[2242] | 1 | <?php |
---|
| 2 | // +-----------------------------------------------------------------------+ |
---|
[2297] | 3 | // | Piwigo - a PHP based picture gallery | |
---|
| 4 | // +-----------------------------------------------------------------------+ |
---|
[5196] | 5 | // | Copyright(C) 2008-2010 Piwigo Team http://piwigo.org | |
---|
[2297] | 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 | // +-----------------------------------------------------------------------+ |
---|
[2242] | 23 | |
---|
| 24 | if( !defined("PHPWG_ROOT_PATH") ) |
---|
| 25 | { |
---|
| 26 | die ("Hacking attempt!"); |
---|
| 27 | } |
---|
| 28 | |
---|
[2263] | 29 | include_once(PHPWG_ROOT_PATH.'admin/include/plugins.class.php'); |
---|
[2255] | 30 | |
---|
[2530] | 31 | $template->set_filenames(array('plugins' => 'plugins_list.tpl')); |
---|
[2255] | 32 | |
---|
[5475] | 33 | $base_url = get_root_url().'admin.php?page='.$page['page']; |
---|
[5195] | 34 | $action_url = $base_url.'&plugin='.'%s'.'&pwg_token='.get_pwg_token(); |
---|
[2255] | 35 | |
---|
[2264] | 36 | $plugins = new plugins(); |
---|
| 37 | |
---|
[2263] | 38 | //--------------------------------------------------perform requested actions |
---|
| 39 | if (isset($_GET['action']) and isset($_GET['plugin']) and !is_adviser()) |
---|
[2255] | 40 | { |
---|
[5195] | 41 | check_pwg_token(); |
---|
[5691] | 42 | |
---|
[3950] | 43 | $page['errors'] = $plugins->perform_action($_GET['action'], $_GET['plugin']); |
---|
[2264] | 44 | |
---|
[3950] | 45 | if (empty($page['errors'])) |
---|
| 46 | { |
---|
| 47 | if ($_GET['action'] == 'activate' or $_GET['action'] == 'deactivate') |
---|
| 48 | { |
---|
| 49 | $template->delete_compiled_templates(); |
---|
| 50 | } |
---|
| 51 | redirect($base_url); |
---|
| 52 | } |
---|
[2255] | 53 | } |
---|
| 54 | |
---|
[2264] | 55 | //--------------------------------------------------------------------Tabsheet |
---|
[5367] | 56 | $plugins->set_tabsheet($page['page']); |
---|
[2264] | 57 | |
---|
[2255] | 58 | // +-----------------------------------------------------------------------+ |
---|
| 59 | // | start template output | |
---|
| 60 | // +-----------------------------------------------------------------------+ |
---|
[5474] | 61 | |
---|
[5475] | 62 | $plugins->sort_fs_plugins('name'); |
---|
[2264] | 63 | |
---|
[2263] | 64 | foreach($plugins->fs_plugins as $plugin_id => $fs_plugin) |
---|
[2242] | 65 | { |
---|
[5474] | 66 | $tpl_plugin = array( |
---|
| 67 | 'NAME' => $fs_plugin['name'], |
---|
| 68 | 'VISIT_URL' => $fs_plugin['uri'], |
---|
| 69 | 'VERSION' => $fs_plugin['version'], |
---|
| 70 | 'DESC' => $fs_plugin['description'], |
---|
| 71 | 'AUTHOR' => $fs_plugin['author'], |
---|
[5691] | 72 | 'AUTHOR_URL' => @$fs_plugin['author uri'], |
---|
[5474] | 73 | 'U_ACTION' => sprintf($action_url, $plugin_id) |
---|
| 74 | ); |
---|
[2242] | 75 | |
---|
[2263] | 76 | if (isset($plugins->db_plugins_by_id[$plugin_id])) |
---|
[2293] | 77 | { |
---|
| 78 | $tpl_plugin['STATE'] = $plugins->db_plugins_by_id[$plugin_id]['state']; |
---|
[2242] | 79 | } |
---|
| 80 | else |
---|
| 81 | { |
---|
[2631] | 82 | $tpl_plugin['STATE'] = 'uninstalled'; |
---|
[2242] | 83 | } |
---|
[5474] | 84 | |
---|
[2242] | 85 | $template->append('plugins', $tpl_plugin); |
---|
| 86 | } |
---|
| 87 | |
---|
| 88 | $missing_plugin_ids = array_diff( |
---|
[5474] | 89 | array_keys($plugins->db_plugins_by_id), |
---|
| 90 | array_keys($plugins->fs_plugins) |
---|
| 91 | ); |
---|
[2242] | 92 | |
---|
| 93 | foreach($missing_plugin_ids as $plugin_id) |
---|
| 94 | { |
---|
[5474] | 95 | $template->append( |
---|
| 96 | 'plugins', |
---|
| 97 | array( |
---|
| 98 | 'NAME' => $plugin_id, |
---|
| 99 | 'VERSION' => $plugins->db_plugins_by_id[$plugin_id]['version'], |
---|
| 100 | 'DESC' => "ERROR: THIS PLUGIN IS MISSING BUT IT IS INSTALLED! UNINSTALL IT NOW !", |
---|
| 101 | 'U_ACTION' => sprintf($action_url, $plugin_id), |
---|
| 102 | 'STATE' => 'missing', |
---|
[2631] | 103 | ) |
---|
| 104 | ); |
---|
[2242] | 105 | } |
---|
| 106 | |
---|
[5474] | 107 | $template->append('plugin_states', 'active'); |
---|
| 108 | $template->append('plugin_states', 'inactive'); |
---|
| 109 | $template->append('plugin_states', 'uninstalled'); |
---|
| 110 | |
---|
| 111 | if (count($missing_plugin_ids) > 0) |
---|
| 112 | { |
---|
| 113 | $template->append('plugin_states', 'missing'); |
---|
| 114 | } |
---|
[5691] | 115 | |
---|
[2255] | 116 | $template->assign_var_from_handle('ADMIN_CONTENT', 'plugins'); |
---|
[2242] | 117 | ?> |
---|