| 1 |
<?
|
| 2 |
if (!isset($_SERVER["argc"]))
|
| 3 |
$_SERVER["argc"] = 0;
|
| 4 |
|
| 5 |
switch($_SERVER["argc"])
|
| 6 |
{
|
| 7 |
case 2:
|
| 8 |
$begin_date = strtotime($_SERVER["argv"][1])-60*60*24*7;
|
| 9 |
$end_date = strtotime($_SERVER["argv"][1]);
|
| 10 |
break;
|
| 11 |
case 3:
|
| 12 |
$begin_date = strtotime($_SERVER["argv"][1]);
|
| 13 |
$end_date = strtotime($_SERVER["argv"][2]);
|
| 14 |
break;
|
| 15 |
default:
|
| 16 |
if (isset($_POST["begin_date"]))
|
| 17 |
{
|
| 18 |
$begin_date = strtotime($_POST["begin_date"]);
|
| 19 |
}
|
| 20 |
else
|
| 21 |
{
|
| 22 |
$begin_date = time();
|
| 23 |
}
|
| 24 |
if (isset($_POST["end_date"]))
|
| 25 |
{
|
| 26 |
$end_date = strtotime($_POST["end_date"]);
|
| 27 |
}
|
| 28 |
else
|
| 29 |
{
|
| 30 |
$end_date = $begin_date;
|
| 31 |
$begin_date -= 60*60*24*7;
|
| 32 |
}
|
| 33 |
}
|
| 34 |
|
| 35 |
if (isset($_SERVER["argv"][0]))
|
| 36 |
chdir(substr($_SERVER["argv"][0],0,strrpos($_SERVER["argv"][0],"/")));
|
| 37 |
|
| 38 |
require_once "./session_init.inc.php";
|
| 39 |
|
| 40 |
//Set data for session
|
| 41 |
$_SESSION["MNG_uid"]=-1;
|
| 42 |
$_SESSION["MNG_priv"]["article_audit"]=1;
|
| 43 |
|
| 44 |
//Set $date for article_daily_stat.php
|
| 45 |
for($date=$begin_date;$date<=$end_date;$date+=(60*60*24))
|
| 46 |
{
|
| 47 |
echo ("Generating <".date("Y-m-d",$date).".xml> ...\n");
|
| 48 |
include "./article_daily_stat.php";
|
| 49 |
}
|
| 50 |
|
| 51 |
session_unset();
|
| 52 |
session_destroy();
|
| 53 |
?>
|