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

Commit

Permalink
Removing spaces from 4 x CSVs before use
Browse files Browse the repository at this point in the history
Before saving the values, remove spaces from CSV values provided by user
Also covering the same thing in the 4 x session arrays & arrays that are
created
  • Loading branch information
mattpass committed Sep 8, 2012
1 parent 8ce1da9 commit 8cfe6b5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/settings.php
Expand Up @@ -46,14 +46,14 @@ function numClean($var) {
$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["findFilesExclude"] = 'array("'.str_replace(',','","',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["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']);
Expand All @@ -76,7 +76,7 @@ function numClean($var) {
// OK, now the config file has been updated, update our current session with new arrays
$settingsArray = array("findFilesExclude","restrictedFiles","bannedFiles","allowedIPs");
for ($i=0;$i<count($settingsArray);$i++) {
$_SESSION[$settingsArray[$i]] = $ICEcoder[$settingsArray[$i]] = explode(", ",strClean($_POST[$settingsArray[$i]]));
$_SESSION[$settingsArray[$i]] = $ICEcoder[$settingsArray[$i]] = explode(",",str_replace(" ","",strClean($_POST[$settingsArray[$i]])));
}
// Work out the theme to use now
$ICEcoder["theme"]=="default" ? $themeURL = 'lib/editor.css' : $themeURL = $ICEcoder["codeMirrorDir"].'/theme/'.$ICEcoder["theme"].'.css';
Expand Down

0 comments on commit 8cfe6b5

Please sign in to comment.