]> git.datanom.net - qtadmin.git/blobdiff - lib/utils.inc.php
add more debug info
[qtadmin.git] / lib / utils.inc.php
index 6cea76ef1943fbc4d3c551f9e4eb27307f175248..6e8f6249da604fc7f3697c7e26783dd82117f87d 100644 (file)
@@ -22,7 +22,54 @@ class Utils {
     <script src="__ROOT__js/forms.js"></script>
     <title>__TITLE__</title>
 </head>
-<body><div id="container">';
+<body>
+<!--
+<nav>
+    <ul>
+        <li><a href="index.php">Home</a></li>
+        <li>
+            <a href="#">Sections <span class="caret"></span></a>
+            <div>
+                <ul>
+                    <li><a href="qtadmin.php">Quarantine admin</a></li>
+                    <li><a href="wblist.php">WB list admin</a></li>
+                </ul>
+            </div>
+        </li>
+        <li><a href="about.html">About</a></li>
+        <li><a href="auth.php?op=logout">Logout</a></li>
+    </ul>
+</nav>
+-->
+<nav>
+    <ul>
+        <li><a href="index.php">Home</a></li>
+        <li>
+            <a href="#">Sections <span class="caret"></span></a>
+            <div>
+                <ul>
+                    <li>
+                        <a href="qtadmin.php">Quarantine admin</span></a>
+                    </li>
+                    <li><a href="#">WB list admin <span class="caret"></a>
+                        <div>
+                            <ul>
+                                <li><a href="wblist.php?p=show&amp;s=all">Show All</a></li>
+                                <li><a href="wblist.php?p=show&amp;s=blacklist">Show Blacklist</a></li>
+                                <li><a href="wblist.php?p=show&amp;s=whitelist">Show Whitelist</a></li>
+                                <li><a href="wblist.php?p=add">Add Rule</a></li>
+                                <li><a href="wblist.php?p=del">Delete Rule</a></li>
+                            </ul>
+                        </div>
+                    </li>
+                </ul>
+            </div>
+        </li>
+        <li><a href="about.html">About</a></li>
+        <li><a href="auth.php?op=logout">Logout</a></li>
+    </ul>
+</nav>
+    <div id="container">';
     private $footer = '</div><div id="footer"><p>Powered by <a href="https://qtadmin.datanom.net"
             title="Goto QtAdmin homepage">QtAdmin</a>. &copy; 2015 by Michael Rasmussen</p>
     </div></body></html>';
@@ -207,7 +254,11 @@ class Utils {
             } else {
                 // HTTP GET
                 $data = json_decode($response['content']);
-                $result = $data->data;
+                if (is_object($data)) {
+                    $result = $data->data;
+                } else {
+                    $result = array('No result');
+                }
             }
         } else {
             $result = ($data) ? false : array();
@@ -313,14 +364,18 @@ class Utils {
         } else {
             $domain = $p[1];
             $dn = "mail=$user,ou=Users,domainName=$domain,$CFG->ldap_base_dn";
+            $this->log('dn: '.var_export($dn, true), 4);
             $filter = "(&(objectclass=mailUser)(accountStatus=active)(mail=$user))";
+            $this->log('filter: '.var_export($filter, true), 4);
             $ds = @ldap_connect($CFG->ldap_dsn);
             if ($ds) {
                 @ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
                 $r = @ldap_bind($ds, $dn, $pw);
                 if ($r) {
                     $sr = @ldap_search($ds, $CFG->ldap_base_dn, $filter, array('mail','domainglobaladmin'));
+                    $this->log('sr: '.var_export($sr, true), 4);
                     $info = @ldap_get_entries($ds, $sr); // array
+                    $this->log('info: '.var_export($info, true), 4);
                     if ($info['count'] > 0) {
                         // Log in to wblistadm server and get CSRFPreventionToken
                         if ($this->getRestTicket($user, $pw)) {
@@ -334,7 +389,7 @@ class Utils {
                             }
                             $this->settings['admin'] = ($admin == 'YES') ? true : false;
                         } else {
-                            $this->settings['loginStatus'] = 'Login failed';
+                            $this->settings['loginStatus'] = 'Login to wblistadm REST server failed';
                         }
                     } else {
                         $this->settings['loginStatus'] = 'Login failed';
This page took 0.054087 seconds and 5 git commands to generate.