|
From: Jon O. <jon...@us...> - 2008-07-13 19:38:30
|
Update of /cvsroot/mxbb/mx_shoutbox In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv5263 Modified Files: mx_shoutbox.php Log Message: related... Index: mx_shoutbox.php =================================================================== RCS file: /cvsroot/mxbb/mx_shoutbox/mx_shoutbox.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** mx_shoutbox.php 27 Feb 2008 17:14:43 -0000 1.2 --- mx_shoutbox.php 13 Jul 2008 19:38:25 -0000 1.3 *************** *** 7,13 **** // COPYRIGHT : © 2002, 2003 apegaming.net // WWW : http://www.blame-the-french.com.com/ ! // LICENCE : GPL vs2.0 [ see /docs/COPYING ] ! // ! // ------------------------------------------------------------- $page_id = ($page_id) ? intval($page_id) : $mx_request_vars->request('page', MX_TYPE_NO_TAGS, 1); --- 7,13 ---- // COPYRIGHT : © 2002, 2003 apegaming.net // WWW : http://www.blame-the-french.com.com/ ! // LICENCE : GPL vs2.0 [ see /docs/COPYING ] ! // ! // ------------------------------------------------------------- $page_id = ($page_id) ? intval($page_id) : $mx_request_vars->request('page', MX_TYPE_NO_TAGS, 1); *************** *** 15,19 **** if ( defined('IN_PORTAL') ) { ! include($module_root_path . 'includes/constants.' . $phpEx); include($module_root_path . 'includes/functions.' . $phpEx); --- 15,19 ---- if ( defined('IN_PORTAL') ) { ! include($module_root_path . 'includes/constants.' . $phpEx); include($module_root_path . 'includes/functions.' . $phpEx); *************** *** 21,25 **** ! /**************************** Read language definition --- 21,25 ---- ! /**************************** Read language definition *************** *** 32,41 **** { include( $module_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_main.'.$phpEx ); ! } ! /**************************** Get config data *****************************/ ! $sql = "SELECT * FROM " . SHOUTBOX_CONFIG_TABLE; if(!$result = $db->sql_query($sql)) --- 32,41 ---- { include( $module_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_main.'.$phpEx ); ! } ! /**************************** Get config data *****************************/ ! $sql = "SELECT * FROM " . SHOUTBOX_CONFIG_TABLE; if(!$result = $db->sql_query($sql)) *************** *** 77,81 **** $message = preg_replace("#\[img:$bbcode_uid\](.*?)\[/img:$bbcode_uid\]#si", '', $message); ! $sql = "INSERT INTO " . SHOUTBOX_TABLE . " (name_id,name,text,time,bbcode_uid) VALUES ('$user_id','" . substr($username,0,20) . "','$message','$time', '$bbcode_uid')"; if ( !($result = $db->sql_query($sql)) ) --- 77,81 ---- $message = preg_replace("#\[img:$bbcode_uid\](.*?)\[/img:$bbcode_uid\]#si", '', $message); ! $sql = "INSERT INTO " . SHOUTBOX_TABLE . " (name_id,name,text,time,bbcode_uid) VALUES ('$user_id','" . substr($username,0,20) . "','$message','$time', '$bbcode_uid')"; if ( !($result = $db->sql_query($sql)) ) *************** *** 88,92 **** shout_msg($message); break; ! case 'delete': $id = $mx_request_vars->request('id', MX_TYPE_INT, ''); --- 88,92 ---- shout_msg($message); break; ! case 'delete': $id = $mx_request_vars->request('id', MX_TYPE_INT, ''); *************** *** 96,100 **** break; } ! $sql = "DELETE FROM " . SHOUTBOX_TABLE . " WHERE id='$id'"; if ( !($result = $db->sql_query($sql)) ) --- 96,100 ---- break; } ! $sql = "DELETE FROM " . SHOUTBOX_TABLE . " WHERE id='$id'"; if ( !($result = $db->sql_query($sql)) ) *************** *** 107,111 **** case 'edit': ! $id = $mx_request_vars->request('id', MX_TYPE_INT, ''); if ( empty($id) ) --- 107,111 ---- case 'edit': ! $id = $mx_request_vars->request('id', MX_TYPE_INT, ''); if ( empty($id) ) *************** *** 114,118 **** break; } ! $sql = "SELECT * FROM ". SHOUTBOX_TABLE ." --- 114,118 ---- break; } ! $sql = "SELECT * FROM ". SHOUTBOX_TABLE ." *************** *** 124,134 **** } $thisshout = $db->sql_fetchrow($result); ! $shoutnameid = $thisshout['name_id']; ! if ($userdata['user_level'] == ADMIN || $shoutnameid == $userdata['user_id']) { $shout_text = $thisshout['text']; ! if ($shout_config['static_box']==1) { --- 124,134 ---- } $thisshout = $db->sql_fetchrow($result); ! $shoutnameid = $thisshout['name_id']; ! if ($userdata['user_level'] == ADMIN || $shoutnameid == $userdata['user_id']) { $shout_text = $thisshout['text']; ! if ($shout_config['static_box']==1) { *************** *** 139,147 **** $box_height = ""; } ! $template->set_filenames(array( 'body' => 'mx_shout_edit.tpl') ); ! $template->assign_vars(array( 'L_EDIT_SHOUT_INFO' => $lang['Edit_Shout_Info'], --- 139,147 ---- $box_height = ""; } ! $template->set_filenames(array( 'body' => 'mx_shout_edit.tpl') ); ! $template->assign_vars(array( 'L_EDIT_SHOUT_INFO' => $lang['Edit_Shout_Info'], *************** *** 151,160 **** 'SHOUT_SIZE' => $shout_config['shout_size'], 'SHOUT_SIZE_EXPL' => $lang['shout_size_expl'], ! 'S_SHOUT_ACTION' => append_sid($mx_root_path.'index.php?page='.$page_id."&sbmode=edit_shout&id=$id"), ) ); ! $template->pparse('body'); ! break; } --- 151,160 ---- 'SHOUT_SIZE' => $shout_config['shout_size'], 'SHOUT_SIZE_EXPL' => $lang['shout_size_expl'], ! 'S_SHOUT_ACTION' => append_sid($mx_root_path.'index.php?page='.$page_id."&sbmode=edit_shout&id=$id"), ) ); ! $template->pparse('body'); ! break; } *************** *** 164,171 **** break; } ! break; ! case 'edit_shout': ! $id = $mx_request_vars->request('id', MX_TYPE_INT, ''); if ( empty($id) ) --- 164,171 ---- break; } ! break; ! case 'edit_shout': ! $id = $mx_request_vars->request('id', MX_TYPE_INT, ''); if ( empty($id) ) *************** *** 173,178 **** shout_msg($lang['Shout_edit_error']); break; ! } ! $sql = "SELECT * FROM ". SHOUTBOX_TABLE ." --- 173,178 ---- shout_msg($lang['Shout_edit_error']); break; ! } ! $sql = "SELECT * FROM ". SHOUTBOX_TABLE ." *************** *** 184,190 **** } $thisshout = $db->sql_fetchrow($result); ! $shoutnameid = $thisshout['name_id']; ! if ($userdata['user_level'] == ADMIN || $shoutnameid == $userdata['user_id']) { --- 184,190 ---- } $thisshout = $db->sql_fetchrow($result); ! $shoutnameid = $thisshout['name_id']; ! if ($userdata['user_level'] == ADMIN || $shoutnameid == $userdata['user_id']) { *************** *** 192,196 **** $shout_text = str_replace("\'", "''", htmlspecialchars(trim($shout_text))); $id = $mx_request_vars->request('id', MX_TYPE_INT, ''); ! $sql = "UPDATE ". SHOUTBOX_TABLE ." SET text = '$shout_text' --- 192,196 ---- $shout_text = str_replace("\'", "''", htmlspecialchars(trim($shout_text))); $id = $mx_request_vars->request('id', MX_TYPE_INT, ''); ! $sql = "UPDATE ". SHOUTBOX_TABLE ." SET text = '$shout_text' *************** *** 199,220 **** { $message = $lang['Shout_error'].'<br />'; ! ! shout_msg($message); ! break; ! } $message = $lang['shout_updated_successfully'].'<br />'; ! shout_msg($message); ! } else { ! shout_msg($lang['Shout_edit_perm_error']); break; } break; ! } /**************************** --- 199,220 ---- { $message = $lang['Shout_error'].'<br />'; ! ! shout_msg($message); ! break; ! } $message = $lang['shout_updated_successfully'].'<br />'; ! shout_msg($message); ! } else { ! shout_msg($lang['Shout_edit_perm_error']); break; } break; ! } /**************************** *************** *** 223,236 **** $s_form_action = append_sid($mx_root_path.'index.php?page='.$page_id); ! $s_hidden_fields = '<input name="sid" type="hidden" value="' . $userdata['session_id'] . '" />' ! .'<input name="user_id" type="hidden" value="' . $userdata['user_id'] . '" />' ! .'<input name="sbmode" type="hidden" value="add" />' .'<input name="bbcode" type="hidden" value="' . $shout_config['allow_bbcode'] . '" />'; ! if ( $userdata['session_logged_in'] ) { $s_hidden_fields .= '<input name="username" type="hidden" value="' . $userdata['username'] . '" />'; } ! /**************************** Get variables for paginate --- 223,236 ---- $s_form_action = append_sid($mx_root_path.'index.php?page='.$page_id); ! $s_hidden_fields = '<input name="sid" type="hidden" value="' . $userdata['session_id'] . '" />' ! .'<input name="user_id" type="hidden" value="' . $userdata['user_id'] . '" />' ! .'<input name="sbmode" type="hidden" value="add" />' .'<input name="bbcode" type="hidden" value="' . $shout_config['allow_bbcode'] . '" />'; ! if ( $userdata['session_logged_in'] ) { $s_hidden_fields .= '<input name="username" type="hidden" value="' . $userdata['username'] . '" />'; } ! /**************************** Get variables for paginate *************** *** 238,246 **** $shout_start = $mx_request_vars->request('shout_start', MX_TYPE_NO_TAGS, 0); $shout_start = ($shout_start < 0) ? 0 : $shout_start; ! /**************************** Count the number of total shouts *****************************/ ! $sql = "SELECT COUNT(id) AS total FROM " . SHOUTBOX_TABLE; if ( !($result = $db->sql_query($sql)) ) --- 238,246 ---- $shout_start = $mx_request_vars->request('shout_start', MX_TYPE_NO_TAGS, 0); $shout_start = ($shout_start < 0) ? 0 : $shout_start; ! /**************************** Count the number of total shouts *****************************/ ! $sql = "SELECT COUNT(id) AS total FROM " . SHOUTBOX_TABLE; if ( !($result = $db->sql_query($sql)) ) *************** *** 264,268 **** $box_height = ""; } ! if ($shout_config['shout_size']!="") { $shout_size = $shout_config['shout_size']; --- 264,268 ---- $box_height = ""; } ! if ($shout_config['shout_size']!="") { $shout_size = $shout_config['shout_size']; *************** *** 274,283 **** $shout_size_lang = ""; } ! /**************************** Start page proper *****************************/ $template->set_filenames(array( ! 'body_shoutbox' => 'mx_shoutbox.tpl' )); --- 274,283 ---- $shout_size_lang = ""; } ! /**************************** Start page proper *****************************/ $template->set_filenames(array( ! 'body_shoutbox' => 'mx_shoutbox.tpl' )); *************** *** 291,295 **** 'L_LOGIN' => $lang['Shout_log_on'], 'L_NAME' => $lang['Shout_username'], ! 'SHOUT_SIZE' => $shout_size, 'SHOUT_SIZE_EXPL' => $shout_size_lang, --- 291,295 ---- 'L_LOGIN' => $lang['Shout_log_on'], 'L_NAME' => $lang['Shout_username'], ! 'SHOUT_SIZE' => $shout_size, 'SHOUT_SIZE_EXPL' => $shout_size_lang, *************** *** 302,311 **** )); ! /**************************** Fetch the shouts, and filter any naughty words, if need so *****************************/ ! $sql = "SELECT * ! FROM " . SHOUTBOX_TABLE . " ! ORDER BY id DESC LIMIT $shout_start,$page_id_limit"; if ( !($result = $db->sql_query($sql)) ) --- 302,311 ---- )); ! /**************************** Fetch the shouts, and filter any naughty words, if need so *****************************/ ! $sql = "SELECT * ! FROM " . SHOUTBOX_TABLE . " ! ORDER BY id DESC LIMIT $shout_start,$page_id_limit"; if ( !($result = $db->sql_query($sql)) ) *************** *** 315,320 **** $mxshout = array(); ! $mxshout = $db->sql_fetchrowset($result); ! if ($mxshout) { --- 315,320 ---- $mxshout = array(); ! $mxshout = $db->sql_fetchrowset($result); ! if ($mxshout) { *************** *** 329,333 **** { $bbcode_uid = $mxshout[$i]['bbcode_uid']; ! $mxshout[$i]['text'] = mx_decode( $mxshout[$i]['text'], $bbcode_uid ); $shoutid = $mxshout[$i]['id']; $shoutnameid = $mxshout[$i]['name_id']; --- 329,333 ---- { $bbcode_uid = $mxshout[$i]['bbcode_uid']; ! $mxshout[$i]['text'] = $mx_bbcode->decode( $mxshout[$i]['text'], $bbcode_uid ); $shoutid = $mxshout[$i]['id']; $shoutnameid = $mxshout[$i]['name_id']; *************** *** 338,342 **** $mxshout[$i]['text'] = preg_replace($orig_word, $replacement_word, $mxshout[$i]['text']); } ! // Is user a guest/anon? Ignore profile URL if it is. if ( $shoutnameid == ANONYMOUS ) --- 338,342 ---- $mxshout[$i]['text'] = preg_replace($orig_word, $replacement_word, $mxshout[$i]['text']); } ! // Is user a guest/anon? Ignore profile URL if it is. if ( $shoutnameid == ANONYMOUS ) *************** *** 354,361 **** $delurl_tmp = append_sid($mx_root_path.'index.php?page='.$page_id."&sbmode=delete&id=$shoutid&sid=" . $userdata['session_id']); $delimg_tmp = '<img src="' . $images['icon_delpost'] . '" align="right" border="0" alt="' . $lang['alt_delete'] . '" />'; ! $edturl_tmp = append_sid($mx_root_path.'index.php?page='.$page_id."&sbmode=edit&id=$shoutid&sid=" . $userdata['session_id']); $edtimg_tmp = '<img src="' . $images['icon_edit'] . '" align="right" border="0" alt="' . $lang['alt_edit'] . '" />'; ! if ($userdata['user_level'] == ADMIN) { --- 354,361 ---- $delurl_tmp = append_sid($mx_root_path.'index.php?page='.$page_id."&sbmode=delete&id=$shoutid&sid=" . $userdata['session_id']); $delimg_tmp = '<img src="' . $images['icon_delpost'] . '" align="right" border="0" alt="' . $lang['alt_delete'] . '" />'; ! $edturl_tmp = append_sid($mx_root_path.'index.php?page='.$page_id."&sbmode=edit&id=$shoutid&sid=" . $userdata['session_id']); $edtimg_tmp = '<img src="' . $images['icon_edit'] . '" align="right" border="0" alt="' . $lang['alt_edit'] . '" />'; ! if ($userdata['user_level'] == ADMIN) { *************** *** 391,419 **** $edtimg = ''; } ! ! } // Change row colors $row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2']; $row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2']; ! $template->assign_block_vars('postrow', array( 'ROW' => $row_class, 'MESSAGE' => $mxshout[$i]['text'], 'DATETIME' => create_date($board_config['default_dateformat'], $mxshout[$i]['time'], $board_config['board_timezone']), ! 'DEL_IMG' => $delimg, 'EDT_IMG' => $edtimg, ! 'U_DELETE' => $delurl, 'U_EDIT' => $edturl, 'U_USER_PROFILE' => $userurl, ! 'L_CONFIRM_DELETE' => $lang['Shout_delete_shout'] )); ! } // loop } // if ($mxshout) ! /**************************** Can user shout? if so, display form, --- 391,419 ---- $edtimg = ''; } ! ! } // Change row colors $row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2']; $row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2']; ! $template->assign_block_vars('postrow', array( 'ROW' => $row_class, 'MESSAGE' => $mxshout[$i]['text'], 'DATETIME' => create_date($board_config['default_dateformat'], $mxshout[$i]['time'], $board_config['board_timezone']), ! 'DEL_IMG' => $delimg, 'EDT_IMG' => $edtimg, ! 'U_DELETE' => $delurl, 'U_EDIT' => $edturl, 'U_USER_PROFILE' => $userurl, ! 'L_CONFIRM_DELETE' => $lang['Shout_delete_shout'] )); ! } // loop } // if ($mxshout) ! /**************************** Can user shout? if so, display form, *************** *** 422,426 **** if ( !$userdata['session_logged_in'] ) { ! if ( $shout_config['allow_guest'] != 0 ) { $template->assign_block_vars('switch_logged_in', array()); --- 422,426 ---- if ( !$userdata['session_logged_in'] ) { ! if ( $shout_config['allow_guest'] != 0 ) { $template->assign_block_vars('switch_logged_in', array()); *************** *** 436,440 **** $template->assign_block_vars('switch_logged_in', array()); } ! /**************************** Start output to page --- 436,440 ---- $template->assign_block_vars('switch_logged_in', array()); } ! /**************************** Start output to page |