From 98c7158ec08f206c023672013648a9c96003b67e Mon Sep 17 00:00:00 2001 From: patdenice Date: Mon, 22 Mar 2010 12:42:42 +0000 Subject: [LocalFiles Editor] Only webmasters can create or modify local files. git-svn-id: http://piwigo.org/svn/trunk@5256 68402e56-0260-453c-a942-63ccdbb3a9ee --- plugins/LocalFilesEditor/admin.php | 59 ++++++++++++---------- .../language/de_DE/plugin.lang.php | 1 + .../language/en_UK/plugin.lang.php | 1 + .../language/es_ES/plugin.lang.php | 1 + .../language/fr_FR/plugin.lang.php | 1 + .../language/hu_HU/plugin.lang.php | 1 + .../language/it_IT/plugin.lang.php | 1 + .../language/pl_PL/plugin.lang.php | 1 + 8 files changed, 40 insertions(+), 26 deletions(-) (limited to 'plugins') diff --git a/plugins/LocalFilesEditor/admin.php b/plugins/LocalFilesEditor/admin.php index 4f4dca03c..0b000f2ab 100644 --- a/plugins/LocalFilesEditor/admin.php +++ b/plugins/LocalFilesEditor/admin.php @@ -294,38 +294,45 @@ if (isset($_POST['restore']) and !is_adviser()) // +-----------------------------------------------------------------------+ if (isset($_POST['submit']) and !is_adviser()) { - $edited_file = $_POST['edited_file']; - $content_file = stripslashes($_POST['text']); - if (get_extension($edited_file) == 'php') - { - $content_file = eval_syntax($content_file); - } - if ($content_file === false) - { - array_push($page['errors'], l10n('locfiledit_syntax_error')); + if ($user['status'] != 'webmaster') + { + array_push($page['errors'], l10n('locfiledit_webmaster_only')); } - else - { - if ($page['tab'] == 'plug' and !is_dir(PHPWG_PLUGINS_PATH . 'PersonalPlugin')) + else + { + $edited_file = $_POST['edited_file']; + $content_file = stripslashes($_POST['text']); + if (get_extension($edited_file) == 'php') { - @mkdir(PHPWG_PLUGINS_PATH . "PersonalPlugin"); + $content_file = eval_syntax($content_file); } - if (file_exists($edited_file)) + if ($content_file === false) { - @copy($edited_file, get_bak_file($edited_file)); - array_push($page['infos'], sprintf(l10n('locfiledit_saved_bak'), substr(get_bak_file($edited_file), 2))); + array_push($page['errors'], l10n('locfiledit_syntax_error')); } - - if ($file = @fopen($edited_file , "w")) - { - @fwrite($file , $content_file); - @fclose($file); - array_unshift($page['infos'], l10n('locfiledit_save_config')); - $template->delete_compiled_templates(); - } - else + else { - array_push($page['errors'], l10n('locfiledit_cant_save')); + if ($page['tab'] == 'plug' and !is_dir(PHPWG_PLUGINS_PATH . 'PersonalPlugin')) + { + @mkdir(PHPWG_PLUGINS_PATH . "PersonalPlugin"); + } + if (file_exists($edited_file)) + { + @copy($edited_file, get_bak_file($edited_file)); + array_push($page['infos'], sprintf(l10n('locfiledit_saved_bak'), substr(get_bak_file($edited_file), 2))); + } + + if ($file = @fopen($edited_file , "w")) + { + @fwrite($file , $content_file); + @fclose($file); + array_unshift($page['infos'], l10n('locfiledit_save_config')); + $template->delete_compiled_templates(); + } + else + { + array_push($page['errors'], l10n('locfiledit_cant_save')); + } } } } diff --git a/plugins/LocalFilesEditor/language/de_DE/plugin.lang.php b/plugins/LocalFilesEditor/language/de_DE/plugin.lang.php index 07ea09c4b..0481935d4 100644 --- a/plugins/LocalFilesEditor/language/de_DE/plugin.lang.php +++ b/plugins/LocalFilesEditor/language/de_DE/plugin.lang.php @@ -52,5 +52,6 @@ $lang['locfiledit_filename_error'] = 'Verbotene Zeichen im Dateinamen.'; $lang['locfiledit_file_already_exists'] = 'Datei ist bereits vorhanden.'; $lang['locfiledit_model_error'] = 'Sie müssen ein Modell wählen.'; $lang['locfiledit_empty_filename'] = 'Sie müssen einen Dateiname eingeben.'; +/* TODO */ $lang['locfiledit_webmaster_only'] = 'Only webmasters can create or modify local files.'; ?> \ No newline at end of file diff --git a/plugins/LocalFilesEditor/language/en_UK/plugin.lang.php b/plugins/LocalFilesEditor/language/en_UK/plugin.lang.php index 502cb0fc2..680008fd9 100644 --- a/plugins/LocalFilesEditor/language/en_UK/plugin.lang.php +++ b/plugins/LocalFilesEditor/language/en_UK/plugin.lang.php @@ -52,5 +52,6 @@ $lang['locfiledit_filename_error'] = 'Forbidden caraters in file name.'; $lang['locfiledit_file_already_exists'] = 'File already exists.'; $lang['locfiledit_model_error'] = 'You must choose a model.'; $lang['locfiledit_empty_filename'] = 'You must fill file name.'; +$lang['locfiledit_webmaster_only'] = 'Only webmasters can create or modify local files.'; ?> \ No newline at end of file diff --git a/plugins/LocalFilesEditor/language/es_ES/plugin.lang.php b/plugins/LocalFilesEditor/language/es_ES/plugin.lang.php index 808e6c10f..56c512025 100644 --- a/plugins/LocalFilesEditor/language/es_ES/plugin.lang.php +++ b/plugins/LocalFilesEditor/language/es_ES/plugin.lang.php @@ -52,5 +52,6 @@ $lang['locfiledit_filename_error'] = 'Carácteres prohibidos en el nombre del fi $lang['locfiledit_file_already_exists'] = 'El fichero ya existe.'; $lang['locfiledit_model_error'] = 'Por favor, seleccione un modelo.'; /* TODO */ $lang['locfiledit_empty_filename'] = 'Por favor, indique un nombre de fichero.'; +/* TODO */ $lang['locfiledit_webmaster_only'] = 'Only webmasters can create or modify local files.'; ?> \ No newline at end of file diff --git a/plugins/LocalFilesEditor/language/fr_FR/plugin.lang.php b/plugins/LocalFilesEditor/language/fr_FR/plugin.lang.php index 3fcc4e3f8..8ac03e02a 100644 --- a/plugins/LocalFilesEditor/language/fr_FR/plugin.lang.php +++ b/plugins/LocalFilesEditor/language/fr_FR/plugin.lang.php @@ -52,5 +52,6 @@ $lang['locfiledit_filename_error'] = 'Caractères interdits dans le nom du fichi $lang['locfiledit_file_already_exists'] = 'Le fichier existe déjà.'; $lang['locfiledit_model_error'] = 'Veuillez sélectionner un modèle.'; $lang['locfiledit_empty_filename'] = 'Veuillez indiquer un nom de fichier.'; +$lang['locfiledit_webmaster_only'] = 'Seuls les webmasters sont autorisés à créer ou modifier les fichiers locaux.'; ?> \ No newline at end of file diff --git a/plugins/LocalFilesEditor/language/hu_HU/plugin.lang.php b/plugins/LocalFilesEditor/language/hu_HU/plugin.lang.php index c7aaa7a7d..b7582cae4 100644 --- a/plugins/LocalFilesEditor/language/hu_HU/plugin.lang.php +++ b/plugins/LocalFilesEditor/language/hu_HU/plugin.lang.php @@ -52,5 +52,6 @@ $lang['locfiledit_filename_error'] = 'Nem használható fájlnév vagy karakter. $lang['locfiledit_file_already_exists'] = 'Ilyen fájl már létezik.'; $lang['locfiledit_model_error'] = 'A típust ki kell választani.'; $lang['locfiledit_empty_filename'] = 'A fájlnevet ki kell tölteni.'; +/* TODO */ $lang['locfiledit_webmaster_only'] = 'Only webmasters can create or modify local files.'; ?> diff --git a/plugins/LocalFilesEditor/language/it_IT/plugin.lang.php b/plugins/LocalFilesEditor/language/it_IT/plugin.lang.php index f43d06a6b..63695bbaf 100644 --- a/plugins/LocalFilesEditor/language/it_IT/plugin.lang.php +++ b/plugins/LocalFilesEditor/language/it_IT/plugin.lang.php @@ -52,5 +52,6 @@ $lang['locfiledit_filename_error'] = 'Caratteri vietati nel nome del file.'; $lang['locfiledit_file_already_exists'] = 'Il file esiste già.'; $lang['locfiledit_model_error'] = 'Selezionare un modello.'; $lang['locfiledit_empty_filename'] = 'Indicate un nome di file.'; +/* TODO */ $lang['locfiledit_webmaster_only'] = 'Only webmasters can create or modify local files.'; ?> \ No newline at end of file diff --git a/plugins/LocalFilesEditor/language/pl_PL/plugin.lang.php b/plugins/LocalFilesEditor/language/pl_PL/plugin.lang.php index 97550122c..14ec3f012 100644 --- a/plugins/LocalFilesEditor/language/pl_PL/plugin.lang.php +++ b/plugins/LocalFilesEditor/language/pl_PL/plugin.lang.php @@ -52,5 +52,6 @@ $lang['locfiledit_filename_error'] = 'Plik zawiera niedozwolone znaki.'; $lang['locfiledit_file_already_exists'] = 'Plik już istnieje.'; $lang['locfiledit_model_error'] = 'Musisz wybrać model.'; $lang['locfiledit_empty_filename'] = 'Musisz wpisać nazwę pliku.'; +/* TODO */ $lang['locfiledit_webmaster_only'] = 'Only webmasters can create or modify local files.'; ?> \ No newline at end of file -- cgit v1.2.3