COMMENTSUB uri pattern

Having trouble installing serendipity?
Post Reply
gregman
Regular
Posts: 91
Joined: Wed Aug 15, 2007 9:32 pm

COMMENTSUB uri pattern

Post by gregman »

Hi there,

I have some understanding problems with the uri patterns. After changing my site to s9y software some of my former links now match the PAT_COMMENTSUB pattern. That's a problem because before switching to s9y I had a slightly different formation of the urls (e.g. /categoryid-entryid/title.html). Sadly some links contain the old urls and now the COMMENTSUB pattern matches the first number in the uri (my old categoryid) and handles it as an entryid.

Now I wandered, what the COMMENTSUB pattern stands for and what would happen, if i'd dump that pattern. Any suggestions?

Thx
Greg
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Post by judebert »

PAT_COMMENTSUB indicates that the URI is the submission of a comment. "Dumping" it -- by deleting it from the .htaccess -- would probably make it so your users can't comment, and might make the blog unusable.

Were you planning something else? Like changing the pattern in the admin screen?
Judebert
---
Website | Wishlist | PayPal
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Yes, s9y really requires unique URLs. You might need to work fix fixed prefixes like "/comments/" and "/entries/" etc. like s9y has by default. You could then use a custom .htaccess rewrite rule to redirect your old /X-Y/ style URLs to the new "/comments/X" style?

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/
gregman
Regular
Posts: 91
Joined: Wed Aug 15, 2007 9:32 pm

Post by gregman »

Hi,

and thank you both for your input. I was able to solve the problem, not by removing the COMMENTSUB uri pattern from .htaccess, but by adding a separate rule in the index.php file. Now the entryview is only entered when the uri not only matches the COMMENTSUB pattern but also contains one of the commentpaths (approve, delete or unsubscribe).

Greg
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Post by judebert »

Sounds good. Can visitors still leave comments and subscribe to entry comments?

If so, I'm interested in seeing the patch. We might want to apply it to the core.
Judebert
---
Website | Wishlist | PayPal
gregman
Regular
Posts: 91
Joined: Wed Aug 15, 2007 9:32 pm

Post by gregman »

judebert wrote:Can visitors still leave comments and subscribe to entry comments?
Yes, I didn't experience any problems till now.

Here is my modification:

Code: Select all

... else if (
((strstr($uri,$serendipity['permalinkApprovePath']) || strstr($uri,$serendipity['permalinkDeletePath']) || strstr($uri,$serendipity['permalinkUnsubscribePath'])) && preg_match(PAT_COMMENTSUB, $uri, $matches)) ||
preg_match(PAT_PERMALINK, $uri, $matches) ||
isset($serendipity['GET']['id']) ||
isset($_GET['p']) ) { ...
I know, it's not the most elegant piece of code, but it works;-)

Regards,
Greg
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Post by judebert »

So, what do you think, Garvin? The change looks good to me; I'll commit it if you have no objections.
Judebert
---
Website | Wishlist | PayPal
Post Reply