Passed
Push — master ( 65bdac...4e88da )
by Alxarafe
32:38
created
Controllers/Categories.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
     {
47 47
 
48 48
 // Load translation files required by the page
49
-       Globals::$langs->load("categories");
49
+        Globals::$langs->load("categories");
50 50
 
51 51
 // Security check
52 52
         $socid = DolUtils::GETPOST('socid', 'int');
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -104,28 +104,28 @@  discard block
 block discarded – undo
104 104
             // Action ajout d'une categorie
105 105
             if ($cancel) {
106 106
                 if ($urlfrom) {
107
-                    header("Location: " . $urlfrom);
107
+                    header("Location: ".$urlfrom);
108 108
                     exit;
109 109
                 } else if ($idProdOrigin) {
110
-                    header("Location: " . DOL_URL_ROOT . '/categories/viewcat.php?id=' . $idProdOrigin . '&type=' . $type);
110
+                    header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idProdOrigin.'&type='.$type);
111 111
                     exit;
112 112
                 } else if ($idCompanyOrigin) {
113
-                    header("Location: " . DOL_URL_ROOT . '/categories/viewcat.php?id=' . $idCompanyOrigin . '&type=' . $type);
113
+                    header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idCompanyOrigin.'&type='.$type);
114 114
                     exit;
115 115
                 } else if ($idSupplierOrigin) {
116
-                    header("Location: " . DOL_URL_ROOT . '/categories/viewcat.php?id=' . $idSupplierOrigin . '&type=' . $type);
116
+                    header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idSupplierOrigin.'&type='.$type);
117 117
                     exit;
118 118
                 } else if ($idMemberOrigin) {
119
-                    header("Location: " . DOL_URL_ROOT . '/categories/viewcat.php?id=' . $idMemberOrigin . '&type=' . $type);
119
+                    header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idMemberOrigin.'&type='.$type);
120 120
                     exit;
121 121
                 } else if ($idContactOrigin) {
122
-                    header("Location: " . DOL_URL_ROOT . '/categories/viewcat.php?id=' . $idContactOrigin . '&type=' . $type);
122
+                    header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idContactOrigin.'&type='.$type);
123 123
                     exit;
124 124
                 } else if ($idProjectOrigin) {
125
-                    header("Location: " . DOL_URL_ROOT . '/categories/viewcat.php?id=' . $idProjectOrigin . '&type=' . $type);
125
+                    header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idProjectOrigin.'&type='.$type);
126 126
                     exit;
127 127
                 } else {
128
-                    header("Location: " . DOL_URL_ROOT . '/categories/index.php?leftmenu=cat&type=' . $type);
128
+                    header("Location: ".DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type);
129 129
                     exit;
130 130
                 }
131 131
             }
@@ -169,32 +169,32 @@  discard block
 block discarded – undo
169 169
             // Action confirmation de creation categorie
170 170
             if ($action == 'confirmed') {
171 171
                 if ($urlfrom) {
172
-                    header("Location: " . $urlfrom);
172
+                    header("Location: ".$urlfrom);
173 173
                     exit;
174 174
                 } elseif ($backtopage) {
175
-                    header("Location: " . $backtopage);
175
+                    header("Location: ".$backtopage);
176 176
                     exit;
177 177
                 } else if ($idProdOrigin) {
178
-                    header("Location: " . DOL_URL_ROOT . '/categories/viewcat.php?id=' . $idProdOrigin . '&type=' . $type . '&mesg=' . urlencode($langs->trans("CatCreated")));
178
+                    header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idProdOrigin.'&type='.$type.'&mesg='.urlencode($langs->trans("CatCreated")));
179 179
                     exit;
180 180
                 } else if ($idCompanyOrigin) {
181
-                    header("Location: " . DOL_URL_ROOT . '/categories/viewcat.php?id=' . $idCompanyOrigin . '&type=' . $type . '&mesg=' . urlencode($langs->trans("CatCreated")));
181
+                    header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idCompanyOrigin.'&type='.$type.'&mesg='.urlencode($langs->trans("CatCreated")));
182 182
                     exit;
183 183
                 } else if ($idSupplierOrigin) {
184
-                    header("Location: " . DOL_URL_ROOT . '/categories/viewcat.php?id=' . $idSupplierOrigin . '&type=' . $type . '&mesg=' . urlencode($langs->trans("CatCreated")));
184
+                    header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idSupplierOrigin.'&type='.$type.'&mesg='.urlencode($langs->trans("CatCreated")));
185 185
                     exit;
186 186
                 } else if ($idMemberOrigin) {
187
-                    header("Location: " . DOL_URL_ROOT . '/categories/viewcat.php?id=' . $idMemberOrigin . '&type=' . $type . '&mesg=' . urlencode($langs->trans("CatCreated")));
187
+                    header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idMemberOrigin.'&type='.$type.'&mesg='.urlencode($langs->trans("CatCreated")));
188 188
                     exit;
189 189
                 } else if ($idContactOrigin) {
190
-                    header("Location: " . DOL_URL_ROOT . '/categories/viewcat.php?id=' . $idContactOrigin . '&type=' . $type . '&mesg=' . urlencode($langs->trans("CatCreated")));
190
+                    header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idContactOrigin.'&type='.$type.'&mesg='.urlencode($langs->trans("CatCreated")));
191 191
                     exit;
192 192
                 } else if ($idProjectOrigin) {
193
-                    header("Location: " . DOL_URL_ROOT . '/categories/viewcat.php?id=' . $idProjectOrigin . '&type=' . $type . '&mesg=' . urlencode($langs->trans("CatCreated")));
193
+                    header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idProjectOrigin.'&type='.$type.'&mesg='.urlencode($langs->trans("CatCreated")));
194 194
                     exit;
195 195
                 }
196 196
 
197
-                header("Location: " . DOL_URL_ROOT . '/categories/viewcat.php?id=' . $result . '&type=' . $type);
197
+                header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$result.'&type='.$type);
198 198
                 exit;
199 199
             }
200 200
         }
Please login to merge, or discard this patch.
Braces   +30 added lines, -20 removed lines patch added patch discarded remove patch
@@ -50,8 +50,9 @@  discard block
 block discarded – undo
50 50
 
51 51
 // Security check
52 52
         $socid = DolUtils::GETPOST('socid', 'int');
53
-        if (!Globals::$user->rights->categorie->lire)
54
-            accessforbidden();
53
+        if (!Globals::$user->rights->categorie->lire) {
54
+                    accessforbidden();
55
+        }
55 56
 
56 57
         $action = DolUtils::GETPOST('action', 'alpha');
57 58
         $cancel = DolUtils::GETPOST('cancel', 'alpha');
@@ -69,22 +70,29 @@  discard block
 block discarded – undo
69 70
         $parent = DolUtils::GETPOST('parent');
70 71
 
71 72
         if ($origin) {
72
-            if ($type == Categorie::TYPE_PRODUCT)
73
-                $idProdOrigin = $origin;
74
-            if ($type == Categorie::TYPE_SUPPLIER)
75
-                $idSupplierOrigin = $origin;
76
-            if ($type == Categorie::TYPE_CUSTOMER)
77
-                $idCompanyOrigin = $origin;
78
-            if ($type == Categorie::TYPE_MEMBER)
79
-                $idMemberOrigin = $origin;
80
-            if ($type == Categorie::TYPE_CONTACT)
81
-                $idContactOrigin = $origin;
82
-            if ($type == Categorie::TYPE_PROJECT)
83
-                $idProjectOrigin = $origin;
73
+            if ($type == Categorie::TYPE_PRODUCT) {
74
+                            $idProdOrigin = $origin;
75
+            }
76
+            if ($type == Categorie::TYPE_SUPPLIER) {
77
+                            $idSupplierOrigin = $origin;
78
+            }
79
+            if ($type == Categorie::TYPE_CUSTOMER) {
80
+                            $idCompanyOrigin = $origin;
81
+            }
82
+            if ($type == Categorie::TYPE_MEMBER) {
83
+                            $idMemberOrigin = $origin;
84
+            }
85
+            if ($type == Categorie::TYPE_CONTACT) {
86
+                            $idContactOrigin = $origin;
87
+            }
88
+            if ($type == Categorie::TYPE_PROJECT) {
89
+                            $idProjectOrigin = $origin;
90
+            }
84 91
         }
85 92
 
86
-        if ($catorigin && $type == Categorie::TYPE_PRODUCT)
87
-            $idCatOrigin = $catorigin;
93
+        if ($catorigin && $type == Categorie::TYPE_PRODUCT) {
94
+                    $idCatOrigin = $catorigin;
95
+        }
88 96
 
89 97
         $object = new Categorie();
90 98
 
@@ -139,12 +147,14 @@  discard block
 block discarded – undo
139 147
             $object->visible = $visible;
140 148
             $object->type = $type;
141 149
 
142
-            if ($parent != "-1")
143
-                $object->fk_parent = $parent;
150
+            if ($parent != "-1") {
151
+                            $object->fk_parent = $parent;
152
+            }
144 153
 
145 154
             $ret = $extrafields->setOptionalsFromPost($extralabels, $object);
146
-            if ($ret < 0)
147
-                $error++;
155
+            if ($ret < 0) {
156
+                            $error++;
157
+            }
148 158
 
149 159
             if (!$object->label) {
150 160
                 $error++;
Please login to merge, or discard this patch.
Views/CategoriesView.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -64,21 +64,21 @@  discard block
 block discarded – undo
64 64
             if ($action == 'create' || $_POST["addcat"] == 'addcat') {
65 65
                 DolUtils::dol_set_focus('#label');
66 66
 
67
-                print '<form action="' . $_SERVER['PHP_SELF'] . '?type=' . $type . '" method="POST">';
68
-                print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
69
-                print '<input type="hidden" name="urlfrom" value="' . $urlfrom . '">';
67
+                print '<form action="'.$_SERVER['PHP_SELF'].'?type='.$type.'" method="POST">';
68
+                print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
69
+                print '<input type="hidden" name="urlfrom" value="'.$urlfrom.'">';
70 70
                 print '<input type="hidden" name="action" value="add">';
71 71
                 print '<input type="hidden" name="addcat" value="addcat">';
72
-                print '<input type="hidden" name="id" value="' . DolUtils::GETPOST('origin', 'alpha') . '">';
73
-                print '<input type="hidden" name="type" value="' . $type . '">';
74
-                print '<input type="hidden" name="backtopage" value="' . $backtopage . '">';
72
+                print '<input type="hidden" name="id" value="'.DolUtils::GETPOST('origin', 'alpha').'">';
73
+                print '<input type="hidden" name="type" value="'.$type.'">';
74
+                print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
75 75
                 if ($origin)
76 76
                 {
77
-                    print '<input type="hidden" name="origin" value="' . $origin . '">';
77
+                    print '<input type="hidden" name="origin" value="'.$origin.'">';
78 78
                 }
79 79
                 if ($catorigin)
80 80
                 {
81
-                    print '<input type="hidden" name="catorigin" value="' . $catorigin . '">';
81
+                    print '<input type="hidden" name="catorigin" value="'.$catorigin.'">';
82 82
                 }
83 83
 
84 84
                 print load_fiche_titre($langs->trans("CreateCat"));
@@ -89,29 +89,29 @@  discard block
 block discarded – undo
89 89
 
90 90
                 // Ref
91 91
                 print '<tr>';
92
-                print '<td class="titlefieldcreate fieldrequired">' . $langs->trans("Ref") . '</td><td><input id="label" class="minwidth100" name="label" value="' . $label . '">';
92
+                print '<td class="titlefieldcreate fieldrequired">'.$langs->trans("Ref").'</td><td><input id="label" class="minwidth100" name="label" value="'.$label.'">';
93 93
                 print'</td></tr>';
94 94
 
95 95
                 // Description
96
-                print '<tr><td class="tdtop">' . $langs->trans("Description") . '</td><td>';
96
+                print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
97 97
                 //require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
98 98
                 $doleditor = new DolEditor('description', $description, '', 200, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, ROWS_6, '90%');
99 99
                 $doleditor->Create();
100 100
                 print '</td></tr>';
101 101
 
102 102
                 // Color
103
-                print '<tr><td>' . $langs->trans("Color") . '</td><td>';
103
+                print '<tr><td>'.$langs->trans("Color").'</td><td>';
104 104
                 print $formother->selectColor($color, 'color');
105 105
                 print '</td></tr>';
106 106
 
107 107
                 // Parent category
108
-                print '<tr><td>' . $langs->trans("AddIn") . '</td><td>';
108
+                print '<tr><td>'.$langs->trans("AddIn").'</td><td>';
109 109
                 print $form->select_all_categories($type, $catorigin, 'parent');
110 110
                 print ajax_combobox('parent');
111 111
                 print '</td></tr>';
112 112
 
113 113
                 $parameters = array();
114
-                $reshook = Globals::$hookManager->executeHooks('formObjectOptions', $parameters, $object, $action);    // Note that $action and $object may have been modified by hook
114
+                $reshook = Globals::$hookManager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
115 115
                 print Globals::$hookManager->resPrint;
116 116
                 if (empty($reshook)) {
117 117
                     print $object->showOptionals($extrafields, 'edit');
@@ -122,9 +122,9 @@  discard block
 block discarded – undo
122 122
                 DolUtils::dol_fiche_end('');
123 123
 
124 124
                 print '<div class="center">';
125
-                print '<input type="submit" class="button" value="' . $langs->trans("CreateThisCat") . '" name="creation" />';
125
+                print '<input type="submit" class="button" value="'.$langs->trans("CreateThisCat").'" name="creation" />';
126 126
                 print '&nbsp; &nbsp; &nbsp;';
127
-                print '<input type="submit" class="button" value="' . $langs->trans("Cancel") . '" name="cancel" />';
127
+                print '<input type="submit" class="button" value="'.$langs->trans("Cancel").'" name="cancel" />';
128 128
                 print '</div>';
129 129
 
130 130
                 print '</form>';
Please login to merge, or discard this patch.
Views/LoginView.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
     public function draw()
62 62
     {
63 63
         header('Cache-Control: Public, must-revalidate');
64
-        header("Content-type: text/html; charset=" . Globals::$conf->file->character_set_client);
64
+        header("Content-type: text/html; charset=".Globals::$conf->file->character_set_client);
65 65
 
66 66
 // Need global variable $title to be defined by caller (like dol_loginfunction)
67 67
 // Caller can also set 	$morelogincontent = array(['options']=>array('js'=>..., 'table'=>...);
@@ -94,9 +94,9 @@  discard block
 block discarded – undo
94 94
         }
95 95
 
96 96
         $php_self = DolUtils::dol_escape_htmltag($_SERVER['PHP_SELF']);
97
-        $php_self .= DolUtils::dol_escape_htmltag($_SERVER["QUERY_STRING"]) ? '?' . DolUtils::dol_escape_htmltag($_SERVER["QUERY_STRING"]) : '';
97
+        $php_self .= DolUtils::dol_escape_htmltag($_SERVER["QUERY_STRING"]) ? '?'.DolUtils::dol_escape_htmltag($_SERVER["QUERY_STRING"]) : '';
98 98
         if (!preg_match('/mainmenu=/', $php_self)) {
99
-            $php_self .= (preg_match('/\?/', $php_self) ? '&' : '?') . 'mainmenu=home';
99
+            $php_self .= (preg_match('/\?/', $php_self) ? '&' : '?').'mainmenu=home';
100 100
         }
101 101
 
102 102
         $this->url = $php_self;
@@ -110,28 +110,28 @@  discard block
 block discarded – undo
110 110
           );
111 111
          */
112 112
         $arrayofjs = array(
113
-            DOL_BASE_URI . '/includes/jstz/jstz.min.js' . (empty(Globals::$conf->dol_use_jmobile) ? '' : '?version=' . urlencode(DOL_VERSION)),
114
-            DOL_BASE_URI . '/core/js/dst.js' . (empty(Globals::$conf->dol_use_jmobile) ? '' : '?version=' . urlencode(DOL_VERSION))
113
+            DOL_BASE_URI.'/includes/jstz/jstz.min.js'.(empty(Globals::$conf->dol_use_jmobile) ? '' : '?version='.urlencode(DOL_VERSION)),
114
+            DOL_BASE_URI.'/core/js/dst.js'.(empty(Globals::$conf->dol_use_jmobile) ? '' : '?version='.urlencode(DOL_VERSION))
115 115
         );
116 116
 
117 117
         // $titletruedolibarrversion is defined by dol_loginfunction in security2.lib.php.
118 118
         // We must keep the @, some tools use it to know it is login page and find true dolibarr version.
119 119
         // $titleofloginpage = Globals::$langs->trans('Login') . ' @ ' . $titletruedolibarrversion;
120
-        $titleofloginpage = Globals::$langs->trans('Login') . ' @ ' . DOL_VERSION;
120
+        $titleofloginpage = Globals::$langs->trans('Login').' @ '.DOL_VERSION;
121 121
 
122 122
         $disablenofollow = 1;
123
-        if (!preg_match('/' . constant('DOL_APPLICATION_TITLE') . '/', $this->title)) {
123
+        if (!preg_match('/'.constant('DOL_APPLICATION_TITLE').'/', $this->title)) {
124 124
             $disablenofollow = 0;
125 125
         }
126 126
 
127 127
         print $this->top_htmlhead('', $titleofloginpage, 0, 0, $arrayofjs, array(), 0, $disablenofollow);
128 128
 
129 129
 
130
-        $colorbackhmenu1 = '60,70,100';      // topmenu
130
+        $colorbackhmenu1 = '60,70,100'; // topmenu
131 131
         if (!isset(Globals::$conf->global->THEME_ELDY_TOPMENU_BACK1)) {
132 132
             Globals::$conf->global->THEME_ELDY_TOPMENU_BACK1 = $colorbackhmenu1;
133 133
         }
134 134
         $colorbackhmenu1 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty(Globals::$conf->global->THEME_ELDY_TOPMENU_BACK1) ? $colorbackhmenu1 : Globals::$conf->global->THEME_ELDY_TOPMENU_BACK1) : (empty($user->conf->THEME_ELDY_TOPMENU_BACK1) ? $colorbackhmenu1 : $user->conf->THEME_ELDY_TOPMENU_BACK1);
135
-        $colorbackhmenu1 = join(',', DolUtils2::colorStringToArray($colorbackhmenu1));    // Normalize value to 'x,y,z'
135
+        $colorbackhmenu1 = join(',', DolUtils2::colorStringToArray($colorbackhmenu1)); // Normalize value to 'x,y,z'
136 136
     }
137 137
 }
Please login to merge, or discard this patch.
dolibarr/htdocs/install/inc.php 2 patches
Spacing   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -33,12 +33,12 @@  discard block
 block discarded – undo
33 33
 // Just to define version DOL_VERSION
34 34
 if (!defined('DOL_INC_FOR_VERSION_ERROR'))
35 35
     define('DOL_INC_FOR_VERSION_ERROR', '1');
36
-require_once DOL_BASE_PATH . '/filefunc.inc.php';
36
+require_once DOL_BASE_PATH.'/filefunc.inc.php';
37 37
 
38
-require_once DOL_BASE_PATH . '/core/class/translate.class.php';
39
-require_once DOL_BASE_PATH . '/core/lib/functions.lib.php';
40
-require_once DOL_BASE_PATH . '/core/lib/admin.lib.php';
41
-require_once DOL_BASE_PATH . '/core/lib/files.lib.php';
38
+require_once DOL_BASE_PATH.'/core/class/translate.class.php';
39
+require_once DOL_BASE_PATH.'/core/lib/functions.lib.php';
40
+require_once DOL_BASE_PATH.'/core/lib/admin.lib.php';
41
+require_once DOL_BASE_PATH.'/core/lib/files.lib.php';
42 42
 
43 43
 /*
44 44
  * adobdbtime package
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 // Define vars
79 79
 $conffiletoshowshort = "conf.php";
80 80
 // Define localization of conf file
81
-$conffile = DOL_BASE_PATH . "/conf/conf.php";
81
+$conffile = DOL_BASE_PATH."/conf/conf.php";
82 82
 $conffiletoshow = "htdocs/conf/conf.php";
83 83
 // For debian/redhat like systems
84 84
 //$conffile = "/etc/dolibarr/conf.php";
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
             $dolibarr_main_db_port = '3306'; // For backward compatibility
101 101
         }
102 102
         // Clean parameters
103
-        $dolibarr_main_data_root = isset($dolibarr_main_data_root) ? trim($dolibarr_main_data_root) : DOL_BASE_PATH . '../documents';
103
+        $dolibarr_main_data_root = isset($dolibarr_main_data_root) ? trim($dolibarr_main_data_root) : DOL_BASE_PATH.'../documents';
104 104
         $dolibarr_main_url_root = isset($dolibarr_main_url_root) ? trim($dolibarr_main_url_root) : '';
105 105
         $dolibarr_main_url_root_alt = isset($dolibarr_main_url_root_alt) ? trim($dolibarr_main_url_root_alt) : '';
106 106
         $dolibarr_main_document_root = isset($dolibarr_main_document_root) ? trim($dolibarr_main_document_root) : '';
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
         // Load database driver
127 127
         if ($result) {
128 128
             if (!empty($dolibarr_main_document_root) && !empty($dolibarr_main_db_type)) {
129
-                $result = include_once $dolibarr_main_document_root . "/core/db/" . $dolibarr_main_db_type . '.class.php';
129
+                $result = include_once $dolibarr_main_document_root."/core/db/".$dolibarr_main_db_type.'.class.php';
130 130
                 if (!$result) {
131 131
                     $includeconferror = 'ErrorBadValueForDolibarrMainDBType';
132 132
                 }
@@ -146,14 +146,14 @@  discard block
 block discarded – undo
146 146
 }
147 147
 define('MAIN_DB_PREFIX', (isset($dolibarr_main_db_prefix) ? $dolibarr_main_db_prefix : ''));
148 148
 
149
-define('DOL_CLASS_PATH', 'class/');                             // Filsystem path to class dir
150
-define('DOL_DATA_ROOT', (isset($dolibarr_main_data_root) ? $dolibarr_main_data_root : DOL_BASE_PATH . '../documents'));
151
-define('DOL_MAIN_URL_ROOT', (isset($dolibarr_main_url_root) ? $dolibarr_main_url_root : ''));           // URL relative root
152
-$uri = preg_replace('/^http(s?):\/\//i', '', constant('DOL_MAIN_URL_ROOT'));  // $uri contains url without http*
153
-$suburi = strstr($uri, '/');       // $suburi contains url without domain
149
+define('DOL_CLASS_PATH', 'class/'); // Filsystem path to class dir
150
+define('DOL_DATA_ROOT', (isset($dolibarr_main_data_root) ? $dolibarr_main_data_root : DOL_BASE_PATH.'../documents'));
151
+define('DOL_MAIN_URL_ROOT', (isset($dolibarr_main_url_root) ? $dolibarr_main_url_root : '')); // URL relative root
152
+$uri = preg_replace('/^http(s?):\/\//i', '', constant('DOL_MAIN_URL_ROOT')); // $uri contains url without http*
153
+$suburi = strstr($uri, '/'); // $suburi contains url without domain
154 154
 if ($suburi == '/')
155
-    $suburi = '';   // If $suburi is /, it is now ''
156
-define('DOL_URL_ROOT', $suburi);    // URL relative root ('', '/dolibarr', ...)
155
+    $suburi = ''; // If $suburi is /, it is now ''
156
+define('DOL_URL_ROOT', $suburi); // URL relative root ('', '/dolibarr', ...)
157 157
 
158 158
 
159 159
 if (empty($conf->file->character_set_client))
@@ -189,14 +189,14 @@  discard block
 block discarded – undo
189 189
     $langs->load("install");
190 190
     print $langs->trans("YouTryInstallDisabledByDirLock");
191 191
     if (!empty($dolibarr_main_url_root)) {
192
-        print 'Click on following link, <a href="' . $dolibarr_main_url_root . '/admin/index.php?mainmenu=home&leftmenu=setup' . (isset($_POST["login"]) ? '&username=' . urlencode($_POST["login"]) : '') . '">';
192
+        print 'Click on following link, <a href="'.$dolibarr_main_url_root.'/admin/index.php?mainmenu=home&leftmenu=setup'.(isset($_POST["login"]) ? '&username='.urlencode($_POST["login"]) : '').'">';
193 193
         print $langs->trans("ClickHereToGoToApp");
194 194
         print '</a>';
195 195
     }
196 196
     exit;
197 197
 }
198 198
 
199
-$lockfile = DOL_DATA_ROOT . '/install.lock';
199
+$lockfile = DOL_DATA_ROOT.'/install.lock';
200 200
 if (constant('DOL_DATA_ROOT') === null) {
201 201
     // We don't have a configuration file yet
202 202
     // Try to detect any lockfile in the default documents path
@@ -210,8 +210,8 @@  discard block
 block discarded – undo
210 210
     $langs->load("install");
211 211
     print $langs->trans("YouTryInstallDisabledByFileLock");
212 212
     if (!empty($dolibarr_main_url_root)) {
213
-        print $langs->trans("ClickOnLinkOrRemoveManualy") . '<br>';
214
-        print '<a href="' . $dolibarr_main_url_root . '/admin/index.php?mainmenu=home&leftmenu=setup' . (isset($_POST["login"]) ? '&username=' . urlencode($_POST["login"]) : '') . '">';
213
+        print $langs->trans("ClickOnLinkOrRemoveManualy").'<br>';
214
+        print '<a href="'.$dolibarr_main_url_root.'/admin/index.php?mainmenu=home&leftmenu=setup'.(isset($_POST["login"]) ? '&username='.urlencode($_POST["login"]) : '').'">';
215 215
         print $langs->trans("ClickHereToGoToApp");
216 216
         print '</a>';
217 217
     } else {
@@ -230,13 +230,13 @@  discard block
 block discarded – undo
230 230
     if (@is_writable('/tmp'))
231 231
         define('SYSLOG_FILE', '/tmp/dolibarr_install.log');
232 232
     else if (!empty($_ENV["TMP"]) && @is_writable($_ENV["TMP"]))
233
-        define('SYSLOG_FILE', $_ENV["TMP"] . '/dolibarr_install.log');
233
+        define('SYSLOG_FILE', $_ENV["TMP"].'/dolibarr_install.log');
234 234
     else if (!empty($_ENV["TEMP"]) && @is_writable($_ENV["TEMP"]))
235
-        define('SYSLOG_FILE', $_ENV["TEMP"] . '/dolibarr_install.log');
235
+        define('SYSLOG_FILE', $_ENV["TEMP"].'/dolibarr_install.log');
236 236
     else if (@is_writable('../../../../') && @file_exists('../../../../startdoliwamp.bat'))
237 237
         define('SYSLOG_FILE', '../../../../dolibarr_install.log'); // For DoliWamp
238 238
     else if (@is_writable('../../'))
239
-        define('SYSLOG_FILE', '../../dolibarr_install.log');    // For others
239
+        define('SYSLOG_FILE', '../../dolibarr_install.log'); // For others
240 240
 
241 241
 
242 242
 
@@ -258,9 +258,9 @@  discard block
 block discarded – undo
258 258
 // We init log handler for install
259 259
 $handlers = array('mod_syslog_file');
260 260
 foreach ($handlers as $handler) {
261
-    $file = DOL_BASE_PATH . '/core/modules/syslog/' . $handler . '.php';
261
+    $file = DOL_BASE_PATH.'/core/modules/syslog/'.$handler.'.php';
262 262
     if (!file_exists($file)) {
263
-        throw new Exception('Missing log handler file ' . $handler . '.php');
263
+        throw new Exception('Missing log handler file '.$handler.'.php');
264 264
     }
265 265
 
266 266
     require_once $file;
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
     global $dolibarr_main_db_pass;
321 321
     global $character_set_client;
322 322
 
323
-    $return = include_once $dolibarr_main_document_root . '/core/class/conf.class.php';
323
+    $return = include_once $dolibarr_main_document_root.'/core/class/conf.class.php';
324 324
     if (!$return)
325 325
         return -1;
326 326
 
@@ -360,13 +360,13 @@  discard block
 block discarded – undo
360 360
         if (@is_writable('/tmp'))
361 361
             define('SYSLOG_FILE', '/tmp/dolibarr_install.log');
362 362
         else if (!empty($_ENV["TMP"]) && @is_writable($_ENV["TMP"]))
363
-            define('SYSLOG_FILE', $_ENV["TMP"] . '/dolibarr_install.log');
363
+            define('SYSLOG_FILE', $_ENV["TMP"].'/dolibarr_install.log');
364 364
         else if (!empty($_ENV["TEMP"]) && @is_writable($_ENV["TEMP"]))
365
-            define('SYSLOG_FILE', $_ENV["TEMP"] . '/dolibarr_install.log');
365
+            define('SYSLOG_FILE', $_ENV["TEMP"].'/dolibarr_install.log');
366 366
         else if (@is_writable('../../../../') && @file_exists('../../../../startdoliwamp.bat'))
367 367
             define('SYSLOG_FILE', '../../../../dolibarr_install.log'); // For DoliWamp
368 368
         else if (@is_writable('../../'))
369
-            define('SYSLOG_FILE', '../../dolibarr_install.log');    // For others
369
+            define('SYSLOG_FILE', '../../dolibarr_install.log'); // For others
370 370
 
371 371
 
372 372
 
@@ -388,9 +388,9 @@  discard block
 block discarded – undo
388 388
     // We init log handler for install
389 389
     $handlers = array('mod_syslog_file');
390 390
     foreach ($handlers as $handler) {
391
-        $file = DOL_BASE_PATH . '/core/modules/syslog/' . $handler . '.php';
391
+        $file = DOL_BASE_PATH.'/core/modules/syslog/'.$handler.'.php';
392 392
         if (!file_exists($file)) {
393
-            throw new Exception('Missing log handler file ' . $handler . '.php');
393
+            throw new Exception('Missing log handler file '.$handler.'.php');
394 394
         }
395 395
 
396 396
         require_once $file;
@@ -436,63 +436,63 @@  discard block
 block discarded – undo
436 436
     }
437 437
 
438 438
     // We force the content charset
439
-    header("Content-type: text/html; charset=" . $conf->file->character_set_client);
439
+    header("Content-type: text/html; charset=".$conf->file->character_set_client);
440 440
     header("X-Content-Type-Options: nosniff");
441 441
 
442
-    print '<!DOCTYPE HTML>' . "\n";
443
-    print '<html>' . "\n";
444
-    print '<head>' . "\n";
445
-    print '<meta charset="' . $conf->file->character_set_client . '">' . "\n";
446
-    print '<meta name="viewport" content="width=device-width, initial-scale=1.0">' . "\n";
447
-    print '<meta name="generator" content="Dolibarr installer">' . "\n";
448
-    print '<link rel="stylesheet" type="text/css" href="' . DOL_BASE_URI . '/install/default.css">' . "\n";
442
+    print '<!DOCTYPE HTML>'."\n";
443
+    print '<html>'."\n";
444
+    print '<head>'."\n";
445
+    print '<meta charset="'.$conf->file->character_set_client.'">'."\n";
446
+    print '<meta name="viewport" content="width=device-width, initial-scale=1.0">'."\n";
447
+    print '<meta name="generator" content="Dolibarr installer">'."\n";
448
+    print '<link rel="stylesheet" type="text/css" href="'.DOL_BASE_URI.'/install/default.css">'."\n";
449 449
 
450
-    print '<!-- Includes CSS for JQuery -->' . "\n";
450
+    print '<!-- Includes CSS for JQuery -->'."\n";
451 451
     if ($jQueryUiCustomPath) {
452
-        print '<link rel="stylesheet" type="text/css" href="' . $jQueryUiCustomPath . 'css/' . $jquerytheme . '/jquery-ui.min.css" />' . "\n";  // JQuery
452
+        print '<link rel="stylesheet" type="text/css" href="'.$jQueryUiCustomPath.'css/'.$jquerytheme.'/jquery-ui.min.css" />'."\n"; // JQuery
453 453
     } else {
454 454
         //print '<link rel="stylesheet" type="text/css" href="' . DOL_BASE_URI . '/includes/jquery/css/' . $jquerytheme . '/jquery-ui.min.css" />' . "\n";    // JQuery
455
-        print '<link rel="stylesheet" type="text/css" href="' . BASE_URI . '/includes/jquery/css/' . $jquerytheme . '/jquery-ui.min.css" />' . "\n";    // JQuery
455
+        print '<link rel="stylesheet" type="text/css" href="'.BASE_URI.'/includes/jquery/css/'.$jquerytheme.'/jquery-ui.min.css" />'."\n"; // JQuery
456 456
     }
457
-    print '<!-- Includes JS for JQuery -->' . "\n";
457
+    print '<!-- Includes JS for JQuery -->'."\n";
458 458
     if ($jQueryCustomPath) {
459
-        print '<script type="text/javascript" src="' . $jQueryCustomPath . 'jquery.min.js"></script>' . "\n";
459
+        print '<script type="text/javascript" src="'.$jQueryCustomPath.'jquery.min.js"></script>'."\n";
460 460
     } else {
461 461
         // print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/js/jquery.min.js"></script>' . "\n";
462
-        print '<script type="text/javascript" src="' . BASE_URI . '/vendor/components/jquery/jquery.min.js"></script>' . "\n";
462
+        print '<script type="text/javascript" src="'.BASE_URI.'/vendor/components/jquery/jquery.min.js"></script>'."\n";
463 463
     }
464 464
     if ($jQueryUiCustomPath) {
465
-        print '<script type="text/javascript" src="' . $jQueryUiCustomPath . 'jquery-ui.min.js"></script>' . "\n";
465
+        print '<script type="text/javascript" src="'.$jQueryUiCustomPath.'jquery-ui.min.js"></script>'."\n";
466 466
     } else {
467 467
         // print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/js/jquery-ui.min.js"></script>' . "\n";
468
-        print '<script type="text/javascript" src="' . BASE_URI . '/vendor/components/jqueryui/jquery-ui.min.js"></script>' . "\n";
468
+        print '<script type="text/javascript" src="'.BASE_URI.'/vendor/components/jqueryui/jquery-ui.min.js"></script>'."\n";
469 469
     }
470
-    print '<title>' . $langs->trans("DolibarrSetup") . '</title>' . "\n";
470
+    print '<title>'.$langs->trans("DolibarrSetup").'</title>'."\n";
471 471
     print "<!-- Alixar debugBar header -->";
472 472
     print Debug::getRenderHeader(); // Includes Alixar debugBar header
473
-    print '</head>' . "\n";
473
+    print '</head>'."\n";
474 474
 
475
-    print '<body>' . "\n";
475
+    print '<body>'."\n";
476 476
 
477 477
     print '<div class="divlogoinstall" style="text-align:center">';
478
-    print '<img class="imglogoinstall" src="' . DOL_BASE_URI . '/theme/dolibarr_logo.png" alt="Dolibarr logo"><br>';
478
+    print '<img class="imglogoinstall" src="'.DOL_BASE_URI.'/theme/dolibarr_logo.png" alt="Dolibarr logo"><br>';
479 479
     print DOL_VERSION;
480 480
     print '</div><br>';
481 481
 
482
-    print '<span class="titre">' . $langs->trans("DolibarrSetup");
482
+    print '<span class="titre">'.$langs->trans("DolibarrSetup");
483 483
     if ($subtitle) {
484
-        print ' - ' . $subtitle;
484
+        print ' - '.$subtitle;
485 485
     }
486
-    print '</span>' . "\n";
486
+    print '</span>'."\n";
487 487
 
488 488
     //print '<form name="forminstall" style="width: 100%" action="' . $next . '.php' . ($param ? '?' . $param : '') . '" method="POST">' . "\n";
489
-    print '<form name="forminstall" style="width: 100%" action="' . BASE_URI . '?controller=install&method=' . $next . ($param ? '&' . $param : '') . '" method="POST">' . "\n";
490
-    print '<input type="hidden" name="testpost" value="ok">' . "\n";
491
-    print '<input type="hidden" name="action" value="' . $action . '">' . "\n";
489
+    print '<form name="forminstall" style="width: 100%" action="'.BASE_URI.'?controller=install&method='.$next.($param ? '&'.$param : '').'" method="POST">'."\n";
490
+    print '<input type="hidden" name="testpost" value="ok">'."\n";
491
+    print '<input type="hidden" name="action" value="'.$action.'">'."\n";
492 492
 
493
-    print '<table class="main" width="100%"><tr><td>' . "\n";
493
+    print '<table class="main" width="100%"><tr><td>'."\n";
494 494
 
495
-    print '<table class="' . $csstable . '" width="100%"><tr><td>' . "\n";
495
+    print '<table class="'.$csstable.'" width="100%"><tr><td>'."\n";
496 496
 }
497 497
 
498 498
 /**
@@ -512,27 +512,27 @@  discard block
 block discarded – undo
512 512
     $langs->load("other");
513 513
     $langs->load("admin");
514 514
 
515
-    print '</td></tr></table>' . "\n";
516
-    print '</td></tr></table>' . "\n";
515
+    print '</td></tr></table>'."\n";
516
+    print '</td></tr></table>'."\n";
517 517
 
518 518
     if (!$nonext || ($nonext == '2')) {
519 519
         print '<div class="nextbutton" id="nextbutton">';
520 520
         if ($nonext == '2') {
521
-            print $langs->trans("ErrorFoundDuringMigration", isset($_SERVER["REQUEST_URI"]) ? $_SERVER["REQUEST_URI"] . '&ignoreerrors=1' : '') . '<br><br>';
521
+            print $langs->trans("ErrorFoundDuringMigration", isset($_SERVER["REQUEST_URI"]) ? $_SERVER["REQUEST_URI"].'&ignoreerrors=1' : '').'<br><br>';
522 522
         }
523 523
 
524
-        print '<input type="submit" ' . ($nonext == '2' ? 'disabled="disabled" ' : '') . 'value="' . $langs->trans("NextStep") . ' ->"';
524
+        print '<input type="submit" '.($nonext == '2' ? 'disabled="disabled" ' : '').'value="'.$langs->trans("NextStep").' ->"';
525 525
         if ($jscheckfunction)
526
-            print ' onClick="return ' . $jscheckfunction . '();"';
526
+            print ' onClick="return '.$jscheckfunction.'();"';
527 527
         print '></div>';
528 528
         if ($withpleasewait)
529
-            print '<div style="visibility: hidden;" class="pleasewait" id="pleasewait"><br>' . $langs->trans("NextStepMightLastALongTime") . '<br><br><div class="blinkwait">' . $langs->trans("PleaseBePatient") . '</div></div>';
529
+            print '<div style="visibility: hidden;" class="pleasewait" id="pleasewait"><br>'.$langs->trans("NextStepMightLastALongTime").'<br><br><div class="blinkwait">'.$langs->trans("PleaseBePatient").'</div></div>';
530 530
     }
531 531
     if ($setuplang) {
532
-        print '<input type="hidden" name="selectlang" value="' . $setuplang . '">';
532
+        print '<input type="hidden" name="selectlang" value="'.$setuplang.'">';
533 533
     }
534 534
 
535
-    print '</form>' . "\n";
535
+    print '</form>'."\n";
536 536
 
537 537
     // If there is some logs in buffer to show
538 538
     if (isset($conf->logbuffer) && count($conf->logbuffer)) {
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
         print "<!-- Start of log output\n";
541 541
         //print '<div class="hidden">'."\n";
542 542
         foreach ($conf->logbuffer as $logline) {
543
-            print $logline . "<br>\n";
543
+            print $logline."<br>\n";
544 544
         }
545 545
         //print '</div>'."\n";
546 546
         print "End of log output -->\n";
@@ -549,8 +549,8 @@  discard block
 block discarded – undo
549 549
 
550 550
     print "<!-- Alixar debugBar footer -->";
551 551
     print Debug::getRenderFooter(); // Includes Alixar debugBar footer
552
-    print '</body>' . "\n";
553
-    print '</html>' . "\n";
552
+    print '</body>'."\n";
553
+    print '</html>'."\n";
554 554
 }
555 555
 
556 556
 /**
@@ -615,16 +615,16 @@  discard block
 block discarded – undo
615 615
         $dolibarr_main_url_root = $_SERVER["SCRIPT_URI"];
616 616
     } // If defined (Ie: Apache with Caudium)
617 617
     elseif (isset($_SERVER["SERVER_URL"]) && isset($_SERVER["DOCUMENT_URI"])) {
618
-        $dolibarr_main_url_root = $_SERVER["SERVER_URL"] . $_SERVER["DOCUMENT_URI"];
618
+        $dolibarr_main_url_root = $_SERVER["SERVER_URL"].$_SERVER["DOCUMENT_URI"];
619 619
     } // If SCRIPT_URI, SERVER_URL, DOCUMENT_URI not defined (Ie: Apache 2.0.44 for Windows)
620 620
     else {
621
-        $proto = ( (!empty($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on') || $_SERVER['SERVER_PORT'] == 443) ? 'https' : 'http';
621
+        $proto = ((!empty($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on') || $_SERVER['SERVER_PORT'] == 443) ? 'https' : 'http';
622 622
         if (!empty($_SERVER["HTTP_HOST"])) {
623 623
             $serverport = $_SERVER["HTTP_HOST"];
624 624
         } else {
625 625
             $serverport = $_SERVER["SERVER_NAME"];
626 626
         }
627
-        $dolibarr_main_url_root = $proto . "://" . $serverport . $_SERVER["SCRIPT_NAME"];
627
+        $dolibarr_main_url_root = $proto."://".$serverport.$_SERVER["SCRIPT_NAME"];
628 628
     }
629 629
     // Clean proposed URL
630 630
     // We assume /install to be under /htdocs, so we get the parent path of the current URL
Please login to merge, or discard this patch.
Braces   +101 added lines, -65 removed lines patch added patch discarded remove patch
@@ -31,8 +31,9 @@  discard block
 block discarded – undo
31 31
  * 	\brief      File that define environment for support pages
32 32
  */
33 33
 // Just to define version DOL_VERSION
34
-if (!defined('DOL_INC_FOR_VERSION_ERROR'))
34
+if (!defined('DOL_INC_FOR_VERSION_ERROR')) {
35 35
     define('DOL_INC_FOR_VERSION_ERROR', '1');
36
+}
36 37
 require_once DOL_BASE_PATH . '/filefunc.inc.php';
37 38
 
38 39
 require_once DOL_BASE_PATH . '/core/class/translate.class.php';
@@ -151,23 +152,31 @@  discard block
 block discarded – undo
151 152
 define('DOL_MAIN_URL_ROOT', (isset($dolibarr_main_url_root) ? $dolibarr_main_url_root : ''));           // URL relative root
152 153
 $uri = preg_replace('/^http(s?):\/\//i', '', constant('DOL_MAIN_URL_ROOT'));  // $uri contains url without http*
153 154
 $suburi = strstr($uri, '/');       // $suburi contains url without domain
154
-if ($suburi == '/')
155
-    $suburi = '';   // If $suburi is /, it is now ''
155
+if ($suburi == '/') {
156
+    $suburi = '';
157
+}
158
+// If $suburi is /, it is now ''
156 159
 define('DOL_URL_ROOT', $suburi);    // URL relative root ('', '/dolibarr', ...)
157 160
 
158 161
 
159
-if (empty($conf->file->character_set_client))
162
+if (empty($conf->file->character_set_client)) {
160 163
     $conf->file->character_set_client = "utf-8";
161
-if (empty($conf->db->character_set))
164
+}
165
+if (empty($conf->db->character_set)) {
162 166
     $conf->db->character_set = 'utf8';
163
-if (empty($conf->db->dolibarr_main_db_collation))
167
+}
168
+if (empty($conf->db->dolibarr_main_db_collation)) {
164 169
     $conf->db->dolibarr_main_db_collation = 'utf8_unicode_ci';
165
-if (empty($conf->db->dolibarr_main_db_encryption))
170
+}
171
+if (empty($conf->db->dolibarr_main_db_encryption)) {
166 172
     $conf->db->dolibarr_main_db_encryption = 0;
167
-if (empty($conf->db->dolibarr_main_db_cryptkey))
173
+}
174
+if (empty($conf->db->dolibarr_main_db_cryptkey)) {
168 175
     $conf->db->dolibarr_main_db_cryptkey = '';
169
-if (empty($conf->db->user))
176
+}
177
+if (empty($conf->db->user)) {
170 178
     $conf->db->user = '';
179
+}
171 180
 
172 181
 // Define array of document root directories
173 182
 $conf->file->dol_document_root = array(DOL_DOCUMENT_ROOT);
@@ -224,19 +233,24 @@  discard block
 block discarded – undo
224 233
 // Force usage of log file for install and upgrades
225 234
 $conf->syslog->enabled = 1;
226 235
 $conf->global->SYSLOG_LEVEL = constant('LOG_DEBUG');
227
-if (!defined('SYSLOG_HANDLERS'))
236
+if (!defined('SYSLOG_HANDLERS')) {
228 237
     define('SYSLOG_HANDLERS', '["mod_syslog_file"]');
238
+}
229 239
 if (!defined('SYSLOG_FILE')) { // To avoid warning on systems with constant already defined
230
-    if (@is_writable('/tmp'))
231
-        define('SYSLOG_FILE', '/tmp/dolibarr_install.log');
232
-    else if (!empty($_ENV["TMP"]) && @is_writable($_ENV["TMP"]))
233
-        define('SYSLOG_FILE', $_ENV["TMP"] . '/dolibarr_install.log');
234
-    else if (!empty($_ENV["TEMP"]) && @is_writable($_ENV["TEMP"]))
235
-        define('SYSLOG_FILE', $_ENV["TEMP"] . '/dolibarr_install.log');
236
-    else if (@is_writable('../../../../') && @file_exists('../../../../startdoliwamp.bat'))
237
-        define('SYSLOG_FILE', '../../../../dolibarr_install.log'); // For DoliWamp
238
-    else if (@is_writable('../../'))
239
-        define('SYSLOG_FILE', '../../dolibarr_install.log');    // For others
240
+    if (@is_writable('/tmp')) {
241
+            define('SYSLOG_FILE', '/tmp/dolibarr_install.log');
242
+    } else if (!empty($_ENV["TMP"]) && @is_writable($_ENV["TMP"])) {
243
+            define('SYSLOG_FILE', $_ENV["TMP"] . '/dolibarr_install.log');
244
+    } else if (!empty($_ENV["TEMP"]) && @is_writable($_ENV["TEMP"])) {
245
+            define('SYSLOG_FILE', $_ENV["TEMP"] . '/dolibarr_install.log');
246
+    } else if (@is_writable('../../../../') && @file_exists('../../../../startdoliwamp.bat')) {
247
+            define('SYSLOG_FILE', '../../../../dolibarr_install.log');
248
+    }
249
+    // For DoliWamp
250
+    else if (@is_writable('../../')) {
251
+            define('SYSLOG_FILE', '../../dolibarr_install.log');
252
+    }
253
+    // For others
240 254
 
241 255
 
242 256
 
@@ -251,10 +265,12 @@  discard block
 block discarded – undo
251 265
         
252 266
 //print 'SYSLOG_FILE='.SYSLOG_FILE;exit;
253 267
 }
254
-if (defined('SYSLOG_FILE'))
268
+if (defined('SYSLOG_FILE')) {
255 269
     $conf->global->SYSLOG_FILE = constant('SYSLOG_FILE');
256
-if (!defined('SYSLOG_FILE_NO_ERROR'))
270
+}
271
+if (!defined('SYSLOG_FILE_NO_ERROR')) {
257 272
     define('SYSLOG_FILE_NO_ERROR', 1);
273
+}
258 274
 // We init log handler for install
259 275
 $handlers = array('mod_syslog_file');
260 276
 foreach ($handlers as $handler) {
@@ -269,9 +285,10 @@  discard block
 block discarded – undo
269 285
         throw new Exception('Log handler does not extend LogHandlerInterface');
270 286
     }
271 287
 
272
-    if (empty($conf->loghandlers[$handler]))
273
-        $conf->loghandlers[$handler] = $loghandlerinstance;
274
-}
288
+    if (empty($conf->loghandlers[$handler])) {
289
+            $conf->loghandlers[$handler] = $loghandlerinstance;
290
+    }
291
+    }
275 292
 
276 293
 // Removed magic_quotes
277 294
 if (function_exists('get_magic_quotes_gpc')) { // magic_quotes_* removed in PHP 5.4
@@ -295,10 +312,11 @@  discard block
 block discarded – undo
295 312
 
296 313
 // Defini objet langs
297 314
 $langs = new Translate('..', $conf);
298
-if (GETPOST('lang', 'aZ09'))
315
+if (GETPOST('lang', 'aZ09')) {
299 316
     $langs->setDefaultLang(GETPOST('lang', 'aZ09'));
300
-else
317
+} else {
301 318
     $langs->setDefaultLang('auto');
319
+}
302 320
 
303 321
 $bc[false] = ' class="bg1"';
304 322
 $bc[true] = ' class="bg2"';
@@ -321,8 +339,9 @@  discard block
 block discarded – undo
321 339
     global $character_set_client;
322 340
 
323 341
     $return = include_once $dolibarr_main_document_root . '/core/class/conf.class.php';
324
-    if (!$return)
325
-        return -1;
342
+    if (!$return) {
343
+            return -1;
344
+    }
326 345
 
327 346
     $conf = new Conf();
328 347
     $conf->db->type = trim($dolibarr_main_db_type);
@@ -333,40 +352,51 @@  discard block
 block discarded – undo
333 352
     $conf->db->pass = trim($dolibarr_main_db_pass);
334 353
 
335 354
     // Mysql driver support has been removed in favor of mysqli
336
-    if ($conf->db->type == 'mysql')
337
-        $conf->db->type = 'mysqli';
338
-    if (empty($character_set_client))
339
-        $character_set_client = "UTF-8";
355
+    if ($conf->db->type == 'mysql') {
356
+            $conf->db->type = 'mysqli';
357
+    }
358
+    if (empty($character_set_client)) {
359
+            $character_set_client = "UTF-8";
360
+    }
340 361
     $conf->file->character_set_client = strtoupper($character_set_client);
341
-    if (empty($dolibarr_main_db_character_set))
342
-        $dolibarr_main_db_character_set = ($conf->db->type == 'mysqli' ? 'utf8' : '');
362
+    if (empty($dolibarr_main_db_character_set)) {
363
+            $dolibarr_main_db_character_set = ($conf->db->type == 'mysqli' ? 'utf8' : '');
364
+    }
343 365
     $conf->db->character_set = $dolibarr_main_db_character_set;
344
-    if (empty($dolibarr_main_db_collation))
345
-        $dolibarr_main_db_collation = ($conf->db->type == 'mysqli' ? 'utf8_unicode_ci' : '');
366
+    if (empty($dolibarr_main_db_collation)) {
367
+            $dolibarr_main_db_collation = ($conf->db->type == 'mysqli' ? 'utf8_unicode_ci' : '');
368
+    }
346 369
     $conf->db->dolibarr_main_db_collation = $dolibarr_main_db_collation;
347
-    if (empty($dolibarr_main_db_encryption))
348
-        $dolibarr_main_db_encryption = 0;
370
+    if (empty($dolibarr_main_db_encryption)) {
371
+            $dolibarr_main_db_encryption = 0;
372
+    }
349 373
     $conf->db->dolibarr_main_db_encryption = $dolibarr_main_db_encryption;
350
-    if (empty($dolibarr_main_db_cryptkey))
351
-        $dolibarr_main_db_cryptkey = '';
374
+    if (empty($dolibarr_main_db_cryptkey)) {
375
+            $dolibarr_main_db_cryptkey = '';
376
+    }
352 377
     $conf->db->dolibarr_main_db_cryptkey = $dolibarr_main_db_cryptkey;
353 378
 
354 379
     // Force usage of log file for install and upgrades
355 380
     $conf->syslog->enabled = 1;
356 381
     $conf->global->SYSLOG_LEVEL = constant('LOG_DEBUG');
357
-    if (!defined('SYSLOG_HANDLERS'))
358
-        define('SYSLOG_HANDLERS', '["mod_syslog_file"]');
382
+    if (!defined('SYSLOG_HANDLERS')) {
383
+            define('SYSLOG_HANDLERS', '["mod_syslog_file"]');
384
+    }