45 if (!defined(
'NOSESSION')) define(
'NOSESSION',
'1');
48 $sapi_type = php_sapi_name();
49 $script_file = basename(__FILE__);
53 if (substr($sapi_type, 0, 3) ==
'cgi') {
54 echo
"Error: You are using PHP for CGI. To execute ".$script_file.
" from command line, you must use PHP for CLI mode.\n";
65 define(
'EVEN_IF_ONLY_LOGIN_ALLOWED', 1);
70 $tmp = empty($_SERVER[
'SCRIPT_FILENAME']) ?
'' : $_SERVER[
'SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
71 while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
74 if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)).
"/master.inc.php")) {
75 $res = @include substr($tmp, 0, ($i + 1)).
"/master.inc.php";
77 if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))).
"/master.inc.php")) {
78 $res = @include dirname(substr($tmp, 0, ($i + 1))).
"/master.inc.php";
81 if (!$res && file_exists(
"../master.inc.php")) {
82 $res = @include
"../master.inc.php";
84 if (!$res && file_exists(
"../../master.inc.php")) {
85 $res = @include
"../../master.inc.php";
87 if (!$res && file_exists(
"../../../master.inc.php")) {
88 $res = @include
"../../../master.inc.php";
91 print
"Include of master fails";
101 $result = $user->fetch(
'',
'admin');
102 if (!($result > 0)) {
108 print
"***** ".$script_file.
" (".$version.
") pid=".
dol_getmypid().
" *****\n";
109 if (!isset($argv[1])) {
110 print
"Usage: ".$script_file.
" param1 param2 ...\n";
113 print
'--- start'.
"\n";
114 print
'Argument 1='.$argv[1].
"\n";
115 print
'Argument 2='.$argv[2].
"\n";
203 print
'--- end ok'.
"\n";
205 print
'--- end error code='.$error.
"\n";
dol_getmypid()
Return getmypid() or random PID when function is disabled Some web hosts disable this php function fo...
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...