public static function importhandler($object) { if (config::get('forward_active') == false) { return; } require_once 'common/includes/class.http.php'; $req = new http_request(config::get('forward_site') . '?a=post'); $req->set_postform('password', config::get('forward_pass')); $req->set_postform('killmail', stripslashes($object->killmail_)); $req->request(); }
function loaddata($keystring, $typestring) { $configvalue = $this->API_characterID_ . '_Standings'; $UseCaching = config::get('API_UseCache'); $url = API_SERVER . "/" . $typestring . "/Standings.xml.aspx" . $keystring; $path = "/" . $typestring . "/Standings.xml.aspx"; if (is_file(KB_CACHEDIR . '/api/' . $configvalue . '.xml')) { $cacheexists = true; } else { $cacheexists = false; } if (strtotime(gmdate("M d Y H:i:s")) - strtotime($CachedTime) > 0 || $UseCaching == 1 || !$cacheexists) { $http = new http_request($url); $http->set_useragent("PHPApi"); foreach ($keystring as $key => $val) { $http->set_postform($key, $val); } $contents = $http->get_content(); $start = strpos($contents, "?>"); if ($start !== FALSE) { $contents = substr($contents, $start + strlen("\r\n\r\n")); } if ($UseCaching == 0) { $file = fopen(KB_CACHEDIR . '/api/' . $configvalue . '.xml', 'w+'); fwrite($file, $contents); fclose($file); @chmod(KB_CACHEDIR . '/api/' . $configvalue . '.xml', 0666); } } else { // re-use cached XML if ($fp = @fopen(KB_CACHEDIR . '/api/' . $configvalue . '.xml', 'r')) { $contents = fread($fp, filesize(KB_CACHEDIR . '/api/' . $configvalue . '.xml')); fclose($fp); } else { return "<i>error loading cached file " . $configvalue . ".xml</i><br><br>"; } } return $contents; }
function loaddata($keystring) { $configvalue = $this->CharName_ . '_CharacterSheet'; $CachedTime = ApiCache::get($configvalue); $UseCaching = config::get('API_UseCache'); $url = API_SERVER . "/char/CharacterSheet.xml.aspx" . $keystring; $path = '/char/CharacterSheet.xml.aspx'; // API Caching system, If we're still under cachetime reuse the last XML, if not download the new one. Helps with Bug hunting and just better all round. if ($CachedTime == "") { $CachedTime = "2005-01-01 00:00:00"; // fake date to ensure that it runs first time. } if (is_file(KB_CACHEDIR . '/api/' . $configvalue . '.xml')) { $cacheexists = true; } else { $cacheexists = false; } // if API_UseCache = 1 (off) then don't use cache if (strtotime(gmdate("M d Y H:i:s")) - strtotime($CachedTime) > 0 || $UseCaching == 1 || !$cacheexists) { $http = new http_request($url); $http->set_useragent("PHPApi"); foreach ($keystring as $key => $val) { $http->set_postform($key, $val); } $contents = $http->get_content(); $start = strpos($contents, "?>"); if ($start !== FALSE) { $contents = substr($contents, $start + strlen("\r\n\r\n")); } // Save the file if we're caching (0 = true in Thunks world) if ($UseCaching == 0) { $file = fopen(KB_CACHEDIR . '/api/' . $configvalue . '.xml', 'w+'); fwrite($file, $contents); fclose($file); @chmod(KB_CACHEDIR . '/api/' . $configvalue . '.xml', 0666); } } else { // re-use cached XML if ($fp = @fopen(KB_CACHEDIR . '/api/' . $configvalue . '.xml', 'r')) { $contents = fread($fp, filesize(KB_CACHEDIR . '/api/' . $configvalue . '.xml')); fclose($fp); } else { return "<i>error loading cached file " . $configvalue . ".xml</i><br><br>"; } } return $contents; }