]> git.sur5r.net Git - contagged/commitdiff
catch a few more LDAP errors and display them in a nicer way
authorAndreas Gohr <gohr@cosmocode.de>
Wed, 5 Dec 2007 14:56:54 +0000 (15:56 +0100)
committerAndreas Gohr <gohr@cosmocode.de>
Wed, 5 Dec 2007 14:56:54 +0000 (15:56 +0100)
darcs-hash:20071205145654-6e07b-5775495f3f5d527beec66ed368b6aceea42d3b65.gz

entry.php
inc/functions.php
inc/template.php
pix/ldaperror.png [new file with mode: 0644]
styles/design.css
templates/header.tpl
templates/style.css

index bb207ceb10e62d40a22faade43995ac6e9dfe9dd..524bb543b4dd7b1e444bed899fdaf553cc901176 100644 (file)
--- a/entry.php
+++ b/entry.php
@@ -89,8 +89,9 @@ function _fetchData($dn){
   global $smarty;
   global $users; //contains the users for manager role
 
-  $sr = ldap_search($LDAP_CON,$dn,'(objectClass=inetOrgPerson)');
-  if(!ldap_count_entries($LDAP_CON,$sr)){
+  $sr = @ldap_search($LDAP_CON,$dn,'(objectClass=inetOrgPerson)');
+  tpl_ldaperror();
+  if(!@ldap_count_entries($LDAP_CON,$sr)){
     return false;
   }
   $result = ldap_get_binentries($LDAP_CON, $sr);
index bb24f23691114a22b7e5ff30d0729e96cb508ef1..33300c64462a0c0f2149147275ea229485ee2a97 100644 (file)
@@ -386,8 +386,9 @@ function ldap_queryabooks($filter,$types){
   $result2 = array();
 
   // public addressbook
-  $sr      = ldap_list($LDAP_CON,$conf['publicbook'],
-                       $filter,$types);
+  $sr      = @ldap_list($LDAP_CON,$conf['publicbook'],
+                        $filter,$types);
+  tpl_ldaperror();
   $result1 = ldap_get_binentries($LDAP_CON, $sr);
   ldap_free_result($sr);
 
@@ -396,6 +397,7 @@ function ldap_queryabooks($filter,$types){
     $sr      = @ldap_list($LDAP_CON,$conf['privatebook'].
                           ','.$_SESSION['ldapab']['binddn'],
                           $filter,$types);
+    tpl_ldaperror();
     $result2 = ldap_get_binentries($LDAP_CON, $sr);
   }
 
index 8ebe359f26c24a60e4e8339c1788537eca3fb54b..93095a182e60d956c1e892403f7769cd4431c76e 100644 (file)
@@ -97,7 +97,6 @@ function tpl_ldaperror($message=""){
     if(!empty($message)){
       $__LDAPERROR__ .= "($message)";
     }
-    $__LDAPERROR__ .= '\n';
   }
   $smarty->assign("LDAPERRORS",$__LDAPERROR__);
 }
diff --git a/pix/ldaperror.png b/pix/ldaperror.png
new file mode 100644 (file)
index 0000000..1fb7d19
Binary files /dev/null and b/pix/ldaperror.png differ
index f23a280122990a5e8a5ecc436c80cf36b437ffa8..aab332398ef81a5f451c32a15b036deb14767cf2 100644 (file)
@@ -148,3 +148,20 @@ a.cloud_4 {font-size: 160%; }
 a.cloud_5 {font-size: 180%; }
 a.cloud_6 {font-size: 200%; }
 
+
+div.ldaperror {
+  border: 1px solid #c33;
+  background: #fcc url(../pix/ldaperror.png) 10px 10px no-repeat;
+  width: 50%;
+  position: absolute;
+  z-index: 555;
+  top: 20%;
+  left: 25%;
+  padding: 0.5em 0.5em 1em 80px;
+  height: auto !important;
+  height: 60px;
+  min-height: 60px;
+  opacity: 0.9;
+  cursor: pointer;
+}
+
index 4939c97ba313b34770fdec30ffd59557ffdf8819..224538e931c6339189597e502338747b31655c5f 100644 (file)
@@ -28,9 +28,6 @@
     <script src="scripts/gui.js" type="text/javascript"></script>
 
     <script type="text/javascript">
-        {if $LDAPERRORS != ''}
-            window.alert('{$lang.err_ldap}:\n\n{$LDAPERRORS|escape:quotes}');
-        {/if}
         {if $entry.dn}
             DN = '{$entry.dn|escape:javascript}';
         {/if}
 <body>
 
 <div id="ldapab">
+    {if $LDAPERRORS != ''}
+        <div class="ldaperror" onclick="this.style.display = 'none'">
+            <h3>{$lang.err_ldap}</h3>
+            <p>{$LDAPERRORS|escape}</p>
+        </div>
+    {/if}
+
 
     <div id="titlerow">
         <div class="logo">
index 60347996ab62ba0fd4fa44240c43ce9859237722..78f4cd936e459d2e959700806e758a64265ab1a5 100644 (file)
@@ -152,3 +152,4 @@ a.tag {
   background: url(../pix/tag_blue.png) left center no-repeat;
   padding-left: 18px;
 }
+