You can subscribe to this list here.
| 2005 |
Jan
|
Feb
|
Mar
(95) |
Apr
(270) |
May
(111) |
Jun
|
Jul
|
Aug
(64) |
Sep
(130) |
Oct
(319) |
Nov
(17) |
Dec
(191) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2006 |
Jan
(53) |
Feb
|
Mar
|
Apr
|
May
(6) |
Jun
(387) |
Jul
(102) |
Aug
(247) |
Sep
(120) |
Oct
(1) |
Nov
(8) |
Dec
(21) |
| 2007 |
Jan
(38) |
Feb
(36) |
Mar
|
Apr
(32) |
May
(135) |
Jun
(523) |
Jul
(192) |
Aug
(103) |
Sep
(533) |
Oct
(77) |
Nov
(23) |
Dec
(203) |
| 2008 |
Jan
(312) |
Feb
(1193) |
Mar
(404) |
Apr
(67) |
May
(62) |
Jun
(497) |
Jul
(297) |
Aug
(110) |
Sep
(335) |
Oct
(256) |
Nov
(50) |
Dec
(118) |
| 2009 |
Jan
(67) |
Feb
(10) |
Mar
(1) |
Apr
(1) |
May
|
Jun
(10) |
Jul
(61) |
Aug
|
Sep
(16) |
Oct
(45) |
Nov
(12) |
Dec
(14) |
| 2010 |
Jan
(30) |
Feb
|
Mar
|
Apr
(4) |
May
|
Jun
|
Jul
(7) |
Aug
(7) |
Sep
(5) |
Oct
(5) |
Nov
|
Dec
|
| 2011 |
Jan
(7) |
Feb
(3) |
Mar
(89) |
Apr
(11) |
May
(5) |
Jun
|
Jul
(8) |
Aug
(1) |
Sep
(2) |
Oct
|
Nov
(2) |
Dec
(89) |
| 2012 |
Jan
(7) |
Feb
(1) |
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(4) |
Sep
(3) |
Oct
(42) |
Nov
(1) |
Dec
|
| 2013 |
Jan
|
Feb
|
Mar
(19) |
Apr
(90) |
May
(38) |
Jun
(235) |
Jul
(38) |
Aug
(10) |
Sep
|
Oct
(29) |
Nov
|
Dec
|
| 2014 |
Jan
|
Feb
|
Mar
|
Apr
(6) |
May
(52) |
Jun
|
Jul
(7) |
Aug
|
Sep
(17) |
Oct
|
Nov
|
Dec
|
|
From: Jon O. <jon...@us...> - 2006-06-25 21:56:00
|
Update of /cvsroot/mxbb/mx_pafiledb/pafiledb/includes In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv26492/modules/mx_pafiledb/pafiledb/includes Modified Files: functions_comment.php functions_pafiledb.php Log Message: Implementing a new mx_post class, to handle all kind of html, bbcode, smilies, links, images etc Index: functions_comment.php =================================================================== RCS file: /cvsroot/mxbb/mx_pafiledb/pafiledb/includes/functions_comment.php,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** functions_comment.php 17 Jun 2006 20:13:22 -0000 1.20 --- functions_comment.php 25 Jun 2006 21:55:56 -0000 1.21 *************** *** 144,147 **** --- 144,154 ---- // + // Toggles + // + $bbcode_on = !$pafiledb_config['allow_wysiwyg'] ? ($pafiledb_config['allow_bbcode'] ? true : false) : false; + $html_on = !$pafiledb_config['allow_wysiwyg'] ? ($pafiledb_config['allow_html'] ? true : false) : true; + $smilies_on = !$pafiledb_config['allow_wysiwyg'] ? ($pafiledb_config['allow_smilies'] ? true : false) : false; + + // // page number (only used for kb articles) // *************** *** 161,167 **** // ! // Includes // ! include_once($phpbb_root_path . 'includes/bbcode.'.$phpEx); $pafiledb_template->assign_block_vars( 'use_comments', array( --- 168,177 ---- // ! // Instantiate the mx_text class // ! include_once($mx_root_path . 'includes/mx_functions_tools.'.$phpEx); ! $mx_text = new mx_text(); ! $mx_text->init($html_on, $bbcode_on, $smilies_on); // Note: allowed_html_tags is altered above ! $mx_text->allow_all_html_tags = $pafiledb_config['allow_wysiwyg'] ? true : false; $pafiledb_template->assign_block_vars( 'use_comments', array( *************** *** 170,180 **** // - // Define censored word matches - // - $orig_word = array(); - $replacement_word = array(); - obtain_word_list( $orig_word, $replacement_word ); - - // // Get all comments // --- 180,183 ---- *************** *** 187,199 **** { $time = create_date( $board_config['default_dateformat'], $this->comments_row['comments_time'], $board_config['board_timezone'] ); - $comments_text = $this->comments_row['comments_text']; ! if ( !$pafiledb_config['allow_html'] ) ! { ! if ( $comments_text != '' && $userdata['user_allowhtml'] ) ! { ! $comments_text = preg_replace( '#(<)([\/]?.*?)(>)#is', "<\\2>", $comments_text ); ! } ! } // --- 190,199 ---- { $time = create_date( $board_config['default_dateformat'], $this->comments_row['comments_time'], $board_config['board_timezone'] ); ! // ! // Decode comment for display ! // ! $comments_title = $mx_text->display_simple($this->comments_row['comments_title']); ! $comments_text = $mx_text->display($this->comments_row['comments_text'], $this->comments_row['comment_bbcode_uid']); // *************** *** 202,235 **** if (!$pafiledb_config['allow_comment_images'] || !$pafiledb_config['allow_comment_links']) { - $comments_text = $mx_pa_text_tools->remove_images_links( $comments_text, $pafiledb_config['allow_comment_images'], $pafiledb_config['no_comment_image_message'], $pafiledb_config['allow_comment_links'], $pafiledb_config['no_comment_link_message'] ); } - if ( $pafiledb_config['allow_bbcode'] ) - { - if ( $comments_text != '' && $this->comments_row['comment_bbcode_uid'] != '' ) - { - $comments_text = ( $pafiledb_config['allow_bbcode'] ) ? bbencode_second_pass( $comments_text, $this->comments_row['comment_bbcode_uid'] ) : preg_replace( '/\:[0-9a-z\:]+\]/si', ']', $comments_text ); - } - } - - $comments_text = make_clickable( $comments_text ); - - if ( count( $orig_word ) ) - { - if ( $comments_text != '' ) - { - $comments_text = preg_replace( $orig_word, $replacement_word, $comments_text ); - } - } - - if ( $pafiledb_config['allow_smilies'] ) - { - if ( $userdata['user_allowsmile'] && $comments_text != '' ) - { - $comments_text = mx_smilies_pass( $comments_text ); - } - } - $poster = ( $this->comments_row['user_id'] == ANONYMOUS ) ? $lang['Guest'] : $this->comments_row['username']; $poster_avatar = ''; --- 202,208 ---- *************** *** 282,288 **** } - $comments_title = $this->comments_row['comments_title']; - $comments_text = str_replace( "\n", "\n<br />\n", $comments_text ); - // // Text formatting --- 255,258 ---- *************** *** 382,385 **** --- 352,362 ---- // + // Toggles + // + $bbcode_on = !$pafiledb_config['allow_wysiwyg'] ? ($pafiledb_config['allow_bbcode'] ? true : false) : false; + $html_on = !$pafiledb_config['allow_wysiwyg'] ? ($pafiledb_config['allow_html'] ? true : false) : true; + $smilies_on = !$pafiledb_config['allow_wysiwyg'] ? ($pafiledb_config['allow_smilies'] ? true : false) : false; + + // // page number (only used for kb articles) // *************** *** 399,405 **** // ! // Includes // ! include_once($phpbb_root_path . 'includes/bbcode.'.$phpEx); $pafiledb_template->assign_block_vars( 'use_comments', array( --- 376,385 ---- // ! // Instantiate the mx_text class // ! include_once($mx_root_path . 'includes/mx_functions_tools.'.$phpEx); ! $mx_text = new mx_text(); ! $mx_text->init($html_on, $bbcode_on, $smilies_on); // Note: allowed_html_tags is altered above ! $mx_text->allow_all_html_tags = $pafiledb_config['allow_wysiwyg'] ? true : false; $pafiledb_template->assign_block_vars( 'use_comments', array( *************** *** 408,418 **** // - // Define censored word matches - // - $orig_word = array(); - $replacement_word = array(); - obtain_word_list( $orig_word, $replacement_word ); - - // // Get all comments // --- 388,391 ---- *************** *** 439,463 **** $poster_rank = $lang['Guest']; } - $comments_title = ( $this->comments_row['post_subject'] != '' ) ? $this->comments_row['post_subject'] : ''; - - $comments_text = $this->comments_row['post_text']; - $bbcode_uid = $this->comments_row['bbcode_uid']; // ! // If the board has HTML off but the post has HTML ! // on then we process it, else leave it alone // ! if ( !$board_config['allow_html'] ) ! { ! if ( $user_sig != '' && $userdata['user_allowhtml'] ) ! { ! $user_sig = preg_replace( '#(<)([\/]?.*?)(>)#is', "<\\2>", $user_sig ); ! } ! ! if ( $this->comments_row['enable_html'] ) ! { ! $comments_text = preg_replace( '#(<)([\/]?.*?)(>)#is', "<\\2>", $comments_text ); ! } ! } // --- 412,422 ---- $poster_rank = $lang['Guest']; } // ! // Decode comment for display // ! $comments_title = $mx_text->display_simple($this->comments_row['post_subject']); ! $comments_text = $mx_text->display($this->comments_row['post_text'], $this->comments_row['bbcode_uid']); ! $user_sig = $mx_text->display($this->comments_row['user_sig'], $this->comments_row['user_sig_bbcode_uid']); // *************** *** 466,513 **** if (!$pafiledb_config['allow_comment_images'] || !$pafiledb_config['allow_comment_links']) { - $comments_text = $mx_pa_text_tools->remove_images_links( $comments_text, $pafiledb_config['allow_comment_images'], $pafiledb_config['no_comment_image_message'], $pafiledb_config['allow_comment_links'], $pafiledb_config['no_comment_link_message'] ); } // - // Parse message and/or sig for BBCode if reqd - // - if ( $board_config['allow_bbcode'] ) - { - if ( $user_sig != '' && $user_sig_bbcode_uid != '' ) - { - $user_sig = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass( $user_sig, $user_sig_bbcode_uid ) : preg_replace( '/\:[0-9a-z\:]+\]/si', ']', $user_sig ); - } - - if ( $bbcode_uid != '' ) - { - $comments_text = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass( $comments_text, $bbcode_uid ) : preg_replace( '/\:[0-9a-z\:]+\]/si', ']', $comments_text ); - } - } - - if ( $user_sig != '' ) - { - $user_sig = make_clickable( $user_sig ); - } - $comments_text = make_clickable( $comments_text ); - - // - // Parse smilies - // - if ( $board_config['allow_smilies'] ) - { - if ( $this->comments_row['user_allowsmile'] && $user_sig != '' ) - { - $user_sig = mx_smilies_pass( $user_sig ); - } - - if ( $this->comments_row['enable_smilies'] ) - { - $comments_text = mx_smilies_pass( $comments_text ); - } - } - $comments_text = str_replace( "\n", "\n<br />\n", $comments_text ); - - // // Text formatting // --- 425,432 ---- Index: functions_pafiledb.php =================================================================== RCS file: /cvsroot/mxbb/mx_pafiledb/pafiledb/includes/functions_pafiledb.php,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** functions_pafiledb.php 17 Jun 2006 20:13:22 -0000 1.28 --- functions_pafiledb.php 25 Jun 2006 21:55:56 -0000 1.29 *************** *** 2521,2533 **** $length = strlen( $message ); - $title = ( !empty( $subject ) ) ? htmlspecialchars( trim ( $subject ) ) : ''; // ! // Formatting // ! $comment_bbcode_uid = make_bbcode_uid(); ! $comments_text = str_replace( '<br />', "\n", $message ); ! $comments_text = prepare_message( trim($comments_text), $html_on, $bbcode_on, $smilies_on, $comment_bbcode_uid ); ! $comments_text = bbencode_first_pass( $comments_text, $comment_bbcode_uid ); if ( $length > $pafiledb_config['max_comment_chars'] ) --- 2521,2539 ---- $length = strlen( $message ); // ! // Instantiate the mx_text class // ! include_once($mx_root_path . 'includes/mx_functions_tools.'.$phpEx); ! $mx_text = new mx_text(); ! $mx_text->init($html_on, $bbcode_on, $smilies_on); ! //$mx_text->allow_all_html_tags = $parameter_data['parameter_type'] = 'WysiwygTextBlock' ? true : false; ! ! // ! // Encode for db storage ! // ! $title = $mx_text->encode_simple($subject); ! $comments_text = $mx_text->encode($message); ! $comment_bbcode_uid = $mx_text->bbcode_uid; if ( $length > $pafiledb_config['max_comment_chars'] ) |
|
From: Jon O. <jon...@us...> - 2006-06-25 21:55:59
|
Update of /cvsroot/mxbb/mx_pafiledb/pafiledb/modules In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv26492/modules/mx_pafiledb/pafiledb/modules Modified Files: pa_post_comment.php Log Message: Implementing a new mx_post class, to handle all kind of html, bbcode, smilies, links, images etc Index: pa_post_comment.php =================================================================== RCS file: /cvsroot/mxbb/mx_pafiledb/pafiledb/modules/pa_post_comment.php,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** pa_post_comment.php 17 Jun 2006 20:13:22 -0000 1.15 --- pa_post_comment.php 25 Jun 2006 21:55:56 -0000 1.16 *************** *** 32,41 **** // - // Includes - // - include_once($phpbb_root_path . 'includes/bbcode.'.$phpEx); - include_once( $phpbb_root_path . 'includes/functions_post.' . $phpEx ); - - // // Request vars // --- 32,35 ---- *************** *** 56,62 **** $preview = $mx_request_vars->is_request('preview'); - $subject = ( !empty( $_POST['subject'] ) ) ? htmlspecialchars( trim( stripslashes( $_POST['subject'] ) ) ) : ''; - $message = ( !empty( $_POST['message'] ) ) ? htmlspecialchars( trim( stripslashes( $_POST['message'] ) ) ) : ''; - $sql = "SELECT * FROM " . PA_FILES_TABLE . " --- 50,53 ---- *************** *** 86,89 **** --- 77,129 ---- } + if ( $mx_request_vars->is_get('cid') ) + { + if ( $this->comments[$file_data['file_catid']]['internal_comments'] ) + { + // + // Query internal comment to edit + // + $sql = 'SELECT c.*, u.* + FROM ' . PA_COMMENTS_TABLE . ' AS c + LEFT JOIN ' . USERS_TABLE . " AS u ON c.poster_id = u.user_id + WHERE c.file_id = '" . $item_id . "' + AND c.comments_id = '" . $mx_request_vars->request('cid', MX_TYPE_INT, '') . "'"; + + $comment_arg_title = 'comments_title'; + $comment_arg_message = 'comments_text'; + $comment_arg_bbcode_uid = 'comment_bbcode_uid'; + } + else + { + // + // Query internal comment to edit + // Note: cid = post_id + // + $sql = "SELECT u.username, u.user_id, u.user_posts, u.user_from, u.user_website, u.user_email, u.user_icq, u.user_aim, u.user_yim, u.user_regdate, u.user_msnm, u.user_viewemail, u.user_rank, u.user_sig, u.user_sig_bbcode_uid, u.user_avatar, u.user_avatar_type, u.user_allowavatar, u.user_allowsmile, p.*, pt.post_text, pt.post_subject, pt.bbcode_uid + FROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u, " . POSTS_TEXT_TABLE . " pt + WHERE pt.post_id = p.post_id + AND u.user_id = p.poster_id + AND p.post_id = '" . $mx_request_vars->request('cid', MX_TYPE_INT, '') . "'"; + + $comment_arg_title = 'post_subject'; + $comment_arg_message = 'post_text'; + $comment_arg_bbcode_uid = 'bbcode_uid'; + } + + if ( !( $result = $db->sql_query( $sql ) ) ) + { + mx_message_die( GENERAL_ERROR, 'Couldnt select comments', '', __LINE__, __FILE__, $sql ); + } + + $comment_row = $db->sql_fetchrow( $result ); + } + + $comment_title = $preview || isset($_POST['subject']) ? $_POST['subject'] : $comment_row[$comment_arg_title]; + $comment_body = $preview || isset($_POST['message']) ? $_POST['message'] : $comment_row[$comment_arg_message]; + $bbcode_uid = $preview ? '' : $comment_row[$comment_arg_bbcode_uid]; + + // + // Toggles + // $html_on = ( $pafiledb_config['allow_comment_html'] ) ? true : 0; $bbcode_on = ( $pafiledb_config['allow_comment_bbcode'] ) ? true : 0; *************** *** 92,95 **** --- 132,149 ---- $images_on = ( $pafiledb_config['allow_comment_images'] ) ? true : 0; + // + // Instantiate the mx_text class + // + include_once($mx_root_path . 'includes/mx_functions_tools.'.$phpEx); + $mx_text = new mx_text(); + $mx_text->init($html_on, $bbcode_on, $smilies_on); + + // + // Allow all html tags + // Fix: Setting 'emtpy' enables all + // + //$mx_text->allow_all_html_tags = $allow_wysiwyg; // Not yet implemented for comments + + // ======================================================= // Delete *************** *** 139,401 **** // ======================================================= ! // Main // ======================================================= ! if ( !$submit ) { ! // ! // Instatiate text tools ! // ! $mx_pa_text_tools = new mx_pa_text_tools(); ! ! // ! // Generate smilies listing for page output ! // ! $pafiledb_functions->pa_generate_smilies( 'inline', PAGE_POSTING ); ! $html_status = ( $html_on ) ? $lang['HTML_is_ON'] : $lang['HTML_is_OFF']; ! $bbcode_status = ( $bbcode_on ) ? $lang['BBCode_is_ON'] : $lang['BBCode_is_OFF']; ! $smilies_status = ( $smilies_on ) ? $lang['Smilies_are_ON'] : $lang['Smilies_are_OFF']; ! $links_status = ( $links_on ) ? $lang['Links_are_ON'] : $lang['Links_are_OFF']; ! $images_status = ( $images_on ) ? $lang['Images_are_ON'] : $lang['Images_are_OFF']; ! ! if ( $mx_request_vars->is_get('cid') ) ! { ! if ( $this->comments[$file_data['file_catid']]['internal_comments'] ) ! { ! // ! // Query internal comment to edit ! // ! $sql = 'SELECT c.*, u.* ! FROM ' . PA_COMMENTS_TABLE . ' AS c ! LEFT JOIN ' . USERS_TABLE . " AS u ON c.poster_id = u.user_id ! WHERE c.file_id = '" . $item_id . "' ! AND c.comments_id = '" . $mx_request_vars->request('cid', MX_TYPE_INT, '') . "'"; ! ! $comment_arg_title = 'comments_title'; ! $comment_arg_message = 'comments_text'; ! $comment_arg_bbcode_uid = 'comment_bbcode_uid'; ! } ! else ! { ! // ! // Query internal comment to edit ! // Note: cid = post_id ! // ! $sql = "SELECT u.username, u.user_id, u.user_posts, u.user_from, u.user_website, u.user_email, u.user_icq, u.user_aim, u.user_yim, u.user_regdate, u.user_msnm, u.user_viewemail, u.user_rank, u.user_sig, u.user_sig_bbcode_uid, u.user_avatar, u.user_avatar_type, u.user_allowavatar, u.user_allowsmile, p.*, pt.post_text, pt.post_subject, pt.bbcode_uid ! FROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u, " . POSTS_TEXT_TABLE . " pt ! WHERE pt.post_id = p.post_id ! AND u.user_id = p.poster_id ! AND p.post_id = '" . $mx_request_vars->request('cid', MX_TYPE_INT, '') . "'"; ! ! $comment_arg_title = 'post_subject'; ! $comment_arg_message = 'post_text'; ! $comment_arg_bbcode_uid = 'bbcode_uid'; ! ! } ! if ( !( $result = $db->sql_query( $sql ) ) ) ! { ! mx_message_die( GENERAL_ERROR, 'Couldnt select comments', '', __LINE__, __FILE__, $sql ); ! } ! $comment_row = $db->sql_fetchrow( $result ); ! // ! // Edit comment ! // ! $comment_title = stripslashes($comment_row[$comment_arg_title]); ! $comment_body = $comment_row[$comment_arg_message]; ! if ( $comment_row[$comment_arg_bbcode_uid] != '' ) ! { ! $comment_body = preg_replace('/\:(([a-z0-9]:)?)' . $comment_row[$comment_arg_bbcode_uid] . '/s', '', $comment_body); ! } ! $comment_body = str_replace('<', '<', $comment_body); ! $comment_body = str_replace('>', '>', $comment_body); ! $comment_body = str_replace('<br />', "\n", $comment_body); ! $hidden_form_fields = '<input type="hidden" name="action" value="post_comment"> ! <input type="hidden" name="cat_id" value="' . $cat_id . '"> ! <input type="hidden" name="item_id" value="' . $item_id . '"> ! <input type="hidden" name="cid" value="' . $mx_request_vars->request('cid', MX_TYPE_INT, '') . '"> ! <input type="hidden" name="comment" value="post">'; ! } ! else { ! // ! // New comment ! // ! $comment_title = ''; ! $comment_body = ''; ! ! $hidden_form_fields = '<input type="hidden" name="action" value="post_comment"> ! <input type="hidden" name="cat_id" value="' . $cat_id . '"> ! <input type="hidden" name="item_id" value="' . $item_id . '"> ! <input type="hidden" name="comment" value="post">'; } - // - // Output the data to the template - // $pafiledb_template->assign_vars( array( - 'HTML_STATUS' => $html_status, - 'BBCODE_STATUS' => sprintf( $bbcode_status, '<a href="' . append_sid( "faq.$phpEx?mode=bbcode" ) . '" target="_phpbbcode">', '</a>' ), - 'SMILIES_STATUS' => $smilies_status, - 'LINKS_STATUS' => $links_status, - 'IMAGES_STATUS' => $images_status, - 'FILE_NAME' => $file_data['file_name'], - 'DOWNLOAD' => $pafiledb_config['module_name'], - 'MESSAGE_LENGTH' => $pafiledb_config['max_comment_chars'], - - 'TITLE' => $comment_title, - 'COMMENT' => $comment_body, - - 'L_COMMENT_ADD' => $lang['Comment_add'], - 'L_COMMENT' => $lang['Message_body'], - 'L_COMMENT_TITLE' => $lang['Subject'], - 'L_OPTIONS' => $lang['Options'], - 'L_COMMENT_EXPLAIN' => sprintf( $lang['Comment_explain'], $pafiledb_config['max_comment_chars'] ), 'L_PREVIEW' => $lang['Preview'], ! 'L_SUBMIT' => $lang['Submit'], ! 'L_DOWNLOAD' => $lang['Download'], ! ! 'L_INDEX' => "<<", ! 'L_CHECK_MSG_LENGTH' => $lang['Check_message_length'], ! 'L_MSG_LENGTH_1' => $lang['Msg_length_1'], ! 'L_MSG_LENGTH_2' => $lang['Msg_length_2'], ! 'L_MSG_LENGTH_3' => $lang['Msg_length_3'], ! 'L_MSG_LENGTH_4' => $lang['Msg_length_4'], ! 'L_MSG_LENGTH_5' => $lang['Msg_length_5'], ! 'L_MSG_LENGTH_6' => $lang['Msg_length_6'], ! ! 'L_BBCODE_B_HELP' => $lang['bbcode_b_help'], ! 'L_BBCODE_I_HELP' => $lang['bbcode_i_help'], ! 'L_BBCODE_U_HELP' => $lang['bbcode_u_help'], ! 'L_BBCODE_Q_HELP' => $lang['bbcode_q_help'], ! 'L_BBCODE_C_HELP' => $lang['bbcode_c_help'], ! 'L_BBCODE_L_HELP' => $lang['bbcode_l_help'], ! 'L_BBCODE_O_HELP' => $lang['bbcode_o_help'], ! 'L_BBCODE_P_HELP' => $lang['bbcode_p_help'], ! 'L_BBCODE_W_HELP' => $lang['bbcode_w_help'], ! 'L_BBCODE_A_HELP' => $lang['bbcode_a_help'], ! 'L_BBCODE_S_HELP' => $lang['bbcode_s_help'], ! 'L_BBCODE_F_HELP' => $lang['bbcode_f_help'], ! 'L_EMPTY_MESSAGE' => $lang['Empty_message'], ! ! 'L_FONT_COLOR' => $lang['Font_color'], ! 'L_COLOR_DEFAULT' => $lang['color_default'], ! 'L_COLOR_DARK_RED' => $lang['color_dark_red'], ! 'L_COLOR_RED' => $lang['color_red'], ! 'L_COLOR_ORANGE' => $lang['color_orange'], ! 'L_COLOR_BROWN' => $lang['color_brown'], ! 'L_COLOR_YELLOW' => $lang['color_yellow'], ! 'L_COLOR_GREEN' => $lang['color_green'], ! 'L_COLOR_OLIVE' => $lang['color_olive'], ! 'L_COLOR_CYAN' => $lang['color_cyan'], ! 'L_COLOR_BLUE' => $lang['color_blue'], ! 'L_COLOR_DARK_BLUE' => $lang['color_dark_blue'], ! 'L_COLOR_INDIGO' => $lang['color_indigo'], ! 'L_COLOR_VIOLET' => $lang['color_violet'], ! 'L_COLOR_WHITE' => $lang['color_white'], ! 'L_COLOR_BLACK' => $lang['color_black'], ! ! 'L_FONT_SIZE' => $lang['Font_size'], ! 'L_FONT_TINY' => $lang['font_tiny'], ! 'L_FONT_SMALL' => $lang['font_small'], ! 'L_FONT_NORMAL' => $lang['font_normal'], ! 'L_FONT_LARGE' => $lang['font_large'], ! 'L_FONT_HUGE' => $lang['font_huge'], ! 'L_BBCODE_CLOSE_TAGS' => $lang['Close_Tags'], ! 'L_STYLES_TIP' => $lang['Styles_tip'], ! ! 'U_INDEX' => append_sid( $mx_root_path . 'index.' . $phpEx ), ! 'U_DOWNLOAD_HOME' => append_sid( pa_this_mxurl() ), ! 'U_FILE_NAME' => append_sid( pa_this_mxurl( 'action=file&item_id=' . $item_id ) ), ! ! 'S_POST_ACTION' => append_sid( pa_this_mxurl() ), ! 'S_HIDDEN_FORM_FIELDS' => $hidden_form_fields ) ); // ! // Show preview stuff if user clicked preview // ! if ( $preview ) ! { ! $orig_word = array(); ! $replacement_word = array(); ! obtain_word_list( $orig_word, $replacement_word ); ! ! $comment_bbcode_uid = ( $bbcode_on ) ? make_bbcode_uid() : ''; ! $comments_text = stripslashes( prepare_message( addslashes( unprepare_message( $message ) ), $html_on, $bbcode_on, $smilies_on, $comment_bbcode_uid ) ); ! $title = $subject; ! if ( !$html_on ) ! { ! // ! // ! // ! $comments_text = preg_replace( '#(<)([\/]?.*?)(>)#is', "<\\2>", $comments_text ); ! } ! // Now we run comment suite before checking for smilies ! // so admins can add them in messages if they like ! // and so smilies are not counted as images in sigs. ! // this is done here again incase above conditions are ! // not met. ! if (!$pafiledb_config['allow_comment_images'] || !$pafiledb_config['allow_comment_links']) ! { ! $comments_text = $mx_kb_text_tools->remove_images_links( $comments_text, $pafiledb_config['allow_comment_images'], $pafiledb_config['no_comment_image_message'], $pafiledb_config['allow_comment_links'], $pafiledb_config['no_comment_link_message'] ); ! } ! if ( $bbcode_on ) ! { ! // ! // ! // ! $comments_text = bbencode_second_pass( $comments_text, $comment_bbcode_uid ); // : preg_replace('/\:[0-9a-z\:]+\]/si', ']', $comments_text); ! } ! if ( !empty( $orig_word ) ) ! { ! $title = ( !empty( $title ) ) ? preg_replace( $orig_word, $replacement_word, $title ) : ''; ! $comments_text = ( !empty( $comments_text ) ) ? preg_replace( $orig_word, $replacement_word, $comments_text ) : ''; ! } ! // ! // Make Clickable ! // ! $comments_text = make_clickable( $comments_text ); ! // ! // Parse smilies ! // ! if ( $smilies_on ) ! { ! $comments_text = smilies_pass( $comments_text ); ! } ! $comments_text = str_replace( "\n", '<br />', $comments_text ); ! $pafiledb_template->assign_vars( array( ! 'PREVIEW' => true, ! 'COMMENT' => stripslashes( $_POST['message'] ), ! 'SUBJECT' => stripslashes( $_POST['subject'] ), ! 'PRE_COMMENT' => $comments_text ) ! ); ! } ! } ! // ======================================================= ! // Submit ! // ======================================================= ! if ( $submit ) ! { ! $this->update_add_comment($file_data, $item_id, $cid, '', '', $html_on, $bbcode_on, $smilies_on); ! $message = $lang['Comment_posted'] . '<br /><br />' . sprintf( $lang['Click_return'], '<a href="' . append_sid( pa_this_mxurl( 'action=file&file_id=' . $item_id ) ) . '">', '</a>' ); ! mx_message_die( GENERAL_MESSAGE, $message ); ! } // =================================================== --- 193,365 ---- // ======================================================= ! // Submit // ======================================================= ! if ( $submit ) { ! $this->update_add_comment($file_data, $item_id, $cid, '', '', $html_on, $bbcode_on, $smilies_on); ! $message = $lang['Comment_posted'] . '<br /><br />' . sprintf( $lang['Click_return'], '<a href="' . append_sid( pa_this_mxurl( 'action=file&file_id=' . $item_id ) ) . '">', '</a>' ); ! mx_message_die( GENERAL_MESSAGE, $message ); ! } ! // ======================================================= ! // Main ! // ======================================================= ! // ! // Instatiate text tools ! // ! $mx_pa_text_tools = new mx_pa_text_tools(); ! // ! // Generate smilies listing for page output ! // ! $pafiledb_functions->pa_generate_smilies( 'inline', PAGE_POSTING ); ! $html_status = ( $html_on ) ? $lang['HTML_is_ON'] : $lang['HTML_is_OFF']; ! $bbcode_status = ( $bbcode_on ) ? $lang['BBCode_is_ON'] : $lang['BBCode_is_OFF']; ! $smilies_status = ( $smilies_on ) ? $lang['Smilies_are_ON'] : $lang['Smilies_are_OFF']; ! $links_status = ( $links_on ) ? $lang['Links_are_ON'] : $lang['Links_are_OFF']; ! $images_status = ( $images_on ) ? $lang['Images_are_ON'] : $lang['Images_are_OFF']; ! if ( $preview ) ! { ! // ! // Encode for preview ! // ! $preview_title = $mx_text->encode_preview_simple($comment_title); ! $preview_text = $mx_text->encode_preview($comment_body); ! if (!$kb_config['allow_images'] || !$kb_config['allow_links']) { ! $preview_text = $mx_kb_text_tools->remove_images_links( $preview_text, $kb_config['allow_images'], $kb_config['no_image_message'], $kb_config['allow_links'], $kb_config['no_link_message'] ); } + $template->set_filenames( array( 'preview' => 'kb_post_preview.tpl' ) ); $pafiledb_template->assign_vars( array( 'L_PREVIEW' => $lang['Preview'], ! 'PREVIEW' => true, ! 'COMMENT' => $preview_text, ! 'SUBJECT' => $preview_title, ! 'PRE_COMMENT' => $comments_text ) ); // ! // Decode for form editing // ! $comment_title = $mx_text->decode_simple($comment_title, true); ! $comment_body = $mx_text->decode($comment_body, '', true); ! } ! else ! { ! // Decode for form editing ! // ! $comment_title = $mx_text->decode_simple($comment_title); ! $comment_body = $mx_text->decode($comment_body, $bbcode_uid); ! } ! if ( $mx_request_vars->is_get('cid') ) ! { ! $hidden_form_fields = '<input type="hidden" name="action" value="post_comment"> ! <input type="hidden" name="cat_id" value="' . $cat_id . '"> ! <input type="hidden" name="item_id" value="' . $item_id . '"> ! <input type="hidden" name="cid" value="' . $mx_request_vars->request('cid', MX_TYPE_INT, '') . '"> ! <input type="hidden" name="comment" value="post">'; ! } ! else ! { ! // ! // New comment ! // ! $comment_title = ''; ! $comment_body = ''; ! $hidden_form_fields = '<input type="hidden" name="action" value="post_comment"> ! <input type="hidden" name="cat_id" value="' . $cat_id . '"> ! <input type="hidden" name="item_id" value="' . $item_id . '"> ! <input type="hidden" name="comment" value="post">'; ! } ! // ! // Output the data to the template ! // ! $pafiledb_template->assign_vars( array( ! 'HTML_STATUS' => $html_status, ! 'BBCODE_STATUS' => sprintf( $bbcode_status, '<a href="' . append_sid( "faq.$phpEx?mode=bbcode" ) . '" target="_phpbbcode">', '</a>' ), ! 'SMILIES_STATUS' => $smilies_status, ! 'LINKS_STATUS' => $links_status, ! 'IMAGES_STATUS' => $images_status, ! 'FILE_NAME' => $file_data['file_name'], ! 'DOWNLOAD' => $pafiledb_config['module_name'], ! 'MESSAGE_LENGTH' => $pafiledb_config['max_comment_chars'], ! 'TITLE' => $comment_title, ! 'COMMENT' => $comment_body, ! 'L_COMMENT_ADD' => $lang['Comment_add'], ! 'L_COMMENT' => $lang['Message_body'], ! 'L_COMMENT_TITLE' => $lang['Subject'], ! 'L_OPTIONS' => $lang['Options'], ! 'L_COMMENT_EXPLAIN' => sprintf( $lang['Comment_explain'], $pafiledb_config['max_comment_chars'] ), ! 'L_PREVIEW' => $lang['Preview'], ! 'L_SUBMIT' => $lang['Submit'], ! 'L_DOWNLOAD' => $lang['Download'], ! 'L_INDEX' => "<<", ! 'L_CHECK_MSG_LENGTH' => $lang['Check_message_length'], ! 'L_MSG_LENGTH_1' => $lang['Msg_length_1'], ! 'L_MSG_LENGTH_2' => $lang['Msg_length_2'], ! 'L_MSG_LENGTH_3' => $lang['Msg_length_3'], ! 'L_MSG_LENGTH_4' => $lang['Msg_length_4'], ! 'L_MSG_LENGTH_5' => $lang['Msg_length_5'], ! 'L_MSG_LENGTH_6' => $lang['Msg_length_6'], ! 'L_BBCODE_B_HELP' => $lang['bbcode_b_help'], ! 'L_BBCODE_I_HELP' => $lang['bbcode_i_help'], ! 'L_BBCODE_U_HELP' => $lang['bbcode_u_help'], ! 'L_BBCODE_Q_HELP' => $lang['bbcode_q_help'], ! 'L_BBCODE_C_HELP' => $lang['bbcode_c_help'], ! 'L_BBCODE_L_HELP' => $lang['bbcode_l_help'], ! 'L_BBCODE_O_HELP' => $lang['bbcode_o_help'], ! 'L_BBCODE_P_HELP' => $lang['bbcode_p_help'], ! 'L_BBCODE_W_HELP' => $lang['bbcode_w_help'], ! 'L_BBCODE_A_HELP' => $lang['bbcode_a_help'], ! 'L_BBCODE_S_HELP' => $lang['bbcode_s_help'], ! 'L_BBCODE_F_HELP' => $lang['bbcode_f_help'], ! 'L_EMPTY_MESSAGE' => $lang['Empty_message'], ! 'L_FONT_COLOR' => $lang['Font_color'], ! 'L_COLOR_DEFAULT' => $lang['color_default'], ! 'L_COLOR_DARK_RED' => $lang['color_dark_red'], ! 'L_COLOR_RED' => $lang['color_red'], ! 'L_COLOR_ORANGE' => $lang['color_orange'], ! 'L_COLOR_BROWN' => $lang['color_brown'], ! 'L_COLOR_YELLOW' => $lang['color_yellow'], ! 'L_COLOR_GREEN' => $lang['color_green'], ! 'L_COLOR_OLIVE' => $lang['color_olive'], ! 'L_COLOR_CYAN' => $lang['color_cyan'], ! 'L_COLOR_BLUE' => $lang['color_blue'], ! 'L_COLOR_DARK_BLUE' => $lang['color_dark_blue'], ! 'L_COLOR_INDIGO' => $lang['color_indigo'], ! 'L_COLOR_VIOLET' => $lang['color_violet'], ! 'L_COLOR_WHITE' => $lang['color_white'], ! 'L_COLOR_BLACK' => $lang['color_black'], ! 'L_FONT_SIZE' => $lang['Font_size'], ! 'L_FONT_TINY' => $lang['font_tiny'], ! 'L_FONT_SMALL' => $lang['font_small'], ! 'L_FONT_NORMAL' => $lang['font_normal'], ! 'L_FONT_LARGE' => $lang['font_large'], ! 'L_FONT_HUGE' => $lang['font_huge'], ! 'L_BBCODE_CLOSE_TAGS' => $lang['Close_Tags'], ! 'L_STYLES_TIP' => $lang['Styles_tip'], ! 'U_INDEX' => append_sid( $mx_root_path . 'index.' . $phpEx ), ! 'U_DOWNLOAD_HOME' => append_sid( pa_this_mxurl() ), ! 'U_FILE_NAME' => append_sid( pa_this_mxurl( 'action=file&item_id=' . $item_id ) ), ! 'S_POST_ACTION' => append_sid( pa_this_mxurl() ), ! 'S_HIDDEN_FORM_FIELDS' => $hidden_form_fields ) ! ); // =================================================== *************** *** 406,411 **** $this->display( $lang['Download'], 'pa_comment_posting.tpl' ); } - } - ?> \ No newline at end of file --- 370,373 ---- |
|
From: Jon O. <jon...@us...> - 2006-06-25 21:55:16
|
Update of /cvsroot/mxbb/mx_kb/kb/modules In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv26394/modules/mx_kb/kb/modules Modified Files: kb_article.php kb_post.php kb_post_comment.php Log Message: Implementing a new mx_post class, to handle all kind of html, bbcode, smilies, links, images etc Index: kb_article.php =================================================================== RCS file: /cvsroot/mxbb/mx_kb/kb/modules/kb_article.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** kb_article.php 17 Jun 2006 20:11:24 -0000 1.5 --- kb_article.php 25 Jun 2006 21:55:12 -0000 1.6 *************** *** 38,63 **** $page_num = $mx_request_vars->request('page_num', MX_TYPE_INT, 1) - 1; if ( empty( $article_id ) ) { mx_message_die( GENERAL_MESSAGE, $lang['Article_not_exsist'] ); } - - // - // Instatiate text tools - // - $mx_kb_text_tools = new mx_kb_text_tools(); - $sql = "SELECT * FROM " . KB_ARTICLES_TABLE . " WHERE article_id = $article_id"; - if ( !( $result = $db->sql_query( $sql ) ) ) { mx_message_die( GENERAL_ERROR, "Could not obtain article data", '', __LINE__, __FILE__, $sql ); } - - // =================================================== - // article doesn't exist' - // =================================================== if ( !$kb_row = $db->sql_fetchrow( $result ) ) { --- 38,55 ---- $page_num = $mx_request_vars->request('page_num', MX_TYPE_INT, 1) - 1; + // =================================================== + // article doesn't exist' + // =================================================== if ( empty( $article_id ) ) { mx_message_die( GENERAL_MESSAGE, $lang['Article_not_exsist'] ); } $sql = "SELECT * FROM " . KB_ARTICLES_TABLE . " WHERE article_id = $article_id"; if ( !( $result = $db->sql_query( $sql ) ) ) { mx_message_die( GENERAL_ERROR, "Could not obtain article data", '', __LINE__, __FILE__, $sql ); } if ( !$kb_row = $db->sql_fetchrow( $result ) ) { *************** *** 92,193 **** $date = create_date( $board_config['default_dateformat'], $kb_row['article_date'], $board_config['board_timezone'] ); ! // ! // wysiwyg ! // ! if ( $kb_config['allow_wysiwyg'] && file_exists( $mx_root_path . $kb_config['wysiwyg_path'] . 'tinymce/jscripts/tiny_mce/blank.htm' )) ! { ! $wysiwygMode = true; ! $bbcode_on = false; ! $html_on = true; ! $smilies_on = false; ! $html_entities_match = array( ); ! $html_entities_replace = array( ); ! } ! else ! { ! $wysiwygMode = false; ! $bbcode_on = $kb_config['allow_bbcode'] ? true : false; ! $html_on = $kb_config['allow_html'] ? true : false; ! $smilies_on = $kb_config['allow_smilies'] ? true : false; ! $board_config['allow_html_tags'] = $kb_config['allowed_html_tags']; ! } // ! // Define censored word matches // ! $orig_word = array(); ! $replacement_word = array(); ! obtain_word_list($orig_word, $replacement_word); // ! // Get vars // ! $temp_url = append_sid( this_kb_mxurl( "mode=cat&cat=$article_category_id" ) ); ! $category = '<a href="' . $temp_url . '" class="gensmall">' . $article_category_name . '</a>'; ! if ( $author_id == -1 ) ! { ! $author_kb_art = ( $kb_row['username'] == '' ) ? $lang['Guest'] : $kb_row['username']; ! } ! else ! { ! $author_name = $this->get_kb_author( $author_id ); ! $temp_url = append_sid( $phpbb_root_path . "profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$author_id" ); ! $author_kb_art = '<a href="' . $temp_url . '" class="gensmall">' . $author_name . '</a>'; ! } - $art_pages = explode( '[page]', stripslashes( $kb_row['article_body'] ) ); - $article = trim( $art_pages[$page_num] ); - $article = str_replace( '[toc]', '', $article ); $article = $this->article_formatting( $article ); - $type_id = $kb_row['article_type']; - $type = $this->get_kb_type( $type_id ); - $new_views = $kb_row['views'] + 1; - $views = '<b>' . $lang['Views'] . '</b> ' . $new_views; - - if ( $page_num == 0 ) - { - $sql = "UPDATE " . KB_ARTICLES_TABLE . " SET - views = '" . $new_views . "' - WHERE article_id = " . $article_id; - } - if ( !( $result2 = $db->sql_query( $sql ) ) ) - { - mx_message_die( GENERAL_ERROR, "Could not update article's views", '', __LINE__, __FILE__, $sql ); - } - // ! // Was a highlight request part of the URI? // ! $original_highlight = ''; ! $highlight_match = $highlight = ''; ! if (isset($HTTP_GET_VARS['highlight'])) ! { ! // ! // Split words and phrases ! // ! $original_highlight = '&highlight='.trim(htmlspecialchars($HTTP_GET_VARS['highlight'])); ! $words = explode(' ', trim(htmlspecialchars($HTTP_GET_VARS['highlight']))); ! ! for($i = 0; $i < sizeof($words); $i++) ! { ! if (trim($words[$i]) != '') ! { ! $highlight_match .= (($highlight_match != '') ? '|' : '') . str_replace('*', '\w*', phpbb_preg_quote($words[$i], '#')); ! } ! } ! unset($words); ! ! $highlight = urlencode($HTTP_GET_VARS['highlight']); ! $highlight_match = phpbb_rtrim($highlight_match, "\\"); ! } ! ! if ( !$html_on ) ! { ! $article = preg_replace( '#(<)([\/]?.*?)(>)#is', "<\\2>", $article ); ! } // --- 84,128 ---- $date = create_date( $board_config['default_dateformat'], $kb_row['article_date'], $board_config['board_timezone'] ); ! $type_id = $kb_row['article_type']; ! $type = $this->get_kb_type( $type_id ); ! $new_views = $kb_row['views'] + 1; ! $board_config['allow_html_tags'] = $kb_config['allowed_html_tags']; ! $art_pages = explode( '[page]', stripslashes( $kb_row['article_body'] ) ); ! $article = trim( $art_pages[$page_num] ); ! $article = str_replace( '[toc]', '', $article ); ! $bbcode_uid = $kb_row['bbcode_uid']; // ! // Toggles // ! $bbcode_on = !$kb_config['allow_wysiwyg'] ? ($kb_config['allow_bbcode'] ? true : false) : false; ! $html_on = !$kb_config['allow_wysiwyg'] ? ($kb_config['allow_html'] ? true : false) : true; ! $smilies_on = !$kb_config['allow_wysiwyg'] ? ($kb_config['allow_smilies'] ? true : false) : false; ! ! $this->page_title = $article_title; // ! // Instantiate the mx_text class // ! include_once($mx_root_path . 'includes/mx_functions_tools.'.$phpEx); ! $mx_text = new mx_text(); ! $mx_text->init($html_on, $bbcode_on, $smilies_on); // Note: allowed_html_tags is altered above ! $mx_text->allow_all_html_tags = $kb_config['allow_wysiwyg'] ? true : false; ! // ! // Decode article for display ! // ! $article_title = $mx_text->display_simple($article_title); ! $article_description = $mx_text->display_simple($article_description); ! $article = $mx_text->display($article, $bbcode_uid); $article = $this->article_formatting( $article ); // ! // Instatiate text tools // ! $mx_kb_text_tools = new mx_kb_text_tools(); // *************** *** 200,287 **** // ! // Parse message // ! $bbcode_uid = $kb_row['bbcode_uid']; ! if ( $bbcode_on ) { ! if ( $bbcode_uid != '' ) ! { ! $article = ( $bbcode_on ) ? bbencode_second_pass( $article, $bbcode_uid ) : preg_replace( '/\:[0-9a-z\:]+\]/si', ']', $article ); ! } } - $article = make_clickable( $article ); ! // ! // Parse smilies ! // ! if ( $smilies_on ) { ! $article = mx_smilies_pass( $article ); } ! // ! // Highlight active words (primarily for search) ! // ! if ($highlight_match) { ! // ! // This was shamelessly 'borrowed' from volker at multiartstudio dot de ! // via php.net's annotated manual ! // ! $article = str_replace('\"', '"', substr(@preg_replace('#(\>(((?>([^><]+|(?R)))*)\<))#se', "@preg_replace('#\b(" . $highlight_match . ")\b#i', '<span style=\"color:#" . $theme['fontcolor3'] . "\"><b>\\\\1</b></span>', '\\0')", '>' . $article . '<'), 1, -1)); } ! // ! // Replace naughty words ! // ! if ( count( $orig_word ) ) { ! $article_title = preg_replace( $orig_word, $replacement_word, $article_title ); ! $article_description = preg_replace( $orig_word, $replacement_word, $article_description ); ! ! $article = str_replace( '\"', '"', substr( preg_replace( '#(\>(((?>([^><]+|(?R)))*)\<))#se', "preg_replace(\$orig_word, \$replacement_word, '\\0')", '>' . $article . '<' ), 1, -1 ) ); } // ! // Replace newlines (we use this rather than nl2br because ! // till recently it wasn't XHTML compliant) // ! $article = str_replace( "\n", "\n<br />\n", $article ); ! // ! // Highlight active words (primarily for search) ! // ! if ( $highlight_match ) { ! // ! // This was shamelessly 'borrowed' from volker at multiartstudio dot de ! // via php.net's annotated manual ! // ! $article = str_replace( '\"', '"', substr( preg_replace( '#(\>(((?>([^><]+|(?R)))*)\<))#se', "preg_replace('#\b(" . $highlight_match . ")\b#i', '<span style=\"color:#" . $theme['fontcolor3'] . "\"><b>\\\\1</b></span>', '\\0')", '>' . $article . '<' ), 1, -1 ) ); } ! ! $this->page_title = $article_title; ! ! // ! // Text formatting ! // ! if ( $kb_config['max_subject_chars'] > 0 ) { ! $article_title = $mx_kb_text_tools->truncate_text( $article_title, $kb_config['max_subject_chars'], true ); } ! if ( $kb_config['max_description_chars'] > 0 ) ! { ! $article_description = $mx_kb_text_tools->truncate_text( $article_description, $kb_config['max_description_chars'], true ); ! } ! if ( $kb_config['max_chars'] > 0 ) { ! $article = $mx_kb_text_tools->truncate_text( $article, $kb_config['max_chars'], true ); } ! ! if ( $kb_config['formatting_truncate_links'] || $kb_config['formatting_image_resize'] > 0 || $kb_config['formatting_wordwrap'] ) { ! $article = $mx_kb_text_tools->decode( $article, $kb_config['formatting_truncate_links'], intval($kb_config['formatting_image_resize']), $kb_config['formatting_wordwrap'] ); } --- 135,188 ---- // ! // Text formatting // ! if ( $kb_config['max_subject_chars'] > 0 ) { ! $article_title = $mx_kb_text_tools->truncate_text( $article_title, $kb_config['max_subject_chars'], true ); } ! if ( $kb_config['max_description_chars'] > 0 ) { ! $article_description = $mx_kb_text_tools->truncate_text( $article_description, $kb_config['max_description_chars'], true ); } ! if ( $kb_config['max_chars'] > 0 ) { ! $article = $mx_kb_text_tools->truncate_text( $article, $kb_config['max_chars'], true ); } ! if ( $kb_config['formatting_truncate_links'] || $kb_config['formatting_image_resize'] > 0 || $kb_config['formatting_wordwrap'] ) { ! $article = $mx_kb_text_tools->decode( $article, $kb_config['formatting_truncate_links'], intval($kb_config['formatting_image_resize']), $kb_config['formatting_wordwrap'] ); } // ! // Format text and data // ! $temp_url = append_sid( this_kb_mxurl( "mode=cat&cat=$article_category_id" ) ); ! $category = '<a href="' . $temp_url . '" class="gensmall">' . $article_category_name . '</a>'; ! if ( $author_id == -1 ) { ! $author_kb_art = ( $kb_row['username'] == '' ) ? $lang['Guest'] : $kb_row['username']; } ! else { ! $author_name = $this->get_kb_author( $author_id ); ! $temp_url = append_sid( $phpbb_root_path . "profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$author_id" ); ! $author_kb_art = '<a href="' . $temp_url . '" class="gensmall">' . $author_name . '</a>'; } ! $views = '<b>' . $lang['Views'] . '</b> ' . $new_views; ! if ( $page_num == 0 ) { ! $sql = "UPDATE " . KB_ARTICLES_TABLE . " SET ! views = '" . $new_views . "' ! WHERE article_id = " . $article_id; } ! if ( !( $result2 = $db->sql_query( $sql ) ) ) { ! mx_message_die( GENERAL_ERROR, "Could not update article's views", '', __LINE__, __FILE__, $sql ); } Index: kb_post.php =================================================================== RCS file: /cvsroot/mxbb/mx_kb/kb/modules/kb_post.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** kb_post.php 17 Jun 2006 20:11:24 -0000 1.5 --- kb_post.php 25 Jun 2006 21:55:12 -0000 1.6 *************** *** 33,48 **** // - // Includes - // - include_once( $phpbb_root_path . 'includes/bbcode.'.$phpEx); - include_once( $phpbb_root_path . 'includes/functions_post.' . $phpEx ); - - // // Request vars // $article_id = $mx_request_vars->request('k', MX_TYPE_INT, ''); ! $kb_post_mode = empty( $article_id ) ? 'add' : 'edit'; $this->page_title = $kb_post_mode == 'add' ? $lang['Add_article'] : $lang['Edit_article']; if ( $mx_request_vars->is_request('cat') ) { --- 33,47 ---- // // Request vars // $article_id = $mx_request_vars->request('k', MX_TYPE_INT, ''); ! $kb_post_mode = empty( $article_id ) ? 'add' : 'edit'; //Main mode toggle $this->page_title = $kb_post_mode == 'add' ? $lang['Add_article'] : $lang['Edit_article']; + $delete = $mx_request_vars->request('delete', MX_TYPE_NO_TAGS, ''); + $submit = $mx_request_vars->is_request('article_submit'); + $preview = $mx_request_vars->is_request('preview'); + $cancel = $mx_request_vars->is_request('cancel'); + if ( $mx_request_vars->is_request('cat') ) { *************** *** 59,66 **** } ! $delete = $mx_request_vars->request('delete', MX_TYPE_NO_TAGS, ''); ! $submit = $mx_request_vars->is_request('article_submit'); ! $preview = $mx_request_vars->is_request('preview'); ! $cancel = $mx_request_vars->is_request('cancel'); // --- 58,86 ---- } ! // ! // First (re)declare basic variables ! // ! $kb_row = array(); ! if ( $kb_post_mode == 'edit' ) ! { ! $sql = "SELECT * ! FROM " . KB_ARTICLES_TABLE . " ! WHERE article_id = '" . $article_id . "'"; ! ! if ( !( $result = $db->sql_query( $sql ) ) ) ! { ! mx_message_die( GENERAL_ERROR, "Could not obtain article data", '', __LINE__, __FILE__, $sql ); ! } ! ! $kb_row = $db->sql_fetchrow( $result ); ! } ! ! $kb_title = $preview || isset($HTTP_POST_VARS['article_name']) ? $HTTP_POST_VARS['article_name'] : $kb_row['article_title']; ! $kb_desc = $preview || isset($HTTP_POST_VARS['article_desc']) ? $HTTP_POST_VARS['article_desc'] : $kb_row['article_description']; ! $kb_text = $preview || isset($HTTP_POST_VARS['message']) ? $HTTP_POST_VARS['message'] : $kb_row['article_body']; ! $bbcode_uid = $preview ? '' : $kb_row['bbcode_uid']; ! ! $username = $preview || isset($HTTP_POST_VARS['username']) ? $HTTP_POST_VARS['username'] : $kb_row['username']; ! $type_id = $preview || isset($HTTP_POST_VARS['type_id']) ? intval($HTTP_POST_VARS['type_id']) : $kb_row['article_type']; // *************** *** 76,79 **** --- 96,100 ---- if ( $kb_config['allow_wysiwyg'] && file_exists( $mx_root_path . $kb_config['wysiwyg_path'] . 'tinymce/jscripts/tiny_mce/blank.htm' )) { + $allow_wysiwyg = true; $bbcode_on = false; $html_on = true; *************** *** 82,88 **** $images_on = false; - $html_entities_match = array( ); - $html_entities_replace = array( ); - $langcode = mx_get_langcode(); $template->assign_block_vars( "tinyMCE", array( --- 103,106 ---- *************** *** 94,97 **** --- 112,116 ---- else { + $allow_wysiwyg = false; $bbcode_on = $kb_config['allow_bbcode'] ? true : false; $html_on = $kb_config['allow_html'] ? true : false; *************** *** 106,109 **** --- 125,141 ---- // + // Instantiate the mx_text class + // + include_once($mx_root_path . 'includes/mx_functions_tools.'.$phpEx); + $mx_text = new mx_text(); + $mx_text->init($html_on, $bbcode_on, $smilies_on); + + // + // Allow all html tags + // Fix: Setting 'emtpy' enables all + // + $mx_text->allow_all_html_tags = $allow_wysiwyg; + + // // post article ----------------------------------------------------------------------------ADD/EDIT // *************** *** 116,180 **** } - $article_title = ( !empty( $_POST['article_name'] ) ) ? addslashes( htmlspecialchars( trim ( $_POST['article_name'] ) ) ) : ''; - $article_description = ( !empty( $_POST['article_desc'] ) ) ? addslashes( htmlspecialchars( trim ( $_POST['article_desc'] ) ) ) : ''; - - $bbcode_uid = $mx_request_vars->request('bbcode_uid', MX_TYPE_NO_TAGS, ''); - if ( empty( $bbcode_uid ) ) - { - $bbcode_uid = ( $bbcode_on ) ? make_bbcode_uid() : ''; - } - - $article_text = str_replace( '<br />', "\n", $_POST['message'] ); - $article_text = prepare_message( trim($article_text), $html_on, $bbcode_on, $smilies_on, $bbcode_uid ); - $article_text = bbencode_first_pass( $article_text, $bbcode_uid ); - - /* - $article_title = ( !empty( $HTTP_POST_VARS['article_name'] ) ) ? htmlspecialchars( trim ( $HTTP_POST_VARS['article_name'] ) ) : ''; - $article_description = ( !empty( $HTTP_POST_VARS['article_desc'] ) ) ? htmlspecialchars( trim ( $HTTP_POST_VARS['article_desc'] ) ) : ''; - $article_text = ( !empty( $HTTP_POST_VARS['message'] ) ) ? $HTTP_POST_VARS['message'] : ''; - // ! // Check message // ! if ( !empty( $article_text ) ) ! { ! if ( empty( $bbcode_uid ) ) ! { ! $bbcode_uid = ( $bbcode_on ) ? make_bbcode_uid() : ''; ! } ! $article_text = prepare_message( trim( $article_text ), $html_on, $bbcode_on, $smilies_on, $bbcode_uid ); ! } ! */ $date = time(); $author_id = $userdata['user_id'] > 0 ? intval( $userdata['user_id'] ) : '-1'; - $type_id = $mx_request_vars->request('type_id', MX_TYPE_INT, ''); - - $username = $HTTP_POST_VARS['username']; - - // - // Check username - // - if (!empty($username)) - { - $username = phpbb_clean_username($username); - - if (!$userdata['session_logged_in'] || ($userdata['session_logged_in'] && $username != $userdata['username'])) - { - include($phpbb_root_path . 'includes/functions_validate.'.$phpEx); - - $result = validate_username($username); - if ($result['error']) - { - $error_msg = (!empty($error_msg)) ? '<br />' . $result['error_msg'] : $result['error_msg']; - - mx_message_die(GENERAL_MESSAGE, $error_msg ); - } - } - else - { - $username = ''; - } - } switch ( $kb_post_mode ) --- 148,162 ---- } // ! // Encode for db storage // ! $article_title = $mx_text->encode_simple($kb_title); ! $article_description = $mx_text->encode_simple($kb_desc); ! $article_text = $mx_text->encode($kb_text); ! $bbcode_uid = $mx_text->bbcode_uid; + $username = $mx_text->encode_username($username); $date = time(); $author_id = $userdata['user_id'] > 0 ? intval( $userdata['user_id'] ) : '-1'; switch ( $kb_post_mode ) *************** *** 191,202 **** // Approve // ! if ( $this->auth_user[$category_id]['auth_mod'] || $this->auth_user[$category_id]['auth_approval_edit'] ) // approval auth ! { ! $approve = 1; // approved ! } ! else ! { ! $approve = 2; // edited unapproved ! } $sql = "UPDATE " . KB_ARTICLES_TABLE . " --- 173,177 ---- // Approve // ! $approve = $this->auth_user[$category_id]['auth_mod'] || $this->auth_user[$category_id]['auth_approval_edit'] ? 1 : 2; // approved $sql = "UPDATE " . KB_ARTICLES_TABLE . " *************** *** 228,242 **** } ! if ( $this->auth_user[$category_id]['auth_approval'] || $this->auth_user[$category_id]['auth_mod'] ) ! { ! $approve = 1; // approved ! } ! else ! { ! $approve = 0; // unapproved ! } $sql = "INSERT INTO " . KB_ARTICLES_TABLE . " ( article_category_id , article_title , article_description , article_date , article_author_id , username , bbcode_uid , article_body , article_type , approved, views ) ! VALUES ( '$category_id', '" . str_replace( "\'", "''", $article_title ) . "', '" . str_replace( "\'", "''", $article_description ) . "', '$date', '$author_id', '$username', '$bbcode_uid', '" . str_replace( "\'", "''", $article_text ) . "', '$type_id', '$approve', '0')"; if ( !( $results = $db->sql_query( $sql ) ) ) --- 203,213 ---- } ! // ! // Approve ! // ! $approve = $this->auth_user[$category_id]['auth_approval'] || $this->auth_user[$category_id]['auth_mod'] ? 1 : 0; // approved $sql = "INSERT INTO " . KB_ARTICLES_TABLE . " ( article_category_id , article_title , article_description , article_date , article_author_id , username , bbcode_uid , article_body , article_type , approved, views ) ! VALUES ( '$category_id', '" . str_replace( "\'", "''", $article_title ) . "', '" . str_replace( "\'", "''", $article_description ) . "', '$date', '$author_id', '" . str_replace( "\'", "''", $username ) . "', '$bbcode_uid', '" . str_replace( "\'", "''", $article_text ) . "', '$type_id', '$approve', '0')"; if ( !( $results = $db->sql_query( $sql ) ) ) *************** *** 289,293 **** // $this->update_add_comment('', $article_id, 0, addslashes(trim($mx_kb_notification->subject)), addslashes(trim($mx_kb_notification->message)) ); - } --- 260,263 ---- *************** *** 348,394 **** } - // - // First (re)declare basic variables - // - if ( $kb_post_mode == 'edit' ) - { - $sql = "SELECT * - FROM " . KB_ARTICLES_TABLE . " - WHERE article_id = '" . $article_id . "'"; - - if ( !( $result = $db->sql_query( $sql ) ) ) - { - mx_message_die( GENERAL_ERROR, "Could not obtain article data", '', __LINE__, __FILE__, $sql ); - } - - $kb_row = $db->sql_fetchrow( $result ); - } - - $kb_title = ( isset( $HTTP_POST_VARS['article_name'] ) ) ? htmlspecialchars( trim( stripslashes( $HTTP_POST_VARS['article_name'] ) ) ) : $kb_row['article_title']; - $kb_desc = ( isset( $HTTP_POST_VARS['article_desc'] ) ) ? htmlspecialchars( trim( stripslashes( $HTTP_POST_VARS['article_desc'] ) ) ): $kb_row['article_description']; - $kb_text = ( isset( $HTTP_POST_VARS['message'] ) ) ? htmlspecialchars( trim( stripslashes( $HTTP_POST_VARS['message'] ) ) ) : $kb_row['article_body']; - - $type_id = ( isset( $HTTP_POST_VARS['type_id'] ) ) ? htmlspecialchars( trim( stripslashes( $HTTP_POST_VARS['type_id'] ) ) ) : $kb_row['article_type']; - $bbcode_uid = ( isset( $HTTP_POST_VARS['bbcode_uid'] ) ) ? htmlspecialchars( trim( stripslashes( $HTTP_POST_VARS['bbcode_uid'] ) ) ) : $kb_row['bbcode_uid']; - $username = ( isset( $HTTP_POST_VARS['username'] ) ) ? htmlspecialchars( trim( stripslashes( $HTTP_POST_VARS['username'] ) ) ) : $kb_row['username']; - if ( $preview ) { ! $preview_title = $kb_title; ! $preview_desc = $kb_desc; ! $preview_text = $kb_text; ! ! $orig_word = array(); ! $replacement_word = array(); ! obtain_word_list( $orig_word, $replacement_word ); ! ! $bbcode_uid = ( $bbcode_on ) ? make_bbcode_uid() : ''; ! $preview_text = stripslashes(prepare_message(addslashes(unprepare_message($preview_text)), $html_on, $bbcode_on, $smilies_on, $bbcode_uid)); - // Now we run comment suite before checking for smilies - // so admins can add them in messages if they like - // and so smilies are not counted as images in sigs. - // this is done here again incase above conditions are - // not met. if (!$kb_config['allow_images'] || !$kb_config['allow_links']) { --- 318,330 ---- } if ( $preview ) { ! // ! // Encode for preview ! // ! $preview_title = $mx_text->encode_preview_simple($kb_title); ! $preview_desc = $mx_text->encode_preview_simple($kb_desc); ! $preview_text = $mx_text->encode_preview($kb_text); if (!$kb_config['allow_images'] || !$kb_config['allow_links']) { *************** *** 396,420 **** } - if ( $bbcode_on ) - { - $preview_text = bbencode_second_pass( $preview_text, $bbcode_uid ); - } - - if ( count( $orig_word ) ) - { - $preview_title = preg_replace( $orig_word, $replacement_word, $preview_title ); - $preview_desc = preg_replace( $orig_word, $replacement_word, $preview_desc ); - $preview_text = preg_replace( $orig_word, $replacement_word, $preview_text ); - } - - if ( $smilies_on ) - { - $preview_text = mx_smilies_pass( $preview_text ); - } - - $preview_text = make_clickable( $preview_text ); - - $preview_text = str_replace( "\n", '<br />', $preview_text ); - $template->set_filenames( array( 'preview' => 'kb_post_preview.tpl' ) ); --- 332,335 ---- *************** *** 428,431 **** --- 343,363 ---- $template->assign_var_from_handle( 'KB_PREVIEW_BOX', 'preview' ); + + // + // Decode for form editing + // + $kb_title = $mx_text->decode_simple($kb_title, true); + $kb_desc = $mx_text->decode_simple($kb_desc, true); + $kb_text = $mx_text->decode($kb_text, '', true); + } + else + { + // + // Decode for form editing + // + $kb_title = $mx_text->decode_simple($kb_title, true); + $kb_desc = $mx_text->decode_simple($kb_desc, true); + $kb_text = $mx_text->decode($kb_text, $bbcode_uid, true); + } *************** *** 442,454 **** } - if ( $bbcode_uid != '' ) - { - $kb_text = preg_replace('/\:(([a-z0-9]:)?)' . $bbcode_uid . '/s', '', $kb_text); - } - - $kb_text = str_replace('<', '<', $kb_text); - $kb_text = str_replace('>', '>', $kb_text); - $kb_text = str_replace('<br />', "\n", $kb_text); - // // Toggle selection --- 374,377 ---- *************** *** 456,477 **** $html_status = ( $html_on ) ? $lang['HTML_is_ON'] : $lang['HTML_is_OFF']; $bbcode_status = ( $bbcode_on ) ? $lang['BBCode_is_ON'] : $lang['BBCode_is_OFF']; $links_status = ( $links_on ) ? $lang['Links_are_ON'] : $lang['Links_are_OFF']; $images_status = ( $images_on ) ? $lang['Images_are_ON'] : $lang['Images_are_OFF']; // - // Smilies toggle selection - // - if ( $smilies_on ) - { - $smilies_status = $lang['Smilies_are_ON']; - - mx_generate_smilies( 'inline', PAGE_POSTING ); - } - else - { - $smilies_status = $lang['Smilies_are_OFF']; - } - - // // set up page // --- 379,387 ---- $html_status = ( $html_on ) ? $lang['HTML_is_ON'] : $lang['HTML_is_OFF']; $bbcode_status = ( $bbcode_on ) ? $lang['BBCode_is_ON'] : $lang['BBCode_is_OFF']; + $smilies_status = ( $smilies_on ) ? $lang['Smilies_are_ON'] : $lang['Smilies_are_OFF']; $links_status = ( $links_on ) ? $lang['Links_are_ON'] : $lang['Links_are_OFF']; $images_status = ( $images_on ) ? $lang['Images_are_ON'] : $lang['Images_are_OFF']; // // set up page // Index: kb_post_comment.php =================================================================== RCS file: /cvsroot/mxbb/mx_kb/kb/modules/kb_post_comment.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** kb_post_comment.php 17 Jun 2006 20:11:24 -0000 1.4 --- kb_post_comment.php 25 Jun 2006 21:55:12 -0000 1.5 *************** *** 32,41 **** // - // Includes - // - include_once( $phpbb_root_path . 'includes/bbcode.'.$phpEx); - include_once( $phpbb_root_path . 'includes/functions_post.' . $phpEx ); - - // // Request vars // --- 32,35 ---- *************** *** 56,62 **** $preview = $mx_request_vars->is_request('preview'); - $subject = ( !empty( $_POST['subject'] ) ) ? htmlspecialchars( trim( stripslashes( $_POST['subject'] ) ) ) : ''; - $message = ( !empty( $_POST['message'] ) ) ? htmlspecialchars( trim( stripslashes( $_POST['message'] ) ) ) : ''; - $sql = "SELECT * FROM " . KB_ARTICLES_TABLE . " --- 50,53 ---- *************** *** 86,89 **** --- 77,129 ---- } + if ( $mx_request_vars->is_get('cid') ) + { + if ( $this->comments[$article_data['article_category_id']]['internal_comments'] ) + { + // + // Query internal comment to edit + // + $sql = 'SELECT c.*, u.* + FROM ' . KB_COMMENTS_TABLE . ' AS c + LEFT JOIN ' . USERS_TABLE . " AS u ON c.poster_id = u.user_id + WHERE c.article_id = '" . $item_id . "' + AND c.comments_id = '" . $mx_request_vars->request('cid', MX_TYPE_INT, '') . "'"; + + $comment_arg_title = 'comments_title'; + $comment_arg_message = 'comments_text'; + $comment_arg_bbcode_uid = 'comment_bbcode_uid'; + } + else + { + // + // Query internal comment to edit + // Note: cid = post_id + // + $sql = "SELECT u.username, u.user_id, u.user_posts, u.user_from, u.user_website, u.user_email, u.user_icq, u.user_aim, u.user_yim, u.user_regdate, u.user_msnm, u.user_viewemail, u.user_rank, u.user_sig, u.user_sig_bbcode_uid, u.user_avatar, u.user_avatar_type, u.user_allowavatar, u.user_allowsmile, p.*, pt.post_text, pt.post_subject, pt.bbcode_uid + FROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u, " . POSTS_TEXT_TABLE . " pt + WHERE pt.post_id = p.post_id + AND u.user_id = p.poster_id + AND p.post_id = '" . $mx_request_vars->request('cid', MX_TYPE_INT, '') . "'"; + + $comment_arg_title = 'post_subject'; + $comment_arg_message = 'post_text'; + $comment_arg_bbcode_uid = 'bbcode_uid'; + } + + if ( !( $result = $db->sql_query( $sql ) ) ) + { + mx_message_die( GENERAL_ERROR, 'Couldnt select comments', '', __LINE__, __FILE__, $sql ); + } + + $comment_row = $db->sql_fetchrow( $result ); + } + + $comment_title = $preview || isset($_POST['subject']) ? $_POST['subject'] : $comment_row[$comment_arg_title]; + $comment_body = $preview || isset($_POST['message']) ? $_POST['message'] : $comment_row[$comment_arg_message]; + $bbcode_uid = $preview ? '' : $comment_row[$comment_arg_bbcode_uid]; + + // + // Toggles + // $html_on = ( $kb_config['allow_comment_html'] ) ? true : 0; $bbcode_on = ( $kb_config['allow_comment_bbcode'] ) ? true : 0; *************** *** 92,95 **** --- 132,148 ---- $images_on = ( $kb_config['allow_comment_images'] ) ? true : 0; + // + // Instantiate the mx_text class + // + include_once($mx_root_path . 'includes/mx_functions_tools.'.$phpEx); + $mx_text = new mx_text(); + $mx_text->init($html_on, $bbcode_on, $smilies_on); + + // + // Allow all html tags + // Fix: Setting 'emtpy' enables all + // + //$mx_text->allow_all_html_tags = $allow_wysiwyg; // Not yet implemented for comments + // ======================================================= // Delete *************** *** 139,403 **** // ======================================================= ! // Main // ======================================================= ! if ( !$submit ) { ! // ! // Instatiate text tools ! // ! $mx_kb_text_tools = new mx_kb_text_tools(); ! ! // ! // Generate smilies listing for page output ! // ! $mx_kb_functions->kb_generate_smilies( 'inline', PAGE_POSTING ); ! ! $html_status = ( $html_on ) ? $lang['HTML_is_ON'] : $lang['HTML_is_OFF']; ! $bbcode_status = ( $bbcode_on ) ? $lang['BBCode_is_ON'] : $lang['BBCode_is_OFF']; ! $smilies_status = ( $smilies_on ) ? $lang['Smilies_are_ON'] : $lang['Smilies_are_OFF']; ! $links_status = ( $links_on ) ? $lang['Links_are_ON'] : $lang['Links_are_OFF']; ! $images_status = ( $images_on ) ? $lang['Images_are_ON'] : $lang['Images_are_OFF']; ! ! if ( $mx_request_vars->is_get('cid') ) ! { ! if ( $this->comments[$article_data['article_category_id']]['internal_comments'] ) ! { ! // ! // Query internal comment to edit ! // ! $sql = 'SELECT c.*, u.* ! FROM ' . KB_COMMENTS_TABLE . ' AS c ! LEFT JOIN ' . USERS_TABLE . " AS u ON c.poster_id = u.user_id ! WHERE c.article_id = '" . $item_id . "' ! AND c.comments_id = '" . $mx_request_vars->request('cid', MX_TYPE_INT, '') . "'"; ! ! $comment_arg_title = 'comments_title'; ! $comment_arg_message = 'comments_text'; ! $comment_arg_bbcode_uid = 'comment_bbcode_uid'; ! } ! else ! { ! // ! // Query internal comment to edit ! // Note: cid = post_id ! // ! $sql = "SELECT u.username, u.user_id, u.user_posts, u.user_from, u.user_website, u.user_email, u.user_icq, u.user_aim, u.user_yim, u.user_regdate, u.user_msnm, u.user_viewemail, u.user_rank, u.user_sig, u.user_sig_bbcode_uid, u.user_avatar, u.user_avatar_type, u.user_allowavatar, u.user_allowsmile, p.*, pt.post_text, pt.post_subject, pt.bbcode_uid ! FROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u, " . POSTS_TEXT_TABLE . " pt ! WHERE pt.post_id = p.post_id ! AND u.user_id = p.poster_id ! AND p.post_id = '" . $mx_request_vars->request('cid', MX_TYPE_INT, '') . "'"; ! ! $comment_arg_title = 'post_subject'; ! $comment_arg_message = 'post_text'; ! $comment_arg_bbcode_uid = 'bbcode_uid'; ! ! } ! if ( !( $result = $db->sql_query( $sql ) ) ) ! { ! mx_message_die( GENERAL_ERROR, 'Couldnt select comments', '', __LINE__, __FILE__, $sql ); ! } ! $comment_row = $db->sql_fetchrow( $result ); ! // ! // Edit comment ! // ! $comment_title = stripslashes($comment_row[$comment_arg_title]); ! $comment_body = $comment_row[$comment_arg_message]; ! if ( $comment_row[$comment_arg_bbcode_uid] != '' ) ! { ! $comment_body = preg_replace('/\:(([a-z0-9]:)?)' . $comment_row[$comment_arg_bbcode_uid] . '/s', '', $comment_body); ! } ! $comment_body = str_replace('<', '<', $comment_body); ! $comment_body = str_replace('>', '>', $comment_body); ! $comment_body = str_replace('<br />', "\n", $comment_body); ! $hidden_form_fields = '<input type="hidden" name="mode" value="post_comment"> ! <input type="hidden" name="cat_id" value="' . $cat_id . '"> ! <input type="hidden" name="item_id" value="' . $item_id . '"> ! <input type="hidden" name="cid" value="' . $mx_request_vars->request('cid', MX_TYPE_INT, '') . '"> ! <input type="hidden" name="comment" value="post">'; ! } ! else { ! // ! // New comment ! // ! $comment_title = ''; ! $comment_body = ''; ! ! $hidden_form_fields = '<input type="hidden" name="mode" value="post_comment"> ! <input type="hidden" name="cat_id" value="' . $cat_id . '"> ! <input type="hidden" name="item_id" value="' . $item_id . '"> ! <input type="hidden" name="comment" value="post">'; } ! $template->set_filenames( array( 'body' => 'kb_comment_posting.tpl' ) ); - // - // Output the data to the template - // $template->assign_vars( array( - 'HTML_STATUS' => $html_status, - 'BBCODE_STATUS' => sprintf( $bbcode_status, '<a href="' . append_sid( "faq.$phpEx?mode=bbcode" ) . '" target="_phpbbcode">', '</a>' ), - 'SMILIES_STATUS' => $smilies_status, - 'LINKS_STATUS' => $links_status, - 'IMAGES_STATUS' => $images_status, - 'FILE_NAME' => $article_data['file_name'], - 'DOWNLOAD' => $kb_config['module_name'], - 'MESSAGE_LENGTH' => $kb_config['max_comment_chars'], - - 'TITLE' => $comment_title, - 'COMMENT' => $comment_body, - - 'L_COMMENT_ADD' => $lang['Comment_add'], - 'L_COMMENT' => $lang['Message_body'], - 'L_COMMENT_TITLE' => $lang['Subject'], - 'L_OPTIONS' => $lang['Options'], - 'L_COMMENT_EXPLAIN' => sprintf( $lang['Comment_explain'], $kb_config['max_comment_chars'] ), 'L_PREVIEW' => $lang['Preview'], ! 'L_SUBMIT' => $lang['Submit'], ! 'L_DOWNLOAD' => $lang['Download'], ! ! 'L_INDEX' => "<<", ! 'L_CHECK_MSG_LENGTH' => $lang['Check_message_length'], ! 'L_MSG_LENGTH_1' => $lang['Msg_length_1'], ! 'L_MSG_LENGTH_2' => $lang['Msg_length_2'], ! 'L_MSG_LENGTH_3' => $lang['Msg_length_3'], ! 'L_MSG_LENGTH_4' => $lang['Msg_length_4'], ! 'L_MSG_LENGTH_5' => $lang['Msg_length_5'], ! 'L_MSG_LENGTH_6' => $lang['Msg_length_6'], ! ! 'L_BBCODE_B_HELP' => $lang['bbcode_b_help'], ! 'L_BBCODE_I_HELP' => $lang['bbcode_i_help'], ! 'L_BBCODE_U_HELP' => $lang['bbcode_u_help'], ! 'L_BBCODE_Q_HELP' => $lang['bbcode_q_help'], ! 'L_BBCODE_C_HELP' => $lang['bbcode_c_help'], ! 'L_BBCODE_L_HELP' => $lang['bbcode_l_help'], ! 'L_BBCODE_O_HELP' => $lang['bbcode_o_help'], ! 'L_BBCODE_P_HELP' => $lang['bbcode_p_help'], ! 'L_BBCODE_W_HELP' => $lang['bbcode_w_help'], ! 'L_BBCODE_A_HELP' => $lang['bbcode_a_help'], ! 'L_BBCODE_S_HELP' => $lang['bbcode_s_help'], ! 'L_BBCODE_F_HELP' => $lang['bbcode_f_help'], ! 'L_EMPTY_MESSAGE' => $lang['Empty_message'], ! ! 'L_FONT_COLOR' => $lang['Font_color'], ! 'L_COLOR_DEFAULT' => $lang['color_default'], ! 'L_COLOR_DARK_RED' => $lang['color_dark_red'], ! 'L_COLOR_RED' => $lang['color_red'], ! 'L_COLOR_ORANGE' => $lang['color_orange'], ! 'L_COLOR_BROWN' => $lang['color_brown'], ! 'L_COLOR_YELLOW' => $lang['color_yellow'], ! 'L_COLOR_GREEN' => $lang['color_green'], ! 'L_COLOR_OLIVE' => $lang['color_olive'], ! 'L_COLOR_CYAN' => $lang['color_cyan'], ! 'L_COLOR_BLUE' => $lang['color_blue'], ! 'L_COLOR_DARK_BLUE' => $lang['color_dark_blue'], ! 'L_COLOR_INDIGO' => $lang['color_indigo'], ! 'L_COLOR_VIOLET' => $lang['color_violet'], ! 'L_COLOR_WHITE' => $lang['color_white'], ! 'L_COLOR_BLACK' => $lang['color_black'], ! ! 'L_FONT_SIZE' => $lang['Font_size'], ! 'L_FONT_TINY' => $lang['font_tiny'], ! 'L_FONT_SMALL' => $lang['font_small'], ! 'L_FONT_NORMAL' => $lang['font_normal'], ! 'L_FONT_LARGE' => $lang['font_large'], ! 'L_FONT_HUGE' => $lang['font_huge'], ! 'L_BBCODE_CLOSE_TAGS' => $lang['Close_Tags'], ! 'L_STYLES_TIP' => $lang['Styles_tip'], ! ! 'U_INDEX' => append_sid( $mx_root_path . 'index.' . $phpEx ), ! 'U_DOWNLOAD_HOME' => append_sid( this_kb_mxurl() ), ! 'U_FILE_NAME' => append_sid( this_kb_mxurl( 'mode=article&item_id=' . $item_id ) ), ! ! 'S_POST_ACTION' => append_sid( this_kb_mxurl() ), ! 'S_HIDDEN_FORM_FIELDS' => $hidden_form_fields ) ); // ! // Show preview stuff if user clicked preview // ! if ( $preview ) ! { ! $orig_word = array(); ! $replacement_word = array(); ! obtain_word_list( $orig_word, $replacement_word ); ! $comment_bbcode_uid = ( $bbcode_on ) ? make_bbcode_uid() : ''; ! $comments_text = stripslashes( prepare_message( addslashes( unprepare_message( $message ) ), $html_on, $bbcode_on, $smilies_on, $comment_bbcode_uid ) ); ! $title = $subject; ! if ( !$html_on ) ! { ! // ! // ! // ! $comments_text = preg_replace( '#(<)([\/]?.*?)(>)#is', "<\\2>", $comments_text ); ! } ! // Now we run comment suite before checking for smilies ! // so admins can add them in messages if they like ! // and so smilies are not counted as images in sigs. ! // this is done here again incase above conditions are ! // not met. ! if (!$kb_config['allow_comment_images'] || !$kb_config['allow_comment_links']) ! { ! $comments_text = $mx_kb_text_tools->remove_images_links( $comments_text, $kb_config['allow_comment_images'], $kb_config['no_comment_image_message'], $kb_config['allow_comment_links'], $kb_config['no_comment_link_message'] ); ! } ! if ( $bbcode_on ) ! { ! // ! // ! // ! $comments_text = bbencode_second_pass( $comments_text, $comment_bbcode_uid ); // : preg_replace('/\:[0-9a-z\:]+\]/si', ']', $comments_text); ! } ! if ( !empty( $orig_word ) ) ! { ! $title = ( !empty( $title ) ) ? preg_replace( $orig_word, $replacement_word, $title ) : ''; ! $comments_text = ( !empty( $comments_text ) ) ? preg_replace( $orig_word, $replacement_word, $comments_text ) : ''; ! } ! // ! // Make clickable ! // ! $comments_text = make_clickable( $comments_text ); ! // ! // Parse smilies ! // ! if ( $smilies_on ) ! { ! $comments_text = smilies_pass( $comments_text ); ! } ! $comments_text = str_replace( "\n", '<br />', $comments_text ); ! $template->assign_vars( array( ! 'PREVIEW' => true, ! 'COMMENT' => stripslashes( $_POST['message'] ), ! 'SUBJECT' => stripslashes( $_POST['subject'] ), ! 'PRE_COMMENT' => $comments_text ) ! ); ! } ! } ! // ======================================================= ! // Submit ! // ======================================================= ! if ( $submit ) ! { ! $this->update_add_comment($article_data, $item_id, $cid, '', '', $html_on, $bbcode_on, $smilies_on); ! $message = $lang['Comment_posted'] . '<br /><br />' . sprintf( $lang['Click_return_article'], '<a href="' . append_sid( this_kb_mxurl( 'mode=article&k=' . $item_id ) ) . '">', '</a>' ); ! mx_message_die( GENERAL_MESSAGE, $message ); ! } // =================================================== --- 192,367 ---- // ======================================================= ! // Submit // ======================================================= ! if ( $submit ) { ! $this->update_add_comment($article_data, $item_id, $cid, '', '', $html_on, $bbcode_on, $smilies_on); ! $message = $lang['Comment_posted'] . '<br /><br />' . sprintf( $lang['Click_return_article'], '<a href="' . append_sid( this_kb_mxurl( 'mode=article&k=' . $item_id ) ) . '">', '</a>' ); ! mx_message_die( GENERAL_MESSAGE, $message ); ! } ! // ======================================================= ! // Main ! // ======================================================= ! // ! // Instatiate text tools ! // ! $mx_kb_text_tools = new mx_kb_text_tools(); ! // ! // Generate smilies listing for page output ! // ! $mx_kb_functions->kb_generate_smilies( 'inline', PAGE_POSTING ); ! $html_status = ( $html_on ) ? $lang['HTML_is_ON'] : $lang['HTML_is_OFF']; ! $bbcode_status = ( $bbcode_on ) ? $lang['BBCode_is_ON'] : $lang['BBCode_is_OFF']; ! $smilies_status = ( $smilies_on ) ? $lang['Smilies_are_ON'] : $lang['Smilies_are_OFF']; ! $links_status = ( $links_on ) ? $lang['Links_are_ON'] : $lang['Links_are_OFF']; ! $images_status = ( $images_on ) ? $lang['Images_are_ON'] : $lang['Images_are_OFF']; ! if ( $preview ) ! { ! // ! // Encode for preview ! // ! $preview_title = $mx_text->encode_preview_simple($comment_title); ! $preview_text = $mx_text->encode_preview($comment_body); ! if (!$kb_config['allow_images'] || !$kb_config['allow_links']) { ! $preview_text = $mx_kb_text_tools->remove_images_links( $preview_text, $kb_config['allow_images'], $kb_config['no_image_message'], $kb_config['allow_links'], $kb_config['no_link_message'] ); } ! $template->set_filenames( array( 'preview' => 'kb_post_preview.tpl' ) ); $template->assign_vars( array( 'L_PREVIEW' => $lang['Preview'], ! 'PREVIEW' => true, ! 'COMMENT' => $preview_text, ! 'SUBJECT' => $preview_title, ! 'PRE_COMMENT' => $comments_text ) ); // ! // Decode for form editing // ! $comment_title = $mx_text->decode_simple($comment_title, true); ! $comment_body = $mx_text->decode($comment_body, '', true); ! } ! else ! { ! // ! // Decode for form editing ! // ! $comment_title = $mx_text->decode_simple($comment_title); ! $comment_body = $mx_text->decode($comment_body, $bbcode_uid); ! } ! if ( $mx_request_vars->is_get('cid') ) ! { ! $hidden_form_fields = '<input type="hidden" name="mode" value="post_comment"> ! <input type="hidden" name="cat_id" value="' . $cat_id . '"> ! <input type="hidden" name="item_id" value="' . $item_id . '"> ! <input type="hidden" name="cid" value="' . $mx_request_vars->request('cid', MX_TYPE_INT, '') . '"> ! <input type="hidden" name="comment" value="post">'; ! } ! else ! { ! // ! // New comment ! // ! $comment_title = ''; ! $comment_body = ''; ! $hidden_form_fields = '<input type="hidden" name="mode" value="post_comment"> ! <input type="hidden" name="cat_id" value="' . $cat_id . '"> ! <input type="hidden" name="item_id" value="' . $item_id . '"> ! <input type="hidden" name="comment" value="post">'; ! } ! $template->set_filenames( array( 'body' => 'kb_comment_posting.tpl' ) ); ! // ! // Output the data to the template ! // ! $template->assign_vars( array( ! 'HTML_STATUS' => $html_status, ! 'BBCODE_STATUS' => sprintf( $bbcode_status, '<a href="' . append_sid( "faq.$phpEx?mode=bbcode" ) . '" target="_phpbbcode">', '</a>' ), ! 'SMILIES_STATUS' => $smilies_status, ! 'LINKS_STATUS' => $links_status, ! 'IMAGES_STATUS' => $images_status, ! 'FILE_NAME' => $article_data['file_name'], ! 'DOWNLOAD' => $kb_config['module_name'], ! 'MESSAGE_LENGTH' => $kb_config['max_comment_chars'], ! 'TITLE' => $comment_title, ! 'COMMENT' => $comment_body, ! 'L_COMMENT_ADD' => $lang['Comment_add'], ! 'L_COMMENT' => $lang['Message_body'], ! 'L_COMMENT_TITLE' => $lang['Subject'], ! 'L_OPTIONS' => $lang['Options'], ! 'L_COMMENT_EXPLAIN' => sprintf( $lang['Comment_explain'], $kb_config['max_comment_chars'] ), ! 'L_PREVIEW' => $lang['Preview'], ! 'L_SUBMIT' => $lang['Submit'], ! 'L_DOWNLOAD' => $lang['Download'], ! 'L_INDEX' => "<<", ! 'L_CHECK_MSG_LENGTH' => $lang['Check_message_length'], ! 'L_MSG_LENGTH_1' => $lang['Msg_length_1'], ! 'L_MSG_LENGTH_2' => $lang['Msg_length_2'], ! 'L_MSG_LENGTH_3' => $lang['Msg_length_3'], ! 'L_MSG_LENGTH_4' => $lang['Msg_length_4'], ! 'L_MSG_LENGTH_5' => $lang['Msg_length_5'], ! 'L_MSG_LENGTH_6' => $lang['Msg_length_6'], ! 'L_BBCODE_B_HELP' => $lang['bbcode_b_help'], ! 'L_BBCODE_I_HELP' => $lang['bbcode_i_help'], ! 'L_BBCODE_U_HELP' => $lang['bbcode_u_help'], ! 'L_BBCODE_Q_HELP' => $lang['bbcode_q_help'], ! 'L_BBCODE_C_HELP' => $lang['bbcode_c_help'], ! 'L_BBCODE_L_HELP' => $lang['bbcode_l_help'], ! 'L_BBCODE_O_HELP' => $lang['bbcode_o_help'], ! 'L_BBCODE_P_HELP' => $lang['bbcode_p_help'], ! 'L_BBCODE_W_HELP' => $lang['bbcode_w_help'], ! 'L_BBCODE_A_HELP' => $lang['bbcode_a_help'], ! 'L_BBCODE_S_HELP' => $lang['bbcode_s_help'], ! 'L_BBCODE_F_HELP' => $lang['bbcode_f_help'], ! 'L_EMPTY_MESSAGE' => $lang['Empty_message'], ! 'L_FONT_COLOR' => $lang['Font_color'], ! 'L_COLOR_DEFAULT' => $lang['color_default'], ! 'L_COLOR_DARK_RED' => $lang['color_dark_red'], ! 'L_COLOR_RED' => $lang['color_red'], ! 'L_COLOR_ORANGE' => $lang['color_orange'], ! 'L_COLOR_BROWN' => $lang['color_brown'], ! 'L_COLOR_YELLOW' => $lang['color_yellow'], ! 'L_COLOR_GREEN' => $lang['color_green'], ! 'L_COLOR_OLIVE' => $lang['color_olive'], ! 'L_COLOR_CYAN' => $lang['color_cyan'], ! 'L_COLOR_BLUE' => $lang['color_blue'], ! 'L_COLOR_DARK_BLUE' => $lang['color_dark_blue'], ! 'L_COLOR_INDIGO' => $lang['color_indigo'], ! 'L_COLOR_VIOLET' => $lang['color_violet'], ! 'L_COLOR_WHITE' => $lang['color_white'], ! 'L_COLOR_BLACK' => $lang['color_black'], ! 'L_FONT_SIZE' => $lang['Font_size'], ! 'L_FONT_TINY' => $lang['font_tiny'], ! 'L_FONT_SMALL' => $lang['font_small'], ! 'L_FONT_NORMAL' => $lang['font_normal'], ! 'L_FONT_LARGE' => $lang['font_large'], ! 'L_FONT_HUGE' => $lang['font_huge'], ! 'L_BBCODE_CLOSE_TAGS' => $lang['Close_Tags'], ! 'L_STYLES_TIP' => $lang['Styles_tip'], ! 'U_INDEX' => append_sid( $mx_root_path . 'index.' . $phpEx ), ! 'U_DOWNLOAD_HOME' => append_sid( this_kb_mxurl() ), ! 'U_FILE_NAME' => append_sid( this_kb_mxurl( 'mode=article&item_id=' . $item_id ) ), ! 'S_POST_ACTION' => append_sid( this_kb_mxurl() ), ! 'S_HIDDEN_FORM_FIELDS' => $hidden_form_fields ) ! ); // =================================================== *************** *** 405,412 **** // =================================================== $this->generate_navigation( $article_data['article_category_id'] ); - } - } - ?> \ No newline at end of file --- 369,373 ---- |
|
From: Jon O. <jon...@us...> - 2006-06-25 21:55:15
|
Update of /cvsroot/mxbb/mx_kb/kb/includes In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv26394/modules/mx_kb/kb/includes Modified Files: functions_comment.php functions_kb.php Log Message: Implementing a new mx_post class, to handle all kind of html, bbcode, smilies, links, images etc Index: functions_comment.php =================================================================== RCS file: /cvsroot/mxbb/mx_kb/kb/includes/functions_comment.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** functions_comment.php 17 Jun 2006 20:11:23 -0000 1.6 --- functions_comment.php 25 Jun 2006 21:55:12 -0000 1.7 *************** *** 151,154 **** --- 151,161 ---- // + // Toggles + // + $bbcode_on = !$kb_config['allow_wysiwyg'] ? ($kb_config['allow_bbcode'] ? true : false) : false; + $html_on = !$kb_config['allow_wysiwyg'] ? ($kb_config['allow_html'] ? true : false) : true; + $smilies_on = !$kb_config['allow_wysiwyg'] ? ($kb_config['allow_smilies'] ? true : false) : false; + + // // page number (only used for kb articles) // *************** *** 168,174 **** // ! // Includes // ! include_once($phpbb_root_path . 'includes/bbcode.'.$phpEx); $template->assign_block_vars( 'use_comments', array( --- 175,184 ---- // ! // Instantiate the mx_text class // ! include_once($mx_root_path . 'includes/mx_functions_tools.'.$phpEx); ! $mx_text = new mx_text(); ! $mx_text->init($html_on, $bbcode_on, $smilies_on); // Note: allowed_html_tags is altered above ! $mx_text->allow_all_html_tags = $kb_config['allow_wysiwyg'] ? true : false; $template->assign_block_vars( 'use_comments', array( *************** *** 177,187 **** // - // Define censored word matches - // - $orig_word = array(); - $replacement_word = array(); - obtain_word_list( $orig_word, $replacement_word ); - - // // Get all comments // --- 187,190 ---- *************** *** 194,206 **** { $time = create_date( $board_config['default_dateformat'], $this->comments_row['comments_time'], $board_config['board_timezone'] ); - $comments_text = $this->comments_row['comments_text']; ! if ( !$kb_config['allow_html'] ) ! { ! if ( $comments_text != '' && $userdata['user_allowhtml'] ) ! { ! $comments_text = preg_replace( '#(<)([\/]?.*?)(>)#is', "<\\2>", $comments_text ); ! } ! } // --- 197,206 ---- { $time = create_date( $board_config['default_dateformat'], $this->comments_row['comments_time'], $board_config['board_timezone'] ); ! // ! // Decode comment for display ! // ! $comments_title = $mx_text->display_simple($this->comments_row['comments_title']); ! $comments_text = $mx_text->display($this->comments_row['comments_text'], $this->comments_row['comment_bbcode_uid']); // *************** *** 209,242 **** if (!$kb_config['allow_comment_images'] || !$kb_config['allow_comment_links']) { - $comments_text = $mx_kb_text_tools->remove_images_links( $comments_text, $kb_config['allow_comment_images'], $kb_config['no_comment_image_message'], $kb_config['allow_comment_links'], $kb_config['no_comment_link_message'] ); } - if ( $kb_config['allow_bbcode'] ) - { - if ( $comments_text != '' && $this->comments_row['comment_bbcode_uid'] != '' ) - { - $comments_text = ( $kb_config['allow_bbcode'] ) ? bbencode_second_pass( $comments_text, $this->comments_row['comment_bbcode_uid'] ) : preg_replace( '/\:[0-9a-z\:]+\]/si', ']', $comments_text ); - } - } - - $comments_text = make_clickable( $comments_text ); - - if ( count( $orig_word ) ) - { - if ( $comments_text != '' ) - { - $comments_text = preg_replace( $orig_word, $replacement_word, $comments_text ); - } - } - - if ( $kb_config['allow_smilies'] ) - { - if ( $userdata['user_allowsmile'] && $comments_text != '' ) - { - $comments_text = mx_smilies_pass( $comments_text ); - } - } - $poster = ( $this->comments_row['user_id'] == ANONYMOUS ) ? $lang['Guest'] : $this->comments_row['username']; $poster_avatar = ''; --- 209,215 ---- *************** *** 289,295 **** } - $comments_title = $this->comments_row['comments_title']; - $comments_text = str_replace( "\n", "\n<br />\n", $comments_text ); - // // Text formatting --- 262,265 ---- *************** *** 389,392 **** --- 359,369 ---- // + // Toggles + // + $bbcode_on = !$kb_config['allow_wysiwyg'] ? ($kb_config['allow_bbcode'] ? true : false) : false; + $html_on = !$kb_config['allow_wysiwyg'] ? ($kb_config['allow_html'] ? true : false) : true; + $smilies_on = !$kb_config['allow_wysiwyg'] ? ($kb_config['allow_smilies'] ? true : false) : false; + + // // page number (only used for kb articles) // *************** *** 406,412 **** // ! // Includes // ! include_once($phpbb_root_path . 'includes/bbcode.'.$phpEx); $template->assign_block_vars( 'use_comments', array( --- 383,392 ---- // ! // Instantiate the mx_text class // ! include_once($mx_root_path . 'includes/mx_functions_tools.'.$phpEx); ! $mx_text = new mx_text(); ! $mx_text->init($html_on, $bbcode_on, $smilies_on); // Note: allowed_html_tags is altered above ! $mx_text->allow_all_html_tags = $kb_config['allow_wysiwyg'] ? true : false; $template->assign_block_vars( 'use_comments', array( *************** *** 415,425 **** // - // Define censored word matches - // - $orig_word = array(); - $replacement_word = array(); - obtain_word_list( $orig_word, $replacement_word ); - - // // Get all comments // --- 395,398 ---- *************** *** 446,469 **** $poster_rank = $lang['Guest']; } - $comments_title = ( $this->comments_row['post_subject'] != '' ) ? $this->comments_row['post_subject'] : ''; - - $comments_text = $this->comments_row['post_text']; - $bbcode_uid = $this->comments_row['bbcode_uid']; - - // If the board has HTML off but the post has HTML - // on then we process it, else leave it alone - - if ( !$board_config['allow_html'] ) - { - if ( $user_sig != '' && $userdata['user_allowhtml'] ) - { - $user_sig = preg_replace( '#(<)([\/]?.*?)(>)#is', "<\\2>", $user_sig ); - } ! if ( $this->comments_row['enable_html'] ) ! { ! $comments_text = preg_replace( '#(<)([\/]?.*?)(>)#is', "<\\2>", $comments_text ); ! } ! } // --- 419,429 ---- $poster_rank = $lang['Guest']; } ! // ! // Decode comment for display ! // ! $comments_title = $mx_text->display_simple($this->comments_row['post_subject']); ! $comments_text = $mx_text->display($this->comments_row['post_text'], $this->comments_row['bbcode_uid']); ! $user_sig = $mx_text->display($this->comments_row['user_sig'], $this->comments_row['user_sig_bbcode_uid']); // *************** *** 472,519 **** if (!$kb_config['allow_comment_images'] || !$kb_config['allow_comment_links']) { - $comments_text = $mx_kb_text_tools->remove_images_links( $comments_text, $kb_config['allow_comment_images'], $kb_config['no_comment_image_message'], $kb_config['allow_comment_links'], $kb_config['no_comment_link_message'] ); } // - // Parse message and/or sig for BBCode if reqd - // - if ( $board_config['allow_bbcode'] ) - { - if ( $user_sig != '' && $user_sig_bbcode_uid != '' ) - { - $user_sig = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass( $user_sig, $user_sig_bbcode_uid ) : preg_replace( '/\:[0-9a-z\:]+\]/si', ']', $user_sig ); - } - - if ( $bbcode_uid != '' ) - { - $comments_text = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass( $comments_text, $bbcode_uid ) : preg_replace( '/\:[0-9a-z\:]+\]/si', ']', $comments_text ); - } - } - - if ( $user_sig != '' ) - { - $user_sig = make_clickable( $user_sig ); - } - $comments_text = make_clickable( $comments_text ); - - // - // Parse smilies - // - if ( $board_config['allow_smilies'] ) - { - if ( $this->comments_row['user_allowsmile'] && $user_sig != '' ) - { - $user_sig = mx_smilies_pass( $user_sig ); - } - - if ( $this->comments_row['enable_smilies'] ) - { - $comments_text = mx_smilies_pass( $comments_text ); - } - } - $comments_text = str_replace( "\n", "\n<br />\n", $comments_text ); - - // // Text formatting // --- 432,439 ---- Index: functions_kb.php =================================================================== RCS file: /cvsroot/mxbb/mx_kb/kb/includes/functions_kb.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** functions_kb.php 17 Jun 2006 20:11:23 -0000 1.6 --- functions_kb.php 25 Jun 2006 21:55:12 -0000 1.7 *************** *** 1429,1441 **** $length = strlen( $message ); - $title = ( !empty( $subject ) ) ? htmlspecialchars( trim ( $subject ) ) : ''; // ! // Formatting // ! $comment_bbcode_uid = make_bbcode_uid(); ! $comments_text = str_replace( '<br />', "\n", $message ); ! $comments_text = prepare_message( trim($comments_text), $html_on, $bbcode_on, $smilies_on, $comment_bbcode_uid ); ! $comments_text = bbencode_first_pass( $comments_text, $comment_bbcode_uid ); if ( $length > $kb_config['max_comment_chars'] ) --- 1429,1447 ---- $length = strlen( $message ); // ! // Instantiate the mx_text class // ! include_once($mx_root_path . 'includes/mx_functions_tools.'.$phpEx); ! $mx_text = new mx_text(); ! $mx_text->init($html_on, $bbcode_on, $smilies_on); ! //$mx_text->allow_all_html_tags = $parameter_data['parameter_type'] = 'WysiwygTextBlock' ? true : false; ! ! // ! // Encode for db storage ! // ! $title = $mx_text->encode_simple($subject); ! $comments_text = $mx_text->encode($message); ! $comment_bbcode_uid = $mx_text->bbcode_uid; if ( $length > $kb_config['max_comment_chars'] ) |
|
From: Jon O. <jon...@us...> - 2006-06-25 21:55:14
|
Update of /cvsroot/mxbb/mx_kb/kb/cache In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv26394/modules/mx_kb/kb/cache Modified Files: data_global.php Log Message: Implementing a new mx_post class, to handle all kind of html, bbcode, smilies, links, images etc Index: data_global.php =================================================================== RCS file: /cvsroot/mxbb/mx_kb/kb/cache/data_global.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** data_global.php 17 Jun 2006 20:11:23 -0000 1.3 --- data_global.php 25 Jun 2006 21:55:11 -0000 1.4 *************** *** 1,2 **** - <?php $this->vars=array('ranks'=>array('0'=>array('rank_id'=>'1','rank_title'=>'Site Admin','rank_min'=>'-1','rank_max'=>'-1','rank_special'=>'1','rank_image'=>'images/smiles/icon_cool.gif'),'1'=>array('rank_id'=>'2','rank_title'=>'Skolledare','rank_min'=>'-1','rank_max'=>'-1','rank_special'=>'1','rank_image'=>''),'2'=>array('rank_id'=>'3','rank_title'=>'Lärare','rank_min'=>'-1','rank_max'=>'-1','rank_special'=>'1','rank_image'=>''),'3'=>array('rank_id'=>'4','rank_title'=>'Ordf. Elevrådet','rank_min'=>'-1','rank_max'=>'-1','rank_special'=>'1','rank_image'=>''),'4'=>array('rank_id'=>'5','rank_title'=>'Redaktör Sambladet','rank_min'=>'-1','rank_max'=>'-1','rank_special'=>'1','rank_image'=>''),'5'=>array('rank_id'=>'6','rank_title'=>'Nätguru','rank_min'=>'-1','rank_max'=>'-1','rank_special'=>'1','rank_image'=>'')),'config'=>array('enable_module'=>'1','notify'=>'1','notify_group'=>'13','show_pretext'=>'1','pt_header'=>'Regler','pt_body'=>'Tänk på vad du skriver i dina artiklar...','use_comments'=>'1','del_topic'=>'1','use_ratings'=>'1','allow_wysiwyg'=>'1','autogenerate_comments'=>'1','stats_list'=>'1','header_banner'=>'0','votes_check_userid'=>'0','votes_check_ip'=>'0','pagination'=>'5','comments_pagination'=>'5','sort_method'=>'Latest','sort_order'=>'DESC','allow_html'=>'1','allow_bbcode'=>'1','allow_smilies'=>'1','allowed_html_tags'=>'b,i,u,a','wysiwyg_path'=>'modules/mx_shared/','module_name'=>'Knowledge Base','formatting_comment_wordwrap'=>'1','formatting_image_resize'=>'300','formatting_truncate_links'=>'1','internal_comments'=>'0','formatting_comment_image_resize'=>'3002','formatting_comment_truncate_links'=>'1','max_comment_subject_chars'=>'50','max_comment_chars'=>'5000','allowed_comment_html_tags'=>'b,i,u,a','allow_comment_wysiwyg'=>'1','allow_comment_html'=>'1','allow_comment_bbcode'=>'1','allow_comment_smilies'=>'1','allow_comment_links'=>'1','allow_comment_images'=>'1','no_comment_image_message'=>'[No image please]','no_comment_link_message'=>'[No links please]','allow_links'=>'1','allow_images'=>'1','no_image_message'=>'[No image please]','no_link_message'=>'[No links please]','formatting_wordwrap'=>'1','max_chars'=>'0','max_desc_chars'=>'500','max_subject_chars'=>'100','wysiwyg'=>'0','comments_forum_id'=>'2')); - $this->vars_ts=array('ranks'=>1150145195,'config'=>1150147653) ?> \ No newline at end of file --- 0 ---- |
|
From: Jon O. <jon...@us...> - 2006-06-25 21:53:31
|
Update of /cvsroot/mxbb/mx_calsnails/includes In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv25859/modules/mx_calsnails/includes Modified Files: cal_functions.php mx_common.php Log Message: Implementing a new mx_post class, to handle all kind of html, bbcode, smilies, links, images etc - removed changes for this module, for now Index: cal_functions.php =================================================================== RCS file: /cvsroot/mxbb/mx_calsnails/includes/cal_functions.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** cal_functions.php 29 May 2006 15:38:06 -0000 1.4 --- cal_functions.php 25 Jun 2006 21:53:26 -0000 1.5 *************** *** 150,155 **** if ( $i == 0 ) { ! $template->assign_block_vars( 'no_events', array( 'NO_EVENTS' => $lang['No records'] ) ! ); $submit_button = ''; } --- 150,154 ---- if ( $i == 0 ) { ! $template->assign_block_vars( 'no_events', array( 'NO_EVENTS' => $lang['No records'] ) ); $submit_button = ''; } *************** *** 158,163 **** $submit_button = "<input type='submit' accesskey='s' tabindex='6' name='post' class='mainoption' value='" . $lang['Submit'] . "' />"; } ! $template->assign_vars( array( 'SUBMIT' => $submit_button ) ! ); $template->pparse( 'body' ); break; --- 157,161 ---- $submit_button = "<input type='submit' accesskey='s' tabindex='6' name='post' class='mainoption' value='" . $lang['Submit'] . "' />"; } ! $template->assign_vars( array( 'SUBMIT' => $submit_button ) ); $template->pparse( 'body' ); break; *************** *** 517,521 **** { global $html_entities_match, $html_entities_replace; ! global $thisscript, $phpbb_root_path, $phpEx, $db, $template, $action, $phpbbheaders, $board_config, $cal_config, $id, $day, $month, $year, $time, $userdata, $modify, $lang, $event_desc, $subject, $caluser, $endday, $endmonth, $endyear, $bbcode_uid, $homeurl, $block_id; --- 515,519 ---- { global $html_entities_match, $html_entities_replace; ! global $thisscript, $phpbb_root_path, $mx_root_path, $phpEx, $db, $template, $action, $phpbbheaders, $board_config, $cal_config, $id, $day, $month, $year, $time, $userdata, $modify, $lang, $event_desc, $subject, $caluser, $endday, $endmonth, $endyear, $bbcode_uid, $homeurl, $block_id; Index: mx_common.php =================================================================== RCS file: /cvsroot/mxbb/mx_calsnails/includes/mx_common.php,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** mx_common.php 29 May 2006 15:38:06 -0000 1.13 --- mx_common.php 25 Jun 2006 21:53:26 -0000 1.14 *************** *** 112,116 **** function my_decode_bbtext( $bbtext, $bbcode_uid ) { ! global $board_config; $mytext = stripslashes( $bbtext ); --- 112,116 ---- function my_decode_bbtext( $bbtext, $bbcode_uid ) { ! global $board_config, $mx_root_path; $mytext = stripslashes( $bbtext ); *************** *** 126,129 **** --- 126,130 ---- $board_config['smilies_path'] = $smilies_path; } + return $mytext; } |
|
From: Jon O. <jon...@us...> - 2006-06-25 21:52:51
|
Update of /cvsroot/mxbb/core/modules/mx_textblocks In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv25772/modules/mx_textblocks Modified Files: mx_textblock_bbcode.php mx_textblock_html.php mx_textblock_multi.php Log Message: Implementing a new mx_post class, to handle all kind of html, bbcode, smilies, links, images etc Index: mx_textblock_html.php =================================================================== RCS file: /cvsroot/mxbb/core/modules/mx_textblocks/mx_textblock_html.php,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** mx_textblock_html.php 5 Apr 2006 21:07:17 -0000 1.12 --- mx_textblock_html.php 25 Jun 2006 21:52:42 -0000 1.13 *************** *** 4,8 **** * @package mxBB Portal Module - mx_textblocks * @version $Id$ ! * @copyright (c) 2002-2006 [Jon Ohlsson] mxBB Project Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * --- 4,8 ---- * @package mxBB Portal Module - mx_textblocks * @version $Id$ ! * @copyright (c) 2002-2006 [Jon Ohlsson] mxBB Project Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * *************** *** 21,24 **** --- 21,37 ---- // + // Instantiate the mx_text class + // + include_once($mx_root_path . 'includes/mx_functions_tools.'.$phpEx); + $mx_text = new mx_text(); + $mx_text->init(true, false, false); + + // + // Decode for display + // + $title = $mx_text->display($title); + $message = $mx_text->display($message); + + // // Start output of page // Index: mx_textblock_multi.php =================================================================== RCS file: /cvsroot/mxbb/core/modules/mx_textblocks/mx_textblock_multi.php,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** mx_textblock_multi.php 5 Apr 2006 21:07:17 -0000 1.15 --- mx_textblock_multi.php 25 Jun 2006 21:52:42 -0000 1.16 *************** *** 4,8 **** * @package mxBB Portal Module - mx_textblocks * @version $Id$ ! * @copyright (c) 2002-2006 [Jon Ohlsson] mxBB Project Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * --- 4,8 ---- * @package mxBB Portal Module - mx_textblocks * @version $Id$ ! * @copyright (c) 2002-2006 [Jon Ohlsson] mxBB Project Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * *************** *** 30,48 **** $board_config['allow_html_tags'] = $mx_block->get_parameters( 'html_tags' ); - // ********************************************************************** - // Read language definition - // ********************************************************************** - if( !file_exists($module_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_main.' . $phpEx) ) - { - include($module_root_path . 'language/lang_english/lang_main.' . $phpEx); - } - else - { - include($module_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_main.' . $phpEx); - } - // // Block Pages/toc // if( isset($HTTP_POST_VARS['page_num']) || isset($HTTP_GET_VARS['page_num']) ) { --- 30,37 ---- $board_config['allow_html_tags'] = $mx_block->get_parameters( 'html_tags' ); // // Block Pages/toc // + /* if( isset($HTTP_POST_VARS['page_num']) || isset($HTTP_GET_VARS['page_num']) ) { *************** *** 54,75 **** $page_num = 0; } $art_pages = explode('[page]', $message); $message = trim($art_pages[$page_num]); $message = str_replace('[toc]', '', $message); // ! // End Pages/TOC // ! if( !$allow_html ) ! { ! $message = preg_replace('#(<)([\/]?.*?)(>)#is', "<\\2>", $message); ! } ! ! if( $allow_bbcode ) ! { ! $bbcode_uid = $mx_block->get_parameters( 'Text', MX_GET_PAR_OPTIONS ); ! $message = mx_decode($message, $bbcode_uid, $allow_smilies, $allow_bbcode); ! } // --- 43,65 ---- $page_num = 0; } + */ + $page_num = $mx_request_vars->request('page_num', MX_TYPE_INT, 1) - 1; $art_pages = explode('[page]', $message); $message = trim($art_pages[$page_num]); $message = str_replace('[toc]', '', $message); + // ! // Instantiate the mx_text class // + include_once($mx_root_path . 'includes/mx_functions_tools.'.$phpEx); + $mx_text = new mx_text(); + $mx_text->init($allow_html, $allow_bbcode, $allow_smilies); // Note: allowed_html_tags is altered above ! // ! // Decode for display ! // ! $title = $mx_text->display_simple($title); ! $message = $mx_text->display($message, $mx_block->get_parameters( 'Text', MX_GET_PAR_OPTIONS )); // *************** *** 125,133 **** $art_split = explode('[toc]', $art_pages[$i]); $article_toc = $art_split[0]; - // $article_body = $art_split[1]; // // Fix up the toc title // if( !$allow_html ) { --- 115,123 ---- $art_split = explode('[toc]', $art_pages[$i]); $article_toc = $art_split[0]; // // Fix up the toc title // + if( !$allow_html ) { *************** *** 224,227 **** $template->pparse('body_block'); - ?> \ No newline at end of file --- 214,216 ---- Index: mx_textblock_bbcode.php =================================================================== RCS file: /cvsroot/mxbb/core/modules/mx_textblocks/mx_textblock_bbcode.php,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** mx_textblock_bbcode.php 5 Apr 2006 21:07:17 -0000 1.13 --- mx_textblock_bbcode.php 25 Jun 2006 21:52:42 -0000 1.14 *************** *** 4,12 **** * @package mxBB Portal Module - mx_textblocks * @version $Id$ ! * @copyright (c) 2002-2006 [Jon Ohlsson] mxBB Project Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ ! if( !defined('IN_PORTAL') || !is_object($mx_block)) { --- 4,12 ---- * @package mxBB Portal Module - mx_textblocks * @version $Id$ ! * @copyright (c) 2002-2006 [Jon Ohlsson] mxBB Project Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ ! if( !defined('IN_PORTAL') || !is_object($mx_block)) { *************** *** 23,27 **** $html_on = $board_config['allow_html'] ? true : false; $smilies_on = $board_config['allow_smilies'] ? true : false; ! if( !$html_on ) { --- 23,41 ---- $html_on = $board_config['allow_html'] ? true : false; $smilies_on = $board_config['allow_smilies'] ? true : false; ! ! // ! // Instantiate the mx_text class ! // ! include_once($mx_root_path . 'includes/mx_functions_tools.'.$phpEx); ! $mx_text = new mx_text(); ! $mx_text->init($html_on, $bbcode_on, $smilies_on); ! ! // ! // Decode for display ! // ! $title = $mx_text->display($title); ! $message = $mx_text->display($message, $mx_block->get_parameters( 'Text', MX_GET_PAR_OPTIONS )); ! ! /* if( !$html_on ) { *************** *** 34,37 **** --- 48,52 ---- $message = mx_decode($message, $bbcode_uid, $smilies_on, $bbcode_on); } + */ // |
|
From: Jon O. <jon...@us...> - 2006-06-25 21:52:47
|
Update of /cvsroot/mxbb/core/includes In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv25772/includes Modified Files: mx_functions_tools.php Log Message: Implementing a new mx_post class, to handle all kind of html, bbcode, smilies, links, images etc Index: mx_functions_tools.php =================================================================== RCS file: /cvsroot/mxbb/core/includes/mx_functions_tools.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** mx_functions_tools.php 17 Jun 2006 20:09:07 -0000 1.2 --- mx_functions_tools.php 25 Jun 2006 21:52:41 -0000 1.3 *************** *** 16,19 **** --- 16,522 ---- } + // + // This 'include' is needed for the mx_text class + // + include_once($phpbb_root_path . 'includes/bbcode.'.$phpEx); + + /** + * Class mx_text. + * + * This class simplifies all text handling: display text on pages, formatting text for editing and storing. + * - based on phpBB 2.0.x code + * + * Methods: + * - display[_simple]: decode rich/simple text (from db) for display on normal pages + * - decode[_simple]: decode rich/simple text for editing in form fields + * - encode_preview[_simple]: encode rich/simple form data for preview + * - encode[_simple|_username]: encode form data to be stored in db + * + * Note: Be sure to check in what format the methods expect its data + * Note(2): Be sure to init the object before usage. + */ + class mx_text + { + var $orig_word = array(); + var $replacement_word = array(); + + var $highlight_match = ''; + var $highlight_match_color = ''; + var $highlight = ''; + + var $bbcode_uid = ''; // set when encoding data + + // + // Toggles + // + var $html_on = false; + var $bbcode_on = true; + var $smilies_on = false; + var $links_on = true; + var $images_on = true; + + var $allow_all_html_tags = false; + + function init($html_on = false, $bbcode_on = true, $smilies_on = false, $links_on = true, $images_on = true) + { + global $theme; + + // + // Toggles + // + $this->html_on = $html_on; + $this->bbcode_on = $bbcode_on; + $this->smilies_on = $smilies_on; + $this->links_on = $links_on; + $this->images_on = $images_on; + + // + // Define censored word matches + // + obtain_word_list($this->orig_word, $this->replacement_word); + + // + // Was a highlight request part of the URI? + // + if (isset($_GET['highlight'])) + { + // Split words and phrases + $words = explode(' ', trim(htmlspecialchars($_GET['highlight']))); + + for($i = 0; $i < sizeof($words); $i++) + { + if (trim($words[$i]) != '') + { + $this->highlight_match .= (($this->highlight_match != '') ? '|' : '') . str_replace('*', '\w*', preg_quote($words[$i], '#')); + } + } + unset($words); + + $this->highlight = urlencode($_GET['highlight']); + $this->highlight_match = phpbb_rtrim($this->highlight_match, "\\"); + } + + // + // Highlight match color + // + $this->highlight_match_color = $theme['fontcolor3']; + + } + + /** + * decode rich text for display on normal pages. + * + * This method decodes full text and handles html, bbcode, images, links, highlights, censored words etc + * Based on phpBB viewtopic.php and functions_post.php (phpBB 2.0.21) + * + * @param string $text text (from db) + * @param string $bbcode_uid + */ + function display($text, $bbcode_uid = '') + { + // + // strip html if reqd + // + if ( !$this->html_on ) + { + if ( $text != '' ) + { + $text = preg_replace('#(<)([\/]?.*?)(>)#is', "<\\2>", $text); + } + } + + // + // BBCode if reqd + // + if ($text != '' && $bbcode_uid != '') + { + $text = ($this->bbcode_on) ? bbencode_second_pass($text, $bbcode_uid) : preg_replace("/\:$bbcode_uid/si", '', $text); + } + + if ( $text != '' ) + { + $text = make_clickable($text); + } + + // + // Parse smilies + // + if ( $this->smilies_on ) + { + if ( $text != '' ) + { + $text = smilies_pass($text); + } + } + + // + // Highlight active words (primarily for search) + // + if ($this->highlight_match) + { + // This has been back-ported from 3.0 CVS + $text = preg_replace('#(?!<.*)(?<!\w)(' . $this->highlight_match . ')(?!\w|[^<>]*>)#i', '<b style="color:#'.$this->highlight_match_color.'">\1</b>', $text); + } + + // + // Replace naughty words + // + if (count($this->orig_word)) + { + if ($text != '') + { + $text = str_replace('\"', '"', substr(@preg_replace('#(\>(((?>([^><]+|(?R)))*)\<))#se', "@preg_replace(\$this->orig_word, \$this->replacement_word, '\\0')", '>' . $text . '<'), 1, -1)); + } + + } + + // + // Replace newlines (we use this rather than nl2br because + // till recently it wasn't XHTML compliant) + // + if ( $text != '' ) + { + $text = str_replace("\n", "\n<br />\n", $text); + } + + return $text; + } + + /** + * decode simple text for display on normal pages. + * + * Eg: titles, short descriptions etc + * + * @param unknown_type $text + */ + function display_simple($text) + { + if ( $text != '' ) + { + $text = ( count($this->orig_word) ) ? preg_replace($this->orig_word, $this->replacement_word, $text) : $text; + } + + return $text; + } + + /** + * decode rich text for editing in form fields. + * + * @param unknown_type $text + * @param unknown_type $bbcode_uid + * @param unknown_type $refresh + */ + function decode($text, $bbcode_uid = '', $refresh = false) + { + if ($refresh) + { + // + // This is raw _GET/_POST data + // + $text = ( !empty($text) ) ? htmlspecialchars(trim(stripslashes($text))) : ''; + } + + if ( $bbcode_uid != '' ) + { + $text = preg_replace('/\:(([a-z0-9]:)?)' . $bbcode_uid . '/s', '', $text); + } + + $text = str_replace('<', '<', $text); + $text = str_replace('>', '>', $text); + $text = str_replace('<br />', "\n", $text); + + return $text; + } + + /** + * decode simple text for editing in form fields. + * + * Eg: titles, usernames, short descriptions etc + * + * @param unknown_type $text + * @param unknown_type $refresh + */ + function decode_simple($text, $refresh = false) + { + + if ($refresh) + { + // + // This is raw _GET/_POST data + // + $text = ( !empty($text) ) ? htmlspecialchars(trim(stripslashes($text))) : ''; + } + + return $text; + } + + /** + * encode rich form data to be stored in db. + * + * Encode text to be db valid. + * Note: passed "text" should be raw _GET/_POST data + * + * @param unknown_type $text + * @return unknown + */ + function encode($text) + { + global $board_config, $userdata, $lang, $phpEx, $phpbb_root_path; + + $this->bbcode_uid = ''; + + // + // Check message + // + if (!empty($text)) + { + $this->bbcode_uid = ($this->bbcode_on) ? make_bbcode_uid() : ''; + $text = $this->prepare_message(trim($text), $this->html_on, $this->bbcode_on, $this->smilies_on, $this->bbcode_uid); + } + + return str_replace("\'", "''", $text); + } + + /** + * encode simple form data to be stored in db. + * + * @param unknown_type $text + */ + function encode_simple($text) + { + global $board_config, $userdata, $lang, $phpEx, $phpbb_root_path; + + // + // Check $text + // + if (!empty($text)) + { + $text = htmlspecialchars(trim($text)); + } + + return str_replace("\'", "''", $text); + } + + /** + * encode username form data to be stored in db. + * + * @param unknown_type $username + */ + function encode_username($username) + { + global $board_config, $userdata, $lang, $phpEx, $phpbb_root_path; + + // + // Check username + // + if (!empty($username)) + { + $username = phpbb_clean_username($username); + + if (!$userdata['session_logged_in'] || ($userdata['session_logged_in'] && $username != $userdata['username'])) + { + include($phpbb_root_path . 'includes/functions_validate.'.$phpEx); + + $result = validate_username($username); + if ($result['error']) + { + $error_msg .= (!empty($error_msg)) ? '<br />' . $result['error_msg'] : $result['error_msg']; + } + } + else + { + $username = ''; + } + } + + return str_replace("\'", "''", $username); + } + + /** + * encode rich form data for preview + * + * @param unknown_type $text + */ + function encode_preview($text) + { + global $html_entities_match, $html_entities_replace, $board_config; + + if ($this->allow_all_html_tags) + { + $html_entities_match = array(); + $html_entities_replace = array(); + $board_config['allow_html_tags'] = ''; + } + + $text = ( !empty($text) ) ? htmlspecialchars(trim(stripslashes($text))) : ''; + + $bbcode_uid = ( $this->bbcode_on ) ? make_bbcode_uid() : ''; + $text = stripslashes($this->prepare_message(addslashes($this->unprepare_message($text)), $this->html_on, $this->bbcode_on, $this->smilies_on, $bbcode_uid)); + + if( $this->bbcode_on ) + { + $text = bbencode_second_pass($text, $bbcode_uid); + } + + if( !empty($this->orig_word) ) + { + $text = ( !empty($text) ) ? preg_replace($this->orig_word, $this->replacement_word, $text) : ''; + } + + $text = make_clickable($text); + + if( $this->smilies_on ) + { + $text = smilies_pass($text); + } + + $text = str_replace("\n", '<br />', $text); + + return $text; + } + + /** + * encode simple form data for preview + * + * Eg: Works for titles, usernames, etc + * + * @param unknown_type $text + */ + function encode_preview_simple($text) + { + $text = ( !empty($text) ) ? htmlspecialchars(trim(stripslashes($text))) : ''; + + if( !empty($this->orig_word) ) + { + $text = ( !empty($text) ) ? preg_replace($this->orig_word, $this->replacement_word, $text) : ''; + } + + return $text; + } + + // + // This function will prepare a posted message for + // entry into the database. + // - borrowed from phpBB 2.0.21 + // + function prepare_message($message, $html_on, $bbcode_on, $smile_on, $bbcode_uid = 0) + { + global $board_config, $html_entities_match, $html_entities_replace; + + // + // Clean up the message + // + $message = trim($message); + + if ($html_on) + { + // If HTML is on, we try to make it safe + // This approach is quite agressive and anything that does not look like a valid tag + // is going to get converted to HTML entities + $message = stripslashes($message); + $html_match = '#<[^\w<]*(\w+)((?:"[^"]*"|\'[^\']*\'|[^<>\'"])+)?>#'; + $matches = array(); + + $message_split = preg_split($html_match, $message); + preg_match_all($html_match, $message, $matches); + + if (!$this->allow_all_html_tags) // Bypass this check for typical (allow all) html text + { + $message = ''; + + foreach ($message_split as $part) + { + $tag = array(array_shift($matches[0]), array_shift($matches[1]), array_shift($matches[2])); + $message .= preg_replace($html_entities_match, $html_entities_replace, $part) . $this->clean_html($tag); + } + } + + $message = addslashes($message); + $message = str_replace('"', '\"', $message); + } + else + { + $message = preg_replace($html_entities_match, $html_entities_replace, $message); + } + + if($bbcode_on && $bbcode_uid != '') + { + $message = bbencode_first_pass($message, $bbcode_uid); + } + + return $message; + } + + function unprepare_message($message) + { + global $unhtml_specialchars_match, $unhtml_specialchars_replace; + + return preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, $message); + } + + /** + * Called from within prepare_message to clean included HTML tags if HTML is + * turned on for that post + * @param array $tag Matching text from the message to parse + */ + function clean_html($tag) + { + global $board_config; + + if (empty($tag[0])) + { + return ''; + } + + $allowed_html_tags = preg_split('/, */', strtolower($board_config['allow_html_tags'])); + $disallowed_attributes = '/^(?:style|on)/i'; + + // Check if this is an end tag + preg_match('/<[^\w\/]*\/[\W]*(\w+)/', $tag[0], $matches); + if (sizeof($matches)) + { + if (in_array(strtolower($matches[1]), $allowed_html_tags)) + { + return '</' . $matches[1] . '>'; + } + else + { + return htmlspecialchars('</' . $matches[1] . '>'); + } + } + + // Check if this is an allowed tag + if (in_array(strtolower($tag[1]), $allowed_html_tags)) + { + $attributes = ''; + if (!empty($tag[2])) + { + preg_match_all('/[\W]*?(\w+)[\W]*?=[\W]*?(["\'])((?:(?!\2).)*)\2/', $tag[2], $test); + for ($i = 0; $i < sizeof($test[0]); $i++) + { + if (preg_match($disallowed_attributes, $test[1][$i])) + { + continue; + } + $attributes .= ' ' . $test[1][$i] . '=' . $test[2][$i] . str_replace(array('[', ']'), array('[', ']'), htmlspecialchars($test[3][$i])) . $test[2][$i]; + } + } + if (in_array(strtolower($tag[1]), $allowed_html_tags)) + { + return '<' . $tag[1] . $attributes . '>'; + } + else + { + return htmlspecialchars('<' . $tag[1] . $attributes . '>'); + } + } + // Finally, this is not an allowed tag so strip all the attibutes and escape it + else + { + return htmlspecialchars('<' . $tag[1] . '>'); + } + } + } + /** * Class: mx_tools. *************** *** 697,716 **** } } - - class mx_post - { - function decode($text, $bbcode_uid = '', $html_on = false, $bbcode_on = true, $smilies_on = false, $links_on = true, $images_on = true) - { - global $board_config; - - return $text; - } - - function encode($text, $bbcode_uid = '', $html_on = false, $bbcode_on = true, $smilies_on = false, $links_on = true, $images_on = true) - { - global $board_config; - - return $text; - } - } ?> \ No newline at end of file --- 1200,1202 ---- |
|
From: Jon O. <jon...@us...> - 2006-06-25 21:52:47
|
Update of /cvsroot/mxbb/core/modules/mx_textblocks/admin In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv25772/modules/mx_textblocks/admin Modified Files: mx_module_defs.php Log Message: Implementing a new mx_post class, to handle all kind of html, bbcode, smilies, links, images etc Index: mx_module_defs.php =================================================================== RCS file: /cvsroot/mxbb/core/modules/mx_textblocks/admin/mx_module_defs.php,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** mx_module_defs.php 17 Jun 2006 20:09:07 -0000 1.17 --- mx_module_defs.php 25 Jun 2006 21:52:42 -0000 1.18 *************** *** 50,54 **** function submit_module_parameters( $parameter_data, $block_id ) { ! global $HTTP_POST_VARS, $db, $board_config, $mx_cache, $mx_blockcp, $mx_root_path, $phpEx; global $html_entities_match, $html_entities_replace; --- 50,54 ---- function submit_module_parameters( $parameter_data, $block_id ) { ! global $HTTP_POST_VARS, $db, $board_config, $mx_cache, $mx_blockcp, $mx_root_path, $phpbb_root_path, $phpEx; global $html_entities_match, $html_entities_replace; *************** *** 63,76 **** $smilies_on = $board_config['allow_smilies'] ? true : false; - if( $bbcode_on ) - { - $bbcode_uid = make_bbcode_uid(); - } - break; case 'CustomizedTextBlock': - // - // "Hasty" code to find text format settings. Could be wrong... - // $bbcode_on = isset($HTTP_POST_VARS[$mx_blockcp->block_parameters['allow_bbcode']['parameter_id']]) ? $HTTP_POST_VARS[$mx_blockcp->block_parameters['allow_bbcode']['parameter_id']] == 'TRUE' : $mx_blockcp->block_parameters['allow_bbcode']['parameter_value'] == 'TRUE'; $html_on = isset($HTTP_POST_VARS[$mx_blockcp->block_parameters['allow_html']['parameter_id']]) ? $HTTP_POST_VARS[$mx_blockcp->block_parameters['allow_html']['parameter_id']] == 'TRUE' : $mx_blockcp->block_parameters['allow_html']['parameter_value'] == 'TRUE'; --- 63,68 ---- *************** *** 78,86 **** $board_config['allow_html_tags'] = isset($HTTP_POST_VARS[$mx_blockcp->block_parameters['html_tags']['parameter_id']]) ? $HTTP_POST_VARS[$mx_blockcp->block_parameters['html_tags']['parameter_id']] : $mx_blockcp->block_parameters['html_tags']['parameter_value']; - if( $bbcode_on ) - { - $bbcode_uid = make_bbcode_uid(); - } - break; case 'WysiwygTextBlock': --- 70,73 ---- *************** *** 88,103 **** $html_on = true; $smilies_on = false; ! $bbcode_uid = 0; ! ! // Remove allowed html tags ! $html_entities_match = array(); ! $html_entities_replace = array(); ! break; } ! $parameter_value = prepare_message(trim($parameter_value), $html_on, $bbcode_on, $smilies_on, $bbcode_uid); ! $parameter_opt = $bbcode_uid; // --- 75,96 ---- $html_on = true; $smilies_on = false; ! $bbcode_uid = ''; break; } ! // ! // Instantiate the mx_text class ! // ! include_once($mx_root_path . 'includes/mx_functions_tools.'.$phpEx); ! $mx_text = new mx_text(); ! $mx_text->init($html_on, $bbcode_on, $smilies_on); ! $mx_text->allow_all_html_tags = $parameter_data['parameter_type'] = 'WysiwygTextBlock' ? true : false; ! ! // ! // Encode for db storage ! // ! $parameter_value = $mx_text->encode($parameter_value); ! $parameter_opt = $mx_text->bbcode_uid; // *************** *** 112,116 **** mx_admin::mx_add_search_words('single', $block_id, $parameter_value, $block_title); - return array('parameter_value' => $parameter_value, 'parameter_opt' => $parameter_opt); } --- 105,108 ---- *************** *** 139,160 **** function display_edit_phpBBTextBlock( $block_id, $parameter_id, $parameter_data ) { ! global $template, $board_config, $db, $theme, $lang, $images, $mx_blockcp, $mx_root_path, $phpEx, $mx_table_prefix, $table_prefix; global $HTTP_POST_VARS; ! $parameter_value = isset($HTTP_POST_VARS['preview']) ? htmlspecialchars(trim(stripslashes($HTTP_POST_VARS[$parameter_data['parameter_name']]))) : $parameter_data['parameter_value']; $bbcode_on = $board_config['allow_bbcode'] ? true : false; $html_on = $board_config['allow_html'] ? true : false; $smilies_on = $board_config['allow_smilies'] ? true : false; ! $bbcode_uid = $parameter_data['parameter_opt']; if ( isset($HTTP_POST_VARS['preview']) ) { ! $this->preview($parameter_value, $html_on, $bbcode_on, $smilies_on); $template->assign_block_vars('preview', array()); } else { ! $parameter_value = $this->decode($parameter_value, $bbcode_uid); } --- 131,179 ---- function display_edit_phpBBTextBlock( $block_id, $parameter_id, $parameter_data ) { ! global $template, $board_config, $db, $theme, $lang, $images, $mx_blockcp, $mx_root_path, $phpbb_root_path, $phpEx, $mx_table_prefix, $table_prefix; global $HTTP_POST_VARS; ! $parameter_value = isset($HTTP_POST_VARS['preview']) ? $HTTP_POST_VARS[$parameter_data['parameter_name']] : $parameter_data['parameter_value']; ! $bbcode_uid = isset($HTTP_POST_VARS['preview']) ? '' : $parameter_data['parameter_opt']; + // + // Toggles + // $bbcode_on = $board_config['allow_bbcode'] ? true : false; $html_on = $board_config['allow_html'] ? true : false; $smilies_on = $board_config['allow_smilies'] ? true : false; ! ! // ! // Instantiate the mx_text class ! // ! include_once($mx_root_path . 'includes/mx_functions_tools.'.$phpEx); ! $mx_text = new mx_text(); ! $mx_text->init($html_on, $bbcode_on, $smilies_on); if ( isset($HTTP_POST_VARS['preview']) ) { ! // ! // Encode for preview ! // ! $preview_text = $mx_text->encode_preview($parameter_value); ! ! $template->assign_vars(array( ! 'TEXT' => $preview_text ! )); ! $template->assign_block_vars('preview', array()); + + // + // Decode for form editing + // + $parameter_value = $mx_text->decode($parameter_value, '', true); } else { ! // ! // Decode for form editing ! // ! $parameter_value = $mx_text->decode($parameter_value, $bbcode_uid); ! } *************** *** 248,275 **** function display_edit_CustomizedTextBlock( $block_id, $parameter_id, $parameter_data ) { ! global $template, $board_config, $db, $theme, $lang, $images, $mx_blockcp, $mx_root_path, $phpEx, $mx_table_prefix, $table_prefix, $html_entities_match, $html_entities_replace; global $HTTP_POST_VARS; ! $parameter_value = isset($HTTP_POST_VARS['preview']) ? htmlspecialchars(trim(stripslashes($HTTP_POST_VARS[$parameter_data['parameter_name']]))) : $parameter_data['parameter_value']; ! // Extract customized textblock settings $bbcode_on = true? true : false; $html_on = true? true : false; $smilies_on = true? true : false; ! // Remove allowed html tags ! $html_entities_match = array(); ! $html_entities_replace = array(); ! ! $bbcode_uid = $parameter_data['parameter_opt']; if ( isset($HTTP_POST_VARS['preview']) ) { ! $this->preview($parameter_value, $html_on, $bbcode_on, $smilies_on); $template->assign_block_vars('preview', array()); } else { ! $parameter_value = $this->decode($parameter_value, $bbcode_uid); } --- 267,314 ---- function display_edit_CustomizedTextBlock( $block_id, $parameter_id, $parameter_data ) { ! global $template, $board_config, $db, $theme, $lang, $images, $mx_blockcp, $mx_root_path, $phpbb_root_path, $phpEx, $mx_table_prefix, $table_prefix, $html_entities_match, $html_entities_replace; global $HTTP_POST_VARS; ! $parameter_value = isset($HTTP_POST_VARS['preview']) ? $HTTP_POST_VARS[$parameter_data['parameter_name']] : $parameter_data['parameter_value']; ! $bbcode_uid = isset($HTTP_POST_VARS['preview']) ? '' : $parameter_data['parameter_opt']; ! // ! // Toggles ????????????????? ! // $bbcode_on = true? true : false; $html_on = true? true : false; $smilies_on = true? true : false; ! // ! // Instantiate the mx_text class ! // ! include_once($mx_root_path . 'includes/mx_functions_tools.'.$phpEx); ! $mx_text = new mx_text(); ! $mx_text->init($html_on, $bbcode_on, $smilies_on); if ( isset($HTTP_POST_VARS['preview']) ) { ! // ! // Encode for preview ! // ! $preview_text = $mx_text->encode_preview($parameter_value); ! ! $template->assign_vars(array( ! 'TEXT' => $preview_text ! )); ! $template->assign_block_vars('preview', array()); + + // + // Decode for form editing + // + $parameter_value = $mx_text->decode($parameter_value, '', true); } else { ! // ! // Decode for form editing ! // ! $parameter_value = $mx_text->decode($parameter_value, $bbcode_uid); } *************** *** 365,391 **** global $HTTP_POST_VARS; ! $parameter_value = $parameter_data['parameter_value']; ! // Extract customized textblock settings $bbcode_on = false; $html_on = true; $smilies_on = false; ! // Remove allowed html tags ! $html_entities_match = array(); ! $html_entities_replace = array(); // ! // HTML, BBCode & Smilies toggle selection // ! $html_status = ( $html_on ) ? $lang['HTML_is_ON'] : $lang['HTML_is_OFF']; ! $bbcode_status = ( $bbcode_on ) ? $lang['BBCode_is_ON'] : $lang['BBCode_is_OFF']; ! $smilies_status = ( $smilies_on ) ? $lang['Smilies_are_ON'] : $lang['Smilies_are_OFF']; if ( isset($HTTP_POST_VARS['preview']) ) { ! $this->preview($parameter_value, $html_on, $bbcode_on, $smilies_on, true); $template->assign_block_vars('preview', array()); } $template->set_filenames(array( --- 404,463 ---- global $HTTP_POST_VARS; ! $parameter_value = isset($HTTP_POST_VARS['preview']) ? $HTTP_POST_VARS[$parameter_data['parameter_name']] : $parameter_data['parameter_value']; ! $bbcode_uid = isset($HTTP_POST_VARS['preview']) ? '' : $parameter_data['parameter_opt']; ! // ! // Toggles ! // $bbcode_on = false; $html_on = true; $smilies_on = false; ! // ! // Instantiate the mx_text class ! // ! include_once($mx_root_path . 'includes/mx_functions_tools.'.$phpEx); ! $mx_text = new mx_text(); ! $mx_text->init($html_on, $bbcode_on, $smilies_on); // ! // Allow all html tags ! // Fix: Setting 'emtpy' enables all // ! $mx_text->allow_all_html_tags = true; if ( isset($HTTP_POST_VARS['preview']) ) { ! // ! // Encode for preview ! // ! $preview_text = $mx_text->encode_preview($parameter_value); ! ! $template->assign_vars(array( ! 'TEXT' => $preview_text ! )); ! $template->assign_block_vars('preview', array()); + + // + // Decode for form editing + // + $parameter_value = $mx_text->decode($parameter_value, '', true); } + else + { + // + // Decode for form editing + // + $parameter_value = $mx_text->decode($parameter_value, $bbcode_uid); + + } + + // + // HTML, BBCode & Smilies toggle selection + // + $html_status = ( $html_on ) ? $lang['HTML_is_ON'] : $lang['HTML_is_OFF']; + $bbcode_status = ( $bbcode_on ) ? $lang['BBCode_is_ON'] : $lang['BBCode_is_OFF']; + $smilies_status = ( $smilies_on ) ? $lang['Smilies_are_ON'] : $lang['Smilies_are_OFF']; $template->set_filenames(array( *************** *** 401,407 **** $langcode = mx_get_langcode(); $template->assign_block_vars( "tinyMCE", array( ! 'PATH' => $mx_root_path, ! 'LANG' => !empty($langcode) ? $langcode : $HTTP_SERVER_VARS['HTTP_ACCEPT_LANGUAGE'], ! 'TEMPLATE' => $phpbb_root_path . 'templates/'. $theme['template_name'] . '/' . $theme['head_stylesheet'] )); } --- 473,479 ---- $langcode = mx_get_langcode(); $template->assign_block_vars( "tinyMCE", array( ! 'PATH' => $mx_root_path, ! 'LANG' => !empty($langcode) ? $langcode : $HTTP_SERVER_VARS['HTTP_ACCEPT_LANGUAGE'], ! 'TEMPLATE' => $phpbb_root_path . 'templates/'. $theme['template_name'] . '/' . $theme['head_stylesheet'] )); } *************** *** 415,419 **** --- 487,493 ---- 'L_PREVIEW' => $lang['Preview'], + // // To sync script and textarea select field + // 'SELECT_NAME' => $parameter_data['parameter_name'], )); *************** *** 428,495 **** $template->pparse('parameter'); } - - function decode($text = '', $bbcode_uid = '') - { - if( $bbcode_uid != '' ) - { - $text = preg_replace('/\:(([a-z0-9]:)?)' . $bbcode_uid . '/s', '', $text); - } - - $text = str_replace('<', '<', $text); - $text = str_replace('>', '>', $text); - $text = str_replace('<br />', "\n", $text); - - return $text; - } - - // =================================================== - // Preview Textblock - // =================================================== - function preview($text, $html_on, $bbcode_on, $smilies_on, $is_html_textblock = false) - { - global $board_config, $template, $lang, $html_entities_match, $html_entities_replace; - - $preview_text = $text; - - $orig_word = array(); - $replacement_word = array(); - obtain_word_list($orig_word, $replacement_word); - - if (!$is_html_textblock) - { - $bbcode_uid = ( $bbcode_on ) ? make_bbcode_uid() : ''; - $preview_text = stripslashes(prepare_message(addslashes(unprepare_message($preview_text)), $html_on, $bbcode_on, $smilies_on, $bbcode_uid)); - - if( $bbcode_on ) - { - $preview_text = bbencode_second_pass($preview_text, $bbcode_uid); - } - - if( count($orig_word) ) - { - $preview_text = preg_replace($orig_word, $replacement_word, $preview_text); - } - - if( $smilies_on ) - { - $preview_text = mx_smilies_pass($preview_text); - } - - $preview_text = make_clickable($preview_text); - - $preview_text = str_replace("\n", '<br />', $preview_text); - } - else - { - $preview_text = str_replace("\n", '', $preview_text); - } - - $template->assign_vars(array( - 'TEXT' => $preview_text - )); - - return $preview_text; - } - } ?> \ No newline at end of file --- 502,505 ---- |
|
From: Jon O. <jon...@us...> - 2006-06-18 10:48:00
|
Update of /cvsroot/mxbb/mx_smartor/album_mod In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv27012/modules/mx_smartor/album_mod Modified Files: clown_album_functions.php Log Message: update Index: clown_album_functions.php =================================================================== RCS file: /cvsroot/mxbb/mx_smartor/album_mod/clown_album_functions.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** clown_album_functions.php 5 Apr 2006 23:03:48 -0000 1.5 --- clown_album_functions.php 18 Jun 2006 10:47:56 -0000 1.6 *************** *** 17,23 **** { // Pre: returns what type of rating style to display ! global $db, $album_sp_config, $lang, $module_root_path; // deside how user wants to show their rating ! if ( $album_sp_config['rate_type'] == 0 ) // display only images { --- 17,23 ---- { // Pre: returns what type of rating style to display ! global $db, $album_sp_config, $lang, $module_root_path; // deside how user wants to show their rating ! if ( $album_sp_config['rate_type'] == 0 ) // display only images { *************** *** 63,67 **** global $db, $board_config, $template, $lang, $images, $theme, $phpEx, $mx_root_path; global $user_ip, $session_length, $starttime; ! global $userdata; // MX global $is_block; --- 63,67 ---- global $db, $board_config, $template, $lang, $images, $theme, $phpEx, $mx_root_path; global $user_ip, $session_length, $starttime; ! global $userdata; // MX global $is_block; *************** *** 84,94 **** } ! $template->set_filenames( array( 'smiliesbody' => 'album_posting_smilies.tpl' ) ! ); } ! $sql = "SELECT emoticon, code, smile_url ! FROM " . SMILIES_TABLE . " ! ORDER BY smilies_id"; if ( $result = $db->sql_query( $sql ) ) { --- 84,93 ---- } ! $template->set_filenames( array( 'smiliesbody' => 'album_posting_smilies.tpl' ) ); } ! $sql = "SELECT emoticon, code, smile_url ! FROM " . SMILIES_TABLE . " ! ORDER BY smilies_id"; if ( $result = $db->sql_query( $sql ) ) { *************** *** 123,127 **** $template->assign_block_vars( 'smilies_row.smilies_col', array( 'SMILEY_CODE' => $data['code'], 'SMILEY_IMG' => $board_config['smilies_path'] . '/' . $smile_url, ! 'SMILEY_DESC' => $data['emoticon'] ) ); --- 122,126 ---- $template->assign_block_vars( 'smilies_row.smilies_col', array( 'SMILEY_CODE' => $data['code'], 'SMILEY_IMG' => $board_config['smilies_path'] . '/' . $smile_url, ! 'SMILEY_DESC' => $data['emoticon'] ) ); *************** *** 148,152 **** $template->assign_vars( array( 'L_MORE_SMILIES' => $lang['More_emoticons'], ! 'U_MORE_SMILIES' => append_sid( $phpbb_root_path . "posting.$phpEx?mode=smilies" ) ) ); } --- 147,151 ---- $template->assign_vars( array( 'L_MORE_SMILIES' => $lang['More_emoticons'], ! 'U_MORE_SMILIES' => append_sid( $phpbb_root_path . "posting.$phpEx?mode=smilies" ) ) ); } *************** *** 154,158 **** $template->assign_vars( array( 'L_EMOTICONS' => $lang['Emoticons'], 'L_CLOSE_WINDOW' => $lang['Close_window'], ! 'S_SMILIES_COLSPAN' => $s_colspan ) ); } --- 153,157 ---- $template->assign_vars( array( 'L_EMOTICONS' => $lang['Emoticons'], 'L_CLOSE_WINDOW' => $lang['Close_window'], ! 'S_SMILIES_COLSPAN' => $s_colspan ) ); } |
|
From: Jon O. <jon...@us...> - 2006-06-18 10:48:00
|
Update of /cvsroot/mxbb/mx_smartor/includes In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv27012/modules/mx_smartor/includes Modified Files: album_cat_sort.php Log Message: update Index: album_cat_sort.php =================================================================== RCS file: /cvsroot/mxbb/mx_smartor/includes/album_cat_sort.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** album_cat_sort.php 2 May 2006 23:29:32 -0000 1.6 --- album_cat_sort.php 18 Jun 2006 10:47:56 -0000 1.7 *************** *** 51,54 **** --- 51,55 ---- redirect( append_sid( this_smartor_mxurl( "smartor_mode=album_personal" ) ) ); } + // Beginning of Jaime's Initials Mod $letters = array( 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' ); |
|
From: Jon O. <jon...@us...> - 2006-06-18 10:47:18
|
Update of /cvsroot/mxbb/mx_profilecp In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv26950/modules/mx_profilecp Modified Files: profile_avatar.php profile_birthday.php profile_pic.php Log Message: update Index: profile_avatar.php =================================================================== RCS file: /cvsroot/mxbb/mx_profilecp/profile_avatar.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** profile_avatar.php 2 May 2006 23:28:36 -0000 1.6 --- profile_avatar.php 18 Jun 2006 10:47:14 -0000 1.7 *************** *** 25,29 **** // $userdata = session_pagestart($user_ip, PAGE_SEARCH); // init_userprefs($userdata); ! $mx_user->init($user_ip, PAGE_INDEX); --- 25,29 ---- // $userdata = session_pagestart($user_ip, PAGE_SEARCH); // init_userprefs($userdata); ! $mx_user->init($user_ip, PAGE_INDEX); Index: profile_birthday.php =================================================================== RCS file: /cvsroot/mxbb/mx_profilecp/profile_birthday.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** profile_birthday.php 2 May 2006 23:28:36 -0000 1.6 --- profile_birthday.php 18 Jun 2006 10:47:14 -0000 1.7 *************** *** 24,28 **** // $userdata = session_pagestart($user_ip, PAGE_INDEX); // init_userprefs($userdata); ! $mx_user->init($user_ip, PAGE_INDEX); // --- 24,28 ---- // $userdata = session_pagestart($user_ip, PAGE_INDEX); // init_userprefs($userdata); ! $mx_user->init($user_ip, PAGE_INDEX); // Index: profile_pic.php =================================================================== RCS file: /cvsroot/mxbb/mx_profilecp/profile_pic.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** profile_pic.php 2 May 2006 23:28:36 -0000 1.6 --- profile_pic.php 18 Jun 2006 10:47:14 -0000 1.7 *************** *** 25,28 **** --- 25,29 ---- // mx_init_userprefs($userdata); $mx_user->init($user_ip, PAGE_INDEX); + // // End session management |
|
From: Jon O. <jon...@us...> - 2006-06-18 10:47:17
|
Update of /cvsroot/mxbb/mx_profilecp/profilcp In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv26950/modules/mx_profilecp/profilcp Modified Files: profilcp_privmsg_popup.php uacp.php Log Message: update Index: uacp.php =================================================================== RCS file: /cvsroot/mxbb/mx_profilecp/profilcp/uacp.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** uacp.php 2 May 2006 23:28:36 -0000 1.6 --- uacp.php 18 Jun 2006 10:47:14 -0000 1.7 *************** *** 51,55 **** // mx_init_userprefs($userdata); - //-- fin mod : profile cp -------------------------------------------------------------------------- --- 51,54 ---- Index: profilcp_privmsg_popup.php =================================================================== RCS file: /cvsroot/mxbb/mx_profilecp/profilcp/profilcp_privmsg_popup.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** profilcp_privmsg_popup.php 5 Apr 2006 23:04:42 -0000 1.5 --- profilcp_privmsg_popup.php 18 Jun 2006 10:47:14 -0000 1.6 *************** *** 36,43 **** $page_title = $lang['Private_Messaging']; include($phpbb_root_path . 'includes/page_header.'.$phpEx); ! ! $template->set_filenames(array( ! 'body' => 'privmsgs_popup.tpl') ! ); if ( $userdata['session_logged_in'] ) --- 36,41 ---- $page_title = $lang['Private_Messaging']; include($phpbb_root_path . 'includes/page_header.'.$phpEx); ! ! $template->set_filenames(array( 'body' => 'privmsgs_popup.tpl') ); if ( $userdata['session_logged_in'] ) *************** *** 59,63 **** $template->assign_vars(array( ! 'L_CLOSE_WINDOW' => $lang['Close_window'], 'L_MESSAGE' => $l_new_message) ); --- 57,61 ---- $template->assign_vars(array( ! 'L_CLOSE_WINDOW' => $lang['Close_window'], 'L_MESSAGE' => $l_new_message) ); |
|
From: Jon O. <jon...@us...> - 2006-06-18 10:47:17
|
Update of /cvsroot/mxbb/mx_profilecp/profilcp/def In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv26950/modules/mx_profilecp/profilcp/def Modified Files: def_userfuncs_album.php Log Message: update Index: def_userfuncs_album.php =================================================================== RCS file: /cvsroot/mxbb/mx_profilecp/profilcp/def/def_userfuncs_album.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** def_userfuncs_album.php 5 Apr 2006 23:04:42 -0000 1.4 --- def_userfuncs_album.php 18 Jun 2006 10:47:13 -0000 1.5 *************** *** 18,39 **** ! //----------------------------------- ! // ! // user_gallery output function ! // ! //----------------------------------- ! function pcp_output_gallery($field_name, $view_userdata, $map_name='') ! { ! global $board_config, $phpbb_root_path, $mx_root_path, $phpEx, $lang, $images, $userdata; ! global $values_list, $tables_linked, $classes_fields, $user_maps, $user_fields; global $db, $album_config, $mx_table_prefix; ! include_once($mx_root_path . 'modules/mx_smartor/album_mod/album_functions.'.$phpEx); ! include_once($mx_root_path . 'modules/mx_smartor/album_mod/album_constants.'.$phpEx); ! $txt = ''; ! $img = ''; ! $res = ''; ! if ( $view_userdata['user_id'] != ANONYMOUS ) { //fill Album_config --- 18,39 ---- ! //----------------------------------- ! // ! // user_gallery output function ! // ! //----------------------------------- ! function pcp_output_gallery($field_name, $view_userdata, $map_name='') ! { ! global $board_config, $phpbb_root_path, $mx_root_path, $phpEx, $lang, $images, $userdata; ! global $values_list, $tables_linked, $classes_fields, $user_maps, $user_fields; global $db, $album_config, $mx_table_prefix; ! include_once($mx_root_path . 'modules/mx_smartor/album_mod/album_functions.'.$phpEx); ! include_once($mx_root_path . 'modules/mx_smartor/album_mod/album_constants.'.$phpEx); ! $txt = ''; ! $img = ''; ! $res = ''; ! if ( $view_userdata['user_id'] != ANONYMOUS ) { //fill Album_config *************** *** 50,56 **** $album_config[$album_config_name] = $album_config_value; } ! // end fill album_config ! // check if the user is allowed to see personal gallerys $personal_gallery_access = personal_gallery_access(1,0); --- 50,56 ---- $album_config[$album_config_name] = $album_config_value; } ! // end fill album_config ! // check if the user is allowed to see personal gallerys $personal_gallery_access = personal_gallery_access(1,0); *************** *** 63,67 **** } else ! { $sql = 'SELECT p.* FROM '. ALBUM_TABLE .' AS p, ' . ALBUM_CAT_TABLE .' AS c --- 63,67 ---- } else ! { $sql = 'SELECT p.* FROM '. ALBUM_TABLE .' AS p, ' . ALBUM_CAT_TABLE .' AS c *************** *** 69,90 **** AND c.cat_id = p.pic_cat_id AND c.cat_user_id = p.pic_user_id'; ! /* ! $sql = "SELECT * FROM " . ALBUM_TABLE . " WHERE pic_user_id =" . $view_userdata['user_id'] . " AND pic_cat_id = ". PERSONAL_GALLERY ; */ if ( !$result = $db->sql_query($sql) ) ! { ! mx_message_die(GENERAL_ERROR, 'Could not read album table', '', __LINE__, __FILE__, $sql); ! } $number_gals = 0; $number_gals = ($db->sql_numrows($result)); $is_gallery = ( $row = $db->sql_fetchrow($result) ); ! if ( $is_gallery ) ! { ! ! // GET SMARTOR PAGE ID $sql = "SELECT * FROM " . FUNCTION_TABLE . " WHERE function_file = 'album.php' LIMIT 1"; if(!$result = $db->sql_query($sql)) --- 69,90 ---- AND c.cat_id = p.pic_cat_id AND c.cat_user_id = p.pic_user_id'; ! /* ! $sql = "SELECT * FROM " . ALBUM_TABLE . " WHERE pic_user_id =" . $view_userdata['user_id'] . " AND pic_cat_id = ". PERSONAL_GALLERY ; */ if ( !$result = $db->sql_query($sql) ) ! { ! mx_message_die(GENERAL_ERROR, 'Could not read album table', '', __LINE__, __FILE__, $sql); ! } $number_gals = 0; $number_gals = ($db->sql_numrows($result)); $is_gallery = ( $row = $db->sql_fetchrow($result) ); ! if ( $is_gallery ) ! { ! ! // GET SMARTOR PAGE ID $sql = "SELECT * FROM " . FUNCTION_TABLE . " WHERE function_file = 'album.php' LIMIT 1"; if(!$result = $db->sql_query($sql)) *************** *** 94,98 **** $row = $db->sql_fetchrow($result); $function_id = $row['function_id']; ! // ------------ $sql = "SELECT * FROM " . BLOCK_TABLE . " WHERE function_id = '$function_id' LIMIT 1"; --- 94,98 ---- $row = $db->sql_fetchrow($result); $function_id = $row['function_id']; ! // ------------ $sql = "SELECT * FROM " . BLOCK_TABLE . " WHERE function_id = '$function_id' LIMIT 1"; *************** *** 124,170 **** break; } ! } ! } */ ! ! $temp_url = append_sid($mx_root_path ."index.$phpEx?page=".$smartor_page_id."&user_id=" . $view_userdata['user_id']); ! $txt = '<a href="' . $temp_url . '" title="' . $number_gals . $lang['gal_pic_in'] . $lang['gallery'] . '">' . $number_gals . $lang['gal_pic'] . '</a>'; ! $img = '<a href="' . $temp_url . '"><img src="' . $images['profilecp_icon_gallery'] . '" alt="' . $number_gals . $lang['gal_pic'] . '" title="' . $number_gals . $lang['gal_pic_in']. $lang['gallery'] . '" border="0" /></a>'; $res = pcp_output_format($field_name, $txt, $img, $map_name); } } ! } ! return $res; } ! // end user_gallery output function ! //----------------------------------- ! // ! // user_no_of_pics output function ! // ! //----------------------------------- ! function pcp_output_nom_pic($field_name, $view_userdata, $map_name='') ! { ! global $board_config, $phpbb_root_path, $mx_root_path, $phpEx, $lang, $images, $userdata; ! global $values_list, $tables_linked, $classes_fields, $user_maps, $user_fields; global $db, $album_config, $mx_table_prefix; include_once($mx_root_path . 'modules/mx_smartor/album_mod/album_functions.'.$phpEx); include_once($mx_root_path . 'modules/mx_smartor/album_mod/album_constants.'.$phpEx); - - // init_userprefs($userdata); - // include_once($phpbb_root_path . 'album_mod/album_common.'.$phpEx); - $txt = ''; - $img = ''; - $res = ''; ! $user_id = $view_userdata['user_id']; ! //fill Album_config ! if ( $view_userdata['user_id'] != ANONYMOUS ) ! { $sql = "SELECT * FROM ". ALBUM_CONFIG_TABLE; --- 124,170 ---- break; } ! } ! } */ ! ! $temp_url = append_sid($mx_root_path ."index.$phpEx?page=".$smartor_page_id."&user_id=" . $view_userdata['user_id']); ! $txt = '<a href="' . $temp_url . '" title="' . $number_gals . $lang['gal_pic_in'] . $lang['gallery'] . '">' . $number_gals . $lang['gal_pic'] . '</a>'; ! $img = '<a href="' . $temp_url . '"><img src="' . $images['profilecp_icon_gallery'] . '" alt="' . $number_gals . $lang['gal_pic'] . '" title="' . $number_gals . $lang['gal_pic_in']. $lang['gallery'] . '" border="0" /></a>'; $res = pcp_output_format($field_name, $txt, $img, $map_name); } } ! } ! return $res; } ! // end user_gallery output function ! //----------------------------------- ! // ! // user_no_of_pics output function ! // ! //----------------------------------- ! function pcp_output_nom_pic($field_name, $view_userdata, $map_name='') ! { ! global $board_config, $phpbb_root_path, $mx_root_path, $phpEx, $lang, $images, $userdata; ! global $values_list, $tables_linked, $classes_fields, $user_maps, $user_fields; global $db, $album_config, $mx_table_prefix; include_once($mx_root_path . 'modules/mx_smartor/album_mod/album_functions.'.$phpEx); include_once($mx_root_path . 'modules/mx_smartor/album_mod/album_constants.'.$phpEx); ! // init_userprefs($userdata); ! // include_once($phpbb_root_path . 'album_mod/album_common.'.$phpEx); ! $txt = ''; ! $img = ''; ! $res = ''; ! ! $user_id = $view_userdata['user_id']; ! //fill Album_config ! if ( $view_userdata['user_id'] != ANONYMOUS ) ! { $sql = "SELECT * FROM ". ALBUM_CONFIG_TABLE; *************** *** 179,188 **** $album_config[$album_config_name] = $album_config_value; } ! // end fill album_config // Check the catagorys if there are any pics the user is allowed to see $sql = "SELECT c.*, COUNT(p.pic_id) AS count FROM ". ALBUM_CAT_TABLE ." AS c LEFT JOIN ". ALBUM_TABLE ." AS p ON c.cat_id = p.pic_cat_id ! WHERE c.cat_user_id = $user_id AND c.cat_id = p.pic_cat_id GROUP BY c.cat_id --- 179,188 ---- $album_config[$album_config_name] = $album_config_value; } ! // end fill album_config // Check the catagorys if there are any pics the user is allowed to see $sql = "SELECT c.*, COUNT(p.pic_id) AS count FROM ". ALBUM_CAT_TABLE ." AS c LEFT JOIN ". ALBUM_TABLE ." AS p ON c.cat_id = p.pic_cat_id ! WHERE c.cat_user_id = $user_id AND c.cat_id = p.pic_cat_id GROUP BY c.cat_id *************** *** 199,203 **** while( $row = $db->sql_fetchrow($result) ) ! { $album_user_access = album_user_access($row['cat_id'], $row, 1, 0, 0, 0, 0, 0); // VIEW if ($album_user_access['view'] == 1) --- 199,203 ---- while( $row = $db->sql_fetchrow($result) ) ! { $album_user_access = album_user_access($row['cat_id'], $row, 1, 0, 0, 0, 0, 0); // VIEW if ($album_user_access['view'] == 1) *************** *** 208,214 **** $total_pics = $total_pics + $thiscat[$i]['count']; } ! } ! ! if (empty($thiscat)) { $nocat_pic = TRUE; // If the user has not uploaded any pictures in catagories --- 208,214 ---- $total_pics = $total_pics + $thiscat[$i]['count']; } ! } ! ! if (empty($thiscat)) { $nocat_pic = TRUE; // If the user has not uploaded any pictures in catagories *************** *** 231,235 **** FROM '. ALBUM_TABLE .' AS p, ' . ALBUM_CAT_TABLE .' AS c WHERE c.cat_user_id = '.$view_userdata['user_id'].' ! AND c.cat_id = p.pic_cat_id'; /* $sql = "SELECT COUNT(pic_id) AS count --- 231,235 ---- FROM '. ALBUM_TABLE .' AS p, ' . ALBUM_CAT_TABLE .' AS c WHERE c.cat_user_id = '.$view_userdata['user_id'].' ! AND c.cat_id = p.pic_cat_id'; /* $sql = "SELECT COUNT(pic_id) AS count *************** *** 248,269 **** $total_pics = $total_pics + $row['count']; } ! ! if ( $total_pics > 0 ) ! { $temp_url = append_sid("./album_by.$phpEx?user_id=" . $view_userdata['user_id']); ! $txt = '<a href="' . $temp_url . '" title="' . $total_pics . $lang['pics_up'] . '">' . $total_pics . '</a>'; ! //$img = '<a href="' . $temp_url . '"><img src="' . $images['profilecp_icon_gallery'] . '" alt="' . $number_gals . $lang['gal_pic'] . '" title="' . $number_gals . $lang['gal_pic_in']. $lang['gallery'] . '" border="0" /></a>'; $res = pcp_output_format($field_name, $txt, $img, $map_name); } else { ! $txt = $total_pics; ! //$img = '<a href="' . $temp_url . '"><img src="' . $images['profilecp_icon_gallery'] . '" alt="' . $number_gals . $lang['gal_pic'] . '" title="' . $number_gals . $lang['gal_pic_in']. $lang['gallery'] . '" border="0" /></a>'; $res = pcp_output_format($field_name, $txt, $img, $map_name); ! } ! } ! return $res; } --- 248,269 ---- $total_pics = $total_pics + $row['count']; } ! ! if ( $total_pics > 0 ) ! { $temp_url = append_sid("./album_by.$phpEx?user_id=" . $view_userdata['user_id']); ! $txt = '<a href="' . $temp_url . '" title="' . $total_pics . $lang['pics_up'] . '">' . $total_pics . '</a>'; ! //$img = '<a href="' . $temp_url . '"><img src="' . $images['profilecp_icon_gallery'] . '" alt="' . $number_gals . $lang['gal_pic'] . '" title="' . $number_gals . $lang['gal_pic_in']. $lang['gallery'] . '" border="0" /></a>'; $res = pcp_output_format($field_name, $txt, $img, $map_name); } else { ! $txt = $total_pics; ! //$img = '<a href="' . $temp_url . '"><img src="' . $images['profilecp_icon_gallery'] . '" alt="' . $number_gals . $lang['gal_pic'] . '" title="' . $number_gals . $lang['gal_pic_in']. $lang['gallery'] . '" border="0" /></a>'; $res = pcp_output_format($field_name, $txt, $img, $map_name); ! } ! } ! return $res; } |
|
From: Jon O. <jon...@us...> - 2006-06-18 10:46:10
|
Update of /cvsroot/mxbb/core In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv26131 Modified Files: common.php Log Message: update for phpBB 2.0.21 Index: common.php =================================================================== RCS file: /cvsroot/mxbb/core/common.php,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** common.php 17 Jun 2006 20:09:06 -0000 1.54 --- common.php 18 Jun 2006 10:46:01 -0000 1.55 *************** *** 91,98 **** while (list($var,) = @each($input)) { ! if (!in_array($var, $not_unset)) { ! unset($$var); } } --- 91,99 ---- while (list($var,) = @each($input)) { ! if (in_array($var, $not_unset)) { ! die('Hacking attempt!'); } + unset($$var); } |
|
From: Jon O. <jon...@us...> - 2006-06-18 10:46:07
|
Update of /cvsroot/mxbb/core/includes In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv26131/includes Modified Files: mx_functions_style.php Log Message: update for phpBB 2.0.21 Index: mx_functions_style.php =================================================================== RCS file: /cvsroot/mxbb/core/includes/mx_functions_style.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** mx_functions_style.php 17 Jun 2006 20:09:07 -0000 1.5 --- mx_functions_style.php 18 Jun 2006 10:46:03 -0000 1.6 *************** *** 256,260 **** { global $userdata, $board_config, $theme, $images; ! global $template, $lang, $phpEx, $phpbb_root_path, $mx_root_path; global $nav_links; --- 256,260 ---- { global $userdata, $board_config, $theme, $images; ! global $template, $lang, $phpEx, $phpbb_root_path, $mx_root_path, $db; global $nav_links; *************** *** 263,267 **** if ( !empty($userdata['user_lang'])) { ! $board_config['default_lang'] = $userdata['user_lang']; } --- 263,268 ---- if ( !empty($userdata['user_lang'])) { ! //$board_config['default_lang'] = $userdata['user_lang']; // See simpler lang select code below ! $default_lang = phpbb_ltrim(basename(phpbb_rtrim($userdata['user_lang'])), "'"); } *************** *** 276,280 **** --- 277,353 ---- } } + // + // New code (phpBB 2.0.21) from here on, to comment below + // + else + { + $default_lang = phpbb_ltrim(basename(phpbb_rtrim($board_config['default_lang'])), "'"); + } + + if ( !file_exists(@phpbb_realpath($mx_root_path . 'language/lang_' . $default_lang . '/lang_main.'.$phpEx)) ) + { + if ( $userdata['user_id'] != ANONYMOUS ) + { + // For logged in users, try the board default language next + $default_lang = phpbb_ltrim(basename(phpbb_rtrim($board_config['default_lang'])), "'"); + } + else + { + // For guests it means the default language is not present, try english + // This is a long shot since it means serious errors in the setup to reach here, + // but english is part of a new install so it's worth us trying + $default_lang = 'english'; + } + + if ( !file_exists(@phpbb_realpath($mx_root_path . 'language/lang_' . $default_lang . '/lang_main.'.$phpEx)) ) + { + message_die(CRITICAL_ERROR, 'Could not locate valid language pack'); + } + } + + // If we've had to change the value in any way then let's write it back to the database + // before we go any further since it means there is something wrong with it + if ( $userdata['user_id'] != ANONYMOUS && $userdata['user_lang'] !== $default_lang ) + { + $sql = 'UPDATE ' . USERS_TABLE . " + SET user_lang = '" . $default_lang . "' + WHERE user_lang = '" . $userdata['user_lang'] . "'"; + + if ( !($result = $db->sql_query($sql)) ) + { + message_die(CRITICAL_ERROR, 'Could not update user language info'); + } + $userdata['user_lang'] = $default_lang; + } + elseif ( $userdata['user_id'] === ANONYMOUS && $board_config['default_lang'] !== $default_lang ) + { + $sql = 'UPDATE ' . CONFIG_TABLE . " + SET config_value = '" . $default_lang . "' + WHERE config_name = 'default_lang'"; + + if ( !($result = $db->sql_query($sql)) ) + { + message_die(CRITICAL_ERROR, 'Could not update user language info'); + } + } + + $board_config['default_lang'] = $default_lang; + + include($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_main.' . $phpEx); // Also include phpBB lang keys + include($mx_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_main.' . $phpEx); + + if ( defined('IN_ADMIN') ) + { + if( !file_exists(@phpbb_realpath($mx_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_admin.'.$phpEx)) ) + { + $board_config['default_lang'] = 'english'; + } + + include($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_admin.' . $phpEx); // Also include phpBB lang keys + include($mx_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_admin.' . $phpEx); + } + + /* Note: This is a simpler "working" version. phpBB 2.0.21 introduced above code instead. // // Is the lang installed? *************** *** 304,307 **** --- 377,381 ---- include($mx_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_admin.' . $phpEx); } + */ // *************** *** 375,382 **** // // Get theme data. To cache? // ! $sql = "SELECT * ! FROM " . THEMES_TABLE . " ! WHERE themes_id = $style"; // --- 449,457 ---- // // Get theme data. To cache? + // Note: This part is different from original phpBB style setup // ! $sql = 'SELECT * ! FROM ' . THEMES_TABLE . ' ! WHERE themes_id = ' . (int) $style; // *************** *** 387,393 **** $style = $board_config['default_style']; ! $sql = "SELECT * ! FROM " . THEMES_TABLE . " ! WHERE themes_id = $style"; if ( !($result = $db->sql_query($sql, 120)) ) --- 462,468 ---- $style = $board_config['default_style']; ! $sql = 'SELECT * ! FROM ' . THEMES_TABLE . ' ! WHERE themes_id = ' . (int) $style; if ( !($result = $db->sql_query($sql, 120)) ) |
|
From: Jon O. <jon...@us...> - 2006-06-18 10:46:07
|
Update of /cvsroot/mxbb/core/modules/mx_coreblocks In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv26131/modules/mx_coreblocks Modified Files: mx_search.php Log Message: update for phpBB 2.0.21 Index: mx_search.php =================================================================== RCS file: /cvsroot/mxbb/core/modules/mx_coreblocks/mx_search.php,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** mx_search.php 2 May 2006 23:22:17 -0000 1.14 --- mx_search.php 18 Jun 2006 10:46:03 -0000 1.15 *************** *** 107,111 **** for( $i = 0; $i < count( $split_search ); $i++ ) { ! if (preg_match('#^[\*%]+$#', trim($split_search[$i])) || preg_match('#^[^\*]{1,2}$#', str_replace(array('*', '%'), '', trim($split_search[$i])))) { $split_search[$i] = ''; --- 107,112 ---- for( $i = 0; $i < count( $split_search ); $i++ ) { ! //if (preg_match('#^[\*%]+$#', trim($split_search[$i])) || preg_match('#^[^\*]{1,2}$#', str_replace(array('*', '%'), '', trim($split_search[$i])))) // < phpBB 2.0.21 ! if ( strlen(str_replace(array('*', '%'), '', trim($split_search[$i]))) < $board_config['search_min_chars'] ) { $split_search[$i] = ''; |
|
From: Jon O. <jon...@us...> - 2006-06-17 22:17:59
|
Update of /cvsroot/mxbb/mx_who_am_i/templates/subSilver In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv20546/modules/mx_who_am_i/templates/subSilver Added Files: index.htm Log Message: Security --- NEW FILE: index.htm --- <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body bgcolor="#FFFFFF" text="#000000"> </body> </html> |
|
From: Jon O. <jon...@us...> - 2006-06-17 22:17:56
|
Update of /cvsroot/mxbb/mx_who_am_i/templates In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv20546/modules/mx_who_am_i/templates Added Files: index.htm Log Message: Security --- NEW FILE: index.htm --- <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body bgcolor="#FFFFFF" text="#000000"> </body> </html> |
|
From: Jon O. <jon...@us...> - 2006-06-17 22:17:56
|
Update of /cvsroot/mxbb/mx_who_am_i/templates/subSilver/images In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv20546/modules/mx_who_am_i/templates/subSilver/images Added Files: index.htm Log Message: Security --- NEW FILE: index.htm --- <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body bgcolor="#FFFFFF" text="#000000"> </body> </html> |
|
From: Jon O. <jon...@us...> - 2006-06-17 22:17:56
|
Update of /cvsroot/mxbb/mx_who_am_i/language/lang_english In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv20546/modules/mx_who_am_i/language/lang_english Added Files: index.htm Log Message: Security --- NEW FILE: index.htm --- <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body bgcolor="#FFFFFF" text="#000000"> </body> </html> |
|
From: Jon O. <jon...@us...> - 2006-06-17 22:17:56
|
Update of /cvsroot/mxbb/mx_who_am_i/language In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv20546/modules/mx_who_am_i/language Added Files: index.htm Log Message: Security --- NEW FILE: index.htm --- <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body bgcolor="#FFFFFF" text="#000000"> </body> </html> |
|
From: Jon O. <jon...@us...> - 2006-06-17 22:17:56
|
Update of /cvsroot/mxbb/mx_who_am_i In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv20546/modules/mx_who_am_i Added Files: index.htm Log Message: Security --- NEW FILE: index.htm --- <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body bgcolor="#FFFFFF" text="#000000"> </body> </html> |
|
From: Jon O. <jon...@us...> - 2006-06-17 22:17:56
|
Update of /cvsroot/mxbb/mx_who_am_i/includes In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv20546/modules/mx_who_am_i/includes Added Files: .htaccess index.htm Log Message: Security --- NEW FILE: .htaccess --- deny from all --- NEW FILE: index.htm --- <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body bgcolor="#FFFFFF" text="#000000"> </body> </html> |
|
From: Jon O. <jon...@us...> - 2006-06-17 22:17:38
|
Update of /cvsroot/mxbb/mx_smartor/templates/subSilver/images In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv20430/modules/mx_smartor/templates/subSilver/images Added Files: index.htm Log Message: Security --- NEW FILE: index.htm --- <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body bgcolor="#FFFFFF" text="#000000"> </body> </html> |