예제 #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'];
?>
,