#43 Use REQUEST_URI instead of PHP_SELF generally? (Core problem

XOOPS_2.2
closed
Jan Pedersen
5
2012-09-25
2004-07-12
Manuel Polo
No

(Note: Original post
http://www.xoops.org/modules/newbb/viewtopic.php?topic_id=20260&forum=8#forumpost87640)
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 from http://domain1.com and
http://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']

I attach a sample patched file with the problem (see
url of original post for more):
/modules/news/admin/storyform.inc.php

Discussion

  • Manuel Polo
    Manuel Polo
    2004-07-12

    Sample of patched file used in production site: www.mrmx.org

     
    Attachments
  • Herko Coomans
    Herko Coomans
    2004-07-16

    Logged In: YES
    user_id=441189

    Please, do not assign your patches to a developer. We will
    do that in due time.

     
  • Jan Pedersen
    Jan Pedersen
    2005-03-25

    Logged In: YES
    user_id=841117

    OK, I'll take care of this one personally.

     
  • Jan Pedersen
    Jan Pedersen
    2005-04-08

    Logged In: YES
    user_id=841117

    Fixed in CVS and waiting for review before merging to the trunk.