Changeset 271

Show
Ignore:
Timestamp:
04/11/08 10:55:28 (9 months ago)
Author:
shupp
Message:

CS fixes to ToasterAdmin?_Common. Added todo

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/ToasterAdmin/Common.php

    r221 r271  
    11<?php 
     2/** 
     3 * ToasterAdmin_Common  
     4 *  
     5 * PHP Version 5.1.0+ 
     6 *  
     7 * @uses Framework_Auth_User 
     8 * @abstract 
     9 * @category  Mail 
     10 * @package   ToasterAdmin 
     11 * @author    Bill Shupp <hostmaster@shupp.org>  
     12 * @copyright 2008 Bill Shupp 
     13 * @license   GPL 2.0  {@link http://www.gnu.org/licenses/gpl.txt} 
     14 * @link      http://trac.merchbox.com/trac/toasteradmin 
     15 * @todo      Check arguments to sameDomain() - first argument is not used 
     16 */ 
    217 
     18/** 
     19 * ToasterAdmin_Common  
     20 *  
     21 * Common helper functions used by modules. 
     22 *  
     23 * @uses Framework_Auth_User 
     24 * @abstract 
     25 * @category  Mail 
     26 * @package   ToasterAdmin 
     27 * @author    Bill Shupp <hostmaster@shupp.org>  
     28 * @copyright 2008 Bill Shupp 
     29 * @license   GPL 2.0  {@link http://www.gnu.org/licenses/gpl.txt} 
     30 * @link      http://trac.merchbox.com/trac/toasteradmin 
     31 */ 
    332abstract class ToasterAdmin_Common extends Framework_Auth_User 
    433{ 
     
    2049     * @return void 
    2150     */ 
    22     public function __construct() { 
     51    public function __construct() 
     52    { 
    2353        parent::__construct(); 
    2454        if (isset($_REQUEST['domain'])) { 
     
    2656        } 
    2757        $this->setData('domain', $this->domain); 
    28         $this->setData('domain_url', htmlspecialchars('./?module=Domains&class=Menu&domain=' . $this->domain)); 
     58        $durl = './?module=Domains&class=Menu&domain=' . $this->domain; 
     59        $this->setData('domain_url', htmlspecialchars($durl)); 
    2960    } 
    3061     
    3162 
    32     public function paginate($total) { 
     63    /** 
     64     * paginate  
     65     *  
     66     * Set pagination data 
     67     *  
     68     * @param mixed $total total number of items 
     69     *  
     70     * @access public 
     71     * @return void 
     72     */ 
     73    public function paginate($total) 
     74    { 
    3375        $this->setData('total', $total); 
    3476        $this->setData('limit', (integer)Framework::$site->config->maxPerPage); 
    3577        $start = !empty($_REQUEST['start']) ? (int)$_REQUEST['start'] : 0; 
    3678        $this->setData('start', $start); 
    37         $this->setData('currentPage', ceil($this->data['start'] / $this->data['limit']) + 1); 
    38         $this->setData('totalPages', ceil($this->data['total'] / $this->data['limit'])); 
     79        $this->setData('currentPage', 
     80            ceil($this->data['start'] / $this->data['limit']) + 1); 
     81        $this->setData('totalPages', 
     82            ceil($this->data['total'] / $this->data['limit'])); 
    3983    } 
    4084 
     
    4589     *  
    4690     * @access protected 
    47      * @return mixed PEAR_Error if they do NOT have domain admin privs, false if they do 
     91     * @throws Framework_Exception on failure 
     92     * @return void 
    4893     */ 
    49     protected function noDomainPrivs() { 
     94    protected function noDomainPrivs() 
     95    { 
    5096        // Verify that they have access 
    5197        if (!$this->user->isDomainAdmin($this->domain)) { 
    52             return PEAR::raiseError(_('Error: you do not have edit privileges on domain ') . $this->domain); 
     98            $message = _('Error: you do not have edit privileges on domain '); 
     99            throw new Framework_Exception($message . $this->domain); 
    53100        } 
    54         return false; 
    55101    } 
    56102 
     
    64110     * @throws Framework_Exception on failure 
    65111     */ 
    66     protected function noDomainSupplied() { 
     112    protected function noDomainSupplied() 
     113    { 
    67114        if (is_null($this->domain)) { 
    68115            throw new Framework_Exception (_('Error no domain supplied')); 
     
    73120     * sameDomain  
    74121     *  
    75      * @param mixed $name  
    76      * @param mixed $value  
     122     * Compare email domin to $this->value 
     123     *  
     124     * @param mixed $name  not sure 
     125     * @param mixed $value email address 
     126     *  
    77127     * @static 
    78128     * @access public 
    79129     * @return void 
    80130     */ 
    81     static public function sameDomain ($name, $value) { 
     131    static public function sameDomain($name, $value) 
     132    { 
    82133        $emailArray = explode('@', $value); 
    83134        if ($emailArray[1] == $this->domain) return true; 
    84135        return false; 
    85136    } 
    86  
    87137} 
    88138?>