Completed
Push — 1.11.x ( 7e6069...34fe5d )
by José
101:44 queued 47:09
created
main/inc/lib/extra_field.lib.php 1 patch
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -27,19 +27,19 @@  discard block
 block discarded – undo
27 27
     );
28 28
 
29 29
     public $ops = array(
30
-        'eq' => '=',        //equal
31
-        'ne' => '<>',       //not equal
32
-        'lt' => '<',        //less than
33
-        'le' => '<=',       //less than or equal
34
-        'gt' => '>',        //greater than
35
-        'ge' => '>=',       //greater than or equal
36
-        'bw' => 'LIKE',     //begins with
30
+        'eq' => '=', //equal
31
+        'ne' => '<>', //not equal
32
+        'lt' => '<', //less than
33
+        'le' => '<=', //less than or equal
34
+        'gt' => '>', //greater than
35
+        'ge' => '>=', //greater than or equal
36
+        'bw' => 'LIKE', //begins with
37 37
         'bn' => 'NOT LIKE', //doesn't begin with
38
-        'in' => 'LIKE',     //is in
38
+        'in' => 'LIKE', //is in
39 39
         'ni' => 'NOT LIKE', //is not in
40
-        'ew' => 'LIKE',     //ends with
40
+        'ew' => 'LIKE', //ends with
41 41
         'en' => 'NOT LIKE', //doesn't end with
42
-        'cn' => 'LIKE',     //contains
42
+        'cn' => 'LIKE', //contains
43 43
         'nc' => 'NOT LIKE'  //doesn't contain
44 44
     );
45 45
 
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
      */
385 385
     public static function get_extra_fields_by_handler($handler)
386 386
     {
387
-        $types= array();
387
+        $types = array();
388 388
         $types[self::FIELD_TYPE_TEXT] = get_lang('FieldTypeText');
389 389
         $types[self::FIELD_TYPE_TEXTAREA] = get_lang('FieldTypeTextarea');
390 390
         $types[self::FIELD_TYPE_RADIO] = get_lang('FieldTypeRadio');
@@ -1073,7 +1073,7 @@  discard block
 block discarded – undo
1073 1073
                         // chzn-select doesn't work for sessions??
1074 1074
                         $form->addElement(
1075 1075
                             'select',
1076
-                            'extra_' . $field_details['variable'],
1076
+                            'extra_'.$field_details['variable'],
1077 1077
                             $field_details['display_text'],
1078 1078
                             $options,
1079 1079
                             array('id' => 'extra_'.$field_details['variable'])
@@ -1132,7 +1132,7 @@  discard block
 block discarded – undo
1132 1132
 
1133 1133
                         if (!$admin_permissions) {
1134 1134
                             if ($field_details['visible_to_self'] == 0) {
1135
-                                $form->freeze('extra_' . $field_details['variable']);
1135
+                                $form->freeze('extra_'.$field_details['variable']);
1136 1136
                             }
1137 1137
                         }
1138 1138
                         break;
@@ -1209,7 +1209,7 @@  discard block
 block discarded – undo
1209 1209
                             }
1210 1210
                         });';
1211 1211
 
1212
-                        $first_id  = null;
1212
+                        $first_id = null;
1213 1213
                         if (!empty($extraData)) {
1214 1214
                             if (isset($extraData['extra_'.$field_details['variable']])) {
1215 1215
                                 $first_id = $extraData['extra_'.$field_details['variable']]['extra_'.$field_details['variable']];
@@ -1469,9 +1469,9 @@  discard block
 block discarded – undo
1469 1469
 
1470 1470
                         if (is_array($extraData) && array_key_exists($fieldVariable, $extraData)) {
1471 1471
 
1472
-                            if (file_exists(api_get_path(SYS_UPLOAD_PATH) . $extraData[$fieldVariable])) {
1472
+                            if (file_exists(api_get_path(SYS_UPLOAD_PATH).$extraData[$fieldVariable])) {
1473 1473
                                 $fieldTexts[] = Display::img(
1474
-                                    api_get_path(WEB_UPLOAD_PATH) . $extraData[$fieldVariable],
1474
+                                    api_get_path(WEB_UPLOAD_PATH).$extraData[$fieldVariable],
1475 1475
                                     $field_details['display_text'],
1476 1476
                                     ['width' => '300']
1477 1477
                                 );
@@ -1494,7 +1494,7 @@  discard block
 block discarded – undo
1494 1494
                         $allowed_picture_types = ['jpg', 'jpeg', 'png', 'gif'];
1495 1495
                         $form->addRule(
1496 1496
                             'extra_'.$field_details['variable'],
1497
-                            get_lang('OnlyImagesAllowed') . ' ('.implode(',', $allowed_picture_types).')',
1497
+                            get_lang('OnlyImagesAllowed').' ('.implode(',', $allowed_picture_types).')',
1498 1498
                             'filetype',
1499 1499
                             $allowed_picture_types
1500 1500
                         );
@@ -1536,10 +1536,10 @@  discard block
 block discarded – undo
1536 1536
                         if (is_array($extraData) &&
1537 1537
                             array_key_exists($fieldVariable, $extraData)
1538 1538
                         ) {
1539
-                            if (file_exists(api_get_path(SYS_UPLOAD_PATH) . $extraData[$fieldVariable])) {
1539
+                            if (file_exists(api_get_path(SYS_UPLOAD_PATH).$extraData[$fieldVariable])) {
1540 1540
                                 $fieldTexts[] = Display::url(
1541
-                                    api_get_path(WEB_UPLOAD_PATH) . $extraData[$fieldVariable],
1542
-                                    api_get_path(WEB_UPLOAD_PATH) . $extraData[$fieldVariable],
1541
+                                    api_get_path(WEB_UPLOAD_PATH).$extraData[$fieldVariable],
1542
+                                    api_get_path(WEB_UPLOAD_PATH).$extraData[$fieldVariable],
1543 1543
                                     array(
1544 1544
                                         'title' => $field_details['display_text'],
1545 1545
                                         'target' => '_blank'
@@ -1579,12 +1579,12 @@  discard block
 block discarded – undo
1579 1579
                             "extra_{$field_details['variable']}",
1580 1580
                             $field_details['display_text']
1581 1581
                         );
1582
-                        $form->applyFilter('extra_' . $field_details['variable'], 'stripslashes');
1582
+                        $form->applyFilter('extra_'.$field_details['variable'], 'stripslashes');
1583 1583
 
1584 1584
                         if (!$admin_permissions) {
1585 1585
                             if ($field_details['visible_to_self'] == 0) {
1586 1586
                                 $form->freeze(
1587
-                                    'extra_' . $field_details['variable']
1587
+                                    'extra_'.$field_details['variable']
1588 1588
                                 );
1589 1589
                             }
1590 1590
                         }
@@ -1595,13 +1595,13 @@  discard block
 block discarded – undo
1595 1595
                             $field_details['display_text']
1596 1596
                         );
1597 1597
                         $form->applyFilter(
1598
-                            'extra_' . $field_details['variable'],
1598
+                            'extra_'.$field_details['variable'],
1599 1599
                             'stripslashes'
1600 1600
                         );
1601 1601
                         if (!$admin_permissions) {
1602 1602
                             if ($field_details['visible_to_self'] == 0) {
1603 1603
                                 $form->freeze(
1604
-                                    'extra_' . $field_details['variable']
1604
+                                    'extra_'.$field_details['variable']
1605 1605
                                 );
1606 1606
                             }
1607 1607
                         }
@@ -1611,12 +1611,12 @@  discard block
 block discarded – undo
1611 1611
                             "extra_{$field_details['variable']}",
1612 1612
                             $field_details['display_text']
1613 1613
                         );
1614
-                        $form->applyFilter('extra_' . $field_details['variable'], 'stripslashes');
1614
+                        $form->applyFilter('extra_'.$field_details['variable'], 'stripslashes');
1615 1615
 
1616 1616
                         if (!$admin_permissions) {
1617 1617
                             if ($field_details['visible_to_self'] == 0) {
1618 1618
                                 $form->freeze(
1619
-                                    'extra_' . $field_details['variable']
1619
+                                    'extra_'.$field_details['variable']
1620 1620
                                 );
1621 1621
                             }
1622 1622
                         }
@@ -1627,13 +1627,13 @@  discard block
 block discarded – undo
1627 1627
                             $field_details['display_text']
1628 1628
                         );
1629 1629
                         $form->applyFilter(
1630
-                            'extra_' . $field_details['variable'],
1630
+                            'extra_'.$field_details['variable'],
1631 1631
                             'stripslashes'
1632 1632
                         );
1633 1633
                         if (!$admin_permissions) {
1634 1634
                             if ($field_details['visible_to_self'] == 0) {
1635 1635
                                 $form->freeze(
1636
-                                    'extra_' . $field_details['variable']
1636
+                                    'extra_'.$field_details['variable']
1637 1637
                                 );
1638 1638
                             }
1639 1639
                         }
@@ -1662,7 +1662,7 @@  discard block
 block discarded – undo
1662 1662
                             '<script>
1663 1663
                                 $(document).ready(function() {
1664 1664
 
1665
-                                    var address = "' . $dataValue . '";
1665
+                                    var address = "' . $dataValue.'";
1666 1666
                                     initializeGeo'.$field_details['variable'].'(address, false);
1667 1667
 
1668 1668
                                     $("#geolocalization_extra_'.$field_details['variable'].'").on("click", function() {
@@ -1694,7 +1694,7 @@  discard block
 block discarded – undo
1694 1694
                                         };
1695 1695
 
1696 1696
                                         var geoError = function(error) {
1697
-                                            alert("Geocode ' . get_lang('Error') . ': " + error);
1697
+                                            alert("Geocode ' . get_lang('Error').': " + error);
1698 1698
                                         };
1699 1699
 
1700 1700
                                         var geoOptions = {
@@ -1745,11 +1745,11 @@  discard block
 block discarded – undo
1745 1745
                                                         infowindow.open(map_'.$field_details['variable'].', marker);
1746 1746
                                                     });
1747 1747
                                                 } else {
1748
-                                                    alert("' . get_lang("NotFound") . '");
1748
+                                                    alert("' . get_lang("NotFound").'");
1749 1749
                                                 }
1750 1750
 
1751 1751
                                             } else {
1752
-                                                alert("Geocode ' . get_lang('Error') . ': " + status);
1752
+                                                alert("Geocode ' . get_lang('Error').': " + status);
1753 1753
                                             }
1754 1754
                                         });
1755 1755
                                     }
@@ -1812,8 +1812,8 @@  discard block
 block discarded – undo
1812 1812
                             '<script>
1813 1813
                                 $(document).ready(function() {
1814 1814
 
1815
-                                    var lat = "' . $lat . '";
1816
-                                    var lng = "' . $lng . '";
1815
+                                    var lat = "' . $lat.'";
1816
+                                    var lng = "' . $lng.'";
1817 1817
                                     var latLng = new google.maps.LatLng(lat, lng);
1818 1818
                                     initializeGeo'.$field_details['variable'].'(false, latLng);
1819 1819
 
@@ -1849,7 +1849,7 @@  discard block
 block discarded – undo
1849 1849
                                         };
1850 1850
 
1851 1851
                                         var geoError = function(error) {
1852
-                                            alert("Geocode ' . get_lang('Error') . ': " + error);
1852
+                                            alert("Geocode ' . get_lang('Error').': " + error);
1853 1853
                                         };
1854 1854
 
1855 1855
                                         var geoOptions = {
@@ -1900,11 +1900,11 @@  discard block
 block discarded – undo
1900 1900
                                                         infowindow.open(map_'.$field_details['variable'].', marker);
1901 1901
                                                     });
1902 1902
                                                 } else {
1903
-                                                    alert("' . get_lang("NotFound") . '");
1903
+                                                    alert("' . get_lang("NotFound").'");
1904 1904
                                                 }
1905 1905
 
1906 1906
                                             } else {
1907
-                                                alert("Geocode ' . get_lang('Error') . ': " + status);
1907
+                                                alert("Geocode ' . get_lang('Error').': " + status);
1908 1908
                                             }
1909 1909
                                         });
1910 1910
                                     }
@@ -2100,7 +2100,7 @@  discard block
 block discarded – undo
2100 2100
         $form->addElement('header', $header);
2101 2101
 
2102 2102
         if ($action == 'edit') {
2103
-            $translateUrl = api_get_path(WEB_CODE_PATH) . 'extrafield/translate.php?' . http_build_query([
2103
+            $translateUrl = api_get_path(WEB_CODE_PATH).'extrafield/translate.php?'.http_build_query([
2104 2104
                 'extra_field' => $id
2105 2105
             ]);
2106 2106
             $translateButton = Display::toolbarButton(get_lang('TranslateThisTerm'), $translateUrl, 'language', 'link');
@@ -2437,7 +2437,7 @@  discard block
 block discarded – undo
2437 2437
                 foreach ($extra_fields as $extra_info) {
2438 2438
                     $extra_field_info = $extra_info['extra_field_info'];
2439 2439
                     $inject_joins .= " INNER JOIN $this->table_field_values fv$counter
2440
-                                       ON (s." . $this->primaryKey . " = fv$counter." . $this->handler_id . ") ";
2440
+                                       ON (s.".$this->primaryKey." = fv$counter.".$this->handler_id.") ";
2441 2441
                     // Add options
2442 2442
                     if (isset($extra_field_info['field_type']) && in_array(
2443 2443
                             $extra_field_info['field_type'],
@@ -2450,7 +2450,7 @@  discard block
 block discarded – undo
2450 2450
                     ) {
2451 2451
                         $options['where'] = str_replace(
2452 2452
                             $extra_info['field'],
2453
-                            'fv' . $counter . '.field_id = ' . $extra_info['id'] . ' AND fvo' . $counter . '.option_value',
2453
+                            'fv'.$counter.'.field_id = '.$extra_info['id'].' AND fvo'.$counter.'.option_value',
2454 2454
                             $options['where']
2455 2455
                         );
2456 2456
                         $inject_joins .= "
@@ -2465,13 +2465,13 @@  discard block
 block discarded – undo
2465 2465
                     ) {
2466 2466
                         $options['where'] = str_replace(
2467 2467
                             $extra_info['field'],
2468
-                            'tag' . $counter . '.tag ',
2468
+                            'tag'.$counter.'.tag ',
2469 2469
                             $options['where']
2470 2470
                         );
2471 2471
 
2472 2472
                         $inject_joins .= "
2473 2473
                             INNER JOIN $this->table_field_rel_tag tag_rel$counter
2474
-                            ON (tag_rel$counter.field_id = ".$extra_info['id']." AND tag_rel$counter.item_id = s." . $this->primaryKey.")
2474
+                            ON (tag_rel$counter.field_id = ".$extra_info['id']." AND tag_rel$counter.item_id = s.".$this->primaryKey.")
2475 2475
                             INNER JOIN $this->table_field_tag tag$counter
2476 2476
                             ON (tag$counter.id =  tag_rel$counter.tag_id)
2477 2477
                         ";
@@ -2676,19 +2676,19 @@  discard block
 block discarded – undo
2676 2676
                         break;
2677 2677
                     }
2678 2678
 
2679
-                    if (!file_exists(api_get_path(SYS_UPLOAD_PATH) . $valueData['value'])) {
2679
+                    if (!file_exists(api_get_path(SYS_UPLOAD_PATH).$valueData['value'])) {
2680 2680
                         break;
2681 2681
                     }
2682 2682
 
2683 2683
                     $image = Display::img(
2684
-                        api_get_path(WEB_UPLOAD_PATH) . $valueData['value'],
2684
+                        api_get_path(WEB_UPLOAD_PATH).$valueData['value'],
2685 2685
                         $field['display_text'],
2686 2686
                         array('width' => '300')
2687 2687
                     );
2688 2688
 
2689 2689
                     $displayedValue = Display::url(
2690 2690
                         $image,
2691
-                        api_get_path(WEB_UPLOAD_PATH) . $valueData['value'],
2691
+                        api_get_path(WEB_UPLOAD_PATH).$valueData['value'],
2692 2692
                         array('target' => '_blank')
2693 2693
                     );
2694 2694
                     break;
@@ -2697,13 +2697,13 @@  discard block
 block discarded – undo
2697 2697
                         break;
2698 2698
                     }
2699 2699
 
2700
-                    if (!file_exists(api_get_path(SYS_UPLOAD_PATH) . $valueData['value'])) {
2700
+                    if (!file_exists(api_get_path(SYS_UPLOAD_PATH).$valueData['value'])) {
2701 2701
                         break;
2702 2702
                     }
2703 2703
 
2704 2704
                     $displayedValue = Display::url(
2705 2705
                         get_lang('Download'),
2706
-                        api_get_path(WEB_UPLOAD_PATH) . $valueData['value'],
2706
+                        api_get_path(WEB_UPLOAD_PATH).$valueData['value'],
2707 2707
                         array(
2708 2708
                             'title' => $field['display_text'],
2709 2709
                             'target' => '_blank'
Please login to merge, or discard this patch.