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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.