Alan Lam 7 лет назад
Родитель
Сommit
f4ae481f03
1 измененных файлов с 13 добавлено и 12 удалено
  1. 13 12
      engine/http.php

+ 13 - 12
engine/http.php

@@ -123,6 +123,7 @@ class HTTP {
 	public static function value(string $key, string $validation = "none", string $request_type = "request") {
 
 		$request_type = strtolower($request_type);
+		$array = [];
 
 		switch($request_type) {
 
@@ -206,16 +207,16 @@ class HTTP {
 
 	public static function getUploadErrorString($error, $name = "file") {
 		switch($error) {
-			case UPLOAD_ERR_OK: return "The $name uploaded successfully.";
-			case UPLOAD_ERR_INI_SIZE: return "The $name uploaded was too large.";
-			case UPLOAD_ERR_FORM_SIZE: return "The $name uploaded was too large.";
-			case UPLOAD_ERR_PARTIAL: return "The $name uploaded was only partially uploaded.";
-			case UPLOAD_ERR_NO_FILE: return "No $name was uploaded.";
-			case UPLOAD_ERR_NO_TMP_DIR: return "The $name cannot be uploaded as the temporary folder is missing.";
-			case UPLOAD_ERR_CANT_WRITE: return "The $name cannot be written to disk.";
-			case UPLOAD_ERR_EXTENSION: return "The $name uploaded was blocked by an extension.";
+			case UPLOAD_ERR_OK: return sprintf(__("The %s uploaded successfully."), $name);
+			case UPLOAD_ERR_FORM_SIZE:
+			case UPLOAD_ERR_INI_SIZE: return sprintf(__("The %s uploaded was too large."), $name);
+			case UPLOAD_ERR_PARTIAL: return sprintf(__("The %s uploaded was only partially uploaded."), $name);
+			case UPLOAD_ERR_NO_FILE: return sprintf(__("No %s was uploaded."), $name);
+			case UPLOAD_ERR_NO_TMP_DIR: return sprintf(__("The %s cannot be uploaded as the temporary folder is missing."), $name);
+			case UPLOAD_ERR_CANT_WRITE: return sprintf(__("The %s cannot be written to disk."), $name);
+			case UPLOAD_ERR_EXTENSION: return sprintf(__("The %s uploaded was blocked by an extension."), $name);
 		}
-		return "Unknown error.";
+		return __("Unknown error.");
 	}
 
 	public static function setStatusCode($code) {
@@ -242,10 +243,10 @@ class HTTP {
 		$file = (object) $file;
 		if($file->error > 0) {
 			switch($file->error) {
-				case UPLOAD_ERR_NO_FILE: throw new Exception("No file was submitted."); break;
-				case UPLOAD_ERR_INI_SIZE: throw new Exception("The uploaded file was too large."); break;
+				case UPLOAD_ERR_NO_FILE: throw new Exception(__("No file was submitted.")); break;
+				case UPLOAD_ERR_INI_SIZE: throw new Exception(__("The uploaded file was too large.")); break;
 			}
-			throw new Exception("The uploaded file could not be stored. Please try again later.");
+			throw new Exception(__("The uploaded file could not be stored. Please try again later."));
 		}
 		return true;
 	}