04.08
php
saved
teknix_
Note
This is the error i get.
Fatal error: Can't use method return value in write context in C:\wamp\www\cake1.2\app\controllers\films_controller.php on line 74
what am i doing wrong ?
This is the error i get.
Fatal error: Can't use method return value in write context in C:\wamp\www\cake1.2\app\controllers\films_controller.php on line 74
what am i doing wrong ?
- <?php
- class FilmsController extends AppController {
- var $name = 'Films';
- function beforeFilter() {
- $this->Auth->allow('view', 'index');
- }
- function isAuthorized() {
- if ($this->action == ‘edit’) {
- if ($this->Auth->user(‘id’) == $this->data['Film']['user_id']) {
- return true;
- } else {
- return false;
- }
- }
- return true;
- }
- function index() {
- $this->Film->recursive = 0;
- $this->set('films', $this->paginate());
- }
- function view($id = null) {
- if (!$id) {
- $this->Session->setFlash(__('Invalid Film.', true));
- }
- $this->set('film', $this->Film->read(null, $id));
- }
- function add() {
- $this->data['Film']['user_id'] = $this->Auth->user('id');
- $this->Film->create();
- $fileName = $this->Film->generateUniqueFilename($this->data['Film']['file']['name']);
- //echo 'The filename is:'. $fileName;
- $error = $this->Film->handleFileUpload($this->data['Film']['file'], $fileName);
- //echo 'The error is:'. $error;
- }
- if (!$error) {
- WWW_ROOT.'/files/'.
- $this->data['Film']['file'] = "/files/".$fileName;
- if ($this->Film->save($this->data)) {
- $this->Session->setFlash(__('The Film has been saved', true));
- } else {
- $this->Session->setFlash(__('The Film could not be saved. Please, try again.', true));
- }
- }
- }
- }
- function edit($id = null) {
- $this->Session->setFlash(__('Invalid Film', true));
- }
- if ($this->Film->save($this->data)) {
- $this->Session->setFlash(__('The Film has been saved', true));
- } else {
- $this->Session->setFlash(__('The Film could not be saved. Please, try again.', true));
- }
- }
- $this->data = $this->Film->read(null, $id);
- if ($this->Auth->user('id') = $this->data['Film']['user_id']) {
- $this->data = $this->Film->read(null, $id);
- } else {
- $this->Session->setFlash('You are not Authorized to edit this film');
- }
- }
- }
- function delete($id = null) {
- if (!$id) {
- $this->Session->setFlash(__('Invalid id for Film', true));
- }
- if ($this->Film->del($id)) {
- $this->Session->setFlash(__('Film deleted', true));
- }
- }
- }
- ?>
Parsed in 0.174 seconds, using GeSHi 1.0.7.14