1 | <?php |
---|
2 | // +-----------------------------------------------------------------------+ |
---|
3 | // | PhpWebGallery - a PHP based picture gallery | |
---|
4 | // | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net | |
---|
5 | // | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net | |
---|
6 | // +-----------------------------------------------------------------------+ |
---|
7 | // | branch : BSF (Best So Far) |
---|
8 | // | file : $RCSfile$ |
---|
9 | // | last update : $Date: 2005-08-19 13:54:40 +0000 (Fri, 19 Aug 2005) $ |
---|
10 | // | last modifier : $Author: plg $ |
---|
11 | // | revision : $Revision: 833 $ |
---|
12 | // +-----------------------------------------------------------------------+ |
---|
13 | // | This program is free software; you can redistribute it and/or modify | |
---|
14 | // | it under the terms of the GNU General Public License as published by | |
---|
15 | // | the Free Software Foundation | |
---|
16 | // | | |
---|
17 | // | This program is distributed in the hope that it will be useful, but | |
---|
18 | // | WITHOUT ANY WARRANTY; without even the implied warranty of | |
---|
19 | // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
---|
20 | // | General Public License for more details. | |
---|
21 | // | | |
---|
22 | // | You should have received a copy of the GNU General Public License | |
---|
23 | // | along with this program; if not, write to the Free Software | |
---|
24 | // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | |
---|
25 | // | USA. | |
---|
26 | // +-----------------------------------------------------------------------+ |
---|
27 | |
---|
28 | if (!defined('PHPWG_ROOT_PATH')) |
---|
29 | { |
---|
30 | die ("Hacking attempt!"); |
---|
31 | } |
---|
32 | include_once(PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php'); |
---|
33 | |
---|
34 | // +-----------------------------------------------------------------------+ |
---|
35 | // | actions | |
---|
36 | // +-----------------------------------------------------------------------+ |
---|
37 | |
---|
38 | $action = isset($_GET['action']) ? $_GET['action'] : ''; |
---|
39 | |
---|
40 | switch ($action) |
---|
41 | { |
---|
42 | case 'categories' : |
---|
43 | { |
---|
44 | update_uppercats(); |
---|
45 | update_category('all'); |
---|
46 | ordering(); |
---|
47 | update_global_rank(); |
---|
48 | break; |
---|
49 | } |
---|
50 | case 'images' : |
---|
51 | { |
---|
52 | update_path(); |
---|
53 | update_average_rate(); |
---|
54 | break; |
---|
55 | } |
---|
56 | case 'history' : |
---|
57 | { |
---|
58 | $query = ' |
---|
59 | DELETE |
---|
60 | FROM '.HISTORY_TABLE.' |
---|
61 | ;'; |
---|
62 | pwg_query($query); |
---|
63 | break; |
---|
64 | } |
---|
65 | case 'sessions' : |
---|
66 | { |
---|
67 | $query = ' |
---|
68 | DELETE |
---|
69 | FROM '.SESSIONS_TABLE.' |
---|
70 | WHERE expiration < NOW() |
---|
71 | ;'; |
---|
72 | pwg_query($query); |
---|
73 | break; |
---|
74 | } |
---|
75 | case 'feeds' : |
---|
76 | { |
---|
77 | $query = ' |
---|
78 | DELETE |
---|
79 | FROM '.USER_FEED_TABLE.' |
---|
80 | WHERE last_check IS NULL |
---|
81 | ;'; |
---|
82 | pwg_query($query); |
---|
83 | break; |
---|
84 | } |
---|
85 | default : |
---|
86 | { |
---|
87 | break; |
---|
88 | } |
---|
89 | } |
---|
90 | |
---|
91 | // +-----------------------------------------------------------------------+ |
---|
92 | // | template init | |
---|
93 | // +-----------------------------------------------------------------------+ |
---|
94 | |
---|
95 | $template->set_filenames(array('maintenance'=>'admin/maintenance.tpl')); |
---|
96 | |
---|
97 | $start_url = PHPWG_ROOT_PATH.'admin.php?page=maintenance&action='; |
---|
98 | |
---|
99 | $template->assign_vars( |
---|
100 | array( |
---|
101 | 'U_MAINT_CATEGORIES' => add_session_id($start_url.'categories'), |
---|
102 | 'U_MAINT_IMAGES' => add_session_id($start_url.'images'), |
---|
103 | 'U_MAINT_HISTORY' => add_session_id($start_url.'history'), |
---|
104 | 'U_MAINT_SESSIONS' => add_session_id($start_url.'sessions'), |
---|
105 | 'U_MAINT_FEEDS' => add_session_id($start_url.'feeds'), |
---|
106 | ) |
---|
107 | ); |
---|
108 | |
---|
109 | // +-----------------------------------------------------------------------+ |
---|
110 | // | sending html code | |
---|
111 | // +-----------------------------------------------------------------------+ |
---|
112 | |
---|
113 | $template->assign_var_from_handle('ADMIN_CONTENT', 'maintenance'); |
---|
114 | ?> |
---|