Revert "Change main router request variable from 'q' to 'req'. This is necessary to implement search in the twitter api addon, because twitter requires use of the variable 'q'." Reverting because this will only work with Apache and break nginx/other installations.

This reverts commit 9367e9fe5a.
This commit is contained in:
zotlabs 2018-08-26 23:05:56 -07:00
parent 9367e9fe5a
commit e4b6a143c7
11 changed files with 19 additions and 19 deletions

View File

@ -20,15 +20,15 @@ AddType audio/ogg .oga
RewriteRule "(^|/)\.git" - [F]
RewriteRule "(^|/)store" - [F]
# Rewrite current-style URLs of the form 'index.php?req=x'.
# Rewrite current-style URLs of the form 'index.php?q=x'.
# Also place auth information into REMOTE_USER for sites running
# in CGI mode.
RewriteCond %{REQUEST_URI} ^/\.well\-known/.*
RewriteRule ^(.*)$ index.php?req=$1 [E=REMOTE_USER:%{HTTP:Authorization},L,QSA]
RewriteRule ^(.*)$ index.php?q=$1 [E=REMOTE_USER:%{HTTP:Authorization},L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?req=$1 [E=REMOTE_USER:%{HTTP:Authorization},L,QSA]
RewriteRule ^(.*)$ index.php?q=$1 [E=REMOTE_USER:%{HTTP:Authorization},L,QSA]
</IfModule>

View File

@ -152,7 +152,7 @@ class Libzotdir {
unset($tmp['pubforums']);
unset($tmp['global']);
unset($tmp['safe']);
unset($tmp['req']);
unset($tmp['q']);
unset($tmp['f']);
$forumsurl = $url . http_build_query($tmp) . $suggest;

View File

@ -326,7 +326,7 @@ class Connections extends \Zotlabs\Web\Controller {
killme();
}
else {
$o .= "<script> var page_query = '" . escape_tags($_GET['req']) . "'; var extra_args = '" . extra_query_args() . "' ; </script>";
$o .= "<script> var page_query = '" . escape_tags($_GET['q']) . "'; var extra_args = '" . extra_query_args() . "' ; </script>";
$o .= replace_macros(get_markup_template('connections.tpl'),array(
'$header' => t('Connections') . (($head) ? ': ' . $head : ''),
'$tabs' => $tabs,

View File

@ -395,7 +395,7 @@ class Directory extends \Zotlabs\Web\Controller {
$dirtitle = (($globaldir) ? t('Global Directory') : t('Local Directory'));
$o .= "<script> var page_query = '" . escape_tags($_GET['req']) . "'; var extra_args = '" . extra_query_args() . "' ; divmore_height = " . intval($maxheight) . "; </script>";
$o .= "<script> var page_query = '" . escape_tags($_GET['q']) . "'; var extra_args = '" . extra_query_args() . "' ; divmore_height = " . intval($maxheight) . "; </script>";
$o .= replace_macros($tpl, array(
'$search' => $search,
'$desc' => t('Find'),

View File

@ -838,7 +838,7 @@ class Photos extends \Zotlabs\Web\Controller {
killme();
}
else {
$o .= "<script> var page_query = '" . escape_tags($_GET['req']) . "'; var extra_args = '" . extra_query_args() . "' ; </script>";
$o .= "<script> var page_query = '" . escape_tags($_GET['q']) . "'; var extra_args = '" . extra_query_args() . "' ; </script>";
$tpl = get_markup_template('photo_album.tpl');
$o .= replace_macros($tpl, array(
'$photos' => $photos,
@ -1377,7 +1377,7 @@ class Photos extends \Zotlabs\Web\Controller {
killme();
}
else {
$o .= "<script> var page_query = '" . escape_tags($_GET['req']) . "'; var extra_args = '" . extra_query_args() . "' ; </script>";
$o .= "<script> var page_query = '" . escape_tags($_GET['q']) . "'; var extra_args = '" . extra_query_args() . "' ; </script>";
$tpl = get_markup_template('photos_recent.tpl');
$o .= replace_macros($tpl, array(
'$title' => t('Recent Photos'),

View File

@ -46,7 +46,7 @@ class Rpost extends \Zotlabs\Web\Controller {
// make sure we're not looping to our own hub
if(($url) && (! stristr($url, \App::get_hostname()))) {
foreach($_GET as $key => $arg) {
if($key === 'req')
if($key === 'q')
continue;
$url .= '&' . $key . '=' . $arg;
}

View File

@ -107,7 +107,7 @@ class Viewconnections extends \Zotlabs\Web\Controller {
killme();
}
else {
$o .= "<script> var page_query = '" . escape_tags($_GET['req']) . "'; var extra_args = '" . extra_query_args() . "' ; </script>";
$o .= "<script> var page_query = '" . escape_tags($_GET['q']) . "'; var extra_args = '" . extra_query_args() . "' ; </script>";
$tpl = get_markup_template("viewcontact_template.tpl");
$o .= replace_macros($tpl, array(
'$title' => t('View Connections'),

View File

@ -878,8 +878,8 @@ class App {
self::$path = $path;
}
if((x($_SERVER,'QUERY_STRING')) && substr($_SERVER['QUERY_STRING'], 0, 4) === "req=") {
self::$query_string = str_replace(['<','>'],['&lt;','&gt;'],substr($_SERVER['QUERY_STRING'], 4));
if((x($_SERVER,'QUERY_STRING')) && substr($_SERVER['QUERY_STRING'], 0, 2) === "q=") {
self::$query_string = str_replace(['<','>'],['&lt;','&gt;'],substr($_SERVER['QUERY_STRING'], 2));
// removing trailing / - maybe a nginx problem
if (substr(self::$query_string, 0, 1) == "/")
self::$query_string = substr(self::$query_string, 1);
@ -887,8 +887,8 @@ class App {
self::$query_string = preg_replace('/&/','?',self::$query_string,1);
}
if(x($_GET,'req'))
self::$cmd = escape_tags(trim($_GET['req'],'/\\'));
if(x($_GET,'q'))
self::$cmd = escape_tags(trim($_GET['q'],'/\\'));
// unix style "homedir"

View File

@ -133,7 +133,7 @@ function dir_sort_links() {
unset($tmp['pubforums']);
unset($tmp['global']);
unset($tmp['safe']);
unset($tmp['req']);
unset($tmp['q']);
unset($tmp['f']);
$forumsurl = $url . http_build_query($tmp) . $suggest;

View File

@ -2526,7 +2526,7 @@ function extra_query_args() {
if(count($_GET)) {
foreach($_GET as $k => $v) {
// these are request vars we don't want to duplicate
if(! in_array($k, array('req','f','zid','page','PHPSESSID'))) {
if(! in_array($k, array('q','f','zid','page','PHPSESSID'))) {
$s .= '&' . $k . '=' . urlencode($v);
}
}
@ -2534,7 +2534,7 @@ function extra_query_args() {
if(count($_POST)) {
foreach($_POST as $k => $v) {
// these are request vars we don't want to duplicate
if(! in_array($k, array('req','f','zid','page','PHPSESSID'))) {
if(! in_array($k, array('q','f','zid','page','PHPSESSID'))) {
$s .= '&' . $k . '=' . urlencode($v);
}
}

View File

@ -293,8 +293,8 @@ class OAuth1Request {
}
// fix for friendica redirect system
// FIXME or don't, but figure out if this is absolutely necessary and act accordingly
$http_url = substr($http_url, 0, strpos($http_url,$parameters['req'])+strlen($parameters['req']));
unset( $parameters['req'] );
$http_url = substr($http_url, 0, strpos($http_url,$parameters['q'])+strlen($parameters['q']));
unset( $parameters['q'] );
return new OAuth1Request($http_method, $http_url, $parameters);
}