diff --git a/dev/samples/create_order.php b/dev/samples/create_order.php index 3b3c3ffd96e..a3faee41b54 100644 --- a/dev/samples/create_order.php +++ b/dev/samples/create_order.php @@ -26,8 +26,7 @@ $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); -$path=str_replace($script_file,'',$_SERVER["PHP_SELF"]); -$path=preg_replace('@[\\\/]+$@','',$path).'/'; +$path=dirname(__FILE__).'/'; // Test if batch mode if (substr($sapi_type, 0, 3) == 'cgi') { diff --git a/dev/samples/create_product.php b/dev/samples/create_product.php index fb323dee79d..f48bcf966de 100644 --- a/dev/samples/create_product.php +++ b/dev/samples/create_product.php @@ -26,8 +26,7 @@ $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); -$path=str_replace($script_file,'',$_SERVER["PHP_SELF"]); -$path=preg_replace('@[\\\/]+$@','',$path).'/'; +$path=dirname(__FILE__).'/'; // Test if batch mode if (substr($sapi_type, 0, 3) == 'cgi') { diff --git a/dev/skeletons/build_class_from_table.php b/dev/skeletons/build_class_from_table.php index 364f44701f1..c52e86e87a3 100644 --- a/dev/skeletons/build_class_from_table.php +++ b/dev/skeletons/build_class_from_table.php @@ -25,8 +25,7 @@ $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); -$path=str_replace($script_file,'',$_SERVER["PHP_SELF"]); -$path=preg_replace('@[\\\/]+$@','',$path).'/'; +$path=dirname(__FILE__).'/'; // Test if batch mode if (substr($sapi_type, 0, 3) == 'cgi') { diff --git a/dev/skeletons/build_webservice_from_class.php b/dev/skeletons/build_webservice_from_class.php index 83389fe76e3..30c5b96b696 100644 --- a/dev/skeletons/build_webservice_from_class.php +++ b/dev/skeletons/build_webservice_from_class.php @@ -25,8 +25,7 @@ $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); -$path=str_replace($script_file,'',$_SERVER["PHP_SELF"]); -$path=preg_replace('@[\\\/]+$@','',$path).'/'; +$path=dirname(__FILE__).'/'; // Test if batch mode if (substr($sapi_type, 0, 3) == 'cgi') { diff --git a/dev/skeletons/skeleton_script.php b/dev/skeletons/skeleton_script.php index 936ab71b52a..5ebfb54639e 100644 --- a/dev/skeletons/skeleton_script.php +++ b/dev/skeletons/skeleton_script.php @@ -28,8 +28,7 @@ $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); -$path=str_replace($script_file,'',$_SERVER["PHP_SELF"]); -$path=preg_replace('@[\\\/]+$@','',$path).'/'; +$path=dirname(__FILE__).'/'; // Test if batch mode if (substr($sapi_type, 0, 3) == 'cgi') { diff --git a/dev/translation/autotranslator.php b/dev/translation/autotranslator.php index cde77595a0a..e8fbb0183f7 100644 --- a/dev/translation/autotranslator.php +++ b/dev/translation/autotranslator.php @@ -27,8 +27,7 @@ $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); -$path=str_replace($script_file,'',$_SERVER["PHP_SELF"]); -$path=preg_replace('@[\\\/]+$@','',$path).'/'; +$path=dirname(__FILE__).'/'; // Test if batch mode if (substr($sapi_type, 0, 3) == 'cgi') { diff --git a/scripts/banks/build-graph-sold-example.php b/scripts/banks/build-graph-sold-example.php index 4f9efaea879..635a77f1f5a 100644 --- a/scripts/banks/build-graph-sold-example.php +++ b/scripts/banks/build-graph-sold-example.php @@ -28,8 +28,7 @@ $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); -$path=str_replace($script_file,'',$_SERVER["PHP_SELF"]); -$path=preg_replace('@[\\\/]+$@','',$path).'/'; +$path=dirname(__FILE__).'/'; // Test si mode batch $sapi_type = php_sapi_name(); diff --git a/scripts/company/export-contacts-xls-example.php b/scripts/company/export-contacts-xls-example.php index e9ca406acb1..7684ab2e105 100644 --- a/scripts/company/export-contacts-xls-example.php +++ b/scripts/company/export-contacts-xls-example.php @@ -26,8 +26,7 @@ $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); -$path=str_replace($script_file,'',$_SERVER["PHP_SELF"]); -$path=preg_replace('@[\\\/]+$@','',$path).'/'; +$path=dirname(__FILE__).'/'; // Test if batch mode if (substr($sapi_type, 0, 3) == 'cgi') { diff --git a/scripts/company/sync_contacts_dolibarr2ldap.php b/scripts/company/sync_contacts_dolibarr2ldap.php index 8faa8939d00..d14734ab583 100644 --- a/scripts/company/sync_contacts_dolibarr2ldap.php +++ b/scripts/company/sync_contacts_dolibarr2ldap.php @@ -26,8 +26,7 @@ $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); -$path=str_replace($script_file,'',$_SERVER["PHP_SELF"]); -$path=preg_replace('@[\\\/]+$@','',$path).'/'; +$path=dirname(__FILE__).'/'; // Test if batch mode if (substr($sapi_type, 0, 3) == 'cgi') { diff --git a/scripts/emailings/mailing-send.php b/scripts/emailings/mailing-send.php index d707496e605..777a6e8b41b 100644 --- a/scripts/emailings/mailing-send.php +++ b/scripts/emailings/mailing-send.php @@ -1,7 +1,7 @@ #!/usr/bin/php - * Copyright (C) 2005-2009 Laurent Destailleur + * Copyright (C) 2005-2010 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -26,11 +26,9 @@ * \version $Id$ */ - $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); -$path=str_replace($script_file,'',$_SERVER["PHP_SELF"]); -$path=preg_replace('@[\\\/]+$@','',$path).'/'; +$path=dirname(__FILE__).'/'; // Test if batch mode if (substr($sapi_type, 0, 3) == 'cgi') { diff --git a/scripts/invoices/email_unpaid_invoices_to_representatives.php b/scripts/invoices/email_unpaid_invoices_to_representatives.php index ccb5804a606..1aaf188907d 100644 --- a/scripts/invoices/email_unpaid_invoices_to_representatives.php +++ b/scripts/invoices/email_unpaid_invoices_to_representatives.php @@ -27,8 +27,7 @@ $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); -$path=str_replace($script_file,'',$_SERVER["PHP_SELF"]); -$path=preg_replace('@[\\\/]+$@','',$path).'/'; +$path=dirname(__FILE__).'/'; // Test si mode batch $sapi_type = php_sapi_name(); diff --git a/scripts/invoices/rebuild_merge_pdf.php b/scripts/invoices/rebuild_merge_pdf.php index f4c93a555a9..ed374f50259 100644 --- a/scripts/invoices/rebuild_merge_pdf.php +++ b/scripts/invoices/rebuild_merge_pdf.php @@ -26,8 +26,7 @@ $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); -$path=str_replace($script_file,'',$_SERVER["PHP_SELF"]); -$path=preg_replace('@[\\\/]+$@','',$path).'/'; +$path=dirname(__FILE__).'/'; // Test if batch mode if (substr($sapi_type, 0, 3) == 'cgi') { diff --git a/scripts/members/sync_members_dolibarr2ldap.php b/scripts/members/sync_members_dolibarr2ldap.php index 55d63d89242..55af54adbfc 100644 --- a/scripts/members/sync_members_dolibarr2ldap.php +++ b/scripts/members/sync_members_dolibarr2ldap.php @@ -26,8 +26,7 @@ $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); -$path=str_replace($script_file,'',$_SERVER["PHP_SELF"]); -$path=preg_replace('@[\\\/]+$@','',$path).'/'; +$path=dirname(__FILE__).'/'; // Test if batch mode if (substr($sapi_type, 0, 3) == 'cgi') { diff --git a/scripts/members/sync_members_ldap2dolibarr.php b/scripts/members/sync_members_ldap2dolibarr.php index ec8f9ca807d..89565199a3f 100644 --- a/scripts/members/sync_members_ldap2dolibarr.php +++ b/scripts/members/sync_members_ldap2dolibarr.php @@ -26,8 +26,7 @@ $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); -$path=str_replace($script_file,'',$_SERVER["PHP_SELF"]); -$path=preg_replace('@[\\\/]+$@','',$path).'/'; +$path=dirname(__FILE__).'/'; // Test if batch mode if (substr($sapi_type, 0, 3) == 'cgi') { diff --git a/scripts/user/sync_groups_dolibarr2ldap.php b/scripts/user/sync_groups_dolibarr2ldap.php index 07e5327989e..77a803e9ccc 100644 --- a/scripts/user/sync_groups_dolibarr2ldap.php +++ b/scripts/user/sync_groups_dolibarr2ldap.php @@ -26,8 +26,7 @@ $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); -$path=str_replace($script_file,'',$_SERVER["PHP_SELF"]); -$path=preg_replace('@[\\\/]+$@','',$path).'/'; +$path=dirname(__FILE__).'/'; // Test if batch mode if (substr($sapi_type, 0, 3) == 'cgi') { diff --git a/scripts/user/sync_users_dolibarr2ldap.php b/scripts/user/sync_users_dolibarr2ldap.php index f082f4e49fc..d4aff47f4b1 100644 --- a/scripts/user/sync_users_dolibarr2ldap.php +++ b/scripts/user/sync_users_dolibarr2ldap.php @@ -26,8 +26,7 @@ $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); -$path=str_replace($script_file,'',$_SERVER["PHP_SELF"]); -$path=preg_replace('@[\\\/]+$@','',$path).'/'; +$path=dirname(__FILE__).'/'; // Test if batch mode if (substr($sapi_type, 0, 3) == 'cgi') { diff --git a/scripts/withdrawals/prelevement-verif.php b/scripts/withdrawals/prelevement-verif.php index 4582b28a160..ddea47b012a 100644 --- a/scripts/withdrawals/prelevement-verif.php +++ b/scripts/withdrawals/prelevement-verif.php @@ -26,8 +26,7 @@ $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); -$path=str_replace($script_file,'',$_SERVER["PHP_SELF"]); -$path=preg_replace('@[\\\/]+$@','',$path).'/'; +$path=dirname(__FILE__).'/'; // Test if batch mode if (substr($sapi_type, 0, 3) == 'cgi') { diff --git a/scripts/withdrawals/prelevement.php b/scripts/withdrawals/prelevement.php index b9bbd557c75..59feea0e333 100644 --- a/scripts/withdrawals/prelevement.php +++ b/scripts/withdrawals/prelevement.php @@ -26,8 +26,7 @@ $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); -$path=str_replace($script_file,'',$_SERVER["PHP_SELF"]); -$path=preg_replace('@[\\\/]+$@','',$path).'/'; +$path=dirname(__FILE__).'/'; // Test if batch mode if (substr($sapi_type, 0, 3) == 'cgi') {