Version 2.3.6
This commit is contained in:
1 parent
a3bb603c96
commit
19b38c7c74
764 files changed
+143731
-118164
No files matched your search
@@ -2,25 +2,17 @@
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board 2.2.2
|
||||
| Invision Power Board
|
||||
| =============================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2006 Invision Power Services, Inc.
|
||||
| http://www.invisionpower.com
|
||||
| =============================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| http://www.ibresource.ru/products/invisionpowerboard/
|
||||
| Time: Monday 05th of March 2007 10:10:54 PM
|
||||
| Release: e3790216629e5a2aaf37070b32237f06
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
| http://www.ibresource.ru/license
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
|
||||
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
|
||||
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
|
||||
+---------------------------------------------------------------------------
|
||||
| > $Date: 2006-11-03 16:54:54 -0600 (Fri, 03 Nov 2006) $
|
||||
| > $Revision: 709 $
|
||||
| > $Date: 2007-04-19 18:08:46 -0400 (Thu, 19 Apr 2007) $
|
||||
| > $Revision: 947 $
|
||||
| > $Author: bfarber $
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
@@ -35,7 +27,7 @@
|
||||
|
||||
if ( ! defined( 'IN_ACP' ) )
|
||||
{
|
||||
print "<h1>Íåâåðíûé âõîä</h1> Ó âàñ íåò äîñòóïà ê ýòîìó ôàéëó. Åñëè ïðîâîäèëîñü îáíîâëåíèå, óáåäèòåñü, ÷òî íå çàáûëè îáíîâèòü ôàéë admin.php.";
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
|
||||
exit();
|
||||
}
|
||||
|
||||
@@ -44,81 +36,81 @@ class ad_banandbadword {
|
||||
var $functions = "";
|
||||
var $ipsclass;
|
||||
var $html;
|
||||
|
||||
|
||||
/**
|
||||
* Section title name
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
var $perm_main = "content";
|
||||
|
||||
|
||||
/**
|
||||
* Section title name
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
var $perm_child = "babw";
|
||||
|
||||
|
||||
function auto_run()
|
||||
{
|
||||
$this->html = $this->ipsclass->acp_load_template('cp_skin_bbcode_badword');
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// Require and RUN !! THERES A BOMB
|
||||
//-----------------------------------------
|
||||
|
||||
|
||||
$this->ipsclass->admin->page_detail = "";
|
||||
$this->ipsclass->admin->page_title = "Ôèëüòðû áëîêèðîâêè (ban)";
|
||||
$this->ipsclass->admin->page_title = "Ban Manager";
|
||||
|
||||
//-----------------------------------------
|
||||
// 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();
|
||||
@@ -133,38 +125,38 @@ class ad_banandbadword {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// BAN: Rebuild cache
|
||||
//-----------------------------------------
|
||||
|
||||
|
||||
function ban_rebuildcache()
|
||||
{
|
||||
require_once ROOT_PATH.'sources/classes/bbcode/class_bbcode_core.php';
|
||||
|
||||
|
||||
$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'];
|
||||
}
|
||||
|
||||
|
||||
usort( $this->ipsclass->cache['banfilters'] , array( 'class_bbcode_core', 'word_length_sort' ) );
|
||||
|
||||
|
||||
$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 ) )
|
||||
@@ -175,104 +167,104 @@ class ad_banandbadword {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$ids = $this->ipsclass->clean_int_array( $ids );
|
||||
|
||||
|
||||
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->ipsclass->main_msg = "Ban filters removed";
|
||||
$this->ban_start();
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// BAN: ADD
|
||||
//-----------------------------------------
|
||||
|
||||
|
||||
function ban_add()
|
||||
{
|
||||
if ( ! $this->ipsclass->input['bantext'] )
|
||||
{
|
||||
$this->ipsclass->main_msg = "Âû äîëæíû ââåñòè çàìåíÿåìîå ñëîâî!";
|
||||
$this->ipsclass->main_msg = "You must enter something to add to the ban filters!";
|
||||
$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->ipsclass->main_msg = "Duplicate entry, entry not added to the ban filters database.";
|
||||
$this->ban_start();
|
||||
}
|
||||
|
||||
|
||||
$this->ipsclass->DB->do_insert( 'banfilters', array( 'ban_type' => $this->ipsclass->input['bantype'], 'ban_content' => trim($this->ipsclass->input['bantext']), 'ban_date' => time() ) );
|
||||
|
||||
|
||||
$this->ban_rebuildcache();
|
||||
|
||||
$this->ipsclass->main_msg = "Íîâûé ôèëüòð áëîêèðîâêè óñïåøíî äîáàâëåí.";
|
||||
|
||||
|
||||
$this->ipsclass->main_msg = "Ban filter added";
|
||||
|
||||
$this->ban_start();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// BAN: START
|
||||
//-----------------------------------------
|
||||
|
||||
|
||||
function ban_start()
|
||||
{
|
||||
$this->ipsclass->admin->page_title = "Óïðàâëåíèå ôèëüòðàìè áëîêèðîâêè";
|
||||
$this->ipsclass->admin->page_title = "Ban Control";
|
||||
$this->ipsclass->admin->nav[] = array( $this->ipsclass->form_code.'&code=ban', 'Ban Filters' );
|
||||
|
||||
$this->ipsclass->admin->page_detail = "Ýòà ñåêöèÿ ïîçâîëÿåò âàì èçìåíÿòü, óäàëÿòü è äîáàâëÿòü ip-àäðåñà, e-mail è çàðåçåðâèðîâàííûå èìåíà â ôèëüòð äëÿ áëîêèðîâêè.
|
||||
<br /><strong>Âû ìîæåòå èñïîëüçîâàòü «ñèìâîë çâåçäî÷êè» — * , äëÿ ëþáîãî(ûõ) ñèìâîëà(îâ) ip-àäðåñà èëè e-mail. (íàïðèìåð: 127.0.*, *@mail.ru)</strong>";
|
||||
|
||||
|
||||
$this->ipsclass->admin->page_detail = "This section allows you to modify, delete or add IP addresses, email addresses and reserved names to the ban filters.
|
||||
<br /><strong>You can use * as a wildcard in any Username, IP or email filter. (Example: 127.0.*, *@yahoo.com, bannedname*)</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!
|
||||
//-----------------------------------------
|
||||
|
||||
$add_form = "<div align='center'><form method='post' action='{$this->ipsclass->base_url}&{$this->ipsclass->form_code}&code=ban_add'><input type='hidden' name='_admin_auth_key' value='{$this->ipsclass->_admin_auth_key}' /><input type='text' size='30' class='textinput' value='' name='bantext' />
|
||||
<select class='dropdown' name='bantype'><option value='ip'>IP Address</option><option value='email'>Email Address</option><option value='name'>Name</option></select>
|
||||
<input type='submit' value='Add New Filter' class='realdarkbutton' /></form></div>
|
||||
<form method='post' action='{$this->ipsclass->base_url}&{$this->ipsclass->form_code}&code=ban_delete'><input type='hidden' name='_admin_auth_key' value='{$this->ipsclass->_admin_auth_key}' />";
|
||||
|
||||
$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->adskin->td_header[] = array( "{none}" , "1%" );
|
||||
$this->ipsclass->adskin->td_header[] = array( "{none}" , "80%" );
|
||||
$this->ipsclass->adskin->td_header[] = array( "{none}" , "20%" );
|
||||
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Óïðàâëåíèå ôèëüòðàìè áëîêèðîâêè" );
|
||||
|
||||
|
||||
$this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Ban Control" );
|
||||
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_basic( $add_form, "center", "tablesubheader");
|
||||
//-----------------------------------------
|
||||
// Banned IP Addresses
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_basic("Çàáëîêèðîâàííûå ip-àäðåñà", "left", "tablesubheader");
|
||||
|
||||
|
||||
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_basic("Banned IP Addresses", "left", "tablesubheader");
|
||||
|
||||
if ( isset($ban['ip']) AND is_array( $ban['ip'] ) AND count( $ban['ip'] ) )
|
||||
{
|
||||
foreach ( $ban['ip'] as $entry )
|
||||
@@ -285,15 +277,15 @@ class ad_banandbadword {
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_basic("Çàáëîêèðîâàííûõ IP-àäðåñîâ íåò", "left", "tablerow1");
|
||||
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_basic("No Entered Banned IP Addresses", "left", "tablerow1");
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// Banned Email Addresses
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_basic("Çàáëîêèðîâàííûå e-mail àäðåñà", "left", "tablesubheader");
|
||||
|
||||
|
||||
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_basic("Banned Email Addresses", "left", "tablesubheader");
|
||||
|
||||
if ( isset($ban['email']) AND is_array( $ban['email'] ) AND count( $ban['email'] ) )
|
||||
{
|
||||
foreach ( $ban['email'] as $entry )
|
||||
@@ -306,15 +298,15 @@ class ad_banandbadword {
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_basic("Çàáëîêèðîâàííûõ e-mail àäðåñîâ íåò", "left", "tablerow1");
|
||||
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_basic("No Entered Banned Email Addresses", "left", "tablerow1");
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// Banned Names
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_basic("Çàïðåùåííûå ê ðåãèñòðàöèè èìåíà ïîëüçîâàòåëåé", "left", "tablesubheader");
|
||||
|
||||
|
||||
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_basic("Non-Registerable Names", "left", "tablesubheader");
|
||||
|
||||
if ( isset($ban['name']) AND is_array( $ban['name'] ) AND count( $ban['name'] ) )
|
||||
{
|
||||
foreach ( $ban['name'] as $entry )
|
||||
@@ -327,422 +319,399 @@ class ad_banandbadword {
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_basic("Çàïðåùåííûõ ê ðåãèñòðàöèè èìåí ïîëüçîâàòåëåé íåò", "left", "tablerow1");
|
||||
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_basic("No Entered Names", "left", "tablerow1");
|
||||
}
|
||||
|
||||
|
||||
$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='hidden' name='_admin_auth_key' value='{$this->ipsclass->_admin_auth_key}' /><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'>Èìÿ</option></select>
|
||||
<input type='submit' value='Äîáàâèòü íîâûé ôèëüòð' class='realdarkbutton' /></form></div>";
|
||||
|
||||
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_basic( $end_it_now, "center", "tablesubheader");
|
||||
|
||||
<input type='submit' value='Delete Selected' class='realdarkbutton' />
|
||||
</div></form>";
|
||||
|
||||
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_basic( $end_it_now, "center", "tablesubheader");
|
||||
|
||||
$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->ipsclass->main_msg = "Upload failed, ipb_badwords.xml was either missing or empty";
|
||||
$this->badword_start();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// Get xml mah-do-dah
|
||||
//-----------------------------------------
|
||||
|
||||
|
||||
require_once( KERNEL_PATH.'class_xml.php' );
|
||||
|
||||
$xml = new class_xml();
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// Unpack the datafile
|
||||
//-----------------------------------------
|
||||
|
||||
$xml->lite_parser = 1;
|
||||
|
||||
$xml->xml_parse_document( $content );
|
||||
|
||||
|
||||
if( !is_array($xml->xml_array['badwordexport']['badwordgroup']['badword']) OR !count($xml->xml_array['badwordexport']['badwordgroup']['badword']) )
|
||||
{
|
||||
$this->ipsclass->main_msg = "Èìïîðòèðîâàíèå çàïèñåé íå âûïîëíåíî, òàê êàê ôàéë «ipb_badwords.xml» ñîäåðæèò îøèáêó ëèáî îí ïóñò";
|
||||
$this->ipsclass->main_msg = "XML Import failed: ipb_badwords.xml is either empty or in the wrong format";
|
||||
$this->badword_start();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// 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 $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 = "Èìïîðòèðîâàíèå çàïèñåé óñïåøíî âûïîëíåíî";
|
||||
|
||||
|
||||
$this->ipsclass->main_msg = "Badword XML file import completed";
|
||||
|
||||
$this->badword_start();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// BADWORD: Export
|
||||
//-----------------------------------------
|
||||
|
||||
|
||||
function badword_export()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Get xml mah-do-dah
|
||||
//-----------------------------------------
|
||||
|
||||
|
||||
require_once( 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()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
|
||||
$badword_html = "";
|
||||
|
||||
$this->ipsclass->admin->page_detail = " ýòîé ñåêöèè âû ìîæåòå äîáàâëÿòü, èçìåíÿòü è óäàëÿòü ôèëüòðû íåöåíçóðíûõ ñëîâ.<br />Ôèëüòð íåöåíçóðíûõ ñëîâ ïîçâîëÿåò âàì çàìåíÿòü íåöåíçóðíûå ñëîâà â ñîîáùåíèÿõ ïîëüçîâàòåëåé, â ïîäïèñÿõ è â íàçâàíèÿõ òåì.<br /><br /><b>Ñîâïàäåíèå ïî ìàñêå</b>: ïðè âûáîðå ñïîñîáà «Ìàñêà», ââåäåííîå âàìè ñëîâî áóäåò èçìåíÿòüñÿ äàæå â ñëîâàõ, ñîäåðæàùèõ â ñåáå ýòî ñëîâî. Íàïðèìåð, åñëè âû ââåäåòå â ôèëüòð ñëîâî «êîçà», òî ýòî ñëîâî áóäåò èçìåíåíî íà óêàçàííûé âàìè çàìåíèòåëü è â ñëîâå «ñòðåêîçà». Åñëè âû íå ââåäåòå çàìåíèòåëü, òî íåöåíçóðíîå ñëîâî áóäåò èçìåíåíî íà øåñòü ñèìâîëîâ «ðåøåòêè» — #<br /><br /><b>Òî÷íîå ñîâïàäåíèå:</b> Ïðè âûáîðå ñïîñîáà «Òî÷íûé», ââåäåííîå âàìè ñëîâî áóäåò èçìåíÿòüñÿ íà çàìåíèòåëü òîëüêî ïðè òî÷íîì ñîâïàäåíèè ýòîãî ñëîâà. Íàïðèìåð, åñëè âû ââåäåòå â ôèëüòð ñëîâî «êîçà», òî ýòî ñëîâî áóäåò èçìåíåíî íà óêàçàííûé âàìè çàìåíèòåëü, òîëüêî â ñëîâå «êîçà». Åñëè âû íå ââåäåòå çàìåíèòåëü, òî íåöåíçóðíîå ñëîâî áóäåò èçìåíåíî íà øåñòü ñèìâîëîâ «ðåøåòêè» — #.<br /><br />Äàííàÿ îïöèÿ íå ÷óâñòâèòåëüíà ê ðåãèñòðó.";
|
||||
$this->ipsclass->admin->page_title = "Ôèëüòð íåöåíçóðíûõ ñëîâ";
|
||||
$this->ipsclass->admin->nav[] = array( $this->ipsclass->form_code.'&code=badword', 'Ôèëüòð íåöåíçóðíûõ ñëîâ' );
|
||||
|
||||
|
||||
$this->ipsclass->admin->page_detail = "You can add/edit and remove bad word filters in this section.<br>The badword filter allows you to globally replace words from a members post, signature and topic title.<br><br><b>Loose matching</b>: If you entered 'hell' as a bad word, it will replace 'hell' and 'hello' with either your replacement if entered or 6 hashes (case insensitive)<br><br><b>Exact matching</b>: If you entered 'hell' as a bad word, it will replace 'hell' only with either your replacement if entered or 6 hashes (case insensitive)";
|
||||
$this->ipsclass->admin->page_title = "Bad Word Filter";
|
||||
$this->ipsclass->admin->nav[] = array( $this->ipsclass->form_code.'&code=badword', 'Bad Word Filters' );
|
||||
|
||||
//-----------------------------------------
|
||||
// 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->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;
|
||||
}
|
||||
|
||||
|
||||
foreach($words as $r)
|
||||
{
|
||||
$r['replace'] = $r['swop'] ? stripslashes($r['swop']) : '######';
|
||||
$r['method'] = $r['m_exact'] ? 'Òî÷íûé' : 'Ìàñêà';
|
||||
$r['method'] = $r['m_exact'] ? 'Exact' : 'Loose';
|
||||
$r['type'] = stripslashes($r['type']);
|
||||
|
||||
|
||||
$badword_html .= $this->html->badword_row( $r );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
$this->ipsclass->html .= $this->html->badword_wrapper( $badword_html );
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// 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->start_table( "Import a Badword List" );
|
||||
|
||||
$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>",
|
||||
"<b>Upload XML Badword List</b><div style='color:gray'>Browse your computer for 'ipb_badwords.xml' or 'ipb_badwords.xml.gz'. Duplicate entries will not be imported.</div>",
|
||||
$this->ipsclass->adskin->form_upload( )
|
||||
) );
|
||||
|
||||
$this->ipsclass->html .= $this->ipsclass->adskin->end_form("Èìïîðòèðîâàòü");
|
||||
|
||||
|
||||
$this->ipsclass->html .= $this->ipsclass->adskin->end_form("Import");
|
||||
|
||||
$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("Âû íå óêàçàëè çàìåíÿåìîå ñëîâî.");
|
||||
$this->ipsclass->admin->error("You must enter a word to replace, silly!");
|
||||
}
|
||||
|
||||
|
||||
if ($this->ipsclass->input['id'] == "")
|
||||
{
|
||||
$this->ipsclass->admin->error("Âû íå óêàçàëè 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' => trim($this->ipsclass->input['before']),
|
||||
'swop' => trim($this->ipsclass->input['after']),
|
||||
'm_exact' => $this->ipsclass->input['match'],
|
||||
), "wid='".$this->ipsclass->input['id']."'" );
|
||||
|
||||
|
||||
$this->badword_rebuildcache();
|
||||
|
||||
$this->ipsclass->main_msg = "Ôèëüòð èçìåíåí";
|
||||
|
||||
|
||||
$this->ipsclass->main_msg = "Filter edited";
|
||||
|
||||
$this->badword_start();
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// BADWORD: Edit
|
||||
//-----------------------------------------
|
||||
|
||||
|
||||
function badword_edit()
|
||||
{
|
||||
$this->ipsclass->admin->page_detail = "Âû ìîæåòå èçìåíèòü âûáðàííûé ôèëüòð â ôîðìå íèæå";
|
||||
$this->ipsclass->admin->page_title = "Ôèëüòð íåöåíçóðíûõ ñëîâ";
|
||||
$this->ipsclass->admin->nav[] = array( $this->ipsclass->form_code.'&code=badword', 'Ôèëüòð íåöåíçóðíûõ ñëîâ' );
|
||||
$this->ipsclass->admin->nav[] = array( '', 'Èçìåíåíèå ôèëüòðà íåöåíçóðíûõ ñëîâ' );
|
||||
|
||||
$this->ipsclass->admin->page_detail = "You may edit the chosen filter below";
|
||||
$this->ipsclass->admin->page_title = "Bad Word Filter";
|
||||
$this->ipsclass->admin->nav[] = array( $this->ipsclass->form_code.'&code=badword', 'Bad Word Filters' );
|
||||
$this->ipsclass->admin->nav[] = array( '', 'Edit Bad Word Filter' );
|
||||
|
||||
//-----------------------------------------
|
||||
|
||||
|
||||
if ($this->ipsclass->input['id'] == "")
|
||||
{
|
||||
$this->ipsclass->admin->error("Âû íå óêàçàëè ID ôèëüòðà.");
|
||||
$this->ipsclass->admin->error("You must pass a valid filter id, silly!");
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
|
||||
|
||||
$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->admin->error("We could not find that filter in the database");
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
|
||||
|
||||
$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->adskin->td_header[] = array( "Before" , "40%" );
|
||||
$this->ipsclass->adskin->td_header[] = array( "After" , "40%" );
|
||||
$this->ipsclass->adskin->td_header[] = array( "Method" , "20%" );
|
||||
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Ðåäàêòèðîâàíèå ôèëüòðà" );
|
||||
|
||||
|
||||
$this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Edit a filter" );
|
||||
|
||||
$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->adskin->form_dropdown( 'match', array( 0 => array( 1, 'Exact' ), 1 => array( 0, 'Loose' ) ), $r['m_exact'] )
|
||||
) );
|
||||
|
||||
$this->ipsclass->html .= $this->ipsclass->adskin->end_form('Èçìåíèòü');
|
||||
|
||||
|
||||
$this->ipsclass->html .= $this->ipsclass->adskin->end_form('Edit Filter');
|
||||
|
||||
$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("Âû íå óêàçàëè 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->ipsclass->main_msg = "Filter removed";
|
||||
|
||||
$this->badword_start();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// BADWORD: Add badword
|
||||
//-----------------------------------------
|
||||
|
||||
|
||||
function badword_add()
|
||||
{
|
||||
if ($this->ipsclass->input['before'] == "")
|
||||
{
|
||||
$this->ipsclass->admin->error("Âû íå óêàçàëè ñëîâî äëÿ çàìåíû.");
|
||||
$this->ipsclass->admin->error("You must enter a word to replace, 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_insert( 'badwords', array( 'type' => trim($this->ipsclass->input['before']),
|
||||
'swop' => trim($this->ipsclass->input['after']),
|
||||
'm_exact' => $this->ipsclass->input['match'],
|
||||
) );
|
||||
|
||||
|
||||
$this->badword_rebuildcache();
|
||||
|
||||
$this->ipsclass->main_msg = "Ôèëüòð óñïåøíî äîáàâëåí.";
|
||||
|
||||
|
||||
$this->ipsclass->main_msg = "New filter added";
|
||||
|
||||
$this->badword_start();
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// BADWORD Rebuild Cache
|
||||
//-----------------------------------------
|
||||
|
||||
|
||||
function badword_rebuildcache()
|
||||
{
|
||||
require_once ROOT_PATH.'sources/classes/bbcode/class_bbcode_core.php';
|
||||
|
||||
$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;
|
||||
}
|
||||
|
||||
|
||||
usort( $this->ipsclass->cache['emoticons'] , array( 'class_bbcode_core', 'word_length_sort' ) );
|
||||
|
||||
$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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user