|
From: Jon O. <jon...@us...> - 2005-12-08 15:04:36
|
Update of /cvsroot/mxbb/mx_kb In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3524/modules/mx_kb Modified Files: db_install.php db_uninstall.php db_upgrade.php kb.php kb_article_reader.php kb_search.php Log Message: in progress commit for mx_kb Index: kb.php =================================================================== RCS file: /cvsroot/mxbb/mx_kb/kb.php,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** kb.php 3 Nov 2005 12:13:34 -0000 1.25 --- kb.php 8 Dec 2005 15:04:26 -0000 1.26 *************** *** 31,35 **** include( $phpbb_root_path . 'common.' . $phpEx ); ! define( 'PAGE_KB', -500 ); // If this id generates a conflict with other mods, change it ;) // Start session management --- 31,35 ---- include( $phpbb_root_path . 'common.' . $phpEx ); ! define( 'PAGE_KB', -501 ); // If this id generates a conflict with other mods, change it ;) // Start session management *************** *** 121,126 **** global $images; } - - } --- 121,124 ---- *************** *** 134,139 **** include_once( $module_root_path . 'kb/kb_common.' . $phpEx ); - $show_new = true; - // =================================================== // Get action variable other wise set it to the main --- 132,135 ---- *************** *** 141,185 **** $mode = $mx_request_vars->request('mode', MX_TYPE_NO_TAGS, 'main'); - if ( isset( $HTTP_POST_VARS['page_num'] ) || isset( $HTTP_GET_VARS['page_num'] ) ) - { - $page_num = ( isset( $HTTP_POST_VARS['page_num'] ) ) ? intval( $HTTP_POST_VARS['page_num'] ) : intval( $HTTP_GET_VARS['page_num'] ); - $page_num = $page_num - 1; - } - else - { - $page_num = 0; - } - // Print version - if ( isset( $HTTP_POST_VARS['print'] ) || isset( $HTTP_GET_VARS['print'] ) ) - { - $print_version = ( isset( $HTTP_POST_VARS['print'] ) ) ? $HTTP_POST_VARS['print'] : $HTTP_GET_VARS['print']; - $print_version = htmlspecialchars( $print_version ); - } - else - { - $print_version = ''; - } - // ! // options // ! $kb_wysiwyg = false; ! if ( $kb_config['wysiwyg'] ) // Html Textblock ! { ! if ( file_exists( $mx_root_path . 'modules/tinymce/jscripts/tiny_mce/blank.htm' ) ) ! { ! $bbcode_on = false; ! $html_on = true; ! $smilies_on = false; ! $kb_wysiwyg = true; ! } ! } ! ! if ( !$kb_wysiwyg ) ! { ! $bbcode_on = $kb_config['allow_bbcode'] ? true : false; ! $html_on = $kb_config['allow_html'] ? true : false; ! $smilies_on = $kb_config['allow_smilies'] ? true : false; ! } $is_admin = ( ( $userdata['user_level'] == ADMIN ) && $userdata['session_logged_in'] ) ? true : 0; --- 137,144 ---- $mode = $mx_request_vars->request('mode', MX_TYPE_NO_TAGS, 'main'); // ! // Get more variables // ! $print_version = $mx_request_vars->request('print', MX_TYPE_NO_TAGS, ''); $is_admin = ( ( $userdata['user_level'] == ADMIN ) && $userdata['session_logged_in'] ) ? true : 0; *************** *** 189,195 **** // if the database disabled give them a nice message // =================================================== ! if ( intval( $kb_config['disable'] ) ) { ! // mx_message_die( GENERAL_MESSAGE, $lang['pafiledb_disable'] ); } --- 148,154 ---- // if the database disabled give them a nice message // =================================================== ! if ( intval( $kb_config['module_enable'] ) ) { ! mx_message_die( GENERAL_MESSAGE, $lang['pafiledb_disable'] ); } *************** *** 206,209 **** --- 165,169 ---- 'stats' => 'stats', 'moderate' => 'moderator', + 'post_comment' => 'post_comment', 'main' => 'main' ); *************** *** 211,215 **** // Lets Build the page // =================================================== - if ( !$is_block && !$print_version) { --- 171,174 ---- Index: db_uninstall.php =================================================================== RCS file: /cvsroot/mxbb/mx_kb/db_uninstall.php,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** db_uninstall.php 1 Oct 2005 14:13:46 -0000 1.13 --- db_uninstall.php 8 Dec 2005 15:04:26 -0000 1.14 *************** *** 67,70 **** --- 67,72 ---- "DROP TABLE " . $mx_table_prefix . "kb_custom ", + + "DROP TABLE " . $mx_table_prefix . "kb_comments ", "DROP TABLE " . $mx_table_prefix . "kb_customdata " Index: db_upgrade.php =================================================================== RCS file: /cvsroot/mxbb/mx_kb/db_upgrade.php,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** db_upgrade.php 1 Oct 2005 14:13:46 -0000 1.26 --- db_upgrade.php 8 Dec 2005 15:04:26 -0000 1.27 *************** *** 150,153 **** --- 150,165 ---- $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 " . $mx_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/>"; + } // ------------------------------------------------------------------------------------------------------ *************** *** 269,273 **** --- 281,394 ---- $sql[] = "ALTER TABLE " . $mx_table_prefix . "kb_config MODIFY config_value VARCHAR(255) NOT NULL default '' "; $sql[] = "ALTER TABLE " . $mx_table_prefix . "kb_config DROP PRIMARY KEY, ADD PRIMARY KEY (config_name) "; + } + + if ( $upgrade_203 == 1 ) + { + // -------------------------------------------------------- + // Table structure for table `phpbb_pa_comments` + $sql[] = "CREATE TABLE " . $mx_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 " . $mx_table_prefix . "kb_config" . " SET config_name = 'enable_module' WHERE config_name = 'allow_new'"; + $sql[] = "UPDATE " . $mx_table_prefix . "kb_config" . " SET config_name = 'pagination' WHERE config_name = 'art_pagination'"; + $sql[] = "UPDATE " . $mx_table_prefix . "kb_config" . " SET config_name = 'sort_method' WHERE config_name = 'news_sort'"; + $sql[] = "UPDATE " . $mx_table_prefix . "kb_config" . " SET config_name = 'sort_order' WHERE config_name = 'news_sort_par'"; + $sql[] = "UPDATE " . $mx_table_prefix . "kb_config" . " SET config_name = 'autogenerate_comments' WHERE config_name = 'bump_post'"; + $sql[] = "UPDATE " . $mx_table_prefix . "kb_config" . " SET config_name = 'notify_group' WHERE config_name = 'admin_id'"; + + $sql[] = "DELETE FROM " . $mx_table_prefix . "kb_config" . " WHERE config_name = 'comments_show'"; + $sql[] = "DELETE FROM " . $mx_table_prefix . "kb_config" . " WHERE config_name = 'wysiwyg'"; + $sql[] = "DELETE FROM " . $mx_table_prefix . "kb_config" . " WHERE config_name = 'wysiwyg_comments'"; + $sql[] = "DELETE FROM " . $mx_table_prefix . "kb_config" . " WHERE config_name = 'allow_wysiwyg_comments'"; + $sql[] = "DELETE FROM " . $mx_table_prefix . "kb_config" . " WHERE config_name = 'allow_wysiwyg'"; + $sql[] = "DELETE FROM " . $mx_table_prefix . "kb_config" . " WHERE config_name = 'formatting_fixup'"; + $sql[] = "DELETE FROM " . $mx_table_prefix . "kb_config" . " WHERE config_name = 'formatting_comment_fixup'"; + $sql[] = "DELETE FROM " . $mx_table_prefix . "kb_config" . " WHERE config_name = 'approve_new'"; + $sql[] = "DELETE FROM " . $mx_table_prefix . "kb_config" . " WHERE config_name = 'approve_edit'"; + $sql[] = "DELETE FROM " . $mx_table_prefix . "kb_config" . " WHERE config_name = 'allow_edit'"; + $sql[] = "DELETE FROM " . $mx_table_prefix . "kb_config" . " WHERE config_name = 'allow_anon'"; + $sql[] = "DELETE FROM " . $mx_table_prefix . "kb_config" . " WHERE config_name = 'forum_id'"; + $sql[] = "DELETE FROM " . $mx_table_prefix . "kb_config" . " WHERE config_name = 'allow_anonymos_rating'"; + $sql[] = "DELETE FROM " . $mx_table_prefix . "kb_config" . " WHERE config_name = 'mod_group'"; + + $sql[] = "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('module_name', 'Knowledge Base')"; + + $sql[] = "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('allow_wysiwyg', '1')"; + $sql[] = "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('allow_links', '1')"; + $sql[] = "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('allow_images', '1')"; + $sql[] = "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('no_image_message', '[No image please]')"; + $sql[] = "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('no_link_message', '[No links please]')"; + $sql[] = "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('formatting_wordwrap', '1')"; + $sql[] = "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('formatting_image_resize', '300')"; + $sql[] = "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('formatting_truncate_links', '1')"; + $sql[] = "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('max_subject_chars', '100')"; + $sql[] = "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('max_desc_chars', '500')"; + $sql[] = "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('max_chars', '0')"; + + $sql[] = "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('internal_comments', '1')"; + $sql[] = "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('formatting_comment_wordwrap', '1')"; + $sql[] = "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('formatting_comment_image_resize', '300')"; + $sql[] = "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('formatting_comment_truncate_links', '1')"; + $sql[] = "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('max_comment_subject_chars', '50')"; + $sql[] = "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('max_comment_chars', '5000')"; + $sql[] = "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('allowed_comment_html_tags', 'b,i,u,a')"; + $sql[] = "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('allow_comment_wysiwyg', '0')"; + $sql[] = "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('allow_comment_html', '1')"; + $sql[] = "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('allow_comment_bbcode', '1')"; + $sql[] = "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('allow_comment_smilies', '1')"; + $sql[] = "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('allow_comment_links', '1')"; + $sql[] = "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('allow_comment_images', '0')"; + $sql[] = "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('no_comment_image_message', '[No image please]')"; + $sql[] = "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('no_comment_link_message', '[No links please]')"; + + // Categories table + $sql[] = "ALTER TABLE " . $mx_table_prefix . "kb_categories ADD cat_allow_comments tinyint(2) NOT NULL default '-1' "; + $sql[] = "ALTER TABLE " . $mx_table_prefix . "kb_categories ADD internal_comments tinyint(2) NOT NULL DEFAULT '-1' "; + $sql[] = "ALTER TABLE " . $mx_table_prefix . "kb_categories ADD autogenerate_comments tinyint(2) NOT NULL DEFAULT '-1' "; + $sql[] = "ALTER TABLE " . $mx_table_prefix . "kb_categories ADD comments_forum_id mediumint(8) NOT NULL DEFAULT '-1' "; + + $sql[] = "ALTER TABLE " . $mx_table_prefix . "kb_categories ADD cat_allow_ratings tinyint(2) NOT NULL default '-1' "; + + $sql[] = "ALTER TABLE " . $mx_table_prefix . "kb_categories ADD show_pretext tinyint(2) NOT NULL default '-1' "; + + $sql[] = "ALTER TABLE " . $mx_table_prefix . "kb_categories ADD notify tinyint(2) NOT NULL DEFAULT '-1' "; + $sql[] = "ALTER TABLE " . $mx_table_prefix . "kb_categories ADD notify_group mediumint(8) NOT NULL DEFAULT '-1' "; + + $sql[] = "ALTER TABLE " . $mx_table_prefix . "kb_categories ADD cat_last_article_id mediumint(8) unsigned NOT NULL default '0' "; + $sql[] = "ALTER TABLE " . $mx_table_prefix . "kb_categories ADD cat_last_article_name varchar(255) NOT NULL default '' "; + $sql[] = "ALTER TABLE " . $mx_table_prefix . "kb_categories ADD cat_last_article_time INT(50) UNSIGNED DEFAULT '0' NOT NULL "; + + $sql[] = "ALTER TABLE " . $mx_table_prefix . "kb_categories MODIFY auth_view_groups smallint(5) NOT NULL default '0' "; + $sql[] = "ALTER TABLE " . $mx_table_prefix . "kb_categories MODIFY auth_post_groups smallint(5) NOT NULL default '0' "; + $sql[] = "ALTER TABLE " . $mx_table_prefix . "kb_categories MODIFY auth_rate_groups smallint(5) NOT NULL default '0' "; + $sql[] = "ALTER TABLE " . $mx_table_prefix . "kb_categories MODIFY auth_comment_groups smallint(5) NOT NULL default '0' "; + $sql[] = "ALTER TABLE " . $mx_table_prefix . "kb_categories MODIFY auth_edit_groups smallint(5) NOT NULL default '0' "; + $sql[] = "ALTER TABLE " . $mx_table_prefix . "kb_categories MODIFY auth_delete_groups smallint(5) NOT NULL default '0' "; + $sql[] = "ALTER TABLE " . $mx_table_prefix . "kb_categories MODIFY auth_approval_groups smallint(5) NOT NULL default '0' "; + $sql[] = "ALTER TABLE " . $mx_table_prefix . "kb_categories MODIFY auth_approval_edit_groups smallint(5) NOT NULL default '0' "; + $sql[] = "ALTER TABLE " . $mx_table_prefix . "kb_categories MODIFY auth_moderator_groups smallint(5) NOT NULL default '0' "; + + // Number of articles can be -1 when syncing + $sql[] = "ALTER TABLE " . $mx_table_prefix . "kb_categories MODIFY number_articles mediumint(8) NOT NULL"; + + // + // Drop unused tables + // + $sql[] = "DROP TABLE " . $mx_table_prefix . "kb_wordlist "; + $sql[] = "DROP TABLE " . $mx_table_prefix . "kb_results "; + $sql[] = "DROP TABLE " . $mx_table_prefix . "kb_wordmatch "; + } else Index: db_install.php =================================================================== RCS file: /cvsroot/mxbb/mx_kb/db_install.php,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** db_install.php 23 Oct 2005 02:04:18 -0000 1.33 --- db_install.php 8 Dec 2005 15:04:26 -0000 1.34 *************** *** 89,95 **** 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', --- 89,112 ---- category_name VARCHAR(255) binary NOT NULL, category_details VARCHAR(255) binary NOT NULL, parent mediumint(8) unsigned, cat_order mediumint(8) unsigned NOT NULL, + + 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) unsigned NOT NULL default '-1', + + number_articles mediumint(8) NOT NULL, + 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', *************** *** 100,117 **** 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) )", ! "INSERT INTO " . $mx_table_prefix . "kb_categories VALUES (1, 'Test Category 1', 'This is a test category', '0', '0', '10', '0', '0', '0', '0', '0', '2', '0', '0', '', '', '', '', '', '', '', '', '', '0' )", "CREATE TABLE " . $mx_table_prefix . "kb_config ( --- 117,136 ---- auth_approval tinyint(3) NOT NULL DEFAULT '0', auth_approval_edit tinyint(3) NOT NULL DEFAULT '0', ! ! auth_view_groups smallint(5) NOT NULL default '0', ! auth_post_groups smallint(5) NOT NULL default '0', ! auth_rate_groups smallint(5) NOT NULL default '0', ! auth_comment_groups smallint(5) NOT NULL default '0', ! auth_edit_groups smallint(5) NOT NULL default '0', ! auth_delete_groups smallint(5) NOT NULL default '0', ! auth_approval_groups smallint(5) NOT NULL default '0', ! auth_approval_edit_groups smallint(5) NOT NULL default '0', ! ! auth_moderator_groups smallint(5) NOT NULL default '0', ! KEY category_id (category_id) )", ! "INSERT INTO " . $mx_table_prefix . "kb_categories VALUES (1, 'Test Category 1', 'This is a test category', '0', '10', '-1', '-1','-1','-1','-1','-1','-1','-1', '', '0', '', '0', '0', '0', '0', '0', '0', '2', '0', '0', '', '', '', '', '', '', '', '', '0' )", "CREATE TABLE " . $mx_table_prefix . "kb_config ( *************** *** 121,164 **** )", ! // "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('approve_new', '1')", ! // "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('approve_edit', '1')", ! "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('allow_new', '1')", ! // "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('allow_edit', '1')", ! "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('notify', '1')", ! "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('admin_id', '2')", ! "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('show_pretext',0)", ! "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('pt_header','Article Submission Instructions')", ! "INSERT INTO " . $mx_table_prefix . "kb_config values ('pt_body','Please check your references and include as much information as you can.')", ! // "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('forum_id', '1')", ! "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('use_comments', '1')", ! // "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('allow_anon', '0')", ! "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('del_topic', '1')", ! "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('use_ratings', '0')", ! // "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('allow_anonymos_rating', '0')", ! // Added by Haplo ! "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('comments_show', '1')", ! // "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('mod_group', '0')", ! "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('bump_post', '1')", ! "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('stats_list', '1')", ! "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('header_banner', '1')", ! // kb 1.06 ! "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('votes_check_userid', '1')", ! "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('votes_check_ip', '1')", ! "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('art_pagination', '5')", ! // kb 1.07 ! "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('comments_pagination', '5')", ! "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('news_sort', 'Alphabetic')", ! "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('news_sort_par', 'ASC')", ! // kb 2.0 ! "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('wysiwyg', '0')", ! "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('wysiwyg_path', 'modules/')", ! ! "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('formatting_fixup', '0')", "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('allow_html', '1')", "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('allow_bbcode', '1')", "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('allow_smilies', '1')", "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('allowed_html_tags', 'b,i,u,a')", "CREATE TABLE " . $mx_table_prefix . "kb_types ( id mediumint(8) unsigned NOT NULL auto_increment, --- 140,226 ---- )", ! // ! // Insert Configs ! // + // General + "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('enable_module', '1')", // allow_new + "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('module_name', 'Knowledge Base')", // NEW + "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('wysiwyg_path', 'modules/')", + + // Articles + "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('formatting_wordwrap', '1')", // formatting_fixup + "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('formatting_image_resize', '300')", // NEW + "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('formatting_truncate_links', '1')", // NEW + "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('allow_wysiwyg', '0')", // NEW "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('allow_html', '1')", "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('allow_bbcode', '1')", "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('allow_smilies', '1')", "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('allowed_html_tags', 'b,i,u,a')", + "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('allow_links', '1')", + "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('allow_images', '0')", + "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('no_image_message', '[No image please]')", + "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('no_link_message', '[No links please]')", + "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('max_subject_chars', '100')", // NEW + "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('max_desc_chars', '500')", // NEW + "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('max_chars', '0')", // NEW + + // Appearance + "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('stats_list', '1')", + "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('header_banner', '1')", + "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('pagination', '5')", // art_pagination + "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('sort_method', 'Alphabetic')", // news_sort + "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('sort_order', 'ASC')", // news_sort_par + + // Comments + "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('use_comments', '1')", // comments_show + "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('internal_comments', '1')", // NEW + "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('formatting_comment_wordwrap', '1')", // formatting_comment_fixup + "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('formatting_comment_image_resize', '300')", // NEW + "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('formatting_comment_truncate_links', '1')", // NEW + "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('max_comment_subject_chars', '50')", // NEW + "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('max_comment_chars', '5000')", // NEW + "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('allow_comment_wysiwyg', '0')", + "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('allow_comment_html', '1')", + "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('allow_comment_bbcode', '1')", + "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('allow_comment_smilies', '1')", + "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('allow_comment_links', '1')", + "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('allow_comment_images', '0')", + "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('no_comment_image_message', '[No image please]')", + "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('no_comment_link_message', '[No links please]')", + "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('allowed_comment_html_tags', 'b,i,u,a')", // NEW + "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('del_topic', '1')", + "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('autogenerate_comments', '1')", // bump_post + "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('comments_pagination', '5')", + + // Ratings + "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('use_ratings', '0')", + "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('votes_check_userid', '1')", + "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('votes_check_ip', '1')", + + // Instructions + "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('show_pretext',0)", + "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('pt_header','Article Submission Instructions')", + "INSERT INTO " . $mx_table_prefix . "kb_config values ('pt_body','Please check your references and include as much information as you can.')", + + // Notifications + "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('notify', 'pm')", // updated + "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('notify_group', '0')", // admin_id + // -------------------------------------------------------- + // Table structure for table `phpbb_pa_comments` + "CREATE TABLE " . $mx_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) + )", + "CREATE TABLE " . $mx_table_prefix . "kb_types ( id mediumint(8) unsigned NOT NULL auto_increment, *************** *** 175,202 **** )", - "CREATE TABLE " . $mx_table_prefix . "kb_wordlist ( - 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) - )", - - "CREATE TABLE " . $mx_table_prefix . "kb_results ( - 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) - )", - - "CREATE TABLE " . $mx_table_prefix . "kb_wordmatch ( - 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) - )", - // -------------------------------------------------------- // Table structure for table `phpbb_pa_custom` --- 237,240 ---- Index: kb_article_reader.php =================================================================== RCS file: /cvsroot/mxbb/mx_kb/kb_article_reader.php,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** kb_article_reader.php 24 Oct 2005 20:15:33 -0000 1.10 --- kb_article_reader.php 8 Dec 2005 15:04:26 -0000 1.11 *************** *** 19,24 **** */ - // Switch for making this run as a phpBB MOD or mxBB module - if ( file_exists( './viewtopic.php' ) ) // -------------------------------------------- phpBB MOD MODE { --- 19,22 ---- *************** *** 36,53 **** // 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 --- 34,40 ---- *************** *** 59,152 **** 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 . 'mx_login.php' ) ); ! $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 ) ) { ! mx_message_die( GENERAL_ERROR, "Could not query Smartor_Album module information", "", __LINE__, __FILE__, $sql ); } - $tmp_row = $db->sql_fetchrow( $result ); - $block_id = $tmp_row['block_id']; } - $is_block = false; } else { define( 'MXBB_27x', file_exists( $mx_root_path . 'mx_login.php' ) ); ! // ! // Read Block Settings // ! $title = $mx_block->block_info['block_title']; $desc = $mx_block->block_info['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_tmp = $mx_block->get_parameters( 'kb_type_select' ); ! $kb_type_select_data = ( !empty( $kb_type_select_tmp ) ) ? unserialize( $kb_type_select_tmp ) : array(); ! ! $default_article_id = $mx_block->get_parameters( 'default_article_id' ); ! ! 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 ! $kb_custom_field = new kb_custom_field(); ! $kb_custom_field->init(); ! ! $show_new = true; ! // options ! if ( !$board_config['allow_html'] ) ! { ! $html_on = 0; ! } ! else ! { ! $html_on = ( $submit || $refresh ) ? ( ( !empty( $HTTP_POST_VARS['disable_html'] ) ) ? 0 : true ) : ( ( $userdata['user_id'] == ANONYMOUS ) ? $board_config['allow_html'] : $userdata['user_allowhtml'] ); ! } ! if ( !$board_config['allow_bbcode'] ) ! { ! $bbcode_on = 0; ! } ! else ! { ! $bbcode_on = ( $submit || $refresh ) ? ( ( !empty( $HTTP_POST_VARS['disable_bbcode'] ) ) ? 0 : true ) : ( ( $userdata['user_id'] == ANONYMOUS ) ? $board_config['allow_bbcode'] : $userdata['user_allowbbcode'] ); ! } ! if ( !$board_config['allow_smilies'] ) ! { ! $smilies_on = 0; ! } ! else ! { ! $smilies_on = ( $submit || $refresh ) ? ( ( !empty( $HTTP_POST_VARS['disable_smilies'] ) ) ? 0 : true ) : ( ( $userdata['user_id'] == ANONYMOUS ) ? $board_config['allow_smilies'] : $userdata['user_allowsmile'] ); ! } ! // page number if ( isset( $HTTP_POST_VARS['page_num'] ) || isset( $HTTP_GET_VARS['page_num'] ) ) --- 46,139 ---- 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 . 'mx_login.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 . 'mx_login.php' ) ); ! // ! // 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%' ); + // + // Extract 'what posts to view info', the cool Array ;) + // + $kb_type_select_var = $mx_block->get_parameters( 'kb_type_select' ); + $kb_type_select_data = ( !empty( $kb_type_select_var ) ) ? unserialize( $kb_type_select_var ) : array(); + $is_block = true; global $images; ! } } ! // ------------------------------------------------------------------------------------------------------------------------- ! // ------------------------------------------------------------------------------------------------------------------------- ! // ------------------------------------------------------------------------------------------------------------------------- ! // =================================================== ! // Include the common file ! // =================================================== ! include_once( $module_root_path . 'kb/kb_common.' . $phpEx ); ! // =================================================== ! // Get action variable other wise set it to the main ! // =================================================== ! $mode = $mx_request_vars->request('mode', MX_TYPE_NO_TAGS, 'main'); if ( isset( $HTTP_POST_VARS['page_num'] ) || isset( $HTTP_GET_VARS['page_num'] ) ) *************** *** 159,229 **** $page_num = 0; } - // Print version - if ( isset( $HTTP_POST_VARS['print'] ) || isset( $HTTP_GET_VARS['print'] ) ) - { - $print_version = ( isset( $HTTP_POST_VARS['print'] ) ) ? $HTTP_POST_VARS['print'] : $HTTP_GET_VARS['print']; - } - else - { - $print_version = ''; - } ! // Pull all config data ! ! $sql = "SELECT * ! FROM " . KB_CONFIG_TABLE; ! if ( !$result = $db->sql_query( $sql ) ) ! { ! mx_message_die( CRITICAL_ERROR, "Could not query config information in kb_config", "", __LINE__, __FILE__, $sql ); ! } ! 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; ! } ! } ! ! 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 || is_group_member( $kb_config['mod_group'], $userdata['user_id'] ) ) && $userdata['session_logged_in'] ) ? true : 0; ! // mode ! 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 ); } ! $reader_mode = true; ! if ( $mode == 'article' ) { --- 146,167 ---- $page_num = 0; } ! // ! // Print version ! // ! $print_version = $mx_request_vars->request('print', MX_TYPE_NO_TAGS, ''); ! $is_admin = ( ( $userdata['user_level'] == ADMIN ) && $userdata['session_logged_in'] ) ? true : 0; ! $reader_mode = true; ! // =================================================== ! // if the database disabled give them a nice message ! // =================================================== ! if ( intval( $kb_config['disable'] ) ) { ! // mx_message_die( GENERAL_MESSAGE, $lang['pafiledb_disable'] ); } ! /* if ( $mode == 'article' ) { *************** *** 262,265 **** --- 200,252 ---- include( $mx_root_path . 'includes/page_tail.' . $phpEx ); } + */ + + // =================================================== + // an array of all expected actions + // =================================================== + $actions = array( + 'article' => 'article', + 'cat' => 'cat', + 'add' => 'post', + 'search' => 'search', + 'edit' => 'post', + 'rate' => 'rate', + 'stats' => 'stats', + 'moderate' => 'moderator', + 'main' => 'main' ); + + // =================================================== + // Lets Build the page + // =================================================== + + if ( !$is_block && !$print_version) + { + include( $mx_root_path . 'includes/page_header.' . $phpEx ); + } + + $mx_kb->module( $actions[$mode] ); + $mx_kb->modules[$actions[$mode]]->main( $mode ); + + // + // load module header + // + if ( !$print_version ) + { + kb_page_header( $page_title ); + } + + $template->pparse( 'body' ); + + // + // load module footer + // + if ( !$print_version ) + { + kb_page_footer(); + } + if ( !$is_block && !$print_version ) + { + include( $mx_root_path . 'includes/page_tail.' . $phpEx ); + } ?> \ No newline at end of file Index: kb_search.php =================================================================== RCS file: /cvsroot/mxbb/mx_kb/kb_search.php,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** kb_search.php 23 Oct 2005 18:50:22 -0000 1.15 --- kb_search.php 8 Dec 2005 15:04:26 -0000 1.16 *************** *** 448,452 **** $article_id = $searchset[$i]['article_id']; ! $kb_cat = get_kb_cat( $searchset[$i]['article_category_id'] ); $temp_url = append_sid( this_kb_mxurl( 'mode=cat&cat=' . $searchset[$i]['article_category_id'], true ) ); $category = '<a href="' . $temp_url . '" class="name">' . $kb_cat['category_name'] . '</a>'; --- 448,453 ---- $article_id = $searchset[$i]['article_id']; ! //$kb_cat = get_kb_cat( $searchset[$i]['article_category_id'] ); ! $kb_cat = $this->cat_rowset[$searchset[$i]['article_category_id']]; $temp_url = append_sid( this_kb_mxurl( 'mode=cat&cat=' . $searchset[$i]['article_category_id'], true ) ); $category = '<a href="' . $temp_url . '" class="name">' . $kb_cat['category_name'] . '</a>'; |