@@ -92,10 +92,18 @@ |
||
92 | 92 | global $langs; |
93 | 93 | $langs->load("admin"); |
94 | 94 | |
95 | - if ($this->version == 'development') return $langs->trans("VersionDevelopment"); |
|
96 | - if ($this->version == 'experimental') return $langs->trans("VersionExperimental"); |
|
97 | - if ($this->version == 'dolibarr') return DOL_VERSION; |
|
98 | - if ($this->version) return $this->version; |
|
95 | + if ($this->version == 'development') { |
|
96 | + return $langs->trans("VersionDevelopment"); |
|
97 | + } |
|
98 | + if ($this->version == 'experimental') { |
|
99 | + return $langs->trans("VersionExperimental"); |
|
100 | + } |
|
101 | + if ($this->version == 'dolibarr') { |
|
102 | + return DOL_VERSION; |
|
103 | + } |
|
104 | + if ($this->version) { |
|
105 | + return $this->version; |
|
106 | + } |
|
99 | 107 | return $langs->trans("NotAvailable"); |
100 | 108 | } |
101 | 109 | } |
@@ -19,8 +19,9 @@ |
||
19 | 19 | require '../../main.inc.php'; |
20 | 20 | |
21 | 21 | // Security check |
22 | -if (!$user->admin && $user->socid > 0) |
|
22 | +if (!$user->admin && $user->socid > 0) { |
|
23 | 23 | accessforbidden(); |
24 | +} |
|
24 | 25 | |
25 | 26 | |
26 | 27 | /* |
@@ -92,10 +92,18 @@ |
||
92 | 92 | global $langs; |
93 | 93 | $langs->load("admin"); |
94 | 94 | |
95 | - if ($this->version == 'development') return $langs->trans("VersionDevelopment"); |
|
96 | - if ($this->version == 'experimental') return $langs->trans("VersionExperimental"); |
|
97 | - if ($this->version == 'dolibarr') return DOL_VERSION; |
|
98 | - if ($this->version) return $this->version; |
|
95 | + if ($this->version == 'development') { |
|
96 | + return $langs->trans("VersionDevelopment"); |
|
97 | + } |
|
98 | + if ($this->version == 'experimental') { |
|
99 | + return $langs->trans("VersionExperimental"); |
|
100 | + } |
|
101 | + if ($this->version == 'dolibarr') { |
|
102 | + return DOL_VERSION; |
|
103 | + } |
|
104 | + if ($this->version) { |
|
105 | + return $this->version; |
|
106 | + } |
|
99 | 107 | return $langs->trans("NotAvailable"); |
100 | 108 | } |
101 | 109 | } |
@@ -25,17 +25,31 @@ discard block |
||
25 | 25 | // Load Dolibarr environment |
26 | 26 | $res = 0; |
27 | 27 | // Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) |
28 | -if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; |
|
28 | +if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) { |
|
29 | + $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; |
|
30 | +} |
|
29 | 31 | // Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME |
30 | 32 | $tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; |
31 | 33 | while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; } |
32 | -if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php"; |
|
33 | -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"; |
|
34 | +if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) { |
|
35 | + $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php"; |
|
36 | +} |
|
37 | +if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) { |
|
38 | + $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php"; |
|
39 | +} |
|
34 | 40 | // Try main.inc.php using relative path |
35 | -if (!$res && file_exists("../main.inc.php")) $res = @include "../main.inc.php"; |
|
36 | -if (!$res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php"; |
|
37 | -if (!$res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php"; |
|
38 | -if (!$res) die("Include of main fails"); |
|
41 | +if (!$res && file_exists("../main.inc.php")) { |
|
42 | + $res = @include "../main.inc.php"; |
|
43 | +} |
|
44 | +if (!$res && file_exists("../../main.inc.php")) { |
|
45 | + $res = @include "../../main.inc.php"; |
|
46 | +} |
|
47 | +if (!$res && file_exists("../../../main.inc.php")) { |
|
48 | + $res = @include "../../../main.inc.php"; |
|
49 | +} |
|
50 | +if (!$res) { |
|
51 | + die("Include of main fails"); |
|
52 | +} |
|
39 | 53 | |
40 | 54 | dol_include_once('/mymodule/class/myobject.class.php'); |
41 | 55 | dol_include_once('/mymodule/lib/mymodule_myobject.lib.php'); |
@@ -65,7 +79,9 @@ discard block |
||
65 | 79 | |
66 | 80 | // Load object |
67 | 81 | include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals |
68 | -if ($id > 0 || !empty($ref)) $upload_dir = $conf->mymodule->multidir_output[$object->entity]."/".$object->id; |
|
82 | +if ($id > 0 || !empty($ref)) { |
|
83 | + $upload_dir = $conf->mymodule->multidir_output[$object->entity]."/".$object->id; |
|
84 | +} |
|
69 | 85 | |
70 | 86 | $permissionnote = $user->rights->mymodule->myobject->write; // Used by the include of actions_setnotes.inc.php |
71 | 87 | $permissiontoadd = $user->rights->mymodule->myobject->write; // Used by the include of actions_addupdatedelete.inc.php |
@@ -26,7 +26,9 @@ |
||
26 | 26 | // Load translation files required by the page |
27 | 27 | $langs->load("admin"); |
28 | 28 | |
29 | -if (!$user->admin) accessforbidden(); |
|
29 | +if (!$user->admin) { |
|
30 | + accessforbidden(); |
|
31 | +} |
|
30 | 32 | |
31 | 33 | $sortfield = 'file'; |
32 | 34 | $sortorder = 'ASC'; |
@@ -320,7 +320,10 @@ |
||
320 | 320 | global $conf, $langs; |
321 | 321 | |
322 | 322 | $result = $this->_load_tables('/bom/sql/'); |
323 | - if ($result < 0) return -1; // Do not activate module if not allowed errors found on module SQL queries (the _load_table run sql with run_sql with error allowed parameter to 'default') |
|
323 | + if ($result < 0) { |
|
324 | + return -1; |
|
325 | + } |
|
326 | + // Do not activate module if not allowed errors found on module SQL queries (the _load_table run sql with run_sql with error allowed parameter to 'default') |
|
324 | 327 | |
325 | 328 | // Create extrafields |
326 | 329 | //include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; |
@@ -44,7 +44,9 @@ |
||
44 | 44 | $result = restrictedArea($user, 'loan', $id, '&loan'); |
45 | 45 | |
46 | 46 | $object = new Loan($db); |
47 | -if ($id > 0) $object->fetch($id); |
|
47 | +if ($id > 0) { |
|
48 | + $object->fetch($id); |
|
49 | +} |
|
48 | 50 | |
49 | 51 | $permissionnote = $user->rights->loan->write; // Used by the include of actions_setnotes.inc.php |
50 | 52 |
@@ -28,7 +28,9 @@ |
||
28 | 28 | // Load translation files required by the page |
29 | 29 | $langs->loadLangs(array("admin", "user", "install")); |
30 | 30 | |
31 | -if (!$user->admin) accessforbidden(); |
|
31 | +if (!$user->admin) { |
|
32 | + accessforbidden(); |
|
33 | +} |
|
32 | 34 | |
33 | 35 | |
34 | 36 | /* |
@@ -26,7 +26,9 @@ discard block |
||
26 | 26 | |
27 | 27 | $langs->load("admin"); |
28 | 28 | |
29 | -if (!$user->admin) accessforbidden(); |
|
29 | +if (!$user->admin) { |
|
30 | + accessforbidden(); |
|
31 | +} |
|
30 | 32 | |
31 | 33 | |
32 | 34 | /* |
@@ -63,10 +65,12 @@ discard block |
||
63 | 65 | // Web user group real (detected by 'id' external command) |
64 | 66 | $arrayout = array(); $varout = 0; |
65 | 67 | exec('id', $arrayout, $varout); |
66 | -if (empty($varout)) // Test command is ok. Work only on Linux OS. |
|
68 | +if (empty($varout)) { |
|
69 | + // Test command is ok. Work only on Linux OS. |
|
67 | 70 | { |
68 | 71 | print '<tr><td>'.$langs->trans("WebUserGroup")." (real, 'id' command)</td><td>".join(',', $arrayout)."</td></tr>\n"; |
69 | 72 | } |
73 | +} |
|
70 | 74 | print '</table>'; |
71 | 75 | print '</div>'; |
72 | 76 |