some more xmlrpc changes

This commit is contained in:
Ralf Becker 2003-10-24 20:42:00 +00:00
parent 6238d6506a
commit 8c9c2f09d0
3 changed files with 30 additions and 14 deletions

View File

@ -384,7 +384,21 @@
function delete_entry($addr)
{
$id = !is_array($addr) ? $addr : (isset($addr['id']) ? $addr['id'] : $addr['ab_id']);
if (!is_array($addr))
{
$id = intval($addr);
}
else
{
if (is_numeric($addr[0])) // xmlrpc liefert array($id)
{
$id = intval($addr[0]);
}
else
{
$id = isset($addr['id']) ? $addr['id'] : $addr['ab_id'];
}
}
if ($this->check_perms($id,PHPGW_ACL_DELETE))
{
@ -415,7 +429,7 @@
$owner = $addr['owner'];
}
//echo "<p>boaddressbook::check_perms(id='$id',rights=$rights): grant[owner='$owner']='".$this->grants[$owner]."' => ".(($this->grants[$owner] & 4) ? 'True':'False')."</p>\n";
return !!($this->grants[$owner] & $rights);
return $owner && !!($this->grants[$owner] & $rights);
}
function save_preferences($prefs,$other,$qfields,$fcat_id)

View File

@ -78,18 +78,13 @@
function update_entry($fields)
{
$ab_id = $fields['ab_id'];
$ab_id = isset($fields['ab_id']) ? $fields['ab_id'] : $fields['id'];
$owner = $fields['owner'];
$access = $fields['access'];
$cat_id = $fields['cat_id'];
$tid = $fields['tid'];
unset($fields['owner']);
unset($fields['access']);
unset($fields['cat_id']);
unset($fields['ab_id']);
unset($fields['tid']);
unset($fields['id']);
return $this->contacts->update($ab_id,$owner,$fields,$access,$cat_id,$tid);
return $this->contacts->update($ab_id,$owner,$fields);
}
function delete_entry($id)

View File

@ -637,7 +637,7 @@
. $this->db->db_addslashes($field_name) . "'",__LINE__,__FILE__);
}
function update($id,$owner,$fields,$access='',$cat_id='',$tid='n')
function update($id,$owner,$fields,$access=NULL,$cat_id=NULL,$tid=NULL)
{
/* First make sure that id number exists */
$this->db->query("SELECT COUNT(*) FROM $this->std_table WHERE id='$id'",__LINE__,__FILE__);
@ -647,6 +647,13 @@
return False;
}
foreach(array('access','cat_id','tid') as $extra)
{
if (!is_null($$extra))
{
$fields[$extra] = $$extra;
}
}
list($stock_fields,$stock_fieldnames,$extra_fields) = $this->split_stock_and_extras($fields);
if (count($stock_fields))
{
@ -655,12 +662,12 @@
$ta[] = $stock_fieldname . "='" . $this->db->db_addslashes($stock_fields[$stock_fieldname]) . "'";
}
$ta[] = 'last_mod=' . $GLOBALS['phpgw']->datetime->gmtnow;
$fields_s = ',' . implode(',',$ta);
$fields_s = implode(',',$ta);
if ($field_s == ',')
{
unset($field_s);
}
$this->db->query("UPDATE $this->std_table SET access='$access',cat_id='$cat_id', tid='$tid' $fields_s WHERE "
$this->db->query("UPDATE $this->std_table SET $fields_s WHERE "
. "id='$id'",__LINE__,__FILE__);
}