Update and rename fileread.php to file_read.php

This commit is contained in:
FusionPBX 2019-08-21 01:51:24 -06:00 committed by GitHub
parent c577d887e9
commit 452e1e2a8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 27 additions and 21 deletions

View File

@ -17,33 +17,39 @@
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
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 <markjcrane@fusionpbx.com>
*/
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);
}
?>
//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);
}
?>