X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gosa-core%2Fhtml%2Fautocomplete.php;h=fa48fab573908bef7cba7c8582f1a3b01ba9badf;hb=6ee7af102f93c5f5319b11b2e7d10ddf36d71bf6;hp=975edd2a477fe6f653a81a7f01997107f129ca95;hpb=675d979edf9e1f906f74f1228e31afa01a5a13d2;p=gosa.git diff --git a/gosa-core/html/autocomplete.php b/gosa-core/html/autocomplete.php index 975edd2a4..fa48fab57 100644 --- a/gosa-core/html/autocomplete.php +++ b/gosa-core/html/autocomplete.php @@ -24,20 +24,69 @@ @require_once ("../include/php_setup.inc"); @require_once ("functions.inc"); +session_cache_limiter("private"); session::start(); session::global_set('errorsAlreadyPosted',array()); /* Logged in? Simple security check */ if (!session::global_is_set('ui')){ - new log("security","unknown","",array(),"Error: autocomplete.php called without session") ; - header ("Location: index.php"); - exit; + new log("security","unknown","",array(),"Error: autocomplete.php called without session") ; + header ("Location: index.php"); + exit; } -/* Is there a filter object arround? */ -if (session::is_set("autocomplete")){ - $filter= session::get("autocomplete"); - $filter->processAutocomplete(); +/* Base completition or filter completition? */ +if (isset($_GET['type']) && $_GET['type'] == "base" && isset($_GET['pid'])) { + + // Find dn based on name and description + $pid = $_GET['pid']; + if (session::is_set("pathMapping_{$pid}")){ + $res= ""; + $pathMapping= session::get("pathMapping_{$pid}"); + $department_info= session::get("department_info_{$pid}"); + + + $search= preg_replace('/"/', '"', current($_POST)); + foreach ($department_info as $dn => $info) { + + if (!isset($pathMapping[$dn])) { + + + continue; + } + if (mb_stristr($info['name'], $search) !== false) { + $res.= "
  • ".mark($search, $pathMapping[$dn]).($info['description']==''?"" + :" [".mark($search, $info['description'])."]")."
  • "; + continue; + } + if (mb_stristr($info['description'], $search) !== false) { + $res.= "
  • ".mark($search, $pathMapping[$dn]).($info['description']==''?"" + :" [".mark($search, $info['description'])."]")."
  • "; + continue; + } + if (mb_stristr($pathMapping[$dn], $search) !== false) { + $res.= "
  • ".mark($search, $pathMapping[$dn]).($info['description']==''?"" + :" [".mark($search, $info['description'])."]")."
  • "; + continue; + } + } + + /* Return results */ + if (!empty($res)) { + echo ""; + } + } + +} else { + + $ui = session::global_get('ui'); + $config = session::global_get('config'); + + /* Is there a filter object arround? */ + if (session::is_set("autocomplete")){ + $filter= session::get("autocomplete"); + $filter->processAutocomplete(); + } } ?>