mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-23 15:18:58 +01:00
Formatting, replace gettype with is_???
This commit is contained in:
parent
3e2136f1b8
commit
9dcc98b2d5
@ -170,7 +170,10 @@
|
||||
/* send this the id and whatever fields you want to see */
|
||||
function read_single_entry($id,$fields = '')
|
||||
{
|
||||
if (!$fields || empty($fields)) { $fields = $this->stock_contact_fields; }
|
||||
if(!$fields || empty($fields))
|
||||
{
|
||||
$fields = $this->stock_contact_fields;
|
||||
}
|
||||
list($stock_fields,$stock_fieldnames,$extra_fields) =
|
||||
$this->split_stock_and_extras($fields);
|
||||
|
||||
@ -192,7 +195,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))
|
||||
{
|
||||
@ -233,7 +236,10 @@
|
||||
|
||||
function read_last_entry($fields = '')
|
||||
{
|
||||
if (!$fields || empty($fields)) { $fields = $this->stock_contact_fields; }
|
||||
if(!$fields || empty($fields))
|
||||
{
|
||||
$fields = $this->stock_contact_fields;
|
||||
}
|
||||
list($stock_fields,$stock_fieldnames,$extra_fields) =
|
||||
$this->split_stock_and_extras($fields);
|
||||
|
||||
@ -247,7 +253,10 @@
|
||||
}
|
||||
|
||||
$id = $this->nextid;
|
||||
if ($id == -1) { $id = 1; }
|
||||
if($id == -1)
|
||||
{
|
||||
$id = 1;
|
||||
}
|
||||
|
||||
$sri = ldap_search($this->ldap, $GLOBALS['phpgw_info']['server']['ldap_contact_context'], 'uidnumber='.$id);
|
||||
$ldap_fields = ldap_get_entries($this->ldap, $sri);
|
||||
@ -259,7 +268,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))
|
||||
{
|
||||
@ -301,11 +310,23 @@
|
||||
/* send this the range, query, sort, order and whatever fields you want to see */
|
||||
function read($start=0,$limit=0,$fields='',$query='',$filter='',$sort='',$order='')
|
||||
{
|
||||
if(!$start) { $start = 0; }
|
||||
if(!$limit) { $limit = 0; }
|
||||
if(!$filter) { $filter = 'tid=n'; }
|
||||
if(!$start)
|
||||
{
|
||||
$start = 0;
|
||||
}
|
||||
if(!$limit)
|
||||
{
|
||||
$limit = 0;
|
||||
}
|
||||
if(!$filter)
|
||||
{
|
||||
$filter = 'tid=n';
|
||||
}
|
||||
|
||||
if (!$fields || empty($fields)) { $fields = $this->stock_contact_fields; }
|
||||
if(!$fields || empty($fields))
|
||||
{
|
||||
$fields = $this->stock_contact_fields;
|
||||
}
|
||||
$DEBUG = 0;
|
||||
|
||||
list($stock_fields,$stock_fieldnames,$extra_fields) = $this->split_stock_and_extras($fields);
|
||||
@ -357,14 +378,18 @@
|
||||
}
|
||||
}
|
||||
/*
|
||||
if ($DEBUG) {
|
||||
if($DEBUG)
|
||||
{
|
||||
while(list($name,$value) = each($filterfields)) {
|
||||
echo "<br>DEBUG - Filter strings: #".$name.",".$value."#";
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
if (!$sort) { $sort = 'ASC'; }
|
||||
if(!$sort)
|
||||
{
|
||||
$sort = 'ASC';
|
||||
}
|
||||
|
||||
if(!$order)
|
||||
{
|
||||
@ -466,7 +491,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))
|
||||
@ -525,7 +550,7 @@
|
||||
}
|
||||
|
||||
$ldap_fields = '';
|
||||
if (gettype($stock_fieldnames) == 'array')
|
||||
if(is_array($stock_fieldnames))
|
||||
{
|
||||
while(list($name,$value)=each($stock_fieldnames))
|
||||
{
|
||||
@ -601,7 +626,7 @@
|
||||
{
|
||||
$dn = $ldap_fields[0]['dn'];
|
||||
list($stock_fields,$stock_fieldnames,$extra_fields) = $this->split_stock_and_extras($fields);
|
||||
if (gettype($stock_fieldnames) == 'array')
|
||||
if(is_array($stock_fieldnames))
|
||||
{
|
||||
/*
|
||||
Check each value, add our extra attributes if they are missing, and
|
||||
|
@ -37,7 +37,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;
|
||||
}
|
||||
@ -68,7 +68,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))
|
||||
{
|
||||
@ -84,14 +84,20 @@
|
||||
function asc_sort($a,$b)
|
||||
{
|
||||
echo "<br>A:'" . $a . "' B:'" . $b;
|
||||
if($a[1]==$b[1]) return 0;
|
||||
if($a[1] == $b[1])
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return ($a[1]>$b[1]) ? 1 : -1;
|
||||
}
|
||||
|
||||
function desc_sort($a,$b)
|
||||
{
|
||||
echo "<br>A:'" . $a . "' B:'" . $b;
|
||||
if($a[1]==$b[1]) return 0;
|
||||
if($a[1]==$b[1])
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return ($a[1]<$b[1]) ? 1 : -1;
|
||||
}
|
||||
|
||||
@ -128,10 +134,15 @@
|
||||
for($index = 0; $index < strlen ($s1); $index++)
|
||||
{
|
||||
/* $s1 comes after $s2 */
|
||||
if (strtolower($s1[$index]) > strtolower($s2[$index])) { return ($order); }
|
||||
|
||||
if(strtolower($s1[$index]) > strtolower($s2[$index]))
|
||||
{
|
||||
return ($order);
|
||||
}
|
||||
/* $s1 comes before $s2 */
|
||||
if (strtolower($s1[$index]) < strtolower($s2[$index])) { return (1 - $order); }
|
||||
if(strtolower($s1[$index]) < strtolower($s2[$index]))
|
||||
{
|
||||
return (1 - $order);
|
||||
}
|
||||
}
|
||||
/* Special case in which $s1 is a substring of $s2 */
|
||||
|
||||
|
@ -163,7 +163,10 @@
|
||||
/* send this the id and whatever fields you want to see */
|
||||
function read_single_entry($id,$fields='')
|
||||
{
|
||||
if (!$fields || empty($fields)) { $fields = $this->stock_contact_fields; }
|
||||
if(!$fields || empty($fields))
|
||||
{
|
||||
$fields = $this->stock_contact_fields;
|
||||
}
|
||||
list($stock_fields,$stock_fieldnames,$extra_fields) =
|
||||
$this->split_stock_and_extras($fields);
|
||||
|
||||
@ -186,7 +189,7 @@
|
||||
$return_fields[0]['access'] = $this->db->f('access');
|
||||
$return_fields[0]['cat_id'] = $this->db->f('cat_id');
|
||||
|
||||
if (gettype($stock_fieldnames) == 'array')
|
||||
if(is_array($stock_fieldnames))
|
||||
{
|
||||
while(list($f_name) = each($stock_fieldnames))
|
||||
{
|
||||
@ -227,7 +230,10 @@
|
||||
|
||||
function read_last_entry($fields='')
|
||||
{
|
||||
if (!$fields || empty($fields)) { $fields = $this->stock_contact_fields; }
|
||||
if(!$fields || empty($fields))
|
||||
{
|
||||
$fields = $this->stock_contact_fields;
|
||||
}
|
||||
list($stock_fields,$stock_fieldnames,$extra_fields) =
|
||||
$this->split_stock_and_extras($fields);
|
||||
|
||||
@ -255,7 +261,7 @@
|
||||
$return_fields[0]['access'] = $this->db->f('access');
|
||||
$return_fields[0]['cat_id'] = $this->db->f('cat_id');
|
||||
|
||||
if (gettype($stock_fieldnames) == 'array')
|
||||
if(is_array($stock_fieldnames))
|
||||
{
|
||||
while(list($f_name) = each($stock_fieldnames))
|
||||
{
|
||||
@ -301,7 +307,10 @@
|
||||
if(!$limit) { $limit = 0; }
|
||||
if(!$filter) { $filter = 'tid=n'; }
|
||||
|
||||
if (!$fields || empty($fields)) { $fields = $this->stock_contact_fields; }
|
||||
if(!$fields || empty($fields))
|
||||
{
|
||||
$fields = $this->stock_contact_fields;
|
||||
}
|
||||
$DEBUG = 0;
|
||||
|
||||
list($stock_fields,$stock_fieldnames,$extra_fields) = $this->split_stock_and_extras($fields);
|
||||
@ -373,11 +382,11 @@
|
||||
{
|
||||
if($name == 'cat_id')
|
||||
{
|
||||
$filterlist .= "(" . $name . " LIKE '%," . $value . ",%' OR " . $name."='".$value."');";
|
||||
$filterlist .= '(' . $name . " LIKE '%," . $value . ",%' OR " . $name."='".$value."');";
|
||||
}
|
||||
elseif (gettype($value) == "integer")
|
||||
elseif(is_int($value))
|
||||
{
|
||||
$filterlist .= $name."=".$value.";";
|
||||
$filterlist .= $name.'='.$value.';';
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -452,7 +461,10 @@
|
||||
echo '<br>DEBUG - Filtering with: #' . $filtermethod . '#';
|
||||
}
|
||||
|
||||
if (!$sort) { $sort = 'ASC'; }
|
||||
if(!$sort)
|
||||
{
|
||||
$sort = 'ASC';
|
||||
}
|
||||
|
||||
if($order)
|
||||
{
|
||||
@ -519,7 +531,7 @@
|
||||
$return_fields[$i]['access'] = $this->db->f('access');
|
||||
$return_fields[$i]['cat_id'] = $this->db->f('cat_id');
|
||||
|
||||
if (gettype($stock_fieldnames) == 'array')
|
||||
if(is_array($stock_fieldnames))
|
||||
{
|
||||
while(list($f_name) = each($stock_fieldnames))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user