$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 "

Неверный вход

У Вас нет доступа к директиве этого файла. Если Вы проводили обновления, убедитесь, что не забыли обновить '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, '' ) ) { $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 <{".$hehe."}> 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" , $final_html ); //$final_html = str_replace( "<{JAVASCRIPT}>", "\n{$_POST['javascripthtml']}\n" , $final_html ); //$final_html = str_replace( "<{LEFT_HAND_SIDE_LINKS}>", "{$_POST['leftlinkshtml']}" , $final_html ); //$final_html = str_replace( "<{RIGHT_HAND_SIDE_LINKS}>", "{$_POST['rightlinkshtml']}", $final_html ); $final_html = preg_replace( "#.+?#si", "IPB" , $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 .= "
".implode("
", $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'], '' ) ) { $this->ipsclass->main_msg = "Невозможно найти тэг логотипа, убедитесь в том, что ваш шаблон обновлен."; $this->show_intro(); } //----------------------------------------- // Get Skin Names //----------------------------------------- $skin_list = $this->_get_skinlist(); //----------------------------------------- // get URL //----------------------------------------- preg_match( "##si", $master[1]['section_content'], $match ); $current_img_url = $match[1]; //----------------------------------------- // get current HTML //----------------------------------------- $current_html = $master[1]['section_content']; $current_html = preg_replace( "#.+?#is" , "<{JAVASCRIPT}>" , $current_html ); $current_html = preg_replace( "##si" , "<{BOARD_LOGO}>" , $current_html ); $current_html = preg_replace( "#.+?#si" , "<{LEFT_HAND_SIDE_LINKS}>" , $current_html ); $current_html = preg_replace( "#.+?#si" , "<{RIGHT_HAND_SIDE_LINKS}>" , $current_html ); //----------------------------------------- // Regex out me bits //----------------------------------------- preg_match( "#(.+?)#si", $master[1]['section_content'], $match ); $html['javascript'] = $this->ipsclass->admin->text_to_form($match[1]); preg_match( "#(.+?)#si" , $master[1]['section_content'], $match ); $html['leftlinks'] = $this->ipsclass->admin->text_to_form($match[1]); preg_match( "#(.+?)#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 = "
ПРЕДУПРЕЖДЕНИЕ: Невозможно загрузить файлы в папку 'style_images'. Если вы хотите загрузить файл, проверьте права доступа (CHMOD) к папке.
"; } //----------------------------------------- // 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 .= "
Установка логотипа
$warning
Конфигурация
К какому шаблону добавить логотип?
Если вы уже изменяли шапку (верхний колонтитул) шаблона из 'Управления шаблонами', то это действие удалит все ваши изменения.
$skin_list
Ссылка к логотипу
Вы можете использовать относительные ссылки или полный URL, начинающийся с http://
".$this->ipsclass->adskin->form_simple_input('logo_url', $_POST['logo_url'] ? $_POST['logo_url'] : $current_img_url, '60' )."
ИЛИ загрузить новый логотип
Выберите файл для загрузки с вашего компьютера. Файл должен иметь разрешение .gif, .jpg, .jpeg или .png
".$this->ipsclass->adskin->form_upload()."
"; //----------------------------------------- $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 = "Базовый шаблон перестроен!
Произведено $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 .= "
Результаты поиска и замены
Вы искали: ".stripslashes(htmlspecialchars($before))."

Не найдено ни одной записи, соответствующей искомой строке. Попробуйте еще раз и расширьте диапазон поиска.
"; $this->ipsclass->admin->output(); } //----------------------------------------- // Swapping or showing? //----------------------------------------- if ( $this->ipsclass->input['testonly'] ) { $this->ipsclass->html .= "
Результаты поиска и замены
{$matches} аписей содержащих '".htmlentities($before)."' заменены на '".htmlentities($after)."'

"; //----------------------------------------- // 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( "<" , "<" , $html); $html = str_replace( ">" , ">" , $html); $html = str_replace( "\"", """, $html); $html = preg_replace( "!<\!--(.+?)(//)?-->!s" , "<!--\\1--\\2>", $html ); $html = preg_replace( "#<([^&<>]+)>#s" , "<\\1>" , $html ); //Matches $html = preg_replace( "#<([^&<>]+)=#s" , "<\\1=" , $html ); //Matches </\\1>" , $html ); //Matches $html = preg_replace( "!=("|')([^<>])("|')(\s|>)!s" , "=\\1\\2\\3\\4" , $html ); //Matches ='this' //----------------------------------------- // convert back wrap tags //----------------------------------------- $html = str_replace( '{#-^--opentag--^-#}' , "", $html ); $html = str_replace( '{#-^--closetag--^-#}', "", $html ); $this->ipsclass->html .= "
{$group_name} · {$tmp_data['func_name']}
{$html}

"; } } $this->ipsclass->html .= "
"; $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( "
", $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 .= "
Результаты поиска
Вы искали: ".htmlentities($SEARCH_word)."

Не найдено ни одной записи, соответствующей искомой строке. Попробуйте еще раз и расширьте диапазон поиска.
"; $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&act=templ'; $this->ipsclass->form_code_js = str_replace( '&', '&', $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( " " , "40%" ); $this->ipsclass->adskin->td_header[] = array( " " , "60%" ); $this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Простой поиск" ); $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Искать...
Введите одно слово или целый блок HTML для поиска", $this->ipsclass->adskin->form_simple_input( 'searchkeywords', '', 30 ) ) ); $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Поиск в...", $skin_list ."
Искать в выбранном шаблоне и во всех вложенных шаблонах." ) ); $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( " " , "40%" ); $this->ipsclass->adskin->td_header[] = array( " " , "60%" ); $this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Поиск и замена" ); $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Поиск по...
Введите одно слово или целый блок HTML для поиска.
Если включены регулярные выражения, то вы можете их использовать в этом запросе.
", $this->ipsclass->adskin->form_textarea( 'searchfor', $_POST['searchfor'] ) ) ); $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Заменить на...
Введите одно слово или целый блок HTML для замены.
Если включены регулярные выражения, то вы можете их использовать в этом запросе.
", $this->ipsclass->adskin->form_textarea( 'replacewith', $_POST['replacewith'] ) ) ); $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Поиск в стиле...
Примечание: Поиск и замена будут произведены только в выбранном шаблоне. Действие не будет произведено для вложенных шаблонов.", $skin_list ) ); $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Только тестирование запроса?
При выборе 'Да', вы сможете увидеть предложенные замены.", $this->ipsclass->adskin->form_yes_no( 'testonly', 1 ) ) ); $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Включить регулярные выражения?
Если выбрано 'Да', вы сможете использовать 'regex' в запросах поиска и замены. Пример: Замена тэгов <br>
Искать: <(br)\s?/?>
Заменить на: <\\1 clear='all' />
", $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 .= "
".implode("
", $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 .= "
".implode("
", $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 .= "
".implode("
", $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 .= "
$notice
"; } if ( $error ) { $extra_html .= "
$error
"; } //----------------------------------------- // 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( "Эта опция позволяет перестроить все кеш файлы всех HTML фрагментов, CSS стилей, оболочки и макросов выбранного шаблона, а также всех вложенных шаблонов.", ) ); $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 .= "
$notice
"; } if ( $error ) { $extra_html .= "
$error
"; } //----------------------------------------- // 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( "Запустите эту опцию, чтобы перестроить HTML и CSS шаблона.", ) ); $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( " " , "60%" ); $this->ipsclass->adskin->td_header[] = array( " " , "40%" ); $this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Перестройка кеш файлов" ); $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "У какого шаблона перестроить кеш файлы?
Эта опция позволяет перестроить все кеш файлы всех HTML фрагментов, CSS стилей, оболочки и макросов выбранного шаблона, а также всех вложенных шаблонов.
[ Перестроить все кеш файлы ]", $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_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( " " , "60%" ); $this->ipsclass->adskin->td_header[] = array( " " , "40%" ); $this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Переустановка шаблона у пользователей форума" ); $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Пользователи использующие шаблон...", $skin_list ) ); $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Изменить шаблон на...", $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( " " , "40%" ); $this->ipsclass->adskin->td_header[] = array( " " , "60%" ); $this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Перестройка базового шаблона" ); $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Перестройка 'IPB Master Skin Set' из CSS и PHP-файлов.
Эта опция позволяет перестроить HTML фрагменты для базового шаблона.
ИСПОЛЬЗУЙТЕ КРАЙНЕ АККУРАТНО!
", " PHP кеш папка: skin_cache/cacheid_ ".$this->ipsclass->adskin->form_simple_input( 'phplocation', '1', 3 )."
". " 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 = ""; return $skin_list; } //----------------------------------------- // Sort by group name //----------------------------------------- function perly_alpha_sort($a, $b) { return strcmp($a['easy_name'], $b['easy_name']); } } ?>