|
From: Jon O. <jon...@us...> - 2005-10-22 22:42:40
|
Update of /cvsroot/mxbb/mx_dev_startkit/admin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv378/modules/mx_dev_startkit/admin Modified Files: mx_module_defs.php Added Files: admin_dev_startkit.php Log Message: adding this dev startkit module Index: mx_module_defs.php =================================================================== RCS file: /cvsroot/mxbb/mx_dev_startkit/admin/mx_module_defs.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** mx_module_defs.php 22 Oct 2005 12:40:33 -0000 1.1 --- mx_module_defs.php 22 Oct 2005 22:42:31 -0000 1.2 *************** *** 20,23 **** --- 20,27 ---- */ + if ( !empty( $setmodules ) ) + { + return; + } /********************************************************************************\ *************** *** 53,57 **** } ! $type_row['phpbb_type_select'] = !empty($lang['ParType_phpbb_type_select']) ? $lang['ParType_phpbb_type_select'] : "phpBB Source"; return $type_row; --- 57,61 ---- } ! $type_row['startkit_module_select'] = !empty($lang['ParType_startkit_module_select']) ? $lang['ParType_startkit_module_select'] : "startkit_module_select"; return $type_row; *************** *** 63,75 **** 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; } --- 67,79 ---- function submit_module_parameters( $parameter_data, $block_id ) { ! global $HTTP_POST_VARS, $db, $board_config, $html_entities_match, $html_entities_replace, $mx_request_vars, $mx_request_vars; ! $parameter_value = $mx_request_vars->request($parameter_data['parameter_id'], MX_TYPE_INT, 1); $parameter_opt = ''; switch ( $parameter_data['parameter_type'] ) { ! case 'startkit_module_select': ! // Nothing special to do for this simple integer break; } *************** *** 86,197 **** 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'); ! ! } } ?> \ No newline at end of file --- 90,133 ---- switch ( $parameter_data['parameter_type'] ) { ! case 'startkit_module_select': ! $this->display_edit_startkit_module_select( $block_id, $parameter_data['parameter_id'], $parameter_data ); break; } } ! function display_edit_startkit_module_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; + // + // Includes + // $module_root_path = $mx_root_path . $mx_blockcp->module_root_path; ! include_once( $module_root_path . 'includes/startkit_constants.' . $phpEx ); ! // ! // Get varaibles ! // ! $parameter_datas = get_list($parameter_id, MODULE_TABLE, 'module_id', 'module_name', $parameter_data['parameter_value'], true); ! ! // ! // Start page proper ! // $template->set_filenames(array( ! 'parameter' => 'admin/mx_module_parameters.tpl') ); ! $template->assign_block_vars( 'select', array( ! 'PARAMETER_TITLE' => ( !empty($lang[$parameter_data['parameter_name']]) ) ? $lang[$parameter_data['parameter_name']] : $parameter_data['parameter_name'], ! 'PARAMETER_TITLE_EXPLAIN' => ( !empty($lang[$parameter_data['parameter_name']. "_explain"]) ) ? '<br />' . $lang[$parameter_data['parameter_name']. "_explain"] : '', ! 'SELECT_LIST' => $parameter_datas, ! 'FIELD_NAME' => ( !empty($lang[$parameter_data['parameter_name']]) ) ? $lang[$parameter_data['parameter_name']] : $parameter_data['parameter_name'], ! 'FIELD_ID' => $parameter_data['parameter_id'], ! 'FIELD_DESCRIPTION' => ( !empty($lang["ParType_".$parameter_data['parameter_type']]) ) ? $lang["ParType_".$parameter_data['parameter_type']] : '' ! )); ! ! $template->pparse('parameter'); } } ?> \ No newline at end of file --- NEW FILE: admin_dev_startkit.php --- <?php /** ------------------------------------------------------------------------ * Subject : mxBB - a fully modular portal and CMS (for phpBB) * Author : Jon Ohlsson and the mxBB Team * Credits : The phpBB Group & Marc Morisette, WebSnail < Martin Smallridge > * Copyright : (C) 2002-2005 mxBB Portal * Email : jo...@mx... * Project site : www.mxbb-portal.com * ------------------------------------------------------------------------- * * $Id: admin_dev_startkit.php,v 1.1 2005/10/22 22:42:31 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', true ); if ( !empty( $setmodules ) ) { $filename = basename( __FILE__ ); $module['Hej']['Hej'] = 'modules/mx_dev_startkit/admin/' . $filename; return; } $mx_root_path = '../../../'; $module_root_path = "../"; require( $mx_root_path . 'extension.inc' ); require( $mx_root_path . '/admin/pagestart.' . $phpEx ); // // Includes // require( $module_root_path . 'includes/startkit_constants.' . $phpEx ); include_once( $mx_root_path . 'admin/page_header_admin.' . $phpEx ); // -------------------------------------------------- $sql = "SELECT * FROM " . STARTKIT_CONFIG_TABLE; if ( !$result = $db->sql_query( $sql ) ) { message_die( GENERAL_ERROR, "Couldn't query dev startkit config table", "", __LINE__, __FILE__, $sql ); } else { while ( $row = $db->sql_fetchrow( $result ) ) { $config_name = $row['config_name']; $config_value = $row['config_value']; $default_config[$config_name] = $config_value; $new[$config_name] = ( isset( $HTTP_POST_VARS[$config_name] ) ) ? $HTTP_POST_VARS[$config_name] : $default_config[$config_name]; if ( isset( $HTTP_POST_VARS['submit'] ) ) { $sql = "UPDATE " . STARTKIT_CONFIG_TABLE . " SET config_value = '" . str_replace( "\'", "''", $new[$config_name] ) . "' WHERE config_name = '$config_name'"; if ( !$db->sql_query( $sql ) ) { message_die( GENERAL_ERROR, "Failed to update startkit configuration for $config_name", "", __LINE__, __FILE__, $sql ); } } } if ( isset( $HTTP_POST_VARS['submit'] ) ) { $message = $lang['Startkit_config_updated'] . "<br /><br />" . sprintf( $lang['Startkit_return_config'], "<a href=\"" . append_sid( "admin_dev_startkit.$phpEx" ) . "\">", "</a>" ) . "<br /><br />" . sprintf( $lang['Click_return_admin_index'], "<a href=\"" . append_sid( $mx_root_path . "admin/index.$phpEx?pane=right" ) . "\">", "</a>" ); message_die( GENERAL_MESSAGE, $message ); } } $startkit_config1 = $new['startkit_config1']; $startkit_config2_yes = ( $new['startkit_config2'] ) ? "checked=\"checked\"" : ""; $startkit_config2_no = ( !$new['startkit_config2'] ) ? "checked=\"checked\"" : ""; $template->set_filenames( array( "body" => "admin/startkit_config_body.tpl" ) ); $template->assign_vars( array( "S_CONFIG_ACTION" => append_sid( "admin_dev_startkit.$phpEx" ), "L_YES" => $lang['Yes'], "L_NO" => $lang['No'], "L_CONFIGURATION_TITLE" => $lang['Config_Startkit'], "L_CONFIGURATION_EXPLAIN" => $lang['Config_Startkit_explain'], "L_GENERAL_SETTINGS" => $lang['Config_Startkit'], "L_STARTKIT_CONFIG1" => $lang['startkit_config1'], "L_STARTKIT_CONFIG1_EXPLAIN" => $lang['startkit_config1_explain'], "L_STARTKIT_CONFIG2" => $lang['startkit_config2'], "L_STARTKIT_CONFIG2_EXPLAIN" => $lang['startkit_config2_explain'], "L_SUBMIT" => $lang['Submit'], "L_RESET" => $lang['Reset'], "STARTKIT_CONFIG1" => $startkit_config1, "S_STARTKIT_CONFIG2_YES" => $startkit_config2_yes, "S_STARTKIT_CONFIG2_NO" => $startkit_config2_no )); $template->pparse( "body" ); include_once( $mx_root_path . 'admin/page_footer_admin.' . $phpEx ); ?> |