Prechádzať zdrojové kódy

Error checks and some error strings.

Signed-off-by: Suki <[email protected]>
Suki 11 rokov pred
rodič
commit
507818e09a

+ 9 - 0
Sources/Themes.php

@@ -1321,7 +1321,16 @@ function ThemeInstall()
 
 function InstallFile()
 {
+	global $txt;
+
+	$result = array();
+
 	// Such pessimist, looking for errors first, nah, just cautious :P
+	if (!isset($_FILES) || (empty($_FILES['theme_gz']) || !empty($_REQUEST['theme_gz']))
+
+	// Another error check layer.
+	if (isset($_FILES['theme_gz']['error']) && $_FILES['theme_gz']['error'] != 0)
+		$result['message'] =  $txt['theme_install_error_file_'. $_FILES['theme_gz']['error']];
 
 }
 

+ 6 - 0
Themes/default/languages/Themes.english.php

@@ -27,6 +27,12 @@ $txt['theme_installed_message'] = 'was installed successfully.';
 $txt['theme_updated_message'] = 'was updated successfully.';
 $txt['theme_install_no_action'] = 'This isn\'t a valid install action.';
 $txt['theme_install_error_title'] = 'An error occurred while installing the theme.';
+$txt['theme_install_error_file_1'] = 'The uploaded file exceeds the upload_max_filesize directive in php.ini.';
+$txt['theme_install_error_file_2'] = 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.';
+$txt['theme_install_error_file_3'] = 'The uploaded file was only partially uploaded.';
+$txt['theme_install_error_file_4'] = 'No file was uploaded.';
+$txt['theme_install_error_file_6'] = 'Missing a temporary upload folder.';
+$txt['theme_install_error_file_7'] = 'Failed to write file to disk.';
 
 
 $txt['theme_latest'] = 'Latest and Greatest Themes';