Ejemplo n.º 1
0
if (is_file($crontabFile)) {
    include $crontabFile;
}
if (WEB_CRONTAB && is_writable($crontabFile) && ((!isset($crontab) || $crontab['date_last_success'] != getDateFromTimestamp(time())) && (!is_file($crontabFile) || isset($crontab) && $crontab['time_last_try'] < time() - TIME_TO_WAIT_FOR_PARALLEL_ARCHIVE))) {
    $crontab['time_last_try'] = time();
    $crontab['date_last_success'] = '2000-12-31';
    saveConfigFile($crontabFile, $crontab, "crontab");
    printDebug('==========================<br>
				CRONTAB BEGIN/			  <br>
				==========================<br>
				');
    require_once INCLUDE_PATH . '/core/include/PmvConfig.class.php';
    require_once INCLUDE_PATH . '/core/include/ApplicationController.php';
    $r =& Request::getInstance();
    $r->setModuleName('send_mail');
    $r->setCrontabAllowed();
    ApplicationController::init();
    printDebug('==========================<br>
				CRONTAB END/			  <br>
				==========================<br>
				');
    $crontab['date_last_success'] = getDateFromTimestamp(time());
    saveConfigFile($crontabFile, $crontab, "crontab");
}
$db->close();
redirectToUrlIfNecessary();
loadImage($logo, $idSite);
// flush content for display
if (DEBUG) {
    ob_end_flush();
}
/**
* exit the script of the ip is recorded as an ip to exclude
* or if the ip is in any range of ip to exclude for this site
* 
* @param int $ip2long ip2long version of ip
* @param string $logo logo name '1.png' necessary if we exit the script
* @param int $idSite
* 
* @return true or calls loadImage() and exit
*/
function exitIfIpExcluded($ip2long, $logo, &$o_site)
{
    printDebug("ip:" . $ip2long);
    // look into the cookie for $a_ipToIgnore
    $a_ipToIgnore = $o_site->getIpArray();
    if (isset($a_ipToIgnore) && sizeof($a_ipToIgnore) >= 1) {
        $i = 0;
        // is the ip excludable ?
        while ($i < sizeof($a_ipToIgnore)) {
            $ip1 = $a_ipToIgnore[$i][0];
            $ip2 = $a_ipToIgnore[$i][1];
            if ($ip2long >= $ip1 && $ip2long <= $ip2 || $ip2long == $ip1 || $ip2long == $ip2) {
                printDebug("<b>=> Ip is excluded, exit</b><br>");
                redirectToUrlIfNecessary();
                loadImage($logo, $o_site->getId());
            }
            $i++;
        }
    }
    printDebug("<b>=> Ip is not excluded</b><br>");
    return true;
}