Changeset 288

Show
Ignore:
Timestamp:
04/20/08 00:50:20 (9 months ago)
Author:
shupp
Message:

Some fixes for accounts limits

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Framework/Module/Accounts/Limits.php

    r287 r288  
    125125        } 
    126126        // To MB 
    127         if ($this->userInfo['quota'] > 0) { 
    128             $defaults['quota'] = ($this->userInfo['quota'] / 1024) / 1024; 
    129         } 
     127        $quota = (int)$this->userInfo['quota']; 
     128        if ($quota > 0) { 
     129            $quota = ((int)$quota / 1024) / 1024; 
     130        } 
     131        $defaults['quota'] = $quota; 
    130132 
    131133        $url  = './?module=Accounts&class=Limits&event=modifyLimitsNow&'; 
     
    174176        $form->registerRule('zero', 'regex', '/^(0|[1-9][0-9]+)$/'); 
    175177        $form->addRule('quota', 
    176             _('Error: only integers of 0 and greater allowed here'), 
     178            _('Error: only integers of 0 and greater are allowed for quotas'), 
    177179            'zero', null, 'client'); 
     180        $form->addRule('quota', 
     181            _('Error: only integers of 0 and greater are allowed for quotas'), 
     182            'numeric', null, 'client'); 
    178183        $form->applyFilter('__ALL__', 'trim'); 
    179184 
     
    204209            $limits['quota'] = ($limits['quota'] * 1024) * 1024; 
    205210        } 
    206         // Convert 0 to NO_QUOTA 
    207         $userInfo['quota'] = $limits['quota'] > 0 ? $limits['quota'] : 'NO_QUOTA'; 
     211        // Convert 0 to NOQUOTA 
     212        $userInfo['quota'] = $limits['quota'] > 0 ? $limits['quota'] : 'NOQUOTA'; 
    208213        unset($limits['quota']); 
    209214        // Set disable flags to zero if not set