Ignore:
Timestamp:
03/11/10 14:24:36 (3 years ago)
Author:
nick_ramsay
Message:

[Branch 1.2] Comments 1.7 - Fix for a previous change that broke the set pending and delete links within comments.

Location:
branches/1.2/content/plugins/comments
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/1.2/content/plugins/comments/comments.php

    r1247 r1296  
    33 * name: Comments 
    44 * description: Enables logged-in users to comment on posts 
    5  * version: 1.6 
     5 * version: 1.7 
    66 * folder: comments 
    77 * class: Comments 
     
    148148        } 
    149149         
    150         if ($h->pageName == 'comments') { 
     150        if ($h->pageName == 'comments') 
     151        { 
     152            // set current comment and responses to pending: 
     153            if ($h->cage->get->getAlpha('action') == 'setpending') {  
     154             
     155                // before setting pending, we need to be certain this user has permission: 
     156                if ($h->currentUser->getPermission('can_set_comments_pending') == 'yes') { 
     157                    $cid = $h->cage->get->testInt('cid'); // comment id 
     158                    $comment = $h->comment->getComment($h, $cid); 
     159                    $h->comment->readComment($h, $comment); // read comment 
     160                    $h->comment->status = 'pending'; // set to pending 
     161                    $h->comment->editComment($h);  // update this comment 
     162 
     163                    $h->comment->postId = $h->cage->get->testInt('pid');  // post id 
     164                    $h->comment->setPendingCommentTree($h,$cid);   // set all responses to 'pending', too. 
     165                     
     166                    // redirect back to thread: 
     167                    $h->post = new Post(); 
     168                    $h->readPost($h->comment->postId); 
     169                    header("Location: " . $h->url(array('page'=>$h->post->id)));    // Go to the post 
     170                    die(); 
     171                } 
     172            } 
     173             
     174            // delete current comment and responses: 
     175            if ($h->cage->get->getAlpha('action') == 'delete') {  
     176             
     177                // before deleting a comment, we need to be certain this user has permission: 
     178                if ($h->currentUser->getPermission('can_delete_comments') == 'yes') { 
     179                    $cid = $h->cage->get->testInt('cid'); // comment id 
     180                    $comment = $h->comment->getComment($h, $cid); 
     181                    $h->comment->readComment($h, $comment); // read comment 
     182                     
     183                    $h->pluginHook('comments_delete_comment'); 
     184                     
     185                    $h->comment->deleteComment($h, $cid); // delete this comment 
     186                    $h->comment->deleteCommentTree($h, $cid);   // delete all responses, too. 
     187                     
     188                    $h->clearCache('html_cache', false); // clear HTML cache to refresh Comments and Activity widgets 
     189                     
     190                    $h->comment->postId = $h->cage->get->testInt('pid');  // post id 
     191                     
     192                    // redirect back to thread: 
     193                    $h->readPost($h->comment->postId); 
     194                    header("Location: " . $h->url(array('page'=>$h->comment->postId)));    // Go to the post 
     195                    die(); 
     196                } 
     197            } 
     198             
     199            // FOR THE COMMENTS PAGE: 
    151200            $h->pageTitle = $h->lang['comments']; 
    152201            if ($h->cage->get->keyExists('user')) { 
     
    257306                     
    258307                } 
    259                  
    260                 // set current comment and responses to pending: 
    261                 if ($h->cage->get->getAlpha('action') == 'setpending') {  
    262                  
    263                     // before setting pending, we need to be certain this user has permission: 
    264                     if ($h->currentUser->getPermission('can_set_comments_pending') == 'yes') { 
    265                         $cid = $h->cage->get->testInt('cid'); // comment id 
    266                         $comment = $h->comment->getComment($h, $cid); 
    267                         $h->comment->readComment($h, $comment); // read comment 
    268                         $h->comment->status = 'pending'; // set to pending 
    269                         $h->comment->editComment($h);  // update this comment 
    270      
    271                         $h->comment->postId = $h->cage->get->testInt('pid');  // post id 
    272                         $h->comment->setPendingCommentTree($h,$cid);   // set all responses to 'pending', too. 
    273                          
    274                         // redirect back to thread: 
    275                         $h->post = new Post(); 
    276                         $h->readPost($h->comment->postId); 
    277                         header("Location: " . $h->url(array('page'=>$h->post->id)));    // Go to the post 
    278                         die(); 
    279                     } 
    280                 } 
    281                  
    282                 // delete current comment and responses: 
    283                 if ($h->cage->get->getAlpha('action') == 'delete') {  
    284                  
    285                     // before deleting a comment, we need to be certain this user has permission: 
    286                     if ($h->currentUser->getPermission('can_delete_comments') == 'yes') { 
    287                         $cid = $h->cage->get->testInt('cid'); // comment id 
    288                         $comment = $h->comment->getComment($h, $cid); 
    289                         $h->comment->readComment($h, $comment); // read comment 
    290                          
    291                         $h->pluginHook('comments_delete_comment'); 
    292                          
    293                         $h->comment->deleteComment($h, $cid); // delete this comment 
    294                         $h->comment->deleteCommentTree($h, $cid);   // delete all responses, too. 
    295                          
    296                         $h->clearCache('html_cache', false); // clear HTML cache to refresh Comments and Activity widgets 
    297                          
    298                         $h->comment->postId = $h->cage->get->testInt('pid');  // post id 
    299                          
    300                         // redirect back to thread: 
    301                         $h->readPost($h->comment->postId); 
    302                         header("Location: " . $h->url(array('page'=>$h->comment->postId)));    // Go to the post 
    303                         die(); 
    304                     } 
    305                 } 
    306      
    307308            } 
    308309             
  • branches/1.2/content/plugins/comments/readme.txt

    r1247 r1296  
    1515Changelog 
    1616--------- 
     17v.1.7 2010/03/11 - Nick - Fix for a previous change that broke the set pending and delete links within comments. 
    1718v.1.6 2010/02/26 - Nick - Adds link to profile navigation; Email changed to go through Hotaru's "email" function  
    1819v.1.5 2010/02/23 - Nick - Shows messages for moderated comments: "Awaiting approval", "Exceeded Daily Limit", etc. 
Note: See TracChangeset for help on using the changeset viewer.