Code

Removed debug output
[gosa.git] / gosa-core / include / functions.inc
index 9a9e2799c9a9762d31b38ca1fe5ff6edfda95982..df32e69ea857864c9cb278cefa02afef3b14d365 100644 (file)
@@ -528,6 +528,7 @@ function ldap_login_user_htaccess ($username)
   /* Bail out if we have login restrictions set, for security reasons
      the message is the same than failed user/pw */
   if (!$ui->loginAllowed()){
+    new log("security","login","",array(),"Login restriction for user \"$username\", login not permitted");
     return (NULL);
   }
 
@@ -624,6 +625,7 @@ function ldap_login_user ($username, $password)
   /* Bail out if we have login restrictions set, for security reasons
      the message is the same than failed user/pw */
   if (!$ui->loginAllowed()){
+    new log("security","login","",array(),"Login restriction for user \"$username\", login not permitted");
     return (NULL);
   }
 
@@ -3519,10 +3521,11 @@ function mark($needle, $haystack, $ignorecase= true)
 
 
 /* Return an image description using the path */
-function image($path, $label= null, $action= "", $title= "")
+function image($path, $action= "", $title= "", $align= "middle")
 {
   global $config;
   global $BASE_DIR;
+  $label= null;
 
   // Bail out, if there's no style file
   if(!session::global_is_set("img-styles")){
@@ -3544,6 +3547,11 @@ function image($path, $label= null, $action= "", $title= "")
   }
   $styles= session::global_get('img-styles');
 
+  /* Extract labels from path */
+  if (preg_match("/\.png\[(.*)\]$/", $path, $matches)) {
+    $label= $matches[1];
+  }
+
   $lbl= "";
   if ($label) {
     if (isset($styles["images/label-".$label.".png"])) {
@@ -3551,13 +3559,25 @@ function image($path, $label= null, $action= "", $title= "")
     } else {
       die("Invalid label specified: $label\n");
     }
+
+    $path= preg_replace("/\[.*\]$/", "", $path);
+  }
+
+  // Non middle layout?
+  if ($align == "middle") {
+    $align= "";
+  } else {
+    $align= ";vertical-align:$align";
   }
 
   // Clickable image or not?
+  if ($title != "") {
+    $title= "title='$title'";
+  }
   if ($action == "") {
-    return "<div class='img' style='".$styles[$path]."'>$lbl</div>";
+    return "<div class='img' $title style='".$styles[$path]."$align'>$lbl</div>";
   } else {
-    return "<button class='img' id='$action' name='$action' title='$title' type='submit'><div class='img' style='".$styles[$path]."'>$lbl</div></button>";
+    return "<input type='submit' class='img' id='$action' value='' name='$action' $title style='".$styles[$path]."$align'>";
   }
 }