root/dev/cron/cron_import.php @ 365

Revision 365, 2.6 KB (checked in by exi, 12 years ago)

Updated included EVEAPI to 2.71
Included a mod_xajax compatible apiuser mod
Tweaked some code of the apiuser mod (menu, xajax, templates)
Removed the post.php from the xajax mod.

Line 
1#!/usr/bin/php
2<?php
3@error_reporting(E_ALL ^ E_NOTICE);
4//
5// Simple Cronjob script - set it to run this, no more than once an hour as you can only pull info once an hour anyway
6// by Captain Thunk! (ISK donations are all gratefully received)
7//
8
9@set_time_limit(0);
10
11// Edit the path below with your webspace directory to the killboard root folder - also check your php folder is correct as defined by the first line of this file
12
13$KB_HOME = "/home/thunkage/public_html/kb";
14chdir($KB_HOME); 
15//chdir('/../'); // finds Killboard root assuming that the we've started where we're supposed to start (<kb root>/cron) - if this fails comment out and uncomment two lines above and edit path to correct path
16
17require_once( "kbconfig.php" );
18require_once( "common/includes/class.config.php" );
19require_once( "common/includes/class.event.php" );
20require_once( "common/includes/globals.php" );
21require_once( "common/includes/class.eveapi.php" );
22require_once( "common/includes/db.php" );
23
24$config = new Config(KB_SITE);
25if (((bool)config::get('cfg_memcache')) === true)
26{
27        require_once('common/includes/class.db_memcache.php');
28        $mc = new Memcache();
29        $mc->connect(config::get('cfg_memcache_server'), config::get('cfg_memcache_port'));
30}
31
32define('KB_TITLE', config::get('cfg_kbtitle'));
33
34// corporation OR alliance id
35if (config::get('cfg_corpid'))
36{
37    define('CORP_ID', config::get('cfg_corpid'));
38    define('ALLIANCE_ID', 0);
39} else {
40    define('CORP_ID', 0);
41    define('ALLIANCE_ID', config::get('cfg_allianceid'));
42}
43
44if (!$dir = config::get('cache_dir'))
45{
46    $dir = 'cache/data';
47}
48define('KB_CACHEDIR', $dir);
49
50$outhead = "Running API Mod ". APIVERSION . " on " . gmdate("M d Y H:i") . "\n\n";
51$out = '';
52
53$myEveAPI = new API_KillLog();
54$myEveAPI->iscronjob_ = true;
55
56$keycount = config::get('API_Key_count');
57
58for ($i = 1; $i <= $keycount; $i++)
59{
60    $keyindex = $i;
61    $myEveAPI->Output_ = "Importing Mails for " . $config->get("API_Name_" . $i);
62        $myEveAPI->Output_ .= "\n";
63    $typestring = $config->get("API_Type_" . $i);
64    $keystring = 'userID=' . $config->get('API_UserID_' . $i) . '&apiKey=' . $config->get('API_Key_' . $i) . '&characterID=' . $config->get('API_CharID_' . $i);
65    $outtemp .= $myEveAPI->Import($keystring, $typestring, $keyindex);
66        config::set('API_CachedUntil_' . $keyindex, $myEveAPI->cachetext_);
67}
68$out = $outtemp;
69
70if ($out)
71{
72    $out = str_replace("<div class=block-header2>","",$out);
73    $out = str_replace("</div>","\n",$out);
74    $out = str_replace("<br>","\n",$out);
75
76    //print $outhead . strip_tags($out, '<a>');
77    print $outhead . strip_tags($out);
78}
79?>
Note: See TracBrowser for help on using the browser.