[809] | 1 | <?php |
---|
| 2 | // +-----------------------------------------------------------------------+ |
---|
[2297] | 3 | // | Piwigo - a PHP based picture gallery | |
---|
| 4 | // +-----------------------------------------------------------------------+ |
---|
| 5 | // | Copyright(C) 2008 Piwigo Team http://piwigo.org | |
---|
| 6 | // | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net | |
---|
| 7 | // | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick | |
---|
| 8 | // +-----------------------------------------------------------------------+ |
---|
| 9 | // | This program is free software; you can redistribute it and/or modify | |
---|
| 10 | // | it under the terms of the GNU General Public License as published by | |
---|
| 11 | // | the Free Software Foundation | |
---|
| 12 | // | | |
---|
| 13 | // | This program is distributed in the hope that it will be useful, but | |
---|
| 14 | // | WITHOUT ANY WARRANTY; without even the implied warranty of | |
---|
| 15 | // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
---|
| 16 | // | General Public License for more details. | |
---|
| 17 | // | | |
---|
| 18 | // | You should have received a copy of the GNU General Public License | |
---|
| 19 | // | along with this program; if not, write to the Free Software | |
---|
| 20 | // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | |
---|
| 21 | // | USA. | |
---|
| 22 | // +-----------------------------------------------------------------------+ |
---|
[809] | 23 | |
---|
| 24 | if (!defined('PHPWG_ROOT_PATH')) |
---|
| 25 | { |
---|
| 26 | die ("Hacking attempt!"); |
---|
| 27 | } |
---|
| 28 | |
---|
[1072] | 29 | include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); |
---|
| 30 | |
---|
[809] | 31 | // +-----------------------------------------------------------------------+ |
---|
[1072] | 32 | // | Check Access and exit when user status is not ok | |
---|
| 33 | // +-----------------------------------------------------------------------+ |
---|
| 34 | check_status(ACCESS_ADMINISTRATOR); |
---|
| 35 | |
---|
| 36 | // +-----------------------------------------------------------------------+ |
---|
[809] | 37 | // | actions | |
---|
| 38 | // +-----------------------------------------------------------------------+ |
---|
| 39 | |
---|
[1111] | 40 | $action = (isset($_GET['action']) and !is_adviser()) ? $_GET['action'] : ''; |
---|
[809] | 41 | |
---|
| 42 | switch ($action) |
---|
| 43 | { |
---|
| 44 | case 'categories' : |
---|
| 45 | { |
---|
| 46 | update_uppercats(); |
---|
| 47 | update_category('all'); |
---|
| 48 | update_global_rank(); |
---|
[1981] | 49 | invalidate_user_cache(); |
---|
[809] | 50 | break; |
---|
| 51 | } |
---|
| 52 | case 'images' : |
---|
| 53 | { |
---|
| 54 | update_path(); |
---|
| 55 | update_average_rate(); |
---|
| 56 | break; |
---|
| 57 | } |
---|
[2062] | 58 | case 'history_detail' : |
---|
[809] | 59 | { |
---|
| 60 | $query = ' |
---|
| 61 | DELETE |
---|
[2062] | 62 | FROM '.HISTORY_TABLE.' |
---|
[1987] | 63 | ;'; |
---|
| 64 | pwg_query($query); |
---|
[2062] | 65 | break; |
---|
| 66 | } |
---|
| 67 | case 'history_summary' : |
---|
| 68 | { |
---|
[1987] | 69 | $query = ' |
---|
| 70 | DELETE |
---|
[2062] | 71 | FROM '.HISTORY_SUMMARY_TABLE.' |
---|
[809] | 72 | ;'; |
---|
| 73 | pwg_query($query); |
---|
| 74 | break; |
---|
| 75 | } |
---|
| 76 | case 'sessions' : |
---|
| 77 | { |
---|
[1080] | 78 | pwg_session_gc(); |
---|
[809] | 79 | break; |
---|
| 80 | } |
---|
[833] | 81 | case 'feeds' : |
---|
| 82 | { |
---|
| 83 | $query = ' |
---|
| 84 | DELETE |
---|
| 85 | FROM '.USER_FEED_TABLE.' |
---|
| 86 | WHERE last_check IS NULL |
---|
| 87 | ;'; |
---|
| 88 | pwg_query($query); |
---|
| 89 | break; |
---|
| 90 | } |
---|
[1111] | 91 | case 'database' : |
---|
| 92 | { |
---|
| 93 | do_maintenance_all_tables(); |
---|
| 94 | break; |
---|
| 95 | } |
---|
[2208] | 96 | case 'c13y' : |
---|
| 97 | { |
---|
[2232] | 98 | include_once(PHPWG_ROOT_PATH.'admin/include/check_integrity.class.php'); |
---|
| 99 | $c13y = new check_integrity(); |
---|
| 100 | $c13y->maintenance(); |
---|
[2208] | 101 | break; |
---|
| 102 | } |
---|
[2251] | 103 | case 'compiled-templates' : |
---|
| 104 | { |
---|
[2278] | 105 | $template->delete_compiled_templates(); |
---|
[2251] | 106 | break; |
---|
| 107 | } |
---|
[809] | 108 | default : |
---|
| 109 | { |
---|
| 110 | break; |
---|
| 111 | } |
---|
| 112 | } |
---|
| 113 | |
---|
| 114 | // +-----------------------------------------------------------------------+ |
---|
| 115 | // | template init | |
---|
| 116 | // +-----------------------------------------------------------------------+ |
---|
| 117 | |
---|
| 118 | $template->set_filenames(array('maintenance'=>'admin/maintenance.tpl')); |
---|
| 119 | |
---|
[2251] | 120 | $start_url = get_root_url().'admin.php?page=maintenance&action='; |
---|
[809] | 121 | |
---|
[2251] | 122 | $template->assign( |
---|
[1111] | 123 | array( |
---|
| 124 | 'U_MAINT_CATEGORIES' => $start_url.'categories', |
---|
| 125 | 'U_MAINT_IMAGES' => $start_url.'images', |
---|
[2062] | 126 | 'U_MAINT_HISTORY_DETAIL' => $start_url.'history_detail', |
---|
| 127 | 'U_MAINT_HISTORY_SUMMARY' => $start_url.'history_summary', |
---|
[1111] | 128 | 'U_MAINT_SESSIONS' => $start_url.'sessions', |
---|
| 129 | 'U_MAINT_FEEDS' => $start_url.'feeds', |
---|
| 130 | 'U_MAINT_DATABASE' => $start_url.'database', |
---|
[2208] | 131 | 'U_MAINT_C13Y' => $start_url.'c13y', |
---|
[2251] | 132 | 'U_MAINT_COMPILED_TEMPLATES' => $start_url.'compiled-templates', |
---|
[1250] | 133 | 'U_HELP' => PHPWG_ROOT_PATH.'popuphelp.php?page=maintenance', |
---|
[1111] | 134 | ) |
---|
| 135 | ); |
---|
[1080] | 136 | |
---|
[809] | 137 | // +-----------------------------------------------------------------------+ |
---|
| 138 | // | sending html code | |
---|
| 139 | // +-----------------------------------------------------------------------+ |
---|
| 140 | |
---|
| 141 | $template->assign_var_from_handle('ADMIN_CONTENT', 'maintenance'); |
---|
| 142 | ?> |
---|