Completed
Push — console-installer ( 3d54e5...e2b50d )
by Adam
69:10 queued 48:24
created
include/Smarty/plugins/function.sugar_button.php 1 patch
Braces   +9 added lines, -5 removed lines patch added patch discarded remove patch
@@ -338,7 +338,9 @@  discard block
 block discarded – undo
338 338
 			break;
339 339
 
340 340
 			case "SUBPANELSAVE":
341
-                if($view == 'QuickCreate' || (isset($_REQUEST['target_action']) && strtolower($_REQUEST['target_action']) == 'quickcreate')) $view =  "form_SubpanelQuickCreate_{$module}";
341
+                if($view == 'QuickCreate' || (isset($_REQUEST['target_action']) && strtolower($_REQUEST['target_action']) == 'quickcreate')) {
342
+                    $view =  "form_SubpanelQuickCreate_{$module}";
343
+                }
342 344
 
343 345
                 /* BEGIN - SECURITY GROUPS - redirect a subpanel save to the detail view if select popup and user in more than 1 group*/ 
344 346
                 /**
@@ -475,8 +477,9 @@  discard block
 block discarded – undo
475 477
     $set_submit = false;
476 478
     $is_hidden_field = false;
477 479
     //if the code is wrapped with the form element, it will escape the operation for JS replacement
478
-    if(isset($dom_tree['tag']) && $dom_tree['tag'] == 'form')
479
-        return false;
480
+    if(isset($dom_tree['tag']) && $dom_tree['tag'] == 'form') {
481
+            return false;
482
+    }
480 483
 
481 484
     if(isset($dom_tree['type']) && $dom_tree['type'] == 'hidden') {
482 485
         $is_hidden_field = true;
@@ -486,8 +489,9 @@  discard block
 block discarded – undo
486 489
     if(isset($dom_tree['onclick'])) {
487 490
         if(strpos($dom_tree['onclick'], "this.form") !== false) {
488 491
             $dom_tree['onclick'] = str_replace("this.form", "_form", $dom_tree['onclick']);
489
-            if(substr($dom_tree['onclick'], -1) != ';')
490
-                $dom_tree['onclick'] .= ";";
492
+            if(substr($dom_tree['onclick'], -1) != ';') {
493
+                            $dom_tree['onclick'] .= ";";
494
+            }
491 495
             //Onclick handler contains returning a variable, for example it prompts a confirm message.
492 496
             if(strpos($dom_tree['onclick'], "return ") !== false ) {
493 497
                 $dom_tree['onclick'] = $js_form.' var _onclick=(function(){ldelim}'.$dom_tree['onclick']."{rdelim}()); if(_onclick!==false) _form.submit();";
Please login to merge, or discard this patch.
include/Smarty/Smarty_Compiler.class.php 1 patch
Braces   +148 added lines, -108 removed lines patch added patch discarded remove patch
@@ -243,7 +243,9 @@  discard block
 block discarded – undo
243 243
         // run template source through prefilter functions
244 244
         if (count($this->_plugins['prefilter']) > 0) {
245 245
             foreach ($this->_plugins['prefilter'] as $filter_name => $prefilter) {
246
-                if ($prefilter === false) continue;
246
+                if ($prefilter === false) {
247
+                    continue;
248
+                }
247 249
                 if ($prefilter[3] || is_callable($prefilter[0])) {
248 250
                     $source_content = call_user_func_array($prefilter[0],
249 251
                                                             array($source_content, &$this));
@@ -385,7 +387,9 @@  discard block
 block discarded – undo
385 387
         // run compiled template through postfilter functions
386 388
         if (count($this->_plugins['postfilter']) > 0) {
387 389
             foreach ($this->_plugins['postfilter'] as $filter_name => $postfilter) {
388
-                if ($postfilter === false) continue;
390
+                if ($postfilter === false) {
391
+                    continue;
392
+                }
389 393
                 if ($postfilter[3] || is_callable($postfilter[0])) {
390 394
                     $compiled_content = call_user_func_array($postfilter[0],
391 395
                                                               array($compiled_content, &$this));
@@ -435,8 +439,9 @@  discard block
 block discarded – undo
435 439
     function _compile_tag($template_tag)
436 440
     {
437 441
         /* Matched comment. */
438
-        if (substr($template_tag, 0, 1) == '*' && substr($template_tag, -1) == '*')
439
-            return '';
442
+        if (substr($template_tag, 0, 1) == '*' && substr($template_tag, -1) == '*') {
443
+                    return '';
444
+        }
440 445
         
441 446
         /* Split tag into two three parts: command, command modifiers and the arguments. */
442 447
         if(! preg_match('~^(?:(' . $this->_num_const_regexp . '|' . $this->_obj_call_regexp . '|' . $this->_var_regexp
@@ -474,18 +479,21 @@  discard block
 block discarded – undo
474 479
 
475 480
             case 'else':
476 481
                 list($_open_tag) = end($this->_tag_stack);
477
-                if ($_open_tag != 'if' && $_open_tag != 'elseif')
478
-                    $this->_syntax_error('unexpected {else}', E_USER_ERROR, __FILE__, __LINE__);
479
-                else
480
-                    $this->_push_tag('else');
482
+                if ($_open_tag != 'if' && $_open_tag != 'elseif') {
483
+                                    $this->_syntax_error('unexpected {else}', E_USER_ERROR, __FILE__, __LINE__);
484
+                } else {
485
+                                    $this->_push_tag('else');
486
+                }
481 487
                 return '<?php else: ?>';
482 488
 
483 489
             case 'elseif':
484 490
                 list($_open_tag) = end($this->_tag_stack);
485
-                if ($_open_tag != 'if' && $_open_tag != 'elseif')
486
-                    $this->_syntax_error('unexpected {elseif}', E_USER_ERROR, __FILE__, __LINE__);
487
-                if ($_open_tag == 'if')
488
-                    $this->_push_tag('elseif');
491
+                if ($_open_tag != 'if' && $_open_tag != 'elseif') {
492
+                                    $this->_syntax_error('unexpected {elseif}', E_USER_ERROR, __FILE__, __LINE__);
493
+                }
494
+                if ($_open_tag == 'if') {
495
+                                    $this->_push_tag('elseif');
496
+                }
489 497
                 return $this->_compile_if_tag($tag_args, true);
490 498
 
491 499
             case '/if':
@@ -515,10 +523,11 @@  discard block
 block discarded – undo
515 523
 
516 524
             case '/section':
517 525
                 $_open_tag = $this->_pop_tag('section');
518
-                if ($_open_tag == 'sectionelse')
519
-                    return "<?php endif; ?>";
520
-                else
521
-                    return "<?php endfor; endif; ?>";
526
+                if ($_open_tag == 'sectionelse') {
527
+                                    return "<?php endif; ?>";
528
+                } else {
529
+                                    return "<?php endfor; endif; ?>";
530
+                }
522 531
 
523 532
             case 'foreach':
524 533
                 $this->_push_tag('foreach');
@@ -531,10 +540,11 @@  discard block
 block discarded – undo
531 540
 
532 541
             case '/foreach':
533 542
                 $_open_tag = $this->_pop_tag('foreach');
534
-                if ($_open_tag == 'foreachelse')
535
-                    return "<?php endif; unset(\$_from); ?>";
536
-                else
537
-                    return "<?php endforeach; endif; unset(\$_from); ?>";
543
+                if ($_open_tag == 'foreachelse') {
544
+                                    return "<?php endif; unset(\$_from); ?>";
545
+                } else {
546
+                                    return "<?php endforeach; endif; unset(\$_from); ?>";
547
+                }
538 548
                 break;
539 549
 
540 550
             case 'strip':
@@ -677,8 +687,9 @@  discard block
 block discarded – undo
677 687
         if (substr($tag_command, 0, 1) == '/') {
678 688
             $start_tag = false;
679 689
             $tag_command = substr($tag_command, 1);
680
-        } else
681
-            $start_tag = true;
690
+        } else {
691
+                    $start_tag = true;
692
+        }
682 693
 
683 694
         $found = false;
684 695
         $have_function = true;
@@ -728,10 +739,11 @@  discard block
 block discarded – undo
728 739
          */
729 740
         $this->_add_plugin('block', $tag_command);
730 741
 
731
-        if ($start_tag)
732
-            $this->_push_tag($tag_command);
733
-        else
734
-            $this->_pop_tag($tag_command);
742
+        if ($start_tag) {
743
+                    $this->_push_tag($tag_command);
744
+        } else {
745
+                    $this->_pop_tag($tag_command);
746
+        }
735 747
 
736 748
         if ($start_tag) {
737 749
             $output = '<?php ' . $this->_push_cacheable_state('block', $tag_command);
@@ -856,8 +868,9 @@  discard block
 block discarded – undo
856 868
                     unset($attrs['assign']);
857 869
                     continue;
858 870
                 }
859
-                if (is_bool($arg_value))
860
-                    $arg_value = $arg_value ? 'true' : 'false';
871
+                if (is_bool($arg_value)) {
872
+                                    $arg_value = $arg_value ? 'true' : 'false';
873
+                }
861 874
                 $arg_list[] = "'$arg_name' => $arg_value";
862 875
             }
863 876
         }
@@ -948,8 +961,9 @@  discard block
 block discarded – undo
948 961
         }
949 962
 
950 963
         foreach ($attrs as $arg_name => $arg_value) {
951
-            if (is_bool($arg_value))
952
-                $arg_value = $arg_value ? 'true' : 'false';
964
+            if (is_bool($arg_value)) {
965
+                            $arg_value = $arg_value ? 'true' : 'false';
966
+            }
953 967
             $arg_list[] = "'$arg_name' => $arg_value";
954 968
         }
955 969
 
@@ -987,13 +1001,15 @@  discard block
 block discarded – undo
987 1001
                 $theme_template = $arg_value;
988 1002
                 continue;
989 1003
             }
990
-            if (is_bool($arg_value))
991
-                $arg_value = $arg_value ? 'true' : 'false';
1004
+            if (is_bool($arg_value)) {
1005
+                            $arg_value = $arg_value ? 'true' : 'false';
1006
+            }
992 1007
             $arg_list[] = "'$arg_name' => $arg_value";
993 1008
         }
994 1009
 
995
-        if ( $theme_template == 'true' )
996
-            $include_file = '"'.SugarThemeRegistry::current()->getTemplate(str_replace(array('"',"'"),'',$include_file)).'"';
1010
+        if ( $theme_template == 'true' ) {
1011
+                    $include_file = '"'.SugarThemeRegistry::current()->getTemplate(str_replace(array('"',"'"),'',$include_file)).'"';
1012
+        }
997 1013
 
998 1014
         $output = '<?php ';
999 1015
 
@@ -1040,8 +1056,9 @@  discard block
 block discarded – undo
1040 1056
         $arg_list = array();
1041 1057
         foreach($attrs as $arg_name => $arg_value) {
1042 1058
             if($arg_name != 'file' AND $arg_name != 'once' AND $arg_name != 'assign') {
1043
-                if(is_bool($arg_value))
1044
-                    $arg_value = $arg_value ? 'true' : 'false';
1059
+                if(is_bool($arg_value)) {
1060
+                                    $arg_value = $arg_value ? 'true' : 'false';
1061
+                }
1045 1062
                 $arg_list[] = "'$arg_name' => $arg_value";
1046 1063
             }
1047 1064
         }
@@ -1079,10 +1096,11 @@  discard block
 block discarded – undo
1079 1096
                     break;
1080 1097
 
1081 1098
                 case 'show':
1082
-                    if (is_bool($attr_value))
1083
-                        $show_attr_value = $attr_value ? 'true' : 'false';
1084
-                    else
1085
-                        $show_attr_value = "(bool)$attr_value";
1099
+                    if (is_bool($attr_value)) {
1100
+                                            $show_attr_value = $attr_value ? 'true' : 'false';
1101
+                    } else {
1102
+                                            $show_attr_value = "(bool)$attr_value";
1103
+                    }
1086 1104
                     $output .= "{$section_props}['show'] = $show_attr_value;\n";
1087 1105
                     break;
1088 1106
 
@@ -1105,24 +1123,28 @@  discard block
 block discarded – undo
1105 1123
             }
1106 1124
         }
1107 1125
 
1108
-        if (!isset($attrs['show']))
1109
-            $output .= "{$section_props}['show'] = true;\n";
1126
+        if (!isset($attrs['show'])) {
1127
+                    $output .= "{$section_props}['show'] = true;\n";
1128
+        }
1110 1129
 
1111
-        if (!isset($attrs['loop']))
1112
-            $output .= "{$section_props}['loop'] = 1;\n";
1130
+        if (!isset($attrs['loop'])) {
1131
+                    $output .= "{$section_props}['loop'] = 1;\n";
1132
+        }
1113 1133
 
1114
-        if (!isset($attrs['max']))
1115
-            $output .= "{$section_props}['max'] = {$section_props}['loop'];\n";
1116
-        else
1117
-            $output .= "if ({$section_props}['max'] < 0)\n" .
1134
+        if (!isset($attrs['max'])) {
1135
+                    $output .= "{$section_props}['max'] = {$section_props}['loop'];\n";
1136
+        } else {
1137
+                    $output .= "if ({$section_props}['max'] < 0)\n" .
1118 1138
                        "    {$section_props}['max'] = {$section_props}['loop'];\n";
1139
+        }
1119 1140
 
1120
-        if (!isset($attrs['step']))
1121
-            $output .= "{$section_props}['step'] = 1;\n";
1141
+        if (!isset($attrs['step'])) {
1142
+                    $output .= "{$section_props}['step'] = 1;\n";
1143
+        }
1122 1144
 
1123
-        if (!isset($attrs['start']))
1124
-            $output .= "{$section_props}['start'] = {$section_props}['step'] > 0 ? 0 : {$section_props}['loop']-1;\n";
1125
-        else {
1145
+        if (!isset($attrs['start'])) {
1146
+                    $output .= "{$section_props}['start'] = {$section_props}['step'] > 0 ? 0 : {$section_props}['loop']-1;\n";
1147
+        } else {
1126 1148
             $output .= "if ({$section_props}['start'] < 0)\n" .
1127 1149
                        "    {$section_props}['start'] = max({$section_props}['step'] > 0 ? 0 : -1, {$section_props}['loop'] + {$section_props}['start']);\n" .
1128 1150
                        "else\n" .
@@ -1377,8 +1399,9 @@  discard block
 block discarded – undo
1377 1399
                                 $is_arg_start--;
1378 1400
                             } 
1379 1401
                         } 
1380
-                    } else
1381
-                        $is_arg_start = $i-1;
1402
+                    } else {
1403
+                                            $is_arg_start = $i-1;
1404
+                    }
1382 1405
                     /* Construct the argument for 'is' expression, so it knows
1383 1406
                        what to operate on. */
1384 1407
                     $is_arg = implode(' ', array_slice($tokens, $is_arg_start, $i - $is_arg_start));
@@ -1420,10 +1443,11 @@  discard block
 block discarded – undo
1420 1443
             }
1421 1444
         }
1422 1445
 
1423
-        if ($elseif)
1424
-            return '<?php elseif ('.implode(' ', $tokens).'): ?>';
1425
-        else
1426
-            return '<?php if ('.implode(' ', $tokens).'): ?>';
1446
+        if ($elseif) {
1447
+                    return '<?php elseif ('.implode(' ', $tokens).'): ?>';
1448
+        } else {
1449
+                    return '<?php if ('.implode(' ', $tokens).'): ?>';
1450
+        }
1427 1451
     }
1428 1452
 
1429 1453
 
@@ -1447,10 +1471,12 @@  discard block
 block discarded – undo
1447 1471
         }
1448 1472
 
1449 1473
         foreach ($attrs as $arg_name => $arg_value) {
1450
-            if (is_bool($arg_value))
1451
-                $arg_value = $arg_value ? 'true' : 'false';
1452
-            if (is_null($arg_value))
1453
-                $arg_value = 'null';
1474
+            if (is_bool($arg_value)) {
1475
+                            $arg_value = $arg_value ? 'true' : 'false';
1476
+            }
1477
+            if (is_null($arg_value)) {
1478
+                            $arg_value = 'null';
1479
+            }
1454 1480
             if ($_cache_attrs && in_array($arg_name, $_cache_attrs)) {
1455 1481
                 $arg_list[] = "'$arg_name' => (\$this->_cache_including) ? \$_cache_attrs['$arg_name'] : (\$_cache_attrs['$arg_name']=$arg_value)";
1456 1482
             } else {
@@ -1475,8 +1501,9 @@  discard block
 block discarded – undo
1475 1501
         if (($first_token = array_shift($tokens)) == 'not') {
1476 1502
             $negate_expr = true;
1477 1503
             $expr_type = array_shift($tokens);
1478
-        } else
1479
-            $expr_type = $first_token;
1504
+        } else {
1505
+                    $expr_type = $first_token;
1506
+        }
1480 1507
 
1481 1508
         switch ($expr_type) {
1482 1509
             case 'even':
@@ -1484,8 +1511,9 @@  discard block
 block discarded – undo
1484 1511
                     $expr_end++;
1485 1512
                     $expr_arg = $tokens[$expr_end++];
1486 1513
                     $expr = "!(1 & ($is_arg / " . $this->_parse_var_props($expr_arg) . "))";
1487
-                } else
1488
-                    $expr = "!(1 & $is_arg)";
1514
+                } else {
1515
+                                    $expr = "!(1 & $is_arg)";
1516
+                }
1489 1517
                 break;
1490 1518
 
1491 1519
             case 'odd':
@@ -1493,8 +1521,9 @@  discard block
 block discarded – undo
1493 1521
                     $expr_end++;
1494 1522
                     $expr_arg = $tokens[$expr_end++];
1495 1523
                     $expr = "(1 & ($is_arg / " . $this->_parse_var_props($expr_arg) . "))";
1496
-                } else
1497
-                    $expr = "(1 & $is_arg)";
1524
+                } else {
1525
+                                    $expr = "(1 & $is_arg)";
1526
+                }
1498 1527
                 break;
1499 1528
 
1500 1529
             case 'div':
@@ -1553,16 +1582,18 @@  discard block
 block discarded – undo
1553 1582
                     if (preg_match('~^\w+$~', $token)) {
1554 1583
                         $attr_name = $token;
1555 1584
                         $state = 1;
1556
-                    } else
1557
-                        $this->_syntax_error("invalid attribute name: '$token'", E_USER_ERROR, __FILE__, __LINE__);
1585
+                    } else {
1586
+                                            $this->_syntax_error("invalid attribute name: '$token'", E_USER_ERROR, __FILE__, __LINE__);
1587
+                    }
1558 1588
                     break;
1559 1589
 
1560 1590
                 case 1:
1561 1591
                     /* If the token is '=', then we go to state 2. */
1562 1592
                     if ($token == '=') {
1563 1593
                         $state = 2;
1564
-                    } else
1565
-                        $this->_syntax_error("expecting '=' after attribute name '$last_token'", E_USER_ERROR, __FILE__, __LINE__);
1594
+                    } else {
1595
+                                            $this->_syntax_error("expecting '=' after attribute name '$last_token'", E_USER_ERROR, __FILE__, __LINE__);
1596
+                    }
1566 1597
                     break;
1567 1598
 
1568 1599
                 case 2:
@@ -1586,8 +1617,9 @@  discard block
 block discarded – undo
1586 1617
 
1587 1618
                         $attrs[$attr_name] = $token;
1588 1619
                         $state = 0;
1589
-                    } else
1590
-                        $this->_syntax_error("'=' cannot be an attribute value", E_USER_ERROR, __FILE__, __LINE__);
1620
+                    } else {
1621
+                                            $this->_syntax_error("'=' cannot be an attribute value", E_USER_ERROR, __FILE__, __LINE__);
1622
+                    }
1591 1623
                     break;
1592 1624
             }
1593 1625
             $last_token = $token;
@@ -1649,32 +1681,27 @@  discard block
 block discarded – undo
1649 1681
                     $this->_parse_modifiers($return, $match[2]);
1650 1682
                 }
1651 1683
                 return $return;
1652
-            }
1653
-        elseif(preg_match('~^' . $this->_num_const_regexp . '(?:' . $this->_mod_regexp . '*)$~', $val)) {
1684
+            } elseif(preg_match('~^' . $this->_num_const_regexp . '(?:' . $this->_mod_regexp . '*)$~', $val)) {
1654 1685
                 // numerical constant
1655 1686
                 preg_match('~^(' . $this->_num_const_regexp . ')('. $this->_mod_regexp . '*)$~', $val, $match);
1656 1687
                 if($match[2] != '') {
1657 1688
                     $this->_parse_modifiers($match[1], $match[2]);
1658 1689
                     return $match[1];
1659 1690
                 }
1660
-            }
1661
-        elseif(preg_match('~^' . $this->_si_qstr_regexp . '(?:' . $this->_mod_regexp . '*)$~', $val)) {
1691
+            } elseif(preg_match('~^' . $this->_si_qstr_regexp . '(?:' . $this->_mod_regexp . '*)$~', $val)) {
1662 1692
                 // single quoted text
1663 1693
                 preg_match('~^(' . $this->_si_qstr_regexp . ')('. $this->_mod_regexp . '*)$~', $val, $match);
1664 1694
                 if($match[2] != '') {
1665 1695
                     $this->_parse_modifiers($match[1], $match[2]);
1666 1696
                     return $match[1];
1667 1697
                 }
1668
-            }
1669
-        elseif(preg_match('~^' . $this->_cvar_regexp . '(?:' . $this->_mod_regexp . '*)$~', $val)) {
1698
+            } elseif(preg_match('~^' . $this->_cvar_regexp . '(?:' . $this->_mod_regexp . '*)$~', $val)) {
1670 1699
                 // config var
1671 1700
                 return $this->_parse_conf_var($val);
1672
-            }
1673
-        elseif(preg_match('~^' . $this->_svar_regexp . '(?:' . $this->_mod_regexp . '*)$~', $val)) {
1701
+            } elseif(preg_match('~^' . $this->_svar_regexp . '(?:' . $this->_mod_regexp . '*)$~', $val)) {
1674 1702
                 // section var
1675 1703
                 return $this->_parse_section_prop($val);
1676
-            }
1677
-        elseif(!in_array($val, $this->_permitted_tokens) && !is_numeric($val)) {
1704
+            } elseif(!in_array($val, $this->_permitted_tokens) && !is_numeric($val)) {
1678 1705
             // literal string
1679 1706
             return $this->_expand_quoted_text('"' . strtr($val, array('\\' => '\\\\', '"' => '\\"')) .'"');
1680 1707
         }
@@ -1737,8 +1764,9 @@  discard block
 block discarded – undo
1737 1764
                         // just output the math operator to php
1738 1765
                         $_output .= $_math_var;
1739 1766
 
1740
-                        if(empty($_first_var))
1741
-                            $_first_var = $_complete_var;
1767
+                        if(empty($_first_var)) {
1768
+                                                    $_first_var = $_complete_var;
1769
+                        }
1742 1770
 
1743 1771
                         $_complete_var = "";
1744 1772
                     } else {
@@ -1747,8 +1775,9 @@  discard block
 block discarded – undo
1747 1775
                 }
1748 1776
             }
1749 1777
             if($_has_math) {
1750
-                if(!empty($_complete_var) || is_numeric($_complete_var))
1751
-                    $_output .= $this->_parse_var($_complete_var);
1778
+                if(!empty($_complete_var) || is_numeric($_complete_var)) {
1779
+                                    $_output .= $this->_parse_var($_complete_var);
1780
+                }
1752 1781
 
1753 1782
                 // get the modifiers working (only the last var from math + modifier is left)
1754 1783
                 $var_expr = $_complete_var;
@@ -1756,10 +1785,11 @@  discard block
 block discarded – undo
1756 1785
         }
1757 1786
 
1758 1787
         // prevent cutting of first digit in the number (we _definitly_ got a number if the first char is a digit)
1759
-        if(is_numeric(substr($var_expr, 0, 1)))
1760
-            $_var_ref = $var_expr;
1761
-        else
1762
-            $_var_ref = substr($var_expr, 1);
1788
+        if(is_numeric(substr($var_expr, 0, 1))) {
1789
+                    $_var_ref = $var_expr;
1790
+        } else {
1791
+                    $_var_ref = substr($var_expr, 1);
1792
+        }
1763 1793
         
1764 1794
         if(!$_has_math) {
1765 1795
             
@@ -1812,10 +1842,11 @@  discard block
 block discarded – undo
1812 1842
                         $_output .= "[\$this->_sections['$_var_section']['$_var_section_prop']]";
1813 1843
                     }
1814 1844
                 } else if (substr($_index, 0, 1) == '.') {
1815
-                    if (substr($_index, 1, 1) == '$')
1816
-                        $_output .= "[\$this->_tpl_vars['" . substr($_index, 2) . "']]";
1817
-                    else
1818
-                        $_output .= "['" . substr($_index, 1) . "']";
1845
+                    if (substr($_index, 1, 1) == '$') {
1846
+                                            $_output .= "[\$this->_tpl_vars['" . substr($_index, 2) . "']]";
1847
+                    } else {
1848
+                                            $_output .= "['" . substr($_index, 1) . "']";
1849
+                    }
1819 1850
                 } else if (substr($_index,0,2) == '->') {
1820 1851
                     if(substr($_index,2,2) == '__') {
1821 1852
                         $this->_syntax_error('call to internal object members is not allowed', E_USER_ERROR, __FILE__, __LINE__);
@@ -1956,10 +1987,11 @@  discard block
 block discarded – undo
1956 1987
                     $_modifier_args[0] = '@' . $_modifier_args[0];
1957 1988
                 }
1958 1989
             }
1959
-            if (count($_modifier_args) > 0)
1960
-                $_modifier_args = ', '.implode(', ', $_modifier_args);
1961
-            else
1962
-                $_modifier_args = '';
1990
+            if (count($_modifier_args) > 0) {
1991
+                            $_modifier_args = ', '.implode(', ', $_modifier_args);
1992
+            } else {
1993
+                            $_modifier_args = '';
1994
+            }
1963 1995
 
1964 1996
             if ($_map_array) {
1965 1997
                 $output = "((is_array(\$_tmp=$output)) ? \$this->_run_mod_handler('$_modifier_name', true, \$_tmp$_modifier_args) : " . $this->_compile_plugin_call('modifier', $_modifier_name) . "(\$_tmp$_modifier_args))";
@@ -2273,8 +2305,12 @@  discard block
 block discarded – undo
2273 2305
     function _push_cacheable_state($type, $name) {
2274 2306
         $_cacheable = !isset($this->_plugins[$type][$name]) || $this->_plugins[$type][$name][4];
2275 2307
         if ($_cacheable
2276
-            || 0<$this->_cacheable_state++) return '';
2277
-        if (!isset($this->_cache_serial)) $this->_cache_serial = md5(uniqid('Smarty'));
2308
+            || 0<$this->_cacheable_state++) {
2309
+            return '';
2310
+        }
2311
+        if (!isset($this->_cache_serial)) {
2312
+            $this->_cache_serial = md5(uniqid('Smarty'));
2313
+        }
2278 2314
         $_ret = 'if ($this->caching && !$this->_cache_including): echo \'{nocache:'
2279 2315
             . $this->_cache_serial . '#' . $this->_nocache_count
2280 2316
             . '}\'; endif;';
@@ -2291,7 +2327,9 @@  discard block
 block discarded – undo
2291 2327
     function _pop_cacheable_state($type, $name) {
2292 2328
         $_cacheable = !isset($this->_plugins[$type][$name]) || $this->_plugins[$type][$name][4];
2293 2329
         if ($_cacheable
2294
-            || --$this->_cacheable_state>0) return '';
2330
+            || --$this->_cacheable_state>0) {
2331
+            return '';
2332
+        }
2295 2333
         return 'if ($this->caching && !$this->_cache_including): echo \'{/nocache:'
2296 2334
             . $this->_cache_serial . '#' . ($this->_nocache_count++)
2297 2335
             . '}\'; endif;';
@@ -2357,11 +2395,13 @@  discard block
 block discarded – undo
2357 2395
  */
2358 2396
 function _smarty_sort_length($a, $b)
2359 2397
 {
2360
-    if($a == $b)
2361
-        return 0;
2398
+    if($a == $b) {
2399
+            return 0;
2400
+    }
2362 2401
 
2363
-    if(strlen($a) == strlen($b))
2364
-        return ($a > $b) ? -1 : 1;
2402
+    if(strlen($a) == strlen($b)) {
2403
+            return ($a > $b) ? -1 : 1;
2404
+    }
2365 2405
 
2366 2406
     return (strlen($a) > strlen($b)) ? -1 : 1;
2367 2407
 }
Please login to merge, or discard this patch.
data/Relationships/SugarRelationship.php 1 patch
Braces   +34 added lines, -23 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -135,8 +137,7 @@  discard block
 block discarded – undo
135 137
             if ($link->getSide() == REL_LHS)
136 138
             {
137 139
                 $sub_result = $this->remove($focus, $relBean);
138
-            }
139
-            else
140
+            } else
140 141
             {
141 142
                 $sub_result = $this->remove($relBean, $focus);
142 143
             }
@@ -202,8 +203,10 @@  discard block
 block discarded – undo
202 203
     protected function addRow($row)
203 204
     {
204 205
         $existing = $this->checkExisting($row);
205
-        if (!empty($existing)) //Update the existing row, overriding the values with those passed in
206
+        if (!empty($existing)) {
207
+            //Update the existing row, overriding the values with those passed in
206 208
             return $this->updateRow($existing['id'], array_merge($existing, $row));
209
+        }
207 210
 
208 211
         $values = array();
209 212
         foreach($this->getFields() as  $def)
@@ -232,7 +235,9 @@  discard block
 block discarded – undo
232 235
     {
233 236
         $newVals = array();
234 237
         //Unset the ID since we are using it to update the row
235
-        if (isset($values['id'])) unset($values['id']);
238
+        if (isset($values['id'])) {
239
+            unset($values['id']);
240
+        }
236 241
         foreach($values as $field => $val)
237 242
         {
238 243
             $newVals[] = "$field='$val'";
@@ -252,8 +257,9 @@  discard block
 block discarded – undo
252 257
      */
253 258
     protected function removeRow($where)
254 259
     {
255
-        if (empty($where))
256
-            return false;
260
+        if (empty($where)) {
261
+                    return false;
262
+        }
257 263
 
258 264
         $date_modified = TimeDate::getInstance()->getNow()->asDb();
259 265
         $stringSets = array();
@@ -278,8 +284,9 @@  discard block
 block discarded – undo
278 284
     {
279 285
         $leftIDName = $this->def['join_key_lhs'];
280 286
         $rightIDName = $this->def['join_key_rhs'];
281
-        if (empty($row[$leftIDName]) ||  empty($row[$rightIDName]))
282
-            return false;
287
+        if (empty($row[$leftIDName]) ||  empty($row[$rightIDName])) {
288
+                    return false;
289
+        }
283 290
 
284 291
         $leftID = $row[$leftIDName];
285 292
         $rightID = $row[$rightIDName];
@@ -308,14 +315,16 @@  discard block
 block discarded – undo
308 315
     {
309 316
         $ignore_role_filter = $ignore_role_filter || $this->ignore_role_filter;
310 317
         $roleCheck = "";
311
-        if (empty ($table))
312
-            $table = $this->getRelationshipTable();
318
+        if (empty ($table)) {
319
+                    $table = $this->getRelationshipTable();
320
+        }
313 321
         if (!empty($this->def['relationship_role_column']) && !empty($this->def["relationship_role_column_value"]) && !$ignore_role_filter )
314 322
         {
315
-            if (empty($table))
316
-                $roleCheck = " AND $this->relationship_role_column";
317
-            else
318
-                $roleCheck = " AND $table.{$this->relationship_role_column}";
323
+            if (empty($table)) {
324
+                            $roleCheck = " AND $this->relationship_role_column";
325
+            } else {
326
+                            $roleCheck = " AND $table.{$this->relationship_role_column}";
327
+            }
319 328
             //role column value.
320 329
             if (empty($this->def['relationship_role_column_value']))
321 330
             {
@@ -406,8 +415,9 @@  discard block
 block discarded – undo
406 415
     protected function getOptionalWhereClause($optional_array) {
407 416
         //lhs_field, operator, and rhs_value must be set in optional_array
408 417
         foreach(array("lhs_field", "operator", "rhs_value") as $required){
409
-            if (empty($optional_array[$required]))
410
-                return "";
418
+            if (empty($optional_array[$required])) {
419
+                            return "";
420
+            }
411 421
         }
412 422
 
413 423
         return $optional_array['lhs_field']."".$optional_array['operator']."'".$optional_array['rhs_value']."'";
@@ -445,8 +455,7 @@  discard block
 block discarded – undo
445 455
                 if (empty($bean->deleted) && empty($bean->in_save))
446 456
                 {
447 457
                     $bean->save();
448
-                }
449
-                else
458
+                } else
450 459
                 {
451 460
                     // Bug 55942 save the in-save id which will be used to send workflow alert later
452 461
                     if (isset($bean->id) && !empty($_SESSION['WORKFLOW_ALERTS']))
@@ -479,8 +488,9 @@  discard block
 block discarded – undo
479 488
 
480 489
     public function __get($name)
481 490
     {
482
-        if (isset($this->def[$name]))
483
-            return $this->def[$name];
491
+        if (isset($this->def[$name])) {
492
+                    return $this->def[$name];
493
+        }
484 494
 
485 495
         switch($name)
486 496
         {
@@ -500,8 +510,9 @@  discard block
 block discarded – undo
500 510
                 return array('lhs_table', 'lhs_key', 'rhs_module', 'rhs_table', 'rhs_key', 'relationship_type');
501 511
         }
502 512
 
503
-        if (isset($this->$name))
504
-            return $this->$name;
513
+        if (isset($this->$name)) {
514
+                    return $this->$name;
515
+        }
505 516
 
506 517
         return null;
507 518
     }
Please login to merge, or discard this patch.
data/Relationships/One2OneBeanRelationship.php 1 patch
Braces   +9 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -72,11 +74,13 @@  discard block
 block discarded – undo
72 74
     protected function updateLinks($lhs, $lhsLinkName, $rhs, $rhsLinkName)
73 75
     {
74 76
         //RHS and LHS only ever have one bean
75
-        if (isset($lhs->$lhsLinkName))
76
-            $lhs->$lhsLinkName->beans = array($rhs->id => $rhs);
77
+        if (isset($lhs->$lhsLinkName)) {
78
+                    $lhs->$lhsLinkName->beans = array($rhs->id => $rhs);
79
+        }
77 80
 
78
-        if (isset($rhs->$rhsLinkName))
79
-            $rhs->$rhsLinkName->beans = array($lhs->id => $lhs);
81
+        if (isset($rhs->$rhsLinkName)) {
82
+                    $rhs->$rhsLinkName->beans = array($lhs->id => $lhs);
83
+        }
80 84
     }
81 85
 
82 86
     public function getJoin($link, $params = array(), $return_array = false)
Please login to merge, or discard this patch.
data/Relationships/One2MBeanRelationship.php 1 patch
Braces   +39 added lines, -25 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -66,7 +68,9 @@  discard block
 block discarded – undo
66 68
         // test to see if the relationship exist if the relationship between the two beans
67 69
         // exist then we just fail out with false as we don't want to re-trigger this
68 70
         // the save and such as it causes problems with the related() in sugarlogic
69
-        if($this->relationship_exists($lhs, $rhs) && !empty($GLOBALS['resavingRelatedBeans'])) return false;
71
+        if($this->relationship_exists($lhs, $rhs) && !empty($GLOBALS['resavingRelatedBeans'])) {
72
+            return false;
73
+        }
70 74
 
71 75
         $lhsLinkName = $this->lhsLink;
72 76
         $rhsLinkName = $this->rhsLink;
@@ -79,8 +83,9 @@  discard block
 block discarded – undo
79 83
             $prevRelated = $oldLink->getBeans(null);
80 84
             foreach($prevRelated as $oldLHS)
81 85
             {
82
-                if ($oldLHS->id != $lhs->id)
83
-                    $this->remove($oldLHS, $rhs, false);
86
+                if ($oldLHS->id != $lhs->id) {
87
+                                    $this->remove($oldLHS, $rhs, false);
88
+                }
84 89
             }
85 90
         }
86 91
 
@@ -111,19 +116,22 @@  discard block
 block discarded – undo
111 116
 
112 117
         //One2MBean relationships require that the RHS bean be saved or else the relationship will not be saved.
113 118
         //If we aren't already in a relationship save, intitiate a save now.
114
-        if (empty($GLOBALS['resavingRelatedBeans']))
115
-            SugarRelationship::resaveRelatedBeans();
119
+        if (empty($GLOBALS['resavingRelatedBeans'])) {
120
+                    SugarRelationship::resaveRelatedBeans();
121
+        }
116 122
         
117 123
         return true;
118 124
     }
119 125
 
120 126
     protected function updateLinks($lhs, $lhsLinkName, $rhs, $rhsLinkName)
121 127
     {
122
-        if (isset($lhs->$lhsLinkName))
123
-            $lhs->$lhsLinkName->addBean($rhs);
128
+        if (isset($lhs->$lhsLinkName)) {
129
+                    $lhs->$lhsLinkName->addBean($rhs);
130
+        }
124 131
         //RHS only has one bean ever, so we don't need to preload the relationship
125
-        if (isset($rhs->$rhsLinkName))
126
-            $rhs->$rhsLinkName->beans = array($lhs->id => $lhs);
132
+        if (isset($rhs->$rhsLinkName)) {
133
+                    $rhs->$rhsLinkName->beans = array($lhs->id => $lhs);
134
+        }
127 135
     }
128 136
 
129 137
     protected function updateFields($lhs, $rhs, $additionalFields)
@@ -148,8 +156,9 @@  discard block
 block discarded – undo
148 156
         $rhsID = $this->def['rhs_key'];
149 157
 
150 158
         //If this relationship has already been removed, we can just return
151
-        if ($rhs->$rhsID != $lhs->id)
152
-            return false;
159
+        if ($rhs->$rhsID != $lhs->id) {
160
+                    return false;
161
+        }
153 162
 
154 163
         $rhs->$rhsID = '';
155 164
 
@@ -192,8 +201,7 @@  discard block
 block discarded – undo
192 201
             {
193 202
                 $rows[$id] = array('id' => $id);
194 203
             }
195
-        }
196
-        else //If the link is LHS, we need to query to get the full list and load all the beans.
204
+        } else //If the link is LHS, we need to query to get the full list and load all the beans.
197 205
         {
198 206
             $db = DBManagerFactory::getInstance();
199 207
             $query = $this->getQuery($link, $params);
@@ -241,8 +249,9 @@  discard block
 block discarded – undo
241 249
             //Add any optional where clause
242 250
             if (!empty($params['where'])) {
243 251
                 $add_where = is_string($params['where']) ? $params['where'] : "$rhsTable." . $this->getOptionalWhereClause($params['where']);
244
-                if (!empty($add_where))
245
-                    $where .= " AND $add_where";
252
+                if (!empty($add_where)) {
253
+                                    $where .= " AND $add_where";
254
+                }
246 255
             }
247 256
 
248 257
             //Add any optional order clauses
@@ -255,7 +264,9 @@  discard block
 block discarded – undo
255 264
             if (empty($params['return_as_array'])) {
256 265
                 //Limit is not compatible with return_as_array
257 266
                 $query = "SELECT id FROM $from $where";
258
-                if (!empty($order_by)) $query .= ' ORDER BY '.$order_by;
267
+                if (!empty($order_by)) {
268
+                    $query .= ' ORDER BY '.$order_by;
269
+                }
259 270
                 if (!empty($params['limit']) && $params['limit'] > 0) {
260 271
                     $offset = isset($params['offset']) ? $params['offset'] : 0;
261 272
                     $query = DBManagerFactory::getInstance()->limitQuery($query, $offset, $params['limit'], false, "", false);
@@ -276,8 +287,9 @@  discard block
 block discarded – undo
276 287
     {
277 288
         $linkIsLHS = $link->getSide() == REL_LHS;
278 289
         $startingTable = (empty($params['left_join_table_alias']) ? $this->def['lhs_table'] : $params['left_join_table_alias']);
279
-        if (!$linkIsLHS)
280
-            $startingTable = (empty($params['right_join_table_alias']) ? $this->def['rhs_table'] : $params['right_join_table_alias']);
290
+        if (!$linkIsLHS) {
291
+                    $startingTable = (empty($params['right_join_table_alias']) ? $this->def['rhs_table'] : $params['right_join_table_alias']);
292
+        }
281 293
         $startingKey = $linkIsLHS ? $this->def['lhs_key'] : $this->def['rhs_key'];
282 294
         $targetTable = $linkIsLHS ? $this->def['rhs_table'] : $this->def['lhs_table'];
283 295
         $targetTableWithAlias = $targetTable;
@@ -315,8 +327,9 @@  discard block
 block discarded – undo
315 327
 
316 328
         $linkIsLHS = $link->getSide() == REL_RHS;
317 329
         $startingTable = (empty($params['left_join_table_alias']) ? $this->def['lhs_table'] : $params['left_join_table_alias']);
318
-        if (!$linkIsLHS)
319
-            $startingTable = (empty($params['right_join_table_alias']) ? $this->def['rhs_table'] : $params['right_join_table_alias']);
330
+        if (!$linkIsLHS) {
331
+                    $startingTable = (empty($params['right_join_table_alias']) ? $this->def['rhs_table'] : $params['right_join_table_alias']);
332
+        }
320 333
         $startingKey = $linkIsLHS ? $this->def['lhs_key'] : $this->def['rhs_key'];
321 334
         $targetTable = $linkIsLHS ? $this->def['rhs_table'] : $this->def['lhs_table'];
322 335
         $targetKey = $linkIsLHS ? $this->def['rhs_key'] : $this->def['lhs_key'];
@@ -393,9 +406,10 @@  discard block
 block discarded – undo
393 406
 
394 407
     public function getRelationshipTable()
395 408
     {
396
-        if (isset($this->def['table']))
397
-            return $this->def['table'];
398
-        else
399
-            return $this->def['rhs_table'];
409
+        if (isset($this->def['table'])) {
410
+                    return $this->def['table'];
411
+        } else {
412
+                    return $this->def['rhs_table'];
413
+        }
400 414
     }
401 415
 }
Please login to merge, or discard this patch.
data/Relationships/M2MRelationship.php 1 patch
Braces   +33 added lines, -22 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -84,8 +86,7 @@  discard block
 block discarded – undo
84 86
         {
85 87
             $GLOBALS['log']->error("Warning: Multiple links found for relationship {$this->name} within module {$module}");
86 88
             return $this->getMostAppropriateLinkedDefinition($results);
87
-        }
88
-        else
89
+        } else
89 90
         {
90 91
             return FALSE;
91 92
         }
@@ -178,8 +179,9 @@  discard block
 block discarded – undo
178 179
 
179 180
         $this->addRow($dataToInsert);
180 181
 
181
-        if ($this->self_referencing)
182
-            $this->addSelfReferencing($lhs, $rhs, $additionalFields);
182
+        if ($this->self_referencing) {
183
+                    $this->addSelfReferencing($lhs, $rhs, $additionalFields);
184
+        }
183 185
 
184 186
             $lhs->$lhsLinkName->addBean($rhs);
185 187
             $rhs->$rhsLinkName->addBean($lhs);
@@ -339,8 +341,9 @@  discard block
 block discarded – undo
339 341
 
340 342
         $this->removeRow($dataToRemove);
341 343
 
342
-        if ($this->self_referencing)
343
-            $this->removeSelfReferencing($lhs, $rhs);
344
+        if ($this->self_referencing) {
345
+                    $this->removeSelfReferencing($lhs, $rhs);
346
+        }
344 347
 
345 348
         if (empty($_SESSION['disable_workflow']) || $_SESSION['disable_workflow'] != "Yes")
346 349
         {
@@ -395,8 +398,9 @@  discard block
 block discarded – undo
395 398
         $idField = $link->getSide() == REL_LHS ? $this->def['join_key_rhs'] : $this->def['join_key_lhs'];
396 399
         while ($row = $db->fetchByAssoc($result, FALSE))
397 400
         {
398
-            if (empty($row['id']) && empty($row[$idField]))
399
-                continue;
401
+            if (empty($row['id']) && empty($row[$idField])) {
402
+                            continue;
403
+            }
400 404
             $id = empty($row['id']) ? $row[$idField] : $row['id'];
401 405
             $rows[$id] = $row;
402 406
         }
@@ -414,15 +418,17 @@  discard block
 block discarded – undo
414 418
             $targetKey = $this->def['join_key_rhs'];
415 419
             $relatedSeed = BeanFactory::getBean($this->getRHSModule());
416 420
             $relatedSeedKey = $this->def['rhs_key'];
417
-            if (!empty($params['where']) || !empty($params['order_by']))
418
-                $whereTable = (empty($params['right_join_table_alias']) ? $relatedSeed->table_name : $params['right_join_table_alias']);
421
+            if (!empty($params['where']) || !empty($params['order_by'])) {
422
+                            $whereTable = (empty($params['right_join_table_alias']) ? $relatedSeed->table_name : $params['right_join_table_alias']);
423
+            }
419 424
         } else {
420 425
             $knownKey = $this->def['join_key_rhs'];
421 426
             $targetKey = $this->def['join_key_lhs'];
422 427
             $relatedSeed = BeanFactory::getBean($this->getLHSModule());
423 428
             $relatedSeedKey = $this->def['lhs_key'];
424
-            if (!empty($params['where']) || !empty($params['order_by']))
425
-                $whereTable = (empty($params['left_join_table_alias']) ? $relatedSeed->table_name : $params['left_join_table_alias']);
429
+            if (!empty($params['where']) || !empty($params['order_by'])) {
430
+                            $whereTable = (empty($params['left_join_table_alias']) ? $relatedSeed->table_name : $params['left_join_table_alias']);
431
+            }
426 432
         }
427 433
         $rel_table = $this->getRelationshipTable();
428 434
 
@@ -432,8 +438,9 @@  discard block
 block discarded – undo
432 438
         //Add any optional where clause
433 439
         if (!empty($params['where'])) {
434 440
             $add_where = is_string($params['where']) ? $params['where'] : "$whereTable." . $this->getOptionalWhereClause($params['where']);
435
-            if (!empty($add_where))
436
-                $where .= " AND $add_where";
441
+            if (!empty($add_where)) {
442
+                            $where .= " AND $add_where";
443
+            }
437 444
         }
438 445
 
439 446
         //Add any optional order clauses
@@ -454,7 +461,9 @@  discard block
 block discarded – undo
454 461
 
455 462
         if (empty($params['return_as_array'])) {
456 463
             $query = "SELECT $targetKey id FROM $from WHERE $where AND $rel_table.deleted=$deleted";
457
-            if(!empty($order_by)) $query .= ' ORDER BY '.$order_by;
464
+            if(!empty($order_by)) {
465
+                $query .= ' ORDER BY '.$order_by;
466
+            }
458 467
             //Limit is not compatible with return_as_array
459 468
             if (!empty($params['limit']) && $params['limit'] > 0) {
460 469
                 $offset = isset($params['offset']) ? $params['offset'] : 0;
@@ -636,18 +645,20 @@  discard block
 block discarded – undo
636 645
 
637 646
     public function getRelationshipTable()
638 647
     {
639
-        if (!empty($this->def['table']))
640
-            return $this->def['table'];
641
-        else if(!empty($this->def['join_table']))
642
-            return $this->def['join_table'];
648
+        if (!empty($this->def['table'])) {
649
+                    return $this->def['table'];
650
+        } else if(!empty($this->def['join_table'])) {
651
+                    return $this->def['join_table'];
652
+        }
643 653
 
644 654
         return false;
645 655
     }
646 656
 
647 657
     public function getFields()
648 658
     {
649
-        if (!empty($this->def['fields']))
650
-            return $this->def['fields'];
659
+        if (!empty($this->def['fields'])) {
660
+                    return $this->def['fields'];
661
+        }
651 662
         $fields = array(
652 663
             "id" => array('name' => 'id'),
653 664
             'date_modified' => array('name' => 'date_modified'),
Please login to merge, or discard this patch.
data/Relationships/One2MRelationship.php 1 patch
Braces   +7 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -67,13 +69,13 @@  discard block
 block discarded – undo
67 69
             if (empty($links))
68 70
             {
69 71
                 $GLOBALS['log']->fatal("No Links found for relationship {$this->name}");
70
-            }
71
-            else {
72
-                if (!is_array($links)) //Only one link for a self referencing relationship, this is very bad.
72
+            } else {
73
+                if (!is_array($links)) {
74
+                    //Only one link for a self referencing relationship, this is very bad.
73 75
                 {
74 76
                     $this->lhsLinkDef = $this->rhsLinkDef = $links;
75 77
                 }
76
-                else if (!empty($links[0]) && !empty($links[1]))
78
+                } else if (!empty($links[0]) && !empty($links[1]))
77 79
                 {
78 80
 
79 81
                     if ((!empty($links[0]['side']) && $links[0]['side'] == "right")
Please login to merge, or discard this patch.
data/Relationships/RelationshipFactory.php 1 patch
Braces   +17 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -62,8 +64,9 @@  discard block
 block discarded – undo
62 64
      */
63 65
     public static function getInstance()
64 66
     {
65
-        if (is_null(self::$rfInstance))
66
-            self::$rfInstance = new SugarRelationshipFactory();
67
+        if (is_null(self::$rfInstance)) {
68
+                    self::$rfInstance = new SugarRelationshipFactory();
69
+        }
67 70
         return self::$rfInstance;
68 71
     }
69 72
 
@@ -114,8 +117,7 @@  discard block
 block discarded – undo
114 117
                 //If a relationship has no table or join keys, it must be bean based
115 118
                 if (empty($def['true_relationship_type']) || (empty($def['table']) && empty($def['join_table'])) || empty($def['join_key_rhs'])){
116 119
                     return new One2MBeanRelationship($def);
117
-                }
118
-                else {
120
+                } else {
119 121
                     return new One2MRelationship($def);
120 122
                 }
121 123
                 break;
@@ -123,8 +125,7 @@  discard block
 block discarded – undo
123 125
                 if (empty($def['true_relationship_type'])){
124 126
                     require_once("data/Relationships/One2OneBeanRelationship.php");
125 127
                     return new One2OneBeanRelationship($def);
126
-                }
127
-                else {
128
+                } else {
128 129
                     require_once("data/Relationships/One2OneRelationship.php");
129 130
                     return new One2OneRelationship($def);
130 131
                 }
@@ -161,13 +162,15 @@  discard block
 block discarded – undo
161 162
     protected function buildRelationshipCache()
162 163
     {
163 164
         global $beanList, $dictionary, $buildingRelCache;
164
-        if ($buildingRelCache)
165
-            return;
165
+        if ($buildingRelCache) {
166
+                    return;
167
+        }
166 168
         $buildingRelCache = true;
167 169
         include("modules/TableDictionary.php");
168 170
 
169
-        if (empty($beanList))
170
-            include("include/modules.php");
171
+        if (empty($beanList)) {
172
+                    include("include/modules.php");
173
+        }
171 174
         //Reload ALL the module vardefs....
172 175
         foreach($beanList as $moduleName => $beanName)
173 176
         {
@@ -186,9 +189,10 @@  discard block
 block discarded – undo
186 189
             {
187 190
                 foreach($def['relationships'] as $relKey => $relDef)
188 191
                 {
189
-                    if ($key == $relKey) //Relationship only entry, we need to capture everything
192
+                    if ($key == $relKey) {
193
+                        //Relationship only entry, we need to capture everything
190 194
                         $relationships[$key] = array_merge(array('name' => $key), (array)$def, (array)$relDef);
191
-                    else {
195
+                    } else {
192 196
                         $relationships[$relKey] = array_merge(array('name' => $relKey), (array)$relDef);
193 197
                         if(!empty($relationships[$relKey]['join_table']) && empty($relationships[$relKey]['fields'])
194 198
                             && isset($dictionary[$relationships[$relKey]['join_table']]['fields'])) {
Please login to merge, or discard this patch.
data/Relationships/EmailAddressRelationship.php 1 patch
Braces   +15 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -65,8 +67,9 @@  discard block
 block discarded – undo
65 67
             return false;
66 68
         }
67 69
 
68
-            if ($lhs->$lhsLinkName->beansAreLoaded())
69
-                $lhs->$lhsLinkName->addBean($rhs);
70
+            if ($lhs->$lhsLinkName->beansAreLoaded()) {
71
+                            $lhs->$lhsLinkName->addBean($rhs);
72
+            }
70 73
 
71 74
             $this->callBeforeAdd($lhs, $rhs, $lhsLinkName);
72 75
 
@@ -75,11 +78,13 @@  discard block
 block discarded – undo
75 78
 
76 79
         $this->addRow($dataToInsert);
77 80
 
78
-        if ($this->self_referencing)
79
-            $this->addSelfReferencing($lhs, $rhs, $additionalFields);
81
+        if ($this->self_referencing) {
82
+                    $this->addSelfReferencing($lhs, $rhs, $additionalFields);
83
+        }
80 84
 
81
-            if ($lhs->$lhsLinkName->beansAreLoaded())
82
-                $lhs->$lhsLinkName->addBean($rhs);
85
+            if ($lhs->$lhsLinkName->beansAreLoaded()) {
86
+                            $lhs->$lhsLinkName->addBean($rhs);
87
+            }
83 88
 
84 89
             $this->callAfterAdd($lhs, $rhs, $lhsLinkName);
85 90
 
@@ -120,8 +125,9 @@  discard block
 block discarded – undo
120 125
 
121 126
         $this->removeRow($dataToRemove);
122 127
 
123
-        if ($this->self_referencing)
124
-            $this->removeSelfReferencing($lhs, $rhs);
128
+        if ($this->self_referencing) {
129
+                    $this->removeSelfReferencing($lhs, $rhs);
130
+        }
125 131
 
126 132
         if (empty($_SESSION['disable_workflow']) || $_SESSION['disable_workflow'] != "Yes")
127 133
         {
Please login to merge, or discard this patch.