[pmwiki-users] Markup Question

Dave Brockman daveb at oz.net
Mon May 4 02:38:49 CDT 2009


Petko Yotov wrote:
> On Monday 04 May 2009 05:33:58 Dave Brockman wrote:
>> Petko Yotov wrote:
>>> On Saturday 02 May 2009 06:12:10 Dave Brockman wrote:
>>>> Users on my site are allowed to edit pages in three
>>>> groups. I would like to disallow pictures in these groups. I read about
>>>> the use of "DisableMarkup('img') in the documentation for Images. I
>>>> *think* I should create a "groupname.php" file in /local containing that
>>>> markup for each group. Is this correct? Thanks in advance for any help.
>>>>
>>>> <?php
>>>>    DisableMarkup('img');
>>> Hello. Yes, this is the way to disable some markup rule. (Only the group
>>> customization file is named "Groupname.php" and not "groupname.php".)
>>>
>>> See also a related discussion at :
>>>   http://www.pmwiki.org/wiki/PITS/01096
> 
>> Hi Petko,
>>
>> Thanks! I tried it, and it doesn't seem to work. I created a file named
>> CommentPages.php which matches the group name. The contents are:
>>
>> <?php if (!defined('PmWiki')) exit();
>>
>> ## Suppress images.
>> DisableMarkup('img');
>>
>> I then added an image to a page in the group with  the page edit window as:
>>
>> A test to see if images are blocked.
>>
>> http://www.perrymasontvseries.com/wiki/images/AbsentArtist-095.jpg
>>
>> Upon saving, I find that the image shows up and is a link to itself.
> 
> Right, I didn't know. When we DisableMarkup('img'), the "http://www...jpg" 
> thing is treated not as an image, but as a regular external link. But the 
> MakeLink function re-checks it to see if it seems like an image, regardless 
> of the markup rules.
> 
> You should also add to CommentPages.php this line :
>   $ImgExtPattern = "$^";
> 
> This line will cause MakeLink to skip the "check image" part, and instead to 
> display the link, like any other http://... link.
> 
> I just tested it here :
>   http://www.pmwiki.org/wiki/Test/DisableMarkup
> 
> Thanks,
> Petko

Ah! That does indeed fix the problem. Thank you very much!

Unfortunately there is yet another problem. Some background. On my site, 
only pages in CommentPages and three other groups can be edited by 
users. Pages from these groups are included on pages in the private 
group EpisodePages. I find now that my test image reappears when the 
CommentPages page is included on the EpisodePages page. Is there some 
way to prevent the "include" from restoring the image? I did notice that 
this image is not a link to itself. Links to images from the user 
editable pages should be allowed. And, images, added by myself, are used 
in EpisodePages. Thanks, again, for your help.

I may be worrying about this too much. I have had no problems with users 
posting "bad" images. And, no matter what can be done, I will still have 
to check every user addition. :-)

Dave




More information about the pmwiki-users mailing list