Version 2.2.0 RC-1

This commit is contained in:
Neo committed 2025-12-19 00:22:37 -08:00
1 parent f73f8bff6d
commit 22f1b963ee
1034 files changed
+178610 -70897

No files matched your search

+259 -145
View File
@@ -2,27 +2,17 @@
/*
+--------------------------------------------------------------------------
| Invision Power Board 2.1.7
| Invision Power Board
| =============================================
| by Matthew Mecham
| (c) 2001 - 2005 Invision Power Services, Inc.
| (c) 2001 - 2006 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| http://www.ibresource.ru/products/invisionpowerboard/
| Time: Tuesday 18th of July 2006 05:56:00 PM
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
| Licence Info: http://www.invisionboard.com/?license
| http://www.ibresource.ru/license
+---------------------------------------------------------------------------
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
+---------------------------------------------------------------------------
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
+---------------------------------------------------------------------------
| > $Date: 2005-12-07 15:18:13 +0000 (Wed, 07 Dec 2005) $
| > $Revision: 95 $
| > $Date: 2006-10-03 21:04:14 +0100 (Tue, 03 Oct 2006) $
| > $Revision: 602 $
| > $Author: bfarber $
+---------------------------------------------------------------------------
|
@@ -38,7 +28,7 @@
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Íåêîððåêòíûé àäðåñ</h1>Âû íå èìååòå äîñòóïà ê ýòîìó ôàéëó íàïðÿìóþ. Åñëè âû íåäàâíî îáíîâëÿëè ôîðóì, âû äîëæíû îáíîâèòü âñå ñîîòâåòñòâóþùèå ôàéëû.";
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();
}
@@ -59,6 +49,7 @@ class messenger
var $to_mem = array();
var $jump_html = "";
var $show_form = 0;
var $vid = "in";
var $mem_groups = array();
@@ -66,7 +57,6 @@ class messenger
var $topiclib = "";
var $postlib = "";
var $parser = "";
var $cp_html = "";
@@ -83,27 +73,17 @@ class messenger
//-----------------------------------------
$this->ipsclass->load_language('lang_msg');
$this->ipsclass->load_language('lang_ucp');
$this->ipsclass->load_template('skin_msg');
$this->ipsclass->load_template('skin_ucp');
//-----------------------------------------
// Load classes
//-----------------------------------------
require_once( ROOT_PATH.'sources/lib/func_msg.php' );
require_once( ROOT_PATH."sources/lib/func_usercp.php" );
$this->msglib = new func_msg();
$this->msglib->ipsclass =& $this->ipsclass;
//-----------------------------------------
// INIT da func
//-----------------------------------------
$this->lib = new func_usercp($this);
$this->lib->ipsclass =& $this->ipsclass;
//-----------------------------------------
// Set up defaults
//-----------------------------------------
@@ -134,7 +114,7 @@ class messenger
// Print menu
//-----------------------------------------
$this->ipsclass->print->add_output( $this->lib->ucp_generate_menu() );
$this->ipsclass->print->add_output( $this->msglib->ucp_generate_menu() );
//-----------------------------------------
// What to do?
@@ -221,14 +201,14 @@ class messenger
// If we have any HTML to print, do so...
$fj = $this->ipsclass->build_forum_jump();
$fj = preg_replace( "!#Forum Jump#!", $this->ipsclass->lang['forum_jump'], $fj);
$fj = str_replace( "#Forum Jump#", $this->ipsclass->lang['forum_jump'], $fj);
$this->output .= $this->ipsclass->compiled_templates['skin_ucp']->CP_end();
$this->output .= $this->ipsclass->compiled_templates['skin_msg']->CP_end();
$this->output .= $this->ipsclass->compiled_templates['skin_ucp']->forum_jump($fj);
$this->output .= $this->ipsclass->compiled_templates['skin_msg']->forum_jump($fj);
$this->ipsclass->print->add_output("$this->output");
$this->ipsclass->print->do_output( array( 'TITLE' => $this->page_title, 'JS' => 0, NAV => $this->nav ) );
$this->ipsclass->print->add_output( $this->output );
$this->ipsclass->print->do_output( array( 'TITLE' => $this->page_title, 'JS' => 0, 'NAV' => $this->nav ) );
}
/*-------------------------------------------------------------------------*/
@@ -248,7 +228,7 @@ class messenger
$count = array( 'unsent' => 0 );
$names = array( 'unsent' => $this->ipsclass->lang['fd_unsent'] );
foreach( $this->ipsclass->member['dir_data'] as $k => $v )
foreach( $this->ipsclass->member['dir_data'] as $v )
{
$count[ $v['id'] ] = 0;
$names[ $v['id'] ] = $v['real'];
@@ -291,7 +271,7 @@ class messenger
$ids = array();
$qe = "";
foreach( $this->ipsclass->member['dir_data'] as $k => $v )
foreach( $this->ipsclass->member['dir_data'] as $v )
{
$names[ $v['id'] ] = $v['real'];
}
@@ -302,7 +282,7 @@ class messenger
foreach( $names as $vid => $name )
{
if ( $this->ipsclass->input['its_'.$vid] == 1 )
if ( isset($this->ipsclass->input['its_'.$vid]) AND $this->ipsclass->input['its_'.$vid] == 1 )
{
$ids[] = $vid;
}
@@ -350,7 +330,7 @@ class messenger
$current_dirs = $this->ipsclass->member['vdirs'];
foreach( $ids as $k => $v )
foreach( $ids as $v )
{
$foldertotal['total'] = 0;
@@ -379,9 +359,9 @@ class messenger
function archive()
{
$this->lib->jump_html = preg_replace("/<!--EXTRA-->/", "<option value='all'>".$this->ipsclass->lang['all_folders']."</option>", $this->lib->jump_html );
$this->msglib->jump_html = str_replace("<!--EXTRA-->", "<option value='all'>".$this->ipsclass->lang['all_folders']."</option>", $this->msglib->jump_html );
$this->output .= $this->ipsclass->compiled_templates['skin_msg']->archive_form( $this->lib->jump_html );
$this->output .= $this->ipsclass->compiled_templates['skin_msg']->archive_form( $this->msglib->jump_html );
$this->page_title = $this->ipsclass->lang['t_welcome'];
$this->nav = array( "<a href='".$this->base_url."act=UserCP&amp;CODE=00'>".$this->ipsclass->lang['t_title']."</a>" );
@@ -537,7 +517,7 @@ class messenger
//-----------------------------------------
// Delete?
//-----------------------------------------
if ($this->ipsclass->input['delete'] == 'yes')
{
$this->msglib->delete_messages( $msg_ids, $this->ipsclass->member['id'] );
@@ -551,6 +531,37 @@ class messenger
$this->ipsclass->DB->simple_construct( array ( 'update'=> 'members', 'set' => "msg_total=".$total['msg_total'], 'where' => "id=".$this->ipsclass->member['id'] ) ) ;
$this->ipsclass->DB->simple_exec();
if( $this->ipsclass->input['VID'] != 'all' )
{
$this->ipsclass->member['vdirs'] = $this->msglib->rebuild_dir_count( $this->ipsclass->member['id'],
$this->ipsclass->member['vdirs'],
$this->ipsclass->input['VID'],
($this->ipsclass->member['dir_data'][ $this->ipsclass->input['VID'] ]['count'] - $num_msg) > 0 ? ($this->ipsclass->member['dir_data'][ $this->ipsclass->input['VID'] ]['count'] - $num_msg) : 0,
'save'
);
}
else
{
foreach( $this->ipsclass->member['dir_data'] as $k => $v )
{
$foldertotal['total'] = 0;
$this->ipsclass->DB->simple_construct( array ( 'select' => 'COUNT(*) as total', 'from' => 'message_topics', 'where' => "mt_owner_id=".$this->ipsclass->member['id']." AND mt_vid_folder = '{$k}'" ) );
$this->ipsclass->DB->simple_exec();
$foldertotal = $this->ipsclass->DB->fetch_row();
$updated_vdirs = $this->msglib->rebuild_dir_count( $this->ipsclass->member['id'],
$this->ipsclass->member['vdirs'],
$k,
$foldertotal['total'],
'save'
);
$this->ipsclass->member['vdirs'] = $updated_vdirs;
}
}
}
//-----------------------------------------
@@ -592,7 +603,7 @@ class messenger
function strip_quotes($text) {
return preg_replace( "/\"/", '\\\"', $text );
return str_replace( '"', '\\\"', $text );
}
/*-------------------------------------------------------------------------*/
@@ -607,7 +618,7 @@ class messenger
$max = 1;
foreach( $this->ipsclass->member['dir_data'] as $k => $v )
foreach( $this->ipsclass->member['dir_data'] as $v )
{
$extra = "";
@@ -723,7 +734,7 @@ class messenger
{
if ($this->ipsclass->input[$match[0]])
{
$count = intval( $cur_dir[ $match[0] ] );
$count = isset($cur_dir[ $match[0] ]) ? intval( $cur_dir[ $match[0] ] ) : 0;
$v_dir .= '|'.$match[0].':'.trim(str_replace( '|', '', str_replace( ";", "", $this->ipsclass->input[$match[0]] ) ) ).';'.$count;
}
@@ -744,16 +755,13 @@ class messenger
function del_member()
{
$this->ipsclass->input['MID'] = isset($this->ipsclass->input['MID']) ? intval($this->ipsclass->input['MID']) : 0;
if (!$this->ipsclass->input['MID'])
{
$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'no_user' ) );
}
if (! preg_match( "/^(\d+)$/", $this->ipsclass->input['MID'] ) )
{
$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'no_user' ) );
}
$this->ipsclass->DB->simple_exec_query( array( 'delete' => 'contacts', 'where' => "member_id={$this->ipsclass->member['id']} AND contact_id={$this->ipsclass->input['MID']}" ) );
$this->ipsclass->boink_it($this->base_url."act=Msg&CODE=02");
@@ -767,16 +775,13 @@ class messenger
function edit_member()
{
$this->ipsclass->input['MID'] = isset($this->ipsclass->input['MID']) ? intval($this->ipsclass->input['MID']) : 0;
if (!$this->ipsclass->input['MID'])
{
$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'no_user' ) );
}
if (! preg_match( "/^(\d+)$/", $this->ipsclass->input['MID'] ) )
{
$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'no_user' ) );
}
$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'contacts', 'where' => "member_id={$this->ipsclass->member['id']} AND contact_id={$this->ipsclass->input['MID']}" ) );
$this->ipsclass->DB->simple_exec();
@@ -816,19 +821,25 @@ class messenger
function do_edit()
{
$this->ipsclass->input['MID'] = isset($this->ipsclass->input['MID']) ? intval($this->ipsclass->input['MID']) : 0;
if (!$this->ipsclass->input['MID'])
{
$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'no_user' ) );
}
if (! preg_match( "/^(\d+)$/", $this->ipsclass->input['MID'] ) )
{
$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'no_user' ) );
}
$this->ipsclass->input['allow_msg'] = $this->ipsclass->input['allow_msg'] == 'yes' ? 1 : 0;
$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'contacts', 'where' => "member_id={$this->ipsclass->member['id']} AND contact_id={$this->ipsclass->input['MID']}" ) );
$this->ipsclass->DB->simple_construct( array( 'select' => 'c.*',
'from' => array( 'contacts' => 'c'),
'where' => "c.member_id={$this->ipsclass->member['id']} AND c.contact_id={$this->ipsclass->input['MID']}",
'add_join' => array( 0 => array( 'select' => 'm.mgroup, m.mgroup_others',
'from' => array( 'members' => 'm' ),
'where' => 'm.id=c.contact_id',
'type' => 'left'
) )
) );
$this->ipsclass->DB->simple_exec();
$memb = $this->ipsclass->DB->fetch_row();
@@ -838,6 +849,35 @@ class messenger
$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'no_user' ) );
}
if( $this->ipsclass->vars['unblockable_pm_groups'] && $this->ipsclass->input['allow_msg'] == 'no' )
{
$unblockable = array();
$unblockable = explode( ",", $this->ipsclass->vars['unblockable_pm_groups'] );
$do_override = 0;
$my_groups = array( $memb['mgroup'] );
if( $memb['mgroup_others'] )
{
$my_other_groups = explode( ",", $memb['mgroup_others'] );
$my_groups = array_merge( $my_groups, $my_other_groups );
}
foreach( $my_groups as $member_group )
{
if( in_array( $member_group, $unblockable ) )
{
$do_override = 1;
}
}
if( $do_override == 0 )
{
$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'cannot_block' ) );
}
}
$this->ipsclass->DB->do_update( 'contacts', array( 'contact_desc' => $this->ipsclass->input['mem_desc'],
'allow_msg' => $this->ipsclass->input['allow_msg'],
), 'id='.$memb['id'] );
@@ -888,20 +928,19 @@ class messenger
$name_to_enter = "";
$this->ipsclass->input['MID'] = isset($this->ipsclass->input['MID']) ? intval($this->ipsclass->input['MID']) : 0;
if ($this->ipsclass->input['MID'])
{
if ( preg_match( "/^(\d+)$/", $this->ipsclass->input['MID'] ) )
{
$this->ipsclass->DB->simple_construct( array( 'select' => 'members_display_name,id', 'from' => 'members', 'where' => "id={$this->ipsclass->input['MID']}" ) );
$this->ipsclass->DB->simple_exec();
$this->ipsclass->DB->simple_construct( array( 'select' => 'members_display_name,id', 'from' => 'members', 'where' => "id={$this->ipsclass->input['MID']}" ) );
$this->ipsclass->DB->simple_exec();
$memb = $this->ipsclass->DB->fetch_row();
if ($memb['id'])
{
$name_to_enter = $memb['members_display_name'];
}
}
$memb = $this->ipsclass->DB->fetch_row();
if ($memb['id'])
{
$name_to_enter = $memb['members_display_name'];
}
}
$this->output .= $this->ipsclass->compiled_templates['skin_msg']->address_add($name_to_enter);
@@ -923,7 +962,7 @@ class messenger
$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'no_user' ) );
}
$this->ipsclass->DB->simple_construct( array( 'select' => 'members_display_name,name,id', 'from' => 'members', 'where' => "LOWER(members_display_name)='".$this->ipsclass->input['mem_name']."'" ) );
$this->ipsclass->DB->simple_construct( array( 'select' => 'members_display_name,name,id,mgroup,mgroup_others', 'from' => 'members', 'where' => "members_l_display_name='".$this->ipsclass->input['mem_name']."'" ) );
$this->ipsclass->DB->simple_exec();
$memb = $this->ipsclass->DB->fetch_row();
@@ -933,6 +972,42 @@ class messenger
$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'no_user' ) );
}
if ( $memb['id'] == $this->ipsclass->member['id'] )
{
$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'cannot_block' ) );
}
if( $this->ipsclass->vars['unblockable_pm_groups'] )
{
$unblockable = array();
$unblockable = explode( ",", $this->ipsclass->vars['unblockable_pm_groups'] );
$do_override = 0;
$my_groups = array( $memb['mgroup'] );
if( $memb['mgroup_others'] )
{
$my_other_groups = explode( ",", $memb['mgroup_others'] );
$my_groups = array_merge( $my_groups, $my_other_groups );
}
foreach( $my_groups as $member_group )
{
if( in_array( $member_group, $unblockable ) )
{
$do_override = 1;
}
}
if( $do_override == 1 )
{
// The member they are trying to add cannot be blocked
$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'cannot_block' ) );
}
}
//-----------------------------------------
// Do we already have this member in our
// address book?
@@ -988,18 +1063,19 @@ class messenger
}
}
$ids = $this->ipsclass->clean_int_array( $ids );
$affected_ids = count($ids);
if ( $affected_ids > 0 )
{
$ids = $this->ipsclass->clean_int_array( $ids );
$id_string = implode( ",", $ids );
if ($this->ipsclass->input['delete'])
{
$this->msglib->delete_messages( $ids, $this->ipsclass->member['id'] );
if ($this->ipsclass->input['saved'])
if ( isset($this->ipsclass->input['saved']) AND $this->ipsclass->input['saved'] )
{
//-----------------------------------------
// Did we delete from the saved folder? If so, don't update the msg stats and
@@ -1012,20 +1088,20 @@ class messenger
{
$this->msglib->rebuild_dir_count( $this->ipsclass->member['id'],
$this->ipsclass->member['vdirs'],
$this->lib->vid,
$this->ipsclass->member['dir_data'][ $this->lib->vid ]['count'] - $affected_ids,
$this->msglib->vid,
$this->ipsclass->member['dir_data'][ $this->msglib->vid ]['count'] - $affected_ids,
'save',
"msg_total=msg_total-$affected_ids"
);
$this->ipsclass->boink_it($this->base_url."act=Msg&CODE=01&VID={$this->lib->vid}");
$this->ipsclass->boink_it($this->base_url."act=Msg&CODE=01&VID={$this->msglib->vid}&sort={$this->ipsclass->input['sort']}&st={$this->ipsclass->input['st']}");
}
}
else if ($this->ipsclass->input['move'])
{
$this->ipsclass->DB->simple_construct( array( 'update' => 'message_topics', 'set' => "mt_vid_folder='{$this->lib->vid}', mt_to_id={$this->ipsclass->member['id']}", 'where' => "mt_vid_folder != '{$this->lib->vid}' AND mt_owner_id=".$this->ipsclass->member['id']." AND mt_id IN ($id_string)" ) );
$this->ipsclass->DB->simple_construct( array( 'update' => 'message_topics', 'set' => "mt_vid_folder='{$this->msglib->vid}', mt_to_id={$this->ipsclass->member['id']}", 'where' => "mt_vid_folder != '{$this->msglib->vid}' AND mt_owner_id=".$this->ipsclass->member['id']." AND mt_id IN ($id_string)" ) );
$this->ipsclass->DB->simple_exec();
if ( $this->ipsclass->DB->get_affected_rows() )
@@ -1037,13 +1113,13 @@ class messenger
$this->ipsclass->member['dir_data'][ $this->ipsclass->input['curvid'] ]['count'] - $affected_ids,
'nosave'
),
$this->lib->vid,
$this->ipsclass->member['dir_data'][ $this->lib->vid ]['count'] + $affected_ids,
$this->msglib->vid,
$this->ipsclass->member['dir_data'][ $this->msglib->vid ]['count'] + $affected_ids,
'save'
);
}
$this->ipsclass->boink_it($this->base_url."act=Msg&CODE=01&VID={$this->lib->vid}");
$this->ipsclass->boink_it($this->base_url."act=Msg&CODE=01&VID={$this->msglib->vid}&sort={$this->ipsclass->input['sort']}&st={$this->ipsclass->input['st']}");
}
else
@@ -1082,6 +1158,8 @@ class messenger
}
}
$ids = $this->ipsclass->clean_int_array( $ids );
$affected_ids = count($ids);
if ( $affected_ids > 0 )
@@ -1122,6 +1200,8 @@ class messenger
}
}
$ids = $this->ipsclass->clean_int_array( $ids );
$affected_ids = count($ids);
if ( $affected_ids > 0 )
@@ -1163,13 +1243,13 @@ class messenger
$this->msglib->rebuild_dir_count( $this->ipsclass->member['id'],
$this->ipsclass->member['vdirs'],
$this->lib->vid,
$this->ipsclass->member['dir_data'][ $this->lib->vid ]['count'] - 1,
$this->msglib->vid,
$this->ipsclass->member['dir_data'][ $this->msglib->vid ]['count'] - 1,
'save',
"msg_total=msg_total-1"
);
$this->ipsclass->boink_it($this->base_url."act=Msg&CODE=01&VID={$this->lib->vid}");
$this->ipsclass->boink_it($this->base_url."act=Msg&CODE=01&VID={$this->msglib->vid}");
}
/*-------------------------------------------------------------------------*/
@@ -1185,12 +1265,14 @@ class messenger
// Get extra LIBBIES
//-----------------------------------------
require_once( ROOT_PATH.'sources/action_public/topics.php' );
require ( ROOT_PATH.'sources/action_public/topics.php' );
$this->topiclib = new topics();
$this->topiclib->ipsclass =& $this->ipsclass;
$this->topiclib->topic_init();
$this->topiclib->topic['forum_id'] = 0;
$this->topiclib->topic['tid'] = 0;
//-----------------------------------------
// check for a msg ID
@@ -1218,7 +1300,7 @@ class messenger
// no new msg
//-----------------------------------------
if ($this->ipsclass->member['new_msg'] >= 1)
if ( $this->ipsclass->member['new_msg'] >= 1 )
{
$this->ipsclass->DB->simple_construct( array( 'update' => 'members', 'set' => "new_msg=new_msg-1", 'where' => "id=".$this->ipsclass->member['id'] ) );
$this->ipsclass->DB->simple_exec();
@@ -1242,7 +1324,25 @@ class messenger
$msg['msg_date'] = $this->ipsclass->get_date( $msg['msg_date'], 'LONG' );
$member = $this->topiclib->parse_member( $msg );
if ( $msg['id'] )
{
$member = $this->topiclib->parse_member( $msg );
}
else
{
//-----------------------------------------
// It's definitely a guest...
//-----------------------------------------
$member = $this->ipsclass->set_up_guest( $this->ipsclass->lang['deleted_user'] );
$member['members_display_name'] = $this->ipsclass->lang['deleted_user'];
$member['custom_fields'] = "";
$member['warn_text'] = "";
$member['warn_minus'] = "";
$member['warn_img'] = "";
$member['warn_add'] = "";
$member['signature'] = "";
}
$this->topiclib->parser->parse_smilies = 1;
$this->topiclib->parser->parse_html = $this->ipsclass->vars['msg_allow_html'];
@@ -1271,6 +1371,8 @@ class messenger
// To , CC, etc?
//-----------------------------------------
$msg['show_cc_users'] = "";
if ( ! $msg['mt_hide_cc'] )
{
$cc_users = $this->msglib->format_cc_string( $msg['msg_cc_users'], $this->ipsclass->member['id'] );
@@ -1286,6 +1388,8 @@ class messenger
// admin message
//-----------------------------------------
$msg['_ip_address'] = "";
if ( $msg['msg_ip_address'] AND $this->ipsclass->member['g_is_supmod'] == 1 AND $member['mgroup'] != $this->ipsclass->vars['admin_group'] )
{
$msg['_ip_address'] = $msg['msg_ip_address'];
@@ -1295,7 +1399,7 @@ class messenger
// Show...
//-----------------------------------------
$html = $this->ipsclass->compiled_templates['skin_msg']->Render_msg( $msg, $member, $this->lib->jump_html );
$html = $this->ipsclass->compiled_templates['skin_msg']->Render_msg( $msg, $member, $this->msglib->jump_html );
//-----------------------------------------
// Attachments?
@@ -1303,9 +1407,25 @@ class messenger
if ( $msg['mt_hasattach'] )
{
$html = $this->topiclib->parse_attachments( $html, array( $msg['msg_id'] ), 'attach_msg', 'msg', 'msg' );
if ( ! is_object( $this->class_attach ) )
{
//-----------------------------------------
// Grab render attach class
//-----------------------------------------
require_once( ROOT_PATH . 'sources/classes/attach/class_attach.php' );
$this->class_attach = new class_attach();
$this->class_attach->ipsclass =& $this->ipsclass;
}
$this->class_attach->type = 'msg';
$this->class_attach->init();
$html = $this->class_attach->render_attachments( $html, array( $msg['msg_id'] ) );
}
unset($this->topiclib);
$this->output .= $html;
$this->page_title = $this->ipsclass->lang['t_welcome'];
@@ -1332,7 +1452,7 @@ class messenger
$show_form = 0;
$this->post_key = $this->ipsclass->input['post_key'] ? $this->ipsclass->input['post_key'] : md5(microtime());
$this->post_key = ( isset($this->ipsclass->input['attach_post_key']) AND $this->ipsclass->input['attach_post_key'] != '' ) ? $this->ipsclass->input['attach_post_key'] : md5(microtime());
$this->msglib->init();
$this->msglib->register_class( $this );
@@ -1341,7 +1461,7 @@ class messenger
// Did we remove an attachment?
//-----------------------------------------
if ( $this->ipsclass->input['removeattachid'] )
if ( isset($this->ipsclass->input['removeattachid']) AND $this->ipsclass->input['removeattachid'] )
{
if ( $this->ipsclass->input[ 'removeattach_'. $this->ipsclass->input['removeattachid'] ] )
{
@@ -1356,7 +1476,7 @@ class messenger
if ( $this->ipsclass->input['attachgo'] )
{
$this->upload_id = $this->msglib->postlib->process_upload();
//$this->upload_id = $this->msglib->postlib->process_upload();
$this->show_form = 1;
}
@@ -1373,7 +1493,7 @@ class messenger
// Show form or...
//-----------------------------------------
if ( $this->ipsclass->input['MODE'] and $this->show_form != 1 )
if ( isset($this->ipsclass->input['MODE']) AND $this->ipsclass->input['MODE'] and $this->show_form != 1 )
{
$this->send_msg();
}
@@ -1399,14 +1519,14 @@ class messenger
// Error checking
//-----------------------------------------
if ( strlen($this->ipsclass->input['msg_title']) < 2 )
if ( strlen(trim($this->ipsclass->input['msg_title'])) < 2 )
{
$this->msglib->send_form( 0, $this->ipsclass->lang['err_no_title'] );
$this->output .= $this->msglib->output;
return;
}
if ( strlen($_POST['Post']) < 2 )
if ( strlen( trim( $_POST['Post'] ) ) < 2 )
{
$this->msglib->send_form( 0, $this->ipsclass->lang['err_no_msg'] );
$this->output .= $this->msglib->output;
@@ -1435,7 +1555,7 @@ class messenger
}
else
{
$this->msglib->to_by_id = intval( $this->ipsclass->input['from_contact'] );
$this->msglib->to_by_id = intval($this->ipsclass->input['from_contact']);
}
//-----------------------------------------
@@ -1445,22 +1565,24 @@ class messenger
$this->ipsclass->input['Post'] = $this->msglib->postlib->han_editor->process_raw_post( 'Post' );
$this->ipsclass->input['msg_title'] = $this->msglib->postlib->parser->bad_words($this->ipsclass->input['msg_title']);
//-----------------------------------------
// SEND
//-----------------------------------------
$this->upload_id = $this->msglib->postlib->process_upload();
//$this->upload_id = $this->msglib->postlib->process_upload();
$this->msglib->cc_users = $this->ipsclass->parse_clean_value( $this->ipsclass->txt_UNhtmlspecialchars($_POST['carbon_copy']) );
$this->msglib->from_member = $this->ipsclass->member;
$this->msglib->msg_title = $this->ipsclass->input['msg_title'];
$this->msglib->msg_post = $this->ipsclass->input['Post'];
$this->msglib->send_pm( array( 'save_only' => $this->ipsclass->input['save'],
'orig_id' => intval($this->ipsclass->input['OID']),
'preview' => $this->ipsclass->input['preview'],
'track' => $this->ipsclass->input['add_tracking'],
'add_sent' => ($this->ipsclass->input['add_sent'] ? 1 : 0),
'hide_cc' => $this->ipsclass->input['mt_hide_cc']
$this->msglib->send_pm( array( 'save_only' => isset($this->ipsclass->input['save']) ? $this->ipsclass->input['save'] : 0,
'orig_id' => isset($this->ipsclass->input['OID']) ? intval($this->ipsclass->input['OID']) : 0,
'preview' => isset($this->ipsclass->input['preview']) ? $this->ipsclass->input['preview'] : 0,
'track' => isset($this->ipsclass->input['add_tracking']) ? $this->ipsclass->input['add_tracking'] : 0,
'add_sent' => isset($this->ipsclass->input['add_sent']) ? 1 : 0,
'hide_cc' => isset($this->ipsclass->input['mt_hide_cc']) ? $this->ipsclass->input['mt_hide_cc'] : 0
) );
if ( $this->msglib->error != "" )
@@ -1479,8 +1601,8 @@ class messenger
// Swap and serve...
//-----------------------------------------
$text = preg_replace( "/<#FROM_MEMBER#>/" , $this->ipsclass->member['members_display_name'] , $this->ipsclass->lang['sent_text'] );
$text = preg_replace( "/<#MESSAGE_TITLE#>/" , $this->ipsclass->input['msg_title'], $text );
$text = str_replace( "<#FROM_MEMBER#>" , $this->ipsclass->member['members_display_name'] , $this->ipsclass->lang['sent_text'] );
$text = str_replace( "<#MESSAGE_TITLE#>" , $this->ipsclass->input['msg_title'], $text );
$this->ipsclass->print->redirect_screen( $text , "&act=Msg&CODE=01" );
}
@@ -1532,16 +1654,16 @@ class messenger
// Get the number of messages in our curr folder.
//-----------------------------------------
$this->ipsclass->DB->simple_construct( array ( 'select' => 'COUNT(*) as msg_total', 'from' => 'message_topics', 'where' => "mt_owner_id=".$this->ipsclass->member['id']." AND mt_vid_folder='{$this->lib->vid}'" ) );
$this->ipsclass->DB->simple_construct( array ( 'select' => 'COUNT(*) as msg_total', 'from' => 'message_topics', 'where' => "mt_owner_id=".$this->ipsclass->member['id']." AND mt_vid_folder='{$this->msglib->vid}'" ) );
$this->ipsclass->DB->simple_exec();
$total_current = $this->ipsclass->DB->fetch_row();
$total_current['msg_total'] = intval($total_current['msg_total']);
if ( $total_current['msg_total'] != $this->ipsclass->member['dir_data'][ $this->lib->vid ]['count'] )
if ( $total_current['msg_total'] != $this->ipsclass->member['dir_data'][ $this->msglib->vid ]['count'] )
{
$this->msglib->rebuild_dir_count( $this->ipsclass->member['id'], $this->ipsclass->member['vdirs'], $this->lib->vid, $total_current['msg_total'] );
$this->msglib->rebuild_dir_count( $this->ipsclass->member['id'], $this->ipsclass->member['vdirs'], $this->msglib->vid, $total_current['msg_total'] );
}
//-----------------------------------------
@@ -1552,7 +1674,7 @@ class messenger
$info['full_text'] = "";
$info['total_messages'] = $total['msg_total'];
$info['img_width'] = 1;
$info['vid'] = $this->lib->vid;
$info['vid'] = $this->msglib->vid;
$info['date_order'] = $sort_key == 'm.msg_date DESC' ? 'rdate' : 'msg_date';
$amount_info = sprintf( $this->ipsclass->lang['pmpc_info_string'], $total['msg_total'] ,$this->ipsclass->lang['pmpc_unlimited'] );
@@ -1583,36 +1705,40 @@ class messenger
// Generate Pagination
//-----------------------------------------
$start = intval($this->ipsclass->input['st']) > 0 ? intval($this->ipsclass->input['st']) : 0;
$start = intval($this->ipsclass->input['st']) >=0 ? intval($this->ipsclass->input['st']) : 0;
$p_end = $this->ipsclass->vars['show_max_msg_list'] > 0 ? $this->ipsclass->vars['show_max_msg_list'] : 50;
if( $start*$p_end > $total_current['msg_total'] )
{
$start = (floor($total_current['msg_total']/$p_end) - 1) * $p_end;
}
$pages = $this->ipsclass->build_pagelinks( array( 'TOTAL_POSS' => $total_current['msg_total'],
'PER_PAGE' => $p_end,
'CUR_ST_VAL' => $start,
'L_SINGLE' => "",
'L_MULTI' => $this->ipsclass->lang['msg_pages'],
'BASE_URL' => $this->ipsclass->base_url."act=Msg&amp;CODE=1&amp;VID=".$this->lib->vid."&amp;sort=".$this->ipsclass->input['sort'],
'BASE_URL' => $this->ipsclass->base_url."act=Msg&amp;CODE=1&amp;VID=".$this->msglib->vid."&amp;sort=".$this->ipsclass->input['sort'],
) );
//-----------------------------------------
// Print the header
//-----------------------------------------
if ($this->lib->vid == 'sent')
if ($this->msglib->vid == 'sent')
{
$this->ipsclass->lang['message_from'] = $this->ipsclass->lang['message_to'];
$this->ipsclass->DB->cache_add_query( 'msg_get_sent_list', array( 'mid' => $this->ipsclass->member['id'], 'vid' => $this->lib->vid, 'sort' => $sort_key, 'limita' => $start, 'limitb' => $p_end ) );
$this->ipsclass->DB->cache_add_query( 'msg_get_sent_list', array( 'mid' => $this->ipsclass->member['id'], 'vid' => $this->msglib->vid, 'sort' => $sort_key, 'limita' => $start, 'limitb' => $p_end ) );
$this->ipsclass->DB->simple_exec();
}
else
{
$this->ipsclass->DB->cache_add_query( 'msg_get_folder_list', array( 'mid' => $this->ipsclass->member['id'], 'vid' => $this->lib->vid, 'sort' => $sort_key, 'limita' => $start, 'limitb' => $p_end ) );
$this->ipsclass->DB->cache_add_query( 'msg_get_folder_list', array( 'mid' => $this->ipsclass->member['id'], 'vid' => $this->msglib->vid, 'sort' => $sort_key, 'limita' => $start, 'limitb' => $p_end ) );
$this->ipsclass->DB->simple_exec();
}
$this->output .= $this->ipsclass->compiled_templates['skin_msg']->inbox_table_header( $this->ipsclass->member['current_dir'], $info, $this->lib->jump_html, $pages, $this->lib->vid );
$this->output .= $this->ipsclass->compiled_templates['skin_msg']->inbox_table_header( $this->ipsclass->member['current_dir'], $info, $this->msglib->jump_html, $pages, $this->msglib->vid );
//-----------------------------------------
// Get the messages
@@ -1622,31 +1748,18 @@ class messenger
{
while( $row = $this->ipsclass->DB->fetch_row() )
{
if ( $row['mt_hasattach'] )
{
$row['attach_img'] = '<{ATTACH_ICON}>';
}
if ($this->lib->vid == 'sent')
{
$row['icon'] = "<{M_READ}>";
}
else
{
$row['icon'] = $row['mt_read'] == 1 ? "<{M_READ}>" : "<{M_UNREAD}>";
}
$row['attach_img'] = $row['mt_hasattach'] ? '<{ATTACH_ICON}>' : '';
$row['icon'] = $this->msglib->vid == 'sent' ? '<{M_READ}>' : ( $row['mt_read'] == 1 ? '<{M_READ}>' : '<{M_UNREAD}>' );
$row['date'] = $this->ipsclass->get_date( $row['mt_date'] , 'LONG' );
if ($this->lib->vid != 'sent')
{
$row['add_to_contacts'] = "[ <a href='{$this->ipsclass->base_url}act=Msg&amp;CODE=02&amp;MID={$row['from_id']}'>{$this->ipsclass->lang[add_to_book]}</a> ]";
}
else
{
//$row['from_id'] = $row['mt_from_id'];
}
$row['add_to_contacts'] = $this->msglib->vid != 'sent' ? "[ <a href='{$this->ipsclass->base_url}act=Msg&amp;CODE=02&amp;MID={$row['from_id']}'>{$this->ipsclass->lang['add_to_book']}</a> ]" : '';
$row['from_name'] = $row['from_name'] ?
"<a href='{$this->ipsclass->base_url}showuser={$row['from_id']}'>{$row['from_name']}</a> {$row['add_to_contacts']}" :
$this->ipsclass->lang['deleted_user'];
$this->output .= $this->ipsclass->compiled_templates['skin_msg']->inbox_row( $row );
}
}
@@ -1656,7 +1769,7 @@ class messenger
}
$this->output .= $this->ipsclass->compiled_templates['skin_msg']->end_inbox($this->lib->jump_html, $amount_info, $pages);
$this->output .= $this->ipsclass->compiled_templates['skin_msg']->end_inbox($this->msglib->jump_html, $amount_info, $pages);
//-----------------------------------------
// Update the message stats if we have to
@@ -1697,15 +1810,16 @@ class messenger
{
while( $row = $this->ipsclass->DB->fetch_row() )
{
if ( $row['mt_hasattach'] )
{
$row['attach_img'] = '<{ATTACH_ICON}>';
}
$row['attach_img'] = $row['mt_hasattach'] ? '<{ATTACH_ICON}>' : '';
$row['icon'] = "<{M_READ}>";
$row['date'] = $this->ipsclass->get_date( $row['mt_date'] , 'LONG' );
$row['cc_users'] = $row['msg_cc_users'] == "" ? $this->ipsclass->lang['no'] : $this->ipsclass->lang['yes'];
$row['from_name'] = $row['from_name'] ?
"<a href='{$this->ipsclass->base_url}showuser={$row['from_id']}'>{$row['from_name']}</a> {$row['add_to_contacts']}" :
$this->ipsclass->lang['deleted_user'];
$d_array = array( 'msg' => $row, 'member' => $this->ipsclass->member );
$this->output .= $this->ipsclass->compiled_templates['skin_msg']->unsent_row( $d_array );
@@ -1713,7 +1827,7 @@ class messenger
}
else
{
$this->output .= $this->ipsclass->compiled_templates['skin_msg']->No_msg_inbox();
$this->output .= $this->ipsclass->compiled_templates['skin_msg']->unsent_empty_row();
}
$this->output .= $this->ipsclass->compiled_templates['skin_msg']->unsent_end();
@@ -1761,7 +1875,7 @@ class messenger
if ( count($read) )
{
foreach( $read as $id => $row )
foreach( $read as $row )
{
$row['icon'] = "<{M_READ}>";
$row['date'] = $this->ipsclass->get_date( $row['mt_user_read'] , 'LONG' );
@@ -1783,7 +1897,7 @@ class messenger
if ( count($unread) )
{
foreach( $unread as $id => $row )
foreach( $unread as $row )
{
$row['icon'] = "<{M_UNREAD}>";
$row['date'] = $this->ipsclass->get_date( $row['mt_date'] , 'LONG' );