コード例 #1
0
 /**
  * @brief Validates file upload (whenever it's regular upload or by-url upload) and sets status and errorMsg
  *
  * @param integer $errorNo variable being checked
  *
  * @return String
  * @author Andrzej 'nAndy' Łukaszewski
  */
 private function validateUpload($errorNo)
 {
     switch ($errorNo) {
         case UPLOAD_ERR_NO_FILE:
             return wfMessage('user-identity-box-avatar-error-nofile')->escaped();
             break;
         case UPLOAD_ERR_CANT_WRITE:
             return wfMessage('user-identity-box-avatar-error-cantwrite')->escaped();
             break;
         case UPLOAD_ERR_FORM_SIZE:
             return wfMessage('user-identity-box-avatar-error-size', (int) (self::AVATAR_MAX_SIZE / 1024))->escaped();
             break;
         case UPLOAD_ERR_EXTENSION:
             return wfMessage('userprofilepage-avatar-error-type', $this->wg->Lang->listToText(ImageOperationsHelper::getAllowedMime()))->escaped();
             break;
         case ImageOperationsHelper::UPLOAD_ERR_RESOLUTION:
             return wfMessage('userprofilepage-avatar-error-resolution')->escaped();
             break;
         default:
             return wfMessage('user-identity-box-avatar-error')->escaped();
     }
 }