while making a friendship system in cakephp, i got error something like this in my friend controller---->
syntax error, unexpected ';'
pls someone sort out this problem.... here is my friendship controller code:
<?php
App::uses('AppController', 'Controller');
/**
* Posts Controller
*
* @property Post $Post
* @property PaginatorComponent $Paginator
*/
class FriendsController extends AppController
{
/**
* Components
*
* @var array
*/
var $layout=null;
public $components = array('Paginator');
function index()
{
}
function friendlist($user_id)
{
$session_user_id = $this->Session->read('Auth.User.id');
if($user_id == $session_user_id )
{
$user_to = $session_user_id ;
}
else
{
$user_to = $user_id;
}
$this->Friend->find('all',array('Friend.user_to'=>$user_to,'Friend.status'=>'Accepted');
}
function add_friend ( $id )
{
if(!empty($this->data))
{
$this->Friend->Create();
if($this->Friend->save($this->data))
{
$this->Session->setFlash('Friendship Requested');
$this->redirect(array('controller'=>'users','action'=>'login'));
}
}
if(empty($this->data))
{
$this->set('friends', $this->Friend->find('all',array('Friend.id'=>$id));
}
}
function accept_friendship ( $id )
{
$this->Friend->id = $id;
$current_status = $this->Friend->field('status');
if($current_status=='Requested') {
$this->Application->saveField('status', 'Accepted');
}
$this->Session->setFlash('Friendship Accepted');
$this->redirect(array('controller'=>'friends','action'=>'index'));
}
}