fix bug 948702. User won't be allowed to change an app name 'cause it breaks it.

This commit is contained in:
alpeb 2004-05-07 16:49:17 +00:00
parent b21523f38b
commit f75a66cc05
2 changed files with 4 additions and 19 deletions

View File

@ -78,9 +78,9 @@
function save($data) function save($data)
{ {
$sql = "UPDATE phpgw_applications SET app_name='" . addslashes($data['n_app_name']) . "'," $sql = "UPDATE phpgw_applications SET "
. "app_enabled='" . $data['n_app_status'] . "',app_order='" . $data['app_order'] . "app_enabled='" . $data['n_app_status'] . "',app_order='" . $data['app_order']
. "' WHERE app_name='" . $data['old_app_name'] . "'"; . "' WHERE app_name='" . $data['app_name'] . "'";
$this->db->query($sql,__LINE__,__FILE__); $this->db->query($sql,__LINE__,__FILE__);
return True; return True;

View File

@ -287,29 +287,14 @@
$totalerrors = 0; $totalerrors = 0;
$app_order = $_POST['app_order'] ? $_POST['app_order'] : 0; $app_order = $_POST['app_order'] ? $_POST['app_order'] : 0;
$n_app_name = chop($_POST['n_app_name']);
$n_app_status = $_POST['n_app_status']; $n_app_status = $_POST['n_app_status'];
if (! $n_app_name)
{
$error[$totalerrors++] = lang('You must enter an application name.');
}
if ($app_name != $n_app_name)
{
if ($this->bo->exists($n_app_name))
{
$error[$totalerrors++] = lang('That application name already exists.');
}
}
if (! $totalerrors) if (! $totalerrors)
{ {
$this->bo->save(array( $this->bo->save(array(
'n_app_name' => $n_app_name,
'n_app_status' => $n_app_status, 'n_app_status' => $n_app_status,
'app_order' => $app_order, 'app_order' => $app_order,
'old_app_name' => urldecode($app_name) 'app_name' => urldecode($app_name)
)); ));
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction=admin.uiapplications.get_list&start='.$start); $GLOBALS['phpgw']->redirect_link('/index.php','menuaction=admin.uiapplications.get_list&start='.$start);
@ -339,7 +324,7 @@
$GLOBALS['phpgw']->template->set_var('th_bg',$GLOBALS['phpgw_info']['theme']['th_bg']); $GLOBALS['phpgw']->template->set_var('th_bg',$GLOBALS['phpgw_info']['theme']['th_bg']);
$GLOBALS['phpgw']->template->set_var('form_action',$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiapplications.edit')); $GLOBALS['phpgw']->template->set_var('form_action',$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiapplications.edit'));
$this->display_row(lang('application name'),'<input name="n_app_name" value="' . $n_app_name . '">'); $this->display_row(lang('application name'), $n_app_name );
$GLOBALS['phpgw']->template->set_var('lang_status',lang('Status')); $GLOBALS['phpgw']->template->set_var('lang_status',lang('Status'));
$GLOBALS['phpgw']->template->set_var('lang_save_button',lang('Save')); $GLOBALS['phpgw']->template->set_var('lang_save_button',lang('Save'));