Removed restrictedFile, DOM ready update & tweak

You cannot get access to ICEcoder unless you have logged in, so
restrictedFiles is not needed anymore
Removed it and all instances of it's usage
Only updating pluginsContainer if it's a DOM elem
Change title tag of login/set password screen conditionally
This commit is contained in:
Matt Pass
2012-09-19 17:29:10 +01:00
parent ed0bad79ad
commit fd974c7bb7
6 changed files with 9 additions and 27 deletions

View File

@@ -12,7 +12,6 @@
<div title="Refresh" onClick="top.ICEcoder.refreshFileManager()" class="refresh"></div>
<?php
$ICEcoder["restrictedFiles"] = $_SESSION['restrictedFiles'];
$ICEcoder["bannedFiles"] = $_SESSION['bannedFiles'];
// Function to sort given values alphabetically
@@ -110,12 +109,6 @@ for ($i=0;$i<count($finalArray);$i++) {
echo "</ul>\n";
}
}
$restrictedFile=false;
for ($j=0;$j<count($ICEcoder["restrictedFiles"]);$j++) {
if (strpos($fileFolderName,$ICEcoder["restrictedFiles"][$j])!="") {
$restrictedFile=true;
}
}
if ($serverType=="Linux") {
$chmodInfo = substr(sprintf('%o', fileperms($docRoot.$iceRoot.$fileFolderName)), -3);
$fileAtts = '<span style="color: #888; font-size: 8px" id="'.str_replace($docRoot,"",str_replace("/","|",$fileFolderName)).'_perms">'.$chmodInfo.'</span>';

View File

@@ -9,7 +9,6 @@ $ICEcoder = array(
"visibleTabs" => false,
"lockedNav" => true,
"accountPassword" => "",
"restrictedFiles" => array("wp-",".php",".rb",".sql",".zip"),
"bannedFiles" => array("_coder","ICEcoder"),
"allowedIPs" => array("*"),
"plugins" => array(

View File

@@ -25,12 +25,6 @@ if ($_GET['action']=="load") {
if (strpos($fileName,".jpg")>0||strpos($fileName,".jpeg")>0||strpos($fileName,".gif")>0||strpos($fileName,".png")>0) {$fileType="image";};
if ($fileType=="text") {
$bannedFile=false;
for ($i=0;$i<count($ICEcoder["restrictedFiles"]);$i++) {
if (strpos($fileName,$ICEcoder["restrictedFiles"][$i])!="") {
$bannedFile=true;
}
}
if (file_exists($file)) {
echo '<script>fileType="text";';
echo 'top.ICEcoder.shortURL = top.ICEcoder.rightClickedFile = top.ICEcoder.thisFileFolderLink = "'.$fileLoc."/".$fileName.'";';

View File

@@ -101,15 +101,11 @@ if (startTab!=top.ICEcoder.selectedTab) {
if(is_dir($fullPath)) {
$ret .= phpGrep($q, $fullPath, $base);
} else if(stristr(file_get_contents($fullPath), $q)) {
$rFile = false;
$bFile = false;
for ($i=0;$i<count($ICEcoder["restrictedFiles"]);$i++) {
if (strpos($f,$ICEcoder['restrictedFiles'][$i])>0) {$rFile = true;};
}
for ($i=0;$i<count($ICEcoder['bannedFiles']);$i++) {
if (strpos($f,$ICEcoder['bannedFiles'][$i])>0) {$bFile = true;};
}
if (!$rFile && !$bFile) {
if (!$bFile) {
$ret .= "<a href=\\\"javascript:top.ICEcoder.openFile('".$fullPath."');top.ICEcoder.showHide('hide',top.document.getElementById('blackMask'))\\\">";
$ret .= str_replace($base,"",$fullPath)."</a><div id=\\\"foundCount".$r."\\\">Found ".substr_count(strtolower(file_get_contents($fullPath)),$q)." times</div>";
if (isset($_GET['replace'])) {

View File

@@ -98,8 +98,6 @@ new password <span style="font-size: 10px; color: #888">8 chars</span><br>
confirm password<br>
<input type="password" name="confirmPassword" onkeydown="showButton()"><br>
<br>
restricted files/folders<br>
<input type="text" onkeydown="document.settings.changedFileSettings.value='true';showButton()" name="restrictedFiles" value="<?php for($i=0;$i<=count($ICEcoder["restrictedFiles"])-1;$i++) {echo $ICEcoder["restrictedFiles"][$i]; if ($i<count($ICEcoder["restrictedFiles"])-1) {echo ', ';};}; ?>"><br>
banned files/folders<br>
<input type="text" onkeydown="document.settings.changedFileSettings.value='true';showButton()" name="bannedFiles" value="<?php for($i=0;$i<=count($ICEcoder["bannedFiles"])-1;$i++) {echo $ICEcoder["bannedFiles"][$i]; if ($i<count($ICEcoder["bannedFiles"])-1) {echo ', ';};}; ?>"><br>
<input type="hidden" name="changedFileSettings" value="false">

View File

@@ -51,14 +51,13 @@ if ($_SESSION['loggedIn'] && isset($_POST["theme"]) && $_POST["theme"]) {
$ICEcoder["visibleTabs"] = $_POST['visibleTabs'] ? "true" : "false";
$ICEcoder["lockedNav"] = $_POST['lockedNav'] ? "true" : "false";
if ($_POST['accountPassword']!="") {$ICEcoder["accountPassword"] = generateHash(strClean($_POST['accountPassword']));};
$ICEcoder["restrictedFiles"] = 'array("'.str_replace(',','","',str_replace(" ","",strClean($_POST['restrictedFiles']))).'")';
$ICEcoder["bannedFiles"] = 'array("'.str_replace(',','","',str_replace(" ","",strClean($_POST['bannedFiles']))).'")';
$ICEcoder["allowedIPs"] = 'array("'.str_replace(',','","',str_replace(" ","",strClean($_POST['allowedIPs']))).'")';
$ICEcoder["plugins"] = 'array('.PHP_EOL.' array('.PHP_EOL.' '.str_replace('====================','),'.PHP_EOL.' array(',$_POST['plugins']).'))';
$ICEcoder["theme"] = strClean($_POST['theme']);
$ICEcoder["tabWidth"] = numClean($_POST['tabWidth']);
$settingsArray = array("root","tabsIndent","checkUpdates","openLastFiles","findFilesExclude","codeAssist","visibleTabs","lockedNav","accountPassword","restrictedFiles","bannedFiles","allowedIPs","plugins","theme","tabWidth");
$settingsArray = array("root","tabsIndent","checkUpdates","openLastFiles","findFilesExclude","codeAssist","visibleTabs","lockedNav","accountPassword","bannedFiles","allowedIPs","plugins","theme","tabWidth");
$settingsNew = "";
for ($i=0;$i<count($settingsArray);$i++) {
$settingsNew .= '"'.$settingsArray[$i].'"'.PHP_EOL.' => ';
@@ -74,7 +73,7 @@ if ($_SESSION['loggedIn'] && isset($_POST["theme"]) && $_POST["theme"]) {
fclose($fh);
// OK, now the config file has been updated, update our current session with new arrays
$settingsArray = array("findFilesExclude","restrictedFiles","bannedFiles","allowedIPs");
$settingsArray = array("findFilesExclude","bannedFiles","allowedIPs");
for ($i=0;$i<count($settingsArray);$i++) {
$_SESSION[$settingsArray[$i]] = $ICEcoder[$settingsArray[$i]] = explode(",",str_replace(" ","",strClean($_POST[$settingsArray[$i]])));
}
@@ -100,7 +99,7 @@ if ($_SESSION['loggedIn']) {
}
// Setup our file security vars
$settingsArray = array("findFilesExclude","restrictedFiles","bannedFiles","allowedIPs");
$settingsArray = array("findFilesExclude","bannedFiles","allowedIPs");
for ($i=0;$i<count($settingsArray);$i++) {
if (!isset($_SESSION[$settingsArray[$i]])) {$_SESSION[$settingsArray[$i]] = $ICEcoder[$settingsArray[$i]];}
}
@@ -177,7 +176,7 @@ if ($_SESSION['loggedIn']) {
};
// If we're updating, replace the plugin display with our newly established one
echo "<script>top.document.getElementById('pluginsContainer').innerHTML = '".$pluginsDisplay."';</script>";
echo "<script>if(top.document.getElementById('pluginsContainer')) {top.document.getElementById('pluginsContainer').innerHTML = '".$pluginsDisplay."'};</script>";
// Work out what plugins we'll need to set on a setInterval
$onLoadExtras = "";
@@ -227,7 +226,10 @@ if (!$_SESSION['loggedIn']) {
<html>
<head>
<title>ICEcoder <?php echo $ICEcoder["versionNo"];?> setup</title>
<title>ICEcoder <?php
echo $ICEcoder["versionNo"]." : ";
echo $ICEcoder["accountPassword"] == "" ? "Setup" : "Login";
?></title>
<link rel="stylesheet" type="text/css" href="coder.css">
</head>