本文整理匯總了PHP中FileHelper::checkAccess方法的典型用法代碼示例。如果您正苦於以下問題:PHP FileHelper::checkAccess方法的具體用法?PHP FileHelper::checkAccess怎麽用?PHP FileHelper::checkAccess使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類FileHelper
的用法示例。
在下文中一共展示了FileHelper::checkAccess方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: bulk_action
/**
* General handler for bulk actions. Support the following actions:
*
* - Download
* - Move
* - Copy
* - Delete
*
* @param String $folder_id Directory entry id of the origin folder
*/
public function bulk_action($folder_id, $page = 1)
{
$ids = Request::optionArray('ids');
FileHelper::checkAccess($ids);
if (empty($ids)) {
$this->redirect('document/files/index/' . $folder_id . '/' . $page);
} else {
if (Request::submitted('download')) {
$this->flash['ids'] = $ids;
$this->redirect('document/download/flashed');
} else {
if (Request::submitted('move')) {
$this->flash['move-ids'] = $ids;
$this->redirect('document/files/move/flashed/' . $folder_id);
} else {
if (Request::submitted('copy')) {
$this->flash['copy-ids'] = $ids;
$this->redirect('document/files/copy/flashed/' . $folder_id);
} else {
if (Request::submitted('delete')) {
if (Request::submitted('yes')) {
if ($folder_id === $this->context_id) {
$dir = new RootDirectory($this->context_id);
} else {
$entry = new DirectoryEntry($folder_id);
$dir = $entry->file;
}
foreach ($ids as $id) {
$entry = new DirectoryEntry($id);
$dir->unlink($entry->name);
}
PageLayout::postMessage(MessageBox::success(_('Die Dateien wurden erfolgreich gelöscht.')));
} elseif (!Request::submitted('no')) {
$question = createQuestion2(_('Sollen die markierten Dateien wirklich gelöscht werden?'), array('delete' => 'true', 'ids' => $ids), array(), $this->url_for('document/files/bulk/' . $folder_id));
$this->flash['question'] = $question;
$this->flash['marked-ids'] = $ids;
}
$this->redirect('document/files/index/' . $folder_id . '/' . $page);
}
}
}
}
}
}
示例2: delete_action
/**
* Deletes a folder.
*
* @param String $folder_id Directory entry id of the folder
*/
public function delete_action($folder_id)
{
if (!$this->full_access) {
throw new AccessDeniedException();
}
FileHelper::checkAccess($folder_id);
$parent_id = FileHelper::getParentId($folder_id) ?: $this->context_id;
if (!Request::isPost()) {
$message = $folder_id === 'all' ? _('Soll der gesamte Dateibereich inklusive aller Order und Dateien wirklich gelöscht werden?') : _('Soll der Ordner inklusive aller darin enthaltenen Dateien wirklich gelöscht werden?');
$question = createQuestion2($message, array(), array(), $this->url_for('document/folder/delete/' . $folder_id));
$this->flash['question'] = $question;
} elseif (Request::isPost() && Request::submitted('yes')) {
if ($folder_id === 'all') {
$entry = RootDirectory::find($this->context_id);
foreach ($entry->listFiles() as $file) {
$entry->unlink($file->name);
}
PageLayout::postMessage(MessageBox::success(_('Der Dateibereich wurde geleert.')));
} else {
$entry = DirectoryEntry::find($folder_id);
$entry->directory->unlink($entry->name);
PageLayout::postMessage(MessageBox::success(_('Der Ordner wurde gelöscht.')));
}
}
$this->redirect('document/files/index/' . $parent_id);
}