From 990a2a4247332ff5853060171f597840924aa2b2 Mon Sep 17 00:00:00 2001 From: Alan Garcia Date: Fri, 10 Jan 2014 15:54:18 +0000 Subject: [PATCH] Simplifie le code d'enregistrement des fichiers de l'editeur --- bureau/admin/bro_editor.php | 4 ++-- bureau/class/m_bro.php | 6 +----- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/bureau/admin/bro_editor.php b/bureau/admin/bro_editor.php index 471e381c..aae04035 100644 --- a/bureau/admin/bro_editor.php +++ b/bureau/admin/bro_editor.php @@ -51,7 +51,7 @@ if (isset($cancel) && $cancel) { } if (isset($saveret) && $saveret) { - if ($bro->Save($editfile,$R,$texte)) { + if ($bro->save($editfile,$R,$texte)) { $error=sprintf(_("Your file %s has been saved"),$editfile)." (".format_date(_('%3$d-%2$d-%1$d %4$d:%5$d'),date("Y-m-d H:i:s")).")"; } else { $error=$err->errstr(); @@ -60,7 +60,7 @@ if (isset($saveret) && $saveret) { exit(); } if (isset($save) && $save) { - if ($bro->Save($editfile,$R,$texte)) { + if ($bro->save($editfile,$R,$texte)) { $error=sprintf(_("Your file %s has been saved"),$editfile)." (".format_date(_('%3$d-%2$d-%1$d %4$d:%5$d'),date("Y-m-d H:i:s")).")"; } else { $error=$err->errstr(); diff --git a/bureau/class/m_bro.php b/bureau/class/m_bro.php index d1a88d0e..5cd8b6b7 100644 --- a/bureau/class/m_bro.php +++ b/bureau/class/m_bro.php @@ -887,11 +887,7 @@ class m_bro { if (!strpos($file,"/")) { $absolute.="/".$file; if (file_exists($absolute)) { - $f=@fopen($absolute,"wb"); - if ($f) { - fputs($f,$texte,strlen($texte)); - fclose($f); - } else { + if (! file_put_contents($absolute, $texte ) ) { $err->raise("bro",_("Cannot edit the requested file. Please check the permissions")); return false; }