If you have a tag "admin" s9y goes to admin page.

Found a bug? Tell us!!
Post Reply
puck
Regular
Posts: 14
Joined: Mon Apr 30, 2007 10:55 am
Location: New Zealand

If you have a tag "admin" s9y goes to admin page.

Post by puck »

Hi,

I have a number of blog posts tagged with "admin" if they're general admin posts about my blog. The other day I tried clicking on the "admin" tag to see what posts I had. I was somewhat surprised to be redirect to the admin page for my blog.

To see this try clicking on the "admin" tag on:
http://blog.etc.gen.nz/index.php?/archi ... -blog.html

I have a redirect for the admin page *only* to an HTTPS site, but that shouldn't be getting triggered by the tag page.

This is s9y v1.1, Tagging of Entries v2.88.

Cheers!
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: If you have a tag "admin" s9y goes to admin pa

Post by garvinhicking »

Hi!
I have a redirect for the admin page *only* to an HTTPS site, but that shouldn't be getting triggered by the tag page.
Seems your redirect is wrong and listens to any occurence of "admin" in the URL? :-)

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
puck
Regular
Posts: 14
Joined: Mon Apr 30, 2007 10:55 am
Location: New Zealand

Re: If you have a tag "admin" s9y goes to admin pa

Post by puck »

Gidday,
garvinhicking wrote:Seems your redirect is wrong and listens to any occurence of "admin" in the URL? :-)
I don't think so. This is my rewrite:

Code: Select all

  RewriteRule ^/serendipity_admin.php(.*) 
      https://blog.etc.gen.nz/serendipity_admin.php$1           [R=301,L]
(All on one line of course)

So I'd be surprised if that is matching the tag...
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: If you have a tag "admin" s9y goes to admin pa

Post by garvinhicking »

Hi!

Phew. I'm sorry, you'Re right. It is a custom Serendipity rewrite rule, that matches 'admin' too broadly:

/(admin|entries)(/.+)?

would also match your adminPath.

So, you could either try to rename your 'admin' Tags to 'administrative' or you could change the permalink configuration of your s9y installation to change the default 'admin' path permalink to sth like 'blogadmin'.

HTH,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
puck
Regular
Posts: 14
Joined: Mon Apr 30, 2007 10:55 am
Location: New Zealand

Re: If you have a tag "admin" s9y goes to admin pa

Post by puck »

garvinhicking wrote:Phew. I'm sorry, you'Re right. It is a custom Serendipity rewrite rule, that matches 'admin' too broadly:
Ah ha, good to know that I'm not crazy.

A better fix is to correct pattern. I've a had a look in the code I can't find where it is defined PAT_ADMIN. If you can point in the right direction I'll see if I can fix it up.

Cheers!
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: If you have a tag "admin" s9y goes to admin pa

Post by garvinhicking »

Hi!
A better fix is to correct pattern. I've a had a look in the code I can't find where it is defined PAT_ADMIN. If you can point in the right direction I'll see if I can fix it up.
It's a bit hidden in the file include/functions_permalinks.inc.php, function serendipity_permalinkPatterns(), $PAT['ADMIN'].

However after you changed that you still need to regenerate/alter your .htaccess file.

HTH,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
puck
Regular
Posts: 14
Joined: Mon Apr 30, 2007 10:55 am
Location: New Zealand

Re: If you have a tag "admin" s9y goes to admin pa

Post by puck »

Hi Garvin,
garvinhicking wrote:It's a bit hidden in the file include/functions_permalinks.inc.php, function serendipity_permalinkPatterns(), $PAT['ADMIN'].
Awesome. Here is a patch that won't match a tag called admin:

Code: Select all

diff --git a/include/functions_permalinks.inc.php b/include/functions_permalinks.inc.php
index 85680a0..004c4fa 100755
--- a/include/functions_permalinks.inc.php
+++ b/include/functions_permalinks.inc.php
@@ -277,7 +277,7 @@ function &serendipity_permalinkPatterns($return = false) {
     $PAT['DELETE']                   = '@/'  . $serendipity['permalinkDeletePath'].'/(.*)/(.*)/([0-9]+)@';
     $PAT['ARCHIVES']                 = '@/'  . $serendipity['permalinkArchivesPath'].'([/A-Za-z0-9]+)\.html@';
     $PAT['FEEDS']                    = '@/'  . $serendipity['permalinkFeedsPath'].'/@';
-    $PAT['ADMIN']                    = '@/(' . $serendipity['permalinkAdminPath'] . '|entries)(/.+)?@';
+    $PAT['ADMIN']                    = '@/(?<!tag\/)(' . $serendipity['permalinkAdminPath'] . '|entries)(/.+)?@';
     $PAT['ARCHIVE']                  = '@/'  . $serendipity['permalinkArchivePath'] . '/?@';
     $PAT['CATEGORIES']               = '@/'  . $serendipity['permalinkCategoriesPath'].'/([0-9;]+)@';
     $PAT['PLUGIN']                   = '@/('  . $serendipity['permalinkPluginPath'] . '|plugin)/(.*)@';
However after you changed that you still need to regenerate/alter your .htaccess file.
For whatever reason it isn't in my .htaccess, restarting Apache2 picked up the change.

Looking at some of the other patterns I suspect there is a good chance there are other tags which will cause issues as well.

/me shrugs

Cheers!
Post Reply