Code

Fixed alphabet match
[gosa.git] / gosa-core / include / functions.inc
index 28e5a7fc8ed3f03f87043554f0376f4e7b0e0a30..d9a82de75ba20be2d811564f4e2ff67a9380bf0a 100644 (file)
@@ -309,14 +309,14 @@ function gosa_log ($message)
   global $ui;
 
   /* Preset to something reasonable */
-  $username= " unauthenticated";
+  $username= "[unauthenticated]";
 
   /* Replace username if object is present */
   if (isset($ui)){
     if ($ui->username != ""){
       $username= "[$ui->username]";
     } else {
-      $username= "unknown";
+      $username= "[unknown]";
     }
   }
 
@@ -1743,7 +1743,7 @@ function gen_uids($rule, $attributes)
       $size= preg_replace('/^.*{id(:|!)(\d+)}.*$/', '\\2', $uid);
 
       $start= $m[1]==":"?0:-1;
-      for ($i= $start, $p= pow(10,$size); $i < $p; $i++){
+      for ($i= $start, $p= pow(10,$size)-1; $i < $p; $i++){
         if ($i == -1) {
           $number= "";
         } else {
@@ -1757,6 +1757,9 @@ function gen_uids($rule, $attributes)
           break;
         }
       }
+
+      /* Remove link if nothing has been found */
+      $uid= preg_replace('/{id(:|!)\d+}/', '', $uid);
     }
 
     if(preg_match('/\{id#\d+}/',$uid)){
@@ -1772,6 +1775,9 @@ function gen_uids($rule, $attributes)
           break;
         }
       }
+
+      /* Remove link if nothing has been found */
+      $uid= preg_replace('/{id#\d+}/', '', $uid);
     }
 
     /* Don't assign used ones */