Version 1.3.0

This commit is contained in:
Neo committed 2025-12-19 00:17:06 -08:00
1 parent 7ef3d1712a
commit f87d29ba65
290 files changed
+50206 -17930

No files matched your search

+430 -137
View File
@@ -2,15 +2,17 @@
/*
+--------------------------------------------------------------------------
| Invision Board v1.1
| Invision Power Board v1.3 Final
| ========================================
| by Matthew Mecham
| (c) 2001,2002 Invision Power Services
| http://www.ibforums.com
| (c) 2001 - 2003 Invision Power Services
| http://www.invisionpower.com
| ========================================
| Web: http://www.ibforums.com
| Email: phpboards@ibforums.com
| Licence Info: phpib-licence@ibforums.com
| Web: http://www.invisionboard.com
| Time: Sun, 04 Jan 2004 00:30:16 GMT
| Release: 28e7bfb25f08ac72a789cb1b172fa185
| Email: matt@invisionpower.com
| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
|
| > ICQ / AIM / EMAIL functions
@@ -36,6 +38,9 @@ class Contact {
var $forum = "";
var $email = "";
var $int_error = "";
var $int_extra = "";
/***********************************************************************************/
//
// Our constructor, load words, load skin
@@ -56,6 +61,9 @@ class Contact {
case 'AOL':
$this->show_aim();
break;
case 'integ':
$this->show_integ();
break;
case 'ICQ':
$this->show_icq();
break;
@@ -68,6 +76,10 @@ class Contact {
case 'Invite':
$this->invite_member();
break;
case 'chat':
$this->chat_display();
break;
case 'report':
if ($ibforums->input['send'] != 1)
@@ -79,6 +91,10 @@ class Contact {
$this->send_report();
}
break;
case 'boardrules':
$this->board_rules();
break;
default:
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'invalid_use' ) );
@@ -90,6 +106,143 @@ class Contact {
}
//****************************************************************/
// INTEGRITY MESSENGER
//
//****************************************************************/
function show_integ()
{
global $ibforums, $DB, $std, $print;
//----------------------------------
if (empty($ibforums->member['id']))
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'no_guests' ) );
}
if ( empty($ibforums->input['MID']) )
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'invalid_use' ) );
}
//----------------------------------
if (! preg_match( "/^(\d+)$/" , $ibforums->input['MID'] ) )
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'invalid_use' ) );
}
//----------------------------------
$DB->query("SELECT name, id, integ_msg from ibf_members WHERE id='".$ibforums->input['MID']."'");
$member = $DB->fetch_row();
//----------------------------------
if (! $member['id'] )
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'no_such_user' ) );
}
//----------------------------------
if (! $member['integ_msg'] )
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'no_integ' ) );
}
//----------------------------------
$std->boink_it( "http://www.integritymessenger.com/WebIM/send.php?to=".urlencode($member['integ_msg']) );
exit();
}
//****************************************************************/
// BOARD RULES
//
//****************************************************************/
function board_rules()
{
global $ibforums, $DB, $std, $print;
$ibforums->lang = $std->load_words($ibforums->lang, 'lang_emails', $ibforums->lang_id );
$this->html = $std->load_template('skin_emails');
$DB->query("SELECT * FROM ibf_cache_store WHERE cs_key='boardrules'");
$row = $DB->fetch_row();
$row['cs_value'] = $std->my_nl2br(stripslashes($row['cs_value']));
$this->nav[] = $ibforums->vars['gl_title'];
$this->page_title = $ibforums->vars['gl_title'];
$this->output .= $this->html->board_rules( $ibforums->vars['gl_title'],$row['cs_value'] );
}
//****************************************************************/
// IP CHAT:
//
//****************************************************************/
function chat_display()
{
global $ibforums, $DB, $std, $print;
$ibforums->lang = $std->load_words($ibforums->lang, 'lang_emails', $ibforums->lang_id );
$this->html = $std->load_template('skin_emails');
if ( ! $ibforums->vars['chat_account_no'] )
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'missing_files') );
}
$width = $ibforums->vars['chat_width'] ? $ibforums->vars['chat_width'] : 600;
$height = $ibforums->vars['chat_height'] ? $ibforums->vars['chat_height'] : 350;
$lang = $ibforums->vars['chat_language'] ? $ibforums->vars['chat_language'] : 'en';
$user = "";
$pass = "";
if ( $ibforums->member['id'] )
{
$user = $ibforums->member['name'];
$pass = $ibforums->member['password'];
}
if ( $ibforums->input['pop'] )
{
$html = $this->html->chat_pop( $ibforums->vars['chat_account_no'], $lang, $width, $height, $user, $pass );
$print->pop_up_window( "CHAT", $html );
exit();
}
else
{
$this->output .= $this->html->chat_inline( $ibforums->vars['chat_account_no'], $lang, $width, $height, $user, $pass);
}
$this->nav[] = $ibforums->lang['live_chat'];
$this->page_title = $ibforums->lang['live_chat'];
}
//****************************************************************/
@@ -98,7 +251,8 @@ class Contact {
//****************************************************************/
function report_form() {
function report_form()
{
global $ibforums, $DB, $std, $print;
$ibforums->lang = $std->load_words($ibforums->lang, 'lang_emails', $ibforums->lang_id );
@@ -121,8 +275,8 @@ class Contact {
$this->output .= $this->html->report_form($fid, $tid, $pid, $st, $this->forum['topic_title']);
$this->nav[] = "<a href='".$ibforums->base_url."&act=SC&c={$this->forum['cat_id']}'>{$this->forum['cat_name']}</a>";
$this->nav[] = "<a href='".$ibforums->base_url."&act=SF&f={$this->forum['id']}'>{$this->forum['name']}</a>";
$this->nav[] = "<a href='".$ibforums->base_url."act=SC&c={$this->forum['cat_id']}'>{$this->forum['cat_name']}</a>";
$this->nav[] = "<a href='".$ibforums->base_url."act=SF&f={$this->forum['id']}'>{$this->forum['name']}</a>";
$this->nav[] = $ibforums->lang['report_title'];
$this->page_title = $ibforums->lang['report_title'];
@@ -271,11 +425,7 @@ class Contact {
$return = 1;
if ($this->forum['read_perms'] == '*')
{
$return = 0;
}
else if (preg_match( "/(^|,)".$ibforums->member['mgroup']."(,|$)/", $this->forum['read_perms'] ) )
if ( $std->check_perms($this->forum['read_perms']) == TRUE )
{
$return = 0;
}
@@ -552,8 +702,8 @@ class Contact {
// reading topics
//****************************************************************/
function mail_member() {
function mail_member()
{
global $ibforums, $DB, $std, $print;
require "./sources/lib/emailer.php";
@@ -561,9 +711,9 @@ class Contact {
//----------------------------------
$ibforums->lang = $std->load_words($ibforums->lang, 'lang_emails', $ibforums->lang_id );
$ibforums->lang = $std->load_words($ibforums->lang, 'lang_emails', $ibforums->lang_id );
$this->html = $std->load_template('skin_emails');
$this->html = $std->load_template('skin_emails');
//----------------------------------
@@ -572,143 +722,286 @@ class Contact {
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'no_guests' ) );
}
if ( ! $ibforums->member['g_email_friend'] )
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'no_member_mail' ) );
}
//----------------------------------
if ($ibforums->input['CODE'] == '01')
{
// Send the email, yippee
if ( empty($ibforums->input['to']) )
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'invalid_use' ) );
}
//----------------------------------
if (! preg_match( "/^(\d+)$/" , $ibforums->input['to'] ) )
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'invalid_use' ) );
}
//----------------------------------
$DB->query("SELECT name, id, email, hide_email from ibf_members WHERE id='".$ibforums->input['to']."'");
$member = $DB->fetch_row();
//----------------------------------
if (! $member['id'] )
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'no_such_user' ) );
}
/*if ($member['id'] == 1)
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'private_email' ) );
}*/
//----------------------------------
$check_array = array (
'message' => 'no_message',
'subject' => 'no_subject'
);
foreach ($check_array as $input => $msg)
{
if (empty($ibforums->input[$input]))
{
$std->Error( array( LEVEL => 1, MSG => $msg) );
}
}
$this->email->get_template("email_member");
$this->email->build_message( array(
'MESSAGE' => $ibforums->input['message'],
'MEMBER_NAME' => $member['name'],
'FROM_NAME' => $ibforums->member['name']
)
);
$this->email->subject = $ibforums->input['subject'];
$this->email->to = $member['email'];
$this->email->from = $ibforums->member['email'];
$this->email->send_mail();
$forum_jump = $std->build_forum_jump();
$forum_jump = preg_replace( "!#Forum Jump#!", $ibforums->lang['forum_jump'], $forum_jump);
$this->output = $this->html->sent_screen($member['name']);
$this->output .= $this->html->forum_jump($forum_jump);
$this->page_title = $ibforums->lang['email_sent'];
$this->nav = array( $ibforums->lang['email_sent'] );
$this->mail_member_send();
}
else
{
// Show the form, booo...
if ( empty($ibforums->input['MID']) )
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'invalid_use' ) );
}
//----------------------------------
if (! preg_match( "/^(\d+)$/" , $ibforums->input['MID'] ) )
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'invalid_use' ) );
}
//----------------------------------
$DB->query("SELECT name, id, email, hide_email from ibf_members WHERE id='".$ibforums->input['MID']."'");
$member = $DB->fetch_row();
//----------------------------------
if (! $member['id'] )
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'no_such_user' ) );
}
if ($member['hide_email'] == 1)
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'private_email' ) );
}
//----------------------------------
$this->output = $ibforums->vars['use_mail_form']
? $this->html->send_form(
array(
'NAME' => $member['name'],
'TO' => $member['id'],
)
)
: $this->html->show_address(
array(
'NAME' => $member['name'],
'ADDRESS' => $member['email'],
)
);
$this->page_title = $ibforums->lang['member_address_title'];
$this->nav = array( $ibforums->lang['member_address_title'] );
$this->mail_member_form();
}
}
function mail_member_form($errors="", $extra = "")
{
global $ibforums, $DB, $std, $print, $HTTP_POST_VARS;
$ibforums->input['MID'] = intval($ibforums->input['MID']);
if ( $ibforums->input['MID'] < 1 )
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'invalid_use' ) );
}
//----------------------------------
$DB->query("SELECT name, id, email, hide_email from ibf_members WHERE id=".$ibforums->input['MID']);
$member = $DB->fetch_row();
//----------------------------------
if (! $member['id'] )
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'no_such_user' ) );
}
if ($member['hide_email'] == 1)
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'private_email' ) );
}
//----------------------------------
if ( $errors != "" )
{
$msg = $ibforums->lang[$errors];
if ( $extra != "" )
{
$msg = str_replace( "<#EXTRA#>", $extra, $msg );
}
$this->output .= $this->html->errors( $msg );
}
//----------------------------------
$this->output .= $ibforums->vars['use_mail_form']
? $this->html->send_form(
array(
'NAME' => $member['name'],
'TO' => $member['id'],
'subject'=> $ibforums->input['subject'],
'content'=> stripslashes(htmlentities($HTTP_POST_VARS['message'])),
)
)
: $this->html->show_address(
array(
'NAME' => $member['name'],
'ADDRESS' => $member['email'],
)
);
$this->page_title = $ibforums->lang['member_address_title'];
$this->nav = array( $ibforums->lang['member_address_title'] );
}
//----------------------------------
function mail_member_send()
{
global $ibforums, $DB, $std, $print;
$ibforums->input['to'] = intval($ibforums->input['to']);
if ( $ibforums->input['to'] == 0 )
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'invalid_use' ) );
}
//----------------------------------
$DB->query("SELECT name, id, email, hide_email from ibf_members WHERE id=".$ibforums->input['to']);
$member = $DB->fetch_row();
//----------------------------------
// Check for schtuff
//----------------------------------
if (! $member['id'] )
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'no_such_user' ) );
}
//----------------------------------
if ($member['hide_email'] == 1)
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'private_email' ) );
}
//----------------------------------
// Check for blanks
//----------------------------------
$check_array = array (
'message' => 'no_message',
'subject' => 'no_subject'
);
foreach ($check_array as $input => $msg)
{
if (empty($ibforums->input[$input]))
{
$ibforums->input['MID'] = $ibforums->input['to'];
$this->mail_member_form($msg);
return;
}
}
//----------------------------------
// Check for spam / delays
//----------------------------------
$email_check = $this->_allow_to_email( $ibforums->member['id'], $ibforums->member['g_email_limit'] );
if ( $email_check != TRUE )
{
$ibforums->input['MID'] = $ibforums->input['to'];
$this->mail_member_form( $this->int_error, $this->int_extra);
return;
}
//----------------------------------
// Send the email
//----------------------------------
$this->email->get_template("email_member");
$this->email->build_message( array(
'MESSAGE' => str_replace( "<br>", "\n", str_replace( "\r", "", $ibforums->input['message'] ) ),
'MEMBER_NAME' => $member['name'],
'FROM_NAME' => $ibforums->member['name']
)
);
$this->email->subject = $ibforums->input['subject'];
$this->email->to = $member['email'];
$this->email->from = $ibforums->member['email'];
$this->email->send_mail();
//----------------------------------
// Store email in the database
//----------------------------------
$dbs = array(
'email_subject' => $ibforums->input['subject'],
'email_content' => $ibforums->input['message'],
'email_date' => time(),
'from_member_id' => $ibforums->member['id'],
'from_email_address' => $ibforums->member['email'],
'from_ip_address' => $ibforums->input['IP_ADDRESS'],
'to_member_id' => $member['id'],
'to_email_address' => $member['email'],
);
$db_string = $DB->compile_db_insert_string($dbs);
$DB->query("INSERT INTO ibf_email_logs ({$db_string['FIELD_NAMES']}) VALUES({$db_string['FIELD_VALUES']})");
//----------------------------------
// Print the success page
//----------------------------------
$forum_jump = $std->build_forum_jump();
$this->output = $this->html->sent_screen($member['name']);
$this->output .= $this->html->forum_jump($forum_jump);
$this->page_title = $ibforums->lang['email_sent'];
$this->nav = array( $ibforums->lang['email_sent'] );
}
//----------------------------------
// CHECK FLOOD LIMIT
// Returns TRUE if able to email
// FALSE if not
//----------------------------------
function _allow_to_email($member_id, $email_limit)
{
global $ibforums, $std, $DB;
$member_id = intval($member_id);
if ( ! $member_id )
{
$this->int_error = 'gen_error';
return FALSE;
}
list( $limit, $flood ) = explode( ':', $email_limit );
if ( ! $limit and ! $flood )
{
return TRUE;
}
//----------------------------------
// Get some stuff from the DB!
// 1) FLOOD?
//----------------------------------
if ( $flood )
{
$DB->query("SELECT * FROM ibf_email_logs WHERE from_member_id=$member_id ORDER BY email_date DESC LIMIT 0,1");
$last_email = $DB->fetch_row();
if ( $last_email['email_date'] + ($flood * 60) > time() )
{
$this->int_error = 'exceeded_flood';
$this->int_extra = $flood;
return FALSE;
}
}
if ( $limit )
{
$time_range = time() - 86400;
$DB->query("SELECT count(email_id) as cnt FROM ibf_email_logs WHERE from_member_id=$member_id AND email_date > $time_range");
$quota_sent = $DB->fetch_row();
if ( $quota_sent['cnt'] + 1 > $limit )
{
$this->int_error = 'exceeded_quota';
$this->int_extra = limit;
return FALSE;
}
}
return TRUE; //If we get here...
}
}
?>