From 452e1e2a8ada64e3e1e4616ff99edd18c3e322e4 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Wed, 21 Aug 2019 01:51:24 -0600 Subject: [PATCH] Update and rename fileread.php to file_read.php --- app/edit/{fileread.php => file_read.php} | 48 +++++++++++++----------- 1 file changed, 27 insertions(+), 21 deletions(-) rename app/edit/{fileread.php => file_read.php} (60%) diff --git a/app/edit/fileread.php b/app/edit/file_read.php similarity index 60% rename from app/edit/fileread.php rename to app/edit/file_read.php index 95a3424d97..b4570a3f81 100644 --- a/app/edit/fileread.php +++ b/app/edit/file_read.php @@ -17,33 +17,39 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2012 + Portions created by the Initial Developer are Copyright (C) 2008-2019 the Initial Developer. All Rights Reserved. Contributor(s): Mark J Crane */ -include "root.php"; -require_once "resources/require.php"; -require_once "resources/check_auth.php"; -if (permission_exists('script_editor_view')) { - //access granted -} -else { - echo "access denied"; - exit; -} -$filename = $_POST["file"]; -$filename = str_replace ("\\", "/", $filename); +//includes + include "root.php"; + require_once "resources/require.php"; + require_once "resources/check_auth.php"; -$handle = fopen($filename, "r"); -if ($handle) { - while (!feof($handle)) { - $buffer = fgets($handle, 4096); - echo $buffer; +//check permissions + if (permission_exists('edit_view')) { + //access granted + } + else { + echo "access denied"; + exit; } - fclose($handle); -} -?> \ No newline at end of file +//get the file name + $file_name = $_POST["file"]; + $file_name = str_replace ("\\", "/", $filename); + +//get the contents of the file + $handle = fopen($file_name, "r"); + if ($handle) { + while (!feof($handle)) { + $buffer = fgets($handle, 4096); + echo $buffer; + } + fclose($handle); + } + +?>