[pmwiki-users] Pagename alternative conflicts? was Re: Wikipaths

Crisses crisses at kinhost.org
Fri Sep 8 10:18:44 CDT 2006


On Sep 8, 2006, at 10:07 AM, Patrick R. Michaud wrote:

> On Fri, Sep 08, 2006 at 09:52:06AM -0400, Crisses wrote:
>> On Sep 8, 2006, at 8:48 AM, Patrick R. Michaud wrote:
>>
>>> Still, I can't think of anything currently in PmWiki that will
>>> specifically disallow the colon in pagenames, if one is willing to
>>> accept that there may be conflicts with url protocol prefixes and
>>> InterMap prefixes.
>>
>> Can the intermap delimiter be changed? LOL
>
> Actually, it can, with a couple of small modifications.  :-)

Since the customer is "always right" that may be preferable to not  
using the colons.

>>> allow colons, and get MakePageName() to not strip colons in the
>>> pagename.  So, in config.php:
>>>
>>>    $NamePattern = '[[:upper:]\\d][\\w:]*(?:-[\\w:]+)*';
>>>    $PageNameChars = '-:[:alnum:]';
>>
>> It's not working.   I personally prefer perl (PCRE) over posix (PREG)
>> regexes....
>
> These *are* PCRE regexes -- that's basically all I use.
> The preg_* functions in PHP use PCRE.

ok -- my bad.

>> In posix regex, : does not seem to need to be escaped, but your
>> regexes didn't work.
>
> Odd, they're working for me.
>
>     http://www.pmichaud.com/sandbox/colons/pmwiki.php?n=Main.HomePage

I commented out all my plugins from config.php and it worked.   
There's a plug-in conflict with

if ($action == 'edit' || $action == 'comment') {
     $EnableWhyBlocked = 1;
     include_once('cookbook/blocklist3.php');
}

Now, don't ask WHY that would have anything to do with it.  :P  It  
happens if I include the blocklist code.

I should have tried commenting out cookbook and other custom markup.

In any case it works now.  Thank you.  now I need to examine my own  
plug-in ;)

Blocklist calls $page_name = ResolvePageName($pagename); -- if that  
matters??

Another odd thing:  when the blocklist (3) is disabled, the "broken"  
link leads directly to an edit page.  When enabled, the link (http:// 
similepedia.com/index.php? 
n=Simile.OfMiceAndMen:SteinbeckJohn:HerHairHung?action=edit) leads to  
a screen that says 'The page  
"Simile.OfMiceAndMenSteinbeckJohnHerHairHung" doesn't exist. (Create  
Simile.OfMiceAndMenSteinbeckJohnHerHairHung)'

I didn't make it do that on purpose ;)  Why is the doesn't exist  
message coming up suddenly instead of the page edit form?

I ran over the Blocklist3 -- it's mainly a class-based recipe, so I  
made sure to rename all cookbook-only non-class variables to  
"$bl_..." to absolutely make sure it's not a variable conflict.   
Other than that I can't see what's wrong with it.   Except that it  
really shouldn't execute the bulk of it's code unless the form has  
been submitted ;) -- I don't even think the recipe checks the  
pagetitle for whether it contains blocked words.

>> I know the regexes you hinted at are (not) working because I managed
>> to break them while tweaking to see if I could fix them.
>> Original pmwiki.php line
>> //pmwiki.php:43:$NamePattern = '[[:upper:]\\d][\\w]*(?:-\\w+)*';
>> $NamePattern = '[[:upper:]\\d][\\w]*(?:-[\\w:]+)*';
>> $PageNameChars = '-:[:alnum:]';
>
> This version of $NamePattern is saying that colons can only appear
> after hyphens.

I copied your code then started messing around with it, trying to  
convince it to work.  In any case, I found the conflict (weird!).

>> I tried
>> $NamePattern = '[[:upper:]\\d][\\w]*(?:-[\\w]+[:]+)*';
>
> This is saying that colons can only occur after hyphens, and then
> only if at the end of the pagename or immediately followed by a  
> hyphen.  :-)

LOL -- like I said, I started messing around with it.

>     [^-:[:alnum:]]          and   [^:-[:alnum:]]
>
> In the first, the hyphen means "don't match a hyphen", in the
> second it means "don't match any character between colon and ["
> (which would really blow up with fireworks, indeed).

Actually [^...] means "don't match anything in this set" but yes, the  
hyphen would be a range and that's messy.

> At any rate, I'm curious as to why the versions I supplied aren't
> working for you -- is there a url I can look at?  Or perhaps
> try it on a clean install w/no recipes?

It wasn't the recipes -- I did process of elimination once the  
commenting out all custom garbage worked.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/pmwiki-users/attachments/20060908/8bbe51b8/attachment.html 


More information about the pmwiki-users mailing list