From e5e982801086e26aaacd4e9706b2854972ae264c Mon Sep 17 00:00:00 2001 From: Paul Howarth Date: Thu, 27 Apr 2006 13:17:04 +0200 Subject: [PATCH 1/1] PHP5 compatibility and code cleanup The first (quotefix) patch just quotes string constants when used as indexes to arrays. This gets rid of many warning messages from PHP and also fixes at least one case where one of the strings is a reserved word ("private") in PHP5. The second (cleanup) patch probably needs more looking at as my lack of understanding of PHP may mean that I've not done things properly. 1. It adds an alternative way of specifying the LDAP server, by URL instead of hostname and port. 2. It casts the arguments of array_merge() to array types everywhere (not sure if all of these are necessary). 3. It makes $_SESSION['ldapab']['username'] and $_SESSION['ldapab']['binddn'] null strings if they are not set. 4. It removes the reference to the unused variable $dfexample With these fixes, ConTagged seems to run OK on PHP 5 darcs-hash:20060427111704-df059-55357a0b7161d967d7119368d08eaa2576331acd.gz --- ajax.php | 4 +- config.php | 37 +++++++------ entry.php | 58 ++++++++++----------- functions.php | 118 +++++++++++++++++++++-------------------- img.php | 2 +- import.php | 2 +- importVCF.php | 2 +- index.php | 20 +++---- init.php | 4 +- lang/de.php | 120 +++++++++++++++++++++--------------------- lang/en.php | 142 +++++++++++++++++++++++++------------------------- login.php | 12 ++--- tags.php | 2 +- template.php | 81 +++++++++++++++------------- 14 files changed, 309 insertions(+), 295 deletions(-) diff --git a/ajax.php b/ajax.php index fafe45a..564e59d 100644 --- a/ajax.php +++ b/ajax.php @@ -41,7 +41,7 @@ function ajax_addnote($dn,$note){ function ajax_settags($dn,$tags){ global $conf; global $LDAP_CON; - if(!$conf[extended]) return; + if(!$conf['extended']) return; $tags = explode(',',$tags); $tags = array_map('trim',$tags); @@ -67,7 +67,7 @@ function ajax_settags($dn,$tags){ function ajax_taglookup($tag){ global $conf; global $LDAP_CON; - if(!$conf[extended]) return; + if(!$conf['extended']) return; $search = ldap_filterescape($tag); $filter = "(&(objectClass=contactPerson)(marker=$search*))"; diff --git a/config.php b/config.php index 8de5079..84cd10d 100644 --- a/config.php +++ b/config.php @@ -1,50 +1,53 @@ diff --git a/entry.php b/entry.php index 00fa82c..c081da4 100644 --- a/entry.php +++ b/entry.php @@ -5,20 +5,20 @@ $users = get_users(); //select template to use - if( $_SESSION[ldapab][username] && - ($_REQUEST[mode]=='edit' || $_REQUEST[mode]=='copy')){ + if( $_SESSION['ldapab']['username'] && + ($_REQUEST['mode']=='edit' || $_REQUEST['mode']=='copy')){ $template='entry_edit.tpl'; - }elseif($_REQUEST[mode]=='vcf'){ + }elseif($_REQUEST['mode']=='vcf'){ $template='entry_vcf.tpl'; }else{ $template='entry_show.tpl'; } - $dn = $_REQUEST[dn]; + $dn = $_REQUEST['dn']; #$dn = 'cn=bar foo, ou=contacts, o=cosmocode, c=de'; //save data if asked for - if($_SESSION[ldapab][username] && $_REQUEST[save]){ + if($_SESSION['ldapab']['username'] && $_REQUEST['save']){ // prepare special data $_REQUEST['entry']['jpegPhoto'][]=_getUploadData(); $_REQUEST['entry']['marker'] = explode(',',$_REQUEST['entry']['markers']); @@ -37,11 +37,11 @@ } if(empty($dn)){ - if(!$_REQUEST[mode]=='edit'){ + if(!$_REQUEST['mode']=='edit'){ $smarty->assign('error','No dn was given'); $template = 'error.tpl'; } - }elseif($_REQUEST[del]){ + }elseif($_REQUEST['del']){ _delEntry($dn); }elseif(!_fetchData($dn)){ $smarty->assign('error',"The requested entry '$dn' was not found"); @@ -58,9 +58,9 @@ tpl_timezone(); tpl_country(); //display templates - if($_REQUEST[mode]=='vcf'){ + if($_REQUEST['mode']=='vcf'){ $entry = $smarty->get_template_vars('entry'); - $filename = $entry[givenname].'_'.$entry[name].'.vcf'; + $filename = $entry['givenname'].'_'.$entry['name'].'.vcf'; header("Content-Disposition: attachment; filename=\"$filename\""); header("Content-type: text/x-vcard; name=\"$filename\"; charset=utf-8"); $smarty->display($template); @@ -89,8 +89,8 @@ $entry = $result[0]; //remove dn from entry when copy - if($_REQUEST[mode] == 'copy'){ - $entry[dn]=''; + if($_REQUEST['mode'] == 'copy'){ + $entry['dn']=''; } //assign entry to template: @@ -101,12 +101,12 @@ print_r($entry); print '';*/ // make username from dn for manager: - $smarty->assign('managername',$users[$entry[manager][0]]); + $smarty->assign('managername',$users[$entry['manager'][0]]); return true; } /** - * saves the data from $_REQUEST[entry] to the LDAP directory + * saves the data from $_REQUEST['entry'] to the LDAP directory * * returns given or constructed dn */ @@ -115,21 +115,21 @@ print '';*/ global $conf; $entries = namedentries(); $entries['mail']='mail'; //special field mail isn't in entries so we add it here - if($conf[extended]){ + if($conf['extended']){ $entries['marker']='marker'; //same for marker inextended schema } - $entry = $_REQUEST[entry]; - $dn = $_REQUEST[dn]; + $entry = $_REQUEST['entry']; + $dn = $_REQUEST['dn']; //construct new dn $now = time(); $newdn = 'uid='.$now; - if($_REQUEST[type] == 'private'){ - $newdn .= ', '.$conf[privatebook].', '.$_SESSION[ldapab][binddn]; + if($_REQUEST['type'] == 'private'){ + $newdn .= ', '.$conf['privatebook'].', '.$_SESSION['ldapab']['binddn']; }else{ - $newdn .= ', '.$conf[publicbook]; + $newdn .= ', '.$conf['publicbook']; } - $entry[cn] = $entry[givenname].' '.$entry[name];; + $entry['cn'] = $entry['givenname'].' '.$entry['name'];; $entry = prepare_ldap_entry($entry); /* @@ -140,17 +140,17 @@ print ''; if(empty($dn)){ //new entry - $entry[uid][] = $now; + $entry['uid'][] = $now; $r = ldap_add($LDAP_CON,$newdn,$entry); tpl_ldaperror(); return $newdn; }else{ // in extended mode we have to make sure the right classes are set - if($conf[extended]){ + if($conf['extended']){ ldap_store_objectclasses($dn,array('inetOrgPerson','contactPerson')); } // in openxchange mode we have to make sure the right classes are set - if ($conf[openxchange]){ + if ($conf['openxchange']){ ldap_store_objectclasses($dn,array('inetOrgPerson','OXUserObject')); } //modify entry (touches only our attributes) @@ -191,14 +191,14 @@ print ''; * gets the binary data from an uploaded file */ function _getUploadData(){ - $file = $_FILES[photoupload]; + $file = $_FILES['photoupload']; - if (is_uploaded_file($file[tmp_name])) { - if(preg_match('=image/p?jpe?g=',$file[type])){ - $fh = fopen($file[tmp_name],'r'); - $data = fread($fh,$file[size]); + if (is_uploaded_file($file['tmp_name'])) { + if(preg_match('=image/p?jpe?g=',$file['type'])){ + $fh = fopen($file['tmp_name'],'r'); + $data = fread($fh,$file['size']); fclose($fh); - unlink($file[tmp_name]); + unlink($file['tmp_name']); return $data; } } diff --git a/functions.php b/functions.php index 74170a0..5250b84 100644 --- a/functions.php +++ b/functions.php @@ -5,7 +5,7 @@ */ function smarty_std(){ global $smarty; - $smarty->assign('USER',$_SESSION[ldapab][username]); + $smarty->assign('USER',$_SESSION['ldapab']['username']); } /** @@ -49,9 +49,13 @@ function do_ldap_bind($user,$pass,$dn=""){ global $conf; global $LDAP_CON; - //create global connection to LDAP if nessessary + //create global connection to LDAP if necessary if(!$LDAP_CON){ - $LDAP_CON = ldap_connect($conf[ldapserver],$conf[ldapport]); + if (!empty($conf['ldapurl'])){ + $LDAP_CON = ldap_connect($conf['ldapurl']); + }else{ + $LDAP_CON = ldap_connect($conf['ldapserver'],$conf['ldapport']); + } if(!$LDAP_CON){ die("couldn't connect to LDAP server"); } @@ -60,7 +64,7 @@ function do_ldap_bind($user,$pass,$dn=""){ if(empty($dn)){ //anonymous bind to lookup users //blank binddn or blank bindpw will result in anonymous bind - if(!ldap_bind($LDAP_CON,$conf[anonbinddn],$conf[anonbindpw])){ + if(!ldap_bind($LDAP_CON,$conf['anonbinddn'],$conf['anonbindpw'])){ die("can not bind for user lookup"); } @@ -71,8 +75,8 @@ function do_ldap_bind($user,$pass,$dn=""){ } //get dn for given user - $filter = str_replace('%u',$user,$conf[userfilter]); - $sr = ldap_search($LDAP_CON, $conf[usertree], $filter);; + $filter = str_replace('%u',$user,$conf['userfilter']); + $sr = ldap_search($LDAP_CON, $conf['usertree'], $filter);; $result = ldap_get_entries($LDAP_CON, $sr); if($result['count'] != 1){ set_session('','',''); @@ -121,10 +125,10 @@ function set_session($user,$pass,$dn){ global $conf; $rand = rand(); - $_SESSION[ldapab][username] = $user; - $_SESSION[ldapab][binddn] = $dn; - $_SESSION[ldapab][password] = $pass; - $_SESSION[ldapab][browserid] = auth_browseruid(); + $_SESSION['ldapab']['username'] = $user; + $_SESSION['ldapab']['binddn'] = $dn; + $_SESSION['ldapab']['password'] = $pass; + $_SESSION['ldapab']['browserid'] = auth_browseruid(); // (re)set the persistant auth cookie if($user == ''){ @@ -192,40 +196,40 @@ function ldap_get_binentries($conn,$srchRslt){ function namedentries($flip=false){ global $conf; - $entries[dn] = 'dn'; - $entries[sn] = 'name'; - $entries[givenName] = 'givenname'; - $entries[title] = 'title'; - $entries[o] = 'organization'; - $entries[physicalDeliveryOfficeName] = 'office'; - $entries[postalAddress] = 'street'; - $entries[postalCode] = 'zip'; - $entries[l] = 'location'; - $entries[telephoneNumber] = 'phone'; - $entries[facsimileTelephoneNumber] = 'fax'; - $entries[mobile] = 'mobile'; - $entries[pager] = 'pager'; - $entries[homePhone] = 'homephone'; - $entries[homePostalAddress] = 'homestreet'; - $entries[jpegPhoto] = 'photo'; - $entries[labeledURI] = 'url'; - $entries[description] = 'note'; - $entries[manager] = 'manager'; - $entries[cn] = 'displayname'; - - if($conf[extended]){ - $entries[anniversary] = 'anniversary'; + $entries['dn'] = 'dn'; + $entries['sn'] = 'name'; + $entries['givenName'] = 'givenname'; + $entries['title'] = 'title'; + $entries['o'] = 'organization'; + $entries['physicalDeliveryOfficeName'] = 'office'; + $entries['postalAddress'] = 'street'; + $entries['postalCode'] = 'zip'; + $entries['l'] = 'location'; + $entries['telephoneNumber'] = 'phone'; + $entries['facsimileTelephoneNumber'] = 'fax'; + $entries['mobile'] = 'mobile'; + $entries['pager'] = 'pager'; + $entries['homePhone'] = 'homephone'; + $entries['homePostalAddress'] = 'homestreet'; + $entries['jpegPhoto'] = 'photo'; + $entries['labeledURI'] = 'url'; + $entries['description'] = 'note'; + $entries['manager'] = 'manager'; + $entries['cn'] = 'displayname'; + + if($conf['extended']){ + $entries['anniversary'] = 'anniversary'; } - if($conf[openxchange]){ - $entries[mailDomain] = 'domain'; - $entries[userCountry] = 'country'; - $entries[birthDay] = 'birthday'; - $entries[IPPhone] = 'ipphone'; - $entries[OXUserCategories] = 'categories'; - $entries[OXUserInstantMessenger] = 'instantmessenger'; - $entries[OXTimeZone] = 'timezone'; - $entries[OXUserPosition] = 'position'; - $entries[relClientCert] = 'certificate'; + if($conf['openxchange']){ + $entries['mailDomain'] = 'domain'; + $entries['userCountry'] = 'country'; + $entries['birthDay'] = 'birthday'; + $entries['IPPhone'] = 'ipphone'; + $entries['OXUserCategories'] = 'categories'; + $entries['OXUserInstantMessenger'] = 'instantmessenger'; + $entries['OXTimeZone'] = 'timezone'; + $entries['OXUserPosition'] = 'position'; + $entries['relClientCert'] = 'certificate'; } if($flip){ @@ -242,8 +246,8 @@ function prepare_ldap_entry($in){ global $conf; //check dateformat - if(!preg_match('/\d\d\d\d-\d\d-\d\d/',$in[anniversary])){ - $in[anniversary]=''; + if(!preg_match('/\d\d\d\d-\d\d-\d\d/',$in['anniversary'])){ + $in['anniversary']=''; } $entries = namedentries(true); @@ -261,12 +265,12 @@ function prepare_ldap_entry($in){ } //standard Objectclass - $out[objectclass][] = 'inetOrgPerson'; - if($conf[extended]){ - $out[objectclass][] = 'contactPerson'; + $out['objectclass'][] = 'inetOrgPerson'; + if($conf['extended']){ + $out['objectclass'][] = 'contactPerson'; } - if($conf[openxchange]){ - $out[objectclass][] = 'OXUserObject'; + if($conf['openxchange']){ + $out['objectclass'][] = 'OXUserObject'; } return clear_array($out); @@ -330,12 +334,12 @@ function get_users(){ global $conf; global $LDAP_CON; - $sr = ldap_list($LDAP_CON,$conf[usertree],"ObjectClass=inetOrgPerson"); + $sr = ldap_list($LDAP_CON,$conf['usertree'],"ObjectClass=inetOrgPerson"); $result = ldap_get_binentries($LDAP_CON, $sr); if(count($result)){ foreach ($result as $entry){ - if(!empty($entry[sn][0])){ - $users[$entry[dn]] = $entry[givenName][0]." ".$entry[sn][0]; + if(!empty($entry['sn'][0])){ + $users[$entry['dn']] = $entry['givenName'][0]." ".$entry['sn'][0]; } } } @@ -361,9 +365,9 @@ function ldap_store_objectclasses($dn,$classes){ $sr = ldap_search($LDAP_CON,$dn,"objectClass=*",array('objectClass')); $result = ldap_get_binentries($LDAP_CON, $sr); - $set = $result[0][objectClass]; - $set = array_unique_renumber(array_merge($set,$classes)); - $add[objectClass] = $set; + $set = $result[0]['objectClass']; + $set = array_unique_renumber(array_merge((array)$set,(array)$classes)); + $add['objectClass'] = $set; $r = @ldap_mod_replace($LDAP_CON,$dn,$add); tpl_ldaperror(); @@ -416,7 +420,7 @@ function ldap_queryabooks($filter,$types){ } // return merged results - return array_merge($result1,$result2); + return array_merge((array)$result1,(array)$result2); } /** diff --git a/img.php b/img.php index 993a4fc..eeb4471 100644 --- a/img.php +++ b/img.php @@ -2,7 +2,7 @@ require_once('init.php'); ldap_login(); - $dn = $_REQUEST[dn]; + $dn = $_REQUEST['dn']; $sr = ldap_search($LDAP_CON,$dn,'(objectClass=inetOrgPerson)',array('jpegPhoto')); if(!ldap_count_entries($LDAP_CON,$sr)){ diff --git a/import.php b/import.php index d1753cf..2f880f1 100644 --- a/import.php +++ b/import.php @@ -4,7 +4,7 @@ require_once('xml.php'); ldap_login(); - if(! $_SESSION[ldapab][username] ){ + if(! $_SESSION['ldapab']['username'] ){ header("Location: login.php"); exit; } diff --git a/importVCF.php b/importVCF.php index bc9ea65..1138b99 100644 --- a/importVCF.php +++ b/importVCF.php @@ -3,7 +3,7 @@ require_once('Contact_Vcard_Parse.php'); ldap_login(); - if(! $_SESSION[ldapab][username] ){ + if(! $_SESSION['ldapab']['username'] ){ header("Location: login.php"); exit; } diff --git a/index.php b/index.php index 04ab996..128bd3d 100644 --- a/index.php +++ b/index.php @@ -6,17 +6,17 @@ $ldapfilter = _makeldapfilter(); //check public addressbook - $sr = ldap_list($LDAP_CON,$conf[publicbook],$ldapfilter); + $sr = ldap_list($LDAP_CON,$conf['publicbook'],$ldapfilter); $result1 = ldap_get_binentries($LDAP_CON, $sr); //check users private addressbook - if(!empty($_SESSION[ldapab][binddn])){ + if(!empty($_SESSION['ldapab']['binddn'])){ $sr = @ldap_list($LDAP_CON, - $conf[privatebook].','.$_SESSION[ldapab][binddn], + $conf['privatebook'].','.$_SESSION['ldapab']['binddn'], $ldapfilter); $result2 = ldap_get_binentries($LDAP_CON, $sr); } - $result = array_merge($result1,$result2); + $result = array_merge((array)$result1,(array)$result2); // select entry template if($_REQUEST['export'] == 'csv'){ @@ -26,9 +26,9 @@ } $list = ''; - if(count($result)==1 && $_REQUEST[search]){ + if(count($result)==1 && $_REQUEST['search']){ //only one result on a search -> display page - header("Location: entry.php?dn=".$result[0][dn]); + header("Location: entry.php?dn=".$result[0]['dn']); exit; }elseif(count($result)){ $keys = array_keys($result); @@ -56,7 +56,7 @@ $smarty->display('export_list_csv.tpl'); }else{ //save location in session - $_SESSION[ldapab][lastlocation]=$_SERVER["REQUEST_URI"]; + $_SESSION['ldapab']['lastlocation']=$_SERVER["REQUEST_URI"]; header('Content-Type: text/html; charset=utf-8'); $smarty->display('list.tpl'); @@ -70,8 +70,8 @@ */ function _namesort($a,$b){ global $result; - $x = $result[$a][sn][0].$result[$a][givenName][0]; - $y = $result[$b][sn][0].$result[$b][givenName][0]; + $x = $result[$a]['sn'][0].$result[$a]['givenName'][0]; + $y = $result[$b]['sn'][0].$result[$b]['givenName'][0]; return(strcasecmp($x,$y)); } @@ -87,7 +87,7 @@ $org = ldap_filterescape($_REQUEST['org']); $marker = ldap_filterescape($_REQUEST['marker']); $categories = ldap_filterescape($_REQUEST['categories']); - $_SESSION[ldapab][filter] = $_REQUEST['filter']; + $_SESSION['ldapab']['filter'] = $_REQUEST['filter']; if(empty($filter)) $filter='a'; if(!empty($marker)){ diff --git a/init.php b/init.php index 14bd24f..b46c6dc 100644 --- a/init.php +++ b/init.php @@ -1,6 +1,6 @@ compile_dir = './cache'; $smarty->use_sub_dirs = 0; $smarty->template_dir = './templates'; - $smarty->force_compile = $conf[smartycompile]; + $smarty->force_compile = $conf['smartycompile']; ?> diff --git a/lang/de.php b/lang/de.php index 21fa105..1f97dd8 100644 --- a/lang/de.php +++ b/lang/de.php @@ -1,73 +1,73 @@ diff --git a/lang/en.php b/lang/en.php index cca3902..6e28ec6 100644 --- a/lang/en.php +++ b/lang/en.php @@ -1,84 +1,84 @@ diff --git a/login.php b/login.php index 2bf41bc..96ba236 100644 --- a/login.php +++ b/login.php @@ -1,18 +1,18 @@ assign('user',$_SESSION[ldapab][username]); - $smarty->assign('binddn',$_SESSION[ldapab][binddn]); - if(!empty($_SESSION[ldapab][lastlocation])){ - $smarty->assign('home',$_SESSION[ldapab][lastlocation]); + if(empty($_SESSION['ldapab']['username'])){ + $_SESSION['ldapab']['username'] = ''; + } + if(empty($_SESSION['ldapab']['binddn'])){ + $_SESSION['ldapab']['binddn'] = ''; + } + + $smarty->assign('user',$_SESSION['ldapab']['username']); + $smarty->assign('binddn',$_SESSION['ldapab']['binddn']); + if(!empty($_SESSION['ldapab']['lastlocation'])){ + $smarty->assign('home',$_SESSION['ldapab']['lastlocation']); }else{ $smarty->assign('home','index.php'); } $smarty->assign('conf',$conf); $smarty->assign('lang',$lang); - $smarty->assign('dfexample',$dfexample); + //$smarty->assign('dfexample',$dfexample); } /** @@ -43,23 +50,23 @@ function tpl_entry($in){ //set the type $out['dn'] = normalize_dn($out['dn']); - $conf[publicbook] = normalize_dn($conf[publicbook]); + $conf['publicbook'] = normalize_dn($conf['publicbook']); if($out['dn']){ - if(strstr($out['dn'],$conf[publicbook])){ - $out[type] = 'public'; + if(strstr($out['dn'],$conf['publicbook'])){ + $out['type'] = 'public'; }else{ - $out[type] = 'private'; + $out['type'] = 'private'; } } //mail entries are handled special $out['mail'] = $in['mail']; - if ($conf[extended]){ + if ($conf['extended']){ //handle marker special in extended mode $out['marker'] = $in['marker']; if(is_array($in['marker'])) $out['markers'] = join(', ',$in['marker']); } - if ($conf[openxchange]){ + if ($conf['openxchange']){ //handle categories special in openxchange mode $out['categories'] = $in['OXUserCategories']; } @@ -97,20 +104,20 @@ function tpl_markers(){ global $LDAP_CON; global $smarty; - if(!$conf[extended]) return; + if(!$conf['extended']) return; $markers = array(); - $sr = ldap_list($LDAP_CON,$conf[publicbook],"ObjectClass=inetOrgPerson",array("marker")); + $sr = ldap_list($LDAP_CON,$conf['publicbook'],"ObjectClass=inetOrgPerson",array("marker")); $result1 = ldap_get_binentries($LDAP_CON, $sr); //check users private addressbook - if(!empty($_SESSION[ldapab][binddn])){ + if(!empty($_SESSION['ldapab']['binddn'])){ $sr = @ldap_list($LDAP_CON, - $conf[privatebook].','.$_SESSION[ldapab][binddn], + $conf['privatebook'].','.$_SESSION['ldapab']['binddn'], "ObjectClass=inetOrgPerson",array("marker")); $result2 = ldap_get_binentries($LDAP_CON, $sr); } - $result = array_merge($result1,$result2); + $result = array_merge((array)$result1,(array)$result2); if(count($result)){ foreach ($result as $entry){ @@ -137,21 +144,21 @@ function tpl_orgs(){ $orgs = array(); - $sr = ldap_list($LDAP_CON,$conf[publicbook],"ObjectClass=inetOrgPerson",array("o")); + $sr = ldap_list($LDAP_CON,$conf['publicbook'],"ObjectClass=inetOrgPerson",array("o")); $result1 = ldap_get_binentries($LDAP_CON, $sr); //check users private addressbook - if(!empty($_SESSION[ldapab][binddn])){ + if(!empty($_SESSION['ldapab']['binddn'])){ $sr = @ldap_list($LDAP_CON, - $conf[privatebook].','.$_SESSION[ldapab][binddn], + $conf['privatebook'].','.$_SESSION['ldapab']['binddn'], "ObjectClass=inetOrgPerson",array("o")); $result2 = ldap_get_binentries($LDAP_CON, $sr); } - $result = array_merge($result1,$result2); + $result = array_merge((array)$result1,(array)$result2); if(count($result)){ foreach ($result as $entry){ - if(!empty($entry[o][0])){ - array_push($orgs, $entry[o][0]); + if(!empty($entry['o'][0])){ + array_push($orgs, $entry['o'][0]); } } } @@ -168,20 +175,20 @@ function tpl_categories(){ global $LDAP_CON; global $smarty; - if(!$conf[openxchange]) return; + if(!$conf['openxchange']) return; $categories = array(); - $sr = ldap_list($LDAP_CON,$conf[publicbook],"ObjectClass=OXUserObject",array("OXUserCategories")); + $sr = ldap_list($LDAP_CON,$conf['publicbook'],"ObjectClass=OXUserObject",array("OXUserCategories")); $result1 = ldap_get_binentries($LDAP_CON, $sr); //check users private addressbook - if(!empty($_SESSION[ldapab][binddn])){ + if(!empty($_SESSION['ldapab']['binddn'])){ $sr = @ldap_list($LDAP_CON, - $conf[privatebook].','.$_SESSION[ldapab][binddn], + $conf['privatebook'].','.$_SESSION['ldapab']['binddn'], "ObjectClass=OXUserObject",array("OXUserCategories")); $result2 = ldap_get_binentries($LDAP_CON, $sr); } - $result = array_merge($result1,$result2); + $result = array_merge((array)$result1,(array)$result2); if(count($result)){ foreach ($result as $entry){ @@ -206,20 +213,20 @@ function tpl_timezone(){ global $LDAP_CON; global $smarty; - if(!$conf[openxchange]) return; + if(!$conf['openxchange']) return; $timezone = array(); - $sr = ldap_list($LDAP_CON,$conf[publicbook],"ObjectClass=OXUserObject",array("OXTimeZone")); + $sr = ldap_list($LDAP_CON,$conf['publicbook'],"ObjectClass=OXUserObject",array("OXTimeZone")); $result1 = ldap_get_binentries($LDAP_CON, $sr); //check users private addressbook - if(!empty($_SESSION[ldapab][binddn])){ + if(!empty($_SESSION['ldapab']['binddn'])){ $sr = @ldap_list($LDAP_CON, - $conf[privatebook].','.$_SESSION[ldapab][binddn], + $conf['privatebook'].','.$_SESSION['ldapab']['binddn'], "ObjectClass=OXUserObject",array("OXTimeZone")); $result2 = ldap_get_binentries($LDAP_CON, $sr); } - $result = array_merge($result1,$result2); + $result = array_merge((array)$result1,(array)$result2); if(count($result)){ foreach ($result as $entry){ @@ -244,20 +251,20 @@ function tpl_country(){ global $LDAP_CON; global $smarty; - if(!$conf[openxchange]) return; + if(!$conf['openxchange']) return; $country = array(); - $sr = ldap_list($LDAP_CON,$conf[publicbook],"ObjectClass=OXUserObject",array("userCountry")); + $sr = ldap_list($LDAP_CON,$conf['publicbook'],"ObjectClass=OXUserObject",array("userCountry")); $result1 = ldap_get_binentries($LDAP_CON, $sr); //check users private addressbook - if(!empty($_SESSION[ldapab][binddn])){ + if(!empty($_SESSION['ldapab']['binddn'])){ $sr = @ldap_list($LDAP_CON, - $conf[privatebook].','.$_SESSION[ldapab][binddn], + $conf['privatebook'].','.$_SESSION['ldapab']['binddn'], "ObjectClass=OXUserObject",array("userCountry")); $result2 = ldap_get_binentries($LDAP_CON, $sr); } - $result = array_merge($result1,$result2); + $result = array_merge((array)$result1,(array)$result2); if(count($result)){ foreach ($result as $entry){ -- 2.39.2