function cs_user_post_list($handle, $type, $limit) { $userid = qa_handle_to_userid($handle); require_once QA_INCLUDE_DIR . 'qa-app-posts.php'; $post = qa_db_read_all_assoc(qa_db_query_sub('SELECT * FROM ^posts INNER JOIN ^users ON ^posts.userid=^users.userid WHERE ^posts.type=$ and ^posts.userid=# ORDER BY ^posts.created DESC LIMIT #', $type, $userid, $limit)); $output = '<ul class="question-list users-post-widget post-type-' . $type . '">'; if (count($post) > 0) { foreach ($post as $p) { if ($type == 'Q') { $what = qa_lang_html('cleanstrap/asked'); } elseif ($type == 'A') { $what = qa_lang_html('cleanstrap/answered'); } elseif ('C') { $what = qa_lang_html('cleanstrap/commented'); } $handle = $p['handle']; $output .= '<li id="q-list-' . $p['postid'] . '" class="question-item">'; if ($type == 'Q') { $output .= '<div class="big-ans-count pull-left">' . $p['acount'] . '<span>' . qa_lang_html('cleanstrap/ans') . '</span></div>'; } elseif ($type == 'A') { $output .= '<div class="big-ans-count pull-left icon-answer"></div>'; } elseif ($type == 'C') { $output .= '<div class="big-ans-count pull-left icon-comment icon-comments"></div>'; } $output .= '<div class="list-right">'; $timeCode = qa_when_to_html(strtotime($p['created']), 7); $when = @$timeCode['prefix'] . @$timeCode['data'] . @$timeCode['suffix']; if ($type == 'Q') { $output .= '<h5><a href="' . qa_q_path_html($p['postid'], $p['title']) . '" title="' . $p['title'] . '">' . qa_html($p['title']) . '</a></h5>'; } elseif ($type == 'A') { $output .= '<h5><a href="' . cs_post_link($p['parentid']) . '#a' . $p['postid'] . '">' . cs_truncate(strip_tags($p['content']), 300) . '</a></h5>'; } else { $output .= '<h5><a href="' . cs_post_link($p['parentid']) . '#c' . $p['postid'] . '">' . cs_truncate(strip_tags($p['content']), 300) . '</a></h5>'; } $output .= '<div class="list-date"><span class="icon-clock">' . $when . '</span>'; $output .= '<span class="icon-thumbs-up2">' . qa_lang_sub('cleanstrap/x_votes', $p['netvotes']) . '</span></div>'; $output .= '</div>'; $output .= '</li>'; } } else { if ($type == 'Q') { $what = 'questions'; } elseif ($type == 'A') { $what = 'answers'; } elseif ('C') { $what = 'comments'; } $output .= '<li class="no-post-found">' . qa_lang('cleanstrap/no_' . $what) . ' </li>'; } $output .= '</ul>'; echo $output; }
function carousel_item($type, $limit, $col_item = 1) { require_once QA_INCLUDE_DIR . 'qa-app-posts.php'; $post = qa_db_query_sub('SELECT * FROM ^postmetas, ^posts INNER JOIN ^users ON ^posts.userid=^users.userid WHERE ^posts.type=$ and ( ^postmetas.postid = ^posts.postid and ^postmetas.title = "featured_question" ) ORDER BY ^posts.created DESC LIMIT #', $type, $limit); $output = '<div class="item"><div class="row">'; $i = 1; while ($p = mysql_fetch_array($post)) { if ($type == 'Q') { $what = qa_lang('cleanstrap/asked'); } elseif ($type == 'A') { $what = qa_lang('cleanstrap/answered'); } elseif ('C') { $what = qa_lang('cleanstrap/commented'); } $handle = $p['handle']; if ($type == 'Q') { $link_header = '<a href="' . qa_q_path_html($p['postid'], $p['title']) . '" title="' . $p['title'] . '">'; } elseif ($type == 'A') { $link_header = '<a href="' . cs_post_link($p['parentid']) . '#a' . $p['postid'] . '">'; } else { $link_header = '<a href="' . cs_post_link($p['parentid']) . '#c' . $p['postid'] . '">'; } $output .= '<div class="slider-item col-sm-' . 12 / $col_item . '">'; $output .= '<div class="slider-item-inner">'; $featured_img = get_featured_thumb($p['postid']); if ($featured_img) { $output .= $link_header . '<div class="featured-image">' . $featured_img . '</div></a>'; } if ($type == 'Q') { $output .= '<div class="big-ans-count pull-left">' . $p['acount'] . '<span> ans</span></div>'; } elseif ($type == 'A') { $output .= '<div class="big-ans-count pull-left vote">' . $p['netvotes'] . '<span>' . qa_lang('cleanstrap/vote') . '</span></div>'; } $output .= '<h5>' . $link_header . cs_truncate(qa_html($p['title']), 50) . '</a></h5>'; $output .= '<div class="meta">'; $when = qa_when_to_html(strtotime($p['created']), 7); $avatar = cs_get_avatar($handle, 15, false); if ($avatar) { $output .= '<img src="' . $avatar . '" />'; } $output .= '<span class="icon-time">' . implode(' ', $when) . '</span>'; $output .= '<span class="vote-count">' . $p['netvotes'] . ' ' . qa_lang('cleanstrap/votes') . '</span></div>'; $output .= '</div>'; $output .= '</div>'; if ($col_item == $i) { $output .= '</div></div><div class="item active"><div class="row">'; } $i++; } $output .= '</div></div>'; return $output; }
function cs_post_list($type, $limit, $return = false) { $posts = qa_db_read_all_assoc(qa_db_query_sub('SELECT ^posts.* , ^users.* FROM ^posts, ^users WHERE ^posts.userid=^users.userid AND ^posts.type=$ ORDER BY ^posts.created DESC LIMIT #', $type, $limit)); $output = '<ul class="posts-list">'; foreach ($posts as $p) { if ($type == 'Q') { $what = qa_lang_html('cleanstrap/asked'); } elseif ($type == 'A') { $what = qa_lang_html('cleanstrap/answered'); } elseif ('C') { $what = qa_lang_html('cleanstrap/commented'); } $handle = $p['handle']; $timeCode = qa_when_to_html(strtotime($p['created']), 7); $when = @$timeCode['prefix'] . @$timeCode['data'] . @$timeCode['suffix']; $output .= '<li>'; $output .= cs_get_post_avatar($p, $p['userid'], 30, true); $output .= '<div class="post-content">'; if ($type == 'Q') { $output .= '<a class="title question" href="' . qa_q_path_html($p['postid'], $p['title']) . '" title="' . $p['title'] . '">' . qa_html($p['title']) . '</a>'; } elseif ($type == 'A') { $output .= '<a class="title" href="' . cs_post_link($p['parentid']) . '#a' . $p['postid'] . '">' . cs_truncate(strip_tags($p['content']), 100) . '</a>'; } else { $output .= '<a class="title" href="' . cs_post_link($p['parentid']) . '#c' . $p['postid'] . '">' . cs_truncate(strip_tags($p['content']), 100) . '</a>'; } $output .= '<div class="meta">'; //$output .= '<span><a href="' . qa_path_html('user/' . $handle) . '">' . cs_name($handle) . '</a> ' . $what . '</span>'; if ($type == 'Q') { $output .= '<span>' . qa_lang_sub('cleanstrap/x_answers', $p['acount']) . '</span>'; } $output .= '<span class="time icon-time">' . $when . '</span>'; $output .= '<span class="vote-count icon-thumbs-up2">' . qa_lang_sub('cleanstrap/x_votes', $p['netvotes']) . '</span>'; $output .= '</div>'; $output .= '</div>'; $output .= '</li>'; } $output .= '</ul>'; if ($return) { return $output; } echo $output; }
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>'); }
function get_next_q() { $myurl = $this->request; $myurlpieces = explode("/", $myurl); $myurl = $myurlpieces[0]; if (is_numeric($myurl)) { $query_n = "SELECT ^posts.*,^categories.position\n\tFROM ^posts INNER JOIN ^categories ON ^posts.categoryid = ^categories.categoryid\n\tWHERE postid = {$myurl}\n\tAND type='Q'\n\tLIMIT 1"; $current_q = qa_db_query_sub($query_n); while ($current_link = qa_db_read_one_assoc($current_q, true)) { $categoryid = $current_link['categoryid']; $categoryposition = $current_link['position']; } $combinedid = $categoryposition * 1000000 - $myurl; $query_n = "SELECT ^posts.* \n\tFROM ^posts INNER JOIN ^categories ON ^posts.categoryid = ^categories.categoryid\n\tWHERE position*1000000-postid > {$combinedid} \n\tAND type='Q'\n\tORDER BY position*1000000-postid ASC\n\tLIMIT 1"; $next_q = qa_db_query_sub($query_n); while ($next_link = qa_db_read_one_assoc($next_q, true)) { $title = $next_link['title']; $pid = $next_link['postid']; $this->output(' <A HREF="' . qa_q_path_html($pid, $title) . '" title="' . $title . '" STYLE="float:right;padding-right:20px">Next Action <img style="border:0px;width:50px" src="../qa-theme/GreenTheme-CATO/next.png"/></A>', ''); } } }
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); } }
public function q_title_list($q_list, $attrs = null) { $this->output('<ul class="qa-q-title-list">'); foreach ($q_list as $q) { $this->output('<li class="qa-q-title-item">', '<a href="' . qa_q_path_html($q['postid'], $q['title']) . '" ' . $attrs . '>' . qa_html($q['title']) . '</a>', '</li>'); } $this->output('</ul>'); }
function cs_post_link($id) { $type = mysql_result(qa_db_query_sub('SELECT type FROM ^posts WHERE postid = "' . $id . '"'), 0); if ($type == 'A') { $id = mysql_result(qa_db_query_sub('SELECT parentid FROM ^posts WHERE postid = "' . $id . '"'), 0); } $post = qa_db_query_sub('SELECT title FROM ^posts WHERE postid = "' . $id . '"'); return qa_q_path_html($id, mysql_result($post, 0)); }
function qa_page_q_question_view($question, $parentquestion, $closepost, $usershtml, $formrequested) { $questionid = $question['postid']; $userid = qa_get_logged_in_userid(); $cookieid = qa_cookie_get(); $htmloptions = qa_post_html_defaults('Q', true); $htmloptions['answersview'] = false; // answer count is displayed separately so don't show it here $htmloptions['avatarsize'] = qa_opt('avatar_q_page_q_size'); $q_view = qa_post_html_fields($question, $userid, $cookieid, $usershtml, null, $htmloptions); $q_view['main_form_tags'] = 'METHOD="POST" ACTION="' . qa_self_html() . '"'; // Buttons for operating on the question if (!$formrequested) { // don't show if another form is currently being shown on page $clicksuffix = ' onClick="qa_show_waiting_after(this, false);"'; // add to operations that write to database $buttons = array(); if ($question['editbutton']) { $buttons['edit'] = array('tags' => 'NAME="q_doedit"', 'label' => qa_lang_html('question/edit_button'), 'popup' => qa_lang_html('question/edit_q_popup')); } $hascategories = qa_using_categories(); if ($question['retagcatbutton']) { $buttons['retagcat'] = array('tags' => 'NAME="q_doedit"', 'label' => qa_lang_html($hascategories ? 'question/recat_button' : 'question/retag_button'), 'popup' => qa_lang_html($hascategories ? qa_using_tags() ? 'question/retag_cat_popup' : 'question/recat_popup' : 'question/retag_popup')); } if ($question['flagbutton']) { $buttons['flag'] = array('tags' => 'NAME="q_doflag"' . $clicksuffix, 'label' => qa_lang_html($question['flagtohide'] ? 'question/flag_hide_button' : 'question/flag_button'), 'popup' => qa_lang_html('question/flag_q_popup')); } if ($question['unflaggable']) { $buttons['unflag'] = array('tags' => 'NAME="q_dounflag"' . $clicksuffix, 'label' => qa_lang_html('question/unflag_button'), 'popup' => qa_lang_html('question/unflag_popup')); } if ($question['clearflaggable']) { $buttons['clearflags'] = array('tags' => 'NAME="q_doclearflags"' . $clicksuffix, 'label' => qa_lang_html('question/clear_flags_button'), 'popup' => qa_lang_html('question/clear_flags_popup')); } if ($question['closeable']) { $buttons['close'] = array('tags' => 'NAME="q_doclose"', 'label' => qa_lang_html('question/close_button'), 'popup' => qa_lang_html('question/close_q_popup')); } if ($question['reopenable']) { $buttons['reopen'] = array('tags' => 'NAME="q_doreopen"' . $clicksuffix, 'label' => qa_lang_html('question/reopen_button')); } if ($question['moderatable']) { $buttons['approve'] = array('tags' => 'NAME="q_doapprove"' . $clicksuffix, 'label' => qa_lang_html('question/approve_button')); $buttons['reject'] = array('tags' => 'NAME="q_doreject"' . $clicksuffix, 'label' => qa_lang_html('question/reject_button')); } if ($question['hideable']) { $buttons['hide'] = array('tags' => 'NAME="q_dohide"' . $clicksuffix, 'label' => qa_lang_html('question/hide_button'), 'popup' => qa_lang_html('question/hide_q_popup')); } if ($question['reshowable']) { $buttons['reshow'] = array('tags' => 'NAME="q_doreshow"' . $clicksuffix, 'label' => qa_lang_html('question/reshow_button')); } if ($question['deleteable']) { $buttons['delete'] = array('tags' => 'NAME="q_dodelete"' . $clicksuffix, 'label' => qa_lang_html('question/delete_button'), 'popup' => qa_lang_html('question/delete_q_popup')); } if ($question['claimable']) { $buttons['claim'] = array('tags' => 'NAME="q_doclaim"' . $clicksuffix, 'label' => qa_lang_html('question/claim_button')); } if ($question['answerbutton']) { // don't show if shown by default $buttons['answer'] = array('tags' => 'NAME="q_doanswer" ID="q_doanswer" onClick="return qa_toggle_element(\'anew\')"', 'label' => qa_lang_html('question/answer_button'), 'popup' => qa_lang_html('question/answer_q_popup')); } if ($question['commentbutton']) { $buttons['comment'] = array('tags' => 'NAME="q_docomment" onClick="return qa_toggle_element(\'c' . $questionid . '\')"', 'label' => qa_lang_html('question/comment_button'), 'popup' => qa_lang_html('question/comment_q_popup')); } $q_view['form'] = array('style' => 'light', 'buttons' => $buttons, 'hidden' => array('qa_click' => '')); } // Information about the question of the answer that this question follows on from (or a question directly) if (isset($parentquestion)) { $q_view['follows'] = array('label' => qa_lang_html($question['parentid'] == $parentquestion['postid'] ? 'question/follows_q' : 'question/follows_a'), 'title' => qa_html(qa_block_words_replace($parentquestion['title'], qa_get_block_words_preg())), 'url' => qa_q_path_html($parentquestion['postid'], $parentquestion['title'], false, $question['parentid'] == $parentquestion['postid'] ? 'Q' : 'A', $question['parentid'])); } // Information about the question that this question is a duplicate of (if appropriate) if (isset($closepost)) { if ($closepost['basetype'] == 'Q') { $q_view['closed'] = array('label' => qa_lang_html('question/closed_as_duplicate'), 'content' => qa_html(qa_block_words_replace($closepost['title'], qa_get_block_words_preg())), 'url' => qa_q_path_html($closepost['postid'], $closepost['title'])); } elseif ($closepost['type'] == 'NOTE') { $viewer = qa_load_viewer($closepost['content'], $closepost['format']); $q_view['closed'] = array('label' => qa_lang_html('question/closed_with_note'), 'content' => $viewer->get_html($closepost['content'], $closepost['format'], array('blockwordspreg' => qa_get_block_words_preg()))); } } // Extra value display if (strlen(@$question['extra']) && qa_opt('extra_field_active') && qa_opt('extra_field_display')) { $q_view['extra'] = array('label' => qa_html(qa_opt('extra_field_label')), 'content' => qa_html(qa_block_words_replace($question['extra'], qa_get_block_words_preg()))); } return $q_view; }
function qa_other_to_q_html_fields($question, $userid, $cookieid, $usershtml, $dummy, $options) { if (qa_to_override(__FUNCTION__)) { $args = func_get_args(); return qa_call_override(__FUNCTION__, $args); } require_once QA_INCLUDE_DIR . 'app/updates.php'; $fields = qa_post_html_fields($question, $userid, $cookieid, $usershtml, null, $options); switch ($question['obasetype'] . '-' . @$question['oupdatetype']) { case 'Q-': $langstring = 'main/asked'; break; case 'Q-' . QA_UPDATE_VISIBLE: if (@$question['opersonal']) { $langstring = $question['hidden'] ? 'misc/your_q_hidden' : 'misc/your_q_reshown'; } else { $langstring = $question['hidden'] ? 'main/hidden' : 'main/reshown'; } break; case 'Q-' . QA_UPDATE_CLOSED: if (@$question['opersonal']) { $langstring = isset($question['closedbyid']) ? 'misc/your_q_closed' : 'misc/your_q_reopened'; } else { $langstring = isset($question['closedbyid']) ? 'main/closed' : 'main/reopened'; } break; case 'Q-' . QA_UPDATE_TAGS: $langstring = @$question['opersonal'] ? 'misc/your_q_retagged' : 'main/retagged'; break; case 'Q-' . QA_UPDATE_CATEGORY: $langstring = @$question['opersonal'] ? 'misc/your_q_recategorized' : 'main/recategorized'; break; case 'A-': $langstring = @$question['opersonal'] ? 'misc/your_q_answered' : 'main/answered'; break; case 'A-' . QA_UPDATE_SELECTED: $langstring = @$question['opersonal'] ? 'misc/your_a_selected' : 'main/answer_selected'; break; case 'A-' . QA_UPDATE_VISIBLE: if (@$question['opersonal']) { $langstring = $question['ohidden'] ? 'misc/your_a_hidden' : 'misc/your_a_reshown'; } else { $langstring = $question['ohidden'] ? 'main/hidden' : 'main/answer_reshown'; } break; case 'A-' . QA_UPDATE_CONTENT: $langstring = @$question['opersonal'] ? 'misc/your_a_edited' : 'main/answer_edited'; break; case 'Q-' . QA_UPDATE_FOLLOWS: $langstring = @$question['opersonal'] ? 'misc/your_a_questioned' : 'main/asked_related_q'; break; case 'C-': $langstring = 'main/commented'; break; case 'C-' . QA_UPDATE_C_FOR_Q: $langstring = @$question['opersonal'] ? 'misc/your_q_commented' : 'main/commented'; break; case 'C-' . QA_UPDATE_C_FOR_A: $langstring = @$question['opersonal'] ? 'misc/your_a_commented' : 'main/commented'; break; case 'C-' . QA_UPDATE_FOLLOWS: $langstring = @$question['opersonal'] ? 'misc/your_c_followed' : 'main/commented'; break; case 'C-' . QA_UPDATE_TYPE: $langstring = @$question['opersonal'] ? 'misc/your_c_moved' : 'main/comment_moved'; break; case 'C-' . QA_UPDATE_VISIBLE: if (@$question['opersonal']) { $langstring = $question['ohidden'] ? 'misc/your_c_hidden' : 'misc/your_c_reshown'; } else { $langstring = $question['ohidden'] ? 'main/hidden' : 'main/comment_reshown'; } break; case 'C-' . QA_UPDATE_CONTENT: $langstring = @$question['opersonal'] ? 'misc/your_c_edited' : 'main/comment_edited'; break; case 'Q-' . QA_UPDATE_CONTENT: default: $langstring = @$question['opersonal'] ? 'misc/your_q_edited' : 'main/edited'; break; } $fields['what'] = qa_lang_html($langstring); if (@$question['opersonal']) { $fields['what_your'] = true; } if ($question['obasetype'] != 'Q' || @$question['oupdatetype'] == QA_UPDATE_FOLLOWS) { $fields['what_url'] = qa_q_path_html($question['postid'], $question['title'], false, $question['obasetype'], $question['opostid']); } if (@$options['contentview'] && !empty($question['ocontent'])) { $viewer = qa_load_viewer($question['ocontent'], $question['oformat']); $fields['content'] = $viewer->get_html($question['ocontent'], $question['oformat'], array('blockwordspreg' => @$options['blockwordspreg'], 'showurllinks' => @$options['showurllinks'], 'linksnewwindow' => @$options['linksnewwindow'])); } if (@$options['whenview']) { $fields['when'] = qa_when_to_html($question['otime'], @$options['fulldatedays']); } if (@$options['whoview']) { $isbyuser = qa_post_is_by_user(array('userid' => $question['ouserid'], 'cookieid' => @$question['ocookieid']), $userid, $cookieid); $fields['who'] = qa_who_to_html($isbyuser, $question['ouserid'], $usershtml, @$options['ipview'] ? @$question['oip'] : null, false, @$question['oname']); if (isset($question['opoints'])) { if (@$options['pointsview']) { $fields['who']['points'] = $question['opoints'] == 1 ? qa_lang_html_sub_split('main/1_point', '1', '1') : qa_lang_html_sub_split('main/x_points', qa_html(number_format($question['opoints']))); } if (isset($options['pointstitle'])) { $fields['who']['title'] = qa_get_points_title_html($question['opoints'], $options['pointstitle']); } } if (isset($question['olevel'])) { $fields['who']['level'] = qa_html(qa_user_level_string($question['olevel'])); } } unset($fields['flags']); if (@$options['flagsview'] && @$question['oflagcount']) { $fields['flags'] = $question['oflagcount'] == 1 ? qa_lang_html_sub_split('main/1_flag', '1', '1') : qa_lang_html_sub_split('main/x_flags', $question['oflagcount']); } unset($fields['avatar']); if (@$options['avatarsize'] > 0) { if (QA_FINAL_EXTERNAL_USERS) { $fields['avatar'] = qa_get_external_avatar_html($question['ouserid'], $options['avatarsize'], false); } else { $fields['avatar'] = qa_get_user_avatar_html($question['oflags'], $question['oemail'], $question['ohandle'], $question['oavatarblobid'], $question['oavatarwidth'], $question['oavatarheight'], $options['avatarsize']); } } return $fields; }
function get_full_post($post, $options, $usershtml) { $fields['raw'] = $post; $userid = qa_get_logged_in_userid(); $cookieid = qa_cookie_get(); $fields['netvotes_raw'] = (int) $post['netvotes']; $postid = $post['postid']; $isquestion = $post['basetype'] == 'Q'; $isanswer = $post['basetype'] == 'A'; $isbyuser = @$post['userid'] == $userid; $anchor = urlencode(qa_anchor($post['basetype'], $postid)); $elementid = isset($options['elementid']) ? $options['elementid'] : $anchor; $microformats = false; $isselected = @$options['isselected']; // content if (@$options['contentview'] && !empty($post['content'])) { $viewer = qa_load_viewer($post['content'], $post['format']); $fields['content'] = $viewer->get_html($post['content'], $post['format'], array('blockwordspreg' => @$options['blockwordspreg'], 'showurllinks' => @$options['showurllinks'], 'linksnewwindow' => @$options['linksnewwindow'])); } if ($post['hidden']) { $fields['vote_state'] = 'disabled'; } elseif ($isbyuser) { $fields['vote_state'] = 'disabled'; } elseif (@$post['uservote'] > 0) { $fields['vote_state'] = 'voted_up'; } elseif (@$post['uservote'] < 0) { $fields['vote_state'] = 'voted_down'; } else { if (strpos($options['voteview'], '-uponly-level')) { $fields['vote_state'] = 'up_only'; } else { $fields['vote_state'] = 'enabled'; } } // Created when and by whom $fields['meta_order'] = qa_lang_html('main/meta_order'); // sets ordering of meta elements which can be language-specific if (@$options['whatview']) { $fields['what'] = qa_lang_html($isquestion ? 'main/asked' : ($isanswer ? 'main/answered' : 'main/commented')); if (@$options['whatlink'] && !$isquestion) { $fields['what_url'] = qa_path_html(qa_request(), array('show' => $postid), null, null, qa_anchor($post['basetype'], $postid)); } } if (isset($post['created']) && @$options['whenview']) { $fields['when'] = qa_when_to_html($post['created'], @$options['fulldatedays']); } if (@$options['whoview']) { $fields['who'] = qa_who_to_html($isbyuser, @$post['userid'], $usershtml, @$options['ipview'] ? @$post['createip'] : null, $microformats); if (isset($post['points'])) { if (@$options['pointsview']) { $fields['who']['points'] = $post['points'] == 1 ? qa_lang_html_sub_split('main/1_point', '1', '1') : qa_lang_html_sub_split('main/x_points', qa_html(number_format($post['points']))); } if (isset($options['pointstitle'])) { $fields['who']['title'] = qa_get_points_title_html($post['points'], $options['pointstitle']); } } if (isset($post['level'])) { $fields['who']['level'] = qa_html(qa_user_level_string($post['level'])); } } $isselected = @$options['isselected']; // Updated when and by whom if (isset($post['opostid'])) { // updated meta switch ($post['obasetype'] . '-' . @$post['oupdatetype']) { case 'Q-': $langstring = 'main/asked'; break; case 'Q-' . QA_UPDATE_VISIBLE: $langstring = $post['hidden'] ? 'main/hidden' : 'main/reshown'; break; case 'Q-' . QA_UPDATE_CLOSED: $langstring = isset($post['closedbyid']) ? 'main/closed' : 'main/reopened'; break; case 'Q-' . QA_UPDATE_TAGS: $langstring = 'main/retagged'; break; case 'Q-' . QA_UPDATE_CATEGORY: $langstring = 'main/recategorized'; break; case 'A-': $langstring = 'main/answered'; break; case 'A-' . QA_UPDATE_SELECTED: $langstring = 'main/answer_selected'; break; case 'A-' . QA_UPDATE_VISIBLE: $langstring = $post['ohidden'] ? 'main/hidden' : 'main/answer_reshown'; break; case 'A-' . QA_UPDATE_CONTENT: $langstring = 'main/answer_edited'; break; case 'Q-' . QA_UPDATE_FOLLOWS: $langstring = 'main/asked_related_q'; break; case 'C-': $langstring = 'main/commented'; break; case 'C-' . QA_UPDATE_TYPE: $langstring = 'main/comment_moved'; break; case 'C-' . QA_UPDATE_VISIBLE: $langstring = $post['ohidden'] ? 'main/hidden' : 'main/comment_reshown'; break; case 'C-' . QA_UPDATE_CONTENT: $langstring = 'main/comment_edited'; break; case 'Q-' . QA_UPDATE_CONTENT: default: $langstring = 'main/edited'; break; } $fields['what_2'] = qa_lang_html($langstring); if ($post['obasetype'] != 'Q' || @$post['oupdatetype'] == QA_UPDATE_FOLLOWS) { $fields['what_2_url'] = qa_q_path_html($post['postid'], $post['title'], false, $post['obasetype'], $post['opostid']); } if (@$options['contentview'] && !empty($post['ocontent'])) { $viewer = qa_load_viewer($post['ocontent'], $post['oformat']); $fields['content_2'] = $viewer->get_html($post['ocontent'], $post['oformat'], array('blockwordspreg' => @$options['blockwordspreg'], 'showurllinks' => @$options['showurllinks'], 'linksnewwindow' => @$options['linksnewwindow'])); } if (@$options['whenview']) { $fields['when_2'] = qa_when_to_html($post['otime'], @$options['fulldatedays']); } if (@$options['whoview']) { $isbyuser = qa_post_is_by_user(array('userid' => $post['ouserid'], 'cookieid' => @$post['ocookieid']), $userid, $cookieid); $fields['who_2'] = qa_who_to_html($isbyuser, $post['ouserid'], $usershtml, @$options['ipview'] ? @$post['oip'] : null, false); if (isset($post['opoints'])) { if (@$options['pointsview']) { $fields['who_2']['points'] = $post['opoints'] == 1 ? qa_lang_html_sub_split('main/1_point', '1', '1') : qa_lang_html_sub_split('main/x_points', qa_html(number_format($post['opoints']))); } if (isset($options['pointstitle'])) { $fields['who_2']['title'] = qa_get_points_title_html($post['opoints'], $options['pointstitle']); } } if (isset($post['olevel'])) { $fields['who_2']['level'] = qa_html(qa_user_level_string($post['olevel'])); } } } else { if (@$options['updateview'] && isset($post['updated']) && ($post['updatetype'] != QA_UPDATE_SELECTED || $isselected) && (!isset($post['created']) || $post['hidden'] && $post['updatetype'] == QA_UPDATE_VISIBLE || isset($post['closedbyid']) && $post['updatetype'] == QA_UPDATE_CLOSED || abs($post['updated'] - $post['created']) > 300 || $post['lastuserid'] != $post['userid'])) { switch ($post['updatetype']) { case QA_UPDATE_TYPE: case QA_UPDATE_PARENT: $langstring = 'main/moved'; break; case QA_UPDATE_CATEGORY: $langstring = 'main/recategorized'; break; case QA_UPDATE_VISIBLE: $langstring = $post['hidden'] ? 'main/hidden' : 'main/reshown'; break; case QA_UPDATE_CLOSED: $langstring = isset($post['closedbyid']) ? 'main/closed' : 'main/reopened'; break; case QA_UPDATE_TAGS: $langstring = 'main/retagged'; break; case QA_UPDATE_SELECTED: $langstring = 'main/selected'; break; default: $langstring = 'main/edited'; break; } $fields['what_2'] = qa_lang_html($langstring); if (@$options['whenview']) { $fields['when_2'] = qa_when_to_html($post['updated'], @$options['fulldatedays']); } if (isset($post['lastuserid']) && @$options['whoview']) { $fields['who_2'] = qa_who_to_html(isset($userid) && $post['lastuserid'] == $userid, $post['lastuserid'], $usershtml, @$options['ipview'] ? $post['lastip'] : null, false); } } } $fields['avatar'] = $this->get_post_avatar($post); return $fields; }
function cs_ajax_get_question_suggestion() { $query = strip_tags($_REQUEST['start_with']); $relatedquestions = qa_db_select_with_pending(qa_db_search_posts_selectspec(null, qa_string_to_words($query), null, null, null, null, 0, false, 10)); //print_r($relatedquestions); if (isset($relatedquestions) && !empty($relatedquestions)) { $data = array(); foreach ($relatedquestions as $k => $q) { $data[$k]['title'] = $q['title']; $data[$k]['blob'] = cs_get_avatar($q['handle'], 30, false); $data[$k]['url'] = qa_q_path_html($q['postid'], $q['title']); $data[$k]['tags'] = $q['tags']; $data[$k]['answers'] = $q['acount']; } echo json_encode($data); } die; }
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; } } } /* Omit PHP closing tag to help avoid accidental output */
case 'C-' . QA_UPDATE_TYPE: $langstring = 'misc/feed_c_moved_prefix'; break; case 'C-' . QA_UPDATE_VISIBLE: $langstring = $question['ohidden'] ? 'misc/feed_hidden_prefix' : 'misc/feed_c_reshown_prefix'; break; case 'C-' . QA_UPDATE_CONTENT: $langstring = 'misc/feed_c_edited_prefix'; break; case 'Q-' . QA_UPDATE_CONTENT: default: $langstring = 'misc/feed_edited_prefix'; break; } $titleprefix = isset($langstring) ? qa_lang($langstring) : ''; $urlhtml = qa_q_path_html($question['postid'], $question['title'], true, @$question['obasetype'], @$question['opostid']); } if (isset($blockwordspreg)) { $question['title'] = qa_block_words_replace($question['title'], $blockwordspreg); } // Build the inner XML structure for each item $lines[] = '<item>'; $lines[] = '<title>' . qa_html($titleprefix . $question['title']) . '</title>'; $lines[] = '<link>' . $urlhtml . '</link>'; if (isset($htmlcontent)) { $lines[] = '<description>' . qa_html($htmlcontent) . '</description>'; } // qa_html() a second time to put HTML code inside XML wrapper if (isset($question['categoryname'])) { $lines[] = '<category>' . qa_html($question['categoryname']) . '</category>'; }
function ra_user_post_list($handle, $type, $limit) { $userid = qa_handle_to_userid($handle); require_once QA_INCLUDE_DIR . 'qa-app-posts.php'; $post = qa_db_query_sub('SELECT * FROM ^posts WHERE ^posts.type=$ and ^posts.userid=# ORDER BY ^posts.created DESC LIMIT #', $type, $userid, $limit); $output = '<ul class="question-list users-widget">'; while ($p = mysql_fetch_array($post)) { if ($type == 'Q') { $what = _ra_lang('asked'); } elseif ($type == 'A') { $what = _ra_lang('answered'); } elseif ('C') { $what = _ra_lang('commented'); } $handle = qa_post_userid_to_handle($p['userid']); $output .= '<li id="q-list-' . $p['postid'] . '" class="question-item">'; if ($type == 'Q') { $output .= '<div class="big-ans-count pull-left">' . $p['acount'] . '<span>' . _ra_lang('Ans') . '</span></div>'; } elseif ($type == 'A') { $output .= '<div class="big-ans-count pull-left vote">' . $p['netvotes'] . '<span>' . _ra_lang('Vote') . '</span></div>'; } $output .= '<div class="list-right">'; if ($type == 'Q') { $output .= '<h5><a href="' . qa_q_path_html($p['postid'], $p['title']) . '" title="' . $p['title'] . '">' . qa_html($p['title']) . '</a></h5>'; } elseif ($type == 'A') { $output .= '<h5><a href="' . ra_post_link($p['parentid']) . '#a' . $p['postid'] . '">' . substr(strip_tags($p['content']), 0, 50) . '</a></h5>'; } else { $output .= '<h5><a href="' . ra_post_link($p['parentid']) . '#c' . $p['postid'] . '">' . substr(strip_tags($p['content']), 0, 50) . '</a></h5>'; } $output .= '<div class="list-date"><span class="icon-calendar-2">' . date('d M Y', strtotime($p['created'])) . '</span>'; $output .= '<span class="icon-chevron-up">' . $p['netvotes'] . ' ' . _ra_lang('votes') . '</span></div>'; $output .= '</div>'; $output .= '</li>'; } $output .= '</ul>'; echo $output; }
function cs_relative_post_list($limit, $slug, $type, $return = false, $avatar_size) { require_once QA_INCLUDE_DIR . 'qa-app-posts.php'; if (!empty($slug)) { if ($type == 'Category') { $post_type = 'Q'; $categories = explode("/", $slug); if (count($categories)) { $category_bread_crup = implode(" > ", $categories); $category_link = implode("/", $categories); $categories = array_reverse($categories); $slug = implode("/", $categories); } $posts = qa_db_read_all_assoc(qa_db_query_sub('SELECT * FROM ^posts WHERE ^posts.type=$ AND categoryid=(SELECT categoryid FROM ^categories WHERE ^categories.backpath=$ LIMIT 1) ORDER BY ^posts.created DESC LIMIT #', 'Q', $slug, $limit)); //refresh every 15 minutes $title = 'Questions in <a href="' . qa_path_html('questions/' . qa_strtolower($category_link)) . '">' . $category_bread_crup . '</a>'; } elseif ($type == 'Tags') { $post_type = 'Q'; $title = 'Questions in <a href="' . qa_path_html('tag/' . qa_strtolower($slug)) . '">' . $slug . '</a>'; $posts = qa_db_read_all_assoc(qa_db_query_sub('SELECT * FROM ^posts WHERE ^posts.type=$ AND ^posts.postid IN (SELECT postid FROM ^posttags WHERE wordid=(SELECT wordid FROM ^words WHERE word=$ OR word=$ COLLATE utf8_bin LIMIT 1) ORDER BY postcreated DESC) ORDER BY ^posts.created DESC LIMIT #', 'Q', $slug, qa_strtolower($slug), $limit)); } else { // Relative to Keyword require_once QA_INCLUDE_DIR . 'qa-app-search.php'; $keyword = $slug; $userid = qa_get_logged_in_userid(); $title = 'Posts About <a href="' . qa_path_html('search/' . qa_strtolower($keyword)) . '">' . $keyword . '</a>'; //$post=qa_get_search_results($keyword, 0, $limit, $userid , false, false); $words = qa_string_to_words($keyword); $posts = qa_db_select_with_pending(qa_db_search_posts_selectspec($userid, $words, $words, $words, $words, trim($keyword), 0, false, $limit)); $output = '<h3 class="widget-title">' . $title . '</h3>'; $output .= '<ul class="question-list">'; foreach ($posts as $post) { $post_type = $post['type']; if ($post_type == 'Q') { $what = qa_lang('cleanstrap/asked'); } elseif ($post_type == 'A') { $what = qa_lang('cleanstrap/answered'); } elseif ('C') { $what = qa_lang('cleanstrap/commented'); } $handle = qa_post_userid_to_handle($post['userid']); $avatar = cs_get_post_avatar($post, $avatar_size); $output .= '<li id="q-list-' . $post['postid'] . '" class="question-item">'; $output .= '<div class="pull-left avatar" data-handle="' . $handle . '" data-id="' . $post['userid'] . '">' . $avatar . '</div>'; $output .= '<div class="list-right">'; if ($post_type == 'Q') { $output .= '<a class="title" href="' . qa_q_path_html($post['postid'], $post['title']) . '" title="' . $post['title'] . '">' . cs_truncate(strip_tags($post['title']), 70) . '</a>'; } elseif ($post_type == 'A') { $output .= '<p><a href="' . cs_post_link($post['parentid']) . '#a' . $post['postid'] . '">' . cs_truncate(strip_tags($post['content']), 70) . '</a></p>'; } else { $output .= '<p><a href="' . cs_post_link($post['parentid']) . '#c' . $post['postid'] . '">' . cs_truncate(strip_tags($post['content']), 70) . '</a></p>'; } $output .= '<div class="meta"><a href="' . qa_path_html('user/' . $handle) . '">' . cs_name($handle) . '</a> ' . $what; if ($post_type == 'Q') { $output .= ' <span class="vote-count">' . $post['netvotes'] . ' votes</span>'; $output .= ' <span class="ans-count">' . $post['acount'] . ' ans</span>'; } elseif ($post_type == 'A') { $output .= ' <span class="vote-count">' . $post['netvotes'] . ' votes</span>'; } $output .= '</div></div>'; $output .= '</li>'; } $output .= '</ul>'; if ($return) { return $output; } echo $output; return; } } else { return; } $output = '<h3 class="widget-title">' . $title . '</h3>'; $output .= '<ul class="question-list">'; foreach ($posts as $p) { if (empty($p['userid'])) { $p['userid'] = NULL; } // to prevent error for anonymous posts while calling qa_post_userid_to_handle() if ($post_type == 'Q') { $what = qa_lang_html('cleanstrap/asked'); } elseif ($post_type == 'A') { $what = qa_lang_html('cleanstrap/answered'); } elseif ('C') { $what = qa_lang_html('cleanstrap/commented'); } $handle = qa_post_userid_to_handle($p['userid']); $avatar = cs_get_avatar($handle, 35, false); $output .= '<li id="q-list-' . $p['postid'] . '" class="question-item">'; $output .= '<div class="pull-left avatar" data-handle="' . $handle . '" data-id="' . qa_handle_to_userid($handle) . '">' . (isset($avatar) ? '<img src="' . $avatar . '" />' : '') . '</div>'; $output .= '<div class="list-right">'; if ($post_type == 'Q') { $output .= '<a class="title" href="' . qa_q_path_html($p['postid'], $p['title']) . '" title="' . $p['title'] . '">' . cs_truncate(qa_html($p['title']), 70) . '</a>'; } elseif ($post_type == 'A') { $output .= '<p><a href="' . cs_post_link($p['parentid']) . '#a' . $p['postid'] . '">' . cs_truncate(strip_tags($p['content']), 70) . '</a></p>'; } else { $output .= '<p><a href="' . cs_post_link($p['parentid']) . '#c' . $p['postid'] . '">' . cs_truncate(strip_tags($p['content']), 70) . '</a></p>'; } $output .= '<div class="meta"><a href="' . qa_path_html('user/' . $handle) . '">' . cs_name($handle) . '</a> ' . $what; if ($post_type == 'Q') { $output .= ' <span class="vote-count">' . $p['netvotes'] . ' votes</span>'; $output .= ' <span class="ans-count">' . $p['acount'] . ' ans</span>'; } elseif ($post_type == 'A') { $output .= ' <span class="vote-count">' . $p['netvotes'] . ' votes</span>'; } $output .= '</div></div>'; $output .= '</li>'; } $output .= '</ul>'; if ($return) { return $output; } echo $output; }
function cs_events($limit = 10, $events_type = false) { if (!$events_type) { $events_type = array('q_post', 'a_post', 'c_post', 'a_select', 'badge_awarded'); } // query last 3 events $posts = qa_db_read_all_assoc(qa_db_query_sub('SELECT datetime,ipaddress,handle,event,params FROM ^eventlog WHERE event IN ("q_post", "a_post", "c_post") ORDER BY datetime DESC LIMIT #', $limit)); if (empty($posts)) { return; } $postids = ''; $i = 1; foreach ($posts as $post) { $params = preg_replace('/\\s+/', '&', $post['params']); parse_str($params, $data); $postids .= ($i != 1 ? ', ' : '') . $data['postid']; $i++; } $posts = qa_db_read_all_assoc(qa_db_query_sub('SELECT ^posts.* , ^users.handle FROM ^posts, ^users WHERE (^posts.userid=^users.userid AND ^posts.postid IN (' . $postids . ')) AND ^posts.type IN ("Q", "A", "C") ORDER BY ^posts.created DESC')); $o = '<ul class="ra-activity">'; foreach ($posts as $p) { $event_name = ''; $event_icon = ''; if ($p['type'] == 'Q') { $event_name = qa_lang('cleanstrap/asked'); $event_icon = 'icon-question'; } else { if ($p['type'] == 'A') { $event_name = qa_lang('cleanstrap/answered'); $event_icon = 'icon-answer'; } else { $event_name = qa_lang('cleanstrap/commented'); $event_icon = 'icon-chat'; } } $username = is_null($p['handle']) ? qa_lang('cleanstrap/anonymous') : htmlspecialchars($p['handle']); $usernameLink = is_null($p['handle']) ? qa_lang('cleanstrap/anonymous') : '<a href="' . qa_path_html('user/' . $p['handle']) . '">' . $p['handle'] . '</a>'; $timeCode = qa_when_to_html(strtotime($p['created']), 7); $time = @$timeCode['prefix'] . @$timeCode['data'] . @$timeCode['suffix']; $o .= '<li class="event-item">'; $o .= '<div class="event-inner">'; $o .= '<div class="event-icon pull-left ' . $event_icon . '"></div>'; $o .= '<div class="event-content">'; $o .= '<p class="title"><strong class="avatar" data-handle="' . $p['handle'] . '" data-id="' . $p['userid'] . '">' . @$usernameLink . '</strong> <span class="what">' . $event_name . '</span></p>'; if ($p['type'] == 'Q') { $o .= '<a class="event-title" href="' . qa_q_path_html($p['postid'], $p['title']) . '" title="' . $p['title'] . '">' . cs_truncate($p['title'], 100) . '</a>'; } elseif ($p['type'] == 'A') { $o .= '<a class="event-title" href="' . cs_post_link($p['parentid']) . '#a' . $p['postid'] . '">' . cs_truncate(strip_tags($p['content']), 100) . '</a>'; } else { $o .= '<a class="event-title" href="' . cs_post_link($p['parentid']) . '#c' . $p['postid'] . '">' . cs_truncate(strip_tags($p['content']), 100) . '</a>'; } $o .= '<span class="time">' . $time . '</span>'; $o .= '</div>'; $o .= '</div>'; $o .= '</li>'; } $o .= '</ul>'; return $o; }
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; } } } /* Omit PHP closing tag to help avoid accidental output */