]> git.sur5r.net Git - contagged/blobdiff - ajax.php
Merge pull request #15 from cweiske/master
[contagged] / ajax.php
index 7e16b2f362d974e83880650600bb9ebea1739c09..580e262ed413b2214b67e70283805f7eb156150b 100644 (file)
--- a/ajax.php
+++ b/ajax.php
@@ -1,7 +1,14 @@
-<?
+<?php
 require_once('inc/init.php');
 ldap_login();
 
+if ($conf['userlogreq'] && !isset($_SESSION['ldapab']['username'])){
+  header("HTTP/1.1 401 Access Denied");
+  echo '<h1>Access Denied</h1>';
+  exit();
+}
+
+
 $FIELD = preg_replace('/entry\[/','',$_REQUEST['field']);
 $FIELD = preg_replace('/\W+/','',$FIELD);
 
@@ -88,9 +95,9 @@ function ajax_loadtags($dn,$type='plain'){
   $entry  = $result[0];
 
   if($type == 'plain'){
-    echo join(', ',$entry[$FIELDS['_marker']]);
+    echo join(', ',(array) $entry[$FIELDS['_marker']]);
   }else{
-    foreach ($entry[$FIELDS['_marker']] as $tag){
+    foreach ((array) $entry[$FIELDS['_marker']] as $tag){
       echo '<a href="index.php?marker=';
       echo rawurlencode($tag);
       echo '" class="tag">';