function tx_mcgooglesitemapmod_base($cObj, $type = 0)
 {
     $this->cObj =& $cObj;
     ini_Set("max_execution_time", 120);
     $GLOBALS["TSFE"]->set_no_cache();
     $this->act = array("1" => "Always", "2" => "Hourly", "3" => "Daily", "4" => "Weekly", "5" => "Monthly", "6" => "Yearly", "7" => "Never");
     header('Content-type: text/xml');
     $head[] = '<?xml version="1.0" encoding="UTF-8"?>';
     if ($type != 2) {
         #$head[]='<urlset xmlns="http://www.google.com/schemas/sitemap/0.84">'."\n";
         $head[] = '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n";
     } else {
         #$head[]='<sitemapindex xmlns="http://www.google.com/schemas/sitemap/0.84">'."\n";
         $head[] = '<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n";
     }
     echo implode("\n", $head);
     unset($head);
     $tmp = explode("/", $GLOBALS['_SERVER']['PHP_SELF']);
     unset($tmp[0]);
     unset($tmp[count($tmp)]);
     $path = implode("/", $tmp);
     if (strlen($path) != 0) {
         $path .= "/";
     }
     $host = $_SERVER['HTTP_X_FORWARDED_HOST'];
     if (!$host) {
         $host = $_SERVER['HTTP_HOST'];
     }
     $this->baseUrl = 'http://' . $host . '/' . $path;
     if ($this->cObj->data['tx_mcgooglesitemapmod_lastmod'] == 1) {
         $this->dateFormat = 'Y-m-d\\TH:i:s\\Z';
     } else {
         $this->dateFormat = "Y-m-d";
     }
     if ($type == 0) {
         $this->sitemapContent();
     } elseif ($type == 2) {
         $this->sitemapIndex();
     } else {
         $this->sitemapPage();
     }
     echo "</urlset>\n";
     exit;
 }
Example #2
0
#!/usr/bin/php
<?php 
set_time_limit(0);
ini_set('memory_limit', '25M');
//TODO: need to change this?  let individual plugings control it too is good
ini_set('display_errors', 'true');
ini_set('error_reporting', E_ALL);
ini_Set('display_startup_errors', 'On');
//classes
class_exists('Settings', false) or (include './classes/Settings.class.php');
class_exists('MySQL', false) or (include './classes/MySQL.class.php');
class_exists('PHPMailer', false) or (include './classes/Phpmailer.class.php');
class_exists('Timer', false) or (include './classes/Timer.class.php');
//load settings
$settings = Settings::getSettings();
//don't do this everytime so rand  - which probably isnt that bad
if (rand(1, 50) === 1) {
    echo "clearing logging table....\n";
    $mysql = new MySQL();
    $mysql->runQuery("delete from logging where DATE_ADD(dateTime, INTERVAL " . $settings['flushLogsDays'] . " DAY) < now();");
    $mysql->close();
}
$cronIterations = 0;
$mysql = new MySQL();
$rs = $mysql->runQuery("select cronIterations from settings;");
if ($row = mysql_fetch_array($rs, MYSQL_ASSOC)) {
    $cronIterations = $row['cronIterations'];
}
$mysql->close();
//this script run's till there is no more work to do
for ($i = 1; $i <= $cronIterations; $i++) {