Beispiel #1
0
 /**
  * limitsForm 
  * 
  * Create limits form
  * 
  * @access protected
  * @return HTML_QuickForm object
  */
 protected function limitsForm()
 {
     $defaults = array();
     $params = $this->user->getModUserParms();
     $this->userInfo = $this->user->userInfo($this->domain, $this->account);
     foreach ($params['flagParms'] as $param) {
         $defaults[$param] = $this->user->getGidBit($this->userInfo['gidflags'], $param);
     }
     // To MB
     $quota = (int) $this->userInfo['quota'];
     if ($quota > 0) {
         $quota = (int) $quota / 1024 / 1024;
     }
     $defaults['quota'] = $quota;
     $url = './?module=Accounts&class=Limits&event=modifyLimitsNow&';
     $url .= "&account={$this->account}&domain={$this->domain}";
     $form = ToasterAdmin_Form::factory('limitsForm', $url);
     $form->setDefaults($defaults);
     $form->addElement('text', 'quota', _('Quota in MB (0 for unlimited)'), array('size' => 4));
     $form->addElement('checkbox', 'no_pop', _('Disable POP'));
     $form->addElement('checkbox', 'no_imap', _('Disable IMAP'));
     $form->addElement('checkbox', 'no_dialup', _('Disable Dial-Up'));
     $form->addElement('checkbox', 'bounce_mail', _('Bounce Mail'));
     $form->addElement('checkbox', 'no_password_changing', _('Disable Password Changing'));
     $form->addElement('checkbox', 'no_webmail', _('Disable Webmail (SqWebmail)'));
     $form->addElement('checkbox', 'no_external_relay', _('Disable Relaying'));
     $form->addElement('checkbox', 'no_smtp', _('Disable SMTP-AUTH'));
     $form->addElement('checkbox', 'system_admin_privileges', _('SysAdmin Privileges'));
     $form->addElement('checkbox', 'system_expert_privileges', _('System Expert Privileges'));
     $form->addElement('checkbox', 'domain_admin_privileges', _('Domain Admin Privileges'));
     $form->addElement('checkbox', 'override_domain_limits', _('Override Domain Limits'));
     $form->addElement('checkbox', 'no_spamassassin', _('Disable SpamAssassin'));
     $form->addElement('checkbox', 'no_maildrop', _('Disable Maildrop Processing'));
     $form->addElement('checkbox', 'delete_spam', _('Delete Spam'));
     $form->addElement('checkbox', 'user_flag_0', _('User Flag 0'));
     $form->addElement('checkbox', 'user_flag_1', _('User Flag 1'));
     $form->addElement('checkbox', 'user_flag_2', _('User Flag 2'));
     $form->addElement('checkbox', 'user_flag_3', _('User Flag 3'));
     $form->addElement('submit', 'submit', _('Modify'));
     $form->registerRule('zero', 'regex', '/^(0|[1-9][0-9]+)$/');
     $form->addRule('quota', _('Error: only integers of 0 and greater are allowed for quotas'), 'zero', null, 'client');
     $form->addRule('quota', _('Error: only integers of 0 and greater are allowed for quotas'), 'numeric', null, 'client');
     $form->applyFilter('__ALL__', 'trim');
     return $form;
 }
Beispiel #2
0
 /**
  * limitsForm 
  * 
  * Create limits form
  * 
  * @access protected
  * @return HTML_QuickForm object
  */
 protected function limitsForm()
 {
     $defaults = $this->user->getLimits($this->domain);
     // To MB
     if ($defaults['default_quota'] > 0) {
         $defaults['default_quota'] = $defaults['default_quota'] / 1024 / 1024;
     }
     $url = './?module=Main&class=Limits&event=modifyLimitsNow&domain=';
     $url .= $this->domain;
     $form = ToasterAdmin_Form::factory('limitsForm', $url);
     $form->setDefaults($defaults);
     $form->addElement('text', 'max_aliases', _('Maximum Aliases (-1 for unlimited)'), array('size' => 4));
     $form->addElement('text', 'max_forwards', _('Maximum Forwards (-1 for unlimited)'), array('size' => 4));
     $form->addElement('text', 'max_autoresponders', _('Maximum Mail Robots (-1 for unlimited)'), array('size' => 4));
     $form->addElement('text', 'max_mailinglists', _('Maximum EZMLM-IDX Mailing Lists (-1 for unlimited)'), array('size' => 4));
     $form->addElement('text', 'default_quota', _('Default Quota in MB (0 for unlimited)'), array('size' => 4));
     $form->addElement('text', 'default_maxmsgcount', _('Default Message Count Limit (0 for unlimited)'), array('size' => 4));
     $form->addElement('checkbox', 'disable_pop', _('Disable POP'));
     $form->addElement('checkbox', 'disable_imap', _('Disable IMAP'));
     $form->addElement('checkbox', 'disable_dialup', _('Disable Dial-Up'));
     $form->addElement('checkbox', 'disable_password_changing', _('Disable Password Changing'));
     $form->addElement('checkbox', 'disable_webmail', _('Disable Webmail (SqWebmail)'));
     $form->addElement('checkbox', 'disable_external_relay', _('Disable Relaying'));
     $form->addElement('checkbox', 'disable_smtp', _('Disable SMTP-AUTH'));
     $form->addElement('submit', 'submit', _('Modify'));
     $form->registerRule('minusOne', 'regex', '/^(-1|[0-9]+)$/');
     $form->registerRule('zero', 'regex', '/^(0|[1-9][0-9]+)$/');
     $form->addRule('max_aliases', _('Error: only integers of -1 and greater allowed here'), 'minusOne', null, 'client');
     $form->addRule('max_forwards', _('Error: only integers of -1 and greater allowed here'), 'minusOne', null, 'client');
     $form->addRule('max_autoresponders', _('Error: only integers of -1 and greater allowed here'), 'minusOne', null, 'client');
     $form->addRule('max_mailinglists', _('Error: only integers of -1 and greater allowed here'), 'minusOne', null, 'client');
     $form->addRule('default_quota', _('Error: only integers of 0 and greater allowed here'), 'zero', null, 'client');
     $form->addRule('default_maxmsgcount', _('Error: only integers of 0 and greater allowed here'), 'zero', null, 'client');
     $form->applyFilter('__ALL__', 'trim');
     return $form;
 }
Beispiel #3
0
 /**
  * addDomainForm 
  * 
  * Create add domain form.
  * 
  * @access protected
  * @return object HTML_QuickForm object
  */
 protected function addDomainForm()
 {
     $form = ToasterAdmin_Form::factory('addDomainForm', './?module=Domains&event=addDomainNow');
     $form->addElement('text', 'domain', _('Domain'));
     $form->addElement('password', 'password', _('Password'));
     $form->addElement('submit', 'submit', _('Add Domain'));
     $form->addRule('domain', _('Please a domain name'), 'required', null, 'client');
     $form->addRule('password', _('Please enter a postmaster password'), 'required', null, 'client');
     $form->applyFilter('__ALL__', 'trim');
     return $form;
 }
Beispiel #4
0
 /**
  * _findForm 
  * 
  * Generate find form
  * 
  * @access private
  * @return void
  */
 private function _findForm()
 {
     $form = ToasterAdmin_Form::factory('formFind', './?module=Main&class=Find&event=findNow');
     $form->addElement('text', 'domain', _('Domain'));
     $form->addElement('submit', 'submit', _('Find Domain'));
     $form->addRule('domain', _('Please a domain name'), 'required', null, 'client');
     $form->applyFilter('__ALL__', 'trim');
     return $form;
 }
Beispiel #5
0
 /**
  * addAccountForm 
  * 
  * Create HTML_QuickForm instance of add account form
  * 
  * @access protected
  * @return object HTML_QuickForm object
  */
 protected function addAccountForm()
 {
     $url = "./?module=Accounts&event=addAccountNow&domain={$this->domain}";
     $form = ToasterAdmin_Form::factory('formAddAccount', $url);
     $form->setDefaults(array('account' => '@' . $this->domain));
     $form->addElement('text', 'account', _("Account"));
     $form->addElement('text', 'comment', _("Real Name/Comment"));
     $form->addElement('text', 'password', _("Password"));
     $form->addElement('submit', 'submit', _("Add Account"));
     $form->registerRule('sameDomain', 'regex', "/@{$this->domain}\$/i");
     $form->addRule('account', _("Account is required"), 'required', null, 'client');
     $form->addRule('comment', _("Comment is required"), 'required', null, 'client');
     $form->addRule('account', _("Account must be the full email address"), 'email', null, 'client');
     $form->addRule('account', _('Error: wrong domain in email address'), 'sameDomain');
     $form->addRule('password', _("Password is required"), 'required', null, 'client');
     return $form;
 }
Beispiel #6
0
 /**
  * modifyAccountForm 
  * 
  * Build the modify account form
  * 
  * @param mixed $account  account name
  * @param mixed $defaults defaults
  * 
  * @access protected
  * @return void
  */
 protected function modifyAccountForm($account, $defaults)
 {
     if ($this->user->isDomainAdmin($this->domain)) {
         $this->setData('isDomainAdmin', 1);
     }
     $this->setData('account', $account);
     $url = "./?module=Accounts&class=Modify&event=modifyAccountNow";
     $url .= "&domain={$this->domain}&account={$account}";
     $form = ToasterAdmin_Form::factory('formModifyAccount', $url);
     $form->setDefaults($defaults);
     $form->addElement('text', 'comment', _("Real Name/Comment"));
     $form->addElement('password', 'password', _("Password"));
     $form->addElement('password', 'password2', _("Re-Type Password"));
     $form->addElement('radio', 'routing', _('Mail Routing'), _('Standard (No Forwarding)'), 'routing_standard');
     $form->addElement('radio', 'routing', '', _('All Mail Deleted'), 'routing_deleted');
     $form->addElement('radio', 'routing', '', _('Forward to:'), 'routing_forwarded');
     $form->addElement('text', 'forward');
     $form->addElement('checkbox', 'save_a_copy', _('Save A Copy'));
     $form->addElement('checkbox', 'vacation', _('Send a Vacation Auto-Response'));
     $form->addElement('text', 'vacation_subject', _('Vacation Subject:'));
     $form->addElement('textarea', 'vacation_body', _('Vacation Message:'), 'rows="10" cols="40"');
     $form->addElement('submit', 'submit', _('Modify Account'));
     $form->addRule(array('password', 'password2'), _('The passwords do not match'), 'compare', null, 'client');
     $form->addRule('routing', _('Please select a mail routing type'), 'required', null, 'client');
     $form->addRule('forward', _('"Forward to" must be a valid email address'), 'email', null, 'client');
     return $form;
 }
Beispiel #7
0
 /**
  * modifyForwardForm 
  * 
  * Display modify forward form
  * 
  * @access public
  * @return object $form HTML_QuickForm object
  */
 function modifyForwardForm()
 {
     $this->setData('forwards_url', htmlspecialchars("./?module=Forwards&domain={$this->domain}"));
     // Form
     $form = ToasterAdmin_Form::factory('modifyForwardForm', './?module=Forwards&event=modifyForwardNow');
     $form->addElement('hidden', 'domain', $this->domain);
     $form->addElement('hidden', 'forward', $this->data['forward']);
     $form->addElement('text', 'destination', _("Destination Address"));
     $form->addElement('submit', 'submit', _("Add"));
     $form->addRule('forward', _("Forward is required"), 'required');
     $form->addRule('destination', _("Destination is required"), 'required', null, 'client');
     $form->addRule('destination', _("Destination must be a full email address"), 'email', null, 'client');
     return $form;
 }
Beispiel #8
0
 /**
  * _addForm 
  * 
  * Create add form
  * 
  * @access private
  * @return void
  */
 private function _addForm()
 {
     $form = ToasterAdmin_Form::factory('addAliasDomainForm', './?module=Main&class=AliasDomain&event=addNow');
     $form->addElement('text', 'domain', _('Real Domain'));
     $form->addElement('text', 'alias', _('Alias Domain'));
     $form->addElement('submit', 'submit', _('Add'));
     $form->addRule('domain', _('Please specify a Real Domain'), 'required', null, 'client');
     $form->addRule('alias', _('Please specify an Alias Domain'), 'required', null, 'client');
     $form->applyFilter('__ALL__', 'trim');
     return $form;
 }
Beispiel #9
0
 /**
  * createLoginForm 
  * 
  * Create HTML_QuickForm object for the login form
  * 
  * @access protected
  * @return object  HTML_QuickForm object
  */
 protected function createLoginForm()
 {
     $url = $_SERVER['REQUEST_URI'] . '&event=loginNow';
     $form = ToasterAdmin_Form::factory('formLogin', $url);
     $form->addElement('header', 'MyHeader', _('Login'));
     $form->addElement('text', 'email', _('Email'));
     $form->addElement('password', 'password', _('Password'));
     $form->addElement('submit', 'submit', _('Login'));
     $form->addRule('email', _('Please enter your email address'), 'required', null, 'client');
     $form->addRule('email', _('Please enter a valid email address'), 'email', null, 'client');
     $form->addRule('password', _('Please enter your password'), 'required', null, 'client');
     $form->applyFilter('__ALL__', 'trim');
     return $form;
 }
Beispiel #10
0
 /**
  * _addForm 
  * 
  * Create Add IP Map form
  * 
  * @access private
  * @return void
  */
 private function _addForm()
 {
     $form = ToasterAdmin_Form::factory('addIPMapForm', './?module=Main&class=IPMaps&event=addNow');
     $form->addElement('text', 'ip', _('IP Address'));
     $form->addElement('text', 'domain', _('Domain'));
     $form->addElement('submit', 'submit', _('Add'));
     $form->addRule('ip', _('Please specify an IP'), 'required', null, 'client');
     $form->addRule('domain', _('Please specify a Domain'), 'required', null, 'client');
     $form->applyFilter('__ALL__', 'trim');
     return $form;
 }