Merge branch 'dev7202'

This commit is contained in:
Dany De Bontridder 2020-04-04 13:56:50 +02:00
commit cc4abbc6f3
21 changed files with 278 additions and 78 deletions

View file

@ -161,6 +161,8 @@ content[205]="<?php echo _("Port pour postgresql")?>";
content[206]="<?php echo _("En version mono dossier, le nom de la base de données doit être mentionné")?>";
content[207]="<?php echo _("Vous devez choisir si NOALYSS est installé sur l'un de vos servers ou sur un server mutualisé qui ne donne qu'une seule base de données")?>";
content[208]="<?php echo _("Serveur postgresql")?>";
content[209]="<?php echo _("Mot de passe administrateur, il peut être changé ensuite dans les préférences")?>";
content[210]="<?php echo _("login administrateur")?>";
</script>
@ -181,7 +183,7 @@ if ( strpos($inc_path,";") != 0 ) {
$new_path=$inc_path.':../../include:addon';
$os=1; /* $os is 1 for unix */
}
// Retrieve informations from the very screen
// Retrieve informations from the screen
//
$http=new HttpInput();
$db_user=$http->request("cuser","string", "");
@ -194,6 +196,7 @@ $ctmp=$http->request("ctmp","string", "/tmp");
$cpath=$http->request("cpath","string", "/usr/bin");
$db_name=$http->request("cdbname", "string","");
$cadmin=$http->request("cadmin","string", "admin");
$cpassword_admin=$http->request("cpassword_admin","string", "phpcompta");
$cadmin=strtolower($cadmin);
//-------------------------------------------------------------------------
// warn only if we can not write in include
@ -213,6 +216,36 @@ if ( is_writable ('install.php') == false ) {
if (isset($_POST['save_config'])) {
require_once NOALYSS_INCLUDE.'/lib/config_file.php';
$err=0;
// check password and admin not empty
//
if ( strlen(trim($cpassword_admin))== 0 ||
strlen(trim($cadmin))== 0
) {
echo '<h2 class="warning">';
echo _('Le mot de passe du super admin et le login ne peuvent être vides');
echo '</h2>';
$err++;
}
// check password and admin not containing quote or double quote
//
if ( strpos($cpassword_admin,'"') !== false
|| strpos($cadmin,'"') !== false
|| strpos($cpassword_admin,"'") !== false
|| strpos($cadmin,"'") !== false
|| strpos($cpassword_admin," ") !== false
|| strpos($cadmin," ") !== false
|| strpos($cadmin,"@mobile") !== false
) {
echo '<h2 class="warning">';
echo _('Le mot de passe du super admin et le superadmin ne peut pas contenir des guillemets ou espaces, ni @mobile');
echo '</h2>';
$err++;
}
// Try to connect , if it doesn't work that do not create the config file
if ($multi=="N") {
$cnx = new DatabaseCore($db_user, $db_password,'template1', $db_host, $db_port);
@ -222,13 +255,14 @@ if (isset($_POST['save_config'])) {
// -----
// If conx successfull save the file or display it
// -----
if ( $cnx !== false ) {
if ( $err == 0 && $cnx !== false ) {
echo '<h1>'._('Important').'</h1>';
echo '<h2 class="warning">',_("Voici l'utilisateur et mot de passe de l'utilisateur administrateur de Noalyss , il a tous les droits et a accès à tout."
echo '<h2 class="warning">',_("Voici l'utilisateur et mot de passe de l'utilisateur administrateur de Noalyss , "
. " il a tous les droits et a accès à tout."
. " Connectez-vous avec ses identifiants et changer le mot de passe dans préférence (en haut à droit)"),
"</h2>";
echo '<p style="font-size:120%">'._('Utilisateur administrateur'),' ','<span style="color:red"> ',$cadmin,'</span>','</p>';
echo '<p style="font-size:120%">',_('Mot de passe'),'<span style="color:red"> phpcompta </span>','</p>';
echo '<p style="font-size:120%">',_('Mot de passe'),'<span style="color:red"> '.$cpassword_admin.' </span>','</p>';
// Create the db
if (is_writable(NOALYSS_INCLUDE)) {
$url=config_file_create($_POST,1,$os);
@ -256,7 +290,7 @@ if (isset($_POST['save_config'])) {
echo '</textarea>';
return;
}
} else {
} elseif ($err == 0 && $cnx == false) {
echo '<h2 class="warning">';
echo _('Impossible de se connecter à Postgresql, vérifiez les informations de connection');
echo '</h2>';
@ -270,6 +304,7 @@ if (isset($_POST['save_config'])) {
//
//------------------------------------------------------------------------
if ( ! file_exists(NOALYSS_INCLUDE.'/config.inc.php')) {
echo '<h1 class="info">'._('Entrez les informations nécessaires à noalyss').'</h1>';
echo '<form method="post">';
require_once NOALYSS_INCLUDE.'/lib/config_file.php';
@ -294,6 +329,7 @@ if ( ! file_exists(NOALYSS_INCLUDE.'/config.inc.php')) {
// magic_quotes_runtime = Off
// magic_quotes_sybase = Off
// include_path
require_once NOALYSS_INCLUDE.'/config.inc.php';
require_once NOALYSS_INCLUDE.'/lib/config_file.php';
require_once NOALYSS_INCLUDE.'/class/database.class.php';
@ -365,7 +401,7 @@ for ($m=0;$m<$nb_need_module;$m++)
if ( ini_get("max_execution_time") < 60 ) {
echo "<li>";
echo _('Avertissement').' : '.$failed;
echo '<span class="info"> ',
echo '<span class="info"> ',
_("max_execution_time devrait être de 60 minimum"),
'</span>';
echo "</li>";
@ -522,8 +558,9 @@ if ($account == 0 ) {
$cn->execute_script(NOALYSS_INCLUDE."/sql/account_repository/constraint.sql");
/* update name administrator */
$cadmin=NOALYSS_ADMINISTRATOR;
$cn->exec_sql("update ac_users set use_login=$1,use_active=1 where use_id=1",
array(strtolower($cadmin)));
$cpassword_admin=NOALYSS_ADMIN_PASSWORD;
$cn->exec_sql("update ac_users set use_login=$1,use_pass=md5($2),use_active=1 where use_id=1",
array(strtolower($cadmin),$cpassword_admin));
$cn->commit($cn);
@ -617,11 +654,11 @@ if (defined("MULTI") && MULTI == 0)
}
}
$db->exec_sql("update ac_users set use_login=$1 where use_id=1",
array(strtolower(NOALYSS_ADMINISTRATOR)));
$db->exec_sql("update ac_users set use_login=$1,use_pass=2 where use_id=1",
array(strtolower(NOALYSS_ADMINISTRATOR),NOALYSS_ADMIN_PASSWORD));
echo '<h1>'._('Important').'</h1>';
echo '<p>'._('Utilisateur administrateur'),' ',NOALYSS_ADMINISTRATOR,'</p>';
echo '<p>',_('Mot de passe par défaut à l\'installation'),' phpcompta','</p>';
echo "<h2 class=\"warning\">";
printf (" VOUS DEVEZ EFFACER CE FICHIER %s",__FILE__);
echo "</h2>";
@ -640,9 +677,12 @@ define ('ALLOWED',1);
define ('ALLOWED_ADMIN',1);
$rep=new Database();
if (defined(NOALYSS_ADMINISTRATOR))
if (defined("NOALYSS_ADMINISTRATOR") && defined ("NOALYSS_ADMIN_PASSWORD"))
{
$rep->exec_sql("update ac_users set use_login=$1 where use_id=1", array(strtolower(NOALYSS_ADMINISTRATOR)));
$rep->exec_sql("update ac_users set use_login=$1 ,use_pass=md5($2)
where use_id=1",
array(strtolower(NOALYSS_ADMINISTRATOR),
NOALYSS_ADMIN_PASSWORD));
}
Dossier::upgrade();
echo '<h1>'._('Important').'</h1>';