471 lines
15 KiB
PHP
471 lines
15 KiB
PHP
<?php
|
|
|
|
/*
|
|
+--------------------------------------------------------------------------
|
|
| Invision Power Board 2.1.7
|
|
| =============================================
|
|
| by Matthew Mecham
|
|
| (c) 2001 - 2005 Invision Power Services, Inc.
|
|
| http://www.invisionpower.com
|
|
| =============================================
|
|
| Web: http://www.invisionboard.com
|
|
| http://www.ibresource.ru/products/invisionpowerboard/
|
|
| Time: Tuesday 18th of July 2006 05:56:00 PM
|
|
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
|
|
| Licence Info: http://www.invisionboard.com/?license
|
|
| http://www.ibresource.ru/license
|
|
+---------------------------------------------------------------------------
|
|
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
|
|
+---------------------------------------------------------------------------
|
|
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
|
|
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
|
|
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
|
|
+---------------------------------------------------------------------------
|
|
| > $Date: 2006-01-11 22:47:48 +0000 (Wed, 11 Jan 2006) $
|
|
| > $Revision: 122 $
|
|
| > $Author: bfarber $
|
|
+---------------------------------------------------------------------------
|
|
|
|
|
| > Admin "welcome" screen functions
|
|
| > Module written by Matt Mecham
|
|
| > Date started: 1st march 2002
|
|
|
|
|
| > Module Version Number: 1.0.0
|
|
| > DBA Checked: Tue 25th May 2004
|
|
+--------------------------------------------------------------------------
|
|
*/
|
|
|
|
if ( ! defined( 'IN_ACP' ) )
|
|
{
|
|
print "<h1>Íåâåðíûé âõîä</h1> Ó Âàñ íåò äîñòóïà ê äèðåêòèâå ýòîãî ôàéëà. Åñëè Âû ïðîâîäèëè îáíîâëåíèÿ, óáåäèòåñü, ÷òî íå çàáûëè îáíîâèòü 'admin.php'.";
|
|
exit();
|
|
}
|
|
|
|
class ad_index
|
|
{
|
|
# Global
|
|
var $ipsclass;
|
|
var $html;
|
|
|
|
var $mysql_version = "";
|
|
|
|
/**
|
|
* Section title name
|
|
*
|
|
* @var string
|
|
*/
|
|
var $perm_main = "admin";
|
|
|
|
/**
|
|
* Section title name
|
|
*
|
|
* @var string
|
|
*/
|
|
var $perm_child = "splash";
|
|
|
|
function auto_run()
|
|
{
|
|
//-----------------------------------------
|
|
// INIT
|
|
//-----------------------------------------
|
|
|
|
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':' );
|
|
|
|
$content = array();
|
|
$thiscontent = "";
|
|
$upgrade_history = array();
|
|
$latest_version = array();
|
|
$reg_end = "";
|
|
$sm_install = 0;
|
|
$lock_file = 0;
|
|
|
|
if ( @file_exists( ROOT_PATH . 'install/index.php' ) )
|
|
{
|
|
$sm_install = 1;
|
|
}
|
|
|
|
if ( @file_exists( ROOT_PATH . 'install/install.lock' ) )
|
|
{
|
|
$lock_file = 1;
|
|
}
|
|
|
|
|
|
//-----------------------------------------
|
|
// Kill globals - globals bad, Homer good.
|
|
//-----------------------------------------
|
|
|
|
$tmp_in = array_merge( $_GET, $_POST, $_COOKIE );
|
|
|
|
foreach ( $tmp_in as $k => $v )
|
|
{
|
|
unset($$k);
|
|
}
|
|
|
|
//-----------------------------------------
|
|
// LOAD HTML
|
|
//-----------------------------------------
|
|
|
|
$this->html = $this->ipsclass->acp_load_template('cp_skin_index');
|
|
|
|
//-----------------------------------------
|
|
// continue...
|
|
//-----------------------------------------
|
|
|
|
$this->ipsclass->admin->page_title = "Äîáðî ïîæàëîâàòü â àäìèíöåíòð âàøåãî Invision Power Board";
|
|
$this->ipsclass->admin->page_detail = "";
|
|
|
|
//-----------------------------------------
|
|
// PHP INFO?
|
|
//-----------------------------------------
|
|
|
|
if ( $this->ipsclass->input['phpinfo'] )
|
|
{
|
|
@ob_start();
|
|
phpinfo();
|
|
$parsed = @ob_get_contents();
|
|
@ob_end_clean();
|
|
|
|
preg_match( "#<body>(.*)</body>#is" , $parsed, $match1 );
|
|
|
|
$php_body = $match1[1];
|
|
|
|
# PREVENT WRAP: Most cookies
|
|
$php_body = str_replace( "; " , ";<br />" , $php_body );
|
|
# PREVENT WRAP: Very long string cookies
|
|
$php_body = str_replace( "%3B", "<br />" , $php_body );
|
|
# PREVENT WRAP: Serialized array string cookies
|
|
$php_body = str_replace( ";i:", ";<br />i:" , $php_body );
|
|
|
|
|
|
$php_style = "<style type='text/css'>
|
|
.center {text-align: center;}
|
|
.center table { margin-left: auto; margin-right: auto; text-align: left; }
|
|
.center th { text-align: center; }
|
|
h1 {font-size: 150%;}
|
|
h2 {font-size: 125%;}
|
|
.p {text-align: left;}
|
|
.e {background-color: #ccccff; font-weight: bold;}
|
|
.h {background-color: #9999cc; font-weight: bold;}
|
|
.v {background-color: #cccccc; white-space: normal;}
|
|
</style>\n";
|
|
|
|
$this->ipsclass->html = $php_style . $php_body;
|
|
$this->ipsclass->admin->output();
|
|
}
|
|
|
|
//-----------------------------------------
|
|
// Get MySQL & PHP Version
|
|
//-----------------------------------------
|
|
|
|
$this->ipsclass->DB->sql_get_version();
|
|
|
|
//-----------------------------------------
|
|
// Upgrade history?
|
|
//-----------------------------------------
|
|
|
|
$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'upgrade_history', 'order' => 'upgrade_version_id DESC', 'limit' => array(0, 5) ) );
|
|
$this->ipsclass->DB->simple_exec();
|
|
|
|
while( $r = $this->ipsclass->DB->fetch_row() )
|
|
{
|
|
if ( $r['upgrade_version_id'] > $latest_version['upgrade_version_id'] )
|
|
{
|
|
$latest_version = $r;
|
|
}
|
|
|
|
$upgrade_history[] = $r;
|
|
}
|
|
|
|
//-----------------------------------------
|
|
// Resetting security image?
|
|
//-----------------------------------------
|
|
|
|
if ( $_REQUEST['reset_security_flag'] == 1 AND $_REQUEST['new_build'] )
|
|
{
|
|
$new_build = intval( $_REQUEST['new_build'] );
|
|
$new_reason = trim( substr( $_REQUEST['new_reason'], 0, 1 ) );
|
|
$new_version = $latest_version['upgrade_version_id'].'.'.$new_build.'.'.$new_reason;
|
|
|
|
$this->ipsclass->DB->do_update( 'upgrade_history', array( 'upgrade_notes' => $new_version ), 'upgrade_version_id='.$latest_version['upgrade_version_id'] );
|
|
|
|
$latest_version['upgrade_notes'] = $new_version;
|
|
}
|
|
|
|
//-----------------------------------------
|
|
// Got real version number?
|
|
//-----------------------------------------
|
|
|
|
$this->ipsclass->version = 'v'.$latest_version['upgrade_version_human'];
|
|
$this->ipsclass->vn_full = $latest_version['upgrade_notes'] ? $latest_version['upgrade_notes'] : $this->ipsclass->vn_full;
|
|
|
|
$content['update_img'] = $this->html->update_img( base64_encode( $this->ipsclass->vn_full.'|^|'.$this->ipsclass->vars['board_url'] ) );
|
|
|
|
//-----------------------------------------
|
|
// Licensed?
|
|
//-----------------------------------------
|
|
|
|
$content['reg_html'] = $this->html->acp_licensed();
|
|
|
|
//-----------------------------------------
|
|
// Notepad
|
|
//-----------------------------------------
|
|
|
|
if ( $this->ipsclass->input['save'] == 1 )
|
|
{
|
|
$this->ipsclass->DB->do_update( 'cache_store', array( 'cs_value' => $this->ipsclass->txt_stripslashes($_POST['notes']) ), "cs_key='adminnotes'" );
|
|
}
|
|
|
|
$text = "Âû ìîæåòå èñïîëüçîâàòü ýòîò áëîê, êàê îáùèé áëîêíîò äëÿ âñåõ àäìèíèñòðàòîðîâ. Óäîáíî äëÿ ñîîáùåíèÿ äðóãèì àäìèíèñòðàòîðàì êàêèõ-ëèáî íîâîñòåé è ò.ä.";
|
|
|
|
$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'cache_store', 'where' => "cs_key='adminnotes'" ) );
|
|
$this->ipsclass->DB->simple_exec();
|
|
|
|
if ( ! $notes = $this->ipsclass->DB->fetch_row() )
|
|
{
|
|
$this->ipsclass->DB->do_insert( 'cache_store', array( 'cs_key' => 'adminnotes', 'cs_value' => $text ) );
|
|
|
|
$notes = array( 'cs_key' => 'adminnotes', 'cs_value' => $text );
|
|
}
|
|
|
|
$content['ad_notes'] = $this->html->acp_notes( $notes['cs_value'] );
|
|
|
|
//-----------------------------------------
|
|
// Quick clicks
|
|
//-----------------------------------------
|
|
|
|
$content['quick_clicks'] = $this->html->acp_quick_clicks();
|
|
|
|
//-----------------------------------------
|
|
// Version History
|
|
//-----------------------------------------
|
|
|
|
foreach( $upgrade_history as $r )
|
|
{
|
|
$r['_date'] = $this->ipsclass->get_date( $r['upgrade_date'], 'SHORT' );
|
|
|
|
$thiscontent .= $this->html->acp_version_history_row( $r );
|
|
}
|
|
|
|
$content['version_history'] = $this->html->acp_version_history_wrapper( $thiscontent );
|
|
|
|
//-----------------------------------------
|
|
// ADMINS USING CP
|
|
//-----------------------------------------
|
|
|
|
$t_time = time() - 60*10;
|
|
$time_now = time();
|
|
$seen_name = array();
|
|
|
|
$this->ipsclass->DB->build_query( array( 'select' => 's.session_member_name, s.session_location, s.session_log_in_time, s.session_running_time, s.session_ip_address',
|
|
'from' => array( 'admin_sessions' => 's' ),
|
|
'add_join' => array( 0 => array( 'select' => 'm.members_display_name',
|
|
'from' => array( 'members' => 'm' ),
|
|
'where' => "m.id=s.session_member_id",
|
|
'type' => 'left' ) ) ) );
|
|
|
|
$this->ipsclass->DB->exec_query();
|
|
|
|
while ( $r = $this->ipsclass->DB->fetch_row() )
|
|
{
|
|
if ( $seen_name[ $r['session_member_name'] ] == 1 )
|
|
{
|
|
continue;
|
|
}
|
|
else
|
|
{
|
|
$seen_name[ $r['session_member_name'] ] = 1;
|
|
}
|
|
|
|
$r['_log_in'] = $time_now - $r['session_log_in_time'];
|
|
$r['_click'] = $time_now - $r['session_running_time'];
|
|
|
|
if ( ($r['_log_in'] / 60) < 1 )
|
|
{
|
|
$r['_log_in'] = sprintf("%0d", $r['_log_in']) . " ñåêóíä íàçàä";
|
|
}
|
|
else
|
|
{
|
|
$r['_log_in'] = sprintf("%0d", ($r['_log_in'] / 60) ) . " ìèíóò íàçàä";
|
|
}
|
|
|
|
if ( ($r['_click'] / 60) < 1 )
|
|
{
|
|
$r['_click'] = sprintf("%0d", $r['_click']) . " ñåêóíä íàçàä";
|
|
}
|
|
else
|
|
{
|
|
$r['_click'] = sprintf("%0d", ($r['_click'] / 60) ) . " ìèíóò íàçàä";
|
|
}
|
|
|
|
//$r['_host'] = @gethostbyaddr($r['session_ip_address']);
|
|
|
|
$r['session_location'] = $r['session_location'] ? $r['session_location'] : 'Index';
|
|
|
|
$acponline .= $this->html->acp_onlineadmin_row( $r );
|
|
}
|
|
|
|
$content['acp_online'] = $this->html->acp_onlineadmin_wrapper( $acponline );
|
|
|
|
//-----------------------------------------
|
|
// IPS latest news
|
|
//-----------------------------------------
|
|
|
|
$content['latest_news'] = $this->html->acp_ips_news( 'http://www.ibresource.ru/forums/ibr_news.php' );
|
|
|
|
//-----------------------------------------
|
|
// Stats
|
|
//-----------------------------------------
|
|
|
|
$reg = $this->ipsclass->DB->simple_exec_query( array( 'select' => 'COUNT(*) as reg', 'from' => 'validating', 'where' => 'lost_pass <> 1' ) );
|
|
$coppa = $this->ipsclass->DB->simple_exec_query( array( 'select' => 'COUNT(*) as coppa', 'from' => 'validating', 'where' => 'coppa_user=1' ) );
|
|
|
|
$content['stats'] = $this->html->acp_stats_wrapper( array( 'topics' => intval($this->ipsclass->cache['stats']['total_topics']),
|
|
'replies' => intval($this->ipsclass->cache['stats']['total_replies']),
|
|
'members' => intval($this->ipsclass->cache['stats']['mem_count']),
|
|
'uploads' => $this->_get_uploads_size(),
|
|
'validate' => intval( $reg['reg'] ),
|
|
'coppa' => intval( $coppa['coppa'] ),
|
|
'sql_driver' => strtoupper(SQL_DRIVER),
|
|
'sql_version' => $this->ipsclass->DB->true_version,
|
|
'php_version' => phpversion(),
|
|
'php_sapi' => @php_sapi_name(),
|
|
'ipb_version' => $this->ipsclass->version,
|
|
'ipb_id' => $this->ipsclass->acpversion ) );
|
|
|
|
//-----------------------------------------
|
|
// Piece it together
|
|
//-----------------------------------------
|
|
|
|
$this->ipsclass->html .= $this->html->acp_main_template( $content );
|
|
|
|
//-----------------------------------------
|
|
// Update img
|
|
//-----------------------------------------
|
|
|
|
$this->ipsclass->html = str_replace( '<!--updateimg-->', $content['update_img'], $this->ipsclass->html );
|
|
|
|
//-----------------------------------------
|
|
// Trashed skin?
|
|
//-----------------------------------------
|
|
|
|
$skinmsg = $this->ipsclass->DB->simple_exec_query( array( "select" => '*', 'from' => "cache_store", "where" => "cs_key='skinpanic'" ) );
|
|
|
|
if ( $skinmsg['cs_value'] == 'rebuildemergency' )
|
|
{
|
|
$this->ipsclass->html = str_replace( '<!--warningskin-->', $this->html->warning_rebuild_emergency(), $this->ipsclass->html );
|
|
}
|
|
|
|
if ( $skinmsg['cs_value'] == 'rebuildupgrade' )
|
|
{
|
|
$this->ipsclass->html = str_replace( '<!--warningskin-->', $this->html->warning_rebuild_upgrade(), $this->ipsclass->html );
|
|
}
|
|
|
|
//-----------------------------------------
|
|
// INSTALLER PRESENT?
|
|
//-----------------------------------------
|
|
|
|
if ( $sm_install == 1 )
|
|
{
|
|
if ( $lock_file != 1 )
|
|
{
|
|
$this->ipsclass->html = str_replace( '<!--warninginstaller-->', $this->html->warning_unlocked_installer(), $this->ipsclass->html );
|
|
}
|
|
else
|
|
{
|
|
$this->ipsclass->html = str_replace( '<!--warninginstaller-->', $this->html->warning_installer(), $this->ipsclass->html );
|
|
}
|
|
}
|
|
|
|
//-----------------------------------------
|
|
// INSUFFICIENT PHP VERSION?
|
|
//-----------------------------------------
|
|
|
|
if ( PHP_VERSION < '4.3.0' )
|
|
{
|
|
$this->ipsclass->html = str_replace( '<!--phpversioncheck-->', $this->html->acp_php_version_warning( PHP_VERSION ), $this->ipsclass->html );
|
|
}
|
|
|
|
//-----------------------------------------
|
|
// BOARD OFFLINE?
|
|
//-----------------------------------------
|
|
|
|
if ( $this->ipsclass->vars['board_offline'] )
|
|
{
|
|
$this->ipsclass->html = str_replace( '<!--boardoffline-->', $this->html->acp_board_offline(), $this->ipsclass->html );
|
|
}
|
|
|
|
//-----------------------------------------
|
|
// ROOT ADMIN?
|
|
//-----------------------------------------
|
|
|
|
if ($this->ipsclass->member['mgroup'] == $this->ipsclass->vars['admin_group'])
|
|
{
|
|
//-----------------------------------------
|
|
// LAST 5 Admin Actions
|
|
//-----------------------------------------
|
|
|
|
$this->ipsclass->DB->cache_add_query( 'index_admin_logs', array() );
|
|
$this->ipsclass->DB->cache_exec_query();
|
|
|
|
while ( $rowb = $this->ipsclass->DB->fetch_row() )
|
|
{
|
|
$rowb['_ctime'] = $this->ipsclass->admin->get_date( $rowb['ctime'] );
|
|
|
|
$lastactions .= $this->html->acp_lastactions_row( $rowb );
|
|
}
|
|
|
|
$this->ipsclass->html = str_replace( '<!--acpactions-->', $this->html->acp_lastactions_wrapper( $lastactions ), $this->ipsclass->html );
|
|
}
|
|
|
|
$this->ipsclass->admin->output();
|
|
}
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
// Get uploads size
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
function _get_uploads_size()
|
|
{
|
|
//-----------------------------------------
|
|
// Make sure the uploads path is correct
|
|
//-----------------------------------------
|
|
|
|
$uploads_size = 0;
|
|
|
|
if ($dh = @opendir( $this->ipsclass->vars['upload_dir'] ))
|
|
{
|
|
while ( $file = @readdir( $dh ) )
|
|
{
|
|
if ( ! preg_match( "/^..?$|^index/i", $file ) )
|
|
{
|
|
$uploads_size += @filesize( $this->ipsclass->vars['upload_dir'] . "/" . $file );
|
|
}
|
|
}
|
|
@closedir( $dh );
|
|
}
|
|
|
|
//-----------------------------------------
|
|
// This piece of code from Jesse's (jesse@jess.on.ca) contribution
|
|
// to the PHP manual @ php.net posted without license
|
|
//-----------------------------------------
|
|
|
|
if ($uploads_size >= 1048576)
|
|
{
|
|
$uploads_size = round($uploads_size / 1048576 * 100 ) / 100 . " ìåãàáàéò";
|
|
}
|
|
else if ($uploads_size >= 1024)
|
|
{
|
|
$uploads_size = round($uploads_size / 1024 * 100 ) / 100 . " êèëîáàéò";
|
|
}
|
|
else
|
|
{
|
|
$uploads_size = $uploads_size . " áàéò";
|
|
}
|
|
|
|
return $uploads_size;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
?>
|