Changeset 222
- Timestamp:
- 12/09/07 00:33:54 (1 year ago)
- Files:
-
- trunk/Framework/Module/Forwards.php (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/Framework/Module/Forwards.php
r195 r222 1 1 <?php 2 2 3 /** 4 * 5 * Forward Module 6 * 7 * This module is for viewing and editing vpopmail forwards 8 * 9 * @author Bill Shupp <hostmaster@shupp.org> 10 * @package ToasterAdmin 11 * @version 1.0 12 * 13 */ 14 3 /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ 15 4 16 5 /** 17 6 * Framework_Module_Forwards 18 7 * 19 * @package ToasterAdmin 20 * @copyright 2005-2006 Bill Shupp 21 * @author Bill Shupp <hostmaster@shupp.org> 22 * @license GPL 2.0 {@link http://www.gnu.org/licenses/gpl.txt} 8 * This module is for viewing and editing vpopmail forwards 9 * 10 * PHP Version 5 11 * 12 * @uses ToasterAdmin_Auth_Domain 13 * @package ToasterAdmin 14 * @author Bill Shupp <hostmaster@shupp.org> 15 * @copyright 2007 Bill Shupp 16 * @license GPL 2.0 {@link http://www.gnu.org/licenses/gpl.txt} 17 * @link http://trac.merchbox.com/trac/toasteradmin 23 18 */ 24 class Framework_Module_Forwards extends ToasterAdmin_Common 19 20 /** 21 * Framework_Module_Forwards 22 * 23 * This module is for viewing and editing vpopmail forwards 24 * 25 * @uses ToasterAdmin_Auth_Domain 26 * @package ToasterAdmin 27 * @author Bill Shupp <hostmaster@shupp.org> 28 * @copyright 2007 Bill Shupp 29 * @license GPL 2.0 {@link http://www.gnu.org/licenses/gpl.txt} 30 * @link http://trac.merchbox.com/trac/toasteradmin 31 */ 32 class Framework_Module_Forwards extends ToasterAdmin_Auth_Domain 25 33 { 26 34 … … 35 43 function __construct() { 36 44 parent::__construct(); 37 // Make sure doamin was supplied 38 if (($result = $this->noDomainSupplied())) { 39 return $result; 40 } 41 // Make sure they are authorized 42 if (($result = $this->noDomainPrivs())) { 43 return $result; 44 } 45 $this->noDomainSupplied())) { 45 46 } 46 47 … … 55 56 } 56 57 57 58 /**59 * checkPrivileges60 *61 * @access protected62 * @return mixed true on success, PEAR_Error on failure63 */64 protected function checkPrivileges() {65 // Verify that they have access to this domain66 if (!$this->user->isDomainAdmin($this->domain)) {67 return PEAR::raiseError(_('Error: you do not have edit privileges on domain ') . $this->domain);68 }69 return true;70 }71 72 58 /** 73 59 * listForwards … … 78 64 function listForwards() { 79 65 80 $result = $this->checkPrivileges();81 if (PEAR::isError($result)) return $result;82 83 66 // Pagintation setup 84 67 $full_alias_array = $this->user->listAlias($this->domain); … … 133 116 */ 134 117 function addForward() { 135 $result = $this->checkPrivileges();136 if (PEAR::isError($result)) return $result;137 138 118 $form = $this->addForwardForm(); 139 119 $renderer =& new HTML_QuickForm_Renderer_AssocArray(); … … 179 159 */ 180 160 function addForwardNow() { 181 $result = $this->checkPrivileges();182 if (PEAR::isError($result)) return $result;183 184 161 $form = $this->addForwardForm(); 185 162 if (!$form->validate()) { … … 248 225 */ 249 226 protected function deleteForwardLine() { 250 251 227 $contents = $this->user->readFile($this->domain, '', ".qmail-" . $this->data['forward']); 252 228 if (PEAR::isError($contents)) { … … 286 262 */ 287 263 function modifyForward() { 288 289 $this->checkPrivileges();290 264 // Make sure forward was supplied 291 265 if (!isset($_REQUEST['forward'])) { … … 336 310 */ 337 311 function modifyForwardNow() { 338 $this->checkPrivileges();339 340 312 $forward = ereg_replace('^.qmail-', '', $_REQUEST['forward']); 341 313 $this->setData('forward', $forward); … … 411 383 */ 412 384 function deleteForwardLineNow() { 413 $this->checkPrivileges();414 415 385 // Make sure forward was supplied 416 386 if (!isset($_REQUEST['forward'])) { … … 453 423 */ 454 424 function deleteForward() { 455 $result = $this->checkPrivileges();456 if (PEAR::isError($result)) return $result;457 458 425 // Make sure forward was supplied 459 426 if (!isset($_REQUEST['forward'])) {
