本文整理汇总了PHP中qa_report_event函数的典型用法代码示例。如果您正苦于以下问题:PHP qa_report_event函数的具体用法?PHP qa_report_event怎么用?PHP qa_report_event使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qa_report_event函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: qa_wall_delete_post
function qa_wall_delete_post($userid, $handle, $cookieid, $message)
{
require_once QA_INCLUDE_DIR . 'qa-db-messages.php';
qa_db_message_delete($message['messageid']);
qa_db_user_recount_posts($message['touserid']);
qa_report_event('u_wall_delete', $userid, $handle, $cookieid, array('messageid' => $message['messageid'], 'oldmessage' => $message));
}
示例3: qa_user_favorite_set
function qa_user_favorite_set($userid, $handle, $cookieid, $entitytype, $entityid, $favorite)
{
require_once QA_INCLUDE_DIR . 'qa-db-favorites.php';
require_once QA_INCLUDE_DIR . 'qa-app-limits.php';
require_once QA_INCLUDE_DIR . 'qa-app-updates.php';
if ($favorite) {
qa_db_favorite_create($userid, $entitytype, $entityid);
} else {
qa_db_favorite_delete($userid, $entitytype, $entityid);
}
switch ($entitytype) {
case QA_ENTITY_QUESTION:
$action = $favorite ? 'q_favorite' : 'q_unfavorite';
$params = array('postid' => $entityid);
break;
case QA_ENTITY_USER:
$action = $favorite ? 'u_favorite' : 'u_unfavorite';
$params = array('userid' => $entityid);
break;
case QA_ENTITY_TAG:
$action = $favorite ? 'tag_favorite' : 'tag_unfavorite';
$params = array('wordid' => $entityid);
break;
case QA_ENTITY_CATEGORY:
$action = $favorite ? 'cat_favorite' : 'cat_unfavorite';
$params = array('categoryid' => $entityid);
break;
default:
qa_fatal_error('Favorite type not recognized');
break;
}
qa_report_event($action, $userid, $handle, $cookieid, $params);
}
示例4: qa_complete_reset_user
function qa_complete_reset_user($userid)
{
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 (!qw_send_notification($userid, $userinfo['email'], $userinfo['handle'], qa_lang('emails/new_password_subject'), nl2br(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']));
}
示例5: process_request
function process_request($request)
{
require_once QA_INCLUDE_DIR . 'qa-app-format.php';
require_once QA_INCLUDE_DIR . 'qa-app-posts.php';
require_once QA_INCLUDE_DIR . 'qa-db-post-create.php';
require_once QA_INCLUDE_DIR . 'mp-db-users.php';
// report that we entered this page
qa_report_event('page_enter', qa_get_logged_in_userid(), qa_get_logged_in_handle(), qa_cookie_get(), array('params' => $_SERVER['QUERY_STRING']));
// create the editor and update its content
qa_get_post_content('editor', 'content', $ineditor, $incontent, $informat, $intext);
$editorname = isset($ineditor) ? $ineditor : qa_opt('editor_for_qs');
$editor = qa_load_editor(@$incontent, @$informat, $editorname);
// retrieve variable data
$innotify = qa_post_text('notify') ? true : false;
// handle creation of annoucement
if (qa_post_text('docreate')) {
//retrieve data
$title = qa_post_text('title');
$content = $incontent;
$format = $informat;
// validate data
// handle create work
// actual create process is in file mp-app-posts.php
$postid = qa_post_create('AN', null, $title, $content, $format, mp_get_categoryid(), null, qa_get_logged_in_userid(), $innotify);
// redirect page
qa_redirect('mp-announcements-page');
// our work is done here
}
$qa_content = qa_content_prepare();
// if the user is not logged in, request user to login
if (!qa_get_logged_in_userid()) {
$qa_content['error'] = qa_insert_login_links('Please ^1log in^2 or ^3register^4 first.', $request);
return $qa_content;
}
$qa_content['title'] = 'Create Announcement';
$qa_content['form_newannouncement'] = array('tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '"', 'style' => 'tall', 'fields' => array('title' => array('label' => qa_lang_html('announcements/a_title_label'), 'tags' => 'NAME="title"', 'value' => qa_html(qa_post_text('title')), 'error' => qa_html(@$errors['title'])), 'content' => array_merge($editor->get_field($qa_content, @$incontent, @$informat, 'content', 12, false), array('label' => qa_lang_html('announcements/a_content_label'), 'error' => qa_html(@$errors['content']))), 'notify' => array('label' => 'Send email notification to all registered students', 'tags' => 'NAME="notify"', 'type' => 'checkbox', 'value' => qa_html($innotify))), 'buttons' => array('ok' => array('tags' => 'NAME="docreate"', 'label' => 'Create Announcement', 'value' => '1')), 'hidden' => array('hiddenfield' => '1', 'editor' => qa_html($editorname)));
// create the sub menu for navigation
$qa_content['navigation']['sub'] = mp_announcements_sub_navigation();
$qa_content['navigation']['sub']['create']['selected'] = true;
return $qa_content;
}
示例6: qa_db_message_create
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');
$qa_content['error'] = @$pageerror;
$qa_content['form_message'] = array('tags' => 'method="post" action="' . qa_self_html() . '"', 'style' => 'tall', 'fields' => array('message' => array('type' => $messagesent ? 'static' : '', 'label' => qa_lang_html_sub('misc/message_for_x', qa_get_one_user_html($handle, false)), 'tags' => 'name="message" id="message"', 'value' => qa_html(@$inmessage, $messagesent), 'rows' => 8, 'note' => qa_lang_html_sub('misc/message_explanation', qa_html(qa_opt('site_title'))), 'error' => qa_html(@$errors['message']))), 'buttons' => array('send' => array('tags' => 'onclick="qa_show_waiting_after(this, false);"', 'label' => qa_lang_html('main/send_button'))), 'hidden' => array('domessage' => '1', 'code' => qa_get_form_security_code('message-' . $handle)));
$qa_content['focusid'] = 'message';
if ($messagesent) {
$qa_content['form_message']['ok'] = qa_lang_html('misc/message_sent');
示例7: qa_report_event
qa_report_event('u_unblock', $loginuserid, qa_get_logged_in_handle(), qa_cookie_get(), array('userid' => $userid, 'handle' => $useraccount['handle']));
qa_redirect(qa_request());
}
if (qa_clicked('dohideall') && !qa_user_permit_error('permit_hide_show')) {
require_once QA_INCLUDE_DIR . 'qa-db-admin.php';
require_once QA_INCLUDE_DIR . 'qa-app-posts.php';
$postids = qa_db_get_user_visible_postids($userid);
foreach ($postids as $postid) {
qa_post_set_hidden($postid, true, $loginuserid);
}
qa_redirect(qa_request());
}
if (qa_clicked('dodelete') && $loginlevel >= QA_USER_LEVEL_ADMIN) {
require_once QA_INCLUDE_DIR . 'qa-app-users-edit.php';
qa_delete_user($userid);
qa_report_event('u_delete', $loginuserid, qa_get_logged_in_handle(), qa_cookie_get(), array('userid' => $userid, 'handle' => $useraccount['handle']));
qa_redirect('users');
}
}
}
// Process bonus setting button
if ($loginlevel >= QA_USER_LEVEL_ADMIN && qa_clicked('dosetbonus')) {
require_once QA_INCLUDE_DIR . 'qa-db-points.php';
qa_db_points_set_bonus($userid, (int) qa_post_text('bonus'));
qa_db_points_update_ifuser($userid, null);
qa_redirect(qa_request(), null, null, null, 'activity');
}
// Get information on user references in answers and other stuff need for page
$pagesize = qa_opt('page_size_user_posts');
$questions = qa_any_sort_and_dedupe(array_merge($questions, $answerqs, $commentqs, $editqs));
$questions = array_slice($questions, 0, $pagesize);
示例8: qa_comment_set_userid
function qa_comment_set_userid($oldcomment, $userid, $handle, $cookieid)
{
qa_db_post_set_userid($oldcomment['postid'], $userid);
qa_db_points_update_ifuser($oldcomment['userid'], array('cposts'));
qa_db_points_update_ifuser($userid, array('cposts'));
qa_report_event('c_claim', $userid, $handle, $cookieid, array('postid' => $oldcomment['postid'], 'parentid' => $oldcomment['parentid'], 'oldcomment' => $oldcomment));
}
示例9: qa_set_logged_in_user
function qa_set_logged_in_user($userid, $handle = '', $remember = false, $source = null, $categoryid = null)
{
require_once QA_INCLUDE_DIR . 'qa-app-cookies.php';
qa_start_session();
$suffix = qa_session_var_suffix();
if (isset($userid)) {
$_SESSION['qa_session_userid_' . $suffix] = $userid;
$_SESSION['qa_session_source_' . $suffix] = $source;
$_SESSION['qa_session_verify_' . $suffix] = qa_session_verify_code($userid);
$_SESSION['mp_session_category_id_' . $suffix] = $categoryid;
// prevents one account on a shared server being able to create a log in a user to Q2A on another account on same server
// PHP sessions time out too quickly on the server side, so we also set a cookie as backup.
// Logging in from a second browser will make the previous browser's 'Remember me' no longer
// work - I'm not sure if this is the right behavior - could see it either way.
require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
$userinfo = qa_db_single_select(qa_db_user_account_selectspec($userid, true));
// if we have logged in before, and are logging in the same way as before, we don't need to change the sessioncode/source
// this means it will be possible to automatically log in (via cookies) to the same account from more than one browser
if (empty($userinfo['sessioncode']) || $source !== $userinfo['sessionsource']) {
$sessioncode = qa_db_user_rand_sessioncode();
qa_db_user_set($userid, 'sessioncode', $sessioncode);
qa_db_user_set($userid, 'sessionsource', $source);
} else {
$sessioncode = $userinfo['sessioncode'];
}
qa_db_user_logged_in($userid, qa_remote_ip_address());
//qa_set_session_cookie($handle, $sessioncode, $remember);
qa_set_session_cookie($handle, $sessioncode, $remember, $categoryid);
qa_report_event('u_login', $userid, $userinfo['handle'], qa_cookie_get());
} else {
$olduserid = qa_get_logged_in_userid();
$oldhandle = qa_get_logged_in_handle();
qa_clear_session_cookie();
unset($_SESSION['qa_session_userid_' . $suffix]);
unset($_SESSION['qa_session_source_' . $suffix]);
unset($_SESSION['qa_session_verify_' . $suffix]);
unset($_SESSION['mp_session_category_id_' . $suffix]);
qa_report_event('u_logout', $olduserid, $oldhandle, qa_cookie_get());
}
}
示例10: qa_opt
if (qa_clicked('doblock')) {
$oldblocked = qa_opt('block_ips_write');
qa_set_option('block_ips_write', (strlen($oldblocked) ? $oldblocked . ' , ' : '') . $ip);
qa_report_event('ip_block', $userid, qa_get_logged_in_handle(), qa_cookie_get(), array('ip' => $ip));
qa_redirect(qa_request());
}
if (qa_clicked('dounblock')) {
require_once QA_INCLUDE_DIR . 'qa-app-limits.php';
$blockipclauses = qa_block_ips_explode(qa_opt('block_ips_write'));
foreach ($blockipclauses as $key => $blockipclause) {
if (qa_block_ip_match($ip, $blockipclause)) {
unset($blockipclauses[$key]);
}
}
qa_set_option('block_ips_write', implode(' , ', $blockipclauses));
qa_report_event('ip_unblock', $userid, qa_get_logged_in_handle(), qa_cookie_get(), array('ip' => $ip));
qa_redirect(qa_request());
}
if (qa_clicked('dohideall') && !qa_user_maximum_permit_error('permit_hide_show')) {
// allow moderator in one category to hide posts across all categories if they are identified via IP page
require_once QA_INCLUDE_DIR . 'qa-db-admin.php';
require_once QA_INCLUDE_DIR . 'qa-app-posts.php';
$postids = qa_db_get_ip_visible_postids($ip);
foreach ($postids as $postid) {
qa_post_set_hidden($postid, true, $userid);
}
qa_redirect(qa_request());
}
}
}
// Combine sets of questions and get information for users
示例11: or
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
More about this license: http://www.question2answer.org/license.php
*/
if (!defined('QA_VERSION')) {
// don't allow this page to be requested directly from browser
header('Location: ../');
exit;
}
// report that we entered this page
qa_report_event('page_enter', qa_get_logged_in_userid(), qa_get_logged_in_handle(), qa_cookie_get(), array('params' => $_SERVER['QUERY_STRING'], 'path' => $_SERVER['SCRIPT_NAME']));
require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
require_once QA_INCLUDE_DIR . 'qa-app-format.php';
// Get popular tags
$populartags = qa_db_select_with_pending(qa_db_popular_tags_selectspec($qa_start));
$tagcount = qa_opt('cache_tagcount');
$pagesize = qa_opt('page_size_tags');
// Prepare content for theme
$qa_content = qa_content_prepare();
$qa_content['title'] = qa_lang_html('main/popular_tags');
$qa_content['ranking'] = array('items' => array(), 'rows' => ceil($pagesize / qa_opt('columns_tags')), 'type' => 'tags');
if (count($populartags)) {
$output = 0;
foreach ($populartags as $word => $count) {
$qa_content['ranking']['items'][] = array('label' => qa_tag_html($word), 'count' => number_format($count));
if (++$output >= $pagesize) {
示例12: qa_flags_clear_all
function qa_flags_clear_all($post, $userid, $handle, $cookieid)
{
require_once QA_INCLUDE_DIR . 'qa-db-votes.php';
require_once QA_INCLUDE_DIR . 'qa-app-limits.php';
qa_db_userflags_clear_all($post['postid']);
qa_db_post_recount_flags($post['postid']);
switch ($post['basetype']) {
case 'Q':
$action = 'q_clearflags';
break;
case 'A':
$action = 'a_clearflags';
break;
case 'C':
$action = 'c_clearflags';
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']));
}
示例13: 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 . 'util/string.php';
require_once QA_INCLUDE_DIR . 'app/options.php';
require_once QA_INCLUDE_DIR . 'app/emails.php';
require_once QA_INCLUDE_DIR . 'app/cookies.php';
require_once QA_INCLUDE_DIR . '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']));
}
示例14: comment_vote_set
function comment_vote_set($post, $userid, $handle, $cookieid, $vote)
{
require_once QA_INCLUDE_DIR . 'qa-db-votes.php';
/*
require_once QA_INCLUDE_DIR.'qa-db-points.php';
require_once QA_INCLUDE_DIR.'qa-db-hotness.php';
require_once QA_INCLUDE_DIR.'qa-app-limits.php';
*/
$vote = (int) min(1, max(-1, $vote));
$oldvote = (int) qa_db_uservote_get($post['postid'], $userid);
qa_db_uservote_set($post['postid'], $userid, $vote);
qa_db_post_recount_votes($post['postid']);
/*
$postisanswer=($post['basetype']=='A');
$columns=array();
if ( ($vote>0) || ($oldvote>0) )
$columns[]=$postisanswer ? 'aupvotes' : 'qupvotes';
if ( ($vote<0) || ($oldvote<0) )
$columns[]=$postisanswer ? 'adownvotes' : 'qdownvotes';
qa_db_points_update_ifuser($userid, $columns);
qa_db_points_update_ifuser($post['userid'], array($postisanswer ? 'avoteds' : 'qvoteds', 'upvoteds', 'downvoteds'));
if ($post['basetype']=='Q')
qa_db_hotness_update($post['postid']);
if ($vote<0)
$action=$postisanswer ? 'a_vote_down' : 'q_vote_down';
elseif ($vote>0)
$action=$postisanswer ? 'a_vote_up' : 'q_vote_up';
else
$action=$postisanswer ? 'a_vote_nil' : 'q_vote_nil';
*/
if ($vote < 0) {
$action = 'c_vote_down';
} elseif ($vote > 0) {
$action = 'c_vote_up';
} else {
$action = 'c_vote_nil';
}
//qa_report_write_action($userid, null, $action, null, null, null);
qa_report_event($action, $userid, $handle, $cookieid, array('postid' => $post['postid'], 'vote' => $vote, 'oldvote' => $oldvote));
}
示例15: 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;
}