|
From: Jon O. <jon...@us...> - 2005-04-09 21:41:37
|
Update of /cvsroot/mxbb/mx_kb In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1717/modules/mx_kb Modified Files: db_install.php db_uninstall.php db_upgrade.php kb.php kb_article_reader.php kb_search.php Added Files: install.txt install_kb_tables.php upgrade_kb_tables.php Removed Files: KnowledgeBase (core 27x).pak Kopia av KnowledgeBase (core 28).pak Log Message: dev work is kept up in the dev forums... Index: kb.php =================================================================== RCS file: /cvsroot/mxbb/mx_kb/kb.php,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** kb.php 5 Apr 2005 20:52:30 -0000 1.17 --- kb.php 9 Apr 2005 21:41:28 -0000 1.18 *************** *** 20,143 **** * (at your option) any later version. */ ! // MX ! if ( !function_exists( 'read_block_config' ) ) { ! if ( MXBB_27x ) ! { ! mx_message_die(GENERAL_MESSAGE, 'This module does not support standalone usage. In the adminCP, add the kb block to a portal page'); ! } define( 'IN_PORTAL', true ); ! $mx_root_path = '../../'; ! include_once( $mx_root_path . 'extension.inc' ); ! include_once( $mx_root_path . 'common.' . $phpEx ); // Start session management ! $userdata = session_pagestart( $user_ip, PAGE_INDEX ); ! mx_init_userprefs( $userdata ); // End session management ! ! if ( isset( $HTTP_POST_VARS['mode'] ) || isset( $HTTP_GET_VARS['mode'] ) ) ! { ! $mode = ( isset( $HTTP_POST_VARS['mode'] ) ) ? $HTTP_POST_VARS['mode'] : $HTTP_GET_VARS['mode']; ! $mode = htmlspecialchars( $mode ); ! } ! ! if ( isset( $HTTP_GET_VARS['print'] ) ) ! { ! $block_id = ( !empty( $HTTP_GET_VARS['block_id'] ) ) ? $HTTP_GET_VARS['block_id'] : $HTTP_POST_VARS['id']; ! if ( empty( $block_id ) ) ! { ! $sql = "SELECT * FROM " . BLOCK_TABLE . " WHERE block_title = 'KB' LIMIT 1"; ! if ( !$result = $db->sql_query( $sql ) ) ! { ! message_die( GENERAL_ERROR, "Could not query Smartor_Album module information", "", __LINE__, __FILE__, $sql ); ! } ! $row = $db->sql_fetchrow( $result ); ! $block_id = $row['block_id']; ! } ! $is_block = false; ! } ! else { ! if ( isset( $HTTP_POST_VARS['mode'] ) || isset( $HTTP_GET_VARS['mode'] ) ) ! { ! $mode = ( isset( $HTTP_POST_VARS['mode'] ) ) ? $HTTP_POST_VARS['mode'] : $HTTP_GET_VARS['mode']; ! $mode = htmlspecialchars( $mode ); ! } ! if ( isset( $HTTP_POST_VARS['stats'] ) || isset( $HTTP_GET_VARS['stats'] ) ) ! { ! $stats = ( isset( $HTTP_POST_VARS['stats'] ) ) ? $HTTP_POST_VARS['stats'] : $HTTP_GET_VARS['stats']; ! $stats = htmlspecialchars( $stats ); ! } ! ! include_once( $module_root_path . 'includes/kb_constants.' . $phpEx ); ! include_once( $module_root_path . 'includes/kb_pages.' . $phpEx ); ! $start = ( isset( $HTTP_GET_VARS['start'] ) ) ? intval( $HTTP_GET_VARS['start'] ) : 0; ! $url = ''; ! if ( !$article_id ) ! { ! $url = PORTAL_URL . 'index.php?page=' . $kb_pages . '&mode=cat&cat=' . $cat_id; ! } ! else if ( $cat_id != '' && $article_id != '' ) ! { ! $url = PORTAL_URL . 'index.php?page=' . $kb_pages . '&mode=article&k=' . $article_id; ! } ! if ( !empty( $url ) && !$kb_error ) { ! if ( !empty( $db ) ) { ! $db->sql_close(); ! } ! ! if ( @preg_match( '/Microsoft|WebSTAR|Xitami/', getenv( 'SERVER_SOFTWARE' ) ) ) { ! header( 'Refresh: 0; URL=' . $url ); ! echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">' . "\n" . '<html><head>' . "\n" . '<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">' . "\n" . '<meta http-equiv="refresh" content="0; url=' . $url . '">' . "\n" . '<title>Redirect</title>' . "\n" . '<script language="javascript" type="text/javascript">' . "\n" . '<!--' . "\n" . 'if( document.images ) {' . "\n" . "\t" . 'parent.location.replace("' . $url . '");' . "\n" . '} else {' . "\n" . "\t" . 'parent.location.href = "' . $url . '";' . "\n" . '}' . "\n" . '// -->' . "\n" . '</script>' . "\n" . '</head>' . "\n" . '<body>' . "\n" . '<div align="center">If your browser does not support meta redirection please click ' . '<a href="' . $url . '">HERE</a> to be redirected</div>' . "\n" . '</body></html>'; ! exit; } - @header( 'Location: ' . $url ); - } - else - { - die('no article, no redirect'); } } ! } ! else ! { ! // Read block Configuration ! $block_config = read_block_config( $block_id ); ! $title = !empty( $block_config[$block_id]['block_title'] ) ? $block_config[$block_id]['block_title'] : $lang['KB_title']; ! $desc = $block_config[$block_id]['block_desc']; ! $block_size = ( isset( $block_size ) && !empty( $block_size ) ? $block_size : '100%' ); ! ! $is_block = true; ! global $images; } ! define('MXBB_MODULE', true); ! define('MXBB_27x', true); ! ! // Extract 'what posts to view info', the cool Array ;) ! $kb_type_select_data = array(); ! $kb_type_select_temp = $block_config[$block_id][kb_type_select]['parameter_value']; ! $kb_type_select_temp = stripslashes( $kb_type_select_temp ); ! $kb_type_select_data = eval( "return " . $kb_type_select_temp . ";" ); ! include_once( $phpbb_root_path . 'includes/functions_post.' . $phpEx ); ! include( $module_root_path . 'includes/kb_constants.' . $phpEx ); ! include_once( $module_root_path . 'includes/functions_kb.' . $phpEx ); ! include_once( $module_root_path . 'includes/functions_kb_auth.' . $phpEx ); ! include_once( $module_root_path . 'includes/functions_kb_field.' . $phpEx ); ! include_once( $module_root_path . 'includes/functions_kb_mx.' . $phpEx ); ! include_once( $phpbb_root_path . 'includes/functions_search.' . $phpEx ); // Instanciate custom fields --- 20,156 ---- * (at your option) any later version. */ ! ! // Switch for making this run as a phpBB MOD or mxBB module ! ! if ( file_exists( './viewtopic.php' ) ) // -------------------------------------------- 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 = './'; ! ! include( $phpbb_root_path . 'extension.inc' ); ! include( $phpbb_root_path . 'common.' . $phpEx ); ! ! define( 'PAGE_KB', -500 ); // If this id generates a conflict with other mods, change it ;) // Start session management ! $userdata = session_pagestart( $user_ip, PAGE_KB ); ! init_userprefs( $userdata ); // End session management ! ! include( $phpbb_root_path . 'includes/functions_post.' . $phpEx ); ! include( $phpbb_root_path . 'includes/kb_constants.' . $phpEx ); ! include( $phpbb_root_path . 'includes/functions_kb.' . $phpEx ); ! include( $phpbb_root_path . 'includes/functions_kb_auth.' . $phpEx ); ! include( $phpbb_root_path . 'includes/functions_kb_field.' . $phpEx ); ! include( $phpbb_root_path . 'includes/functions_kb_mx.' . $phpEx ); ! include_once( $phpbb_root_path . 'includes/bbcode.' . $phpEx ); ! include_once( $phpbb_root_path . 'includes/functions_search.' . $phpEx ); ! } ! else // --------------------------------------------------------------------------------- mxBB Module MODE ! { ! define( 'MXBB_MODULE', true ); ! ! if ( !function_exists( 'read_block_config' ) ) { ! define( 'IN_PORTAL', true ); ! $mx_root_path = './../../'; ! include_once( $mx_root_path . 'extension.inc' ); ! include_once( $mx_root_path . 'common.' . $phpEx ); ! // Start session management ! $userdata = session_pagestart( $user_ip, PAGE_INDEX ); ! mx_init_userprefs( $userdata ); ! // End session management ! ! define( 'MXBB_27x', file_exists( $mx_root_path . 'more_smilies.php' ) ); ! if ( !isset( $HTTP_GET_VARS['print'] ) ) { ! include_once( $module_root_path . 'includes/kb_constants.' . $phpEx ); ! include_once( $module_root_path . 'includes/kb_pages.' . $phpEx ); ! ! $start = ( isset( $HTTP_GET_VARS['start'] ) ) ? intval( $HTTP_GET_VARS['start'] ) : 0; ! ! $url = ''; ! if ( empty( $article_id ) ) { ! $url = PORTAL_URL . 'index.php?page=' . $kb_pages . '&mode=cat&cat=' . $cat_id; ! } ! else if ( !empty( $article_id ) ) { ! $url = PORTAL_URL . 'index.php?page=' . $kb_pages . '&mode=article&k=' . $article_id; ! } ! ! if ( !empty( $url ) && !$kb_error ) ! { ! if ( !empty( $db ) ) ! { ! $db->sql_close(); ! } ! ! if ( @preg_match( '/Microsoft|WebSTAR|Xitami/', getenv( 'SERVER_SOFTWARE' ) ) ) ! { ! header( 'Refresh: 0; URL=' . $url ); ! echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">' . "\n" . '<html><head>' . "\n" . '<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">' . "\n" . '<meta http-equiv="refresh" content="0; url=' . $url . '">' . "\n" . '<title>Redirect</title>' . "\n" . '<script language="javascript" type="text/javascript">' . "\n" . '<!--' . "\n" . 'if( document.images ) {' . "\n" . "\t" . 'parent.location.replace("' . $url . '");' . "\n" . '} else {' . "\n" . "\t" . 'parent.location.href = "' . $url . '";' . "\n" . '}' . "\n" . '// -->' . "\n" . '</script>' . "\n" . '</head>' . "\n" . '<body>' . "\n" . '<div align="center">If your browser does not support meta redirection please click ' . '<a href="' . $url . '">HERE</a> to be redirected</div>' . "\n" . '</body></html>'; ! exit; ! } ! @header( 'Location: ' . $url ); ! } ! else ! { ! if ( MXBB_27x ) ! { ! mx_message_die(GENERAL_MESSAGE, 'This module does not support standalone usage. In the adminCP, add the kb block to a portal page.'); ! } ! else ! { ! die('no article, no redirect'); ! } } } } ! else ! { ! define( 'MXBB_27x', file_exists( $mx_root_path . 'more_smilies.php' ) ); ! ! // Read block Configuration ! ! $block_config = read_block_config( $block_id ); ! $title = !empty( $block_config[$block_id]['block_title'] ) ? $block_config[$block_id]['block_title'] : $lang['KB_title']; ! $desc = $block_config[$block_id]['block_desc']; ! $block_size = ( isset( $block_size ) && !empty( $block_size ) ? $block_size : '100%' ); ! $is_block = true; ! global $images; ! } ! // Extract 'what posts to view info', the cool Array ;) ! $kb_type_select_data = array(); ! $kb_type_select_temp = $block_config[$block_id][kb_type_select]['parameter_value']; ! $kb_type_select_temp = stripslashes( $kb_type_select_temp ); ! $kb_type_select_data = eval( "return " . $kb_type_select_temp . ";" ); ! ! include_once( $phpbb_root_path . 'includes/functions_post.' . $phpEx ); ! include( $module_root_path . 'includes/kb_constants.' . $phpEx ); ! include_once( $module_root_path . 'includes/functions_kb.' . $phpEx ); ! include_once( $module_root_path . 'includes/functions_kb_auth.' . $phpEx ); ! include_once( $module_root_path . 'includes/functions_kb_field.' . $phpEx ); ! include_once( $module_root_path . 'includes/functions_kb_mx.' . $phpEx ); ! include_once( $phpbb_root_path . 'includes/functions_search.' . $phpEx ); } ! // ------------------------------------------------------------------------------------------------------------------------- ! // ------------------------------------------------------------------------------------------------------------------------- ! // ------------------------------------------------------------------------------------------------------------------------- ! // Start KB SCRIPT // Instanciate custom fields *************** *** 179,186 **** else { ! while ( $row = $db->sql_fetchrow( $result ) ) { ! $config_name = $row['config_name']; ! $config_value = $row['config_value']; $kb_config[$config_name] = $config_value; } --- 192,199 ---- else { ! while ( $kb_config_row = $db->sql_fetchrow( $result ) ) { ! $config_name = $kb_config_row['config_name']; ! $config_value = $kb_config_row['config_value']; $kb_config[$config_name] = $config_value; } *************** *** 207,233 **** } ! // Newssuite operation mode? ! //------------------------------------------------------------------------- ! $total_blockk = count( $HTTP_SESSION_VARS['mx_pages']['page_' . $page_id]['blocks'] ); ! ! $kb_config['news_operate_mode'] = ''; ! for( $blockk = 0; $blockk < $total_blockk; $blockk++ ) { ! if ( $HTTP_SESSION_VARS['block_' . $block_rows[$blockk]['block_id']]['news_source_switch']['parameter_value'] == 'kb' && $HTTP_SESSION_VARS['block_' . $block_rows[$blockk]['block_id']]['news_mode_operate']['parameter_value'] == 'Source' ) ! { ! $newssuite_select_par = $HTTP_SESSION_VARS['block_' . $block_rows[$blockk]['block_id']]['news_type_select']['parameter_value']; ! // Extract 'what posts to view info', the cool Array ;) ! $news_type_select_data = array(); ! $news_type_select_temp = $newssuite_select_par; ! $news_type_select_temp = stripslashes( $news_type_select_temp ); ! $news_type_select_data = eval( "return " . $news_type_select_temp . ";" ); ! $kb_config['news_operate_mode'] = true; ! } ! else { ! $kb_config['news_operate_mode'] = ''; ! } ! } ! // ------------------------------------------------------------------------- $is_admin = ( ( $userdata['user_level'] == ADMIN ) && $userdata['session_logged_in'] ) ? true : 0; --- 220,249 ---- } ! if ( MXBB_MODULE ) { ! // Newssuite operation mode? ! //------------------------------------------------------------------------- ! $total_blockk = count( $HTTP_SESSION_VARS['mx_pages']['page_' . $page_id]['blocks'] ); ! ! $kb_config['news_operate_mode'] = ''; ! for( $blockk = 0; $blockk < $total_blockk; $blockk++ ) { ! if ( $HTTP_SESSION_VARS['block_' . $block_rows[$blockk]['block_id']]['news_source_switch']['parameter_value'] == 'kb' && $HTTP_SESSION_VARS['block_' . $block_rows[$blockk]['block_id']]['news_mode_operate']['parameter_value'] == 'Source' ) ! { ! $newssuite_select_par = $HTTP_SESSION_VARS['block_' . $block_rows[$blockk]['block_id']]['news_type_select']['parameter_value']; ! // Extract 'what posts to view info', the cool Array ;) ! $news_type_select_data = array(); ! $news_type_select_temp = $newssuite_select_par; ! $news_type_select_temp = stripslashes( $news_type_select_temp ); ! $news_type_select_data = eval( "return " . $news_type_select_temp . ";" ); ! $kb_config['news_operate_mode'] = true; ! } ! else ! { ! $kb_config['news_operate_mode'] = ''; ! } ! } ! // ------------------------------------------------------------------------- ! } $is_admin = ( ( $userdata['user_level'] == ADMIN ) && $userdata['session_logged_in'] ) ? true : 0; *************** *** 238,242 **** { $mode = ( isset( $HTTP_POST_VARS['mode'] ) ) ? $HTTP_POST_VARS['mode'] : $HTTP_GET_VARS['mode']; ! $mode = htmlspecialchars( $mode ); } --- 254,258 ---- { $mode = ( isset( $HTTP_POST_VARS['mode'] ) ) ? $HTTP_POST_VARS['mode'] : $HTTP_GET_VARS['mode']; ! $mode = ( htmlspecialchars( $mode ) != 'cat' || intval ($HTTP_GET_VARS['cat'] ) != 0 ) ? htmlspecialchars( $mode ) : ''; } *************** *** 305,309 **** // load footer ! include ( $module_root_path . "includes/kb_footer." . $phpEx ); if ( !$is_block && !$print_version ) --- 321,328 ---- // load footer ! if ( !$print_version ) ! { ! include ( $module_root_path . "includes/kb_footer." . $phpEx ); ! } if ( !$is_block && !$print_version ) --- NEW FILE: upgrade_kb_tables.php --- <?php /*************************************************************************** * install_kb_tables.php * ------------------- * begin : Wednesday, May 16, 2002 * copyright : Eric * email : er...@eg... * * $Id: install_kb_tables.php * ***************************************************************************/ /*************************************************************************** * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * ***************************************************************************/ define('IN_PHPBB', 1); define( 'MXBB_MODULE', false ); // Switch for making this run as a phpBB mod or mxBB module $phpbb_root_path = './'; include($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'config.'.$phpEx); include($phpbb_root_path . 'includes/constants.'.$phpEx); include($phpbb_root_path . 'common.'.$phpEx); include($phpbb_root_path . 'includes/db.'.$phpEx); include($phpbb_root_path . 'includes/kb_constants.'.$phpEx); // A few additional checks to avoid blunders during install/upgrade define( 'phpBBroot_ok', file_exists( $phpbb_root_path . 'viewtopic.php' ) ); define( 'kbconstants_ok', defined( 'KB_CUSTOM_TABLE' ) ); if ( !phpBBroot_ok ) { message_die(GENERAL_ERROR, "This install/upgrade script should be uploaded to the phpBB root."); } if ( !kbconstants_ok ) { message_die(GENERAL_ERROR, "You haven't uploaded latest kb_constants.php."); } $userdata = session_pagestart($user_ip, PAGE_INDEX); init_userprefs($userdata); if ( $userdata['user_level'] != ADMIN ) { message_die(GENERAL_ERROR, "You must be an Administrator to use this page."); } define('KB_VERSION','KB MOD 2.0.1e'); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <title>Install File for MOD's</title> <head> <meta http-equiv="Content-Type" content="text/html;"> <meta http-equiv="Content-Style-Type" content="text/css"> <style type="text/css"> </style> </head> <body bgcolor="#FFFFFF" text="#000000" link="#006699" vlink="#5584AA"> <table width="100%" border="0" cellspacing="0" cellpadding="10" align="center"> <tr> <td><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td><a href="./index.php"><img src="./templates/subSilver/images/logo_phpBB.gif" border="0" alt="Forum Home" vspace="1" /></a></td> <td align="center" width="100%" valign="middle"><span class="maintitle">Installing Knowledge Base</span></td> </tr> </table></td> </tr> </table> <br clear="all" /> <h2>Information</h2> <?php // get the phpBB version $sql = "SELECT config_value FROM " . CONFIG_TABLE . " WHERE config_name = 'version'"; if ( !($result = $db->sql_query($sql)) ) { die("Couldn't obtain version info"); } $row = $db->sql_fetchrow($result); $phpBB_version = $row['config_value'] ; $sql = array(); // output some info echo '<p>Database type :: <b>' . SQL_LAYER . '</b><br />'; echo 'phpBB version :: <b>2' . $phpBB_version . '</b><br />'; echo 'Upgrading Knowledge Base to :: <b>' . KB_VERSION . '</b></p> From KB Beta 0.7.6 + mxaddon 1.x' ."\n"; ?> <br clear="all" /> <h3>What are you going to do ?</h3> This file is used to do the changes to your database (adding/modifying a table) to make the MOD working properly. If you have any problem during this part, you can contact me to get support. Now, if you are ready, click on the button. <br clear="all" /> <center> <form action="upgrade_kb_tables.php" method=POST> <input type="submit" name="submit" value="submit" class="liteoption" /> </form> </center> <?php $submit = ( isset($HTTP_POST_VARS['submit']) ) ? $HTTP_POST_VARS['submit'] : 0; $res_message = ""; // Upgrade checks $upgrade_101 = 0; $upgrade_102 = 0; $upgrade_103 = 0; $upgrade_200 = 0; $upgrade_201 = 0; // validate before 1.01 if( !$result = $db->sql_query("SELECT article_rating from ".KB_ARTICLES_TABLE)) { $upgrade_101 = 1; $res_message .= "Upgrading to v. 1.01...<br />"; } else { $res_message .= "v. 1.01 : installed<br />"; } // validate before 1.02 if( !$result = $db->sql_query("SELECT votes_userid from ".KB_VOTES_TABLE)) { $upgrade_102 = 1; $res_message .= "Upgrading to v. 1.02...<br />"; } else { $res_message .= "v. 1.02 : installed<br />"; } // validate before 1.03 $result = $db->sql_query( "SELECT config_value from " . KB_CONFIG_TABLE . " WHERE config_name = 'comments_pagination'" ); if ( $db->sql_numrows( $result ) == 0 ) { $upgrade_103 = 1; $res_message .= "Upgrading to v. 1.03...<br />"; } else { $res_message .= "v. 1.03 : installed <br />"; } // validate before 2.00 $result = $db->sql_query( "SELECT config_value from " . KB_CONFIG_TABLE . " WHERE config_name = 'wysiwyg'" ); if( $db->sql_numrows( $result ) == 0 ) { $upgrade_200 = 1; $res_message .= "Upgrading to v. 2.00...<br />"; } else { $res_message .= "v. 2.00 : installed <br />"; } // validate before 2.01 $result = $db->sql_query( "SELECT config_value from " . KB_CONFIG_TABLE . " WHERE config_name = 'wysiwyg_path'" ); if( $db->sql_numrows( $result ) == 0 ) { $upgrade_201 = 1; $res_message .= "Upgrading to v. 2.01...<br />"; } else { $res_message .= "v. 2.01 : installed <br />"; } if ( $submit ) { switch ( SQL_LAYER ) { case 'mysql': case 'mysql4': if ( $upgrade_101 == 1 ) { $sql[] = 'ALTER TABLE ' . KB_ARTICLES_TABLE . ' ADD article_rating double(6,4) NOT NULL default "0.0000" ;'; $sql[] = 'ALTER TABLE ' . KB_ARTICLES_TABLE . ' ADD article_totalvotes int(255) NOT NULL default "0" ;'; // Upgrade the config table to avoid duplicate entries $sql[] = 'ALTER TABLE '. KB_CONFIG_TABLE.' MODIFY config_name VARCHAR(255) NOT NULL default "" ;'; $sql[] = 'ALTER TABLE '. KB_CONFIG_TABLE.' MODIFY config_value VARCHAR(255) NOT NULL default "" ;'; $sql[] = 'ALTER TABLE '. KB_CONFIG_TABLE.' DROP PRIMARY KEY, ADD PRIMARY KEY (config_name) ;'; $sql[] = 'INSERT INTO '.KB_CONFIG_TABLE.' (config_name, config_value) VALUES ("allow_rating", "0") ;'; $sql[] = 'INSERT INTO '.KB_CONFIG_TABLE.' (config_name, config_value) VALUES ("allow_anonymos_rating", "0") ;'; $sql[] = 'INSERT INTO '.KB_CONFIG_TABLE.' (config_name, config_value) VALUES ("comments_show", "1") ;'; $sql[] = 'INSERT INTO '.KB_CONFIG_TABLE.' (config_name, config_value) VALUES ("mod_group", "0") ;'; $sql[] = 'INSERT INTO '.KB_CONFIG_TABLE.' (config_name, config_value) VALUES ("bump_post", "1") ;'; $sql[] = 'INSERT INTO '.KB_CONFIG_TABLE.' (config_name, config_value) VALUES ("stats_list", "1") ;'; $sql[] = 'INSERT INTO '.KB_CONFIG_TABLE.' (config_name, config_value) VALUES ("header_banner", "1") ;'; $sql[] = 'CREATE TABLE '.KB_VOTES_TABLE.' ( votes_ip varchar(50) NOT NULL default "0", votes_userid int(50) NOT NULL default "0", votes_file int(50) NOT NULL default "0" ) TYPE=MyISAM'; } if ( $upgrade_102 == 1 ) { $sql[] = 'INSERT INTO '.KB_CONFIG_TABLE.' (config_name, config_value) VALUES ("votes_check_userid", "1");'; $sql[] = 'INSERT INTO '.KB_CONFIG_TABLE.' (config_name, config_value) VALUES ("votes_check_ip", "1");'; $sql[] = 'INSERT INTO '.KB_CONFIG_TABLE.' (config_name, config_value) VALUES ("art_pagination", "5");'; // $sql[] = 'ALTER TABLE ' . KB_VOTES_TABLE . ' ADD votes_userid int(50) NOT NULL default "0" AFTER votes_ip'; } if ( $upgrade_103 == 1 ) { $sql[] = 'INSERT INTO '.KB_CONFIG_TABLE.' (config_name, config_value) VALUES ("comments_pagination", "5");'; $sql[] = 'INSERT INTO '.KB_CONFIG_TABLE.' (config_name, config_value) VALUES ("news_sort", "Alphabetic");'; $sql[] = 'INSERT INTO '.KB_CONFIG_TABLE.' (config_name, config_value) VALUES ("news_sort_par", "ASC");'; } if ( $upgrade_200 == 1 ) { $sql[] = 'ALTER TABLE ' . KB_CATEGORIES_TABLE . ' ADD auth_view tinyint(3) NOT NULL DEFAULT "0" ;'; $sql[] = 'ALTER TABLE ' . KB_CATEGORIES_TABLE . ' ADD auth_post tinyint(3) NOT NULL DEFAULT "0" ;'; $sql[] = 'ALTER TABLE ' . KB_CATEGORIES_TABLE . ' ADD auth_rate tinyint(3) NOT NULL DEFAULT "0" ;'; $sql[] = 'ALTER TABLE ' . KB_CATEGORIES_TABLE . ' ADD auth_comment tinyint(3) NOT NULL DEFAULT "0" ;'; $sql[] = 'ALTER TABLE ' . KB_CATEGORIES_TABLE . ' ADD auth_edit tinyint(3) NOT NULL DEFAULT "0" ;'; $sql[] = 'ALTER TABLE ' . KB_CATEGORIES_TABLE . ' ADD auth_delete tinyint(3) NOT NULL DEFAULT "2" ;'; $sql[] = 'ALTER TABLE ' . KB_CATEGORIES_TABLE . ' ADD auth_approval tinyint(3) NOT NULL DEFAULT "0" ;'; $sql[] = 'ALTER TABLE ' . KB_CATEGORIES_TABLE . ' ADD auth_approval_edit tinyint(3) NOT NULL DEFAULT "0" ;'; $sql[] = 'ALTER TABLE ' . KB_CATEGORIES_TABLE . ' ADD auth_view_groups varchar(255) ;'; $sql[] = 'ALTER TABLE ' . KB_CATEGORIES_TABLE . ' ADD auth_post_groups varchar(255) ;'; $sql[] = 'ALTER TABLE ' . KB_CATEGORIES_TABLE . ' ADD auth_rate_groups varchar(255) ;'; $sql[] = 'ALTER TABLE ' . KB_CATEGORIES_TABLE . ' ADD auth_comment_groups varchar(255) ;'; $sql[] = 'ALTER TABLE ' . KB_CATEGORIES_TABLE . ' ADD auth_edit_groups varchar(255) ;'; $sql[] = 'ALTER TABLE ' . KB_CATEGORIES_TABLE . ' ADD auth_delete_groups varchar(255) ;'; $sql[] = 'ALTER TABLE ' . KB_CATEGORIES_TABLE . ' ADD auth_approval_groups varchar(255) ;'; $sql[] = 'ALTER TABLE ' . KB_CATEGORIES_TABLE . ' ADD auth_approval_edit_groups varchar(255) ;'; $sql[] = 'ALTER TABLE ' . KB_CATEGORIES_TABLE . ' ADD auth_moderator_groups varchar(255) ;'; $sql[] = 'ALTER TABLE ' . KB_CATEGORIES_TABLE . ' ADD comments_forum_id tinyint(3) NOT NULL DEFAULT "-1" ;'; $sql[] = 'UPDATE ' . KB_CONFIG_TABLE . ' SET config_name = "use_comments", config_value = "1" WHERE config_name = "comments" ;'; $sql[] = 'UPDATE ' . KB_CONFIG_TABLE . ' SET config_name = "use_ratings", config_value = "1" WHERE config_name = "allow_rating" ;'; $sql[] = 'INSERT INTO '.KB_CONFIG_TABLE.' (config_name, config_value) VALUES ("wysiwyg", "0");'; $sql[] = 'INSERT INTO '.KB_CONFIG_TABLE.' (config_name, config_value) VALUES ("allow_html", "1");'; $sql[] = 'INSERT INTO '.KB_CONFIG_TABLE.' (config_name, config_value) VALUES ("allow_bbcode", "1");'; $sql[] = 'INSERT INTO '.KB_CONFIG_TABLE.' (config_name, config_value) VALUES ("allow_smilies", "1");'; $sql[] = 'INSERT INTO '.KB_CONFIG_TABLE.' (config_name, config_value) VALUES ("allowed_html_tags", "b,i,u,a");'; $sql[] = 'CREATE TABLE ' . KB_CUSTOM_TABLE . ' ( 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) ) TYPE=MyISAM;'; $sql[] = 'CREATE TABLE ' . KB_CUSTOM_DATA_TABLE . ' ( customdata_file int(50) NOT NULL default "0", customdata_custom int(50) NOT NULL default "0", data text NOT NULL ) TYPE=MyISAM;'; } if ( $upgrade_201 == 1 ) { $sql[] = 'INSERT INTO '.KB_CONFIG_TABLE.' (config_name, config_value) VALUES ("wysiwyg_path", "modules/");'; $sql[] = 'INSERT INTO '.KB_CONFIG_TABLE.' (config_name, config_value) VALUES ("formatting_fixup", "0");'; $sql[] = 'ALTER TABLE ' . KB_ARTICLES_TABLE . ' MODIFY article_author_id mediumint(8) NOT NULL ;'; } break; case 'mssql': case 'mssql-odbc': default: die("/!\ No Database Abstraction Layer (DBAL) found /!\\"); break; } echo("<h2>Adding/modifying tables to your database</h2>\n"); for ($i=0; $i < count($sql); $i++) { echo("Running query :: " . $sql[$i]); flush(); if ( !($result = $db->sql_query($sql[$i])) ) { $error_code = TRUE; $error = $db->sql_error(); echo(" -> <b><span class=\"error\">ERROR - QUERY FAILED</span></b> ----> <u>" . $error['message'] . "</u><br /><br />\n\n"); } else { echo(" -> <b><span class=\"ok\">GOOD - QUERY OK</span></b><br /><br />\n\n"); } } if ( $error_code ) { $res_message .= "<br />At least one query failed : check the error message and contact me if you need help to resolve the problem. <br />"; } else { $res_message .= "<br />All the queries have been successfully done - Enjoy. <br />"; } echo("\n<br />\n<b>COMPLETE - INSTALLATION IS ENDED</b><br />\n"); echo($res_message . "<br />"); echo("<br /><b>NOW, DELETE THIS FILE FROM YOUR SERVER</b><br />\n"); } ?> </body> </html> --- NEW FILE: install_kb_tables.php --- <?php /*************************************************************************** * install_kb_tables.php * ------------------- * begin : Wednesday, May 16, 2002 * copyright : Eric * email : er...@eg... * * $Id: install_kb_tables.php * ***************************************************************************/ /*************************************************************************** * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * ***************************************************************************/ define('IN_PHPBB', 1); $phpbb_root_path = './'; define( 'MXBB_MODULE', false ); // Switch for making this run as a phpBB mod or mxBB module include($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'config.'.$phpEx); include($phpbb_root_path . 'includes/constants.'.$phpEx); include($phpbb_root_path . 'common.'.$phpEx); include($phpbb_root_path . 'includes/db.'.$phpEx); include($phpbb_root_path . 'includes/kb_constants.'.$phpEx); // A few additional checks to avoid blunders during install/upgrade define( 'phpBBroot_ok', file_exists( $phpbb_root_path . 'viewtopic.php' ) ); define( 'kbconstants_ok', defined( 'KB_CUSTOM_TABLE' ) ); if ( !phpBBroot_ok ) { message_die(GENERAL_ERROR, "This install/upgrade script should be uploaded to the phpBB root."); } if ( !kbconstants_ok ) { message_die(GENERAL_ERROR, "You haven't uploaded latest kb_constants.php."); } $userdata = session_pagestart($user_ip, PAGE_INDEX); init_userprefs($userdata); if ( $userdata['user_level'] != ADMIN ) { message_die(GENERAL_ERROR, "You must be an Administrator to use this page."); } $userdata = session_pagestart($user_ip, PAGE_INDEX); init_userprefs($userdata); if ( $userdata['user_level'] != ADMIN ) { message_die(GENERAL_ERROR, "You must be an Administrator to use this page."); } define('KB_VERSION','KB MOD 2.0.1e'); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <title>Install File for MOD's</title> <head> <meta http-equiv="Content-Type" content="text/html;"> <meta http-equiv="Content-Style-Type" content="text/css"> <style type="text/css"> </style> </head> <body bgcolor="#FFFFFF" text="#000000" link="#006699" vlink="#5584AA"> <table width="100%" border="0" cellspacing="0" cellpadding="10" align="center"> <tr> <td><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td><a href="./index.php"><img src="./templates/subSilver/images/logo_phpBB.gif" border="0" alt="Forum Home" vspace="1" /></a></td> <td align="center" width="100%" valign="middle"><span class="maintitle">Installing Knowledge Base</span></td> </tr> </table></td> </tr> </table> <br clear="all" /> <h2>Information</h2> <?php // get the phpBB version $sql = "SELECT config_value FROM " . CONFIG_TABLE . " WHERE config_name = 'version'"; if ( !($result = $db->sql_query($sql)) ) { die("Couldn't obtain version info"); } $row = $db->sql_fetchrow($result); $phpBB_version = $row['config_value'] ; $sql = array(); // output some info echo '<p>Database type :: <b>' . SQL_LAYER . '</b><br />'; echo 'phpBB version :: <b>2' . $phpBB_version . '</b><br />'; echo 'Knowledge Base MOD version :: <b>' . KB_VERSION . '</b></p>' ."\n"; ?> <br clear="all" /> <h3>What are you going to do ?</h3> This file is used to do the changes to your database (adding/modifying a table) to make the MOD working properly. If you have any problem during this part, you can contact me to get support. Now, if you are ready, click on the button. <br clear="all" /> <center> <form action="install_kb_tables.php" method=POST> <input type="submit" name="submit" value="submit" class="liteoption" /> </form> </center> <?php $submit = ( isset($HTTP_POST_VARS['submit']) ) ? $HTTP_POST_VARS['submit'] : 0; if ( $submit ) { switch ( SQL_LAYER ) { case 'mysql': case 'mysql4': $sql[]= 'CREATE TABLE '. KB_ARTICLES_TABLE .' ( article_id mediumint(8) unsigned NOT NULL auto_increment, article_category_id mediumint(8) unsigned NOT NULL default "0", article_title varchar(255) binary NOT NULL default "", article_description varchar(255) binary NOT NULL default "", article_date varchar(255) binary NOT NULL default "", article_author_id mediumint(8) NOT NULL, username VARCHAR(255), bbcode_uid varchar(10) binary NOT NULL default "", article_body text NOT NULL, article_type mediumint(8) unsigned NOT NULL default "0", approved tinyint(1) unsigned NOT NULL default "0", topic_id mediumint(8) unsigned NOT NULL default "0", views BIGINT(8) NOT NULL DEFAULT "0", article_rating double(6,4) NOT NULL default "0.0000", article_totalvotes int(255) NOT NULL default "0", KEY article_id (article_id) ) TYPE=MyISAM;'; $sql[] = 'INSERT INTO '. KB_ARTICLES_TABLE .' VALUES ( 1, 1, "Test Article", "This is a test article for your KB", "1057708235", 2, "", "93074f48a9", "This is a test article for your Knowledge Base. This MOD is based on code written by wGEric < er...@eg... > (Eric Faerber) - http://eric.best-1.biz/, now supervised by _Haplo < jon...@ho... > (Jon Ohlsson) - http://www.mx-system.com/ \r\n\r\nBe sure you add categories and article types in the ACP and also change the Configuration to your liking.\r\n\r\nHave fun and enjoy your new Knowledge Base! :D", 1, 1, 0, 0,0,0 );'; $sql[] = 'CREATE TABLE '.KB_CATEGORIES_TABLE.' ( category_id mediumint(8) unsigned NOT NULL auto_increment, category_name VARCHAR(255) binary NOT NULL, category_details VARCHAR(255) binary NOT NULL, number_articles mediumint(8) unsigned NOT NULL, parent mediumint(8) unsigned, cat_order mediumint(8) unsigned 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_comment tinyint(3) NOT NULL DEFAULT "0", 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), auth_post_groups varchar(255), auth_rate_groups varchar(255), auth_comment_groups varchar(255), auth_edit_groups varchar(255), auth_delete_groups varchar(255), auth_approval_groups varchar(255), auth_approval_edit_groups varchar(255), auth_moderator_groups varchar(255), comments_forum_id tinyint(3) NOT NULL DEFAULT "-1", KEY category_id (category_id) ) TYPE=MyISAM'; $sql[] = 'INSERT INTO '.KB_CATEGORIES_TABLE.' VALUES (1, "Test Category 1", "This is a test category", "0", "0", "10", "0", "0", "0", "0", "0", "2", "0", "0", "", "", "", "", "", "", "", "", "", "0" );'; $sql[] = 'CREATE TABLE '.KB_CONFIG_TABLE.' ( config_name VARCHAR(255) NOT NULL default "", config_value varchar(255) NOT NULL default "", PRIMARY KEY (config_name) ) TYPE=MyISAM'; $sql[] = 'INSERT INTO '.KB_CONFIG_TABLE.' (config_name, config_value) VALUES ("allow_new", "1")'; $sql[] = 'INSERT INTO '.KB_CONFIG_TABLE.' (config_name, config_value) VALUES ("notify", "1")'; $sql[] = 'INSERT INTO '.KB_CONFIG_TABLE.' (config_name, config_value) VALUES ("admin_id", "2")'; $sql[] = 'INSERT INTO '.KB_CONFIG_TABLE.' (config_name, config_value) values("show_pretext",0);'; $sql[] = 'INSERT INTO '.KB_CONFIG_TABLE.' (config_name, config_value) values("pt_header","Article Submission Instructions");'; $sql[] = 'INSERT INTO '.KB_CONFIG_TABLE.' (config_name, config_value) values("pt_body","Please check your references and include as much information as you can.");'; $sql[] = 'INSERT INTO '.KB_CONFIG_TABLE.' (config_name, config_value) VALUES ("use_comments", "1");'; $sql[] = 'INSERT INTO '.KB_CONFIG_TABLE.' (config_name, config_value) VALUES ("del_topic", "1");'; $sql[] = 'INSERT INTO '.KB_CONFIG_TABLE.' (config_name, config_value) VALUES ("use_ratings", "0");'; $sql[] = 'INSERT INTO '.KB_CONFIG_TABLE.' (config_name, config_value) VALUES ("comments_show", "1");'; $sql[] = 'INSERT INTO '.KB_CONFIG_TABLE.' (config_name, config_value) VALUES ("bump_post", "1");'; $sql[] = 'INSERT INTO '.KB_CONFIG_TABLE.' (config_name, config_value) VALUES ("stats_list", "1");'; $sql[] = 'INSERT INTO '.KB_CONFIG_TABLE.' (config_name, config_value) VALUES ("header_banner", "1");'; $sql[] = 'INSERT INTO '.KB_CONFIG_TABLE.' (config_name, config_value) VALUES ("votes_check_userid", "1");'; $sql[] = 'INSERT INTO '.KB_CONFIG_TABLE.' (config_name, config_value) VALUES ("votes_check_ip", "1");'; $sql[] = 'INSERT INTO '.KB_CONFIG_TABLE.' (config_name, config_value) VALUES ("art_pagination", "5");'; $sql[] = 'INSERT INTO '.KB_CONFIG_TABLE.' (config_name, config_value) VALUES ("comments_pagination", "5");'; $sql[] = 'INSERT INTO '.KB_CONFIG_TABLE.' (config_name, config_value) VALUES ("news_sort", "Alphabetic");'; $sql[] = 'INSERT INTO '.KB_CONFIG_TABLE.' (config_name, config_value) VALUES ("news_sort_par", "ASC");'; $sql[] = 'INSERT INTO '.KB_CONFIG_TABLE.' (config_name, config_value) VALUES ("wysiwyg", "0");'; $sql[] = 'INSERT INTO '.KB_CONFIG_TABLE.' (config_name, config_value) VALUES ("wysiwyg_path", "modules/");'; $sql[] = 'INSERT INTO '.KB_CONFIG_TABLE.' (config_name, config_value) VALUES ("allow_html", "1");'; $sql[] = 'INSERT INTO '.KB_CONFIG_TABLE.' (config_name, config_value) VALUES ("allow_bbcode", "1");'; $sql[] = 'INSERT INTO '.KB_CONFIG_TABLE.' (config_name, config_value) VALUES ("allow_smilies", "1");'; $sql[] = 'INSERT INTO '.KB_CONFIG_TABLE.' (config_name, config_value) VALUES ("formatting_fixup", "0");'; $sql[] = 'INSERT INTO '.KB_CONFIG_TABLE.' (config_name, config_value) VALUES ("allowed_html_tags", "b,i,u,a");'; $sql[] = 'CREATE TABLE ' . KB_TYPES_TABLE . ' ( id mediumint(8) unsigned NOT NULL auto_increment, type varchar(255) binary DEFAULT "" NOT NULL, KEY id (id) ) TYPE=MyISAM'; $sql[] = 'INSERT INTO '. KB_TYPES_TABLE . ' VALUES (1, "Test Type 1")'; $sql[] = 'CREATE TABLE '. KB_VOTES_TABLE . ' ( votes_ip varchar(50) NOT NULL default "0", votes_userid int(50) NOT NULL default "0", votes_file int(50) NOT NULL default "0" ) TYPE=MyISAM'; $sql[] = 'CREATE TABLE ' . KB_SEARCH_TABLE . ' ( search_id int(11) unsigned NOT NULL default "0", session_id varchar(32) NOT NULL default "", search_array text NOT NULL, PRIMARY KEY (search_id), KEY session_id (session_id) ) TYPE=MyISAM;'; $sql[] = 'CREATE TABLE ' . KB_WORD_TABLE . ' ( word_text varchar(50) binary NOT NULL default "", word_id mediumint(8) unsigned NOT NULL auto_increment, word_common tinyint(1) unsigned NOT NULL default "0", PRIMARY KEY (word_text), KEY word_id (word_id) ) TYPE=MyISAM;'; $sql[] = 'CREATE TABLE ' . KB_MATCH_TABLE . ' ( article_id mediumint(8) unsigned NOT NULL default "0", word_id mediumint(8) unsigned NOT NULL default "0", title_match tinyint(1) NOT NULL default "0", KEY post_id (article_id), KEY word_id (word_id) ) TYPE=MyISAM;'; $sql[] = 'CREATE TABLE ' . KB_CUSTOM_TABLE . ' ( 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) ) TYPE=MyISAM;'; $sql[] = 'CREATE TABLE ' . KB_CUSTOM_DATA_TABLE . ' ( customdata_file int(50) NOT NULL default "0", customdata_custom int(50) NOT NULL default "0", data text NOT NULL ) TYPE=MyISAM;'; break; case 'mssql': case 'mssql-odbc': default: die("/!\ No Database Abstraction Layer (DBAL) found /!\\"); break; } echo("<h2>Adding/modifying tables to your database</h2>\n"); for ($i=0; $i < count($sql); $i++) { echo("Running query :: " . $sql[$i]); flush(); if ( !($result = $db->sql_query($sql[$i])) ) { $error_code = TRUE; $error = $db->sql_error(); echo(" -> <b><span class=\"error\">ERROR - QUERY FAILED</span></b> ----> <u>" . $error['message'] . "</u><br /><br />\n\n"); } else { echo(" -> <b><span class=\"ok\">GOOD - QUERY OK</span></b><br /><br />\n\n"); } } $error_message = ""; if ( $error_code ) { $error_message .= "<br />At least one query failed : check the error message and contact me if you need help to resolve the problem. <br />"; } else { $error_message .= "<br />All the queries have been successfully done - Enjoy. <br />"; } echo("\n<br />\n<b>COMPLETE - INSTALLATION IS ENDED</b><br />\n"); echo($error_message . "<br />"); echo("<br /><b>NOW, DELETE THIS FILE FROM YOUR SERVER</b><br />\n"); } ?> </body> </html> Index: db_upgrade.php =================================================================== RCS file: /cvsroot/mxbb/mx_kb/db_upgrade.php,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** db_upgrade.php 2 Apr 2005 22:03:20 -0000 1.19 --- db_upgrade.php 9 Apr 2005 21:41:27 -0000 1.20 *************** *** 20,79 **** * (at your option) any later version. */ - if ( !function_exists(mx_do_install_upgrade) ) - { - // Generating output - - function mx_do_install_upgrade( $sql = '', $main_install = false ) - { - global $table_prefix, $mx_table_prefix, $userdata, $phpEx, $template, $lang, $db, $board_config, $HTTP_POST_VARS; - - $inst_error = false; - $n = 0; - $message = "<b>This is the result list of the SQL queries needed for the install/upgrade</b><br /><br />"; - - while ( $sql[$n] ) - { - if ( !$result = $db->sql_query( $sql[$n] ) ) - { - $message .= '<b><font color=#FF0000>[Error or Already added]</font></b> line: ' . ( $n + 1 ) . ' , ' . $sql[$n] . '<br />'; - $inst_error = true; - } - else - { - $message .= '<b><font color=#0000fF>[Added/Updated]</font></b> line: ' . ( $n + 1 ) . ' , ' . $sql[$n] . '<br />'; - } - $n++; - } - $message .= '<br /> If you get some Errors, Already Added or Updated messages, relax, this is normal when updating modules'; - - if ( $main_install ) - { - if ( !$inst_error ) - { - $message .= '-> no db errors :-)<br /><br /><b>Portal installed successfully! </b><hr><br /><br />'; - $message .= '1) Now, delete the /install and /contrib folders!!!<br /><br />'; - $message .= '2) If you haven\'t already done a db backup, now is the time ;)<br /><br />'; - $message .= '3) Then (after step 1), you HAVE to configure MX core and its modules from within the adminCP, simply \'upgrade\' MX portal Core and all modules in use!!!<br /><br />'; - - $message .= 'Click <a href=../admin/admin_mx_module.php>Here</a> to administer/upgrade the portal/modules. You will be promted for an admin username and pass. The upgrade process provide informative output...'; - } - else - { - $message .= '<br /><br /><b>Portal installed successfully (with some warnings)! </b><hr><br /><br />'; - $message .= '1) Now, delete the /install and /contrib folders!!!<br /><br />'; - $message .= '2) If you haven\'t already done a db backup, now is the time ;)<br /><br />'; - $message .= '3) Now (after step 1), you HAVE to configure MX core and its modules from within the adminCP, simply \'upgrade\' MX portal Core and all modules in use!!!<br /><br />'; - - $message .= 'Click <a href=../admin/admin_mx_module.php>Here</a> to administer/upgrade the portal/modules. You will be promted for an admin username and pass. The upgrade process provide informative output...'; - } - } - return $message; - } - - define('MXBB_27x', 1); - - } define( 'IN_PORTAL', true ); $mx_module_version = 'mxBB Knowledge Base Module v. 2.0.0'; --- 20,26 ---- * (at your option) any later version. */ define( 'IN_PORTAL', true ); + $mx_root_path = './../'; $mx_module_version = 'mxBB Knowledge Base Module v. 2.0.0'; *************** *** 82,86 **** if ( !defined( 'IN_ADMIN' ) ) { ! $mx_root_path = '../../'; include( $mx_root_path . 'extension.inc' ); include( $mx_root_path . 'common.' . $phpEx ); --- 29,33 ---- if ( !defined( 'IN_ADMIN' ) ) { ! $mx_root_path = './../../'; include( $mx_root_path . 'extension.inc' ); include( $mx_root_path . 'common.' . $phpEx ); *************** *** 101,104 **** --- 48,59 ---- } + // For compatibility with core 2.7.+ + define( 'MXBB_27x', file_exists( $mx_root_path . 'more_smilies.php' ) ); + + if ( MXBB_27x ) + { + include_once( $mx_root_path . 'modules/mx_kb/includes/functions_kb_mx.' . $phpEx ); + } + $sql = array(); // Precheck *************** *** 183,187 **** $message .= "<b>Validating v. 2.00...ok</b><br/><br/>"; } ! // validate before 2.01 $result = $db->sql_query( "SELECT config_value from " . $mx_table_prefix . "kb_config WHERE config_name = 'wysiwyg_path'" ); --- 138,142 ---- $message .= "<b>Validating v. 2.00...ok</b><br/><br/>"; } ! // validate before 2.01 $result = $db->sql_query( "SELECT config_value from " . $mx_table_prefix . "kb_config WHERE config_name = 'wysiwyg_path'" ); *************** *** 194,199 **** { $message .= "<b>Validating v. 2.01...ok</b><br/><br/>"; ! } ! // ------------------------------------------------------------------------------------------------------ if ( $upgrade_105 == 1 ) --- 149,154 ---- { $message .= "<b>Validating v. 2.01...ok</b><br/><br/>"; ! } ! // ------------------------------------------------------------------------------------------------------ if ( $upgrade_105 == 1 ) *************** *** 239,244 **** } - - if ( $upgrade_109 == 1 ) { --- 194,197 ---- *************** *** 300,311 **** data text NOT NULL )"; } ! if ( $upgrade_201 == 1 ) ! { ! $sql[] = "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('wysiwyg_path', '0')"; $sql[] = "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('formatting_fixup', '0')"; $sql[] = "ALTER TABLE " . $mx_table_prefix . "kb_articles MODIFY article_author_id mediumint(8) NOT NULL "; ! } else { --- 253,266 ---- data text NOT NULL )"; + } ! if ( $upgrade_201 == 1 ) ! { ! $sql[] = "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('wysiwyg_path', 'modules/')"; $sql[] = "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('formatting_fixup', '0')"; $sql[] = "ALTER TABLE " . $mx_table_prefix . "kb_articles MODIFY article_author_id mediumint(8) NOT NULL "; ! ! } else { --- NEW FILE: install.txt --- ############################################################## ## MOD Title: Knowledge Base ## MOD Original Author: wGEric < er...@ww... > (Eric Faerber) http://eric.best-1.biz ## MOD Addon Author: Haplo < jon...@ho... > (Jon Ohlsson) http://www.mx-system.com ## MOD Description: This mod adds a Knowledge Base manager to your board ## MOD Version: KB MOD 2.0.1(abc...) ## ## Installation Level: easy ## Installation Time: 5 Minutes ## Files To Edit: (5) ## - viewonline.php ## - admin/index.php, ## - includes/page_header.php, ## - language/lang_english/lang_main.php, ## - templates/subSilver/overall_header.tpl, ## ## Included Files: (58) ## - kb.php, ## - kb_search.php, ## - admin/admin_kb_*.php (7), ## - includes/functions_.php (4), ## - includes/kb_.php, (9) ## - language/lang_english/lang_.php (2), ## - templates/subSilver/kb_*.tpl (14), ## - templates/subSilver/admin/kb_*.tpl (17), ## - templates/subSilver/images/lang_english/*.gif (1), ## - templates/subSilver/images/*.gif (2) ## ############################################################## ## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the ## latest version of this MOD. Downloading this MOD from other sites could cause malicious code ## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered ## in our MOD-Database, located at: http://www.phpbb.com/mods/ ############################################################## ## ## ## MOD History: ## ## 2005/04/09 - Version KB MOD 2.0.1e. ## - Category jumpbox ## - Permissions revised and less db queries needed ## - More information in PM - subject ## - Category PRIVATE settings for 'approval' removed. Approvals settings are now INACTIVATED, MOD, ADMIN ## - Fix for kb_search - now also articles titles are searchable ;) ## - "All" reported bugs/fixes/addons in dev thread fixed (implemented) ## 2005/03/29 - Version KB MOD 2.0.1abcd... ## - Name changed, since much (most) is rewritten ;) ## - Updated with latest phpBB security patches ## - Category (PRIVATE) permissions ## - Subcategories ## - "Comments phpBB forum" set per category ## - Regenerate search tables adminCP ## - Rewritten PM/MAIL handling ## - Text reformatting options: img, link and linewidth controls ## - Rewritten BBcode/html handling (once more yes) ## - Custom fields added ## - wysiwyg feature (tinymce), ## you can simply download latest version from http://tinymce.moxiecode.com/ and upload into phpbbroot/modules/ ## - "All" reported bugs/fixes/addons in dev thread fixed (implemented) ## 2004/09/14 - Version 0.7.6 + MX Addon 1.03 ## - Comments pagination added (new db entry) ## - Advanced sorting options (2 new db entries) ## - Rewritten BBcode/html handling ## - Improved Moderator features ## - some tpl bugs fixed ## - All reported bugs in dev thread fixed ## 2004/07/05 - Version 0.7.6 + MX Addon 1.02 ## - Article pagination added (new db entry) ## - rate check vs ip and userid added (2 new db entries) ## - add comments/rate links added ## - some tpl bugs fixed ## 2004/06/15 - Version 0.7.6 + MX Addon 1.01 ## - Bugfixes ## 2004/06/05 - Version 0.7.6 + MX Addon 1.0 ## - Ratings added ## - 'Printable version' added ## - Moderator group ## - Admin switch for 'bumping' reply post in comment thread whenever the article is edited ## - Admin switch for showing kb stats ## - Rewritten EDIT function ## - Switch for show comments in portal page ## - Additional stats: latest articles, toprated articles and most popular articles ## - [page] and [toc] feature for pages and table of contents entries ## - Fixed lots of bugs ## ## 2003/08/08 - Version 0.7.6 ## - Fixed some typos, Thanks to Gary for pointing these out ## - Fixed lots of bugs ## ## 2003/07/26 - Version 0.7.5 ## - Multiple paged articles ## - Quick Stats ## - Minor changes ## ## 2003/07/17 - Version 0.7.1 ## - Fixed a bug that could empty your topics table ## ## 2003/07/14 - Version 0.7.0 ## - Sub Categories added ## - Order Categories ## - Delete Topic when deleting article ## - Makes sure all articles has a topic if comments are on ## - Users not logged in can post articles ## ## 2003/07/09 - Version 0.6.3 ## - Works with MSSQL ## - Topic uses boards language instead of English ## ## 2003/07/08 - Version 0.6.2 ## - Fixed email_kb_admin() in kb.php ## - View counter is fixed when viewing a cateogory ## - Fixed it so amount of articles in a category decrease after ## deleting an article ## - All editing article bugs have been fixed ## - Install script has been fixed. ## ## 07/02/03 - Version 0.6.1 ## - Fixed bugs (ACP Type manager, HTML when viewing ## article, Anyone could edit article if they changed the URL) ## - Added a view counter for the articles. ## ## 06/30/03 - Version 0.6.0 ## - Added Search ## - Fixed a couple of bugs ## - Changed the way the posts look ## ## 06/12/03 - Beta - 0.5.1 ## - Fixed a bug in the functions. Forgot to put $phpEx as a global. ## ## 06/11/03 - Beta 2 - 0.5.0 ## - Rewrote most of the code. This made some of the files smaller ## - Comments on articles feature ## - Fixed most of the known bugs ## - Dutch Translation by NL Web Hebbies ## ## 05/13/03 - Beta 0.4.3 ## - FIX: Check for empty category and type by ZapZap ## ## 05/10/03 - Beta 0.4.2 ## - FIX: preview fixed by wGEric ## - FIX: html parsed even if html of fixed by wGEric ## - FIX: missing text for category on some forms ## ## 05/06/03 - Beta 0.4.1 ## - Removed pretext table and moved pretext fields to config table ## - Added entry to viewonline list ## ## 05/01/03 - Beta 0.4.0 ## - Added Pretext Mod by Palamedes < pal...@ro... > (Jason Ellis) http://www.randomstringofwords.com ## ## 04/28/03 - Beta 0.3.2 ## - Added Spanish Files ## - Used cleaned up code from MJ - Thanks! ## ## 04/19/03 - Beta 0.3.1 - Fixed some bugs ## ## 04/18/03 - Beta 0.3.0 ## - Added, 'Preview Articles' before posting them. ## - Added, Admin's and Moderator's articles are automatically approved. ## - Added, the ability to change the article types ## ## 04/12/03 - Beta 0.2.0 ## - Added, the ability to edit articles ## - Added, E-mail or PM Notification of a new article ## - Added. configuration file in the admin panel. In there you can allow new articles to be posted, allow edits, and choose whether to be PM, e-mailed, or get no notification. ## ## 04/05/03 - Beta 0.1.0 ## - First Release ## ## 1) Edit the Original phpBB2 Code. ## 2) Upload all Remaining Files. ## 3) Prepare the database by running the included install/upgrade-*.php file. ## - use install_kb_tables.php for a fresh installation, ## and upgrade_kb_tables.php if upgrading (even if from original kb 0.76 - works! ) ## 4) Delete install/upgrade files!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ## ############################################################## ## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD ############################################################## # #-----[ COPY ]------------------------------------------ # copy mx_kb/install_kb_tables.php to phpbbroot/install_kb_tables.php or copy mx_kb/upgrade_kb_tables.php to phpbbroot/upgrade_kb_tables.php copy mx_kb/kb.php to kb.php copy mx_kb/kb_search.php to phpbbroot/kb_search.php copy mx_kb/admin/admin__.php to phpbbroot/admin/admin__.php copy mx_kb/includes/functions_.php to phpbbroot/includes/functions_.php copy mx_kb/includes/kb_.php to phpbbroot/includes/kb_.php copy mx_kb/language/lang_english/lang_kb.php to phpbbroot/language/lang_english/lang_kb.php copy mx_kb/templates/print_version.css to phpbbroot/templates/print_version.css copy mx_kb/templates/subSilver/kb_.tpl to phpbbroot/templates/subSilver/kb_.tpl copy mx_kb/templates/subSilver/admin/kb_.tpl to phpbbroot/templates/subSilver/admin/kb_.tpl copy mx_kb/templates/subSilver/images/icon_.gif to phpbbroot/templates/subSilver/images/icon_.gif copy mx_kb/templates/subSilver/images/lang_english/kb.gif to phpbbroot/templates/subSilver/images/lang_english/kb.gif Notes: Files distributed in this zip, NOT used by the phpBB version of the KB MOD - kb_pages.php - kb_defs.php - admin/mx_config.php - kb_article_reader.php If they have been included by accident, simply remove. They are only used for the mxBB version of the mod!! # #-----[ OPEN ]------------------------------------------ # viewonline.php # #-----[ FIND ]------------------------------------------ # case PAGE_FAQ: $location = $lang['Viewing_FAQ']; $location_url = "faq.$phpEx"; break; # #-----[ AFTER, ADD ]------------------------------------------ # case PAGE_KB: $location = $lang['Viewing_KB']; $location_url = "kb.$phpEx"; break; # #-----[ OPEN ]------------------------------------------ # admin/index.php # #-----[ FIND ]------------------------------------------ # case PAGE_FAQ: $location = $lang['Viewing_FAQ']; $location_url = "index.$phpEx?pane=right"; break; # #-----[ AFTER, ADD ]------------------------------------------ # case PAGE_KB: $location = $lang['Viewing_KB']; $location_url = "kb.$phpEx"; break; # #-----[ FIND ]------------------------------------------ # case PAGE_FAQ: $location = $lang['Viewing_FAQ']; $location_url = "index.$phpEx?pane=right"; break # #-----[ AFTER, ADD ]------------------------------------------ # case PAGE_KB: $location = $lang['Viewing_KB']; $location_url = "kb.$phpEx"; break; # #-----[ OPEN ]------------------------------------------ # includes/page_header.php # #-----[ FIND ]------------------------------------------ # 'L_FAQ' => $lang['FAQ'], # #-----[ AFTER, ADD ]------------------------------------------ # 'L_KB' => $lang['KB_title'], # #-----[ FIND ]------------------------------------------ # 'U_FAQ' => append_sid('faq.'.$phpEx), # #-----[ AFTER, ADD ]------------------------------------------ # 'U_KB' => append_sid('kb.'.$phpEx), # #-----[ OPEN ]------------------------------------------ # language/lang_english/lang_main.php # #-----[ FIND ]------------------------------------------ # $lang['FAQ'] = 'FAQ'; # #-----[ AFTER, ADD ]------------------------------------------ # $lang['KB_title'] = 'Knowledge Base'; # #-----[ FIND ]------------------------------------------ # $lang['Viewing_FAQ'] = 'Viewing FAQ'; # #-----[ AFTER, ADD ]------------------------------------------ # $lang['Viewing_KB'] = 'Viewing KB'; # #-----[ OPEN ]------------------------------------------ # templates/subSilver/overall_header.tpl # #-----[ FIND ]------------------------------------------ # <td align="center" valign="top" nowrap="nowrap"><span class="mainmenu"> <a href="{U_FAQ}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_faq.gif" width="12" height="13" border="0" alt="{L_FAQ}" hspace="3" />{L_FAQ}</a></span><span class="mainmenu"> <a href="{U_SEARCH}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_search.gif" width="12" height="13" border="0" alt="{L_SEARCH}" hspace="3" />{L_SEARCH}</a> <a href="{U_MEMBERLIST}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_members.gif" width="12" height="13" border="0" alt="{L_MEMBERLIST}" hspace="3" />{L_MEMBERLIST}</a> <a href="{U_GROUP_CP}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_groups.gif" width="12" height="13" border="0" alt="{L_USERGROUPS}" hspace="3" />{L_USERGROUPS}</a> # #-----[ IN-LINE FIND ]------------------------------------------ # <a href="{U_FAQ}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_faq.gif" width="12" height="13" border="0" alt="{L_FAQ}" hspace="3" />{L_FAQ}</a></span><span class="mainmenu"> # #-----[ IN-LINE AFTER, ADD ]------------------------------------------ # &nb... [truncated message content] |