/** * Removes a user from the system */ function remove() { zp_apply_filter('remove_user', $this); $album = $this->getAlbum(); $id = $this->getID(); if (parent::remove()) { if (!empty($album)) { // Remove users album as well $album->remove(); } $sql = "DELETE FROM " . prefix('admin_to_object') . " WHERE `adminid`={$id}"; $result = query($sql); } else { return false; } return $result; }
/** * Delete the entire album PERMANENTLY. Be careful! This is unrecoverable. * Returns true if successful * * @return bool */ function remove() { $rslt = false; if (PersistentObject::remove()) { foreach ($this->getImages() as $filename) { $image = newImage($this, $filename); $image->remove(); } foreach ($this->getAlbums() as $folder) { $subalbum = newAlbum($folder); $subalbum->remove(); } $curdir = getcwd(); chdir($this->localpath); $filelist = safe_glob('*'); foreach ($filelist as $file) { if ($file != '.' && $file != '..') { @chmod($file, 0777); unlink($this->localpath . $file); // clean out any other files in the folder } } chdir($curdir); clearstatcache(); 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('obj_to_tag') . "WHERE `type`='albums' AND `objectid`=" . $this->id); $success = true; $filestoremove = safe_glob(substr($this->localpath, 0, strrpos($this->localpath, '.')) . '.*'); foreach ($filestoremove as $file) { if (in_array(strtolower(getSuffix($file)), $this->sidecars)) { @chmod($file, 0777); $success = $success && unlink($file); } } @chmod($this->localpath, 0777); $rslt = @rmdir($this->localpath) && $success; $cachepath = SERVERCACHE . '/' . pathurlencode($this->name) . '/'; @chmod($cachepath, 0777); @rmdir($cachepath); } clearstatcache(); return $rslt; }
/** * Invalidate the search cache because something has definately changed */ function remove() { if (class_exists('SearchEngine')) { SearchEngine::clearSearchCache($this); } return parent::remove(); }