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 }
GNU General Public License for more details. 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 . 'db/selects.php'; require_once QA_INCLUDE_DIR . 'app/format.php'; $categoryslugs = qa_request_parts(1); $countslugs = count($categoryslugs); // Get information about appropriate categories and redirect to questions page if category has no sub-categories $userid = qa_get_logged_in_userid(); list($categories, $categoryid, $favoritecats) = qa_db_select_with_pending(qa_db_category_nav_selectspec($categoryslugs, false, false, true), $countslugs ? qa_db_slugs_to_category_id_selectspec($categoryslugs) : null, isset($userid) ? qa_db_user_favorite_categories_selectspec($userid) : null); if ($countslugs && !isset($categoryid)) { return include QA_INCLUDE_DIR . 'qa-page-not-found.php'; } // Function for recursive display of categories function qa_category_nav_to_browse(&$navigation, $categories, $categoryid, $favoritemap) { foreach ($navigation as $key => $navlink) { $category = $categories[$navlink['categoryid']]; if (!$category['childcount']) { unset($navigation[$key]['url']); } elseif ($navlink['selected']) { $navigation[$key]['state'] = 'open'; $navigation[$key]['url'] = qa_path_html('categories/' . qa_category_path_request($categories, $category['parentid'])); } else { $navigation[$key]['state'] = 'closed';
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) {
/** * Run the appropriate qa-page-*.php file for this request and return back the $qa_content it passed */ function qa_get_request_content() { if (qa_to_override(__FUNCTION__)) { $args = func_get_args(); return qa_call_override(__FUNCTION__, $args); } $requestlower = strtolower(qa_request()); $requestparts = qa_request_parts(); $firstlower = strtolower($requestparts[0]); $routing = qa_page_routing(); //AGGIUNTO DA BAFIO $favoritecategory = array(); $userid = qa_get_logged_in_userid(); if ($userid) { $categories = qa_db_select_with_pending(qa_db_user_favorite_categories_selectspec($userid)); foreach ($categories as $cat) { $backpath = array_reverse(explode('/', $cat['backpath'])); if (count($backpath) > 2) { array_push($favoritecategory, $backpath); } $backpath = null; } } if (isset($routing[$requestlower])) { qa_set_template($firstlower); $qa_content = (require QA_INCLUDE_DIR . $routing[$requestlower]); } elseif (isset($routing[$firstlower . '/'])) { qa_set_template($firstlower); $qa_content = (require QA_INCLUDE_DIR . $routing[$firstlower . '/']); } elseif (is_numeric($requestparts[0])) { qa_set_template('question'); $qa_content = (require QA_INCLUDE_DIR . 'pages/question.php'); } else { if (qa_get_logged_in_userid() && $requestparts[0] == '' && count($favoritecategory)) { qa_set_template(strlen($firstlower) ? $firstlower : 'qa'); // will be changed later $qa_content = (require QA_INCLUDE_DIR . 'pages/login-default.php'); // handles many other pages, including custom pages and page modules } else { qa_set_template(strlen($firstlower) ? $firstlower : 'qa'); // will be changed later $qa_content = (require QA_INCLUDE_DIR . 'pages/default.php'); // handles many other pages, including custom pages and page modules } } if ($firstlower == 'admin') { $_COOKIE['qa_admin_last'] = $requestlower; // for navigation tab now... setcookie('qa_admin_last', $_COOKIE['qa_admin_last'], 0, '/', QA_COOKIE_DOMAIN); // ...and in future } if (isset($qa_content)) { qa_set_form_security_key(); } return $qa_content; }
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');