mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Fix: Use preg functions
This commit is contained in:
parent
538736bedb
commit
f3a1978b9a
|
|
@ -24,14 +24,14 @@
|
|||
* \remarks Put here some comments
|
||||
*/
|
||||
|
||||
// Test if batch mode
|
||||
$sapi_type = php_sapi_name();
|
||||
$script_file = __FILE__;
|
||||
if (preg_match('/([^\\/]+)$/i',$script_file,$reg)) $script_file = '/'.$reg[1].'/i';
|
||||
$path=preg_replace($script_file,'',$_SERVER["PHP_SELF"]);
|
||||
$script_file = basename(__FILE__);
|
||||
$path=str_replace($script_file,'',$_SERVER["PHP_SELF"]);
|
||||
$path=preg_replace('@[\\\/]+$@','',$path).'/';
|
||||
|
||||
// Test if batch mode
|
||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
echo "Error: You are using PHP for CGI/Web. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
|
||||
echo "Error: You ar usingr PH for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,14 +24,14 @@
|
|||
* \remarks Put here some comments
|
||||
*/
|
||||
|
||||
// Test if batch mode
|
||||
$sapi_type = php_sapi_name();
|
||||
$script_file = __FILE__;
|
||||
if (preg_match('/([^\\/]+)$/i',$script_file,$reg)) $script_file = '/'.$reg[1].'/i';
|
||||
$path=preg_replace($script_file,'',$_SERVER["PHP_SELF"]);
|
||||
$script_file = basename(__FILE__);
|
||||
$path=str_replace($script_file,'',$_SERVER["PHP_SELF"]);
|
||||
$path=preg_replace('@[\\\/]+$@','',$path).'/';
|
||||
|
||||
// Test if batch mode
|
||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
echo "Error: You are using PHP for CGI/Web. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
|
||||
echo "Error: You ar usingr PH for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,16 +23,15 @@
|
|||
* \version $Id$
|
||||
*/
|
||||
|
||||
// Test if batch mode
|
||||
$sapi_type = php_sapi_name();
|
||||
$script_file=__FILE__;
|
||||
if (preg_match('/([^\\/]+)$/i',$script_file,$reg)) $script_file = '/'.$reg[1].'/i';
|
||||
$path=preg_replace($script_file,'',$_SERVER["PHP_SELF"]);
|
||||
$script_file = basename(__FILE__);
|
||||
$path=str_replace($script_file,'',$_SERVER["PHP_SELF"]);
|
||||
$path=preg_replace('@[\\\/]+$@','',$path).'/';
|
||||
|
||||
if (substr($sapi_type, 0, 3) == 'cgi')
|
||||
{
|
||||
echo "Error: You use PHP for CGI mode. To execute $script_file as a command line program, you must use PHP for CLI mode (try php-cli).\n";
|
||||
exit;
|
||||
// Test if batch mode
|
||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
echo "Error: You ar usingr PH for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
// Include Dolibarr environment
|
||||
|
|
|
|||
|
|
@ -23,16 +23,15 @@
|
|||
* \version $Id$
|
||||
*/
|
||||
|
||||
// Test if batch mode
|
||||
$sapi_type = php_sapi_name();
|
||||
$script_file=__FILE__;
|
||||
if (preg_match('/([^\\/]+)$/i',$script_file,$reg)) $script_file = '/'.$reg[1].'/i';
|
||||
$path=preg_replace($script_file,'',$_SERVER["PHP_SELF"]);
|
||||
$script_file = basename(__FILE__);
|
||||
$path=str_replace($script_file,'',$_SERVER["PHP_SELF"]);
|
||||
$path=preg_replace('@[\\\/]+$@','',$path).'/';
|
||||
|
||||
if (substr($sapi_type, 0, 3) == 'cgi')
|
||||
{
|
||||
echo "Error: You use PHP for CGI mode. To execute $script_file as a command line program, you must use PHP for CLI mode (try php-cli).\n";
|
||||
exit;
|
||||
// Test if batch mode
|
||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
echo "Error: You ar usingr PH for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
// Include Dolibarr environment
|
||||
|
|
|
|||
|
|
@ -26,14 +26,14 @@
|
|||
* \remarks Put here some comments
|
||||
*/
|
||||
|
||||
// Test if batch mode and define path of script
|
||||
$sapi_type = php_sapi_name();
|
||||
$script_file=__FILE__;
|
||||
if (preg_match('/([^\\/]+)$/i',$script_file,$reg)) $script_file = '/'.$reg[1].'/i';
|
||||
$path=preg_replace($script_file,'',$_SERVER["PHP_SELF"]);
|
||||
$script_file = basename(__FILE__);
|
||||
$path=str_replace($script_file,'',$_SERVER["PHP_SELF"]);
|
||||
$path=preg_replace('@[\\\/]+$@','',$path).'/';
|
||||
|
||||
// Test if batch mode
|
||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
echo "Error: You are using PHP for CGI/Web. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
|
||||
echo "Error: You ar usingr PH for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,12 +25,12 @@
|
|||
* \remarks Put here some comments
|
||||
*/
|
||||
|
||||
// Test if batch mode
|
||||
$sapi_type = php_sapi_name();
|
||||
$script_file=__FILE__;
|
||||
if (preg_match('/([^\\/]+)$/i',$script_file,$reg)) $script_file = '/'.$reg[1].'/i';
|
||||
$path=preg_replace($script_file,'',$_SERVER["PHP_SELF"]);
|
||||
$script_file = basename(__FILE__);
|
||||
$path=str_replace($script_file,'',$_SERVER["PHP_SELF"]);
|
||||
$path=preg_replace('@[\\\/]+$@','',$path).'/';
|
||||
|
||||
// Test if batch mode
|
||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
echo "Error: You ar usingr PH for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
|
||||
exit;
|
||||
|
|
|
|||
|
|
@ -24,13 +24,14 @@
|
|||
* \version $Id$
|
||||
*/
|
||||
|
||||
// Test si mode CLI
|
||||
$sapi_type = php_sapi_name();
|
||||
$script_file=__FILE__;
|
||||
if (preg_match('/([^\\/]+)$/i',$script_file,$reg)) $script_file=$reg[1];
|
||||
$script_file = basename(__FILE__);
|
||||
$path=str_replace($script_file,'',$_SERVER["PHP_SELF"]);
|
||||
$path=preg_replace('@[\\\/]+$@','',$path).'/';
|
||||
|
||||
// Test if batch mode
|
||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
echo "Erreur: Vous utilisez l'interpreteur PHP pour le mode CGI. Pour executer $script_file en ligne de commande, vous devez utiliser l'interpreteur PHP pour le mode CLI.\n";
|
||||
echo "Error: You ar usingr PH for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
|
@ -42,7 +43,6 @@ $now=$argv[1];
|
|||
|
||||
// Recupere env dolibarr
|
||||
$version='$Revision$';
|
||||
$path=str_replace($script_file,'',$_SERVER["PHP_SELF"]);
|
||||
|
||||
require_once($path."../../htdocs/master.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/contact.class.php");
|
||||
|
|
|
|||
|
|
@ -27,11 +27,15 @@
|
|||
*/
|
||||
|
||||
|
||||
// Test if CLI mode
|
||||
$sapi_type = php_sapi_name();
|
||||
$script_file = basename(__FILE__);
|
||||
$path=str_replace($script_file,'',$_SERVER["PHP_SELF"]);
|
||||
$path=preg_replace('@[\\\/]+$@','',$path).'/';
|
||||
|
||||
// Test if batch mode
|
||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
echo "Error: You are using PH for CGI/Web. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
|
||||
exit;
|
||||
echo "Error: You ar usingr PH for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
if (! isset($argv[1]) || ! $argv[1]) {
|
||||
|
|
@ -40,10 +44,6 @@ if (! isset($argv[1]) || ! $argv[1]) {
|
|||
}
|
||||
$id=$argv[1];
|
||||
|
||||
// Recupere root dolibarr
|
||||
$path=str_replace('mailing-send.php','',$_SERVER["PHP_SELF"]);
|
||||
|
||||
|
||||
require_once ($path."../../htdocs/master.inc.php");
|
||||
require_once (DOL_DOCUMENT_ROOT."/lib/CMailFile.class.php");
|
||||
|
||||
|
|
|
|||
|
|
@ -24,14 +24,14 @@
|
|||
* \version $Id$
|
||||
*/
|
||||
|
||||
// Test if batch mode
|
||||
$sapi_type = php_sapi_name();
|
||||
$script_file=__FILE__;
|
||||
if (preg_match('/([^\\/]+)$/i',$script_file,$reg)) $script_file=$reg[1];
|
||||
$script_file = basename(__FILE__);
|
||||
$path=str_replace($script_file,'',$_SERVER["PHP_SELF"]);
|
||||
$path=preg_replace('@[\\\/]+$@','',$path).'/';
|
||||
|
||||
// Test if batch mode
|
||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
echo "Error: You are using PH for CGI/Web. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
|
||||
echo "Error: You ar usingr PH for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,13 +24,14 @@
|
|||
* \version $Id$
|
||||
*/
|
||||
|
||||
// Test si mode batch
|
||||
$sapi_type = php_sapi_name();
|
||||
$script_file=__FILE__;
|
||||
if (preg_match('/([^\\/]+)$/i',$script_file,$reg)) $script_file=$reg[1];
|
||||
$script_file = basename(__FILE__);
|
||||
$path=str_replace($script_file,'',$_SERVER["PHP_SELF"]);
|
||||
$path=preg_replace('@[\\\/]+$@','',$path).'/';
|
||||
|
||||
// Test if batch mode
|
||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
echo "Erreur: Vous utilisez l'interpreteur PHP pour le mode CGI. Pour executer $script_file en ligne de commande, vous devez utiliser l'interpreteur PHP pour le mode CLI.\n";
|
||||
echo "Error: You ar usingr PH for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,19 +24,19 @@
|
|||
* \version $Id$
|
||||
*/
|
||||
|
||||
// Test si mode batch
|
||||
$sapi_type = php_sapi_name();
|
||||
$script_file=__FILE__;
|
||||
if (preg_match('/([^\\/]+)$/i',$script_file,$reg)) $script_file=$reg[1];
|
||||
$script_file = basename(__FILE__);
|
||||
$path=str_replace($script_file,'',$_SERVER["PHP_SELF"]);
|
||||
$path=preg_replace('@[\\\/]+$@','',$path).'/';
|
||||
|
||||
// Test if batch mode
|
||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
echo "Erreur: Vous utilisez l'interpreteur PHP pour le mode CGI. Pour executer $script_file en ligne de commande, vous devez utiliser l'interpreteur PHP pour le mode CLI.\n";
|
||||
echo "Error: You ar usingr PH for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
// Main
|
||||
$version='$Revision$';
|
||||
$path=str_replace($script_file,'',$_SERVER["PHP_SELF"]);
|
||||
@set_time_limit(0);
|
||||
$error=0;
|
||||
$forcecommit=0;
|
||||
|
|
|
|||
|
|
@ -24,13 +24,14 @@
|
|||
* \version $Id$
|
||||
*/
|
||||
|
||||
// Test si mode batch
|
||||
$sapi_type = php_sapi_name();
|
||||
$script_file=__FILE__;
|
||||
if (preg_match('/([^\\/]+)$/i',$script_file,$reg)) $script_file=$reg[1];
|
||||
$script_file = basename(__FILE__);
|
||||
$path=str_replace($script_file,'',$_SERVER["PHP_SELF"]);
|
||||
$path=preg_replace('@[\\\/]+$@','',$path).'/';
|
||||
|
||||
// Test if batch mode
|
||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
echo "Erreur: Vous utilisez l'interpreteur PHP pour le mode CGI. Pour executer $script_file en ligne de commande, vous devez utiliser l'interpreteur PHP pour le mode CLI.\n";
|
||||
echo "Error: You ar usingr PH for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
|
@ -42,7 +43,6 @@ $now=$argv[1];
|
|||
|
||||
// Recupere env dolibarr
|
||||
$version='$Revision$';
|
||||
$path=str_replace($script_file,'',$_SERVER["PHP_SELF"]);
|
||||
|
||||
require_once($path."../../htdocs/master.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/ldap.class.php");
|
||||
|
|
|
|||
|
|
@ -24,13 +24,14 @@
|
|||
* \version $Id$
|
||||
*/
|
||||
|
||||
// Test si mode batch
|
||||
$sapi_type = php_sapi_name();
|
||||
$script_file=__FILE__;
|
||||
if (preg_match('/([^\\/]+)$/i',$script_file,$reg)) $script_file=$reg[1];
|
||||
$script_file = basename(__FILE__);
|
||||
$path=str_replace($script_file,'',$_SERVER["PHP_SELF"]);
|
||||
$path=preg_replace('@[\\\/]+$@','',$path).'/';
|
||||
|
||||
// Test if batch mode
|
||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
echo "Erreur: Vous utilisez l'interpreteur PHP pour le mode CGI. Pour executer $script_file en ligne de commande, vous devez utiliser l'interpreteur PHP pour le mode CLI.\n";
|
||||
echo "Error: You ar usingr PH for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
|
@ -42,7 +43,6 @@ $now=$argv[1];
|
|||
|
||||
// Recupere env dolibarr
|
||||
$version='$Revision$';
|
||||
$path=str_replace($script_file,'',$_SERVER["PHP_SELF"]);
|
||||
|
||||
require_once($path."../../htdocs/master.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/ldap.class.php");
|
||||
|
|
|
|||
|
|
@ -24,19 +24,19 @@
|
|||
* \version $Id$
|
||||
*/
|
||||
|
||||
// Test si mode CLI
|
||||
$sapi_type = php_sapi_name();
|
||||
$script_file=__FILE__;
|
||||
if (preg_match('/([^\\/]+)$/i',$script_file,$reg)) $script_file=$reg[1];
|
||||
$script_file = basename(__FILE__);
|
||||
$path=str_replace($script_file,'',$_SERVER["PHP_SELF"]);
|
||||
$path=preg_replace('@[\\\/]+$@','',$path).'/';
|
||||
|
||||
// Test if batch mode
|
||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
echo "Erreur: Vous utilisez l'interpreteur PHP pour le mode CGI. Pour executer $script_file en ligne de commande, vous devez utiliser l'interpreteur PHP pour le mode CLI.\n";
|
||||
exit;
|
||||
echo "Error: You ar usingr PH for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
// Recupere env dolibarr
|
||||
$version='$Revision$';
|
||||
$path=str_replace($script_file,'',$_SERVER["PHP_SELF"]);
|
||||
|
||||
require_once($path."../../htdocs/master.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/facture.class.php");
|
||||
|
|
|
|||
|
|
@ -24,19 +24,19 @@
|
|||
* \version $Id$
|
||||
*/
|
||||
|
||||
// Test si mode CLI
|
||||
$sapi_type = php_sapi_name();
|
||||
$script_file=__FILE__;
|
||||
if (preg_match('/([^\\/]+)$/i',$script_file,$reg)) $script_file=$reg[1];
|
||||
$script_file = basename(__FILE__);
|
||||
$path=str_replace($script_file,'',$_SERVER["PHP_SELF"]);
|
||||
$path=preg_replace('@[\\\/]+$@','',$path).'/';
|
||||
|
||||
// Test if batch mode
|
||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
echo "Erreur: Vous utilisez l'interpreteur PHP pour le mode CGI. Pour executer $script_file en ligne de commande, vous devez utiliser l'interpreteur PHP pour le mode CLI.\n";
|
||||
exit;
|
||||
echo "Error: You ar usingr PH for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
// Recupere env dolibarr
|
||||
$version='$Revision$';
|
||||
$path=str_replace($script_file,'',$_SERVER["PHP_SELF"]);
|
||||
|
||||
require_once($path."../../htdocs/master.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/compta/prelevement/bon-prelevement.class.php");
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user