|
From: OryNider <ory...@us...> - 2007-06-06 21:38:34
|
Update of /cvsroot/mxbb/mx_pageblock/admin In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv29672/admin Added Files: mx_module_defs.php Log Message: --- NEW FILE: mx_module_defs.php --- <?php /** * * @package mxBB Portal Module - mx_pageblock * @version $Id: mx_module_defs.php,v 1.1 2007/06/06 21:38:29 orynider Exp $ * @copyright (c) 2002-2006 [Jon Ohlsson] mxBB Project Team, mxBB Development Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ if ( !defined( 'IN_PORTAL' ) ) { die( "Hacking attempt" ); } /********************************************************************************\ | Class: mx_module_defs | The mx_module_defs object provides additional module block parameters... \********************************************************************************/ class mx_module_defs { // ------------------------------ // Private Methods // // // =================================================== // define module specific block parameters // =================================================== function get_parameters($type_row = '') { global $lang; if (empty($type_row)) { $type_row = array(); } $type_row['pageblock_select'] = !empty($lang['ParType_pageblock_type_select']) ? $lang['ParType_pageblock_type_select'] : "pageblock Source"; return $type_row; } // =================================================== // Submit custom parameter field and data // =================================================== 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; $parameter_value = $HTTP_POST_VARS[$parameter_data['parameter_name']]; $parameter_opt = ''; switch ( $parameter_data['parameter_type'] ) { case 'pageblock_select': $bbcode_on = false; $html_on = false; $smilies_on = false; $bbcode_uid = 0; // Remove allowed html tags $html_entities_match = array(); $html_entities_replace = array(); 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; // // Add search words // mx_admin::mx_remove_search_post($block_id); $block_config_temp = $mx_cache->read( $block_id, MX_CACHE_BLOCK_TYPE ); $block_info_temp = $block_config_temp[$block_id]['block_info']; $block_title = $block_info_temp['block_title']; mx_admin::mx_add_search_words('single', $block_id, $parameter_value, $block_title); return array('parameter_value' => $parameter_value, 'parameter_opt' => $parameter_opt); } // =================================================== // Display cuztom parameter field and data in the Block Control Panel // =================================================== function display_module_parameters( $parameter_data, $block_id ) { global $template, $mx_blockcp, $mx_root_path, $theme, $lang; switch ( $parameter_data['parameter_type'] ) { case 'pageblock_select': $this->display_edit_pageBlock( $block_id, $parameter_data['parameter_id'], $parameter_data ); break; } } function display_edit_pageBlock( $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 = 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( 'parameter' => 'admin/mx_module_parameters.tpl') ); // // 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/mx_shared/tinymce/jscripts/tiny_mce/blank.htm' ) ) { $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'] )); } $parameter_field = '<textarea rows="30" cols="150" wrap="virtual" name="' . $parameter_id . '" class="post">' . $parameter_value . '</textarea>'; $template->assign_vars(array( 'HTML_STATUS' => $html_status, 'BBCODE_STATUS' => $bbcode_status, 'SMILIES_STATUS' => $smilies_status, 'L_PREVIEW' => $lang['Preview'], 'L_PAGEBLOCK_SETTINGS' => $lang['pageblock_Settings'], 'L_CAT_PAGEURL' => $lang['Page_url'], // To sync script and textarea select field 'SELECT_NAME' => $parameter_data['parameter_name'], )); $template->assign_block_vars('textblock', array( 'PARAMETER_TITLE' => ( !empty($lang[$parameter_data['parameter_name']]) ) ? $lang[$parameter_data['parameter_name']] : $parameter_data['parameter_name'], 'PARAMETER_TYPE' => ( !empty($lang["ParType_".$parameter_data['parameter_type']]) ) ? $lang["ParType_".$parameter_data['parameter_type']] : '', 'PARAMETER_TYPE_EXPLAIN' => ( !empty($lang["ParType_".$parameter_data['parameter_type'] . "_info"]) ) ? '<br />' . $lang["ParType_".$parameter_data['parameter_type'] . "_info"] : '', 'TEXT' => $parameter_data['parameter_value'] )); $template->pparse('parameter'); } } ?> |