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--; } } }
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>'); }
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); } }
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); } }
if ($usecaptcha) { qa_set_up_captcha_field($qa_content, $answerform['fields'], @$errors, qa_insert_login_links(qa_lang_html(isset($qa_login_userid) ? 'misc/captcha_confirm_fix' : 'misc/captcha_login_fix'))); } break; } if ($formrequested || empty($qa_content['a_list']['as'])) { $qa_content['q_view']['a_form'] = $answerform; } else { $answerkeys = array_keys($qa_content['a_list']['as']); $qa_content['a_list']['as'][$answerkeys[count($answerkeys) - 1]]['c_form'] = $answerform; // under last answer } } // List of related questions 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) { // related questions will include itself so remove that unset($relatedquestions[$key]); } } if (count($relatedquestions)) { $qa_content['q_list']['title'] = qa_lang('main/related_qs_title'); } else { $qa_content['q_list']['title'] = qa_lang('main/no_related_qs_title'); } $qa_content['q_list']['qs'] = array(); foreach ($relatedquestions as $related) { $qa_content['q_list']['qs'][] = qa_post_html_fields($related, $qa_login_userid, $qa_cookieid, $usershtml, null, qa_post_html_defaults('Q')); }
$exampletags[] = $tag; if (count($exampletags) >= $maxcount) { break; } } } else { $exampletags = array(); } // Output the response header and example tags echo "QA_AJAX_RESPONSE\n1\n"; echo strtr(qa_html(implode(',', $exampletags)), "\r\n", ' ') . "\n"; // Collect and output the list of related questions if ($doaskcheck) { require_once QA_INCLUDE_DIR . 'qa-app-format.php'; $count = 0; $minscore = qa_match_to_min_score(qa_opt('match_ask_check_qs')); $maxcount = qa_opt('page_size_ask_check_qs'); foreach ($relatedquestions as $question) { if ($question['score'] < $minscore) { break; } if (!$count) { echo qa_lang_html('question/ask_same_q') . '<BR/>'; } echo strtr('<A HREF="' . qa_q_path_html($question['postid'], $question['title']) . '" TARGET="_blank">' . qa_html($question['title']) . '</A><BR/>', "\r\n", ' ') . "\n"; if (++$count >= $maxcount) { break; } } } /*