diff --git a/lib/file-control.php b/lib/file-control.php
index 9bc677e..3a54eab 100644
--- a/lib/file-control.php
+++ b/lib/file-control.php
@@ -14,7 +14,7 @@ $file = str_replace("|","/",strClean(
$file = rtrim(rtrim($file,'+'),' ');
// Make $file a full path and establish the $fileLoc and $fileName
-if (strpos($file,$docRoot)===false) {$file=str_replace("|","/",$docRoot.$iceRoot.$file);};
+if (strpos($file,$docRoot)===false && $_GET['action']!="getRemoteFile") {$file=str_replace("|","/",$docRoot.$iceRoot.$file);};
$fileLoc = substr(str_replace($docRoot,"",$file),0,strrpos(str_replace($docRoot,"",$file),"/"));
$fileName = basename($file);
@@ -51,6 +51,21 @@ if ($_GET['action']=="load") {
};
+// Get the contents of a remote URL
+if ($_GET['action']=="getRemoteFile") {
+ if ($remoteFile = file_get_contents($file)) {
+ // replace \r\n (Windows) and \r (old Mac) line endings with \n (Linux)
+ $remoteFile = str_replace("\r\n", "\n", $remoteFile);
+ $remoteFile = str_replace("\r", "\n", $remoteFile);
+ echo '';
+ echo '","",str_replace("&","&",$remoteFile)).'';
+ echo '';
+ } else {
+ echo '';
+ }
+ echo '';
+}
+
// If we're due to add a new folder...
if ($_GET['action']=="newFolder") {
if (!$demoMode && is_writable($docRoot.$fileLoc)) {