Display "Activate it now" link when installing a new plugin

git-svn-id: http://piwigo.org/svn/trunk@26909 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
mistic100
2014-01-22 21:21:37 +00:00
parent 597be89274
commit cf0750dbc0
4 changed files with 15 additions and 9 deletions

View File

@@ -509,7 +509,7 @@ DELETE FROM '. PLUGINS_TABLE .'
* @param string - archive URL
* @param string - plugin id or extension id
*/
function extract_plugin_files($action, $revision, $dest)
function extract_plugin_files($action, $revision, $dest, &$plugin_id=null)
{
if ($archive = tempnam( PHPWG_PLUGINS_PATH, 'zip'))
{
@@ -541,13 +541,14 @@ DELETE FROM '. PLUGINS_TABLE .'
$root = dirname($main_filepath); // main.inc.php path in archive
if ($action == 'upgrade')
{
$extract_path = PHPWG_PLUGINS_PATH . $dest;
$plugin_id = $dest;
}
else
{
$extract_path = PHPWG_PLUGINS_PATH
. ($root == '.' ? 'extension_' . $dest : basename($root));
$plugin_id = ($root == '.' ? 'extension_' . $dest : basename($root));
}
$extract_path = PHPWG_PLUGINS_PATH . $plugin_id;
if($result = $zip->extract(PCLZIP_OPT_PATH, $extract_path,
PCLZIP_OPT_REMOVE_PATH, $root,
PCLZIP_OPT_REPLACE_NEWER))

View File

@@ -45,9 +45,9 @@ if (isset($_GET['revision']) and isset($_GET['extension']))
{
check_pwg_token();
$install_status = $plugins->extract_plugin_files('install', $_GET['revision'], $_GET['extension']);
$install_status = $plugins->extract_plugin_files('install', $_GET['revision'], $_GET['extension'], $plugin_id);
redirect($base_url.'&installstatus='.$install_status);
redirect($base_url.'&installstatus='.$install_status.'&plugin_id='.$plugin_id);
}
}
@@ -57,8 +57,13 @@ if (isset($_GET['installstatus']))
switch ($_GET['installstatus'])
{
case 'ok':
$activate_url = get_root_url().'admin.php?page=plugins'
. '&plugin=' . $_GET['plugin_id']
. '&pwg_token=' . get_pwg_token()
. '&action=activate';
$page['infos'][] = l10n('Plugin has been successfully copied');
$page['infos'][] = l10n('You might go to plugin list to install and activate it.');
$page['infos'][] = '<a href="'. $activate_url . '">' . l10n('Activate it now') . '</a>';
break;
case 'temp_path_error':

View File

@@ -119,6 +119,7 @@ $lang['Activate icon "new" next to albums and pictures'] = 'Activate icon "new"
$lang['Activate Navigation Bar'] = 'Activate navigation bar';
$lang['Activate Navigation Thumbnails'] = 'Activate navigation thumbnails';
$lang['Activate'] = "Activate";
$lang['Activate it now'] = 'Activate it now';
$lang['Active Languages'] = 'Active Languages';
$lang['Active Plugins'] = 'Active Plugins';
$lang['Active Themes'] = 'Active Themes';
@@ -944,7 +945,6 @@ $lang['You have %d orphan tags: %s.'] = 'You have %d orphan tags: %s.';
$lang['You have specified <i>$conf[\'order_by\']</i> in your local configuration file, this parameter in deprecated, please remove it or rename it into <i>$conf[\'order_by_custom\']</i> !'] = 'You have specified <i>$conf[\'order_by\']</i> in your local configuration file, this parameter in deprecated, please remove it or rename it into <i>$conf[\'order_by_custom\']</i> !';
$lang['You have subscribed to receiving notifications by mail.'] = "You have subscribed to receive notifications by mail.";
$lang['You have unsubscribed from receiving notifications by mail.'] = "You have unsubscribed from being notified by mail.";
$lang['You might go to plugin list to install and activate it.'] = "Go to the plugins list to install and activate it.";
$lang['You need to confirm deletion'] = "You must confirm deletion";
$lang['You need to upgrade your system to take full advantage of the application else the application will not work correctly, or not at all'] = "You should upgrade your system to take full advantage of the application, otherwise the application could work improperly, or not at all";
$lang['Your configuration settings are saved'] = 'Your configuration settings are saved';

View File

@@ -480,7 +480,6 @@ $lang['Are you sure you want to delete this plugin?'] = "Etes-vous sûr de voulo
$lang['Are you sure you want to install this plugin?'] = "Etes-vous sûr de vouloir installer ce plugin?";
$lang['Are you sure to install this upgrade? You must verify if this version does not need uninstallation.'] = "Etes-vous sur de vouloir installer cette mise à jour? Vous devez vérifiez que cette mise à jour ne nécessite pas de désinstallation préalable.";
$lang['Plugin has been successfully copied'] = "Le plugin a été copié avec succès.";
$lang['You might go to plugin list to install and activate it.'] = "Rendez-vous dans la liste des plugins pour l'installer et l'activer.";
$lang['Can\'t create temporary file.'] = "Impossible de créer un fichier temporaire.";
$lang['Can\'t download archive.'] = "Impossible de télécharger l'archive.";
$lang['Can\'t read or extract archive.'] = "Impossible de lire ou d'extraire l'archive.";
@@ -976,4 +975,5 @@ $lang['Users modified'] = 'Utilisateurs modifiés';
$lang['Open user details'] = 'Ouvrir les détails de l\'utilisateur';
$lang['Close user details'] = 'Fermer les détails de l\'utilisateur';
$lang['close'] = 'fermer';
$lang['Activate it now'] = 'Activate it now';
?>