Changeset 193
- Timestamp:
- 07/11/07 19:21:21 (2 years ago)
- Files:
-
- trunk/Framework/Module/Accounts.php (modified) (8 diffs)
- trunk/Framework/Module/Domains.php (modified) (1 diff)
- trunk/Framework/Module/Forwards.php (modified) (2 diffs)
- trunk/Framework/Module/MailingLists.php (modified) (1 diff)
- trunk/Framework/Module/Responders.php (modified) (6 diffs)
- trunk/Framework/Object/Web.php (modified) (1 diff)
- trunk/Framework/Site/Default/config.xml (modified) (1 diff)
- trunk/ToasterAdmin/Common.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/Framework/Module/Accounts.php
r186 r193 22 22 * @license GPL 2.0 {@link http://www.gnu.org/licenses/gpl.txt} 23 23 */ 24 class Framework_Module_Accounts extends Framework_Auth_User24 class Framework_Module_Accounts extends ToasterAdmin_Common 25 25 { 26 27 /**28 * $domain is set from $_REQUEST['domain'];29 */30 public $domain = null;31 26 32 27 /** … … 40 35 function __construct() { 41 36 parent::__construct(); 42 // Make sure domain was supplied 43 if (!isset($_REQUEST['domain'])) 44 throw new Framework_Exception(_("Error: no domain supplied")); 45 $this->domain = $_REQUEST['domain']; 46 $this->setData('domain', $this->domain); 47 $this->setData('domain_url', htmlspecialchars('./?module=Domains&event=domainMenu&domain=' . $this->domain)); 48 } 49 50 /** 51 * checkPrivileges 52 * 53 * @access protected 54 * @return void 55 */ 56 protected function checkPrivileges() { 57 // Verify that they have access to this domain 58 if (!$this->user->isDomainAdmin($this->domain)) { 59 return PEAR::raiseError(_('Error: you do not have edit privileges on domain ') . $this->domain); 60 } 61 } 62 37 if (($result = $this->noDomainSupplied())) { 38 return $result; 39 } 40 } 63 41 64 42 /** … … 74 52 function listAccounts() { 75 53 76 $privs = $this->checkPrivileges(); 77 if (PEAR::isError($privs)) return privs; 54 if (($result = $this->noDomainPrivs())) { 55 return $result; 56 } 78 57 79 58 // Pagintation setup 80 59 $total = $this->user->userCount($this->domain); 81 if (PEAR::isError($total)) return $total; 60 if (PEAR::isError($total)) { 61 return $total; 62 } 82 63 $this->paginate($total); 83 64 … … 123 104 function addAccount() { 124 105 125 $privs = $this->checkPrivileges(); 126 if (PEAR::isError($privs)) return privs; 106 if (($result = $this->noDomainPrivs())) { 107 return $result; 108 } 127 109 128 110 $form = $this->addAccountForm(); … … 134 116 } 135 117 136 static function sameDomain ($name, $value) {137 $emailArray = explode('@', $value);138 if ($emailArray[1] == $this->domain) {139 return true;140 } else {141 return false;142 }143 }144 145 118 function addAccountNow() { 146 119 147 $privs = $this->checkPrivileges(); 148 if (PEAR::isError($privs)) return privs; 120 if (($result = $this->noDomainPrivs())) { 121 return $result; 122 } 149 123 150 124 $form = $this->addAccountForm(); … … 202 176 function delete() { 203 177 204 $privs = $this->checkPrivileges(); 205 if (PEAR::isError($privs)) return privs; 178 if (($result = $this->noDomainPrivs())) { 179 return $result; 180 } 206 181 207 182 if (!isset($_REQUEST['account'])) { … … 221 196 function deleteNow() { 222 197 223 $privs = $this->checkPrivileges(); 224 if (PEAR::isError($privs)) return privs; 198 if (($result = $this->noDomainPrivileges())) { 199 return $result; 200 } 225 201 226 202 if (!isset($_REQUEST['account'])) { … … 244 220 function cancelDelete() { 245 221 246 $privs = $this->checkPrivileges(); 247 if (PEAR::isError($privs)) return privs; 222 if (($result = $this->noDomainPrivileges())) { 223 return $result; 224 } 248 225 249 226 $this->setData('message', _("Delete Canceled")); trunk/Framework/Module/Domains.php
r184 r193 25 25 * 26 26 */ 27 class Framework_Module_Domains extends Framework_Auth_User27 class Framework_Module_Domains extends ToasterAdmin_Common 28 28 { 29 29 /** trunk/Framework/Module/Forwards.php
r184 r193 22 22 * @license GPL 2.0 {@link http://www.gnu.org/licenses/gpl.txt} 23 23 */ 24 class Framework_Module_Forwards extends Framework_Auth_User24 class Framework_Module_Forwards extends ToasterAdmin_Common 25 25 { 26 27 /**28 * $domain is set from $_REQUEST['domain'];29 */30 public $domain = null;31 26 32 27 /** … … 41 36 parent::__construct(); 42 37 // Make sure doamin was supplied 43 if (!isset($_REQUEST['domain'])) 44 throw new Framework_Exception(_("Error: no domain supplied")); 45 $this->domain = $_REQUEST['domain']; 46 $this->setData('domain', $this->domain); 47 $this->setData('domain_url', htmlspecialchars('./?module=Domains&event=domainMenu&domain=' . $this->domain)); 38 if (($result = $this->noDomainSupplied())) { 39 return $result; 40 } 41 // Make sure they are authorized 42 if (($result = $this->noDomainPrivileges())) { 43 return $result; 44 } 48 45 } 49 46 trunk/Framework/Module/MailingLists.php
r190 r193 21 21 * @license GPL 2.0 {@link http://www.gnu.org/licenses/gpl.txt} 22 22 */ 23 class Framework_Module_MailingLists extends Framwork_Auth_User23 class Framework_Module_MailingLists extends ToasterAdmin_Common 24 24 { 25 25 public function __construct() { trunk/Framework/Module/Responders.php
r184 r193 4 4 * Responders Module 5 5 * 6 * @uses Framework_Auth_User6 * @uses ToasterAdmin_Common 7 7 * @package ToasterAdmin 8 8 * @copyright 2006-2007 Bill Shupp … … 14 14 * Framework_Module_Responders 15 15 * 16 * @uses Framework_Auth_User16 * @uses ToasterAdmin_Common 17 17 * @package ToasterAdmin 18 18 * @copyright 2006-2007 Bill Shupp … … 20 20 * @license GPL 2.0 {@link http://www.gnu.org/licenses/gpl.txt} 21 21 */ 22 class Framework_Module_Responders extends Framework_Auth_User22 class Framework_Module_Responders extends ToasterAdmin_Common 23 23 { 24 25 /**26 * $domain is set from $_REQUEST['domain'];27 */28 public $domain = null;29 24 30 25 /** … … 38 33 function __construct() { 39 34 parent::__construct(); 35 // Make they have access 36 if (($result = $this->noDomainPrivileges())) { 37 return $result; 38 } 40 39 // Make sure doamin was supplied 41 if (!isset($_REQUEST['domain'])) 42 throw new Framework_Exception(_("Error: no domain supplied")); 43 $this->domain = $_REQUEST['domain']; 44 $this->setData('domain', $this->domain); 45 $this->setData('domain_url', htmlspecialchars('./?module=Domains&event=domainMenu&domain=' . $this->domain)); 46 } 47 48 /** 49 * checkPrivileges 50 * 51 * @access protected 52 * @return void 53 */ 54 protected function checkPrivileges() { 55 // Verify that they have access to this domain 56 if (!$this->user->isDomainAdmin($this->domain)) { 57 return PEAR::raiseError(_('Error: you do not have edit privileges on domain ') . $this->domain); 58 } 59 } 60 61 /** 62 * sameDomain 63 * 64 * @param mixed $name 65 * @param mixed $value 66 * @access public 67 * @return bool 68 */ 69 public function sameDomain ($name, $value) { 70 $emailArray = explode('@', $value); 71 if ($emailArray[1] == $this->domain) return true; 72 return false; 40 if (($result = $this->noDomainSupplied())) { 41 return $result; 42 } 73 43 } 74 44 … … 246 216 return PEAR::raiseError(_("Error: no Auto-Responder supplied")); 247 217 } 248 // Check privs249 if (!$this->user->isUserAdmin($account, $this->domain)) {250 return PEAR::raiseError(_('Error: you do not have edit privileges on domain ') . $this->domain);251 }252 218 $array = explode('@', $_REQUEST['autoresponder']); 253 219 // Setup defaults … … 274 240 if (!isset($_REQUEST['autoresponder'])) { 275 241 return PEAR::raiseError(_("Error: no Auto-Responder supplied")); 276 }277 // Check privs278 if (!$this->user->isUserAdmin($account, $this->domain)) {279 return PEAR::raiseError(_('Error: you do not have edit privileges on domain ') . $this->domain);280 242 } 281 243 $array = explode('@', $_REQUEST['autoresponder']); trunk/Framework/Object/Web.php
r163 r193 56 56 parent::__construct(); 57 57 $neg =& new Framework_User_Lang; 58 $this->user = Framework_User _toasterAdmin::singleton();58 $this->user = Framework_User::singleton(); 59 59 $this->session = Framework_Session::singleton(); 60 }61 62 public function paginate($total) {63 $this->setData('total', $total);64 $this->setData('limit', (integer)Framework::$site->config->maxPerPage);65 if (isset($_REQUEST['start']) && !ereg('[^0-9]', $_REQUEST['start'])) {66 if ($_REQUEST['start'] == 0) {67 $start = 1;68 } else {69 $start = $_REQUEST['start'];70 }71 }72 if (!isset($start)) $start = 1;73 $this->setData('start', $start);74 $this->setData('currentPage', ceil($this->data['start'] / $this->data['limit']));75 $this->setData('totalPages', ceil($this->data['total'] / $this->data['limit']));76 60 } 77 61 } trunk/Framework/Site/Default/config.xml
r177 r193 14 14 <logFile>/tmp/framework.log</logFile> 15 15 <user> 16 <userClass> toasterAdmin</userClass>16 <userClass>ToasterAdmin</userClass> 17 17 <userLocaleDir>Framework/Site/Default/locale</userLocaleDir> 18 18 </user> trunk/ToasterAdmin/Common.php
r192 r193 1 1 <?php 2 2 3 class ToasterAdmin_Common extends Framework_User_ToasterAdmin 3 abstract class ToasterAdmin_Common extends Framework_Auth_User 4 4 { 5 5 … … 78 78 } 79 79 80 /** 81 * sameDomain 82 * 83 * @param mixed $name 84 * @param mixed $value 85 * @static 86 * @access public 87 * @return void 88 */ 89 static public function sameDomain ($name, $value) { 90 $emailArray = explode('@', $value); 91 if ($emailArray[1] == $this->domain) return true; 92 return false; 93 } 94 80 95 } 81 96 ?> 82
