From 7c8a510d3fb753e9929d3805372148a04e4d59b5 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Fri, 17 May 2013 22:25:03 +0000 Subject: [PATCH] Last bugs --- html/admin/setup.php | 23 ++++++++++++----------- html/admin/sql/patch/upgrade106.sql | 11 +++++++++++ html/user_login.php | 2 +- include/config_file.php | 4 ++-- include/constant.php | 24 +++++++++++------------- include/user_menu.php | 12 +++++++++++- sql/upgrade.sql | 5 ----- 7 files changed, 48 insertions(+), 33 deletions(-) create mode 100644 html/admin/sql/patch/upgrade106.sql diff --git a/html/admin/setup.php b/html/admin/setup.php index 82fd9fda2..65baf0ecc 100644 --- a/html/admin/setup.php +++ b/html/admin/setup.php @@ -51,21 +51,22 @@ $failed=""; $succeed=""; $inc_path=get_include_path(); global $os; -/** - *@brief create correctly the htaccess file - */ -function create_htaccess() -{ - - $inc_path=get_include_path(); +$inc_path=get_include_path(); global $os; if ( strpos($inc_path,";") != 0 ) { - $new_path=$inc_path.';..\..\include;addon'; + $new_path=$inc_path.';../../include;addon'; $os=0; /* $os is 0 for windoz */ } else { $new_path=$inc_path.':../../include:addon'; $os=1; /* $os is 1 for unix */ } +/** + *@brief create correctly the htaccess file + */ +function create_htaccess() +{ + global $os; + /* If htaccess file doesn't exists we create them here * if os == 1 then windows, 0 means Unix @@ -100,7 +101,7 @@ function create_htaccess() "php_flag session.use_only_cookies on"); if ( $os == 0 ) - fwrite($hFile,'php_value include_path .;..\..\include;..\include;addon'."\n"); + fwrite($hFile,'php_value include_path .;../../include;../include;addon'."\n"); else fwrite($hFile,'php_value include_path .:../../include:../include:addon'."\n"); foreach ($array as $value ) fwrite($hFile,$value."\n"); @@ -340,7 +341,7 @@ if ( ! isset($_POST['go']) ) { if ( ! isset($_POST['go']) ) exit(); // Check if account_repository exists - if ( defined("MULTI") && MULTI== 0) + if (!defined("MULTI") || (defined("MULTI") && MULTI == 1)) $account = $cn->count_sql("select * from pg_database where datname=lower('" . domaine . "account_repository')"); else $account=1; @@ -392,7 +393,7 @@ $cn=new Database(); echo "

Mise a jour du systeme

"; echo "

Mise à jour dossier

"; -if (defined("MULTI") && MULTI == 0) +if (defined("MULTI") && MULTI == 0) { $db = new Database(); if ($db->exist_table("version") == false) diff --git a/html/admin/sql/patch/upgrade106.sql b/html/admin/sql/patch/upgrade106.sql new file mode 100644 index 000000000..a08f7ce26 --- /dev/null +++ b/html/admin/sql/patch/upgrade106.sql @@ -0,0 +1,11 @@ +begin; +update attr_def set ad_text='Compte bancaire' where ad_id=3; +ALTER TABLE mod_payment DROP CONSTRAINT mod_payment_mp_fd_id_fkey ; +ALTER TABLE mod_payment ADD CONSTRAINT mod_payment_mp_fd_id_fkey FOREIGN KEY (mp_fd_id) REFERENCES fiche_def (fd_id) MATCH SIMPLE ON UPDATE cascade ON DELETE cascade; +ALTER TABLE mod_payment DROP CONSTRAINT mod_payment_mp_jrn_def_id_fkey ; +ALTER TABLE mod_payment ADD CONSTRAINT mod_payment_mp_jrn_def_id_fkey FOREIGN KEY (mp_jrn_def_id) REFERENCES jrn_def (jrn_def_id) MATCH SIMPLE ON UPDATE CASCADE ON DELETE CASCADE; + +update version set val=107; + +commit; + diff --git a/html/user_login.php b/html/user_login.php index 9200f7ada..495b45dca 100644 --- a/html/user_login.php +++ b/html/user_login.php @@ -104,7 +104,7 @@ echo '
'; * folder if he's an "plugin user" */ -if ( $User->admin == 0 || (defined("MULTI")&&MULTI==0)) +if ( $User->admin == 0 ) { // how many folder ? $folder=$User->get_available_folder(); diff --git a/include/config_file.php b/include/config_file.php index 73bccdd7b..6cc095ec9 100644 --- a/include/config_file.php +++ b/include/config_file.php @@ -105,7 +105,7 @@ function config_file_form($p_array=null) } /*!\brief create the config file */ -function config_file_create($p_array,$from_setup=1,$os=1) +function config_file_create($p_array,$from_setup=1,$p_os=1) { extract ($p_array); $add=($from_setup==1)?'..'.DIRECTORY_SEPARATOR:''; @@ -118,7 +118,7 @@ function config_file_create($p_array,$from_setup=1,$os=1) fputs($hFile,"\r\n"); fputs($hFile, 'define("PG_PATH","'.$cpath.'");'); fputs($hFile,"\r\n"); - if ( $os == 1 ) + if ( $p_os == 1 ) { fputs($hFile, 'define("PG_RESTORE","'.$cpath.DIRECTORY_SEPARATOR.'pg_restore ");'); fputs($hFile,"\r\n"); diff --git a/include/constant.php b/include/constant.php index 1148b1dda..f65b24e82 100644 --- a/include/constant.php +++ b/include/constant.php @@ -41,17 +41,15 @@ if ( strpos($inc_path,";") != 0 ) { $os=1; /* $os is 1 for unix */ } set_include_path($new_path); -if ( defined("MULTI") && MULTI==0 ) { - ini_set ('session.use_cookies',1); - ini_set ('session.use_only_cookies','on'); - ini_set ('session.use_trans_sid','on'); - ini_set ('magic_quotes_gpc','off'); - ini_set ('max_execution_time',240); - ini_set ('memory_limit','20M'); - ini_set ('post_max_size','20M'); - ini_set ('upload_max_filesize','20M'); +ini_set ('session.use_cookies',1); +ini_set ('session.use_only_cookies','on'); +ini_set ('magic_quotes_gpc','off'); +ini_set ('max_execution_time',240); +ini_set ('memory_limit','20M'); +ini_set ('default_charset',"UTF-8"); +@ini_set ('session.use_trans_sid','on'); @session_start(); -} + /* * Ini session */ @@ -64,9 +62,9 @@ $g_failed=""; $g_succeed=""; /*set to none for production */ /* uncomment for production */ -define ('SVNINFO',5900); +//define ('SVNINFO',5900); $version_phpcompta=SVNINFO; -define ("DEBUG",true); +define ("DEBUG",false); /* define ('SVNINFO',5015); * $version_phpcompta=SVNINFO; * define ("DEBUG",true); @@ -77,7 +75,7 @@ define ("SITE_UPDATE",'http://www.phpcompta.eu/last_version.txt'); define ("SITE_UPDATE_PLUGIN",'http://www.phpcompta.eu/plugin_last_version.txt'); -define ("DBVERSION",106); +define ("DBVERSION",107); define ("DBVERSIONREPO",14); define ('NOTFOUND','--not found--'); diff --git a/include/user_menu.php b/include/user_menu.php index 23f3caeca..dad5ee314 100644 --- a/include/user_menu.php +++ b/include/user_menu.php @@ -106,14 +106,24 @@ function MenuAdmin() break; } } - $item=array (array("admin_repo.php?action=user_mgt",_("Utilisateurs"),_('Gestion des utilisateurs'),0), + if (!defined("MULTI")||(defined("MULTI")&&MULTI==1)) + { + $item=array (array("admin_repo.php?action=user_mgt",_("Utilisateurs"),_('Gestion des utilisateurs'),0), array("admin_repo.php?action=dossier_mgt",_("Dossiers"),_('Gestion des dossiers'),1), array("admin_repo.php?action=modele_mgt",_("Modèles"),_('Gestion des modèles'),2), array("admin_repo.php?action=restore",_("Restaure"),_("Restaure une base de données"),3), array("admin_repo.php?action=audit_log",_("Audit"),_("Utilisateurs qui se sont connectés"),4), array("login.php",_("Accueil")) ); + } + else + { + $item=array (array("admin_repo.php?action=user_mgt",_("Utilisateurs"),_('Gestion des utilisateurs'),0), + array("admin_repo.php?action=audit_log",_("Audit"),_("Utilisateurs qui se sont connectés"),4), + array("login.php",_("Accueil")) + ); + } $menu=ShowItem($item,'H',"mtitle","mtitle",$def,' style="width:80%;margin-left:10%" '); return $menu; } diff --git a/sql/upgrade.sql b/sql/upgrade.sql index 084c8295b..e69de29bb 100644 --- a/sql/upgrade.sql +++ b/sql/upgrade.sql @@ -1,5 +0,0 @@ -update attr_def set ad_text='Compte bancaire' where ad_id=3; -ALTER TABLE mod_payment DROP CONSTRAINT mod_payment_mp_fd_id_fkey ; -ALTER TABLE mod_payment ADD CONSTRAINT mod_payment_mp_fd_id_fkey FOREIGN KEY (mp_fd_id) REFERENCES fiche_def (fd_id) MATCH SIMPLE ON UPDATE cascade ON DELETE cascade; -ALTER TABLE mod_payment DROP CONSTRAINT mod_payment_mp_jrn_def_id_fkey ; -ALTER TABLE mod_payment ADD CONSTRAINT mod_payment_mp_jrn_def_id_fkey FOREIGN KEY (mp_jrn_def_id) REFERENCES jrn_def (jrn_def_id) MATCH SIMPLE ON UPDATE CASCADE ON DELETE CASCADE;