aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/admin/admin_forums.php
diff options
context:
space:
mode:
authorthe_systech <the_systech@users.sourceforge.net>2001-08-31 20:58:31 +0000
committerthe_systech <the_systech@users.sourceforge.net>2001-08-31 20:58:31 +0000
commit5c6eb1e14918762ef657d8c93d83d2fafd2b36e0 (patch)
tree15bcb3ff97965492ee693793f9863b42c0c1eb22 /phpBB/admin/admin_forums.php
parentddf104d7817deb77c92de40653790ceab64f2c45 (diff)
downloadforums-5c6eb1e14918762ef657d8c93d83d2fafd2b36e0.tar
forums-5c6eb1e14918762ef657d8c93d83d2fafd2b36e0.tar.gz
forums-5c6eb1e14918762ef657d8c93d83d2fafd2b36e0.tar.bz2
forums-5c6eb1e14918762ef657d8c93d83d2fafd2b36e0.tar.xz
forums-5c6eb1e14918762ef657d8c93d83d2fafd2b36e0.zip
Additions for forum auto_pruning, and fix for form submission on edits
git-svn-id: file:///svn/phpbb/trunk@956 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/admin/admin_forums.php')
-rw-r--r--phpBB/admin/admin_forums.php77
1 files changed, 76 insertions, 1 deletions
diff --git a/phpBB/admin/admin_forums.php b/phpBB/admin/admin_forums.php
index 4da935a502..d9fa09729f 100644
--- a/phpBB/admin/admin_forums.php
+++ b/phpBB/admin/admin_forums.php
@@ -224,19 +224,71 @@ if(isset($mode)) // Are we supposed to do something?
{
message_die(GENERAL_ERROR, "Couldn't insert row in forums table", "", __LINE__, __FILE__, $sql);
}
+ if($HTTP_POST_VARS['prune_enable'] == 1)
+ {
+ $new_forum_id = $db->sql_nextid();
+ $sql = "INSERT INTO ".PRUNE_TABLE." (
+ forum_id,
+ prune_days,
+ prune_freq)
+ VALUES(
+ '$new_forum_id',
+ '".$HTTP_POST_VARS['prune_days']."',
+ '".$HTTP_POST_VARS['prune_freq']."')";
+ if( !$result = $db->sql_query($sql) )
+ {
+ message_die(GENERAL_ERROR, "Couldn't insert row in prune table", "", __LINE__, __FILE__, $sql);
+ }
+ }
$show_index = TRUE;
break;
case 'modforum': // Modify a forum in the DB
+ if($HTTP_POST_VARS['prune_enable'] != 1)
+ {
+ $HTTP_POST_VARS['prune_enable'] = 0;
+ }
$sql = "UPDATE ".FORUMS_TABLE." SET
forum_name = '".$HTTP_POST_VARS['forumname']."',
cat_id = '".$HTTP_POST_VARS['cat_id']."',
forum_desc = '".$HTTP_POST_VARS['forumdesc']."',
- forum_status = '".$HTTP_POST_VARS['forumstatus']."'
+ forum_status = '".$HTTP_POST_VARS['forumstatus']."',
+ prune_enable = '".$HTTP_POST_VARS['prune_enable']."'
WHERE forum_id = '".$HTTP_POST_VARS['forum_id']."'";
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't update forum information", "", __LINE__, __FILE__, $sql);
}
+ if($HTTP_POST_VARS['prune_enable'] == 1)
+ {
+ $sql = "SELECT * FROM ".PRUNE_TABLE."
+ WHERE forum_id = '".$HTTP_POST_VARS['forum_id']."'";
+ if( !$result = $db->sql_query($sql) )
+ {
+ message_die(GENERAL_ERROR, "Couldn't get forum Prune Information","",__LINE__, __FILE__, $sql);
+ }
+ if( $db->sql_numrows($result) > 0 )
+ {
+ $sql = "UPDATE ".PRUNE_TABLE." SET
+ prune_days = '".$HTTP_POST_VARS['prune_days']."',
+ prune_freq = '".$HTTP_POST_VARS['prune_freq']."'
+ WHERE forum_id = '".$HTTP_POST_VARS['forum_id']."'";
+ }
+ else
+ {
+ $sql = "INSERT INTO ".PRUNE_TABLE."(
+ forum_id,
+ prune_days,
+ prune_freq)
+ VALUES(
+ '".$HTTP_POST_VARS['forum_id']."',
+ '".$HTTP_POST_VARS['prune_days']."',
+ '".$HTTP_POST_VARS['prune_freq']."')";
+ }
+ if( !$result = $db->sql_query($sql) )
+ {
+ message_die(GENERAL_ERROR, "Couldn't Update Forum Prune Information","",__LINE__, __FILE__, $sql);
+ }
+ }
$show_index = TRUE;
break;
@@ -279,6 +331,21 @@ if(isset($mode)) // Are we supposed to do something?
$cat_id = $row['cat_id'];
$forumdesc = $row['forum_desc'];
$forumstatus = $row['forum_status'];
+ //
+ // start forum prune stuff.
+ //
+ if( $row['prune_enable'] == 1 )
+ {
+ $prune_enabled = "CHECKED";
+ $sql = "SELECT *
+ FROM " . PRUNE_TABLE . "
+ WHERE forum_id = $forum_id";
+ if(!$pr_result = $db->sql_query($sql))
+ {
+ message_die(GENERAL_ERROR, "Auto-Prune: Couldn't read auto_prune table.", __LINE__, __FILE__);
+ }
+ $pr_row = $db->sql_fetchrow($pr_result);
+ }
}
else
{
@@ -304,10 +371,18 @@ if(isset($mode)) // Are we supposed to do something?
$template->assign_vars(array(
'FORUMNAME' => $forumname,
'DESCRIPTION' => $forumdesc,
+ 'S_FORUM_ACTION' => $PHP_SELF,
'S_CATLIST' => $catlist,
'S_STATUSLIST' => $statuslist,
'S_FORUMID' => $forum_id,
'S_NEWMODE' => $newmode,
+ 'S_PRUNE_EN' => $prune_enabled,
+ 'S_PRUNE_DAYS' => $pr_row['prune_days'],
+ 'S_PRUNE_FREQ' => $pr_row['prune_freq'],
+ 'L_ENABLED' => $lang['Enabled'],
+ 'L_PRUNE_DAYS' => $lang['prune_days'],
+ 'L_PRUNE_FREQ' => $lang['prune_freq'],
+ 'L_DAYS' => $lang['days'],
'BUTTONVALUE' => $buttonvalue)
);
$template->pparse("body");