|
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'] ) |