From 931fd9d64293ebd1dc48aeef25039ce50251aec8 Mon Sep 17 00:00:00 2001 From: the_systech Date: Tue, 17 Jul 2001 13:26:36 +0000 Subject: Update of pruning to add admin interface, and change error_die's to message_die's git-svn-id: file:///svn/phpbb/trunk@683 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/admin/admin_forum_prune.php | 202 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 202 insertions(+) create mode 100644 phpBB/admin/admin_forum_prune.php (limited to 'phpBB/admin') diff --git a/phpBB/admin/admin_forum_prune.php b/phpBB/admin/admin_forum_prune.php new file mode 100644 index 0000000000..a72eafdcd6 --- /dev/null +++ b/phpBB/admin/admin_forum_prune.php @@ -0,0 +1,202 @@ +sql_query($sql); + +$forum_rows = $db->sql_fetchrowset($f_result); + +// +// Check for the submit variable. +// +if(isset($HTTP_GET_VARS['submit']) || isset($HTTP_POST_VARS['submit'])) +{ + $submit = (isset($HTTP_POST_VARS['submit'])) ? $HTTP_POST_VARS['submit'] : $HTTP_GET_VARS['submit']; +} +else +{ + unset($submit); +} + +// +// Check for submit to be equal to Prune. If so then proceed with the pruning. +// +if($submit == "Prune") +{ + $prunedays = $HTTP_POST_VARS['prunedays']; + // Convert days to seconds for timestamp functions... + $prunesecs = $prunedays * 1440 * 60; + $prunedate = time() - $prunesecs; + $template->set_filenames(array( + "body" => "admin/forum_prune_result_body.tpl") + ); + reset($forum_rows); + while(list(, $forum_data) = each ($forum_rows)) + { + $p_result = prune($forum_data['forum_id'], $prunedate); + $template->assign_block_vars("prune_results", array( + "FORUM_NAME" => $forum_data['forum_name'], + "FORUM_TOPICS" => $p_result['topics'], + "FORUM_POSTS" => $p_result['posts']) + ); + } + $template->assign_vars(array( + "PRUNE_MSG" => "Pruning of forums was successful") + ); +} +else +{ + // + // If they haven't selected a forum for pruning yet then + // display a select box to use for pruning. + // + if(empty($forum_id)) + { + // + // Output a selection table if no forum id has been specified. + // + $template->set_filenames(array( + "body" => "admin/forum_prune_select_body.tpl") + ); + $select_list = "\n"; + // + // Assign the template variables. + // + $template->assign_vars(array( + "S_FORUMPRUNE_ACTION" => append_sid("admin_forum_prune.$phpEx"), + "S_FORUMS_SELECT" => $select_list) + ); + } + else + { + // + // Output the form to retrieve Prune information. + // + $template->set_filenames(array( + "body" => "admin/forum_prune_body.tpl") + ); + + $forum_name = ($forum_id == "ALL") ? 'All Forums' : $forum_rows[0]['forum_name']; + $prune_data = "Prune Topics that haven't been posted to in the last "; + $prune_data .= " Days."; + $hidden_input = ""; + + // + // Assign the template variables. + // + $template->assign_vars(array( + "S_FORUMPRUNE_ACTION" => append_sid("admin_forum_prune.$phpEx"), + "FORUM_NAME" => $forum_name, + "S_PRUNE_DATA" => $prune_data, + "S_HIDDEN_VARS" => $hidden_input) + ); + } +} +// +// Actually output the page here. +// +$template->pparse("body"); + +include('page_footer_admin.'.$phpEx); + +?> -- cgit v1.2.1