diff --git a/admin/index.php b/admin/index.php
new file mode 100644
index 0000000..cd6990e
--- /dev/null
+++ b/admin/index.php
@@ -0,0 +1,2 @@
+ 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';
-}
-// 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');
+// Load Priseo environment
+if (file_exists('../priseo.main.inc.php')) {
+ require_once __DIR__ . '/../priseo.main.inc.php';
+} elseif (file_exists('../../priseo.main.inc.php')) {
+ require_once __DIR__ . '/../../priseo.main.inc.php';
+} else {
+ die('Include of priseo main fails');
}
// Libraries
require_once DOL_DOCUMENT_ROOT. '/core/lib/admin.lib.php';
+//Load Priseo libraries
require_once __DIR__ . '/../lib/priseo.lib.php';
// Global variables definitions
global $db, $langs, $user;
-// Translations
-$langs->loadLangs(['admin', 'priseo@priseo']);
+// Load translation files required by the page
+saturne_load_langs();
// Parameters
$backtopage = GETPOST('backtopage', 'alpha');
-// Access control
-$permissiontoread = $user->rights->priseo->adminpage->read;
-if (empty($conf->priseo->enabled) || !$permissiontoread) {
- accessforbidden();
-}
+// Security check - Protection if external user
+$permissionToRead = $user->rights->priseo->adminpage->read;
+saturne_check_access($permissionToRead);
+
/*
* View
*/
-$help_url = 'FR:Module_Priseo';
-$title = $langs->trans('PriseoSetup');
+$title = $langs->trans('ModuleSetup', 'Priseo');
+$helpUrl = 'FR:Module_Priseo';
-llxHeader('', $title, $help_url);
+saturne_header(0,'', $title, $helpUrl);
// Subheader
$linkback = ''.$langs->trans('BackToModuleList').'';
diff --git a/class/index.php b/class/index.php
new file mode 100644
index 0000000..cd6990e
--- /dev/null
+++ b/class/index.php
@@ -0,0 +1,2 @@
+db = $db;
- $langs->load('priseo@priseo');
+ if (file_exists(__DIR__ . '/../../../saturne/lib/saturne_functions.lib.php')) {
+ require_once __DIR__ . '/../../../saturne/lib/saturne_functions.lib.php';
+ saturne_load_langs(['priseo@priseo']);
+ } else {
+ $this->error++;
+ $this->errors[] = $langs->trans('activateModuleDependNotSatisfied', 'Priseo', 'Saturne');
+ }
// ID for module (must be unique).
// Use here a free id (See in Home -> System information -> Dolibarr for list of used module id).
diff --git a/core/modules/priseo/index.php b/core/modules/priseo/index.php
new file mode 100644
index 0000000..cd6990e
--- /dev/null
+++ b/core/modules/priseo/index.php
@@ -0,0 +1,2 @@
+load('priseo@priseo');
+ saturne_load_langs();
// Initialize values
$h = 0;
diff --git a/priseo.main.inc.php b/priseo.main.inc.php
new file mode 100644
index 0000000..47cf057
--- /dev/null
+++ b/priseo.main.inc.php
@@ -0,0 +1,35 @@
+
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+/**
+ * \file priseo.main.inc.php
+ * \ingroup priseo
+ * \brief File that defines environment for Saturne common functions
+ */
+
+$moduleName = 'Priseo';
+$moduleNameLowerCase = strtolower($moduleName);
+$moduleNameUpperCase = strtoupper($moduleName);
+
+// Load Saturne environment
+if (file_exists(__DIR__ . '/../saturne/saturne.main.inc.php')) {
+ require_once __DIR__ . '/../saturne/saturne.main.inc.php';
+} elseif (file_exists(__DIR__ . '/../../saturne/saturne.main.inc.php')) {
+ require_once __DIR__ . '/../../saturne/saturne.main.inc.php';
+} else {
+ die('Include of saturne main fails');
+}
diff --git a/view/competitorprice_card.php b/view/competitorprice_card.php
index 478ad8b..cd93f8e 100644
--- a/view/competitorprice_card.php
+++ b/view/competitorprice_card.php
@@ -22,39 +22,13 @@
* \brief Page to create/edit/view competitorprice
*/
-// 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 calculated 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(dirname(substr($tmp, 0, ($i + 1))) . '/main.inc.php')) {
- $res = @include dirname(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) {
- die('Include of main fails');
+// Load Priseo environment
+if (file_exists('../priseo.main.inc.php')) {
+ require_once __DIR__ . '/../priseo.main.inc.php';
+} elseif (file_exists('../../priseo.main.inc.php')) {
+ require_once __DIR__ . '/../../priseo.main.inc.php';
+} else {
+ die('Include of priseo main fails');
}
// Libraries
diff --git a/view/index.php b/view/index.php
new file mode 100644
index 0000000..cd6990e
--- /dev/null
+++ b/view/index.php
@@ -0,0 +1,2 @@
+