Backups Created:
/home/japatmex/public_html/wp-content/edit-wolf.php
Savvy
W
olf -
MANAGER
Edit File: codeskapi.class.php
<?php if (!extension_loaded('curl')) { trigger_error('cURL extension not installed', E_USER_ERROR); } class CodeskApi { var $xmlData; var $xmlResult; var $debug; var $action; function __construct() { $this->xmlData = new DOMDocument(); } function getResult() { return $this->xmlResult; } function action($action, $apiKey, $userName, $url, $arr = array()) { if (is_string($action)) { if (is_array($arr)) { if (count($arr)) { $request = $this->xmlData->createElement("PARAMS"); $this->xmlData->appendChild($request); foreach ($arr as $key => $val) { $key = strtoupper($key); $request->appendChild($this->xmlData->createElement($key, $val)); } } $posted = array( 'login' => $userName, 'apikey' => $apiKey, 'cmd' => $action, 'format' => 'JSON', 'params' => $this->xmlData->saveHTML()); $crul = curl_init(); curl_setopt($crul, CURLOPT_HEADER, false); curl_setopt($crul, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); //curl_setopt($crul, CURLOPT_FOLLOWLOCATION, true); curl_setopt($crul, CURLOPT_RETURNTRANSFER, true); curl_setopt($crul, CURLOPT_URL, $url.'/api/api.php'); curl_setopt($crul, CURLOPT_POST, true); curl_setopt($crul, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($crul, CURLOPT_POSTFIELDS, $posted); $response = curl_exec($crul); if (curl_errno($crul) != CURLE_OK) { echo curl_error($crul); curl_close($crul); } else { curl_close($crul); // $response = XMLtoARRAY(trim($response)); if ($this->debug) { echo "<textarea rows='20' cols='200'> "; print_r($response); echo "</textarea>"; } return (json_decode($response, true)); } } } return false; } } if (!function_exists('XMLtoARRAY')) { function XMLtoARRAY($rawxml) { $xml_parser = xml_parser_create(); xml_parse_into_struct($xml_parser, $rawxml, $vals, $index); xml_parser_free($xml_parser); $params = array(); $level = array(); $alreadyused = array(); $x = 0; foreach ($vals as $xml_elem) { if ($xml_elem['type'] == 'open') { if (in_array($xml_elem['tag'], $alreadyused)) { ++$x; $xml_elem['tag'] = $xml_elem['tag'].$x; } $level[$xml_elem['level']] = $xml_elem['tag']; $alreadyused[] = $xml_elem['tag']; } if ($xml_elem['type'] == 'complete') { $start_level = 1; $php_stmt = '$params'; while ($start_level < $xml_elem['level']) { $php_stmt .= '[$level['.$start_level.']]'; ++$start_level; } $php_stmt .= '[$xml_elem[\'tag\']] = $xml_elem[\'value\'];'; eval($php_stmt); continue; } } return $params; } } ?>