Update of /cvsroot/mxbb/mx_kb/kb/admin In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv26309/modules/mx_kb/kb/admin Added Files: admin_article_manage.php admin_auth_manage.php admin_cat_manage.php admin_custom_manage.php admin_settings.php admin_types_manage.php Log Message: making all admincp an object :-) --- NEW FILE: admin_cat_manage.php --- <?php /** * * @package mxBB Portal Module - mx_kb * @version $Id: admin_cat_manage.php,v 1.1 2006/07/08 10:21:36 jonohlsson Exp $ * @copyright (c) 2002-2006 [wGEric, Jon Ohlsson] mxBB Project Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ if ( !defined( 'IN_PORTAL' ) || !defined( 'IN_ADMIN' ) ) { die( "Hacking attempt" ); } class mx_kb_cat_manage extends mx_kb_admin { function main( $action ) { global $db, $images, $template, $lang, $phpEx, $mx_kb_functions, $mx_kb_cache, $kb_config, $phpbb_root_path, $module_root_path, $mx_root_path, $mx_request_vars; // // Includes // include_once( $phpbb_root_path . 'includes/functions_search.' . $phpEx ); $mode = $mx_request_vars->request('mode', MX_TYPE_NO_TAGS, ''); if ( empty($mode) ) { if ( $create ) { $mode = 'create'; } else if ( $edit ) { $mode = 'edit'; } else if ( $delete ) { $mode = 'delete'; } else { $mode = ''; } } $cat_auth_levels = array( 'ALL', 'REG', 'PRIVATE', 'MOD', 'ADMIN' ); $cat_auth_const = array( AUTH_ALL, AUTH_REG, AUTH_ACL, AUTH_MOD, AUTH_ADMIN ); $global_auth = array( 'auth_view', 'auth_post', 'auth_rate', 'auth_comment', 'auth_edit', 'auth_delete', 'auth_approval', 'auth_approval_edit' ); $auth_select = array(); switch ( $mode ) { case ( 'create' ): if ( !$_POST['submit'] ) { $new_cat_name = stripslashes( $_POST['new_cat_name'] ); // // Comments // $use_comments_yes = ""; $use_comments_no = ""; $use_comments_default = "checked=\"checked\""; $internal_comments_internal = ""; $internal_comments_phpbb = ""; $internal_comments_default = "checked=\"checked\""; $comments_forum_id = '-1'; $autogenerate_comments_yes = ""; $autogenerate_comments_no = ""; $autogenerate_comments_default = "checked=\"checked\""; // // Ratings // $use_ratings_yes = ""; $use_ratings_no = ""; $use_ratings_default = "checked=\"checked\""; // // Instructions // $pretext_show = ""; $pretext_hide = ""; $pretext_default = "checked=\"checked\""; // // Notification // $notify_none = ""; $notify_pm = ""; $notify_email = ""; $notify_default = "checked=\"checked\""; $notify_group_list = mx_get_groups('', 'notify_group'); // // Permissions // $cat_rowset['auth_view'] = 0; $cat_rowset['auth_post'] = 1; $cat_rowset['auth_rate'] = 1; $cat_rowset['auth_comment'] = 1; $cat_rowset['auth_edit'] = 1; $cat_rowset['auth_delete'] = 2; $cat_rowset['auth_approval'] = 5; $cat_rowset['auth_approval_edit'] = 5; foreach( $global_auth as $auth ) { $auth_select[$auth] = ' <select name="' . $auth . '">'; for( $k = 0; $k < count( $cat_auth_levels ); $k++ ) { $selected = ( $cat_rowset[$auth] == $cat_auth_const[$k] ) ? ' selected="selected"' : ''; $auth_select[$auth] .= '<option value="' . $cat_auth_const[$k] . '"' . $selected . '>' . $lang['Forum_' . $cat_auth_levels[$k]] . '</option>'; } $auth_select[$auth] .= '</select> '; } // // Generate page // $template->set_filenames( array( 'body' => 'admin/kb_cat_edit_body.tpl' ) ); $template->assign_block_vars( 'switch_cat', array() ); $template->assign_vars( array( 'S_ACTION' => append_sid( "admin_kb.$phpEx?action=cat_manage&mode=create" ), 'L_EDIT_TITLE' => $lang['Create_cat'], 'L_EDIT_DESCRIPTION' => $lang['Create_description'], 'L_CATEGORY' => $lang['Category'], 'L_DESCRIPTION' => $lang['Category_description'], 'L_NUMBER_ARTICLES' => $lang['Articles'], 'L_CAT_SETTINGS' => $lang['Cat_settings'], 'L_CREATE' => $lang['Create'], 'L_PARENT' => $lang['Parent'], 'L_NONE' => $lang['None'], 'PARENT_LIST' => $this->generate_jumpbox( '', 0, 0, 0, true ), 'CAT_NAME' => $new_cat_name, 'DESC' => '', 'NUMBER_ARTICLES' => '0', 'L_DEFAULT' => $lang['Use_default'], 'L_YES' => $lang['Yes'], 'L_NO' => $lang['No'], 'L_NONE' => $lang['Acc_None'], // // Comments // 'L_COMMENTS_TITLE' => $lang['Comments_title'], 'L_USE_COMMENTS' => $lang['Use_comments'], 'L_USE_COMMENTS_EXPLAIN' => $lang['Use_comments_explain'], 'S_USE_COMMENTS_YES' => $use_comments_yes, 'S_USE_COMMENTS_NO' => $use_comments_no, 'S_USE_COMMENTS_DEFAULT' => $use_comments_default, 'L_INTERNAL_COMMENTS' => $lang['Internal_comments'], 'L_INTERNAL_COMMENTS_EXPLAIN' => $lang['Internal_comments_explain'], 'S_INTERNAL_COMMENTS_INTERNAL' => $internal_comments_internal, 'S_INTERNAL_COMMENTS_PHPBB' => $internal_comments_phpbb, 'S_INTERNAL_COMMENTS_DEFAULT' => $internal_comments_default, 'L_INTERNAL_COMMENTS_INTERNAL' => $lang['Internal_comments_internal'], 'L_INTERNAL_COMMENTS_PHPBB' => $lang['Internal_comments_phpBB'], 'L_FORUM_ID' => $lang['Forum_id'], 'L_FORUM_ID_EXPLAIN' => $lang['Forum_id_explain'], 'FORUM_LIST' => $this->get_forums( $comments_forum_id, true, 'comments_forum_id' ), 'L_AUTOGENERATE_COMMENTS' => $lang['Autogenerate_comments'], 'L_AUTOGENERATE_COMMENTS_EXPLAIN' => $lang['Autogenerate_comments_explain'], 'S_AUTOGENERATE_COMMENTS_YES' => $autogenerate_comments_yes, 'S_AUTOGENERATE_COMMENTS_NO' => $autogenerate_comments_no, 'S_AUTOGENERATE_COMMENTS_DEFAULT' => $autogenerate_comments_default, // // Ratings // 'L_RATINGS_TITLE' => $lang['Ratings_title'], 'L_USE_RATINGS' => $lang['Use_ratings'], 'L_USE_RATINGS_EXPLAIN' => $lang['Use_ratings_explain'], 'S_USE_RATINGS_YES' => $use_ratings_yes, 'S_USE_RATINGS_NO' => $use_ratings_no, 'S_USE_RATINGS_DEFAULT' => $use_ratings_default, // // Instructions // 'L_INSTRUCTIONS_TITLE' => $lang['Instructions_title'], 'L_PRE_TEXT_NAME' => $lang['Pre_text_name'], 'L_PRE_TEXT_EXPLAIN' => $lang['Pre_text_explain'], 'S_SHOW_PRETEXT' => $pretext_show, 'S_HIDE_PRETEXT' => $pretext_hide, 'S_DEFAULT_PRETEXT' => $pretext_default, 'L_SHOW' => $lang['Show'], 'L_HIDE' => $lang['Hide'], // // Notifications // 'L_NOTIFICATIONS_TITLE' => $lang['Notifications_title'], 'L_NOTIFY' => $lang['Notify'], 'L_NOTIFY_EXPLAIN' => $lang['Notify_explain'], 'L_EMAIL' => $lang['Email'], 'L_PM' => $lang['PM'], 'S_NOTIFY_NONE' => $notify_none, 'S_NOTIFY_EMAIL' => $notify_email, 'S_NOTIFY_PM' => $notify_pm, 'S_NOTIFY_DEFAULT' => $notify_default, 'L_NOTIFY_GROUP' => $lang['Notify_group'], 'L_NOTIFY_GROUP_EXPLAIN' => $lang['Notify_group_explain'], 'NOTIFY_GROUP' => $notify_group_list, // // Category permissions // 'L_CAT_PERMISSIONS' => $lang['Category_Permissions'], 'L_VIEW_LEVEL' => $lang['View_level'], 'S_VIEW_LEVEL' => $auth_select['auth_view'], 'L_UPLOAD_LEVEL' => $lang['Upload_level'], 'S_UPLOAD_LEVEL' => $auth_select['auth_post'], 'L_RATE_LEVEL' => $lang['Rate_level'], 'S_RATE_LEVEL' => $auth_select['auth_rate'], 'L_COMMENT_LEVEL' => $lang['Comment_level'], 'S_COMMENT_LEVEL' => $auth_select['auth_comment'], 'L_EDIT_LEVEL' => $lang['Edit_level'], 'S_EDIT_LEVEL' => $auth_select['auth_edit'], 'L_DELETE_LEVEL' => $lang['Delete_level'], 'S_DELETE_LEVEL' => $auth_select['auth_delete'], 'L_APPROVAL_LEVEL' => $lang['Approval_level'], 'S_APPROVAL_LEVEL' => $auth_select['auth_approval'], 'L_APPROVAL_EDIT_LEVEL' => $lang['Approval_edit_level'], 'S_APPROVAL_EDIT_LEVEL' => $auth_select['auth_approval_edit'], 'L_DISABLED' => $lang['Disabled'], )); } else if ( $_POST['submit'] ) { $cat_name = trim( $_POST['catname'] ); if ( !$cat_name ) { echo "Please put a category name in!"; } $cat_desc = $_POST['catdesc']; $parent = intval( $_POST['parent'] ); $cat_use_comments = ( isset( $_POST['cat_allow_comments'] ) ) ? intval( $_POST['cat_allow_comments'] ) : 0; $cat_internal_comments = ( isset( $_POST['internal_comments'] ) ) ? intval( $_POST['internal_comments'] ) : 0; $cat_autogenerate_comments = ( isset( $_POST['autogenerate_comments'] ) ) ? intval( $_POST['autogenerate_comments'] ) : 0; $comments_forum_id = intval( $_POST['comments_forum_id'] ); $cat_show_pretext = ( isset( $_POST['show_pretext'] ) ) ? intval( $_POST['show_pretext'] ) : 0; $cat_use_ratings = ( isset( $_POST['cat_allow_ratings'] ) ) ? intval( $_POST['cat_allow_ratings'] ) : 0; $cat_notify = ( isset( $_POST['notify'] ) ) ? intval( $_POST['notify'] ) : 0; $cat_notify_group = ( isset( $_POST['notify_group'] ) ) ? intval( $_POST['notify_group'] ) : 0; if ( $comments_forum_id == 0 ) { mx_message_die(GENERAL_MESSAGE , 'Select a Forum'); } $view_level = intval( $_POST['auth_view'] ); $post_level = intval( $_POST['auth_post'] ); $rate_level = intval( $_POST['auth_rate'] ); $comment_level = intval( $_POST['auth_comment'] ); $edit_level = intval( $_POST['auth_edit'] ); $delete_level = intval( $_POST['auth_delete'] ); $approval_level = intval( $_POST['auth_approval'] ); $approval_edit_level = intval( $_POST['auth_approval_edit'] ); $sql = "SELECT MAX(cat_order) AS cat_order FROM " . KB_CATEGORIES_TABLE . " WHERE parent = $parent"; if ( !( $result = $db->sql_query( $sql ) ) ) { mx_message_die( GENERAL_ERROR, 'Could not obtain next type id', '', __LINE__, __FILE__, $sql ); } if ( !( $id = $db->sql_fetchrow( $result ) ) ) { mx_message_die( GENERAL_ERROR, 'Could not obtain next type id', '', __LINE__, __FILE__, $sql ); } $cat_order = $id['cat_order'] + 10; $sql = "INSERT INTO " . KB_CATEGORIES_TABLE . " ( category_name, category_details, number_articles, parent, cat_order, auth_view, auth_post, auth_rate, auth_comment, auth_edit, auth_delete, auth_approval, auth_approval_edit, cat_allow_comments, internal_comments, autogenerate_comments, comments_forum_id, cat_allow_ratings, show_pretext, notify, notify_group )" . " VALUES ( '$cat_name', ' $cat_desc', '0', '$parent', '$cat_order', '$view_level', '$post_level', '$rate_level', '$comment_level', '$edit_level', '$delete_level', '$approval_level', '$approval_edit_level', '$cat_use_comments', '$cat_internal_comments', '$cat_autogenerate_comments', '$comments_forum_id', '$cat_use_ratings', '$cat_show_pretext', '$cat_notify', '$cat_notify_group')"; if ( !( $results = $db->sql_query( $sql ) ) ) { mx_message_die( GENERAL_ERROR, "Could not create category", '', __LINE__, __FILE__, $sql ); } $message = $lang['Cat_created'] . '<br /><br />' . sprintf( $lang['Click_return_cat_manager'], '<a href="' . append_sid( "admin_kb.$phpEx?action=cat_manage" ) . '">', '</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 ); } break; case ( 'edit' ): if ( !$_POST['submit'] ) { $cat_id = intval( $_GET['cat'] ); $cat_name = $this->cat_rowset[$cat_id]['category_name']; $cat_desc = $this->cat_rowset[$cat_id]['category_details']; $number_articles = $this->article_in_cat($cat_id); $parent = $this->cat_rowset[$cat_id]['parent']; // // Comments // $use_comments_yes = ( $this->cat_rowset[$cat_id]['cat_allow_comments'] == 1 ) ? "checked=\"checked\"" : ""; $use_comments_no = ( $this->cat_rowset[$cat_id]['cat_allow_comments'] == 0 ) ? "checked=\"checked\"" : ""; $use_comments_default = ( $this->cat_rowset[$cat_id]['cat_allow_comments'] == -1 ) ? "checked=\"checked\"" : ""; $internal_comments_internal = ( $this->cat_rowset[$cat_id]['internal_comments'] == 1 ) ? "checked=\"checked\"" : ""; $internal_comments_phpbb = ( $this->cat_rowset[$cat_id]['internal_comments'] == 0 ) ? "checked=\"checked\"" : ""; $internal_comments_default = ( $this->cat_rowset[$cat_id]['internal_comments'] == -1 ) ? "checked=\"checked\"" : ""; $comments_forum_id = $this->cat_rowset[$cat_id]['comments_forum_id']; $autogenerate_comments_yes = ( $this->cat_rowset[$cat_id]['autogenerate_comments'] == 1 ) ? "checked=\"checked\"" : ""; $autogenerate_comments_no = ( $this->cat_rowset[$cat_id]['autogenerate_comments'] == 0) ? "checked=\"checked\"" : ""; $autogenerate_comments_default = ( $this->cat_rowset[$cat_id]['autogenerate_comments'] == -1 ) ? "checked=\"checked\"" : ""; // // Ratings // $use_ratings_yes = ( $this->cat_rowset[$cat_id]['cat_allow_ratings'] == 1) ? "checked=\"checked\"" : ""; $use_ratings_no = ( $this->cat_rowset[$cat_id]['cat_allow_ratings'] == 0) ? "checked=\"checked\"" : ""; $use_ratings_default = ( $this->cat_rowset[$cat_id]['cat_allow_ratings'] == -1 ) ? "checked=\"checked\"" : ""; // // Instructions // $pretext_show = ( $this->cat_rowset[$cat_id]['show_pretext'] == 1) ? "checked=\"checked\"" : ""; $pretext_hide = ( $this->cat_rowset[$cat_id]['show_pretext'] == 0) ? "checked=\"checked\"" : ""; $pretext_default = ( $this->cat_rowset[$cat_id]['show_pretext'] == -1 ) ? "checked=\"checked\"" : ""; // // Notification // $notify_none = ( $this->cat_rowset[$cat_id]['notify'] == 0 ) ? "checked=\"checked\"" : ""; $notify_pm = ( $this->cat_rowset[$cat_id]['notify'] == 1 ) ? "checked=\"checked\"" : ""; $notify_email = ( $this->cat_rowset[$cat_id]['notify'] == 2 ) ? "checked=\"checked\"" : ""; $notify_default = ( $this->cat_rowset[$cat_id]['notify'] == -1 ) ? "checked=\"checked\"" : ""; $notify_group_list = mx_get_groups($this->cat_rowset[$cat_id]['notify_group'], 'notify_group'); // // Permissions // foreach( $global_auth as $auth ) { $auth_select[$auth] = ' <select name="' . $auth . '">'; for( $k = 0; $k < count( $cat_auth_levels ); $k++ ) { $selected = ( $this->cat_rowset[$cat_id][$auth] == $cat_auth_const[$k] ) ? ' selected="selected"' : ''; $auth_select[$auth] .= '<option value="' . $cat_auth_const[$k] . '"' . $selected . '>' . $lang['Forum_' . $cat_auth_levels[$k]] . '</option>'; } $auth_select[$auth] .= '</select> '; } // // Generate page // $template->set_filenames( array( 'body' => 'admin/kb_cat_edit_body.tpl' ) ); $template->assign_block_vars( 'switch_cat', array() ); $template->assign_block_vars( 'switch_cat.switch_edit_category', array() ); $template->assign_vars( array( 'L_EDIT_TITLE' => $lang['Edit_cat'], 'L_EDIT_DESCRIPTION' => $lang['Edit_description'], 'L_CATEGORY' => $lang['Category'], 'L_DESCRIPTION' => $lang['Category_desc'], 'L_NUMBER_ARTICLES' => $lang['Articles'], 'L_CAT_SETTINGS' => $lang['Cat_settings'], 'L_CREATE' => $lang['Edit'], 'L_PARENT' => $lang['Parent'], 'L_NONE' => $lang['None'], 'PARENT_LIST' => $this->generate_jumpbox( '', $cat_id, $parent, true, true ), 'S_ACTION' => append_sid( "admin_kb.$phpEx?action=cat_manage&mode=edit" ), 'CAT_NAME' => $cat_name, 'CAT_DESCRIPTION' => $cat_desc, 'NUMBER_ARTICLES' => $number_articles, 'L_DEFAULT' => $lang['Use_default'], 'L_YES' => $lang['Yes'], 'L_NO' => $lang['No'], 'L_NONE' => $lang['Acc_None'], // // Comments // 'L_COMMENTS_TITLE' => $lang['Comments_title'], 'L_USE_COMMENTS' => $lang['Use_comments'], 'L_USE_COMMENTS_EXPLAIN' => $lang['Use_comments_explain'], 'S_USE_COMMENTS_YES' => $use_comments_yes, 'S_USE_COMMENTS_NO' => $use_comments_no, 'S_USE_COMMENTS_DEFAULT' => $use_comments_default, 'L_INTERNAL_COMMENTS' => $lang['Internal_comments'], 'L_INTERNAL_COMMENTS_EXPLAIN' => $lang['Internal_comments_explain'], 'S_INTERNAL_COMMENTS_INTERNAL' => $internal_comments_internal, 'S_INTERNAL_COMMENTS_PHPBB' => $internal_comments_phpbb, 'S_INTERNAL_COMMENTS_DEFAULT' => $internal_comments_default, 'L_INTERNAL_COMMENTS_INTERNAL' => $lang['Internal_comments_internal'], 'L_INTERNAL_COMMENTS_PHPBB' => $lang['Internal_comments_phpBB'], 'L_FORUM_ID' => $lang['Forum_id'], 'L_FORUM_ID_EXPLAIN' => $lang['Forum_id_explain'], 'FORUM_LIST' => $this->get_forums( $comments_forum_id, true, 'comments_forum_id' ), 'L_AUTOGENERATE_COMMENTS' => $lang['Autogenerate_comments'], 'L_AUTOGENERATE_COMMENTS_EXPLAIN' => $lang['Autogenerate_comments_explain'], 'S_AUTOGENERATE_COMMENTS_YES' => $autogenerate_comments_yes, 'S_AUTOGENERATE_COMMENTS_NO' => $autogenerate_comments_no, 'S_AUTOGENERATE_COMMENTS_DEFAULT' => $autogenerate_comments_default, // // Ratings // 'L_RATINGS_TITLE' => $lang['Ratings_title'], 'L_USE_RATINGS' => $lang['Use_ratings'], 'L_USE_RATINGS_EXPLAIN' => $lang['Use_ratings_explain'], 'S_USE_RATINGS_YES' => $use_ratings_yes, 'S_USE_RATINGS_NO' => $use_ratings_no, 'S_USE_RATINGS_DEFAULT' => $use_ratings_default, // // Instructions // 'L_INSTRUCTIONS_TITLE' => $lang['Instructions_title'], 'L_PRE_TEXT_NAME' => $lang['Pre_text_name'], 'L_PRE_TEXT_EXPLAIN' => $lang['Pre_text_explain'], 'S_SHOW_PRETEXT' => $pretext_show, 'S_HIDE_PRETEXT' => $pretext_hide, 'S_DEFAULT_PRETEXT' => $pretext_default, 'L_SHOW' => $lang['Show'], 'L_HIDE' => $lang['Hide'], // // Notifications // 'L_NOTIFICATIONS_TITLE' => $lang['Notifications_title'], 'L_NOTIFY' => $lang['Notify'], 'L_NOTIFY_EXPLAIN' => $lang['Notify_explain'], 'L_EMAIL' => $lang['Email'], 'L_PM' => $lang['PM'], 'S_NOTIFY_NONE' => $notify_none, 'S_NOTIFY_EMAIL' => $notify_email, 'S_NOTIFY_PM' => $notify_pm, 'S_NOTIFY_DEFAULT' => $notify_default, 'L_NOTIFY_GROUP' => $lang['Notify_group'], 'L_NOTIFY_GROUP_EXPLAIN' => $lang['Notify_group_explain'], 'NOTIFY_GROUP' => $notify_group_list, // // Cat permissions // 'L_CAT_PERMISSIONS' => $lang['Category_Permissions'], 'L_VIEW_LEVEL' => $lang['View_level'], 'S_VIEW_LEVEL' => $auth_select['auth_view'], 'L_UPLOAD_LEVEL' => $lang['Upload_level'], 'S_UPLOAD_LEVEL' => $auth_select['auth_post'], 'L_RATE_LEVEL' => $lang['Rate_level'], 'S_RATE_LEVEL' => $auth_select['auth_rate'], 'L_COMMENT_LEVEL' => $lang['Comment_level'], 'S_COMMENT_LEVEL' => $auth_select['auth_comment'], 'L_EDIT_LEVEL' => $lang['Edit_level'], 'S_EDIT_LEVEL' => $auth_select['auth_edit'], 'L_DELETE_LEVEL' => $lang['Delete_level'], 'S_DELETE_LEVEL' => $auth_select['auth_delete'], 'L_APPROVAL_LEVEL' => $lang['Approval_level'], 'S_APPROVAL_LEVEL' => $auth_select['auth_approval'], 'L_APPROVAL_EDIT_LEVEL' => $lang['Approval_edit_level'], 'S_APPROVAL_EDIT_LEVEL' => $auth_select['auth_approval_edit'], 'L_DISABLED' => $lang['Disabled'], 'S_HIDDEN' => '<input type="hidden" name="catid" value="' . $cat_id . '">' ) ); } else if ( $_POST['submit'] ) { $cat_id = intval( $_POST['catid'] ); $cat_name = trim( $_POST['catname'] ); $cat_desc = $_POST['catdesc']; $number_articles = intval( $_POST['number_articles'] ); $parent = intval( $_POST['parent'] ); $cat_use_comments = ( isset( $_POST['cat_allow_comments'] ) ) ? intval( $_POST['cat_allow_comments'] ) : 0; $cat_internal_comments = ( isset( $_POST['internal_comments'] ) ) ? intval( $_POST['internal_comments'] ) : 0; $cat_autogenerate_comments = ( isset( $_POST['autogenerate_comments'] ) ) ? intval( $_POST['autogenerate_comments'] ) : 0; $comments_forum_id = intval( $_POST['comments_forum_id'] ); $cat_show_pretext = ( isset( $_POST['show_pretext'] ) ) ? intval( $_POST['show_pretext'] ) : 0; $cat_use_ratings = ( isset( $_POST['cat_allow_ratings'] ) ) ? intval( $_POST['cat_allow_ratings'] ) : 0; $cat_notify = ( isset( $_POST['notify'] ) ) ? intval( $_POST['notify'] ) : 0; $cat_notify_group = ( isset( $_POST['notify_group'] ) ) ? intval( $_POST['notify_group'] ) : 0; $view_level = intval( $_POST['auth_view'] ); $post_level = intval( $_POST['auth_post'] ); $rate_level = intval( $_POST['auth_rate'] ); $comment_level = intval( $_POST['auth_comment'] ); $edit_level = intval( $_POST['auth_edit'] ); $delete_level = intval( $_POST['auth_delete'] ); $approval_level = intval( $_POST['auth_approval'] ); $approval_edit_level = intval( $_POST['auth_approval_edit'] ); if ( !$cat_name ) { echo "Please put a category name in!"; } $sql = "UPDATE " . KB_CATEGORIES_TABLE . " SET category_name = '" . $cat_name . "', category_details = '" . $cat_desc . "', number_articles = '" . $number_articles . "', parent = '" . $parent . "', auth_view = '" . $view_level . "', auth_post = '" . $post_level . "', auth_rate = '" . $rate_level . "', auth_comment = '" . $comment_level . "', auth_edit = '" . $edit_level . "', auth_delete = '" . $delete_level . "', auth_approval = '" . $approval_level . "', auth_approval_edit = '" . $approval_edit_level . "', cat_allow_comments = '" . $cat_use_comments . "', internal_comments = '" . $cat_internal_comments . "', autogenerate_comments = '" . $cat_autogenerate_comments . "', cat_allow_ratings = '" . $cat_use_ratings . "', notify = '" . $cat_notify . "', notify_group = '" . $cat_notify_group . "', show_pretext = '" . $cat_show_pretext . "', comments_forum_id = '" . $comments_forum_id . "' WHERE category_id = " . $cat_id; if ( !( $results = $db->sql_query( $sql ) ) ) { mx_message_die( GENERAL_ERROR, "Could not update category", '', __LINE__, __FILE__, $sql ); } $message = $lang['Cat_edited'] . '<br /><br />' . sprintf( $lang['Click_return_cat_manager'], '<a href="' . append_sid( "admin_kb.$phpEx?action=cat_manage" ) . '">', '</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 ); } break; case ( 'delete' ): if ( !$_POST['submit'] ) { $cat_id = $_GET['cat']; $sql = "SELECT * FROM " . KB_CATEGORIES_TABLE . " WHERE category_id = '" . $cat_id . "'"; if ( !( $cat_result = $db->sql_query( $sql ) ) ) { mx_message_die( GENERAL_ERROR, "Could not obtain category information", '', __LINE__, __FILE__, $sql ); } if ( $category = $db->sql_fetchrow( $cat_result ) ) { $cat_name = $category['category_name']; } // // Generate page // $template->set_filenames( array( 'body' => 'admin/kb_cat_del_body.tpl' ) ); $template->assign_vars( array( 'L_DELETE_TITLE' => $lang['Cat_delete_title'], 'L_DELETE_DESCRIPTION' => $lang['Cat_delete_desc'], 'L_CAT_DELETE' => $lang['Cat_delete_title'], 'L_DELETE_ARTICLES' => $lang['Delete_all_articles'], 'L_CAT_NAME' => $lang['Article_category'], 'L_MOVE_CONTENTS' => $lang['Move_contents'], 'L_DELETE' => $lang['Move_and_Delete'], 'S_HIDDEN_FIELDS' => '<input type="hidden" name="catid" value="' . $cat_id . '">', 'S_SELECT_TO' => $this->generate_jumpbox( '', $cat_id, 0, true, true ), 'S_ACTION' => append_sid( "admin_kb.$phpEx?action=cat_manage&mode=delete" ), 'CAT_NAME' => $cat_name ) ); } else if ( $_POST['submit'] ) { $new_category = $_POST['move_id']; $old_category = $_POST['catid']; if ( $new_category != '0' ) { $sql = "UPDATE " . KB_ARTICLES_TABLE . " SET article_category_id = '$new_category' WHERE article_category_id = '$old_category'"; if ( !( $move_result = $db->sql_query( $sql ) ) ) { mx_message_die( GENERAL_ERROR, "Could not move articles", '', __LINE__, __FILE__, $sql ); } $sql = "SELECT * FROM " . KB_CATEGORIES_TABLE . " WHERE category_id = '$new_category'"; if ( !( $cat_result = $db->sql_query( $sql ) ) ) { mx_message_die( GENERAL_ERROR, "Could not get category data", '', __LINE__, __FILE__, $sql ); } if ( $new_cat = $db->sql_fetchrow( $cat_result ) ) { $new_articles = $new_cat['number_articles']; } $sql = "SELECT * FROM " . KB_CATEGORIES_TABLE . " WHERE category_id = '$old_category'"; if ( !( $oldcat_result = $db->sql_query( $sql ) ) ) { mx_message_die( GENERAL_ERROR, "Could not get category data", '', __LINE__, __FILE__, $sql ); } if ( $old_cat = $db->sql_fetchrow( $oldcat_result ) ) { $old_articles = $old_cat['number_articles']; } $number_articles = $new_articles + $old_articles; $sql = "UPDATE " . KB_CATEGORIES_TABLE . " SET number_articles = '" . $number_articles . "' WHERE category_id = " . $new_category; if ( !( $number_result = $db->sql_query( $sql ) ) ) { mx_message_die( GENERAL_ERROR, "Could not update articles number", '', __LINE__, __FILE__, $sql ); } } else { $sql = "DELETE FROM " . KB_ARTICLES_TABLE . " WHERE article_category_id = " . $old_category; if ( !( $delete__articles = $db->sql_query( $sql ) ) ) { mx_message_die( GENERAL_ERROR, "Could not delete articles", '', __LINE__, __FILE__, $sql ); } } $sql = "DELETE FROM " . KB_CATEGORIES_TABLE . " WHERE category_id = $old_category"; if ( !( $delete_result = $db->sql_query( $sql ) ) ) { mx_message_die( GENERAL_ERROR, "Could not delete category", '', __LINE__, __FILE__, $sql ); } $message = $lang['Cat_deleted'] . '<br /><br />' . sprintf( $lang['Click_return_cat_manager'], '<a href="' . append_sid( "admin_kb.$phpEx?action=cat_manage" ) . '">', '</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 ); } break; default: if ( $mode == "up" ) { $cat_id = $_GET['cat']; $sql = "SELECT * FROM " . KB_CATEGORIES_TABLE . " WHERE category_id = $cat_id"; if ( !( $result = $db->sql_query( $sql ) ) ) { mx_message_die( GENERAL_ERROR, "Could not get category data", '', __LINE__, __FILE__, $sql ); } if ( $category = $db->sql_fetchrow( $result ) ) { $parent = $category['parent']; $old_pos = $category['cat_order']; $new_pos = $old_pos-10; } $sql = "UPDATE " . KB_CATEGORIES_TABLE . " SET cat_order = '" . $old_pos . "' WHERE parent = " . $parent . " AND cat_order = " . $new_pos; if ( !( $result = $db->sql_query( $sql ) ) ) { mx_message_die( GENERAL_ERROR, "Could not update order", '', __LINE__, __FILE__, $sql ); } $sql = "UPDATE " . KB_CATEGORIES_TABLE . " SET cat_order = '" . $new_pos . "' WHERE category_id = " . $cat_id; if ( !( $result = $db->sql_query( $sql ) ) ) { mx_message_die( GENERAL_ERROR, "Could not update order", '', __LINE__, __FILE__, $sql ); } } if ( $mode == "down" ) { $cat_id = $_GET['cat']; $sql = "SELECT * FROM " . KB_CATEGORIES_TABLE . " WHERE category_id = $cat_id"; if ( !( $result = $db->sql_query( $sql ) ) ) { mx_message_die( GENERAL_ERROR, "Could not get category data", '', __LINE__, __FILE__, $sql ); } if ( $category = $db->sql_fetchrow( $result ) ) { $parent = $category['parent']; $old_pos = $category['cat_order']; $new_pos = $old_pos + 10; } $sql = "UPDATE " . KB_CATEGORIES_TABLE . " SET cat_order = '" . $old_pos . "' WHERE parent = " . $parent . " AND cat_order = " . $new_pos; if ( !( $result = $db->sql_query( $sql ) ) ) { mx_message_die( GENERAL_ERROR, "Could not update order", '', __LINE__, __FILE__, $sql ); } $sql = "UPDATE " . KB_CATEGORIES_TABLE . " SET cat_order = '" . $new_pos . "' WHERE category_id = " . $cat_id; if ( !( $result = $db->sql_query( $sql ) ) ) { mx_message_die( GENERAL_ERROR, "Could not update order", '', __LINE__, __FILE__, $sql ); } } // Generate page $template->set_filenames( array( 'body' => 'admin/kb_cat_admin_body.tpl' ) ); $template->assign_vars( array( 'L_CAT_TITLE' => $lang['Panel_cat_title'], 'L_CAT_EXPLAIN' => $lang['Panel_cat_explain'], 'L_CREATE_CAT' => $lang['Create_cat'], 'L_CREATE' => $lang['Create'], 'L_CATEGORY' => $lang['Article_category'], 'L_ACTION' => $lang['Art_action'], 'L_ARTICLES' => $lang['Articles'], 'L_ORDER' => $lang['Update_order'], 'S_ACTION' => append_sid( "admin_kb.$phpEx?action=cat_manage&mode=create" ) ) ); $this->admin_cat_main( 0 ); break; } $template->pparse( 'body' ); } } ?> --- NEW FILE: admin_settings.php --- <?php /** * * @package mxBB Portal Module - mx_kb * @version $Id: admin_settings.php,v 1.1 2006/07/08 10:21:36 jonohlsson Exp $ * @copyright (c) 2002-2006 [wGEric, Jon Ohlsson] mxBB Project Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ if ( !defined( 'IN_PORTAL' ) || !defined( 'IN_ADMIN' ) ) { die( "Hacking attempt" ); } class mx_kb_settings extends mx_kb_admin { function main( $action ) { global $db, $images, $template, $lang, $phpEx, $mx_kb_functions, $mx_kb_cache, $kb_config, $phpbb_root_path, $module_root_path, $mx_root_path, $mx_request_vars; // // Includes // include_once( $phpbb_root_path . 'includes/functions_search.' . $phpEx ); // // Pull all config data // $sql = "SELECT * FROM " . KB_CONFIG_TABLE; if ( !$result = $db->sql_query( $sql ) ) { mx_message_die( CRITICAL_ERROR, "Could not query knowledge base configuration information", "", __LINE__, __FILE__, $sql ); } else { while ( $row = $db->sql_fetchrow( $result ) ) { $config_name = $row['config_name']; $config_value = $row['config_value']; $kb_config[$config_name] = $config_value; $new[$config_name] = ( isset( $_POST[$config_name] ) ) ? $_POST[$config_name] : $kb_config[$config_name]; if ( isset( $_POST['submit'] ) ) { $mx_kb_functions->set_config( $config_name, $new[$config_name] ); } } if ( isset( $_POST['submit'] ) ) { $mx_kb_cache->unload(); $message = $lang['KB_config_updated'] . "<br /><br />" . sprintf( $lang['Click_return_kb_config'], "<a href=\"" . append_sid( "admin_kb.$phpEx?action=settings&mode=config" ) . "\">", "</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 ); } } $template->set_filenames( array( "body" => "admin/kb_config_body.tpl" ) ); // // General Settings // $module_name = $new['module_name']; $enable_module_yes = ( $new['enable_module'] ) ? "checked=\"checked\"" : ""; $enable_module_no = ( !$new['enable_module'] ) ? "checked=\"checked\"" : ""; $wysiwyg_path = $new['wysiwyg_path']; // // Article // $allow_wysiwyg_yes = ( $new['allow_wysiwyg'] ) ? "checked=\"checked\"" : ""; $allow_wysiwyg_no = ( !$new['allow_wysiwyg'] ) ? "checked=\"checked\"" : ""; $allow_html_yes = ( $new['allow_html'] ) ? "checked=\"checked\"" : ""; $allow_html_no = ( !$new['allow_html'] ) ? "checked=\"checked\"" : ""; $allowed_html_tags = $new['allowed_html_tags']; $allow_bbcode_yes = ( $new['allow_bbcode'] ) ? "checked=\"checked\"" : ""; $allow_bbcode_no = ( !$new['allow_bbcode'] ) ? "checked=\"checked\"" : ""; $allow_smilies_yes = ( $new['allow_smilies'] ) ? "checked=\"checked\"" : ""; $allow_smilies_no = ( !$new['allow_smilies'] ) ? "checked=\"checked\"" : ""; $allow_images_yes = ( $new['allow_images'] ) ? "checked=\"checked\"" : ""; $allow_images_no = ( !$new['allow_images'] ) ? "checked=\"checked\"" : ""; $allow_links_yes = ( $new['allow_links'] ) ? "checked=\"checked\"" : ""; $allow_links_no = ( !$new['allow_links'] ) ? "checked=\"checked\"" : ""; $no_image_message = $new['no_image_message']; $no_link_message = $new['no_link_message']; $max_chars = $new['max_chars']; $max_subject_chars = $new['max_subject_chars']; $max_desc_chars = $new['max_desc_chars']; $format_truncate_links_yes = ( $new['formatting_truncate_links'] ) ? "checked=\"checked\"" : ""; $format_truncate_links_no = ( !$new['formatting_truncate_links'] ) ? "checked=\"checked\"" : ""; $format_image_resize = $new['formatting_image_resize']; $format_wordwrap_yes = ( $new['formatting_wordwrap'] ) ? "checked=\"checked\"" : ""; $format_wordwrap_no = ( !$new['formatting_wordwrap'] ) ? "checked=\"checked\"" : ""; // // Appearance // $pagination = $new['pagination']; $sort_method_options = array(); $sort_method_options = array( "Latest", "Creation", "Id", "Userrank", "Alphabetic" ); $sort_method_list = '<select name="sort_method">'; for( $j = 0; $j < count( $sort_method_options ); $j++ ) { if ( $new['sort_method'] == $sort_method_options[$j] ) { $status = "selected"; } else { $status = ''; } $sort_method_list .= '<option value="' . $sort_method_options[$j] . '" ' . $status . '>' . $sort_method_options[$j] . '</option>'; } $sort_method_list .= '</select>'; $sort_order_options = array(); $sort_order_options = array( "DESC", "ASC" ); $sort_order_list = '<select name="sort_order">'; for( $j = 0; $j < count( $sort_order_options ); $j++ ) { if ( $new['sort_order'] == $sort_order_options[$j] ) { $status = "selected"; } else { $status = ''; } $sort_order_list .= '<option value="' . $sort_order_options[$j] . '" ' . $status . '>' . $sort_order_options[$j] . '</option>'; } $sort_order_list .= '</select>'; $header_banner_yes = ( $new['header_banner'] ) ? "checked=\"checked\"" : ""; $header_banner_no = ( !$new['header_banner'] ) ? "checked=\"checked\"" : ""; $stats_list_yes = ( $new['stats_list'] ) ? "checked=\"checked\"" : ""; $stats_list_no = ( !$new['stats_list'] ) ? "checked=\"checked\"" : ""; $settings_newdays = $new['settings_newdays']; $cat_col = $new['cat_col']; // // Instructions // $pretext_show = ( $new['show_pretext'] ) ? "checked=\"checked\"" : ""; $pretext_hide = ( !$new['show_pretext'] ) ? "checked=\"checked\"" : ""; $pt_header = $new['pt_header']; $pt_body = $new['pt_body']; // // Comments (default settings) // $use_comments_yes = ( $new['use_comments'] ) ? "checked=\"checked\"" : ""; $use_comments_no = ( !$new['use_comments'] ) ? "checked=\"checked\"" : ""; $internal_comments_internal = ( $new['internal_comments'] ) ? "checked=\"checked\"" : ""; $internal_comments_phpbb = ( !$new['internal_comments'] ) ? "checked=\"checked\"" : ""; $comments_forum_id = $new['comments_forum_id']; $del_topic_yes = ( $new['del_topic'] ) ? "checked=\"checked\"" : ""; $del_topic_no = ( !$new['del_topic'] ) ? "checked=\"checked\"" : ""; $autogenerate_comments_yes = ( $new['autogenerate_comments'] ) ? "checked=\"checked\"" : ""; $autogenerate_comments_no = ( !$new['autogenerate_comments'] ) ? "checked=\"checked\"" : ""; $allow_comment_wysiwyg_yes = ( $new['allow_comment_wysiwyg'] ) ? "checked=\"checked\"" : ""; $allow_comment_wysiwyg_no = ( !$new['allow_comment_wysiwyg'] ) ? "checked=\"checked\"" : ""; $allow_comment_html_yes = ( $new['allow_comment_html'] ) ? "checked=\"checked\"" : ""; $allow_comment_html_no = ( !$new['allow_comment_html'] ) ? "checked=\"checked\"" : ""; $allowed_comment_html_tags = $new['allowed_comment_html_tags']; $allow_comment_bbcode_yes = ( $new['allow_comment_bbcode'] ) ? "checked=\"checked\"" : ""; $allow_comment_bbcode_no = ( !$new['allow_comment_bbcode'] ) ? "checked=\"checked\"" : ""; $allow_comment_smilies_yes = ( $new['allow_comment_smilies'] ) ? "checked=\"checked\"" : ""; $allow_comment_smilies_no = ( !$new['allow_comment_smilies'] ) ? "checked=\"checked\"" : ""; $allow_comment_links_yes = ( $new['allow_comment_links'] ) ? "checked=\"checked\"" : ""; $allow_comment_links_no = ( !$new['allow_comment_links'] ) ? "checked=\"checked\"" : ""; $allow_comment_images_yes = ( $new['allow_comment_images'] ) ? "checked=\"checked\"" : ""; $allow_comment_images_no = ( !$new['allow_comment_images'] ) ? "checked=\"checked\"" : ""; $no_comment_link_message = $new['no_comment_link_message']; $no_comment_image_message = $new['no_comment_image_message']; $max_comment_chars = $new['max_comment_chars']; $max_comment_subject_chars = $new['max_comment_subject_chars']; $format_comment_truncate_links_yes = ( $new['formatting_comment_truncate_links'] ) ? "checked=\"checked\"" : ""; $format_comment_truncate_links_no = ( !$new['formatting_comment_truncate_links'] ) ? "checked=\"checked\"" : ""; $format_comment_image_resize = $new['formatting_comment_image_resize']; $format_comment_wordwrap_yes = ( $new['formatting_comment_wordwrap'] ) ? "checked=\"checked\"" : ""; $format_comment_wordwrap_no = ( !$new['formatting_comment_wordwrap'] ) ? "checked=\"checked\"" : ""; $comments_pag = $new['comments_pagination']; // // Ratings (default settings) // $use_ratings_yes = ( $new['use_ratings'] ) ? "checked=\"checked\"" : ""; $use_ratings_no = ( !$new['use_ratings'] ) ? "checked=\"checked\"" : ""; $votes_check_ip_yes = ( $new['votes_check_ip'] ) ? "checked=\"checked\"" : ""; $votes_check_ip_no = ( !$new['votes_check_ip'] ) ? "checked=\"checked\"" : ""; $votes_check_userid_yes = ( $new['votes_check_userid'] ) ? "checked=\"checked\"" : ""; $votes_check_userid_no = ( !$new['votes_check_userid'] ) ? "checked=\"checked\"" : ""; // // Notifications // $notify_none = ( $new['notify'] == 0 ) ? "checked=\"checked\"" : ""; $notify_pm = ( $new['notify'] == 1 ) ? "checked=\"checked\"" : ""; $notify_email = ( $new['notify'] == 2 ) ? "checked=\"checked\"" : ""; $notify_group_list = mx_get_groups($new['notify_group'], 'notify_group'); $template->assign_vars( array( 'S_ACTION' => append_sid( "admin_kb.$phpEx?action=settings&mode=config" ), 'L_CONFIGURATION_TITLE' => $lang['Panel_config_title'], 'L_CONFIGURATION_EXPLAIN' => $lang['Panel_config_explain'], 'L_SUBMIT' => $lang['Submit'], 'L_RESET' => $lang['Reset'], 'L_YES' => $lang['Yes'], 'L_NO' => $lang['No'], 'L_NONE' => $lang['Acc_None'], // // General // 'L_GENERAL_TITLE' => $lang['General_title'], 'L_MODULE_NAME' => $lang['Module_name'], 'L_MODULE_NAME_EXPLAIN' => $lang['Module_name_explain'], 'MODULE_NAME' => $module_name, 'L_ENABLE_MODULE' => $lang['Enable_module'], 'L_ENABLE_MODULE_EXPLAIN' => $lang['Enable_module_explain'], 'S_ENABLE_MODULE_YES' => $enable_module_yes, 'S_ENABLE_MODULE_NO' => $enable_module_no, 'L_WYSIWYG_PATH' => $lang['Wysiwyg_path'], 'L_WYSIWYG_PATH_EXPLAIN' => $lang['Wysiwyg_path_explain'], 'WYSIWYG_PATH' => $wysiwyg_path, // // Article // 'L_ARTICLE_TITLE' => $lang['Article_title'], 'L_ALLOW_WYSIWYG' => $lang['Allow_Wysiwyg'], 'L_ALLOW_WYSIWYG_EXPLAIN' => $lang['Allow_Wysiwyg_explain'], 'S_ALLOW_WYSIWYG_YES' => $allow_wysiwyg_yes, 'S_ALLOW_WYSIWYG_NO' => $allow_wysiwyg_no, 'L_ALLOW_HTML' => $lang['Allow_HTML'], 'L_ALLOW_HTML_EXPLAIN' => $lang['Allow_html_explain'], 'S_ALLOW_HTML_YES' => $allow_html_yes, 'S_ALLOW_HTML_NO' => $allow_html_no, 'L_ALLOW_BBCODE' => $lang['Allow_BBCode'], 'L_ALLOW_BBCODE_EXPLAIN' => $lang['Allow_bbcode_explain'], 'S_ALLOW_BBCODE_YES' => $allow_bbcode_yes, 'S_ALLOW_BBCODE_NO' => $allow_bbcode_no, 'L_ALLOW_SMILIES' => $lang['Allow_smilies'], 'L_ALLOW_SMILIES_EXPLAIN' => $lang['Allow_smilies_explain'], 'S_ALLOW_SMILIES_YES' => $allow_smilies_yes, 'S_ALLOW_SMILIES_NO' => $allow_smilies_no, 'L_ALLOWED_HTML_TAGS' => $lang['Allowed_tags'], 'L_ALLOWED_HTML_TAGS_EXPLAIN' => $lang['Allowed_tags_explain'], 'ALLOWED_HTML_TAGS' => $allowed_html_tags, 'L_ALLOW_IMAGES' => $lang['Allow_images'], 'L_ALLOW_IMAGES_EXPLAIN' => $lang['Allow_images_explain'], 'S_ALLOW_IMAGES_YES' => $allow_images_yes, 'S_ALLOW_IMAGES_NO' => $allow_images_no, 'L_ALLOW_LINKS' => $lang['Allow_links'], 'L_ALLOW_LINKS_EXPLAIN' => $lang['Allow_links_explain'], 'S_ALLOW_LINKS_YES' => $allow_links_yes, 'S_ALLOW_LINKS_NO' => $allow_links_no, 'L_LINKS_MESSAGE' => $lang['Allow_links_message'], 'L_LINKS_MESSAGE_EXPLAIN' => $lang['Allow_links_message_explain'], 'MESSAGE_LINK' => $no_link_message, 'L_IMAGES_MESSAGE' => $lang['Allow_images_message'], 'L_IMAGES_MESSAGE_EXPLAIN' => $lang['Allow_images_message_explain'], 'MESSAGE_IMAGE' => $no_image_message, 'L_MAX_SUBJECT_CHAR' => $lang['Max_subject_char'], 'L_MAX_SUBJECT_CHAR_EXPLAIN' => $lang['Max_subject_char_explain'], 'MAX_SUBJECT_CHAR' => $max_subject_chars, 'L_MAX_DESC_CHAR' => $lang['Max_desc_char'], 'L_MAX_DESC_CHAR_EXPLAIN' => $lang['Max_desc_char_explain'], 'MAX_DESC_CHAR' => $max_desc_chars, 'L_MAX_CHAR' => $lang['Max_char'], 'L_MAX_CHAR_EXPLAIN' => $lang['Max_char_explain'], 'MAX_CHAR' => $max_chars, 'L_FORMAT_WORDWRAP' => $lang['Format_wordwrap'], 'L_FORMAT_WORDWRAP_EXPLAIN' => $lang['Format_wordwrap_explain'], 'S_FORMAT_WORDWRAP_YES' => $format_wordwrap_yes, 'S_FORMAT_WORDWRAP_NO' => $format_wordwrap_no, 'L_FORMAT_IMAGE_RESIZE' => $lang['Format_image_resize'], 'L_FORMAT_IMAGE_RESIZE_EXPLAIN' => $lang['Format_image_resize_explain'], 'FORMAT_IMAGE_RESIZE' => $format_image_resize, 'L_FORMAT_TRUNCATE_LINKS' => $lang['Format_truncate_links'], 'L_FORMAT_TRUNCATE_LINKS_EXPLAIN' => $lang['Format_truncate_links_explain'], 'S_FORMAT_TRUNCATE_LINKS_YES' => $format_truncate_links_yes, 'S_FORMAT_TRUNCATE_LINKS_NO' => $format_truncate_links_no, // // Appearance // 'L_APPEARANCE_TITLE' => $lang['Appearance_title'], 'L_PAGINATION' => $lang['Article_pag'], 'L_PAGINATION_EXPLAIN' => $lang['Article_pag_explain'], 'PAGINATION' => $pagination, 'L_SORT_METHOD' => $lang['Sort_method'], 'L_SORT_METHOD_EXPLAIN' => $lang['Sort_method_explain'], 'SORT_METHOD' => $sort_method_list, 'L_SORT_ORDER' => $lang['Sort_order'], 'L_SORT_ORDER_EXPLAIN' => $lang['Sort_order_explain'], 'SORT_ORDER' => $sort_order_list, 'L_STATS_LIST' => $lang['Stats_list'], 'L_STATS_LIST_EXPLAIN' => $lang['Stats_list_explain'], 'S_STATS_LIST_YES' => $stats_list_yes, 'S_STATS_LIST_NO' => $stats_list_no, 'L_HEADER_BANNER' => $lang['Header_banner'], 'L_HEADER_BANNER_EXPLAIN' => $lang['Header_banner_explain'], 'S_HEADER_BANNER_YES' => $header_banner_yes, 'S_HEADER_BANNER_NO' => $header_banner_no, 'CAT_COL' => $cat_col, 'L_CAT_COL' => $lang['cat_col'], 'L_NFDAYS' => $lang['Nfdays'], 'L_NFDAYSINFO' => $lang['Nfdaysinfo'], 'SETTINGS_NEWDAYS' => $settings_newdays, // // Comments // 'L_COMMENTS_TITLE' => $lang['Comments_title'], 'L_COMMENTS_TITLE_EXPLAIN' => $lang['Comments_title_explain'], 'L_USE_COMMENTS' => $lang['Use_comments'], 'L_USE_COMMENTS_EXPLAIN' => $lang['Use_comments_explain'], 'S_USE_COMMENTS_YES' => $use_comments_yes, 'S_USE_COMMENTS_NO' => $use_comments_no, 'L_INTERNAL_COMMENTS' => $lang['Internal_comments'], 'L_INTERNAL_COMMENTS_EXPLAIN' => $lang['Internal_comments_explain'], 'S_INTERNAL_COMMENTS_INTERNAL' => $internal_comments_internal, 'S_INTERNAL_COMMENTS_PHPBB' => $internal_comments_phpbb, 'L_INTERNAL_COMMENTS_INTERNAL' => $lang['Internal_comments_internal'], 'L_INTERNAL_COMMENTS_PHPBB' => $lang['Internal_comments_phpBB'], 'L_FORUM_ID' => $lang['Forum_id'], 'L_FORUM_ID_EXPLAIN' => $lang['Forum_id_explain'], 'FORUM_LIST' => $this->get_forums( $comments_forum_id, false, 'comments_forum_id' ), 'L_AUTOGENERATE_COMMENTS' => $lang['Autogenerate_comments'], 'L_AUTOGENERATE_COMMENTS_EXPLAIN' => $lang['Autogenerate_comments_explain'], 'S_AUTOGENERATE_COMMENTS_YES' => $autogenerate_comments_yes, 'S_AUTOGENERATE_COMMENTS_NO' => $autogenerate_comments_no, 'L_ALLOW_COMMENT_WYSIWYG' => $lang['Allow_Wysiwyg'], 'L_ALLOW_COMMENT_WYSIWYG_EXPLAIN' => $lang['Allow_Wysiwyg_explain'], 'S_ALLOW_COMMENT_WYSIWYG_YES' => $allow_comment_wysiwyg_yes, 'S_ALLOW_COMMENT_WYSIWYG_NO' => $allow_comment_wysiwyg_no, 'L_ALLOW_COMMENT_HTML' => $lang['Allow_HTML'], 'L_ALLOW_COMMENT_HTML_EXPLAIN' => $lang['Allow_html_explain'], 'S_ALLOW_COMMENT_HTML_YES' => $allow_comment_html_yes, 'S_ALLOW_COMMENT_HTML_NO' => $allow_comment_html_no, 'L_ALLOW_COMMENT_BBCODE' => $lang['Allow_BBCode'], 'L_ALLOW_COMMENT_BBCODE_EXPLAIN' => $lang['Allow_bbcode_explain'], 'S_ALLOW_COMMENT_BBCODE_YES' => $allow_comment_bbcode_yes, 'S_ALLOW_COMMENT_BBCODE_NO' => $allow_comment_bbcode_no, 'L_ALLOW_COMMENT_SMILIES' => $lang['Allow_smilies'], 'L_ALLOW_COMMENT_SMILIES_EXPLAIN' => $lang['Allow_smilies_explain'], 'S_ALLOW_COMMENT_SMILIES_YES' => $allow_comment_smilies_yes, 'S_ALLOW_COMMENT_SMILIES_NO' => $allow_comment_smilies_no, 'L_ALLOWED_COMMENT_HTML_TAGS' => $lang['Allowed_tags'], 'L_ALLOWED_COMMENT_HTML_TAGS_EXPLAIN' => $lang['Allowed_tags_explain'], 'ALLOWED_COMMENT_HTML_TAGS' => $allowed_comment_html_tags, 'L_ALLOW_COMMENT_IMAGES' => $lang['Allow_images'], 'L_ALLOW_COMMENT_IMAGES_EXPLAIN' => $lang['Allow_images_explain'], 'S_ALLOW_COMMENT_IMAGES_YES' => $allow_comment_images_yes, 'S_ALLOW_COMMENT_IMAGES_NO' => $allow_comment_images_no, 'L_ALLOW_COMMENT_LINKS' => $lang['Allow_links'], 'L_ALLOW_COMMENT_LINKS_EXPLAIN' => $lang['Allow_links_explain'], 'S_ALLOW_COMMENT_LINKS_YES' => $allow_comment_links_yes, 'S_ALLOW_COMMENT_LINKS_NO' => $allow_comment_links_no, 'L_COMMENT_LINKS_MESSAGE' => $lang['Allow_links_message'], 'L_COMMENT_LINKS_MESSAGE_EXPLAIN' => $lang['Allow_links_message_explain'], 'COMMENT_MESSAGE_LINK' => $no_comment_link_message, 'L_COMMENT_IMAGES_MESSAGE' => $lang['Allow_images_message'], 'L_COMMENT_IMAGES_MESSAGE_EXPLAIN' => $lang['Allow_images_message_explain'], 'COMMENT_MESSAGE_IMAGE' => $no_comment_image_message, 'L_COMMENT_MAX_SUBJECT_CHAR' => $lang['Max_subject_char'], 'L_COMMENT_MAX_SUBJECT_CHAR_EXPLAIN' => $lang['Max_subject_char_explain'], 'COMMENT_MAX_SUBJECT_CHAR' => $max_comment_subject_chars, 'L_COMMENT_MAX_CHAR' => $lang['Max_char'], 'L_COMMENT_MAX_CHAR_EXPLAIN' => $lang['Max_char_explain'], 'COMMENT_MAX_CHAR' => $max_comment_chars, 'L_COMMENT_FORMAT_WORDWRAP' => $lang['Format_wordwrap'], 'L_COMMENT_FORMAT_WORDWRAP_EXPLAIN' => $lang['Format_wordwrap_explain'], 'S_COMMENT_FORMAT_WORDWRAP_YES' => $format_comment_wordwrap_yes, 'S_COMMENT_FORMAT_WORDWRAP_NO' => $format_comment_wordwrap_no, 'L_COMMENT_FORMAT_IMAGE_RESIZE' => $lang['Format_image_resize'], 'L_COMMENT_FORMAT_IMAGE_RESIZE_EXPLAIN' => $lang['Format_image_resize_explain'], 'COMMENT_FORMAT_IMAGE_RESIZE' => $format_comment_image_resize, 'L_COMMENT_FORMAT_TRUNCATE_LINKS' => $lang['Format_truncate_links'], 'L_COMMENT_FORMAT_TRUNCATE_LINKS_EXPLAIN' => $lang['Format_truncate_links_explain'], 'S_COMMENT_FORMAT_TRUNCATE_LINKS_YES' => $format_comment_truncate_links_yes, 'S_COMMENT_FORMAT_TRUNCATE_LINKS_NO' => $format_comment_truncate_links_no, 'L_COMMENTS_PAG' => $lang['Comments_pag'], 'L_COMMENTS_PAG_EXPLAIN' => $lang['Comments_pag_explain'], 'COMMENTS_PAG' => $comments_pag, 'L_DEL_TOPIC' => $lang['Del_topic'], 'L_DEL_TOPIC_EXPLAIN' => $lang['Del_topic_explain'], 'S_DEL_TOPIC_YES' => $del_topic_yes, 'S_DEL_TOPIC_NO' => $del_topic_no, // // Ratings // 'L_RATINGS_TITLE' => $lang['Ratings_title'], 'L_RATINGS_TITLE_EXPLAIN' => $lang['Ratings_title_explain'], 'L_USE_RATINGS' => $lang['Use_ratings'], 'L_USE_RATINGS_EXPLAIN' => $lang['Use_ratings_explain'], 'S_USE_RATINGS_YES' => $use_ratings_yes, 'S_USE_RATINGS_NO' => $use_ratings_no, 'L_VOTES_CHECK_IP' => $lang['Votes_check_ip'], 'L_VOTES_CHECK_IP_EXPLAIN' => $lang['Votes_check_ip_explain'], 'S_VOTES_CHECK_IP_YES' => $votes_check_ip_yes, 'S_VOTES_CHECK_IP_NO' => $votes_check_ip_no, 'L_VOTES_CHECK_USERID' => $lang['Votes_check_userid'], 'L_VOTES_CHECK_USERID_EXPLAIN' => $lang['Votes_check_userid_explain'], 'S_VOTES_CHECK_USERID_YES' => $votes_check_userid_yes, 'S_VOTES_CHECK_USERID_NO' => $votes_check_userid_no, // // Instructions // 'L_INSTRUCTIONS_TITLE' => $lang['Instructions_title'], 'L_PRE_TEXT_NAME' => $lang['Pre_text_name'], 'L_PRE_TEXT_EXPLAIN' => $lang['Pre_text_explain'], 'S_SHOW_PRETEXT' => $pretext_show, 'S_HIDE_PRETEXT' => $pretext_hide, 'S_DEFAULT_PRETEXT' => $pretext_default, 'L_SHOW' => $lang['Show'], 'L_HIDE' => $lang['Hide'], 'L_PRE_TEXT_HEADER' => $lang['Pre_text_header'], 'L_PT_HEADER' => $pt_header, 'L_PRE_TEXT_BODY' => $lang['Pre_text_body'], 'L_PT_BODY' => $pt_body, // // Notifications // 'L_NOTIFICATIONS_TITLE' => $lang['Notifications_title'], 'L_NOTIFY' => $lang['Notify'], 'L_NOTIFY_EXPLAIN' => $lang['Notify_explain'], 'L_EMAIL' => $lang['Email'], 'L_PM' => $lang['PM'], 'S_NOTIFY_NONE' => $notify_none, 'S_NOTIFY_EMAIL' => $notify_email, 'S_NOTIFY_PM' => $notify_pm, 'L_NOTIFY_GROUP' => $lang['Notify_group'], 'L_NOTIFY_GROUP_EXPLAIN' => $lang['Notify_group_explain'], 'NOTIFY_GROUP' => $notify_group_list, )); $template->pparse( 'body' ); } } ?> --- NEW FILE: admin_auth_manage.php --- <?php /** * * @package mxBB Portal Module - mx_kb * @version $Id: admin_auth_manage.php,v 1.1 2006/07/08 10:21:36 jonohlsson Exp $ * @copyright (c) 2002-2006 [wGEric, Jon Ohlsson] mxBB Project Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ if ( !defined( 'IN_PORTAL' ) || !defined( 'IN_ADMIN' ) ) { die( "Hacking attempt" ); } class mx_kb_auth_manage extends mx_kb_admin { function main( $action ) { global $db, $images, $template, $lang, $phpEx, $mx_kb_functions, $mx_kb_cache, $kb_config, $phpbb_root_path, $module_root_path, $mx_root_path, $mx_request_vars; // // Includes // include_once( $phpbb_root_path . 'includes/functions_search.' . $phpEx ); // // Start adminCP // if ( !isset( $_POST['submit'] ) ) { $s_kb_cat_list = $this->generate_jumpbox( '', 0, 0, 0, true ); $template->set_filenames( array( 'body' => 'admin/kb_cat_select_body.tpl' ) ); $template->assign_vars( array( 'L_KB_AUTH_TITLE' => $lang['KB_Auth_Title'], 'L_KB_AUTH_EXPLAIN' => $lang['KB_Auth_Explain'], 'L_SELECT_CAT' => $lang['Select_a_Category'], 'S_KB_ACTION' => append_sid( "admin_kb.$phpEx?action=auth_manage" ), 'L_LOOK_UP_CAT' => $lang['Look_up_Category'], 'CAT_SELECT_TITLE' => $s_kb_cat_list )); $template->pparse( 'body' ); } else { if ( !isset( $_GET['cat_id'] ) ) { $cat_id = $mx_request_vars->request('cat_id', MX_TYPE_INT, ''); $template->set_filenames( array( 'body' => 'admin/kb_cat_auth_body.tpl' ) ); $template->assign_vars( array( 'L_ALBUM_AUTH_TITLE' => $lang['Album_Auth_Title'], 'L_ALBUM_AUTH_EXPLAIN' => $lang['Album_Auth_Explain'], 'L_SUBMIT' => $lang['Submit'], 'L_RESET' => $lang['Reset'], 'L_GROUPS' => $lang['Usergroups'], 'L_VIEW' => $lang['View'], 'L_UPLOAD' => $lang['Upload'], 'L_RATE' => $lang['Rate'], 'L_COMMENT' => $lang['Comment'], 'L_EDIT' => $lang['Edit'], 'L_DELETE' => $lang['Delete'], // 'L_APPROVAL' => $lang['Approval'], // 'L_APPROVAL_EDIT' => $lang['Approval_edit'], 'L_IS_MODERATOR' => $lang['Is_Moderator'], 'S_ALBUM_ACTION' => append_sid( "admin_kb.$phpEx?action=auth_manage&cat_id=$cat_id" ), )); // // Get the list of phpBB usergroups // $sql = "SELECT group_id, group_name FROM " . GROUPS_TABLE . " WHERE group_single_user <> " . true . " ORDER BY group_name ASC"; if ( !( $result = $db->sql_query( $sql ) ) ) { mx_message_die( GENERAL_ERROR, 'Could not get group list', '', __LINE__, __FILE__, $sql ); } while ( $kb_row = $db->sql_fetchrow( $result ) ) { $groupdata[] = $kb_row; } // // Get info of this cat // $sql = "SELECT category_id, category_name, auth_view_groups, auth_post_groups, auth_rate_groups, auth_comment_groups, auth_edit_groups, auth_delete_groups, auth_approval_groups, auth_approval_edit_groups, auth_moderator_groups FROM " . KB_CATEGORIES_TABLE . " WHERE category_id = '$cat_id'"; if ( !$result = $db->sql_query( $sql ) ) { mx_message_die( GENERAL_ERROR, 'Could not get Category information', '', __LINE__, __FILE__, $sql ); } $thiscat = $db->sql_fetchrow( $result ); $view_groups = @explode( ',', $thiscat['auth_view_groups'] ); $post_groups = @explode( ',', $thiscat['auth_post_groups'] ); $rate_groups = @explode( ',', $thiscat['auth_rate_groups'] ); $comment_groups = @explode( ',', $thiscat['auth_comment_groups'] ); $edit_groups = @explode( ',', $thiscat['auth_edit_groups'] ); $delete_groups = @explode( ',', $thiscat['auth_delete_groups'] ); // $approval_groups = @explode( ',', $thiscat['auth_approval_groups'] ); // $approval_edit_groups = @explode( ',', $thiscat['auth_approval_edit_groups'] ); $moderator_groups = @explode( ',', $thiscat['auth_moderator_groups'] ); for ( $i = 0; $i < count( $groupdata ); $i++ ) { $template->assign_block_vars( 'grouprow', array( 'GROUP_ID' => $groupdata[$i]['group_id'], 'GROUP_NAME' => $groupdata[$i]['group_name'], 'VIEW_CHECKED' => ( in_array( $groupdata[$i]['group_id'], $view_groups ) ) ? 'checked="checked"' : '', 'POST_CHECKED' => ( in_array( $groupdata[$i]['group_id'], $post_groups ) ) ? 'checked="checked"' : '', 'RATE_CHECKED' => ( in_array( $groupdata[$i]['group_id'], $rate_groups ) ) ? 'checked="checked"' : '', 'COMMENT_CHECKED' => ( in_array( $groupdata[$i]['group_id'], $comment_groups ) ) ? 'checked="checked"' : '', 'EDIT_CHECKED' => ( in_array( $groupdata[$i]['group_id'], $edit_groups ) ) ? 'checked="checked"' : '', 'DELETE_CHECKED' => ( in_array( $groupdata[$i]['group_id'], $delete_groups ) ) ? 'checked="checked"' : '', // 'APPROVAL_CHECKED' => ( in_array( $groupdata[$i]['group_id'], $approval_groups ) ) ? 'checked="checked"' : '', // 'APPROVAL_EDIT_CHECKED' => ( in_array( $groupdata[$i]['group_id'], $approval_edit_groups ) ) ? 'checked="checked"' : '', 'MODERATOR_CHECKED' => ( in_array( $groupdata[$i]['group_id'], $moderator_groups ) ) ? 'checked="checked"' : '' )); } $template->pparse( 'body' ); } else { $cat_id = $mx_request_vars->request('cat_id', MX_TYPE_INT, ''); $view_groups = @implode( ',', $_POST['view'] ); $post_groups = @implode( ',', $_POST['post'] ); $rate_groups = @implode( ',', $_POST['rate'] ); $comment_groups = @implode( ',', $_POST['comment'] ); $edit_groups = @implode( ',', $_POST['edit'] ); $delete_groups = @implode( ',', $_POST['delete'] ); // $approval_groups = @implode( ',', $_POST['approval'] ); // $approval_edit_groups = @implode( ',', $_POST['approval_edit'] ); $moderator_groups = @implode( ',', $_POST['moderator'] ); $sql = "UPDATE " . KB_CATEGORIES_TABLE . " SET auth_view_groups = '$view_groups', auth_post_groups = '$post_groups', auth_rate_groups = '$rate_groups', auth_comment_groups = '$comment_groups', auth_edit_groups = '$edit_groups', auth_delete_groups = '$delete_groups', auth_approval_groups = '$approval_groups', auth_approval_edit_groups = '$approval_edit_groups', auth_moderator_groups = '$moderator_groups' WHERE category_id = '$cat_id'"; if ( !$result = $db->sql_query( $sql ) ) { mx_message_die( GENERAL_ERROR, 'Could not update KB config table', '', __LINE__, __FILE__, $sql ); } $message = $lang['KB_Auth_successfully'] . '<br /><br />' . sprintf( $lang['Click_return_KB_auth'], '<a href="' . append_sid( "admin_kb.$phpEx?action=auth_manage" ) . '">', '</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 ); } } } } ?> --- NEW FILE: admin_types_manage.php --- <?php /** * * @package mxBB Portal Module - mx_kb * @version $Id: admin_types_manage.php,v 1.1 2006/07/08 10:21:36 jonohlsson Exp $ * @copyright (c) 2002-2006 [wGEric, Jon Ohlsson] mxBB Project Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ if ( !defined( 'IN_PORTAL' ) || !defined( 'IN_ADMIN' ) ) { die( "Hacking attempt" ); } class mx_kb_types_manage extends mx_kb_admin { function main( $action ) { global $db, $images, $template, $lang, $phpEx, $mx_kb_functions, $mx_kb_cache, $kb_config, $phpbb_root_path, $module_root_path, $mx_root_path, $mx_request_vars; // // Includes // include_once( $phpbb_root_path . 'includes/functions_search.' . $phpEx ); // // Load mode // if ( isset( $_POST['mode'] ) || isset( $_GET['mode'] ) ) { $mode = ( isset( $_POST['mode'] ) ) ? $_POST['mode'] : $_GET['mode']; } else { if ( $create ) { $mode = 'create'; } else if ( $edit ) { $mode = 'edit'; } else if ( $delete ) { $mode = 'delete'; } else { $mode = ''; } } switch ( $mode ) { case ( 'create' ): $type_name = trim( $_POST['new_type_name'] ); if ( !$type_name ) { echo "Please put a type name in!"; exit; } $sql = "INSERT INTO " . KB_TYPES_TABLE . " (type) VALUES ('$type_name')"; if ( !( $results = $db->sql_query( $sql ) ) ) { mx_message_die( GENERAL_ERROR, "Could not create type", '', __LINE__, __FILE__, $sql ); } $message = $lang['Type_created'] . '<br /><br />' . sprintf( $lang['Click_return_type_manager'], '<a href="' . append_sid( "admin_kb.$phpEx?action=types_manage" ) . '">', '</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 ); break; case ( 'edit' ): if ( !$_POST['submit'] ) { $type_id = intval( $_GET['cat'] ); $sql = "SELECT * FROM " . KB_TYPES_TABLE . " WHERE id = " . $type_id; if ( !( $results = $db->sql_query( $sql ) ) ) { mx_message_die( GENERAL_ERROR, "Could not obtain type", '', __LINE__, __FILE__, $sql ); } if ( $type = $db->sql_fetchrow( $results ) ) { $type = $type['type']; } // Generate page $template->set_filenames( array( 'body' => 'admin/kb_type_edit_body.tpl' ) ); $template->assign_vars( array( 'L_EDIT_TITLE' => $lang['Edit_type'], 'L_CATEGORY' => $lang['Article_type'], 'L_CAT_SETTINGS' => $lang['Cat_settings'], 'L_CREATE' => $lang['Edit'], 'S_ACTION' => append_sid( "admin_kb.$phpEx?action=types_manage&mode=edit" ), 'CAT_NAME' => $type, 'S_HIDDEN' => '<input type="hidden" name="typeid" value="' . $type_id . '">' )); } ... [truncated message content] |