当前位置: 首页>>代码示例>>PHP>>正文


PHP rcube_utils::check_email方法代码示例

本文整理汇总了PHP中rcube_utils::check_email方法的典型用法代码示例。如果您正苦于以下问题:PHP rcube_utils::check_email方法的具体用法?PHP rcube_utils::check_email怎么用?PHP rcube_utils::check_email使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在rcube_utils的用法示例。


在下文中一共展示了rcube_utils::check_email方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: save_data

 /**
  * Handler for submitted form (ajax request)
  *
  * Check fields and save to default identity if valid.
  * Afterwards the session flag is removed and we're done.
  */
 function save_data()
 {
     $rcmail = rcmail::get_instance();
     $identity = $rcmail->user->get_identity();
     $ident_level = intval($rcmail->config->get('identities_level', 0));
     $save_data = array('name' => rcube_utils::get_input_value('_name', rcube_utils::INPUT_POST), 'email' => rcube_utils::get_input_value('_email', rcube_utils::INPUT_POST), 'organization' => rcube_utils::get_input_value('_organization', rcube_utils::INPUT_POST), 'signature' => rcube_utils::get_input_value('_signature', rcube_utils::INPUT_POST));
     // don't let the user alter the e-mail address if disabled by config
     if (in_array($ident_level, array(1, 3, 4))) {
         $save_data['email'] = $identity['email'];
     }
     if (empty($save_data['name']) || empty($save_data['email'])) {
         $rcmail->output->show_message('formincomplete', 'error');
     } else {
         if (!rcube_utils::check_email($save_data['email'] = rcube_utils::idn_to_ascii($save_data['email']))) {
             $rcmail->output->show_message('emailformaterror', 'error', array('email' => $save_data['email']));
         } else {
             // save data
             $rcmail->user->update_identity($identity['identity_id'], $save_data);
             $rcmail->session->remove('plugin.newuserdialog');
             // hide dialog
             $rcmail->output->command('new_user_dialog_close');
             $rcmail->output->show_message('successfullysaved', 'confirmation');
         }
     }
     $rcmail->output->send();
 }
开发者ID:BIGGANI,项目名称:zpanelx,代码行数:32,代码来源:new_user_dialog.php

示例2: create_identity

 public function create_identity($p)
 {
     $rcmail = rcmail::get_instance();
     // prefs are set in create_user()
     if ($this->prefs) {
         if ($this->prefs['full_name']) {
             $p['record']['name'] = $this->prefs['full_name'];
         }
         if (($this->identities_level == 0 || $this->identities_level == 2) && $this->prefs['email_address']) {
             $p['record']['email'] = $this->prefs['email_address'];
         }
         if ($this->prefs['___signature___']) {
             $p['record']['signature'] = $this->prefs['___signature___'];
         }
         if ($this->prefs['reply_to']) {
             $p['record']['reply-to'] = $this->prefs['reply_to'];
         }
         if (($this->identities_level == 0 || $this->identities_level == 1) && isset($this->prefs['identities']) && $this->prefs['identities'] > 1) {
             for ($i = 1; $i < $this->prefs['identities']; $i++) {
                 unset($ident_data);
                 $ident_data = array('name' => '', 'email' => '');
                 // required data
                 if ($this->prefs['full_name' . $i]) {
                     $ident_data['name'] = $this->prefs['full_name' . $i];
                 }
                 if ($this->identities_level == 0 && $this->prefs['email_address' . $i]) {
                     $ident_data['email'] = $this->prefs['email_address' . $i];
                 } else {
                     $ident_data['email'] = $p['record']['email'];
                 }
                 if ($this->prefs['reply_to' . $i]) {
                     $ident_data['reply-to'] = $this->prefs['reply_to' . $i];
                 }
                 if ($this->prefs['___sig' . $i . '___']) {
                     $ident_data['signature'] = $this->prefs['___sig' . $i . '___'];
                 }
                 // insert identity
                 $rcmail->user->insert_identity($ident_data);
             }
         }
         // copy address book
         $contacts = $rcmail->get_address_book(null, true);
         if ($contacts && count($this->abook)) {
             foreach ($this->abook as $rec) {
                 // #1487096 handle multi-address and/or too long items
                 $rec['email'] = array_shift(explode(';', $rec['email']));
                 if (rcube_utils::check_email(rcube_utils::idn_to_ascii($rec['email']))) {
                     $rec['email'] = rcube_utils::idn_to_utf8($rec['email']);
                     $contacts->insert($rec, true);
                 }
             }
         }
         // mark identity as complete for following hooks
         $p['complete'] = true;
     }
     return $p;
 }
开发者ID:bbspike,项目名称:sentora-core,代码行数:57,代码来源:squirrelmail_usercopy.php

示例3: mailto_callback

 /**
  * Callback function used to build mailto: links around e-mail strings
  *
  * This also adds an onclick-handler to open the Rouncube compose message screen on such links
  *
  * @param array Matches result from preg_replace_callback
  * @return int Index of saved string value
  * @see rcube_string_replacer::mailto_callback()
  */
 public function mailto_callback($matches)
 {
     $href = $matches[1];
     $suffix = $this->parse_url_brackets($href);
     $email = $href;
     if (strpos($email, '?')) {
         list($email, ) = explode('?', $email);
     }
     // skip invalid emails
     if (!rcube_utils::check_email($email, false)) {
         return $matches[1];
     }
     $i = $this->add(html::a(array('href' => 'mailto:' . $href, 'onclick' => "return " . rcmail_output::JS_OBJECT_NAME . ".command('compose','" . rcube::JQ($href) . "',this)"), rcube::Q($href)) . $suffix);
     return $i >= 0 ? $this->get_replacement($i) : '';
 }
开发者ID:JotapePinheiro,项目名称:roundcubemail,代码行数:24,代码来源:rcmail_string_replacer.php

示例4: validate

 /**
  * Check the given data before saving.
  * If input isn't valid, the message to display can be fetched using get_error()
  *
  * @param array Assoziative array with data to save
  * @param boolean Attempt to fix/complete record automatically
  * @return boolean True if input is valid, False if not.
  */
 public function validate(&$save_data, $autofix = false)
 {
     $rcube = rcube::get_instance();
     $valid = true;
     // check validity of email addresses
     foreach ($this->get_col_values('email', $save_data, true) as $email) {
         if (strlen($email)) {
             if (!rcube_utils::check_email(rcube_utils::idn_to_ascii($email))) {
                 $error = $rcube->gettext(array('name' => 'emailformaterror', 'vars' => array('email' => $email)));
                 $this->set_error(self::ERROR_VALIDATE, $error);
                 $valid = false;
                 break;
             }
         }
     }
     // allow plugins to do contact validation and auto-fixing
     $plugin = $rcube->plugins->exec_hook('contact_validate', array('record' => $save_data, 'autofix' => $autofix, 'valid' => $valid));
     if ($valid && !$plugin['valid']) {
         $this->set_error(self::ERROR_VALIDATE, $plugin['error']);
     }
     if (is_array($plugin['record'])) {
         $save_data = $plugin['record'];
     }
     return $plugin['valid'];
 }
开发者ID:rasky,项目名称:roundcubemail,代码行数:33,代码来源:rcube_addressbook.php

示例5: save


//.........这里部分代码省略.........
                         switch ($type) {
                             case 'fileinto':
                             case 'fileinto_copy':
                                 $mailbox = $this->strip_value($mailboxes[$idx], false, false);
                                 $this->form['actions'][$i]['target'] = $this->mod_mailbox($mailbox, 'in');
                                 if ($type == 'fileinto_copy') {
                                     $type = 'fileinto';
                                     $this->form['actions'][$i]['copy'] = true;
                                 }
                                 break;
                             case 'reject':
                             case 'ereject':
                                 $target = $this->strip_value($area_targets[$idx]);
                                 $this->form['actions'][$i]['target'] = str_replace("\r\n", "\n", $target);
                                 //                 if ($target == '')
                                 //                      $this->errors['actions'][$i]['targetarea'] = $this->plugin->gettext('cannotbeempty');
                                 break;
                             case 'redirect':
                             case 'redirect_copy':
                                 $target = $this->strip_value($act_targets[$idx]);
                                 $domain = $this->strip_value($domain_targets[$idx]);
                                 // force one of the configured domains
                                 $domains = (array) $this->rc->config->get('managesieve_domains');
                                 if (!empty($domains) && !empty($target)) {
                                     if (!$domain || !in_array($domain, $domains)) {
                                         $domain = $domains[0];
                                     }
                                     $target .= '@' . $domain;
                                 }
                                 $this->form['actions'][$i]['target'] = $target;
                                 if ($target == '') {
                                     $this->errors['actions'][$i]['target'] = $this->plugin->gettext('cannotbeempty');
                                 } else {
                                     if (!rcube_utils::check_email($target)) {
                                         $this->errors['actions'][$i]['target'] = $this->plugin->gettext(!empty($domains) ? 'forbiddenchars' : 'noemailwarning');
                                     }
                                 }
                                 if ($type == 'redirect_copy') {
                                     $type = 'redirect';
                                     $this->form['actions'][$i]['copy'] = true;
                                 }
                                 break;
                             case 'addflag':
                             case 'setflag':
                             case 'removeflag':
                                 $_target = array();
                                 if (empty($flags[$idx])) {
                                     $this->errors['actions'][$i]['target'] = $this->plugin->gettext('noflagset');
                                 } else {
                                     foreach ($flags[$idx] as $flag) {
                                         $_target[] = $this->strip_value($flag);
                                     }
                                 }
                                 $this->form['actions'][$i]['target'] = $_target;
                                 break;
                             case 'vacation':
                                 $reason = $this->strip_value($reasons[$idx]);
                                 $interval_type = $interval_types[$idx] == 'seconds' ? 'seconds' : 'days';
                                 $this->form['actions'][$i]['reason'] = str_replace("\r\n", "\n", $reason);
                                 $this->form['actions'][$i]['subject'] = $subject[$idx];
                                 $this->form['actions'][$i]['addresses'] = array_shift($addresses);
                                 $this->form['actions'][$i][$interval_type] = $intervals[$idx];
                                 // @TODO: vacation :mime, :from, :handle
                                 foreach ((array) $this->form['actions'][$i]['addresses'] as $aidx => $address) {
                                     $this->form['actions'][$i]['addresses'][$aidx] = $address = trim($address);
                                     if (empty($address)) {
开发者ID:zamentur,项目名称:roundcube_ynh,代码行数:67,代码来源:rcube_sieve_engine.php

示例6: test_invalid_email

 /**
  * @dataProvider data_invalid_email
  */
 function test_invalid_email($email, $title)
 {
     $this->assertFalse(rcube_utils::check_email($email, false), $title);
 }
开发者ID:netcon-source,项目名称:roundcubemail,代码行数:7,代码来源:Utils.php

示例7: set_vacation

 /**
  * API: set vacation rule
  *
  * @param array $vacation Vacation rule information (see self::get_vacation())
  *
  * @return bool True on success, False on failure
  */
 public function set_vacation($data)
 {
     $this->exts = $this->sieve->get_extensions();
     $this->error = false;
     $this->init_script();
     $this->vacation_rule();
     // check supported extensions
     $date_extension = in_array('date', $this->exts);
     $regex_extension = in_array('regex', $this->exts);
     $seconds_extension = in_array('vacation-seconds', $this->exts);
     $vacation['type'] = 'vacation';
     $vacation['reason'] = $this->strip_value(str_replace("\r\n", "\n", $data['message']));
     $vacation['addresses'] = $data['addresses'];
     $vacation['subject'] = trim($data['subject']);
     $vacation['from'] = trim($data['from']);
     $vacation_tests = (array) $this->vacation['tests'];
     foreach ((array) $vacation['addresses'] as $aidx => $address) {
         $vacation['addresses'][$aidx] = $address = trim($address);
         if (empty($address)) {
             unset($vacation['addresses'][$aidx]);
         } else {
             if (!rcube_utils::check_email($address)) {
                 $this->error = "Invalid address in vacation addresses: {$address}";
                 return false;
             }
         }
     }
     if (!empty($vacation['from']) && !rcube_utils::check_email($vacation['from'])) {
         $this->error = "Invalid address in 'from': " . $vacation['from'];
         return false;
     }
     if ($vacation['reason'] == '') {
         $this->error = "No vacation message specified";
         return false;
     }
     if ($data['interval']) {
         if (!preg_match('/^([0-9]+)\\s*([sd])$/', $data['interval'], $m)) {
             $this->error = "Invalid vacation interval value: " . $data['interval'];
             return false;
         } else {
             if ($m[1]) {
                 $vacation[strtolower($m[2]) == 's' ? 'seconds' : 'days'] = $m[1];
             }
         }
     }
     // find and remove existing date/regex/true rules
     foreach ((array) $vacation_tests as $idx => $t) {
         if ($t['test'] == 'currentdate' || $t['test'] == 'true' || $t['test'] == 'header' && $t['type'] == 'regex' && $t['arg1'] == 'received') {
             unset($vacation_tests[$idx]);
         }
     }
     if ($date_extension) {
         foreach (array('start', 'end') as $var) {
             if ($dt = $data[$var]) {
                 $vacation_tests[] = array('test' => 'currentdate', 'part' => 'iso8601', 'type' => 'value-' . ($var == 'start' ? 'ge' : 'le'), 'zone' => $dt->format('O'), 'arg' => str_replace('+00:00', 'Z', strtoupper($dt->format('c'))));
             }
         }
     } else {
         if ($regex_extension) {
             // Add date range rules if range specified
             if ($data['start'] && $data['end']) {
                 if ($tests = self::build_regexp_tests($data['start'], $data['end'], $error)) {
                     $vacation_tests = array_merge($vacation_tests, $tests);
                 }
                 if ($error) {
                     $this->error = "Invalid dates specified or unsupported period length";
                     return false;
                 }
             }
         }
     }
     if ($data['action'] == 'redirect' || $data['action'] == 'copy') {
         if (empty($data['target']) || !rcube_utils::check_email($data['target'])) {
             $this->error = "Invalid address in action taget: " . $data['target'];
             return false;
         }
     } else {
         if ($data['action'] && $data['action'] != 'keep' && $data['action'] != 'discard') {
             $this->error = "Unsupported vacation action: " . $data['action'];
             return false;
         }
     }
     if (empty($vacation_tests)) {
         $vacation_tests = $this->rc->config->get('managesieve_vacation_test', array(array('test' => 'true')));
     }
     $rule = $this->vacation;
     $rule['type'] = 'if';
     $rule['name'] = $rule['name'] ?: 'Out-of-Office';
     $rule['disabled'] = isset($data['enabled']) && !$data['enabled'];
     $rule['tests'] = $vacation_tests;
     $rule['join'] = $date_extension ? count($vacation_tests) > 1 : false;
     $rule['actions'] = array($vacation);
     if ($data['action'] && $data['action'] != 'keep') {
//.........这里部分代码省略.........
开发者ID:jimjag,项目名称:roundcubemail,代码行数:101,代码来源:rcube_sieve_vacation.php

示例8: check_email

function check_email($email, $dns_check = true)
{
    return rcube_utils::check_email($email, $dns_check);
}
开发者ID:noikiy,项目名称:roundcubemail,代码行数:4,代码来源:bc.php

示例9: validate

 /**
  * Check the given data before saving.
  * If input isn't valid, the message to display can be fetched using get_error()
  *
  * @param array Assoziative array with data to save
  * @param boolean Attempt to fix/complete record automatically
  * @return boolean True if input is valid, False if not.
  */
 public function validate(&$save_data, $autofix = false)
 {
     $rcmail = rcmail::get_instance();
     // check validity of email addresses
     foreach ($this->get_col_values('email', $save_data, true) as $email) {
         if (strlen($email)) {
             if (!rcube_utils::check_email(rcube_utils::idn_to_ascii($email))) {
                 $error = $rcmail->gettext(array('name' => 'emailformaterror', 'vars' => array('email' => $email)));
                 $this->set_error(self::ERROR_VALIDATE, $error);
                 return false;
             }
         }
     }
     return true;
 }
开发者ID:nmrugg,项目名称:roundcubemail,代码行数:23,代码来源:rcube_addressbook.php

示例10: create_identity

 public function create_identity($p)
 {
     $rcmail = rcmail::get_instance();
     // prefs are set in create_user()
     if ($this->prefs) {
         if ($this->prefs['full_name']) {
             $p['record']['name'] = $this->prefs['full_name'];
         }
         if (($this->identities_level == 0 || $this->identities_level == 2) && $this->prefs['email_address']) {
             $p['record']['email'] = $this->prefs['email_address'];
         }
         if ($this->prefs['___signature___']) {
             $p['record']['signature'] = $this->prefs['___signature___'];
         }
         if ($this->prefs['reply_to']) {
             $p['record']['reply-to'] = $this->prefs['reply_to'];
         }
         if (($this->identities_level == 0 || $this->identities_level == 1) && isset($this->prefs['identities']) && $this->prefs['identities'] > 1) {
             for ($i = 1; $i < $this->prefs['identities']; $i++) {
                 unset($ident_data);
                 $ident_data = array('name' => '', 'email' => '');
                 // required data
                 if ($this->prefs['full_name' . $i]) {
                     $ident_data['name'] = $this->prefs['full_name' . $i];
                 }
                 if ($this->identities_level == 0 && $this->prefs['email_address' . $i]) {
                     $ident_data['email'] = $this->prefs['email_address' . $i];
                 } else {
                     $ident_data['email'] = $p['record']['email'];
                 }
                 if ($this->prefs['reply_to' . $i]) {
                     $ident_data['reply-to'] = $this->prefs['reply_to' . $i];
                 }
                 if ($this->prefs['___sig' . $i . '___']) {
                     $ident_data['signature'] = $this->prefs['___sig' . $i . '___'];
                 }
                 // insert identity
                 $rcmail->user->insert_identity($ident_data);
             }
         }
         // copy address book
         $contacts = $rcmail->get_address_book(null, true);
         $addresses = array();
         $groups = array();
         if ($contacts && !empty($this->abook)) {
             foreach ($this->abook as $rec) {
                 // #1487096: handle multi-address and/or too long items
                 // #1487858: convert multi-address contacts into groups
                 $emails = preg_split('/[;,]/', $rec['email'], -1, PREG_SPLIT_NO_EMPTY);
                 $group_id = null;
                 // create group for addresses
                 if (count($emails) > 1) {
                     if (!($group_id = $groups[$rec['name']])) {
                         if ($group = $contacts->create_group($rec['name'])) {
                             $group_id = $group['id'];
                             $groups[$rec['name']] = $group_id;
                         }
                     }
                 }
                 // create contacts
                 foreach ($emails as $email) {
                     if (!($contact_id = $addresses[$email]) && rcube_utils::check_email(rcube_utils::idn_to_ascii($email))) {
                         $rec['email'] = rcube_utils::idn_to_utf8($email);
                         if ($contact_id = $contacts->insert($rec, true)) {
                             $addresses[$email] = $contact_id;
                         }
                     }
                     if ($group_id && $contact_id) {
                         $contacts->add_to_group($group_id, array($contact_id));
                     }
                 }
             }
         }
         // mark identity as complete for following hooks
         $p['complete'] = true;
     }
     return $p;
 }
开发者ID:jimjag,项目名称:roundcubemail,代码行数:78,代码来源:squirrelmail_usercopy.php

示例11: vacation_post

 private function vacation_post()
 {
     if (empty($_POST)) {
         return;
     }
     $status = rcube_utils::get_input_value('vacation_status', rcube_utils::INPUT_POST);
     $subject = rcube_utils::get_input_value('vacation_subject', rcube_utils::INPUT_POST, true);
     $reason = rcube_utils::get_input_value('vacation_reason', rcube_utils::INPUT_POST, true);
     $addresses = rcube_utils::get_input_value('vacation_addresses', rcube_utils::INPUT_POST, true);
     $interval = rcube_utils::get_input_value('vacation_interval', rcube_utils::INPUT_POST);
     $interval_type = rcube_utils::get_input_value('vacation_interval_type', rcube_utils::INPUT_POST);
     $date_from = rcube_utils::get_input_value('vacation_datefrom', rcube_utils::INPUT_POST);
     $date_to = rcube_utils::get_input_value('vacation_dateto', rcube_utils::INPUT_POST);
     $after = rcube_utils::get_input_value('vacation_after', rcube_utils::INPUT_POST);
     $interval_type = $interval_type == 'seconds' ? 'seconds' : 'days';
     $vacation_action['type'] = 'vacation';
     $vacation_action['reason'] = $this->strip_value(str_replace("\r\n", "\n", $reason));
     $vacation_action['subject'] = $subject;
     $vacation_action['addresses'] = $addresses;
     $vacation_action[$interval_type] = $interval;
     $vacation_tests = (array) $this->vacation['tests'];
     foreach ((array) $vacation_action['addresses'] as $aidx => $address) {
         $vacation_action['addresses'][$aidx] = $address = trim($address);
         if (empty($address)) {
             unset($vacation_action['addresses'][$aidx]);
         } else {
             if (!rcube_utils::check_email($address)) {
                 $error = 'noemailwarning';
                 break;
             }
         }
     }
     if ($vacation_action['reason'] == '') {
         $error = 'managesieve.emptyvacationbody';
     }
     if ($vacation_action[$interval_type] && !preg_match('/^[0-9]+$/', $vacation_action[$interval_type])) {
         $error = 'managesieve.forbiddenchars';
     }
     foreach (array('date_from', 'date_to') as $var) {
         $date = ${$var};
         if ($date && ($dt = rcube_utils::anytodatetime($date))) {
             $type = 'value-' . ($var == 'date_from' ? 'ge' : 'le');
             $test = array('test' => 'currentdate', 'part' => 'date', 'type' => $type, 'arg' => $dt->format('Y-m-d'));
             // find existing date rule
             foreach ((array) $vacation_tests as $idx => $t) {
                 if ($t['test'] == 'currentdate' && $t['part'] == 'date' && $t['type'] == $type) {
                     $vacation_tests[$idx] = $test;
                     continue 2;
                 }
             }
             $vacation_tests[] = $test;
         }
     }
     if (empty($vacation_tests)) {
         $vacation_tests = $this->rc->config->get('managesieve_vacation_test', array(array('test' => 'true')));
     }
     // @TODO: handle situation when there's no active script
     if (!$error) {
         $rule = $this->vacation;
         $rule['type'] = 'if';
         $rule['name'] = $rule['name'] ? $rule['name'] : $this->plugin->gettext('vacation');
         $rule['disabled'] = $status == 'off';
         $rule['actions'][0] = $vacation_action;
         $rule['tests'] = $vacation_tests;
         $rule['join'] = count($vacation_tests) > 1;
         // reset original vacation rule
         if (isset($this->vacation['idx'])) {
             $this->script[$this->vacation['idx']] = null;
         }
         // re-order rules if needed
         if (isset($after) && $after !== '') {
             // add at target position
             if ($after >= count($this->script) - 1) {
                 $this->script[] = $rule;
             } else {
                 $script = array();
                 foreach ($this->script as $idx => $r) {
                     if ($r) {
                         $script[] = $r;
                     }
                     if ($idx == $after) {
                         $script[] = $rule;
                     }
                 }
                 $this->script = $script;
             }
         } else {
             array_unshift($this->script, $rule);
         }
         $this->sieve->script->content = array_values(array_filter($this->script));
         if ($this->save_script()) {
             $this->rc->output->show_message('managesieve.vacationsaved', 'confirmation');
             $this->rc->output->send();
         }
     }
     $this->rc->output->show_message($error ? $error : 'managesieve.saveerror', 'error');
     $this->rc->output->send();
 }
开发者ID:bbspike,项目名称:sentora-core,代码行数:98,代码来源:rcube_sieve_vacation.php

示例12: check_email

function check_email($email, $dns_check = true)
{
    _deprecation_warning(__FUNCTION__);
    return rcube_utils::check_email($email, $dns_check);
}
开发者ID:JotapePinheiro,项目名称:roundcubemail,代码行数:5,代码来源:bc.php


注:本文中的rcube_utils::check_email方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。