本文整理汇总了PHP中qa_request函数的典型用法代码示例。如果您正苦于以下问题:PHP qa_request函数的具体用法?PHP qa_request怎么用?PHP qa_request使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qa_request函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: qa_get_request_content
/**
* adds blog admin pages to the request handlers
*
* @return mixed
*/
function qa_get_request_content()
{
$requestlower = strtolower(qa_request());
$requestparts = qa_request_parts();
$firstlower = strtolower(@$requestparts[0]);
$secondlower = strtolower(@$requestparts[1]);
$routing = qa_page_routing();
$route_part = '';
if (!empty($firstlower) && !empty($secondlower)) {
$route_part = $firstlower . '/' . $secondlower . '/';
}
if (!isset($routing[$requestlower]) && $route_part === 'admin/donut-theme/') {
//for loading the default setting file
qa_set_template($firstlower);
$qa_content = (require QA_INCLUDE_DIR . $routing[$route_part]);
if ($firstlower == 'admin') {
$_COOKIE['qa_admin_last'] = $requestlower;
// for navigation tab now...
setcookie('qa_admin_last', $_COOKIE['qa_admin_last'], 0, '/', QA_COOKIE_DOMAIN);
// ...and in future
}
} else {
//otherwise load the original qa_get_request_content function
$qa_content = qa_get_request_content_base();
}
return $qa_content;
}
示例2: it_q_list_page_content
function it_q_list_page_content($questions, $pagesize, $start, $count, $sometitle, $nonetitle, $navcategories, $categoryid, $categoryqcount, $categorypathprefix, $feedpathprefix, $suggest, $pagelinkparams = null, $categoryparams = null, $dummy = null)
{
require_once QA_INCLUDE_DIR . 'qa-app-format.php';
require_once QA_INCLUDE_DIR . 'qa-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));
$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');
foreach ($questions as $question) {
$qa_content['q_list']['qs'][] = qa_any_to_q_html_fields($question, $userid, it_cookie_get(), $usershtml, null, qa_post_html_options($question, $defaults));
}
} 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);
}
return $qa_content;
}
示例3: qa_wall_error_html
function qa_wall_error_html($fromuserid, $touserid, $touserflags)
{
require_once QA_INCLUDE_DIR . 'qa-app-limits.php';
if (qa_to_override(__FUNCTION__)) {
$args = func_get_args();
return qa_call_override(__FUNCTION__, $args);
}
if (!QA_FINAL_EXTERNAL_USERS && qa_opt('allow_user_walls')) {
if ($touserflags & QA_USER_FLAGS_NO_WALL_POSTS && !(isset($fromuserid) && $fromuserid == $touserid)) {
return qa_lang_html('profile/post_wall_blocked');
} else {
switch (qa_user_permit_error('permit_post_wall', QA_LIMIT_WALL_POSTS)) {
case 'limit':
return qa_lang_html('profile/post_wall_limit');
break;
case 'login':
return qa_insert_login_links(qa_lang_html('profile/post_wall_must_login'), qa_request());
break;
case 'confirm':
return qa_insert_login_links(qa_lang_html('profile/post_wall_must_confirm'), qa_request());
break;
case 'approve':
return qa_lang_html('profile/post_wall_must_be_approved');
break;
case false:
return false;
break;
}
}
}
return qa_lang_html('users/no_permission');
}
示例4: qa_get_request_content
function qa_get_request_content()
{
if (qa_opt('news_plugin_active')) {
$requestlower = strtolower(qa_request());
if ($requestlower && $requestlower === 'my-profile') {
$userid = qa_get_logged_in_userid();
if (!$userid) {
qa_redirect();
}
$handles = qa_userids_to_handles(array($userid));
$handle = $handles[$userid];
qa_redirect(qa_path('user/' . $handle));
} else {
if ($requestlower && $requestlower === qa_opt('news_plugin_request')) {
// send on cron
if (qa_opt('news_plugin_send') && qa_get('cron') == qa_opt('news_plugin_cron_rand') && time() >= qa_opt('news_plugin_send_last') + 23 * 60 * 60) {
// minumum cron interval is 23 hours
qa_news_plugin_createNewsletter(true);
return false;
} else {
if (qa_get('cron') == qa_opt('news_plugin_cron_rand')) {
if (!qa_opt('news_plugin_send')) {
error_log('Q2A Newsletter Recreate Error: sending newsletter not allowed via admin/plugins');
} else {
error_log('Q2A Newsletter Recreate Error: cron request before minimum time elapsed');
}
echo "false\n";
return false;
}
}
include qa_opt('news_plugin_loc');
return false;
} else {
if (qa_opt('news_plugin_pdf') && $requestlower && $requestlower === qa_opt('news_plugin_request_pdf')) {
$pdf = file_get_contents(qa_opt('news_plugin_loc_pdf'));
header('Content-Description: File Transfer');
header('Cache-Control: public, must-revalidate, max-age=0');
// HTTP/1.1
header('Pragma: public');
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT');
// Date in the past
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
// force download dialog
header('Content-Type: application/force-download');
header('Content-Type: application/octet-stream', false);
header('Content-Type: application/download', false);
header('Content-Type: application/pdf', false);
// use the Content-Disposition header to supply a recommended filename
header('Content-Disposition: attachment; filename="' . basename(qa_opt('news_plugin_loc_pdf')) . '";');
header('Content-Transfer-Encoding: binary');
header('Content-Length: ' . strlen($pdf));
echo $pdf;
return false;
}
}
}
}
return qa_get_request_content_base();
}
示例5: qa_get_request_content
function qa_get_request_content()
{
if (qa_opt('xml_rpc_bool_active')) {
$requestlower = strtolower(qa_request());
if ($requestlower && $requestlower === "xml-rpc") {
qa_xml_rpc_start_server();
return false;
}
}
return qa_get_request_content_base();
}
示例6: allow_template
function allow_template($template)
{
// not allowed when logged in
$userid = qa_get_logged_in_userid();
if (stristr(qa_request(), 'admin/layoutwidgets') === false && isset($userid)) {
return false;
}
if ($template == 'login' || $template == 'register') {
return false;
}
return true;
}
示例7: 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;
}
示例8: doctype
function doctype()
{
parent::doctype();
if (QA_FINAL_EXTERNAL_USERS) {
return;
}
// check if logged in
$handle = qa_get_logged_in_handle();
if (isset($handle)) {
if (qa_request() == '' && count($_GET) > 0) {
// Check if we need to associate another provider
$this->process_login();
}
// see if the account pages are accessed
$tmpl = array('account', 'favorites');
$user_pages = array('user', 'user-wall', 'user-activity', 'user-questions', 'user-answers');
$logins_page = qa_request() == 'logins' && !qa_get('confirm');
$urlhandle = qa_request_part(1);
if (in_array($this->template, $tmpl) || $logins_page || in_array($this->template, $user_pages) && $handle == $urlhandle) {
// add a navigation item
$this->content['navigation']['sub']['logins'] = array('label' => qa_lang_html('plugin_open/my_logins_nav'), 'url' => qa_path_html('logins'), 'selected' => $logins_page);
return;
}
} else {
$title = qa_lang_html('plugin_open/login_title');
$descr = qa_lang_html('plugin_open/login_description');
// hide login/register links from navigation on any page
if (qa_opt('open_login_hideform') == '1') {
unset($this->content['navigation']['user']['login']);
unset($this->content['navigation']['user']['register']);
}
// then check if login/register pages are accessed
$tmpl = array('register', 'login');
if (!in_array($this->template, $tmpl)) {
return;
}
// hide regular login/register form on those pages only
if (qa_opt('open_login_hideform') == '1') {
$this->content['title'] = $title;
$this->content['form'] = null;
}
// add some custom text
if (!empty($this->content['custom'])) {
$content = str_ireplace('<BR>', '', $this->content['custom']);
$this->content['custom'] = "<div><p>{$descr}</p>{$content}</div>";
if ($this->content['form'] != null) {
$this->content['custom'] = "<br /><br /><h1>{$title}</h1>{$this->content['custom']}";
}
}
}
}
示例9: output_widget
function output_widget($region, $place, $themeobject, $template, $request, $qa_content)
{
$req = end(explode('/', qa_request()));
if (!isset($req)) {
return;
}
if (!qa_opt('event_logger_to_database')) {
return;
}
$widget_opt = @$themeobject->current_widget['param']['options'];
$cat = $this->cs_get_cat_desc($req);
if (@$themeobject->current_widget['param']['locations']['show_title'] && isset($cat['title'])) {
$themeobject->output('<h3 class="widget-title">' . $cat['title'] . '</h3>');
}
$themeobject->output('<div class="ra-cc-widget">');
$themeobject->output($cat['content']);
$themeobject->output('</div>');
}
示例10: 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;
}
示例11: process_request
function process_request($request)
{
$qa_content = qa_content_prepare();
$qa_content['site_title'] = "Notifications";
$qa_content['error'] = "";
$qa_content['suggest_next'] = "";
$qa_content['template'] = "notifications";
// Get the no of notifications
$start = qa_get_start();
$pagesize = qa_opt('qw_all_notification_page_size');
if (!$pagesize) {
$pagesize = 15;
}
$notifications_count = qw_get_notification_count(qa_get_logged_in_userid());
$qa_content['page_links'] = qa_html_page_links(qa_request(), $start, $pagesize, $notifications_count, qa_opt('pages_prev_next'));
if (empty($qa_content['page_links'])) {
$qa_content['suggest_next'] = qa_html_suggest_ask();
}
$qa_content['custom'] = $this->opt_form();
return $qa_content;
}
示例12: array
$leveloptions = array();
$catleveloptions = array('' => qa_lang_html('users/category_level_none'));
foreach ($showlevels as $showlevel) {
if ($showlevel <= $maxlevelassign) {
$leveloptions[$showlevel] = qa_html(qa_user_level_string($showlevel));
if ($showlevel > QA_USER_LEVEL_BASIC) {
$catleveloptions[$showlevel] = $leveloptions[$showlevel];
}
}
}
$qa_content['form_profile']['fields']['level']['options'] = $leveloptions;
// Category-specific levels
if (qa_using_categories()) {
$catleveladd = qa_get('catleveladd') ? true : false;
if (!$catleveladd && !count($userlevels)) {
$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));
示例13: qa_get_start
require_once QA_INCLUDE_DIR . 'app/format.php';
// Get list of all users
$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);
// Prepare content for theme
$qa_content = qa_content_prepare();
$qa_content['title'] = qa_lang_html('main/highest_users');
$qa_content['ranking'] = array('items' => array(), 'rows' => ceil($pagesize / qa_opt('columns_users')), 'type' => 'users');
if (count($users)) {
foreach ($users as $userid => $user) {
if (QA_FINAL_EXTERNAL_USERS) {
$avatarhtml = qa_get_external_avatar_html($user['userid'], qa_opt('avatar_users_size'), true);
} else {
$avatarhtml = qa_get_user_avatar_html($user['flags'], $user['email'], $user['handle'], $user['avatarblobid'], $user['avatarwidth'], $user['avatarheight'], qa_opt('avatar_users_size'), true);
}
// avatar and handle now listed separately for use in themes
$qa_content['ranking']['items'][] = array('avatar' => $avatarhtml, 'label' => $usershtml[$user['userid']], 'score' => qa_html(number_format($user['points'])), 'raw' => $user);
}
} else {
$qa_content['title'] = qa_lang_html('main/no_active_users');
}
$qa_content['page_links'] = qa_html_page_links(qa_request(), $start, $pagesize, $usercount, qa_opt('pages_prev_next'));
$qa_content['navigation']['sub'] = qa_users_sub_navigation();
return $qa_content;
/*
Omit PHP closing tag to help avoid accidental output
*/
示例14: qa_get_logged_in_handle
} else {
$messageid = null;
}
$fromhandle = qa_get_logged_in_handle();
$canreply = !(qa_get_logged_in_flags() & QA_USER_FLAGS_NO_MESSAGES);
$more = strtr(qa_lang($canreply ? 'emails/private_message_reply' : 'emails/private_message_info'), array('^f_handle' => $fromhandle, '^url' => qa_path_absolute($canreply ? 'message/' . $fromhandle : 'user/' . $fromhandle)));
$subs = array('^message' => $inmessage, '^f_handle' => $fromhandle, '^f_url' => qa_path_absolute('user/' . $fromhandle), '^more' => $more, '^a_url' => qa_path_absolute('account'));
if (qa_send_notification($toaccount['userid'], $toaccount['email'], $toaccount['handle'], qa_lang('emails/private_message_subject'), qa_lang('emails/private_message_body'), $subs)) {
$messagesent = true;
} else {
$pageerror = qa_lang_html('main/general_error');
}
qa_report_event('u_message', $loginuserid, qa_get_logged_in_handle(), qa_cookie_get(), array('userid' => $toaccount['userid'], 'handle' => $toaccount['handle'], 'messageid' => $messageid, 'message' => $inmessage));
if ($messagesent && qa_opt('show_message_history')) {
// show message as part of general history
qa_redirect(qa_request(), array('state' => 'message-sent'));
}
}
}
}
// Prepare content for theme
$qa_content = qa_content_prepare();
$qa_content['title'] = qa_lang_html('misc/private_message_title');
$qa_content['error'] = @$pageerror;
$qa_content['form_message'] = array('tags' => 'method="post" action="' . qa_self_html() . '"', 'style' => 'tall', 'fields' => array('message' => array('type' => $messagesent ? 'static' : '', 'label' => qa_lang_html_sub('misc/message_for_x', qa_get_one_user_html($handle, false)), 'tags' => 'name="message" id="message"', 'value' => qa_html(@$inmessage, $messagesent), 'rows' => 8, 'note' => qa_lang_html_sub('misc/message_explanation', qa_html(qa_opt('site_title'))), 'error' => qa_html(@$errors['message']))), 'buttons' => array('send' => array('tags' => 'onclick="qa_show_waiting_after(this, false);"', 'label' => qa_lang_html('main/send_button'))), 'hidden' => array('domessage' => '1', 'code' => qa_get_form_security_code('message-' . $handle)));
$qa_content['focusid'] = 'message';
if ($messagesent) {
$qa_content['form_message']['ok'] = qa_lang_html('misc/message_sent');
unset($qa_content['form_message']['buttons']);
if (qa_opt('show_message_history')) {
unset($qa_content['form_message']['fields']['message']);
示例15: header
<?php
/* don't allow this page to be requested directly from browser */
if (!defined('QA_VERSION')) {
header('Location: /');
exit;
}
/* Head of the template */
$current_cat = ra_get_cat_desc(qa_request(2));
?>
<!DOCTYPE html>
<html lang="<?php
echo qa_opt('site_language');
?>
">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<?php
if (is_array($current_cat)) {
?>
<meta name="description" content="<?php
echo substr($current_cat['content'], 0, 25);
?>
">
<meta name="keywords" content="<?php
echo $current_cat['title'];
?>
">
<?php
}