Show
Ignore:
Timestamp:
07/09/08 21:55:19 (5 months ago)
Author:
aarkerio
Message:

Updates genrali

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/app/controllers/comments_controller.php

    r635 r636  
    2323    $this->Auth->allow(array('view', 'add')); 
    2424  } 
    25    
    26   public function view($username=null, $entry_id=null) 
    27   {     
    28     $this->pageTitle = $username . '\'s Comments'; 
    29        
    30     $conditions      = array("status"=>1); 
    31        
    32     if ($username != null): 
    33       $user_id    = $this->User->field('id', array("username"=>$username)); 
    34       $conditions["user_id"] = $user_id; 
    35     endif; 
    36        
    37     if ($entry_id != null): 
    38       $conditions["id"] = $entry_id;   
    39     endif; 
    40        
    41     $fields     = array("id", "title", "description", "pubdate", "size"); 
    42     $order      = "id DESC"; 
    43     $limit      = 12; 
    44        
    45     $this->set('username',$username); 
    46     $this->set('data', $this->Podcast->findAll($conditions, $fields, $order, $limit, null, true));  
    47   } 
    48   
     25    
    4926  public function add()  
    5027  { 
    51     if (!empty($this->data["Comment"]) ): 
    52           
     28    if (!empty($this->data['Comment']) ): 
     29       
    5330      $this->Sanitize = new Sanitize;  
    54       $this->Sanitize->clean($this->data["Comment"]); //Hopefully this is enough 
    55       $this->Comment->create(); 
    56         
    57       if ($this->Comment->save($this->data["Comment"])): 
     31      $this->Sanitize->clean($this->data['Comment']); //Hopefully this is enough 
     32       
     33      if ($this->Comment->save($this->data)): 
    5834           $this->msgFlash(__('Comment added', true), $this->data['Comment']['redirect_to'].'/#comments'); 
     35      else: 
     36           $this->flash('Problem, please report', $this->data['Comment']['redirect_to'].'/#comments'); 
    5937      endif; 
    6038    endif; 
     
    7048    $this->data['Comment']['id']     = $comment_id; 
    7149       
    72     if ($this->Comment->save($this->data['Comment'])): 
    73       $this->msgFlash('Comment status changed', '/admin/entries/comments'); 
     50    if ($this->Comment->save($this->data)): 
     51        $this->msgFlash('Comment status changed', '/admin/entries/comments'); 
    7452    endif; 
    7553  } 
     
    8058      
    8159    if ( empty( $this->data["Comment"] ) ): 
    82       $this->data      = $this->Comment->read(null, $id); 
     60       $this->data      = $this->Comment->read(null, $id); 
    8361    else: 
    84     $this->Sanitize = new Sanitize; 
     62      $this->Sanitize = new Sanitize; 
    8563          
    86     $this->Sanitize->html($this->data["Comment"]["comment"]); 
     64      $this->Sanitize->html($this->data["Comment"]["comment"]); 
    8765          
    88     if ($this->Comment->save($this->data["Comment"])):   
    89       $this->msgFlash('Comment saved!', '/admin/comments/edit/'.$this->data["Comment"]["id"]); 
    90     endif; 
    91     endif; 
     66      if ($this->Comment->save($this->data)):   
     67         $this->msgFlash('Comment saved!', '/admin/comments/edit/'.$this->data["Comment"]["id"]); 
     68      endif; 
     69   endif; 
    9270  } 
    9371  
    94   public function admin_delete($id) 
     72  public function admin_delete($comment_id) 
    9573  { 
    96     if ($this->Comment->del($id)): 
    97       $this->msgFlash('Comment deleted', '/admin/comments/listing'); 
     74    if ($this->Comment->del($comment_id)): 
     75       $this->msgFlash('Comment deleted', '/admin/comments/listing'); 
    9876    endif; 
    9977  }