Exemple #1
0
/**
 * 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;
}
    }
}
//	Then, check whether we are showing a custom home page
if (!$explicitqa && !$countslugs && qa_opt('show_custom_home')) {
    qa_set_template('custom');
    $qa_content = qa_content_prepare();
    $qa_content['title'] = qa_html(qa_opt('custom_home_heading'));
    if (qa_opt('show_home_description')) {
        $qa_content['description'] = qa_html(qa_opt('home_description'));
    }
    $qa_content['custom'] = qa_opt('custom_home_content');
    return $qa_content;
}
//	If we got this far, it's a good old-fashioned Q&A listing page
require_once QA_INCLUDE_DIR . 'app/q-list.php';
qa_set_template('qa');
$questions = qa_any_sort_and_dedupe(array_merge($questions1, $questions2));
$pagesize = qa_opt('page_size_home');
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/recent_qs_as_in_x', $categorytitlehtml);
    $nonetitle = qa_lang_html_sub('main/no_questions_in_x', $categorytitlehtml);
} else {
    $sometitle = qa_lang_html('main/recent_qs_as_title');
    $nonetitle = qa_lang_html('main/no_questions_found');
}
//	Prepare and return content for theme for Q&A listing page
$qa_content = qa_q_list_page_content($questions, $pagesize, 0, null, $sometitle, $nonetitle, $categories, $categoryid, true, $explicitqa ? 'qa/' : '', qa_opt('feed_for_qa') ? 'qa' : null, count($questions) < $pagesize ? qa_html_suggest_ask($categoryid) : qa_html_suggest_qs_tags(qa_using_tags(), qa_category_path_request($categories, $categoryid)), null, null);
	Version: See define()s at top of qa-include/qa-base.php
	Description: Controller for page not found (error 404)


	This program is free software; you can redistribute it and/or
	modify it under the terms of the GNU General Public License
	as published by the Free Software Foundation; either version 2
	of the License, or (at your option) any later version.
	
	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 . 'qa-app-format.php';
header('HTTP/1.0 404 Not Found');
qa_set_template('not-found');
$qa_content = qa_content_prepare();
$qa_content['error'] = qa_lang_html('main/page_not_found');
$qa_content['suggest_next'] = qa_html_suggest_qs_tags(qa_using_tags());
return $qa_content;
/*
	Omit PHP closing tag to help avoid accidental output
*/
Exemple #4
0
    $userhtml = qa_html($handle);
}
//	Display the appropriate page based on the request
switch (qa_request_part(2)) {
    case 'wall':
        qa_set_template('user-wall');
        $qa_content = (include QA_INCLUDE_DIR . 'pages/user-wall.php');
        break;
    case 'activity':
        qa_set_template('user-activity');
        $qa_content = (include QA_INCLUDE_DIR . 'pages/user-activity.php');
        break;
    case 'questions':
        qa_set_template('user-questions');
        $qa_content = (include QA_INCLUDE_DIR . 'pages/user-questions.php');
        break;
    case 'answers':
        qa_set_template('user-answers');
        $qa_content = (include QA_INCLUDE_DIR . 'pages/user-answers.php');
        break;
    case null:
        $qa_content = (include QA_INCLUDE_DIR . 'pages/user-profile.php');
        break;
    default:
        $qa_content = (include QA_INCLUDE_DIR . 'qa-page-not-found.php');
        break;
}
return $qa_content;
/*
	Omit PHP closing tag to help avoid accidental output
*/
Exemple #5
0
/**
 *	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;
}
Exemple #6
0
/**
 *	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;
}