mirror of
https://github.com/icecoder/ICEcoder.git
synced 2026-03-10 10:36:47 +01:00
Putting server vars into $ICEcoder array
All server variables such as codeMirrorDir, visibleTabs etc now in $ICEcoder array This is so we have a single object to contain all settings, just like the JS equivalent
This commit is contained in:
20
editor.php
20
editor.php
@@ -5,17 +5,17 @@
|
||||
<head>
|
||||
<title>CodeMirror 2: ICE Coders Editor of Choice</title>
|
||||
<?php include("lib/settings.php");?>
|
||||
<link rel="stylesheet" href="<?php echo $codeMirrorDir; ?>/lib/codemirror.css">
|
||||
<link rel="stylesheet" href="<?php echo $ICEcoder["codeMirrorDir"]; ?>/lib/codemirror.css">
|
||||
<!--codemirror-compressed.js includes codemirror.js plus the mode files for clike, coffeescript, css, javascript, less, php, ruby & xml //-->
|
||||
<script src="<?php echo $codeMirrorDir; ?>/lib/codemirror-compressed.js"></script>
|
||||
<script src="<?php echo $codeMirrorDir; ?>/lib/util/searchcursor.js"></script>
|
||||
<script src="<?php echo $codeMirrorDir; ?>/lib/util/match-highlighter.js"></script>
|
||||
<script src="<?php echo $codeMirrorDir; ?>/lib/util/foldcode.js"></script>
|
||||
<script src="<?php echo $ICEcoder["codeMirrorDir"]; ?>/lib/codemirror-compressed.js"></script>
|
||||
<script src="<?php echo $ICEcoder["codeMirrorDir"]; ?>/lib/util/searchcursor.js"></script>
|
||||
<script src="<?php echo $ICEcoder["codeMirrorDir"]; ?>/lib/util/match-highlighter.js"></script>
|
||||
<script src="<?php echo $ICEcoder["codeMirrorDir"]; ?>/lib/util/foldcode.js"></script>
|
||||
<?php
|
||||
if ($theme=="default") {
|
||||
if ($ICEcoder["theme"]=="default") {
|
||||
echo '<link rel="stylesheet" href="lib/editor.css">';
|
||||
} else {
|
||||
echo '<link rel="stylesheet" href="'.$codeMirrorDir.'/theme/'.$theme.'.css">';
|
||||
echo '<link rel="stylesheet" href="'.$ICEcoder["codeMirrorDir"].'/theme/'.$ICEcoder["theme"].'.css">';
|
||||
}
|
||||
?>
|
||||
<style type="text/css">
|
||||
@@ -25,7 +25,7 @@ if ($theme=="default") {
|
||||
span.CodeMirror-matchhighlight {background: #555}
|
||||
.CodeMirror-focused span.CodeMirror-matchhighlight {color: #000; background: #555; !important}
|
||||
/* Make sure this next one remains the 6th item, updated with JS */
|
||||
.cm-tab:after {position: relative; display: inline-block; width: 0; left: -1.4em; overflow: visible; color: #aaa; content: "<?php if($visibleTabs) {echo '\\21e5';};?>";}
|
||||
.cm-tab:after {position: relative; display: inline-block; width: 0; left: -1.4em; overflow: visible; color: #aaa; content: "<?php if($ICEcoder["visibleTabs"]) {echo '\\21e5';};?>";}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
@@ -48,9 +48,9 @@ span.CodeMirror-matchhighlight {background: #555}
|
||||
echo '<div style="float: left">'.PHP_EOL;
|
||||
echo '<h2 style="color: rgba(0,198,255,0.7)">files</h2>'.PHP_EOL;
|
||||
echo '<span style="color:#888">Last 10 files opened:</span><br>'.PHP_EOL;
|
||||
$last10FilesArray = explode(",",$last10Files);
|
||||
$last10FilesArray = explode(",",$ICEcoder["last10Files"]);
|
||||
for ($i=0;$i<count($last10FilesArray);$i++) {
|
||||
if ($last10Files=="") {
|
||||
if ($ICEcoder["last10Files"]=="") {
|
||||
echo '[none]<br><br>';
|
||||
} else {
|
||||
echo '<a style="cursor:pointer" onClick="top.ICEcoder.openFile(top.fullPath+\''.str_replace("|","/",$last10FilesArray[$i]).'\')">';
|
||||
|
||||
12
files.php
12
files.php
@@ -12,8 +12,8 @@
|
||||
|
||||
<?php
|
||||
include("lib/settings.php");
|
||||
$restrictedFiles = $_SESSION['restrictedFiles'];
|
||||
$bannedFiles = $_SESSION['bannedFiles'];
|
||||
$ICEcoder["restrictedFiles"] = $_SESSION['restrictedFiles'];
|
||||
$ICEcoder["bannedFiles"] = $_SESSION['bannedFiles'];
|
||||
strrpos($_SERVER['DOCUMENT_ROOT'],":") ? $serverType = "Windows" : $serverType = "Linux";
|
||||
|
||||
// Function to sort given values alphabetically
|
||||
@@ -45,8 +45,8 @@ $finalArray = $tempArray = array();
|
||||
foreach ($objectList as $objectRef) {
|
||||
$fileFolderName = rtrim(substr($objectRef->getPathname(), strlen($path)),"..");
|
||||
$canAdd = true;
|
||||
for ($i=0;$i<count($bannedFiles);$i++) {
|
||||
if(strpos($fileFolderName,$bannedFiles[$i])!==false) {$canAdd = false;}
|
||||
for ($i=0;$i<count($ICEcoder["bannedFiles"]);$i++) {
|
||||
if(strpos($fileFolderName,$ICEcoder["bannedFiles"][$i])!==false) {$canAdd = false;}
|
||||
}
|
||||
if ($objectRef->getFilename()!="." && $fileFolderName[strlen($fileFolderName)-1]!="/" && $canAdd) {
|
||||
$fileFolderName!="/" && is_dir($path.$fileFolderName) ? array_push($finalArray,$fileFolderName) : array_push($tempArray,$fileFolderName);
|
||||
@@ -101,8 +101,8 @@ for ($i=0;$i<count($finalArray);$i++) {
|
||||
}
|
||||
}
|
||||
$restrictedFile=false;
|
||||
for ($j=0;$j<count($restrictedFiles);$j++) {
|
||||
if (strpos($fileFolderName,$restrictedFiles[$j])!="") {
|
||||
for ($j=0;$j<count($ICEcoder["restrictedFiles"]);$j++) {
|
||||
if (strpos($fileFolderName,$ICEcoder["restrictedFiles"][$j])!="") {
|
||||
$restrictedFile=true;
|
||||
}
|
||||
}
|
||||
|
||||
20
index.php
20
index.php
@@ -11,15 +11,15 @@ if (!$allowedIP) {
|
||||
};
|
||||
|
||||
// Check for updates of ICEcoder & CodeMirror
|
||||
if ($checkUpdates) {
|
||||
if ($ICEcoder["checkUpdates"]) {
|
||||
$ICEcoderLatestVer = json_encode(file_get_contents("http://icecoder.net/latest-version.txt"));
|
||||
$ICEcoderLatestVer = rtrim(ltrim($ICEcoderLatestVer,"\""),"\"\\n");
|
||||
if (ltrim($versionNo,"v ")<ltrim($ICEcoderLatestVer,"v ")) {
|
||||
if (ltrim($ICEcoder["versionNo"],"v ")<ltrim($ICEcoderLatestVer,"v ")) {
|
||||
echo '<script>top.ICEcoder.message(\'ICEcoder '.$ICEcoderLatestVer.' now released\n\nPlease upgrade\');</script>';
|
||||
} else {
|
||||
$cMLatestVer = json_encode(file_get_contents("http://codemirror.net/latest-version.txt"));
|
||||
$cMLatestVer = rtrim(ltrim($cMLatestVer,"\""),"\"\\n");
|
||||
if ($cMThisVer<$cMLatestVer) {
|
||||
if ($ICEcoder["cMThisVer"]<$cMLatestVer) {
|
||||
echo '<script>top.ICEcoder.message(\'Code Mirror '.$cMLatestVer.' now released\n\nPlease upgrade\');</script>';
|
||||
}
|
||||
}
|
||||
@@ -29,14 +29,14 @@ if ($checkUpdates) {
|
||||
|
||||
<html onMouseDown="top.ICEcoder.mouseDown=true" onMouseUp="top.ICEcoder.mouseDown=false" onMouseMove="if(top.ICEcoder) {top.ICEcoder.getMouseXY(event,'top');top.ICEcoder.canResizeFilesW()}">
|
||||
<head>
|
||||
<title>ICE Coder - <?php echo $versionNo;?></title>
|
||||
<title>ICE Coder - <?php echo $ICEcoder["versionNo"];?></title>
|
||||
<meta name="robots" content="noindex, nofollow">
|
||||
<link rel="stylesheet" type="text/css" href="lib/coder.css">
|
||||
<script>
|
||||
shortURLStarts = "<?php echo $shortURLStarts;?>";
|
||||
theme = "<?php if ($theme=="default") {echo 'icecoder';} else {echo $theme;};?>";
|
||||
tabsIndent = <?php if ($tabsIndent) {echo 'true';} else {echo 'false';};?>;
|
||||
tabWidth = <?php echo $tabWidth; ?>;
|
||||
theme = "<?php if ($ICEcoder["theme"]=="default") {echo 'icecoder';} else {echo $ICEcoder["theme"];};?>";
|
||||
tabsIndent = <?php if ($ICEcoder["tabsIndent"]) {echo 'true';} else {echo 'false';};?>;
|
||||
tabWidth = <?php echo $ICEcoder["tabWidth"]; ?>;
|
||||
<?
|
||||
echo 'fullPath = "'.$docRoot.'";'.PHP_EOL;
|
||||
?>
|
||||
@@ -49,8 +49,8 @@ window.onbeforeunload = function() {
|
||||
}
|
||||
|
||||
previousFiles = [<?php
|
||||
if ($previousFiles!="" && $_SESSION['userLevel'] == 10) {
|
||||
$openFilesArray = explode(",",$previousFiles);
|
||||
if ($ICEcoder["previousFiles"]!="" && $_SESSION['userLevel'] == 10) {
|
||||
$openFilesArray = explode(",",$ICEcoder["previousFiles"]);
|
||||
for ($i=0;$i<count($openFilesArray);$i++) {
|
||||
echo "'".$openFilesArray[$i]."'";
|
||||
if ($i<count($openFilesArray)-1) {echo ",";};
|
||||
@@ -99,7 +99,7 @@ previousFiles = [<?php
|
||||
<div class="plugins" id="pluginsContainer">
|
||||
<?php echo $pluginsDisplay; ?>
|
||||
</div>
|
||||
<div class="version"><?php echo $versionNo;?></div><img src="images/full-screen.gif" id="screenMode" class="screenModeIcon" onClick="top.ICEcoder.fullScreenSwitcher()">
|
||||
<div class="version"><?php echo $ICEcoder["versionNo"];?></div><img src="images/full-screen.gif" id="screenMode" class="screenModeIcon" onClick="top.ICEcoder.fullScreenSwitcher()">
|
||||
<img src="images/ice-coder.png" class="logo" onClick="ICEcoder.helpScreen()" onContextMenu="ICEcoder.settingsScreen()">
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,25 +1,27 @@
|
||||
<?php
|
||||
$versionNo = "v 0.7.8";
|
||||
$codeMirrorDir = "CodeMirror-2.3";
|
||||
$cMThisVer = 2.3;
|
||||
$tabsIndent = true;
|
||||
$checkUpdates = false;
|
||||
$openLastFiles = true;
|
||||
$findFilesExclude = array("_coder",".doc",".gif",".jpg",".jpeg",".pdf",".png",".swf",".xml",".zip");
|
||||
$codeAssist = true;
|
||||
$visibleTabs = false;
|
||||
$lockedNav = true;
|
||||
$accountPassword = "";
|
||||
$restrictedFiles = array("wp-",".php",".rb",".sql");
|
||||
$bannedFiles = array("_coder","wp-",".exe");
|
||||
$allowedIPs = array("*");
|
||||
$plugins = array(
|
||||
$ICEcoder = array(
|
||||
"versionNo" => "v 0.7.8",
|
||||
"codeMirrorDir" => "CodeMirror-2.3",
|
||||
"cMThisVer" => 2.3,
|
||||
"tabsIndent" => true,
|
||||
"checkUpdates" => false,
|
||||
"openLastFiles" => true,
|
||||
"findFilesExclude" => array("_coder",".doc",".gif",".jpg",".jpeg",".pdf",".png",".swf",".xml",".zip"),
|
||||
"codeAssist" => true,
|
||||
"visibleTabs" => false,
|
||||
"lockedNav" => true,
|
||||
"accountPassword" => "",
|
||||
"restrictedFiles" => array("wp-",".php",".rb",".sql"),
|
||||
"bannedFiles" => array("_coder","wp-",".exe"),
|
||||
"allowedIPs" => array("*"),
|
||||
"plugins" => array(
|
||||
array("Database Admin","images/database.png","margin-top: 3px","plugins/adminer/adminer-3.3.3-mysql-en.php","_blank",""),
|
||||
array("Batch Image Processor","images/images.png","margin-top: 5px","http://birme.net","_blank",""),
|
||||
array("Zip It!","images/zip-it.png","margin-top: 3px","plugins/zip-it/?zip=|&exclude=.doc,.gif,.jpg,.jpeg,.pdf,.png,.swf,.xml,.zip","fileControl:<b>Zipping Open Files</b>","10")
|
||||
);
|
||||
$theme = "default";
|
||||
$tabWidth = 4;
|
||||
$previousFiles = "";
|
||||
$last10Files = "";
|
||||
),
|
||||
"theme" => "default",
|
||||
"tabWidth" => 4,
|
||||
"previousFiles" => "",
|
||||
"last10Files" => ""
|
||||
);
|
||||
?>
|
||||
@@ -22,8 +22,8 @@ if ($_GET['action']=="load") {
|
||||
|
||||
if ($fileType=="text") {
|
||||
$bannedFile=false;
|
||||
for ($i=0;$i<count($restrictedFiles);$i++) {
|
||||
if (strpos($file,$restrictedFiles[$i])!="") {
|
||||
for ($i=0;$i<count($ICEcoder["restrictedFiles"]);$i++) {
|
||||
if (strpos($file,$ICEcoder["restrictedFiles"][$i])!="") {
|
||||
$bannedFile=true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
<html onContextMenu="return false">
|
||||
<head>
|
||||
<title>ICE Coder - <?php echo $versionNo;?> :: File/Folder Properties</title>
|
||||
<title>ICE Coder - <?php echo $ICEcoder["versionNo"];?> :: File/Folder Properties</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<link rel="stylesheet" type="text/css" href="file-folder-properties.css">
|
||||
</head>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>ICE Coder - <?php echo $versionNo;?> :: Help & Shortcuts</title>
|
||||
<title>ICE Coder - <?php echo $ICEcoder["versionNo"];?> :: Help & Shortcuts</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<link rel="stylesheet" type="text/css" href="help.css">
|
||||
</head>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>ICE Coder - <?php echo $versionNo;?> :: Multiple Results Screen</title>
|
||||
<title>ICE Coder - <?php echo $ICEcoder["versionNo"];?> :: Multiple Results Screen</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<link rel="stylesheet" type="text/css" href="multiple-results.css">
|
||||
</head>
|
||||
|
||||
@@ -4,24 +4,24 @@
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>ICE Coder - <?php echo $versionNo;?> :: Settings Screen</title>
|
||||
<title>ICE Coder - <?php echo $ICEcoder["versionNo"];?> :: Settings Screen</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<link rel="stylesheet" type="text/css" href="settings-screen.css">
|
||||
<link rel="stylesheet" href="../<?php echo $codeMirrorDir; ?>/lib/codemirror.css">
|
||||
<script src="../<?php echo $codeMirrorDir; ?>/lib/codemirror-compressed.js"></script>
|
||||
<link rel="stylesheet" href="../<?php echo $ICEcoder["codeMirrorDir"]; ?>/lib/codemirror.css">
|
||||
<script src="../<?php echo $ICEcoder["codeMirrorDir"]; ?>/lib/codemirror-compressed.js"></script>
|
||||
|
||||
<style type="text/css">
|
||||
.CodeMirror {position: absolute; width: 0; background-color: #fff; font-family: monospace; width: 420px}
|
||||
.CodeMirror-scroll {height: 220px; overflow: hidden}
|
||||
/* Make sure this next one remains the 3rd item, updated with JS */
|
||||
.cm-tab:after {position: relative; display: inline-block; width: 0; left: -1.4em; overflow: visible; color: #aaa; content: "<?php if($visibleTabs) {echo '\21e5';};?>";}
|
||||
.cm-tab:after {position: relative; display: inline-block; width: 0; left: -1.4em; overflow: visible; color: #aaa; content: "<?php if($ICEcoder["visibleTabs"]) {echo '\21e5';};?>";}
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" href="editor.css">
|
||||
<?php
|
||||
$themeArray = array("ambiance","blackboard","cobalt","eclipse","elegant","erlang-dark","lesser-dark","monokai","neat","night","rubyblue","vibrant-ink","xq-dark");
|
||||
for ($i=0;$i<count($themeArray)-1;$i++) {
|
||||
echo '<link rel="stylesheet" href="../'.$codeMirrorDir.'/theme/'.$themeArray[$i].'.css">'.PHP_EOL;
|
||||
echo '<link rel="stylesheet" href="../'.$ICEcoder["codeMirrorDir"].'/theme/'.$themeArray[$i].'.css">'.PHP_EOL;
|
||||
}
|
||||
?>
|
||||
</head>
|
||||
@@ -30,7 +30,7 @@ for ($i=0;$i<count($themeArray)-1;$i++) {
|
||||
|
||||
<div class="infoPane">
|
||||
<img src="../images/ice-coder.gif" class="logo">
|
||||
<div class="version"><?php echo $versionNo;?></div>
|
||||
<div class="version"><?php echo $ICEcoder["versionNo"];?></div>
|
||||
|
||||
<p>
|
||||
git:<br>
|
||||
@@ -38,11 +38,11 @@ for ($i=0;$i<count($themeArray)-1;$i++) {
|
||||
<br><br>
|
||||
|
||||
codemirror dir:<br>
|
||||
<?php echo $codeMirrorDir; ?>
|
||||
<?php echo $ICEcoder["codeMirrorDir"]; ?>
|
||||
<br><br>
|
||||
|
||||
codemirror version:<br>
|
||||
<?php echo $cMThisVer; ?>
|
||||
<?php echo $ICEcoder["cMThisVer"]; ?>
|
||||
<br><br>
|
||||
|
||||
doc root:<br>
|
||||
@@ -72,18 +72,18 @@ for ($i=0;$i<count($themeArray)-1;$i++) {
|
||||
<div class="settingsColumn1">
|
||||
<h1>settings</h1>
|
||||
<h2>functionality</h2>
|
||||
<input type="checkbox" onclick="showButton()" name="tabsIndent" value="true"<?php if($tabsIndent) {echo ' checked';};?>> tab indents selection<br>
|
||||
<input type="checkbox" onclick="showButton()" name="checkUpdates" value="true"<?php if($checkUpdates) {echo ' checked';};?>> check for updates on load<br>
|
||||
<input type="checkbox" onclick="showButton()" name="openLastFiles" value="true"<?php if($openLastFiles) {echo ' checked';};?>> auto open last files on login<br>
|
||||
<input type="checkbox" onclick="showButton()" name="tabsIndent" value="true"<?php if($ICEcoder["tabsIndent"]) {echo ' checked';};?>> tab indents selection<br>
|
||||
<input type="checkbox" onclick="showButton()" name="checkUpdates" value="true"<?php if($ICEcoder["checkUpdates"]) {echo ' checked';};?>> check for updates on load<br>
|
||||
<input type="checkbox" onclick="showButton()" name="openLastFiles" value="true"<?php if($ICEcoder["openLastFiles"]) {echo ' checked';};?>> auto open last files on login<br>
|
||||
<br>
|
||||
when finding in files, exclude:<br>
|
||||
<input type="text" onkeydown="showButton()" name="findFilesExclude" value="<?php for($i=0;$i<=count($findFilesExclude)-1;$i++) {echo $findFilesExclude[$i]; if ($i<count($findFilesExclude)-1) {echo ', ';};}; ?>"><br>
|
||||
<input type="text" onkeydown="showButton()" name="findFilesExclude" value="<?php for($i=0;$i<=count($ICEcoder["findFilesExclude"])-1;$i++) {echo $ICEcoder["findFilesExclude"][$i]; if ($i<count($ICEcoder["findFilesExclude"])-1) {echo ', ';};}; ?>"><br>
|
||||
<br>
|
||||
|
||||
<h2>assisting</h2>
|
||||
<input type="checkbox" onclick="showButton()" name="codeAssist" value="true"<?php if($codeAssist) {echo ' checked';};?>> code assist<br>
|
||||
<input type="checkbox" onclick="showButton();showHideTabs()" name="visibleTabs" value="true"<?php if($visibleTabs) {echo ' checked';};?>> visible tabs<br>
|
||||
<input type="checkbox" onclick="showButton()" name="lockedNav" value="true"<?php if($lockedNav) {echo ' checked';};?>> locked nav<br>
|
||||
<input type="checkbox" onclick="showButton()" name="codeAssist" value="true"<?php if($ICEcoder["codeAssist"]) {echo ' checked';};?>> code assist<br>
|
||||
<input type="checkbox" onclick="showButton();showHideTabs()" name="visibleTabs" value="true"<?php if($ICEcoder["visibleTabs"]) {echo ' checked';};?>> visible tabs<br>
|
||||
<input type="checkbox" onclick="showButton()" name="lockedNav" value="true"<?php if($ICEcoder["lockedNav"]) {echo ' checked';};?>> locked nav<br>
|
||||
<br>
|
||||
|
||||
<h2>security</h2>
|
||||
@@ -93,29 +93,29 @@ 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($restrictedFiles)-1;$i++) {echo $restrictedFiles[$i]; if ($i<count($restrictedFiles)-1) {echo ', ';};}; ?>"><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($bannedFiles)-1;$i++) {echo $bannedFiles[$i]; if ($i<count($bannedFiles)-1) {echo ', ';};}; ?>"><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">
|
||||
<br>
|
||||
ip addresses<br>
|
||||
<input type="text" onkeydown="showButton()" name="allowedIPs" value="<?php for($i=0;$i<=count($allowedIPs)-1;$i++) {echo $allowedIPs[$i]; if ($i<count($allowedIPs)-1) {echo ', ';};}; ?>"><br>
|
||||
<input type="text" onkeydown="showButton()" name="allowedIPs" value="<?php for($i=0;$i<=count($ICEcoder["allowedIPs"])-1;$i++) {echo $ICEcoder["allowedIPs"][$i]; if ($i<count($ICEcoder["allowedIPs"])-1) {echo ', ';};}; ?>"><br>
|
||||
</div>
|
||||
|
||||
<div class="settingsColumn2">
|
||||
<h2>plugins</h2>
|
||||
plugins array <span style="font-size: 10px; color: #888">name, img src, style, url, target, setInterval (mins)</span><br>
|
||||
<textarea name="plugins" class="plugins" onkeydown="showButton()"><?php
|
||||
for($i=0;$i<count($plugins);$i++) {
|
||||
for($j=0;$j<count($plugins[$i]);$j++) {
|
||||
echo '"'.$plugins[$i][$j].'"';
|
||||
if ($j<count($plugins[$i])-1) {
|
||||
for($i=0;$i<count($ICEcoder["plugins"]);$i++) {
|
||||
for($j=0;$j<count($ICEcoder["plugins"][$i]);$j++) {
|
||||
echo '"'.$ICEcoder["plugins"][$i][$j].'"';
|
||||
if ($j<count($ICEcoder["plugins"][$i])-1) {
|
||||
echo ',';
|
||||
};
|
||||
if (!($i==count($plugins)-1 && $j==count($plugins[$i])-1)) {
|
||||
if (!($i==count($ICEcoder["plugins"])-1 && $j==count($ICEcoder["plugins"][$i])-1)) {
|
||||
echo PHP_EOL;
|
||||
}
|
||||
if (($i<count($plugins)-1 && $j==count($plugins[$i])-1)) {
|
||||
if (($i<count($ICEcoder["plugins"])-1 && $j==count($ICEcoder["plugins"][$i])-1)) {
|
||||
echo "====================".PHP_EOL;
|
||||
}
|
||||
}
|
||||
@@ -126,10 +126,10 @@ for($i=0;$i<count($plugins);$i++) {
|
||||
<h2>style</h2>
|
||||
theme<br>
|
||||
<select onchange="selectTheme();showButton()" id="select" name="theme">
|
||||
<option<?php if ($theme=="default") {echo ' selected';}; ?>>default</option>
|
||||
<option<?php if ($ICEcoder["theme"]=="default") {echo ' selected';}; ?>>default</option>
|
||||
<?php
|
||||
for ($i=0;$i<count($themeArray)-1;$i++) {
|
||||
if ($theme==$themeArray[$i]) {$optionSelected = ' selected';} else {$optionSelected = '';};
|
||||
if ($ICEcoder["theme"]==$themeArray[$i]) {$optionSelected = ' selected';} else {$optionSelected = '';};
|
||||
echo '<option'.$optionSelected.'>'.$themeArray[$i].'</option>'.PHP_EOL;
|
||||
}
|
||||
?>
|
||||
@@ -153,7 +153,7 @@ function findSequence(goal) {
|
||||
|
||||
<span style="position: absolute; top: 520px">
|
||||
tab width <span style="font-size: 10px; color: #888">chars</span><br>
|
||||
<input type="text" name="tabWidth" id="tabWidth" style="width: 30px" onkeydown="showButton()" onkeyup="changeTabWidth()" value="<?php echo $tabWidth;?>">
|
||||
<input type="text" name="tabWidth" id="tabWidth" style="width: 30px" onkeydown="showButton()" onkeyup="changeTabWidth()" value="<?php echo $ICEcoder["tabWidth"];?>">
|
||||
</span>
|
||||
|
||||
<script>
|
||||
@@ -163,7 +163,7 @@ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
||||
indentUnit: top.tabWidth,
|
||||
tabSize: top.tabWidth,
|
||||
mode: "javascript",
|
||||
theme: "<?php if ($theme=="default") {echo 'icecoder';} else {echo $theme;}; ?>"
|
||||
theme: "<?php if ($ICEcoder["theme"]=="default") {echo 'icecoder';} else {echo $ICEcoder["theme"];}; ?>"
|
||||
});
|
||||
|
||||
var input = document.getElementById("select");
|
||||
|
||||
131
lib/settings.php
131
lib/settings.php
@@ -33,58 +33,58 @@ if (isset($_POST["theme"]) && $_POST["theme"] && $_SESSION['userLevel'] == 10) {
|
||||
$settingsFile = 'config.php';
|
||||
$settingsContents = file_get_contents($settingsFile);
|
||||
// Replace our settings vars
|
||||
$repPosStart = strpos($settingsContents,'$tabsIndent');
|
||||
$repPosEnd = strpos($settingsContents,'$previousFiles');
|
||||
$repPosStart = strpos($settingsContents,'"tabsIndent"');
|
||||
$repPosEnd = strpos($settingsContents,'"previousFiles"');
|
||||
|
||||
// Prepare all our vars
|
||||
if ($_POST['tabsIndent']) {$tabsIndent = "true";} else {$tabsIndent = "false";};
|
||||
if ($_POST['checkUpdates']) {$checkUpdates = "true";} else {$checkUpdates = "false";};
|
||||
if ($_POST['openLastFiles']) {$openLastFiles = "true";} else {$openLastFiles = "false";};
|
||||
$findFilesExclude = 'array("'.str_replace(', ','","',strClean($_POST['findFilesExclude'])).'")';
|
||||
if ($_POST['codeAssist']) {$codeAssist = "true";} else {$codeAssist = "false";};
|
||||
if ($_POST['visibleTabs']) {$visibleTabs = "true";} else {$visibleTabs = "false";};
|
||||
if ($_POST['lockedNav']) {$lockedNav = "true";} else {$lockedNav = "false";};
|
||||
if ($_POST['accountPassword']!="") {$accountPassword = generateHash(strClean($_POST['accountPassword']));};
|
||||
$restrictedFiles = 'array("'.str_replace(', ','","',strClean($_POST['restrictedFiles'])).'")';
|
||||
$bannedFiles = 'array("'.str_replace(', ','","',strClean($_POST['bannedFiles'])).'")';
|
||||
$allowedIPs = 'array("'.str_replace(', ','","',strClean($_POST['allowedIPs'])).'")';
|
||||
$plugins = 'array('.PHP_EOL.' array('.PHP_EOL.' '.str_replace('====================','),'.PHP_EOL.' array(',$_POST['plugins']).'))';
|
||||
$theme = strClean($_POST['theme']);
|
||||
$tabWidth = numClean($_POST['tabWidth']);
|
||||
if ($_POST['tabsIndent']) {$ICEcoder["tabsIndent"] = "true";} else {$ICEcoder["tabsIndent"] = "false";};
|
||||
if ($_POST['checkUpdates']) {$ICEcoder["checkUpdates"] = "true";} else {$ICEcoder["checkUpdates"] = "false";};
|
||||
if ($_POST['openLastFiles']) {$ICEcoder["openLastFiles"] = "true";} else {$ICEcoder["openLastFiles"] = "false";};
|
||||
$ICEcoder["findFilesExclude"] = 'array("'.str_replace(', ','","',strClean($_POST['findFilesExclude'])).'")';
|
||||
if ($_POST['codeAssist']) {$ICEcoder["codeAssist"] = "true";} else {$ICEcoder["codeAssist"] = "false";};
|
||||
if ($_POST['visibleTabs']) {$ICEcoder["visibleTabs"] = "true";} else {$ICEcoder["visibleTabs"] = "false";};
|
||||
if ($_POST['lockedNav']) {$ICEcoder["lockedNav"] = "true";} else {$ICEcoder["lockedNav"] = "false";};
|
||||
if ($_POST['accountPassword']!="") {$ICEcoder["accountPassword"] = generateHash(strClean($_POST['accountPassword']));};
|
||||
$ICEcoder["restrictedFiles"] = 'array("'.str_replace(', ','","',strClean($_POST['restrictedFiles'])).'")';
|
||||
$ICEcoder["bannedFiles"] = 'array("'.str_replace(', ','","',strClean($_POST['bannedFiles'])).'")';
|
||||
$ICEcoder["allowedIPs"] = 'array("'.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']);
|
||||
|
||||
$settingsNew = '$tabsIndent = '.$tabsIndent.';'.PHP_EOL;
|
||||
$settingsNew .= '$checkUpdates = '.$checkUpdates.';'.PHP_EOL;
|
||||
$settingsNew .= '$openLastFiles = '.$openLastFiles.';'.PHP_EOL;
|
||||
$settingsNew .= '$findFilesExclude = '.$findFilesExclude.';'.PHP_EOL;
|
||||
$settingsNew .= '$codeAssist = '.$codeAssist.';'.PHP_EOL;
|
||||
$settingsNew .= '$visibleTabs = '.$visibleTabs.';'.PHP_EOL;
|
||||
$settingsNew .= '$lockedNav = '.$lockedNav.';'.PHP_EOL;
|
||||
$settingsNew .= '$accountPassword = "'.$accountPassword.'";'.PHP_EOL;
|
||||
$settingsNew .= '$restrictedFiles = '.$restrictedFiles.';'.PHP_EOL;
|
||||
$settingsNew .= '$bannedFiles = '.$bannedFiles.';'.PHP_EOL;
|
||||
$settingsNew .= '$allowedIPs = '.$allowedIPs.';'.PHP_EOL;
|
||||
$settingsNew .= '$plugins = '.$plugins.';'.PHP_EOL;
|
||||
$settingsNew .= '$theme = "'.$theme.'";'.PHP_EOL;
|
||||
$settingsNew .= '$tabWidth = '.$tabWidth.';'.PHP_EOL;
|
||||
$settingsNew = '"tabsIndent" => '.$ICEcoder["tabsIndent"].','.PHP_EOL;
|
||||
$settingsNew .= '"checkUpdates" => '.$ICEcoder["checkUpdates"].','.PHP_EOL;
|
||||
$settingsNew .= '"openLastFiles" => '.$ICEcoder["openLastFiles"].','.PHP_EOL;
|
||||
$settingsNew .= '"findFilesExclude" => '.$ICEcoder["findFilesExclude"].','.PHP_EOL;
|
||||
$settingsNew .= '"codeAssist" => '.$ICEcoder["codeAssist"].','.PHP_EOL;
|
||||
$settingsNew .= '"visibleTabs" => '.$ICEcoder["visibleTabs"].','.PHP_EOL;
|
||||
$settingsNew .= '"lockedNav" => '.$ICEcoder["lockedNav"].','.PHP_EOL;
|
||||
$settingsNew .= '"accountPassword" => "'.$ICEcoder["accountPassword"].'",'.PHP_EOL;
|
||||
$settingsNew .= '"restrictedFiles" => '.$ICEcoder["restrictedFiles"].','.PHP_EOL;
|
||||
$settingsNew .= '"bannedFiles" => '.$ICEcoder["bannedFiles"].','.PHP_EOL;
|
||||
$settingsNew .= '"allowedIPs" => '.$ICEcoder["allowedIPs"].','.PHP_EOL;
|
||||
$settingsNew .= '"plugins" => '.$ICEcoder["plugins"].','.PHP_EOL;
|
||||
$settingsNew .= '"theme" => "'.$ICEcoder["theme"].'",'.PHP_EOL;
|
||||
$settingsNew .= '"tabWidth" => '.$ICEcoder["tabWidth"].','.PHP_EOL;
|
||||
|
||||
// Compile our new settings
|
||||
$settingsContents = substr($settingsContents,0,$repPosStart).$settingsNew.substr($settingsContents,($repPosEnd),strlen($settingsContents));
|
||||
// Now update the config file
|
||||
$fh = fopen($settingsFile, 'w') or die("Can't update config file. Please set public write permissions on lib/config.php");
|
||||
$fh = fopen($settingsFile, 'w') or die("Can't update config file. Please set public write permissions on lib/config.php and press refresh");
|
||||
fwrite($fh, $settingsContents);
|
||||
fclose($fh);
|
||||
|
||||
// OK, now the config file has been updated, update our current session with new arrays
|
||||
$_SESSION['findFilesExclude'] = $findFilesExclude = explode(", ",strClean($_POST['findFilesExclude']));
|
||||
$_SESSION['restrictedFiles'] = $restrictedFiles = explode(", ",strClean($_POST['restrictedFiles']));
|
||||
$_SESSION['bannedFiles'] = $bannedFiles = explode(", ",strClean($_POST['bannedFiles']));
|
||||
$_SESSION['allowedIPs'] = $allowedIPs = explode(", ",strClean($_POST['allowedIPs']));
|
||||
$_SESSION['findFilesExclude'] = $ICEcoder["findFilesExclude"] = explode(", ",strClean($_POST['findFilesExclude']));
|
||||
$_SESSION['restrictedFiles'] = $ICEcoder["restrictedFiles"] = explode(", ",strClean($_POST['restrictedFiles']));
|
||||
$_SESSION['bannedFiles'] = $ICEcoder["bannedFiles"] = explode(", ",strClean($_POST['bannedFiles']));
|
||||
$_SESSION['allowedIPs'] = $ICEcoder["allowedIPs"] = explode(", ",strClean($_POST['allowedIPs']));
|
||||
// Work out the theme to use now
|
||||
if ($theme=="default") {$themeURL="lib/editor.css";} else {$themeURL=$codeMirrorDir."/theme/".$theme.".css";};
|
||||
if ($ICEcoder["theme"]=="default") {$themeURL="lib/editor.css";} else {$themeURL=$ICEcoder["codeMirrorDir"]."/theme/".$ICEcoder["theme"].".css";};
|
||||
// Do we need a file manager refresh?
|
||||
if ($_POST['changedFileSettings']=="true") {$refreshFM="true";} else {$refreshFM="false";};
|
||||
// With all that worked out, we can now hide the settings screen and apply the new settings
|
||||
echo "<script>top.ICEcoder.settingsScreen('hide');top.ICEcoder.useNewSettings('".$themeURL."',".$tabsIndent.",".$codeAssist.",".$lockedNav.",".$visibleTabs.",".$tabWidth.",".$refreshFM.");</script>";
|
||||
echo "<script>top.ICEcoder.settingsScreen('hide');top.ICEcoder.useNewSettings('".$themeURL."',".$ICEcoder["tabsIndent"].",".$ICEcoder["codeAssist"].",".$ICEcoder["lockedNav"].",".$ICEcoder["visibleTabs"].",".$ICEcoder["tabWidth"].",".$refreshFM.");</script>";
|
||||
}
|
||||
|
||||
// Save the currently opened files for next time
|
||||
@@ -94,8 +94,8 @@ if (isset($_GET["saveFiles"]) && $_GET['saveFiles']) {
|
||||
$settingsContents = file_get_contents($settingsFile);
|
||||
|
||||
// Replace our previousFiles var with the the current
|
||||
$repPosStart = strpos($settingsContents,'previousFiles = "')+18;
|
||||
$repPosEnd = strpos($settingsContents,'";',$repPosStart)-$repPosStart;
|
||||
$repPosStart = strpos($settingsContents,'previousFiles" => "')+20;
|
||||
$repPosEnd = strpos($settingsContents,'",',$repPosStart)-$repPosStart;
|
||||
if ($_GET['saveFiles']!="CLEAR") {
|
||||
$saveFiles=strClean($_GET['saveFiles']);
|
||||
$settingsContents1 = substr($settingsContents,0,$repPosStart).$saveFiles.substr($settingsContents,($repPosStart+$repPosEnd),strlen($settingsContents));
|
||||
@@ -105,15 +105,15 @@ if (isset($_GET["saveFiles"]) && $_GET['saveFiles']) {
|
||||
|
||||
// Update our last10Files var?
|
||||
$saveFilesArray = explode(",",$saveFiles);
|
||||
$last10FilesArray = explode(",",$last10Files);
|
||||
$last10FilesArray = explode(",",$ICEcoder["last10Files"]);
|
||||
for ($i=0;$i<count($saveFilesArray);$i++) {
|
||||
$inLast10Files = in_array($saveFilesArray[$i],$last10FilesArray);
|
||||
if (!$inLast10Files && $saveFilesArray[$i] !="") {
|
||||
$repPosStart = strpos($settingsContents1,'last10Files = "')+16;
|
||||
$repPosEnd = strpos($settingsContents1,'";',$repPosStart)-$repPosStart;
|
||||
if ($last10Files!="") {$commaExtra=",";} else {$commaExtra="";};
|
||||
if (count($last10FilesArray)>=10) {$last10Files=substr($last10Files,0,strrpos($last10Files,','));};
|
||||
$settingsContents2 = substr($settingsContents1,0,$repPosStart).$saveFilesArray[$i].$commaExtra.$last10Files.substr($settingsContents1,($repPosStart+$repPosEnd),strlen($settingsContents1));
|
||||
$repPosStart = strpos($settingsContents1,'last10Files" => "')+18;
|
||||
$repPosEnd = strpos($settingsContents1,'"',$repPosStart)-$repPosStart;
|
||||
if ($ICEcoder["last10Files"]!="") {$commaExtra=",";} else {$commaExtra="";};
|
||||
if (count($last10FilesArray)>=10) {$ICEcoder["last10Files"]=substr($ICEcoder["last10Files"],0,strrpos($ICEcoder["last10Files"],','));};
|
||||
$settingsContents2 = substr($settingsContents1,0,$repPosStart).$saveFilesArray[$i].$commaExtra.$ICEcoder["last10Files"].substr($settingsContents1,($repPosStart+$repPosEnd),strlen($settingsContents1));
|
||||
// Now update the config file
|
||||
$fh = fopen($settingsFile, 'w') or die("Can't update config file. Please set public write permissions on lib/config.php");
|
||||
fwrite($fh, $settingsContents2);
|
||||
@@ -127,13 +127,13 @@ if (isset($_GET["saveFiles"]) && $_GET['saveFiles']) {
|
||||
|
||||
// Establish our user level
|
||||
if (!isset($_SESSION['userLevel'])) {$_SESSION['userLevel'] = 0;};
|
||||
if(isset($_POST['loginPassword']) && generateHash(strClean($_POST['loginPassword']),$accountPassword)==$accountPassword) {$_SESSION['userLevel'] = 10;};
|
||||
if(isset($_POST['loginPassword']) && generateHash(strClean($_POST['loginPassword']),$ICEcoder["accountPassword"])==$ICEcoder["accountPassword"]) {$_SESSION['userLevel'] = 10;};
|
||||
$_SESSION['userLevel'] = $_SESSION['userLevel'];
|
||||
|
||||
if (!isset($_SESSION['findFilesExclude'])) {$_SESSION['findFilesExclude'] = $findFilesExclude;}
|
||||
if (!isset($_SESSION['restrictedFiles'])) {$_SESSION['restrictedFiles'] = $restrictedFiles;}
|
||||
if (!isset($_SESSION['bannedFiles'])) {$_SESSION['bannedFiles'] = $bannedFiles;}
|
||||
if (!isset($_SESSION['allowedIPs'])) {$_SESSION['allowedIPs'] = $allowedIPs;}
|
||||
if (!isset($_SESSION['findFilesExclude'])) {$_SESSION['findFilesExclude'] = $ICEcoder["findFilesExclude"];}
|
||||
if (!isset($_SESSION['restrictedFiles'])) {$_SESSION['restrictedFiles'] = $ICEcoder["restrictedFiles"];}
|
||||
if (!isset($_SESSION['bannedFiles'])) {$_SESSION['bannedFiles'] = $ICEcoder["bannedFiles"];}
|
||||
if (!isset($_SESSION['allowedIPs'])) {$_SESSION['allowedIPs'] = $ICEcoder["allowedIPs"];}
|
||||
|
||||
// Determin our allowed IP addresses
|
||||
$allowedIP = false;
|
||||
@@ -160,18 +160,18 @@ $shortURLStarts = $shortURLStarts[count($shortURLStarts)-$trimArray];
|
||||
if ((isset($_POST["theme"]) && $_POST["theme"] && $_SESSION['userLevel'] == 10) || strpos($_SERVER['PHP_SELF'],"index.php")>0) {
|
||||
// If we're updating, we need to recreate the plugins array
|
||||
if (isset($_POST["theme"]) && $_POST["theme"] && $_SESSION['userLevel'] == 10) {
|
||||
$plugins = array();
|
||||
$ICEcoder["plugins"] = array();
|
||||
$pluginsArray = explode("====================",str_replace("\"","",str_replace("\r","",str_replace("\n","",$_POST['plugins']))));
|
||||
for ($i=0;$i<count($pluginsArray);$i++) {
|
||||
array_push($plugins, explode(",",$pluginsArray[$i]));
|
||||
array_push($ICEcoder["plugins"], explode(",",$pluginsArray[$i]));
|
||||
}
|
||||
}
|
||||
|
||||
// Work out the plugins to display to the user
|
||||
$pluginsDisplay = "";
|
||||
for ($i=0;$i<count($plugins);$i++) {
|
||||
$target = explode(":",$plugins[$i][4]);
|
||||
$pluginsDisplay .= '<a href="'.$plugins[$i][3].'" title="'.$plugins[$i][0].'" target="'.$target[0].'"><img src="'.$plugins[$i][1].'" style="'.$plugins[$i][2].'" alt="'.$plugins[$i][0].'"></a>';
|
||||
for ($i=0;$i<count($ICEcoder["plugins"]);$i++) {
|
||||
$target = explode(":",$ICEcoder["plugins"][$i][4]);
|
||||
$pluginsDisplay .= '<a href="'.$ICEcoder["plugins"][$i][3].'" title="'.$ICEcoder["plugins"][$i][0].'" target="'.$target[0].'"><img src="'.$ICEcoder["plugins"][$i][1].'" style="'.$ICEcoder["plugins"][$i][2].'" alt="'.$ICEcoder["plugins"][$i][0].'"></a>';
|
||||
};
|
||||
|
||||
// If we're updating, replace the plugin display with our newly established one
|
||||
@@ -181,9 +181,9 @@ if ((isset($_POST["theme"]) && $_POST["theme"] && $_SESSION['userLevel'] == 10)
|
||||
|
||||
// Work out what plugins we'll need to set on a setInterval
|
||||
$onLoadExtras = "";
|
||||
for ($i=0;$i<count($plugins);$i++) {
|
||||
if ($plugins[$i][5]!="") {
|
||||
$onLoadExtras .= ";top.ICEcoder.startPluginIntervals(".$i.",'".$plugins[$i][3]."','".$plugins[$i][4]."','".$plugins[$i][5]."')";
|
||||
for ($i=0;$i<count($ICEcoder["plugins"]);$i++) {
|
||||
if ($ICEcoder["plugins"][$i][5]!="") {
|
||||
$onLoadExtras .= ";top.ICEcoder.startPluginIntervals(".$i.",'".$ICEcoder["plugins"][$i][3]."','".$ICEcoder["plugins"][$i][4]."','".$ICEcoder["plugins"][$i][5]."')";
|
||||
};
|
||||
};
|
||||
|
||||
@@ -201,7 +201,7 @@ if ((isset($_POST["theme"]) && $_POST["theme"] && $_SESSION['userLevel'] == 10)
|
||||
}
|
||||
|
||||
// Finally, open last opened files if we need to (applies to index.php only)
|
||||
if ($openLastFiles) {
|
||||
if ($ICEcoder["openLastFiles"]) {
|
||||
$onLoadExtras .= ";top.ICEcoder.autoOpenFiles()";
|
||||
}
|
||||
|
||||
@@ -212,13 +212,13 @@ if ((isset($_POST["theme"]) && $_POST["theme"] && $_SESSION['userLevel'] == 10)
|
||||
}
|
||||
|
||||
// If we're due to show the settings screen
|
||||
if ($accountPassword == "" && isset($_GET['settings'])) {
|
||||
if ($ICEcoder["accountPassword"] == "" && isset($_GET['settings'])) {
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>ICE Coder - <?php echo $versionNo;?> :: Settings</title>
|
||||
<title>ICE Coder - <?php echo $ICEcoder["versionNo"];?> :: Settings</title>
|
||||
<link rel="stylesheet" type="text/css" href="coder.css">
|
||||
</head>
|
||||
|
||||
@@ -228,7 +228,7 @@ if ($accountPassword == "" && isset($_GET['settings'])) {
|
||||
<div class="screenVCenter">
|
||||
<div class="screenCenter">
|
||||
<img src="../images/ice-coder.png">
|
||||
<div class="version"><?php echo $versionNo;?></div>
|
||||
<div class="version"><?php echo $ICEcoder["versionNo"];?></div>
|
||||
<form name="settingsUpdate" action="../index.php" method="POST">
|
||||
<input type="password" name="accountPassword" class="accountPassword">
|
||||
<input type="submit" name="submit" value="Set Password" class="button">
|
||||
@@ -244,14 +244,15 @@ if ($accountPassword == "" && isset($_GET['settings'])) {
|
||||
} else {
|
||||
// If the password hasn't been set, set it, but only if we're including
|
||||
// from the index.php file (as this file is included from multiple places)
|
||||
if ($accountPassword == "" && strpos($_SERVER['PHP_SELF'],"index.php")>0) {
|
||||
if ($ICEcoder["accountPassword"] == "" && strpos($_SERVER['PHP_SELF'],"index.php")>0) {
|
||||
// If we're setting a password
|
||||
|
||||
if (isset($_POST['accountPassword'])) {
|
||||
$password = generateHash(strClean($_POST['accountPassword']));
|
||||
$settingsFile = 'lib/config.php';
|
||||
$settingsContents = file_get_contents($settingsFile);
|
||||
// Replace our empty password with the one submitted by user
|
||||
$settingsContents = str_replace('$accountPassword = "";','$accountPassword = "'.$password.'";',$settingsContents);
|
||||
$settingsContents = str_replace('"accountPassword" => "",','"accountPassword" => "'.$password.'",',$settingsContents);
|
||||
// Now update the config file
|
||||
$fh = fopen($settingsFile, 'w') or die("Can't update config file. Please set public write permissions on lib/config.php");
|
||||
fwrite($fh, $settingsContents);
|
||||
@@ -268,7 +269,7 @@ if ($accountPassword == "" && isset($_GET['settings'])) {
|
||||
|
||||
// If we're logging in, refresh the file manager and show icons if login is correct
|
||||
if(isset($_POST['loginPassword'])) {
|
||||
if(isset($_POST['loginPassword']) && generateHash(strClean($_POST['loginPassword']),$accountPassword)==$accountPassword) {
|
||||
if(isset($_POST['loginPassword']) && generateHash(strClean($_POST['loginPassword']),$ICEcoder["accountPassword"])==$ICEcoder["accountPassword"]) {
|
||||
$loginAttempt = 'loginOK';
|
||||
} else {
|
||||
$loginAttempt = 'loginFailed';
|
||||
|
||||
Reference in New Issue
Block a user