|
From: Jon O. <jon...@us...> - 2005-03-28 20:23:31
|
Update of /cvsroot/mxbb/mx_kb/admin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20851/modules/mx_kb/admin Modified Files: admin_kb_art.php admin_kb_auth.php admin_kb_cat.php admin_kb_config.php admin_kb_types.php Added Files: admin_kb_custom.php Log Message: finally rewriting this module, once and for all - rewritten post methods - better security - separated html. bbcode, smilies from phpbb - wysiwyg support - adding custom fields - making it compatible with phpBB mod Index: admin_kb_auth.php =================================================================== RCS file: /cvsroot/mxbb/mx_kb/admin/admin_kb_auth.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** admin_kb_auth.php 4 Feb 2005 23:44:30 -0000 1.1 --- admin_kb_auth.php 28 Mar 2005 20:22:44 -0000 1.2 *************** *** 19,47 **** */ ! define( 'IN_PORTAL', 1 ); ! ! if ( !empty( $setmodules ) ) { ! $filename = basename( __FILE__ ); ! $module['KB_title']['Permissions'] = "modules/mx_kb/admin/" . $filename; ! return; } - - - // Let's set the root dir for phpBB - - $module_root_path = '../'; - $mx_root_path = '../../../'; - require( $mx_root_path . 'extension.inc' ); - require( $mx_root_path . 'admin/pagestart.' . $phpEx ); - require( $module_root_path . 'includes/kb_constants.' . $phpEx ); - require( $module_root_path . 'includes/functions_kb.' . $phpEx ); - require( $module_root_path . 'includes/functions_kb_auth.' . $phpEx ); - - include_once( $mx_root_path . 'admin/page_header_admin.' . $phpEx ); if ( !isset( $HTTP_POST_VARS['submit'] ) ) { - $s_kb_cat_list = get_kb_cat_list( 0, 0, 0, true ); $template->set_filenames( array( 'body' => 'admin/kb_cat_select_body.tpl' ) --- 19,72 ---- */ ! if ( file_exists( './../viewtopic.php' ) ) { ! define( 'IN_PHPBB', 1 ); ! define( 'IN_PORTAL', 1 ); ! define( 'MXBB_MODULE', false ); ! ! if ( !empty( $setmodules ) ) ! { ! $file = basename( __FILE__ ); ! $module['KB_title']['Permissions'] = $file; ! return; ! } ! ! $phpbb_root_path = $module_root_path = $mx_root_path = "./../"; ! require( $phpbb_root_path . 'extension.inc' ); ! require( './pagestart.' . $phpEx ); ! include( $phpbb_root_path . 'config.'.$phpEx ); ! include( $phpbb_root_path . 'includes/functions_admin.'.$phpEx ); ! include( $phpbb_root_path . 'includes/kb_constants.' . $phpEx ); ! include( $phpbb_root_path . 'includes/functions_kb.' . $phpEx ); ! include( $phpbb_root_path . 'includes/functions_kb_auth.' . $phpEx ); ! include( $phpbb_root_path . 'includes/functions_kb_field.' . $phpEx ); ! include( $phpbb_root_path . 'includes/functions_kb_mx.' . $phpEx ); ! include( $phpbb_root_path . 'includes/functions_search.' . $phpEx ); ! } ! else ! { ! define( 'IN_PORTAL', 1 ); ! ! if ( !empty( $setmodules ) ) ! { ! $file = basename( __FILE__ ); ! $module['KB_title']['Permissions'] = "modules/mx_kb/admin/" . $file; ! return; ! } ! ! $mx_root_path = '../../../'; ! $module_root_path = "../"; ! require( $mx_root_path . 'extension.inc' ); ! require( $mx_root_path . '/admin/pagestart.' . $phpEx ); ! include( $module_root_path . 'includes/kb_constants.' . $phpEx ); ! include( $module_root_path . 'includes/functions_kb.' . $phpEx ); ! include( $module_root_path . 'includes/functions_kb_auth.' . $phpEx ); ! include( $module_root_path . 'includes/functions_kb_field.' . $phpEx ); ! include( $phpbb_root_path . 'includes/functions_search.' . $phpEx ); ! include_once( $mx_root_path . 'admin/page_header_admin.' . $phpEx ); } if ( !isset( $HTTP_POST_VARS['submit'] ) ) { $s_kb_cat_list = get_kb_cat_list( 0, 0, 0, true ); $template->set_filenames( array( 'body' => 'admin/kb_cat_select_body.tpl' ) Index: admin_kb_config.php =================================================================== RCS file: /cvsroot/mxbb/mx_kb/admin/admin_kb_config.php,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** admin_kb_config.php 26 Mar 2005 22:52:35 -0000 1.14 --- admin_kb_config.php 28 Mar 2005 20:22:45 -0000 1.15 *************** *** 20,48 **** */ ! define( 'IN_PORTAL', 1 ); ! ! if ( !empty( $setmodules ) ) { ! $file = basename( __FILE__ ); ! $module['KB_title']['Configuration'] = 'modules/mx_kb/admin/' . $file . '?mode=config'; ! return; } - - // Load default header - - /* - $phpbb_root_path = "./../"; - require($phpbb_root_path . 'extension.inc'); - require('./pagestart.' . $phpEx); - include($phpbb_root_path . 'config.'.$phpEx); - include($phpbb_root_path . 'includes/functions_admin.'.$phpEx); - */ - $mx_root_path = '../../../'; - $module_root_path = "../"; - require( $mx_root_path . 'extension.inc' ); - require( $mx_root_path . '/admin/pagestart.' . $phpEx ); - require( $module_root_path . 'includes/kb_constants.' . $phpEx ); - - include_once( $mx_root_path . 'admin/page_header_admin.' . $phpEx ); // Pull all config data --- 20,70 ---- */ ! if ( file_exists( './../viewtopic.php' ) ) { ! define( 'IN_PHPBB', 1 ); ! define( 'IN_PORTAL', 1 ); ! define( 'MXBB_MODULE', false ); ! ! if ( !empty( $setmodules ) ) ! { ! $file = basename( __FILE__ ); ! $module['KB_title']['Configuration'] = $file; ! return; ! } ! ! $phpbb_root_path = $module_root_path = $mx_root_path = "./../"; ! require( $phpbb_root_path . 'extension.inc' ); ! require( './pagestart.' . $phpEx ); ! include( $phpbb_root_path . 'config.'.$phpEx ); ! include( $phpbb_root_path . 'includes/functions_admin.'.$phpEx ); ! include( $phpbb_root_path . 'includes/kb_constants.' . $phpEx ); ! include( $phpbb_root_path . 'includes/functions_kb.' . $phpEx ); ! include( $phpbb_root_path . 'includes/functions_kb_auth.' . $phpEx ); ! include( $phpbb_root_path . 'includes/functions_kb_field.' . $phpEx ); ! include( $phpbb_root_path . 'includes/functions_kb_mx.' . $phpEx ); ! include( $phpbb_root_path . 'includes/functions_search.' . $phpEx ); ! } ! else ! { ! define( 'IN_PORTAL', 1 ); ! ! if ( !empty( $setmodules ) ) ! { ! $file = basename( __FILE__ ); ! $module['KB_title']['Configuration'] = 'modules/mx_kb/admin/' . $file . '?mode=config'; ! return; ! } ! ! $mx_root_path = '../../../'; ! $module_root_path = "../"; ! require( $mx_root_path . 'extension.inc' ); ! require( $mx_root_path . '/admin/pagestart.' . $phpEx ); ! include( $module_root_path . 'includes/kb_constants.' . $phpEx ); ! include( $module_root_path . 'includes/functions_kb.' . $phpEx ); ! include( $module_root_path . 'includes/functions_kb_auth.' . $phpEx ); ! include( $module_root_path . 'includes/functions_kb_field.' . $phpEx ); ! include( $phpbb_root_path . 'includes/functions_search.' . $phpEx ); ! include_once( $mx_root_path . 'admin/page_header_admin.' . $phpEx ); } // Pull all config data Index: admin_kb_cat.php =================================================================== RCS file: /cvsroot/mxbb/mx_kb/admin/admin_kb_cat.php,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** admin_kb_cat.php 17 Mar 2005 12:37:24 -0000 1.7 --- admin_kb_cat.php 28 Mar 2005 20:22:44 -0000 1.8 *************** *** 20,51 **** */ ! define( 'IN_PORTAL', 1 ); ! ! if ( !empty( $setmodules ) ) { ! $file = basename( __FILE__ ); ! $module['KB_title']['Cat_man'] = 'modules/mx_kb/admin/' . $file; ! return; } - - - // Load default header - - /* - $phpbb_root_path = "./../"; - require($phpbb_root_path . 'extension.inc'); - require('./pagestart.' . $phpEx); - include($phpbb_root_path . 'config.'.$phpEx); - include($phpbb_root_path . 'includes/functions_admin.'.$phpEx); - */ - $mx_root_path = '../../../'; - $module_root_path = "../"; - require( $mx_root_path . 'extension.inc' ); - require( $mx_root_path . '/admin/pagestart.' . $phpEx ); - require( $module_root_path . 'includes/kb_constants.' . $phpEx ); - require( $module_root_path . 'includes/functions_kb.' . $phpEx ); - require( $module_root_path . 'includes/functions_kb_auth.' . $phpEx ); - - include_once( $mx_root_path . 'admin/page_header_admin.' . $phpEx ); function get_forums( $sel_id = 0 ) --- 20,70 ---- */ ! if ( file_exists( './../viewtopic.php' ) ) { ! define( 'IN_PHPBB', 1 ); ! define( 'IN_PORTAL', 1 ); ! define( 'MXBB_MODULE', false ); ! ! if ( !empty( $setmodules ) ) ! { ! $file = basename( __FILE__ ); ! $module['KB_title']['Cat_man'] = $file; ! return; ! } ! ! $phpbb_root_path = $module_root_path = $mx_root_path = "./../"; ! require( $phpbb_root_path . 'extension.inc' ); ! require( './pagestart.' . $phpEx ); ! include( $phpbb_root_path . 'config.'.$phpEx ); ! include( $phpbb_root_path . 'includes/functions_admin.'.$phpEx ); ! include( $phpbb_root_path . 'includes/kb_constants.' . $phpEx ); ! include( $phpbb_root_path . 'includes/functions_kb.' . $phpEx ); ! include( $phpbb_root_path . 'includes/functions_kb_auth.' . $phpEx ); ! include( $phpbb_root_path . 'includes/functions_kb_field.' . $phpEx ); ! include( $phpbb_root_path . 'includes/functions_kb_mx.' . $phpEx ); ! include( $phpbb_root_path . 'includes/functions_search.' . $phpEx ); ! } ! else ! { ! define( 'IN_PORTAL', 1 ); ! ! if ( !empty( $setmodules ) ) ! { ! $file = basename( __FILE__ ); ! $module['KB_title']['Cat_man'] = 'modules/mx_kb/admin/' . $file; ! return; ! } ! ! $mx_root_path = '../../../'; ! $module_root_path = "../"; ! require( $mx_root_path . 'extension.inc' ); ! require( $mx_root_path . '/admin/pagestart.' . $phpEx ); ! include( $module_root_path . 'includes/kb_constants.' . $phpEx ); ! include( $module_root_path . 'includes/functions_kb.' . $phpEx ); ! include( $module_root_path . 'includes/functions_kb_auth.' . $phpEx ); ! include( $module_root_path . 'includes/functions_kb_field.' . $phpEx ); ! include( $phpbb_root_path . 'includes/functions_search.' . $phpEx ); ! include_once( $mx_root_path . 'admin/page_header_admin.' . $phpEx ); } function get_forums( $sel_id = 0 ) *************** *** 169,176 **** 'DELETE_MOD' => 'selected="selected"', 'APPROVAL_DISABLED' => 'selected="selected"', ! ! ! ) ! ); } else if ( $HTTP_POST_VARS['submit'] ) --- 188,192 ---- 'DELETE_MOD' => 'selected="selected"', 'APPROVAL_DISABLED' => 'selected="selected"', ! ) ); } else if ( $HTTP_POST_VARS['submit'] ) Index: admin_kb_art.php =================================================================== RCS file: /cvsroot/mxbb/mx_kb/admin/admin_kb_art.php,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** admin_kb_art.php 26 Mar 2005 22:52:35 -0000 1.13 --- admin_kb_art.php 28 Mar 2005 20:22:43 -0000 1.14 *************** *** 20,41 **** */ ! define( 'IN_PORTAL', 1 ); ! ! if ( !empty( $setmodules ) ) { ! $file = basename( __FILE__ ); ! $module['KB_title']['Art_man'] = 'modules/mx_kb/admin/' . $file; ! return; } - - $mx_root_path = '../../../'; - $module_root_path = "../"; - require( $mx_root_path . 'extension.inc' ); - require( $mx_root_path . '/admin/pagestart.' . $phpEx ); - require( $module_root_path . 'includes/kb_constants.' . $phpEx ); - // include($phpbb_root_path . 'includes/functions_admin.'.$phpEx); - include( $module_root_path . 'includes/functions_kb.' . $phpEx ); - include_once( $phpbb_root_path . 'includes/functions_search.' . $phpEx ); - include_once( $mx_root_path . 'admin/page_header_admin.' . $phpEx ); // Pull all config data --- 20,70 ---- */ ! if ( file_exists( './../viewtopic.php' ) ) { ! define( 'IN_PHPBB', 1 ); ! define( 'IN_PORTAL', 1 ); ! define( 'MXBB_MODULE', false ); ! ! if ( !empty( $setmodules ) ) ! { ! $file = basename( __FILE__ ); ! $module['KB_title']['Art_man'] = $file; ! return; ! } ! ! $phpbb_root_path = $module_root_path = $mx_root_path = "./../"; ! require( $phpbb_root_path . 'extension.inc' ); ! require( './pagestart.' . $phpEx ); ! include( $phpbb_root_path . 'config.'.$phpEx ); ! include( $phpbb_root_path . 'includes/functions_admin.'.$phpEx ); ! include( $phpbb_root_path . 'includes/kb_constants.' . $phpEx ); ! include( $phpbb_root_path . 'includes/functions_kb.' . $phpEx ); ! include( $phpbb_root_path . 'includes/functions_kb_auth.' . $phpEx ); ! include( $phpbb_root_path . 'includes/functions_kb_field.' . $phpEx ); ! include( $phpbb_root_path . 'includes/functions_kb_mx.' . $phpEx ); ! include( $phpbb_root_path . 'includes/functions_search.' . $phpEx ); ! } ! else ! { ! define( 'IN_PORTAL', 1 ); ! ! if ( !empty( $setmodules ) ) ! { ! $file = basename( __FILE__ ); ! $module['KB_title']['Art_man'] = 'modules/mx_kb/admin/' . $file; ! return; ! } ! ! $mx_root_path = '../../../'; ! $module_root_path = "../"; ! require( $mx_root_path . 'extension.inc' ); ! require( $mx_root_path . '/admin/pagestart.' . $phpEx ); ! include( $module_root_path . 'includes/kb_constants.' . $phpEx ); ! include( $module_root_path . 'includes/functions_kb.' . $phpEx ); ! include( $module_root_path . 'includes/functions_kb_auth.' . $phpEx ); ! include( $module_root_path . 'includes/functions_kb_field.' . $phpEx ); ! include( $phpbb_root_path . 'includes/functions_search.' . $phpEx ); ! include_once( $mx_root_path . 'admin/page_header_admin.' . $phpEx ); } // Pull all config data *************** *** 114,118 **** // Post ! $topic_data = kb_insert_post( $kb_message, $subject, $kb_comment['category_forum_id'], $kb_comment['article_author_id'], $userdata['article_author'], $userdata['article_author_sig'], $kb_comment['topic_id'], $kb_update_message ); $topic_sql = ", topic_id = " . $topic_data['topic_id']; --- 143,147 ---- // Post ! $topic_data = kb_insert_post( $kb_message, $subject, $kb_comment['category_forum_id'], $kb_comment['article_editor_id'], $kb_comment['article_editor'], $kb_comment['article_editor_sig'], $kb_comment['topic_id'], $kb_update_message ); $topic_sql = ", topic_id = " . $topic_data['topic_id']; *************** *** 163,167 **** update_kb_number( $article_category_id, '- 1' ); ! mx_remove_search_words( $article_id, 'kb' ); $message = $lang['Article_unapproved'] . '<br /><br />' . sprintf( $lang['Click_return_article_manager'], '<a href="' . append_sid( "admin_kb_art.$phpEx" ) . '">', '</a>' ) . '<br /><br />' . sprintf( $lang['Click_return_admin_index'], '<a href="' . append_sid( $mx_root_path . "admin/index.$phpEx?pane=right" ) . '">', '</a>' ); --- 192,196 ---- update_kb_number( $article_category_id, '- 1' ); ! mx_remove_search_post( $article_id, 'kb' ); $message = $lang['Article_unapproved'] . '<br /><br />' . sprintf( $lang['Click_return_article_manager'], '<a href="' . append_sid( "admin_kb_art.$phpEx" ) . '">', '</a>' ) . '<br /><br />' . sprintf( $lang['Click_return_admin_index'], '<a href="' . append_sid( $mx_root_path . "admin/index.$phpEx?pane=right" ) . '">', '</a>' ); *************** *** 322,326 **** } ! mx_remove_search_words( $article_id, 'kb' ); $message = $lang['Article_deleted'] . '<br /><br />' . sprintf( $lang['Click_return_article_manager'], '<a href="' . append_sid( "admin_kb_art.$phpEx" ) . '">', '</a>' ) . '<br /><br />' . sprintf( $lang['Click_return_admin_index'], '<a href="' . append_sid( $mx_root_path . "admin/index.$phpEx?pane=right" ) . '">', '</a>' ); --- 351,355 ---- } ! mx_remove_search_post( $article_id, 'kb' ); $message = $lang['Article_deleted'] . '<br /><br />' . sprintf( $lang['Click_return_article_manager'], '<a href="' . append_sid( "admin_kb_art.$phpEx" ) . '">', '</a>' ) . '<br /><br />' . sprintf( $lang['Click_return_admin_index'], '<a href="' . append_sid( $mx_root_path . "admin/index.$phpEx?pane=right" ) . '">', '</a>' ); Index: admin_kb_types.php =================================================================== RCS file: /cvsroot/mxbb/mx_kb/admin/admin_kb_types.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** admin_kb_types.php 17 Mar 2005 12:37:24 -0000 1.6 --- admin_kb_types.php 28 Mar 2005 20:22:45 -0000 1.7 *************** *** 20,32 **** */ ! define( 'IN_PORTAL', 1 ); ! ! if ( !empty( $setmodules ) ) { ! $file = basename( __FILE__ ); ! $module['KB_title']['Types_man'] = 'modules/mx_kb/admin/' . $file; ! return; } ! function get_list_kb( $id, $select ) { --- 20,71 ---- */ ! if ( file_exists( './../viewtopic.php' ) ) { ! define( 'IN_PHPBB', 1 ); ! define( 'IN_PORTAL', 1 ); ! define( 'MXBB_MODULE', false ); ! ! if ( !empty( $setmodules ) ) ! { ! $file = basename( __FILE__ ); ! $module['KB_title']['Types_man'] = $file; ! return; ! } ! ! $phpbb_root_path = $module_root_path = $mx_root_path = "./../"; ! require( $phpbb_root_path . 'extension.inc' ); ! require( './pagestart.' . $phpEx ); ! include( $phpbb_root_path . 'config.'.$phpEx ); ! include( $phpbb_root_path . 'includes/functions_admin.'.$phpEx ); ! include( $phpbb_root_path . 'includes/kb_constants.' . $phpEx ); ! include( $phpbb_root_path . 'includes/functions_kb.' . $phpEx ); ! include( $phpbb_root_path . 'includes/functions_kb_auth.' . $phpEx ); ! include( $phpbb_root_path . 'includes/functions_kb_field.' . $phpEx ); ! include( $phpbb_root_path . 'includes/functions_kb_mx.' . $phpEx ); ! include( $phpbb_root_path . 'includes/functions_search.' . $phpEx ); } ! else ! { ! define( 'IN_PORTAL', 1 ); ! ! if ( !empty( $setmodules ) ) ! { ! $file = basename( __FILE__ ); ! $module['KB_title']['Types_man'] = 'modules/mx_kb/admin/' . $file; ! return; ! } ! ! $mx_root_path = '../../../'; ! $module_root_path = "../"; ! require( $mx_root_path . 'extension.inc' ); ! require( $mx_root_path . '/admin/pagestart.' . $phpEx ); ! include( $module_root_path . 'includes/kb_constants.' . $phpEx ); ! include( $module_root_path . 'includes/functions_kb.' . $phpEx ); ! include( $module_root_path . 'includes/functions_kb_auth.' . $phpEx ); ! include( $module_root_path . 'includes/functions_kb_field.' . $phpEx ); ! include( $phpbb_root_path . 'includes/functions_search.' . $phpEx ); ! include_once( $mx_root_path . 'admin/page_header_admin.' . $phpEx ); ! } ! function get_list_kb( $id, $select ) { *************** *** 61,79 **** // Load default header - /* - $phpbb_root_path = "./../"; - require($phpbb_root_path . 'extension.inc'); - require('./pagestart.' . $phpEx); - include($phpbb_root_path . 'config.'.$phpEx); - include($phpbb_root_path . 'includes/functions_admin.'.$phpEx); - */ - $mx_root_path = '../../../'; - $module_root_path = "../"; - require( $mx_root_path . 'extension.inc' ); - require( $mx_root_path . '/admin/pagestart.' . $phpEx ); - require( $module_root_path . 'includes/kb_constants.' . $phpEx ); - - include_once( $mx_root_path . 'admin/page_header_admin.' . $phpEx ); - if ( isset( $HTTP_POST_VARS['mode'] ) || isset( $HTTP_GET_VARS['mode'] ) ) { --- 100,103 ---- *************** *** 142,147 **** // Generate page ! $template->set_filenames( array( 'body' => 'admin/kb_cat_edit_body.tpl' ) ! ); $template->assign_vars( array( 'L_EDIT_TITLE' => $lang['Edit_type'], --- 166,170 ---- // Generate page ! $template->set_filenames( array( 'body' => 'admin/kb_type_edit_body.tpl' ) ); $template->assign_vars( array( 'L_EDIT_TITLE' => $lang['Edit_type'], --- NEW FILE: admin_kb_custom.php --- <?php /** * pafiledb mx module * ------------------- * copyright : (C) 2002 MX-System * begin : oct 23, 2003 * email : jon...@ho... * based on code by Mohd Basri, and pafilDB * * $Id: admin_kb_custom.php,v 1.1 2005/03/28 20:22:45 jonohlsson Exp $ */ if ( file_exists( './../viewtopic.php' ) ) { define( 'IN_PHPBB', 1 ); define( 'IN_PORTAL', 1 ); define( 'MXBB_MODULE', false ); if ( !empty( $setmodules ) ) { $file = basename( __FILE__ ); $module['KB_title']['Custom Field'] = $file; return; } $phpbb_root_path = $module_root_path = $mx_root_path = "./../"; require( $phpbb_root_path . 'extension.inc' ); require( './pagestart.' . $phpEx ); include( $phpbb_root_path . 'config.'.$phpEx ); include( $phpbb_root_path . 'includes/functions_admin.'.$phpEx ); include( $phpbb_root_path . 'includes/kb_constants.' . $phpEx ); include( $phpbb_root_path . 'includes/functions_kb.' . $phpEx ); include( $phpbb_root_path . 'includes/functions_kb_auth.' . $phpEx ); include( $phpbb_root_path . 'includes/functions_kb_field.' . $phpEx ); include( $phpbb_root_path . 'includes/functions_kb_mx.' . $phpEx ); include( $phpbb_root_path . 'includes/functions_search.' . $phpEx ); } else { define( 'IN_PORTAL', 1 ); if ( !empty( $setmodules ) ) { $file = basename( __FILE__ ); $module['KB_title']['Custom Field'] = "modules/mx_kb/admin/" . "$file"; return; } $mx_root_path = '../../../'; $module_root_path = "../"; require( $mx_root_path . 'extension.inc' ); require( $mx_root_path . '/admin/pagestart.' . $phpEx ); include( $module_root_path . 'includes/kb_constants.' . $phpEx ); include( $module_root_path . 'includes/functions_kb.' . $phpEx ); include( $module_root_path . 'includes/functions_kb_auth.' . $phpEx ); include( $module_root_path . 'includes/functions_kb_field.' . $phpEx ); include( $phpbb_root_path . 'includes/functions_search.' . $phpEx ); include_once( $mx_root_path . 'admin/page_header_admin.' . $phpEx ); } // =================================================== // to make it work with php version under 4.1 and other stuff // =================================================== if ( @phpversion() < '4.1' ) { $_GET = &$HTTP_GET_VARS; $_POST = &$HTTP_POST_VARS; $_COOKIE = &$HTTP_COOKIE_VARS; $_SERVER = &$HTTP_SERVER_VARS; $_ENV = &$HTTP_ENV_VARS; $_FILES = &$HTTP_POST_FILES; $_SESSION = &$HTTP_SESSION_VARS; } if ( !isset( $_REQUEST ) ) { $_REQUEST = array_merge( $_GET, $_POST, $_COOKIE ); } if ( !get_magic_quotes_gpc() ) { $_GET = slash_input_data( $_GET ); $_POST = slash_input_data( $_POST ); $_COOKIE = slash_input_data( $_COOKIE ); $_REQUEST = slash_input_data( $_REQUEST ); } $kb_custom_field = new kb_custom_field(); $kb_custom_field->init(); $mode = ( isset( $_REQUEST['mode'] ) ) ? htmlspecialchars( $_REQUEST['mode'] ) : 'select'; $field_id = ( isset( $_REQUEST['field_id'] ) ) ? intval( $_REQUEST['field_id'] ) : 0; $field_type = ( isset( $_REQUEST['field_type'] ) ) ? intval( $_REQUEST['field_type'] ) : $kb_custom_field->field_rowset[$field_id]['field_type']; $field_ids = ( isset( $_REQUEST['field_ids'] ) ) ? $_REQUEST['field_ids'] : ''; $submit = ( isset( $_POST['submit'] ) ) ? true : false; switch ( $mode ) { case 'addfield': $template_file = 'admin/kb_field_add.tpl'; break; case 'editfield': $template_file = 'admin/kb_field_add.tpl'; break; case 'edit': $template_file = 'admin/kb_select_field_edit.tpl'; break; case 'add': $template_file = 'admin/kb_select_field_type.tpl'; break; case 'delete': $template_file = 'admin/kb_select_field_delete.tpl'; break; case 'select': $template_file = 'admin/kb_select.tpl'; break; } if ( $submit ) { if ( $mode == 'do_add' && !$field_id ) { $kb_custom_field->update_add_field( $field_type ); $message = $lang['Fieldadded'] . '<br /><br />' . sprintf( $lang['Click_return'], '<a href="' . append_sid( 'admin_kb_custom.' . $phpEx ) . '">', '</a>' ) . '<br /><br />' . sprintf( $lang['Click_return_admin_index'], '<a href="' . append_sid( 'index.' . $phpEx . '?pane=right' ) . '">', '</a>' ); mx_message_die( GENERAL_MESSAGE, $message ); } elseif ( $mode == 'do_add' && $field_id ) { $kb_custom_field->update_add_field( $field_type, $field_id ); $message = $lang['Fieldedited'] . '<br /><br />' . sprintf( $lang['Click_return'], '<a href="' . append_sid( 'admin_kb_custom.' . $phpEx ) . '">', '</a>' ) . '<br /><br />' . sprintf( $lang['Click_return_admin_index'], '<a href="' . append_sid( 'index.' . $phpEx . '?pane=right' ) . '">', '</a>' ); mx_message_die( GENERAL_MESSAGE, $message ); } elseif ( $mode == 'do_delete' ) { foreach( $field_ids as $key => $value ) { $kb_custom_field->delete_field( $key ); } $message = $lang['Fieldsdel'] . '<br /><br />' . sprintf( $lang['Click_return'], '<a href="' . append_sid( 'admin_kb_custom.' . $phpEx ) . '">', '</a>' ) . '<br /><br />' . sprintf( $lang['Click_return_admin_index'], '<a href="' . append_sid( 'index.' . $phpEx . '?pane=right' ) . '">', '</a>' ); mx_message_die( GENERAL_MESSAGE, $message ); } } $template->set_filenames( array( 'admin' => $template_file ) ); switch ( $mode ) { case 'add': case 'addfield': $l_title = $lang['Afieldtitle']; break; case 'edit': $l_title = $lang['Efieldtitle']; break; case 'editfield': $l_title = $lang['Efieldtitle']; break; case 'delete': $l_title = $lang['Dfieldtitle']; break; case 'select': $l_title = $lang['Mfieldtitle']; break; } if ( $mode == 'add' ) { $s_hidden_fields = '<input type="hidden" name="mode" value="addfield">'; } elseif ( $mode == 'addfield' || $mode == 'editfield') { $s_hidden_fields = '<input type="hidden" name="field_type" value="' . $field_type . '">'; $s_hidden_fields .= '<input type="hidden" name="field_id" value="' . $field_id . '">'; $s_hidden_fields .= '<input type="hidden" name="mode" value="do_add">'; } elseif ( $mode == 'edit' ) { $s_hidden_fields = '<input type="hidden" name="mode" value="editfield">'; } elseif ( $mode == 'delete' ) { $s_hidden_fields = '<input type="hidden" name="mode" value="do_delete">'; } $template->assign_vars( array( 'L_FIELD_TITLE' => $l_title, 'L_FIELD_EXPLAIN' => $lang['Fieldexplain'], 'L_SELECT_TITLE' => $lang['Fieldselecttitle'], 'S_HIDDEN_FIELDS' => $s_hidden_fields, 'S_FIELD_ACTION' => append_sid( "admin_kb_custom.$phpEx" ) ) ); if ( $mode == 'addfield' || $mode == 'editfield') { if ( $field_id ) { $data = $kb_custom_field->get_field_data( $field_id ); } $template->assign_vars( array( 'L_FIELD_NAME' => $lang['Fieldname'], 'L_FIELD_NAME_INFO' => $lang['Fieldnameinfo'], 'L_FIELD_DESC' => $lang['Fielddesc'], 'L_FIELD_DESC_INFO' => $lang['Fielddescinfo'], 'L_FIELD_DATA' => $lang['Field_data'], 'L_FIELD_DATA_INFO' => $lang['Field_data_info'], 'L_FIELD_REGEX' => $lang['Field_regex'], 'L_FIELD_REGEX_INFO' => sprintf( $lang['Field_regex_info'], '<a href="http://www.php.net/manual/en/function.preg-match.php" target="_blank">', '</a>' ), 'L_FIELD_ORDER' => $lang['Field_order'], 'DATA' => ( $field_type != INPUT && $field_type != TEXTAREA ) ? true : false, 'REGEX' => ( $field_type == INPUT || $field_type == TEXTAREA ) ? true : false, 'ORDER' => ( $field_id ) ? true : false, 'FIELD_NAME' => $data['custom_name'], 'FIELD_DESC' => $data['custom_description'], 'FIELD_DATA' => $data['data'], 'FIELD_REGEX' => $data['regex'], 'FIELD_ORDER' => $data['field_order'] ) ); } elseif ( $mode == 'add' ) { $field_types = array( INPUT => $lang['Field_Input'], TEXTAREA => $lang['Field_Textarea'], RADIO => $lang['Field_Radio'], SELECT => $lang['Field_Select'], SELECT_MULTIPLE => $lang['Field_Select_multiple'], CHECKBOX => $lang['Field_Checkbox'] ); $field_type_list = '<select name="field_type">'; foreach( $field_types as $key => $value ) { $field_type_list .= '<option value="' . $key . '">' . $value . '</option>'; } $field_type_list .= '</select>'; $template->assign_vars( array( 'S_SELECT_FIELD_TYPE' => $field_type_list ) ); } elseif ( $mode == 'edit' || $mode == 'delete' || $mode == 'select' ) { foreach( $kb_custom_field->field_rowset as $field_id => $field_data ) { $template->assign_block_vars( 'field_row', array( 'FIELD_ID' => $field_id, 'FIELD_NAME' => $field_data['custom_name'], 'FIELD_DESC' => $field_data['custom_description'] ) ); } } $template->pparse( 'admin' ); //$pafiledb->_pafiledb(); //$cache->unload(); /* Original include('./page_footer_admin.'.$phpEx); */ // MX Module include( $mx_root_path . 'admin/page_footer_admin.' . $phpEx ); ?> |