Changeset 12551


Ignore:
Timestamp:
Nov 5, 2011, 3:48:21 PM (12 years ago)
Author:
Eric
Message:

Merged from trunk to branch 2.30
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.

Location:
extensions/UserAdvManager/branches/2.30
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • extensions/UserAdvManager/branches/2.30/admin/UAM_admin.php

    r12276 r12551  
    269269    $Backup_File = UAM_PATH.'/include/backup/UAM_dbbackup.sql';
    270270
    271     if (file_exists($Backup_File))
    272     {
    273       $restore = UAM_Restore_backup_file();
    274       if(empty($restore))
     271    if (file_exists($Backup_File) and $file = file($Backup_File, FILE_IGNORE_NEW_LINES) and !empty($file))
     272    {
     273      // Check backup file version
     274      // -------------------------
     275      if ($file[0] == "-- ".$version." --")
    275276      {
    276         array_push($page['infos'], l10n('UAM_Restoration_OK'));
     277        $restore = UAM_Restore_backup_file();
     278        if(empty($restore))
     279        {
     280          array_push($page['infos'], l10n('UAM_Restoration_OK'));
     281        }
     282        else
     283        {
     284          array_push($page['errors'], l10n('UAM_Restoration_NOK'));
     285        }
    277286      }
    278       else
    279       {
    280         array_push($page['errors'], l10n('UAM_Restoration_NOK'));
    281       }
     287      else array_push($page['errors'], l10n('UAM_Bad_version_backup'));
    282288    }
    283289    else
  • extensions/UserAdvManager/branches/2.30/changelog.txt.php

    r12281 r12551  
    261261-- 2.20.11 : Bug 2336 fixed - New feature : Add [Kdays] autotext flag to insert the number of days until expiration.
    262262
    263 -- 2.30.0 :
    264             Piwigo 2.3.0 compliant
     263**************************************************************
     264***** Plugin history (branch 2.30 - Piwigo 2.3 compliant)*****
     265**************************************************************
     266-- 2.30.0 : Piwigo 2.3.0 compliant
    265267            Bug 2415 fixed - New feature : Set automatically privacy level for users who have validated or not their registration. Automated task available.
    266268            Bug 2437 fixed - New feature : Request password renewal for selected users in Piwigo's users management panel.
     
    269271            Bug 2450 fixed - New feature : Backup file restoration.
    270272            Help files remaned and relocated in the language root directory (no more "help" subdirectory) for compliance with the new online translation tool.
     273
     274-- 2.30.1 : Bug 2455 fixed - Exclusion of specific users (généric and admins users) for password reset function.
     275            Bug 2451 fixed - Unable to handle Sql errors but control of backup file validity have been enforced.
    271276*/
    272277?>
  • extensions/UserAdvManager/branches/2.30/include/functions.inc.php

    r12276 r12551  
    399399  // -----------------------------------------------------
    400400  if ((isset($conf_UAM[20]) and $conf_UAM[20] == 'true'))
    401   { 
     401  {
    402402    $query ='
    403403SELECT user_id, status
     
    426426    $data = pwg_db_fetch_assoc(pwg_query($query));
    427427
    428     if ($data['status'] <> "admin" and $data['status'] <> "webmaster" and $data['status'] <> "generic") // Exclusion of specific accounts
     428    if ($data['status'] <> "webmaster" and $data['status'] <> "generic") // Exclusion of specific accounts
    429429    {
    430430      if (UAM_check_pwgreset($user['id']))
     
    28002800{
    28012801  global $conf;
    2802  
     2802
     2803  $plugin =  PluginInfos(UAM_PATH);
     2804  $version = $plugin['version'];
     2805
    28032806  // Initial backup folder creation and file initialisation
    28042807  // ------------------------------------------------------
     
    28102813  $fp = fopen($Backup_File, 'w');
    28112814
     2815  // Writing plugin version
     2816  $insertions = "-- ".$version." --\n\n";
     2817  fwrite($fp, $insertions);
    28122818
    28132819  // Saving UAM specific tables
  • extensions/UserAdvManager/branches/2.30/language/en_UK/help.lang.php

    r12276 r12551  
    330330- Password renewed: The password has been renewed after a request.<br>
    331331- Original Password: The original password chosen at account creation and has never been required for a renewal.<br>
    332 The webmaster, administrators and guest accounts are excluded from this function.<br>
     332Webmaster, generic and guest accounts are excluded from this function.<br>
    333333These 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.';
    334334$lang['UAM_DumpTitle'] = 'Backup and restore your configuration';
  • extensions/UserAdvManager/branches/2.30/language/en_UK/plugin.lang.php

    r12278 r12551  
    7676/* Action button names */
    7777$lang['UAM_audit'] = 'Audit settings';
    78 $lang['UAM_submit'] = 'Save settings';
    7978// --------- End: New or revised $lang ---- from version 2.12.0 and 2.12.1
    8079
     
    400399$lang['UAM_Restoration_OK'] = 'Restoring your configuration completed successfully! Please reload UAM\'s administration page to view the restored settings.';
    401400// --------- End: New or revised $lang ---- from version 2.30.0
     401
     402
     403// --------- Starting below: New or revised $lang ---- from version 2.30.1
     404$lang['UAM_submit'] = 'Submit settings';
     405$lang['UAM_Generic cannot be pwdreset'] = 'Password renewal can\'t be set for generic accounts!';
     406$lang['UAM_Admins cannot be pwdreset'] = 'Password renewal can\'t be set for admins account!';
     407$lang['UAM_Bad_version_backup'] = 'The version of the backup file does not match the version of the plugin! The restoration was not performed.';
     408// --------- End: New or revised $lang ---- from version 2.30.1
    402409?>
  • extensions/UserAdvManager/branches/2.30/language/fr_FR/help.lang.php

    r12276 r12551  
    326326- Mot de passe modifié : Le mot de passe a été changé suite à une demande.<br>
    327327- 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.<br>
    328 Le compte du webmaster, des administrateurs et de l\'invité (Guest) sont exclus de cette fonction.<br><br>
     328Le compte webmaster, génériques et invités (Guest) sont exclus de cette fonction.<br><br>
    329329Ces 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.';
    330330$lang['UAM_DumpTitle'] = 'Sauvegarde et restauration de votre configuration';
  • extensions/UserAdvManager/branches/2.30/language/fr_FR/plugin.lang.php

    r12278 r12551  
    7676/* Action button names */
    7777$lang['UAM_audit'] = 'Auditer les paramètres';
    78 $lang['UAM_submit'] = 'Sauvegarder les paramètres';
    7978// --------- End: New or revised $lang ---- from version 2.12.0 and 2.12.1
    8079
     
    397396$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.';
    398397// --------- End: New or revised $lang ---- from version 2.30.0
     398
     399
     400// --------- Starting below: New or revised $lang ---- from version 2.30.1
     401$lang['UAM_submit'] = 'Enregistrer les paramètres';
     402$lang['UAM_Generic cannot be pwdreset'] = 'Le renouvellement de mot de passe ne peut pas être demandé pour un compte générique !';
     403$lang['UAM_Admins cannot be pwdreset'] = 'Le renouvellement de mot de passe ne peut pas être demandé pour un compte d\'administrateur !';
     404$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.';
     405// --------- End: New or revised $lang ---- from version 2.30.1
    399406?>
  • extensions/UserAdvManager/branches/2.30/main.inc.php

    r12272 r12551  
    22/*
    33Plugin Name: UserAdvManager
    4 Version: 2.30.0
     4Version: 2.30.1
    55Description: Renforcer la gestion des utilisateurs - Enforce users management
    66Plugin URI: http://piwigo.org/ext/extension_view.php?eid=216
     
    150150      }
    151151
     152      // Generic accounts exclusion (including Adult_Content generic users)
     153      // ------------------------------------------------------------------
     154      $query ='
     155SELECT u.id
     156FROM '.USERS_TABLE.' AS u
     157INNER JOIN '.USER_INFOS_TABLE.' AS ui
     158  ON u.id = ui.user_id
     159WHERE ui.status = "generic"
     160;';
     161
     162            $result = pwg_query($query);
     163
     164      while ($row = pwg_db_fetch_assoc($result))
     165      {
     166        if (in_array($row['id'], $collection))
     167        {
     168          array_push($page['errors'], l10n('UAM_Generic cannot be pwdreset'));
     169          $errors = l10n('UAM_Generic cannot be pwdreset');
     170        }
     171      }
     172
     173      // Admins accounts exclusion
     174      // --------------------------
     175      $query ='
     176SELECT u.id
     177FROM '.USERS_TABLE.' AS u
     178INNER JOIN '.USER_INFOS_TABLE.' AS ui
     179  ON u.id = ui.user_id
     180WHERE ui.status = "admin"
     181;';
     182
     183            $result = pwg_query($query);
     184
     185      while ($row = pwg_db_fetch_assoc($result))
     186      {
     187        if (in_array($row['id'], $collection))
     188        {
     189          array_push($page['errors'], l10n('UAM_Admins cannot be pwdreset'));
     190          $errors = l10n('UAM_Admins cannot be pwdreset');
     191        }
     192      }
     193
     194      $template->append('errors', $errors);
     195
    152196      if (count($page['errors']) == 0)
    153       { 
     197      {
    154198        if (isset($_POST['confirm_pwdreset']) and 1 == $_POST['confirm_pwdreset'])
    155199        {
     
    182226        }
    183227      }
    184     } 
     228    }
    185229    $template->set_prefilter('user_list', 'UAM_PwdReset_Prefilter');
    186230  }
Note: See TracChangeset for help on using the changeset viewer.