本文整理匯總了PHP中UploadBase::verifyPermissions方法的典型用法代碼示例。如果您正苦於以下問題:PHP UploadBase::verifyPermissions方法的具體用法?PHP UploadBase::verifyPermissions怎麽用?PHP UploadBase::verifyPermissions使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類UploadBase
的用法示例。
在下文中一共展示了UploadBase::verifyPermissions方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: verifyPermissions
/**
* Wrapper around the parent function in order to defer checking protection
* until we are sure that the file can actually be uploaded
*/
public function verifyPermissions($user)
{
if ($this->mAsync) {
return true;
}
return parent::verifyPermissions($user);
}
示例2: uploadImage
/**
* @param UploadBase $upload
* @return array
*/
private function uploadImage($upload)
{
global $wgRequest, $wgUser, $wgEnableUploads;
$uploadStatus = array("status" => "error");
if (empty($wgEnableUploads)) {
$uploadStatus["errors"] = [wfMessage('themedesigner-upload-disabled')->plain()];
} else {
$upload->initializeFromRequest($wgRequest);
$permErrors = $upload->verifyPermissions($wgUser);
if ($permErrors !== true) {
$uploadStatus["errors"] = array(wfMsg('badaccess'));
} else {
$details = $upload->verifyUpload();
if ($details['status'] != UploadBase::OK) {
$uploadStatus["errors"] = array($this->getUploadErrorMessage($details));
} else {
$warnings = $upload->checkWarnings();
if (!empty($warnings)) {
$uploadStatus["errors"] = $this->getUploadWarningMessages($warnings);
} else {
//save temp file
$status = $upload->performUpload();
$uploadStatus["status"] = "uploadattempted";
$uploadStatus["isGood"] = $status->isGood();
}
}
}
}
return $uploadStatus;
}