|
From: Jon O. <jon...@us...> - 2005-03-29 21:41:13
|
Update of /cvsroot/mxbb/mx_kb/includes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1986/modules/mx_kb/includes Modified Files: functions_kb.php kb_article.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/mx_kb/includes/kb_article.php,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** kb_article.php 29 Mar 2005 20:02:00 -0000 1.16 --- kb_article.php 29 Mar 2005 21:41:02 -0000 1.17 *************** *** 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: kb_post.php =================================================================== RCS file: /cvsroot/mxbb/mx_kb/includes/kb_post.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** kb_post.php 29 Mar 2005 20:02:01 -0000 1.3 --- kb_post.php 29 Mar 2005 21:41:03 -0000 1.4 *************** *** 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'], Index: functions_kb.php =================================================================== RCS file: /cvsroot/mxbb/mx_kb/includes/functions_kb.php,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** functions_kb.php 29 Mar 2005 20:01:59 -0000 1.21 --- functions_kb.php 29 Mar 2005 21:41:02 -0000 1.22 *************** *** 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 |