acl_get('a_prune')) { return; } $module['Forums']['Prune'] = basename(__FILE__) . $SID . '&mode=forums'; return; } define('IN_PHPBB', 1); // Include files $phpbb_root_path = '../'; require($phpbb_root_path . 'extension.inc'); require('pagestart.' . $phpEx); require($phpbb_root_path . 'includes/functions_admin.'.$phpEx); // Do we have permission? if (!$auth->acl_get('a_prune')) { trigger_error($user->lang['NO_ADMIN']); } // // Get the forum ID for pruning // if (isset($_REQUEST['f'])) { $forum_id = intval($_REQUEST['f']); $forum_sql = ($forum_id == -1) ? '' : "AND forum_id = $forum_id"; } else { $forum_id = ''; $forum_sql = ''; } // // Get a list of forum's or the data for the forum that we are pruning. // $sql = "SELECT forum_id, forum_name, left_id, right_id FROM " . FORUMS_TABLE . " ORDER BY left_id ASC"; $result = $db->sql_query($sql); $forum_rows = array(); while($row = $db->sql_fetchrow($result)) { $forum_rows[] = $row; } $db->sql_freeresult($result); // // Check for submit to be equal to Prune. If so then proceed with the pruning. // if (isset($_POST['doprune'])) { $prunedays = (isset($_POST['prunedays'])) ? intval($_POST['prunedays']) : 0; // Convert days to seconds for timestamp functions... $prunedate = time() - ($prunedays * 86400); $template->set_filenames(array( 'body' => 'admin/forum_prune_result_body.tpl') ); $log_data = ''; for($i = 0; $i < count($forum_rows); $i++) { $p_result = prune($forum_rows[$i]['forum_id'], $prunedate); sync('forum', $forum_rows[$i]['forum_id']); $template->assign_block_vars('prune_results', array( 'ROW_COLOR' => '#' . $row_color, 'ROW_CLASS' => $row_class, 'FORUM_NAME' => $forum_rows[$i]['forum_name'], 'FORUM_TOPICS' => $p_result['topics'], 'FORUM_POSTS' => $p_result['posts']) ); $log_data .= (($log_data != '') ? ', ' : '') . $forum_rows[$i]['forum_name']; } $template->assign_vars(array( 'L_FORUM_PRUNE' => $user->lang['Forum_Prune'], 'L_FORUM' => $user->lang['Forum'], 'L_TOPICS_PRUNED' => $user->lang['Topics_pruned'], 'L_POSTS_PRUNED' => $user->lang['Posts_pruned'], 'L_PRUNE_RESULT' => $user->lang['Prune_success']) ); add_admin_log('log_prune', $log_data); } else { page_header($user->lang['Prune']); // // 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. // $select_list = ''; $right = 0; $subforum = ''; $forum_list = ''; foreach ($forum_rows as $row) { if ($row['left_id'] < $right ) { $subforum .= '   '; } else if ($row['left_id'] > $right + 1) { $subforum = substr($subforum, 0, -18 * ($row['left_id'] - $right + 1)); } $select_list .= ''; $right = $row['right_id']; } ?>

lang['Prune']; ?>

lang['Forum_Prune_explain']; ?>

">
lang['Select_a_Forum']; ?>
    
lang['All_Forums'] : $forum_rows[0]['forum_name']; $prune_data = $user->lang['Prune_topics_not_posted'] . " "; $prune_data .= ' ' . $user->lang['Days']; $s_hidden_fields = ''; ?>

lang['Prune']; ?>

lang['Forum_Prune_explain']; ?>

lang['Forum'] . ': ' . $forum_name; ?>

">
lang['Forum_Prune']; ?>