Skip to content
This repository was archived by the owner on Dec 14, 2023. It is now read-only.

Increase readability #741

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Reverting the commig 6ed2edb "Removing unnecessary semi-colons"
the commit had unintende consequences ( broke the file manager, probably
more stuff )
  • Loading branch information
rotelok committed Jun 17, 2018
commit 5c8aa37cdf1e30b460394640038afa45a447349e
25 changes: 13 additions & 12 deletions editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,28 +23,28 @@
<?php
if (file_exists(__DIR__."/plugins/jshint/jshint-2.5.6.min.js")) {
echo '<script src="plugins/jshint/jshint-2.5.6.min.js?microtime='.microtime(true).'></script>';
} ?>
};?>
<script src="lib/mmd.js?microtime=<?php echo microtime(true);?>"></script>
<link rel="stylesheet" href="<?php echo $ICEcoder["codeMirrorDir"]; ?>/addon/fold/foldgutter.css?microtime=<?php echo microtime(true);?>">
<link rel="stylesheet" href="<?php echo $ICEcoder["codeMirrorDir"]; ?>/addon/scroll/simplescrollbars.css?microtime=<?php echo microtime(true);?>">
<?php
if (file_exists(__DIR__."/plugins/emmet/emmet.min.js")) {
echo '<script src="plugins/emmet/emmet.min.js?microtime='.microtime(true).'"></script>';
} ?>
};?>
<?php
if (file_exists(__DIR__."/plugins/pesticide/pesticide.js")) {
echo '<script src="plugins/pesticide/pesticide.js?microtime='.microtime(true).'"></script>';
} ?>
};?>
<?php
if (file_exists(__DIR__."/plugins/stats.js/stats.min.js")) {
echo '<script src="plugins/stats.js/stats.min.js?microtime='.microtime(true).'"></script>';
} ?>
};?>
<?php
if (file_exists(__DIR__."/plugins/responsive-helper/responsive-helper.js")) {
echo '<script src="plugins/responsive-helper/responsive-helper.js?microtime='.microtime(true).'"></script>';
} ?>
};?>
<link rel="stylesheet" href="<?php
if ($ICEcoder["theme"]=="default") {echo 'lib/editor.css';} else {echo $ICEcoder["codeMirrorDir"].'/theme/'.$ICEcoder["theme"].'.css';}
if ($ICEcoder["theme"]=="default") {echo 'lib/editor.css';} else {echo $ICEcoder["codeMirrorDir"].'/theme/'.$ICEcoder["theme"].'.css';};
echo "?microtime=".microtime(true);
if (in_array($ICEcoder["theme"],array("3024-day","base16-light","eclipse","elegant","mdn-like","neat","neo","paraiso-light","solarized","the-matrix","xq-light"))) {
$activeLineBG = "#ccc";
Expand Down Expand Up @@ -130,7 +130,7 @@
<div class="trialBarContainer"><div class="trialBarRemaining" id="trialBarRemaining"></div><br>
<div class="trialBarText"><?php echo $tDaysRemaining;?> <?php echo $t['days left'];?> - <a href="lib/login.php?get=code&csrf=<?php echo $_SESSION["csrf"];?>" target="_parent">Unlock now</a></div>
</div>
<?php } ?>
<?php ;}; ?>

<h2><?php echo $t['files'];?></h2>
<span class="heading"><?php echo $t['Last 10 files...'];?></span><br>
Expand All @@ -147,9 +147,10 @@
echo '<a style="cursor:pointer" onClick="top.ICEcoder.openFile(\''.str_replace($docRoot,"",str_replace("|","/",$last10FilesArray[$i])).'\')">';
echo str_replace($docRoot,"",str_replace("|","/",$last10FilesArray[$i]));
echo '</a></li>';
if ($i<count($last10FilesArray)-1) {echo PHP_EOL;}
}
} ?></ul>
if ($i<count($last10FilesArray)-1) {echo PHP_EOL;};
}
}
;?></ul>
</div>

<div style="clear: both"></div>
Expand All @@ -174,8 +175,8 @@
<a nohref onclick="top.ICEcoder.filesFrame.contentWindow.frames['testControl'].location.href = 'test'" style="color: #fff; cursor: pointer"><?php echo $t['Run unit tests'];?></a><div id="unitTestResults"></div>
</div>
<?php
}
?>
;};
?>
<div style="float: left">
<h2><?php echo $t['dev mode'];?> <?php echo $ICEcoder['devMode'] ? "on" : "off";?></h2>
<span class="heading"><?php echo $t['Status'];?>:</span><br>
Expand Down
7 changes: 3 additions & 4 deletions files.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
<link rel="stylesheet" type="text/css" href="lib/files.css?microtime=<?php echo microtime(true);?>">
<link rel="stylesheet" type="text/css" href="lib/file-types.css?microtime=<?php echo microtime(true);?>">
<link rel="stylesheet" type="text/css" href="lib/file-type-icons.css?microtime=<?php echo microtime(true);?>">
<script src="lib/ice-coder<?php if (!$ICEcoder['devMode']) {echo '.min';}
echo ".js?microtime=".microtime(true);?>" type="text/javascript"></script>
<script src="lib/ice-coder<?php if (!$ICEcoder['devMode']) {echo '.min';}; echo ".js?microtime=".microtime(true);?>" type="text/javascript"></script>
<!--Updated via settings so must remain 4th stylesheet//-->
<style>
ul.fileManager li a span { font-size: <?php echo $ICEcoder["fontSize"];?>; }
Expand Down Expand Up @@ -46,7 +45,7 @@
echo $iceRoot == "" ? $t['ROOT'] : trim($iceRoot,"/");
$thisPermVal = $serverType=="Linux" ? substr(sprintf('%o', fileperms($docRoot.$iceRoot)), -3) : "";
$permColors = $thisPermVal == 777 ? 'background: #800; color: #eee' : 'color: #888';
?></span> <span style="<?php echo $permColors;?>; font-size: 8px" id="|_perms"><?php echo $thisPermVal; ?></span></a></li><?php
?></span> <span style="<?php echo $permColors;?>; font-size: 8px" id="|_perms"><?php echo $thisPermVal;;?></span></a></li><?php
// tree file items generated by the iFrame 'fileControl' below which loads in the items at location=| (ie, the root)
?>
</ul>
Expand All @@ -63,4 +62,4 @@

</body>

</html>
</html>
16 changes: 8 additions & 8 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
$icv = $icvInfo[0];
$icvI = str_replace('"','\\\'',$icvInfo[1]);
$thisV = $ICEcoder["versionNo"];
if (strpos($thisV,"beta")>-1 && !strpos($icv,"beta") && str_replace(" beta","",$thisV) == $icv) {$thisV-=0.1;}
if ($thisV<$icv) {
if (strpos($thisV,"beta")>-1 && !strpos($icv,"beta") && str_replace(" beta","",$thisV) == $icv) {$thisV-=0.1;};
if ($thisV<$icv) {
$updateMsg = ";top.ICEcoder.dataMessage('<b>".$t['UPDATE INFO'].":</b> ICEcoder v ".$icv." ".$t['now available'].". (".$t['Your version is']." v ".$ICEcoder["versionNo"].").<br><br><a onclick=\\'top.ICEcoder.update()\\' style=\\'color:#fff; background: #b00; padding: 5px; text-decoration: none; cursor: pointer\\'>".$t['Update now']."</a><br><br>".$icvI."');";
}
}
Expand All @@ -36,7 +36,7 @@
<meta name="viewport" content="width=device-width, initial-scale=0.5, user-scalable=no">
<link rel="stylesheet" type="text/css" href="lib/ice-coder.css?microtime=<?php echo microtime(true);?>">
<link rel="stylesheet" href="<?php
if ($ICEcoder["theme"]=="default") {echo 'lib/editor.css';} else {echo $ICEcoder["codeMirrorDir"].'/theme/'.$ICEcoder["theme"].'.css';}
if ($ICEcoder["theme"]=="default") {echo 'lib/editor.css';} else {echo $ICEcoder["codeMirrorDir"].'/theme/'.$ICEcoder["theme"].'.css';};
echo "?microtime=".microtime(true);
?>">
<link rel="icon" type="image/png" href="favicon.png">
Expand Down Expand Up @@ -69,7 +69,7 @@
?>
}
</script>
<script language="JavaScript" src="lib/ice-coder<?php if (!$ICEcoder['devMode']) {echo '.min';} ?>.js?microtime=<?php echo microtime(true);?>"></script>
<script language="JavaScript" src="lib/ice-coder<?php if (!$ICEcoder['devMode']) {echo '.min';};?>.js?microtime=<?php echo microtime(true);?>"></script>
<script src="lib/mmd.js?microtime=<?php echo microtime(true);?>"></script>
<script src="lib/draggabilly.pkgd.min.js?microtime=<?php echo microtime(true);?>"></script>
<script src="farbtastic/farbtastic.js?microtime=<?php echo microtime(true);?>"></script>
Expand Down Expand Up @@ -116,7 +116,7 @@
echo "top.ICEcoder.githubAuthTokenSet = true;";
}
echo "top.ICEcoder.csrf = '".$_SESSION["csrf"]."';";
?>ICEcoder.init()<?php echo $updateMsg.$onLoadExtras;?>;top.ICEcoder.content.style.visibility='visible';top.ICEcoder.filesFrame.contentWindow.frames['processControl'].location.href = 'processes/on-load.php';<?php if(isset($_GET["display"]) && $_GET["display"] == "updated") {echo "top.ICEcoder.updated();";} ?>" onResize="ICEcoder.setLayout()" onKeyDown="return ICEcoder.interceptKeys('coder',event);" onKeyUp="parent.ICEcoder.resetKeys(event);" onBlur="parent.ICEcoder.resetKeys(event);">
?>ICEcoder.init()<?php echo $updateMsg.$onLoadExtras;?>;top.ICEcoder.content.style.visibility='visible';top.ICEcoder.filesFrame.contentWindow.frames['processControl'].location.href = 'processes/on-load.php';<?php if(isset($_GET["display"]) && $_GET["display"] == "updated") {echo "top.ICEcoder.updated();";};?>" onResize="ICEcoder.setLayout()" onKeyDown="return ICEcoder.interceptKeys('coder',event);" onKeyUp="parent.ICEcoder.resetKeys(event);" onBlur="parent.ICEcoder.resetKeys(event);">

<div id="blackMask" class="blackMask" onClick="if (!ICEcoder.overPopup) {ICEcoder.showHide('hide',this)}" onContextMenu="return false">
<div class="popupVCenter">
Expand Down Expand Up @@ -173,8 +173,8 @@
<?php
if (file_exists(__DIR__."/plugins/zip-it/index.php")) {
echo '<a href="javascript:top.ICEcoder.zipIt(top.ICEcoder.selectedFiles[top.ICEcoder.selectedFiles.length-1])" onMouseOver="ICEcoder.showFileMenu()">Zip It!</a>'.PHP_EOL;
}
?>
};
?>
<a href="javascript:top.ICEcoder.downloadFile(top.ICEcoder.selectedFiles[top.ICEcoder.selectedFiles.length-1])" onMouseOver="ICEcoder.showFileMenu()"><?php echo $t['Download'];?></a>
<div onMouseOver="ICEcoder.showFileMenu()" style="padding: 2px 0"><hr></div>
<a href="javascript:top.ICEcoder.propertiesScreen(top.ICEcoder.selectedFiles[top.ICEcoder.selectedFiles.length-1])" onMouseOver="ICEcoder.showFileMenu()"><?php echo $t['Properties'];?></a>
Expand Down Expand Up @@ -306,7 +306,7 @@
</form>
<form onSubmit="return ICEcoder.goToLine()">
<div class="codeAssist" title="<?php echo $t['Turn on/off...'];?>">
<input type="checkbox" name="codeAssist" id="codeAssist" class="codeAssistCheckbox" <?php if ($ICEcoder['codeAssist']) {echo 'checked ';} ?>>
<input type="checkbox" name="codeAssist" id="codeAssist" class="codeAssistCheckbox" <?php if ($ICEcoder['codeAssist']) {echo 'checked ';};?>>
<span class="codeAssistDisplay" id="codeAssistDisplay" style="background-position: <?php echo $ICEcoder['codeAssist'] ? "0" : "-16";?> 0" onClick="top.ICEcoder.codeAssistToggle()"></span> <?php echo $t['Code Assist'];?>
</div>
<div class="goLine"><?php echo $t['Go to Line'];?> <input type="text" name="goToLine" value="" id="goToLineNo" class="textbox goToLine">
Expand Down
42 changes: 21 additions & 21 deletions lib/file-control-xhr.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
$error = true;
$errorStr = "true";
$errorMsg = $t['Sorry, bad filename...'];
}
};

// If we have file(s) to work with...
if (!$error) {
Expand All @@ -56,8 +56,8 @@
if (strpos($allFiles[$i],$docRoot)===false && $_GET['action']!="getRemoteFile") {
$allFiles[$i]=str_replace("|","/",$docRoot.$iceRoot.$allFiles[$i]);
}
}
$file = implode(";",$allFiles);
};
$file = implode(";",$allFiles);

// Establish the $fileLoc and $fileName (used in single file cases, eg opening. Multiple file cases, eg deleting, is worked out in that loop)
$fileLoc = substr(str_replace($docRoot,"",$file),0,strrpos(str_replace($docRoot,"",$file),"/"));
Expand Down Expand Up @@ -85,8 +85,8 @@
$error = true;
$errorStr = "true";
$errorMsg = "Sorry! - problem with file requested";
}
}
};
}
}

$doNext = "";
Expand Down Expand Up @@ -526,7 +526,7 @@ function stitchChanges($fileLines) {
}
$doNext .= 'top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);';
}
}
};

// ==========
// NEW FOLDER
Expand Down Expand Up @@ -561,7 +561,7 @@ function stitchChanges($fileLines) {
$finalAction = "nothing";
}
$doNext .= 'top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);';
}
};

// ================
// MOVE FILE/FOLDER
Expand Down Expand Up @@ -611,7 +611,7 @@ function stitchChanges($fileLines) {
$finalAction = "nothing";
}
$doNext .= 'top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);';
}
};

// ==================
// RENAME FILE/FOLDER
Expand Down Expand Up @@ -645,7 +645,7 @@ function stitchChanges($fileLines) {
$finalAction = "nothing";
}
$doNext .= 'top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);';
}
};

// =================
// PASTE FILE/FOLDER
Expand Down Expand Up @@ -702,7 +702,7 @@ function stitchChanges($fileLines) {
$finalAction = "nothing";
}
$doNext .= 'top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);';
}
};

// ==============
// UPLOAD FILE(S)
Expand Down Expand Up @@ -767,7 +767,7 @@ function getDetails($fileArr) {

// Upload is not handled by XHR methods, but form post, so we need to manually trigger $doNext in a script tag
echo "<script>".$doNext."</script>";
}
};

// ========================
// DELETE FILE(S)/FOLDER(S)
Expand All @@ -782,8 +782,8 @@ function getDetails($fileArr) {
$itemType = $ftpFileDirInfo['type'] == "directory" ? "dir" : "file";
$itemPath = ltrim($fileLoc."/".$fileName,"/");
if (!$demoMode && ftpDelete($ftpConn,$itemType,$itemPath)) {
if ($fileLoc=="" || $fileLoc=="\\") {$fileLoc="/";}
// Reload file manager
if ($fileLoc=="" || $fileLoc=="\\") {$fileLoc="/";};
// Reload file manager
$doNext .= 'top.ICEcoder.selectedFiles=[];top.ICEcoder.updateFileManagerList(\'delete\',\''.$fileLoc.'\',\''.$fileName.'\');';
$finalAction = "delete";
// Run our custom processes
Expand Down Expand Up @@ -815,8 +815,8 @@ function getDetails($fileArr) {
}
$fileName = basename($fullPath);
$fileLoc = dirname(str_replace($docRoot,"",$fullPath));
if ($fileLoc=="" || $fileLoc=="\\") {$fileLoc="/";}
// Reload file manager
if ($fileLoc=="" || $fileLoc=="\\") {$fileLoc="/";};
// Reload file manager
$doNext .= 'top.ICEcoder.selectedFiles=[];top.ICEcoder.updateFileManagerList(\'delete\',\''.$fileLoc.'\',\''.$fileName.'\');';
$finalAction = "delete";
// Run our custom processes
Expand All @@ -828,7 +828,7 @@ function getDetails($fileArr) {
}
}
$doNext .= 'top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);';
}
};

// The function to recursively remove folders & files
function rrmdir($dir) {
Expand All @@ -852,7 +852,7 @@ function rrmdir($dir) {
? rename($dir,str_replace("\\","/",__DIR__)."/../tmp/.".str_replace(":","_",str_replace("/","_",$dir)))
: rmdir($dir);
}
}
};

// ======================
// REPLACE TEXT IN A FILE
Expand All @@ -873,7 +873,7 @@ function rrmdir($dir) {
$finalAction = "nothing";
}
$doNext .= 'top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);';
}
};

// ==========================
// GET CONTENTS OF REMOTE URL
Expand All @@ -896,7 +896,7 @@ function rrmdir($dir) {
$doNext .= 'top.ICEcoder.message(\''.$t['Sorry, could not...'].' '.$file.'\');';
}
$doNext .= 'top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);';
}
};

// =======================
// CHANGING FILE/DIR PERMS
Expand Down Expand Up @@ -931,7 +931,7 @@ function rrmdir($dir) {
$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
Expand All @@ -942,7 +942,7 @@ function rrmdir($dir) {
// 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
Expand Down
19 changes: 10 additions & 9 deletions lib/file-control.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<?php if ($_SESSION['githubDiff']) { ?>
<script src="github.js?microtime=<?php echo microtime(true);?>"></script>
<script src="underscore-min.js?microtime=<?php echo microtime(true);?>"></script>
<?php } ?>
<?php ;}; ?>
<script>
<?php
// Establish the filename/new filename
Expand Down Expand Up @@ -35,7 +35,7 @@
if (strpos($allFiles[$i],$docRoot)===false && $_GET['action']!="getRemoteFile") {
$allFiles[$i]=str_replace("|","/",$docRoot.$iceRoot.$allFiles[$i]);
}
}
};
$file = implode(";",$allFiles);

// Establish the $fileLoc and $fileName (used in single file cases, eg opening. Multiple file cases, eg deleting, is worked out in that loop)
Expand All @@ -60,7 +60,7 @@
($_GET['action']=="getRemoteFile" && strpos($allFiles[$i],"http") !== 0)
) {
die("top.ICEcoder.message('Sorry! - problem with file requested');</script>");
}
};
}

// If we're due to open a file...
Expand Down Expand Up @@ -123,12 +123,12 @@
echo 'fileType="image";fileName=\''.$fileLoc."/".$fileName.'\';';
} else {
echo 'fileType="other";window.open(\'http://'.$_SERVER['SERVER_NAME'].$fileLoc."/".$fileName.'\');';
}
} else {
};
} else {
echo 'fileType="nothing"; top.ICEcoder.message(\''.$t['Sorry'].', '.$fileLoc."/".$fileName.' '.$t['does not seem...'].'\');';
}

}
};


?>
Expand Down Expand Up @@ -181,7 +181,7 @@

top.ICEcoder.filesFrame.contentWindow.frames['processControl'].location.href = "github.php?action=read&repo=<?php echo $ghRemoteURL;?>&filePath=<?php echo $ghFilePath;?>&csrf="+top.ICEcoder.csrf;
}
<?php} ?>
<?php ;}; ?>

// Set the value & innerHTML of the code textarea to that of our loaded file plus make it visible (it's hidden on ICEcoder's load)
top.ICEcoder.switchMode();
Expand All @@ -206,8 +206,9 @@

top.ICEcoder.goToLine(<?php echo $lineNumber; ?>);
top.ICEcoder.loadingFile = false;
<?php}
?>
<?php
;};
?>
}
},4);
}
Expand Down
Loading