From 9a359b265c889ee5be32caa3d90ea19955c09ca4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20M=C3=BCller?= Date: Wed, 16 Apr 2014 15:34:02 +0200 Subject: [PATCH] suche --- app/Controller/SearchController.php | 4 ++++ app/Controller/UserController.php | 10 +++------- app/Model/DreamjobPageImage.php | 18 +++++++++++++++++- 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/app/Controller/SearchController.php b/app/Controller/SearchController.php index a233e3c..c7bc55d 100644 --- a/app/Controller/SearchController.php +++ b/app/Controller/SearchController.php @@ -22,6 +22,10 @@ class SearchController extends AppController { * @throws NotFoundException When the view file could not be found * or MissingViewException in debug mode. */ + public function beforeFilter(){ + $this->Security->unlockedActions[]="openings"; + parent::beforeFilter(); + } public function openings() { $this->MiconwareSession->init($this); diff --git a/app/Controller/UserController.php b/app/Controller/UserController.php index 8d89c78..0116a1c 100755 --- a/app/Controller/UserController.php +++ b/app/Controller/UserController.php @@ -159,7 +159,7 @@ class UserController extends AppController { $this->render('/Home/error'); } } - + /* public function savePageDeleteJson(){ $this->MiconwareSession->init($this); @@ -182,7 +182,7 @@ class UserController extends AppController { $this->set('error', true); } $this->set('_serialize', array('error')); - } + }*/ public function savePageOrder(){ $this->MiconwareSession->init($this); @@ -371,16 +371,12 @@ class UserController extends AppController { if(!empty($page) and count($page)> 0){ $path = null; if($image){ - $path = WWW_ROOT.$page['DreamjobPageImage']['image']; - $result = $this->DreamjobPageImage->delete($page['DreamjobPageInh']['id'],false); + $result = $this->DreamjobPageImage->delete($page,false); }else $result = $this->DreamjobPageText->delete($page['DreamjobPageInh']['id'],false); if($result){ $result = $this->DreamjobPageInh->delete($page['DreamjobPageInh']['id'],false); } - if($path!=null and $result){ - $result = unlink($path); - } if($result){ $this->MiconwareSession->refreshCache(); $profil = $this->MiconwareSession->getWorker(); diff --git a/app/Model/DreamjobPageImage.php b/app/Model/DreamjobPageImage.php index 5e28520..fc2dd30 100644 --- a/app/Model/DreamjobPageImage.php +++ b/app/Model/DreamjobPageImage.php @@ -124,7 +124,23 @@ public function processUpload($check=array()) { return TRUE; } - +public function delete($id = NULL, $cascade = true){ + $dataSource = $this->getDataSource(); + $dataSource->begin(); + $result = $this->delete($id['DreamjobPageInh']['id'],false); + if($result){ + $filename = WWW_ROOT . $this->uploadDir . DS .$id['DreamjobPageImage']['image']; + chmod($filename,0755); + $result = unlink($filename); + } + if ($result) { + $dataSource->commit(); + return true; + } else { + $dataSource->rollback(); + } + return false; +} public function saveAndUpload($data){ $dataSource = $this->getDataSource(); $dataSource->begin();