while ($attachrow = $db->sql_fetchrow($result)) { if (isset($attachments['_' . $attachrow['attach_id']])) { if ($attachrow['comment'] != $attachments['_' . $attachrow['attach_id']]['comment'] || $attachrow['download_count'] != $attachments['_' . $attachrow['attach_id']]['download_count']) { $sql = "UPDATE " . ATTACHMENTS_DESC_TABLE . " \n\t\t\t\t\tSET comment = '" . attach_mod_sql_escape($attachments['_' . $attachrow['attach_id']]['comment']) . "', download_count = " . (int) $attachments['_' . $attachrow['attach_id']]['download_count'] . "\n\t\t\t\t\tWHERE attach_id = " . (int) $attachrow['attach_id']; if (!$db->sql_query($sql)) { message_die(GENERAL_ERROR, 'Couldn\'t update Attachments Informations', '', __LINE__, __FILE__, $sql); } } } } $db->sql_freeresult($result); } // Statistics if ($view == 'stats') { $template->set_filenames(array('body' => 'admin/attach_cp_body.tpl')); $upload_dir_size = get_formatted_dirsize(); if ($attach_config['attachment_quota'] >= 1048576) { $attachment_quota = round($attach_config['attachment_quota'] / 1048576 * 100) / 100 . ' ' . $lang['MB']; } else { if ($attach_config['attachment_quota'] >= 1024) { $attachment_quota = round($attach_config['attachment_quota'] / 1024 * 100) / 100 . ' ' . $lang['KB']; } else { $attachment_quota = $attach_config['attachment_quota'] . ' ' . $lang['Bytes']; } } $sql = "SELECT count(*) AS total\n\t\tFROM " . ATTACHMENTS_DESC_TABLE; if (!($result = $db->sql_query($sql))) { message_die(GENERAL_ERROR, 'Error getting total attachments', '', __LINE__, __FILE__, $sql); } $total = $db->sql_fetchrow($result); $db->sql_freeresult($result);
FROM ' . USERS_TABLE . ' WHERE user_id = ' . $newest_uid . ' LIMIT 1'; $result = $stat_db->sql_query($sql); $row = $stat_db->sql_fetchrow($result); $newest_user_date = $row['user_regdate']; // Most Online data $sql = "SELECT *\n\tFROM " . CONFIG_TABLE . "\n\tWHERE config_name = 'record_online_users' OR config_name = 'record_online_date'"; $result = $stat_db->sql_query($sql); $row = $stat_db->sql_fetchrowset($result); $most_users_date = $lang['Not_available']; $most_users = $lang['Not_available']; for ($i = 0; $i < sizeof($row); $i++) { if (intval($row[$i]['config_value']) > 0 && $row[$i]['config_name'] == 'record_online_date') { $most_users_date = create_date($config['default_dateformat'], intval($row[$i]['config_value']), $config['board_timezone']); } elseif (intval($row[$i]['config_value']) > 0 && $row[$i]['config_name'] == 'record_online_users') { $most_users = intval($row[$i]['config_value']); } } $statistic_array = array($lang['Number_posts'], $lang['Posts_per_day'], $lang['Number_topics'], $lang['Topics_per_day'], $lang['Number_users'], $lang['Users_per_day'], $lang['Board_started'], $lang['Board_Up_Days'], $lang['Database_size'], $lang['Avatar_dir_size'], $lang['Latest_Reg_User_Date'], $lang['Latest_Reg_User'], $lang['Most_Ever_Online_Date'], $lang['Most_Ever_Online'], $lang['Gzip_compression']); $value_array = array($total_posts, $posts_per_day, $total_topics, $topics_per_day, $total_users, $users_per_day, $start_date, sprintf('%.2f', $boarddays), $dbsize, $avatar_dir_size, create_date($config['default_dateformat'], $newest_user_date, $config['board_timezone']), $newest_user, $most_users_date, $most_users, $config['gzip_compress'] ? $lang['Enabled'] : $lang['Disabled']); // Disk Usage, if Attachment Mod is installed if ($attachment_mod_installed) { $disk_usage = get_formatted_dirsize(); $statistic_array[] = $lang['Disk_usage']; $value_array[] = $disk_usage; } $template->_tpldata['adminrow.'] = array(); for ($i = 0; $i < sizeof($statistic_array); $i += 2) { $template->assign_block_vars('adminrow', array('STATISTIC' => $statistic_array[$i], 'VALUE' => $value_array[$i], 'STATISTIC2' => isset($statistic_array[$i + 1]) ? $statistic_array[$i + 1] : '', 'VALUE2' => isset($value_array[$i + 1]) ? $value_array[$i + 1] : '')); }