diff options
author | James Atkinson <thefinn@users.sourceforge.net> | 2001-07-23 18:30:35 +0000 |
---|---|---|
committer | James Atkinson <thefinn@users.sourceforge.net> | 2001-07-23 18:30:35 +0000 |
commit | fb52fdddb929f131bfb3443b2329cf686084ba94 (patch) | |
tree | 4bfa3257329ffbccfd96aa77b05471f018d0a62a | |
parent | 273314d0be7040e31b1db7621a4af59619271737 (diff) | |
download | forums-fb52fdddb929f131bfb3443b2329cf686084ba94.tar forums-fb52fdddb929f131bfb3443b2329cf686084ba94.tar.gz forums-fb52fdddb929f131bfb3443b2329cf686084ba94.tar.bz2 forums-fb52fdddb929f131bfb3443b2329cf686084ba94.tar.xz forums-fb52fdddb929f131bfb3443b2329cf686084ba94.zip |
Started on the admin overview/index page
git-svn-id: file:///svn/phpbb/trunk@734 89ea8834-ac86-4346-8a33-228a782c2dd0
-rw-r--r-- | phpBB/admin/admin_index.php | 204 | ||||
-rw-r--r-- | phpBB/admin/index.php | 5 | ||||
-rwxr-xr-x | phpBB/language/lang_english.php | 2 | ||||
-rw-r--r-- | phpBB/templates/PSO/admin/admin_index_body.tpl | 47 |
4 files changed, 257 insertions, 1 deletions
diff --git a/phpBB/admin/admin_index.php b/phpBB/admin/admin_index.php new file mode 100644 index 0000000000..42196e1448 --- /dev/null +++ b/phpBB/admin/admin_index.php @@ -0,0 +1,204 @@ +<?php +/*************************************************************************** + * admin_index + * ------------------- + * begin : Thursday, Jul 23, 2001 + * copyright : (C) 2001 The phpBB Group + * email : support@phpbb.com + * + * $Id$ + * + * + ***************************************************************************/ + +/*************************************************************************** + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * + ***************************************************************************/ + +if($setmodules == 1) +{ + $filename = basename(__FILE__); + $module['General']['overview'] = "$filename"; + + return; +} + +if(!$from_index) +{ + $phpbb_root_path = "./../"; + include($phpbb_root_path . 'extension.inc'); + include($phpbb_root_path . 'common.'.$phpEx); +} + +// +// Start session management +// +$userdata = session_pagestart($user_ip, PAGE_INDEX, $session_length); +init_userprefs($userdata); +// +// End session management +// + +// +// Check user permissions +// +if( !$userdata['session_logged_in'] ) +{ + header("Location: ../login.$phpEx?forward_page=/admin"); +} +else if( $userdata['user_level'] != ADMIN ) +{ + message_die(GENERAL_MESSAGE, "You are not authorised to administer this board"); +} + + +$template->set_filenames(array("body" => "admin/admin_index_body.tpl")); + + +// 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("viewforum.$phpEx?" . POST_FORUM_URL . "=" . $onlinerow[$i]['session_page']); + $location = $forum_data[$onlinerow[$i]['session_page']]; + } + + if(!($count % 2)) + { + $row_color = "#" . $theme['td_color1']; + } + else + { + $row_color = "#" . $theme['td_color2']; + } + $count++; + + $ip_address = decode_ip($onlinerow[$i]['session_ip']); + $host_name = gethostbyaddr($ip_address); + $ip_address = $ip_address . " ($host_name)"; + + $template->assign_block_vars("userrow", array( + "ROW_COLOR" => $row_color, + "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("profile.$phpEx?mode=viewprofile&" . 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"); + +if(!$from_index) +{ + include('page_footer_admin.'.$phpEx); +} + +?>
\ No newline at end of file diff --git a/phpBB/admin/index.php b/phpBB/admin/index.php index 466e803895..67a905e401 100644 --- a/phpBB/admin/index.php +++ b/phpBB/admin/index.php @@ -101,7 +101,10 @@ elseif( $HTTP_GET_VARS['pane'] == 'right' ) $template_header = "admin/page_header.tpl"; include('page_header_admin.'.$phpEx); - + + $from_index = 1; + include('admin_index.'.$phpEx); + include('page_footer_admin.'.$phpEx); } diff --git a/phpBB/language/lang_english.php b/phpBB/language/lang_english.php index 9ddea7bf53..553c4092e8 100755 --- a/phpBB/language/lang_english.php +++ b/phpBB/language/lang_english.php @@ -111,6 +111,8 @@ $lang['YIM'] = "Yahoo Messenger"; $lang['Error'] = "Error"; +$lang['IP_Address'] = "IP Address"; + // // Global Header strings // diff --git a/phpBB/templates/PSO/admin/admin_index_body.tpl b/phpBB/templates/PSO/admin/admin_index_body.tpl new file mode 100644 index 0000000000..8bc1aeca18 --- /dev/null +++ b/phpBB/templates/PSO/admin/admin_index_body.tpl @@ -0,0 +1,47 @@ +<h1>Welcome to phpBB</h1> + +<p> + Thank you for choosing phpBB as your forum solution. This screen will give you a quick overview of all the various statistics of your board. You can get back to this page by clicking on the <i><u>overview</u></i> link in the left pane.<br /> + The other links on the left hand side of this screen will allow you to control every aspect of your forum experiance, each screen will have instructions on how to use the tools. +</p> + + +<h2>Forum Statistics</h2> +<p> + Current number of posts: <b>{NUMBER_OF_POSTS}</b><br /> + Current number of topics: <b>{NUMBER_OF_TOPICS}</b><br /> + Current number of users: <b>{NUMBER_OF_USERS}</b><br /> + <br /> + Posts per day: <b>{POSTS_PER_DAY}</b><br /> + Topics per day: <b>{TOPICS_PER_DAY}</b><br /> + Users per day: <b>{USERS_PER_DAY}</b><br /> + <br /> + Avatar directory size: <b>{AVATAR_DIR_SIZE}</b><br /> + Database size: <b>{DB_SIZE}</b> +</p> + +<h2>Users Online</h2> +<table border="0" cellpadding="1" cellspacing="0" width="98%" align="center"> + <tr> + <td class="tablebg"> + <table width="100%" cellpadding="4" cellspacing="1" border="0"> + <tr> + <th width="25%"> {L_USERNAME} </th> + <th width="25%"> {L_LAST_UPDATE} </th> + <th width="25%"> {L_LOCATION} </th> + <th width="25%"> {L_IPADDRESS} </th> + </tr> + <!-- BEGIN userrow --> + <tr bgcolor="{userrow.ROW_COLOR}"> + <td width="25%"> <span class="gen"><a href="{userrow.U_USER_PROFILE}">{userrow.USERNAME}</a></span> </td> + <td width="25%" align="center"> <span class="gen">{userrow.LASTUPDATE}</span> </td> + <td width="25%"> <span class="gen"><a href="{userrow.U_FORUM_LOCATION}">{userrow.LOCATION}</a></span> </td> + <td width="25%"> <span class="gen">{userrow.IPADDRESS}</span> </td> + </tr> + <!-- END userrow --> + </table> + </td> + </tr> +</table> + +<br clear="all"> |