From f476985c3b27fa827cf1763dac1caa9150cb7b72 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@users.sourceforge.net> Date: Mon, 9 Nov 2009 15:13:45 +0000 Subject: [PATCH] Fix: Control of parameters was not done. --- .../email_unpaid_invoices_to_representatives.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/invoices/email_unpaid_invoices_to_representatives.php b/scripts/invoices/email_unpaid_invoices_to_representatives.php index 523c2fb1a6b..ccb5804a606 100644 --- a/scripts/invoices/email_unpaid_invoices_to_representatives.php +++ b/scripts/invoices/email_unpaid_invoices_to_representatives.php @@ -25,6 +25,11 @@ * \version $Id$ */ +$sapi_type = php_sapi_name(); +$script_file = basename(__FILE__); +$path=str_replace($script_file,'',$_SERVER["PHP_SELF"]); +$path=preg_replace('@[\\\/]+$@','',$path).'/'; + // Test si mode batch $sapi_type = php_sapi_name(); if (substr($sapi_type, 0, 3) == 'cgi') { @@ -32,8 +37,10 @@ if (substr($sapi_type, 0, 3) == 'cgi') { exit; } -// Recupere root dolibarr -$path=str_replace('email_unpaid_invoices_to_representatives.php','',$_SERVER["PHP_SELF"]); +if (! isset($argv[1]) || ! $argv[1]) { + print "Usage: $script_file now\n"; + exit; +} require($path."../../htdocs/master.inc.php"); -- GitLab