Update of /cvsroot/mxbb/kb_076_mxaddon/root/includes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28989/modules/kb_076_mxaddon/root/includes Modified Files: functions_kb.php kb_article.php kb_cat.php kb_footer.php kb_header.php kb_moderator.php kb_post.php kb_stats.php Log Message: fixing up: - permissions - tpl - footers adding - cat jump box Index: kb_stats.php =================================================================== RCS file: /cvsroot/mxbb/kb_076_mxaddon/root/includes/kb_stats.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** kb_stats.php 1 Apr 2005 14:12:29 -0000 1.4 --- kb_stats.php 2 Apr 2005 20:35:40 -0000 1.5 *************** *** 35,38 **** --- 35,40 ---- // + $kb_quick_nav = get_kb_cat_list( '', 1, true, true ); + if ( !$is_block ) { Index: kb_header.php =================================================================== RCS file: /cvsroot/mxbb/kb_076_mxaddon/root/includes/kb_header.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** kb_header.php 1 Apr 2005 14:12:29 -0000 1.3 --- kb_header.php 2 Apr 2005 20:35:40 -0000 1.4 *************** *** 25,41 **** } - define( 'ALLOW_NEW', 1 ); - define( 'ALLOW_ANON', 1 ); - // Parse and show the overall header. $template->set_filenames( array( 'kb_header' => 'kb_header.tpl' ) ); - if ( isset ( $HTTP_GET_VARS['cat'] ) ) { if ( $kb_config['allow_new'] == 1 && ( $kb_is_auth['auth_post'] || $kb_is_auth['auth_mod'] ) ) { ! $temp_url = append_sid( this_kb_mxurl( "mode=add&cat=" . intval ($HTTP_GET_VARS['cat'] ) ) ); $add_article = '<a href="' . $temp_url . '">' . $lang['Add_article'] . '</a>'; } --- 25,44 ---- } // Parse and show the overall header. $template->set_filenames( array( 'kb_header' => 'kb_header.tpl' ) ); if ( isset ( $HTTP_GET_VARS['cat'] ) ) { + $category_id = intval ($HTTP_GET_VARS['cat'] ); + // Start auth check + // + $kb_is_auth = array(); + $kb_is_auth = kb_auth(AUTH_ALL, $category_id, $userdata); + // End of auth check + if ( $kb_config['allow_new'] == 1 && ( $kb_is_auth['auth_post'] || $kb_is_auth['auth_mod'] ) ) { ! $temp_url = append_sid( this_kb_mxurl( "mode=add&cat=" . $category_id ) ); $add_article = '<a href="' . $temp_url . '">' . $lang['Add_article'] . '</a>'; } *************** *** 79,83 **** if ( $kb_config['stats_list'] == 1 ) { ! get_quick_stats( intval( $HTTP_GET_VARS['cat'] ) ); } --- 82,86 ---- if ( $kb_config['stats_list'] == 1 ) { ! get_quick_stats( $category_id ); } Index: kb_article.php =================================================================== RCS file: /cvsroot/mxbb/kb_076_mxaddon/root/includes/kb_article.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** kb_article.php 1 Apr 2005 20:38:43 -0000 1.6 --- kb_article.php 2 Apr 2005 20:35:40 -0000 1.7 *************** *** 60,67 **** // // User authorisation levels output // ! ! $kb_auth_can = ( ( $kb_is_auth['auth_post'] ) ? $lang['KB_Rules_post_can'] : $lang['KB_Rules_post_cannot'] ) . '<br />'; $kb_auth_can .= ( ( $kb_is_auth['auth_edit'] ) ? $lang['KB_Rules_edit_can'] : $lang['KB_Rules_edit_cannot'] ) . '<br />'; $kb_auth_can .= ( ( $kb_is_auth['auth_delete'] ) ? $lang['KB_Rules_delete_can'] : $lang['KB_Rules_delete_cannot'] ) . '<br />'; --- 60,67 ---- // + // // User authorisation levels output // ! $kb_auth_can = '<br />' . ( ( $kb_is_auth['auth_post'] ) ? $lang['KB_Rules_post_can'] : $lang['KB_Rules_post_cannot'] ) . '<br />'; $kb_auth_can .= ( ( $kb_is_auth['auth_edit'] ) ? $lang['KB_Rules_edit_can'] : $lang['KB_Rules_edit_cannot'] ) . '<br />'; $kb_auth_can .= ( ( $kb_is_auth['auth_delete'] ) ? $lang['KB_Rules_delete_can'] : $lang['KB_Rules_delete_cannot'] ) . '<br />'; *************** *** 73,79 **** if ( $kb_is_auth['auth_mod'] ) { ! $kb_auth_can .= $lang['KB_Rules_moderate_can'] . '<br />'; } $category = get_kb_cat( $article_category_id ); $article_category_name = $category['category_name']; --- 73,81 ---- if ( $kb_is_auth['auth_mod'] ) { ! $kb_auth_can .= $lang['KB_Rules_moderate_can']; } + $kb_quick_nav = get_kb_cat_list( $article_category_id, 1, true, true ); + $category = get_kb_cat( $article_category_id ); $article_category_name = $category['category_name']; *************** *** 292,296 **** { $message = $lang['Article_not_exsist'] . '<br /><br />' . sprintf( $lang['Click_return_kb'], '<a href="' . append_sid( this_kb_mxurl() ) . '">', '</a>' ) . '<br /><br />' . sprintf( $lang['Click_return_index'], '<a href="' . append_sid( $phpbb_root_path . "index.$phpEx" ) . '">', '</a>' ); ! message_die( GENERAL_MESSAGE, $message ); } else --- 294,298 ---- { $message = $lang['Article_not_exsist'] . '<br /><br />' . sprintf( $lang['Click_return_kb'], '<a href="' . append_sid( this_kb_mxurl() ) . '">', '</a>' ) . '<br /><br />' . sprintf( $lang['Click_return_index'], '<a href="' . append_sid( $phpbb_root_path . "index.$phpEx" ) . '">', '</a>' ); ! mx_message_die( GENERAL_MESSAGE, $message ); } else *************** *** 299,303 **** // Populate the kb_comment variable ! $kb_comment = kb_get_data($row, $userdata); // Compose post header --- 301,305 ---- // Populate the kb_comment variable ! $kb_comment = kb_get_data($row, $userdata ); // Compose post header *************** *** 307,310 **** --- 309,335 ---- $kb_message = $message_temp['message']; $kb_update_message = $message_temp['update_message']; + + $topic_id_tmp = $row['topic_id']; + // + // Check if this topic exists. It could have been deleted by accident ;) If so recreate it! + // + if ( !empty($topic_id_tmp) ) + { + $sql = "SELECT * + FROM " . TOPICS_TABLE . " + WHERE topic_id = $topic_id_tmp"; + if ( !($result = $db->sql_query($sql)) ) + { + mx_message_die(GENERAL_ERROR, 'Could not obtain forums information', '', __LINE__, __FILE__, $sql); + } + } + + // + // If the query doesn't return any rows this isn't a valid topic. Set to null. + // + if ( !($topic_row = $db->sql_fetchrow($result)) ) + { + $topic_id = 0; + } // If no phpbb topic id is created, create on ;) *************** *** 312,317 **** { // 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 ); ! $sql = "UPDATE " . KB_ARTICLES_TABLE . " SET topic_id = " . $topic_data['topic_id'] . " WHERE article_id = " . $kb_comment['article_id']; --- 337,342 ---- { // Post ! $topic_data = kb_insert_post( $kb_message, $subject, $kb_comment['category_forum_id'], $kb_comment['article_editor_id'], $kb_comment['article_editor'], $kb_comment['article_editor_sig'], $kb_comment['topic_id'], $kb_update_message ); ! $sql = "UPDATE " . KB_ARTICLES_TABLE . " SET topic_id = " . $topic_data['topic_id'] . " WHERE article_id = " . $kb_comment['article_id']; *************** *** 422,428 **** 'COMMENTS_IMG' => $comments_img, ! 'PATH' => $path_kb, ! 'S_AUTH_LIST' => $kb_auth_can ! ) ); --- 447,451 ---- 'COMMENTS_IMG' => $comments_img, ! 'PATH' => $path_kb ) ); Index: functions_kb.php =================================================================== RCS file: /cvsroot/mxbb/kb_076_mxaddon/root/includes/functions_kb.php,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** functions_kb.php 1 Apr 2005 20:38:43 -0000 1.7 --- functions_kb.php 2 Apr 2005 20:35:40 -0000 1.8 *************** *** 300,304 **** $temp_url = append_sid( $module_root_path . "admin/admin_kb_art.$phpEx?mode=approve&a=$article_id" . "&start=" . $start); $approve = '<a href="' . $temp_url . '"><img src="' . $images['icon_approve'] . '" border="0" alt="' . $lang['Approve'] . '"></a>'; ! }elseif ( $article_approved == 1 ) { // unapprove --- 300,305 ---- $temp_url = append_sid( $module_root_path . "admin/admin_kb_art.$phpEx?mode=approve&a=$article_id" . "&start=" . $start); $approve = '<a href="' . $temp_url . '"><img src="' . $images['icon_approve'] . '" border="0" alt="' . $lang['Approve'] . '"></a>'; ! } ! elseif ( $article_approved == 1 ) { // unapprove *************** *** 310,332 **** $delete = '<a href="' . $temp_url . '"><img src="' . $phpbb_root_path . $images['icon_delpost'] . '" border="0" alt="' . $lang['Delete'] . '"></a>'; } ! else if ( $kb_is_auth['auth_mod'] ) { $category = get_kb_cat( $article_cat ); $category_name = $category['category_name']; ! if ( $article_approved == 2 || $article_approved == 0 ) ! { ! // approve ! $temp_url = append_sid( this_kb_mxurl( "mode=moderate&action=approve&a=$article_id&cat=$article_cat&page=$page_id" . "&start=" . $start) ); ! $approve = '<a href="' . $temp_url . '"><img src="' . $images['icon_approve'] . '" border="0" alt="' . $lang['Approve'] . '"></a>'; ! }elseif ( $article_approved == 1 ) ! { ! // unapprove ! $temp_url = append_sid( this_kb_mxurl( "mode=moderate&action=unapprove&a=$article_id&cat=$article_cat&page=$page_id" . "&start=" . $start) ); ! $approve = '<a href="' . $temp_url . '"><img src="' . $images['icon_unapprove'] . '" border="0" alt="' . $lang['Un_approve'] . '"></a>'; ! } ! // delete ! $temp_url = append_sid( this_kb_mxurl( "mode=moderate&action=delete&a=$article_id&cat=$article_cat&page=$page_id" . "&start=" . $start) ); ! $delete = '<a href="' . $temp_url . '"><img src="' . $phpbb_root_path . $images['icon_delpost'] . '" border="0" alt="' . $lang['Delete'] . '"></a>'; } --- 311,340 ---- $delete = '<a href="' . $temp_url . '"><img src="' . $phpbb_root_path . $images['icon_delpost'] . '" border="0" alt="' . $lang['Delete'] . '"></a>'; } ! else { $category = get_kb_cat( $article_cat ); $category_name = $category['category_name']; ! if ( $kb_is_auth['auth_mod'] ) ! { ! if ( $article_approved == 2 || $article_approved == 0 ) ! { ! // approve ! $temp_url = append_sid( this_kb_mxurl( "mode=moderate&action=approve&a=$article_id&cat=$article_cat&page=$page_id" . "&start=" . $start) ); ! $approve = '<a href="' . $temp_url . '"><img src="' . $images['icon_approve'] . '" border="0" alt="' . $lang['Approve'] . '"></a>'; ! } ! elseif ( $article_approved == 1 ) ! { ! // unapprove ! $temp_url = append_sid( this_kb_mxurl( "mode=moderate&action=unapprove&a=$article_id&cat=$article_cat&page=$page_id" . "&start=" . $start) ); ! $approve = '<a href="' . $temp_url . '"><img src="' . $images['icon_unapprove'] . '" border="0" alt="' . $lang['Un_approve'] . '"></a>'; ! } ! } ! if ( $kb_is_auth['auth_delete'] || $kb_is_auth['auth_mod']) ! { ! // delete ! $temp_url = append_sid( this_kb_mxurl( "mode=moderate&action=delete&a=$article_id&cat=$article_cat&page=$page_id" . "&start=" . $start) ); ! $delete = '<a href="' . $temp_url . '"><img src="' . $phpbb_root_path . $images['icon_delpost'] . '" border="0" alt="' . $lang['Delete'] . '"></a>'; ! } } *************** *** 546,550 **** function kb_notify( $action, $message, $to_id, $from_id ) { ! global $lang, $board_config, $kb_config, $db, $module_root_path, $phpbb_root_path, $mx_root_path, $phpEx; if ( $action == 2 ) // Mail --- 554,558 ---- function kb_notify( $action, $message, $to_id, $from_id ) { ! global $lang, $board_config, $kb_config, $db, $module_root_path, $phpbb_root_path, $mx_root_path, $phpEx, $userdata; if ( $action == 2 ) // Mail *************** *** 577,581 **** global $db, $lang, $user_ip, $board_config, $userdata, $phpbb_root_path, $phpEx; ! if ( !$from_id ) { $from_id = $userdata['user_id']; --- 585,589 ---- global $db, $lang, $user_ip, $board_config, $userdata, $phpbb_root_path, $phpEx; ! if ( empty( $from_id ) ) { $from_id = $userdata['user_id']; *************** *** 830,834 **** function get_kb_cat_index( $parent = 0 ) { ! global $db, $template, $phpbb_root_path, $mx_root_path, $module_root_path, $phpEx, $is_block, $page_id, $kb_config, $userdata; $sql = "SELECT * --- 838,842 ---- function get_kb_cat_index( $parent = 0 ) { ! global $db, $template, $phpbb_root_path, $mx_root_path, $module_root_path, $phpEx, $is_block, $page_id, $kb_config, $userdata, $kb_quick_nav; $sql = "SELECT * *************** *** 847,857 **** // Start auth check // ! $kb_is_auth = array(); ! $kb_is_auth = kb_auth(AUTH_ALL, $category['category_id'], $userdata); // End of auth check // - // Get number of articles in cat - newssuite addon $sql_num = "SELECT count(article_id) AS total --- 855,864 ---- // Start auth check // ! $kb_is_cat_auth = array(); ! $kb_is_cat_auth = kb_auth(AUTH_ALL, $category['category_id'], $userdata); // End of auth check // // Get number of articles in cat - newssuite addon $sql_num = "SELECT count(article_id) AS total *************** *** 886,890 **** $category = '<a href="' . $temp_url . '" class="forumlink">' . $category_name . '</a>'; // Newssuite operating mode ! if ( ns_auth_cat( $category_id ) && $kb_is_auth['auth_view']) { $template->assign_block_vars( 'catrow', array( 'CATEGORY' => $category, --- 893,897 ---- $category = '<a href="' . $temp_url . '" class="forumlink">' . $category_name . '</a>'; // Newssuite operating mode ! if ( ns_auth_cat( $category_id ) && $kb_is_cat_auth['auth_view']) { $template->assign_block_vars( 'catrow', array( 'CATEGORY' => $category, *************** *** 895,898 **** --- 902,907 ---- } + $kb_quick_nav = get_kb_cat_list( '', 1, true, true ); + return $template; } *************** *** 977,981 **** // gets sub categories for a category ! function get_kb_cat_subs_admin( $parent, $select = 1, $indent ) { global $db, $template, $phpbb_root_path, $module_root_path, $phpEx, $images, $row_color, $row_class, $theme, $i, $lang; --- 986,990 ---- // gets sub categories for a category ! function get_kb_cat_subs_admin( $parent, $select = 1, $indent, $ss ) { global $db, $template, $phpbb_root_path, $module_root_path, $phpEx, $images, $row_color, $row_class, $theme, $i, $lang; *************** *** 1022,1027 **** $down2 = '<a href="' . $temp_url . '" class="gen">' . $lang['Move_down'] . '</a>'; ! $row_color = ( !( $i % 2 ) ) ? $theme['td_color1'] : $theme['td_color2']; ! $row_class = ( !( $i % 2 ) ) ? $theme['td_class1'] : $theme['td_class2']; $template->assign_block_vars( 'catrow.subrow', array( 'CATEGORY' => $category2, --- 1031,1036 ---- $down2 = '<a href="' . $temp_url . '" class="gen">' . $lang['Move_down'] . '</a>'; ! $row_color = ( !( $ss % 2 ) ) ? $theme['td_color1'] : $theme['td_color2']; ! $row_class = ( !( $ss % 2 ) ) ? $theme['td_class1'] : $theme['td_class2']; $template->assign_block_vars( 'catrow.subrow', array( 'CATEGORY' => $category2, *************** *** 1029,1033 **** 'CAT_ARTICLES' => $category_articles2, ! 'INDENT' => $indent, 'U_EDIT' => $edit2, --- 1038,1042 ---- 'CAT_ARTICLES' => $category_articles2, ! 'INDENT' => $indent . '--» ', 'U_EDIT' => $edit2, *************** *** 1040,1048 **** ); ! $temp = $indent . '-> '; ! get_kb_cat_subs_admin( $category_id2, $select, $temp ); } ! return $template; } --- 1049,1058 ---- ); ! $temp = $indent . ' '; ! $ss++; ! $ss = get_kb_cat_subs_admin( $category_id2, $select, $temp, $ss ); } ! return $ss; } *************** *** 1082,1087 **** $status = ''; } ! $catlist .= "<option value=\"$category2[$idfield]\" $status>" . $indent . $category2[$namefield] . "</option>\n"; ! $temp = $indent . '-> '; $catlist .= get_kb_cat_subs_list( $category2[$idfield], $select, $selected, $temp ); } --- 1092,1097 ---- $status = ''; } ! $catlist .= "<option value=\"$category2[$idfield]\" $status>" . $indent . '--»'. $category2[$namefield] . "</option>\n"; ! $temp = $indent . ' '; $catlist .= get_kb_cat_subs_list( $category2[$idfield], $select, $selected, $temp ); } *************** *** 1140,1144 **** $catlist .= "<option value=\"$category[$idfield]\" $status>" . $category[$namefield] . "</option>\n"; ! $catlist .= get_kb_cat_subs_list( $category[$idfield], $select, $selected, ' -> ' ); } } --- 1150,1154 ---- $catlist .= "<option value=\"$category[$idfield]\" $status>" . $category[$namefield] . "</option>\n"; ! $catlist .= get_kb_cat_subs_list( $category[$idfield], $select, $selected, ' ' ); } } *************** *** 1374,1382 **** // Start KB addon - update original post -------------------------------------------------- - $sql = "SELECT topic_first_post_id FROM " . TOPICS_TABLE . " WHERE topic_id = '$topic_id'"; ! if ( !( $result = $db->sql_query( $sql ) ) ) { --- 1384,1391 ---- // Start KB addon - update original post -------------------------------------------------- $sql = "SELECT topic_first_post_id FROM " . TOPICS_TABLE . " WHERE topic_id = '$topic_id'"; ! if ( !( $result = $db->sql_query( $sql ) ) ) { *************** *** 1384,1401 **** } $row = $db->sql_fetchrow( $result ); ! $orig_post_id = $row[0]; ! $sql = "UPDATE " . TOPICS_TABLE . " SET topic_title = '$subject' WHERE topic_id = '$topic_id'"; ! if ( !( $result = $db->sql_query( $sql, BEGIN_TRANSACTION ) ) ) { message_die( GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql ); } - $message_tmp = $message . '\n\n' . $message_update_text; - $sql = "UPDATE " . POSTS_TEXT_TABLE . " SET post_subject = '$subject', --- 1393,1410 ---- } $row = $db->sql_fetchrow( $result ); ! $orig_post_id = $row[0]; ! $sql = "UPDATE " . TOPICS_TABLE . " SET topic_title = '$subject' WHERE topic_id = '$topic_id'"; ! if ( !( $result = $db->sql_query( $sql, BEGIN_TRANSACTION ) ) ) { message_die( GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql ); } + + $message_tmp = $mode == 'newtopic' ? $message : $message . '\n\n' . $message_update_text; $sql = "UPDATE " . POSTS_TEXT_TABLE . " SET post_subject = '$subject', *************** *** 1403,1416 **** post_text = '$message_tmp' WHERE post_id = '$orig_post_id'"; ! if ( !( $result = $db->sql_query( $sql, BEGIN_TRANSACTION ) ) ) { message_die( GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql ); } - // End kb addon coe ---------------------------------------------------------- // if all is well then return the id of our new post ! return array( 'post_id' => $post_id, 'topic_id' => $topic_id ); } --- 1412,1424 ---- post_text = '$message_tmp' WHERE post_id = '$orig_post_id'"; ! if ( !( $result = $db->sql_query( $sql, BEGIN_TRANSACTION ) ) ) { message_die( GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql ); } // End kb addon coe ---------------------------------------------------------- // if all is well then return the id of our new post ! return array( 'post_id' => $post_id, 'topic_id' => $topic_id, 'notify' => $message_tmp ); } *************** *** 1424,1428 **** if ( !MXBB_MODULE ) { ! $mxurl = $phpbb_root_path . 'kb.' . $phpEx . ( $args == '' ? '' : '?' . $args ); return $mxurl; } --- 1432,1436 ---- if ( !MXBB_MODULE ) { ! $mxurl = $module_root_path . 'kb.' . $phpEx . ( $args == '' ? '' : '?' . $args ); return $mxurl; } *************** *** 1456,1460 **** if ( !MXBB_MODULE ) { ! $mxurl = $phpbb_root_path . 'kb_search.' . $phpEx . ( $args == '' ? '' : '?' . $args ); return $mxurl; } --- 1464,1468 ---- if ( !MXBB_MODULE ) { ! $mxurl = $module_root_path . 'kb_search.' . $phpEx . ( $args == '' ? '' : '?' . $args ); return $mxurl; } *************** *** 1674,1681 **** } ! function kb_get_data($row, $userdata, $kb_post_mode = '') { ! global $db, $lang, $username; $kb_author_data = get_kb_author( $row['article_author_id'], true ); --- 1682,1695 ---- } ! function kb_get_data($row = '', $userdata = '', $kb_post_mode = 'add') { ! global $db, $lang, $username, $kb_config; + // Debug checks + if ( empty( $row ) || empty( $userdata ) ) + { + die('kb_get_data - empty pars'); + } + $kb_author_data = get_kb_author( $row['article_author_id'], true ); *************** *** 1686,1690 **** } $cat_row = $db->sql_fetchrow( $results ); ! // Article data $kb_comment['article_id'] = $row['article_id']; --- 1700,1704 ---- } $cat_row = $db->sql_fetchrow( $results ); ! // Article data $kb_comment['article_id'] = $row['article_id']; *************** *** 1702,1706 **** // Article author $kb_comment['article_author_id'] = $row['article_author_id']; ! $kb_comment['article_author'] = $kb_post_mode == 'add' ? ( $row['article_author_id'] != -1 ? $kb_author_data['username'] : ( ( $row['username'] == '' ) ? $lang['Guest'] : $row['username'] ) ) : $row['username']; $kb_comment['article_author_sig'] = $kb_author_data['user_attachsig']; --- 1716,1720 ---- // 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']; *************** *** 1708,1721 **** $kb_comment['article_editor_id'] = $userdata['user_id']; $kb_comment['article_editor'] = ( $userdata['user_id'] != '-1' ) ? $userdata['username'] : ( ( $username == '' ) ? $lang['Guest'] : stripslashes($username) ); ! $kb_comment['article_editor_sig'] = $userdata['user_attachsig']; return $kb_comment; } - if ( $author_id == -1 ) - { - $author_kb_art = ( $username != '' ) ? $lang['Guest'] : $row['username']; - } - // Compose phpbb comment header function kb_compose_comment( $kb_comment ) --- 1722,1736 ---- $kb_comment['article_editor_id'] = $userdata['user_id']; $kb_comment['article_editor'] = ( $userdata['user_id'] != '-1' ) ? $userdata['username'] : ( ( $username == '' ) ? $lang['Guest'] : stripslashes($username) ); ! $kb_comment['article_editor_sig'] = ( $userdata['user_id'] != '-1' ) ? $userdata['user_attachsig'] : '0'; ! ! // Debug checks ! if ( $kb_post_mode == 'edit' && $kb_config['use_comments'] && empty($kb_comment['topic_id'])) ! { ! die('kb_get_data - no forum topic id for comment'); ! } return $kb_comment; } // Compose phpbb comment header function kb_compose_comment( $kb_comment ) Index: kb_cat.php =================================================================== RCS file: /cvsroot/mxbb/kb_076_mxaddon/root/includes/kb_cat.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** kb_cat.php 1 Apr 2005 20:38:43 -0000 1.6 --- kb_cat.php 2 Apr 2005 20:35:40 -0000 1.7 *************** *** 42,50 **** // End of auth check // // // User authorisation levels output // ! $kb_auth_can = ( ( $kb_is_auth['auth_post'] ) ? $lang['KB_Rules_post_can'] : $lang['KB_Rules_post_cannot'] ) . '<br />'; $kb_auth_can .= ( ( $kb_is_auth['auth_edit'] ) ? $lang['KB_Rules_edit_can'] : $lang['KB_Rules_edit_cannot'] ) . '<br />'; $kb_auth_can .= ( ( $kb_is_auth['auth_delete'] ) ? $lang['KB_Rules_delete_can'] : $lang['KB_Rules_delete_cannot'] ) . '<br />'; --- 42,51 ---- // End of auth check + // // // User authorisation levels output // ! $kb_auth_can = '<br />' . ( ( $kb_is_auth['auth_post'] ) ? $lang['KB_Rules_post_can'] : $lang['KB_Rules_post_cannot'] ) . '<br />'; $kb_auth_can .= ( ( $kb_is_auth['auth_edit'] ) ? $lang['KB_Rules_edit_can'] : $lang['KB_Rules_edit_cannot'] ) . '<br />'; $kb_auth_can .= ( ( $kb_is_auth['auth_delete'] ) ? $lang['KB_Rules_delete_can'] : $lang['KB_Rules_delete_cannot'] ) . '<br />'; *************** *** 56,63 **** if ( $kb_is_auth['auth_mod'] ) { ! //$kb_auth_can .= sprintf($lang['KB_Rules_moderate'], "<a href=\"modcp.$phpEx?" . POST_FORUM_URL . "=$forum_id&start=" . $start . "&sid=" . $userdata['session_id'] . '">', '</a>'); ! $kb_auth_can .= $lang['KB_Rules_moderate_can'] . '<br />'; } if ( !$kb_is_auth['auth_view'] ) { --- 57,65 ---- if ( $kb_is_auth['auth_mod'] ) { ! $kb_auth_can .= $lang['KB_Rules_moderate_can']; } + $kb_quick_nav = get_kb_cat_list( $category_id, 1, true, true ); + if ( !$kb_is_auth['auth_view'] ) { *************** *** 160,164 **** } ! $template->assign_vars( array( 'PAGINATION' => $pagination, 'PAGE_NUMBER' => sprintf( $lang['Page_of'], ( floor( $start / $kb_config['art_pagination'] ) + 1 ), ceil( $total_articles / $kb_config['art_pagination'] ) ), 'L_GOTO_PAGE' => $lang['Goto_page'], --- 162,167 ---- } ! $template->assign_vars( array( ! 'PAGINATION' => $pagination, 'PAGE_NUMBER' => sprintf( $lang['Page_of'], ( floor( $start / $kb_config['art_pagination'] ) + 1 ), ceil( $total_articles / $kb_config['art_pagination'] ) ), 'L_GOTO_PAGE' => $lang['Goto_page'], *************** *** 177,182 **** 'PATH' => $path_kb, - 'S_AUTH_LIST' => $kb_auth_can, - 'U_CAT' => append_sid( this_kb_mxurl( 'mode=cat&cat=' . $category_id ) ) ) ); --- 180,183 ---- Index: kb_footer.php =================================================================== RCS file: /cvsroot/mxbb/kb_076_mxaddon/root/includes/kb_footer.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** kb_footer.php 1 Apr 2005 14:12:28 -0000 1.3 --- kb_footer.php 2 Apr 2005 20:35:40 -0000 1.4 *************** *** 27,34 **** // Parse and show the overall footer. ! $template->set_filenames( array( 'kb_footer' => 'kb_footer.tpl' ) ! ); ! $template->assign_vars( array( 'L_MODULE_VERSION' => $kb_module_version, 'L_MODULE_ORIG_AUTHOR' => $kb_module_orig_author, 'L_MODULE_AUTHOR' => $kb_module_author ) --- 27,60 ---- // Parse and show the overall footer. ! $template->set_filenames( array( 'kb_footer' => 'kb_footer.tpl' ) ); ! if ( !empty($kb_auth_can) ) ! { ! $template->assign_block_vars( 'auth_can', array() ); ! } ! ! if ( !empty($kb_quick_nav) ) ! { ! $template->assign_block_vars( 'quick_nav', array() ); ! } ! ! if ( !MXBB_MODULE ) ! { ! $template->assign_block_vars( 'copy_footer', array() ); ! } ! ! $quick_nav_action = this_kb_mxurl(); ! ! $template->assign_vars( array( ! 'QUICK_JUMP_ACTION' => $quick_nav_action, ! //'SID' => $userdata['session_id'], ! ! 'L_QUICK_NAV' => $lang['Quick_nav'], ! 'L_QUICK_JUMP' => $lang['Quick_jump'], ! 'QUICK_NAV' => $kb_quick_nav, ! ! 'S_AUTH_LIST' => $kb_auth_can, ! ! 'L_MODULE_VERSION' => $kb_module_version, 'L_MODULE_ORIG_AUTHOR' => $kb_module_orig_author, 'L_MODULE_AUTHOR' => $kb_module_author ) Index: kb_post.php =================================================================== RCS file: /cvsroot/mxbb/kb_076_mxaddon/root/includes/kb_post.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** kb_post.php 1 Apr 2005 14:12:29 -0000 1.5 --- kb_post.php 2 Apr 2005 20:35:40 -0000 1.6 *************** *** 169,204 **** $error_msg = ''; ! ! // If changed category ! if ( $old_category_id != $category_id ) { ! update_kb_number( $old_category_id, '- 1' ); ! if ( $kb_is_auth['auth_mod'] || ( $kb_is_auth['auth_approval_edit'] && $userdata['user_id'] == $author_id ) ) { update_kb_number( $category_id, '+ 1' ); } ! } ! ! // If unapproved ! if ( $kb_is_auth['auth_mod'] || ( $kb_is_auth['auth_approval_edit'] && $userdata['user_id'] == $author_id ) ) ! { ! $approve = 1; ! ! if ( $old_approve != 1 ) { update_kb_number( $category_id, '+ 1' ); } } ! else { $approve = 2; ! ! if ( $old_approve == 1 && $old_category_id == $category_id ) { ! update_kb_number( $category_id, '- 1' ); } ! } ! $sql = "UPDATE " . KB_ARTICLES_TABLE . " SET article_category_id = '$category_id', --- 169,199 ---- $error_msg = ''; ! ! $cat_switch = $old_category_id != $category_id; // Has switched category ! ! if ( $kb_is_auth['auth_mod'] || $kb_is_auth['auth_approval_edit'] ) // approval auth { ! $approve = 1; ! if ( $cat_switch ) { + update_kb_number( $old_category_id, ( $old_approve == 1 ? '- 1' : '0' ) ); update_kb_number( $category_id, '+ 1' ); } ! else { update_kb_number( $category_id, '+ 1' ); } } ! else { $approve = 2; ! ! if ( $cat_switch ) { ! update_kb_number( $old_category_id, ( $old_approve == 1 ? '- 1' : '0' ) ); } ! } ! $sql = "UPDATE " . KB_ARTICLES_TABLE . " SET article_category_id = '$category_id', *************** *** 277,283 **** if ( $approve == 1 && $kb_config['use_comments'] && $kb_is_auth['auth_comment']) { - // Post $topic_data = kb_insert_post( $kb_message, $subject, $kb_comment['category_forum_id'], $kb_comment['article_editor_id'], $kb_comment['article_editor'], $kb_comment['article_editor_sig'], $kb_comment['topic_id'], $kb_update_message ); ! $sql = "UPDATE " . KB_ARTICLES_TABLE . " SET topic_id = " . $topic_data['topic_id'] . " WHERE article_id = " . $kb_comment['article_id']; --- 272,277 ---- if ( $approve == 1 && $kb_config['use_comments'] && $kb_is_auth['auth_comment']) { $topic_data = kb_insert_post( $kb_message, $subject, $kb_comment['category_forum_id'], $kb_comment['article_editor_id'], $kb_comment['article_editor'], $kb_comment['article_editor_sig'], $kb_comment['topic_id'], $kb_update_message ); ! $sql = "UPDATE " . KB_ARTICLES_TABLE . " SET topic_id = " . $topic_data['topic_id'] . " WHERE article_id = " . $kb_comment['article_id']; *************** *** 289,300 **** } - $kb_message_tmp = $kb_message . '\n\n' . $kb_update_message; - - kb_notify( $kb_config['notify'], $kb_message_tmp, $kb_config['admin_id'], $kb_comment['article_author_id'] ); - $kb_custom_field->file_update_data( $article_id ); if ( $approve == 1 ) { mx_add_search_words( 'single', $article_id, stripslashes( $article_text ), stripslashes( $article_title ), 'kb' ); --- 283,291 ---- } $kb_custom_field->file_update_data( $article_id ); if ( $approve == 1 ) { + kb_notify( $kb_config['notify'], $kb_message, $kb_config['admin_id'], $kb_comment['article_editor_id'] ); mx_add_search_words( 'single', $article_id, stripslashes( $article_text ), stripslashes( $article_title ), 'kb' ); Index: kb_moderator.php =================================================================== RCS file: /cvsroot/mxbb/kb_076_mxaddon/root/includes/kb_moderator.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** kb_moderator.php 1 Apr 2005 20:38:43 -0000 1.4 --- kb_moderator.php 2 Apr 2005 20:35:40 -0000 1.5 *************** *** 41,45 **** // ! if ( !($kb_is_auth['auth_mod'] && $userdata['session_logged_in']) ) { $message = $lang['No_add'] . '<br /><br />' . sprintf( $lang['Click_return_kb'], '<a href="' . append_sid( this_kb_mxurl() ) . '">', '</a>' ) . '<br /><br />' . sprintf( $lang['Click_return_index'], '<a href="' . append_sid( $mx_root_path . "index.$phpEx" ) . '">', '</a>' ); --- 41,45 ---- // ! if ( !( ($kb_is_auth['auth_delete'] || $kb_is_auth['auth_mod']) && $userdata['session_logged_in'] ) ) { $message = $lang['No_add'] . '<br /><br />' . sprintf( $lang['Click_return_kb'], '<a href="' . append_sid( this_kb_mxurl() ) . '">', '</a>' ) . '<br /><br />' . sprintf( $lang['Click_return_index'], '<a href="' . append_sid( $mx_root_path . "index.$phpEx" ) . '">', '</a>' ); *************** *** 53,65 **** else { ! if ( $approve ) { $action = 'approve'; } ! else if ( $unapprove ) { $action = 'unapprove'; } ! else if ( $delete ) { $action = 'delete'; --- 53,65 ---- else { ! if ( $approve && $kb_is_auth['auth_mod']) { $action = 'approve'; } ! else if ( $unapprove && $kb_is_auth['auth_mod']) { $action = 'unapprove'; } ! else if ( $delete && ( $kb_is_auth['auth_mod'] || $kb_is_auth['auth_delete']) ) { $action = 'delete'; *************** *** 84,103 **** $topic_sql = ''; ! if ( $kb_is_auth['auth_comment'] && $kb_config['use_comments'] ) ! { ! if ( !$row['topic_id'] ) ! { ! $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'], $kb_comment['article_editor'], $kb_comment['article_editor_sig'], $kb_comment['topic_id'], $kb_update_message ); --- 84,104 ---- $topic_sql = ''; ! ! $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 ( $kb_config['use_comments'] ) + { + if ( !$row['topic_id'] ) + { // Post $topic_data = kb_insert_post( $kb_message, $subject, $kb_comment['category_forum_id'], $kb_comment['article_editor_id'], $kb_comment['article_editor'], $kb_comment['article_editor_sig'], $kb_comment['topic_id'], $kb_update_message ); *************** *** 118,121 **** --- 119,123 ---- update_kb_number( $article_category_id, '+ 1' ); + kb_notify( $kb_config['notify'], $kb_message, $kb_config['admin_id'], $kb_comment['article_editor_id'] ); mx_add_search_words( 'single', $article_id, stripslashes( $row['article_body'] ), stripslashes( $row['article_title'] ), 'kb' ); *************** *** 180,184 **** } ! if ( $kb_config['del_topic'] && $kb_is_auth['auth_delete'] && $article['topic_id'] ) { $topic = $article['topic_id']; --- 182,186 ---- } ! if ( $kb_config['del_topic'] && $article['topic_id'] ) { $topic = $article['topic_id']; *************** *** 324,327 **** --- 326,331 ---- } break; + + } |