|
From: OryNider <ory...@us...> - 2008-03-08 15:19:54
|
Update of /cvsroot/mxbb/mx_kb In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv5829 Modified Files: Tag: core28x kb.php Added Files: Tag: core28x kb_install.php kb_uninstall.php Log Message: upgrade for mx_mod 2.8.2 Index: kb.php =================================================================== RCS file: /cvsroot/mxbb/mx_kb/kb.php,v retrieving revision 1.42.2.2 retrieving revision 1.42.2.3 diff -C2 -d -r1.42.2.2 -r1.42.2.3 *** kb.php 15 Feb 2008 23:46:26 -0000 1.42.2.2 --- kb.php 8 Mar 2008 15:19:12 -0000 1.42.2.3 *************** *** 13,24 **** if ( !defined('PORTAL_BACKEND') && @file_exists( './viewtopic.' . $phpEx ) ) // -------------------------------------------- phpBB MOD MODE { ! define( 'MXBB_MODULE', false ); ! define( 'IN_PHPBB', true ); ! define( 'IN_PORTAL', true ); ! ! // When run as a phpBB mod these paths are identical ;) ! $phpbb_root_path = $module_root_path = $mx_root_path = './'; $mx_mod_path = $phpbb_root_path . 'mx_mod/'; //Check for cash mod if (file_exists($phpbb_root_path . 'includes/functions_cash.'.$phpEx)) --- 13,46 ---- if ( !defined('PORTAL_BACKEND') && @file_exists( './viewtopic.' . $phpEx ) ) // -------------------------------------------- phpBB MOD MODE { ! define('MXBB_MODULE', false); ! define('IN_PHPBB', true); ! ! $phpbb_root_path = $module_root_path = './'; $mx_mod_path = $phpbb_root_path . 'mx_mod/'; + + include($phpbb_root_path . 'common.' . $phpEx); + include($mx_mod_path . "includes/functions_required.$phpEx"); + + //Check if forum_hack is installed + if (!isset($mx_root_path)) + { + $mx_root_path = './'; + @define('IN_PORTAL', true); + include_once($mx_mod_path . "includes/mx_constants.$phpEx"); + include_once($mx_mod_path . "includes/shared/phpbb2/includes/functions.$phpEx"); + } + else + { + @define('IN_PORTAL', true); + include_once($mx_root_path . "includes/mx_constants.$phpEx"); + include_once($mx_root_path . "includes/shared/phpbb2/includes/functions.$phpEx"); + //Redefine mx_root_path to include phpbb page_tail.php + $mx_root_path = $phpbb_root_path; + } + + require($mx_mod_path . "includes/functions_core.$phpEx"); + require($mx_mod_path . "includes/functions_styles.$phpEx"); + //Check for cash mod if (file_exists($phpbb_root_path . 'includes/functions_cash.'.$phpEx)) *************** *** 27,37 **** } ! include( $phpbb_root_path . 'common.' . $phpEx ); ! ! @ini_set( 'display_errors', '1' ); error_reporting (E_ERROR | E_WARNING | E_PARSE); // This will NOT report uninitialized variables ! ! include_once( $mx_mod_path . 'includes/functions_required.' . $phpEx ); ! include_once( $mx_mod_path . 'includes/functions_core.' . $phpEx ); define( 'PAGE_KB', -502 ); // If this id generates a conflict with other mods, change it ;) --- 49,55 ---- } ! //@ini_set( 'display_errors', '1' ); error_reporting (E_ERROR | E_WARNING | E_PARSE); // This will NOT report uninitialized variables ! //error_reporting(E_ALL & ~E_NOTICE); define( 'PAGE_KB', -502 ); // If this id generates a conflict with other mods, change it ;) *************** *** 41,49 **** // $mx_cache = new mx_cache(); ! // // Get mxBB config settings // ! $portal_config = $mx_cache->obtain_mxbb_config(); // --- 59,67 ---- // $mx_cache = new mx_cache(); ! // // Get mxBB config settings // ! //$portal_config = $mx_cache->obtain_mxbb_config(); // *************** *** 51,85 **** // $mx_request_vars = new mx_request_vars(); $is_block = false; ! if ( file_exists("./modcp.$phpEx") ) // phpBB2 { define('PORTAL_BACKEND', 'phpbb2'); $tplEx = 'tpl'; ! include_once( $phpbb_root_path . 'includes/bbcode.' . $phpEx ); ! include_once( $phpbb_root_path . 'includes/functions_post.' . $phpEx ); ! ! // Start session management ! $userdata = session_pagestart( $user_ip, PAGE_DOWNLOAD ); ! init_userprefs( $userdata ); ! // End session management ! ! } ! else if ( @file_exists("./mcp.$phpEx") ) // phpBB3 { define('PORTAL_BACKEND', 'phpbb3'); $tplEx = 'html'; ! ! //include_once( $mx_mod_path . 'includes/shared/phpbb2/includes/bbcode.' . $phpEx ); ! //include_once( $mx_mod_path . 'includes/shared/phpbb2/includes/functions_post.' . $phpEx ); ! // ! // Start session management // ! $user->session_begin(); ! $userdata = $user->data; $user->setup(); // --- 69,117 ---- // $mx_request_vars = new mx_request_vars(); + + // + // Page selector + // + $page_id = $mx_request_vars->request('page', MX_TYPE_INT, 1); $is_block = false; + + // + // instatiate the mx_user class + // + $mx_user = new mx_user(); ! if (file_exists("./modcp.$phpEx")) // phpBB2 { define('PORTAL_BACKEND', 'phpbb2'); $tplEx = 'tpl'; + + // + // Start user session + // - populate $userdata and $lang + // + $mx_user->init($user_ip, $page_id, false); + //init_userprefs($userdata); + $mx_user->init_style(); //Overwrite template class ! /* ! $mx_user->set_module_default_style('_core'); // For compatibility with core 2.8.x ! if (!$userdata['user_level'] == ADMIN) ! { ! die('Only admins may run this script!!!'); ! } ! */ ! } ! else if (@file_exists("./mcp.$phpEx")) // phpBB3 { define('PORTAL_BACKEND', 'phpbb3'); $tplEx = 'html'; ! // ! // Start user session ! // - populate $userdata and $lang // ! $mx_user->init($user_ip, $page_id, false); $user->setup(); // *************** *** 87,94 **** // ! // ! // Get phpBB config settings ! // ! $board_config = $config; } else --- 119,129 ---- // ! /* ! $mx_user->set_module_default_style('_core'); // For compatibility with core 2.8.x ! if ($userdata['user_type'] != USER_FOUNDER) ! { ! die('Only admins may run this script!!!'); ! } ! */ } else *************** *** 120,124 **** $mx_get_page->init('kb.php'); ! $start = ( isset( $HTTP_GET_VARS['start'] ) ) ? intval( $HTTP_GET_VARS['start'] ) : 0; $url = ''; --- 155,159 ---- $mx_get_page->init('kb.php'); ! $start = ( isset( $_GET['start'] ) ) ? intval( $_GET['start'] ) : 0; $url = ''; *************** *** 132,136 **** } ! if (isset($HTTP_GET_VARS['print'])) { $url .= '&print=true'; --- 167,171 ---- } ! if (isset($_GET['print'])) { $url .= '&print=true'; *************** *** 196,200 **** $is_block = true; ! global $images, $mx_images; } define( 'MXBB_27x', @file_exists( $mx_root_path . 'mx_login.'.$phpEx ) ); --- 231,235 ---- $is_block = true; ! global $images; } define( 'MXBB_27x', @file_exists( $mx_root_path . 'mx_login.'.$phpEx ) ); *************** *** 215,230 **** // Get mode variables, otherwise set it to the main // =================================================== ! if ( !MXBB_MODULE ) ! { ! $mode = $mx_request_vars->request('mode', MX_TYPE_NO_TAGS, 'main'); ! //$mode = ( isset( $_REQUEST['mode'] ) ) ? htmlspecialchars( $_REQUEST['mode'] ) : 'main'; ! $print_version = ( isset( $_REQUEST['print'] ) ) ? htmlspecialchars( $_REQUEST['print'] ) : ''; ! } ! else ! { ! $mode = $mx_request_vars->request('mode', MX_TYPE_NO_TAGS, 'main'); ! $print_version = $mx_request_vars->is_request('print', MX_TYPE_NO_TAGS, ''); ! } ! $kb_config['reader_mode'] = false; --- 250,255 ---- // Get mode variables, otherwise set it to the main // =================================================== ! $mode = $mx_request_vars->request('mode', MX_TYPE_NO_TAGS, 'main'); ! $print_version = $mx_request_vars->is_request('print'); $kb_config['reader_mode'] = false; *************** *** 326,329 **** include( $mx_root_path . 'includes/page_tail.' . $phpEx ); } - ?> \ No newline at end of file --- 351,353 ---- --- NEW FILE: kb_install.php --- <?php /** * * @package phpBB Mod - Knowledge Base * @version $Id: kb_install.php,v 1.1.2.1 2008/03/08 15:19:15 orynider Exp $ * @copyright (c) 2002-2006 [Jon Ohlsson, Mohd Basri, wGEric, PHP Arena, pafileDB, CRLin] mxBB Project Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ $phpEx = substr(strrchr(__FILE__, '.'), 1); if ( !defined('PORTAL_BACKEND') && @file_exists( './viewtopic.' . $phpEx ) ) // -------------------------------------------- phpBB MOD MODE { define( 'MXBB_MODULE', false ); define( 'IN_PHPBB', true ); $phpbb_root_path = $module_root_path = './'; $mx_mod_path = $phpbb_root_path . 'mx_mod/'; include($phpbb_root_path . 'common.' . $phpEx); include($mx_mod_path . "includes/functions_required.$phpEx"); //Check if forum_hack is installed if (!isset($mx_root_path)) { $mx_root_path = './'; @define('IN_PORTAL', true); include_once($mx_mod_path . "includes/mx_constants.$phpEx"); include_once($mx_mod_path . "includes/shared/phpbb2/includes/functions.$phpEx"); } else { @define('IN_PORTAL', true); include_once($mx_root_path . "includes/mx_constants.$phpEx"); include_once($mx_root_path . "includes/shared/phpbb2/includes/functions.$phpEx"); } require($mx_mod_path . "includes/functions_core.$phpEx"); require($mx_mod_path . "includes/functions_styles.$phpEx"); //Check for cash mod if (file_exists($phpbb_root_path . 'includes/functions_cash.'.$phpEx)) { define('IN_CASHMOD', true); } //@ini_set( 'display_errors', '1' ); error_reporting (E_ERROR | E_WARNING | E_PARSE); // This will NOT report uninitialized variables //error_reporting(E_ALL & ~E_NOTICE); define( 'PAGE_KB', -502 ); // If this id generates a conflict with other mods, change it ;) // // Instatiate the mx_cache class // $mx_cache = new mx_cache(); // // Get mxBB config settings // //$portal_config = $mx_cache->obtain_mxbb_config(); // // instatiate the mx_request_vars class // $mx_request_vars = new mx_request_vars(); // // Page selector // $page_id = $mx_request_vars->request('page', MX_TYPE_INT, 1); $is_block = false; // // instatiate the mx_user class // $mx_user = new mx_user(); if (file_exists("./modcp.$phpEx")) // phpBB2 { define('PORTAL_BACKEND', 'phpbb2'); $tplEx = 'tpl'; // // Start user session // - populate $userdata and $lang // $mx_user->init($user_ip, $page_id, false); init_userprefs($userdata); $mx_user->set_module_default_style('prosilver'); // For compatibility with core 2.8.x if (!$userdata['user_level'] == ADMIN) { die('Only admins may run this script!!!'); } } else if (@file_exists("./mcp.$phpEx")) // phpBB3 { define('PORTAL_BACKEND', 'phpbb3'); $tplEx = 'html'; // // Start user session // - populate $userdata and $lang // $mx_user->init($user_ip, $page_id, false); $user->setup(); // // End session management // $mx_user->set_module_default_style('prosilver'); // For compatibility with core 2.8.x if ($userdata['user_type'] != USER_FOUNDER) { die('Only admins may run this script!!!'); } } else { die('Copy this file in phpbb_root_path were is your viewtopic.php file!!!'); } } else // --------------------------------------------------------------------------------- mxBB Module MODE { define( 'MXBB_MODULE', true ); if ( !function_exists( 'read_block_config' ) ) { define( 'IN_PORTAL', true ); $mx_root_path = './../../'; $module_root_path = './'; $phpEx = substr(strrchr(__FILE__, '.'), 1); include_once( $mx_root_path . 'common.' . $phpEx ); // Start session management $mx_user->init($user_ip, PAGE_INDEX); // End session management define( 'MXBB_27x', file_exists( $mx_root_path . 'mx_login.' . $phpEx ) ); } else { if( !defined('IN_PORTAL') || !is_object($mx_block)) { die("Hacking attempt"); } // // Read Block Settings (default mode) // $title = !empty( $mx_block->block_info['block_title'] ) ? $mx_block->block_info['block_title'] : $lang['KB_title']; $desc = $mx_block->block_info['block_desc']; $block_size = ( isset( $block_size ) && !empty( $block_size ) ? $block_size : '100%' ); //Check for cash mod if (file_exists($phpbb_root_path . 'includes/functions_cash.'.$phpEx)) { define('IN_CASHMOD', true); } $is_block = true; global $images; } define( 'MXBB_27x', @file_exists( $mx_root_path . 'mx_login.'.$phpEx ) ); } // // Check if mx_common Mod is prezent // if (!file_exists($mx_mod_path . "includes/functions_admincp.$phpEx")) { die('mx mod is not uploaded!!!'); } else { require($mx_mod_path . "includes/functions_admincp.$phpEx"); } $page_title = 'Installing/Upgrading Knowledge Base'; include($phpbb_root_path . 'includes/page_header.'.$phpEx); $sql = array(); // If fresh install if ( !$result = $db->sql_query( "SELECT config_name from " . $table_prefix . "kb_config" ) ) { $message = "<b>This is a fresh install!</b><br/><br/>"; $sql[] = "DROP TABLE IF EXISTS " . $table_prefix . "kb_articles "; $sql[] = "DROP TABLE IF EXISTS " . $table_prefix . "kb_categories "; $sql[] = "DROP TABLE IF EXISTS " . $table_prefix . "kb_config "; $sql[] = "DROP TABLE IF EXISTS " . $table_prefix . "kb_types "; $sql[] = "DROP TABLE IF EXISTS " . $table_prefix . "kb_wordlist "; $sql[] = "DROP TABLE IF EXISTS " . $table_prefix . "kb_results "; $sql[] = "DROP TABLE IF EXISTS " . $table_prefix . "kb_wordmatch "; $sql[] = "DROP TABLE IF EXISTS " . $table_prefix . "kb_votes "; $sql[] = "CREATE TABLE " . $table_prefix . "kb_categories ( category_id int(10) NOT NULL auto_increment, category_name text, category_details text, parent int(50) default NULL, parents_data text NOT NULL default '', cat_order int(50) default NULL, cat_allow_file tinyint(2) NOT NULL default '1', cat_allow_comments tinyint(2) NOT NULL default '-1', internal_comments tinyint(2) NOT NULL default '-1', autogenerate_comments tinyint(2) NOT NULL default '-1', comments_forum_id mediumint(8) NOT NULL default '-1', cat_allow_ratings tinyint(2) NOT NULL default '-1', show_pretext tinyint(2) NOT NULL default '-1', notify tinyint(2) NOT NULL default '-1', notify_group mediumint(8) NOT NULL default '-1', number_articles mediumint(8) NOT NULL default '-1', cat_last_article_id mediumint(8) unsigned NOT NULL default '0', cat_last_article_name varchar(255) NOT NULL default '', cat_last_article_time INT(50) UNSIGNED DEFAULT '0' NOT NULL, auth_view tinyint(3) NOT NULL DEFAULT '0', auth_post tinyint(3) NOT NULL DEFAULT '0', auth_rate tinyint(3) NOT NULL DEFAULT '0', auth_view_comment tinyint(3) NOT NULL DEFAULT '0', auth_post_comment tinyint(3) NOT NULL DEFAULT '0', auth_edit_comment tinyint(3) NOT NULL DEFAULT '0', auth_delete_comment tinyint(3) NOT NULL DEFAULT '2', auth_edit tinyint(3) NOT NULL DEFAULT '0', auth_delete tinyint(3) NOT NULL DEFAULT '2', auth_approval tinyint(3) NOT NULL DEFAULT '0', auth_approval_edit tinyint(3) NOT NULL DEFAULT '0', auth_view_groups varchar(255) NOT NULL default '0', auth_post_groups varchar(255) NOT NULL default '0', auth_rate_groups varchar(255) NOT NULL default '0', auth_view_comment_groups varchar(255) NOT NULL default '0', auth_post_comment_groups varchar(255) NOT NULL default '0', auth_edit_comment_groups varchar(255) NOT NULL default '0', auth_delete_comment_groups varchar(255) NOT NULL default '0', auth_edit_groups varchar(255) NOT NULL default '0', auth_delete_groups varchar(255) NOT NULL default '0', auth_approval_groups varchar(255) NOT NULL default '0', /* not really used */ auth_approval_edit_groups varchar(255) NOT NULL default '0', /* not really used */ auth_moderator_groups varchar(255) NOT NULL default '0', PRIMARY KEY (category_id), KEY cat_order (cat_order) )"; $sql[] = "INSERT INTO " . $table_prefix . "kb_categories VALUES (1, 'Test Category', 'Just a test category', '0', '10', '-1', '-1','-1','-1','-1','-1','-1','-1', '-1', '0', '', '0', '0', '0', '0', '0', '0', '0', '2', '0', '2', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0' )"; $sql[] = "CREATE TABLE " . $table_prefix . "kb_articles ( article_id mediumint(8) unsigned NOT NULL auto_increment, article_title varchar(255) binary NOT NULL default '', article_description varchar(255) binary NOT NULL default '', article_category_id mediumint(8) unsigned NOT NULL default '0', approved tinyint(1) unsigned NOT NULL default '0', article_body text NOT NULL, bbcode_uid varchar(10) binary NOT NULL default '', article_type mediumint(8) unsigned NOT NULL default '0', article_date int(50) default NULL, article_author_id mediumint(8) NOT NULL, username VARCHAR(255), topic_id mediumint(8) unsigned NOT NULL default '0', views BIGINT(8) NOT NULL DEFAULT '0', PRIMARY KEY (article_id) )"; $sql[] = "CREATE TABLE " . $table_prefix . "kb_config ( config_name VARCHAR(255) NOT NULL default '', config_value varchar(255) NOT NULL default '', PRIMARY KEY (config_name) )"; // -------------------------------------------------------- $sql[] = "CREATE TABLE " . $table_prefix . "kb_comments ( comments_id int(10) NOT NULL auto_increment, article_id int(10) NOT NULL default '0', comments_text text NOT NULL, comments_title text NOT NULL, comments_time int(50) NOT NULL default '0', comment_bbcode_uid varchar(10) default NULL, poster_id mediumint(8) NOT NULL default '0', PRIMARY KEY (comments_id), KEY comments_id (comments_id), FULLTEXT KEY comment_bbcode_uid (comment_bbcode_uid) )"; $sql[] = "CREATE TABLE " . $table_prefix . "kb_types ( id mediumint(8) unsigned NOT NULL auto_increment, type varchar(255) binary DEFAULT '' NOT NULL, KEY id (id) )"; $sql[] = "INSERT INTO " . $table_prefix . "kb_types VALUES (1, 'Test Type 1')"; $sql[] = "CREATE TABLE " . $table_prefix . "kb_votes ( user_id mediumint(8) NOT NULL default '0', votes_ip varchar(50) NOT NULL default '0', votes_article int(50) NOT NULL default '0', rate_point tinyint(3) unsigned NOT NULL default '0', KEY user_id (user_id) )"; // -------------------------------------------------------- $sql[] = "CREATE TABLE " . $table_prefix . "kb_custom ( custom_id int(50) NOT NULL auto_increment, custom_name text NOT NULL, custom_description text NOT NULL, data text NOT NULL, field_order int(20) NOT NULL default '0', field_type tinyint(2) NOT NULL default '0', regex varchar(255) NOT NULL default '', PRIMARY KEY (custom_id) )"; // -------------------------------------------------------- $sql[] = "CREATE TABLE " . $table_prefix . "kb_customdata ( customdata_file int(50) NOT NULL default '0', customdata_custom int(50) NOT NULL default '0', data text NOT NULL )"; // // Insert Configs // // General $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('enable_module', '1')"; // allow_new $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('module_name', 'Knowledge Base')"; // NEW $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('wysiwyg_path', 'mx_mod/mx_shared/')"; // Articles $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('formatting_wordwrap', '1')"; // formatting_fixup $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('formatting_image_resize', '300')"; // NEW $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('formatting_truncate_links', '1')"; // NEW $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('allow_wysiwyg', '0')"; // NEW $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('allow_html', '1')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('allow_bbcode', '1')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('allow_smilies', '1')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('allowed_html_tags', 'b,i,u,a')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('allow_links', '1')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('allow_images', '0')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('no_image_message', '[No image please]')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('no_link_message', '[No links please]')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('max_subject_chars', '100')"; // NEW $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('max_desc_chars', '500')"; // NEW $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('max_chars', '0')"; // NEW // Appearance $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('sort_method', 'Alphabetic')"; // news_sort $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('sort_order', 'ASC')"; // news_sort_par $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('pagination', '10')"; // art_pagination $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('stats_list', '1')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('header_banner', '0')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('use_simple_navigation', '1')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('cat_col', '2')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('settings_newdays', '1')"; // Comments $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('use_comments', '0')"; // comments_show $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('internal_comments', '1')"; // NEW $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('formatting_comment_wordwrap', '1')"; // formatting_comment_fixup $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('formatting_comment_image_resize', '300')"; // NEW $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('formatting_comment_truncate_links', '1')"; // NEW $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('max_comment_subject_chars', '50')"; // NEW $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('max_comment_chars', '5000')"; // NEW $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('allow_comment_wysiwyg', '0')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('allow_comment_html', '1')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('allow_comment_bbcode', '1')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('allow_comment_smilies', '1')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('allow_comment_links', '1')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('allow_comment_images', '0')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('no_comment_image_message', '[No image please]')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('no_comment_link_message', '[No links please]')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('allowed_comment_html_tags', 'b,i,u,a')"; // NEW $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('del_topic', '1')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('autogenerate_comments', '1')"; // bump_post $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('comments_pagination', '5')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('comments_forum_id', '1')"; // New // Ratings $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('use_ratings', '0')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('votes_check_userid', '1')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('votes_check_ip', '1')"; // Instructions $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('show_pretext',0)"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('pt_header','Article Submission Instructions')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config values ('pt_body','Please check your references and include as much information as you can.')"; // Notifications $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('notify', 'pm')"; // updated $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('notify_group', '0')"; // admin_id $message .= mx_do_install_upgrade( $sql ); } else { // Upgrade checks $upgrade_101 = 0; $upgrade_102 = 0; $upgrade_103 = 0; $upgrade_104 = 0; $upgrade_105 = 0; $upgrade_106 = 0; $upgrade_107 = 0; $upgrade_108 = 0; $upgrade_109 = 0; $upgrade_200 = 0; $upgrade_201 = 0; $upgrade_202 = 0; $upgrade_280 = 0; // mxBB 2.8 branch -> $message = "<b>Upgrading!</b><br/><br/>"; // validate before 1.05 $result = $db->sql_query( "SELECT config_value from " . $table_prefix . "kb_config WHERE config_name = 'header_banner'" ); if ( $db->sql_numrows( $result ) == 0 ) { $upgrade_105 = 1; $message .= "<b>Upgrading to v. 1.05...</b><br/><br/>"; } else { $message .= "<b>Validating v. 1.05...ok</b><br/><br/>"; } // validate before 1.06 if ( !$result = $db->sql_query( "SELECT votes_userid from " . $table_prefix . "kb_votes" ) ) { $upgrade_106 = 1; $message .= "<b>Validating v. 1.06...ok</b><br/><br/>"; } else { $message .= "<b>Validating v. 1.06...ok</b><br/><br/>"; } // validate before 1.07 $result = $db->sql_query( "SELECT config_value from " . $table_prefix . "kb_config WHERE config_name = 'comments_pagination'" ); if ( $db->sql_numrows( $result ) == 0 ) { $upgrade_107 = 1; $message .= "<b>Validating v. 1.07...ok</b><br/><br/>"; } else { $message .= "<b>Validating v. 1.07...ok</b><br/><br/>"; } // validate before 1.08 $result = $db->sql_query( "SELECT parameter_id from " . $table_prefix . "parameter WHERE parameter_name = 'kb_type_select'" ); if ( $db->sql_numrows( $result ) == 0 ) { $upgrade_108 = 1; $message .= "<b>Validating v. 1.08...ok</b><br/><br/>"; } else { $message .= "<b>Validating v. 1.08...ok</b><br/><br/>"; } // validate before 1.09 if ( !$result = $db->sql_query( "SELECT auth_edit_groups from " . $table_prefix . "kb_categories" ) ) { $upgrade_109 = 1; $message .= "<b>Upgrading to v. 1.09...</b><br/><br/>"; } else { $message .= "<b>Validating v. 1.09...ok</b><br/><br/>"; } // validate before 2.00 if ( !$result = $db->sql_query( "SELECT custom_id from " . $table_prefix . "kb_custom" ) ) { $upgrade_200 = 1; $message .= "<b>Upgrading to v. 2.00...ok</b><br/><br/>"; } else { $message .= "<b>Validating v. 2.00...ok</b><br/><br/>"; } // validate before 2.01 $result = $db->sql_query( "SELECT config_value from " . $table_prefix . "kb_config WHERE config_name = 'wysiwyg_path'" ); if ( $db->sql_numrows( $result ) == 0 ) { $upgrade_201 = 1; $message .= "<b>Upgrading to v. 2.01...ok</b><br/><br/>"; } else { $message .= "<b>Validating v. 2.01...ok</b><br/><br/>"; } $upgrade_202 = 1; $message .= "<b>Upgrading to v. 2.02...ok</b><br/><br/>"; // validate before 2.0.3 $result = $db->sql_query( "SELECT config_value from " . $table_prefix . "kb_config WHERE config_name = 'internal_comments'" ); if ( $db->sql_numrows( $result ) == 0 ) { $upgrade_203 = 1; $message .= "<b>Upgrading to v. 2.0.3...ok</b><br/><br/>"; } else { $message .= "<b>Validating v. 2.0.3...ok</b><br/><br/>"; } // validate before 2.8.0 $result = $db->sql_query( "SELECT config_value from " . $table_prefix . "kb_config WHERE config_name = 'comments_forum_id'" ); if ( $db->sql_numrows( $result ) == 0 ) { $upgrade_280 = 1; $message .= "<b>Upgrading to v. 2.8.0...ok</b><br/><br/>"; } else { $message .= "<b>Validating v. 2.8.0...ok</b><br/><br/>"; } // ------------------------------------------------------------------------------------------------------ if ( $upgrade_105 == 1 ) { $sql[] = "CREATE TABLE " . $table_prefix . "kb_votes ( votes_ip varchar(50) NOT NULL default '0', votes_file int(50) NOT NULL default '0' ) TYPE=MyISAM"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('allow_rating', '0')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('allow_anonymos_rating', '0')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('comments_show', '1')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('mod_group', '0')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('bump_post', '1')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('stats_list', '1')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('header_banner', '1')"; $sql[] = "ALTER TABLE " . $table_prefix . "kb_articles ADD article_rating double(6,4) NOT NULL default '0.0000' "; $sql[] = "ALTER TABLE " . $table_prefix . "kb_articles ADD article_totalvotes int(255) NOT NULL default '0' "; } if ( $upgrade_106 == 1 ) { $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('votes_check_userid', '1')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('votes_check_ip', '1')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('art_pagination', '5')"; $sql[] = "ALTER TABLE " . $table_prefix . "kb_votes ADD votes_userid int(50) NOT NULL default '0' AFTER votes_ip "; } if ( $upgrade_107 == 1 ) { $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('comments_pagination', '5')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('news_sort', 'Alphabetic')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('news_sort_par', 'ASC')"; } if ( $upgrade_108 == 1 ) { $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('comments_pagination', '5')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('news_sort', 'Alphabetic')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('news_sort_par', 'ASC')"; } if ( $upgrade_109 == 1 ) { $sql[] = "ALTER TABLE " . $table_prefix . "kb_categories ADD auth_view tinyint(3) NOT NULL DEFAULT '0' "; $sql[] = "ALTER TABLE " . $table_prefix . "kb_categories ADD auth_post tinyint(3) NOT NULL DEFAULT '0' "; $sql[] = "ALTER TABLE " . $table_prefix . "kb_categories ADD auth_rate tinyint(3) NOT NULL DEFAULT '0' "; $sql[] = "ALTER TABLE " . $table_prefix . "kb_categories ADD auth_comment tinyint(3) NOT NULL DEFAULT '0' "; $sql[] = "ALTER TABLE " . $table_prefix . "kb_categories ADD auth_edit tinyint(3) NOT NULL DEFAULT '0' "; $sql[] = "ALTER TABLE " . $table_prefix . "kb_categories ADD auth_delete tinyint(3) NOT NULL DEFAULT '2' "; $sql[] = "ALTER TABLE " . $table_prefix . "kb_categories ADD auth_approval tinyint(3) NOT NULL DEFAULT '0' "; $sql[] = "ALTER TABLE " . $table_prefix . "kb_categories ADD auth_approval_edit tinyint(3) NOT NULL DEFAULT '0' "; $sql[] = "ALTER TABLE " . $table_prefix . "kb_categories ADD auth_view_groups varchar(255) "; $sql[] = "ALTER TABLE " . $table_prefix . "kb_categories ADD auth_post_groups varchar(255) "; $sql[] = "ALTER TABLE " . $table_prefix . "kb_categories ADD auth_rate_groups varchar(255) "; $sql[] = "ALTER TABLE " . $table_prefix . "kb_categories ADD auth_comment_groups varchar(255) "; $sql[] = "ALTER TABLE " . $table_prefix . "kb_categories ADD auth_edit_groups varchar(255) "; $sql[] = "ALTER TABLE " . $table_prefix . "kb_categories ADD auth_delete_groups varchar(255) "; $sql[] = "ALTER TABLE " . $table_prefix . "kb_categories ADD auth_approval_groups varchar(255) "; $sql[] = "ALTER TABLE " . $table_prefix . "kb_categories ADD auth_approval_edit_groups varchar(255) "; $sql[] = "ALTER TABLE " . $table_prefix . "kb_categories ADD auth_moderator_groups varchar(255) "; $sql[] = "ALTER TABLE " . $table_prefix . "kb_categories ADD comments_forum_id tinyint(3) NOT NULL DEFAULT '-1' "; $sql[] = "UPDATE " . $table_prefix . "kb_config" . " SET config_name = 'use_comments', config_value = '1' WHERE config_name = 'comments'"; $sql[] = "UPDATE " . $table_prefix . "kb_config" . " SET config_name = 'use_ratings', config_value = '1' WHERE config_name = 'allow_rating'"; } if ( $upgrade_200 == 1 ) { $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('wysiwyg', '0')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('allow_html', '1')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('allow_bbcode', '1')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('allow_smilies', '1')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('allowed_html_tags', 'b,i,u,a')"; // -------------------------------------------------------- $sql[] = "CREATE TABLE " . $table_prefix . "kb_custom ( custom_id int(50) NOT NULL auto_increment, custom_name text NOT NULL, custom_description text NOT NULL, data text NOT NULL, field_order int(20) NOT NULL default '0', field_type tinyint(2) NOT NULL default '0', regex varchar(255) NOT NULL default '', PRIMARY KEY (custom_id) )"; // -------------------------------------------------------- $sql[] = "CREATE TABLE " . $table_prefix . "kb_customdata ( customdata_file int(50) NOT NULL default '0', customdata_custom int(50) NOT NULL default '0', data text NOT NULL )"; } if ( $upgrade_201 == 1 ) { $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('wysiwyg_path', 'modules/')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('formatting_fixup', '0')"; $sql[] = "ALTER TABLE " . $table_prefix . "kb_articles MODIFY article_author_id mediumint(8) NOT NULL "; } if ( $upgrade_202 == 1 ) // Old fix for those upgraded from old old version { // Upgrade the config table to avoid duplicate entries $sql[] = "ALTER TABLE " . $table_prefix . "kb_config MODIFY config_name VARCHAR(255) NOT NULL default '' "; $sql[] = "ALTER TABLE " . $table_prefix . "kb_config MODIFY config_value VARCHAR(255) NOT NULL default '' "; $sql[] = "ALTER TABLE " . $table_prefix . "kb_config DROP PRIMARY KEY, ADD PRIMARY KEY (config_name) "; } if ( $upgrade_203 == 1 ) { // -------------------------------------------------------- $sql[] = "CREATE TABLE " . $table_prefix . "kb_comments ( comments_id int(10) NOT NULL auto_increment, article_id int(10) NOT NULL default '0', comments_text text NOT NULL, comments_title text NOT NULL, comments_time int(50) NOT NULL default '0', comment_bbcode_uid varchar(10) default NULL, poster_id mediumint(8) NOT NULL default '0', PRIMARY KEY (comments_id), KEY comments_id (comments_id), FULLTEXT KEY comment_bbcode_uid (comment_bbcode_uid) )"; // Config table $sql[] = "UPDATE " . $table_prefix . "kb_config" . " SET config_name = 'enable_module' WHERE config_name = 'allow_new'"; $sql[] = "UPDATE " . $table_prefix . "kb_config" . " SET config_name = 'pagination' WHERE config_name = 'art_pagination'"; $sql[] = "UPDATE " . $table_prefix . "kb_config" . " SET config_name = 'sort_method' WHERE config_name = 'news_sort'"; $sql[] = "UPDATE " . $table_prefix . "kb_config" . " SET config_name = 'sort_order' WHERE config_name = 'news_sort_par'"; $sql[] = "UPDATE " . $table_prefix . "kb_config" . " SET config_name = 'autogenerate_comments' WHERE config_name = 'bump_post'"; $sql[] = "UPDATE " . $table_prefix . "kb_config" . " SET config_name = 'notify_group' WHERE config_name = 'admin_id'"; $sql[] = "DELETE FROM " . $table_prefix . "kb_config" . " WHERE config_name = 'comments_show'"; $sql[] = "DELETE FROM " . $table_prefix . "kb_config" . " WHERE config_name = 'wysiwyg'"; $sql[] = "DELETE FROM " . $table_prefix . "kb_config" . " WHERE config_name = 'wysiwyg_comments'"; $sql[] = "DELETE FROM " . $table_prefix . "kb_config" . " WHERE config_name = 'allow_wysiwyg_comments'"; $sql[] = "DELETE FROM " . $table_prefix . "kb_config" . " WHERE config_name = 'allow_wysiwyg'"; $sql[] = "DELETE FROM " . $table_prefix . "kb_config" . " WHERE config_name = 'formatting_fixup'"; $sql[] = "DELETE FROM " . $table_prefix . "kb_config" . " WHERE config_name = 'formatting_comment_fixup'"; $sql[] = "DELETE FROM " . $table_prefix . "kb_config" . " WHERE config_name = 'approve_new'"; $sql[] = "DELETE FROM " . $table_prefix . "kb_config" . " WHERE config_name = 'approve_edit'"; $sql[] = "DELETE FROM " . $table_prefix . "kb_config" . " WHERE config_name = 'allow_edit'"; $sql[] = "DELETE FROM " . $table_prefix . "kb_config" . " WHERE config_name = 'allow_anon'"; $sql[] = "DELETE FROM " . $table_prefix . "kb_config" . " WHERE config_name = 'forum_id'"; $sql[] = "DELETE FROM " . $table_prefix . "kb_config" . " WHERE config_name = 'allow_anonymos_rating'"; $sql[] = "DELETE FROM " . $table_prefix . "kb_config" . " WHERE config_name = 'mod_group'"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('module_name', 'Knowledge Base')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('allow_wysiwyg', '1')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('allow_links', '1')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('allow_images', '1')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('no_image_message', '[No image please]')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('no_link_message', '[No links please]')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('formatting_wordwrap', '1')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('formatting_image_resize', '300')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('formatting_truncate_links', '1')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('max_subject_chars', '100')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('max_desc_chars', '500')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('max_chars', '0')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('internal_comments', '1')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('formatting_comment_wordwrap', '1')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('formatting_comment_image_resize', '300')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('formatting_comment_truncate_links', '1')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('max_comment_subject_chars', '50')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('max_comment_chars', '5000')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('allowed_comment_html_tags', 'b,i,u,a')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('allow_comment_wysiwyg', '0')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('allow_comment_html', '1')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('allow_comment_bbcode', '1')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('allow_comment_smilies', '1')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('allow_comment_links', '1')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('allow_comment_images', '0')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('no_comment_image_message', '[No image please]')"; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('no_comment_link_message', '[No links please]')"; // Categories table $sql[] = "ALTER TABLE " . $table_prefix . "kb_categories ADD cat_allow_comments tinyint(2) NOT NULL default '-1' "; $sql[] = "ALTER TABLE " . $table_prefix . "kb_categories ADD internal_comments tinyint(2) NOT NULL DEFAULT '-1' "; $sql[] = "ALTER TABLE " . $table_prefix . "kb_categories ADD autogenerate_comments tinyint(2) NOT NULL DEFAULT '-1' "; $sql[] = "ALTER TABLE " . $table_prefix . "kb_categories ADD comments_forum_id mediumint(8) NOT NULL DEFAULT '-1' "; $sql[] = "ALTER TABLE " . $table_prefix . "kb_categories ADD cat_allow_ratings tinyint(2) NOT NULL default '-1' "; $sql[] = "ALTER TABLE " . $table_prefix . "kb_categories ADD show_pretext tinyint(2) NOT NULL default '-1' "; $sql[] = "ALTER TABLE " . $table_prefix . "kb_categories ADD notify tinyint(2) NOT NULL DEFAULT '-1' "; $sql[] = "ALTER TABLE " . $table_prefix . "kb_categories ADD notify_group mediumint(8) NOT NULL DEFAULT '-1' "; $sql[] = "ALTER TABLE " . $table_prefix . "kb_categories ADD cat_last_article_id mediumint(8) unsigned NOT NULL default '0' "; $sql[] = "ALTER TABLE " . $table_prefix . "kb_categories ADD cat_last_article_name varchar(255) NOT NULL default '' "; $sql[] = "ALTER TABLE " . $table_prefix . "kb_categories ADD cat_last_article_time INT(50) UNSIGNED DEFAULT '0' NOT NULL "; $sql[] = "ALTER TABLE " . $table_prefix . "kb_categories MODIFY auth_view_groups varchar(255) NOT NULL default '0' "; $sql[] = "ALTER TABLE " . $table_prefix . "kb_categories MODIFY auth_post_groups varchar(255) NOT NULL default '0' "; $sql[] = "ALTER TABLE " . $table_prefix . "kb_categories MODIFY auth_rate_groups varchar(255) NOT NULL default '0' "; $sql[] = "ALTER TABLE " . $table_prefix . "kb_categories MODIFY auth_comment_groups varchar(255) NOT NULL default '0' "; $sql[] = "ALTER TABLE " . $table_prefix . "kb_categories MODIFY auth_edit_groups varchar(255) NOT NULL default '0' "; $sql[] = "ALTER TABLE " . $table_prefix . "kb_categories MODIFY auth_delete_groups varchar(255) NOT NULL default '0' "; $sql[] = "ALTER TABLE " . $table_prefix . "kb_categories MODIFY auth_approval_groups varchar(255) NOT NULL default '0' "; $sql[] = "ALTER TABLE " . $table_prefix . "kb_categories MODIFY auth_approval_edit_groups varchar(255) NOT NULL default '0' "; $sql[] = "ALTER TABLE " . $table_prefix . "kb_categories MODIFY auth_moderator_groups varchar(255) NOT NULL default '0' "; // Number of articles can be -1 when syncing $sql[] = "ALTER TABLE " . $table_prefix . "kb_categories MODIFY number_articles mediumint(8) NOT NULL"; // // Drop unused tables // $sql[] = "DROP TABLE " . $table_prefix . "kb_wordlist "; $sql[] = "DROP TABLE " . $table_prefix . "kb_results "; $sql[] = "DROP TABLE " . $table_prefix . "kb_wordmatch "; // // New // $sql[] = "UPDATE " . $table_prefix . "kb_config" . " SET config_value = 'modules/mx_shared/' WHERE config_name = 'wysiwyg_path'"; } if ( $upgrade_280 == 1 ) { $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('comments_forum_id', '1')"; $sql[] = "ALTER TABLE " . $table_prefix . "kb_categories MODIFY cat_allow_comments tinyint(2) NOT NULL default '-1' "; $sql[] = "ALTER TABLE " . $table_prefix . "kb_categories MODIFY notify_group mediumint(8) NOT NULL default '-1' "; $sql[] = "ALTER TABLE " . $table_prefix . "kb_categories MODIFY number_articles mediumint(8) NOT NULL default '-1' "; $sql[] = "ALTER TABLE " . $table_prefix . "kb_categories MODIFY category_id int(10) NOT NULL auto_increment "; $sql[] = "ALTER TABLE " . $table_prefix . "kb_categories MODIFY category_name text "; $sql[] = "ALTER TABLE " . $table_prefix . "kb_categories MODIFY category_details text "; $sql[] = "ALTER TABLE " . $table_prefix . "kb_categories MODIFY parent int(50) default NULL "; $sql[] = "ALTER TABLE " . $table_prefix . "kb_categories ADD parents_data text NOT NULL default '' "; $sql[] = "ALTER TABLE " . $table_prefix . "kb_categories ADD cat_allow_file tinyint(2) NOT NULL default '1' "; $sql[] = "ALTER TABLE " . $table_prefix . "kb_categories MODIFY cat_order int(50) default NULL "; $sql[] = "ALTER TABLE " . $table_prefix . "kb_categories CHANGE auth_comment auth_view_comment tinyint(3) NOT NULL DEFAULT '0' "; $sql[] = "ALTER TABLE " . $table_prefix . "kb_categories ADD auth_post_comment tinyint(3) NOT NULL DEFAULT '0' "; $sql[] = "ALTER TABLE " . $table_prefix . "kb_categories ADD auth_edit_comment tinyint(3) NOT NULL DEFAULT '0' "; $sql[] = "ALTER TABLE " . $table_prefix . "kb_categories ADD auth_delete_comment tinyint(3) NOT NULL DEFAULT '0' "; $sql[] = "ALTER TABLE " . $table_prefix . "kb_categories CHANGE auth_comment_groups auth_view_comment_groups varchar(255) NOT NULL default '0' "; $sql[] = "ALTER TABLE " . $table_prefix . "kb_categories ADD auth_post_comment_groups varchar(255) NOT NULL default '0' "; $sql[] = "ALTER TABLE " . $table_prefix . "kb_categories ADD auth_edit_comment_groups varchar(255) NOT NULL default '0' "; $sql[] = "ALTER TABLE " . $table_prefix . "kb_categories ADD auth_delete_comment_groups varchar(255) NOT NULL default '0' "; $sql[] = "ALTER TABLE " . $table_prefix . "kb_votes ADD rate_point tinyint(3) unsigned NOT NULL default '0' "; $sql[] = "ALTER TABLE " . $table_prefix . "kb_votes CHANGE votes_userid user_id mediumint(8) NOT NULL default '0' "; $sql[] = "ALTER TABLE " . $table_prefix . "kb_votes CHANGE votes_file votes_article int(50) NOT NULL default '0' "; // Appearance $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('use_simple_navigation', '1') "; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('cat_col', '2') "; $sql[] = "INSERT INTO " . $table_prefix . "kb_config VALUES ('settings_newdays', '1') "; // Delete kb_article table article_rating and article_totalvotes } else { $message .= "<b>Nothing to upgrade...</b><br/><br/>"; } $message .= mx_do_install_upgrade( $sql ); // // Empty module cache // include_once( $mx_mod_path . 'includes/functions_tools.' . $phpEx ); $module_cache = new module_cache($phpbb_root_path . 'kb/'); $module_cache->tidy(); $module_cache->save(); } echo "<br /><br />"; echo "<table width=\"90%\" align=\"center\" cellpadding=\"4\" cellspacing=\"1\" border=\"0\" class=\"forumline\">"; echo "<tr><th class=\"thHead\" align=\"center\">Mod Installation/Upgrading/Uninstalling Information - mod specific db tables</th></tr>"; echo "<tr><td class=\"row1\" align=\"left\"><span class=\"gen\">" . $message . "</span></td></tr>"; echo "</table><br />"; include($phpbb_root_path . 'includes/page_tail.'.$phpEx); ?> --- NEW FILE: kb_uninstall.php --- <?php /** * * @package phpBB2 Mod - pafileDB * @version $Id: kb_uninstall.php,v 1.1.2.1 2008/03/08 15:19:18 orynider Exp $ * @copyright (c) 2002-2006 [Jon Ohlsson, Mohd Basri, wGEric, PHP Arena, pafileDB, CRLin] mxBB Project Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ $phpEx = substr(strrchr(__FILE__, '.'), 1); if ( !defined('PORTAL_BACKEND') && @file_exists( './viewtopic.' . $phpEx ) ) // -------------------------------------------- phpBB MOD MODE { define( 'MXBB_MODULE', false ); define( 'IN_PHPBB', true ); $phpbb_root_path = $module_root_path = './'; $mx_mod_path = $phpbb_root_path . 'mx_mod/'; include($phpbb_root_path . 'common.' . $phpEx); include($mx_mod_path . "includes/functions_required.$phpEx"); //Check if forum_hack is installed if (!isset($mx_root_path)) { $mx_root_path = './'; @define('IN_PORTAL', true); include_once($mx_mod_path . "includes/mx_constants.$phpEx"); include_once($mx_mod_path . "includes/shared/phpbb2/includes/functions.$phpEx"); } else { @define('IN_PORTAL', true); include_once($mx_root_path . "includes/mx_constants.$phpEx"); include_once($mx_root_path . "includes/shared/phpbb2/includes/functions.$phpEx"); } require($mx_mod_path . "includes/functions_core.$phpEx"); require($mx_mod_path . "includes/functions_styles.$phpEx"); //Check for cash mod if (file_exists($phpbb_root_path . 'includes/functions_cash.'.$phpEx)) { define('IN_CASHMOD', true); } //@ini_set( 'display_errors', '1' ); error_reporting (E_ERROR | E_WARNING | E_PARSE); // This will NOT report uninitialized variables //error_reporting(E_ALL & ~E_NOTICE); define( 'PAGE_KB', -502 ); // If this id generates a conflict with other mods, change it ;) // // Instatiate the mx_cache class // $mx_cache = new mx_cache(); // // Get mxBB config settings // //$portal_config = $mx_cache->obtain_mxbb_config(); // // instatiate the mx_request_vars class // $mx_request_vars = new mx_request_vars(); // // Page selector // $page_id = $mx_request_vars->request('page', MX_TYPE_INT, 1); $is_block = false; // // instatiate the mx_user class // $mx_user = new mx_user(); if (file_exists("./modcp.$phpEx")) // phpBB2 { define('PORTAL_BACKEND', 'phpbb2'); $tplEx = 'tpl'; // // Start user session // - populate $userdata and $lang // $mx_user->init($user_ip, $page_id, false); init_userprefs($userdata); $mx_user->set_module_default_style('prosilver'); // For compatibility with core 2.8.x if (!$userdata['user_level'] == ADMIN) { die('Only admins may run this script!!!'); } } else if (@file_exists("./mcp.$phpEx")) // phpBB3 { define('PORTAL_BACKEND', 'phpbb3'); $tplEx = 'html'; // // Start user session // - populate $userdata and $lang // $mx_user->init($user_ip, $page_id, false); $user->setup(); // // End session management // $mx_user->set_module_default_style('prosilver'); // For compatibility with core 2.8.x if ($userdata['user_type'] != USER_FOUNDER) { die('Only admins may run this script!!!'); } } else { die('Copy this file in phpbb_root_path were is your viewtopic.php file!!!'); } } else // --------------------------------------------------------------------------------- mxBB Module MODE { define( 'MXBB_MODULE', true ); if ( !function_exists( 'read_block_config' ) ) { define( 'IN_PORTAL', true ); $mx_root_path = './../../'; $module_root_path = './'; $phpEx = substr(strrchr(__FILE__, '.'), 1); include_once( $mx_root_path . 'common.' . $phpEx ); // Start session management $mx_user->init($user_ip, PAGE_INDEX); // End session management define( 'MXBB_27x', file_exists( $mx_root_path . 'mx_login.' . $phpEx ) ); } else { if( !defined('IN_PORTAL') || !is_object($mx_block)) { die("Hacking attempt"); } // // Read Block Settings (default mode) // $title = !empty( $mx_block->block_info['block_title'] ) ? $mx_block->block_info['block_title'] : $lang['KB_title']; $desc = $mx_block->block_info['block_desc']; $block_size = ( isset( $block_size ) && !empty( $block_size ) ? $block_size : '100%' ); //Check for cash mod if (file_exists($phpbb_root_path . 'includes/functions_cash.'.$phpEx)) { define('IN_CASHMOD', true); } $is_block = true; global $images; } define( 'MXBB_27x', @file_exists( $mx_root_path . 'mx_login.'.$phpEx ) ); } // // Check if mx_common Mod is prezent // if (!file_exists($mx_mod_path . "includes/functions_admincp.$phpEx")) { die('mx mod is not uploaded!!!'); } else { require($mx_mod_path . "includes/functions_admincp.$phpEx"); } $page_title = 'Uninstalling Knowledge Base'; include($phpbb_root_path . 'includes/page_header.'.$phpEx); $sql = array( "DROP TABLE " . $table_prefix . "kb_articles ", "DROP TABLE " . $table_prefix . "kb_categories ", "DROP TABLE " . $table_prefix . "kb_config ", "DROP TABLE " . $table_prefix . "kb_types ", //"DROP TABLE " . $table_prefix . "kb_wordlist ", //"DROP TABLE " . $table_prefix . "kb_results ", //"DROP TABLE " . $table_prefix . "kb_wordmatch ", "DROP TABLE " . $table_prefix . "kb_votes ", "DROP TABLE " . $table_prefix . "kb_custom ", "DROP TABLE " . $table_prefix . "kb_comments ", "DROP TABLE " . $table_prefix . "kb_customdata " ); echo "<br /><br />"; echo "<table width=\"90%\" align=\"center\" cellpadding=\"4\" cellspacing=\"1\" border=\"0\" class=\"forumline\">"; echo "<tr><th class=\"thHead\" align=\"center\">Mod Installation/Upgrading/Uninstalling Information - mod specific db tables</th></tr>"; echo "<tr><td class=\"row1\" align=\"left\"><span class=\"gen\">" . mx_do_install_upgrade( $sql ) . "</span></td></tr>"; echo "</table><br />"; include($phpbb_root_path . 'includes/page_tail.'.$phpEx); ?> |