Index: /extensions/UserAdvManager/branches/2.30/admin/UAM_admin.php
===================================================================
--- /extensions/UserAdvManager/branches/2.30/admin/UAM_admin.php (revision 12550)
+++ /extensions/UserAdvManager/branches/2.30/admin/UAM_admin.php (revision 12551)
@@ -269,15 +269,21 @@
$Backup_File = UAM_PATH.'/include/backup/UAM_dbbackup.sql';
- if (file_exists($Backup_File))
- {
- $restore = UAM_Restore_backup_file();
- if(empty($restore))
+ if (file_exists($Backup_File) and $file = file($Backup_File, FILE_IGNORE_NEW_LINES) and !empty($file))
+ {
+ // Check backup file version
+ // -------------------------
+ if ($file[0] == "-- ".$version." --")
{
- array_push($page['infos'], l10n('UAM_Restoration_OK'));
+ $restore = UAM_Restore_backup_file();
+ if(empty($restore))
+ {
+ array_push($page['infos'], l10n('UAM_Restoration_OK'));
+ }
+ else
+ {
+ array_push($page['errors'], l10n('UAM_Restoration_NOK'));
+ }
}
- else
- {
- array_push($page['errors'], l10n('UAM_Restoration_NOK'));
- }
+ else array_push($page['errors'], l10n('UAM_Bad_version_backup'));
}
else
Index: /extensions/UserAdvManager/branches/2.30/changelog.txt.php
===================================================================
--- /extensions/UserAdvManager/branches/2.30/changelog.txt.php (revision 12550)
+++ /extensions/UserAdvManager/branches/2.30/changelog.txt.php (revision 12551)
@@ -261,6 +261,8 @@
-- 2.20.11 : Bug 2336 fixed - New feature : Add [Kdays] autotext flag to insert the number of days until expiration.
--- 2.30.0 :
- Piwigo 2.3.0 compliant
+**************************************************************
+***** Plugin history (branch 2.30 - Piwigo 2.3 compliant)*****
+**************************************************************
+-- 2.30.0 : Piwigo 2.3.0 compliant
Bug 2415 fixed - New feature : Set automatically privacy level for users who have validated or not their registration. Automated task available.
Bug 2437 fixed - New feature : Request password renewal for selected users in Piwigo's users management panel.
@@ -269,4 +271,7 @@
Bug 2450 fixed - New feature : Backup file restoration.
Help files remaned and relocated in the language root directory (no more "help" subdirectory) for compliance with the new online translation tool.
+
+-- 2.30.1 : Bug 2455 fixed - Exclusion of specific users (généric and admins users) for password reset function.
+ Bug 2451 fixed - Unable to handle Sql errors but control of backup file validity have been enforced.
*/
?>
Index: /extensions/UserAdvManager/branches/2.30/include/functions.inc.php
===================================================================
--- /extensions/UserAdvManager/branches/2.30/include/functions.inc.php (revision 12550)
+++ /extensions/UserAdvManager/branches/2.30/include/functions.inc.php (revision 12551)
@@ -399,5 +399,5 @@
// -----------------------------------------------------
if ((isset($conf_UAM[20]) and $conf_UAM[20] == 'true'))
- {
+ {
$query ='
SELECT user_id, status
@@ -426,5 +426,5 @@
$data = pwg_db_fetch_assoc(pwg_query($query));
- if ($data['status'] <> "admin" and $data['status'] <> "webmaster" and $data['status'] <> "generic") // Exclusion of specific accounts
+ if ($data['status'] <> "webmaster" and $data['status'] <> "generic") // Exclusion of specific accounts
{
if (UAM_check_pwgreset($user['id']))
@@ -2800,5 +2800,8 @@
{
global $conf;
-
+
+ $plugin = PluginInfos(UAM_PATH);
+ $version = $plugin['version'];
+
// Initial backup folder creation and file initialisation
// ------------------------------------------------------
@@ -2810,4 +2813,7 @@
$fp = fopen($Backup_File, 'w');
+ // Writing plugin version
+ $insertions = "-- ".$version." --\n\n";
+ fwrite($fp, $insertions);
// Saving UAM specific tables
Index: /extensions/UserAdvManager/branches/2.30/language/en_UK/help.lang.php
===================================================================
--- /extensions/UserAdvManager/branches/2.30/language/en_UK/help.lang.php (revision 12550)
+++ /extensions/UserAdvManager/branches/2.30/language/en_UK/help.lang.php (revision 12551)
@@ -330,5 +330,5 @@
- Password renewed: The password has been renewed after a request.
- Original Password: The original password chosen at account creation and has never been required for a renewal.
-The webmaster, administrators and guest accounts are excluded from this function.
+Webmaster, generic and guest accounts are excluded from this function.
These users will be automatically redirected to their customization page at each of their connections until they changed their password and an explicit message will be displayed on this page.';
$lang['UAM_DumpTitle'] = 'Backup and restore your configuration';
Index: /extensions/UserAdvManager/branches/2.30/language/en_UK/plugin.lang.php
===================================================================
--- /extensions/UserAdvManager/branches/2.30/language/en_UK/plugin.lang.php (revision 12550)
+++ /extensions/UserAdvManager/branches/2.30/language/en_UK/plugin.lang.php (revision 12551)
@@ -76,5 +76,4 @@
/* Action button names */
$lang['UAM_audit'] = 'Audit settings';
-$lang['UAM_submit'] = 'Save settings';
// --------- End: New or revised $lang ---- from version 2.12.0 and 2.12.1
@@ -400,3 +399,11 @@
$lang['UAM_Restoration_OK'] = 'Restoring your configuration completed successfully! Please reload UAM\'s administration page to view the restored settings.';
// --------- End: New or revised $lang ---- from version 2.30.0
+
+
+// --------- Starting below: New or revised $lang ---- from version 2.30.1
+$lang['UAM_submit'] = 'Submit settings';
+$lang['UAM_Generic cannot be pwdreset'] = 'Password renewal can\'t be set for generic accounts!';
+$lang['UAM_Admins cannot be pwdreset'] = 'Password renewal can\'t be set for admins account!';
+$lang['UAM_Bad_version_backup'] = 'The version of the backup file does not match the version of the plugin! The restoration was not performed.';
+// --------- End: New or revised $lang ---- from version 2.30.1
?>
Index: /extensions/UserAdvManager/branches/2.30/language/fr_FR/help.lang.php
===================================================================
--- /extensions/UserAdvManager/branches/2.30/language/fr_FR/help.lang.php (revision 12550)
+++ /extensions/UserAdvManager/branches/2.30/language/fr_FR/help.lang.php (revision 12551)
@@ -326,5 +326,5 @@
- Mot de passe modifié : Le mot de passe a été changé suite à une demande.
- Mot de passe original : Le mot de passe est celui choisi à la création du compte et n\'a jamais fait l\'objet d\'une demande de changement.
-Le compte du webmaster, des administrateurs et de l\'invité (Guest) sont exclus de cette fonction.
+Le compte webmaster, génériques et invités (Guest) sont exclus de cette fonction.
Ces utilisateurs seront alors systématiquement redirigés vers leur page de personnalisation à chacune de leurs connexions tant qu\'ils n\'auront pas modifié leur mot de passe. Un message explicite sera affiché sur cette page.';
$lang['UAM_DumpTitle'] = 'Sauvegarde et restauration de votre configuration';
Index: /extensions/UserAdvManager/branches/2.30/language/fr_FR/plugin.lang.php
===================================================================
--- /extensions/UserAdvManager/branches/2.30/language/fr_FR/plugin.lang.php (revision 12550)
+++ /extensions/UserAdvManager/branches/2.30/language/fr_FR/plugin.lang.php (revision 12551)
@@ -76,5 +76,4 @@
/* Action button names */
$lang['UAM_audit'] = 'Auditer les paramètres';
-$lang['UAM_submit'] = 'Sauvegarder les paramètres';
// --------- End: New or revised $lang ---- from version 2.12.0 and 2.12.1
@@ -397,3 +396,11 @@
$lang['UAM_Restoration_OK'] = 'La restauration de votre configuration s\'est terminée avec succès ! Veuillez recharger la page d\'administration de UAM pour voir les paramètres restaurés.';
// --------- End: New or revised $lang ---- from version 2.30.0
+
+
+// --------- Starting below: New or revised $lang ---- from version 2.30.1
+$lang['UAM_submit'] = 'Enregistrer les paramètres';
+$lang['UAM_Generic cannot be pwdreset'] = 'Le renouvellement de mot de passe ne peut pas être demandé pour un compte générique !';
+$lang['UAM_Admins cannot be pwdreset'] = 'Le renouvellement de mot de passe ne peut pas être demandé pour un compte d\'administrateur !';
+$lang['UAM_Bad_version_backup'] = 'La version du fichier de sauvegarde ne correspond pas à la version du plugin ! La restauration n\'a pas été réalisée.';
+// --------- End: New or revised $lang ---- from version 2.30.1
?>
Index: /extensions/UserAdvManager/branches/2.30/main.inc.php
===================================================================
--- /extensions/UserAdvManager/branches/2.30/main.inc.php (revision 12550)
+++ /extensions/UserAdvManager/branches/2.30/main.inc.php (revision 12551)
@@ -2,5 +2,5 @@
/*
Plugin Name: UserAdvManager
-Version: 2.30.0
+Version: 2.30.1
Description: Renforcer la gestion des utilisateurs - Enforce users management
Plugin URI: http://piwigo.org/ext/extension_view.php?eid=216
@@ -150,6 +150,50 @@
}
+ // Generic accounts exclusion (including Adult_Content generic users)
+ // ------------------------------------------------------------------
+ $query ='
+SELECT u.id
+FROM '.USERS_TABLE.' AS u
+INNER JOIN '.USER_INFOS_TABLE.' AS ui
+ ON u.id = ui.user_id
+WHERE ui.status = "generic"
+;';
+
+ $result = pwg_query($query);
+
+ while ($row = pwg_db_fetch_assoc($result))
+ {
+ if (in_array($row['id'], $collection))
+ {
+ array_push($page['errors'], l10n('UAM_Generic cannot be pwdreset'));
+ $errors = l10n('UAM_Generic cannot be pwdreset');
+ }
+ }
+
+ // Admins accounts exclusion
+ // --------------------------
+ $query ='
+SELECT u.id
+FROM '.USERS_TABLE.' AS u
+INNER JOIN '.USER_INFOS_TABLE.' AS ui
+ ON u.id = ui.user_id
+WHERE ui.status = "admin"
+;';
+
+ $result = pwg_query($query);
+
+ while ($row = pwg_db_fetch_assoc($result))
+ {
+ if (in_array($row['id'], $collection))
+ {
+ array_push($page['errors'], l10n('UAM_Admins cannot be pwdreset'));
+ $errors = l10n('UAM_Admins cannot be pwdreset');
+ }
+ }
+
+ $template->append('errors', $errors);
+
if (count($page['errors']) == 0)
- {
+ {
if (isset($_POST['confirm_pwdreset']) and 1 == $_POST['confirm_pwdreset'])
{
@@ -182,5 +226,5 @@
}
}
- }
+ }
$template->set_prefilter('user_list', 'UAM_PwdReset_Prefilter');
}