コード例 #1
0
ファイル: Album.php プロジェクト: rcrrich/cunity
 /**
  * @return bool
  * @throws \Exception
  * @throws \Zend_Db_Table_Row_Exception
  */
 public function deleteAlbum()
 {
     $images = new GalleryImages();
     $imageslist = $images->getImages($this->id);
     $settings = Cunity::get("settings");
     foreach ($imageslist as $image) {
         $likes = new Likes();
         $comments = new Comments();
         $comments->delete($this->getTable()->getAdapter()->quoteInto("ref_id=? AND ref_name='image'", $image['id']));
         $likes->delete($this->getTable()->getAdapter()->quoteInto("ref_id=? AND ref_name='image'", $image['id']));
         unlink("../data/uploads/" . $settings->getSetting("core.filesdir") . "/" . $image['filename']);
         unlink("../data/uploads/" . $settings->getSetting("core.filesdir") . "/thumb_" . $image['filename']);
         if (file_exists("../data/uploads/" . $settings->getSetting("core.filesdir") . "/cr_" . $image['filename'])) {
             unlink("../data/uploads/" . $settings->getSetting("core.filesdir") . "/cr_" . $image['filename']);
         }
     }
     $images->delete($images->getAdapter()->quoteInto("albumid=?", $this->id));
     return 0 < $this->delete();
 }