Files
IPB/upload/sources/action_admin/skintools.php
T
2025-12-19 00:21:15 -08:00

1470 lines
53 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
+---------------------------------------------------------------------------
| > $Date: 2005-10-10 14:08:54 +0100 (Mon, 10 Oct 2005) $
| > $Revision: 23 $
| > $Author: matt $
+---------------------------------------------------------------------------
|
| > Skin Tools
| > Module written by Matt Mecham
| > Date started: 22nd January 2004
|
| > Module Version Number: 1.0.0
| > DBA Checked: Tue 25th May 2004
+--------------------------------------------------------------------------
*/
if ( ! defined( 'IN_ACP' ) )
{
print "<h1>Íåâåðíûé âõîä</h1> Ó Âàñ íåò äîñòóïà ê äèðåêòèâå ýòîãî ôàéëà. Åñëè Âû ïðîâîäèëè îáíîâëåíèÿ, óáåäèòåñü, ÷òî íå çàáûëè îáíîâèòü 'admin.php'.";
exit();
}
class ad_skintools {
var $base_url;
var $db_html_files = "";
var $ff_html_files = "";
var $skin_id = "";
var $ff_fixes = array();
var $log = array();
/**
* Section title name
*
* @var string
*/
var $perm_main = "lookandfeel";
/**
* Section title name
*
* @var string
*/
var $perm_child = "skintools";
function auto_run()
{
$this->ipsclass->admin->page_detail = "Ïîæàëóéñòà ïðî÷èòàéòå âíèìàòåëüíî èíñòðóêöèè ïåðåä èñïîëüçîâàíèåì êàêîãî-ëèáî èíñòðóìåíòà.";
$this->ipsclass->admin->page_title = "Èíñòðóìåíòû øàáëîíîâ";
//-----------------------------------------
// Kill globals - globals bad, Homer good.
//-----------------------------------------
$tmp_in = array_merge( $_GET, $_POST, $_COOKIE );
foreach ( $tmp_in as $k => $v )
{
unset($$k);
}
//-----------------------------------------
switch($this->ipsclass->input['code'])
{
case 'rebuildcaches':
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':recache' );
$this->rebuildcaches();
break;
case 'rebuildmaster':
$this->rebuildmaster();
break;
case 'rebuildmasterhtml':
$this->rebuildmaster_html();
break;
case 'rebuildmastercomponents':
$this->rebuildmaster_components();
break;
case 'changemember':
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':changemember' );
$this->change_member();
break;
//-----------------------------------------
// Search stuff
//-----------------------------------------
case 'searchsplash':
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':search' );
$this->searchreplace_start();
break;
case 'simplesearch':
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':search' );
$this->simple_search();
break;
case 'searchandreplace':
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':search' );
$this->search_and_replace();
break;
//-----------------------------------------
// Search stuff
//-----------------------------------------
case 'easylogo':
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':' );
$this->easy_logo_start();
break;
case 'easylogo_complete':
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':' );
$this->easy_logo_complete();
break;
default:
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':' );
$this->show_intro();
break;
}
}
//-----------------------------------------
// EASY LOGO CHANGER (COMPLETE)
//-----------------------------------------
function easy_logo_complete()
{
//-----------------------------------------
// Init
//-----------------------------------------
$master = array();
//-----------------------------------------
// Check id
//-----------------------------------------
if ( ! $this->ipsclass->input['set_skin_set_id'] )
{
$this->ipsclass->main_msg = "Íå âûáðàí ID øàáëîíà, âåðíèòåñü íàçàä è ïîâòîðèòå ïîïûòêó";
$this->easy_logo_start();
}
//-----------------------------------------
// Grab the default template bit
//-----------------------------------------
$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'skin_templates', 'where' => "group_name='skin_global' AND func_name='global_board_header'" ) );
$this->ipsclass->DB->simple_exec();
while( $r = $this->ipsclass->DB->fetch_row() )
{
$master[ $r['set_id'] ] = $r;
}
if ( ! is_array($master[ $this->ipsclass->input['set_skin_set_id'] ]) )
{
$final_html = $master[1]['section_content'];
}
else
{
$final_html = $master[ $this->ipsclass->input['set_skin_set_id'] ]['section_content'];
}
if ( ! strstr( $final_html, '<!--ipb.logo.end-->' ) )
{
$this->ipsclass->main_msg = "Íåâîçìîæíî íàéòè ëîãîòèï äëÿ ýòîãî øàáëîíà, óáåäèòåñü â òîì, ÷òî âàø øàáëîí îáíîâëåí.";
$this->easy_logo_start();
}
//-----------------------------------------
// Check for content
//-----------------------------------------
if ( ! $_POST['headerhtml'] )
{
//$this->ipsclass->main_msg = "Îáùåå ñîäåðæàíèå ñåêöèè ïóñòî!";
//$this->easy_logo_start();
}
if ( ! $_POST['javascripthtml'] )
{
//$this->ipsclass->main_msg = "Ñîäåðæàíèå ñåêöèè javascript ïóñòî!";
//$this->easy_logo_start();
}
if ( ! $_POST['leftlinkshtml'] )
{
//$this->ipsclass->main_msg = "Ñîäåðæàíèå ñåêöèè ëåâûõ ññûëîê ïóñòîå!";
//$this->easy_logo_start();
}
if ( ! $_POST['rightlinkshtml'] )
{
//$this->ipsclass->main_msg = "Ñîäåðæàíèå ñåêöèè ïðàâûõ ññûëîê ïóñòîå!";
//$this->easy_logo_start();
}
//-----------------------------------------
// Check for tags
//-----------------------------------------
foreach( array( 'JAVASCRIPT', 'BOARD_LOGO', 'LEFT_HAND_SIDE_LINKS', 'RIGHT_HAND_SIDE_LINKS' ) as $hehe )
{
if ( ! strstr( $_POST['headerhtml'], '<{'.$hehe.'}>' ) )
{
//$this->ipsclass->main_msg = "The &lt;{".$hehe."}&gt; tag is missing!";
//$this->easy_logo_start();
}
}
//-----------------------------------------
// Upload or new logo?
//-----------------------------------------
if ( $_FILES['FILE_UPLOAD']['name'] == "" or ! $_FILES['FILE_UPLOAD']['name'] or ($_FILES['FILE_UPLOAD']['name'] == "none") )
{
if ( ! $_POST['logo_url'] )
{
$this->ipsclass->main_msg = "Âû äîëæíû ëèáî çàãðóçèòü íîâûé ëîãîòèï, ëèáî ââåñòè ññûëêó íà ñóùåñòâóþùèé";
$this->easy_logo_start();
}
$newlogo = $_POST['logo_url'];
}
else
{
if ( ! is_writable( CACHE_PATH.'style_images' ) )
{
$this->ipsclass->main_msg = "Âû äîëæíû áûòü óâåðåíû, ÷òî ó 'style_images' ñòîÿò ïðàâèëüíûå ïðàâà (CHMOD) íà çàïèñü â íåå. Äîëæíû ñòîÿòü 0777.";
$this->easy_logo_start();
}
//-----------------------------------------
// Upload
//-----------------------------------------
$FILE_NAME = $_FILES['FILE_UPLOAD']['name'];
$FILE_SIZE = $_FILES['FILE_UPLOAD']['size'];
$FILE_TYPE = $_FILES['FILE_UPLOAD']['type'];
//-----------------------------------------
// Naughty Opera adds the filename on the end of the
// mime type - we don't want this.
//-----------------------------------------
$FILE_TYPE = preg_replace( "/^(.+?);.*$/", "\\1", $FILE_TYPE );
//-----------------------------------------
// Correct file type?
//-----------------------------------------
if ( ! preg_match( "#\.(?:gif|jpg|jpeg|png)$#is", $FILE_NAME ) )
{
$this->ipsclass->main_msg = "Íåâåðíûé ôîðìàò ôàéëà. Ôàéë äîëæåí èìåòü ôîðìàò GIF, JPEG èëè PNG.";
$this->easy_logo_start();
}
if ( move_uploaded_file( $_FILES[ 'FILE_UPLOAD' ]['tmp_name'], CACHE_PATH."style_images/".$FILE_NAME) )
{
@chmod( CACHE_PATH."style_images/".$FILE_NAME, 0777 );
}
else
{
$this->ipsclass->main_msg = "Íåóäà÷íàÿ çàãðóçêà. Ïðîâåðüòå ïðàâà äîñòóïà (CHMOD) ó ïàïêè 'style_images' è óáåäèòåñü, ÷òî çàãðóæàåìûé ôàéë èìååò ðàçìåð ìåíüøå, ÷åì 2 Mb.";
$this->easy_logo_start();
}
$newlogo = "style_images/".urlencode($FILE_NAME);
}
//-----------------------------------------
// Convert back stuff
//-----------------------------------------
foreach( array( 'headerhtml', 'javascripthtml', 'leftlinkshtml', 'rightlinkshtml' ) as $mail )
{
//$_POST[ $mail ] = $this->ipsclass->admin->form_to_text( $_POST[ $mail ] );
//$_POST[ $mail ] = str_replace( "\r\n", "\n", $_POST[ $mail ] );
}
//-----------------------------------------
// Okay! Form the template
//-----------------------------------------
//$final_html = $_POST['headerhtml'];
//$final_html = str_replace( "<{BOARD_LOGO}>", "<!--ipb.logo.start--><img src='$newlogo' alt='IPB' style='vertical-align:top' border='0' /><!--ipb.logo.end-->" , $final_html );
//$final_html = str_replace( "<{JAVASCRIPT}>", "<!--ipb.javascript.start-->\n{$_POST['javascripthtml']}\n<!--ipb.javascript.end-->" , $final_html );
//$final_html = str_replace( "<{LEFT_HAND_SIDE_LINKS}>", "<!--ipb.leftlinks.start-->{$_POST['leftlinkshtml']}<!--ipb.leftlinks.end-->" , $final_html );
//$final_html = str_replace( "<{RIGHT_HAND_SIDE_LINKS}>", "<!--ipb.rightlinks.start-->{$_POST['rightlinkshtml']}<!--ipb.rightlinks.end-->", $final_html );
$final_html = preg_replace( "#<!--ipb.logo.start-->.+?<!--ipb.logo.end-->#si", "<!--ipb.logo.start--><img src='$newlogo' alt='IPB' style='vertical-align:top' border='0' /><!--ipb.logo.end-->" , $final_html );
//-----------------------------------------
// Update the DeeBee
//-----------------------------------------
$this->ipsclass->DB->simple_exec_query( array( 'delete' => 'skin_templates', 'where' => "set_id={$this->ipsclass->input['set_skin_set_id']} AND group_name='skin_global' AND func_name='global_board_header'" ) );
$this->ipsclass->DB->do_insert( 'skin_templates', array( 'section_content' => $final_html,
'set_id' => $this->ipsclass->input['set_skin_set_id'],
'group_name' => 'skin_global',
'func_name' => 'global_board_header',
'func_data' => '$component_links=""'
) );
$this->ipsclass->cache_func->_rebuild_all_caches(array($this->ipsclass->input['set_skin_set_id']));
$this->ipsclass->main_msg = 'Ëîãîòèï èçìåíåí. Êåø øàáëîíà ïåðåñòðîåí (ID: '.$this->ipsclass->input['set_skin_set_id'].')';
$this->ipsclass->main_msg .= "<br />".implode("<br />", $this->ipsclass->cache_func->messages);
$this->easy_logo_start();
}
//-----------------------------------------
// EASY LOGO CHANGER (START)
//-----------------------------------------
function easy_logo_start()
{
//-----------------------------------------
// Init
//-----------------------------------------
$master = array();
$skin_list = "";
$html = array();
//-----------------------------------------
// Grab the default template bit
//-----------------------------------------
$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'skin_templates', 'where' => "group_name='skin_global' AND func_name='global_board_header'" ) );
$this->ipsclass->DB->simple_exec();
while( $r = $this->ipsclass->DB->fetch_row() )
{
$master[ $r['set_id'] ] = $r;
}
if ( ! $master[1]['section_content'] )
{
$this->ipsclass->main_msg = "Íåâîçìîæíî íàéòè áàçîâûé ôðàãìåíò øàáëîíà 'global_board_header'";
$this->show_intro();
}
if ( ! strstr( $master[1]['section_content'], '<!--ipb.logo.end-->' ) )
{
$this->ipsclass->main_msg = "Íåâîçìîæíî íàéòè òýã ëîãîòèïà, óáåäèòåñü â òîì, ÷òî âàø øàáëîí îáíîâëåí.";
$this->show_intro();
}
//-----------------------------------------
// Get Skin Names
//-----------------------------------------
$skin_list = $this->_get_skinlist();
//-----------------------------------------
// get URL
//-----------------------------------------
preg_match( "#<!--ipb.logo.start--><img src=[\"'](.+?)[\"'].+?<!--ipb.logo.end-->#si", $master[1]['section_content'], $match );
$current_img_url = $match[1];
//-----------------------------------------
// get current HTML
//-----------------------------------------
$current_html = $master[1]['section_content'];
$current_html = preg_replace( "#<!--ipb.javascript.start-->.+?<!--ipb.javascript.end-->#is" , "<{JAVASCRIPT}>" , $current_html );
$current_html = preg_replace( "#<!--ipb.logo.start--><img src=[\"'](.+?)[\"'].+?<!--ipb.logo.end-->#si" , "<{BOARD_LOGO}>" , $current_html );
$current_html = preg_replace( "#<!--ipb.leftlinks.start-->.+?<!--ipb.leftlinks.end-->#si" , "<{LEFT_HAND_SIDE_LINKS}>" , $current_html );
$current_html = preg_replace( "#<!--ipb.rightlinks.start-->.+?<!--ipb.rightlinks.end-->#si" , "<{RIGHT_HAND_SIDE_LINKS}>" , $current_html );
//-----------------------------------------
// Regex out me bits
//-----------------------------------------
preg_match( "#<!--ipb.javascript.start-->(.+?)<!--ipb.javascript.end-->#si", $master[1]['section_content'], $match );
$html['javascript'] = $this->ipsclass->admin->text_to_form($match[1]);
preg_match( "#<!--ipb.leftlinks.start-->(.+?)<!--ipb.leftlinks.end-->#si" , $master[1]['section_content'], $match );
$html['leftlinks'] = $this->ipsclass->admin->text_to_form($match[1]);
preg_match( "#<!--ipb.rightlinks.start-->(.+?)<!--ipb.rightlinks.end-->#si" , $master[1]['section_content'], $match );
$html['rightlinks'] = $this->ipsclass->admin->text_to_form($match[1]);
$current_html = $this->ipsclass->admin->text_to_form($current_html);
//-----------------------------------------
// Can we upload into style_images?
//-----------------------------------------
if ( ! is_writable( CACHE_PATH.'style_images' ) )
{
$warning = "<div class='redbox' style='padding:4px'><strong>ÏÐÅÄÓÏÐÅÆÄÅÍÈÅ: Íåâîçìîæíî çàãðóçèòü ôàéëû â ïàïêó 'style_images'. Åñëè âû õîòèòå çàãðóçèòü ôàéë, ïðîâåðüòå ïðàâà äîñòóïà (CHMOD) ê ïàïêå.</strong></div>";
}
//-----------------------------------------
// Start the form
//-----------------------------------------
$this->ipsclass->html .= $this->ipsclass->adskin->start_form( array( 1 => array( 'act' , 'skintools' ),
2 => array( 'code' , 'easylogo_complete' ),
3 => array( 'MAX_FILE_SIZE', '10000000000' ),
4 => array( 'section', $this->ipsclass->section_code ),
) , "uploadform", " enctype='multipart/form-data'" );
$this->ipsclass->html .= "<div class='tableborder'>
<div class='maintitle'>Óñòàíîâêà ëîãîòèïà</div>
<div class='tablepad'>
$warning
<fieldset class='tdfset'>
<legend><strong>Êîíôèãóðàöèÿ</strong></legend>
<table width='100%' cellpadding='5' cellspacing='0' border='0'>
<tr>
<td width='40%' class='tdrow1'>Ê êàêîìó øàáëîíó äîáàâèòü ëîãîòèï?<div class='graytext'>Åñëè âû óæå èçìåíÿëè øàïêó (âåðõíèé êîëîíòèòóë) øàáëîíà èç 'Óïðàâëåíèÿ øàáëîíàìè', òî ýòî äåéñòâèå óäàëèò âñå âàøè èçìåíåíèÿ.</div></td>
<td width='60%' class='tdrow1'>$skin_list</td>
</tr>
<tr>
<td width='40%' class='tdrow1'>Ññûëêà ê ëîãîòèïó<div class='graytext'>Âû ìîæåòå èñïîëüçîâàòü îòíîñèòåëüíûå ññûëêè èëè ïîëíûé URL, íà÷èíàþùèéñÿ ñ <b>http://</div></td>
<td width='60%' class='tdrow1'>".$this->ipsclass->adskin->form_simple_input('logo_url', $_POST['logo_url'] ? $_POST['logo_url'] : $current_img_url, '60' )."</td>
</tr>
<tr>
<td width='40%' class='tdrow1'><b><u>ÈËÈ</u></b> çàãðóçèòü íîâûé ëîãîòèï<div class='graytext'>Âûáåðèòå ôàéë äëÿ çàãðóçêè ñ âàøåãî êîìïüþòåðà. Ôàéë äîëæåí èìåòü ðàçðåøåíèå <b>.gif</b>, <b>.jpg</b>, <b>.jpeg</b> èëè <b>.png</b></div></td>
<td width='60%' class='tdrow1'>".$this->ipsclass->adskin->form_upload()."</td>
</tr>
</table>
</fieldset>
<!--<fieldset class='tdfset'>
<legend><strong>Íàñòðîéêà øàïêè ôîðóìà</strong></legend>
<table width='100%' cellpadding='5' cellspacing='0' border='0'>
<tr>
<td width='100%' align='center' class='tdrow1'><div align='left'><b>Îáùèé ñëîé</b></div><br />".$this->ipsclass->adskin->form_textarea( 'headerhtml', $_POST['headerhtml'] ? $_POST['headerhtml'] : $current_html, 80, 10, 'soft', '', 'width:100%')."</td>
</tr>
<tr>
<td width='100%' align='center' class='tdrow1'><div align='left'><b>&lt;{JAVASCRIPT}&gt;</b></div><br />".$this->ipsclass->adskin->form_textarea( 'javascripthtml', $_POST['javascripthtml'] ? $_POST['javascripthtml'] : $html['javascript'], 80, 5, 'soft', '', 'width:100%')."</td>
</tr>
<tr>
<td width='100%' align='center' class='tdrow1'><div align='left'><b>&lt;{LEFT_HAND_SIDE_LINKS}&gt;</b></div><br />".$this->ipsclass->adskin->form_textarea( 'leftlinkshtml', $_POST['leftlinkshtml'] ? $_POST['leftlinkshtml'] : $html['leftlinks'], 80, 5, 'soft', '', 'width:100%')."</td>
</tr>
<tr>
<td width='100%' align='center' class='tdrow1'><div align='left'><b>&lt;{RIGHT_HAND_SIDE_LINKS}&gt;</b></div><br />".$this->ipsclass->adskin->form_textarea( 'rightlinkshtml', $_POST['rightlinkshtml'] ? $_POST['rightlinkshtml'] : $html['rightlinks'], 80, 5, 'soft', '', 'width:100%')."</td>
</tr>
</table>
</fieldset>-->
</div>
</div>";
//-----------------------------------------
$this->ipsclass->html .= $this->ipsclass->adskin->end_form_standalone("Óñòàíîâèòü");
//-----------------------------------------
$this->ipsclass->admin->output();
}
//-----------------------------------------
// REBUILD MASTER COMPONENTS
//-----------------------------------------
function rebuildmaster_components()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$CSS = "";
$WRAPPER = "";
$file = ROOT_PATH . 'install/installfiles/components.php';
if ( ! file_exists( $file ) )
{
$this->ipsclass->main_msg = "$file íå íàéäåí. Ïîæàëóéñòà, âåðíèòåñü è ïðîâåðüòå åùå âñå åùå ðàç";
$this->show_intro();
}
require_once( $file );
if ( $CSS AND $WRAPPER )
{
$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' );
}
$this->ipsclass->main_msg = "Êîìïîíåíòû øàáëîíà èçìåíåíû";
$this->show_intro();
}
//-----------------------------------------
// REBUILD MASTER HTML
//-----------------------------------------
function rebuildmaster_html()
{
$master = array();
$inserts = 0;
$updates = 0;
//-----------------------------------------
// Template here?
//-----------------------------------------
if ( ! file_exists( ROOT_PATH.'ipb_templates.xml' ) )
{
$this->ipsclass->main_msg = "Ôàéë 'ipb_templates.xml' íå íàéäåí â êîðíå âàøåãî ôîðóìà. Ïîæàëóéñòà, çàãðóçèòå åãî";
$this->show_intro();
}
//-----------------------------------------
// First, get all the default bits
//-----------------------------------------
$this->ipsclass->DB->simple_construct( array( 'select' => 'suid,group_name,func_name', 'from' => 'skin_templates', 'where' => 'set_id=1' ) );
$this->ipsclass->DB->simple_exec();
while ( $r = $this->ipsclass->DB->fetch_row() )
{
$master[ strtolower( $r['group_name'] ) ][ strtolower( $r['func_name'] ) ] = $r['suid'];
}
//-----------------------------------------
// Get XML
//-----------------------------------------
require_once( KERNEL_PATH.'class_xml.php' );
$xml = new class_xml();
//-----------------------------------------
// 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'] ) )
{
$this->ipsclass->main_msg = "Îøèáêà â ôàéëå 'ipb_templates.xml', íåâîçìîæíî ðàñïàðñèòü XML-àðõèâ";
$this->show_intro();
}
foreach( $xml->xml_array['templateexport']['templategroup']['template'] as $id => $entry )
{
$newrow = array();
$newrow['group_name'] = $entry[ 'group_name' ]['VALUE'];
$newrow['section_content'] = $entry[ 'section_content' ]['VALUE'];
$newrow['func_name'] = $entry[ 'func_name' ]['VALUE'];
$newrow['func_data'] = $entry[ 'func_data' ]['VALUE'];
$newrow['set_id'] = 1;
$newrow['updated'] = time();
if ( $master[ strtolower( $newrow['group_name'] ) ][ strtolower( $newrow['func_name'] ) ] )
{
//-----------------------------------------
// Update
//-----------------------------------------
$updates++;
$this->ipsclass->DB->do_update( 'skin_templates', $newrow, 'suid='.$master[ strtolower( $newrow['group_name'] ) ][ strtolower( $newrow['func_name'] ) ] );
}
else
{
//-----------------------------------------
// Insert
//-----------------------------------------
$inserts++;
$this->ipsclass->DB->do_insert( 'skin_templates', $newrow );
}
}
$this->ipsclass->main_msg = "Áàçîâûé øàáëîí ïåðåñòðîåí!<br />Ïðîèçâåäåíî $updates îáíîâëåíèé è $inserts äîáàâëåíèé";
$this->show_intro();
}
//-----------------------------------------
// COMPLEX SEARCH
//-----------------------------------------
function search_and_replace()
{
//-----------------------------------------
// Get $skin_names stuff
//-----------------------------------------
require_once( ROOT_PATH.'sources/lib/skin_info.php' );
$SEARCH_set = intval( $this->ipsclass->input['set_skin_set_id'] );
//-----------------------------------------
// Get set stuff
//-----------------------------------------
$this_set = $this->ipsclass->DB->simple_exec_query( array( 'select' => '*', 'from' => 'skin_sets', 'where' => 'set_skin_set_id='.$SEARCH_set ) );
//-----------------------------------------
// Clean up before / after
//-----------------------------------------
$before = $this->ipsclass->txt_stripslashes($_POST['searchfor']);
$after = $this->ipsclass->txt_stripslashes($_POST['replacewith']);
$before = str_replace( '"', '\"', $before );
$after = str_replace( '"', '\"', $after );
if ( ! $before )
{
$this->ipsclass->main_msg = "Âû íå ââåëè çíà÷åíèå äëÿ ïîèñêà.";
$this->searchreplace_start();
}
//-----------------------------------------
// Clean up regex
//-----------------------------------------
if ( $this->ipsclass->input['regexmode'] )
{
$before = str_replace( '#', '\#', $before );
//-----------------------------------------
// Test to ensure they are legal
// - catch warnings, etc
//-----------------------------------------
ob_start();
eval( "preg_replace( \"#{$before}#i\", \"{$after}\", '' );");
$return = ob_get_contents();
ob_end_clean();
if ( $return )
{
$this->ipsclass->main_msg = "Ïðîèçîøëà îøèáêà âî âðåìÿ çàìåíû - ïðîâåðüòå ââåäåííûå çíà÷åíèÿ äëÿ ïîèñêà è çàìåíû.";
$this->searchreplace_start();
}
}
//-----------------------------------------
// we're here, so it's good
//-----------------------------------------
$templates = array();
$matches = 0;
$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'skin_templates', 'where' => 'set_id='.$SEARCH_set ) );
$this->ipsclass->DB->simple_exec();
while ( $r = $this->ipsclass->DB->fetch_row() )
{
if ( $this->ipsclass->input['regexmode'] )
{
if ( preg_match( "#{$before}#i", $r['section_content'] ) )
{
$templates[ $r['group_name'] ][ strtolower($r['func_name']) ] = $r;
$matches++;
}
}
else if ( strstr( $r['section_content'], $before ) )
{
$templates[ $r['group_name'] ][ strtolower($r['func_name']) ] = $r;
$matches++;
}
}
//-----------------------------------------
// No matches...
//-----------------------------------------
if ( ! count($templates) )
{
$this->ipsclass->html .= "<div class='tableborder'>
<div class='maintitle'>Ðåçóëüòàòû ïîèñêà è çàìåíû</div>
<div class='tablepad'>
<b>Âû èñêàëè: ".stripslashes(htmlspecialchars($before))."</b>
<br />
<br />
Íå íàéäåíî íè îäíîé çàïèñè, ñîîòâåòñòâóþùåé èñêîìîé ñòðîêå. Ïîïðîáóéòå åùå ðàç è ðàñøèðüòå äèàïàçîí ïîèñêà.
</div>
</div>";
$this->ipsclass->admin->output();
}
//-----------------------------------------
// Swapping or showing?
//-----------------------------------------
if ( $this->ipsclass->input['testonly'] )
{
$this->ipsclass->html .= "<div class='tableborder'>
<div class='maintitle'>Ðåçóëüòàòû ïîèñêà è çàìåíû</div>
<div class='tablepad' style='padding:5px'><b style='font-size:12px'>{$matches} àïèñåé ñîäåðæàùèõ '".htmlentities($before)."' çàìåíåíû íà '".htmlentities($after)."'</b><br /><br />";
//-----------------------------------------
// Go fru dem all and print..
//-----------------------------------------
foreach( $templates as $group => $d )
{
foreach( $templates[ $group ] as $tmp_name => $tmp_data )
{
if ( isset($skin_names[ $group ]) )
{
$group_name = $skin_names[ $group ][0];
}
else
{
$group_name = $group;
}
$html = $tmp_data['section_content'];
//-----------------------------------------
// Decode...
//-----------------------------------------
$hl = $before;
$after = str_replace( '\\\\', '\\\\\\', $after );
if ( ! $after )
{
$hl = preg_replace( "#\((.+?)\)#s", "(?:\\1)", $hl );
$html = preg_replace( "#({$hl})#si" , '{#-^--opentag--^-#}'."\\1".'{#-^--closetag--^-#}', $html );
}
else
{
//-----------------------------------------
// Wrap tags (so we don't use
// < >, etc )
//-----------------------------------------
$html = preg_replace( "#{$hl}#si", '{#-^--opentag--^-#}'.$after.'{#-^--closetag--^-#}', $html );
}
//-----------------------------------------
// Clean up..
//-----------------------------------------
$html = str_replace( "{#-^--opentag--^-#}\\", '{#-^--opentag--^-#}', $html );
//-----------------------------------------
// convert to printable html
//-----------------------------------------
$html = str_replace( "<" , "&lt;" , $html);
$html = str_replace( ">" , "&gt;" , $html);
$html = str_replace( "\"", "&quot;", $html);
$html = preg_replace( "!&lt;\!--(.+?)(//)?--&gt;!s" , "&#60;&#33;<span style='color:red'>--\\1--\\2</span>&#62;", $html );
$html = preg_replace( "#&lt;([^&<>]+)&gt;#s" , "<span style='color:blue'>&lt;\\1&gt;</span>" , $html ); //Matches <tag>
$html = preg_replace( "#&lt;([^&<>]+)=#s" , "<span style='color:blue'>&lt;\\1</span>=" , $html ); //Matches <tag
$html = preg_replace( "#&lt;/([^&]+)&gt;#s" , "<span style='color:blue'>&lt;/\\1&gt;</span>" , $html ); //Matches </tag>
$html = preg_replace( "!=(&quot;|')([^<>])(&quot;|')(\s|&gt;)!s" , "=\\1<span style='color:purple'>\\2</span>\\3\\4" , $html ); //Matches ='this'
//-----------------------------------------
// convert back wrap tags
//-----------------------------------------
$html = str_replace( '{#-^--opentag--^-#}' , "<span style='color:red;font-weight:bold;background-color:yellow'>", $html );
$html = str_replace( '{#-^--closetag--^-#}', "</span>", $html );
$this->ipsclass->html .= "<div class='tableborder'>
<div class='maintitle'>{$group_name} &middot; {$tmp_data['func_name']}</div>
<div class='tdrow2' style='height:100px;overflow:auto'><pre>{$html}</pre></div>
</div>
<br />";
}
}
$this->ipsclass->html .= "</div></div>";
$this->ipsclass->admin->nav[] = array( "", "Ðåçóëüòàòû ïîèñêà â øàáëîíå ".$this_set['set_name'] );
$this->ipsclass->admin->output();
}
else
{
//-----------------------------------------
// Jus' do iiit
//-----------------------------------------
$after = str_replace( '\\\\', '\\\\\\', $after );
$report = array();
foreach( $templates as $group => $d )
{
foreach( $templates[ $group ] as $tmp_name => $tmp_data )
{
if ( $this->ipsclass->input['regexmode'] )
{
$tmp_data['section_content'] = preg_replace( "#{$before}#si", $after, $tmp_data['section_content'] );
}
else
{
$tmp_data['section_content'] = str_replace( $before, $after, $tmp_data['section_content'] );
}
//-----------------------------------------
// Update DB
//-----------------------------------------
$this->ipsclass->DB->do_update( 'skin_templates', array( 'section_content' => $tmp_data['section_content'] ), 'suid='.$tmp_data['suid'] );
$report[] = $tmp_data['func_name'].' îáíîâëåíî...';
}
}
//-----------------------------------------
// Recache skin template..
//-----------------------------------------
$this->ipsclass->cache_func->_recache_templates( $SEARCH_set, $this_set['set_skin_set_parent'] );
$report[] = "Templates recached for set {$this_set['set_name']}";
$this->ipsclass->main_msg = implode( "<br />", $report );
$this->searchreplace_start();
}
}
//-----------------------------------------
// SIMPLE SEARCH
//-----------------------------------------
function simple_search()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$rawword = $_GET['searchkeywords'] ? urldecode( $_GET['searchkeywords'] ) : $_POST['searchkeywords'];
$templates = array();
$final = array();
$matches = array();
//-----------------------------------------
// CLEAN UP
//-----------------------------------------
$SEARCH_word = trim( $this->ipsclass->txt_safeslashes( $rawword ) );
$SEARCH_safe = urlencode( $SEARCH_word );
$SEARCH_all = intval( $this->ipsclass->input['searchall'] );
$SEARCH_set = intval( $this->ipsclass->input['set_skin_set_id'] );
//-----------------------------------------
// check (please?)
//-----------------------------------------
if ( ! $SEARCH_word )
{
$this->ipsclass->main_msg = "Âû äîëæíû ââåñòè èñêîìîå ñëîâî";
$this->searchreplace_start();
}
//-----------------------------------------
// Get set stuff
//-----------------------------------------
$this_set = $this->ipsclass->DB->simple_exec_query( array( 'select' => '*', 'from' => 'skin_sets', 'where' => 'set_skin_set_id='.$SEARCH_set ) );
if ( ! $this_set['set_skin_set_id'] )
{
$this->ipsclass->main_msg = " áàçå äàííûõ íè÷åãî íå áûëî íàéäåíî";
$this->searchreplace_start();
}
//-----------------------------------------
// Get templates from DB
//-----------------------------------------
if ( $SEARCH_all )
{
$templates = $this->ipsclass->cache_func->_get_templates( $this_set['set_skin_set_id'], $this_set['set_skin_set_parent'], 'all' );
}
else
{
$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'skin_templates', 'where' => 'set_id='.$SEARCH_set ) );
$this->ipsclass->DB->simple_exec();
while ( $r = $this->ipsclass->DB->fetch_row() )
{
$templates[ $r['group_name'] ][ strtolower($r['func_name']) ] = $r;
}
}
if ( ! count( $templates ) )
{
$this->ipsclass->main_msg = "Øàáëîíû íå íàéäåíû!";
$this->searchreplace_start();
}
//-----------------------------------------
// Go fru dem all and search
//-----------------------------------------
foreach( $templates as $group => $d )
{
foreach( $templates[ $group ] as $tmp_name => $tmp_data )
{
if ( strstr( strtolower( $tmp_data['section_content'] ), strtolower( $SEARCH_word ) ) )
{
$final[ $group ][] = $tmp_data;
}
}
}
//-----------------------------------------
// Print..
//-----------------------------------------
if ( ! count($final) )
{
$this->ipsclass->html .= "<div class='tableborder'>
<div class='maintitle'>Ðåçóëüòàòû ïîèñêà</div>
<div class='tablepad'>
<b>Âû èñêàëè: ".htmlentities($SEARCH_word)."</b>
<br />
<br />
Íå íàéäåíî íè îäíîé çàïèñè, ñîîòâåòñòâóþùåé èñêîìîé ñòðîêå. Ïîïðîáóéòå åùå ðàç è ðàñøèðüòå äèàïàçîí ïîèñêà.
</div>
</div>";
$this->ipsclass->admin->output();
}
//-----------------------------------------
// SET ids right
//-----------------------------------------
$this->ipsclass->input['id'] = $SEARCH_set;
$this->ipsclass->input['p'] = $this_set['set_skin_set_parent'];
$this->ipsclass->input['code'] = 'template-sections-list';
$this->ipsclass->input['act'] = 'templ';
$this->ipsclass->form_code = 'section=lookandfeel&amp;act=templ';
$this->ipsclass->form_code_js = str_replace( '&amp;', '&', $this->ipsclass->form_code );
//-----------------------------------------
// Pass array
//-----------------------------------------
require_once( ROOT_PATH."sources/action_admin/skin_template_bits.php" );
$temp = new ad_skin_template_bits();
$temp->ipsclass =& $this->ipsclass;
$temp->search_bits = $final;
$temp->auto_run();
}
//-----------------------------------------
// SEARCH & REPLACE SPLASH
//-----------------------------------------
function searchreplace_start()
{
$skin_list = $this->_get_skinlist();
$this->ipsclass->admin->page_detail = "Ýòîò èíñòðóìååíò ïîçâîëÿåò âàì áûñòðî íàéòè è çàìåíèòü HTML-êîäû.";
$this->ipsclass->admin->page_title = "Ïîèñê â ñòèëÿõ è çàìåíà";
$this->ipsclass->html .= $this->ipsclass->adskin->start_form( array( 1 => array( 'act' , 'skintools' ),
2 => array( 'code' , 'simplesearch' ),
4 => array( 'section', $this->ipsclass->section_code ),
) );
$this->ipsclass->adskin->td_header[] = array( "&nbsp;" , "40%" );
$this->ipsclass->adskin->td_header[] = array( "&nbsp;" , "60%" );
$this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Ïðîñòîé ïîèñê" );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Èñêàòü...</b><br /><span style='color:gray'>Ââåäèòå îäíî ñëîâî èëè öåëûé áëîê HTML äëÿ ïîèñêà</span>",
$this->ipsclass->adskin->form_simple_input( 'searchkeywords', '', 30 )
) );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Ïîèñê â...</b>",
$skin_list
."<br /><input type='checkbox' name='searchall' value='1'> Èñêàòü â âûáðàííîì øàáëîíå è âî âñåõ âëîæåííûõ øàáëîíàõ."
) );
$this->ipsclass->html .= $this->ipsclass->adskin->end_form("Ïîèñê");
$this->ipsclass->html .= $this->ipsclass->adskin->end_table();
//-----------------------------------------
// Search and replace
//-----------------------------------------
$this->ipsclass->html .= $this->ipsclass->adskin->start_form( array( 1 => array( 'act' , 'skintools' ),
2 => array( 'code' , 'searchandreplace' ),
4 => array( 'section', $this->ipsclass->section_code ),
) );
$this->ipsclass->adskin->td_header[] = array( "&nbsp;" , "40%" );
$this->ipsclass->adskin->td_header[] = array( "&nbsp;" , "60%" );
$this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Ïîèñê è çàìåíà" );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Ïîèñê ïî...</b><br /><span style='color:gray'>Ââåäèòå îäíî ñëîâî èëè öåëûé áëîê HTML äëÿ ïîèñêà.<br />Åñëè âêëþ÷åíû ðåãóëÿðíûå âûðàæåíèÿ, òî âû ìîæåòå èõ èñïîëüçîâàòü â ýòîì çàïðîñå.</span>",
$this->ipsclass->adskin->form_textarea( 'searchfor', $_POST['searchfor'] )
) );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Çàìåíèòü íà...</b><br /><span style='color:gray'>Ââåäèòå îäíî ñëîâî èëè öåëûé áëîê HTML äëÿ çàìåíû.<br />Åñëè âêëþ÷åíû ðåãóëÿðíûå âûðàæåíèÿ, òî âû ìîæåòå èõ èñïîëüçîâàòü â ýòîì çàïðîñå.</span>",
$this->ipsclass->adskin->form_textarea( 'replacewith', $_POST['replacewith'] )
) );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Ïîèñê â ñòèëå...</b><br /><span style='color:gray'>Ïðèìå÷àíèå: Ïîèñê è çàìåíà áóäóò ïðîèçâåäåíû òîëüêî â âûáðàííîì øàáëîíå. Äåéñòâèå íå áóäåò ïðîèçâåäåíî äëÿ âëîæåííûõ øàáëîíîâ.</span>",
$skin_list
) );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Òîëüêî òåñòèðîâàíèå çàïðîñà?</b><br /><span style='color:gray'>Ïðè âûáîðå 'Äà', âû ñìîæåòå óâèäåòü ïðåäëîæåííûå çàìåíû.</span>",
$this->ipsclass->adskin->form_yes_no( 'testonly', 1 )
) );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Âêëþ÷èòü ðåãóëÿðíûå âûðàæåíèÿ?</b><br /><span style='color:gray'>Åñëè âûáðàíî 'Äà', âû ñìîæåòå èñïîëüçîâàòü 'regex' â çàïðîñàõ ïîèñêà è çàìåíû.
Ïðèìåð: Çàìåíà òýãîâ <b>&lt;br&gt;
<br />Èñêàòü: <b>&lt;(br)&#92;s?/?&gt;</b>
<br />Çàìåíèòü íà: <b>&lt;&#92;&#92;1 clear='all' /&gt;</b></span>",
$this->ipsclass->adskin->form_yes_no( 'regexmode', 0 )
) );
$this->ipsclass->html .= $this->ipsclass->adskin->end_form("Èñêàòü è çàìåíèòü");
$this->ipsclass->html .= $this->ipsclass->adskin->end_table();
$this->ipsclass->admin->output();
}
//-----------------------------------------
// Swap members...
//-----------------------------------------
function change_member()
{
$old_id = intval($this->ipsclass->input['set_skin_set_id']);
$new_id = intval($this->ipsclass->input['set_skin_set_id2']);
if ($new_id == 'n')
{
$this->ipsclass->DB->do_update( 'members', array( 'skin' => '' ), 'skin='.$old_id );
}
else
{
$this->ipsclass->DB->do_update( 'members', array( 'skin' => $new_id ), 'skin='.$old_id );
}
$this->ipsclass->main_msg = "Øàáëîíû ïîëüçîâàòåëåé îáíîâëåíû";
$this->show_intro();
}
//-----------------------------------------
// REBUILD MASTER
//-----------------------------------------
function rebuildmaster()
{
$pid = intval($this->ipsclass->input['phplocation']);
$cid = intval($this->ipsclass->input['csslocation']);
if ( $this->ipsclass->input['phpyes'] )
{
if ( ! file_exists( CACHE_PATH.'cache/skin_cache/cacheid_'.$pid ) )
{
$this->ipsclass->main_msg = "IPB íå ìîæåò ïåðåñòðîèòü áàçîâûé øàáëîí, òàê êàê ïàïêà 'cacheid_$pid' íå ñóùåñòâóåò";
}
$this->ipsclass->cache_func->_rebuild_templates_from_php($pid);
$this->ipsclass->main_msg = 'Ïîïûòêà ïåðåñòðîèòü PHP êåø ôàéëû äëÿ áàçîâîãî øàáëîíà...';
$this->ipsclass->main_msg .= "<br />".implode("<br />", $this->ipsclass->cache_func->messages);
}
if ( $this->ipsclass->input['cssyes'] )
{
if ( ! file_exists( CACHE_PATH.'style_images/css_'.$cid.'.css' ) )
{
$this->ipsclass->main_msg = "IPB íå ìîæåò ïåðåñòðîèòü áàçîâûå CSS ñòèëè, òàê êàê ïàïêà 'css_$cid' íå ñóùåñòâóåò";
}
$css = @file_get_contents( CACHE_PATH.'style_images/css_'.$cid.'.css' );
if ( ! $css )
{
$this->ipsclass->main_msg = "IPB íå ìîæåò ïåðåñòðîèòü áàçîâûå CSS ñòèëè, òàê êàê ïàïêà 'css_$cid' ïóñòàÿ";
}
$css = preg_replace( "#^.*\*~START CSS~\*/#s", "", $css );
//-----------------------------------------
// Attempt to rearrange style_images dir stuff
//-----------------------------------------
$this->ipsclass->main_msg = "Ïîïûòêà âîññòàíîâèòü CSS íàñòðîéêè èç êåøà CSS ôàéëîâ...";
$css = preg_replace( "#url\((.+?)/(.+?)\)#is", "url(style_images/1/\\2)", $css );
$this->ipsclass->DB->do_update( 'skin_sets', array( 'set_css' => $css, 'set_css_updated' => time() ), 'set_skin_set_id=1' );
$this->ipsclass->cache_func->_write_css_to_cache(1);
$this->ipsclass->main_msg .= "<br />".implode("<br />", $this->ipsclass->cache_func->messages);
}
$this->show_intro();
}
//-----------------------------------------
// REBUILD CACHES
//-----------------------------------------
function rebuildcaches()
{
$this->ipsclass->cache_func->_rebuild_all_caches(array($this->ipsclass->input['set_skin_set_id']));
$this->ipsclass->main_msg = 'Êåø øàáëîíà ïåðåñòðîåí (ID: '.$this->ipsclass->input['set_skin_set_id'].')';
$this->ipsclass->main_msg .= "<br />".implode("<br />", $this->ipsclass->cache_func->messages);
$this->show_intro();
}
//-----------------------------------------
// SHOW MAIN SCREEN
//-----------------------------------------
function show_intro()
{
$skin_list = $this->_get_skinlist();
//-----------------------------------------
// REBUILD MASTER TEMPLATES
//-----------------------------------------
$this->ipsclass->html .= $this->ipsclass->adskin->start_form( array( 1 => array( 'act' , 'skintools' ),
2 => array( 'code' , 'rebuildmasterhtml' ),
4 => array( 'section', $this->ipsclass->section_code ),
) );
//-----------------------------------------
// Attempt to get filemtime
//-----------------------------------------
$filemtime = 0;
$file = ROOT_PATH . 'ipb_templates.xml';
$error = "";
$notice = "";
$extra_html = "";
if ( @file_exists( $file ) )
{
if ( $filemtime = @filemtime( $file ) )
{
$notice = "ipb_templates.xml ïîñëåäíåå îáíîâëåíèå: " . $this->ipsclass->get_date( $filemtime, 'JOINED' );
}
if ( $filemtime2 = @filemtime( ROOT_PATH . 'sources/ipsclass.php' ) )
{
if ( ( $filemtime2 - (86400 * 7) ) > $filemtime )
{
$error = "Ïîæàëóéñòà ïðîâåðüòå ipb_templates.xml - 'ipsclass.php' áîëåå ÷åì íà íåäåëþ íîâåå.";
}
}
}
else
{
$error = "Íåëüçÿ îïðåäåëèòü '{$file}' – óáåäèòåñü, ÷òî îí áûë çàãðóæåí â êîðíåâóþ ïàïêó ôîðóìà";
}
//-----------------------------------------
// Got notices?
//-----------------------------------------
if ( $notice )
{
$extra_html .= "<div class='input-ok-content'>$notice</div>";
}
if ( $error )
{
$extra_html .= "<div class='input-warn-content'>$error</div>";
}
//-----------------------------------------
// Continue
//-----------------------------------------
$this->ipsclass->adskin->td_header[] = array( "{none}" , "100%" );
$this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Ïåðåñòðîéêà êåø ôàéëîâ" );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Ýòà îïöèÿ ïîçâîëÿåò ïåðåñòðîèòü âñå êåø ôàéëû âñåõ HTML ôðàãìåíòîâ, CSS ñòèëåé, îáîëî÷êè è ìàêðîñîâ âûáðàííîãî øàáëîíà, à òàêæå âñåõ âëîæåííûõ øàáëîíîâ.</b>",
) );
$this->ipsclass->html .= $this->ipsclass->adskin->end_form("Çàïóñòèòü èíñòðóìåíò...");
$this->ipsclass->html .= $this->ipsclass->adskin->end_table();
//-----------------------------------------
// REBUILD MASTER CSS and BOARDWRAPPER
//-----------------------------------------
$this->ipsclass->html .= $this->ipsclass->adskin->start_form( array( 1 => array( 'act' , 'skintools' ),
2 => array( 'code' , 'rebuildmastercomponents' ),
4 => array( 'section', $this->ipsclass->section_code ),
) );
//-----------------------------------------
// Attempt to get filemtime
//-----------------------------------------
$filemtime = 0;
$file = ROOT_PATH . 'install/installfiles/components.php';
$error = "";
$notice = "";
$extra_html = "";
if ( @file_exists( $file ) )
{
if ( $filemtime = @filemtime( $file ) )
{
$notice = "install/installfiles/components.php ïîñëåäíèå îáíîâëåíèå: " . $this->ipsclass->get_date( $filemtime, 'JOINED' );
}
if ( $filemtime2 = @filemtime( ROOT_PATH . 'sources/ipsclass.php' ) )
{
if ( ( $filemtime2 - (86400 * 7) ) > $filemtime )
{
$error = "Ïîæàëóéñòà, ïðîâåðüòå install/installfiles/components.php - 'ipsclass.php' è îáåäèòåñü, ÷òî îíè îáíîâëåíû.";
}
}
}
else
{
$error = "Íåëüçÿ íàéòè '{$file}' - óáåäèòåñü, ÷òî ïàïêà 'install' ïóñòà.";
}
//-----------------------------------------
// Got notices?
//-----------------------------------------
if ( $notice )
{
$extra_html .= "<div class='input-ok-content'>$notice</div>";
}
if ( $error )
{
$extra_html .= "<div class='input-warn-content'>$error</div>";
}
//-----------------------------------------
// Continue
//-----------------------------------------
$this->ipsclass->adskin->td_header[] = array( "{none}" , "100%" );
$this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Êîìïîíåíòû âîññòàíîâëåíèÿ ñòèëÿ" );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Çàïóñòèòå ýòó îïöèþ, ÷òîáû ïåðåñòðîèòü HTML è CSS øàáëîíà.</b>",
) );
$this->ipsclass->html .= $this->ipsclass->adskin->end_form("Çàïóñòèòü...");
$this->ipsclass->html .= $this->ipsclass->adskin->end_table();
//-----------------------------------------
// REBUILD CACHES
//-----------------------------------------
$this->ipsclass->html .= $this->ipsclass->adskin->start_form( array( 1 => array( 'act' , 'skintools' ),
2 => array( 'code' , 'rebuildcaches' ),
4 => array( 'section', $this->ipsclass->section_code ),
) );
$this->ipsclass->adskin->td_header[] = array( "&nbsp;" , "60%" );
$this->ipsclass->adskin->td_header[] = array( "&nbsp;" , "40%" );
$this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Ïåðåñòðîéêà êåø ôàéëîâ" );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Ó êàêîãî øàáëîíà ïåðåñòðîèòü êåø ôàéëû?</b><br /><span style='color:gray'>Ýòà îïöèÿ ïîçâîëÿåò ïåðåñòðîèòü âñå êåø ôàéëû âñåõ HTML ôðàãìåíòîâ, CSS ñòèëåé, îáîëî÷êè è ìàêðîñîâ âûáðàííîãî øàáëîíà, à òàêæå âñåõ âëîæåííûõ øàáëîíîâ.</span><br />[ <a href='{$this->ipsclass->base_url}&section={$this->ipsclass->section_code}&act=sets&code=rebuildalltemplates'>Ïåðåñòðîèòü âñå êåø ôàéëû</a> ]",
$skin_list
) );
$this->ipsclass->html .= $this->ipsclass->adskin->end_form("Çàïóñòèòü èíñòðóìåíò...");
$this->ipsclass->html .= $this->ipsclass->adskin->end_table();
//-----------------------------------------
// CHANGE MEMBERS
//-----------------------------------------
$dd_two = str_replace( "select name='set_skin_set_id'", "select name='set_skin_set_id2'", $skin_list );
$dd_two = str_replace( "<!--DD.OPTIONS-->", "<option value='n'>Íåò - èñïîëüçîâàòü ïî óìîë÷àíèþ</option>", $dd_two );
$this->ipsclass->html .= $this->ipsclass->adskin->start_form( array( 1 => array( 'act' , 'skintools' ),
2 => array( 'code' , 'changemember' ),
4 => array( 'section', $this->ipsclass->section_code ),
) );
$this->ipsclass->adskin->td_header[] = array( "&nbsp;" , "60%" );
$this->ipsclass->adskin->td_header[] = array( "&nbsp;" , "40%" );
$this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Ïåðåóñòàíîâêà øàáëîíà ó ïîëüçîâàòåëåé ôîðóìà" );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Ïîëüçîâàòåëè èñïîëüçóþùèå øàáëîí...</b>",
$skin_list
) );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Èçìåíèòü øàáëîí íà...</b>",
$dd_two
) );
$this->ipsclass->html .= $this->ipsclass->adskin->end_form("Çàïóñòèòü èíñòðóìåíò...");
$this->ipsclass->html .= $this->ipsclass->adskin->end_table();
//-----------------------------------------
// REBUILD MASTER
//-----------------------------------------
if ( IN_DEV )
{
$this->ipsclass->html .= $this->ipsclass->adskin->start_form( array( 1 => array( 'act' , 'skintools' ),
2 => array( 'code' , 'rebuildmaster' ),
4 => array( 'section', $this->ipsclass->section_code ),
) );
$this->ipsclass->adskin->td_header[] = array( "&nbsp;" , "40%" );
$this->ipsclass->adskin->td_header[] = array( "&nbsp;" , "60%" );
$this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Ïåðåñòðîéêà áàçîâîãî øàáëîíà" );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Ïåðåñòðîéêà 'IPB Master Skin Set' èç CSS è PHP-ôàéëîâ.</b><br /><span style='color:gray'>Ýòà îïöèÿ ïîçâîëÿåò ïåðåñòðîèòü HTML ôðàãìåíòû äëÿ áàçîâîãî øàáëîíà.<br />ÈÑÏÎËÜÇÓÉÒÅ ÊÐÀÉÍÅ ÀÊÊÓÐÀÒÍÎ!</span>",
"<input type='checkbox' name='phpyes' value='1' /> PHP êåø ïàïêà: skin_cache/cacheid_ ".$this->ipsclass->adskin->form_simple_input( 'phplocation', '1', 3 )."<br />".
"<input type='checkbox' name='cssyes' value='1' /> CSS êåø ôàéë: style_images/css_ ".$this->ipsclass->adskin->form_simple_input( 'csslocation', '1',3 )
) );
$this->ipsclass->html .= $this->ipsclass->adskin->end_form("Çàïóñòèòü èíñòðóìåíò...");
$this->ipsclass->html .= $this->ipsclass->adskin->end_table();
}
//-----------------------------------------
//-------------------------------
$this->ipsclass->admin->output();
}
//-----------------------------------------
// Get dropdown of skin
//-----------------------------------------
function _get_skinlist()
{
$skin_sets = array();
$skin_list = "<select name='set_skin_set_id' class='dropdown'><!--DD.OPTIONS-->";
//-----------------------------------------
// Get formatted list of skin sets
//-----------------------------------------
$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'skin_sets', 'order' => 'set_skin_set_parent, set_skin_set_id' ) );
$this->ipsclass->DB->simple_exec();
while ( $s = $this->ipsclass->DB->fetch_row() )
{
$skin_sets[ $s['set_skin_set_id'] ] = $s;
$skin_sets[ $s['set_skin_set_parent'] ]['_children'][] = $s['set_skin_set_id'];
}
//-----------------------------------------
// Roots
//-----------------------------------------
foreach( $skin_sets as $id => $data )
{
if ( $data['set_skin_set_parent'] < 1 and $id > 1 )
{
$skin_list .= "\n<option value='$id'>{$data['set_name']}</option><!--CHILDREN:{$id}-->";
}
}
//-----------------------------------------
// Kids...
//-----------------------------------------
foreach( $skin_sets as $id => $data )
{
if ( is_array( $data['_children'] ) and count( $data['_children'] ) > 0 )
{
$html = "";
foreach( $data['_children'] as $cid )
{
$html .= "\n<option value='$cid'>---- {$skin_sets[ $cid ]['set_name']}</option>";
}
$skin_list = str_replace( "<!--CHILDREN:{$id}-->", $html, $skin_list );
}
}
$skin_list .= "</select>";
return $skin_list;
}
//-----------------------------------------
// Sort by group name
//-----------------------------------------
function perly_alpha_sort($a, $b)
{
return strcmp($a['easy_name'], $b['easy_name']);
}
}
?>