Completed
Push — master ( 26b490...31307f )
by Michael
03:13
created
class/event.php 1 patch
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -19,13 +19,13 @@  discard block
 block discarded – undo
19 19
 
20 20
 // defined('XOOPS_ROOT_PATH') || exit('Restricted access.');
21 21
 
22
-require_once __DIR__ . '/ExtcalPersistableObjectHandler.php';
23
-require_once __DIR__ . '/perm.php';
24
-require_once __DIR__ . '/time.php';
25
-require_once __DIR__ . '/config.php';
26
-require_once __DIR__ . '/extDateTime.php';
27
-require_once __DIR__ . '/utility.php';
28
-require_once __DIR__ . '/../include/constantes.php';
22
+require_once __DIR__.'/ExtcalPersistableObjectHandler.php';
23
+require_once __DIR__.'/perm.php';
24
+require_once __DIR__.'/time.php';
25
+require_once __DIR__.'/config.php';
26
+require_once __DIR__.'/extDateTime.php';
27
+require_once __DIR__.'/utility.php';
28
+require_once __DIR__.'/../include/constantes.php';
29 29
 
30 30
 /**
31 31
  * Class ExtcalEvent.
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
         $this->initVar('event_etablissement', XOBJ_DTYPE_INT, 5, false);
67 67
         $this->initVar('event_icone', XOBJ_DTYPE_TXTBOX, '', false);
68 68
 
69
-        $this->externalKey['cat_id']          = [
69
+        $this->externalKey['cat_id'] = [
70 70
             'className'      => 'cat',
71 71
             'getMethodeName' => 'getCat',
72 72
             'keyName'        => 'cat',
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
 
403 403
         //        while (list($k, $v) = each($events)) {
404 404
         foreach ($events as $k => $v) {
405
-            $ordre[] = (int)$v['event_start'];
405
+            $ordre[] = (int) $v['event_start'];
406 406
             $this->formatEventDate($v, $extcalConfig['event_date_week']);
407 407
             //$v['cat']['cat_light_color'] = $v['cat']['cat_color'];
408 408
             $v['cat']['cat_light_color'] = ExtcalUtility::getLighterColor($v['cat']['cat_color'], _EXTCAL_INFOBULLE_RGB_MIN, _EXTCAL_INFOBULLE_RGB_MAX);
@@ -606,7 +606,7 @@  discard block
 block discarded – undo
606 606
 
607 607
         reset($period);
608 608
         foreach ($period as $dt) {
609
-            echo $dt->format("l d-m-Y H:i:s\n") . '<br>';
609
+            echo $dt->format("l d-m-Y H:i:s\n").'<br>';
610 610
         }
611 611
     }
612 612
 
@@ -939,10 +939,10 @@  discard block
 block discarded – undo
939 939
         $authorizedAccessCats = $this->_extcalPerm->getAuthorizedCat($user, 'extcal_cat_view');
940 940
         $count                = count($authorizedAccessCats);
941 941
         if ($count > 0) {
942
-            $in = '(' . $authorizedAccessCats[0];
942
+            $in = '('.$authorizedAccessCats[0];
943 943
             array_shift($authorizedAccessCats);
944 944
             foreach ($authorizedAccessCats as $authorizedAccessCat) {
945
-                $in .= ',' . $authorizedAccessCat;
945
+                $in .= ','.$authorizedAccessCat;
946 946
             }
947 947
             $in .= ')';
948 948
             $criteria->add(new Criteria('cat_id', $in, 'IN'));
@@ -962,10 +962,10 @@  discard block
 block discarded – undo
962 962
         }
963 963
         if (is_array($cats)) {
964 964
             if (false === array_search(0, $cats)) {
965
-                $in = '(' . current($cats);
965
+                $in = '('.current($cats);
966 966
                 array_shift($cats);
967 967
                 foreach ($cats as $cat) {
968
-                    $in .= ',' . $cat;
968
+                    $in .= ','.$cat;
969 969
                 }
970 970
                 $in .= ')';
971 971
                 $criteria->add(new Criteria('cat_id', $in, 'IN'));
@@ -988,7 +988,7 @@  discard block
 block discarded – undo
988 988
         $fileHandler = xoops_getModuleHandler(_EXTCAL_CLS_FILE, _EXTCAL_MODULE);
989 989
 
990 990
         /***************************************************/
991
-        require_once __DIR__ . '/etablissement.php';
991
+        require_once __DIR__.'/etablissement.php';
992 992
         if ('admin' === $siteSide) {
993 993
             $action = 'event.php?op=enreg';
994 994
             $cats   = $catHandler->getAllCat($GLOBALS['xoopsUser'], 'all');
@@ -1006,7 +1006,7 @@  discard block
 block discarded – undo
1006 1006
             if ('clone' === $mode) {
1007 1007
                 $data['event_id'] = 0;
1008 1008
                 $event->setVar('event_id', 0);
1009
-                $newTitle = $event->getVar('event_title') . ' (' . _MD_EXTCAL_CLONE_OF . $data['event_id'] . ')';
1009
+                $newTitle = $event->getVar('event_title').' ('._MD_EXTCAL_CLONE_OF.$data['event_id'].')';
1010 1010
                 $event->setVar('event_title', $newTitle);
1011 1011
             }
1012 1012
 
@@ -1190,7 +1190,7 @@  discard block
 block discarded – undo
1190 1190
         $form->addElement($catSelect, true);
1191 1191
         //-----------------------------------------------------------
1192 1192
 
1193
-        $file_path = __DIR__ . '/../assets/css/images';
1193
+        $file_path = __DIR__.'/../assets/css/images';
1194 1194
         $tf        = XoopsLists::getImgListAsArray($file_path);
1195 1195
         array_unshift($tf, _MD_EXTCAL_NONE);
1196 1196
         $xfIcones = new XoopsFormSelect(_MD_EXTCAL_ICONE, 'event_icone', $event_icone, '');
@@ -1295,7 +1295,7 @@  discard block
 block discarded – undo
1295 1295
         if (count($files) > 0) {
1296 1296
             $eventFiles = new ExtcalFormFileCheckBox('', 'filetokeep');
1297 1297
             foreach ($files as $file) {
1298
-                $name = $file['file_nicename'] . ' (<i>' . $file['file_mimetype'] . '</i>) ' . $file['formated_file_size'];
1298
+                $name = $file['file_nicename'].' (<i>'.$file['file_mimetype'].'</i>) '.$file['formated_file_size'];
1299 1299
                 $eventFiles->addOption($file['file_id'], $name);
1300 1300
             }
1301 1301
             $fileElmtTray->addElement($eventFiles);
@@ -1311,7 +1311,7 @@  discard block
 block discarded – undo
1311 1311
         //Picture1
1312 1312
         $file_tray = new XoopsFormElementTray(sprintf(_MD_EXTCAL_FORM_IMG, 1), '');
1313 1313
         if (!empty($event_picture1)) {
1314
-            $file_tray->addElement(new XoopsFormLabel('', "<img src='" . XOOPS_URL . '/uploads/extcal/' . $event_picture1 . "' name='image' id='image' alt=''><br><br>"));
1314
+            $file_tray->addElement(new XoopsFormLabel('', "<img src='".XOOPS_URL.'/uploads/extcal/'.$event_picture1."' name='image' id='image' alt=''><br><br>"));
1315 1315
             $check_del_img = new XoopsFormCheckBox('', 'delimg_1');
1316 1316
             $check_del_img->addOption(1, _MD_EXTCAL_DEL_IMG);
1317 1317
             $file_tray->addElement($check_del_img);
@@ -1322,8 +1322,8 @@  discard block
 block discarded – undo
1322 1322
         }
1323 1323
         $file_img->setExtra("size ='40'");
1324 1324
         $file_tray->addElement($file_img);
1325
-        $msg        = sprintf(_MD_EXTCAL_IMG_CONFIG, (int)(400728 / 1000), 500, 500);
1326
-        $file_label = new XoopsFormLabel('', '<br>' . $msg);
1325
+        $msg        = sprintf(_MD_EXTCAL_IMG_CONFIG, (int) (400728 / 1000), 500, 500);
1326
+        $file_label = new XoopsFormLabel('', '<br>'.$msg);
1327 1327
         $file_tray->addElement($file_label);
1328 1328
         $form->addElement($file_tray);
1329 1329
         $form->addElement(new XoopsFormHidden('file1', $event_picture1));
@@ -1331,7 +1331,7 @@  discard block
 block discarded – undo
1331 1331
         //Picture2
1332 1332
         $file_tray = new XoopsFormElementTray(sprintf(_MD_EXTCAL_FORM_IMG, 2), '');
1333 1333
         if (!empty($event_picture2)) {
1334
-            $file_tray->addElement(new XoopsFormLabel('', "<img src='" . XOOPS_URL . '/uploads/extcal/' . $event_picture2 . "' name='image' id='image' alt=''><br><br>"));
1334
+            $file_tray->addElement(new XoopsFormLabel('', "<img src='".XOOPS_URL.'/uploads/extcal/'.$event_picture2."' name='image' id='image' alt=''><br><br>"));
1335 1335
             $check_del_img = new XoopsFormCheckBox('', 'delimg_2');
1336 1336
             $check_del_img->addOption(1, _MD_EXTCAL_DEL_IMG);
1337 1337
             $file_tray->addElement($check_del_img);
@@ -1342,8 +1342,8 @@  discard block
 block discarded – undo
1342 1342
         }
1343 1343
         $file_img->setExtra("size ='40'");
1344 1344
         $file_tray->addElement($file_img);
1345
-        $msg        = sprintf(_MD_EXTCAL_IMG_CONFIG, (int)(400728 / 1000), 500, 500);
1346
-        $file_label = new XoopsFormLabel('', '<br>' . $msg);
1345
+        $msg        = sprintf(_MD_EXTCAL_IMG_CONFIG, (int) (400728 / 1000), 500, 500);
1346
+        $file_label = new XoopsFormLabel('', '<br>'.$msg);
1347 1347
         $file_tray->addElement($file_label);
1348 1348
         $form->addElement($file_tray);
1349 1349
         $form->addElement(new XoopsFormHidden('file2', $event_picture2));
@@ -1410,7 +1410,7 @@  discard block
 block discarded – undo
1410 1410
                 $recurRules = 'weekly|';
1411 1411
                 $recurRules .= $parm['rrule_weekly_interval'];
1412 1412
                 foreach ($parm['rrule_weekly_bydays'] as $day) {
1413
-                    $recurRules .= '|' . $day;
1413
+                    $recurRules .= '|'.$day;
1414 1414
                 }
1415 1415
 
1416 1416
                 break;
@@ -1420,11 +1420,11 @@  discard block
 block discarded – undo
1420 1420
                     $parm['rrule_monthly_interval'] = 0;
1421 1421
                 }
1422 1422
                 $recurRules = 'monthly|';
1423
-                $recurRules .= $parm['rrule_monthly_interval'] . '|';
1423
+                $recurRules .= $parm['rrule_monthly_interval'].'|';
1424 1424
                 if ('' != $parm['rrule_monthly_byday']) {
1425 1425
                     $recurRules .= $parm['rrule_monthly_byday'];
1426 1426
                 } else {
1427
-                    $recurRules .= 'MD' . $parm['rrule_bymonthday'];
1427
+                    $recurRules .= 'MD'.$parm['rrule_bymonthday'];
1428 1428
                 }
1429 1429
 
1430 1430
                 break;
@@ -1458,9 +1458,9 @@  discard block
 block discarded – undo
1458 1458
 
1459 1459
                 $recurRules = 'yearly|';
1460 1460
                 $recurRules .= $parm['rrule_yearly_interval'];
1461
-                $recurRules .= '|' . $parm['rrule_yearly_byday'];
1461
+                $recurRules .= '|'.$parm['rrule_yearly_byday'];
1462 1462
                 foreach ($parm['rrule_yearly_bymonths'] as $month) {
1463
-                    $recurRules .= '|' . $month;
1463
+                    $recurRules .= '|'.$month;
1464 1464
                 }
1465 1465
 
1466 1466
                 break;
@@ -2390,10 +2390,10 @@  discard block
 block discarded – undo
2390 2390
         global $xoopsDB;
2391 2391
 
2392 2392
         //echo "<hr>{$andor}-{$limit}-{$offset}-{$userId}-{$user}<br>{$criteresPlus}";
2393
-        $tEvent = $xoopsDB->prefix('extcal_event') . ' AS te';
2394
-        $tCat   = $xoopsDB->prefix('extcal_cat') . ' AS tc';
2393
+        $tEvent = $xoopsDB->prefix('extcal_event').' AS te';
2394
+        $tCat   = $xoopsDB->prefix('extcal_cat').' AS tc';
2395 2395
 
2396
-        $sql = 'SELECT te.*, tc.cat_name , tc.cat_color, ' . 'year(FROM_UNIXTIME(event_start)) AS year,' . 'month(FROM_UNIXTIME(event_start)) AS month,' . 'day(FROM_UNIXTIME(event_start)) AS day' . " FROM {$tEvent}, {$tCat}";
2396
+        $sql = 'SELECT te.*, tc.cat_name , tc.cat_color, '.'year(FROM_UNIXTIME(event_start)) AS year,'.'month(FROM_UNIXTIME(event_start)) AS month,'.'day(FROM_UNIXTIME(event_start)) AS day'." FROM {$tEvent}, {$tCat}";
2397 2397
         //---------------------------------------------------
2398 2398
         $tw   = [];
2399 2399
         $tw[] = 'te.cat_id = tc.cat_id';
@@ -2402,7 +2402,7 @@  discard block
 block discarded – undo
2402 2402
         $authorizedAccessCats = $this->_extcalPerm->getAuthorizedCat($user, 'extcal_cat_view');
2403 2403
         $inCat                = 'te.cat_id IN (0)';
2404 2404
         if (count($authorizedAccessCats) > 0) {
2405
-            $inCat = 'te.cat_id IN (' . implode(',', $authorizedAccessCats) . ')';
2405
+            $inCat = 'te.cat_id IN ('.implode(',', $authorizedAccessCats).')';
2406 2406
         }
2407 2407
         //echo $tw[count($tw)-1];
2408 2408
 
@@ -2438,12 +2438,12 @@  discard block
 block discarded – undo
2438 2438
                 'te.event_address',
2439 2439
                 'tc.cat_name',
2440 2440
             ];
2441
-            $t       = [];
2441
+            $t = [];
2442 2442
             for ($i = 0, $count = count($queryarray); $i < $count; ++$i) {
2443 2443
                 $t1[] = " %1\$s LIKE '#{$queryarray[$i]}#' ";
2444 2444
             }
2445 2445
 
2446
-            $flt = '(' . implode(" {$andor} ", $t1) . ')';
2446
+            $flt = '('.implode(" {$andor} ", $t1).')';
2447 2447
 
2448 2448
             $t = [];
2449 2449
             for ($h = 0, $count = count($tFields); $h < $count; ++$h) {
@@ -2452,10 +2452,10 @@  discard block
 block discarded – undo
2452 2452
 
2453 2453
             $filtre = implode(' OR ', $t);
2454 2454
             $filtre = str_replace('#', '%', $filtre);
2455
-            $tw[]   = '(' . $filtre . ')';
2455
+            $tw[]   = '('.$filtre.')';
2456 2456
         }
2457 2457
 
2458
-        $sql .= ' WHERE ' . implode(' AND ', $tw);
2458
+        $sql .= ' WHERE '.implode(' AND ', $tw);
2459 2459
         //------------------------------------------------------------
2460 2460
         if (count($orderBy) > 0) {
2461 2461
             $t = [];
@@ -2465,7 +2465,7 @@  discard block
 block discarded – undo
2465 2465
                 }
2466 2466
             }
2467 2467
             if (count($t) > 0) {
2468
-                $sql .= ' ORDER BY ' . implode(',', $t);
2468
+                $sql .= ' ORDER BY '.implode(',', $t);
2469 2469
             }
2470 2470
         }
2471 2471
 
@@ -2498,7 +2498,7 @@  discard block
 block discarded – undo
2498 2498
         $i = 0;
2499 2499
         while ($myrow = $xoopsDB->fetchArray($result)) {
2500 2500
             $ret[$i]['image'] = 'assets/images/icons/extcal.gif';
2501
-            $ret[$i]['link']  = 'event.php?event=' . $myrow['event_id'];
2501
+            $ret[$i]['link']  = 'event.php?event='.$myrow['event_id'];
2502 2502
             $ret[$i]['title'] = $myrow['event_title'];
2503 2503
             $ret[$i]['time']  = $myrow['event_submitdate'];
2504 2504
             $ret[$i]['uid']   = $myrow['event_submitter'];
@@ -2538,23 +2538,23 @@  discard block
 block discarded – undo
2538 2538
         //        }
2539 2539
         $tEvent = $xoopsDB->prefix('extcal_event');
2540 2540
         $tCat   = $xoopsDB->prefix('extcal_cat');
2541
-        $sql    = "SELECT {$tEvent}.*, {$tCat}.cat_name AS categorie, {$tCat}.cat_color " . " FROM {$tEvent}, {$tCat}" . " WHERE {$tEvent}.cat_id = {$tCat}.cat_id AND event_approved = '1'";
2541
+        $sql    = "SELECT {$tEvent}.*, {$tCat}.cat_name AS categorie, {$tCat}.cat_color "." FROM {$tEvent}, {$tCat}"." WHERE {$tEvent}.cat_id = {$tCat}.cat_id AND event_approved = '1'";
2542 2542
 
2543 2543
         $authorizedAccessCats = $this->_extcalPerm->getAuthorizedCat($user, 'extcal_cat_view');
2544 2544
         $count                = count($authorizedAccessCats);
2545 2545
         if ($count > 0) {
2546
-            $in = '(' . $authorizedAccessCats[0];
2546
+            $in = '('.$authorizedAccessCats[0];
2547 2547
             array_shift($authorizedAccessCats);
2548 2548
             foreach ($authorizedAccessCats as $authorizedAccessCat) {
2549
-                $in .= ',' . $authorizedAccessCat;
2549
+                $in .= ','.$authorizedAccessCat;
2550 2550
             }
2551 2551
             $in .= ')';
2552 2552
         } else {
2553 2553
             $in = '(0)';
2554 2554
         }
2555
-        $sql .= " AND {$tEvent}.cat_id IN " . $in . '';
2555
+        $sql .= " AND {$tEvent}.cat_id IN ".$in.'';
2556 2556
         if (0 != $userId) {
2557
-            $sql .= " AND event_submitter = '" . $userId . "'";
2557
+            $sql .= " AND event_submitter = '".$userId."'";
2558 2558
         }
2559 2559
 
2560 2560
         //echoArray($queryarray,false);
@@ -2574,7 +2574,7 @@  discard block
 block discarded – undo
2574 2574
                 $t1[] = " %1\$s LIKE '#{$queryarray[$i]}#' ";
2575 2575
             }
2576 2576
 
2577
-            $flt = '(' . implode(" {$andor} ", $t1) . ')';
2577
+            $flt = '('.implode(" {$andor} ", $t1).')';
2578 2578
 
2579 2579
             $t = [];
2580 2580
             for ($h = 0, $count = count($tFields); $h < $count; ++$h) {
@@ -2583,11 +2583,11 @@  discard block
 block discarded – undo
2583 2583
 
2584 2584
             $filtre = implode(' OR ', $t);
2585 2585
             $filtre = str_replace('#', '%', $filtre);
2586
-            $sql    .= " AND ($filtre)";
2586
+            $sql .= " AND ($filtre)";
2587 2587
         }
2588 2588
 
2589 2589
         if ('' != $criteresPlus) {
2590
-            $sql .= ' AND ' . $criteresPlus;
2590
+            $sql .= ' AND '.$criteresPlus;
2591 2591
         }
2592 2592
         $sql .= ' ORDER BY event_id DESC';
2593 2593
 
@@ -2597,7 +2597,7 @@  discard block
 block discarded – undo
2597 2597
         if ($xoopsSearch) {
2598 2598
             while ($myrow = $xoopsDB->fetchArray($result)) {
2599 2599
                 $ret[$i]['image'] = 'assets/images/icons/extcal.gif';
2600
-                $ret[$i]['link']  = 'event.php?event=' . $myrow['event_id'];
2600
+                $ret[$i]['link']  = 'event.php?event='.$myrow['event_id'];
2601 2601
                 $ret[$i]['title'] = $myrow['event_title'];
2602 2602
                 $ret[$i]['time']  = $myrow['event_submitdate'];
2603 2603
                 $ret[$i]['uid']   = $myrow['event_submitter'];
Please login to merge, or discard this patch.