diff options
author | patdenice <patdenice@piwigo.org> | 2011-04-23 12:48:05 +0000 |
---|---|---|
committer | patdenice <patdenice@piwigo.org> | 2011-04-23 12:48:05 +0000 |
commit | 790f6b3bb6e4bf888a7fdb36f87a763cdb8ca450 (patch) | |
tree | 57cce0c848c48c18e17013138509e9d0b2bbbb03 /admin | |
parent | d7dfe63e113a069b05a363fa339db3cd7274ead1 (diff) |
Change tabsheet place for plugins, themes and languages.
Plugins, themes and languages use same update page.
git-svn-id: http://piwigo.org/svn/trunk@10594 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'admin')
-rw-r--r-- | admin/include/functions.php | 10 | ||||
-rw-r--r-- | admin/include/languages.class.php | 18 | ||||
-rw-r--r-- | admin/include/plugins.class.php | 18 | ||||
-rw-r--r-- | admin/include/themes.class.php | 18 | ||||
-rw-r--r-- | admin/include/updates.class.php | 7 | ||||
-rw-r--r-- | admin/languages.php | 50 | ||||
-rw-r--r-- | admin/languages_installed.php | 1 | ||||
-rw-r--r-- | admin/languages_new.php | 1 | ||||
-rw-r--r-- | admin/languages_update.php | 133 | ||||
-rw-r--r-- | admin/plugins.php | 50 | ||||
-rw-r--r-- | admin/plugins_installed.php (renamed from admin/plugins_list.php) | 3 | ||||
-rw-r--r-- | admin/plugins_new.php | 5 | ||||
-rw-r--r-- | admin/plugins_update.php | 153 | ||||
-rw-r--r-- | admin/themes.php | 50 | ||||
-rw-r--r-- | admin/themes/default/template/languages_update.tpl | 58 | ||||
-rw-r--r-- | admin/themes/default/template/plugins_list.tpl | 2 | ||||
-rw-r--r-- | admin/themes/default/template/plugins_update.tpl | 58 | ||||
-rw-r--r-- | admin/themes/default/template/themes_update.tpl | 58 | ||||
-rw-r--r-- | admin/themes_installed.php | 1 | ||||
-rw-r--r-- | admin/themes_new.php | 1 | ||||
-rw-r--r-- | admin/themes_update.php | 133 |
21 files changed, 161 insertions, 667 deletions
diff --git a/admin/include/functions.php b/admin/include/functions.php index 3d32e7b0e..edc09048e 100644 --- a/admin/include/functions.php +++ b/admin/include/functions.php @@ -2072,9 +2072,7 @@ function get_active_menu($menu_page) case 'notification_by_mail': return 2; - case 'plugins_list': - case 'plugins_update': - case 'plugins_new': + case 'plugins': case 'plugin': return 3; @@ -2091,11 +2089,9 @@ function get_active_menu($menu_page) case 'configuration': case 'extend_for_templates': case 'menubar': - case 'themes_new': - case 'themes_installed': + case 'themes': case 'theme': - case 'languages_installed': - case 'languages_new': + case 'languages': return 5; } return 0; diff --git a/admin/include/languages.class.php b/admin/include/languages.class.php index c19385412..cfcacc934 100644 --- a/admin/include/languages.class.php +++ b/admin/include/languages.class.php @@ -36,24 +36,6 @@ class languages } /** - * Set tabsheet for languages pages. - * @param string selected page. - */ - function set_tabsheet($selected) - { - include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php'); - - $link = get_root_url().'admin.php?page='; - - $tabsheet = new tabsheet(); - $tabsheet->add('languages_installed', l10n('Installed Languages'), $link.'languages_installed'); - $tabsheet->add('languages_update', l10n('Check for updates'), $link.'languages_update'); - $tabsheet->add('languages_new', l10n('Add New Language'), $link.'languages_new'); - $tabsheet->select($selected); - $tabsheet->assign(); - } - - /** * Perform requested actions * @param string - action * @param string - language id diff --git a/admin/include/plugins.class.php b/admin/include/plugins.class.php index 3f7cf4567..d1b8f5c5b 100644 --- a/admin/include/plugins.class.php +++ b/admin/include/plugins.class.php @@ -41,24 +41,6 @@ class plugins } } - /** - * Set tabsheet for plugins pages. - * @param string selected page. - */ - function set_tabsheet($selected) - { - include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php'); - - $link = get_root_url().'admin.php?page='; - - $tabsheet = new tabsheet(); - $tabsheet->add('plugins_list', l10n('Plugin list'), $link.'plugins_list'); - $tabsheet->add('plugins_update', l10n('Check for updates'), $link.'plugins_update'); - $tabsheet->add('plugins_new', l10n('Other plugins'), $link.'plugins_new'); - $tabsheet->select($selected); - $tabsheet->assign(); - } - /** * Perform requested actions * @param string - action diff --git a/admin/include/themes.class.php b/admin/include/themes.class.php index 78716214e..294046976 100644 --- a/admin/include/themes.class.php +++ b/admin/include/themes.class.php @@ -41,24 +41,6 @@ class themes } /** - * Set tabsheet for themes pages. - * @param string selected page. - */ - function set_tabsheet($selected) - { - include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php'); - - $link = get_root_url().'admin.php?page='; - - $tabsheet = new tabsheet(); - $tabsheet->add('themes_installed', l10n('Installed Themes'), $link.'themes_installed'); - $tabsheet->add('themes_update', l10n('Check for updates'), $link.'themes_update'); - $tabsheet->add('themes_new', l10n('Add New Theme'), $link.'themes_new'); - $tabsheet->select($selected); - $tabsheet->assign(); - } - - /** * Perform requested actions * @param string - action * @param string - theme id diff --git a/admin/include/updates.class.php b/admin/include/updates.class.php index b53001488..def4a1a2d 100644 --- a/admin/include/updates.class.php +++ b/admin/include/updates.class.php @@ -15,9 +15,14 @@ class updates var $merged_extensions = array();
var $merged_extension_url = 'http://piwigo.org/download/merged_extensions.txt';
- function __construct()
+ function __construct($page='updates')
{
$this->types = array('plugins', 'themes', 'languages');
+
+ if (in_array($page, $this->types))
+ {
+ $this->types = array($page);
+ }
$this->default_themes = array('clear', 'dark', 'Sylvia');
$this->default_plugins = array('admin_multi_view', 'c13y_upgrade', 'language_switch', 'LocalFilesEditor');
diff --git a/admin/languages.php b/admin/languages.php new file mode 100644 index 000000000..095fd7670 --- /dev/null +++ b/admin/languages.php @@ -0,0 +1,50 @@ +<?php +// +-----------------------------------------------------------------------+ +// | Piwigo - a PHP based photo gallery | +// +-----------------------------------------------------------------------+ +// | Copyright(C) 2008-2011 Piwigo Team http://piwigo.org | +// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net | +// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick | +// +-----------------------------------------------------------------------+ +// | This program is free software; you can redistribute it and/or modify | +// | it under the terms of the GNU General Public License as published by | +// | the Free Software Foundation | +// | | +// | This program is distributed in the hope that it will be useful, but | +// | WITHOUT ANY WARRANTY; without even the implied warranty of | +// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | +// | General Public License for more details. | +// | | +// | You should have received a copy of the GNU General Public License | +// | along with this program; if not, write to the Free Software | +// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | +// | USA. | +// +-----------------------------------------------------------------------+ + +if( !defined("PHPWG_ROOT_PATH") ) +{ + die ("Hacking attempt!"); +} + +include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php'); + +$my_base_url = get_root_url().'admin.php?page=languages'; + +if (isset($_GET['tab'])) + $page['tab'] = $_GET['tab']; +else + $page['tab'] = 'installed'; + +$tabsheet = new tabsheet(); +$tabsheet->add('installed', l10n('Installed Languages'), $my_base_url.'&tab=installed'); +$tabsheet->add('update', l10n('Check for updates'), $my_base_url.'&tab=update'); +$tabsheet->add('new', l10n('Add New Language'), $my_base_url.'&tab=new'); +$tabsheet->select($page['tab']); +$tabsheet->assign(); + +if ($page['tab'] == 'update') + include(PHPWG_ROOT_PATH.'admin/updates_ext.php'); +else + include(PHPWG_ROOT_PATH.'admin/languages_'.$page['tab'].'.php'); + +?>
\ No newline at end of file diff --git a/admin/languages_installed.php b/admin/languages_installed.php index 2f4c23f30..93e719491 100644 --- a/admin/languages_installed.php +++ b/admin/languages_installed.php @@ -34,7 +34,6 @@ $base_url = get_root_url().'admin.php?page='.$page['page']; $languages = new languages(); $languages->get_db_languages(); -$languages->set_tabsheet($page['page']); //--------------------------------------------------perform requested actions if (isset($_GET['action']) and isset($_GET['language'])) diff --git a/admin/languages_new.php b/admin/languages_new.php index 6f3d0abfa..9d10c5b8e 100644 --- a/admin/languages_new.php +++ b/admin/languages_new.php @@ -34,7 +34,6 @@ $base_url = get_root_url().'admin.php?page='.$page['page']; $languages = new languages(); $languages->get_db_languages(); -$languages->set_tabsheet($page['page']); // +-----------------------------------------------------------------------+ // | setup check | diff --git a/admin/languages_update.php b/admin/languages_update.php deleted file mode 100644 index 238113049..000000000 --- a/admin/languages_update.php +++ /dev/null @@ -1,133 +0,0 @@ -<?php -// +-----------------------------------------------------------------------+ -// | Piwigo - a PHP based photo gallery | -// +-----------------------------------------------------------------------+ -// | Copyright(C) 2008-2011 Piwigo Team http://piwigo.org | -// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net | -// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick | -// +-----------------------------------------------------------------------+ -// | This program is free software; you can redistribute it and/or modify | -// | it under the terms of the GNU General Public License as published by | -// | the Free Software Foundation | -// | | -// | This program is distributed in the hope that it will be useful, but | -// | WITHOUT ANY WARRANTY; without even the implied warranty of | -// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | -// | General Public License for more details. | -// | | -// | You should have received a copy of the GNU General Public License | -// | along with this program; if not, write to the Free Software | -// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | -// | USA. | -// +-----------------------------------------------------------------------+ - - -if( !defined("PHPWG_ROOT_PATH") ) -{ - die ("Hacking attempt!"); -} - -include_once(PHPWG_ROOT_PATH.'admin/include/languages.class.php'); - -$base_url = get_root_url().'admin.php?page='.$page['page']; - -$languages = new languages(); - -$languages->set_tabsheet($page['page']); - -//-----------------------------------------------------------automatic upgrade -if (isset($_GET['language']) and isset($_GET['revision'])) -{ - if (!is_webmaster()) - { - array_push($page['errors'], l10n('Webmaster status is required.')); - } - else - { - check_pwg_token(); - - $language_id = $_GET['language']; - $revision = $_GET['revision']; - - $upgrade_status = $languages->extract_language_files('upgrade', $revision, $language_id); - - switch ($upgrade_status) - { - case 'ok': - array_push($page['infos'], - sprintf( - l10n('%s has been successfully upgraded.'), - $languages->fs_languages[$_GET['language']]['name'])); - break; - - case 'temp_path_error': - array_push($page['errors'], l10n('Can\'t create temporary file.')); - break; - - case 'dl_archive_error': - array_push($page['errors'], l10n('Can\'t download archive.')); - break; - - case 'archive_error': - array_push($page['errors'], l10n('Can\'t read or extract archive.')); - break; - - default: - array_push($page['errors'], - sprintf(l10n('An error occured during extraction (%s).'), $upgrade_status) - ); - } - - $languages->languages(); - $template->delete_compiled_templates(); - } -} - -// +-----------------------------------------------------------------------+ -// | start template output | -// +-----------------------------------------------------------------------+ -$template->set_filenames(array('languages' => 'languages_update.tpl')); - -if ($languages->get_server_languages()) -{ - foreach($languages->fs_languages as $language_id => $fs_language) - { - if (isset($fs_language['extension']) - and isset($languages->server_languages[$fs_language['extension']])) - { - $language_info = $languages->server_languages[$fs_language['extension']]; - - if (!$languages->language_version_compare($fs_language['version'], $language_info['revision_name'])) - { - $url_auto_update = $base_url - . '&revision=' . $language_info['revision_id'] - . '&language=' . $language_id - . '&pwg_token='.get_pwg_token() - ; - - $template->append('update_languages', array( - 'ID' => $language_info['extension_id'], - 'EXT_NAME' => $fs_language['name'], - 'EXT_URL' => PEM_URL.'/extension_view.php?eid='.$language_info['extension_id'], - 'EXT_DESC' => trim($language_info['extension_description'], " \n\r"), - 'REV_DESC' => trim($language_info['revision_description'], " \n\r"), - 'CURRENT_VERSION' => $fs_language['version'], - 'NEW_VERSION' => $language_info['revision_name'], - 'AUTHOR' => $language_info['author_name'], - 'DOWNLOADS' => $language_info['extension_nb_downloads'], - 'URL_UPDATE' => $url_auto_update, - 'URL_DOWNLOAD' => $language_info['download_url'] . '&origin=piwigo_download' - ) - ); - } - } - } -} -else -{ - $template->assign('SERVER_ERROR', true); - array_push($page['errors'], l10n('Can\'t connect to server.')); -} - -$template->assign_var_from_handle('ADMIN_CONTENT', 'languages'); -?>
\ No newline at end of file diff --git a/admin/plugins.php b/admin/plugins.php new file mode 100644 index 000000000..7b2a7152d --- /dev/null +++ b/admin/plugins.php @@ -0,0 +1,50 @@ +<?php +// +-----------------------------------------------------------------------+ +// | Piwigo - a PHP based photo gallery | +// +-----------------------------------------------------------------------+ +// | Copyright(C) 2008-2011 Piwigo Team http://piwigo.org | +// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net | +// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick | +// +-----------------------------------------------------------------------+ +// | This program is free software; you can redistribute it and/or modify | +// | it under the terms of the GNU General Public License as published by | +// | the Free Software Foundation | +// | | +// | This program is distributed in the hope that it will be useful, but | +// | WITHOUT ANY WARRANTY; without even the implied warranty of | +// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | +// | General Public License for more details. | +// | | +// | You should have received a copy of the GNU General Public License | +// | along with this program; if not, write to the Free Software | +// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | +// | USA. | +// +-----------------------------------------------------------------------+ + +if( !defined("PHPWG_ROOT_PATH") ) +{ + die ("Hacking attempt!"); +} + +include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php'); + +$my_base_url = get_root_url().'admin.php?page=plugins'; + +if (isset($_GET['tab'])) + $page['tab'] = $_GET['tab']; +else + $page['tab'] = 'installed'; + +$tabsheet = new tabsheet(); +$tabsheet->add('installed', l10n('Plugin list'), $my_base_url.'&tab=installed'); +$tabsheet->add('update', l10n('Check for updates'), $my_base_url.'&tab=update'); +$tabsheet->add('new', l10n('Other plugins'), $my_base_url.'&tab=new'); +$tabsheet->select($page['tab']); +$tabsheet->assign(); + +if ($page['tab'] == 'update') + include(PHPWG_ROOT_PATH.'admin/updates_ext.php'); +else + include(PHPWG_ROOT_PATH.'admin/plugins_'.$page['tab'].'.php'); + +?>
\ No newline at end of file diff --git a/admin/plugins_list.php b/admin/plugins_installed.php index 3f38356b5..70fd734f5 100644 --- a/admin/plugins_list.php +++ b/admin/plugins_installed.php @@ -64,9 +64,6 @@ if (isset($_GET['action']) and isset($_GET['plugin'])) } } -//--------------------------------------------------------------------Tabsheet -$plugins->set_tabsheet($page['page']); - // +-----------------------------------------------------------------------+ // | start template output | // +-----------------------------------------------------------------------+ diff --git a/admin/plugins_new.php b/admin/plugins_new.php index 710ce8eec..1b1e9befb 100644 --- a/admin/plugins_new.php +++ b/admin/plugins_new.php @@ -30,7 +30,7 @@ include_once(PHPWG_ROOT_PATH.'admin/include/plugins.class.php'); $template->set_filenames(array('plugins' => 'plugins_new.tpl')); -$base_url = get_root_url().'admin.php?page='.$page['page']; +$base_url = get_root_url().'admin.php?page='.$page['page'].'&'.$page['tab']; $plugins = new plugins(); @@ -81,9 +81,6 @@ if (isset($_GET['installstatus'])) } } -//--------------------------------------------------------------------Tabsheet -$plugins->set_tabsheet($page['page']); - //---------------------------------------------------------------Order options $template->assign('order_options', array( diff --git a/admin/plugins_update.php b/admin/plugins_update.php deleted file mode 100644 index 1ed176daa..000000000 --- a/admin/plugins_update.php +++ /dev/null @@ -1,153 +0,0 @@ -<?php -// +-----------------------------------------------------------------------+ -// | Piwigo - a PHP based photo gallery | -// +-----------------------------------------------------------------------+ -// | Copyright(C) 2008-2011 Piwigo Team http://piwigo.org | -// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net | -// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick | -// +-----------------------------------------------------------------------+ -// | This program is free software; you can redistribute it and/or modify | -// | it under the terms of the GNU General Public License as published by | -// | the Free Software Foundation | -// | | -// | This program is distributed in the hope that it will be useful, but | -// | WITHOUT ANY WARRANTY; without even the implied warranty of | -// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | -// | General Public License for more details. | -// | | -// | You should have received a copy of the GNU General Public License | -// | along with this program; if not, write to the Free Software | -// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | -// | USA. | -// +-----------------------------------------------------------------------+ - -if( !defined("PHPWG_ROOT_PATH") ) -{ - die ("Hacking attempt!"); -} - -include_once(PHPWG_ROOT_PATH.'admin/include/plugins.class.php'); - -$template->set_filenames(array('plugins' => 'plugins_update.tpl')); - -$base_url = get_root_url().'admin.php?page='.$page['page']; - -$plugins = new plugins(); - -//-----------------------------------------------------------automatic upgrade -if (isset($_GET['plugin']) and isset($_GET['revision'])) -{ - if (!is_webmaster()) - { - array_push($page['errors'], l10n('Webmaster status is required.')); - } - else - { - check_pwg_token(); - - $plugin_id = $_GET['plugin']; - $revision = $_GET['revision']; - - if (isset($plugins->db_plugins_by_id[$plugin_id]) - and $plugins->db_plugins_by_id[$plugin_id]['state'] == 'active') - { - $plugins->perform_action('deactivate', $plugin_id); - - redirect($base_url - . '&revision=' . $revision - . '&plugin=' . $plugin_id - . '&pwg_token='.get_pwg_token() - . '&reactivate=true'); - } - - $upgrade_status = $plugins->extract_plugin_files('upgrade', $revision, $plugin_id); - - if (isset($_GET['reactivate'])) - { - $plugins->perform_action('activate', $plugin_id); - } - - $template->delete_compiled_templates(); - - redirect($base_url.'&plugin='.$plugin_id.'&upgradestatus='.$upgrade_status); - } -} - -//--------------------------------------------------------------upgrade result -if (isset($_GET['upgradestatus']) and isset($_GET['plugin'])) -{ - switch ($_GET['upgradestatus']) - { - case 'ok': - array_push($page['infos'], - sprintf( - l10n('%s has been successfully upgraded.'), - $plugins->fs_plugins[$_GET['plugin']]['name'])); - break; - - case 'temp_path_error': - array_push($page['errors'], l10n('Can\'t create temporary file.')); - break; - - case 'dl_archive_error': - array_push($page['errors'], l10n('Can\'t download archive.')); - break; - - case 'archive_error': - array_push($page['errors'], l10n('Can\'t read or extract archive.')); - break; - - default: - array_push($page['errors'], - sprintf(l10n('An error occured during extraction (%s).'), $_GET['upgradestatus']), - l10n('Please check "plugins" folder and sub-folders permissions (CHMOD).')); - } -} - -//--------------------------------------------------------------------Tabsheet -$plugins->set_tabsheet($page['page']); - -// +-----------------------------------------------------------------------+ -// | start template output | -// +-----------------------------------------------------------------------+ -if ($plugins->get_server_plugins()) -{ - foreach($plugins->fs_plugins as $plugin_id => $fs_plugin) - { - if (isset($fs_plugin['extension']) - and isset($plugins->server_plugins[$fs_plugin['extension']])) - { - $plugin_info = $plugins->server_plugins[$fs_plugin['extension']]; - - if (!$plugins->plugin_version_compare($fs_plugin['version'], $plugin_info['revision_name'])) - { - $url_auto_update = $base_url - . '&revision=' . $plugin_info['revision_id'] - . '&plugin=' . $plugin_id - . '&pwg_token='.get_pwg_token() - ; - - $template->append('plugins', array( - 'ID' => $plugin_info['extension_id'], - 'EXT_NAME' => $fs_plugin['name'], - 'EXT_URL' => PEM_URL.'/extension_view.php?eid='.$plugin_info['extension_id'], - 'EXT_DESC' => trim($plugin_info['extension_description'], " \n\r"), - 'REV_DESC' => trim($plugin_info['revision_description'], " \n\r"), - 'CURRENT_VERSION' => $fs_plugin['version'], - 'NEW_VERSION' => $plugin_info['revision_name'], - 'AUTHOR' => $plugin_info['author_name'], - 'DOWNLOADS' => $plugin_info['extension_nb_downloads'], - 'URL_UPDATE' => $url_auto_update, - 'URL_DOWNLOAD' => $plugin_info['download_url'] . '&origin=piwigo_download')); - } - } - } -} -else -{ - $template->assign('SERVER_ERROR', true); - array_push($page['errors'], l10n('Can\'t connect to server.')); -} - -$template->assign_var_from_handle('ADMIN_CONTENT', 'plugins'); -?>
\ No newline at end of file diff --git a/admin/themes.php b/admin/themes.php new file mode 100644 index 000000000..297cec1a9 --- /dev/null +++ b/admin/themes.php @@ -0,0 +1,50 @@ +<?php +// +-----------------------------------------------------------------------+ +// | Piwigo - a PHP based photo gallery | +// +-----------------------------------------------------------------------+ +// | Copyright(C) 2008-2011 Piwigo Team http://piwigo.org | +// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net | +// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick | +// +-----------------------------------------------------------------------+ +// | This program is free software; you can redistribute it and/or modify | +// | it under the terms of the GNU General Public License as published by | +// | the Free Software Foundation | +// | | +// | This program is distributed in the hope that it will be useful, but | +// | WITHOUT ANY WARRANTY; without even the implied warranty of | +// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | +// | General Public License for more details. | +// | | +// | You should have received a copy of the GNU General Public License | +// | along with this program; if not, write to the Free Software | +// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | +// | USA. | +// +-----------------------------------------------------------------------+ + +if( !defined("PHPWG_ROOT_PATH") ) +{ + die ("Hacking attempt!"); +} + +include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php'); + +$my_base_url = get_root_url().'admin.php?page=themes'; + +if (isset($_GET['tab'])) + $page['tab'] = $_GET['tab']; +else + $page['tab'] = 'installed'; + +$tabsheet = new tabsheet(); +$tabsheet->add('installed', l10n('Installed Themes'), $my_base_url.'&tab=installed'); +$tabsheet->add('update', l10n('Check for updates'), $my_base_url.'&tab=update'); +$tabsheet->add('new', l10n('Add New Theme'), $my_base_url.'&tab=new'); +$tabsheet->select($page['tab']); +$tabsheet->assign(); + +if ($page['tab'] == 'update') + include(PHPWG_ROOT_PATH.'admin/updates_ext.php'); +else + include(PHPWG_ROOT_PATH.'admin/themes_'.$page['tab'].'.php'); + +?>
\ No newline at end of file diff --git a/admin/themes/default/template/languages_update.tpl b/admin/themes/default/template/languages_update.tpl deleted file mode 100644 index 2b1a2b27d..000000000 --- a/admin/themes/default/template/languages_update.tpl +++ /dev/null @@ -1,58 +0,0 @@ -{footer_script require='jquery.effects.blind'}{literal} -jQuery(document).ready(function(){ - jQuery("td[id^='desc_'], p[id^='revdesc_']").click(function() { - id = this.id.split('_'); - jQuery("#revdesc_"+id[1]).toggle('blind'); - jQuery(".button_"+id[1]).toggle(); - return false; - }); -}); -{/literal}{/footer_script} - -<div class="titrePage"> - <h2>{'Languages'|@translate}</h2> -</div> - -{if not empty($update_languages)} -<div id="availablePlugins"> -<fieldset> -<legend>{'Languages which need upgrade'|@translate}</legend> -{foreach from=$update_languages item=language name=languages_loop} -<div class="pluginBox"> - <table> - <tr> - <td class="pluginBoxNameCell"> - {$language.EXT_NAME} - </td> - <td> - <a href="{$language.URL_UPDATE}" onclick="return confirm('{'Are you sure?'|@translate|@escape:javascript}');">{'Install'|@translate}</a> - | <a href="{$language.URL_DOWNLOAD}">{'Download'|@translate}</a> - | <a class="externalLink" href="{$language.EXT_URL}">{'Visit language site'|@translate}</a> - </td> - </tr> - <tr> - <td> - {'Version'|@translate} {$language.CURRENT_VERSION} - </td> - <td class="pluginDesc" id="desc_{$language.ID}"> - <em>{'Downloads'|@translate}: {$language.DOWNLOADS}</em> - <img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/plus.gif" alt="" class="button_{$language.ID}"> - <img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/minus.gif" alt="" class="button_{$language.ID}" style="display:none;"> - {'New Version'|@translate} : {$language.NEW_VERSION} - | {'By %s'|@translate|@sprintf:$language.AUTHOR} - </td> - </tr> - <tr> - <td></td> - <td class="pluginDesc"> - <p id="revdesc_{$language.ID}" style="display:none;">{$language.REV_DESC|htmlspecialchars|nl2br}</p> - </td> - </tr> - </table> -</div> -{/foreach} -</fieldset> -</div> -{elseif not isset($SERVER_ERROR)} -<p>{'All languages are up to date.'|@translate}</p> -{/if} diff --git a/admin/themes/default/template/plugins_list.tpl b/admin/themes/default/template/plugins_list.tpl index ccf6f02f7..54f051eac 100644 --- a/admin/themes/default/template/plugins_list.tpl +++ b/admin/themes/default/template/plugins_list.tpl @@ -81,7 +81,7 @@ jQuery(document).ready(function() { <div class="titrePage"> <span class="sort"> <form action="" method="get" name="change_order"> - <input type="hidden" name="page" value="plugins_list"/> + <input type="hidden" name="page" value="plugins"/> {'Sort order'|@translate} : <select name="plugin_order" onchange="this.form.submit();"> <option value="status" {if $plugin_order=='state'}selected="selected"{/if}>{'Status'|@translate}</option> diff --git a/admin/themes/default/template/plugins_update.tpl b/admin/themes/default/template/plugins_update.tpl deleted file mode 100644 index 50cca3505..000000000 --- a/admin/themes/default/template/plugins_update.tpl +++ /dev/null @@ -1,58 +0,0 @@ -{footer_script require='jquery.effects.blind'}{literal} -jQuery(document).ready(function(){ - jQuery("td[id^='desc_'], p[id^='revdesc_']").click(function() { - id = this.id.split('_'); - jQuery("#revdesc_"+id[1]).toggle('blind'); - jQuery(".button_"+id[1]).toggle(); - return false; - }); -}); -{/literal}{/footer_script} - -<div class="titrePage"> - <h2>{'Plugins'|@translate}</h2> -</div> - -{if not empty($plugins)} -<div id="availablePlugins"> -<fieldset> -<legend>{'Plugins which need upgrade'|@translate}</legend> -{foreach from=$plugins item=plugin name=plugins_loop} -<div class="pluginBox"> - <table> - <tr> - <td class="pluginBoxNameCell"> - {$plugin.EXT_NAME} - </td> - <td> - <a href="{$plugin.URL_UPDATE}" onclick="return confirm('{'Are you sure to install this upgrade? You must verify if this version does not need uninstallation.'|@translate|@escape:javascript}');">{'Install'|@translate}</a> - | <a href="{$plugin.URL_DOWNLOAD}">{'Download'|@translate}</a> - | <a class="externalLink" href="{$plugin.EXT_URL}">{'Visit plugin site'|@translate}</a> - </td> - </tr> - <tr> - <td> - {'Version'|@translate} {$plugin.CURRENT_VERSION} - </td> - <td class="pluginDesc" id="desc_{$plugin.ID}"> - <em>{'Downloads'|@translate}: {$plugin.DOWNLOADS}</em> - <img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/plus.gif" alt="" class="button_{$plugin.ID}"> - <img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/minus.gif" alt="" class="button_{$plugin.ID}" style="display:none;"> - {'New Version'|@translate} : {$plugin.NEW_VERSION} - | {'By %s'|@translate|@sprintf:$plugin.AUTHOR} - </td> - </tr> - <tr> - <td></td> - <td class="pluginDesc"> - <p id="revdesc_{$plugin.ID}" style="display:none;">{$plugin.REV_DESC|htmlspecialchars|nl2br}</p> - </td> - </tr> - </table> -</div> -{/foreach} -</fieldset> -</div> -{elseif not isset($SERVER_ERROR)} -<p>{'All plugins are up to date.'|@translate}</p> -{/if} diff --git a/admin/themes/default/template/themes_update.tpl b/admin/themes/default/template/themes_update.tpl deleted file mode 100644 index 3bf1cc0b1..000000000 --- a/admin/themes/default/template/themes_update.tpl +++ /dev/null @@ -1,58 +0,0 @@ -{footer_script require='jquery.effects.blind'}{literal} -jQuery(document).ready(function(){ - jQuery("td[id^='desc_'], p[id^='revdesc_']").click(function() { - id = this.id.split('_'); - jQuery("#revdesc_"+id[1]).toggle('blind'); - jQuery(".button_"+id[1]).toggle(); - return false; - }); -}); -{/literal}{/footer_script} - -<div class="titrePage"> - <h2>{'Themes'|@translate}</h2> -</div> - -{if not empty($update_themes)} -<div id="availablePlugins"> -<fieldset> -<legend>{'Themes which need upgrade'|@translate}</legend> -{foreach from=$update_themes item=theme name=themes_loop} -<div class="pluginBox"> - <table> - <tr> - <td class="pluginBoxNameCell"> - {$theme.EXT_NAME} - </td> - <td> - <a href="{$theme.URL_UPDATE}" onclick="return confirm('{'Are you sure?'|@translate|@escape:javascript}');">{'Install'|@translate}</a> - | <a href="{$theme.URL_DOWNLOAD}">{'Download'|@translate}</a> - | <a class="externalLink" href="{$theme.EXT_URL}">{'Visit theme site'|@translate}</a> - </td> - </tr> - <tr> - <td> - {'Version'|@translate} {$theme.CURRENT_VERSION} - </td> - <td class="pluginDesc" id="desc_{$theme.ID}"> - <em>{'Downloads'|@translate}: {$theme.DOWNLOADS}</em> - <img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/plus.gif" alt="" class="button_{$theme.ID}"> - <img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/minus.gif" alt="" class="button_{$theme.ID}" style="display:none;"> - {'New Version'|@translate} : {$theme.NEW_VERSION} - | {'By %s'|@translate|@sprintf:$theme.AUTHOR} - </td> - </tr> - <tr> - <td></td> - <td class="pluginDesc"> - <p id="revdesc_{$theme.ID}" style="display:none;">{$theme.REV_DESC|htmlspecialchars|nl2br}</p> - </td> - </tr> - </table> -</div> -{/foreach} -</fieldset> -</div> -{elseif not isset($SERVER_ERROR)} -<p>{'All themes are up to date.'|@translate}</p> -{/if} diff --git a/admin/themes_installed.php b/admin/themes_installed.php index 5fc17fe64..9ba06011c 100644 --- a/admin/themes_installed.php +++ b/admin/themes_installed.php @@ -151,7 +151,6 @@ $template->assign( ); -$themes->set_tabsheet($page['page']); $template->set_filenames(array('themes' => 'themes_installed.tpl')); $template->assign_var_from_handle('ADMIN_CONTENT', 'themes'); ?> diff --git a/admin/themes_new.php b/admin/themes_new.php index cef9b3c41..44acd1fa7 100644 --- a/admin/themes_new.php +++ b/admin/themes_new.php @@ -31,7 +31,6 @@ include_once(PHPWG_ROOT_PATH.'admin/include/themes.class.php'); $base_url = get_root_url().'admin.php?page='.$page['page']; $themes = new themes(); -$themes->set_tabsheet('themes_new'); // +-----------------------------------------------------------------------+ // | setup check | diff --git a/admin/themes_update.php b/admin/themes_update.php deleted file mode 100644 index 7909e47e0..000000000 --- a/admin/themes_update.php +++ /dev/null @@ -1,133 +0,0 @@ -<?php -// +-----------------------------------------------------------------------+ -// | Piwigo - a PHP based photo gallery | -// +-----------------------------------------------------------------------+ -// | Copyright(C) 2008-2011 Piwigo Team http://piwigo.org | -// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net | -// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick | -// +-----------------------------------------------------------------------+ -// | This program is free software; you can redistribute it and/or modify | -// | it under the terms of the GNU General Public License as published by | -// | the Free Software Foundation | -// | | -// | This program is distributed in the hope that it will be useful, but | -// | WITHOUT ANY WARRANTY; without even the implied warranty of | -// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | -// | General Public License for more details. | -// | | -// | You should have received a copy of the GNU General Public License | -// | along with this program; if not, write to the Free Software | -// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | -// | USA. | -// +-----------------------------------------------------------------------+ - - -if( !defined("PHPWG_ROOT_PATH") ) -{ - die ("Hacking attempt!"); -} - -include_once(PHPWG_ROOT_PATH.'admin/include/themes.class.php'); - -$base_url = get_root_url().'admin.php?page='.$page['page']; - -$themes = new themes(); - -$themes->set_tabsheet($page['page']); - -//-----------------------------------------------------------automatic upgrade -if (isset($_GET['theme']) and isset($_GET['revision'])) -{ - if (!is_webmaster()) - { - array_push($page['errors'], l10n('Webmaster status is required.')); - } - else - { - check_pwg_token(); - - $theme_id = $_GET['theme']; - $revision = $_GET['revision']; - - $upgrade_status = $themes->extract_theme_files('upgrade', $revision, $theme_id); - - switch ($upgrade_status) - { - case 'ok': - array_push($page['infos'], - sprintf( - l10n('%s has been successfully upgraded.'), - $themes->fs_themes[$_GET['theme']]['name'])); - break; - - case 'temp_path_error': - array_push($page['errors'], l10n('Can\'t create temporary file.')); - break; - - case 'dl_archive_error': - array_push($page['errors'], l10n('Can\'t download archive.')); - break; - - case 'archive_error': - array_push($page['errors'], l10n('Can\'t read or extract archive.')); - break; - - default: - array_push($page['errors'], - sprintf(l10n('An error occured during extraction (%s).'), $upgrade_status) - ); - } - - $themes->themes(); - $template->delete_compiled_templates(); - } -} - -// +-----------------------------------------------------------------------+ -// | start template output | -// +-----------------------------------------------------------------------+ -$template->set_filenames(array('themes' => 'themes_update.tpl')); - -if ($themes->get_server_themes()) -{ - foreach($themes->fs_themes as $theme_id => $fs_theme) - { - if (isset($fs_theme['extension']) - and isset($themes->server_themes[$fs_theme['extension']])) - { - $theme_info = $themes->server_themes[$fs_theme['extension']]; - - if (!$themes->theme_version_compare($fs_theme['version'], $theme_info['revision_name'])) - { - $url_auto_update = $base_url - . '&revision=' . $theme_info['revision_id'] - . '&theme=' . $theme_id - . '&pwg_token='.get_pwg_token() - ; - - $template->append('update_themes', array( - 'ID' => $theme_info['extension_id'], - 'EXT_NAME' => $fs_theme['name'], - 'EXT_URL' => PEM_URL.'/extension_view.php?eid='.$theme_info['extension_id'], - 'EXT_DESC' => trim($theme_info['extension_description'], " \n\r"), - 'REV_DESC' => trim($theme_info['revision_description'], " \n\r"), - 'CURRENT_VERSION' => $fs_theme['version'], - 'NEW_VERSION' => $theme_info['revision_name'], - 'AUTHOR' => $theme_info['author_name'], - 'DOWNLOADS' => $theme_info['extension_nb_downloads'], - 'URL_UPDATE' => $url_auto_update, - 'URL_DOWNLOAD' => $theme_info['download_url'] . '&origin=piwigo_download' - ) - ); - } - } - } -} -else -{ - $template->assign('SERVER_ERROR', true); - array_push($page['errors'], l10n('Can\'t connect to server.')); -} - -$template->assign_var_from_handle('ADMIN_CONTENT', 'themes'); -?>
\ No newline at end of file |