Example #1
0
 public function excluirAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender();
     $db = new Album();
     $dbf = new Fotos();
     $id = $this->_request->getParam('id');
     $db->deleteAlbum($id);
     $dbf->deleteFotos($id);
     $this->_redirect('painel/album/listar');
 }
 /**
  * Delete the entire album PERMANENTLY. Be careful! This is unrecoverable.
  * Returns true if successful
  *
  * @return bool
  */
 function deleteAlbum()
 {
     if (!$this->isDynamic()) {
         foreach ($this->getSubAlbums() as $folder) {
             $subalbum = new Album($album, $folder);
             $subalbum->deleteAlbum();
         }
         foreach ($this->getImages() as $filename) {
             $image = newImage($this, $filename);
             $image->deleteImage(true);
         }
         chdir($this->localpath);
         $filelist = safe_glob('*');
         foreach ($filelist as $file) {
             if ($file != '.' && $file != '..') {
                 unlink($this->localpath . $file);
                 // clean out any other files in the folder
             }
         }
     }
     query("DELETE FROM " . prefix('options') . "WHERE `ownerid`=" . $this->id);
     query("DELETE FROM " . prefix('comments') . "WHERE `type`='albums' AND `ownerid`=" . $this->id);
     query("DELETE FROM " . prefix('albums') . " WHERE `id` = " . $this->id);
     if ($this->isDynamic()) {
         return unlink($this->localpath);
     } else {
         return rmdir($this->localpath);
     }
 }
Example #3
0
     }
     if ($notify == '&') {
         $notify = '';
     } else {
         $notify .= '&saved';
     }
     header('Location: ' . FULLWEBPATH . '/' . ZENFOLDER . '/admin-edit.php?page=edit' . $qs_albumsuffix . $notify . $pg . $returntab);
     exit;
     /** DELETION ******************************************************************/
     /*****************************************************************************/
 } else {
     if ($action == "deletealbum") {
         if ($_GET['album']) {
             $folder = sanitize_path($_GET['album']);
             $album = new Album($gallery, $folder);
             if ($album->deleteAlbum()) {
                 $nd = 3;
             } else {
                 $nd = 4;
             }
             $albumdir = dirname($folder);
             if ($albumdir != '/' && $albumdir != '.') {
                 $albumdir = "&album=" . urlencode($albumdir);
             } else {
                 $albumdir = '';
             }
         }
         header("Location: " . FULLWEBPATH . "/" . ZENFOLDER . "/admin-edit.php?page=edit" . $albumdir . "&ndeleted=" . $nd);
         exit;
     }
 }