function qa_cookie_get()
{
    if (qa_to_override(__FUNCTION__)) {
        $args = func_get_args();
        return qa_call_override(__FUNCTION__, $args);
    }
    return isset($_COOKIE['qa_id']) ? qa_gpc_to_string($_COOKIE['qa_id']) : null;
}
示例#2
0
function it_cookie_get()
{
    return isset($_COOKIE['qa_id']) ? qa_gpc_to_string($_COOKIE['qa_id']) : null;
}
示例#3
0
function qw_request_text($field)
{
    if (qa_to_override(__FUNCTION__)) {
        $args = func_get_args();
        return qa_call_override(__FUNCTION__, $args);
    }
    return isset($_REQUEST[$field]) ? preg_replace('/\\r\\n?/', "\n", trim(qa_gpc_to_string($_REQUEST[$field]))) : null;
}
示例#4
0
 function qa_index_set_request()
 {
     if (qa_to_override(__FUNCTION__)) {
         $args = func_get_args();
         return qa_call_override(__FUNCTION__, $args);
     }
     $relativedepth = 0;
     if (isset($_GET['qa-rewrite'])) {
         // URLs rewritten by .htaccess
         $urlformat = QA_URL_FORMAT_NEAT;
         $requestparts = explode('/', qa_gpc_to_string($_GET['qa-rewrite']));
         unset($_GET['qa-rewrite']);
         if (!empty($_SERVER['REQUEST_URI'])) {
             // workaround for the fact that Apache unescapes characters while rewriting
             $origpath = $_SERVER['REQUEST_URI'];
             $_GET = array();
             $questionpos = strpos($origpath, '?');
             if (is_numeric($questionpos)) {
                 $params = explode('&', substr($origpath, $questionpos + 1));
                 foreach ($params as $param) {
                     if (preg_match('/^([^\\=]*)(\\=(.*))?$/', $param, $matches)) {
                         $argument = strtr(urldecode($matches[1]), '.', '_');
                         // simulate PHP's $_GET behavior
                         $_GET[$argument] = qa_string_to_gpc(urldecode(@$matches[3]));
                     }
                 }
                 $origpath = substr($origpath, 0, $questionpos);
             }
             // Generally we assume that $_GET['qa-rewrite'] has the right path depth, but this won't be the case if there's
             // a & or # somewhere in the middle of the path, due to apache unescaping. So we make a special case for that.
             $keepparts = count($requestparts);
             $requestparts = explode('/', urldecode($origpath));
             // new request calculated from $_SERVER['REQUEST_URI']
             for ($part = count($requestparts) - 1; $part >= 0; $part--) {
                 if (is_numeric(strpos($requestparts[$part], '&')) || is_numeric(strpos($requestparts[$part], '#'))) {
                     $keepparts += count($requestparts) - $part - 1;
                     // this is how many parts we lost
                     break;
                 }
             }
             $requestparts = array_slice($requestparts, -$keepparts);
             // remove any irrelevant parts from the beginning
         }
         $relativedepth = count($requestparts);
     } elseif (isset($_GET['qa'])) {
         if (strpos($_GET['qa'], '/') === false) {
             $urlformat = empty($_SERVER['REQUEST_URI']) || strpos($_SERVER['REQUEST_URI'], '/index.php') !== false ? QA_URL_FORMAT_SAFEST : QA_URL_FORMAT_PARAMS;
             $requestparts = array(qa_gpc_to_string($_GET['qa']));
             for ($part = 1; $part < 10; $part++) {
                 if (isset($_GET['qa_' . $part])) {
                     $requestparts[] = qa_gpc_to_string($_GET['qa_' . $part]);
                     unset($_GET['qa_' . $part]);
                 }
             }
         } else {
             $urlformat = QA_URL_FORMAT_PARAM;
             $requestparts = explode('/', qa_gpc_to_string($_GET['qa']));
         }
         unset($_GET['qa']);
     } else {
         $phpselfunescaped = strtr($_SERVER['PHP_SELF'], '+', ' ');
         // seems necessary, and plus does not work with this scheme
         $indexpath = '/index.php/';
         $indexpos = strpos($phpselfunescaped, $indexpath);
         if (is_numeric($indexpos)) {
             $urlformat = QA_URL_FORMAT_INDEX;
             $requestparts = explode('/', substr($phpselfunescaped, $indexpos + strlen($indexpath)));
             $relativedepth = 1 + count($requestparts);
         } else {
             $urlformat = null;
             // at home page so can't identify path type
             $requestparts = array();
         }
     }
     foreach ($requestparts as $part => $requestpart) {
         // remove any blank parts
         if (!strlen($requestpart)) {
             unset($requestparts[$part]);
         }
     }
     reset($requestparts);
     $key = key($requestparts);
     $replacement = array_search(@$requestparts[$key], qa_get_request_map());
     if ($replacement !== false) {
         $requestparts[$key] = $replacement;
     }
     qa_set_request(implode('/', $requestparts), $relativedepth > 1 ? str_repeat('../', $relativedepth - 1) : './', $urlformat);
 }
示例#5
0
文件: qa-index.php 项目: ramo01/1kapp
 function qa_index_set_request()
 {
     if (qa_to_override(__FUNCTION__)) {
         $args = func_get_args();
         return qa_call_override(__FUNCTION__, $args);
     }
     $relativedepth = 0;
     if (isset($_GET['qa-rewrite'])) {
         // URLs rewritten by .htaccess
         $urlformat = QA_URL_FORMAT_NEAT;
         $requestparts = explode('/', qa_gpc_to_string($_GET['qa-rewrite']));
         unset($_GET['qa-rewrite']);
         $relativedepth = count($requestparts);
         // Workaround for fact that Apache unescapes characters while rewriting, based on assumption that $_GET['qa-rewrite'] has
         // right path depth, which is true do long as there are only escaped characters in the last part of the path
         if (!empty($_SERVER['REQUEST_URI'])) {
             $origpath = $_SERVER['REQUEST_URI'];
             $_GET = array();
             $questionpos = strpos($origpath, '?');
             if (is_numeric($questionpos)) {
                 $params = explode('&', substr($origpath, $questionpos + 1));
                 foreach ($params as $param) {
                     if (preg_match('/^([^\\=]*)(\\=(.*))?$/', $param, $matches)) {
                         $_GET[urldecode($matches[1])] = qa_string_to_gpc(urldecode(@$matches[3]));
                     }
                 }
                 $origpath = substr($origpath, 0, $questionpos);
             }
             $requestparts = array_slice(explode('/', urldecode($origpath)), -count($requestparts));
         }
     } elseif (isset($_GET['qa'])) {
         if (strpos($_GET['qa'], '/') === false) {
             $urlformat = empty($_SERVER['REQUEST_URI']) || strpos($_SERVER['REQUEST_URI'], '/index.php') !== false ? QA_URL_FORMAT_SAFEST : QA_URL_FORMAT_PARAMS;
             $requestparts = array(qa_gpc_to_string($_GET['qa']));
             for ($part = 1; $part < 10; $part++) {
                 if (isset($_GET['qa_' . $part])) {
                     $requestparts[] = qa_gpc_to_string($_GET['qa_' . $part]);
                     unset($_GET['qa_' . $part]);
                 }
             }
         } else {
             $urlformat = QA_URL_FORMAT_PARAM;
             $requestparts = explode('/', qa_gpc_to_string($_GET['qa']));
         }
         unset($_GET['qa']);
     } else {
         $phpselfunescaped = strtr($_SERVER['PHP_SELF'], '+', ' ');
         // seems necessary, and plus does not work with this scheme
         $indexpath = '/index.php/';
         $indexpos = strpos($phpselfunescaped, $indexpath);
         if (is_numeric($indexpos)) {
             $urlformat = QA_URL_FORMAT_INDEX;
             $requestparts = explode('/', substr($phpselfunescaped, $indexpos + strlen($indexpath)));
             $relativedepth = 1 + count($requestparts);
         } else {
             $urlformat = null;
             // at home page so can't identify path type
             $requestparts = array();
         }
     }
     foreach ($requestparts as $part => $requestpart) {
         // remove any blank parts
         if (!strlen($requestpart)) {
             unset($requestparts[$part]);
         }
     }
     reset($requestparts);
     $key = key($requestparts);
     $replacement = array_search(@$requestparts[$key], qa_get_request_map());
     if ($replacement !== false) {
         $requestparts[$key] = $replacement;
     }
     qa_set_request(implode('/', $requestparts), $relativedepth > 1 ? str_repeat('../', $relativedepth - 1) : './', $urlformat);
 }
示例#6
0
	
	File: qa-include/qa-url-test.php
	Version: See define()s at top of qa-include/qa-base.php
	Description: Sits in an iframe and shows a green page with word 'OK'


	This program is free software; you can redistribute it and/or
	modify it under the terms of the GNU General Public License
	as published by the Free Software Foundation; either version 2
	of the License, or (at your option) any later version.
	
	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	More about this license: http://www.question2answer.org/license.php
*/
if (qa_gpc_to_string(@$_GET['param']) == QA_URL_TEST_STRING) {
    require_once QA_INCLUDE_DIR . 'qa-app-admin.php';
    echo '<html><body style="margin:0; padding:0;">';
    echo '<table width="100%" height="100%" cellspacing="0" cellpadding="0">';
    echo '<tr valign="middle"><td align="center" style="border-style:solid; border-width:1px; background-color:#fff; ';
    echo qa_admin_url_test_html();
    echo '/td></tr></table>';
    echo '</body></html>';
}
/*
	Omit PHP closing tag to help avoid accidental output
*/
 function _my_qa_post_text($field)
 {
     return isset($_POST[$field]) ? preg_replace('/\\r\\n?/', "\n", qa_gpc_to_string($_POST[$field])) : null;
 }
function qa_post_array($field)
{
    if (qa_to_override(__FUNCTION__)) {
        $args = func_get_args();
        return qa_call_override(__FUNCTION__, $args);
    }
    if (!isset($_POST[$field]) || !is_array($_POST[$field])) {
        return null;
    }
    $result = array();
    foreach ($_POST[$field] as $key => $value) {
        $result[$key] = preg_replace('/\\r\\n?/', "\n", trim(qa_gpc_to_string($value)));
    }
    return $result;
}
示例#9
0
        }
        $requestparts = array_slice(explode('/', urldecode($origpath)), -count($requestparts));
    }
} elseif (isset($_GET['qa'])) {
    if (strpos($_GET['qa'], '/') === false) {
        $qa_used_url_format = empty($_SERVER['REQUEST_URI']) || strpos($_SERVER['REQUEST_URI'], '/index.php') !== false ? QA_URL_FORMAT_SAFEST : QA_URL_FORMAT_PARAMS;
        $requestparts = array(qa_gpc_to_string($_GET['qa']));
        for ($part = 1; $part < 10; $part++) {
            if (isset($_GET['qa_' . $part])) {
                $requestparts[] = qa_gpc_to_string($_GET['qa_' . $part]);
                unset($_GET['qa_' . $part]);
            }
        }
    } else {
        $qa_used_url_format = QA_URL_FORMAT_PARAM;
        $requestparts = explode('/', qa_gpc_to_string($_GET['qa']));
    }
    unset($_GET['qa']);
} else {
    $phpselfunescaped = strtr($_SERVER['PHP_SELF'], '+', ' ');
    // seems necessary, and plus does not work with this scheme
    $indexpath = '/index.php/';
    $indexpos = strpos($phpselfunescaped, $indexpath);
    if (is_numeric($indexpos)) {
        $qa_used_url_format = QA_URL_FORMAT_INDEX;
        $requestparts = explode('/', substr($phpselfunescaped, $indexpos + strlen($indexpath)));
        $relativedepth = 1 + count($requestparts);
        $rootpath = substr($phpselfunescaped, 0, $indexpos);
    } else {
        $qa_used_url_format = null;
        // at home page so can't identify path type