Completed
Push — 1.11.x ( 253320...1d91e0 )
by José
124:55 queued 86:48
created
main/inc/lib/extra_field.lib.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -26,19 +26,19 @@  discard block
 block discarded – undo
26 26
     );
27 27
 
28 28
     public $ops = array(
29
-        'eq' => '=',        //equal
30
-        'ne' => '<>',       //not equal
31
-        'lt' => '<',        //less than
32
-        'le' => '<=',       //less than or equal
33
-        'gt' => '>',        //greater than
34
-        'ge' => '>=',       //greater than or equal
35
-        'bw' => 'LIKE',     //begins with
29
+        'eq' => '=', //equal
30
+        'ne' => '<>', //not equal
31
+        'lt' => '<', //less than
32
+        'le' => '<=', //less than or equal
33
+        'gt' => '>', //greater than
34
+        'ge' => '>=', //greater than or equal
35
+        'bw' => 'LIKE', //begins with
36 36
         'bn' => 'NOT LIKE', //doesn't begin with
37
-        'in' => 'LIKE',     //is in
37
+        'in' => 'LIKE', //is in
38 38
         'ni' => 'NOT LIKE', //is not in
39
-        'ew' => 'LIKE',     //ends with
39
+        'ew' => 'LIKE', //ends with
40 40
         'en' => 'NOT LIKE', //doesn't end with
41
-        'cn' => 'LIKE',     //contains
41
+        'cn' => 'LIKE', //contains
42 42
         'nc' => 'NOT LIKE'  //doesn't contain
43 43
     );
44 44
 
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
      */
344 344
     public static function get_extra_fields_by_handler($handler)
345 345
     {
346
-        $types= array();
346
+        $types = array();
347 347
         $types[self::FIELD_TYPE_TEXT] = get_lang('FieldTypeText');
348 348
         $types[self::FIELD_TYPE_TEXTAREA] = get_lang('FieldTypeTextarea');
349 349
         $types[self::FIELD_TYPE_RADIO] = get_lang('FieldTypeRadio');
@@ -1027,7 +1027,7 @@  discard block
 block discarded – undo
1027 1027
                         // chzn-select doesn't work for sessions??
1028 1028
                         $form->addElement(
1029 1029
                             'select',
1030
-                            'extra_' . $field_details['variable'],
1030
+                            'extra_'.$field_details['variable'],
1031 1031
                             $field_details['display_text'],
1032 1032
                             $options,
1033 1033
                             array('id' => 'extra_'.$field_details['variable'])
@@ -1086,7 +1086,7 @@  discard block
 block discarded – undo
1086 1086
 
1087 1087
                         if (!$admin_permissions) {
1088 1088
                             if ($field_details['visible'] == 0) {
1089
-                                $form->freeze('extra_' . $field_details['variable']);
1089
+                                $form->freeze('extra_'.$field_details['variable']);
1090 1090
                             }
1091 1091
                         }
1092 1092
                         break;
@@ -1163,7 +1163,7 @@  discard block
 block discarded – undo
1163 1163
                             }
1164 1164
                         });';
1165 1165
 
1166
-                        $first_id  = null;
1166
+                        $first_id = null;
1167 1167
                         if (!empty($extraData)) {
1168 1168
                             if (isset($extraData['extra_'.$field_details['variable']])) {
1169 1169
                                 $first_id = $extraData['extra_'.$field_details['variable']]['extra_'.$field_details['variable']];
@@ -1424,9 +1424,9 @@  discard block
 block discarded – undo
1424 1424
 
1425 1425
                         if (is_array($extraData) && array_key_exists($fieldVariable, $extraData)) {
1426 1426
 
1427
-                            if (file_exists(api_get_path(SYS_UPLOAD_PATH) . $extraData[$fieldVariable])) {
1427
+                            if (file_exists(api_get_path(SYS_UPLOAD_PATH).$extraData[$fieldVariable])) {
1428 1428
                                 $fieldTexts[] = Display::img(
1429
-                                    api_get_path(WEB_UPLOAD_PATH) . $extraData[$fieldVariable],
1429
+                                    api_get_path(WEB_UPLOAD_PATH).$extraData[$fieldVariable],
1430 1430
                                     $field_details['display_text'],
1431 1431
                                     ['width' => '300']
1432 1432
                                 );
@@ -1450,7 +1450,7 @@  discard block
 block discarded – undo
1450 1450
                         $allowed_picture_types = ['jpg', 'jpeg', 'png', 'gif'];
1451 1451
                         $form->addRule(
1452 1452
                             'extra_'.$field_details['variable'],
1453
-                            get_lang('OnlyImagesAllowed') . ' ('.implode(',', $allowed_picture_types).')',
1453
+                            get_lang('OnlyImagesAllowed').' ('.implode(',', $allowed_picture_types).')',
1454 1454
                             'filetype',
1455 1455
                             $allowed_picture_types
1456 1456
                         );
@@ -1492,10 +1492,10 @@  discard block
 block discarded – undo
1492 1492
                         if (is_array($extraData) &&
1493 1493
                             array_key_exists($fieldVariable, $extraData)
1494 1494
                         ) {
1495
-                            if (file_exists(api_get_path(SYS_UPLOAD_PATH) . $extraData[$fieldVariable])) {
1495
+                            if (file_exists(api_get_path(SYS_UPLOAD_PATH).$extraData[$fieldVariable])) {
1496 1496
                                 $fieldTexts[] = Display::url(
1497
-                                    api_get_path(WEB_UPLOAD_PATH) . $extraData[$fieldVariable],
1498
-                                    api_get_path(WEB_UPLOAD_PATH) . $extraData[$fieldVariable],
1497
+                                    api_get_path(WEB_UPLOAD_PATH).$extraData[$fieldVariable],
1498
+                                    api_get_path(WEB_UPLOAD_PATH).$extraData[$fieldVariable],
1499 1499
                                     array(
1500 1500
                                         'title' => $field_details['display_text'],
1501 1501
                                         'target' => '_blank'
@@ -1535,12 +1535,12 @@  discard block
 block discarded – undo
1535 1535
                             "extra_{$field_details['variable']}",
1536 1536
                             $field_details['display_text']
1537 1537
                         );
1538
-                        $form->applyFilter('extra_' . $field_details['variable'], 'stripslashes');
1538
+                        $form->applyFilter('extra_'.$field_details['variable'], 'stripslashes');
1539 1539
 
1540 1540
                         if (!$admin_permissions) {
1541 1541
                             if ($field_details['visible'] == 0) {
1542 1542
                                 $form->freeze(
1543
-                                    'extra_' . $field_details['variable']
1543
+                                    'extra_'.$field_details['variable']
1544 1544
                                 );
1545 1545
                             }
1546 1546
                         }
@@ -1551,13 +1551,13 @@  discard block
 block discarded – undo
1551 1551
                             $field_details['display_text']
1552 1552
                         );
1553 1553
                         $form->applyFilter(
1554
-                            'extra_' . $field_details['variable'],
1554
+                            'extra_'.$field_details['variable'],
1555 1555
                             'stripslashes'
1556 1556
                         );
1557 1557
                         if (!$admin_permissions) {
1558 1558
                             if ($field_details['visible'] == 0) {
1559 1559
                                 $form->freeze(
1560
-                                    'extra_' . $field_details['variable']
1560
+                                    'extra_'.$field_details['variable']
1561 1561
                                 );
1562 1562
                             }
1563 1563
                         }
@@ -1567,12 +1567,12 @@  discard block
 block discarded – undo
1567 1567
                             "extra_{$field_details['variable']}",
1568 1568
                             $field_details['display_text']
1569 1569
                         );
1570
-                        $form->applyFilter('extra_' . $field_details['variable'], 'stripslashes');
1570
+                        $form->applyFilter('extra_'.$field_details['variable'], 'stripslashes');
1571 1571
 
1572 1572
                         if (!$admin_permissions) {
1573 1573
                             if ($field_details['visible'] == 0) {
1574 1574
                                 $form->freeze(
1575
-                                    'extra_' . $field_details['variable']
1575
+                                    'extra_'.$field_details['variable']
1576 1576
                                 );
1577 1577
                             }
1578 1578
                         }
@@ -1583,13 +1583,13 @@  discard block
 block discarded – undo
1583 1583
                             $field_details['display_text']
1584 1584
                         );
1585 1585
                         $form->applyFilter(
1586
-                            'extra_' . $field_details['variable'],
1586
+                            'extra_'.$field_details['variable'],
1587 1587
                             'stripslashes'
1588 1588
                         );
1589 1589
                         if (!$admin_permissions) {
1590 1590
                             if ($field_details['visible'] == 0) {
1591 1591
                                 $form->freeze(
1592
-                                    'extra_' . $field_details['variable']
1592
+                                    'extra_'.$field_details['variable']
1593 1593
                                 );
1594 1594
                             }
1595 1595
                         }
@@ -1618,7 +1618,7 @@  discard block
 block discarded – undo
1618 1618
                             '<script>
1619 1619
                                 $(document).ready(function() {
1620 1620
 
1621
-                                    var address = "' . $dataValue . '";
1621
+                                    var address = "' . $dataValue.'";
1622 1622
                                     initializeGeo'.$field_details['variable'].'(address, false);
1623 1623
 
1624 1624
                                     $("#geolocalization_extra_'.$field_details['variable'].'").on("click", function() {
@@ -1650,7 +1650,7 @@  discard block
 block discarded – undo
1650 1650
                                         };
1651 1651
 
1652 1652
                                         var geoError = function(error) {
1653
-                                            alert("Geocode ' . get_lang('Error') . ': " + error);
1653
+                                            alert("Geocode ' . get_lang('Error').': " + error);
1654 1654
                                         };
1655 1655
 
1656 1656
                                         var geoOptions = {
@@ -1701,11 +1701,11 @@  discard block
 block discarded – undo
1701 1701
                                                         infowindow.open(map_'.$field_details['variable'].', marker);
1702 1702
                                                     });
1703 1703
                                                 } else {
1704
-                                                    alert("' . get_lang("NotFound") . '");
1704
+                                                    alert("' . get_lang("NotFound").'");
1705 1705
                                                 }
1706 1706
 
1707 1707
                                             } else {
1708
-                                                alert("Geocode ' . get_lang('Error') . ': " + status);
1708
+                                                alert("Geocode ' . get_lang('Error').': " + status);
1709 1709
                                             }
1710 1710
                                         });
1711 1711
                                     }
@@ -1893,7 +1893,7 @@  discard block
 block discarded – undo
1893 1893
         $form->addElement('header', $header);
1894 1894
 
1895 1895
         if ($action == 'edit') {
1896
-            $translateUrl = api_get_path(WEB_CODE_PATH) . 'extrafield/translate.php?' . http_build_query([
1896
+            $translateUrl = api_get_path(WEB_CODE_PATH).'extrafield/translate.php?'.http_build_query([
1897 1897
                 'extra_field' => $id
1898 1898
             ]);
1899 1899
             $translateButton = Display::toolbarButton(get_lang('TranslateThisTerm'), $translateUrl, 'language', 'link');
@@ -2224,7 +2224,7 @@  discard block
 block discarded – undo
2224 2224
                 foreach ($extra_fields as $extra_info) {
2225 2225
                     $extra_field_info = $extra_info['extra_field_info'];
2226 2226
                     $inject_joins .= " INNER JOIN $this->table_field_values fv$counter
2227
-                                       ON (s." . $this->primaryKey . " = fv$counter." . $this->handler_id . ") ";
2227
+                                       ON (s.".$this->primaryKey." = fv$counter.".$this->handler_id.") ";
2228 2228
                     // Add options
2229 2229
                     if (isset($extra_field_info['field_type']) && in_array(
2230 2230
                             $extra_field_info['field_type'],
@@ -2237,7 +2237,7 @@  discard block
 block discarded – undo
2237 2237
                     ) {
2238 2238
                         $options['where'] = str_replace(
2239 2239
                             $extra_info['field'],
2240
-                            'fv' . $counter . '.field_id = ' . $extra_info['id'] . ' AND fvo' . $counter . '.option_value',
2240
+                            'fv'.$counter.'.field_id = '.$extra_info['id'].' AND fvo'.$counter.'.option_value',
2241 2241
                             $options['where']
2242 2242
                         );
2243 2243
                         $inject_joins .= "
@@ -2252,13 +2252,13 @@  discard block
 block discarded – undo
2252 2252
                     ) {
2253 2253
                         $options['where'] = str_replace(
2254 2254
                             $extra_info['field'],
2255
-                            'tag' . $counter . '.tag ',
2255
+                            'tag'.$counter.'.tag ',
2256 2256
                             $options['where']
2257 2257
                         );
2258 2258
 
2259 2259
                         $inject_joins .= "
2260 2260
                             INNER JOIN $this->table_field_rel_tag tag_rel$counter
2261
-                            ON (tag_rel$counter.field_id = ".$extra_info['id']." AND tag_rel$counter.item_id = s." . $this->primaryKey.")
2261
+                            ON (tag_rel$counter.field_id = ".$extra_info['id']." AND tag_rel$counter.item_id = s.".$this->primaryKey.")
2262 2262
                             INNER JOIN $this->table_field_tag tag$counter
2263 2263
                             ON (tag$counter.id =  tag_rel$counter.tag_id)
2264 2264
                         ";
@@ -2463,19 +2463,19 @@  discard block
 block discarded – undo
2463 2463
                         break;
2464 2464
                     }
2465 2465
 
2466
-                    if (!file_exists(api_get_path(SYS_UPLOAD_PATH) . $valueData['value'])) {
2466
+                    if (!file_exists(api_get_path(SYS_UPLOAD_PATH).$valueData['value'])) {
2467 2467
                         break;
2468 2468
                     }
2469 2469
 
2470 2470
                     $image = Display::img(
2471
-                        api_get_path(WEB_UPLOAD_PATH) . $valueData['value'],
2471
+                        api_get_path(WEB_UPLOAD_PATH).$valueData['value'],
2472 2472
                         $field['display_text'],
2473 2473
                         array('width' => '300')
2474 2474
                     );
2475 2475
 
2476 2476
                     $displayedValue = Display::url(
2477 2477
                         $image,
2478
-                        api_get_path(WEB_UPLOAD_PATH) . $valueData['value'],
2478
+                        api_get_path(WEB_UPLOAD_PATH).$valueData['value'],
2479 2479
                         array('target' => '_blank')
2480 2480
                     );
2481 2481
                     break;
@@ -2484,13 +2484,13 @@  discard block
 block discarded – undo
2484 2484
                         break;
2485 2485
                     }
2486 2486
 
2487
-                    if (!file_exists(api_get_path(SYS_UPLOAD_PATH) . $valueData['value'])) {
2487
+                    if (!file_exists(api_get_path(SYS_UPLOAD_PATH).$valueData['value'])) {
2488 2488
                         break;
2489 2489
                     }
2490 2490
 
2491 2491
                     $displayedValue = Display::url(
2492 2492
                         get_lang('Download'),
2493
-                        api_get_path(WEB_UPLOAD_PATH) . $valueData['value'],
2493
+                        api_get_path(WEB_UPLOAD_PATH).$valueData['value'],
2494 2494
                         array(
2495 2495
                             'title' => $field['display_text'],
2496 2496
                             'target' => '_blank'
Please login to merge, or discard this patch.