$error = true; $errorStr = "true"; $errorMsg = "Sorry! - problem with file requested"; } } // ============ // SAVING FILES // ============ if (!$error && $_GET['action'] == "save") { // ==================================== // NEW FILES AND SAVE AS XHR LOOPAROUND // ==================================== if (strpos($fileOrig, "[NEW]") > 0 || $saveType == "saveAs") { $finalAction = strpos($fileOrig, "[NEW]") > 0 ? "save as" : "save"; $fileURL = isset($file) ? $file : ""; $fileMDTURLPart = isset($_GET["fileMDT"]) && $_GET["fileMDT"] != "undefined" ? "&fileMDT=" . numClean($_GET['fileMDT']) : ""; $doNext = ' top.ICEcoder.serverMessage(); fileLoc = "' . $fileLoc . '"; newFileName = top.ICEcoder.getInput("' . $t['Enter filename to...'] . ' "+(fileLoc!="" ? fileLoc : "/"),""); if (newFileName) { if (newFileName.substr(0,1)!="/") {newFileName = "/" + newFileName}; newFileName = fileLoc + newFileName; if (top.document.getElementById("filesFrame").contentWindow.document.getElementById(newFileName.replace(/\\\\//g,"|"))) { overwriteOK = top.ICEcoder.ask("' . $t['That file exists...'] . '"); } }; if ("undefined" == typeof newFileName || (newFileName && "undefined" == typeof overwriteOK) || ("undefined" != typeof overwriteOK && overwriteOK)) { newFileName = "' . $docRoot . '" + newFileName; saveURL = "lib/file-control-xhr.php?action=save' . $fileMDTURLPart . '&csrf=' . $_GET["csrf"] . '";
if (isset($ftpSite)) { $ftpFilepath = ltrim($fileLoc . "/" . $fileName, "/"); if (!ftpPerms($ftpConn, octdec(numClean($_GET['perms'])), $ftpFilepath)) { $doNext .= 'top.ICEcoder.message("Sorry, could not set perms on ' . $ftpFilepath . ' at ' . $ftpHost . '");'; } else { $updateFM = true; } // Local } else { chmod($file, octdec(numClean($_GET['perms']))); // Reload file manager $updateFM = true; } // Update file manager on success if ($updateFM) { $doNext .= 'top.ICEcoder.updateFileManagerList(\'chmod\',\'' . $fileLoc . '\',\'' . $fileName . '\',\'' . numClean($_GET['perms']) . '\');'; } $finalAction = "perms"; // Run our custom processes include_once "../processes/on-file-dir-perms.php"; } else { $finalAction = "nothing"; $doNext .= "top.ICEcoder.message('" . $t['Sorry, cannot change...'] . " \\n" . strClean($file) . "');"; } $doNext .= 'top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);'; } // ==================== // CHECK FOR A FILE/DIR // ==================== if (!isset($ftpSite) && !$error && $_GET['action'] == "checkExists") { // This action is called under seperate AJAX call and the responseText object stored in top.ICEcoder.lastFileDirCheckStatusObj
<?php include "headers.php"; include "settings.php"; $t = $text['github-manager']; // If we have an action to perform if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset($_GET['action'])) { // Get our old paths & user settings $oldLocal = $ICEcoder["githubLocalPaths"]; $oldRemote = $ICEcoder["githubRemotePaths"]; $settingsContents = file_get_contents($settingsFile, false, $context); // ======== // CHOOSING // ======== if ($_GET['action'] == "choose") { $pathPair = numClean($_GET['pathPair']); $chosenLocal = $oldLocal[$pathPair]; $chosenRemote = $oldRemote[$pathPair]; $pathValid = false; if (!is_dir($docRoot . $chosenLocal)) { if (is_writable($docRoot)) { mkdir($docRoot . $chosenLocal, octdec($ICEcoder['newDirPerms'])); } else { echo "<script>top.ICEcoder.message('" . $t['Sorry, cannot create...'] . "\\n" . $chosenLocal . "');</script>"; } } if (is_dir($docRoot . $chosenLocal)) { $pathValid = true; } if ($pathValid) { // New setting for the root path
"<input type=\"text\" id=\"hexMouseXY\" style=\"border: 1px solid #888; border-right: 0; width: 70px\" onmouseover=\"top.ICEcoder.overPopup=true\" onmouseout=\"top.ICEcoder.overPopup=false\"></input>" + "<input type=\"text\" id=\"rgbMouseXY\" style=\"border: 1px solid #888; margin-right: 10px; width: 70px\" onmouseover=\"top.ICEcoder.overPopup=true\" onmouseout=\"top.ICEcoder.overPopup=false\"></input>" + "<input type=\"text\" id=\"hex\" style=\"border: 1px solid #888; border-right: 0; width: 70px\" onmouseover=\"top.ICEcoder.overPopup=true\" onmouseout=\"top.ICEcoder.overPopup=false\"></input>" + "<input type=\"text\" id=\"rgb\" style=\"border: 1px solid #888; width: 70px\" onmouseover=\"top.ICEcoder.overPopup=true\" onmouseout=\"top.ICEcoder.overPopup=false\"></input>"; } top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0); } </script> <form name="saveFile" action="file-control.php?action=save&file=<?php if (isset($file)) { echo $file; } if (isset($_GET['fileMDT']) && $_GET['fileMDT'] != "undefined") { echo "&fileMDT=" . numClean($_GET['fileMDT']); } ?> " method="POST"> <textarea name="contents"></textarea> <input type="hidden" name="newFileName" value=""> <input type="hidden" name="csrf" value="<?php echo $_SESSION["csrf"]; ?> "> </form> <script> if (action=="save") { <?php if (strpos($file, "[NEW]") > 0 || $saveType == "saveAs") {
// ==================== if (!isset($ftpSite) && !$error && $_GET['action'] == "checkExists") { // This action is called under seperate AJAX call and the responseText object stored in top.ICEcoder.lastFileDirCheckStatusObj // Nothing really done here though, we do something with the responseText $finalAction = "checkExists"; $doNext .= 'top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);'; } // =================== // JSON DATA TO RETURN // =================== // No $filemtime yet? Get it now! if (!isset($filemtime) && !is_dir($file)) { $filemtime = $serverType == "Linux" ? filemtime($file) : "1000000"; } // Set $timeStart, use 0 if not available $timeStart = isset($_POST["timeStart"]) ? numClean($_POST["timeStart"]) : 0; if (isset($ftpSite)) { // Get info on dir/file now $ftpFileDirInfo = ftpGetFileInfo($ftpConn, ltrim($fileLoc, "/"), $fileName); // End the connection ftpEnd(); // Then set info $itemAbsPath = $ftpRoot . $fileLoc . '/' . $fileName; $itemPath = dirname($ftpRoot . $fileLoc . '/' . $fileName); $itemBytes = $ftpFileDirInfo['size']; $itemType = isset($ftpFileDirInfo['type']) ? $ftpFileDirInfo['type'] == "directory" ? "dir" : "file" : "unknown"; $itemExists = isset($ftpFileDirInfo['type']) ? "true" : "false"; } else { $itemAbsPath = $file; $itemPath = dirname($file); $itemBytes = is_dir($file) ? null : filesize($file);
><?php echo $t['ASCII transfer']; ?> </option> <option value="FTP_BINARY"<?php echo isset($_GET['action']) && $_GET['action'] == "edit" && $ICEcoder['ftpSites'][$_GET['ftpSiteRef']]['mode'] == "FTP_BINARY" ? " selected" : ""; ?> ><?php echo $t['Binary transfer']; ?> </option> </select> </td> <td style="padding: 0 0 8px 0"><input type="text" name="ftpRootNEW" value="<?php if (isset($_GET['action']) && $_GET['action'] == "edit") { echo $ICEcoder['ftpSites'][numClean($_GET['ftpSiteRef'])]['root']; } ?> " style="width: 272px"></td> </tr> <tr> <td colspan="2" style="padding: 3px 0 8px 0; text-align: right"><div style="display: inline-block; padding: 5px; background: #2187e7; color: #fff; font-size: 12px; cursor: pointer" onclick="document.getElementById('ftpAddEditForm').submit()"><?php echo isset($_GET['action']) && $_GET['action'] == "edit" ? $t['Update'] : $t['Add']; ?> </div></td> </tr> </table> <input type="hidden" name="csrf" value="<?php echo $_SESSION["csrf"]; ?> ">