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
This commit is contained in:
parent
d7dfe63e11
commit
790f6b3bb6
22 changed files with 164 additions and 670 deletions
|
@ -147,8 +147,8 @@ $template->assign(
|
|||
'U_CONFIG_DISPLAY'=> $conf_link.'default',
|
||||
'U_CONFIG_EXTENTS'=> $link_start.'extend_for_templates',
|
||||
'U_CONFIG_MENUBAR'=> $link_start.'menubar',
|
||||
'U_CONFIG_LANGUAGES' => $link_start.'languages_installed',
|
||||
'U_CONFIG_THEMES'=> $link_start.'themes_installed',
|
||||
'U_CONFIG_LANGUAGES' => $link_start.'languages',
|
||||
'U_CONFIG_THEMES'=> $link_start.'themes',
|
||||
'U_CATEGORIES'=> $link_start.'cat_list',
|
||||
'U_MOVE'=> $link_start.'cat_move',
|
||||
'U_CAT_OPTIONS'=> $link_start.'cat_options',
|
||||
|
@ -164,7 +164,7 @@ $template->assign(
|
|||
'U_RETURN'=> make_index_url(),
|
||||
'U_ADMIN'=> PHPWG_ROOT_PATH.'admin.php',
|
||||
'U_LOGOUT'=> PHPWG_ROOT_PATH.'index.php?act=logout',
|
||||
'U_PLUGINS'=> $link_start.'plugins_list',
|
||||
'U_PLUGINS'=> $link_start.'plugins',
|
||||
'U_ADD_PHOTOS' => $link_start.'photos_add',
|
||||
'U_CHANGE_THEME' => PHPWG_ROOT_PATH.'admin.php?change_theme=1',
|
||||
'U_PENDING_COMMENTS' => $link_start.'comments',
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -35,24 +35,6 @@ class languages
|
|||
$this->get_fs_languages($target_charset);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -40,24 +40,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
|
||||
|
|
|
@ -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');
|
||||
|
||||
|
|
50
admin/languages.php
Normal file
50
admin/languages.php
Normal file
|
@ -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');
|
||||
|
||||
?>
|
|
@ -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']))
|
||||
|
|
|
@ -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 |
|
||||
|
|
|
@ -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');
|
||||
?>
|
50
admin/plugins.php
Normal file
50
admin/plugins.php
Normal file
|
@ -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');
|
||||
|
||||
?>
|
|
@ -64,9 +64,6 @@ if (isset($_GET['action']) and isset($_GET['plugin']))
|
|||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------Tabsheet
|
||||
$plugins->set_tabsheet($page['page']);
|
||||
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | start template output |
|
||||
// +-----------------------------------------------------------------------+
|
|
@ -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(
|
||||
|
|
|
@ -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');
|
||||
?>
|
50
admin/themes.php
Normal file
50
admin/themes.php
Normal file
|
@ -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');
|
||||
|
||||
?>
|
|
@ -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}
|
|
@ -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>
|
||||
|
|
|
@ -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}
|
|
@ -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}
|
|
@ -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');
|
||||
?>
|
||||
|
|
|
@ -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 |
|
||||
|
|
|
@ -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');
|
||||
?>
|
Loading…
Add table
Reference in a new issue