44 lines
1.7 KiB
PHP
44 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace Module\ACM\Admin;
|
|
|
|
|
|
// Load Dolibarr environment
|
|
$res = 0;
|
|
global $db, $hookmanager, $conf;
|
|
if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) { $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";}
|
|
$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(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {$res = @include dirname(substr($tmp, 0, ($i + 1)))."/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");}
|
|
|
|
global $langs, $user;
|
|
|
|
|
|
// Translations
|
|
$langs->loadLangs(array("admin", "ACM@ACM"));
|
|
|
|
|
|
$csrfToken = function_exists('newToken') ? newToken() : $_SESSION['newtoken'];
|
|
|
|
$data = array(
|
|
'controleur' => 'admin',
|
|
'action' => 'afficherSetup',
|
|
'page' => 'etup',
|
|
'token' => "$csrfToken"
|
|
);
|
|
|
|
// URL where you want to POST data
|
|
$redirect_url = '../index.php';
|
|
echo '<html><body>';
|
|
echo '<form id="redirectForm" action="' . $redirect_url . '" method="POST">';
|
|
foreach ($data as $key => $value) {echo '<input type="hidden" name="' . $key . '" value="' . htmlspecialchars($value) . '">';}
|
|
echo '</form>';
|
|
echo '<script type="text/javascript">document.getElementById("redirectForm").submit();</script>';
|
|
echo '</body></html>';
|
|
|
|
$db->close();
|
|
?>
|