|
From: Jon O. <jon...@us...> - 2005-04-12 17:38:49
|
Update of /cvsroot/mxbb/core/modules/mx_textblocks/admin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5654/modules/mx_textblocks/admin Modified Files: mx_textblock_edit.php Log Message: Index: mx_textblock_edit.php =================================================================== RCS file: /cvsroot/mxbb/core/modules/mx_textblocks/admin/mx_textblock_edit.php,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** mx_textblock_edit.php 21 Mar 2005 21:52:40 -0000 1.15 --- mx_textblock_edit.php 12 Apr 2005 17:38:37 -0000 1.16 *************** *** 59,63 **** // Blog mode: - // $blog_validate = ( $blog_mode == 'group' ) ? mx_auth_group( $sub_id, $userdata['user_id'], true ) : $sub_id == $userdata['user_id']; $blog_validate = ( $blog_mode == 'group' ) ? mx_auth_group_cache( $sub_id, true ) : $sub_id == $userdata['user_id']; --- 59,62 ---- *************** *** 101,151 **** $error = false; - /* - // Toggles - - if ( !$board_config['allow_html'] ) - { - $html_on = 0; - } - else - { - // $html_on = ( $submit || $refresh ) ? ( ( !empty($HTTP_POST_VARS['disable_html']) ) ? 0 : TRUE ) : $userdata['user_allowhtml']; - $html_on = true; - } - - if ( !$board_config['allow_bbcode'] ) - { - $bbcode_on = 0; - } - else - { - // $bbcode_on = ( $submit || $refresh ) ? ( ( !empty($HTTP_POST_VARS['disable_bbcode']) ) ? 0 : TRUE ) : $userdata['user_allowbbcode']; - $bbcode_on = true; - } - */ - - if ( !$board_config['allow_smilies'] ) - { - $smilies_on = 0; - } - else - { - $smilies_on = ( $submit || $refresh ) ? ( ( !empty( $HTTP_POST_VARS['disable_smilies'] ) ) ? 0 : true ) : $userdata['user_allowsmile']; - } - - $attach_sig = ( $submit || $refresh ) ? ( ( !empty( $HTTP_POST_VARS['attach_sig'] ) ) ? true : 0 ) : $userdata['user_attachsig']; - $user_sig = ( $userdata['user_sig'] != '' && $board_config['allow_sig'] ) ? $userdata['user_sig'] : ""; - // Define all config data // Main parameters ! $block_title_par = "block_title"; ! $block_desc_par = "block_desc"; ! $show_block_par = "show_block"; ! $show_title_par = "show_title"; ! $show_stats_par = "show_stats"; ! ! if ( isset( $block_config[$block_id]['Html'] ) ) // Html Textblock { $block_text_par = "Html"; --- 100,108 ---- $error = false; // Define all config data // Main parameters ! if ( isset( $block_config[$block_id]['Html']['parameter_value'] ) ) // Html Textblock { $block_text_par = "Html"; *************** *** 153,179 **** $bbcode_on = false; $html_on = true; $html_entities_match = array( ); $html_entities_replace = array( ); } ! else if ( isset( $block_config[$block_id]['Text'] ) ) // Multi or BBcode Textblock { ! $block_text_par = "Text"; ! $mode = "edit"; ! $bbcode_on = true; ! $html_on = true; ! $html_entities_match = array( '#&#', '#<#', '#>#' ); ! $html_entities_replace = array( '&', '<', '>' ); ! } ! else if ( isset( $block_config[$block_id]['Blog'] ) ) // Blog Textblock ! { ! $block_text_par = "Blog"; ! $mode = "editblog"; ! $bbcode_on = true; ! $html_on = true; ! ! $html_entities_match = array( '#&#', '#<#', '#>#' ); ! $html_entities_replace = array( '&', '<', '>' ); } else --- 110,144 ---- $bbcode_on = false; $html_on = true; + $smilies_on = false; $html_entities_match = array( ); $html_entities_replace = array( ); + + // This switch is for enabling the wysiwyg html editor addon "tiny mce". to disable this feature either remove this section or delete the modules/tinymce folder + if ( file_exists( $mx_root_path . 'modules/tinymce/jscripts/tiny_mce/blank.htm' ) ) + { + $template->assign_block_vars( "tinyMCE", array() ); + } + } ! else if ( isset( $block_config[$block_id]['Text']['parameter_value'] ) || isset( $block_config[$block_id]['Blog']['parameter_value'] ) ) // Multi, phpBB, Blog Textblock { ! $block_text_par = isset( $block_config[$block_id]['Blog']['parameter_value'] ) ? "Blog" : "Text"; ! $mode = isset( $block_config[$block_id]['Blog']['parameter_value'] ) ? "editblog" : "edit"; ! if ( isset( $block_config[$block_id]['allow_html'] ) ) ! { ! $bbcode_on = $block_config[$block_id]['allow_bbcode']['parameter_value'] == 'TRUE' ? true : false; ! $html_on = $block_config[$block_id]['allow_html']['parameter_value'] == 'TRUE' ? true : false; ! $smilies_on = $block_config[$block_id]['allow_smilies']['parameter_value'] == 'TRUE' ? true : false; ! ! $board_config['allow_html_tags'] = $block_config[$block_id]['html_tags']['parameter_value']; ! } ! else ! { ! $bbcode_on = $board_config['allow_bbcode'] ? true : false; ! $html_on = $board_config['allow_html'] ? true : false; ! $smilies_on = $board_config['allow_smilies'] ? true : false; ! } } else *************** *** 183,190 **** --- 148,168 ---- } + // Main parameters + $block_title_par = "block_title"; + $block_desc_par = "block_desc"; + $show_block_par = "show_block"; + $show_title_par = "show_title"; + $show_stats_par = "show_stats"; + // Style parameters $block_style_par = "block_style"; $text_style_par = "text_style"; $title_style_par = "title_style"; + + $allow_smilies_par = "allow_smilies"; + $allow_html_par = "allow_html"; + $allow_bbcode_par = "allow_bbcode"; + $html_tags_par = "html_tags"; + $blog_id_par = "blog_id"; *************** *** 193,197 **** $new_vars = array(); ! $new_vars = array( $block_text_par, $block_style_par, $text_style_par, $title_style_par, $blog_id_par ); $new = array(); --- 171,175 ---- $new_vars = array(); ! $new_vars = array( $block_text_par, $block_style_par, $text_style_par, $title_style_par, $allow_smilies_par, $allow_html_par, $allow_bbcode_par, $html_tags_par, $blog_id_par ); $new = array(); *************** *** 217,221 **** $bbcode_uid = make_bbcode_uid(); } - //Format the input: $new[$new_vars[$j]] = prepare_message( trim($new[$new_vars[$j]]), $html_on, $bbcode_on, $smilies_on, $bbcode_uid ); --- 195,198 ---- *************** *** 224,227 **** --- 201,205 ---- if ( $block_config[$block_id][$new_vars[$j]]['sub_id'] == $sub_id ) { + // Note: is str_replace really needed here ?? $sql = "UPDATE " . BLOCK_SYSTEM_PARAMETER_TABLE . " SET parameter_value = '" . str_replace( "\'", "''", $new[$new_vars[$j]] ) . "', *************** *** 276,280 **** show_title = '" . intval( $show_title ) . "', show_stats = '" . intval( $show_stats ) . "' ! WHERE block_id = $block_id"; if ( !( $result = $db->sql_query( $sql, BEGIN_TRANSACTION ) ) ) --- 254,258 ---- show_title = '" . intval( $show_title ) . "', show_stats = '" . intval( $show_stats ) . "' ! WHERE block_id = $block_id"; if ( !( $result = $db->sql_query( $sql, BEGIN_TRANSACTION ) ) ) *************** *** 305,330 **** } - $block_text = $new[$block_text_par]; - $bbcode_uid = $block_config[$block_id][$block_text_par]['bbcode_uid']; ! $blog_id = trim( stripslashes( $new[$blog_id_par] )); ! $block_text = htmlspecialchars( trim( stripslashes( $block_text ) ) ) ; ! $block_title = htmlspecialchars( trim( stripslashes( $block_title ) ) ) ; - if ( $mode != 'edithtml' ) - { - $block_text = preg_replace( "/\:(([a-z0-9]:)?)$bbcode_uid/si", '', $block_text ); - $block_text = str_replace( '<br />', "\n", $block_text ); - $block_text = preg_replace( '#</textarea>#si', '</textarea>', $block_text ); - $block_text = trim( stripslashes( $block_text ) ); - } - else - { - $block_title = trim( strip_tags( stripslashes( $block_title ) ) ); - $block_text = str_replace( '<br />', "\n", $block_text ); - $block_text = preg_replace( '#</textarea>#si', '</textarea>', $block_text ); - $block_text = trim( stripslashes( $block_text ) ); - } // Style parameters $block_style_yes = ( $new[$block_style_par] == 'TRUE' ) ? "checked=\"checked\"" : ""; --- 283,296 ---- } ! // Main ------------------------------------- ! // First (re)declare basic variables ! $block_title = ( isset( $HTTP_POST_VARS[$block_title_par] ) ) ? htmlspecialchars( trim( stripslashes( $HTTP_POST_VARS[$block_title_par] ) ) ) : $block_config[$block_id][$block_title_par]; ! $block_desc = ( isset( $HTTP_POST_VARS[$block_desc_par] ) ) ? htmlspecialchars( trim( stripslashes( $HTTP_POST_VARS[$block_desc_par] ) ) ): $block_config[$block_id][$block_desc_par]; ! $block_text = ( isset( $HTTP_POST_VARS[$block_text_par] ) ) ? htmlspecialchars( trim( stripslashes( $HTTP_POST_VARS[$block_text_par] ) ) ) : $block_config[$block_id][$block_text_par]['parameter_value']; ! ! $blog_id = trim( stripslashes( $new[$blog_id_par] )); // Style parameters $block_style_yes = ( $new[$block_style_par] == 'TRUE' ) ? "checked=\"checked\"" : ""; *************** *** 352,361 **** $title_style_no = ( !( $new[$title_style_par] == 'TRUE' ) ) ? "checked=\"checked\"" : ""; // Main parameters ! $block_title = ( isset( $HTTP_POST_VARS[$block_title_par] ) ) ? stripslashes( htmlspecialchars( $HTTP_POST_VARS[$block_title_par] ) ) : $block_config[$block_id][$block_title_par]; ! $block_desc = ( isset( $HTTP_POST_VARS[$block_desc_par] ) ) ? stripslashes( htmlspecialchars( $HTTP_POST_VARS[$block_desc_par] ) ) : $block_config[$block_id][$block_desc_par]; ! $show_block = ( isset( $HTTP_POST_VARS[$show_block_par] ) ) ? intval( $HTTP_POST_VARS[$show_block_par] ) : $block_config[$block_id][$show_block_par]; ! $show_title = ( isset( $HTTP_POST_VARS[$show_title_par] ) ) ? intval( $HTTP_POST_VARS[$show_title_par] ) : $block_config[$block_id][$show_title_par]; ! $show_stats = ( isset( $HTTP_POST_VARS[$show_stats_par] ) ) ? intval( $HTTP_POST_VARS[$show_stats_par] ) : $block_config[$block_id][$show_stats_par]; $show_title_yes = ( $show_title == 1 ) ? "checked=\"checked\"" : ""; --- 318,336 ---- $title_style_no = ( !( $new[$title_style_par] == 'TRUE' ) ) ? "checked=\"checked\"" : ""; + $allow_smilies_yes = ( $new[$allow_smilies_par] == 'TRUE' ) ? "checked=\"checked\"" : ""; + $allow_smilies_no = ( !( $new[$allow_smilies_par] == 'TRUE' ) ) ? "checked=\"checked\"" : ""; + + $allow_html_yes = ( $new[$allow_html_par] == 'TRUE' ) ? "checked=\"checked\"" : ""; + $allow_html_no = ( !( $new[$allow_html_par] == 'TRUE' ) ) ? "checked=\"checked\"" : ""; + + $allow_bbcode_yes = ( $new[$allow_bbcode_par] == 'TRUE' ) ? "checked=\"checked\"" : ""; + $allow_bbcode_no = ( !( $new[$allow_bbcode_par] == 'TRUE' ) ) ? "checked=\"checked\"" : ""; + + $textblock_allowed_html_tags = $new[$html_tags_par]; + // Main parameters ! $show_block = ( isset( $HTTP_POST_VARS[$show_block_par] ) ) ? intval( $HTTP_POST_VARS[$show_block_par] ) : $block_config[$block_id][$show_block_par]['parameter_value']; ! $show_title = ( isset( $HTTP_POST_VARS[$show_title_par] ) ) ? intval( $HTTP_POST_VARS[$show_title_par] ) : $block_config[$block_id][$show_title_par]['parameter_value']; ! $show_stats = ( isset( $HTTP_POST_VARS[$show_stats_par] ) ) ? intval( $HTTP_POST_VARS[$show_stats_par] ) : $block_config[$block_id][$show_stats_par]['parameter_value']; $show_title_yes = ( $show_title == 1 ) ? "checked=\"checked\"" : ""; *************** *** 370,375 **** // Start output, first preview, then errors then post form ! $title = $block_config[$block_id]['block_title']; ! $page_title = $title; $template->assign_block_vars( "switch_view", array() ); --- 345,349 ---- // Start output, first preview, then errors then post form ! $page_title = $block_title; $template->assign_block_vars( "switch_view", array() ); *************** *** 384,387 **** --- 358,362 ---- include_once( $mx_root_path . 'admin/page_header_admin.' . $phpEx ); } + // -------------------------------------------------------- // Previews Layout *************** *** 389,396 **** if ( $preview && !$error ) { ! $preview_title = $block_title; $preview_text = $block_text; ! ! // $preview_text = preg_replace( '#<textarea>#si', '<textarea>', $preview_text ); $orig_word = array(); --- 364,370 ---- if ( $preview && !$error ) { ! $preview_title = $block_title; $preview_text = $block_text; ! $orig_word = array(); *************** *** 398,414 **** obtain_word_list( $orig_word, $replacement_word ); ! if ( $bbcode_on && $mode != 'edithtml' ) ! { ! $bbcode_uid = make_bbcode_uid(); ! } ! ! //$mxbb_tmp = $board_config['allow_html_tags']; //Should we have specfic allowed tags spec for mx textblocks? ! //$board_config['allow_html_tags'] = ''; $preview_text = stripslashes(prepare_message(addslashes(unprepare_message($preview_text)), $html_on, $bbcode_on, $smilies_on, $bbcode_uid)); - //$board_config['allow_html_tags'] = $mxbb_tmp; - - // Finalise processing as per viewtopic ! if ( $bbcode_on && $mode != 'edithtml' ) { $preview_text = bbencode_second_pass( $preview_text, $bbcode_uid ); --- 372,379 ---- 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)); ! if ( $bbcode_on ) { $preview_text = bbencode_second_pass( $preview_text, $bbcode_uid ); *************** *** 421,425 **** } ! if ( $smilies_on && $mode != 'edithtml' ) { $preview_text = mx_smilies_pass( $preview_text ); --- 386,390 ---- } ! if ( $smilies_on ) { $preview_text = mx_smilies_pass( $preview_text ); *************** *** 428,435 **** $preview_text = make_clickable( $preview_text ); ! if ( $mode != 'edithtml' ) ! { ! $preview_text = str_replace( "\n", '<br />', $preview_text ); ! } $s_hidden_fields .= '<input type="hidden" name="mode" value="' . $mode . '" />'; --- 393,397 ---- $preview_text = make_clickable( $preview_text ); ! $preview_text = str_replace( "\n", '<br />', $preview_text ); $s_hidden_fields .= '<input type="hidden" name="mode" value="' . $mode . '" />'; *************** *** 451,454 **** --- 413,448 ---- $template->assign_var_from_handle( 'POST_PREVIEW_BOX', 'preview' ); } + else + { + + $bbcode_uid = $block_config[$block_id][$block_text_par]['bbcode_uid']; + + if ( $bbcode_uid != '' ) + { + $block_text = preg_replace('/\:(([a-z0-9]:)?)' . $bbcode_uid . '/s', '', $block_text); + } + + $block_text = str_replace('<', '<', $block_text); + $block_text = str_replace('>', '>', $block_text); + $block_text = str_replace('<br />', "\n", $block_text); + + /* + if ( $mode != 'edithtml' ) + { + $block_text = preg_replace( "/\:(([a-z0-9]:)?)$bbcode_uid/si", '', $block_text ); + $block_text = str_replace( '<br />', "\n", $block_text ); + $block_text = preg_replace( '#</textarea>#si', '</textarea>', $block_text ); + $block_text = trim( stripslashes( $block_text ) ); + $block_text = unprepare_message($block_text); + } + else + { + $block_title = trim( strip_tags( stripslashes( $block_title ) ) ); + $block_text = str_replace( '<br />', "\n", $block_text ); + $block_text = preg_replace( '#</textarea>#si', '</textarea>', $block_text ); + $block_text = trim( stripslashes( $block_text ) ); + } + */ + } // -------------------------------------------------------- // Default Layout *************** *** 465,471 **** } // Send smilies to template ! if ( $mode != 'edithtml' ) { mx_generate_smilies( 'inline', PAGE_INDEX ); --- 459,498 ---- } + // HTML toggle selection + + if ( $html_on ) + { + $html_status = $lang['HTML_is_ON']; + } + else + { + $html_status = $lang['HTML_is_OFF']; + } + + // BBCode toggle selection + + if ( $bbcode_on ) + { + $bbcode_status = $lang['BBCode_is_ON']; + } + else + { + $bbcode_status = $lang['BBCode_is_OFF']; + } + + // Smilies toggle selection + + if ( $smilies_on ) + { + $smilies_status = $lang['Smilies_are_ON']; + } + else + { + $smilies_status = $lang['Smilies_are_OFF']; + } + // Send smilies to template ! if ( $smilies_on ) { mx_generate_smilies( 'inline', PAGE_INDEX ); *************** *** 489,493 **** } ! if ( $mode != 'edithtml' ) { $template->assign_block_vars( "switch_bbcodes", array() ); --- 516,520 ---- } ! if ( $bbcode_on ) { $template->assign_block_vars( "switch_bbcodes", array() ); *************** *** 499,514 **** } ! if ( !empty( $new[$text_style_par] ) ) { $template->assign_block_vars( "switch_text_style", array() ); - } - if ( !empty( $new[$block_style_par] ) ) - { $template->assign_block_vars( "switch_block_style", array() ); - } - if ( !empty( $new[$title_style_par] ) ) - { $template->assign_block_vars( "switch_title_style", array() ); } if ( !empty( $new[$blog_id_par] ) && $sub_id == 0 ) { --- 526,544 ---- } ! echo(var_export($block_edit_auth)); ! ! // For Multi block ! if ( !empty( $new[$text_style_par] ) && $block_edit_auth['auth_mod']) { $template->assign_block_vars( "switch_text_style", array() ); $template->assign_block_vars( "switch_block_style", array() ); $template->assign_block_vars( "switch_title_style", array() ); + $template->assign_block_vars( "switch_allow_smilies", array() ); + $template->assign_block_vars( "switch_allow_bbcode", array() ); + $template->assign_block_vars( "switch_allow_html", array() ); + $template->assign_block_vars( "switch_html_tags", array() ); } + + // For Blogs if ( !empty( $new[$blog_id_par] ) && $sub_id == 0 ) { *************** *** 519,525 **** 'L_TITLE' => $lang['Block_admin'], 'L_EXPLAIN' => $lang['Block_admin_explain'], ! 'BLOCK_TITLE' => $block_title, ! 'BLOCK_INFO' => $block_text, 'HTML_STATUS' => $html_status, 'SMILIES_STATUS' => $smilies_status, --- 549,556 ---- 'L_TITLE' => $lang['Block_admin'], 'L_EXPLAIN' => $lang['Block_admin_explain'], ! //'BLOCK_TITLE' => $block_title, ! 'HTML_STATUS' => $html_status, + 'BBCODE_STATUS' => $bbcode_status, 'SMILIES_STATUS' => $smilies_status, *************** *** 529,532 **** --- 560,568 ---- 'L_TEXT_STYLE' => $lang['Text_Style'], 'L_TITLE_STYLE' => $lang['Title_Style'], + + 'L_ALLOW_SMILIES' => $lang['Allow_smilies'], + 'L_ALLOW_HTML' => $lang['Allow_HTML'], + 'L_ALLOW_BBCODE' => $lang['Allow_BBCode'], + 'L_HTML_TAGS' => $lang['Allowed_tags'], 'L_YES' => $lang['Yes'], *************** *** 606,609 **** --- 642,656 ---- 'S_TITLE_STYLE_NO' => $title_style_no, + 'S_ALLOW_BBCODE_YES' => $allow_bbcode_yes, + 'S_ALLOW_BBCODE_NO' => $allow_bbcode_no, + + 'S_ALLOW_HTML_YES' => $allow_html_yes, + 'S_ALLOW_HTML_NO' => $allow_html_no, + + 'S_ALLOW_SMILIES_YES' => $allow_smilies_yes, + 'S_ALLOW_SMILIES_NO' => $allow_smilies_no, + + 'S_HTML_TAGS' => $textblock_allowed_html_tags, + 'L_BLOCK_TITLE' => $lang['Block_title'], 'L_BLOCK_DESC' => $lang['Block_desc'], *************** *** 614,617 **** --- 661,665 ---- 'E_BLOCK_TITLE' => $block_title, 'E_BLOCK_DESC' => $block_desc, + 'BLOCK_INFO' => $block_text, 'S_SHOW_BLOCK_YES' => $show_block_yes, |