$endunixstr) {
showmessage('start_time_is_greater_than_end_time', NULL, array(), array('return' => true));
} else if ($beginunixstr == $endunixstr) {
showmessage('start_time_end_time_is_equal_to', NULL, array(), array('return' => true));
}
if (!empty($_GET['xml'])) {
$xaxis = '';
$graph = array();
$count = 1;
$begin = dgmdate($beginunixstr, 'Ymd');
$end = dgmdate($endunixstr, 'Ymd');
$field = '*';
if (!empty($_GET['merge'])) {
if (empty($_GET['types'])) {
$_GET['types'] = array_merge($cols['login'], $cols['forum'], $cols['tgroup'], $cols['home'], $cols['space']);
}
if (!array_diff($_GET['types'], array_merge($cols['login'], $cols['forum'], $cols['tgroup'], $cols['home'], $cols['space']))) {
$field = 'daytime,`' . implode('`+`', $_GET['types']) . '` AS statistic';
}
$type = 'statistic';
}
foreach (C::t('common_stat')->fetch_all($begin, $end, $field) as $value) {
$xaxis .= "" . substr($value['daytime'], 4, 4) . "";
if ($type == 'all') {
foreach ($cols as $ck => $cvs) {
if ($ck == 'login') {
$graph['login'] .= "$value[login]";
$graph['register'] .= "$value[register]";
} else {
$num = 0;
foreach ($cvs as $cvk) {
$num = $value[$cvk] + $num;
}
$graph[$ck] .= "" . $num . "";
}
}
} else {
if (empty($_GET['types']) || !empty($_GET['merge'])) {
$graph[$type] .= "" . $value[$type] . "";
} else {
foreach ($_GET['types'] as $t) {
$graph[$t] .= "" . $value[$t] . "";
}
}
}
$count++;
}
$xml = '';
$xml .= '<' . "?xml version=\"1.0\" encoding=\"utf-8\"?>";
$xml .= '';
$xml .= $xaxis;
$xml .= "";
$count = 0;
foreach ($graph as $key => $value) {
$xml .= "";
$xml .= $value;
$xml .= '';
$count++;
}
$xml .= '';
@header("Expires: -1");
@header("Cache-Control: no-store, private, post-check=0, pre-check=0, max-age=0", FALSE);
@header("Pragma: no-cache");
@header("Content-type: application/xml; charset=utf-8");
echo $xml;
exit();
}
$actives = array($type => ' class="a"');
require_once libfile('function/home');
$siteurl = getsiteurl();
$types = '';
$merge = !empty($_GET['merge']) ? '&merge=1' : '';
foreach ($_GET['types'] as $value) {
$types .= '&types[]=' . $value;
$actives[$value] = ' class="a"';
}
$statuspara = "path=&settings_file=data/stat_setting.xml&data_file=" . urlencode("misc.php?mod=stat&op=trend&xml=1&type=$type&primarybegin=$primarybegin&primaryend=$primaryend{$types}{$merge}&hash=$stat_hash");
include template('home/misc_stat');