dolibarr  13.0.2
mymodule.js.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) ---Put here your own copyright and developer email---
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  *
17  * Library javascript to enable Browser notifications
18  */
19 
20 if (!defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1');
21 if (!defined('NOREQUIREDB')) define('NOREQUIREDB', '1');
22 if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
23 if (!defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1');
24 if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', 1);
25 if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1);
26 if (!defined('NOLOGIN')) define('NOLOGIN', 1);
27 if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', 1);
28 if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', 1);
29 if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
30 
31 
38 // Load Dolibarr environment
39 $res = 0;
40 // Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
41 if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
42 // Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
43 $tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
44 while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; }
45 if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
46 if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/../main.inc.php")) $res = @include substr($tmp, 0, ($i + 1))."/../main.inc.php";
47 // Try main.inc.php using relative path
48 if (!$res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php";
49 if (!$res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php";
50 if (!$res) die("Include of main fails");
51 
52 // Define js type
53 header('Content-Type: application/javascript');
54 // Important: Following code is to cache this file to avoid page request by browser at each Dolibarr page access.
55 // You can use CTRL+F5 to refresh your browser cache.
56 if (empty($dolibarr_nocache)) header('Cache-Control: max-age=3600, public, must-revalidate');
57 else header('Cache-Control: no-cache');
58 ?>
59 
60 /* Javascript library of module MyModule */
61 
62 
print $_SERVER["PHP_SELF"]
Edit parameters.