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


PHP qa_path_to_root函数代码示例

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


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

示例1: logout_html

 function logout_html($tourl)
 {
     require_once QA_INCLUDE_DIR . "qa-base.php";
     $_SESSION['logout_url'] = $tourl;
     $logout_url = qa_path('auth/logout', null, qa_path_to_root());
     echo '<a href="' . $logout_url . '">' . qa_lang_html('main/nav_logout') . '</a>';
 }
开发者ID:neobubbaloo82,项目名称:qa-ldap-login,代码行数:7,代码来源:ldap-login.php

示例2: qa_db_user_find_by_email

            // handles can't contain @ symbols
            $matchusers = qa_db_user_find_by_email($inemailhandle);
        } else {
            $matchusers = qa_db_user_find_by_handle($inemailhandle);
        }
        if (count($matchusers) == 1) {
            // if matches more than one (should be impossible), don't log in
            $inuserid = $matchusers[0];
            $userinfo = qa_db_select_with_pending(qa_db_user_account_selectspec($inuserid, true));
            if (strtolower(qa_db_calc_passcheck($inpassword, $userinfo['passsalt'])) == strtolower($userinfo['passcheck'])) {
                // login and redirect
                require_once QA_INCLUDE_DIR . 'qa-app-users.php';
                qa_set_logged_in_user($inuserid, $userinfo['handle'], $inremember ? true : false);
                $topath = qa_get('to');
                if (isset($topath)) {
                    qa_redirect_raw(qa_path_to_root() . $topath);
                } elseif ($passwordsent) {
                    qa_redirect('account');
                } else {
                    qa_redirect('welcome');
                }
            } else {
                $errors['password'] = qa_lang('users/password_wrong');
            }
        } else {
            $errors['emailhandle'] = qa_lang('users/user_not_found');
        }
    } else {
        $pageerror = qa_lang('users/login_limit');
    }
} else {
开发者ID:ruuttt,项目名称:question2answer,代码行数:31,代码来源:qa-page-login.php

示例3: qa_request_part

require_once QA_INCLUDE_DIR . 'qa-app-format.php';
require_once QA_INCLUDE_DIR . 'qa-app-updates.php';
require_once QA_INCLUDE_DIR . 'qa-app-users.php';
$handle = qa_request_part(1);
if (!strlen($handle)) {
    qa_redirect('users');
}
//	Get the HTML to display for the handle, and if we're using external users, determine the userid
if (QA_FINAL_EXTERNAL_USERS) {
    $publictouserid = qa_get_userids_from_public(array($handle));
    if (!count($publictouserid)) {
        return include QA_INCLUDE_DIR . 'qa-page-not-found.php';
    }
    $userid = reset($publictouserid);
    // don't use $publictouserid[$handle] since $handle capitalization might be different
    $usershtml = qa_get_users_html(array($userid), false, qa_path_to_root(), true);
    $userhtml = @$usershtml[$userid];
} else {
    $userhtml = qa_html($handle);
}
//	Find the user profile and questions and answers for this handle
$loginuserid = qa_get_logged_in_userid();
$identifier = QA_FINAL_EXTERNAL_USERS ? $userid : $handle;
@(list($useraccount, $userprofile, $userfields, $userpoints, $userrank, $questions, $answerqs, $commentqs, $editqs, $favorite) = 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_db_user_points_selectspec($identifier), qa_db_user_rank_selectspec($identifier), qa_db_user_recent_qs_selectspec($loginuserid, $identifier, qa_opt_if_loaded('page_size_user_posts')), qa_db_user_recent_a_qs_selectspec($loginuserid, $identifier), qa_db_user_recent_c_qs_selectspec($loginuserid, $identifier), qa_db_user_recent_edit_qs_selectspec($loginuserid, $identifier), isset($loginuserid) && !QA_FINAL_EXTERNAL_USERS ? qa_db_is_favorite_selectspec($loginuserid, QA_ENTITY_USER, $handle) : null));
//	Check the user exists and work out what can and can't be set (if not using single sign-on)
$loginlevel = qa_get_logged_in_level();
if (!QA_FINAL_EXTERNAL_USERS) {
    // if we're using integrated user management, we can know and show more
    if (!is_array($userpoints) && !is_array($useraccount)) {
        return include QA_INCLUDE_DIR . 'qa-page-not-found.php';
    }
开发者ID:ruuttt,项目名称:question2answer,代码行数:31,代码来源:qa-page-user.php

示例4: badge_notify

 function badge_notify()
 {
     $userid = qa_get_logged_in_userid();
     qa_db_query_sub('CREATE TABLE IF NOT EXISTS ^userbadges (' . 'awarded_at DATETIME NOT NULL,' . 'user_id INT(11) NOT NULL,' . 'notify TINYINT DEFAULT 0 NOT NULL,' . 'object_id INT(10),' . 'badge_slug VARCHAR (64) CHARACTER SET ascii DEFAULT \'\',' . 'id INT(11) NOT NULL AUTO_INCREMENT,' . 'PRIMARY KEY (id)' . ') ENGINE=MyISAM DEFAULT CHARSET=utf8');
     $result = qa_db_read_all_values(qa_db_query_sub('SELECT badge_slug FROM ^userbadges WHERE user_id=# AND notify>=1', $userid));
     if (count($result) > 0) {
         $notice = '<div class="notify-container">';
         if (count($result) == 1) {
             $slug = $result[0];
             $badge_name = qa_lang('badges/' . $slug);
             if (!qa_opt('badge_' . $slug . '_name')) {
                 qa_opt('badge_' . $slug . '_name', $badge_name);
             }
             $name = qa_opt('badge_' . $slug . '_name');
             $notice .= '<div class="badge-notify notify">' . qa_lang('badges/badge_notify') . "'" . $name . '\'&nbsp;&nbsp;' . qa_lang('badges/badge_notify_profile_pre') . '<a href="' . qa_path_html((QA_FINAL_EXTERNAL_USERS ? qa_path_to_root() : '') . 'user/' . qa_get_logged_in_handle(), array('tab' => 'badges'), qa_opt('site_url')) . '">' . qa_lang('badges/badge_notify_profile') . '</a><div class="notify-close" onclick="jQuery(this).parent().slideUp(\'slow\')">x</div></div>';
         } else {
             $number_text = count($result) > 2 ? str_replace('#', count($result) - 1, qa_lang('badges/badge_notify_multi_plural')) : qa_lang('badges/badge_notify_multi_singular');
             $slug = $result[0];
             $badge_name = qa_lang('badges/' . $slug);
             if (!qa_opt('badge_' . $slug . '_name')) {
                 qa_opt('badge_' . $slug . '_name', $badge_name);
             }
             $name = qa_opt('badge_' . $slug . '_name');
             $notice .= '<div class="badge-notify notify">' . qa_lang('badges/badge_notify') . "'" . $name . '\'&nbsp;' . $number_text . '&nbsp;&nbsp;' . qa_lang('badges/badge_notify_profile_pre') . '<a href="' . qa_path_html('user/' . qa_get_logged_in_handle(), array('tab' => 'badges'), qa_opt('site_url')) . '">' . qa_lang('badges/badge_notify_profile') . '</a><div class="notify-close" onclick="jQuery(this).parent().slideUp(\'slow\')">x</div></div>';
         }
         $notice .= '</div>';
         // remove notification flag
         qa_db_query_sub('UPDATE ^userbadges SET notify=0 WHERE user_id=# AND notify>=1', $userid);
         $this->badge_notice = $notice;
     }
 }
开发者ID:architbakliwal,项目名称:Q2A,代码行数:31,代码来源:qa-badge-layer.php

示例5: qa_load_theme_class

function qa_load_theme_class($theme, $template, $content, $request)
{
    if (qa_to_override(__FUNCTION__)) {
        $args = func_get_args();
        return qa_call_override(__FUNCTION__, $args);
    }
    global $qa_layers;
    //	First load the default class
    require_once QA_INCLUDE_DIR . 'qa-theme-base.php';
    $classname = 'qa_html_theme_base';
    //	Then load the selected theme if valid, otherwise load the Classic theme
    if (!file_exists(QA_THEME_DIR . $theme . '/qa-styles.css')) {
        $theme = 'Classic';
    }
    $themeroothtml = qa_html(qa_path_to_root() . 'qa-theme/' . $theme . '/');
    if (file_exists(QA_THEME_DIR . $theme . '/qa-theme.php')) {
        require_once QA_THEME_DIR . $theme . '/qa-theme.php';
        if (class_exists('qa_html_theme')) {
            $classname = 'qa_html_theme';
        }
    }
    //	Create the list of layers to load
    $loadlayers = $qa_layers;
    if (!qa_user_maximum_permit_error('permit_view_voters_flaggers')) {
        $loadlayers[] = array('directory' => QA_INCLUDE_DIR . 'plugins/', 'include' => 'qa-layer-voters-flaggers.php', 'urltoroot' => null);
    }
    //	Then load any theme layers using some class-munging magic (substitute class names)
    $layerindex = 0;
    foreach ($loadlayers as $layer) {
        $filename = $layer['directory'] . $layer['include'];
        $layerphp = file_get_contents($filename);
        if (strlen($layerphp)) {
            $newclassname = 'qa_layer_' . ++$layerindex . '_from_' . preg_replace('/[^A-Za-z0-9_]+/', '_', basename($layer['include']));
            // include file name in layer class name to make debugging easier if there is an error
            if (preg_match('/\\s+class\\s+qa_html_theme_layer\\s+extends\\s+qa_html_theme_base\\s+/im', $layerphp) != 1) {
                qa_fatal_error('Class for layer must be declared as "class qa_html_theme_layer extends qa_html_theme_base" in ' . $layer['directory'] . $layer['include']);
            }
            $searchwordreplace = array('qa_html_theme_base::qa_html_theme_base' => $classname . '::__construct', 'parent::qa_html_theme_base' => 'parent::__construct', 'qa_html_theme_layer' => $newclassname, 'qa_html_theme_base' => $classname, 'QA_HTML_THEME_LAYER_DIRECTORY' => "'" . $layer['directory'] . "'", 'QA_HTML_THEME_LAYER_URLTOROOT' => "'" . qa_path_to_root() . $layer['urltoroot'] . "'");
            foreach ($searchwordreplace as $searchword => $replace) {
                if (preg_match_all('/\\W(' . preg_quote($searchword, '/') . ')\\W/im', $layerphp, $matches, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE)) {
                    $searchmatches = array_reverse($matches[1]);
                    // don't use preg_replace due to complication of escaping replacement phrase
                    foreach ($searchmatches as $searchmatch) {
                        $layerphp = substr_replace($layerphp, $replace, $searchmatch[1], strlen($searchmatch[0]));
                    }
                }
            }
            //	echo '<pre style="text-align:left;">'.htmlspecialchars($layerphp).'</pre>'; // to debug munged code
            qa_eval_from_file($layerphp, $filename);
            $classname = $newclassname;
        }
    }
    //	Finally, instantiate the object
    $themeclass = new $classname($template, $content, $themeroothtml, $request);
    return $themeclass;
}
开发者ID:amiyasahu,项目名称:question2answer,代码行数:56,代码来源:format.php

示例6: qa_path

function qa_path($request, $params = null, $rooturl = null, $neaturls = null, $anchor = null)
{
    if (qa_to_override(__FUNCTION__)) {
        $args = func_get_args();
        return qa_call_override(__FUNCTION__, $args);
    }
    if (!isset($neaturls)) {
        require_once QA_INCLUDE_DIR . 'qa-app-options.php';
        $neaturls = qa_opt('neat_urls');
    }
    if (!isset($rooturl)) {
        $rooturl = qa_path_to_root();
    }
    $url = $rooturl . (empty($rooturl) || substr($rooturl, -1) == '/' ? '' : '/');
    $paramsextra = '';
    $requestparts = explode('/', $request);
    $pathmap = qa_get_request_map();
    if (isset($pathmap[$requestparts[0]])) {
        $newpart = $pathmap[$requestparts[0]];
        if (strlen($newpart)) {
            $requestparts[0] = $newpart;
        } elseif (count($requestparts) == 1) {
            array_shift($requestparts);
        }
    }
    foreach ($requestparts as $index => $requestpart) {
        $requestparts[$index] = urlencode($requestpart);
    }
    $requestpath = implode('/', $requestparts);
    switch ($neaturls) {
        case QA_URL_FORMAT_INDEX:
            if (!empty($request)) {
                $url .= 'index.php/' . $requestpath;
            }
            break;
        case QA_URL_FORMAT_NEAT:
            $url .= $requestpath;
            break;
        case QA_URL_FORMAT_PARAM:
            if (!empty($request)) {
                $paramsextra = '?qa=' . $requestpath;
            }
            break;
        default:
            $url .= 'index.php';
        case QA_URL_FORMAT_PARAMS:
            if (!empty($request)) {
                foreach ($requestparts as $partindex => $requestpart) {
                    $paramsextra .= (strlen($paramsextra) ? '&' : '?') . 'qa' . ($partindex ? '_' . $partindex : '') . '=' . $requestpart;
                }
            }
            break;
    }
    if (isset($params)) {
        foreach ($params as $key => $value) {
            $paramsextra .= (strlen($paramsextra) ? '&' : '?') . urlencode($key) . '=' . urlencode((string) $value);
        }
    }
    return $url . $paramsextra . (empty($anchor) ? '' : '#' . urlencode($anchor));
}
开发者ID:netham91,项目名称:question2answer,代码行数:60,代码来源:qa-base.php

示例7: ask_button

 /**
  * Custom ask button for medium and small screen
  *
  * @access private
  * @since Snow 1.4
  * @version 1.0
  * @return string Ask button html markup
  */
 private function ask_button()
 {
     return '<div class="qam-ask-search-box">' . '<div class="qam-ask-mobile">' . '<a href="' . qa_path('ask', null, qa_path_to_root()) . '" class="' . $this->ask_search_box_class . '">' . qa_lang_html('main/nav_ask') . '</a>' . '</div>' . '<div class="qam-search-mobile ' . $this->ask_search_box_class . '" id="qam-search-mobile">' . '</div>' . '</div>';
 }
开发者ID:ronkeizer,项目名称:question2answer,代码行数:12,代码来源:qa-theme.php

示例8: array

 if ($type == 'number-blank') {
     $type = 'number';
 }
 $value = $options[$optionname];
 $optionfield = array('id' => $optionname, 'label' => ($indented ? '&ndash; ' : '') . qa_lang_html('options/' . $optionname), 'tags' => 'name="option_' . $optionname . '" id="option_' . $optionname . '"', 'value' => qa_html($value), 'type' => $type, 'error' => qa_html(@$errors[$optionname]));
 if (isset($optionmaximum[$optionname])) {
     $optionfield['note'] = qa_lang_html_sub('admin/maximum_x', $optionmaximum[$optionname]);
 }
 $feedrequest = null;
 $feedisexample = false;
 switch ($optionname) {
     // special treatment for certain options
     case 'site_language':
         require_once QA_INCLUDE_DIR . 'qa-util-string.php';
         qa_optionfield_make_select($optionfield, qa_admin_language_options(), $value, '');
         $optionfield['suffix'] = strtr(qa_lang_html('admin/check_language_suffix'), array('^1' => '<a href="' . qa_html(qa_path_to_root() . 'qa-include/qa-check-lang.php') . '">', '^2' => '</a>'));
         if (!qa_has_multibyte()) {
             $optionfield['error'] = qa_lang_html('admin/no_multibyte');
         }
         break;
     case 'neat_urls':
         $neatoptions = array();
         $rawoptions = array(QA_URL_FORMAT_NEAT, QA_URL_FORMAT_INDEX, QA_URL_FORMAT_PARAM, QA_URL_FORMAT_PARAMS, QA_URL_FORMAT_SAFEST);
         foreach ($rawoptions as $rawoption) {
             $neatoptions[$rawoption] = '<iframe src="' . qa_path_html('url/test/' . QA_URL_TEST_STRING, array('dummy' => '', 'param' => QA_URL_TEST_STRING), null, $rawoption) . '" width="20" height="16" style="vertical-align:middle; border:0" scrolling="no" frameborder="0"></iframe>&nbsp;' . '<small>' . qa_html(urldecode(qa_path('123/why-do-birds-sing', null, '/', $rawoption))) . ($rawoption == QA_URL_FORMAT_NEAT ? strtr(qa_lang_html('admin/neat_urls_note'), array('^1' => '<a href="http://www.question2answer.org/htaccess.php" target="_blank">', '^2' => '</a>')) : '') . '</small>';
         }
         qa_optionfield_make_select($optionfield, $neatoptions, $value, QA_URL_FORMAT_SAFEST);
         $optionfield['type'] = 'select-radio';
         $optionfield['note'] = qa_lang_html_sub('admin/url_format_note', '<span style=" ' . qa_admin_url_test_html() . '/span>');
         break;
     case 'site_theme':
开发者ID:mostafiz93,项目名称:PrintfScanf,代码行数:31,代码来源:qa-page-admin-default.php

示例9: ask_button

 /**
  * Custom ask button for medium and small screen
  *
  * @access private
  * @since Snow 1.4
  * @version 1.0
  * @return string Ask button html markup
  *
  * @author Q2A Market <http://www.q2amarket.com>
  * @copyright (c) 2014, Q2A Market
  * @license http://www.gnu.org/copyleft/gpl.html
  */
 private function ask_button()
 {
     $html = '<div class="qam-ask-search-box">';
     $html .= '<div class="qam-ask-mobile"><a href="' . qa_path('ask', null, qa_path_to_root()) . '" class="' . $this->qam_opt('ask_search_box_color') . '">' . qa_lang_html('main/nav_ask') . '</a></div>';
     $html .= '<div class="qam-search-mobile ' . $this->qam_opt('ask_search_box_color') . '" id="qam-search-mobile"></div>';
     $html .= '</div>';
     return $html;
 }
开发者ID:GitFuture,项目名称:bmf,代码行数:20,代码来源:qam-snow-theme.php

示例10: qa_content_prepare


//.........这里部分代码省略.........
        $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
            }
        }
    }
    $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_path_to_root() . $logourl) . '"' . ($logowidth ? ' width="' . $logowidth . '"' : '') . ($logoheight ? ' height="' . $logoheight . '"' : '') . ' border="0" alt="' . qa_html(qa_opt('site_title')) . '"/></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
    $userlinks = qa_get_login_links(qa_path_to_root(), isset($topath) ? $topath : qa_path($request, $_GET, ''));
    $qa_content['navigation']['user'] = array();
    if (qa_is_logged_in()) {
        $qa_content['loggedin'] = qa_lang_html_sub_split('main/logged_in_x', QA_FINAL_EXTERNAL_USERS ? qa_get_logged_in_user_html(qa_get_logged_in_user_cache(), qa_path_to_root(), false) : qa_get_one_user_html(qa_get_logged_in_handle(), false));
        $qa_content['navigation']['user']['updates'] = array('url' => qa_path_html('updates'), 'label' => qa_lang_html('main/nav_updates'));
        if (!empty($userlinks['logout'])) {
            $qa_content['navigation']['user']['logout'] = array('url' => qa_html(@$userlinks['logout']), 'label' => qa_lang_html('main/nav_logout'));
        }
        if (!QA_FINAL_EXTERNAL_USERS) {
            $source = qa_get_logged_in_source();
            if (strlen($source)) {
                $loginmodules = qa_load_modules_with('login', 'match_source');
                foreach ($loginmodules as $module) {
                    if ($module->match_source($source) && method_exists($module, 'logout_html')) {
                        ob_start();
                        $module->logout_html(qa_path('logout', array(), qa_opt('site_url')));
                        $qa_content['navigation']['user']['logout'] = array('label' => ob_get_clean());
                    }
                }
            }
        }
        $notices = qa_db_get_pending_result('notices');
        foreach ($notices as $notice) {
            $qa_content['notices'][] = qa_notice_form($notice['noticeid'], qa_viewer_html($notice['content'], $notice['format']), $notice);
        }
    } else {
        require_once QA_INCLUDE_DIR . 'util/string.php';
开发者ID:Trideon,项目名称:gigolo,代码行数:67,代码来源:qa-page.php

示例11: process_request

    public function process_request($request)
    {
        $qa_content = qa_content_prepare();
        $category_1 = qa_opt('qa_blog_cat_1');
        $category_2 = qa_opt('qa_blog_cat_2');
        $category_3 = qa_opt('qa_blog_cat_3');
        $category_4 = qa_opt('qa_blog_cat_4');
        $category_5 = qa_opt('qa_blog_cat_5');
        $html = "";
        $postid = qa_request_part(1);
        if (isset($postid)) {
            $result = qa_db_query_sub('SELECT * FROM ^blog_posts WHERE `postid` LIKE #', $postid);
            if ($row = mysqli_fetch_array($result)) {
                $userid = $row['userid'];
                $author = handleLinkForID($row['userid']);
                $editor = qa_get_logged_in_userid();
                if ($userid >= $editor) {
                    if (qa_clicked('doedit')) {
                        $in = array();
                        qa_get_post_content('editor', 'content', $in['editor'], $in['content'], $in['format'], $in['text']);
                        $in['title'] = qa_post_text('title');
                        $in['category'] = qa_post_text('category');
                        if (strlen($in['title']) < 10 || strlen($in['content']) < 50 || $in['category'] !== 'cat_0' && $in['category'] !== 'cat_1' && $in['category'] !== 'cat_2' && $in['category'] !== 'cat_3' && $in['category'] !== 'cat_4' && $in['category'] !== 'cat_5') {
                            if (strlen($in['title']) < 10) {
                                $errors['title'] = qa_lang('qa_blog_lang/error_title');
                            }
                            if (strlen($in['content']) < 50) {
                                $errors['content'] = qa_lang('qa_blog_lang/error_content');
                            }
                            if ($in['category'] !== 'cat_0' && $in['category'] !== 'cat_1' && $in['category'] !== 'cat_2' && $in['category'] !== 'cat_3' && $in['category'] !== 'cat_4' && $in['category'] !== 'cat_5') {
                                $errors['type'] = 'Invalid category';
                            }
                        } else {
                            $type = 0;
                            if ($in['category'] === 'cat_1') {
                                $type = 1;
                            } else {
                                if ($in['category'] === 'cat_2') {
                                    $type = 2;
                                } else {
                                    if ($in['category'] === 'cat_3') {
                                        $type = 3;
                                    } else {
                                        if ($in['category'] === 'cat_4') {
                                            $type = 4;
                                        } else {
                                            if ($in['category'] === 'cat_5') {
                                                $type = 5;
                                            }
                                        }
                                    }
                                }
                            }
                            $result = qa_db_query_sub('UPDATE ^blog_posts SET updated=NOW(), title=$, content=$, type=#, format=$ WHERE postid=#', $in['title'], $in['content'], $type, 'markdown', $postid);
                            header('location:' . qa_path_to_root() . '/blog/' . $postid);
                        }
                    } else {
                        if (qa_clicked('doresetoptions')) {
                            $in = array();
                            qa_get_post_content('editor', 'content', $in['editor'], $in['content'], $in['format'], $in['text']);
                            $in['title'] = qa_post_text('title');
                            $in['category'] = qa_post_text('category');
                            if (strlen($in['title']) < 10 || strlen($in['content']) < 50 || $in['category'] !== 'cat_0' && $in['category'] !== 'cat_1' && $in['category'] !== 'cat_2' && $in['category'] !== 'cat_3' && $in['category'] !== 'cat_4' && $in['category'] !== 'cat_5') {
                                if (strlen($in['title']) < 10) {
                                    $errors['title'] = qa_lang('qa_blog_lang/error_title');
                                }
                                if (strlen($in['content']) < 50) {
                                    $errors['content'] = qa_lang('qa_blog_lang/error_content');
                                }
                                if ($in['category'] !== 'cat_0' && $in['category'] !== 'cat_1' && $in['category'] !== 'cat_2' && $in['category'] !== 'cat_3' && $in['category'] !== 'cat_4' && $in['category'] !== 'cat_5') {
                                    $errors['type'] = 'Invalid category';
                                }
                            } else {
                                $type = 0;
                                if ($in['category'] === 'cat_1') {
                                    $type = 1;
                                } else {
                                    if ($in['category'] === 'cat_2') {
                                        $type = 2;
                                    } else {
                                        if ($in['category'] === 'cat_3') {
                                            $type = 3;
                                        } else {
                                            if ($in['category'] === 'cat_4') {
                                                $type = 4;
                                            } else {
                                                if ($in['category'] === 'cat_5') {
                                                    $type = 5;
                                                }
                                            }
                                        }
                                    }
                                }
                                $result = qa_db_query_sub('UPDATE ^blog_posts SET updated=NOW(), title=$, content=$, type=#, format=$ WHERE postid=#', $in['title'], $in['content'], $type, 'draft', $postid);
                                header('location:' . qa_path_to_root() . '/blog/' . $postid);
                            }
                        } else {
                            if (qa_clicked('dogoback')) {
                                qa_redirect('blog');
                            } else {
//.........这里部分代码省略.........
开发者ID:arjunsuresh,项目名称:qa-blog-post,代码行数:101,代码来源:qa-edit.php

示例12: donut_theme_url

/**
 * returns the base url for the theme
 *
 * @return string
 */
function donut_theme_url()
{
    return qa_path_to_root() . donut_theme_folder();
}
开发者ID:hckrtech,项目名称:Donut,代码行数:9,代码来源:qa-donut-utils.php

示例13: process_request

    public function process_request($request)
    {
        $category_1 = qa_opt('qa_blog_cat_1');
        $category_2 = qa_opt('qa_blog_cat_2');
        $category_3 = qa_opt('qa_blog_cat_3');
        $category_4 = qa_opt('qa_blog_cat_4');
        $category_5 = qa_opt('qa_blog_cat_5');
        $qa_content = qa_content_prepare();
        $cat = -1;
        if (isset($_GET['category'])) {
            $cat = $_GET['category'];
        }
        $qa_content['navigation']['sub'] = array();
        $qa_content['navigation']['sub']['all'] = array('label' => qa_lang('qa_blog_lang/nav_all'), 'url' => qa_path_to_root() . '/blog', 'selected' => isset($_GET['category']) ? 0 : 1);
        $qa_content['navigation']['sub']['cat1'] = array('label' => $category_1, 'url' => qa_path_to_root() . '/blog?category=1', 'selected' => $cat == 1 ? 1 : 0);
        $qa_content['navigation']['sub']['cat2'] = array('label' => $category_2, 'url' => qa_path_to_root() . '/blog?category=2', 'selected' => $cat == 2 ? 1 : 0);
        $qa_content['navigation']['sub']['cat3'] = array('label' => $category_3, 'url' => qa_path_to_root() . '/blog?category=3', 'selected' => $cat == 3 ? 1 : 0);
        $qa_content['navigation']['sub']['cat4'] = array('label' => $category_4, 'url' => qa_path_to_root() . '/blog?category=4', 'selected' => $cat == 4 ? 1 : 0);
        $qa_content['navigation']['sub']['cat5'] = array('label' => $category_5, 'url' => qa_path_to_root() . '/blog?category=5', 'selected' => $cat == 5 ? 1 : 0);
        $qa_content['navigation']['sub']['post'] = array('label' => qa_lang('qa_blog_lang/nav_post'), 'url' => qa_path_to_root() . '/articles');
        $qa_content['title'] = qa_opt('qa_blog_title');
        $postid = qa_request_part(1);
        if (isset($postid)) {
            $result = qa_db_query_sub('SELECT * FROM ^blog_posts WHERE `postid` LIKE #', $postid);
            if ($row = mysqli_fetch_array($result)) {
                qa_db_query_sub('UPDATE ^blog_posts SET Views = Views + 1 WHERE `postid` LIKE #', $postid);
                $qa_content['title'] = $row['title'];
                $qa_content['custom'] = "";
                $html = qa_viewer_html($row['content'], $row['format'], array('showurllinks' => 1));
                $strviews = qa_lang('qa_blog_lang/post_views');
                $views = $row['views'];
                if ($row['views'] == 1) {
                    $strviews = qa_lang('qa_blog_lang/post_views');
                }
                $author = handleLinkForID($row['userid']);
                if ($row['userid'] == 0) {
                    $author = qa_lang('qa_blog_lang/userid_null');
                }
                $user = $row['userid'];
                $date = $row['posted'];
                $date = new DateTime($date);
                $on = $date->format('Y.m.d');
                $at = $date->format('H:i');
                $parentid = $postid;
                $result = qa_db_query_sub("SELECT COUNT(*) as total FROM ^blog_comments WHERE `parentid` LIKE #", $parentid);
                $countdata = mysqli_fetch_assoc($result);
                $count = $countdata['total'];
                $delete = "<a href='" . qa_path_to_root() . "/edit/" . $postid . "'/>\n\t\t\t<img src='" . qa_opt('site_url') . "qa-plugin/blog-post/images/delete.png'> Delete </a>";
                $edit = "<a href='" . qa_path_to_root() . "/edit/" . $postid . "'/>\n\t\t\t<img src='" . qa_opt('site_url') . "qa-plugin/blog-post/images/edit.png'> Edit </a>";
                $flag = "<a href='#'/>\n\t\t\t<img src='" . qa_opt('site_url') . "qa-plugin/blog-post/images/edit.png'> Flag </a>";
                $comments = qa_lang('qa_blog_lang/post_comments');
                $queryName = qa_db_read_one_assoc(qa_db_query_sub('SELECT content
											FROM `^userprofile`
											WHERE `userid`=' . $user . '
											AND title="name"
											LIMIT 0,#;', $user), true);
                $name = isset($queryName['content']) && trim($queryName['content']) != '' ? $queryName['content'] : $author;
                $result = qa_db_query_sub('SELECT * FROM ^users WHERE userid=#', $user);
                if ($row = mysqli_fetch_array($result)) {
                    $fullname = '<a href="/user/' . $row['handle'] . '">' . $name . '</a>';
                }
                if (qa_is_logged_in()) {
                    $html .= "<hr>\n\t\t\t\t\t<span style='float:left;padding-left:10px'>\n\t\t\t\t\t" . qa_lang('qa_blog_lang/posted_by') . " " . $fullname . " " . qa_lang('qa_blog_lang/on') . "\n\t\t\t\t\t" . $on . " " . qa_lang('qa_blog_lang/at') . " " . $at . "</span>\n\t\t\t\t\t<span style='float:right;padding-right:10px;'>\n\t\t\t\t\t" . $edit . " . " . $delete . " |\n\t\t\t\t\t<img src='" . qa_path_to_root() . "/qa-plugin/blog-post/images/comment.png'>" . $count . " " . $comments . "\n\t\t\t\t\t<img src='" . qa_path_to_root() . "/qa-plugin/blog-post/images/hits.jpg'>" . $views . " " . $strviews . "</span>\n\t\t\t\t\t<br>";
                } else {
                    $html .= "<hr>\n\t\t\t\t\t<span style='float:left;padding-left:10px'>\n\t\t\t\t\t" . qa_lang('qa_blog_lang/posted_by') . " " . $fullname . " " . qa_lang('qa_blog_lang/on') . "\n\t\t\t\t\t" . $on . " " . qa_lang('qa_blog_lang/at') . " " . $at . "</span>\n\t\t\t\t\t<span style='float:right;padding-right:10px;'>" . $count . " " . $comments . " | " . $row['views'] . " " . $strviews . "</span>\n\t\t\t\t\t<br>";
                }
                #			 $html .= "<h2>Comments features is not available in free version</h2>";
                $parentid = qa_request_part(1);
                $result = qa_db_query_sub("SELECT * FROM ^blog_comments WHERE parentid =  '{$parentid}' ");
                $i = 0;
                while ($blob = mysqli_fetch_array($result)) {
                    $i++;
                    $html .= "<p> " . $blob['comment'] . "</span><br>" . qa_lang('qa_blog_lang/comment') . "\n\t\t\t\t\t" . $author . " " . qa_lang('qa_blog_lang/on') . " " . $on . " " . qa_lang('qa_blog_lang/at') . "\n\t\t\t\t\t" . $at . "</p>";
                }
                if ($i == 0) {
                    $html .= '<h3>No Comments yet</h3>';
                }
            } else {
                $html = qa_lang('qa_blog_lang/post_null');
            }
        } else {
            $cat = -1;
            if (isset($_GET['category'])) {
                $cat = $_GET['category'];
            }
            $qa_content['navigation']['sub'] = array();
            $qa_content['navigation']['sub']['all'] = array('label' => qa_lang('qa_blog_lang/nav_all'), 'url' => './blog', 'selected' => isset($_GET['category']) ? 0 : 1);
            $qa_content['navigation']['sub']['cat1'] = array('label' => $category_1, 'url' => './blog?category=1', 'selected' => $cat == 1 ? 1 : 0);
            $qa_content['navigation']['sub']['cat2'] = array('label' => $category_2, 'url' => './blog?category=2', 'selected' => $cat == 2 ? 1 : 0);
            $qa_content['navigation']['sub']['cat3'] = array('label' => $category_3, 'url' => './blog?category=3', 'selected' => $cat == 3 ? 1 : 0);
            $qa_content['navigation']['sub']['cat4'] = array('label' => $category_4, 'url' => './blog?category=4', 'selected' => $cat == 4 ? 1 : 0);
            $qa_content['navigation']['sub']['cat5'] = array('label' => $category_5, 'url' => './blog?category=5', 'selected' => $cat == 5 ? 1 : 0);
            $qa_content['navigation']['sub']['post'] = array('label' => qa_lang('qa_blog_lang/nav_post'), 'url' => './articles');
            $html = qa_opt('qa_blog_tagline') . '<hr>';
            $page = 1;
            if (isset($_GET['page'])) {
                $page = $_GET['page'];
            }
            $limit = 10;
            if (isset($_GET['category'])) {
//.........这里部分代码省略.........
开发者ID:arjunsuresh,项目名称:qa-blog-post,代码行数:101,代码来源:qa-blog.php

示例14: process_request

    public function process_request($request)
    {
        $category_1 = qa_opt('qa_blog_cat_1');
        $category_2 = qa_opt('qa_blog_cat_2');
        $category_3 = qa_opt('qa_blog_cat_3');
        $category_4 = qa_opt('qa_blog_cat_4');
        $category_5 = qa_opt('qa_blog_cat_5');
        $qa_content = qa_content_prepare();
        $errors = array();
        if (qa_clicked('docancel')) {
            qa_redirect('blog');
        } else {
            if (qa_clicked('dosaveoptions')) {
                $in = array();
                qa_get_post_content('editor', 'content', $in['editor'], $in['content'], $in['format'], $in['text']);
                $in['title'] = qa_post_text('title');
                $in['category'] = qa_post_text('category');
                if (strlen($in['title']) < 10 || strlen($in['content']) < 50 || $in['category'] !== 'cat_0' && $in['category'] !== 'cat_1' && $in['category'] !== 'cat_2' && $in['category'] !== 'cat_3' && $in['category'] !== 'cat_4' && $in['category'] !== 'cat_5') {
                    if (strlen($in['title']) < 10) {
                        $errors['title'] = qa_lang('qa_blog_lang/error_title');
                    }
                    if (strlen($in['content']) < 50) {
                        $errors['content'] = qa_lang('qa_blog_lang/error_content');
                    }
                    if ($in['category'] !== 'cat_0' && $in['category'] !== 'cat_1' && $in['category'] !== 'cat_2' && $in['category'] !== 'cat_3' && $in['category'] !== 'cat_4' && $in['category'] !== 'cat_5') {
                        $errors['type'] = 'Invalid category';
                    }
                } else {
                    $type = 0;
                    if ($in['category'] === 'cat_1') {
                        $type = 1;
                    } else {
                        if ($in['category'] === 'cat_2') {
                            $type = 2;
                        } else {
                            if ($in['category'] === 'cat_3') {
                                $type = 3;
                            } else {
                                if ($in['category'] === 'cat_4') {
                                    $type = 4;
                                } else {
                                    if ($in['category'] === 'cat_5') {
                                        $type = 5;
                                    }
                                }
                            }
                        }
                    }
                    qa_db_query_sub('INSERT INTO ^blog_posts (postid, userid, posted, title, type, content, views,format) 
				VALUES (0,#,NOW(),$,#,$,0,$)', qa_get_logged_in_userid(), $in['title'], $type, $in['content'], 'draft');
                    header('location:' . qa_path_to_root() . '/user/' . qa_get_logged_in_handle() . '');
                }
            } else {
                if (qa_clicked('doarticle')) {
                    $in = array();
                    qa_get_post_content('editor', 'content', $in['editor'], $in['content'], $in['format'], $in['text']);
                    $in['title'] = qa_post_text('title');
                    $in['category'] = qa_post_text('category');
                    if (strlen($in['title']) < 10 || strlen($in['content']) < 50 || $in['category'] !== 'cat_0' && $in['category'] !== 'cat_1' && $in['category'] !== 'cat_2' && $in['category'] !== 'cat_3' && $in['category'] !== 'cat_4' && $in['category'] !== 'cat_5') {
                        if (strlen($in['title']) < 10) {
                            $errors['title'] = qa_lang('qa_blog_lang/error_title');
                        }
                        if (strlen($in['content']) < 50) {
                            $errors['content'] = qa_lang('qa_blog_lang/error_content');
                        }
                        if ($in['category'] !== 'cat_0' && $in['category'] !== 'cat_1' && $in['category'] !== 'cat_2' && $in['category'] !== 'cat_3' && $in['category'] !== 'cat_4' && $in['category'] !== 'cat_5') {
                            $errors['type'] = 'Invalid category';
                        }
                    } else {
                        $type = 0;
                        if ($in['category'] === 'cat_1') {
                            $type = 1;
                        } else {
                            if ($in['category'] === 'cat_2') {
                                $type = 2;
                            } else {
                                if ($in['category'] === 'cat_3') {
                                    $type = 3;
                                } else {
                                    if ($in['category'] === 'cat_4') {
                                        $type = 4;
                                    } else {
                                        if ($in['category'] === 'cat_5') {
                                            $type = 5;
                                        }
                                    }
                                }
                            }
                        }
                        $result = qa_db_query_sub('INSERT INTO ^blog_posts (postid, userid, posted, title, type, content, views,format) 
				VALUES (0,#,NOW(),$,#,$,0,$)', qa_get_logged_in_userid(), $in['title'], $type, $in['content'], 'markdown');
                        header('location:' . qa_path_to_root() . '/blog/');
                    }
                }
            }
        }
        if (qa_is_logged_in()) {
            $qa_content['title'] = qa_lang('qa_blog_lang/articles_page');
            $userpostslink = '/user/' . qa_get_logged_in_handle() . '/articles';
            $editorname = isset($in['editor']) ? $in['editor'] : qa_opt('editor_for_qs');
//.........这里部分代码省略.........
开发者ID:arjunsuresh,项目名称:qa-blog-post,代码行数:101,代码来源:qa-articles.php

示例15: printCode

    static function printCode($provider, $tourl, $context, $action = 'login', $print = true)
    {
        $css = $key = strtolower($provider);
        if ($key == 'live') {
            $css = 'windows';
            // translate provider name to zocial css class
        } else {
            if ($key == 'googleplus') {
                $provider = 'Google+';
            }
        }
        $showInHeader = qa_opt("{$key}_app_shortcut") ? true : false;
        if ($action == 'login' && !$showInHeader && $context == 'menu') {
            // do not show login button in the header for this
            return;
        }
        $zocial = qa_opt('open_login_zocial') == '1' ? 'zocial' : '';
        // use zocial buttons
        if ($action == 'logout') {
            $url = $tourl;
            $classes = "{$context} action-logout {$zocial} {$css}";
            $title = qa_lang_html('main/nav_logout');
            $text = qa_lang_html('main/nav_logout');
        } else {
            if ($action == 'login') {
                $topath = qa_get('to');
                // lets user switch between login and register without losing destination page
                // clean GET parameters (not performed when to parameter is already passed)
                $get = $_GET;
                unset($get['provider']);
                unset($get['code']);
                $tourl = isset($topath) ? $topath : qa_path(qa_request(), $get, '');
                // build our own tourl
                $params = array('login' => $key);
                $url = qa_path('login', $params, qa_path_to_root());
                if (strlen($tourl) > 0) {
                    $url .= '&amp;to=' . $tourl;
                    // play nice with validators
                }
                $classes = "{$context} action-login {$zocial}  {$css}";
                $title = qa_lang_html_sub('plugin_open/login_using', $provider);
                $text = $provider . ' ' . qa_lang_html('main/nav_login');
                if ($context != 'menu') {
                    $text = $title;
                }
            } else {
                if ($action == 'link') {
                    $url = qa_path('logins', array('link' => $key), qa_path_to_root());
                    // build our own url
                    $classes = "{$context} action-link {$zocial} {$css}";
                    $title = qa_lang_html_sub('plugin_open/login_using', $provider);
                    $text = qa_lang_html('main/nav_login');
                    if ($context != 'menu') {
                        $text = $title;
                    }
                } else {
                    if ($action == 'view') {
                        $url = 'javascript://';
                        $classes = "{$context} action-link {$zocial} {$css}";
                        $title = $provider;
                        $text = $tourl;
                    }
                }
            }
        }
        $html = <<<HTML
  <a class="open-login-button context-{$classes}" title="{$title}" href="{$url}" rel="nofollow">{$text}</a>
HTML;
        if ($print) {
            echo $html;
        } else {
            return $html;
        }
    }
开发者ID:microbye,项目名称:q2a-open-login,代码行数:74,代码来源:qa-open-login.php


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