From 30f84ace56efe79555bdeee124a0ea172f83c8a5 Mon Sep 17 00:00:00 2001
From: Dany De Bontridder
Date: Sat, 30 Jan 2016 22:32:56 +0100
Subject: [PATCH] =?UTF-8?q?A=20l'installation=20permet=20de=20choisir=20le?=
=?UTF-8?q?=20nom=20de=20l'administrateur,=20dans=20les=20versions=20pr?=
=?UTF-8?q?=C3=A9c=C3=A9dentes=20c'=C3=A9tait=20phpcompta?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
html/install.php | 30 +++++++++++-
include/class/class_acc_ledger.php | 4 +-
include/class/class_acc_operation.php | 2 +-
include/class/class_dossier.php | 4 +-
include/class/class_user.php | 2 +-
include/constant.php | 4 ++
include/lib/config_file.php | 58 ++++++++++++-----------
include/template/template_config_form.php | 8 ++++
8 files changed, 78 insertions(+), 34 deletions(-)
diff --git a/html/install.php b/html/install.php
index 38425868a..166cbd378 100644
--- a/html/install.php
+++ b/html/install.php
@@ -216,6 +216,8 @@ $locale=HtmlInput::default_value_request("clocale", "1");
$ctmp=HtmlInput::default_value_request("ctmp", "/tmp");
$cpath=HtmlInput::default_value_request("cpath", "/usr/bin");
$db_name=HtmlInput::default_value_request("cdbname", "");
+$cadmin=HtmlInput::default_value_request("cadmin", "phpcompta");
+$cadmin=strtolower($cadmin);
//-------------------------------------------------------------------------
// warn only if we can not write in include
//-------------------------------------------------------------------------
@@ -244,6 +246,9 @@ if (isset($_POST['save_config'])) {
// If conx successfull save the file or display it
// -----
if ( $cnx !== false ) {
+ echo ''._('Important').'
';
+ echo ''._('Utilisateur administrateur'),' ',$cadmin,'
';
+ echo '',_('Mot de passe'),' phpcompta','
';
// Create the db
if (is_writable(NOALYSS_INCLUDE)) {
$url=config_file_create($_POST,1,$os);
@@ -265,6 +270,7 @@ if (isset($_POST['save_config'])) {
print (_('Puis cliquez sur ce lien'))." ";
echo ''._('Installation')."";
echo '
';
+
echo '';
@@ -551,6 +557,11 @@ if ($account == 0 ) {
$cn->execute_script(NOALYSS_INCLUDE."/sql/account_repository/schema.sql");
$cn->execute_script(NOALYSS_INCLUDE."/sql/account_repository/data.sql");
$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 where use_id=1",
+ array(strtolower($cadmin)));
+
$cn->commit($cn);
if ( ! DEBUG) ob_end_clean();
@@ -579,7 +590,9 @@ if ($account == 0 ) {
$cn->commit();
if ( ! DEBUG) ob_end_clean();
-
+echo ''._('Important').'
';
+echo ''._('Utilisateur administrateur'),' ',$cadmin,'
';
+echo '',_('Mot de passe'),' phpcompta','
';
}// end if
// Add a french accountancy model
//--
@@ -597,8 +610,15 @@ if (defined("MULTI") && MULTI == 0)
{
if ( ! DEBUG) { ob_start(); }
$db->execute_script(NOALYSS_INCLUDE.'/sql/mono/mono.sql');
+
if ( ! DEBUG) ob_end_clean();
}
+ /* update name administrator */
+ if ( isset ($_REQUEST['cadmin'])) {
+ $db->exec_sql("update ac_users set use_login=$1 where use_id=1",
+ array($cadmin));
+ }
+
if ($db->exist_table("version") == false)
{
echo '' . $failed ;
@@ -627,6 +647,9 @@ if (defined("MULTI") && MULTI == 0)
$db->execute_script(NOALYSS_INCLUDE.'/sql/patch/ac-upgrade'.$i.'.sql');
}
}
+ echo '
'._('Important').'
';
+ echo ''._('Utilisateur administrateur'),' ',$cadmin,'
';
+ echo '',_('Mot de passe'),' phpcompta','
';
echo "";
printf (" VOUS DEVEZ EFFACER CE FICHIER %s",__FILE__);
echo "
";
@@ -644,7 +667,12 @@ if (defined("MULTI") && MULTI == 0)
define ('ALLOWED',1);
$_GET['sb']="upg_all";
$rep=new Database();
+$rep->exec_sql("update ac_users set use_login=$1 where use_id=1",
+ array(strtolower(NOALYSS_ADMINISTRATOR)));
require NOALYSS_INCLUDE."/upgrade.inc.php";
+echo ''._('Important').'
';
+echo ''._('Utilisateur administrateur'),' ',NOALYSS_ADMINISTRATOR,'
';
+
echo "";
printf (" VOUS DEVEZ EFFACER CE FICHIER %s",__FILE__);
echo "
";
diff --git a/include/class/class_acc_ledger.php b/include/class/class_acc_ledger.php
index 45013b565..73124d152 100644
--- a/include/class/class_acc_ledger.php
+++ b/include/class/class_acc_ledger.php
@@ -3245,7 +3245,7 @@ class Acc_Ledger extends jrn_def_sql
echo Acc_Reconciliation::$javascript;
html_page_start();
$cn = Dossier::connect();
- $_SESSION['g_user'] = 'phpcompta';
+ $_SESSION['g_user'] = NOALYSS_ADMINISTRATOR ;
$_SESSION['g_pass'] = 'phpcompta';
$id = (isset($_REQUEST['p_jrn'])) ? $_REQUEST['p_jrn'] : -1;
@@ -3335,7 +3335,7 @@ class Acc_Ledger extends jrn_def_sql
html_page_start();
$cn = Dossier::connect();
$ledger = new Acc_Ledger($cn, 0);
- $_SESSION['g_user'] = 'phpcompta';
+ $_SESSION['g_user'] = NOALYSS_ADMINISTRATOR;
$_SESSION['g_pass'] = 'phpcompta';
echo $ledger->search_form('ALL');
}
diff --git a/include/class/class_acc_operation.php b/include/class/class_acc_operation.php
index bd2d711fd..a064ab1d9 100644
--- a/include/class/class_acc_operation.php
+++ b/include/class/class_acc_operation.php
@@ -576,7 +576,7 @@ class Acc_Operation
}
static function test_me()
{
- $_SESSION['g_user']='phpcompta';
+ $_SESSION['g_user']=NOALYSS_ADMINISTRATOR;
$_SESSION['g_pass']='dany';
global $g_user;
$cn=Dossier::connect();
diff --git a/include/class/class_dossier.php b/include/class/class_dossier.php
index 132bd168e..9d6944de3 100644
--- a/include/class/class_dossier.php
+++ b/include/class/class_dossier.php
@@ -151,11 +151,11 @@ class Dossier
join jnt_use_dos as jt on (jt.dos_id=ds.dos_id)
group by jt.use_id) as dossier_name on (jt_use_id=ac.use_id)
where
- use_login!='phpcompta'
+ use_login!=$1
$sql
";
- $res=$this->cn->get_array($sql);
+ $res=$this->cn->get_array($sql,array(NOALYSS_ADMINISTRATOR));
return $res;
}
diff --git a/include/class/class_user.php b/include/class/class_user.php
index 124628d42..ee3b446bd 100644
--- a/include/class/class_user.php
+++ b/include/class/class_user.php
@@ -384,7 +384,7 @@ class User
function Admin()
{
$this->admin = 0;
- if ($this->login != 'phpcompta')
+ if ($this->login != NOALYSS_ADMINISTRATOR )
{
$pass5 = md5($this->pass);
$sql = "select use_admin from ac_users where use_login=$1
diff --git a/include/constant.php b/include/constant.php
index 655e629ec..2d9868892 100644
--- a/include/constant.php
+++ b/include/constant.php
@@ -47,6 +47,10 @@ if ( !defined("NOALYSS_TEMPLATE")) define ("NOALYSS_TEMPLATE",$g_template_dir);
// with convert
if ( !defined("FIX_BROKEN_PDF")) define ("FIX_BROKEN_PDF",'NO');
+if ( !defined('NOALYSS_ADMINISTRATOR')) {
+ define ('NOALYSS_ADMINISTRATOR','phpcompta');
+}
+
require_once NOALYSS_INCLUDE.'/constant.security.php';
if ( strpos($inc_path,";") != 0 ) {
diff --git a/include/lib/config_file.php b/include/lib/config_file.php
index f24379d5e..977d14035 100644
--- a/include/lib/config_file.php
+++ b/include/lib/config_file.php
@@ -69,6 +69,7 @@ function config_file_form($p_array=null)
$multi="N";
$cdbname="";
$chost="localhost";
+ $cadmin='admin';
}
else extract ($p_array);
@@ -77,32 +78,34 @@ function config_file_form($p_array=null)
$ictmp->size=25;
$iclocale=new ISelect('clocale');
- $iclocale->value=array(
- array("value"=>1,"label"=>"Activé"),
- array("value"=>0,"label"=>"Désactivé")
- );
- $iclocale->selected=1;
+ $iclocale->value=array(
+ array("value"=>1,"label"=>"Activé"),
+ array("value"=>0,"label"=>"Désactivé")
+ );
+ $iclocale->selected=1;
- $icpath=new IText("cpath",$cpath);
- $icpath->size=30;
+ $icpath=new IText("cpath",$cpath);
+ $icpath->size=30;
+
+ $icuser=new IText('cuser',$cuser);
+ $icpasswd=new IText('cpasswd',$cpasswd);
+ $icport=new IText("cport",$cport);
+ $ichost=new IText("chost",$chost);
+
+ $icadmin=new IText('cadmin',$cadmin);
+ /*
+ * For version MONO
+ */
+ $smulti=new ICheckBox('multi');
+ $smulti->javascript=' onchange="show_dbname(this)" ';
+ $smulti->value = 'Y';
+ if ( $multi == 'Y') {
+ $smulti->selected=true;
- $icuser=new IText('cuser',$cuser);
- $icpasswd=new IText('cpasswd',$cpasswd);
- $icport=new IText("cport",$cport);
- $ichost=new IText("chost",$chost);
- /*
- * For version MONO
- */
- $smulti=new ICheckBox('multi');
- $smulti->javascript=' onchange="show_dbname(this)" ';
- $smulti->value = 'Y';
- if ( $multi == 'Y') {
- $smulti->selected=true;
-
- }
- $icdbname=new IText('cdbname');
- $icdbname->value=$cdbname;
- require NOALYSS_TEMPLATE.'/template_config_form.php';
+ }
+ $icdbname=new IText('cdbname');
+ $icdbname->value=$cdbname;
+ require NOALYSS_TEMPLATE.'/template_config_form.php';
}
/**
* Display the content of the config.inc.php with variables
@@ -146,7 +149,9 @@ function display_file_config($p_array,$from_setup=1,$p_os=1)
print ("\r\n");
print ( 'define ("noalyss_psql_host","'.$chost.'");');
print ("\r\n");
-
+ print ( 'define ("NOALYSS_ADMINISTRATOR","'.$cadmin.'");');
+ print ("\r\n");
+
print ( 'define ("LOCALE",'.$clocale.');');
print ("\r\n");
@@ -187,12 +192,11 @@ function display_file_config($p_array,$from_setup=1,$p_os=1)
print ( '// define ("NOALYSS_INCLUDE","");');
print ("\r\n");
print ( '// define ("NOALYSS_TEMPLATE","");');
+ print ("\r\n");
print ( "// Fix an issue with PDF when exporting receipt in PDF in ANCGL"."\r\n");
print ( '// define ("FIX_BROKEN_PDF","NO");');
print ("\r\n");
print ("\r\n");
- print ("\r\n");
- print ("\r\n");
print ( "// Uncomment if you don't want "."\r\n");
print ( "// to be informed when a new release is "."\r\n");
print ( "// published"."\r\n");
diff --git a/include/template/template_config_form.php b/include/template/template_config_form.php
index 3df715473..fae5e8a94 100644
--- a/include/template/template_config_form.php
+++ b/include/template/template_config_form.php
@@ -51,6 +51,14 @@
|
input();echo HtmlInput::infobulle(204)?> |
+
+ |
+
+ |
+
+ input();?>
+ |
+
| |
input();echo HtmlInput::infobulle(208)?> |