]> git.sur5r.net Git - contagged/blobdiff - inc/functions.php
Merge pull request #15 from cweiske/master
[contagged] / inc / functions.php
index 84a29f2539a7c978bc57b856b398f0d9a5500008..db8c6b0c5fd107b7c36da69ce1bc2e76a79918f2 100644 (file)
@@ -113,11 +113,9 @@ function do_ldap_bind($user,$pass,$dn=""){
 function auth_browseruid(){
   $uid  = '';
   if (empty($_SERVER['HTTP_USER_AGENT']))      { $_SERVER['HTTP_USER_AGENT']='USER_AGENT'; }
-  if (empty($_SERVER['HTTP_ACCEPT_ENCODING'])) { $_SERVER['HTTP_ACCEPT_ENCODING']='ACCEPT_ENCODING'; }
   if (empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { $_SERVER['HTTP_ACCEPT_LANGUAGE']='ACCEPT_LANGUAGE'; }
   if (empty($_SERVER['HTTP_ACCEPT_CHARSET']))  { $_SERVER['HTTP_ACCEPT_CHARSET']='ACCEPT_CHARSET'; }
   $uid .= $_SERVER['HTTP_USER_AGENT'];
-  $uid .= $_SERVER['HTTP_ACCEPT_ENCODING'];
   $uid .= $_SERVER['HTTP_ACCEPT_LANGUAGE'];
   $uid .= $_SERVER['HTTP_ACCEPT_CHARSET'];
   $uid .= substr($_SERVER['REMOTE_ADDR'],0,strpos($_SERVER['REMOTE_ADDR'],'.'));
@@ -359,9 +357,13 @@ function ldap_store_objectclasses($dn,$classes){
  * @author Andreas Gohr <andi@splitbrain.org>
  */
 function ldap_filterescape($string){
-  return preg_replace('/([\x00-\x1F\*\(\)\\\\])/e',
-                            '"\\\\\".join("",unpack("H2","$1"))',
-                            $string);
+  return preg_replace_callback(
+    '/([\x00-\x1F\*\(\)\\\\])/',
+    function ($matches) {
+      return "\\" . implode("", unpack("H2", $matches[1]));
+    },
+    $string
+  );
 }
 
 /**
@@ -526,24 +528,3 @@ function get_fields_from_template($tpl){
     return $return;
 }
 
-function addCoords(&$coords, $entry, $geocoder)
-{
-    $priv = $geocoder->getPrivateCoords($entry);
-    if ($priv !== null) {
-        $priv->address = '<b>'
-            . $entry['givenname'] . ' ' . $entry['name'] . '</b><br/>'
-            . str_replace("\n", '<br/>', $entry['homestreet']);
-        $coords[] = $priv;
-    }
-
-    $busi = $geocoder->getBusinessCoords($entry);
-    if ($busi !== null) {
-        $busi->address = '<b>' . $entry['organization'] . '<br/>'
-            . $entry['givenname'] . ' ' . $entry['name'] . '</b><br/>'
-            . $entry['street'] . '<br/>'
-            . $entry['zip'] . $entry['location'];
-        $coords[] = $busi;
-    }
-}
-
-?>