phpbbkb-checkins Mailing List for phpBB Knowledge Base
Status: Alpha
Brought to you by:
markthedaemon
You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(3) |
Aug
(1) |
Sep
|
Oct
(6) |
Nov
(10) |
Dec
(8) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(10) |
Feb
(19) |
Mar
(5) |
Apr
(1) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <mar...@us...> - 2007-05-28 02:38:29
|
Revision: 71 http://svn.sourceforge.net/phpbbkb/?rev=71&view=rev Author: markthedaemon Date: 2007-05-27 19:38:31 -0700 (Sun, 27 May 2007) Log Message: ----------- Hrm, it's nearly 4am and probably not the best time to be looking at code. I'll check this in for now and then re-evaluate the situation after I've had some sleep. Night! Modified Paths: -------------- main/trunk/includes/functions_kb.php Modified: main/trunk/includes/functions_kb.php =================================================================== --- main/trunk/includes/functions_kb.php 2007-05-28 02:23:40 UTC (rev 70) +++ main/trunk/includes/functions_kb.php 2007-05-28 02:38:31 UTC (rev 71) @@ -221,11 +221,13 @@ $error_msg = ''; $user_sig = $userdata['user_sig']; + /* + No longer needed due to proper authentication in Alpha 2 // Simple auth for Alpha 1 if(!$userdata['session_logged_in']) { message_die(GENERAL_MESSAGE, 'Not authenticated!'); - } + } */ if(!empty($HTTP_POST_VARS['post'])) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2007-05-28 02:23:41
|
Revision: 70 http://svn.sourceforge.net/phpbbkb/?rev=70&view=rev Author: markthedaemon Date: 2007-05-27 19:23:40 -0700 (Sun, 27 May 2007) Log Message: ----------- Hello one and all. It's been a long time since I've had the chance to commit or even code on anything, however I've had some time spare so committing a couple of fixes for your enjoyment :D. Modified Paths: -------------- main/trunk/common.php main/trunk/kb.php Modified: main/trunk/common.php =================================================================== --- main/trunk/common.php 2007-04-05 08:00:39 UTC (rev 69) +++ main/trunk/common.php 2007-05-28 02:23:40 UTC (rev 70) @@ -220,7 +220,8 @@ $board_config[$row['config_name']] = $row['config_value']; } -// Shamelessly stolen from above for the KB configuration :P. +/* +Commenting out this whole section for now until it's decided whether we actually need all of the kb_config entries globally... $sql = "SELECT * FROM " . KB_CONFIG_TABLE; if( !($result = $db->sql_query($sql)) ) @@ -231,7 +232,7 @@ while ( $row = $db->sql_fetchrow($result) ) { $kb_config[$row['config_name']] = $row['config_value']; -} +} */ if (file_exists('install') || file_exists('contrib')) { Modified: main/trunk/kb.php =================================================================== --- main/trunk/kb.php 2007-04-05 08:00:39 UTC (rev 69) +++ main/trunk/kb.php 2007-05-28 02:23:40 UTC (rev 70) @@ -58,7 +58,7 @@ $auth = kb_auth("cat", $cat_id, $userdata); if(!$auth['auth_view']) { - message_die(GENERAL_MESSAGE, $lang['kb_noauth_viewcat']; + message_die(GENERAL_MESSAGE, $lang['kb_noauth_viewcat']); } // Store the main cat in a variable This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <so...@us...> - 2007-04-05 08:00:40
|
Revision: 69 http://svn.sourceforge.net/phpbbkb/?rev=69&view=rev Author: softphp Date: 2007-04-05 01:00:39 -0700 (Thu, 05 Apr 2007) Log Message: ----------- - Added authorization options in acp - Other auth stuff, more will follow. Please note that kb.php is broken at the moment. Modified Paths: -------------- main/trunk/admin/admin_kb.php main/trunk/includes/auth_kb.php main/trunk/includes/constants.php main/trunk/includes/functions_kb.php main/trunk/kb.php main/trunk/language/lang_english/lang_admin.php main/trunk/language/lang_english/lang_kb.php Added Paths: ----------- main/trunk/templates/subSilver/admin/kb_auth.tpl main/trunk/templates/subSilver/admin/kb_ugauth.tpl Modified: main/trunk/admin/admin_kb.php =================================================================== --- main/trunk/admin/admin_kb.php 2007-03-18 17:29:45 UTC (rev 68) +++ main/trunk/admin/admin_kb.php 2007-04-05 08:00:39 UTC (rev 69) @@ -23,7 +23,9 @@ if( !empty($setmodules) ) { $file = basename(__FILE__); - $module['KB']['Categories'] = "$file?mode=cats"; + $module['KB']['kbadm_Categories'] = "$file?mode=cats"; + $module['KB']['kbadm_Auth'] = "$file?mode=auth"; + $module['KB']['kbadm_Group_Auth'] = "$file?mode=ugauth"; return; } @@ -444,7 +446,7 @@ 'L_CATEGORIES' => $lang['kb_categories'], 'L_EDITCAT' => $lang['kbadm_editcat'], 'L_DELCAT' => $lang['kbadm_delcat'], - 'L_HEADER' => $lang['Categories'], + 'L_HEADER' => $lang['kbadm_Categories'], 'L_EXPLAIN' => $lang['kbadm_maincat_explain']) ); @@ -563,9 +565,366 @@ exit; break; - case "auth": // For later use + // Auth layout that is + case "auth": // Category Auth + $template->set_filenames(array( + 'body' => 'admin/kb_auth.tpl') + ); + + $auth_fields = array("auth_view", "auth_add", "auth_edit", "auth_delete", "auth_mod", "auth_comment", "auth_rate", "auth_attach"); + $auth_levels = array('ALL', 'REG', 'PRIVATE', 'MOD', 'ADMIN'); + $auth_const = array(AUTH_ALL, AUTH_REG, AUTH_ACL, AUTH_MOD, AUTH_ADMIN); + if(isset($HTTP_POST_VARS['submit']) && isset($HTTP_POST_VARS['auth'])) + { + // Process + $sql = "UPDATE " . KB_CATEGORIES_TABLE . " + SET "; + + for($i = 0; $i < count($auth_fields); $i++) + { + $sql .= $auth_fields[$i] . " = " . $HTTP_POST_VARS[$auth_fields[$i]] . ", "; + } + + $sql = substr($sql, 0, -2); + + $sql .= " + WHERE cat_id = '" . $HTTP_GET_VARS['c'] . "'"; + + if(!$db->sql_query($sql)) + { + message_die(GENERAL_ERROR, "Couldn't update auth data for the given category.", "", __LINE__, __FILE__, $sql); + } + + // Show a "choose a category" dialogue + $template->assign_vars(array( + 'COUNT_AUTH_FIELDS' => 1, + 'L_INFORMATION' => $lang['Information'], + 'L_CHOOSE_CAT' => $lang['kbadm_authupdate_success']) + ); + + $template->assign_block_vars('switch_no_cat', array()); + } + elseif(isset($HTTP_GET_VARS['c'])) + { + // Show cells + $sql = "SELECT cat_id, auth_view, auth_add, auth_edit, auth_delete, auth_mod, auth_comment, auth_rate, auth_attach + FROM " . KB_CATEGORIES_TABLE . " + WHERE cat_id = '" . $HTTP_GET_VARS['c'] . "'"; + + if(!$result = $db->sql_query($sql)) + { + message_die(GENERAL_ERROR, "Couldn't retrieve category auth data.", "", __LINE__, __FILE__, $sql); + } + + $cat = $db->sql_fetchrow($result); + + $template->assign_block_vars('switch_show_form', array()); + + for($i = 0; $i < count($auth_fields); $i++) + { + $template->assign_block_vars('switch_show_form.header_authrow', array( + 'L_AUTH_TITLE' => $lang['kbadm_' . $auth_fields[$i]]) + ); + + $auth_select = ' <select name="' . $auth_fields[$i] . '">'; + for($j = 0; $j < count($auth_const); $j++) + { + + $selected = ( $cat[$auth_fields[$i]] == $auth_const[$j] ) ? ' selected="selected"' : ''; + $auth_select .= '<option value="' . $auth_const[$j] . '"' . $selected . '>' . $lang['Forum_' . $auth_levels[$j]] . '</option>'; + } + $auth_select .= '</select> '; + + $template->assign_block_vars('switch_show_form.authrow', array( + 'S_AUTH_SELECT' => $auth_select) + ); + } + + $template->assign_vars(array( + 'COUNT_AUTH_FIELDS' => count($auth_fields), + 'S_AUTH_ACTION' => append_sid('admin_kb.' . $phpEx . '?mode=auth&c=' . $HTTP_GET_VARS['c']), + 'L_SUBMIT' => $lang['Submit']) + ); + } + else + { + // Show a "choose a category" dialogue + $template->assign_vars(array( + 'COUNT_AUTH_FIELDS' => 1, + 'L_INFORMATION' => $lang['Information'], + 'L_CHOOSE_CAT' => $lang['kbadm_choose_cat']) + ); + + $template->assign_block_vars('switch_no_cat', array()); + } + + $cats = get_cats_structure('cat_id, cat_title'); + $select = '<select name="c" onchange="if(this.options[this.selectedIndex].value != -1){ forms[\'choose_cat\'].submit() }"><option value="-1">' . $lang['kbadm_select_cat'] . '</option>'; + for($i = 0; $i < count($cats); $i++) + { + $catstring = ''; + + for($j = 0; $j < count($cats[$i]['subcats']); $j++) + { + $selected = ( $cats[$i]['subcats'][$j]['cat_id'] == $HTTP_GET_VARS['c'] ) ? 'selected="selected"' : ''; + $catstring .= '<option value="' . $cats[$i]['subcats'][$j]['cat_id'] . '"' . $selected . '>--' . $cats[$i]['subcats'][$j]['cat_title'] . '</option>'; + } + + $selected = ( $cats[$i]['cat_id'] == $HTTP_GET_VARS['c'] ) ? 'selected="selected"' : ''; + $select .= '<option value="' . $cats[$i]['cat_id'] . '"' . $selected . '>' . $cats[$i]['cat_title'] . '</option>'; + + if($catstring != '') + { + $select .= $catstring; + $select .= '<option value="-1">----------------</option>'; + } + } + + $select .= '</select>'; + + $template->assign_vars(array( + 'S_CAT_SELECT' => $select, + 'L_SELECT_CAT' => $lang['kbadm_select_cat'], + 'S_CHOOSE_CAT_ACTION' => 'admin_kb.' . $phpEx . '?mode=auth', + 'L_KBAUTH_TITLE' => $lang['kbadm_Auth'], + 'L_KBAUTH_EXPLAIN' => $lang['kbadm_Auth_explain'], + 'SID' => $userdata['session_id']) + ); + + $template->pparse('body'); + + include('./page_footer_admin.'.$phpEx); + exit; break; + case "ugauth": // Usergroup Auth + $template->set_filenames(array( + 'body' => 'admin/kb_ugauth.tpl') + ); + + $auth_fields = array("auth_view", "auth_add", "auth_edit", "auth_delete", "auth_mod", "auth_comment", "auth_rate", "auth_attach"); + $auth_levels = array('ALL', 'REG', 'PRIVATE', 'MOD', 'ADMIN'); + $auth_const = array(AUTH_ALL, AUTH_REG, AUTH_ACL, AUTH_MOD, AUTH_ADMIN); + if(isset($HTTP_POST_VARS['submit']) && isset($HTTP_POST_VARS['ugauth'])) + { + // The select names will be: ugauth:cat_id:auth_field + // Process + + $cats = array(); + // Sort all the post variables, so we get an array with submitted auth fields, based on $cats[cat_id][auth_field] + foreach($_POST as $key => $value) + { + // Ok break them up and use them if they have ugauth: prefix. + if(strstr($key, "ugauth:")) + { + // Break it up using explode + $rawdata = explode(":", $key); + $cats[$rawdata[1]][$rawdata[2]] = $value; + } + } + + // great let's run a foreach on the cats and do one cat at a time :) + foreach($cats as $cat_id => $auth_field) + { + // Right! Before doing the sql we need to find out wether the entry is already existant, or whether we have to insert it. + $sql = "SELECT group_id + FROM " . KB_AUTH_ACCESS_TABLE . " + WHERE group_id = '" . $HTTP_GET_VARS['g'] . "' + AND cat_id = '" . $cat_id . "'"; + + if(!$result = $db->sql_query($sql)) + { + message_die(GENERAL_ERROR, "Couldn't check whether the group entry already is existant in the auth table.", "", __LINE__, __FILE__, $sql); + } + + if($db->sql_numrows($result) > 0) + { + $sql = "UPDATE " . KB_AUTH_ACCESS_TABLE . " + SET "; + + for($i = 0; $i < count($auth_fields); $i++) + { + $sql .= $auth_fields[$i] . " = " . $auth_field[$auth_fields[$i]] . ", "; + } + + $sql = substr($sql, 0, -2); + + $sql .= " + WHERE group_id = '" . $HTTP_GET_VARS['g'] . "' + AND cat_id = '" . $cat_id . "'"; + } + else + { + $sql = "INSERT INTO " . KB_AUTH_ACCESS_TABLE . " (group_id, cat_id, "; + + for($i = 0; $i < count($auth_fields); $i++) + { + $sql .= $auth_fields[$i] . ", "; + } + + $sql = substr($sql, 0, -2); + $sql .= ") VALUES ('" . $HTTP_GET_VARS['g'] . "', '" . $cat_id . "', "; + + for($i = 0; $i < count($auth_fields); $i++) + { + $sql .= "'" . $auth_field[$auth_fields[$i]] . "', "; + } + + $sql = substr($sql, 0, -2); + $sql .= ");"; + } + + if(!$db->sql_query($sql)) + { + message_die(GENERAL_ERROR, "Couldn't update auth data for the given group.", "", __LINE__, __FILE__, $sql); + } + } + + // Show a "choose a category" dialogue + $template->assign_vars(array( + 'COUNT_AUTH_FIELDS' => 1, + 'L_INFORMATION' => $lang['Information'], + 'L_CHOOSE_GROUP' => $lang['kbadm_ugauthupdate_success']) + ); + + $template->assign_block_vars('switch_no_cat', array()); + } + elseif(isset($HTTP_GET_VARS['g'])) + { + // Show cells + $sql = "SELECT g.*, c.cat_title + FROM " . KB_AUTH_ACCESS_TABLE . " g, " . KB_CATEGORIES_TABLE . " c + WHERE g.group_id = '" . $HTTP_GET_VARS['g'] . "' + AND g.cat_id = c.cat_id"; + + if(!$result = $db->sql_query($sql)) + { + message_die(GENERAL_ERROR, "Couldn't retrieve group auth data.", "", __LINE__, __FILE__, $sql); + } + + // lets sort the group auth entries based on $group[cat_id]. + $group = array(); + while($row = $db->sql_fetchrow($result)) + { + $group[$row['cat_id']] = $row; + } + + $template->assign_block_vars('switch_show_form', array()); + + // Create header =) + for($i = 0; $i < count($auth_fields); $i++) + { + $template->assign_block_vars('switch_show_form.header_authrow', array( + 'L_AUTH_TITLE' => $lang['kbadm_' . $auth_fields[$i]]) + ); + } + + $cats = get_cats_structure('cat_id, cat_title'); + for($i = 0; $i < count($cats); $i++) + { + $template->assign_block_vars('switch_show_form.catrow', array( + 'CAT_TITLE' => $cats[$i]['cat_title']) + ); + + // Okay, per cat do the auth field switch + for($k = 0; $k < count($auth_fields); $k++) + { + $auth_select = ' <select name="ugauth:' . $cats[$i]['cat_id'] . ':' . $auth_fields[$k] . '">'; + for($j = 0; $j < count($auth_const); $j++) + { + $selected = ( $group[$cats[$i]['cat_id']][$auth_fields[$k]] == $auth_const[$j] ) ? ' selected="selected"' : ''; + $auth_select .= '<option value="' . $auth_const[$j] . '"' . $selected . '>' . $lang['Forum_' . $auth_levels[$j]] . '</option>'; + } + $auth_select .= '</select> '; + + $template->assign_block_vars('switch_show_form.catrow.authrow', array( + 'S_AUTH_SELECT' => $auth_select) + ); + } + + // Handle subcats + for($j = 0; $j < count($cats[$i]['subcats']); $j++) + { + $temlate->assign_block_vars('switch_show_form.catrow.subcatrow', array( + 'SUBCAT_TITLE' => $cats[$i]['subcats'][$j]['cat_title']) + ); + + for($l = 0; $l < count($auth_fields); $l++) + { + // And auth fields + $auth_select = ' <select name="ugauth' . $cats[$i]['subcats'][$j]['cat_id'] . ':' . $auth_fields[$l] . '">'; + for($k = 0; $k < count($auth_const); $k++) + { + $selected = ( $group[$cats[$i]['subcats'][$j]['cat_id']][$auth_fields[$l]] == $auth_const[$k] ) ? ' selected="selected"' : ''; + $auth_select .= '<option value="' . $auth_const[$k] . '"' . $selected . '>' . $lang['Forum_' . $auth_levels[$j]] . '</option>'; + } + $auth_select .= '</select> '; + + $template->assign_block_vars('switch_show_form.catrow.subcatrow.authrow', array( + 'S_AUTH_SELECT' => $auth_select) + ); + } + } + } + + $template->assign_vars(array( + 'COUNT_AUTH_FIELDS' => (count($auth_fields) + 1), // +1 because of the extra column to the left + 'S_UGAUTH_ACTION' => append_sid('admin_kb.' . $phpEx . '?mode=ugauth&g=' . $HTTP_GET_VARS['g']), + 'L_SUBMIT' => $lang['Submit']) + ); + } + else + { + // Show a "choose a category" dialogue + $template->assign_vars(array( + 'COUNT_AUTH_FIELDS' => 2, + 'L_INFORMATION' => $lang['Information'], + 'L_CHOOSE_GROUP' => $lang['kbadm_choose_group']) + ); + + $template->assign_block_vars('switch_no_cat', array()); + } + + $sql = "SELECT group_id, group_name + FROM " . GROUPS_TABLE . " + WHERE group_type = '0'"; + + if(!$result = $db->sql_query($sql)) + { + message_die(GENERAL_ERROR, "Couldn't retrieve groups.", "", __LINE__, __FILE__, $sql); + } + + $groups = array(); + while($row = $db->sql_fetchrow($result)) + { + $groups[] = $row; + } + + $select = '<select name="g" onchange="if(this.options[this.selectedIndex].value != -1){ forms[\'choose_group\'].submit() }"><option value="-1">' . $lang['kbadm_select_group'] . '</option>'; + for($i = 0; $i < count($groups); $i++) + { + $selected = ( $groups[$i]['group_id'] == $HTTP_GET_VARS['g'] ) ? 'selected="selected"' : ''; + $select .= '<option value="' . $groups[$i]['group_id'] . '"' . $selected . '>' . $groups[$i]['group_name'] . '</option>'; + } + + $select .= '</select>'; + + $template->assign_vars(array( + 'S_GROUP_SELECT' => $select, + 'L_SELECT_GROUP' => $lang['kbadm_select_group'], + 'S_CHOOSE_GROUP_ACTION' => 'admin_kb.' . $phpEx . '?mode=ugauth', + 'L_KBUGAUTH_TITLE' => $lang['kbadm_Group_Auth'], + 'L_KBUGAUTH_EXPLAIN' => $lang['kbadm_ugAuth_explain'], + 'SID' => $userdata['session_id']) + ); + + $template->pparse('body'); + + include('./page_footer_admin.'.$phpEx); + exit; + break; + + // attachment configuration case "files": // For later use break; Modified: main/trunk/includes/auth_kb.php =================================================================== --- main/trunk/includes/auth_kb.php 2007-03-18 17:29:45 UTC (rev 68) +++ main/trunk/includes/auth_kb.php 2007-04-05 08:00:39 UTC (rev 69) @@ -25,10 +25,12 @@ // category permissions. // -// This function returns info on whether the user is allowed to do the supplied argument(s) all dependant on the given category id +// This function returns info on whether the user is allowed to do the supplied argument(s) all dependant on the given category id, shamelessly ripped off from auth.php =) // function kb_auth($type, $cat_id, $userdata) { + global $db, $lang; + switch($type) { case "view": @@ -96,7 +98,7 @@ if(!$result = $db->sql_query($sql)) { - message_die(GENERAL_MESSAGE, 'Could not retrieve categorys auth info.', '', __LINE__, __FILE__, $sql); + message_die(GENERAL_MESSAGE, 'Could not retrieve categories auth info.', '', __LINE__, __FILE__, $sql); } $f_access = $db->sql_fetchrow($result); Modified: main/trunk/includes/constants.php =================================================================== --- main/trunk/includes/constants.php 2007-03-18 17:29:45 UTC (rev 68) +++ main/trunk/includes/constants.php 2007-04-05 08:00:39 UTC (rev 69) @@ -187,7 +187,7 @@ define('KB_CATEGORIES_TABLE', $table_prefix . "kb_categories"); define('KB_ARTICLES_TABLE', $table_prefix . "kb_articles"); define('KB_ARTICLECATS_TABLE', $table_prefix . "kb_articlecats"); // For Multiple cats -define('KB_AUTH_ACCESS', $table_prefix . "kb_auth_access"); +define('KB_AUTH_ACCESS_TABLE', $table_prefix . "kb_auth_access"); define('KB_CONFIG_TABLE', $table_prefix . "kb_config"); // Article Status Modified: main/trunk/includes/functions_kb.php =================================================================== --- main/trunk/includes/functions_kb.php 2007-03-18 17:29:45 UTC (rev 68) +++ main/trunk/includes/functions_kb.php 2007-04-05 08:00:39 UTC (rev 69) @@ -104,12 +104,12 @@ return; } -function get_cats_structure() +function get_cats_structure($fields = "*") { global $db; $cats = array(); - $sql = "SELECT * + $sql = "SELECT " . $fields . " FROM " . KB_CATEGORIES_TABLE . " WHERE cat_main = '0' ORDER BY cat_order ASC"; @@ -123,7 +123,7 @@ { $cats[$i] = $row; - $sql = "SELECT * + $sql = "SELECT " . $fields . " FROM " . KB_CATEGORIES_TABLE . " WHERE cat_main = '" . $row['cat_id'] . "' ORDER BY cat_order ASC"; Modified: main/trunk/kb.php =================================================================== --- main/trunk/kb.php 2007-03-18 17:29:45 UTC (rev 68) +++ main/trunk/kb.php 2007-04-05 08:00:39 UTC (rev 69) @@ -22,6 +22,7 @@ include($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'common.' . $phpEx); include($phpbb_root_path . 'includes/functions_kb.' . $phpEx); +include($phpbb_root_path . 'includes/auth_kb.' . $phpEx); include($phpbb_root_path . 'includes/bbcode.'.$phpEx); // @@ -54,6 +55,12 @@ message_die(GENERAL_MESSAGE, $lang['kb_cat_noexist']); } + $auth = kb_auth("cat", $cat_id, $userdata); + if(!$auth['auth_view']) + { + message_die(GENERAL_MESSAGE, $lang['kb_noauth_viewcat']; + } + // Store the main cat in a variable $sql = "SELECT * FROM " . KB_CATEGORIES_TABLE . " @@ -117,6 +124,7 @@ FROM " . KB_ARTICLECATS_TABLE . " c, " . KB_ARTICLES_TABLE . " a WHERE c.cat_id = '$cat_id' AND c.article_id = a.article_id + AND a.article_status = '" . KB_STATUS_ACCEPTED . "' $sort"; if( !($result = $db->sql_query($sql)) ) { @@ -155,7 +163,7 @@ 'body' => 'kb_viewcat.tpl') ); - if($userdata['session_logged_in']) + if($auth['auth_add']) { $template->assign_block_vars('switch_add_article', array()); } @@ -179,14 +187,19 @@ // Ok it contains subcats, let's build them. for($i = 0; $i < $total_subcats; $i++) { + $view = kb_auth("view", $subcats[$i]['cat_id'], $userdata); + // Ok display one cat here - $template->assign_block_vars('switch_subcats.catrow', array( - 'CAT_TITLE' => $subcats[$i]['cat_title'], - 'CAT_DESC' => $subcats[$i]['cat_desc'], - 'CAT_ARTICLES' => $subcats[$i]['cat_articles'], - 'U_VIEWCAT' => append_sid("kb.$phpEx?cat_id=" . $subcats[$i]['cat_id']), - 'FORUM_FOLDER_IMG' => $images['forum']) - ); + if($view['auth_view']) + { + $template->assign_block_vars('switch_subcats.catrow', array( + 'CAT_TITLE' => $subcats[$i]['cat_title'], + 'CAT_DESC' => $subcats[$i]['cat_desc'], + 'CAT_ARTICLES' => $subcats[$i]['cat_articles'], + 'U_VIEWCAT' => append_sid("kb.$phpEx?cat_id=" . $subcats[$i]['cat_id']), + 'FORUM_FOLDER_IMG' => $images['forum']) + ); + } } } @@ -246,11 +259,8 @@ ); $template->assign_block_vars('switch_no_articles', array()); - } + } // if ... total_categories - // if ... total_categories - - // // Generate the page // @@ -258,11 +268,53 @@ include($phpbb_root_path . 'includes/page_tail.'.$phpEx); } +elseif(isset($HHTP_GET_VARS['search'])) +{ + // Search function + $string = $HTTP_GET_VARS['search']; + + // Search form + if($string == "f") + { + + } + elseif($string == "newarticles") + { + + } + else + { + $search_sql = "SELECT * + FROM " . KB_ARTICLES . " + WHERE article_title LIKE '%" . $HTTP_GET_VARS['search'] . "%' + "; + + if(isset($HTTP_GET_VARS['a'])) + { + // Search on author aswell + $search_sql .= ""; + } + + if(isset($HTTP_GET_VARS['w'])) + { + // Search the article text and description + $search_sql .= ""; + } + + + } +} elseif(isset($HTTP_GET_VARS['cat_id']) && isset($HTTP_GET_VARS['article'])) { $cid = ( empty($HTTP_GET_VARS['cat_id']) ) ? false : $HTTP_GET_VARS['cat_id']; $article_query = unwiki_article_title($HTTP_GET_VARS['article']); + $auth = kb_auth("article", $cid, $userdata); + if(!$auth['auth_view']) + { + message_die(GENERAL_MESSAGE, $lang['kb_noauth_viewarticle']); + } + // Get naughty words :) $orig_word = array(); $replacement_word = array(); @@ -540,11 +592,10 @@ { for($i = 0; $i < $total_catrows; $i++) { - //$auth = kb_auth("view", $catrows[$i]['cat_id'], $userdata); + $auth = kb_auth("view", $catrows[$i]['cat_id'], $userdata); - // auth not included in alpha - //if($auth['auth_view']) - //{ + if($auth['auth_view']) + { // Ok display one cat here $template->assign_block_vars('catrow', array( 'CAT_TITLE' => $catrows[$i]['cat_title'], @@ -578,11 +629,10 @@ for($j = 0; $j < $total_subcats; $j++) { - //$auth = kb_auth("view", $subcats[$j]['cat_id'], $userdata); - - // auth not included in alpha - //if($auth['auth_view']) - //{ + $auth = kb_auth("view", $subcats[$j]['cat_id'], $userdata); + + if($auth['auth_view']) + { // Show the subcat $k = $j + 1; $subcat_comma = ( isset($subcats[$k]) ) ? ", " : "."; @@ -591,10 +641,10 @@ 'SUBCAT_TITLE' => $subcats[$j]['cat_title'], 'SUBCAT_COMMA' => $subcat_comma) ); - //} // if auth view + } // if auth view } // for subcats } // if subcats - //} // auth view + } // auth view } // for cats }// total cats else Modified: main/trunk/language/lang_english/lang_admin.php =================================================================== --- main/trunk/language/lang_english/lang_admin.php 2007-03-18 17:29:45 UTC (rev 68) +++ main/trunk/language/lang_english/lang_admin.php 2007-04-05 08:00:39 UTC (rev 69) @@ -1,766 +1,775 @@ -<?php - -/*************************************************************************** - * lang_admin.php [English] - * ------------------- - * begin : Sat Dec 16 2000 - * copyright : (C) 2001 The phpBB Group - * email : su...@ph... - * - * $Id: lang_admin.php,v 1.35.2.17 2006/02/05 15:59:48 grahamje Exp $ - * - ****************************************************************************/ - -/*************************************************************************** - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - ***************************************************************************/ - -/* CONTRIBUTORS - 2002-12-15 Philip M. White (pw...@ma...) - Fixed many minor grammatical mistakes -*/ - -// -// Format is same as lang_main -// - -// -// Modules, this replaces the keys used -// in the modules[][] arrays in each module file -// -$lang['General'] = 'General Admin'; -$lang['Users'] = 'User Admin'; -$lang['Groups'] = 'Group Admin'; -$lang['Forums'] = 'Forum Admin'; -$lang['Styles'] = 'Styles Admin'; - -$lang['Configuration'] = 'Configuration'; -$lang['Permissions'] = 'Permissions'; -$lang['Manage'] = 'Management'; -$lang['Disallow'] = 'Disallow names'; -$lang['Prune'] = 'Pruning'; -$lang['Mass_Email'] = 'Mass Email'; -$lang['Ranks'] = 'Ranks'; -$lang['Smilies'] = 'Smilies'; -$lang['Ban_Management'] = 'Ban Control'; -$lang['Word_Censor'] = 'Word Censors'; -$lang['Export'] = 'Export'; -$lang['Create_new'] = 'Create'; -$lang['Add_new'] = 'Add'; -$lang['Backup_DB'] = 'Backup Database'; -$lang['Restore_DB'] = 'Restore Database'; - - -// -// Index -// -$lang['Admin'] = 'Administration'; -$lang['Not_admin'] = 'You are not authorised to administer this board'; -$lang['Welcome_phpBB'] = 'Welcome to phpBB'; -$lang['Admin_intro'] = 'Thank you for choosing phpBB as your forum solution. This screen will give you a quick overview of all the various statistics of your board. You can get back to this page by clicking on the <u>Admin Index</u> link in the left pane. To return to the index of your board, click the phpBB logo also in the left pane. The other links on the left hand side of this screen will allow you to control every aspect of your forum experience. Each screen will have instructions on how to use the tools.'; -$lang['Main_index'] = 'Forum Index'; -$lang['Forum_stats'] = 'Forum Statistics'; -$lang['Admin_Index'] = 'Admin Index'; -$lang['Preview_forum'] = 'Preview Forum'; - -$lang['Click_return_admin_index'] = 'Click %sHere%s to return to the Admin Index'; - -$lang['Statistic'] = 'Statistic'; -$lang['Value'] = 'Value'; -$lang['Number_posts'] = 'Number of posts'; -$lang['Posts_per_day'] = 'Posts per day'; -$lang['Number_topics'] = 'Number of topics'; -$lang['Topics_per_day'] = 'Topics per day'; -$lang['Number_users'] = 'Number of users'; -$lang['Users_per_day'] = 'Users per day'; -$lang['Board_started'] = 'Board started'; -$lang['Avatar_dir_size'] = 'Avatar directory size'; -$lang['Database_size'] = 'Database size'; -$lang['Gzip_compression'] ='Gzip compression'; -$lang['Not_available'] = 'Not available'; - -$lang['ON'] = 'ON'; // This is for GZip compression -$lang['OFF'] = 'OFF'; - - -// -// DB Utils -// -$lang['Database_Utilities'] = 'Database Utilities'; - -$lang['Restore'] = 'Restore'; -$lang['Backup'] = 'Backup'; -$lang['Restore_explain'] = 'This will perform a full restore of all phpBB tables from a saved file. If your server supports it, you may upload a gzip-compressed text file and it will automatically be decompressed. <b>WARNING</b>: This will overwrite any existing data. The restore may take a long time to process, so please do not move from this page until it is complete.'; -$lang['Backup_explain'] = 'Here you can back up all your phpBB-related data. If you have any additional custom tables in the same database with phpBB that you would like to back up as well, please enter their names, separated by commas, in the Additional Tables textbox below. If your server supports it you may also gzip-compress the file to reduce its size before download.'; - -$lang['Backup_options'] = 'Backup options'; -$lang['Start_backup'] = 'Start Backup'; -$lang['Full_backup'] = 'Full backup'; -$lang['Structure_backup'] = 'Structure-Only backup'; -$lang['Data_backup'] = 'Data only backup'; -$lang['Additional_tables'] = 'Additional tables'; -$lang['Gzip_compress'] = 'Gzip compress file'; -$lang['Select_file'] = 'Select a file'; -$lang['Start_Restore'] = 'Start Restore'; - -$lang['Restore_success'] = 'The Database has been successfully restored.<br /><br />Your board should be back to the state it was when the backup was made.'; -$lang['Backup_download'] = 'Your download will start shortly; please wait until it begins.'; -$lang['Backups_not_supported'] = 'Sorry, but database backups are not currently supported for your database system.'; - -$lang['Restore_Error_uploading'] = 'Error in uploading the backup file'; -$lang['Restore_Error_filename'] = 'Filename problem; please try an alternative file'; -$lang['Restore_Error_decompress'] = 'Cannot decompress a gzip file; please upload a plain text version'; -$lang['Restore_Error_no_file'] = 'No file was uploaded'; - - -// -// Auth pages -// -$lang['Select_a_User'] = 'Select a User'; -$lang['Select_a_Group'] = 'Select a Group'; -$lang['Select_a_Forum'] = 'Select a Forum'; -$lang['Auth_Control_User'] = 'User Permissions Control'; -$lang['Auth_Control_Group'] = 'Group Permissions Control'; -$lang['Auth_Control_Forum'] = 'Forum Permissions Control'; -$lang['Look_up_User'] = 'Look up User'; -$lang['Look_up_Group'] = 'Look up Group'; -$lang['Look_up_Forum'] = 'Look up Forum'; - -$lang['Group_auth_explain'] = 'Here you can alter the permissions and moderator status assigned to each user group. Do not forget when changing group permissions that individual user permissions may still allow the user entry to forums, etc. You will be warned if this is the case.'; -$lang['User_auth_explain'] = 'Here you can alter the permissions and moderator status assigned to each individual user. Do not forget when changing user permissions that group permissions may still allow the user entry to forums, etc. You will be warned if this is the case.'; -$lang['Forum_auth_explain'] = 'Here you can alter the authorisation levels of each forum. You will have both a simple and advanced method for doing this, where advanced offers greater control of each forum operation. Remember that changing the permission level of forums will affect which users can carry out the various operations within them.'; - -$lang['Simple_mode'] = 'Simple Mode'; -$lang['Advanced_mode'] = 'Advanced Mode'; -$lang['Moderator_status'] = 'Moderator status'; - -$lang['Allowed_Access'] = 'Allowed Access'; -$lang['Disallowed_Access'] = 'Disallowed Access'; -$lang['Is_Moderator'] = 'Is Moderator'; -$lang['Not_Moderator'] = 'Not Moderator'; - -$lang['Conflict_warning'] = 'Authorisation Conflict Warning'; -$lang['Conflict_access_userauth'] = 'This user still has access rights to this forum via group membership. You may want to alter the group permissions or remove this user the group to fully prevent them having access rights. The groups granting rights (and the forums involved) are noted below.'; -$lang['Conflict_mod_userauth'] = 'This user still has moderator rights to this forum via group membership. You may want to alter the group permissions or remove this user the group to fully prevent them having moderator rights. The groups granting rights (and the forums involved) are noted below.'; - -$lang['Conflict_access_groupauth'] = 'The following user (or users) still have access rights to this forum via their user permission settings. You may want to alter the user permissions to fully prevent them having access rights. The users granted rights (and the forums involved) are noted below.'; -$lang['Conflict_mod_groupauth'] = 'The following user (or users) still have moderator rights to this forum via their user permissions settings. You may want to alter the user permissions to fully prevent them having moderator rights. The users granted rights (and the forums involved) are noted below.'; - -$lang['Public'] = 'Public'; -$lang['Private'] = 'Private'; -$lang['Registered'] = 'Registered'; -$lang['Administrators'] = 'Administrators'; -$lang['Hidden'] = 'Hidden'; - -// These are displayed in the drop down boxes for advanced -// mode forum auth, try and keep them short! -$lang['Forum_ALL'] = 'ALL'; -$lang['Forum_REG'] = 'REG'; -$lang['Forum_PRIVATE'] = 'PRIVATE'; -$lang['Forum_MOD'] = 'MOD'; -$lang['Forum_ADMIN'] = 'ADMIN'; - -$lang['View'] = 'View'; -$lang['Read'] = 'Read'; -$lang['Post'] = 'Post'; -$lang['Reply'] = 'Reply'; -$lang['Edit'] = 'Edit'; -$lang['Delete'] = 'Delete'; -$lang['Sticky'] = 'Sticky'; -$lang['Announce'] = 'Announce'; -$lang['Vote'] = 'Vote'; -$lang['Pollcreate'] = 'Poll create'; - -$lang['Permissions'] = 'Permissions'; -$lang['Simple_Permission'] = 'Simple Permissions'; - -$lang['User_Level'] = 'User Level'; -$lang['Auth_User'] = 'User'; -$lang['Auth_Admin'] = 'Administrator'; -$lang['Group_memberships'] = 'Usergroup memberships'; -$lang['Usergroup_members'] = 'This group has the following members'; - -$lang['Forum_auth_updated'] = 'Forum permissions updated'; -$lang['User_auth_updated'] = 'User permissions updated'; -$lang['Group_auth_updated'] = 'Group permissions updated'; - -$lang['Auth_updated'] = 'Permissions have been updated'; -$lang['Click_return_userauth'] = 'Click %sHere%s to return to User Permissions'; -$lang['Click_return_groupauth'] = 'Click %sHere%s to return to Group Permissions'; -$lang['Click_return_forumauth'] = 'Click %sHere%s to return to Forum Permissions'; - - -// -// Banning -// -$lang['Ban_control'] = 'Ban Control'; -$lang['Ban_explain'] = 'Here you can control the banning of users. You can achieve this by banning either or both of a specific user or an individual or range of IP addresses or hostnames. These methods prevent a user from even reaching the index page of your board. To prevent a user from registering under a different username you can also specify a banned email address. Please note that banning an email address alone will not prevent that user from being able to log on or post to your board. You should use one of the first two methods to achieve this.'; -$lang['Ban_explain_warn'] = 'Please note that entering a range of IP addresses results in all the addresses between the start and end being added to the banlist. Attempts will be made to minimise the number of addresses added to the database by introducing wildcards automatically where appropriate. If you really must enter a range, try to keep it small or better yet state specific addresses.'; - -$lang['Select_username'] = 'Select a Username'; -$lang['Select_ip'] = 'Select an IP address'; -$lang['Select_email'] = 'Select an Email address'; - -$lang['Ban_username'] = 'Ban one or more specific users'; -$lang['Ban_username_explain'] = 'You can ban multiple users in one go using the appropriate combination of mouse and keyboard for your computer and browser'; - -$lang['Ban_IP'] = 'Ban one or more IP addresses or hostnames'; -$lang['IP_hostname'] = 'IP addresses or hostnames'; -$lang['Ban_IP_explain'] = 'To specify several different IP addresses or hostnames separate them with commas. To specify a range of IP addresses, separate the start and end with a hyphen (-); to specify a wildcard, use an asterisk (*).'; - -$lang['Ban_email'] = 'Ban one or more email addresses'; -$lang['Ban_email_explain'] = 'To specify more than one email address, separate them with commas. To specify a wildcard username, use * like *@hotmail.com'; - -$lang['Unban_username'] = 'Un-ban one more specific users'; -$lang['Unban_username_explain'] = 'You can unban multiple users in one go using the appropriate combination of mouse and keyboard for your computer and browser'; - -$lang['Unban_IP'] = 'Un-ban one or more IP addresses'; -$lang['Unban_IP_explain'] = 'You can unban multiple IP addresses in one go using the appropriate combination of mouse and keyboard for your computer and browser'; - -$lang['Unban_email'] = 'Un-ban one or more email addresses'; -$lang['Unban_email_explain'] = 'You can unban multiple email addresses in one go using the appropriate combination of mouse and keyboard for your computer and browser'; - -$lang['No_banned_users'] = 'No banned usernames'; -$lang['No_banned_ip'] = 'No banned IP addresses'; -$lang['No_banned_email'] = 'No banned email addresses'; - -$lang['Ban_update_sucessful'] = 'The banlist has been updated successfully'; -$lang['Click_return_banadmin'] = 'Click %sHere%s to return to Ban Control'; - - -// -// Configuration -// -$lang['General_Config'] = 'General Configuration'; -$lang['Config_explain'] = 'The form below will allow you to customize all the general board options. For User and Forum configurations use the related links on the left hand side.'; - -$lang['Click_return_config'] = 'Click %sHere%s to return to General Configuration'; - -$lang['General_settings'] = 'General Board Settings'; -$lang['Server_name'] = 'Domain Name'; -$lang['Server_name_explain'] = 'The domain name from which this board runs'; -$lang['Script_path'] = 'Script path'; -$lang['Script_path_explain'] = 'The path where phpBB2 is located relative to the domain name'; -$lang['Server_port'] = 'Server Port'; -$lang['Server_port_explain'] = 'The port your server is running on, usually 80. Only change if different'; -$lang['Site_name'] = 'Site name'; -$lang['Site_desc'] = 'Site description'; -$lang['Board_disable'] = 'Disable board'; -$lang['Board_disable_explain'] = 'This will make the board unavailable to users. Administrators are able to access the Administration Panel while the board is disabled.'; -$lang['Acct_activation'] = 'Enable account activation'; -$lang['Acc_None'] = 'None'; // These three entries are the type of activation -$lang['Acc_User'] = 'User'; -$lang['Acc_Admin'] = 'Admin'; - -$lang['Abilities_settings'] = 'User and Forum Basic Settings'; -$lang['Max_poll_options'] = 'Max number of poll options'; -$lang['Flood_Interval'] = 'Flood Interval'; -$lang['Flood_Interval_explain'] = 'Number of seconds a user must wait between posts'; -$lang['Board_email_form'] = 'User email via board'; -$lang['Board_email_form_explain'] = 'Users send email to each other via this board'; -$lang['Topics_per_page'] = 'Topics Per Page'; -$lang['Posts_per_page'] = 'Posts Per Page'; -$lang['Hot_threshold'] = 'Posts for Popular Threshold'; -$lang['Default_style'] = 'Default Style'; -$lang['Override_style'] = 'Override user style'; -$lang['Override_style_explain'] = 'Replaces users style with the default'; -$lang['Default_language'] = 'Default Language'; -$lang['Date_format'] = 'Date Format'; -$lang['System_timezone'] = 'System Timezone'; -$lang['Enable_gzip'] = 'Enable GZip Compression'; -$lang['Enable_prune'] = 'Enable Forum Pruning'; -$lang['Allow_HTML'] = 'Allow HTML'; -$lang['Allow_BBCode'] = 'Allow BBCode'; -$lang['Allowed_tags'] = 'Allowed HTML tags'; -$lang['Allowed_tags_explain'] = 'Separate tags with commas'; -$lang['Allow_smilies'] = 'Allow Smilies'; -$lang['Smilies_path'] = 'Smilies Storage Path'; -$lang['Smilies_path_explain'] = 'Path under your phpBB root dir, e.g. images/smiles'; -$lang['Allow_sig'] = 'Allow Signatures'; -$lang['Max_sig_length'] = 'Maximum signature length'; -$lang['Max_sig_length_explain'] = 'Maximum number of characters in user signatures'; -$lang['Allow_name_change'] = 'Allow Username changes'; - -$lang['Avatar_settings'] = 'Avatar Settings'; -$lang['Allow_local'] = 'Enable gallery avatars'; -$lang['Allow_remote'] = 'Enable remote avatars'; -$lang['Allow_remote_explain'] = 'Avatars linked to from another website'; -$lang['Allow_upload'] = 'Enable avatar uploading'; -$lang['Max_filesize'] = 'Maximum Avatar File Size'; -$lang['Max_filesize_explain'] = 'For uploaded avatar files'; -$lang['Max_avatar_size'] = 'Maximum Avatar Dimensions'; -$lang['Max_avatar_size_explain'] = '(Height x Width in pixels)'; -$lang['Avatar_storage_path'] = 'Avatar Storage Path'; -$lang['Avatar_storage_path_explain'] = 'Path under your phpBB root dir, e.g. images/avatars'; -$lang['Avatar_gallery_path'] = 'Avatar Gallery Path'; -$lang['Avatar_gallery_path_explain'] = 'Path under your phpBB root dir for pre-loaded images, e.g. images/avatars/gallery'; - -$lang['COPPA_settings'] = 'COPPA Settings'; -$lang['COPPA_fax'] = 'COPPA Fax Number'; -$lang['COPPA_mail'] = 'COPPA Mailing Address'; -$lang['COPPA_mail_explain'] = 'This is the mailing address to which parents will send COPPA registration forms'; - -$lang['Email_settings'] = 'Email Settings'; -$lang['Admin_email'] = 'Admin Email Address'; -$lang['Email_sig'] = 'Email Signature'; -$lang['Email_sig_explain'] = 'This text will be attached to all emails the board sends'; -$lang['Use_SMTP'] = 'Use SMTP Server for email'; -$lang['Use_SMTP_explain'] = 'Say yes if you want or have to send email via a named server instead of the local mail function'; -$lang['SMTP_server'] = 'SMTP Server Address'; -$lang['SMTP_username'] = 'SMTP Username'; -$lang['SMTP_username_explain'] = 'Only enter a username if your SMTP server requires it'; -$lang['SMTP_password'] = 'SMTP Password'; -$lang['SMTP_password_explain'] = 'Only enter a password if your SMTP server requires it'; - -$lang['Disable_privmsg'] = 'Private Messaging'; -$lang['Inbox_limits'] = 'Max posts in Inbox'; -$lang['Sentbox_limits'] = 'Max posts in Sentbox'; -$lang['Savebox_limits'] = 'Max posts in Savebox'; - -$lang['Cookie_settings'] = 'Cookie settings'; -$lang['Cookie_settings_explain'] = 'These details define how cookies are sent to your users\' browsers. In most cases the default values for the cookie settings should be sufficient, but if you need to change them do so with care -- incorrect settings can prevent users from logging in'; -$lang['Cookie_domain'] = 'Cookie domain'; -$lang['Cookie_name'] = 'Cookie name'; -$lang['Cookie_path'] = 'Cookie path'; -$lang['Cookie_secure'] = 'Cookie secure'; -$lang['Cookie_secure_explain'] = 'If your server is running via SSL, set this to enabled, else leave as disabled'; -$lang['Session_length'] = 'Session length [ seconds ]'; - -// Visual Confirmation -$lang['Visual_confirm'] = 'Enable Visual Confirmation'; -$lang['Visual_confirm_explain'] = 'Requires users enter a code defined by an image when registering.'; - -// Autologin Keys - added 2.0.18 -$lang['Allow_autologin'] = 'Allow automatic logins'; -$lang['Allow_autologin_explain'] = 'Determines whether users are allowed to select to be automatically logged in when visiting the forum'; -$lang['Autologin_time'] = 'Automatic login key expiry'; -$lang['Autologin_time_explain'] = 'How long a autologin key is valid for in days if the user does not visit the board. Set to zero to disable expiry.'; - -// Search Flood Control - added 2.0.20 -$lang['Search_Flood_Interval'] = 'Search Flood Interval'; -$lang['Search_Flood_Interval_explain'] = 'Number of seconds a user must wait between search requests'; - -// -// Forum Management -// -$lang['Forum_admin'] = 'Forum Administration'; -$lang['Forum_admin_explain'] = 'From this panel you can add, delete, edit, re-order and re-synchronise categories and forums'; -$lang['Edit_forum'] = 'Edit forum'; -$lang['Create_forum'] = 'Create new forum'; -$lang['Create_category'] = 'Create new category'; -$lang['Remove'] = 'Remove'; -$lang['Action'] = 'Action'; -$lang['Update_order'] = 'Update Order'; -$lang['Config_updated'] = 'Forum Configuration Updated Successfully'; -$lang['Edit'] = 'Edit'; -$lang['Delete'] = 'Delete'; -$lang['Move_up'] = 'Move up'; -$lang['Move_down'] = 'Move down'; -$lang['Resync'] = 'Resync'; -$lang['No_mode'] = 'No mode was set'; -$lang['Forum_edit_delete_explain'] = 'The form below will allow you to customize all the general board options. For User and Forum configurations use the related links on the left hand side'; - -$lang['Move_contents'] = 'Move all contents'; -$lang['Forum_delete'] = 'Delete Forum'; -$lang['Forum_delete_explain'] = 'The form below will allow you to delete a forum (or category) and decide where you want to put all topics (or forums) it contained.'; - -$lang['Status_locked'] = 'Locked'; -$lang['Status_unlocked'] = 'Unlocked'; -$lang['Forum_settings'] = 'General Forum Settings'; -$lang['Forum_name'] = 'Forum name'; -$lang['Forum_desc'] = 'Description'; -$lang['Forum_status'] = 'Forum status'; -$lang['Forum_pruning'] = 'Auto-pruning'; - -$lang['prune_freq'] = 'Check for topic age every'; -$lang['prune_days'] = 'Remove topics that have not been posted to in'; -$lang['Set_prune_data'] = 'You have turned on auto-prune for this forum but did not set a frequency or number of days to prune. Please go back and do so.'; - -$lang['Move_and_Delete'] = 'Move and Delete'; - -$lang['Delete_all_posts'] = 'Delete all posts'; -$lang['Nowhere_to_move'] = 'Nowhere to move to'; - -$lang['Edit_Category'] = 'Edit Category'; -$lang['Edit_Category_explain'] = 'Use this form to modify a category\'s name.'; - -$lang['Forums_updated'] = 'Forum and Category information updated successfully'; - -$lang['Must_delete_forums'] = 'You need to delete all forums before you can delete this category'; - -$lang['Click_return_forumadmin'] = 'Click %sHere%s to return to Forum Administration'; - - -// -// Smiley Management -// -$lang['smiley_title'] = 'Smiles Editing Utility'; -$lang['smile_desc'] = 'From this page you can add, remove and edit the emoticons or smileys that your users can use in their posts and private messages.'; - -$lang['smiley_config'] = 'Smiley Configuration'; -$lang['smiley_code'] = 'Smiley Code'; -$lang['smiley_url'] = 'Smiley Image File'; -$lang['smiley_emot'] = 'Smiley Emotion'; -$lang['smile_add'] = 'Add a new Smiley'; -$lang['Smile'] = 'Smile'; -$lang['Emotion'] = 'Emotion'; - -$lang['Select_pak'] = 'Select Pack (.pak) File'; -$lang['replace_existing'] = 'Replace Existing Smiley'; -$lang['keep_existing'] = 'Keep Existing Smiley'; -$lang['smiley_import_inst'] = 'You should unzip the smiley package and upload all files to the appropriate Smiley directory for your installation. Then select the correct information in this form to import the smiley pack.'; -$lang['smiley_import'] = 'Smiley Pack Import'; -$lang['choose_smile_pak'] = 'Choose a Smile Pack .pak file'; -$lang['import'] = 'Import Smileys'; -$lang['smile_conflicts'] = 'What should be done in case of conflicts'; -$lang['del_existing_smileys'] = 'Delete existing smileys before import'; -$lang['import_smile_pack'] = 'Import Smiley Pack'; -$lang['export_smile_pack'] = 'Create Smiley Pack'; -$lang['export_smiles'] = 'To create a smiley pack from your currently installed smileys, click %sHere%s to download the smiles.pak file. Name this file appropriately making sure to keep the .pak file extension. Then create a zip file containing all of your smiley images plus this .pak configuration file.'; - -$lang['smiley_add_success'] = 'The Smiley was successfully added'; -$lang['smiley_edit_success'] = 'The Smiley was successfully updated'; -$lang['smiley_import_success'] = 'The Smiley Pack was imported successfully!'; -$lang['smiley_del_success'] = 'The Smiley was successfully removed'; -$lang['Click_return_smileadmin'] = 'Click %sHere%s to return to Smiley Administration'; - -$lang['Confirm_delete_smiley'] = 'Are you sure you want to delete this Smiley?'; - -// -// User Management -// -$lang['User_admin'] = 'User Administration'; -$lang['User_admin_explain'] = 'Here you can change your users\' information and certain options. To modify the users\' permissions, please use the user and group permissions system.'; - -$lang['Look_up_user'] = 'Look up user'; - -$lang['Admin_user_fail'] = 'Couldn\'t update the user\'s profile.'; -$lang['Admin_user_updated'] = 'The user\'s profile was successfully updated.'; -$lang['Click_return_useradmin'] = 'Click %sHere%s to return to User Administration'; - -$lang['User_delete'] = 'Delete this user'; -$lang['User_delete_explain'] = 'Click here to delete this user; this cannot be undone.'; -$lang['User_deleted'] = 'User was successfully deleted.'; - -$lang['User_status'] = 'User is active'; -$lang['User_allowpm'] = 'Can send Private Messages'; -$lang['User_allowavatar'] = 'Can display avatar'; - -$lang['Admin_avatar_explain'] = 'Here you can see and delete the user\'s current avatar.'; - -$lang['User_special'] = 'Special admin-only fields'; -$lang['User_special_explain'] = 'These fields are not able to be modified by the users. Here you can set their status and other options that are not given to users.'; - - -// -// Group Management -// -$lang['Group_administration'] = 'Group Administration'; -$lang['Group_admin_explain'] = 'From this panel you can administer all your usergroups. You can delete, create and edit existing groups. You may choose moderators, toggle open/closed group status and set the group name and description'; -$lang['Error_updating_groups'] = 'There was an error while updating the groups'; -$lang['Updated_group'] = 'The group was successfully updated'; -$lang['Added_new_group'] = 'The new group was successfully created'; -$lang['Deleted_group'] = 'The group was successfully deleted'; -$lang['New_group'] = 'Create new group'; -$lang['Edit_group'] = 'Edit group'; -$lang['group_name'] = 'Group name'; -$lang['group_description'] = 'Group description'; -$lang['group_moderator'] = 'Group moderator'; -$lang['group_status'] = 'Group status'; -$lang['group_open'] = 'Open group'; -$lang['group_closed'] = 'Closed group'; -$lang['group_hidden'] = 'Hidden group'; -$lang['group_delete'] = 'Delete group'; -$lang['group_delete_check'] = 'Delete this group'; -$lang['submit_group_changes'] = 'Submit Changes'; -$lang['reset_group_changes'] = 'Reset Changes'; -$lang['No_group_name'] = 'You must specify a name for this group'; -$lang['No_group_moderator'] = 'You must specify a moderator for this group'; -$lang['No_group_mode'] = 'You must specify a mode for this group, open or closed'; -$lang['No_group_action'] = 'No action was specified'; -$lang['delete_group_moderator'] = 'Delete the old group moderator?'; -$lang['delete_moderator_explain'] = 'If you\'re changing the group moderator, check this box to remove the old moderator from the group. Otherwise, do not check it, and the user will become a regular member of the group.'; -$lang['Click_return_groupsadmin'] = 'Click %sHere%s to return to Group Administration.'; -$lang['Select_group'] = 'Select a group'; -$lang['Look_up_group'] = 'Look up group'; - - -// -// Prune Administration -// -$lang['Forum_Prune'] = 'Forum Prune'; -$lang['Forum_Prune_explain'] = 'This will delete any topic which has not been posted to within the number of days you select. If you do not enter a number then all topics will be deleted. It will not remove topics in which polls are still running nor will it remove announcements. You will need to remove those topics manually.'; -$lang['Do_Prune'] = 'Do Prune'; -$lang['All_Forums'] = 'All Forums'; -$lang['Prune_topics_not_posted'] = 'Prune topics with no replies in this many days'; -$lang['Topics_pruned'] = 'Topics pruned'; -$lang['Posts_pruned'] = 'Posts pruned'; -$lang['Prune_success'] = 'Pruning of forums was successful'; - - -// -// Word censor -// -$lang['Words_title'] = 'Word Censoring'; -$lang['Words_explain'] = 'From this control panel you can add, edit, and remove words that will be automatically censored on your forums. In addition people will not be allowed to register with usernames containing these words. Wildcards (*) are accepted in the word field. For example, *test* will match detestable, test* would match testing, *test would match detest.'; -$lang['Word'] = 'Word'; -$lang['Edit_word_censor'] = 'Edit word censor'; -$lang['Replacement'] = 'Replacement'; -$lang['Add_new_word'] = 'Add new word'; -$lang['Update_word'] = 'Update word censor'; - -$lang['Must_enter_word'] = 'You must enter a word and its replacement'; -$lang['No_word_selected'] = 'No word selected for editing'; - -$lang['Word_updated'] = 'The selected word censor has been successfully updated'; -$lang['Word_added'] = 'The word censor has been successfully added'; -$lang['Word_removed'] = 'The selected word censor has been successfully removed'; - -$lang['Click_return_wordadmin'] = 'Click %sHere%s to return to Word Censor Administration'; - -$lang['Confirm_delete_word'] = 'Are you sure you want to delete this word censor?'; - - -// -// Mass Email -// -$lang['Mass_email_explain'] = 'Here you can email a message to either all of your users or all users of a specific group. To do this, an email will be sent out to the administrative email address supplied, with a blind carbon copy sent to all recipients. If you are emailing a large group of people please be patient after submitting and do not stop the page halfway through. It is normal for a mass emailing to take a long time and you will be notified when the script has completed'; -$lang['Compose'] = 'Compose'; - -$lang['Recipients'] = 'Recipients'; -$lang['All_users'] = 'All Users'; - -$lang['Email_successfull'] = 'Your message has been sent'; -$lang['Click_return_massemail'] = 'Click %sHere%s to return to the Mass Email form'; - - -// -// Ranks admin -// -$lang['Ranks_title'] = 'Rank Administration'; -$lang['Ranks_explain'] = 'Using this form you can add, edit, view and delete ranks. You can also create custom ranks which can be applied to a user via the user management facility'; - -$lang['Add_new_rank'] = 'Add new rank'; - -$lang['Rank_title'] = 'Rank Title'; -$lang['Rank_special'] = 'Set as Special Rank'; -$lang['Rank_minimum'] = 'Minimum Posts'; -$lang['Rank_maximum'] = 'Maximum Posts'; -$lang['Rank_image'] = 'Rank Image (Relative to phpBB2 root path)'; -$lang['Rank_image_explain'] = 'Use this to define a small image associated with the rank'; - -$lang['Must_select_rank'] = 'You must select a rank'; -$lang['No_assigned_rank'] = 'No special rank assigned'; - -$lang['Rank_updated'] = 'The rank was successfully updated'; -$lang['Rank_added'] = 'The rank was successfully added'; -$lang['Rank_removed'] = 'The rank was successfully deleted'; -$lang['No_update_ranks'] = 'The rank was successfully deleted. However, user accounts using this rank were not updated. You will need to manually reset the rank on these accounts'; - -$lang['Click_return_rankadmin'] = 'Click %sHere%s to return to Rank Administration'; - -$lang['Confirm_delete_rank'] = 'Are you sure you want to delete this rank?'; - -// -// Disallow Username Admin -// -$lang['Disallow_control'] = 'Username Disallow Control'; -$lang['Disallow_explain'] = 'Here you can control usernames which will not be allowed to be used. Disallowed usernames are allowed to contain a wildcard character of *. Please note that you will not be allowed to specify any username that has already been registered. You must first delete that name then disallow it.'; - -$lang['Delete_disallow'] = 'Delete'; -$lang['Delete_disallow_title'] = 'Remove a Disallowed Username'; -$lang['Delete_disallow_explain'] = 'You can remove a disallowed username by selecting the username from this list and clicking submit'; - -$lang['Add_disallow'] = 'Add'; -$lang['Add_disallow_title'] = 'Add a disallowed username'; -$lang['Add_disallow_explain'] = 'You can disallow a username using the wildcard character * to match any character'; - -$lang['No_disallowed'] = 'No Disallowed Usernames'; - -$lang['Disallowed_deleted'] = 'The disallowed username has been successfully removed'; -$lang['Disallow_successful'] = 'The disallowed username has been successfully added'; -$lang['Disallowed_already'] = 'The name you entered could not be disallowed. It either already exists in the list, exists in the word censor list, or a matching username is present.'; - -$lang['Click_return_disallowadmin'] = 'Click %sHere%s to return to Disallow Username Administration'; - - -// -// Styles Admin -// -$lang['Styles_admin'] = 'Styles Administration'; -$lang['Styles_explain'] = 'Using this facility you can add, remove and manage styles (templates and themes) available to your users'; -$lang['Styles_addnew_explain'] = 'The following list contains all the themes that are available for the templates you currently have. The items on this list have not yet been installed into the phpBB database. To install a theme, simply click the install link beside an entry.'; - -$lang['Select_template'] = 'Select a Template'; - -$lang['Style'] = 'Style'; -$lang['Template'] = 'Template'; -$lang['Install'] = 'Install'; -$lang['Download'] = 'Download'; - -$lang['Edit_theme'] = 'Edit Theme'; -$lang['Edit_theme_explain'] = 'In the form below you can edit the settings for the selected theme'; - -$lang['Create_theme'] = 'Create Theme'; -$lang['Create_theme_explain'] = 'Use the form below to create a new theme for a selected template. When entering colours (for which you should use hexadecimal notation) you must not include the initial #, i.e.. CCCCCC is valid, #CCCCCC is not'; - -$lang['Export_themes'] = 'Export Themes'; -$lang['Export_explain'] = 'In this panel you will be able to export the theme data for a selected template. Select the template from the list below and the script will create the theme configuration file and attempt to save it to the selected template directory. If it cannot save the file itself it will give you the option to download it. In order for the script to save the file you must give write access to the webserver for the selected template dir. For more information on this see the phpBB 2 users guide.'; - -$lang['Theme_installed'] = 'The selected theme has been installed successfully'; -$lang['Style_removed'] = 'The selected style has been removed from the database. To fully remove this style from your system you must delete the appropriate style from your templates directory.'; -$lang['Theme_info_saved'] = 'The theme information for the selected template has been saved. You should now return the permissions on the theme_info.cfg (and if applicable the selected template directory) to read-only'; -$lang['Theme_updated'] = 'The selected theme has been updated. You should now export the new theme settings'; -$lang['Theme_created'] = 'Theme created. You should now export the theme to the theme configuration file for safe keeping or use elsewhere'; - -$lang['Confirm_delete_style'] = 'Are you sure you want to delete this style?'; - -$lang['Download_theme_cfg'] = 'The exporter could not write the theme information file. Click the button below to download this file with your browser. Once you have downloaded it you can transfer it to the directory containing the template files. You can then package the files for distribution or use elsewhere if you desire'; -$lang['No_themes'] = 'The template you selected has no themes attached to it. To create a new theme click the Create New link on the left hand panel'; -$lang['No_template_dir'] = 'Could not open the template directory. It may be unreadable by the webserver or may not exist'; -$lang['Cannot_remove_style'] = 'You cannot remove the style selected since it is currently the forum default. Please change the default style and try again.'; -$lang['Style_exists'] = 'The style name to selected already exists, please go back and choose a different name.'; - -$lang['Click_return_styleadmin'] = 'Click %sHere%s to return to Style Administration'; - -$lang['Theme_settings'] = 'Theme Settings'; -$lang['Theme_element'] = 'Theme Element'; -$lang['Simple_name'] = 'Simple Name'; -$lang['Value'] = 'Value'; -$lang['Save_Settings'] = 'Save Settings'; - -$lang['Stylesheet'] = 'CSS Stylesheet'; -$lang['Stylesheet_explain'] = 'Filename for CSS stylesheet to use for this theme.'; -$lang['Background_image'] = 'Background Image'; -$lang['Background_color'] = 'Background Colour'; -$lang['Theme_name'] = 'Theme Name'; -$lang['Link_color'] = 'Link Colour'; -$lang['Text_color'] = 'Text Colour'; -$lang['VLink_color'] = 'Visited Link Colour'; -$lang['ALink_color'] = 'Active Link Colour'; -$lang['HLink_color'] = 'Hover Link Colour'; -$lang['Tr_color1'] = 'Table Row Colour 1'; -$lang['Tr_color2'] = 'Table Row Colour 2'; -$lang['Tr_color3'] = 'Table Row Colour 3'; -$lang['Tr_class1'] = 'Table Row Class 1'; -$lang['Tr_class2'] = 'Table Row Class 2'; -$lang['Tr_class3'] = 'Table Row Class 3'; -$lang['Th_color1'] = 'Table Header Colour 1'; -$lang['Th_color2'] = 'Table Header Colour 2'; -$lang['Th_color3'] = 'Table Header Colour 3'; -$lang['Th_class1'] = 'Table Header Class 1'; -$lang['Th_class2'] = 'Table Header Class 2'; -$lang['Th_class3'] = 'Table Header Class 3'; -$lang['Td_color1'] = 'Table Cell Colour 1'; -$lang['Td_color2'] = 'Table Cell Colour 2'; -$lang['Td_color3'] = 'Table Cell Colour 3'; -$lang['Td_class1'] = 'Table Cell Class 1'; -$lang['Td_class2'] = 'Table Cell Class 2'; -$lang['Td_class3'] = 'Table Cell Class 3'; -$lang['fontface1'] = 'Font Face 1'; -$lang['fontface2'] = 'Font Face 2'; -$lang['fontface3'] = 'Font Face 3'; -$lang['fontsize1'] = 'Font Size 1'; -$lang['fontsize2'] = 'Font Size 2'; -$lang['fontsize3'] = 'Font Size 3'; -$lang['fontcolor1'] = 'Font Colour 1'; -$lang['fontcolor2'] = 'Font Colour 2'; -$lang['fontcolor3'] = 'Font Colour 3'; -$lang['span_class1'] = 'Span Class 1'; -$lang['span_class2'] = 'Span Class 2'; -$lang['span_class3'] = 'Span Class 3'; -$lang['img_poll_size'] = 'Polling Image Size [px]'; -$lang['img_pm_size'] = 'Private Message Status size [px]'; - - -// -// Install Process -// -$lang['Welcome_install'] = 'Welcome to phpBB 2 Installation'; -$lang['Initial_config'] = 'Basic Configuration'; -$lang['DB_config'] = 'Database Configuration'; -$lang['Admin_config'] = 'Admin Configuration'; -$lang['continue_upgrade'] = 'Once you have downloaded your config file to your local machine you may\'Continue Upgrade\' button below to move forward with the upgrade process. Please wait to upload the config file until the upgrade process is complete.'; -$lang['upgrade_submit'] = 'Continue Upgrade'; - -$lang['Installer_Error'] = 'An error has occurred during installation'; -$lang['Previous_Install'] = 'A previous installation has been detected'; -$lang['Install_db_error'] = 'An error occurred trying to update the database'; - -$lang['Re_install'] = 'Your previous installation is still active.<br /><br />If you would like to re-install phpBB 2 you should click the Yes button below. Please be aware that doing so will destroy all existing data and no backups will be made! The administrator username and password you have used to login in to the board will be re-created after the re-installation and no other settings will be retained.<br /><br />Think carefully before pressing Yes!'; - -$lang['Inst_Step_0'] = 'Thank you f... [truncated message content] |
From: <mar...@us...> - 2007-03-18 23:59:03
|
Revision: 68 http://svn.sourceforge.net/phpbbkb/?rev=68&view=rev Author: markthedaemon Date: 2007-03-18 10:29:45 -0700 (Sun, 18 Mar 2007) Log Message: ----------- Doh! Missed a semi-colon. Also a test to see if the SF commit notifications are working, they seem a little broken at the moment. Modified Paths: -------------- main/trunk/install/kb_install.php Modified: main/trunk/install/kb_install.php =================================================================== --- main/trunk/install/kb_install.php 2007-03-17 14:00:52 UTC (rev 67) +++ main/trunk/install/kb_install.php 2007-03-18 17:29:45 UTC (rev 68) @@ -99,7 +99,7 @@ config_name varchar(255) NOT NULL, config_value varchar(255) NOT NULL, PRIMARY KEY (config_name) -);" +);"; $sql[] = "INSERT INTO " . $table_prefix . "kb_categories (cat_id, cat_main, cat_title, cat_desc, cat_articles, cat_order) VALUES ('', '0', 'Example Category 1', 'Example description for category 1','0', '1');"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2007-03-18 13:32:08
|
Revision: 67 http://svn.sourceforge.net/phpbbkb/?rev=67&view=rev Author: markthedaemon Date: 2007-03-17 07:00:52 -0700 (Sat, 17 Mar 2007) Log Message: ----------- Committing a kb_config table which will allow kb configuration entries to be stored in it. Works a lot like phpbb_config. It has the same table layout with the code being "borrowed" ;) that allows us to use $kb_config['value'], again like the $board_config['value'] system. Modified Paths: -------------- main/trunk/common.php main/trunk/includes/constants.php main/trunk/install/kb_install.php Modified: main/trunk/common.php =================================================================== --- main/trunk/common.php 2007-03-07 20:20:58 UTC (rev 66) +++ main/trunk/common.php 2007-03-17 14:00:52 UTC (rev 67) @@ -220,6 +220,19 @@ $board_config[$row['config_name']] = $row['config_value']; } +// Shamelessly stolen from above for the KB configuration :P. +$sql = "SELECT * + FROM " . KB_CONFIG_TABLE; +if( !($result = $db->sql_query($sql)) ) +{ + message_die(CRITICAL_ERROR, "Could not query config information", "", __LINE__, __FILE__, $sql); +} + +while ( $row = $db->sql_fetchrow($result) ) +{ + $kb_config[$row['config_name']] = $row['config_value']; +} + if (file_exists('install') || file_exists('contrib')) { message_die(GENERAL_MESSAGE, 'Please_remove_install_contrib'); Modified: main/trunk/includes/constants.php =================================================================== --- main/trunk/includes/constants.php 2007-03-07 20:20:58 UTC (rev 66) +++ main/trunk/includes/constants.php 2007-03-17 14:00:52 UTC (rev 67) @@ -188,6 +188,7 @@ define('KB_ARTICLES_TABLE', $table_prefix . "kb_articles"); define('KB_ARTICLECATS_TABLE', $table_prefix . "kb_articlecats"); // For Multiple cats define('KB_AUTH_ACCESS', $table_prefix . "kb_auth_access"); +define('KB_CONFIG_TABLE', $table_prefix . "kb_config"); // Article Status define('KB_STATUS_NOT_ASSIGNED', 0); Modified: main/trunk/install/kb_install.php =================================================================== --- main/trunk/install/kb_install.php 2007-03-07 20:20:58 UTC (rev 66) +++ main/trunk/install/kb_install.php 2007-03-17 14:00:52 UTC (rev 67) @@ -95,6 +95,12 @@ KEY cat_id (cat_id) )"; +$sql[] = "CREATE TABLE " . $table_prefix . "kb_config ( + config_name varchar(255) NOT NULL, + config_value varchar(255) NOT NULL, + PRIMARY KEY (config_name) +);" + $sql[] = "INSERT INTO " . $table_prefix . "kb_categories (cat_id, cat_main, cat_title, cat_desc, cat_articles, cat_order) VALUES ('', '0', 'Example Category 1', 'Example description for category 1','0', '1');"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2007-03-07 20:20:57
|
Revision: 66 http://svn.sourceforge.net/phpbbkb/?rev=66&view=rev Author: markthedaemon Date: 2007-03-07 12:20:58 -0800 (Wed, 07 Mar 2007) Log Message: ----------- Removing the contrib/ and docs/ directories; there isn't a great deal of need for them. Removed Paths: ------------- main/trunk/contrib/ main/trunk/docs/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2007-03-07 00:00:12
|
Revision: 65 http://svn.sourceforge.net/phpbbkb/?rev=65&view=rev Author: markthedaemon Date: 2007-03-06 16:00:12 -0800 (Tue, 06 Mar 2007) Log Message: ----------- Well, its finally been released ;). Added Paths: ----------- main/branches/alpha1/ Copied: main/branches/alpha1 (from rev 64, main/trunk) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <so...@us...> - 2007-03-06 22:13:27
|
Revision: 64 http://svn.sourceforge.net/phpbbkb/?rev=64&view=rev Author: softphp Date: 2007-03-06 14:13:22 -0800 (Tue, 06 Mar 2007) Log Message: ----------- - Fixed bug #20, #21, #22.. Let's go alpha! Modified Paths: -------------- main/trunk/admin/admin_kb.php main/trunk/includes/functions_kb.php main/trunk/kb.php main/trunk/language/lang_english/lang_kb.php Modified: main/trunk/admin/admin_kb.php =================================================================== --- main/trunk/admin/admin_kb.php 2007-02-24 20:51:19 UTC (rev 63) +++ main/trunk/admin/admin_kb.php 2007-03-06 22:13:22 UTC (rev 64) @@ -198,14 +198,10 @@ $cancel = isset($HTTP_POST_VARS['cancel']) ? true : false; if($cancel) { - // Redirect back to cat page - $meta = '<meta http-equiv="refresh" content="0;url=' . append_sid('admin_kb.' . $phpEx . '?mode=cats') . '>"'; + // Redirect back to cat page + $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>'); - $template->assign_vars(array( - 'META' => $meta) - ); - - message_die(GENERAL_MESSAGE, ''); + message_die(GENERAL_MESSAGE, $message); } elseif(!$confirm) { @@ -246,6 +242,54 @@ message_die(GENERAL_ERROR, "Couldn't delete category from categories table.", "", __LINE__, __FILE__, $sql); } + // Obtain articles that has been deleted. + $sql = "SELECT article_id FROM " . KB_ARTICLECATS_TABLE . " WHERE cat_id = '" . $cat_id . "'"; + if(!$result = $db->sql_query($sql)) + { + message_die(GENERAL_ERROR, "Couldn't obtain articles that needs deletion.", "", __LINE__, __FILE__, $sql); + } + + while($row = $db->sql_fetchrow($result)) + { + $sql = "DELETE FROM " . KB_ARTICLES_TABLE . " WHERE article_id = '" . $row['article_id'] . "'"; + if(!$db->sql_query($sql)) + { + message_die(GENERAL_ERROR, "Couldn't delete articles from article table.", "", __LINE__, __FILE__, $sql); + } + } + + // Now get subcats and loop through them deleting all of them and their articles. + $sql = "SELECT cat_id FROM " . KB_CATEGORIES_TABLE . " WHERE cat_main = '" . $cat_id . "'"; + if(!$result = $db->sql_query($sql)) + { + message_die(GENERAL_ERROR, "Couldn't obtain subcategories.", "", __LINE__, __FILE__, $sql); + } + + while($row = $db->sql_fetchrow($result)) + { + // Get all articles and delete them, then delete articlecats entries + $sql = "SELECT article_id FROM " . KB_ARTICLECATS_TABLE . " WHERE cat_id = '" . $row['cat_id'] . "'"; + if(!$result2 = $db->sql_query($sql)) + { + message_die(GENERAL_ERROR, "Couldn't obtain articles that needs deletion.", "", __LINE__, __FILE__, $sql); + } + + while($row2 = $db->sql_fetchrow($result2)) + { + $sql = "DELETE FROM " . KB_ARTICLES_TABLE . " WHERE article_id = '" . $row2['article_id'] . "'"; + if(!$db->sql_query($sql)) + { + message_die(GENERAL_ERROR, "Couldn't delete articles from article table.", "", __LINE__, __FILE__, $sql); + } + } + + $sql = "DELETE FROM " . KB_ARTICLECATS_TABLE . " WHERE cat_id = '" . $row['cat_id'] . "'"; + if(!$db->sql_query($sql)) + { + message_die(GENERAL_ERROR, "Couldn't delete subcategory from articlecats table.", "", __LINE__, __FILE__, $sql); + } + } + $sql = "DELETE FROM " . KB_ARTICLECATS_TABLE . " WHERE cat_id = '" . $cat_id . "'"; if(!$db->sql_query($sql)) { @@ -259,6 +303,9 @@ message_die(GENERAL_ERROR, "Couldn't delete subcategories from articlecats table.", "", __LINE__, __FILE__, $sql); } + // Delete subcats articles.. oh no + + $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? Modified: main/trunk/includes/functions_kb.php =================================================================== --- main/trunk/includes/functions_kb.php 2007-02-24 20:51:19 UTC (rev 63) +++ main/trunk/includes/functions_kb.php 2007-03-06 22:13:22 UTC (rev 64) @@ -810,7 +810,7 @@ if($cancel) { - $meta = '<meta http-equiv="refresh" content="0;url=' . append_sid('kb.' . $phpEx) . '>"'; + $meta = '<meta http-equiv="refresh" content="0;url=' . append_sid('kb.' . $phpEx) . '">'; $template->assign_vars(array( 'META' => $meta) Modified: main/trunk/kb.php =================================================================== --- main/trunk/kb.php 2007-02-24 20:51:19 UTC (rev 63) +++ main/trunk/kb.php 2007-03-06 22:13:22 UTC (rev 64) @@ -494,10 +494,7 @@ // include($phpbb_root_path . 'includes/page_header.' . $phpEx); - if($action != "delete_article") - { - $template->pparse('body'); - } + $template->pparse('body'); include($phpbb_root_path . 'includes/page_tail.'.$phpEx); } Modified: main/trunk/language/lang_english/lang_kb.php =================================================================== --- main/trunk/language/lang_english/lang_kb.php 2007-02-24 20:51:19 UTC (rev 63) +++ main/trunk/language/lang_english/lang_kb.php 2007-03-06 22:13:22 UTC (rev 64) @@ -75,7 +75,7 @@ $lang['kbadm_cat_parent'] = "Parent Category"; $lang['kbadm_empty_cat_title'] = "The Category Title submitted was empty."; $lang['kbadm_empty_cat_desc'] = "The Category Description submitted was empty."; -$lang['kbadm_confirm_deletecat'] = "Are you sure you want to delete this category?"; +$lang['kbadm_confirm_deletecat'] = "Are you sure you want to delete this category? <b>Please notice that all subcategories aswell as all categories in this category (or subcategories) will be deleted, even though they are assigned other categories aswell!</b>"; $lang['kbadm_Click_return_catadmin'] = "Click %shere%s to return to category administration."; $lang['kbadm_header_addcat'] = "Add Category"; $lang['kbadm_explain_addcat'] = "From here you can add a new category."; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <so...@us...> - 2007-02-24 20:51:18
|
Revision: 63 http://svn.sourceforge.net/phpbbkb/?rev=63&view=rev Author: softphp Date: 2007-02-24 12:51:19 -0800 (Sat, 24 Feb 2007) Log Message: ----------- - Bug #17, #18. Modified Paths: -------------- main/trunk/includes/functions_kb.php main/trunk/kb.php Modified: main/trunk/includes/functions_kb.php =================================================================== --- main/trunk/includes/functions_kb.php 2007-02-24 13:59:19 UTC (rev 62) +++ main/trunk/includes/functions_kb.php 2007-02-24 20:51:19 UTC (rev 63) @@ -294,9 +294,9 @@ $smilies_on = ( !empty($HTTP_POST_VARS['disable_smilies']) ) ? 0 : 1; } - $article_desc = ( !empty($HTTP_POST_VARS['desc']) ) ? trim(stripslashes($HTTP_POST_VARS['desc'])) : ''; - $article_title = ( !empty($HTTP_POST_VARS['title']) ) ? trim(stripslashes($HTTP_POST_VARS['title'])) : ''; - $message = ( !empty($HTTP_POST_VARS['message']) ) ? stripslashes($HTTP_POST_VARS['message']) : ''; + $article_desc = ( !empty($HTTP_POST_VARS['desc']) ) ? trim(addslashes($HTTP_POST_VARS['desc'])) : ''; + $article_title = ( !empty($HTTP_POST_VARS['title']) ) ? trim(addslashes($HTTP_POST_VARS['title'])) : ''; + $message = ( !empty($HTTP_POST_VARS['message']) ) ? addslashes($HTTP_POST_VARS['message']) : ''; $article_author = ($mode == 'edit') ? $article['article_author'] : $userdata['user_id']; $article_authorname = ( $mode == 'edit' ) ? ( ( empty($HTTP_POST_VARS['authorname']) ) ? $article['article_authorname'] : $HTTP_POST_VARS['authorname'] ) : ( ( empty($HTTP_POST_VARS['authorname']) ) ? $userdata['username'] : $HTTP_POST_VARS['authorname'] ); $bbcode_uid = ($mode == 'edit' ) ? $article['bbcode_uid'] : ''; Modified: main/trunk/kb.php =================================================================== --- main/trunk/kb.php 2007-02-24 13:59:19 UTC (rev 62) +++ main/trunk/kb.php 2007-02-24 20:51:19 UTC (rev 63) @@ -229,8 +229,8 @@ $template->assign_block_vars('articlerow', array( 'TOPIC_FOLDER_IMG' => $images['folder'], - 'ARTICLE_TITLE' => $articles[$i]['article_title'], - 'ARTICLE_DESC' => $articles[$i]['article_desc'], + 'ARTICLE_TITLE' => stripslashes($articles[$i]['article_title']), + 'ARTICLE_DESC' => stripslashes($articles[$i]['article_desc']), 'ARTICLE_AUTHOR' => $author, 'ARTICLE_HITS' => $articles[$i]['article_hits'], 'ARTICLE_LAST_ACTION' => $last_action, @@ -270,7 +270,7 @@ $sql = "SELECT a.*, u.* FROM " . KB_ARTICLES_TABLE . " a, " . USERS_TABLE . " u - WHERE a.article_title LIKE %'$article_query'% + WHERE a.article_title LIKE '%$article_query%' AND a.article_author = u.user_id"; if( !($result = $db->sql_query($sql)) ) { @@ -315,8 +315,9 @@ message_die(GENERAL_MESSAGE, "The category specified in GET variables did not exist along with this article in the database."); } - $article_title = $article['article_title']; - $article_text = $article['article_text']; + $article_title = stripslashes($article['article_title']); + $article_text = stripslashes($article['article_text']); + $article_desc = stripslashes($article['article_desc']); $article_bbcode_uid = $article['bbcode_uid']; $user_sig = ( $article['enable_sig'] && $article['user_sig'] != '' && $board_config['allow_sig'] ) ? $article['user_sig'] : ''; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <so...@us...> - 2007-02-24 13:59:26
|
Revision: 62 http://svn.sourceforge.net/phpbbkb/?rev=62&view=rev Author: softphp Date: 2007-02-24 05:59:19 -0800 (Sat, 24 Feb 2007) Log Message: ----------- -Fixing bug #15, #16, #17 Modified Paths: -------------- main/trunk/includes/functions_kb.php main/trunk/kb.php Modified: main/trunk/includes/functions_kb.php =================================================================== --- main/trunk/includes/functions_kb.php 2007-02-23 20:20:42 UTC (rev 61) +++ main/trunk/includes/functions_kb.php 2007-02-24 13:59:19 UTC (rev 62) @@ -827,7 +827,7 @@ // Output confirmation page // $template->set_filenames(array( - 'confirm_body' => 'confirm_body.tpl') + 'body' => 'confirm_body.tpl') ); $template->assign_vars(array( @@ -840,8 +840,6 @@ 'S_CONFIRM_ACTION' => append_sid("kb." . $phpEx . "?ucp=delete_article"), 'S_HIDDEN_FIELDS' => $s_hidden_fields) ); - - $template->pparse('confirm_body'); } else { @@ -856,7 +854,7 @@ // Obtain categories then delete $sql = "SELECT c.cat_id, ca.cat_id FROM " . KB_ARTICLECATS_TABLE . " c, " . KB_CATEGORIES_TABLE . " ca - WHERE c.article_id = '$id' + WHERE c.article_id = '$article_id' AND ca.cat_id = c.cat_id"; if( !($result = $db->sql_query($sql)) ) { Modified: main/trunk/kb.php =================================================================== --- main/trunk/kb.php 2007-02-23 20:20:42 UTC (rev 61) +++ main/trunk/kb.php 2007-02-24 13:59:19 UTC (rev 62) @@ -270,7 +270,7 @@ $sql = "SELECT a.*, u.* FROM " . KB_ARTICLES_TABLE . " a, " . USERS_TABLE . " u - WHERE a.article_title LIKE '$article_query' + WHERE a.article_title LIKE %'$article_query'% AND a.article_author = u.user_id"; if( !($result = $db->sql_query($sql)) ) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2007-02-23 20:20:41
|
Revision: 61 http://svn.sourceforge.net/phpbbkb/?rev=61&view=rev Author: markthedaemon Date: 2007-02-23 12:20:42 -0800 (Fri, 23 Feb 2007) Log Message: ----------- Fixing the language bugs i've been meaning to do for a while... Modified Paths: -------------- main/trunk/language/lang_english/lang_kb.php Modified: main/trunk/language/lang_english/lang_kb.php =================================================================== --- main/trunk/language/lang_english/lang_kb.php 2007-02-21 01:24:37 UTC (rev 60) +++ main/trunk/language/lang_english/lang_kb.php 2007-02-23 20:20:42 UTC (rev 61) @@ -31,7 +31,6 @@ $lang['kb_categories'] = "Knowledge Base Categories"; $lang['kb_articles'] = "Articles"; $lang['kb_subcats'] = "Subcategories"; -$lang['kb_remove_installfile'] = "Please ensure that you remove the kb_install.php file located in your phpBB root folder. The Knowledge Base Modification <strong>will not</strong> work before the file is removed."; $lang['No_kb_cats'] = "No Knowledge Base categories have been added."; $lang['kb_cat_noexist'] = "The category you have chosen does not exist."; @@ -80,7 +79,7 @@ $lang['kbadm_Click_return_catadmin'] = "Click %shere%s to return to category administration."; $lang['kbadm_header_addcat'] = "Add Category"; $lang['kbadm_explain_addcat'] = "From here you can add a new category."; -$lang['kbadm_addcat'] = "Add"; +$lang['kbadm_addcat'] = "Add Category"; $lang['kbadm_editcat'] = "Edit"; $lang['kbadm_movecatup'] = "Move Up"; @@ -93,7 +92,7 @@ $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."; +$lang['No_kbadm_cats'] = "No knowledge base categories have been added. Click %shere%s to create a new one."; $lang['No_articles'] = "There are no articles in this category."; ?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2007-02-21 01:24:37
|
Revision: 60 http://svn.sourceforge.net/phpbbkb/?rev=60&view=rev Author: markthedaemon Date: 2007-02-20 17:24:37 -0800 (Tue, 20 Feb 2007) Log Message: ----------- Changed a lang string. Modified Paths: -------------- main/trunk/install/kb_install.php main/trunk/language/lang_english/lang_kb.php Modified: main/trunk/install/kb_install.php =================================================================== --- main/trunk/install/kb_install.php 2007-02-21 00:57:43 UTC (rev 59) +++ main/trunk/install/kb_install.php 2007-02-21 01:24:37 UTC (rev 60) @@ -96,7 +96,7 @@ )"; $sql[] = "INSERT INTO " . $table_prefix . "kb_categories (cat_id, cat_main, cat_title, cat_desc, cat_articles, cat_order) - VALUES ('', '0', 'Example Category 1', 'Example description for category 1','0', '9999');"; + VALUES ('', '0', 'Example Category 1', 'Example description for category 1','0', '1');"; echo '<table width="100%" cellspacing="1" cellpadding="2" border="0" class="forumline">'; echo '<tr><th>Updating the database</th></tr>'; Modified: main/trunk/language/lang_english/lang_kb.php =================================================================== --- main/trunk/language/lang_english/lang_kb.php 2007-02-21 00:57:43 UTC (rev 59) +++ main/trunk/language/lang_english/lang_kb.php 2007-02-21 01:24:37 UTC (rev 60) @@ -55,7 +55,7 @@ $lang['kb_empty_cats'] = "The article you submitted had no category defined."; $lang['kb_empty_article_desc'] = "The article has to contain an article description."; $lang['kb_added'] = "Your article has been submitted and is awaiting approval."; -$lang['kb_deleted'] = "Your article has been deleted and is now nonexistant."; +$lang['kb_deleted'] = "Your article has now been removed from the database."; $lang['kb_edited'] = "Your article has been edited and is awaiting reapproval."; $lang['kb_click_view_article'] = "Click %shere%s to view you article."; // Change this later on, they can't view the article yet. //$lang['kb_click_return_ucp'] = "Click %shere%s to go back to the user control panel"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2007-02-21 00:57:46
|
Revision: 59 http://svn.sourceforge.net/phpbbkb/?rev=59&view=rev Author: markthedaemon Date: 2007-02-20 16:57:43 -0800 (Tue, 20 Feb 2007) Log Message: ----------- Probably best if we give an initial category to start with, like phpBB does. Modified Paths: -------------- main/trunk/install/kb_install.php Modified: main/trunk/install/kb_install.php =================================================================== --- main/trunk/install/kb_install.php 2007-02-21 00:48:50 UTC (rev 58) +++ main/trunk/install/kb_install.php 2007-02-21 00:57:43 UTC (rev 59) @@ -95,6 +95,9 @@ KEY cat_id (cat_id) )"; +$sql[] = "INSERT INTO " . $table_prefix . "kb_categories (cat_id, cat_main, cat_title, cat_desc, cat_articles, cat_order) + VALUES ('', '0', 'Example Category 1', 'Example description for category 1','0', '9999');"; + echo '<table width="100%" cellspacing="1" cellpadding="2" border="0" class="forumline">'; echo '<tr><th>Updating the database</th></tr>'; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2007-02-21 00:48:53
|
Revision: 58 http://svn.sourceforge.net/phpbbkb/?rev=58&view=rev Author: markthedaemon Date: 2007-02-20 16:48:50 -0800 (Tue, 20 Feb 2007) Log Message: ----------- Stop the silly people from trying to destroy us ^_^ Modified Paths: -------------- main/trunk/includes/functions_kb.php Modified: main/trunk/includes/functions_kb.php =================================================================== --- main/trunk/includes/functions_kb.php 2007-02-20 23:16:40 UTC (rev 57) +++ main/trunk/includes/functions_kb.php 2007-02-21 00:48:50 UTC (rev 58) @@ -294,9 +294,9 @@ $smilies_on = ( !empty($HTTP_POST_VARS['disable_smilies']) ) ? 0 : 1; } - $article_desc = ( !empty($HTTP_POST_VARS['desc']) ) ? trim($HTTP_POST_VARS['desc']) : ''; - $article_title = ( !empty($HTTP_POST_VARS['title']) ) ? trim($HTTP_POST_VARS['title']) : ''; - $message = ( !empty($HTTP_POST_VARS['message']) ) ? $HTTP_POST_VARS['message'] : ''; + $article_desc = ( !empty($HTTP_POST_VARS['desc']) ) ? trim(stripslashes($HTTP_POST_VARS['desc'])) : ''; + $article_title = ( !empty($HTTP_POST_VARS['title']) ) ? trim(stripslashes($HTTP_POST_VARS['title'])) : ''; + $message = ( !empty($HTTP_POST_VARS['message']) ) ? stripslashes($HTTP_POST_VARS['message']) : ''; $article_author = ($mode == 'edit') ? $article['article_author'] : $userdata['user_id']; $article_authorname = ( $mode == 'edit' ) ? ( ( empty($HTTP_POST_VARS['authorname']) ) ? $article['article_authorname'] : $HTTP_POST_VARS['authorname'] ) : ( ( empty($HTTP_POST_VARS['authorname']) ) ? $userdata['username'] : $HTTP_POST_VARS['authorname'] ); $bbcode_uid = ($mode == 'edit' ) ? $article['bbcode_uid'] : ''; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2007-02-20 23:16:39
|
Revision: 57 http://svn.sourceforge.net/phpbbkb/?rev=57&view=rev Author: markthedaemon Date: 2007-02-20 15:16:40 -0800 (Tue, 20 Feb 2007) Log Message: ----------- Removing the kb/ directory as it is no longer needed. Removed Paths: ------------- main/trunk/kb/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <so...@us...> - 2007-02-19 15:43:31
|
Revision: 56 http://svn.sourceforge.net/phpbbkb/?rev=56&view=rev Author: softphp Date: 2007-02-19 07:43:31 -0800 (Mon, 19 Feb 2007) Log Message: ----------- -Fixed bugs: #12, #13, #14 -Fixed all urls to be compitable with wiki style. -Removed the old inclusion files to make room for the wiki style. Modified Paths: -------------- main/trunk/admin/admin_kb.php main/trunk/includes/constants.php main/trunk/kb.php main/trunk/templates/subSilver/kb_viewcat.tpl Added Paths: ----------- main/trunk/includes/auth_kb.php main/trunk/includes/functions_kb.php Removed Paths: ------------- main/trunk/kb/auth.php main/trunk/kb/constants.php main/trunk/kb/functions.php Modified: main/trunk/admin/admin_kb.php =================================================================== --- main/trunk/admin/admin_kb.php 2007-02-18 21:43:28 UTC (rev 55) +++ main/trunk/admin/admin_kb.php 2007-02-19 15:43:31 UTC (rev 56) @@ -32,8 +32,7 @@ require('./pagestart.' . $phpEx); // Get constants and functions -include($phpbb_root_path . "kb/constants." . $phpEx); -include($phpbb_root_path . "kb/functions." . $phpEx); +include($phpbb_root_path . "includes/functions_kb." . $phpEx); // And language include($phpbb_root_path . "language/lang_" . $board_config['default_lang'] . "/lang_kb." . $phpEx); @@ -200,7 +199,13 @@ if($cancel) { // Redirect back to cat page + $meta = '<meta http-equiv="refresh" content="0;url=' . append_sid('admin_kb.' . $phpEx . '?mode=cats') . '>"'; + $template->assign_vars(array( + 'META' => $meta) + ); + + message_die(GENERAL_MESSAGE, ''); } elseif(!$confirm) { Added: main/trunk/includes/auth_kb.php =================================================================== --- main/trunk/includes/auth_kb.php (rev 0) +++ main/trunk/includes/auth_kb.php 2007-02-19 15:43:31 UTC (rev 56) @@ -0,0 +1,188 @@ +<?php +/*************************************************************************** + * auth.php + * ------------------- + * + * copyright: phpBB KB Group + * site: http://www.phpbbknowledgebase.com + * SF Project Page: http://www.sourceforge.net/projects/phpbbkb + * + ***************************************************************************/ + +/*************************************************************************** + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + ***************************************************************************/ + +// This file holds the kb auth functions, very similar to the phpBB auth functions, but differs certain places :) +// As of now, the articles auth is handles out from which category it is selected through, therefore an article +// can have different kinds of auth, all depending on through which category it is viewed. This solution might seem +// stupid, but it is the best I can come up with, and I think admins will just take that into consideration when creating +// category permissions. + +// +// This function returns info on whether the user is allowed to do the supplied argument(s) all dependant on the given category id +// +function kb_auth($type, $cat_id, $userdata) +{ + switch($type) + { + case "view": + $sql = "a.auth_view"; + $auth_fields = array('auth_view'); + break; + + case "add": + $sql = "a.auth_add"; + $auth_fields = array('auth_add'); + break; + + case "edit": + $sql = "a.auth_edit"; + $auth_fields = array('auth_edit'); + break; + + case "delete": + $sql = "a.auth_delete"; + $auth_fields = array('auth_delete'); + break; + + case "mod": + $sql = "a.auth_mod"; + $auth_fields = array('auth_mod'); + break; + + case "comment": + $sql = "a.auth_comment"; + $auth_fields = array('auth_comment'); + break; + + case "rate": + $sql = "a.auth_rate"; + $auth_fields = array('auth_rate'); + break; + + case "attach": + $sql = "a.auth_attach"; + $auth_fields = array('auth_attach'); + break; + + // Returns array containing everything above + case "all": + $sql = "a.auth_view, a.auth_add, a.auth_edit, a.auth_delete, a.auth_mod, a.auth_comment, a.auth_rate, a.auth_attach"; + $auth_fields = array('auth_view', 'auth_add', 'auth_edit', 'auth_delete', 'auth_mod', 'auth_comment', 'auth_rate', 'auth_attach'); + break; + + // Returns array containing article related auth + case "article": + $sql = "a.auth_view, a.auth_edit, a.auth_delete, a.auth_mod, a.auth_comment, a.auth_rate"; + $auth_fields = array('auth_view', 'auth_edit', 'auth_delete', 'auth_mod', 'auth_comment', 'auth_rate'); + break; + + // Returns array containing category related auth + case "cat": + $sql = "a.auth_view, a.auth_add, a.auth_attach"; + $auth_fields = array('auth_view', 'auth_add', 'auth_attach'); + break; + } + + $sql = "SELECT a.cat_id, $sql + FROM " . KB_CATEGORIES_TABLE . " a + WHERE a.cat_id = '" . $cat_id . "'"; + + if(!$result = $db->sql_query($sql)) + { + message_die(GENERAL_MESSAGE, 'Could not retrieve categorys auth info.', '', __LINE__, __FILE__, $sql); + } + + $f_access = $db->sql_fetchrow($result); + + // + // If user is logged in we need to see if he is in any usergroups that changes his auth info, else just return it + // + if($userdata['session_logged_in']) + { + // Check if the user is present in a group that changes his permissions + $sql = "SELECT a.cat_id, $sql, a.auth_mod + FROM " . KB_AUTH_ACCESS_TABLE . " a, " . USER_GROUP_TABLE . " ug + WHERE ug.user_id = ".$userdata['user_id']. " + AND ug.user_pending = 0 + AND a.group_id = ug.group_id + AND a.cat_id = '" . $cat_id . "'"; + if ( !($result = $db->sql_query($sql)) ) + { + message_die(GENERAL_ERROR, 'Failed obtaining category access control lists', '', __LINE__, __FILE__, $sql); + } + + if ( $row = $db->sql_fetchrow($result) ) + { + do + { + $u_access[] = $row; + } + while( $row = $db->sql_fetchrow($result) ); + } + $db->sql_freeresult($result); + } + + $is_admin = ( $userdata['user_level'] == ADMIN && $userdata['session_logged_in'] ) ? TRUE : 0; + + $auth = array(); + for($i = 0; $i < count($auth_fields); $i++) + { + $key = $auth_fields[$i]; + + // + // If the user is logged on and the forum type is either ALL or REG then the user has access + // + // If the type if ACL, MOD or ADMIN then we need to see if the user has specific permissions + // to do whatever it is they want to do ... to do this we pull relevant information for the + // user (and any groups they belong to) + // + // Now we compare the users access level against the forums. We assume here that a moderator + // and admin automatically have access to an ACL forum, similarly we assume admins meet an + // auth requirement of MOD + // + $value = $f_access[$key]; + + switch( $value ) + { + case AUTH_ALL: + $auth[$key] = TRUE; + $auth[$key . '_type'] = $lang['Auth_Anonymous_Users']; + break; + + case AUTH_REG: + $auth_user[$key] = ( $userdata['session_logged_in'] ) ? TRUE : 0; + $auth_user[$key . '_type'] = $lang['Auth_Registered_Users']; + break; + + case AUTH_ACL: + $auth[$key] = ( $userdata['session_logged_in'] ) ? auth_check_user(AUTH_ACL, $key, $u_access, $is_admin) : 0; + $auth[$key . '_type'] = $lang['Auth_Users_granted_access']; + break; + + case AUTH_MOD: + $auth[$key] = ( $userdata['session_logged_in'] ) ? auth_check_user(AUTH_MOD, 'auth_mod', $u_access, $is_admin) : 0; + $auth[$key . '_type'] = $lang['Auth_Moderators']; + break; + + case AUTH_ADMIN: + $auth[$key] = $is_admin; + $auth[$key . '_type'] = $lang['Auth_Administrators']; + break; + + default: + $auth[$key] = 0; + break; + } + } + + return $auth; +} + +?> Modified: main/trunk/includes/constants.php =================================================================== --- main/trunk/includes/constants.php 2007-02-18 21:43:28 UTC (rev 55) +++ main/trunk/includes/constants.php 2007-02-19 15:43:31 UTC (rev 56) @@ -1,186 +1,198 @@ -<?php -/*************************************************************************** - * constants.php - * ------------------- - * begin : Saturday', Feb 13', 2001 - * copyright : ('C) 2001 The phpBB Group - * email : su...@ph... - * - * $Id: constants.php,v 1.47.2.6 2005/10/30 15:17:14 acydburn Exp $ - * - * - ***************************************************************************/ - -/*************************************************************************** - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License', or - * ('at your option) any later version. - * - ***************************************************************************/ - -if ( !defined('IN_PHPBB') ) -{ - die("Hacking attempt"); -} - -// Debug Level -//define('DEBUG', 1); // Debugging on -define('DEBUG', 1); // Debugging off - - -// User Levels <- Do not change the values of USER or ADMIN -define('DELETED', -1); -define('ANONYMOUS', -1); - -define('USER', 0); -define('ADMIN', 1); -define('MOD', 2); - - -// User related -define('USER_ACTIVATION_NONE', 0); -define('USER_ACTIVATION_SELF', 1); -define('USER_ACTIVATION_ADMIN', 2); - -define('USER_AVATAR_NONE', 0); -define('USER_AVATAR_UPLOAD', 1); -define('USER_AVATAR_REMOTE', 2); -define('USER_AVATAR_GALLERY', 3); - - -// Group settings -define('GROUP_OPEN', 0); -define('GROUP_CLOSED', 1); -define('GROUP_HIDDEN', 2); - - -// Forum state -define('FORUM_UNLOCKED', 0); -define('FORUM_LOCKED', 1); - - -// Topic status -define('TOPIC_UNLOCKED', 0); -define('TOPIC_LOCKED', 1); -define('TOPIC_MOVED', 2); -define('TOPIC_WATCH_NOTIFIED', 1); -define('TOPIC_WATCH_UN_NOTIFIED', 0); - - -// Topic types -define('POST_NORMAL', 0); -define('POST_STICKY', 1); -define('POST_ANNOUNCE', 2); -define('POST_GLOBAL_ANNOUNCE', 3); - - -// SQL codes -define('BEGIN_TRANSACTION', 1); -define('END_TRANSACTION', 2); - - -// Error codes -define('GENERAL_MESSAGE', 200); -define('GENERAL_ERROR', 202); -define('CRITICAL_MESSAGE', 203); -define('CRITICAL_ERROR', 204); - - -// Private messaging -define('PRIVMSGS_READ_MAIL', 0); -define('PRIVMSGS_NEW_MAIL', 1); -define('PRIVMSGS_SENT_MAIL', 2); -define('PRIVMSGS_SAVED_IN_MAIL', 3); -define('PRIVMSGS_SAVED_OUT_MAIL', 4); -define('PRIVMSGS_UNREAD_MAIL', 5); - - -// URL PARAMETERS -define('POST_TOPIC_URL', 't'); -define('POST_CAT_URL', 'c'); -define('POST_FORUM_URL', 'f'); -define('POST_USERS_URL', 'u'); -define('POST_POST_URL', 'p'); -define('POST_GROUPS_URL', 'g'); - -// Session parameters -define('SESSION_METHOD_COOKIE', 100); -define('SESSION_METHOD_GET', 101); - - -// Page numbers for session handling -define('PAGE_INDEX', 0); -define('PAGE_LOGIN', -1); -define('PAGE_SEARCH', -2); -define('PAGE_REGISTER', -3); -define('PAGE_PROFILE', -4); -define('PAGE_VIEWONLINE', -6); -define('PAGE_VIEWMEMBERS', -7); -define('PAGE_FAQ', -8); -define('PAGE_POSTING', -9); -define('PAGE_PRIVMSGS', -10); -define('PAGE_GROUPCP', -11); -define('PAGE_TOPIC_OFFSET', 5000); -define('PAGE_KB', -1345); // http://www.phpbb.com/kb/article.php?article_id=149 - - -// Auth settings -define('AUTH_LIST_ALL', 0); -define('AUTH_ALL', 0); - -define('AUTH_REG', 1); -define('AUTH_ACL', 2); -define('AUTH_MOD', 3); -define('AUTH_ADMIN', 5); - -define('AUTH_VIEW', 1); -define('AUTH_READ', 2); -define('AUTH_POST', 3); -define('AUTH_REPLY', 4); -define('AUTH_EDIT', 5); -define('AUTH_DELETE', 6); -define('AUTH_ANNOUNCE', 7); -define('AUTH_STICKY', 8); -define('AUTH_POLLCREATE', 9); -define('AUTH_VOTE', 10); -define('AUTH_ATTACH', 11); - - -// Table names -define('CONFIRM_TABLE', $table_prefix.'confirm'); -define('AUTH_ACCESS_TABLE', $table_prefix.'auth_access'); -define('BANLIST_TABLE', $table_prefix.'banlist'); -define('CATEGORIES_TABLE', $table_prefix.'categories'); -define('CONFIG_TABLE', $table_prefix.'config'); -define('DISALLOW_TABLE', $table_prefix.'disallow'); -define('FORUMS_TABLE', $table_prefix.'forums'); -define('GROUPS_TABLE', $table_prefix.'groups'); -define('POSTS_TABLE', $table_prefix.'posts'); -define('POSTS_TEXT_TABLE', $table_prefix.'posts_text'); -define('PRIVMSGS_TABLE', $table_prefix.'privmsgs'); -define('PRIVMSGS_TEXT_TABLE', $table_prefix.'privmsgs_text'); -define('PRIVMSGS_IGNORE_TABLE', $table_prefix.'privmsgs_ignore'); -define('PRUNE_TABLE', $table_prefix.'forum_prune'); -define('RANKS_TABLE', $table_prefix.'ranks'); -define('SEARCH_TABLE', $table_prefix.'search_results'); -define('SEARCH_WORD_TABLE', $table_prefix.'search_wordlist'); -define('SEARCH_MATCH_TABLE', $table_prefix.'search_wordmatch'); -define('SESSIONS_TABLE', $table_prefix.'sessions'); -define('SESSIONS_KEYS_TABLE', $table_prefix.'sessions_keys'); -define('SMILIES_TABLE', $table_prefix.'smilies'); -define('THEMES_TABLE', $table_prefix.'themes'); -define('THEMES_NAME_TABLE', $table_prefix.'themes_name'); -define('TOPICS_TABLE', $table_prefix.'topics'); -define('TOPICS_WATCH_TABLE', $table_prefix.'topics_watch'); -define('USER_GROUP_TABLE', $table_prefix.'user_group'); -define('USERS_TABLE', $table_prefix.'users'); -define('WORDS_TABLE', $table_prefix.'words'); -define('VOTE_DESC_TABLE', $table_prefix.'vote_desc'); -define('VOTE_RESULTS_TABLE', $table_prefix.'vote_results'); -define('VOTE_USERS_TABLE', $table_prefix.'vote_voters'); - - - +<?php +/*************************************************************************** + * constants.php + * ------------------- + * begin : Saturday', Feb 13', 2001 + * copyright : ('C) 2001 The phpBB Group + * email : su...@ph... + * + * $Id: constants.php,v 1.47.2.6 2005/10/30 15:17:14 acydburn Exp $ + * + * + ***************************************************************************/ + +/*************************************************************************** + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License', or + * ('at your option) any later version. + * + ***************************************************************************/ + +if ( !defined('IN_PHPBB') ) +{ + die("Hacking attempt"); +} + +// Debug Level +//define('DEBUG', 1); // Debugging on +define('DEBUG', 1); // Debugging off + + +// User Levels <- Do not change the values of USER or ADMIN +define('DELETED', -1); +define('ANONYMOUS', -1); + +define('USER', 0); +define('ADMIN', 1); +define('MOD', 2); + + +// User related +define('USER_ACTIVATION_NONE', 0); +define('USER_ACTIVATION_SELF', 1); +define('USER_ACTIVATION_ADMIN', 2); + +define('USER_AVATAR_NONE', 0); +define('USER_AVATAR_UPLOAD', 1); +define('USER_AVATAR_REMOTE', 2); +define('USER_AVATAR_GALLERY', 3); + + +// Group settings +define('GROUP_OPEN', 0); +define('GROUP_CLOSED', 1); +define('GROUP_HIDDEN', 2); + + +// Forum state +define('FORUM_UNLOCKED', 0); +define('FORUM_LOCKED', 1); + + +// Topic status +define('TOPIC_UNLOCKED', 0); +define('TOPIC_LOCKED', 1); +define('TOPIC_MOVED', 2); +define('TOPIC_WATCH_NOTIFIED', 1); +define('TOPIC_WATCH_UN_NOTIFIED', 0); + + +// Topic types +define('POST_NORMAL', 0); +define('POST_STICKY', 1); +define('POST_ANNOUNCE', 2); +define('POST_GLOBAL_ANNOUNCE', 3); + + +// SQL codes +define('BEGIN_TRANSACTION', 1); +define('END_TRANSACTION', 2); + + +// Error codes +define('GENERAL_MESSAGE', 200); +define('GENERAL_ERROR', 202); +define('CRITICAL_MESSAGE', 203); +define('CRITICAL_ERROR', 204); + + +// Private messaging +define('PRIVMSGS_READ_MAIL', 0); +define('PRIVMSGS_NEW_MAIL', 1); +define('PRIVMSGS_SENT_MAIL', 2); +define('PRIVMSGS_SAVED_IN_MAIL', 3); +define('PRIVMSGS_SAVED_OUT_MAIL', 4); +define('PRIVMSGS_UNREAD_MAIL', 5); + + +// URL PARAMETERS +define('POST_TOPIC_URL', 't'); +define('POST_CAT_URL', 'c'); +define('POST_FORUM_URL', 'f'); +define('POST_USERS_URL', 'u'); +define('POST_POST_URL', 'p'); +define('POST_GROUPS_URL', 'g'); + +// Session parameters +define('SESSION_METHOD_COOKIE', 100); +define('SESSION_METHOD_GET', 101); + + +// Page numbers for session handling +define('PAGE_INDEX', 0); +define('PAGE_LOGIN', -1); +define('PAGE_SEARCH', -2); +define('PAGE_REGISTER', -3); +define('PAGE_PROFILE', -4); +define('PAGE_VIEWONLINE', -6); +define('PAGE_VIEWMEMBERS', -7); +define('PAGE_FAQ', -8); +define('PAGE_POSTING', -9); +define('PAGE_PRIVMSGS', -10); +define('PAGE_GROUPCP', -11); +define('PAGE_TOPIC_OFFSET', 5000); +define('PAGE_KB', -1345); // http://www.phpbb.com/kb/article.php?article_id=149 + + +// Auth settings +define('AUTH_LIST_ALL', 0); +define('AUTH_ALL', 0); + +define('AUTH_REG', 1); +define('AUTH_ACL', 2); +define('AUTH_MOD', 3); +define('AUTH_ADMIN', 5); + +define('AUTH_VIEW', 1); +define('AUTH_READ', 2); +define('AUTH_POST', 3); +define('AUTH_REPLY', 4); +define('AUTH_EDIT', 5); +define('AUTH_DELETE', 6); +define('AUTH_ANNOUNCE', 7); +define('AUTH_STICKY', 8); +define('AUTH_POLLCREATE', 9); +define('AUTH_VOTE', 10); +define('AUTH_ATTACH', 11); + + +// Table names +define('CONFIRM_TABLE', $table_prefix.'confirm'); +define('AUTH_ACCESS_TABLE', $table_prefix.'auth_access'); +define('BANLIST_TABLE', $table_prefix.'banlist'); +define('CATEGORIES_TABLE', $table_prefix.'categories'); +define('CONFIG_TABLE', $table_prefix.'config'); +define('DISALLOW_TABLE', $table_prefix.'disallow'); +define('FORUMS_TABLE', $table_prefix.'forums'); +define('GROUPS_TABLE', $table_prefix.'groups'); +define('POSTS_TABLE', $table_prefix.'posts'); +define('POSTS_TEXT_TABLE', $table_prefix.'posts_text'); +define('PRIVMSGS_TABLE', $table_prefix.'privmsgs'); +define('PRIVMSGS_TEXT_TABLE', $table_prefix.'privmsgs_text'); +define('PRIVMSGS_IGNORE_TABLE', $table_prefix.'privmsgs_ignore'); +define('PRUNE_TABLE', $table_prefix.'forum_prune'); +define('RANKS_TABLE', $table_prefix.'ranks'); +define('SEARCH_TABLE', $table_prefix.'search_results'); +define('SEARCH_WORD_TABLE', $table_prefix.'search_wordlist'); +define('SEARCH_MATCH_TABLE', $table_prefix.'search_wordmatch'); +define('SESSIONS_TABLE', $table_prefix.'sessions'); +define('SESSIONS_KEYS_TABLE', $table_prefix.'sessions_keys'); +define('SMILIES_TABLE', $table_prefix.'smilies'); +define('THEMES_TABLE', $table_prefix.'themes'); +define('THEMES_NAME_TABLE', $table_prefix.'themes_name'); +define('TOPICS_TABLE', $table_prefix.'topics'); +define('TOPICS_WATCH_TABLE', $table_prefix.'topics_watch'); +define('USER_GROUP_TABLE', $table_prefix.'user_group'); +define('USERS_TABLE', $table_prefix.'users'); +define('WORDS_TABLE', $table_prefix.'words'); +define('VOTE_DESC_TABLE', $table_prefix.'vote_desc'); +define('VOTE_RESULTS_TABLE', $table_prefix.'vote_results'); +define('VOTE_USERS_TABLE', $table_prefix.'vote_voters'); + +// KB Constants +// All constants here +// DB Tables +define('KB_CATEGORIES_TABLE', $table_prefix . "kb_categories"); +define('KB_ARTICLES_TABLE', $table_prefix . "kb_articles"); +define('KB_ARTICLECATS_TABLE', $table_prefix . "kb_articlecats"); // For Multiple cats +define('KB_AUTH_ACCESS', $table_prefix . "kb_auth_access"); + +// Article Status +define('KB_STATUS_NOT_ASSIGNED', 0); +define('KB_STATUS_ASSIGNED', 1); +define('KB_STATUS_REVIEW_IN_PROGRESS', 3); +define('KB_STATUS_ACCEPTED', 4); +define('KB_STATUS_REJECTED', 5); ?> \ No newline at end of file Added: main/trunk/includes/functions_kb.php =================================================================== --- main/trunk/includes/functions_kb.php (rev 0) +++ main/trunk/includes/functions_kb.php 2007-02-19 15:43:31 UTC (rev 56) @@ -0,0 +1,1009 @@ +<?php +/*************************************************************************** + * functions.php + * ------------------- + * + * copyright: phpBB KB Group + * site: http://www.phpbbknowledgebase.com + * SF Project Page: http://www.sourceforge.net/projects/phpbbkb + * + ***************************************************************************/ + +/*************************************************************************** + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + ***************************************************************************/ + +if (!defined('IN_PHPBB')) +{ + die('Hacking attempt'); +} + +// This function creates the navigation line based on a few parameters +function create_navigation($type = "main", $id_ary = array()) +{ + global $db, $template, $lang, $board_config, $phpEx; + + switch($type) + { + case "ucp": + // Different kind of subcategories + switch($id_ary) + { + case "post_article": + $navigation = '<span class="nav"> <a href="' . append_sid('kb.' . $phpEx) . '" class="nav">' . $lang['kb_main'] . '</a> -> <a class="nav" href="' . append_sid('kb.' . $phpEx . '?ucp=post_article') . '">' . $lang['kb_ucp_articlepost'] .'</a></span>'; + break; + + case "edit_article": + $navigation = '<span class="nav"> <a href="' . append_sid('kb.' . $phpEx) . '" class="nav">' . $lang['kb_main'] . '</a> -> <a class="nav" href="' . append_sid('kb.' . $phpEx . '?ucp=edit_article') . '">' . $lang['kb_ucp_articleedit'] .'</a></span>'; + break; + + default: + break; + } + break; + + case "viewcat": + // View category + // id = $cat_id::$cat_name + $navigation = '<span class="nav"> <a href="' . append_sid('kb.' . $phpEx) . '" class="nav">' . $lang['kb_main'] . '</a> -> <a class="nav" href="' . append_sid('kb.' . $phpEx.'?pid=view_cat&id='. $id_ary[0]) . '">' . $id_ary[1] .'</a></span>'; + break; + + case "viewsubcat": + // View subcategory + // id = $cat_id::$cat_name::$maincat_id + $sql = "SELECT cat_title + FROM " . KB_CATEGORIES_TABLE . " + WHERE cat_id = '" . $id_ary[2] . "'"; + if( !($result = $db->sql_query($sql)) ) + { + message_die(GENERAL_ERROR, 'Could not query cat name.', '', __LINE__, __FILE__, $sql); + } + $maincat = $db->sql_fetchrow($result); + $navigation = '<span class="nav"> <a href="' . append_sid('kb.' . $phpEx) . '" class="nav">' . $lang['kb_main'] . '</a> -> <a class="nav" href="' . append_sid('kb.' . $phpEx.'?cat_id=' . $id_ary[2]) . '">' . $maincat['cat_title'] .'</a> -> <a class="nav" href="' . append_sid('kb.' . $phpEx.'?cat_id=' . $id_ary[0]) . '">' . $id_ary[1] .'</a></span>'; + break; + + case "viewarticle": + // Viewing an article + if($id_ary[2] == 0) + { + $navigation = '<span class="nav"> <a href="' . append_sid('kb.' . $phpEx) . '" class="nav">' . $lang['kb_main'] . '</a> -> <a class="nav" href="' . append_sid('kb.' . $phpEx.'?cat_id=' . $id_ary[0]) . '">' . $id_ary[1] .'</a> -> <a class="nav" href="' . append_sid('kb.' . $phpEx.'?cat_id=' . $id_ary[0] . '&article=' . wiki_article_title($id_ary[4])) . '">' . $id_ary[4] .'</a></span>'; + } + else + { + $sql = "SELECT cat_title + FROM " . KB_CATEGORIES_TABLE . " + WHERE cat_id = '" . $id_ary[2] . "'"; + if( !($result = $db->sql_query($sql)) ) + { + message_die(GENERAL_ERROR, 'Could not query cat name.', '', __LINE__, __FILE__, $sql); + } + $maincat = $db->sql_fetchrow($result); + $navigation = '<span class="nav"> <a href="' . append_sid('kb.' . $phpEx) . '" class="nav">' . $lang['kb_main'] . '</a> -> <a class="nav" href="' . append_sid('kb.' . $phpEx.'?pid=cat_id=' . $id_ary[2]) . '">' . $maincat['cat_title'] .'</a> -> <a class="nav" href="' . append_sid('kb.' . $phpEx.'?pid=cat_id=' . $id_ary[0]) . '">' . $id_ary[1] .'</a> -> <a class="nav" href="' . append_sid('kb.' . $phpEx.'?pid=cat_id=' . $id_ary[0] . '&article=' . wiki_article_title($id_ary[4])) . '">' . $id_ary[4] .'</a></span>'; + } + break; + + case "search": + // viewing search results or page + break; + + case "main": + default: + $navigation = '<span class="nav"> <a href="' . append_sid('kb.' . $phpEx) . '" class="nav">' . $lang['kb_main'] . '</a></span>'; + break; + } + + $template->assign_vars(array( + 'NAVIGATION' => $navigation) + ); + + return; +} + +function get_cats_structure() +{ + global $db; + + $cats = array(); + $sql = "SELECT * + FROM " . KB_CATEGORIES_TABLE . " + WHERE cat_main = '0' + ORDER BY cat_order ASC"; + if( !($result = $db->sql_query($sql)) ) + { + message_die(GENERAL_ERROR, 'Could not query cats.', '', __LINE__, __FILE__, $sql); + } + + $i = 0; + while($row = $db->sql_fetchrow($result)) + { + $cats[$i] = $row; + + $sql = "SELECT * + FROM " . KB_CATEGORIES_TABLE . " + WHERE cat_main = '" . $row['cat_id'] . "' + ORDER BY cat_order ASC"; + if( !($subcat_result = $db->sql_query($sql)) ) + { + message_die(GENERAL_ERROR, 'Could not query subcats.', '', __LINE__, __FILE__, $sql); + } + + $cats[$i]['subcats'] = array(); + while($row2 = $db->sql_fetchrow($subcat_result)) + { + $cats[$i]['subcats'][] = $row2; + } + $i++; + } + + return $cats; +} + +function get_kb_config() +{ + // Using normal db table with kb_prefix + global $db; + + $sql = "SELECT * + FROM " . CONFIG_TABLE; + if(!$result = $db->sql_query($sql)) + { + message_die(CRITICAL_ERROR, "Could not query config information in admin_board", "", __LINE__, __FILE__, $sql); + } + + $config = array(); + while($row = $db->fetchrow($result)) + { + // Detect if it has a kb_ in it and strip it + if(strstr('kb_', $row['config_name'])) + { + $name = str_replace("kb_", "", $row['config_name']); + $config[$name] = $row['config_value']; + } + } + + return $config; +} + +//////////////////////////////////////// +/// UCP FUNCTIONS /// +//////////////////////////////////////// +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": + $title .= ": " . $lang['kb_ucp_articledelete']; + 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, $preview) +{ + global $template, $board_config, $db, $userdata, $lang, $phpbb_root_path, $phpEx, $HTTP_POST_VARS; + + $error_msg = ''; + $user_sig = $userdata['user_sig']; + + // Simple auth for Alpha 1 + if(!$userdata['session_logged_in']) + { + message_die(GENERAL_MESSAGE, 'Not authenticated!'); + } + + if(!empty($HTTP_POST_VARS['post'])) + { + if($mode == 'edit') + { + // Let's get the old article data + $article_id = isset($HTTP_POST_VARS['id']) ? $HTTP_POST_VARS['id'] : false; + if(!$article_id) + { + message_die(MESSAGE_DIE, 'No article id defined.'); + } + + $sql = "SELECT * + FROM " . KB_ARTICLES_TABLE . " + WHERE article_id = '$article_id'"; + if (!$result = $db->sql_query($sql)) + { + message_die(GENERAL_ERROR, 'Error while retrieving old article data.', '', __LINE__, __FILE__, $sql); + } + + $article = $db->sql_fetchrow($result); + + // if user editing set status = 0, else set status = old status :) + if($userdata['user_id'] == $article['article_author']) + { + $article_status = "0"; + } + else + { + $article_status = $article['article_status']; + } + + // Simple Auth for alpha 1 + if(($userdata['user_level'] != ADMIN) && ($userdata['user_id'] != $article['article_author'])) + { + message_die(GENERAL_MESSAGE, $lang['kb_edit_noauth']); + } + } + + // Add the new article + // Make all the variables :) + if ( !$board_config['allow_html'] ) + { + $html_on = 0; + } + else + { + $html_on = ( !empty($HTTP_POST_VARS['disable_html']) ) ? 0 : 1; + } + + if ( !$board_config['allow_bbcode'] ) + { + $bbcode_on = 0; + } + else + { + $bbcode_on = ( !empty($HTTP_POST_VARS['disable_bbcode']) ) ? 0 : 1; + } + + if ( !$board_config['allow_smilies'] ) + { + $smilies_on = 0; + } + else + { + $smilies_on = ( !empty($HTTP_POST_VARS['disable_smilies']) ) ? 0 : 1; + } + + $article_desc = ( !empty($HTTP_POST_VARS['desc']) ) ? trim($HTTP_POST_VARS['desc']) : ''; + $article_title = ( !empty($HTTP_POST_VARS['title']) ) ? trim($HTTP_POST_VARS['title']) : ''; + $message = ( !empty($HTTP_POST_VARS['message']) ) ? $HTTP_POST_VARS['message'] : ''; + $article_author = ($mode == 'edit') ? $article['article_author'] : $userdata['user_id']; + $article_authorname = ( $mode == 'edit' ) ? ( ( empty($HTTP_POST_VARS['authorname']) ) ? $article['article_authorname'] : $HTTP_POST_VARS['authorname'] ) : ( ( empty($HTTP_POST_VARS['authorname']) ) ? $userdata['username'] : $HTTP_POST_VARS['authorname'] ); + $bbcode_uid = ($mode == 'edit' ) ? $article['bbcode_uid'] : ''; + $cat_id = $HTTP_POST_VARS['cats']; + $attach_sig = ( !empty($HTTP_POST_VARS['attach_sig']) ) ? 1 : 0; + + prepare_article($bbcode_on, $html_on, $smilies_on, $error_msg, $bbcode_uid, $article_title, $article_desc, $message, $cat_id); + + if ( $error_msg == '' ) + { + $current_time = time(); + + if($mode == 'post') + { + $sql = "INSERT INTO " . KB_ARTICLES_TABLE . " (article_id, article_title, article_desc, article_author, article_authorname, article_time, article_edittime, article_hits, article_editby, article_status, bbcode_uid, enable_sig, enable_html, enable_bbcode, enable_smilies, article_text) VALUES + ('', '$article_title', '$article_desc', '$article_author', '$article_authorname', '$current_time', '$current_time', '0', '" . $userdata['user_id'] . "', '0', '$bbcode_uid', '$attach_sig', '$html_on', '$bbcode_on', '$smilies_on', '$message');"; + if (!$db->sql_query($sql)) + { + message_die(GENERAL_ERROR, 'Error in adding article', '', __LINE__, __FILE__, $sql); + } + + $article_id = $db->sql_nextid(); + // Now make the categories + foreach($cat_id as $i => $cat) + { + $sql = "INSERT INTO " . KB_ARTICLECATS_TABLE . " VALUES ('$article_id', '$cat');\n"; + $sql2 = "UPDATE " . KB_CATEGORIES_TABLE . " SET cat_articles = cat_articles + 1 WHERE cat_id = '$cat';\n"; + + if (!$db->sql_query($sql)) + { + message_die(GENERAL_ERROR, 'Error in adding articles categories.', '', __LINE__, __FILE__, $sql); + } + + if (!$db->sql_query($sql2)) + { + message_die(GENERAL_ERROR, 'Error in adding updating categories articles count.', '', __LINE__, __FILE__, $sql); + } + } + + $meta = '<meta http-equiv="refresh" content="3;url=' . append_sid('kb.' . $phpEx . '?cat_id=' . $cat . '&article=' . wiki_article_title($article_title)) . '>"'; + $return_message = $lang['kb_added'] . '<br /><br />' . sprintf($lang['kb_click_view_article'], '<a href="' . append_sid('kb.' . $phpEx . '?cat_id=' . $cat . '&article=' . wiki_article_title($article_title)) . '">', '</a>'); + } + else + { + $article_id = isset($HTTP_POST_VARS['id']) ? $HTTP_POST_VARS['id'] : false; + if(!$article_id) + { + message_die(GENERAL_ERROR, 'No article to edit.'); + } + + // First update the article table + $sql = "UPDATE " . KB_ARTICLES_TABLE . " + SET article_title = '$article_title', + article_desc = '$article_desc', + article_author = '$article_author', + article_authorname = '$article_authorname', + article_edittime = '$current_time', + article_editby = '" . $userdata['user_id'] . "', + article_status = '$article_status', + bbcode_uid = '$bbcode_uid', + enable_sig = '$attach_sig', + enable_html = '$html_on', + enable_bbcode = '$bbcode_on', + enable_smilies = '$smilies_on', + article_text = '$message' + WHERE article_id = '$article_id'"; + + if (!$db->sql_query($sql)) + { + message_die(GENERAL_ERROR, 'Error in editing article', '', __LINE__, __FILE__, $sql); + } + + // Now delete all articlecats + $sql = "DELETE FROM " . KB_ARTICLECATS_TABLE . " WHERE article_id = '$article_id'"; + + if (!$db->sql_query($sql)) + { + message_die(GENERAL_ERROR, 'Error in deleting articlecat entries.', '', __LINE__, __FILE__, $sql); + } + + // Last add them again doing the loop + foreach($cat_id as $i => $cat) + { + $sql = "INSERT INTO " . KB_ARTICLECATS_TABLE . " VALUES ('$article_id', '$cat');\n"; + $sql2 = "UPDATE " . KB_CATEGORIES_TABLE . " SET cat_articles = cat_articles + 1 WHERE cat_id = '$cat';\n"; + + if (!$db->sql_query($sql)) + { + message_die(GENERAL_ERROR, 'Error in adding articles categories.', '', __LINE__, __FILE__, $sql); + } + + if (!$db->sql_query($sql2)) + { + message_die(GENERAL_ERROR, 'Error in adding updating categories articles count.', '', __LINE__, __FILE__, $sql); + } + } + + // Message here somewhere + $meta = '<meta http-equiv="refresh" content="3;url=' . append_sid('kb.' . $phpEx . '?cat_id=' . $cat . 'article=' . $article_id) . '>"'; + $return_message = $lang['kb_edited'] . '<br /><br />' . sprintf($lang['kb_click_view_article'], '<a href="' . append_sid('kb.' . $phpEx . '?cat_id=' . $cat . '&article=' . wiki_article_title($article_title)) . '">', '</a>') . '<br /><br />' . sprintf($lang['kb_click_return_ucp'], '<a href="' . append_sid('kb.' . $phpEx . '?ucp=main') . '">', '</a>'); + } + + $template->assign_vars(array( + 'META' => $meta) + ); + + message_die(GENERAL_MESSAGE, $return_message); + } + } + + if($mode == "post" && !$preview && $error_msg == '') + { + $article_title = ''; + $article_text = ''; + $article_desc = ''; + $authorname = $userdata['username']; + $form_action = append_sid('kb.' . $phpEx . '?ucp=post_article'); + $hidden_form_fields = ""; + $attach_sig = ( $userdata['user_id'] == ANONYMOUS ) ? 0 : $userdata['user_attachsig']; + + if ( !$board_config['allow_html'] ) + { + $html_on = 0; + } + else + { + $html_on = ( ( $userdata['user_id'] == ANONYMOUS ) ? $board_config['allow_html'] : $userdata['user_allowhtml'] ); + } + + if ( !$board_config['allow_bbcode'] ) + { + $bbcode_on = 0; + } + else + { + $bbcode_on = ( ( $userdata['user_id'] == ANONYMOUS ) ? $board_config['allow_bbcode'] : $userdata['user_allowbbcode'] ); + } + + if ( !$board_config['allow_smilies'] ) + { + $smilies_on = 0; + } + else + { + $smilies_on = ( ( $userdata['user_id'] == ANONYMOUS ) ? $board_config['allow_smilies'] : $userdata['user_allowsmile'] ); + } + } + elseif($preview || $error_msg != '') + { + $article_id = $HTTP_POST_VARS['id']; + $article_title = $HTTP_POST_VARS['title']; + $article_text = $HTTP_POST_VARS['message']; + $article_desc = $HTTP_POST_VARS['desc']; + $article_cats = $HTTP_POST_VARS['cats']; + $authorname = $HTTP_POST_VARS['authorname']; + + $attach_sig = ( $HTTP_POST_VARS['enable_sig'] ) ? TRUE : 0; + + $html_on = ( $HTTP_POST_VARS['disable_html'] ) ? false : true; + $bbcode_on = ( $HTTP_POST_VARS['disable_bbcode'] ) ? false : true; + $smilies_on = ( $HTTP_POST_VARS['disable_smilies'] ) ? false : true; + + if($mode == 'edit') + { + $form_action = append_sid("kb.php?ucp=edit_article"); + $hidden_form_fields = '<input type="hidden" name="id" value="' . $article_id . '" />'; + } + else + { + $hidden_form_fields = ""; + $form_action = append_sid("kb.php?ucp=post_article"); + } + + if($error_msg != "") + { + $template->set_filenames(array( + 'reg_header' => 'error_body.tpl') + ); + $template->assign_vars(array( + 'ERROR_MESSAGE' => $error_msg) + ); + $template->assign_var_from_handle('ERROR_BOX', 'reg_header'); + } + + if($preview) + { + // Create the preview box + $preview_article_desc = ( !empty($HTTP_POST_VARS['desc']) ) ? trim($HTTP_POST_VARS['desc']) : ''; + $preview_article_title = ( !empty($HTTP_POST_VARS['title']) ) ? trim($HTTP_POST_VARS['title']) : ''; + $preview_message = ( !empty($HTTP_POST_VARS['message']) ) ? $HTTP_POST_VARS['message'] : ''; + $bbcode_uid = ( $bbcode_on ) ? make_bbcode_uid() : ''; + + $preview_message = stripslashes(prepare_article_text(addslashes(unprepare_article_text(trim($preview_message))), $html_on, $bbcode_on, $smilies_on, $bbcode_uid)); + + // A lot of copy/paste from viewtopic.php, then shaped for this file ofc :) + // + // If the board has HTML off but the post has HTML + // on then we process it, else leave it alone + // + if ( !$html_on ) + { + $preview_message = preg_replace('#(<)([\/]?.*?)(>)#is', "<\\2>", $preview_message); + } + + // + // Parse message and/or sig for BBCode if reqd + // + if ($bbcode_uid != '') + { + $preview_message = ($bbcode_on) ? bbencode_second_pass($preview_message, $bbcode_uid) : preg_replace("/\:$bbcode_uid/si", '', $preview_message); + } + + $preview_message = make_clickable($preview_message); + + // + // Parse smilies + // + if ( $smilies_on ) + { + $preview_message = smilies_pass($preview_message); + } + + // + // Replace naughty words + // + $orig_word = array(); + $replacement_word = array(); + obtain_word_list($orig_word, $replacement_word); + if (count($orig_word)) + { + $preview_article_title = preg_replace($orig_word, $replacement_word, $preview_article_title); + $preview_article_desc = preg_replace($orig_word, $replacement_word, $preview_article_desc); + $preview_message = str_replace('\"', '"', substr(@preg_replace('#(\>(((?>([^><]+|(?R)))*)\<))#se', "@preg_replace(\$orig_word, \$replacement_word, '\\0')", '>' . $preview_message . '<'), 1, -1)); + } + + $preview_message = str_replace("\n", "\n<br />\n", $preview_message); + + + $template->set_filenames(array( + 'preview_box' => 'kb_previewarticle.tpl') + ); + + $template->assign_vars(array( + 'L_ARTICLE_NAME' => $lang['kb_articlename'], + 'L_ARTICLE_DESC' => $lang['kb_articledesc'], + 'L_PREVIEW' => $lang['kb_articlepreview'], + 'PREVIEW_ARTICLE_TITLE' => $preview_article_title, + 'PREVIEW_ARTICLE_DESC' => $preview_article_desc, + 'MESSAGE' => $preview_message) + ); + + $template->assign_var_from_handle('ARTICLE_PREVIEW_BOX', 'preview_box'); + } + } + else + { + if(empty($id)) + { + message_die(GENERAL_ERROR, "No article defined."); + } + + $sql = "SELECT * + FROM " . KB_ARTICLES_TABLE . " + WHERE article_id = '$id'"; + if(!$result = $db->sql_query($sql)) + { + message_die(GENERAL_ERROR, 'Could not query article data.', '', __LINE__, __FILE__, $sql); + } + + if($db->sql_numrows($result) == 1) + { + $article = $db->sql_fetchrow($result); + } + else + { + message_die(GENERAL_ERROR, "Article does not exist."); + } + + // Now make an array over the cats + $sql = "SELECT cat_id + FROM " . KB_ARTICLECATS_TABLE . " + WHERE article_id = '$id'"; + if(!$result = $db->sql_query($sql)) + { + message_die(GENERAL_ERROR, 'Could not query articlecats data.', '', __LINE__, __FILE__, $sql); + } + + $article_cats = array(); + while($row = $db->sql_fetchrow($result)) + { + $article_cats[] = $row; + } + + $article_title = $article['article_title']; + $article_text = $article['article_text']; + $article_desc = $article['article_desc']; + $authorname = $article['article_authorname']; + + $attach_sig = ( $article['enable_sig'] ) ? TRUE : 0; + + $html_on = ( $article['enable_html'] ) ? true : false; + $bbcode_on = ( $article['enable_bbcode'] ) ? true : false; + $smilies_on = ( $article['enable_smilies'] ) ? true : false; + + $form_action = append_sid("kb.php?ucp=edit_article"); + $hidden_form_fields = '<input type="hidden" name="id" value="' . $id . '" />'; + } + + if ( $article['bbcode_uid'] != '' ) + { + $article_text = preg_replace('/\:(([a-z0-9]:)?)' . $article['bbcode_uid'] . '/s', '', $article_text); + } + + $article_text = str_replace('<', '<', $article_text); + $article_text = str_replace('>', '>', $article_text); + $article_text = str_replace('<br />', "\n", $article_text); + + // + // Signature toggle selection + // + if( $user_sig != '' ) + { + $template->assign_block_vars('switch_signature_checkbox', array()); + } + + // + // HTML toggle selection + // + if ( $board_config['allow_html'] ) + { + $html_status = $lang['HTML_is_ON']; + $template->assign_block_vars('switch_html_checkbox', array()); + } + else + { + $html_status = $lang['HTML_is_OFF']; + } + + // + // BBCode toggle selection + // + if ( $board_config['allow_bbcode'] ) + { + $bbcode_status = $lang['BBCode_is_ON']; + $template->assign_block_vars('switch_bbcode_checkbox', array()); + } + else + { + $bbcode_status = $lang['BBCode_is_OFF']; + } + + // Obtain categories structure + $cats = get_cats_structure(); + + // First lets sort main cats, yes i know there is a lot of loops, but i can't find a better way :S + $s_cats = '<option value="0">-' . $lang['kb_main'] . '</option>'; + if($mode == "edit" || $preview) + { + for($i = 0; $i < count($cats); $i++) + { + $selected = ''; + for($k = 0; $k < count($article_cats); $k++) + { + if($article_cats[$k]['cat_id'] == $cats[$i]['cat_id']) + { + $selected = ' selected="selected"'; + } + } + $s_cats .= '<option' . $selected . ' value="' . $cats[$i]['cat_id'] . '"> --' . $cats[$i]['cat_title'] . '</option>'; + + // Sort subcats + for($j = 0; $j < count($cats[$i]['subcats']); $j++) + { + $selected = ''; + for($k = 0; $k < count($article_cats); $k++) + { + if($article_cats[$k]['cat_id'] == $cats[$i]['subcats'][$j]['cat_id']) + { + $selected = ' selected="selected"'; + } + } + $s_cats .= '<option' . $selected . ' value="' . $cats[$i]['subcats'][$j]['cat_id'] . '"> --' . $cats[$i]['subcats'][$j]['cat_title'] . '</option>'; + } + } + } + else + { + for($i = 0; $i < count($cats); $i++) + { + $s_cats .= '<option value="' . $cats[$i]['cat_id'] . '">--' . $cats[$i]['cat_title'] . '</option>'; + + // Sort subcats + for($j = 0; $j < count($cats[$i]['subcats']); $j++) + { + $s_cats .= '<option value="' . $cats[$i]['subcats'][$j]['cat_id'] . '">--' . $cats[$i]['subcats'][$j]['cat_title'] . '</option>'; + } + } + } + + // + // Smilies toggle selection + // + if ( $board_config['allow_smilies'] ) + { + $smilies_status = $lang['Smilies_are_ON']; + $template->assign_block_vars('switch_smilies_checkbox', array()); + } + else + { + $smilies_status = $lang['Smilies_are_OFF']; + } + + $template->set_filenames(array( + 'body' => 'kb_article_posting.tpl') + ); + + create_navigation("ucp", $action); + $post_article = ($mode == 'edit') ? $lang['kb_edit_article'] : $lang['kb_post_article']; + + // This is the template stuff we need no matter what + $template->assign_vars(array( + 'AUTHORNAME' => $authorname, + 'ARTICLE_TITLE' => $article_title, + 'ARTICLE' => $article_text, + 'DESC' => $article_desc, + 'HTML_STATUS' => $html_status, + 'BBCODE_STATUS' => sprintf($bbcode_status, '<a href="' . append_sid("faq." . $phpEx . "?mode=bbcode") . '" target="_phpbbcode">', '</a>'), + 'SMILIES_STATUS' => $smilies_status, + + 'L_POST_ARTICLE' => $post_article, + 'L_AUTHORNAME' => $lang['kb_authorname'], + 'L_ARTICLE_NAME' => $lang['kb_articlename'], + 'L_ARTICLE_DESC' => $lang['kb_articledesc'], + 'L_ARTICLE_CATS' => $lang['kb_articlecats'], + 'L_ARTICLE_BODY' => $lang['kb_articletext'], + 'L_AUTHORNAME_DESC' => $lang['kb_authorname_desc'], + 'L_ARTICLEDESC_DESC' => $lang['kb_articledesc_desc'], // Funny one eh? + 'L_ARTICLECATS_DESC' => $lang['kb_articlecats_desc'], + + 'L_OPTIONS' => $lang['Options'], + 'L_PREVIEW' => $lang['Preview'], + 'L_SUBMIT' => $lang['Submit'], + 'L_DISABLE_HTML' => $lang['Disable_HTML_post'], + 'L_DISABLE_BBCODE' => $lang['Disable_BBCode_post'], + 'L_DISABLE_SMILIES' => $lang['Disable_Smilies_post'], + 'L_ATTACH_SIGNATURE' => $lang['Attach_signature'], + + 'L_BBCODE_B_HELP' => $lang['bbcode_b_help'], + 'L_BBCODE_I_HELP' => $lang['bbcode_i_help'], + 'L_BBCODE_U_HELP' => $lang['bbcode_u_help'], + 'L_BBCODE_Q_HELP' => $lang['bbcode_q_help'], + 'L_BBCODE_C_HELP' => $lang['bbcode_c_help'], + 'L_BBCODE_L_HELP' => $lang['bbcode_l_help'], + 'L_BBCODE_O_HELP' => $lang['bbcode_o_help'], + 'L_BBCODE_P_HELP' => $lang['bbcode_p_help'], + 'L_BBCODE_W_HELP' => $lang['bbcode_w_help'], + 'L_BBCODE_A_HELP' => $lang['bbcode_a_help'], + 'L_BBCODE_S_HELP' => $lang['bbcode_s_help'], + 'L_BBCODE_F_HELP' => $lang['bbcode_f_help'], + 'L_EMPTY_MESSAGE' => $lang['Empty_message'], + + 'L_FONT_COLOR' => $lang['Font_color'], + 'L_COLOR_DEFAULT' => $lang['color_default'], + 'L_COLOR_DARK_RED' => $lang['color_dark_red'], + 'L_COLOR_RED' => $lang['color_red'], + 'L_COLOR_ORANGE' => $lang['color_orange'], + 'L_COLOR_BROWN' => $lang['color_brown'], + 'L_COLOR_YELLOW' => $lang['color_yellow'], + 'L_COLOR_GREEN' => $lang['color_green'], + 'L_COLOR_OLIVE' => $lang['color_olive'], + 'L_COLOR_CYAN' => $lang['color_cyan'], + 'L_COLOR_BLUE' => $lang['color_blue'], + 'L_COLOR_DARK_BLUE' => $lang['color_dark_blue'], + 'L_COLOR_INDIGO' => $lang['color_indigo'], + 'L_COLOR_VIOLET' => $lang['color_violet'], + 'L_COLOR_WHITE' => $lang['color_white'], + 'L_COLOR_BLACK' => $lang['color_black'], + + 'L_FONT_SIZE' => $lang['Font_size'], + 'L_FONT_TINY' => $lang['font_tiny'], + 'L_FONT_SMALL' => $lang['font_small'], + 'L_FONT_NORMAL' => $lang['font_normal'], + 'L_FONT_LARGE' => $lang['font_large'], + 'L_FONT_HUGE' => $lang['font_huge'], + + 'L_BBCODE_CLOSE_TAGS' => $lang['Close_Tags'], + 'L_STYLES_TIP' => $lang['Styles_tip'], + + 'S_HTML_CHECKED' => ( !$html_on ) ? 'checked="checked"' : '', + 'S_BBCODE_CHECKED' => ( !$bbcode_on ) ? 'checked="checked"' : '', + 'S_SMILIES_CHECKED' => ( !$smilies_on ) ? 'checked="checked"' : '', + 'S_SIGNATURE_CHECKED' => ( $attach_sig ) ? 'checked="checked"' : '', + 'S_POST_ACTION' => $form_action, + 'CATS_HTML' => $s_cats, + 'S_HIDDEN_FORM_FIELDS' => $hidden_form_fields) + ); +} + +// Delete an article +function ucp_article_delete($id, $confirm) +{ + global $lang, $db, $phpEx, $template, $HTTP_POST_VARS; + + // Simple auth for alpha 1 + if(($userdata['user_level'] != ADMIN) && ($userdata['user_id'] != $article['article_author'])) + { + message_die(GENERAL_MESSAGE, $lang['kb_delete_noauth']); + } + + $cancel = isset($HTTP_POST_VARS['cancel']) ? true : false; + + if($cancel) + { + $meta = '<meta http-equiv="refresh" content="0;url=' . append_sid('kb.' . $phpEx) . '>"'; + + $template->assign_vars(array( + 'META' => $meta) + ); + + message_die(GENERAL_MESSAGE, ''); + } + elseif(!$confirm) + { + $s_hidden_fields = '<input type="hidden" name="article_id" value="' . $id . '" />'; + $l_confirm = $lang['kb_confirm_deletearticle']; + + // + // Output confirmation page + // + $template->set_filenames(array( + 'confirm_body' => 'confirm_body.tpl') + ); + + $template->assign_vars(array( + 'MESSAGE_TITLE' => $lang['Information'], + 'MESSAGE_TEXT' => $l_confirm, + + 'L_YES' => $lang['Yes'], + 'L_NO' => $lang['No'], + + 'S_CONFIRM_ACTION' => append_sid("kb." . $phpEx . "?ucp=delete_article"), + 'S_HIDDEN_FIELDS' => $s_hidden_fields) + ); + + $template->pparse('confirm_body'); + } + else + { + $article_id = $HTTP_POST_VARS['article_id']; + // Need lang vars for the error messages? + $sql = "DELETE FROM " . KB_ARTICLES_TABLE . " WHERE article_id = '" . $article_id . "'"; + if(!$db->sql_query($sql)) + { + message_die(GENERAL_ERROR, "Couldn't delete article from articles table.", "", __LINE__, __FILE__, $sql); + } + + // Obtain categories then delete + $sql = "SELECT c.cat_id, ca.cat_id + FROM " . KB_ARTICLECATS_TABLE . " c, " . KB_CATEGORIES_TABLE . " ca + WHERE c.article_id = '$id' + AND ca.cat_id = c.cat_id"; + if( !($result = $db->sql_query($sql)) ) + { + message_die(GENERAL_ERROR, 'Could not query article categories.', '', __LINE__, __FILE__, $sql); + } + + while($row = $db->sql_fetchrow($result)) + { + $sql = "UPDATE " . KB_CATEGORIES_TABLE . " SET cat_articles = cat_articles - 1 WHERE cat_id = '" . $row['cat_id'] . "'"; + + if( !($result = $db->sql_query($sql)) ) + { + message_die(GENERAL_ERROR, 'Could not decrease article count for cat with id ' . $row['cat_id'] . '.', '', __LINE__, __FILE__, $sql); + } + } + + $sql = "DELETE FROM " . KB_ARTICLECATS_TABLE . " WHERE article_id = '" . $article_id . "'"; + if(!$db->sql_query($sql)) + { + message_die(GENERAL_ERROR, "Couldn't delete article from articlecats table.", "", __LINE__, __FILE__, $sql); + } + + // Message + $return_message = $lang['kb_deleted'] . '<br /><br />' . sprintf($lang['kb_click_return_ucp'], '<a href="' . append_sid('kb.' . $phpEx . '?ucp=main') . '">', '</a>'); + + message_die(GENERAL_MESSAGE, $return_message); + } +} + +// +// Prepare an article for the database +// +function prepare_article(&$bbcode_on, &$html_on, &$smilies_on, &$error_msg, &$bbcode_uid, &$article_title, &$article_desc, &$message, &$cat_id) +{ + global $board_config, $userdata, $lang, $phpEx, $phpbb_root_path; + + // Check title + if (!empty($article_title)) + { + $article_title = htmlspecialchars(trim($article_title)); + } + else + { + $error_msg .= (!empty($error_msg)) ? '<br />' . $lang['kb_empty_article_title'] : $lang['kb_empty_article_title']; + } + + // Check message + if(!empty($message)) + { + $bbcode_uid = ($bbcode_on) ? make_bbcode_uid() : ''; + $message = prepare_article_text(trim($message), $html_on, $bbcode_on, $smilies_on, $bbcode_uid); + } + else + { + $error_msg .= (!empty($error_msg)) ? '<br />' . $lang['kb_empty_article'] : $lang['kb_empty_article']; + } + + // Check Desc + if (!empty($article_desc)) + { + $article_desc = htmlspecialchars(trim($article_desc)); + } + else + { + $error_msg .= (!empty($error_msg)) ? '<br />' . $lang['kb_empty_article_desc'] : $lang['kb_empty_article_desc']; + } + + // Check categories + if(!is_array($cat_id)) + { + $error_msg .= (!empty($error_msg)) ? '<br />' . $lang['kb_empty_cats'] : $lang['kb_empty_cats']; + } + return; +} + +function prepare_article_text($message, $html_on, $bbcode_on, $smile_on, $bbcode_uid = 0) +{ + global $board_config, $phpEx; + + // + // Clean up the message + // + $message = trim($message); + $html_entities_match = array('#&(?!(\#[0-9]+;))#', '#<#', '#>#', '#"#'); + $html_entities_replace = array('&', '<', '>', '"'); + + if ($html_on) + { + // If HTML is on, we try to make it safe + // This approach is quite agressive and anything that does not look like a valid tag + // is going to get converted to HTML entities + $message = stripslashes($message); + $html_match = '#<[^\w<]*(\w+)((?:"[^"]*"|\'[^\']*\'|[^<>\'"])+)?>#'; + $matches = array(); + + $message_split = preg_split($html_match, $message); + preg_match_all($html_match, $message, $matches); + + $message = ''; + + // Include functions_post for clean_html + include($phpbb_root_path . "includes/functions_post." . $phpEx); + + foreach ($message_split as $part) + { + $tag = array(array_shift($matches[0]), array_shift($matches[1]), array_shift($matches[2])); + $message .= preg_replace($html_entities_match, $html_entities_replace, $part) . clean_html($tag); + } + + $message = addslashes($message); + $message = str_replace('"', '\"', $message); + } + else + { + $message = preg_replace($html_entities_match, $html_entities_replace, $message); + } + + if($bbcode_on && $bbcode_uid != '') + { + $message = bbencode_first_pass($message, $bbcode_uid); + } + + return $message; +} + +function unprepare_article_text($message) +{ + $unhtml_specialchars_match = array('#>#', '#<#', '#"#', '#&#'); + $unhtml_specialchars_replace = array('>', '<', '"', '&'); + + return preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, $message); +} + +function wiki_article_title($article_title) +{ + $chars = array("&", """, "<", ">", "'", ":", ",", ".", ";", "!", "*", "^", "\xA8", "~", "|", "`", "\xB4", "?", "-", "_", "="); + $article_title = str_replace($chars, "", $article_title); + $article_title = str_replace(" ", "-", $article_title); + + return $article_title; +} + +function unwiki_article_title($article_title) +{ + // Very simple, just remove - and replace them with spaces. + $article_title = str_replace("-", " ", $article_title); + + return $article_title; +} +?> \ No newline at end of file Deleted: main/trunk/kb/auth.php =================================================================== --- main/trunk/kb/auth.php 2007-02-18 21:43:28 UTC (rev 55) +++ main/trunk/kb/auth.php 2007-02-19 15:43:31 UTC (rev 56) @@ -1,188 +0,0 @@ -<?php -/*************************************************************************** - * auth.php - * ------------------- - * - * copyright: phpBB KB Group - * site: http://www.phpbbknowledgebase.com - * SF Project Page: http://www.sourceforge.net/projects/phpbbkb - * - ***************************************************************************/ - -/*************************************************************************** - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - ***************************************************************************/ - -// This file holds the kb auth functions, very similar to the phpBB auth functions, but differs certain places :) -// As of now, the articles auth is handles out from which category it is selected through, therefore an article -// can have different kinds of auth, all depending on through which category it is viewed. This solution might seem -// stupid, but it is the best I can come up with, and I think admins will just take that into consideration when creating -// category permissions. - -// -// This function returns info on whether the user is allowed to do the supplied argument(s) all dependant on the given category id -// -function kb_auth($type, $cat_id, $userdata) -{ - switch($type) - { - case "view": - $sql = "a.auth_view"; - $auth_fields = array('auth_view'); - break; - - case "add": - $sql = "a.auth_add"; - $auth_fields = array('auth_add'); - break; - - case "edit": - $sql = "a.auth_edit"; - $auth_fields = array('auth_edit'); - break; - - case "delete": - $sql = "a.auth_delete"; - $auth_fields = array('auth_delete'); - break; - - case "mod": - $sql = "a.auth_mod"; - $auth_fields = array('auth_mod'); - break; - - case "comment": - $sql = "a.auth_comment"; - $auth_fields = array('auth_comment'); - break; - - case "rate": - $sql = "a.auth_rate"; - $auth_fields = array('auth_rate'); - break; - - case "attach": - $sql = "a.auth_attach"; - $auth_fields = array('auth_attach'); - break; - - // Returns array containing everything above - case "all": - $sql = "a.auth_view, a.auth_add, a.auth_edit, a.auth_delete, a.auth_mod, a.auth_comment, a.auth_rate, a.auth_attach"; - $auth_fields = array('auth_view', 'auth_add', 'auth_edit', 'auth_delete', 'auth_mod', 'auth_comment', 'auth_rate', 'auth_attach'); - break; - - // Returns array containing article related auth - case "article": - $sql = "a.auth_view, a.auth_edit, a.auth_delete, a.auth_mod, a.auth_comment, a.auth_rate"; - $auth_fields = array('auth_view', 'auth_edit', 'auth_delete', 'auth_mod', 'auth_comment', 'auth_rate'); - break; - - // Returns array containing category related auth - case "cat": - $sql = "a.auth_view, a.auth_add, a.auth_attach"; - $auth_fields = array('auth_view', 'auth_add', 'auth_attach'); - break; - } - - $sql = "SELECT a.cat_id, $sql - FROM " . KB_CATEGORIES_TABLE . " a - WHERE a.cat_id = '" . $cat_id . "'"; - - if(!$result = $db->sql_query($sql)) - { - message_die(GENERAL_MESSAGE, 'Could not retrieve categorys auth info.', '', __LINE__, __FILE__, $sql); - } - - $f_access = $db->sql_fetchrow($result); - - // - // If user is logged in we need to see if he is in any usergroups that changes his auth info, else just return it - // - if($userdata['session_logged_in']) - { - // Check if the user is present in a group that changes his permissions - $sql = "SELECT a.cat_id, $sql, a.auth_mod - FROM " . KB_AUTH_ACCESS_TABLE . " a, " . USER_GROUP_TABLE . " ug - WHERE ug.user_id = ".$userdata['user_id']. " - AND ug.user_pending = 0 - AND a.group_id = ug.group_id - AND a.cat_id = '" . $cat_id . "'"; - if ( !($result = $db->sql_query($sql)) ) - { - message_die(GENERAL_ERROR, 'Failed obtaining category access control lists', '', __LINE__, __FILE__, $sql); - } - - if ( $row = $db->sql_fetchrow($result) ) - { - do - { - $u_access[] = $row; - } - while( $row = $db->sql_fetchrow($result) ); - } - $db->sql_freeresult($result); - } - - $is_admin = ( $userdata['user_level'] == ADMIN && $userdata['session_logged_in'] ) ? TRUE : 0; - - $auth = array(); - for($i = 0; $i < count($auth_fields); $i++) - { - $key = $auth_fields[$i]; - - // - // If the user is logged on and the forum type is either ALL or REG then the user has access - // - // If the type if ACL, MOD or ADMIN then we need to see if the user has specific permissions - // to do whatever it is they want to do ... to do this we pull relevant information for the - // user (and any groups they belong to) - // - // Now we compare the users access level against the forums. We assume here that a moderator - // and admin automatically have access to an ACL forum, similarly we assume admins meet an - // auth requirement of MOD - // - $value = $f_access[$key]; - - switch( $value ) - { - case AUTH_ALL: - $auth[$key] = TRUE; - $auth[$key . '_type'] = $lang['Auth_Anonymous_Users']; - break; - - case AUTH_REG: - $auth_user[$key] = ( $userdata['session_logged_in'] ) ? TRUE : 0; - $auth_user[$key . '_type'] = $lang['Auth_Registered_Users']; - break; - - case AUTH_ACL: - $auth[$key] = ( $userdata['session_logged_in'] ) ? auth_check_user(AUTH_ACL, $key, $u_access, $is_admin) : 0; - $auth[$key . '_type'] = $lang['Auth_Users_granted_access']; - break; - - case AUTH_MOD: - $auth[$key] = ( $userdata['session_logged_in'] ) ? auth_check_user(AUTH_MOD, 'auth_mod', $u_access, $is_admin) : 0; - $auth[$key . '_type'] = $lang['Auth_Moderators']; - break; - - case AUTH_ADMIN: - $auth[$key] = $is_admin; - $auth[$key . '_type'] = $lang['Auth_Administrators']; - break; - - default: - $auth[$key] = 0; - break; - } - } - - return $auth; -} - -?> Deleted: main/trunk/kb/constants.php =================================================================== --- main/trunk/kb/constants.php 2007-02-18 21:43:28 UTC (rev 55) +++ main/trunk/kb/constants.php 2007-02-19 15:43:31 UTC (rev 56) @@ -1,40 +0,0 @@ -<?php -/*************************************************************************** - * constants.php - * ------------------- - * - * copyright: phpBB KB Group - * site: http://www.phpbbknowledgebase.com - * SF Project Page: http://www.sourceforge.net/projects/phpbbkb - * - *******************************************************************... [truncated message content] |
From: <so...@us...> - 2007-02-18 21:43:36
|
Revision: 55 http://svn.sourceforge.net/phpbbkb/?rev=55&view=rev Author: softphp Date: 2007-02-18 13:43:28 -0800 (Sun, 18 Feb 2007) Log Message: ----------- Fixed bugs #7, #1, #11, #10. Modified Paths: -------------- main/trunk/admin/admin_kb.php main/trunk/kb/functions.php main/trunk/kb.php Modified: main/trunk/admin/admin_kb.php =================================================================== --- main/trunk/admin/admin_kb.php 2007-02-15 04:18:49 UTC (rev 54) +++ main/trunk/admin/admin_kb.php 2007-02-18 21:43:28 UTC (rev 55) @@ -75,7 +75,7 @@ 'body' => 'admin/kb_editcat.tpl') ); - $parent = generate_cat_parents($cat['cat_main']); + $parent = generate_cat_parents($cat['cat_main'], $edit); $s_hidden_fields = "<input type=\"hidden\" name=\"oldparent\" value=\"" . $cat['cat_main'] . "\">"; $template->assign_vars(array( @@ -129,7 +129,7 @@ 'body' => 'admin/kb_editcat.tpl') ); - $parent = generate_cat_parents($cat['cat_main']); + $parent = generate_cat_parents($cat['cat_main'], $edit); $s_hidden_fields = "<input type=\"hidden\" name=\"oldparent\" value=\"" . $cat['cat_main'] . "\">"; $template->set_filenames(array( @@ -525,7 +525,7 @@ ////////////////// /// FUNCTIONS /// ////////////////// -function generate_cat_parents($selected = false) +function generate_cat_parents($selected = false, $current = false) { global $db, $lang; @@ -555,19 +555,22 @@ for($i = 0; $i < count($cats); $i++) { - if(!$selected) + if(($current && $current != $cats[$i]['cat_id']) || (!$current)) { - $parent .= '<option value="' . $cats[$i]['cat_id'] . '">' . $cats[$i]['cat_title'] . '</option>\n'; - } - else - { - if($cats[$i]['cat_id'] == $selected) + if(!$selected) { - $parent .= '<option value="' . $cats[$i]['cat_id'] . '" selected="selected">' . $cats[$i]['cat_title'] . '</option>\n'; + $parent .= '<option value="' . $cats[$i]['cat_id'] . '">' . $cats[$i]['cat_title'] . '</option>\n'; } else { - $parent .= '<option value="' . $cats[$i]['cat_id'] . '">' . $cats[$i]['cat_title'] . '</option>\n'; + if($cats[$i]['cat_id'] == $selected) + { + $parent .= '<option value="' . $cats[$i]['cat_id'] . '" selected="selected">' . $cats[$i]['cat_title'] . '</option>\n'; + } + else + { + $parent .= '<option value="' . $cats[$i]['cat_id'] . '">' . $cats[$i]['cat_title'] . '</option>\n'; + } } } } Modified: main/trunk/kb/functions.php =================================================================== --- main/trunk/kb/functions.php 2007-02-15 04:18:49 UTC (rev 54) +++ main/trunk/kb/functions.php 2007-02-18 21:43:28 UTC (rev 55) @@ -300,7 +300,7 @@ $message = ( !empty($HTTP_POST_VARS['message']) ) ? $HTTP_POST_VARS['message'] : ''; $article_author = ($mode == 'edit') ? $article['article_author'] : $userdata['user_id']; $article_authorname = ( $mode == 'edit' ) ? ( ( empty($HTTP_POST_VARS['authorname']) ) ? $article['article_authorname'] : $HTTP_POST_VARS['authorname'] ) : ( ( empty($HTTP_POST_VARS['authorname']) ) ? $userdata['username'] : $HTTP_POST_VARS['authorname'] ); - $bbcode_uid = ''; + $bbcode_uid = ($mode == 'edit' ) ? $article['bbcode_uid'] : ''; $cat_id = $HTTP_POST_VARS['cats']; $attach_sig = ( !empty($HTTP_POST_VARS['attach_sig']) ) ? 1 : 0; @@ -358,6 +358,7 @@ article_edittime = '$current_time', article_editby = '" . $userdata['user_id'] . "', article_status = '$article_status', + bbcode_uid = '$bbcode_uid', enable_sig = '$attach_sig', enable_html = '$html_on', enable_bbcode = '$bbcode_on', @@ -799,7 +800,7 @@ // Delete an article function ucp_article_delete($id, $confirm) { - global $lang, $db, $phpEx, $template; + global $lang, $db, $phpEx, $template, $HTTP_POST_VARS; // Simple auth for alpha 1 if(($userdata['user_level'] != ADMIN) && ($userdata['user_id'] != $article['article_author'])) @@ -826,16 +827,16 @@ 'L_YES' => $lang['Yes'], 'L_NO' => $lang['No'], - 'S_CONFIRM_ACTION' => append_sid("kb." . $phpEx . "?mode=ucp&action=delete_article"), + 'S_CONFIRM_ACTION' => append_sid("kb." . $phpEx . "?pid=ucp&action=delete_article"), 'S_HIDDEN_FIELDS' => $s_hidden_fields) ); $template->pparse('confirm_body'); } - elseif($confirm) // Double check they actually confirmed + else { $article_id = $HTTP_POST_VARS['article_id']; - + echo $article_id; // Need lang vars for the error messages? $sql = "DELETE FROM " . KB_ARTICLES_TABLE . " WHERE article_id = '" . $article_id . "'"; if(!$db->sql_query($sql)) @@ -850,13 +851,8 @@ } // Message - $meta = '<meta http-equiv="refresh" content="3;url=' . append_sid('kb.' . $phpEx . '?pid=view_article&cid=' . $cat . '&id=' . $article_id) . '>"'; - $return_message = $lang['kb_deleted'] . '<br /><br />' . sprintf($lang['kb_click_view_article'], '<a href="' . append_sid('kb.' . $phpEx . '?pid=view_article&cid=' . $cat . '&id=' . $article_id) . '">', '</a>') . '<br /><br />' . sprintf($lang['kb_click_return_ucp'], '<a href="' . append_sid('kb.' . $phpEx . '?pid=ucp') . '">', '</a>'); - - $template->assign_vars(array( - 'META' => $meta) - ); - + $return_message = $lang['kb_deleted'] . '<br /><br />' . sprintf($lang['kb_click_return_ucp'], '<a href="' . append_sid('kb.' . $phpEx . '?pid=ucp') . '">', '</a>'); + message_die(GENERAL_MESSAGE, $return_message); } } Modified: main/trunk/kb.php =================================================================== --- main/trunk/kb.php 2007-02-15 04:18:49 UTC (rev 54) +++ main/trunk/kb.php 2007-02-18 21:43:28 UTC (rev 55) @@ -281,6 +281,7 @@ 'L_SUBCATS' => sprintf($lang['kb_viewcat_subcats'], $cat['cat_title']), 'L_LAST_ACTION' => $lang['kb_last_action'], 'L_ADD_ARTICLE' => $lang['kb_ucp_articlepost'], + 'ADD_ARTICLE_IMG' => $images['kb_new_article'], 'U_ADD_ARTICLE' => append_sid("kb.$phpEx?pid=ucp&action=post_article")) ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2007-02-15 04:18:48
|
Revision: 54 http://svn.sourceforge.net/phpbbkb/?rev=54&view=rev Author: markthedaemon Date: 2007-02-14 20:18:49 -0800 (Wed, 14 Feb 2007) Log Message: ----------- Code clean-up == @_@ Modified Paths: -------------- main/trunk/kb.php Modified: main/trunk/kb.php =================================================================== --- main/trunk/kb.php 2007-02-15 01:04:18 UTC (rev 53) +++ main/trunk/kb.php 2007-02-15 04:18:49 UTC (rev 54) @@ -83,7 +83,7 @@ 'L_CATEGORIES' => $lang['kb_categories'], 'L_ARTICLES' => $lang['kb_articles'], 'ADD_ARTICLE_IMG' => $images['kb_new_article'], - 'U_ADD_ARTICLE' => append_sid("kb." . $phpEx . "?pid=ucp&action=post_article")) + 'U_ADD_ARTICLE' => append_sid("kb.$phpEx?pid=ucp&action=post_article")) ); if($total_catrows = count($catrows)) @@ -100,9 +100,9 @@ 'CAT_TITLE' => $catrows[$i]['cat_title'], 'CAT_DESC' => $catrows[$i]['cat_desc'], 'CAT_ARTICLES' => $catrows[$i]['cat_articles'], - 'U_VIEWCAT' => append_sid("kb." . $phpEx . "?pid=view_cat&id=" . $catrows[$i]['cat_id']), + 'U_VIEWCAT' => append_sid("kb.$phpEx?pid=view_cat&id=" . $catrows[$i]['cat_id']), 'L_SUBCATS' => $lang['kb_subcats'], - 'FORUM_FOLDER_IMG' => $images['forum']) // Stolen :D + 'FORUM_FOLDER_IMG' => $images['forum']) ); // Now let's look at subcats @@ -137,7 +137,7 @@ $k = $j + 1; $subcat_comma = ( isset($subcats[$k]) ) ? ", " : "."; $template->assign_block_vars('catrow.subcatrow', array( - 'U_SUBCAT' => append_sid("kb." . $phpEx . "?pid=view_cat&id=" . $subcats[$j]['cat_id']), + 'U_SUBCAT' => append_sid("kb.$phpEx?pid=view_cat&id=" . $subcats[$j]['cat_id']), 'SUBCAT_TITLE' => $subcats[$j]['cat_title'], 'SUBCAT_COMMA' => $subcat_comma) ); @@ -281,7 +281,7 @@ 'L_SUBCATS' => sprintf($lang['kb_viewcat_subcats'], $cat['cat_title']), '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")) + 'U_ADD_ARTICLE' => append_sid("kb.$phpEx?pid=ucp&action=post_article")) ); if( $total_subcats = count($subcats) ) @@ -296,8 +296,8 @@ 'CAT_TITLE' => $subcats[$i]['cat_title'], 'CAT_DESC' => $subcats[$i]['cat_desc'], 'CAT_ARTICLES' => $subcats[$i]['cat_articles'], - 'U_VIEWCAT' => append_sid("kb." . $phpEx . "?pid=view_cat&id=" . $subcats[$i]['cat_id']), - 'FORUM_FOLDER_IMG' => $images['forum']) // Stolen :D + 'U_VIEWCAT' => append_sid("kb.$phpEx?pid=view_cat&id=" . $subcats[$i]['cat_id']), + 'FORUM_FOLDER_IMG' => $images['forum']) ); } } @@ -346,7 +346,7 @@ 'ARTICLE_AUTHOR' => $author, 'ARTICLE_HITS' => $articles[$i]['article_hits'], 'ARTICLE_LAST_ACTION' => $last_action, - 'U_VIEW_ARTICLE' => append_sid("kb." . $phpEx . "?pid=view_article&cid=" . $cat_id . "&id=" . $articles[$i]['article_id'])) + 'U_VIEW_ARTICLE' => append_sid("kb.$phpEx?pid=view_article&cid=" . $cat_id . "&id=" . $articles[$i]['article_id'])) ); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2007-02-15 01:04:17
|
Revision: 53 http://svn.sourceforge.net/phpbbkb/?rev=53&view=rev Author: markthedaemon Date: 2007-02-14 17:04:18 -0800 (Wed, 14 Feb 2007) Log Message: ----------- A fix for bug #2. Don't really like how its implemented but meh :P. Probably need a better solution by the time we get to the betas. Modified Paths: -------------- main/trunk/kb/functions.php main/trunk/language/lang_english/lang_kb.php Modified: main/trunk/kb/functions.php =================================================================== --- main/trunk/kb/functions.php 2007-02-15 00:48:38 UTC (rev 52) +++ main/trunk/kb/functions.php 2007-02-15 01:04:18 UTC (rev 53) @@ -71,7 +71,7 @@ // Viewing an article if($id_ary[2] == 0) { - $navigation = '<span class="nav"> <a href="' . append_sid('kb.' . $phpEx) . '" class="nav">' . $lang['kb_main'] . '</a> -> <a class="nav" href="' . append_sid('kb.' . $phpEx.'?pid=view_cat&id=' . $id_ary[0]) . '">' . $id_ary[1] .'</a> -> <a class="nav" href="' . append_sid('kb.' . $phpEx.'?pid=view_article&id=' . $id_ary[3]) . '&cid=' . $id_ary[0] . '">' . $id_ary[4] .'</a></span>'; + $navigation = '<span class="nav"> <a href="' . append_sid('kb.' . $phpEx) . '" class="nav">' . $lang['kb_main'] . '</a> -> <a class="nav" href="' . append_sid('kb.' . $phpEx.'?pid=view_cat&id=' . $id_ary[0]) . '">' . $id_ary[1] .'</a> -> <a class="nav" href="' . append_sid('kb.' . $phpEx.'?pid=view_article&cid=' . $cat . '&id=' . $id_ary[3]) . '&cid=' . $id_ary[0] . '">' . $id_ary[4] .'</a></span>'; } else { @@ -84,7 +84,7 @@ } $maincat = $db->sql_fetchrow($result); - $navigation = '<span class="nav"> <a href="' . append_sid('kb.' . $phpEx) . '" class="nav">' . $lang['kb_main'] . '</a> -> <a class="nav" href="' . append_sid('kb.' . $phpEx.'?pid=view_cat&id=' . $id_ary[2]) . '">' . $maincat['cat_title'] .'</a> -> <a class="nav" href="' . append_sid('kb.' . $phpEx.'?pid=view_cat&id=' . $id_ary[0]) . '">' . $id_ary[1] .'</a> -> <a class="nav" href="' . append_sid('kb.' . $phpEx.'?pid=view_article&id=' . $id_ary[3]) . '&cid=' . $id_ary[0] . '">' . $id_ary[4] .'</a></span>'; + $navigation = '<span class="nav"> <a href="' . append_sid('kb.' . $phpEx) . '" class="nav">' . $lang['kb_main'] . '</a> -> <a class="nav" href="' . append_sid('kb.' . $phpEx.'?pid=view_cat&id=' . $id_ary[2]) . '">' . $maincat['cat_title'] .'</a> -> <a class="nav" href="' . append_sid('kb.' . $phpEx.'?pid=view_cat&id=' . $id_ary[0]) . '">' . $id_ary[1] .'</a> -> <a class="nav" href="' . append_sid('kb.' . $phpEx.'?pid=view_article&cid=' . $cat . '&id=' . $id_ary[3]) . '&cid=' . $id_ary[0] . '">' . $id_ary[4] .'</a></span>'; } break; @@ -337,8 +337,9 @@ } } - $meta = '<meta http-equiv="refresh" content="3;url=' . append_sid('kb.' . $phpEx . '?pid=view_article&id=' . $article_id) . '>"'; - $return_message = $lang['kb_added'] . '<br /><br />' . sprintf($lang['kb_click_view_article'], '<a href="' . append_sid('kb.' . $phpEx . '?pid=view_article&id=' . $article_id) . '">', '</a>') . '<br /><br />' . sprintf($lang['kb_click_return_ucp'], '<a href="' . append_sid('kb.' . $phpEx . '?pid=ucp') . '">', '</a>'); + $meta = '<meta http-equiv="refresh" content="3;url=' . append_sid('kb.' . $phpEx . '?pid=view_article&cid=' . $cat . '&cid=' . $cat . '&id=' . $article_id) . '>"'; + $return_message = $lang['kb_added'] . '<br /><br />' . sprintf($lang['kb_click_view_article'], '<a href="' . append_sid('kb.' . $phpEx . '?pid=view_article&cid=' . $cat . '&cid=' . $cat . '&id=' . $article_id) . '">', '</a>') //. '<br /><br />' . sprintf($lang['kb_click_return_ucp'], '<a href="' . append_sid('kb.' . $phpEx . '?pid=ucp') . '">', '</a>') + ; } else { @@ -395,8 +396,8 @@ } // Message here somewhere - $meta = '<meta http-equiv="refresh" content="3;url=' . append_sid('kb.' . $phpEx . '?pid=view_article&id=' . $article_id) . '>"'; - $return_message = $lang['kb_edited'] . '<br /><br />' . sprintf($lang['kb_click_view_article'], '<a href="' . append_sid('kb.' . $phpEx . '?pid=view_article&id=' . $article_id) . '">', '</a>') . '<br /><br />' . sprintf($lang['kb_click_return_ucp'], '<a href="' . append_sid('kb.' . $phpEx . '?pid=ucp') . '">', '</a>'); + $meta = '<meta http-equiv="refresh" content="3;url=' . append_sid('kb.' . $phpEx . '?pid=view_article&cid=' . $cat . '&cid=' . $cat . '&id=' . $article_id) . '>"'; + $return_message = $lang['kb_edited'] . '<br /><br />' . sprintf($lang['kb_click_view_article'], '<a href="' . append_sid('kb.' . $phpEx . '?pid=view_article&cid=' . $cat . '&cid=' . $cat . '&id=' . $article_id) . '">', '</a>') . '<br /><br />' . sprintf($lang['kb_click_return_ucp'], '<a href="' . append_sid('kb.' . $phpEx . '?pid=ucp') . '">', '</a>'); } $template->assign_vars(array( @@ -849,8 +850,8 @@ } // Message - $meta = '<meta http-equiv="refresh" content="3;url=' . append_sid('kb.' . $phpEx . '?pid=view_article&id=' . $article_id) . '>"'; - $return_message = $lang['kb_deleted'] . '<br /><br />' . sprintf($lang['kb_click_view_article'], '<a href="' . append_sid('kb.' . $phpEx . '?pid=view_article&id=' . $article_id) . '">', '</a>') . '<br /><br />' . sprintf($lang['kb_click_return_ucp'], '<a href="' . append_sid('kb.' . $phpEx . '?pid=ucp') . '">', '</a>'); + $meta = '<meta http-equiv="refresh" content="3;url=' . append_sid('kb.' . $phpEx . '?pid=view_article&cid=' . $cat . '&id=' . $article_id) . '>"'; + $return_message = $lang['kb_deleted'] . '<br /><br />' . sprintf($lang['kb_click_view_article'], '<a href="' . append_sid('kb.' . $phpEx . '?pid=view_article&cid=' . $cat . '&id=' . $article_id) . '">', '</a>') . '<br /><br />' . sprintf($lang['kb_click_return_ucp'], '<a href="' . append_sid('kb.' . $phpEx . '?pid=ucp') . '">', '</a>'); $template->assign_vars(array( 'META' => $meta) Modified: main/trunk/language/lang_english/lang_kb.php =================================================================== --- main/trunk/language/lang_english/lang_kb.php 2007-02-15 00:48:38 UTC (rev 52) +++ main/trunk/language/lang_english/lang_kb.php 2007-02-15 01:04:18 UTC (rev 53) @@ -58,7 +58,7 @@ $lang['kb_deleted'] = "Your article has been deleted and is now nonexistant."; $lang['kb_edited'] = "Your article has been edited and is awaiting reapproval."; $lang['kb_click_view_article'] = "Click %shere%s to view you article."; // Change this later on, they can't view the article yet. -$lang['kb_click_return_ucp'] = "Click %shere%s to go back to the user control panel"; +//$lang['kb_click_return_ucp'] = "Click %shere%s to go back to the user control panel"; $lang['kb_posted_by'] = "This article was submitted by %s on %s, it was last updated on %s."; $lang['kb_confirm_deletearticle'] = "Are you sure you want to delete this article?"; $lang['kb_articlepreview'] = "Article Preview"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2007-02-15 00:48:37
|
Revision: 52 http://svn.sourceforge.net/phpbbkb/?rev=52&view=rev Author: markthedaemon Date: 2007-02-14 16:48:38 -0800 (Wed, 14 Feb 2007) Log Message: ----------- /me slaps self. Lets try again... Modified Paths: -------------- main/trunk/kb.php Modified: main/trunk/kb.php =================================================================== --- main/trunk/kb.php 2007-02-15 00:38:22 UTC (rev 51) +++ main/trunk/kb.php 2007-02-15 00:48:38 UTC (rev 52) @@ -193,8 +193,6 @@ $subcats[] = $row; } - if( ( $total_subcats = count($subcats) ) ) - { // Now articles, the LIKE handles multiple cats // First handle the sorting @@ -352,14 +350,14 @@ ); } } - - }// if ... total_categories else { message_die(GENERAL_MESSAGE, $lang['No_articles']); } + // if ... total_categories + // // Generate the page // This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2007-02-15 00:38:25
|
Revision: 51 http://svn.sourceforge.net/phpbbkb/?rev=51&view=rev Author: markthedaemon Date: 2007-02-14 16:38:22 -0800 (Wed, 14 Feb 2007) Log Message: ----------- Some changes: - Added a "There are no articles in this category." message as per bug #9 - Committing the constants.php file with the KB page constant in it, not sure if I have committed this or not :\. Modified Paths: -------------- main/trunk/admin/admin_kb.php main/trunk/includes/constants.php main/trunk/kb.php main/trunk/language/lang_english/lang_kb.php main/trunk/templates/subSilver/images/Thumbs.db main/trunk/templates/subSilver/images/lang_english/Thumbs.db Modified: main/trunk/admin/admin_kb.php =================================================================== --- main/trunk/admin/admin_kb.php 2007-02-14 04:48:07 UTC (rev 50) +++ main/trunk/admin/admin_kb.php 2007-02-15 00:38:22 UTC (rev 51) @@ -531,7 +531,7 @@ $sql = "SELECT cat_id, cat_title FROM " . KB_CATEGORIES_TABLE . " - WHERE cat_main = '0' + WHERE cat_main = '0' ORDER BY cat_order ASC"; // At the moment only one level of subcats if(!$result = $db->sql_query($sql)) { Modified: main/trunk/includes/constants.php =================================================================== --- main/trunk/includes/constants.php 2007-02-14 04:48:07 UTC (rev 50) +++ main/trunk/includes/constants.php 2007-02-15 00:38:22 UTC (rev 51) @@ -123,6 +123,7 @@ define('PAGE_PRIVMSGS', -10); define('PAGE_GROUPCP', -11); define('PAGE_TOPIC_OFFSET', 5000); +define('PAGE_KB', -1345); // http://www.phpbb.com/kb/article.php?article_id=149 // Auth settings @@ -180,4 +181,6 @@ define('VOTE_RESULTS_TABLE', $table_prefix.'vote_results'); define('VOTE_USERS_TABLE', $table_prefix.'vote_voters'); + + ?> \ No newline at end of file Modified: main/trunk/kb.php =================================================================== --- main/trunk/kb.php 2007-02-14 04:48:07 UTC (rev 50) +++ main/trunk/kb.php 2007-02-15 00:38:22 UTC (rev 51) @@ -193,6 +193,9 @@ $subcats[] = $row; } + if( ( $total_subcats = count($subcats) ) ) + { + // Now articles, the LIKE handles multiple cats // First handle the sorting // default is by edit time, other options: -rating, -author, -title @@ -240,12 +243,14 @@ { $articles[] = $row; } + $db->sql_freeresult($result); + // Start Page output $page_title = $lang['kb_viewcat'] . ": " . $cat['cat_title']; include($phpbb_root_path . 'includes/page_header.'.$phpEx); - if($cat['cat_main'] == "0") + if( $cat['cat_main'] == "0" ) { create_navigation("viewcat", array( 0 => $cat['cat_id'], @@ -323,7 +328,7 @@ { $authorname = $articles[$i]['article_authorname']; } - $author = "<a href=\"profile." . $phpEx . "?mode=viewprofile&u=" . $articles[$i]['article_author'] . "\">$authorname</a>"; + $author = "<a href=\"profile.$phpEx?mode=viewprofile&u=" . $articles[$i]['article_author'] . "\">$authorname</a>"; $sql = "SELECT username FROM " . USERS_TABLE . " @@ -348,6 +353,13 @@ } } + }// if ... total_categories + else + { + message_die(GENERAL_MESSAGE, $lang['No_articles']); + } + + // // Generate the page // Modified: main/trunk/language/lang_english/lang_kb.php =================================================================== --- main/trunk/language/lang_english/lang_kb.php 2007-02-14 04:48:07 UTC (rev 50) +++ main/trunk/language/lang_english/lang_kb.php 2007-02-15 00:38:22 UTC (rev 51) @@ -94,4 +94,6 @@ $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."; + +$lang['No_articles'] = "There are no articles in this category."; ?> \ No newline at end of file Modified: main/trunk/templates/subSilver/images/Thumbs.db =================================================================== (Binary files differ) Modified: main/trunk/templates/subSilver/images/lang_english/Thumbs.db =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2007-02-14 04:48:07
|
Revision: 50 http://svn.sourceforge.net/phpbbkb/?rev=50&view=rev Author: markthedaemon Date: 2007-02-13 20:48:07 -0800 (Tue, 13 Feb 2007) Log Message: ----------- We continue the fight against bugs by squashing another one ;). This time it's bug #8 Modified Paths: -------------- main/trunk/admin/admin_kb.php Modified: main/trunk/admin/admin_kb.php =================================================================== --- main/trunk/admin/admin_kb.php 2007-02-14 04:29:56 UTC (rev 49) +++ main/trunk/admin/admin_kb.php 2007-02-14 04:48:07 UTC (rev 50) @@ -248,7 +248,7 @@ } // Delete subcats - $sql = "DELETE FROM " . KB_ARTICLES_TABLE . " WHERE cat_main = '" . $cat_id . "'"; + $sql = "DELETE FROM " . KB_CATEGORIES_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); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2007-02-14 04:29:58
|
Revision: 49 http://svn.sourceforge.net/phpbbkb/?rev=49&view=rev Author: markthedaemon Date: 2007-02-13 20:29:56 -0800 (Tue, 13 Feb 2007) Log Message: ----------- Bug #4 Modified Paths: -------------- main/trunk/templates/subSilver/kb_viewcat.tpl Modified: main/trunk/templates/subSilver/kb_viewcat.tpl =================================================================== --- main/trunk/templates/subSilver/kb_viewcat.tpl 2007-02-14 04:28:15 UTC (rev 48) +++ main/trunk/templates/subSilver/kb_viewcat.tpl 2007-02-14 04:29:56 UTC (rev 49) @@ -57,7 +57,7 @@ <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> + <td align="left" valign="middle" width="50"><a class="nav" href="{U_ADD_ARTICLE}"><img src="{ADD_ARTICLE_IMG}" border="0" alt="{L_ADD_ARTICLE}" /></a></td> <!-- END switch_add_article --> <td align="left">{NAVIGATION}</td> <td align="right"><span class="gensmall">{S_TIMEZONE}</span></td> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2007-02-14 04:28:15
|
Revision: 48 http://svn.sourceforge.net/phpbbkb/?rev=48&view=rev Author: markthedaemon Date: 2007-02-13 20:28:15 -0800 (Tue, 13 Feb 2007) Log Message: ----------- Bug #6 Modified Paths: -------------- main/trunk/templates/subSilver/kb_viewarticle.tpl Modified: main/trunk/templates/subSilver/kb_viewarticle.tpl =================================================================== --- main/trunk/templates/subSilver/kb_viewarticle.tpl 2007-02-14 04:22:05 UTC (rev 47) +++ main/trunk/templates/subSilver/kb_viewarticle.tpl 2007-02-14 04:28:15 UTC (rev 48) @@ -7,7 +7,7 @@ <table class="forumline" width="100%" cellspacing="1" cellpadding="3" border="0"> <tr> - <th colspan="2" class="thRight" nowrap="nowrap"><a class="maintitle" href="{U_VIEW_ARTICLE}">{ARTICLE_TITLE}</a></th> + <th colspan="2" class="thRight" nowrap="nowrap">{ARTICLE_TITLE}</th> </tr> <tr> <td align="left" class="catHead" height="28"><span class="gensmall">{POSTED_BY}</span></td> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2007-02-14 04:22:06
|
Revision: 47 http://svn.sourceforge.net/phpbbkb/?rev=47&view=rev Author: markthedaemon Date: 2007-02-13 20:22:05 -0800 (Tue, 13 Feb 2007) Log Message: ----------- Bug #3 Modified Paths: -------------- main/trunk/templates/subSilver/images/lang_english/Thumbs.db Added Paths: ----------- main/trunk/templates/subSilver/images/lang_english/new-article.gif Removed Paths: ------------- main/trunk/templates/subSilver/images/new-article.gif Modified: main/trunk/templates/subSilver/images/lang_english/Thumbs.db =================================================================== (Binary files differ) Added: main/trunk/templates/subSilver/images/lang_english/new-article.gif =================================================================== (Binary files differ) Property changes on: main/trunk/templates/subSilver/images/lang_english/new-article.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Deleted: main/trunk/templates/subSilver/images/new-article.gif =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |