Passed
Push — master ( 7e4a07...284492 )
by Alxarafe
19:58
created
Helpers/AlixarDispatcher.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -35,8 +35,8 @@  discard block
 block discarded – undo
35 35
          * Copyright (C) 2018 Alxarafe <[email protected]>
36 36
          */
37 37
 
38
-        define('DOL_BASE_PATH', BASE_PATH . '/dolibarr/htdocs');
39
-        define('DOL_BASE_URI', BASE_URI . '/dolibarr/htdocs');
38
+        define('DOL_BASE_PATH', BASE_PATH.'/dolibarr/htdocs');
39
+        define('DOL_BASE_URI', BASE_URI.'/dolibarr/htdocs');
40 40
         define('DOL_DOCUMENT_ROOT', DOL_BASE_PATH);
41 41
 
42 42
         define('CORE_FOLDER', '/core');
@@ -50,15 +50,15 @@  discard block
 block discarded – undo
50 50
         define('CACHE_FOLDER', '/../cache');
51 51
         //define('VENDOR_FOLDER', BASE_URI . '/vendor');
52 52
 
53
-        define('CORE_PATH', BASE_PATH . CORE_FOLDER);
54
-        define('CONFIG_PATH', BASE_PATH . CONFIG_FOLDER);
55
-        define('CONTROLLERS_PATH', BASE_PATH . CONTROLLERS_FOLDER);
56
-        define('HELPERS_PATH', BASE_PATH . HELPERS_FOLDER);
57
-        define('MODELS_PATH', BASE_PATH . MODELS_FOLDER);
58
-        define('SKINS_PATH', BASE_PATH . SKINS_FOLDER);
59
-        define('TEMPLATES_PATH', BASE_PATH . TEMPLATES_FOLDER);
60
-        define('PLUGINS_PATH', BASE_PATH . PLUGINS_FOLDER);
61
-        define('CACHE_PATH', BASE_PATH . CACHE_FOLDER);
53
+        define('CORE_PATH', BASE_PATH.CORE_FOLDER);
54
+        define('CONFIG_PATH', BASE_PATH.CONFIG_FOLDER);
55
+        define('CONTROLLERS_PATH', BASE_PATH.CONTROLLERS_FOLDER);
56
+        define('HELPERS_PATH', BASE_PATH.HELPERS_FOLDER);
57
+        define('MODELS_PATH', BASE_PATH.MODELS_FOLDER);
58
+        define('SKINS_PATH', BASE_PATH.SKINS_FOLDER);
59
+        define('TEMPLATES_PATH', BASE_PATH.TEMPLATES_FOLDER);
60
+        define('PLUGINS_PATH', BASE_PATH.PLUGINS_FOLDER);
61
+        define('CACHE_PATH', BASE_PATH.CACHE_FOLDER);
62 62
         //define('VENDOR_PATH', BASE_PATH . VENDOR_FOLDER);
63 63
 
64 64
         /**
Please login to merge, or discard this patch.
Helpers/Request.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -25,17 +25,17 @@  discard block
 block discarded – undo
25 25
 {
26 26
 
27 27
     // Filters
28
-    const NO_CHECK = 0;             // 'none'=no check (only for param that should have very rich content)
29
-    const NUMERIC = 1;              // 'int'=check it's numeric (integer or float)
30
-    const NUMBER_COMMA = 2;         // 'intcomma'=check it's integer+comma ('1,2,3,4...')
31
-    const ALPHA = 3;                // 'alpha'=check it's text and sign
32
-    const LETTERS_ONLY = 4;         // 'aZ'=check it's a-z only
33
-    const LETTERS_AND_NUMBERS = 5;  // 'aZ09'=check it's simple alpha string (recommended for keys)
34
-    const AN_ARRAY = 6;             // 'array'=check it's array
35
-    const SANITIZE = 7;             // 'san_alpha' = Use filter_var with FILTER_SANITIZE_STRING (do not use this for free text string)
36
-    const NO_HTML = 8;              // 'nohtml', 'alphanohtml' = check there is no html content
37
-    const ALPHA_NO_HTML = 9;              // 'nohtml', 'alphanohtml' = check there is no html content
38
-    const CUSTOM = 10;               // 'custom' = custom filter specify $filter and $options)
28
+    const NO_CHECK = 0; // 'none'=no check (only for param that should have very rich content)
29
+    const NUMERIC = 1; // 'int'=check it's numeric (integer or float)
30
+    const NUMBER_COMMA = 2; // 'intcomma'=check it's integer+comma ('1,2,3,4...')
31
+    const ALPHA = 3; // 'alpha'=check it's text and sign
32
+    const LETTERS_ONLY = 4; // 'aZ'=check it's a-z only
33
+    const LETTERS_AND_NUMBERS = 5; // 'aZ09'=check it's simple alpha string (recommended for keys)
34
+    const AN_ARRAY = 6; // 'array'=check it's array
35
+    const SANITIZE = 7; // 'san_alpha' = Use filter_var with FILTER_SANITIZE_STRING (do not use this for free text string)
36
+    const NO_HTML = 8; // 'nohtml', 'alphanohtml' = check there is no html content
37
+    const ALPHA_NO_HTML = 9; // 'nohtml', 'alphanohtml' = check there is no html content
38
+    const CUSTOM = 10; // 'custom' = custom filter specify $filter and $options)
39 39
 
40 40
     public static function get(string $variable, array $methods = [INPUT_GET, INPUT_POST], int $filter = NO_CHECK): string
41 41
     {
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
         if (empty($paramname))
178 178
             return 'BadFirstParameterForGETPOST';
179 179
         if (empty($check)) {
180
-            dol_syslog("Deprecated use of GETPOST, called with 1st param = " . $paramname . " and 2nd param is '', when calling page " . $_SERVER["PHP_SELF"], LOG_WARNING);
180
+            dol_syslog("Deprecated use of GETPOST, called with 1st param = ".$paramname." and 2nd param is '', when calling page ".$_SERVER["PHP_SELF"], LOG_WARNING);
181 181
 // Enable this line to know who call the GETPOST with '' $check parameter.
182 182
 //var_dump(debug_backtrace()[0]);
183 183
         }
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
             $relativepathstring = $_SERVER["PHP_SELF"];
200 200
 // Clean $relativepathstring
201 201
             if (constant('DOL_URL_ROOT'))
202
-                $relativepathstring = preg_replace('/^' . preg_quote(constant('DOL_URL_ROOT'), '/') . '/', '', $relativepathstring);
202
+                $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_URL_ROOT'), '/').'/', '', $relativepathstring);
203 203
             $relativepathstring = preg_replace('/^\//', '', $relativepathstring);
204 204
             $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring);
205 205
 //var_dump($relativepathstring);
@@ -207,8 +207,8 @@  discard block
 block discarded – undo
207 207
 // Code for search criteria persistence.
208 208
 // Retrieve values if restore_lastsearch_values
209 209
             if (!empty($_GET['restore_lastsearch_values'])) {        // Use $_GET here and not GETPOST
210
-                if (!empty($_SESSION['lastsearch_values_' . $relativepathstring])) { // If there is saved values
211
-                    $tmp = json_decode($_SESSION['lastsearch_values_' . $relativepathstring], true);
210
+                if (!empty($_SESSION['lastsearch_values_'.$relativepathstring])) { // If there is saved values
211
+                    $tmp = json_decode($_SESSION['lastsearch_values_'.$relativepathstring], true);
212 212
                     if (is_array($tmp)) {
213 213
                         foreach ($tmp as $key => $val) {
214 214
                             if ($key == $paramname) { // We are on the requested parameter
@@ -219,12 +219,12 @@  discard block
 block discarded – undo
219 219
                     }
220 220
                 }
221 221
 // If there is saved contextpage, page or limit
222
-                if ($paramname == 'contextpage' && !empty($_SESSION['lastsearch_contextpage_' . $relativepathstring])) {
223
-                    $out = $_SESSION['lastsearch_contextpage_' . $relativepathstring];
224
-                } elseif ($paramname == 'page' && !empty($_SESSION['lastsearch_page_' . $relativepathstring])) {
225
-                    $out = $_SESSION['lastsearch_page_' . $relativepathstring];
226
-                } elseif ($paramname == 'limit' && !empty($_SESSION['lastsearch_limit_' . $relativepathstring])) {
227
-                    $out = $_SESSION['lastsearch_limit_' . $relativepathstring];
222
+                if ($paramname == 'contextpage' && !empty($_SESSION['lastsearch_contextpage_'.$relativepathstring])) {
223
+                    $out = $_SESSION['lastsearch_contextpage_'.$relativepathstring];
224
+                } elseif ($paramname == 'page' && !empty($_SESSION['lastsearch_page_'.$relativepathstring])) {
225
+                    $out = $_SESSION['lastsearch_page_'.$relativepathstring];
226
+                } elseif ($paramname == 'limit' && !empty($_SESSION['lastsearch_limit_'.$relativepathstring])) {
227
+                    $out = $_SESSION['lastsearch_limit_'.$relativepathstring];
228 228
                 }
229 229
             }
230 230
 // Else, retreive default values if we are not doing a sort
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
                                             $qualified = 1;
293 293
 
294 294
                                         if ($qualified) {
295
-                                            $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ";", "=");  // we accept _, -, . and ,
295
+                                            $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ";", "="); // we accept _, -, . and ,
296 296
                                             foreach ($user->default_values[$relativepathstring]['sortorder'][$defkey] as $key => $val) {
297 297
                                                 if ($out)
298 298
                                                     $out .= ', ';
@@ -328,11 +328,11 @@  discard block
 block discarded – undo
328 328
                                         if (isset($_POST['sall']) || isset($_POST['search_all']) || isset($_GET['sall']) || isset($_GET['search_all'])) {
329 329
 // We made a search from quick search menu, do we still use default filter ?
330 330
                                             if (empty($conf->global->MAIN_DISABLE_DEFAULT_FILTER_FOR_QUICK_SEARCH)) {
331
-                                                $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ";", "=");  // we accept _, -, . and ,
331
+                                                $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ";", "="); // we accept _, -, . and ,
332 332
                                                 $out = dol_string_nospecial($user->default_values[$relativepathstring]['filters'][$defkey][$paramname], '', $forbidden_chars_to_replace);
333 333
                                             }
334 334
                                         } else {
335
-                                            $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ";", "=");  // we accept _, -, . and ,
335
+                                            $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ";", "="); // we accept _, -, . and ,
336 336
                                             $out = dol_string_nospecial($user->default_values[$relativepathstring]['filters'][$defkey][$paramname], '', $forbidden_chars_to_replace);
337 337
                                         }
338 338
                                         break;
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 // We do this only if var is a GET. If it is a POST, may be we want to post the text with vars as the setup text.
351 351
         if (!is_array($out) && empty($_POST[$paramname]) && empty($noreplace)) {
352 352
             $maxloop = 20;
353
-            $loopnb = 0;    // Protection against infinite loop
353
+            $loopnb = 0; // Protection against infinite loop
354 354
             while (preg_match('/__([A-Z0-9]+_?[A-Z0-9]+)__/i', $out, $reg) && ($loopnb < $maxloop)) {    // Detect '__ABCDEF__' as key 'ABCDEF' and '__ABC_DEF__' as key 'ABC_DEF'. Detection is also correct when 2 vars are side by side.
355 355
                 $loopnb++;
356 356
                 $newout = '';
@@ -395,9 +395,9 @@  discard block
 block discarded – undo
395 395
                 } elseif ($reg[1] == 'ENTITY_ID' || $reg[1] == 'ENTITYID') {
396 396
                     $newout = $conf->entity;
397 397
                 } else
398
-                    $newout = '';     // Key not found, we replace with empty string
398
+                    $newout = ''; // Key not found, we replace with empty string
399 399
 //var_dump('__'.$reg[1].'__ -> '.$newout);
400
-                $out = preg_replace('/__' . preg_quote($reg[1], '/') . '__/', $newout, $out);
400
+                $out = preg_replace('/__'.preg_quote($reg[1], '/').'__/', $newout, $out);
401 401
             }
402 402
         }
403 403
 
Please login to merge, or discard this patch.
dolibarr/htdocs/comm/action/index.php 2 patches
Spacing   +200 added lines, -200 removed lines patch added patch discarded remove patch
@@ -32,15 +32,15 @@  discard block
 block discarded – undo
32 32
  *  \ingroup    agenda
33 33
  *  \brief      Home page of calendar events
34 34
  */
35
-require DOL_BASE_PATH . '/main.inc.php';
35
+require DOL_BASE_PATH.'/main.inc.php';
36 36
 
37
-require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
38
-require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
39
-require_once DOL_DOCUMENT_ROOT . '/comm/action/class/actioncomm.class.php';
40
-require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
41
-require_once DOL_DOCUMENT_ROOT . '/core/lib/agenda.lib.php';
37
+require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
38
+require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
39
+require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
40
+require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
41
+require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
42 42
 if (!empty($conf->projet->enabled)) {
43
-    require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
43
+    require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
44 44
 }
45 45
 
46 46
 if (!isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW))
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 $week = GETPOST("week", "int") ? GETPOST("week", "int") : date("W");
98 98
 $day = GETPOST("day", "int") ? GETPOST("day", "int") : date("d");
99 99
 $pid = GETPOST("search_projectid", "int", 3) ? GETPOST("search_projectid", "int", 3) : GETPOST("projectid", "int", 3);
100
-$status = GETPOST("search_status", 'aZ09') ? GETPOST("search_status", 'aZ09') : GETPOST("status", 'aZ09');  // status may be 0, 50, 100, 'todo'
100
+$status = GETPOST("search_status", 'aZ09') ? GETPOST("search_status", 'aZ09') : GETPOST("status", 'aZ09'); // status may be 0, 50, 100, 'todo'
101 101
 $type = GETPOST("search_type", 'az09') ? GETPOST("search_type", 'az09') : GETPOST("type", 'az09');
102 102
 $maxprint = (isset($_GET["maxprint"]) ? GETPOST("maxprint") : $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW);
103 103
 // Set actioncode (this code must be same for setting actioncode into peruser, listacton and index)
@@ -152,11 +152,11 @@  discard block
 block discarded – undo
152 152
         foreach ($_POST as $key => $val) {
153 153
             if ($key == 'token')
154 154
                 continue;
155
-            $param .= '&' . $key . '=' . urlencode($val);
155
+            $param .= '&'.$key.'='.urlencode($val);
156 156
         }
157 157
     }
158 158
     //print $param;
159
-    header("Location: " . BASE_URI . '?controller=comm/action&method=list' . $param);
159
+    header("Location: ".BASE_URI.'?controller=comm/action&method=list'.$param);
160 160
     exit;
161 161
 }
162 162
 
@@ -166,11 +166,11 @@  discard block
 block discarded – undo
166 166
         foreach ($_POST as $key => $val) {
167 167
             if ($key == 'token')
168 168
                 continue;
169
-            $param .= '&' . $key . '=' . urlencode($val);
169
+            $param .= '&'.$key.'='.urlencode($val);
170 170
         }
171 171
     }
172 172
     //print $param;
173
-    header("Location: " . BASE_URI . '?controller=comm/action&method=peruser' . $param);
173
+    header("Location: ".BASE_URI.'?controller=comm/action&method=peruser'.$param);
174 174
     exit;
175 175
 }
176 176
 
@@ -205,11 +205,11 @@  discard block
 block discarded – undo
205 205
     $i = 0;
206 206
     while ($i < $MAXAGENDA) {
207 207
         $i++;
208
-        $source = 'AGENDA_EXT_SRC' . $i;
209
-        $name = 'AGENDA_EXT_NAME' . $i;
210
-        $offsettz = 'AGENDA_EXT_OFFSETTZ' . $i;
211
-        $color = 'AGENDA_EXT_COLOR' . $i;
212
-        $buggedfile = 'AGENDA_EXT_BUGGEDFILE' . $i;
208
+        $source = 'AGENDA_EXT_SRC'.$i;
209
+        $name = 'AGENDA_EXT_NAME'.$i;
210
+        $offsettz = 'AGENDA_EXT_OFFSETTZ'.$i;
211
+        $color = 'AGENDA_EXT_COLOR'.$i;
212
+        $buggedfile = 'AGENDA_EXT_BUGGEDFILE'.$i;
213 213
         if (!empty($conf->global->$source) && !empty($conf->global->$name)) {
214 214
             // Note: $conf->global->buggedfile can be empty or 'uselocalandtznodaylight' or 'uselocalandtzdaylight'
215 215
             $listofextcals[] = array('src' => $conf->global->$source, 'name' => $conf->global->$name, 'offsettz' => $conf->global->$offsettz, 'color' => $conf->global->$color, 'buggedfile' => (isset($conf->global->buggedfile) ? $conf->global->buggedfile : 0));
@@ -221,12 +221,12 @@  discard block
 block discarded – undo
221 221
     $i = 0;
222 222
     while ($i < $MAXAGENDA) {
223 223
         $i++;
224
-        $source = 'AGENDA_EXT_SRC_' . $user->id . '_' . $i;
225
-        $name = 'AGENDA_EXT_NAME_' . $user->id . '_' . $i;
226
-        $offsettz = 'AGENDA_EXT_OFFSETTZ_' . $user->id . '_' . $i;
227
-        $color = 'AGENDA_EXT_COLOR_' . $user->id . '_' . $i;
228
-        $enabled = 'AGENDA_EXT_ENABLED_' . $user->id . '_' . $i;
229
-        $buggedfile = 'AGENDA_EXT_BUGGEDFILE_' . $user->id . '_' . $i;
224
+        $source = 'AGENDA_EXT_SRC_'.$user->id.'_'.$i;
225
+        $name = 'AGENDA_EXT_NAME_'.$user->id.'_'.$i;
226
+        $offsettz = 'AGENDA_EXT_OFFSETTZ_'.$user->id.'_'.$i;
227
+        $color = 'AGENDA_EXT_COLOR_'.$user->id.'_'.$i;
228
+        $enabled = 'AGENDA_EXT_ENABLED_'.$user->id.'_'.$i;
229
+        $buggedfile = 'AGENDA_EXT_BUGGEDFILE_'.$user->id.'_'.$i;
230 230
         if (!empty($user->conf->$source) && !empty($user->conf->$name)) {
231 231
             // Note: $conf->global->buggedfile can be empty or 'uselocalandtznodaylight' or 'uselocalandtzdaylight'
232 232
             $listofextcals[] = array('src' => $user->conf->$source, 'name' => $user->conf->$name, 'offsettz' => $user->conf->$offsettz, 'color' => $user->conf->$color, 'buggedfile' => (isset($user->conf->buggedfile) ? $user->conf->buggedfile : 0));
@@ -242,10 +242,10 @@  discard block
 block discarded – undo
242 242
     $next_year = $next['year'];
243 243
     $next_month = $next['month'];
244 244
 
245
-    $max_day_in_prev_month = date("t", dol_mktime(0, 0, 0, $prev_month, 1, $prev_year));  // Nb of days in previous month
246
-    $max_day_in_month = date("t", dol_mktime(0, 0, 0, $month, 1, $year));                 // Nb of days in next month
245
+    $max_day_in_prev_month = date("t", dol_mktime(0, 0, 0, $prev_month, 1, $prev_year)); // Nb of days in previous month
246
+    $max_day_in_month = date("t", dol_mktime(0, 0, 0, $month, 1, $year)); // Nb of days in next month
247 247
     // tmpday is a negative or null cursor to know how many days before the 1st to show on month view (if tmpday=0, 1st is monday)
248
-    $tmpday = -date("w", dol_mktime(12, 0, 0, $month, 1, $year, true)) + 2;  // date('w') is 0 fo sunday
248
+    $tmpday = -date("w", dol_mktime(12, 0, 0, $month, 1, $year, true)) + 2; // date('w') is 0 fo sunday
249 249
     $tmpday += ((isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK : 1) - 1);
250 250
     if ($tmpday >= 1)
251 251
         $tmpday -= 7; // If tmpday is 0 we start with sunday, if -6, we start with monday of previous week.
@@ -312,60 +312,60 @@  discard block
 block discarded – undo
312 312
 if ($actioncode || isset($_GET['search_actioncode']) || isset($_POST['search_actioncode'])) {
313 313
     if (is_array($actioncode)) {
314 314
         foreach ($actioncode as $str_action)
315
-            $param .= "&search_actioncode[]=" . urlencode($str_action);
315
+            $param .= "&search_actioncode[]=".urlencode($str_action);
316 316
     } else
317
-        $param .= "&search_actioncode=" . urlencode($actioncode);
317
+        $param .= "&search_actioncode=".urlencode($actioncode);
318 318
 }
319 319
 if ($resourceid > 0)
320
-    $param .= "&search_resourceid=" . urlencode($resourceid);
320
+    $param .= "&search_resourceid=".urlencode($resourceid);
321 321
 if ($status || isset($_GET['status']) || isset($_POST['status']))
322
-    $param .= "&search_status=" . urlencode($status);
322
+    $param .= "&search_status=".urlencode($status);
323 323
 if ($filter)
324
-    $param .= "&search_filter=" . urlencode($filter);
324
+    $param .= "&search_filter=".urlencode($filter);
325 325
 if ($filtert)
326
-    $param .= "&search_filtert=" . urlencode($filtert);
326
+    $param .= "&search_filtert=".urlencode($filtert);
327 327
 if ($usergroup)
328
-    $param .= "&search_usergroup=" . urlencode($usergroup);
328
+    $param .= "&search_usergroup=".urlencode($usergroup);
329 329
 if ($socid)
330
-    $param .= "&search_socid=" . urlencode($socid);
330
+    $param .= "&search_socid=".urlencode($socid);
331 331
 if ($showbirthday)
332 332
     $param .= "&search_showbirthday=1";
333 333
 if ($pid)
334
-    $param .= "&search_projectid=" . urlencode($pid);
334
+    $param .= "&search_projectid=".urlencode($pid);
335 335
 if ($type)
336
-    $param .= "&search_type=" . urlencode($type);
336
+    $param .= "&search_type=".urlencode($type);
337 337
 if ($action == 'show_day' || $action == 'show_week' || $action == 'show_month')
338
-    $param .= '&action=' . urlencode($action);
339
-$param .= "&maxprint=" . urlencode($maxprint);
338
+    $param .= '&action='.urlencode($action);
339
+$param .= "&maxprint=".urlencode($maxprint);
340 340
 
341 341
 // Show navigation bar
342 342
 if (empty($action) || $action == 'show_month') {
343
-    $nav = "<a href=\"?year=" . $prev_year . "&amp;month=" . $prev_month . $param . "\"><i class=\"fa fa-chevron-left\"></i></a> &nbsp;\n";
344
-    $nav .= " <span id=\"month_name\">" . dol_print_date(dol_mktime(0, 0, 0, $month, 1, $year), "%b %Y");
343
+    $nav = "<a href=\"?year=".$prev_year."&amp;month=".$prev_month.$param."\"><i class=\"fa fa-chevron-left\"></i></a> &nbsp;\n";
344
+    $nav .= " <span id=\"month_name\">".dol_print_date(dol_mktime(0, 0, 0, $month, 1, $year), "%b %Y");
345 345
     $nav .= " </span>\n";
346
-    $nav .= " &nbsp; <a href=\"?year=" . $next_year . "&amp;month=" . $next_month . $param . "\"><i class=\"fa fa-chevron-right\"></i></a>\n";
347
-    $nav .= " &nbsp; (<a href=\"?year=" . $nowyear . "&amp;month=" . $nowmonth . $param . "\">" . $langs->trans("Today") . "</a>)";
346
+    $nav .= " &nbsp; <a href=\"?year=".$next_year."&amp;month=".$next_month.$param."\"><i class=\"fa fa-chevron-right\"></i></a>\n";
347
+    $nav .= " &nbsp; (<a href=\"?year=".$nowyear."&amp;month=".$nowmonth.$param."\">".$langs->trans("Today")."</a>)";
348 348
     $picto = 'calendar';
349 349
 }
350 350
 if ($action == 'show_week') {
351
-    $nav = "<a href=\"?year=" . $prev_year . "&amp;month=" . $prev_month . "&amp;day=" . $prev_day . $param . "\"><i class=\"fa fa-chevron-left\" title=\"" . dol_escape_htmltag($langs->trans("Previous")) . "\"></i></a> &nbsp;\n";
352
-    $nav .= " <span id=\"month_name\">" . dol_print_date(dol_mktime(0, 0, 0, $first_month, $first_day, $first_year), "%Y") . ", " . $langs->trans("Week") . " " . $week;
351
+    $nav = "<a href=\"?year=".$prev_year."&amp;month=".$prev_month."&amp;day=".$prev_day.$param."\"><i class=\"fa fa-chevron-left\" title=\"".dol_escape_htmltag($langs->trans("Previous"))."\"></i></a> &nbsp;\n";
352
+    $nav .= " <span id=\"month_name\">".dol_print_date(dol_mktime(0, 0, 0, $first_month, $first_day, $first_year), "%Y").", ".$langs->trans("Week")." ".$week;
353 353
     $nav .= " </span>\n";
354
-    $nav .= " &nbsp; <a href=\"?year=" . $next_year . "&amp;month=" . $next_month . "&amp;day=" . $next_day . $param . "\"><i class=\"fa fa-chevron-right\" title=\"" . dol_escape_htmltag($langs->trans("Next")) . "\"></i></a>\n";
355
-    $nav .= " &nbsp; (<a href=\"?year=" . $nowyear . "&amp;month=" . $nowmonth . "&amp;day=" . $nowday . $param . "\">" . $langs->trans("Today") . "</a>)";
354
+    $nav .= " &nbsp; <a href=\"?year=".$next_year."&amp;month=".$next_month."&amp;day=".$next_day.$param."\"><i class=\"fa fa-chevron-right\" title=\"".dol_escape_htmltag($langs->trans("Next"))."\"></i></a>\n";
355
+    $nav .= " &nbsp; (<a href=\"?year=".$nowyear."&amp;month=".$nowmonth."&amp;day=".$nowday.$param."\">".$langs->trans("Today")."</a>)";
356 356
     $picto = 'calendarweek';
357 357
 }
358 358
 if ($action == 'show_day') {
359
-    $nav = "<a href=\"?year=" . $prev_year . "&amp;month=" . $prev_month . "&amp;day=" . $prev_day . $param . "\"><i class=\"fa fa-chevron-left\"></i></a> &nbsp;\n";
360
-    $nav .= " <span id=\"month_name\">" . dol_print_date(dol_mktime(0, 0, 0, $month, $day, $year), "daytextshort");
359
+    $nav = "<a href=\"?year=".$prev_year."&amp;month=".$prev_month."&amp;day=".$prev_day.$param."\"><i class=\"fa fa-chevron-left\"></i></a> &nbsp;\n";
360
+    $nav .= " <span id=\"month_name\">".dol_print_date(dol_mktime(0, 0, 0, $month, $day, $year), "daytextshort");
361 361
     $nav .= " </span>\n";
362
-    $nav .= " &nbsp; <a href=\"?year=" . $next_year . "&amp;month=" . $next_month . "&amp;day=" . $next_day . $param . "\"><i class=\"fa fa-chevron-right\"></i></a>\n";
363
-    $nav .= " &nbsp; (<a href=\"?year=" . $nowyear . "&amp;month=" . $nowmonth . "&amp;day=" . $nowday . $param . "\">" . $langs->trans("Today") . "</a>)";
362
+    $nav .= " &nbsp; <a href=\"?year=".$next_year."&amp;month=".$next_month."&amp;day=".$next_day.$param."\"><i class=\"fa fa-chevron-right\"></i></a>\n";
363
+    $nav .= " &nbsp; (<a href=\"?year=".$nowyear."&amp;month=".$nowmonth."&amp;day=".$nowday.$param."\">".$langs->trans("Today")."</a>)";
364 364
     $picto = 'calendarday';
365 365
 }
366 366
 
367 367
 // Must be after the nav definition
368
-$param .= '&year=' . $year . '&month=' . $month . ($day ? '&day=' . $day : '');
368
+$param .= '&year='.$year.'&month='.$month.($day ? '&day='.$day : '');
369 369
 //print 'x'.$param;
370 370
 
371 371
 
@@ -385,10 +385,10 @@  discard block
 block discarded – undo
385 385
 
386 386
 $head = calendars_prepare_head($paramnoaction);
387 387
 
388
-print '<form method="POST" id="searchFormList" class="listactionsfilter" action="' . $_SERVER["PHP_SELF"] . '">' . "\n";
388
+print '<form method="POST" id="searchFormList" class="listactionsfilter" action="'.$_SERVER["PHP_SELF"].'">'."\n";
389 389
 if ($optioncss != '')
390
-    print '<input type="hidden" name="optioncss" value="' . $optioncss . '">';
391
-print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
390
+    print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
391
+print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
392 392
 
393 393
 dol_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action');
394 394
 print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, 0, $filtert, 0, $pid, $socid, $action, $listofextcals, $actioncode, $usergroup, '', $resourceid);
@@ -402,50 +402,50 @@  discard block
 block discarded – undo
402 402
 $showextcals = $listofextcals;
403 403
 
404 404
 if (!empty($conf->use_javascript_ajax)) { // If javascript on
405
-    $s .= "\n" . '<!-- Div to calendars selectors -->' . "\n";
406
-    $s .= '<script type="text/javascript">' . "\n";
407
-    $s .= 'jQuery(document).ready(function () {' . "\n";
408
-    $s .= 'jQuery("#check_birthday").click(function() { console.log("Toggle birthday"); jQuery(".family_birthday").toggle(); });' . "\n";
409
-    $s .= 'jQuery(".family_birthday").toggle();' . "\n";
405
+    $s .= "\n".'<!-- Div to calendars selectors -->'."\n";
406
+    $s .= '<script type="text/javascript">'."\n";
407
+    $s .= 'jQuery(document).ready(function () {'."\n";
408
+    $s .= 'jQuery("#check_birthday").click(function() { console.log("Toggle birthday"); jQuery(".family_birthday").toggle(); });'."\n";
409
+    $s .= 'jQuery(".family_birthday").toggle();'."\n";
410 410
     if ($action == "show_week" || $action == "show_month" || empty($action)) {
411 411
         // Code to enable drag and drop
412
-        $s .= 'jQuery( "div.sortable" ).sortable({connectWith: ".sortable", placeholder: "ui-state-highlight", items: "div.movable", receive: function( event, ui ) {' . "\n";
412
+        $s .= 'jQuery( "div.sortable" ).sortable({connectWith: ".sortable", placeholder: "ui-state-highlight", items: "div.movable", receive: function( event, ui ) {'."\n";
413 413
         // Code to submit form
414
-        $s .= 'console.log("submit form to record new event");' . "\n";
414
+        $s .= 'console.log("submit form to record new event");'."\n";
415 415
         //$s.='console.log(event.target);';
416
-        $s .= 'var newval = jQuery(event.target).closest("div.dayevent").attr("id");' . "\n";
417
-        $s .= 'console.log("found parent div.dayevent with id = "+newval);' . "\n";
418
-        $s .= 'var frm=jQuery("#searchFormList");' . "\n";
419
-        $s .= 'var newurl = ui.item.find("a.cal_event").attr("href");' . "\n";
420
-        $s .= 'console.log(newurl);' . "\n";
421
-        $s .= 'frm.attr("action", newurl).children("#newdate").val(newval);frm.submit();}' . "\n";
422
-        $s .= '});' . "\n";
416
+        $s .= 'var newval = jQuery(event.target).closest("div.dayevent").attr("id");'."\n";
417
+        $s .= 'console.log("found parent div.dayevent with id = "+newval);'."\n";
418
+        $s .= 'var frm=jQuery("#searchFormList");'."\n";
419
+        $s .= 'var newurl = ui.item.find("a.cal_event").attr("href");'."\n";
420
+        $s .= 'console.log(newurl);'."\n";
421
+        $s .= 'frm.attr("action", newurl).children("#newdate").val(newval);frm.submit();}'."\n";
422
+        $s .= '});'."\n";
423 423
     }
424
-    $s .= '});' . "\n";
425
-    $s .= '</script>' . "\n";
424
+    $s .= '});'."\n";
425
+    $s .= '</script>'."\n";
426 426
 
427 427
     // Local calendar
428
-    $s .= '<div class="nowrap clear inline-block minheight20"><input type="checkbox" id="check_mytasks" name="check_mytasks" checked disabled> ' . $langs->trans("LocalAgenda") . ' &nbsp; </div>';
428
+    $s .= '<div class="nowrap clear inline-block minheight20"><input type="checkbox" id="check_mytasks" name="check_mytasks" checked disabled> '.$langs->trans("LocalAgenda").' &nbsp; </div>';
429 429
 
430 430
     // External calendars
431 431
     if (is_array($showextcals) && count($showextcals) > 0) {
432
-        $s .= '<script type="text/javascript">' . "\n";
432
+        $s .= '<script type="text/javascript">'."\n";
433 433
         $s .= 'jQuery(document).ready(function () {
434 434
 				jQuery("table input[name^=\"check_ext\"]").click(function() {
435 435
 					var name = $(this).attr("name");
436 436
 					jQuery(".family_ext" + name.replace("check_ext", "")).toggle();
437 437
 				});
438 438
 			});' . "\n";
439
-        $s .= '</script>' . "\n";
439
+        $s .= '</script>'."\n";
440 440
 
441 441
         foreach ($showextcals as $val) {
442 442
             $htmlname = md5($val['name']);
443
-            $s .= '<div class="nowrap inline-block"><input type="checkbox" id="check_ext' . $htmlname . '" name="check_ext' . $htmlname . '" checked> ' . $val['name'] . ' &nbsp; </div>';
443
+            $s .= '<div class="nowrap inline-block"><input type="checkbox" id="check_ext'.$htmlname.'" name="check_ext'.$htmlname.'" checked> '.$val['name'].' &nbsp; </div>';
444 444
         }
445 445
     }
446 446
 
447 447
     // Birthdays
448
-    $s .= '<div class="nowrap inline-block"><input type="checkbox" id="check_birthday" name="check_birthday"> ' . $langs->trans("AgendaShowBirthdayEvents") . ' &nbsp; </div>';
448
+    $s .= '<div class="nowrap inline-block"><input type="checkbox" id="check_birthday" name="check_birthday"> '.$langs->trans("AgendaShowBirthdayEvents").' &nbsp; </div>';
449 449
 
450 450
     // Calendars from hooks
451 451
     $parameters = array();
@@ -457,12 +457,12 @@  discard block
 block discarded – undo
457 457
         $s = $hookmanager->resPrint;
458 458
     }
459 459
 } else {          // If javascript off
460
-    $newparam = $param;   // newparam is for birthday links
461
-    $newparam = preg_replace('/showbirthday=[0-1]/i', 'showbirthday=' . (empty($showbirthday) ? 1 : 0), $newparam);
460
+    $newparam = $param; // newparam is for birthday links
461
+    $newparam = preg_replace('/showbirthday=[0-1]/i', 'showbirthday='.(empty($showbirthday) ? 1 : 0), $newparam);
462 462
     if (!preg_match('/showbirthday=/i', $newparam))
463 463
         $newparam .= '&showbirthday=1';
464
-    $link = '<a href="' . dol_escape_htmltag($_SERVER['PHP_SELF']);
465
-    $link .= '?' . dol_escape_htmltag($newparam);
464
+    $link = '<a href="'.dol_escape_htmltag($_SERVER['PHP_SELF']);
465
+    $link .= '?'.dol_escape_htmltag($newparam);
466 466
     $link .= '">';
467 467
     if (empty($showbirthday))
468 468
         $link .= $langs->trans("AgendaShowBirthdayEvents");
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
     $link .= '</a>';
472 472
 }
473 473
 
474
-print load_fiche_titre($s, $link . ' &nbsp; &nbsp; ' . $nav, '', 0, 0, 'tablelistofcalendars');
474
+print load_fiche_titre($s, $link.' &nbsp; &nbsp; '.$nav, '', 0, 0, 'tablelistofcalendars');
475 475
 
476 476
 
477 477
 // Load events from database into $eventarray
@@ -489,19 +489,19 @@  discard block
 block discarded – undo
489 489
 $sql .= ' a.fk_soc, a.fk_contact,';
490 490
 $sql .= ' a.fk_element, a.elementtype,';
491 491
 $sql .= ' ca.code as type_code, ca.libelle as type_label, ca.color as type_color';
492
-$sql .= ' FROM ' . MAIN_DB_PREFIX . 'c_actioncomm as ca, ' . MAIN_DB_PREFIX . "actioncomm as a";
492
+$sql .= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a";
493 493
 if (!$user->rights->societe->client->voir && !$socid)
494
-    $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
494
+    $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
495 495
 // We must filter on resource table
496 496
 if ($resourceid > 0)
497
-    $sql .= ", " . MAIN_DB_PREFIX . "element_resources as r";
497
+    $sql .= ", ".MAIN_DB_PREFIX."element_resources as r";
498 498
 // We must filter on assignement table
499 499
 if ($filtert > 0 || $usergroup > 0)
500
-    $sql .= ", " . MAIN_DB_PREFIX . "actioncomm_resources as ar";
500
+    $sql .= ", ".MAIN_DB_PREFIX."actioncomm_resources as ar";
501 501
 if ($usergroup > 0)
502
-    $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "usergroup_user as ugu ON ugu.fk_user = ar.fk_element";
502
+    $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element";
503 503
 $sql .= ' WHERE a.fk_action = ca.id';
504
-$sql .= ' AND a.entity IN (' . getEntity('agenda') . ')';
504
+$sql .= ' AND a.entity IN ('.getEntity('agenda').')';
505 505
 // Condition on actioncode
506 506
 if (!empty($actioncode)) {
507 507
     if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
@@ -523,50 +523,50 @@  discard block
 block discarded – undo
523 523
             $sql .= " AND ca.type = 'systemauto'";
524 524
         else {
525 525
             if (is_array($actioncode)) {
526
-                $sql .= " AND ca.code IN ('" . implode("','", $actioncode) . "')";
526
+                $sql .= " AND ca.code IN ('".implode("','", $actioncode)."')";
527 527
             } else {
528
-                $sql .= " AND ca.code IN ('" . implode("','", explode(',', $actioncode)) . "')";
528
+                $sql .= " AND ca.code IN ('".implode("','", explode(',', $actioncode))."')";
529 529
             }
530 530
         }
531 531
     }
532 532
 }
533 533
 if ($resourceid > 0)
534
-    $sql .= " AND r.element_type = 'action' AND r.element_id = a.id AND r.resource_id = " . $db->escape($resourceid);
534
+    $sql .= " AND r.element_type = 'action' AND r.element_id = a.id AND r.resource_id = ".$db->escape($resourceid);
535 535
 if ($pid)
536
-    $sql .= " AND a.fk_project=" . $db->escape($pid);
536
+    $sql .= " AND a.fk_project=".$db->escape($pid);
537 537
 if (!$user->rights->societe->client->voir && !$socid)
538
-    $sql .= " AND (a.fk_soc IS NULL OR sc.fk_user = " . $user->id . ")";
538
+    $sql .= " AND (a.fk_soc IS NULL OR sc.fk_user = ".$user->id.")";
539 539
 if ($socid > 0)
540
-    $sql .= ' AND a.fk_soc = ' . $socid;
540
+    $sql .= ' AND a.fk_soc = '.$socid;
541 541
 // We must filter on assignement table
542 542
 if ($filtert > 0 || $usergroup > 0)
543 543
     $sql .= " AND ar.fk_actioncomm = a.id AND ar.element_type='user'";
544 544
 if ($action == 'show_day') {
545 545
     $sql .= " AND (";
546
-    $sql .= " (a.datep BETWEEN '" . $db->idate(dol_mktime(0, 0, 0, $month, $day, $year)) . "'";
547
-    $sql .= " AND '" . $db->idate(dol_mktime(23, 59, 59, $month, $day, $year)) . "')";
546
+    $sql .= " (a.datep BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."'";
547
+    $sql .= " AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."')";
548 548
     $sql .= " OR ";
549
-    $sql .= " (a.datep2 BETWEEN '" . $db->idate(dol_mktime(0, 0, 0, $month, $day, $year)) . "'";
550
-    $sql .= " AND '" . $db->idate(dol_mktime(23, 59, 59, $month, $day, $year)) . "')";
549
+    $sql .= " (a.datep2 BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."'";
550
+    $sql .= " AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."')";
551 551
     $sql .= " OR ";
552
-    $sql .= " (a.datep < '" . $db->idate(dol_mktime(0, 0, 0, $month, $day, $year)) . "'";
553
-    $sql .= " AND a.datep2 > '" . $db->idate(dol_mktime(23, 59, 59, $month, $day, $year)) . "')";
552
+    $sql .= " (a.datep < '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."'";
553
+    $sql .= " AND a.datep2 > '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."')";
554 554
     $sql .= ')';
555 555
 } else {
556 556
     // To limit array
557 557
     $sql .= " AND (";
558
-    $sql .= " (a.datep BETWEEN '" . $db->idate(dol_mktime(0, 0, 0, $month, 1, $year) - (60 * 60 * 24 * 7)) . "'";   // Start 7 days before
559
-    $sql .= " AND '" . $db->idate(dol_mktime(23, 59, 59, $month, 28, $year) + (60 * 60 * 24 * 10)) . "')";            // End 7 days after + 3 to go from 28 to 31
558
+    $sql .= " (a.datep BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, 1, $year) - (60 * 60 * 24 * 7))."'"; // Start 7 days before
559
+    $sql .= " AND '".$db->idate(dol_mktime(23, 59, 59, $month, 28, $year) + (60 * 60 * 24 * 10))."')"; // End 7 days after + 3 to go from 28 to 31
560 560
     $sql .= " OR ";
561
-    $sql .= " (a.datep2 BETWEEN '" . $db->idate(dol_mktime(0, 0, 0, $month, 1, $year) - (60 * 60 * 24 * 7)) . "'";
562
-    $sql .= " AND '" . $db->idate(dol_mktime(23, 59, 59, $month, 28, $year) + (60 * 60 * 24 * 10)) . "')";
561
+    $sql .= " (a.datep2 BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, 1, $year) - (60 * 60 * 24 * 7))."'";
562
+    $sql .= " AND '".$db->idate(dol_mktime(23, 59, 59, $month, 28, $year) + (60 * 60 * 24 * 10))."')";
563 563
     $sql .= " OR ";
564
-    $sql .= " (a.datep < '" . $db->idate(dol_mktime(0, 0, 0, $month, 1, $year) - (60 * 60 * 24 * 7)) . "'";
565
-    $sql .= " AND a.datep2 > '" . $db->idate(dol_mktime(23, 59, 59, $month, 28, $year) + (60 * 60 * 24 * 10)) . "')";
564
+    $sql .= " (a.datep < '".$db->idate(dol_mktime(0, 0, 0, $month, 1, $year) - (60 * 60 * 24 * 7))."'";
565
+    $sql .= " AND a.datep2 > '".$db->idate(dol_mktime(23, 59, 59, $month, 28, $year) + (60 * 60 * 24 * 10))."')";
566 566
     $sql .= ')';
567 567
 }
568 568
 if ($type)
569
-    $sql .= " AND ca.id = " . $type;
569
+    $sql .= " AND ca.id = ".$type;
570 570
 if ($status == '0') {
571 571
     $sql .= " AND a.percent = 0";
572 572
 }
@@ -586,9 +586,9 @@  discard block
 block discarded – undo
586 586
 if ($filtert > 0 || $usergroup > 0) {
587 587
     $sql .= " AND (";
588 588
     if ($filtert > 0)
589
-        $sql .= "ar.fk_element = " . $filtert;
589
+        $sql .= "ar.fk_element = ".$filtert;
590 590
     if ($usergroup > 0)
591
-        $sql .= ($filtert > 0 ? " OR " : "") . " ugu.fk_usergroup = " . $usergroup;
591
+        $sql .= ($filtert > 0 ? " OR " : "")." ugu.fk_usergroup = ".$usergroup;
592 592
     $sql .= ")";
593 593
 }
594 594
 // Sort on date
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
 if ($resql) {
602 602
     $num = $db->num_rows($resql);
603 603
 
604
-    $MAXONSAMEPAGE = 10000;   // Useless to have more. Protection to avoid memory overload when high number of event (for example after a mass import)
604
+    $MAXONSAMEPAGE = 10000; // Useless to have more. Protection to avoid memory overload when high number of event (for example after a mass import)
605 605
     $i = 0;
606 606
     while ($i < $num && $i < $MAXONSAMEPAGE) {
607 607
         $obj = $db->fetch_object($resql);
@@ -616,7 +616,7 @@  discard block
 block discarded – undo
616 616
         $event = new ActionComm($db);
617 617
         $event->id = $obj->id;
618 618
 
619
-        $event->datep = $db->jdate($obj->datep);      // datep and datef are GMT date. Example: 1970-01-01 01:00:00, jdate will return 0 if TZ of PHP server is Europe/Berlin
619
+        $event->datep = $db->jdate($obj->datep); // datep and datef are GMT date. Example: 1970-01-01 01:00:00, jdate will return 0 if TZ of PHP server is Europe/Berlin
620 620
         $event->datef = $db->jdate($obj->datep2);
621 621
         //var_dump($obj->datep);
622 622
         //var_dump($event->datep);
@@ -628,9 +628,9 @@  discard block
 block discarded – undo
628 628
         $event->libelle = $obj->label;
629 629
         $event->label = $obj->label;
630 630
         $event->percentage = $obj->percent;
631
-        $event->authorid = $obj->fk_user_author;  // user id of creator
631
+        $event->authorid = $obj->fk_user_author; // user id of creator
632 632
         $event->userownerid = $obj->fk_user_action; // user id of owner
633
-        $event->fetch_userassigned();    // This load $event->userassigned
633
+        $event->fetch_userassigned(); // This load $event->userassigned
634 634
         $event->priority = $obj->priority;
635 635
         $event->fulldayevent = $obj->fulldayevent;
636 636
         $event->location = $obj->location;
@@ -710,14 +710,14 @@  discard block
 block discarded – undo
710 710
 if ($showbirthday) {
711 711
     // Add events in array
712 712
     $sql = 'SELECT sp.rowid, sp.lastname, sp.firstname, sp.birthday';
713
-    $sql .= ' FROM ' . MAIN_DB_PREFIX . 'socpeople as sp';
714
-    $sql .= ' WHERE (priv=0 OR (priv=1 AND fk_user_creat=' . $user->id . '))';
715
-    $sql .= " AND sp.entity IN (" . getEntity('socpeople') . ")";
713
+    $sql .= ' FROM '.MAIN_DB_PREFIX.'socpeople as sp';
714
+    $sql .= ' WHERE (priv=0 OR (priv=1 AND fk_user_creat='.$user->id.'))';
715
+    $sql .= " AND sp.entity IN (".getEntity('socpeople').")";
716 716
     if ($action == 'show_day') {
717
-        $sql .= ' AND MONTH(birthday) = ' . $month;
718
-        $sql .= ' AND DAY(birthday) = ' . $day;
717
+        $sql .= ' AND MONTH(birthday) = '.$month;
718
+        $sql .= ' AND DAY(birthday) = '.$day;
719 719
     } else {
720
-        $sql .= ' AND MONTH(birthday) = ' . $month;
720
+        $sql .= ' AND MONTH(birthday) = '.$month;
721 721
     }
722 722
     $sql .= ' ORDER BY birthday';
723 723
 
@@ -733,10 +733,10 @@  discard block
 block discarded – undo
733 733
             $datebirth = dol_stringtotime($obj->birthday, 1);
734 734
             //print 'ee'.$obj->birthday.'-'.$datebirth;
735 735
             $datearray = dol_getdate($datebirth, true);
736
-            $event->datep = dol_mktime(0, 0, 0, $datearray['mon'], $datearray['mday'], $year, true);    // For full day events, date are also GMT but they wont but converted during output
736
+            $event->datep = dol_mktime(0, 0, 0, $datearray['mon'], $datearray['mday'], $year, true); // For full day events, date are also GMT but they wont but converted during output
737 737
             $event->datef = $event->datep;
738 738
             $event->type_code = 'BIRTHDAY';
739
-            $event->libelle = $langs->trans("Birthday") . ' ' . dolGetFirstLastname($obj->firstname, $obj->lastname);
739
+            $event->libelle = $langs->trans("Birthday").' '.dolGetFirstLastname($obj->firstname, $obj->lastname);
740 740
             $event->percentage = 100;
741 741
             $event->fulldayevent = 1;
742 742
 
@@ -769,9 +769,9 @@  discard block
 block discarded – undo
769 769
 
770 770
 // Complete $eventarray with external import Ical
771 771
 if (count($listofextcals)) {
772
-    require_once DOL_DOCUMENT_ROOT . '/comm/action/class/ical.class.php';
772
+    require_once DOL_DOCUMENT_ROOT.'/comm/action/class/ical.class.php';
773 773
     foreach ($listofextcals as $extcal) {
774
-        $url = $extcal['src'];    // Example: https://www.google.com/calendar/ical/eldy10%40gmail.com/private-cde92aa7d7e0ef6110010a821a2aaeb/basic.ics
774
+        $url = $extcal['src']; // Example: https://www.google.com/calendar/ical/eldy10%40gmail.com/private-cde92aa7d7e0ef6110010a821a2aaeb/basic.ics
775 775
         $namecal = $extcal['name'];
776 776
         $offsettz = $extcal['offsettz'];
777 777
         $colorcal = $extcal['color'];
@@ -784,9 +784,9 @@  discard block
 block discarded – undo
784 784
         //var_dump($ical->cal); exit;
785 785
         $icalevents = array();
786 786
         if (is_array($ical->get_event_list()))
787
-            $icalevents = array_merge($icalevents, $ical->get_event_list());        // Add $ical->cal['VEVENT']
787
+            $icalevents = array_merge($icalevents, $ical->get_event_list()); // Add $ical->cal['VEVENT']
788 788
         if (is_array($ical->get_freebusy_list()))
789
-            $icalevents = array_merge($icalevents, $ical->get_freebusy_list());  // Add $ical->cal['VFREEBUSY']
789
+            $icalevents = array_merge($icalevents, $ical->get_freebusy_list()); // Add $ical->cal['VFREEBUSY']
790 790
 
791 791
         if (count($icalevents) > 0) {
792 792
             // Duplicate all repeatable events into new entries
@@ -797,7 +797,7 @@  discard block
 block discarded – undo
797 797
                     //if ($event->date_end_in_calendar > $lastdaytoshow) $event->date_end_in_calendar=($lastdaytoshow-1);
798 798
                     if ($icalevent['DTSTART;VALUE=DATE']) { //fullday event
799 799
                         $datecurstart = dol_stringtotime($icalevent['DTSTART;VALUE=DATE'], 1);
800
-                        $datecurend = dol_stringtotime($icalevent['DTEND;VALUE=DATE'], 1) - 1;  // We remove one second to get last second of day
800
+                        $datecurend = dol_stringtotime($icalevent['DTEND;VALUE=DATE'], 1) - 1; // We remove one second to get last second of day
801 801
                     } else if (is_array($icalevent['DTSTART']) && !empty($icalevent['DTSTART']['unixtime'])) {
802 802
                         $datecurstart = $icalevent['DTSTART']['unixtime'];
803 803
                         $datecurend = $icalevent['DTEND']['unixtime'];
@@ -832,9 +832,9 @@  discard block
 block discarded – undo
832 832
                     $until = empty($icalevent['RRULE']['UNTIL']) ? 0 : dol_stringtotime($icalevent['RRULE']['UNTIL'], 1);
833 833
                     $maxrepeat = empty($icalevent['RRULE']['COUNT']) ? 0 : $icalevent['RRULE']['COUNT'];
834 834
                     if ($until && ($until + ($datecurend - $datecurstart)) < $firstdaytoshow)
835
-                        continue;  // We discard repeatable event that end before start date to show
835
+                        continue; // We discard repeatable event that end before start date to show
836 836
                     if ($datecurstart >= $lastdaytoshow)
837
-                        continue;                                   // We discard repeatable event that start after end date to show
837
+                        continue; // We discard repeatable event that start after end date to show
838 838
 
839 839
                     $numofevent = 0;
840 840
                     while (($datecurstart < $lastdaytoshow) && (empty($maxrepeat) || ($numofevent < $maxrepeat))) {
@@ -869,7 +869,7 @@  discard block
 block discarded – undo
869 869
                         }
870 870
                         // Test to avoid infinite loop ($datecurstart must increase)
871 871
                         if ($savdatecurstart >= $datecurstart) {
872
-                            dol_syslog("Found a rule freq " . $icalevent['RRULE']['FREQ'] . " not managed by dolibarr code. Assume 1 week frequency.", LOG_ERR);
872
+                            dol_syslog("Found a rule freq ".$icalevent['RRULE']['FREQ']." not managed by dolibarr code. Assume 1 week frequency.", LOG_ERR);
873 873
                             $datecurstart += 3600 * 24 * 7;
874 874
                             $datecurend += 3600 * 24 * 7;
875 875
                         }
@@ -883,7 +883,7 @@  discard block
 block discarded – undo
883 883
                 //var_dump($icalevent);
884 884
                 //print $icalevent['SUMMARY'].'->'.var_dump($icalevent).'<br>';exit;
885 885
                 if (!empty($icalevent['RRULE']))
886
-                    continue;    // We found a repeatable event. It was already split into unitary events, so we discard general rule.
886
+                    continue; // We found a repeatable event. It was already split into unitary events, so we discard general rule.
887 887
 
888 888
 
889 889
                     
@@ -893,7 +893,7 @@  discard block
 block discarded – undo
893 893
                 if (isset($icalevent['DTSTART;VALUE=DATE'])) { // fullday event
894 894
                     // For full day events, date are also GMT but they wont but converted using tz during output
895 895
                     $datestart = dol_stringtotime($icalevent['DTSTART;VALUE=DATE'], 1);
896
-                    $dateend = dol_stringtotime($icalevent['DTEND;VALUE=DATE'], 1) - 1;  // We remove one second to get last second of day
896
+                    $dateend = dol_stringtotime($icalevent['DTEND;VALUE=DATE'], 1) - 1; // We remove one second to get last second of day
897 897
                     //print 'x'.$datestart.'-'.$dateend;exit;
898 898
                     //print dol_print_date($dateend,'dayhour','gmt');
899 899
                     $event->fulldayevent = 1;
@@ -938,7 +938,7 @@  discard block
 block discarded – undo
938 938
                     $event->id = $icalevent['UID'];
939 939
                     $event->icalname = $namecal;
940 940
                     $event->icalcolor = $colorcal;
941
-                    $usertime = 0;    // We dont modify date because we want to have date into memory datep and datef stored as GMT date. Compensation will be done during output.
941
+                    $usertime = 0; // We dont modify date because we want to have date into memory datep and datef stored as GMT date. Compensation will be done during output.
942 942
                     $event->datep = $datestart + $usertime;
943 943
                     $event->datef = $dateend + $usertime;
944 944
                     $event->type_code = "ICALEVENT";
@@ -991,7 +991,7 @@  discard block
 block discarded – undo
991 991
                             //if ($event->fulldayevent) print dol_print_date($daykeygmt,'dayhour','gmt').'-'.dol_print_date($daykey,'dayhour','gmt').'-'.dol_print_date($event->date_end_in_calendar,'dayhour','gmt').' ';
992 992
                             $eventarray[$daykey][] = $event;
993 993
                             $daykey += 60 * 60 * 24;
994
-                            $daykeygmt += 60 * 60 * 24;   // Add one day
994
+                            $daykeygmt += 60 * 60 * 24; // Add one day
995 995
                             if (($event->fulldayevent ? $daykeygmt : $daykey) > $event->date_end_in_calendar)
996 996
                                 $loop = false;
997 997
                         }
@@ -1026,7 +1026,7 @@  discard block
 block discarded – undo
1026 1026
 $cacheusers = array();
1027 1027
 
1028 1028
 // Define theme_datacolor array
1029
-$color_file = DOL_DOCUMENT_ROOT . "/theme/" . $conf->theme . "/graph-color.php";
1029
+$color_file = DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/graph-color.php";
1030 1030
 if (is_readable($color_file)) {
1031 1031
     include_once $color_file;
1032 1032
 }
@@ -1035,7 +1035,7 @@  discard block
 block discarded – undo
1035 1035
 
1036 1036
 
1037 1037
 if (empty($action) || $action == 'show_month') {      // View by month
1038
-    $newparam = $param;   // newparam is for birthday links
1038
+    $newparam = $param; // newparam is for birthday links
1039 1039
     $newparam = preg_replace('/showbirthday=/i', 'showbirthday_=', $newparam); // To avoid replacement when replace day= is done
1040 1040
     $newparam = preg_replace('/action=show_month&?/i', '', $newparam);
1041 1041
     $newparam = preg_replace('/action=show_week&?/i', '', $newparam);
@@ -1058,11 +1058,11 @@  discard block
 block discarded – undo
1058 1058
             $labelshort = array(0 => 'SundayMin', 1 => 'MondayMin', 2 => 'TuesdayMin', 3 => 'WednesdayMin', 4 => 'ThursdayMin', 5 => 'FridayMin', 6 => 'SaturdayMin');
1059 1059
             print $langs->trans($labelshort[$numdayinweek]);
1060 1060
         } else
1061
-            print $langs->trans("Day" . $numdayinweek);
1062
-        print '  </td>' . "\n";
1061
+            print $langs->trans("Day".$numdayinweek);
1062
+        print '  </td>'."\n";
1063 1063
         $i++;
1064 1064
     }
1065
-    echo ' </tr>' . "\n";
1065
+    echo ' </tr>'."\n";
1066 1066
 
1067 1067
     $todayarray = dol_getdate($now, 'fast');
1068 1068
     $todaytms = dol_mktime(0, 0, 0, $todayarray['mon'], $todayarray['mday'], $todayarray['year']);
@@ -1077,7 +1077,7 @@  discard block
 block discarded – undo
1077 1077
                 $style = 'cal_other_month cal_past';
1078 1078
                 if ($iter_day == 6)
1079 1079
                     $style .= ' cal_other_month_right';
1080
-                echo '  <td class="' . $style . ' nowrap" width="14%" valign="top">';
1080
+                echo '  <td class="'.$style.' nowrap" width="14%" valign="top">';
1081 1081
                 show_day_events($db, $max_day_in_prev_month + $tmpday, $prev_month, $prev_year, $month, $style, $eventarray, $maxprint, $maxnbofchar, $newparam);
1082 1082
                 echo "  </td>\n";
1083 1083
             }
@@ -1095,7 +1095,7 @@  discard block
 block discarded – undo
1095 1095
                 if ($curtime < $todaytms)
1096 1096
                     $style .= ' cal_past';
1097 1097
                 //var_dump($todayarray['mday']."==".$tmpday." && ".$todayarray['mon']."==".$month." && ".$todayarray['year']."==".$year.' -> '.$style);
1098
-                echo '  <td class="' . $style . ' nowrap" width="14%" valign="top">';
1098
+                echo '  <td class="'.$style.' nowrap" width="14%" valign="top">';
1099 1099
                 show_day_events($db, $tmpday, $month, $year, $month, $style, $eventarray, $maxprint, $maxnbofchar, $newparam);
1100 1100
                 echo "  </td>\n";
1101 1101
             }
@@ -1104,7 +1104,7 @@  discard block
 block discarded – undo
1104 1104
                 $style = 'cal_other_month';
1105 1105
                 if ($iter_day == 6)
1106 1106
                     $style .= ' cal_other_month_right';
1107
-                echo '  <td class="' . $style . ' nowrap" width="14%" valign="top">';
1107
+                echo '  <td class="'.$style.' nowrap" width="14%" valign="top">';
1108 1108
                 show_day_events($db, $tmpday - $max_day_in_month, $next_month, $next_year, $month, $style, $eventarray, $maxprint, $maxnbofchar, $newparam);
1109 1109
                 echo "</td>\n";
1110 1110
             }
@@ -1116,11 +1116,11 @@  discard block
 block discarded – undo
1116 1116
     print '</div>';
1117 1117
 
1118 1118
     print '<input type="hidden" name="actionmove" value="mupdate">';
1119
-    print '<input type="hidden" name="backtopage" value="' . dol_escape_htmltag($_SERVER['PHP_SELF']) . '?' . dol_escape_htmltag($_SERVER['QUERY_STRING']) . '">';
1119
+    print '<input type="hidden" name="backtopage" value="'.dol_escape_htmltag($_SERVER['PHP_SELF']).'?'.dol_escape_htmltag($_SERVER['QUERY_STRING']).'">';
1120 1120
     print '<input type="hidden" name="newdate" id="newdate">';
1121 1121
 }
1122 1122
 elseif ($action == 'show_week') { // View by week
1123
-    $newparam = $param;   // newparam is for birthday links
1123
+    $newparam = $param; // newparam is for birthday links
1124 1124
     $newparam = preg_replace('/showbirthday=/i', 'showbirthday_=', $newparam); // To avoid replacement when replace day= is done
1125 1125
     $newparam = preg_replace('/action=show_month&?/i', '', $newparam);
1126 1126
     $newparam = preg_replace('/action=show_week&?/i', '', $newparam);
@@ -1136,7 +1136,7 @@  discard block
 block discarded – undo
1136 1136
     print ' <tr class="liste_titre">';
1137 1137
     $i = 0;
1138 1138
     while ($i < 7) {
1139
-        echo '  <td align="center">' . $langs->trans("Day" . (($i + (isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK : 1)) % 7)) . "</td>\n";
1139
+        echo '  <td align="center">'.$langs->trans("Day".(($i + (isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK : 1)) % 7))."</td>\n";
1140 1140
         $i++;
1141 1141