本文整理汇总了PHP中qa_db_single_select函数的典型用法代码示例。如果您正苦于以下问题:PHP qa_db_single_select函数的具体用法?PHP qa_db_single_select怎么用?PHP qa_db_single_select使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qa_db_single_select函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: output_widget
public function output_widget($region, $place, $themeobject, $template, $request, $qa_content)
{
require_once QA_INCLUDE_DIR . 'db/selects.php';
$populartags = qa_db_single_select(qa_db_popular_tags_selectspec(0, (int) qa_opt('tag_cloud_count_tags')));
$maxcount = reset($populartags);
// $themeobject->output(sprintf('<h2 style="margin-top: 0; padding-top: 0;">%s</h2>', qa_lang_html('main/popular_tags')));
// $themeobject->output('<div style="font-size: 10px;">');
$themeobject->output(sprintf('<div class="panel panel-primary" style="padding: 0;"><div class="panel-heading"><h3 class="panel-title">%s</h3></div>', qa_lang_html('main/popular_tags')));
$themeobject->output('<div class="panel-body">');
$maxsize = qa_opt('tag_cloud_font_size');
$minsize = qa_opt('tag_cloud_minimal_font_size');
$scale = qa_opt('tag_cloud_size_popular');
$blockwordspreg = qa_get_block_words_preg();
foreach ($populartags as $tag => $count) {
$matches = qa_block_words_match_all($tag, $blockwordspreg);
if (empty($matches)) {
if ($scale) {
$size = number_format($maxsize * $count / $maxcount, 1);
if ($size < $minsize) {
$size = $minsize;
}
} else {
$size = $maxsize;
}
$themeobject->output(sprintf('<a href="%s" style="font-size: %dpx; vertical-align: baseline;">%s</a>', qa_path_html('tag/' . $tag), $size, qa_html($tag)));
}
}
// $themeobject->output('</div>');
$themeobject->output('</div></div>');
}
示例2: q_list_item
function q_list_item($q_item)
{
$userid = qa_get_logged_in_userid();
if (qa_opt('obvious_content_on') && $userid) {
require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
$fav_tags = qa_db_single_select(qa_db_user_favorite_tags_selectspec($userid));
foreach ($fav_tags as $k => $v) {
$tag[$k] = $v['word'];
}
$post_tags = explode(",", $q_item['raw']['tags']);
$result = array_diff($tag, $post_tags);
if (sizeof($result) != sizeof($tag) && $tag) {
@($q_item['classes'] .= " is_favorite");
}
}
if (qa_opt('obvious_content_category_on') && $userid) {
require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
$fav_cats = qa_db_single_select(qa_db_user_favorite_categories_selectspec($userid));
foreach ($fav_cats as $k => $v) {
$cat[$k] = $v['word'];
}
$post_cat = explode(",", $q_item['raw']['category']);
$result = array_diff($cat, $post_cat);
if (sizeof($result) != sizeof($cat) && $cat) {
@($q_item['classes'] .= " is_favorite_cat");
}
}
qa_html_theme_base::q_list_item($q_item);
// call back through to the default function
}
示例3: 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);
}
示例4: output_widget
function output_widget($region, $place, $themeobject, $template, $request, $qa_content)
{
require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
$populartags = qa_db_single_select(array('columns' => array('word' => 'BINARY word', 'tagcount'), 'source' => '^words JOIN (SELECT wordid FROM ^words WHERE tagcount>=# ORDER BY tagcount DESC LIMIT #,#) y ON ^words.wordid=y.wordid', 'arguments' => array((int) qa_opt('log_tag_cloud_min_count'), 0, (int) qa_opt('log_tag_cloud_count_tags')), 'arraykey' => 'word', 'arrayvalue' => 'tagcount', 'sortdesc' => 'tagcount'));
if (empty($populartags)) {
return false;
}
$maxsize = (int) qa_opt('log_tag_cloud_font_size');
$minsize = (int) qa_opt('log_tag_cloud_min_font_size');
$scale = qa_opt('log_tag_cloud_size_popular');
if ($scale) {
// convert from linear to log
$populartags = $this->FromParetoCurve($populartags, $minsize, $maxsize);
}
if (qa_opt('log_tag_cloud_sort_type') == 'alphabetical') {
// sort alphabetical
ksort($populartags);
}
if (qa_opt('log_tag_cloud_header') != '') {
$themeobject->output('<DIV CLASS="qa-nav-cat-list qa-nav-cat-link" STYLE="margin:0;">', qa_opt('log_tag_cloud_header'), '</DIV>');
}
$themeobject->output('<DIV STYLE="font-size:10px;">');
foreach ($populartags as $tag => $count) {
$size = number_format($scale ? $count : $maxsize, 1);
$themeobject->output('<A HREF="' . qa_path_html('tag/' . $tag) . '" STYLE="font-size:' . $size . 'px; vertical-align:baseline;">' . qa_html($tag) . '</A>');
}
$themeobject->output('</DIV>');
}
示例5: qa_create_event_for_category
function qa_create_event_for_category($categoryid, $questionid, $updatetype, $lastuserid, $timestamp = null)
{
if (isset($categoryid)) {
require_once QA_INCLUDE_DIR . 'db/selects.php';
require_once QA_INCLUDE_DIR . 'app/format.php';
$categories = qa_category_path(qa_db_single_select(qa_db_category_nav_selectspec($categoryid, true)), $categoryid);
foreach ($categories as $category) {
qa_db_event_create_for_entity(QA_ENTITY_CATEGORY, $category['categoryid'], $questionid, $questionid, $updatetype, $lastuserid, $timestamp);
}
}
}
示例6: getHandleFromId
function getHandleFromId($userid)
{
require_once QA_INCLUDE_DIR . 'qa-app-users.php';
if (QA_FINAL_EXTERNAL_USERS) {
$publictohandle = qa_get_public_from_userids(array($userid));
$handle = @$publictohandle[$userid];
} else {
$user = qa_db_single_select(qa_db_user_account_selectspec($userid, true));
$handle = @$user['handle'];
}
return $handle;
}
示例7: output_widget
function output_widget($region, $place, $themeobject, $template, $request, $qa_content)
{
require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
$favoritetags = qa_db_single_select(qa_db_user_favorite_tags_selectspec(qa_get_logged_in_userid()));
$themeobject->output('<span class="qa-nav-cat-list qa-nav-cat-link">Favorite Tags</span><br>');
foreach ($favoritetags as $k => $v) {
if ($k == qa_opt('obvious_max_tags')) {
break;
}
$tag = $v['word'];
$count = $v['tagcount'];
$question = $count > 1 ? 'questions' : 'question';
$themeobject->output('<a href="' . qa_path_html('tag/' . $tag) . '" class="qa-tag-link" title="Tagged in ' . $count . ' ' . $question . '">' . qa_html($tag) . '</a>');
}
}
示例8: output_widget
function output_widget($region, $place, $themeobject, $template, $request, $qa_content)
{
require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
$populartags = qa_db_single_select(qa_db_popular_tags_selectspec(0, (int) qa_opt('tag_cloud_count_tags')));
reset($populartags);
$maxcount = current($populartags);
$themeobject->output('<H2 STYLE="margin-top:0; padding-top:0;">', qa_lang_html('main/popular_tags'), '</H2>');
$themeobject->output('<DIV STYLE="font-size:10px;">');
$maxsize = qa_opt('tag_cloud_font_size');
$scale = qa_opt('tag_cloud_size_popular');
foreach ($populartags as $tag => $count) {
$size = number_format($scale ? $maxsize * $count / $maxcount : $maxsize, 1);
if ($size >= 5 || !$scale) {
$themeobject->output('<A HREF="' . qa_path_html('tag/' . $tag) . '" STYLE="font-size:' . $size . 'px; vertical-align:baseline;">' . qa_html($tag) . '</A>');
}
}
$themeobject->output('</DIV>');
}
示例9: output_widget
function output_widget($region, $place, $themeobject, $template, $request, $qa_content)
{
$widget_opt = @$themeobject->current_widget['param']['options'];
require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
if (@$qa_content['q_view']['raw']['type'] != 'Q') {
// question might not be visible, etc...
return;
}
$questionid = $qa_content['q_view']['raw']['postid'];
$userid = qa_get_logged_in_userid();
$cookieid = qa_cookie_get();
$questions = qa_db_single_select(qa_db_related_qs_selectspec($userid, $questionid, (int) $widget_opt['count']));
$minscore = qa_match_to_min_score(qa_opt('match_related_qs'));
foreach ($questions as $key => $question) {
if ($question['score'] < $minscore) {
unset($questions[$key]);
}
}
$titlehtml = qa_lang_html(count($questions) ? 'main/related_qs_title' : 'main/no_related_qs_title');
if (@$themeobject->current_widget['param']['locations']['show_title']) {
$themeobject->output('<h3 class="widget-title">' . qa_lang('cleanstrap/related_questions') . '</h3>');
}
$themeobject->output('<div class="ra-rq-widget">');
$themeobject->output('<ul>');
foreach ($questions as $p) {
$timeCode = qa_when_to_html($p['created'], 7);
$when = @$timeCode['prefix'] . @$timeCode['data'] . @$timeCode['suffix'];
$themeobject->output('<li>' . cs_get_post_avatar($p, $p['userid'], 30, true));
$themeobject->output('<div class="post-content">');
$themeobject->output('<a class="title" href="' . qa_q_path_html($p['postid'], $p['title']) . '">' . qa_html($p['title']) . '</a>');
$themeobject->output('<div class="meta">');
$themeobject->output('<span>' . qa_lang_sub('cleanstrap/x_answers', $p['acount']) . '</span>');
$themeobject->output('<span class="time icon-time">' . $when . '</span>');
$themeobject->output('<span class="vote-count icon-thumbs-up2">' . qa_lang_sub('cleanstrap/x_votes', $p['netvotes']) . '</span>');
$themeobject->output('</div>');
$themeobject->output('</div>');
$themeobject->output('</li>');
}
$themeobject->output('</ul>');
$themeobject->output('</div>');
}
示例10: output_widget
function output_widget($region, $place, $themeobject, $template, $request, $qa_content)
{
require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
$widget_opt = @$themeobject->current_widget['param']['options'];
if (@$themeobject->current_widget['param']['locations']['show_title']) {
$themeobject->output('<h3 class="widget-title">' . qa_lang('cleanstrap/tags') . '<a href="' . qa_path_html('tags') . '">' . qa_lang('cleanstrap/view_all') . '</a></h3>');
}
$to_show = (int) $widget_opt['cs_tags_count'];
$populartags = qa_db_single_select(qa_db_popular_tags_selectspec(0, !empty($to_show) ? $to_show : 20));
reset($populartags);
$themeobject->output('<div class="ra-tags-widget clearfix">');
$blockwordspreg = qa_get_block_words_preg();
foreach ($populartags as $tag => $count) {
if (count(qa_block_words_match_all($tag, $blockwordspreg))) {
continue;
}
// skip censored tags
$themeobject->output('<a href="' . qa_path_html('tag/' . $tag) . '" class="widget-tag">' . qa_html($tag) . '<span>' . $count . '</span></a>');
}
$themeobject->output('</div>');
}
示例11: output_widget
function output_widget($region, $place, $themeobject, $template, $request, $qa_content)
{
require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
$populartags = qa_db_single_select(qa_db_popular_tags_selectspec(0, (int) qa_opt('tag_cloud_count_tags')));
reset($populartags);
$maxcount = current($populartags);
$themeobject->output('<h2 style="margin-top:0; padding-top:0;">', qa_lang_html('main/popular_tags'), '</h2>');
$themeobject->output('<div style="font-size:10px;">');
$maxsize = qa_opt('tag_cloud_font_size');
$scale = qa_opt('tag_cloud_size_popular');
$blockwordspreg = qa_get_block_words_preg();
foreach ($populartags as $tag => $count) {
if (count(qa_block_words_match_all($tag, $blockwordspreg))) {
continue;
}
// skip censored tags
$size = number_format($scale ? $maxsize * $count / $maxcount : $maxsize, 1);
if ($size >= 5 || !$scale) {
$themeobject->output('<a href="' . qa_path_html('tag/' . $tag) . '" style="font-size:' . $size . 'px; vertical-align:baseline;">' . qa_html($tag) . '</a>');
}
}
$themeobject->output('</div>');
}
示例12: output_widget
function output_widget($region, $place, $themeobject, $template, $request, $qa_content)
{
require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
if (@$qa_content['q_view']['raw']['type'] != 'Q') {
// question might not be visible, etc...
return;
}
$questionid = $qa_content['q_view']['raw']['postid'];
$userid = qa_get_logged_in_userid();
$cookieid = qa_cookie_get();
$questions = qa_db_single_select(qa_db_related_qs_selectspec($userid, $questionid, qa_opt('page_size_related_qs')));
$minscore = qa_match_to_min_score(qa_opt('match_related_qs'));
foreach ($questions as $key => $question) {
if ($question['score'] < $minscore) {
unset($questions[$key]);
}
}
$titlehtml = qa_lang_html(count($questions) ? 'main/related_qs_title' : 'main/no_related_qs_title');
if ($region == 'side') {
$themeobject->output('<DIV CLASS="qa-related-qs">', '<H2 STYLE="margin-top:0; padding-top:0;">', $titlehtml, '</H2>');
$themeobject->output('<UL CLASS="qa-related-q-list">');
foreach ($questions as $question) {
$themeobject->output('<LI CLASS="qa-related-q-item"><A HREF="' . qa_q_path_html($question['postid'], $question['title']) . '">' . qa_html($question['title']) . '</A></LI>');
}
$themeobject->output('</UL>', '</DIV>');
} else {
$themeobject->output('<H2>', $titlehtml, '</H2>');
$q_list = array('form' => array('tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '"'), 'qs' => array());
$options = qa_post_html_defaults('Q');
$usershtml = qa_userids_handles_html($questions);
foreach ($questions as $question) {
$q_list['qs'][] = qa_post_html_fields($question, $userid, $cookieid, $usershtml, null, $options);
}
$themeobject->q_list_and_form($q_list);
}
}
示例13: output_widget
public function output_widget($region, $place, $themeobject, $template, $request, $qa_content)
{
require_once QA_INCLUDE_DIR . 'db/selects.php';
if (!isset($qa_content['q_view']['raw']['type']) || $qa_content['q_view']['raw']['type'] != 'Q') {
// question might not be visible, etc...
return;
}
$questionid = $qa_content['q_view']['raw']['postid'];
$userid = qa_get_logged_in_userid();
$cookieid = qa_cookie_get();
$questions = qa_db_single_select(qa_db_related_qs_selectspec($userid, $questionid, qa_opt('page_size_related_qs')));
$minscore = qa_match_to_min_score(qa_opt('match_related_qs'));
foreach ($questions as $key => $question) {
if ($question['score'] < $minscore) {
unset($questions[$key]);
}
}
$titlehtml = qa_lang_html(count($questions) ? 'main/related_qs_title' : 'main/no_related_qs_title');
if ($region == 'side') {
$themeobject->output('<div class="qa-related-qs">', '<h2 style="margin-top:0; padding-top:0;">', $titlehtml, '</h2>');
$themeobject->output('<ul class="qa-related-q-list">');
foreach ($questions as $question) {
$themeobject->output('<li class="qa-related-q-item">' . '<a href="' . qa_q_path_html($question['postid'], $question['title']) . '">' . qa_html($question['title']) . '</a>' . '</li>');
}
$themeobject->output('</ul>', '</div>');
} else {
$themeobject->output('<h2>', $titlehtml, '</h2>');
$q_list = array('form' => array('tags' => 'method="post" action="' . qa_self_html() . '"', 'hidden' => array('code' => qa_get_form_security_code('vote'))), 'qs' => array());
$defaults = qa_post_html_defaults('Q');
$usershtml = qa_userids_handles_html($questions);
foreach ($questions as $question) {
$q_list['qs'][] = qa_post_html_fields($question, $userid, $cookieid, $usershtml, null, qa_post_html_options($question, $defaults));
}
$themeobject->q_list_and_form($q_list);
}
}
示例14: qa_comment_set_status
function qa_comment_set_status($oldcomment, $status, $userid, $handle, $cookieid, $question, $parent)
{
require_once QA_INCLUDE_DIR . 'qa-app-format.php';
if (!isset($parent)) {
$parent = $question;
}
// for backwards compatibility with old answer parameter
$washidden = $oldcomment['type'] == 'C_HIDDEN';
$wasqueued = $oldcomment['type'] == 'C_QUEUED';
$wasrequeued = $wasqueued && isset($oldcomment['updated']);
qa_post_unindex($oldcomment['postid']);
$setupdated = false;
$event = null;
if ($status == QA_POST_STATUS_QUEUED) {
$newtype = 'C_QUEUED';
if (!$wasqueued) {
$event = 'c_requeue';
}
// same event whether it was hidden or shown before
} elseif ($status == QA_POST_STATUS_HIDDEN) {
$newtype = 'C_HIDDEN';
if (!$washidden) {
$event = $wasqueued ? 'c_reject' : 'c_hide';
if (!$wasqueued) {
$setupdated = true;
}
}
} elseif ($status == QA_POST_STATUS_NORMAL) {
$newtype = 'C';
if ($wasqueued) {
$event = 'c_approve';
} elseif ($washidden) {
$event = 'c_reshow';
$setupdated = true;
}
} else {
qa_fatal_error('Unknown status in qa_comment_set_status(): ' . $status);
}
qa_db_post_set_type($oldcomment['postid'], $newtype, $setupdated ? $userid : null, $setupdated ? qa_remote_ip_address() : null, QA_UPDATE_VISIBLE);
if ($wasqueued && $status == QA_POST_STATUS_NORMAL && qa_opt('moderate_update_time')) {
// ... for approval of a post, can set time to now instead
if ($wasrequeued) {
qa_db_post_set_updated($oldcomment['postid'], null);
} else {
qa_db_post_set_created($oldcomment['postid'], null);
}
}
qa_db_ccount_update();
qa_db_points_update_ifuser($oldcomment['userid'], array('cposts'));
if ($wasqueued || $status == QA_POST_STATUS_QUEUED) {
qa_db_queuedcount_update();
}
if ($oldcomment['flagcount']) {
qa_db_flaggedcount_update();
}
if ($question['type'] == 'Q' && ($parent['type'] == 'Q' || $parent['type'] == 'A') && $status == QA_POST_STATUS_NORMAL) {
// only index if none of the things it depends on are hidden or queued
qa_post_index($oldcomment['postid'], 'C', $question['postid'], $oldcomment['parentid'], null, $oldcomment['content'], $oldcomment['format'], qa_viewer_text($oldcomment['content'], $oldcomment['format']), null, $oldcomment['categoryid']);
}
$eventparams = array('postid' => $oldcomment['postid'], 'parentid' => $oldcomment['parentid'], 'parenttype' => $parent['basetype'], 'parent' => $parent, 'questionid' => $question['postid'], 'question' => $question, 'content' => $oldcomment['content'], 'format' => $oldcomment['format'], 'text' => qa_viewer_text($oldcomment['content'], $oldcomment['format']), 'categoryid' => $oldcomment['categoryid'], 'name' => $oldcomment['name']);
if (isset($event)) {
qa_report_event($event, $userid, $handle, $cookieid, $eventparams + array('oldcomment' => $oldcomment));
}
if ($wasqueued && $status == QA_POST_STATUS_NORMAL && !$wasrequeued) {
require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
require_once QA_INCLUDE_DIR . 'qa-util-string.php';
$commentsfollows = qa_db_single_select(qa_db_full_child_posts_selectspec(null, $oldcomment['parentid']));
$thread = array();
foreach ($commentsfollows as $comment) {
if ($comment['type'] == 'C' && $comment['parentid'] == $parent['postid']) {
$thread[] = $comment;
}
}
qa_report_event('c_post', $oldcomment['userid'], $oldcomment['handle'], $oldcomment['cookieid'], $eventparams + array('thread' => $thread, 'notify' => isset($oldcomment['notify']), 'email' => qa_email_validate($oldcomment['notify']) ? $oldcomment['notify'] : null, 'delayed' => $oldcomment['created']));
}
}
示例15: cs_tag_list
function cs_tag_list($limit = 20)
{
$populartags = qa_db_single_select(qa_db_popular_tags_selectspec(0, $limit));
$i = 1;
foreach ($populartags as $tag => $count) {
echo '<li><a class="icon-tag" href="' . qa_path_html('tag/' . $tag) . '">' . qa_html($tag) . '<span>' . filter_var($count, FILTER_SANITIZE_NUMBER_INT) . '</span></a></li>';
}
}