Ejemplo n.º 1
0
function qa_get_options($names)
{
    global $qa_options_cache, $qa_options_loaded;
    //	If any options not cached, retrieve them from database via standard pending mechanism
    if (!$qa_options_loaded) {
        qa_preload_options();
    }
    if (!$qa_options_loaded) {
        require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
        qa_load_options_results(array(qa_db_get_pending_result('options'), qa_db_get_pending_result('time')));
    }
    //	Pull out the options specifically requested here, and assign defaults
    $options = array();
    foreach ($names as $name) {
        if (!isset($qa_options_cache[$name])) {
            $todatabase = true;
            switch ($name) {
                // don't write default to database if option was deprecated, or depends on site language (which could be changed)
                case 'custom_sidebar':
                case 'site_title':
                case 'email_privacy':
                case 'answer_needs_login':
                case 'ask_needs_login':
                case 'comment_needs_login':
                case 'db_time':
                    $todatabase = false;
                    break;
            }
            qa_set_option($name, qa_default_option($name), $todatabase);
        }
        $options[$name] = $qa_options_cache[$name];
    }
    return $options;
}
Ejemplo n.º 2
0
function qa_page_queue_pending()
{
    if (qa_to_override(__FUNCTION__)) {
        $args = func_get_args();
        return qa_call_override(__FUNCTION__, $args);
    }
    qa_preload_options();
    $loginuserid = qa_get_logged_in_userid();
    if (isset($loginuserid)) {
        if (!QA_FINAL_EXTERNAL_USERS) {
            qa_db_queue_pending_select('loggedinuser', qa_db_user_account_selectspec($loginuserid, true));
        }
        qa_db_queue_pending_select('notices', qa_db_user_notices_selectspec($loginuserid));
    }
    qa_db_queue_pending_select('navpages', qa_db_pages_selectspec(array('B', 'M', 'O', 'F')));
    qa_db_queue_pending_select('widgets', qa_db_widgets_selectspec());
}
Ejemplo n.º 3
0
}
function qa_feed_load_ifcategory($categoryslugs, $allkey, $catkey, &$title, $questionselectspec1 = null, $questionselectspec2 = null, $questionselectspec3 = null, $questionselectspec4 = null)
{
    $countslugs = @count($categoryslugs);
    list($questions1, $questions2, $questions3, $questions4, $categories, $categoryid) = qa_db_select_with_pending($questionselectspec1, $questionselectspec2, $questionselectspec3, $questionselectspec4, $countslugs ? qa_db_category_nav_selectspec($categoryslugs, false) : null, $countslugs ? qa_db_slugs_to_category_id_selectspec($categoryslugs) : null);
    if ($countslugs && !isset($categoryid)) {
        qa_feed_not_found();
    }
    if (isset($allkey)) {
        $title = isset($categoryid) && isset($catkey) ? qa_lang_sub($catkey, $categories[$categoryid]['title']) : qa_lang($allkey);
    }
    return array_merge(is_array($questions1) ? $questions1 : array(), is_array($questions2) ? $questions2 : array(), is_array($questions3) ? $questions3 : array(), is_array($questions4) ? $questions4 : array());
}
//	Connect to database and get the type of feed and category requested (in some cases these are overridden later)
qa_db_connect('qa_feed_db_fail_handler');
qa_preload_options();
$requestlower = strtolower(qa_request());
$foursuffix = substr($requestlower, -4);
if ($foursuffix == '.rss' || $foursuffix == '.xml') {
    $requestlower = substr($requestlower, 0, -4);
}
$requestlowerparts = explode('/', $requestlower);
$feedtype = @$requestlowerparts[1];
$feedparams = array_slice($requestlowerparts, 2);
//	Choose which option needs to be checked to determine if this feed can be requested, and stop if no matches
$feedoption = null;
$categoryslugs = $feedparams;
switch ($feedtype) {
    case 'questions':
        $feedoption = 'feed_for_questions';
        break;