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


PHP qa_db_full_post_selectspec函数代码示例

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


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

示例1: output_widget

 function output_widget($region, $place, $themeobject, $template, $request, $qa_content)
 {
     require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
     global $qa_login_userid, $questionid, $relatedcount, $question, $relatedquestions, $qa_cookieid, $usershtml;
     list($question, $relatedquestions) = qa_db_select_with_pending(qa_db_full_post_selectspec($qa_login_userid, $questionid), qa_db_related_qs_selectspec($qa_login_userid, $questionid));
     if ($relatedcount > 1 && !$question['hidden']) {
         $minscore = qa_match_to_min_score(qa_opt('match_related_qs'));
         foreach ($relatedquestions as $key => $related) {
             if ($related['postid'] == $questionid || $related['score'] < $minscore) {
                 unset($relatedquestions[$key]);
             }
         }
         if (count($relatedquestions)) {
             $themeobject->output('<h2>' . qa_lang('main/related_qs_title') . '</h2>');
         } else {
             $themeobject->output('<h2>' . qa_lang('main/no_related_qs_title') . '</h2>');
         }
         $upper = qa_opt('related_qs_num') < count($relatedquestions) ? qa_opt('related_qs_num') : count($relatedquestions);
         foreach ($relatedquestions as $related) {
             if ($upper <= 0) {
                 break;
             }
             $themeobject->output('<p style="margin:0 0 10px 0; font-weight:bold;"><a href="' . qa_path_html(qa_q_request($related['postid'], $related['title'])) . '">' . $related['title'] . '</a></p>');
             $upper--;
         }
     }
 }
开发者ID:ayagup,项目名称:qa-related-questions,代码行数:27,代码来源:qa-related-questions.php

示例2: user_activity_form


//.........这里部分代码省略.........
                } else {
                    if (in_array($type, array('u_edit', 'u_level', 'u_block', 'u_unblock'))) {
                        $ohandle = $this->getHandleFromID($params['userid']);
                        $link = '<a href="' . qa_path_html('user/' . $ohandle, null, qa_opt('site_url')) . '">' . $ohandle . '</a>';
                    } else {
                        $link = '';
                    }
                }
            } else {
                if ($type == 'badge_awarded') {
                    if (!qa_opt('badge_active') || !function_exists('qa_get_badge_type')) {
                        continue;
                    }
                    if ($post != null) {
                        if (strpos($post['type'], 'Q') !== 0) {
                            $anchor = qa_anchor(strpos($post['type'], 'A') === 0 ? 'A' : 'C', $params['postid']);
                            $parent = qa_db_read_one_assoc(qa_db_query_sub('SELECT parentid,type,BINARY title as title,postid FROM ^posts WHERE postid=#', $post['parentid']), true);
                            if ($parent['type'] == 'A') {
                                $parent = qa_db_read_one_assoc(qa_db_query_sub('SELECT BINARY title as title,postid FROM ^posts WHERE postid=#', $parent['parentid']), true);
                            }
                            $activity_url = qa_path_html(qa_q_request($parent['postid'], $parent['title']), null, qa_opt('site_url'), null, $anchor);
                            $link = '<a href="' . $activity_url . '">' . $parent['title'] . '</a>';
                        } else {
                            $activity_url = qa_path_html(qa_q_request($params['postid'], $post['title']), null, qa_opt('site_url'), null, null);
                            $link = '<a href="' . $activity_url . '">' . $post['title'] . '</a>';
                        }
                    }
                } else {
                    if ($post != null && strpos($event['event'], 'q_') !== 0 && strpos($event['event'], 'in_q_') !== 0) {
                        // comment or answer
                        if (!isset($params['parentid'])) {
                            $params['parentid'] = $post['parentid'];
                        }
                        $parent = qa_db_select_with_pending(qa_db_full_post_selectspec($userid, $params['parentid']));
                        if ($parent['type'] == 'A') {
                            $parent = qa_db_select_with_pending(qa_db_full_post_selectspec($userid, $parent['parentid']));
                        }
                        $anchor = qa_anchor(strpos($event['event'], 'a_') === 0 || strpos($event['event'], 'in_a_') === 0 ? 'A' : 'C', $params['postid']);
                        $activity_url = qa_path_html(qa_q_request($parent['postid'], $parent['title']), null, qa_opt('site_url'), null, $anchor);
                        $link = '<a href="' . $activity_url . '">' . $parent['title'] . '</a>';
                    } else {
                        if ($post != null) {
                            // question
                            if (!isset($params['title'])) {
                                $params['title'] = $posts[$params['postid']]['title'];
                            }
                            if ($params['title'] !== null) {
                                $activity_url = qa_path_html(qa_q_request($params['postid'], $params['title']), null, qa_opt('site_url'));
                                $link = '<a href="' . $activity_url . '">' . $params['title'] . '</a>';
                            }
                        }
                    }
                }
            }
            $time = $event['datetime'];
            if (qa_opt('user_act_list_shading')) {
                $days = (qa_opt('db_time') - $time) / 60 / 60 / 24;
                $col = round($days / qa_opt('user_act_list_age') * 255 / 2);
                $bkg = 255 - round($days / qa_opt('user_act_list_age') * 255 / 8);
                $bkg = dechex($bkg);
                $col = dechex($col);
                if (strlen($col) == 1) {
                    $col = '0' . $col;
                }
                if (strlen($bkg) == 1) {
                    $bkg = '0' . $bkg;
开发者ID:ruuttt,项目名称:question2answer_sandbox,代码行数:67,代码来源:qa-history-layer.php

示例3: qa_post_text

require_once QA_INCLUDE_DIR . 'app/users.php';
require_once QA_INCLUDE_DIR . 'db/selects.php';
require_once QA_INCLUDE_DIR . 'pages/question-view.php';
require_once QA_INCLUDE_DIR . 'pages/question-submit.php';
//	Load relevant information about this comment
$commentid = qa_post_text('commentid');
$questionid = qa_post_text('questionid');
$parentid = qa_post_text('parentid');
$userid = qa_get_logged_in_userid();
list($comment, $question, $parent, $children) = qa_db_select_with_pending(qa_db_full_post_selectspec($userid, $commentid), qa_db_full_post_selectspec($userid, $questionid), qa_db_full_post_selectspec($userid, $parentid), qa_db_full_child_posts_selectspec($userid, $parentid));
//	Check if there was an operation that succeeded
if (@$comment['basetype'] == 'C' && @$question['basetype'] == 'Q' && (@$parent['basetype'] == 'Q' || @$parent['basetype'] == 'A')) {
    $comment = $comment + qa_page_q_post_rules($comment, $parent, $children, null);
    // array union
    if (qa_page_q_single_click_c($comment, $question, $parent, $error)) {
        $comment = qa_db_select_with_pending(qa_db_full_post_selectspec($userid, $commentid));
        //	If so, page content to be updated via Ajax
        echo "QA_AJAX_RESPONSE\n1";
        //	If the comment was not deleted...
        if (isset($comment)) {
            $parent = $parent + qa_page_q_post_rules($parent, $questionid == $parentid ? null : $question, null, $children);
            // in theory we should retrieve the parent's siblings for the above, but they're not going to be relevant
            $comment = $comment + qa_page_q_post_rules($comment, $parent, $children, null);
            $usershtml = qa_userids_handles_html(array($comment), true);
            $c_view = qa_page_q_comment_view($question, $parent, $comment, $usershtml, false);
            $themeclass = qa_load_theme_class(qa_get_site_theme(), 'ajax-comment', null, null);
            //	... send back the HTML for it
            echo "\n";
            $themeclass->c_list_item($c_view);
        }
        return;
开发者ID:GitFuture,项目名称:bmf,代码行数:31,代码来源:click-comment.php

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

示例5: qa_question_set_status

function qa_question_set_status($oldquestion, $status, $userid, $handle, $cookieid, $answers, $commentsfollows, $closepost = null)
{
    require_once QA_INCLUDE_DIR . 'qa-app-format.php';
    require_once QA_INCLUDE_DIR . 'qa-app-updates.php';
    $washidden = $oldquestion['type'] == 'Q_HIDDEN';
    $wasqueued = $oldquestion['type'] == 'Q_QUEUED';
    $wasrequeued = $wasqueued && isset($oldquestion['updated']);
    qa_post_unindex($oldquestion['postid']);
    foreach ($answers as $answer) {
        qa_post_unindex($answer['postid']);
    }
    foreach ($commentsfollows as $comment) {
        if ($comment['basetype'] == 'C') {
            qa_post_unindex($comment['postid']);
        }
    }
    if (@$closepost['parentid'] == $oldquestion['postid']) {
        qa_post_unindex($closepost['postid']);
    }
    $setupdated = false;
    $event = null;
    if ($status == QA_POST_STATUS_QUEUED) {
        $newtype = 'Q_QUEUED';
        if (!$wasqueued) {
            $event = 'q_requeue';
        }
        // same event whether it was hidden or shown before
    } elseif ($status == QA_POST_STATUS_HIDDEN) {
        $newtype = 'Q_HIDDEN';
        if (!$washidden) {
            $event = $wasqueued ? 'q_reject' : 'q_hide';
            if (!$wasqueued) {
                $setupdated = true;
            }
        }
    } elseif ($status == QA_POST_STATUS_NORMAL) {
        $newtype = 'Q';
        if ($wasqueued) {
            $event = 'q_approve';
        } elseif ($washidden) {
            $event = 'q_reshow';
            $setupdated = true;
        }
    } else {
        qa_fatal_error('Unknown status in qa_question_set_status(): ' . $status);
    }
    qa_db_post_set_type($oldquestion['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) {
            // reset edit time to now if there was one, since we're approving the edit...
            qa_db_post_set_updated($oldquestion['postid'], null);
        } else {
            // ... otherwise we're approving original created post
            qa_db_post_set_created($oldquestion['postid'], null);
            qa_db_hotness_update($oldquestion['postid']);
        }
    }
    qa_update_counts_for_q($oldquestion['postid']);
    qa_db_points_update_ifuser($oldquestion['userid'], array('qposts', 'aselects'));
    if ($wasqueued || $status == QA_POST_STATUS_QUEUED) {
        qa_db_queuedcount_update();
    }
    if ($oldquestion['flagcount']) {
        qa_db_flaggedcount_update();
    }
    if ($status == QA_POST_STATUS_NORMAL) {
        qa_post_index($oldquestion['postid'], 'Q', $oldquestion['postid'], $oldquestion['parentid'], $oldquestion['title'], $oldquestion['content'], $oldquestion['format'], qa_viewer_text($oldquestion['content'], $oldquestion['format']), $oldquestion['tags'], $oldquestion['categoryid']);
        foreach ($answers as $answer) {
            if ($answer['type'] == 'A') {
                // even if question visible, don't index hidden or queued answers
                qa_post_index($answer['postid'], $answer['type'], $oldquestion['postid'], $answer['parentid'], null, $answer['content'], $answer['format'], qa_viewer_text($answer['content'], $answer['format']), null, $answer['categoryid']);
            }
        }
        foreach ($commentsfollows as $comment) {
            if ($comment['type'] == 'C') {
                $answer = @$answers[$comment['parentid']];
                if (!isset($answer) || $answer['type'] == 'A') {
                    // don't index comment if it or its parent is hidden
                    qa_post_index($comment['postid'], $comment['type'], $oldquestion['postid'], $comment['parentid'], null, $comment['content'], $comment['format'], qa_viewer_text($comment['content'], $comment['format']), null, $comment['categoryid']);
                }
            }
        }
        if ($closepost['parentid'] == $oldquestion['postid']) {
            qa_post_index($closepost['postid'], $closepost['type'], $oldquestion['postid'], $closepost['parentid'], null, $closepost['content'], $closepost['format'], qa_viewer_text($closepost['content'], $closepost['format']), null, $closepost['categoryid']);
        }
    }
    $eventparams = array('postid' => $oldquestion['postid'], 'parentid' => $oldquestion['parentid'], 'parent' => isset($oldquestion['parentid']) ? qa_db_single_select(qa_db_full_post_selectspec(null, $oldquestion['parentid'])) : null, 'title' => $oldquestion['title'], 'content' => $oldquestion['content'], 'format' => $oldquestion['format'], 'text' => qa_viewer_text($oldquestion['content'], $oldquestion['format']), 'tags' => $oldquestion['tags'], 'categoryid' => $oldquestion['categoryid'], 'name' => $oldquestion['name']);
    if (isset($event)) {
        qa_report_event($event, $userid, $handle, $cookieid, $eventparams + array('oldquestion' => $oldquestion));
    }
    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';
        qa_report_event('q_post', $oldquestion['userid'], $oldquestion['handle'], $oldquestion['cookieid'], $eventparams + array('notify' => isset($oldquestion['notify']), 'email' => qa_email_validate($oldquestion['notify']) ? $oldquestion['notify'] : null, 'delayed' => $oldquestion['created']));
    }
}
开发者ID:gogupe,项目名称:question2answer-releases,代码行数:97,代码来源:qa-app-post-update.php

示例6: qa_post_get_full

function qa_post_get_full($postid, $requiredbasetypes = null)
{
    $post = qa_db_single_select(qa_db_full_post_selectspec(null, $postid));
    if (!is_array($post)) {
        qa_fatal_error('Post ID could not be found: ' . $postid);
    }
    if (isset($requiredbasetypes) && !is_numeric(strpos($requiredbasetypes, $post['basetype']))) {
        qa_fatal_error('Post of wrong type: ' . $post['basetype']);
    }
    return $post;
}
开发者ID:mathjoy,项目名称:math-duodaa,代码行数:11,代码来源:qa-app-posts.php

示例7: qa_badge_plugin_user_form

function qa_badge_plugin_user_form($userid)
{
    $handles = qa_userids_to_handles(array($userid));
    $handle = $handles[$userid];
    // displays badge list in user profile
    $result = qa_db_read_all_assoc(qa_db_query_sub('SELECT badge_slug as slug, object_id AS oid FROM ^userbadges WHERE user_id=#', $userid));
    $fields = array();
    if (count($result) > 0) {
        // count badges
        $bin = qa_get_badge_list();
        $badges = array();
        foreach ($result as $info) {
            $slug = $info['slug'];
            $type = $bin[$slug]['type'];
            if (isset($badges[$type][$slug])) {
                $badges[$type][$slug]['count']++;
            } else {
                $badges[$type][$slug]['count'] = 1;
            }
            if ($info['oid']) {
                $badges[$type][$slug]['oid'][] = $info['oid'];
            }
        }
        foreach ($badges as $type => $badge) {
            $typea = qa_get_badge_type($type);
            $types = $typea['slug'];
            $typed = $typea['name'];
            $output = '
							<table>
								<tr>
									<td class="qa-form-wide-label">
										<h3 class="badge-title" title="' . qa_lang('badges/' . $types . '_desc') . '">' . $typed . '</h3>
									</td>
								</tr>';
            foreach ($badge as $slug => $info) {
                $badge_name = qa_lang('badges/' . $slug);
                if (!qa_opt('badge_' . $slug . '_name')) {
                    qa_opt('badge_' . $slug . '_name', $badge_name);
                }
                $name = qa_opt('badge_' . $slug . '_name');
                $count = $info['count'];
                if (qa_opt('badge_show_source_posts')) {
                    $oids = @$info['oid'];
                } else {
                    $oids = null;
                }
                $var = qa_opt('badge_' . $slug . '_var');
                $desc = qa_badge_desc_replace($slug, $var, $name);
                // badge row
                $output .= '
								<tr>
									<td class="badge-container">
										<div class="badge-container-badge">
											<span class="badge-' . $types . '" title="' . $desc . ' (' . $typed . ')">' . qa_html($name) . '</span>&nbsp;<span onclick="jQuery(\'.badge-container-sources-' . $slug . '\').slideToggle()" class="badge-count' . (is_array($oids) ? ' badge-count-link" title="' . qa_lang('badges/badge_count_click') : '') . '">x&nbsp;' . $count . '</span>
										</div>';
                // source row(s) if any
                if (is_array($oids)) {
                    $output .= '
										<div class="badge-container-sources-' . $slug . '" style="display:none">';
                    foreach ($oids as $oid) {
                        $post = qa_db_select_with_pending(qa_db_full_post_selectspec(null, $oid));
                        $title = $post['title'];
                        $anchor = '';
                        if ($post['parentid']) {
                            $anchor = urlencode(qa_anchor($post['type'], $oid));
                            $oid = $post['parentid'];
                            $title = qa_db_read_one_value(qa_db_query_sub('SELECT BINARY title as title FROM ^posts WHERE postid=#', $oid), true);
                        }
                        $length = 30;
                        $text = qa_strlen($title) > $length ? qa_substr($title, 0, $length) . '...' : $title;
                        $output .= '
											<div class="badge-source"><a href="' . qa_path_html(qa_q_request($oid, $title), NULL, qa_opt('site_url')) . ($anchor ? '#' . $anchor : '') . '">' . qa_html($text) . '</a></div>';
                    }
                }
                $output .= '
									</td>
								</tr>';
            }
            $output .= '
							</table>';
            $outa[] = $output;
        }
        $fields[] = array('value' => '<table class="badge-user-tables"><tr><td class="badge-user-table">' . implode('</td><td class="badge-user-table">', $outa) . '</td></tr></table>', 'type' => 'static');
    }
    $ok = null;
    $tags = null;
    $buttons = array();
    if ((bool) qa_opt('badge_email_notify') && qa_get_logged_in_handle() == $handle) {
        // add badge notify checkbox
        if (qa_clicked('badge_email_notify_save')) {
            qa_opt('badge_email_notify_id_' . $userid, (bool) qa_post_text('badge_notify_email_me'));
            $ok = qa_lang('badges/badge_notified_email_me');
        }
        $select = (bool) qa_opt('badge_email_notify_id_' . $userid);
        $tags = 'id="badge-form" action="' . qa_self_html() . '#signature_text" method="POST"';
        $fields[] = array('type' => 'blank');
        $fields[] = array('label' => qa_lang('badges/badge_notify_email_me'), 'type' => 'checkbox', 'tags' => 'NAME="badge_notify_email_me"', 'value' => $select);
        $buttons[] = array('label' => qa_lang_html('main/save_button'), 'tags' => 'NAME="badge_email_notify_save"');
    }
    return array('ok' => $ok && !isset($error) ? $ok : null, 'style' => 'tall', 'tags' => $tags, 'title' => qa_lang('badges/badges'), 'fields' => $fields, 'buttons' => $buttons);
//.........这里部分代码省略.........
开发者ID:roine,项目名称:q2a-badges,代码行数:101,代码来源:qa-plugin.php

示例8: ra_ajax_add_answer

function ra_ajax_add_answer()
{
    //	Load relevant information about this question
    $questionid = qa_post_text('a_questionid');
    $userid = qa_get_logged_in_userid();
    list($question, $childposts) = qa_db_select_with_pending(qa_db_full_post_selectspec($userid, $questionid), qa_db_full_child_posts_selectspec($userid, $questionid));
    //	Check if the question exists, is not closed, and whether the user has permission to do this
    if (@$question['basetype'] == 'Q' && !isset($question['closedbyid']) && !qa_user_post_permit_error('permit_post_a', $question, QA_LIMIT_ANSWERS)) {
        require_once QA_INCLUDE_DIR . 'qa-app-captcha.php';
        require_once QA_INCLUDE_DIR . 'qa-app-format.php';
        require_once QA_INCLUDE_DIR . 'qa-app-post-create.php';
        require_once QA_INCLUDE_DIR . 'qa-app-cookies.php';
        require_once QA_INCLUDE_DIR . 'qa-page-question-view.php';
        require_once QA_INCLUDE_DIR . 'qa-page-question-submit.php';
        //	Try to create the new answer
        $usecaptcha = qa_user_use_captcha(qa_user_level_for_post($question));
        $answers = qa_page_q_load_as($question, $childposts);
        $answerid = qa_page_q_add_a_submit($question, $answers, false, $in, $errors);
        if ($answerid) {
            return true;
        }
    }
    die;
}
开发者ID:rahularyan,项目名称:dude-theme,代码行数:24,代码来源:qa-plugin.php

示例9: get_cache

 /**
  * Outputs cache to the user
  */
 private function get_cache()
 {
     global $qa_usage;
     qa_db_connect('qa_page_db_fail_handler');
     qa_page_queue_pending();
     qa_load_state();
     qa_check_login_modules();
     qa_check_page_clicks();
     $contents = @file_get_contents($this->cache_file);
     if (!$contents) {
         return;
     }
     //cache failure, graceful exit
     $qa_content = array();
     // Dummy contents
     $userid = qa_get_logged_in_userid();
     $questionid = qa_request_part(0);
     $cookieid = qa_cookie_get(true);
     if (is_numeric($questionid)) {
         $question = qa_db_select_with_pending(qa_db_full_post_selectspec($userid, $questionid));
         if (is_numeric($questionid) && qa_opt('do_count_q_views') && !$this->post_method && !qa_is_http_post() && qa_is_human_probably() && (!$question['views'] || ($question['lastviewip'] != qa_remote_ip_address() || !isset($question['lastviewip'])) && ($question['createip'] != qa_remote_ip_address() || !isset($question['createip'])) && ($question['userid'] != $userid || !isset($question['userid'])) && ($question['cookieid'] != $cookieid || !isset($question['cookieid'])))) {
             $qa_content['inc_views_postid'] = $questionid;
         } else {
             $qa_content['inc_views_postid'] = null;
         }
         qa_do_content_stats($qa_content);
     }
     if (QA_DEBUG_PERFORMANCE) {
         ob_start();
         $qa_usage->output();
         $contents .= ob_get_contents();
         ob_end_clean();
     }
     qa_db_disconnect();
     exit($contents);
 }
开发者ID:stevenev,项目名称:q2a-caching,代码行数:39,代码来源:qa-caching-main.php

示例10: bookmarks_plugin_form

 function bookmarks_plugin_form()
 {
     // displays bookmarks_plugin_form form in user profile
     global $qa_request;
     $handle = preg_replace('/^[^\\/]+\\/([^\\/]+).*/', "\$1", $qa_request);
     $uid = $this->getuserfromhandle($handle);
     if (!$uid) {
         return;
     }
     if (qa_get_logged_in_handle() && qa_get_logged_in_handle() == $handle) {
         $bookmarks = $this->get_bookmarks_for_user($uid);
         if (!$bookmarks) {
             return;
         }
         $output = '<div class="bookmarks_container">';
         $query = qa_db_query_sub('SELECT title,postid FROM ^posts WHERE type=$ AND postid in (' . $bookmarks . ')', 'Q');
         $idx = 1;
         $bms = explode(',', $bookmarks);
         foreach ($bms as $qid) {
             $post = qa_db_select_with_pending(qa_db_full_post_selectspec(null, $qid));
             $title = $post['title'];
             $length = 60;
             $text = strlen($title) > $length ? substr($title, 0, $length) . '...' : $title;
             $output .= '<div class="bookmark-row" id="bookmark-row-' . $idx . '"><div class="bookmark-row-image bookmark" title="' . qa_html(qa_opt('bookmarks_plugin_unbookmark')) . '" onclick="ajaxBookmark(' . $qid . ',' . $uid . ',true,' . $idx++ . ')"></div><a href="' . qa_path_html(qa_q_request($qid, $title), NULL, qa_opt('site_url')) . '">' . qa_html($text) . '</a></div>';
         }
         $output .= '</div>';
         $fields['bookmarks'] = array('type' => 'static', 'label' => $output);
         $form = array('style' => 'tall', 'tags' => 'id="bookmarks_form"', 'title' => '<a id="bookmark_title">' . qa_opt('bookmarks_plugin_title') . '</a>', 'fields' => $fields);
         return $form;
     }
 }
开发者ID:NoahY,项目名称:q2a-bookmarks,代码行数:31,代码来源:qa-bookmarks-layer.php

示例11: ajaxCommentVote

 function ajaxCommentVote($vote, $postid)
 {
     global $topage, $qa_cookieid;
     $post = qa_db_select_with_pending(qa_db_full_post_selectspec($this->logged_in_userid, $postid));
     $voteerror = $this->comment_vote_error_html($post, $this->logged_in_userid, $topage);
     if ($voteerror === false) {
         $this->comment_vote_set($post, $this->logged_in_userid, qa_get_logged_in_handle(), $qa_cookieid, $vote);
         $comment = qa_db_single_select(qa_db_full_post_selectspec(null, $postid));
         $votes = $comment['netvotes'];
         $up_text = qa_lang_html('main/vote' . ($vote == 1 ? 'd' : '') . '_up_popup');
         $down_text = qa_lang_html('main/vote' . ($vote == -1 ? 'd' : '') . '_down_popup');
         echo '{"status":"1","data":"' . $votes . '","up":"' . $up_text . '","down":"' . $down_text . '"}';
     } else {
         echo '{"status":"0","data":"' . $voteerror . '"}';
     }
 }
开发者ID:neil-zeng,项目名称:q2a-comment-voting,代码行数:16,代码来源:qa-comment-voting-layer.php

示例12: qa_recalc_perform_step


//.........这里部分代码省略.........
            break;
        case 'dorecalccategories_postupdate':
            $postids = qa_db_posts_get_for_recategorizing($next, 100);
            if (count($postids)) {
                $lastpostid = max($postids);
                qa_db_posts_recalc_categoryid($next, $lastpostid);
                qa_db_posts_calc_category_path($next, $lastpostid);
                $next = 1 + $lastpostid;
                $done += count($postids);
                $continue = true;
            } else {
                qa_recalc_transition($state, 'dorecalccategories_recount');
            }
            break;
        case 'dorecalccategories_recount':
            $categoryids = qa_db_categories_get_for_recalcs($next, 10);
            if (count($categoryids)) {
                $lastcategoryid = max($categoryids);
                foreach ($categoryids as $categoryid) {
                    qa_db_ifcategory_qcount_update($categoryid);
                }
                $next = 1 + $lastcategoryid;
                $done += count($categoryids);
                $continue = true;
            } else {
                qa_recalc_transition($state, 'dorecalccategories_backpaths');
            }
            break;
        case 'dorecalccategories_backpaths':
            $categoryids = qa_db_categories_get_for_recalcs($next, 10);
            if (count($categoryids)) {
                $lastcategoryid = max($categoryids);
                qa_db_categories_recalc_backpaths($next, $lastcategoryid);
                $next = 1 + $lastcategoryid;
                $done += count($categoryids);
                $continue = true;
            } else {
                qa_recalc_transition($state, 'dorecalccategories_complete');
            }
            break;
        case 'dodeletehidden':
            qa_recalc_transition($state, 'dodeletehidden_comments');
            break;
        case 'dodeletehidden_comments':
            $posts = qa_db_posts_get_for_deleting('C', $next, 1);
            if (count($posts)) {
                $postid = $posts[0];
                $oldcomment = qa_db_single_select(qa_db_full_post_selectspec(null, $postid));
                $parent = qa_db_single_select(qa_db_full_post_selectspec(null, $oldcomment['parentid']));
                if ($parent['basetype'] == 'Q') {
                    $question = $parent;
                    $answer = null;
                } else {
                    $question = qa_db_single_select(qa_db_full_post_selectspec(null, $parent['parentid']));
                    $answer = $parent;
                }
                qa_comment_delete($oldcomment, $question, $answer, null, null, null);
                $next = 1 + $postid;
                $done++;
                $continue = true;
            } else {
                qa_recalc_transition($state, 'dodeletehidden_answers');
            }
            break;
        case 'dodeletehidden_answers':
            $posts = qa_db_posts_get_for_deleting('A', $next, 1);
            if (count($posts)) {
                $postid = $posts[0];
                $oldanswer = qa_db_single_select(qa_db_full_post_selectspec(null, $postid));
                $question = qa_db_single_select(qa_db_full_post_selectspec(null, $oldanswer['parentid']));
                qa_answer_delete($oldanswer, $question, null, null, null);
                $next = 1 + $postid;
                $done++;
                $continue = true;
            } else {
                qa_recalc_transition($state, 'dodeletehidden_questions');
            }
            break;
        case 'dodeletehidden_questions':
            $posts = qa_db_posts_get_for_deleting('Q', $next, 1);
            if (count($posts)) {
                $postid = $posts[0];
                $oldquestion = qa_db_single_select(qa_db_full_post_selectspec(null, $postid));
                qa_question_delete($oldquestion, null, null, null);
                $next = 1 + $postid;
                $done++;
                $continue = true;
            } else {
                qa_recalc_transition($state, 'dodeletehidden_complete');
            }
            break;
        default:
            $state = '';
            break;
    }
    if ($continue) {
        $state = $operation . ',' . $length . ',' . $next . ',' . $done;
    }
    return $continue && $done < $length;
}
开发者ID:TheProjecter,项目名称:microprobe,代码行数:101,代码来源:qa-app-recalc.php

示例13: qa_post_check_full

function qa_post_check_full($postid)
{
    $post = qa_db_single_select(qa_db_full_post_selectspec(null, $postid));
    return $post;
}
开发者ID:bafio89,项目名称:qea-u,代码行数:5,代码来源:posts.php

示例14: qa_question_set_hidden

function qa_question_set_hidden($oldquestion, $hidden, $userid, $handle, $cookieid, $answers, $commentsfollows, $closepost = null)
{
    require_once QA_INCLUDE_DIR . 'qa-app-format.php';
    require_once QA_INCLUDE_DIR . 'qa-app-updates.php';
    $wasqueued = $oldquestion['type'] == 'Q_QUEUED';
    qa_post_unindex($oldquestion['postid']);
    foreach ($answers as $answer) {
        qa_post_unindex($answer['postid']);
    }
    foreach ($commentsfollows as $comment) {
        if ($comment['basetype'] == 'C') {
            qa_post_unindex($comment['postid']);
        }
    }
    if (@$closepost['parentid'] == $oldquestion['postid']) {
        qa_post_unindex($closepost['postid']);
    }
    $setupdated = $hidden || !$wasqueued;
    // don't record approval of a post as an update action...
    qa_db_post_set_type($oldquestion['postid'], $hidden ? 'Q_HIDDEN' : 'Q', $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($oldquestion['postid'], null);
        qa_db_hotness_update($oldquestion['postid']);
    }
    qa_db_category_path_qcount_update(qa_db_post_get_category_path($oldquestion['postid']));
    qa_db_points_update_ifuser($oldquestion['userid'], array('qposts', 'aselects'));
    qa_db_qcount_update();
    qa_db_unaqcount_update();
    qa_db_unselqcount_update();
    qa_db_unupaqcount_update();
    if (!$hidden) {
        qa_post_index($oldquestion['postid'], 'Q', $oldquestion['postid'], $oldquestion['parentid'], $oldquestion['title'], $oldquestion['content'], $oldquestion['format'], qa_viewer_text($oldquestion['content'], $oldquestion['format']), $oldquestion['tags'], $oldquestion['categoryid']);
        foreach ($answers as $answer) {
            if ($answer['type'] == 'A') {
                // even if question visible, don't index hidden or queued answers
                qa_post_index($answer['postid'], $answer['type'], $oldquestion['postid'], $answer['parentid'], null, $answer['content'], $answer['format'], qa_viewer_text($answer['content'], $answer['format']), null, $answer['categoryid']);
            }
        }
        foreach ($commentsfollows as $comment) {
            if ($comment['type'] == 'C') {
                $answer = @$answers[$comment['parentid']];
                if (!isset($answer) || $answer['type'] == 'A') {
                    // don't index comment if it or its parent is hidden
                    qa_post_index($comment['postid'], $comment['type'], $oldquestion['postid'], $comment['parentid'], null, $comment['content'], $comment['format'], qa_viewer_text($comment['content'], $comment['format']), null, $comment['categoryid']);
                }
            }
        }
        if ($closepost['parentid'] == $oldquestion['postid']) {
            qa_post_index($closepost['postid'], $closepost['type'], $oldquestion['postid'], $closepost['parentid'], null, $closepost['content'], $closepost['format'], qa_viewer_text($closepost['content'], $closepost['format']), null, $closepost['categoryid']);
        }
    }
    qa_report_event($wasqueued ? $hidden ? 'q_reject' : 'q_approve' : ($hidden ? 'q_hide' : 'q_reshow'), $userid, $handle, $cookieid, array('postid' => $oldquestion['postid'], 'oldquestion' => $oldquestion));
    if ($wasqueued && !$hidden) {
        require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
        require_once QA_INCLUDE_DIR . 'qa-util-string.php';
        qa_report_event('q_post', $oldquestion['userid'], $oldquestion['handle'], $oldquestion['cookieid'], array('postid' => $oldquestion['postid'], 'parentid' => $oldquestion['parentid'], 'parent' => isset($oldquestion['parentid']) ? qa_db_single_select(qa_db_full_post_selectspec(null, $oldquestion['parentid'])) : null, 'title' => $oldquestion['title'], 'content' => $oldquestion['content'], 'format' => $oldquestion['format'], 'text' => qa_viewer_text($oldquestion['content'], $oldquestion['format']), 'tags' => $oldquestion['tags'], 'categoryid' => $oldquestion['categoryid'], 'notify' => isset($oldquestion['notify']), 'email' => qa_email_validate($oldquestion['notify']) ? $oldquestion['notify'] : null, 'delayed' => $oldquestion['created']));
    }
}
开发者ID:mathjoy,项目名称:math-duodaa,代码行数:59,代码来源:qa-app-post-update.php

示例15: qa_check_page_clicks

function qa_check_page_clicks()
{
    if (qa_to_override(__FUNCTION__)) {
        $args = func_get_args();
        return qa_call_override(__FUNCTION__, $args);
    }
    global $qa_page_error_html;
    if (qa_is_http_post()) {
        foreach ($_POST as $field => $value) {
            if (strpos($field, 'vote_') === 0) {
                // voting...
                @(list($dummy, $postid, $vote, $anchor) = explode('_', $field));
                if (isset($postid) && isset($vote)) {
                    if (!qa_check_form_security_code('vote', qa_post_text('code'))) {
                        $qa_page_error_html = qa_lang_html('misc/form_security_again');
                    } else {
                        require_once QA_INCLUDE_DIR . 'app/votes.php';
                        require_once QA_INCLUDE_DIR . 'db/selects.php';
                        $userid = qa_get_logged_in_userid();
                        $post = qa_db_select_with_pending(qa_db_full_post_selectspec($userid, $postid));
                        $qa_page_error_html = qa_vote_error_html($post, $vote, $userid, qa_request());
                        if (!$qa_page_error_html) {
                            qa_vote_set($post, $userid, qa_get_logged_in_handle(), qa_cookie_get(), $vote);
                            qa_redirect(qa_request(), $_GET, null, null, $anchor);
                        }
                        break;
                    }
                }
            } elseif (strpos($field, 'favorite_') === 0) {
                // favorites...
                @(list($dummy, $entitytype, $entityid, $favorite) = explode('_', $field));
                if (isset($entitytype) && isset($entityid) && isset($favorite)) {
                    if (!qa_check_form_security_code('favorite-' . $entitytype . '-' . $entityid, qa_post_text('code'))) {
                        $qa_page_error_html = qa_lang_html('misc/form_security_again');
                    } else {
                        require_once QA_INCLUDE_DIR . 'app/favorites.php';
                        qa_user_favorite_set(qa_get_logged_in_userid(), qa_get_logged_in_handle(), qa_cookie_get(), $entitytype, $entityid, $favorite);
                        qa_redirect(qa_request(), $_GET);
                    }
                }
            } elseif (strpos($field, 'notice_') === 0) {
                // notices...
                @(list($dummy, $noticeid) = explode('_', $field));
                if (isset($noticeid)) {
                    if (!qa_check_form_security_code('notice-' . $noticeid, qa_post_text('code'))) {
                        $qa_page_error_html = qa_lang_html('misc/form_security_again');
                    } else {
                        if ($noticeid == 'visitor') {
                            setcookie('qa_noticed', 1, time() + 86400 * 3650, '/', QA_COOKIE_DOMAIN);
                        } elseif ($noticeid == 'welcome') {
                            require_once QA_INCLUDE_DIR . 'db/users.php';
                            qa_db_user_set_flag(qa_get_logged_in_userid(), QA_USER_FLAGS_WELCOME_NOTICE, false);
                        } else {
                            require_once QA_INCLUDE_DIR . 'db/notices.php';
                            qa_db_usernotice_delete(qa_get_logged_in_userid(), $noticeid);
                        }
                        qa_redirect(qa_request(), $_GET);
                    }
                }
            }
        }
    }
}
开发者ID:Trideon,项目名称:gigolo,代码行数:63,代码来源:qa-page.php


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