mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-02-25 06:31:59 +01:00
Will now stop (error) when inserting bad data.
This commit is contained in:
parent
328f9a4bc5
commit
bb0535281f
@ -11,10 +11,10 @@
|
|||||||
|
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
|
|
||||||
$GLOBALS['phpgw_info'] = array();
|
$phpgw_info = array();
|
||||||
if (!@$GLOBALS['included'])
|
if (!$included)
|
||||||
{
|
{
|
||||||
$GLOBALS['phpgw_info']['flags'] = Array(
|
$GLOBALS['phpgw_info']['flags'] = array(
|
||||||
'noheader' => True,
|
'noheader' => True,
|
||||||
'nonavbar' => True,
|
'nonavbar' => True,
|
||||||
'currentapp' => 'home',
|
'currentapp' => 'home',
|
||||||
@ -29,11 +29,9 @@
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
$GLOBALS['phpgw_setup']->loaddb();
|
$GLOBALS['phpgw_setup']->loaddb();
|
||||||
|
|
||||||
include(PHPGW_API_INC.'/class.common.inc.php');
|
include(PHPGW_API_INC.'/class.common.inc.php');
|
||||||
$common = new common;
|
$common = new common;
|
||||||
|
|
||||||
$newinstall = False;
|
|
||||||
|
|
||||||
// this is not used
|
// this is not used
|
||||||
//$sep = $common->filesystem_separator();
|
//$sep = $common->filesystem_separator();
|
||||||
}
|
}
|
||||||
@ -44,30 +42,16 @@
|
|||||||
$submit = True;
|
$submit = True;
|
||||||
}
|
}
|
||||||
|
|
||||||
$setup_info_temp = $GLOBALS['phpgw_setup']->detection->get_versions();
|
if (@$GLOBALS['HTTP_POST_VARS']['submit'])
|
||||||
$setup_info = $GLOBALS['phpgw_setup']->detection->get_db_versions($setup_info_temp);
|
|
||||||
|
|
||||||
if($GLOBALS['phpgw_setup']->alessthanb($setup_info['phpgwapi']['currentver'], '0.9.15.002'))
|
|
||||||
{
|
{
|
||||||
$langtbl = 'lang';
|
$lang_selected = @$GLOBALS['HTTP_POST_VARS']['lang_selected'];
|
||||||
$langstbl = 'languages';
|
$upgrademethod = @$GLOBALS['HTTP_POST_VARS']['upgrademethod'];
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$langtbl = 'phpgw_lang';
|
|
||||||
$langstbl = 'phpgw_languages';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (@get_var('submit',Array('POST')))
|
|
||||||
{
|
|
||||||
$lang_selected = get_var('lang_selected',Array('POST'));
|
|
||||||
$upgrademethod = get_var('upgrademethod',Array('POST'));
|
|
||||||
$GLOBALS['phpgw_setup']->db->transaction_begin();
|
$GLOBALS['phpgw_setup']->db->transaction_begin();
|
||||||
if (count($lang_selected))
|
if (count($lang_selected))
|
||||||
{
|
{
|
||||||
if ($upgrademethod == 'dumpold')
|
if ($upgrademethod == 'dumpold')
|
||||||
{
|
{
|
||||||
$GLOBALS['phpgw_setup']->db->query('DELETE FROM '.$langtbl,__LINE__,__FILE__);
|
$GLOBALS['phpgw_setup']->db->query("DELETE FROM lang",__LINE__,__FILE__);
|
||||||
//echo '<br>Test: dumpold';
|
//echo '<br>Test: dumpold';
|
||||||
}
|
}
|
||||||
while (list($null,$lang) = each($lang_selected))
|
while (list($null,$lang) = each($lang_selected))
|
||||||
@ -76,8 +60,8 @@
|
|||||||
$addlang = False;
|
$addlang = False;
|
||||||
if ($upgrademethod == 'addonlynew')
|
if ($upgrademethod == 'addonlynew')
|
||||||
{
|
{
|
||||||
//echo "<br>Test: addonlynew - select count(*) from lang where lang='$lang'";
|
//echo "<br>Test: addonlynew - select count(*) from lang where lang='".$lang."'";
|
||||||
$GLOBALS['phpgw_setup']->db->query("SELECT COUNT(*) FROM $langtbl WHERE lang='$lang'",__LINE__,__FILE__);
|
$GLOBALS['phpgw_setup']->db->query("SELECT COUNT(*) FROM lang WHERE lang='".$lang."'",__LINE__,__FILE__);
|
||||||
$GLOBALS['phpgw_setup']->db->next_record();
|
$GLOBALS['phpgw_setup']->db->next_record();
|
||||||
|
|
||||||
if ($GLOBALS['phpgw_setup']->db->f(0) == 0)
|
if ($GLOBALS['phpgw_setup']->db->f(0) == 0)
|
||||||
@ -89,8 +73,8 @@
|
|||||||
if (($addlang && $upgrademethod == 'addonlynew') || ($upgrademethod != 'addonlynew'))
|
if (($addlang && $upgrademethod == 'addonlynew') || ($upgrademethod != 'addonlynew'))
|
||||||
{
|
{
|
||||||
//echo '<br>Test: loop above file()';
|
//echo '<br>Test: loop above file()';
|
||||||
$setup_info = $GLOBALS['phpgw_setup']->detection->get_versions();
|
$setup_info = $GLOBALS['phpgw_setup']->get_versions();
|
||||||
$setup_info = $GLOBALS['phpgw_setup']->detection->get_db_versions($setup_info);
|
$setup_info = $GLOBALS['phpgw_setup']->get_db_versions($setup_info);
|
||||||
$raw = $raw_file = array();
|
$raw = $raw_file = array();
|
||||||
// Visit each app/setup dir, look for a lang file
|
// Visit each app/setup dir, look for a lang file
|
||||||
while (list($key,$app) = each($setup_info))
|
while (list($key,$app) = each($setup_info))
|
||||||
@ -118,8 +102,7 @@
|
|||||||
if ($upgrademethod == 'addmissing')
|
if ($upgrademethod == 'addmissing')
|
||||||
{
|
{
|
||||||
//echo '<br>Test: addmissing';
|
//echo '<br>Test: addmissing';
|
||||||
$GLOBALS['phpgw_setup']->db->query("SELECT COUNT(*) FROM $langtbl WHERE message_id='$message_id' and lang='"
|
$GLOBALS['phpgw_setup']->db->query("SELECT COUNT(*) FROM lang WHERE message_id='".$message_id."' and lang='".$GLOBALS['phpgw_setup']->db_lang."' and (app_name='".$app_name."' or app_name='common')",__LINE__,__FILE__);
|
||||||
. $GLOBALS['phpgw_setup']->db_lang . "'",__LINE__,__FILE__);
|
|
||||||
$GLOBALS['phpgw_setup']->db->next_record();
|
$GLOBALS['phpgw_setup']->db->next_record();
|
||||||
|
|
||||||
if ($GLOBALS['phpgw_setup']->db->f(0) == 0)
|
if ($GLOBALS['phpgw_setup']->db->f(0) == 0)
|
||||||
@ -133,9 +116,12 @@
|
|||||||
{
|
{
|
||||||
if($message_id && $content)
|
if($message_id && $content)
|
||||||
{
|
{
|
||||||
// echo "<br>adding - insert into $langtbl(message_id,app_name,lang,content) values ('$message_id','$app_name','" . $GLOBALS['phpgw_setup']->db_lang . "','$content')";
|
//echo "<br>adding - insert into lang values ('".$message_id."','".$app_name."','".$GLOBALS['phpgw_setup']->db_lang."','".$content."')";
|
||||||
$GLOBALS['phpgw_setup']->db->query("INSERT INTO $langtbl(message_id,app_name,lang,content) VALUES ('$message_id','$app_name','"
|
$result = $GLOBALS['phpgw_setup']->db->query("INSERT INTO lang(message_id,app_name,lang,content) VALUES('".$message_id."','".$app_name."','".$GLOBALS['phpgw_setup']->db_lang."','".$content."')",__LINE__,__FILE__);
|
||||||
. $GLOBALS['phpgw_setup']->db_lang . "','$content')",__LINE__,__FILE__);
|
if (intval($result) <= 0)
|
||||||
|
{
|
||||||
|
echo '<br>Error inserting record: lang values ('".$message_id."','".$app_name."','".$GLOBALS['phpgw_setup']->db_lang."','".$content."')";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -145,7 +131,7 @@
|
|||||||
$GLOBALS['phpgw_setup']->db->transaction_commit();
|
$GLOBALS['phpgw_setup']->db->transaction_commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!@$GLOBALS['included'])
|
if(!$included)
|
||||||
{
|
{
|
||||||
Header('Location: index.php');
|
Header('Location: index.php');
|
||||||
exit;
|
exit;
|
||||||
@ -153,16 +139,16 @@
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (@get_var('cancel',Array('POST')))
|
if ($GLOBALS['HTTP_POST_VARS']['cancel'])
|
||||||
{
|
{
|
||||||
Header('Location: index.php');
|
Header('Location: index.php');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!@$GLOBALS['included'])
|
if (!$included)
|
||||||
{
|
{
|
||||||
$tpl_root = $GLOBALS['phpgw_setup']->html->setup_tpl_dir('setup');
|
$tpl_root = $GLOBALS['phpgw_setup']->setup_tpl_dir('setup');
|
||||||
$setup_tpl = CreateObject('setup.Template',$tpl_root);
|
$setup_tpl = CreateObject('phpgwapi.Template',$tpl_root);
|
||||||
$setup_tpl->set_file(array(
|
$setup_tpl->set_file(array(
|
||||||
'T_head' => 'head.tpl',
|
'T_head' => 'head.tpl',
|
||||||
'T_footer' => 'footer.tpl',
|
'T_footer' => 'footer.tpl',
|
||||||
@ -179,21 +165,16 @@
|
|||||||
$td_align = $newinstall ? ' align="center"' : '';
|
$td_align = $newinstall ? ' align="center"' : '';
|
||||||
$hidden_var1 = $newinstall ? '<input type="hidden" name="newinstall" value="True">' : '';
|
$hidden_var1 = $newinstall ? '<input type="hidden" name="newinstall" value="True">' : '';
|
||||||
|
|
||||||
$GLOBALS['phpgw_setup']->db->query("SELECT DISTINCT lang FROM $langtbl",__LINE__,__FILE__);
|
|
||||||
$installed_langs = array();
|
|
||||||
while(@$GLOBALS['phpgw_setup']->db->next_record())
|
|
||||||
{
|
|
||||||
$installed_langs[$GLOBALS['phpgw_setup']->db->f('lang')] = ' selected';
|
|
||||||
}
|
|
||||||
|
|
||||||
$select_box_desc = lang('Select which languages you would like to use');
|
$select_box_desc = lang('Select which languages you would like to use');
|
||||||
$select_box_langs = '';
|
$select_box = '';
|
||||||
$GLOBALS['phpgw_setup']->db->query("SELECT lang_id,lang_name from $langstbl WHERE available='Yes' ORDER BY(lang_name)");
|
$GLOBALS['phpgw_setup']->db->query("select lang_id,lang_name from languages where available='Yes'");
|
||||||
while ($GLOBALS['phpgw_setup']->db->next_record())
|
while ($GLOBALS['phpgw_setup']->db->next_record())
|
||||||
{
|
{
|
||||||
$select_box_langs .= '<option value="' . $GLOBALS['phpgw_setup']->db->f('lang_id')
|
$select_box_langs =
|
||||||
. '"' . $installed_langs[$GLOBALS['phpgw_setup']->db->f('lang_id')] . '>'
|
$select_box_langs
|
||||||
. $GLOBALS['phpgw_setup']->db->f('lang_name') . '</option>' . "\n";
|
.'<option value="' . $GLOBALS['phpgw_setup']->db->f('lang_id') . '">'
|
||||||
|
. $GLOBALS['phpgw_setup']->db->f('lang_name') . '</option>'
|
||||||
|
."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $newinstall)
|
if (! $newinstall)
|
||||||
@ -226,10 +207,10 @@
|
|||||||
$setup_tpl->set_var('lang_install',lang('install'));
|
$setup_tpl->set_var('lang_install',lang('install'));
|
||||||
$setup_tpl->set_var('lang_cancel',lang('cancel'));
|
$setup_tpl->set_var('lang_cancel',lang('cancel'));
|
||||||
|
|
||||||
$ConfigDomain = get_var('ConfigDomain',Array('POST','COOKIE'));
|
$ConfigDomain = $GLOBALS['HTTP_COOKIE_VARS']['ConfigDomain'] ? $GLOBALS['HTTP_COOKIE_VARS']['ConfigDomain'] : $GLOBALS['HTTP_POST_VARS']['ConfigDomain'];
|
||||||
$GLOBALS['phpgw_setup']->html->show_header("$stage_title",False,'config',$ConfigDomain . '(' . $phpgw_domain[$ConfigDomain]['db_type'] . ')');
|
$GLOBALS['phpgw_setup']->show_header("$stage_title",False,'config',$ConfigDomain . '(' . $phpgw_domain[$ConfigDomain]['db_type'] . ')');
|
||||||
$setup_tpl->pparse('out','T_lang_main');
|
$setup_tpl->pparse('out','T_lang_main');
|
||||||
$GLOBALS['phpgw_setup']->html->show_footer();
|
$GLOBALS['phpgw_setup']->show_footer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
Loading…
Reference in New Issue
Block a user