Beispiel #1
0
function checkExpiration()
{
    global $noahsHost, $noahsVersionCheckScript, $item_typ, $fatherCatList;
    $_S =& new Settings();
    $timeBeforeExp = Date::add($_S->expNoticeBefore, Date_Day);
    $query = "SELECT id, cid FROM @item WHERE " . "expirationTime!=0 AND expEmailSent=0 AND status=1 AND expirationTime<'" . $timeBeforeExp->getDbFormat() . "' ORDER BY cid ASC";
    G::load($items, $query);
    G::load($n, Notification_adExpired, "notification");
    if ($n->active) {
        for ($i = 0; $i < count($items); $i++) {
            if ($i && $items[$i]->cid != $items[$i - 1]->cid) {
                include "item_typ.php";
                $fatherCatList = 0;
            }
            $ownerEmail = $items[$i]->getEmailParams($params);
            $n->send($ownerEmail, $params);
            executeQuery("UPDATE @item SET expEmailSent=1 WHERE id=" . $items[$i]->id);
        }
    }
    $_GS = new GlobalStat();
    if (!$_GS->reg) {
        $_GS->reg = md5(uniqid(rand(), true));
        modify($_GS);
    }
    $ck = new CheckConf();
    $data = $ck->getTransferData($_GS);
    $ck->getVersionInfo($noahsHost, "POST", $noahsVersionCheckScript, $data);
    return count($items);
}
Beispiel #2
0
 function checkForUpdates()
 {
     global $noahsHost, $noahsVersionCheckScript, $now, $siteDemo;
     $_S =& new AppSettings();
     if ($_S->updateCheckInterval && !$siteDemo) {
         $_GS = new GlobalStat();
         if ($_GS->lastUpdateCheck->isEmpty() || $_GS->lastUpdateCheck->getDayDiff() >= $_S->updateCheckInterval) {
             $cc = new CheckConf();
             if (($latestVersionInfo = $cc->getVersionInfo($noahsHost, "POST", $noahsVersionCheckScript, "")) === FALSE) {
                 return;
                 // connection error - we will try next time
             } else {
                 // sets $response and $latestVersion:
                 $latestVersionInfo = explode("Version-Info:", $latestVersionInfo);
                 eval($latestVersionInfo[1]);
                 if ($latestVersion != $_GS->instver) {
                     $this->nextAction =& new AppController("checkconf/updates");
                 }
                 $_GS->lastUpdateCheck = $now;
                 modify($_GS);
             }
         }
     }
 }