[Phpbbkb-checkins] SF.net SVN: phpbbkb: [35] root
Status: Alpha
Brought to you by:
markthedaemon
From: <so...@us...> - 2007-01-06 11:14:44
|
Revision: 35 http://svn.sourceforge.net/phpbbkb/?rev=35&view=rev Author: softphp Date: 2007-01-06 03:14:40 -0800 (Sat, 06 Jan 2007) Log Message: ----------- - ACP now thoroughly tested and should be working 100%. - Alpha 1 is almost ready, need to implement some links here and there, and insert some auth here and there. Also preview function isn't coded yet. Besides that some native englishman just needs to look through the lang files and it's ready to go. Modified Paths: -------------- root/admin/admin_kb.php root/kb/functions.php root/kb.php root/language/lang_english/lang_kb.php root/templates/subSilver/admin/kb_cats.tpl root/templates/subSilver/kb_main.tpl root/templates/subSilver/kb_viewcat.tpl Modified: root/admin/admin_kb.php =================================================================== --- root/admin/admin_kb.php 2006-12-29 23:45:05 UTC (rev 34) +++ root/admin/admin_kb.php 2007-01-06 11:14:40 UTC (rev 35) @@ -52,6 +52,10 @@ $edit = isset($HTTP_GET_VARS['edit']) ? $HTTP_GET_VARS['edit'] : false; $delete = isset($HTTP_GET_VARS['delete']) ? $HTTP_GET_VARS['delete'] : false; $add = isset($HTTP_POST_VARS['add']) ? true : false; + if(!$add) + { + $add = isset($HTTP_GET_VARS['add']) ? true : false; + } $sort = isset($HTTP_GET_VARS['s']) ? $HTTP_GET_VARS['s'] : false; if($edit != false) @@ -192,8 +196,14 @@ if($delete != false) { $confirm = isset($HTTP_POST_VARS['confirm']) ? true : false; - if(!$confirm) + $cancel = isset($HTTP_POST_VARS['cancel']) ? true : false; + if($cancel) { + // Redirect back to cat page + + } + elseif(!$confirm) + { $s_hidden_fields = '<input type="hidden" name="cat_id" value="' . $delete . '" />'; $l_confirm = $lang['kbadm_confirm_deletecat']; @@ -237,6 +247,13 @@ message_die(GENERAL_ERROR, "Couldn't delete category from articlecats table.", "", __LINE__, __FILE__, $sql); } + // Delete subcats + $sql = "DELETE FROM " . KB_ARTICLES_TABLE . " WHERE cat_main = '" . $cat_id . "'"; + if(!$db->sql_query($sql)) + { + message_die(GENERAL_ERROR, "Couldn't delete subcategories from articlecats table.", "", __LINE__, __FILE__, $sql); + } + $message = $lang['kbadm_delcat_success'] . '<br /><br />' . sprintf($lang['kbadm_Click_return_catadmin'], '<a href="' . append_sid("admin_kb." . $phpEx . "?mode=cats") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_admin_index'], '<a href="' . append_sid("index.$phpEx?pane=right") . '">', '</a>'); // Delete all articles in this category or set cat_id to another one or? I'm not sure how we should handle this? @@ -266,7 +283,7 @@ 'S_SUBMIT_VALUE' => $lang['kbadm_addcat'], 'S_PARENT' => $parent, 'S_HIDDEN_FIELDS' => $s_hidden_fields, - 'S_FORUM_ACTION' => append_sid("admin_kb." . $phpEx . "mode=cats")) + 'S_FORUM_ACTION' => append_sid("admin_kb." . $phpEx . "?mode=cats")) ); $template->pparse('body'); @@ -294,8 +311,8 @@ 'body' => 'admin/kb_editcat.tpl') ); - $parent = generate_cat_parents($cat['cat_main']); - $s_hidden_fields = ""; + $parent = generate_cat_parents($HTTP_POST_VARS['parent']); + $s_hidden_fields = '<input type="hidden" name="add" value="1">'; $template->set_filenames(array( 'reg_header' => 'error_body.tpl') @@ -321,7 +338,7 @@ 'S_SUBMIT_VALUE' => $lang['kbadm_addcat'], 'S_PARENT' => $parent, 'S_HIDDEN_FIELDS' => $s_hidden_fields, - 'S_FORUM_ACTION' => append_sid("admin_kb." . $phpEx . "?mode=cats&edit=" . $edit)) + 'S_FORUM_ACTION' => append_sid("admin_kb." . $phpEx . "?mode=cats")) ); $template->pparse('body'); @@ -355,7 +372,7 @@ { $sort = explode("|", $sort); - // ok so ?sort=id,id2|up/down|level + // ok so ?sort=id|up/down|level sort_cats("", $sort[0], $sort[1], $sort[2]); // Put id2 in the level argument, nvm that :) // And yes yet another message here @@ -374,8 +391,6 @@ $template->assign_vars(array( 'L_CATEGORIES' => $lang['kb_categories'], 'L_EDITCAT' => $lang['kbadm_editcat'], - 'L_MOVECAT_UP' => $lang['kbadm_movecatup'], - 'L_MOVECAT_DOWN' => $lang['kbadm_movecatdown'], 'L_DELCAT' => $lang['kbadm_delcat'], 'L_HEADER' => $lang['Categories'], 'L_EXPLAIN' => $lang['kbadm_maincat_explain']) @@ -385,69 +400,111 @@ { for($i = 0; $i < $total_catrows; $i++) { - //$auth = kb_auth("view", $catrows[$i]['cat_id'], $userdata); + // Check if the cat is at the top and therefore cant be moved up + if(($cats[$i - 1]['cat_main'] != $cats[$i]['cat_main']) || (strlen($cats[$i - 1]['cat_id']) == 0)) + { + $movecat_up = $lang['kbadm_movecatup']; + } + else + { + $movecat_up = '<a href="' . append_sid('admin_kb.' . $phpEx . '?mode=cats&s=' . $cats[$i]['cat_id'] . '|up|' . $cats[$i]['cat_main']) . '">' . $lang['kbadm_movecatup'] . '</a>'; + } - // auth not included in alpha - //if($auth['auth_view']) - //{ - // Ok display one cat here - $template->assign_block_vars('catrow', array( - // Name 'nd stuff - 'CAT_TITLE' => $cats[$i]['cat_title'], - 'CAT_DESC' => $cats[$i]['cat_desc'], - - // Links - 'U_EDITCAT' => append_sid("admin_kb." . $phpEx . "?mode=cats&edit=" . $cats[$i]['cat_id']), - 'U_DELCAT' => append_sid("admin_kb." . $phpEx . "?mode=cats&delete=" . $cats[$i]['cat_id']), - // sort=id,id2|up/down|level - 'U_MOVECAT_UP' => append_sid("admin_kb." . $phpEx . "?mode=cats&s=" . $cats[$i]['cat_id'] . "," . $cats[$i - 1]['cat_id'] . "|up|" . $cats[$i]['cat_main']), - 'U_MOVECAT_DOWN' => append_sid("admin_kb." . $phpEx . "?mode=cats&s=" . $cats[$i]['cat_id'] . "," . $cats[$i + 1]['cat_id'] . "|down|" . $cats[$i]['cat_main']), - - // Image - 'FORUM_FOLDER_IMG' => "../" . $images['forum']) // Stolen :D - ); + // Check if the cat is at the bottom and therefore cant be moved down + if(($cats[$i + 1]['cat_main'] != $cats[$i]['cat_main']) || (strlen($cats[$i + 1]['cat_id']) == 0)) + { + $movecat_down = $lang['kbadm_movecatdown']; + } + else + { + $movecat_down = '<a href="' . append_sid('admin_kb.' . $phpEx . '?mode=cats&s=' . $cats[$i]['cat_id'] . '|down|' . $cats[$i]['cat_main']) . '">' . $lang['kbadm_movecatdown'] . '</a>'; + } + + // Ok display one cat here + $template->assign_block_vars('catrow', array( + // Name 'nd stuff + 'CAT_TITLE' => $cats[$i]['cat_title'], + 'CAT_DESC' => $cats[$i]['cat_desc'], - if($total_subcats = count($cats[$i]['subcats'])) + // Links + 'U_EDITCAT' => append_sid("admin_kb." . $phpEx . "?mode=cats&edit=" . $cats[$i]['cat_id']), + 'U_DELCAT' => append_sid("admin_kb." . $phpEx . "?mode=cats&delete=" . $cats[$i]['cat_id']), + // sort=id,id2|up/down|level + 'MOVECAT_UP' => $movecat_up, + 'MOVECAT_DOWN' => $movecat_down, + + // Image + 'FORUM_FOLDER_IMG' => "../" . $images['forum']) // Stolen :D + ); + + if($total_subcats = count($cats[$i]['subcats'])) + { + // Contains subcats, show them + //$template->assign_block_vars('catrow.switch_subcat', array( + //'L_SUBCATS' => $lang['kb_subcats']) + //); + + for($j = 0; $j < $total_subcats; $j++) { - // Contains subcats, show them - $template->assign_block_vars('catrow.switch_subcat', array( - 'L_SUBCATS' => $lang['kb_subcats']) - ); + if(($cats[$i]['subcats'][$j - 1]['cat_main'] != $cats[$i]['subcats'][$j]['cat_main']) || (strlen($cats[$i]['subcats'][$j - 1]['cat_id']) == 0)) + { + $subcatmove_up = $lang['kbadm_movecatup']; + } + else + { + $subcatmove_up = '<a href="' . append_sid('admin_kb.' . $phpEx . '?mode=cats&s=' . $cats[$i]['subcats'][$j]['cat_id'] . '|up') . '">' . $lang['kbadm_movecatup'] . '</a>'; + } - for($j = 0; $j < $total_subcats; $j++) + // Check if the cat is at the bottom and therefore cant be moved down + if(($cats[$i]['subcats'][$j + 1]['cat_main'] != $cats[$i]['subcats'][$j]['cat_main']) || (strlen($cats[$i]['subcats'][$j + 1]['cat_id']) == 0)) { - //$auth = kb_auth("view", $subcats[$j]['cat_id'], $userdata); + $subcatmove_down = $lang['kbadm_movecatdown']; + } + else + { + $subcatmove_down = '<a href="' . append_sid('admin_kb.' . $phpEx . '?mode=cats&s=' . $cats[$i]['subcats'][$j]['cat_id'] . '|down') . '">' . $lang['kbadm_movecatdown'] . '</a>'; + } + + // Show the subcat + $template->assign_block_vars('catrow.subcatrow', array( + 'SUBCAT_TITLE' => $cats[$i]['subcats'][$j]['cat_title'], + 'SUBCAT_DESC' => $cats[$i]['subcats'][$j]['cat_desc'], - // auth not included in alpha - //if($auth['auth_view']) - //{ - // Show the subcat - $template->assign_block_vars('catrow.subcatrow', array( - 'SUBCAT_TITLE' => $cats[$i]['subcats'][$j]['cat_title'], - 'SUBCAT_DESC' => $cats[$i]['subcats'][$j]['cat_desc'], - - // Links - 'U_EDITSUBCAT' => append_sid("admin_kb." . $phpEx . "?mode=cats&edit=" . $cats[$i]['subcats'][$j]['cat_id']), - 'U_DELSUBCAT' => append_sid("admin_kb." . $phpEx . "?mode=cats&delete=" . $cats[$i]['subcats'][$j]['cat_id']), - // sort=id,id2|up/down|level - 'U_MOVESUBCAT_UP' => append_sid("admin_kb." . $phpEx . "?mode=cats&s=" . $cats[$i]['subcats'][$j]['cat_id'] . "," . $cats[$i]['subcats'][$j - 1]['cat_id'] . "|up|" . $cats[$i]['subcats'][$j]['cat_main']), - 'U_MOVESUBCAT_DOWN' => append_sid("admin_kb." . $phpEx . "?mode=cats&s=" . $cats[$i]['subcats'][$j]['cat_id'] . "," . $cats[$i]['subcats'][$j + 1]['cat_id'] . "|down|" . $cats[$i]['subcats'][$j]['cat_main']), - - 'TOPIC_FOLDER_IMG' => "../" . $images['folder']) // Stolen :D - ); - //} // if auth view - } // for subcats - - $template->assign_block_vars('catrow.switch_subcat_close', array()); - } // if subcats - //} // auth view + // Links + 'U_EDITSUBCAT' => append_sid("admin_kb." . $phpEx . "?mode=cats&edit=" . $cats[$i]['subcats'][$j]['cat_id']), + 'U_DELSUBCAT' => append_sid("admin_kb." . $phpEx . "?mode=cats&delete=" . $cats[$i]['subcats'][$j]['cat_id']), + // sort=id,id2|up/down|level + 'MOVESUBCAT_UP' => $subcatmove_up, + 'MOVESUBCAT_DOWN' => $subcatmove_down, + + 'TOPIC_FOLDER_IMG' => "../" . $images['folder']) // Stolen :D + ); + } // for subcats + + //$template->assign_block_vars('catrow.switch_subcat_close', array()); + } // if subcats } // for cats + $parent = generate_cat_parents(); + $s_hidden_fields = '<input type="hidden" name="add" value="1">'; + + $template->assign_vars(array( + 'L_CAT_SETTINGS' => $lang['kbadm_addcat'], + 'L_CAT_TITLE' => $lang['kbadm_cat_title'], + 'L_CAT_DESCRIPTION' => $lang['kbadm_cat_desc'], + 'L_CAT_PARENT' => $lang['kbadm_cat_parent'], + + 'S_SUBMIT_VALUE' => $lang['kbadm_addcat'], + 'S_PARENT' => $parent, + 'S_HIDDEN_FIELDS' => $s_hidden_fields, + 'S_FORUM_ACTION' => append_sid("admin_kb." . $phpEx . "?mode=cats")) + ); + $template->pparse('body'); }// total cats else { - message_die(GENERAL_MESSAGE, $lang['No_kb_cats']); + message_die(GENERAL_MESSAGE, sprintf($lang['No_kbadm_cats'], '<a href="' . append_sid("admin_kb." . $phpEx . "?mode=cats&add=1") . '">', '</a>')); } include('./page_footer_admin.'.$phpEx); @@ -474,7 +531,8 @@ $sql = "SELECT cat_id, cat_title FROM " . KB_CATEGORIES_TABLE . " - WHERE cat_main = '0' ORDER BY cat_order"; // At the moment only one level of subcats + WHERE cat_main = '0' + ORDER BY cat_order ASC"; // At the moment only one level of subcats if(!$result = $db->sql_query($sql)) { message_die(GENERAL_ERROR, "Couldn't get categories from categories table", "", __LINE__, __FILE__, $sql); @@ -537,8 +595,8 @@ $cat_number = $db->sql_numrows($result); - $sql = "UPDATE " . KB_CATEGORIES_TABLE . " - SET cat_order = '" . $cat_number + 1 . "' + $sql = "UPDATE " . KB_CATEGORIES_TABLE . " + SET cat_order = '" . $cat_number . "' WHERE cat_id = '" . $id . "'"; if(!$db->sql_query($sql)) @@ -566,16 +624,15 @@ while($old_cat = $db->sql_fetchrow($result)) { $i++; - $sql .= "UPDATE " . KB_CATEGORIES_TABLE . " + $sql = "UPDATE " . KB_CATEGORIES_TABLE . " SET cat_order = '" . $i . "' WHERE cat_id = '" . $old_cat['cat_id'] . "';\n"; + if(!$db->sql_query($sql)) + { + message_die(GENERAL_ERROR, "Couldn't sort old level order in cat table.", "", __LINE__, __FILE__, $sql); + } } - if(!$db->sql_query($sql)) - { - message_die(GENERAL_ERROR, "Couldn't sort old level order in cat table.", "", __LINE__, __FILE__, $sql); - } - // Ok insert it in the back of the new one :) $sql = "SELECT cat_id FROM " . KB_CATEGORIES_TABLE . " @@ -590,7 +647,7 @@ $cat_number = $db->sql_numrows($result); $sql = "UPDATE " . KB_CATEGORIES_TABLE . " - SET cat_order = '" . $cat_number + 1 . "' + SET cat_order = '" . $cat_number . "' WHERE cat_id = '" . $id . "'"; if(!$db->sql_query($sql)) @@ -602,52 +659,68 @@ } else { + $sql = "SELECT cat_order, cat_main + FROM " . KB_CATEGORIES_TABLE . " + WHERE cat_id = '" . $id . "'"; + + if(!$result = $db->sql_query($sql)) + { + message_die(GENERAL_ERROR, "Couldn't retrieve categories order data.", "", __LINE__, __FILE__, $sql); + } + + $cat = $db->sql_fetchrow($result); + if($dir == "up") { - $ids = explode(",", $id); + $num = $cat['cat_order'] - 1; - $sql = "UPDATE " . KB_CATEGORIES_TABLE . " - SET cat_order = cat_order - 1 - WHERE cat_id = '" . $ids[0] . "';"; - - $sql2 = "UPDATE " . KB_CATEGORIES_TABLE . " - SET cat_order = cat_order + 1 - WHERE cat_id = '" . $ids[1] . "' - AND cat_main = '" . $level . "';"; // to ensure they are in the same level. - - if(!$db->sql_query($sql)) + $sql = "SELECT cat_id, cat_order + FROM " . KB_CATEGORIES_TABLE . " + WHERE cat_order = '" . $num . "' + AND cat_main = '" . $cat['cat_main'] . "'"; + + if(!$result = $db->sql_query($sql)) { - message_die(GENERAL_ERROR, "Couldn't alter categories order.", "", __LINE__, __FILE__, $sql); + message_die(GENERAL_ERROR, "Couldn't retrieve categories order data.", "", __LINE__, __FILE__, $sql); } - if(!$db->sql_query($sql2)) - { - message_die(GENERAL_ERROR, "Couldn't alter categories order.", "", __LINE__, __FILE__, $sql); - } + $cat2 = $db->sql_fetchrow($result); } elseif($dir == "down") { - $ids = explode(",", $id); + $num = $cat['cat_order'] + 1; - $sql = "UPDATE " . KB_CATEGORIES_TABLE . " - SET cat_order = cat_order + 1 - WHERE cat_id = '" . $ids[0] . "';"; + $sql = "SELECT cat_id, cat_order + FROM " . KB_CATEGORIES_TABLE . " + WHERE cat_order = '" . $num . "' + AND cat_main = '" . $cat['cat_main'] . "'"; - $sql2 = "UPDATE " . KB_CATEGORIES_TABLE . " - SET cat_order = cat_order - 1 - WHERE cat_id = '" . $ids[1] . "' - AND cat_main = '" . $level . "';"; // to ensure they are in the same level - - if(!$db->sql_query($sql)) + if(!$result = $db->sql_query($sql)) { - message_die(GENERAL_ERROR, "Couldn't alter categories order.", "", __LINE__, __FILE__, $sql); + message_die(GENERAL_ERROR, "Couldn't retrieve categories order data.", "", __LINE__, __FILE__, $sql); } - if(!$db->sql_query($sql2)) - { - message_die(GENERAL_ERROR, "Couldn't alter categories order.", "", __LINE__, __FILE__, $sql); - } + $cat2 = $db->sql_fetchrow($result); } + + $sql = "UPDATE " . KB_CATEGORIES_TABLE . " + SET cat_order = '" . $cat2['cat_order'] . "' + WHERE cat_id = '" . $id . "'"; + + if(!$db->sql_query($sql)) + { + message_die(GENERAL_ERROR, "Couldn't alter categories order data.", "", __LINE__, __FILE__, $sql); + } + + $sql = "UPDATE " . KB_CATEGORIES_TABLE . " + SET cat_order = '" . $cat['cat_order'] . "' + WHERE cat_id = '" . $cat2['cat_id'] . "'"; + + if(!$db->sql_query($sql)) + { + message_die(GENERAL_ERROR, "Couldn't alter categories order data.", "", __LINE__, __FILE__, $sql); + } + return; } } Modified: root/kb/functions.php =================================================================== --- root/kb/functions.php 2006-12-29 23:45:05 UTC (rev 34) +++ root/kb/functions.php 2007-01-06 11:14:40 UTC (rev 35) @@ -113,7 +113,7 @@ $sql = "SELECT * FROM " . KB_CATEGORIES_TABLE . " WHERE cat_main = '0' - ORDER BY cat_order"; + ORDER BY cat_order ASC"; if( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Could not query cats.', '', __LINE__, __FILE__, $sql); @@ -127,7 +127,7 @@ $sql = "SELECT * FROM " . KB_CATEGORIES_TABLE . " WHERE cat_main = '" . $row['cat_id'] . "' - ORDER BY cat_order"; + ORDER BY cat_order ASC"; if( !($subcat_result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Could not query subcats.', '', __LINE__, __FILE__, $sql); @@ -147,10 +147,45 @@ //////////////////////////////////////// /// UCP FUNCTIONS /// //////////////////////////////////////// -$html_entities_match = array('#&(?!(\#[0-9]+;))#', '#<#', '#>#', '#"#'); -$html_entities_replace = array('&', '<', '>', '"'); -$unhtml_specialchars_match = array('#>#', '#<#', '#"#', '#&#'); -$unhtml_specialchars_replace = array('>', '<', '"', '&'); +function ucp_generate_page_title($action) +{ + global $lang; + + $title = $lang['kb_ucp']; + switch($action) + { + case "articles": + break; + + case "comments": + break; + + case "post_article": + $title .= ": " . $lang['kb_ucp_articlepost']; + break; + + case "edit_article": + $title .= ": " . $lang['kb_ucp_articleedit']; + break; + + case "delete_article": + break; + + case "post_comment": // Only input + break; + + case "edit_comment": + break; + + case "delete_comment": + break; + + default: + break; + } + + return $title; +} // This is for posting articles, mostly cut out of the posting.php :) function ucp_article_form($mode, $id, $review) @@ -160,6 +195,12 @@ $error_msg = ''; $user_sig = $userdata['user_sig']; + // This is instead of authentication which will be featured after alpha + if(!$userdata['session_logged_in']) + { + message_die(GENERAL_MESSAGE, 'Not authenticated!'); + } + if(!empty($HTTP_POST_VARS['post'])) { if($mode == 'edit') @@ -737,6 +778,8 @@ // Clean up the message // $message = trim($message); + $html_entities_match = array('#&(?!(\#[0-9]+;))#', '#<#', '#>#', '#"#'); + $html_entities_replace = array('&', '<', '>', '"'); if ($html_on) { @@ -779,6 +822,9 @@ function unprepare_message($message) { + $unhtml_specialchars_match = array('#>#', '#<#', '#"#', '#&#'); + $unhtml_specialchars_replace = array('>', '<', '"', '&'); + return preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, $message); } ?> \ No newline at end of file Modified: root/kb.php =================================================================== --- root/kb.php 2006-12-29 23:45:05 UTC (rev 34) +++ root/kb.php 2007-01-06 11:14:40 UTC (rev 35) @@ -58,7 +58,7 @@ $sql = "SELECT c.cat_id, c.cat_main, c.cat_title, c.cat_desc, c.cat_articles, c.cat_order FROM " . KB_CATEGORIES_TABLE . " c WHERE c.cat_main = '0' - ORDER BY c.cat_order"; + ORDER BY c.cat_order ASC"; if( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Could not query categories list', '', __LINE__, __FILE__, $sql); @@ -79,9 +79,16 @@ 'body' => 'kb_main.tpl') ); + if($userdata['session_logged_in']) + { + $template->assign_block_vars('switch_add_article', array()); + } + $template->assign_vars(array( 'L_CATEGORIES' => $lang['kb_categories'], - 'L_ARTICLES' => $lang['kb_articles']) + 'L_ARTICLES' => $lang['kb_articles'], + 'L_ADD_ARTICLE' => $lang['kb_ucp_articlepost'], + 'U_ADD_ARTICLE' => append_sid("kb." . $phpEx . "?pid=ucp&action=post_article")) ); if($total_catrows = count($catrows)) @@ -107,7 +114,7 @@ $sql = "SELECT c.cat_id, c.cat_main, c.cat_title, c.cat_order FROM " . KB_CATEGORIES_TABLE . " c WHERE c.cat_main = '" . $catrows[$i]['cat_id'] . "' - ORDER BY c.cat_order"; + ORDER BY c.cat_order ASC"; if( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Could not query subcategories list', '', __LINE__, __FILE__, $sql); @@ -179,7 +186,7 @@ $sql = "SELECT c.cat_id, c.cat_main, c.cat_title, c.cat_desc, c.cat_articles, c.cat_order FROM " . KB_CATEGORIES_TABLE . " c WHERE c.cat_main = '$cat_id' - ORDER BY c.cat_order"; + ORDER BY c.cat_order ASC"; if( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Could not query subcategories list', '', __LINE__, __FILE__, $sql); @@ -263,13 +270,20 @@ 'body' => 'kb_viewcat.tpl') ); + if($userdata['session_logged_in']) + { + $template->assign_block_vars('switch_add_article', array()); + } + // Process the whole thing $template->assign_vars(array( 'L_VIEWS' => $lang['Views'], 'L_AUTHOR' => $lang['Author'], 'L_ARTICLES' => $lang['kb_articles'], 'L_SUBCATS' => sprintf($lang['kb_viewcat_subcats'], $cat['cat_title']), - 'L_LAST_ACTION' => $lang['kb_last_action']) + 'L_LAST_ACTION' => $lang['kb_last_action'], + 'L_ADD_ARTICLE' => $lang['kb_ucp_articlepost'], + 'U_ADD_ARTICLE' => append_sid("kb." . $phpEx . "?pid=ucp&action=post_article")) ); if( $total_subcats = count($subcats) ) Modified: root/language/lang_english/lang_kb.php =================================================================== --- root/language/lang_english/lang_kb.php 2006-12-29 23:45:05 UTC (rev 34) +++ root/language/lang_english/lang_kb.php 2007-01-06 11:14:40 UTC (rev 35) @@ -59,7 +59,7 @@ // Admin $lang['kbadm_header_editcat'] = "Edit Category"; -$lang['kbadm_explain_editcat'] = "Here you can edit the chosen category, specifying its name, parent category adn description."; +$lang['kbadm_explain_editcat'] = "Here you can edit the chosen category, specifying its name, parent category and description."; $lang['kbadm_cat_settings'] = "Category Properties"; $lang['kbadm_cat_title'] = "Category Title"; $lang['kbadm_cat_desc'] = "Category Description"; @@ -82,4 +82,6 @@ $lang['kbadm_editcat_success'] = "The category has been edited successfully."; $lang['kbadm_addcat_success'] = "Your new category has been added."; $lang['kbadm_sortcat_success'] = "The category has been moved as specified."; + +$lang['No_kbadm_cats'] = "No knowledge base categories has been added. Click %shere%s to create a new one."; ?> \ No newline at end of file Modified: root/templates/subSilver/admin/kb_cats.tpl =================================================================== --- root/templates/subSilver/admin/kb_cats.tpl 2006-12-29 23:45:05 UTC (rev 34) +++ root/templates/subSilver/admin/kb_cats.tpl 2007-01-06 11:14:40 UTC (rev 35) @@ -16,37 +16,51 @@ <td class="row1" align="center" valign="middle" height="50"><img src="{catrow.FORUM_FOLDER_IMG}" width="46" height="25" /></td> <td class="row1" width="100%" height="50">{catrow.CAT_TITLE}<br /> </span> <span class="genmed">{catrow.CAT_DESC}</td> - <td class="row2" align="center" valign="middle" height="50" nowrap="nowrap"><span class="genmed"><a href="{catrow.U_EDITCAT}">{L_EDITCAT}</a></span></td> - <td class="row2" align="center" valign="middle" height="50" nowrap="nowrap"><span class="genmed"><a href="{catrow.U_MOVECAT_UP}">{L_MOVECAT_UP}</a></span></td> - <td class="row2" align="center" valign="middle" height="50" nowrap="nowrap"><span class="genmed"><a href="{catrow.U_MOVECAT_DOWN}">{L_MOVECAT_DOWN}</a></span></td> - <td class="row2" align="center" valign="middle" height="50" nowrap="nowrap"><span class="genmed"><a href="{catrow.U_DELCAT}">{L_DELCAT}</a></span></td> + <td class="row1" align="center" valign="middle" height="50" nowrap="nowrap"><span class="genmed"><a href="{catrow.U_EDITCAT}">{L_EDITCAT}</a></span></td> + <td class="row1" align="center" valign="middle" height="50" nowrap="nowrap"><span class="genmed">{catrow.MOVECAT_UP}</span></td> + <td class="row1" align="center" valign="middle" height="50" nowrap="nowrap"><span class="genmed">{catrow.MOVECAT_DOWN}</span></td> + <td class="row1" align="center" valign="middle" height="50" nowrap="nowrap"><span class="genmed"><a href="{catrow.U_DELCAT}">{L_DELCAT}</a></span></td> </tr> - <!-- BEGIN switch_subcat --> - <tr> - <td class="catLeft" colspan="2" height="28"><span class="cattitle">{catrow.switch_subcat.L_SUBCATS}</span></td> - <td class="rowpic" colspan="4" align="right"> </td> - </tr> - <!-- END switch_subcat --> <!-- BEGIN subcatrow --> <tr> - <td class="row1" align="center" valign="middle" height="50"><img src="{catrow.subcatrow.TOPIC_FOLDER_IMG}" width="19" height="18" /></td> - <td class="row1" width="100%" height="50">{catrow.subcatrow.SUBCAT_TITLE}<br /> + <td class="row2" align="center" valign="middle" height="50"><img src="{catrow.subcatrow.TOPIC_FOLDER_IMG}" width="19" height="18" /></td> + <td class="row2" width="100%" height="50">{catrow.subcatrow.SUBCAT_TITLE}<br /> <span class="genmed">{catrow.subcatrow.SUBCAT_DESC}</span></td> <td class="row2" align="center" valign="middle" height="50" nowrap="nowrap"><span class="genmed"><a href="{catrow.subcatrow.U_EDITSUBCAT}">{L_EDITCAT}</a></span></td> - <td class="row2" align="center" valign="middle" height="50" nowrap="nowrap"><span class="genmed"><a href="{catrow.subcatrow.U_MOVESUBCAT_UP}">{L_MOVECAT_UP}</a></span></td> - <td class="row2" align="center" valign="middle" height="50" nowrap="nowrap"><span class="genmed"><a href="{catrow.subcatrow.U_MOVESUBCAT_DOWN}">{L_MOVECAT_DOWN}</a></span></td> + <td class="row2" align="center" valign="middle" height="50" nowrap="nowrap"><span class="genmed">{catrow.subcatrow.MOVESUBCAT_UP}</span></td> + <td class="row2" align="center" valign="middle" height="50" nowrap="nowrap"><span class="genmed">{catrow.subcatrow.MOVESUBCAT_DOWN}</span></td> <td class="row2" align="center" valign="middle" height="50" nowrap="nowrap"><span class="genmed"><a href="{catrow.subcatrow.U_DELSUBCAT}">{L_DELCAT}</a></span></td> </tr> <!-- END subcatrow --> - <!-- BEGIN switch_subcat_close --> - <tr> - <td class="catBottom" align="center" valign="middle" colspan="6" height="28"> </td> - </tr> - <!-- END switch_subcat_close --> <!-- END catrow --> <tr> <td class="catBottom" align="center" valign="middle" colspan="6" height="28"> </td> </tr> </table> +<br clear="all" /> + +<form action="{S_FORUM_ACTION}" method="post"> + <table width="100%" cellpadding="4" cellspacing="1" border="0" class="forumline" align="center"> + <tr> + <th class="thHead" colspan="2">{L_CAT_SETTINGS}</th> + </tr> + <tr> + <td class="row1">{L_CAT_TITLE}</td> + <td class="row2"><input type="text" size="25" name="title" value="" class="post" /></td> + </tr> + <tr> + <td class="row1">{L_CAT_DESCRIPTION}</td> + <td class="row2"><textarea rows="5" cols="45" wrap="virtual" name="desc" class="post"></textarea></td> + </tr> + <tr> + <td class="row1">{L_CAT_PARENT}</td> + <td class="row2">{S_PARENT}</td> + </tr> + <tr> + <td class="catBottom" colspan="2" align="center">{S_HIDDEN_FIELDS}<input type="submit" name="submit" value="{S_SUBMIT_VALUE}" class="mainoption" /></td> + </tr> + </table> +</form> + <br clear="all" /> \ No newline at end of file Modified: root/templates/subSilver/kb_main.tpl =================================================================== --- root/templates/subSilver/kb_main.tpl 2006-12-29 23:45:05 UTC (rev 34) +++ root/templates/subSilver/kb_main.tpl 2007-01-06 11:14:40 UTC (rev 35) @@ -1,5 +1,8 @@ <table width="100%" cellspacing="0" border="0" align="center" cellpadding="2"> <tr> + <!-- BEGIN switch_add_article --> + <td align="left" valign="middle" width="50"><a class="nav" href="{U_ADD_ARTICLE}">{L_ADD_ARTICLE}</a></td> + <!-- END switch_add_article --> <td align="left">{NAVIGATION}</td> <td align="right"> </td> </tr> @@ -36,7 +39,10 @@ </table> <table width="100%" cellspacing="0" border="0" align="center" cellpadding="2"> - <tr> + <tr> + <!-- BEGIN switch_add_article --> + <td align="left" valign="middle" width="50"><a class="nav" href="{U_ADD_ARTICLE}">{L_ADD_ARTICLE}</a></td> + <!-- END switch_add_article --> <td align="left">{NAVIGATION}</td> <td align="right"><span class="gensmall">{S_TIMEZONE}</span></td> </tr> Modified: root/templates/subSilver/kb_viewcat.tpl =================================================================== --- root/templates/subSilver/kb_viewcat.tpl 2006-12-29 23:45:05 UTC (rev 34) +++ root/templates/subSilver/kb_viewcat.tpl 2007-01-06 11:14:40 UTC (rev 35) @@ -1,5 +1,8 @@ <table width="100%" cellspacing="0" border="0" align="center" cellpadding="2"> - <tr> + <tr> + <!-- BEGIN switch_add_article --> + <td align="left" valign="middle" width="50"><a class="nav" href="{U_ADD_ARTICLE}">{L_ADD_ARTICLE}</a></td> + <!-- END switch_add_article --> <td align="left">{NAVIGATION}</td> <td align="right"> </td> </tr> @@ -52,7 +55,10 @@ <!-- END switch_articles --> <table width="100%" cellspacing="0" border="0" align="center" cellpadding="2"> - <tr> + <tr> + <!-- BEGIN switch_add_article --> + <td align="left" valign="middle" width="50"><a class="nav" href="{U_ADD_ARTICLE}">{L_ADD_ARTICLE}</a></td> + <!-- END switch_add_article --> <td align="left">{NAVIGATION}</td> <td align="right"><span class="gensmall">{S_TIMEZONE}</span></td> </tr> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |