From fcc25550c265914a0829be117a019d6348fc4dc9 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Thu, 5 May 2016 12:13:48 +0200 Subject: [PATCH] Fix several small bugs --- include/config.inc.example | 8 ++++++++ include/constant.php | 13 ++++++++----- include/lib/class_database.php | 2 +- include/lib/class_sendmail.php | 4 +++- include/lib/config_file.php | 15 +++++++++++++-- 5 files changed, 33 insertions(+), 9 deletions(-) diff --git a/include/config.inc.example b/include/config.inc.example index 9f352406c..a8284a46b 100644 --- a/include/config.inc.example +++ b/include/config.inc.example @@ -42,3 +42,11 @@ define ("dbname",""); // define ("SYSINFO_DISPLAY",true); // For developpement // define ("NOALYSS VERSION",9999); + +// If you want to override the parameters you have to define OVERRIDE_PARAM +// and give your own parameters for max_execution_time and memory limit +// define ('OVERRIDE_PARAM',1); +// ini_set ('max_execution_time',240); +// ini_set ('memory_limit','256M'); +// + \ No newline at end of file diff --git a/include/constant.php b/include/constant.php index 3bff1155f..e6c0465a2 100644 --- a/include/constant.php +++ b/include/constant.php @@ -62,12 +62,15 @@ if ( strpos($inc_path,";") != 0 ) { $os=1; /* $os is 1 for unix */ } set_include_path($new_path); -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','256M'); ini_set ('default_charset',"UTF-8"); +ini_set ('session.use_cookies',1); +ini_set ('magic_quotes_gpc','off'); +ini_set ('session.use_only_cookies','on'); + +if ( ! defined('OVERRIDE_PARAM')) { + ini_set ('max_execution_time',240); + ini_set ('memory_limit','256M'); +} @ini_set ('session.use_trans_sid','on'); @session_start(); diff --git a/include/lib/class_database.php b/include/lib/class_database.php index 48c7dd23f..c2d1b781d 100644 --- a/include/lib/class_database.php +++ b/include/lib/class_database.php @@ -47,7 +47,7 @@ class Database function __construct($p_database_id=0, $p_type='dos') { - if (IsNumber($p_database_id)==false||strlen($p_database_id)>5) + if (IsNumber($p_database_id)==false||strlen($p_database_id)>10) die("-->Dossier invalide [$p_database_id]"); $noalyss_user=(defined("noalyss_user"))?noalyss_user:phpcompta_user; $password=(defined("noalyss_password"))?noalyss_password:phpcompta_password; diff --git a/include/lib/class_sendmail.php b/include/lib/class_sendmail.php index ae8f29757..c5d0a6f27 100644 --- a/include/lib/class_sendmail.php +++ b/include/lib/class_sendmail.php @@ -25,6 +25,7 @@ * @author dany */ require_once NOALYSS_INCLUDE.'/lib/class_filetosend.php'; +require_once NOALYSS_INCLUDE.'/class/class_dossier.php'; class Sendmail { @@ -158,7 +159,7 @@ class Sendmail // Increment email amount $repo =new Database(); $date=date('Ymd'); - $dossier=Dossier::id(); + $dossier=HtmlInput::default_value_request("gDossier", -1); $this->increment_mail($repo,$dossier,$date); } /** @@ -228,6 +229,7 @@ class Sendmail */ function increment_mail(Database $p_repo,$p_dossier,$p_date) { + if ( $p_dossier == -1) return ; $email_sent = $this->get_email_sent($p_repo,$p_dossier,$p_date); if ( $email_sent == 0 ){ $p_repo->exec_sql("insert into public.dossier_sent_email(de_sent_email,dos_id,de_date) values($1,$2,$3)", diff --git a/include/lib/config_file.php b/include/lib/config_file.php index 580747aeb..c5e0459d4 100644 --- a/include/lib/config_file.php +++ b/include/lib/config_file.php @@ -198,6 +198,10 @@ function display_file_config($p_array,$from_setup=1,$p_os=1) print ("\r\n"); print ( '// define ("NOALYSS_TEMPLATE","");'); print ("\r\n"); + 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"); @@ -205,7 +209,7 @@ function display_file_config($p_array,$from_setup=1,$p_os=1) print ("// With the unoconv tool"); print ( "//define ('OFFICE','HOME=/tmp unoconv ');"); print ("\r\n"); - printf("//define ('GENERATE_PDF','YES');"); + print ("//define ('GENERATE_PDF','YES');"); print ("\r\n"); print ( "// Uncomment if you don't want "."\r\n"); print ( "// to be informed when a new release is "."\r\n"); @@ -216,10 +220,17 @@ function display_file_config($p_array,$from_setup=1,$p_os=1) print ( '// define ("SYSINFO_DISPLAY",true);'."\r\n"); print ( '// For developpement'."\r\n"); print ( '// define ("NOALYSS VERSION",9999);'."\r\n"); + print (' // If you want to override the parameters you have to define OVERRIDE_PARAM'."\r\n"); + print ('// and give your own parameters for max_execution_time and memory_limit'."\r\n"); + print ("// define ('OVERRIDE_PARAM',1);\r\n"); + print ("// ini_set ('max_execution_time',240);\r\n"); + print ("// ini_set ('memory_limit','256M');\r\n"); +// + } /*!\brief create the config file */ -function config_file_create($p_array,$p_os=1) +function config_file_create($p_array,$from_setup,$p_os=1) { extract ($p_array); $hFile= fopen(NOALYSS_INCLUDE.'/config.inc.php','w');