From 4384b0a32a169719caf143c80a586dc13b1c6a39 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Fri, 14 Aug 2009 18:06:15 +0000 Subject: [PATCH] *** empty log message *** --- lam/lib/selfService.inc | 8 ++++---- lam/templates/config/conftypes.php | 2 +- lam/templates/config/mainmanage.php | 6 +++--- lam/templates/config/profmanage.php | 6 +++--- lam/templates/ou_edit.php | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lam/lib/selfService.inc b/lam/lib/selfService.inc index e18e6bd8..5be29e59 100644 --- a/lam/lib/selfService.inc +++ b/lam/lib/selfService.inc @@ -159,8 +159,8 @@ function getSelfServiceProfiles() { * @return selfServiceProfile true if file was readable */ function loadSelfServiceProfile($name, $scope) { - if (!eregi("^[0-9a-z _-]+$", $name)) return false; - if (!eregi("^[0-9a-z _-]+$", $scope)) return false; + if (!preg_match("/^[0-9a-z _-]+$/i", $name)) return false; + if (!preg_match("/^[0-9a-z _-]+$/i", $scope)) return false; $profile = new selfServiceProfile(); $file = substr(__FILE__, 0, strlen(__FILE__) - 20) . "/config/selfService/" . $name . "." . $scope; if (is_file($file) === True) { @@ -193,8 +193,8 @@ function loadSelfServiceProfile($name, $scope) { */ function saveSelfServiceProfile($name, $scope, $profile) { // check profile name - if (!eregi("^[0-9a-z _-]+$", $scope)) return false; - if (!eregi("^[0-9a-z _-]+$", $name)) return false; + if (!preg_match("/^[0-9a-z _-]+$/i", $scope)) return false; + if (!preg_match("/^[0-9a-z _-]+$/i", $name)) return false; if (!get_class($profile) === 'selfServiceProfile') { return false; } diff --git a/lam/templates/config/conftypes.php b/lam/templates/config/conftypes.php index d55a5ca3..132e7c3b 100644 --- a/lam/templates/config/conftypes.php +++ b/lam/templates/config/conftypes.php @@ -296,7 +296,7 @@ function checkInput() { elseif (substr($key, 0, 5) == "attr_") { $typeSettings[$key] = $_POST[$key]; $type = substr($postKeys[$i], 5); - if (!is_string($_POST[$key]) || !eregi("^((#[^:;]+)|([^:;]*:[^:;]+))(;((#[^:;]+)|([^:;]*:[^:;]+)))*$", $_POST[$key])) { + if (!is_string($_POST[$key]) || !preg_match("/^((#[^:;]+)|([^:;]*:[^:;]+))(;((#[^:;]+)|([^:;]*:[^:;]+)))*$/", $_POST[$key])) { $errors[] = array("ERROR", _("List attributes are invalid!"), getTypeAlias($type)); } } diff --git a/lam/templates/config/mainmanage.php b/lam/templates/config/mainmanage.php index 2284d5f8..eff0a0ad 100644 --- a/lam/templates/config/mainmanage.php +++ b/lam/templates/config/mainmanage.php @@ -105,8 +105,8 @@ if (isset($_POST['submit'])) { continue; } // check each line - $ipRegex = '^[0-9\\.\\*]+$'; - if (!ereg($ipRegex, $allowedHostsList[$i]) || (strlen($allowedHostsList[$i]) > 15)) { + $ipRegex = '/^[0-9\\.\\*]+$/'; + if (!preg_match($ipRegex, $allowedHostsList[$i]) || (strlen($allowedHostsList[$i]) > 15)) { $errors[] = sprintf(_("The IP address %s is invalid!"), $allowedHostsList[$i]); } } @@ -120,7 +120,7 @@ if (isset($_POST['submit'])) { if ($_POST['logDestination'] == "none") $cfg->logDestination = "NONE"; elseif ($_POST['logDestination'] == "syslog") $cfg->logDestination = "SYSLOG"; else { - if (isset($_POST['logFile']) && ($_POST['logFile'] != "") && eregi("^[a-z0-9/\\\\:\\._-]+$", $_POST['logFile'])) { + if (isset($_POST['logFile']) && ($_POST['logFile'] != "") && preg_match("/^[a-z0-9/\\\\:\\._-]+$/i", $_POST['logFile'])) { $cfg->logDestination = $_POST['logFile']; } else $errors[] = _("The log file is empty or contains invalid characters! Valid characters are: a-z, A-Z, 0-9, /, \\, ., :, _ and -."); diff --git a/lam/templates/config/profmanage.php b/lam/templates/config/profmanage.php index d96e86a4..907f20ba 100644 --- a/lam/templates/config/profmanage.php +++ b/lam/templates/config/profmanage.php @@ -73,7 +73,7 @@ if ($_POST['submit']) { } // add new profile elseif ($_POST['action'] == "add") { - if (eregi("^[a-z0-9_-]+$", $_POST['addprofile']) && !in_array($_POST['addprofile'], getConfigProfiles())) { + if (preg_match("/^[a-z0-9_-]+$/i", $_POST['addprofile']) && !in_array($_POST['addprofile'], getConfigProfiles())) { // check profile password if ($_POST['addpassword'] && $_POST['addpassword2'] && ($_POST['addpassword'] == $_POST['addpassword2'])) { // create new profile file @@ -95,7 +95,7 @@ if ($_POST['submit']) { } // rename profile elseif ($_POST['action'] == "rename") { - if (eregi("^[a-z0-9_-]+$", $_POST['renfilename']) && !in_array($_POST['renfilename'], getConfigProfiles())) { + if (preg_match("/^[a-z0-9_-]+$/i", $_POST['renfilename']) && !in_array($_POST['renfilename'], getConfigProfiles())) { if (rename("../../config/" . $_POST['oldfilename'] . ".conf", "../../config/" . $_POST['renfilename'] . ".conf")) { $msg = _("Renamed profile."); @@ -106,7 +106,7 @@ if ($_POST['submit']) { } // delete profile elseif ($_POST['action'] == "delete") { - if (eregi("^[a-z0-9_-]+$", $_POST['delfilename']) && @unlink("../../config/" . $_POST['delfilename'] . ".conf")) { + if (preg_match("/^[a-z0-9_-]+$/i", $_POST['delfilename']) && @unlink("../../config/" . $_POST['delfilename'] . ".conf")) { $msg = _("Profile deleted."); } else $error = _("Unable to delete profile!"); diff --git a/lam/templates/ou_edit.php b/lam/templates/ou_edit.php index 3a05d245..886bbaf7 100644 --- a/lam/templates/ou_edit.php +++ b/lam/templates/ou_edit.php @@ -58,7 +58,7 @@ if (isset($_POST['createOU']) || isset($_POST['deleteOU'])) { // new ou if (isset($_POST['createOU'])) { // create ou if valid - if (eregi("^[a-z0-9 _\\-]+$", $_POST['newOU'])) { + if (preg_match("/^[a-z0-9 _\\-]+$/i", $_POST['newOU'])) { // check if ou already exists $new_dn = "ou=" . $_POST['newOU'] . "," . $_POST['parentOU']; if (!in_array($new_dn, $_SESSION['ldap']->search_units($_POST['parentOU']))) {