"v 0.8.3", "codeMirrorDir" => "CodeMirror-2.33", "cMThisVer" => 2.33 )+$ICEcoder; // Update this config file? if (isset($_POST["theme"]) && $_POST["theme"] && $_SESSION['userLevel'] == 10) { $settingsContents = file_get_contents($settingsFile); // Replace our settings vars $repPosStart = strpos($settingsContents,'"root"'); $repPosEnd = strpos($settingsContents,'"previousFiles"'); // Prepare all our vars $ICEcoder["root"] = strClean($_POST['root']); $ICEcoder["tabsIndent"] = $_POST['tabsIndent'] ? "true" : "false"; $ICEcoder["checkUpdates"] = $_POST['checkUpdates'] ? "true" : "false"; $ICEcoder["openLastFiles"] = $_POST['openLastFiles'] ? "true" : "false"; $ICEcoder["findFilesExclude"] = 'array("'.str_replace(', ','","',strClean($_POST['findFilesExclude'])).'")'; $ICEcoder["codeAssist"] = $_POST['codeAssist'] ? "true" : "false"; $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(', ','","',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']); $settingsArray = array("root","tabsIndent","checkUpdates","openLastFiles","findFilesExclude","codeAssist","visibleTabs","lockedNav","accountPassword","restrictedFiles","bannedFiles","allowedIPs","plugins","theme","tabWidth"); $settingsNew = ""; for ($i=0;$i '; $settingWrap = $settingsArray[$i]=="root"||$settingsArray[$i]=="accountPassword"||$settingsArray[$i]=="theme" ? '"' : ''; $settingsNew .= $settingWrap.$ICEcoder[$settingsArray[$i]].$settingWrap.','.PHP_EOL.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/".$settingsFile." and press refresh"); fwrite($fh, $settingsContents); fclose($fh); // OK, now the config file has been updated, update our current session with new arrays $settingsArray = array("findFilesExclude","restrictedFiles","bannedFiles","allowedIPs"); for ($i=0;$itop.ICEcoder.settingsScreen('hide');top.ICEcoder.useNewSettings('".$themeURL."',".$ICEcoder["tabsIndent"].",".$ICEcoder["codeAssist"].",".$ICEcoder["lockedNav"].",".$ICEcoder["visibleTabs"].",".$ICEcoder["tabWidth"].",".$refreshFM.");"; } // Define the docRoot & iceRoot $docRoot = rtrim(str_replace("\\","/",$_SERVER['DOCUMENT_ROOT'])); $iceRoot = rtrim(str_replace("\\","/",$ICEcoder["root"])); if ($_SESSION['userLevel'] == 10) { echo ""; } $serverType = stristr($_SERVER[SERVER_SOFTWARE], "win") ? "Windows" : "Linux"; // Establish our user level if (!isset($_SESSION['userLevel'])) {$_SESSION['userLevel'] = 0;}; if(isset($_POST['loginPassword']) && generateHash(strClean($_POST['loginPassword']),$ICEcoder["accountPassword"])==$ICEcoder["accountPassword"]) {$_SESSION['userLevel'] = 10;}; $_SESSION['userLevel'] = $_SESSION['userLevel']; // Setup our file security vars $settingsArray = array("findFilesExclude","restrictedFiles","bannedFiles","allowedIPs"); for ($i=0;$itop.window.location="/";'; }; // Save the currently opened files for next time if (isset($_GET["saveFiles"]) && $_GET['saveFiles']) { if ($_SESSION['userLevel'] == 10) { $settingsContents = file_get_contents($settingsFile); // Replace our previousFiles var with the the current $repPosStart = strpos($settingsContents,'previousFiles" => "')+20; $repPosEnd = strpos($settingsContents,'",',$repPosStart)-$repPosStart; if ($_GET['saveFiles']!="CLEAR") { $saveFiles=strClean($_GET['saveFiles']); $saveFilesArray = explode(",",$saveFiles); $saveFiles=""; for ($i=0;$i "')+18; $repPosEnd = strpos($settingsContents,'"',$repPosStart)-$repPosStart; $commaExtra = $ICEcoder["last10Files"]!="" ? "," : ""; if (count($last10FilesArray)>=10) {$ICEcoder["last10Files"]=substr($ICEcoder["last10Files"],0,strrpos($ICEcoder["last10Files"],','));}; $settingsContents = substr($settingsContents,0,$repPosStart).$saveFilesArray[$i].$commaExtra.$ICEcoder["last10Files"].substr($settingsContents,($repPosStart+$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/".$settingsFile); fwrite($fh, $settingsContents); } } } fclose($fh); } echo ''; } // If we're updating or calling from the index.php page, do/redo plugins 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) { $ICEcoder["plugins"] = array(); $pluginsArray = explode("====================",str_replace("\"","",str_replace("\r","",str_replace("\n","",$_POST['plugins'])))); for ($i=0;$i'.$ICEcoder['; }; // If we're updating, replace the plugin display with our newly established one if (isset($_POST["theme"]) && $_POST["theme"] && $_SESSION['userLevel'] == 10) { echo ""; } // Work out what plugins we'll need to set on a setInterval $onLoadExtras = ""; for ($i=0;$i ICEcoder <?php echo $ICEcoder["versionNo"];?> setup
0) { // If we're setting a password if (isset($_POST['accountPassword'])) { $password = generateHash(strClean($_POST['accountPassword'])); $settingsFile = 'lib/'.$settingsFile; $settingsContents = file_get_contents($settingsFile); // Replace our empty password with the one submitted by user $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 ".$settingsFile); fwrite($fh, $settingsContents); fclose($fh); // Set the session user level $_SESSION['userLevel'] = 10; // Finally, load again as now this file has changed and auto login header('Location: index.php'); } else { // We need to set the password header('Location: lib/settings.php?settings=set'); } } // 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']),$ICEcoder["accountPassword"])==$ICEcoder["accountPassword"]) { $loginAttempt = 'loginOK'; if ($ICEcoder["previousFiles"]!="") { $openFilesArray = explode(",",$ICEcoder["previousFiles"]); echo ''; } } else { $loginAttempt = 'loginFailed'; } echo ""; } } ?>