From eef332eea5d299784dc31891e84c11017548681d Mon Sep 17 00:00:00 2001 From: Ludovic Arnaud Date: Sun, 15 Sep 2002 17:21:08 +0000 Subject: [PATCH] Cleanups git-svn-id: file:///svn/phpbb/trunk@2889 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/admin/admin_forums.php | 89 +++------------------- phpBB/common.php | 1 + phpBB/includes/functions.php | 36 +++++++++ phpBB/language/lang_english/lang_admin.php | 39 +++++----- phpBB/language/lang_english/lang_main.php | 6 +- 5 files changed, 74 insertions(+), 97 deletions(-) diff --git a/phpBB/admin/admin_forums.php b/phpBB/admin/admin_forums.php index 19b9b6fc00..2336bec824 100644 --- a/phpBB/admin/admin_forums.php +++ b/phpBB/admin/admin_forums.php @@ -40,28 +40,6 @@ require($phpbb_root_path . 'extension.inc'); require('pagestart.' . $phpEx); include($phpbb_root_path . 'includes/functions_admin.'.$phpEx); -// -// Additional lang strings and constants -// -$lang['Category_name'] = 'Category name'; -$lang['Type'] = 'Type'; - -$lang['Parent'] = 'Parent'; -$lang['Locked'] = 'Locked'; -$lang['Unlocked'] = 'Unlocked'; - -$lang['General_settings'] = 'General settings'; -$lang['Forum_settings'] = 'Forum settings'; -$lang['Disable_post_count'] = 'Disable post count'; - -$lang['Default_style'] = 'Default style'; - -$lang['Move_posts'] = 'Move posts to'; -$lang['Delete_subforums'] = 'Delete subforums and associated posts'; -$lang['Move_subforums'] = 'Move subforums to'; - -define('ITEM_CATEGORY', 3); - // // Do we have forum admin permissions? // @@ -307,10 +285,7 @@ switch ($mode) $parents_list = make_forums_list('all', $parent_id, $subforums_id); - // - // TODO: Make 'Edit_forum' and 'Edit_Category' use the same case - // - $l_title = ($forum_status != ITEM_CATEGORY) ? $lang['Edit_forum'] : $lang['Edit_Category']; + $l_title = ($forum_status != ITEM_CATEGORY) ? $lang['Edit_forum'] : $lang['Edit_category']; $newmode = 'modify'; $buttonvalue = $lang['Update']; $prune_enabled = ($prune_enable) ? 'checked="checked" ' : ''; @@ -382,7 +357,7 @@ switch ($mode) { ?> - + />   /> - - Change this forum into a category and
+ +
     
-      Move all posts to +       - + - + Forum Index'; - $sql = 'SELECT f2.forum_id, f2.forum_name - FROM ' . FORUMS_TABLE . ' f1 - LEFT JOIN ' . FORUMS_TABLE . " f2 ON f1.left_id BETWEEN f2.left_id AND f2.right_id - WHERE f1.forum_id = $parent_id - ORDER BY f2.left_id"; - - $result = $db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + $forums_nav = get_forum_branch($parent_id, 'parents', 'descending'); + foreach ($forums_nav as $row) { if ($row['forum_id'] == $parent_id) { @@ -654,7 +623,7 @@ while ($row = $db->sql_fetchrow($result)) } ?> - + >
@@ -666,7 +635,7 @@ while ($row = $db->sql_fetchrow($result)) } ?> - + sql_query($sql); - while ($row = $db->sql_fetchrow($result)) - { - if (!$include_forum && $row['forum_id'] == $forum_id) - { - continue; - } - $rows[] = $row; - } - return $rows; -} - function get_forum_info($forum_id) { global $db; diff --git a/phpBB/common.php b/phpBB/common.php index 704037be13..3d7a1c7734 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -66,6 +66,7 @@ define('GROUP_HIDDEN', 2); define('ITEM_UNLOCKED', 0); define('ITEM_LOCKED', 1); define('ITEM_MOVED', 2); +define('ITEM_CATEGORY', 3); // Topic types define('POST_NORMAL', 0); diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index ffcb49dc1b..aa7feba656 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -81,6 +81,42 @@ function get_userdata($user) return ( $row = $db->sql_fetchrow($result) ) ? $row : false; } +function get_forum_branch($forum_id, $type='all', $order='descending', $include_forum=TRUE) +{ + global $db; + + switch ($type) + { + case 'parents': + $condition = 'f1.left_id BETWEEN f2.left_id AND f2.right_id'; + break; + + case 'children': + $condition = 'f2.left_id BETWEEN f1.left_id AND f1.right_id'; + break; + + default: + $condition = 'f2.left_id BETWEEN f1.left_id AND f1.right_id OR f1.left_id BETWEEN f2.left_id AND f2.right_id'; + } + $sql = 'SELECT f2.* + FROM ' . FORUMS_TABLE . ' f1 + LEFT JOIN ' . FORUMS_TABLE . " f2 ON $condition + WHERE f1.forum_id = $forum_id + ORDER BY f2.left_id " . (($order == 'descending') ? 'ASC' : 'DESC'); + + $rows = array(); + $result = $db->sql_query($sql); + while ($row = $db->sql_fetchrow($result)) + { + if (!$include_forum && $row['forum_id'] == $forum_id) + { + continue; + } + $rows[] = $row; + } + return $rows; +} + // // Obtain list of moderators of each forum // First users, then groups ... broken into two queries diff --git a/phpBB/language/lang_english/lang_admin.php b/phpBB/language/lang_english/lang_admin.php index aab70579e4..a7e4582cc1 100644 --- a/phpBB/language/lang_english/lang_admin.php +++ b/phpBB/language/lang_english/lang_admin.php @@ -522,23 +522,29 @@ $lang['Allow_name_change'] = 'Allow Username changes'; $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['Edit_category'] = 'Edit category'; $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['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['Category_name'] = 'Category name'; +$lang['Forum_type'] = 'Forum type'; + +$lang['Parent'] = 'Parent'; +$lang['Locked'] = 'Locked'; +$lang['Unlocked'] = 'Unlocked'; + +$lang['General_settings'] = 'General settings'; +$lang['Forum_settings'] = 'Forum settings'; +$lang['Disable_post_count'] = 'Disable post count'; + +$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['Forum_general'] = 'General Forum Settings'; $lang['Forum_name'] = 'Forum name'; @@ -548,20 +554,19 @@ $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['Set_as_category'] = 'Set this forum as a category and'; // followed by a list of actions + +$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['Move_and_Delete'] = 'Move and Delete'; - +$lang['Move_posts_to'] = 'Move posts to'; +$lang['Move_subforums_to'] = 'Move subforums to'; $lang['Delete_all_posts'] = 'Delete all posts'; -$lang['Nowhere_to_move'] = 'Nowhere to move too'; - -$lang['Edit_Category'] = 'Edit Category'; -$lang['Edit_Category_explain'] = 'Use this form to modify a categories name.'; +$lang['Delete_subforums'] = 'Delete subforums and associated posts'; $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'; diff --git a/phpBB/language/lang_english/lang_main.php b/phpBB/language/lang_english/lang_main.php index 35e922890c..3e8fed672b 100644 --- a/phpBB/language/lang_english/lang_main.php +++ b/phpBB/language/lang_english/lang_main.php @@ -576,11 +576,13 @@ $lang['Always_notify'] = 'Always notify me of replies'; $lang['Always_notify_explain'] = 'Sends an email when someone replies to a topic you have posted in. This can be changed whenever you post'; $lang['Board_style'] = 'Board Style'; -$lang['Board_lang'] = 'Board Language'; +$lang['Default_style'] = 'Default style'; $lang['No_themes'] = 'No Themes In database'; + +$lang['Board_lang'] = 'Board Language'; $lang['Timezone'] = 'Timezone'; $lang['Date_format'] = 'Date format'; -$lang['Date_format_explain'] = 'The syntax used is identical to the PHP date() function'; +$lang['Date_format_explain'] = 'The syntax used is identical to the PHP date() function'; $lang['Signature'] = 'Signature'; $lang['Signature_explain'] = 'This is a block of text that can be added to posts you make. There is a %d character limit'; $lang['Public_view_email'] = 'Always show my Email Address';