Verzeichnisstruktur phpBB-2.0.0


Veröffentlicht
03.04.2002

So funktioniert es


Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück

Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

      (Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

admin_forum_prune.php

Zuletzt modifiziert: 09.10.2024, 12:51 - Dateigröße: 5.38 KiB


 001  <?php
 002  /***************************************************************************
 003  *                             admin_forum_prune.php
 004  *                              -------------------
 005  *     begin                : Mon Jul 31, 2001
 006  *     copyright            : (C) 2001 The phpBB Group
 007  *     email                : support@phpbb.com
 008  *
 009  *     $Id$
 010  *
 011  ****************************************************************************/
 012   
 013  /***************************************************************************
 014   *
 015   *   This program is free software; you can redistribute it and/or modify
 016   *   it under the terms of the GNU General Public License as published by
 017   *   the Free Software Foundation; either version 2 of the License, or
 018   *   (at your option) any later version.
 019   *
 020   ***************************************************************************/
 021   
 022  define('IN_PHPBB', true);
 023   
 024  if ( !empty($setmodules) )
 025  {
 026      $filename = basename(__FILE__);
 027      $module['Forums']['Prune'] = $filename;
 028   
 029      return;
 030  }
 031   
 032  //
 033  // Load default header
 034  //
 035  $phpbb_root_path = "./../";
 036  require($phpbb_root_path . 'extension.inc');
 037  require('./pagestart.' . $phpEx);
 038  require($phpbb_root_path . 'includes/prune.'.$phpEx);
 039  require($phpbb_root_path . 'includes/functions_admin.'.$phpEx); 
 040   
 041  //
 042  // Get the forum ID for pruning
 043  //
 044  if( isset($HTTP_GET_VARS[POST_FORUM_URL]) || isset($HTTP_POST_VARS[POST_FORUM_URL]) )
 045  {
 046      $forum_id = ( isset($HTTP_POST_VARS[POST_FORUM_URL]) ) ? $HTTP_POST_VARS[POST_FORUM_URL] : $HTTP_GET_VARS[POST_FORUM_URL];
 047   
 048      if( $forum_id == -1 )
 049      {
 050          $forum_sql = '';
 051      }
 052      else
 053      {
 054          $forum_id = intval($forum_id);
 055          $forum_sql = "AND forum_id = $forum_id";
 056      }
 057  }
 058  else
 059  {
 060      $forum_id = '';
 061      $forum_sql = '';
 062  }
 063  //
 064  // Get a list of forum's or the data for the forum that we are pruning.
 065  //
 066  $sql = "SELECT f.*
 067      FROM " . FORUMS_TABLE . " f, " . CATEGORIES_TABLE . " c
 068      WHERE c.cat_id = f.cat_id
 069      $forum_sql
 070      ORDER BY c.cat_order ASC, f.forum_order ASC";
 071  if( !($result = $db->sql_query($sql)) )
 072  {
 073      message_die(GENERAL_ERROR, 'Could not obtain list of forums for pruning', '', __LINE__, __FILE__, $sql);
 074  }
 075   
 076  $forum_rows = array();
 077  while( $row = $db->sql_fetchrow($result) )
 078  {
 079      $forum_rows[] = $row;
 080  }
 081   
 082  //
 083  // Check for submit to be equal to Prune. If so then proceed with the pruning.
 084  //
 085  if( isset($HTTP_POST_VARS['doprune']) )
 086  {
 087      $prunedays = ( isset($HTTP_POST_VARS['prunedays']) ) ? intval($HTTP_POST_VARS['prunedays']) : 0;
 088   
 089      // Convert days to seconds for timestamp functions...
 090      $prunedate = time() - ( $prunedays * 86400 );
 091   
 092      $template->set_filenames(array(
 093          'body' => 'admin/forum_prune_result_body.tpl')
 094      );
 095   
 096      for($i = 0; $i < count($forum_rows); $i++)
 097      {
 098          $p_result = prune($forum_rows[$i]['forum_id'], $prunedate);
 099          sync('forum', $forum_rows[$i]['forum_id']);
 100      
 101          $row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
 102          $row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
 103      
 104          $template->assign_block_vars('prune_results', array(
 105              'ROW_COLOR' => '#' . $row_color, 
 106              'ROW_CLASS' => $row_class, 
 107              'FORUM_NAME' => $forum_rows[$i]['forum_name'],
 108              'FORUM_TOPICS' => $p_result['topics'],
 109              'FORUM_POSTS' => $p_result['posts'])
 110          );
 111      }
 112   
 113      $template->assign_vars(array(
 114          'L_FORUM_PRUNE' => $lang['Forum_Prune'],
 115          'L_FORUM' => $lang['Forum'],
 116          'L_TOPICS_PRUNED' => $lang['Topics_pruned'],
 117          'L_POSTS_PRUNED' => $lang['Posts_pruned'],
 118          'L_PRUNE_RESULT' => $lang['Prune_success'])
 119      );
 120  }
 121  else
 122  {
 123      //
 124      // If they haven't selected a forum for pruning yet then
 125      // display a select box to use for pruning.
 126      //
 127      if( empty($HTTP_POST_VARS[POST_FORUM_URL]) )
 128      {
 129          //
 130          // Output a selection table if no forum id has been specified.
 131          //
 132          $template->set_filenames(array(
 133              'body' => 'admin/forum_prune_select_body.tpl')
 134          );
 135   
 136          $select_list = '<select name="' . POST_FORUM_URL . '">';
 137          $select_list .= '<option value="-1">' . $lang['All_Forums'] . '</option>';
 138   
 139          for($i = 0; $i < count($forum_rows); $i++)
 140          {
 141              $select_list .= '<option value="' . $forum_rows[$i]['forum_id'] . '">' . $forum_rows[$i]['forum_name'] . '</option>';
 142          }
 143          $select_list .= '</select>';
 144   
 145          //
 146          // Assign the template variables.
 147          //
 148          $template->assign_vars(array(
 149              'L_FORUM_PRUNE' => $lang['Forum_Prune'],
 150              'L_SELECT_FORUM' => $lang['Select_a_Forum'], 
 151              'L_LOOK_UP' => $lang['Look_up_Forum'],
 152   
 153              'S_FORUMPRUNE_ACTION' => append_sid("admin_forum_prune.$phpEx"),
 154              'S_FORUMS_SELECT' => $select_list)
 155          );
 156      }
 157      else
 158      {
 159          $forum_id = intval($HTTP_POST_VARS[POST_FORUM_URL]);
 160          
 161          //
 162          // Output the form to retrieve Prune information.
 163          //
 164          $template->set_filenames(array(
 165              'body' => 'admin/forum_prune_body.tpl')
 166          );
 167   
 168          $forum_name = ( $forum_id == -1 ) ? $lang['All_Forums'] : $forum_rows[0]['forum_name'];
 169   
 170          $prune_data = $lang['Prune_topics_not_posted'] . " "; 
 171          $prune_data .= '<input class="post" type="text" name="prunedays" size="4"> ' . $lang['Days'];
 172   
 173          $hidden_input = '<input type="hidden" name="' . POST_FORUM_URL . '" value="' . $forum_id . '" />';
 174   
 175          //
 176          // Assign the template variables.
 177          //
 178          $template->assign_vars(array(
 179              'FORUM_NAME' => $forum_name,
 180   
 181              'L_FORUM' => $lang['Forum'], 
 182              'L_FORUM_PRUNE' => $lang['Forum_Prune'], 
 183              'L_FORUM_PRUNE_EXPLAIN' => $lang['Forum_Prune_explain'], 
 184              'L_DO_PRUNE' => $lang['Do_Prune'],
 185   
 186              'S_FORUMPRUNE_ACTION' => append_sid("admin_forum_prune.$phpEx"),
 187              'S_PRUNE_DATA' => $prune_data,
 188              'S_HIDDEN_VARS' => $hidden_input)
 189          );
 190      }
 191  }
 192  //
 193  // Actually output the page here.
 194  //
 195  $template->pparse('body');
 196   
 197  include('./page_footer_admin.'.$phpEx);
 198   
 199  ?>