本文整理汇总了PHP中qa_db_points_update_ifuser函数的典型用法代码示例。如果您正苦于以下问题:PHP qa_db_points_update_ifuser函数的具体用法?PHP qa_db_points_update_ifuser怎么用?PHP qa_db_points_update_ifuser使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qa_db_points_update_ifuser函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: qa_vote_set
function qa_vote_set($post, $userid, $handle, $cookieid, $vote)
{
require_once QA_INCLUDE_DIR . 'qa-db-points.php';
require_once QA_INCLUDE_DIR . 'qa-db-hotness.php';
require_once QA_INCLUDE_DIR . 'qa-db-votes.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';
}
qa_report_write_action($userid, null, $action, $postisanswer ? null : $post['postid'], $postisanswer ? $post['postid'] : null, null);
qa_report_event($action, $userid, $handle, $cookieid, array('postid' => $post['postid'], 'vote' => $vote, 'oldvote' => $oldvote));
}
示例2: qa_create_new_user
function qa_create_new_user($email, $password, $handle, $level = QA_USER_LEVEL_BASIC, $confirmed = false)
{
require_once QA_INCLUDE_DIR . 'qa-db-users.php';
require_once QA_INCLUDE_DIR . 'qa-db-points.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';
$userid = qa_db_user_create($email, $password, $handle, $level, qa_remote_ip_address());
qa_db_points_update_ifuser($userid, null);
qa_db_uapprovecount_update();
if ($confirmed) {
qa_db_user_set_flag($userid, QA_USER_FLAGS_EMAIL_CONFIRMED, true);
}
if (qa_opt('show_notice_welcome')) {
qa_db_user_set_flag($userid, QA_USER_FLAGS_WELCOME_NOTICE, true);
}
$custom = qa_opt('show_custom_welcome') ? trim(qa_opt('custom_welcome')) : '';
if (qa_opt('confirm_user_emails') && $level < QA_USER_LEVEL_EXPERT && !$confirmed) {
$confirm = strtr(qa_lang('emails/welcome_confirm'), array('^url' => qa_get_new_confirm_url($userid, $handle)));
if (qa_opt('confirm_user_required')) {
qa_db_user_set_flag($userid, QA_USER_FLAGS_MUST_CONFIRM, true);
}
} else {
$confirm = '';
}
if (qa_opt('moderate_users') && qa_opt('approve_user_required') && $level < QA_USER_LEVEL_EXPERT) {
qa_db_user_set_flag($userid, QA_USER_FLAGS_MUST_APPROVE, true);
}
qw_send_notification($userid, $email, $handle, qa_lang('emails/welcome_subject'), nl2br(qa_lang('emails/welcome_body')), array('^password' => isset($password) ? qa_lang('main/hidden') : qa_lang('users/password_to_set'), '^url' => qa_opt('site_url'), '^custom' => strlen($custom) ? $custom . "\n\n" : '', '^confirm' => $confirm));
qa_report_event('u_register', $userid, $handle, qa_cookie_get(), array('email' => $email, 'level' => $level));
return $userid;
}
示例3: 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));
}
示例4: qa_redirect
}
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);
$usershtml = qa_userids_handles_html(qa_any_get_userids_handles($questions));
$usershtml[$userid] = $userhtml;
// Prepare content for theme
$qa_content = qa_content_prepare(true);
$qa_content['title'] = qa_lang_html_sub('profile/user_x', $userhtml);
if (isset($loginuserid) && !QA_FINAL_EXTERNAL_USERS) {
$qa_content['favorite'] = qa_favorite_form(QA_ENTITY_USER, $useraccount['userid'], $favorite, qa_lang_sub($favorite ? 'main/remove_x_favorites' : 'users/add_user_x_favorites', $handle));
}
// General information about the user, only available if we're using internal user management
示例5: qa_delete_user
function qa_delete_user($userid)
{
if (qa_to_override(__FUNCTION__)) {
$args = func_get_args();
return qa_call_override(__FUNCTION__, $args);
}
require_once QA_INCLUDE_DIR . 'qa-db-votes.php';
require_once QA_INCLUDE_DIR . 'qa-db-users.php';
require_once QA_INCLUDE_DIR . 'qa-db-post-update.php';
require_once QA_INCLUDE_DIR . 'qa-db-points.php';
$postids = qa_db_uservoteflag_user_get($userid);
// posts this user has flagged or voted on, whose counts need updating
qa_db_user_delete($userid);
foreach ($postids as $postid) {
// hoping there aren't many of these - saves a lot of new SQL code...
qa_db_post_recount_votes($postid);
qa_db_post_recount_flags($postid);
}
$postuserids = qa_db_posts_get_userids($postids);
foreach ($postuserids as $postuserid) {
qa_db_points_update_ifuser($postuserid, array('avoteds', 'qvoteds', 'upvoteds', 'downvoteds'));
}
}
示例6: qa_vote_set
function qa_vote_set($post, $userid, $handle, $cookieid, $vote)
{
if (qa_to_override(__FUNCTION__)) {
$args = func_get_args();
return qa_call_override(__FUNCTION__, $args);
}
require_once QA_INCLUDE_DIR . 'db/points.php';
require_once QA_INCLUDE_DIR . 'db/hotness.php';
require_once QA_INCLUDE_DIR . 'db/votes.php';
require_once QA_INCLUDE_DIR . 'db/post-create.php';
require_once QA_INCLUDE_DIR . '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';
if ($postisanswer) {
qa_db_post_acount_update($post['parentid']);
qa_db_unupaqcount_update();
}
$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) {
$event = $postisanswer ? 'a_vote_down' : 'q_vote_down';
} elseif ($vote > 0) {
$event = $postisanswer ? 'a_vote_up' : 'q_vote_up';
} else {
$event = $postisanswer ? 'a_vote_nil' : 'q_vote_nil';
}
qa_report_event($event, $userid, $handle, $cookieid, array('postid' => $post['postid'], 'userid' => $post['userid'], 'vote' => $vote, 'oldvote' => $oldvote));
}
示例7: qa_comment_create
function qa_comment_create($userid, $handle, $cookieid, $content, $format, $text, $notify, $email, $question, $parent, $commentsfollows, $queued = false)
{
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';
if (!isset($parent)) {
$parent = $question;
}
// for backwards compatibility with old answer parameter
$postid = qa_db_post_create($queued ? 'C_QUEUED' : '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 (!$queued) {
if ($question['type'] == 'Q' && ($parent['type'] == 'Q' || $parent['type'] == 'A')) {
// only index if antecedents fully visible
qa_post_index($postid, 'C', $question['postid'], $parent['postid'], null, $content, $format, $text, null, $question['categoryid']);
}
qa_db_points_update_ifuser($userid, 'cposts');
qa_db_ccount_update();
}
$thread = array();
foreach ($commentsfollows as $comment) {
if ($comment['type'] == 'C' && $comment['parentid'] == $parent['postid']) {
// find just those for this parent, fully visible
$thread[] = $comment;
}
}
qa_report_event($queued ? 'c_queue' : 'c_post', $userid, $handle, $cookieid, array('postid' => $postid, 'parentid' => $parent['postid'], 'parenttype' => $parent['basetype'], 'parent' => $parent, 'questionid' => $question['postid'], 'question' => $question, 'thread' => $thread, 'content' => $content, 'format' => $format, 'text' => $text, 'categoryid' => $question['categoryid'], 'notify' => $notify, 'email' => $email));
return $postid;
}
示例8: 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;
}
示例9: qa_comment_set_userid
function qa_comment_set_userid($oldcomment, $userid, $handle, $cookieid)
{
require_once QA_INCLUDE_DIR . 'db/votes.php';
$postid = $oldcomment['postid'];
qa_db_post_set_userid($postid, $userid);
qa_db_uservote_remove_own($postid);
qa_db_post_recount_votes($postid);
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' => $postid, 'parentid' => $oldcomment['parentid'], 'oldcomment' => $oldcomment));
}
示例10: qa_create_new_user
function qa_create_new_user($email, $password, $handle, $level = QA_USER_LEVEL_BASIC, $confirmed = false)
{
require_once QA_INCLUDE_DIR . 'qa-db-users.php';
require_once QA_INCLUDE_DIR . 'qa-db-points.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';
$userid = qa_db_user_create($email, $password, $handle, $level, qa_remote_ip_address());
qa_db_points_update_ifuser($userid, null);
if ($confirmed) {
qa_db_user_set_flag($userid, QA_USER_FLAGS_EMAIL_CONFIRMED, true);
}
$options = qa_get_options(array('custom_welcome', 'site_url', 'confirm_user_emails'));
$custom = trim($options['custom_welcome']);
if ($options['confirm_user_emails'] && $level < QA_USER_LEVEL_EXPERT && !$confirmed) {
$confirm = strtr(qa_lang('emails/welcome_confirm'), array('^url' => qa_get_new_confirm_url($userid, $handle)));
} else {
$confirm = '';
}
qa_send_notification($userid, $email, $handle, qa_lang('emails/welcome_subject'), qa_lang('emails/welcome_body'), array('^password' => isset($password) ? $password : qa_lang('users/password_to_set'), '^url' => $options['site_url'], '^custom' => empty($custom) ? '' : $custom . "\n\n", '^confirm' => $confirm));
qa_report_event('u_register', $userid, $handle, qa_cookie_get(), array('email' => $email, 'level' => $level));
return $userid;
}