Remove FTP functionality & UI from ICEcoder

This commit is contained in:
mattpass
2020-12-30 14:57:37 +00:00
parent 2e7e5a8bcd
commit bc589549f3
28 changed files with 77 additions and 1096 deletions

View File

@@ -1,16 +0,0 @@
body {overflow: hidden;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
h1 {font-size: 36px; font-weight: normal; color: #888; margin-bottom: 20px}
a {color: #2187e7; text-decoration: none}
input {padding: 4px; border: 0; background-color: #444; color: #fff}
select {padding: 3px 4px; border: 0; background-color: #444; color: #fff}
input:focus {outline: none; background: rgba(0,198,255,0.5); color: #fff}
select:focus {outline: none}
.ftpManager {background-color: #1c1c19; color: #fff; padding: 20px}
.ftpManager .info {font-size: 10px; color: rgba(0,198,255,0.7); cursor: help}

View File

@@ -3672,21 +3672,6 @@ var ICEcoder = {
this.showHide('show', get('blackMask'));
},
// Go to localhost root
goLocalhostRoot: function() {
this.filesFrame.contentWindow.frames['fileControl'].location.href =
this.iceLoc +
"/lib/go-localhost-root.php";
},
// Show the FTP manager
ftpManager: function() {
get('mediaContainer').innerHTML = '<iframe src="' +
this.iceLoc +
'/lib/ftp-manager.php" id="ftpManagerIFrame" style="width: 620px; height: 550px"></iframe>';
this.showHide('show', get('blackMask'));
},
// Update the settings used when we make a change to them
useNewSettings: function(settings) {
let styleNode, thisCSS, strCSS, activeLineBG;

View File

@@ -14,13 +14,13 @@ class Backup
}
public function makeBackup($fileLoc, $fileName, $contents) {
global $ftpSite, $t, $ICEcoder;
global $t, $ICEcoder;
$backupDirFormat = "Y-m-d";
// Establish the base, host and date dir parts...
$backupDirBase = str_replace("\\", "/", dirname(__FILE__)) . "/../data/backups/";
$backupDirHost = isset($ftpSite) ? parse_url($ftpSite, PHP_URL_HOST) : "localhost";
$backupDirHost = "localhost";
$backupDirDate = date($backupDirFormat);
// Establish an array of dirs from base to our file location

View File

@@ -1,188 +0,0 @@
<?php declare(strict_types=1);
namespace ICEcoder;
use ICEcoder\System;
class FTP
{
private $systemClass;
public function __construct()
{
$this->systemClass = new System();
}
public function writeFile() {
global $fileLoc, $fileName, $ftpConn, $ftpRoot, $ftpHost, $ftpMode, $ICEcoder, $doNext, $filemtime, $tabNum;
$ftpFilepath = ltrim($fileLoc . "/" . $fileName, "/");
if (isset($_POST['changes'])) {
// Get existing file contents as lines
$loadedFile = toUTF8noBOM($this->ftpGetContents($ftpConn, $ftpRoot . $fileLoc . "/" . $fileName, $ftpMode), false);
$fileLines = explode("\n", str_replace("\r", "", $loadedFile));
// Need to add a new line at the end of each because explode will lose them,
// want want to end up with same array that 'file($file)' produces for a local file
// - it keeps the line endings at the end of each array item
for ($i = 0; $i < count($fileLines); $i++) {
if ($i < count($fileLines) - 1) {
$fileLines[$i] .= $ICEcoder["lineEnding"];
}
}
// Stitch changes onto it
$contents = $this->systemClass->stitchChanges($fileLines, $_POST['changes']);
// get old file contents and count stats on usage \n and \r there
// in this case we can keep line endings, which file had before, without
// making code version control systems going crazy about line endings change in whole file.
$unixNewLines = preg_match_all('/[^\r][\n]/u', $loadedFile);
$windowsNewLines = preg_match_all('/[\r][\n]/u', $loadedFile);
} else {
$contents = $_POST['contents'];
}
// replace \r\n (Windows), \r (old Mac) and \n (Linux) line endings with whatever we chose to be lineEnding
$contents = str_replace("\r\n", $ICEcoder["lineEnding"], $contents);
$contents = str_replace("\r", $ICEcoder["lineEnding"], $contents);
$contents = str_replace("\n", $ICEcoder["lineEnding"], $contents);
if (isset($_POST['changes']) && ($unixNewLines > 0) || ($windowsNewLines > 0)) {
if ($unixNewLines > $windowsNewLines){
$contents = str_replace($ICEcoder["lineEnding"], "\n", $contents);
} elseif ($windowsNewLines > $unixNewLines){
$contents = str_replace($ICEcoder["lineEnding"], "\r\n", $contents);
}
}
// Write our file contents
if (!$this->ftpWriteFile($ftpConn, $ftpFilepath, $contents, $ftpMode)) {
$doNext .= 'ICEcoder.message("Sorry, could not write ' . $ftpFilepath . ' at ' . $ftpHost . '");';
} else {
$doNext .= 'ICEcoder.openFileMDTs[' . ($tabNum - 1) .']="' . $filemtime . '";';
$doNext .= '(function() {var x = ICEcoder.openFileVersions; var y = ' . ($tabNum - 1) .'; x[y] = "undefined" != typeof x[y] ? x[y] + 1 : 1})(); ICEcoder.updateVersionsDisplay();';
}
}
// Start a FTP connection
function ftpStart()
{
global $ftpConn, $ftpLogin, $ftpHost, $ftpUser, $ftpPass, $ftpPasv;
// Establish connection, login and maybe use pasv
$ftpConn = ftp_connect($ftpHost);
$ftpLogin = ftp_login($ftpConn, $ftpUser, $ftpPass);
if ($ftpPasv) {
ftp_pasv($ftpConn, true);
}
}
// End a FTP connection
function ftpEnd()
{
global $ftpConn;
ftp_close($ftpConn);
}
// Get dir/file lists (simple and detailed) from FTP detailed rawlist response
function ftpGetList($ftpConn, $directory = '.')
{
$simpleList = $detailedList = array();
// If we have a FTP rawlist to work with
if (is_array($rows = @ftp_rawlist($ftpConn, $directory))) {
foreach ($rows as $row) {
// Split row up by spaces and set keys on $item array
$chunks = preg_split("/\s+/", $row);
list($item['rights'], $item['number'], $item['user'], $item['group'], $item['size'], $item['month'], $item['day'], $item['time']) = $chunks;
// Also set if this is a dir or file
$item['type'] = $chunks[0][0] === 'd' ? 'directory' : 'file';
// Splice the array and finally work out $simpleList and $detailedList
array_splice($chunks, 0, 8);
$detailedList[implode(" ", $chunks)] = $item;
$simpleList[] = implode(" ", $chunks);
}
// Return simple array list and detailed items list also
return array('simpleList' => $simpleList, 'detailedList' => $detailedList);
}
return false;
}
// Get detailed info on a file from returned info from ftpGetList
function ftpGetFileInfo($ftpConn, $directory = '.', $fileName)
{
// Get both sets of arrays back and get our detailed list
$ftpListArrays = $this->ftpGetList($ftpConn, $directory);
$detailedList = $ftpListArrays['detailedList'];
// Now get the file info for our file
$fileInfo = $detailedList[$fileName];
// Return the info
return $fileInfo;
}
// Get contents over FTP
function ftpGetContents($ftpConn, $filepath, $ftpMode)
{
// Create temp handler, this type needed for extended char set
$tempHandle = fopen('php://temp', 'r+');
// Get file from FTP assuming that it exists
ftp_fget($ftpConn, $tempHandle, $filepath, $ftpMode, 0);
// Return our content
return stream_get_contents($tempHandle, -1, 0);
}
// Write file contents over FTP
function ftpWriteFile($ftpConn, $filepath, $contents, $ftpMode)
{
// Create temp handler, this type needed for extended char set
$tempHandle = fopen('php://temp', 'r+');
// Write contents to handle and rewind head
fwrite($tempHandle, $contents);
rewind($tempHandle);
// Write our content and return true/false
return ftp_fput($ftpConn, $filepath, $tempHandle, $ftpMode, 0);
}
// Make a new dir over FTP
function ftpMkDir($ftpConn, $perms, $dir)
{
// Create the new dir
if (!ftp_mkdir($ftpConn, $dir)) {
return false;
} else {
// Also then set perms (we must be able to do that if we created dir, so can always return true)
$this->ftpPerms($ftpConn, $perms, $dir);
return true;
}
}
// Rename a dir/dile over FTP
function ftpRename($ftpConn, $oldPath, $newPath)
{
// Return success status of rename
return ftp_rename($ftpConn, $oldPath, $newPath);
}
// Change dir/file perms over FTP
function ftpPerms($ftpConn, $perms, $filePath)
{
// Return success status of perms change
return ftp_chmod($ftpConn, $perms, $filePath);
}
// Delete dir/file over FTP
function ftpDelete($ftpConn, $type, $path)
{
if ($type == "file") {
// Delete our file and return true/false
return ftp_delete($ftpConn, $path);
} else {
// Delete our dir and return true/false
return ftp_rmdir($ftpConn, $path);
}
}
}

View File

@@ -4,19 +4,16 @@ namespace ICEcoder;
use RecursiveDirectoryIterator;
use RecursiveIteratorIterator;
use ICEcoder\FTP;
use ICEcoder\System;
use scssc;
use lessc;
class File
{
private $ftpClass;
private $systemClass;
public function __construct()
{
$this->ftpClass = new FTP();
$this->systemClass = new System();
}
@@ -67,7 +64,7 @@ class File
// On the banned file/dir list
($bannedFileFound) ||
// A local folder that isn't the doc root or starts with the doc root
("getRemoteFile" !== $_GET['action'] && !isset($ftpSite) &&
("getRemoteFile" !== $_GET['action'] &&
rtrim($allFiles[$i], "/") !== rtrim($docRoot, "/") &&
true === realpath(rtrim(dirname($allFiles[$i]), "/")) &&
0 !== strpos(realpath(rtrim(dirname($allFiles[$i]), "/")), realpath(rtrim($docRoot, "/")))
@@ -111,7 +108,7 @@ class File
}
public function load() {
global $file, $fileLoc, $fileName, $t, $ftpConn, $ftpHost, $ftpLogin, $ftpRoot, $ftpUser, $ftpMode;
global $file, $fileLoc, $fileName, $t;
echo 'action="load";';
$lineNumber = max(isset($_REQUEST['lineNumber']) ? intval($_REQUEST['lineNumber']) : 1, 1);
// Check this file isn't on the banned list at all
@@ -124,10 +121,10 @@ class File
if (false === $canOpen) {
echo 'fileType="nothing"; parent.parent.ICEcoder.message(\'' . $t['Sorry, could not...'] . ' ' . $fileLoc . "/" . $fileName . '\');';
} elseif (isset($ftpSite) || file_exists($file)) {
} elseif (file_exists($file)) {
$finfo = "text";
// Determine what to do based on mime type
if (!isset($ftpSite) && function_exists('finfo_open')) {
if (function_exists('finfo_open')) {
$finfoMIME = finfo_open(FILEINFO_MIME);
$finfo = finfo_file($finfoMIME, $file);
finfo_close($finfoMIME);
@@ -144,20 +141,9 @@ class File
if (0 === strpos($finfo, "text") || 0 === strpos($finfo, "application/json") || 0 === strpos($finfo, "application/xml") || false !== strpos($finfo, "empty")) {
echo 'fileType="text";';
// Get file over FTP?
if (isset($ftpSite)) {
$this->ftpClass->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");</script>');
}
// Get our file contents and close the FTP connection
$loadedFile = toUTF8noBOM($this->ftpClass->ftpGetContents($ftpConn, $ftpRoot . $fileLoc . "/" . $fileName, $ftpMode), false);
$this->ftpClass->ftpEnd();
// Get local file
} else {
$loadedFile = toUTF8noBOM(getData($file), true);
}
// Get data from file
$loadedFile = toUTF8noBOM(getData($file), true);
$encoding = ini_get("default_charset");
if ("" == $encoding) {
$encoding = "UTF-8";
@@ -186,7 +172,7 @@ class File
$script = 'if ("text" === fileType) {';
if (isset($ftpSite) || file_exists($file)) {
if (file_exists($file)) {
$script .= '
setTimeout(function() {
if (!parent.parent.ICEcoder.content.contentWindow.createNewCMInstance) {
@@ -247,7 +233,7 @@ class File
parent.parent.document.getElementById(\'blackMask\').style.visibility = "visible";
parent.parent.document.getElementById(\'mediaContainer\').innerHTML =
"<canvas id=\"canvasPicker\" width=\"1\" height=\"1\" style=\"position: absolute; margin: 10px 0 0 10px; cursor: crosshair\"></canvas>" +
"<img src=\"' . ((isset($ftpSite) ? $ftpSite : "") . $fileLoc . "/" . $fileName . "?unique=" . microtime(true)) .'\" style=\"border: solid 10px #fff; max-width: 700px; max-height: 500px; background-color: #000; background-image: url(\'assets/images/checkerboard.png\')\" onLoad=\"reducedImgMsg = (this.naturalWidth > 700 || this.naturalHeight > 500) ? \', ' .$t['displayed at'] . '\' + this.width + \' x \' + this.height : \'\'; document.getElementById(\'imgInfo\').innerHTML += \' (\' + this.naturalWidth + \' x \' + this.naturalHeight + reducedImgMsg + \')\'; ICEcoder.initCanvasImage(this); ICEcoder.interactCanvasImage(this)\"><br>" +
"<img src=\"' . $fileLoc . "/" . $fileName . "?unique=" . microtime(true) .'\" style=\"border: solid 10px #fff; max-width: 700px; max-height: 500px; background-color: #000; background-image: url(\'assets/images/checkerboard.png\')\" onLoad=\"reducedImgMsg = (this.naturalWidth > 700 || this.naturalHeight > 500) ? \', ' .$t['displayed at'] . '\' + this.width + \' x \' + this.height : \'\'; document.getElementById(\'imgInfo\').innerHTML += \' (\' + this.naturalWidth + \' x \' + this.naturalHeight + reducedImgMsg + \')\'; ICEcoder.initCanvasImage(this); ICEcoder.interactCanvasImage(this)\"><br>" +
"<div style=\"display: inline-block; margin-top: -10px; border: solid 10px #fff; color: #000; background-color: #fff\" id=\"imgInfo\" onmouseover=\"parent.parent.ICEcoder.overPopup=true\" onmouseout=\"parent.parent.ICEcoder.overPopup=false\">" +
"<b>' . $fileLoc . "/" . $fileName . '</b>" +
"</div><br>" +
@@ -273,7 +259,6 @@ class File
$fileName = $fileDetails['fileName'];
$fileMDTURLPart = $fileDetails['fileMDTURLPart'];
$fileVersionURLPart = $fileDetails['fileVersionURLPart'];
$ftpSite = $fileDetails['ftpSite'];
$doNext = '
ICEcoder.serverMessage();
@@ -300,7 +285,7 @@ class File
/* Saving under conditions: Confirmation of overwrite or there is no filename conflict, it is a new file, in either case we can save */
if (overwriteOK || noConflictSave) {
newFileName = "' . (true === $ftpSite ? "" : $docRoot) . '" + newFileName;
newFileName = "' . $docRoot . '" + newFileName;
saveURL = "lib/file-control.php?action=save' . $fileMDTURLPart . $fileVersionURLPart . '&csrf=' . $_GET["csrf"] . '";
var xhr = ICEcoder.xhrObj();
@@ -721,26 +706,13 @@ class File
}
public function returnJSON() {
global $ftpSite, $ftpConn, $fileLoc, $fileName, $ftpRoot, $file, $filemtime, $finalAction, $timeStart, $error, $errorStr, $errorMsg, $doNext;
global $fileLoc, $fileName, $file, $filemtime, $finalAction, $timeStart, $error, $errorStr, $errorMsg, $doNext;
if (isset($ftpSite)) {
// Get info on dir/file now
$ftpFileDirInfo = $this->ftpClass->ftpGetFileInfo($ftpConn, ltrim($fileLoc, "/"), $fileName);
// End the connection
$this->ftpClass->ftpEnd();
// Then set info
$itemAbsPath = $ftpRoot . $fileLoc . '/' . $fileName;
$itemPath = dirname($ftpRoot.$fileLoc . '/' . $fileName);
$itemBytes = $ftpFileDirInfo['size'];
$itemType = (isset($ftpFileDirInfo['type']) ? ("directory" === $ftpFileDirInfo['type'] ? "dir" : "file") : "unknown");
$itemExists = (isset($ftpFileDirInfo['type']) ? "true" : "false");
} else {
$itemAbsPath = $file;
$itemPath = dirname($file);
$itemBytes = is_dir($file) || !file_exists($file) ? null : filesize($file);
$itemType = (file_exists($file) ? (is_dir($file) ? "dir" : "file") : "unknown");
$itemExists = (file_exists($file) ? "true" : "false");
}
$itemAbsPath = $file;
$itemPath = dirname($file);
$itemBytes = is_dir($file) || !file_exists($file) ? null : filesize($file);
$itemType = (file_exists($file) ? (is_dir($file) ? "dir" : "file") : "unknown");
$itemExists = (file_exists($file) ? "true" : "false");
return '{
"file": {

View File

@@ -275,17 +275,6 @@ if (true === $havePrettier && true === file_exists(dirname(__FILE__) . "/plugins
<li><a nohref onclick="ICEcoder.pluginsManager()">Plugins</a></li>
</ul>
</div>
<!--
FTP is a far less used method of data transfer and so this menu hidden for now
Uncomment if you really want to use it but please note, in future versions of ICEcoder
that FTP is likely to be removed altogether
<div id="optionsSource" class="optionsList" onmouseover="ICEcoder.showHideFileNav('show', this.id)" onmouseout="ICEcoder.showHideFileNav('hide', this.id);ICEcoder.canShowFMNav = false">
<ul>
<li><a nohref onclick="ICEcoder.goLocalhostRoot()">Localhost</a></li>
<li><a nohref onclick="ICEcoder.ftpManager()">FTP</a></li>
</ul>
</div>
//-->
<div id="optionsHelp" class="optionsList" onmouseover="ICEcoder.showHideFileNav('show', this.id)" onmouseout="ICEcoder.showHideFileNav('hide', this.id);ICEcoder.canShowFMNav = false">
<ul>
<li><a nohref onclick="ICEcoder.viewTutorial(false, 500)">Tutorial</a></li>

View File

@@ -147,7 +147,6 @@ $text = [
"Sorry, cannot save" => "抱歉, 不能保存",
"Sorry, cannot replace..." => "抱歉, 目标不能替换文本",
"Sorry, cannot change..." => "抱歉, 目标不能更改权限",
"Sorry, cannot delete more..." => "抱歉在FTP模式下一次不能删除多个项目",
"Sorry, cannot delete..." => "抱歉, 不能删除根目录",
"Sorry, cannot delete" => "抱歉, 不能删除",
"Sorry, this file..." => "抱歉, 此文件已更改, 不能保存",
@@ -159,37 +158,6 @@ $text = [
"Saving" => "正在保存",
],
"ftp-manager" =>
[
"Saving FTP sites" => "保存FTP站点",
"Cannot update config..." => "无法更新配置文件,请设置公用写入权限。",
"and try again" => "重试",
"ftp manager" => "FTP管理器",
"Choose existing site" => "选择现有网站",
"Are you sure..." => "确实要删除此网站吗?",
"Add new site" => "添加新站点",
"Edit site" => "配置站点",
"Site base" => "站点信息",
"Host" => "域名",
"Username" => "用户名",
"Password" => "密码",
"PASV and mode" => "被动模式",
"Root" => "根目录",
"eg http://yourdomain.com" => "例 http://yourdomain.com",
"eg ftp.yourdomain.com" => "例 ftp.yourdomain.com",
"eg user123" => "例 user123",
"eg pass123" => "例 pass123",
"Use PASV mode..." => "如果FTP站点需要请使用被动模式并选择数据传输类型 ASCII字符 或 Binary二进制",
"eg /htdocs" => "例 /htdocs",
"PASV connection off" => "关闭 PASV 模式连接",
"PASV connection on" => "开启 PASV 模式连接",
"ASCII transfer" => "ASCII 字符传输",
"Binary transfer" => "Binary 二进制传输",
"Add" => "添加",
"Choose" => "选择",
"Update" => "更新",
],
"get-branch" => [],
"headers" =>

View File

@@ -147,7 +147,6 @@ $text = [
"Sorry, cannot replace..." => "抱歉, 目標不能替換文本",
"Sorry, cannot change..." => "抱歉, 目標不能更改權限",
"Sorry, cannot delete..." => "抱歉, 不能刪除根級別ROOT",
"Sorry, cannot delete more..." => "Sorry, cannot delete more then one item at a time under FTP mode",
"Sorry, cannot delete" => "抱歉, 不能刪除",
"Sorry, this file..." => "抱歉, 此文件已更改, 不能保存",
"Reload this file..." => "重新加載該文件, 你的版本複製到一個新文件?",
@@ -158,37 +157,6 @@ $text = [
"Saving" => "正在保存",
],
"ftp-manager" =>
[
"Saving FTP sites" => "Saving FTP sites",
"Cannot update config..." => "Cannot update config file. Please set public write permissions on",
"and try again" => "and try again",
"ftp manager" => "ftp manager",
"Choose existing site" => "Choose existing site",
"Are you sure..." => "Are you sure you wish to remove this site?",
"Add new site" => "Add new site",
"Edit site" => "Edit site",
"Site base" => "Site base",
"Host" => "Host",
"Username" => "Username",
"Password" => "Password",
"PASV and mode" => "PASV and mode",
"Root" => "Root",
"eg http://yourdomain.com" => "eg http://yourdomain.com",
"eg ftp.yourdomain.com" => "eg ftp.yourdomain.com",
"eg user123" => "eg user123",
"eg pass123" => "eg pass123",
"Use PASV mode..." => "Use PASV mode if your FTP site requires it and choose the data transfer type - ASCII or binary",
"eg /htdocs" => "eg /htdocs",
"PASV connection off" => "PASV connection off",
"PASV connection on" => "PASV connection on",
"ASCII transfer" => "ASCII transfer",
"Binary transfer" => "Binary transfer",
"Add" => "Add",
"Choose" => "Choose",
"Update" => "Update",
],
"get-branch" => [],
"headers" =>

View File

@@ -146,7 +146,6 @@ $text = [
"Sorry, cannot save" => "Kan niet opslaan",
"Sorry, cannot replace..." => "Kan geen tekst vervangen in",
"Sorry, cannot change..." => "Kan de rechten niet wijzigen voor",
"Sorry, cannot delete more..." => "U kunt niet meer dan een bestand tegelijkertijd verwijderen in FTP modus",
"Sorry, cannot delete..." => "Kan de root level niet verwijderen",
"Sorry, cannot delete" => "Kan niet verwijderd worden",
"Sorry, this file..." => "Het bestand is gewijzigd, maar kan niet worden opgeslagen",
@@ -158,37 +157,6 @@ $text = [
"Saving" => "Opslaan"
],
"ftp-manager" =>
[
"Saving FTP sites" => "Saving FTP sites",
"Cannot update config..." => "Cannot update config file. Please set public write permissions on",
"and try again" => "and try again",
"ftp manager" => "ftp manager",
"Choose existing site" => "Choose existing site",
"Are you sure..." => "Are you sure you wish to remove this site?",
"Add new site" => "Add new site",
"Edit site" => "Edit site",
"Site base" => "Site base",
"Host" => "Host",
"Username" => "Username",
"Password" => "Password",
"PASV and mode" => "PASV and mode",
"Root" => "Root",
"eg http://yourdomain.com" => "eg http://yourdomain.com",
"eg ftp.yourdomain.com" => "eg ftp.yourdomain.com",
"eg user123" => "eg user123",
"eg pass123" => "eg pass123",
"Use PASV mode..." => "Use PASV mode if your FTP site requires it and choose the data transfer type - ASCII or binary",
"eg /htdocs" => "eg /htdocs",
"PASV connection off" => "PASV connection off",
"PASV connection on" => "PASV connection on",
"ASCII transfer" => "ASCII transfer",
"Binary transfer" => "Binary transfer",
"Add" => "Add",
"Choose" => "Choose",
"Update" => "Update",
],
"get-branch" => [],
"headers" =>

View File

@@ -146,7 +146,6 @@ $text = [
"Sorry, cannot save" => "Sorry, cannot save",
"Sorry, cannot replace..." => "Sorry, cannot replace text in",
"Sorry, cannot change..." => "Sorry, cannot change permissions on",
"Sorry, cannot delete more..." => "Sorry, cannot delete more then one item at a time under FTP mode",
"Sorry, cannot delete..." => "Sorry, cannot delete the root level",
"Sorry, cannot delete" => "Sorry, cannot delete",
"Sorry, this file..." => "Sorry, this file has changed outside of ICEcoder, cannot save",
@@ -158,37 +157,6 @@ $text = [
"Saving" => "Saving",
],
"ftp-manager" =>
[
"Saving FTP sites" => "Saving FTP sites",
"Cannot update config..." => "Cannot update config file. Please set public write permissions on",
"and try again" => "and try again",
"ftp manager" => "ftp manager",
"Choose existing site" => "Choose existing site",
"Are you sure..." => "Are you sure you wish to remove this site?",
"Add new site" => "Add new site",
"Edit site" => "Edit site",
"Site base" => "Site base",
"Host" => "Host",
"Username" => "Username",
"Password" => "Password",
"PASV and mode" => "PASV and mode",
"Root" => "Root",
"eg http://yourdomain.com" => "eg http://yourdomain.com",
"eg ftp.yourdomain.com" => "eg ftp.yourdomain.com",
"eg user123" => "eg user123",
"eg pass123" => "eg pass123",
"Use PASV mode..." => "Use PASV mode if your FTP site requires it and choose the data transfer type - ASCII or binary",
"eg /htdocs" => "eg /htdocs",
"PASV connection off" => "PASV connection off",
"PASV connection on" => "PASV connection on",
"ASCII transfer" => "ASCII transfer",
"Binary transfer" => "Binary transfer",
"Add" => "Add",
"Choose" => "Choose",
"Update" => "Update",
],
"get-branch" => [],
"headers" =>

View File

@@ -146,7 +146,6 @@ $text = [
"Sorry, cannot save" => "D&eacute;sol&eacute;, impossibilit&eacute; de sauvegarder",
"Sorry, cannot replace..." => "D&eacute;sol&eacute;, impossibilit&eacute; de remplacer le texte dans ",
"Sorry, cannot change..." => "D&eacute;sol&eacute;, impossibilit&eacute; de changer les permissions sur",
"Sorry, cannot delete more..." => "Sorry, cannot delete more then one item at a time under FTP mode",
"Sorry, cannot delete..." => "D&eacute;sol&eacute;, imossibilit&eacute; de supprimer le dossier racine",
"Sorry, cannot delete" => "D&eacute;sol&eacute;, impossibilit&eacute; d&apos;effacer",
"Sorry, this file..." => "D&eacute;sol&eacute;, le fichier a &eacute;t&eacute; modifi&eacute;, impossibilit&eacute; de sauvegarder",
@@ -158,37 +157,6 @@ $text = [
"Saving" => "Sauvegard&eacute;",
],
"ftp-manager" =>
[
"Saving FTP sites" => "Saving FTP sites",
"Cannot update config..." => "Cannot update config file. Please set public write permissions on",
"and try again" => "and try again",
"ftp manager" => "ftp manager",
"Choose existing site" => "Choose existing site",
"Are you sure..." => "Are you sure you wish to remove this site?",
"Add new site" => "Add new site",
"Edit site" => "Edit site",
"Site base" => "Site base",
"Host" => "Host",
"Username" => "Username",
"Password" => "Password",
"PASV and mode" => "PASV and mode",
"Root" => "Root",
"eg http://yourdomain.com" => "eg http://yourdomain.com",
"eg ftp.yourdomain.com" => "eg ftp.yourdomain.com",
"eg user123" => "eg user123",
"eg pass123" => "eg pass123",
"Use PASV mode..." => "Use PASV mode if your FTP site requires it and choose the data transfer type - ASCII or binary",
"eg /htdocs" => "eg /htdocs",
"PASV connection off" => "PASV connection off",
"PASV connection on" => "PASV connection on",
"ASCII transfer" => "ASCII transfer",
"Binary transfer" => "Binary transfer",
"Add" => "Add",
"Choose" => "Choose",
"Update" => "Update",
],
"get-branch" => [],
"headers" =>

View File

@@ -146,7 +146,6 @@ $text = [
"Sorry, cannot save" => "Entschuldigung, kann nicht speichern",
"Sorry, cannot replace..." => "Entschuldigung, kann den Text nicht ersetzen",
"Sorry, cannot change..." => "Entschuldigung, kann die Berechtigung nicht &auml;ndern f&uuml;r",
"Sorry, cannot delete more..." => "Sorry, cannot delete more then one item at a time under FTP mode",
"Sorry, cannot delete..." => "Entschuldigung, kann das Hauptverzeichnis nicht l&ouml;schen",
"Sorry, cannot delete" => "Entschuldigung, kann nicht l&ouml;schen",
"Sorry, this file..." => "Entschuldigung, die Datei wurde ge&auml;ndert, kann nicht speichern",
@@ -158,37 +157,6 @@ $text = [
"Saving" => "Speichere",
],
"ftp-manager" =>
[
"Saving FTP sites" => "Saving FTP sites",
"Cannot update config..." => "Cannot update config file. Please set public write permissions on",
"and try again" => "and try again",
"ftp manager" => "ftp manager",
"Choose existing site" => "Choose existing site",
"Are you sure..." => "Are you sure you wish to remove this site?",
"Add new site" => "Add new site",
"Edit site" => "Edit site",
"Site base" => "Site base",
"Host" => "Host",
"Username" => "Username",
"Password" => "Password",
"PASV and mode" => "PASV and mode",
"Root" => "Root",
"eg http://yourdomain.com" => "eg http://yourdomain.com",
"eg ftp.yourdomain.com" => "eg ftp.yourdomain.com",
"eg user123" => "eg user123",
"eg pass123" => "eg pass123",
"Use PASV mode..." => "Use PASV mode if your FTP site requires it and choose the data transfer type - ASCII or binary",
"eg /htdocs" => "eg /htdocs",
"PASV connection off" => "PASV connection off",
"PASV connection on" => "PASV connection on",
"ASCII transfer" => "ASCII transfer",
"Binary transfer" => "Binary transfer",
"Add" => "Add",
"Choose" => "Choose",
"Update" => "Update",
],
"get-branch" => [],
"headers" =>

View File

@@ -146,7 +146,6 @@ $text = [
"Sorry, cannot save" => "Siamo spiacenti, non è possibile salvare",
"Sorry, cannot replace..." => "Siamo spiacenti, non è possibile sostituire il testo",
"Sorry, cannot change..." => "Siamo spiacenti, non è possibile cambiare i permessi",
"Sorry, cannot delete more..." => "Sorry, cannot delete more then one item at a time under FTP mode",
"Sorry, cannot delete..." => "Siamo spiacenti, non è possibile cancellare la cartella root",
"Sorry, cannot delete" => "Siamo spiacenti, non è possibile cancellare",
"Sorry, this file..." => "Siamo spiacenti, questo file è stato cambiato, non è possibile salvarlo",
@@ -158,37 +157,6 @@ $text = [
"Saving" => "Stiamo salvando",
],
"ftp-manager" =>
[
"Saving FTP sites" => "Saving FTP sites",
"Cannot update config..." => "Cannot update config file. Please set public write permissions on",
"and try again" => "and try again",
"ftp manager" => "ftp manager",
"Choose existing site" => "Choose existing site",
"Are you sure..." => "Are you sure you wish to remove this site?",
"Add new site" => "Add new site",
"Edit site" => "Edit site",
"Site base" => "Site base",
"Host" => "Host",
"Username" => "Username",
"Password" => "Password",
"PASV and mode" => "PASV and mode",
"Root" => "Root",
"eg http://yourdomain.com" => "eg http://yourdomain.com",
"eg ftp.yourdomain.com" => "eg ftp.yourdomain.com",
"eg user123" => "eg user123",
"eg pass123" => "eg pass123",
"Use PASV mode..." => "Use PASV mode if your FTP site requires it and choose the data transfer type - ASCII or binary",
"eg /htdocs" => "eg /htdocs",
"PASV connection off" => "PASV connection off",
"PASV connection on" => "PASV connection on",
"ASCII transfer" => "ASCII transfer",
"Binary transfer" => "Binary transfer",
"Add" => "Add",
"Choose" => "Choose",
"Update" => "Update",
],
"get-branch" => [],
"headers" =>

View File

@@ -146,7 +146,6 @@ $text = [
"Sorry, cannot save" => "Beklager, kan ikke lagre",
"Sorry, cannot replace..." => "Beklager, kan ikke erstatte tekst i",
"Sorry, cannot change..." => "Beklager, kan ikke endre tillatelser på",
"Sorry, cannot delete more..." => "Sorry, cannot delete more then one item at a time under FTP mode",
"Sorry, cannot delete..." => "Beklager, kan ikke slette rotnivå",
"Sorry, cannot delete" => "Beklager, kan ikke slette",
"Sorry, this file..." => "Beklager, denne filen er endret, kan ikke lagre",
@@ -158,37 +157,6 @@ $text = [
"Saving" => "Lagring",
],
"ftp-manager" =>
[
"Saving FTP sites" => "Saving FTP sites",
"Cannot update config..." => "Cannot update config file. Please set public write permissions on",
"and try again" => "and try again",
"ftp manager" => "ftp manager",
"Choose existing site" => "Choose existing site",
"Are you sure..." => "Are you sure you wish to remove this site?",
"Add new site" => "Add new site",
"Edit site" => "Edit site",
"Site base" => "Site base",
"Host" => "Host",
"Username" => "Username",
"Password" => "Password",
"PASV and mode" => "PASV and mode",
"Root" => "Root",
"eg http://yourdomain.com" => "eg http://yourdomain.com",
"eg ftp.yourdomain.com" => "eg ftp.yourdomain.com",
"eg user123" => "eg user123",
"eg pass123" => "eg pass123",
"Use PASV mode..." => "Use PASV mode if your FTP site requires it and choose the data transfer type - ASCII or binary",
"eg /htdocs" => "eg /htdocs",
"PASV connection off" => "PASV connection off",
"PASV connection on" => "PASV connection on",
"ASCII transfer" => "ASCII transfer",
"Binary transfer" => "Binary transfer",
"Add" => "Add",
"Choose" => "Choose",
"Update" => "Update",
],
"get-branch" => [],
"headers" =>

View File

@@ -146,7 +146,6 @@ $text = [
"Sorry, cannot save" => "متاسفانه نمی توانیم ذخیره کنیم",
"Sorry, cannot replace..." => "متاسفانه نمی نمی توانیم جایگزین کنیم",
"Sorry, cannot change..." => "متاسفانه نمی توانیم دسترسی را تغییر دهیم",
"Sorry, cannot delete more..." => "Sorry, cannot delete more then one item at a time under FTP mode",
"Sorry, cannot delete..." => "متاسفانه نمی توانیم دسترسی ریشه را تغییر دهیم",
"Sorry, cannot delete" => "متاسفانه نمی توانیم تغییر دهیم",
"Sorry, this file..." => "متاسفانه این فایل تغییر دارد و نمی توانیم آن را ذخیره کنیم",
@@ -158,37 +157,6 @@ $text = [
"Saving" => "در حال ذخره",
],
"ftp-manager" =>
[
"Saving FTP sites" => "Saving FTP sites",
"Cannot update config..." => "Cannot update config file. Please set public write permissions on",
"and try again" => "and try again",
"ftp manager" => "ftp manager",
"Choose existing site" => "Choose existing site",
"Are you sure..." => "Are you sure you wish to remove this site?",
"Add new site" => "Add new site",
"Edit site" => "Edit site",
"Site base" => "Site base",
"Host" => "Host",
"Username" => "Username",
"Password" => "Password",
"PASV and mode" => "PASV and mode",
"Root" => "Root",
"eg http://yourdomain.com" => "eg http://yourdomain.com",
"eg ftp.yourdomain.com" => "eg ftp.yourdomain.com",
"eg user123" => "eg user123",
"eg pass123" => "eg pass123",
"Use PASV mode..." => "Use PASV mode if your FTP site requires it and choose the data transfer type - ASCII or binary",
"eg /htdocs" => "eg /htdocs",
"PASV connection off" => "PASV connection off",
"PASV connection on" => "PASV connection on",
"ASCII transfer" => "ASCII transfer",
"Binary transfer" => "Binary transfer",
"Add" => "Add",
"Choose" => "Choose",
"Update" => "Update",
],
"get-branch" => [],
"headers" =>

View File

@@ -146,7 +146,6 @@ $text = [
"Sorry, cannot save" => "Desculpe, n&atilde;o &eacute; poss&iacute;vel salvar",
"Sorry, cannot replace..." => "Desculpe, n&atilde;o &eacute; poss&iacute;vel substituir texto em",
"Sorry, cannot change..." => "Desculpe, n&atilde;o &eacute; poss&iacute;vel mudar permiss&otilde;es para",
"Sorry, cannot delete more..." => "Sorry, cannot delete more then one item at a time under FTP mode",
"Sorry, cannot delete..." => "Desculpe, n&atilde;o &eacute; poss&iacute;vel excluir n&iacute;vel raiz",
"Sorry, cannot delete" => "Desculpe, n&atilde;o &eacute; poss&iacute;vel remover",
"Sorry, this file..." => "Desculpe, este arquivo foi modificado, n&atilde;o &eacute; poss&iacute;vel salvar",
@@ -158,37 +157,6 @@ $text = [
"Saving" => "Salvando",
],
"ftp-manager" =>
[
"Saving FTP sites" => "Saving FTP sites",
"Cannot update config..." => "Cannot update config file. Please set public write permissions on",
"and try again" => "and try again",
"ftp manager" => "ftp manager",
"Choose existing site" => "Choose existing site",
"Are you sure..." => "Are you sure you wish to remove this site?",
"Add new site" => "Add new site",
"Edit site" => "Edit site",
"Site base" => "Site base",
"Host" => "Host",
"Username" => "Username",
"Password" => "Password",
"PASV and mode" => "PASV and mode",
"Root" => "Root",
"eg http://yourdomain.com" => "eg http://yourdomain.com",
"eg ftp.yourdomain.com" => "eg ftp.yourdomain.com",
"eg user123" => "eg user123",
"eg pass123" => "eg pass123",
"Use PASV mode..." => "Use PASV mode if your FTP site requires it and choose the data transfer type - ASCII or binary",
"eg /htdocs" => "eg /htdocs",
"PASV connection off" => "PASV connection off",
"PASV connection on" => "PASV connection on",
"ASCII transfer" => "ASCII transfer",
"Binary transfer" => "Binary transfer",
"Add" => "Add",
"Choose" => "Choose",
"Update" => "Update",
],
"get-branch" => [],
"headers" =>

View File

@@ -146,7 +146,6 @@ $text = [
"Sorry, cannot save" => "Lo siento, no puedo guardar",
"Sorry, cannot replace..." => "Lo siento, no puedo reemplazar texto en",
"Sorry, cannot change..." => "Lo siento, no puedo cambiar permisos sobre",
"Sorry, cannot delete more..." => "Lo siento, no puedo eliminar mas de un item a la vez bajo modo FTP",
"Sorry, cannot delete..." => "Lo siento, no puedo eliminar el nivel raiz",
"Sorry, cannot delete" => "Lo siento, no puedo eliminar",
"Sorry, this file..." => "Lo siento, este archivo ha cambiado, no puedo almacenar",
@@ -158,37 +157,6 @@ $text = [
"Saving" => "Guardando"
],
"ftp-manager" =>
[
"Saving FTP sites" => "Saving FTP sites",
"Cannot update config..." => "Cannot update config file. Please set public write permissions on",
"and try again" => "and try again",
"ftp manager" => "ftp manager",
"Choose existing site" => "Choose existing site",
"Are you sure..." => "Are you sure you wish to remove this site?",
"Add new site" => "Add new site",
"Edit site" => "Edit site",
"Site base" => "Site base",
"Host" => "Host",
"Username" => "Username",
"Password" => "Password",
"PASV and mode" => "PASV and mode",
"Root" => "Root",
"eg http://yourdomain.com" => "eg http://yourdomain.com",
"eg ftp.yourdomain.com" => "eg ftp.yourdomain.com",
"eg user123" => "eg user123",
"eg pass123" => "eg pass123",
"Use PASV mode..." => "Use PASV mode if your FTP site requires it and choose the data transfer type - ASCII or binary",
"eg /htdocs" => "eg /htdocs",
"PASV connection off" => "PASV connection off",
"PASV connection on" => "PASV connection on",
"ASCII transfer" => "ASCII transfer",
"Binary transfer" => "Binary transfer",
"Add" => "Add",
"Choose" => "Choose",
"Update" => "Update",
],
"get-branch" => [],
"headers" =>

View File

@@ -49,7 +49,7 @@ $dateCounts = $fileCountInfo['dateCounts'];
$displayVersions = $versions;
// Establish the base, host and date dir parts...
$backupDirHost = isset($ftpSite) ? parse_url($ftpSite, PHP_URL_HOST) : "localhost";
$backupDirHost = "localhost";
foreach ($dateCounts as $key => $value) {
echo "<b>".date("jS M Y", strtotime($key)) . " (" . $value . " " . ($value !== 1 ? $t["backups"] : $t["backup"]) . ")</b>";

View File

@@ -4,13 +4,11 @@ require "icecoder.php";
use ICEcoder\ExtraProcesses;
use ICEcoder\Backup;
use ICEcoder\File;
use ICEcoder\FTP;
use ICEcoder\System;
use ICEcoder\URL;
$backupClass = new Backup;
$fileClass = new File;
$ftpClass = new FTP;
$systemClass = new System;
$t = $text['file-control'];
@@ -68,14 +66,6 @@ if (false === $error) {
}
$doNext = "";
// If we're in FTP mode, start a connection and leave open for FTP actions
if (isset($ftpSite)) {
$ftpClass->ftpStart();
// Show user warning if no good connection
if (!$ftpConn || !$ftpLogin) {
$doNext .= 'ICEcoder.message("Sorry, no FTP connection to ' . $ftpHost . ' for user ' . $ftpUser . '");';
}
}
// =============
// LOADING FILES
@@ -118,8 +108,7 @@ if (!$error && "save" === $_GET['action']) {
"fileURL" => $fileURL,
"fileName" => $fileName,
"fileMDTURLPart" => $fileMDTURLPart,
"fileVersionURLPart" => $fileVersionURLPart,
"ftpSite" => true === isset($ftpSite)
"fileVersionURLPart" => $fileVersionURLPart
];
$doNext .= $fileClass->handleSaveLooparound($fileDetails, $finalAction, $t);
@@ -134,22 +123,17 @@ if (!$error && "save" === $_GET['action']) {
// FILE IS WRITEABLE
// =================
if (!$demoMode && (isset($ftpSite) || (file_exists($file) && is_writable($file)) || isset($_POST['newFileName']) && "" != $_POST['newFileName'])) {
if (!$demoMode && ((file_exists($file) && is_writable($file)) || isset($_POST['newFileName']) && "" != $_POST['newFileName'])) {
$filemtime = !isset($ftpSite) && "Windows" !== $serverType && file_exists($file) ? filemtime($file) : "1000000";
$filemtime = "Windows" !== $serverType && file_exists($file) ? filemtime($file) : "1000000";
// ==================================================
// MDT'S MATCH (OR WE'RE SAVING NEW FILE), WRITE FILE
// ==================================================
if (!(isset($_GET['fileMDT'])) || $filemtime == $_GET['fileMDT'] || isset($_POST['newFileName'])) {
// FTP Saving
if (isset($ftpSite)) {
$ftpClass->writeFile();
// Local saving
} else {
$fileClass->writeFile();
}
// Write file
$fileClass->writeFile();
// Save a version controlled backup source of the file
if ($ICEcoder["backupsKept"]) {
@@ -192,20 +176,9 @@ if (!$error && "save" === $_GET['action']) {
// ==========
if (!$error && "newFolder" === $_GET['action']) {
if (!$demoMode && (isset($ftpSite) || is_writable($docRoot.$fileLoc))) {
// FTP
if (isset($ftpSite)) {
$ftpFilepath = ltrim($fileLoc . "/" . $fileName, "/");
if (!$ftpClass->ftpMkDir($ftpConn, octdec($ICEcoder['newDirPerms']), $ftpFilepath)) {
$doNext .= 'ICEcoder.message("Sorry, could not create dir '.$ftpFilepath.' at ' . $ftpHost . '");';
} else {
$fileClass->updateFileManager('add', $fileLoc, $fileName, '', '', '', 'folder');
}
// Local
} else {
mkdir($file, octdec($ICEcoder['newDirPerms']));
$fileClass->updateFileManager('add', $fileLoc, $fileName, '', '', '', 'folder');
}
if (!$demoMode && is_writable($docRoot . $fileLoc)) {
mkdir($file, octdec($ICEcoder['newDirPerms']));
$fileClass->updateFileManager('add', $fileLoc, $fileName, '', '', '', 'folder');
$finalAction = "newFolder";
// Run any extra processes
$extraProcessesClass = new ExtraProcesses($fileLoc, $fileName);
@@ -222,39 +195,22 @@ if (!$error && "newFolder" === $_GET['action']) {
// ================
if (!$error && "move" === $_GET['action']) {
if (isset($ftpSite)) {
$srcDir = ltrim(str_replace("|", "/", $_GET['oldFileName']), "/");
$tgtDir = ltrim($fileLoc . "/" . $fileName, "/");
} else {
$srcDir = $docRoot . $iceRoot . str_replace("|", "/", $_GET['oldFileName']);
$tgtDir = $docRoot . $fileLoc . "/" . $fileName;
}
$srcDir = $docRoot . $iceRoot . str_replace("|", "/", $_GET['oldFileName']);
$tgtDir = $docRoot . $fileLoc . "/" . $fileName;
if ($srcDir != $tgtDir) {
if (!$demoMode && (isset($ftpSite) || is_writable($srcDir))) {
// FTP
if (isset($ftpSite)) {
if (!$ftpClass->ftpRename($ftpConn, $srcDir, $tgtDir)) {
$doNext .= 'ICEcoder.message("Sorry, could not rename ' . $srcDir . ' to ' . $tgtDir . '");';
} else {
$ftpFileDirInfo = $ftpClass->ftpGetFileInfo($ftpConn, ltrim($fileLoc, "/"), $fileName);
$fileOrFolder = "directory" === $ftpFileDirInfo['type'] ? "folder" : "file";
$fileClass->updateFileManager('move', $fileLoc, $fileName, '', str_replace($iceRoot, "", str_replace("|", "/", $_GET['oldFileName'])), '', $fileOrFolder);
}
// Local
if (!$demoMode && is_writable($srcDir)) {
if(rename($srcDir, $tgtDir)) {
// Is a dir or file (needed to create new item in file manager)
$fileOrFolder = is_dir($docRoot . $fileLoc . "/" . $fileName) ? "folder" : "file";
$fileClass->updateFileManager('move', $fileLoc, $fileName, '', str_replace($iceRoot, "", str_replace("|", "/", $_GET['oldFileName'])), '', $fileOrFolder);
$doNext .= 'tabNum = ICEcoder.openFiles.indexOf(\'' . str_replace("|", "/", $_GET['oldFileName']) . '\') + 1; if (0 < tabNum) {ICEcoder.renameTab(tabNum, \'' . $fileLoc . "/" . $fileName . '\');};';
$finalAction = "move";
// Run any extra processes
$extraProcessesClass = new ExtraProcesses($fileLoc, $fileName);
$doNext = $extraProcessesClass->onFileDirMove($doNext);
} else {
if(rename($srcDir, $tgtDir)) {
// Is a dir or file (needed to create new item in file manager)
$fileOrFolder = is_dir($docRoot . $fileLoc . "/" . $fileName) ? "folder" : "file";
$fileClass->updateFileManager('move', $fileLoc, $fileName, '', str_replace($iceRoot, "", str_replace("|", "/", $_GET['oldFileName'])), '', $fileOrFolder);
$doNext .= 'tabNum = ICEcoder.openFiles.indexOf(\'' . str_replace("|", "/", $_GET['oldFileName']) . '\') + 1; if (0 < tabNum) {ICEcoder.renameTab(tabNum, \'' . $fileLoc . "/" . $fileName . '\');};';
$finalAction = "move";
// Run any extra processes
$extraProcessesClass = new ExtraProcesses($fileLoc, $fileName);
$doNext = $extraProcessesClass->onFileDirMove($doNext);
} else {
$doNext .= "ICEcoder.message('" . $t['Sorry, cannot move'] . "\\\\n" . str_replace("|", "/", $_GET['oldFileName']) . "\\\\n\\\\n" . $t['Maybe public write...'] . "');";
$finalAction = "nothing";
}
$doNext .= "ICEcoder.message('" . $t['Sorry, cannot move'] . "\\\\n" . str_replace("|", "/", $_GET['oldFileName']) . "\\\\n\\\\n" . $t['Maybe public write...'] . "');";
$finalAction = "nothing";
}
} else {
$doNext .= "ICEcoder.message('" . $t['Sorry, cannot move'] . "\\\\n" . str_replace("|", "/", $_GET['oldFileName']) . "\\\\n\\\\n" . $t['Maybe public write...'] . "');";
@@ -272,29 +228,18 @@ if (!$error && "move" === $_GET['action']) {
// ==================
if (!$error && "rename" === $_GET['action']) {
if (!$demoMode && (isset($ftpSite) || is_writable($docRoot.$iceRoot.str_replace("|", "/", $_GET['oldFileName'])))) {
// FTP
if (isset($ftpSite)) {
$ftpFilepath = ltrim($fileLoc . "/" . $fileName, "/");
if (!$ftpClass->ftpRename($ftpConn, ltrim($_GET['oldFileName'], "/"), $ftpFilepath)) {
$doNext .= 'ICEcoder.message("Sorry, could not rename ' . ltrim($_GET['oldFileName'], "/") . ' to ' . $ftpFilepath . '");';
} else {
$fileClass->updateFileManager('rename', $fileLoc, $fileName, '', str_replace($iceRoot, "", $_GET['oldFileName']), '', '');
}
// Local
if (!$demoMode && is_writable($docRoot . $iceRoot . str_replace("|", "/", $_GET['oldFileName']))) {
if (true === file_exists($docRoot . $fileLoc)) {
rename($docRoot.$iceRoot.str_replace("|", "/", $_GET['oldFileName']), $docRoot . $fileLoc . "/" . $fileName);
$fileClass->updateFileManager('rename', $fileLoc, $fileName, '', str_replace($iceRoot, "", $_GET['oldFileName']), '', '');
$doNext .= 'tabNum = ICEcoder.openFiles.indexOf(\'' . str_replace("|", "/", $_GET['oldFileName']) . '\') + 1; if (0 < tabNum) {ICEcoder.renameTab(tabNum, \'' . $fileLoc . "/" . $fileName . '\');};';
$finalAction = "rename";
// Run any extra processes
$extraProcessesClass = new ExtraProcesses($fileLoc, $fileName);
$doNext = $extraProcessesClass->onFileDirRename($doNext);
} else {
if (true === file_exists($docRoot . $fileLoc)) {
rename($docRoot.$iceRoot.str_replace("|", "/", $_GET['oldFileName']), $docRoot . $fileLoc . "/" . $fileName);
$fileClass->updateFileManager('rename', $fileLoc, $fileName, '', str_replace($iceRoot, "", $_GET['oldFileName']), '', '');
$doNext .= 'tabNum = ICEcoder.openFiles.indexOf(\'' . str_replace("|", "/", $_GET['oldFileName']) . '\') + 1; if (0 < tabNum) {ICEcoder.renameTab(tabNum, \'' . $fileLoc . "/" . $fileName . '\');};';
$finalAction = "rename";
// Run any extra processes
$extraProcessesClass = new ExtraProcesses($fileLoc, $fileName);
$doNext = $extraProcessesClass->onFileDirRename($doNext);
} else {
$doNext .= "ICEcoder.message('".$t['Sorry, cannot rename'] . "\\\\n" . str_replace("|", "/", $_GET['oldFileName']) . "\\\\n\\\\n" . $t['does not seem...'] . "');";
$finalAction = "nothing";
}
$doNext .= "ICEcoder.message('".$t['Sorry, cannot rename'] . "\\\\n" . str_replace("|", "/", $_GET['oldFileName']) . "\\\\n\\\\n" . $t['does not seem...'] . "');";
$finalAction = "nothing";
}
} else {
$doNext .= "ICEcoder.message('".$t['Sorry, cannot rename'] . "\\\\n" . str_replace("|", "/", $_GET['oldFileName']) . "\\\\n\\\\n" . $t['Maybe public write...'] . "');";
@@ -307,7 +252,7 @@ if (!$error && "rename" === $_GET['action']) {
// PASTE FILE/FOLDER
// =================
if (!isset($ftpSite) && !$error && "paste" === $_GET['action']) {
if (!$error && "paste" === $_GET['action']) {
$source = $file;
$dest = str_replace("//", "/", $docRoot . $iceRoot . str_replace("|", "/", $_GET['location']) . "/" . basename($source));
if (!$demoMode && is_writable(dirname($dest))) {
@@ -331,7 +276,7 @@ if (!isset($ftpSite) && !$error && "paste" === $_GET['action']) {
// UPLOAD FILE(S)
// ==============
if (!isset($ftpSite) && !$error && "upload" === $_GET['action']) {
if (!$error && "upload" === $_GET['action']) {
if (!$demoMode) {
if ($_FILES['filesInput']){
@@ -358,34 +303,7 @@ if (!isset($ftpSite) && !$error && "upload" === $_GET['action']) {
if (!$error && "delete" === $_GET['action']) {
$filesArray = explode(";", $file); // May contain more than one file here
// FTP
if (isset($ftpSite)) {
if (1 === count($filesArray)) {
$ftpFileDirInfo = $ftpClass->ftpGetFileInfo($ftpConn, ltrim($fileLoc, "/"), $fileName);
$itemType = "directory" === $ftpFileDirInfo['type'] ? "dir" : "file";
$itemPath = ltrim($fileLoc . "/" . $fileName, "/");
if (!$demoMode && $ftpClass->ftpDelete($ftpConn, $itemType, $itemPath)) {
if ($fileLoc=="" || "\\" === $fileLoc) {
$fileLoc = "/";
};
// Reload file manager
$doNext .= 'ICEcoder.selectedFiles = []; ICEcoder.updateFileManagerList(\'delete\', \'' . $fileLoc . '\', \'' . $fileName . '\', false, false, false, \'' . ("dir" === $itemType ? 'folder' : 'file') . '\');';
$finalAction = "delete";
// Run any extra processes
$extraProcessesClass = new ExtraProcesses($fileLoc, $fileName);
$doNext = $extraProcessesClass->onFileDirDelete($doNext);
} else {
$doNext .= "ICEcoder.message('" . $t['Sorry, cannot delete'] . "\\\\n" . $fileLoc . "/" . $fileName . "');";
$finalAction = "nothing";
}
} else {
$doNext .= "ICEcoder.message('" . $t['Sorry, cannot delete more...'] . "');";
$finalAction = "nothing";
}
// Local
} else {
$fileClass->delete();
}
$fileClass->delete();
$doNext .= 'ICEcoder.serverMessage(); ICEcoder.serverQueue("del");';
};
@@ -393,7 +311,7 @@ if (!$error && "delete" === $_GET['action']) {
// REPLACE TEXT IN A FILE
// ======================
if (!isset($ftpSite) && !$error && "replaceText" === $_GET['action']) {
if (!$error && "replaceText" === $_GET['action']) {
if (!$demoMode && is_writable($file)) {
$loadedFile = toUTF8noBOM(getData($file), true);
$find = $_GET['find'];
@@ -419,7 +337,7 @@ if (!isset($ftpSite) && !$error && "replaceText" === $_GET['action']) {
// GET CONTENTS OF REMOTE URL
// ==========================
if (!isset($ftpSite) && !$error && "getRemoteFile" === $_GET['action']) {
if (!$error && "getRemoteFile" === $_GET['action']) {
$lineNumber = max(isset($_REQUEST['lineNumber']) ? intval($_REQUEST['lineNumber']) : 1, 1);
if ($remoteFile = toUTF8noBOM(getData($file, 'curl'), true)) {
@@ -445,20 +363,9 @@ if (!isset($ftpSite) && !$error && "getRemoteFile" === $_GET['action']) {
// =======================
if (!$error && "perms" === $_GET['action']) {
if (!$demoMode && (isset($ftpSite) || is_writable($file))) {
// FTP
if (isset($ftpSite)) {
$ftpFilepath = ltrim($fileLoc . "/" . $fileName, "/");
if (!$ftpClass->ftpPerms($ftpConn, octdec(numClean($_GET['perms'])), $ftpFilepath)) {
$doNext .= 'ICEcoder.message("Sorry, could not set perms on ' . $ftpFilepath . ' at ' . $ftpHost . '");';
} else {
$fileClass->updateFileManager('chmod', $fileLoc, $fileName, numClean($_GET['perms']), '', '', '');
}
// Local
} else {
chmod($file, octdec(numClean($_GET['perms'])));
$fileClass->updateFileManager('chmod', $fileLoc, $fileName, numClean($_GET['perms']), '', '', '');
}
if (!$demoMode && is_writable($file)) {
chmod($file, octdec(numClean($_GET['perms'])));
$fileClass->updateFileManager('chmod', $fileLoc, $fileName, numClean($_GET['perms']), '', '', '');
$finalAction = "perms";
// Run any custom processes
$extraProcessesClass = new ExtraProcesses($fileLoc, $fileName);
@@ -474,7 +381,7 @@ if (!$error && "perms" === $_GET['action']) {
// CHECK FOR A FILE/DIR
// ====================
if (!isset($ftpSite) && !$error && "checkExists" === $_GET['action']) {
if (!$error && "checkExists" === $_GET['action']) {
// This action is called under seperate AJAX call and the responseText object stored in ICEcoder.lastFileDirCheckStatusObj
// Nothing really done here though, we do something with the responseText
$finalAction = "checkExists";

View File

@@ -1,215 +0,0 @@
<?php
die("FTP Manager now offline");
include "headers.php";
include "settings.php";
$t = $text['ftp-manager'];
// If we have an action to perform
if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset($_GET['action'])) {
// Get our old FTP sites & user settings
$oldFTPSites = $ICEcoder["ftpSites"];
$settingsContents = getData("../data/" . $settingsFile);
// ========
// CHOOSING
// ========
if ("choose" === $_GET['action']) {
// Set the site ref in session, hide the popup and reload the file manager
$_SESSION['ftpSiteRef'] = numClean($_GET['ftpSiteRef']);
// Hide this popup and reload file manager
echo "<script>parent.parent.ICEcoder.showHide('hide', parent.document.getElementById('blackMask')); parent.parent.ICEcoder.refreshFileManager();</script>";
} else {
// Start creating a new chunk for the FTP sites
$settingsNew = '"ftpSites" => array(
';
}
// ======
// ADDING
// ======
if ($_GET['action']=="add") {
// Add the new FTP site
if ($_POST['ftpSiteNEW'] != "") {
$settingsNew .= ' array(
"site" => "' . injClean($_POST['ftpSiteNEW']) . '",
"host" => "' . injClean($_POST['ftpHostNEW']) . '",
"user" => "' . injClean($_POST['ftpUserNEW']) . '",
"pass" => "' . injClean($_POST['ftpPassNEW']) . '",
"pasv" => ' . injClean($_POST['ftpPASVNEW']) . ',
"mode" => "' . injClean($_POST['ftpModeNEW']) . '",
"root" => "' . injClean($_POST['ftpRootNEW']) . '"
),
';
}
}
// ===============================================
// UPDATING & REMOVING PLUS UPDATE CONFIG SETTINGS
// ===============================================
if ("choose" !== $_GET['action'] && "edit" !== $_GET['action']) {
// Look at each of the existing FTP sites
for ($i = 0; $i < count($oldFTPSites); $i++) {
// Updating
if ("update" === $_GET['action'] && $i == $_GET['ftpSiteRef']) {
$settingsNew .= ' array(
"site" => "' . injClean($_POST['ftpSiteNEW']) . '",
"host" => "' . injClean($_POST['ftpHostNEW']) . '",
"user" => "' . injClean($_POST['ftpUserNEW']) . '",
"pass" => "' . injClean($_POST['ftpPassNEW']) . '",
"pasv" => ' . injClean($_POST['ftpPASVNEW']) . ',
"mode" => "' . injClean($_POST['ftpModeNEW']) . '",
"root" => "' . injClean($_POST['ftpRootNEW']) . '"
),
';
// Deleting
} elseif ("remove" === $_GET['action'] && $i == $_GET['ftpSiteRef']) {
// Do nothing, so we ignore this entry now
// Entry is as before
} else {
$settingsNew .= ' array(
"site" => "' . $oldFTPSites[$i]['site'] . '",
"host" => "' . $oldFTPSites[$i]['host'] . '",
"user" => "' . $oldFTPSites[$i]['user'] . '",
"pass" => "' . $oldFTPSites[$i]['pass'] . '",
"pasv" => ' . ($oldFTPSites[$i]['pasv'] ? 'true' : 'false') . ',
"mode" => "' . ('FTP_ASCII' === $oldFTPSites[$i]['mode'] ? 'FTP_ASCII' : 'FTP_BINARY') . '",
"root" => "' . $oldFTPSites[$i]['root'] . '"
),
';
}
}
// Rtrim off the last comma
$settingsNew = rtrim($settingsNew,',
');
$settingsNew .= '
),' . PHP_EOL;
// Now we have a new settingsNew string to use
// we can update the FTP sites in the settings file
// Identify the bit to replace
$repPosStart = strpos($settingsContents, '"ftpSites"');
$repPosEnd = strpos($settingsContents, '"tutorialOnLogin"');
// Compile our new settings
$settingsContents = substr($settingsContents, 0, $repPosStart) . $settingsNew . substr($settingsContents, $repPosEnd, strlen($settingsContents));
// Now update the config file
if (is_writeable("../data/" . $settingsFile)) {
$fh = fopen("../data/" . $settingsFile, 'w');
fwrite($fh, $settingsContents);
fclose($fh);
// Finally, reload the iFrame screen for the user
header("Location: ftp-manager.php?updatedFTPSites&csrf=" . $_SESSION["csrf"]);
echo "<script>window.location = 'ftp-manager.php?updatedFTPSites&csrf=' + parent.parent.ICEcoder.csrf;</script>";
die($t['Saving FTP sites']);
} else {
echo "<script>parent.parent.ICEcoder.message('" . $t['Cannot update config...'] . " data/" . $settingsFile . " " . $t['and try again'] . "');</script>";
}
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>ICEcoder <?php echo $ICEcoder["versionNo"];?> FTP manager</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="robots" content="noindex, nofollow">
<link rel="stylesheet" type="text/css" href="../assets/css/resets.css?microtime=<?php echo microtime(true);?>">
<link rel="stylesheet" type="text/css" href="../assets/css/ftp-manager.css?microtime=<?php echo microtime(true);?>">
</head>
<body class="ftpManager" onkeyup="parent.ICEcoder.handleModalKeyUp(event, 'ftpManager')" onload="this.focus();">
<h1><?php echo $t['ftp manager'];?></h1>
<div style="display: inline-block; width: 620px; height: 440px; overflow-y: auto">
<?php
$ftpSites = $ICEcoder['ftpSites'];
if (count($ftpSites) > 0) {
?>
<div style="display: inline-block; width: 600px; margin-bottom: 30px">
<h2><?php echo $t['Choose existing site'];?></h2><br>
<form id="ftpUpdateForm" action="ftp-manager.php?action=update" method="POST">
<table style="width: 100%">
<?php
for ($i = 0; $i < count($ftpSites); $i++) {
echo '<tr>';
echo '<td style="padding: 10px 10px 8px 0">' . $ftpSites[$i]['site'] . '</td>';
echo '<td style="padding: 10px 10px 8px 0">' . $ftpSites[$i]['host'] . '</td>';
echo '<td style="padding: 10px 10px 8px 0"><a href="ftp-manager.php?action=edit&ftpSiteRef=' . $i . '&csrf=' . $_SESSION["csrf"] . '" class="blue">Edit</a></td>';
echo '<td style="padding: 10px 10px 8px 0"><a href="ftp-manager.php?action=remove&ftpSiteRef=' . $i . '&csrf=' . $_SESSION["csrf"] . '" class="blue" onclick="return parent.parent.ICEcoder.ask(\'' . $t['Are you sure...'] . '\')">Delete</a></td>';
echo '<td style="padding: 2px 20px 8px 0; text-align: right"><div style="display: inline-block; padding: 5px; margin-top: 4px; background: #2187e7; color: #fff; font-size: 12px; cursor: pointer" onclick="window.location=\'ftp-manager.php?action=choose&ftpSiteRef=' . $i . '&csrf=' . $_SESSION["csrf"] . '\'">' . $t['Choose'] . '</div></td>';
echo '</tr>';
}
?>
</table>
<input type="hidden" name="csrf" value="<?php echo $_SESSION["csrf"]; ?>">
</form>
</div>
<?php
}
?>
<div style="display: inline-block; width: 600px">
<h2><?php echo isset($_GET['action']) && "edit" === $_GET['action'] ? $t['Edit site'] : $t['Add new site'];?></h2><br>
<form id="ftpAddEditForm" action="ftp-manager.php?action=<?php echo isset($_GET['action']) && "edit" === $_GET['action'] ? "update&ftpSiteRef=" . numClean($_GET['ftpSiteRef']) : "add";?>" method="POST">
<table>
<tr>
<td><?php echo $t['Site base'];?> <span class="info" title="<?php echo $t['eg http://yourdomain.com'];?>">[?]</span></td>
<td><?php echo $t['Host'];?> <span class="info" title="<?php echo $t['eg ftp.yourdomain.com'];?>">[?]</span></td>
</tr>
<tr>
<td style="padding: 0 10px 8px 0"><input type="text" name="ftpSiteNEW" value="<?php if (isset($_GET['action']) && "edit" === $_GET['action']) {echo $ICEcoder['ftpSites'][numClean($_GET['ftpSiteRef'])]['site'];};?>" style="width: 272px"></td>
<td style="padding: 0 0 8px 0"><input type="text" name="ftpHostNEW" value="<?php if (isset($_GET['action']) && "edit" === $_GET['action']) {echo $ICEcoder['ftpSites'][numClean($_GET['ftpSiteRef'])]['host'];};?>" style="width: 272px"></td>
</tr>
<tr>
<td><?php echo $t['Username'];?> <span class="info" title="<?php echo $t['eg user123'];?>">[?]</span></td>
<td><?php echo $t['Password'];?> <span class="info" title="<?php echo $t['eg pass123'];?>">[?]</span></td>
</tr>
<tr>
<td style="padding: 0 10px 8px 0"><input type="text" name="ftpUserNEW" value="<?php if (isset($_GET['action']) && "edit" === $_GET['action']) {echo $ICEcoder['ftpSites'][numClean($_GET['ftpSiteRef'])]['user'];};?>" style="width: 272px"></td>
<td style="padding: 0 0 8px 0"><input type="password" name="ftpPassNEW" value="<?php if (isset($_GET['action']) && "edit" === $_GET['action']) {echo $ICEcoder['ftpSites'][numClean($_GET['ftpSiteRef'])]['pass'];};?>" style="width: 272px"></td>
</tr>
<tr>
<td><?php echo $t['PASV and mode'];?> <span class="info" title="<?php echo $t['Use PASV mode...'];?>">[?]</span></td>
<td><?php echo $t['Root'];?> <span class="info" title="<?php echo $t['eg /htdocs'];?>">[?]</span></td>
</tr>
<tr>
<td style="padding: 0 10px 8px 0">
<select name="ftpPASVNEW">
<option value="false"<?php echo isset($_GET['action']) && "edit" === $_GET['action'] && $ICEcoder['ftpSites'][$_GET['ftpSiteRef']]['pasv'] == false ? " selected" : "";?>><?php echo $t['PASV connection off'];?></option>
<option value="true"<?php echo isset($_GET['action']) && "edit" === $_GET['action'] && $ICEcoder['ftpSites'][$_GET['ftpSiteRef']]['pasv'] == true ? " selected" : "";?>><?php echo $t['PASV connection on'];?></option>
</select>
<select name="ftpModeNEW">
<option value="FTP_ASCII"<?php echo isset($_GET['action']) && "edit" === $_GET['action'] && $ICEcoder['ftpSites'][$_GET['ftpSiteRef']]['mode'] == "FTP_ASCII" ? " selected" : "";?>><?php echo $t['ASCII transfer'];?></option>
<option value="FTP_BINARY"<?php echo isset($_GET['action']) && "edit" === $_GET['action'] && $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']) && "edit" === $_GET['action']) {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']) && "edit" === $_GET['action'] ? $t['Update'] : $t['Add'];?></div></td>
</tr>
</table>
<input type="hidden" name="csrf" value="<?php echo $_SESSION["csrf"]; ?>">
</form>
</div>
</div>
</body>
</html>

View File

@@ -1,10 +1,6 @@
<?php
require "icecoder.php";
use ICEcoder\FTP;
$ftpClass = new FTP;
if (!$_SESSION['loggedIn']) {
header("Location: ../");
die();
@@ -32,25 +28,8 @@ if ("/" === $location) {
$location = "";
};
$dirArray = $filesArray = $finalArray = [];
// Get dir/file list over FTP
if (isset($ftpSite)) {
$ftpClass->ftpStart();
// Show user warning if no good connection
if (!$ftpConn || !$ftpLogin) {
die('<script>parent.parent.ICEcoder.message("Sorry, no FTP connection to ' . $ftpHost . ' for user ' . $ftpUser . '");</script>');
exit;
}
// Get our simple and detailed lists and close the FTP connection
$ftpList = $ftpClass->ftpGetList($ftpConn, $ftpRoot . $location);
$finalArray = $ftpList['simpleList'];
$ftpItems = $ftpList['detailedList'];
$ftpClass->ftpEnd();
// or get local list
} else {
$finalArray = scanDir($scanDir . $location);
}
$dirArray = $filesArray = [];
$finalArray = scanDir($scanDir . $location);
foreach($finalArray as $entry) {
$canAdd = true;
@@ -59,20 +38,14 @@ foreach($finalArray as $entry) {
$canAdd = false;
}
}
// Only applicable for local dir, ignoring ICEcoder's dir
if (!isset($ftpSite) && $docRoot . $iceRoot . $location . "/" . $entry === $docRoot . $ICEcoderDir) {
// Ignore ICEcoder's dir
if ($docRoot . $iceRoot . $location . "/" . $entry === $docRoot . $ICEcoderDir) {
$canAdd = false;
}
if ("." !== $entry && ".." !== $entry && $canAdd) {
if (!isset($ftpSite)) {
is_dir($docRoot . $iceRoot . $location . "/".$entry)
is_dir($docRoot . $iceRoot . $location . "/".$entry)
? array_push($dirArray, $location . "/" . $entry)
: array_push($filesArray, $location . "/" . $entry);
} else {
"directory" === $ftpItems[$entry]['type']
? array_push($dirArray, $location . "/" . $entry)
: array_push($filesArray, $location. "/" . $entry);
}
}
}
natcasesort($dirArray);
@@ -81,11 +54,7 @@ natcasesort($filesArray);
$finalArray = array_merge($dirArray, $filesArray);
for ($i = 0; $i < count($finalArray); $i++) {
$fileFolderName = str_replace("\\", "/", $finalArray[$i]);
if (!isset($ftpSite)) {
$type = is_dir($docRoot . $iceRoot . $fileFolderName) ? "folder" : "file";
} else {
$type = "directory" === $ftpItems[basename($fileFolderName)]['type'] ? "folder" : "file";
}
$type = is_dir($docRoot . $iceRoot . $fileFolderName) ? "folder" : "file";
if ("file" === $type) {
// Get extension (prefix 'ext-' to prevent invalid classes from extensions that begin with numbers)
$ext = "ext-" . pathinfo($docRoot . $iceRoot . $fileFolderName, PATHINFO_EXTENSION);
@@ -113,25 +82,9 @@ for ($i = 0; $i < count($finalArray); $i++) {
(("folder" === $type) ? " parent.ICEcoder.openCloseDir(this,$loadParam);" : "") .
" if (/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent)) {parent.ICEcoder.openFile()}}\" style=\"position: relative; left:-22px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span id=\"".str_replace($docRoot,"",str_replace("/","|",$fileFolderName))."\">".xssClean(basename($fileFolderName),"html")."</span> ";
if (!isset($ftpSite)) {
$thisPermVal = "Windows" !== $serverType ? intval(substr(sprintf('%o', fileperms($docRoot . $iceRoot . $fileFolderName)), -3)) : 0;
} else {
// Work out perms value
$thisPermVal = 0;
$r = $ftpItems[basename($fileFolderName)]['rights'];
// Owner
$thisPermVal += "r" === substr($r,1,1) ? 400 : 0;
$thisPermVal += "w" === substr($r,2,1) ? 200 : 0;
$thisPermVal += "x" === substr($r,3,1) ? 100 : 0;
// Group
$thisPermVal += "r" === substr($r,4,1) ? 40 : 0;
$thisPermVal += "w" === substr($r,5,1) ? 20 : 0;
$thisPermVal += "x" === substr($r,6,1) ? 10 : 0;
// Public
$thisPermVal += "r" === substr($r,7,1) ? 4 : 0;
$thisPermVal += "w" === substr($r,8,1) ? 2 : 0;
$thisPermVal += "x" === substr($r,9,1) ? 1 : 0;
}
$thisPermVal = "Windows" !== $serverType
? intval(substr(sprintf('%o', fileperms($docRoot . $iceRoot . $fileFolderName)), -3))
: 0;
$permColors = 777 === $thisPermVal ? 'background: #800; color: #eee' : 'color: #888';
echo '<span style="' . $permColors . '; font-size: 8px" id="' . str_replace($docRoot, "", str_replace("/", "|", $fileFolderName)) . '_perms">';
echo 0 !== $thisPermVal ? $thisPermVal : '';

View File

@@ -1,36 +0,0 @@
<?php
include_once "settings.php" ;
$text = $_SESSION['text'];
$t = $text['settings-update'];
// Update our 'root' value to be blank
// which resets the file manager to localhost root again
if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn']) {
$settingsContents = getData("../data/" . $settingsFile);
// Replace our root var
$repPosStart = strpos($settingsContents, '"root"');
$repPosEnd = strpos($settingsContents, '"checkUpdates"');
// Compile our new settings
$settingsContents =
substr($settingsContents, 0, $repPosStart).
'"root" => "",'.PHP_EOL.
substr($settingsContents, ($repPosEnd), strlen($settingsContents));
// Now update the config file
if (is_writeable("../data/" . $settingsFile)) {
$fh = fopen("../data/" . $settingsFile, 'w');
fwrite($fh, $settingsContents);
fclose($fh);
// Clear any FTP session we may have
$_SESSION['ftpSiteRef'] = false;
// Now we've reset the root path to localhost root, refresh the file manager to show it
echo "<script>parent.parent.ICEcoder.refreshFileManager();</script>";
} else {
echo "<script>parent.parent.ICEcoder.message('" . $t['Cannot update config'] . " data/" . $settingsFile . " " . $t['and try again'] . "');</script>";
}
?>
<?php
;};

View File

@@ -3,7 +3,6 @@
require_once "../classes/_ExtraProcesses.php";
require_once "../classes/Backup.php";
require_once "../classes/File.php";
require_once "../classes/FTP.php";
require_once "../classes/Settings.php";
require_once "../classes/System.php";
require_once "../classes/URL.php";

View File

@@ -266,15 +266,11 @@ function getVersionsCount($fileLoc, $fileName) {
$backupDateDirs = [];
// Establish the base, host and date dirs within...
$backupDirBase = str_replace("\\", "/", dirname(__FILE__)) . "/../data/backups/";
$backupDirHost = isset($ftpSite) ? parse_url($ftpSite, PHP_URL_HOST) : "localhost";
// check if folder exists if local before enumerating contents
if (false === isset($ftpSite)) {
if (true === is_dir($backupDirBase . $backupDirHost)) {
$backupDateDirs = scandir($backupDirBase . $backupDirHost, 1);
}
} else {
$backupDateDirs = scandir($backupDirBase . $backupDirHost, 1);
}
$backupDirHost = "localhost";
// check if folder exists if local before enumerating contents
if (true === is_dir($backupDirBase . $backupDirHost)) {
$backupDateDirs = scandir($backupDirBase . $backupDirHost, 1);
}
// Get rid of . and .. from date dirs array
for ($i = 0; $i < count($backupDateDirs); $i++) {
if ($backupDateDirs[$i] === "." || $backupDateDirs[$i] === "..") {

View File

@@ -198,7 +198,7 @@ if (true === isset($_GET['tab'])) {
<?php
// Display number of days backups available
$backupDirBase = str_replace("\\", "/", dirname(__FILE__)) . "/../data/backups/";
$backupDirHost = true === isset($ftpSite) ? parse_url($ftpSite, PHP_URL_HOST) : "localhost";
$backupDirHost = "localhost";
$backupDirsList = scandir($backupDirBase . $backupDirHost);
// Remove . and .. from array
for ($i = 0; $i < count($backupDirsList); $i++) {

View File

@@ -66,7 +66,6 @@ if (false === $demoMode && true === isset($_SESSION['loggedIn']) && true === $_S
"bugFileCheckTimer" => intval($_POST['bugFileCheckTimer']) >= 0 ? intval($_POST['bugFileCheckTimer']) : 0,
"bugFileMaxLines" => intval($_POST['bugFileMaxLines']),
"plugins" => $currentSettings['plugins'],
"ftpSites" => $currentSettings['ftpSites'],
"tutorialOnLogin" => isset($_POST['tutorialOnLogin']),
"previousFiles" => $currentSettings['previousFiles'],
"last10Files" => $currentSettings['last10Files'],

View File

@@ -188,18 +188,6 @@ if (false === in_array(getUserIP(), $_SESSION['allowedIPs']) && false === in_arr
include(dirname(__FILE__) . "/requirements.php");
};
// Establish any FTP site to use
if (true === isset($_SESSION['ftpSiteRef']) && false !== $_SESSION['ftpSiteRef']) {
$ftpSiteArray = $ICEcoder['ftpSites'][$_SESSION['ftpSiteRef']];
$ftpSite = $ftpSiteArray['site']; // FTP site domain, eg http://yourdomain.com
$ftpHost = $ftpSiteArray['host']; // FTP host, eg ftp.yourdomain.com
$ftpUser = $ftpSiteArray['user']; // FTP username
$ftpPass = $ftpSiteArray['pass']; // FTP password
$ftpPasv = $ftpSiteArray['pasv']; // FTP account requires PASV mode?
$ftpMode = $ftpSiteArray['mode'] == "FTP_ASCII" ? FTP_ASCII : FTP_BINARY; // FTP transfer mode, FTP_ASCII or FTP_BINARY
$ftpRoot = $ftpSiteArray['root']; // FTP root dir to use as base, eg /htdocs
}
// Save currently opened files in previousFiles and last10Files arrays
include(dirname(__FILE__) . "/settings-save-current-files.php");

View File

@@ -1,7 +1,7 @@
<?php
/*
a:43:{s:9:"versionNo";s:3:"8.0";s:16:"configCreateDate";i:0;s:4:"root";s:0:"";s:12:"checkUpdates";b:1;s:13:"openLastFiles";b:1;s:16:"updateDiffOnSave";b:1;s:12:"languageUser";s:11:"english.php";s:11:"backupsKept";b:1;s:11:"backupsDays";i:14;s:11:"deleteToTmp";b:1;s:16:"findFilesExclude";a:9:{i:0;s:4:".doc";i:1;s:4:".gif";i:2;s:4:".jpg";i:3;s:5:".jpeg";i:4;s:4:".pdf";i:5;s:4:".png";i:6;s:4:".swf";i:7;s:4:".xml";i:8;s:4:".zip";}s:10:"codeAssist";b:1;s:11:"visibleTabs";b:0;s:9:"lockedNav";b:1;s:17:"tagWrapperCommand";s:8:"ctrl+alt";s:12:"autoComplete";s:8:"keypress";s:8:"password";s:0:"";s:11:"bannedFiles";a:2:{i:0;s:4:".git";i:1;s:12:"node_modules";}s:11:"bannedPaths";a:2:{i:0;s:26:"/var/www/sites/all/modules";i:1;s:28:"/var/www/sites/default/files";}s:10:"allowedIPs";a:1:{i:0;s:1:"*";}s:14:"autoLogoutMins";i:0;s:5:"theme";s:7:"default";s:8:"fontSize";s:4:"13px";s:12:"lineWrapping";b:0;s:11:"lineNumbers";b:1;s:17:"showTrailingSpace";b:1;s:13:"matchBrackets";b:1;s:13:"autoCloseTags";b:1;s:17:"autoCloseBrackets";b:1;s:10:"indentType";s:6:"spaces";s:10:"indentAuto";b:1;s:10:"indentSize";i:4;s:18:"pluginPanelAligned";s:4:"left";s:14:"scrollbarStyle";s:7:"overlay";s:12:"bugFilePaths";a:0:{}s:17:"bugFileCheckTimer";i:0;s:15:"bugFileMaxLines";i:0;s:7:"plugins";a:0:{}s:8:"ftpSites";a:0:{}s:15:"tutorialOnLogin";b:1;s:13:"previousFiles";a:0:{}s:11:"last10Files";a:0:{}s:13:"favoritePaths";a:0:{}}
a:42:{s:9:"versionNo";s:3:"8.0";s:16:"configCreateDate";i:0;s:4:"root";s:0:"";s:12:"checkUpdates";b:1;s:13:"openLastFiles";b:1;s:16:"updateDiffOnSave";b:1;s:12:"languageUser";s:11:"english.php";s:11:"backupsKept";b:1;s:11:"backupsDays";i:14;s:11:"deleteToTmp";b:1;s:16:"findFilesExclude";a:9:{i:0;s:4:".doc";i:1;s:4:".gif";i:2;s:4:".jpg";i:3;s:5:".jpeg";i:4;s:4:".pdf";i:5;s:4:".png";i:6;s:4:".swf";i:7;s:4:".xml";i:8;s:4:".zip";}s:10:"codeAssist";b:1;s:11:"visibleTabs";b:0;s:9:"lockedNav";b:1;s:17:"tagWrapperCommand";s:8:"ctrl+alt";s:12:"autoComplete";s:8:"keypress";s:8:"password";s:0:"";s:11:"bannedFiles";a:2:{i:0;s:4:".git";i:1;s:12:"node_modules";}s:11:"bannedPaths";a:2:{i:0;s:26:"/var/www/sites/all/modules";i:1;s:28:"/var/www/sites/default/files";}s:10:"allowedIPs";a:1:{i:0;s:1:"*";}s:14:"autoLogoutMins";i:0;s:5:"theme";s:7:"default";s:8:"fontSize";s:4:"13px";s:12:"lineWrapping";b:0;s:11:"lineNumbers";b:1;s:17:"showTrailingSpace";b:1;s:13:"matchBrackets";b:1;s:13:"autoCloseTags";b:1;s:17:"autoCloseBrackets";b:1;s:10:"indentType";s:6:"spaces";s:10:"indentAuto";b:1;s:10:"indentSize";i:4;s:18:"pluginPanelAligned";s:4:"left";s:14:"scrollbarStyle";s:7:"overlay";s:12:"bugFilePaths";a:0:{}s:17:"bugFileCheckTimer";i:0;s:15:"bugFileMaxLines";i:0;s:7:"plugins";a:0:{}s:15:"tutorialOnLogin";b:1;s:13:"previousFiles";a:0:{}s:11:"last10Files";a:0:{}s:13:"favoritePaths";a:0:{}}
*/
?>