Better templates
This commit is contained in:
parent
693b2fe3b4
commit
247803f894
@ -23,9 +23,18 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Load Dolibarr environment
|
// Load Dolibarr environment
|
||||||
if (false === (@include '../../main.inc.php')) { // From htdocs directory
|
$res=0;
|
||||||
require '../../../main.inc.php'; // From "custom" directory
|
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
|
||||||
}
|
if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include($_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php");
|
||||||
|
// Try main.inc.php into web root detected using web root caluclated from SCRIPT_FILENAME
|
||||||
|
$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1;
|
||||||
|
while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; }
|
||||||
|
if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include(substr($tmp, 0, ($i+1))."/main.inc.php");
|
||||||
|
if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/../main.inc.php")) $res=@include(substr($tmp, 0, ($i+1))."/../main.inc.php");
|
||||||
|
// Try main.inc.php using relative path
|
||||||
|
if (! $res && file_exists("../../main.inc.php")) $res=@include("../../main.inc.php");
|
||||||
|
if (! $res && file_exists("../../../main.inc.php")) $res=@include("../../../main.inc.php");
|
||||||
|
if (! $res) die("Include of main fails");
|
||||||
|
|
||||||
// Libraries
|
// Libraries
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||||
|
|||||||
@ -23,9 +23,19 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Load Dolibarr environment
|
// Load Dolibarr environment
|
||||||
if (false === (@include '../../main.inc.php')) { // From htdocs directory
|
$res=0;
|
||||||
require '../../../main.inc.php'; // From "custom" directory
|
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
|
||||||
}
|
if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include($_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php");
|
||||||
|
// Try main.inc.php into web root detected using web root caluclated from SCRIPT_FILENAME
|
||||||
|
$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1;
|
||||||
|
while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; }
|
||||||
|
if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include(substr($tmp, 0, ($i+1))."/main.inc.php");
|
||||||
|
if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/../main.inc.php")) $res=@include(substr($tmp, 0, ($i+1))."/../main.inc.php");
|
||||||
|
// Try main.inc.php using relative path
|
||||||
|
if (! $res && file_exists("../../main.inc.php")) $res=@include("../../main.inc.php");
|
||||||
|
if (! $res && file_exists("../../../main.inc.php")) $res=@include("../../../main.inc.php");
|
||||||
|
if (! $res) die("Include of main fails");
|
||||||
|
|
||||||
|
|
||||||
global $langs, $user;
|
global $langs, $user;
|
||||||
|
|
||||||
|
|||||||
@ -33,15 +33,24 @@ if (! defined('NOLOGIN')) define('NOLOGIN',1); // File must be
|
|||||||
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1);
|
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1);
|
||||||
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
|
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
|
||||||
|
|
||||||
|
// Load Dolibarr environment
|
||||||
session_cache_limiter(FALSE);
|
|
||||||
|
|
||||||
$res=0;
|
$res=0;
|
||||||
|
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
|
||||||
if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include($_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php");
|
if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include($_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php");
|
||||||
|
// Try main.inc.php into web root detected using web root caluclated from SCRIPT_FILENAME
|
||||||
|
$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1;
|
||||||
|
while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; }
|
||||||
|
if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include(substr($tmp, 0, ($i+1))."/main.inc.php");
|
||||||
|
if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/../main.inc.php")) $res=@include(substr($tmp, 0, ($i+1))."/../main.inc.php");
|
||||||
|
// Try main.inc.php using relative path
|
||||||
if (! $res && file_exists("../../main.inc.php")) $res=@include("../../main.inc.php");
|
if (! $res && file_exists("../../main.inc.php")) $res=@include("../../main.inc.php");
|
||||||
if (! $res && file_exists("../../../main.inc.php")) $res=@include("../../../main.inc.php");
|
if (! $res && file_exists("../../../main.inc.php")) $res=@include("../../../main.inc.php");
|
||||||
|
if (! $res) die("Include of main fails");
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||||
|
|
||||||
|
session_cache_limiter(FALSE);
|
||||||
|
|
||||||
// Load user to have $user->conf loaded (not done into main because of NOLOGIN constant defined) and load permission if we need to use them in CSS
|
// Load user to have $user->conf loaded (not done into main because of NOLOGIN constant defined) and load permission if we need to use them in CSS
|
||||||
/*if (empty($user->id) && ! empty($_SESSION['dol_login']))
|
/*if (empty($user->id) && ! empty($_SESSION['dol_login']))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -22,4 +22,24 @@
|
|||||||
* \brief JavaScript file for module MyModule.
|
* \brief JavaScript file for module MyModule.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// Load Dolibarr environment
|
||||||
|
$res=0;
|
||||||
|
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
|
||||||
|
if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include($_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php");
|
||||||
|
// Try main.inc.php into web root detected using web root caluclated from SCRIPT_FILENAME
|
||||||
|
$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1;
|
||||||
|
while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; }
|
||||||
|
if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include(substr($tmp, 0, ($i+1))."/main.inc.php");
|
||||||
|
if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/../main.inc.php")) $res=@include(substr($tmp, 0, ($i+1))."/../main.inc.php");
|
||||||
|
// Try main.inc.php using relative path
|
||||||
|
if (! $res && file_exists("../../main.inc.php")) $res=@include("../../main.inc.php");
|
||||||
|
if (! $res && file_exists("../../../main.inc.php")) $res=@include("../../../main.inc.php");
|
||||||
|
if (! $res) die("Include of main fails");
|
||||||
|
|
||||||
|
// Define js type
|
||||||
header('Content-Type: application/javascript');
|
header('Content-Type: application/javascript');
|
||||||
|
// Important: Following code is to cache this file to avoid page request by browser at each Dolibarr page access.
|
||||||
|
// You can use CTRL+F5 to refresh your browser cache.
|
||||||
|
if (empty($dolibarr_nocache)) header('Cache-Control: max-age=3600, public, must-revalidate');
|
||||||
|
else header('Cache-Control: no-cache');
|
||||||
|
|
||||||
|
|||||||
@ -35,20 +35,25 @@
|
|||||||
//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
|
//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
|
||||||
//if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session)
|
//if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session)
|
||||||
|
|
||||||
// Change this following line to use the correct relative path (../, ../../, etc)
|
// Load Dolibarr environment
|
||||||
$res=0;
|
$res=0;
|
||||||
if (! $res && file_exists("../main.inc.php")) $res=@include '../main.inc.php'; // to work if your module directory is into dolibarr root htdocs directory
|
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
|
||||||
if (! $res && file_exists("../../main.inc.php")) $res=@include '../../main.inc.php'; // to work if your module directory is into a subdir of root htdocs directory
|
if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include($_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php");
|
||||||
if (! $res && file_exists("../../../dolibarr/htdocs/main.inc.php")) $res=@include '../../../dolibarr/htdocs/main.inc.php'; // Used on dev env only
|
// Try main.inc.php into web root detected using web root caluclated from SCRIPT_FILENAME
|
||||||
if (! $res && file_exists("../../../../dolibarr/htdocs/main.inc.php")) $res=@include '../../../../dolibarr/htdocs/main.inc.php'; // Used on dev env only
|
$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1;
|
||||||
|
while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; }
|
||||||
|
if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include(substr($tmp, 0, ($i+1))."/main.inc.php");
|
||||||
|
if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/../main.inc.php")) $res=@include(substr($tmp, 0, ($i+1))."/../main.inc.php");
|
||||||
|
// Try main.inc.php using relative path
|
||||||
|
if (! $res && file_exists("../../main.inc.php")) $res=@include("../../main.inc.php");
|
||||||
|
if (! $res && file_exists("../../../main.inc.php")) $res=@include("../../../main.inc.php");
|
||||||
if (! $res) die("Include of main fails");
|
if (! $res) die("Include of main fails");
|
||||||
// Change this following line to use the correct relative path from htdocs
|
|
||||||
include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php');
|
include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php');
|
||||||
dol_include_once('/mymodule/class/myobject.class.php');
|
dol_include_once('/mymodule/class/myobject.class.php');
|
||||||
|
|
||||||
// Load traductions files requiredby by page
|
// Load traductions files requiredby by page
|
||||||
$langs->load("mymodule");
|
$langs->loadLangs(array("mymodule","other"));
|
||||||
$langs->load("other");
|
|
||||||
|
|
||||||
// Get parameters
|
// Get parameters
|
||||||
$id = GETPOST('id','int');
|
$id = GETPOST('id','int');
|
||||||
|
|||||||
@ -35,14 +35,20 @@
|
|||||||
//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
|
//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
|
||||||
//if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session)
|
//if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session)
|
||||||
|
|
||||||
// Change this following lines to use the correct relative path (../, ../../, etc)
|
// Load Dolibarr environment
|
||||||
$res=0;
|
$res=0;
|
||||||
if (! $res && file_exists("../main.inc.php")) $res=@include '../main.inc.php'; // to work if your module directory is into dolibarr root htdocs directory
|
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
|
||||||
if (! $res && file_exists("../../main.inc.php")) $res=@include '../../main.inc.php'; // to work if your module directory is into a subdir of root htdocs directory
|
if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include($_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php");
|
||||||
if (! $res && file_exists("../../../dolibarr/htdocs/main.inc.php")) $res=@include '../../../dolibarr/htdocs/main.inc.php'; // Used on dev env only
|
// Try main.inc.php into web root detected using web root caluclated from SCRIPT_FILENAME
|
||||||
if (! $res && file_exists("../../../../dolibarr/htdocs/main.inc.php")) $res=@include '../../../../dolibarr/htdocs/main.inc.php'; // Used on dev env only
|
$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1;
|
||||||
|
while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; }
|
||||||
|
if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include(substr($tmp, 0, ($i+1))."/main.inc.php");
|
||||||
|
if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/../main.inc.php")) $res=@include(substr($tmp, 0, ($i+1))."/../main.inc.php");
|
||||||
|
// Try main.inc.php using relative path
|
||||||
|
if (! $res && file_exists("../../main.inc.php")) $res=@include("../../main.inc.php");
|
||||||
|
if (! $res && file_exists("../../../main.inc.php")) $res=@include("../../../main.inc.php");
|
||||||
if (! $res) die("Include of main fails");
|
if (! $res) die("Include of main fails");
|
||||||
// Change this following line to use the correct relative path from htdocs
|
|
||||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php');
|
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php');
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||||
@ -51,11 +57,11 @@ dol_include_once('/mymodule/class/myobject.class.php');
|
|||||||
// Load traductions files requiredby by page
|
// Load traductions files requiredby by page
|
||||||
$langs->loadLangs(array("mymodule","other"));
|
$langs->loadLangs(array("mymodule","other"));
|
||||||
|
|
||||||
$action=GETPOST('action','alpha');
|
$action = GETPOST('action','alpha');
|
||||||
$massaction=GETPOST('massaction','alpha');
|
$massaction = GETPOST('massaction','alpha');
|
||||||
$show_files=GETPOST('show_files','int');
|
$show_files = GETPOST('show_files','int');
|
||||||
$confirm=GETPOST('confirm','alpha');
|
$confirm = GETPOST('confirm','alpha');
|
||||||
$toselect = GETPOST('toselect', 'array');
|
$toselect = GETPOST('toselect', 'array');
|
||||||
|
|
||||||
$id = GETPOST('id','int');
|
$id = GETPOST('id','int');
|
||||||
$backtopage = GETPOST('backtopage');
|
$backtopage = GETPOST('backtopage');
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user