本文整理汇总了PHP中qa_db_select_with_pending函数的典型用法代码示例。如果您正苦于以下问题:PHP qa_db_select_with_pending函数的具体用法?PHP qa_db_select_with_pending怎么用?PHP qa_db_select_with_pending使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qa_db_select_with_pending函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: ami_dhp_delete_hidden_posts_process
/**
* Process the delete hidden posts request from the admin
*/
function ami_dhp_delete_hidden_posts_process()
{
// load all required files if not loaded
require_once QA_INCLUDE_DIR . 'qa-app-admin.php';
require_once QA_INCLUDE_DIR . 'qa-db-admin.php';
require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
require_once QA_INCLUDE_DIR . 'qa-app-format.php';
// Check admin privileges
if (qa_user_maximum_permit_error('permit_hide_show') && qa_user_maximum_permit_error('permit_delete_hidden')) {
return false;
}
$userid = qa_get_logged_in_userid();
// Find recently hidden questions, answers, comments
list($hiddenquestions, $hiddenanswers, $hiddencomments) = qa_db_select_with_pending(qa_db_qs_selectspec($userid, 'created', 0, null, null, 'Q_HIDDEN', true), qa_db_recent_a_qs_selectspec($userid, 0, null, null, 'A_HIDDEN', true), qa_db_recent_c_qs_selectspec($userid, 0, null, null, 'C_HIDDEN', true));
// first delete all hidden posts
if (count($hiddencomments)) {
foreach ($hiddencomments as $hiddencomment) {
ami_dhp_post_delete_recursive($hiddencomment['opostid']);
}
}
// delete all the hidden answers
if (count($hiddenanswers)) {
foreach ($hiddenanswers as $hiddenanswer) {
ami_dhp_post_delete_recursive($hiddenanswer['opostid']);
}
}
// delete all the hidden questions
if (count($hiddenquestions)) {
foreach ($hiddenquestions as $hiddenquestion) {
ami_dhp_post_delete_recursive($hiddenquestion['postid']);
}
}
}
开发者ID:aunna77doe,项目名称:q2a-delete-hidden-posts,代码行数:36,代码来源:qa-dhp-utils.php
示例3: 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';
require_once QA_INCLUDE_DIR . 'qa-app-format.php';
require_once QA_INCLUDE_DIR . 'qa-app-q-list.php';
$categoryslugs = '';
$userid = qa_get_logged_in_userid();
// Get lists of recent activity in all its forms, plus category information
list($questions1, $questions2, $questions3, $questions4) = qa_db_select_with_pending(qa_db_qs_selectspec($userid, 'created', 0, $categoryslugs, null, false, false, $qcount), qa_db_recent_a_qs_selectspec($userid, 0, $categoryslugs), qa_db_recent_c_qs_selectspec($userid, 0, $categoryslugs), qa_db_recent_edit_qs_selectspec($userid, 0, $categoryslugs));
// Prepare and return content for theme
$content = qa_q_list_page_content(qa_any_sort_and_dedupe(array_merge($questions1, $questions2, $questions3, $questions4)), $qcount, 0, null, null, null, null, null, true, 'activity/', null, null, null, null);
$content = $content['q_list']['qs'];
if (@$themeobject->current_widget['param']['locations']['show_title']) {
$themeobject->output('<h3 class="widget-title">' . qa_lang('cleanstrap/recent_activities') . ' <a href="' . qa_path_html('activity') . '">' . qa_lang('cleanstrap/view_all') . '</a></h3>');
}
$themeobject->output('<div class="ra-question-activity-widget">');
$q_list = $content;
$themeobject->output('<ul class="activity-list">');
foreach ($q_list as $list) {
$themeobject->output('<li class="clearfix ' . (is_featured($list['raw']['postid']) ? ' featured' : '') . '"><span class="fav-star icon-heart' . (@$list['raw']['userfavoriteq'] ? ' active' : '') . '"></span><span class="post-status-c">' . cs_post_status($list) . '</span><a href="' . $list['url'] . '">' . $list['title'] . '<span class="time">' . implode(' ', $list['when']) . '</span><span class="ans-count total-' . $list['raw']['acount'] . '">' . $list['raw']['acount'] . '</span></a></li>');
}
$themeobject->output('</ul>');
$themeobject->output('</div>');
}
开发者ID:microbye,项目名称:CleanStrap,代码行数:25,代码来源:widget_question_activity.php
示例4: qa_get_options
function qa_get_options($names)
{
global $qa_options_cache, $qa_options_loaded;
// If any options not cached, retrieve them from database via standard pending mechanism
if (!@$qa_options_loaded) {
require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
qa_db_select_with_pending();
}
// Pull out the options specifically requested here, and assign defaults
$options = array();
foreach ($names as $name) {
if (!isset($qa_options_cache[$name])) {
$todatabase = true;
switch ($name) {
// don't write default to database if option was deprecated, or depends on site language (which could be changed)
case 'custom_sidebar':
case 'site_title':
case 'email_privacy':
case 'answer_needs_login':
case 'ask_needs_login':
case 'comment_needs_login':
case 'db_time':
$todatabase = false;
break;
}
qa_set_option($name, qa_default_option($name), $todatabase);
}
$options[$name] = $qa_options_cache[$name];
}
return $options;
}
开发者ID:TheProjecter,项目名称:microprobe,代码行数:31,代码来源:qa-app-options.php
示例5: admin_form
function admin_form(&$qa_content)
{
// process config change
$saved_msg = '';
if (qa_clicked('tag_synonyms_save_button')) {
qa_opt('tag_synonyms', trim(qa_post_text('tag_synonyms_text')));
qa_opt('tag_synonyms_prevent', (int) qa_post_text('tag_synonyms_prevent'));
qa_opt('tag_synonyms_rep', (int) qa_post_text('tag_synonyms_rep'));
$saved_msg = 'Tag Synonyms settings saved';
// convert all old tags based on synonyms
if (qa_post_text('tag_synonyms_convert')) {
$synonyms = $this->_synonyms_to_array(qa_opt('tag_synonyms'));
$edited = 0;
qa_suspend_event_reports(true);
// avoid infinite loop
foreach ($synonyms as $syn) {
list($questions, $qcount) = qa_db_select_with_pending(qa_db_tag_recent_qs_selectspec(null, $syn['from'], 0, false, 500), qa_db_tag_count_qs_selectspec($syn['from']));
foreach ($questions as $q) {
$oldtags = qa_tagstring_to_tags($q['tags']);
$newtags = $this->_convert_tags($oldtags, $synonyms);
qa_post_set_content($q['postid'], null, null, null, $newtags);
$edited++;
}
}
qa_suspend_event_reports(false);
$saved_msg .= ' (and ' . $edited . ' tags edited)';
}
}
// set fields to show/hide when checkbox is clicked
qa_set_display_rules($qa_content, array('tag_synonyms_rep' => 'tag_synonyms_prevent'));
return array('ok' => $saved_msg, 'fields' => array(array('label' => 'Tag Synonyms', 'tags' => 'name="tag_synonyms_text" id="tag_synonyms_text"', 'value' => qa_opt('tag_synonyms'), 'type' => 'textarea', 'rows' => 20, 'note' => 'Put each pair of synonyms on a new line. <code>q2a,question2answer</code> means that a tag of <code>q2a</code> will be replaced by <code>question2answer</code>, while <code>help</code> on its own means that tag will be removed.'), array('label' => 'Also convert existing tags using above rules', 'tags' => 'name="tag_synonyms_convert" id="tag_synonyms_convert"', 'value' => '', 'type' => 'checkbox'), array('type' => 'blank'), array('label' => 'Prevent new users from creating new tags', 'tags' => 'name="tag_synonyms_prevent" id="tag_synonyms_prevent"', 'value' => qa_opt('tag_synonyms_prevent'), 'type' => 'checkbox'), array('id' => 'tag_synonyms_rep', 'label' => 'Minimum reputation to create new tags', 'value' => qa_opt('tag_synonyms_rep'), 'tags' => 'name="tag_synonyms_rep"', 'type' => 'number')), 'buttons' => array(array('label' => 'Save Changes', 'tags' => 'name="tag_synonyms_save_button"')));
}
开发者ID:NoahY,项目名称:Q2A-Tag-Synonyms,代码行数:32,代码来源:qa-tag-synonyms.php
示例6: qa_get_user_avatar_html
function qa_get_user_avatar_html($flags, $email, $handle, $blobid, $width, $height, $size, $padding = false)
{
if (qa_opt('avatar_allow_gravatar') && $flags & QA_USER_FLAGS_SHOW_GRAVATAR) {
$html = qa_get_gravatar_html($email, $size);
} elseif (qa_opt('avatar_allow_upload') && $flags & QA_USER_FLAGS_SHOW_AVATAR) {
if (isset($blobid)) {
$html = qa_get_avatar_blob_html($blobid, $width, $height, $size, $padding);
} elseif (strlen($handle)) {
$userprofile = qa_db_select_with_pending(qa_db_user_profile_selectspec($handle, false));
if (!empty($userprofile['social_avatar'])) {
$html = '<img src="' . $userprofile['social_avatar'] . '" width="' . $size . '" height="' . $size . '" class="qa-avatar-image" />';
} else {
$html = null;
}
}
}
if (!isset($html)) {
if ((qa_opt('avatar_allow_gravatar') || qa_opt('avatar_allow_upload')) && qa_opt('avatar_default_show') && strlen(qa_opt('avatar_default_blobid'))) {
$html = qa_get_avatar_blob_html(qa_opt('avatar_default_blobid'), qa_opt('avatar_default_width'), qa_opt('avatar_default_height'), $size, $padding);
} else {
$html = null;
}
}
return isset($html) && strlen($handle) ? '<A HREF="' . qa_path_html('user/' . $handle) . '" CLASS="qa-avatar-link">' . $html . '</A>' : $html;
}
开发者ID:swuit,项目名称:swuit-q2a,代码行数:25,代码来源:override-function.php
示例7: check_privileges
function check_privileges($userid, $event_points)
{
$user = qa_db_select_with_pending(qa_db_user_points_selectspec($userid, true));
$upoints = (int) $user['points'];
$before_points = (int) $user['points'] - $event_points;
$permr = qa_db_read_one_value(qa_db_query_sub('SELECT meta_value FROM ^usermeta WHERE user_id=# AND meta_key=$ ', $userid, 'priv_notify'), true);
// stale perms
$stale = array();
if ($permr) {
$perms = explode('^', $permr);
$stale = explode(',', $perms[0]);
}
$p_options = qa_get_permit_options();
$notices = '';
foreach ($p_options as $option) {
if (qa_opt($option) == QA_PERMIT_POINTS) {
$opoints = (int) qa_opt($option . '_points');
if ($opoints < $upoints && $opoints > $before_points && !in_array($option, $stale)) {
$notices = ($notices ? $notices . ',' : '') . $option;
}
}
}
if ($notices) {
qa_db_query_sub('INSERT INTO ^usermeta (user_id,meta_key,meta_value) VALUES (#,$,$) ON DUPLICATE KEY UPDATE meta_value=$', $userid, 'priv_notify', '^' . $notices, $permr . ($perms[1] ? ',' : '') . $notices);
if (qa_opt('priv_email_notify_on')) {
$this->notify($userid, $notices);
}
}
}
开发者ID:ruuttt,项目名称:question2answer_sandbox,代码行数:29,代码来源:qa-priv-check.php
示例8: output_widget
function output_widget($region, $place, $themeobject, $template, $request, $qa_content)
{
/*
$requestparts=qa_request_parts();
$requestlower=strtolower(qa_request());
$firstlower=strtolower($requestparts[0]);
$routing=qa_page_routing();
// unanswered & questions pages may contain categories.
unset($routing['activity/']);
unset($routing['unanswered/']);
unset($routing['questions/']);
if ( (isset($routing[$requestlower])) or (isset($routing[$firstlower.'/'])) or (is_numeric($requestparts[0])) )
return;
$explicitqa=(strtolower($requestparts[0])=='qa' or strtolower($requestparts[0])=='unanswered' or strtolower($requestparts[0])=='questions' or strtolower($requestparts[0])=='activity');
if ($explicitqa)
$slugs=array_slice($requestparts, 1);
elseif (strlen($requestparts[0]))
$slugs=$requestparts;
else
$slugs=array();
*/
$slugs = useo_get_current_category_slug();
$countslugs = count($slugs);
list($categories, $categoryid) = qa_db_select_with_pending(qa_db_category_nav_selectspec($slugs, false, false, true), $countslugs ? qa_db_slugs_to_category_id_selectspec($slugs) : null);
if ($countslugs && isset($categoryid)) {
/*
$categoryid is current categories ID
$backpath = implode('/', array_reverse($slugs));
echo "countslugs: <pre>"; var_dump($countslugs); echo "</pre>";
$fullcategory=qa_db_select_with_pending(qa_db_full_category_selectspec($categoryid, true));
echo "fullcategory: <pre>"; var_dump($fullcategory); echo "</pre>";
echo "categoryid: <pre>"; var_dump($categoryid); echo "</pre>";
echo "slugs: <pre>"; var_dump($slugs); echo "</pre>";
echo "template: <pre>"; var_dump($template); echo "</pre>";
echo "request: <pre>"; var_dump($request); echo "</pre>";
*/
require_once QA_INCLUDE_DIR . 'qa-db-metas.php';
$description = qa_db_categorymeta_get($categoryid, 'useo_cat_description');
if (!qa_opt('useo_cat_desc_format')) {
$description = qa_html($description);
}
$editurlhtml = qa_path_html('category-edit/' . $categoryid);
$allowediting = !qa_user_permit_error('useo_cat_desc_permit_edit');
if (strlen($description)) {
echo '<SPAN CLASS="entry-content qa-category-description">';
echo $description;
echo '</SPAN>';
if ($allowediting) {
echo ' - <A HREF="' . $editurlhtml . '">edit</A>';
}
} elseif ($allowediting) {
echo '<A HREF="' . $editurlhtml . '">' . qa_lang_html('useo/create_desc_link') . '</A>';
}
}
}
开发者ID:Kailashaghera,项目名称:Q2A-Ultimate-SEO,代码行数:58,代码来源:category-widget.php
示例9: getEmail
function getEmail($userid)
{
require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
if (QA_FINAL_EXTERNAL_USERS) {
$email = qa_get_user_email($userid);
} else {
$useraccount = qa_db_select_with_pending(qa_db_user_account_selectspec($userid, true));
$email = @$useraccount['email'];
}
return $email;
}
开发者ID:ruuttt,项目名称:question2answer_sandbox,代码行数:11,代码来源:qa-news-layer.php
示例10: qa_feed_load_ifcategory
function qa_feed_load_ifcategory($categoryslugs, $allkey, $catkey, &$title, $questionselectspec1 = null, $questionselectspec2 = null, $questionselectspec3 = null, $questionselectspec4 = null)
{
$countslugs = @count($categoryslugs);
list($questions1, $questions2, $questions3, $questions4, $categories, $categoryid) = qa_db_select_with_pending($questionselectspec1, $questionselectspec2, $questionselectspec3, $questionselectspec4, $countslugs ? qa_db_category_nav_selectspec($categoryslugs, false) : null, $countslugs ? qa_db_slugs_to_category_id_selectspec($categoryslugs) : null);
if ($countslugs && !isset($categoryid)) {
qa_feed_not_found();
}
if (isset($allkey)) {
$title = isset($categoryid) && isset($catkey) ? qa_lang_sub($catkey, $categories[$categoryid]['title']) : qa_lang($allkey);
}
return array_merge(is_array($questions1) ? $questions1 : array(), is_array($questions2) ? $questions2 : array(), is_array($questions3) ? $questions3 : array(), is_array($questions4) ? $questions4 : array());
}
开发者ID:swuit,项目名称:swuit-q2a,代码行数:12,代码来源:qa-feed.php
示例11: qa_db_get_pending_result
function qa_db_get_pending_result($pendingid, $selectspec = null)
{
global $qa_db_pending_selectspecs, $qa_db_pending_results;
if (isset($selectspec)) {
qa_db_queue_pending_select($pendingid, $selectspec);
} elseif (!isset($qa_db_pending_selectspecs[$pendingid])) {
qa_fatal_error('Pending query was never set up: ' . $pendingid);
}
if (!isset($qa_db_pending_results[$pendingid])) {
qa_db_select_with_pending();
}
return $qa_db_pending_results[$pendingid];
}
开发者ID:netham91,项目名称:question2answer,代码行数:13,代码来源:qa-db-selects.php
示例12: process_request
function process_request($request)
{
// Get list of unanswered open questions
$userid = qa_get_logged_in_userid();
$start = qa_get_start();
$questions_selectspec = $this->qa_db_open_qs_selectspec($userid, $start);
$questions = qa_db_select_with_pending($questions_selectspec);
// Prepare and return the content for the theme
$questions_found_title = qa_lang_html('open_questions/questions_found_title');
$no_questions_title = qa_lang_html('open_questions/no_questions_title');
$count = qa_opt('cache_unaqcount');
$qa_content = qa_q_list_page_content($questions, qa_opt('page_size_una_qs'), $start, @$count, $questions_found_title, $no_questions_title, null, null, false, null, null, qa_html_suggest_qs_tags(qa_using_tags()), null, null);
return $qa_content;
}
开发者ID:nakov,项目名称:q2a-plugin-open-questions,代码行数:14,代码来源:qa-open-questions.php
示例13: qa_send_notification
function qa_send_notification($userid, $email, $handle, $subject, $body, $subs, $html = false)
{
if (qa_to_override(__FUNCTION__)) {
$args = func_get_args();
return qa_call_override(__FUNCTION__, $args);
}
global $qa_notifications_suspended;
if ($qa_notifications_suspended > 0) {
return false;
}
require_once QA_INCLUDE_DIR . 'db/selects.php';
require_once QA_INCLUDE_DIR . 'util/string.php';
if (isset($userid)) {
$needemail = !qa_email_validate(@$email);
// take from user if invalid, e.g. @ used in practice
$needhandle = empty($handle);
if ($needemail || $needhandle) {
if (QA_FINAL_EXTERNAL_USERS) {
if ($needhandle) {
$handles = qa_get_public_from_userids(array($userid));
$handle = @$handles[$userid];
}
if ($needemail) {
$email = qa_get_user_email($userid);
}
} else {
$useraccount = qa_db_select_with_pending(array('columns' => array('email', 'handle'), 'source' => '^users WHERE userid = #', 'arguments' => array($userid), 'single' => true));
if ($needhandle) {
$handle = @$useraccount['handle'];
}
if ($needemail) {
$email = @$useraccount['email'];
}
}
}
}
if (isset($email) && qa_email_validate($email)) {
$subs['^site_title'] = qa_opt('site_title');
$subs['^handle'] = $handle;
$subs['^email'] = $email;
$subs['^open'] = "\n";
$subs['^close'] = "\n";
return qa_send_email(array('fromemail' => qa_opt('from_email'), 'fromname' => qa_opt('site_title'), 'toemail' => $email, 'toname' => $handle, 'subject' => strtr($subject, $subs), 'body' => (empty($handle) ? '' : qa_lang_sub('emails/to_handle_prefix', $handle)) . strtr($body, $subs), 'html' => $html));
} else {
return false;
}
}
开发者ID:kosmoluna,项目名称:question2answer,代码行数:47,代码来源:emails.php
示例14: process_request
function process_request($request)
{
require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
require_once QA_INCLUDE_DIR . 'qa-app-format.php';
require_once QA_INCLUDE_DIR . 'qa-app-q-list.php';
// Get list of questions, plus category information
$nonetitle = qa_lang_html('main/no_questions_found');
$categorypathprefix = null;
// only show category list and feed when sorting by date
$feedpathprefix = null;
$selectspec = array('columns' => array('^posts.postid', '^posts.categoryid', '^posts.type', 'basetype' => 'LEFT(^posts.type,1)', 'hidden' => "INSTR(^posts.type, '_HIDDEN')>0", '^posts.acount', '^posts.selchildid', '^posts.upvotes', '^posts.downvotes', '^posts.netvotes', '^posts.views', '^posts.hotness', '^posts.flagcount', 'title' => 'BINARY ^posts.title', 'tags' => 'BINARY ^posts.tags', 'created' => 'UNIX_TIMESTAMP(^posts.created)', 'categoryname' => 'BINARY ^categories.title', 'categorybackpath' => "BINARY ^categories.backpath"), 'arraykey' => 'postid', 'source' => '^posts LEFT JOIN ^categories ON ^categories.categoryid=^posts.categoryid JOIN ^postmeta ON ^posts.postid=^postmeta.post_id AND ^postmeta.meta_key=$ AND ^postmeta.meta_value>0 AND ^posts.type=$', 'arguments' => array('is_poll', 'Q'));
$selectspec['columns']['content'] = '^posts.content';
$selectspec['columns']['notify'] = '^posts.notify';
$selectspec['columns']['updated'] = 'UNIX_TIMESTAMP(^posts.updated)';
$selectspec['columns']['updatetype'] = '^posts.updatetype';
$selectspec['columns'][] = '^posts.format';
$selectspec['columns'][] = '^posts.lastuserid';
$selectspec['columns']['lastip'] = 'INET_NTOA(^posts.lastip)';
$selectspec['columns'][] = '^posts.parentid';
$selectspec['columns']['lastviewip'] = 'INET_NTOA(^posts.lastviewip)';
$selectspec['columns'][] = '^posts.userid';
$selectspec['columns'][] = '^posts.cookieid';
$selectspec['columns']['createip'] = 'INET_NTOA(^posts.createip)';
$selectspec['columns'][] = '^userpoints.points';
if (!QA_FINAL_EXTERNAL_USERS) {
$selectspec['columns'][] = '^users.flags';
$selectspec['columns'][] = '^users.level';
$selectspec['columns']['email'] = 'BINARY ^users.email';
$selectspec['columns']['handle'] = 'CONVERT(^users.handle USING BINARY)';
// because of MySQL bug #29205
$selectspec['columns'][] = '^users.avatarblobid';
$selectspec['columns'][] = '^users.avatarwidth';
$selectspec['columns'][] = '^users.avatarheight';
$selectspec['source'] .= ' LEFT JOIN ^users ON ^posts.userid=^users.userid';
$selectspec['columns']['lasthandle'] = 'CONVERT(lastusers.handle USING BINARY)';
// because of MySQL bug #29205
$selectspec['source'] .= ' LEFT JOIN ^users AS lastusers ON ^posts.lastuserid=lastusers.userid';
}
$selectspec['source'] .= ' LEFT JOIN ^userpoints ON ^posts.userid=^userpoints.userid';
$selectspec['source'] .= ' ORDER BY ^posts.created DESC';
$questions = qa_db_select_with_pending($selectspec);
global $qa_start;
// Prepare and return content for theme
$qa_content = qa_q_list_page_content($questions, qa_opt('page_size_qs'), $qa_start, count($questions), qa_lang('polls/page_title'), $nonetitle, null, null, false, null, null, null, null);
return $qa_content;
}
开发者ID:NoahY,项目名称:q2a-poll,代码行数:46,代码来源:qa-poll-page.php
示例15: qa_complete_reset_user
function qa_complete_reset_user($userid)
{
require_once QA_INCLUDE_DIR . 'qa-util-string.php';
require_once QA_INCLUDE_DIR . 'qa-app-options.php';
require_once QA_INCLUDE_DIR . 'qa-app-emails.php';
require_once QA_INCLUDE_DIR . 'qa-app-cookies.php';
require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
$password = qa_random_alphanum(max(QA_MIN_PASSWORD_LEN, QA_NEW_PASSWORD_LEN));
$userinfo = qa_db_select_with_pending(qa_db_user_account_selectspec($userid, true));
if (!qw_send_notification($userid, $userinfo['email'], $userinfo['handle'], qa_lang('emails/new_password_subject'), nl2br(qa_lang('emails/new_password_body')), array('^password' => $password, '^url' => qa_opt('site_url')))) {
qa_fatal_error('Could not send new password - password not reset');
}
qa_db_user_set_password($userid, $password);
// do this last, to be safe
qa_db_user_set($userid, 'emailcode', '');
// so can't be reused
qa_report_event('u_reset', $userid, $userinfo['handle'], qa_cookie_get(), array('email' => $userinfo['email']));
}
开发者ID:rahularyan,项目名称:dude-theme,代码行数:18,代码来源:overrides.php
示例16: get_qa_avartar_html
function get_qa_avartar_html($user, $size = 200)
{
$userid_array = qa_handles_to_userids(array($user));
$userid = $userid_array[$user];
$useraccount = qa_db_select_with_pending(qa_db_user_account_selectspec($userid, true));
$avartahtml = qa_get_user_avatar_html($useraccount['flags'], $useraccount['email'], $useraccount['handle'], $useraccount['avatarblobid'], $useraccount['avatarwidth'], $useraccount['avatarheight'], qa_opt('avatar_profile_size'));
$avartahtml = strtolower($avartahtml);
if ($avartahtml != null) {
$avartahtml = strtolower($avartahtml);
$avartahtml = str_replace('?', '\\?', $avartahtml);
//生成avarta的html串,从站点的根目录引用
} else {
$avartahtml = '<a href="' . $this->config->item('qaroot_src') . '?qa=user/' . $user . '" class="qa-user-link">';
$avartahtml .= '<img src="' . base_url($this->config->item('app_src')) . '/views/theme/' . $this->config->item('theme') . '/img/default_avatar.jpg' . '"/>';
$avartahtml .= '</a>';
}
return $avartahtml;
}
开发者ID:mathjoy,项目名称:math-duodaa,代码行数:18,代码来源:user_model.php
示例17: qa_send_notification
function qa_send_notification($userid, $email, $handle, $subject, $body, $subs)
{
global $qa_notifications_suspended;
if ($qa_notifications_suspended > 0) {
return false;
}
require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
require_once QA_INCLUDE_DIR . 'qa-util-emailer.php';
require_once QA_INCLUDE_DIR . 'qa-util-string.php';
if (isset($userid)) {
$needemail = !qa_email_validate(@$email);
// take from user if invalid, e.g. @ used in practice
$needhandle = empty($handle);
if ($needemail || $needhandle) {
if (QA_FINAL_EXTERNAL_USERS) {
if ($needhandle) {
$handles = qa_get_public_from_userids(array($userid));
$handle = @$handles[$userid];
}
if ($needemail) {
$email = qa_get_user_email($userid);
}
} else {
$useraccount = qa_db_select_with_pending(qa_db_user_account_selectspec($userid, true));
if ($needhandle) {
$handle = @$useraccount['handle'];
}
if ($needemail) {
$email = @$useraccount['email'];
}
}
}
}
if (isset($email) && qa_email_validate($email)) {
$subs['^site_title'] = qa_opt('site_title');
$subs['^handle'] = $handle;
$subs['^email'] = $email;
$subs['^open'] = "\n";
$subs['^close'] = "\n";
return qa_send_email(array('fromemail' => qa_opt('from_email'), 'fromname' => qa_opt('site_title'), 'toemail' => $email, 'toname' => $handle, 'subject' => strtr($subject, $subs), 'body' => (empty($handle) ? '' : $handle . ",\n\n") . strtr($body, $subs), 'html' => false));
} else {
return false;
}
}
开发者ID:TheProjecter,项目名称:microprobe,代码行数:44,代码来源:qa-app-emails.php
示例18: sendNewConfirm
function sendNewConfirm($userid)
{
require_once QA_INCLUDE_DIR . 'db/users.php';
require_once QA_INCLUDE_DIR . 'db/selects.php';
require_once QA_INCLUDE_DIR . 'app/emails.php';
$userinfo = qa_db_select_with_pending(qa_db_user_account_selectspec($userid, true));
if (!qa_send_notification($userid, $userinfo['email'], $userinfo['handle'], qa_lang('emails/confirm_subject'), qa_lang('emails/confirm_body'), array('^url' => getNewConfirmUrl($userid, $userinfo['handle'])))) {
qa_fatal_error('Could not send email confirmation');
}
// $userinfo=qa_db_select_with_pending(qa_db_user_account_selectspec($userid, true));
// $params = array();
// $params['fromemail'] = qa_opt('from_email'),
// $params['fromname'] = qa_opt('site_title'),
// $params['toemail'] = $userinfo['email'];
// $params['toname'] = $userinfo['handle'];
// $params['subject'] = qa_lang('emails/confirm_subject');
// $params['body'] = qa_lang('emails/confirm_body');
// qa_send_email($params);
}
开发者ID:GitFuture,项目名称:bmf,代码行数:19,代码来源:register.php
示例19: get_user_activity
function get_user_activity($handle, $limit = 10)
{
$userid = qa_handle_to_userid($handle);
require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
require_once QA_INCLUDE_DIR . 'qa-app-format.php';
$identifier = QA_FINAL_EXTERNAL_USERS ? $userid : $handle;
list($useraccount, $questions, $answerqs, $commentqs, $editqs) = qa_db_select_with_pending(QA_FINAL_EXTERNAL_USERS ? null : qa_db_user_account_selectspec($handle, false), qa_db_user_recent_qs_selectspec($userid, $identifier, $limit), qa_db_user_recent_a_qs_selectspec($userid, $identifier), qa_db_user_recent_c_qs_selectspec($userid, $identifier), qa_db_user_recent_edit_qs_selectspec($userid, $identifier));
if (!QA_FINAL_EXTERNAL_USERS && !is_array($useraccount)) {
// check the user exists
return include QA_INCLUDE_DIR . 'qa-page-not-found.php';
}
// Get information on user references
$questions = qa_any_sort_and_dedupe(array_merge($questions, $answerqs, $commentqs, $editqs));
$questions = array_slice($questions, 0, $limit);
$usershtml = qa_userids_handles_html(qa_any_get_userids_handles($questions), false);
$htmldefaults = qa_post_html_defaults('Q');
$htmldefaults['whoview'] = false;
$htmldefaults['voteview'] = false;
$htmldefaults['avatarsize'] = 0;
foreach ($questions as $question) {
$qa_content[] = qa_any_to_q_html_fields($question, $userid, qa_cookie_get(), $usershtml, null, array('voteview' => false) + qa_post_html_options($question, $htmldefaults));
}
$output = '<div class="user-activities">';
$output .= '<ul>';
if (isset($qa_content)) {
foreach ($qa_content as $qs) {
$icon = 'icon-time undefined';
$output .= '<li class="activity-item">';
$output .= '<div class="list-right">';
$output .= '<div class="type pull-left ' . $icon . '"></div>';
$output .= '<div class="what"><a class="what-task" href="' . @$qs['url'] . '">' . $qs['what'] . '</a>';
$output .= '<a href="' . $qs['url'] . '">' . $qs['title'] . '</a> </div>';
$output .= '<strong class="when">' . implode(' ', $qs['when']) . '</strong>';
$output .= '</div>';
$output .= '</li>';
}
} else {
$output .= '<li>' . qa_lang('cleanstrap/no_activity_yet') . '</li>';
}
$output .= '</ul>';
$output .= '</div>';
return $output;
}
开发者ID:microbye,项目名称:CleanStrap,代码行数:43,代码来源:widget_user_activity.php
示例20: process_request
public function process_request($request)
{
$requestparts = explode('/', qa_request());
$slugs = array_slice($requestparts, 1);
$countslugs = count($slugs);
$userid = qa_get_logged_in_userid();
$start = qa_get_start();
$count = qa_opt_if_loaded('page_size_activity');
$totalcount = qa_opt('cache_qcount');
$qspec = qa_db_posts_basic_selectspec($userid, false);
qa_db_add_selectspec_opost($qspec, 'ra', false, false);
qa_db_add_selectspec_ousers($qspec, 'rau', 'raup');
$qspec['source'] .= " JOIN (SELECT questionid, childid FROM ^homepage ORDER BY ^homepage.updated DESC) AS rcaq ON ^posts.postid=rcaq.questionid" . " LEFT JOIN ^posts AS ra ON childid=ra.postid" . (QA_FINAL_EXTERNAL_USERS ? "" : " LEFT JOIN ^users AS rau ON ra.userid=rau.userid") . " LEFT JOIN ^userpoints AS raup ON ra.userid=raup.userid LIMIT #,#";
array_push($qspec['columns'], 'childid');
array_push($qspec['arguments'], $start, $count);
$qspec['sortdesc'] = 'otime';
$query = 'SELECT ';
foreach ($qspec['columns'] as $columnas => $columnfrom) {
$query .= $columnfrom . (is_int($columnas) ? '' : ' AS ' . $columnas) . ', ';
}
$query = qa_db_apply_sub(substr($query, 0, -2) . (strlen(@$qspec['source']) ? ' FROM ' . $qspec['source'] : ''), @$qspec['arguments']);
$results = qa_db_read_all_assoc(qa_db_query_raw($query));
qa_db_post_select($results, $qspec);
list($categories, $categoryid) = qa_db_select_with_pending(qa_db_category_nav_selectspec($slugs, false, false, true), $countslugs ? qa_db_slugs_to_category_id_selectspec($slugs) : null);
$questions = qa_any_sort_and_dedupe($results);
// $questions=qa_any_sort_and_dedupe(array_merge($recentquestions,$recentanswers));
$pagesize = qa_opt('page_size_home');
if ($countslugs) {
if (!isset($categoryid)) {
return include QA_INCLUDE_DIR . 'qa-page-not-found.php';
}
$categorytitlehtml = qa_html($categories[$categoryid]['title']);
$sometitle = qa_lang_html_sub('main/recent_qs_as_in_x', $categorytitlehtml);
$nonetitle = qa_lang_html_sub('main/no_questions_in_x', $categorytitlehtml);
} else {
$sometitle = qa_lang_html('main/recent_qs_as_title');
$nonetitle = qa_lang_html('main/no_questions_found');
}
require_once QA_INCLUDE_DIR . 'qa-app-q-list.php';
$qa_content = qa_q_list_page_content($questions, $pagesize, $start, $totalcount, $sometitle, $nonetitle, $categories, $categoryid, true, qa_opt('eql_homepage_url'), qa_opt('feed_for_qa') ? qa_opt('eql_homepage_url') : null, count($questions) < $pagesize ? qa_html_suggest_ask($categoryid) : qa_html_suggest_qs_tags(qa_using_tags(), qa_category_path_request($categories, $categoryid)), null, null);
return $qa_content;
}
开发者ID:BrunoVandekerkhove,项目名称:q2a-expandable-question-lists,代码行数:42,代码来源:qa-eql-homepage.php
注:本文中的qa_db_select_with_pending函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论