b2evolution

Multilingual multiuser multiblog engine

b2evolution Technical Documentation (CVS HEAD) [ class tree: main ] [ index: main ] [ all elements ]

Source for file comment_review.php

Documentation is available at comment_review.php

  1. <?php
  2. /**
  3.  * This is file implements the comments quick edit operations after mail notification.
  4.  */
  5.  
  6. /**
  7.  * Initialize everything:
  8.  */
  9. require_once dirname(dirname(__FILE__)).'/conf/_config.php';
  10.  
  11. require_once dirname(dirname(__FILE__)).'/inc/_main.inc.php';
  12.  
  13. param('cmt_ID''integer''' );
  14. param('secret''string''' );
  15.  
  16. $to_dashboard $admin_url.'?ctrl=dashboard';
  17. $to_comment_edit $admin_url.'?ctrl=comments&action=edit&comment_ID='.$cmt_ID;
  18.  
  19. if$cmt_ID != null )
  20. {
  21.     $posted_Comment Comment_get_by_ID$cmt_ID );
  22. }
  23. else
  24. {
  25.     $Messages->add'Requested comment does not exist!' );
  26.     header_redirect$to_dashboard );
  27. }
  28.  
  29. // Check the secret paramater (This doubles as a CRUMB)
  30. if$secret != $posted_Comment->get('secret') )
  31. {    // Invalid secret, no moderation allowed here, go to regular form with regular login requirements:
  32.     header_redirect$to_comment_edit );
  33. }
  34.  
  35. $antispam_url $admin_url.'?ctrl=antispam&action=ban&keyword='.$posted_Comment->author_url.'&'.url_crumb'antispam' );
  36.  
  37. // perform action if action is not null
  38. switch$action )
  39. {
  40.     case 'publish':
  41.         $posted_Comment->set('status''published' );
  42.  
  43.         $posted_Comment->dbupdate();    // Commit update to the DB
  44.  
  45.         $Messages->addT_('Comment has been published.')'success' );
  46.  
  47.         header_redirect$to_dashboard );
  48.         /* exited */
  49.         break;
  50.  
  51.  
  52.     case 'deprecate':
  53.         $posted_Comment->set('status''deprecated' );
  54.  
  55.         $posted_Comment->dbupdate();    // Commit update to the DB
  56.  
  57.         $Messages->addT_('Comment has been deprecated.')'success' );
  58.  
  59.         header_redirect$to_dashboard );
  60.         /* exited */
  61.         break;
  62.  
  63.  
  64.     case 'delete':
  65.         // Delete from DB:
  66.         $posted_Comment->dbdelete();
  67.  
  68.         $Messages->addT_('Comment has been deleted.')'success' );
  69.  
  70.         header_redirect$to_dashboard );
  71.         break;
  72.         
  73.     case 'deleteurl':
  74.         // Delete author url:
  75.         $posted_Comment->set'author_url'null );
  76.  
  77.         $posted_Comment->dbupdate();    // Commit update to the DB
  78.  
  79.         $Messages->addT_('Comment url has been deleted.')'success' );
  80.         
  81.         break;
  82.         
  83.     case 'antispamtool':
  84.         // Redirect to the Antispam ban screen
  85.  
  86.         header_redirect$antispam_url );
  87.         /* exited */
  88.         break;
  89. }
  90.  
  91. // No action => display the form
  92. ?>
  93. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  94. <html xml:lang="<?php locale_lang(?>" lang="<?php locale_lang(?>">
  95. <head>
  96.     <title><?php echo ' '.T_('Comment review').' '?></title>
  97. </head>
  98.  
  99. <body>
  100.  
  101. <form method="post" name="review">
  102.  
  103. <?php
  104.  
  105. if ($secret == $posted_Comment->get('secret'&& ($secret != NULL) )
  106. {
  107.     // delete button
  108.     echo '<input type="submit" name="actionArray[delete]"';
  109.     echo ' value="'.T_('Delete').'" title="'.T_('Delete this comment').'"/>';
  110.     echo "\n";
  111.  
  112.     // deprecate button
  113.     if$posted_Comment->status != 'deprecated')
  114.     {
  115.         echo '<input type="submit" name="actionArray[deprecate]"';
  116.         echo ' value="'.T_('Deprecate').'" title="'.T_('Deprecate this comment').'"/>';
  117.         echo "\n";
  118.     }
  119.  
  120.     // publish button
  121.     if$posted_Comment->status != 'published' )
  122.     {
  123.         echo '<input type="submit" name="actionArray[publish]"';
  124.         echo ' value="'.T_('Publish').'" title="'.T_('Publish this comment').'"/>';
  125.         echo "\n";
  126.     }
  127.     
  128.     if$posted_Comment->author_url != null )
  129.     {
  130.         // delete url button
  131.         echo '<input type="submit" name="actionArray[deleteurl]"';
  132.         echo ' value="'.T_('Delete URL').'" title="'.T_('Delete comment URL').'"/>';
  133.         echo "\n";
  134.         
  135.         // antispam tool button
  136.         echo '<input type="submit" name="actionArray[antispamtool]"';
  137.         echo ' value="'.T_('Antispam tool').'" title="'.T_('Antispam tool').'"/>';
  138.         echo "\n";
  139.     }
  140.     
  141.     echo '<input type="hidden" name="secret" value="'.$secret.'"';
  142.     echo "\n";
  143.     echo '<input type="hidden" name="cmt_ID" value="'.$cmt_ID.'"';
  144.     echo "\n";
  145. }
  146. else
  147. {
  148.     dieT_('Invalid link!') );
  149. }
  150.  
  151. ?>
  152. <fieldset>
  153. <legend><?php echo T_('Posted comment')?></legend>
  154. <div class=bComment>
  155.     <div class="bSmallHead">
  156.         <span class="bDate"><?php $posted_Comment->date()?></span>
  157.         @
  158.         <span class="bTime"><?php $posted_Comment->time'H:i' )?></span>
  159.         <?php
  160.                 $posted_Comment->author_url''' &middot; Url: <span class="bUrl">''</span>' );
  161.                 if$posted_Comment->author_url != null )
  162.                 {
  163.                     echo ' '.action_iconT_('Delete comment url')'delete'regenerate_url''array'action=deleteurl''cmt_ID='.$cmt_ID'secret='.$secret ) ) ).' ';
  164.                     echo ' '.action_iconT_('Antispam tool')'ban'$antispam_url );
  165.                 }
  166.                 $posted_Comment->author_email''' &middot; Email: <span class="bEmail">''</span>' );
  167.                 $posted_Comment->author_ip' &middot; IP: <span class="bIP">''</span>' );
  168.                 echo ' &middot; <span class="bKarma">';
  169.                 $posted_Comment->spam_karmaT_('Spam Karma').': %s%'T_('No Spam Karma') );
  170.                 echo '</span>';
  171.              ?>
  172.     </div>
  173.     <div class="bTitle">
  174.         <?php echo $posted_Comment->get_title()?>
  175.     </div>
  176.     <?php $posted_Comment->rating()?>
  177.     <?php $posted_Comment->avatar()?>
  178.     <fieldset class="bCommentText">
  179.         <legend><?php echo T_('Content')?></legend>
  180.         <?php $posted_Comment->content(?>
  181.     </fieldset>
  182. </div>
  183. </fieldset>
  184.  
  185. </form>
  186.  
  187. </body>
  188. </html>

Documentation generated on Sat, 06 Mar 2010 03:50:46 +0100 by phpDocumentor 1.4.2. This site is hosted and maintained by Daniel HAHLER (Contact).