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


PHP qa_email_validate函数代码示例

本文整理汇总了PHP中qa_email_validate函数的典型用法代码示例。如果您正苦于以下问题:PHP qa_email_validate函数的具体用法?PHP qa_email_validate怎么用?PHP qa_email_validate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: qa_handle_email_validate

function qa_handle_email_validate($handle, $email, $allowuserid = null)
{
    require_once QA_INCLUDE_DIR . 'qa-db-users.php';
    require_once QA_INCLUDE_DIR . 'qa-db-maxima.php';
    require_once QA_INCLUDE_DIR . 'qa-util-string.php';
    $errors = array();
    if (empty($handle)) {
        $errors['handle'] = qa_lang('users/handle_empty');
    } elseif (preg_match('/[\\@\\+\\/]/', $handle)) {
        $errors['handle'] = qa_lang_sub('users/handle_has_bad', '@ + /');
    } elseif (qa_strlen($handle) > QA_DB_MAX_HANDLE_LENGTH) {
        $errors['handle'] = qa_lang_sub('main/max_length_x', QA_DB_MAX_HANDLE_LENGTH);
    } else {
        $handleusers = qa_db_user_find_by_handle($handle);
        if (count($handleusers) && (!isset($allowuserid) || array_search($allowuserid, $handleusers) === false)) {
            $errors['handle'] = qa_lang('users/handle_exists');
        }
    }
    if (empty($email)) {
        $errors['email'] = qa_lang('users/email_required');
    } elseif (!qa_email_validate($email)) {
        $errors['email'] = qa_lang('users/email_invalid');
    } elseif (qa_strlen($email) > QA_DB_MAX_EMAIL_LENGTH) {
        $errors['email'] = qa_lang_sub('main/max_length_x', QA_DB_MAX_EMAIL_LENGTH);
    } else {
        $emailusers = qa_db_user_find_by_email($email);
        if (count($emailusers) && (!isset($allowuserid) || array_search($allowuserid, $emailusers) === false)) {
            $errors['email'] = qa_lang('users/email_exists');
        }
    }
    return $errors;
}
开发者ID:TheProjecter,项目名称:microprobe,代码行数:32,代码来源:qa-app-users-edit.php

示例2: filter_email

 public function filter_email(&$email, $olduser)
 {
     if (!strlen($email)) {
         return qa_lang('users/email_required');
     }
     if (!qa_email_validate($email)) {
         return qa_lang('users/email_invalid');
     }
     if (qa_strlen($email) > QA_DB_MAX_EMAIL_LENGTH) {
         return qa_lang_sub('main/max_length_x', QA_DB_MAX_EMAIL_LENGTH);
     }
 }
开发者ID:kosmoluna,项目名称:question2answer,代码行数:12,代码来源:qa-filter-basic.php

示例3: qa_send_notification

function qa_send_notification($userid, $email, $handle, $subject, $body, $subs, $html = false)
{
    if (qa_to_override(__FUNCTION__)) {
        $args = func_get_args();
        return qa_call_override(__FUNCTION__, $args);
    }
    global $qa_notifications_suspended;
    if ($qa_notifications_suspended > 0) {
        return false;
    }
    require_once QA_INCLUDE_DIR . 'db/selects.php';
    require_once QA_INCLUDE_DIR . 'util/string.php';
    if (isset($userid)) {
        $needemail = !qa_email_validate(@$email);
        // take from user if invalid, e.g. @ used in practice
        $needhandle = empty($handle);
        if ($needemail || $needhandle) {
            if (QA_FINAL_EXTERNAL_USERS) {
                if ($needhandle) {
                    $handles = qa_get_public_from_userids(array($userid));
                    $handle = @$handles[$userid];
                }
                if ($needemail) {
                    $email = qa_get_user_email($userid);
                }
            } else {
                $useraccount = qa_db_select_with_pending(array('columns' => array('email', 'handle'), 'source' => '^users WHERE userid = #', 'arguments' => array($userid), 'single' => true));
                if ($needhandle) {
                    $handle = @$useraccount['handle'];
                }
                if ($needemail) {
                    $email = @$useraccount['email'];
                }
            }
        }
    }
    if (isset($email) && qa_email_validate($email)) {
        $subs['^site_title'] = qa_opt('site_title');
        $subs['^handle'] = $handle;
        $subs['^email'] = $email;
        $subs['^open'] = "\n";
        $subs['^close'] = "\n";
        return qa_send_email(array('fromemail' => qa_opt('from_email'), 'fromname' => qa_opt('site_title'), 'toemail' => $email, 'toname' => $handle, 'subject' => strtr($subject, $subs), 'body' => (empty($handle) ? '' : qa_lang_sub('emails/to_handle_prefix', $handle)) . strtr($body, $subs), 'html' => $html));
    } else {
        return false;
    }
}
开发者ID:kosmoluna,项目名称:question2answer,代码行数:47,代码来源:emails.php

示例4: qa_send_notification

function qa_send_notification($userid, $email, $handle, $subject, $body, $subs)
{
    global $qa_notifications_suspended;
    if ($qa_notifications_suspended > 0) {
        return false;
    }
    require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
    require_once QA_INCLUDE_DIR . 'qa-util-emailer.php';
    require_once QA_INCLUDE_DIR . 'qa-util-string.php';
    if (isset($userid)) {
        $needemail = !qa_email_validate(@$email);
        // take from user if invalid, e.g. @ used in practice
        $needhandle = empty($handle);
        if ($needemail || $needhandle) {
            if (QA_FINAL_EXTERNAL_USERS) {
                if ($needhandle) {
                    $handles = qa_get_public_from_userids(array($userid));
                    $handle = @$handles[$userid];
                }
                if ($needemail) {
                    $email = qa_get_user_email($userid);
                }
            } else {
                $useraccount = qa_db_select_with_pending(qa_db_user_account_selectspec($userid, true));
                if ($needhandle) {
                    $handle = @$useraccount['handle'];
                }
                if ($needemail) {
                    $email = @$useraccount['email'];
                }
            }
        }
    }
    if (isset($email) && qa_email_validate($email)) {
        $subs['^site_title'] = qa_opt('site_title');
        $subs['^handle'] = $handle;
        $subs['^email'] = $email;
        $subs['^open'] = "\n";
        $subs['^close'] = "\n";
        return qa_send_email(array('fromemail' => qa_opt('from_email'), 'fromname' => qa_opt('site_title'), 'toemail' => $email, 'toname' => $handle, 'subject' => strtr($subject, $subs), 'body' => (empty($handle) ? '' : $handle . ",\n\n") . strtr($body, $subs), 'html' => false));
    } else {
        return false;
    }
}
开发者ID:TheProjecter,项目名称:microprobe,代码行数:44,代码来源:qa-app-emails.php

示例5: process_event

 function process_event($event, $userid, $handle, $cookieid, $params)
 {
     require_once QA_INCLUDE_DIR . 'qa-app-emails.php';
     require_once QA_INCLUDE_DIR . 'qa-app-format.php';
     require_once QA_INCLUDE_DIR . 'qa-util-string.php';
     switch ($event) {
         case 'q_post':
             $followanswer = @$params['followanswer'];
             $sendhandle = isset($handle) ? $handle : (strlen($params['name']) ? $params['name'] : qa_lang('main/anonymous'));
             if (isset($followanswer['notify']) && !qa_post_is_by_user($followanswer, $userid, $cookieid)) {
                 $blockwordspreg = qa_get_block_words_preg();
                 $sendtext = qa_viewer_text($followanswer['content'], $followanswer['format'], array('blockwordspreg' => $blockwordspreg));
                 qa_send_notification($followanswer['userid'], $followanswer['notify'], @$followanswer['handle'], qa_lang('emails/a_followed_subject'), qa_lang('emails/a_followed_body'), array('^q_handle' => $sendhandle, '^q_title' => qa_block_words_replace($params['title'], $blockwordspreg), '^a_content' => $sendtext, '^url' => qa_q_path($params['postid'], $params['title'], true)));
             }
             if (qa_opt('notify_admin_q_post')) {
                 qa_send_notification(null, qa_opt('feedback_email'), null, qa_lang('emails/q_posted_subject'), qa_lang('emails/q_posted_body'), array('^q_handle' => $sendhandle, '^q_title' => $params['title'], '^q_content' => $params['text'], '^url' => qa_q_path($params['postid'], $params['title'], true)));
             }
             break;
         case 'a_post':
             $question = $params['parent'];
             if (isset($question['notify']) && !qa_post_is_by_user($question, $userid, $cookieid)) {
                 qa_send_notification($question['userid'], $question['notify'], @$question['handle'], qa_lang('emails/q_answered_subject'), qa_lang('emails/q_answered_body'), array('^a_handle' => isset($handle) ? $handle : (strlen($params['name']) ? $params['name'] : qa_lang('main/anonymous')), '^q_title' => $question['title'], '^a_content' => qa_block_words_replace($params['text'], qa_get_block_words_preg()), '^url' => qa_q_path($question['postid'], $question['title'], true, 'A', $params['postid'])));
             }
             break;
         case 'c_post':
             $parent = $params['parent'];
             $question = $params['question'];
             $senttoemail = array();
             // to ensure each user or email gets only one notification about an added comment
             $senttouserid = array();
             switch ($parent['basetype']) {
                 case 'Q':
                     $subject = qa_lang('emails/q_commented_subject');
                     $body = qa_lang('emails/q_commented_body');
                     $context = $parent['title'];
                     break;
                 case 'A':
                     $subject = qa_lang('emails/a_commented_subject');
                     $body = qa_lang('emails/a_commented_body');
                     $context = qa_viewer_text($parent['content'], $parent['format']);
                     break;
             }
             $blockwordspreg = qa_get_block_words_preg();
             $sendhandle = isset($handle) ? $handle : (strlen($params['name']) ? $params['name'] : qa_lang('main/anonymous'));
             $sendcontext = qa_block_words_replace($context, $blockwordspreg);
             $sendtext = qa_block_words_replace($params['text'], $blockwordspreg);
             $sendurl = qa_q_path($question['postid'], $question['title'], true, 'C', $params['postid']);
             if (isset($parent['notify']) && !qa_post_is_by_user($parent, $userid, $cookieid)) {
                 $senduserid = $parent['userid'];
                 $sendemail = @$parent['notify'];
                 if (qa_email_validate($sendemail)) {
                     $senttoemail[$sendemail] = true;
                 } elseif (isset($senduserid)) {
                     $senttouserid[$senduserid] = true;
                 }
                 qa_send_notification($senduserid, $sendemail, @$parent['handle'], $subject, $body, array('^c_handle' => $sendhandle, '^c_context' => $sendcontext, '^c_content' => $sendtext, '^url' => $sendurl));
             }
             foreach ($params['thread'] as $comment) {
                 if (isset($comment['notify']) && !qa_post_is_by_user($comment, $userid, $cookieid)) {
                     $senduserid = $comment['userid'];
                     $sendemail = @$comment['notify'];
                     if (qa_email_validate($sendemail)) {
                         if (@$senttoemail[$sendemail]) {
                             continue;
                         }
                         $senttoemail[$sendemail] = true;
                     } elseif (isset($senduserid)) {
                         if (@$senttouserid[$senduserid]) {
                             continue;
                         }
                         $senttouserid[$senduserid] = true;
                     }
                     qa_send_notification($senduserid, $sendemail, @$comment['handle'], qa_lang('emails/c_commented_subject'), qa_lang('emails/c_commented_body'), array('^c_handle' => $sendhandle, '^c_context' => $sendcontext, '^c_content' => $sendtext, '^url' => $sendurl));
                 }
             }
             break;
         case 'q_queue':
         case 'q_requeue':
             if (qa_opt('moderate_notify_admin')) {
                 qa_send_notification(null, qa_opt('feedback_email'), null, $event == 'q_requeue' ? qa_lang('emails/remoderate_subject') : qa_lang('emails/moderate_subject'), $event == 'q_requeue' ? qa_lang('emails/remoderate_body') : qa_lang('emails/moderate_body'), array('^p_handle' => isset($handle) ? $handle : (strlen($params['name']) ? $params['name'] : (strlen(@$oldquestion['name']) ? $oldquestion['name'] : qa_lang('main/anonymous'))), '^p_context' => trim(@$params['title'] . "\n\n" . $params['text']), '^url' => qa_q_path($params['postid'], $params['title'], true), '^a_url' => qa_path_absolute('admin/moderate')));
             }
             break;
         case 'a_queue':
         case 'a_requeue':
             if (qa_opt('moderate_notify_admin')) {
                 qa_send_notification(null, qa_opt('feedback_email'), null, $event == 'a_requeue' ? qa_lang('emails/remoderate_subject') : qa_lang('emails/moderate_subject'), $event == 'a_requeue' ? qa_lang('emails/remoderate_body') : qa_lang('emails/moderate_body'), array('^p_handle' => isset($handle) ? $handle : (strlen($params['name']) ? $params['name'] : (strlen(@$oldanswer['name']) ? $oldanswer['name'] : qa_lang('main/anonymous'))), '^p_context' => $params['text'], '^url' => qa_q_path($params['parentid'], $params['parent']['title'], true, 'A', $params['postid']), '^a_url' => qa_path_absolute('admin/moderate')));
             }
             break;
         case 'c_queue':
         case 'c_requeue':
             if (qa_opt('moderate_notify_admin')) {
                 qa_send_notification(null, qa_opt('feedback_email'), null, $event == 'c_requeue' ? qa_lang('emails/remoderate_subject') : qa_lang('emails/moderate_subject'), $event == 'c_requeue' ? qa_lang('emails/remoderate_body') : qa_lang('emails/moderate_body'), array('^p_handle' => isset($handle) ? $handle : (strlen($params['name']) ? $params['name'] : (strlen(@$oldcomment['name']) ? $oldcomment['name'] : (strlen(@$oldanswer['name']) ? $oldanswer['name'] : qa_lang('main/anonymous')))), '^p_context' => $params['text'], '^url' => qa_q_path($params['questionid'], $params['question']['title'], true, 'C', $params['postid']), '^a_url' => qa_path_absolute('admin/moderate')));
             }
             break;
         case 'q_flag':
         case 'a_flag':
         case 'c_flag':
             $flagcount = $params['flagcount'];
             $oldpost = $params['oldpost'];
             $notifycount = $flagcount - qa_opt('flagging_notify_first');
//.........这里部分代码省略.........
开发者ID:netham91,项目名称:question2answer,代码行数:101,代码来源:qa-event-notify.php

示例6: qa_page_q_prepare_post_for_filters

function qa_page_q_prepare_post_for_filters($post)
{
    $in = array('content' => $post['content'], 'format' => $post['format'], 'text' => qa_viewer_text($post['content'], $post['format']), 'notify' => isset($post['notify']), 'email' => qa_email_validate($post['notify']) ? $post['notify'] : null, 'queued' => qa_user_moderation_reason(qa_user_level_for_post($post)) !== false);
    if ($post['basetype'] == 'Q') {
        $in['title'] = $post['title'];
        $in['tags'] = qa_tagstring_to_tags($post['tags']);
        $in['categoryid'] = $post['categoryid'];
        $in['extra'] = $post['extra'];
    }
    return $in;
}
开发者ID:swuit,项目名称:swuit-q2a,代码行数:11,代码来源:question-submit.php

示例7: qa_comment_set_status

function qa_comment_set_status($oldcomment, $status, $userid, $handle, $cookieid, $question, $parent)
{
    require_once QA_INCLUDE_DIR . 'qa-app-format.php';
    if (!isset($parent)) {
        $parent = $question;
    }
    // for backwards compatibility with old answer parameter
    $washidden = $oldcomment['type'] == 'C_HIDDEN';
    $wasqueued = $oldcomment['type'] == 'C_QUEUED';
    $wasrequeued = $wasqueued && isset($oldcomment['updated']);
    qa_post_unindex($oldcomment['postid']);
    $setupdated = false;
    $event = null;
    if ($status == QA_POST_STATUS_QUEUED) {
        $newtype = 'C_QUEUED';
        if (!$wasqueued) {
            $event = 'c_requeue';
        }
        // same event whether it was hidden or shown before
    } elseif ($status == QA_POST_STATUS_HIDDEN) {
        $newtype = 'C_HIDDEN';
        if (!$washidden) {
            $event = $wasqueued ? 'c_reject' : 'c_hide';
            if (!$wasqueued) {
                $setupdated = true;
            }
        }
    } elseif ($status == QA_POST_STATUS_NORMAL) {
        $newtype = 'C';
        if ($wasqueued) {
            $event = 'c_approve';
        } elseif ($washidden) {
            $event = 'c_reshow';
            $setupdated = true;
        }
    } else {
        qa_fatal_error('Unknown status in qa_comment_set_status(): ' . $status);
    }
    qa_db_post_set_type($oldcomment['postid'], $newtype, $setupdated ? $userid : null, $setupdated ? qa_remote_ip_address() : null, QA_UPDATE_VISIBLE);
    if ($wasqueued && $status == QA_POST_STATUS_NORMAL && qa_opt('moderate_update_time')) {
        // ... for approval of a post, can set time to now instead
        if ($wasrequeued) {
            qa_db_post_set_updated($oldcomment['postid'], null);
        } else {
            qa_db_post_set_created($oldcomment['postid'], null);
        }
    }
    qa_db_ccount_update();
    qa_db_points_update_ifuser($oldcomment['userid'], array('cposts'));
    if ($wasqueued || $status == QA_POST_STATUS_QUEUED) {
        qa_db_queuedcount_update();
    }
    if ($oldcomment['flagcount']) {
        qa_db_flaggedcount_update();
    }
    if ($question['type'] == 'Q' && ($parent['type'] == 'Q' || $parent['type'] == 'A') && $status == QA_POST_STATUS_NORMAL) {
        // only index if none of the things it depends on are hidden or queued
        qa_post_index($oldcomment['postid'], 'C', $question['postid'], $oldcomment['parentid'], null, $oldcomment['content'], $oldcomment['format'], qa_viewer_text($oldcomment['content'], $oldcomment['format']), null, $oldcomment['categoryid']);
    }
    $eventparams = array('postid' => $oldcomment['postid'], 'parentid' => $oldcomment['parentid'], 'parenttype' => $parent['basetype'], 'parent' => $parent, 'questionid' => $question['postid'], 'question' => $question, 'content' => $oldcomment['content'], 'format' => $oldcomment['format'], 'text' => qa_viewer_text($oldcomment['content'], $oldcomment['format']), 'categoryid' => $oldcomment['categoryid'], 'name' => $oldcomment['name']);
    if (isset($event)) {
        qa_report_event($event, $userid, $handle, $cookieid, $eventparams + array('oldcomment' => $oldcomment));
    }
    if ($wasqueued && $status == QA_POST_STATUS_NORMAL && !$wasrequeued) {
        require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
        require_once QA_INCLUDE_DIR . 'qa-util-string.php';
        $commentsfollows = qa_db_single_select(qa_db_full_child_posts_selectspec(null, $oldcomment['parentid']));
        $thread = array();
        foreach ($commentsfollows as $comment) {
            if ($comment['type'] == 'C' && $comment['parentid'] == $parent['postid']) {
                $thread[] = $comment;
            }
        }
        qa_report_event('c_post', $oldcomment['userid'], $oldcomment['handle'], $oldcomment['cookieid'], $eventparams + array('thread' => $thread, 'notify' => isset($oldcomment['notify']), 'email' => qa_email_validate($oldcomment['notify']) ? $oldcomment['notify'] : null, 'delayed' => $oldcomment['created']));
    }
}
开发者ID:gogupe,项目名称:question2answer-releases,代码行数:76,代码来源:qa-app-post-update.php

示例8: qa_post_text

if (qa_clicked('dofeedback')) {
    require_once QA_INCLUDE_DIR . 'qa-util-emailer.php';
    require_once QA_INCLUDE_DIR . 'qa-util-string.php';
    $inmessage = qa_post_text('message');
    $inname = qa_post_text('name');
    $inemail = qa_post_text('email');
    $inreferer = qa_post_text('referer');
    if (empty($inmessage)) {
        $errors['message'] = qa_lang('misc/feedback_empty');
    }
    if ($usecaptcha) {
        qa_captcha_validate($_POST, $errors);
    }
    if (empty($errors)) {
        $subs = array('^message' => $inmessage, '^name' => empty($inname) ? '-' : $inname, '^email' => empty($inemail) ? '-' : $inemail, '^previous' => empty($inreferer) ? '-' : $inreferer, '^url' => isset($qa_login_userid) ? qa_path('user/' . qa_get_logged_in_handle(), null, qa_opt('site_url')) : '-', '^ip' => qa_remote_ip_address(), '^browser' => @$_SERVER['HTTP_USER_AGENT']);
        if (qa_send_email(array('fromemail' => qa_email_validate(@$inemail) ? $inemail : qa_opt('from_email'), 'fromname' => $inname, 'toemail' => qa_opt('feedback_email'), 'toname' => qa_opt('site_title'), 'subject' => qa_lang_sub('emails/feedback_subject', qa_opt('site_title')), 'body' => strtr(qa_lang('emails/feedback_body'), $subs), 'html' => false))) {
            $feedbacksent = true;
        } else {
            $page_error = qa_lang_html('main/general_error');
        }
        qa_report_event('feedback', $qa_login_userid, qa_get_logged_in_handle(), $qa_cookieid, array('email' => $inemail, 'name' => $inname, 'message' => $inmessage, 'previous' => $inreferer, 'browser' => @$_SERVER['HTTP_USER_AGENT']));
    }
}
//	Prepare content for theme
$qa_content = qa_content_prepare();
$qa_content['title'] = qa_lang_html('misc/feedback_title');
$qa_content['error'] = @$page_error;
$qa_content['form'] = array('tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '"', 'style' => 'tall', 'fields' => array('message' => array('type' => $feedbacksent ? 'static' : '', 'label' => qa_lang_html_sub('misc/feedback_message', qa_opt('site_title')), 'tags' => 'NAME="message" ID="message"', 'value' => qa_html(@$inmessage), 'rows' => 8, 'error' => qa_html(@$errors['message'])), 'name' => array('type' => $feedbacksent ? 'static' : '', 'label' => qa_lang_html('misc/feedback_name'), 'tags' => 'NAME="name"', 'value' => qa_html(isset($inname) ? $inname : @$userprofile['name'])), 'email' => array('type' => $feedbacksent ? 'static' : '', 'label' => qa_lang_html('misc/feedback_email'), 'tags' => 'NAME="email"', 'value' => qa_html(isset($inemail) ? $inemail : qa_get_logged_in_email()), 'note' => $feedbacksent ? null : qa_opt('email_privacy'))), 'buttons' => array('send' => array('label' => qa_lang_html('main/send_button'))), 'hidden' => array('dofeedback' => '1', 'referer' => qa_html(isset($inreferer) ? $inreferer : @$_SERVER['HTTP_REFERER'])));
if ($usecaptcha && !$feedbacksent) {
    qa_set_up_captcha_field($qa_content, $qa_content['form']['fields'], @$errors);
}
开发者ID:TheProjecter,项目名称:microprobe,代码行数:31,代码来源:qa-page-feedback.php

示例9: test__qa_email_validate

 public function test__qa_email_validate()
 {
     $goodEmails = array('hello@example.com', 'q.a@question2answer.org', 'example@newdomain.app');
     $badEmails = array('nobody@nowhere', 'pokémon@example.com', 'email @ with spaces', 'some random string');
     foreach ($goodEmails as $email) {
         $this->assertTrue(qa_email_validate($email));
     }
     foreach ($badEmails as $email) {
         $this->assertFalse(qa_email_validate($email));
     }
 }
开发者ID:kosmoluna,项目名称:question2answer,代码行数:11,代码来源:UtilStringTest.php

示例10: qa_comment_create

function qa_comment_create($userid, $handle, $cookieid, $content, $format, $text, $notify, $email, $question, $answer, $commentsfollows)
{
    require_once QA_INCLUDE_DIR . 'qa-app-emails.php';
    require_once QA_INCLUDE_DIR . 'qa-app-options.php';
    require_once QA_INCLUDE_DIR . 'qa-app-format.php';
    require_once QA_INCLUDE_DIR . 'qa-util-string.php';
    $parent = isset($answer) ? $answer : $question;
    $postid = qa_db_post_create('C', $parent['postid'], $userid, isset($userid) ? null : $cookieid, qa_remote_ip_address(), null, $content, $format, null, qa_combine_notify_email($userid, $notify, $email), $question['categoryid']);
    qa_db_posts_calc_category_path($postid);
    if (!($question['hidden'] || @$answer['hidden'])) {
        // don't index comment if parent or parent of parent is hidden
        qa_post_index($postid, 'C', $question['postid'], null, $text, null);
    }
    qa_db_points_update_ifuser($userid, 'cposts');
    qa_db_ccount_update();
    //	$senttoemail and $senttouserid ensure each user or email gets only one notification about an added comment,
    //	even if they have several previous comments in the same thread and asked for notifications for the parent.
    //	Still, if a person posted some comments as a registered user and some others anonymously,
    //	they could get two emails about a subsequent comment. Shouldn't be much of a problem in practice.
    $senttoemail = array();
    $senttouserid = array();
    switch ($parent['basetype']) {
        case 'Q':
            $subject = qa_lang('emails/q_commented_subject');
            $body = qa_lang('emails/q_commented_body');
            $context = $parent['title'];
            break;
        case 'A':
            $subject = qa_lang('emails/a_commented_subject');
            $body = qa_lang('emails/a_commented_body');
            $context = qa_viewer_text($parent['content'], $parent['format']);
            break;
    }
    $blockwordspreg = qa_get_block_words_preg();
    $sendhandle = isset($handle) ? $handle : qa_lang('main/anonymous');
    $sendcontext = qa_block_words_replace($context, $blockwordspreg);
    $sendtext = qa_block_words_replace($text, $blockwordspreg);
    $sendtitle = qa_block_words_replace($question['title'], $blockwordspreg);
    $sendurl = qa_path(qa_q_request($question['postid'], $sendtitle), null, qa_opt('site_url'), null, qa_anchor($parent['basetype'], $parent['postid']));
    if (isset($parent['notify']) && !qa_post_is_by_user($parent, $userid, $cookieid)) {
        $senduserid = $parent['userid'];
        $sendemail = @$parent['notify'];
        if (qa_email_validate($sendemail)) {
            $senttoemail[$sendemail] = true;
        } elseif (isset($senduserid)) {
            $senttouserid[$senduserid] = true;
        }
        qa_send_notification($senduserid, $sendemail, @$parent['handle'], $subject, $body, array('^c_handle' => $sendhandle, '^c_context' => $sendcontext, '^c_content' => $sendtext, '^url' => $sendurl));
    }
    foreach ($commentsfollows as $comment) {
        if ($comment['basetype'] == 'C' && $comment['parentid'] == $parent['postid'] && !$comment['hidden']) {
            // find just those for this parent
            if (isset($comment['notify']) && !qa_post_is_by_user($comment, $userid, $cookieid)) {
                $senduserid = $comment['userid'];
                $sendemail = @$comment['notify'];
                if (qa_email_validate($sendemail)) {
                    if (@$senttoemail[$sendemail]) {
                        continue;
                    }
                    $senttoemail[$sendemail] = true;
                } elseif (isset($senduserid)) {
                    if (@$senttouserid[$senduserid]) {
                        continue;
                    }
                    $senttouserid[$senduserid] = true;
                }
                qa_send_notification($senduserid, $sendemail, @$comment['handle'], qa_lang('emails/c_commented_subject'), qa_lang('emails/c_commented_body'), array('^c_handle' => $sendhandle, '^c_context' => $sendcontext, '^c_content' => $sendtext, '^url' => $sendurl));
            }
        }
    }
    qa_report_event('c_post', $userid, $handle, $cookieid, array('postid' => $postid, 'parentid' => $parent['postid'], 'parenttype' => $parent['basetype'], 'questionid' => $question['postid'], 'content' => $content, 'format' => $format, 'text' => $text, 'categoryid' => $question['categoryid'], 'notify' => $notify, 'email' => $email));
    return $postid;
}
开发者ID:TheProjecter,项目名称:microprobe,代码行数:73,代码来源:qa-app-post-create.php

示例11: qa_content_prepare

}
//	Prepare content for theme
$qa_content = qa_content_prepare();
$qa_content['title'] = qa_lang_html('users/confirm_title');
$qa_content['error'] = @$pageerror;
if ($useremailed) {
    $qa_content['error'] = qa_lang_html('users/confirm_emailed');
} elseif ($userconfirmed) {
    $qa_content['error'] = qa_lang_html('users/confirm_complete');
    if (!isset($loginuserid)) {
        $qa_content['suggest_next'] = strtr(qa_lang_html('users/log_in_to_access'), array('^1' => '<a href="' . qa_path_html('login', array('e' => $inhandle)) . '">', '^2' => '</a>'));
    }
} elseif (isset($loginuserid)) {
    // if logged in, allow sending a fresh link
    require_once QA_INCLUDE_DIR . 'qa-util-string.php';
    if (strlen($incode)) {
        $qa_content['error'] = qa_lang_html('users/confirm_wrong_resend');
    }
    $email = qa_get_logged_in_email();
    $qa_content['form'] = array('tags' => 'method="post" action="' . qa_path_html('confirm') . '"', 'style' => 'tall', 'fields' => array('email' => array('label' => qa_lang_html('users/email_label'), 'value' => qa_html($email) . strtr(qa_lang_html('users/change_email_link'), array('^1' => '<a href="' . qa_path_html('account') . '">', '^2' => '</a>')), 'type' => 'static')), 'buttons' => array('send' => array('tags' => 'name="dosendconfirm"', 'label' => qa_lang_html('users/send_confirm_button'))), 'hidden' => array('code' => qa_get_form_security_code('confirm')));
    if (!qa_email_validate($email)) {
        $qa_content['error'] = qa_lang_html('users/email_invalid');
        unset($qa_content['form']['buttons']['send']);
    }
} else {
    $qa_content['error'] = qa_insert_login_links(qa_lang_html('users/confirm_wrong_log_in'), 'confirm');
}
return $qa_content;
/*
	Omit PHP closing tag to help avoid accidental output
*/
开发者ID:gogupe,项目名称:question2answer-releases,代码行数:31,代码来源:qa-page-confirm.php

示例12: qa_comment_set_hidden

function qa_comment_set_hidden($oldcomment, $hidden, $userid, $handle, $cookieid, $question, $parent)
{
    require_once QA_INCLUDE_DIR . 'qa-app-format.php';
    if (!isset($parent)) {
        $parent = $question;
    }
    // for backwards compatibility with old answer parameter
    $wasqueued = $oldcomment['type'] == 'C_QUEUED';
    qa_post_unindex($oldcomment['postid']);
    $setupdated = $hidden || !$wasqueued;
    // don't record approval of a post as an update action...
    qa_db_post_set_type($oldcomment['postid'], $hidden ? 'C_HIDDEN' : 'C', $setupdated ? $userid : null, $setupdated ? qa_remote_ip_address() : null, QA_UPDATE_VISIBLE);
    if (!$setupdated) {
        // ... for approval of a post, set created time to now instead
        qa_db_post_set_created($oldcomment['postid'], null);
    }
    qa_db_points_update_ifuser($oldcomment['userid'], array('cposts'));
    qa_db_ccount_update();
    if ($question['type'] == 'Q' && ($parent['type'] == 'Q' || $parent['type'] == 'A') && !$hidden) {
        // only index if none of the things it depends on are hidden or queued
        qa_post_index($oldcomment['postid'], 'C', $question['postid'], $oldcomment['parentid'], null, $oldcomment['content'], $oldcomment['format'], qa_viewer_text($oldcomment['content'], $oldcomment['format']), null, $oldcomment['categoryid']);
    }
    qa_report_event($wasqueued ? $hidden ? 'c_reject' : 'c_approve' : ($hidden ? 'c_hide' : 'c_reshow'), $userid, $handle, $cookieid, array('postid' => $oldcomment['postid'], 'parentid' => $oldcomment['parentid'], 'oldcomment' => $oldcomment, 'parenttype' => $parent['basetype'], 'questionid' => $question['postid']));
    if ($wasqueued && !$hidden) {
        require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
        require_once QA_INCLUDE_DIR . 'qa-util-string.php';
        $commentsfollows = qa_db_single_select(qa_db_full_child_posts_selectspec(null, $oldcomment['parentid']));
        $thread = array();
        foreach ($commentsfollows as $comment) {
            if ($comment['type'] == 'C' && $comment['parentid'] == $parent['postid']) {
                $thread[] = $comment;
            }
        }
        qa_report_event('c_post', $oldcomment['userid'], $oldcomment['handle'], $oldcomment['cookieid'], array('postid' => $oldcomment['postid'], 'parentid' => $oldcomment['parentid'], 'parenttype' => $parent['basetype'], 'parent' => $parent, 'questionid' => $question['postid'], 'question' => $question, 'thread' => $thread, 'content' => $oldcomment['content'], 'format' => $oldcomment['format'], 'text' => qa_viewer_text($oldcomment['content'], $oldcomment['format']), 'categoryid' => $oldcomment['categoryid'], 'notify' => isset($oldcomment['notify']), 'email' => qa_email_validate($oldcomment['notify']) ? $oldcomment['notify'] : null, 'delayed' => $oldcomment['created']));
    }
}
开发者ID:mathjoy,项目名称:math-duodaa,代码行数:36,代码来源:qa-app-post-update.php


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