Version 2.1.7

This commit is contained in:
Neo committed 2025-12-19 00:21:15 -08:00
1 parent 0eecc172d9
commit f73f8bff6d
941 files changed
+215301 -103093

No files matched your search

-165
View File
@@ -1,165 +0,0 @@
<?php
/*
+--------------------------------------------------------------------------
| Invision Power Board v2.0.0
| =============================================
| by Matthew Mecham
| (c) 2001 - 2004 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| Time: Tue, 21 Sep 2004 16:34:28 GMT
| Release: 150aa7a702c3c8b6f6eb90ad49305d2f
| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
|
| > Add POLL module
| > Module written by Matt Mecham
| > DBA Checked: Fri 21 May 2004
|
+--------------------------------------------------------------------------
|
| QUOTE OF THE MODULE: (Taken from BtVS)
| --------------------
| Drusilla: I'm naming all the stars...
| Spike: You can't see the stars love, That's the ceiling. Also, it's day.
|
+--------------------------------------------------------------------------
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class poll {
var $topic = array();
var $poll = array();
var $upload = array();
var $poll_count = 0;
var $poll_choices = "";
function auto_run() {
global $ibforums, $std, $DB, $print;
$ibforums->lang = $std->load_words($ibforums->lang, 'lang_post', $ibforums->lang_id);
// Lets do some tests to make sure that we are allowed to start a new topic
if (! $ibforums->member['g_vote_polls'])
{
$std->Error( array( LEVEL => 1, MSG => 'no_reply_polls') );
}
// Did we choose a choice?
if (!$ibforums->input['nullvote'])
{
if (! isset($ibforums->input['poll_vote']) )
{
$std->Error( array( LEVEL => 1, MSG => 'no_vote') );
}
}
// Make sure we have a valid poll id
$ibforums->input['t'] = intval($ibforums->input['t']);
if (! $ibforums->input['t'] )
{
$std->Error( array( LEVEL => 1, MSG => 'missing_files') );
}
// Load the topic and poll
$DB->cache_add_query( 'poll_get_poll_with_topic', array( 'tid' => $ibforums->input['t'] ) );
$DB->cache_exec_query();
$this->topic = $DB->fetch_row();
if (! $this->topic['tid'] )
{
$std->Error( array( LEVEL => 1, MSG => 'poll_none_found') );
}
if ($this->topic['state'] != 'open')
{
$std->Error( array( LEVEL => 1, MSG => 'locked_topic') );
}
// Have we voted before?
$DB->simple_construct( array( 'select' => 'member_id', 'from' => 'voters', 'where' => "tid={$this->topic['tid']} and member_id=".$ibforums->member['id'] ) );
$DB->simple_exec();
if ( $DB->get_num_rows() )
{
$std->Error( array( LEVEL => 1, MSG => 'poll_you_voted') );
}
// If we're here, lets add the vote
$DB->do_insert( 'voters', array( 'member_id' => $ibforums->member['id'],
'ip_address' => $ibforums->input['IP_ADDRESS'],
'tid' => $this->topic['tid'],
'forum_id' => $this->topic['forum_id'],
'vote_date' => time(),
) );
// If this isn't a null vote...
if ( ! $ibforums->input['nullvote'] )
{
$poll_answers = unserialize(stripslashes($this->topic['choices']));
reset($poll_answers);
$new_poll_array = array();
foreach ($poll_answers as $entry)
{
$id = $entry[0];
$choice = $entry[1];
$votes = $entry[2];
if ($id == $ibforums->input['poll_vote'])
{
$votes++;
}
$new_poll_array[] = array( $id, $choice, $votes);
}
$this->topic['choices'] = addslashes(serialize($new_poll_array));
$DB->simple_exec_query( array( 'update' => 'polls',
'set' => "votes=votes+1,choices='{$this->topic['choices']}'",
'where' => "pid={$this->topic['poll_id']}" ) );
if ($this->topic['allow_pollbump'])
{
$this->topic['last_vote'] = time();
$this->topic['last_post'] = time();
$DB->do_update( 'topics', array( 'last_vote' => $this->topic['last_vote'], 'last_post' => $this->topic['last_post'] ), 'tid='.$this->topic['tid'] );
}
else
{
$this->topic['last_vote'] = time();
$DB->do_update( 'topics', array( 'last_vote' => $this->topic['last_vote'], 'last_post' => $this->topic['last_post'] ), 'tid='.$this->topic['tid'] );
}
}
$lang = $ibforums->input['nullvote'] ? $ibforums->lang['poll_viewing_results'] : $ibforums->lang['poll_vote_added'];
$print->redirect_screen( $lang , "act=ST&f={$this->topic['forum_id']}&t={$this->topic['tid']}&st={$ibforums->input['st']}" );
}
}
?>
@@ -0,0 +1,965 @@
<?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-14 18:52:45 +0100 (Fri, 14 Oct 2005) $
| > $Revision: 50 $
| > $Author: matt $
+---------------------------------------------------------------------------
|
| > Admin Cache functions library
| > Script written by Matt Mecham
| > Date started: 20th January 2004
|
| > DBA Checked: Tue 25th May 2004
+--------------------------------------------------------------------------
*/
class admin_cache_functions
{
var $master_set = 1;
var $messages = array();
var $no_rebuild = 0;
var $template = "";
//-----------------------------------------
// Constructor
//-----------------------------------------
function admin_cache_functions()
{
//-----------------------------------------
// Get the libraries
//-----------------------------------------
require_once( KERNEL_PATH.'class_template.php' );
$this->template = new class_template();
$this->template->root_path = CACHE_PATH;
}
//============================================================================================================
// WRAPPER FUNCTIONS
//============================================================================================================
//-----------------------------------------
// WRAPPER: Update internal cache
//-----------------------------------------
function _recache_wrapper($id, $parent="", $root='1')
{
//-----------------------------------------
// Get wrapper from tree
//-----------------------------------------
$parent_in = $parent ? ','.$parent : '';
$this->ipsclass->DB->cache_add_query( 'cache_wrapper', array( 'id' => $id, 'parent_in' => $parent_in, 'root' => $root ) );
$this->ipsclass->DB->cache_exec_query();
$this_set = $this->ipsclass->DB->fetch_row();
$wrapper = $this_set['set_wrapper'];
//-----------------------------------------
// Get children details
//-----------------------------------------
$ids = array( 0 => array( 'set_skin_set_id' => $id ) );
if ( $id == 1 and IN_DEV )
{
$id = -1;
}
$this->ipsclass->DB->cache_add_query( 'cache_empty_wrapper', array( 'parent_id' => $id ) );
$this->ipsclass->DB->cache_exec_query();
while ( $r = $this->ipsclass->DB->fetch_row() )
{
$ids[] = $r;
}
if ( $id == -1 and IN_DEV )
{
$id = 1;
}
//-----------------------------------------
// Update this and child db
// caches
//-----------------------------------------
$theids = array();
foreach( $ids as $i => $d )
{
$theids[] = $d['set_skin_set_id'];
}
$this->ipsclass->DB->do_update( 'skin_sets', array( 'set_cache_wrapper' => $wrapper ), 'set_skin_set_id IN ('.implode(',',$theids).') AND set_skin_set_id != 1' );
$this->messages[] = "Îáíîâëåíèå îôîðìëåíèÿ âûïîëíåíî... (id: ".implode(',',$theids).")";
}
//============================================================================================================
// TEMPLATE FUNCTIONS
//============================================================================================================
//-----------------------------------------
// TEMPLATE: Recache and splash
//-----------------------------------------
function _recache_templates( $id, $parent="", $group_only="", $root=1 )
{
$ids = array( 0 => array( 'id' => $id, 'parent' => $parent ) );
//-----------------------------------------
// Get any children
//-----------------------------------------
if ( $id == 1 and IN_DEV )
{
$id = -1;
}
$this->ipsclass->DB->simple_construct( array( 'select' => 'set_skin_set_id, set_skin_set_parent', 'from' => 'skin_sets', 'where' => "set_skin_set_parent=$id" ) );
$this->ipsclass->DB->simple_exec();
while ( $r = $this->ipsclass->DB->fetch_row() )
{
$ids[] = array( 'id' => $r['set_skin_set_id'], 'parent' => $r['set_skin_set_parent'] );
}
if ( $id == -1 and IN_DEV )
{
$id = 1;
}
//-----------------------------------------
// SPIN TO WIN!
//-----------------------------------------
foreach ( $ids as $i => $tid )
{
$id = $tid['id'];
$parent = $tid['parent'];
//-----------------------------------------
// Get template set titles
//-----------------------------------------
$group_titles = $this->_get_templates( $id, $parent, 'groups' );
foreach ( $group_titles as $name => $group )
{
//-----------------------------------------
// Skip if we're only updating
// one group..
//-----------------------------------------
if ( $group_only != '' )
{
if ( $group_only != $group['group_name'] )
{
continue;
}
}
$this_set_list = array();
$out = "class {$group['group_name']}_{$id} {\n\n";
$out .= ' var $ipsclass;'."\n";
//$out .= 'function '. $group['group_name'] .'( $ipsclass )'."\n{\n".'$this->ipsclass = &$ipsclass;'."\n}\n\n";
$templates = $this->_get_templates( $id, $parent, 'groups', $group['group_name'] );
foreach ($templates as $func_name => $data )
{
$out .= $this->template->convert_html_to_php( $data['func_name'], $data['func_data'], $data['section_content'] ) ."\n";
if ( $data['set_id'] == $id )
{
$this_set_list[] = $data['func_name'];
}
}
$out .= "\n\n}";
//-----------------------------------------
// Write to the DB...
//-----------------------------------------
$this->ipsclass->DB->simple_exec_query( array( 'delete' => 'skin_templates_cache', 'where' => "template_group_name='{$group['group_name']}' and template_set_id={$id}" ) );
$this->ipsclass->DB->do_insert( 'skin_templates_cache', array(
'template_id' => md5(uniqid(rand(), true)),
'template_group_name' => $group['group_name'],
'template_group_content' => $out,
'template_set_id' => $id,
) );
//-----------------------------------------
// Write to the flatfile
//-----------------------------------------
$start = '<'.'?'."php\n";
$start .= "/*--------------------------------------------------*/\n";
$start .= "/* FILE GENERATED BY INVISION POWER BOARD */\n";
$start .= "/* CACHE FILE: Skin set id: {$id} */\n";
$start .= "/* CACHE FILE: Generated: ".gmdate( "D, d M Y H:i:s \G\M\T" )." */\n";
$start .= "/* DO NOT EDIT DIRECTLY - THE CHANGES WILL NOT BE */\n";
$start .= "/* WRITTEN TO THE DATABASE AUTOMATICALLY */\n";
$start .= "/*--------------------------------------------------*/\n\n";
$end = "\n\n/*--------------------------------------------------*/\n";
$end .= "/*<changed bits>\n".implode(',',$this_set_list)."\n</changed bits>*/\n";
$end .= "/* END OF FILE */\n";
$end .= "/*--------------------------------------------------*/\n";
$end .= "\n?".">";
$this->_write_template_to_file( $id, $group['group_name'], $start.$out.$end );
}
$this->messages[] = "HTML øàáëîíû óñïåøíî îáíîâëåíû... (id: $id)";
}
}
//-----------------------------------------
// TEMPLATE: write flat-file
//-----------------------------------------
function _write_template_to_file($id, $group_name, $content)
{
//-----------------------------------------
// Check..
//-----------------------------------------
if ( $id == 1 AND ! IN_DEV)
{
return 0;
}
$return = 0;
$good_to_go = 0;
if ( ! SAFE_MODE_ON )
{
$good_to_go = 1;
if ( is_writeable( CACHE_PATH.'cache/skin_cache' ) )
{
$good_to_go = 1;
if ( ! is_dir( CACHE_PATH.'cache/skin_cache/cacheid_'.$id ) )
{
if ( ! @ mkdir( CACHE_PATH.'cache/skin_cache/cacheid_'.$id, 0777 ) )
{
$good_to_go = 0;
}
else
{
@chmod( CACHE_PATH.'cache/skin_cache/cacheid_'.$id, 0777 );
$good_to_go = 1;
}
}
else
{
if ( file_exists( CACHE_PATH.'cache/skin_cache/cacheid_'.$id.'/'.$group_name.'.php' ) )
{
if ( ! is_writeable( CACHE_PATH.'cache/skin_cache/cacheid_'.$id.'/'.$group_name.'.php' ) )
{
$this->messages[] = "::cache_id_{$id}/{$group_name}.php not writeable - cannot cache to PHP files";
$good_to_go = 0;
}
else
{
$good_to_go = 1;
}
}
else
{
$good_to_go = 1;
}
}
}
else
{
$this->messages[] = "::cache_id_{$id} íå çàïèñàí - íåâîçìîæíî ñîçäàâàòü òàì php ôàéëû";
}
}
//-----------------------------------------
// Write...
//-----------------------------------------
if ( $good_to_go )
{
if ( $FH = @fopen( CACHE_PATH.'cache/skin_cache/cacheid_'.$id.'/'.$group_name.'.php', 'w' ) )
{
fwrite( $FH, $content, strlen($content) );
fclose( $FH );
@chmod( CACHE_PATH.'cache/skin_cache/cacheid_'.$id.'/'.$group_name.'.php', 0777 );
$return = 1;
$this->messages[] = "/skin_cache/cacheid_{$id}/{$group_name}.php óñïåøíî çàïèñàí";
}
}
return $return;
}
//-----------------------------------------
// TEMPLATE: Return templates from tree
//-----------------------------------------
function _get_templates($id, $parent, $type='all', $group='', $root=1)
{
$templates = array();
$parent_in = $parent > 0 ? ','.$parent : '';
$return = 'all';
if ( $type == 'groups' and $group == '' )
{
//-----------------------------------------
// Just return group titles
//-----------------------------------------
$this->ipsclass->DB->cache_add_query( 'cache_templates_titles', array( 'id' => $id, 'parent_in' => $parent_in, 'root' => $root ) );
$newq = $this->ipsclass->DB->cache_exec_query();
$return = 'titles';
}
else if ( $type == 'groups' and $group != '' )
{
//-----------------------------------------
// Return group template bits
//-----------------------------------------
$this->ipsclass->DB->cache_add_query( 'cache_templates_bits', array( 'id' => $id, 'parent_in' => $parent_in, 'root' => $root, 'group' => $group ) );
$newq = $this->ipsclass->DB->cache_exec_query();
$return = 'group';
}
else
{
//-----------------------------------------
// Return all...
//-----------------------------------------
$this->ipsclass->DB->cache_add_query( 'cache_templates_all', array( 'id' => $id, 'parent_in' => $parent_in, 'root' => $root ) );
$newq = $this->ipsclass->DB->cache_exec_query();
}
//-----------------------------------------
// Get all results
//-----------------------------------------
while ( $r = $this->ipsclass->DB->fetch_row($newq) )
{
if ( $return == 'titles' )
{
$templates[ $r['group_name'] ] = $r;
$this->template_count[ $r['set_id'] ][ $r['group_name'] ]['count']++;
}
else if ( $return == 'group' )
{
$templates[ strtolower($r['func_name']) ] = $r;
}
else
{
$templates[ $r['group_name'] ][ strtolower($r['func_name']) ] = $r;
}
}
ksort($templates);
return $templates;
}
//-----------------------------------------
// TEMPLATE: Rebuild templates from PHP files
//-----------------------------------------
function _rebuild_templates_from_php($id)
{
$insert = 1;
$script_token = 0;
$script_jump = 0;
//-----------------------------------------
// Rebuilds the data editable files from the PHP source files
//-----------------------------------------
$this->template->cache_id = $id;
$skin_dir = CACHE_PATH."cache/skin_cache/cacheid_".$id;
$errors = array();
$flag = 0;
//-----------------------------------------
// Is this a safe mode only skinny poos?
//-----------------------------------------
if ( ! file_exists( $skin_dir ) )
{
$this->messages[] = "Ýòîò ñòèëü óñòàíîâëåí â áåçîïàñíîì ðåæèìå (safe mode) è php ôàéëû êåøà îòñóòñòâóþò, ñîîòâåòñòâåíî íåò íåîáõîäèìîñòè çàïóñêàòü ýòó óòèëèòó äëÿ ýòîãî ñòèëÿ.";
return 0;
}
if ( ! is_readable($skin_dir) )
{
$this->messages[] = "ÎØÈÁÊÀ: Íåâîçìîæíà çàïèñü â ïàïêó /$skin_dir/, ïîæàëóéñòà, ïðîâåðüòå ïðàâà äîñòóïà (CHMOD) &#151; îíè äîëæíû áûòü 0777!";
return 0;
}
if ( is_dir($skin_dir) )
{
if ( $handle = opendir($skin_dir) )
{
while (($filename = readdir($handle)) !== false)
{
if (($filename != ".") && ($filename != ".."))
{
if ( preg_match( "/\.php$/", $filename ) )
{
$name = preg_replace( "/^(\S+)\.(\S+)$/", "\\1", $filename );
# Ignore bugtracker
if ( $name == 'skin_bugtracker' )
{
$this->messages[] = "Ïðîïóùåí skin_bugtracker.php...";
continue;
}
if ($FH = fopen($skin_dir."/".$filename, 'r') )
{
$fdata = fread( $FH, filesize($skin_dir."/".$filename) );
fclose($FH);
}
else
{
$this->messages[] = "Íåâîçìîæíî îòêðûòü äëÿ ÷òåíèÿ ôàéë $filename, ýòîò ôàéë ïðîïóùåí...";
continue;
}
$fdata = str_replace( "\r", "\n", $fdata );
$fdata = str_replace( "\n\n", "\n", $fdata );
if ( ! preg_match( "/\n/", $fdata ) )
{
$this->messages[] = "Ôàéë $filename ïóñòîé, ýòîò ôàéë ïðîïóùåí...";
continue;
}
$farray = explode( "\n", $fdata );
//-----------------------------------------
$functions = array();
foreach($farray as $f)
{
//-----------------------------------------
// Skip javascript functions...
//-----------------------------------------
if ( preg_match( "/<script/i", $f ) )
{
$script_token = 1;
$script_jump = 0;
}
if ( preg_match( "/<\/script>/i", $f ) )
{
$script_token = 0;
$script_jump = 0;
}
//-----------------------------------------
// If, in the middle?
//-----------------------------------------
if ( $script_token AND $script_jump == 0 )
{
if ( preg_match( "#//startif#", $f ) )
{
$script_jump = 1;
$script_token = 0;
}
}
if ( $script_token == 0 AND $script_jump == 1 )
{
if ( preg_match( "#//endif#", $f ) )
{
$script_jump = 0;
$script_token = 1;
}
}
//-----------------------------------------
// NOT IN JS
//-----------------------------------------
if ($script_token == 0)
{
if ( preg_match( "/^function\s*([\w\_]+)\s*\((.*)\)/i", $f, $matches ) )
{
$functions[$matches[1]] = '';
$config[$matches[1]] = $matches[2];
$flag = $matches[1];
continue;
}
}
//-----------------------------------------
// ARE IN JS
//-----------------------------------------
else
{
// Make JS safe (UBE - Ugly, but effective)
$f = preg_replace( "#if\s+?\(#is" , "i~f~(~" , $f );
$f = preg_replace( "#else#is" , "e~lse~" , $f );
$f = preg_replace( "#else\s+?if#is", "e~lse~i~f", $f );
}
if ($flag)
{
$functions[$flag] .= $f."\n";
continue;
}
}
//-----------------------------------------
// Remove current templates for this set...
//-----------------------------------------
$this->ipsclass->DB->simple_exec_query( array( 'delete' => 'skin_templates', 'where' => "set_id='".$id."' AND group_name='$name'" ) );
$final = "";
$flag = 0;
foreach($functions as $fname => $ftext)
{
preg_match( "#//--starthtml--//(.+?)//--endhtml--//#s", $ftext, $matches );
$content = str_replace( '\\n' , '\\\\\\n', $this->template->convert_php_to_html($matches[1]) );
//-----------------------------------------
// Unconvert JS
//-----------------------------------------
$content = str_replace( "i~f~(~" , "if (" , $content );
$content = str_replace( "e~lse~" , "else" , $content );
$content = str_replace( "e~lse~i~f", "else if", $content );
$this->ipsclass->DB->do_insert( 'skin_templates', array (
'set_id' => $id,
'group_name' => $name,
'section_content' => $content,
'func_name' => $fname,
'func_data' => trim($config[$fname]),
'updated' => time(),
) );
}
$functions = array();
//-----------------------------------------
} // if *.php
} // if not dir
} // while loop
closedir($handle);
}
else
{
$this->messages[] = "Íåâîçìîæíî îòêðûòü äëÿ ÷òåíèÿ ïàïêó /$skin_dir/.";
return 0;
}
}
else
{
$this->messages[] = "Íåò ïàïêè $skin_dir &#151; ïîæàëóéñòà, ïðîâåðüòå ïåðåìåííóþ \$root_path â ôàéëå admin.php.";
return 0;
}
$this->messages[] = "Îáíîâëåíèå php ôàéëîâ êåøà óñïåøíî çàâåðøåíî.";
return 1;
}
//============================================================================================================
// CSS FUNCTIONS
//============================================================================================================
//-----------------------------------------
// CSS: Write file to cache
//-----------------------------------------
function _write_css_to_cache($id, $parent="", $root='1')
{
//-----------------------------------------
// Get css from tree
//-----------------------------------------
$parent_in = $parent ? ','.$parent : '';
$this->ipsclass->DB->cache_add_query( 'cache_templates_css', array( 'id' => $id, 'parent_in' => $parent_in, 'root' => $root ) );
$this->ipsclass->DB->cache_exec_query();
$this_set = $this->ipsclass->DB->fetch_row();
$css = $this_set['set_css'];
$this->ipsclass->DB->simple_construct( array( 'select' => 'set_image_dir', 'from' => 'skin_sets', 'where' => "set_skin_set_id=$id" ) );
$this->ipsclass->DB->simple_exec();
$real_set = $this->ipsclass->DB->fetch_row();
//-----------------------------------------
// Get children details
//-----------------------------------------
$ids = array( $id => array( 'set_skin_set_id' => $id, 'set_image_dir' => $this_set['set_image_dir'] ) );
$set_ids = array( 0 => $id );
if ( $id == 1 and IN_DEV )
{
$id = -1;
}
$this->ipsclass->DB->cache_add_query( 'cache_empty_css', array ( 'parent_id' => $id ) );
$this->ipsclass->DB->cache_exec_query();
if ( $id == -1 and IN_DEV )
{
$id = 1;
}
while ( $r = $this->ipsclass->DB->fetch_row() )
{
$ids[ $r['set_skin_set_id'] ] = $r;
$set_ids[] = $r['set_skin_set_id'];
}
//-----------------------------------------
// Update this and child db
// caches
//-----------------------------------------
if ( count($set_ids) )
{
$this->ipsclass->DB->simple_construct( array( 'select' => 'set_image_dir, set_skin_set_id', 'from' => 'skin_sets', 'where' => 'set_skin_set_id IN('. implode(",",$set_ids) .')' ) );
$this->ipsclass->DB->simple_exec();
while ( $newid = $this->ipsclass->DB->fetch_row() )
{
$ids[ $newid['set_skin_set_id'] ]['set_image_dir'] = $newid['set_image_dir'];
}
}
//-----------------------------------------
// Make sure inline sheets
// have the proper style_images folder
//-----------------------------------------
$css = str_replace( "url({$real_set['set_image_dir']}/", "url(style_images/<#IMG_DIR#>/", $css );
$css = str_replace( "url(<#IMG_DIR#>/", "url(style_images/<#IMG_DIR#>/", $css );
$css = preg_replace( "#url\((style_images/)?\d+?/#i", "url(style_images/<#IMG_DIR#>/", $css );
if ( $this->ipsclass->vars['ipb_img_url'] )
{
$css = str_replace( "url(style_images/", "url({$this->ipsclass->vars['ipb_img_url']}style_images/", $css );
}
$this->ipsclass->DB->do_update( 'skin_sets', array( 'set_cache_css' => $css ), 'set_skin_set_id IN ('.implode(',',$set_ids).') AND set_skin_set_id != 1' );
//-----------------------------------------
// Update flat-file caches
//-----------------------------------------
$start = "/*------------------------------------------------------------------*/\n";
$start .= "/* FILE GENERATED BY INVISION POWER BOARD */\n";
$start .= "/* DO NOT EDIT BY HAND WITHOUT RESYNCHRONISING BACK TO THE DATABASE */\n";
$start .= "/* OR CHANGES TO THIS FILE WILL BE LOST WHEN NEXT EDITED FROM THE */\n";
$start .= "/* ADMIN CONTROL PANEL */\n";
$start .= "/* STYLE DIRECTORY: <#IMG_DIR#> */\n";
$start .= "/* CACHE FILE: Generated: ".gmdate( "D, d M Y H:i:s \G\M\T" )." */\n";
$start .= "/*------------------------------------------------------------------*/\n\n";
$start .= "/*~START CSS~*/\n\n";
$css = $this->ipsclass->txt_windowstounix($start.$css);
if ( file_exists( CACHE_PATH."style_images" ) )
{
if ( is_writeable( CACHE_PATH."style_images" ) )
{
foreach( $ids as $id )
{
@unlink( CACHE_PATH."style_images/css_".$id['set_skin_set_id'].".css" );
//-----------------------------------------
// Fix up relative stuff
//-----------------------------------------
$thiscss = str_replace( '<#IMG_DIR#>', $id['set_image_dir'], $css );
if ( ! $this->ipsclass->vars['ipb_img_url'] )
{
$thiscss = str_replace( 'style_images/', '', $thiscss );
}
//-----------------------------------------
// Write..
//-----------------------------------------
if ( $FH = @fopen( CACHE_PATH."style_images/css_".$id['set_skin_set_id'].".css", 'w' ) )
{
@fputs( $FH, $thiscss, strlen($thiscss) );
@fclose($FH);
@chmod( CACHE_PATH."style_images/css_".$id['set_skin_set_id'].".css", 0777 );
$this->messages[] = "Îáíîâëåíèå ôàéëà êåøà CSS ñòèëåé css_{$id['set_skin_set_id']}...";
}
else
{
$this->messages[] = "<br /><b>Ôàéë ñ êåøåì css_{$id['set_skin_set_id']} íå îáíîâëåí! Ïðîâåðüòå ïðàâà äîñòóïà (CHMOD) ó /style_images/ è /style_images/css_{$id['set_skin_set_id']}.css!</b>";
}
}
}
else
{
$this->messages[] = "<b>Ôàéë(û) êåøà íå îáíîâëåí(û). Ïðîâåðüòå ïðàâà äîñòóïà (CHMOD) ó /style_images/ è /style_images/css_{$id['set_skin_set_id']}.css!</b>";
}
}
else
{
$this->messages[] = "<b>Ôàéë(û) êåøà íå îáíîâëåí(û). Ïàïêà /style_images/ íå ñóùåñòâóåò!</b>";
}
}
//============================================================================================================
// MACRO FUNCTIONS
//============================================================================================================
//-----------------------------------------
// MACRO: Recache macros
//-----------------------------------------
function _recache_macros($id, $parent="", $root=1)
{
$ids = array( 0 => array( 'id' => $id, 'parent' => $parent ) );
//-----------------------------------------
// Get any children
//-----------------------------------------
$this->ipsclass->DB->simple_construct( array( 'select' => 'set_skin_set_id, set_skin_set_parent', 'from' => 'skin_sets', 'where' => "set_skin_set_parent=$id" ) );
$this->ipsclass->DB->simple_exec();
while ( $r = $this->ipsclass->DB->fetch_row() )
{
$ids[] = array( 'id' => $r['set_skin_set_id'], 'parent' => $r['set_skin_set_parent'] );
}
$this->ipsclass->DB->manual_addslashes = 1;
foreach( $ids as $i )
{
$macros = $this->_get_macros($i['id'], $i['parent'], $root);
$this->messages[] = "Âûïîëíåíî... (Ìàêðîñ: {$i['id']})...";
$this->ipsclass->DB->do_update( 'skin_sets', array( 'set_cache_macro' => $this->ipsclass->DB->add_slashes(serialize($macros)) ), 'set_skin_set_id='.$i['id'] );
}
$this->ipsclass->DB->manual_addslashes = 0;
}
//-----------------------------------------
// MACRO: Return macros from tree
//-----------------------------------------
function _get_macros($id, $parent, $root=1)
{
$macros = array();
$parent_in = $parent ? ','.$parent : '';
//-----------------------------------------
// Get macros from db, we want to return macros in order
// so that skin specific macros are returned over root
// macros. We use instr( concat() ) to search the parent
// list for the macro set and return the position. The lower
// the pos, the higher up the tree. Use DESC on this 'theorder'
// to return specific macros last so that they overwrite root
// macros.... (thats the theory)
//-----------------------------------------
$this->ipsclass->DB->cache_add_query( 'cache_templates_macros', array( 'id' => $id, 'parent_in' => $parent_in, 'root' => $root ) );
$this->ipsclass->DB->cache_exec_query();
while ( $r = $this->ipsclass->DB->fetch_row() )
{
$macros[ strtolower( $r['macro_value'] ) ] = $r;
}
ksort($macros);
return $macros;
}
//============================================================================================================
// MAIN FUNCTIONS
//============================================================================================================
//-----------------------------------------
// MAIN: Rebuild all caches
//-----------------------------------------
function _rebuild_all_caches( $affected )
{
$this->no_rebuild = 1;
$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'skin_sets', 'order' => 'set_skin_set_parent, set_skin_set_id ASC' ) );
$this->ipsclass->DB->simple_exec();
while ( $r = $this->ipsclass->DB->fetch_row() )
{
$skins[ $r['set_skin_set_id'] ] = $r;
}
//-----------------------------------------
// check all affected ids
//-----------------------------------------
foreach( $affected as $aid )
{
if ( $aid == 1 and ! IN_DEV )
{
continue;
}
//-----------------------------------------
// Custom Macros
//-----------------------------------------
$this->messages[] = "Îáíîâëåíèå ìàêðîñîâ äëÿ {$skins[$aid]['set_name']}...";
$this->_recache_macros($aid, $skins[ $aid ]['set_skin_set_parent']);
//-----------------------------------------
// Custom CSS
//-----------------------------------------
$this->messages[] = "Îáíîâëåíèå CSS-ñòèëåé äëÿ {$skins[$aid]['set_name']}...";
$this->_write_css_to_cache( $aid, $skins[ $aid ]['set_skin_set_parent'] );
//-----------------------------------------
// Custom HTML
//-----------------------------------------
$this->messages[] = "Îáíîâëåíèå êåøà HTML øàáëîíîâ äëÿ {$skins[$aid]['set_name']}...";
$this->_recache_templates( $aid, $skins[ $aid ]['set_skin_set_parent'] );
//-----------------------------------------
// Custom Wrappers
//-----------------------------------------
$this->messages[] = "Îáíîâëåíèå êåøà ãëàâíîãî øàáëîíà ôîðóìà äëÿ {$skins[$aid]['set_name']}...";
$this->_recache_wrapper( $aid, $skins[ $aid ]['set_skin_set_parent'] );
}
$this->messages[] = "Îáíîâëåíèå óñòàíîâîê ID ñòèëÿ...";
$this->_rebuild_skin_id_cache($skins);
return $message;
}
//-----------------------------------------
// MAIN: Rebuild cache entry
//-----------------------------------------
function _rebuild_skin_id_cache($skins=array())
{
$this->ipsclass->cache['skin_id_cache'] = array();
if ( ! count( $skins ) )
{
$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'skin_sets', 'order' => 'set_skin_set_parent, set_skin_set_id ASC' ) );
$this->ipsclass->DB->simple_exec();
while ( $r = $this->ipsclass->DB->fetch_row() )
{
$skins[ $r['set_skin_set_id'] ] = $r;
}
}
foreach( $skins as $row )
{
if ( $row['set_skin_set_parent'] > 1 )
{
$parent = ','.$row['set_skin_set_parent'];
}
$this->ipsclass->cache['skin_id_cache'][ $row['set_skin_set_id'] ] = array( 'set_skin_set_id' => $row['set_skin_set_id'],
'set_tree_list' => $row['set_skin_set_id'].$parent.',1',
'set_hidden' => $row['set_hidden'],
'set_default' => $row['set_default'],
'set_parent' => $row['set_skin_set_parent'],
'set_name' => $row['set_name'],
);
}
$this->ipsclass->update_cache( array( 'name' => 'skin_id_cache', 'array' => 1, 'deletefirst' => 1 ) );
return $this->ipsclass->cache['skin_id_cache'];
}
}
?>
@@ -0,0 +1,529 @@
<?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 $
+---------------------------------------------------------------------------
|
| > Admin forum functions library
| > Script written by Matt Mecham
| > Date started: 19th November 2003
|
| > DBA Checked: Tue 25th May 2004
+--------------------------------------------------------------------------
*/
class admin_forum_functions
{
# Global
var $ipsclass;
# HTML
var $html;
var $type = "";
var $printed = 0;
var $show_all = 0;
var $skins = array();
var $need_desc = array();
/*-------------------------------------------------------------------------*/
// Forum - Build Children (of the CORN!!!)
/*-------------------------------------------------------------------------*/
function forum_build_children($root_id, $temp_html="", $depth_guide="")
{
if ( is_array( $this->ipsclass->forums->forum_cache[ $root_id ] ) )
{
foreach( $this->ipsclass->forums->forum_cache[ $root_id ] as $id => $forum_data )
{
if ( $this->ipsclass->vars['forum_cache_minimum'] )
{
$forum_data['description'] = "<!--DESCRIPTION:{$forum_data['id']}-->";
$this->need_desc[] = $forum_data['id'];
}
$temp_html .= $this->render_forum($forum_data, $depth_guide);
$temp_html = $this->forum_build_children( $forum_data['id'], $temp_html, $depth_guide . $this->ipsclass->forums->depth_guide );
}
}
return $temp_html;
}
/*-------------------------------------------------------------------------*/
// Forum - Render forum entry (NOT of the CORN!!!)
/*-------------------------------------------------------------------------*/
function render_forum($r, $depth_guide="")
{
//-----------------------------------------
// INIT
//-----------------------------------------
$desc = "";
$mod_string = "";
//-----------------------------------------
// Skin
//-----------------------------------------
if ( ! $this->html )
{
$this->html = $this->ipsclass->acp_load_template('cp_skin_forums');
}
//-----------------------------------------
// Manage forums?
//-----------------------------------------
if ( $this->type == 'manage' )
{
//-----------------------------------------
// Show main forums...
//-----------------------------------------
if ( ! $this->show_all )
{
$children = $this->ipsclass->forums->forums_get_children( $r['id'] );
$sub = array();
$subforums = "";
$count = 0;
//-----------------------------------------
// Build sub-forums link
//-----------------------------------------
if ( count($children) )
{
$r['name'] = "<a href='{$this->ipsclass->base_url}&section=content&act=forum&f={$r['id']}'>".$r['name']."</a>";
foreach ( $children as $cid )
{
$count++;
$cfid = $cid;
if ( $count == count($children) )
{
//-----------------------------------------
// Last subforum, link to parent
// forum...
//-----------------------------------------
if ( ! $cfid = $children[ $count - 2 ] )
{
$cfid = $r['id'];
}
}
$sub[] = "<a href='{$this->ipsclass->base_url}&section=content&act=forum&f={$this->ipsclass->forums->forum_by_id[$cid]['parent_id']}'>".$this->ipsclass->forums->forum_by_id[$cid]['name']."</a>";
}
}
if ( count( $sub ) )
{
$subforums = '<fieldset style="margin-top:4px"><legend>Ïîäôîðóìû:</legend>'.implode( ", ", $sub ).'</fieldset>';
}
$desc = "{$r['description']}{$subforums}";
}
//-----------------------------------------
// Moderators
//-----------------------------------------
foreach( $this->moderators as $phpid => $data )
{
if ( $data['forum_id'] == $r['id'] )
{
if ($data['is_group'] == 1)
{
$data['_fullname'] = 'Ãðóïïà: '.$data['group_name'];
}
else
{
$data['_fullname'] = $data['member_name'];
}
$r['_modstring'] .= $this->html->render_moderator_entry( $data );
}
}
//-----------------------------------------
// Print
//-----------------------------------------
$this->skins[$r['skin_id']] = $this->skins[$r['skin_id']] ? $this->skins[$r['skin_id']] : '';
return $this->html->render_forum_row( $desc, $r, $depth_guide, $this->skins[$r['skin_id']] );
}
//-----------------------------------------
// REORDER
//-----------------------------------------
else if ( $this->type == 'reorder' )
{
$this->printed++;
$no_root = count( $this->ipsclass->forums->forums_get_children($this->ipsclass->input['f']) );
$reorder = "<select id='realbutton' name='f_{$r['id']}'>";
for( $i = 1 ; $i <= $no_root ; $i++ )
{
$sel = "";
if ( $this->printed == $i )
{
$sel = 'selected="selected" ';
}
$reorder .= "\n<option value='$i'{$sel}>$i</option>";
}
$reorder .= "</select>\n";
return $this->html->render_reorder_row( $r, $reorder, $depth_guide );
}
}
/*-------------------------------------------------------------------------*/
// Forum - SHOW CAT(MEOW) (MEOW _ WOOF :&)
/*-------------------------------------------------------------------------*/
function forum_show_cat($content, $r, $show_buttons=1, $show_reorder=0)
{
$this->printed++;
$no_root = count( $this->ipsclass->forums->forum_cache['root'] );
$reorder = "";
//-----------------------------------------
// Build reorder list
//-----------------------------------------
if ( $this->type != 'reorder' )
{
$reorder = "<select id='editbutton' name='f_{$r['id']}'>";
for( $i = 1 ; $i <= $no_root ; $i++ )
{
$sel = "";
if ( $this->printed == $i )
{
$sel = 'selected="selected" ';
}
$reorder .= "\n<option value='$i'{$sel}>$i</option>";
}
$reorder .= "</select>\n";
}
$this->ipsclass->html .= $this->html->forum_wrapper( $content, $r, $reorder, $show_buttons, $show_reorder );
}
/*-------------------------------------------------------------------------*/
// Forum - END CAT(MEOW) (MEOW _ WOOF MOO :&)
/*-------------------------------------------------------------------------*/
function forum_end_cat($r=array())
{
// NO LONGER USED?
if ( $this->type == 'manage' )
{
$this->ipsclass->html .= $this->ipsclass->adskin->end_table();
}
else if ( $this->type == 'reorder' )
{
$this->ipsclass->html .= $this->ipsclass->adskin->end_table();
}
}
/*-------------------------------------------------------------------------*/
// List all forums
/*-------------------------------------------------------------------------*/
function forums_list_forums()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$this->show_all = intval($this->ipsclass->input['showall']);
if ( ! $this->html )
{
$this->html = $this->ipsclass->acp_load_template('cp_skin_forums');
}
//-----------------------------------------
// Manage forums
//-----------------------------------------
if ( $this->type == 'manage' )
{
foreach( $this->ipsclass->cache['skin_id_cache'] as $id => $data )
{
$this->skins[ $id ] = $data['set_name'];
}
}
$temp_html = "";
$fid = intval( $this->ipsclass->input['f'] );
//-----------------------------------------
// Show all forums
//-----------------------------------------
if ( $this->show_all )
{
foreach( $this->ipsclass->forums->forum_cache['root'] as $id => $forum_data )
{
$cat_data = $forum_data;
$depth_guide = "";
if ( is_array( $this->ipsclass->forums->forum_cache[ $forum_data['id'] ] ) )
{
foreach( $this->ipsclass->forums->forum_cache[ $forum_data['id'] ] as $id => $forum_data )
{
if ( $this->ipsclass->vars['forum_cache_minimum'] )
{
$forum_data['description'] = "<!--DESCRIPTION:{$forum_data['id']}-->";
$this->need_desc[] = $forum_data['id'];
}
$temp_html .= $this->render_forum($forum_data, $depth_guide);
$temp_html = $this->forum_build_children( $forum_data['id'], $temp_html, '<span style="color:gray">&#0124;</span>'.$depth_guide . $this->ipsclass->forums->depth_guide );
}
}
$this->ipsclass->html .= $this->forum_show_cat($temp_html, $cat_data);
unset($temp_html);
}
}
//-----------------------------------------
// Show root forums
//-----------------------------------------
else if ( ! $fid )
{
$seen_count = 0;
$total_items = 0;
foreach( $this->ipsclass->forums->forum_cache[ 'root' ] as $id => $forum_data )
{
$cat_data = $forum_data;
$depth_guide = "";
if ( is_array( $this->ipsclass->forums->forum_cache[ $forum_data['id'] ] ) )
{
foreach( $this->ipsclass->forums->forum_cache[ $forum_data['id'] ] as $id => $forum_data )
{
if ( $this->ipsclass->vars['forum_cache_minimum'] )
{
$forum_data['description'] = "<!--DESCRIPTION:{$forum_data['id']}-->";
$this->need_desc[] = $forum_data['id'];
}
$temp_html .= $this->render_forum($forum_data, $depth_guide);
}
}
$this->ipsclass->html .= $this->forum_show_cat($temp_html, $cat_data);
unset($temp_html);
}
}
//-----------------------------------------
// Show per ID forums
//-----------------------------------------
else
{
$cat_data = $forum_data;
$depth_guide = "";
if ( is_array( $this->ipsclass->forums->forum_cache[ $fid ] ) )
{
$cat_data = $this->ipsclass->forums->forum_by_id[ $fid ];
$depth_guide = "";
foreach( $this->ipsclass->forums->forum_cache[ $fid ] as $id => $forum_data )
{
if ( $this->ipsclass->vars['forum_cache_minimum'] )
{
$forum_data['description'] = "<!--DESCRIPTION:{$forum_data['id']}-->";
$this->need_desc[] = $forum_data['id'];
}
$temp_html .= $this->render_forum($forum_data, $depth_guide);
}
}
$this->ipsclass->html .= $this->forum_show_cat( $temp_html, $this->ipsclass->forums->forum_by_id[ $fid ], 0, 1 );
unset($temp_html);
}
//-----------------------------------------
// Get descriptions?
//-----------------------------------------
if ( $this->ipsclass->vars['forum_cache_minimum'] and count($this->need_desc) )
{
$this->ipsclass->DB->simple_construct( array( 'select' => 'id,description', 'from' => 'forums', 'where' => 'id IN('.implode( ',', $this->need_desc ) .')' ) );
$this->ipsclass->DB->simple_exec();
while( $r = $this->ipsclass->DB->fetch_row() )
{
$this->ipsclass->html = str_replace( "<!--DESCRIPTION:{$r['id']}-->", $r['description'], $this->ipsclass->html );
}
}
}
/*-------------------------------------------------------------------------*/
// forum jumpee
/*-------------------------------------------------------------------------*/
function ad_forums_forum_list($restrict=0)
{
if ( $restrict != 1 )
{
$jump_array[] = array( '-1', 'Ñäåëàòü ðîäèòåëüñêèì/îñíîâíûì (êàòåãîðèÿ)' );
}
else
{
$jump_array = array();
}
foreach( $this->ipsclass->forums->forum_cache['root'] as $id => $forum_data )
{
$jump_array[] = array( $forum_data['id'], $forum_data['name'] );
$depth_guide = $this->ipsclass->forums->depth_guide;
if ( is_array( $this->ipsclass->forums->forum_cache[ $forum_data['id'] ] ) )
{
foreach( $this->ipsclass->forums->forum_cache[ $forum_data['id'] ] as $id => $forum_data )
{
$jump_array[] = array( $forum_data['id'], $depth_guide.$forum_data['name'] );
$jump_array = $this->forums_forum_list_internal( $forum_data['id'], $jump_array, $depth_guide . $this->ipsclass->forums->depth_guide );
}
}
}
return $jump_array;
}
/*-------------------------------------------------------------------------*/
// INTERNAL
/*-------------------------------------------------------------------------*/
function forums_forum_list_internal($root_id, $jump_array=array(), $depth_guide="")
{
if ( is_array( $this->ipsclass->forums->forum_cache[ $root_id ] ) )
{
foreach( $this->ipsclass->forums->forum_cache[ $root_id ] as $id => $forum_data )
{
$jump_array[] = array( $forum_data['id'], $depth_guide.$forum_data['name'] );
$jump_array = $this->forums_forum_list_internal( $forum_data['id'], $jump_array, $depth_guide . $this->ipsclass->forums->depth_guide );
}
}
return $jump_array;
}
/*-------------------------------------------------------------------------*/
// forum return data
/*-------------------------------------------------------------------------*/
function ad_forums_forum_data()
{
foreach( $this->ipsclass->forums->forum_cache['root'] as $id => $forum_data )
{
$forum_data['depthed_name'] = $forum_data['name'];
$forum_data['root_forum'] = 1;
$jump_array[ $forum_data['id'] ] = $forum_data;
$depth_guide = $this->ipsclass->forums->depth_guide;
if ( is_array( $this->ipsclass->forums->forum_cache[ $forum_data['id'] ] ) )
{
foreach( $this->ipsclass->forums->forum_cache[ $forum_data['id'] ] as $id => $forum_data )
{
$forum_data['depthed_name'] = $depth_guide.$forum_data['name'];
$jump_array[ $forum_data['id'] ] = $forum_data;
$jump_array = $this->forums_forum_data_internal( $forum_data['id'], $jump_array, $depth_guide . $this->ipsclass->forums->depth_guide );
}
}
}
return $jump_array;
}
/*-------------------------------------------------------------------------*/
// INTERNAL
/*-------------------------------------------------------------------------*/
function forums_forum_data_internal($root_id, $jump_array=array(), $depth_guide="")
{
if ( is_array( $this->ipsclass->forums->forum_cache[ $root_id ] ) )
{
foreach( $this->ipsclass->forums->forum_cache[ $root_id ] as $id => $forum_data )
{
$forum_data['depthed_name'] = $depth_guide.$forum_data['name'];
$jump_array[ $forum_data['id'] ] = $forum_data;
$jump_array = $this->forums_forum_data_internal( $forum_data['id'], $jump_array, $depth_guide . $this->ipsclass->forums->depth_guide );
}
}
return $jump_array;
}
}
?>
File diff suppressed because it is too large. Load diff
+230
View File
@@ -0,0 +1,230 @@
<?php
//===========================================================================
// Simple library that holds all the links for the admin cp
//===========================================================================
// CAT_ID => array( PAGE_ID => (PAGE_NAME, URL ) )
// $PAGES[ $cat_id ][$page_id][0] = Page name
// $PAGES[ $cat_id ][$page_id][1] = Url
// $PAGES[ $cat_id ][$page_id][2] = Look for folder before showing
// $PAGES[ $cat_id ][$page_id][3] = URL type: 1 = Board URL 0 = ACP URL
// $PAGES[ $cat_id ][$page_id][4] = Item icon: 1= redirect 0 = Normal
$PAGES = array(
# ÍÀÑÒÐÎÉÊÈ
100 => array (
1 => array( 'Âñå îñíîâíûå íàñòðîéêè', 'act=op' ),
2 => array( 'Äîáàâèòü íîâûé ïàðàìåòð' , 'act=op&code=settingnew' ),
7 => array( 'Âêëþ÷åíèå/Âûêëþ÷åíèå' , 'act=op&code=findsetting&key='.urlencode('Âêëþ÷åíèå / Âûêëþ÷åíèå ôîðóìà'), '', 0, 1 ),
8 => array( 'Ïðàâèëà ôîðóìà' , 'act=op&code=findsetting&key='.urlencode('Ïðàâèëà ôîðóìà'), '', 0, 1 ),
9 => array( 'Ãëîáàëüíûå íàñòðîéêè' , 'act=op&code=findsetting&key='.urlencode('Ãëîáàëüíûå Íàñòðîéêè ôîðóìà'), '', 0, 1 ),
10 => array( 'Íàñòðîéêè áûñòðîäåéñòâèÿ' , 'act=op&code=findsetting&key='.urlencode('Íàñòðîéêè Áûñòðîäåéñòâèÿ'), '', 0, 1 ),
// 11 => array( 'IP Chat' , 'act=pin&code=ipchat' ),
12 => array( 'Ðåãèñòðàöèÿ IPB' , 'act=pin&code=reg' ),
// 14 => array( 'IPB Copyright Removal' , 'act=pin&code=copy' ),
),
# ÓÏÐÀÂËÅÍÈÅ ÏÎËÜÇÎÂÀÒÅËßÌÈ
200 => array (
1 => array( 'Ñîçäàòü íîâûé ôîðóì' , 'act=forum&code=new' ),
2 => array( 'Óïðàâëåíèå ôîðóìàìè' , 'act=forum' ),
3 => array( 'Ìàñêè äîñòóïà' , 'act=group&code=permsplash'),
6 => array( 'Ìîäåðàòîðû' , 'act=mod' ),
7 => array( 'Ìóëüòè-ìîäåðàöèÿ òåì', 'act=multimod' ),
8 => array( 'Íàñòðîéêè êîðçèíû' , 'act=op&code=setting_view&conf_group=14', '', 0, 1 ),
),
300 => array (
1 => array ( 'Óïðàâëåíèå ïîëüçîâàòåëÿìè' , 'act=mem&code=search' ),
2 => array ( 'Ñîçäàòü íîâîãî ïîëüçîâàòåëÿ' , 'act=mem&code=add' ),
6 => array ( 'Óïðàâëåíèå çâàíèÿìè' , 'act=mem&code=title'),
7 => array ( 'Óïðàâëåíèå ãðóïïàìè' , 'act=group' ),
8 => array ( 'Óïðàâëåíèå íåàêòèâèðîâàí.' , 'act=mem&code=mod' ),
9 => array ( 'Äîïîëíèòåëüíûå ïîëÿ ïðîôèëÿ' , 'act=field' ),
11 => array ( 'IP óòèëèòû' , 'act=mtools' ),
12 => array ( 'Ïðîôèëè ïîëüçîâàòåëåé' , 'act=op&code=setting_view&conf_group=4', '', 0, 1 ),
),
/* íå àêòóàëüíî äëÿ Ðîññèè
400 => array(
1 => array( 'Manage Payment Gateways' , 'act=msubs&code=index-gateways' ),
2 => array( 'Manage Packages' , 'act=msubs&code=index-packages' ),
3 => array( 'Manage Transactions' , 'act=msubs&code=index-tools' ),
4 => array( 'Manage Currencies' , 'act=msubs&code=currency' , ),
5 => array( 'Manually Add Transaction' , 'act=msubs&code=addtransaction' ),
6 => array( 'Install Payment Gateways' , 'act=msubs&code=install-index' ),
9 => array( 'Subscription Settings' , 'act=op&code=findsetting&key='.urlencode('subscriptionsmanager'), '', 0, 1 ),
),
*/
# POST MANAGEMENT
500 => array (
1 => array( 'Òèïû ïðèêðåïëÿåìûõ ôàéëîâ' , 'act=attach&code=types' ),
2 => array( 'Ñòàòèñòèêà ïðèêðåïë. ôàéëîâ' , 'act=attach&code=stats' ),
3 => array( 'Ïîèñê ïðèêðåïë. ôàéëîâ' , 'act=attach&code=search' ),
),
600 => array(
1 => array( 'Äîïîëíèòåëüíûå BB-êîäû' , 'act=admin&code=bbcode' ),
2 => array( 'Äîáàâèòü íîâûé BB-êîä' , 'act=admin&code=bbcode_add' ),
),
700 => array(
1 => array( 'Ìåíåäæåð ñìàéëèêîâ' , 'act=admin&code=emo' ),
2 => array( 'Èìïîðò/ýêñïîðò ñìàéëèêîâ' , 'act=admin&code=emo_packsplash' ),
),
800 => array (
1 => array( 'Ôèëüòðû íåöåíçóðíûõ ñëîâ', 'act=admin&code=badword' ),
6 => array( 'Ôèëüòðû áëîêèðîâêè (ban)' , 'act=admin&code=ban' ),
),
# SKINS & LANGS
900 => array (
1 => array( 'Ìåíåäæåð ñòèëåé' , 'act=sets' ),
2 => array( 'Óòèëèòû äëÿ ñòèëåé' , 'act=skintools' ),
3 => array( 'Ïîèñê è çàìåíà â ñòèëÿõ' , 'act=skintools&code=searchsplash' ),
4 => array( 'Èìïîðò/ýêñïîðò ñòèëåé' , 'act=import' ),
5 => array( 'Ïðîñòàÿ ñìåíà ëîãîòèïà' , 'act=skintools&code=easylogo' ),
),
1000 => array (
1 => array( 'Óïðàâëåíèå ÿçûêàìè' , 'act=lang' ),
2 => array( 'Èìïîðòèðîâàíèå ÿçûêà' , 'act=lang&code=import' ),
),
# ADMIN
1100 => array (
1 => array( 'Ðàçäåëû ïîìîùè' , 'act=help' ),
2 => array( 'Óïðàâëåíèå êåøåì' , 'act=admin&code=cache' ),
3 => array( 'Ïåðåñ÷åò è îáíîâëåíèå' , 'act=rebuild' ),
4 => array( 'Óòèëèòû î÷èñòêè' , 'act=rebuild&code=tools' ),
),
1200 => array(
1 => array( 'Óïðàâëåíèå ðàññûëêàìè' , 'act=postoffice' ),
2 => array( 'Ñîçäàòü ðàññûëêó' , 'act=postoffice&code=mail_new' ),
3 => array( 'Æóðíàë e-mail îòïðàâëåíèé' , 'act=emaillog', '', 0, 1 ),
4 => array( 'Æóðíàë e-mail îøèáîê' , 'act=emailerror', '', 0, 1 ),
5 => array( 'E-mail íàñòðîéêè' , 'act=op&code=findsetting&key='.urlencode('Íàñòðîéêè e-mail'), '', 0, 1 ),
),
1300 => array (
1 => array( 'Ìåíåäæåð çàäà÷' , 'act=task' ),
2 => array( 'Æóðíàë âûïîëíåííûõ çàäà÷ ' , 'act=task&code=log' ),
),
1400 => array(
1 => array( 'Invision Gallery' , 'act=gallery' ),
2 => array( '|-- Íàñòðîéêè' , 'act=op&code=findsetting&key='.urlencode('Íàñòðîéêè ãàëåðåè'), '', 0, 0 ),
3 => array( '|-- Ìåíåäæåð àëüáîìîâ' , 'act=gallery&code=albums' , 'modules/gallery' ),
4 => array( '|-- Ìåíåäæåð ìóëüòèìåäèà' , 'act=gallery&code=media' , 'modules/gallery' ),
5 => array( '|-- Ãðóïïû' , 'act=gallery&code=groups' , 'modules/gallery' ),
6 => array( '|-- Ñòàòèñòèêà' , 'act=gallery&code=stats' , 'modules/gallery' ),
7 => array( '|-- Óòèëèòû' , 'act=gallery&code=tools' , 'modules/gallery' ),
8 => array( '&#039;-- Ôîðìà ïóáëèêàöèè' , 'act=gallery&code=postform', 'modules/gallery' ),
),
1450 => array(
1 => array( 'Invision Community Blog' , 'act=blog' ),
2 => array( 'Íàñòðîéêè áëîãîâ' , 'act=op&code=findsetting&key='.urlencode('Íàñòðîéêè áëîãîâ'), '', 0, 1 ),
3 => array( 'Ãðóïïû' , 'act=blog&amp;cmd=groups' ),
4 => array( 'Áëîêè' , 'act=blog&amp;cmd=cblocks' ),
5 => array( 'Óòèëèòû' , 'act=blog&amp;cmd=tools' ),
),
1500 => array (
1 => array( 'Ñòàòèñòèêà ðåãèñòðàöèé' , 'act=stats&code=reg' ),
2 => array( 'Ñòàòèñòèêà íîâûõ òåì' , 'act=stats&code=topic' ),
3 => array( 'Ñòàòèñòèêà ñîîáùåíèé' , 'act=stats&code=post' ),
4 => array( 'Ñòàòèñòèêà ëè÷íûõ ñîîáùåíèé' , 'act=stats&code=msg' ),
5 => array( 'Ñòàòèñòèêà ïðîñìîòðîâ òåì' , 'act=stats&code=views' ),
),
1600 => array (
1 => array( 'SQL Óòèëèòà' , 'act=mysql' ),
2 => array( 'SQL Ðåçåðâíàÿ êîïèÿ (backup)' , 'act=mysql&code=backup' ),
3 => array( 'SQL Èíôîðìàöèÿ', 'act=mysql&code=runtime' ),
4 => array( 'SQL Ñèñòåìíûå ïåðåìåííûå' , 'act=mysql&code=system' ),
5 => array( 'SQL Ïðîöåññû' , 'act=mysql&code=processes' ),
),
1700 => array(
1 => array( 'Äåéñòâèÿ ìîäåðàòîðîâ' , 'act=modlog' ),
2 => array( 'Äåéñòâèÿ àäìèíèñòðàòîðîâ' , 'act=adminlog' ),
3 => array( 'E-mail îòïðàâëåíèÿ' , 'act=emaillog' ),
4 => array( 'Æóðíàë e-mail îøèáîê', 'act=emailerror' ),
5 => array( 'Äåéñòâèÿ ïîèñêîâûõ áîòîâ' , 'act=spiderlog' ),
6 => array( 'Æóðíàë ïðåäóïðåæäåíèé' , 'act=warnlog' ),
),
);
$CATS = array (
100 => array( "Ñèñòåìíûå íàñòðîéêè" , '#caf2d9;margin-bottom:12px;' ),
200 => array( 'Óïðàâëåíèå ôîðóìàìè' , '#F9FFA2' ),
300 => array( 'Ïîëüçîâàòåëè è ãðóïïû' , '#F9FFA2' ),
/* íå àêòóàëüíî äëÿ Ðîññèè
400 => array( "Ïîäïèñêè" , '#F9FFA2;margin-bottom:12px;' ),
*/
500 => array( "Ïðèêðåïëÿåìûå ôàéëû" , '#f5cdcd' ),
600 => array( "Äîïîëíèòåëüíûå BB-êîäû" , '#f5cdcd' ),
700 => array( "Ñìàéëèêè" , '#f5cdcd' ),
800 => array( "Ôèëüòðû", '#f5cdcd;margin-bottom:12px;' ),
900 => array( 'Ñòèëè' , '#DFE6EF' ),
1000 => array( 'ßçûêè' , '#DFE6EF;margin-bottom:12px;' ),
1100 => array( 'Äîïîëíèòåëüíî' , '#caf2d9' ),
1200 => array( 'Ðàáîòà ñ e-mail' , '#caf2d9' ),
1300 => array( 'Ìåíåäæåð çàäà÷' , '#caf2d9;margin-bottom:12px;' ),
1400 => array( "Invision Gallery" , '#F9FFA2;' ),
1450 => array( "Community Blog" , '#F9FFA2;margin-bottom:12px;' ),
1500 => array( 'Öåíòð ñòàòèñòèêè' , '#f5cdcd' ),
1600 => array( 'Óïðàâëåíèå SQL' , '#f5cdcd' ),
1700 => array( 'Æóðíàëû ôîðóìíûõ îïåðàöèé' , '#f5cdcd' ),
);
$DESC = array (
100 => "Íàñòðîéêè ôîðóìà, òàêèå êàê íàñòðîéêà cookies, âîçìîæíîñòè ïî áåçîïàñíîñòè, âîçìîæíîñòè ïóáëèêàöèè ñîîáùåíèé è ò.ä.",
200 => "Ñîçäàíèå, èçìåíåíèå, óäàëåíèå è ñîðòèðîâêà êàòåãîðèé, ôîðóìîâ è ìîäåðàòîðîâ",
300 => "Óïðàâëåíèå ïîëüçîâàòåëÿìè, ãðóïïàìè è çâàíèÿìè",
/* íå àêòóàëüíî äëÿ Ðîññèè
400 => "Óïðàâëåíèå ïîäïèñêàìè âàøèõ ïîëüçîâàòåëåé",
*/
500 => "Óïðàâëåíèå ïðèêðåïëÿåìûìè ôàéëàìè",
600 => "Óïðàâëåíèå äîïîëíèòåëüíàìè BB-êîäàìè",
700 => "Óïðàâëåíèå ñìàéëèêàìè, ýêñïîðò è èìïîðò ãðóïï ñìàéëèêîâ",
800 => "Óïðàâëåíèå ôèëüòðàìè áàíîâ è íåöåíçóðíûõ ñëîâ",
900 => "Óïðàâëåíèå øàáëîíàìè, ñòèëÿìè, öâåòàìè è èçîáðàæåíèÿìè",
1000 => "Óïðàâëåíèå ÿçûêîâûìè ôàéëàìè",
1100 => "Óïðàâëåíèå ðàçäåëàìè ïîìîùè, ôèëüòðàìè íåöåíçóðíûõ ñëîâ è ñìàéëèêàìè",
1200 => "Óïðàâëåíèå e-mail è ðàññûëêàìè",
1300 => "Óïðàâëåíèå çàïëàíèðîâàííûìè çàäà÷àìè",
1400 => "Óïðàâëåíèå âàøåé ãàëåðååé",
1450 => "Óïðàâëåíèå âàøèìè áëîãàìè",
1500 => "Ïîëó÷åíèå ñòàòèñòèêè ðåãèñòðàöèé è ïóáëèêàöèè ñîîáùåíèé",
1600 => "Óïðàâëåíèå âàøåé áàçîé äàííûõ, ïî÷èíêà, îïòèìèçàöèÿ è ýêñïîðòèðîâàíèå äàííûõ",
1700 => "Ïðîñìîòð æóðíàëà îïåðàöèé àäìèíèñòðàòîðîâ, ìîäåðàòîðîâ è e-mail (òîëüêî ãëàâíûå àäìèíèñòðàòîðû)", );
?>
+693
View File
@@ -0,0 +1,693 @@
<?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: 2006-02-03 16:54:26 +0000 (Fri, 03 Feb 2006) $
| > $Revision: 137 $
| > $Author: bfarber $
+---------------------------------------------------------------------------
|
| > Admin HTML stuff library
| > Script written by Matt Mecham
| > Date started: 1st march 2002
|
| > DBA Checked: Tue 25th May 2004
+--------------------------------------------------------------------------
*/
class admin_skin
{
# Global
var $ipsclass;
var $base_url;
var $img_url;
var $has_title;
var $td_widths = array();
var $td_header = array();
var $td_colspan;
var $valid_hostnames = array();
function init_admin_skin()
{
$this->base_url = $this->ipsclass->base_url;
$this->img_url = $this->ipsclass->skin_url;
}
/*-------------------------------------------------------------------------*/
// Print the global ACP header
/*-------------------------------------------------------------------------*/
function print_top($title="",$desc="")
{
return $this->ipsclass->skin_global_acp->global_header( $title, $desc );
}
/*-------------------------------------------------------------------------*/
// Print the nav wrapper
/*-------------------------------------------------------------------------*/
function wrap_nav($links)
{
return $this->ipsclass->skin_global_acp->global_wrap_nav( $links );
}
/*-------------------------------------------------------------------------*/
// Print the global ACP footer
/*-------------------------------------------------------------------------*/
function print_foot()
{
return $this->ipsclass->skin_global_acp->global_footer( date("Y") );
}
/*-------------------------------------------------------------------------*/
// Print the global ACP menu header
/*-------------------------------------------------------------------------*/
function menu_top()
{
return $this->ipsclass->skin_global_acp->global_menu_header();
}
/*-------------------------------------------------------------------------*/
// Print the global ACP menu footer
/*-------------------------------------------------------------------------*/
function menu_foot()
{
return $this->ipsclass->skin_global_acp->global_menu_footer();
}
/*-------------------------------------------------------------------------*/
// Print the global ACP frameset
/*-------------------------------------------------------------------------*/
function frame_set()
{
//-----------------------------------------
// Carry on
//-----------------------------------------
$extra_query = 'act=index';
if ( $this->ipsclass->input['act'] != 'idx' )
{
$extra_query = str_replace( '&amp;', '&', $this->ipsclass->parse_clean_value($_SERVER['QUERY_STRING']) );
$extra_query = str_replace( "{$this->ipsclass->vars['board_url']}" , "" , $extra_query );
$extra_query = preg_replace( "!/?admin\.{$this->ipsclass->vars['php_ext']}!i", "" , $extra_query );
$extra_query = preg_replace( "!^\?!" , "" , $extra_query );
$extra_query = str_replace( "printframes=1" , "" , $extra_query );
$extra_query = preg_replace( "!adsess=(\w){32}!" , "" , $extra_query );
$extra_query = preg_replace( "!s=(\w){32}!" , "" , $extra_query );
}
return $this->ipsclass->skin_global_acp->global_frame_set( $extra_query );
}
/*-------------------------------------------------------------------------*/
// Print the global menu cat wrap
/*-------------------------------------------------------------------------*/
function menu_cat_wrap($show, $name="", $links="", $id = "", $desc, $color='#FFF', $extra='')
{
return $this->ipsclass->skin_global_acp->global_menu_cat_wrap($show, $name, $links, $id, $desc, $color, $extra);
}
/*-------------------------------------------------------------------------*/
// Print the global menu cat link
/*-------------------------------------------------------------------------*/
function menu_cat_link($pid, $cid, $url="", $name="", $urltype=0, $isredirect=0, $no_access=0)
{
if ( $urltype == 1 )
{
$theurl = $this->ipsclass->vars['board_url'].'/index.'.$this->ipsclass->vars['php_ext'].'?';
}
else
{
$theurl = $this->ipsclass->base_url;
}
if ( $isredirect )
{
$icon = "<img src='{$this->ipsclass->skin_url}/images/menu_shortcut.gif' border='0' alt='' valign='absmiddle' />";
$extra_css = ';font-style:italic';
}
else
{
$icon = "<img src='{$this->ipsclass->skin_url}/images/item.gif' border='0' alt='' valign='absmiddle' />";
$extra_css = "";
}
if ( $no_access )
{
$extra_css .= ";color:#777";
}
return $this->ipsclass->skin_global_acp->global_menu_cat_link( $cid, $pid, $icon, $extra_css, $name, $url, $theurl );
}
/*-------------------------------------------------------------------------*/
// JS Make button
/*-------------------------------------------------------------------------*/
function js_make_button($text="", $url="", $css='realbutton', $title="")
{
return "<input type='button' class='{$css}' value='{$text}' onclick='self.location.href=\"{$url}\"' title='$title' />";
}
/*-------------------------------------------------------------------------*/
// JS Help Link
/*-------------------------------------------------------------------------*/
function js_help_link($help="", $text="Áûñòðàÿ ïîìîùü")
{
return "( <a href='#' onClick=\"window.open('{$this->ipsclass->base_url}&act=quickhelp&id=$help','Ïîìîùü','width=250,height=400,resizable=yes,scrollbars=yes'); return false;\">$text</a> )";
}
/*-------------------------------------------------------------------------*/
// JS Template tools
/*-------------------------------------------------------------------------*/
function js_template_tools()
{
return "
<script language='javascript'>
<!--
var template_bit_ids = '<!--IPB.TEMPLATE_BIT_IDS-->';
//-->
</script>
";
}
/*-------------------------------------------------------------------------*/
// JS Make page jump
/*-------------------------------------------------------------------------*/
function make_page_jump($tp="", $pp="", $ub="" )
{
return "<a href='#' title=\"Ïåðåéòè ê ñòðàíèöå...\" onclick=\"multi_page_jump('$ub',$tp,$pp);\">Pages:</a>";
}
/*-------------------------------------------------------------------------*/
// Form: Start Form
/*-------------------------------------------------------------------------*/
function start_form($hiddens="", $name='theAdminForm', $js="", $id="")
{
if ( ! $id )
{
$id = $name;
}
$form = "<form action='{$this->ipsclass->base_url}' method='post' name='$name' $js id='$id'>";
if (is_array($hiddens))
{
foreach ($hiddens as $k => $v)
{
$form .= "\n<input type='hidden' name='{$v[0]}' value='{$v[1]}'>";
}
}
return $form;
}
/*-------------------------------------------------------------------------*/
// Form: Hidden
/*-------------------------------------------------------------------------*/
function form_hidden($hiddens="")
{
if (is_array($hiddens))
{
foreach ($hiddens as $k => $v)
{
$form .= "\n<input type='hidden' name='{$v[0]}' value='{$v[1]}'>";
}
}
return $form;
}
//-----------------------------------------
function end_form($text = "", $js = "", $extra = "")
{
$html = "";
$colspan = "";
if ($text != "")
{
if ($this->td_colspan > 0)
{
$colspan = " colspan='".$this->td_colspan."' ";
}
$html .= "<tr><td align='center' class='pformstrip'".$colspan."><input type='submit' value='$text'".$js." id='button' accesskey='s'>{$extra}</td></tr>\n";
}
$html .= "</form>";
return $html;
}
//-----------------------------------------
function end_form_standalone($text = "", $js = "")
{
$html = "";
$colspan = "";
if ($text != "")
{
$html .= "<div class='tableborder'><div align='center' class='pformstrip'><input type='submit' value='$text'".$js." id='button' accesskey='s'></div></div>\n";
}
$html .= "</form>";
return $html;
}
//-----------------------------------------
function form_upload($name="FILE_UPLOAD", $js="")
{
if ($js != "")
{
$js = ' '.$js.' ';
}
return "<input class='textinput' type='file' $js size='30' name='$name'>";
}
//-----------------------------------------
function form_input($name, $value="", $type='text', $js="", $size="30")
{
if ($js != "")
{
$js = ' '.$js.' ';
}
return "<input type='$type' name='$name' value=\"$value\" size='$size'".$js." class='textinput'>";
}
function form_simple_input($name, $value="", $size='5')
{
return "<input type='text' name='$name' value='$value' size='$size' class='textinput'>";
}
//-----------------------------------------
function form_textarea($name, $value="", $cols='60', $rows='5', $wrap='soft', $id="", $style="", $js="") {
if ( $id )
{
$id = "id='$id'";
}
else
{
$id = "id='{$name}'";
}
if ( $style )
{
$style = "style='$style'";
}
return "<textarea name='$name' cols='$cols' rows='$rows' wrap='$wrap' $id $style $js class='multitext'>$value</textarea>";
}
//-----------------------------------------
function form_dropdown($name, $list=array(), $default_val="", $js="", $css="") {
if ($js != "")
{
$js = ' '.$js.' ';
}
if ($css != "")
{
$css = ' class="'.$css.'" ';
}
$html = "<select name='$name'".$js." $css class='dropdown'>\n";
foreach ($list as $k => $v)
{
$selected = "";
if ( ($default_val != "") and ($v[0] == $default_val) )
{
$selected = ' selected';
}
$html .= "<option value='".$v[0]."'".$selected.">".$v[1]."</option>\n";
}
$html .= "</select>\n\n";
return $html;
}
//-----------------------------------------
function form_multiselect($name, $list=array(), $default=array(), $size=5, $js="") {
if ($js != "")
{
$js = ' '.$js.' ';
}
//$html = "<select name='$name".'[]'."'".$js." id='dropdown' multiple='multiple' size='$size'>\n";
$html = "<select name='$name"."'".$js." class='dropdown' multiple='multiple' size='$size'>\n";
foreach ($list as $k => $v)
{
$selected = "";
if ( count($default) > 0 )
{
if ( in_array( $v[0], $default ) )
{
$selected = ' selected="selected"';
}
}
$html .= "<option value='".$v[0]."'".$selected.">".$v[1]."</option>\n";
}
$html .= "</select>\n\n";
return $html;
}
//-----------------------------------------
function form_yes_no( $name, $default_val="", $js=array() ) {
$y_js = "";
$n_js = "";
if ( $js['yes'] != "" )
{
$y_js = $js['yes'];
}
if ( $js['no'] != "" )
{
$n_js = $js['no'];
}
$yes = "Äà &nbsp; <input type='radio' name='$name' value='1' $y_js id='green'>";
$no = "<input type='radio' name='$name' value='0' $n_js id='red'> &nbsp; Íåò";
if ($default_val == 1)
{
$yes = "Äà &nbsp; <input type='radio' name='$name' value='1'$y_js checked id='green'>";
}
else
{
$no = "<input type='radio' name='$name' value='0' checked $n_js id='red'> &nbsp; Íåò";
}
return $yes.'&nbsp;&nbsp;&nbsp;'.$no;
}
//-----------------------------------------
function form_checkbox( $name, $checked=0, $val=1, $js=array() ) {
$form_js = "";
if( count( $js ) )
{
foreach( $js as $javascript )
{
$form_js .= $javascript." ";
}
}
if ($checked == 1)
{
return "<input type='checkbox' name='$name' value='$val' $form_js checked='checked'>";
}
else
{
return "<input type='checkbox' name='$name' value='$val' $form_js>";
}
}
//-----------------------------------------
//--------------------------------------------------------------------
// SCREEN ELEMENTS
//-----------------------------------------
//--------------------------------------------------------------------
function add_subtitle($title="",$id="subtitle", $colspan="") {
if ($colspan != "")
{
$colspan = " colspan='$colspan' ";
}
return "\n<tr><td id='$id'".$colspan.">$title</td><tr>\n";
}
//-----------------------------------------
function start_table( $title="", $desc="") {
if ($title != "")
{
$this->has_title = 1;
$html .= "<div class='tableborder'>
<div class='maintitle'>$title</div>\n";
if ( $desc != "" )
{
$html .= "<div class='pformstrip'>$desc</div>\n";
}
}
$html .= "\n<table width='100%' cellspacing='0' cellpadding='5' align='center' border='0'>";
if (isset($this->td_header[0]))
{
$html .= "<tr>\n";
// Auto remove two &nbsp; only headers..
if ( $this->td_header[0][0] == '&nbsp;' && $this->td_header[1][0] == '&nbsp;' && ( ! isset( $this->td_header[2][0] ) ) )
{
$this->td_header[0][0] = '{none}';
$this->td_header[1][0] = '{none}';
}
foreach ($this->td_header as $td)
{
if ($td[1] != "")
{
$width = " width='{$td[1]}' ";
}
else
{
$width = "";
}
if ($td[0] != '{none}')
{
$html .= "<td class='titlemedium'".$width."align='center'>{$td[0]}</td>\n";
}
$this->td_colspan++;
}
$html.= "</tr>\n";
}
return $html;
}
//-----------------------------------------
function add_standalone_row($text = "", $align='center', $class='pformstrip')
{
return "<div class='tableborder'><div align='{$align}' class='{$class}'>{$text}</div></div>\n";
}
//-----------------------------------------
function add_td_row( $array, $css="", $align='middle' ) {
if (is_array($array))
{
$html = "<tr>\n";
$count = count($array);
$this->td_colspan = $count;
for ($i = 0; $i < $count ; $i++ )
{
$td_col = $i % 2 ? 'tdrow2' : 'tdrow1';
if ($css != "")
{
$td_col = $css;
}
if (is_array($array[$i]))
{
$text = $array[$i][0];
$colspan = $array[$i][1];
$td_col = $array[$i][2] != "" ? $array[$i][2] : $td_col;
$html .= "<td class='$td_col' colspan='$colspan' valign='$align'>".$text."</td>\n";
}
else
{
if ($this->td_header[$i][1] != "")
{
$width = " width='{$this->td_header[$i][1]}' ";
}
else
{
$width = "";
}
$html .= "<td class='$td_col' $width valign='$align'>".$array[$i]."</td>\n";
}
}
$html .= "</tr>\n";
return $html;
}
}
//-----------------------------------------
function add_td_basic($text="",$align="left",$id="tdrow1", $colspanint=0) {
$html = "";
$colspan = "";
if ( $colspanint )
{
$this->td_colspan = $colspanint;
}
if ($text != "")
{
if ($this->td_colspan > 0)
{
$colspan = " colspan='".$this->td_colspan."' ";
}
$html .= "<tr><td align='$align' class='$id'".$colspan.">$text</td></tr>\n";
}
return $html;
}
//-----------------------------------------
function add_td_spacer() {
if ($this->td_colspan > 0)
{
$colspan = " colspan='".$this->td_colspan."' ";
}
return "<tr><td".$colspan."><br /></td></tr>";
}
//-----------------------------------------
function end_table() {
$this->td_header = array(); // Reset TD headers
if ($this->has_title == 1)
{
$this->has_title = 0;
return "</table></div><br />\n\n";
}
else
{
return "</table>\n\n";
}
}
//-----------------------------------------
function skin_jump_menu_wrap()
{
return "<br /><div align='center' style='width:250px;margin-left:auto;margin-right:auto;'>
<div style='padding:3px 0px 3px 0px;border:1px solid #AAA;'>
<div class='tablepad' align='center'>".$this->ipsclass->admin->skin_jump_menu()."</div></div></div>";
}
}
?>
@@ -0,0 +1,415 @@
<?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 $
+---------------------------------------------------------------------------
|
| > Admin Template functions library
| > Script written by Matt Mecham
| > Date started: 19th November 2003
|
| > DBA Checked: Tue 25th May 2004
+--------------------------------------------------------------------------
*/
class admin_template_functions
{
var $menu_fontchange = "";
var $menu_sizechange = "";
var $menu_backchange = "";
var $menu_fontcolor = "";
var $menu_widthchange = "";
var $menu_highchange = "";
var $default_css = "";
//-----------------------------------------
// Constructor
//-----------------------------------------
function admin_template_functions()
{
$this->default_css = "font-family:Verdana;font-size:11pt;color:black;background-color:white;border:3px outset #555";
}
//-----------------------------------------
// Build generic editor
//-----------------------------------------
function build_generic_editor_area( $data )
{
$return = "";
$return .= $this->html_build_editor_top();
$return .= "
<script language='javascript'>
<!--
var template_bit_ids = 'txt{$data['textareaname']}';
//-->
</script>
<div class='tableborder'>
<div class='titlemedium'>
<table width='100%' cellpadding='0' cellspacing='0' border='0'>
<tr>
<td width='1%' align='left' valign='middle'>
<input type='button' value='Ïëàâàþùåå îêíî' class='realdarkbutton' title='Îòêðûòü ðåäàêòèðîâàíèå ýòîãî øàáëîíà â áîëüøîì îêíå' onclick=\"pop_win('section={$data['section']}&act={$data['act']}&code=floateditor&id={$data['textareaname']}', 'Float', 800, 400)\">&nbsp;
</td>
<td width='95%' align='left' valign='middle'>&nbsp;<b>{$data['title']}</b></td>
<td width='5% align='right' valign='middle' nowrap='nowrap' ><!--TOP.RIGHT--></td>
</tr>
<!--TR.ROW-->
</table>
</div>";
$return .= "<div align='center' style='padding:2px;'>".$this->ipsclass->adskin->form_textarea("txt{$data['textareaname']}", $data['textareainput'], $this->ipsclass->vars['tx'], $this->ipsclass->vars['ty'], 'none', "txt{$data['textareaname']}", $this->default_css )."</div>\n";
$return .= $this->html_build_editor_bottom() . "</div>";
return $return;
}
//-----------------------------------------
// Build editor text area table
//-----------------------------------------
function build_editor_area( $html, $template=array(), $img="" )
{
$return = "";
$edit_prefs = $this->type == 'single' ? $this->editor_prefs_dropdown : '';
$close_box = $this->type == 'single' ? "<input type='button' class='realbutton' style='color:red' onclick='parent.template_edit_close(\"{$template['suid']}\")' value=' X ' />" : '';
$template['func_data'] = str_replace( "'", '&#039;', $template['func_data'] );
$spiffy_diffy = "<div align='center' style='position:absolute;width:99%;display:none;text-align:center' id='dv_{$template['suid']}'>
<table cellspacing='0' width='500' align='center' cellpadding='6' style='background:#EEE;border:2px outset #555;'>
<tr>
<td align='center' valign='top'>
<b>Ðàñøèðåííûé ðåæèì: Ïåðåìåííûå øàáëîíà</b><br />Îñòàâüòå êàê åñòü, åñëè âû íå çíàåòå, êàê ýòî ðàáîòàåò.<br />Èñïîëüçóéòå çàïÿòóþ äëÿ ðàçäåëåíèÿ íåñêîëüêèõ ïåðåìåííûõ.
<br /><input class='textinput' name='funcdata_{$template['suid']}' value='{$template['func_data']}' type='text' size='50' />
<br /><br />
<input type='button' class='realdarkbutton' value='Ñîõðàíèòü è Çàêðûòü' onclick=\"togglediv('dv_{$template['suid']}');\" />
</td>
</tr>
</table>
</div>";
$return .= <<<EOF
<div class='tableborder'>
<div class='titlemedium'>
<table width='100%' cellpadding='0' cellspacing='0' border='0'>
<tr>
<td width='1%' align='left' valign='middle'>{$close_box}</td>
<td width='19%' align='left' valign='middle' nowrap='nowrap'>
{$edit_prefs}
</td>
<td width='75%' align='left' valign='middle'>&nbsp;{$img}<b>{$template['easy_name']}</b></td>
<td width='5% align='right' nowrap='nowrap' valign='middle'>
<input type='hidden' id='edited-{$template['suid']}' name='edited-{$template['suid']}' value='0' />
<input type='submit' name='submit-{$template['suid']}' value='Ñîõðàíèòü øàáëîí' id='sb-t{$template['suid']}' class='realdarkbutton' />
<input type='button' value='Ïëàâàþùåå îêíî' class='realbutton' title='Îòêðûòü ðåäàêòèðîâàíèå ýòîãî øàáëîíà â ïëàâàþùåì îêíå' onclick="pop_win('section=lookandfeel&act=templ&code=floateditor&id={$template['suid']}', 'Ïëàâàþùåå îêíî {$template['suid']}', 800, 400)">
<img id="tmpl-{$template['suid']}" src='{$this->ipsclass->skin_url}/images/filebrowser_action.gif' border='0' alt='Îïöèè' class='ipd' />
&nbsp;
</td>
</tr>
</table>
$spiffy_diffy
</div>
<script type="text/javascript">
EOF;
if ( $this->type == 'single' OR $this->type == 'multiple' )
{
$return .= "\ntry { parent.template_bit_onload(); } catch(e) { }\n";
}
$return .= <<<EOF
menu_build_menu(
"tmpl-{$template['suid']}",
new Array(
img_item + " <a href='#' onclick=\"menu_action_close(); toggleview('dv_{$template['suid']}')\"; return false;'>Ðåäàêòèðîâàíèå âõîäÿùèõ ïåðåìåííûõ...</a>",
img_item + " <a href='#' onclick='menu_action_close(); pop_win(\"act=rtempl&code=macro_one&suid={$template['suid']}\", \"MacroWindow\", 400, 200); return false;'>Ïðîâåðêà ìàêðîñîâ...</a>",
img_item + " <a href='#' onclick='menu_action_close(); pop_win(\"act=rtempl&code=compare&suid={$template['suid']}\", \"CompareWindow\", 500,400); return false;'>Ñðàâíèòü âåðñèè...</a>",
img_item + " <a href='#' onclick='menu_action_close(); parent.template_bit_restore(\"{$template['suid']}\"); return false;'>Îáðàòèòü âñå èçìåíåíèÿ...</a>",
img_item + " <a href='#' onclick='menu_action_close(); pop_win(\"act=rtempl&code=preview&suid={$template['suid']}&type=html\", \"OriginalPreview\", 400,400); return false;'>Ïðîñìîòð îðèãèíàëà...</a>"
) );
</script>
EOF;
$return .= "<div align='center' style='padding:2px;'>".$this->ipsclass->adskin->form_textarea("txt{$template['suid']}", $html, $this->ipsclass->vars['tx'], $this->ipsclass->vars['ty'], 'none', "t{$template['suid']}", $this->default_css, 'onkeypress="parent.template_bit_changed(\'t'.$template['suid'].'\')"' )."</div>\n";
$return .= "</div>";
return $return;
}
//-----------------------------------------
// Build JS for floated window
//-----------------------------------------
function build_editor_area_floated($no_buttons=0)
{
$return = "<form name='theform'>";
$return .= $this->html_build_editor_top();
$return .= "<div class='tableborder'>
<div class='titlemedium' align='right'>";
if ( $no_buttons == 0 )
{
$return .= "
<input type='button' value='Ïîèñê' class='realbutton' title='Ïîèñê ïî øàáëîíó' onClick='pop_win(\"act=rtempl&code=search&suid={$template['suid']}&type=html\", \"Search\", 500,400)'>
<input type='button' value='Ìàêðîñû' class='realbutton' title='Ïðîâåðêà ìàêðîñîâ ïî ââåäåííîé çàïèñè' onClick='pop_win(\"code=macro_one&suid={$template['suid']}\", \"MacroWindow\", 400, 200)'>
<input type='button' value='Ñðàâíèòü' class='realbutton' title='Ñðàâíèòü èçìåíåííûé âàìè âàðèàíò øàáëîíà ñ ïåðâîíà÷àëüíûì îðèãèíàëîì' onClick='pop_win(\"act=rtempl&code=compare&suid={$template['suid']}\", \"CompareWindow\", 500,400)'>
<input type='button' value='Îáðàòèòü' class='realbutton' title='Îáðàòèòü âñå èçìåíåíèÿ øàáëîíà, òî åñòü ïðèâåñòè åãî ê ïåðâîíà÷àëüíîìó ñòàíäàðòíîìó âèäó' onClick='restore(\"{$template['suid']}\",\"{$this->ipsclass->input['expand']}\")'>
<input type='button' value='Îðèãèíàë' class='realbutton' title='Ïðîñìîòð îðèãèíàëüíîãî ïåðâîíà÷àëüíîãî âàðèàíòà øàáëîíà' onClick='pop_win(\"act=rtempl&code=preview&suid={$template['suid']}&type=html\", \"OriginalPreview\", 400,400)'>
";
}
$return .= "</div>";
$return .= "<div align='center' style='padding:2px;'>".$this->ipsclass->adskin->form_textarea("templatebit", $html, $this->ipsclass->vars['tx'], $this->ipsclass->vars['ty'], 'none', "templatebit", $this->default_css )."</div>\n";
$return .= "</div>";
$return .= "<script type='text/javascript'>
var template_id = '{$this->ipsclass->input['id']}';
var template_bit = eval(\"opener.document.theform.txt\"+template_id+\".value\");
document.theform.templatebit.value = template_bit;
var template_bit_ids = 'templatebit';
function saveandclose()
{
eval(\"opener.document.theform.txt\"+template_id+\".value = document.theform.templatebit.value\");
window.close();
}
</script>
";
$return .= $this->html_build_editor_bottom();
$return .= "<br /><div class='tableborder'><div class='catrow2' align='center' style='padding:4px;'><input type='button' onclick='saveandclose()' value='Ñêîïèðîâàòü íàçàä â ñòàíäàðòíîå ïîëå è çàêðûòü îêíî' class='realdarkbutton' /></div></div></form>";
$this->ipsclass->html = $return;
$this->ipsclass->admin->print_popup();
}
//-----------------------------------------
// Build editor preferences menus
//-----------------------------------------
function build_editor_pref_menus()
{
$this->menu_fontchange = "<select name='fontchange' class='smalldropdown'>".
"<option value='monaco'>Monaco</option>".
"<option value='courier'>Courier</option>".
"<option value='verdana'>Verdana</option>".
"<option value='arial'>Arial</option>".
"</select>";
$this->menu_sizechange = "<select name='sizechange' class='smalldropdown'>".
"<option value='8pt'>8 ïóíêòîâ</option>".
"<option value='9pt'>9 ïóíêòîâ</option>".
"<option value='10pt'>10 ïóíêòîâ</option>".
"<option value='11pt'>11 ïóíêòîâ</option>".
"<option value='12pt'>12 ïóíêòîâ</option>".
"</select>";
$this->menu_backchange = "<select name='backchange' class='smalldropdown'>".
"<option value='black'>×åðíûé</option>".
"<option value='white'>Áåëûé</option>".
"<option value='#EEEEEE'>Ñâåòëîñåðûé</option>".
"<option value='gray'>Ñåðûé</option>".
"</select>";
$this->menu_fontcolor = "<select name='fontcolor' class='smalldropdown'>".
"<option value='black'>×åðíûé</option>".
"<option value='white'>Áåëûé</option>".
"<option value='blue'>Ñèíèé</option>".
"<option value='lightgreen'>Ñâåòëîçåëåíûé</option>".
"<option value='green'>Çåëåíûé</option>".
"<option value='darkgreen'>Òåìíîçåëåíûé</option>".
"<option value='gray'>Ñåðûé</option>".
"</select>";
$this->menu_widthchange = "<select name='widthchange' class='smalldropdown'>".
"<option value='100%'>100%</option>".
"<option value='90%'>90%</option>".
"<option value='80%'>80%</option>".
"<option value='70%'>70%</option>".
"<option value='60%'>60%</option>".
"<option value='50%'>50%</option>".
"</select>";
//-----------------------------------------
// Not single?
//-----------------------------------------
if ( $this->type != 'single' AND $this->type != 'multiple' )
{
$this->menu_highchange = "<select name='highchange' class='smalldropdown'>".
"<option value='50px'>50 ïèêñåëåé</option>".
"<option value='100px'>100 ïèêñåëåé</option>".
"<option value='200px'>200 ïèêñåëåé</option>".
"<option value='300px'>300 ïèêñåëåé</option>".
"<option value='400px'>400 ïèêñåëåé</option>".
"<option value='500px'>500 ïèêñåëåé</option>".
"<option value='600px'>600 ïèêñåëåé</option>".
"<option value='700px'>700 ïèêñåëåé</option>".
"<option value='800px'>800 ïèêñåëåé</option>".
"<option value='900px'>900 ïèêñåëåé</option>".
"<option value='1000px'>1000 ïèêñåëåé</option>".
"</select>";
}
else
{
$this->menu_highchange = "<select name='highchange' class='smalldropdown' style='color:gray'><option value='-'>Íåäîñòóïíî</option></span>";
}
if ( $cookie = $this->ipsclass->my_getcookie( 'acpeditorprefs' ) )
{
list( $font, $size, $bg, $fc, $width, $height ) = explode( "," ,$cookie );
}
else
{
//-----------------------------------------
// Decent defaults
//-----------------------------------------
$font = 'monaco';
$size = '8pt';
$bg = 'white';
$fc = 'black';
$width = '100%';
$height = '300px';
}
//-----------------------------------------
// Force decent height if single
//-----------------------------------------
if ( $this->type == 'single' OR $this->type == 'multiple' )
{
$height = '300px';
}
//-----------------------------------------
// Show..
//-----------------------------------------
$this->default_css = "font-family:$font;font-size:$size;color:$fc;background-color:$bg;width:$width;height:$height;border:3px outset #555";
$this->menu_fontchange = preg_replace( "/(option value='".preg_quote($font)."')/" , "\\1 selected='selected'", $this->menu_fontchange );
$this->menu_sizechange = preg_replace( "/(option value='".preg_quote($size)."')/" , "\\1 selected='selected'", $this->menu_sizechange );
$this->menu_backchange = preg_replace( "/(option value='".preg_quote($bg)."')/" , "\\1 selected='selected'", $this->menu_backchange );
$this->menu_fontcolor = preg_replace( "/(option value='".preg_quote($fc)."')/" , "\\1 selected='selected'", $this->menu_fontcolor );
$this->menu_widthchange = preg_replace( "/(option value='".preg_quote($width)."')/" , "\\1 selected='selected'", $this->menu_widthchange );
$this->menu_highchange = preg_replace( "/(option value='".preg_quote($height)."')/" , "\\1 selected='selected'", $this->menu_highchange );
$this->editor_prefs_dropdown = "<div class='fauxbutton' style='padding:4px;color:black;white-space:nowrap;font-weight:bold;float:left' id='tmpl-editor-prefs'>Íàñòðîéêè ðåäàêòîðà <img src='{$this->ipsclass->skin_url}/images/icon_open.gif' border='0' style='vertical-align:top' /></div>";
}
function html_build_editor_top()
{
$this->build_editor_pref_menus();
if ( $this->type == 'single' )
{
return "<input type='hidden' name='changed_bits' id='changed_bits' /><div class='tableborder'><div>";
}
$close_box = $this->type == 'multiple' ? "<input type='button' class='realbutton' style='color:red' onclick='parent.template_edit_close(\"{$template['suid']}\")' value=' X ' />" : '';
return <<<EOF
<div class='tableborder'>
<div class='maintitle' align='left' style='height:30px'>
<div style='float:right'>{$close_box} <!--TOPRIGHT--></div>
<div>{$this->editor_prefs_dropdown}</div>
</div>
<div class='tablepad'><!--BEFORETEXTAREA-->
EOF;
}
function html_build_editor_bottom()
{
return <<<EOF
<script type="text/javascript">
menu_build_menu(
'tmpl-editor-prefs',
new Array( "<table cellpadding='4' cellspacing='0' width='200' border='0'>"+
"<tr>"+
"<td nowrap='nowrap'>Øðèôò</td>"+
"<td width='100%'>{$this->menu_fontchange}</td>"+
"</tr>"+
"<tr>"+
"<td nowrap='nowrap'>Ðàçìåð øðèôòà</td>"+
"<td width='100%'>{$this->menu_sizechange}</td>"+
"</tr>"+
"<tr>"+
"<td nowrap='nowrap'>Öâåò øðèôòà</td>"+
"<td width='100%'>{$this->menu_fontcolor}</td>"+
"</tr>"+
"<tr>"+
"<td nowrap='nowrap'>Ôîí</td>"+
"<td width='100%'>{$this->menu_backchange}</td>"+
"</tr>"+
"<tr>"+
"<td nowrap='nowrap'>Øèðèíà ðåäàêòîðà</td>"+
"<td width='100%'>{$this->menu_widthchange}</td>"+
"</tr>"+
"<tr>"+
"<td nowrap='nowrap'>Âûñîòà ðåäàêòîðà</td>"+
"<td width='100%'>{$this->menu_highchange}</td>"+
"</tr>"+
"<tr>"+
"<td colspan='2' align='center'>"+
"<input type='button' value='Èçìåíèòü!' class='realbutton' onclick=\"menu_action_close(); changefont();\" />"+
"</td>"+
"</tr>"+
"</table>"
) );
</script>
<!--IPB.EDITORBOTTOM--></div>\n</div>
EOF;
}
}
?>
-506
View File
@@ -1,506 +0,0 @@
<?php
/*
+--------------------------------------------------------------------------
| Invision Power Board v2.0.0
| =============================================
| by Matthew Mecham
| (c) 2001 - 2004 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| Time: Tue, 21 Sep 2004 16:34:28 GMT
| Release: 150aa7a702c3c8b6f6eb90ad49305d2f
| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
|
| > Board index functions module
| > Module written by Matt Mecham
| > Date started: 18th November 2003
|
| > Module Version Number: 1.0.0
| > DBA Checked: Fri 21 May 2004
+--------------------------------------------------------------------------
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class boardstats_functions
{
var $class = "";
var $sep_char = "";
var $users_online = "";
var $total_posts = "";
var $total_members = "";
/*-------------------------------------------------------------------------*/
// register_class
// ------------------
// Register a $this-> class with this module
/*-------------------------------------------------------------------------*/
function register_class(&$class)
{
$this->class = $class;
$this->sep_char = '<{ACTIVE_LIST_SEP}>';
}
/*-------------------------------------------------------------------------*/
//
// DISPLAY ACTIVE USERS
//
/*-------------------------------------------------------------------------*/
function active_users()
{
global $DB, $std, $ibforums;
$active = array( 'TOTAL' => 0 ,
'NAMES' => "",
'GUESTS' => 0 ,
'MEMBERS' => 0 ,
'ANON' => 0 ,
);
$stats_html = "";
if ($ibforums->vars['show_active'])
{
if ($ibforums->vars['au_cutoff'] == "")
{
$ibforums->vars['au_cutoff'] = 15;
}
//-----------------------------------------
// Get the users from the DB
//-----------------------------------------
$cut_off = $ibforums->vars['au_cutoff'] * 60;
$time = time() - $cut_off;
$qe = "";
$rows = array( 0 => array( 'login_type' => substr($ibforums->member['login_anonymous'],0, 1),
'running_time' => time(),
'member_id' => $ibforums->member['id'],
'member_name' => $ibforums->member['name'],
'member_group' => $ibforums->member['mgroup'] ) );
if ( $ibforums->member['id'] )
{
$qe = "member_id !=".intval($ibforums->member['id'])." AND ";
}
$DB->simple_construct( array( 'select' => 'id, member_id, member_name, login_type, running_time, member_group',
'from' => 'sessions',
'where' => $qe." running_time > $time",
'order' => "running_time DESC"
) );
$DB->simple_exec();
//-----------------------------------------
// FETCH...
//-----------------------------------------
while ($r = $DB->fetch_row() )
{
$rows[] = $r;
}
//-----------------------------------------
// cache all printed members so we
// don't double print them
//-----------------------------------------
$cached = array();
foreach ( $rows as $result )
{
$last_date = $std->get_time( $result['running_time'] );
//-----------------------------------------
// Bot?
//-----------------------------------------
if ( strstr( $result['id'], '_session' ) )
{
//-----------------------------------------
// Seen bot of this type yet?
//-----------------------------------------
$botname = preg_replace( '/^(.+?)=/', "\\1", $result['id'] );
if ( ! $cached[ $result['member_name'] ] )
{
if ( $ibforums->vars['spider_anon'] )
{
if ( $ibforums->member['mgroup'] == $ibforums->vars['admin_group'] )
{
$active['NAMES'] .= "{$result['member_name']}*{$this->sep_char} \n";
}
}
else
{
$active['NAMES'] .= "{$result['member_name']}{$this->sep_char} \n";
}
$cached[ $result['member_name'] ] = 1;
}
else
{
//-----------------------------------------
// Yup, count others as guest
//-----------------------------------------
$active['GUESTS']++;
}
}
//-----------------------------------------
// Guest?
//-----------------------------------------
else if ($result['member_id'] == 0 )
{
$active['GUESTS']++;
}
//-----------------------------------------
// Member?
//-----------------------------------------
else
{
if ( empty( $cached[ $result['member_id'] ] ) )
{
$cached[ $result['member_id'] ] = 1;
$result['prefix'] = $ibforums->cache['group_cache'][ $result['member_group'] ]['prefix'];
$result['suffix'] = $ibforums->cache['group_cache'][ $result['member_group'] ]['suffix'];
if ($result['login_type'])
{
if ( ($ibforums->member['mgroup'] == $ibforums->vars['admin_group']) and ($ibforums->vars['disable_admin_anon'] != 1) )
{
$active['NAMES'] .= "<a href='{$ibforums->base_url}showuser={$result['member_id']}' title='$last_date'>{$result['prefix']}{$result['member_name']}{$result['suffix']}</a>*{$this->sep_char} \n";
$active['ANON']++;
}
else
{
$active['ANON']++;
}
}
else
{
$active['MEMBERS']++;
$active['NAMES'] .= "<a href='{$ibforums->base_url}showuser={$result['member_id']}' title='$last_date'>{$result['prefix']}{$result['member_name']}{$result['suffix']}</a>{$this->sep_char} \n";
}
}
}
}
$active['NAMES'] = preg_replace( "/".preg_quote($this->sep_char)."$/", "", trim($active['NAMES']) );
$active['TOTAL'] = $active['MEMBERS'] + $active['GUESTS'] + $active['ANON'];
$this->users_online = $active['TOTAL'];
//-----------------------------------------
// Show a link?
//-----------------------------------------
if ($ibforums->vars['allow_online_list'])
{
$active['links'] = $this->class->html->active_user_links();
}
$ibforums->lang['active_users'] = sprintf( $ibforums->lang['active_users'], $ibforums->vars['au_cutoff'] );
return $this->class->html->ActiveUsers($active, $ibforums->vars['au_cutoff']);
}
}
/*-------------------------------------------------------------------------*/
//
// SHOW CALENDAR EVENTS
//
/*-------------------------------------------------------------------------*/
function show_calendar_events()
{
global $DB, $ibforums, $std;
if ($ibforums->vars['show_birthdays'])
{
$a = explode( ',', gmdate( 'Y,n,j,G,i,s', time() + $std->get_time_offset() ) );
$day = $a[2];
$month = $a[1];
$year = $a[0];
$birthstring = "";
$count = 0;
$users = array();
//-----------------------------------------
// Not caching?
//-----------------------------------------
if ( ! $ibforums->vars['cache_calendar'] )
{
$DB->simple_construct( array( 'select' => 'id, name, bday_day, bday_month, bday_year', 'from' => 'members', 'where' => "bday_day=$day and bday_month=$month" ) );
$DB->simple_exec();
while( $r = $DB->fetch_row() )
{
$users[] = $r;
}
}
//-----------------------------------------
// Or caching...
//-----------------------------------------
else
{
if ( count( $ibforums->cache['birthdays'] ) )
{
foreach( $ibforums->cache['birthdays'] as $id => $u )
{
if ( $u['bday_day'] == $day and $u['bday_month'] == $month )
{
$users[] = $u;
}
}
}
}
//-----------------------------------------
// Spin and print...
//-----------------------------------------
foreach ( $users as $id => $user )
{
$birthstring .= "<a href='{$ibforums->base_url}showuser={$user['id']}'>{$user['name']}</a>";
if ($user['bday_year'])
{
$pyear = $year - $user['bday_year'];
$birthstring .= "(<b>$pyear</b>)";
}
$birthstring .= $this->sep_char."\n";
$count++;
}
//-----------------------------------------
// Fix up string...
//-----------------------------------------
$birthstring = preg_replace( "/".$this->sep_char."$/", "", trim($birthstring) );
$lang = $ibforums->lang['no_birth_users'];
if ($count > 0)
{
$lang = ($count > 1) ? $ibforums->lang['birth_users'] : $ibforums->lang['birth_user'];
$stats_html .= $this->class->html->birthdays( $birthstring, $count, $lang );
}
else
{
$count = "";
if ( ! $ibforums->vars['autohide_bday'] )
{
$stats_html .= $this->class->html->birthdays( $birthstring, $count, $lang );
}
}
}
//-----------------------------------------
// Are we viewing the calendar?
//-----------------------------------------
if ($ibforums->vars['show_calendar'])
{
if ($ibforums->vars['calendar_limit'] < 2)
{
$ibforums->vars['calendar_limit'] = 2;
}
$our_unix = mktime( 0, 0, 1, $month, $day, $year);
$max_date = $our_unix + ($ibforums->vars['calendar_limit'] * 86400);
$events = array();
$show_events = array();
//-----------------------------------------
// Not caching?
//-----------------------------------------
if ( ! $ibforums->vars['cache_calendar'] )
{
$DB->simple_construct( array( 'select' => 'eventid, title, read_perms, priv_event, userid, unix_stamp',
'from' => 'calendar_events',
'where' => "unix_stamp > $our_unix and unix_stamp < $max_date",
'order' => 'unix_stamp'
) );
$DB->simple_exec();
while( $r = $DB->fetch_row() )
{
$events[] = $r;
}
}
//-----------------------------------------
// Or caching...
//-----------------------------------------
else
{
if ( count( $ibforums->cache['calendar'] ) )
{
foreach( $ibforums->cache['calendar'] as $id => $u )
{
if ( $u['unix_stamp'] >= $our_unix and $u['unix_stamp'] <= $max_date )
{
$events[] = $u;
}
}
}
}
//-----------------------------------------
// Print...
//-----------------------------------------
foreach( $events as $e => $event )
{
if ($event['priv_event'] == 1 and $ibforums->member['id'] != $event['userid'])
{
continue;
}
//-----------------------------------------
// Do we have permission to see the event?
//-----------------------------------------
if ( $event['read_perms'] != '*' )
{
if ( ! preg_match( "/(^|,)".$ibforums->member['mgroup']."(,|$)/", $event['read_perms'] ) )
{
continue;
}
}
$c_time = date( 'j-F-y', $event['unix_stamp']);
$show_events[] = "<a href='{$ibforums->base_url}act=calendar&amp;code=showevent&amp;eventid={$event['eventid']}' title='$c_time'>".$event['title']."</a>";
}
$ibforums->lang['calender_f_title'] = sprintf( $ibforums->lang['calender_f_title'], $ibforums->vars['calendar_limit'] );
if ( count($show_events) > 0 )
{
$event_string = implode( $this->sep_char.' ', $show_events );
$stats_html .= $this->class->html->calendar_events( $event_string );
}
else
{
if ( ! $ibforums->vars['autohide_calendar'] )
{
$event_string = $ibforums->lang['no_calendar_events'];
$stats_html .= $this->class->html->calendar_events( $event_string );
}
}
}
return $stats_html;
}
/*-------------------------------------------------------------------------*/
//
// SHOW TOTALS
//
/*-------------------------------------------------------------------------*/
function show_totals()
{
global $DB, $ibforums, $std;
if ($ibforums->vars['show_totals'])
{
if ( ! is_array( $ibforums->cache['stats'] ) )
{
$ibforums->cache['stats'] = array();
$DB->simple_exec_query( array( 'delete' => 'cache_store', 'where' => "cs_key='stats'" ) );
$DB->do_insert( 'cache_store', array( 'cs_array' => 1, 'cs_key' => 'stats', 'cs_value' => addslashes(serialize($ibforums->cache['stats'])) ) );
}
$stats = $ibforums->cache['stats'];
//-----------------------------------------
// Update the most active count if needed
//-----------------------------------------
if ($this->users_online > $stats['most_count'])
{
$stats['most_count'] = $this->users_online;
$stats['most_date'] = time();
$DB->do_update( 'cache_store',
array( 'cs_array' => 1, 'cs_value' => addslashes(serialize($stats)) ),
"cs_key='stats'"
);
}
$most_time = $std->get_date( $stats['most_date'], 'LONG' );
$ibforums->lang['most_online'] = str_replace( "<#NUM#>" , $std->do_number_format($stats['most_count']) , $ibforums->lang['most_online'] );
$ibforums->lang['most_online'] = str_replace( "<#DATE#>", $most_time , $ibforums->lang['most_online'] );
$total_posts = $stats['total_replies'] + $stats['total_topics'];
$total_posts = $std->do_number_format($total_posts);
$stats['mem_count'] = $std->do_number_format($stats['mem_count']);
$this->total_posts = $total_posts;
$this->total_members = $stats['mem_count'];
$link = $ibforums->base_url."showuser=".$stats['last_mem_id'];
$ibforums->lang['total_word_string'] = str_replace( "<#posts#>" , "$total_posts" , $ibforums->lang['total_word_string'] );
$ibforums->lang['total_word_string'] = str_replace( "<#reg#>" , $stats['mem_count'] , $ibforums->lang['total_word_string'] );
$ibforums->lang['total_word_string'] = str_replace( "<#mem#>" , $stats['last_mem_name'] , $ibforums->lang['total_word_string'] );
$ibforums->lang['total_word_string'] = str_replace( "<#link#>" , $link , $ibforums->lang['total_word_string'] );
$stats_html .= $this->class->html->ShowStats($ibforums->lang['total_word_string']);
}
return $stats_html;
}
}
?>
-215
View File
@@ -1,215 +0,0 @@
<?php
/*
+--------------------------------------------------------------------------
| Invision Power Board v2.0.0
| =============================================
| by Matthew Mecham
| (c) 2001 - 2004 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| Time: Tue, 21 Sep 2004 16:34:28 GMT
| Release: 150aa7a702c3c8b6f6eb90ad49305d2f
| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
|
| > IPChat functions
| > Script written by Matt Mecham
| > Date started: 29th September 2003
|
+--------------------------------------------------------------------------
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly.";
exit();
}
class chat_functions
{
var $class = "";
var $server = "";
var $html = "";
function chat_functions()
{
global $DB, $std, $ibforums;
$this->server = str_replace( 'http://', '', $ibforums->vars['chat04_whodat_server_addr'] );
}
//-----------------------------------------
// register_class($class)
//
// Register a $this-> with this class
//
//-----------------------------------------
function register_class(&$class)
{
$this->class = $class;
}
//-----------------------------------------
// Print online list
//
//-----------------------------------------
function get_online_list()
{
global $DB, $std, $ibforums;
if ( ! $ibforums->vars['chat04_who_on'] )
{
return;
}
//-----------------------------------------
// Get details from the DB
//-----------------------------------------
$DB->query("SELECT * FROM ibf_cache_store WHERE cs_key='chatstat'");
$row = $DB->fetch_row();
list( $hits, $time ) = explode( '&', $row['cs_extra'] );
//-----------------------------------------
// Do we need to update?
//-----------------------------------------
$final = "";
$time_is_running_out = time();
$member_ids = array();
if ( $time < time() - ( $ibforums->vars['chat04_who_save'] * 60 ) )
//if ( 1 == 1)
{
//-----------------------------------------
// Get service library
//-----------------------------------------
require_once( ROOT_PATH.'retail/chatservice.php' );
$server_url = 'http://'.$CHAT_SERVER[ $ibforums->vars['chat04_servicetype'] ].'/'.$CHAT_ONLINELIST[ $ibforums->vars['chat04_servicetype'] ].$ibforums->vars['chat04_account_no'];
if ( $data = @file( $server_url ) )
{
if ( count($data) > 0 )
{
$hits_left = intval( array_shift($data) );
}
$data = implode( "", $data );
$data = str_replace( "<html>" , "", $data );
$data = str_replace( "</html>", "", $data );
$data = preg_replace( "#^.+?:\s#i", "", strtolower($data) );
$tmp = explode( " ", $data );
$na = array();
if ( is_array( $tmp ) and count ($tmp) )
{
foreach( $tmp as $n )
{
$n = trim( $n );
//-----------------------------------------
// Look for underscore version too?
//-----------------------------------------
if ( strstr( $n, '_' ) )
{
//$n = str_replace( '_', ' ', $n );
}
//-----------------------------------------
// Like?
//-----------------------------------------
if ( strstr( $n, '-' ) )
{
$n = str_replace( '-', '_', $n );
}
$n = str_replace( '"', '&quot;', $n );
$na[] = "lower(name) LIKE '{$n}'";
}
}
$timecutoff = time() - ( 30 * 60 );
$query_string = implode( ' OR ', $na );
if ( $query_string )
{
$DB->query("SELECT m.id, m.name, g.g_id, g.prefix, g.suffix FROM ibf_members m
LEFT JOIN ibf_groups g ON (m.mgroup=g.g_id)
WHERE $query_string AND m.last_activity > $timecutoff ORDER BY m.name");
while ( $m = $DB->fetch_row() )
{
$member_ids[] = "<a href=\"{$ibforums->base_url}showuser={$m['id']}\">{$m['prefix']}{$m['name']}{$m['suffix']}</a>";
}
$final = implode( ",\n", $member_ids );
$final .= '|&|'.intval(count($member_ids));
}
if ( ! $hits_left )
{
$hits_left = 100000;
}
$DB->query("UPDATE ibf_cache_store SET cs_value='".$DB->add_slashes($final)."', cs_extra='{$hits_left}&{$time_is_running_out}' WHERE cs_key='chatstat'");
$row['cs_value'] = $final;
}
}
//-----------------------------------------
// Any members to show?
//-----------------------------------------
$ibforums->vars['chat04_height'] += $ibforums->vars['chat04_poppad'] ? $ibforums->vars['chat04_poppad'] : 50;
$ibforums->vars['chat04_width'] += $ibforums->vars['chat04_poppad'] ? $ibforums->vars['chat04_poppad'] : 50;
$chat_link = ( $ibforums->vars['chat04_display'] == 'self' )
? $this->class->html->whoschatting_inline_link()
: $this->class->html->whoschatting_popup_link();
list ($names, $count) = explode( '|&|', $row['cs_value'] );
if ( $count > 0 )
{
$txt = sprintf( $ibforums->lang['whoschatting_delay'], $ibforums->vars['chat04_who_save'] );
$this->html = $this->class->html->whoschatting_show( intval($count), stripslashes($names), $chat_link, $txt );
}
else
{
if ( ! $ibforums->vars['chat04_hide_whoschatting'] )
{
$this->html = $this->class->html->whoschatting_empty($chat_link);
}
}
return $this->html;
}
}
?>
+521
View File
@@ -0,0 +1,521 @@
<?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: 2006-01-30 18:53:19 +0000 (Mon, 30 Jan 2006) $
| > $Revision: 127 $
| > $Author: bfarber $
+---------------------------------------------------------------------------
|
| > Board index functions module
| > Module written by Matt Mecham
| > Date started: 18th November 2003
|
| > Module Version Number: 1.0.0
| > DBA Checked: Fri 21 May 2004
+--------------------------------------------------------------------------
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Íåêîððåêòíûé àäðåñ</h1>Âû íå èìååòå äîñòóïà ê ýòîìó ôàéëó íàïðÿìóþ. Åñëè âû íåäàâíî îáíîâëÿëè ôîðóì, âû äîëæíû îáíîâèòü âñå ñîîòâåòñòâóþùèå ôàéëû.";
exit();
}
class func_boardstats
{
# Global
var $ipsclass;
var $class = "";
var $sep_char = '<{ACTIVE_LIST_SEP}>';
var $users_online = "";
var $total_posts = "";
var $total_members = "";
/*-------------------------------------------------------------------------*/
// register_class
// ------------------
// Register a $this-> class with this module
/*-------------------------------------------------------------------------*/
function register_class()
{
// NO LONGER NEEDED
}
/*-------------------------------------------------------------------------*/
//
// DISPLAY ACTIVE USERS
//
/*-------------------------------------------------------------------------*/
function active_users()
{
$active = array( 'TOTAL' => 0 ,
'NAMES' => "",
'GUESTS' => 0 ,
'MEMBERS' => 0 ,
'ANON' => 0 ,
);
$stats_html = "";
if ( $this->ipsclass->vars['show_active'] )
{
if ($this->ipsclass->vars['au_cutoff'] == "")
{
$this->ipsclass->vars['au_cutoff'] = 15;
}
//-----------------------------------------
// Get the users from the DB
//-----------------------------------------
$cut_off = $this->ipsclass->vars['au_cutoff'] * 60;
$time = time() - $cut_off;
$rows = array();
$ar_time = time();
if ( $this->ipsclass->member['id'] )
{
$rows = array( $ar_time => array( 'login_type' => substr($this->ipsclass->member['login_anonymous'],0, 1),
'running_time' => $ar_time,
'member_id' => $this->ipsclass->member['id'],
'member_name' => $this->ipsclass->member['members_display_name'],
'member_group' => $this->ipsclass->member['mgroup'] ) );
}
$this->ipsclass->DB->simple_construct( array( 'select' => 'id, member_id, member_name, login_type, running_time, member_group',
'from' => 'sessions',
'where' => "running_time > $time",
//'order' => "running_time DESC" // Sort in PHP to avoid filesort in SQL
) );
$this->ipsclass->DB->simple_exec();
//-----------------------------------------
// FETCH...
//-----------------------------------------
while ( $r = $this->ipsclass->DB->fetch_row() )
{
$rows[ $r['running_time'].'.'.$r['id'] ] = $r;
}
krsort( $rows );
//-----------------------------------------
// cache all printed members so we
// don't double print them
//-----------------------------------------
$cached = array();
foreach ( $rows as $result )
{
$last_date = $this->ipsclass->get_time( $result['running_time'] );
//-----------------------------------------
// Bot?
//-----------------------------------------
if ( strstr( $result['id'], '_session' ) )
{
//-----------------------------------------
// Seen bot of this type yet?
//-----------------------------------------
$botname = preg_replace( '/^(.+?)=/', "\\1", $result['id'] );
if ( ! $cached[ $result['member_name'] ] )
{
if ( $this->ipsclass->vars['spider_anon'] )
{
if ( $this->ipsclass->member['mgroup'] == $this->ipsclass->vars['admin_group'] )
{
$active['NAMES'] .= "{$result['member_name']}*{$this->sep_char} \n";
}
}
else
{
$active['NAMES'] .= "{$result['member_name']}{$this->sep_char} \n";
}
$cached[ $result['member_name'] ] = 1;
}
else
{
//-----------------------------------------
// Yup, count others as guest
//-----------------------------------------
$active['GUESTS']++;
}
}
//-----------------------------------------
// Guest?
//-----------------------------------------
else if ( ! $result['member_id'] )
{
$active['GUESTS']++;
}
//-----------------------------------------
// Member?
//-----------------------------------------
else
{
if ( empty( $cached[ $result['member_id'] ] ) )
{
$cached[ $result['member_id'] ] = 1;
$result['prefix'] = $this->ipsclass->cache['group_cache'][ $result['member_group'] ]['prefix'];
$result['suffix'] = $this->ipsclass->cache['group_cache'][ $result['member_group'] ]['suffix'];
if ($result['login_type'])
{
if ( ($this->ipsclass->member['mgroup'] == $this->ipsclass->vars['admin_group']) and ($this->ipsclass->vars['disable_admin_anon'] != 1) )
{
$active['NAMES'] .= "<a href='{$this->ipsclass->base_url}showuser={$result['member_id']}' title='$last_date'>{$result['prefix']}{$result['member_name']}{$result['suffix']}</a>*{$this->sep_char} \n";
$active['ANON']++;
}
else
{
$active['ANON']++;
}
}
else
{
$active['MEMBERS']++;
$active['NAMES'] .= "<a href='{$this->ipsclass->base_url}showuser={$result['member_id']}' title='$last_date'>{$result['prefix']}{$result['member_name']}{$result['suffix']}</a>{$this->sep_char} \n";
}
}
}
}
$active['NAMES'] = preg_replace( "/".preg_quote($this->sep_char)."$/", "", trim($active['NAMES']) );
$active['TOTAL'] = $active['MEMBERS'] + $active['GUESTS'] + $active['ANON'];
$this->users_online = $active['TOTAL'];
//-----------------------------------------
// Show a link?
//-----------------------------------------
if ($this->ipsclass->vars['allow_online_list'])
{
$active['links'] = $this->ipsclass->compiled_templates['skin_boards']->active_user_links();
}
$this->ipsclass->lang['active_users'] = sprintf( $this->ipsclass->lang['active_users'], $this->ipsclass->vars['au_cutoff'] );
return $this->ipsclass->compiled_templates['skin_boards']->ActiveUsers($active, $this->ipsclass->vars['au_cutoff']);
}
}
/*-------------------------------------------------------------------------*/
//
// SHOW CALENDAR EVENTS
//
/*-------------------------------------------------------------------------*/
function show_calendar_events()
{
if ($this->ipsclass->vars['show_birthdays'] or $this->ipsclass->vars['show_calendar'] )
{
$a = explode( ',', gmdate( 'Y,n,j,G,i,s', time() + $this->ipsclass->get_time_offset() ) );
$day = $a[2];
$month = $a[1];
$year = $a[0];
$birthstring = "";
$count = 0;
$users = array();
if ( $this->ipsclass->vars['show_birthdays'] )
{
if ( is_array($this->ipsclass->cache['birthdays']) AND count( $this->ipsclass->cache['birthdays'] ) )
{
foreach( $this->ipsclass->cache['birthdays'] as $id => $u )
{
if ( $u['bday_day'] == $day and $u['bday_month'] == $month )
{
$users[] = $u;
}
}
}
//-----------------------------------------
// Spin and print...
//-----------------------------------------
foreach ( $users as $id => $user )
{
$birthstring .= "<a href='{$this->ipsclass->base_url}showuser={$user['id']}'>{$user['members_display_name']}</a>";
if ($user['bday_year'])
{
$pyear = $year - $user['bday_year'];
$birthstring .= "(<b>$pyear</b>)";
}
$birthstring .= $this->sep_char."\n";
$count++;
}
//-----------------------------------------
// Fix up string...
//-----------------------------------------
$birthstring = preg_replace( "/".$this->sep_char."$/", "", trim($birthstring) );
$lang = $this->ipsclass->lang['no_birth_users'];
if ($count > 0)
{
$lang = ($count > 1) ? $this->ipsclass->lang['birth_users'] : $this->ipsclass->lang['birth_user'];
$stats_html .= $this->ipsclass->compiled_templates['skin_boards']->birthdays( $birthstring, $count, $lang );
}
else
{
$count = "";
if ( ! $this->ipsclass->vars['autohide_bday'] )
{
$stats_html .= $this->ipsclass->compiled_templates['skin_boards']->birthdays( $birthstring, $count, $lang );
}
}
}
}
//-----------------------------------------
// Are we viewing the calendar?
//-----------------------------------------
if ($this->ipsclass->vars['show_calendar'])
{
$this->ipsclass->vars['calendar_limit'] = intval($this->ipsclass->vars['calendar_limit']) < 2 ? 1 : intval($this->ipsclass->vars['calendar_limit']);
$our_unix = gmmktime( 0, 0, 0, $month, $day, $year);
$max_date = $our_unix + ($this->ipsclass->vars['calendar_limit'] * 86400);
$events = array();
$show_events = array();
if ( is_array($this->ipsclass->cache['calendar']) AND count( $this->ipsclass->cache['calendar'] ) )
{
foreach( $this->ipsclass->cache['calendar'] as $id => $u )
{
$set_offset = 0;
if( $u['event_timeset'] && !($u['event_recurring'] == 0 AND $u['event_unix_to']) )
{
$set_offset = $this->ipsclass->member['time_offset'] * 3600;
}
$u['_unix_from'] = $u['event_unix_from'] - $set_offset;
$u['_unix_to'] = $u['event_unix_to'] - $set_offset;
//-----------------------------------------
// Private?
//-----------------------------------------
if ( $u['event_private'] == 1 and $this->ipsclass->member['id'] != $u['event_member_id'] )
{
continue;
}
//-----------------------------------------
// Got perms?
//-----------------------------------------
if ( $this->ipsclass->check_perms( $u['event_perms'] ) != TRUE )
{
continue;
}
//-----------------------------------------
// Got calendar perms?
//-----------------------------------------
if ( $this->ipsclass->check_perms( $u['_perm_read'] ) != TRUE )
{
continue;
}
//-----------------------------------------
// In range?
//-----------------------------------------
if ( $u['event_recurring'] == 0 AND ( ( $u['event_unix_from'] >= $our_unix AND $u['event_unix_from'] <= $max_date )
OR ( $u['event_unix_to'] = 0 AND $u['event_unix_from'] >= $our_unix AND $u['event_unix_from'] <= $max_date ) ) )
{
$u['event_activetime'] = $u['_unix_from'];
$events[$u['event_unix_from'].$u['event_id']] = $u;
}
elseif( $u['event_recurring'] > 0 )
{
$cust_range_s = $u['event_unix_from'];
while( $cust_range_s < $u['event_unix_to'])
{
if( $cust_range_s >= $our_unix AND $cust_range_s <= $max_date )
{
$u['event_activetime'] = $cust_range_s;
$events[$cust_range_s.$u['event_id']] = $u;
}
if( $u['event_recurring'] == "1" )
{
$cust_range_s += 604800;
}
elseif ( $u['event_recurring'] == "2" )
{
$cust_range_s += 18144000;
}
else
{
$cust_range_s += 31536000;
}
}
}
}
}
//-----------------------------------------
// Print...
//-----------------------------------------
ksort($events);
foreach( $events as $e => $event )
{
//-----------------------------------------
// Recurring?
//-----------------------------------------
$c_time = '';
//if ( ! $event['event_recurring'] )
//{
$c_time = gmdate( 'j-F-y', $event['event_activetime'] );
//}
$show_events[] = "<a href='{$this->ipsclass->base_url}act=calendar&amp;code=showevent&amp;calendar_id={$event['event_calendar_id']}&amp;event_id={$event['event_id']}' title='$c_time'>".$event['event_title']."</a>";
}
$this->ipsclass->lang['calender_f_title'] = sprintf( $this->ipsclass->lang['calender_f_title'], $this->ipsclass->vars['calendar_limit'] );
if ( count($show_events) > 0 )
{
$event_string = implode( $this->sep_char.' ', $show_events );
$stats_html .= $this->ipsclass->compiled_templates['skin_boards']->calendar_events( $event_string );
}
else
{
if ( ! $this->ipsclass->vars['autohide_calendar'] )
{
$event_string = $this->ipsclass->lang['no_calendar_events'];
$stats_html .= $this->ipsclass->compiled_templates['skin_boards']->calendar_events( $event_string );
}
}
}
return $stats_html;
}
/*-------------------------------------------------------------------------*/
//
// SHOW TOTALS
//
/*-------------------------------------------------------------------------*/
function show_totals()
{
if ($this->ipsclass->vars['show_totals'])
{
if ( ! is_array( $this->ipsclass->cache['stats'] ) )
{
$this->ipsclass->cache['stats'] = array();
$this->ipsclass->update_cache( array( 'name' => 'stats', 'array' => 1, 'deletefirst' => 1 ) );
}
$stats =& $this->ipsclass->cache['stats'];
//-----------------------------------------
// Update the most active count if needed
//-----------------------------------------
if ($this->users_online > $stats['most_count'])
{
$stats['most_count'] = $this->users_online;
$stats['most_date'] = time();
$this->ipsclass->update_cache( array( 'name' => 'stats', 'array' => 1, 'deletefirst' => 1 ) );
}
$most_time = $this->ipsclass->get_date( $stats['most_date'], 'LONG' );
$this->ipsclass->lang['most_online'] = str_replace( "<#NUM#>" , $this->ipsclass->do_number_format($stats['most_count']) , $this->ipsclass->lang['most_online'] );
$this->ipsclass->lang['most_online'] = str_replace( "<#DATE#>", $most_time , $this->ipsclass->lang['most_online'] );
$total_posts = $stats['total_replies'] + $stats['total_topics'];
$total_posts = $this->ipsclass->do_number_format($total_posts);
$stats['mem_count'] = $this->ipsclass->do_number_format($stats['mem_count']);
$this->total_posts = $total_posts;
$this->total_members = $stats['mem_count'];
$link = $this->ipsclass->base_url."showuser=".$stats['last_mem_id'];
$this->ipsclass->lang['total_word_string'] = str_replace( "<#posts#>" , "$total_posts" , $this->ipsclass->lang['total_word_string'] );
$this->ipsclass->lang['total_word_string'] = str_replace( "<#reg#>" , $stats['mem_count'] , $this->ipsclass->lang['total_word_string'] );
$this->ipsclass->lang['total_word_string'] = str_replace( "<#mem#>" , $stats['last_mem_name'] , $this->ipsclass->lang['total_word_string'] );
$this->ipsclass->lang['total_word_string'] = str_replace( "<#link#>" , $link , $this->ipsclass->lang['total_word_string'] );
$stats_html .= $this->ipsclass->compiled_templates['skin_boards']->ShowStats($this->ipsclass->lang['total_word_string']);
}
return $stats_html;
}
}
?>
+161
View File
@@ -0,0 +1,161 @@
<?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-24 22:17:00 +0100 (Mon, 24 Oct 2005) $
| > $Revision: 64 $
| > $Author: bfarber $
+---------------------------------------------------------------------------
|
| > IPChat functions
| > Script written by Matt Mecham
| > Date started: 29th September 2003
|
+--------------------------------------------------------------------------
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly.";
exit();
}
class func_chat
{
var $class = "";
var $server = "";
var $html = "";
function func_chat()
{
$this->server = str_replace( 'http://', '', $this->ipsclass->vars['chat04_whodat_server_addr'] );
}
//-----------------------------------------
// register_class($class)
//
// Register a $this-> with this class
//
//-----------------------------------------
function register_class()
{
// NO LONGER NEEDED
}
//-----------------------------------------
// Print online list
//-----------------------------------------
function get_online_list()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$member_ids = array();
$to_load = array();
// Let's use the new config vars if they are available, else revert to the legacy variable names
$_hide_whoschatting = $this->ipsclass->vars['chat_hide_whoschatting'] ? $this->ipsclass->vars['chat_hide_whoschatting'] : $this->ipsclass->vars['chat04_hide_whoschatting'];
$_who_on = $this->ipsclass->vars['chat_who_on'] ? $this->ipsclass->vars['chat_who_on'] : $this->ipsclass->vars['chat04_who_on'];
//-----------------------------------------
// Check
//-----------------------------------------
if ( ! $_who_on )
{
return;
}
//-----------------------------------------
// Sort and show :D
//-----------------------------------------
if ( is_array( $this->ipsclass->cache['chatting'] ) AND count( $this->ipsclass->cache['chatting'] ) )
{
foreach( $this->ipsclass->cache['chatting'] as $id => $data )
{
if ( $data['updated'] < ( time() - 120 ) )
{
continue;
}
$to_load[ $id ] = $id;
}
}
//-----------------------------------------
// Got owt?
//-----------------------------------------
if ( count($to_load) )
{
$this->ipsclass->DB->build_query( array( 'select' => 'id, members_display_name, mgroup',
'from' => 'members',
'where' => "id IN(".implode(",",$to_load).")",
'order' => 'members_display_name' ) );
$this->ipsclass->DB->exec_query();
while ( $m = $this->ipsclass->DB->fetch_row() )
{
$m['prefix'] = $this->ipsclass->cache['group_cache'][ $m['mgroup'] ]['prefix'];
$m['suffix'] = $this->ipsclass->cache['group_cache'][ $m['mgroup'] ]['suffix'];
$member_ids[] = "<a href=\"{$this->ipsclass->base_url}showuser={$m['id']}\">{$m['prefix']}{$m['members_display_name']}{$m['suffix']}</a>";
}
}
//-----------------------------------------
// Got owt?
//-----------------------------------------
if ( count( $member_ids ) )
{
$final = implode( ",\n", $member_ids );
$this->html = $this->ipsclass->compiled_templates['skin_boards']->whoschatting_show( intval(count($member_ids)), $final );
}
else
{
if ( ! $_hide_whoschatting )
{
$this->html = $this->ipsclass->compiled_templates['skin_boards']->whoschatting_empty();
}
}
return $this->html;
}
}
?>
@@ -2,16 +2,28 @@
/*
+--------------------------------------------------------------------------
| Invision Power Board v2.0.0
| Invision Power Board 2.1.7
| =============================================
| by Matthew Mecham
| (c) 2001 - 2004 Invision Power Services, Inc.
| (c) 2001 - 2005 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| Time: Tue, 21 Sep 2004 16:34:28 GMT
| Release: 150aa7a702c3c8b6f6eb90ad49305d2f
| 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 $
+---------------------------------------------------------------------------
|
| > IPChat functions
@@ -40,7 +52,7 @@ class chat_functions
{
global $DB, $std, $ibforums;
$this->server = str_replace( 'http://', '', $ibforums->vars['chat_server_addr'] );
$this->server = str_replace( 'http://', '', $this->ipsclass->vars['chat_server_addr'] );
}
//-----------------------------------------
@@ -64,7 +76,7 @@ class chat_functions
{
global $DB, $std, $ibforums;
if ( ! $ibforums->vars['chat_who_on'] )
if ( ! $this->ipsclass->vars['chat_who_on'] )
{
return;
}
@@ -73,9 +85,9 @@ class chat_functions
// Get details from the DB
//-----------------------------------------
$DB->query("SELECT * FROM ibf_cache_store WHERE cs_key='chatstat'");
$this->ipsclass->DB->query("SELECT * FROM ibf_cache_store WHERE cs_key='chatstat'");
$row = $DB->fetch_row();
$row = $this->ipsclass->DB->fetch_row();
list( $hits, $time ) = explode( '&', $row['cs_extra'] );
@@ -88,9 +100,9 @@ class chat_functions
$member_ids = array();
$new = array();
if ( $time < time() - ( $ibforums->vars['chat_who_save'] * 60 ) )
if ( $time < time() - ( $this->ipsclass->vars['chat_who_save'] * 60 ) )
{
$server_url = 'http://'.$this->server.'/ipc_who.pl?id='.$ibforums->vars['chat_account_no'].'&pw='.$ibforums->vars['chat_pass_md5'];
$server_url = 'http://'.$this->server.'/ipc_who.pl?id='.$this->ipsclass->vars['chat_account_no'].'&pw='.$this->ipsclass->vars['chat_pass_md5'];
if ( $data = @file( $server_url ) )
{
@@ -112,13 +124,13 @@ class chat_functions
if ( count($new) > 0 )
{
$DB->query("SELECT m.id, m.name, m.mgroup FROM ibf_members m
$this->ipsclass->DB->query("SELECT m.id, m.name, m.mgroup FROM ibf_members m
WHERE lower(name) IN (\"".$name_string."\") ORDER BY m.name");
while ( $m = $DB->fetch_row() )
while ( $m = $this->ipsclass->DB->fetch_row() )
{
$g = $ibforums->cache['group_cache'][ $m['mgroup'] ];
$member_ids[] = "<a href=\"{$ibforums->vars['board_url']}/index.{$ibforums->vars['php_ext']}?showuser={$m['id']}\">{$g['prefix']}{$m['name']}{$g['suffix']}</a>";
$g = $this->ipsclass->cache['group_cache'][ $m['mgroup'] ];
$member_ids[] = "<a href=\"{$this->ipsclass->vars['board_url']}/index.{$this->ipsclass->vars['php_ext']}?showuser={$m['id']}\">{$g['prefix']}{$m['name']}{$g['suffix']}</a>";
}
$final = implode( ",\n", $member_ids );
@@ -126,7 +138,7 @@ class chat_functions
$final .= '|&|'.intval(count($member_ids));
}
$DB->query("UPDATE ibf_cache_store SET cs_value='".addslashes($final)."', cs_extra='{$hits_left}&{$time_is_running_out}' WHERE cs_key='chatstat'");
$this->ipsclass->DB->query("UPDATE ibf_cache_store SET cs_value='".addslashes($final)."', cs_extra='{$hits_left}&{$time_is_running_out}' WHERE cs_key='chatstat'");
$row['cs_value'] = $final;
}
@@ -136,10 +148,10 @@ class chat_functions
// Any members to show?
//-----------------------------------------
$ibforums->vars['chat_height'] += $ibforums->vars['chat_poppad'] ? $ibforums->vars['chat_poppad'] : 50;
$ibforums->vars['chat_width'] += $ibforums->vars['chat_poppad'] ? $ibforums->vars['chat_poppad'] : 50;
$this->ipsclass->vars['chat_height'] += $this->ipsclass->vars['chat_poppad'] ? $this->ipsclass->vars['chat_poppad'] : 50;
$this->ipsclass->vars['chat_width'] += $this->ipsclass->vars['chat_poppad'] ? $this->ipsclass->vars['chat_poppad'] : 50;
$chat_link = ( $ibforums->vars['chat_display'] == 'self' )
$chat_link = ( $this->ipsclass->vars['chat_display'] == 'self' )
? $this->class->html->whoschatting_inline_link()
: $this->class->html->whoschatting_popup_link();
@@ -147,12 +159,12 @@ class chat_functions
if ( $count > 0 )
{
$txt = sprintf( $ibforums->lang['whoschatting_delay'], $ibforums->vars['chat_who_save'] );
$txt = sprintf( $this->ipsclass->lang['whoschatting_delay'], $this->ipsclass->vars['chat_who_save'] );
$this->html = $this->class->html->whoschatting_show( intval($count), stripslashes($names), $chat_link, $txt );
}
else
{
if ( ! $ibforums->vars['chat_hide_whoschatting'] )
if ( ! $this->ipsclass->vars['chat_hide_whoschatting'] )
{
$this->html = $this->class->html->whoschatting_empty($chat_link);
}
@@ -2,16 +2,28 @@
/*
+--------------------------------------------------------------------------
| Invision Power Board v2.0.0
| Invision Power Board 2.1.7
| =============================================
| by Matthew Mecham
| (c) 2001 - 2004 Invision Power Services, Inc.
| (c) 2001 - 2005 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| Time: Tue, 21 Sep 2004 16:34:28 GMT
| Release: 150aa7a702c3c8b6f6eb90ad49305d2f
| 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 $
+---------------------------------------------------------------------------
|
| > Task Manager functions ( Digest Library )
@@ -31,8 +43,11 @@ if ( ! defined( 'IN_IPB' ) )
class digest_functions
class func_digest
{
# Global
var $ipsclass;
var $digest_time = 'daily';
var $digest_type = 'topic';
var $root_path = './';
@@ -47,13 +62,11 @@ class digest_functions
//
/*-------------------------------------------------------------------------*/
function digest_functions()
function func_digest_init( $ROOT_PATH )
{
global $DB, $std, $ibforums, $ROOT_PATH;
if ( $ROOT_PATH )
{
$this->root_path = $ROOT_PATH.'/';
$this->root_path = preg_replace( "#/$#", "", $ROOT_PATH ) .'/';
}
else if ( ROOT_PATH )
{
@@ -78,7 +91,7 @@ class digest_functions
$this->last_day = $this->midnight - 86400;
$DB->load_cache_file( $this->root_path.'sources/sql/'.SQL_DRIVER.'_extra_queries.php', 'sql_extra_queries' );
$this->ipsclass->DB->load_cache_file( $this->root_path.'sources/sql/'.SQL_DRIVER.'_extra_queries.php', 'sql_extra_queries' );
//-----------------------------------------
// Load the email libby
@@ -86,6 +99,8 @@ class digest_functions
require_once( $this->root_path.'sources/classes/class_email.php' );
$this->email = new emailer($this->root_path);
$this->email->ipsclass =& $this->ipsclass;
$this->email->email_init();
}
/*-------------------------------------------------------------------------*/
@@ -96,8 +111,6 @@ class digest_functions
function run_digest()
{
global $ibforums, $DB, $std;
$this->last_time = $this->digest_time == 'daily' ? $this->last_day : $this->last_week;
if ( $this->digest_type == 'topic' )
@@ -116,17 +129,15 @@ class digest_functions
function _send_topic_digest()
{
global $ibforums, $DB, $std;
//-----------------------------------------
// Get all posts / topics
//-----------------------------------------
$DB->cache_add_query( 'digest_get_topics', array(
'type' => $this->digest_time,
'last_time' => $this->last_time
), 'sql_extra_queries' );
$topic_query = $DB->cache_exec_query();
$this->ipsclass->DB->cache_add_query( 'digest_get_topics', array(
'type' => $this->digest_time,
'last_time' => $this->last_time
), 'sql_extra_queries' );
$topic_query = $this->ipsclass->DB->cache_exec_query();
//-----------------------------------------
// Now, loop print and send to subscribers
@@ -137,7 +148,7 @@ class digest_functions
$cached = array();
$subject = $this->digest_time == 'daily' ? 'digest_topic_daily' : 'digest_topic_weekly';
while( $t = $DB->fetch_row( $topic_query ) )
while( $t = $this->ipsclass->DB->fetch_row( $topic_query ) )
{
$main_output = "";
$others_posted = 0;
@@ -145,22 +156,22 @@ class digest_functions
if ( ! $cached[ $t['tid'] ] )
{
$topic_title = $t['title'];
$forum_name = $ibforums->cache['forum_cache'][ $t['forum_id'] ]['name'];
$forum_name = $this->ipsclass->cache['forum_cache'][ $t['forum_id'] ]['name'];
//-----------------------------------------
// Get posts...
//-----------------------------------------
$DB->simple_construct( array( 'select' => '*',
$this->ipsclass->DB->simple_construct( array( 'select' => '*',
'from' => 'posts',
'where' => "topic_id={$t['tid']} AND queued=0 AND post_date > {$this->last_time}",
'order' => 'post_date' ) );
$post_query = $DB->simple_exec();
$post_query = $this->ipsclass->DB->simple_exec();
$post_output = "";
while( $p = $DB->fetch_row( $post_query ) )
while( $p = $this->ipsclass->DB->fetch_row( $post_query ) )
{
//-----------------------------------------
// Do we have other posters?
@@ -172,7 +183,7 @@ class digest_functions
}
$post_author = $p['author_name'];
$post_date = $std->get_date( $p['post_date'], 'SHORT' );
$post_date = $this->ipsclass->get_date( $p['post_date'], 'SHORT' );
$post_content = $p['post'];
$post_output .= "\n-------------------------------------------\n"
@@ -213,21 +224,21 @@ class digest_functions
'CONTENT' => $main_output,
) );
$DB->do_insert( 'mail_queue', array( 'mail_to' => $t['email'],
$this->ipsclass->DB->do_insert( 'mail_queue', array( 'mail_to' => $t['email'],
'mail_date' => time(),
'mail_subject' => $this->email->lang_subject,
'mail_content' => $std->txt_safeslashes($this->email->message) ) );
'mail_content' => $this->ipsclass->txt_safeslashes($this->email->message) ) );
}
}
$ibforums->cache['systemvars']['mail_queue'] += $count;
$this->ipsclass->cache['systemvars']['mail_queue'] += $count;
//-----------------------------------------
// Update cache with remaning email count
//-----------------------------------------
$DB->do_update( 'cache_store', array( 'cs_array' => 1, 'cs_value' => addslashes(serialize($ibforums->cache['systemvars'])) ), "cs_key='systemvars'" );
$this->ipsclass->DB->do_update( 'cache_store', array( 'cs_array' => 1, 'cs_value' => addslashes(serialize($this->ipsclass->cache['systemvars'])) ), "cs_key='systemvars'" );
}
/*-------------------------------------------------------------------------*/
@@ -236,16 +247,14 @@ class digest_functions
function _send_forum_digest()
{
global $ibforums, $DB, $std;
//-----------------------------------------
// Get all posts / topics
//-----------------------------------------
$DB->cache_add_query( 'digest_get_forums', array(
'type' => $this->digest_time
), 'sql_extra_queries' );
$forum_query = $DB->simple_exec();
$this->ipsclass->DB->cache_add_query( 'digest_get_forums', array(
'type' => $this->digest_time
), 'sql_extra_queries' );
$forum_query = $this->ipsclass->DB->simple_exec();
//-----------------------------------------
// Now, loop print and send to subscribers
@@ -256,28 +265,28 @@ class digest_functions
$cached = array();
$subject = $this->digest_time == 'daily' ? 'digest_forum_daily' : 'digest_forum_weekly';
while( $t = $DB->fetch_row( $forum_query ) )
while( $t = $this->ipsclass->DB->fetch_row( $forum_query ) )
{
$main_output = "";
$others_posted = 0;
if ( ! $cached[ $t['forum_id'] ] )
{
$forum_name = $ibforums->cache['forum_cache'][ $t['forum_id'] ]['name'];
$forum_name = $this->ipsclass->cache['forum_cache'][ $t['forum_id'] ]['name'];
//-----------------------------------------
// Get topics...
//-----------------------------------------
$DB->cache_add_query( 'digest_get_forums_topics', array(
'forum_id' => $t['forum_id'],
'last_time' => $this->last_time
), 'sql_extra_queries' );
$topic_query = $DB->cache_exec_query();
$this->ipsclass->DB->cache_add_query( 'digest_get_forums_topics', array(
'forum_id' => $t['forum_id'],
'last_time' => $this->last_time
), 'sql_extra_queries' );
$topic_query = $this->ipsclass->DB->cache_exec_query();
$post_output = "";
while( $p = $DB->fetch_row( $topic_query ) )
while( $p = $this->ipsclass->DB->fetch_row( $topic_query ) )
{
//-----------------------------------------
// Do we have other posters?
@@ -289,7 +298,7 @@ class digest_functions
}
$post_author = $p['author_name'];
$post_date = $std->get_date( $p['post_date'], 'SHORT' );
$post_date = $this->ipsclass->get_date( $p['post_date'], 'SHORT' );
$post_content = $p['post'];
$topic_title = $p['title'];
@@ -327,25 +336,25 @@ class digest_functions
$this->email->build_message( array(
'FORUM_ID' => $t['forum_id'],
'NAME' => $t['name'],
'NAME' => $forum_name,
'CONTENT' => $main_output,
) );
$DB->do_insert( 'mail_queue', array( 'mail_to' => $t['email'],
$this->ipsclass->DB->do_insert( 'mail_queue', array( 'mail_to' => $t['email'],
'mail_date' => time(),
'mail_subject' => $this->email->lang_subject,
'mail_content' => $std->txt_safeslashes($this->email->message) ) );
'mail_content' => $this->ipsclass->txt_safeslashes($this->email->message) ) );
}
}
$ibforums->cache['systemvars']['mail_queue'] += $count;
$this->ipsclass->cache['systemvars']['mail_queue'] += $count;
//-----------------------------------------
// Update cache with remaning email count
//-----------------------------------------
$DB->do_update( 'cache_store', array( 'cs_array' => 1, 'cs_value' => addslashes(serialize($ibforums->cache['systemvars'])) ), "cs_key='systemvars'" );
$this->ipsclass->DB->do_update( 'cache_store', array( 'cs_array' => 1, 'cs_value' => addslashes(serialize($this->ipsclass->cache['systemvars'])) ), "cs_key='systemvars'" );
}
@@ -1,17 +1,24 @@
<?php
/*
+--------------------------------------------------------------------------
| Invision Power Board v2.0.0
| ========================================
| Invision Power Board 2.1.7
| =============================================
| by Matthew Mecham
| (c) 2001 - 2004 Invision Power Services
| http://www.ibforums.com
| ========================================
| (c) 2001 - 2005 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| Time: Tue, 21 Sep 2004 16:34:28 GMT
| Release: 150aa7a702c3c8b6f6eb90ad49305d2f
| Email: matt@ibforums.com
| Licence Info: http://www.invisionpower.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)
+---------------------------------------------------------------------------
|
| > Moderator Core Functions
@@ -25,7 +32,7 @@
+--------------------------------------------------------------------------
*/
class modfunctions
class func_mod
{
//-----------------------------------------
// @modfunctions: constructor
@@ -45,13 +52,11 @@ class modfunctions
var $moderator = "";
function modfunctions()
function func_mod()
{
global $ibforums;
$this->error = "";
$this->upload_dir = $ibforums->vars['upload_dir'];
$this->upload_dir = $this->ipsclass->vars['upload_dir'];
return TRUE;
}
@@ -90,8 +95,6 @@ class modfunctions
function post_delete($id)
{
global $std, $ibforums, $DB;
$posts = array();
$attach_tid = array();
$topics = array();
@@ -100,6 +103,8 @@ class modfunctions
if ( is_array( $id ) )
{
$id = $this->ipsclass->clean_int_array( $id );
if ( count($id) > 0 )
{
$pid = " IN(".implode(",",$id).")";
@@ -125,10 +130,10 @@ class modfunctions
// Get Stuff
//-----------------------------------------
$DB->simple_construct( array( 'select' => 'pid, topic_id', 'from' => 'posts', 'where' => 'pid'.$pid ) );
$DB->simple_exec();
$this->ipsclass->DB->simple_construct( array( 'select' => 'pid, topic_id', 'from' => 'posts', 'where' => 'pid'.$pid ) );
$this->ipsclass->DB->simple_exec();
while ( $r = $DB->fetch_row() )
while ( $r = $this->ipsclass->DB->fetch_row() )
{
$posts[ $r['pid'] ] = $r['topic_id'];
$topics[ $r['topic_id'] ] = 1;
@@ -138,20 +143,20 @@ class modfunctions
// Is there an attachment to this post?
//-----------------------------------------
$DB->simple_construct( array( 'select' => '*', 'from' => 'attachments', 'where' => "attach_pid".$pid ) );
$DB->simple_exec();
$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'attachments', 'where' => "attach_pid".$pid ) );
$this->ipsclass->DB->simple_exec();
$attach_ids = array();
while ( $killmeh = $DB->fetch_row( ) )
while ( $killmeh = $this->ipsclass->DB->fetch_row( ) )
{
if ( $killmeh['attach_location'] )
{
@unlink( $ibforums->vars['upload_dir']."/".$killmeh['attach_location'] );
@unlink( $this->ipsclass->vars['upload_dir']."/".$killmeh['attach_location'] );
}
if ( $killmeh['attach_thumb_location'] )
{
@unlink( $ibforums->vars['upload_dir']."/".$killmeh['attach_thumb_location'] );
@unlink( $this->ipsclass->vars['upload_dir']."/".$killmeh['attach_thumb_location'] );
}
$attach_ids[] = $killmeh['attach_id'];
@@ -160,15 +165,16 @@ class modfunctions
if ( count($attach_ids) )
{
$DB->simple_exec_query( array( 'delete' => 'attachments', 'where' => "attach_id IN(".implode(",",$attach_ids).")" ) );
$this->ipsclass->DB->simple_exec_query( array( 'delete' => 'attachments', 'where' => "attach_id IN(".implode(",",$attach_ids).")" ) );
//-----------------------------------------
// Recount topic upload marker
//-----------------------------------------
require_once( ROOT_PATH.'sources/post.php' );
require_once( ROOT_PATH.'sources/classes/post/class_post.php' );
$postlib = new post();
$postlib = new class_post();
$postlib->ipsclass =& $this->ipsclass;
foreach( $attach_tid as $apid => $tid )
{
@@ -180,15 +186,15 @@ class modfunctions
// delete the post
//-----------------------------------------
$DB->simple_exec_query( array( 'delete' => 'posts', 'where' => "pid".$pid ) );
$this->ipsclass->DB->simple_exec_query( array( 'delete' => 'posts', 'where' => "pid".$pid ) );
//-----------------------------------------
// Update the stats
//-----------------------------------------
$ibforums->cache['stats']['total_replies'] -= count($posts);
$this->ipsclass->cache['stats']['total_replies'] -= count($posts);
$std->update_cache( array( 'name' => 'stats', 'array' => 1, 'deletefirst' => 0 ) );
$this->ipsclass->update_cache( array( 'name' => 'stats', 'array' => 1, 'deletefirst' => 0 ) );
//-----------------------------------------
// Update all relevant topics
@@ -199,7 +205,8 @@ class modfunctions
$this->rebuild_topic($tid);
}
$this->add_moderate_log("", "", "", $pid, "Deleted posts ($pid)");
$this->add_moderate_log("", "", "", $pid, "Óäàëåííûå ñîîáùåíèÿ ($pid)");
return TRUE;
}
//-----------------------------------------
@@ -212,18 +219,16 @@ class modfunctions
function rebuild_topic($tid, $doforum=1)
{
global $std, $ibforums, $DB, $forums;
$tid = intval($tid);
//-----------------------------------------
// Get the correct number of replies
//-----------------------------------------
$DB->simple_construct( array( 'select' => 'COUNT(*) as posts', 'from' => 'posts', 'where' => "topic_id=$tid and queued != 1" ) );
$DB->simple_exec();
$this->ipsclass->DB->simple_construct( array( 'select' => 'COUNT(*) as posts', 'from' => 'posts', 'where' => "topic_id=$tid and queued != 1" ) );
$this->ipsclass->DB->simple_exec();
$posts = $DB->fetch_row();
$posts = $this->ipsclass->DB->fetch_row();
$pcount = intval( $posts['posts'] - 1 );
@@ -231,10 +236,10 @@ class modfunctions
// Get the correct number of queued replies
//-----------------------------------------
$DB->simple_construct( array( 'select' => 'COUNT(*) as posts', 'from' => 'posts', 'where' => "topic_id=$tid and queued=1" ) );
$DB->simple_exec();
$this->ipsclass->DB->simple_construct( array( 'select' => 'COUNT(*) as posts', 'from' => 'posts', 'where' => "topic_id=$tid and queued=1" ) );
$this->ipsclass->DB->simple_exec();
$qposts = $DB->fetch_row();
$qposts = $this->ipsclass->DB->fetch_row();
$qpcount = intval( $qposts['posts'] );
@@ -242,48 +247,54 @@ class modfunctions
// Get last post info
//-----------------------------------------
$DB->cache_add_query( 'mod_func_get_last_post', array( 'tid' => $tid ) );
$DB->cache_exec_query();
$this->ipsclass->DB->cache_add_query( 'mod_func_get_last_post', array( 'tid' => $tid ) );
$this->ipsclass->DB->cache_exec_query();
$last_post = $DB->fetch_row();
$last_post = $this->ipsclass->DB->fetch_row();
//-----------------------------------------
// Get first post info
//-----------------------------------------
$DB->simple_construct( array( 'select' => 'post_date, author_id, author_name, pid',
'from' => 'posts',
'where' => "topic_id=$tid",
'order' => 'pid ASC',
'limit' => array(0,1) ) );
$DB->simple_exec();
$this->ipsclass->DB->build_query( array( 'select' => 'p.post_date, p.author_id, p.author_name, p.pid',
'from' => array( 'posts' => 'p' ),
'where' => "p.topic_id=$tid",
'order' => 'p.pid ASC',
'limit' => array(0,1),
'add_join' => array( 0 => array( 'select' => 'm.id, m.members_display_name',
'from' => array( 'members' => 'm' ),
'where' => "p.author_id=m.id",
'type' => 'left' ) )
) );
$first_post = $DB->fetch_row();
$this->ipsclass->DB->exec_query();
$first_post = $this->ipsclass->DB->fetch_row();
//-----------------------------------------
// Get number of attachments
//-----------------------------------------
$DB->cache_add_query( 'mod_func_get_attach_count', array( 'tid' => $tid ) );
$DB->cache_exec_query();
$this->ipsclass->DB->cache_add_query( 'mod_func_get_attach_count', array( 'tid' => $tid ) );
$this->ipsclass->DB->cache_exec_query();
$attach = $DB->fetch_row();
$attach = $this->ipsclass->DB->fetch_row();
//-----------------------------------------
// Update topic
//-----------------------------------------
$DB->do_update( 'topics', array( 'last_post' => $last_post['post_date'],
'last_poster_id' => $last_post['author_id'],
'last_poster_name' => $last_post['author_name'],
'topic_queuedposts' => $qpcount,
'posts' => $pcount,
'starter_id' => $first_post['author_id'],
'starter_name' => $first_post['author_name'],
'start_date' => $first_post['post_date'],
'topic_firstpost' => $first_post['pid'],
'topic_hasattach' => intval($attach['count'])
), 'tid='.$tid );
$this->ipsclass->DB->do_update( 'topics', array( 'last_post' => $last_post['post_date'],
'last_poster_id' => $last_post['author_id'],
'last_poster_name' => $last_post['members_display_name'] ? $last_post['members_display_name'] : $last_post['author_name'],
'topic_queuedposts' => $qpcount,
'posts' => $pcount,
'starter_id' => $first_post['author_id'],
'starter_name' => $first_post['members_display_name'] ? $first_post['members_display_name'] : $first_post['author_name'],
'start_date' => $first_post['post_date'],
'topic_firstpost' => $first_post['pid'],
'topic_hasattach' => intval($attach['count'])
), 'tid='.$tid );
//-----------------------------------------
// Update first post
@@ -291,8 +302,8 @@ class modfunctions
if ( $first_post['new_topic'] != 1 and $first_post['pid'] )
{
$DB->do_shutdown_update( 'posts', array( 'new_topic' => 0 ), 'topic_id='.$tid );
$DB->do_shutdown_update( 'posts', array( 'new_topic' => 1 ), 'pid='.$first_post['pid'] );
$this->ipsclass->DB->do_shutdown_update( 'posts', array( 'new_topic' => 0 ), 'topic_id='.$tid );
$this->ipsclass->DB->do_shutdown_update( 'posts', array( 'new_topic' => 1 ), 'pid='.$first_post['pid'] );
}
//-----------------------------------------
@@ -300,14 +311,14 @@ class modfunctions
// the last post in a forum, best update that :D
//-----------------------------------------
if ( ($forums->forums_by_id[ $last_post['forum_id'] ]['last_id'] == $tid) AND ($doforum == 1) )
if ( ($this->ipsclass->forums->forums_by_id[ $last_post['forum_id'] ]['last_id'] == $tid) AND ($doforum == 1) )
{
$tt = $DB->simple_exec_query( array( 'select' => 'title, tid, last_post, last_poster_id, last_poster_name',
'from' => 'topics',
'where' => 'forum_id='.$last_post['forum_id'].' and approved=1',
'order' => 'last_post desc',
'limit' => array( 0,1 )
) );
$tt = $this->ipsclass->DB->simple_exec_query( array( 'select' => 'title, tid, last_post, last_poster_id, last_poster_name',
'from' => 'topics',
'where' => 'forum_id='.$last_post['forum_id'].' and approved=1',
'order' => 'last_post desc',
'limit' => array( 0,1 )
) );
$dbs = array(
'last_title' => $tt['title'] ? $tt['title'] : "",
@@ -317,7 +328,7 @@ class modfunctions
'last_poster_id' => $tt['last_poster_id'] ? $tt['last_poster_id'] : "",
);
$DB->do_update( 'forums', $dbs, "id=".intval($this->forum['id']) );
$this->ipsclass->DB->do_update( 'forums', $dbs, "id=".intval($this->forum['id']) );
//-----------------------------------------
// Update forum cache
@@ -325,11 +336,12 @@ class modfunctions
foreach( $dbs as $k => $v )
{
$ibforums->cache['forum_cache'][ $this->forum['id'] ][ $k ] = $v;
$this->ipsclass->cache['forum_cache'][ $this->forum['id'] ][ $k ] = $v;
}
$std->update_cache( array( 'name' => 'forum_cache', 'array' => 1, 'deletefirst' => 0 ) );
$this->ipsclass->update_cache( array( 'name' => 'forum_cache', 'array' => 1, 'deletefirst' => 0 ) );
}
return TRUE;
}
//-----------------------------------------
@@ -342,8 +354,6 @@ class modfunctions
function topic_add_reply($post="", $tids=array(), $incpost=0)
{
global $std, $ibforums, $DB;
if ( $post == "" )
{
return FALSE;
@@ -355,14 +365,14 @@ class modfunctions
}
$post = array(
'author_id' => $ibforums->member['id'],
'author_id' => $this->ipsclass->member['id'],
'use_sig' => 1,
'use_emo' => 1,
'ip_address' => $ibforums->input['IP_ADDRESS'],
'ip_address' => $this->ipsclass->input['IP_ADDRESS'],
'post_date' => time(),
'icon_id' => 0,
'post' => $post,
'author_name' => $ibforums->member['name'],
'author_name' => $this->ipsclass->member['members_display_name'],
'topic_id' => "",
'queued' => 0,
);
@@ -391,17 +401,17 @@ class modfunctions
$pa = $post;
$pa['topic_id'] = $tid;
$DB->do_insert( 'posts', $pa );
$this->ipsclass->DB->do_insert( 'posts', $pa );
$ta = array (
'last_poster_id' => $ibforums->member['id'],
'last_poster_name' => $ibforums->member['name'],
'last_poster_id' => $this->ipsclass->member['id'],
'last_poster_name' => $this->ipsclass->member['members_display_name'],
'last_post' => $pa['post_date'],
);
$db_string = $DB->compile_db_update_string( $ta );
$db_string = $this->ipsclass->DB->compile_db_update_string( $ta );
$DB->simple_exec_query( array( 'update' => 'topics', 'set' => $db_string.", posts=posts+1", 'where' => 'tid='.$tid ) );
$this->ipsclass->DB->simple_exec_query( array( 'update' => 'topics', 'set' => $db_string.", posts=posts+1", 'where' => 'tid='.$tid ) );
$add_posts++;
}
@@ -420,9 +430,9 @@ class modfunctions
if ( $add_posts > 0 )
{
$ibforums->cache['stats']['total_replies'] += $add_posts;
$this->ipsclass->cache['stats']['total_replies'] += $add_posts;
$std->update_cache( array( 'name' => 'stats', 'array' => 1, 'deletefirst' => 0 ) );
$this->ipsclass->update_cache( array( 'name' => 'stats', 'array' => 1, 'deletefirst' => 0 ) );
//-----------------------------------------
// Update current members stuff
@@ -445,20 +455,20 @@ class modfunctions
// Are we checking for auto promotion?
//-----------------------------------------
if ($ibforums->member['g_promotion'] != '-1&-1')
if ($this->ipsclass->member['g_promotion'] != '-1&-1')
{
list($gid, $gposts) = explode( '&', $ibforums->member['g_promotion'] );
list($gid, $gposts) = explode( '&', $this->ipsclass->member['g_promotion'] );
if ( $gid > 0 and $gposts > 0 )
{
if ( $ibforums->member['posts'] + $add_posts >= $gposts )
if ( $this->ipsclass->member['posts'] + $add_posts >= $gposts )
{
$mgroup = "mgroup='$gid', ";
}
}
}
$DB->simple_exec_query( array( 'update' => 'members', 'set' => $pcount.$mgroup."last_post=".time(), 'where' => "id=".$ibforums->member['id'] ) );
$this->ipsclass->DB->simple_exec_query( array( 'update' => 'members', 'set' => $pcount.$mgroup."last_post=".time(), 'where' => "id=".$this->ipsclass->member['id'] ) );
}
return TRUE;
@@ -473,11 +483,10 @@ class modfunctions
function topic_close($id)
{
global $ibforums, $DB;
$this->stm_init();
$this->stm_add_close();
$this->stm_exec($id);
return TRUE;
}
@@ -490,11 +499,10 @@ class modfunctions
function topic_open($id)
{
global $ibforums, $DB;
$this->stm_init();
$this->stm_add_open();
$this->stm_exec($id);
return TRUE;
}
//-----------------------------------------
@@ -506,11 +514,10 @@ class modfunctions
function topic_pin($id)
{
global $ibforums, $DB;
$this->stm_init();
$this->stm_add_pin();
$this->stm_exec($id);
return TRUE;
}
//-----------------------------------------
@@ -522,11 +529,10 @@ class modfunctions
function topic_unpin($id)
{
global $ibforums, $DB;
$this->stm_init();
$this->stm_add_unpin();
$this->stm_exec($id);
return TRUE;
}
@@ -539,8 +545,6 @@ class modfunctions
function topic_delete($id, $nostats=0)
{
global $std, $ibforums, $DB;
$posts = array();
$attach = array();
@@ -573,28 +577,28 @@ class modfunctions
// Remove polls assigned to this topic
//-----------------------------------------
$DB->simple_exec_query( array( 'delete' => 'polls', 'where' => "tid".$tid ) );
$this->ipsclass->DB->simple_exec_query( array( 'delete' => 'polls', 'where' => "tid".$tid ) );
//-----------------------------------------
// Remove polls assigned to this topic
//-----------------------------------------
$DB->simple_exec_query( array( 'delete' => 'voters', 'where' => "tid".$tid ) );
$this->ipsclass->DB->simple_exec_query( array( 'delete' => 'voters', 'where' => "tid".$tid ) );
//-----------------------------------------
// Remove polls assigned to this topic
//-----------------------------------------
$DB->simple_exec_query( array( 'delete' => 'topics', 'where' => "tid".$tid ) );
$this->ipsclass->DB->simple_exec_query( array( 'delete' => 'topics', 'where' => "tid".$tid ) );
//-----------------------------------------
// Get PIDS for attachment deletion
//-----------------------------------------
$DB->simple_construct( array( 'select' => 'pid', 'from' => 'posts', 'where' => "topic_id".$tid ) );
$DB->simple_exec();
$this->ipsclass->DB->simple_construct( array( 'select' => 'pid', 'from' => 'posts', 'where' => "topic_id".$tid ) );
$this->ipsclass->DB->simple_exec();
while ( $r = $DB->fetch_row() )
while ( $r = $this->ipsclass->DB->fetch_row() )
{
$posts[] = $r['pid'];
}
@@ -605,18 +609,18 @@ class modfunctions
if ( count( $posts ) )
{
$DB->simple_construct( array( "select" => '*', 'from' => 'attachments', 'where' => "attach_pid IN (".implode(",",$posts).")" ) );
$o = $DB->simple_exec();
$this->ipsclass->DB->simple_construct( array( "select" => '*', 'from' => 'attachments', 'where' => "attach_pid IN (".implode(",",$posts).")" ) );
$o = $this->ipsclass->DB->simple_exec();
while ( $killmeh = $DB->fetch_row( $o ) )
while ( $killmeh = $this->ipsclass->DB->fetch_row( $o ) )
{
if ( $killmeh['attach_location'] )
{
@unlink( $ibforums->vars['upload_dir']."/".$killmeh['attach_location'] );
@unlink( $this->ipsclass->vars['upload_dir']."/".$killmeh['attach_location'] );
}
if ( $killmeh['attach_thumb_location'] )
{
@unlink( $ibforums->vars['upload_dir']."/".$killmeh['attach_thumb_location'] );
@unlink( $this->ipsclass->vars['upload_dir']."/".$killmeh['attach_thumb_location'] );
}
$attach[] = $killmeh['attach_id'];
@@ -624,8 +628,8 @@ class modfunctions
if ( count( $attach ) )
{
$DB->simple_construct( array( 'delete' => 'attachments', 'where' => "attach_id IN (".implode(",",$attach).")" ) );
$DB->simple_exec();
$this->ipsclass->DB->simple_construct( array( 'delete' => 'attachments', 'where' => "attach_id IN (".implode(",",$attach).")" ) );
$this->ipsclass->DB->simple_exec();
}
}
@@ -633,7 +637,7 @@ class modfunctions
// Remove the posts
//-----------------------------------------
$DB->simple_exec_query( array( 'delete' => 'posts', 'where' => "topic_id".$tid ) );
$this->ipsclass->DB->simple_exec_query( array( 'delete' => 'posts', 'where' => "topic_id".$tid ) );
//-----------------------------------------
// Recount forum...
@@ -643,11 +647,13 @@ class modfunctions
{
if ( $this->forum['id'] )
{
$this->ipsclass->forums->forum_by_id[ $this->forum['id'] ]['_update_deletion'] = 1;
$this->forum_recount( $this->forum['id'] );
}
$this->stats_recount();
}
return TRUE;
}
@@ -661,8 +667,6 @@ class modfunctions
function topic_move($topics, $source, $moveto, $leavelink=0)
{
global $std, $ibforums, $DB, $forums;
$this->error = "";
$source = intval($source);
@@ -695,13 +699,13 @@ class modfunctions
// Update the topic
//-----------------------------------------
$DB->do_update( 'topics', array( 'forum_id' => $moveto ), "forum_id=$source AND tid".$tid );
$this->ipsclass->DB->do_update( 'topics', array( 'forum_id' => $moveto ), "forum_id=$source AND tid".$tid );
//-----------------------------------------
// Update the polls
//-----------------------------------------
$DB->do_update( 'polls', array( 'forum_id' => $moveto ), "forum_id=$source AND tid".$tid );
$this->ipsclass->DB->do_update( 'polls', array( 'forum_id' => $moveto ), "forum_id=$source AND tid".$tid );
//-----------------------------------------
// Are we leaving a stink er link?
@@ -709,12 +713,12 @@ class modfunctions
if ( $leavelink != 0 )
{
$DB->simple_construct( array( 'select' => '*', 'from' => 'topics', 'where' => "tid".$tid ) );
$oq = $DB->simple_exec();
$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'topics', 'where' => "tid".$tid ) );
$oq = $this->ipsclass->DB->simple_exec();
while ( $row = $DB->fetch_row($oq) )
while ( $row = $this->ipsclass->DB->fetch_row($oq) )
{
$DB->do_insert( 'topics', array (
$this->ipsclass->DB->do_insert( 'topics', array (
'title' => $row['title'],
'description' => $row['description'],
'state' => 'link',
@@ -739,12 +743,12 @@ class modfunctions
// Sort out subscriptions
//-----------------------------------------
$DB->cache_add_query( 'mod_func_get_topic_tracker', array( 'tid' => $tid ) );
$DB->cache_exec_query();
$this->ipsclass->DB->cache_add_query( 'mod_func_get_topic_tracker', array( 'tid' => $tid ) );
$this->ipsclass->DB->cache_exec_query();
$trid_to_delete = array();
while ( $r = $DB->fetch_row() )
while ( $r = $this->ipsclass->DB->fetch_row() )
{
//-----------------------------------------
// Match the perm group against forum_mask
@@ -759,7 +763,7 @@ class modfunctions
$pass = 0;
$forum_perm_array = explode( ",", $forums->forum_by_id[ $r['forum_id'] ]['read_perms'] );
$forum_perm_array = explode( ",", $this->ipsclass->forums->forum_by_id[ $r['forum_id'] ]['read_perms'] );
foreach( explode( ',', $perm_id ) as $u_id )
{
@@ -777,7 +781,7 @@ class modfunctions
if ( count($trid_to_delete) > 0 )
{
$DB->simple_exec_query( array( 'delete' => 'tracker', 'where' => "trid IN(".implode(',', $trid_to_delete ).")" ) );
$this->ipsclass->DB->simple_exec_query( array( 'delete' => 'tracker', 'where' => "trid IN(".implode(',', $trid_to_delete ).")" ) );
}
return TRUE;
@@ -792,27 +796,26 @@ class modfunctions
function stats_recount()
{
global $ibforums, $DB, $std;
if ( ! is_array($ibforums->cache['stats']) )
if ( ! is_array($this->ipsclass->cache['stats']) )
{
$stats = $DB->simple_exec_query( array( 'select' => '*', 'from' => 'cache_store', 'where' => "cs_key='stats'" ) );
$stats = $this->ipsclass->DB->simple_exec_query( array( 'select' => '*', 'from' => 'cache_store', 'where' => "cs_key='stats'" ) );
$ibforums->cache['stats'] = unserialize(stripslashes($stats['cs_value']));
$this->ipsclass->cache['stats'] = unserialize($this->ipsclass->txt_stripslashes($stats['cs_value']));
}
$topics = $DB->simple_exec_query( array( 'select' => 'COUNT(*) as tcount',
'from' => 'topics',
'where' => 'approved=1' ) );
$topics = $this->ipsclass->DB->simple_exec_query( array( 'select' => 'COUNT(*) as tcount',
'from' => 'topics',
'where' => 'approved=1' ) );
$posts = $DB->simple_exec_query( array( 'select' => 'SUM(posts) as replies',
'from' => 'topics',
'where' => 'approved=1' ) );
$posts = $this->ipsclass->DB->simple_exec_query( array( 'select' => 'SUM(posts) as replies',
'from' => 'topics',
'where' => 'approved=1' ) );
$this->ipsclass->cache['stats']['total_topics'] = $topics['tcount'];
$this->ipsclass->cache['stats']['total_replies'] = $posts['replies'];
$ibforums->cache['stats']['total_topics'] = $topics['tcount'];
$ibforums->cache['stats']['total_replies'] = $posts['replies'];
$std->update_cache( array( 'name' => 'stats', 'array' => 1, 'deletefirst' => 0 ) );
$this->ipsclass->update_cache( array( 'name' => 'stats', 'array' => 1, 'deletefirst' => 0, 'donow' => 1 ) );
return TRUE;
}
@@ -825,8 +828,6 @@ class modfunctions
function forum_recount($fid="")
{
global $ibforums, $DB, $std;
$fid = intval($fid);
if ( ! $fid )
@@ -845,47 +846,47 @@ class modfunctions
// Get the topics..
//-----------------------------------------
$topics = $DB->simple_exec_query( array( 'select' => 'COUNT(*) as count',
'from' => 'topics',
'where' => "approved=1 and forum_id=$fid" ) );
$topics = $this->ipsclass->DB->simple_exec_query( array( 'select' => 'COUNT(*) as count',
'from' => 'topics',
'where' => "approved=1 and forum_id=$fid" ) );
//-----------------------------------------
// Get the QUEUED topics..
//-----------------------------------------
$queued_topics = $DB->simple_exec_query( array( 'select' => 'COUNT(*) as count',
'from' => 'topics',
'where' => "approved=0 and forum_id=$fid" ) );
$queued_topics = $this->ipsclass->DB->simple_exec_query( array( 'select' => 'COUNT(*) as count',
'from' => 'topics',
'where' => "approved=0 and forum_id=$fid" ) );
//-----------------------------------------
// Get the posts..
//-----------------------------------------
$posts = $DB->simple_exec_query( array( 'select' => 'SUM(posts) as replies',
'from' => 'topics',
'where' => "approved=1 and forum_id=$fid" ) );
$posts = $this->ipsclass->DB->simple_exec_query( array( 'select' => 'SUM(posts) as replies',
'from' => 'topics',
'where' => "approved=1 and forum_id=$fid" ) );
//-----------------------------------------
// Get the QUEUED posts..
//-----------------------------------------
$queued_posts = $DB->simple_exec_query( array( 'select' => 'SUM(topic_queuedposts) as replies',
'from' => 'topics',
'where' => "forum_id=$fid" ) );
$queued_posts = $this->ipsclass->DB->simple_exec_query( array( 'select' => 'SUM(topic_queuedposts) as replies',
'from' => 'topics',
'where' => "forum_id=$fid" ) );
//-----------------------------------------
// Get the forum last poster..
//-----------------------------------------
$DB->simple_construct( array( 'select' => 'tid, title, last_poster_id, last_poster_name, last_post',
'from' => 'topics',
'where' => "approved=1 and forum_id=$fid",
'order' => 'last_post DESC',
'limit' => array( 0,1 ) ) );
$this->ipsclass->DB->simple_construct( array( 'select' => 'tid, title, last_poster_id, last_poster_name, last_post',
'from' => 'topics',
'where' => "approved=1 and forum_id=$fid",
'order' => 'last_post DESC',
'limit' => array( 0,1 ) ) );
$DB->simple_exec();
$this->ipsclass->DB->simple_exec();
$last_post = $DB->fetch_row();
$last_post = $this->ipsclass->DB->fetch_row();
//-----------------------------------------
// Reset this forums stats
@@ -902,8 +903,13 @@ class modfunctions
'queued_topics' => intval($queued_topics['count']),
'queued_posts' => intval($queued_posts['replies']),
);
if ( $this->ipsclass->forums->forum_by_id[ $fid ]['_update_deletion'] )
{
$dbs['forum_last_deletion'] = time();
}
$DB->do_update( 'forums', $dbs, "id=".$fid );
$this->ipsclass->DB->do_update( 'forums', $dbs, "id=".$fid );
//-----------------------------------------
// Update forum cache
@@ -911,13 +917,12 @@ class modfunctions
foreach( $dbs as $k => $v )
{
$ibforums->cache['forum_cache'][ $fid ][ $k ] = $v;
$this->ipsclass->cache['forum_cache'][ $fid ][ $k ] = $v;
}
$std->update_cache( array( 'name' => 'forum_cache', 'array' => 1, 'deletefirst' => 0 ) );
$this->ipsclass->update_cache( array( 'name' => 'forum_cache', 'array' => 1, 'deletefirst' => 0 ) );
return TRUE;
}
@@ -944,8 +949,6 @@ class modfunctions
function stm_exec($id)
{
global $ibforums, $DB;
if ( count($this->stm) < 1 )
{
return FALSE;
@@ -961,13 +964,13 @@ class modfunctions
}
}
$db_string = $DB->compile_db_update_string( $final_array );
$db_string = $this->ipsclass->DB->compile_db_update_string( $final_array );
if ( is_array($id) )
{
if ( count($id) > 0 )
{
$DB->simple_exec_query( array( 'update' => 'topics', 'set' => $db_string, 'where' => "tid IN(".implode( ",", $id ).")" ) );
$this->ipsclass->DB->simple_exec_query( array( 'update' => 'topics', 'set' => $db_string, 'where' => "tid IN(".implode( ",", $id ).")" ) );
return TRUE;
}
else
@@ -977,7 +980,7 @@ class modfunctions
}
else if ( intval($id) != "" )
{
$DB->simple_exec_query( array( 'update' => 'topics', 'set' => $db_string, 'where' => "tid=".intval($id) ) );
$this->ipsclass->DB->simple_exec_query( array( 'update' => 'topics', 'set' => $db_string, 'where' => "tid=".intval($id) ) );
}
else
{
@@ -1024,6 +1027,8 @@ class modfunctions
function stm_add_close()
{
$this->stm[] = array( 'state' => 'closed' );
$this->stm[] = array( 'topic_open_time' => 0 );
$this->stm[] = array( 'topic_close_time' => 0 );
return TRUE;
}
@@ -1038,7 +1043,9 @@ class modfunctions
function stm_add_open()
{
$this->stm[] = array( 'state' => 'open' );
$this->stm[] = array( 'topic_open_time' => 0 );
$this->stm[] = array( 'topic_close_time' => 0 );
return TRUE;
}
@@ -1113,10 +1120,10 @@ class modfunctions
// -----------
// Accepts: forum_id, poss_starter_id, poss_topic_state, poss_post_min
// poss_date_expiration, poss_ignore_pin_state
// Returns: NOTHING (TRUE/FALSE)
// Returns: formatted sql query
//-----------------------------------------
function sql_prune_create( $forum_id, $starter_id="", $topic_state="", $post_min="", $date_exp="", $ignore_pin="" )
function sql_prune_create( $forum_id, $starter_id="", $topic_state="", $post_min="", $date_exp="", $ignore_pin="", $pergo=0, $limit=0 )
{
$sql = "SELECT tid FROM ibf_topics WHERE approved=1 and forum_id=".intval($forum_id);
@@ -1146,11 +1153,18 @@ class modfunctions
if ( $ignore_pin != "" )
{
$sql .= " AND pinned <> 1";
$sql .= " AND pinned=0";
}
if ( $pergo )
{
$this->ipsclass->DB->cur_query = $sql;
$this->ipsclass->DB->simple_limit( 0, $pergo );
$sql = $this->ipsclass->DB->cur_query;
$this->ipsclass->DB->flush_query();
}
return $sql;
}
//-----------------------------------------
@@ -1162,13 +1176,11 @@ class modfunctions
function mm_authorize()
{
global $ibforums, $std;
$pass_go = FALSE;
if ( $ibforums->member['id'] )
if ( $this->ipsclass->member['id'] )
{
if ( $ibforums->member['g_is_supmod'] )
if ( $this->ipsclass->member['g_is_supmod'] )
{
$pass_go = TRUE;
}
@@ -1210,21 +1222,20 @@ class modfunctions
function add_moderate_log($fid, $tid, $pid, $t_title, $mod_title='Unknown')
{
global $std, $ibforums, $DB, $HTTP_REFERER, $QUERY_STRING;
$DB->do_insert( 'moderator_logs', array (
$this->ipsclass->DB->do_insert( 'moderator_logs', array (
'forum_id' => $fid,
'topic_id' => $tid,
'post_id' => $pid,
'member_id' => $ibforums->member['id'],
'member_name' => $ibforums->member['name'],
'ip_address' => $ibforums->input['IP_ADDRESS'],
'http_referer'=> $HTTP_REFERER,
'member_id' => $this->ipsclass->member['id'],
'member_name' => $this->ipsclass->member['members_display_name'],
'ip_address' => $this->ipsclass->input['IP_ADDRESS'],
'http_referer'=> $_SERVER['HTTP_REFERER'],
'ctime' => time(),
'topic_title' => $t_title,
'action' => $mod_title,
'query_string'=> $QUERY_STRING,
'query_string'=> $_SERVER['QUERY_STRING'],
) );
return TRUE;
}
File diff suppressed because it is too large. Load diff
@@ -2,16 +2,28 @@
/*
+--------------------------------------------------------------------------
| Invision Power Board v2.0.0
| Invision Power Board 2.1.7
| =============================================
| by Matthew Mecham
| (c) 2001 - 2004 Invision Power Services, Inc.
| (c) 2001 - 2005 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| Time: Tue, 21 Sep 2004 16:34:28 GMT
| Release: 150aa7a702c3c8b6f6eb90ad49305d2f
| 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 $
+---------------------------------------------------------------------------
|
| > Task Manager functions
@@ -25,14 +37,16 @@
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly.";
print "<h1>Íåêîððåêòíûé àäðåñ</h1>Âû íå èìååòå äîñòóïà ê ýòîìó ôàéëó íàïðÿìóþ.";
exit();
}
class task_functions
class func_taskmanager
{
# Global
var $ipsclass;
var $type = 'internal';
var $root_path = './';
var $time_now = 0;
@@ -45,9 +59,9 @@ class task_functions
//
/*-------------------------------------------------------------------------*/
function task_functions()
function func_taskmanager()
{
global $DB, $std, $ibforums, $ROOT_PATH;
global $ROOT_PATH;
if ( $ROOT_PATH )
{
@@ -58,11 +72,10 @@ class task_functions
$this->root_path = ROOT_PATH;
}
if ( $ibforums->input['ck'] )
if ( $_REQUEST['ck'] )
{
$this->type = 'cron';
$this->cron_key = substr( trim($ibforums->input['ck']), 0, 32 );
$this->type = 'cron';
$this->cron_key = addslashes( substr( trim(stripslashes($this->ipsclass->txt_alphanumerical_clean($_REQUEST['ck']))), 0, 32 ) );
}
$this->time_now = time();
@@ -83,8 +96,6 @@ class task_functions
function run_task()
{
global $ibforums, $DB, $std;
if ( $this->type == 'internal' )
{
//-----------------------------------------
@@ -92,12 +103,12 @@ class task_functions
// ... get next job
//-----------------------------------------
$this_task = $DB->simple_exec_query( array( 'select' => '*',
'from' => 'task_manager',
'where' => 'task_enabled = 1 AND task_next_run <= '.$this->time_now,
'order' => 'task_next_run ASC',
'limit' => array(0,1)
) );
$this_task = $this->ipsclass->DB->simple_exec_query( array( 'select' => '*',
'from' => 'task_manager',
'where' => 'task_enabled = 1 AND task_next_run <= '.$this->time_now,
'order' => 'task_next_run ASC',
'limit' => array(0,1)
) );
}
else
{
@@ -105,10 +116,10 @@ class task_functions
// Cron.. load from cron key
//-----------------------------------------
$this_task = $DB->simple_exec_query( array( 'select' => '*',
'from' => 'task_manager',
'where' => "task_cronkey='".$this->cron_key."'",
) );
$this_task = $this->ipsclass->DB->simple_exec_query( array( 'select' => '*',
'from' => 'task_manager',
'where' => "task_cronkey='".$this->cron_key."'",
) );
}
@@ -116,12 +127,35 @@ class task_functions
if ( $this_task['task_id'] )
{
//-----------------------------------------
// Got it, now update row and run..
// Locked?
//-----------------------------------------
if ( $this_task['task_locked'] > 0 )
{
# Yes - now, how long has it been locked for?
# If longer than 30 mins, unlock as something
# has gone wrong.
if ( $this_task['task_locked'] < time() - 1800 )
{
$newdate = $this->generate_next_run($this_task);
$this->ipsclass->DB->do_update( 'task_manager', array( 'task_next_run' => $newdate, 'task_locked' => 0 ), "task_id=".$this_task['task_id'] );
$this->save_next_run_stamp();
}
# Cancel and return
return;
}
//-----------------------------------------
// Got it, now update row, lock and run..
//-----------------------------------------
$newdate = $this->generate_next_run($this_task);
$DB->do_update( 'task_manager', array( 'task_next_run' => $newdate ), "task_id=".$this_task['task_id'] );
$this->ipsclass->DB->do_update( 'task_manager', array( 'task_next_run' => $newdate, 'task_locked' => time() ), "task_id=".$this_task['task_id'] );
$this->save_next_run_stamp();
@@ -132,10 +166,41 @@ class task_functions
$myobj->register_class( $this );
$myobj->pass_task( $this_task );
$myobj->run_task();
//-----------------------------------------
// Any shutdown queries
//-----------------------------------------
$this->ipsclass->DB->return_die = 0;
if ( count( $this->ipsclass->DB->obj['shutdown_queries'] ) )
{
foreach( $this->ipsclass->DB->obj['shutdown_queries'] as $q )
{
$this->ipsclass->DB->query( $q );
}
}
$this->ipsclass->DB->return_die = 1;
$this->ipsclass->DB->obj['shutdown_queries'] = array();
}
}
}
/*-------------------------------------------------------------------------*/
// Unlock task
/*-------------------------------------------------------------------------*/
function unlock_task($task=array())
{
if ( ! $task['task_id'] )
{
return;
}
$this->ipsclass->DB->do_update( 'task_manager', array( 'task_locked' => 0 ), "task_id=".$task['task_id'] );
}
/*-------------------------------------------------------------------------*/
//
@@ -145,9 +210,7 @@ class task_functions
function save_next_run_stamp()
{
global $ibforums, $DB, $std;
$this_task = $DB->simple_exec_query( array( 'select' => 'task_next_run', 'from' => 'task_manager', 'where' => 'task_enabled = 1', 'order' => 'task_next_run ASC', 'limit' => array(0,1) ) );
$this_task = $this->ipsclass->DB->simple_exec_query( array( 'select' => 'task_next_run', 'from' => 'task_manager', 'where' => 'task_enabled = 1', 'order' => 'task_next_run ASC', 'limit' => array(0,1) ) );
if ( ! $this_task['task_next_run'] )
{
@@ -160,13 +223,13 @@ class task_functions
$cache_array = array();
$cache = $DB->simple_exec_query( array( 'select' => '*', 'from' => 'cache_store', 'where' => "cs_key='systemvars'" ) );
$cache = $this->ipsclass->DB->simple_exec_query( array( 'select' => '*', 'from' => 'cache_store', 'where' => "cs_key='systemvars'" ) );
$cache_array = unserialize(stripslashes($cache['cs_value']));
$cache_array['task_next_run'] = $this_task['task_next_run'];
$DB->do_update( 'cache_store', array( 'cs_value' => addslashes(serialize($cache_array)) ), "cs_key='systemvars'" );
$this->ipsclass->DB->do_update( 'cache_store', array( 'cs_value' => addslashes(serialize($cache_array)) ), "cs_key='systemvars'" );
}
/*-------------------------------------------------------------------------*/
@@ -177,8 +240,6 @@ class task_functions
function generate_next_run($task=array())
{
global $ibforums, $DB, $std;
//-----------------------------------------
// Did we set a day?
//-----------------------------------------
@@ -374,8 +435,6 @@ class task_functions
function append_task_log($task,$desc)
{
global $ibforums, $DB, $std;
if ( ! $task['task_log'] )
{
return;
@@ -387,7 +446,7 @@ class task_functions
'log_desc' => $desc
);
$DB->do_insert( 'task_logs', $save );
$this->ipsclass->DB->do_insert( 'task_logs', $save );
}
/*-------------------------------------------------------------------------*/
@@ -2,16 +2,28 @@
/*
+--------------------------------------------------------------------------
| Invision Power Board v2.0.0
| Invision Power Board 2.1.7
| =============================================
| by Matthew Mecham
| (c) 2001 - 2004 Invision Power Services, Inc.
| (c) 2001 - 2005 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| Time: Tue, 21 Sep 2004 16:34:28 GMT
| Release: 150aa7a702c3c8b6f6eb90ad49305d2f
| 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-12-01 16:45:12 +0000 (Thu, 01 Dec 2005) $
| > $Revision: 88 $
| > $Author: bfarber $
+---------------------------------------------------------------------------
|
| > Topic display module
@@ -26,12 +38,15 @@
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
print "<h1>Íåêîððåêòíûé àäðåñ</h1>Âû íå èìååòå äîñòóïà ê ýòîìó ôàéëó íàïðÿìóþ. Åñëè âû íåäàâíî îáíîâëÿëè ôîðóì, âû äîëæíû îáíîâèòü âñå ñîîòâåòñòâóþùèå ôàéëû.";
exit();
}
class topic_display {
class topic_display
{
# Global
var $ipsclass;
var $output = "";
var $base_url = "";
var $html = "";
@@ -60,7 +75,7 @@ class topic_display {
// Register class
/*-------------------------------------------------------------------------*/
function register_class($class="")
function register_class(&$class)
{
$this->lib = &$class;
@@ -76,11 +91,10 @@ class topic_display {
function auto_run()
{
global $ibforums, $forums, $DB, $std, $print, $skin_universal;
require_once( ROOT_PATH.'sources/topics.php' );
require_once( ROOT_PATH.'sources/action_public/topics.php' );
$this->lib = new topics();
$this->lib->ipsclass =& $this->ipsclass;
$this->lib->init();
$this->lib->topic_set_up();
@@ -94,7 +108,7 @@ class topic_display {
if ( ! $this->topic['topic_firstpost'] )
{
$std->boink_it($ibforums->base_url."showtopic=".$this->topic['tid'].'&amp;mode=standard');
$this->ipsclass->boink_it($this->ipsclass->base_url."showtopic=".$this->topic['tid'].'&amp;mode=standard');
}
//-----------------------------------------
@@ -106,27 +120,27 @@ class topic_display {
// Enable quick reply box?
if ( ( $this->topic['quick_reply'] == 1 )
and ( $std->check_perms( $this->topic['reply_perms']) == TRUE )
and ( $this->ipsclass->check_perms( $this->topic['reply_perms']) == TRUE )
and ( $this->topic['state'] != 'closed' ) )
{
$show = "none";
$sqr = $std->my_getcookie("open_qr");
$sqr = $this->ipsclass->my_getcookie("open_qr");
if ( $sqr == 1 )
{
$show = "show";
}
$this->output = str_replace( "<!--IBF.QUICK_REPLY_CLOSED-->", $this->lib->html->quick_reply_box_closed(), $this->output );
$this->output = str_replace( "<!--IBF.QUICK_REPLY_OPEN-->" , $this->lib->html->quick_reply_box_open($this->topic['forum_id'], $this->topic['tid'], $show, $this->md5_check), $this->output );
$this->output = str_replace( "<!--IBF.QUICK_REPLY_CLOSED-->", $this->ipsclass->compiled_templates['skin_topic']->quick_reply_box_closed(), $this->output );
$this->output = str_replace( "<!--IBF.QUICK_REPLY_OPEN-->" , $this->ipsclass->compiled_templates['skin_topic']->quick_reply_box_open($this->topic['forum_id'], $this->topic['tid'], $show, $this->md5_check), $this->output );
}
$this->output = str_replace( "<!--IBF.TOPIC_OPTIONS_CLOSED-->", $this->lib->html->topic_opts_closed(), $this->output );
$this->output = str_replace( "<!--IBF.TOPIC_OPTIONS_OPEN-->" , $this->lib->html->topic_opts_open($this->topic['forum_id'], $this->topic['tid']), $this->output );
$this->output = str_replace( "<!--IBF.TOPIC_OPTIONS_CLOSED-->", $this->ipsclass->compiled_templates['skin_topic']->topic_opts_closed(), $this->output );
$this->output = str_replace( "<!--IBF.TOPIC_OPTIONS_OPEN-->" , $this->ipsclass->compiled_templates['skin_topic']->topic_opts_open($this->topic['forum_id'], $this->topic['tid']), $this->output );
$this->topic['id'] = $this->topic['forum_id'];
$this->output = str_replace( "<!--IBF.FORUM_RULES-->", $std->print_forum_rules($this->topic), $this->output );
$this->output = str_replace( "<!--IBF.FORUM_RULES-->", $this->ipsclass->print_forum_rules($this->topic), $this->output );
//-----------------------------------------
// Topic multi-moderation - yay!
@@ -136,8 +150,8 @@ class topic_display {
// Pass it to our print routine
$print->add_output("$this->output");
$print->do_output( array( 'TITLE' => $ibforums->vars['board_name']." -> {$this->topic['title']}",
$this->ipsclass->print->add_output("$this->output");
$this->ipsclass->print->do_output( array( 'TITLE' => $this->ipsclass->vars['board_name']." -> {$this->topic['title']}",
'JS' => 1,
'NAV' => $this->lib->nav,
) );
@@ -151,32 +165,30 @@ class topic_display {
function display_topic()
{
global $ibforums, $forums, $DB, $std, $print;
//-----------------------------------------
// Grab the posts we'll need
//-----------------------------------------
$first = intval($ibforums->input['st']);
$first = intval($this->ipsclass->input['st']);
$query_type = 'topics_get_posts';
if ( $ibforums->vars['post_order_column'] != 'post_date' )
if ( $this->ipsclass->vars['post_order_column'] != 'post_date' )
{
$ibforums->vars['post_order_column'] = 'pid';
$this->ipsclass->vars['post_order_column'] = 'pid';
}
if ( $ibforums->vars['post_order_sort'] != 'desc' )
if ( $this->ipsclass->vars['post_order_sort'] != 'desc' )
{
$ibforums->vars['post_order_sort'] = 'asc';
$this->ipsclass->vars['post_order_sort'] = 'asc';
}
if ($ibforums->vars['au_cutoff'] == "")
if ($this->ipsclass->vars['au_cutoff'] == "")
{
$ibforums->vars['au_cutoff'] = 15;
$this->ipsclass->vars['au_cutoff'] = 15;
}
if ( $ibforums->vars['custom_profile_topic'] == 1 )
if ( $this->ipsclass->vars['custom_profile_topic'] == 1 )
{
$query_type = 'topics_get_posts_with_join';
}
@@ -187,11 +199,11 @@ class topic_display {
$queued_query_bit = ' and queued=0';
if ( $std->can_queue_posts($this->topic['forum_id']) )
if ( $this->ipsclass->can_queue_posts($this->topic['forum_id']) )
{
$queued_query_bit = '';
if ( $ibforums->input['modfilter'] == 'invisible_posts' )
if ( $this->ipsclass->input['modfilter'] == 'invisible_posts' )
{
$queued_query_bit = ' and queued=1';
}
@@ -210,13 +222,13 @@ class topic_display {
$this->topic['new_mode_start']--;
}
if ( $first + $ibforums->vars['display_max_posts'] > ( $this->topic['posts'] + 1 ) )
if ( $first + $this->ipsclass->vars['display_max_posts'] > ( $this->topic['posts'] + 1 ) )
{
$this->topic['new_mode_end'] = $this->topic['posts'];
}
else
{
$this->topic['new_mode_end'] = $first + ($ibforums->vars['display_max_posts'] - 1);
$this->topic['new_mode_end'] = $first + ($this->ipsclass->vars['display_max_posts'] - 1);
}
if ( $first )
@@ -228,17 +240,17 @@ class topic_display {
// Get PIDS of this page/topic
//-----------------------------------------
$DB->simple_construct( array (
'select' => 'pid',
'from' => 'posts',
'where' => 'topic_id='.$this->topic['tid']. $queued_query_bit,
'order' => 'pid',
'limit' => array( $first, $ibforums->vars['display_max_posts'] )
) );
$this->ipsclass->DB->simple_construct( array (
'select' => 'pid,topic_id',
'from' => 'posts',
'where' => 'topic_id='.$this->topic['tid']. $queued_query_bit,
'order' => 'pid',
'limit' => array( $first, $this->ipsclass->vars['display_max_posts'] )
) );
$DB->simple_exec();
$this->ipsclass->DB->simple_exec();
while( $p = $DB->fetch_row() )
while( $p = $this->ipsclass->DB->fetch_row() )
{
$this->pids[] = $p['pid'];
}
@@ -251,17 +263,18 @@ class topic_display {
$this->lib->topic_view_mode = 'linear';
$DB->simple_construct( array (
'select' => 'pid',
'from' => 'posts',
'where' => 'topic_id='.$this->topic['tid']. $queued_query_bit,
'order' => $ibforums->vars['post_order_column'].' '.$ibforums->vars['post_order_sort'],
'limit' => array( $first, $ibforums->vars['display_max_posts'] )
) );
# We don't need * but if we don't use it, it won't use the correct index
$this->ipsclass->DB->simple_construct( array (
'select' => 'pid,topic_id',
'from' => 'posts',
'where' => 'topic_id='.$this->topic['tid']. $queued_query_bit,
'order' => $this->ipsclass->vars['post_order_column'].' '.$this->ipsclass->vars['post_order_sort'],
'limit' => array( $first, $this->ipsclass->vars['display_max_posts'] )
) );
$DB->simple_exec();
$this->ipsclass->DB->simple_exec();
while( $p = $DB->fetch_row() )
while( $p = $this->ipsclass->DB->fetch_row() )
{
$this->pids[] = $p['pid'];
}
@@ -283,7 +296,7 @@ class topic_display {
$this->pids[] = 0;
}
if ( $ibforums->input['modfilter'] == 'invisible_posts' )
if ( $this->ipsclass->input['modfilter'] == 'invisible_posts' )
{
$this->pids[] = 0;
}
@@ -308,27 +321,27 @@ class topic_display {
// Get posts
//-----------------------------------------
$DB->cache_add_query( $query_type, array( 'pids' => $this->pids, 'scol' => $ibforums->vars['post_order_column'], 'sord' => $ibforums->vars['post_order_sort'] ) );
$this->ipsclass->DB->cache_add_query( $query_type, array( 'pids' => $this->pids, 'scol' => $this->ipsclass->vars['post_order_column'], 'sord' => $this->ipsclass->vars['post_order_sort'] ) );
$oq = $DB->simple_exec();
$oq = $this->ipsclass->DB->simple_exec();
if ( ! $DB->get_num_rows() )
if ( ! $this->ipsclass->DB->get_num_rows() )
{
if ($first >= $ibforums->vars['display_max_posts'])
if ($first >= $this->ipsclass->vars['display_max_posts'])
{
//-----------------------------------------
// AUTO FIX: Get the correct number of replies...
//-----------------------------------------
$DB->simple_construct( array(
'select' => 'COUNT(*) as pcount',
'from' => 'posts',
'where' => "topic_id=".$this->topic['tid']." and queued !=1"
) );
$this->ipsclass->DB->simple_construct( array(
'select' => 'COUNT(*) as pcount',
'from' => 'posts',
'where' => "topic_id=".$this->topic['tid']." and queued !=1"
) );
$newq = $DB->simple_exec();
$newq = $this->ipsclass->DB->simple_exec();
$pcount = $DB->fetch_row($newq);
$pcount = $this->ipsclass->DB->fetch_row($newq);
$pcount['pcount'] = $pcount['pcount'] > 0 ? $pcount['pcount'] - 1 : 0;
@@ -338,17 +351,17 @@ class topic_display {
if ($pcount['pcount'] > 1)
{
$DB->simple_construct( array(
'update' => 'topics',
'set' => "posts=".$pcount['pcount'],
'where' => "tid=".$this->topic['tid']
) );
$this->ipsclass->DB->simple_construct( array(
'update' => 'topics',
'set' => "posts=".$pcount['pcount'],
'where' => "tid=".$this->topic['tid']
) );
$DB->simple_exec();
$this->ipsclass->DB->simple_exec();
}
$std->boink_it($ibforums->base_url."act=ST&f={$this->forum['id']}&t={$this->topic['tid']}&view=getlastpost");
$this->ipsclass->boink_it($this->ipsclass->base_url."act=ST&f={$this->forum['id']}&t={$this->topic['tid']}&view=getlastpost");
}
}
@@ -358,49 +371,53 @@ class topic_display {
if ( $this->lib->topic_view_mode == 'linearplus' and $this->topic['posts'] > 0 )
{
$this->output .= $this->lib->html->topic_page_top_new_mode( array( 'TOPIC' => $this->topic, 'FORUM' => $this->forum ) );
$this->output .= $this->ipsclass->compiled_templates['skin_topic']->topic_page_top( array( 'TOPIC' => $this->topic, 'FORUM' => $this->forum ), 1 );
}
else
{
$this->output .= $this->lib->html->topic_page_top_classic( array( 'TOPIC' => $this->topic, 'FORUM' => $this->forum ) );
$this->output .= $this->ipsclass->compiled_templates['skin_topic']->topic_page_top( array( 'TOPIC' => $this->topic, 'FORUM' => $this->forum ), 0 );
}
//-----------------------------------------
// Format and print out the topic list
//-----------------------------------------
while ( $row = $DB->fetch_row( $oq ) )
while ( $row = $this->ipsclass->DB->fetch_row( $oq ) )
{
$return = $this->lib->parse_row( $row );
$poster = $return['poster'];
$row = $return['row'];
//-----------------------------------------
// Print post row
//-----------------------------------------
$this->output .= $this->ipsclass->compiled_templates['skin_topic']->RenderRow( $row, $poster );
//-----------------------------------------
// Are we giving this bloke a good ignoring?
//-----------------------------------------
if ( $ibforums->member['ignored_users'] )
if ( $this->ipsclass->member['ignored_users'] )
{
if ( strstr( $ibforums->member['ignored_users'], ','.$poster['id'].',' ) and $ibforums->input['p'] != $row['pid'] )
if ( strstr( $this->ipsclass->member['ignored_users'], ','.$poster['id'].',' ) and $this->ipsclass->input['p'] != $row['pid'] )
{
if ( ! strstr( $ibforums->vars['cannot_ignore_groups'], ','.$poster['mgroup'].',' ) )
if ( ! strstr( $this->ipsclass->vars['cannot_ignore_groups'], ','.$poster['mgroup'].',' ) )
{
$this->output .= $this->lib->html->render_row_hidden( $row, $poster );
$this->output .= $this->ipsclass->compiled_templates['skin_topic']->render_row_hidden( $row, $poster );
continue;
}
}
}
$this->output .= $this->lib->html->RenderRow( $row, $poster );
//-----------------------------------------
// Show end first post
//-----------------------------------------
if ( $this->lib->topic_view_mode == 'linearplus' and $this->first_printed == 0 and $row['pid'] == $this->topic['topic_firstpost'] and $this->topic['posts'] > 0)
{
$this->output .= $this->lib->html->topic_end_first_post( array( 'TOPIC' => $this->topic, 'FORUM' => $this->forum ) );
$this->output .= $this->ipsclass->compiled_templates['skin_topic']->topic_end_first_post( array( 'TOPIC' => $this->topic, 'FORUM' => $this->forum ) );
}
}
@@ -409,7 +426,7 @@ class topic_display {
// Print the footer
//-----------------------------------------
$this->output .= $this->lib->html->TableFooter( array( 'TOPIC' => $this->topic, 'FORUM' => $this->forum ), 0, $std->return_md5_check() );
$this->output .= $this->ipsclass->compiled_templates['skin_topic']->TableFooter( array( 'TOPIC' => $this->topic, 'FORUM' => $this->forum ), 0, $this->ipsclass->return_md5_check() );
}
@@ -2,16 +2,28 @@
/*
+--------------------------------------------------------------------------
| Invision Power Board v2.0.0
| Invision Power Board 2.1.7
| =============================================
| by Matthew Mecham
| (c) 2001 - 2004 Invision Power Services, Inc.
| (c) 2001 - 2005 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| Time: Tue, 21 Sep 2004 16:34:28 GMT
| Release: 150aa7a702c3c8b6f6eb90ad49305d2f
| 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-12-01 16:45:12 +0000 (Thu, 01 Dec 2005) $
| > $Revision: 88 $
| > $Author: bfarber $
+---------------------------------------------------------------------------
|
| > Topic Outline Display Module wodule wookie, nookie shut up
@@ -26,12 +38,16 @@
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
print "<h1>Íåêîððåêòíûé àäðåñ</h1>Âû íå èìååòå äîñòóïà ê ýòîìó ôàéëó íàïðÿìóþ. Åñëè âû íåäàâíî îáíîâëÿëè ôîðóì, âû äîëæíû îáíîâèòü âñå ñîîòâåòñòâóþùèå ôàéëû.";
exit();
}
class topic_display {
class topic_display
{
# Global
var $ipsclass;
var $output = "";
var $html = "";
var $forum = array();
@@ -60,7 +76,7 @@ class topic_display {
// Register class
/*-------------------------------------------------------------------------*/
function register_class($class="")
function register_class(&$class)
{
$this->lib = &$class;
@@ -78,15 +94,14 @@ class topic_display {
function auto_run()
{
global $ibforums, $forums, $DB, $std, $print, $skin_universal;
//-----------------------------------------
// Require and init topics.php
//-----------------------------------------
require_once( ROOT_PATH.'sources/topics.php' );
require_once( ROOT_PATH.'sources/action_public/topics.php' );
$this->lib = new topics();
$this->lib->ipsclass =& $this->ipsclass;
$this->lib->init();
$this->lib->topic_set_up();
@@ -102,7 +117,7 @@ class topic_display {
if ( ! $this->topic['topic_firstpost'] )
{
$std->boink_it($ibforums->base_url."showtopic=".$this->topic['tid'].'&amp;mode=standard');
$this->ipsclass->boink_it($this->ipsclass->base_url."showtopic=".$this->topic['tid'].'&amp;mode=standard');
}
$this->display_topic();
@@ -113,12 +128,12 @@ class topic_display {
$this->topic['id'] = $this->topic['forum_id'];
$this->output = str_replace( "<!--IBF.FORUM_RULES-->", $std->print_forum_rules($this->topic), $this->output );
$this->output = str_replace( "<!--IBF.FORUM_RULES-->", $this->ipsclass->print_forum_rules($this->topic), $this->output );
// Pass it to our print routine
$print->add_output("$this->output");
$print->do_output( array( 'TITLE' => $ibforums->vars['board_name']." -> {$this->topic['title']}",
$this->ipsclass->print->add_output("$this->output");
$this->ipsclass->print->do_output( array( 'TITLE' => $this->ipsclass->vars['board_name']." -> {$this->topic['title']}",
'JS' => 1,
'NAV' => $this->lib->nav,
) );
@@ -132,18 +147,16 @@ class topic_display {
function display_topic()
{
global $ibforums, $forums, $DB, $std, $print, $skin_universal;
//-----------------------------------------
// Grab the posts we'll need
//-----------------------------------------
$query_type = 'topics_get_posts';
$first = intval($ibforums->input['start']);
$last = $ibforums->vars['threaded_per_page'] ? $ibforums->vars['threaded_per_page'] : 250;
$first = intval($this->ipsclass->input['start']);
$last = $this->ipsclass->vars['threaded_per_page'] ? $this->ipsclass->vars['threaded_per_page'] : 250;
if ( $ibforums->vars['custom_profile_topic'] == 1 )
if ( $this->ipsclass->vars['custom_profile_topic'] == 1 )
{
$query_type = 'topics_get_posts_with_join';
}
@@ -160,7 +173,7 @@ class topic_display {
$this->structured_pids[ 0 ][] = $this->topic['topic_firstpost'];
}
$DB->simple_construct( array (
$this->ipsclass->DB->simple_construct( array (
'select' => 'pid, post_parent',
'from' => 'posts',
'where' => 'topic_id='.$this->topic['tid']. ' and queued != 1',
@@ -168,9 +181,9 @@ class topic_display {
'limit' => array( $first, $last )
) );
$DB->simple_exec();
$this->ipsclass->DB->simple_exec();
while( $p = $DB->fetch_row() )
while( $p = $this->ipsclass->DB->fetch_row() )
{
$this->pids[] = $p['pid'];
@@ -190,16 +203,16 @@ class topic_display {
if ( count( $this->pids ) )
{
$DB->simple_construct( array (
$this->ipsclass->DB->simple_construct( array (
'select' => 'pid, post, author_id, author_name, post_date, post_title, post_parent, topic_id, icon_id',
'from' => 'posts',
'where' => 'pid IN('.implode(',',$this->pids).')',
'order' => 'pid',
) );
$DB->simple_exec();
$this->ipsclass->DB->simple_exec();
while( $p = $DB->fetch_row() )
while( $p = $this->ipsclass->DB->fetch_row() )
{
if ( ! $p['post_parent'] and $p['pid'] != $this->topic['topic_firstpost'] )
{
@@ -224,7 +237,7 @@ class topic_display {
// Are we viewing Posts?
//-----------------------------------------
$post_id = intval($ibforums->input['pid']);
$post_id = intval($this->ipsclass->input['pid']);
$postid_array = array( 1 => $post_id );
@@ -254,7 +267,7 @@ class topic_display {
$postid_array[0] = $this->topic['topic_firstpost'];
$DB->cache_add_query( $query_type, array( 'pids' => $postid_array, 'scol' => 'pid', 'sord' => 'asc') );
$this->ipsclass->DB->cache_add_query( $query_type, array( 'pids' => $postid_array, 'scol' => 'pid', 'sord' => 'asc') );
}
else
{
@@ -262,7 +275,7 @@ class topic_display {
// Just get root
//-----------------------------------------
$DB->cache_add_query( $query_type, array( 'pids' => array( 0 => $this->topic['topic_firstpost'] ) ) );
$this->ipsclass->DB->cache_add_query( $query_type, array( 'pids' => array( 0 => $this->topic['topic_firstpost'] ) ) );
}
//-----------------------------------------
@@ -275,17 +288,17 @@ class topic_display {
// Render the original post
//-----------------------------------------
$this->output .= $this->lib->html->topic_page_top_new_mode( array( 'TOPIC' => $this->topic, 'FORUM' => $this->forum ) );
$this->output .= $this->ipsclass->compiled_templates['skin_topic']->topic_page_top( array( 'TOPIC' => $this->topic, 'FORUM' => $this->forum ), 1 );
$DB->simple_exec();
$this->ipsclass->DB->simple_exec();
//-----------------------------------------
// Format and print out the topic list
//-----------------------------------------
$num_rows = $DB->get_num_rows();
$num_rows = $this->ipsclass->DB->get_num_rows();
while ( $row = $DB->fetch_row() )
while ( $row = $this->ipsclass->DB->fetch_row() )
{
$return = $this->lib->parse_row( $row );
@@ -296,28 +309,28 @@ class topic_display {
// Are we giving this bloke a good ignoring?
//-----------------------------------------
if ( $ibforums->member['ignored_users'] )
if ( $this->ipsclass->member['ignored_users'] )
{
if ( strstr( $ibforums->member['ignored_users'], ','.$poster['id'].',' ) and $ibforums->input['p'] != $row['pid'] )
if ( strstr( $this->ipsclass->member['ignored_users'], ','.$poster['id'].',' ) and $this->ipsclass->input['p'] != $row['pid'] )
{
if ( ! strstr( $ibforums->vars['cannot_ignore_groups'], ','.$poster['mgroup'].',' ) )
if ( ! strstr( $this->ipsclass->vars['cannot_ignore_groups'], ','.$poster['mgroup'].',' ) )
{
$this->output .= $this->lib->html->render_row_hidden( $row, $poster );
$this->output .= $this->ipsclass->compiled_templates['skin_topic']->render_row_hidden( $row, $poster );
continue;
}
}
}
$this->output .= $this->lib->html->RenderRow( $row, $poster );
$this->output .= $this->ipsclass->compiled_templates['skin_topic']->RenderRow( $row, $poster );
if ( ! $this->printed and $num_rows > 1 )
{
$this->output .= $this->lib->html->topic_end_first_post( array( 'TOPIC' => $this->topic, 'FORUM' => $this->forum ), 1 );
$this->output .= $this->ipsclass->compiled_templates['skin_topic']->topic_end_first_post( array( 'TOPIC' => $this->topic, 'FORUM' => $this->forum ), 1 );
$this->printed = 1;
}
}
$this->output .= $this->lib->html->topic_end_outline( array( 'TOPIC' => $this->topic, 'FORUM' => $this->forum ) );
$this->output .= $this->ipsclass->compiled_templates['skin_topic']->topic_end_outline( array( 'TOPIC' => $this->topic, 'FORUM' => $this->forum ) );
//-----------------------------------------
// Sort out pagination
@@ -326,11 +339,11 @@ class topic_display {
$total_replies = $this->topic['posts'];
$show_replies = count( $this->structured_pids) - 1;
$this->topic['threaded_pages'] = $std->build_pagelinks( array( 'TOTAL_POSS' => $total_replies,
$this->topic['threaded_pages'] = $this->ipsclass->build_pagelinks( array( 'TOTAL_POSS' => $total_replies,
'PER_PAGE' => $last,
'CUR_ST_VAL' => $ibforums->input['start'],
'CUR_ST_VAL' => $this->ipsclass->input['start'],
'L_SINGLE' => "",
'BASE_URL' => $ibforums->base_url."showtopic=".$this->topic['tid'],
'BASE_URL' => $this->ipsclass->base_url."showtopic=".$this->topic['tid'],
'USE_ST' => 'start'
) );
@@ -338,13 +351,13 @@ class topic_display {
// START GETTING THE OUTLINE LIST
//-----------------------------------------
$this->output .= $this->lib->html->toutline_start_list();
$this->output .= $this->ipsclass->compiled_templates['skin_topic']->toutline_start_list();
$this->output .= $this->loop_get_children();
$this->output .= $this->lib->html->toutline_end_list($this->topic['threaded_pages']);
$this->output .= $this->ipsclass->compiled_templates['skin_topic']->toutline_end_list($this->topic['threaded_pages']);
$this->output .= $this->lib->html->TableFooter( array( 'TOPIC' => $this->topic, 'FORUM' => $this->forum ), 1, $std->return_md5_check() );
$this->output .= $this->ipsclass->compiled_templates['skin_topic']->TableFooter( array( 'TOPIC' => $this->topic, 'FORUM' => $this->forum ), 1, $this->ipsclass->return_md5_check() );
}
@@ -354,15 +367,13 @@ class topic_display {
function loop_get_children($root_id=0, $html="" ,$dguide=-1)
{
global $DB, $ibforums, $std, $forums;
$dguide++;
if ( is_array( $this->structured_pids[ $root_id ] ) )
{
if ( count( $this->structured_pids[ $root_id ] ) )
{
$html .= $this->lib->html->toutline_start_new_parent();
$html .= $this->ipsclass->compiled_templates['skin_topic']->toutline_start_new_parent();
foreach( $this->structured_pids[ $root_id ] as $idx => $pid )
{
@@ -371,7 +382,7 @@ class topic_display {
$html = $this->loop_get_children( $pid, $html, $dguide );
}
$html .= $this->lib->html->toutline_end_new_parent();
$html .= $this->ipsclass->compiled_templates['skin_topic']->toutline_end_new_parent();
}
}
@@ -385,11 +396,9 @@ class topic_display {
function render_list_row( $post, $depth=0 )
{
global $DB, $ibforums, $std, $forums;
$post['depthguide'] = "";
$ibforums->vars['post_showtext_notitle'] = 1;
$this->ipsclass->vars['post_showtext_notitle'] = 1;
for( $i = 1 ; $i < $depth; $i++ )
{
@@ -416,7 +425,7 @@ class topic_display {
if ( ! $post['post_title'] )
{
if ( $ibforums->vars['post_showtext_notitle'] )
if ( $this->ipsclass->vars['post_showtext_notitle'] )
{
$post_text = $this->lib->parser->strip_all_tags( $post['post'] );
@@ -442,9 +451,9 @@ class topic_display {
}
$post['linked_name'] = $std->make_profile_link( $post['author_name'], $post['author_id'] );
$post['linked_name'] = $this->ipsclass->make_profile_link( $post['author_name'], $post['author_id'] );
$post['formatted_date'] = $std->get_date( $post['post_date'], 'LONG' );
$post['formatted_date'] = $this->ipsclass->get_date( $post['post_date'], 'LONG' );
$post['new_post'] = '<img src="style_images/<#IMG_DIR#>/to_post_off.gif" />';
@@ -457,11 +466,11 @@ class topic_display {
if ( strstr( $this->used_post_ids, ','.$post['pid'].',' ) )
{
return $this->lib->html->toutline_show_row_highlight( $post );
return $this->ipsclass->compiled_templates['skin_topic']->toutline_show_row_highlight( $post );
}
else
{
return $this->lib->html->toutline_show_row( $post );
return $this->ipsclass->compiled_templates['skin_topic']->toutline_show_row( $post );
}
}
File diff suppressed because it is too large. Load diff
+15 -1
View File
@@ -1 +1,15 @@
<html>␍<head><title>Invision Power Board - Bulletin Board System</title></head>␍<body>␍<h1>403: Invision Power Board -> Forbidden</h1>␍<hr>␍You have reached this Page in error, please use␍your back button to return to Invision Board.␍<hr>␍<a href="http://www.invisionboard.com/">Invision Power Board</a>␍</body>␍</html>␍
<html>
<head><title>Ошибка &lt; Русская версия Invision Power Board</title></head>
<body>
<h1>Ошибка &lt; Русская версия Invision Power Board</h1>
<hr>
Вы попали на несуществующую страницу!<br>Пожалуйста нажмите на кнопочку &laquo;<b>Назад</b>&raquo;
в вашем браузере для возвращения на предыдущую страницу.
<hr>
<b>Invision Power Board:</b>
<ul>
<li><a href="http://www.bestwarez.ru" title="BestWarez.Ru - Только лучший Варез!">Русская версия</a></li>
<li><a href="http://www.invisionboard.com" title="Official Site">English version</a></li>
</ul>
</body>
</html>
-511
View File
@@ -1,511 +0,0 @@
<?php
/*
+--------------------------------------------------------------------------
| Invision Power Board v2.0.0
| =============================================
| by Matthew Mecham
| (c) 2001 - 2004 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| Time: Tue, 21 Sep 2004 16:34:28 GMT
| Release: 150aa7a702c3c8b6f6eb90ad49305d2f
| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
|
| > Edit post library
| > Module written by Matt Mecham
| > Date started: 19th February 2002
|
| > Module Version Number: 1.0.0
| > DBA Checked: Fri 21 May 2004
+--------------------------------------------------------------------------
*/
class post_functions extends Post {
var $nav = array();
var $title = "";
var $post = array();
var $topic = array();
var $upload = array();
var $moderator = array( 'member_id' => 0, 'member_name' => "", 'edit_post' => 0 );
var $orig_post = array();
var $edit_title = 0;
var $post_key = "";
var $class = "";
function post_functions($class)
{
global $ibforums, $std, $DB;
$this->class = $class;
//-----------------------------------------
// Lets load the topic from the database before we do anything else.
//-----------------------------------------
$DB->simple_construct( array( 'select' => '*', 'from' => 'topics', 'where' => "tid=".intval($ibforums->input['t']) ) );
$DB->simple_exec();
$this->topic = $DB->fetch_row();
//-----------------------------------------
// Is it legitimate?
//-----------------------------------------
if (! $this->topic['tid'])
{
$std->Error( array( LEVEL => 1, MSG => 'missing_files') );
}
//-----------------------------------------
// Load the old post
//-----------------------------------------
$DB->simple_construct( array( 'select' => '*', 'from' => 'posts', 'where' => "pid=".intval($ibforums->input['p']) ) );
$DB->simple_exec();
$this->orig_post = $DB->fetch_row();
if (! $this->orig_post['pid'])
{
$std->Error( array( LEVEL => 1, MSG => 'missing_files') );
}
//-----------------------------------------
// Generate post key (do we have one?)
//-----------------------------------------
if ( ! $this->orig_post['post_key'] )
{
//-----------------------------------------
// Generate one and save back to post and attachment
// to ensure 1.3 < compatibility
//-----------------------------------------
$this->post_key = md5(microtime());
$DB->do_update( 'posts', array( 'post_key' => $this->post_key ), 'pid='.$this->orig_post['pid'] );
$DB->do_update( 'attachments', array( 'attach_post_key' => $this->post_key ), 'attach_pid='.$this->orig_post['pid'] );
}
else
{
$this->post_key = $this->orig_post['post_key'];
}
//-----------------------------------------
// Load the moderator
//-----------------------------------------
if ($ibforums->member['id'])
{
$DB->simple_construct( array( 'select' => 'member_id, member_name, mid, edit_post, edit_topic',
'from' => 'moderators',
'where' => "forum_id=".$this->class->forum['id']." AND (member_id='".$ibforums->member['id']."' OR (is_group=1 AND group_id='".$ibforums->member['mgroup']."'))" ) );
$DB->simple_exec();
$this->moderator = $DB->fetch_row();
}
//-----------------------------------------
// Lets do some tests to make sure that we are
// allowed to edit this topic
//-----------------------------------------
$can_edit = 0;
if ($ibforums->member['g_is_supmod'])
{
$can_edit = 1;
}
if ($this->moderator['edit_post'])
{
$can_edit = 1;
}
if ( ($this->orig_post['author_id'] == $ibforums->member['id']) and ($ibforums->member['g_edit_posts']) )
{
// Have we set a time limit?
if ($ibforums->member['g_edit_cutoff'] > 0)
{
if ( $this->orig_post['post_date'] > ( time() - ( intval($ibforums->member['g_edit_cutoff']) * 60 ) ) )
{
$can_edit = 1;
}
}
else
{
$can_edit = 1;
}
}
if ($can_edit != 1)
{
$std->Error( array( LEVEL => 1, MSG => 'not_op') );
}
//-----------------------------------------
// Check access
//-----------------------------------------
$this->class->check_for_edit($this->topic);
//-----------------------------------------
// // Do we have edit topic abilities?
//-----------------------------------------
if ( $this->orig_post['new_topic'] == 1 )
{
if ($ibforums->member['g_is_supmod'] == 1)
{
$this->edit_title = 1;
}
else if ($this->moderator['edit_topic'] == 1)
{
if ( $ibforums->member['id'] == $this->topic['starter_id'] )
{
$this->edit_title = 1;
}
}
else if ($ibforums->member['g_edit_topic'] == 1 )
{
$this->edit_title = 1;
}
}
}
/*-------------------------------------------------------------------------*/
// MAIN PROCESS FUNCTION
/*-------------------------------------------------------------------------*/
function process()
{
global $ibforums, $std, $DB, $print;
//-----------------------------------------
// Did we remove an attachment?
//-----------------------------------------
if ( $ibforums->input['removeattachid'] )
{
if ( $ibforums->input[ 'removeattach_'. $ibforums->input['removeattachid'] ] )
{
$this->class->pf_remove_attachment( intval($ibforums->input['removeattachid']), $this->post_key );
$this->show_form();
}
}
//-----------------------------------------
// Did we add an attachment?
//-----------------------------------------
if ( $ibforums->input['attachgo'] )
{
$this->class->obj['post_errors'] = "";
$this->upload_id = $this->class->process_upload();
$this->show_form();
}
//-----------------------------------------
// Parse the post, and check for any errors.
// overwrites saved post intentionally
//-----------------------------------------
$this->post = $this->class->compile_post();
if ($this->class->obj['post_errors'] == "")
{
$this->upload = $this->class->process_upload();
}
if ( ($this->class->obj['post_errors'] != "") or ($this->class->obj['preview_post'] != "") )
{
//-----------------------------------------
// Show the form again
//-----------------------------------------
$this->show_form($class);
}
else
{
$this->complete_edit($class);
}
}
/*-------------------------------------------------------------------------*/
// COMPLETE EDIT THINGY
/*-------------------------------------------------------------------------*/
function complete_edit($class)
{
global $ibforums, $std, $DB, $print;
$time = $std->get_date( time(), 'LONG' );
//-----------------------------------------
// Reset some data
//-----------------------------------------
$this->post['ip_address'] = $this->orig_post['ip_address'];
$this->post['topic_id'] = $this->orig_post['topic_id'];
$this->post['author_id'] = $this->orig_post['author_id'];
$this->post['pid'] = $this->orig_post['pid'];
$this->post['post_date'] = $this->orig_post['post_date'];
$this->post['author_name'] = $this->orig_post['author_name'];
$this->post['queued'] = $this->orig_post['queued'];
$this->post['edit_time'] = time();
$this->post['edit_name'] = $ibforums->member['name'];
//-----------------------------------------
// If the post icon has changed, update the topic post icon
//-----------------------------------------
if ($this->orig_post['new_topic'] == 1)
{
if ($this->post['icon_id'] != $this->orig_post['icon_id'])
{
$DB->do_update( 'topics', array( 'icon_id' => $this->post['icon_id'] ), 'tid='.$this->topic['tid'] );
}
}
//-----------------------------------------
// Update topic title?
//-----------------------------------------
if ( $this->edit_title == 1 )
{
$ibforums->input['TopicTitle'] = $this->class->pf_clean_topic_title( $ibforums->input['TopicTitle'] );
$ibforums->input['TopicTitle'] = trim( $this->class->parser->bad_words( $ibforums->input['TopicTitle'] ) );
$ibforums->input['TopicDesc'] = trim( $this->class->parser->bad_words( $ibforums->input['TopicDesc'] ) );
if ( $ibforums->input['TopicTitle'] != "" )
{
if ( ($ibforums->input['TopicTitle'] != $this->topic['title']) or ($ibforums->input['TopicDesc'] != $this->topic['description']) )
{
$DB->do_update( 'topics', array( 'title' => $ibforums->input['TopicTitle'],
'description' => $ibforums->input['TopicDesc']
) , "tid=".$this->topic['tid']
);
if ($this->topic['tid'] == $this->class->forum['last_id'])
{
$DB->do_update( 'forums', array( 'last_title' => $ibforums->input['TopicTitle'] ), 'id='.$this->class->forum['id'] );
$std->update_forum_cache();
}
if ( ($this->moderator['edit_topic'] == 1) OR ( $ibforums->member['g_is_supmod'] == 1 ) )
{
$DB->do_insert( 'moderator_logs', array (
'forum_id' => $this->class->forum['id'],
'topic_id' => $this->topic['tid'],
'post_id' => $this->post['pid'],
'member_id' => $ibforums->member['id'],
'member_name' => $ibforums->member['name'],
'ip_address' => $ibforums->input['IP_ADDRESS'],
'http_referer'=> $HTTP_REFERER,
'ctime' => time(),
'topic_title' => $this->topic['title'],
'action' => "Edited topic title or description '{$this->topic['title']}' to '{$ibforums->input['TopicTitle']}' via post form",
'query_string'=> $QUERY_STRING,
) );
}
}
}
}
//-----------------------------------------
// Update the database (ib_forum_post)
//-----------------------------------------
$this->post['append_edit'] = 1;
if ($ibforums->member['g_append_edit'])
{
if ($ibforums->input['add_edit'] != 1)
{
$this->post['append_edit'] = 0;
}
}
$db_string = $DB->compile_db_update_string( $this->post );
$DB->do_update( 'posts', $this->post, 'pid='.$this->post['pid'] );
//-----------------------------------------
// Make attachments "permanent"
//-----------------------------------------
$this->class->pf_make_attachments_permanent($this->post_key, $this->topic['tid'], $this->post['pid']);
//-----------------------------------------
// Make sure paperclip symbol is OK
//-----------------------------------------
$this->class->pf_recount_topic_attachments($this->topic['tid']);
//-----------------------------------------
// Redirect them back to the topic
//-----------------------------------------
$print->redirect_screen( $ibforums->lang['post_edited'], "act=ST&f={$this->class->forum['id']}&t={$this->topic['tid']}&st={$ibforums->input['st']}#entry{$this->post['pid']}");
}
/*-------------------------------------------------------------------------*/
// SHOW FORM
/*-------------------------------------------------------------------------*/
function show_form()
{
global $ibforums, $std, $DB, $print;
//-----------------------------------------
// Sort out the "raw" textarea input and make it safe incase
// we have a <textarea> tag in the raw post var.
//-----------------------------------------
$raw_post = isset($_POST['Post']) ? $std->txt_htmlspecialchars($_POST['Post']) : $this->class->parser->unconvert($this->orig_post['post'], $this->class->forum['use_ibc'], $this->class->forum['use_html']);
if (isset($raw_post))
{
$raw_post = $std->txt_raw2form($raw_post);
}
//-----------------------------------------
// Is this the first post in the topic?
//-----------------------------------------
if ( $this->edit_title == 1 )
{
$topic_title = isset($_POST['TopicTitle']) ? $ibforums->input['TopicTitle'] : $this->topic['title'];
$topic_desc = isset($_POST['TopicDesc']) ? $ibforums->input['TopicDesc'] : $this->topic['description'];
$topic_title = $this->class->html->topictitle_fields( array( 'TITLE' => $topic_title, 'DESC' => $topic_desc ) );
}
//-----------------------------------------
// Do we have any posting errors?
//-----------------------------------------
if ($this->class->obj['post_errors'])
{
$this->class->output .= $this->class->html->errors( $ibforums->lang[ $this->class->obj['post_errors'] ]);
}
if ($this->class->obj['preview_post'])
{
$this->class->parser->pp_do_html = intval($ibforums->input['post_htmlstatus']) AND $this->class->forum['use_html'] AND $ibforums->member['g_dohtml'] ? 1 : 0;
$this->class->parser->pp_nl2br = $ibforums->input['post_htmlstatus'] == 2 ? 1 : 0;
$this->post['post'] = $this->class->parser->post_db_parse(
$this->class->parser->convert( array(
'TEXT' => $this->post['post'],
'CODE' => $this->class->forum['use_ibc'],
'SMILIES' => $ibforums->input['enableemo'],
'HTML' => $this->class->forum['use_html']
) )
);
$this->class->output .= $this->class->html->preview( $this->post['post'] );
}
$this->class->output .= $this->class->html_start_form( array( 1 => array( 'CODE', '09' ),
2 => array( 't' , $this->topic['tid']),
3 => array( 'p' , $ibforums->input['p'] ),
4 => array( 'st' , $ibforums->input['st'] ),
5 => array( 'post_key', $this->post_key )
) );
//-----------------------------------------
// START TABLE
//-----------------------------------------
$this->class->output .= $this->class->html->table_structure();
//-----------------------------------------
$start_table = $this->class->html->table_top( "{$ibforums->lang['top_txt_edit']} {$this->topic['title']}");
$name_fields = $this->class->html_name_field();
$post_box = $this->class->html_post_body( $raw_post );
$end_form = $this->class->html->EndForm( $ibforums->lang['submit_edit'] );
$post_icons = $this->class->html_post_icons($this->orig_post['icon_id']);
if ($this->class->can_upload)
{
$upload_field = $this->class->html_build_uploads($this->post_key,'edit',$this->orig_post['pid']);
}
if ($ibforums->member['g_append_edit'])
{
$checked = "";
if ($this->orig_post['append_edit'])
{
$checked = "checked";
}
$edit_option = $this->class->html->add_edit_box($checked);
}
//-----------------------------------------
$this->class->output = str_replace( "<!--START TABLE-->" , $start_table , $this->class->output );
$this->class->output = str_replace( "<!--NAME FIELDS-->" , $name_fields , $this->class->output );
$this->class->output = str_replace( "<!--POST BOX-->" , $post_box , $this->class->output );
$this->class->output = str_replace( "<!--POST ICONS-->" , $post_icons , $this->class->output );
$this->class->output = str_replace( "<!--END TABLE-->" , $end_form , $this->class->output );
$this->class->output = str_replace( "<!--UPLOAD FIELD-->", $upload_field , $this->class->output );
$this->class->output = str_replace( "<!--MOD OPTIONS-->" , $edit_option , $this->class->output );
$this->class->output = str_replace( "<!--FORUM RULES-->" , $std->print_forum_rules($this->class->forum), $this->class->output );
$this->class->output = str_replace( "<!--TOPIC TITLE-->" , $topic_title , $this->class->output );
//-----------------------------------------
$this->class->output = $this->class->html_add_smilie_box( $this->class->output );
//-----------------------------------------
// Add in siggy buttons and such
//-----------------------------------------
$ibforums->input['post_htmlstatus'] = $this->orig_post['post_htmlstate'];
$this->class->html_checkboxes('edit', $this->topic['tid'], $this->class->forum['id']);
//-----------------------------------------
$this->class->html_topic_summary($this->topic['tid']);
$this->nav = array( "<a href='{$this->class->base_url}&act=SC&c={$this->class->forum['cat_id']}'>{$this->class->forum['cat_name']}</a>",
"<a href='{$this->class->base_url}&act=SF&f={$this->class->forum['id']}'>{$this->class->forum['name']}</a>",
"<a href='{$this->class->base_url}&act=ST&f={$this->class->forum['id']}&t={$this->topic['tid']}'>{$this->topic['title']}</a>",
);
$this->title = $ibforums->lang['editing_post'].' '.$this->topic['title'];
$print->add_output( $this->class->output );
$print->do_output( array( 'TITLE' => $ibforums->vars['board_name']." -> ".$this->title,
'JS' => 1,
'NAV' => $this->class->nav,
) );
}
}
?>
-436
View File
@@ -1,436 +0,0 @@
<?php
/*
+--------------------------------------------------------------------------
| Invision Power Board v2.0.0
| =============================================
| by Matthew Mecham
| (c) 2001 - 2004 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| Time: Tue, 21 Sep 2004 16:34:28 GMT
| Release: 150aa7a702c3c8b6f6eb90ad49305d2f
| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
|
| > New Post module
| > Module written by Matt Mecham
| > Date started: 17th February 2002
|
| > Module Version Number: 1.0.0
| > DBA Checked: Fri 21 May 2004
+--------------------------------------------------------------------------
*/
class post_functions extends Post
{
var $nav = array();
var $title = "";
var $post = array();
var $topic = array();
var $upload = array();
var $mod_topic = array();
var $class = "";
var $m_group = "";
var $post_key = "";
function post_functions($class)
{
global $ibforums, $std, $DB;
//-----------------------------------------
// Check permissions
//-----------------------------------------
$this->post_key = $ibforums->input['post_key'] ? $ibforums->input['post_key'] : md5(microtime());
$this->class = $class;
$this->class->check_for_new_topic();
}
/*-------------------------------------------------------------------------*/
// MAIN PROCESS FUNCTION
/*-------------------------------------------------------------------------*/
function process()
{
global $ibforums, $std, $DB, $print;
//-----------------------------------------
// Did we remove an attachment?
//-----------------------------------------
if ( $ibforums->input['removeattachid'] )
{
if ( $ibforums->input[ 'removeattach_'. $ibforums->input['removeattachid'] ] )
{
$this->class->pf_remove_attachment( intval($ibforums->input['removeattachid']), $this->post_key );
$this->show_form();
}
}
//-----------------------------------------
// Did we add an attachment?
//-----------------------------------------
if ( $ibforums->input['attachgo'] )
{
$this->class->obj['post_errors'] = "";
$this->upload_id = $this->class->process_upload();
$this->show_form();
}
//-----------------------------------------
// Parse the post, and check for any errors.
//-----------------------------------------
$this->post = $this->class->compile_post();
//-----------------------------------------
// check to make sure we have a valid topic title
//-----------------------------------------
$ibforums->input['TopicTitle'] = str_replace( "<br>", "", $ibforums->input['TopicTitle'] );
$ibforums->input['TopicTitle'] = trim($ibforums->input['TopicTitle']);
if ( (strlen($ibforums->input['TopicTitle']) < 2) or (!$ibforums->input['TopicTitle']) )
{
$this->class->obj['post_errors'] = 'no_topic_title';
}
//-----------------------------------------
// More unicode..
//-----------------------------------------
$temp = $std->txt_stripslashes($_POST['TopicTitle']);
$temp = preg_replace("/&#([0-9]+);/", "-", $temp );
if ( strlen($temp) > 64 )
{
$this->class->obj['post_errors'] = 'topic_title_long';
}
//-----------------------------------------
// If we don't have any errors yet, parse the upload
//-----------------------------------------
if ($this->class->obj['post_errors'] == "")
{
$this->upload = $this->class->process_upload();
}
if ( ($this->class->obj['post_errors'] != "") or ($this->class->obj['preview_post'] != "") )
{
//-----------------------------------------
// Show the form again
//-----------------------------------------
$this->show_form();
}
else
{
$this->add_new_topic();
}
}
/*-------------------------------------------------------------------------*/
// ADD TOPIC FUNCTION
/*-------------------------------------------------------------------------*/
function add_new_topic()
{
global $ibforums, $std, $DB, $print;
//-----------------------------------------
// Fix up the topic title
//-----------------------------------------
$ibforums->input['TopicTitle'] = $this->class->pf_clean_topic_title( $ibforums->input['TopicTitle'] );
$ibforums->input['TopicTitle'] = $this->class->parser->bad_words( $ibforums->input['TopicTitle'] );
$ibforums->input['TopicDesc'] = $this->class->parser->bad_words( $ibforums->input['TopicDesc'] );
$pinned = 0;
$state = 'open';
if ( ($ibforums->input['mod_options'] != "") or ($ibforums->input['mod_options'] != 'nowt') )
{
if ($ibforums->input['mod_options'] == 'pin')
{
if ($ibforums->member['g_is_supmod'] == 1 or $this->class->moderator['pin_topic'] == 1)
{
$pinned = 1;
$this->class->moderate_log('Pinned topic from post form', $ibforums->input['TopicTitle']);
}
}
else if ($ibforums->input['mod_options'] == 'close')
{
if ($ibforums->member['g_is_supmod'] == 1 or $this->class->moderator['close_topic'] == 1)
{
$state = 'closed';
$this->class->moderate_log('Closed topic from post form', $ibforums->input['TopicTitle']);
}
}
else if ($ibforums->input['mod_options'] == 'pinclose')
{
if ($ibforums->member['g_is_supmod'] == 1 or ( $this->class->moderator['pin_topic'] == 1 AND $this->class->moderator['close_topic'] == 1 ) )
{
$pinned = 1;
$state = 'closed';
$this->class->moderate_log('Pinned & closed topic from post form', $ibforums->input['TopicTitle']);
}
}
}
//-----------------------------------------
// Build the master array
//-----------------------------------------
$this->topic = array(
'title' => $ibforums->input['TopicTitle'],
'description' => $ibforums->input['TopicDesc'] ,
'state' => $state,
'posts' => 0,
'starter_id' => $ibforums->member['id'],
'starter_name' => $ibforums->member['id'] ? $ibforums->member['name'] : $ibforums->input['UserName'],
'start_date' => time(),
'last_poster_id' => $ibforums->member['id'],
'last_poster_name' => $ibforums->member['id'] ? $ibforums->member['name'] : $ibforums->input['UserName'],
'last_post' => time(),
'icon_id' => $ibforums->input['iconid'],
'author_mode' => $ibforums->member['id'] ? 1 : 0,
'poll_state' => 0,
'last_vote' => 0,
'views' => 0,
'forum_id' => $this->class->forum['id'],
'approved' => ( $this->class->obj['moderate'] == 1 || $this->class->obj['moderate'] == 2 ) ? 0 : 1,
'pinned' => $pinned,
);
//-----------------------------------------
// Insert the topic into the database to get the
// last inserted value of the auto_increment field
// follow suit with the post
//-----------------------------------------
$DB->do_insert( 'topics', $this->topic );
$this->post['topic_id'] = $DB->get_insert_id();
$this->topic['tid'] = $this->post['topic_id'];
//-----------------------------------------
// Update the post info with the upload array info
//-----------------------------------------
$this->post['post_key'] = $this->post_key;
$this->post['new_topic'] = 1;
//-----------------------------------------
// Unqueue the post if we're starting a new topic
//-----------------------------------------
$this->post['queued'] = 0;
//-----------------------------------------
// Add post to DB
//-----------------------------------------
$DB->do_insert( 'posts', $this->post );
$this->post['pid'] = $DB->get_insert_id();
//-----------------------------------------
// Update topic with firstpost ID
//-----------------------------------------
$DB->simple_construct( array( 'update' => 'topics',
'set' => "topic_firstpost=".$this->post['pid'],
'where' => "tid=".$this->topic['tid']
) );
$DB->simple_exec();
//-----------------------------------------
// If we are still here, lets update the
// board/forum stats
//-----------------------------------------
$this->class->pf_update_forum_and_stats($this->topic['tid'], $this->topic['title'], 'new');
//-----------------------------------------
// Make attachments "permanent"
//-----------------------------------------
$this->class->pf_make_attachments_permanent($this->post_key, $this->topic['tid'], $this->post['pid']);
//-----------------------------------------
// If we are a member, lets update thier last post
// date and increment their post count.
//-----------------------------------------
$this->class->pf_increment_user_post_count();
//-----------------------------------------
// Moderating?
//-----------------------------------------
if ( $this->class->obj['moderate'] == 1 OR $this->class->obj['moderate'] == 2 )
{
//-----------------------------------------
// Redirect them with a message telling them the
// post has to be previewed first
//-----------------------------------------
$this->class->notify_new_topic_approval( $this->topic['tid'], $this->topic['title'], $this->topic['starter_name'], $this->post['pid'] );
$print->redirect_screen( $ibforums->lang['moderate_topic'], "act=SF&f={$this->class->forum['id']}" );
}
//-----------------------------------------
// Are we tracking new topics we start 'auto_track'?
//-----------------------------------------
$this->class->pf_add_tracked_topic($this->topic['tid']);
//-----------------------------------------
// Are we tracking this forum? If so generate some mailies - yay!
//-----------------------------------------
$this->class->forum_tracker($this->class->forum['id'], $this->topic['tid'], $this->topic['title'], $this->class->forum['name'], $this->post['post'] );
//-----------------------------------------
// Redirect them back to the topic
//-----------------------------------------
$std->boink_it($this->class->base_url."showtopic={$this->topic['tid']}");
}
/*-------------------------------------------------------------------------*/
// SHOW FORM
/*-------------------------------------------------------------------------*/
function show_form()
{
global $ibforums, $std, $DB, $print;
//-----------------------------------------
// Are we quoting posts?
//-----------------------------------------
$raw_post = $this->class->check_multi_quote();
//-----------------------------------------
// Sort out the "raw" textarea input and make it safe incase
// we have a <textarea> tag in the raw post var.
//-----------------------------------------
$topic_title = isset($_POST['TopicTitle']) ? $ibforums->input['TopicTitle'] : "";
$topic_desc = isset($_POST['TopicDesc']) ? $ibforums->input['TopicDesc'] : "";
//-----------------------------------------
// Do we have any posting errors?
//-----------------------------------------
if ($this->class->obj['post_errors'])
{
$this->class->output .= $this->class->html->errors( $ibforums->lang[ $this->class->obj['post_errors'] ]);
}
if ($this->class->obj['preview_post'])
{
$this->class->parser->pp_do_html = intval($ibforums->input['post_htmlstatus']) AND $this->class->forum['use_html'] AND $ibforums->member['g_dohtml'] ? 1 : 0;
$this->class->parser->pp_nl2br = $ibforums->input['post_htmlstatus'] == 2 ? 1 : 0;
$this->post['post'] = $this->class->parser->post_db_parse(
$this->class->parser->convert( array(
'TEXT' => $this->post['post'],
'CODE' => $this->class->forum['use_ibc'],
'SMILIES' => $ibforums->input['enableemo'],
'HTML' => $this->class->forum['use_html']
) )
);
$this->class->output .= $this->class->html->preview( $this->post['post'] );
}
$this->class->output .= $this->class->html_start_form( array( 1 => array( 'CODE', '01' ),
2 => array( 'post_key', $this->post_key ),
) );
//-----------------------------------------
// START TABLE
//-----------------------------------------
$this->class->output .= $this->class->html->table_structure();
//-----------------------------------------
$topic_title = $this->class->html->topictitle_fields( array( 'TITLE' => $topic_title, 'DESC' => $topic_desc ) );
$start_table = $this->class->html->table_top( "{$ibforums->lang['top_txt_new']} {$this->class->forum['name']}");
$name_fields = $this->class->html_name_field();
$post_box = $this->class->html_post_body( $raw_post );
$mod_options = $this->class->mod_options();
$end_form = $this->class->html->EndForm( $ibforums->lang['submit_new'] );
$post_icons = $this->class->html_post_icons();
if ($this->class->can_upload)
{
$upload_field = $this->class->html_build_uploads($this->post_key,'new');
}
//-----------------------------------------
$this->class->output = str_replace( "<!--START TABLE-->" , $start_table , $this->class->output );
$this->class->output = str_replace( "<!--NAME FIELDS-->" , $name_fields , $this->class->output );
$this->class->output = str_replace( "<!--POST BOX-->" , $post_box , $this->class->output );
$this->class->output = str_replace( "<!--POST ICONS-->" , $post_icons , $this->class->output );
$this->class->output = str_replace( "<!--UPLOAD FIELD-->", $upload_field , $this->class->output );
$this->class->output = str_replace( "<!--MOD OPTIONS-->" , $mod_options , $this->class->output );
$this->class->output = str_replace( "<!--END TABLE-->" , $end_form , $this->class->output );
$this->class->output = str_replace( "<!--TOPIC TITLE-->" , $topic_title , $this->class->output );
$this->class->output = str_replace( "<!--FORUM RULES-->" , $std->print_forum_rules($this->class->forum), $this->class->output );
//-----------------------------------------
$this->class->output = $this->class->html_add_smilie_box( $this->class->output );
//-----------------------------------------
// Add in siggy buttons and such
//-----------------------------------------
$this->class->html_checkboxes('new', 0, $this->class->forum['id']);
//-----------------------------------------
$this->title = $ibforums->lang['posting_new_topic'];
$print->add_output( $this->class->output );
$print->do_output( array( 'TITLE' => $ibforums->vars['board_name']." -> ".$this->title,
'JS' => 1,
'NAV' => $this->class->nav,
) );
}
}
?>
+35 -29
View File
@@ -2,16 +2,28 @@
/*
+--------------------------------------------------------------------------
| Invision Power Board v2.0.0
| Invision Power Board 2.1.7
| =============================================
| by Matthew Mecham
| (c) 2001 - 2004 Invision Power Services, Inc.
| (c) 2001 - 2005 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| Time: Tue, 21 Sep 2004 16:34:28 GMT
| Release: 150aa7a702c3c8b6f6eb90ad49305d2f
| 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 $
+---------------------------------------------------------------------------
|
| > Text processor module
@@ -50,8 +62,6 @@ class post_parser {
function post_parser($load=0)
{
global $ibforums, $DB;
$this->strip_quotes = $ibforums->vars['strip_quotes'];
if ( $load )
@@ -67,7 +77,7 @@ class post_parser {
function check_caches($load=0)
{
global $ibforums, $std, $DB;
$load=0;
if ( ! is_array( $ibforums->cache['emoticons'] ) )
{
$ibforums->cache['emoticons'] = array();
@@ -224,7 +234,7 @@ class post_parser {
// Do [CODE] tag
//-----------------------------------------
$txt = preg_replace( "#\[code\](.+?)\[/code\]#ies", "\$this->regex_code_tag('\\1')", $txt );
$txt = preg_replace( "#\[code\](.+?)\[/code\]#ies", "\$this->regex_code_tag( '\\1' )", $txt );
//-----------------------------------------
// Auto parse URLs
@@ -351,7 +361,7 @@ class post_parser {
{
foreach( $ibforums->cache['emoticons'] as $a_id => $row)
{
if ( $row['emo_set'] != $ibforums->skin['_emodir'] )
if ( $row['emo_set'] != $this->ipsclass->skin['_emodir'] )
{
continue;
}
@@ -528,7 +538,7 @@ class post_parser {
if ( $row['bbcode_useoption'] )
{
preg_match_all( "#(\[".$row['bbcode_tag']."=(?:&quot;|&\#39;)?(.+?)(?:&quot;|&\#39;)?\])(.+?)(\[/".$row['bbcode_tag']."\])#si", $t, $match );
preg_match_all( "#(\[".preg_quote($row['bbcode_tag'], '#' )."=(?:&quot;|&\#39;)?(.+?)(?:&quot;|&\#39;)?\])(.+?)(\[/".preg_quote($row['bbcode_tag'], '#' )."\])#si", $t, $match );
for ($i=0; $i < count($match[0]); $i++)
{
@@ -540,7 +550,7 @@ class post_parser {
}
else
{
preg_match_all( "#(\[".$row['bbcode_tag']."\])(.+?)(\[/".$row['bbcode_tag']."\])#si", $t, $match );
preg_match_all( "#(\[".preg_quote($row['bbcode_tag'], '#' )."\])(.+?)(\[/".preg_quote($row['bbcode_tag'], '#' )."\])#si", $t, $match );
for ($i=0; $i < count($match[0]); $i++)
{
@@ -791,12 +801,9 @@ class post_parser {
{
$sql = stripslashes($sql);
while ( preg_match( "#<span style='.+?'>(.+?)</span>#is", $sql ) )
{
$sql = preg_replace( "#<span style='.+?'>(.+?)</span>#is", "\\1", $sql );
}
$sql = preg_replace( "#\s*$#" , "", $sql );
$sql = preg_replace( "#<span style='.+?'>#is", "", $sql );
$sql = str_replace( "</span>" , "", $sql );
$sql = preg_replace( "#\s*$#" , "", $sql );
return '[sql]'.$sql.'[/sql]';
@@ -806,12 +813,9 @@ class post_parser {
{
$html = stripslashes($html);
while ( preg_match( "#<span style='.+?'>(.+?)</span>#is", $html ) )
{
$html = preg_replace( "#<span style='.+?'>(.+?)</span>#is", "\\1", $html );
}
$html = preg_replace( "#\s*$#" , "", $html );
$html = preg_replace( "#<span style='.+?'>#is", "", $html );
$html = str_replace( "</span>" , "", $html );
$html = preg_replace( "#\s*$#" , "", $html );
return '[html]'.$html.'[/html]';
@@ -856,8 +860,8 @@ class post_parser {
global $ibforums;
$used = array(
'quote' => array( 'title' => 'QUOTE', 'css_top' => 'quotetop' , 'css_main' => 'quotemain' ),
'code' => array( 'title' => 'CODE' , 'css_top' => 'codetop' , 'css_main' => 'codemain' ),
'quote' => array( 'title' => 'Öèòàòà', 'css_top' => 'quotetop' , 'css_main' => 'quotemain' ),
'code' => array( 'title' => 'Èñõîäíûé êîä' , 'css_top' => 'codetop' , 'css_main' => 'codemain' ),
'sql' => array( 'title' => 'SQL' , 'css_top' => 'sqltop' , 'css_main' => 'sqlmain' ),
'html' => array( 'title' => 'HTML' , 'css_top' => 'htmltop' , 'css_main' => 'htmlmain' )
);
@@ -1304,7 +1308,7 @@ class post_parser {
$url = str_replace( " ", "%20", $url );
return "<img src='$url' border='0' alt='user posted image' />";
return "<img src='$url' border='0' alt='îïóáëèêîâàííîå ïîëüçîâàòåëåì èçîáðàæåíèå' />";
}
@@ -1329,11 +1333,11 @@ class post_parser {
$IN['1'] = $attr[0];
}
$IN['1'] = preg_replace( "/[&\(\)\.\%]/", "", $IN['1'] );
$IN['1'] = preg_replace( "/[&\(\)\.\%\[\]<>]/", "", $IN['1'] );
if ($IN['s'] == 'size')
{
$IN['1'] = $IN['1'] + 7;
$IN['1'] = intval($IN['1']) + 7;
if ($IN['1'] > 30)
{
@@ -1344,10 +1348,12 @@ class post_parser {
}
else if ($IN['s'] == 'col')
{
return "<span style='color:".$IN['1']."'>".$IN['2']."</span>";
$IN[1] = preg_replace( "/[^\d\w\#\s]/s", "", $IN[1] );
return "<span style='color:".$IN[1]."'>".$IN['2']."</span>";
}
else if ($IN['s'] == 'font')
{
$IN['1'] = preg_replace( "/[^\d\w\#\-\_\s]/s", "", $IN['1'] );
return "<span style='font-family:".$IN['1']."'>".$IN['2']."</span>";
}
}
-551
View File
@@ -1,551 +0,0 @@
<?php
/*
+--------------------------------------------------------------------------
| Invision Power Board v2.0.0
| =============================================
| by Matthew Mecham
| (c) 2001 - 2004 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| Time: Tue, 21 Sep 2004 16:34:28 GMT
| Release: 150aa7a702c3c8b6f6eb90ad49305d2f
| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
|
| > New Post module
| > Module written by Matt Mecham
| > DBA Checked: Fri 21 May 2004
|
+--------------------------------------------------------------------------
*/
class post_functions extends Post {
var $nav = array();
var $title = "";
var $post = array();
var $topic = array();
var $upload = array();
var $mod_topic = array();
var $poll_count = 0;
var $poll_choices = "";
var $m_group = "";
function post_functions($class)
{
global $ibforums, $std, $DB;
$this->class = $class;
$this->post_key = $ibforums->input['post_key'] ? $ibforums->input['post_key'] : md5(microtime());
//-----------------------------------------
// Sort out maximum number of poll choices allowed
//-----------------------------------------
$ibforums->vars['max_poll_choices'] = $ibforums->vars['max_poll_choices'] ? $ibforums->vars['max_poll_choices'] : 10;
$ibforums->lang['poll_choices'] = sprintf( $ibforums->lang['poll_choices'], $ibforums->vars['max_poll_choices'] );
//-----------------------------------------
// Lets do some tests to make sure that we are allowed to start a new topic
//-----------------------------------------
if (! $ibforums->member['g_post_polls'])
{
$std->Error( array( LEVEL => 1, MSG => 'no_start_polls') );
}
if ( ! $this->class->forum['allow_poll'] )
{
$std->Error( array( LEVEL => 1, MSG => 'no_start_polls') );
}
$this->m_group = $ibforums->perm_id;
if ( $std->check_perms($this->class->forum['start_perms']) != TRUE )
{
$std->Error( array( LEVEL => 1, MSG => 'no_start_polls') );
}
}
function process()
{
global $ibforums, $std, $DB, $print;
//-----------------------------------------
// Did we remove an attachment?
//-----------------------------------------
if ( $ibforums->input['removeattachid'] )
{
if ( $ibforums->input[ 'removeattach_'. $ibforums->input['removeattachid'] ] )
{
$this->class->pf_remove_attachment( intval($ibforums->input['removeattachid']), $this->post_key );
$this->show_form();
}
}
//-----------------------------------------
// Did we add an attachment?
//-----------------------------------------
if ( $ibforums->input['attachgo'] )
{
$this->class->obj['post_errors'] = "";
$this->upload_id = $this->class->process_upload();
$this->show_form();
}
//-----------------------------------------
// Parse the post, and check for any errors.
//-----------------------------------------
$this->post = $this->class->compile_post();
//-----------------------------------------
// check to make sure we have a valid topic title
//-----------------------------------------
if ( (strlen($ibforums->input['TopicTitle']) < 2) or (!$ibforums->input['TopicTitle']) )
{
$this->class->obj['post_errors'] = 'no_topic_title';
}
//-----------------------------------------
// More unicode..
//-----------------------------------------
$temp = $std->txt_stripslashes($_POST['TopicTitle']);
$temp = preg_replace("/&#([0-9]+);/", "-", $temp );
if ( strlen($temp) > 64 )
{
$this->class->obj['post_errors'] = 'topic_title_long';
}
//-----------------------------------------
// check to make sure we have a correct # of choices
//-----------------------------------------
$this->poll_choices = $ibforums->input['PollAnswers'];
$this->poll_choices = preg_replace( "#<br /><br />#" , "" , $this->poll_choices );
$this->poll_choices = preg_replace( "#<br />#e" , "\$this->regex_count_choices()" , $this->poll_choices );
if ($this->poll_count > $ibforums->vars['max_poll_choices'])
{
$this->class->obj['post_errors'] = 'poll_to_many';
}
if ($this->poll_count < 1)
{
$this->class->obj['post_errors'] = 'poll_not_enough';
}
//-----------------------------------------
// If we don't have any errors yet, parse the upload
//-----------------------------------------
if ($this->class->obj['post_errors'] == "")
{
$this->upload = $this->class->process_upload();
}
if ( ($this->class->obj['post_errors'] != "") or ($this->class->obj['preview_post'] != "") )
{
//-----------------------------------------
// Show the form again
//-----------------------------------------
$this->show_form();
}
else
{
$this->add_new_poll();
}
}
/*-------------------------------------------------------------------------*/
// ADD POLL FUNCTION
/*-------------------------------------------------------------------------*/
function add_new_poll() {
global $ibforums, $std, $DB, $print;
//-----------------------------------------
// Sort out the poll stuff
// This is somewhat contrived, but it has to be
// compatible with the current perl version.
//-----------------------------------------
$poll_array = array();
$count = 0;
$polls = explode( "<br />", $this->poll_choices );
foreach ($polls as $polling)
{
if ( $polling == "" )
{
continue;
}
$poll_array[] = array( $count , $this->class->parser->bad_words($polling), 0 );
$count++;
}
//-----------------------------------------
// Fix up the topic title
//-----------------------------------------
$ibforums->input['TopicTitle'] = $this->class->pf_clean_topic_title( $ibforums->input['TopicTitle'] );
$ibforums->input['TopicTitle'] = $this->class->parser->bad_words( $ibforums->input['TopicTitle'] );
$ibforums->input['TopicDesc'] = $this->class->parser->bad_words( $ibforums->input['TopicDesc'] );
if ( $ibforums->vars['poll_disable_noreply'] != 1 )
{
$poll_state = $ibforums->input['allow_disc'] == 0 ? 'open' : 'closed';
}
else
{
$poll_state = 'open';
}
$pinned = 0;
$state = 'open';
if ( ($ibforums->input['mod_options'] != "") or ($ibforums->input['mod_options'] != 'nowt') )
{
if ($ibforums->input['mod_options'] == 'pin')
{
if ($ibforums->member['g_is_supmod'] == 1 or $this->class->moderator['pin_topic'] == 1)
{
$pinned = 1;
$this->class->moderate_log('Pinned topic from post form', $ibforums->input['TopicTitle']);
}
}
else if ($ibforums->input['mod_options'] == 'close')
{
if ($ibforums->member['g_is_supmod'] == 1 or $this->class->moderator['close_topic'] == 1)
{
$state = 'closed';
$this->class->moderate_log('Closed topic from post form', $ibforums->input['TopicTitle']);
}
}
else if ($ibforums->input['mod_options'] == 'pinclose')
{
if ($ibforums->member['g_is_supmod'] == 1 or ( $this->class->moderator['pin_topic'] == 1 AND $this->class->moderator['close_topic'] == 1 ) )
{
$pinned = 1;
$state = 'closed';
$this->class->moderate_log('Pinned & closed topic from post form', $ibforums->input['TopicTitle']);
}
}
}
//-----------------------------------------
// Build the master array
//-----------------------------------------
$this->topic = array(
'title' => $ibforums->input['TopicTitle'],
'description' => $ibforums->input['TopicDesc'] ,
'state' => $state,
'posts' => 0,
'starter_id' => $ibforums->member['id'],
'starter_name' => $ibforums->member['id'] ? $ibforums->member['name'] : $ibforums->input['UserName'],
'start_date' => time(),
'last_poster_id' => $ibforums->member['id'],
'last_poster_name' => $ibforums->member['id'] ? $ibforums->member['name'] : $ibforums->input['UserName'],
'last_post' => time(),
'icon_id' => $ibforums->input['iconid'],
'author_mode' => $ibforums->member['id'] ? 1 : 0,
'poll_state' => $poll_state,
'last_vote' => 0,
'views' => 0,
'forum_id' => $this->class->forum['id'],
'approved' => $this->class->obj['moderate'] ? 0 : 1,
'pinned' => $pinned,
);
//-----------------------------------------
// Insert the topic into the database to get the
// last inserted value of the auto_increment field
// follow suit with the post
//-----------------------------------------
$DB->do_insert( 'topics', $this->topic );
$this->post['topic_id'] = $DB->get_insert_id();
$this->topic['tid'] = $this->post['topic_id'];
//-----------------------------------------
// Update the post info with the upload array info
//-----------------------------------------
$this->post['post_key'] = $this->post_key;
$this->post['new_topic'] = 1;
//-----------------------------------------
// Unqueue the post if we're starting a new topic
//-----------------------------------------
if ( $this->class->obj['moderate'] == 3 )
{
$this->post['queued'] = 0;
}
//-----------------------------------------
// Add post to DB
//-----------------------------------------
$DB->do_insert( 'posts', $this->post );
$this->post['pid'] = $DB->get_insert_id();
//-----------------------------------------
// Update topic with firstpost ID
//-----------------------------------------
$DB->simple_construct( array( 'update' => 'topics',
'set' => "topic_firstpost=".$this->post['pid'],
'where' => "tid=".$this->topic['tid']
) );
$DB->simple_exec();
//-----------------------------------------
// Add the poll to the forum_polls table
// if we are moderating this post
//-----------------------------------------
$DB->do_insert( 'polls',
array (
'tid' => $this->topic['tid'],
'forum_id' => $this->class->forum['id'],
'start_date' => time(),
'choices' => addslashes(serialize($poll_array)),
'starter_id' => $ibforums->member['id'],
'votes' => 0,
'poll_question' => $this->class->parser->bad_words($ibforums->input['pollq']),
) );
//-----------------------------------------
// If we are still here, lets update the
// board/forum stats
//-----------------------------------------
$this->class->pf_update_forum_and_stats($this->topic['tid'], $this->topic['title'], 'new');
//-----------------------------------------
// Make attachments "permanent"
//-----------------------------------------
$this->class->pf_make_attachments_permanent($this->post_key, $this->topic['tid'], $this->post['pid']);
//-----------------------------------------
// If we are a member, lets update thier last post
// date and increment their post count.
//-----------------------------------------
$this->class->pf_increment_user_post_count();
//-----------------------------------------
// Moderating?
//-----------------------------------------
if ( $this->class->obj['moderate'] == 1 OR $this->class->obj['moderate'] == 2 )
{
//-----------------------------------------
// Redirect them with a message telling them the
// post has to be previewed first
//-----------------------------------------
$this->class->notify_new_topic_approval( $this->topic['tid'], $this->topic['title'], $this->topic['starter_name'] );
$print->redirect_screen( $ibforums->lang['moderate_topic'], "act=SF&f={$this->class->forum['id']}" );
}
//-----------------------------------------
// Are we tracking new topics we start 'auto_track'?
//-----------------------------------------
$this->class->pf_add_tracked_topic($this->topic['tid']);
//-----------------------------------------
// Are we tracking this forum? If so generate some mailies - yay!
//-----------------------------------------
$this->class->forum_tracker($this->class->forum['id'], $this->topic['tid'], $this->topic['title'], $this->class->forum['name'] );
//-----------------------------------------
// Redirect them back to the topic
//-----------------------------------------
$std->boink_it($this->class->base_url."act=ST&f={$this->class->forum['id']}&t={$this->topic['tid']}");
}
/*-------------------------------------------------------------------------*/
// SHOW FORM
/*-------------------------------------------------------------------------*/
function show_form()
{
global $ibforums, $std, $DB, $print;
//-----------------------------------------
// Are we quoting posts?
//-----------------------------------------
$raw_post = $this->class->check_multi_quote();
//-----------------------------------------
// Sort out the "raw" textarea input and make it safe incase
// we have a <textarea> tag in the raw post var.
//-----------------------------------------
$topic_title = isset($_POST['TopicTitle']) ? $ibforums->input['TopicTitle'] : "";
$topic_desc = isset($_POST['TopicDesc']) ? $ibforums->input['TopicDesc'] : "";
$poll = isset($_POST['PollAnswers']) ? $std->txt_htmlspecialchars($std->txt_stripslashes($_POST['PollAnswers'])) : "";
//-----------------------------------------
// Do we have any posting errors?
//-----------------------------------------
if ($this->class->obj['post_errors'])
{
$this->class->output .= $this->class->html->errors( $ibforums->lang[ $this->class->obj['post_errors'] ]);
}
if ($this->class->obj['preview_post'])
{
$this->class->parser->pp_do_html = intval($ibforums->input['post_htmlstatus']) AND $this->class->forum['use_html'] AND $ibforums->member['g_dohtml'] ? 1 : 0;
$this->class->parser->pp_nl2br = $ibforums->input['post_htmlstatus'] == 2 ? 1 : 0;
$this->post['post'] = $this->class->parser->post_db_parse(
$this->class->parser->convert( array(
'TEXT' => $this->post['post'],
'CODE' => $this->class->forum['use_ibc'],
'SMILIES' => $ibforums->input['enableemo'],
'HTML' => $this->class->forum['use_html']
) )
);
$this->class->output .= $this->class->html->preview( $this->post['post'] );
}
$extra = "";
if ($ibforums->vars['poll_tags'])
{
$extra = $ibforums->lang['poll_tag_allowed'];
}
$this->class->output .= $this->class->html_start_form( array( 1 => array( 'CODE', '11' ),
2 => array( 'f', $this->class->forum['id']),
3 => array( 'post_key', $this->post_key ),
) );
//-----------------------------------------
// START TABLE
//-----------------------------------------
$this->class->output .= $this->class->html->table_structure();
//-----------------------------------------
$topic_title = $this->class->html->topictitle_fields( array( TITLE => $topic_title, DESC => $topic_desc ) );
$start_table = $this->class->html->table_top( "{$ibforums->lang['top_txt_poll']}: {$this->class->forum['name']}");
$name_fields = $this->class->html_name_field();
$post_box = $this->class->html_post_body( $raw_post );
$mod_options = $this->class->mod_options();
$poll_box = $this->class->html->poll_box( $poll, $extra);
$end_form = $this->class->html->EndForm( $ibforums->lang['submit_poll'] );
$post_icons = $this->class->html_post_icons();
if ($this->class->can_upload)
{
$upload_field = $this->class->html_build_uploads($this->post_key,'new');
}
//-----------------------------------------
$this->class->output = str_replace( "<!--POLL BOX-->" , $poll_box , $this->class->output );
$this->class->output = str_replace( "<!--START TABLE-->" , $start_table , $this->class->output );
$this->class->output = str_replace( "<!--NAME FIELDS-->" , $name_fields , $this->class->output );
$this->class->output = str_replace( "<!--POST BOX-->" , $post_box , $this->class->output );
$this->class->output = str_replace( "<!--POST ICONS-->" , $post_icons , $this->class->output );
$this->class->output = str_replace( "<!--UPLOAD FIELD-->", $upload_field , $this->class->output );
$this->class->output = str_replace( "<!--MOD OPTIONS-->" , $mod_options , $this->class->output );
$this->class->output = str_replace( "<!--END TABLE-->" , $end_form , $this->class->output );
$this->class->output = str_replace( "<!--TOPIC TITLE-->" , $topic_title , $this->class->output );
$this->class->output = str_replace( "<!--FORUM RULES-->" , $std->print_forum_rules($this->class->forum), $this->class->output );
//-----------------------------------------
$this->class->html_add_smilie_box();
if ( $ibforums->vars['poll_disable_noreply'] != 1 )
{
$this->class->output = str_replace("<!--IBF.POLL_OPTIONS-->", $this->class->html->poll_options(), $this->class->output );
}
//-----------------------------------------
// Add in siggy buttons and such
//-----------------------------------------
$this->class->html_checkboxes('new', 0, $this->class->forum['id']);
$this->class->output = $this->class->html_add_smilie_box( $this->class->output );
$this->title = $ibforums->lang['posting_new_topic'];
$print->add_output( $this->class->output );
$print->do_output( array( 'TITLE' => $ibforums->vars['board_name']." -> ".$this->title,
'JS' => 1,
'NAV' => $this->class->nav,
) );
}
function regex_count_choices()
{
++$this->poll_count;
return "<br />";
}
}
?>
-280
View File
@@ -1,280 +0,0 @@
<?php
/*
+--------------------------------------------------------------------------
| Invision Power Board v2.0.0
| =============================================
| by Matthew Mecham
| (c) 2001 - 2004 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| Time: Tue, 21 Sep 2004 16:34:28 GMT
| Release: 150aa7a702c3c8b6f6eb90ad49305d2f
| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
|
| > New Post module
| > Module written by Matt Mecham
| > DBA Checked: Fri 21 May 2004
|
+--------------------------------------------------------------------------
*/
class post_functions extends Post {
var $nav = array();
var $title = "";
var $post = array();
var $topic = array();
var $upload = array();
var $mod_topic = array();
var $poll_count = 0;
var $poll_choices = "";
var $m_group = "";
function post_functions($class)
{
global $ibforums, $std, $DB;
//-----------------------------------------
// Sort out maximum number of poll choices allowed
//-----------------------------------------
$ibforums->vars['max_poll_choices'] = $ibforums->vars['max_poll_choices'] ? $ibforums->vars['max_poll_choices'] : 10;
$ibforums->lang['poll_choices'] = sprintf( $ibforums->lang['poll_choices'], $ibforums->vars['max_poll_choices'] );
//-----------------------------------------
// Lets do some tests to make sure that we are allowed to start a new topic
//-----------------------------------------
if (! $ibforums->member['g_post_polls'])
{
$std->Error( array( LEVEL => 1, MSG => 'no_start_polls') );
}
if ( ! $class->forum['allow_poll'] )
{
$std->Error( array( LEVEL => 1, MSG => 'no_start_polls') );
}
if ( $std->check_perms($class->forum['start_perms']) == FALSE )
{
$std->Error( array( LEVEL => 1, MSG => 'no_start_polls') );
}
if ( ! intval($ibforums->input['t']) )
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'is_broken_link') );
}
else
{
$tid = intval($ibforums->input['t']);
$DB->simple_construct( array('select' => '*', 'from' => 'topics', 'where' => "tid=$tid") );
$DB->simple_exec();
if ( ! $this->topic = $DB->fetch_row() )
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'is_broken_link') );
}
}
$pass = 0;
if ( $ibforums->member['id'] )
{
if ( $ibforums->member['g_is_supmod'] == 1 )
{
$pass = 1;
}
else if ( $this->topic['starter_id'] == $ibforums->member['id'] )
{
if ( ($ibforums->vars['startpoll_cutoff'] > 0) AND ( $this->topic['start_date'] + ($ibforums->vars['startpoll_cutoff'] * 3600) > time() ) )
{
$pass = 1;
}
}
}
if ( $pass != 1 )
{
$std->Error( array( LEVEL => 1, MSG => 'no_start_polls') );
}
}
function process($class) {
global $ibforums, $std, $DB, $print;
//-----------------------------------------
// check to make sure we have a correct # of choices
//-----------------------------------------
$this->poll_choices = $ibforums->input['PollAnswers'];
$this->poll_choices = preg_replace( "#<br /><br />#" , "" , $this->poll_choices );
$this->poll_choices = preg_replace( "#<br />#e" , "\$this->regex_count_choices()" , $this->poll_choices );
if ($this->poll_count > $ibforums->vars['max_poll_choices'])
{
$class->obj['post_errors'] = 'poll_to_many';
}
if ($this->poll_count < 1)
{
$class->obj['post_errors'] = 'poll_not_enough';
}
if ($class->obj['post_errors'] != "")
{
// Show the form again
$this->show_form($class);
}
else
{
$this->add_new_poll($class);
}
}
function add_new_poll($class) {
global $ibforums, $std, $DB, $print;
//-----------------------------------------
// Sort out the poll stuff
// This is somewhat contrived, but it has to be
// compatible with the current perl version.
//-----------------------------------------
$poll_array = array();
$count = 0;
$polls = explode( "<br />", $this->poll_choices );
foreach ($polls as $polling)
{
if ( $polling == "" )
{
continue;
}
$poll_array[] = array( $count , $class->parser->bad_words($polling), 0 );
$count++;
}
//-----------------------------------------
// Add the poll to the forum_polls table
// if we are moderating this post
//-----------------------------------------
$DB->do_insert( 'polls',
array (
'tid' => $this->topic['tid'],
'forum_id' => $class->forum['id'],
'start_date' => time(),
'choices' => addslashes(serialize($poll_array)),
'starter_id' => $ibforums->member['id'],
'votes' => 0,
'poll_question' => $class->parser->bad_words($ibforums->input['pollq']),
) );
$DB->simple_construct( array( 'update' => 'topics', 'set' => 'poll_state="open"', 'where' => "tid={$this->topic['tid']}" ) );
$DB->simple_exec();
//-----------------------------------------
// Redirect them back to the topic
//-----------------------------------------
$std->boink_it($class->base_url."showtopic={$this->topic['tid']}");
}
function show_form($class)
{
global $ibforums, $std, $DB, $print, $HTTP_POST_VARS;
// Sort out the "raw" textarea input and make it safe incase
// we have a <textarea> tag in the raw post var.
$poll = isset($HTTP_POST_VARS['PollAnswers']) ? $std->txt_htmlspecialchars($HTTP_POST_VARS['PollAnswers']) : "";
$extra = "";
if ($ibforums->vars['poll_tags'])
{
$extra = $ibforums->lang['poll_tag_allowed'];
}
$class->output .= $class->html_start_form( array( 1 => array( 'CODE', '15' ), 2 => array( 'f', $class->forum['id']), 2 => array( 't', $this->topic['tid']) ) );
//-----------------------------------------
// START TABLE
//-----------------------------------------
$class->output .= $class->html->table_structure();
//-----------------------------------------
$start_table = $class->html->table_top( "{$ibforums->lang['top_txt_poll']}: {$class->forum['name']} -> ".$this->topic['title']);
$poll_box = $class->html->poll_box($poll, $extra);
$end_form = $class->html->poll_end_form( $ibforums->lang['submit_poll'] );
//-----------------------------------------
$class->output = preg_replace( "/<!--START TABLE-->/" , "$start_table" , $class->output );
//$class->output = preg_replace( "/<!--NAME FIELDS-->/" , "$name_fields" , $class->output );
//$class->output = preg_replace( "/<!--POST BOX-->/" , "$post_box" , $class->output );
//$class->output = preg_replace( "/<!--POST ICONS-->/" , "$post_icons" , $class->output );
//$class->output = preg_replace( "/<!--UPLOAD FIELD-->/", "$upload_field" , $class->output );
//$class->output = preg_replace( "/<!--MOD OPTIONS-->/" , "$mod_options" , $class->output );
$class->output = preg_replace( "/<!--END TABLE-->/" , "$end_form" , $class->output );
//$class->output = preg_replace( "/<!--TOPIC TITLE-->/" , "$topic_title" , $class->output );
$class->output = preg_replace( "/<!--POLL BOX-->/" , "$poll_box" , $class->output );
$class->output = str_replace("<!--FORUM RULES-->", $std->print_forum_rules($class->forum), $class->output );
//-----------------------------------------
$class->html_add_smilie_box();
$this->nav = array( "<a href='{$class->base_url}act=SC&amp;c={$class->forum['cat_id']}'>{$class->forum['cat_name']}</a>",
"<a href='{$class->base_url}act=SF&amp;f={$class->forum['id']}'>{$class->forum['name']}</a>",
"<a href='{$class->base_url}act=ST&amp;f={$class->forum['id']}&amp;t={$this->topic['tid']}'>{$this->topic['title']}</a>",
);
$this->title = $ibforums->lang['posting_poll'];
$print->add_output("$class->output");
$print->do_output( array( 'TITLE' => $ibforums->vars['board_name']." -> ".$this->title,
'JS' => 1,
'NAV' => $class->nav,
) );
}
function regex_count_choices() {
++$this->poll_count;
return "<br />";
}
}
?>
-452
View File
@@ -1,452 +0,0 @@
<?php
/*
+--------------------------------------------------------------------------
| Invision Power Board v2.0.0
| =============================================
| by Matthew Mecham
| (c) 2001 - 2004 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| Time: Tue, 21 Sep 2004 16:34:28 GMT
| Release: 150aa7a702c3c8b6f6eb90ad49305d2f
| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
|
| > Reply post module
| > Module written by Matt Mecham
| > DBA Checked: Fri 21 May 2004
|
+--------------------------------------------------------------------------
*/
class post_functions extends Post {
var $nav = array();
var $title = "";
var $post = array();
var $topic = array();
var $upload = array();
var $mod_topic = array();
var $class = "";
var $m_group = "";
var $post_key = "";
var $quote_pids = array();
var $quote_posts = array();
function post_functions($class)
{
global $ibforums, $std, $DB, $forums;
$this->class = $class;
$this->post_key = $ibforums->input['post_key'] ? $ibforums->input['post_key'] : md5(microtime());
//-----------------------------------------
// Lets load the topic from the database before we do anything else.
//-----------------------------------------
$DB->simple_construct( array( 'select' => '*', 'from' => 'topics', 'where' => "forum_id=".intval($this->class->forum['id'])." AND tid=".intval($ibforums->input['t']) ) );
$DB->simple_exec();
$this->topic = $DB->fetch_row();
//-----------------------------------------
// Check permissions, etc
//-----------------------------------------
if (! $this->topic['tid'])
{
$std->Error( array( LEVEL => 1, MSG => 'missing_files') );
}
//-----------------------------------------
// Lets do some tests to make sure that we are
// allowed to reply to this topic
//-----------------------------------------
$this->class->check_for_reply($this->topic);
}
/*-------------------------------------------------------------------------*/
// MAIN PROCESS FUNCTION
/*-------------------------------------------------------------------------*/
function process()
{
global $ibforums, $std, $DB, $print;
//-----------------------------------------
// Did we remove an attachment?
//-----------------------------------------
if ( $ibforums->input['removeattachid'] )
{
if ( $ibforums->input[ 'removeattach_'. $ibforums->input['removeattachid'] ] )
{
$this->class->pf_remove_attachment( intval($ibforums->input['removeattachid']), $this->post_key );
$this->show_form();
}
}
//-----------------------------------------
// Did we add an attachment?
//-----------------------------------------
if ( $ibforums->input['attachgo'] )
{
$this->class->obj['post_errors'] = "";
$this->upload_id = $this->class->process_upload();
$this->show_form();
}
//-----------------------------------------
// Parse the post, and check for any errors.
//-----------------------------------------
$this->post = $this->class->compile_post();
if ($this->class->obj['post_errors'] == "")
{
$this->upload = $this->class->process_upload();
}
if ( ($this->class->obj['post_errors'] != "") or ($this->class->obj['preview_post'] != "") )
{
//-----------------------------------------
// Show the form again
//-----------------------------------------
$this->show_form($class);
}
else
{
$this->add_reply($class);
}
}
/*-------------------------------------------------------------------------*/
// ADD THE REPLY
/*-------------------------------------------------------------------------*/
function add_reply()
{
global $ibforums, $std, $DB, $print;
//-----------------------------------------
// Insert the post into the database to get the
// last inserted value of the auto_increment field
//-----------------------------------------
$this->post['topic_id'] = $this->topic['tid'];
//-----------------------------------------
// Get the last post time of this topic not counting
// this new reply
//-----------------------------------------
$this->last_post = $this->topic['last_post'];
//die( $this->last_post .' - '.$ibforums->member['last_activity'] . ' l');
//-----------------------------------------
// Are we a mod, and can we change the topic state?
//-----------------------------------------
$return_to_move = 0;
if ( ($ibforums->input['mod_options'] != "") or ($ibforums->input['mod_options'] != 'nowt') )
{
if ($ibforums->input['mod_options'] == 'pin')
{
if ($ibforums->member['g_is_supmod'] == 1 or $this->class->moderator['pin_topic'] == 1)
{
$this->topic['pinned'] = 1;
$this->class->moderate_log('Pinned topic from post form', $this->topic['title']);
}
}
else if ($ibforums->input['mod_options'] == 'close')
{
if ($ibforums->member['g_is_supmod'] == 1 or $this->class->moderator['close_topic'] == 1)
{
$this->topic['state'] = 'closed';
$this->class->moderate_log('Closed topic from post form', $this->topic['title']);
}
}
else if ($ibforums->input['mod_options'] == 'move')
{
if ($ibforums->member['g_is_supmod'] == 1 or $this->class->moderator['move_topic'] == 1)
{
$return_to_move = 1;
}
}
else if ($ibforums->input['mod_options'] == 'pinclose')
{
if ($ibforums->member['g_is_supmod'] == 1 or ( $this->class->moderator['pin_topic'] == 1 AND $this->class->moderator['close_topic'] == 1 ) )
{
$this->topic['pinned'] = 1;
$this->topic['state'] = 'closed';
$this->class->moderate_log('Pinned & closed topic from post form', $this->topic['title']);
}
}
}
//-----------------------------------------
// Add post to DB
//-----------------------------------------
$this->post['post_key'] = $this->post_key;
$this->post['post_parent'] = intval($ibforums->input['parent_id']);
//-----------------------------------------
// Typecast
//-----------------------------------------
$DB->force_data_type = array( 'pid' => 'int',
'post' => 'string' );
$DB->do_insert( 'posts', $this->post );
$this->post['pid'] = $DB->get_insert_id();
//-----------------------------------------
// If we are still here, lets update the
// board/forum/topic stats
//-----------------------------------------
$this->class->pf_update_forum_and_stats($this->topic['tid'], $this->topic['title'], 'reply');
//-----------------------------------------
// Get the correct number of replies
//-----------------------------------------
$DB->simple_construct( array( 'select' => 'COUNT(*) as posts', 'from' => 'posts', 'where' => "topic_id={$this->topic['tid']} and queued != 1" ) );
$DB->simple_exec();
$posts = $DB->fetch_row();
$pcount = intval( $posts['posts'] - 1 );
//-----------------------------------------
// Get the correct number of queued replies
//-----------------------------------------
$DB->simple_construct( array( 'select' => 'COUNT(*) as posts', 'from' => 'posts', 'where' => "topic_id={$this->topic['tid']} and queued=1" ) );
$DB->simple_exec();
$qposts = $DB->fetch_row();
$qpcount = intval( $qposts['posts'] );
//-----------------------------------------
// UPDATE TOPIC
//-----------------------------------------
$poster_name = $ibforums->member['id'] ? $ibforums->member['name'] : $ibforums->input['UserName'];
$update_array = array(
'posts' => $pcount,
'topic_queuedposts'=> $qpcount
);
if ( $this->class->obj['moderate'] != 1 and $this->class->obj['moderate'] != 3 )
{
$update_array['last_poster_id'] = $ibforums->member['id'];
$update_array['last_poster_name'] = $poster_name;
$update_array['last_post'] = time();
$update_array['pinned'] = $this->topic['pinned'];
$update_array['state'] = $this->topic['state'];
}
$DB->do_update( 'topics', $update_array, "tid={$this->topic['tid']}" );
//-----------------------------------------
// If we are a member, lets update thier last post
// date and increment their post count.
//-----------------------------------------
$this->class->pf_increment_user_post_count();
//-----------------------------------------
// Make attachments "permanent"
//-----------------------------------------
$this->class->pf_make_attachments_permanent($this->post_key, $this->topic['tid'], $this->post['pid']);
//-----------------------------------------
// Moderating?
//-----------------------------------------
if ( $this->class->obj['moderate'] == 1 or $this->class->obj['moderate'] == 3 )
{
//-----------------------------------------
// Boing!!!
//-----------------------------------------
$this->class->notify_new_topic_approval( $this->topic['tid'], $this->topic['title'], $this->topic['starter_name'], $this->post['pid'], 'reply' );
$page = floor( ($this->topic['posts'] + 1) / $ibforums->vars['display_max_posts']);
$page = $page * $ibforums->vars['display_max_posts'];
$print->redirect_screen( $ibforums->lang['moderate_post'], "showtopic={$this->topic['tid']}&st=$page" );
}
//-----------------------------------------
// Are we tracking topics we reply in 'auto_track'?
//-----------------------------------------
$this->class->pf_add_tracked_topic($this->topic['tid'], 1);
//-----------------------------------------
// Check for subscribed topics
// Pass on the previous last post time of the topic
// to see if we need to send emails out
//-----------------------------------------
$this->class->topic_tracker( $this->topic['tid'], $this->post['post'], $poster_name, $this->last_post );
//-----------------------------------------
// Redirect them back to the topic
//-----------------------------------------
if ($return_to_move == 1)
{
$std->boink_it($this->class->base_url."act=Mod&CODE=02&f={$this->class->forum['id']}&t={$this->topic['tid']}");
}
else
{
$page = floor( ($this->topic['posts'] + 1) / $ibforums->vars['display_max_posts']);
$page = $page * $ibforums->vars['display_max_posts'];
$std->boink_it($ibforums->base_url."showtopic={$this->topic['tid']}&st=$page&p={$this->post['pid']}&#entry{$this->post['pid']}");
}
}
/*-------------------------------------------------------------------------*/
// SHOW FORM
/*-------------------------------------------------------------------------*/
function show_form()
{
global $ibforums, $std, $DB, $print, $forums;
//-----------------------------------------
// Are we quoting posts?
//-----------------------------------------
$raw_post = $this->class->check_multi_quote();
//-----------------------------------------
// Do we have any posting errors?
//-----------------------------------------
if ($this->class->obj['post_errors'])
{
$this->class->output .= $this->class->html->errors( $ibforums->lang[ $this->class->obj['post_errors'] ]);
}
if ($this->class->obj['preview_post'])
{
$this->class->parser->pp_do_html = intval($ibforums->input['post_htmlstatus']) AND $this->class->forum['use_html'] AND $ibforums->member['g_dohtml'] ? 1 : 0;
$this->class->parser->pp_nl2br = $ibforums->input['post_htmlstatus'] == 2 ? 1 : 0;
$this->post['post'] = $this->class->parser->post_db_parse(
$this->class->parser->convert( array(
'TEXT' => $this->post['post'],
'CODE' => $this->class->forum['use_ibc'],
'SMILIES' => $ibforums->input['enableemo'],
'HTML' => $this->class->forum['use_html']
) )
);
$this->class->output .= $this->class->html->preview( $this->post['post'] );
}
$this->class->output .= $this->class->html_start_form( array( 1 => array( 'CODE' , '03' ),
2 => array( 't' , $this->topic['tid'] ),
3 => array( 'post_key' , $this->post_key ),
4 => array( 'parent_id', $ibforums->input['parent_id'] ),
) );
//-----------------------------------------
// START TABLE
//-----------------------------------------
$this->class->output .= $this->class->html->table_structure();
//-----------------------------------------
$start_table = $this->class->html->table_top( "{$ibforums->lang['top_txt_reply']} {$this->topic['title']}");
$name_fields = $this->class->html_name_field();
$post_box = $this->class->html_post_body( $raw_post );
$mod_options = $this->class->mod_options(1);
$end_form = $this->class->html->EndForm( $ibforums->lang['submit_reply'] );
$post_icons = $this->class->html_post_icons();
if ($this->class->can_upload)
{
$upload_field = $this->class->html_build_uploads($this->post_key,'reply');
}
//-----------------------------------------
$this->class->output = str_replace( "<!--START TABLE-->" , $start_table , $this->class->output );
$this->class->output = str_replace( "<!--NAME FIELDS-->" , $name_fields , $this->class->output );
$this->class->output = str_replace( "<!--POST BOX-->" , $post_box , $this->class->output );
$this->class->output = str_replace( "<!--POST ICONS-->" , $post_icons , $this->class->output );
$this->class->output = str_replace( "<!--UPLOAD FIELD-->", $upload_field , $this->class->output );
$this->class->output = str_replace( "<!--MOD OPTIONS-->" , $mod_options , $this->class->output );
$this->class->output = str_replace( "<!--END TABLE-->" , $end_form , $this->class->output );
$this->class->output = str_replace( "<!--FORUM RULES-->" , $std->print_forum_rules($this->class->forum), $this->class->output );
//-----------------------------------------
$this->class->output = $this->class->html_add_smilie_box( $this->class->output );
//-----------------------------------------
// Add in siggy buttons and such
//-----------------------------------------
$this->class->html_checkboxes('reply', $this->topic['tid'], $this->class->forum['id']);
//-----------------------------------------
$this->class->html_topic_summary($this->topic['tid']);
$this->nav = array( "<a href='{$this->class->base_url}act=SC&amp;c={$this->class->forum[cat_id]}'>{$this->class->forum['cat_name']}</a>",
"<a href='{$this->class->base_url}showforum={$this->class->forum['id']}'>{$this->class->forum['name']}</a>",
"<a href='{$this->class->base_url}showtopic={$this->topic['tid']}'>{$this->topic['title']}</a>",
);
$this->title = $ibforums->lang['replying_in'].' '.$this->topic['title'];
$print->add_output( $this->class->output );
$print->do_output( array( 'TITLE' => $ibforums->vars['board_name']." -> ".$this->title,
'JS' => 1,
'NAV' => $this->class->nav,
) );
}
}
?>
+323 -151
View File
@@ -2,16 +2,28 @@
/*
+--------------------------------------------------------------------------
| Invision Power Board v2.0.0
| Invision Power Board 2.1.7
| =============================================
| by Matthew Mecham
| (c) 2001 - 2004 Invision Power Services, Inc.
| (c) 2001 - 2005 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| Time: Tue, 21 Sep 2004 16:34:28 GMT
| Release: 150aa7a702c3c8b6f6eb90ad49305d2f
| 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: 2006-02-02 17:23:13 +0000 (Thu, 02 Feb 2006) $
| > $Revision: 133 $
| > $Author: bfarber $
+---------------------------------------------------------------------------
|
| > MySQL FULL TEXT Search Library
@@ -28,18 +40,16 @@ class search_lib extends Search
var $parser = "";
var $is = "";
var $resultlimit = "";
//-----------------------------------------
// Constructor
//-----------------------------------------
function search_lib($that)
function search_lib(&$that)
{
global $ibforums, $DB, $std, $print;
$this->is = &$that; // hahaha!
$this->is = &$that; // hahaha!
$this->resultlimit = $this->is->resultlimit;
}
//-----------------------------------------
@@ -48,11 +58,10 @@ class search_lib extends Search
function do_simple_search()
{
global $ibforums, $DB, $std, $HTTP_POST_VARS, $print, $forums;
if ( ! $ibforums->input['sid'] )
if ( ! $this->ipsclass->input['sid'] )
{
$boolean = "";
$boolean = "";
$topics_name = "";
//-----------------------------------------
// NEW SEARCH.. Check Keywords..
@@ -61,23 +70,23 @@ class search_lib extends Search
if ( $this->is->mysql_version >= 40010 )
{
$boolean = 'IN BOOLEAN MODE';
$keywords = $this->is->filter_ftext_keywords($ibforums->input['keywords']);
$keywords = $this->is->filter_ftext_keywords($this->ipsclass->input['keywords']);
}
else
{
$keywords = $this->is->filter_keywords($ibforums->input['keywords']);
$keywords = $this->is->filter_keywords($this->ipsclass->input['keywords']);
}
$check_keywords = trim($keywords);
if ( (! $check_keywords) or ($check_keywords == "") or (! isset($check_keywords) ) )
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'no_search_words') );
$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'no_search_words') );
}
if (strlen(trim($keywords)) < $ibforums->vars['min_search_word'])
if (strlen(trim($keywords)) < $this->ipsclass->vars['min_search_word'])
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'search_word_short', 'EXTRA' => 4) );
$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'search_word_short', 'EXTRA' => 4) );
}
//-----------------------------------------
@@ -99,9 +108,9 @@ class search_lib extends Search
// Allow abc* but not a***
//-----------------------------------------
if ( strlen( $t ) < 3 )
if ( strlen( $t ) < $this->ipsclass->vars['min_search_word'] )
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'search_word_short', 'EXTRA' => 4) );
$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'search_word_short', 'EXTRA' => $this->ipsclass->vars['min_search_word']) );
}
}
@@ -115,26 +124,48 @@ class search_lib extends Search
if ($myforums == "")
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'no_search_forum') );
$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'no_search_forum') );
}
//-----------------------------------------
// Only allowed to see their own topics?
//-----------------------------------------
if ( ! $this->ipsclass->member['g_other_topics'] )
{
$topics_name = " AND t.starter_id=".$this->ipsclass->member['id'];
}
//-----------------------------------------
// Allowed to see queueueueueuueueueued?
//-----------------------------------------
if ( ! $this->ipsclass->member['g_is_supmod'] )
{
$approved = 'and p.queued=0 and t.approved=1';
}
else
{
$approved = 'and p.queued IN (0,1)';
}
//-----------------------------------------
// How many results?
//-----------------------------------------
$DB->query("SELECT COUNT(*) as dracula
FROM ".SQL_PREFIX."posts p
LEFT JOIN ".SQL_PREFIX."topics t ON (t.tid=p.topic_id)
WHERE t.forum_id IN ($myforums)
AND MATCH(p.post) AGAINST ('$check_keywords' $boolean)");
$this->ipsclass->DB->query("SELECT COUNT(*) as dracula
FROM ".SQL_PREFIX."posts p
LEFT JOIN ".SQL_PREFIX."topics t ON (t.tid=p.topic_id)
WHERE t.forum_id IN ($myforums) {$topics_name} {$approved}
AND MATCH(p.post) AGAINST ('$check_keywords' $boolean)");
$count = $DB->fetch_row();
$count = $this->ipsclass->DB->fetch_row();
if ( $count['dracula'] < 1 ) // Tee-hee!
{
$this->output .= $this->is->html->search_error_page($ibforums->input['keywords']);
$print->add_output( $this->output );
$print->do_output( array( 'TITLE' => $ibforums->lang['g_simple_title'], 'JS' => 0, NAV => array( $ibforums->lang['g_simple_title'] ) ) );
$this->output .= $this->ipsclass->compiled_templates['skin_search']->search_error_page($this->ipsclass->input['keywords']);
$this->ipsclass->print->add_output( $this->output );
$this->ipsclass->print->do_output( array( 'TITLE' => $this->ipsclass->lang['g_simple_title'], 'JS' => 0, NAV => array( $this->ipsclass->lang['g_simple_title'] ) ) );
}
//-----------------------------------------
@@ -147,34 +178,34 @@ class search_lib extends Search
LEFT JOIN ".SQL_PREFIX."topics t on (p.topic_id=t.tid)
LEFT JOIN ".SQL_PREFIX."members m on (m.id=p.author_id)
LEFT JOIN ".SQL_PREFIX."member_extra me on (me.id=p.author_id)
WHERE t.forum_id IN ($myforums) AND t.title IS NOT NULL
WHERE t.forum_id IN ($myforums) AND t.title IS NOT NULL {$topics_name} {$approved}
AND MATCH(post) AGAINST ('$check_keywords' $boolean)";
if ( $ibforums->input['sortby'] != "relevant" )
if ( $this->ipsclass->input['sortby'] != "relevant" )
{
$cache .= " ORDER BY p.post_date DESC";
}
$unique_id = md5(uniqid(microtime(),1));
$str = $DB->compile_db_insert_string( array (
$str = $this->ipsclass->DB->compile_db_insert_string( array (
'id' => $unique_id,
'search_date'=> time(),
'topic_id' => '00',
'topic_max' => $count['dracula'],
'member_id' => $ibforums->member['id'],
'ip_address' => $ibforums->input['IP_ADDRESS'],
'member_id' => $this->ipsclass->member['id'],
'ip_address' => $this->ipsclass->input['IP_ADDRESS'],
'post_id' => '00',
'query_cache'=> $cache,
) );
$DB->query("INSERT INTO ibf_search_results ({$str['FIELD_NAMES']}) VALUES ({$str['FIELD_VALUES']})");
$this->ipsclass->DB->query("INSERT INTO ibf_search_results ({$str['FIELD_NAMES']}) VALUES ({$str['FIELD_VALUES']})");
$hilight = str_replace( '&quot;', '', $ibforums->input['keywords'] );
$hilight = str_replace( '&quot;', '', $this->ipsclass->input['keywords'] );
$hilight = urlencode(trim(str_replace( '&amp;', '&', $hilight)));
$print->redirect_screen( $ibforums->lang['search_redirect'] , "act=Search&CODE=simpleresults&sid=$unique_id&highlite=".$hilight );
$this->ipsclass->print->redirect_screen( $this->ipsclass->lang['search_redirect'] , "act=Search&CODE=simpleresults&sid=$unique_id&highlite=".$hilight );
}
else
@@ -183,45 +214,47 @@ class search_lib extends Search
// Load up the topic stuff
//-----------------------------------------
require_once( ROOT_PATH.'sources/topics.php' );
require_once( ROOT_PATH.'sources/action_public/topics.php' );
$this->topics = new topics();
$this->topics->ipsclass =& $this->ipsclass;
$this->topics->topic_init();
//-----------------------------------------
// Get SQL schtuff
//-----------------------------------------
$this->unique_id = $ibforums->input['sid'];
$this->unique_id = $this->ipsclass->input['sid'];
if ($this->unique_id == "")
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'no_search_results' ) );
$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'no_search_results' ) );
}
$DB->query("SELECT * FROM ibf_search_results WHERE id='{$this->unique_id}'");
$this->ipsclass->DB->query("SELECT * FROM ibf_search_results WHERE id='{$this->unique_id}'");
if ( ! $sr = $DB->fetch_row() )
if ( ! $sr = $this->ipsclass->DB->fetch_row() )
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'no_search_results' ) );
$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'no_search_results' ) );
}
$query = stripslashes($sr['query_cache']);
$check_keywords = preg_replace( '/&amp;(lt|gt|quot);/', "&\\1;", trim(urldecode($ibforums->input['highlite'])) );
$check_keywords = preg_replace( '/&amp;(lt|gt|quot);/', "&\\1;", trim(urldecode($this->ipsclass->input['highlite'])) );
//-----------------------------------------
// Display
//-----------------------------------------
$this->links = $std->build_pagelinks(
$this->links = $this->ipsclass->build_pagelinks(
array(
'TOTAL_POSS' => $sr['topic_max'],
'leave_out' => 10,
'PER_PAGE' => 25,
'CUR_ST_VAL' => $this->is->first,
'L_SINGLE' => $ibforums->lang['sp_single'],
'L_SINGLE' => $this->ipsclass->lang['sp_single'],
'L_MULTI' => "",
'BASE_URL' => $ibforums->base_url."&amp;act=Search&amp;CODE=simpleresults&amp;sid=".$this->unique_id."&amp;highlite=".urlencode(str_replace('"', '', $check_keywords)),
'BASE_URL' => $this->ipsclass->base_url."&amp;act=Search&amp;CODE=simpleresults&amp;sid=".$this->unique_id."&amp;highlite=".urlencode(str_replace('"', '', $check_keywords)),
)
);
@@ -235,7 +268,7 @@ class search_lib extends Search
$SQLtime->startTimer();
$outer = $DB->query($query." LIMIT {$this->is->first},25");
$outer = $this->ipsclass->DB->query($query." LIMIT {$this->is->first},25");
$ex_time = sprintf( "%.4f",$SQLtime->endTimer() );
@@ -246,18 +279,18 @@ class search_lib extends Search
$show_end = $sr['topic_max'];
}
$this->output .= $this->is->html->result_simple_header(array(
'links' => $this->links,
'start' => $this->is->first,
'end' => $show_end + $this->is->first,
'matches' => $sr['topic_max'],
'ex_time' => $ex_time,
'keyword' => $check_keywords,
) );
$this->output .= $this->ipsclass->compiled_templates['skin_search']->result_simple_header(array(
'links' => $this->links,
'start' => $this->is->first,
'end' => $show_end + $this->is->first,
'matches' => $sr['topic_max'],
'ex_time' => $ex_time,
'keyword' => $check_keywords,
) );
$attach_pids = array();
while ( $row = $DB->fetch_row($outer) )
while ( $row = $this->ipsclass->DB->fetch_row($outer) )
{
//-----------------------------------------
// Listen up, this is relevant.
@@ -273,13 +306,13 @@ class search_lib extends Search
$row['relevance'] = sprintf( "%3d", ( $row['score'] > 1.0 ) ? 100 : $row['score'] * 100 );
$row['post_date'] = $std->get_date( $row['post_date'], 'LONG' );
$row['post_date'] = $this->ipsclass->get_date( $row['post_date'], 'LONG' );
// Link member's name
if ($row['author_id'])
{
$row['author_name'] = "<a href='{$ibforums->base_url}act=Profile&amp;MID={$row['author_id']}'>{$row['author_name']}</a>";
$row['author_name'] = "<a href='{$this->ipsclass->base_url}act=Profile&amp;MID={$row['author_id']}'>{$row['author_name']}</a>";
}
//-----------------------------------------
@@ -295,22 +328,14 @@ class search_lib extends Search
// Fix up quotes..
//-----------------------------------------
$row['post'] = $this->topics->parser->unconvert( $row['post'] );
$this->topics->parser->parse_html = ( $this->ipsclass->forums->forum_by_id[$row['forum_id']]['use_html'] and $this->ipsclass->cache['group_cache'][ $row['mgroup'] ]['g_dohtml'] and $row['post_htmlstate'] ) ? 1 : 0;
$this->topics->parser->parse_wordwrap = $this->ipsclass->vars['post_wordwrap'];
$this->topics->parser->parse_nl2br = $row['post_htmlstate'] == 2 ? 1 : 0;
$row['post'] = $this->topics->parser->convert( array(
'TEXT' => $row['post'],
'CODE' => $forums->forum_by_id[$row['forum_id']]['use_ibc'],
'SMILIES' => 1,
'HTML' => 0
) );
$this->topics->parser->pp_do_html = ( $forums->forum_by_id[$row['forum_id']]['use_html'] and $ibforums->cache['group_cache'][ $row['mgroup'] ]['g_dohtml'] and $row['post_htmlstate'] ) ? 1 : 0;
$this->topics->parser->pp_wordwrap = $ibforums->vars['post_wordwrap'];
$this->topics->parser->pp_nl2br = $row['post_htmlstate'] == 2 ? 1 : 0;
$row['post'] = $this->topics->parser->pre_db_parse( $this->topics->parser->pre_edit_parse( $row['post'] ) );
$row['post'] = $this->topics->parser->pre_display_parse( $row['post'] );
$row['post'] = $this->topics->parser->post_db_parse( $row['post'] );
$keywords_array = explode( " ", str_replace( "+", " ", $ibforums->input['highlite'] ) );
$keywords_array = explode( " ", str_replace( "+", " ", $this->ipsclass->input['highlite'] ) );
if ( count($keywords_array) )
{
@@ -328,10 +353,10 @@ class search_lib extends Search
}
}
$row['forum_name'] = $forums->forum_by_id[ $row['forum_id'] ]['name'];
$row['forum_name'] = $this->ipsclass->forums->forum_by_id[ $row['forum_id'] ]['name'];
$this->output .= $this->is->html->RenderPostRow($row, $member);
$this->output .= $this->ipsclass->compiled_templates['skin_search']->RenderPostRow($row, $member);
}
//-----------------------------------------
@@ -343,10 +368,10 @@ class search_lib extends Search
$this->output = $this->topics->parse_attachments( $this->output, $attach_pids );
}
$this->output .= $this->is->html->end_results_table(array( 'SHOW_PAGES' => $this->links ) , 1 );
$this->output .= $this->ipsclass->compiled_templates['skin_search']->end_results_table(array( 'SHOW_PAGES' => $this->links ) , 1 );
$print->add_output("$this->output");
$print->do_output( array( 'TITLE' => $ibforums->lang['g_simple_title'], 'JS' => 0, NAV => array( $ibforums->lang['g_simple_title'] ) ) );
$this->ipsclass->print->add_output("$this->output");
$this->ipsclass->print->do_output( array( 'TITLE' => $this->ipsclass->lang['g_simple_title'], 'JS' => 0, NAV => array( $this->ipsclass->lang['g_simple_title'] ) ) );
}
@@ -362,8 +387,40 @@ class search_lib extends Search
function do_main_search()
{
global $ibforums, $DB, $std, $HTTP_POST_VARS, $print;
//-----------------------------------------
// Invisible topic-approval permissions?
//-----------------------------------------
$my_invisible_forums_t = array();
$my_invisible_forums_p = array();
if( is_array($this->ipsclass->cache['moderators']) AND count($this->ipsclass->cache['moderators']) )
{
foreach( $this->ipsclass->cache['moderators'] as $k => $v )
{
if( $v['member_id'] == $this->ipsclass->member['id'] AND $v['post_q'] )
{
$my_invisible_forums_p[] = $v['forum_id'];
}
if( $v['member_id'] == $this->ipsclass->member['id'] AND $v['topic_q'] )
{
$my_invisible_forums_t[] = $v['forum_id'];
}
if( $v['is_group'] && ( $v['group_id'] == $this->ipsclass->member['mgroup']
OR in_array( $v['group_id'], explode( ",", $this->ipsclass->clean_perm_string( $this->ipsclass->member['mgroup_others'] ) ) ) ) && $v['post_q'] )
{
$my_invisible_forums_p[] = $v['forum_id'];
}
if( $v['is_group'] && ( $v['group_id'] == $this->ipsclass->member['mgroup']
OR in_array( $v['group_id'], explode( ",", $this->ipsclass->clean_perm_string( $this->ipsclass->member['mgroup_others'] ) ) ) ) && $v['topic_q'] )
{
$my_invisible_forums_t[] = $v['forum_id'];
}
}
}
//-----------------------------------------
// Do we have any input?
//-----------------------------------------
@@ -373,31 +430,31 @@ class search_lib extends Search
//-----------------------------------------
if ($ibforums->input['namesearch'] != "")
if ($this->ipsclass->input['namesearch'] != "")
{
$name_filter = $this->is->filter_keywords($ibforums->input['namesearch'], 1);
$name_filter = $this->is->filter_keywords($this->ipsclass->input['namesearch'], 1);
}
if ($ibforums->input['useridsearch'] != "")
if ($this->ipsclass->input['useridsearch'] != "")
{
$keywords = $this->is->filter_keywords($ibforums->input['useridsearch']);
$keywords = $this->is->filter_keywords($this->ipsclass->input['useridsearch']);
$this->is->search_type = 'userid';
}
else
{
$keywords = $this->is->filter_keywords($ibforums->input['keywords']);
$keywords = $this->is->filter_keywords($this->ipsclass->input['keywords']);
$this->is->search_type = 'posts';
}
if ( $name_filter != "" AND $ibforums->input['keywords'] != "" )
if ( $name_filter != "" AND $this->ipsclass->input['keywords'] != "" )
{
$type = 'joined';
}
else if ( $name_filter == "" AND $ibforums->input['keywords'] != "" )
else if ( $name_filter == "" AND $this->ipsclass->input['keywords'] != "" )
{
$type= 'postonly';
}
else if ( $name_filter != "" AND $ibforums->input['keywords'] == "" )
else if ( $name_filter != "" AND $this->ipsclass->input['keywords'] == "" )
{
$type='nameonly';
}
@@ -407,27 +464,35 @@ class search_lib extends Search
if ( $this->is->mysql_version >= 40010 )
{
$boolean = 'IN BOOLEAN MODE';
$keywords = $this->is->filter_ftext_keywords($ibforums->input['keywords']);
$keywords = $this->is->filter_ftext_keywords($this->ipsclass->input['keywords']);
}
else
{
$keywords = $this->is->filter_keywords($ibforums->input['keywords']);
$keywords = $this->is->filter_keywords($this->ipsclass->input['keywords']);
}
$check_keywords = trim($keywords);
if ( (! $check_keywords) or ($check_keywords == "") or (! isset($check_keywords) ) )
{
if ($ibforums->input['namesearch'] == "")
if ($this->ipsclass->input['namesearch'] == "")
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'no_search_words') );
$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'no_search_words') );
}
}
else
{
if ( strlen(trim($keywords)) < $ibforums->vars['min_search_word'] and $type != 'nameonly' )
if ( strlen(trim($keywords)) < $this->ipsclass->vars['min_search_word'] and $type != 'nameonly' )
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'search_word_short', 'EXTRA' => 4) );
if ( $this->is->xml_out )
{
print sprintf( $this->ipsclass->lang['xml_char'], $this->ipsclass->vars['min_search_word'] );
exit();
}
else
{
$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'search_word_short', 'EXTRA' => $this->ipsclass->vars['min_search_word']) );
}
}
}
@@ -450,15 +515,23 @@ class search_lib extends Search
// Allow abc* but not a***
//-----------------------------------------
if ( ( strlen( $t ) < $ibforums->vars['min_search_word'] ) and $type != 'nameonly' )
if ( ( strlen( $t ) < $this->ipsclass->vars['min_search_word'] ) and $type != 'nameonly' )
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'search_word_short', 'EXTRA' => 4) );
if ( $this->is->xml_out )
{
print sprintf( $this->ipsclass->lang['xml_char'], $this->ipsclass->vars['min_search_word'] );
exit();
}
else
{
$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'search_word_short', 'EXTRA' => $this->ipsclass->vars['min_search_word']) );
}
}
}
//-----------------------------------------
if ($ibforums->input['search_in'] == 'titles')
if ($this->ipsclass->input['search_in'] == 'titles')
{
$this->is->search_in = 'titles';
}
@@ -473,14 +546,14 @@ class search_lib extends Search
if ($forums == "")
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'no_search_forum') );
$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'no_search_forum') );
}
//-----------------------------------------
foreach( array( 'last_post', 'posts', 'starter_name', 'forum_id' ) as $v )
{
if ($ibforums->input['sort_key'] == $v)
if ( $this->ipsclass->input['sort_key'] == $v )
{
$this->is->sort_key = $v;
}
@@ -490,7 +563,7 @@ class search_lib extends Search
foreach ( array( 1, 7, 30, 60, 90, 180, 365, 0 ) as $v )
{
if ($ibforums->input['prune'] == $v)
if ($this->ipsclass->input['prune'] == $v)
{
$this->is->prune = $v;
}
@@ -498,21 +571,21 @@ class search_lib extends Search
//-----------------------------------------
if ($ibforums->input['sort_order'] == 'asc')
if ($this->ipsclass->input['sort_order'] == 'asc')
{
$this->is->sort_order = 'asc';
}
//-----------------------------------------
if ($ibforums->input['result_type'] == 'posts')
if ($this->ipsclass->input['result_type'] == 'posts')
{
$this->is->result_type = 'posts';
}
if ( $ibforums->vars['min_search_word'] < 1 )
if ( $this->ipsclass->vars['min_search_word'] < 1 )
{
$ibforums->vars['min_search_word'] = 4;
$this->ipsclass->vars['min_search_word'] = 4;
}
//-----------------------------------------
@@ -521,8 +594,8 @@ class search_lib extends Search
if ($this->is->prune > 0)
{
$gt_lt = $ibforums->input['prune_type'] == 'older' ? "<" : ">";
$time = time() - ($ibforums->input['prune'] * 86400);
$gt_lt = $this->ipsclass->input['prune_type'] == 'older' ? "<" : ">";
$time = time() - ($this->ipsclass->input['prune'] * 86400);
if ( $this->is->result_type == 'posts' )
{
@@ -536,33 +609,46 @@ class search_lib extends Search
$posts_datecut = "p.post_date $gt_lt $time AND";
}
// Is this a membername search?
//-----------------------------------------
// Only allowed to see their own topics?
//-----------------------------------------
if ( ! $this->ipsclass->member['g_other_topics'] )
{
$name_filter = "";
$posts_name = " AND t.starter_id=".$this->ipsclass->member['id'];
$topics_name = " AND t.starter_id=".$this->ipsclass->member['id'];
}
//-----------------------------------------
// Is this a membername search?
//-----------------------------------------
$name_filter = trim( $name_filter );
$member_string = "";
$name_filter = trim( $name_filter );
$member_string = "";
if ( $name_filter != "" )
{
if ( $name_filter != "" )
{
//-----------------------------------------
// Get all the possible matches for the supplied name from the DB
//-----------------------------------------
$name_filter = str_replace( '|', "&#124;", $name_filter );
if ($ibforums->input['exactname'] == 1)
if ($this->ipsclass->input['exactname'] == 1)
{
$sql_query = "SELECT id from ibf_members WHERE lower(name)='".$name_filter."'";
$sql_query = "SELECT id from ibf_members WHERE LOWER(members_display_name)='".$name_filter."'";
}
else
{
$sql_query = "SELECT id from ibf_members WHERE name like '%".$name_filter."%'";
$sql_query = "SELECT id from ibf_members WHERE members_display_name like '%".$name_filter."%'";
}
$DB->query( $sql_query );
$this->ipsclass->DB->query( $sql_query );
while ($row = $DB->fetch_row())
while ($row = $this->ipsclass->DB->fetch_row())
{
$member_string .= "'".$row['id']."',";
}
@@ -573,21 +659,19 @@ class search_lib extends Search
if ($member_string == "")
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'no_name_search_results') );
$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'no_name_search_results') );
}
$posts_name = " AND p.author_id IN ($member_string)";
$topics_name = " AND t.starter_id IN ($member_string)";
}
if ( $type != 'nameonly' )
{
if (strlen(trim($keywords)) < $ibforums->vars['min_search_word'])
if (strlen(trim($keywords)) < $this->ipsclass->vars['min_search_word'])
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'search_word_short', 'EXTRA' => $ibforums->vars['min_search_word']) );
$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'search_word_short', 'EXTRA' => $this->ipsclass->vars['min_search_word']) );
}
}
$unique_id = md5(uniqid(microtime(),1));
@@ -596,17 +680,17 @@ class search_lib extends Search
{
if ( ! $this->is->topic_search_only )
{
$topics_query = "SELECT t.tid
$topics_query = "SELECT t.tid, t.approved, t.forum_id
FROM ibf_topics t
WHERE $topics_datecut t.forum_id IN ($forums)
$topics_name AND t.approved=1 AND MATCH(title) AGAINST ('".trim($keywords)."' $boolean)";
$posts_query = "SELECT p.pid
$posts_query = "SELECT p.pid, p.queued, t.approved, t.forum_id
FROM ibf_posts p
LEFT JOIN ibf_topics t ON ( p.topic_id=t.tid )
WHERE $posts_datecut t.forum_id IN ($forums)
AND p.queued <> 1
AND p.queued=0
$posts_name AND MATCH(post) AGAINST ('".trim($keywords)."' $boolean)";
}
else
@@ -615,32 +699,32 @@ class search_lib extends Search
// Search in topic only
//-----------------------------------------
$posts_query = "SELECT p.pid
$posts_query = "SELECT p.pid, p.queued, t.approved, t.forum_id
FROM ibf_posts p
LEFT JOIN ibf_topics t ON ( p.topic_id=t.tid )
WHERE
p.topic_id={$this->is->topic_id}
AND $posts_datecut t.forum_id IN ($forums)
AND p.queued <> 1
AND p.queued=0
$posts_name AND MATCH(post) AGAINST ('".trim($keywords)."' $boolean)";
}
}
else
{
$topics_query = "SELECT t.tid
$topics_query = "SELECT t.tid, t.approved, t.forum_id
FROM ibf_topics t
WHERE $topics_datecut t.forum_id IN ($forums)
$topics_name";
$topics_name AND t.approved=1";
$posts_query = "SELECT p.pid
$posts_query = "SELECT p.pid, p.queued, t.approved, t.forum_id
FROM ibf_posts p
LEFT JOIN ibf_topics t ON ( p.topic_id=t.tid )
WHERE $posts_datecut t.forum_id IN ($forums)
AND p.queued <> 1
AND p.queued=0
$posts_name";
}
//print $topics_query."<br />".$posts_query; exit();
//-----------------------------------------
// Get the topic ID's to serialize and store into
// the database
@@ -649,32 +733,112 @@ class search_lib extends Search
$topics = "";
$posts = "";
$topic_array = array();
$topic_tmp = array();
$post_array = array();
$post_tmp = array();
$t_cnt = 0;
$p_cnt = 0;
$more = "";
//-----------------------------------------
// TID: Get 'em
//-----------------------------------------
if ( ! $this->is->topic_search_only )
{
$DB->query($topics_query);
$this->ipsclass->DB->query($topics_query);
while ($row = $DB->fetch_row() )
while ($row = $this->ipsclass->DB->fetch_row() )
{
$topic_array[ $row['tid'] ] = $row['tid'];
if( !$row['approved'] )
{
if( !$this->ipsclass->member['g_is_supmod'] )
{
if( !in_array( $row['forum_id'], $my_invisible_forums_t ) )
{
continue;
}
}
}
$topic_tmp[ $row['tid'] ] = $row['tid'];
}
$DB->free_result();
$this->ipsclass->DB->free_result();
}
//-----------------------------------------
// TID Sort 'em
//-----------------------------------------
$DB->query($posts_query);
krsort( $topic_tmp );
while ($row = $DB->fetch_row() )
foreach( $topic_tmp as $id => $tid )
{
$post_array[ $row['pid'] ] = $row['pid'];
$t_cnt++;
if ( $t_cnt > $this->resultlimit )
{
$more = 1;
break;
}
$topic_array[ $tid ] = $tid;
}
$DB->free_result();
//-----------------------------------------
// PID: Get 'em
//-----------------------------------------
$this->ipsclass->DB->query($posts_query);
while ($row = $this->ipsclass->DB->fetch_row() )
{
if( $row['queued'] )
{
if( !$this->ipsclass->member['g_is_supmod'] )
{
if( !in_array( $row['forum_id'], $my_invisible_forums_p ) )
{
continue;
}
}
}
if( !$row['approved'] )
{
if( !$this->ipsclass->member['g_is_supmod'] )
{
if( !in_array( $row['forum_id'], $my_invisible_forums_t ) )
{
continue;
}
}
}
$post_tmp[ $row['pid'] ] = $row['pid'];
}
$this->ipsclass->DB->free_result();
//-----------------------------------------
// PID Sort 'em
//-----------------------------------------
krsort( $post_tmp );
foreach( $post_tmp as $id => $pid )
{
$p_cnt++;
if ( $p_cnt > $this->resultlimit )
{
$more = 1;
break;
}
$post_array[ $pid ] = $pid;
}
//-----------------------------------------
@@ -687,10 +851,17 @@ class search_lib extends Search
if ($topics == "" and $posts == "")
{
$this->output .= $this->is->html->search_error_page($ibforums->input['keywords']);
$print->add_output( $this->output );
$print->do_output( array( 'TITLE' => $ibforums->lang['g_simple_title'], 'JS' => 0, NAV => array( $ibforums->lang['g_simple_title'] ) ) );
if ( $this->is->xml_out )
{
print sprintf( $this->ipsclass->lang['xml_nomatches'], str_replace( '"', "", $keywords ) );
exit();
}
else
{
$this->output .= $this->ipsclass->compiled_templates['skin_search']->search_error_page($this->ipsclass->input['keywords']);
$this->ipsclass->print->add_output( $this->output );
$this->ipsclass->print->do_output( array( 'TITLE' => $this->ipsclass->lang['g_simple_title'], 'JS' => 0, NAV => array( $this->ipsclass->lang['g_simple_title'] ) ) );
}
}
//-----------------------------------------
@@ -700,11 +871,12 @@ class search_lib extends Search
//-----------------------------------------
return array(
'topic_id' => $topics,
'post_id' => $posts,
'topic_max' => intval( count( $topic_array ) ),
'post_max' => intval( count( $post_array ) ),
'keywords' => str_replace( '"', "", $keywords ),
'topic_id' => $topics,
'post_id' => $posts,
'topic_max' => intval( count( $topic_array ) ),
'post_max' => intval( count( $post_array ) ),
'keywords' => str_replace( '"', "", $keywords ),
'query_cache' => $more,
);
}
+183 -67
View File
@@ -2,16 +2,28 @@
/*
+--------------------------------------------------------------------------
| Invision Power Board v2.0.0
| Invision Power Board 2.1.7
| =============================================
| by Matthew Mecham
| (c) 2001 - 2004 Invision Power Services, Inc.
| (c) 2001 - 2005 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| Time: Tue, 21 Sep 2004 16:34:28 GMT
| Release: 150aa7a702c3c8b6f6eb90ad49305d2f
| 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: 2006-02-02 17:23:13 +0000 (Thu, 02 Feb 2006) $
| > $Revision: 133 $
| > $Author: bfarber $
+---------------------------------------------------------------------------
|
| > MySQL Manual Search Library
@@ -27,16 +39,16 @@ class search_lib extends Search
{
var $parser = "";
var $is = "";
var $resultlimit = "";
//-----------------------------------------
// Constructor
//-----------------------------------------
function search_lib($that)
function search_lib(&$that)
{
global $ibforums, $DB, $std, $print;
$this->is = &$that; // hahaha!
$this->is = &$that; // hahaha!
$this->resultlimit = $this->is->resultlimit;
}
//-----------------------------------------
@@ -46,38 +58,36 @@ class search_lib extends Search
function do_main_search()
{
global $ibforums, $DB, $std, $HTTP_POST_VARS, $print;
//-----------------------------------------
// Do we have any input?
//-----------------------------------------
if ($ibforums->input['namesearch'] != "")
if ($this->ipsclass->input['namesearch'] != "")
{
$name_filter = $this->is->filter_keywords($ibforums->input['namesearch'], 1);
$name_filter = $this->is->filter_keywords($this->ipsclass->input['namesearch'], 1);
}
if ($ibforums->input['useridsearch'] != "")
if ($this->ipsclass->input['useridsearch'] != "")
{
$keywords = $this->is->filter_keywords($ibforums->input['useridsearch']);
$keywords = $this->is->filter_keywords($this->ipsclass->input['useridsearch']);
$this->is->search_type = 'userid';
}
else
{
$keywords = $this->is->filter_keywords($ibforums->input['keywords']);
$keywords = $this->is->filter_keywords($this->ipsclass->input['keywords']);
$this->is->search_type = 'posts';
}
if ( $name_filter != "" AND $ibforums->input['keywords'] != "" )
if ( $name_filter != "" AND $this->ipsclass->input['keywords'] != "" )
{
$type = 'joined';
}
else if ( $name_filter == "" AND $ibforums->input['keywords'] != "" )
else if ( $name_filter == "" AND $this->ipsclass->input['keywords'] != "" )
{
$type= 'postonly';
}
else if ( $name_filter != "" AND $ibforums->input['keywords'] == "" )
else if ( $name_filter != "" AND $this->ipsclass->input['keywords'] == "" )
{
$type='nameonly';
}
@@ -92,13 +102,13 @@ class search_lib extends Search
{
if ($type != 'nameonly')
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'no_search_words') );
$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'no_search_words') );
}
}
//-----------------------------------------
if ($ibforums->input['search_in'] == 'titles')
if ($this->ipsclass->input['search_in'] == 'titles')
{
$this->is->search_in = 'titles';
}
@@ -113,14 +123,14 @@ class search_lib extends Search
if ($forums == "")
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'no_search_forum') );
$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'no_search_forum') );
}
//-----------------------------------------
foreach( array( 'last_post', 'posts', 'starter_name', 'forum_id' ) as $v )
{
if ($ibforums->input['sort_key'] == $v)
if ($this->ipsclass->input['sort_key'] == $v)
{
$this->is->sort_key = $v;
}
@@ -130,7 +140,7 @@ class search_lib extends Search
foreach ( array( 1, 7, 30, 60, 90, 180, 365, 0 ) as $v )
{
if ($ibforums->input['prune'] == $v)
if ($this->ipsclass->input['prune'] == $v)
{
$this->is->prune = $v;
}
@@ -138,21 +148,21 @@ class search_lib extends Search
//-----------------------------------------
if ($ibforums->input['sort_order'] == 'asc')
if ($this->ipsclass->input['sort_order'] == 'asc')
{
$this->is->sort_order = 'asc';
}
//-----------------------------------------
if ($ibforums->input['result_type'] == 'posts')
if ($this->ipsclass->input['result_type'] == 'posts')
{
$this->is->result_type = 'posts';
}
if ( $ibforums->vars['min_search_word'] < 1 )
if ( $this->ipsclass->vars['min_search_word'] < 1 )
{
$ibforums->vars['min_search_word'] = 4;
$this->ipsclass->vars['min_search_word'] = 4;
}
//-----------------------------------------
@@ -161,40 +171,51 @@ class search_lib extends Search
if ($this->is->prune > 0)
{
$gt_lt = $ibforums->input['prune_type'] == 'older' ? "<" : ">";
$time = time() - ($ibforums->input['prune'] * 86400);
$gt_lt = $this->ipsclass->input['prune_type'] == 'older' ? "<" : ">";
$time = time() - ($this->ipsclass->input['prune'] * 86400);
$topics_datecut = "t.last_post $gt_lt $time AND";
$posts_datecut = "p.post_date $gt_lt $time AND";
}
// Is this a membername search?
$name_filter = trim( $name_filter );
$member_string = "";
if ( $name_filter != "" )
{
//-----------------------------------------
// Only allowed to see their own topics?
//-----------------------------------------
if ( ! $this->ipsclass->member['g_other_topics'] )
{
$name_filter = "";
$posts_name = " AND t.starter_id=".$this->ipsclass->member['id'];
$topics_name = " AND t.starter_id=".$this->ipsclass->member['id'];
}
// Is this a membername search?
$name_filter = trim( $name_filter );
$member_string = "";
if ( $name_filter != "" )
{
//-----------------------------------------
// Get all the possible matches for the supplied name from the DB
//-----------------------------------------
$name_filter = str_replace( '|', "&#124;", $name_filter );
if ($ibforums->input['exactname'] == 1)
if ($this->ipsclass->input['exactname'] == 1)
{
$sql_query = "SELECT id from ibf_members WHERE lower(name)='".$name_filter."'";
$sql_query = "SELECT id from ibf_members WHERE LOWER(members_display_name)='".$name_filter."'";
}
else
{
$sql_query = "SELECT id from ibf_members WHERE name like '%".$name_filter."%'";
$sql_query = "SELECT id from ibf_members WHERE members_display_name like '%".$name_filter."%'";
}
$DB->query( $sql_query );
$this->ipsclass->DB->query( $sql_query );
while ($row = $DB->fetch_row())
while ($row = $this->ipsclass->DB->fetch_row())
{
$member_string .= "'".$row['id']."',";
}
@@ -205,7 +226,7 @@ class search_lib extends Search
if ($member_string == "")
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'no_name_search_results') );
$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'no_name_search_results') );
}
$posts_name = " AND p.author_id IN ($member_string)";
@@ -228,9 +249,9 @@ class search_lib extends Search
$boolean = $matches[1][$i];
$word = trim($matches[2][$i]);
if (strlen($word) < $ibforums->vars['min_search_word'])
if (strlen($word) < $this->ipsclass->vars['min_search_word'])
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'search_word_short', 'EXTRA' => $ibforums->vars['min_search_word']) );
$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'search_word_short', 'EXTRA' => $this->ipsclass->vars['min_search_word']) );
}
if ($boolean)
@@ -248,10 +269,9 @@ class search_lib extends Search
}
else
{
if (strlen(trim($keywords)) < $ibforums->vars['min_search_word'])
if (strlen(trim($keywords)) < $this->ipsclass->vars['min_search_word'])
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'search_word_short', 'EXTRA' => $ibforums->vars['min_search_word']) );
$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'search_word_short', 'EXTRA' => $this->ipsclass->vars['min_search_word']) );
}
$title_like = " LOWER(t.title) LIKE '%".trim($keywords)."%' ";
@@ -265,32 +285,41 @@ class search_lib extends Search
if ($type != 'nameonly')
{
$topics_query = "SELECT t.tid
if( $this->is->topic_search_only == 1 )
{
$topic_filter = " t.tid={$this->is->topic_id} AND ";
}
else
{
$topic_filter = "";
}
$topics_query = "SELECT t.tid, t.approved, t.forum_id
FROM ibf_topics t
WHERE $topics_datecut t.forum_id IN ($forums)
WHERE {$topic_filter}{$topics_datecut} t.forum_id IN ($forums)
$topics_name AND t.approved=1 AND ($title_like)";
$posts_query = "SELECT p.pid
$posts_query = "SELECT p.pid, p.queued, t.approved, t.forum_id
FROM ibf_posts p
LEFT JOIN ibf_topics t on (t.tid=p.topic_id)
WHERE $posts_datecut t.forum_id IN ($forums)
AND p.queued <> 1
WHERE {$topic_filter}{$posts_datecut} t.forum_id IN ($forums)
AND p.queued=0
$posts_name AND ($post_like)";
}
else
{
$topics_query = "SELECT t.tid
$topics_query = "SELECT t.tid, t.approved, t.forum_id
FROM ibf_topics t
WHERE $topics_datecut t.forum_id IN ($forums)
$topics_name";
$posts_query = "SELECT p.pid
$posts_query = "SELECT p.pid, p.queued, t.approved, t.forum_id
FROM ibf_posts p
LEFT JOIN ibf_topics t on (t.tid=p.topic_id)
WHERE $posts_datecut t.forum_id IN ($forums)
AND p.queued <> 1
AND p.queued=0
$posts_name";
}
@@ -301,32 +330,118 @@ class search_lib extends Search
$topics = "";
$posts = "";
$t_cnt = 0;
$p_cnt = 0;
$more = "";
//-----------------------------------------
$DB->query($topics_query);
$topic_max_hits = $DB->get_num_rows();
$my_invisible_forums_t = array();
$my_invisible_forums_p = array();
while ($row = $DB->fetch_row() )
if( is_array($this->ipsclass->cache['moderators']) AND count($this->ipsclass->cache['moderators']) )
{
foreach( $this->ipsclass->cache['moderators'] as $k => $v )
{
if( $v['member_id'] == $this->ipsclass->member['id'] AND $v['post_q'] )
{
$my_invisible_forums_p[] = $v['forum_id'];
}
if( $v['member_id'] == $this->ipsclass->member['id'] AND $v['topic_q'] )
{
$my_invisible_forums_t[] = $v['forum_id'];
}
if( $v['is_group'] && ( $v['group_id'] == $this->ipsclass->member['mgroup']
OR in_array( $v['group_id'], explode( ",", $this->ipsclass->clean_perm_string( $this->ipsclass->member['mgroup_others'] ) ) ) ) && $v['post_q'] )
{
$my_invisible_forums_p[] = $v['forum_id'];
}
if( $v['is_group'] && ( $v['group_id'] == $this->ipsclass->member['mgroup']
OR in_array( $v['group_id'], explode( ",", $this->ipsclass->clean_perm_string( $this->ipsclass->member['mgroup_others'] ) ) ) ) && $v['topic_q'] )
{
$my_invisible_forums_t[] = $v['forum_id'];
}
}
}
$this->ipsclass->DB->query($topics_query);
$topic_max_hits = $this->ipsclass->DB->get_num_rows();
while ($row = $this->ipsclass->DB->fetch_row() )
{
if( !$row['approved'] )
{
if( !$this->ipsclass->member['g_is_supmod'] )
{
if( !in_array( $row['forum_id'], $my_invisible_forums_t ) )
{
$topic_max_hits--;
continue;
}
}
}
$t_cnt++;
if ( $t_cnt > $this->resultlimit )
{
$more = 1;
break;
}
$topics .= $row['tid'].",";
}
$DB->free_result();
$this->ipsclass->DB->free_result();
//-----------------------------------------
$DB->query($posts_query);
$this->ipsclass->DB->query($posts_query);
$post_max_hits = $DB->get_num_rows();
while ($row = $DB->fetch_row() )
$post_max_hits = $this->ipsclass->DB->get_num_rows();
while ($row = $this->ipsclass->DB->fetch_row() )
{
if( $row['queued'] )
{
if( !$this->ipsclass->member['g_is_supmod'] )
{
if( !in_array( $row['forum_id'], $my_invisible_forums_p ) )
{
$post_max_hits--;
continue;
}
}
}
if( !$row['approved'] )
{
if( !$this->ipsclass->member['g_is_supmod'] )
{
if( !in_array( $row['forum_id'], $my_invisible_forums_t ) )
{
$post_max_hits--;
continue;
}
}
}
$p_cnt++;
if ( $p_cnt > $this->resultlimit )
{
$more = 1;
break;
}
$posts .= $row['pid'].",";
}
$DB->free_result();
$this->ipsclass->DB->free_result();
//-----------------------------------------
@@ -339,7 +454,7 @@ class search_lib extends Search
if ($topics == "" and $posts == "")
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'no_search_results' ) );
//$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'no_search_results' ) );
}
//-----------------------------------------
@@ -354,6 +469,7 @@ class search_lib extends Search
'topic_max' => $topic_max_hits,
'post_max' => $post_max_hits,
'keywords' => $keywords,
'query_cache' => $more,
);
}
+194
View File
@@ -0,0 +1,194 @@
<?php
$css_names = array(
'BODY' => "Тело web-страницы",
'TABLE, TR, TD' => "Таблица по умолчанию",
'a:link, a:visited, a:active' => "Ссылка по умолчанию",
'a:hover' => "Ссылка по умолчанию при наведении курсора",
'.googlebottom, .googlebottom a:link, .googlebottom a:visited, .googlebottom a:active' => "Результаты простого поиска: темный",
'.googlish, .googlish a:link, .googlish a:visited, .googlish a:active' => "Результаты простого поиска: ссылка на тему",
'.googlesmall, .googlesmall a:link, .googlesmall a:active, .googlesmall a:visited' => "Результаты простого поиска: маленький текст",
'option.sub' => "Форма поиска: меню выбора форумов: цвет подкатегории",
'.caldate' => "Календарь: дата",
'#ucpmenu' => "Личные данные пользователя: цвет меню",
'#ucpcontent' => "Личные данные пользователя: цвет шрифта",
'#logostrip' => "Верхняя часть форума: полоса с логотипом",
'#submenu' => "Верхняя часть форума: полоса с иконками",
'#submenu a:link, #submenu a:visited, #submenu a:active' => "Верхняя часть форума: полоска с иконками: цвет ссылок полосы с иконками",
'#userlinks' => "Верхняя часть форума: меню пользователя",
'.activeuserstrip' => 'Форумы и топики: активные пользователи',
'.pformstrip' => 'Глобально: подзаголовок',
'.pformleft' => 'Глобально: левая колонка',
'.pformleftw' => 'Глобально: ширина левой колонки',
'.pformright' => 'Глобально: правая колонка',
'.post1' => 'Просмотр сообщений: альтернативный цвет #1',
'.post2' => 'Просмотр сообщений: альтернативный цвет #2',
'.postlinksbar' => 'Просмотр сообщений: подписка на тему и другие ссылки',
'.row1' => 'Глобально: альтернативная строка #1',
'.row2' => 'Глобально: альтернативная строка #2',
'.row3' => 'Глобально: альтернативная строка #3',
'.row4' => 'Глобально: альтернативная строка #4',
'.darkrow1' => 'Глобально: альтернативная темная строка #1',
'.darkrow2' => 'Глобально: альтернативная темная строка #2',
'.darkrow3' => 'Глобально: альтернативная темная строка #3',
'.hlight' => 'Персональные сообщения: входящие &#151; выбранная строка',
'.dlight' => 'Персональные сообщения: входящие &#151; невыбранная строка',
'.titlemedium' => 'Глобально: подзаголовок (меньший)',
'.titlemedium a:link, .titlemedium a:visited, .titlemedium a:active' =>'Глобально: ссылки подзаголовка (меньшего)',
'.maintitle' => 'Глобально: заголовок главной таблицы',
'.maintitle a:link, .maintitle a:visited, .maintitle a:active' => 'Глобально: ссылки заголовка главной таблицы',
'.plainborder' => 'Глобально: альтернативная таблица #1',
'.tableborder' => 'Глобально: цвет фона между ячейками таблицы',
'.tablefill' => 'Глобально: альтернативная таблица #2',
'.tablepad' => 'Глобально: альтернативная таблица #3',
'.desc' => 'Просмотр форума: информация о последнем сообщении',
'.signature' => 'Просмотр сообщений: подпись',
'.normalname' => 'Просмотр сообщений: имя пользователя (зарегистрированное)',
'.unreg' => 'Просмотр сообщений: незарегистрированное имя',
'.searchlite' => 'Глобально: цвет подсветки ключевых слов поиска',
'#QUOTE' => 'Блок цитаты',
'#CODE' => 'Блок программного кода',
);
$skin_names = array(
'skin_boards' => array(
'skin_boards (Главная страница форума) ',
'Элементы главной страницы форума (отображает все форумы и подфорумы), такие, как ссылки на форумы, блок активных пользователей, статистика, именинники и последние события календаря.',
'act=idx'
),
'skin_buddy' => array(
'skin_buddy (Помощник)',
'Элементы окна &laquo;Помощник&raquo; включая ссылки и форму поиска.',
'act=buddy',
),
'skin_calendar'=> array(
'skin_calendar (Календарь)',
'Элементы календаря, включая просмотр самого календаря, дней календаря и конкретных событий.',
'act=calendar'
),
'skin_editors' => array(
'skin_editors (Редактор сообщений)',
'Элементы стандартного и rich text редакторов, используемых для создания сообщений.',
'',
),
'skin_emails' => array(
'skin_emails (Контакты пользователя)',
'Элементы различных форм контактов, такие как e-mail и жалоба пользователя на некорректное сообщение.',
'',
),
'skin_forum' => array(
'skin_forum (Просмотр конкретного форума)',
'Элементы отображения конкретного форума (список тем и опросов), включая свои правила выбранного форума и т.д.',
'act=SF&f=1',
),
'skin_global' => array(
'skin_global (Основные HTML фрагменты)',
'Различные глобальные элементы форума &#151; верхняя (логотип с ссылками) и нижняя часть всех страниц форума, промежуточная страница переадресации, страница описания ошибки форума и т.д.',
),
'skin_help' => array(
'skin_help (Помощь)',
'Элементы раздела &laquo;Помощь&raquo;.',
'act=help'
),
'skin_legends' => array(
'skin_legends (Легенды форума)',
'Элементы различных вспомогательных страниц типа страницы со всеми смайликами, описанием BB кодов форума и т.д.',
'act=legends'
),
'skin_login' => array(
'skin_login (Вход в форум)',
'Элементы авторизации пользователя для входа на форум.',
'act=Login'
),
'skin_mlist' => array(
'skin_mlist (Список пользователей)',
'Все элементы списка всех пользователей форума.',
'act=Members'
),
'skin_mod' => array(
'skin_mod (Функции модератора)',
'Элементы для работы модераторов, такие как удаление тему, редактирование тему и т.д.',
),
'skin_msg' => array(
'skin_msg (Личные сообщения)',
'Элементы личных сообщений, такие как входящие сообщения, написание новых личных сообщений, архивирование и т.д.',
'act=Msg',
),
'skin_online' => array (
'skin_online (Список активных пользователей)',
'Все элементы отображения раздела активных пользователей.',
'act=Online',
),
'skin_poll' => array (
'skin_poll (Просмотр опросов)',
'Элементы просмотра опросов, включая результаты опроса и т.д.',
),
'skin_post' => array(
'skin_post (Публикация сообщений)',
'Элементы публикации сообщений, открытие темы и т.д.',
),
'skin_printpage'=> array(
'skin_printpage (Версия темы для печати)',
'Все элементы версии темы для печати.',
),
'skin_profile' => array(
'skin_profile (Просмотр профиля)',
'Элементы просмотра профиля пользователей, данные, фотография и т.д.',
'showuser=1',
),
'skin_register' => array(
'skin_register (Регистрация)',
'Элементы страниц регистрации, активации учетной записи и т.д.',
'act=Reg',
),
'skin_search' => array(
'skin_search (Поиск)',
'Элементы формы поиска и результатыпоиска...',
'act=Search',
),
'skin_stats' => array(
'skin_stats (Статистика)',
'Элементы различных функций, таких как вывод администраторов и модераторов форума, активных тем и т.д.',
'act=Stats',
),
'skin_topic' => array(
'skin_topic (Просмотр темы)',
'Элементы просмотра темы, такие как просмотр сообщений, прикрепленные файлы, форма быстрого ответа и т.д.',
'showtopic=1'
),
'skin_modcp' => array(
'skin_modcp (Панель управления для модератора)',
'Элементы секций панели управления для модератора.',
'act=ModCP',
),
'skin_portal' => array(
'skin_portal (Портал)',
'Все элементы портала для IPB.',
),
'skin_ucp' => array(
'skin_ucp (Личные данные пользователя)',
'Элементы личных данных пользователя, такие как редактирование профиля, настроек форума, подпись, аватар и т.д.',
'act=UserCP',
),
'skin_subscriptions' => array(
'skin_subscriptions (Менеджер подписок)',
'Элементы менеджера подписок.',
)
);
$bit_names = array();
?>
+877 -878
View File
File diff suppressed because it is too large. Load diff
-451
View File
@@ -1,451 +0,0 @@
<?php
/*
+--------------------------------------------------------------------------
| Invision Power Board v2.0.0
| =============================================
| by Matthew Mecham
| (c) 2001 - 2004 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| Time: Tue, 21 Sep 2004 16:34:28 GMT
| Release: 150aa7a702c3c8b6f6eb90ad49305d2f
| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
|
| > Template Engine module
| > Module written by Matt Mecham
| > Date started: 5th January 2004
|
| > Module Version Number: 1.0.0
+--------------------------------------------------------------------------
| New template module to build, rebuild and generate caches of templates
| which include the new IPB HTML Logic system.
| Example:
| <ipb-htmllogic>
| <if="ibf.vars['threaded_per_page'] == 10">
| html here
| </if>
| <else if="ibf.vars['threaded_per_page'] >= 100 or some_var == 'this'">
| html here
| </if>
| <else if="show['this'] > 100">
| html here
| </if>
| <else>
| html here
| </else>
| </ipb-htmllogic>
+--------------------------------------------------------------------------
*/
class ipb_template_engine
{
var $root_path = './';
var $cache_dir = 'skin_cache';
var $cache_id = '1';
var $database_id = '1';
var $cache_path = '';
function class_template()
{
$this->cache_path = $this->root_path . $this->cache_dir . '/cacheid_' . $this->cache_id;
}
//===================================================
// Convert HTML to PHP cache file
//===================================================
function convert_html_to_php($func_name, $func_data, $func_html)
{
//-----------------------------------------
// Make sure we have ="" on each
// func data
//-----------------------------------------
$func_data = preg_replace( "#".'\$'."(\w+)(,|$)#i", "\$\\1=\"\"\\2", str_replace( " ", "", $func_data ) );
$top = "//===========================================================================\n".
"// {$func_name}\n".
"//===========================================================================\n";
$start = "function {$func_name}($func_data) {\nglobal \$ibforums;\n\$IPBHTML = \"\";\n//--starthtml--//\n";
$middle = $this->build_section_html_to_php($func_html);
$end = "\n//--endhtml--//\nreturn \$IPBHTML;\n}\n";
return $top.$start.$middle.$end;
}
//===================================================
// Alias: Convert PHP to HTML
//===================================================
function convert_php_to_html($php)
{
return $this->_convert_php_to_html($php);
}
//===================================================
// Build Section: PHP to HTML
// - Updates HTML database with PHP cache file
//===================================================
function build_section_php_to_html($php="")
{
}
//===================================================
// Build Section: HTML to PHP
// - Makes PHP cache of raw HTML
//===================================================
function build_section_html_to_php($html="")
{
//-----------------------------------------
// Does it have logic sections?
//-----------------------------------------
if ( preg_match( "#<ipb-htmllogic>#si", $html ) )
{
//-----------------------------------------
// Convert between logic sections
//-----------------------------------------
$html = preg_replace( "#(</ipb-htmllogic>)(.+?)(<ipb-htmllogic>)#ise", "\$this->_wrap_in_php('\\2', '\\3', '\\1');", $html );
//-----------------------------------------
// Convert before logic sections
//-----------------------------------------
$html = preg_replace( "#^(.+?)(<ipb-htmllogic>)#ise", "\$this->_wrap_in_php('\\1', '\\2');", $html );
//-----------------------------------------
// Convert after logic sections
//-----------------------------------------
if ( preg_match( "#^(.*)</ipb-htmllogic>(.+?)$#is", $html, $match ) )
{
if ( $match[1] and $match[2] )
{
$html = preg_replace( "#^(.*</ipb-htmllogic>)(.+?)$#ise", "\$this->_wrap_in_php('\\2', '', '\\1');", $html );
}
}
//-----------------------------------------
// Find and convert ipb-htmllogic bits
//-----------------------------------------
while ( preg_match( "#<ipb-htmllogic>(.+?)</ipb-htmllogic>#si", $html, $match ) )
{
$html = preg_replace( "#<ipb-htmllogic>(.+?)</ipb-htmllogic>#sie", "'//start-htmllogic' . \$this->_convert_html_to_php('\\1') . '//end-htmllogic';", $html );
}
}
else
{
$html = $this->_wrap_in_php( $html );
}
//-----------------------------------------
// Remove extra spaces
//-----------------------------------------
$html = preg_replace( "#(//endelse|//endif)\s+?(//end-htmllogic)#is", "\\1\n\\2", $html );
//-----------------------------------------
// Unconvert special tags
//-----------------------------------------
$html = $this->unconvert_tags($html);
return $html;
}
//===================================================
// Convert special tags into HTML safe versions
//===================================================
function convert_tags($t="")
{
$t = preg_replace( "/{?\\\$ibforums->base_url}?/" , "{ipb.script_url}" , $t );
$t = preg_replace( "/{?\\\$ibforums->session_id}?/" , "{ipb.session_id}" , $t );
$t = preg_replace( "#\\\$ibforums->(member|vars|skin|lang)#i" , "ipb.\\1" , $t );
//-----------------------------------------
// Make some tags safe..
//-----------------------------------------
$t = preg_replace( "/\{ipb\.vars\[(['\"])?(sql_driver|sql_host|sql_database|sql_pass|sql_user|sql_port|sql_tbl_prefix|smtp_host|smtp_port|smtp_user|smtp_pass|html_dir|base_dir|upload_dir)(['\"])?\]\}/", "" , $t );
return $t;
}
//===================================================
// Uncovert them back again
//===================================================
function unconvert_tags($t="")
{
//-----------------------------------------
// Make some tags safe..
//-----------------------------------------
$t = preg_replace( "/\{ipb\.vars\[(['\"])?(sql_driver|sql_host|sql_database|sql_pass|sql_user|sql_port|sql_tbl_prefix|smtp_host|smtp_port|smtp_user|smtp_pass|html_dir|base_dir|upload_dir)(['\"])?\]\}/", "" , $t );
$t = preg_replace( "/{ipb\.script_url}/i" , '{$ibforums->base_url}' , $t);
$t = preg_replace( "/{ipb\.session_id}/i" , '{$ibforums->session_id}', $t);
$t = preg_replace( "#ipb\.(member|vars|skin|lang)#i", '$ibforums->\\1' , $t );
return $t;
}
//===================================================
// Wrap HTML into PHP
//===================================================
function _wrap_in_php( $html, $after="", $before="" )
{
$html = $this->_trim_newlines($this->_trim_slashes($html));
$before = $this->_trim_slashes($before);
$after = $this->_trim_slashes($after);
if ( strlen($html) < 1 )
{
return $before.$html.$after;
}
return $before."\n\$IPBHTML .= <<<EOF\n$html\nEOF;\n".$after;
}
//===================================================
// Convert: HTML Logic to PHP logic
//===================================================
function _convert_html_to_php($html)
{
$html = $this->_trim_slashes($html);
$html = preg_replace( "#\s+?<if=[\"'](.+?)[\"']>(.+?)</if>#ise", "\$this->_statement_if('\\1', '\\2')", $html );
$html = preg_replace( "#\s+?<else if=[\"'](.+?)[\"']>(.+?)</if>#ise", '$this->_statement_elseif("\\1", "\\2")', $html );
$html = preg_replace( "#\s+?<else>(.+?)</else>#ise", '$this->_statement_else("\\1")', $html );
return $html;
}
//===================================================
// Convert: PHP logic to HTML logic
//===================================================
function _convert_php_to_html($php)
{
$php = preg_replace( "#else if\s+?\((.+?)\)\s+?{(.+?)}//endif\n?#ise", "\$this->_reverse_if('\\1', '\\2', 'else if')", $php );
$php = preg_replace( "#if\s+?\((.+?)\)\s+?{(.+?)}//endif\n?#ise", "\$this->_reverse_if('\\1', '\\2', 'if')", $php );
$php = preg_replace( "#else\s+?{(.+?)}//endelse\n?#ise", "\$this->_reverse_else( '\\1' )", $php );
//-----------------------------------------
// Parse raw sections
//-----------------------------------------
$php = $this->_reverse_ipbhtml($php);
//-----------------------------------------
// Convert ipb-htmllogic tags
//-----------------------------------------
$php = preg_replace( "#//start-htmllogic#i" , "<ipb-htmllogic>", $php );
$php = preg_replace( "#//end-htmllogic#i", "</ipb-htmllogic>" , $php );
//-----------------------------------------
// Remove extra spaces
//-----------------------------------------
$php = preg_replace( "#(</if>|</else>)\s+?(<if|<else|</ipb-htmllogic>)#is", "\\1\n\\2", $php );
//-----------------------------------------
// Make safe special $Ibforums vars
//-----------------------------------------
$php = $this->convert_tags($php);
return $php;
}
//===================================================
// Reverse: PHP IF to HTML IF
//===================================================
function _reverse_if( $code, $php, $start='if' )
{
$code = $this->_trim_slashes(trim($code));
$code = preg_replace( "/(^|and|or)(\s+)(.+?)(\s|$)/ise", "\$this->_reverse_prep_left('\\3', '\\1', '\\2', '\\4')", ' '.$code );
$php = $this->_reverse_ipbhtml($php);
return "<".$start."=\"".trim($code)."\">\n".$php."\n</if>\n";
}
//===================================================
// Reverse: PHP else to HTML else
//===================================================
function _reverse_else( $php )
{
$php = $this->_trim_slashes(trim($php));
$php = $this->_reverse_ipbhtml($php);
return "<else>\n".$php."\n</else>\n";
}
//===================================================
// Reverse: $IPBHTML to normal $HTML
//===================================================
function _reverse_ipbhtml( $code )
{
$code = $this->_trim_slashes($code);
$code = preg_replace("/".'\$'."IPBHTML\s+?\.?=\s+?<<<EOF(.+?)EOF;\s?/si", "\\1", $code );
$code = trim($code);
$code = $this->_trim_newlines($code);
return $code;
}
//===================================================
// Reverse PHP IF code to HTML code
//===================================================
function _reverse_prep_left($left, $andor="", $fs="", $ls="")
{
$left = trim($this->_trim_slashes($left));
if ( preg_match( "/".'\$'."ibforums->/", $left ) )
{
$left = preg_replace( "/".'\$'."ibforums->(.+?)$/", 'ipb.'."\\1", $left );
}
else
{
$left = str_replace( '$', '', $left );
}
return $andor.$fs.$left.$ls;
}
//===================================================
// Statement: Return PHP 'IF' statement
//===================================================
function _statement_if( $code, $html )
{
$html = $this->_func_prep_html($html);
$code = $this->_func_prep_if($code);
return "\nif ( $code )\n{\n\$IPBHTML .= <<<EOF\n$html\nEOF;\n}//endif\n";
}
//===================================================
// Statement: Return PHP 'ELSE IF' statement
//===================================================
function _statement_elseif( $code, $html )
{
$html = $this->_func_prep_html($html);
$code = $this->_func_prep_if($code);
return "\nelse if ( $code )\n{\n\$IPBHTML .= <<<EOF\n$html\nEOF;\n}//endif\n";
}
//===================================================
// Statement: Return PHP 'ELSE' statement
//===================================================
function _statement_else( $html )
{
$html = $this->_func_prep_html($html);
return "\nelse\n{\n\$IPBHTML .= <<<EOF\n$html\nEOF;\n}//endelse\n";
}
//===================================================
// Strip leading newlines, etc
//===================================================
function _func_prep_html($html)
{
$html = trim($this->_trim_slashes($html));
//$html = preg_replace( '/"/', '\\"', $html );
return $html;
}
//===================================================
// Sort out left bit of comparison
//===================================================
function _func_prep_left($left, $andor="", $fs="", $ls="")
{
$left = trim($this->_trim_slashes($left));
if ( preg_match( "/^ipb\./", $left ) )
{
$left = preg_replace( "/^ipb\.(.+?)$/", '$ibforums->'."\\1", $left );
}
else
{
$left = '$'.$left;
}
return $andor.$fs.$left.$ls;
}
//===================================================
// Statement: Prep AND OR, etc
//===================================================
function _func_prep_if( $code )
{
$code = preg_replace( "/(^|and|or)(\s+)(.+?)(\s|$)/ise", "\$this->_func_prep_left('\\3', '\\1', '\\2', '\\4')", ' '.$code );
return trim($code);
}
//===================================================
// Remove leading and trailing newlines
//===================================================
function _trim_newlines($code)
{
$code = preg_replace("/^\n{1,}/s", "", $code );
$code = preg_replace("/\n{1,}$/s", "", $code );
return $code;
}
//===================================================
// Remove preg_replace/e slashes
//===================================================
function _trim_slashes($code)
{
$code = str_replace( '\"' , '"', $code );
$code = str_replace( "\\'", "'", $code );
return $code;
}
}
?>
File diff suppressed because it is too large. Load diff