Changeset 163
- Timestamp:
- 07/01/07 12:00:48 (2 years ago)
- Files:
-
- trunk/Framework/Auth/Vpopmail.php (modified) (2 diffs)
- trunk/Framework/Module/Accounts.php (modified) (25 diffs)
- trunk/Framework/Module/Domains.php (modified) (10 diffs)
- trunk/Framework/Module/Forwards.php (modified) (22 diffs)
- trunk/Framework/Module/Login.php (modified) (1 diff)
- trunk/Framework/Module/Responders.php (modified) (24 diffs)
- trunk/Framework/Object/Web.php (modified) (2 diffs)
- trunk/Framework/Site/Default/config.xml (modified) (1 diff)
- trunk/Framework/User/toasterAdmin.php (modified) (7 diffs)
- trunk/Vpopmail/Base.php (modified) (6 diffs)
- trunk/Vpopmail/Main.php (modified) (48 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/Framework/Auth/Vpopmail.php
r154 r163 33 33 $timeLimit = (int)Framework::$site->config->inactiveTimeout; 34 34 $this->user->recordio("timeout info: time: $time, lastActionTime: $lastActionTime, timeLimit: $timeLimit"); 35 if (($time - $lastActionTime) > $timeLimit) {35 if (($time - $lastActionTime) > $timeLimit) { 36 36 header('Location: ./?module=Login&event=logoutInactive'); 37 37 return false; … … 41 41 $encryptedPass = $this->session->__get('password'); 42 42 $plainPass = Framework_User_passEncryption::decryptPass($encryptedPass, (string)Framework::$site->config->mcryptKey); 43 if (!PEAR::isError($this->user->authenticate($this->session->__get('email'), $plainPass))) {43 if (!PEAR::isError($this->user->authenticate($this->session->__get('email'), $plainPass))) { 44 44 $this->session->__set('lastActionTime', $time); 45 45 $this->setData('logged_in_as', $this->session->__get('email')); trunk/Framework/Module/Accounts.php
r159 r163 41 41 parent::__construct(); 42 42 // Make sure doamin was supplied 43 if (!isset($_REQUEST['domain']))43 if (!isset($_REQUEST['domain'])) 44 44 throw new Framework_Exception(_("Error: no domain supplied")); 45 45 $this->domain = $_REQUEST['domain']; … … 56 56 protected function checkPrivileges() { 57 57 // Verify that they have access to this domain 58 if (!$this->user->isDomainAdmin($this->domain)) {58 if (!$this->user->isDomainAdmin($this->domain)) { 59 59 return PEAR::raiseError(_('Error: you do not have edit privileges on domain ') . $this->domain); 60 60 } … … 75 75 76 76 $privs = $this->checkPrivileges(); 77 if (PEAR::isError($privs)) return privs;77 if (PEAR::isError($privs)) return privs; 78 78 79 79 // Pagintation setup 80 80 $total = $this->user->userCount($this->domain); 81 if (PEAR::isError($total)) return $total;81 if (PEAR::isError($total)) return $total; 82 82 $this->paginate($total); 83 83 … … 86 86 $accounts = array(); 87 87 $count = 0; 88 while (list($key,$val) = each($account_array)) {88 while (list($key,$val) = each($account_array)) { 89 89 $accounts[$count]['account'] = $key; 90 90 $accounts[$count]['comment'] = $val['comment']; … … 124 124 125 125 $privs = $this->checkPrivileges(); 126 if (PEAR::isError($privs)) return privs;126 if (PEAR::isError($privs)) return privs; 127 127 128 128 $form = $this->addAccountForm(); … … 137 137 static function sameDomain ($name, $value) { 138 138 $emailArray = explode('@', $value); 139 if ($emailArray[1] == $this->domain) {139 if ($emailArray[1] == $this->domain) { 140 140 return true; 141 141 } else { … … 147 147 148 148 $privs = $this->checkPrivileges(); 149 if (PEAR::isError($privs)) return privs;149 if (PEAR::isError($privs)) return privs; 150 150 151 151 $form = $this->addAccountForm(); 152 if (!$form->validate()) {152 if (!$form->validate()) { 153 153 $renderer =& new HTML_QuickForm_Renderer_Array(); 154 154 $form->accept($renderer); … … 161 161 $emailArray = explode('@', $_REQUEST['account']); 162 162 $result = $this->user->addUser($this->domain, $emailArray[0], $_REQUEST['password'], $_REQUEST['comment']); 163 if (PEAR::isError($result)) {163 if (PEAR::isError($result)) { 164 164 $this->setData('message', _("Error: ") . $result->getMessage()); 165 165 $renderer =& new HTML_QuickForm_Renderer_Array(); … … 202 202 203 203 $privs = $this->checkPrivileges(); 204 if (PEAR::isError($privs)) return privs;205 206 if (!isset($_REQUEST['account'])) {204 if (PEAR::isError($privs)) return privs; 205 206 if (!isset($_REQUEST['account'])) { 207 207 return PEAR::raiseError(_("Error: no account supplied")); 208 208 } … … 221 221 222 222 $privs = $this->checkPrivileges(); 223 if (PEAR::isError($privs)) return privs;224 225 if (!isset($_REQUEST['account'])) {223 if (PEAR::isError($privs)) return privs; 224 225 if (!isset($_REQUEST['account'])) { 226 226 return PEAR::raiseError(_("Error: no account supplied")); 227 227 } 228 228 229 if (!isset($_REQUEST['domain'])) {229 if (!isset($_REQUEST['domain'])) { 230 230 return PEAR::raiseError(_("Error: no domain supplied")); 231 231 } 232 232 233 233 $result = $this->user->delUser($this->domain, $_REQUEST['account']); 234 if (PEAR::isError($result)) {234 if (PEAR::isError($result)) { 235 235 return $result; 236 236 } … … 244 244 245 245 $privs = $this->checkPrivileges(); 246 if (PEAR::isError($privs)) return privs;246 if (PEAR::isError($privs)) return privs; 247 247 248 248 $this->setData('message', _("Delete Canceled")); … … 254 254 255 255 // Make sure account was supplied 256 if (!isset($_REQUEST['account'])) {256 if (!isset($_REQUEST['account'])) { 257 257 return PEAR::raiseError(_("Error: no account supplied")); 258 258 } … … 260 260 261 261 // Check privs 262 if (!$this->user->isUserAdmin($account, $this->domain)) {262 if (!$this->user->isUserAdmin($account, $this->domain)) { 263 263 return PEAR::raiseError(_('Error: you do not have edit privileges on domain ') . $this->domain); 264 264 } 265 265 266 266 // See what user_info to use 267 if ($this->user->isDomainAdmin($this->domain)) {267 if ($this->user->isDomainAdmin($this->domain)) { 268 268 $account_info = $this->user->userInfo($this->domain, $_REQUEST['account']); 269 if (PEAR::isError($account_info)) return $account_info;269 if (PEAR::isError($account_info)) return $account_info; 270 270 } else { 271 271 $account_info = $this->user->loginUser; … … 274 274 // Get .qmail info if it exists 275 275 $dot_qmail = $this->user->readFile($this->domain, $_REQUEST['account'], '.qmail'); 276 if (PEAR::isError($dot_qmail) && $dot_qmail->getMessage() != '-ERR 2102 No such file or directory') {276 if (PEAR::isError($dot_qmail) && $dot_qmail->getMessage() != '-ERR 2102 No such file or directory') { 277 277 return $dot_qmail; 278 278 } … … 294 294 $this->setData('LANG_Modify_Account', _("Modify Account")); 295 295 $this->setData('LANG_Domain_Menu', _("Domain Menu")); 296 if ($this->user->isDomainAdmin($this->domain)) {296 if ($this->user->isDomainAdmin($this->domain)) { 297 297 $this->setData('isDomainAdmin', 1); 298 298 $this->setData('LANG_Main_Menu', _("Main Menu")); … … 329 329 330 330 // Make sure account was supplied 331 if (!isset($_REQUEST['account'])) {331 if (!isset($_REQUEST['account'])) { 332 332 return PEAR::raiseError(_("Error: no account supplied")); 333 333 } … … 335 335 336 336 // Check privs 337 if (!$this->user->isUserAdmin($account, $this->domain)) {337 if (!$this->user->isUserAdmin($account, $this->domain)) { 338 338 return PEAR::raiseError(_('Error: you do not have edit privileges on domain ') . $this->domain); 339 339 } … … 341 341 // See what user_info to use 342 342 $account_info = $this->user->userInfo($this->domain, $_REQUEST['account']); 343 if (PEAR::isError($account_info)) {343 if (PEAR::isError($account_info)) { 344 344 return $account_info; 345 345 } … … 352 352 $defaults = $this->user->parseHomeDotqmail($dot_qmail, $account_info); 353 353 $form = $this->modifyAccountForm($account, $defaults); 354 if (!$form->validate()) {354 if (!$form->validate()) { 355 355 $this->setData('message', _("Error Modifying Account")); 356 356 $renderer =& new HTML_QuickForm_Renderer_Array(); … … 364 364 $routing = ''; 365 365 $save_a_copy = 0; 366 if ($_REQUEST['routing'] == 'routing_standard') {366 if ($_REQUEST['routing'] == 'routing_standard') { 367 367 $routing = 'standard'; 368 } else if ($_REQUEST['routing'] == 'routing_deleted') {368 } else if ($_REQUEST['routing'] == 'routing_deleted') { 369 369 $routing = 'deleted'; 370 } else if ($_REQUEST['routing'] == 'routing_forwarded') {371 if (empty($_REQUEST['forward'])) {370 } else if ($_REQUEST['routing'] == 'routing_forwarded') { 371 if (empty($_REQUEST['forward'])) { 372 372 $this->setData('message', _('Error: you must supply a forward address')); 373 373 return $this->modifyAccount(); … … 376 376 } 377 377 $routing = 'forwarded'; 378 if (isset($_REQUEST['save_a_copy'])) $save_a_copy = 1;378 if (isset($_REQUEST['save_a_copy'])) $save_a_copy = 1; 379 379 } else { 380 380 $this->setData('message', _('Error: unsupported routing selection')); … … 384 384 // Check for vacation 385 385 $vacation = 0; 386 if (isset($_REQUEST['vacation'])) {386 if (isset($_REQUEST['vacation'])) { 387 387 $vacation = 1; 388 388 $vacation_subject = $_REQUEST['vacation_subject']; … … 392 392 // Build .qmail contents 393 393 $dot_qmail_contents = ''; 394 if ($routing == 'deleted') {394 if ($routing == 'deleted') { 395 395 $dot_qmail_contents = "# delete"; 396 } else if ($routing == 'forwarded') {396 } else if ($routing == 'forwarded') { 397 397 $dot_qmail_contents = "&$forward"; 398 if ($save_a_copy = 1) $dot_qmail_contents .= "\n./Maildir/";399 } 400 401 if ($vacation == 1) {402 if (strlen($dot_qmail_contents) > 0) $dot_qmail_contents .= "\n";398 if ($save_a_copy = 1) $dot_qmail_contents .= "\n./Maildir/"; 399 } 400 401 if ($vacation == 1) { 402 if (strlen($dot_qmail_contents) > 0) $dot_qmail_contents .= "\n"; 403 403 $vacation_dir = $account_info['user_dir'] . '/vacation'; 404 404 $dot_qmail_contents .= '| ' . VPOPMAIL_ROBOT_PROGRAM; … … 409 409 410 410 $dot_qmail_file = '.qmail'; 411 if (strlen($dot_qmail_contents) > 0) {411 if (strlen($dot_qmail_contents) > 0) { 412 412 $contents = explode("\n", $dot_qmail_contents); 413 413 // Delete existing file … … 417 417 418 418 // Add vacation files 419 if ($vacation == 1) {419 if ($vacation == 1) { 420 420 $vcontents = "From: " . $account_info['name'] . "@{$this->domain}\n"; 421 421 $vcontents .= "Subject: $vacation_subject\n\n"; trunk/Framework/Module/Domains.php
r162 r163 47 47 public function accessDirector() 48 48 { 49 if (!$this->user->isSysAdmin()) {49 if (!$this->user->isSysAdmin()) { 50 50 $domain = $this->session->__get('domain'); 51 51 // Redirect to appropriate page 52 if ($this->user->isDomainAdmin($domain)) {52 if ($this->user->isDomainAdmin($domain)) { 53 53 header("Location: ./?module=Domains&event=domainMenu&domain=" . urlencode($domain)); 54 54 return; … … 72 72 // Pagination setup 73 73 $total = $this->user->domainCount(); 74 if (PEAR::isError($total)) return PEAR::raiseError($total);74 if (PEAR::isError($total)) return PEAR::raiseError($total); 75 75 $this->paginate($total); 76 76 … … 79 79 $domains = array(); 80 80 $count = 0; 81 while (list($key,$val) = each($domain_array)) {81 while (list($key,$val) = each($domain_array)) { 82 82 $domains[$count]['name'] = $key; 83 83 $domains[$count]['edit_url'] = htmlspecialchars('./?module=Domains&event=domainMenu&domain=' . $key); … … 104 104 { 105 105 // Make sure the domain was supplied 106 if ($domain == null) {107 if (empty($_REQUEST['domain']))106 if ($domain == null) { 107 if (empty($_REQUEST['domain'])) 108 108 return PEAR::raiseError(_("Error: no domain supplied")); 109 109 $domain = $_REQUEST['domain']; 110 110 } 111 111 112 if (!$this->user->isDomainAdmin($domain)) {112 if (!$this->user->isDomainAdmin($domain)) { 113 113 return PEAR::raiseError(_('Error: you do not have edit privileges on domain ') . $domain); 114 114 } 115 115 116 if ($this->user->isSysAdmin()) $this->setData('isSysAdmin', 1);116 if ($this->user->isSysAdmin()) $this->setData('isSysAdmin', 1); 117 117 // Setup URLs 118 118 $this->setData('domain', $domain); … … 135 135 function addDomain() 136 136 { 137 if (!$this->user->isSysAdmin()) {137 if (!$this->user->isSysAdmin()) { 138 138 return PEAR::raiseError(_('Error: you do not have add domain privileges')); 139 139 } … … 149 149 function addDomainNow() 150 150 { 151 if (!$this->user->isSysAdmin()) {151 if (!$this->user->isSysAdmin()) { 152 152 return PEAR::raiseError(_('Error: you do not have add domain privileges')); 153 153 } 154 154 155 155 $form = $this->addDomainForm(); 156 if (!$form->validate()) {156 if (!$form->validate()) { 157 157 $this->addDomain(); 158 158 return; … … 161 161 // Add domain 162 162 $result = $this->user->AddDomain($_REQUEST['domain'], $_REQUEST['password']); 163 if (PEAR::isError($result)) {163 if (PEAR::isError($result)) { 164 164 $this->setData('message', _("Error: ") . $result->getMessage()); 165 165 return $this->addDomain(); … … 187 187 { 188 188 // Make sure the domain was supplied 189 if ($domain == null) {190 if (empty($_REQUEST['domain']))189 if ($domain == null) { 190 if (empty($_REQUEST['domain'])) 191 191 return PEAR::raiseError(_("Error: no domain supplied")); 192 192 $domain = $_REQUEST['domain']; 193 193 } 194 194 195 if (!$this->user->isDomainAdmin($domain)) {195 if (!$this->user->isDomainAdmin($domain)) { 196 196 return PEAR::raiseError(_('Error: you do not have edit privileges on domain ') . $domain); 197 197 } … … 211 211 { 212 212 // Make sure the domain was supplied 213 if ($domain == null) {214 if (empty($_REQUEST['domain']))213 if ($domain == null) { 214 if (empty($_REQUEST['domain'])) 215 215 return PEAR::raiseError(_("Error: no domain supplied")); 216 216 $domain = $_REQUEST['domain']; 217 217 } 218 218 219 if (!$this->user->isDomainAdmin($domain)) {219 if (!$this->user->isDomainAdmin($domain)) { 220 220 return PEAR::raiseError(_('Error: you do not have edit privileges on domain ') . $domain); 221 221 } … … 223 223 // Delete domain 224 224 $result = $this->user->delDomain($domain); 225 if (PEAR::isError($result)) {225 if (PEAR::isError($result)) { 226 226 $this->setData('message', _("Error: ") . $result->getMessage()); 227 227 return $this->listDomains(); trunk/Framework/Module/Forwards.php
r154 r163 41 41 parent::__construct(); 42 42 // Make sure doamin was supplied 43 if (!isset($_REQUEST['domain']))43 if (!isset($_REQUEST['domain'])) 44 44 throw new Framework_Exception(_("Error: no domain supplied")); 45 45 $this->domain = $_REQUEST['domain']; … … 61 61 protected function checkPrivileges() { 62 62 // Verify that they have access to this domain 63 if (!$this->user->isDomainAdmin($this->domain)) {63 if (!$this->user->isDomainAdmin($this->domain)) { 64 64 return PEAR::raiseError(_('Error: you do not have edit privileges on domain ') . $this->domain); 65 65 } … … 72 72 // Pagintation setup 73 73 $full_alias_array = $this->user->ListAlias($this->domain); 74 if ($this->user->Error) return PEAR::raiseError(_("Error: ") . $this->user->Error);74 if ($this->user->Error) return PEAR::raiseError(_("Error: ") . $this->user->Error); 75 75 // Format the valias outpt from vpopmaild 76 76 $aliasesParsed = $this->user->parseAliases($full_alias_array, 'forwards'); … … 79 79 $this->setData('total', $total); 80 80 $this->setData('limit', (integer)Framework::$site->config->maxPerPage); 81 if (isset($_REQUEST['start']) && !ereg('[^0-9]', $_REQUEST['start'])) {82 if ($_REQUEST['start'] == 0) {81 if (isset($_REQUEST['start']) && !ereg('[^0-9]', $_REQUEST['start'])) { 82 if ($_REQUEST['start'] == 0) { 83 83 $start = 1; 84 84 } else { … … 86 86 } 87 87 } 88 if (!isset($start)) $start = 1;88 if (!isset($start)) $start = 1; 89 89 $this->setData('start', $start); 90 90 $this->setData('currentPage', ceil($this->data['start'] / $this->data['limit'])); … … 93 93 // List Accounts 94 94 $alias_array = $this->user->listAliases($aliasesParsed, $this->data['currentPage'], $this->data['limit']); 95 if ($this->user->Error) return PEAR::raiseError(_("Error: ") . $this->user->Error);96 97 if (count($alias_array) == 0) {95 if ($this->user->Error) return PEAR::raiseError(_("Error: ") . $this->user->Error); 96 97 if (count($alias_array) == 0) { 98 98 $this->setData('message', _("No Forwards. Care to add one?")); 99 99 return $this->addForward(); … … 102 102 $aliases = array(); 103 103 $count = 0; 104 while (list($key,$val) = each($alias_array)) {104 while (list($key,$val) = each($alias_array)) { 105 105 $forwardName = ereg_replace('@.*$', '', $key); 106 106 $aliases[$count]['name'] = $forwardName; … … 132 132 function addForward() { 133 133 $result = $this->checkPrivileges(); 134 if (PEAR::isError($result)) return $result;134 if (PEAR::isError($result)) return $result; 135 135 136 136 $form = $this->addForwardForm(); … … 168 168 function addForwardNow() { 169 169 $result = $this->checkPrivileges(); 170 if (PEAR::isError($result)) return $result;170 if (PEAR::isError($result)) return $result; 171 171 172 172 $form = $this->addForwardForm(); 173 if (!$form->validate()) {173 if (!$form->validate()) { 174 174 $renderer =& new HTML_QuickForm_Renderer_Array(); 175 175 $form->accept($renderer); … … 184 184 185 185 $result = $this->addForwardLine(); 186 if (PEAR::isError($result)) {187 if ($result->getMessage() == 'Forward Exists') {186 if (PEAR::isError($result)) { 187 if ($result->getMessage() == 'Forward Exists') { 188 188 $this->setData('message', _("Forward already exists")); 189 189 return $this->addForward(); … … 198 198 199 199 $contents = $this->user->ReadFile($this->domain, '', ".qmail-" . $this->data['forward']); 200 if ($type == 'new') {201 if (!$this->user->Error) {200 if ($type == 'new') { 201 if (!$this->user->Error) { 202 202 return PEAR::raiseError("Forward Exists"); 203 } else if ($this->user->Error != 'command failed - -ERR 2102 No such file or directory') {203 } else if ($this->user->Error != 'command failed - -ERR 2102 No such file or directory') { 204 204 return PEAR::raiseError(_("Error: ") . $this->user->Error); 205 205 } 206 206 } else { 207 if ($this->user->Error) return PEAR::raiseError(_("Error: ") . $this->user->Error);207 if ($this->user->Error) return PEAR::raiseError(_("Error: ") . $this->user->Error); 208 208 } 209 209 210 210 // Now build a new array without that forward 211 if (empty($contents)) $contents = array();212 if (in_array("&" . $this->data['destination'], $contents)) {211 if (empty($contents)) $contents = array(); 212 if (in_array("&" . $this->data['destination'], $contents)) { 213 213 return PEAR::raiseError('Error: destination already exists'); 214 214 } 215 215 array_push($contents, "&" . $this->data['destination']); 216 216 $this->user->WriteFile($contents, $this->domain, '', ".qmail-" . $this->data['forward']); 217 if ($this->user->Error) {217 if ($this->user->Error) { 218 218 return PEAR::raiseError(_("Error: ") . $this->user->Error); 219 219 } … … 223 223 224 224 $contents = $this->user->ReadFile($this->domain, '', ".qmail-" . $this->data['forward']); 225 if ($this->user->Error)225 if ($this->user->Error) 226 226 return PEAR::raiseError($this->user->Error, 1); 227 227 228 228 // Now build a new array without that forward 229 if (!in_array($this->data['line'], $contents)) {229 if (!in_array($this->data['line'], $contents)) { 230 230 return PEAR::raiseError(_('Error: forward line does not exist'), 2); 231 231 } 232 232 233 if (count($contents) == 1) {233 if (count($contents) == 1) { 234 234 // tell caller to delete instead 235 235 return PEAR::raiseError(_("Only one line, use delete instead"), 3); … … 237 237 $newContents = array(); 238 238 $count = 1; 239 while (list($key, $val) = each($contents)) {240 if ($val == $this->data['line']) continue;239 while (list($key, $val) = each($contents)) { 240 if ($val == $this->data['line']) continue; 241 241 $newContents[$count] = $val; 242 242 $count++; 243 243 } 244 244 $this->user->WriteFile($newContents, $this->domain, '', ".qmail-" . $this->data['forward']); 245 if ($this->user->Error) {245 if ($this->user->Error) { 246 246 return PEAR::raiseError(_("Error: ") . $this->user->Error, 4); 247 247 } … … 253 253 $this->checkPrivileges(); 254 254 // Make sure forward was supplied 255 if (!isset($_REQUEST['forward'])) {255 if (!isset($_REQUEST['forward'])) { 256 256 $this->setData('message', _("Error: no forward provided")); 257 257 return $this->listForwards(); … … 262 262 // Get forward info if it exists 263 263 $contents = $this->user->ReadFile($this->domain, '', ".qmail-$forward"); 264 if ($this->user->Error) return PEAR::raiseError(_("Error: ") . $this->user->Error);264 if ($this->user->Error) return PEAR::raiseError(_("Error: ") . $this->user->Error); 265 265 266 266 // Set template data … … 279 279 $count = 0; 280 280 $forward_array = array(); 281 while (list($key,$val) = each($contents)) {281 while (list($key,$val) = each($contents)) { 282 282 $forward_array[$count]['destination'] = $this->user->displayForwardLine($val); 283 283 $forward_array[$count]['delete_url'] = htmlspecialchars("./?module=Forwards&event=deleteForwardLineNow&domain={$this->domain}&forward=" . $_REQUEST['forward'] . "&line=" . urlencode($val)); … … 295 295 // Get forward info if it exists 296 296 $contents = $this->user->ReadFile($this->domain, '', ".qmail-$forward"); 297 if ($this->user->Error) return PEAR::raiseError(_("Error: ") . $this->user->Error);297 if ($this->user->Error) return PEAR::raiseError(_("Error: ") . $this->user->Error); 298 298 299 299 $form = $this->modifyForwardForm(); 300 if (!$form->validate()) {300 if (!$form->validate()) { 301 301 302 302 // Set template data … … 313 313 314 314 $result = $this->addForwardLine($type = 'modify'); 315 if (PEAR::isError($result)) {316 if ($result->getMessage() == 'Error: destination already exists') {315 if (PEAR::isError($result)) { 316 if ($result->getMessage() == 'Error: destination already exists') { 317 317 $this->setData('message', _("Error: destination already exists")); 318 318 return $this->modifyForward(); … … 354 354 355 355 // Make sure forward was supplied 356 if (!isset($_REQUEST['forward'])) {356 if (!isset($_REQUEST['forward'])) { 357 357 $this->setData('message', _("Error: no forward provided")); 358 358 return $this->listForwards(); 359 359 } 360 360 // Make sure line was supplied 361 if (!isset($_REQUEST['line'])) {361 if (!isset($_REQUEST['line'])) { 362 362 $this->setData('message', _("Error: no forward line provided")); 363 363 return $this->modifyForward(); … … 369 369 370 370 $result = $this->deleteForwardLine(); 371 if (PEAR::isError($result)) {372 if ($result->getCode() == 1) {371 if (PEAR::isError($result)) { 372 if ($result->getCode() == 1) { 373 373 $this->setData('message', $result->getMessage()); 374 374 return $this->listAliases(); 375 } else if ($result->getCode() == 2) {375 } else if ($result->getCode() == 2) { 376 376 $this->setData('message', $result->getMessage()); 377 377 return $this->modifyForward(); 378 } else if ($result->getCode() == 3) {378 } else if ($result->getCode() == 3) { 379 379 return $this->deleteForward(); 380 380 } else { … … 391 391 392 392 // Make sure forward was supplied 393 if (!isset($_REQUEST['forward'])) {393 if (!isset($_REQUEST['forward'])) { 394 394 $this->setData('message', _("Error: no forward provided")); 395 395 return $this->listForwards(); … … 397 397 $forward = ereg_replace('^.qmail-', '', $_REQUEST['forward']); 398 398 $contents = $this->user->ReadFile($this->domain, '', ".qmail-" . $forward); 399 if ($this->user->Error)399 if ($this->user->Error) 400 400 return PEAR::raiseError($this->user->Error); 401 401 $this->user->RmFile($this->domain, '', '.qmail-' . $forward); 402 if ($this->user->Error)402 if ($this->user->Error) 403 403 return PEAR::raiseError($this->user->Error); 404 404 $this->setData('message', _("Forward Deleted Successfully")); trunk/Framework/Module/Login.php
r149 r163 39 39 if ($form->validate()) { 40 40 $result = $this->user->authenticate($_POST['email'], $_POST['password']); 41 if (PEAR::isError($result)) {41 if (PEAR::isError($result)) { 42 42 $this->setData('loginError', $result->getMessage()); 43 43 $this->setData('QF_Form', $form->toHtml()); trunk/Framework/Module/Responders.php
r154 r163 39 39 parent::__construct(); 40 40 // Make sure doamin was supplied 41 if (!isset($_REQUEST['domain']))41 if (!isset($_REQUEST['domain'])) 42 42 throw new Framework_Exception(_("Error: no domain supplied")); 43 43 $this->domain = $_REQUEST['domain']; … … 54 54 protected function checkPrivileges() { 55 55 // Verify that they have access to this domain 56 if (!$this->user->isDomainAdmin($this->domain)) {56 if (!$this->user->isDomainAdmin($this->domain)) { 57 57 return PEAR::raiseError(_('Error: you do not have edit privileges on domain ') . $this->domain); 58 58 } … … 79 79 // Pagintation setup 80 80 $total = count($autoresponders_raw); 81 if ($this->user->Error) die ("Error: {$this->user->Error}");81 if ($this->user->Error) die ("Error: {$this->user->Error}"); 82 82 $this->setData('total', $total); 83 83 $this->setData('limit', (integer)Framework::$site->config->maxPerPage); 84 if (isset($_REQUEST['start']) && !ereg('[^0-9]', $_REQUEST['start'])) {85 if ($_REQUEST['start'] == 0) {84 if (isset($_REQUEST['start']) && !ereg('[^0-9]', $_REQUEST['start'])) { 85 if ($_REQUEST['start'] == 0) { 86 86 $start = 1; 87 87 } else { … … 89 89 } 90 90 } 91 if (!isset($start)) $start = 1;91 if (!isset($start)) $start = 1; 92 92 $this->setData('start', $start); 93 93 $this->setData('currentPage', ceil($this->data['start'] / $this->data['limit'])); … … 98 98 $autoresponders = array(); 99 99 $count = 0; 100 while (list($key,$val) = each($autoresponders_paginated)) {100 while (list($key,$val) = each($autoresponders_paginated)) { 101 101 $autoresponders[$count]['autoresponder'] = $key; 102 102 $autoresponders[$count]['edit_url'] = htmlspecialchars("./?module=Responders&domain={$this->domain}&responder=$key&event=modifyResponder"); … … 142 142 static function sameDomain ($name, $value) { 143 143 $emailArray = explode('@', $value); 144 if ($emailArray[1] == $this->domain) return true;144 if ($emailArray[1] == $this->domain) return true; 145 145 return false; 146 146 } … … 149 149 150 150 $form = $this->addForm(); 151 if (!$form->validate()) {151 if (!$form->validate()) { 152 152 $renderer =& new HTML_QuickForm_Renderer_Array(); 153 153 $form->accept($renderer); … … 167 167 168 168 $this->user->AddUser($this->domain, $emailArray[0], $_REQUEST['password'], $_REQUEST['comment']); 169 if ($this->user->Error) {169 if ($this->user->Error) { 170 170 $this->setData('message', _("Error: ") . $this->user->Error); 171 171 $renderer =& new HTML_QuickForm_Renderer_Array(); … … 209 209 function delete() { 210 210 211 if (!isset($_REQUEST['account'])) {211 if (!isset($_REQUEST['account'])) { 212 212 return PEAR::raiseError(_("Error: no account supplied")); 213 213 } … … 225 225 function deleteNow() { 226 226 227 if (!isset($_REQUEST['account'])) {227 if (!isset($_REQUEST['account'])) { 228 228 return PEAR::raiseError(_("Error: no account supplied")); 229 229 } 230 230 231 if (!isset($_REQUEST['domain'])) {231 if (!isset($_REQUEST['domain'])) { 232 232 return PEAR::raiseError(_("Error: no domain supplied")); 233 233 } 234 234 235 235 $this->user->DelUser($this->domain, $_REQUEST['account']); 236 if ($this->user->Error) {236 if ($this->user->Error) { 237 237 return PEAR::raiseError(_("Error: ") . $this->user->Error); 238 238 } … … 252 252 253 253 // Make sure account was supplied 254 if (!isset($_REQUEST['responder'])) {254 if (!isset($_REQUEST['responder'])) { 255 255 return PEAR::raiseError(_("Error: no Auto-Responder supplied")); 256 256 } … … 258 258 259 259 // Check privs 260 if (!$this->user->isUserAdmin($account, $this->domain)) {260 if (!$this->user->isUserAdmin($account, $this->domain)) { 261 261 return PEAR::raiseError(_('Error: you do not have edit privileges on domain ') . $this->domain); 262 262 } … … 266 266 print_r($responder);exit; 267 267 268 if ($this->user->Error) {268 if ($this->user->Error) { 269 269 return PEAR::raiseError(_('Error: ') . $this->user->Error); 270 270 } … … 287 287 $this->setData('LANG_Modify_Account', _("Modify Account")); 288 288 $this->setData('LANG_Domain_Menu', _("Domain Menu")); 289 if ($this->user->isDomainAdmin($this->domain)) {289 if ($this->user->isDomainAdmin($this->domain)) { 290 290 $this->setData('isDomainAdmin', 1); 291 291 $this->setData('LANG_Main_Menu', _("Main Menu")); … … 322 322 323 323 // Make sure account was supplied 324 if (!isset($_REQUEST['account'])) {324 if (!isset($_REQUEST['account'])) { 325 325 return PEAR::raiseError(_("Error: no account supplied")); 326 326 } … … 328 328 329 329 // Check privs 330 if (!$this->user->isUserAdmin($account, $this->domain)) {330 if (!$this->user->isUserAdmin($account, $this->domain)) { 331 331 return PEAR::raiseError(_('Error: you do not have edit privileges on domain ') . $this->domain); 332 332 } … … 334 334 // See what user_info to use 335 335 $account_info = $this->user->UserInfo($this->domain, $_REQUEST['account']); 336 if ($this->user->Error) {336 if ($this->user->Error) { 337 337 return PEAR::raiseError(_('Error: ') . $this->user->Error); 338 338 } … … 340 340 // Get .qmail info if it exists 341 341 $dot_qmail = $this->user->ReadFile($this->domain, $_REQUEST['account'], '.qmail'); 342 if ($this->user->Error && $this->user->Error != 'command failed - -ERR 2102 No such file or directory') {342 if ($this->user->Error && $this->user->Error != 'command failed - -ERR 2102 No such file or directory') { 343 343 return PEAR::raiseError(_('Error: ') . $this->user->Error); 344 344 } 345 345 $defaults = $this->user->parseHomeDotqmail($dot_qmail, $account_info); 346 346 $form = $this->modifyAccountForm($account, $defaults); 347 if (!$form->validate()) {347 if (!$form->validate()) { 348 348 $this->setData('message', _("Error Modifying Account")); 349 349 $renderer =& new HTML_QuickForm_Renderer_Array(); … … 357 357 $routing = ''; 358 358 $save_a_copy = 0; 359 if ($_REQUEST['routing'] == 'routing_standard') {359 if ($_REQUEST['routing'] == 'routing_standard') { 360 360 $routing = 'standard'; 361 } else if ($_REQUEST['routing'] == 'routing_deleted') {361 } else if ($_REQUEST['routing'] == 'routing_deleted') { 362 362 $routing = 'deleted'; 363 } else if ($_REQUEST['routing'] == 'routing_forwarded') {364 if (empty($_REQUEST['forward'])) {363 } else if ($_REQUEST['routing'] == 'routing_forwarded') { 364 if (empty($_REQUEST['forward'])) { 365 365 return PEAR::raiseError(_('Error: you must supply a forward address')); 366 366 } else { … … 368 368 } 369 369 $routing = 'forwarded'; 370 if (isset($_REQUEST['save_a_copy'])) $save_a_copy = 1;370 if (isset($_REQUEST['save_a_copy'])) $save_a_copy = 1; 371 371 } else { 372 372 return PEAR::raiseError(_('Error: unsupported routing selection')); … … 375 375 // Check for vacation 376 376 $vacation = 0; 377 if (isset($_REQUEST['vacation'])) {377 if (isset($_REQUEST['vacation'])) { 378 378 $vacation = 1; 379 379 $vacation_subject = $_REQUEST['vacation_subject']; … … 383 383 // Build .qmail contents 384 384 $dot_qmail_contents = ''; 385 if ($routing == 'deleted') {385 if ($routing == 'deleted') { 386 386 $dot_qmail_contents = "# delete"; 387 } else if ($routing == 'forwarded') {387 } else if ($routing == 'forwarded') { 388 388 $dot_qmail_contents = "&$forward"; 389 if ($save_a_copy = 1) $dot_qmail_contents .= "\n./Maildir/";390 } 391 392 if ($vacation == 1) {393 if (strlen($dot_qmail_contents) > 0) $dot_qmail_contents .= "\n";389 if ($save_a_copy = 1) $dot_qmail_contents .= "\n./Maildir/"; 390 } 391 392 if ($vacation == 1) { 393 if (strlen($dot_qmail_contents) > 0) $dot_qmail_contents .= "\n"; 394 394 $vacation_dir = $account_info['user_dir'] . '/vacation'; 395 395 $dot_qmail_contents .= "| $autorespond 86400 3 $vacation_dir/message $vacation_dir"; … … 399
