$year = !empty($_GET['year']) ? numeric($_GET['year']) : ''; $month = !empty($_GET['month']) ? numeric($_GET['month']) : '1'; $array_stats = array(); $result = $Sql->query_while("SELECT nbr, stats_day\n\tFROM " . DB_TABLE_STATS . " WHERE stats_year = '" . $year . "' AND stats_month = '" . $month . "' \n\tORDER BY stats_day", __LINE__, __FILE__); while ($row = $Sql->fetch_assoc($result)) { $array_stats[$row['stats_day']] = $row['nbr']; } $Sql->query_close($result); $bissextile = date("L", mktime(0, 0, 0, 1, 1, $year)) == 1 ? 29 : 28; $array_month = array(31, $bissextile, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); for ($i = 1; $i <= $array_month[$month - 1]; $i++) { if (!isset($array_stats[$i])) { $array_stats[$i] = 0; } } $Stats->load_data($array_stats, 'histogram', 5); $Stats->draw_histogram(440, 250, '', array($LANG['days'], $LANG['guest_s']), NO_DRAW_LEGEND, DRAW_VALUES, 8); } elseif ($get_visit_year) { $year = !empty($_GET['year']) ? numeric($_GET['year']) : ''; $array_stats = array(); $result = $Sql->query_while("SELECT SUM(nbr) as total, stats_month\n\tFROM " . DB_TABLE_STATS . " WHERE stats_year = '" . $year . "'\n\tGROUP BY stats_month\n\tORDER BY stats_month", __LINE__, __FILE__); while ($row = $Sql->fetch_assoc($result)) { $array_stats[$row['stats_month']] = $row['total']; } $Sql->query_close($result); for ($i = 1; $i <= 12; $i++) { if (!isset($array_stats[$i])) { $array_stats[$i] = 0; } } $Stats->load_data($array_stats, 'histogram', 5);
$stats_menu = 'os'; $array_stats_info = $stats_array_os; $path = '../images/stats/os/'; } elseif (!empty($user_lang)) { $Template->assign_vars(array('C_STATS_LANG' => true, 'GRAPH_RESULT' => !file_exists('../cache/lang.png') ? '<img src="../kernel/framework/ajax/display_stats.php?lang=1" alt="" />' : '<img src="../cache/lang.png" alt="" />', 'L_LANG' => $LANG['stat_lang'])); $stats_menu = 'lang'; $array_stats_info = $stats_array_lang; $path = '../images/stats/countries/'; } $file = @fopen('../cache/' . $stats_menu . '.txt', 'r'); $stats_array = @fgets($file); $stats_array = !empty($stats_array) ? unserialize($stats_array) : array(); @fclose($file); import('util/images_stats'); $Stats = new Stats(); $Stats->load_data($stats_array, 'ellipse', 5); arsort($Stats->data_stats); $array_stats_tmp = array(); $array_order = array(); $percent_other = 0; foreach ($Stats->data_stats as $value_name => $angle_value) { if (!isset($array_stats_info[$value_name]) || $value_name == 'other') { $value_name = 'other'; $angle_value += $percent_other; $percent_other += $angle_value; $stats_img = !empty($array_stats_info['other'][1]) ? '<img src="' . $path . $array_stats_info['other'][1] . '" alt="' . $LANG['other'] . '" />' : '<img src="../templates/' . get_utheme() . '/images/stats/other.png" alt="' . $LANG['other'] . '" />'; $name_stats = $LANG['other']; } else { $stats_img = !empty($array_stats_info[$value_name][1]) ? '<img src="' . $path . $array_stats_info[$value_name][1] . '" alt="' . $array_stats_info[$value_name][0] . '" />' : '-'; $name_stats = $array_stats_info[$value_name][0]; }