$Date: 2005-10-10 14:08:54 +0100 (Mon, 10 Oct 2005) $ | > $Revision: 23 $ | > $Author: matt $ +--------------------------------------------------------------------------- | | > Administration Module | > Module written by Matt Mecham | > Date started: 27th January 2004 | | > Module Version Number: 1.0.0 | > DBA Checked: Mon 24th May 2004 +-------------------------------------------------------------------------- */ if ( ! defined( 'IN_ACP' ) ) { print "

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

У Вас нет доступа к директиве этого файла. Если Вы проводили обновления, убедитесь, что не забыли обновить 'admin.php'."; exit(); } class ad_administration { var $ipsclass; var $html; var $map; /** * Section title name * * @var string */ var $perm_main = "tools"; /** * Section title name * * @var string */ var $perm_child = "admin"; function auto_run() { //----------------------------------------- // Require and RUN !! THERES A BOMB //----------------------------------------- $this->ipsclass->admin->page_detail = "Управление кешем позволяет вам просматривать содержимое вашего кеша, а также и обновлять его."; $this->ipsclass->admin->page_title = "Управление кешем"; //----------------------------------------- // Load skin //----------------------------------------- $this->html = $this->ipsclass->acp_load_template('cp_skin_tools'); //----------------------------------------- // Kill globals - globals bad, Homer good. //----------------------------------------- $tmp_in = array_merge( $_GET, $_POST, $_COOKIE ); foreach ( $tmp_in as $k => $v ) { unset($$k); } //----------------------------------------- // Map //----------------------------------------- $this->map = array( 'forum_cache' => 'Информация и данные о всех форумах', 'group_cache' => 'Информация и данные о всех пользовательских групп', 'systemvars' => 'Рабочее время системы', 'skin_id_cache' => 'Информация и данные и стилях', 'moderators' => 'Информация и данныех о всех модераторх', 'stats' => 'Статистика форума, общее кол-во сообщений и т.д.', 'ranks' => 'Информация об учетных записях пользователей и их статусах', 'profilefields' => 'Информация о дополнительных полях в профиле', 'birthdays' => 'Дни рождения пользователей', 'calendar' => 'Приближающиеся календарные события', 'multimod' => 'Информация и данные о мульти-модерации', 'bbcode' => "Информация и данные о специальных ББ кодах", 'settings' => "Настройки форума и переменных", 'emoticons' => 'Информация и данные о смайликах', 'badwords' => 'Информация и данные о фильтре нецензурных слов', 'languages' => 'Информация о языковых настройках', 'banfilters' => 'Забаненные IP адреса', 'attachtypes' => 'Информация о типах прикрепляемых файлов', 'announcements' => 'Кеш сообщений', 'components' => 'Включенные компоненты в вашем IPB', ); //----------------------------------------- // What to do... //----------------------------------------- switch($this->ipsclass->input['code']) { case 'cacheend': $this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':recache' ); $this->cache_end(); break; case 'viewcache': $this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':' ); $this->view_cache(); break; case 'cache_update_all': $this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':recache' ); $this->ipsclass->admin->output_multiple_redirect_init( $this->ipsclass->base_url.'&'.$this->ipsclass->form_code_js.'&code=cache_update_all_process&id=0' ); break; case 'cache_update_all_process': $this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':recache' ); $this->cache_update_all_process(); break; default: $this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':' ); $this->cache_start(); break; } } /*-------------------------------------------------------------------------*/ // Process.... /*-------------------------------------------------------------------------*/ function cache_update_all_process() { //----------------------------------------- // INIT //----------------------------------------- $id = intval( $this->ipsclass->input['id'] ); $cache_name = ''; $count = 0; $img = '- '; //----------------------------------------- // Get cache name //----------------------------------------- foreach( $this->map as $name => $desc ) { if ( $count == $id ) { $cache_name = $name; break; } $count++; } //----------------------------------------- // Do what, now? //----------------------------------------- $id++; if ( $cache_name ) { $this->cache_end( $cache_name, 1 ); $this->ipsclass->admin->output_multiple_redirect_hit( $this->ipsclass->base_url.'&'.$this->ipsclass->form_code_js.'&code=cache_update_all_process&id='.$id, $img.$cache_name.' processed...' ); } else { $this->ipsclass->admin->output_multiple_redirect_done(); } } /*-------------------------------------------------------------------------*/ // DO VIEW /*-------------------------------------------------------------------------*/ function view_cache() { if ( ! $this->ipsclass->input['cache'] ) { $this->ipsclass->main_msg = "Не один ID не выбран, повторите попытку заново "; $this->cache_start(); } $row = $this->ipsclass->DB->simple_exec_query( array( 'select' => '*', 'from' => 'cache_store', 'where' => "cs_key='{$this->ipsclass->input['cache']}'" ) ); ob_start(); if ( $row['cs_array'] ) { print_r( unserialize($this->ipsclass->txt_stripslashes($row['cs_value'])) ); } else { print $row['cs_value']; } $out = ob_get_contents(); ob_end_clean(); $this->ipsclass->html = "
".htmlspecialchars($out)."
"; $this->ipsclass->admin->print_popup(); } /*-------------------------------------------------------------------------*/ // DO UPDATE /*-------------------------------------------------------------------------*/ function cache_end( $cache_name='', $dontcancel=0 ) { if ( ! $cache_name ) { $cache_name = $this->ipsclass->input['cache']; } switch ( $cache_name ) { //----------------------------------------- // Forum cache //----------------------------------------- case 'forum_cache': $this->ipsclass->update_forum_cache(); $this->ipsclass->main_msg = 'Кеш форума обновлен'; break; //----------------------------------------- // Group Cache //----------------------------------------- case '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 ) ); $this->ipsclass->main_msg = 'Кеш групп обновлен'; break; //----------------------------------------- // Systemvars //----------------------------------------- case '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->update_cache( array( 'name' => 'systemvars', 'array' => 1, 'deletefirst' => 1 ) ); require_once( ROOT_PATH.'sources/lib/func_taskmanager.php' ); $task = new func_taskmanager(); $task->ipsclass =& $this->ipsclass; $task->save_next_run_stamp(); $this->ipsclass->main_msg = 'Переменные системы обновлены'; break; //----------------------------------------- // Skin ID cache //----------------------------------------- case 'skin_id_cache': require_once( ROOT_PATH.'sources/lib/admin_cache_functions.php' ); $admin = new admin_cache_functions(); $admin->ipsclass =& $this->ipsclass; $admin->_rebuild_skin_id_cache(); $this->ipsclass->main_msg = 'Кеш стиля обновлен'; break; //----------------------------------------- // Moderators //----------------------------------------- case 'moderators': $this->ipsclass->cache['moderators'] = array(); require_once( ROOT_PATH.'sources/action_admin/moderator.php' ); $this->mod = new ad_moderator(); $this->mod->ipsclass =& $this->ipsclass; $this->mod->rebuild_moderator_cache(); $this->ipsclass->main_msg = 'Модераторы обновлены'; break; //----------------------------------------- // Stats //----------------------------------------- case 'stats': $this->ipsclass->main_msg = 'Статистика обновлена'; break; //----------------------------------------- // Ranks //----------------------------------------- case '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 ) ); $this->ipsclass->main_msg = 'Статусы обновлены'; break; //----------------------------------------- // Profile Fields //----------------------------------------- case 'profilefields': $this->ipsclass->cache['profilefields'] = array(); $this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'pfields_data', 'order' => 'pf_position' ) ); $this->ipsclass->DB->simple_exec(); while ( $r = $this->ipsclass->DB->fetch_row() ) { $this->ipsclass->cache['profilefields'][ $r['pf_id'] ] = $r; } $this->ipsclass->update_cache( array( 'name' => 'profilefields', 'array' => 1, 'deletefirst' => 1 ) ); $this->ipsclass->main_msg = 'Доп. поля в профиле обновлены'; break; //----------------------------------------- // Calendar //----------------------------------------- case 'calendar': require_once( ROOT_PATH.'sources/lib/func_taskmanager.php' ); $func = new func_taskmanager(); $func->ipsclass =& $this->ipsclass; require_once( ROOT_PATH.'sources/tasks/calendarevents.php' ); $task = new task_item(); $task->register_class( $func ); $task->restrict_log = 1; $task->run_task(); $this->ipsclass->main_msg = 'Календарные события обновлены'; break; //----------------------------------------- // Birthdays //----------------------------------------- case 'birthdays': require_once( ROOT_PATH.'sources/lib/func_taskmanager.php' ); $func = new func_taskmanager(); $func->ipsclass =& $this->ipsclass; require_once( ROOT_PATH.'sources/tasks/calendarevents.php' ); $task = new task_item(); $task->register_class( $func ); $task->restrict_log = 1; $task->run_task(); $this->ipsclass->main_msg = 'Дни рождения обновлены'; break; //----------------------------------------- // Multimoderation //----------------------------------------- case 'multimod': $this->ipsclass->cache['multimod'] = array(); $this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'topic_mmod', 'order' => 'mm_title' ) ); $this->ipsclass->DB->simple_exec(); while ($i = $this->ipsclass->DB->fetch_row()) { $this->ipsclass->cache['multimod'][ $i['mm_id'] ] = $i; } $this->ipsclass->update_cache( array( 'name' => 'multimod', 'array' => 1, 'deletefirst' => 1 ) ); $this->ipsclass->main_msg = 'Мульти-модерация обновлена'; break; //----------------------------------------- // BBCODE //----------------------------------------- case 'bbcode': require_once( ROOT_PATH.'sources/action_admin/bbcode.php' ); $this->bbcode = new ad_bbcode(); $this->bbcode->ipsclass =& $this->ipsclass; $this->bbcode->bbcode_rebuildcache(); $this->ipsclass->main_msg = 'ББ коды обновлены'; break; //----------------------------------------- // SETTINGS //----------------------------------------- case 'settings': $this->ipsclass->cache['settings'] = array(); $this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'conf_settings', 'where' => 'conf_add_cache=1' ) ); $info = $this->ipsclass->DB->simple_exec(); while ( $r = $this->ipsclass->DB->fetch_row($info) ) { $value = $r['conf_value'] != "" ? $r['conf_value'] : $r['conf_default']; if ( $value == '{blank}' ) { $value = ''; } $this->ipsclass->cache['settings'][ $r['conf_key'] ] = $value; } $this->ipsclass->update_cache( array( 'name' => 'settings', 'array' => 1, 'deletefirst' => 1 ) ); $this->ipsclass->main_msg = 'Настройки обновлены'; break; //----------------------------------------- // EMOTICONS //----------------------------------------- case 'emoticons': require_once( ROOT_PATH.'sources/action_admin/emoticons.php' ); $this->emoticons = new ad_emoticons(); $this->emoticons->ipsclass =& $this->ipsclass; $this->emoticons->emoticon_rebuildcache(); $this->ipsclass->main_msg = 'Смайлики обновлены'; break; //----------------------------------------- // BADWORDS //----------------------------------------- case 'badwords': require_once( ROOT_PATH.'sources/action_admin/banandbadword.php' ); $this->banandbadword = new ad_banandbadword(); $this->banandbadword->ipsclass =& $this->ipsclass; $this->banandbadword->badword_rebuildcache(); $this->ipsclass->main_msg = 'Фильтр нецензурных слов обновлен'; break; //----------------------------------------- // LANGUAGES //----------------------------------------- case '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 ) ); $this->ipsclass->main_msg = 'Языки обновлены'; break; //----------------------------------------- // BAN FILTERS //----------------------------------------- case 'banfilters': require_once( ROOT_PATH.'sources/action_admin/banandbadword.php' ); $this->banandbadword = new ad_banandbadword(); $this->banandbadword->ipsclass =& $this->ipsclass; $this->banandbadword->ban_rebuildcache(); $this->ipsclass->main_msg = 'Фильтр бана обновлен'; break; //----------------------------------------- // ATTACHMENT TYPES //----------------------------------------- case 'attachtypes': $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->main_msg = 'Типы присоединяемых файлов обновлены'; break; //----------------------------------------- // Announcements //----------------------------------------- case 'announcements': require_once( ROOT_PATH.'sources/action_public/announcements.php' ); $announcements = new announcements(); $announcements->ipsclass =& $this->ipsclass; $announcements->announce_recache(); $this->ipsclass->main_msg = 'Сообщений обновлены'; break; //----------------------------------------- // BBCODE //----------------------------------------- case 'components': require_once( ROOT_PATH.'sources/action_admin/components.php' ); $this->components = new ad_components(); $this->components->ipsclass =& $this->ipsclass; $this->components->components_rebuildcache(); $this->ipsclass->main_msg = 'Компоненты обновлены'; break; default: $this->ipsclass->main_msg = 'Нечего обновлять'; break; } if ( ! $dontcancel ) { $this->cache_start(); } } /*-------------------------------------------------------------------------*/ // SHOW CACHE FORM /*-------------------------------------------------------------------------*/ function cache_start() { //----------------------------------------- // INIT //----------------------------------------- $used = array(); $content = ""; //----------------------------------------- // SHOW CACHES //----------------------------------------- $this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'cache_store', 'order' => 'cs_key' ) ); $this->ipsclass->DB->simple_exec(); while ( $row = $this->ipsclass->DB->fetch_row() ) { if ( ! in_array( $row['cs_key'], array_keys( $this->map ) ) ) { continue; } $used[ $row['cs_key'] ] = $row['cs_key']; $row['_size'] = ceil( intval( strlen( $row['cs_value'] ) ) / 1024 ); $row['_desc'] = $this->map[ $row['cs_key'] ]; $content .= $this->html->cache_row( $row ); } if ( count( $used ) != count( $this->map ) ) { foreach( $this->map as $k => $v ) { if ( in_array( $k, array_keys( $used ) ) ) { continue; } else { $row['cs_key'] = $k; $row['cs_value'] = $v; $row['_size'] = 0; $row['_desc'] = $this->map[ $row['cs_key'] ]; $content .= $this->html->cache_row( $row ); } } } $this->ipsclass->html .= $this->html->cache_overview( $content ); $this->ipsclass->admin->output(); } /*-------------------------------------------------------------------------*/ // PERL /*-------------------------------------------------------------------------*/ function perly_length_sort($a, $b) { if ( strlen($a['typed']) == strlen($b['typed']) ) { return 0; } return ( strlen($a['typed']) > strlen($b['typed']) ) ? -1 : 1; } function perly_word_sort($a, $b) { if ( strlen($a['type']) == strlen($b['type']) ) { return 0; } return ( strlen($a['type']) > strlen($b['type']) ) ? -1 : 1; } } ?>