From 928190dab22d65be0ae577417e5e36463588e062 Mon Sep 17 00:00:00 2001 From: "Paul S. Owen" Date: Fri, 27 Jul 2001 23:29:58 +0000 Subject: [PATCH] Removed header frame, reduced timezone naming, added DB size for MySQL, no major technical changes git-svn-id: file:///svn/phpbb/trunk@754 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/admin/index.php | 294 +++++++++++++++++++++++++++++++++-- phpBB/db/mssql_schema.sql | Bin 38912 -> 40176 bytes phpBB/db/mysql_schema.sql | 1 + phpBB/db/postgres_schema.sql | 63 +++++--- 4 files changed, 319 insertions(+), 39 deletions(-) diff --git a/phpBB/admin/index.php b/phpBB/admin/index.php index 67a905e401..c83ef0a572 100644 --- a/phpBB/admin/index.php +++ b/phpBB/admin/index.php @@ -50,14 +50,7 @@ else if( $userdata['user_level'] != ADMIN ) // // Generate relevant output // -if( $HTTP_GET_VARS['pane'] == 'top' ) -{ - - $template_header = "admin/overall_header.tpl"; - include('page_header_admin.'.$phpEx); - -} -elseif( $HTTP_GET_VARS['pane'] == 'left' ) +if( $HTTP_GET_VARS['pane'] == 'left' ) { $dir = opendir("."); @@ -70,41 +63,311 @@ elseif( $HTTP_GET_VARS['pane'] == 'left' ) } } - $template_header = "admin/page_header.tpl"; include('page_header_admin.'.$phpEx); $template->set_filenames(array( "body" => "admin/navigate.tpl") ); + $template->assign_vars(array( + "U_BOARD_INDEX" => append_sid("../index.$phpEx"), + "U_ADMIN_INDEX" => append_sid("index.$phpEx?pane=right"), + + "L_BOARD_INDEX" => "Board Index", + "L_ADMIN_INDEX" => "Admin Index") + ); + while( list($cat, $action_array) = each($module) ) { $template->assign_block_vars("catrow", array( "CATNAME" => $cat) ); + + $row_count = 0; while( list($action, $file) = each($action_array) ) { + $row_color = "#" . ( ( !($row_count%2) ) ? $theme['td_color1'] : $theme['td_color2']); + $row_class = ( !($row_count%2) ) ? $theme['td_class1'] : $theme['td_class2']; + $template->assign_block_vars("catrow.actionrow", array( + "ROW_COLOR" => $row_color, + "ROW_CLASS" => $row_class, "ACTIONNAME" => $action, "FILE" => $file) ); + $row_count++; } } - //var_dump($module); $template->pparse("body"); - $setmodules = 0; + unset($setmodules); } elseif( $HTTP_GET_VARS['pane'] == 'right' ) { - $template_header = "admin/page_header.tpl"; include('page_header_admin.'.$phpEx); - $from_index = 1; - include('admin_index.'.$phpEx); - + $template->set_filenames(array( + "body" => "admin/admin_index_body.tpl") + ); + + // + // Get forum statistics + // + $total_posts = get_db_stat('postcount'); + $total_users = get_db_stat('usercount'); + $total_topics = get_db_stat('topiccount'); + $start_date = create_date($board_config['default_dateformat'], $board_config['board_startdate'], $board_config['default_timezone']); + + $boarddays = (time() - $board_config['board_startdate']) / (24*60*60); + $posts_per_day = sprintf("%.2f", $total_posts / $boarddays); + $topics_per_day = sprintf("%.2f", $total_topics / $boarddays); + $users_per_day = sprintf("%.2f", $total_users / $boarddays); + + $avatar_dir_size = 0; + + if ($avatar_dir = opendir($phpbb_root_path . $board_config['avatar_path'])) + { + while($file = readdir($avatar_dir)) + { + if($file != "." && $file != "..") + { + $avatar_dir_size += filesize($phpbb_root_path . $board_config['avatar_path'] . "/" . $file); + } + } + closedir($avatar_dir); + } + + // + // This bit of code translates the avatar directory size into human readable format + // Borrowed the code from the PHP.net annoted manual, origanally written by: + // Jesse (jesse@jess.on.ca) + // + if($avatar_dir_size >= 1048576) + { + $avatar_dir_size = round($avatar_dir_size / 1048576 * 100) / 100 . " MB"; + } + else if($avatar_dir_size >= 1024) + { + $avatar_dir_size = round($avatar_dir_size / 1024 * 100) / 100 . " KB"; + } + else + { + $avatar_dir_size = $avatar_dir_size . " Bytes"; + } + + if($posts_per_day > $total_posts) + { + $posts_per_day = $total_posts; + } + + if($topics_per_day > $total_topics) + { + $topics_per_day = $total_topics; + } + + if($users_per_day > $total_users) + { + $users_per_day = $total_users; + } + + // + // DB size ... MySQL only + // + // This code is heavily influenced by a similar routine + // in phpMyAdmin 2.2.0 + // + if(SQL_LAYER == 'mysql') + { + $sql = "SHOW TABLE STATUS FROM " . $dbname; + if(!$result = $db->sql_query($sql)) + { + message_die(GENERAL_ERROR, "Couldn't obtain table information.", "", __LINE__, __FILE__, $sql); + } + $tabledata_ary = $db->sql_fetchrowset($result); + + $dbsize = 0; + for($i = 0; $i < count($tabledata_ary); $i++) + { + if($tabledata_ary[$i]['Type'] != "MRG_MyISAM") + { + $dbsize += $tabledata_ary[$i]['Data_length'] + $tabledata_ary[$i]['Index_length']; + } + } + + if($dbsize >= 1048576) + { + $dbsize = sprintf("%.2f MB", ( $dbsize / 1048576 )); + } + else if($dbsize >= 1024) + { + $dbsize = sprintf("%.2f KB", ( $dbsize / 1024 )); + } + else + { + $dbsize = sprintf("%.2f Bytes", $dbsize); + } + } + else + { + $dbsize = "N/A"; + } + + $template->assign_vars(array( + "NUMBER_OF_POSTS" => $total_posts, + "NUMBER_OF_TOPICS" => $total_topics, + "NUMBER_OF_USERS" => $total_users, + "START_DATE" => $start_date, + "POSTS_PER_DAY" => $posts_per_day, + "TOPICS_PER_DAY" => $topics_per_day, + "USERS_PER_DAY" => $users_per_day, + "AVATAR_DIR_SIZE" => $avatar_dir_size, + "DB_SIZE" => $dbsize) + ); + // + // End forum statistics + // + + // + // Get users online information. + // + $sql = "SELECT u.username, u.user_id, u.user_allow_viewonline, s.session_page, s.session_logged_in, s.session_time, s.session_ip + FROM " . USERS_TABLE . " u, " . SESSIONS_TABLE . " s + WHERE u.user_id = s.session_user_id + AND s.session_time >= " . (time()-300) . " + ORDER BY s.session_time DESC"; + if(!$result = $db->sql_query($sql)) + { + message_die(GENERAL_ERROR, "Couldn't obtain user/online information.", "", __LINE__, __FILE__, $sql); + } + $onlinerow = $db->sql_fetchrowset($result); + + $sql = "SELECT forum_name, forum_id + FROM " . FORUMS_TABLE; + if($forums_result = $db->sql_query($sql)) + { + while($forumsrow = $db->sql_fetchrow($forums_result)) + { + $forum_data[$forumsrow['forum_id']] = $forumsrow['forum_name']; + } + } + else + { + message_die(GENERAL_ERROR, "Couldn't obtain user/online forums information.", "", __LINE__, __FILE__, $sql); + } + + $online_count = $db->sql_numrows($result); + if($online_count) + { + $count = 0; + + for($i = 0; $i < $online_count; $i++) + { + if($onlinerow[$i]['user_id'] != ANONYMOUS) + { + if($onlinerow[$i]['session_logged_in']) + { + $username = $onlinerow[$i]['username']; + } + else + { + $username = $onlinerow[$i]['username']; + } + } + else + { + $username = $lang['Anonymous']; + } + + if($onlinerow[$i]['session_page'] < 1) + { + switch($onlinerow[$i]['session_page']) + { + case PAGE_INDEX: + $location = $lang['Forum_index']; + $location_url = "index.$phpEx"; + break; + case PAGE_POSTING: + $location = $lang['Posting_message']; + $location_url = "index.$phpEx"; + break; + case PAGE_LOGIN: + $location = $lang['Logging_on']; + $location_url = "index.$phpEx"; + break; + case PAGE_SEARCH: + $location = $lang['Searching_forums']; + $location_url = "search.$phpEx"; + break; + case PAGE_PROFILE: + $location = $lang['Viewing_profile']; + $location_url = "index.$phpEx"; + break; + case PAGE_VIEWONLINE: + $location = $lang['Viewing_online']; + $location_url = "viewonline.$phpEx"; + break; + case PAGE_VIEWMEMBERS: + $location = $lang['Viewing_member_list']; + $location_url = "memberlist.$phpEx"; + break; + case PAGE_PRIVMSGS: + $location = $lang['Viewing_priv_msgs']; + $location_url = "privmsg.$phpEx"; + break; + case PAGE_FAQ: + $location = $lang['Viewing_FAQ']; + $location_url = "faq.$phpEx"; + break; + default: + $location = $lang['Forum_index']; + $location_url = "index.$phpEx"; + } + } + else + { + $location_url = append_sid("admin_forum.$phpEx?" . POST_FORUM_URL . "=" . $onlinerow[$i]['session_page']); + $location = $forum_data[$onlinerow[$i]['session_page']]; + } + + $row_color = "#" . ( ( !($count % 2) ) ? $theme['td_color1'] : $theme['td_color2']); + $row_class = ( !($count % 2) ) ? $theme['td_class1'] : $theme['td_class2']; + $count++; + + $ip_address = decode_ip($onlinerow[$i]['session_ip']); + // + // This resolves the users IP to a host name, but it REALLY slows the page down + // + //$host_name = gethostbyaddr($ip_address); + //$ip_address = $ip_address . " ($host_name)"; + + if(empty($username)) + { + $username = $lang['Guest']; + } + + $template->assign_block_vars("userrow", array( + "ROW_COLOR" => $row_color, + "ROW_CLASS" => $row_class, + "USERNAME" => $username, + "LOGGED_ON" => $logged_on, + "LASTUPDATE" => create_date($board_config['default_dateformat'], $onlinerow[$i]['session_time'], $board_config['default_timezone']), + "LOCATION" => $location, + "IPADDRESS" => $ip_address, + "U_USER_PROFILE" => append_sid("admin_user.$phpEx?" . POST_USERS_URL . "=" . $onlinerow[$i]['user_id']), + "U_FORUM_LOCATION" => append_sid($location_url)) + ); + } + } + $template->assign_vars(array("L_USERNAME" => $lang['Username'], + "L_LOCATION" => $lang['Location'], + "L_LAST_UPDATE" => $lang['Last_updated'], + "L_IPADDRESS" => $lang['IP_Address']) + ); + + $template->pparse("body"); + include('page_footer_admin.'.$phpEx); } @@ -118,7 +381,6 @@ else ); $template->assign_vars(array( - "S_FRAME_HEADER" => "index.$phpEx?pane=top", "S_FRAME_NAV" => "index.$phpEx?pane=left", "S_FRAME_MAIN" => "index.$phpEx?pane=right") ); diff --git a/phpBB/db/mssql_schema.sql b/phpBB/db/mssql_schema.sql index 5ced86ed97569551121440b955b6637e97f8d223..9b218b0ab91dbfaf210a25ca295a320e698ea87f 100644 GIT binary patch delta 838 zcmZuuJx{_=6n*W0m0;6EVL)txVK6TY;Kv_;II)z4K`7;`1%p8%%%*WyI*r>Kt3Pzxz&fQGalLUynT z85}asaVY~c%)?xcL+vOGkuvYaD<|j}^-vc+aMankEeqZqcwfRh6?>k5`wGuwEw+hb z7IQJ#^GrhIR-ITJK(W4ct%_vXZC(9uF*4aod&G6w74NG8eBupaIRU!t>QL#FbBW5j zkV=XWsoFvqYE{m1j2YYQw!>dIT{E+7BHRAL>r#_Q!(}@KLYsphOH)$P%q~qpQugT; zNlC$@^5Uc`bvXF#L||GAE%m~VoA~+w^+|F)p9$(L5jdj$f=4s}!N@g6tS|nFdg#MR zjp9}7$!HIr)jSEBhqu}$~n1C)PhqdHMdqe1v5e8Nqc1j l-!@V6f&HYGj|RjEHx>HYqCc)-{dM!IJX1HMUp)cEr8%kA(&i~ zePZA;lY3%0Ca+85n5+}W0aF4O%fS%in!GNK4X(~1LjXmeLx#}gJT&<=NM>Bf;+VWA z9$`0#{|Ak4lYk_jC@?uD5#p|Ii7Jy7a=0chNQBrA;d4xW0GIy;ch?1=7+)R_id#Tp zamhk3HSC!TxeVzHhLbl|T0+@INNi&ywh54}KiR;%Ve^L+E~d#J(!Wh^$l{y)FWm)9 z+hk3dd?8U_^R?_7Osrs2Ckv)ILs^E|FxJ8hXQ(|UlLIr%LFP@)n<+4Pj-1nEpVY9) N1vB|J-zpH(0RU37z1;u+ diff --git a/phpBB/db/mysql_schema.sql b/phpBB/db/mysql_schema.sql index 1439032195..a2559de378 100644 --- a/phpBB/db/mysql_schema.sql +++ b/phpBB/db/mysql_schema.sql @@ -90,6 +90,7 @@ DROP TABLE IF EXISTS phpbb_config; CREATE TABLE phpbb_config ( config_id int(10) NOT NULL auto_increment, board_disable tinyint(1) DEFAULT '0' NOT NULL, + board_startdate int(11), sitename varchar(100), cookie_name char(20), cookie_path char(25), diff --git a/phpBB/db/postgres_schema.sql b/phpBB/db/postgres_schema.sql index 54564671b0..cf49def9b3 100644 --- a/phpBB/db/postgres_schema.sql +++ b/phpBB/db/postgres_schema.sql @@ -87,6 +87,7 @@ CREATE TABLE phpbb_categories ( CREATE TABLE phpbb_config ( config_id int2 NOT NULL, board_disable int2 DEFAULT '0' NOT NULL, + board_startdate int4, sitename varchar(100) NOT NULL, cookie_name char(20), cookie_path char(25), @@ -320,25 +321,33 @@ CREATE TABLE phpbb_themes ( tr_color1 char(6), tr_color2 char(6), tr_color3 char(6), + tr_class1 varchar(25), + tr_class2 varchar(25), + tr_class3 varchar(25), th_color1 char(6), th_color2 char(6), th_color3 char(6), + th_class1 varchar(25), + th_class2 varchar(25), + th_class3 varchar(25), td_color1 char(6), td_color2 char(6), td_color3 char(6), - fontface1 varchar(50), - fontface2 varchar(50), - fontface3 varchar(50), + td_class1 varchar(25), + td_class2 varchar(25), + td_class3 varchar(25), + fontface1 varchar(25), + fontface2 varchar(25), + fontface3 varchar(25), fontsize1 int2, fontsize2 int2, fontsize3 int2, fontcolor1 char(6), fontcolor2 char(6), fontcolor3 char(6), - img1 varchar(100), - img2 varchar(100), - img3 varchar(100), - img4 varchar(100), + span_class1 varchar(25), + span_class2 varchar(25), + span_class3 varchar(25), CONSTRAINT phpbb_themes_pkey PRIMARY KEY (themes_id) ); CREATE INDEX themes_name_phpbb_themes_index ON phpbb_themes (themes_name); @@ -349,28 +358,36 @@ CREATE INDEX themes_name_phpbb_themes_index ON phpbb_themes (themes_name); -------------------------------------------------------- */ CREATE TABLE phpbb_themes_name ( themes_id int4 DEFAULT '0' NOT NULL, - tr_color1_name varchar(50), - tr_color2_name varchar(50), - tr_color3_name varchar(50), - th_color1_name varchar(50), - th_color2_name varchar(50), - th_color3_name varchar(50), - td_color1_name varchar(50), - td_color2_name varchar(50), - td_color3_name varchar(50), + tr_color1_name char(50), + tr_color2_name char(50), + tr_color3_name char(50), + tr_class1_name varchar(50), + tr_class2_name varchar(50), + tr_class3_name varchar(50), + th_color1_name char(50), + th_color2_name char(50), + th_color3_name char(50), + th_class1_name varchar(50), + th_class2_name varchar(50), + th_class3_name varchar(50), + td_color1_name char(50), + td_color2_name char(50), + td_color3_name char(50), + td_class1_name varchar(50), + td_class2_name varchar(50), + td_class3_name varchar(50), fontface1_name varchar(50), fontface2_name varchar(50), fontface3_name varchar(50), fontsize1_name varchar(50), fontsize2_name varchar(50), fontsize3_name varchar(50), - fontcolor1_name varchar(50), - fontcolor2_name varchar(50), - fontcolor3_name varchar(50), - img1_name varchar(50), - img2_name varchar(50), - img3_name varchar(50), - img4_name varchar(50), + fontcolor1_name char(50), + fontcolor2_name char(50), + fontcolor3_name char(50), + span_class1_name varchar(50), + span_class2_name varchar(50), + span_class3_name varchar(50), CONSTRAINT phpbb_themes_name_pkey PRIMARY KEY (themes_id) );