703 lines
24 KiB
PHP
703 lines
24 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
|
|
+---------------------------------------------------------------------------
|
|
|
|
|
| > IPB UPGRADE LOADER
|
|
| > Script written by Matt Mecham
|
|
| > Date started: 21st April 2004
|
|
| > Interesting fact: Radiohead rock (still)
|
|
+--------------------------------------------------------------------------
|
|
*/
|
|
|
|
if ( ! defined( 'IN_IPB' ) )
|
|
{
|
|
print "<h1>Íåêîððåêòíûé àäðåñ</h1>Âû íå èìååòå äîñòóïà ê ýòîìó ôàéëó íàïðÿìóþ. Åñëè âû íåäàâíî îáíîâëÿëè ôîðóì, âû äîëæíû îáíîâèòü âñå ñîîòâåòñòâóþùèå ôàéëû.";
|
|
exit();
|
|
}
|
|
|
|
class core_functions
|
|
{
|
|
/*-------------------------------------------------------------------------*/
|
|
// CONSTRUCTOR
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
function core_functions()
|
|
{
|
|
|
|
}
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
// FINISH _EVERYTHING_
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
function upgrade_complete()
|
|
{
|
|
$this->ipsclass->template->content .= "
|
|
<div class='tableborder'>
|
|
<div class='maintitle'>Îáíîâëåíèå IPB çàâåðøåíî!</div>
|
|
<div class='tdrow1' style='padding:6px'>Âàø ôîðóì óñïåøíî îáíîâëåí!
|
|
<br /><br />
|
|
Âû äîëæíû îòêëþ÷èòü ïðàâà íà âûïîëíåíèå ñêðèïòà /upgrade/index.php èëè ïåðåèìåíîâàòü äèðåêòîðèþ /upgrade/. Èíà÷å ó âàñ ìîãóò áûòü ïðîáëåìû ñ áåçîïàñíîñòüþ.
|
|
</div>
|
|
</div>
|
|
";
|
|
|
|
$this->ipsclass->template->output();
|
|
}
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
// REBUILD TEMPLATES
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
function rebuild_templates_cache()
|
|
{
|
|
//-----------------------------------
|
|
// Get ACP library
|
|
//-----------------------------------
|
|
|
|
require_once( ROOT_PATH.'sources/lib/admin_cache_functions.php' );
|
|
$acp = new admin_cache_functions();
|
|
$acp->ipsclass =& $this->ipsclass;
|
|
|
|
$justdone = intval($this->ipsclass->input['justdone']);
|
|
$justdone = $justdone ? $justdone : 1;
|
|
|
|
//-----------------------------------
|
|
// Get skins
|
|
//-----------------------------------
|
|
|
|
$this->ipsclass->DB->simple_construct( array( 'select' => '*',
|
|
'from' => 'skin_sets',
|
|
'where' => 'set_skin_set_id > '.$justdone,
|
|
'order' => 'set_skin_set_id',
|
|
'limit' => array( 0, 1 )
|
|
) );
|
|
|
|
$this->ipsclass->DB->simple_exec();
|
|
|
|
//-----------------------------------
|
|
// Got a biggun?
|
|
//-----------------------------------
|
|
|
|
$r = $this->ipsclass->DB->fetch_row();
|
|
|
|
if ( $r['set_skin_set_id'] )
|
|
{
|
|
$acp->_rebuild_all_caches( array($r['set_skin_set_id']) );
|
|
|
|
$extra = implode( "<br />", $acp->messages );
|
|
|
|
$this->ipsclass->core->redirect( "index.php?act=templatescache&justdone={$r['set_skin_set_id']}&loginkey={$this->ipsclass->input['loginkey']}&securekey={$this->ipsclass->input['securekey']}&mid={$this->ipsclass->input['mid']}", "Ïåðåñòðîéêà êåøà äëÿ ñòèëÿ «{$r['set_name']}»<br />{$extra}<br />Äàëåå ïåðåõîäèì ê ñëåäóþùåìó ñòèëþ..." );
|
|
}
|
|
else
|
|
{
|
|
$this->ipsclass->core->redirect( "index.php?act=finish&loginkey={$this->ipsclass->input['loginkey']}&securekey={$this->ipsclass->input['securekey']}&mid={$this->ipsclass->input['mid']}", "Íåò áîëüøå ñòèëåé äëÿ ïåðåñòðîéêè..." );
|
|
}
|
|
}
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
// REBUILD TEMPLATES
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
function rebuild_templates()
|
|
{
|
|
//-----------------------------------
|
|
// Get XML
|
|
//-----------------------------------
|
|
|
|
require_once( KERNEL_PATH.'class_xml.php' );
|
|
|
|
$xml = new class_xml();
|
|
$xml->lite_parser = 1;
|
|
|
|
//-----------------------------------
|
|
// Get XML file (TEMPLATES)
|
|
//-----------------------------------
|
|
|
|
$xmlfile = ROOT_PATH.'ipb_templates.xml';
|
|
|
|
$setting_content = implode( "", file($xmlfile) );
|
|
|
|
//-------------------------------
|
|
// Unpack the datafile (TEMPLATES)
|
|
//-------------------------------
|
|
|
|
$xml->xml_parse_document( $setting_content );
|
|
|
|
//-------------------------------
|
|
// (TEMPLATES)
|
|
//-------------------------------
|
|
|
|
if ( ! is_array( $xml->xml_array['templateexport']['templategroup']['template'] ) )
|
|
{
|
|
install_error("Îøèáêà â ôàéëå ipb_templates.xml — íåâîçìîæíî âûïîëíèòü ýòîò XML ôàéë");
|
|
}
|
|
|
|
foreach( $xml->xml_array['templateexport']['templategroup']['template'] as $id => $entry )
|
|
{
|
|
|
|
$row = $this->ipsclass->DB->simple_exec_query( array( 'select' => 'suid',
|
|
'from' => 'skin_templates',
|
|
'where' => "group_name='{$entry[ 'group_name' ]['VALUE']}' AND func_name='{$entry[ 'func_name' ]['VALUE']}' and set_id=1"
|
|
) );
|
|
|
|
if ( $row['suid'] )
|
|
{
|
|
$this->ipsclass->DB->do_update( 'skin_templates', array( 'func_data' => $entry[ 'func_data' ]['VALUE'],
|
|
'section_content' => $entry[ 'section_content' ]['VALUE'],
|
|
'updated' => time()
|
|
)
|
|
, 'suid='.$row['suid'] );
|
|
}
|
|
else
|
|
{
|
|
$this->ipsclass->DB->do_insert( 'skin_templates', array( 'func_data' => $entry[ 'func_data' ]['VALUE'],
|
|
'func_name' => $entry[ 'func_name' ]['VALUE'],
|
|
'section_content' => $entry[ 'section_content' ]['VALUE'],
|
|
'group_name' => $entry[ 'group_name' ]['VALUE'],
|
|
'updated' => time(),
|
|
'set_id' => 1
|
|
) );
|
|
}
|
|
}
|
|
|
|
//-----------------------------------
|
|
// Boink..
|
|
//-----------------------------------
|
|
|
|
$this->ipsclass->core->redirect( "index.php?act=templatescache&loginkey={$this->ipsclass->input['loginkey']}&securekey={$this->ipsclass->input['securekey']}&mid={$this->ipsclass->input['mid']}", "Ïåðåñòðîéêà ìàñòåð øàáëîíîâ, äàëåå ïåðåñòðîéêà îáû÷íûõ øàáëîíîâ..." );
|
|
}
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
// REBUILD CACHES
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
function rebuild_caches()
|
|
{
|
|
//-------------------------------------------------------------
|
|
// BBCODE
|
|
//-------------------------------------------------------------
|
|
|
|
$this->ipsclass->cache['bbcode'] = array();
|
|
|
|
$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'custom_bbcode' ) );
|
|
$bbcode = $this->ipsclass->DB->simple_exec();
|
|
|
|
while ( $r = $this->ipsclass->DB->fetch_row($bbcode) )
|
|
{
|
|
$this->ipsclass->cache['bbcode'][] = $r;
|
|
}
|
|
|
|
$this->ipsclass->update_cache( array( 'name' => 'bbcode', 'array' => 1, 'deletefirst' => 1 ) );
|
|
|
|
//-------------------------------------------------------------
|
|
// Forum cache
|
|
//-------------------------------------------------------------
|
|
|
|
$this->ipsclass->update_forum_cache();
|
|
|
|
//-------------------------------------------------------------
|
|
// Group Cache
|
|
//-------------------------------------------------------------
|
|
|
|
$this->ipsclass->cache['group_cache'] = array();
|
|
|
|
$this->ipsclass->DB->simple_construct( array( 'select' => "*",
|
|
'from' => 'groups'
|
|
) );
|
|
|
|
$this->ipsclass->DB->simple_exec();
|
|
|
|
while ( $i = $this->ipsclass->DB->fetch_row() )
|
|
{
|
|
$this->ipsclass->cache['group_cache'][ $i['g_id'] ] = $i;
|
|
}
|
|
|
|
$this->ipsclass->update_cache( array( 'name' => 'group_cache', 'array' => 1, 'deletefirst' => 1 ) );
|
|
|
|
//-------------------------------------------------------------
|
|
// Systemvars
|
|
//-------------------------------------------------------------
|
|
|
|
$this->ipsclass->cache['systemvars'] = array();
|
|
|
|
$result = $this->ipsclass->DB->simple_exec_query( array( 'select' => 'count(*) as cnt', 'from' => 'mail_queue' ) );
|
|
|
|
$this->ipsclass->cache['systemvars']['mail_queue'] = intval( $result['cnt'] );
|
|
$this->ipsclass->cache['systemvars']['task_next_run'] = time() + 3600;
|
|
|
|
$this->ipsclass->update_cache( array( 'name' => 'systemvars', 'array' => 1, 'deletefirst' => 1 ) );
|
|
|
|
//-----------------------------------------
|
|
// Moderators
|
|
//-----------------------------------------
|
|
|
|
$this->ipsclass->cache['moderators'] = array();
|
|
|
|
require_once( ROOT_PATH.'sources/action_admin/moderator.php' );
|
|
$mod = new ad_moderator();
|
|
$mod->ipsclass =& $this->ipsclass;
|
|
|
|
$mod->rebuild_moderator_cache();
|
|
|
|
//-----------------------------------------
|
|
// Cal events / Birthdays
|
|
//-----------------------------------------
|
|
|
|
require_once( ROOT_PATH . 'sources/action_admin/calendars.php' );
|
|
$calendars = new ad_calendars();
|
|
$calendars->ipsclass =& $this->ipsclass;
|
|
|
|
$calendars->calendar_rebuildcache( 0 );
|
|
|
|
//-------------------------------------------------------------
|
|
// Ranks
|
|
//-------------------------------------------------------------
|
|
|
|
$this->ipsclass->cache['ranks'] = array();
|
|
|
|
$this->ipsclass->DB->simple_construct( array( 'select' => 'id, title, pips, posts',
|
|
'from' => 'titles',
|
|
'order' => "posts DESC",
|
|
) );
|
|
|
|
$this->ipsclass->DB->simple_exec();
|
|
|
|
while ($i = $this->ipsclass->DB->fetch_row())
|
|
{
|
|
$this->ipsclass->cache['ranks'][ $i['id'] ] = array(
|
|
'TITLE' => $i['title'],
|
|
'PIPS' => $i['pips'],
|
|
'POSTS' => $i['posts'],
|
|
);
|
|
}
|
|
|
|
$this->ipsclass->update_cache( array( 'name' => 'ranks', 'array' => 1, 'deletefirst' => 1 ) );
|
|
|
|
|
|
//-------------------------------------------------------------
|
|
// SETTINGS
|
|
//-------------------------------------------------------------
|
|
|
|
require_once( ROOT_PATH . 'sources/action_admin/settings.php' );
|
|
$settings = new ad_settings();
|
|
$settings->ipsclass =& $this->ipsclass;
|
|
|
|
$settings->setting_rebuildcache();
|
|
|
|
//-------------------------------------------------------------
|
|
// EMOTICONS
|
|
//-------------------------------------------------------------
|
|
|
|
$this->ipsclass->cache['emoticons'] = array();
|
|
|
|
$this->ipsclass->DB->simple_construct( array( 'select' => 'typed,image,clickable,emo_set', 'from' => 'emoticons' ) );
|
|
$this->ipsclass->DB->simple_exec();
|
|
|
|
while ( $r = $this->ipsclass->DB->fetch_row() )
|
|
{
|
|
$this->ipsclass->cache['emoticons'][] = $r;
|
|
}
|
|
|
|
$this->ipsclass->update_cache( array( 'name' => 'emoticons', 'array' => 1, 'deletefirst' => 1 ) );
|
|
|
|
//-------------------------------------------------------------
|
|
// LANGUAGES
|
|
//-------------------------------------------------------------
|
|
|
|
$this->ipsclass->cache['languages'] = array();
|
|
|
|
$this->ipsclass->DB->simple_construct( array( 'select' => 'ldir,lname', 'from' => 'languages' ) );
|
|
$this->ipsclass->DB->simple_exec();
|
|
|
|
while ( $r = $this->ipsclass->DB->fetch_row() )
|
|
{
|
|
$this->ipsclass->cache['languages'][] = $r;
|
|
}
|
|
|
|
$this->ipsclass->update_cache( array( 'name' => 'languages', 'array' => 1, 'deletefirst' => 1 ) );
|
|
|
|
//-------------------------------------------------------------
|
|
// ATTACHMENT TYPES
|
|
//-------------------------------------------------------------
|
|
|
|
$this->ipsclass->cache['attachtypes'] = array();
|
|
|
|
$this->ipsclass->DB->simple_construct( array( 'select' => 'atype_extension,atype_mimetype,atype_post,atype_photo,atype_img', 'from' => 'attachments_type', 'where' => "atype_photo=1 OR atype_post=1" ) );
|
|
$this->ipsclass->DB->simple_exec();
|
|
|
|
while ( $r = $this->ipsclass->DB->fetch_row() )
|
|
{
|
|
$this->ipsclass->cache['attachtypes'][ $r['atype_extension'] ] = $r;
|
|
}
|
|
|
|
$this->ipsclass->update_cache( array( 'name' => 'attachtypes', 'array' => 1, 'deletefirst' => 1 ) );
|
|
|
|
$this->ipsclass->core->redirect( "index.php?act=templates&loginkey={$this->ipsclass->input['loginkey']}&securekey={$this->ipsclass->input['securekey']}&mid={$this->ipsclass->input['mid']}", "Êåøè ïåðåñòðîåíû, äàëåå ïåðåñòðîéêà øàáëîíîâ..." );
|
|
|
|
}
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
// MODULE RUN - Look for next, or finish up...
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
function module_complete()
|
|
{
|
|
$message = array();
|
|
|
|
//--------------------------------
|
|
// Upgrade templates
|
|
//--------------------------------
|
|
|
|
if ( @file_exists( THIS_PATH.'upg_'.$this->ipsclass->current_upgrade.'/components.php' ) )
|
|
{
|
|
require_once( THIS_PATH.'upg_'.$this->ipsclass->current_upgrade.'/components.php' );
|
|
|
|
$this->ipsclass->DB->do_update( 'skin_sets', array( 'set_css' => $CSS,
|
|
'set_cache_css' => $CSS,
|
|
'set_wrapper' => $WRAPPER,
|
|
'set_cache_wrapper' => $WRAPPER,
|
|
), 'set_skin_set_id=1' );
|
|
|
|
$message[] = "Øàáëîíû êîìïîíåíòîâ îáíîâëåíû...";
|
|
}
|
|
|
|
//--------------------------------
|
|
// ACP Perms
|
|
//--------------------------------
|
|
|
|
if ( @file_exists( THIS_PATH.'upg_'.$this->ipsclass->current_upgrade.'/ipb_acpperms.xml' ) )
|
|
{
|
|
//-------------------------------
|
|
// Load module...
|
|
//-------------------------------
|
|
|
|
require_once( ROOT_PATH . 'sources/action_admin/acppermissions.php' );
|
|
$settings = new ad_acppermissions();
|
|
$settings->ipsclass =& $this->ipsclass;
|
|
|
|
//-------------------------------
|
|
// Set location
|
|
//-------------------------------
|
|
|
|
$this->ipsclass->input['file_location'] = UPGRADE_DIR.'/upg_'.$this->ipsclass->current_upgrade.'/ipb_acpperms.xml';
|
|
|
|
//-------------------------------
|
|
// Run it
|
|
//-------------------------------
|
|
|
|
$settings->acpperms_xml_import( 1 );
|
|
|
|
$message[] = $this->ipsclass->main_msg;
|
|
}
|
|
|
|
//--------------------------------
|
|
// Settings
|
|
//--------------------------------
|
|
|
|
if ( @file_exists( THIS_PATH.'upg_'.$this->ipsclass->current_upgrade.'/ipb_settings_partial.xml' ) )
|
|
{
|
|
//-------------------------------
|
|
// Load module...
|
|
//-------------------------------
|
|
|
|
require_once( ROOT_PATH . 'sources/action_admin/settings.php' );
|
|
$settings = new ad_settings();
|
|
$settings->ipsclass =& $this->ipsclass;
|
|
|
|
//-------------------------------
|
|
// Set location
|
|
//-------------------------------
|
|
|
|
$this->ipsclass->input['file_location'] = UPGRADE_DIR.'/upg_'.$this->ipsclass->current_upgrade.'/ipb_settings_partial.xml';
|
|
|
|
//-------------------------------
|
|
// Run it
|
|
//-------------------------------
|
|
|
|
$settings->settings_do_import( 1 );
|
|
|
|
$message[] = $this->ipsclass->main_msg;
|
|
}
|
|
|
|
//------------------------------------------
|
|
// Update DB
|
|
//------------------------------------------
|
|
|
|
$this->ipsclass->DB->do_insert( 'upgrade_history', array( 'upgrade_version_id' => $this->ipsclass->current_upgrade,
|
|
'upgrade_version_human' => $this->ipsclass->versions[ $this->ipsclass->current_upgrade ],
|
|
'upgrade_date' => time(),
|
|
'upgrade_mid' => $this->ipsclass->input['mid']
|
|
) );
|
|
|
|
//------------------------------------------
|
|
// Anymore to run?
|
|
//------------------------------------------
|
|
|
|
if ( $this->ipsclass->last_poss_id != $this->ipsclass->current_upgrade )
|
|
{
|
|
$this->ipsclass->core->redirect( "index.php?act=work&loginkey={$this->ipsclass->input['loginkey']}&securekey={$this->ipsclass->input['securekey']}&mid={$this->ipsclass->input['mid']}",
|
|
implode( "<br />", $message ) . "<br />Îáíîâëåíèå ìîäóëÿ çàâåðøåíî, ïåðåìåùàåìñÿ ê îáíîâëåíèþ ñëåäóþùåãî ìîäóëÿ...." );
|
|
}
|
|
else
|
|
{
|
|
$this->ipsclass->template->content .= "
|
|
<div class='tableborder'>
|
|
<div class='maintitle'>Îáíîâëåíèå IPB çàâåðøåíî</div>
|
|
<div class='tdrow1' style='padding:6px'>".implode( "<br />", $message ) . "<br />
|
|
Âàø ôîðóì áûë óñïåøíî îáíîâëåí ñ {$this->ipsclass->versions[$this->ipsclass->current_version]} äî {$this->ipsclass->versions[$this->ipsclass->current_upgrade]}
|
|
<br /><br />
|
|
Ñëåäóþùèå ôèíàëüíûå ýòàïû ïðîâåðÿò íà îáíîâëåíèÿ íàñòðîéêè è ïåðåñòðîÿò âàøè êåø äàííûå (ôîðóìû, ãðóïïû, ìîäåðàòîðû è ò.ä.), à òàêæå ïåðåñòðîÿò âàøè ìàñòåð øàáëîíû...
|
|
<br /><br />
|
|
<div align='center'><span style='font-weight:bold;font-size:14px'>» <a href='index.php?act=recache&loginkey={$this->ipsclass->input['loginkey']}&securekey={$this->ipsclass->input['securekey']}&mid={$this->ipsclass->input['mid']}'>Äàëåå...</a></span></div>
|
|
</div>
|
|
</div>
|
|
";
|
|
|
|
$this->ipsclass->template->output();
|
|
|
|
}
|
|
}
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
// Redirect
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
function redirect($url, $text, $time=2)
|
|
{
|
|
$this->ipsclass->template->content .= "<meta http-equiv='refresh' content=\"{$time}; url={$url}\">
|
|
<div class='tableborder'>
|
|
<div class='maintitle'>Ïåðåàäðåñàöèÿ</div>
|
|
<div class='tdrow1' style='padding:8px'>
|
|
<div style='font-size:12px'>$text
|
|
<br />
|
|
<br />
|
|
<center><a href='{$url}'>Íàæìèòå ñþäà, åñëè âû íå áûëè ïåðåìåùåíû...</a></center>
|
|
</div>
|
|
</div>
|
|
</div>";
|
|
|
|
$this->ipsclass->template->output("Ïåðåàäðåñàöèÿ...");
|
|
}
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
// SHOW LOG IN SCREEN
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
function login_screen($msg='')
|
|
{
|
|
if ( ! file_exists( ROOT_PATH.'ipb_templates.xml' ) )
|
|
{
|
|
$alert .= "<div class='warnbox'><b>Íåâîçìîæíî íàéòè XML øàáëîíû</b><br />Îíè äîëæíû íàõîäèòüñÿ â «ipb_templates.xml» ïîæàëóéñòà ïðîâåðüòå, ÷òîáû ýòîò ôàéë áûë çàãðóæåí. Áåç íåãî ïðîäîëæåíèå íåâîçìîæíî.
|
|
<br /><strong>Åñëè âû íå çàãðóçèòå ýòîò ôàéë, òî âàøè øàáëîíû íå áóäóò îáíîâëåíû!</strong></div>";
|
|
}
|
|
|
|
if ( ! is_writeable( CACHE_PATH . 'cache/skin_cache' ) )
|
|
{
|
|
$alert .= "<div class='warnbox'><strong>ÂÍÈÌÀÍÈÅ: Ïàïêà cache/skin_cache íåäîñòóïíà äëÿ çàïèñè</strong><br />
|
|
Ïîæàëóéñòà, ïðîâåðüòå CHMOD äëÿ ýòîé ïàïêè. Åñëè âû ïðîèãíîðèðóåòå ýòî ïðåäóïðåæäåíèå, òî ôàéëû ñòèëåé
|
|
ìîãóò íåêîððåêòíî óñòàíîâèòüñÿ.</div>";
|
|
}
|
|
|
|
if ( $alert )
|
|
{
|
|
$this->ipsclass->template->content .= "{$alert}";
|
|
$this->ipsclass->template->output("ÂÍÈÌÀÍÈÅ");
|
|
exit();
|
|
}
|
|
|
|
if ( $msg != "" )
|
|
{
|
|
$msg = "<div class='warnbox'>$msg</div><br />";
|
|
}
|
|
|
|
$this->ipsclass->template->content .= "
|
|
<form action='index.php?act=login' method='post' name='theAdminForm'>
|
|
{$msg}
|
|
<div>
|
|
<strong>Âû îáÿçàíû àâòîðèçîâàòüñÿ ñ âàøèìè äàííûìè äëÿ âõîäà â âàø ôîðóì ïîä ó÷åòíîé çàïèñüþ àäìèíèñòðàòîðà. Èíà÷å âû ïðîñòî íå ñìîæåòå âîñïîëüçîâàòüñÿ ñèñòåìîé îáíîâëåíèÿ.
|
|
<br />Îáíîâëåíèå ñ âåðñèè {$this->ipsclass->versions[$this->ipsclass->current_version]} äî {$this->ipsclass->versions[$this->ipsclass->current_upgrade]}</strong>
|
|
</div>
|
|
<br />
|
|
<div class='tableborder'>
|
|
<div class='maintitle'>Òðåáóåòñÿ àâòîðèçàöèÿ</div>
|
|
<table width='100%' cellspacing='0' cellpadding='5' align='center' border='0'>
|
|
<tr>
|
|
<td class='tdrow1' width='40%' valign='middle'>Âàøå èìÿ ïîëüçîâàòåëÿ íà ôîðóìå:</td>
|
|
<td class='tdrow2' width='60%' valign='middle'><input type='text' style='width:100%' name='username' value=''></td>
|
|
</tr>
|
|
<tr>
|
|
<td class='tdrow1' width='40%' valign='middle'>Âàø ïàðîëü íà ôîðóìå:</td>
|
|
<td class='tdrow2' width='60%' valign='middle'><input type='password' style='width:100%' name='password' value=''></td>
|
|
</tr>
|
|
<tr>
|
|
<td class='pformstrip' colspan='2'><div align='center'><input type='submit' value='Âîéòè' id='button' accesskey='s'></div></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</form>";
|
|
|
|
$this->ipsclass->template->output("Âîéòè");
|
|
|
|
}
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
// Authorise da membah
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
function get_member()
|
|
{
|
|
$member = array( 'id' => 0 );
|
|
|
|
$this->ipsclass->loginkey = $this->check_md5( $this->ipsclass->input['loginkey'] );
|
|
$this->ipsclass->securekey = $this->check_md5( $this->ipsclass->input['securekey'] );
|
|
$this->ipsclass->member_id = trim(intval($this->ipsclass->input['mid'] ) );
|
|
|
|
if ( ! $this->ipsclass->loginkey or ! $this->ipsclass->securekey )
|
|
{
|
|
return $member;
|
|
}
|
|
|
|
$this->ipsclass->DB->query( "SELECT m.*, g.* FROM ibf_members m
|
|
LEFT JOIN ibf_groups g ON ( m.mgroup=g.g_id )
|
|
WHERE member_login_key='{$this->ipsclass->loginkey}' and id='{$this->ipsclass->member_id}'" );
|
|
|
|
$member = $this->ipsclass->DB->fetch_row();
|
|
|
|
return $member;
|
|
}
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
// Get the current version and the next version to upgrade to..
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
function get_version_latest()
|
|
{
|
|
$this->ipsclass->current_version = '';
|
|
$this->ipsclass->current_upgrade = '';
|
|
|
|
//------------------------------------------
|
|
// Copy & pop DB array and get next
|
|
// upgrade script
|
|
//------------------------------------------
|
|
|
|
$tmp = $this->ipsclass->db_contents;
|
|
|
|
$this->ipsclass->current_version = array_pop( $tmp );
|
|
|
|
//------------------------------------------
|
|
// Get the next upgrade script
|
|
//------------------------------------------
|
|
|
|
ksort( $this->ipsclass->dir_contents );
|
|
|
|
foreach( $this->ipsclass->dir_contents as $i => $a )
|
|
{
|
|
if ( $a > $this->ipsclass->current_version )
|
|
{
|
|
if ( ! $this->ipsclass->current_upgrade )
|
|
{
|
|
$this->ipsclass->current_upgrade = $a;
|
|
}
|
|
|
|
$this->ipsclass->modules_to_run[] = $this->ipsclass->versions[ $a ];
|
|
}
|
|
}
|
|
}
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
// GET INFO FROM THE DERTABASTIC
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
function get_db_structure()
|
|
{
|
|
$vers = array();
|
|
|
|
$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'upgrade_history', 'order' => 'upgrade_version_id ASC' ) );
|
|
$this->ipsclass->DB->simple_exec();
|
|
|
|
while( $r = $this->ipsclass->DB->fetch_row() )
|
|
{
|
|
$vers[ $r['upgrade_version_id'] ] = $r['upgrade_version_id'];
|
|
}
|
|
|
|
return $vers;
|
|
}
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
// Get dir structure..
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
function get_dir_structure()
|
|
{
|
|
$return = array();
|
|
|
|
//------------------------------------------
|
|
// Get the folder names
|
|
//------------------------------------------
|
|
|
|
$dh = opendir( THIS_PATH );
|
|
|
|
while ( $file = readdir( $dh ) )
|
|
{
|
|
if ( is_dir( THIS_PATH."/".$file ) )
|
|
{
|
|
if ( $file != "." && $file != ".." )
|
|
{
|
|
if ( strstr( $file, 'upg_' ) )
|
|
{
|
|
$tmp = str_replace( "upg_", "", $file );
|
|
$return[ $tmp ] = $tmp;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
closedir( $dh );
|
|
|
|
sort($return);
|
|
|
|
return $return;
|
|
}
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
// Check to see if its a 'real' MD5
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
function check_md5($t)
|
|
{
|
|
$t = preg_replace( "#[^a-z0-9]#", "", trim($t) );
|
|
|
|
if ( strlen($t) != 32 )
|
|
{
|
|
return '';
|
|
}
|
|
else
|
|
{
|
|
return $t;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
?>
|