|
From: Jon O. <jon...@us...> - 2005-09-20 15:40:34
|
Update of /cvsroot/mxbb/mx_phpbb/admin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17659/admin Added Files: admin_forums_ext.php mx_module_defs.php Log Message: adding new files for module mx_phpbb --- NEW FILE: mx_module_defs.php --- <?php /** ------------------------------------------------------------------------ * subject : mx-portal, CMS & portal * begin : june, 2002 * copyright : (C) 2002-2005 MX-System * email : jon...@ho... * project site : www.mx-system.com * * description : * ------------------------------------------------------------------------- * * $Id: mx_module_defs.php,v 1.1 2005/09/20 15:40:17 jonohlsson Exp $ */ /** * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. */ /********************************************************************************\ | Class: mx_blockcp_parameter | The mx_blockcp_parameter object provides extra module block parameters, added to the standard core parameters. | | Usage examples: | \********************************************************************************/ // // The following flags are class specific options // //define('MX_ALL_DATA' , -1); // Flag - write all data 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['phpbb_type_select'] = !empty($lang['ParType_phpbb_type_select']) ? $lang['ParType_phpbb_type_select'] : "phpBB 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, $html_entities_match, $html_entities_replace; $parameter_value = $HTTP_POST_VARS[$parameter_data['parameter_id']]; $parameter_opt = ''; switch ( $parameter_data['parameter_type'] ) { case 'phpbb_type_select': $parameter_value = addslashes( serialize( $parameter_value ) ); break; } return array('parameter_value' => $parameter_value, 'parameter_opt' => $parameter_opt); } // =================================================== // display parameter field and data in the add/edit page // =================================================== function display_module_parameters( $parameter_data ) { global $template, $mx_blockcp, $mx_root_path, $theme, $lang; switch ( $parameter_data['parameter_type'] ) { case 'phpbb_type_select': $this->display_edit_Phpbb_type_select( $block_id, $parameter_data['parameter_id'], $parameter_data ); break; } } function display_edit_Phpbb_type_select( $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; $module_root_path = $mx_root_path . $mx_blockcp->module_root_path; include_once( $module_root_path . "includes/phpbb_constants.$phpEx" ); include_once( $module_root_path . "includes/phpbb_defs.$phpEx" ); if (file_exists($mx_root_path . $mx_blockcp->module_root_path . 'templates/'. $theme['template_name'] . '/admin/mx_module_parameters.tpl')) { $module_template_file = $mx_root_path . $mx_blockcp->module_root_path . 'templates/'. $theme['template_name'] . '/admin/mx_module_parameters.tpl'; } else { $module_template_file = $mx_root_path . $mx_blockcp->module_root_path . 'templates/subSilver' . '/admin/mx_module_parameters.tpl'; } $template->set_filenames(array( 'parameter' => $module_template_file) ); // Get number of forums in db $sql = "SELECT * FROM " . NEWS_CAT_TABLE . " ORDER BY $cat_extract_order"; if ( !( $result = $db->sql_query( $sql ) ) ) { message_die( GENERAL_ERROR, "Couldn't obtain forums information.", "", __LINE__, __FILE__, $sql ); } $forums = $db->sql_fetchrowset( $result ); // Get array of categories from the database $sql = "SELECT cat_id, cat_title FROM " . CATEGORIES_TABLE . " ORDER BY cat_order"; if ( !( $result = $db->sql_query( $sql ) ) ) { mx_message_die( GENERAL_ERROR, "Couldn't obtain category list.", "", __LINE__, __FILE__, $sql ); } $categories = $db->sql_fetchrowset( $result ); $phpbb_type_select_data = ( !empty( $mx_blockcp->block_parameters['Source_phpBB_Forums']['parameter_value'] ) ) ? unserialize($mx_blockcp->block_parameters['Source_phpBB_Forums']['parameter_value']) : array(); // // Check that some categories exist // if ( $total_categories = count( $categories ) ) { // // Check that some forums exist (these were queried earlier) // if ( $total_forums = count( $forums ) ) { $template->assign_block_vars( 'switch_forums_phpbb', array( 'COLSPAN' => count( $item_types_array ) + 2 ) ); for( $i = 0; $i < $total_categories; $i++ ) { $template->assign_block_vars( 'catrow', array( 'CAT_ID' => $categories[$i]['cat_id'], 'COLSPAN' => count( $item_types_array ) + 1, 'CAT_NAME' => $categories[$i]['cat_title'] ) ); for( $j = 0; $j < $total_forums; $j++ ) { if ( $forums[$j]['cat_id'] == $categories[$i]['cat_id'] || $forums[$j]['cat_id'] == '' ) { $template->assign_block_vars( 'catrow.forumrow_phpbb', array( 'FORUM_ID' => $forums[$j][$catt_id], 'FORUM_NAME' => $forums[$j][$catt_name], 'FORUM_DESC' => $forums[$j][$catt_desc], 'CHECKED' => ( $phpbb_type_select_data[$forums[$j]['forum_id']] ? 'CHECKED' : '' ), )); } } } } } $template->assign_vars(array( 'NAME' => $lang[$parameter_data['parameter_name']], 'SELECT_NAME' => $parameter_data['parameter_id'], '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"] : '', 'SCRIPT_PATH' => $module_root_path, 'I_ANNOUNCE' => PHPBB_URL . $images['folder_announce'], 'I_STICKY' => PHPBB_URL . $images['folder_sticky'], 'I_NORMAL' => PHPBB_URL . $images['folder'], 'L_ANNOUNCEMENT' => $lang['Post_Announcement'], 'L_STICKY' => $lang['Post_Sticky'], 'L_NORMAL' => $lang['Posted'], )); $template->pparse('parameter'); } } ?> --- NEW FILE: admin_forums_ext.php --- <?php /** * admin_forums_ext.php * ------------------- * begin : Thursday, Jul 12, 2001 * copyright : (C) 2001 The phpBB Group * email : su...@ph... * * $Id: admin_forums_ext.php,v 1.1 2005/09/20 15:40:17 jonohlsson Exp $ */ /** * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. */ define( 'IN_PORTAL', 1 ); if ( !empty( $setmodules ) ) { $file = basename( __FILE__ ); $module['phpBB plugin']['Management'] = 'modules/mx_phpbb/admin/' . $file; return; } $mx_root_path = '../../../'; $module_root_path = "../"; require( $mx_root_path . 'extension.inc' ); require( $mx_root_path . '/admin/pagestart.' . $phpEx ); include_once( $mx_root_path . 'admin/page_header_admin.' . $phpEx ); include_once( $module_root_path . 'includes/phpbb_constants.' . $phpEx ); // // Mode setting // $mode = $mx_request_vars->request('mode', MX_TYPE_NO_TAGS, ''); // // Main db settings // Pull all config data // $sql = "SELECT * FROM " . PHPBB_CONFIG_TABLE; if ( !$result = $db->sql_query( $sql ) ) { mx_message_die( CRITICAL_ERROR, "Could not query phpbb plugin base configuration information", "", __LINE__, __FILE__, $sql ); } else { while ( $row = $db->sql_fetchrow( $result ) ) { $phpbb_config_name = $row['config_name']; $phpbb_config_value = $row['config_value']; $phpbb_default_config[$phpbb_config_name] = $phpbb_config_value; $phpbb_new[$phpbb_config_name] = ( isset( $HTTP_POST_VARS[$phpbb_config_name] ) ) ? $HTTP_POST_VARS[$phpbb_config_name] : $phpbb_default_config[$phpbb_config_name]; if ( isset( $HTTP_POST_VARS['submit'] ) ) { $sql = "UPDATE " . PHPBB_CONFIG_TABLE . " SET config_value = '" . str_replace( "\'", "''", $phpbb_new[$phpbb_config_name] ) . "' WHERE config_name = '$phpbb_config_name'"; if ( !$db->sql_query( $sql ) ) { mx_message_die( GENERAL_ERROR, "Failed to update general configuration for $config_name", "", __LINE__, __FILE__, $sql ); } } } if ( isset( $HTTP_POST_VARS['submit'] ) ) { $message = $lang['phpbb_config_updated'] . "<br /><br />" . sprintf( $lang['Click_return_phpbb_config'], "<a href=\"" . append_sid( "admin_forums_ext.$phpEx" ) . "\">", "</a>" ) . "<br /><br />" . sprintf( $lang['Click_return_admin_index'], "<a href=\"" . append_sid( $mx_root_path . "admin/index.$phpEx?pane=right" ) . "\">", "</a>" ); mx_message_die( GENERAL_MESSAGE, $message ); } } // // Populate parameter variables // $phpbb_index = $phpbb_new['index']; $phpbb_viewforum = $phpbb_new['viewforum']; $phpbb_viewtopic = $phpbb_new['viewtopic']; $phpbb_faq = $phpbb_new['faq']; $phpbb_groupcp = $phpbb_new['groupcp']; $phpbb_login = $phpbb_new['login']; $phpbb_memberlist = $phpbb_new['memberlist']; $phpbb_modcp = $phpbb_new['modcp']; $phpbb_posting = $phpbb_new['posting']; $phpbb_privmsg = $phpbb_new['privmsg']; $phpbb_profile = $phpbb_new['profile']; $phpbb_search = $phpbb_new['search']; $phpbb_viewonline = $phpbb_new['viewonline']; $phpbb_other = $phpbb_new['other']; $phpbb_override_default_pages = $phpbb_new['override_default_pages']; $phpbb_integration_enabled = $phpbb_new['enable_module']; // // Get page_list selects // $pagelist_index = get_list_formatted('page_list', $phpbb_new['index'], 'index'); //$pagelist_viewforum = get_list_formatted('page_list', $phpbb_new['viewforum'], 'viewforum'); //$pagelist_viewtopic = get_list_formatted('page_list', $phpbb_new['viewtopic'], 'viewtopic'); $pagelist_faq = get_list_formatted('page_list', $phpbb_new['faq'], 'faq'); $pagelist_groupcp = get_list_formatted('page_list', $phpbb_new['groupcp'], 'groupcp'); $pagelist_login = get_list_formatted('page_list', $phpbb_new['login'], 'login'); $pagelist_memberlist = get_list_formatted('page_list', $phpbb_new['memberlist'], 'memberlist'); //$pagelist_modcp = get_list_formatted('page_list', $phpbb_new['modcp'], 'modcp'); //$pagelist_posting = get_list_formatted('page_list', $phpbb_new['posting'], 'posting'); $pagelist_privmsg = get_list_formatted('page_list', $phpbb_new['privmsg'], 'privmsg'); $pagelist_profile = get_list_formatted('page_list', $phpbb_new['profile'], 'profile'); $pagelist_search = get_list_formatted('page_list', $phpbb_new['search'], 'search'); $pagelist_viewonline = get_list_formatted('page_list', $phpbb_new['viewonline'], 'viewonline'); $pagelist_other = get_list_formatted('page_list', $phpbb_new['other'], 'other'); // // Start page proper // $template->set_filenames( array( "body" => "admin/forum_admin_body_ext.tpl" )); $template->assign_vars( array( 'S_FORUM_ACTION' => append_sid( "admin_forums_ext.$phpEx" ), 'L_FORUM_TITLE' => $lang['mx_forum_admin'], 'L_FORUM_EXPLAIN' => $lang['mx_forum_admin_explain'], 'L_SUBMIT' => $lang['submit'], 'L_RESET' => $lang['reset'], 'L_DEFAULT_PAGES_TITLE' => $lang['default_pages_title'], 'L_DEFAULT_PAGES_TITLE_EXPLAIN' => $lang['default_pages_title_explain'], 'L_DEFAULT_PAGES_MORE_TITLE' => $lang['default_pages_more_title'], 'L_DEFAULT_PAGES_MORE_TITLE_EXPLAIN' => $lang['default_pages_more_title_explain'], // // Enable/Disable phpBB integration // 'L_PHPBB_INTEGRATION_ENABLED' => $lang['phpbb_integration_enabled'], 'L_PHPBB_INTEGRATION_ENABLED_EXPLAIN' => $lang['phpbb_integration_enabled_explain'], 'L_PHPBB_INTEGRATION_ENABLED_YES' => $lang['phpbb_integration_enabled_yes'], 'L_PHPBB_INTEGRATION_ENABLED_NO' => $lang['phpbb_integration_enabled_no'], 'PHPBB_INTEGRATION_ENABLED_YES' => ( $phpbb_integration_enabled == '1' ) ? ' checked="checked"' : '', 'PHPBB_INTEGRATION_ENABLED_NO' => ( $phpbb_integration_enabled == '0' ) ? ' checked="checked"' : '', // // Default static settings or block settings // 'L_PHPBB_OVERRIDE_DEFAULT_PAGES' => $lang['phpbb_override'], 'L_PHPBB_OVERRIDE_DEFAULT_PAGES_EXPLAIN' => $lang['phpbb_override_explain'], 'L_PHPBB_OVERRIDE_DEFAULT_PAGES_YES' => $lang['phpbb_override_yes'], 'L_PHPBB_OVERRIDE_DEFAULT_PAGES_NO' => $lang['phpbb_override_no'], 'OVERRIDE_DEFAULT_PAGES_CHECKBOX_YES' => ( $phpbb_override_default_pages == '1' ) ? ' checked="checked"' : '', 'OVERRIDE_DEFAULT_PAGES_CHECKBOX_NO' => ( $phpbb_override_default_pages == '0' ) ? ' checked="checked"' : '', // // ProfileCP compatitility och info // 'L_DEFAULT_PAGES_PROFILECP' => $lang['default_pages_profilecp'], 'L_PHPBB_EXPLAIN' => $lang['phpbb_explain'], 'L_PHPBB_FAQ' => $lang['phpbb_faq'], 'PHPBB_FAQ' => $pagelist_faq, 'L_PHPBB_GROUPCP' => $lang['phpbb_groupcp'], 'PHPBB_GROUPCP' => $pagelist_groupcp, 'L_PHPBB_INDEX' => $lang['phpbb_index'] . ', ' . $lang['phpbb_viewforum'] . ', ' . $lang['phpbb_viewtopic'] . ', ' . $lang['phpbb_posting'] . ', ' . $lang['phpbb_modcp'], 'PHPBB_INDEX' => $pagelist_index, 'L_PHPBB_LOGIN' => $lang['phpbb_login'], 'PHPBB_LOGIN' => $pagelist_login, 'L_PHPBB_MEMBERLIST' => $lang['phpbb_memberlist'], 'PHPBB_MEMBERLIST' => $pagelist_memberlist, //'L_PHPBB_MODCP' => $lang['phpbb_modcp'], //'PHPBB_MODCP' => $pagelist_modcp, //'L_PHPBB_POSTING' => $lang['phpbb_posting'], //'PHPBB_POSTING' => $pagelist_posting, 'L_PHPBB_PRIVMSG' => $lang['phpbb_privmsg'], 'PHPBB_PRIVMSG' => $pagelist_privmsg, 'L_PHPBB_PROFILE' => $lang['phpbb_profile'], 'PHPBB_PROFILE' => $pagelist_profile, 'L_PHPBB_SEARCH' => $lang['phpbb_search'], 'PHPBB_SEARCH' => $pagelist_search, //'L_PHPBB_VIEWFORUM' => $lang['phpbb_viewforum'], //'PHPBB_VIEWFORUM' => $pagelist_viewforum, 'L_PHPBB_VIEWONLINE' => $lang['phpbb_viewonline'], 'PHPBB_VIEWONLINE' => $pagelist_viewonline, 'L_PHPBB_OTHER' => $lang['phpbb_other'], 'PHPBB_OTHER' => $pagelist_other, //'L_PHPBB_VIEWTOPIC' => $lang['phpbb_viewtopic'], //'PHPBB_VIEWTOPIC' => $pagelist_viewtopic )); $template->pparse( "body" ); include_once( $mx_root_path . 'admin/page_footer_admin.' . $phpEx ); ?> |