This commit is contained in:
ceb 2003-06-17 13:23:42 +00:00
parent 78d0caebdd
commit 298c0d03ae
2 changed files with 23 additions and 17 deletions

View File

@ -305,7 +305,7 @@
$data['login_standard']['msgbox_data'] = $GLOBALS['phpgw']->common->msgbox('',False); $data['login_standard']['msgbox_data'] = $GLOBALS['phpgw']->common->msgbox('',False);
} }
$data['login_standard']['website_title'] = $GLOBALS['phpgw_info']['server']['site_title']; $data['login_standard']['website_title'] = ($GLOBALS['phpgw_info']['server']['site_title']?$GLOBALS['phpgw_info']['server']['site_title']:'phpGroupWare');
$data['login_standard']['login_url'] = 'login.php' . $extra_vars; $data['login_standard']['login_url'] = 'login.php' . $extra_vars;
$data['login_standard']['cookie'] = $last_loginid; $data['login_standard']['cookie'] = $last_loginid;
$data['login_standard']['lang_username'] = lang('username'); $data['login_standard']['lang_username'] = lang('username');

View File

@ -534,30 +534,33 @@
*/ */
function add($values) function add($values)
{ {
if ($values['parent'] && $values['parent'] != 0) $values['cat_id'] = intval($values['cat_id']);
$values['parent'] = intval($values['parent']);
if ($values['parent'] > 0)
{ {
$values['main'] = intval($this->id2item(array('cat_id' => $values['parent'],'item' => 'main'))); $values['main'] = $this->id2item(array('cat_id' => $values['parent'],'item' => 'main'));
$values['level'] = intval($this->id2item(array('cat_id' => $values['parent'],'item' => 'level'))+1); $values['level'] = $this->id2item(array('cat_id' => $values['parent'],'item' => 'level'))+1;
} }
$values['descr'] = $this->db->db_addslashes($values['descr']); $values['descr'] = $this->db->db_addslashes($values['descr']);
$values['name'] = $this->db->db_addslashes($values['name']); $values['name'] = $this->db->db_addslashes($values['name']);
if (isset($values['cat_id'])) if ($values['cat_id'] > 0)
{ {
$id_col = 'cat_id,'; $id_col = 'cat_id,';
$id_val = $values['cat_id'].','; $id_val = $values['cat_id'].',';
} }
$this->db->query("INSERT INTO phpgw_categories (${id_col}cat_parent,cat_owner,cat_access,cat_appname,cat_name,cat_description,cat_data," $this->db->query("INSERT INTO phpgw_categories (${id_col}cat_parent,cat_owner,cat_access,cat_appname,cat_name,cat_description,cat_data,"
. "cat_main,cat_level,last_mod) VALUES ($id_val" . intval($values['parent']) . "," . $this->account_id . ",'" . $values['access'] . 'cat_main,cat_level,last_mod) VALUES (' . $id_val . $values['parent'] . ',' . $this->account_id . ",'" . $values['access']
. "','" . $this->app_name . "','" . $values['name'] . "','" . $values['descr'] . "','" . $values['data'] . "','" . $this->app_name . "','" . $values['name'] . "','" . $values['descr'] . "','" . $values['data']
. "'," . $values['main'] . "," . $values['level'] . "," . time() . ")",__LINE__,__FILE__); . "'," . intval($values['main']) . ',' . intval($values['level']) . ',' . time() . ')',__LINE__,__FILE__);
$max = $this->db->get_last_insert_id('phpgw_categories','cat_id'); $max = $this->db->get_last_insert_id('phpgw_categories','cat_id');
$max = intval($max);
if (!$values['parent'] || $values['parent'] == 0) if ($values['parent'] == 0)
{ {
$this->db->query("UPDATE phpgw_categories SET cat_main=" . $max . " WHERE cat_id=" . $max,__LINE__,__FILE__); $this->db->query('UPDATE phpgw_categories SET cat_main=' . $max . ' WHERE cat_id=' . $max,__LINE__,__FILE__);
} }
return $max; return $max;
} }
@ -694,6 +697,9 @@
*/ */
function edit($values) function edit($values)
{ {
$values['cat_id'] = intval($values['id']);
$values['parent'] = intval($values['parent']);
if (isset($values['old_parent']) && $values['old_parent'] != $values['parent']) if (isset($values['old_parent']) && $values['old_parent'] != $values['parent'])
{ {
//$this->delete(array('cat_id' => $values['cat_id'],'drop_subs' => False,'modify_subs' => True)); //$this->delete(array('cat_id' => $values['cat_id'],'drop_subs' => False,'modify_subs' => True));
@ -703,15 +709,15 @@
} }
if (!isset($values['main']) || !isset($values['level'])) if (!isset($values['main']) || !isset($values['level']))
{ {
if ($values['parent'] && ($values['parent'] != 0)) if ($values['parent'] > 0)
{ {
$values['main'] = intval($this->id2item(array('cat_id' => $values['parent'],'item' => 'main'))); $values['main'] = intval($this->id2item(array('cat_id' => $values['parent'],'item' => 'main')));
$values['level'] = intval($this->id2item(array('cat_id' => $values['parent'],'item' => 'level'))+1); $values['level'] = intval($this->id2item(array('cat_id' => $values['parent'],'item' => 'level'))+1);
} }
else else
{ {
$values['main'] = intval($values['cat_id']); $values['main'] = $values['cat_id'];
$values['parent'] = $values['level'] = 0; // parent need to be set to 0, as it can be '' $values['level'] = 0;
} }
} }
@ -719,11 +725,11 @@
$values['name'] = $this->db->db_addslashes($values['name']); $values['name'] = $this->db->db_addslashes($values['name']);
$sql = "UPDATE phpgw_categories SET cat_name='" . $values['name'] . "', cat_description='" . $values['descr'] $sql = "UPDATE phpgw_categories SET cat_name='" . $values['name'] . "', cat_description='" . $values['descr']
. "', cat_data='" . $values['data'] . "', cat_parent=" . intval($values['parent']) . ", cat_access='" . "', cat_data='" . $values['data'] . "', cat_parent=" . $values['parent'] . ", cat_access='"
. $values['access'] . "', cat_main=" . $values['main'] . ", cat_level=" . $values['level'] . ", last_mod=" . time() . $values['access'] . "', cat_main=" . $values['main'] . ', cat_level=' . $values['level'] . ', last_mod=' . time()
. " WHERE cat_appname='" . $this->app_name . "' AND cat_id=" . intval($values['cat_id']); . " WHERE cat_appname='" . $this->app_name . "' AND cat_id=" . $values['cat_id'];
$this->db->query($sql,__LINE__,__FILE__); $this->db->query($sql,__LINE__,__FILE__);
return intval($values['cat_id']); return $values['cat_id'];
} }
function name2id($cat_name) function name2id($cat_name)