Simplifie le code d'enregistrement des fichiers de l'editeur

This commit is contained in:
Alan Garcia 2014-01-10 15:54:18 +00:00
parent 7b2f399d72
commit 990a2a4247
2 changed files with 3 additions and 7 deletions

View File

@ -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();

View File

@ -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;
}