Admin "welcome" screen functions | > Module written by Matt Mecham | > Date started: 1st march 2002 | | > Module Version Number: 1.0.0 +-------------------------------------------------------------------------- */ if ( ! defined( 'IN_ACP' ) ) { print "

Incorrect access

You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'."; exit(); } $idx = new index_page(); class index_page { var $mysql_version = ""; function index_page() { global $DB, $IN, $INFO, $ADMIN, $MEMBER, $SKIN, $std, $ibforums; //--------------------------------------- // Kill globals - globals bad, Homer good. //--------------------------------------- $tmp_in = array_merge( $_GET, $_POST, $_COOKIE ); foreach ( $tmp_in as $k => $v ) { unset($$k); } //--------------------------------------- $ADMIN->page_title = "Welcome to the Invision Power Board Administration CP"; $ADMIN->page_detail = "You can set up and customize your board from within this control panel.

Clicking on one of the links in the left menu pane will show you the relevant options for that administration category. Each option will contain further information on configuration, etc."; //--------------------------------- // Get mySQL & PHP Version //--------------------------------- $DB->query("SELECT VERSION() AS version"); if ( ! $row = $DB->fetch_row() ) { $DB->query("SHOW VARIABLES LIKE 'version'"); $row = $DB->fetch_row(); } $this->mysql_version = $row['version']; $phpv = phpversion(); //--------------------------------- // Got reg code? //--------------------------------- $reg_html = ""; $reg_end = ""; $version_info = "
PHP VERSION: $phpv, MySQL VERSION: ".$this->mysql_version; if ( $INFO['ipb_reg_number'] ) { list( $a, $b, $c, $d, $e ) = explode( '-', $INFO['ipb_reg_number'] ); if ( strlen($e) > 9 ) { $reg_end = "Registered until: ". $ADMIN->get_date( $e, 'SHORT' ).""; } else { $reg_end = "Registered for life"; } $reg_html = "
Registered Invision Power Board
Thank you for registering your Invision Power Board!

Please visit your client area for news, updates and support.
$reg_end
"; } else { $reg_html = "
Unregistered Invision Power Board
This copy of Invision Power Board is unregistered.

Why register? click here to find out!
Go on, register today! you know it makes sense!
"; } //--------------------------------- // Notepad //--------------------------------- if ( $IN['save'] == 1 ) { $DB->query("UPDATE ibf_cache_store SET cs_value='".addslashes($_POST['notes'])."' WHERE cs_key='adminnotes'"); } $text = "You can use this section to keep notes for yourself and other admins, etc."; $DB->query("SELECT * FROM ibf_cache_store WHERE cs_key='adminnotes'"); if ( ! $notes = $DB->fetch_row() ) { $DB->query("INSERT INTO ibf_cache_store (cs_key,cs_value) VALUES ('adminnotes', '$text')"); $notes = array( 'cs_key' => 'adminnotes', 'cs_value' => $text ); } $ad_notes = "
"; //--------------------------------- // Printy-poos //--------------------------------- $ADMIN->html .= "
{$ad_notes}   {$version_info}

{$reg_html}

\n"; //--------------------------------- // Stats //--------------------------------- $DB->query("SELECT * FROM ibf_stats"); $row = $DB->fetch_row(); if ($row['TOTAL_REPLIES'] < 0) $row['TOTAL_REPLIES'] = 0; if ($row['TOTAL_TOPICS'] < 0) $row['TOTAL_TOPICS'] = 0; if ($row['MEM_COUNT'] < 0) $row['MEM_COUNT'] = 0; $DB->query("SELECT COUNT(*) as reg FROM ibf_validating WHERE lost_pass <> 1"); $reg = $DB->fetch_row(); if ($reg['reg'] < 1 ) $reg['reg'] = 0; $DB->query("SELECT COUNT(*) as coppa FROM ibf_validating WHERE coppa_user=1"); $coppa = $DB->fetch_row(); if ($coppa['coppa'] < 1 ) $coppa['coppa'] = 0; //------------------------------------------------- // Make sure the uploads path is correct //------------------------------------------------- $uploads_size = 0; if ($dh = opendir( $INFO['upload_dir'] )) { while ( $file = readdir( $dh ) ) { if ( !preg_match( "/^..?$|^index/i", $file ) ) { $uploads_size += @filesize( $INFO['upload_dir'] . "/" . $file ); } } closedir( $dh ); } // This piece of code from Jesse's (jesse@jess.on.ca) contribution // to the PHP manual @ php.net if ($uploads_size >= 1048576) { $uploads_size = round($uploads_size / 1048576 * 100 ) / 100 . " mb"; } else if ($uploads_size >= 1024) { $uploads_size = round($uploads_size / 1024 * 100 ) / 100 . " k"; } else { $uploads_size = $uploads_size . " bytes"; } //+----------------------------------------------------------- // INSTALLER PRESENT? //+----------------------------------------------------------- $sm_install = 0; $lock_file = 0; if ( @file_exists( ROOT_PATH . 'sm_install.php' ) ) { $sm_install = 1; } if ( @file_exists( ROOT_PATH . 'install.lock' ) ) { $lock_file = 1; } if ( $sm_install == 1 ) { if ( $lock_file != 1 ) { $ADMIN->html .= "
Warning: Unlocked Installer Still Present

Remove sm_install.php from your server at once!
Leaving it on your server WILL compromise the security of your system.


"; } else { $ADMIN->html .= "
Warning: Installer Still Present

Although the installer appears to be locked, we recommend you remove it from your server for security.
Simply remove sm_install.php from your installation to remove this message.


"; } } //+----------------------------------------------------------- // BOARD OFFLINE? //+----------------------------------------------------------- if ($INFO['board_offline']) { $SKIN->td_header[] = array( " ", "100%" ); $ADMIN->html .= $SKIN->start_table( "Offline Notice" ); $ADMIN->html .= $SKIN->add_td_row( array( "Your board is currently offline

» Turn Board Online" ) ); $ADMIN->html .= $SKIN->end_table(); $ADMIN->html .= $SKIN->add_td_spacer(); } //+----------------------------------------------------------- // ADMINS USING CP //+----------------------------------------------------------- $SKIN->td_header[] = array( "Name" , "20%" ); $SKIN->td_header[] = array( "IP Address" , "20%" ); $SKIN->td_header[] = array( "Log In" , "20%" ); $SKIN->td_header[] = array( "Last Click" , "20%" ); $SKIN->td_header[] = array( "Location" , "20%" ); $ADMIN->html .= $SKIN->start_table( "Administrators using the CP" ); $t_time = time() - 60*10; $DB->query("SELECT MEMBER_NAME, LOCATION, LOG_IN_TIME, RUNNING_TIME, IP_ADDRESS FROM ibf_admin_sessions WHERE RUNNING_TIME > $t_time"); $time_now = time(); $seen_name = array(); while ( $r = $DB->fetch_row() ) { if ( $seen_name[ $r['MEMBER_NAME'] ] == 1 ) { continue; } else { $seen_name[ $r['MEMBER_NAME'] ] = 1; } $log_in = $time_now - $r['LOG_IN_TIME']; $click = $time_now - $r['RUNNING_TIME']; if ( ($log_in / 60) < 1 ) { $log_in = sprintf("%0d", $log_in) . " seconds ago"; } else { $log_in = sprintf("%0d", ($log_in / 60) ) . " minutes ago"; } if ( ($click / 60) < 1 ) { $click = sprintf("%0d", $click) . " seconds ago"; } else { $click = sprintf("%0d", ($click / 60) ) . " minutes ago"; } $ADMIN->html .= $SKIN->add_td_row( array ( $r['MEMBER_NAME'], "
".$r['IP_ADDRESS']."
", "
".$log_in."
", "
".$click."
", "
".$r['LOCATION']."
", ) ); } $ADMIN->html .= $SKIN->end_table(); //+----------------------------------------------------------- $ADMIN->html .= $SKIN->add_td_spacer(); //+----------------------------------------------------------- if ($MEMBER['mgroup'] == $INFO['admin_group']) { //+----------------------------------------------------------- // LAST 5 Admin Actions //+----------------------------------------------------------- $SKIN->td_header[] = array( "Member Name" , "20%" ); $SKIN->td_header[] = array( "Action Performed" , "40%" ); $SKIN->td_header[] = array( "Time of action" , "20%" ); $SKIN->td_header[] = array( "IP address" , "20%" ); $ADMIN->html .= $SKIN->start_table( "Last 5 Admin Actions" ); $DB->query("SELECT m.*, mem.id, mem.name FROM ibf_admin_logs m, ibf_members mem WHERE m.member_id=mem.id ORDER BY m.ctime DESC LIMIT 0, 5"); if ( $DB->get_num_rows() ) { while ( $rowb = $DB->fetch_row() ) { $rowb['ctime'] = $ADMIN->get_date( $rowb['ctime'] ); $ADMIN->html .= $SKIN->add_td_row( array( "{$rowb['name']}", "{$rowb['note']}", "{$rowb['ctime']}", "{$rowb['ip_address']}", ) ); } } else { $ADMIN->html .= $SKIN->add_td_basic("
No results
"); } $ADMIN->html .= $SKIN->end_table(); //+----------------------------------------------------------- $ADMIN->html .= $SKIN->add_td_spacer(); } //+----------------------------------------------------------- // Bots stuff //+----------------------------------------------------------- if ( $INFO['spider_sense'] ) { $SKIN->td_header[] = array( "Search Bot" , "20%" ); $SKIN->td_header[] = array( "Date" , "25%" ); $SKIN->td_header[] = array( "Query" , "20%" ); $SKIN->td_header[] = array( "Query" , "35%" ); $ADMIN->html .= $SKIN->start_table( "Last 10 Search Engine Spiders Hits" ); $DB->query("SELECT * FROM ibf_spider_logs ORDER BY entry_date DESC LIMIT 0,10"); while ( $r = $DB->fetch_row() ) { $ADMIN->html .= $SKIN->add_td_row( array( "".$INFO[ 'sp_'.$r['bot'] ]."", $ADMIN->get_date( $r['entry_date'], 'SHORT' ), $r['ip_address'].' ', $r['query_string'].' ' ) ); } $ADMIN->html .= $SKIN->end_table(); $ADMIN->html .= $SKIN->add_td_spacer(); } //+----------------------------------------------------------- $SKIN->td_header[] = array( "Definition", "25%" ); $SKIN->td_header[] = array( "Value" , "25%" ); $SKIN->td_header[] = array( "Definition", "25%" ); $SKIN->td_header[] = array( "Value" , "25%" ); $ADMIN->html .= $SKIN->start_table( "System Overview" ); $ADMIN->html .= $SKIN->add_td_row( array( "Total Unique Topics" , $row['TOTAL_TOPICS'], "Total Replies to topics" , $row['TOTAL_REPLIES'] ) ); $ADMIN->html .= $SKIN->add_td_row( array( "Total Members" , $row['MEM_COUNT'], "Public Upload Folder Size", $uploads_size ) ); $ADMIN->html .= $SKIN->add_td_row( array( "Users awaiting validation" , $reg['reg'], "COPPA Requests from 'Users awaiting validation' total", $coppa['coppa'], ) ); $ADMIN->html .= $SKIN->end_table(); //+----------------------------------------------------------- $ADMIN->html .= $SKIN->add_td_spacer(); //+----------------------------------------------------------- $ADMIN->html .= $SKIN->start_form(); $SKIN->td_header[] = array( " " , "40%" ); $SKIN->td_header[] = array( " " , "30%" ); $SKIN->td_header[] = array( " " , "30%" ); $ADMIN->html .= $SKIN->start_table( "Quick Clicks" ); $ADMIN->html .= "
"; $ADMIN->html .= $SKIN->add_td_row( array( "Edit Member:", "", "" ) ); $ADMIN->html .= $SKIN->add_td_row( array( "Add New Category:", "", "" ) ); $ADMIN->html .= $SKIN->add_td_row( array( "Add New Forum:", "", "" ) ); $ADMIN->html .= "
"; $ADMIN->html .= $SKIN->end_table(); $ADMIN->output(); } } ?>