当前位置: 首页>>代码示例>>PHP>>正文


PHP qa_using_categories函数代码示例

本文整理汇总了PHP中qa_using_categories函数的典型用法代码示例。如果您正苦于以下问题:PHP qa_using_categories函数的具体用法?PHP qa_using_categories怎么用?PHP qa_using_categories使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了qa_using_categories函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: qa_q_list_page_content

function qa_q_list_page_content($questions, $pagesize, $start, $count, $sometitle, $nonetitle, $navcategories, $categoryid, $categoryqcount, $categorypathprefix, $feedpathprefix, $suggest, $pagelinkparams = null, $categoryparams = null, $dummy = null)
{
    if (qa_to_override(__FUNCTION__)) {
        $args = func_get_args();
        return qa_call_override(__FUNCTION__, $args);
    }
    require_once QA_INCLUDE_DIR . 'app/format.php';
    require_once QA_INCLUDE_DIR . 'app/updates.php';
    $userid = qa_get_logged_in_userid();
    //	Chop down to size, get user information for display
    if (isset($pagesize)) {
        $questions = array_slice($questions, 0, $pagesize);
    }
    $usershtml = qa_userids_handles_html(qa_any_get_userids_handles($questions));
    //	Prepare content for theme
    $qa_content = qa_content_prepare(true, array_keys(qa_category_path($navcategories, $categoryid)));
    $qa_content['q_list']['form'] = array('tags' => 'method="post" action="' . qa_self_html() . '"', 'hidden' => array('code' => qa_get_form_security_code('vote')));
    $qa_content['q_list']['qs'] = array();
    if (count($questions)) {
        $qa_content['title'] = $sometitle;
        $defaults = qa_post_html_defaults('Q');
        if (isset($categorypathprefix)) {
            $defaults['categorypathprefix'] = $categorypathprefix;
        }
        foreach ($questions as $question) {
            $fields = qa_any_to_q_html_fields($question, $userid, qa_cookie_get(), $usershtml, null, qa_post_html_options($question, $defaults));
            if (!empty($fields['raw']['closedbyid'])) {
                $fields['closed'] = array('state' => qa_lang_html('main/closed'));
            }
            $qa_content['q_list']['qs'][] = $fields;
        }
    } else {
        $qa_content['title'] = $nonetitle;
    }
    if (isset($userid) && isset($categoryid)) {
        $favoritemap = qa_get_favorite_non_qs_map();
        $categoryisfavorite = @$favoritemap['category'][$navcategories[$categoryid]['backpath']];
        $qa_content['favorite'] = qa_favorite_form(QA_ENTITY_CATEGORY, $categoryid, $categoryisfavorite, qa_lang_sub($categoryisfavorite ? 'main/remove_x_favorites' : 'main/add_category_x_favorites', $navcategories[$categoryid]['title']));
    }
    if (isset($count) && isset($pagesize)) {
        $qa_content['page_links'] = qa_html_page_links(qa_request(), $start, $pagesize, $count, qa_opt('pages_prev_next'), $pagelinkparams);
    }
    if (empty($qa_content['page_links'])) {
        $qa_content['suggest_next'] = $suggest;
    }
    if (qa_using_categories() && count($navcategories) && isset($categorypathprefix)) {
        $qa_content['navigation']['cat'] = qa_category_navigation($navcategories, $categoryid, $categorypathprefix, $categoryqcount, $categoryparams);
    }
    if (isset($feedpathprefix) && (qa_opt('feed_per_category') || !isset($categoryid))) {
        $qa_content['feed'] = array('url' => qa_path_html(qa_feed_request($feedpathprefix . (isset($categoryid) ? '/' . qa_category_path_request($navcategories, $categoryid) : ''))), 'label' => strip_tags($sometitle));
    }
    return $qa_content;
}
开发者ID:kosmoluna,项目名称:question2answer,代码行数:53,代码来源:q-list.php

示例2: qa_q_list_page_content

function qa_q_list_page_content($questions, $pagesize, $start, $count, $sometitle, $nonetitle, $navcategories, $categoryid, $categoryqcount, $categorypathprefix, $feedpathprefix, $suggest, $pagelinkparams = array())
{
    require_once QA_INCLUDE_DIR . 'qa-app-format.php';
    global $qa_login_userid, $qa_cookieid, $qa_request;
    // get globals from qa-page.php
    //	Chop down to size, get user information for display
    if (isset($pagesize)) {
        $questions = array_slice($questions, 0, $pagesize);
    }
    $usershtml = qa_userids_handles_html(qa_any_get_userids_handles($questions));
    //	Prepare content for theme
    $qa_content = qa_content_prepare(true, array_keys(qa_category_path($navcategories, $categoryid)));
    $qa_content['q_list']['form'] = array('tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '"');
    $qa_content['q_list']['qs'] = array();
    if (count($questions)) {
        $qa_content['title'] = $sometitle;
        $options = qa_post_html_defaults('Q');
        if (isset($categorypathprefix)) {
            $options['categorypathprefix'] = $categorypathprefix;
        }
        foreach ($questions as $question) {
            $qa_content['q_list']['qs'][] = qa_any_to_q_html_fields($question, $qa_login_userid, $qa_cookieid, $usershtml, null, $options);
        }
    } else {
        $qa_content['title'] = $nonetitle;
    }
    if (isset($count) && isset($pagesize)) {
        $qa_content['page_links'] = qa_html_page_links($qa_request, $start, $pagesize, $count, qa_opt('pages_prev_next'), $pagelinkparams);
    }
    if (empty($qa_content['page_links'])) {
        $qa_content['suggest_next'] = $suggest;
    }
    if (qa_using_categories() && count($navcategories) && isset($categorypathprefix)) {
        $qa_content['navigation']['cat'] = qa_category_navigation($navcategories, $categoryid, $categorypathprefix, $categoryqcount);
    }
    if (isset($feedpathprefix) && (qa_opt('feed_per_category') || !isset($categoryid))) {
        $qa_content['feed'] = array('url' => qa_path_html(qa_feed_request($feedpathprefix . (isset($categoryid) ? '/' . qa_category_path_request($navcategories, $categoryid) : ''))), 'label' => strip_tags($sometitle));
    }
    return $qa_content;
}
开发者ID:TheProjecter,项目名称:microprobe,代码行数:40,代码来源:qa-app-q-list.php

示例3: qa_content_prepare

$qa_content = qa_content_prepare();
$qa_content['title'] = qa_lang_html('admin/admin_title') . ' - ' . qa_lang_html('admin/stats_title');
$qa_content['error'] = qa_admin_page_error();
$qa_content['form'] = array('style' => 'wide', 'fields' => array('q2a_version' => array('label' => qa_lang_html('admin/q2a_version'), 'value' => qa_html(QA_VERSION)), 'q2a_date' => array('label' => qa_lang_html('admin/q2a_build_date'), 'value' => qa_html(QA_BUILD_DATE)), 'q2a_latest' => array('label' => qa_lang_html('admin/q2a_latest_version'), 'type' => 'custom', 'html' => '<iframe src="http://www.question2answer.org/question2answer-latest.php?version=' . urlencode(QA_VERSION) . '&language=' . urlencode(qa_opt('site_language')) . '" width="100" height="16" style="vertical-align:middle; border:0; background:transparent;" allowTransparency="true" scrolling="no" frameborder="0"></iframe>'), 'break0' => array('type' => 'blank'), 'db_version' => array('label' => qa_lang_html('admin/q2a_db_version'), 'value' => qa_html(qa_opt('db_version'))), 'db_size' => array('label' => qa_lang_html('admin/q2a_db_size'), 'value' => qa_html(number_format(qa_db_table_size() / 1048576, 1) . ' MB')), 'break1' => array('type' => 'blank'), 'php_version' => array('label' => qa_lang_html('admin/php_version'), 'value' => qa_html(phpversion())), 'mysql_version' => array('label' => qa_lang_html('admin/mysql_version'), 'value' => qa_html(qa_db_mysql_version())), 'break2' => array('type' => 'blank'), 'qcount' => array('label' => qa_lang_html('admin/total_qs'), 'value' => qa_html(number_format($qcount))), 'qcount_users' => array('label' => qa_lang_html('admin/from_users'), 'value' => qa_html(number_format($qcount - $qcount_anon))), 'qcount_anon' => array('label' => qa_lang_html('admin/from_anon'), 'value' => qa_html(number_format($qcount_anon))), 'break3' => array('type' => 'blank'), 'acount' => array('label' => qa_lang_html('admin/total_as'), 'value' => qa_html(number_format($acount))), 'acount_users' => array('label' => qa_lang_html('admin/from_users'), 'value' => qa_html(number_format($acount - $acount_anon))), 'acount_anon' => array('label' => qa_lang_html('admin/from_anon'), 'value' => qa_html(number_format($acount_anon))), 'break4' => array('type' => 'blank'), 'ccount' => array('label' => qa_lang_html('admin/total_cs'), 'value' => qa_html(number_format($ccount))), 'ccount_users' => array('label' => qa_lang_html('admin/from_users'), 'value' => qa_html(number_format($ccount - $ccount_anon))), 'ccount_anon' => array('label' => qa_lang_html('admin/from_anon'), 'value' => qa_html(number_format($ccount_anon))), 'break5' => array('type' => 'blank'), 'users' => array('label' => qa_lang_html('admin/users_registered'), 'value' => QA_FINAL_EXTERNAL_USERS ? '' : qa_html(number_format(qa_db_count_users()))), 'users_active' => array('label' => qa_lang_html('admin/users_active'), 'value' => qa_html(number_format((int) qa_opt('cache_userpointscount')))), 'users_posted' => array('label' => qa_lang_html('admin/users_posted'), 'value' => qa_html(number_format(qa_db_count_active_users('posts')))), 'users_voted' => array('label' => qa_lang_html('admin/users_voted'), 'value' => qa_html(number_format(qa_db_count_active_users('uservotes'))))));
if (QA_FINAL_EXTERNAL_USERS) {
    unset($qa_content['form']['fields']['users']);
} else {
    unset($qa_content['form']['fields']['users_active']);
}
foreach ($qa_content['form']['fields'] as $index => $field) {
    if (empty($field['type'])) {
        $qa_content['form']['fields'][$index]['type'] = 'static';
    }
}
$qa_content['form_2'] = array('tags' => 'method="post" action="' . qa_path_html('admin/recalc') . '"', 'title' => qa_lang_html('admin/database_cleanup'), 'style' => 'basic', 'buttons' => array('recount_posts' => array('label' => qa_lang_html('admin/recount_posts'), 'tags' => 'name="dorecountposts" onclick="return qa_recalc_click(this.name, this, ' . qa_js(qa_lang_html('admin/recount_posts_stop')) . ', \'recount_posts_note\');"', 'note' => '<span id="recount_posts_note">' . qa_lang_html('admin/recount_posts_note') . '</span>'), 'reindex_content' => array('label' => qa_lang_html('admin/reindex_content'), 'tags' => 'name="doreindexcontent" onclick="return qa_recalc_click(this.name, this, ' . qa_js(qa_lang_html('admin/reindex_content_stop')) . ', \'reindex_content_note\');"', 'note' => '<span id="reindex_content_note">' . qa_lang_html('admin/reindex_content_note') . '</span>'), 'recalc_points' => array('label' => qa_lang_html('admin/recalc_points'), 'tags' => 'name="dorecalcpoints" onclick="return qa_recalc_click(this.name, this, ' . qa_js(qa_lang_html('admin/recalc_stop')) . ', \'recalc_points_note\');"', 'note' => '<span id="recalc_points_note">' . qa_lang_html('admin/recalc_points_note') . '</span>'), 'refill_events' => array('label' => qa_lang_html('admin/refill_events'), 'tags' => 'name="dorefillevents" onclick="return qa_recalc_click(this.name, this, ' . qa_js(qa_lang_html('admin/recalc_stop')) . ', \'refill_events_note\');"', 'note' => '<span id="refill_events_note">' . qa_lang_html('admin/refill_events_note') . '</span>'), 'recalc_categories' => array('label' => qa_lang_html('admin/recalc_categories'), 'tags' => 'name="dorecalccategories" onclick="return qa_recalc_click(this.name, this, ' . qa_js(qa_lang_html('admin/recalc_stop')) . ', \'recalc_categories_note\');"', 'note' => '<span id="recalc_categories_note">' . qa_lang_html('admin/recalc_categories_note') . '</span>'), 'delete_hidden' => array('label' => qa_lang_html('admin/delete_hidden'), 'tags' => 'name="dodeletehidden" onclick="return qa_recalc_click(this.name, this, ' . qa_js(qa_lang_html('admin/delete_stop')) . ', \'delete_hidden_note\');"', 'note' => '<span id="delete_hidden_note">' . qa_lang_html('admin/delete_hidden_note') . '</span>')), 'hidden' => array('code' => qa_get_form_security_code('admin/recalc')));
if (!qa_using_categories()) {
    unset($qa_content['form_2']['buttons']['recalc_categories']);
}
if (defined('QA_BLOBS_DIRECTORY')) {
    if (qa_db_has_blobs_in_db()) {
        $qa_content['form_2']['buttons']['blobs_to_disk'] = array('label' => qa_lang_html('admin/blobs_to_disk'), 'tags' => 'name="doblobstodisk" onclick="return qa_recalc_click(this.name, this, ' . qa_js(qa_lang_html('admin/blobs_stop')) . ', \'blobs_to_disk_note\');"', 'note' => '<span id="blobs_to_disk_note">' . qa_lang_html('admin/blobs_to_disk_note') . '</span>');
    }
    if (qa_db_has_blobs_on_disk()) {
        $qa_content['form_2']['buttons']['blobs_to_db'] = array('label' => qa_lang_html('admin/blobs_to_db'), 'tags' => 'name="doblobstodb" onclick="return qa_recalc_click(this.name, this, ' . qa_js(qa_lang_html('admin/blobs_stop')) . ', \'blobs_to_db_note\');"', 'note' => '<span id="blobs_to_db_note">' . qa_lang_html('admin/blobs_to_db_note') . '</span>');
    }
}
$qa_content['script_rel'][] = 'qa-content/qa-admin.js?' . QA_VERSION;
$qa_content['script_var']['qa_warning_recalc'] = qa_lang('admin/stop_recalc_warning');
$qa_content['navigation']['sub'] = qa_admin_sub_navigation();
return $qa_content;
/*
开发者ID:kosmoluna,项目名称:question2answer,代码行数:31,代码来源:admin-stats.php

示例4: qa_page_q_question_view

function qa_page_q_question_view($question, $parentquestion, $closepost, $usershtml, $formrequested)
{
    $questionid = $question['postid'];
    $userid = qa_get_logged_in_userid();
    $cookieid = qa_cookie_get();
    $htmloptions = qa_post_html_defaults('Q', true);
    $htmloptions['answersview'] = false;
    // answer count is displayed separately so don't show it here
    $htmloptions['avatarsize'] = qa_opt('avatar_q_page_q_size');
    $q_view = qa_post_html_fields($question, $userid, $cookieid, $usershtml, null, $htmloptions);
    $q_view['main_form_tags'] = 'METHOD="POST" ACTION="' . qa_self_html() . '"';
    //	Buttons for operating on the question
    if (!$formrequested) {
        // don't show if another form is currently being shown on page
        $clicksuffix = ' onClick="qa_show_waiting_after(this, false);"';
        // add to operations that write to database
        $buttons = array();
        if ($question['editbutton']) {
            $buttons['edit'] = array('tags' => 'NAME="q_doedit"', 'label' => qa_lang_html('question/edit_button'), 'popup' => qa_lang_html('question/edit_q_popup'));
        }
        $hascategories = qa_using_categories();
        if ($question['retagcatbutton']) {
            $buttons['retagcat'] = array('tags' => 'NAME="q_doedit"', 'label' => qa_lang_html($hascategories ? 'question/recat_button' : 'question/retag_button'), 'popup' => qa_lang_html($hascategories ? qa_using_tags() ? 'question/retag_cat_popup' : 'question/recat_popup' : 'question/retag_popup'));
        }
        if ($question['flagbutton']) {
            $buttons['flag'] = array('tags' => 'NAME="q_doflag"' . $clicksuffix, 'label' => qa_lang_html($question['flagtohide'] ? 'question/flag_hide_button' : 'question/flag_button'), 'popup' => qa_lang_html('question/flag_q_popup'));
        }
        if ($question['unflaggable']) {
            $buttons['unflag'] = array('tags' => 'NAME="q_dounflag"' . $clicksuffix, 'label' => qa_lang_html('question/unflag_button'), 'popup' => qa_lang_html('question/unflag_popup'));
        }
        if ($question['clearflaggable']) {
            $buttons['clearflags'] = array('tags' => 'NAME="q_doclearflags"' . $clicksuffix, 'label' => qa_lang_html('question/clear_flags_button'), 'popup' => qa_lang_html('question/clear_flags_popup'));
        }
        if ($question['closeable']) {
            $buttons['close'] = array('tags' => 'NAME="q_doclose"', 'label' => qa_lang_html('question/close_button'), 'popup' => qa_lang_html('question/close_q_popup'));
        }
        if ($question['reopenable']) {
            $buttons['reopen'] = array('tags' => 'NAME="q_doreopen"' . $clicksuffix, 'label' => qa_lang_html('question/reopen_button'));
        }
        if ($question['moderatable']) {
            $buttons['approve'] = array('tags' => 'NAME="q_doapprove"' . $clicksuffix, 'label' => qa_lang_html('question/approve_button'));
            $buttons['reject'] = array('tags' => 'NAME="q_doreject"' . $clicksuffix, 'label' => qa_lang_html('question/reject_button'));
        }
        if ($question['hideable']) {
            $buttons['hide'] = array('tags' => 'NAME="q_dohide"' . $clicksuffix, 'label' => qa_lang_html('question/hide_button'), 'popup' => qa_lang_html('question/hide_q_popup'));
        }
        if ($question['reshowable']) {
            $buttons['reshow'] = array('tags' => 'NAME="q_doreshow"' . $clicksuffix, 'label' => qa_lang_html('question/reshow_button'));
        }
        if ($question['deleteable']) {
            $buttons['delete'] = array('tags' => 'NAME="q_dodelete"' . $clicksuffix, 'label' => qa_lang_html('question/delete_button'), 'popup' => qa_lang_html('question/delete_q_popup'));
        }
        if ($question['claimable']) {
            $buttons['claim'] = array('tags' => 'NAME="q_doclaim"' . $clicksuffix, 'label' => qa_lang_html('question/claim_button'));
        }
        if ($question['answerbutton']) {
            // don't show if shown by default
            $buttons['answer'] = array('tags' => 'NAME="q_doanswer" ID="q_doanswer" onClick="return qa_toggle_element(\'anew\')"', 'label' => qa_lang_html('question/answer_button'), 'popup' => qa_lang_html('question/answer_q_popup'));
        }
        if ($question['commentbutton']) {
            $buttons['comment'] = array('tags' => 'NAME="q_docomment" onClick="return qa_toggle_element(\'c' . $questionid . '\')"', 'label' => qa_lang_html('question/comment_button'), 'popup' => qa_lang_html('question/comment_q_popup'));
        }
        $q_view['form'] = array('style' => 'light', 'buttons' => $buttons, 'hidden' => array('qa_click' => ''));
    }
    //	Information about the question of the answer that this question follows on from (or a question directly)
    if (isset($parentquestion)) {
        $q_view['follows'] = array('label' => qa_lang_html($question['parentid'] == $parentquestion['postid'] ? 'question/follows_q' : 'question/follows_a'), 'title' => qa_html(qa_block_words_replace($parentquestion['title'], qa_get_block_words_preg())), 'url' => qa_q_path_html($parentquestion['postid'], $parentquestion['title'], false, $question['parentid'] == $parentquestion['postid'] ? 'Q' : 'A', $question['parentid']));
    }
    //	Information about the question that this question is a duplicate of (if appropriate)
    if (isset($closepost)) {
        if ($closepost['basetype'] == 'Q') {
            $q_view['closed'] = array('label' => qa_lang_html('question/closed_as_duplicate'), 'content' => qa_html(qa_block_words_replace($closepost['title'], qa_get_block_words_preg())), 'url' => qa_q_path_html($closepost['postid'], $closepost['title']));
        } elseif ($closepost['type'] == 'NOTE') {
            $viewer = qa_load_viewer($closepost['content'], $closepost['format']);
            $q_view['closed'] = array('label' => qa_lang_html('question/closed_with_note'), 'content' => $viewer->get_html($closepost['content'], $closepost['format'], array('blockwordspreg' => qa_get_block_words_preg())));
        }
    }
    //	Extra value display
    if (strlen(@$question['extra']) && qa_opt('extra_field_active') && qa_opt('extra_field_display')) {
        $q_view['extra'] = array('label' => qa_html(qa_opt('extra_field_label')), 'content' => qa_html(qa_block_words_replace($question['extra'], qa_get_block_words_preg())));
    }
    return $q_view;
}
开发者ID:mathjoy,项目名称:math-duodaa,代码行数:83,代码来源:qa-page-question-view.php

示例5: qa_lang_html

 case 'permit_retag_cat':
 case 'permit_edit_a':
 case 'permit_edit_c':
 case 'permit_edit_silent':
 case 'permit_flag':
 case 'permit_close_q':
 case 'permit_select_a':
 case 'permit_hide_show':
 case 'permit_moderate':
 case 'permit_delete_hidden':
 case 'permit_anon_view_ips':
 case 'permit_view_voters_flaggers':
 case 'permit_post_wall':
     $dopoints = true;
     if ($optionname == 'permit_retag_cat') {
         $optionfield['label'] = qa_lang_html(qa_using_categories() ? 'profile/permit_recat' : 'profile/permit_retag') . ':';
     } else {
         $optionfield['label'] = qa_lang_html('profile/' . $optionname) . ':';
     }
     if ($optionname == 'permit_view_q_page' || $optionname == 'permit_post_q' || $optionname == 'permit_post_a' || $optionname == 'permit_post_c' || $optionname == 'permit_anon_view_ips') {
         $widest = QA_PERMIT_ALL;
     } elseif ($optionname == 'permit_close_q' || $optionname == 'permit_select_a' || $optionname == 'permit_moderate' || $optionname == 'permit_hide_show') {
         $widest = QA_PERMIT_POINTS;
     } elseif ($optionname == 'permit_delete_hidden') {
         $widest = QA_PERMIT_EDITORS;
     } elseif ($optionname == 'permit_view_voters_flaggers' || $optionname == 'permit_edit_silent') {
         $widest = QA_PERMIT_EXPERTS;
     } else {
         $widest = QA_PERMIT_USERS;
     }
     if ($optionname == 'permit_view_q_page') {
开发者ID:mostafiz93,项目名称:PrintfScanf,代码行数:31,代码来源:qa-page-admin-default.php

示例6: qa_get_permit_options

function qa_get_permit_options()
{
    if (qa_to_override(__FUNCTION__)) {
        $args = func_get_args();
        return qa_call_override(__FUNCTION__, $args);
    }
    $permits = array('permit_view_q_page', 'permit_post_q', 'permit_post_a');
    if (qa_opt('comment_on_qs') || qa_opt('comment_on_as')) {
        $permits[] = 'permit_post_c';
    }
    if (qa_opt('voting_on_qs')) {
        $permits[] = 'permit_vote_q';
    }
    if (qa_opt('voting_on_as')) {
        $permits[] = 'permit_vote_a';
    }
    if (qa_opt('voting_on_qs') || qa_opt('voting_on_as')) {
        $permits[] = 'permit_vote_down';
    }
    if (qa_using_tags() || qa_using_categories()) {
        $permits[] = 'permit_retag_cat';
    }
    array_push($permits, 'permit_edit_q', 'permit_edit_a');
    if (qa_opt('comment_on_qs') || qa_opt('comment_on_as')) {
        $permits[] = 'permit_edit_c';
    }
    if (qa_opt('allow_close_questions')) {
        $permits[] = 'permit_close_q';
    }
    array_push($permits, 'permit_select_a', 'permit_anon_view_ips');
    if (qa_opt('flagging_of_posts')) {
        $permits[] = 'permit_flag';
    }
    $permits[] = 'permit_moderate';
    array_push($permits, 'permit_hide_show', 'permit_delete_hidden');
    return $permits;
}
开发者ID:mathjoy,项目名称:math-duodaa,代码行数:37,代码来源:qa-app-options.php

示例7: qa_page_q_edit_q_submit

function qa_page_q_edit_q_submit($question, $answers, $commentsfollows, $closepost, &$in, &$errors)
{
    $in = array();
    if ($question['editable']) {
        $in['title'] = qa_post_text('q_title');
        qa_get_post_content('q_editor', 'q_content', $in['editor'], $in['content'], $in['format'], $in['text']);
        $in['extra'] = qa_opt('extra_field_active') ? qa_post_text('q_extra') : null;
    }
    if ($question['retagcatable']) {
        if (qa_using_tags()) {
            $in['tags'] = qa_get_tags_field_value('q_tags');
        }
        if (qa_using_categories()) {
            $in['categoryid'] = qa_get_category_field_value('q_category');
        }
    }
    if (array_key_exists('categoryid', $in)) {
        // need to check if we can move it to that category, and if we need moderation
        $categories = qa_db_select_with_pending(qa_db_category_nav_selectspec($in['categoryid'], true));
        $categoryids = array_keys(qa_category_path($categories, $in['categoryid']));
        $userlevel = qa_user_level_for_categories($categoryids);
    } else {
        $userlevel = null;
    }
    if ($question['isbyuser']) {
        $in['name'] = qa_post_text('q_name');
        $in['notify'] = qa_post_text('q_notify') ? true : false;
        $in['email'] = qa_post_text('q_email');
    }
    if (!qa_user_post_permit_error('permit_edit_silent', $question)) {
        $in['silent'] = qa_post_text('q_silent');
    }
    // here the $in array only contains values for parts of the form that were displayed, so those are only ones checked by filters
    $errors = array();
    if (!qa_check_form_security_code('edit-' . $question['postid'], qa_post_text('code'))) {
        $errors['page'] = qa_lang_html('misc/form_security_again');
    } else {
        $in['queued'] = qa_opt('moderate_edited_again') && qa_user_moderation_reason($userlevel);
        $filtermodules = qa_load_modules_with('filter', 'filter_question');
        foreach ($filtermodules as $filtermodule) {
            $oldin = $in;
            $filtermodule->filter_question($in, $errors, $question);
            if ($question['editable']) {
                qa_update_post_text($in, $oldin);
            }
        }
        if (array_key_exists('categoryid', $in) && strcmp($in['categoryid'], $question['categoryid'])) {
            if (qa_user_permit_error('permit_post_q', null, $userlevel)) {
                $errors['categoryid'] = qa_lang_html('question/category_ask_not_allowed');
            }
        }
        if (empty($errors)) {
            $userid = qa_get_logged_in_userid();
            $handle = qa_get_logged_in_handle();
            $cookieid = qa_cookie_get();
            // now we fill in the missing values in the $in array, so that we have everything we need for qa_question_set_content()
            // we do things in this way to avoid any risk of a validation failure on elements the user can't see (e.g. due to admin setting changes)
            if (!$question['editable']) {
                $in['title'] = $question['title'];
                $in['content'] = $question['content'];
                $in['format'] = $question['format'];
                $in['text'] = qa_viewer_text($in['content'], $in['format']);
                $in['extra'] = $question['extra'];
            }
            if (!isset($in['tags'])) {
                $in['tags'] = qa_tagstring_to_tags($question['tags']);
            }
            if (!array_key_exists('categoryid', $in)) {
                $in['categoryid'] = $question['categoryid'];
            }
            if (!isset($in['silent'])) {
                $in['silent'] = false;
            }
            $setnotify = $question['isbyuser'] ? qa_combine_notify_email($question['userid'], $in['notify'], $in['email']) : $question['notify'];
            qa_question_set_content($question, $in['title'], $in['content'], $in['format'], $in['text'], qa_tags_to_tagstring($in['tags']), $setnotify, $userid, $handle, $cookieid, $in['extra'], @$in['name'], $in['queued'], $in['silent']);
            if (qa_using_categories() && strcmp($in['categoryid'], $question['categoryid'])) {
                qa_question_set_category($question, $in['categoryid'], $userid, $handle, $cookieid, $answers, $commentsfollows, $closepost, $in['silent']);
            }
            return true;
        }
    }
    return false;
}
开发者ID:netham91,项目名称:question2answer,代码行数:83,代码来源:qa-page-question-post.php

示例8: unset

     unset($qa_content['form_profile']['fields']['avatar']);
 }
 //	Private message form
 if (qa_opt('allow_private_messages') && isset($loginuserid) && $loginuserid != $userid && !($useraccount['flags'] & QA_USER_FLAGS_NO_MESSAGES)) {
     $qa_content['form_profile']['fields']['level']['value'] .= strtr(qa_lang_html('profile/send_private_message'), array('^1' => '<A HREF="' . qa_path_html('message/' . $handle) . '">', '^2' => '</A>'));
 }
 //	Show any extra privileges due to user's level or their points
 $showpermits = array();
 $permitoptions = qa_get_permit_options();
 foreach ($permitoptions as $permitoption) {
     if (qa_opt($permitoption) < QA_PERMIT_CONFIRMED) {
         // if it's not available to all users (after they've confirmed their email address)
         if (!qa_permit_error($permitoption, $userid, $useraccount['level'], $useraccount['flags'], $userpoints['points'])) {
             // but this user can
             if ($permitoption == 'permit_retag_cat') {
                 $showpermits[] = qa_lang(qa_using_categories() ? 'profile/permit_recat' : 'profile/permit_retag');
             } else {
                 $showpermits[] = qa_lang('profile/' . $permitoption);
             }
             // then show it as an extra priviliege
         }
     }
 }
 if (count($showpermits)) {
     $qa_content['form_profile']['fields']['permits'] = array('type' => 'static', 'label' => qa_lang_html('profile/extra_privileges'), 'value' => qa_html(implode("\n", $showpermits), true), 'rows' => count($showpermits));
 }
 //	Show email address only if we're an administrator
 if ($loginlevel >= QA_USER_LEVEL_ADMIN && !qa_user_permit_error()) {
     $doconfirms = qa_opt('confirm_user_emails') && $useraccount['level'] < QA_USER_LEVEL_EXPERT;
     $isconfirmed = $useraccount['flags'] & QA_USER_FLAGS_EMAIL_CONFIRMED ? true : false;
     $qa_content['form_profile']['fields']['email'] = array('type' => $userediting ? 'text' : 'static', 'label' => qa_lang_html('users/email_label'), 'tags' => 'NAME="email"', 'value' => qa_html(isset($inemail) ? $inemail : $useraccount['email']), 'error' => qa_html(@$errors['email']), 'note' => ($doconfirms ? qa_lang_html($isconfirmed ? 'users/email_confirmed' : 'users/email_not_confirmed') . ' ' : '') . qa_lang_html('users/only_shown_admins'));
开发者ID:ruuttt,项目名称:question2answer,代码行数:31,代码来源:qa-page-user.php

示例9: header

 function header()
 {
     $this->cs_position('Top');
     $this->output('<header id="site-header" class="clearfix">', '<div class="qa-navbar navbar-default' . (qa_opt('cs_nav_fixed') ? ' navbar-fixed-top ' : '') . '" role="navigation">');
     $this->output('<a href="#" class="slide-mobile-menu icon-list"></a>');
     $this->logo();
     if (qa_opt('cs_enable_ask_button')) {
         $this->output('<a id="nav-ask-btn" href="' . qa_path_html('ask') . '" class="btn btn-sm">' . qa_lang_html('cleanstrap/ask_question') . '</a>');
         $this->output('<a id="nav-ask-btn" href="' . qa_path_html('ask') . '" class="btn btn-sm header-ask-button icon-question-sign"></a>');
     }
     if (qa_opt('cs_enable_category_nav') && qa_using_categories()) {
         $this->cat_drop_nav();
     }
     $this->head_nav();
     $this->user_drop_nav();
     $this->search();
     $this->output('</div>', '</header>');
 }
开发者ID:microbye,项目名称:CleanStrap,代码行数:18,代码来源:blocks.php

示例10: qa_page_q_edit_q_submit

function qa_page_q_edit_q_submit($question, $answers, $commentsfollows, $closepost, &$in, &$errors)
{
    $in = array();
    if ($question['editable']) {
        $in['title'] = qa_post_text('q_title');
        qa_get_post_content('q_editor', 'q_content', $in['editor'], $in['content'], $in['format'], $in['text']);
        $in['extra'] = qa_opt('extra_field_active') ? qa_post_text('q_extra') : null;
    }
    if ($question['retagcatable']) {
        if (qa_using_tags()) {
            $in['tags'] = qa_get_tags_field_value('q_tags');
        }
        if (qa_using_categories()) {
            $in['categoryid'] = qa_get_category_field_value('q_category');
        }
    }
    if ($question['isbyuser']) {
        $in['notify'] = qa_post_text('q_notify') ? true : false;
        $in['email'] = qa_post_text('q_email');
    }
    // here the $in array only contains values for parts of the form that were displayed, so those are only ones checked by filters
    $errors = array();
    $filtermodules = qa_load_modules_with('filter', 'filter_question');
    foreach ($filtermodules as $filtermodule) {
        $oldin = $in;
        $filtermodule->filter_question($in, $errors, $question);
        if ($question['editable']) {
            qa_update_post_text($in, $oldin);
        }
    }
    if (empty($errors)) {
        $userid = qa_get_logged_in_userid();
        $handle = qa_get_logged_in_handle();
        $cookieid = qa_cookie_get();
        // now we fill in the missing values in the $in array, so that we have everything we need for qa_question_set_content()
        // we do things in this way to avoid any risk of a validation failure on elements the user can't see (e.g. due to admin setting changes)
        if (!$question['editable']) {
            $in['title'] = $question['title'];
            $in['content'] = $question['content'];
            $in['format'] = $question['format'];
            $in['text'] = qa_viewer_text($in['content'], $in['format']);
            $in['extra'] = $question['extra'];
        }
        if (!isset($in['tags'])) {
            $in['tags'] = qa_tagstring_to_tags($question['tags']);
        }
        if (!array_key_exists('categoryid', $in)) {
            $in['categoryid'] = $question['categoryid'];
        }
        $setnotify = $question['isbyuser'] ? qa_combine_notify_email($question['userid'], $in['notify'], $in['email']) : $question['notify'];
        qa_question_set_content($question, $in['title'], $in['content'], $in['format'], $in['text'], qa_tags_to_tagstring($in['tags']), $setnotify, $userid, $handle, $cookieid, $in['extra']);
        if (qa_using_categories() && strcmp($in['categoryid'], $question['categoryid'])) {
            qa_question_set_category($question, $in['categoryid'], $userid, $handle, $cookieid, $answers, $commentsfollows, $closepost);
        }
        return true;
    }
    return false;
}
开发者ID:robomartin,项目名称:Import-Tags,代码行数:58,代码来源:qa-page-question-post.php

示例11: qa_user_use_captcha

    return $qa_content;
}
//	Process input
$usecaptcha = qa_user_use_captcha('captcha_on_anon_post');
$intitle = qa_post_text('title');
// allow title and tags to be posted by an external form
$intags = qa_get_tags_field_value('tags');
if (qa_clicked('doask')) {
    require_once QA_INCLUDE_DIR . 'qa-app-post-create.php';
    require_once QA_INCLUDE_DIR . 'qa-util-string.php';
    $innotify = qa_post_text('notify') ? true : false;
    $inemail = qa_post_text('email');
    qa_get_post_content('editor', 'content', $ineditor, $incontent, $informat, $intext);
    $tagstring = qa_tags_to_tagstring($intags);
    $errors = qa_question_validate($intitle, $incontent, $informat, $intext, $tagstring, $innotify, $inemail);
    if (qa_using_categories() && count($categories) && !qa_opt('allow_no_category') && !isset($incategoryid)) {
        $errors['category'] = qa_lang_html('question/category_required');
    }
    if ($usecaptcha) {
        require_once 'qa-app-captcha.php';
        qa_captcha_validate($_POST, $errors);
    }
    if (empty($errors)) {
        if (!isset($qa_login_userid)) {
            $qa_cookieid = qa_cookie_get_create();
        }
        // create a new cookie if necessary
        $questionid = qa_question_create($followanswer, $qa_login_userid, qa_get_logged_in_handle(), $qa_cookieid, $intitle, $incontent, $informat, $intext, $tagstring, $innotify, $inemail, $incategoryid);
        qa_report_write_action($qa_login_userid, $qa_cookieid, 'q_post', $questionid, null, null);
        qa_redirect(qa_q_request($questionid, $intitle));
        // our work is done here
开发者ID:TheProjecter,项目名称:microprobe,代码行数:31,代码来源:qa-page-ask.php

示例12: qa_content_prepare

function qa_content_prepare($voting = false, $categoryids = null)
{
    global $qa_root_url_relative, $qa_request, $qa_template, $qa_login_userid, $qa_vote_error_html, $qa_nav_pages_cached, $qa_widgets_cached, $QA_CONST_ROUTING;
    if (QA_DEBUG_PERFORMANCE) {
        qa_usage_mark('control');
    }
    if (isset($categoryids) && !is_array($categoryids)) {
        // accept old-style parameter
        $categoryids = array($categoryids);
    }
    $lastcategoryid = count($categoryids) ? end($categoryids) : null;
    $qa_content = array('content_type' => 'text/html; charset=utf-8', 'site_title' => qa_html(qa_opt('site_title')), 'head_lines' => array(), 'navigation' => array('user' => array(), 'main' => array(), 'footer' => array('feedback' => array('url' => qa_path_html('feedback'), 'label' => qa_lang_html('main/nav_feedback')))), 'sidebar' => qa_opt('show_custom_sidebar') ? qa_opt('custom_sidebar') : null, 'sidepanel' => qa_opt('show_custom_sidepanel') ? qa_opt('custom_sidepanel') : null, 'widgets' => array());
    if (qa_opt('show_custom_in_head')) {
        $qa_content['head_lines'][] = qa_opt('custom_in_head');
    }
    if (qa_opt('show_custom_header')) {
        $qa_content['body_header'] = qa_opt('custom_header');
    }
    if (qa_opt('show_custom_footer')) {
        $qa_content['body_footer'] = qa_opt('custom_footer');
    }
    if (isset($categoryids)) {
        $qa_content['categoryids'] = $categoryids;
    }
    foreach ($qa_nav_pages_cached as $page) {
        if ($page['nav'] == 'B') {
            qa_navigation_add_page($qa_content['navigation']['main'], $page);
        }
    }
    if (qa_opt('nav_home') && qa_opt('show_custom_home')) {
        $qa_content['navigation']['main']['$'] = array('url' => qa_path_html(''), 'label' => qa_lang_html('main/nav_home'));
    }
    if (qa_opt('nav_activity')) {
        $qa_content['navigation']['main']['activity'] = array('url' => qa_path_html('activity'), 'label' => qa_lang_html('main/nav_activity'));
    }
    $hascustomhome = qa_has_custom_home();
    if (qa_opt($hascustomhome ? 'nav_qa_not_home' : 'nav_qa_is_home')) {
        $qa_content['navigation']['main'][$hascustomhome ? 'qa' : '$'] = array('url' => qa_path_html($hascustomhome ? 'qa' : ''), 'label' => qa_lang_html('main/nav_qa'));
    }
    if (qa_opt('nav_questions')) {
        $qa_content['navigation']['main']['questions'] = array('url' => qa_path_html('questions'), 'label' => qa_lang_html('main/nav_qs'));
    }
    if (qa_opt('nav_hot')) {
        $qa_content['navigation']['main']['hot'] = array('url' => qa_path_html('hot'), 'label' => qa_lang_html('main/nav_hot'));
    }
    if (qa_opt('nav_unanswered')) {
        $qa_content['navigation']['main']['unanswered'] = array('url' => qa_path_html('unanswered'), 'label' => qa_lang_html('main/nav_unanswered'));
    }
    if (qa_using_tags() && qa_opt('nav_tags')) {
        $qa_content['navigation']['main']['tag'] = array('url' => qa_path_html('tags'), 'label' => qa_lang_html('main/nav_tags'));
    }
    if (qa_using_categories() && qa_opt('nav_categories')) {
        $qa_content['navigation']['main']['categories'] = array('url' => qa_path_html('categories'), 'label' => qa_lang_html('main/nav_categories'));
    }
    if (qa_opt('nav_users')) {
        $qa_content['navigation']['main']['user'] = array('url' => qa_path_html('users'), 'label' => qa_lang_html('main/nav_users'));
    }
    if (qa_user_permit_error('permit_post_q') != 'level') {
        $qa_content['navigation']['main']['ask'] = array('url' => qa_path_html('ask', qa_using_categories() && strlen($lastcategoryid) ? array('cat' => $lastcategoryid) : null), 'label' => qa_lang_html('main/nav_ask'));
    }
    if (qa_get_logged_in_level() >= QA_USER_LEVEL_ADMIN) {
        $qa_content['navigation']['main']['admin'] = array('url' => qa_path_html(isset($_COOKIE['qa_admin_last']) && isset($QA_CONST_ROUTING[$_COOKIE['qa_admin_last']]) ? $_COOKIE['qa_admin_last'] : 'admin'), 'label' => qa_lang_html('main/nav_admin'));
    }
    $qa_content['search'] = array('form_tags' => 'METHOD="GET" ACTION="' . qa_path_html('search') . '"', 'form_extra' => qa_path_form_html('search'), 'title' => qa_lang_html('main/search_title'), 'field_tags' => 'NAME="q"', 'button_label' => qa_lang_html('main/search_button'));
    if (!qa_opt('feedback_enabled')) {
        unset($qa_content['navigation']['footer']['feedback']);
    }
    foreach ($qa_nav_pages_cached as $page) {
        if ($page['nav'] == 'M' || $page['nav'] == 'O' || $page['nav'] == 'F') {
            qa_navigation_add_page($qa_content['navigation'][$page['nav'] == 'F' ? 'footer' : 'main'], $page);
        }
    }
    $regioncodes = array('F' => 'full', 'M' => 'main', 'S' => 'side');
    $placecodes = array('T' => 'top', 'H' => 'high', 'L' => 'low', 'B' => 'bottom');
    foreach ($qa_widgets_cached as $widget) {
        if (is_numeric(strpos(',' . $widget['tags'] . ',', ',' . $qa_template . ',')) || is_numeric(strpos(',' . $widget['tags'] . ',', ',all,'))) {
            // see if it has been selected for display on this template
            $region = @$regioncodes[substr($widget['place'], 0, 1)];
            $place = @$placecodes[substr($widget['place'], 1, 2)];
            if (isset($region) && isset($place)) {
                // check region/place codes recognized
                $module = qa_load_module('widget', $widget['title']);
                if (isset($module) && method_exists($module, 'allow_template') && $module->allow_template($qa_template) && method_exists($module, 'allow_region') && $module->allow_region($region) && method_exists($module, 'output_widget')) {
                    $qa_content['widgets'][$region][$place][] = $module;
                }
                // if module loaded and happy to be displayed here, tell theme about it
            }
        }
    }
    $logoshow = qa_opt('logo_show');
    $logourl = qa_opt('logo_url');
    $logowidth = qa_opt('logo_width');
    $logoheight = qa_opt('logo_height');
    if ($logoshow) {
        $qa_content['logo'] = '<A HREF="' . qa_path_html('') . '" CLASS="qa-logo-link" TITLE="' . qa_html(qa_opt('site_title')) . '">' . '<IMG SRC="' . qa_html(is_numeric(strpos($logourl, '://')) ? $logourl : $qa_root_url_relative . $logourl) . '"' . ($logowidth ? ' WIDTH="' . $logowidth . '"' : '') . ($logoheight ? ' HEIGHT="' . $logoheight . '"' : '') . ' BORDER="0"/></A>';
    } else {
        $qa_content['logo'] = '<A HREF="' . qa_path_html('') . '" CLASS="qa-logo-link">' . qa_html(qa_opt('site_title')) . '</A>';
    }
    $topath = qa_get('to');
    // lets user switch between login and register without losing destination page
//.........这里部分代码省略.........
开发者ID:TheProjecter,项目名称:microprobe,代码行数:101,代码来源:qa-page.php

示例13: qa_admin_sub_navigation

function qa_admin_sub_navigation()
{
    $navigation = array('admin$' => array('label' => qa_lang('admin/general_title'), 'url' => qa_path_html('admin')), 'admin/emails' => array('label' => qa_lang('admin/emails_title'), 'url' => qa_path_html('admin/emails')), 'admin/user' => array('label' => qa_lang('admin/users_title'), 'url' => qa_path_html('admin/users')), 'admin/layout' => array('label' => qa_lang('admin/layout_title'), 'url' => qa_path_html('admin/layout')), 'admin/lists' => array('label' => qa_lang('admin/lists_title'), 'url' => qa_path_html('admin/lists')), 'admin/viewing' => array('label' => qa_lang('admin/viewing_title'), 'url' => qa_path_html('admin/viewing')), 'admin/posting' => array('label' => qa_lang('admin/posting_title'), 'url' => qa_path_html('admin/posting')), 'admin/categories' => array('label' => qa_lang('admin/categories_title'), 'url' => qa_path_html('admin/categories')), 'admin/permissions' => array('label' => qa_lang('admin/permissions_title'), 'url' => qa_path_html('admin/permissions')), 'admin/pages' => array('label' => qa_lang('admin/pages_title'), 'url' => qa_path_html('admin/pages')), 'admin/feeds' => array('label' => qa_lang('admin/feeds_title'), 'url' => qa_path_html('admin/feeds')), 'admin/points' => array('label' => qa_lang('admin/points_title'), 'url' => qa_path_html('admin/points')), 'admin/spam' => array('label' => qa_lang('admin/spam_title'), 'url' => qa_path_html('admin/spam')), 'admin/hidden' => array('label' => qa_lang('admin/hidden_title'), 'url' => qa_path_html('admin/hidden')), 'admin/stats' => array('label' => qa_lang('admin/stats_title'), 'url' => qa_path_html('admin/stats')), 'admin/plugins' => array('label' => qa_lang('admin/plugins_title'), 'url' => qa_path_html('admin/plugins')));
    if (!qa_using_categories()) {
        unset($navigation['admin/categories']);
    }
    return $navigation;
}
开发者ID:TheProjecter,项目名称:microprobe,代码行数:8,代码来源:qa-app-admin.php

示例14: qa_feed_not_found

            $categoryslugs = null;
        }
        break;
    case 'search':
        if (strlen(@$feedparams[0])) {
            $feedoption = 'feed_for_search';
            $categoryslugs = null;
        }
        break;
}
$countslugs = @count($categoryslugs);
if (!isset($feedoption)) {
    qa_feed_not_found();
}
//	Check that all the appropriate options are in place to allow this feed to be retrieved
if (!(qa_opt($feedoption) && ($countslugs ? qa_using_categories() && qa_opt('feed_per_category') : true))) {
    qa_feed_not_found();
}
//	Retrieve the appropriate questions and other information for this feed
require_once QA_INCLUDE_DIR . 'db/selects.php';
$sitetitle = qa_opt('site_title');
$siteurl = qa_opt('site_url');
$full = qa_opt('feed_full_text');
$count = qa_opt('feed_number_items');
$showurllinks = qa_opt('show_url_links');
$linkrequest = $feedtype . ($countslugs ? '/' . implode('/', $categoryslugs) : '');
$linkparams = null;
switch ($feedtype) {
    case 'questions':
        $questions = qa_feed_load_ifcategory($categoryslugs, 'main/recent_qs_title', 'main/recent_qs_in_x', $title, qa_db_qs_selectspec(null, 'created', 0, $categoryslugs, null, false, $full, $count));
        break;
开发者ID:swuit,项目名称:swuit-q2a,代码行数:31,代码来源:qa-feed.php

示例15: qa_content_prepare

function qa_content_prepare($voting = false, $categoryids = null)
{
    if (qa_to_override(__FUNCTION__)) {
        $args = func_get_args();
        return qa_call_override(__FUNCTION__, $args);
    }
    global $qa_template, $qa_page_error_html;
    if (QA_DEBUG_PERFORMANCE) {
        global $qa_usage;
        $qa_usage->mark('control');
    }
    $request = qa_request();
    $requestlower = qa_request();
    $navpages = qa_db_get_pending_result('navpages');
    $widgets = qa_db_get_pending_result('widgets');
    if (isset($categoryids) && !is_array($categoryids)) {
        // accept old-style parameter
        $categoryids = array($categoryids);
    }
    $lastcategoryid = count($categoryids) ? end($categoryids) : null;
    $charset = 'utf-8';
    $qa_content = array('content_type' => 'text/html; charset=' . $charset, 'charset' => $charset, 'direction' => qa_opt('site_text_direction'), 'site_title' => qa_html(qa_opt('site_title')), 'head_lines' => array(), 'navigation' => array('user' => array(), 'main' => array(), 'footer' => array('feedback' => array('url' => qa_path_html('feedback'), 'label' => qa_lang_html('main/nav_feedback')))), 'sidebar' => qa_opt('show_custom_sidebar') ? qa_opt('custom_sidebar') : null, 'sidepanel' => qa_opt('show_custom_sidepanel') ? qa_opt('custom_sidepanel') : null, 'widgets' => array());
    if (qa_opt('show_custom_in_head')) {
        $qa_content['head_lines'][] = qa_opt('custom_in_head');
    }
    if (qa_opt('show_custom_header')) {
        $qa_content['body_header'] = qa_opt('custom_header');
    }
    if (qa_opt('show_custom_footer')) {
        $qa_content['body_footer'] = qa_opt('custom_footer');
    }
    if (isset($categoryids)) {
        $qa_content['categoryids'] = $categoryids;
    }
    foreach ($navpages as $page) {
        if ($page['nav'] == 'B') {
            qa_navigation_add_page($qa_content['navigation']['main'], $page);
        }
    }
    if (qa_opt('nav_home') && qa_opt('show_custom_home')) {
        $qa_content['navigation']['main']['$'] = array('url' => qa_path_html(''), 'label' => qa_lang_html('main/nav_home'));
    }
    if (qa_opt('nav_activity')) {
        $qa_content['navigation']['main']['activity'] = array('url' => qa_path_html('activity'), 'label' => qa_lang_html('main/nav_activity'));
    }
    $hascustomhome = qa_has_custom_home();
    if (qa_opt($hascustomhome ? 'nav_qa_not_home' : 'nav_qa_is_home')) {
        $qa_content['navigation']['main'][$hascustomhome ? 'qa' : '$'] = array('url' => qa_path_html($hascustomhome ? 'qa' : ''), 'label' => qa_lang_html('main/nav_qa'));
    }
    if (qa_opt('nav_questions')) {
        $qa_content['navigation']['main']['questions'] = array('url' => qa_path_html('questions'), 'label' => qa_lang_html('main/nav_qs'));
    }
    if (qa_opt('nav_hot')) {
        $qa_content['navigation']['main']['hot'] = array('url' => qa_path_html('hot'), 'label' => qa_lang_html('main/nav_hot'));
    }
    if (qa_opt('nav_unanswered')) {
        $qa_content['navigation']['main']['unanswered'] = array('url' => qa_path_html('unanswered'), 'label' => qa_lang_html('main/nav_unanswered'));
    }
    if (qa_using_tags() && qa_opt('nav_tags')) {
        $qa_content['navigation']['main']['tag'] = array('url' => qa_path_html('tags'), 'label' => qa_lang_html('main/nav_tags'), 'selected_on' => array('tags$', 'tag/'));
    }
    if (qa_using_categories() && qa_opt('nav_categories')) {
        $qa_content['navigation']['main']['categories'] = array('url' => qa_path_html('categories'), 'label' => qa_lang_html('main/nav_categories'), 'selected_on' => array('categories$', 'categories/'));
    }
    if (qa_opt('nav_users')) {
        $qa_content['navigation']['main']['user'] = array('url' => qa_path_html('users'), 'label' => qa_lang_html('main/nav_users'), 'selected_on' => array('users$', 'users/', 'user/'));
    }
    // Only the 'level' permission error prevents the menu option being shown - others reported on qa-page-ask.php
    if (qa_opt('nav_ask') && qa_user_maximum_permit_error('permit_post_q') != 'level') {
        $qa_content['navigation']['main']['ask'] = array('url' => qa_path_html('ask', qa_using_categories() && strlen($lastcategoryid) ? array('cat' => $lastcategoryid) : null), 'label' => qa_lang_html('main/nav_ask'));
    }
    if (qa_get_logged_in_level() >= QA_USER_LEVEL_ADMIN || !qa_user_maximum_permit_error('permit_moderate') || !qa_user_maximum_permit_error('permit_hide_show') || !qa_user_maximum_permit_error('permit_delete_hidden')) {
        $qa_content['navigation']['main']['admin'] = array('url' => qa_path_html('admin'), 'label' => qa_lang_html('main/nav_admin'), 'selected_on' => array('admin/'));
    }
    $qa_content['search'] = array('form_tags' => 'method="get" action="' . qa_path_html('search') . '"', 'form_extra' => qa_path_form_html('search'), 'title' => qa_lang_html('main/search_title'), 'field_tags' => 'name="q"', 'button_label' => qa_lang_html('main/search_button'));
    if (!qa_opt('feedback_enabled')) {
        unset($qa_content['navigation']['footer']['feedback']);
    }
    foreach ($navpages as $page) {
        if ($page['nav'] == 'M' || $page['nav'] == 'O' || $page['nav'] == 'F') {
            qa_navigation_add_page($qa_content['navigation'][$page['nav'] == 'F' ? 'footer' : 'main'], $page);
        }
    }
    $regioncodes = array('F' => 'full', 'M' => 'main', 'S' => 'side');
    $placecodes = array('T' => 'top', 'H' => 'high', 'L' => 'low', 'B' => 'bottom');
    foreach ($widgets as $widget) {
        if (is_numeric(strpos(',' . $widget['tags'] . ',', ',' . $qa_template . ',')) || is_numeric(strpos(',' . $widget['tags'] . ',', ',all,'))) {
            // see if it has been selected for display on this template
            $region = @$regioncodes[substr($widget['place'], 0, 1)];
            $place = @$placecodes[substr($widget['place'], 1, 2)];
            if (isset($region) && isset($place)) {
                // check region/place codes recognized
                $module = qa_load_module('widget', $widget['title']);
                if (isset($module) && method_exists($module, 'allow_template') && $module->allow_template(substr($qa_template, 0, 7) == 'custom-' ? 'custom' : $qa_template) && method_exists($module, 'allow_region') && $module->allow_region($region) && method_exists($module, 'output_widget')) {
                    $qa_content['widgets'][$region][$place][] = $module;
                }
                // if module loaded and happy to be displayed here, tell theme about it
            }
        }
    }
//.........这里部分代码省略.........
开发者ID:Trideon,项目名称:gigolo,代码行数:101,代码来源:qa-page.php


注:本文中的qa_using_categories函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。