[2242] | 1 | <?php |
---|
| 2 | // +-----------------------------------------------------------------------+ |
---|
[2297] | 3 | // | Piwigo - a PHP based picture gallery | |
---|
| 4 | // +-----------------------------------------------------------------------+ |
---|
[3046] | 5 | // | Copyright(C) 2008-2009 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_new.tpl')); |
---|
[2255] | 32 | |
---|
[2263] | 33 | $order = isset($_GET['order']) ? $_GET['order'] : 'date'; |
---|
[2264] | 34 | $base_url = get_root_url().'admin.php?page='.$page['page'].'&order='.$order; |
---|
[2255] | 35 | |
---|
[2264] | 36 | $plugins = new plugins(); |
---|
[2242] | 37 | |
---|
| 38 | //------------------------------------------------------automatic installation |
---|
[2647] | 39 | if (isset($_GET['revision']) and isset($_GET['extension']) and !is_adviser()) |
---|
[2242] | 40 | { |
---|
[4506] | 41 | check_pwg_token(); |
---|
| 42 | |
---|
[2647] | 43 | $install_status = $plugins->extract_plugin_files('install', $_GET['revision'], $_GET['extension']); |
---|
[2264] | 44 | |
---|
| 45 | redirect($base_url.'&installstatus='.$install_status); |
---|
[2242] | 46 | } |
---|
| 47 | |
---|
| 48 | //--------------------------------------------------------------install result |
---|
| 49 | if (isset($_GET['installstatus'])) |
---|
| 50 | { |
---|
[2264] | 51 | switch ($_GET['installstatus']) |
---|
| 52 | { |
---|
| 53 | case 'ok': |
---|
| 54 | array_push($page['infos'], |
---|
| 55 | l10n('plugins_install_ok'), |
---|
| 56 | l10n('plugins_install_need_activate')); |
---|
| 57 | break; |
---|
| 58 | |
---|
| 59 | case 'temp_path_error': |
---|
| 60 | array_push($page['errors'], l10n('plugins_temp_path_error')); |
---|
| 61 | break; |
---|
| 62 | |
---|
| 63 | case 'dl_archive_error': |
---|
| 64 | array_push($page['errors'], l10n('plugins_dl_archive_error')); |
---|
| 65 | break; |
---|
| 66 | |
---|
| 67 | case 'archive_error': |
---|
| 68 | array_push($page['errors'], l10n('plugins_archive_error')); |
---|
| 69 | break; |
---|
| 70 | |
---|
| 71 | default: |
---|
| 72 | array_push($page['errors'], |
---|
| 73 | sprintf(l10n('plugins_extract_error'), $_GET['installstatus']), |
---|
| 74 | l10n('plugins_check_chmod')); |
---|
| 75 | } |
---|
[2242] | 76 | } |
---|
| 77 | |
---|
[2264] | 78 | //--------------------------------------------------------------------Tabsheet |
---|
[2272] | 79 | set_plugins_tabsheet($page['page']); |
---|
[2264] | 80 | |
---|
| 81 | //---------------------------------------------------------------Order options |
---|
[2272] | 82 | $link = get_root_url().'admin.php?page='.$page['page'].'&order='; |
---|
[2264] | 83 | $template->assign('order_options', |
---|
| 84 | array( |
---|
| 85 | $link.'date' => l10n('Post date'), |
---|
[2272] | 86 | $link.'revision' => l10n('plugins_revisions'), |
---|
[2264] | 87 | $link.'name' => l10n('Name'), |
---|
[3144] | 88 | $link.'author' => l10n('Author'), |
---|
| 89 | $link.'downloads' => l10n('Number of downloads'))); |
---|
[2264] | 90 | $template->assign('order_selected', $link.$order); |
---|
| 91 | |
---|
[2242] | 92 | // +-----------------------------------------------------------------------+ |
---|
| 93 | // | start template output | |
---|
| 94 | // +-----------------------------------------------------------------------+ |
---|
[2881] | 95 | if ($plugins->get_server_plugins(true)) |
---|
[2242] | 96 | { |
---|
[2272] | 97 | $plugins->sort_server_plugins($order); |
---|
| 98 | |
---|
[2263] | 99 | foreach($plugins->server_plugins as $plugin) |
---|
[2243] | 100 | { |
---|
[2647] | 101 | list($date, ) = explode(' ', $plugin['revision_date']); |
---|
| 102 | |
---|
[3144] | 103 | $ext_desc = '<i>'.l10n('Downloads').':</i> '.$plugin['extension_nb_downloads']."\r\n" |
---|
| 104 | ."\r\n" |
---|
| 105 | .$plugin['extension_description']; |
---|
[2245] | 106 | |
---|
[3144] | 107 | $rev_desc = '<i>'.l10n('Version').':</i> '.$plugin['revision_name']."\r\n" |
---|
| 108 | .'<i>'.l10n('Released on').':</i> '.$date."\r\n" |
---|
| 109 | .'<i>'.l10n('Downloads').':</i> '.$plugin['revision_nb_downloads']."\r\n" |
---|
| 110 | ."\r\n" |
---|
| 111 | .$plugin['revision_description']; |
---|
| 112 | |
---|
[2264] | 113 | $url_auto_install = htmlentities($base_url) |
---|
[2647] | 114 | . '&revision=' . $plugin['revision_id'] |
---|
[4506] | 115 | . '&extension=' . $plugin['extension_id'] |
---|
| 116 | . '&pwg_token='.get_pwg_token() |
---|
| 117 | ; |
---|
[2245] | 118 | |
---|
[2647] | 119 | $template->append('plugins', array( |
---|
| 120 | 'EXT_NAME' => $plugin['extension_name'], |
---|
| 121 | 'EXT_URL' => PEM_URL.'/extension_view.php?eid='.$plugin['extension_id'], |
---|
[3144] | 122 | 'EXT_DESC' => $ext_desc, |
---|
[2647] | 123 | 'VERSION' => $plugin['revision_name'], |
---|
| 124 | 'DATE' => $date, |
---|
[3144] | 125 | 'VER_DESC' => $rev_desc, |
---|
[2647] | 126 | 'AUTHOR' => $plugin['author_name'], |
---|
| 127 | 'URL_INSTALL' => $url_auto_install, |
---|
| 128 | 'URL_DOWNLOAD' => $plugin['download_url'] . '&origin=piwigo_download')); |
---|
[2243] | 129 | } |
---|
[2242] | 130 | } |
---|
| 131 | else |
---|
| 132 | { |
---|
[2243] | 133 | array_push($page['errors'], l10n('plugins_server_error')); |
---|
[2242] | 134 | } |
---|
| 135 | |
---|
[2255] | 136 | $template->assign_var_from_handle('ADMIN_CONTENT', 'plugins'); |
---|
[2242] | 137 | ?> |
---|