Version 2.0.0

This commit is contained in:
Neo committed 2025-12-19 00:19:56 -08:00
1 parent 5699abfc0e
commit 0eecc172d9
696 files changed
+120723 -77160

No files matched your search

+223 -48
View File
@@ -2,16 +2,15 @@
/*
+--------------------------------------------------------------------------
| Invision Power Board v1.3.1 Final
| ========================================
| Invision Power Board v2.0.0
| =============================================
| by Matthew Mecham
| (c) 2001 - 2003 Invision Power Services
| (c) 2001 - 2004 Invision Power Services, Inc.
| http://www.invisionpower.com
| ========================================
| =============================================
| Web: http://www.invisionboard.com
| Time: Thu, 23 Sep 2004 23:05:01 GMT
| Release: 3cb325c445e1909182084806ae7f8226
| Email: matt@invisionpower.com
| Time: Tue, 21 Sep 2004 16:34:28 GMT
| Release: 150aa7a702c3c8b6f6eb90ad49305d2f
| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
|
@@ -20,69 +19,245 @@
| > Date started: 10th March 2002
|
| > Module Version Number: 1.0.0
| > DBA Checked: Mon 24th May 2004
+--------------------------------------------------------------------------
*/
$idx = new attach;
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 attach {
function attach()
/*-------------------------------------------------------------------------*/
//
// AUTO RUN
//
/*-------------------------------------------------------------------------*/
function auto_run()
{
global $ibforums, $DB, $std, $print, $skin_universal;
global $ibforums, $DB, $std, $print, $forums;
$ibforums->input['id'] = preg_replace( "/^(\d+)$/", "\\1", $ibforums->input['id'] );
$ibforums->input['id'] = intval($ibforums->input['id']);
$ibforums->input['tid'] = intval($ibforums->input['tid']);
if ($ibforums->input['id'] == "")
//-----------------------------------------
// Got attachment types?
//-----------------------------------------
$ibforums->cache['attachtypes'] = array();
$DB->simple_construct( array( 'select' => 'atype_extension,atype_mimetype,atype_post,atype_photo,atype_img', 'from' => 'attachments_type', 'where' => "atype_photo=1 OR atype_post=1" ) );
$DB->simple_exec();
while ( $r = $DB->fetch_row() )
{
$ibforums->cache['attachtypes'][ $r['atype_extension'] ] = $r;
}
//-----------------------------------------
// What to do..
//-----------------------------------------
switch( $ibforums->input['code'] )
{
case 'showtopic':
$this->show_topic_attachments();
break;
default:
$this->show_post_attachment();
break;
}
}
/*-------------------------------------------------------------------------*/
//
// SHOW TOPIC ATTACHMENTS ( MULTIPLE )
//
/*-------------------------------------------------------------------------*/
function show_topic_attachments()
{
global $DB, $ibforums, $std, $forums, $print;
if ( ! $ibforums->input['tid'] )
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'missing_files' ) );
}
if ($ibforums->input['type'] == 'post')
//-----------------------------------------
// get topic..
//-----------------------------------------
$topic = $DB->simple_exec_query( array( 'select' => '*', 'from' => 'topics', 'where' => 'tid='.$ibforums->input['tid'] ) );
if ( ! $topic['topic_hasattach'] )
{
// Handle post attachments.
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'missing_files' ) );
}
//-----------------------------------------
// Check forum..
//-----------------------------------------
if ( ! $forums->forum_by_id[ $topic['forum_id'] ] )
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'no_permission' ) );
}
//-----------------------------------------
// Get forum skin and lang
//-----------------------------------------
$ibforums->lang = $std->load_words($ibforums->lang, 'lang_forum', $ibforums->lang_id);
$ibforums->lang = $std->load_words($ibforums->lang, 'lang_topic', $ibforums->lang_id);
$this->html = $std->load_template('skin_forum');
//-----------------------------------------
// aight.....
//-----------------------------------------
$this->output .= $this->html->forums_attachments_top($topic['title']);
$DB->cache_add_query( 'forum_get_attachments', array( 'tid' => $ibforums->input['tid'] ) );
$DB->cache_exec_query();
while ( $row = $DB->fetch_row() )
{
if ( $std->check_perms($forums->forum_by_id[ $row['forum_id'] ]['read_perms']) != TRUE )
{
continue;
}
$row['image'] = $ibforums->cache['attachtypes'][ $row['attach_ext'] ]['atype_img'];
$row['short_name'] = $std->txt_truncate( $row['attach_file'], 30 );
$row['attach_date'] = $std->get_date( $row['attach_date'], 'SHORT' );
$row['real_size'] = $std->size_format( $row['attach_filesize'] );
$this->output .= $this->html->forums_attachments_row( $row );
}
$this->output .= $this->html->forums_attachments_bottom();
$print->pop_up_window($ibforums->lang['attach_title'], $this->output);
}
/*-------------------------------------------------------------------------*/
//
// SHOW POST ATTACHMENT ( SINGLE )
//
/*-------------------------------------------------------------------------*/
function show_post_attachment()
{
global $DB, $ibforums, $std, $forums, $print;
if ( ! $ibforums->input['id'] )
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'missing_files' ) );
}
//-----------------------------------------
// get attachment
//-----------------------------------------
$DB->simple_construct( array( 'select' => '*', 'from' => 'attachments', 'where' => "attach_id=".$ibforums->input['id'] ) );
$DB->simple_exec();
if ( ! $attach = $DB->fetch_row() )
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'missing_files' ) );
}
//-----------------------------------------
// Handle post attachments.
//-----------------------------------------
if ( $ibforums->input['type'] == 'post' )
{
//-----------------------------------------
// Get post thingy majiggy to check perms
//-----------------------------------------
$DB->query("SELECT pid, attach_id, attach_type, attach_file FROM ibf_posts WHERE pid='".$ibforums->input['id']."'");
$DB->cache_add_query( 'attach_get_perms', array( 'apid' => $attach['attach_pid'] ) );
$DB->cache_exec_query();
if ( !$DB->get_num_rows() )
if ( ! $post = $DB->fetch_row() )
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'missing_files' ) );
}
}
$post = $DB->fetch_row();
if ( $post['attach_id'] == "" )
if ( ! $forums->forum_by_id[ $post['forum_id'] ] )
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'missing_files' ) );
}
$file = $ibforums->vars['upload_dir']."/".$post['attach_id'];
if ( file_exists( $file ) and ( $post['attach_type'] != "" ) )
{
// Update the "hits"..
$DB->query("UPDATE ibf_posts SET attach_hits=attach_hits+1 WHERE pid='".$post['pid']."'");
// Set up the headers..
@header( "Content-Type: ".$post['attach_type']."\nContent-Disposition: inline; filename=\"".$post['attach_file']."\"\nContent-Length: ".(string)(filesize( $file ) ) );
// Open and display the file..
$fh = fopen( $file, 'rb' ); // Set binary for Win even if it's an ascii file, it won't hurt.
fpassthru( $fh );
@fclose( $fh );
exit();
}
else
{
// File does not exist..
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'missing_files' ) );
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'no_permission' ) );
}
}
else if ( $ibforums->input['type'] == 'msg' and $attach['attach_msg'] )
{
$DB->simple_construct( array( 'select' => 'mt_id, mt_owner_id', 'from' => 'message_topics', 'where' => 'mt_owner_id='.$ibforums->member['id'].' AND mt_msg_id='.$attach['attach_msg'] ) );
$DB->simple_exec();
if ( ! $post = $DB->fetch_row() )
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'missing_files' ) );
}
}
else
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'missing_files' ) );
}
//-----------------------------------------
// Show attachment
//-----------------------------------------
$file = $ibforums->vars['upload_dir']."/".$attach['attach_location'];
if ( file_exists( $file ) and ( $ibforums->cache['attachtypes'][ $attach['attach_ext'] ]['atype_mimetype'] != "" ) )
{
//-----------------------------------------
// Update the "hits"..
//-----------------------------------------
$DB->simple_construct( array( 'update' => 'attachments', 'set' =>"attach_hits=attach_hits+1", 'where' => "attach_id=".$ibforums->input['id'] ) );
$DB->simple_exec();
//-----------------------------------------
// Set up the headers..
//-----------------------------------------
//flush();
@header( "Content-Type: ".$ibforums->cache['attachtypes'][ $attach['attach_ext'] ]['atype_mimetype'].
"\nContent-Disposition: inline; filename=\"".$attach['attach_file']
."\"\nContent-Length: ".(string)(filesize( $file ) ) );
//-----------------------------------------
// Open and display the file..
//-----------------------------------------
$fh = fopen( $file, 'rb' ); // Set binary for Win even if it's an ascii file, it won't hurt.
fpassthru( $fh );
@fclose( $fh );
exit();
}
else
{
//-----------------------------------------
// File does not exist..
//-----------------------------------------
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'missing_files' ) );
}
}
File diff suppressed because it is too large. Load diff
+53 -68
View File
@@ -2,16 +2,15 @@
/*
+--------------------------------------------------------------------------
| Invision Power Board v1.3.1 Final
| ========================================
| Invision Power Board v2.0.0
| =============================================
| by Matthew Mecham
| (c) 2001 - 2003 Invision Power Services
| (c) 2001 - 2004 Invision Power Services, Inc.
| http://www.invisionpower.com
| ========================================
| =============================================
| Web: http://www.invisionboard.com
| Time: Thu, 23 Sep 2004 23:05:01 GMT
| Release: 3cb325c445e1909182084806ae7f8226
| Email: matt@invisionpower.com
| Time: Tue, 21 Sep 2004 16:34:28 GMT
| Release: 150aa7a702c3c8b6f6eb90ad49305d2f
| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
|
@@ -20,13 +19,18 @@
| > Date started: 21st March 2002
|
| > Module Version Number: 1.0.0
| > DBA Checked: Mon 24th May 2004
+--------------------------------------------------------------------------
*/
$idx = new Forward;
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 Forward {
class forwardpage {
var $output = "";
var $base_url = "";
@@ -37,69 +41,59 @@ class Forward {
var $category = array();
/***********************************************************************************/
/*-------------------------------------------------------------------------*/
//
// Our constructor, load words, load skin, print the topic listing
//
/***********************************************************************************/
/*-------------------------------------------------------------------------*/
function Forward() {
global $ibforums, $DB, $std, $print, $skin_universal;
function forwardpage()
{
global $ibforums, $DB, $std, $print, $forums;
//-------------------------------------
//-----------------------------------------
// Compile the language file
//-------------------------------------
//-----------------------------------------
$ibforums->lang = $std->load_words($ibforums->lang, 'lang_emails', $ibforums->lang_id);
$this->html = $std->load_template('skin_emails');
//-------------------------------------
//-----------------------------------------
// Check the input
//-------------------------------------
//-----------------------------------------
$ibforums->input['t'] = $std->is_number($ibforums->input['t']);
$ibforums->input['f'] = $std->is_number($ibforums->input['f']);
$ibforums->input['t'] = intval($ibforums->input['t']);
$ibforums->input['f'] = intval($ibforums->input['f']);
if ($ibforums->input['t'] < 0 or $ibforums->input['f'] < 0)
if ( !$ibforums->input['t'] )
{
$std->Error( array( LEVEL => 1, MSG => 'missing_files') );
}
//-------------------------------------
// Get the forum info based on the forum ID, get the category name, ID, and get the topic details
//-------------------------------------
//-----------------------------------------
// Get the topic details
//-----------------------------------------
$DB->query("SELECT t.*, f.name as forum_name, f.id as forum_id, f.read_perms, f.reply_perms, f.start_perms, f.allow_poll, f.posts as forum_posts, f.topics as forum_topics, c.name as cat_name, c.id as cat_id FROM ibf_topics t, ibf_forums f , ibf_categories c where t.tid='".$ibforums->input[t]."' and f.id = t.forum_id and f.category=c.id");
$DB->simple_construct( array( 'select' => '*', 'from' => 'topics', 'where' => "tid=".intval($ibforums->input['t']) ) );
$DB->simple_exec();
$this->topic = $DB->fetch_row();
$this->forum = array( 'id' => $this->topic['forum_id'] ,
'name' => $this->topic['forum_name'] ,
'posts' => $this->topic['forum_posts'] ,
'topics' => $this->topic['forum_topics'] ,
'read_perms' => $this->topic['read_perms'] ,
'allow_poll' => $this->topic['allow_poll'] ,
);
$this->category = array( 'name' => $this->topic['cat_name'],
'id' => $this->topic['cat_id'] ,
);
$this->forum = $forums->forum_by_id[ $this->topic['forum_id'] ];
//-------------------------------------
//-----------------------------------------
// Error out if we can not find the forum
//-------------------------------------
//-----------------------------------------
if (!$this->forum['id'])
if ( ! $this->forum['id'] )
{
$std->Error( array( LEVEL => 1, MSG => 'missing_files') );
}
//-------------------------------------
//-----------------------------------------
// Error out if we can not find the topic
//-------------------------------------
//-----------------------------------------
if (!$this->topic['tid'])
{
@@ -110,24 +104,21 @@ class Forward {
$this->base_url_NS = "{$ibforums->vars['board_url']}/index.{$ibforums->vars['php_ext']}";
//-------------------------------------
//-----------------------------------------
// Check viewing permissions, private forums,
// password forums, etc
//-------------------------------------
//-----------------------------------------
if (! $ibforums->member['id'] )
{
$std->Error( array( LEVEL => 1, MSG => 'no_guests') );
}
$bad_entry = $this->check_access();
if ($bad_entry == 1)
{
$std->Error( array( LEVEL => 1, MSG => 'no_view_topic') );
}
$forums->forums_check_access( $this->forum['id'] );
//-----------------------------------------
// What to do?
//-----------------------------------------
if ($ibforums->input['CODE'] == '01')
{
@@ -137,15 +128,14 @@ class Forward {
{
$this->show_form();
}
}
function send_email() {
function send_email()
{
global $std, $ibforums, $DB, $print;
require "./sources/lib/emailer.php";
require ROOT_PATH."sources/classes/class_email.php";
$this->email = new emailer();
@@ -182,11 +172,10 @@ class Forward {
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'invalid_email' ) );
}
$this->email->get_template("forward_page", $lang_to_use);
$this->email->build_message( array(
'THE_MESSAGE' => str_replace( "<br>", "\n", $ibforums->input['message'] ),
'THE_MESSAGE' => str_replace( "<br />", "\n", $ibforums->input['message'] ),
'TO_NAME' => $ibforums->input['to_name'],
'FROM_NAME' => $ibforums->member['name'],
)
@@ -197,7 +186,7 @@ class Forward {
$this->email->from = $ibforums->member['email'];
$this->email->send_mail();
$print->redirect_screen( $ibforums->lang['redirect'], "act=ST&f=".$this->forum['id']."&t=".$this->topic['tid']."&st=".$ibforums->input['st'] );
$print->redirect_screen( $ibforums->lang['redirect'], "showtopic=".$this->topic['tid']."&st=".$ibforums->input['st'] );
}
@@ -205,12 +194,13 @@ class Forward {
function show_form() {
function show_form()
{
global $std, $ibforums, $DB, $print;
require ROOT_PATH."lang/".$ibforums->lang_id."/email_content.php";
require ROOT_PATH."lang/".$ibforums->lang_id."/lang_email_content.php";
$ibforums->lang['send_text'] = $EMAIL['send_text'];
$ibforums->lang['send_text'] = $lang['send_text'];
$lang_array = unserialize(stripslashes($ibforums->vars['languages']));
@@ -229,7 +219,7 @@ class Forward {
$ibforums->lang['send_text'] = preg_replace( "/<#THE LINK#>/" , $this->base_url_NS."?act=ST&f=".$this->forum['id']."&t=".$this->topic['tid'], $ibforums->lang['send_text'] );
$ibforums->lang['send_text'] = preg_replace( "/<#USER NAME#>/", $ibforums->member['name'], $ibforums->lang['send_text'] );
$this->output = $this->html->forward_form( $this->topic['title'], $ibforums->lang ['send_text'], $lang_select );
$this->output = $this->html->forward_form( $this->topic['title'], $ibforums->lang['send_text'], $lang_select );
$this->page_title = $ibforums->lang['title'];
@@ -246,7 +236,7 @@ class Forward {
//+----------------------------------------------------------------------------------
//-----------------------------------------
function check_access()
@@ -274,9 +264,4 @@ class Forward {
}
}
?>
?>
-367
View File
@@ -1,367 +0,0 @@
<?php
/*
+--------------------------------------------------------------------------
| Invision Power Board v1.3.1 Final
| ========================================
| by Matthew Mecham
| (c) 2001 - 2003 Invision Power Services
| http://www.invisionpower.com
| ========================================
| Web: http://www.invisionboard.com
| Time: Thu, 23 Sep 2004 23:05:01 GMT
| Release: 3cb325c445e1909182084806ae7f8226
| Email: matt@invisionpower.com
| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
|
| > Log in / log out module
| > Module written by Matt Mecham
| > Date started: 12th December 2001
|
| > Module Version Number: 1.0.0
+--------------------------------------------------------------------------
*/
$idx = new Login;
class Login {
var $output = "";
var $page_title = "";
var $nav = array();
var $login_html = "";
function Login() {
global $ibforums, $DB, $std, $print;
// Make sure our code number is numerical only
//$ibforums->input[CODE] = preg_replace("/^([0-9]+)$/", "$1", $ibforums->input[CODE]);
// Require the HTML and language modules
$ibforums->lang = $std->load_words($ibforums->lang, 'lang_login', $ibforums->lang_id);
$this->login_html = $std->load_template('skin_login');
// What to do?
switch($ibforums->input[CODE]) {
case '01':
$this->do_log_in();
break;
case '02':
$this->log_in_form();
break;
case '03':
$this->do_log_out();
break;
default:
$this->log_in_form();
break;
}
// If we have any HTML to print, do so...
$print->add_output("$this->output");
$print->do_output( array( 'TITLE' => $this->page_title, 'JS' => 0, NAV => $this->nav ) );
}
function log_in_form($message="") {
global $ibforums, $DB, $std, $print, $HTTP_REFERER;
//+--------------------------------------------
//| Are they banned?
//+--------------------------------------------
if ($message != "")
{
$this->output .= $this->login_html->errors( $ibforums->lang[ $message ] );
}
$html = <<<EOF
<script language='JavaScript'>
<!--
function ValidateForm() {
var Check = 0;
if (document.LOGIN.UserName.value == '') { Check = 1; }
if (document.LOGIN.PassWord.value == '') { Check = 1; }
if (Check == 1) {
alert("{$ibforums->lang[blank_fields]}");
return false;
} else {
document.LOGIN.submit.disabled = true;
return true;
}
}
//-->
</script>
<br>
<table cellpadding='3' cellspacing='1' border='0' align='center' width='{$ibforums->skin['tbl_width']}'>
<tr>
<td align='left'>{$ibforums->lang['login_text']}</td>
</tr>
<tr>
<td align='left'><b>{$ibforums->lang[forgot_pass]} <a href='{$ibforums->vars['board_url']}/index.{$ibforums->vars['php_ext']}?act=Reg&CODE=10'>{$ibforums->lang[pass_link]}</a></b></td>
</tr>
</table>
<form action="{$ibforums->vars['board_url']}/index.{$ibforums->vars['php_ext']}" method="post" name='LOGIN' onSubmit='return ValidateForm()'>
<input type='hidden' name='act' value='ib3'>
<input type='hidden' name='CODE' value='01'>
<input type='hidden' name='s' value='{$ibforums->session_id}'>
<input type='hidden' name='referer' value="">
<table cellpadding='0' cellspacing='0' border='0' width='{$ibforums->skin['tbl_width']}' bgcolor='{$ibforums->skin['tbl_border']}' align='center'>
<tr>
<td>
<table cellpadding='3' cellspacing='1' border='0' width='100%'>
<tr>
<td align='left' colspan='2' id='titlemedium'>Please enter your old Ikonboard 3 Username and Password</td>
</tr>
<tr>
<td id='row1' width='40%'>Your Ikonboard 3 Username</td>
<td id='row1'><input type='text' size='20' maxlength='64' name='UserName' class='forminput'></td>
</tr>
<tr>
<td id='row1' width='40%'>Your Ikonboard 3 Password</td>
<td id='row1'><input type='password' size='20' name='PassWord' class='forminput'></td>
</tr>
</table>
</td>
</tr>
</table>
<br>
<table cellpadding='0' cellspacing='0' border='0' width='{$ibforums->skin['tbl_width']}' bgcolor='{$ibforums->skin['tbl_border']}' align='center'>
<tr>
<td>
<table cellpadding='3' cellspacing='1' border='0' width='100%'>
<tr>
<td align='left' colspan='2' id='titlemedium'>{$ibforums->lang[options]}</td>
</tr>
<tr>
<td id='row1' width='40%' align='left' valign='top'>{$ibforums->lang[cookies]}</td>
<td id='row1' width='40%'><input type="radio" name="CookieDate" value="1" checked>{$ibforums->lang[cookie_yes]}<br><input type="radio" name="CookieDate" value="0">{$ibforums->lang[cookie_no]}</td>
</tr>
<tr>
<td id='row1' width='40%' align='left' valign='top'>{$ibforums->lang[privacy]}</td>
<td id='row1' width='40%'><input type="checkbox" name="Privacy" value="1">{$ibforums->lang[anon_name]}</td>
</tr>
<tr>
<td id='row2' align='center' colspan='2'>
<input type="submit" name='submit' value="{$ibforums->lang[log_in_submit]}" class='forminput'>
</td></tr></table>
</td></tr></table>
</form>
EOF;
$this->output .= $html;
$this->nav = array( "Upgrade my old Ikonboard Account" );
$this->page_title = "Upgrade my old Ikonboard Account";
$print->add_output("$this->output");
$print->do_output( array( 'TITLE' => $this->page_title, 'JS' => 0, NAV => $this->nav ) );
exit();
}
function do_log_in() {
global $DB, $ibforums, $std, $print, $sess, $HTTP_USER_AGENT, $HTTP_POST_VARS;
$url = "";
//-------------------------------------------------
// Make sure the username and password were entered
//-------------------------------------------------
if ($HTTP_POST_VARS['UserName'] == "")
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'no_username' ) );
}
if ($HTTP_POST_VARS['PassWord'] == "")
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'pass_blank' ) );
}
//-------------------------------------------------
// Check for input length
//-------------------------------------------------
if (strlen($ibforums->input['UserName']) > 32)
{
$std->Error( array( LEVEL => 1, MSG => 'username_long' ) );
}
if (strlen($ibforums->input['PassWord']) > 32)
{
$std->Error( array( LEVEL => 1, MSG => 'pass_too_long' ) );
}
$username = strtolower($ibforums->input['UserName']);
$password = crypt( $ibforums->input['PassWord'], substr( strtolower($ibforums->input['UserName']), 0, 2) );
//-------------------------------------------------
// Attempt to get the user details
//-------------------------------------------------
$DB->query("SELECT id, name, mgroup, password, new_pass FROM ibf_members WHERE LOWER(name)='$username'");
if ($DB->get_num_rows())
{
$member = $DB->fetch_row();
if ( empty($member['id']) or ($member['id'] == "") )
{
$this->log_in_form( 'wrong_name' );
}
if ($member['password'] != $password)
{
$this->log_in_form( 'wrong_pass' );
}
// SET REAL PASSY
$real_pass = md5($ibforums->input['PassWord']);
//------------------------------
if ($ibforums->input['s'])
{
$session_id = $ibforums->input['s'];
// Delete any old sessions with this users IP addy that doesn't match our
// session ID.
$DB->query("DELETE FROM ibf_sessions WHERE ip_address='".$ibforums->input['IP_ADDRESS']."' AND id <> '$session_id'");
$db_string = $DB->compile_db_update_string( array (
'member_name' => $member['name'],
'member_id' => $member['id'],
'running_time' => time(),
'member_group' => $member['mgroup'],
'login_type' => $ibforums->input['Privacy'] ? 1 : 0
) );
$db_query = "UPDATE ibf_sessions SET $db_string WHERE id='".$ibforums->input['s']."'";
}
else
{
$session_id = md5( uniqid(microtime()) );
// Delete any old sessions with this users IP addy.
$DB->query("DELETE FROM ibf_sessions WHERE ip_address='".$ibforums->input['IP_ADDRESS']."'");
$db_string = $DB->compile_db_insert_string( array (
'id' => $session_id,
'member_name' => $member['name'],
'member_id' => $member['id'],
'running_time' => time(),
'member_group' => $member['mgroup'],
'ip_address' => substr($ibforums->input['IP_ADDRESS'], 0, 50),
'browser' => substr($HTTP_USER_AGENT, 0, 50),
'login_type' => $ibforums->input['Privacy'] ? 1 : 0
) );
$db_query = "INSERT INTO ibf_sessions (" .$db_string['FIELD_NAMES']. ") VALUES (". $db_string['FIELD_VALUES'] .")";
}
$DB->query( $db_query );
//-----------------------------------
// RESET PASS IN MD5
//-----------------------------------
$DB->query("UPDATE ibf_members SET password='$real_pass' WHERE id='".$member['id']."'");
$ibforums->member = $member;
$ibforums->session_id = $session_id;
//------------------------------
if ($ibforums->input['CookieDate'])
{
$std->my_setcookie("pass_hash" , $real_pass, 1);
$std->my_setcookie("member_id" , $member['id'], 1);
}
//-----------------------------------
// set our privacy cookie
//-----------------------------------
if ($ibforums->input[Privacy] == 1)
{
$std->my_setcookie( "anonlogin", 1 );
}
//-----------------------------------
// Redirect them to either the board
// index, or where they came from
//-----------------------------------
$print->redirect_screen( "{$ibforums->lang[thanks_for_login]} {$ibforums->member['name']}", $url );
}
else
{
$this->log_in_form( 'wrong_name' );
}
}
function do_log_out() {
global $std, $ibforums, $DB, $print;
if(! $ibforums->member['id'])
{
$std->Error( array( LEVEL => 1, MSG => 'no_guests') );
}
// Update the DB
$DB->query("UPDATE ibf_sessions SET ".
"member_name='NULL',".
"member_id='0',".
"member_pass='NULL',".
"login_type='0' ".
"WHERE id='". $ibforums->session_id ."'");
// Set some cookies
$std->my_setcookie( "member_id" , "0" );
$std->my_setcookie( "pass_hash" , "0" );
$std->my_setcookie( "skin" , "-1" );
// Redirect...
$print->redirect_screen( $ibforums->lang['thanks_for_logout'], "" );
}
}
?>
+102 -69
View File
@@ -2,16 +2,15 @@
/*
+--------------------------------------------------------------------------
| Invision Power Board v1.3.1 Final
| ========================================
| Invision Power Board v2.0.0
| =============================================
| by Matthew Mecham
| (c) 2001 - 2003 Invision Power Services
| (c) 2001 - 2004 Invision Power Services, Inc.
| http://www.invisionpower.com
| ========================================
| =============================================
| Web: http://www.invisionboard.com
| Time: Thu, 23 Sep 2004 23:05:01 GMT
| Release: 3cb325c445e1909182084806ae7f8226
| Email: matt@invisionpower.com
| Time: Tue, 21 Sep 2004 16:34:28 GMT
| Release: 150aa7a702c3c8b6f6eb90ad49305d2f
| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
|
@@ -20,11 +19,16 @@
| > Date started: 18th April 2002
|
| > Module Version Number: 1.0.0
| > DBA Checked: Mon 24th May 2004
+--------------------------------------------------------------------------
*/
$idx = new legends;
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 legends {
@@ -32,16 +36,16 @@ class legends {
var $base_url = "";
var $html = "";
function legends() {
function auto_run() {
//------------------------------------------------------
//-----------------------------------------
// $is_sub is a boolean operator.
// If set to 1, we don't show the "topic subscribed" page
// we simply end the subroutine and let the caller finish
// up for us.
//------------------------------------------------------
//-----------------------------------------
global $ibforums, $DB, $std, $print, $skin_universal;
global $ibforums, $DB, $std, $print;
$ibforums->lang = $std->load_words($ibforums->lang, 'lang_legends', $ibforums->lang_id );
@@ -51,9 +55,9 @@ class legends {
//--------------------------------------------
//-----------------------------------------
// What to do?
//--------------------------------------------
//-----------------------------------------
switch($ibforums->input['CODE'])
{
@@ -84,11 +88,11 @@ class legends {
}
//--------------------------------------------------------------
//-----------------------------------------
function find_user_one()
{
global $ibforums, $DB, $std;
global $ibforums, $DB, $std;
// entry=textarea&name=carbon_copy&sep=comma
@@ -102,11 +106,11 @@ class legends {
}
//--------------------------------------------------------------
//-----------------------------------------
function find_user_two()
{
global $ibforums, $DB, $std;
global $ibforums, $DB, $std;
$entry = (isset($ibforums->input['entry'])) ? $ibforums->input['entry'] : 'textarea';
$name = (isset($ibforums->input['name'])) ? $ibforums->input['name'] : 'carbon_copy';
@@ -128,8 +132,12 @@ class legends {
// Attempt a match
//-----------------------------------------
$DB->query("SELECT id, name FROM ibf_members WHERE LOWER(name) LIKE '".$ibforums->input['username']."%' LIMIT 0,101");
$DB->simple_construct( array( 'select' => 'id, name',
'from' => 'members',
'where' => "LOWER(name) LIKE '".$ibforums->input['username']."%'",
'limit' => array( 0,101) ) );
$DB->simple_exec();
if ( ! $DB->get_num_rows() )
{
$this->find_user_error('fu_no_match');
@@ -161,11 +169,11 @@ class legends {
}
//--------------------------------------------------------------
//-----------------------------------------
function find_user_error($error)
{
global $ibforums, $DB, $std;
global $ibforums, $DB, $std;
$this->page_title = $ibforums->lang['fu_title'];
@@ -176,11 +184,11 @@ class legends {
}
//--------------------------------------------------------------
//-----------------------------------------
function show_emoticons()
{
global $ibforums, $DB, $std;
global $ibforums, $DB, $std;
$this->page_title = $ibforums->lang['emo_title'];
@@ -188,8 +196,9 @@ class legends {
$this->output .= $this->html->page_header( $ibforums->lang['emo_title'], $ibforums->lang['emo_type'], $ibforums->lang['emo_img'] );
$DB->query("SELECT typed, image from ibf_emoticons");
$DB->simple_construct( array( 'select' => 'typed, image', 'from' => 'emoticons', 'where' => "emo_set='".$ibforums->skin['_emodir']."'" ) );
$DB->simple_exec();
if ( $DB->get_num_rows() )
{
while ( $r = $DB->fetch_row() )
@@ -214,53 +223,49 @@ class legends {
}
//--------------------------------------------------------------
//-----------------------------------------
// Show BBCode Helpy file
//--------------------------------------------------------------
//-----------------------------------------
function show_bbcode()
{
global $ibforums, $DB, $std;
global $ibforums, $DB, $std;
require './sources/lib/post_parser.php';
$this->parser = new post_parser();
//-------------------------------------------
//-----------------------------------------
// Array out or stuff here
//-------------------------------------------
//-----------------------------------------
$bbcode = array(
0 => array( '[b]', '[/b]', $ibforums->lang['bbc_ex1'] ),
1 => array('[s]', '[/s]', $ibforums->lang['bbc_ex1'] ),
2 => array('[i]', '[/i]', $ibforums->lang['bbc_ex1'] ),
3 => array('[u]', '[/u]', $ibforums->lang['bbc_ex1'] ),
4 => array('[email]', '[/email]', 'user@domain.com' ),
5 => array('[email=user@domain.com]', '[/email]', $ibforums->lang['bbc_ex2'] ),
6 => array('[url]', '[/url]', 'http://www.domain.com' ),
7 => array('[url=http://www.domain.com]', '[/url]', $ibforums->lang['bbc_ex2'] ),
8 => array('[size=7]', '[/size]' , $ibforums->lang['bbc_ex1'] ),
9 => array('[font=times]', '[/font]', $ibforums->lang['bbc_ex1'] ),
10 => array('[color=red]', '[/color]', $ibforums->lang['bbc_ex1'] ),
11 => array('[img]', '[/img]', $ibforums->vars['board_url'].'/'.$ibforums->vars['img_url'].'/icon11.gif' ),
12 => array('[list]', '[/list]', '[*]List Item [*]List Item' ),
13 => array('[list=1]', '[/list]', '[*]List Item [*]List Item' ),
14 => array('[list=a]', '[/list]', '[*]List Item [*]List Item' ),
15 => array('[list=i]', '[/list]', '[*]List Item [*]List Item' ),
16 => array('[quote]', '[/quote]', $ibforums->lang['bbc_ex1'] ),
17 => array('[code]', '[/code]', '$this_var = "Hello World!";' ),
18 => array('[sql]', '[/sql]', 'SELECT t.tid FROM a_table t WHERE t.val="This Value"' ),
19 => array('[html]', '[/html]', '&lt;a href=&quot;test/page.html&quot;&gt;A Test Page&lt;/a&gt;' ),
);
0 => array('[b]', '[/b]', $ibforums->lang['bbc_ex1'] ),
1 => array('[s]', '[/s]', $ibforums->lang['bbc_ex1'] ),
2 => array('[i]', '[/i]', $ibforums->lang['bbc_ex1'] ),
3 => array('[u]', '[/u]', $ibforums->lang['bbc_ex1'] ),
4 => array('[email]', '[/email]', 'user@domain.com' ),
5 => array('[email=user@domain.com]', '[/email]', $ibforums->lang['bbc_ex2'] ),
6 => array('[url]', '[/url]', 'http://www.domain.com' ),
7 => array('[url=http://www.domain.com]', '[/url]', $ibforums->lang['bbc_ex2'] ),
8 => array('[size=7]', '[/size]' , $ibforums->lang['bbc_ex1'] ),
9 => array('[font=times]', '[/font]', $ibforums->lang['bbc_ex1'] ),
10 => array('[color=red]', '[/color]', $ibforums->lang['bbc_ex1'] ),
11 => array('[img]', '[/img]', $ibforums->vars['board_url'].'/'.$ibforums->vars['img_url'].'/folder_post_icons/icon11.gif' ),
12 => array('[list]', '[/list]', '[*]List Item [*]List Item' ),
13 => array('[list=1]', '[/list]', '[*]List Item [*]List Item' ),
14 => array('[list=a]', '[/list]', '[*]List Item [*]List Item' ),
15 => array('[list=i]', '[/list]', '[*]List Item [*]List Item' ),
16 => array('[quote]', '[/quote]', $ibforums->lang['bbc_ex1'] ),
17 => array('[code]', '[/code]', '$this_var = "Hello World!";' ),
18 => array('[sql]', '[/sql]', 'SELECT t.tid FROM a_table t WHERE t.val="This Value"' ),
19 => array('[html]', '[/html]', '&lt;a href=&quot;test/page.html&quot;&gt;A Test Page&lt;/a&gt;' ),
);
$this->page_title = $ibforums->lang['bbc_title'];
$this->output .= $this->html->bbcode_header();
$this->output .= $this->html->page_header( $ibforums->lang['bbc_title'], $ibforums->lang['bbc_before'], $ibforums->lang['bbc_after'] );
foreach( $bbcode as $bbc )
{
$open = $bbc[0];
@@ -270,22 +275,50 @@ class legends {
$before = $this->html->wrap_tag($open) . $content . $this->html->wrap_tag($close);
$after = $this->parser->convert( array( 'TEXT' => $open.$content.$close, 'CODE' => 1 ) );
$this->output .= $this->html->bbcode_row_header( $ibforums->lang['bbc_title']);
$this->output .= $this->html->bbcode_row( $before, stripslashes($after) );
$this->output .= $this->html->bbcode_row_footer();
}
$this->output .= $this->html->page_footer();
//-----------------------------------------
// Add in custom bbcode
//-----------------------------------------
$DB->simple_construct( array( 'select' => '*', 'from' => 'custom_bbcode' ) );
$DB->simple_exec();
while ( $row = $DB->fetch_row() )
{
$before = $row['bbcode_example'];
$t = $before;
$replace = explode( '{content}', $row['bbcode_replace'] );
if ( $row['bbcode_useoption'] )
{
$t = preg_replace( "#\[".$row['bbcode_tag']."=(?:&quot;|&\#39;)?(.+?)(?:&quot;|&\#39;)?\]#si", str_replace( '{option}', "\\1", $replace[0] ), $t );
}
else
{
$t = str_replace( '['.$row['bbcode_tag'].']' , $replace[0], $t );
}
$t = str_replace( '[/'.$row['bbcode_tag'].']', $replace[1], $t );
$before = preg_replace( "#(\[".$row['bbcode_tag']."(?:[^\]]+)?\])#is", $this->html->wrap_tag("\\1"), $before );
$before = preg_replace( "#(\[/".$row['bbcode_tag']."\])#is" , $this->html->wrap_tag("\\1"), $before );
$this->output .= $this->html->bbcode_row_header( $row['bbcode_title'], $row['bbcode_desc'] );
$this->output .= $this->html->bbcode_row( $before, $t );
$this->output .= $this->html->bbcode_row_footer();
}
}
}
?>
?>
+102 -85
View File
@@ -2,16 +2,15 @@
/*
+--------------------------------------------------------------------------
| Invision Power Board v1.3.1 Final
| ========================================
| Invision Power Board v2.0.0
| =============================================
| by Matthew Mecham
| (c) 2001 - 2003 Invision Power Services
| (c) 2001 - 2004 Invision Power Services, Inc.
| http://www.invisionpower.com
| ========================================
| =============================================
| Web: http://www.invisionboard.com
| Time: Thu, 23 Sep 2004 23:05:01 GMT
| Release: 3cb325c445e1909182084806ae7f8226
| Email: matt@invisionpower.com
| Time: Tue, 21 Sep 2004 16:34:28 GMT
| Release: 150aa7a702c3c8b6f6eb90ad49305d2f
| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
|
@@ -20,13 +19,18 @@
| > Date started: 16th May 2003
|
| > Module Version Number: 1.0.0
| > DBA Checked: Mon 24th May 2004
+--------------------------------------------------------------------------
*/
$idx = new multi_mod;
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 multi_mod {
class mmod {
var $output = "";
var $topic = array();
@@ -39,17 +43,17 @@ class multi_mod {
var $mm_data = "";
var $parser = "";
//------------------------------------------------------
//-----------------------------------------
// @constructor (no, not bob the builder)
//------------------------------------------------------
//-----------------------------------------
function multi_mod()
function auto_run()
{
global $ibforums, $DB, $std, $print;
global $ibforums, $DB, $std, $print, $forums;
//-------------------------------------
//-----------------------------------------
// Load modules...
//-------------------------------------
//-----------------------------------------
$ibforums->lang = $std->load_words($ibforums->lang, 'lang_mod', $ibforums->lang_id);
@@ -61,9 +65,9 @@ class multi_mod {
$this->parser = new post_parser(1);
//----------------------------------------
//-----------------------------------------
// Clean the incoming
//----------------------------------------
//-----------------------------------------
$ibforums->input['t'] = intval($ibforums->input['t']);
$this->mm_id = intval($ibforums->input['mm_id']);
@@ -73,94 +77,91 @@ class multi_mod {
$std->Error( array( LEVEL => '1', MSG => 'missing_files') );
}
//-------------------------------------
//-----------------------------------------
// Get the topic id / forum id
//-------------------------------------
$DB->query("SELECT t.*, f.*
FROM ibf_topics t, ibf_forums f
WHERE t.tid={$ibforums->input['t']} and f.id=t.forum_id");
//-----------------------------------------
$DB->simple_construct( array( 'select' => '*', 'from' => 'topics', 'where' => "tid=".intval($ibforums->input['t']) ) );
$DB->simple_exec();
$this->topic = $DB->fetch_row();
$this->forum = array(
'id' => $this->topic['id'],
'name' => $this->topic['name'],
'topic_mm_id' => $this->topic['topic_mm_id'],
'inc_postcount' => $this->topic['inc_postcount']
);
$this->forum = $forums->forum_by_id[ $this->topic['forum_id'] ];
//-------------------------------------
//-----------------------------------------
// Error out if we can not find the forum
//-------------------------------------
//-----------------------------------------
if (! $this->forum['id'])
{
$std->Error( array( 'LEVEL' => 1,'MSG' => 'missing_files') );
}
//-------------------------------------
//-----------------------------------------
// Error out if we can not find the topic
//-------------------------------------
//-----------------------------------------
if (! $this->topic['tid'])
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'missing_files') );
}
//-------------------------------------
//-----------------------------------------
// Are we a moderator?
//-------------------------------------
//-----------------------------------------
if ( ($ibforums->member['id']) and ($ibforums->member['g_is_supmod'] != 1) )
{
$DB->query("SELECT * FROM ibf_moderators
WHERE forum_id={$this->forum['id']} AND (member_id={$ibforums->member['id']}
OR (is_group=1 AND group_id={$ibforums->member['mgroup']}))");
$DB->simple_construct( array( 'select' => '*',
'from' => 'moderators',
'where' => "forum_id=".$this->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();
}
//----------------------------------------
//-----------------------------------------
// Init modfunc module
//----------------------------------------
//-----------------------------------------
$this->modfunc->init( $this->forum, $this->topic, $this->moderator );
//----------------------------------------
//-----------------------------------------
// Do we have permission?
//----------------------------------------
//-----------------------------------------
if ( $this->modfunc->mm_authorize() != TRUE )
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'is_broken_link') );
}
//-------------------------------------
// Does this forum have this mm_id
//-------------------------------------
if ( $this->modfunc->mm_check_id_in_forum( $this->forum['topic_mm_id'], $this->mm_id ) != TRUE )
//-----------------------------------------
// Get MM data
//-----------------------------------------
$this->mm_data = $ibforums->cache['multimod'][ $this->mm_id ];
if ( ! $this->mm_data['mm_id'] )
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'is_broken_link') );
}
//-----------------------------------------
// Does this forum have this mm_id
//-----------------------------------------
if ( $this->modfunc->mm_check_id_in_forum( $this->forum['id'], $this->mm_data ) != TRUE )
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'missing_files') );
}
//-------------------------------------
// Still here? We're damn good to go sir!
//-------------------------------------
$DB->query("SELECT * FROM ibf_topic_mmod WHERE mm_id={$this->mm_id}");
if ( ! $this->mm_data = $DB->fetch_row() )
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'is_broken_link') );
}
$this->modfunc->stm_init();
//-------------------------------------
//-----------------------------------------
// Open close?
//-------------------------------------
//-----------------------------------------
if ( $this->mm_data['topic_state'] != 'leave' )
{
@@ -174,9 +175,9 @@ class multi_mod {
}
}
//-------------------------------------
//-----------------------------------------
// pin no-pin?
//-------------------------------------
//-----------------------------------------
if ( $this->mm_data['topic_pin'] != 'leave' )
{
@@ -190,9 +191,25 @@ class multi_mod {
}
}
//-------------------------------------
//-----------------------------------------
// Approve / Unapprove
//-----------------------------------------
if ( $this->mm_data['topic_approve'] )
{
if ( $this->mm_data['topic_approve'] == 1 )
{
$this->modfunc->stm_add_approve();
}
else if ( $this->mm_data['topic_approve'] == 2 )
{
$this->modfunc->stm_add_unapprove();
}
}
//-----------------------------------------
// Topic title
//-------------------------------------
//-----------------------------------------
$title = $this->topic['title'];
@@ -212,15 +229,15 @@ class multi_mod {
$this->modfunc->stm_add_title($this->mm_data['topic_title_st'].$title.$this->mm_data['topic_title_end']);
//-------------------------------------
//-----------------------------------------
// Update what we have so far...
//-------------------------------------
//-----------------------------------------
$this->modfunc->stm_exec( $this->topic['tid'] );
//-------------------------------------
//-----------------------------------------
// Add reply?
//-------------------------------------
//-----------------------------------------
if ( $this->mm_data['topic_reply'] and $this->mm_data['topic_reply_content'] )
{
@@ -238,23 +255,24 @@ class multi_mod {
);
}
//-------------------------------------
//-----------------------------------------
// Move topic?
//-------------------------------------
//-----------------------------------------
if ( $this->mm_data['topic_move'] )
{
//-------------------------------------
//-----------------------------------------
// Move to forum still exist?
//-------------------------------------
$DB->query("SELECT id, name, subwrap, sub_can_post FROM ibf_forums WHERE id=".$this->mm_data['topic_move']);
//-----------------------------------------
$DB->simple_construct( array( 'select' => 'id, name, sub_can_post', 'from' => 'forums', 'where' => "id=".$this->mm_data['topic_move'] ) );
$DB->simple_exec();
if ( $r = $DB->fetch_row() )
{
if ( $r['subwrap'] == 1 AND $r['sub_can_post'] != 1 )
if ( $r['sub_can_post'] != 1 )
{
$DB->query("UPDATE ibf_topic_mmod SET topic_move=0 WHERE mm_id=".$this->mm_id);
$DB->do_update( 'topic_mmod', array( 'topic_move' => 0 ), 'mm_id='.$this->mm_id );
}
else
{
@@ -268,25 +286,25 @@ class multi_mod {
}
else
{
$DB->query("UPDATE ibf_topic_mmod SET topic_move=0 WHERE mm_id=".$this->mm_id);
$DB->do_update( 'topic_mmod', array( 'topic_move' => 0 ), 'mm_id='.$this->mm_id );
}
}
//-------------------------------------
//-----------------------------------------
// Recount root forum
//-------------------------------------
//-----------------------------------------
$this->modfunc->forum_recount( $this->forum['id'] );
//-------------------------------------
//-----------------------------------------
// Add mod log
//-------------------------------------
//-----------------------------------------
$this->modfunc->add_moderate_log( $this->forum['id'], $this->topic['tid'], "", $this->topic['title'], "Applied multi-mod: ".$this->mm_data['mm_title'] );
//-------------------------------------
//-----------------------------------------
// Redirect back with nice fluffy message
//-------------------------------------
//-----------------------------------------
$print->redirect_screen( sprintf($ibforums->lang['mm_applied'], $this->mm_data['mm_title'] ), "showforum=".$this->forum['id'] );
@@ -301,4 +319,3 @@ class multi_mod {
+150 -159
View File
@@ -2,16 +2,15 @@
/*
+--------------------------------------------------------------------------
| Invision Power Board v1.3.1 Final
| ========================================
| Invision Power Board v2.0.0
| =============================================
| by Matthew Mecham
| (c) 2001 - 2003 Invision Power Services
| (c) 2001 - 2004 Invision Power Services, Inc.
| http://www.invisionpower.com
| ========================================
| =============================================
| Web: http://www.invisionboard.com
| Time: Thu, 23 Sep 2004 23:05:01 GMT
| Release: 3cb325c445e1909182084806ae7f8226
| Email: matt@invisionpower.com
| Time: Tue, 21 Sep 2004 16:34:28 GMT
| Release: 150aa7a702c3c8b6f6eb90ad49305d2f
| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
|
@@ -20,13 +19,18 @@
| > Date started: 25th March 2002
|
| > Module Version Number: 1.0.0
| > DBA Checked: Mon 24th May 2004
+--------------------------------------------------------------------------
*/
$idx = new Printable;
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 Printable {
class printpage {
var $output = "";
var $base_url = "";
@@ -41,20 +45,19 @@ class Printable {
var $poll_html = "";
var $parser = "";
/***********************************************************************************/
/*-------------------------------------------------------------------------*/
//
// Our constructor, load words, load skin, print the topic listing
//
/***********************************************************************************/
/*-------------------------------------------------------------------------*/
function Printable() {
global $ibforums, $DB, $std, $print, $skin_universal;
function auto_run()
{
global $ibforums, $DB, $std, $print, $forums;
/***********************************/
//-----------------------------------------
// Compile the language file
/***********************************/
//-----------------------------------------
$ibforums->lang = $std->load_words($ibforums->lang, 'lang_printpage', $ibforums->lang_id);
@@ -64,84 +67,70 @@ class Printable {
$this->parser = new post_parser();
/***********************************/
//-----------------------------------------
// Check the input
/***********************************/
//-----------------------------------------
$ibforums->input['t'] = intval($ibforums->input['t']);
$ibforums->input['f'] = intval($ibforums->input['f']);
if ($ibforums->input['t'] < 0 or $ibforums->input['f'] < 0)
if ( ! $ibforums->input['t'] or ! $ibforums->input['f'] )
{
$std->Error( array( LEVEL => 1, MSG => 'missing_files') );
}
//-------------------------------------
// Get the forum info based on the forum ID, get the category name, ID, and get the topic details
//-------------------------------------
//-----------------------------------------
// Get the forum info based on the
// forum ID, get the category name, ID,
// and get the topic details
//-----------------------------------------
$DB->query("SELECT t.*, f.name as forum_name, f.id as forum_id, f.read_perms, f.password, f.reply_perms, f.start_perms, f.allow_poll, f.posts as forum_posts, f.topics as forum_topics, f.use_html, c.name as cat_name, c.id as cat_id FROM ibf_topics t, ibf_forums f , ibf_categories c where t.tid='".$ibforums->input[t]."' and f.id = t.forum_id and f.category=c.id");
$DB->simple_construct( array( 'select' => '*', 'from' => 'topics', 'where' => "tid=".$ibforums->input['t'] ) );
$DB->simple_exec();
$this->topic = $DB->fetch_row();
$this->forum = array( 'id' => $this->topic['forum_id'] ,
'name' => $this->topic['forum_name'] ,
'posts' => $this->topic['forum_posts'] ,
'topics' => $this->topic['forum_topics'] ,
'read_perms' => $this->topic['read_perms'] ,
'allow_poll' => $this->topic['allow_poll'] ,
'password' => $this->topic['password'] ,
'use_html' => $this->topic['use_html']
);
$this->forum = $forums->forum_by_id[ $this->topic['forum_id'] ];
$this->category = array( 'name' => $this->topic['cat_name'],
'id' => $this->topic['cat_id'] ,
);
//-------------------------------------
//-----------------------------------------
// Error out if we can not find the forum
//-------------------------------------
//-----------------------------------------
if (!$this->forum['id'])
if ( ! $this->forum['id'])
{
$std->Error( array( LEVEL => 1, MSG => 'missing_files') );
}
//-------------------------------------
//-----------------------------------------
// Error out if we can not find the topic
//-------------------------------------
//-----------------------------------------
if (!$this->topic['tid'])
{
$std->Error( array( LEVEL => 1, MSG => 'missing_files') );
}
$this->base_url = "{$ibforums->vars['board_url']}/index.{$ibforums->vars['php_ext']}?s={$ibforums->session_id}";
/***********************************/
//-----------------------------------------
// Check viewing permissions, private forums,
// password forums, etc
/***********************************/
//-----------------------------------------
if ( (!$this->topic['pin_state']) and (!$ibforums->member['g_other_topics']) )
{
$std->Error( array( LEVEL => 1, MSG => 'no_view_topic') );
}
$bad_entry = $this->check_access();
//-----------------------------------------
// Check access
//-----------------------------------------
if ($bad_entry == 1)
{
$std->Error( array( LEVEL => 1, MSG => 'no_view_topic') );
}
$forums->forums_check_access( $this->forum['id'], 1 );
//------------------------------------------------------------
//-----------------------------------------
//
// Main logic engine
//
//------------------------------------------------------------
//-----------------------------------------
if ($ibforums->input['client'] == 'choose')
{
@@ -149,8 +138,8 @@ class Printable {
$this->page_title = $this->topic['title'];
$this->nav = array ( "<a href='{$this->base_url}&act=SF&f={$this->forum['id']}'>{$this->forum['name']}</a>",
"<a href='{$this->base_url}&act=ST&f={$this->forum['id']}&t={$this->topic['tid']}'>{$this->topic['title']}</a>"
$this->nav = array ( "<a href='{$ibforums->base_url}&act=SF&f={$this->forum['id']}'>{$this->forum['name']}</a>",
"<a href='{$ibforums->base_url}&act=ST&f={$this->forum['id']}&t={$this->topic['tid']}'>{$this->topic['title']}</a>"
);
@@ -187,7 +176,6 @@ class Printable {
//$this->output .= "<br><br><font size='1'><center>Powered by Invision Power Board<br>&copy; 2002 Invision PS</center></font></body></html>";
@flush();
@header("Content-type: $header");
if ($ibforums->input['client'] != 'printer')
@@ -202,33 +190,45 @@ class Printable {
}
/*-------------------------------------------------------------------------*/
// GET POSTS
/*-------------------------------------------------------------------------*/
function get_posts()
{
global $ibforums, $DB, $std, $skin_universal;
global $ibforums, $DB, $std, $print;
/***********************************/
//-----------------------------------------
// Render the page top
/***********************************/
//-----------------------------------------
$posts_html = $this->html->pp_header( $this->forum['name'], $this->topic['title'], $this->topic['starter_name'] , $this->forum['id'], $this->topic['tid']);
$max_posts = 300;
$DB->query( "SELECT * FROM ibf_posts WHERE topic_id='".$this->topic['tid']."'".
" and queued !='1' ORDER BY pid LIMIT 0, ".$max_posts);
$DB->simple_construct( array ( 'select' => '*',
'from' => 'posts',
'where' => "topic_id='{$this->topic['tid']}' and queued !='1'",
'order' => 'pid',
'limit' => array(0, $max_posts)
) );
$DB->simple_exec();
//-----------------------------------------
// Loop through to pick out the correct member IDs.
// and push the post info into an array - maybe in the future
// we can add page spans, or maybe save to a PDF file?
//-----------------------------------------
$the_posts = array();
$mem_ids = "";
$member_array = array();
$cached_members = array();
while ($i = $DB->fetch_row() )
while ( $i = $DB->fetch_row() )
{
$the_posts[] = $i;
if ($i['author_id'] != 0)
{
if (preg_match( "/'".$i['author_id']."',/", $mem_ids) )
@@ -242,15 +242,21 @@ class Printable {
}
}
//-----------------------------------------
// Fix up the member_id string
//-----------------------------------------
$mem_ids = preg_replace( "/,$/", "", $mem_ids);
//-----------------------------------------
// Get the member profiles needed for this topic
//-----------------------------------------
if ($mem_ids != "")
{
$DB->query("SELECT g.*, m.* FROM ibf_members m, ibf_groups g WHERE m.id in ($mem_ids) AND m.mgroup=g.g_id");
$DB->cache_add_query( 'print_page_get_members', array( 'mem_ids' => $mem_ids ) );
$DB->cache_exec_query();
while ( $m = $DB->fetch_row() )
{
if ($m['id'] and $m['name'])
@@ -267,44 +273,62 @@ class Printable {
}
}
/***********************************/
//-----------------------------------------
// Format and print out the topic list
/***********************************/
//-----------------------------------------
$td_col_cnt = 0;
foreach ($the_posts as $row) {
$poster = array();
//-----------------------------------------
// Get the member info. We parse the data and cache it.
// It's likely that the same member posts several times in
// one page, so it's not efficient to keep parsing the same
// data
//-----------------------------------------
if ($row['author_id'] != 0)
{
//-----------------------------------------
// Is it in the hash?
//-----------------------------------------
if ( isset($cached_members[ $row['author_id'] ]) )
{
//-----------------------------------------
// Ok, it's already cached, read from it
//-----------------------------------------
$poster = $cached_members[ $row['author_id'] ];
$row['name_css'] = 'normalname';
}
else
{
//-----------------------------------------
// Ok, it's NOT in the cache, is it a member thats
// not been deleted?
//-----------------------------------------
if ($member_array[ $row['author_id'] ])
{
$row['name_css'] = 'normalname';
$poster = $member_array[ $row['author_id'] ];
//-----------------------------------------
// Add it to the cached list
//-----------------------------------------
$cached_members[ $row['author_id'] ] = $poster;
}
else
{
//-----------------------------------------
// It's probably a deleted member, so treat them as a guest
//-----------------------------------------
$poster = $std->set_up_guest( $row['author_id'] );
$row['name_css'] = 'unreg';
}
@@ -312,31 +336,34 @@ class Printable {
}
else
{
//-----------------------------------------
// It's definately a guest...
//-----------------------------------------
$poster = $std->set_up_guest( $row['author_name'] );
$row['name_css'] = 'unreg';
}
//--------------------------------------------------------------
//-----------------------------------------
$row['post_css'] = $td_col_count % 2 ? 'post1' : 'post2';
++$td_col_count;
//--------------------------------------------------------------
//-----------------------------------------
$row['post'] = preg_replace( "/<!--EDIT\|(.+?)\|(.+?)-->/", "", $row['post'] );
//--------------------------------------------------------------
//-----------------------------------------
$row['post_date'] = $std->get_date( $row['post_date'], 'LONG' );
$row['post'] = $this->parse_message($row['post']);
//--------------------------------------------------------------
//-----------------------------------------
// Siggie stuff
//--------------------------------------------------------------
//-----------------------------------------
$row['signature'] = "";
@@ -344,113 +371,77 @@ class Printable {
{
if ($row['use_sig'] == 1)
{
if ( $ibforums->vars['sig_allow_html'] == 1 )
{
$poster['signature'] = $this->parser->parse_html($poster['signature'], 0);
}
$this->parser->pp_do_html = intval($ibforums->vars['sig_allow_html']);
$this->parser->pp_wordwrap = $ibforums->vars['post_wordwrap'];
$this->pp_nl2br = 1;
if ( $ibforums->vars['post_wordwrap'] > 0 )
{
$poster['signature'] = $this->parser->my_wordwrap( $poster['signature'], $ibforums->vars['post_wordwrap']) ;
}
$row['signature'] = $skin_universal->signature_separator($poster['signature']);
$row['signature'] = $ibforums->skin_global->signature_separator( $this->parser->post_db_parse($poster['signature']) );
}
}
//--------------------------------------------------------------
//-----------------------------------------
// Parse HTML tag on the fly
//--------------------------------------------------------------
//-----------------------------------------
if ( $this->forum['use_html'] == 1 )
{
// So far, so good..
if ( stristr( $row['post'], '[dohtml]' ) )
{
// [doHTML] tag found..
$parse = ($this->forum['use_html'] AND $poster['g_dohtml']) ? 1 : 0;
$row['post'] = $this->parser->post_db_parse($row['post'], $parse );
}
}
$this->parser->pp_do_html = ( $this->forum['use_html'] and $ibforums->cache['group_cache'][ $ibforums->member['mgroup'] ]['g_dohtml'] and $row['post_htmlstate'] ) ? 1 : 0;
$this->parser->pp_wordwrap = $ibforums->vars['post_wordwrap'];
$this->parser->pp_nl2br = $row['post_htmlstate'] == 2 ? 1 : 0;
$row['post'] = $this->parser->post_db_parse( $row['post'] );
$posts_html .= $this->html->pp_postentry( $poster, $row );
}
/***********************************/
//-----------------------------------------
// Print the footer
/***********************************/
//-----------------------------------------
$posts_html .= $this->html->pp_end();
//-----------------------------------------
// Macros
//-----------------------------------------
$print->_unpack_macros();
if ( is_array( $print->macros ) )
{
foreach( $print->macros as $i => $row )
{
if ( $row['macro_value'] != "" )
{
$posts_html = str_replace( "<{".$row['macro_value']."}>", $row['macro_replace'], $posts_html );
}
}
}
$posts_html = str_replace( "<#IMG_DIR#>", $ibforums->skin['_imagedir'], $posts_html );
$posts_html = str_replace( "<#EMO_DIR#>", $ibforums->skin['_emodir'] , $posts_html );
//-----------------------------------------
// CSS
//-----------------------------------------
$ibforums->skin['_usecsscache'] = 0;
$css = $print->_get_css();
$posts_html = str_replace( '<!--IPB.CSS-->', $css, $posts_html );
return $posts_html;
}
function parse_message($message="") {
//$message = preg_replace( "#<!--emo&(.+?)-->.+?<!--endemo-->#", "\\1" , $message );
//$message = preg_replace( "#<!--c1-->(.+?)<!--ec1-->#", "\n\n------------ CODE SAMPLE ----------\n" , $message );
//$message = preg_replace( "#<!--c2-->(.+?)<!--ec2-->#", "\n-----------------------------------\n\n" , $message );
//$message = preg_replace( "#<!--QuoteBegin-->(.+?)<!--QuoteEBegin-->#" , "\n\n------------ QUOTE ----------\n" , $message );
//$message = preg_replace( "#<!--QuoteBegin--(.+?)\+(.+?)-->(.+?)<!--QuoteEBegin-->#" , "\n\n------------ QUOTE ----------\n" , $message );
//$message = preg_replace( "#<!--QuoteEnd-->(.+?)<!--QuoteEEnd-->#" , "\n-----------------------------\n\n" , $message );
$message = preg_replace( "#<!--Flash (.+?)-->.+?<!--End Flash-->#e" , "(FLASH MOVIE)" , $message );
//$message = preg_replace( "#<img src=[\"'](\S+?)['\"].+"."?".">#" , "(IMAGE: \\1)" , $message );
function parse_message($message="")
{
$message = preg_replace( "#<!--Flash (.+?)-->.+?<!--End Flash-->#e" , "(FLASH MOVIE)" , $message );
$message = preg_replace( "#<a href=[\"'](http|https|ftp|news)://(\S+?)['\"].+?".">(.+?)</a>#" , "\\1://\\2" , $message );
//$message = preg_replace( "#<a href=[\"']mailto:(.+?)['\"]>(.+?)</a>#" , "(EMAIL: \\2)" , $message );
//$message = preg_replace( "#<!--sql-->(.+?)<!--sql1-->(.+?)<!--sql2-->(.+?)<!--sql3-->#e" , "\n\n--------------- SQL -----------\n\\2\n----------------\n\n", $message);
//$message = preg_replace( "#<!--html-->(.+?)<!--html1-->(.+?)<!--html2-->(.+?)<!--html3-->#e", "\n\n-------------- HTML -----------\n\\2\n----------------\n\n", $message);
return $message;
}
function check_access() {
global $ibforums, $std, $HTTP_COOKIE_VARS;
$return = 1;
$this->m_group = $ibforums->member['mgroup'];
if ( $std->check_perms($this->forum['read_perms']) == TRUE )
{
$return = 0;
}
if ($this->forum['password'] != "")
{
if ( ! $c_pass = $std->my_getcookie('iBForum'.$this->forum['id']) )
{
return 1;
}
if ( $c_pass == $this->forum['password'] )
{
return 0;
}
else
{
return 1;
}
}
return $return;
}
}
?>
?>
+214 -161
View File
@@ -2,16 +2,15 @@
/*
+--------------------------------------------------------------------------
| Invision Power Board v1.3.1 Final
| ========================================
| Invision Power Board v2.0.0
| =============================================
| by Matthew Mecham
| (c) 2001 - 2003 Invision Power Services
| (c) 2001 - 2004 Invision Power Services, Inc.
| http://www.invisionpower.com
| ========================================
| =============================================
| Web: http://www.invisionboard.com
| Time: Thu, 23 Sep 2004 23:05:01 GMT
| Release: 3cb325c445e1909182084806ae7f8226
| Email: matt@invisionpower.com
| Time: Tue, 21 Sep 2004 16:34:28 GMT
| Release: 150aa7a702c3c8b6f6eb90ad49305d2f
| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
|
@@ -20,11 +19,16 @@
| > Date started: 6th March 2002
|
| > Module Version Number: 1.0.0
| > DBA Checked: Mon 24th May 2004
+--------------------------------------------------------------------------
*/
$idx = new stats;
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 stats {
@@ -33,14 +37,14 @@ class stats {
var $html = "";
var $forum = "";
function stats() {
function auto_run() {
//------------------------------------------------------
//-----------------------------------------
// $is_sub is a boolean operator.
// If set to 1, we don't show the "topic subscribed" page
// we simply end the subroutine and let the caller finish
// up for us.
//------------------------------------------------------
//-----------------------------------------
global $ibforums, $DB, $std, $print, $skin_universal;
@@ -50,9 +54,9 @@ class stats {
$this->base_url = $ibforums->base_url;
//--------------------------------------------
//-----------------------------------------
// What to do?
//--------------------------------------------
//-----------------------------------------
switch($ibforums->input['CODE'])
{
@@ -84,7 +88,7 @@ class stats {
function who_posted()
{
global $ibforums, $DB, $std, $print;
global $ibforums, $DB, $std, $print;
$tid = intval(trim($ibforums->input['t']));
@@ -92,8 +96,8 @@ class stats {
$this->check_access($tid);
$DB->query("SELECT COUNT(p.pid) as pcount, p.author_id, p.author_name FROM ibf_posts p
WHERE p.topic_id=$tid AND queued <> 1 GROUP BY p.author_name ORDER BY pcount DESC");
$DB->cache_add_query( 'stats_who_posted', array( 'tid' => $tid ) );
$DB->cache_exec_query();
if ( $DB->get_num_rows() )
{
@@ -122,11 +126,11 @@ class stats {
exit();
}
//--------------------------------
//-----------------------------------------
function check_access($tid)
{
global $ibforums, $DB, $std, $HTTP_COOKIE_VARS;
global $ibforums, $DB, $std, $HTTP_COOKIE_VARS, $forums;
// check for faked session ID's :D
@@ -149,11 +153,14 @@ class stats {
// $std->Error( array( 'LEVEL' => 1, 'MSG' => 'no_permission') );
//}
//--------------------------------
//-----------------------------------------
$DB->simple_construct( array( 'select' => '*,title as topic_title', 'from' => 'topics', 'where' => "tid=".$tid ) );
$DB->simple_exec();
$DB->query("SELECT t.title as topic_title, f.read_perms, f.password, f.id from ibf_forums f, ibf_topics t WHERE t.tid=$tid and f.id=t.forum_id");
$this->forum = $DB->fetch_row();
$this->forum = array_merge( $this->forum, $forums->forum_by_id[ $this->forum['forum_id'] ] );
$return = 1;
@@ -177,140 +184,177 @@ class stats {
}
//--------------------------------
/*-------------------------------------------------------------------------*/
// SHOW FORUM LEADERS
/*-------------------------------------------------------------------------*/
function show_leaders()
{
global $ibforums, $DB, $std;
global $ibforums, $DB, $std, $forums;
//$this->output .= $this->html->page_title( $ibforums->lang['forum_leaders'] );
//--------------------------------------------
// Work out where our super mods are at
//--------------------------------------------
//-----------------------------------------
// Work out where our super mods / admins/ mods
// are.....
//-----------------------------------------
$sup_ids = array();
$group_ids = array();
$member_ids = array();
$used_ids = array();
$members = array();
$moderators = array();
$DB->query("SELECT g_id from ibf_groups WHERE g_is_supmod = 1");
foreach( $ibforums->cache['group_cache'] as $d => $i )
{
if ( $i['g_is_supmod'] )
{
$group_ids[ $i['g_id'] ] = $i['g_id'];
}
if ( $i['g_access_cp'] )
{
$group_ids[ $i['g_id'] ] = $i['g_id'];
}
}
foreach( $ibforums->cache['moderators'] as $d => $i )
{
if ( $i['is_group'] )
{
$group_ids[ $i['group_id'] ] = $i['group_id'];
}
else
{
$member_ids[ $i['member_id'] ] = $i['member_id'];
}
}
if ( $DB->get_num_rows() )
//-----------------------------------------
// Get all members.. (two is more eff. than 1)
//-----------------------------------------
if ( count( $member_ids ) )
{
while ( $i = $DB->fetch_row() )
{
$sup_ids[] = $i['g_id'];
}
$DB->cache_add_query( 'stats_get_all_members', array( 'member_ids' => $member_ids ) );
$DB->cache_exec_query();
while( $r = $DB->fetch_row() )
{
$members[ $r['id'] ] = $r;
}
}
//--------------------------------------------
// Get our admins
//--------------------------------------------
//-----------------------------------------
// Get all groups.. (two is more eff. than 1)
//-----------------------------------------
$admin_ids = array();
$DB->cache_add_query( 'stats_get_all_members_groups', array( 'group_ids' => $group_ids ) );
$DB->cache_exec_query();
$DB->query("SELECT m.id, m.name, m.email, m.hide_email, m.location, m.aim_name, m.icq_number, g.g_access_cp
FROM ibf_members m, ibf_groups g
WHERE g.g_access_cp=1 AND m.mgroup=g.g_id ORDER BY m.name");
while( $r = $DB->fetch_row() )
{
$members[ $r['id'] ] = $r;
}
//-----------------------------------------
// PRINT: Admins
//-----------------------------------------
$this->output .= $this->html->group_strip( $ibforums->lang['leader_admins'] );
while ( $member = $DB->fetch_row() )
foreach( $members as $id => $member )
{
$this->output .= $this->html->leader_row( $this->parse_member( $member ), $ibforums->lang['leader_all_forums'] );
$admin_ids[] = $member['id'];
if ( $ibforums->cache['group_cache'][ $member['mgroup'] ]['g_access_cp'] )
{
$this->output .= $this->html->leader_row( $this->parse_member( $member ), $ibforums->lang['leader_all_forums'] );
//-----------------------------------------
// Used...
//-----------------------------------------
$used_ids[] = $id;
}
}
$this->output .= $this->html->close_strip();
//--------------------------------------------
// Do the bizz with the super men, er mods.
//--------------------------------------------
//-----------------------------------------
// PRINT: Super Moderators
//-----------------------------------------
$admin_ids[] = '0';
$tmp_html = "";
if ( count($sup_ids) > 0 )
foreach( $members as $id => $member )
{
$DB->query("SELECT id, name, email, hide_email, location, aim_name, icq_number from ibf_members WHERE mgroup IN (".implode( ',', $sup_ids ).") and id NOT IN(".implode(',', $admin_ids).") ORDER BY name");
if ( $DB->get_num_rows() )
if ( $ibforums->cache['group_cache'][ $member['mgroup'] ]['g_is_supmod'] and ( ! in_array( $id, $used_ids) ) )
{
$this->output .= $this->html->group_strip( $ibforums->lang['leader_global'] );
$tmp_html .= $this->html->leader_row( $this->parse_member( $member ), $ibforums->lang['leader_all_forums'] );
while ( $member = $DB->fetch_row() )
{
$this->output .= $this->html->leader_row( $this->parse_member( $member ), $ibforums->lang['leader_all_forums'] );
}
$this->output .= $this->html->close_strip();
}
//-----------------------------------------
// Used...
//-----------------------------------------
$used_ids[] = $id;
}
}
if ( $tmp_html )
{
$this->output .= $this->html->group_strip( $ibforums->lang['leader_global'] );
$this->output .= $tmp_html;
$this->output .= $this->html->close_strip();
}
//--------------------------------------------
// Do we have any moderators? NORMAL MODS 1st
//--------------------------------------------
//-----------------------------------------
// GET MODERATORS: Normal
//-----------------------------------------
$DB->query("SELECT m2.id, m2.name, m2.email, m2.hide_email, m2.location, m2.aim_name, m2.icq_number,
f.id as forum_id, f.read_perms, f.name as forum_name, c.state
FROM ibf_moderators mod
LEFT JOIN ibf_forums f ON(f.id=mod.forum_id)
LEFT JOIN ibf_categories c ON(c.id=f.category AND c.state != 0)
LEFT JOIN ibf_members m2 ON (mod.member_id=m2.id)
");
$tmp_html = "";
$data = array();
while ( $i = $DB->fetch_row() )
foreach( $members as $id => $member )
{
if ( ! $i['name'] )
if ( ! in_array( $id, $used_ids) )
{
continue;
}
if ( $std->check_perms($i['read_perms']) == TRUE )
{
$data[] = $i;
foreach( $ibforums->cache['moderators'] as $idx => $data )
{
if ( $data['is_group'] and $data['group_id'] == $member['mgroup'] )
{
if ( $std->check_perms( $forums->forum_by_id[ $data['forum_id'] ]['read_perms'] ) == TRUE )
{
$moderators[] = array_merge( $member, array( 'forum_id' => $data['forum_id'] ) );
}
$used_ids[] = $id;
}
else if ( $data['member_id'] == $member['id'] )
{
if ( $std->check_perms( $forums->forum_by_id[ $data['forum_id'] ]['read_perms'] ) == TRUE )
{
$moderators[] = array_merge( $member, array( 'forum_id' => $data['forum_id'] ) );
}
$used_ids[] = $id;
}
}
}
}
//--------------------------------------------
// Do we have any moderators? GROUP MODS 1st
//--------------------------------------------
//-----------------------------------------
// Parse moderators
//-----------------------------------------
$DB->query("SELECT m.id, m.name, m.email, m.hide_email, m.location, m.aim_name, m.icq_number,
f.id as forum_id, f.read_perms, f.name as forum_name, c.state
FROM ibf_moderators mod
LEFT JOIN ibf_forums f ON(f.id=mod.forum_id)
LEFT JOIN ibf_categories c ON(c.id=f.category AND c.state != 0)
LEFT JOIN ibf_members m ON ((mod.is_group=1 and mod.group_id=m.mgroup))
");
while ( $i = $DB->fetch_row() )
{
if ( ! $i['name'] )
{
continue;
}
if ( $std->check_perms($i['read_perms']) == TRUE )
{
$data[] = $i;
}
}
//------------------------
if ( count($data) > 0 )
if ( count($moderators) > 0 )
{
$mod_array = array();
$this->output .= $this->html->group_strip( $ibforums->lang['leader_mods'] );
foreach ( $data as $idx => $i )
foreach ( $moderators as $idx => $i )
{
if ( !isset( $mod_array['member'][ $i['id'] ][ 'name' ] ) )
if ( ! isset( $mod_array['member'][ $i['id'] ][ 'name' ] ) )
{
//-----------------------------------------
// Member is not already set, lets add the member...
//-----------------------------------------
$mod_array['member'][ $i['id'] ] = array( 'name' => $i['name'],
'email' => $i['email'],
@@ -323,9 +367,11 @@ class stats {
}
//-----------------------------------------
// Add forum..
$mod_array['forums'][ $i['id'] ][] = array($i['forum_id'], $i['forum_name']);
//-----------------------------------------
$mod_array['forums'][ $i['id'] ][] = array( $i['forum_id'] , $forums->forum_by_id[ $i['forum_id'] ]['name'] );
}
foreach( $mod_array['member'] as $id => $data )
@@ -354,7 +400,6 @@ class stats {
$this->parse_member( $mod_array['member'][ $id ] ),
$fhtml
);
}
$this->output .= $this->html->close_strip();
@@ -363,12 +408,11 @@ class stats {
$this->page_title = $ibforums->lang['forum_leaders'];
$this->nav = array( $ibforums->lang['forum_leaders'] );
}
function show_queries()
{
global $ibforums, $DB, $std;
global $ibforums, $DB, $std;
// show DB queries in graphic format(depreciated)
// left here to stop other functions breaking
@@ -378,65 +422,79 @@ class stats {
exit();
}
/*-------------------------------------------------------------------------*/
// Top 10 Posters
/*-------------------------------------------------------------------------*/
function show_today_posters()
{
global $ibforums, $DB, $std;
//$this->output .= $this->html->page_title( $ibforums->lang['todays_posters'] );
global $ibforums, $DB, $std, $forums;
$this->output .= $this->html->top_poster_header();
$time_high = time();
$ids = array();
$time_low = $time_high - (60*60*24);
$time_low = $time_high - (60*60*24);
//--------------------------------------------
//-----------------------------------------
// Query the DB
//--------------------------------------------
//-----------------------------------------
$DB->query("SELECT COUNT(pid) as count FROM ibf_posts WHERE post_date < $time_high and post_date > $time_low");
$todays_posts = $DB->fetch_row();
if ($todays_posts['count'] > 0)
foreach( $forums->forum_by_id as $id => $data )
{
if ( ! $data['inc_postcount'] )
{
continue;
}
$ids[] = $id;
}
$DB->query("SELECT COUNT(p.pid) as tpost, m.id, m.name, m.joined, m.posts FROM ibf_posts p, ibf_members m "
."WHERE m.id > 0 AND m.id=p.author_id and post_date < $time_high and post_date > $time_low GROUP BY p.author_id ORDER BY tpost DESC LIMIT 0,10");
if ( $DB->get_num_rows() )
{
$todays_posts = 0;
$store = array();
$DB->simple_construct( array( 'select' => 'count(*) as cnt', 'from' => 'posts', 'where' => "post_date > $time_low" ) );
$DB->simple_exec();
$total_today = $DB->fetch_row();
$DB->cache_add_query( 'stats_get_todays_posters', array( 'ids' => $ids, 'time_low' => $time_low ) );
$DB->cache_exec_query();
while ($r = $DB->fetch_row())
{
$todays_posts += $r['tpost'];
while ($info = $DB->fetch_row())
$store[] = $r;
}
if ( $todays_posts )
{
foreach( $store as $idx => $info )
{
$info['total_today_posts'] = $todays_posts;
if ($todays_posts > 0 and $info['tpost'] > 0)
{
$info['total_today_posts'] = $todays_posts['count'];
if ($todays_posts['count'] > 0 and $info['tpost'] > 0)
{
$info['today_pct'] = sprintf( '%.2f', ( $info['tpost'] / $todays_posts['count'] ) * 100 );
}
$info['joined'] = $std->get_date( $info['joined'], 'JOINED' );
$info['posts'] = $std->do_number_format($info['posts']);
$info['tpost'] = $std->do_number_format($info['tpost']);
$this->output .= $this->html->top_poster_row( $info );
$info['today_pct'] = sprintf( '%.2f', ( $info['tpost'] / $total_today['cnt'] ) * 100 );
}
$info['joined'] = $std->get_date( $info['joined'], 'JOINED' );
$info['posts'] = $std->do_number_format($info['posts']);
$info['tpost'] = $std->do_number_format($info['tpost']);
$this->output .= $this->html->top_poster_row( $info );
}
else
{
$this->output .= $this->html->top_poster_no_info();
}
}
else
{
$this->output .= $this->html->top_poster_no_info();
}
$this->output .= $this->html->top_poster_footer( $std->do_number_format($todays_posts['count']) );
$this->output .= $this->html->top_poster_footer();
$this->page_title = $ibforums->lang['top_poster_title'];
@@ -474,7 +532,7 @@ class stats {
//------------------------------------------------------------------------------------------------
//-----------------------------------------
function parse_member( $member )
{
@@ -544,9 +602,4 @@ class stats {
}
?>
?>
+261 -244
View File
@@ -1,244 +1,261 @@
<?php
/*
+--------------------------------------------------------------------------
| Invision Power Board v1.3.1 Final
| ========================================
| by Matthew Mecham
| (c) 2001 - 2003 Invision Power Services
| http://www.invisionpower.com
| ========================================
| Web: http://www.invisionboard.com
| Time: Thu, 23 Sep 2004 23:05:01 GMT
| Release: 3cb325c445e1909182084806ae7f8226
| Email: matt@invisionpower.com
| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
|
| > Topic Tracker module
| > Module written by Matt Mecham
| > Date started: 5th March 2002
|
| > Module Version Number: 1.0.0
+--------------------------------------------------------------------------
*/
$idx = new tracker;
class tracker {
var $output = "";
var $base_url = "";
var $html = "";
var $forum = array();
var $topic = array();
var $category = array();
var $type = 'topic';
function tracker($is_sub=0) {
//------------------------------------------------------
// $is_sub is a boolean operator.
// If set to 1, we don't show the "topic subscribed" page
// we simply end the subroutine and let the caller finish
// up for us.
//------------------------------------------------------
global $ibforums, $DB, $std, $print, $skin_universal;
$ibforums->lang = $std->load_words($ibforums->lang, 'lang_emails', $ibforums->lang_id);
//------------------------------------------------------
// Check the input
//------------------------------------------------------
if ($ibforums->input['type'] == 'forum')
{
$this->type = 'forum';
}
$ibforums->input['t'] = intval($ibforums->input['t']);
$ibforums->input['f'] = intval($ibforums->input['f']);
//------------------------------------------------------
// Get the forum info based on the forum ID, get the category name, ID, and get the topic details
//------------------------------------------------------
if ($this->type == 'forum')
{
$DB->query("SELECT f.id as fid, f.read_perms, f.password FROM ibf_forums f WHERE f.id='".$ibforums->input['f']."'");
}
else
{
$DB->query("SELECT t.tid, f.id as fid, f.read_perms, f.password FROM ibf_topics t, ibf_forums f WHERE t.tid='".$ibforums->input['t']."' AND t.forum_id=f.id");
}
$this->topic = $DB->fetch_row();
//------------------------------------------------------
// Error out if we can not find the forum
//------------------------------------------------------
if (!$this->topic['fid'])
{
if ($is_sub != 1)
{
$std->Error( array( LEVEL => 1, MSG => 'missing_files') );
}
else
{
return;
}
}
//------------------------------------------------------
// Error out if we can not find the topic
//------------------------------------------------------
if ($this->type != 'forum')
{
if (!$this->topic['tid'])
{
if ($is_sub != 1)
{
$std->Error( array( LEVEL => 1, MSG => 'missing_files') );
}
else
{
return;
}
}
}
$this->base_url = "{$ibforums->vars['board_url']}/index.{$ibforums->vars['php_ext']}?s={$ibforums->session_id}";
$this->base_url_NS = "{$ibforums->vars['board_url']}/index.{$ibforums->vars['php_ext']}";
//------------------------------------------------------
// Check viewing permissions, private forums,
// password forums, etc
//------------------------------------------------------
if (! $ibforums->member['id'] )
{
if ($is_sub != 1)
{
$std->Error( array( LEVEL => 1, MSG => 'no_guests') );
}
else
{
return;
}
}
if ( $std->check_perms($this->topic['read_perms']) != TRUE )
{
if ($is_sub != 1)
{
$std->Error( array( LEVEL => 1, MSG => 'forum_no_access') );
}
else
{
return;
}
}
if ($this->topic['password'] != "")
{
if ( ! $c_pass = $std->my_getcookie('iBForum'.$this->topic['fid']) )
{
$std->Error( array( LEVEL => 1, MSG => 'forum_no_access') );
}
if ( $c_pass != $this->topic['password'] )
{
$std->Error( array( LEVEL => 1, MSG => 'forum_no_access') );
}
}
//------------------------------------------------------
// Have we already subscribed?
//------------------------------------------------------
if ($this->type == 'forum')
{
$DB->query("SELECT frid from ibf_forum_tracker WHERE forum_id='".$this->topic['fid']."' AND member_id='".$ibforums->member['id']."'");
}
else
{
$DB->query("SELECT trid from ibf_tracker WHERE topic_id='".$this->topic['tid']."' AND member_id='".$ibforums->member['id']."'");
}
if ( $DB->get_num_rows() )
{
if ($is_sub != 1)
{
$std->Error( array( LEVEL => 1, MSG => 'already_sub') );
}
else
{
return;
}
}
//------------------------------------------------------
// Add it to the DB
//------------------------------------------------------
if ($this->type == 'forum')
{
$db_string = $DB->compile_db_insert_string( array (
'member_id' => $ibforums->member['id'],
'forum_id' => $this->topic['fid'],
'start_date' => time(),
) );
$DB->query("INSERT INTO ibf_forum_tracker (" .$db_string['FIELD_NAMES']. ") VALUES (". $db_string['FIELD_VALUES'] .")");
}
else
{
$db_string = $DB->compile_db_insert_string( array (
'member_id' => $ibforums->member['id'],
'topic_id' => $this->topic['tid'],
'start_date' => time(),
) );
$DB->query("INSERT INTO ibf_tracker (" .$db_string['FIELD_NAMES']. ") VALUES (". $db_string['FIELD_VALUES'] .")");
}
if ($is_sub != 1)
{
if ($this->type == 'forum')
{
$print->redirect_screen( $ibforums->lang['sub_added'], "act=SF&f={$this->topic['fid']}" );
}
else
{
$print->redirect_screen( $ibforums->lang['sub_added'], "act=ST&f={$this->topic['fid']}&t={$this->topic['tid']}&st={$ibforums->input['st']}" );
}
}
else
{
return;
}
}
}
?>
<?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
+---------------------------------------------------------------------------
|
| > Topic Tracker module
| > Module written by Matt Mecham
| > Date started: 5th March 2002
|
| > Module Version Number: 1.0.0
| > DBA Checked: Mon 24th 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 tracker {
var $output = "";
var $base_url = "";
var $html = "";
var $forum = array();
var $topic = array();
var $category = array();
var $type = 'topic';
var $method = 'delayed';
function auto_run($is_sub=0)
{
//-----------------------------------------
// $is_sub is a boolean operator.
// If set to 1, we don't show the "topic subscribed" page
// we simply end the subroutine and let the caller finish
// up for us.
//-----------------------------------------
global $ibforums, $DB, $std, $print, $forums;
$ibforums->lang = $std->load_words($ibforums->lang, 'lang_emails', $ibforums->lang_id);
//-----------------------------------------
// Check the input
//-----------------------------------------
if ($ibforums->input['type'] == 'forum')
{
$this->type = 'forum';
}
//-----------------------------------------
// Method..
//-----------------------------------------
switch ($ibforums->input['method'])
{
case 'immediate':
$this->method = 'immediate';
break;
case 'delayed':
$this->method = 'delayed';
break;
case 'none':
$this->method = 'none';
break;
case 'daily':
$this->method = 'daily';
break;
case 'weekly':
$this->method = 'weekly';
break;
default:
$this->method = 'delayed';
break;
}
$ibforums->input['t'] = intval($ibforums->input['t']);
$ibforums->input['f'] = intval($ibforums->input['f']);
//-----------------------------------------
// Get the forum info based on the forum ID, get the category name, ID, and get the topic details
//-----------------------------------------
if ($this->type == 'forum')
{
$this->topic = $forums->forum_by_id[ $ibforums->input['f'] ];
}
else
{
$row = $DB->simple_exec_query( array( 'select' => 'tid, forum_id', 'from' => 'topics', 'where' => 'tid='.$ibforums->input['t'] ) );
$this->topic = array_merge( $row, $forums->forum_by_id[ $ibforums->input['f'] ] );
}
//-----------------------------------------
// Error out if we can not find the forum
//-----------------------------------------
if ( ! $forums->forum_by_id[ $ibforums->input['f'] ] )
{
if ($is_sub != 1)
{
$std->Error( array( LEVEL => 1, MSG => 'missing_files') );
}
else
{
return;
}
}
//-----------------------------------------
// Error out if we can not find the topic
//-----------------------------------------
if ($this->type != 'forum')
{
if ( ! $this->topic['tid'] )
{
if ($is_sub != 1)
{
$std->Error( array( LEVEL => 1, MSG => 'missing_files') );
}
else
{
return;
}
}
}
$this->base_url = "{$ibforums->vars['board_url']}/index.{$ibforums->vars['php_ext']}?s={$ibforums->session_id}";
$this->base_url_NS = "{$ibforums->vars['board_url']}/index.{$ibforums->vars['php_ext']}";
//-----------------------------------------
// Check viewing permissions, private forums,
// password forums, etc
//-----------------------------------------
if (! $ibforums->member['id'] )
{
if ($is_sub != 1)
{
$std->Error( array( LEVEL => 1, MSG => 'no_guests') );
}
else
{
return;
}
}
if ( $std->check_perms( $forums->forum_by_id[ $ibforums->input['f'] ]['read_perms'] ) != TRUE )
{
if ($is_sub != 1)
{
$std->Error( array( LEVEL => 1, MSG => 'forum_no_access') );
}
else
{
return;
}
}
if ($this->topic['password'] != "")
{
if ( $forums->forums_compare_password($this->topic['fid']) != TRUE )
{
$std->Error( array( LEVEL => 1, MSG => 'forum_no_access') );
}
}
//-----------------------------------------
// Have we already subscribed?
//-----------------------------------------
if ($this->type == 'forum')
{
$DB->simple_construct( array( 'select' => 'frid',
'from' => 'forum_tracker',
'where' => "forum_id='".$this->topic['id']."' AND member_id='".$ibforums->member['id']."'" ) );
$DB->simple_exec();
}
else
{
$DB->simple_construct( array( 'select' => 'trid',
'from' => 'tracker',
'where' => "topic_id='".$this->topic['tid']."' AND member_id='".$ibforums->member['id']."'" ) );
$DB->simple_exec();
}
if ( $DB->get_num_rows() )
{
if ($is_sub != 1)
{
$std->Error( array( LEVEL => 1, MSG => 'already_sub') );
}
else
{
return;
}
}
//-----------------------------------------
// Add it to the DB
//-----------------------------------------
if ($this->type == 'forum')
{
$DB->do_insert( 'forum_tracker', array (
'member_id' => $ibforums->member['id'],
'forum_id' => $ibforums->input['f'],
'start_date' => time(),
'forum_track_type' => $this->method,
) );
}
else
{
$DB->do_insert( 'tracker', array (
'member_id' => $ibforums->member['id'],
'topic_id' => $this->topic['tid'],
'start_date' => time(),
'topic_track_type' => $this->method,
) );
}
if ($is_sub != 1)
{
if ($this->type == 'forum')
{
$print->redirect_screen( $ibforums->lang['sub_added'], "act=SF&f={$this->topic['id']}" );
}
else
{
$print->redirect_screen( $ibforums->lang['sub_added'], "act=ST&f={$this->topic['id']}&t={$this->topic['tid']}&st={$ibforums->input['st']}" );
}
}
else
{
return;
}
}
}
?>
+113 -143
View File
@@ -2,16 +2,15 @@
/*
+--------------------------------------------------------------------------
| Invision Power Board v1.3.1 Final
| ========================================
| Invision Power Board v2.0.0
| =============================================
| by Matthew Mecham
| (c) 2001 - 2003 Invision Power Services
| (c) 2001 - 2004 Invision Power Services, Inc.
| http://www.invisionpower.com
| ========================================
| =============================================
| Web: http://www.invisionboard.com
| Time: Thu, 23 Sep 2004 23:05:01 GMT
| Release: 3cb325c445e1909182084806ae7f8226
| Email: matt@invisionpower.com
| Time: Tue, 21 Sep 2004 16:34:28 GMT
| Release: 150aa7a702c3c8b6f6eb90ad49305d2f
| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
|
@@ -20,11 +19,16 @@
| > Date started: 16th May 2003
|
| > Module Version Number: 1.0.0
| > DBA Checked: Mon 24th May 2004
+--------------------------------------------------------------------------
*/
$idx = new warn;
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 warn {
@@ -46,17 +50,17 @@ class warn {
var $warn_member = "";
//------------------------------------------------------
//-----------------------------------------
// @constructor (no, not bob the builder)
//------------------------------------------------------
//-----------------------------------------
function warn()
function auto_run()
{
global $ibforums, $DB, $std, $print;
global $ibforums, $DB, $std, $print;
//-------------------------------------
//-----------------------------------------
// Load modules...
//-------------------------------------
//-----------------------------------------
$ibforums->lang = $std->load_words($ibforums->lang, 'lang_mod', $ibforums->lang_id);
@@ -64,11 +68,11 @@ class warn {
require( ROOT_PATH.'sources/lib/post_parser.php');
$this->parser = new post_parser(1);
$this->parser = new post_parser();
//-------------------------------------
//-----------------------------------------
// Make sure we're a moderator...
//-------------------------------------
//-----------------------------------------
$pass = 0;
@@ -94,16 +98,24 @@ class warn {
}
else if ($ibforums->member['is_mod'])
{
$DB->query("SELECT * FROM ibf_moderators WHERE (member_id='".$ibforums->member['id']."' OR (is_group=1 AND group_id='".$ibforums->member['mgroup']."'))");
$DB->simple_construct( array( 'select' => '*',
'from' => 'moderators',
'where' => "(member_id='".$ibforums->member['id']."' OR (is_group=1 AND group_id='".$ibforums->member['mgroup']."'))" ) );
$DB->simple_exec();
if ( $this->moderator = $DB->fetch_row() )
{
$pass = 1;
$this->can_ban = $ibforums->vars['warn_mod_ban'];
$this->can_mod_q = $ibforums->vars['warn_mod_modq'];
$this->can_rem_post = $ibforums->vars['warn_mod_post'];
$this->times_a_day = intval($ibforums->vars['warn_mod_day']);
$this->type = 'mod';
if ( $this->moderator['allow_warn'] )
{
$pass = 1;
$this->can_ban = $ibforums->vars['warn_mod_ban'];
$this->can_mod_q = $ibforums->vars['warn_mod_modq'];
$this->can_rem_post = $ibforums->vars['warn_mod_post'];
$this->times_a_day = intval($ibforums->vars['warn_mod_day']);
$this->type = 'mod';
}
}
}
else if ( $ibforums->vars['warn_show_own'] and $ibforums->member['id'] == $ibforums->input['mid'] )
@@ -131,9 +143,9 @@ class warn {
$std->Error( array( LEVEL => 1, MSG => 'no_permission') );
}
//-------------------------------------
//-----------------------------------------
// Ensure we have a valid member id
//-------------------------------------
//-----------------------------------------
$mid = intval($ibforums->input['mid']);
@@ -142,10 +154,9 @@ class warn {
$std->Error( array( LEVEL => 1, MSG => 'no_such_user') );
}
$DB->query("SELECT m.*, g.* FROM ibf_members m
LEFT JOIN ibf_groups g on (m.mgroup=g.g_id)
WHERE id=$mid");
$DB->cache_add_query( 'generic_get_all_member', array( 'mid' => $mid ) );
$DB->cache_exec_query();
$this->warn_member = $DB->fetch_row();
if ( ! $this->warn_member['id'] )
@@ -153,27 +164,27 @@ class warn {
$std->Error( array( LEVEL => 1, MSG => 'no_such_user') );
}
if ( $ibforums->input['CODE'] == "" OR $ibforums->input['CODE'] == "dowarn" )
{
//-------------------------------------
//-----------------------------------------
// Protected member? Really? o_O
//-------------------------------------
//-----------------------------------------
if ( stristr( $ibforums->vars['warn_protected'], ','.$this->warn_member['mgroup'].',' ) )
if ( strstr( ','.$ibforums->vars['warn_protected'].',', ','.$this->warn_member['mgroup'].',' ) )
{
$std->Error( array( LEVEL => 1, MSG => 'protected_user') );
}
//-------------------------------------
//-----------------------------------------
// I've already warned you!!
//-------------------------------------
//-----------------------------------------
if ( $this->times_a_day > 0 )
{
$time_to_check = time() - 86400;
$DB->query("SELECT * FROM ibf_warn_logs WHERE wlog_mid={$this->warn_member['id']} AND wlog_date > $time_to_check");
$DB->simple_construct( array( 'select' => '*', 'from' => 'warn_logs', 'where' => "wlog_mid={$this->warn_member['id']} AND wlog_date > $time_to_check" ) );
$DB->simple_exec();
if ( $DB->get_num_rows() >= $this->times_a_day )
{
@@ -182,12 +193,12 @@ class warn {
}
}
//-------------------------------------
//-----------------------------------------
// Bouncy, bouncy!
//-------------------------------------
//-----------------------------------------
switch ($ibforums->input['CODE']) {
switch ($ibforums->input['CODE'])
{
case 'dowarn':
$this->do_warn();
break;
@@ -218,17 +229,17 @@ class warn {
//-------------------------------------------------
//-----------------------------------------
// Show logs
//-------------------------------------------------
//-----------------------------------------
function view_log()
{
global $std, $ibforums, $DB, $print;
//-------------------------------------
//-----------------------------------------
// Protected member? Really? o_O
//-------------------------------------
//-----------------------------------------
if ( stristr( $ibforums->vars['warn_protected'], ','.$this->warn_member['mgroup'].',' ) )
{
@@ -239,7 +250,8 @@ class warn {
$start = intval($ibforums->input['st']);
$DB->query("SELECT count(*) as cnt FROM ibf_warn_logs WHERE wlog_mid={$this->warn_member['id']}");
$DB->simple_construct( array( 'select' => 'count(*) as cnt', 'from' => 'warn_logs', 'where' => "wlog_mid={$this->warn_member['id']}" ) );
$DB->simple_exec();
$row = $DB->fetch_row();
@@ -260,11 +272,9 @@ class warn {
}
else
{
$DB->query("SELECT l.*, p.id as punisher_id, p.name as punisher_name
FROM ibf_warn_logs l
LEFT JOIN ibf_members p ON ( p.id=l.wlog_addedby )
WHERE l.wlog_mid={$this->warn_member['id']} ORDER BY l.wlog_date DESC LIMIT $start, $perpage");
$DB->cache_add_query( 'warn_get_data', array( 'mid' => $this->warn_member['id'], 'limit_a' => $start, 'limit_b' => $perpage ) );
$DB->cache_exec_query();
while ( $r = $DB->fetch_row() )
{
$date = $std->get_date( $r['wlog_date'], 'LONG' );
@@ -301,15 +311,15 @@ class warn {
//-------------------------------------------------
//-----------------------------------------
// Do the actual warny-e-poos
//-------------------------------------------------
//-----------------------------------------
function do_warn()
{
global $std, $ibforums, $DB, $print;
require "./sources/lib/emailer.php";
require "./sources/classes/class_email.php";
$this->email = new emailer();
$save = array();
@@ -349,18 +359,18 @@ class warn {
}
}
//-------------------------------------------------
//-----------------------------------------
// Check security fang
//-------------------------------------------------
//-----------------------------------------
if ( $ibforums->input['key'] != $std->return_md5_check() )
{
$std->Error( array( LEVEL => '1', MSG => 'del_post') );
}
//-------------------------------------------------
//-----------------------------------------
// As Celine Dion once squawked, "Show me the reason"
//-------------------------------------------------
//-----------------------------------------
if ( trim($ibforums->input['reason']) == "" )
{
@@ -368,16 +378,16 @@ class warn {
return;
}
//-------------------------------------------------
//-----------------------------------------
// Plussy - minussy?
//-------------------------------------------------
//-----------------------------------------
$save['wlog_type'] = ( $ibforums->input['level'] == 'add' ) ? 'neg' : 'pos';
$save['wlog_date'] = time();
//-------------------------------------------------
//-----------------------------------------
// Contacting the member?
//-------------------------------------------------
//-----------------------------------------
if ( $ibforums->input['contact'] != "" )
{
@@ -392,9 +402,9 @@ class warn {
if ( $ibforums->input['contactmethod'] == 'email' )
{
//----------------------------------
//-----------------------------------------
// Send the email
//----------------------------------
//-----------------------------------------
$this->email->get_template("email_member");
@@ -412,71 +422,34 @@ class warn {
}
else
{
//----------------------------------
//-----------------------------------------
// PM :o
//----------------------------------
//-----------------------------------------
$show_popup = $this->warn_member['view_pop'];
require_once( ROOT_PATH.'sources/lib/msg_functions.php' );
$this->lib = new msg_functions();
$this->lib->init();
$this->lib->to_by_id = $this->warn_member['id'];
$this->lib->from_member = $ibforums->member;
$this->lib->msg_title = $ibforums->input['subject'];
$this->lib->msg_post = $std->remove_tags($ibforums->input['contact']);
$this->lib->force_pm = 1;
//--------------------------------------
// Enter the info into the DB
// Target user side.
//--------------------------------------
$this->lib->send_pm();
$db_string = $std->compile_db_string( array(
'member_id' => $this->warn_member['id'],
'msg_date' => time(),
'read_state' => '0',
'title' => $ibforums->input['subject'],
'message' => $std->remove_tags($ibforums->input['contact']),
'from_id' => $ibforums->member['id'],
'vid' => 'in',
'recipient_id' => $this->warn_member['id'],
'tracking' => 0,
) );
$DB->query("INSERT INTO ibf_messages (" .$db_string['FIELD_NAMES']. ") VALUES (". $db_string['FIELD_VALUES'] .")");
$new_id = $DB->get_insert_id();
unset($db_string);
//-----------------------------------------------------
$DB->query("UPDATE ibf_members SET ".
"msg_total = msg_total + 1, " .
"new_msg = new_msg + 1, " .
"msg_from_id='" . $ibforums->member['id'] . "', ".
"msg_msg_id='" . $new_id . "', ".
"show_popup='" . $show_popup . "' ".
"WHERE id='" . $this->warn_member['id'] . "'");
//-----------------------------------------------------
// Has this member requested a PM email nofity?
//-----------------------------------------------------
if ($this->warn_member['email_pm'] == 1)
if ( $this->lib->error )
{
$this->warn_member['language'] = $this->warn_member['language'] == "" ? 'en' : $this->warn_member['language'];
$this->email->get_template("pm_notify", $this->warn_member['language']);
$this->email->build_message( array(
'NAME' => $this->warn_member['name'],
'POSTER' => $ibforums->member['name'],
'TITLE' => $ibforums->input['subject'],
'LINK' => "?act=Msg&CODE=03&VID=in&MSID=$new_id",
)
);
$this->email->subject = $ibforums->lang['pm_email_subject'];
$this->email->to = $this->warn_member['email'];
$this->email->send_mail();
print $this->error;
exit();
}
}
}
//-------------------------------------------------
//-----------------------------------------
// Right - is we banned or wha?
//-------------------------------------------------
//-----------------------------------------
$restrict_post = '';
$mod_queue = '';
@@ -514,17 +487,15 @@ class warn {
$save['wlog_mid'] = $this->warn_member['id'];
$save['wlog_addedby'] = $ibforums->member['id'];
//-------------------------------------------------
//-----------------------------------------
// Enter into warn loggy poos (eeew - poo)
//-------------------------------------------------
//-----------------------------------------
$dbs = $DB->compile_db_insert_string( $save );
$DB->do_insert( 'warn_logs', $save );
$DB->query("INSERT INTO ibf_warn_logs ({$dbs['FIELD_NAMES']}) VALUES({$dbs['FIELD_VALUES']})");
//-------------------------------------------------
//-----------------------------------------
// Update member
//-------------------------------------------------
//-----------------------------------------
$warn_level = intval($this->warn_member['warn_level']);
@@ -544,22 +515,20 @@ class warn {
if ( $warn_level < 1 )
{
$warn_level == 0;
$warn_level = 0;
}
$dbs = $DB->compile_db_update_string( array (
'mod_posts' => $mod_queue,
'restrict_post' => $restrict_post,
'temp_ban' => $susp,
'warn_level' => $warn_level,
'warn_lastwarn' => time(),
) );
$DB->do_update( 'members', array (
'mod_posts' => $mod_queue,
'restrict_post' => $restrict_post,
'temp_ban' => $susp,
'warn_level' => $warn_level,
'warn_lastwarn' => time(),
) , "id={$this->warn_member['id']}" );
$DB->query("UPDATE ibf_members SET $dbs WHERE id={$this->warn_member['id']}");
//-------------------------------------------------
//-----------------------------------------
// Now what? Show success screen, that's what!!
//-------------------------------------------------
//-----------------------------------------
$ibforums->lang['w_done_te'] = sprintf( $ibforums->lang['w_done_te'], $this->warn_member['name'] );
@@ -571,17 +540,18 @@ class warn {
if ( $tid > 0 )
{
$DB->query("SELECT t.tid, t.title, f.id, f.name FROM ibf_topics t, ibf_forums f WHERE tid=$tid AND t.forum_id=f.id");
$DB->cache_add_query( 'warn_get_forum', array( 'tid' => $tid ) );
$DB->cache_exec_query();
$topic = $DB->fetch_row();
$this->output = str_replace( "<!--IBF.FORUM_TOPIC-->", $this->html->warn_success_forum( $topic['id'], $topic['name'], $topic['tid'], $topic['title'], intval($ibforums->input['st']) ), $this->output );
}
}
//-------------------------------------------------
//-----------------------------------------
// Show form
//-------------------------------------------------
//-----------------------------------------
function show_form($errors="")
{