summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8e42174)
raw | patch | inline | side by side (parent: 8e42174)
author | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 3 Mar 2008 15:35:52 +0000 (15:35 +0000) | ||
committer | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 3 Mar 2008 15:35:52 +0000 (15:35 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9252 594d385d-05f5-0310-b6e9-bd551577e9d8
index c7896deaa527201ef8f75d31db0f7de1fddef48d..0d807407fc82ae7ccac3a211099526f03e38ca94 100644 (file)
$message[]= _("The passwords you've entered as 'New password' and 'Repeated new password' do not match.");
} else {
if ($_POST['new_password'] == ""){
- $message[]= _("The password you've entered as 'New password' is empty.");
+ $message[]= msgPool::required(_("New password"));
}
}
}
/* Validate */
- if (!ereg("^[A-Za-z0-9_.-]+$", $uid)){
- $message[]= _("Please specify a valid username!");
+ if (!tests::is_uid($uid)){
+ $message[]= msgPool::invalid(_("Login"));
} elseif (mb_strlen($_POST["current_password"], 'UTF-8') == 0){
- $message[]= _("Please specify your password!");
+ $message[]= msgPool::required(_("Current password"));
} else {
/* Do we have the selected user somewhere? */
diff --git a/gosa-core/include/class_SnapShotDialog.inc b/gosa-core/include/class_SnapShotDialog.inc
index 00e1f870d53a952be0c7e13b33dd28575c79aabf..258a1b2e95641f0c1390a52d32cd1703cdb4f5ad 100644 (file)
$message = plugin::check();
if(!$this->display_restore_dialog){
if(empty($this->CurrentDescription)){
- $message[] = _("Please specify a valid description for this snapshot.");
+ $message[]= msgPool::invalid(_("Description"));
}
}
return($message);
index 6bf6e73db4e49045c1238a3bc59a5fc83284e539..de49eb40d2a4eb92e880bb78fd21b07d4165b98e 100644 (file)
if ($command != ""){
if (!check_command($command)){
- $message[]= sprintf(_("Command '%s', specified as CHECK hook for plugin '%s' doesn't seem to exist."), $command,
- get_class($this));
+ $message[]= msgPool::cmdnotfound("CHECK", get_class($this));
} else {
/* Generate "ldif" for check hook */
$current_csn = getEntryCSN($this->dn);
if($current_csn != $this->entryCSN && !empty($this->entryCSN) && !empty($current_csn)){
$this->entryCSN = $current_csn;
- $message[] = _("The object has changed since opened in GOsa. Please ensure that nobody has done serious changes that may get lost if you save this entry.");
+ $message[] = _("The object has changed since opened in GOsa. All changes that may be done by others get lost if you save this entry!");
}
}
return ($message);
exec($command);
} else {
- $message= sprintf(_("Command '%s', specified as POSTCREATE for plugin '%s' doesn't seem to exist."), $command, get_class($this));
+ $message[]= msgPool::cmdnotfound("POSTCREATE", get_class($this));
msg_dialog::display(_("Error"), $message, ERROR_DIALOG);
}
}
exec($command);
} else {
- $message= sprintf(_("Command '%s', specified as POSTMODIFY for plugin '%s' doesn't seem to exist."), $command, get_class($this));
+ $message[]= msgPool::cmdnotfound("POSTMODIFY", get_class($this));
msg_dialog::display(_("Error"), $message, ERROR_DIALOG);
}
}
exec($command);
} else {
- $message= sprintf(_("Command '%s', specified as POSTREMOVE for plugin '%s' doesn't seem to exist."), $command, get_class($this));
+ $message[]= msgPool::cmdnotfound("POSTREMOVE", get_class($this));
msg_dialog::display(_("Error"), $message, ERROR_DIALOG);
}
}
index c5eec8021fa31432895cf41ab0fc0df1841d2416..8e2484c8002e8a6d447acf5eccf0a93ae0b98e04 100644 (file)
class msgPool
{
+ public static function reserved($name)
+ {
+ return (sprintf(_("The field '%s' contains a reserved keyword!"), $name));
+ }
+
+
+ public static function cmdnotfound($type, $plugin)
+ {
+ return (sprintf(_("Command specified as %s hook for plugin '%s' does not exist!"), $type, $plugin));
+ }
+
+
public static function toobig($name, $min= "")
{
if ($min == ""){
if (preg_match("$regex", $currentChar)){
$result.= $currentChar;
} else {
- $result.= "<font style='color:red;'>".htmlentities($currentChar)."</font>";
+ $result.= "<font style='color:red;text-decoration:underline;'>".htmlentities($currentChar)."</font>";
$mismatch.= $currentChar;
}
}
diff --git a/gosa-core/plugins/admin/departments/class_departmentGeneric.inc b/gosa-core/plugins/admin/departments/class_departmentGeneric.inc
index 08c7f3b101b5cc4370570011d7a40acec93c8dd6..0f9ec67cfb93d0e51253cbcafe9c02822d7dd98d 100644 (file)
$ldap= $this->config->get_ldap_link();
$ldap->ls ("(&(ou=".$this->ou.")(objectClass=organizationalUnit))", $this->base, array('dn'));
if ($this->orig_dn == "new" && $ldap->count()){
- $message[]= _("Department with that 'Name' already exists.");
+ $message[]= msgPool::duplicated(_("Name"));
} elseif ($this->orig_dn != $this->dn && !($attrs === FALSE)){
- $message[]= _("Department with that 'Name' already exists.");
+ $message[]= msgPool::duplicated(_("Name"));
}
/* All required fields are set? */
if ($this->ou == ""){
$message[]= _("Required field 'Name' is not set.");
+ $message[]= msgPool::required(_("Name"));
}
if ($this->description == ""){
$message[]= _("Required field 'Description' is not set.");
+ $message[]= msgPool::required(_("Description"));
}
if(tests::is_department_name_reserved($this->ou,$this->base)){
- $message[]= sprintf(_("The field 'Name' contains the reserved word '%s'. Please choose another name."),$this->ou);
+ $message[]= msgPool::reserved(_("Name"));
}
if (preg_match ('/[#+:=>\\\\\/]/', $this->ou)){
- $message[]= _("The field 'Name' contains invalid characters.");
+ $message[]= msgPool::invalid(_("Name"), $this->ou, "/[^#+:=>\\\\\/]/");
}
if (!tests::is_phone_nr($this->telephoneNumber)){
- $message[]= _("The field 'Phone' contains an invalid phone number.");
+ $message[]= msgPool::invalid(_("Phone"), $this->telephoneNumber, "/[\/0-9 ()+*-]/");
}
if (!tests::is_phone_nr($this->facsimileTelephoneNumber)){
- $message[]= _("The field 'Fax' contains an invalid phone number.");
+ $message[]= msgPool::invalid(_("Fax"), $this->facsimileTelephoneNumber, "/[\/0-9 ()+*-]/");
}
return $message;
diff --git a/gosa-core/plugins/admin/groups/class_groupGeneric.inc b/gosa-core/plugins/admin/groups/class_groupGeneric.inc
index eed50c61da55b8e197849ed55c5eea10f01626ad..5f0a1c86112fdae5d140a6d8a7e243068a6ef690 100644 (file)
/* If more than max users are found, display a message to warn the user */
if($i == $MaxUser){
- msg_dialog::display(_("Configuration error"), sprintf(_("Search returned too many results. Not displaying more than %s entries."), $MaxUser), ERROR_DIALOG);
+ msg_dialog::display(_("Configuration error"), sprintf(_("Search returned too many results. Not displaying more than %s entries!"), $MaxUser), ERROR_DIALOG);
}
/* Sort lists */
/* must: cn */
if ($this->cn == "" && $this->acl_is_writeable("cn")){
- $message[]= "The required field 'Name' is not set.";
+ $message[]= msgPool::required(_("Name"));
}
/* Check for valid input */
if (!tests::is_uid($this->cn)){
- $message[]= _("The field 'Name' contains invalid characters. Lowercase, numbers and dashes are allowed.");
+ if (strict_uid_mode()){
+ $message[]= msgPool::invalid(_("Name"), $this->cn, "/[a-z0-9_-]/");
+ } else {
+ $message[]= msgPool::invalid(_("Name"), $this->cn, "/[a-z0-9_-]/i");
+ }
}
if($this->allowGroupsWithSameNameInOtherSubtrees == true){
$ldap->cd(get_groups_ou().$this->base);
$ldap->ls("(&(|(objectClass=gosaGroupOfNames)(objectClass=posixGroup))(cn=$this->cn))",get_groups_ou().$this->base,array("cn"));
if ($ldap->count() != 0){
- $message[]= _("Value specified as 'Name' is already used.");
+ $message[]= msgPool::duplicated(_("Name"));
}
}
/* New entry? */
if ($this->dn == 'new'){
- $message[]= _("Value specified as 'Name' is already used.");
+ $message[]= msgPool::duplicated(_("Name"));
}
/* Moved? */
elseif ($new_dn != $this->orig_dn){
$ldap->fetch();
if ($ldap->getDN() != $this->orig_dn){
- $message[]= _("Value specified as 'Name' is already used.");
+ $message[]= msgPool::duplicated(_("Name"));
}
}
}
/* Check ID */
if ($this->force_gid == "1"){
if (!tests::is_id($this->gidNumber)){
- $message[]= _("Value specified as 'GID' is not valid.");
+ $message[]= msgPool::invalid(_("GID"), $this->gidNumber, "/[0-9]/");
} else {
if ($this->gidNumber < $this->config->current['MINID']){
- $message[]= _("Value specified as 'GID' is too small.");
+ $message[]= msgPool::toosmall(_("GID"), $this->config->current['MINID']);
}
}
diff --git a/gosa-core/plugins/admin/ogroups/class_ogroup.inc b/gosa-core/plugins/admin/ogroups/class_ogroup.inc
index ca2ef69693c6ea9f32b2abc230c9faa7e817923a..b36a79cf48d4f77158568b0749da651e22b99a74 100644 (file)
}
if($ldap->count() !=0){
- $message[]= _("There is already an object with this cn.");
+ $message[]= msgPool::duplicated(_("Name"));
}
/* Set new acl base */
/* must: cn */
if ($this->cn == ""){
- $message[]= "The required field 'Name' is not set.";
+ $message[]= msgPool::required(_("Name"));
}
/* To many different object types? */
if (strlen($this->gosaGroupObjects) > 4){
- $message[]= _("You can combine two different object types at maximum only!");
+ $message[]= _("You can combine two different object types at maximum, only!");
}
return ($message);
diff --git a/gosa-core/plugins/admin/users/class_userManagement.inc b/gosa-core/plugins/admin/users/class_userManagement.inc
index 04a17bc485c896e04848d0dd389d6663d682e18b..0d7a5f69889b7ee0604cb2f90403a42a70a00c1e 100644 (file)
/* Empty password is not permitted by default. */
if ($_POST['new_password'] == ""){
- $message[]= _("The password you've entered as 'New password' is empty.");
+ msgPool::required(_("New password"));
}
}
if (isset($_POST['template_continue'])){
$message = array();
if(!isset($_POST['template']) || (empty($_POST['template']))){
- $message[] = _("Please select a valid template.");
+ $message[]= msgPool::invalid(_("Template"));
}
if(!isset($_POST['sn']) || (empty($_POST['sn']))){
- $message[]= _("The required field 'Name' is not set.");
+ $message[]= msgPool::required(_("Name"));
}
if(!isset($_POST['givenName']) || (empty($_POST['givenName']))){
- $message[]= _("The required field 'Given name' is not set.");
+ $message[]= msgPool::required(_("Given name"));
}
/* Show error message / continue editing */
/* Check for requred values */
$message= array();
if ($this->sn == "") {
- $message[]= _("The required field 'Name' is not set.");
+ $message[]= msgPool::required(_("Name"));
}
if ($this->givenName == "") {
- $message[]= _("The required field 'Given name' is not set.");
+ $message[]= msgPool::required(_("Given name"));
}
/* Check if dn is used */
$ldap->cd ($dn);
$ldap->search ("(&(sn=".normalizeLdap($this->sn).")(givenName=".normalizeLdap($this->givenName)."))", array("givenName"));
if ($ldap->count () != 0){
- $message[]= _("A person with the choosen name is already used in this tree.");
+ msgPool::duplicated(_("Name"));
}
/* Show error message / continue editing */
diff --git a/gosa-core/plugins/personal/generic/main.inc b/gosa-core/plugins/personal/generic/main.inc
index beafad1e8576858bd0427144216487f2c1837225..753e8d412cca3ae73ededf367e2a7fd3ff656274 100644 (file)
/* Empty password is not permitted by default. */
if ($_POST['new_password'] == ""){
- $message[]= _("The password you've entered as 'New password' is empty.");
+ $message[]= msgPool::required(_("New password"));
}
}