Андрей (andy) wrote in changelog,
Андрей
andy
changelog

[livejournal] r23493: LJSUP-14679 ([internal] disable fileedit...

Committer: ailyin
LJSUP-14679 ([internal] disable fileedit for local files)
U   trunk/htdocs/admin/fileedit/index.bml
Modified: trunk/htdocs/admin/fileedit/index.bml
===================================================================
--- trunk/htdocs/admin/fileedit/index.bml	2012-12-21 12:10:42 UTC (rev 23492)
+++ trunk/htdocs/admin/fileedit/index.bml	2012-12-21 12:36:33 UTC (rev 23493)
@@ -34,9 +34,11 @@
          return 1;
      }
 
-     open (FILE, ">$INC_DIR/$filename") or return 0;
-     print FILE $content;
-     close FILE;
+     unless ( LJ::is_enabled('fileedit_local') ) {
+         return 0;
+     }
+
+     File::Slurp::write_file( "$INC_DIR/$filename", $content );
      return 1;
  };
 
@@ -52,10 +54,7 @@
          return $contents if defined $contents;
      }
 
-     open (FILE, "$INC_DIR/$filename") or return undef;
-     while (<FILE>) { $contents .= $_; }
-     close FILE;
-     return $contents;
+     return File::Slurp::read_file("$INC_DIR/$filename");
  };
 
  if ($files{'*'}) 

Tags: ailyin, andy, bml, livejournal
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments