"); }; } // If we're due to open a file... if ("load" === $_GET['action']) { echo 'action="load";'; $lineNumber = max(isset($_REQUEST['lineNumber']) ? intval($_REQUEST['lineNumber']) : 1, 1); // Check this file isn't on the banned list at all $canOpen = true; for ($i = 0; $i < count($_SESSION['bannedFiles']); $i++) { if ("" !== str_replace("*", "", $_SESSION['bannedFiles'][$i]) && false !== strpos($file, str_replace("*", "", $_SESSION['bannedFiles'][$i]))) { $canOpen = false; } } if (false === $canOpen) { echo 'fileType="nothing"; parent.parent.ICEcoder.message(\'' . $t['Sorry, could not...'] . ' ' . $fileLoc . "/" . $fileName . '\');'; } elseif (isset($ftpSite) || file_exists($file)) { $finfo = "text"; // Determine what to do based on mime type if (!isset($ftpSite) && function_exists('finfo_open')) { $finfoMIME = finfo_open(FILEINFO_MIME); $finfo = finfo_file($finfoMIME, $file); finfo_close($finfoMIME); } else { $fileExt = explode(" ", pathinfo($file, PATHINFO_EXTENSION)); $fileExt = $fileExt[0]; if (false !== array_search($fileExt, ["gif", "jpg", "jpeg", "png"])) { $finfo = "image"; }; if (false !== array_search($fileExt, ["doc", "docx", "ppt", "rtf", "pdf", "zip", "tar", "gz", "swf", "asx", "asf", "midi", "mp3", "wav", "aiff", "mov", "qt", "wmv", "mp4", "odt", "odg", "odp"])) { $finfo = "other"; }; } if (0 === strpos($finfo, "text") || 0 === strpos($finfo, "application/xml") || false !== strpos($finfo, "empty")) { echo 'fileType="text";'; echo 'parent.parent.ICEcoder.shortURL = parent.parent.ICEcoder.thisFileFolderLink = "' . $fileLoc . "/" . $fileName . '";'; // Get file over FTP? if (isset($ftpSite)) { ftpStart(); // Show user warning if no good connection if (!$ftpConn || !$ftpLogin) { die('parent.parent.ICEcoder.message("Sorry, no FTP connection to ' . $ftpHost . ' for user ' . $ftpUser . '");parent.parent.ICEcoder.serverMessage();parent.parent.ICEcoder.serverQueue("del",0);'); } // Get our file contents and close the FTP connection $loadedFile = toUTF8noBOM(ftpGetContents($ftpConn, $ftpRoot . $fileLoc . "/" . $fileName, $ftpMode), false); ftpEnd(); // Get local file } else { $loadedFile = toUTF8noBOM(getData($file), true); } $encoding = ini_get("default_charset"); if ("" == $encoding) { $encoding = "UTF-8"; } // Get content and set HTML entities on it according to encoding $loadedFile = htmlentities($loadedFile, ENT_COMPAT, $encoding); // Remove \r chars and replace \n with carriage return HTML entity char $loadedFile = preg_replace('/\\r/', '', $loadedFile); $loadedFile = preg_replace('/\\n/', ' ', $loadedFile); echo '