Esempio n. 1
0
File: Dow.php Progetto: Eupeodes/gh
 public function view($url)
 {
     if (preg_match('/^\\/dow(.php)?\\/' . \lib\RegExp::date(true, true) . \lib\RegExp::ext(true) . '$/', $url, $matches)) {
         if (\lib\RegExp::partExists('d', $matches)) {
             $dt_start = new \DateTime($matches['y'] . '-' . $matches['m'] . '-' . $matches['d']);
             $dt_end = null;
         } elseif (\lib\RegExp::partExists('m', $matches)) {
             $dt_start = new \DateTime($matches['y'] . '-' . $matches['m'] . '-01');
             $dt_end = new \DateTime($matches['y'] . '-' . $matches['m'] . '-' . cal_days_in_month(CAL_GREGORIAN, $matches['m'], $matches['y']));
         } else {
             $dt_start = new \DateTime($matches['y'] . '-01-01');
             $dt_end = new \DateTime($matches['y'] . '-12-31');
         }
         $ext = \lib\RegExp::partExists('ext', $matches) ? $matches['ext'] : null;
         $dow = \model\Dow::get($dt_start, $dt_end);
         if ($dow === false) {
             \lib\Error::send(404, 'This dow is not available');
         } else {
             $this->display($dow, $ext);
         }
     } else {
         \lib\Error::send(404, 'No valid url, use <u>/dow/&lt;yyyy&gt;[/&lt;mm&gt;[/&lt;dd&gt;]]</u>');
     }
 }
Esempio n. 2
0
File: Hash.php Progetto: Eupeodes/gh
 private function doCalc()
 {
     $this->output = ['date' => $this->date->format('Y-m-d'), 'east' => null, 'west' => null, 'global' => null];
     $dow = \model\Dow::get($this->date);
     $dateTimeDayBefore = clone $this->date;
     $dateTimeDayBefore->modify('-1 day');
     $dowDayBefore = \model\Dow::get($dateTimeDayBefore);
     if ($dow !== false) {
         $this->output['west'] = new \model\Hash($this->date, $dow);
     }
     if ($this->date->format('Y-m-d') < '2008-05-27') {
         $this->output['east'] = $this->output['west'];
         if ($dowDayBefore !== false) {
             $this->output['global'] = new \model\Hash($this->date, $dowDayBefore, true);
         }
     } else {
         if ($dowDayBefore !== false) {
             $this->output['east'] = new \model\Hash($this->date, $dowDayBefore);
             $this->output['global'] = new \model\Hash($this->date, $dowDayBefore, true);
         }
     }
 }
Esempio n. 3
0
File: cron.php Progetto: 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();