1
manuel
Use REQUEST_URI instead of PHP_SELF generally? (Core problem)
  • 2004/5/24 17:52

  • manuel

  • Just popping in

  • Posts: 3

  • Since: 2004/2/25


Hi!

I've have a problem with a solution (also others too as this thread shows)

The problem is that in some places withing XOOPS (I'm using 2.0.6) that the global PHP_SELF variable is used to create urls (forms,navigation,etc) and configured sites like mine (an maybe more users) that uses apache .htaccess with modrewrite configured to handle multiple domains with only one account.

Let me show my configuration for more clearness:

I own 1 hosting solution that I will call myhost.com, and I also have pointing to this host a couple of more domains.
So domain1.com and domain2.com -> points to myhost.com.
But thanks to modrewrite I change the url for every domainX to a subdirectory withing myhost.com htdocs
I have XOOPS installed in each subdirectory (and, of course, visible fromhttp://domain1.com andhttp://domain2.com)-

Here is my .htaccess:

Quote:

RewriteEngine On
Options +FollowSymlinks
RewriteBase /
RewriteCond %{HTTP_HOST} domain1.com
RewriteCond %{REQUEST_URI} !domain1_com/
RewriteRule ^(.*)$ domain1_com/$1 [L]
RewriteCond %{HTTP_HOST} domain2.com
RewriteCond %{REQUEST_URI} !domain2_com/
RewriteRule ^(.*)$ domain2_com/$1 [L]


That causes to php self to pointo to /domain1_com/index.php but it's needed to point to /index.php.

I changed a couple of scripts from XOOPS (see above forum link), eg: /class/pagenav.php, to use some code like this:
Quote:

$submit_page = $HTTP_SERVER_VARS['REQUEST_URI'];
if(strpos($submit_page,"?")) $submit_page = substr($submit_page,0,strpos($submit_page,"?"));

instead of
Quote:

$submit_page = $HTTP_SERVER_VARS['PHP_SELF']


Am I wrong and should learn more about url rewriting or should change XOOPS developers to use the request uri (without get params) instead of php_self?



2
manuel
Use REQUEST_URI instead of PHP_SELF generally? (Core problem)
  • 2004/5/3 8:48

  • manuel

  • Just popping in

  • Posts: 3

  • Since: 2004/2/25


Hi!

I've have a problem with a solution (also others too as this thread shows)

The problem is that in some places withing XOOPS (I'm using 2.0.6) that the global PHP_SELF variable is used to create urls (forms,navigation,etc) and configured sites like mine (an maybe more users) that uses apache .htaccess with modrewrite configured to handle multiple domains with only one account.

Let me show my configuration for more clearness:

I own 1 hosting solution that I will call myhost.com, and I also have pointing to this host a couple of more domains.
So domain1.com and domain2.com -> points to myhost.com.
But thanks to modrewrite I change the url for every domainX to a subdirectory withing myhost.com htdocs
I have XOOPS installed in each subdirectory (and, of course, visible fromhttp://domain1.com andhttp://domain2.com)-

Here is my .htaccess:

Quote:

RewriteEngine On
Options +FollowSymlinks
RewriteBase /
RewriteCond %{HTTP_HOST} domain1.com
RewriteCond %{REQUEST_URI} !domain1_com/
RewriteRule ^(.*)$ domain1_com/$1 [L]
RewriteCond %{HTTP_HOST} domain2.com
RewriteCond %{REQUEST_URI} !domain2_com/
RewriteRule ^(.*)$ domain2_com/$1 [L]


That causes to php self to pointo to /domain1_com/index.php but it's needed to point to /index.php.

I changed a couple of scripts from XOOPS (see above forum link), eg: /class/pagenav.php, to use some code like this:
Quote:

$submit_page = $HTTP_SERVER_VARS['REQUEST_URI'];
if(strpos($submit_page,"?")) $submit_page = substr($submit_page,0,strpos($submit_page,"?"));

instead of
Quote:

$submit_page = $HTTP_SERVER_VARS['PHP_SELF']


Am I wrong and should learn more about url rewriting or should change XOOPS developers to use the request uri (without get params) instead of php_self?



3
manuel
Re: News Module (Selected module does not exist!)
  • 2004/2/25 20:43

  • manuel

  • Just popping in

  • Posts: 3

  • Since: 2004/2/25


I've just been in the same problem because of site configuration.

The problems lies in some modules that incorrectly (IMHO) uses PHP_SELF, and shoud use REQUEST_URI, both http vars.

So for module news change:

/modules/news/include/storyform.inc.php

second line:
$sform = new XoopsThemeForm(_NW_SUBMITNEWS, "storyform", xoops_getenv('PHP_SELF'));

change to:
$sform = new XoopsThemeForm(_NW_SUBMITNEWS, "storyform", xoops_getenv('REQUEST_URI'));

and for admin to change a post:

/modules/news/admin/storyform.inc.php

change:

if(!isset($submit_page)){
$submit_page = $HTTP_SERVER_VARS['PHP_SELF'];
if(strpos($submit_page,"?")) $submit_page = substr($submit_page,0,strpos($submit_page,"?"));
}

to:

if(!isset($submit_page)){
$submit_page = $HTTP_SERVER_VARS['REQUEST_URI'];
if(strpos($submit_page,"?")) $submit_page = substr($submit_page,0,strpos($submit_page,"?"));
}


Hope it helps..

I hope XOOPS team developers notice this post! ;)




TopTop



Login

Who's Online

151 user(s) are online (102 user(s) are browsing Support Forums)


Members: 0


Guests: 151


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits