Browse Source

Database errors are not nice, used a fatal_lang_error when a smiley set is not found

Signed-off-by: emanuele <[email protected]>
emanuele 12 years ago
parent
commit
777cecec77
2 changed files with 6 additions and 2 deletions
  1. 4 1
      Sources/ManageSmileys.php
  2. 2 1
      Themes/default/languages/Errors.english.php

+ 4 - 1
Sources/ManageSmileys.php

@@ -323,6 +323,9 @@ function EditSmileySets()
 				}
 				$dir->close();
 
+				if (empty($smileys))
+					fatal_lang_error('smiley_set_dir_not_found', false, array($context['current_set']['name']));
+
 				// Exclude the smileys that are already in the database.
 				$request = $smcFunc['db_query']('', '
 					SELECT filename
@@ -1833,4 +1836,4 @@ function sortSmileyTable()
 	$smcFunc['db_remove_column']('{db_prefix}smileys', 'temp_order');
 }
 
-?>
+?>

+ 2 - 1
Themes/default/languages/Errors.english.php

@@ -259,6 +259,7 @@ $txt['smiley_has_no_filename'] = 'No filename for this smiley was given.';
 $txt['smiley_not_unique'] = 'A smiley with that code already exists.';
 $txt['smiley_set_already_exists'] = 'A smiley set with that URL already exists';
 $txt['smiley_set_not_found'] = 'Smiley set not found';
+$txt['smiley_set_dir_not_found'] = 'The directory of the smiley set %1$s is either invalid or cannot be accessed';
 $txt['smiley_set_path_already_used'] = 'The URL of the smiley set is already being used by another smiley set.';
 $txt['smiley_set_unable_to_import'] = 'Unable to import smiley set. Either the directory is invalid or cannot be accessed.';
 
@@ -412,4 +413,4 @@ $txt['restore_not_found'] = 'The following messages could not be restored; the o
 $txt['error_invalid_dir'] = 'The directory you entered is invalid.';
 
 $txt['error_sqlite_optimizing'] = 'Sqlite is optimizing the database, the forum can not be accessed until it has finished.  Please try refreshing this page momentarily.';
-?>
+?>