785 lines
26 KiB
PHP
785 lines
26 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
|
|
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
|
|
+---------------------------------------------------------------------------
|
|
| > $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 "<h1>Íåâåðíûé âõîä</h1> Ó Âàñ íåò äîñòóïà ê äèðåêòèâå ýòîãî ôàéëà. Åñëè Âû ïðîâîäèëè îáíîâëåíèÿ, óáåäèòåñü, ÷òî íå çàáûëè îáíîâèòü 'admin.php'.";
|
|
exit();
|
|
}
|
|
|
|
class ad_banandbadword {
|
|
|
|
var $functions = "";
|
|
|
|
/**
|
|
* Section title name
|
|
*
|
|
* @var string
|
|
*/
|
|
var $perm_main = "content";
|
|
|
|
/**
|
|
* Section title name
|
|
*
|
|
* @var string
|
|
*/
|
|
var $perm_child = "babw";
|
|
|
|
function auto_run()
|
|
{
|
|
//-----------------------------------------
|
|
// Require and RUN !! THERES A BOMB
|
|
//-----------------------------------------
|
|
|
|
$this->ipsclass->admin->page_detail = "";
|
|
$this->ipsclass->admin->page_title = "Ôèëüòðû áëîêèðîâêè (ban)";
|
|
|
|
//-----------------------------------------
|
|
// Kill globals - globals bad, Homer good.
|
|
//-----------------------------------------
|
|
|
|
$tmp_in = array_merge( $_GET, $_POST, $_COOKIE );
|
|
|
|
foreach ( $tmp_in as $k => $v )
|
|
{
|
|
unset($$k);
|
|
}
|
|
|
|
//-----------------------------------------
|
|
// What to do...
|
|
//-----------------------------------------
|
|
|
|
switch($this->ipsclass->input['code'])
|
|
{
|
|
//-----------------------------------------
|
|
// Badword
|
|
//-----------------------------------------
|
|
|
|
case 'badword':
|
|
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':' );
|
|
$this->badword_start();
|
|
break;
|
|
|
|
case 'badword_add':
|
|
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':bw-add' );
|
|
$this->badword_add();
|
|
break;
|
|
|
|
case 'badword_remove':
|
|
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':bw-remove' );
|
|
$this->badword_remove();
|
|
break;
|
|
|
|
case 'badword_edit':
|
|
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':bw-edit' );
|
|
$this->badword_edit();
|
|
break;
|
|
|
|
case 'badword_doedit':
|
|
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':bw-edit' );
|
|
$this->badword_doedit();
|
|
break;
|
|
|
|
case 'badword_export':
|
|
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':bw-export' );
|
|
$this->badword_export();
|
|
break;
|
|
|
|
case 'badword_import':
|
|
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':bw-import' );
|
|
$this->badword_import();
|
|
break;
|
|
|
|
//-----------------------------------------
|
|
// BAN (d-aid)
|
|
//-----------------------------------------
|
|
|
|
case 'ban':
|
|
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':ban-view' );
|
|
$this->ban_start();
|
|
break;
|
|
case 'ban_add':
|
|
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':ban-add' );
|
|
$this->ban_add();
|
|
break;
|
|
case 'ban_delete':
|
|
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':ban-remove' );
|
|
$this->ban_delete();
|
|
break;
|
|
}
|
|
}
|
|
|
|
//-----------------------------------------
|
|
// BAN: Rebuild cache
|
|
//-----------------------------------------
|
|
|
|
function ban_rebuildcache()
|
|
{
|
|
$this->ipsclass->cache['banfilters'] = array();
|
|
|
|
$this->ipsclass->DB->simple_construct( array( 'select' => 'ban_content', 'from' => 'banfilters', 'where' => "ban_type='ip'" ) );
|
|
$this->ipsclass->DB->simple_exec();
|
|
|
|
while ( $r = $this->ipsclass->DB->fetch_row() )
|
|
{
|
|
$this->ipsclass->cache['banfilters'][] = $r['ban_content'];
|
|
}
|
|
|
|
$this->ipsclass->update_cache( array( 'name' => 'banfilters', 'array' => 1, 'deletefirst' => 1 ) );
|
|
}
|
|
|
|
//-----------------------------------------
|
|
// BAN: DELETE
|
|
//-----------------------------------------
|
|
|
|
function ban_delete()
|
|
{
|
|
$ids = array();
|
|
|
|
foreach ($this->ipsclass->input as $key => $value)
|
|
{
|
|
if ( preg_match( "/^id_(\d+)$/", $key, $match ) )
|
|
{
|
|
if ( $this->ipsclass->input[$match[0]] )
|
|
{
|
|
$ids[] = $match[1];
|
|
}
|
|
}
|
|
}
|
|
|
|
if ( count( $ids ) )
|
|
{
|
|
$this->ipsclass->DB->simple_construct( array( 'delete' => 'banfilters', 'where' => 'ban_id IN('.implode( ",",$ids ).')' ) );
|
|
$this->ipsclass->DB->simple_exec();
|
|
}
|
|
|
|
$this->ban_rebuildcache();
|
|
|
|
$this->ipsclass->main_msg = "Áàí óäàëåí";
|
|
$this->ban_start();
|
|
}
|
|
|
|
//-----------------------------------------
|
|
// BAN: ADD
|
|
//-----------------------------------------
|
|
|
|
function ban_add()
|
|
{
|
|
if ( ! $this->ipsclass->input['bantext'] )
|
|
{
|
|
$this->ipsclass->main_msg = "Âû äîëæíû ââåñòè çàìåíÿåìîå ñëîâî!";
|
|
$this->ban_start();
|
|
}
|
|
|
|
//-----------------------------------------
|
|
// Check for existing entry
|
|
//-----------------------------------------
|
|
|
|
$result = $this->ipsclass->DB->simple_exec_query( array( 'select' => '*', 'from' => 'banfilters', 'where' => "ban_content='{$this->ipsclass->input['bantext']}' and ban_type='{$this->ipsclass->input['bantype']}'" ) );
|
|
|
|
if ( $result['ban_id'] )
|
|
{
|
|
$this->ipsclass->main_msg = "Òàêîå çíà÷åíèå óæå åñòü.";
|
|
$this->ban_start();
|
|
}
|
|
|
|
$this->ipsclass->DB->do_insert( 'banfilters', array( 'ban_type' => $this->ipsclass->input['bantype'], 'ban_content' => $this->ipsclass->input['bantext'], 'ban_date' => time() ) );
|
|
|
|
$this->ban_rebuildcache();
|
|
|
|
$this->ipsclass->main_msg = "Äîáàâëåí íîâûé áàí ôèëüòð";
|
|
|
|
$this->ban_start();
|
|
|
|
}
|
|
|
|
//-----------------------------------------
|
|
// BAN: START
|
|
//-----------------------------------------
|
|
|
|
function ban_start()
|
|
{
|
|
$this->ipsclass->admin->page_title = "Óïðàâëåíèå ôèëüòðàìè áëîêèðîâêè";
|
|
|
|
$this->ipsclass->admin->page_detail = "Ýòà ñåêöèÿ ïîçâîëÿåò âàì èçìåíÿòü, óäàëÿòü è äîáàâëÿòü ip-àäðåñà, e-mail è çàðåçåðâèðîâàííûå èìåíà â ôèëüòð äëÿ áëîêèðîâêè.
|
|
<br /><strong>Âû ìîæåòå èñïîëüçîâàòü «ñèìâîë çâåçäî÷êè» — * , äëÿ ëþáîãî(ûõ) ñèìâîëà(îâ) ip-àäðåñà èëè e-mail. (íàïðèìåð: 127.0.*, *@mail.ru)</strong>";
|
|
|
|
//-----------------------------------------
|
|
// Get things
|
|
//-----------------------------------------
|
|
|
|
$ban = array();
|
|
|
|
$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'banfilters', 'order' => 'ban_date desc' ) );
|
|
$this->ipsclass->DB->simple_exec();
|
|
|
|
while ( $r = $this->ipsclass->DB->fetch_row() )
|
|
{
|
|
$ban[ $r['ban_type'] ][ $r['ban_id'] ] = $r;
|
|
}
|
|
|
|
//-----------------------------------------
|
|
// SHOW THEM!
|
|
//-----------------------------------------
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->start_form( array( 1 => array( 'code' , 'ban_delete'),
|
|
2 => array( 'act' , 'babw' ),
|
|
4 => array( 'section', $this->ipsclass->section_code ),
|
|
) );
|
|
|
|
$this->ipsclass->adskin->td_header[] = array( " " , "1%" );
|
|
$this->ipsclass->adskin->td_header[] = array( "Çàïèñü" , "80%" );
|
|
$this->ipsclass->adskin->td_header[] = array( "Äàòà äîáàâëåíèÿ" , "20%" );
|
|
|
|
//-----------------------------------------
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Óïðàâëåíèå ôèëüòðàìè áëîêèðîâêè" );
|
|
|
|
//-----------------------------------------
|
|
// Banned IP Addresses
|
|
//-----------------------------------------
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_basic("Çàáëîêèðîâàííûå ip-àäðåñà", "left", "pformstrip");
|
|
|
|
if ( is_array( $ban['ip'] ) and count( $ban['ip'] ) )
|
|
{
|
|
foreach ( $ban['ip'] as $id => $entry )
|
|
{
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<input type='checkbox' name='id_{$entry['ban_id']}' value='1' />",
|
|
$entry['ban_content'],
|
|
$this->ipsclass->get_date( $entry['ban_date'], 'SHORT' ),
|
|
) );
|
|
}
|
|
}
|
|
else
|
|
{
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_basic("Çàáëîêèðîâàííûõ IP-àäðåñîâ íåò", "left", "tdrow1");
|
|
}
|
|
|
|
//-----------------------------------------
|
|
// Banned Email Addresses
|
|
//-----------------------------------------
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_basic("Çàáëîêèðîâàííûå e-mail àäðåñà", "left", "pformstrip");
|
|
|
|
if ( is_array( $ban['email'] ) and count( $ban['email'] ) )
|
|
{
|
|
foreach ( $ban['email'] as $id => $entry )
|
|
{
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<input type='checkbox' name='id_{$entry['ban_id']}' value='1' />",
|
|
$entry['ban_content'],
|
|
$this->ipsclass->get_date( $entry['ban_date'], 'SHORT' ),
|
|
) );
|
|
}
|
|
}
|
|
else
|
|
{
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_basic("Çàáëîêèðîâàííûõ e-mail àäðåñîâ íåò", "left", "tdrow1");
|
|
}
|
|
|
|
//-----------------------------------------
|
|
// Banned Names
|
|
//-----------------------------------------
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_basic("Çàïðåùåííûå ê ðåãèñòðàöèè èìåíà ïîëüçîâàòåëåé", "left", "pformstrip");
|
|
|
|
if ( is_array( $ban['name'] ) and count( $ban['name'] ) )
|
|
{
|
|
foreach ( $ban['name'] as $id => $entry )
|
|
{
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<input type='checkbox' name='id_{$entry['ban_id']}' value='1' />",
|
|
$entry['ban_content'],
|
|
$this->ipsclass->get_date( $entry['ban_date'], 'SHORT' ),
|
|
) );
|
|
}
|
|
}
|
|
else
|
|
{
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_basic("Çàïðåùåííûõ ê ðåãèñòðàöèè èìåí ïîëüçîâàòåëåé íåò", "left", "tdrow1");
|
|
}
|
|
|
|
$end_it_now = "<div align='left' style='float:left;width:auto;'>
|
|
<input type='submit' value='Óäàëèòü âûáðàííîå' class='realdarkbutton' />
|
|
</div></form>
|
|
<div align='center'><form method='post' action='{$this->ipsclass->base_url}&{$this->ipsclass->form_code}&code=ban_add'><input type='text' size='30' class='textinput' value='' name='bantext' />
|
|
<select class='dropdown' name='bantype'><option value='ip'>IP àäðåñ</option><option value='email'>e-mail àäðåñ</option><option value='name'>Name</option></select>
|
|
<input type='submit' value='Äîáàâèòü íîâûé ôèëüòð' class='realdarkbutton' /></form></div>";
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_basic( $end_it_now, "center", "pformstrip");
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->end_table();
|
|
|
|
$this->ipsclass->admin->output();
|
|
|
|
|
|
}
|
|
|
|
//-----------------------------------------
|
|
// BADWORDS: Import
|
|
//-----------------------------------------
|
|
|
|
function badword_import()
|
|
{
|
|
$content = $this->ipsclass->admin->import_xml( 'ipb_badwords.xml' );
|
|
|
|
//-----------------------------------------
|
|
// Got anything?
|
|
//-----------------------------------------
|
|
|
|
if ( ! $content )
|
|
{
|
|
$this->ipsclass->main_msg = "Çàêà÷êà íå ñîâåðøåíà, ipb_badwords.xml íåêîððåêòíûé èëè ïóñò";
|
|
$this->badword_start();
|
|
}
|
|
|
|
//-----------------------------------------
|
|
// Get xml mah-do-dah
|
|
//-----------------------------------------
|
|
|
|
require( KERNEL_PATH.'class_xml.php' );
|
|
|
|
$xml = new class_xml();
|
|
|
|
//-----------------------------------------
|
|
// Unpack the datafile
|
|
//-----------------------------------------
|
|
|
|
$xml->xml_parse_document( $content );
|
|
|
|
//-----------------------------------------
|
|
// Get current badwords
|
|
//-----------------------------------------
|
|
|
|
$words = array();
|
|
|
|
$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'badwords', 'order' => 'type' ) );
|
|
$this->ipsclass->DB->simple_exec();
|
|
|
|
while ( $r = $this->ipsclass->DB->fetch_row() )
|
|
{
|
|
$words[ $r['type'] ] = 1;
|
|
}
|
|
|
|
//-----------------------------------------
|
|
// pArse
|
|
//-----------------------------------------
|
|
|
|
foreach( $xml->xml_array['badwordexport']['badwordgroup']['badword'] as $idx => $entry )
|
|
{
|
|
$type = $entry['type']['VALUE'];
|
|
$swop = $entry['swop']['VALUE'];
|
|
$m_exact = $entry['m_exact']['VALUE'];
|
|
|
|
if ( $words[ $type ] )
|
|
{
|
|
continue;
|
|
}
|
|
|
|
if ( $type )
|
|
{
|
|
$this->ipsclass->DB->do_insert( 'badwords', array( 'type' => $type, 'swop' => $swop, 'm_exact' => $m_exact ) );
|
|
}
|
|
}
|
|
|
|
$this->badword_rebuildcache();
|
|
|
|
$this->ipsclass->main_msg = "Èìïîðò XML ôàéëà ïðîøåë óñïåøíî";
|
|
|
|
$this->badword_start();
|
|
|
|
}
|
|
|
|
//-----------------------------------------
|
|
// BADWORD: Export
|
|
//-----------------------------------------
|
|
|
|
function badword_export()
|
|
{
|
|
//-----------------------------------------
|
|
// Get xml mah-do-dah
|
|
//-----------------------------------------
|
|
|
|
require( KERNEL_PATH.'class_xml.php' );
|
|
|
|
$xml = new class_xml();
|
|
|
|
//-----------------------------------------
|
|
// Start...
|
|
//-----------------------------------------
|
|
|
|
$xml->xml_set_root( 'badwordexport', array( 'exported' => time() ) );
|
|
|
|
//-----------------------------------------
|
|
// Get emo group
|
|
//-----------------------------------------
|
|
|
|
$xml->xml_add_group( 'badwordgroup' );
|
|
|
|
$this->ipsclass->DB->simple_construct( array( 'select' => 'type, swop, m_exact', 'from' => 'badwords', 'order' => 'type' ) );
|
|
$this->ipsclass->DB->simple_exec();
|
|
|
|
while ( $r = $this->ipsclass->DB->fetch_row() )
|
|
{
|
|
$content = array();
|
|
|
|
foreach ( $r as $k => $v )
|
|
{
|
|
$content[] = $xml->xml_build_simple_tag( $k, $v );
|
|
}
|
|
|
|
$entry[] = $xml->xml_build_entry( 'badword', $content );
|
|
}
|
|
|
|
$xml->xml_add_entry_to_group( 'badwordgroup', $entry );
|
|
|
|
$xml->xml_format_document();
|
|
|
|
//-----------------------------------------
|
|
// Send to browser.
|
|
//-----------------------------------------
|
|
|
|
$this->ipsclass->admin->show_download( $xml->xml_document, 'ipb_badwords.xml' );
|
|
}
|
|
|
|
//-----------------------------------------
|
|
// BADWORD: Start
|
|
//-----------------------------------------
|
|
|
|
function badword_start()
|
|
{
|
|
$this->ipsclass->admin->page_detail = "Â ýòîé ñåêöèè âû ìîæåòå äîáàâëÿòü, èçìåíÿòü è óäàëÿòü ôèëüòðû íåöåíçóðíûõ ñëîâ.<br>Ôèëüòð íåöåíçóðíûõ ñëîâ ïîçâîëÿåò âàì çàìåíÿòü íåöåíçóðíûå ñëîâà â ñîîáùåíèÿõ ïîëüçîâàòåëåé, â ïîäïèñÿõ è â íàçâàíèÿõ òåì.<br><br><b>Ñîâïàäåíèå ïî ìàñêå</b>: ïðè âûáîðå ñïîñîáà 'Ìàñêà', ââåäåííîå âàìè ñëîâî áóäåò èçìåíÿòüñÿ äàæå â ñëîâàõ, ñîäåðæàùèõ â ñåáå ýòî ñëîâî. Íàïðèìåð, åñëè âû ââåäåòå â ôèëüòð ñëîâî 'êîçà', òî ýòî ñëîâî áóäåò èçìåíåíî íà óêàçàííûé âàìè çàìåíèòåëü è â ñëîâå 'ñòðåêîçà'. Åñëè âû íå ââåäåòå çàìåíèòåëü, òî íåöåíçóðíîå ñëîâî áóäåò èçìåíåíî íà øåñòü ñèìâîëîâ «ðåøåòêè» — #
|
|
<br><br><b>Òî÷íîå ñîâïàäåíèå:</b>: Ïðè âûáîðå ñïîñîáà 'Òî÷íûé', ââåäåííîå âàìè ñëîâî áóäåò èçìåíÿòüñÿ íà çàìåíèòåëü òîëüêî ïðè òî÷íîì ñîâïàäåíèè ýòîãî ñëîâà. Íàïðèìåð, åñëè âû ââåäåòå â ôèëüòð ñëîâî 'êîçà', òî ýòî ñëîâî áóäåò èçìåíåíî íà óêàçàííûé âàìè çàìåíèòåëü, òîëüêî â ñëîâå 'êîçà'. Åñëè âû íå ââåäåòå çàìåíèòåëü, òî íåöåíçóðíîå ñëîâî áóäåò èçìåíåíî íà øåñòü ñèìâîëîâ «ðåøåòêè» — #.
|
|
Äàííàÿ îïöèÿ ÷óâñòâèòåëüíà ê ðåãèñòðó.";
|
|
$this->ipsclass->admin->page_title = "Ôèëüòð íåöåíçóðíûõ ñëîâ";
|
|
|
|
//-----------------------------------------
|
|
// Start form
|
|
//-----------------------------------------
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->start_form( array( 1 => array( 'code' , 'badword_add' ),
|
|
2 => array( 'act' , 'babw' ),
|
|
4 => array( 'section', $this->ipsclass->section_code ),
|
|
) );
|
|
|
|
$this->ipsclass->adskin->td_header[] = array( "Ñëîâî" , "30%" );
|
|
$this->ipsclass->adskin->td_header[] = array( "Çàìåíà" , "30%" );
|
|
$this->ipsclass->adskin->td_header[] = array( "Ìåòîä" , "20%" );
|
|
$this->ipsclass->adskin->td_header[] = array( "Èçìåíèòü" , "10%" );
|
|
$this->ipsclass->adskin->td_header[] = array( "Óäàëèòü" , "10%" );
|
|
|
|
//-----------------------------------------
|
|
// Start table
|
|
//-----------------------------------------
|
|
|
|
$export_button = $this->ipsclass->adskin->js_make_button("Èìïîðòèðîâàíèå ôàéëà ñ ôèëüòðàìè íåöåíçóðíûõ ñëîâ", $this->ipsclass->base_url."&{$this->ipsclass->form_code}&code=badword_export");
|
|
|
|
$table = "<table cellpadding='0' cellspacing='0' border='0' width='100%'>
|
|
<tr>
|
|
<td align='left' width='100%' style='font-weight:bold;font-size:11px;color:#FFF'>Òåêóùèå ôèëüòðû</td>
|
|
<td align='right' nowrap='nowrap' style='padding-right:2px'>{$export_button}</td>
|
|
</tr>
|
|
</table>";
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->start_table( $table );
|
|
|
|
$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'badwords', 'order' => 'type' ) );
|
|
$this->ipsclass->DB->simple_exec();
|
|
|
|
if ( $this->ipsclass->DB->get_num_rows() )
|
|
{
|
|
while ( $r = $this->ipsclass->DB->fetch_row() )
|
|
{
|
|
$words[] = $r;
|
|
}
|
|
|
|
//usort($words, array( 'ad_settings', 'perly_word_sort' ) );
|
|
|
|
foreach($words as $idx => $r)
|
|
{
|
|
|
|
$replace = $r['swop'] ? stripslashes($r['swop']) : '######';
|
|
|
|
$method = $r['m_exact'] ? 'Òî÷íûé' : 'Ìàñêà';
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( stripslashes($r['type']),
|
|
$replace,
|
|
$method,
|
|
"<center><a href='".$this->ipsclass->base_url."&{$this->ipsclass->form_code}&code=badword_edit&id={$r['wid']}'>Èçìåíèòü</a></center>",
|
|
"<center><a href='".$this->ipsclass->base_url."&{$this->ipsclass->form_code}&code=badword_remove&id={$r['wid']}'>Óäàëèòü</a></center>",
|
|
) );
|
|
}
|
|
|
|
}
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->end_table();
|
|
|
|
|
|
$this->ipsclass->adskin->td_header[] = array( "Ñëîâî" , "40%" );
|
|
$this->ipsclass->adskin->td_header[] = array( "Çàìåíà" , "40%" );
|
|
$this->ipsclass->adskin->td_header[] = array( "Ìåòîä" , "20%" );
|
|
|
|
//-----------------------------------------
|
|
// Add new filter
|
|
//-----------------------------------------
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Äîáàâëåíèå íîâîãî ôèëüòðà" );
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( $this->ipsclass->adskin->form_input('before'),
|
|
$this->ipsclass->adskin->form_input('after'),
|
|
$this->ipsclass->adskin->form_dropdown( 'match', array( 0 => array( 1, 'Òî÷íûé' ), 1 => array( 0, 'Ìàñêà' ) ) )
|
|
) );
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->end_form('Äîáàâèòü íîâûé ôèëüòð');
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->end_table();
|
|
|
|
//-----------------------------------------
|
|
// IMPORT: Start table
|
|
//-----------------------------------------
|
|
|
|
$this->ipsclass->adskin->td_header[] = array( " " , "60%" );
|
|
$this->ipsclass->adskin->td_header[] = array( " " , "40%" );
|
|
|
|
//-----------------------------------------
|
|
// IMPORT: Start output
|
|
//-----------------------------------------
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->start_form( array( 1 => array( 'code' , 'badword_import' ),
|
|
2 => array( 'act' , 'babw' ),
|
|
3 => array( 'MAX_FILE_SIZE', '10000000000' ),
|
|
4 => array( 'section', $this->ipsclass->section_code ),
|
|
) , "uploadform", " enctype='multipart/form-data'" );
|
|
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Èìïîðòèðîâàíèå ôàéëà ñ ôèëüòðàìè íåöåíçóðíûõ ñëîâ" );
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array(
|
|
"<b>Çàãðóçêà XML-ôàéëà ñ ôèëüòðàìè</b><div style='color:gray'>Âûáåðèòå ôàéë äëÿ çàãðóçêè ñ âàøåãî êîìïüþòåðà 'ipb_badwords.xml' èëè 'ipb_badwords.xml.gz'. Äâîéíûå çàïèñè èìïîðòèðîâàíû íå áóäóò.</div>",
|
|
$this->ipsclass->adskin->form_upload( )
|
|
) );
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->end_form("Èìïîðòèðîâàòü");
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->end_table();
|
|
|
|
$this->ipsclass->admin->output();
|
|
|
|
}
|
|
|
|
//-----------------------------------------
|
|
// BADWORD: Complete Edit
|
|
//-----------------------------------------
|
|
|
|
function badword_doedit()
|
|
{
|
|
if ($this->ipsclass->input['before'] == "")
|
|
{
|
|
$this->ipsclass->admin->error("Âû äîëæíû ââåñòè çàìåíÿåìîå ñëîâî!");
|
|
}
|
|
|
|
if ($this->ipsclass->input['id'] == "")
|
|
{
|
|
$this->ipsclass->admin->error("You must pass a valid filter id, silly!");
|
|
}
|
|
|
|
$this->ipsclass->input['match'] = $this->ipsclass->input['match'] ? 1 : 0;
|
|
|
|
strlen($this->ipsclass->input['swop']) > 1 ? $this->ipsclass->input['swop'] : "";
|
|
|
|
$this->ipsclass->DB->do_update( 'badwords', array( 'type' => $this->ipsclass->input['before'],
|
|
'swop' => $this->ipsclass->input['after'],
|
|
'm_exact' => $this->ipsclass->input['match'],
|
|
), "wid='".$this->ipsclass->input['id']."'" );
|
|
|
|
$this->badword_rebuildcache();
|
|
|
|
$this->ipsclass->main_msg = "Ôèëüòð èçìåíåí";
|
|
|
|
$this->badword_start();
|
|
}
|
|
|
|
//-----------------------------------------
|
|
// BADWORD: Edit
|
|
//-----------------------------------------
|
|
|
|
function badword_edit()
|
|
{
|
|
$this->ipsclass->admin->page_detail = "Âûìîæåòå èçìåíèòü âûáðàííûé ôèëüòð â ôîðìå íèæå";
|
|
$this->ipsclass->admin->page_title = "Ôèëüòð íåöåíçóðíûõ ñëîâ";
|
|
|
|
//-----------------------------------------
|
|
|
|
if ($this->ipsclass->input['id'] == "")
|
|
{
|
|
$this->ipsclass->admin->error("Ôèëüòð ñ òàêèì id íå íàéäåí!");
|
|
}
|
|
|
|
//-----------------------------------------
|
|
|
|
$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'badwords', 'where' => "wid='".$this->ipsclass->input['id']."'" ) );
|
|
$this->ipsclass->DB->simple_exec();
|
|
|
|
if ( ! $r = $this->ipsclass->DB->fetch_row() )
|
|
{
|
|
$this->ipsclass->admin->error("Ìû íå ìîæåì íàéòè ýòîò ôèëüòð â áàçå äàííûõ");
|
|
}
|
|
|
|
//-----------------------------------------
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->start_form( array( 1 => array( 'code' , 'badword_doedit' ),
|
|
2 => array( 'act' , 'babw' ),
|
|
3 => array( 'id' , $this->ipsclass->input['id'] ),
|
|
4 => array( 'section', $this->ipsclass->section_code ),
|
|
) );
|
|
|
|
|
|
|
|
$this->ipsclass->adskin->td_header[] = array( "Ñëîâî" , "40%" );
|
|
$this->ipsclass->adskin->td_header[] = array( "Çàìåíà" , "40%" );
|
|
$this->ipsclass->adskin->td_header[] = array( "Ìåòîä" , "20%" );
|
|
|
|
//-----------------------------------------
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Ðåäàêòèðîâàíèå ôèëüòðà" );
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( $this->ipsclass->adskin->form_input('before', stripslashes($r['type']) ),
|
|
$this->ipsclass->adskin->form_input('after' , stripslashes($r['swop']) ),
|
|
$this->ipsclass->adskin->form_dropdown( 'match', array( 0 => array( 1, 'Òî÷íûé' ), 1 => array( 0, 'Ìàñêà' ) ), $r['m_exact'] )
|
|
) );
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->end_form('Ðåäàêòèðîâàòü ôèëüòð');
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->end_table();
|
|
|
|
$this->ipsclass->admin->output();
|
|
|
|
}
|
|
|
|
//-----------------------------------------
|
|
// BADWORD: Remove badowrd
|
|
//-----------------------------------------
|
|
|
|
function badword_remove()
|
|
{
|
|
if ($this->ipsclass->input['id'] == "")
|
|
{
|
|
$this->ipsclass->admin->error("You must pass a valid filter id, silly!");
|
|
}
|
|
|
|
$this->ipsclass->DB->simple_exec_query( array( 'delete' => 'badwords', 'where' => "wid='".$this->ipsclass->input['id']."'" ) );
|
|
|
|
$this->badword_rebuildcache();
|
|
|
|
$this->ipsclass->main_msg = "Ôèëüòð óäàëåí";
|
|
|
|
$this->badword_start();
|
|
}
|
|
|
|
//-----------------------------------------
|
|
// BADWORD: Add badword
|
|
//-----------------------------------------
|
|
|
|
function badword_add()
|
|
{
|
|
if ($this->ipsclass->input['before'] == "")
|
|
{
|
|
$this->ipsclass->admin->error("Âû äîëæíû ââåñòè ñëîâî äëÿ çàìåíû");
|
|
}
|
|
|
|
$this->ipsclass->input['match'] = $this->ipsclass->input['match'] ? 1 : 0;
|
|
|
|
strlen($this->ipsclass->input['swop']) > 1 ? $this->ipsclass->input['swop'] : "";
|
|
|
|
$this->ipsclass->DB->do_insert( 'badwords', array( 'type' => $this->ipsclass->input['before'],
|
|
'swop' => $this->ipsclass->input['after'],
|
|
'm_exact' => $this->ipsclass->input['match'],
|
|
) );
|
|
|
|
$this->badword_rebuildcache();
|
|
|
|
$this->ipsclass->main_msg = "Ôèëüòð ïóñò";
|
|
|
|
$this->badword_start();
|
|
}
|
|
|
|
//-----------------------------------------
|
|
// BADWORD Rebuild Cache
|
|
//-----------------------------------------
|
|
|
|
function badword_rebuildcache()
|
|
{
|
|
$this->ipsclass->cache['badwords'] = array();
|
|
|
|
$this->ipsclass->DB->simple_construct( array( 'select' => 'type,swop,m_exact', 'from' => 'badwords' ) );
|
|
$this->ipsclass->DB->simple_exec();
|
|
|
|
while ( $r = $this->ipsclass->DB->fetch_row() )
|
|
{
|
|
$this->ipsclass->cache['badwords'][] = $r;
|
|
}
|
|
|
|
$this->ipsclass->update_cache( array( 'name' => 'badwords', 'array' => 1, 'deletefirst' => 1 ) );
|
|
}
|
|
|
|
|
|
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;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
?>
|