本文整理汇总了PHP中qa_db_single_select函数的典型用法代码示例。如果您正苦于以下问题:PHP qa_db_single_select函数的具体用法?PHP qa_db_single_select怎么用?PHP qa_db_single_select使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qa_db_single_select函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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>');
}
开发者ID:architbakliwal,项目名称:Q2A,代码行数:30,代码来源:qa-tag-cloud.php
示例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
}
开发者ID:roine,项目名称:roine-q2a-obvious-favorite,代码行数:30,代码来源:qa-obvious-layer.php
示例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);
}
开发者ID:NoahY,项目名称:q2a-privileges,代码行数:34,代码来源:qa-plugin.php
示例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>');
}
开发者ID:NoahY,项目名称:q2a-log-tags,代码行数:28,代码来源:qa-tag-cloud.php
示例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);
}
}
}
开发者ID:swuit,项目名称:swuit-q2a,代码行数:11,代码来源:events.php
示例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;
}
开发者ID:ruuttt,项目名称:question2answer_sandbox,代码行数:12,代码来源:qa-history-check.php
示例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>');
}
}
开发者ID:roine,项目名称:roine-q2a-obvious-favorite,代码行数:15,代码来源:qa-favorite-tags.php
示例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>');
}
开发者ID:ramo01,项目名称:1kapp,代码行数:18,代码来源:qa-tag-cloud.php
示例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>');
}
开发者ID:microbye,项目名称:CleanStrap,代码行数:41,代码来源:widget_related_questions.php
示例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>');
}
开发者ID:microbye,项目名称:CleanStrap,代码行数:21,代码来源:widget_tags.php
示例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>');
}
开发者ID:gogupe,项目名称:question2answer-releases,代码行数:23,代码来源:qa-tag-cloud.php
示例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);
}
}
开发者ID:mathjoy,项目名称:math-duodaa,代码行数:36,代码来源:qa-widget-related-qs.php
示例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);
}
}
开发者ID:swuit,项目名称:swuit-q2a,代码行数:36,代码来源:qa-widget-related-qs.php
示例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']));
}
}
开发者ID:gogupe,项目名称:question2answer-releases,代码行数:76,代码来源:qa-app-post-update.php
示例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>';
}
}
开发者ID:microbye,项目名称:CleanStrap,代码行数:8,代码来源:functions.php
示例16: qa_post_get_answer_commentsfollows
function qa_post_get_answer_commentsfollows($answerid)
{
$commentsfollows = array();
$childposts = qa_db_single_select(qa_db_full_child_posts_selectspec(null, $answerid));
foreach ($childposts as $postid => $post) {
if ($post['basetype'] == 'Q' || $post['basetype'] == 'C') {
$commentsfollows[$postid] = $post;
}
}
return $commentsfollows;
}
开发者ID:mathjoy,项目名称:math-duodaa,代码行数:11,代码来源:qa-app-posts.php
示例17: qa_load_modules_with
$listhtml = '';
$widgetmodules = qa_load_modules_with('widget', 'allow_template');
foreach ($widgetmodules as $tryname => $trywidget) {
if (method_exists($trywidget, 'allow_region')) {
$listhtml .= '<li><b>' . qa_html($tryname) . '</b>';
$listhtml .= strtr(qa_lang_html('admin/add_widget_link'), array('^1' => '<a href="' . qa_path_html('admin/layoutwidgets', array('title' => $tryname)) . '">', '^2' => '</a>'));
if (method_exists($trywidget, 'admin_form')) {
$listhtml .= strtr(qa_lang_html('admin/widget_global_options'), array('^1' => '<a href="' . qa_admin_module_options_path('widget', $tryname) . '">', '^2' => '</a>'));
}
$listhtml .= '</li>';
}
}
if (strlen($listhtml)) {
$qa_content['form']['fields']['plugins'] = array('label' => qa_lang_html('admin/widgets_explanation'), 'style' => 'tall', 'type' => 'custom', 'html' => '<ul style="margin-bottom:0;">' . $listhtml . '</ul>');
}
$widgets = qa_db_single_select(qa_db_widgets_selectspec());
$listhtml = '';
$placeoptions = qa_admin_place_options();
foreach ($widgets as $widget) {
$listhtml .= '<li><b>' . qa_html($widget['title']) . '</b> - ' . '<a href="' . qa_path_html('admin/layoutwidgets', array('edit' => $widget['widgetid'])) . '">' . @$placeoptions[$widget['place']] . '</a>';
$listhtml .= '</li>';
}
if (strlen($listhtml)) {
$qa_content['form']['fields']['widgets'] = array('label' => qa_lang_html('admin/active_widgets_explanation'), 'type' => 'custom', 'html' => '<ul style="margin-bottom:0;">' . $listhtml . '</ul>');
}
break;
case 'permissions':
$qa_content['form']['fields']['permit_block'] = array('type' => 'static', 'label' => qa_lang_html('options/permit_block'), 'value' => qa_lang_html('options/permit_moderators'));
if (!QA_FINAL_EXTERNAL_USERS) {
$qa_content['form']['fields']['permit_approve_users'] = array('type' => 'static', 'label' => qa_lang_html('options/permit_approve_users'), 'value' => qa_lang_html('options/permit_moderators'));
$qa_content['form']['fields']['permit_create_experts'] = array('type' => 'static', 'label' => qa_lang_html('options/permit_create_experts'), 'value' => qa_lang_html('options/permit_moderators'));
开发者ID:mostafiz93,项目名称:PrintfScanf,代码行数:31,代码来源:qa-page-admin-default.php
示例18: qa_post_text
$inslug = qa_post_text('slug');
if (!isset($inslug)) {
$inslug = implode('-', qa_string_to_words($inname));
}
break;
case 1:
$inslug = qa_lang_sub('admin/category_default_slug', $inslug);
break;
default:
$inslug = qa_lang_sub('admin/category_default_slug', $attempt - 1);
break;
}
$matchcategoryid = qa_db_category_slug_to_id($inparentid, $inslug);
// query against DB since MySQL ignores accents, etc...
if (!isset($inparentid)) {
$matchpage = qa_db_single_select(qa_db_page_full_selectspec($inslug, false));
} else {
$matchpage = null;
}
if (empty($inslug)) {
$errors['slug'] = qa_lang('main/field_required');
} elseif (qa_strlen($inslug) > QA_DB_MAX_CAT_PAGE_TAGS_LENGTH) {
$errors['slug'] = qa_lang_sub('main/max_length_x', QA_DB_MAX_CAT_PAGE_TAGS_LENGTH);
} elseif (preg_match('/[\\+\\/]/', $inslug)) {
$errors['slug'] = qa_lang_sub('admin/slug_bad_chars', '+ /');
} elseif (!isset($inparentid) && qa_admin_is_slug_reserved($inslug)) {
// only top level is a problem
$errors['slug'] = qa_lang('admin/slug_reserved');
} elseif (isset($matchcategoryid) && strcmp($matchcategoryid, @$editcategory['categoryid'])) {
$errors['slug'] = qa_lang('admin/category_already_used');
} elseif (isset($matchpage)) {
开发者ID:kosmoluna,项目名称:question2answer,代码行数:31,代码来源:admin-categories.php
示例19: 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
示例20: qa_comment_set_hidden
function qa_comment_set_hidden($oldcomment, $hidden, $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
$wasqueued = $oldcomment['type'] == 'C_QUEUED';
qa_post_unindex($oldcomment['postid']);
$setupdated = $hidden || !$wasqueued;
// don't record approval of a post as an update action...
qa_db_post_set_type($oldcomment['postid'], $hidden ? 'C_HIDDEN' : 'C', $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($oldcomment['postid'], null);
}
qa_db_points_update_ifuser($oldcomment['userid'], array('cposts'));
qa_db_ccount_update();
if ($question['type'] == 'Q' && ($parent['type'] == 'Q' || $parent['type'] == 'A') && !$hidden) {
// 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']);
}
qa_report_event($wasqueued ? $hidden ? 'c_reject' : 'c_approve' : ($hidden ? 'c_hide' : 'c_reshow'), $userid, $handle, $cookieid, array('postid' => $oldcomment['postid'], 'parentid' => $oldcomment['parentid'], 'oldcomment' => $oldcomment, 'parenttype' => $parent['basetype'], 'questionid' => $question['postid']));
if ($wasqueued && !$hidden) {
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'], array('postid' => $oldcomment['postid'], 'parentid' => $oldcomment['parentid'], 'parenttype' => $parent['basetype'], 'parent' => $parent, 'questionid' => $question['postid'], 'question' => $question, 'thread' => $thread, 'content' => $oldcomment['content'], 'format' => $oldcomment['format'], 'text' => qa_viewer_text($oldcomment['content'], $oldcomment['format']), 'categoryid' => $oldcomment['categoryid'], 'notify' => isset($oldcomment['notify']), 'email' => qa_email_validate($oldcomment['notify']) ? $oldcomment['notify'] : null, 'delayed' => $oldcomment['created']));
}
}
开发者ID:mathjoy,项目名称:math-duodaa,代码行数:36,代码来源:qa-app-post-update.php
注:本文中的qa_db_single_select函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论