git-svn-id: file:///svn/phpbb/trunk@2889 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Ludovic Arnaud 2002-09-15 17:21:08 +00:00
parent 8d6c391d48
commit eef332eea5
5 changed files with 74 additions and 97 deletions

View file

@ -40,28 +40,6 @@ require($phpbb_root_path . 'extension.inc');
require('pagestart.' . $phpEx); require('pagestart.' . $phpEx);
include($phpbb_root_path . 'includes/functions_admin.'.$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? // Do we have forum admin permissions?
// //
@ -307,10 +285,7 @@ switch ($mode)
$parents_list = make_forums_list('all', $parent_id, $subforums_id); $parents_list = make_forums_list('all', $parent_id, $subforums_id);
// $l_title = ($forum_status != ITEM_CATEGORY) ? $lang['Edit_forum'] : $lang['Edit_category'];
// TODO: Make 'Edit_forum' and 'Edit_Category' use the same case
//
$l_title = ($forum_status != ITEM_CATEGORY) ? $lang['Edit_forum'] : $lang['Edit_Category'];
$newmode = 'modify'; $newmode = 'modify';
$buttonvalue = $lang['Update']; $buttonvalue = $lang['Update'];
$prune_enabled = ($prune_enable) ? 'checked="checked" ' : ''; $prune_enabled = ($prune_enable) ? 'checked="checked" ' : '';
@ -382,7 +357,7 @@ switch ($mode)
{ {
?> ?>
<tr> <tr>
<td class="row1"><?php echo $lang['Type'] ?></td> <td class="row1"><?php echo $lang['Forum_type'] ?></td>
<td class="row2"><input type="radio" name="is_category" value="0" <?php echo $forum_checked ?>/><?php echo $lang['Forum'] ?> &nbsp; <input type="radio" name="is_category" value="1" <?php echo $category_checked ?>/><?php echo $lang['Category'] ?></td> <td class="row2"><input type="radio" name="is_category" value="0" <?php echo $forum_checked ?>/><?php echo $lang['Forum'] ?> &nbsp; <input type="radio" name="is_category" value="1" <?php echo $category_checked ?>/><?php echo $lang['Category'] ?></td>
</tr> </tr>
<?php <?php
@ -420,10 +395,10 @@ switch ($mode)
{ {
?> ?>
<tr> <tr>
<td class="row1"><?php echo $lang['Type'] ?></td> <td class="row1"><?php echo $lang['Forum_type'] ?></td>
<td class="row2"><input type="checkbox" name="set_category" />Change this forum into a category and<br /> <td class="row2"><input type="checkbox" name="set_category" /><?php echo $lang['Set_as_category'] ?><br />
&nbsp; &nbsp; &nbsp;<input type="radio" name="action" value="delete" checked="checked" /><?php echo $lang['Delete_all_posts'] ?><br /> &nbsp; &nbsp; &nbsp;<input type="radio" name="action" value="delete" checked="checked" /><?php echo $lang['Delete_all_posts'] ?><br />
&nbsp; &nbsp; &nbsp;<input type="radio" name="action" value="move" />Move all posts to <select name="to_forum_id"><?php echo $forums_list ?></select> &nbsp; &nbsp; &nbsp;<input type="radio" name="action" value="move" /><?php echo $lang['Move_posts_to'] ?> <select name="to_forum_id"><?php echo $forums_list ?></select>
</td> </td>
</tr> </tr>
<?php <?php
@ -498,7 +473,7 @@ switch ($mode)
</tr> </tr>
<tr> <tr>
<td class="row1"></td> <td class="row1"></td>
<td class="row1"><input type="radio" name="action_posts" value="move" /> <?php echo $lang['Move_posts'] ?> <select name="posts_to_id" ?><option value="0"></option><?php echo $move_posts_list ?></select></td> <td class="row1"><input type="radio" name="action_posts" value="move" /> <?php echo $lang['Move_posts_to'] ?> <select name="posts_to_id" ?><option value="0"></option><?php echo $move_posts_list ?></select></td>
</tr> </tr>
<?php <?php
} }
@ -511,7 +486,7 @@ switch ($mode)
</tr> </tr>
<tr> <tr>
<td class="row1"></td> <td class="row1"></td>
<td class="row1"><input type="radio" name="action_forums" value="move" /> <?php echo $lang['Move_subforums'] ?> <select name="subforums_to_id" ?><option value="0"></option><?php echo $forums_list ?></select></td> <td class="row1"><input type="radio" name="action_forums" value="move" /> <?php echo $lang['Move_subforums_to'] ?> <select name="subforums_to_id" ?><option value="0"></option><?php echo $forums_list ?></select></td>
</tr> </tr>
<?php <?php
} }
@ -546,14 +521,8 @@ else
{ {
$navigation = '<a href="admin_forums.' . $phpEx . $SID . '">Forum Index</a>'; $navigation = '<a href="admin_forums.' . $phpEx . $SID . '">Forum Index</a>';
$sql = 'SELECT f2.forum_id, f2.forum_name $forums_nav = get_forum_branch($parent_id, 'parents', 'descending');
FROM ' . FORUMS_TABLE . ' f1 foreach ($forums_nav as $row)
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))
{ {
if ($row['forum_id'] == $parent_id) if ($row['forum_id'] == $parent_id)
{ {
@ -654,7 +623,7 @@ while ($row = $db->sql_fetchrow($result))
} }
?> ?>
<tr> <tr>
<td width="1" class="spaceRow"></td> <td width="1" class="row3"></td>
<td width="40%" class="row2"<?php echo $colspan ?>><span class="gen"><?php echo $forum_title ?></span><br /><span class="gensmall"><?php echo $forum_desc ?></span></td> <td width="40%" class="row2"<?php echo $colspan ?>><span class="gen"><?php echo $forum_title ?></span><br /><span class="gensmall"><?php echo $forum_desc ?></span></td>
<?php echo $forum_stats ?> <?php echo $forum_stats ?>
<td class="row2" align="center" valign="middle"><span class="gen"><a href="admin_forums.<?php echo $url ?>&mode=edit"><?php echo $lang['Edit'] ?></a></span></td> <td class="row2" align="center" valign="middle"><span class="gen"><a href="admin_forums.<?php echo $url ?>&mode=edit"><?php echo $lang['Edit'] ?></a></span></td>
@ -666,7 +635,7 @@ while ($row = $db->sql_fetchrow($result))
} }
?> ?>
<tr> <tr>
<td width="1" class="spaceRow"></td> <td width="1" class="row3"></td>
<td width="100%" colspan="8" class="row2"><input type="text" name="forum_name[<? echo $row['forum_id'] ?>]" /> <input type="submit" class="liteoption" name="parent_id[<? echo $row['forum_id'] ?>]" value="<?php echo $lang['Create_forum'] ?>" /></td> <td width="100%" colspan="8" class="row2"><input type="text" name="forum_name[<? echo $row['forum_id'] ?>]" /> <input type="submit" class="liteoption" name="parent_id[<? echo $row['forum_id'] ?>]" value="<?php echo $lang['Create_forum'] ?>" /></td>
</tr> </tr>
<?php <?php
@ -705,42 +674,6 @@ page_footer();
// Begin function block // Begin function block
// //
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;
}
function get_forum_info($forum_id) function get_forum_info($forum_id)
{ {
global $db; global $db;

View file

@ -66,6 +66,7 @@ define('GROUP_HIDDEN', 2);
define('ITEM_UNLOCKED', 0); define('ITEM_UNLOCKED', 0);
define('ITEM_LOCKED', 1); define('ITEM_LOCKED', 1);
define('ITEM_MOVED', 2); define('ITEM_MOVED', 2);
define('ITEM_CATEGORY', 3);
// Topic types // Topic types
define('POST_NORMAL', 0); define('POST_NORMAL', 0);

View file

@ -81,6 +81,42 @@ function get_userdata($user)
return ( $row = $db->sql_fetchrow($result) ) ? $row : false; 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 // Obtain list of moderators of each forum
// First users, then groups ... broken into two queries // First users, then groups ... broken into two queries

View file

@ -522,23 +522,29 @@ $lang['Allow_name_change'] = 'Allow Username changes';
$lang['Forum_admin'] = 'Forum Administration'; $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['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_forum'] = 'Edit forum';
$lang['Edit_category'] = 'Edit category';
$lang['Create_forum'] = 'Create new forum'; $lang['Create_forum'] = 'Create new forum';
$lang['Create_category'] = 'Create new category';
$lang['Remove'] = 'Remove'; $lang['Remove'] = 'Remove';
$lang['Action'] = 'Action'; $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['Edit'] = 'Edit';
$lang['Delete'] = 'Delete'; $lang['Delete'] = 'Delete';
$lang['Move_up'] = 'Move up'; $lang['Move_up'] = 'Move up';
$lang['Move_down'] = 'Move down'; $lang['Move_down'] = 'Move down';
$lang['Resync'] = 'Resync'; $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['Category_name'] = 'Category name';
$lang['Forum_delete'] = 'Delete Forum'; $lang['Forum_type'] = 'Forum type';
$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['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_general'] = 'General Forum Settings';
$lang['Forum_name'] = 'Forum name'; $lang['Forum_name'] = 'Forum name';
@ -548,20 +554,19 @@ $lang['Forum_pruning'] = 'Auto-pruning';
$lang['prune_freq'] = 'Check for topic age every'; $lang['prune_freq'] = 'Check for topic age every';
$lang['prune_days'] = 'Remove topics that have not been posted to in'; $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_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['Delete_all_posts'] = 'Delete all posts';
$lang['Nowhere_to_move'] = 'Nowhere to move too'; $lang['Delete_subforums'] = 'Delete subforums and associated posts';
$lang['Edit_Category'] = 'Edit Category';
$lang['Edit_Category_explain'] = 'Use this form to modify a categories name.';
$lang['Forums_updated'] = 'Forum and Category information updated successfully'; $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'; $lang['Click_return_forumadmin'] = 'Click %sHere%s to return to Forum Administration';

View file

@ -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['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_style'] = 'Board Style';
$lang['Board_lang'] = 'Board Language'; $lang['Default_style'] = 'Default style';
$lang['No_themes'] = 'No Themes In database'; $lang['No_themes'] = 'No Themes In database';
$lang['Board_lang'] = 'Board Language';
$lang['Timezone'] = 'Timezone'; $lang['Timezone'] = 'Timezone';
$lang['Date_format'] = 'Date format'; $lang['Date_format'] = 'Date format';
$lang['Date_format_explain'] = 'The syntax used is identical to the PHP <a href=\'http://www.php.net/date\' target=\'_other\'>date()</a> function'; $lang['Date_format_explain'] = 'The syntax used is identical to the PHP <a href="http://www.php.net/date" target="_other">date()</a> function';
$lang['Signature'] = 'Signature'; $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['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'; $lang['Public_view_email'] = 'Always show my Email Address';