$Date: 2005-10-10 14:08:54 +0100 (Mon, 10 Oct 2005) $ | > $Revision: 23 $ | > $Author: matt $ +--------------------------------------------------------------------------- | | > Warn Log functions | > Module written by Matt Mecham | > Date started: 4th June 2003 | | > Module Version Number: 1.0.0 | > DBA Checked: Tue 25th May 2004 +-------------------------------------------------------------------------- */ if ( ! defined( 'IN_ACP' ) ) { print "

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

У Вас нет доступа к директиве этого файла. Если Вы проводили обновления, убедитесь, что не забыли обновить 'admin.php'."; exit(); } class ad_warnlogs { var $base_url; /** * Section title name * * @var string */ var $perm_main = "admin"; /** * Section title name * * @var string */ var $perm_child = "warnlog"; function auto_run() { //----------------------------------------- // 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 'view': $this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':' ); $this->view(); break; case 'viewcontact': $this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':' ); $this->view_contact(); break; case 'viewnote': $this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':view' ); $this->view_note(); break; case 'remove': $this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':remove' ); $this->remove(); break; //----------------------------------------- default: $this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':' ); $this->list_current(); break; } } //----------------------------------------- // View NOTE in da pop up innit //----------------------------------------- function view_note() { if ($this->ipsclass->input['id'] == "") { $this->ipsclass->admin->error("Невозможно получить ID email, попробуйте снова"); } //----------------------------------------- // Load and config the post parser //----------------------------------------- require_once( ROOT_PATH."sources/handlers/han_parse_bbcode.php" ); $this->parser = new parse_bbcode(); $this->parser->ipsclass = $this->ipsclass; $this->parser->allow_update_caches = 1; $this->parser->bypass_badwords = intval($this->ipsclass->member['g_bypass_badwords']); $id = intval($this->ipsclass->input['id']); $this->ipsclass->DB->cache_add_query( 'warnlogs_view_note', array( 'id' => $id ) ); $this->ipsclass->DB->cache_exec_query(); if ( ! $row = $this->ipsclass->DB->fetch_row() ) { $this->ipsclass->admin->error("Невозможно получить ID email, попробуйте снова ($id)"); } $this->ipsclass->adskin->td_header[] = array( " " , "100%" ); $content = preg_match( "#(.+?)#is", $row['wlog_notes'], $cont ); $this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Warn Notes" ); $row['date'] = $this->ipsclass->admin->get_date( $row['wlog_date'], 'LONG' ); $this->parser->parse_html = 0; $this->parser->parse_nl2br = 1; $this->parser->parse_smilies = 1; $this->parser->parse_bbcode = 1; $text = $this->parser->pre_display_parse( $this->parser->pre_db_parse($cont[1]) ); $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "От: {$row['p_name']}
Кому: {$row['a_name']}
Отправлено: {$row['date']}

$text " ) ); $this->ipsclass->html .= $this->ipsclass->adskin->end_table(); $this->ipsclass->admin->print_popup(); } //----------------------------------------- // View contact in da pop up innit //----------------------------------------- function view_contact() { if ($this->ipsclass->input['id'] == "") { $this->ipsclass->admin->error("Невозможно получить ID email, попробуйте снова"); } $id = intval($this->ipsclass->input['id']); $this->ipsclass->DB->cache_add_query( 'warnlogs_view_note', array( 'id' => $id ) ); $this->ipsclass->DB->cache_exec_query(); if ( ! $row = $this->ipsclass->DB->fetch_row() ) { $this->ipsclass->admin->error("Невозможно получить ID email, попробуйте снова ($id)"); } $type = $row['wlog_contact'] == 'pm' ? "Личное сообщение" : "EMAIL"; $this->ipsclass->adskin->td_header[] = array( " " , "100%" ); $subject = preg_match( "#(.+?)#is", $row['wlog_contact_content'], $subj ); $content = preg_match( "#(.+?)#is", $row['wlog_contact_content'], $cont ); $this->ipsclass->html .= $this->ipsclass->adskin->start_table( $type.": ".$subj[1] ); $row['date'] = $this->ipsclass->admin->get_date( $row['wlog_date'], 'LONG' ); $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "От: {$row['p_name']}
Кому: {$row['a_name']}
Отправлено: {$row['date']}
Тема: $subj[1]

$cont[1] " ) ); $this->ipsclass->html .= $this->ipsclass->adskin->end_table(); $this->ipsclass->admin->print_popup(); } //----------------------------------------- // Remove archived files //----------------------------------------- function view() { $start = $this->ipsclass->input['st'] ? $this->ipsclass->input['st'] : 0; $this->ipsclass->html .= ""; // removed js popwin $this->ipsclass->admin->page_detail = "Просмотр всех записей предупреждений пользователя"; $this->ipsclass->admin->page_title = "Управление логами предупреждений"; if ($this->ipsclass->input['search_string'] == "" and $this->ipsclass->input['mid']) { $this->ipsclass->DB->simple_construct( array( 'select' => 'COUNT(wlog_id) as count', 'from' => 'warn_logs', 'where' => "wlog_mid='".$this->ipsclass->input['mid']."'" ) ); $this->ipsclass->DB->simple_exec(); $row = $this->ipsclass->DB->fetch_row(); $row_count = $row['count']; $query = "&{$this->ipsclass->form_code}&mid={$this->ipsclass->input['mid']}&code=view"; $this->ipsclass->DB->cache_add_query( 'warnlogs_view', array( 'mid' => $this->ipsclass->input['mid'], 'start' => $start ) ); $this->ipsclass->DB->cache_exec_query(); } else { $this->ipsclass->input['search_string'] = urldecode($this->ipsclass->input['search_string']); if ( ($this->ipsclass->input['search_type'] == 'notes') ) { $dbq = "l.wlog_notes LIKE '%".$this->ipsclass->input['search_string']."%'"; } else { $dbq = "l.wlog_contact_content LIKE '%".$this->ipsclass->input['search_string']."%'"; } $this->ipsclass->DB->simple_construct( array( 'select' => 'COUNT(l.wlog_id) as count', 'from' => 'warn_logs l', 'where' => $dbq ) ); $this->ipsclass->DB->simple_exec(); $row = $this->ipsclass->DB->fetch_row(); $row_count = $row['count']; $query = "&{$this->ipsclass->form_code}&code=view&search_type={$this->ipsclass->input['search_type']}&search_string=".urlencode($this->ipsclass->input['search_string']); $this->ipsclass->DB->cache_add_query( 'warnlogs_view_two', array( 'dbq' => $dbq, 'start' => $start ) ); $this->ipsclass->DB->cache_exec_query(); } $links = $this->ipsclass->build_pagelinks( array( 'TOTAL_POSS' => $row_count, 'PER_PAGE' => 30, 'CUR_ST_VAL' => $start, 'L_SINGLE' => "Одна страница", 'L_MULTI' => "Страницы: ", 'BASE_URL' => $this->ipsclass->base_url.$query, ) ); $this->ipsclass->admin->page_detail = "Вы можете видеть все записи предупрждений, сделанных вашими модераторами"; $this->ipsclass->admin->page_title = "Управление логами предупреждений"; //----------------------------------------- $this->ipsclass->adskin->td_header[] = array( "Тип" , "5%" ); $this->ipsclass->adskin->td_header[] = array( "Пользователь" , "15%" ); $this->ipsclass->adskin->td_header[] = array( "Сообщено?" , "5%" ); $this->ipsclass->adskin->td_header[] = array( "Предпроверка сообщений" , "10%" ); $this->ipsclass->adskin->td_header[] = array( "Бан" , "10%" ); $this->ipsclass->adskin->td_header[] = array( "Запрет сообщений" , "10%" ); $this->ipsclass->adskin->td_header[] = array( "Дата" , "15%" ); $this->ipsclass->adskin->td_header[] = array( "Модератор" , "15%" ); $this->ipsclass->adskin->td_header[] = array( "Посмотреть заметки" , "10%" ); $this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Сохранить логи предупреждений" ); $this->ipsclass->html .= $this->ipsclass->adskin->add_td_basic($links, 'right', 'pformstrip'); $days = array( 'd' => "Дней", 'h' => "часов" ); if ( $this->ipsclass->DB->get_num_rows() ) { while ( $row = $this->ipsclass->DB->fetch_row() ) { $row['wlog_date'] = $this->ipsclass->admin->get_date( $row['wlog_date'], 'LONG' ); $type = ( $row['wlog_type'] == 'pos' ) ? '-' : '+'; $cont = ( $row['wlog_contact'] != 'none' ) ? "
Просмотр
" : 'Нет'; $mod = preg_match( "#(.+?)#is" , $row['wlog_notes'], $mm ); $post = preg_match( "#(.+?)#is" , $row['wlog_notes'], $pm ); $susp = preg_match( "#(.+?)#is" , $row['wlog_notes'], $sm ); $content = preg_match( "#(.+?)#is", $row['wlog_notes'], $cm ); $content = $cm[1]; $mod = trim($mm[1]); $post = trim($pm[1]); $susp = trim($sm[1]); list($v, $u, $i) = explode(',', $mod); if ( $i == 1 ) { $mod = 'Не определено'; } else if ( $v == "" ) { $mod = 'Нет'; } else { $mod = $v.' '.$days[$u]; } //----------------------------------------- list($v, $u, $i) = explode(',', $post); if ( $i == 1 ) { $post = 'Не определено'; } else if ( $v == "" ) { $post = 'Нет'; } else { $post = $v.' '.$days[$u]; } list($v, $u) = explode(',', $susp); if ( $v == "" ) { $susp = 'нет'; } else { $susp = $v.' '.$days[$u]; } //----------------------------------------- $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "
$type
", "{$row['a_name']}", $cont, $mod, $susp, $post, "{$row['wlog_date']}", "{$row['p_name']}", "
Просмотр
" ) ); } } else { $this->ipsclass->html .= $this->ipsclass->adskin->add_td_basic("
Нет записей
"); } $this->ipsclass->html .= $this->ipsclass->adskin->add_td_basic($links, 'right', 'pformstrip'); $this->ipsclass->html .= $this->ipsclass->adskin->end_table(); //----------------------------------------- //------------------------------- $this->ipsclass->admin->output(); } //----------------------------------------- // Remove archived files //----------------------------------------- function remove() { if ($this->ipsclass->input['mid'] == "") { $this->ipsclass->admin->error("Вы не выбрали пользователя, чтобы удалить!"); } $this->ipsclass->DB->simple_exec_query( array( 'delete' => 'warn_logs', 'where' => "wlog_mid={$this->ipsclass->input['mid']}" ) ); $this->ipsclass->admin->save_log("Предупреждение удалено"); $this->ipsclass->boink_it($this->ipsclass->base_url."&{$this->ipsclass->form_code}"); } //----------------------------------------- // SHOW LOGS //----------------------------------------- function list_current() { $form_array = array(); $this->ipsclass->admin->page_detail = "В этой секции вы можете просматривать и удалять предупреждения, сделанные вашими модераторами.
Примечание: Удаление логов не понижает уровень предупреждений пользователя."; $this->ipsclass->admin->page_title = "Управление логами предупреждений"; $this->ipsclass->html .= ""; // removed js popwin //----------------------------------------- // VIEW LAST 5 //----------------------------------------- $this->ipsclass->DB->cache_add_query( 'warnlogs_list_current', array() ); $this->ipsclass->DB->cache_exec_query(); $this->ipsclass->adskin->td_header[] = array( "Тип" , "5%" ); $this->ipsclass->adskin->td_header[] = array( "Пользователь" , "25%" ); $this->ipsclass->adskin->td_header[] = array( "Сообщено?" , "5%" ); $this->ipsclass->adskin->td_header[] = array( "Дата" , "25%" ); $this->ipsclass->adskin->td_header[] = array( "Модератор" , "25%" ); $this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Последние 10 записей предупрждений" ); if ( $this->ipsclass->DB->get_num_rows() ) { while ( $row = $this->ipsclass->DB->fetch_row() ) { $row['wlog_date'] = $this->ipsclass->admin->get_date( $row['wlog_date'], 'LONG' ); $type = ( $row['wlog_type'] == 'pos' ) ? '-' : '+'; $cont = ( $row['wlog_contact'] != 'none' ) ? "
X
" : 'Нет'; $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "
$type
", "{$row['a_name']}", $cont, "{$row['wlog_date']}", "{$row['p_name']}", ) ); } } else { $this->ipsclass->html .= $this->ipsclass->adskin->add_td_basic("
Нет записей
"); } $this->ipsclass->html .= $this->ipsclass->adskin->end_table(); //----------------------------------------- $this->ipsclass->adskin->td_header[] = array( "Пользователь" , "30%" ); $this->ipsclass->adskin->td_header[] = array( "Время предупреждения" , "20%" ); $this->ipsclass->adskin->td_header[] = array( "Просмотр всех предупреждений пользователя" , "20%" ); $this->ipsclass->adskin->td_header[] = array( "Удаление всех предупреждений пользователя" , "30%" ); $this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Логи предупреждений сохранены" ); $this->ipsclass->DB->cache_add_query( 'warnlogs_list_current_two', array() ); $this->ipsclass->DB->cache_exec_query(); while ( $r = $this->ipsclass->DB->fetch_row() ) { $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "{$r['members_display_name']}", "
{$r['act_count']}
", "
Просмотр
", "
Удалить
", ) ); } $this->ipsclass->html .= $this->ipsclass->adskin->end_table(); //----------------------------------------- //------------------------------- $this->ipsclass->html .= $this->ipsclass->adskin->start_form( array( 1 => array( 'code' , 'view' ), 2 => array( 'act' , 'warnlog' ), 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( "Найти логи предупреждений" ); $form_array = array( 0 => array( 'notes' , 'Заметки' ), 1 => array( 'contact', 'Отправка Email/PM' ), ); //----------------------------------------- $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Искать..." , $this->ipsclass->adskin->form_input( "search_string") ) ); $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Искать в..." , $this->ipsclass->adskin->form_dropdown( "search_type", $form_array) ) ); $this->ipsclass->html .= $this->ipsclass->adskin->end_form("Искать"); $this->ipsclass->html .= $this->ipsclass->adskin->end_table(); //----------------------------------------- //------------------------------- $this->ipsclass->admin->output(); } } ?>