* @copyright 2002-2009 Alexandros Vellis * @package plugins * @subpackage avelsieve */ /** * Vacation / Autoresponder Action */ class avelsieve_action_vacation extends avelsieve_action { var $num = 6; var $capability = 'vacation'; var $options = array( 'vac_addresses' => '', 'vac_days' => '7', 'vac_subject' => '', 'vac_message' => '' ); var $image_src = 'images/icons/status_away.png'; function avelsieve_action_vacation(&$s, $rule = array()) { $this->init(); $this->text = _("Vacation / Autoresponder"); $this->options['vac_addresses'] = get_user_addresses(); if($this->translate_return_msgs==true) { $this->options['vac_message'] = _("This is an automated reply; I am away and will not be able to reply to you immediately."). ' '. _("I will get back to you as soon as I return."); } else { $this->options['vac_message'] = "This is an automated reply; I am away and will not be able to reply to you immediately.". "I will get back to you as soon as I return."; } $this->helptxt = _("The notice will be sent only once to each person that sends you mail, and will not be sent to a mailing list address."); $this->avelsieve_action($s, $rule); } function options_html($val) { /* Provide sane default for maxlength */ $maxlength = 200; if(isset($val['vac_addresses']) && strlen($val['vac_addresses']) > 200) { $maxlength = (string) (strlen($val['vac_addresses']) + 50); } $out = ''. ''. ''. ''. ''. '
'. _("Subject:") . ''. ''. '
'._("Optional subject of the vacation message.") .''. '
'. _("Your Addresses:"). ''. ' '. '
'._("A vacation / autorespond message will be sent only if an email is sent explicitly to one of these addresses.") .''. '
'. _("Days:"). ''. ' ' . _("days"). '
'._("A vacation / autorespond message will not be resent to the same address, within this number of days.") .''. '
'. _("Message:") . ''. ''. '
'; return $out; } function validate($val, &$errormsg) { if(!is_numeric($val['vac_days']) || !($val['vac_days'] > 0)) { $errormsg[] = _("The number of days between vacation messages must be a positive number."); } if(!empty($val['vac_addresses'])) { $onemailregex = "[a-zA-Z0-9]+[a-zA-Z0-9\._\+-]*@[a-zA-Z0-9_-]+[a-zA-Z0-9\._-]+"; if(!preg_match("/^$onemailregex(,$onemailregex)*$/" , $val['vac_addresses'])){ $errormsg[] = _("Incorrect email address(es). You must enter one or more valid email addresses, separated by comma."); } } } }