From cf0750dbc0c188a80b0dbefb89ea9cf4e1c79c5f Mon Sep 17 00:00:00 2001 From: mistic100 Date: Wed, 22 Jan 2014 21:21:37 +0000 Subject: Display "Activate it now" link when installing a new plugin git-svn-id: http://piwigo.org/svn/trunk@26909 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/include/plugins.class.php | 9 +++++---- admin/plugins_new.php | 11 ++++++++--- language/en_UK/admin.lang.php | 2 +- language/fr_FR/admin.lang.php | 2 +- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/admin/include/plugins.class.php b/admin/include/plugins.class.php index 0ddc85b50..b410ff647 100644 --- a/admin/include/plugins.class.php +++ b/admin/include/plugins.class.php @@ -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)) diff --git a/admin/plugins_new.php b/admin/plugins_new.php index 379077410..a8df9359c 100644 --- a/admin/plugins_new.php +++ b/admin/plugins_new.php @@ -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'][] = '' . l10n('Activate it now') . ''; break; case 'temp_path_error': diff --git a/language/en_UK/admin.lang.php b/language/en_UK/admin.lang.php index 1cbc91929..4abe5641d 100644 --- a/language/en_UK/admin.lang.php +++ b/language/en_UK/admin.lang.php @@ -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 $conf[\'order_by\'] in your local configuration file, this parameter in deprecated, please remove it or rename it into $conf[\'order_by_custom\'] !'] = 'You have specified $conf[\'order_by\'] in your local configuration file, this parameter in deprecated, please remove it or rename it into $conf[\'order_by_custom\'] !'; $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'; diff --git a/language/fr_FR/admin.lang.php b/language/fr_FR/admin.lang.php index 3a49ebca5..9aab4de48 100644 --- a/language/fr_FR/admin.lang.php +++ b/language/fr_FR/admin.lang.php @@ -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'; ?> \ No newline at end of file -- cgit v1.2.3