diff --git a/htdocs/admin/system/database-tables.php b/htdocs/admin/system/database-tables.php index abba79fc5cc..7dfd6b9f2c8 100644 --- a/htdocs/admin/system/database-tables.php +++ b/htdocs/admin/system/database-tables.php @@ -1,8 +1,9 @@ - * Copyright (C) 2004-2005 Laurent Destailleur - * Copyright (C) 2004 Sebastien Di Cintio - * Copyright (C) 2004 Benoit Mortier +/* Copyright (C) 2003 Rodolphe Quiedeville + * Copyright (C) 2004-2005 Laurent Destailleur + * Copyright (C) 2004 Sebastien Di Cintio + * Copyright (C) 2004 Benoit Mortier + * Copyright (C) 2005-2012 Regis Houssin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -27,10 +28,13 @@ require("../../main.inc.php"); $langs->load("admin"); -if (!$user->admin) accessforbidden(); +if (! $user->admin) + accessforbidden(); + +$action=GETPOST('action','alpha'); -if ($_GET["action"] == 'convert') +if ($action == 'convert') { $db->query("alter table ".$_GET["table"]." ENGINE=INNODB"); } @@ -103,7 +107,7 @@ else print ''.$obj->Name.''; print ''.$obj->Engine.''; - if ($row[1] == "MyISAM") + if (isset($row[1]) && $row[1] == "MyISAM") { print ''.$langs->trans("Convert").''; } @@ -138,7 +142,9 @@ else print 'Nb tuples modify'; print 'Nb tuples delete'; print "\n"; - $sql = "select relname,seq_tup_read,idx_tup_fetch,n_tup_ins,n_tup_upd,n_tup_del from pg_stat_user_tables;"; + + $sql = "SELECT relname, seq_tup_read, idx_tup_fetch, n_tup_ins, n_tup_upd, n_tup_del"; + $sql.= " FROM pg_stat_user_tables"; $resql = $db->query($sql); if ($resql) @@ -166,4 +172,5 @@ else } llxFooter(); -?> +$db->close(); +?> \ No newline at end of file diff --git a/htdocs/admin/system/dbtable.php b/htdocs/admin/system/dbtable.php index f389e73a053..bc6cc57405e 100644 --- a/htdocs/admin/system/dbtable.php +++ b/htdocs/admin/system/dbtable.php @@ -1,8 +1,9 @@ - * Copyright (C) 2004-2005 Laurent Destailleur - * Copyright (C) 2004 Sebastien Di Cintio - * Copyright (C) 2004 Benoit Mortier +/* Copyright (C) 2003 Rodolphe Quiedeville + * Copyright (C) 2004-2005 Laurent Destailleur + * Copyright (C) 2004 Sebastien Di Cintio + * Copyright (C) 2004 Benoit Mortier + * Copyright (C) 2005-2012 Regis Houssin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -27,8 +28,10 @@ require("../../main.inc.php"); $langs->load("admin"); +if (! $user->admin) + accessforbidden(); -if (!$user->admin) accessforbidden(); +$table=GETPOST('table','alpha'); /* @@ -38,31 +41,29 @@ if (!$user->admin) accessforbidden(); llxHeader(); -print_fiche_titre($langs->trans("Table") . " ".$_GET["table"],'','setup'); +print_fiche_titre($langs->trans("Table") . " ".$table,'','setup'); // Define request to get table description $base=0; if (preg_match('/mysql/i',$conf->db->type)) { - $sql = "SHOW TABLE STATUS LIKE '".$_GET["table"]."'"; + $sql = "SHOW TABLE STATUS LIKE '".$db->escape($table)."'"; $base=1; } - -if ($conf->db->type == 'pgsql') +else if ($conf->db->type == 'pgsql') { $sql = "SELECT conname,contype FROM pg_constraint"; $base=2; } - if (! $base) { print $langs->trans("FeatureNotAvailableWithThisDatabaseDriver"); } else { - $result = $db->query($sql); - if ($result) + $resql = $db->query($sql); + if ($resql) { $num = $db->num_rows($resql); $var=True; @@ -74,24 +75,24 @@ else } } - - if ($base==1) + if ($base == 1) { - - $cons = explode(";",$row[14]); - - foreach ($cons as $cc) + $link=array(); + $cons = explode(";", $row[14]); + if (! empty($cons)) { - $cx = preg_replace("/\)\sREFER/", "", $cc); - $cx = preg_replace("/\(`/", "", $cx); - $cx = preg_replace("/`\)/", "", $cx); - $cx = preg_replace("/`\s/", "", $cx); + foreach($cons as $cc) + { + $cx = preg_replace("/\)\sREFER/", "", $cc); + $cx = preg_replace("/\(`/", "", $cx); + $cx = preg_replace("/`\)/", "", $cx); + $cx = preg_replace("/`\s/", "", $cx); - $val = explode("`",$cx); - - $link[trim($val[0])][0] = $val[1]; - $link[trim($val[0])][1] = $val[2]; + $val = explode("`",$cx); + $link[trim($val[0])][0] = (isset($val[1])?$val[1]:''); + $link[trim($val[0])][1] = (isset($val[2])?$val[2]:''); + } } // var_dump($link); @@ -100,26 +101,24 @@ else print ''.$langs->trans("Fields").''.$langs->trans("Type").''.$langs->trans("Index").''; print ''.$langs->trans("FieldsLinked").''; - $sql = "DESCRIBE ".$_GET["table"]; - $result = $db->query($sql); - if ($result) + $sql = "DESCRIBE ".$table; + $resql = $db->query($sql); + if ($resql) { - $num = $db->num_rows($result); + $num = $db->num_rows($resql); $var=True; $i=0; while ($i < $num) { - $row = $db->fetch_row($result); + $row = $db->fetch_row($resql); $var=!$var; print ""; - print "$row[0]"; print "$row[1]"; print "$row[3]"; - print "".$link[$row[0]][0]."."; - print $link[$row[0]][1].""; - + print "".(isset($link[$row[0]][0])?$link[$row[0]][0]:'')."."; + print (isset($link[$row[0]][1])?$link[$row[0]][1]:'').""; print ''; $i++; @@ -130,4 +129,5 @@ else } llxFooter(); -?> +$db->close(); +?> \ No newline at end of file diff --git a/htdocs/admin/system/dolibarr.php b/htdocs/admin/system/dolibarr.php index 52da5ba5325..5c9a262a268 100644 --- a/htdocs/admin/system/dolibarr.php +++ b/htdocs/admin/system/dolibarr.php @@ -1,6 +1,7 @@ - * Copyright (C) 2007 Rodolphe Quiedeville +/* Copyright (C) 2005-2012 Laurent Destailleur + * Copyright (C) 2007 Rodolphe Quiedeville + * Copyright (C) 2007-2012 Regis Houssin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,8 +30,8 @@ $langs->load("admin"); $langs->load("install"); $langs->load("other"); -if (!$user->admin) - accessforbidden(); +if (! $user->admin) + accessforbidden(); /* @@ -153,7 +154,7 @@ if (($thousand != ',' && $thousand != '.') || ($thousand != ' ')) $var=!$var; print '  => price(1234.56)'.price(1234.56).''; // Timezone -$txt =$langs->trans("OSTZ").' (variable system TZ): '.($_ENV["TZ"]?$_ENV["TZ"]:$langs->trans("NotDefined")).'
'."\n"; +$txt =$langs->trans("OSTZ").' (variable system TZ): '.(! empty($_ENV["TZ"])?$_ENV["TZ"]:$langs->trans("NotDefined")).'
'."\n"; $txt.=$langs->trans("PHPTZ").' (php.ini date.timezone): '.(ini_get("date.timezone")?ini_get("date.timezone"):$langs->trans("NotDefined")).''."\n"; // date.timezone must be in valued defined in http://fr3.php.net/manual/en/timezones.europe.php $var=!$var; print ''.$langs->trans("CurrentTimeZone").''; // Timezone server PHP @@ -212,4 +213,4 @@ print '
'; llxFooter(); $db->close(); -?> +?> \ No newline at end of file diff --git a/htdocs/admin/system/modules.php b/htdocs/admin/system/modules.php index 616c551d00c..1a10f15ca1e 100644 --- a/htdocs/admin/system/modules.php +++ b/htdocs/admin/system/modules.php @@ -1,7 +1,7 @@ * Copyright (C) 2007 Rodolphe Quiedeville - * Copyright (C) 2010-2011 Regis Houssin + * Copyright (C) 2010-2012 Regis Houssin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,7 +29,8 @@ $langs->load("admin"); $langs->load("install"); $langs->load("other"); -if (!$user->admin) accessforbidden(); +if (! $user->admin) + accessforbidden(); /* @@ -123,12 +124,14 @@ foreach($sortorder as $numero=>$name) print ''; print '
'; sort($rights_ids); +$old=''; foreach($rights_ids as $right_id) { if ($old == $right_id) - print "Warning duplicate id on permission : ".$right_id."
"; + print "Warning duplicate id on permission : ".$right_id."
"; $old = $right_id; } llxFooter(); -?> +$db->close(); +?> \ No newline at end of file diff --git a/htdocs/admin/system/phpinfo.php b/htdocs/admin/system/phpinfo.php index 57fab93dc40..01ab2a200e3 100644 --- a/htdocs/admin/system/phpinfo.php +++ b/htdocs/admin/system/phpinfo.php @@ -1,6 +1,7 @@ - * Copyright (C) 2004-2005 Laurent Destailleur +/* Copyright (C) 2001-2002 Rodolphe Quiedeville + * Copyright (C) 2004-2005 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -25,8 +26,10 @@ require("../../main.inc.php"); $langs->load("admin"); -if (!$user->admin) -accessforbidden(); +if (! $user->admin) + accessforbidden(); + +$what=GETPOST('what','alpha'); /* @@ -61,17 +64,17 @@ llxHeader(); ob_start(); -if ($_GET["what"] == 'conf') +if ($what == 'conf') { $title = 'Setup'; phpinfo(INFO_CONFIGURATION); } -elseif ($_GET["what"] == 'env') +elseif ($what == 'env') { $title = 'OSEnv'; phpinfo(INFO_ENVIRONMENT); } -elseif ($_GET["what"] == 'modules') +elseif ($what == 'modules') { $title = 'Modules'; phpinfo(INFO_MODULES); @@ -115,4 +118,5 @@ print "$chaine\n"; // Ne pas centrer la reponse php car certains tableau du bas print "
\n"; llxFooter(); -?> +$db->close(); +?> \ No newline at end of file diff --git a/htdocs/admin/tools/dolibarr_export.php b/htdocs/admin/tools/dolibarr_export.php index e7442679c4d..047b9c6ffe9 100644 --- a/htdocs/admin/tools/dolibarr_export.php +++ b/htdocs/admin/tools/dolibarr_export.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2006-2012 Laurent Destailleur + * Copyright (C) 2006-2012 Regis Houssin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -28,19 +29,19 @@ require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php"); $langs->load("admin"); -$action=GETPOST('action'); +$action=GETPOST('action','alpha'); -$sortfield = GETPOST("sortfield"); -$sortorder = GETPOST("sortorder"); -$page = GETPOST("page"); +$sortfield = GETPOST('sortfield','alpha'); +$sortorder = GETPOST('sortorder','alpha'); +$page = GETPOST('page','int'); if (! $sortorder) $sortorder="DESC"; if (! $sortfield) $sortfield="date"; if ($page < 0) { $page = 0; } $limit = $conf->liste_limit; $offset = $limit * $page; -if (! $user->admin) accessforbidden(); - +if (! $user->admin) + accessforbidden(); /* @@ -115,13 +116,6 @@ print $langs->trans("BackupDescX").'

'; print $langs->trans("BackupDesc3",DOL_DATA_ROOT).'
'; print $langs->trans("BackupDescY").'

'; -if ($_GET["msg"]) -{ - print '
'.$_GET["msg"].'
'; - print '
'; - print "\n"; -} - ?> diff --git a/htdocs/admin/tools/dolibarr_import.php b/htdocs/admin/tools/dolibarr_import.php index 325d1c834bc..cd2119ca4c8 100644 --- a/htdocs/admin/tools/dolibarr_import.php +++ b/htdocs/admin/tools/dolibarr_import.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2006-2012 Laurent Destailleur + * Copyright (C) 2006-2012 Regis Houssin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -26,7 +27,11 @@ require("../../main.inc.php"); $langs->load("admin"); $langs->load("other"); -if (! $user->admin) accessforbidden(); +if (! $user->admin) + accessforbidden(); + +$radio_dump=GETPOST('radio_dump'); +$showpass=GETPOST('showpass'); /* @@ -41,8 +46,8 @@ llxHeader('','',$help_url); ?>