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.
";
}
//---------------------------------
// 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.