function navigation() { $request = qa_request_parts(); if (!empty($request) && is_array($request)) { return $request; } }
/** * adds blog admin pages to the request handlers * * @return mixed */ function qa_get_request_content() { $requestlower = strtolower(qa_request()); $requestparts = qa_request_parts(); $firstlower = strtolower(@$requestparts[0]); $secondlower = strtolower(@$requestparts[1]); $routing = qa_page_routing(); $route_part = ''; if (!empty($firstlower) && !empty($secondlower)) { $route_part = $firstlower . '/' . $secondlower . '/'; } if (!isset($routing[$requestlower]) && $route_part === 'admin/donut-theme/') { //for loading the default setting file qa_set_template($firstlower); $qa_content = (require QA_INCLUDE_DIR . $routing[$route_part]); 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 } } else { //otherwise load the original qa_get_request_content function $qa_content = qa_get_request_content_base(); } return $qa_content; }
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'; $start = qa_get_start(); $userid = qa_get_logged_in_userid(); $categoryslugs = qa_request_parts(1); //$selectspec = qa_db_qs_selectspec($userid, 'created', $start, $categoryslugs, null, false, false, qa_opt_if_loaded('page_size_qs')); $selectspec = qa_db_posts_basic_selectspec($userid, false); $selectspec['source'] .= ' JOIN ^postmeta ON ^posts.postid=^postmeta.post_id AND ^postmeta.meta_key=$ AND ^postmeta.meta_value>0' . (is_array($this->expert_user) ? ' AND ^posts.categoryid IN (#)' : ' AND $'); //$selectspec['source'].=' JOIN (SELECT postid FROM ^posts WHERE type=$ ORDER BY ^posts.created DESC LIMIT #,#) y ON ^posts.postid=y.postid'; $selectspec['arguments'] = array_merge($selectspec['arguments'], array('is_expert_question', $this->expert_user)); $questions = qa_db_select_with_pending($selectspec); $nonetitle = qa_lang_html('main/no_questions_found'); 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_opt('expert_question_page_title'), $nonetitle, null, null, false, null, null, null, null); return $qa_content; }
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 . '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 unanswered questions, allow per-category if QA_ALLOW_UNINDEXED_QUERIES set in qa-config.php if (QA_ALLOW_UNINDEXED_QUERIES) { $categoryslugs = qa_request_parts(1); } else { $categoryslugs = null; } $countslugs = @count($categoryslugs); $by = qa_get('by'); $start = qa_get_start(); $userid = qa_get_logged_in_userid(); switch ($by) { case 'selected': $selectby = 'selchildid'; break; case 'upvotes': $selectby = 'amaxvote'; break; default:
function ra_cat_list($limit = 15) { $categoryslugs = qa_request_parts(1); $cats = qa_db_select_with_pending(qa_db_category_nav_selectspec($categoryslugs, false, false, true)); $cats = qa_category_navigation($cats); $output = '<ul class="ra-cat-list clearfix">'; $i = 1; foreach ($cats as $k => $c) { if ($k != 'all') { $output .= '<li><a class="icon-folder-close" title="' . @$c['popup'] . '" href="' . $c['url'] . '">' . $c['label'] . '<span>' . filter_var($c['note'], FILTER_SANITIZE_NUMBER_INT) . '</span></a></li>'; if ($limit == $i) { break; } $i++; } } $output .= '</ul>'; echo $output; }
/** * 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(); 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 { 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; }
/** * 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; }
function cs_full_categories_list($show_sub = false) { $level = 1; $navigation = @$this->content['navigation']['cat']; if (!isset($navigation)) { $categoryslugs = qa_request_parts(1); $cats = qa_db_select_with_pending(qa_db_category_nav_selectspec($categoryslugs, false, false, true)); $navigation = qa_category_navigation($cats); } if (count($navigation) > 1) { // if there are any categories (except 'all categories' navigation item) //$this->output( '<div class="qa-nav-cat">'); //$this->output( '<ul class="qa-nav-cat-list">'); $index = 0; if (isset($QA_CONST_PATH_MAP)) { $navigation['all']['url'] = qa_path_html($QA_CONST_PATH_MAP['categories']); } else { $navigation['all']['url'] = qa_path_html('categories'); } foreach ($navigation as $key => $navlink) { $this->set_context('nav_key', $key); $this->set_context('nav_index', $index++); $this->cs_full_categories_list_item($key, $navlink, '', $level, $show_sub); } $this->clear_context('nav_key'); $this->clear_context('nav_index'); //$this->output('</ul></div>'); } unset($navigation); }
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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/q-list.php'; // Get list of hottest questions, allow per-category if QA_ALLOW_UNINDEXED_QUERIES set in qa-config.php $categoryslugs = QA_ALLOW_UNINDEXED_QUERIES ? qa_request_parts(1) : null; $countslugs = @count($categoryslugs); $start = qa_get_start(); $userid = qa_get_logged_in_userid(); list($questions, $categories, $categoryid) = qa_db_select_with_pending(qa_db_qs_selectspec($userid, 'hotness', $start, $categoryslugs, null, false, false, qa_opt_if_loaded('page_size_hot_qs')), qa_db_category_nav_selectspec($categoryslugs, false, false, true), $countslugs ? qa_db_slugs_to_category_id_selectspec($categoryslugs) : null); 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/hot_qs_in_x', $categorytitlehtml); $nonetitle = qa_lang_html_sub('main/no_questions_in_x', $categorytitlehtml); } else { $sometitle = qa_lang_html('main/hot_qs_title'); $nonetitle = qa_lang_html('main/no_questions_found'); }
function donut_users_sub_navigation() { if (!QA_FINAL_EXTERNAL_USERS && qa_get_logged_in_level() >= QA_USER_LEVEL_MODERATOR) { $navigation = array('users$' => array('url' => qa_path_html('users'), 'label' => qa_lang_html('main/highest_users')), 'users/special' => array('label' => qa_lang('users/special_users'), 'url' => qa_path_html('users/special')), 'users/blocked' => array('label' => qa_lang('users/blocked_users'), 'url' => qa_path_html('users/blocked'))); $request_parts = qa_request_parts(); if (!empty($request_parts) && $request_parts[0] == 'users') { if (count($request_parts) == 1) { $navigation['users$']['selected'] = true; } else { if (count($request_parts) > 1 && $request_parts[1] == 'special') { $navigation['users/special']['selected'] = true; } else { if (count($request_parts) > 1 && $request_parts[1] == 'blocked') { $navigation['users/blocked']['selected'] = true; } } } } return $navigation; } else { return null; } }
function output_widget($region, $place, $themeobject, $template, $request, $qa_content) { $AdsPos = (int) qa_opt('tw_ads_pos'); 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 = qa_request_parts(1); $countslugs = count($categoryslugs); $sort = 'created'; $userid = qa_get_logged_in_userid(); $questions = qa_db_select_with_pending(qa_db_qs_selectspec($userid, 'created', 0, '', null, false, false, (int) qa_opt('tw_recent_number'))); $hotquestions = qa_db_select_with_pending(qa_db_qs_selectspec($userid, 'hotness', 0, '', null, false, false, (int) qa_opt('tw_popular_number'))); $themeobject->output(' <ul class="tabs nav nav-tabs"> <li><a href="#tab1" class="active">' . qa_opt('tw_popular_lable') . '</a></li> <li><a href="#tab2">' . qa_opt('tw_recent_lable') . '</a></li> </ul> <div class="tab-content" id="tab1"> <ul class="popular"> '); $thumb = ''; $i = 0; foreach ($hotquestions as $question) { $i++; $questionid = $question['postid']; $questionlink = qa_path_html(qa_q_request($questionid, $question['title']), null, qa_opt('site_url')); $q_time = qa_when_to_html($question['created'], 7); $when = @$q_time['prefix'] . ' ' . @$q_time['data'] . ' ' . @$q_time['suffix']; // get question content $result = qa_db_query_sub('SELECT content FROM ^posts WHERE postid=#', $questionid); $postinfo = qa_db_read_one_assoc($result, 'postid'); if (qa_opt('tw_thumbnail_enable')) { // get thumbnail $doc = new DOMDocument(); @$doc->loadHTML($postinfo['content']); $xpath = new DOMXPath($doc); $src = $xpath->evaluate("string(//img/@src)"); $default_thumbnail = qa_opt('tw_thumbnail'); if (empty($src) && !empty($default_thumbnail)) { $src = qa_opt('tw_thumbnail'); } $thumb = ''; if (!empty($src)) { $thumb = '<div class="tab-div-thumb"><a class="tab-link-thumbnail" href="' . $questionlink . '"><img class="tab-thumbnail" width="60" height="50" src="' . $src . '"></a></div>'; } } $themeobject->output('<li>' . $thumb); $themeobject->output('<div class="tab-div-body"><a class="tab-link" href="' . $questionlink . '"><p class="tab-link-header">' . $question['title'] . '</p></a>'); $themeobject->output('<span class="tab-time">' . $when . '</span></div></li>'); $ads_content = qa_opt('tw_ads'); if ($i == $AdsPos && !empty($ads_content)) { $themeobject->output('<div class="tab-ads">' . qa_opt('tw_ads') . '</div>'); } } $themeobject->output(' </ul> </div> <div class="tab-content" id="tab2" style="display: none;"> <ul class="recent"> '); $i = 0; foreach ($questions as $question) { $i++; $questionid = $question['postid']; $questionlink = qa_path_html(qa_q_request($questionid, $question['title']), null, qa_opt('site_url')); $q_time = qa_when_to_html($question['created'], 7); $when = @$q_time['prefix'] . ' ' . @$q_time['data'] . ' ' . @$q_time['suffix']; // get question content $result = qa_db_query_sub('SELECT content FROM ^posts WHERE postid=#', $questionid); $postinfo = qa_db_read_one_assoc($result, 'postid'); if (qa_opt('tw_thumbnail_enable')) { // get thumbnail $doc = new DOMDocument(); @$doc->loadHTML($postinfo['content']); $xpath = new DOMXPath($doc); $src = $xpath->evaluate("string(//img/@src)"); $default_thumbnail = qa_opt('tw_thumbnail'); if (empty($src) && !empty($default_thumbnail)) { $src = qa_opt('tw_thumbnail'); } $thumb = ''; if (!empty($src)) { $thumb = '<div class="tab-div-thumb"><a class="tab-link-thumbnail" href="' . $questionlink . '"><img class="tab-thumbnail" width="60" height="50" src="' . $src . '"></a></div>'; } } $themeobject->output('<li>' . $thumb); $themeobject->output('<div class="tab-div-body"><a class="tab-link" href="' . $questionlink . '"><p class="tab-link-header">' . $question['title'] . '</p></a>'); $themeobject->output('<span class="tab-time">' . $when . '</span></div></li>'); $ads_content = qa_opt('tw_ads'); if ($i == $AdsPos && !empty($ads_content)) { $themeobject->output('<div class="tab-ads">' . qa_opt('tw_ads') . '</div>'); } } $themeobject->output(' </ul> </div> '); }
function useo_get_current_category_slug() { global $useo_category_slug; if (isset($useo_category_slug)) { return $useo_category_slug; } else { // check if it's a category or not $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])) { $useo_category_slug = false; return false; } $explicitqa = (strtolower($requestparts[0]) == 'qa' or strtolower($requestparts[0]) == 'unanswered' or strtolower($requestparts[0]) == 'questions' or strtolower($requestparts[0]) == 'activity'); if ($explicitqa) { $useo_category_slug = array_slice($requestparts, 1); } elseif (strlen($requestparts[0])) { $useo_category_slug = $requestparts; } else { $useo_category_slug = false; } return $useo_category_slug; } }