allow spaces in profile names and fixed magic_quotes_gpc problem

This commit is contained in:
Roland Gruber 2005-10-23 09:26:18 +00:00
parent 09f692b87a
commit 6e083bd690
3 changed files with 12 additions and 4 deletions

View File

@ -3,6 +3,9 @@
- check file permissions on login page
- fixed bugs:
-> creation of home directories did not work
-> allow spaces in profile names (1333058)
-> fixed problem with magic_quotes_gpc in profile editor (1333069)
19.10.2005 0.5.1
- Samba 3: added support for account expiration

View File

@ -64,7 +64,7 @@ function getAccountProfiles($scope) {
* @return array hash array (attribute => value)
*/
function loadAccountProfile($profile, $scope) {
if (!eregi("^[0-9a-z_-]+$", $profile) || !eregi("^[a-z]+$", $scope)) return false;
if (!eregi("^[0-9a-z _-]+$", $profile) || !eregi("^[a-z]+$", $scope)) return false;
$settings = array();
$file = substr(__FILE__, 0, strlen(__FILE__) - 17) . "/config/profiles/" . $profile . "." . $scope;
if (is_file($file) == True) {
@ -110,7 +110,7 @@ function loadAccountProfile($profile, $scope) {
function saveAccountProfile($attributes, $profile, $scope) {
if (!$_SESSION['loggedIn'] == true) return false;
// check profile name
if (!eregi("^[0-9a-z_-]+$", $profile) || !eregi("^[a-z]+$", $scope)) return false;
if (!eregi("^[0-9a-z _-]+$", $profile) || !eregi("^[a-z]+$", $scope)) return false;
if (!is_array($attributes)) {
return false;
}
@ -146,7 +146,7 @@ function saveAccountProfile($attributes, $profile, $scope) {
*/
function delAccountProfile($file, $scope) {
if (!$_SESSION['loggedIn'] == true) return false;
if (!eregi("^[0-9a-z\\-_]+$", $file) || !eregi("^[0-9a-z\\-_]+$", $scope)) return false;
if (!eregi("^[0-9a-z _-]+$", $file) || !eregi("^[a-z]+$", $scope)) return false;
$prof = substr(__FILE__, 0, strlen(__FILE__) - 16) . "config/profiles/" . $file . "." . $scope;
if (is_file($prof)) {
return @unlink($prof);

View File

@ -141,7 +141,12 @@ if (isset($_POST['save'])) {
$postKeys = array_keys($_POST);
for ($i = 0; $i < sizeof($postKeys); $i++) {
if (!is_array($_POST[$postKeys[$i]])) {
$old_options[$postKeys[$i]] = array($_POST[$postKeys[$i]]);
if (get_magic_quotes_gpc() == 1) {
$old_options[$postKeys[$i]] = array(stripslashes($_POST[$postKeys[$i]]));
}
else {
$old_options[$postKeys[$i]] = array($_POST[$postKeys[$i]]);
}
}
else {
$old_options[$postKeys[$i]] = $_POST[$postKeys[$i]];