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 }
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>'); } }
More about this license: http://www.question2answer.org/license.php */ if (!defined('QA_VERSION')) { // don't allow this page to be requested directly from browser header('Location: ../'); exit; } require_once QA_INCLUDE_DIR . 'qa-db-selects.php'; require_once QA_INCLUDE_DIR . 'qa-app-format.php'; // Check that we're logged in $userid = qa_get_logged_in_userid(); if (!isset($userid)) { qa_redirect('login'); } // Get lists of favorites for this user @(list($questions, $users, $tags, $categories) = qa_db_select_with_pending(qa_db_user_favorite_qs_selectspec($userid), QA_FINAL_EXTERNAL_USERS ? null : qa_db_user_favorite_users_selectspec($userid), qa_db_user_favorite_tags_selectspec($userid), qa_db_user_favorite_categories_selectspec($userid))); $usershtml = qa_userids_handles_html(QA_FINAL_EXTERNAL_USERS ? $questions : array_merge($questions, $users)); // Prepare and return content for theme $qa_content = qa_content_prepare(true); $qa_content['title'] = qa_lang_html('misc/my_favorites_title'); // Favorite questions $qa_content['q_list'] = array('title' => count($questions) ? qa_lang_html('main/nav_qs') : qa_lang_html('misc/no_favorite_qs'), 'qs' => array()); if (count($questions)) { $qa_content['q_list']['form'] = array('tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '"'); $options = qa_post_html_defaults('Q'); foreach ($questions as $question) { $qa_content['q_list']['qs'][] = qa_post_html_fields($question, $userid, qa_cookie_get(), $usershtml, null, $options); } } // Favorite users if (!QA_FINAL_EXTERNAL_USERS) {
header('Location: ../'); exit; } require_once QA_INCLUDE_DIR . 'db/selects.php'; require_once QA_INCLUDE_DIR . 'app/format.php'; require_once QA_INCLUDE_DIR . 'app/favorites.php'; // Check that we're logged in $userid = qa_get_logged_in_userid(); if (!isset($userid)) { qa_redirect('login'); } // Get lists of favorites for this user $pagesize_qs = qa_opt('page_size_qs'); $pagesize_users = qa_opt('page_size_users'); $pagesize_tags = qa_opt('page_size_tags'); list($numQs, $questions, $numUsers, $users, $numTags, $tags, $categories) = qa_db_select_with_pending(qa_db_selectspec_count(qa_db_user_favorite_qs_selectspec($userid)), qa_db_user_favorite_qs_selectspec($userid, $pagesize_qs), QA_FINAL_EXTERNAL_USERS ? null : qa_db_selectspec_count(qa_db_user_favorite_users_selectspec($userid)), QA_FINAL_EXTERNAL_USERS ? null : qa_db_user_favorite_users_selectspec($userid, $pagesize_users), qa_db_selectspec_count(qa_db_user_favorite_tags_selectspec($userid)), qa_db_user_favorite_tags_selectspec($userid, $pagesize_tags), qa_db_user_favorite_categories_selectspec($userid)); $usershtml = qa_userids_handles_html(QA_FINAL_EXTERNAL_USERS ? $questions : array_merge($questions, $users)); // Prepare and return content for theme $qa_content = qa_content_prepare(true); $qa_content['title'] = qa_lang_html('misc/my_favorites_title'); // Favorite questions $qa_content['q_list'] = qa_favorite_q_list_view($questions, $usershtml); $qa_content['q_list']['title'] = count($questions) ? qa_lang_html('main/nav_qs') : qa_lang_html('misc/no_favorite_qs'); if ($numQs['count'] > count($questions)) { $url = qa_path_html('favorites/questions', array('start' => $pagesize_qs)); $qa_content['q_list']['footer'] = '<p class="qa-link-next"><a href="' . $url . '">' . qa_lang_html('misc/more_favorite_qs') . '</a></p>'; } // Favorite users if (!QA_FINAL_EXTERNAL_USERS) { $qa_content['ranking_users'] = qa_favorite_users_view($users, $usershtml); $qa_content['ranking_users']['title'] = count($users) ? qa_lang_html('main/nav_users') : qa_lang_html('misc/no_favorite_users');