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


PHP qa_db_category_nav_selectspec函数代码示例

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


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

示例1: output_widget

 function output_widget($region, $place, $themeobject, $template, $request, $qa_content)
 {
     /*
     $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])) )
     	return;
     	
     $explicitqa=(strtolower($requestparts[0])=='qa' or strtolower($requestparts[0])=='unanswered' or strtolower($requestparts[0])=='questions' or strtolower($requestparts[0])=='activity');
     
     if ($explicitqa)
     	$slugs=array_slice($requestparts, 1);
     elseif (strlen($requestparts[0]))
     	$slugs=$requestparts;
     else
     	$slugs=array();
     */
     $slugs = useo_get_current_category_slug();
     $countslugs = count($slugs);
     list($categories, $categoryid) = qa_db_select_with_pending(qa_db_category_nav_selectspec($slugs, false, false, true), $countslugs ? qa_db_slugs_to_category_id_selectspec($slugs) : null);
     if ($countslugs && isset($categoryid)) {
         /*
         $categoryid is current categories ID
         $backpath = implode('/', array_reverse($slugs));
         echo "countslugs: <pre>"; var_dump($countslugs); echo "</pre>";
         $fullcategory=qa_db_select_with_pending(qa_db_full_category_selectspec($categoryid, true));
         echo "fullcategory: <pre>"; var_dump($fullcategory); echo "</pre>";
         
         echo "categoryid: <pre>"; var_dump($categoryid); echo "</pre>";
         echo "slugs: <pre>"; var_dump($slugs); echo "</pre>";
         echo "template: <pre>"; var_dump($template); echo "</pre>";
         echo "request: <pre>"; var_dump($request); echo "</pre>";
         */
         require_once QA_INCLUDE_DIR . 'qa-db-metas.php';
         $description = qa_db_categorymeta_get($categoryid, 'useo_cat_description');
         if (!qa_opt('useo_cat_desc_format')) {
             $description = qa_html($description);
         }
         $editurlhtml = qa_path_html('category-edit/' . $categoryid);
         $allowediting = !qa_user_permit_error('useo_cat_desc_permit_edit');
         if (strlen($description)) {
             echo '<SPAN CLASS="entry-content qa-category-description">';
             echo $description;
             echo '</SPAN>';
             if ($allowediting) {
                 echo ' - <A HREF="' . $editurlhtml . '">edit</A>';
             }
         } elseif ($allowediting) {
             echo '<A HREF="' . $editurlhtml . '">' . qa_lang_html('useo/create_desc_link') . '</A>';
         }
     }
 }
开发者ID:Kailashaghera,项目名称:Q2A-Ultimate-SEO,代码行数:58,代码来源:category-widget.php

示例2: qa_create_event_for_category

function qa_create_event_for_category($categoryid, $questionid, $updatetype, $lastuserid, $timestamp = null)
{
    if (isset($categoryid)) {
        require_once QA_INCLUDE_DIR . 'db/selects.php';
        require_once QA_INCLUDE_DIR . 'app/format.php';
        $categories = qa_category_path(qa_db_single_select(qa_db_category_nav_selectspec($categoryid, true)), $categoryid);
        foreach ($categories as $category) {
            qa_db_event_create_for_entity(QA_ENTITY_CATEGORY, $category['categoryid'], $questionid, $questionid, $updatetype, $lastuserid, $timestamp);
        }
    }
}
开发者ID:swuit,项目名称:swuit-q2a,代码行数:11,代码来源:events.php

示例3: qa_feed_load_ifcategory

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());
}
开发者ID:swuit,项目名称:swuit-q2a,代码行数:12,代码来源:qa-feed.php

示例4: process_request

 public function process_request($request)
 {
     $requestparts = explode('/', qa_request());
     $slugs = array_slice($requestparts, 1);
     $countslugs = count($slugs);
     $userid = qa_get_logged_in_userid();
     $start = qa_get_start();
     $count = qa_opt_if_loaded('page_size_activity');
     $totalcount = qa_opt('cache_qcount');
     $qspec = qa_db_posts_basic_selectspec($userid, false);
     qa_db_add_selectspec_opost($qspec, 'ra', false, false);
     qa_db_add_selectspec_ousers($qspec, 'rau', 'raup');
     $qspec['source'] .= " JOIN (SELECT questionid, childid FROM ^homepage ORDER BY ^homepage.updated DESC) AS rcaq ON ^posts.postid=rcaq.questionid" . " LEFT JOIN ^posts AS ra ON childid=ra.postid" . (QA_FINAL_EXTERNAL_USERS ? "" : " LEFT JOIN ^users AS rau ON ra.userid=rau.userid") . " LEFT JOIN ^userpoints AS raup ON ra.userid=raup.userid LIMIT #,#";
     array_push($qspec['columns'], 'childid');
     array_push($qspec['arguments'], $start, $count);
     $qspec['sortdesc'] = 'otime';
     $query = 'SELECT ';
     foreach ($qspec['columns'] as $columnas => $columnfrom) {
         $query .= $columnfrom . (is_int($columnas) ? '' : ' AS ' . $columnas) . ', ';
     }
     $query = qa_db_apply_sub(substr($query, 0, -2) . (strlen(@$qspec['source']) ? ' FROM ' . $qspec['source'] : ''), @$qspec['arguments']);
     $results = qa_db_read_all_assoc(qa_db_query_raw($query));
     qa_db_post_select($results, $qspec);
     list($categories, $categoryid) = qa_db_select_with_pending(qa_db_category_nav_selectspec($slugs, false, false, true), $countslugs ? qa_db_slugs_to_category_id_selectspec($slugs) : null);
     $questions = qa_any_sort_and_dedupe($results);
     // $questions=qa_any_sort_and_dedupe(array_merge($recentquestions,$recentanswers));
     $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');
     }
     require_once QA_INCLUDE_DIR . 'qa-app-q-list.php';
     $qa_content = qa_q_list_page_content($questions, $pagesize, $start, $totalcount, $sometitle, $nonetitle, $categories, $categoryid, true, qa_opt('eql_homepage_url'), qa_opt('feed_for_qa') ? qa_opt('eql_homepage_url') : 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);
     return $qa_content;
 }
开发者ID:BrunoVandekerkhove,项目名称:q2a-expandable-question-lists,代码行数:42,代码来源:qa-eql-homepage.php

示例5: header

    header('Location: ../');
    exit;
}
require_once QA_INCLUDE_DIR . 'app/cookies.php';
require_once QA_INCLUDE_DIR . 'app/format.php';
require_once QA_INCLUDE_DIR . 'db/selects.php';
require_once QA_INCLUDE_DIR . 'util/sort.php';
require_once QA_INCLUDE_DIR . 'util/string.php';
require_once QA_INCLUDE_DIR . 'app/captcha.php';
require_once QA_INCLUDE_DIR . 'pages/question-view.php';
require_once QA_INCLUDE_DIR . 'app/updates.php';
$questionid = qa_request_part(0);
$userid = qa_get_logged_in_userid();
$cookieid = qa_cookie_get();
//	Get information about this question
list($question, $childposts, $achildposts, $parentquestion, $closepost, $extravalue, $categories, $favorite) = qa_db_select_with_pending(qa_db_full_post_selectspec($userid, $questionid), qa_db_full_child_posts_selectspec($userid, $questionid), qa_db_full_a_child_posts_selectspec($userid, $questionid), qa_db_post_parent_q_selectspec($questionid), qa_db_post_close_post_selectspec($questionid), qa_db_post_meta_selectspec($questionid, 'qa_q_extra'), qa_db_category_nav_selectspec($questionid, true, true, true), isset($userid) ? qa_db_is_favorite_selectspec($userid, QA_ENTITY_QUESTION, $questionid) : null);
if ($question['basetype'] != 'Q') {
    // don't allow direct viewing of other types of post
    $question = null;
}
if (isset($question)) {
    $question['extra'] = $extravalue;
    $answers = qa_page_q_load_as($question, $childposts);
    $commentsfollows = qa_page_q_load_c_follows($question, $childposts, $achildposts);
    $question = $question + qa_page_q_post_rules($question, null, null, $childposts);
    // array union
    if ($question['selchildid'] && @$answers[$question['selchildid']]['type'] != 'A') {
        $question['selchildid'] = null;
    }
    // if selected answer is hidden or somehow not there, consider it not selected
    foreach ($answers as $key => $answer) {
开发者ID:nikhilkumar80,项目名称:question2answer,代码行数:31,代码来源:question.php

示例6: qa_page_q_load_q

function qa_page_q_load_q()
{
    global $qa_login_userid, $questionid, $question, $parentquestion, $answers, $commentsfollows, $relatedcount, $relatedquestions, $question, $categories;
    list($question, $childposts, $achildposts, $parentquestion, $relatedquestions, $categories) = qa_db_select_with_pending(qa_db_full_post_selectspec($qa_login_userid, $questionid), qa_db_full_child_posts_selectspec($qa_login_userid, $questionid), qa_db_full_a_child_posts_selectspec($qa_login_userid, $questionid), qa_db_post_parent_q_selectspec($questionid), qa_db_related_qs_selectspec($qa_login_userid, $questionid), qa_db_category_nav_selectspec($questionid, true, true));
    if ($question['basetype'] != 'Q') {
        // don't allow direct viewing of other types of post
        $question = null;
    }
    $answers = array();
    $commentsfollows = array();
    foreach ($childposts as $postid => $post) {
        switch ($post['type']) {
            case 'Q':
                // never show follow-on Qs which have been hidden, even to admins
            // never show follow-on Qs which have been hidden, even to admins
            case 'C':
            case 'C_HIDDEN':
                $commentsfollows[$postid] = $post;
                break;
            case 'A':
            case 'A_HIDDEN':
                $answers[$postid] = $post;
                break;
        }
    }
    foreach ($achildposts as $postid => $post) {
        switch ($post['type']) {
            case 'Q':
            case 'Q_HIDDEN':
            case 'C':
            case 'C_HIDDEN':
                $commentsfollows[$postid] = $post;
                break;
        }
    }
    if (isset($question)) {
        $relatedcount = qa_opt('do_related_qs') ? 1 + qa_opt('page_size_related_qs') : 0;
        $relatedquestions = array_slice($relatedquestions, 0, $relatedcount);
        // includes question itself at this point
        qa_page_q_post_rules($question);
        if ($question['selchildid'] && @$answers[$question['selchildid']]['type'] != 'A') {
            $question['selchildid'] = null;
        }
        // if selected answer is hidden or somehow not there, consider it not selected
        foreach ($answers as $key => $answer) {
            $question['deleteable'] = false;
            qa_page_q_post_rules($answers[$key]);
            if ($answers[$key]['isbyuser'] && !qa_opt('allow_multi_answers')) {
                $question['answerbutton'] = false;
            }
            $answers[$key]['isselected'] = $answer['postid'] == $question['selchildid'];
        }
        foreach ($commentsfollows as $key => $commentfollow) {
            if ($commentfollow['parentid'] == $questionid) {
                $question['deleteable'] = false;
            }
            if (isset($answers[$commentfollow['parentid']])) {
                $answers[$commentfollow['parentid']]['deleteable'] = false;
            }
            qa_page_q_post_rules($commentsfollows[$key]);
        }
    }
}
开发者ID:TheProjecter,项目名称:microprobe,代码行数:63,代码来源:qa-page-question.php

示例7: doctype

 function doctype()
 {
     if (strpos($this->request, 'user/') !== false && strpos($this->request, 'articles') !== false) {
         $this->request = 'user-articles';
     }
     /*
     	ADAPT USER PAGES AND SUBPAGES
     */
     if ($this->template == 'user' || $this->template == 'user-wall' || $this->template == 'user-activity' || $this->template == 'user-questions' || $this->template == 'user-answers' || $this->request == 'user-articles') {
         $handle = qa_request_part(1);
         if (!strlen($handle)) {
             $handle = qa_get_logged_in_handle();
             qa_redirect(isset($handle) ? 'user/' . $handle : 'users');
         }
         $identifier = QA_FINAL_EXTERNAL_USERS ? $userid : $handle;
         list($useraccount, $userprofile, $userfields, $usermessages, $userpoints, $userlevels, $navcategories, $userrank) = qa_db_select_with_pending(QA_FINAL_EXTERNAL_USERS ? null : qa_db_user_account_selectspec($handle, false), QA_FINAL_EXTERNAL_USERS ? null : qa_db_user_profile_selectspec($handle, false), QA_FINAL_EXTERNAL_USERS ? null : qa_db_userfields_selectspec(), QA_FINAL_EXTERNAL_USERS ? null : qa_db_recent_messages_selectspec(null, null, $handle, false, qa_opt_if_loaded('page_size_wall')), qa_db_user_points_selectspec($identifier), qa_db_user_levels_selectspec($identifier, QA_FINAL_EXTERNAL_USERS, true), qa_db_category_nav_selectspec(null, true), qa_db_user_rank_selectspec($identifier));
         $userid = $useraccount['userid'];
         $loginuserid = qa_get_logged_in_userid();
         if ($this->template == 'user') {
             // ADAPT FORM CONTENTS
             /*$this->content['form_activity']['fields']['activity'] = array('type'=>'static', 
             		'label'=>'Recent Activity',
             		'value'=>'<a href="'.$handle.'/activity">show</a>');*/
             // ADD PRIVATE MESSAGE LINK AFTER MEMBERSHIP DURATION
             if (qa_opt('allow_private_messages') && isset($loginuserid) && $loginuserid != $userid && !($useraccount['flags'] & QA_USER_FLAGS_NO_MESSAGES)) {
                 $this->content['form_profile']['fields']['duration']['value'] .= strtr(qa_lang_html('profile/send_private_message'), array('^1' => '<a href="' . qa_path_html('message/' . $handle) . '">', '^2' => '</a>'));
             }
         }
         $site_url = qa_opt('site_url');
         // RENEW THE SUB-NAVIGATION
         unset($this->content['navigation']['sub']);
         $this->content['navigation']['sub']['account'] = array('label' => 'User ' . $handle, 'url' => $site_url . '/user/' . $handle, 'selected' => $this->template == 'user' ? 1 : 0);
         $this->content['navigation']['sub']['wall'] = array('label' => $handle . '\'s Wall', 'url' => $site_url . '/user/' . $handle . '/wall', 'selected' => $this->template == 'user-wall' ? 1 : 0);
         $this->content['navigation']['sub']['activity'] = array('label' => qa_lang('qa_blog_lang/nav_activity'), 'url' => $site_url . '/user/' . $handle . '/activity', 'selected' => $this->template == 'user-activity' ? 1 : 0);
         $this->content['navigation']['sub']['questions'] = array('label' => qa_lang('qa_blog_lang/nav_questions'), 'url' => $site_url . '/user/' . $handle . '/questions', 'selected' => $this->template == 'user-questions' ? 1 : 0);
         $this->content['navigation']['sub']['answers'] = array('label' => qa_lang('qa_blog_lang/nav_answers'), 'url' => $site_url . '/user/' . $handle . '/answers', 'selected' => $this->template == 'user-answers' ? 1 : 0);
         $this->content['navigation']['sub']['articles'] = array('label' => qa_lang('qa_blog_lang/nav_articles'), 'url' => $site_url . '/user/' . $handle . '/articles', 'selected' => $this->request == 'user-articles' ? 1 : 0);
         $this->content['navigation']['sub']['newarticles'] = array('label' => qa_lang('qa_blog_lang/new_articles'), 'url' => $site_url . '/articles', 'selected' => $this->request == 'articles' ? 1 : 0);
         if ($this->request == 'user-articles') {
             unset($this->content['title']);
             $this->content['title'] = qa_lang('qa_blog_lang/title_recent') . " {$handle}";
             unset($this->content['suggest_next']);
             unset($this->content['error']);
             if ($this->request == 'user-articles') {
                 $qa_content['custom'] = "";
                 $html = "";
                 $result = qa_db_query_sub("SELECT * FROM ^blog_posts WHERE userid =  '{$userid}' ORDER BY posted DESC");
                 $i = 0;
                 while ($article = mysqli_fetch_array($result)) {
                     $i++;
                     $html .= article_item($article['title'], $site_url . '/blog/' . $article['postid'] . '/' . seoUrl2($article['title']) . '/', $article['posted'], $article['views']);
                 }
                 if ($i == 0) {
                     $html = "<h3>" . qa_lang('qa_blog_lang/oops') . " {$handle} " . qa_lang('qa_blog_lang/no_post') . "</h3>";
                 }
                 $this->content['custom'] = $html;
             }
         }
     } else {
         if ($this->template == 'account' || $this->template == 'favorites' || $this->template == 'updates' || $this->request == 'gallery' || $this->request == 'articles') {
             // ADAPT FORM FOR DETAILS SUBPAGE
             // RENEW THE SUB-NAVIGATION
             unset($this->content['navigation']['sub']);
             $this->content['navigation']['sub']['account'] = array('label' => 'My Details', 'url' => './account', 'selected' => $this->template == 'account' ? 1 : 0);
             $this->content['navigation']['sub']['favorites'] = array('label' => 'My Favorites', 'url' => './favorites', 'selected' => $this->template == 'favorites' ? 1 : 0);
             $this->content['navigation']['sub']['updates'] = array('label' => 'My Updates', 'url' => './updates', 'selected' => $this->template == 'updates' ? 1 : 0);
             $this->content['navigation']['sub']['articles'] = array('label' => 'My Articles', 'url' => './articles', 'selected' => $this->request == 'articles' ? 1 : 0);
         } else {
             if ($this->template == 'users') {
                 require_once QA_INCLUDE_DIR . 'qa-db-users.php';
                 require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
                 require_once QA_INCLUDE_DIR . 'qa-app-format.php';
                 $start = qa_get_start();
                 $users = qa_db_select_with_pending(qa_db_top_users_selectspec($start, qa_opt_if_loaded('page_size_users')));
                 $usercount = qa_opt('cache_userpointscount');
                 $pagesize = qa_opt('page_size_users');
                 $users = array_slice($users, 0, $pagesize);
                 $usershtml = qa_userids_handles_html($users);
                 // CHANGE TITLE
                 $this->content['title'] = 'Users';
                 $this->content['ranking'] = array('items' => array(), 'rows' => ceil($pagesize / qa_opt('columns_users')), 'type' => 'users');
                 if (count($users)) {
                     foreach ($users as $userid => $user) {
                         $this->content['ranking']['items'][] = array('label' => (QA_FINAL_EXTERNAL_USERS ? qa_get_external_avatar_html($user['userid'], qa_opt('avatar_users_size'), true) : qa_get_user_avatar_html($user['flags'], $user['email'], $user['handle'], $user['avatarblobid'], $user['avatarwidth'], $user['avatarheight'], qa_opt('avatar_users_size'), true)) . ' ' . $usershtml[$user['userid']], 'score' => qa_html(number_format($user['points'])));
                     }
                 } else {
                     $this->content['title'] = qa_lang_html('main/no_active_users');
                 }
                 $this->content['page_links'] = qa_html_page_links(qa_request(), $start, $pagesize, $usercount, qa_opt('pages_prev_next'));
                 // EMPTY SUB-NAVIGATION
                 $this->content['navigation']['sub'] = null;
             }
         }
     }
     if ($this->template == 'questions') {
         unset($this->content['navigation']['sub']);
         $this->content['navigation']['sub']['account'] = array('label' => 'My Details', 'url' => './account', 'selected' => 0);
         //print_r ($this->content['navigation']);
     }
     if ($this->request == 'login') {
//.........这里部分代码省略.........
开发者ID:arjunsuresh,项目名称:qa-blog-post,代码行数:101,代码来源:qa-users-layer.php

示例8: ra_cat_list

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;
}
开发者ID:rahularyan,项目名称:dude-theme,代码行数:19,代码来源:qa-plugin.php

示例9: qa_get

$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:
        $selectby = 'acount';
        break;
}
list($questions, $categories, $categoryid) = qa_db_select_with_pending(qa_db_unanswered_qs_selectspec($userid, $selectby, $start, $categoryslugs, false, false, qa_opt_if_loaded('page_size_una_qs')), QA_ALLOW_UNINDEXED_QUERIES ? qa_db_category_nav_selectspec($categoryslugs, false, false, true) : null, $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']);
}
$feedpathprefix = null;
$linkparams = array('by' => $by);
switch ($by) {
    case 'selected':
        if ($countslugs) {
            $sometitle = qa_lang_html_sub('main/unselected_qs_in_x', $categorytitlehtml);
            $nonetitle = qa_lang_html_sub('main/no_una_questions_in_x', $categorytitlehtml);
        } else {
            $sometitle = qa_lang_html('main/unselected_qs_title');
开发者ID:mostafiz93,项目名称:PrintfScanf,代码行数:31,代码来源:qa-page-unanswered.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 (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

示例11: strtr

                 $qa_content['form_profile']['fields']['level']['suffix'] = strtr(qa_lang_html('users/category_level_add'), array('^1' => '<a href="' . qa_path_html(qa_request(), array('state' => 'edit', 'catleveladd' => 1)) . '">', '^2' => '</a>'));
             } else {
                 $qa_content['form_profile']['fields']['level']['suffix'] = qa_lang_html('users/level_in_general');
             }
             if ($catleveladd || count($userlevels)) {
                 $userlevels[] = array('entitytype' => QA_ENTITY_CATEGORY);
             }
             $index = 0;
             foreach ($userlevels as $userlevel) {
                 if ($userlevel['entitytype'] == QA_ENTITY_CATEGORY) {
                     $index++;
                     $id = 'ls_' . +$index;
                     $qa_content['form_profile']['fields']['uc_' . $index . '_level'] = array('label' => qa_lang_html('users/category_level_label'), 'type' => 'select', 'tags' => 'name="uc_' . $index . '_level" id="' . qa_html($id) . '" onchange="this.qa_prev=this.options[this.selectedIndex].value;"', 'options' => $catleveloptions, 'value' => isset($userlevel['level']) ? qa_html(qa_user_level_string($userlevel['level'])) : '', 'suffix' => qa_lang_html('users/category_level_in'));
                     $qa_content['form_profile']['fields']['uc_' . $index . '_cat'] = array();
                     if (isset($userlevel['entityid'])) {
                         $fieldnavcategories = qa_db_select_with_pending(qa_db_category_nav_selectspec($userlevel['entityid'], true));
                     } else {
                         $fieldnavcategories = $navcategories;
                     }
                     qa_set_up_category_field($qa_content, $qa_content['form_profile']['fields']['uc_' . $index . '_cat'], 'uc_' . $index . '_cat', $fieldnavcategories, @$userlevel['entityid'], true, true);
                     unset($qa_content['form_profile']['fields']['uc_' . $index . '_cat']['note']);
                 }
             }
             $qa_content['script_lines'][] = array("function qa_update_category_levels()", "{", "\tglob=document.getElementById('level_select');", "\tif (!glob)", "\t\treturn;", "\tvar opts=glob.options;", "\tvar lev=parseInt(opts[glob.selectedIndex].value);", "\tfor (var i=1; i<9999; i++) {", "\t\tvar sel=document.getElementById('ls_'+i);", "\t\tif (!sel)", "\t\t\tbreak;", "\t\tsel.qa_prev=sel.qa_prev || sel.options[sel.selectedIndex].value;", "\t\tsel.options.length=1;", "\t\tfor (var j=0; j<opts.length; j++)", "\t\t\tif (parseInt(opts[j].value)>lev)", "\t\t\t\tsel.options[sel.options.length]=new Option(opts[j].text, opts[j].value, false, (opts[j].value==sel.qa_prev));", "\t}", "}");
             $qa_content['script_onloads'][] = array("qa_update_category_levels();");
             $qa_content['form_profile']['fields']['level']['tags'] .= ' id="level_select" onchange="qa_update_category_levels();"';
         }
     }
 } else {
     foreach ($userlevels as $userlevel) {
         if ($userlevel['entitytype'] == QA_ENTITY_CATEGORY && $userlevel['level'] > $useraccount['level']) {
开发者ID:gogupe,项目名称:question2answer-releases,代码行数:31,代码来源:qa-page-user-profile.php

示例12: qa_report_event

qa_report_event('page_enter', qa_get_logged_in_userid(), qa_get_logged_in_handle(), qa_cookie_get(), array('params' => $_SERVER['QUERY_STRING'], 'path' => $_SERVER['SCRIPT_NAME']));
require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
require_once QA_INCLUDE_DIR . 'qa-app-format.php';
//	Determine whether path begins with qa or not (question and answer listing can be accessed either way)
$explicitqa = $qa_request_lc_parts[0] == 'qa';
if ($explicitqa) {
    $slugs = array_slice($qa_request_parts, 1);
} elseif (strlen($qa_request_parts[0])) {
    // $qa_request_parts[0] always present so we need to check its length
    $slugs = $qa_request_parts;
} else {
    $slugs = array();
}
$countslugs = count($slugs);
//	Get list of questions, other bits of information that might be
@(list($questions1, $questions2, $categories, $categoryid, $custompage) = qa_db_select_with_pending(qa_db_qs_selectspec($qa_login_userid, 'created', 0, $slugs), qa_db_recent_a_qs_selectspec($qa_login_userid, 0, $slugs), qa_db_category_nav_selectspec($slugs, false), $countslugs ? qa_db_slugs_to_category_id_selectspec($slugs) : null, $countslugs == 1 && !$explicitqa ? qa_db_page_full_selectspec($slugs[0], false) : null));
//	First, if this matches a custom page, return immediately with that page's content
if (isset($custompage) && !($custompage['flags'] & QA_PAGE_FLAGS_EXTERNAL)) {
    $qa_template = 'custom';
    $qa_content = qa_content_prepare();
    $qa_content['title'] = qa_html($custompage['heading']);
    $qa_content['custom'] = $custompage['content'];
    if (qa_get_logged_in_level() >= QA_USER_LEVEL_ADMIN) {
        $qa_content['navigation']['sub'] = array('admin/pages' => array('label' => qa_lang('admin/edit_custom_page'), 'url' => qa_path_html('admin/pages', array('edit' => $custompage['pageid']))));
    }
    return $qa_content;
}
//	Then, see if we should redirect because the 'qa' page is the same as the home page
if ($explicitqa && !qa_is_http_post() && !qa_has_custom_home()) {
    qa_redirect(qa_category_path_request($categories, $categoryid), $_GET);
}
开发者ID:TheProjecter,项目名称:microprobe,代码行数:31,代码来源:qa-page-default.php

示例13: elseif

 } elseif (qa_post_text('dodelete')) {
     if (!$hassubcategory) {
         $inreassign = qa_get_category_field_value('reassign');
         qa_db_category_reassign($editcategory['categoryid'], $inreassign);
         qa_db_category_delete($editcategory['categoryid']);
         qa_redirect(qa_request(), array('recalc' => 1, 'edit' => $editcategory['parentid']));
     }
 } else {
     require_once QA_INCLUDE_DIR . 'util/string.php';
     $inname = qa_post_text('name');
     $incontent = qa_post_text('content');
     $inparentid = $setparent ? qa_get_category_field_value('parent') : $editcategory['parentid'];
     $inposition = qa_post_text('position');
     $errors = array();
     //	Check the parent ID
     $incategories = qa_db_select_with_pending(qa_db_category_nav_selectspec($inparentid, true));
     //	Verify the name is legitimate for that parent ID
     if (empty($inname)) {
         $errors['name'] = qa_lang('main/field_required');
     } elseif (qa_strlen($inname) > QA_DB_MAX_CAT_PAGE_TITLE_LENGTH) {
         $errors['name'] = qa_lang_sub('main/max_length_x', QA_DB_MAX_CAT_PAGE_TITLE_LENGTH);
     } else {
         foreach ($incategories as $category) {
             if (!strcmp($category['parentid'], $inparentid) && strcmp($category['categoryid'], @$editcategory['categoryid']) && qa_strtolower($category['title']) == qa_strtolower($inname)) {
                 $errors['name'] = qa_lang('admin/category_already_used');
             }
         }
     }
     //	Verify the slug is legitimate for that parent ID
     for ($attempt = 0; $attempt < 100; $attempt++) {
         switch ($attempt) {
开发者ID:kosmoluna,项目名称:question2answer,代码行数:31,代码来源:admin-categories.php

示例14: header

	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';
require_once QA_INCLUDE_DIR . 'app/q-list.php';
$categoryslugs = qa_request_parts(1);
$countslugs = count($categoryslugs);
$userid = qa_get_logged_in_userid();
//	Get lists of recent activity in all its forms, plus category information
list($questions1, $questions2, $questions3, $questions4, $categories, $categoryid) = qa_db_select_with_pending(qa_db_qs_selectspec($userid, 'created', 0, $categoryslugs, null, false, false, qa_opt_if_loaded('page_size_activity')), qa_db_recent_a_qs_selectspec($userid, 0, $categoryslugs), qa_db_recent_c_qs_selectspec($userid, 0, $categoryslugs), qa_db_recent_edit_qs_selectspec($userid, 0, $categoryslugs), 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/recent_activity_in_x', $categorytitlehtml);
    $nonetitle = qa_lang_html_sub('main/no_questions_in_x', $categorytitlehtml);
} else {
    $sometitle = qa_lang_html('main/recent_activity_title');
    $nonetitle = qa_lang_html('main/no_questions_found');
}
//	Prepare and return content for theme
return qa_q_list_page_content(qa_any_sort_and_dedupe(array_merge($questions1, $questions2, $questions3, $questions4)), qa_opt('page_size_activity'), 0, null, $sometitle, $nonetitle, $categories, $categoryid, true, 'activity/', qa_opt('feed_for_activity') ? 'activity' : null, qa_html_suggest_qs_tags(qa_using_tags(), qa_category_path_request($categories, $categoryid)), null, null);
/*
	Omit PHP closing tag to help avoid accidental output
开发者ID:kosmoluna,项目名称:question2answer,代码行数:30,代码来源:activity.php

示例15: header

	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;
}
// report that we entered this page
qa_report_event('page_enter', qa_get_logged_in_userid(), qa_get_logged_in_handle(), qa_cookie_get(), array('params' => $_SERVER['QUERY_STRING'], 'path' => $_SERVER['SCRIPT_NAME']));
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 = $pass_subrequests;
$countslugs = count($categoryslugs);
//	Get lists of recent activity in all its forms, plus category information
@(list($questions1, $questions2, $questions3, $questions4, $categories, $categoryid) = qa_db_select_with_pending(qa_db_qs_selectspec($qa_login_userid, 'created', 0, $categoryslugs), qa_db_recent_a_qs_selectspec($qa_login_userid, 0, $categoryslugs), qa_db_recent_c_qs_selectspec($qa_login_userid, 0, $categoryslugs), qa_db_recent_edit_qs_selectspec($qa_login_userid, 0, $categoryslugs), qa_db_category_nav_selectspec($categoryslugs, false), $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/recent_activity_in_x', $categorytitlehtml);
    $nonetitle = qa_lang_html_sub('main/no_questions_in_x', $categorytitlehtml);
} else {
    $sometitle = qa_lang_html('main/recent_activity_title');
    $nonetitle = qa_lang_html('main/no_questions_found');
}
//	Prepare and return content for theme
return qa_q_list_page_content(qa_any_sort_and_dedupe(array_merge($questions1, $questions2, $questions3, $questions4)), qa_opt('page_size_activity'), 0, null, $sometitle, $nonetitle, $categories, $categoryid, true, 'activity/', qa_opt('feed_for_activity') ? 'activity' : null, qa_html_suggest_qs_tags(qa_using_tags(), qa_category_path_request($categories, $categoryid)));
/*
	Omit PHP closing tag to help avoid accidental output
开发者ID:TheProjecter,项目名称:microprobe,代码行数:31,代码来源:qa-page-activity.php


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