[pmwiki-users] Solved: Commentbox - Preventing posting of directives

Mike mike at widowitz.com
Mon Oct 2 16:06:09 CDT 2006

Hi everyone,

if anybody is interested: I added a line to the commentboxplus recipe
which introduces a global variable $PreventDirectives.

It enables the admin to prevent users from posting directives like
(:title:) as part of their comment, by changing the colon to the
corresponding HTML entity. Thus, when the user comments with (:title
this page sucks:), this will simply show up as his comment.

The last four lines are the ones which I have added. I also just posted
this on the cookbook page (can someone reformat the indent there?).


function HandleCommentPost($pagename) {
  global $_GET,$_POST,$JournalPattern,$DiaryPattern,$Author;
  global $AuthFunction, $oAuthFunction;
  if (!@$_POST['post'] || @$_POST['text']=='') Redirect($pagename);
  if (@$_POST['author']=='') $Author = 'anon';
  if (isset($_GET['message'])) { $message = $_GET['message']; echo
$message; }
  if (@$_POST['postto']) {
      SDV($EditRedirectFmt, $pagename);
      $pagename = MakePageName($pagename, $_POST['postto']);

    if($PreventDirectives == 1){   
        $_POST['text'] = ereg_replace(":",":",$_POST['text']);

-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/pmwiki-users/attachments/20061002/59f99c86/attachment.html 

More information about the pmwiki-users mailing list