|
From: Jon O. <jon...@us...> - 2005-03-29 21:39:40
|
Update of /cvsroot/mxbb/kb_076_mxaddon/root/includes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1125/modules/kb_076_mxaddon/root/includes Modified Files: functions_kb.php functions_kb_mx.php kb_article.php kb_cat.php kb_post.php kb_stats.php Log Message: small bugs, reported in phpbb dev thread - added regenerate search tables Index: kb_article.php =================================================================== RCS file: /cvsroot/mxbb/kb_076_mxaddon/root/includes/kb_article.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** kb_article.php 29 Mar 2005 20:06:58 -0000 1.3 --- kb_article.php 29 Mar 2005 21:39:31 -0000 1.4 *************** *** 38,46 **** $row = $db->sql_fetchrow( $result ); - if ( count($row) > 0 ) { $article_title = $row['article_title'] ; - // // Define censored word matches --- 38,44 ---- *************** *** 90,96 **** $author_id = $row['article_author_id']; ! if ( $author_id == 0 ) { ! $author_kb_art = ( $username != '' ) ? $lang['Guest'] : $row['username']; } else --- 88,94 ---- $author_id = $row['article_author_id']; ! if ( $author_id == -1 ) { ! $author_kb_art = ( $row['username'] == '' ) ? $lang['Guest'] : $row['username']; } else *************** *** 287,305 **** else { ! // If no phpbb topic id is created, create on ;) ! if ( !$topic_id && $approved && $kb_config['use_comments']) ! { ! $kb_comment = array(); ! // Populate the kb_comment variable ! $kb_comment = kb_get_data($row, $userdata); ! // Compose post header ! $subject = $lang['KB_comment_prefix'] . $kb_comment['article_title']; ! $message_temp = kb_compose_comment( $kb_comment ); ! ! $kb_message = $message_temp['message']; ! $kb_update_message = $message_temp['update_message']; // Post $topic_data = kb_insert_post( $kb_message, $subject, $kb_comment['category_forum_id'], $kb_comment['article_editor_id'], $userdata['article_editor'], $userdata['article_editor_sig'], $kb_comment['topic_id'], $kb_update_message ); --- 285,303 ---- else { ! $kb_comment = array(); ! // Populate the kb_comment variable ! $kb_comment = kb_get_data($row, $userdata); ! // Compose post header ! $subject = $lang['KB_comment_prefix'] . $kb_comment['article_title']; ! $message_temp = kb_compose_comment( $kb_comment ); + $kb_message = $message_temp['message']; + $kb_update_message = $message_temp['update_message']; + + // If no phpbb topic id is created, create on ;) + if ( !$topic_id && $approved && $kb_config['use_comments'] && $kb_comment['category_forum_id'] > 0) + { // Post $topic_data = kb_insert_post( $kb_message, $subject, $kb_comment['category_forum_id'], $kb_comment['article_editor_id'], $userdata['article_editor'], $userdata['article_editor_sig'], $kb_comment['topic_id'], $kb_update_message ); Index: functions_kb_mx.php =================================================================== RCS file: /cvsroot/mxbb/kb_076_mxaddon/root/includes/functions_kb_mx.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** functions_kb_mx.php 28 Mar 2005 20:54:53 -0000 1.1 --- functions_kb_mx.php 29 Mar 2005 21:39:31 -0000 1.2 *************** *** 20,39 **** */ - if ( !MXBB_MODULE ) - { - $server_protocol = ($board_config['cookie_secure']) ? 'https://' : 'http://'; - $server_name = preg_replace('#^\/?(.*?)\/?$#', '\1', trim($board_config['server_name'])); - $server_port = ($board_config['server_port'] <> 80) ? ':' . trim($board_config['server_port']) : ''; - $script_name = preg_replace('#^\/?(.*?)\/?$#', '\1', trim($board_config['script_path'])); - $script_name = ($script_name == '') ? $script_name : '/' . $script_name; - - define( 'PORTAL_URL', $server_protocol . $server_name . $server_port . $script_name . '/' ); - define( 'PHPBB_URL', PORTAL_URL ); - - $reader_mode = false; - $kb_config['news_operate_mode'] = false; - $mx_table_prefix = $table_prefix; - $is_block = false; - if ( !function_exists( mx_smilies_pass ) ) { --- 20,23 ---- *************** *** 72,258 **** global $userdata, $user_ip, $session_length; global $starttime; - - if(defined('HAS_DIED')) - { - die("message_die() was called multiple times. This isn't supposed to happen. Was message_die() used in page_tail.php?"); - } - - define(HAS_DIED, 1); - - - $sql_store = $sql; ! // ! // Get SQL error if we are debugging. Do this as soon as possible to prevent ! // subsequent queries from overwriting the status of sql_error() ! // ! if ( DEBUG && ( $msg_code == GENERAL_ERROR || $msg_code == CRITICAL_ERROR ) ) ! { ! $sql_error = $db->sql_error(); ! ! $debug_text = ''; ! ! if ( $sql_error['message'] != '' ) ! { ! $debug_text .= '<br /><br />SQL Error : ' . $sql_error['code'] . ' ' . $sql_error['message']; ! } ! ! if ( $sql_store != '' ) ! { ! $debug_text .= "<br /><br />$sql_store"; ! } ! ! if ( $err_line != '' && $err_file != '' ) ! { ! $debug_text .= '</br /><br />Line : ' . $err_line . '<br />File : ' . basename($err_file); ! } ! } ! ! if( empty($userdata) && ( $msg_code == GENERAL_MESSAGE || $msg_code == GENERAL_ERROR ) ) ! { ! $userdata = session_pagestart($user_ip, PAGE_INDEX); ! init_userprefs($userdata); ! } ! ! // ! // If the header hasn't been output then do it ! // ! if ( !defined('HEADER_INC') && $msg_code != CRITICAL_ERROR ) ! { ! if ( empty($lang) ) ! { ! if ( !empty($board_config['default_lang']) ) ! { ! include($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_main.'.$phpEx); ! } ! else ! { ! include($phpbb_root_path . 'language/lang_english/lang_main.'.$phpEx); ! } ! } ! ! if ( empty($template) ) ! { ! $template = new Template($phpbb_root_path . 'templates/' . $board_config['board_template']); ! } ! if ( empty($theme) ) ! { ! $theme = setup_style($board_config['default_style']); ! } ! ! // ! // Load the Page Header ! // ! if ( !defined('IN_ADMIN') ) ! { ! include($phpbb_root_path . 'includes/page_header.'.$phpEx); ! } ! else ! { ! include($phpbb_root_path . 'admin/page_header_admin.'.$phpEx); ! } ! } ! ! switch($msg_code) ! { ! case GENERAL_MESSAGE: ! if ( $msg_title == '' ) ! { ! $msg_title = $lang['Information']; ! } ! break; ! ! case CRITICAL_MESSAGE: ! if ( $msg_title == '' ) ! { ! $msg_title = $lang['Critical_Information']; ! } ! break; ! ! case GENERAL_ERROR: ! if ( $msg_text == '' ) ! { ! $msg_text = $lang['An_error_occured']; ! } ! ! if ( $msg_title == '' ) ! { ! $msg_title = $lang['General_Error']; ! } ! break; ! ! case CRITICAL_ERROR: ! // ! // Critical errors mean we cannot rely on _ANY_ DB information being ! // available so we're going to dump out a simple echo'd statement ! // ! include($phpbb_root_path . 'language/lang_english/lang_main.'.$phpEx); ! ! if ( $msg_text == '' ) ! { ! $msg_text = $lang['A_critical_error']; ! } ! ! if ( $msg_title == '' ) ! { ! $msg_title = 'phpBB : <b>' . $lang['Critical_Error'] . '</b>'; ! } ! break; ! } ! ! // ! // Add on DEBUG info if we've enabled debug mode and this is an error. This ! // prevents debug info being output for general messages should DEBUG be ! // set TRUE by accident (preventing confusion for the end user!) ! // ! if ( DEBUG && ( $msg_code == GENERAL_ERROR || $msg_code == CRITICAL_ERROR ) ) ! { ! if ( $debug_text != '' ) ! { ! $msg_text = $msg_text . '<br /><br /><b><u>DEBUG MODE</u></b>' . $debug_text; ! } ! } ! ! if ( $msg_code != CRITICAL_ERROR ) ! { ! if ( !empty($lang[$msg_text]) ) ! { ! $msg_text = $lang[$msg_text]; ! } ! ! if ( !defined('IN_ADMIN') ) ! { ! $template->set_filenames(array( ! 'message_body' => 'message_body.tpl') ! ); ! } ! else ! { ! $template->set_filenames(array( ! 'message_body' => 'admin/admin_message_body.tpl') ! ); ! } ! ! $template->assign_vars(array( ! 'MESSAGE_TITLE' => $msg_title, ! 'MESSAGE_TEXT' => $msg_text) ! ); ! $template->pparse('message_body'); ! ! if ( !defined('IN_ADMIN') ) ! { ! include($phpbb_root_path . 'includes/page_tail.'.$phpEx); ! } ! else ! { ! include($phpbb_root_path . 'admin/page_footer_admin.'.$phpEx); ! } ! } ! else ! { ! echo "<html>\n<body>\n" . $msg_title . "\n<br /><br />\n" . $msg_text . "</body>\n</html>"; ! } ! ! exit; } --- 56,61 ---- global $userdata, $user_ip, $session_length; global $starttime; ! message_die($msg_code, $msg_text = '', $msg_title = '', $err_line = '', $err_file = '', $sql = ''); } *************** *** 612,615 **** } } - } ?> \ No newline at end of file --- 415,417 ---- Index: functions_kb.php =================================================================== RCS file: /cvsroot/mxbb/kb_076_mxaddon/root/includes/functions_kb.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** functions_kb.php 29 Mar 2005 20:06:57 -0000 1.3 --- functions_kb.php 29 Mar 2005 21:39:30 -0000 1.4 *************** *** 212,217 **** global $kb_news_sort_method_extra, $kb_news_sort_method, $kb_news_sort_par, $kb_config, $kb_is_auth; ! // $sql = "SELECT * FROM " . KB_ARTICLES_TABLE . " WHERE"; ! $sql = "SELECT t.*, u.username, u.user_id, u.user_rank, u.user_sig, u.user_sig_bbcode_uid, u.user_allowsmile FROM " . KB_ARTICLES_TABLE . " t, " . USERS_TABLE . " u WHERE "; --- 212,216 ---- global $kb_news_sort_method_extra, $kb_news_sort_method, $kb_news_sort_par, $kb_config, $kb_is_auth; ! $sql = "SELECT t.*, u.user_id, u.user_rank, u.user_sig, u.user_sig_bbcode_uid, u.user_allowsmile FROM " . KB_ARTICLES_TABLE . " t, " . USERS_TABLE . " u WHERE "; *************** *** 268,274 **** // author information $author_id = $article['article_author_id']; ! if ( $author_id == 0 ) { ! $author = ( $username != '' ) ? $lang['Guest'] : $article['username']; } else --- 267,273 ---- // author information $author_id = $article['article_author_id']; ! if ( $author_id == -1 ) { ! $author = ( $article['username'] == '' ) ? $lang['Guest'] : $article['username']; } else *************** *** 1582,1595 **** // author information $author_id = $article['article_author_id']; ! if ( $author_id == 0 ) { ! $author = ( $username != '' ) ? $lang['Guest'] : $article['username']; } else { ! $author_name = get_kb_author( $author_id ); $temp_url = append_sid( $phpbb_root_path . "profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$author_id" ); ! $author = '<a href="' . $temp_url . '" class="gen">' . $author_name . '</a>'; } --- 1581,1594 ---- // author information $author_id = $article['article_author_id']; ! if ( $author_id == -1 ) { ! $author = ( $article['username'] == '' ) ? $lang['Guest'] : $article['username']; } else { ! $author = get_kb_author( $author_id ); $temp_url = append_sid( $phpbb_root_path . "profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$author_id" ); ! $author = '<a href="' . $temp_url . '" class="gen">' . $author . '</a>'; } *************** *** 1673,1677 **** function kb_get_data($row, $userdata, $kb_post_mode = '') { ! global $db; $kb_author_data = get_kb_author( $row['article_author_id'], true ); --- 1672,1676 ---- function kb_get_data($row, $userdata, $kb_post_mode = '') { ! global $db, $lang, $username; $kb_author_data = get_kb_author( $row['article_author_id'], true ); *************** *** 1699,1708 **** // Article author $kb_comment['article_author_id'] = $row['article_author_id']; ! $kb_comment['article_author'] = $kb_author_data['username']; $kb_comment['article_author_sig'] = $kb_author_data['user_attachsig']; // Article editor $kb_comment['article_editor_id'] = $userdata['user_id']; ! $kb_comment['article_editor'] = $userdata['username']; $kb_comment['article_editor_sig'] = $userdata['user_attachsig']; --- 1698,1707 ---- // Article author $kb_comment['article_author_id'] = $row['article_author_id']; ! $kb_comment['article_author'] = $row['article_author_id'] != -1 ? $kb_author_data['username'] : ( ( $row['username'] == '' ) ? $lang['Guest'] : $row['username'] ) ; $kb_comment['article_author_sig'] = $kb_author_data['user_attachsig']; // Article editor $kb_comment['article_editor_id'] = $userdata['user_id']; ! $kb_comment['article_editor'] = ( $userdata['user_id'] != '-1' ) ? $userdata['username'] : ( ( $username == '' ) ? $lang['Guest'] : $username ); $kb_comment['article_editor_sig'] = $userdata['user_attachsig']; *************** *** 1710,1717 **** } // Compose phpbb comment header function kb_compose_comment( $kb_comment ) { ! global $lang, $kb_comment, $phpEx, $kb_custom_field; $search = array ( "'&(quot|#34);'i", // Replace HTML entities --- 1709,1721 ---- } + if ( $author_id == -1 ) + { + $author_kb_art = ( $username != '' ) ? $lang['Guest'] : $row['username']; + } + // Compose phpbb comment header function kb_compose_comment( $kb_comment ) { ! global $lang, $phpEx, $kb_custom_field; $search = array ( "'&(quot|#34);'i", // Replace HTML entities Index: kb_post.php =================================================================== RCS file: /cvsroot/mxbb/kb_076_mxaddon/root/includes/kb_post.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** kb_post.php 29 Mar 2005 20:06:58 -0000 1.2 --- kb_post.php 29 Mar 2005 21:39:31 -0000 1.3 *************** *** 104,113 **** $bbcode_uid = ( !empty( $HTTP_POST_VARS['bbcode_uid'] ) ) ? $HTTP_POST_VARS['bbcode_uid'] : ''; ! $date = time(); ! $author_id = intval ( $userdata['user_id'] ); $type_id = intval ( $HTTP_POST_VARS['type_id'] ); $username = phpbb_clean_username( $HTTP_POST_VARS['username'] ); ! // Check message if ( !empty( $article_text ) ) --- 104,113 ---- $bbcode_uid = ( !empty( $HTTP_POST_VARS['bbcode_uid'] ) ) ? $HTTP_POST_VARS['bbcode_uid'] : ''; ! $date = time(); ! $author_id = $userdata['user_id'] > 0 ? intval ( $userdata['user_id'] ) : '-1'; $type_id = intval ( $HTTP_POST_VARS['type_id'] ); $username = phpbb_clean_username( $HTTP_POST_VARS['username'] ); ! // Check message if ( !empty( $article_text ) ) *************** *** 342,345 **** --- 342,346 ---- $type_id = ( isset( $HTTP_POST_VARS['type_id'] ) ) ? htmlspecialchars( trim( stripslashes( $HTTP_POST_VARS['type_id'] ) ) ) : $row['article_type']; $bbcode_uid = ( isset( $HTTP_POST_VARS['bbcode_uid'] ) ) ? htmlspecialchars( trim( stripslashes( $HTTP_POST_VARS['bbcode_uid'] ) ) ) : $row['bbcode_uid']; + $username = ( isset( $HTTP_POST_VARS['username'] ) ) ? htmlspecialchars( trim( stripslashes( $HTTP_POST_VARS['username'] ) ) ) : $row['username']; if ( $preview ) *************** *** 487,490 **** --- 488,492 ---- 'ARTICLE_DESC' => $kb_desc, 'ARTICLE_BODY' => $kb_text, + 'USERNAME' => $username, 'L_ADD_ARTICLE' => $lang['Add_article'], |