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


PHP qa_send_notification函数代码示例

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


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

示例1: qa_question_set_selchildid

function qa_question_set_selchildid($userid, $handle, $cookieid, $oldquestion, $selchildid, $answers)
{
    $oldselchildid = $oldquestion['selchildid'];
    qa_db_post_set_selchildid($oldquestion['postid'], isset($selchildid) ? $selchildid : null);
    qa_db_points_update_ifuser($oldquestion['userid'], 'aselects');
    if (isset($oldselchildid)) {
        if (isset($answers[$oldselchildid])) {
            qa_db_points_update_ifuser($answers[$oldselchildid]['userid'], 'aselecteds');
            qa_report_event('a_unselect', $userid, $handle, $cookieid, array('parentid' => $oldquestion['postid'], 'postid' => $oldselchildid));
        }
    }
    if (isset($selchildid)) {
        $answer = $answers[$selchildid];
        qa_db_points_update_ifuser($answer['userid'], 'aselecteds');
        if (isset($answer['notify']) && !qa_post_is_by_user($answer, $userid, $cookieid)) {
            require_once QA_INCLUDE_DIR . 'qa-app-emails.php';
            require_once QA_INCLUDE_DIR . 'qa-app-options.php';
            require_once QA_INCLUDE_DIR . 'qa-util-string.php';
            require_once QA_INCLUDE_DIR . 'qa-app-format.php';
            $blockwordspreg = qa_get_block_words_preg();
            $sendtitle = qa_block_words_replace($oldquestion['title'], $blockwordspreg);
            $sendcontent = qa_viewer_text($answer['content'], $answer['format'], array('blockwordspreg' => $blockwordspreg));
            qa_send_notification($answer['userid'], $answer['notify'], @$answer['handle'], qa_lang('emails/a_selected_subject'), qa_lang('emails/a_selected_body'), array('^s_handle' => isset($handle) ? $handle : qa_lang('main/anonymous'), '^q_title' => $sendtitle, '^a_content' => $sendcontent, '^url' => qa_path(qa_q_request($oldquestion['postid'], $sendtitle), null, qa_opt('site_url'), null, qa_anchor('A', $selchildid))));
        }
        qa_report_event('a_select', $userid, $handle, $cookieid, array('parentid' => $oldquestion['postid'], 'postid' => $selchildid));
    }
}
开发者ID:TheProjecter,项目名称:microprobe,代码行数:27,代码来源:qa-app-post-update.php

示例2: qa_priv_notification

function qa_priv_notification($uid, $oid, $badge_slug)
{
    require_once QA_INCLUDE_DIR . 'qa-app-users.php';
    require_once QA_INCLUDE_DIR . 'qa-app-emails.php';
    if (QA_FINAL_EXTERNAL_USERS) {
        $publictohandle = qa_get_public_from_userids(array($uid));
        $handle = @$publictohandle[$uid];
    } else {
        $user = qa_db_single_select(qa_db_user_account_selectspec($uid, true));
        $handle = @$user['handle'];
    }
    $subject = qa_opt('badge_email_subject');
    $body = qa_opt('badge_email_body');
    $body = preg_replace('/\\^if_post_text="([^"]*)"/', $oid ? '$1' : '', $body);
    // if post text
    $site_url = qa_opt('site_url');
    $profile_url = qa_path_html('user/' . $handle, null, $site_url);
    if ($oid) {
        $post = qa_db_read_one_assoc(qa_db_query_sub('SELECT * FROM ^posts WHERE postid=#', $oid), true);
        if ($post['parentid']) {
            $parent = qa_db_read_one_assoc(qa_db_query_sub('SELECT * FROM ^posts WHERE postid=#', $post['parentid']), true);
        }
        if (isset($parent)) {
            $anchor = urlencode(qa_anchor($post['basetype'], $oid));
            $post_title = $parent['title'];
            $post_url = qa_path_html(qa_q_request($parent['postid'], $parent['title']), null, qa_opt('site_url'), null, $anchor);
        } else {
            $post_title = $post['title'];
            $post_url = qa_path_html(qa_q_request($post['postid'], $post['title']), null, qa_opt('site_url'));
        }
    }
    $subs = array('^badge_name' => qa_opt('badge_' . $badge_slug . '_name'), '^post_title' => @$post_title, '^post_url' => @$post_url, '^profile_url' => $profile_url, '^site_url' => $site_url);
    qa_send_notification($uid, '@', $handle, $subject, $body, $subs);
}
开发者ID:NoahY,项目名称:q2a-privileges,代码行数:34,代码来源:qa-plugin.php

示例3: mp_announcement_create

function mp_announcement_create($userid, $handle, $cookieid, $title, $content, $format, $text, $notify, $categoryid)
{
    /* 
     * Proceeds to create an announcement
     *
     */
    require_once QA_INCLUDE_DIR . 'qa-db-post-create.php';
    require_once QA_INCLUDE_DIR . 'qa-app-emails.php';
    require_once QA_INCLUDE_DIR . 'mp-app-users.php';
    // persist data to database
    $postid = qa_db_post_create('AN', null, $userid, $cookieid, qa_remote_ip_address(), $title, $content, $format, null, $notify, $categoryid);
    qa_user_report_action(qa_get_logged_in_userid(), null, null, null, null);
    // update new post with category path hierarchy
    qa_db_posts_calc_category_path($postid);
    // send notifications
    if ($notify && isset($postid)) {
        $category = mp_get_categoryinfo($categoryid);
        $recipients = mp_get_category_userids($categoryid);
        foreach ($recipients as $recipient) {
            // retrieve the user flags
            $userflags = mp_get_user_flags($recipient['userid']);
            // check user flags to determine whether user should be notified or not
            // of the new answer post
            if (!($userflags & QA_USER_FLAGS_NOTIFY_ANNOUNCEMENTS)) {
                qa_send_notification($recipient['userid'], null, null, qa_lang('emails/an_posted_subject'), qa_lang('emails/an_posted_body'), array('^an_handle' => $handle, '^category_title' => $category['title'], '^an_title' => $title, '^an_url' => qa_path('mp-announcements-page', null, qa_opt('site_url'), null, null)));
            }
        }
    }
    // report announcement create event
    qa_report_event('an_post', $userid, $handle, $cookieid, array('postid' => $postid, 'title' => $title, 'content' => $content, 'format' => $format, 'text' => $text, 'categoryid' => $categoryid, 'notify' => $notify));
    return $postid;
}
开发者ID:TheProjecter,项目名称:microprobe,代码行数:32,代码来源:mp-app-posts.php

示例4: sendEmail

 function sendEmail($event, $userid, $handle, $params)
 {
     $email = $this->getEmail($userid);
     if ($email == qa_opt('feedback_email')) {
         return;
     }
     $parent = qa_db_read_one_assoc(qa_db_query_sub('SELECT * FROM ^posts WHERE postid=#', $params['parentid']), true);
     if ($parent['type'] == 'A') {
         $parent = qa_db_read_one_assoc(qa_db_query_sub('SELECT * FROM ^posts WHERE postid=#', $parent['parentid']), true);
     }
     $url = qa_q_path($parent['postid'], $parent['title'], true, $event == 'a_post' ? 'A' : 'C', $params['postid']);
     $title = $parent['title'];
     $type = $event == 'a_post' ? 'answer' : 'comment';
     $subs = array();
     qa_send_notification(null, qa_opt('feedback_email'), null, qa_lang('admin_plus/posted_subject'), qa_lang('admin_plus/posted_body'), array('^post_handle' => isset($handle) ? $handle : qa_lang('main/anonymous'), '^post_type' => $type, '^post_title' => $title, '^post_content' => $params['content'], '^site_url' => qa_opt('site_url'), '^url' => $url));
 }
开发者ID:NoahY,项目名称:q2a-admin-plus,代码行数:16,代码来源:qa-admin-check.php

示例5: sendNewConfirm

function sendNewConfirm($userid)
{
    require_once QA_INCLUDE_DIR . 'db/users.php';
    require_once QA_INCLUDE_DIR . 'db/selects.php';
    require_once QA_INCLUDE_DIR . 'app/emails.php';
    $userinfo = qa_db_select_with_pending(qa_db_user_account_selectspec($userid, true));
    if (!qa_send_notification($userid, $userinfo['email'], $userinfo['handle'], qa_lang('emails/confirm_subject'), qa_lang('emails/confirm_body'), array('^url' => getNewConfirmUrl($userid, $userinfo['handle'])))) {
        qa_fatal_error('Could not send email confirmation');
    }
    // $userinfo=qa_db_select_with_pending(qa_db_user_account_selectspec($userid, true));
    // $params = array();
    // $params['fromemail'] = qa_opt('from_email'),
    // $params['fromname'] = qa_opt('site_title'),
    // $params['toemail'] = $userinfo['email'];
    // $params['toname'] = $userinfo['handle'];
    // $params['subject'] = qa_lang('emails/confirm_subject');
    // $params['body'] = qa_lang('emails/confirm_body');
    // qa_send_email($params);
}
开发者ID:GitFuture,项目名称:bmf,代码行数:19,代码来源:register.php

示例6: process_event

    function process_event($event, $userid, $handle, $cookieid, $params)
    {
        if (qa_opt('expert_question_enable')) {
            switch ($event) {
                case 'q_post':
                    if (qa_post_text('is_expert_question') == 'yes' || in_array(qa_opt('expert_question_type'), array(1, 2)) && !qa_get_logged_in_userid() || qa_opt('expert_question_type') == 3) {
                        require_once QA_INCLUDE_DIR . 'qa-app-post-update.php';
                        qa_question_set_hidden($params, true, $userid, $handle, $cookieid, array(), array());
                        qa_db_query_sub('CREATE TABLE IF NOT EXISTS ^postmeta (
								meta_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
								post_id bigint(20) unsigned NOT NULL,
								meta_key varchar(255) DEFAULT \'\',
								meta_value longtext,
								PRIMARY KEY (meta_id),
								KEY post_id (post_id),
								KEY meta_key (meta_key)
								) ENGINE=MyISAM  DEFAULT CHARSET=utf8');
                        qa_db_query_sub("INSERT INTO ^postmeta (post_id,meta_key,meta_value) VALUES (#,'is_expert_question','1')", $params['postid']);
                        if (qa_opt('expert_question_email_experts')) {
                            $subs = array('^post_title' => $params['title'], '^post_url' => qa_path_html(qa_q_request($params['postid'], $params['title']), null, qa_opt('site_url')), '^questions_list' => qa_path_html(qa_opt('expert_question_page_url'), null, qa_opt('site_url')), '^site_url' => qa_opt('site_url'));
                            $experts = explode("\n", qa_opt('expert_question_users'));
                            foreach ($experts as $expert) {
                                if (strpos($expert, '=')) {
                                    $expert = explode('=', $expert);
                                    $catnames = explode(',', $expert[1]);
                                    $cats = qa_db_read_all_values(qa_db_query_sub('SELECT categoryid FROM ^categories WHERE title IN ($)', $catnames));
                                    if (in_array($params['categoryid'], $cats)) {
                                        qa_send_notification($this->getuserfromhandle($expert[0]), '@', $expert[0], qa_opt('expert_question_email_subject'), qa_opt('expert_question_email_body'), $subs);
                                    }
                                } else {
                                    qa_send_notification($this->getuserfromhandle($expert), '@', $expert, qa_opt('expert_question_email_subject'), qa_opt('expert_question_email_body'), $subs);
                                }
                            }
                        }
                    }
                    break;
                default:
                    break;
            }
        }
    }
开发者ID:rkarimabadi,项目名称:q2a-expert-questions,代码行数:41,代码来源:qa-expert-check.php

示例7: 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

示例8: qa_flag_set_tohide

function qa_flag_set_tohide($post, $userid, $handle, $cookieid, $question)
{
    require_once QA_INCLUDE_DIR . 'qa-db-votes.php';
    require_once QA_INCLUDE_DIR . 'qa-app-limits.php';
    qa_db_userflag_set($post['postid'], $userid, true);
    qa_db_post_recount_flags($post['postid']);
    switch ($post['basetype']) {
        case 'Q':
            $action = 'q_flag';
            break;
        case 'A':
            $action = 'a_flag';
            break;
        case 'C':
            $action = 'c_flag';
            break;
    }
    qa_report_write_action($userid, null, $action, $post['basetype'] == 'Q' ? $post['postid'] : null, $post['basetype'] == 'A' ? $post['postid'] : null, $post['basetype'] == 'C' ? $post['postid'] : null);
    qa_report_event($action, $userid, $handle, $cookieid, array('postid' => $post['postid']));
    $post = qa_db_select_with_pending(qa_db_full_post_selectspec(null, $post['postid']));
    $flagcount = $post['flagcount'];
    $notifycount = $flagcount - qa_opt('flagging_notify_first');
    if ($notifycount >= 0 && $notifycount % qa_opt('flagging_notify_every') == 0) {
        require_once QA_INCLUDE_DIR . 'qa-app-emails.php';
        require_once QA_INCLUDE_DIR . 'qa-app-format.php';
        $anchor = $post['basetype'] == 'Q' ? null : qa_anchor($post['basetype'], $post['postid']);
        qa_send_notification(null, qa_opt('feedback_email'), null, qa_lang('emails/flagged_subject'), qa_lang('emails/flagged_body'), array('^p_handle' => isset($post['handle']) ? $post['handle'] : qa_lang('main/anonymous'), '^flags' => $flagcount == 1 ? qa_lang_html_sub('main/1_flag', '1', '1') : qa_lang_html_sub('main/x_flags', $flagcount), '^p_context' => trim(@$post['title'] . "\n\n" . qa_viewer_text($post['content'], $post['format'])), '^url' => qa_path(qa_q_request($question['postid'], $question['title']), null, qa_opt('site_url'), null, $anchor)));
    }
    if ($flagcount >= qa_opt('flagging_hide_after') && !$post['hidden']) {
        return true;
    }
    return false;
}
开发者ID:TheProjecter,项目名称:microprobe,代码行数:33,代码来源:qa-app-votes.php

示例9: qa_lang

        if (empty($inmessage)) {
            $errors['message'] = qa_lang('misc/message_empty');
        }
        if (empty($errors)) {
            require_once QA_INCLUDE_DIR . 'qa-db-messages.php';
            require_once QA_INCLUDE_DIR . 'qa-app-emails.php';
            if (qa_opt('show_message_history')) {
                $messageid = qa_db_message_create($loginuserid, $toaccount['userid'], $inmessage, '', false);
            } else {
                $messageid = null;
            }
            $fromhandle = qa_get_logged_in_handle();
            $canreply = !(qa_get_logged_in_flags() & QA_USER_FLAGS_NO_MESSAGES);
            $more = strtr(qa_lang($canreply ? 'emails/private_message_reply' : 'emails/private_message_info'), array('^f_handle' => $fromhandle, '^url' => qa_path_absolute($canreply ? 'message/' . $fromhandle : 'user/' . $fromhandle)));
            $subs = array('^message' => $inmessage, '^f_handle' => $fromhandle, '^f_url' => qa_path_absolute('user/' . $fromhandle), '^more' => $more, '^a_url' => qa_path_absolute('account'));
            if (qa_send_notification($toaccount['userid'], $toaccount['email'], $toaccount['handle'], qa_lang('emails/private_message_subject'), qa_lang('emails/private_message_body'), $subs)) {
                $messagesent = true;
            } else {
                $pageerror = qa_lang_html('main/general_error');
            }
            qa_report_event('u_message', $loginuserid, qa_get_logged_in_handle(), qa_cookie_get(), array('userid' => $toaccount['userid'], 'handle' => $toaccount['handle'], 'messageid' => $messageid, 'message' => $inmessage));
            if ($messagesent && qa_opt('show_message_history')) {
                // show message as part of general history
                qa_redirect(qa_request(), array('state' => 'message-sent'));
            }
        }
    }
}
//	Prepare content for theme
$qa_content = qa_content_prepare();
$qa_content['title'] = qa_lang_html('misc/private_message_title');
开发者ID:gogupe,项目名称:question2answer-releases,代码行数:31,代码来源:qa-page-message.php

示例10: qa_complete_reset_user

function qa_complete_reset_user($userid)
{
    if (qa_to_override(__FUNCTION__)) {
        $args = func_get_args();
        return qa_call_override(__FUNCTION__, $args);
    }
    require_once QA_INCLUDE_DIR . 'qa-util-string.php';
    require_once QA_INCLUDE_DIR . 'qa-app-options.php';
    require_once QA_INCLUDE_DIR . 'qa-app-emails.php';
    require_once QA_INCLUDE_DIR . 'qa-app-cookies.php';
    require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
    $password = qa_random_alphanum(max(QA_MIN_PASSWORD_LEN, QA_NEW_PASSWORD_LEN));
    $userinfo = qa_db_select_with_pending(qa_db_user_account_selectspec($userid, true));
    if (!qa_send_notification($userid, $userinfo['email'], $userinfo['handle'], qa_lang('emails/new_password_subject'), qa_lang('emails/new_password_body'), array('^password' => $password, '^url' => qa_opt('site_url')))) {
        qa_fatal_error('Could not send new password - password not reset');
    }
    qa_db_user_set_password($userid, $password);
    // do this last, to be safe
    qa_db_user_set($userid, 'emailcode', '');
    // so can't be reused
    qa_report_event('u_reset', $userid, $userinfo['handle'], qa_cookie_get(), array('email' => $userinfo['email']));
}
开发者ID:robomartin,项目名称:Q2A-Mod-2,代码行数:22,代码来源:qa-app-users-edit.php

示例11: 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

示例12: notify

 function notify($uid, $notices)
 {
     require_once QA_INCLUDE_DIR . 'qa-app-users.php';
     require_once QA_INCLUDE_DIR . 'qa-app-emails.php';
     if (QA_FINAL_EXTERNAL_USERS) {
         $publictohandle = qa_get_public_from_userids(array($uid));
         $handle = @$publictohandle[$uid];
     } else {
         $user = qa_db_single_select(qa_db_user_account_selectspec($uid, true));
         $handle = @$user['handle'];
     }
     $subject = qa_opt('priv_email_subject');
     $body = qa_opt('priv_email_body');
     $n = explode(',', $notices);
     if (count($n) > 1) {
         $body = preg_replace('/\\^single=`([^`]+)`/', '', $body);
         preg_match('/\\^multi=`([^`]+)`/', $body, $multi);
         $m = str_replace('#', count($n), $multi[1]);
         $body = preg_replace('/\\^multi=`([^`]+)`/', $m, $body);
     } else {
         $body = preg_replace('/\\^single=`([^`]+)`/', '$1', $body);
         $body = preg_replace('/\\^multi=`([^`]+)`/', '', $body);
     }
     $site_url = qa_opt('site_url');
     $profile_url = qa_path_html('user/' . $handle, null, $site_url);
     $subs = array('^profile_url' => $profile_url, '^site_url' => $site_url);
     qa_send_notification($uid, '@', $handle, $subject, $body, $subs);
 }
开发者ID:ruuttt,项目名称:question2answer_sandbox,代码行数:28,代码来源:qa-priv-check.php

示例13: sprintf

            $body .= sprintf("It has been %s days since you last posted a question.\n", mp_get_days_since_last_post($user['userid'], $category, 'Q'));
        } else {
            $body .= sprintf("You have not posted a question before.  Posting a question will help increase your activity points while motivating the knowledge sharing process.\n\n");
        }
        $answercount = mp_get_count_posts_by_userid_category_posttype($user['userid'], $category, 'A');
        if ($answercount > 0) {
            $body .= sprintf("You have posted %d answers so far. ", $answercount);
            $body .= sprintf("It has been %d days since you last posted an answer.\n", mp_get_days_since_last_post($user['userid'], $category, 'A'));
        } else {
            $body .= sprintf("You have not posted an answer before.  Posting an answer will help increase your activity and knowledge sharing points while helping your fellow students.\n\n");
        }
        // point awareness
        $body .= sprintf("\nPOINTS INFORMATION\n");
        $body .= sprintf("You currently have %6s activity points.\n", mp_get_activity_points_by_userid($user['userid'], $category));
        $body .= sprintf("You currently have %6s knowledge contribution points.\n", mp_get_contribution_points_by_userid($user['userid'], $category));
        $body .= sprintf("You currently have %6s participation points.\n", mp_get_participation_points_by_userid($user['userid'], $category));
        $body .= sprintf("You currently have %6s total points.\n\n", mp_get_total_points_by_userid($user['userid'], $category));
        // contribution
        //$body.= "Within last month, a total of X questions were asked. Of those questions, X were asked by you.  Of those question N were answered.<br />";
        //$body.= "Maybe you can help by answered those questions.<br />";
        $body .= sprintf("You can increase your points by logging in to the system, asking questions, posting answers, or voting for either a question or an answer.\n\n");
        $body .= sprintf("Sincerely,\nThe MicroProbe team");
        // send the mail to the user
        //qa_send_notification($user['userid'], null, null, $subject, $body, null);
        if ($debug == FALSE) {
            qa_send_notification($user['userid'], null, null, $subjects[$subjectindex] . $categoryinfo['title'], $body, null);
            //qa_send_notification(1, null, null, $subjects[$subjectindex].$categoryinfo['title'], $body, null);
        }
        echo $debug . '<hr>' . $body;
    }
}
开发者ID:TheProjecter,项目名称:microprobe,代码行数:31,代码来源:mp-biweekly-usage-report.php


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