本文整理汇总了PHP中is_banned_email函数的典型用法代码示例。如果您正苦于以下问题:PHP is_banned_email函数的具体用法?PHP is_banned_email怎么用?PHP is_banned_email使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_banned_email函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: verify_email
/**
* Verifies if an email address is valid or not.
*
* @return boolean True when valid, false when invalid.
*/
function verify_email()
{
global $mybb;
$user =& $this->data;
// Check if an email address has actually been entered.
if (trim_blank_chrs($user['email']) == '') {
$this->set_error('missing_email');
return false;
}
// Check if this is a proper email address.
if (!validate_email_format($user['email'])) {
$this->set_error('invalid_email_format');
return false;
}
// Check banned emails
if (is_banned_email($user['email'], true)) {
$this->set_error('banned_email');
return false;
}
// Check signed up emails
// Ignore the ACP because the Merge System sometimes produces users with duplicate email addresses (Not A Bug)
if ($mybb->settings['allowmultipleemails'] == 0 && !defined("IN_ADMINCP")) {
$uid = 0;
if (isset($user['uid'])) {
$uid = $user['uid'];
}
if (email_already_in_use($user['email'], $uid)) {
$this->set_error('email_already_in_use');
return false;
}
}
// If we have an "email2", verify it matches the existing email
if (isset($user['email2']) && $user['email'] != $user['email2']) {
$this->set_error("emails_dont_match");
return false;
}
return true;
}
示例2: array
} else {
if ($password1 != $password2) {
$errors[] = $lang->t('Pass not match');
}
}
// Validate email
require PUN_ROOT . 'include/email.php';
if (!is_valid_email($email1)) {
$errors[] = $lang->t('Invalid email');
} else {
if ($pun_config['o_regs_verify'] == '1' && $email1 != $email2) {
$errors[] = $lang->t('Email not match');
}
}
// Check if it's a banned email address
if (is_banned_email($email1)) {
if ($pun_config['p_allow_banned_email'] == '0') {
$errors[] = $lang->t('Banned email');
}
$banned_email = true;
// Used later when we send an alert email
} else {
$banned_email = false;
}
// Check if someone else already has registered with that email address
$dupe_list = array();
$query = $db->select(array('username' => 'u.username'), 'users AS u');
$query->where = 'u.email = :email';
$params = array(':email' => $email1);
$result = $query->run($params);
if (!empty($result)) {
示例3: error
$db->query('UPDATE ' . $db->prefix . 'users SET email=activate_string, activate_string=NULL, activate_key=NULL WHERE id=' . $id) or error('Unable to update email address', __FILE__, __LINE__, $db->error());
message($lang_profile['Email updated'], true);
}
} else {
if (isset($_POST['form_sent'])) {
if (pun_hash($_POST['req_password']) !== $pun_user['password']) {
message($lang_profile['Wrong pass']);
}
require PUN_ROOT . 'include/email.php';
// Validate the email address
$new_email = strtolower(trim($_POST['req_new_email']));
if (!is_valid_email($new_email)) {
message($lang_common['Invalid email']);
}
// Check if it's a banned email address
if (is_banned_email($new_email)) {
if ($pun_config['p_allow_banned_email'] == '0') {
message($lang_prof_reg['Banned email']);
} else {
if ($pun_config['o_mailing_list'] != '') {
$mail_subject = $lang_common['Banned email notification'];
$mail_message = sprintf($lang_common['Banned email change message'], $pun_user['username'], $new_email) . "\n";
$mail_message .= sprintf($lang_common['User profile'], get_base_url() . '/profile.php?id=' . $id) . "\n";
$mail_message .= "\n" . '--' . "\n" . $lang_common['Email signature'];
pun_mail($pun_config['o_mailing_list'], $mail_subject, $mail_message);
}
}
}
// Check if someone else already has registered with that email address
$result = $db->query('SELECT id, username FROM ' . $db->prefix . 'users WHERE email=\'' . $db->escape($new_email) . '\'') or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());
if ($db->num_rows($result)) {
示例4: market_get_single_address_balance
} else {
$new_balance = market_get_single_address_balance($my_bitcoin_address);
if (satoshi2bitcoin($new_balance - $_SESSION['balance']) < $_SESSION['price'] * 0.99 && $new_balance > 1.0E-8 && $_SESSION['balance'] > 1.0E-8) {
$payed_diff = $_SESSION['price'] - satoshi2bitcoin($new_balance - $_SESSION['balance']);
$errors[] = sprintf($lang_profile['Please make payment'], $payed_diff, $my_bitcoin_address);
} else {
$username2 = round($_SESSION['price'], 6) . ' BTC';
}
}
} else {
$pubkey = 'None';
$username2 = 'None';
}
#############
// Check if it's a banned e-mail address
$banned_email = is_banned_email($email1);
if ($banned_email && $forum_config['p_allow_banned_email'] == '0') {
$errors[] = $lang_profile['Banned e-mail'];
}
// Clean old unverified registrators - delete older than 72 hours
$query = array('DELETE' => 'users', 'WHERE' => 'group_id=' . FORUM_UNVERIFIED . ' AND activate_key IS NOT NULL AND registered < ' . (time() - 259200));
($hook = get_hook('rg_register_qr_delete_unverified')) ? eval($hook) : null;
$forum_db->query_build($query) or error(__FILE__, __LINE__);
// Check if someone else already has registered with that e-mail address
$dupe_list = array();
$query = array('SELECT' => 'u.username', 'FROM' => 'users AS u', 'WHERE' => 'u.email=\'' . $forum_db->escape($email1) . '\'');
($hook = get_hook('rg_register_qr_check_email_dupe')) ? eval($hook) : null;
$result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
while ($cur_dupe = $forum_db->fetch_assoc($result)) {
$dupe_list[] = $cur_dupe['username'];
}
示例5: luna_trim
$email = $luna_user['email'];
$id = $luna_user['id'];
} else {
$username = luna_trim($_POST['req_username']);
$email = strtolower(luna_trim($luna_config['p_force_guest_email'] == '1' ? $_POST['req_email'] : $_POST['email']));
$banned_email = false;
// It's a guest, so we have to validate the username
check_username($username);
if ($luna_config['p_force_guest_email'] == '1' || $email != '') {
require FORUM_ROOT . 'include/email.php';
if (!is_valid_email($email)) {
$errors[] = __('The email address you entered is invalid.', 'luna');
}
// Check if it's a banned email address
// we should only check guests because members' addresses are already verified
if ($luna_user['is_guest'] && is_banned_email($email)) {
if ($luna_config['p_allow_banned_email'] == '0') {
$errors[] = __('The email address you entered is banned in this forum. Please choose another email address.', 'luna');
}
$banned_email = true;
// Used later when we send an alert email
}
}
}
// Clean up message from POST
$orig_message = $message = luna_linebreaks(luna_trim($_POST['req_message']));
// Here we use strlen() not luna_strlen() as we want to limit the comment to FORUM_MAX_POSTSIZE bytes, not characters
if (strlen($message) > FORUM_MAX_POSTSIZE) {
$errors[] = sprintf(__('Comments cannot be longer than %s bytes.', 'luna'), forum_number_format(FORUM_MAX_POSTSIZE));
} elseif ($luna_config['p_message_all_caps'] == '0' && is_all_uppercase($message) && !$luna_user['is_admmod']) {
$errors[] = __('Comments cannot contain only capital letters.', 'luna');
示例6: verify_useremail
/**
* Verifies that everything is hunky dory with the user's email field
*
* @param string Email address
*
* @return boolean
*/
function verify_useremail(&$email)
{
$email_changed = (!isset($this->existing['email']) or $email != $this->existing['email']);
// check for empty string
if ($email == '') {
if ($this->adminoverride or !$email_changed) {
return true;
}
$this->error('fieldmissing_email');
return false;
}
// check valid email address
if (!$this->verify_email($email)) {
$this->error('bademail');
return false;
}
// check banned email addresses
require_once DIR . '/includes/functions_user.php';
if (is_banned_email($email) and !$this->adminoverride) {
if ($email_changed or !$this->registry->options['allowkeepbannedemail']) {
// throw error if this is a new registration, or if updating users are not allowed to keep banned addresses
$this->error('banemail', $this->registry->options['contactuslink']);
return false;
}
}
// check unique address
if ($this->registry->options['requireuniqueemail'] and $email_changed) {
if ($user = $this->dbobject->query_first("\n\t\t\t\tSELECT userid, username, email\n\t\t\t\tFROM " . TABLE_PREFIX . "user\n\t\t\t\tWHERE email = '" . $this->dbobject->escape_string($email) . "'\n\t\t\t\t\t" . ($this->condition !== null ? 'AND userid <> ' . intval($this->existing['userid']) : '') . "\n\t\t\t")) {
if ($this->error_handler == ERRTYPE_CP) {
$this->error('emailtaken_search_here', $this->registry->session->vars['sessionurl'], $email);
} else {
$this->error('emailtaken', $this->registry->session->vars['sessionurl']);
}
return false;
}
}
return true;
}
示例7: error_no_permission
if (!in_array($mybb->get_input('action'), $allowable_actions)) {
error_no_permission();
}
unset($allowable_actions);
} else {
if (ALLOWABLE_PAGE !== 1) {
error_no_permission();
}
}
} else {
error_no_permission();
}
}
// Find out if this user of ours is using a banned email address.
// If they are, redirect them to change it
if ($mybb->user['uid'] && is_banned_email($mybb->user['email']) && $mybb->settings['emailkeep'] != 1) {
if (THIS_SCRIPT != 'usercp.php' || THIS_SCRIPT == 'usercp.php' && $mybb->get_input('action') != 'email' && $mybb->get_input('action') != 'do_email') {
redirect('usercp.php?action=email');
} else {
if ($mybb->request_method != 'post') {
$banned_email_error = inline_error(array($lang->banned_email_warning));
}
}
}
// work out which items the user has collapsed
$colcookie = '';
if (!empty($mybb->cookies['collapsed'])) {
$colcookie = $mybb->cookies['collapsed'];
}
// set up collapsable items (to automatically show them us expanded)
$collapsed = array('boardstats' => '', 'boardstats_e' => '', 'quickreply' => '', 'quickreply_e' => '');
示例8: pun_trim
$username = pun_trim($_POST['req_username']);
$email = strtolower(pun_trim($pun_config['p_force_guest_email'] == '1' ? $_POST['req_email'] : $_POST['email']));
$banned_email = false;
// Load the register.php/prof_reg.php language files
require PUN_ROOT . 'lang/' . $pun_user['language'] . '/prof_reg.php';
require PUN_ROOT . 'lang/' . $pun_user['language'] . '/register.php';
// It's a guest, so we have to validate the username
check_username($username);
if ($pun_config['p_force_guest_email'] == '1' || $email != '') {
require PUN_ROOT . 'include/email.php';
if (!is_valid_email($email)) {
$errors[] = $lang_common['Invalid email'];
}
// Check if it's a banned email address
// we should only check guests because members' addresses are already verified
if ($pun_user['is_guest'] && is_banned_email($email)) {
if ($pun_config['p_allow_banned_email'] == '0') {
$errors[] = $lang_prof_reg['Banned email'];
}
$banned_email = true;
// Used later when we send an alert email
}
}
}
// Clean up message from POST
$orig_message = $message = pun_linebreaks(pun_trim($_POST['req_message']));
// Here we use strlen() not pun_strlen() as we want to limit the post to PUN_MAX_POSTSIZE bytes, not characters
if (strlen($message) > PUN_MAX_POSTSIZE) {
$errors[] = sprintf($lang_post['Too long message'], forum_number_format(PUN_MAX_POSTSIZE));
} else {
if ($pun_config['p_message_all_caps'] == '0' && is_all_uppercase($message) && !$pun_user['is_admmod']) {
示例9: check_for_errors
public function check_for_errors()
{
global $lang_register, $lang_prof_reg, $lang_common, $lang_antispam, $lang_antispam_questions;
$user = array();
$user['errors'] = '';
// Check that someone from this IP didn't register a user within the last hour (DoS prevention)
$already_registered = DB::for_table('users')->where('registration_ip', get_remote_address())->where_gt('registered', time() - 3600)->find_one();
if ($already_registered) {
message($lang_register['Registration flood']);
}
$user['username'] = feather_trim($this->request->post('req_user'));
$user['email1'] = strtolower(feather_trim($this->request->post('req_email1')));
if ($this->config['o_regs_verify'] == '1') {
$email2 = strtolower(feather_trim($this->request->post('req_email2')));
$user['password1'] = random_pass(12);
$password2 = $user['password1'];
} else {
$user['password1'] = feather_trim($this->request->post('req_password1'));
$password2 = feather_trim($this->request->post('req_password2'));
}
// Validate username and passwords
$user['errors'] = check_username($user['username'], $user['errors']);
if (feather_strlen($user['password1']) < 6) {
$user['errors'][] = $lang_prof_reg['Pass too short'];
} elseif ($user['password1'] != $password2) {
$user['errors'][] = $lang_prof_reg['Pass not match'];
}
// Antispam feature
$question = $this->request->post('captcha_q') ? trim($this->request->post('captcha_q')) : '';
$answer = $this->request->post('captcha') ? strtoupper(trim($this->request->post('captcha'))) : '';
$lang_antispam_questions_array = array();
foreach ($lang_antispam_questions as $k => $v) {
$lang_antispam_questions_array[md5($k)] = strtoupper($v);
}
if (empty($lang_antispam_questions_array[$question]) || $lang_antispam_questions_array[$question] != $answer) {
$user['errors'][] = $lang_antispam['Robot test fail'];
}
// Validate email
require FEATHER_ROOT . 'include/email.php';
if (!is_valid_email($user['email1'])) {
$user['errors'][] = $lang_common['Invalid email'];
} elseif ($this->config['o_regs_verify'] == '1' && $user['email1'] != $email2) {
$user['errors'][] = $lang_register['Email not match'];
}
// Check if it's a banned email address
if (is_banned_email($user['email1'])) {
if ($this->config['p_allow_banned_email'] == '0') {
$user['errors'][] = $lang_prof_reg['Banned email'];
}
$user['banned_email'] = 1;
// Used later when we send an alert email
}
// Check if someone else already has registered with that email address
$dupe_list = array();
$dupe_mail = DB::for_table('users')->select('username')->where('email', $user['email1'])->find_many();
if ($dupe_mail) {
if ($this->config['p_allow_dupe_email'] == '0') {
$user['errors'][] = $lang_prof_reg['Dupe email'];
}
foreach ($dupe_mail as $cur_dupe) {
$dupe_list[] = $cur_dupe['username'];
}
}
// Make sure we got a valid language string
if ($this->request->post('language')) {
$user['language'] = preg_replace('%[\\.\\\\/]%', '', $this->request->post('language'));
if (!file_exists(FEATHER_ROOT . 'lang/' . $user['language'] . '/common.php')) {
message($lang_common['Bad request'], '404');
}
} else {
$user['language'] = $this->config['o_default_lang'];
}
return $user;
}
示例10: check_errors_before_post
public function check_errors_before_post($fid, $tid, $qid, $pid, $page, $errors)
{
global $lang_post, $lang_common, $lang_prof_reg, $lang_register, $lang_antispam, $lang_antispam_questions, $pd;
// Antispam feature
if ($this->user->is_guest) {
// It's a guest, so we have to validate the username
$errors = check_username(feather_trim($this->request->post('req_username')), $errors);
$question = $this->request->post('captcha_q') ? trim($this->request->post('captcha_q')) : '';
$answer = $this->request->post('captcha') ? strtoupper(trim($this->request->post('captcha'))) : '';
$lang_antispam_questions_array = array();
foreach ($lang_antispam_questions as $k => $v) {
$lang_antispam_questions_array[md5($k)] = strtoupper($v);
}
if (empty($lang_antispam_questions_array[$question]) || $lang_antispam_questions_array[$question] != $answer) {
$errors[] = $lang_antispam['Robot test fail'];
}
}
// Flood protection
if ($this->request->post('preview') != '' && $this->user->last_post != '' && time() - $this->user->last_post < $this->user->g_post_flood) {
$errors[] = sprintf($lang_post['Flood start'], $this->user->g_post_flood, $this->user->g_post_flood - (time() - $this->user->last_post));
}
if ($tid) {
$subject_tid = DB::for_table('topics')->where('id', $tid)->find_one_col('subject');
if (!$subject_tid) {
message($lang_common['Bad request'], '404');
}
$url_subject = url_friendly($subject_tid);
} else {
$url_subject = '';
}
// If it's a new topic
if ($fid) {
$subject = feather_trim($this->request->post('req_subject'));
if ($this->config['o_censoring'] == '1') {
$censored_subject = feather_trim(censor_words($subject));
}
if ($subject == '') {
$errors[] = $lang_post['No subject'];
} elseif ($this->config['o_censoring'] == '1' && $censored_subject == '') {
$errors[] = $lang_post['No subject after censoring'];
} elseif (feather_strlen($subject) > 70) {
$errors[] = $lang_post['Too long subject'];
} elseif ($this->config['p_subject_all_caps'] == '0' && is_all_uppercase($subject) && !$this->user->is_admmod) {
$errors[] = $lang_post['All caps subject'];
}
}
if ($this->user->is_guest) {
$email = strtolower(feather_trim($this->config['p_force_guest_email'] == '1' ? $this->request->post('req_email') : $this->request->post('email')));
// Load the register.php/prof_reg.php language files
require FEATHER_ROOT . 'lang/' . $this->user->language . '/prof_reg.php';
require FEATHER_ROOT . 'lang/' . $this->user->language . '/register.php';
if ($this->config['p_force_guest_email'] == '1' || $email != '') {
require FEATHER_ROOT . 'include/email.php';
if (!is_valid_email($email)) {
$errors[] = $lang_common['Invalid email'];
}
// Check if it's a banned email address
// we should only check guests because members' addresses are already verified
if ($this->user->is_guest && is_banned_email($email)) {
if ($this->config['p_allow_banned_email'] == '0') {
$errors[] = $lang_prof_reg['Banned email'];
}
$errors['banned_email'] = 1;
// Used later when we send an alert email
}
}
}
// Clean up message from POST
$message = feather_linebreaks(feather_trim($this->request->post('req_message')));
// Here we use strlen() not feather_strlen() as we want to limit the post to FEATHER_MAX_POSTSIZE bytes, not characters
if (strlen($message) > FEATHER_MAX_POSTSIZE) {
$errors[] = sprintf($lang_post['Too long message'], forum_number_format(FEATHER_MAX_POSTSIZE));
} elseif ($this->config['p_message_all_caps'] == '0' && is_all_uppercase($message) && !$this->user->is_admmod) {
$errors[] = $lang_post['All caps message'];
}
// Validate BBCode syntax
if ($this->config['p_message_bbcode'] == '1') {
require FEATHER_ROOT . 'include/parser.php';
$message = preparse_bbcode($message, $errors);
}
if (empty($errors)) {
if ($message == '') {
$errors[] = $lang_post['No message'];
} elseif ($this->config['o_censoring'] == '1') {
// Censor message to see if that causes problems
$censored_message = feather_trim(censor_words($message));
if ($censored_message == '') {
$errors[] = $lang_post['No message after censoring'];
}
}
}
return $errors;
}
示例11: check_email
private function check_email($email, &$banned_email, &$dupe_list)
{
global $lang_profile, $forum_db, $forum_config, $forum_user;
$result = FALSE;
// Load the profile language file
if (!isset($lang_profile)) {
require FORUM_ROOT . 'lang/' . $forum_user['language'] . '/profile.php';
}
if (!defined('FORUM_EMAIL_FUNCTIONS_LOADED')) {
require FORUM_ROOT . 'include/email.php';
}
if (!is_valid_email($email)) {
return $lang_profile['Invalid e-mail'];
}
// Check if it's a banned e-mail address
$banned_email = is_banned_email($email);
if ($banned_email && $forum_config['p_allow_banned_email'] == '0') {
return $lang_profile['Banned e-mail'];
}
// Check if someone else already has registered with that e-mail address
$dupe_list = array();
$query = array('SELECT' => 'u.username', 'FROM' => 'users AS u', 'WHERE' => 'u.email=\'' . $forum_db->escape($email) . '\'');
($hook = get_hook('rg_register_qr_check_email_dupe')) ? eval($hook) : null;
$result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
while ($cur_dupe = $forum_db->fetch_assoc($result)) {
$dupe_list[] = $cur_dupe['username'];
}
if (!empty($dupe_list)) {
if ($forum_config['p_allow_dupe_email'] == '0') {
return $lang_profile['Dupe e-mail'];
}
}
return TRUE;
}
示例12: UPPER
// check if email already exists on DB
$user_exists = $db->query_read_slave("\n SELECT userid, username, email, languageid\n FROM " . TABLE_PREFIX . "user\n WHERE UPPER(email) = '" . strtoupper($db->escape_string($vbulletin->GPC['email'])) . "'\n ");
if ($db->num_rows($user_exists)) {
$valid_entries = FALSE;
$messages['errors'][] = $message = fetch_error('emailtaken', '');
$messages['fields'][] = $error_type = "email";
}
}
}
} else {
$valid_entries = FALSE;
$messages['errors'][] = $message = fetch_error('bademail');
$messages['fields'][] = $error_type = "email";
}
require_once DIR . '/includes/functions_user.php';
if (is_banned_email($vbulletin->GPC['email'])) {
if (!$vbulletin->options['allowkeepbannedemail']) {
$valid_entries = FALSE;
$messages['errors'][] = $message = $error = fetch_error("banemail");
$messages['fields'][] = $error_type = "email";
}
}
if ($vbulletin->options['usecoppa'] > 0 && $vbulletin->options['reqbirthday'] == TRUE) {
$reqbirthday = true;
}
// ACP-479
if ($vbulletin->options['usecoppa'] == 2 || $vbulletin->options['usecoppa'] == 1) {
$reqbirthday = true;
}
if ($vbulletin->GPC['birthdate'] == 'undefined') {
$vbulletin->GPC['birthdate'] = '';
示例13: change_email
public function change_email($id)
{
global $lang_profile, $lang_common, $lang_prof_reg;
// Make sure we are allowed to change this user's email
if ($this->user->id != $id) {
if (!$this->user->is_admmod) {
// A regular user trying to change another user's email?
message($lang_common['No permission'], '403');
} elseif ($this->user->g_moderator == '1') {
// A moderator trying to change a user's email?
$select_change_mail = array('u.group_id', 'g.g_moderator');
$user = DB::for_table('users')->table_alias('u')->select_many($select_change_mail)->inner_join('groups', array('g.g_id', '=', 'u.group_id'), 'g')->where('u.id', $id)->find_one();
if (!$user) {
message($lang_common['Bad request'], '404');
}
if ($this->user->g_mod_edit_users == '0' || $this->user->g_mod_change_passwords == '0' || $user['group_id'] == FEATHER_ADMIN || $user['g_moderator'] == '1') {
message($lang_common['No permission'], '403');
}
}
}
if ($this->request->get('key')) {
$key = $this->request->get('key');
$new_email_key = DB::for_table('users')->where('id', $id)->find_one_col('activate_key');
if ($key == '' || $key != $new_email_key) {
message($lang_profile['Email key bad'] . ' <a href="mailto:' . feather_escape($this->config['o_admin_email']) . '">' . feather_escape($this->config['o_admin_email']) . '</a>.');
} else {
DB::for_table('users')->where('id', $id)->find_one()->set_expr('email', 'activate_string')->set_expr('activate_string', 'NULL')->set_expr('activate_key', 'NULL')->save();
message($lang_profile['Email updated'], true);
}
} elseif ($this->request->isPost()) {
if (feather_hash($this->request->post('req_password')) !== $this->user->password) {
message($lang_profile['Wrong pass']);
}
require FEATHER_ROOT . 'include/email.php';
// Validate the email address
$new_email = strtolower(feather_trim($this->request->post('req_new_email')));
if (!is_valid_email($new_email)) {
message($lang_common['Invalid email']);
}
// Check if it's a banned email address
if (is_banned_email($new_email)) {
if ($this->config['p_allow_banned_email'] == '0') {
message($lang_prof_reg['Banned email']);
} elseif ($this->config['o_mailing_list'] != '') {
// Load the "banned email change" template
$mail_tpl = trim(file_get_contents(FEATHER_ROOT . 'lang/' . $this->user->language . '/mail_templates/banned_email_change.tpl'));
// The first row contains the subject
$first_crlf = strpos($mail_tpl, "\n");
$mail_subject = trim(substr($mail_tpl, 8, $first_crlf - 8));
$mail_message = trim(substr($mail_tpl, $first_crlf));
$mail_message = str_replace('<username>', $this->user->username, $mail_message);
$mail_message = str_replace('<email>', $new_email, $mail_message);
$mail_message = str_replace('<profile_url>', get_link('user/' . $id . '/'), $mail_message);
$mail_message = str_replace('<board_mailer>', $this->config['o_board_title'], $mail_message);
pun_mail($this->config['o_mailing_list'], $mail_subject, $mail_message);
}
}
// Check if someone else already has registered with that email address
$select_change_mail = array('id', 'username');
$result = DB::for_table('users')->select_many($select_change_mail)->where('email', $new_email)->find_many();
if ($result) {
if ($this->config['p_allow_dupe_email'] == '0') {
message($lang_prof_reg['Dupe email']);
} elseif ($this->config['o_mailing_list'] != '') {
foreach ($result as $cur_dupe) {
$dupe_list[] = $cur_dupe['username'];
}
// Load the "dupe email change" template
$mail_tpl = trim(file_get_contents(FEATHER_ROOT . 'lang/' . $this->user->language . '/mail_templates/dupe_email_change.tpl'));
// The first row contains the subject
$first_crlf = strpos($mail_tpl, "\n");
$mail_subject = trim(substr($mail_tpl, 8, $first_crlf - 8));
$mail_message = trim(substr($mail_tpl, $first_crlf));
$mail_message = str_replace('<username>', $this->user->username, $mail_message);
$mail_message = str_replace('<dupe_list>', implode(', ', $dupe_list), $mail_message);
$mail_message = str_replace('<profile_url>', get_link('user/' . $id . '/'), $mail_message);
$mail_message = str_replace('<board_mailer>', $this->config['o_board_title'], $mail_message);
pun_mail($this->config['o_mailing_list'], $mail_subject, $mail_message);
}
}
$new_email_key = random_pass(8);
// Update the user
$update_user = array('activate_string' => $new_email, 'activate_key' => $new_email_key);
DB::for_table('users')->where('id', tid)->find_one()->set($update_user)->save();
// Load the "activate email" template
$mail_tpl = trim(file_get_contents(FEATHER_ROOT . 'lang/' . $this->user->language . '/mail_templates/activate_email.tpl'));
// The first row contains the subject
$first_crlf = strpos($mail_tpl, "\n");
$mail_subject = trim(substr($mail_tpl, 8, $first_crlf - 8));
$mail_message = trim(substr($mail_tpl, $first_crlf));
$mail_message = str_replace('<username>', $this->user->username, $mail_message);
$mail_message = str_replace('<base_url>', get_base_url(), $mail_message);
$mail_message = str_replace('<activation_url>', get_link('user/' . $id . '/action/change_email/?key=' . $new_email_key), $mail_message);
$mail_message = str_replace('<board_mailer>', $this->config['o_board_title'], $mail_message);
pun_mail($new_email, $mail_subject, $mail_message);
message($lang_profile['Activate email sent'] . ' <a href="mailto:' . feather_escape($this->config['o_admin_email']) . '">' . feather_escape($this->config['o_admin_email']) . '</a>.', true);
}
}