From ad9658f725b1c3171860b29c84912c7579ce84da Mon Sep 17 00:00:00 2001
From: Miles Lott contacts::check_perms($rights,$needed,".print_r($addr,True).")";
if ($addr !== False) // addr-record or id given
{
- if (is_array($addr))
+ if(@is_array($addr))
{
if (isset($addr['rights']))
{
@@ -62,12 +62,12 @@
}
else
{
- $id = intval(isset($addr['id']) ? $addr['id'] : $addr['ab_id']);
+ $id = (int)(isset($addr['id']) ? $addr['id'] : $addr['ab_id']);
}
}
else
{
- $id = intval($addr);
+ $id = (int)$addr;
}
if (isset($id))
{
@@ -76,7 +76,7 @@
//echo "addr($id)=".print_r($addr[0],True)."
\n";
}
}
- $ret = !!(intval($rights) & $needed);
+ $ret = !!((int)$rights & $needed);
//echo " rights=$rights, id=$id => ".($ret?'True':'False')."
".print_r($this->grants,True)."\n"; @@ -92,13 +92,13 @@ */ function read_single_entry($id,$fields='') { - if (is_array($fields)) + if(@is_array($fields)) { $fields['owner'] = 'owner'; // we need the owner to set the rights } if ($entry = contacts_::read_single_entry($id,$fields)) { - $entry[0]['rights'] = intval($this->grants[$entry[0]['owner']]); + $entry[0]['rights'] = (int)$this->grants[$entry[0]['owner']]; } return $entry; } @@ -118,7 +118,7 @@ */ function read($start=0,$limit=0,$fields='',$query='',$filter='',$sort='',$order='', $lastmod=-1) { - if (is_array($fields)) + if(@is_array($fields)) { $fields['owner'] = 'owner'; // we need the owner to set the rights } @@ -126,7 +126,7 @@ { foreach($entrys as $nr => $entry) { - $entrys[$nr]['rights'] = intval($this->grants[$entry['owner']]); + $entrys[$nr]['rights'] = (int)$this->grants[$entry['owner']]; } } return $entrys; @@ -137,7 +137,7 @@ while (list($field,$value) = @each($fields)) { /* Depending on how the array was built, this is needed. */ - if (gettype($value) == 'integer') + if(@is_int($value)) { $value = $field; } @@ -168,7 +168,7 @@ /* This will take an array or integer */ function delete($id) { - if (gettype($id) == 'array') + if(@is_array($id)) { while (list($null,$t_id) = each($id)) { @@ -207,17 +207,17 @@ */ $order = 1; - if ( (strlen($s1) == 0) ) + if((strlen($s1) == 0)) { return 0; } - if ( (strlen($s2) == 0) ) + if((strlen($s2) == 0)) { return 1; } - if (strlen ($s1) > strlen ($s2)) + if(strlen ($s1) > strlen ($s2)) { $temp = $s1; $s1 = $s2; @@ -331,7 +331,7 @@ if($DEBUG) { echo ', but number '.$ldap_fields[$i]['uidnumber'][0].' did not match.'.' '; } $yes &= False; $match--; - } + } } } else @@ -384,23 +384,22 @@ $t = CreateObject('phpgwapi.Template',$GLOBALS['phpgw']->common->get_tpl_dir('addressbook')); $s = CreateObject('phpgwapi.sbox'); - $fields = array - ( - 'n_given' => 'n_given', - 'n_family' => 'n_family', - 'title' => 'title', - 'org_name' => 'org_name', - 'org_unit' => 'org_unit', - 'adr_one_street' => 'adr_one_street', - 'adr_one_locality' => 'adr_one_locality', - 'adr_one_postalcode' => 'adr_one_postalcode', - 'adr_one_region' => 'adr_one_region', - 'adr_one_countryname' => 'adr_one_countryname', - 'adr_two_street' => 'adr_two_street', - 'adr_two_locality' => 'adr_two_locality', - 'adr_two_postalcode' => 'adr_two_postalcode', - 'adr_two_region' => 'adr_two_region', - 'adr_two_countryname' => 'adr_two_countryname' + $fields = array( + 'n_given' => 'n_given', + 'n_family' => 'n_family', + 'title' => 'title', + 'org_name' => 'org_name', + 'org_unit' => 'org_unit', + 'adr_one_street' => 'adr_one_street', + 'adr_one_locality' => 'adr_one_locality', + 'adr_one_postalcode' => 'adr_one_postalcode', + 'adr_one_region' => 'adr_one_region', + 'adr_one_countryname' => 'adr_one_countryname', + 'adr_two_street' => 'adr_two_street', + 'adr_two_locality' => 'adr_two_locality', + 'adr_two_postalcode' => 'adr_two_postalcode', + 'adr_two_region' => 'adr_two_region', + 'adr_two_countryname' => 'adr_two_countryname' ); list($address) = $this->read_single_entry($id,$fields); diff --git a/phpgwapi/inc/class.contacts_ldap.inc.php b/phpgwapi/inc/class.contacts_ldap.inc.php index 14c0dd5ed9..2171c96c6f 100644 --- a/phpgwapi/inc/class.contacts_ldap.inc.php +++ b/phpgwapi/inc/class.contacts_ldap.inc.php @@ -192,7 +192,7 @@ $return_fields[0]['owner'] = $ldap_fields[0]['phpgwcontactowner'][0]; $return_fields[0]['access'] = $ldap_fields[0]['phpgwcontactaccess'][0]; $return_fields[0]['cat_id'] = $ldap_fields[0]['phpgwcontactcatid'][0]; - if (gettype($stock_fieldnames) == 'array') + if(@is_array($stock_fieldnames)) { while(list($name,$value)=each($stock_fieldnames)) { @@ -259,7 +259,7 @@ $return_fields[0]['access'] = $ldap_fields[0]['phpgwcontactaccess'][0]; $return_fields[0]['cat_id'] = $ldap_fields[0]['phpgwcontactcatid'][0]; - if (gettype($stock_fieldnames) == 'array') + if(@is_array($stock_fieldnames)) { while(list($name,$value)=each($stock_fieldnames)) { @@ -350,13 +350,13 @@ need some way of using the lastmod arg in the filter like this: if($lastmod >= 0) { - $filterfields += array('last_mod' => (int) $lastmod); + $filterfields += array('last_mod' => (int)$lastmod; } or maybe not like this - i am not sure what i am doing :) */ - if (is_array($this->grants)) + if(@is_array($this->grants)) { /* this was not listing private entries when show all was selected */ /* $filterfields += array('phpgwcontactaccess' => 'public'); */ @@ -474,7 +474,7 @@ $return_fields[$j]['access'] = $ldap_fields[$i]['phpgwcontactaccess'][0]; $return_fields[$j]['cat_id'] = $ldap_fields[$i]['phpgwcontactcatid'][0]; - if (gettype($stock_fieldnames) == 'array') + if(@is_array($stock_fieldnames)) { reset($stock_fieldnames); while (list($f_name,$f_value) = each($stock_fieldnames)) @@ -484,7 +484,7 @@ reset($stock_fieldnames); } $this->db->query("SELECT contact_name,contact_value FROM $this->ext_table WHERE contact_id='" - . intval($ldap_fields[$i]['uidnumber']) . "'",__LINE__,__FILE__); + . (int)$ldap_fields[$i]['uidnumber'] . "'",__LINE__,__FILE__); while ($this->db->next_record()) { if ($extra_fields[$this->db->f('contact_name')]) @@ -501,12 +501,12 @@ /* Used by read() above to build the ldap filter string */ function makefilter($qarray,$extra='',$query='', $DEBUG=False) { - if(!is_array($qarray)) + if(!@is_array($qarray)) { return $qarray; } - if(is_array($extra)) + if(@is_array($extra)) { if($DEBUG) { echo '