| 
      1
     | 
    
      <?php
 
     | 
  
  
    | 
      2
     | 
    
      
 
     | 
  
  
    | 
      3
     | 
    
      // $Id: empty_trash.php 519 2007-12-23 14:37:02Z Ruebenwurzel $
 
     | 
  
  
    | 
      4
     | 
    
      
 
     | 
  
  
    | 
      5
     | 
    
      /*
 
     | 
  
  
    | 
      6
     | 
    
      
 
     | 
  
  
    | 
      7
     | 
    
       Website Baker Project <http://www.websitebaker.org/>
 
     | 
  
  
    | 
      8
     | 
    
       Copyright (C) 2004-2008, Ryan Djurovich
 
     | 
  
  
    | 
      9
     | 
    
      
 
     | 
  
  
    | 
      10
     | 
    
       Website Baker is free software; you can redistribute it and/or modify
 
     | 
  
  
    | 
      11
     | 
    
       it under the terms of the GNU General Public License as published by
 
     | 
  
  
    | 
      12
     | 
    
       the Free Software Foundation; either version 2 of the License, or
 
     | 
  
  
    | 
      13
     | 
    
       (at your option) any later version.
 
     | 
  
  
    | 
      14
     | 
    
      
 
     | 
  
  
    | 
      15
     | 
    
       Website Baker is distributed in the hope that it will be useful,
 
     | 
  
  
    | 
      16
     | 
    
       but WITHOUT ANY WARRANTY; without even the implied warranty of
 
     | 
  
  
    | 
      17
     | 
    
       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
     | 
  
  
    | 
      18
     | 
    
       GNU General Public License for more details.
 
     | 
  
  
    | 
      19
     | 
    
      
 
     | 
  
  
    | 
      20
     | 
    
       You should have received a copy of the GNU General Public License
 
     | 
  
  
    | 
      21
     | 
    
       along with Website Baker; if not, write to the Free Software
 
     | 
  
  
    | 
      22
     | 
    
       Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
     | 
  
  
    | 
      23
     | 
    
      
 
     | 
  
  
    | 
      24
     | 
    
      */
 
     | 
  
  
    | 
      25
     | 
    
      
 
     | 
  
  
    | 
      26
     | 
    
      require('../../config.php');
     | 
  
  
    | 
      27
     | 
    
      require_once(WB_PATH.'/framework/class.admin.php');
 
     | 
  
  
    | 
      28
     | 
    
      $admin = new admin('Pages', 'pages');
     | 
  
  
    | 
      29
     | 
    
      
 
     | 
  
  
    | 
      30
     | 
    
      // Include the WB functions file
 
     | 
  
  
    | 
      31
     | 
    
      require_once(WB_PATH.'/framework/functions.php');
 
     | 
  
  
    | 
      32
     | 
    
      
 
     | 
  
  
    | 
      33
     | 
    
      // Get page list from database
 
     | 
  
  
    | 
      34
     | 
    
      $database = new database();
 
     | 
  
  
    | 
      35
     | 
    
      $query = "SELECT * FROM ".TABLE_PREFIX."pages WHERE visibility = 'deleted' ORDER BY level DESC";
 
     | 
  
  
    | 
      36
     | 
    
      $get_pages = $database->query($query);
 
     | 
  
  
    | 
      37
     | 
    
      
 
     | 
  
  
    | 
      38
     | 
    
      // Insert values into main page list
 
     | 
  
  
    | 
      39
     | 
    
      if($get_pages->numRows() > 0)	{
     | 
  
  
    | 
      40
     | 
    
      	while($page = $get_pages->fetchRow()) {
     | 
  
  
    | 
      41
     | 
    
      		// Delete page subs
 
     | 
  
  
    | 
      42
     | 
    
      		$sub_pages = get_subs($page['page_id'], array());
 
     | 
  
  
    | 
      43
     | 
    
      		foreach($sub_pages AS $sub_page_id) {
     | 
  
  
    | 
      44
     | 
    
      			delete_page($sub_page_id);
 
     | 
  
  
    | 
      45
     | 
    
      		}	
 
     | 
  
  
    | 
      46
     | 
    
      		// Delete page
 
     | 
  
  
    | 
      47
     | 
    
      		delete_page($page['page_id']);
 
     | 
  
  
    | 
      48
     | 
    
      	}
 
     | 
  
  
    | 
      49
     | 
    
      }
 
     | 
  
  
    | 
      50
     | 
    
      
 
     | 
  
  
    | 
      51
     | 
    
      // Check if there is a db error, otherwise say successful
 
     | 
  
  
    | 
      52
     | 
    
      if($database->is_error()) {
     | 
  
  
    | 
      53
     | 
    
      	$admin->print_error($database->get_error());
 
     | 
  
  
    | 
      54
     | 
    
      } else {
     | 
  
  
    | 
      55
     | 
    
      	$admin->print_success($TEXT['TRASH_EMPTIED']);
 
     | 
  
  
    | 
      56
     | 
    
      }
 
     | 
  
  
    | 
      57
     | 
    
      
 
     | 
  
  
    | 
      58
     | 
    
      // Print admin 
 
     | 
  
  
    | 
      59
     | 
    
      $admin->print_footer();
 
     | 
  
  
    | 
      60
     | 
    
      
 
     | 
  
  
    | 
      61
     | 
    
      ?>
 
     |