Ignore:
Timestamp:
Oct 2, 2011, 7:14:27 PM (13 years ago)
Author:
Eric
Message:

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/trunk/main.inc.php

    r12271 r12314  
    131131      {
    132132        array_push($page['errors'], l10n('UAM_Guest cannot be pwdreset'));
    133         $template->append('errors', l10n('UAM_Guest cannot be pwdreset'));
     133        $errors = l10n('UAM_Guest cannot be pwdreset');
    134134      }
    135135      if (($conf['guest_id'] != $conf['default_user_id']) and
     
    137137      {
    138138        array_push($page['errors'], l10n('UAM_Default user cannot be pwgreset'));
    139         $template->append('errors', l10n('UAM_Default user cannot be pwgreset'));
     139        $errors = l10n('UAM_Default user cannot be pwgreset');
    140140      }
    141141      if (in_array($conf['webmaster_id'], $collection))
    142142      {
    143143        array_push($page['errors'], l10n('UAM_Webmaster cannot be pwdreset'));
    144         $template->append('errors', l10n('UAM_Webmaster cannot be pwdreset'));
     144        $errors = l10n('UAM_Webmaster cannot be pwdreset');
    145145      }
    146146      if (in_array($user['id'], $collection))
    147147      {
    148148        array_push($page['errors'], l10n('UAM_You cannot pwdreset your account'));
    149         $template->append('errors', l10n('UAM_You cannot pwdreset your account'));
    150       }
     149        $errors = l10n('UAM_You cannot pwdreset your account');
     150      }
     151
     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);
    151195
    152196      if (count($page['errors']) == 0)
    153       { 
     197      {
    154198        if (isset($_POST['confirm_pwdreset']) and 1 == $_POST['confirm_pwdreset'])
    155199        {
     
    182226        }
    183227      }
    184     } 
     228    }
     229
     230$page['order_by_items'] = array(
     231  'id' => l10n('registration date'),
     232  'username' => l10n('Username'),
     233  'level' => l10n('Privacy level'),
     234  'Language' => l10n('Language'),
     235  'UAM_pwdreset' => l10n('UAM_PwdReset'),
     236  );
     237
     238// Filter order options
     239$template->assign('order_options', $page['order_by_items']);
     240$template->assign('order_selected',
     241    isset($_GET['order_by']) ? $_GET['order_by'] : '');
     242
    185243    $template->set_prefilter('user_list', 'UAM_PwdReset_Prefilter');
    186244  }
Note: See TracChangeset for help on using the changeset viewer.