本文整理汇总了PHP中func::IsEmailAddress方法的典型用法代码示例。如果您正苦于以下问题:PHP func::IsEmailAddress方法的具体用法?PHP func::IsEmailAddress怎么用?PHP func::IsEmailAddress使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类func
的用法示例。
在下文中一共展示了func::IsEmailAddress方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: subscribe_finish
function subscribe_finish()
{
set_time_limit(0);
$aSendedID = array();
$aReceivers = $this->db->select('SELECT I.user_id, U.user_id as id, U.login, U.password
FROM ' . TABLE_ITEMS . ' I, ' . TABLE_USERS . ' U
WHERE I.status = ' . ITEMS_STATUS_COMPLETED . ' AND I.user_id!=1
AND I.user_id = U.user_id
AND I.id NOT IN(
39, 41, 70
)
GROUP BY I.user_id
ORDER BY U.login ASC');
//echo '<pre>', print_r($aReceivers, true), '</pre>'; exit;
// $aReceivers = array(
// array('id'=>1, 'login'=>'battazo@gmail.com', 'password'=>'x123')
// );
# инициализируем класс рассылки
$mailer = new CMail();
$mailer->From = config::get('mail_noreply', BFF_EMAIL_NOREPLY);
//"E-Mail адрес уведомлений" из настроек сайта
# подготавливаем заголовок письма
$mailer->FromName = 'ILove.zp.ua';
$mailer->Subject = 'ILove.zp.ua - итоги акции!';
$sTpl = nl2br($this->getMailTemplateContent('member_subscribe_open'));
foreach ($aReceivers as $v) {
if (func::IsEmailAddress($v['login'])) {
# подготавливаем тело письма
$mailer->AltBody = '';
$mailer->MsgHTML(strtr($sTpl, array('{login}' => $v['login'], '{password}' => $v['password'])));
# отправляем письмо
$mailer->AddAddress($v['login']);
if ($mailer->Send()) {
$aSendedID[] = $v['id'];
}
$mailer->ClearAddresses();
usleep(150000);
// sleep for 0.15 second
}
}
echo sizeof($aReceivers), ' / ', sizeof($aSendedID), '<br/>';
echo '<pre>', print_r($aSendedID, true), '</pre>';
exit;
}
示例2: view
function view()
{
$nUserID = $this->security->getUserID();
if (bff::$isAjax) {
$aResponse = array();
switch (func::GET('act')) {
case 'comment':
$p = $this->input->postm(array('id' => TYPE_UINT, 'reply' => TYPE_UINT, 'message' => TYPE_STR, 'name' => TYPE_NOHTML, 'captcha' => TYPE_STR));
if (!$p['id']) {
$this->errors->set(Errors::IMPOSSIBLE);
break;
}
$p['name'] = func::cleanComment($p['name']);
$p['message'] = func::cleanComment($p['message']);
if (empty($p['message'])) {
$this->errors->set('comm_message');
}
if (!$nUserID) {
if (empty($p['name'])) {
$this->errors->set('comm_name');
}
$oProtection = new CCaptchaProtection();
if (!$oProtection->valid(isset($_SESSION['c2']) ? $_SESSION['c2'] : '', $p['captcha'])) {
$aResponse['captcha_wrong'] = 1;
$this->errors->set('comm_wrong_captcha');
}
}
if ($this->errors->no()) {
unset($_SESSION['c2']);
$res = $this->db->execute('INSERT INTO ' . TABLE_BBS_ITEMS_COMMENTS . ' (pid, item_id, user_id, comment, name, ip, created)
VALUES(' . $p['reply'] . ', ' . $p['id'] . ', ' . $nUserID . ', :comment, :name, :ip, :created)', array(':comment' => $p['message'], ':name' => $p['name'], ':ip' => func::getRemoteAddress(), ':created' => $this->db->getNOW(false)));
if ($nCommentID = $this->db->insert_id(TABLE_BBS_ITEMS_COMMENTS, 'id')) {
$aData = $this->db->one_array('SELECT IC.*, ( CASE WHEN IC.user_id != 0 THEN U.name ELSE IC.name END) as name,
I.user_id as owner_id, I.contacts_email, U.blocked as user_blocked
FROM ' . TABLE_BBS_ITEMS_COMMENTS . ' IC
LEFT JOIN ' . TABLE_USERS . ' U ON IC.user_id = U.user_id,
' . TABLE_BBS_ITEMS . ' I
WHERE IC.id=' . $nCommentID . ' AND IC.item_id = I.id');
$aData['my'] = $aData['owner_id'] > 0 && $aData['owner_id'] == $nUserID;
$aData['cur_user_id'] = $nUserID;
$aResponse['comment'] = $this->tplFetchPHP($aData, 'item.view.comment.php');
$sEnotifyEmail = false;
if ($aData['owner_id']) {
if (!$nUserID || $nUserID > 0 && $aData['owner_id'] != $nUserID) {
//комментатор > незарег. пользователь или не владелец объявления
// для зарег. пользователей отправляем на email указанный при регистрации
$sEnotifyEmail = $this->db->one_data('SELECT email FROM ' . TABLE_USERS . ' WHERE user_id = ' . $aData['owner_id']);
}
} else {
// для незарег. пользователей отправляем на контактный email
$sEnotifyEmail = $aData['contacts_email'];
if ($this->isEditPassGranted($p['id'])) {
$sEnotifyEmail = false;
// есть доступ к редактированию, значит = владелец объявления
}
}
if (!empty($sEnotifyEmail) && func::IsEmailAddress($sEnotifyEmail)) {
// отправляем уведомление о новом комментарии к объявлению
$this->db->execute('INSERT INTO ' . TABLE_BBS_ITEMS_COMMENTS_ENOTIFY . ' (item_id, comment_id, comment, email, created)
VALUES(' . $p['id'] . ', ' . $nCommentID . ', :comment, :email, ' . time() . ')', array(':comment' => nl2br(tpl::truncate($p['message'], 100, '...', true)), ':email' => $sEnotifyEmail));
}
}
}
break;
case 'comment_del':
$p = $this->input->postm(array('id' => TYPE_UINT, 'comment_id' => TYPE_UINT));
if (!$p['id'] || !$p['comment_id']) {
$this->errors->set(Errors::IMPOSSIBLE);
break;
}
if (!$nUserID) {
$this->errors->set(Errors::ACCESSDENIED);
break;
}
$isCommentOwner = $this->db->one_data('SELECT user_id FROM ' . TABLE_BBS_ITEMS_COMMENTS . ' WHERE id = ' . $p['comment_id'] . ' AND user_id = ' . $nUserID);
if ($isCommentOwner) {
$res = $this->db->execute('UPDATE ' . TABLE_BBS_ITEMS_COMMENTS . ' SET deleted = 3 WHERE id = ' . $p['comment_id']);
$aResponse['success'] = !empty($res);
$aResponse['by'] = 3;
} else {
$isOwner = $this->db->one_data('SELECT id FROM ' . TABLE_BBS_ITEMS . ' WHERE id = ' . $p['id'] . ' AND user_id = ' . $nUserID);
if (empty($isOwner)) {
$this->errors->set(Errors::ACCESSDENIED);
break;
}
$res = $this->db->execute('UPDATE ' . TABLE_BBS_ITEMS_COMMENTS . ' SET deleted = 1 WHERE id = ' . $p['comment_id']);
$aResponse['success'] = !empty($res);
$aResponse['by'] = 1;
}
break;
}
$aResponse['res'] = $this->errors->no();
$this->ajaxResponse($aResponse);
}
$nItemID = $this->input->id('id');
if (!$nItemID) {
func::JSRedirect('/');
}
$sqlDate = $this->db->str2sql(date('Y-m-d'));
$dp = $this->initDynprops();
//.........这里部分代码省略.........
示例3: mod_edit
function mod_edit()
{
if (!$this->haveAccessTo('users-edit')) {
return $this->showAccessDenied();
}
if (!($nRecordID = $this->input->id())) {
$this->adminRedirect(Errors::IMPOSSIBLE, 'listing');
}
$sTUID = func::GET('tuid');
if (!$this->checkTUID($sTUID, $nRecordID)) {
return $this->showAccessDenied();
}
$aData = array('admin' => 0);
#анализируем группы, в которые входит пользователь
$bUserSuperadmin = 0;
$aUserGroups = $this->getUserGroups($nRecordID);
foreach ($aUserGroups as $v) {
if ($v['group_id'] == self::GROUPID_SUPERADMIN) {
$bUserSuperadmin = 1;
}
if ($v['adminpanel'] == 1) {
$aData['admin'] = 1;
}
}
if (bff::$isPost) {
$this->input->postm(array('name' => TYPE_STR, 'email' => TYPE_STR, 'changepass' => TYPE_BOOL, 'password' => TYPE_STR, 'balance' => TYPE_NUM, 'skype' => TYPE_STR, 'email2' => TYPE_STR, 'phone' => TYPE_STR, 'group_id' => TYPE_ARRAY_INT, 'cat' => TYPE_ARRAY_UINT), $aData);
if (!$aData['admin']) {
//удаляем настройки предназначенные для админов
unset($aData['im_noreply']);
}
if (empty($aData['email'])) {
$this->errors->set('empty:email');
} elseif (!func::IsEmailAddress($aData['email'])) {
$this->errors->set('wrong:email');
}
if ($aData['changepass']) {
if (empty($aData['password'])) {
$this->errors->set('empty:password');
} else {
$aData['password'] = $this->security->getUserPasswordMD5($aData['password']);
}
} else {
unset($aData['password']);
}
// if($aData['city_id']<=0)
// $this->errors->set('wrong:city');
$aGroupID = $aData['group_id'];
$aData['email_hash'] = func::getEmailHash($aData['email']);
if ($this->isEmailExists($aData['email_hash'], $nRecordID)) {
$this->errors->set('email_exist');
}
if ($this->errors->no()) {
#update user data
unset($aData['changepass'], $aData['group_id']);
$aData['member'] = in_array(self::GROUPID_MEMBER, $aGroupID) ? 1 : 0;
$aData['cat'] = join(',', $aData['cat']);
$this->userUpdate($nRecordID, $aData);
$avatar = new CAvatar(TABLE_USERS, USERS_AVATAR_PATH, 'avatar', 'user_id');
$avatar->update($nRecordID, true, true);
#set user groups
if ($bUserSuperadmin && !in_array(self::GROUPID_SUPERADMIN, $aGroupID)) {
$aGroupID = array_merge($aGroupID, array(self::GROUPID_SUPERADMIN));
}
$this->assignUser2Groups($nRecordID, $aGroupID);
#обновляем, является ли юзер администратором
$bIsAdmin = 0;
if ($this->errors->no()) {
if ($bUserSuperadmin || in_array(self::GROUPID_MODERATOR, $aGroupID)) {
$bIsAdmin = 1;
} elseif (count($aGroupID) == 1 && current($aGroupID) == self::GROUPID_MEMBER) {
$bIsAdmin = 0;
} else {
$aUserGroups = $this->getUserGroups($nRecordID);
foreach ($aUserGroups as $v) {
if ($v['adminpanel'] == 1) {
$bIsAdmin = 1;
break;
}
}
}
if ($aData['admin'] != $bIsAdmin) {
$sQuery = ', im_noreply = 0';
$this->db->execute('UPDATE ' . TABLE_USERS . ' SET admin=' . $bIsAdmin . (!$bIsAdmin ? $sQuery : '') . ' WHERE user_id=' . $nRecordID);
}
}
#если пользователь редактирует собственные настройки
if ($this->security->isCurrentUser($nRecordID)) {
$this->security->expire();
}
$this->adminRedirect(Errors::SUCCESSFULL, (!func::GET('members') ? 'admin_' : '') . 'listing');
}
$aActiveGroupsID = $aGroupID;
} else {
$aActiveGroupsID = array();
for ($j = 0; $j < count($aUserGroups); $j++) {
$aActiveGroupsID[] = $aUserGroups[$j]['group_id'];
}
}
$aUserInfo = $this->db->one_array('SELECT U.*, C.title as city, R.region_id, R.title as region
FROM ' . TABLE_USERS . ' U
//.........这里部分代码省略.........
示例4: subscriber_edit
function subscriber_edit()
{
if (!$this->haveAccessTo('subscribers-edit')) {
return $this->showAccessDenied();
}
$nRecordID = func::POSTGET('rec', false, true);
if (!$nRecordID) {
$this->adminRedirect(Errors::IMPOSSIBLE, 'subscriber_listing');
}
$aData = $this->db->one_array('SELECT * FROM ' . DB_PREFIX . 'subscribers WHERE id=' . $nRecordID . ' LIMIT 1');
if (!$aData) {
$this->adminRedirect(Errors::IMPOSSIBLE, 'subscriber_listing');
}
if (func::isPostMethod()) {
$sName = $aData['name'] = func::POST('name');
$sEmail = $aData['email'] = func::POST('email');
if (!$sName) {
$aErrors[] = $this->errors->set('no_subscriber_name');
}
if (!$sEmail) {
$this->errors->set('no_subscriber_email');
} elseif (!func::IsEmailAddress($sEmail)) {
$this->errors->set('subscriber_wrong_email');
} elseif ($aData['email'] != $sEmail && $this->isSubscribed($sEmail)) {
$this->errors->set('subscriber_email_exists');
}
if ($this->errors->no()) {
$this->db->execute('UPDATE ' . DB_PREFIX . 'subscribers
SET name=' . $this->db->str2sql($sName) . ', email=' . $this->db->str2sql($sEmail) . ', create_datetime=' . $this->db->getNOW() . '
WHERE id=' . $nRecordID);
$this->adminRedirect(Errors::SUCCESSFULL, 'subscriber_listing');
}
}
$this->tplAssign('rec', $nRecordID);
$this->tplAssign('aData', $aData);
return $this->tplFetch('admin.subscriber.form.tpl');
}
示例5: ajax
function ajax()
{
if (bff::$isAjax) {
switch (func::GETPOST('act')) {
case 'subscribe':
/*
* При подписке:
* - email выступает в дальнейшем в качестве логина
* - пароль генерируется автоматически
*/
$sName = $this->input->post('name', TYPE_NOHTML);
$sEmail = mb_strtolower($this->input->post('email', TYPE_NOHTML));
$response = '';
do {
if (empty($sEmail) || !func::IsEmailAddress($sEmail)) {
$response = 0;
break;
// некорректно указан email
}
$isSubscribed = $this->db->one_data('SELECT user_id FROM ' . TABLE_USERS . ' WHERE login=' . $this->db->str2sql($sEmail));
if ($isSubscribed) {
$response = 2;
break;
// данный email уже подписан
}
$sPassword = func::generator();
//'email' - для рассылки, 'login' - для авторизации
$nUserID = $this->userCreate(array('login' => $sEmail, 'email' => $sEmail, 'password' => $sPassword, 'name' => $sName, 'subscribed' => 1, 'ip_reg' => func::getRemoteAddress(true)), self::GROUPID_MEMBER);
if ($nUserID) {
$response = 1;
// успешно подписались
# высылаем письмо (ставим в очередь на рассылку)
CMail::SendQueue('subscribe', array('user_id' => $nUserID));
} else {
$response = 4;
// системная ошибка
}
} while (false);
$this->ajaxResponse(array('result' => $response));
break;
case 'enter':
if ($this->security->isLogined()) {
$this->ajaxResponse(array('result' => 'login-ok'));
}
$aData = $this->input->postm(array('email' => TYPE_STR, 'pass' => TYPE_STR, 'reg' => TYPE_BOOL));
if (!func::IsEmailAddress($aData['email'])) {
$this->errors->set('wrong:email');
break;
//email не корректный
}
if ($this->security->checkBan(false, func::getRemoteAddress(), $aData['email'], true)) {
$this->errors->set(Errors::ACCESSDENIED);
break;
//не прошли бан-фильтр
}
if ($aData['reg']) {
//регистрация
if (empty($aData['pass']) || strlen($aData['pass']) < 3) {
$this->errors->set('password_short');
break;
//пароль слишком короткий
}
$aData['email_hash'] = func::getEmailHash($aData['email']);
if ($this->isEmailExists($aData['email_hash'])) {
$this->errors->set('email_exist');
break;
//email уже занят
}
$this->getActivationInfo($sCode, $sLink);
$nUserID = $this->userCreate(array('login' => $aData['email'], 'email' => $aData['email'], 'email_hash' => $aData['email_hash'], 'password' => $aData['pass'], 'ip_reg' => Func::getRemoteAddress(true), 'activatekey' => $sCode, 'activated' => 0), self::GROUPID_MEMBER);
if ($nUserID) {
//$this->userAUTH($aData['email'], $aData['pass'], null, true);
$res = bff::sendMailTemplate(array('password' => $aData['pass'], 'email' => $aData['email'], 'activate_link' => "<a href=\"{$sLink}\">{$sLink}</a>"), 'member_registration', $aData['email']);
$this->ajaxResponse(array('result' => 'reg-ok'));
} else {
$this->ajaxResponse(Errors::IMPOSSIBLE);
}
} else {
//авторизация
$nResult = $this->userAUTH($aData['email'], $aData['pass'], null, true);
if ($nResult == 1) {
//$this->security->setRememberMe('u', $aData['email'], $aData['pass']);
bff::i()->Bbs_getFavorites(true);
$bReload = false;
if (!empty($_SERVER['HTTP_REFERER'])) {
if (stripos($_SERVER['HTTP_REFERER'], '/item/') !== FALSE || stripos($_SERVER['HTTP_REFERER'], '/items/fav') !== FALSE) {
$bReload = true;
}
}
$userMenu = $this->tplFetch('user.menu.tpl');
$this->ajaxResponse(array('result' => 'login-ok', 'usermenu' => $userMenu, 'reload' => $bReload));
} else {
$mResponse = null;
switch ($nResult) {
case 0:
$this->errors->set('email_or_pass_incorrect');
break;
case -3:
$this->errors->set('activate_first');
break;
//.........这里部分代码省略.........