コード例 #1
0
ファイル: Dow.php プロジェクト: Eupeodes/gh
 public static function getNew()
 {
     $file = explode('/', dirname(__FILE__));
     array_pop($file);
     $response = false;
     if (debug_backtrace()[0]['file'] === implode('/', $file) . '/cron.php') {
         $db = \lib\Db::getInstance();
         $date = \model\Date::max(false);
         if (\model\Date::nextCheck($date, 0) <= 0) {
             $dateTime = new \DateTime($date);
             $req = $db->prepare('INSERT INTO dow VALUES (:date, :dow)');
             while (true) {
                 $url = "http://geo.crox.net/djia/" . str_replace("-", "/", $date);
                 $ch = curl_init();
                 curl_setopt($ch, CURLOPT_URL, $url);
                 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
                 curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, true);
                 $dow = curl_exec($ch);
                 curl_close($ch);
                 if ($dow > 0) {
                     $req->execute([':date' => $date, ':dow' => $dow]);
                     $response = true;
                     $dateTime->add(new \DateInterval('P1D'));
                     $date = $dateTime->format('Y-m-d');
                 } else {
                     break;
                 }
             }
         }
     }
     return $response;
 }
コード例 #2
0
ファイル: MaxDate.php プロジェクト: Eupeodes/gh
 public function view()
 {
     $maxDate = \model\Date::max();
     $nextCheck = \model\Date::nextCheck($maxDate);
     $output = array('maxDate' => $maxDate, 'nextCheck' => $nextCheck);
     header('Content-Type: application/json');
     echo json_encode($output);
 }
コード例 #3
0
ファイル: IrcBot.php プロジェクト: Eupeodes/gh
 private function globalToday()
 {
     $req = $this->db->prepare('SELECT val FROM conf WHERE field=\'last_global\'');
     $req->execute();
     $last_global = $req->fetch(PDO::FETCH_OBJ)->val;
     if ($last_global < date('Y-m-d')) {
         $dateTime = new \DateTime();
         $dateTime->setTimezone(new \DateTimeZone('America/New_York'));
         $time = $dateTime->format('Gi');
         if (\model\Date::max() > date('Y-m-d') && $time == 600 || \model\Date::max() <= date('Y-m-d') && $time == 930) {
             $hash = new \view\Hash();
             $data = $hash->getGlobal(date('Y-m-d'))['global'];
             $this->sendGlobal($data, date('Y-m-d'));
         }
     }
 }
コード例 #4
0
ファイル: Index.php プロジェクト: Eupeodes/gh
 public function view($url)
 {
     $this->url = $url;
     $this->settings = ['home' => '[0,0]', 'center' => '[0,0]', 'grid' => '[0,0]', 'single' => false, 'zoom' => 8, 'type' => 'map', 'dayOf' => 'month', 'colorSet' => '0ff', 'controlsVisible' => true, 'resetSetHomeGrid' => true];
     $cookie = filter_input(INPUT_COOKIE, 'config');
     if (!is_null($cookie)) {
         $this->parseCookie($cookie);
     }
     $this->maxDate = \model\Date::max();
     $this->version = file_get_contents('../version');
     if (!empty(filter_input_array(INPUT_GET))) {
         $this->readGet();
     }
     if (!$this->set) {
         $this->readPath();
     }
     if ($this->homeSet || $this->centerSet || $this->gridSet) {
         $this->cookie = [];
     }
     $this->setLocation('home');
     $this->setLocation('center');
     $this->setLocation('grid');
     require '../template/index.tpl.php';
 }
コード例 #5
0
ファイル: Cache.php プロジェクト: Eupeodes/gh
 public static function tillDow()
 {
     $maxDate = \model\Date::max();
     $nextCheck = \model\Date::nextCheck($maxDate);
     header('Cache-Control: public, max-age=' . $nextCheck);
 }
コード例 #6
0
ファイル: cron.php プロジェクト: Eupeodes/gh
<?php

spl_autoload_register(function ($className) {
    require_once dirname(__FILE__) . '/' . str_replace('\\', '/', $className) . '.php';
});
define('BASE_DIR', dirname(__FILE__));
$twitter = new \cron\Twitter();
$ircBot = new \cron\IrcBot();
$ircBot->cron();
//do all the daily stuff if new dow is available
$dowDate = \model\Date::max();
if (\model\Dow::getNew()) {
    $twitter->dailyCoords($dowDate);
    $ircBot->dailyCoords($dowDate);
}
$wiki = new \cron\Wiki();
$wiki->cron();
$twitter->sendQueue();
コード例 #7
0
ファイル: index.tpl.php プロジェクト: Eupeodes/gh
					minZoom: 1,
					maxZoom: 19,
					minDate: '<?php 
echo \model\Date::min();
?>
',
					maxDate: '<?php 
echo $this->maxDate;
?>
',
					date: '<?php 
echo $this->date;
?>
',
					refreshMaxDate: '<?php 
echo \model\Date::nextCheck($this->maxDate);
?>
',
					bingKey: '<?php 
echo \config::$keys['bing'];
?>
',
					showDisclaimer: <?php 
echo $this->showDisclaimer ? 'true' : 'false';
?>
				},
				user: {
					home: <?php 
echo $this->settings['home'];
?>
,