@@ -1,5 +1,7 @@ discard block |
||
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. |
@@ -456,8 +458,9 @@ discard block |
||
456 | 458 | while ($file = readdir($handler)) { |
457 | 459 | // if $file isn't this directory or its parent, |
458 | 460 | // add it to the results array |
459 | - if ($file != '.' && $file != '..') |
|
460 | - $results[] = $file; |
|
461 | + if ($file != '.' && $file != '..') { |
|
462 | + $results[] = $file; |
|
463 | + } |
|
461 | 464 | } |
462 | 465 | |
463 | 466 | // tidy up: close the handler |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | /** |
97 | 97 | * getFormElementsNames |
98 | 98 | * Parses for the name values of input, select, textarea types from string content |
99 | - * @param $contents The String contents to parse |
|
99 | + * @param string $contents The String contents to parse |
|
100 | 100 | * @return $matches Array of name/value pairs |
101 | 101 | */ |
102 | 102 | function getFormElementsNames($contents) { |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | /** |
109 | 109 | * getTagAttribute |
110 | 110 | * Returns the name/value of a tag attribute where name is set to $name |
111 | - * @param $name The name of the attribute |
|
111 | + * @param string $name The name of the attribute |
|
112 | 112 | * @param $contents The contents to parse |
113 | 113 | * @param $filter Option regular expression to filter value |
114 | 114 | * @return Array of name/value for matching attribute |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | * and method call getElementsByType("<td>", $contents) returns |
164 | 164 | * "<td>Text <table><tr><td>a</td></tr></table></td>" |
165 | 165 | * |
166 | - * @param $type The type of element to parse out and return |
|
166 | + * @param string $type The type of element to parse out and return |
|
167 | 167 | * @return a tag element format Array |
168 | 168 | */ |
169 | 169 | function getElementsByType($type, $contents) { |
@@ -208,6 +208,7 @@ discard block |
||
208 | 208 | /** |
209 | 209 | * getElementValue |
210 | 210 | * |
211 | + * @param string $type |
|
211 | 212 | */ |
212 | 213 | function getElementValue($type, $contents, $filter = "(.*?)") { |
213 | 214 | $exp = "'<".$type."[^>]*?>".$filter."</".$type."[^>]*?>'si"; |
@@ -244,7 +245,7 @@ discard block |
||
244 | 245 | * Returns the highest number of <td>...</td> blocks within a <tr>...</tr> block. |
245 | 246 | * @param $contents The table contents to parse |
246 | 247 | * @param $filter Optional filter to parse for an attribute within the td block. |
247 | - * @return The maximum column count |
|
248 | + * @return integer maximum column count |
|
248 | 249 | */ |
249 | 250 | function getMaxColumns($contents, $filter) { |
250 | 251 | preg_match_all("'(<tr[^>]*?>)(.*?)(</tr[^>]*?>)'si", $contents, $matches, PREG_SET_ORDER); |
@@ -281,6 +282,9 @@ discard block |
||
281 | 282 | * trimHTML |
282 | 283 | * This function removes the \r (return), \n (newline) and \t (tab) markup from string |
283 | 284 | */ |
285 | +/** |
|
286 | + * @param string $contents |
|
287 | + */ |
|
284 | 288 | function trimHTML($contents) { |
285 | 289 | $contents = str_replace(array("\r"), array(""), $contents); |
286 | 290 | $contents = str_replace(array("\n"), array(""), $contents); |
@@ -342,6 +346,9 @@ discard block |
||
342 | 346 | |
343 | 347 | } |
344 | 348 | |
349 | +/** |
|
350 | + * @param string $javascript |
|
351 | + */ |
|
345 | 352 | static function parseDelimiters($javascript) { |
346 | 353 | $newJavascript = ''; |
347 | 354 | $scriptLength = strlen($javascript); |
@@ -441,7 +448,7 @@ discard block |
||
441 | 448 | * dirList |
442 | 449 | * Utility method to list all the files in a given directory. |
443 | 450 | * |
444 | - * @param $directory The directory to scan |
|
451 | + * @param string $directory The directory to scan |
|
445 | 452 | * @return $results The files in the directory that were found |
446 | 453 | */ |
447 | 454 | function dirList ($directory) { |
@@ -496,6 +503,9 @@ discard block |
||
496 | 503 | return null; |
497 | 504 | } |
498 | 505 | |
506 | +/** |
|
507 | + * @param string $moduleDir |
|
508 | + */ |
|
499 | 509 | function applyPreRules($moduleDir, $panels) { |
500 | 510 | if(file_exists("include/SugarFields/Parsers/Rules/".$moduleDir."ParseRule.php")) { |
501 | 511 | require_once("include/SugarFields/Parsers/Rules/".$moduleDir."ParseRule.php"); |
@@ -506,6 +516,9 @@ discard block |
||
506 | 516 | return $panels; |
507 | 517 | } |
508 | 518 | |
519 | +/** |
|
520 | + * @param string $moduleDir |
|
521 | + */ |
|
509 | 522 | function applyRules($moduleDir, $panels) { |
510 | 523 | return $this->applyPostRules($moduleDir, $panels); |
511 | 524 | } |
@@ -537,6 +550,9 @@ discard block |
||
537 | 550 | return $panels; |
538 | 551 | } |
539 | 552 | |
553 | +/** |
|
554 | + * @param string $moduleDir |
|
555 | + */ |
|
540 | 556 | function createFileContents($moduleDir, $panels, $templateMeta=array(), $htmlFilePath) { |
541 | 557 | |
542 | 558 | $header = "<?php\n\n"; |
@@ -587,7 +603,7 @@ discard block |
||
587 | 603 | * mergePanels |
588 | 604 | * This function merges the $panels Array against the $masterCopy's meta data definition |
589 | 605 | * @param $panels meta data Array to merge |
590 | - * @param $moduleDir Directory name of the module |
|
606 | + * @param string $moduleDir Directory name of the module |
|
591 | 607 | * @param $masterCopy file path to the meta data master copy |
592 | 608 | * @return Array of merged $panel definition |
593 | 609 | */ |
@@ -680,7 +696,7 @@ discard block |
||
680 | 696 | * mergeTemplateMeta |
681 | 697 | * This function merges the $templateMeta Array against the $masterCopy's meta data definition |
682 | 698 | * @param $templateMeta meta data Array to merge |
683 | - * @param $moduleDir Directory name of the module |
|
699 | + * @param string $moduleDir Directory name of the module |
|
684 | 700 | * @param $masterCopy file path to the meta data master copy |
685 | 701 | * @return Array of merged $templateMeta definition |
686 | 702 | */ |
@@ -91,10 +91,10 @@ discard block |
||
91 | 91 | $file = 'custom/include/SugarFields/Fields/' . $field . '/SugarField' . $field. '.php'; |
92 | 92 | $type = $field; |
93 | 93 | //else check the fields directory |
94 | - }else if(file_exists('include/SugarFields/Fields/' . $field . '/SugarField' . $field. '.php')){ |
|
94 | + } else if(file_exists('include/SugarFields/Fields/' . $field . '/SugarField' . $field. '.php')){ |
|
95 | 95 | $file = 'include/SugarFields/Fields/' . $field . '/SugarField' . $field. '.php'; |
96 | 96 | $type = $field; |
97 | - }else{ |
|
97 | + } else{ |
|
98 | 98 | // No direct class, check the directories to see if they are defined |
99 | 99 | if( $returnNullIfBase && |
100 | 100 | !is_dir('custom/include/SugarFields/Fields/'.$field) && |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | $customClass = 'Custom' . $class; |
112 | 112 | if(class_exists($customClass)){ |
113 | 113 | $sugarFieldObjects[$field] = new $customClass($field); |
114 | - }else{ |
|
114 | + } else{ |
|
115 | 115 | $sugarFieldObjects[$field] = new $class($field); |
116 | 116 | } |
117 | 117 | } |
@@ -47,6 +47,9 @@ |
||
47 | 47 | function SugarFieldHandler() { |
48 | 48 | } |
49 | 49 | |
50 | + /** |
|
51 | + * @param string $field |
|
52 | + */ |
|
50 | 53 | static function fixupFieldType($field) { |
51 | 54 | switch($field) { |
52 | 55 | case 'double': |
@@ -46,7 +46,7 @@ |
||
46 | 46 | if(!empty($vardef['function']['returns']) && $vardef['function']['returns']== 'html'){ |
47 | 47 | $this->setup($parentFieldArray, $vardef, $displayParams, $tabindex); |
48 | 48 | return $this->fetch($this->findTemplate('EditViewFunction')); |
49 | - }else{ |
|
49 | + } else{ |
|
50 | 50 | $this->setup($parentFieldArray, $vardef, $displayParams, $tabindex); |
51 | 51 | return $this->fetch($this->findTemplate('SearchView')); |
52 | 52 | } |
@@ -1,5 +1,7 @@ discard block |
||
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. |
@@ -132,8 +134,9 @@ discard block |
||
132 | 134 | $alternate_found = false; |
133 | 135 | $alternate2_found = false; |
134 | 136 | foreach($this->addresses as $k=>$address) { |
135 | - if ($primary_found && $alternate_found) |
|
136 | - break; |
|
137 | + if ($primary_found && $alternate_found) { |
|
138 | + break; |
|
139 | + } |
|
137 | 140 | if ($address['primary_address'] == 1 && !$primary_found) { |
138 | 141 | $primary_index = $k; |
139 | 142 | $primary_found = true; |
@@ -271,8 +274,9 @@ discard block |
||
271 | 274 | ) |
272 | 275 | { |
273 | 276 | $emailCaps = strtoupper(trim($email)); |
274 | - if(empty($emailCaps)) |
|
275 | - return 0; |
|
277 | + if(empty($emailCaps)) { |
|
278 | + return 0; |
|
279 | + } |
|
276 | 280 | |
277 | 281 | $q = "SELECT * |
278 | 282 | FROM email_addr_bean_rel eabl JOIN email_addresses ea |
@@ -288,7 +292,9 @@ discard block |
||
288 | 292 | |
289 | 293 | // do it this way to make the count accurate in oracle |
290 | 294 | $i = 0; |
291 | - while ($this->db->fetchByAssoc($r)) ++$i; |
|
295 | + while ($this->db->fetchByAssoc($r)) { |
|
296 | + ++$i; |
|
297 | + } |
|
292 | 298 | |
293 | 299 | return $i; |
294 | 300 | } |
@@ -471,8 +477,9 @@ discard block |
||
471 | 477 | foreach($_REQUEST as $k => $v) { |
472 | 478 | if(preg_match('/'.$eId.'emailAddressVerifiedValue[0-9]+$/i', $k) && !empty($v)) { |
473 | 479 | $validateFlag = str_replace("Value", "Flag", $k); |
474 | - if (isset($_REQUEST[$validateFlag]) && $_REQUEST[$validateFlag] == "true") |
|
475 | - $new_addrs[$k] = $v; |
|
480 | + if (isset($_REQUEST[$validateFlag]) && $_REQUEST[$validateFlag] == "true") { |
|
481 | + $new_addrs[$k] = $v; |
|
482 | + } |
|
476 | 483 | } |
477 | 484 | } |
478 | 485 | } |
@@ -675,8 +682,7 @@ discard block |
||
675 | 682 | if ($id) { |
676 | 683 | $r = $this->db->query("SELECT * FROM email_addresses WHERE id='".$this->db->quote($id)."'"); |
677 | 684 | $current_email = $this->db->fetchByAssoc($r); |
678 | - } |
|
679 | - else { |
|
685 | + } else { |
|
680 | 686 | $current_email = null; |
681 | 687 | } |
682 | 688 | |
@@ -716,8 +722,7 @@ discard block |
||
716 | 722 | $upd_r = $this->db->query($upd_q); |
717 | 723 | } |
718 | 724 | return $duplicate_email['id']; |
719 | - } |
|
720 | - else { |
|
725 | + } else { |
|
721 | 726 | // no case-insensitive address match - it's new, or undeleted. |
722 | 727 | $guid = ''; |
723 | 728 | if(!empty($address)){ |
@@ -783,8 +788,7 @@ discard block |
||
783 | 788 | // otherwise |
784 | 789 | $q .= " |
785 | 790 | ORDER BY ear.reply_to_address DESC"; |
786 | - } |
|
787 | - else |
|
791 | + } else |
|
788 | 792 | { |
789 | 793 | // retrieve reply-to address only |
790 | 794 | $q .= " |
@@ -835,8 +839,9 @@ discard block |
||
835 | 839 | */ |
836 | 840 | function getEmailAddressWidgetEditView($id, $module, $asMetadata=false, $tpl='',$tabindex='0') |
837 | 841 | { |
838 | - if ( !($this->smarty instanceOf Sugar_Smarty ) ) |
|
839 | - $this->smarty = new Sugar_Smarty(); |
|
842 | + if ( !($this->smarty instanceOf Sugar_Smarty ) ) { |
|
843 | + $this->smarty = new Sugar_Smarty(); |
|
844 | + } |
|
840 | 845 | |
841 | 846 | global $app_strings, $dictionary, $beanList; |
842 | 847 | |
@@ -854,8 +859,9 @@ discard block |
||
854 | 859 | if(!empty($id)) { |
855 | 860 | $prefillDataArr = $this->getAddressesByGUID($id, $module); |
856 | 861 | //When coming from convert leads, sometimes module is Contacts while the id is for a lead. |
857 | - if (empty($prefillDataArr) && $module == "Contacts") |
|
858 | - $prefillDataArr = $this->getAddressesByGUID($id, "Leads"); |
|
862 | + if (empty($prefillDataArr) && $module == "Contacts") { |
|
863 | + $prefillDataArr = $this->getAddressesByGUID($id, "Leads"); |
|
864 | + } |
|
859 | 865 | } else if(isset($_REQUEST['full_form']) && !empty($_REQUEST['emailAddressWidget'])){ |
860 | 866 | $widget_id = isset($_REQUEST[$module . '_email_widget_id']) ? $_REQUEST[$module . '_email_widget_id'] : '0'; |
861 | 867 | $count = 0; |
@@ -880,8 +886,9 @@ discard block |
||
880 | 886 | |
881 | 887 | $required = false; |
882 | 888 | $vardefs = $dictionary[$beanList[$passedModule]]['fields']; |
883 | - if (!empty($vardefs['email1']) && isset($vardefs['email1']['required']) && $vardefs['email1']['required']) |
|
884 | - $required = true; |
|
889 | + if (!empty($vardefs['email1']) && isset($vardefs['email1']['required']) && $vardefs['email1']['required']) { |
|
890 | + $required = true; |
|
891 | + } |
|
885 | 892 | $this->smarty->assign('required', $required); |
886 | 893 | |
887 | 894 | $this->smarty->assign('module', $saveModule); |
@@ -935,13 +942,16 @@ discard block |
||
935 | 942 | */ |
936 | 943 | function getEmailAddressWidgetDetailView($focus, $tpl='') |
937 | 944 | { |
938 | - if ( !($this->smarty instanceOf Sugar_Smarty ) ) |
|
939 | - $this->smarty = new Sugar_Smarty(); |
|
945 | + if ( !($this->smarty instanceOf Sugar_Smarty ) ) { |
|
946 | + $this->smarty = new Sugar_Smarty(); |
|
947 | + } |
|
940 | 948 | |
941 | 949 | global $app_strings; |
942 | 950 | global $current_user; |
943 | 951 | $assign = array(); |
944 | - if(empty($focus->id))return ''; |
|
952 | + if(empty($focus->id)) { |
|
953 | + return ''; |
|
954 | + } |
|
945 | 955 | $prefillData = $this->getAddressesByGUID($focus->id, $focus->module_dir); |
946 | 956 | |
947 | 957 | foreach($prefillData as $addressItem) { |
@@ -970,8 +980,9 @@ discard block |
||
970 | 980 | */ |
971 | 981 | function getEmailAddressWidgetDuplicatesView($focus) |
972 | 982 | { |
973 | - if ( !($this->smarty instanceOf Sugar_Smarty ) ) |
|
974 | - $this->smarty = new Sugar_Smarty(); |
|
983 | + if ( !($this->smarty instanceOf Sugar_Smarty ) ) { |
|
984 | + $this->smarty = new Sugar_Smarty(); |
|
985 | + } |
|
975 | 986 | |
976 | 987 | $count = 0; |
977 | 988 | $emails = array(); |
@@ -1131,7 +1142,9 @@ discard block |
||
1131 | 1142 | |
1132 | 1143 | if($view == 'EditView' || $view == 'QuickCreate' || $view == 'ConvertLead') { |
1133 | 1144 | $module = $focus->module_dir; |
1134 | - if ($view == 'ConvertLead' && $module == "Contacts") $module = "Leads"; |
|
1145 | + if ($view == 'ConvertLead' && $module == "Contacts") { |
|
1146 | + $module = "Leads"; |
|
1147 | + } |
|
1135 | 1148 | |
1136 | 1149 | return $sea->getEmailAddressWidgetEditView($focus->id, $module, false,'',$tabindex); |
1137 | 1150 | } |
@@ -80,8 +80,6 @@ discard block |
||
80 | 80 | |
81 | 81 | /** |
82 | 82 | * Legacy email address handling. This is to allow support for SOAP or customizations |
83 | - * @param string $id |
|
84 | - * @param string $module |
|
85 | 83 | */ |
86 | 84 | function handleLegacySave($bean, $prefix = "") { |
87 | 85 | if(!isset($_REQUEST) || !isset($_REQUEST['useEmailWidget'])) { |
@@ -166,12 +164,6 @@ discard block |
||
166 | 164 | |
167 | 165 | /** |
168 | 166 | * Saves email addresses for a parent bean |
169 | - * @param string $id Parent bean ID |
|
170 | - * @param string $module Parent bean's module |
|
171 | - * @param array $addresses Override of $_REQUEST vars, used to handle non-standard bean saves |
|
172 | - * @param string $primary GUID of primary address |
|
173 | - * @param string $replyTo GUID of reply-to address |
|
174 | - * @param string $invalid GUID of invalid address |
|
175 | 167 | */ |
176 | 168 | public function save($check_notify = FALSE) { |
177 | 169 | $args = func_get_args(); |
@@ -369,7 +361,6 @@ discard block |
||
369 | 361 | * Saves email addresses for a parent bean |
370 | 362 | * @param string $id Parent bean ID |
371 | 363 | * @param string $module Parent bean's module |
372 | - * @param array $addresses Override of $_REQUEST vars, used to handle non-standard bean saves |
|
373 | 364 | * @param string $primary GUID of primary address |
374 | 365 | * @param string $replyTo GUID of reply-to address |
375 | 366 | * @param string $invalid GUID of invalid address |
@@ -620,7 +611,7 @@ discard block |
||
620 | 611 | |
621 | 612 | /** |
622 | 613 | * preps a passed email address for email address storage |
623 | - * @param array $addr Address in focus, must be RFC compliant |
|
614 | + * @param string $addr Address in focus, must be RFC compliant |
|
624 | 615 | * @return string $id email_addresses ID |
625 | 616 | */ |
626 | 617 | function getEmailGUID($addr) { |
@@ -733,7 +724,8 @@ discard block |
||
733 | 724 | |
734 | 725 | /** |
735 | 726 | * Returns Primary or newest email address |
736 | - * @param object $focus Object in focus |
|
727 | + * @param boolean $focus Object in focus |
|
728 | + * @param string $parent_type |
|
737 | 729 | * @return string email |
738 | 730 | */ |
739 | 731 | function getPrimaryAddress($focus,$parent_id=null,$parent_type=null) { |
@@ -804,7 +796,7 @@ discard block |
||
804 | 796 | * Returns all email addresses by parent's GUID |
805 | 797 | * @param string $id Parent's GUID |
806 | 798 | * @param string $module Parent's module |
807 | - * @return array |
|
799 | + * @return string |
|
808 | 800 | */ |
809 | 801 | function getAddressesByGUID($id, $module) { |
810 | 802 | $return = array(); |
@@ -828,7 +820,6 @@ discard block |
||
828 | 820 | |
829 | 821 | /** |
830 | 822 | * Returns the HTML/JS for the EmailAddress widget |
831 | - * @param string $parent_id ID of parent bean, generally $focus |
|
832 | 823 | * @param string $module $focus' module |
833 | 824 | * @param bool asMetadata Default false |
834 | 825 | * @return string HTML/JS for widget |
@@ -965,7 +956,7 @@ discard block |
||
965 | 956 | |
966 | 957 | /** |
967 | 958 | * getEmailAddressWidgetDuplicatesView($focus) |
968 | - * @param object $focus Bean in focus |
|
959 | + * @param Lead $focus Bean in focus |
|
969 | 960 | * @return string HTML that contains hidden input values based off of HTML request |
970 | 961 | */ |
971 | 962 | function getEmailAddressWidgetDuplicatesView($focus) |
@@ -1041,6 +1032,7 @@ discard block |
||
1041 | 1032 | /** |
1042 | 1033 | * getFormBaseURL |
1043 | 1034 | * |
1035 | + * @param SugarBean $focus |
|
1044 | 1036 | */ |
1045 | 1037 | function getFormBaseURL($focus) { |
1046 | 1038 | $get = ""; |
@@ -1081,13 +1073,15 @@ discard block |
||
1081 | 1073 | |
1082 | 1074 | } |
1083 | 1075 | |
1076 | + /** |
|
1077 | + * @param string $view |
|
1078 | + */ |
|
1084 | 1079 | function setView($view) { |
1085 | 1080 | $this->view = $view; |
1086 | 1081 | } |
1087 | 1082 | |
1088 | 1083 | /** |
1089 | 1084 | * This function is here so the Employees/Users division can be handled cleanly in one place |
1090 | - * @param object $focus SugarBean |
|
1091 | 1085 | * @return string The value for the bean_module column in the email_addr_bean_rel table |
1092 | 1086 | */ |
1093 | 1087 | function getCorrectedModule(&$module) { |
@@ -1119,7 +1113,7 @@ discard block |
||
1119 | 1113 | |
1120 | 1114 | /** |
1121 | 1115 | * Convenience function for MVC (Mystique) |
1122 | - * @param object $focus SugarBean |
|
1116 | + * @param SugarBean $focus SugarBean |
|
1123 | 1117 | * @param string $field unused |
1124 | 1118 | * @param string $value unused |
1125 | 1119 | * @param string $view DetailView or EditView |
@@ -133,7 +133,7 @@ |
||
133 | 133 | try{ |
134 | 134 | $this->_last = $token = parent::getRequestToken($params); |
135 | 135 | return array('oauth_token' => $token->getToken(), 'oauth_token_secret' => $token->getTokenSecret()); |
136 | - }catch(Zend_Oauth_Exception $e){ |
|
136 | + } catch(Zend_Oauth_Exception $e){ |
|
137 | 137 | return array('oauth_token' => '', 'oauth_token_secret' => ''); |
138 | 138 | } |
139 | 139 | } |
@@ -75,7 +75,9 @@ discard block |
||
75 | 75 | $vardef['type'] = 'varchar'; |
76 | 76 | } |
77 | 77 | |
78 | - if (isset($vardef['precision'])) unset($vardef['precision']); |
|
78 | + if (isset($vardef['precision'])) { |
|
79 | + unset($vardef['precision']); |
|
80 | + } |
|
79 | 81 | |
80 | 82 | //$vardef['precision'] = $locale->getPrecedentPreference('default_currency_significant_digits', $current_user); |
81 | 83 | |
@@ -115,8 +117,9 @@ discard block |
||
115 | 117 | if (isset($vardef['function']) |
116 | 118 | && ($vardef['function'] == 'getEmailAddressWidget' |
117 | 119 | || $vardef['function']['name'] == 'getEmailAddressWidget') |
118 | - ) |
|
119 | - unset($vardef['function']); |
|
120 | + ) { |
|
121 | + unset($vardef['function']); |
|
122 | + } |
|
120 | 123 | |
121 | 124 | if (isset($vardef['name']) && ($vardef['name'] == 'date_modified')) { |
122 | 125 | $vardef['name'] = 'aow_temp_date'; |
@@ -149,8 +152,9 @@ discard block |
||
149 | 152 | } |
150 | 153 | |
151 | 154 | // hack to disable one of the js calls in this control |
152 | - if (isset($vardef['function']) && ($vardef['function'] == 'getCurrencyDropDown' || $vardef['function']['name'] == 'getCurrencyDropDown')) |
|
153 | - $contents .= "{literal}<script>function CurrencyConvertAll() { return; }</script>{/literal}"; |
|
155 | + if (isset($vardef['function']) && ($vardef['function'] == 'getCurrencyDropDown' || $vardef['function']['name'] == 'getCurrencyDropDown')) { |
|
156 | + $contents .= "{literal}<script>function CurrencyConvertAll() { return; }</script>{/literal}"; |
|
157 | + } |
|
154 | 158 | |
155 | 159 | |
156 | 160 | |
@@ -186,8 +190,9 @@ discard block |
||
186 | 190 | $ss->assign('CALENDAR_FDOW', $current_user->get_first_day_of_week()); |
187 | 191 | |
188 | 192 | $fieldlist = array(); |
189 | - if (!isset($focus) || !($focus instanceof SugarBean)) |
|
190 | - require_once($beanFiles[$beanList[$module]]); |
|
193 | + if (!isset($focus) || !($focus instanceof SugarBean)) { |
|
194 | + require_once($beanFiles[$beanList[$module]]); |
|
195 | + } |
|
191 | 196 | $focus = new $beanList[$module]; |
192 | 197 | // create the dropdowns for the parent type fields |
193 | 198 | $vardefFields[$fieldname] = $focus->field_defs[$fieldname]; |
@@ -197,14 +202,17 @@ discard block |
||
197 | 202 | foreach ($vardefFields as $name => $properties) { |
198 | 203 | $fieldlist[$name] = $properties; |
199 | 204 | // fill in enums |
200 | - if (isset($fieldlist[$name]['options']) && is_string($fieldlist[$name]['options']) && isset($app_list_strings[$fieldlist[$name]['options']])) |
|
201 | - $fieldlist[$name]['options'] = $app_list_strings[$fieldlist[$name]['options']]; |
|
205 | + if (isset($fieldlist[$name]['options']) && is_string($fieldlist[$name]['options']) && isset($app_list_strings[$fieldlist[$name]['options']])) { |
|
206 | + $fieldlist[$name]['options'] = $app_list_strings[$fieldlist[$name]['options']]; |
|
207 | + } |
|
202 | 208 | // Bug 32626: fall back on checking the mod_strings if not in the app_list_strings |
203 | - elseif (isset($fieldlist[$name]['options']) && is_string($fieldlist[$name]['options']) && isset($mod_strings[$fieldlist[$name]['options']])) |
|
204 | - $fieldlist[$name]['options'] = $mod_strings[$fieldlist[$name]['options']]; |
|
209 | + elseif (isset($fieldlist[$name]['options']) && is_string($fieldlist[$name]['options']) && isset($mod_strings[$fieldlist[$name]['options']])) { |
|
210 | + $fieldlist[$name]['options'] = $mod_strings[$fieldlist[$name]['options']]; |
|
211 | + } |
|
205 | 212 | // Bug 22730: make sure all enums have the ability to select blank as the default value. |
206 | - if (!isset($fieldlist[$name]['options'][''])) |
|
207 | - $fieldlist[$name]['options'][''] = ''; |
|
213 | + if (!isset($fieldlist[$name]['options'][''])) { |
|
214 | + $fieldlist[$name]['options'][''] = ''; |
|
215 | + } |
|
208 | 216 | } |
209 | 217 | |
210 | 218 | // fill in function return values |
@@ -212,8 +220,9 @@ discard block |
||
212 | 220 | if (!empty($fieldlist[$fieldname]['function']['returns']) && $fieldlist[$fieldname]['function']['returns'] == 'html') { |
213 | 221 | $function = $fieldlist[$fieldname]['function']['name']; |
214 | 222 | // include various functions required in the various vardefs |
215 | - if (isset($fieldlist[$fieldname]['function']['include']) && is_file($fieldlist[$fieldname]['function']['include'])) |
|
216 | - require_once($fieldlist[$fieldname]['function']['include']); |
|
223 | + if (isset($fieldlist[$fieldname]['function']['include']) && is_file($fieldlist[$fieldname]['function']['include'])) { |
|
224 | + require_once($fieldlist[$fieldname]['function']['include']); |
|
225 | + } |
|
217 | 226 | $_REQUEST[$fieldname] = $value; |
218 | 227 | $value = $function($focus, $fieldname, $value, $view); |
219 | 228 | |
@@ -311,14 +320,14 @@ discard block |
||
311 | 320 | |
312 | 321 | if ($bean->field_defs[$field]['type'] == "multienum") { |
313 | 322 | $bean->$field = encodeMultienumValue($value); |
314 | - }else if ($bean->field_defs[$field]['type'] == "relate" || $bean->field_defs[$field]['type'] == 'parent'){ |
|
323 | + } else if ($bean->field_defs[$field]['type'] == "relate" || $bean->field_defs[$field]['type'] == 'parent'){ |
|
315 | 324 | $save_field = $bean->field_defs[$field]['id_name']; |
316 | 325 | $bean->$save_field = $value; |
317 | 326 | if ($bean->field_defs[$field]['type'] == 'parent') { |
318 | 327 | $bean->parent_type = $_REQUEST['parent_type']; |
319 | 328 | $bean->fill_in_additional_parent_fields(); // get up to date parent info as need it to display name |
320 | 329 | } |
321 | - }else{ |
|
330 | + } else{ |
|
322 | 331 | $bean->$field = $value; |
323 | 332 | } |
324 | 333 | |
@@ -449,7 +458,7 @@ discard block |
||
449 | 458 | if($vardef['ext2']){ |
450 | 459 | $value .= getFieldValueFromModule($vardef['rname'],$vardef['ext2'],$record) . "</a>"; |
451 | 460 | |
452 | - }else if(!empty($vardef['rname'])){ |
|
461 | + } else if(!empty($vardef['rname'])){ |
|
453 | 462 | $value .= getFieldValueFromModule($vardef['rname'],$vardef['module'],$record) . "</a>"; |
454 | 463 | |
455 | 464 | } else { |
@@ -486,7 +495,7 @@ discard block |
||
486 | 495 | |
487 | 496 | if($bean->ACLAccess('EditView')) { |
488 | 497 | return true; |
489 | - }else { |
|
498 | + } else { |
|
490 | 499 | return false; |
491 | 500 | } |
492 | 501 | } |
@@ -330,6 +330,9 @@ discard block |
||
330 | 330 | |
331 | 331 | } |
332 | 332 | |
333 | +/** |
|
334 | + * @param SugarBean $bean |
|
335 | + */ |
|
333 | 336 | function getDisplayValue($bean, $field, $method = "save") |
334 | 337 | { |
335 | 338 | |
@@ -471,6 +474,9 @@ discard block |
||
471 | 474 | |
472 | 475 | } |
473 | 476 | |
477 | +/** |
|
478 | + * @return string |
|
479 | + */ |
|
474 | 480 | function convertDateUserToDB($value) |
475 | 481 | { |
476 | 482 | global $timedate; |
@@ -482,6 +488,9 @@ discard block |
||
482 | 488 | return $value; |
483 | 489 | } |
484 | 490 | |
491 | +/** |
|
492 | + * @param SugarBean $bean |
|
493 | + */ |
|
485 | 494 | function checkAccess($bean){ |
486 | 495 | |
487 | 496 | if($bean->ACLAccess('EditView')) { |
@@ -1,5 +1,7 @@ discard block |
||
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. |
@@ -77,8 +79,9 @@ discard block |
||
77 | 79 | { |
78 | 80 | global $current_user; |
79 | 81 | |
80 | - if(!empty($_REQUEST[$prefix.'record']) && !$skipRetrieve) |
|
81 | - $focus->retrieve($_REQUEST[$prefix.'record']); |
|
82 | + if(!empty($_REQUEST[$prefix.'record']) && !$skipRetrieve) { |
|
83 | + $focus->retrieve($_REQUEST[$prefix.'record']); |
|
84 | + } |
|
82 | 85 | |
83 | 86 | if(!empty($_POST['assigned_user_id']) && |
84 | 87 | ($focus->assigned_user_id != $_POST['assigned_user_id']) && |
@@ -240,8 +243,7 @@ discard block |
||
240 | 243 | if(isset($_REQUEST['return_module']) && $_REQUEST['return_module'] != "") |
241 | 244 | { |
242 | 245 | $return_module = $_REQUEST['return_module']; |
243 | - } |
|
244 | - else |
|
246 | + } else |
|
245 | 247 | { |
246 | 248 | $return_module = $return_module; |
247 | 249 | } |
@@ -275,14 +277,12 @@ discard block |
||
275 | 277 | $return_module = $_REQUEST['module']; |
276 | 278 | $return_action = $_REQUEST['return_action']; |
277 | 279 | // wp: return action needs to be set for one-click close in task list |
278 | - } |
|
279 | - else |
|
280 | + } else |
|
280 | 281 | { |
281 | 282 | // if we "Cancel", we go back to the list view. |
282 | 283 | $return_action = $_REQUEST['return_action']; |
283 | 284 | } |
284 | - } |
|
285 | - else |
|
285 | + } else |
|
286 | 286 | { |
287 | 287 | $return_action = "DetailView"; |
288 | 288 | } |
@@ -378,8 +378,7 @@ discard block |
||
378 | 378 | $focus=BeanFactory::getBean('Prospects'); |
379 | 379 | if(is_array($child_id)){ |
380 | 380 | $uids = $child_id; |
381 | - } |
|
382 | - else{ |
|
381 | + } else{ |
|
383 | 382 | $uids = array($child_id); |
384 | 383 | } |
385 | 384 |
@@ -235,6 +235,9 @@ discard block |
||
235 | 235 | } |
236 | 236 | |
237 | 237 | //eggsurplus: abstract to simplify unit testing |
238 | +/** |
|
239 | + * @return string |
|
240 | + */ |
|
238 | 241 | function buildRedirectURL($return_id='', $return_module='') |
239 | 242 | { |
240 | 243 | if(isset($_REQUEST['return_module']) && $_REQUEST['return_module'] != "") |
@@ -339,6 +342,9 @@ discard block |
||
339 | 342 | } |
340 | 343 | } |
341 | 344 | |
345 | +/** |
|
346 | + * @param string $fieldname |
|
347 | + */ |
|
342 | 348 | function getLikeForEachWord($fieldname, $value, $minsize=4) |
343 | 349 | { |
344 | 350 | $value = trim($value); |
@@ -448,11 +448,9 @@ discard block |
||
448 | 448 | |
449 | 449 | if(file_exists("custom/include/language/{$language}.notify_template.html")){ |
450 | 450 | $file = "custom/include/language/{$language}.notify_template.html"; |
451 | - } |
|
452 | - else if(file_exists("include/language/{$language}.notify_template.html")){ |
|
451 | + } else if(file_exists("include/language/{$language}.notify_template.html")){ |
|
453 | 452 | $file = "include/language/{$language}.notify_template.html"; |
454 | - } |
|
455 | - else if(file_exists("custom/include/language/en_us.notify_template.html")){ |
|
453 | + } else if(file_exists("custom/include/language/en_us.notify_template.html")){ |
|
456 | 454 | $file = "custom/include/language/en_us.notify_template.html"; |
457 | 455 | } |
458 | 456 | |
@@ -470,8 +468,7 @@ discard block |
||
470 | 468 | foreach( $default as $key => $value ){ |
471 | 469 | if( !array_key_exists($key, $override) ){ |
472 | 470 | $override[$key] = $value; |
473 | - } |
|
474 | - else if( is_array( $key ) ){ |
|
471 | + } else if( is_array( $key ) ){ |
|
475 | 472 | $override[$key] = sugar_config_union( $value, $override[$key] ); |
476 | 473 | } |
477 | 474 | } |
@@ -484,8 +481,7 @@ discard block |
||
484 | 481 | if( is_file($file) || is_dir($file) ){ |
485 | 482 | if( !is_writable($file) ){ |
486 | 483 | $ret_val = true; |
487 | - } |
|
488 | - else { |
|
484 | + } else { |
|
489 | 485 | $original_fileperms = fileperms($file); |
490 | 486 | |
491 | 487 | // take away writable permissions |
@@ -591,8 +587,9 @@ discard block |
||
591 | 587 | function get_user_name($id) { |
592 | 588 | global $db; |
593 | 589 | |
594 | - if(empty($db)) |
|
595 | - $db = DBManagerFactory::getInstance(); |
|
590 | + if(empty($db)) { |
|
591 | + $db = DBManagerFactory::getInstance(); |
|
592 | + } |
|
596 | 593 | |
597 | 594 | $q = "SELECT user_name FROM users WHERE id='{$id}'"; |
598 | 595 | $r = $db->query($q); |
@@ -637,8 +634,7 @@ discard block |
||
637 | 634 | // Including deleted users for now. |
638 | 635 | if (empty($status)) { |
639 | 636 | $query = "SELECT id, first_name, last_name, user_name from users WHERE 1=1".$portal_filter; |
640 | - } |
|
641 | - else { |
|
637 | + } else { |
|
642 | 638 | $query = "SELECT id, first_name, last_name, user_name from users WHERE status='$status'".$portal_filter; |
643 | 639 | } |
644 | 640 | /* BEGIN - SECURITY GROUPS */ |
@@ -677,7 +673,7 @@ discard block |
||
677 | 673 | //its possible for first name to be skipped, check for this |
678 | 674 | if($firstNamePos===false){ |
679 | 675 | $order_by_string = 'last_name ASC'; |
680 | - }else{ |
|
676 | + } else{ |
|
681 | 677 | $order_by_string = ($lastNamePos < $firstNamePos) ? "last_name, first_name ASC" : "first_name, last_name ASC"; |
682 | 678 | } |
683 | 679 | } |
@@ -1100,18 +1096,20 @@ discard block |
||
1100 | 1096 | $loaded_mod_strings = LanguageManager::loadModuleLanguage($module, $language,$refresh); |
1101 | 1097 | |
1102 | 1098 | // cn: bug 6048 - merge en_us with requested language |
1103 | - if($language != $sugar_config['default_language']) |
|
1104 | - $loaded_mod_strings = sugarLangArrayMerge( |
|
1099 | + if($language != $sugar_config['default_language']) { |
|
1100 | + $loaded_mod_strings = sugarLangArrayMerge( |
|
1105 | 1101 | LanguageManager::loadModuleLanguage($module, $sugar_config['default_language'],$refresh), |
1106 | 1102 | $loaded_mod_strings |
1107 | 1103 | ); |
1104 | + } |
|
1108 | 1105 | |
1109 | 1106 | // Load in en_us strings by default |
1110 | - if($language != 'en_us' && $sugar_config['default_language'] != 'en_us') |
|
1111 | - $loaded_mod_strings = sugarLangArrayMerge( |
|
1107 | + if($language != 'en_us' && $sugar_config['default_language'] != 'en_us') { |
|
1108 | + $loaded_mod_strings = sugarLangArrayMerge( |
|
1112 | 1109 | LanguageManager::loadModuleLanguage($module, 'en_us', $refresh), |
1113 | 1110 | $loaded_mod_strings |
1114 | 1111 | ); |
1112 | + } |
|
1115 | 1113 | |
1116 | 1114 | // If we are in debug mode for translating, turn on the prefix now! |
1117 | 1115 | if($sugar_config['translation_string_prefix']) { |
@@ -1123,9 +1121,9 @@ discard block |
||
1123 | 1121 | $return_value = $loaded_mod_strings; |
1124 | 1122 | if(!isset($mod_strings)){ |
1125 | 1123 | $mod_strings = $return_value; |
1124 | + } else { |
|
1125 | + $mod_strings = $temp_mod_strings; |
|
1126 | 1126 | } |
1127 | - else |
|
1128 | - $mod_strings = $temp_mod_strings; |
|
1129 | 1127 | |
1130 | 1128 | $cache_key = LanguageManager::getLanguageCacheKey($module, $language); |
1131 | 1129 | sugar_cache_put($cache_key, $return_value); |
@@ -1164,8 +1162,9 @@ discard block |
||
1164 | 1162 | // cn: bug 6048 - merge en_us with requested language |
1165 | 1163 | include("modules/$module/language/en_us.lang.php"); |
1166 | 1164 | $en_mod_list_strings = array(); |
1167 | - if($language_used != $default_language) |
|
1168 | - $en_mod_list_strings = $mod_list_strings; |
|
1165 | + if($language_used != $default_language) { |
|
1166 | + $en_mod_list_strings = $mod_list_strings; |
|
1167 | + } |
|
1169 | 1168 | |
1170 | 1169 | if(file_exists("modules/$module/language/$language.lang.php")) { |
1171 | 1170 | include("modules/$module/language/$language.lang.php"); |
@@ -1295,8 +1294,9 @@ discard block |
||
1295 | 1294 | $where = ""; |
1296 | 1295 | foreach($where_clauses as $clause) |
1297 | 1296 | { |
1298 | - if($where != "") |
|
1299 | - $where .= " and "; |
|
1297 | + if($where != "") { |
|
1298 | + $where .= " and "; |
|
1299 | + } |
|
1300 | 1300 | $where .= $clause; |
1301 | 1301 | } |
1302 | 1302 | |
@@ -1374,8 +1374,7 @@ discard block |
||
1374 | 1374 | if($strlen < $length) |
1375 | 1375 | { |
1376 | 1376 | $string = str_pad($string,$length,"0"); |
1377 | - } |
|
1378 | - else if($strlen > $length) |
|
1377 | + } else if($strlen > $length) |
|
1379 | 1378 | { |
1380 | 1379 | $string = substr($string, 0, $length); |
1381 | 1380 | } |
@@ -1575,7 +1574,9 @@ discard block |
||
1575 | 1574 | $replacement .= "/OPTION>\n<OPTION value='__SugarMassUpdateClearField__'><"; // Giving the user the option to unset a drop down list. I.e. none means that it won't get updated |
1576 | 1575 | } |
1577 | 1576 | |
1578 | - if (empty($key_list)) $key_list = array(); |
|
1577 | + if (empty($key_list)) { |
|
1578 | + $key_list = array(); |
|
1579 | + } |
|
1579 | 1580 | //create the type dropdown domain and set the selected value if $opp value already exists |
1580 | 1581 | foreach ($key_list as $option_key=>$option_value) { |
1581 | 1582 | |
@@ -1737,24 +1738,26 @@ discard block |
||
1737 | 1738 | $current_language = ($_REQUEST['login_language'] == $current_language)? $current_language : $_REQUEST['login_language']; |
1738 | 1739 | } |
1739 | 1740 | $mod_strings = return_module_language($current_language, $mod); |
1740 | - if ($mod == "") |
|
1741 | - echo "Language is <pre>" . $mod_strings . "</pre>"; |
|
1741 | + if ($mod == "") { |
|
1742 | + echo "Language is <pre>" . $mod_strings . "</pre>"; |
|
1743 | + } |
|
1742 | 1744 | |
1743 | - }else{ |
|
1745 | + } else{ |
|
1744 | 1746 | global $mod_strings; |
1745 | 1747 | } |
1746 | 1748 | |
1747 | 1749 | $returnValue = ''; |
1748 | 1750 | global $app_strings, $app_list_strings; |
1749 | 1751 | |
1750 | - if (isset($mod_strings[$string])) |
|
1751 | - $returnValue = $mod_strings[$string]; |
|
1752 | - else if (isset($app_strings[$string])) |
|
1753 | - $returnValue = $app_strings[$string]; |
|
1754 | - else if (isset($app_list_strings[$string])) |
|
1755 | - $returnValue = $app_list_strings[$string]; |
|
1756 | - else if (isset($app_list_strings['moduleList']) && isset($app_list_strings['moduleList'][$string])) |
|
1757 | - $returnValue = $app_list_strings['moduleList'][$string]; |
|
1752 | + if (isset($mod_strings[$string])) { |
|
1753 | + $returnValue = $mod_strings[$string]; |
|
1754 | + } else if (isset($app_strings[$string])) { |
|
1755 | + $returnValue = $app_strings[$string]; |
|
1756 | + } else if (isset($app_list_strings[$string])) { |
|
1757 | + $returnValue = $app_list_strings[$string]; |
|
1758 | + } else if (isset($app_list_strings['moduleList']) && isset($app_list_strings['moduleList'][$string])) { |
|
1759 | + $returnValue = $app_list_strings['moduleList'][$string]; |
|
1760 | + } |
|
1758 | 1761 | |
1759 | 1762 | |
1760 | 1763 | //$test_end = microtime(); |
@@ -1867,8 +1870,9 @@ discard block |
||
1867 | 1870 | function clean_xss($str, $cleanImg=true) { |
1868 | 1871 | global $sugar_config; |
1869 | 1872 | |
1870 | - if(empty($sugar_config['email_xss'])) |
|
1871 | - $sugar_config['email_xss'] = getDefaultXssTags(); |
|
1873 | + if(empty($sugar_config['email_xss'])) { |
|
1874 | + $sugar_config['email_xss'] = getDefaultXssTags(); |
|
1875 | + } |
|
1872 | 1876 | |
1873 | 1877 | $xsstags = unserialize(base64_decode($sugar_config['email_xss'])); |
1874 | 1878 | |
@@ -1987,32 +1991,65 @@ discard block |
||
1987 | 1991 | die("Bad data passed in; <a href=\"{$sugar_config['site_url']}\">Return to Home</a>"); |
1988 | 1992 | } |
1989 | 1993 | return false; |
1990 | - } |
|
1991 | - else { |
|
1994 | + } else { |
|
1992 | 1995 | return $str; |
1993 | 1996 | } |
1994 | 1997 | } |
1995 | 1998 | |
1996 | 1999 | function clean_special_arguments() { |
1997 | 2000 | if(isset($_SERVER['PHP_SELF'])) { |
1998 | - if (!empty($_SERVER['PHP_SELF'])) clean_string($_SERVER['PHP_SELF'], 'SAFED_GET'); |
|
1999 | - } |
|
2000 | - if (!empty($_REQUEST) && !empty($_REQUEST['login_theme'])) clean_string($_REQUEST['login_theme'], "STANDARD"); |
|
2001 | - if (!empty($_REQUEST) && !empty($_REQUEST['login_module'])) clean_string($_REQUEST['login_module'], "STANDARD"); |
|
2002 | - if (!empty($_REQUEST) && !empty($_REQUEST['login_action'])) clean_string($_REQUEST['login_action'], "STANDARD"); |
|
2003 | - if (!empty($_REQUEST) && !empty($_REQUEST['ck_login_theme_20'])) clean_string($_REQUEST['ck_login_theme_20'], "STANDARD"); |
|
2004 | - if (!empty($_SESSION) && !empty($_SESSION['authenticated_user_theme'])) clean_string($_SESSION['authenticated_user_theme'], "STANDARD"); |
|
2005 | - if (!empty($_REQUEST) && !empty($_REQUEST['module_name'])) clean_string($_REQUEST['module_name'], "STANDARD"); |
|
2006 | - if (!empty($_REQUEST) && !empty($_REQUEST['module'])) clean_string($_REQUEST['module'], "STANDARD"); |
|
2007 | - if (!empty($_POST) && !empty($_POST['parent_type'])) clean_string($_POST['parent_type'], "STANDARD"); |
|
2008 | - if (!empty($_REQUEST) && !empty($_REQUEST['mod_lang'])) clean_string($_REQUEST['mod_lang'], "STANDARD"); |
|
2009 | - if (!empty($_SESSION) && !empty($_SESSION['authenticated_user_language'])) clean_string($_SESSION['authenticated_user_language'], "STANDARD"); |
|
2010 | - if (!empty($_SESSION) && !empty($_SESSION['dyn_layout_file'])) clean_string($_SESSION['dyn_layout_file'], "PATH_NO_URL"); |
|
2011 | - if (!empty($_GET) && !empty($_GET['from'])) clean_string($_GET['from']); |
|
2012 | - if (!empty($_GET) && !empty($_GET['gmto'])) clean_string($_GET['gmto'], "NUMBER"); |
|
2013 | - if (!empty($_GET) && !empty($_GET['case_number'])) clean_string($_GET['case_number'], "AUTO_INCREMENT"); |
|
2014 | - if (!empty($_GET) && !empty($_GET['bug_number'])) clean_string($_GET['bug_number'], "AUTO_INCREMENT"); |
|
2015 | - if (!empty($_GET) && !empty($_GET['quote_num'])) clean_string($_GET['quote_num'], "AUTO_INCREMENT"); |
|
2001 | + if (!empty($_SERVER['PHP_SELF'])) { |
|
2002 | + clean_string($_SERVER['PHP_SELF'], 'SAFED_GET'); |
|
2003 | + } |
|
2004 | + } |
|
2005 | + if (!empty($_REQUEST) && !empty($_REQUEST['login_theme'])) { |
|
2006 | + clean_string($_REQUEST['login_theme'], "STANDARD"); |
|
2007 | + } |
|
2008 | + if (!empty($_REQUEST) && !empty($_REQUEST['login_module'])) { |
|
2009 | + clean_string($_REQUEST['login_module'], "STANDARD"); |
|
2010 | + } |
|
2011 | + if (!empty($_REQUEST) && !empty($_REQUEST['login_action'])) { |
|
2012 | + clean_string($_REQUEST['login_action'], "STANDARD"); |
|
2013 | + } |
|
2014 | + if (!empty($_REQUEST) && !empty($_REQUEST['ck_login_theme_20'])) { |
|
2015 | + clean_string($_REQUEST['ck_login_theme_20'], "STANDARD"); |
|
2016 | + } |
|
2017 | + if (!empty($_SESSION) && !empty($_SESSION['authenticated_user_theme'])) { |
|
2018 | + clean_string($_SESSION['authenticated_user_theme'], "STANDARD"); |
|
2019 | + } |
|
2020 | + if (!empty($_REQUEST) && !empty($_REQUEST['module_name'])) { |
|
2021 | + clean_string($_REQUEST['module_name'], "STANDARD"); |
|
2022 | + } |
|
2023 | + if (!empty($_REQUEST) && !empty($_REQUEST['module'])) { |
|
2024 | + clean_string($_REQUEST['module'], "STANDARD"); |
|
2025 | + } |
|
2026 | + if (!empty($_POST) && !empty($_POST['parent_type'])) { |
|
2027 | + clean_string($_POST['parent_type'], "STANDARD"); |
|
2028 | + } |
|
2029 | + if (!empty($_REQUEST) && !empty($_REQUEST['mod_lang'])) { |
|
2030 | + clean_string($_REQUEST['mod_lang'], "STANDARD"); |
|
2031 | + } |
|
2032 | + if (!empty($_SESSION) && !empty($_SESSION['authenticated_user_language'])) { |
|
2033 | + clean_string($_SESSION['authenticated_user_language'], "STANDARD"); |
|
2034 | + } |
|
2035 | + if (!empty($_SESSION) && !empty($_SESSION['dyn_layout_file'])) { |
|
2036 | + clean_string($_SESSION['dyn_layout_file'], "PATH_NO_URL"); |
|
2037 | + } |
|
2038 | + if (!empty($_GET) && !empty($_GET['from'])) { |
|
2039 | + clean_string($_GET['from']); |
|
2040 | + } |
|
2041 | + if (!empty($_GET) && !empty($_GET['gmto'])) { |
|
2042 | + clean_string($_GET['gmto'], "NUMBER"); |
|
2043 | + } |
|
2044 | + if (!empty($_GET) && !empty($_GET['case_number'])) { |
|
2045 | + clean_string($_GET['case_number'], "AUTO_INCREMENT"); |
|
2046 | + } |
|
2047 | + if (!empty($_GET) && !empty($_GET['bug_number'])) { |
|
2048 | + clean_string($_GET['bug_number'], "AUTO_INCREMENT"); |
|
2049 | + } |
|
2050 | + if (!empty($_GET) && !empty($_GET['quote_num'])) { |
|
2051 | + clean_string($_GET['quote_num'], "AUTO_INCREMENT"); |
|
2052 | + } |
|
2016 | 2053 | clean_superglobals('stamp', 'ALPHANUM'); // for vcr controls |
2017 | 2054 | clean_superglobals('offset', 'ALPHANUM'); |
2018 | 2055 | clean_superglobals('return_action'); |
@@ -2024,10 +2061,16 @@ discard block |
||
2024 | 2061 | * cleans the given key in superglobals $_GET, $_POST, $_REQUEST |
2025 | 2062 | */ |
2026 | 2063 | function clean_superglobals($key, $filter = 'STANDARD') { |
2027 | - if(isset($_GET[$key])) clean_string($_GET[$key], $filter); |
|
2028 | - if(isset($_POST[$key])) clean_string($_POST[$key], $filter); |
|
2029 | - if(isset($_REQUEST[$key])) clean_string($_REQUEST[$key], $filter); |
|
2030 | -} |
|
2064 | + if(isset($_GET[$key])) { |
|
2065 | + clean_string($_GET[$key], $filter); |
|
2066 | + } |
|
2067 | + if(isset($_POST[$key])) { |
|
2068 | + clean_string($_POST[$key], $filter); |
|
2069 | + } |
|
2070 | + if(isset($_REQUEST[$key])) { |
|
2071 | + clean_string($_REQUEST[$key], $filter); |
|
2072 | + } |
|
2073 | + } |
|
2031 | 2074 | |
2032 | 2075 | function set_superglobals($key, $val){ |
2033 | 2076 | $_GET[$key] = $val; |
@@ -2068,25 +2111,51 @@ discard block |
||
2068 | 2111 | //get translated, so scrub the data but don't die |
2069 | 2112 | if(ini_get('mbstring.encoding_translation')==='1'){ |
2070 | 2113 | securexsskey($k,false); |
2071 | - }else{ |
|
2114 | + } else{ |
|
2072 | 2115 | securexsskey($k,true); |
2073 | 2116 | } |
2074 | 2117 | |
2075 | 2118 | } |
2076 | 2119 | // Any additional variables that need to be cleaned should be added here |
2077 | - if (isset($_REQUEST['login_theme'])) clean_string($_REQUEST['login_theme']); |
|
2078 | - if (isset($_REQUEST['login_module'])) clean_string($_REQUEST['login_module']); |
|
2079 | - if (isset($_REQUEST['login_action'])) clean_string($_REQUEST['login_action']); |
|
2080 | - if (isset($_REQUEST['login_language'])) clean_string($_REQUEST['login_language']); |
|
2081 | - if (isset($_REQUEST['action'])) clean_string($_REQUEST['action']); |
|
2082 | - if (isset($_REQUEST['module'])) clean_string($_REQUEST['module']); |
|
2083 | - if (isset($_REQUEST['record'])) clean_string($_REQUEST['record'], 'STANDARDSPACE'); |
|
2084 | - if (isset($_SESSION['authenticated_user_theme'])) clean_string($_SESSION['authenticated_user_theme']); |
|
2085 | - if (isset($_SESSION['authenticated_user_language'])) clean_string($_SESSION['authenticated_user_language']); |
|
2086 | - if (isset($_REQUEST['language'])) clean_string($_REQUEST['language']); |
|
2087 | - if (isset($sugar_config['default_theme'])) clean_string($sugar_config['default_theme']); |
|
2088 | - if (isset($_REQUEST['offset'])) clean_string($_REQUEST['offset']); |
|
2089 | - if (isset($_REQUEST['stamp'])) clean_string($_REQUEST['stamp']); |
|
2120 | + if (isset($_REQUEST['login_theme'])) { |
|
2121 | + clean_string($_REQUEST['login_theme']); |
|
2122 | + } |
|
2123 | + if (isset($_REQUEST['login_module'])) { |
|
2124 | + clean_string($_REQUEST['login_module']); |
|
2125 | + } |
|
2126 | + if (isset($_REQUEST['login_action'])) { |
|
2127 | + clean_string($_REQUEST['login_action']); |
|
2128 | + } |
|
2129 | + if (isset($_REQUEST['login_language'])) { |
|
2130 | + clean_string($_REQUEST['login_language']); |
|
2131 | + } |
|
2132 | + if (isset($_REQUEST['action'])) { |
|
2133 | + clean_string($_REQUEST['action']); |
|
2134 | + } |
|
2135 | + if (isset($_REQUEST['module'])) { |
|
2136 | + clean_string($_REQUEST['module']); |
|
2137 | + } |
|
2138 | + if (isset($_REQUEST['record'])) { |
|
2139 | + clean_string($_REQUEST['record'], 'STANDARDSPACE'); |
|
2140 | + } |
|
2141 | + if (isset($_SESSION['authenticated_user_theme'])) { |
|
2142 | + clean_string($_SESSION['authenticated_user_theme']); |
|
2143 | + } |
|
2144 | + if (isset($_SESSION['authenticated_user_language'])) { |
|
2145 | + clean_string($_SESSION['authenticated_user_language']); |
|
2146 | + } |
|
2147 | + if (isset($_REQUEST['language'])) { |
|
2148 | + clean_string($_REQUEST['language']); |
|
2149 | + } |
|
2150 | + if (isset($sugar_config['default_theme'])) { |
|
2151 | + clean_string($sugar_config['default_theme']); |
|
2152 | + } |
|
2153 | + if (isset($_REQUEST['offset'])) { |
|
2154 | + clean_string($_REQUEST['offset']); |
|
2155 | + } |
|
2156 | + if (isset($_REQUEST['stamp'])) { |
|
2157 | + clean_string($_REQUEST['stamp']); |
|
2158 | + } |
|
2090 | 2159 | |
2091 | 2160 | if(isset($_REQUEST['lvso'])){ |
2092 | 2161 | set_superglobals('lvso', (strtolower($_REQUEST['lvso']) === 'desc')?'desc':'asc'); |
@@ -2096,8 +2165,7 @@ discard block |
||
2096 | 2165 | if (str_end($key, "_offset")) { |
2097 | 2166 | clean_string($_REQUEST[$key], "ALPHANUM"); // keep this ALPHANUM for disable_count_query |
2098 | 2167 | set_superglobals($key, $_REQUEST[$key]); |
2099 | - } |
|
2100 | - elseif (str_end($key, "_ORDER_BY")) { |
|
2168 | + } elseif (str_end($key, "_ORDER_BY")) { |
|
2101 | 2169 | clean_string($_REQUEST[$key], "SQL_COLUMN_LIST"); |
2102 | 2170 | set_superglobals($key, $_REQUEST[$key]); |
2103 | 2171 | } |
@@ -2138,7 +2206,7 @@ discard block |
||
2138 | 2206 | if(!empty($matches)){ |
2139 | 2207 | if($die){ |
2140 | 2208 | die("Bad data passed in; <a href=\"{$sugar_config['site_url']}\">Return to Home</a>"); |
2141 | - }else{ |
|
2209 | + } else{ |
|
2142 | 2210 | unset($_REQUEST[$value]); |
2143 | 2211 | unset($_POST[$value]); |
2144 | 2212 | unset($_GET[$value]); |
@@ -2153,8 +2221,7 @@ discard block |
||
2153 | 2221 | } |
2154 | 2222 | |
2155 | 2223 | $value = securexss($value); |
2156 | - } |
|
2157 | - else if (is_array($value)){ |
|
2224 | + } else if (is_array($value)){ |
|
2158 | 2225 | foreach ($value as $key => $element) { |
2159 | 2226 | $value[$key] = preprocess_param($element); |
2160 | 2227 | } |
@@ -2165,7 +2232,9 @@ discard block |
||
2165 | 2232 | |
2166 | 2233 | function cleanup_slashes($value) |
2167 | 2234 | { |
2168 | - if(is_string($value)) return stripslashes($value); |
|
2235 | + if(is_string($value)) { |
|
2236 | + return stripslashes($value); |
|
2237 | + } |
|
2169 | 2238 | return $value; |
2170 | 2239 | } |
2171 | 2240 | |
@@ -2210,18 +2279,26 @@ discard block |
||
2210 | 2279 | |
2211 | 2280 | function getWebPath($relative_path){ |
2212 | 2281 | //if it has a :// then it isn't a relative path |
2213 | - if(substr_count($relative_path, '://') > 0) return $relative_path; |
|
2214 | - if(defined('TEMPLATE_URL'))$relative_path = SugarTemplateUtilities::getWebPath($relative_path); |
|
2282 | + if(substr_count($relative_path, '://') > 0) { |
|
2283 | + return $relative_path; |
|
2284 | + } |
|
2285 | + if(defined('TEMPLATE_URL')) { |
|
2286 | + $relative_path = SugarTemplateUtilities::getWebPath($relative_path); |
|
2287 | + } |
|
2215 | 2288 | return $relative_path; |
2216 | 2289 | } |
2217 | 2290 | |
2218 | 2291 | function getVersionedPath($path, $additional_attrs='') |
2219 | 2292 | { |
2220 | - if(empty($GLOBALS['sugar_config']['js_custom_version'])) $GLOBALS['sugar_config']['js_custom_version'] = 1; |
|
2293 | + if(empty($GLOBALS['sugar_config']['js_custom_version'])) { |
|
2294 | + $GLOBALS['sugar_config']['js_custom_version'] = 1; |
|
2295 | + } |
|
2221 | 2296 | $js_version_key = isset($GLOBALS['js_version_key'])?$GLOBALS['js_version_key']:''; |
2222 | 2297 | if(inDeveloperMode()) { |
2223 | 2298 | static $rand; |
2224 | - if(empty($rand)) $rand = mt_rand(); |
|
2299 | + if(empty($rand)) { |
|
2300 | + $rand = mt_rand(); |
|
2301 | + } |
|
2225 | 2302 | $dev = $rand; |
2226 | 2303 | } else { |
2227 | 2304 | $dev = ''; |
@@ -2233,7 +2310,9 @@ discard block |
||
2233 | 2310 | $str = substr(base64_encode(md5("$js_version_key|{$GLOBALS['sugar_config']['js_custom_version']}|$dev|$additional_attrs", true)), 0, -2); |
2234 | 2311 | // remove / - it confuses some parsers |
2235 | 2312 | $str = strtr($str, '/+', '-_'); |
2236 | - if(empty($path)) return $str; |
|
2313 | + if(empty($path)) { |
|
2314 | + return $str; |
|
2315 | + } |
|
2237 | 2316 | |
2238 | 2317 | return $path . "?v=$str"; |
2239 | 2318 | } |
@@ -2245,7 +2324,9 @@ discard block |
||
2245 | 2324 | |
2246 | 2325 | function getJSPath($relative_path, $additional_attrs='') |
2247 | 2326 | { |
2248 | - if(defined('TEMPLATE_URL'))$relative_path = SugarTemplateUtilities::getWebPath($relative_path); |
|
2327 | + if(defined('TEMPLATE_URL')) { |
|
2328 | + $relative_path = SugarTemplateUtilities::getWebPath($relative_path); |
|
2329 | + } |
|
2249 | 2330 | return getVersionedPath($relative_path).(!empty($additional_attrs)?"&$additional_attrs":""); |
2250 | 2331 | } |
2251 | 2332 | |
@@ -2277,8 +2358,7 @@ discard block |
||
2277 | 2358 | $match[1] = "0".$match[1]; |
2278 | 2359 | } |
2279 | 2360 | return "{$match[3]}-{$match[1]}-{$match[2]}"; |
2280 | - } |
|
2281 | - else if (preg_match('/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/',$date_str,$match)) |
|
2361 | + } else if (preg_match('/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/',$date_str,$match)) |
|
2282 | 2362 | { |
2283 | 2363 | if ( strlen($match[2]) == 1) |
2284 | 2364 | { |
@@ -2289,8 +2369,7 @@ discard block |
||
2289 | 2369 | $match[1] = "0".$match[1]; |
2290 | 2370 | } |
2291 | 2371 | return "{$match[3]}-{$match[1]}-{$match[2]}"; |
2292 | - } |
|
2293 | - else |
|
2372 | + } else |
|
2294 | 2373 | { |
2295 | 2374 | return ""; |
2296 | 2375 | } |
@@ -2347,10 +2426,12 @@ discard block |
||
2347 | 2426 | } |
2348 | 2427 | $bean->update_date_modified = false; |
2349 | 2428 | $bean->update_modified_by = false; |
2350 | - if(isset($bean->date_modified)) |
|
2351 | - $bean->date_modified = $timedate->to_db($bean->date_modified); |
|
2352 | - if(isset($bean->date_entered)) |
|
2353 | - $bean->date_entered = $timedate->to_db($bean->date_entered); |
|
2429 | + if(isset($bean->date_modified)) { |
|
2430 | + $bean->date_modified = $timedate->to_db($bean->date_modified); |
|
2431 | + } |
|
2432 | + if(isset($bean->date_entered)) { |
|
2433 | + $bean->date_entered = $timedate->to_db($bean->date_entered); |
|
2434 | + } |
|
2354 | 2435 | //save |
2355 | 2436 | $new_id=$bean->save(); |
2356 | 2437 | |
@@ -2673,7 +2754,7 @@ discard block |
||
2673 | 2754 | //no error notice - lets just display the error to the user |
2674 | 2755 | if(!isset($error_notice)){ |
2675 | 2756 | echo '<br>'.$msg . '<br>'; |
2676 | - }else{ |
|
2757 | + } else{ |
|
2677 | 2758 | $error_notice .= $msg . '<br>'; |
2678 | 2759 | } |
2679 | 2760 | } |
@@ -2717,10 +2798,9 @@ discard block |
||
2717 | 2798 | |
2718 | 2799 | if(ord(substr($str, $i, 1))==10){ |
2719 | 2800 | $new_str .= '\n'; |
2720 | - }elseif(ord(substr($str, $i, 1))==13){ |
|
2801 | + } elseif(ord(substr($str, $i, 1))==13){ |
|
2721 | 2802 | $new_str .= '\r'; |
2722 | - } |
|
2723 | - else { |
|
2803 | + } else { |
|
2724 | 2804 | $new_str .= $str{$i}; |
2725 | 2805 | } |
2726 | 2806 | } |
@@ -2735,8 +2815,7 @@ discard block |
||
2735 | 2815 | |
2736 | 2816 | if($keep){ |
2737 | 2817 | $str = javascript_escape($str); |
2738 | - } |
|
2739 | - else { |
|
2818 | + } else { |
|
2740 | 2819 | $str = str_replace("'", " ", $str); |
2741 | 2820 | $str = str_replace('"', " ", $str); |
2742 | 2821 | } |
@@ -2931,8 +3010,9 @@ discard block |
||
2931 | 3010 | |
2932 | 3011 | $server_software = $_SERVER["SERVER_SOFTWARE"]; |
2933 | 3012 | $iis_version = ''; |
2934 | - if(strpos($server_software,'Microsoft-IIS') !== false && preg_match_all("/^.*\/(\d+\.?\d*)$/", $server_software, $out)) |
|
2935 | - $iis_version = $out[1][0]; |
|
3013 | + if(strpos($server_software,'Microsoft-IIS') !== false && preg_match_all("/^.*\/(\d+\.?\d*)$/", $server_software, $out)) { |
|
3014 | + $iis_version = $out[1][0]; |
|
3015 | + } |
|
2936 | 3016 | |
2937 | 3017 | $sys_iis_version = empty($sys_iis_version) ? $iis_version : $sys_iis_version; |
2938 | 3018 | |
@@ -3008,7 +3088,9 @@ discard block |
||
3008 | 3088 | |
3009 | 3089 | function sugar_cleanup($exit = false) { |
3010 | 3090 | static $called = false; |
3011 | - if($called)return; |
|
3091 | + if($called) { |
|
3092 | + return; |
|
3093 | + } |
|
3012 | 3094 | $called = true; |
3013 | 3095 | set_include_path(realpath(dirname(__FILE__) . '/..') . PATH_SEPARATOR . get_include_path()); |
3014 | 3096 | chdir(realpath(dirname(__FILE__) . '/..')); |
@@ -3019,7 +3101,11 @@ discard block |
||
3019 | 3101 | |
3020 | 3102 | //added this check to avoid errors during install. |
3021 | 3103 | if (empty($sugar_config['dbconfig'])) { |
3022 | - if ($exit) exit; else return; |
|
3104 | + if ($exit) { |
|
3105 | + exit; |
|
3106 | + } else { |
|
3107 | + return; |
|
3108 | + } |
|
3023 | 3109 | } |
3024 | 3110 | |
3025 | 3111 | if (!class_exists('Tracker', true)) { |
@@ -3028,8 +3114,9 @@ discard block |
||
3028 | 3114 | Tracker::logPage(); |
3029 | 3115 | // Now write the cached tracker_queries |
3030 | 3116 | if(!empty($GLOBALS['savePreferencesToDB']) && $GLOBALS['savePreferencesToDB']) { |
3031 | - if ( isset($GLOBALS['current_user']) && $GLOBALS['current_user'] instanceOf User ) |
|
3032 | - $GLOBALS['current_user']->savePreferencesToDB(); |
|
3117 | + if ( isset($GLOBALS['current_user']) && $GLOBALS['current_user'] instanceOf User ) { |
|
3118 | + $GLOBALS['current_user']->savePreferencesToDB(); |
|
3119 | + } |
|
3033 | 3120 | } |
3034 | 3121 | |
3035 | 3122 | //check to see if this is not an `ajax call AND the user preference error flag is set |
@@ -3154,8 +3241,9 @@ discard block |
||
3154 | 3241 | |
3155 | 3242 | echo "\n\n display_stack_trace caller, file: " . $stack[0]['file']. ' line#: ' .$stack[0]['line']; |
3156 | 3243 | |
3157 | - if(!$textOnly) |
|
3158 | - echo '<br>'; |
|
3244 | + if(!$textOnly) { |
|
3245 | + echo '<br>'; |
|
3246 | + } |
|
3159 | 3247 | |
3160 | 3248 | $first = true; |
3161 | 3249 | $out = ''; |
@@ -3166,14 +3254,18 @@ discard block |
||
3166 | 3254 | $line = ''; |
3167 | 3255 | $function = ''; |
3168 | 3256 | |
3169 | - if(isset($item['file'])) |
|
3170 | - $file = $item['file']; |
|
3171 | - if(isset($item['class'])) |
|
3172 | - $class = $item['class']; |
|
3173 | - if(isset($item['line'])) |
|
3174 | - $line = $item['line']; |
|
3175 | - if(isset($item['function'])) |
|
3176 | - $function = $item['function']; |
|
3257 | + if(isset($item['file'])) { |
|
3258 | + $file = $item['file']; |
|
3259 | + } |
|
3260 | + if(isset($item['class'])) { |
|
3261 | + $class = $item['class']; |
|
3262 | + } |
|
3263 | + if(isset($item['line'])) { |
|
3264 | + $line = $item['line']; |
|
3265 | + } |
|
3266 | + if(isset($item['function'])) { |
|
3267 | + $function = $item['function']; |
|
3268 | + } |
|
3177 | 3269 | |
3178 | 3270 | if(!$first) { |
3179 | 3271 | if(!$textOnly) { |
@@ -3217,9 +3309,9 @@ discard block |
||
3217 | 3309 | if ( error_reporting() & E_NOTICE ) { |
3218 | 3310 | $halt_script = false; |
3219 | 3311 | $type = 'Notice'; |
3312 | + } else { |
|
3313 | + return; |
|
3220 | 3314 | } |
3221 | - else |
|
3222 | - return; |
|
3223 | 3315 | break; |
3224 | 3316 | case E_USER_WARNING: |
3225 | 3317 | case E_COMPILE_WARNING: |
@@ -3367,14 +3459,16 @@ discard block |
||
3367 | 3459 | $file = str_replace("/", '\\', $file); |
3368 | 3460 | |
3369 | 3461 | if(file_exists($file)) { |
3370 | - if (!($f = @sugar_fopen($file, 'r+'))) |
|
3371 | - return false; |
|
3462 | + if (!($f = @sugar_fopen($file, 'r+'))) { |
|
3463 | + return false; |
|
3464 | + } |
|
3372 | 3465 | fclose($f); |
3373 | 3466 | return true; |
3374 | 3467 | } |
3375 | 3468 | |
3376 | - if(!($f = @sugar_fopen($file, 'w'))) |
|
3377 | - return false; |
|
3469 | + if(!($f = @sugar_fopen($file, 'w'))) { |
|
3470 | + return false; |
|
3471 | + } |
|
3378 | 3472 | fclose($f); |
3379 | 3473 | unlink($file); |
3380 | 3474 | return true; |
@@ -3393,7 +3487,9 @@ discard block |
||
3393 | 3487 | global $beanList; |
3394 | 3488 | |
3395 | 3489 | foreach($module_array as $key => $value){ |
3396 | - if(!empty($beanList[$value])) $module_array[$key] = $beanList[$value]; |
|
3490 | + if(!empty($beanList[$value])) { |
|
3491 | + $module_array[$key] = $beanList[$value]; |
|
3492 | + } |
|
3397 | 3493 | |
3398 | 3494 | if($value=="Cases") { |
3399 | 3495 | $module_array[$key] = "Case"; |
@@ -3417,8 +3513,7 @@ discard block |
||
3417 | 3513 | global $beanFiles, $beanList; |
3418 | 3514 | if(array_key_exists($bean_name, $beanList)){ |
3419 | 3515 | return $beanList[$bean_name]; |
3420 | - } |
|
3421 | - else{ |
|
3516 | + } else{ |
|
3422 | 3517 | return $bean_name; |
3423 | 3518 | } |
3424 | 3519 | } |
@@ -3692,8 +3787,7 @@ discard block |
||
3692 | 3787 | $num=unformat_number($num); |
3693 | 3788 | if(isset($system_id) && $system_id == 1){ |
3694 | 3789 | return sprintf("%d", $num); |
3695 | - } |
|
3696 | - else{ |
|
3790 | + } else{ |
|
3697 | 3791 | return sprintf("%d-%d", $num, $system_id); |
3698 | 3792 | } |
3699 | 3793 | } |
@@ -3720,8 +3814,7 @@ discard block |
||
3720 | 3814 | { |
3721 | 3815 | //third index ($split[2]) will be the host |
3722 | 3816 | $split[2] .= ":".$port; |
3723 | - } |
|
3724 | - else // otherwise assumed to start with host name |
|
3817 | + } else // otherwise assumed to start with host name |
|
3725 | 3818 | { |
3726 | 3819 | //first index ($split[0]) will be the host |
3727 | 3820 | $split[0] .= ":".$port; |
@@ -3797,19 +3890,19 @@ discard block |
||
3797 | 3890 | if(is_array($domVal)) |
3798 | 3891 | { |
3799 | 3892 | $tempArr = array(); |
3800 | - foreach ( $domVal as $domArrKey => $domArrVal ) |
|
3801 | - $tempArr[$domArrKey] = $domArrVal; |
|
3802 | - foreach ( $gimp[$domKey] as $gimpArrKey => $gimpArrVal ) |
|
3803 | - if ( !isset($tempArr[$gimpArrKey]) ) |
|
3893 | + foreach ( $domVal as $domArrKey => $domArrVal ) { |
|
3894 | + $tempArr[$domArrKey] = $domArrVal; |
|
3895 | + } |
|
3896 | + foreach ( $gimp[$domKey] as $gimpArrKey => $gimpArrVal ) { |
|
3897 | + if ( !isset($tempArr[$gimpArrKey]) ) |
|
3804 | 3898 | $tempArr[$gimpArrKey] = $gimpArrVal; |
3899 | + } |
|
3805 | 3900 | $gimp[$domKey] = $tempArr; |
3806 | - } |
|
3807 | - else |
|
3901 | + } else |
|
3808 | 3902 | { |
3809 | 3903 | $gimp[$domKey] = $domVal; |
3810 | 3904 | } |
3811 | - } |
|
3812 | - else |
|
3905 | + } else |
|
3813 | 3906 | { |
3814 | 3907 | $gimp[$domKey] = $domVal; |
3815 | 3908 | } |
@@ -3843,11 +3936,13 @@ discard block |
||
3843 | 3936 | if(array_key_exists($domKey, $gimp)) { |
3844 | 3937 | if(is_array($domVal)) { |
3845 | 3938 | $tempArr = array(); |
3846 | - foreach ( $domVal as $domArrKey => $domArrVal ) |
|
3847 | - $tempArr[$domArrKey] = $domArrVal; |
|
3848 | - foreach ( $gimp[$domKey] as $gimpArrKey => $gimpArrVal ) |
|
3849 | - if ( !array_key_exists($gimpArrKey, $tempArr) ) |
|
3939 | + foreach ( $domVal as $domArrKey => $domArrVal ) { |
|
3940 | + $tempArr[$domArrKey] = $domArrVal; |
|
3941 | + } |
|
3942 | + foreach ( $gimp[$domKey] as $gimpArrKey => $gimpArrVal ) { |
|
3943 | + if ( !array_key_exists($gimpArrKey, $tempArr) ) |
|
3850 | 3944 | $tempArr[$gimpArrKey] = $gimpArrVal; |
3945 | + } |
|
3851 | 3946 | $gimp[$domKey] = $tempArr; |
3852 | 3947 | } else { |
3853 | 3948 | $gimp[$domKey] = $domVal; |
@@ -3858,8 +3953,9 @@ discard block |
||
3858 | 3953 | } |
3859 | 3954 | } |
3860 | 3955 | // if the passed value for gimp isn't an array, then return the $dom |
3861 | - elseif(is_array($dom)) |
|
3862 | - return $dom; |
|
3956 | + elseif(is_array($dom)) { |
|
3957 | + return $dom; |
|
3958 | + } |
|
3863 | 3959 | |
3864 | 3960 | return $gimp; |
3865 | 3961 | } |
@@ -3886,8 +3982,9 @@ discard block |
||
3886 | 3982 | } |
3887 | 3983 | } |
3888 | 3984 | // if the passed value for gimp isn't an array, then return the $dom |
3889 | - elseif(is_array($dom)) |
|
3890 | - return $dom; |
|
3985 | + elseif(is_array($dom)) { |
|
3986 | + return $dom; |
|
3987 | + } |
|
3891 | 3988 | |
3892 | 3989 | return $gimp; |
3893 | 3990 | } |
@@ -4042,8 +4139,7 @@ discard block |
||
4042 | 4139 | |
4043 | 4140 | if( write_array_to_file( "sugar_config", $sugar_config, "config.php" ) ){ |
4044 | 4141 | return true; |
4045 | - } |
|
4046 | - else { |
|
4142 | + } else { |
|
4047 | 4143 | return false; |
4048 | 4144 | } |
4049 | 4145 | } |
@@ -4076,8 +4172,9 @@ discard block |
||
4076 | 4172 | if(!empty($_SERVER['HTTP_REFERER'])) { |
4077 | 4173 | $url = parse_url($_SERVER['HTTP_REFERER']); |
4078 | 4174 | $replacement_url = $url['scheme']."://".$url['host']; |
4079 | - if(!empty($url['port'])) |
|
4080 | - $replacement_url .= ':'.$url['port']; |
|
4175 | + if(!empty($url['port'])) { |
|
4176 | + $replacement_url .= ':'.$url['port']; |
|
4177 | + } |
|
4081 | 4178 | $site_url = preg_replace('/^http[s]?\:\/\/[^\/]+/',$replacement_url,$sugar_config['site_url']); |
4082 | 4179 | } else { |
4083 | 4180 | $site_url = preg_replace('/^http(s)?\:\/\/[^\/]+/',"http$1://".$_SERVER['HTTP_HOST'],$sugar_config['site_url']); |
@@ -4102,8 +4199,7 @@ discard block |
||
4102 | 4199 | foreach ($array as $key => $value){ |
4103 | 4200 | $depth_array[] = array_depth($value, $depth_count); |
4104 | 4201 | } |
4105 | - } |
|
4106 | - else{ |
|
4202 | + } else{ |
|
4107 | 4203 | return $depth_count; |
4108 | 4204 | } |
4109 | 4205 | foreach ($depth_array as $value){ |
@@ -4146,17 +4242,20 @@ discard block |
||
4146 | 4242 | $iconFound = SugarThemeRegistry::current()->getImageURL($iconName,false); |
4147 | 4243 | |
4148 | 4244 | //First try un-ucfirst-ing the icon name |
4149 | - if ( empty($iconFound) ) |
|
4150 | - $iconName = "icon_" . strtolower(substr($iconFileName,0,1)).substr($iconFileName,1) . ".gif"; |
|
4245 | + if ( empty($iconFound) ) { |
|
4246 | + $iconName = "icon_" . strtolower(substr($iconFileName,0,1)).substr($iconFileName,1) . ".gif"; |
|
4247 | + } |
|
4151 | 4248 | $iconFound = SugarThemeRegistry::current()->getImageURL($iconName,false); |
4152 | 4249 | |
4153 | 4250 | //Next try removing the icon prefix |
4154 | - if ( empty($iconFound) ) |
|
4155 | - $iconName = "{$iconFileName}.gif"; |
|
4251 | + if ( empty($iconFound) ) { |
|
4252 | + $iconName = "{$iconFileName}.gif"; |
|
4253 | + } |
|
4156 | 4254 | $iconFound = SugarThemeRegistry::current()->getImageURL($iconName,false); |
4157 | 4255 | |
4158 | - if ( empty($iconFound) ) |
|
4159 | - $iconName = ''; |
|
4256 | + if ( empty($iconFound) ) { |
|
4257 | + $iconName = ''; |
|
4258 | + } |
|
4160 | 4259 | |
4161 | 4260 | return $iconName; |
4162 | 4261 | } |
@@ -4222,8 +4321,9 @@ discard block |
||
4222 | 4321 | if (!isset($trans_tbl)) |
4223 | 4322 | { |
4224 | 4323 | $trans_tbl = array(); |
4225 | - foreach (get_html_translation_table(HTML_ENTITIES) as $val=>$key) |
|
4226 | - $trans_tbl[$key] = utf8_encode($val); |
|
4324 | + foreach (get_html_translation_table(HTML_ENTITIES) as $val=>$key) { |
|
4325 | + $trans_tbl[$key] = utf8_encode($val); |
|
4326 | + } |
|
4227 | 4327 | } |
4228 | 4328 | return strtr($string, $trans_tbl); |
4229 | 4329 | } |
@@ -4231,10 +4331,18 @@ discard block |
||
4231 | 4331 | // Returns the utf string corresponding to the unicode value |
4232 | 4332 | function code2utf($num) |
4233 | 4333 | { |
4234 | - if ($num < 128) return chr($num); |
|
4235 | - if ($num < 2048) return chr(($num >> 6) + 192) . chr(($num & 63) + 128); |
|
4236 | - if ($num < 65536) return chr(($num >> 12) + 224) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128); |
|
4237 | - if ($num < 2097152) return chr(($num >> 18) + 240) . chr((($num >> 12) & 63) + 128) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128); |
|
4334 | + if ($num < 128) { |
|
4335 | + return chr($num); |
|
4336 | + } |
|
4337 | + if ($num < 2048) { |
|
4338 | + return chr(($num >> 6) + 192) . chr(($num & 63) + 128); |
|
4339 | + } |
|
4340 | + if ($num < 65536) { |
|
4341 | + return chr(($num >> 12) + 224) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128); |
|
4342 | + } |
|
4343 | + if ($num < 2097152) { |
|
4344 | + return chr(($num >> 18) + 240) . chr((($num >> 12) & 63) + 128) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128); |
|
4345 | + } |
|
4238 | 4346 | return ''; |
4239 | 4347 | } |
4240 | 4348 | |
@@ -4287,8 +4395,9 @@ discard block |
||
4287 | 4395 | */ |
4288 | 4396 | function chartColors() |
4289 | 4397 | { |
4290 | - if (SugarThemeRegistry::current()->getCSSURL('sugarColors.xml')=='') |
|
4291 | - return SugarThemeRegistry::current()->getImageURL('sugarColors.xml'); |
|
4398 | + if (SugarThemeRegistry::current()->getCSSURL('sugarColors.xml')=='') { |
|
4399 | + return SugarThemeRegistry::current()->getImageURL('sugarColors.xml'); |
|
4400 | + } |
|
4292 | 4401 | return SugarThemeRegistry::current()->getCSSURL('sugarColors.xml'); |
4293 | 4402 | } |
4294 | 4403 | /* End Chart Dashlet helper functions */ |
@@ -4319,8 +4428,9 @@ discard block |
||
4319 | 4428 | if ( ( substr($path,0,2) == '\\\\' ) |
4320 | 4429 | || ( $path[0] == '/' ) |
4321 | 4430 | || preg_match('/^[A-z]:/i',$path) |
4322 | - || $currentServer ) |
|
4323 | - return $path; |
|
4431 | + || $currentServer ) { |
|
4432 | + return $path; |
|
4433 | + } |
|
4324 | 4434 | |
4325 | 4435 | return getcwd().'/'.$path; |
4326 | 4436 | } |
@@ -4367,8 +4477,9 @@ discard block |
||
4367 | 4477 | */ |
4368 | 4478 | function get_alt_hot_key() { |
4369 | 4479 | $ua = ''; |
4370 | - if ( isset($_SERVER['HTTP_USER_AGENT']) ) |
|
4371 | - $ua = strtolower($_SERVER['HTTP_USER_AGENT']); |
|
4480 | + if ( isset($_SERVER['HTTP_USER_AGENT']) ) { |
|
4481 | + $ua = strtolower($_SERVER['HTTP_USER_AGENT']); |
|
4482 | + } |
|
4372 | 4483 | $isMac = strpos($ua, 'mac') !== false; |
4373 | 4484 | $isLinux = strpos($ua, 'linux') !== false; |
4374 | 4485 | |
@@ -4412,11 +4523,12 @@ discard block |
||
4412 | 4523 | { |
4413 | 4524 | if ( !isset($GLOBALS['sugar_config']['allow_pop_inbound']) || ! $GLOBALS['sugar_config']['allow_pop_inbound'] ) |
4414 | 4525 | { |
4415 | - if( isset($protocol['pop3']) ) |
|
4416 | - unset($protocol['pop3']); |
|
4526 | + if( isset($protocol['pop3']) ) { |
|
4527 | + unset($protocol['pop3']); |
|
4528 | + } |
|
4529 | + } else { |
|
4530 | + $protocol['pop3'] = 'POP3'; |
|
4417 | 4531 | } |
4418 | - else |
|
4419 | - $protocol['pop3'] = 'POP3'; |
|
4420 | 4532 | |
4421 | 4533 | return $protocol; |
4422 | 4534 | } |
@@ -4460,11 +4572,13 @@ discard block |
||
4460 | 4572 | } |
4461 | 4573 | |
4462 | 4574 | function encodeMultienumValue($arr) { |
4463 | - if (!is_array($arr)) |
|
4464 | - return $arr; |
|
4575 | + if (!is_array($arr)) { |
|
4576 | + return $arr; |
|
4577 | + } |
|
4465 | 4578 | |
4466 | - if (empty($arr)) |
|
4467 | - return ""; |
|
4579 | + if (empty($arr)) { |
|
4580 | + return ""; |
|
4581 | + } |
|
4468 | 4582 | |
4469 | 4583 | $string = "^" . implode('^,^', $arr) . "^"; |
4470 | 4584 | |
@@ -4496,16 +4610,14 @@ discard block |
||
4496 | 4610 | if(empty($join_type)) |
4497 | 4611 | { |
4498 | 4612 | $params['join_type'] = ' LEFT JOIN '; |
4499 | - } |
|
4500 | - else |
|
4613 | + } else |
|
4501 | 4614 | { |
4502 | 4615 | $params['join_type'] = $join_type; |
4503 | 4616 | } |
4504 | 4617 | if(isset($data['join_name'])) |
4505 | 4618 | { |
4506 | 4619 | $params['join_table_alias'] = $field['join_name']; |
4507 | - } |
|
4508 | - else |
|
4620 | + } else |
|
4509 | 4621 | { |
4510 | 4622 | $params['join_table_alias'] = 'join_'.$field['name']; |
4511 | 4623 | |
@@ -4513,8 +4625,7 @@ discard block |
||
4513 | 4625 | if(isset($data['join_link_name'])) |
4514 | 4626 | { |
4515 | 4627 | $params['join_table_link_alias'] = $field['join_link_name']; |
4516 | - } |
|
4517 | - else |
|
4628 | + } else |
|
4518 | 4629 | { |
4519 | 4630 | $params['join_table_link_alias'] = 'join_link_'.$field['name']; |
4520 | 4631 | } |
@@ -4523,7 +4634,7 @@ discard block |
||
4523 | 4634 | if(isset($field['db_concat_fields'])){ |
4524 | 4635 | $db_field = db_concat($join_table_alias, $field['db_concat_fields']); |
4525 | 4636 | $where = preg_replace('/'.$field['name'].'/', $db_field, $where); |
4526 | - }else{ |
|
4637 | + } else{ |
|
4527 | 4638 | $where = preg_replace('/(^|[\s(])' . $field['name'] . '/', '${1}' . $join_table_alias . '.'.$field['rname'], $where); |
4528 | 4639 | } |
4529 | 4640 | } |
@@ -4558,8 +4669,7 @@ discard block |
||
4558 | 4669 | $number = preg_match("/{$variable}=([a-zA-Z0-9_-]+)[&]?/", $string, $matches); |
4559 | 4670 | if($number){ |
4560 | 4671 | return $matches[1]; |
4561 | - } |
|
4562 | - else{ |
|
4672 | + } else{ |
|
4563 | 4673 | return false; |
4564 | 4674 | } |
4565 | 4675 | } |
@@ -4591,7 +4701,7 @@ discard block |
||
4591 | 4701 | function getVersionStatus($version){ |
4592 | 4702 | if(preg_match('/^[\d\.]+?([a-zA-Z]+?)[\d]*?$/si', $version, $matches)) { |
4593 | 4703 | return strtoupper($matches[1]); |
4594 | - }else{ |
|
4704 | + } else{ |
|
4595 | 4705 | return 'GA'; |
4596 | 4706 | } |
4597 | 4707 | } |
@@ -4686,7 +4796,9 @@ discard block |
||
4686 | 4796 | } else { |
4687 | 4797 | // check image manually |
4688 | 4798 | $fp = fopen($path, "rb"); |
4689 | - if(!$fp) return false; |
|
4799 | + if(!$fp) { |
|
4800 | + return false; |
|
4801 | + } |
|
4690 | 4802 | $data = ''; |
4691 | 4803 | // read the whole file in chunks |
4692 | 4804 | while(!feof($fp)) { |
@@ -4778,8 +4890,9 @@ discard block |
||
4778 | 4890 | // add wildcard at the beginning of the search string |
4779 | 4891 | if (isset($GLOBALS['sugar_config']['search_wildcard_infront']) && |
4780 | 4892 | $GLOBALS['sugar_config']['search_wildcard_infront'] == true) { |
4781 | - if (substr($str,0,1) <> $wildcard) |
|
4782 | - $str = $wildcard.$str; |
|
4893 | + if (substr($str,0,1) <> $wildcard) { |
|
4894 | + $str = $wildcard.$str; |
|
4895 | + } |
|
4783 | 4896 | } |
4784 | 4897 | |
4785 | 4898 | // add wildcard at the end of search string (default) |
@@ -4834,8 +4947,7 @@ discard block |
||
4834 | 4947 | { |
4835 | 4948 | if (isset($GLOBALS['app_list_strings'][$optionName])) { |
4836 | 4949 | return $GLOBALS['app_list_strings'][$optionName]; |
4837 | - } |
|
4838 | - else { |
|
4950 | + } else { |
|
4839 | 4951 | return array(); |
4840 | 4952 | } |
4841 | 4953 | } |
@@ -5085,47 +5197,53 @@ discard block |
||
5085 | 5197 | |
5086 | 5198 | function suite_strlen($input, $encoding = DEFAULT_UTIL_SUITE_ENCODING) |
5087 | 5199 | { |
5088 | - if(function_exists('mb_strlen')) |
|
5089 | - return mb_strlen($input,$encoding); |
|
5090 | - else |
|
5091 | - return strlen($input); |
|
5092 | -} |
|
5200 | + if(function_exists('mb_strlen')) { |
|
5201 | + return mb_strlen($input,$encoding); |
|
5202 | + } else { |
|
5203 | + return strlen($input); |
|
5204 | + } |
|
5205 | + } |
|
5093 | 5206 | |
5094 | 5207 | function suite_substr($input, $start, $length = null,$encoding = DEFAULT_UTIL_SUITE_ENCODING) |
5095 | 5208 | { |
5096 | - if(function_exists('mb_substr')) |
|
5097 | - return mb_substr($input,$start,$length,$encoding); |
|
5098 | - else |
|
5099 | - return substr($input,$start,$length); |
|
5100 | -} |
|
5209 | + if(function_exists('mb_substr')) { |
|
5210 | + return mb_substr($input,$start,$length,$encoding); |
|
5211 | + } else { |
|
5212 | + return substr($input,$start,$length); |
|
5213 | + } |
|
5214 | + } |
|
5101 | 5215 | |
5102 | 5216 | function suite_strtoupper($input,$encoding = DEFAULT_UTIL_SUITE_ENCODING) |
5103 | 5217 | { |
5104 | - if(function_exists('mb_strtoupper')) |
|
5105 | - return mb_strtoupper($input,$encoding); |
|
5106 | - else |
|
5107 | - return strtoupper($input); |
|
5108 | -} |
|
5218 | + if(function_exists('mb_strtoupper')) { |
|
5219 | + return mb_strtoupper($input,$encoding); |
|
5220 | + } else { |
|
5221 | + return strtoupper($input); |
|
5222 | + } |
|
5223 | + } |
|
5109 | 5224 | function suite_strtolower($input,$encoding = DEFAULT_UTIL_SUITE_ENCODING) |
5110 | 5225 | { |
5111 | - if(function_exists('mb_strtolower')) |
|
5112 | - return mb_strtolower($input,$encoding); |
|
5113 | - else |
|
5114 | - return strtolower($input); |
|
5115 | -} |
|
5226 | + if(function_exists('mb_strtolower')) { |
|
5227 | + return mb_strtolower($input,$encoding); |
|
5228 | + } else { |
|
5229 | + return strtolower($input); |
|
5230 | + } |
|
5231 | + } |
|
5116 | 5232 | |
5117 | 5233 | function suite_strpos($haystack,$needle,$offset=0,$encoding = DEFAULT_UTIL_SUITE_ENCODING) |
5118 | 5234 | { |
5119 | - if(function_exists('mb_strpos')) |
|
5120 | - return mb_strpos($haystack,$needle,$offset,$encoding); |
|
5121 | - else |
|
5122 | - return strpos($haystack,$needle,$offset); |
|
5123 | -} |
|
5235 | + if(function_exists('mb_strpos')) { |
|
5236 | + return mb_strpos($haystack,$needle,$offset,$encoding); |
|
5237 | + } else { |
|
5238 | + return strpos($haystack,$needle,$offset); |
|
5239 | + } |
|
5240 | + } |
|
5124 | 5241 | |
5125 | 5242 | function suite_strrpos($haystack,$needle,$offset=0,$encoding = DEFAULT_UTIL_SUITE_ENCODING) |
5126 | 5243 | { |
5127 | - if(function_exists('mb_strrpos')) |
|
5128 | - return mb_strrpos($haystack,$needle,$offset,$encoding); |
|
5129 | - else |
|
5130 | - return strrpos($haystack,$needle,$offset); |
|
5131 | -} |
|
5132 | 5244 | \ No newline at end of file |
5245 | + if(function_exists('mb_strrpos')) { |
|
5246 | + return mb_strrpos($haystack,$needle,$offset,$encoding); |
|
5247 | + } else { |
|
5248 | + return strrpos($haystack,$needle,$offset); |
|
5249 | + } |
|
5250 | + } |
|
5133 | 5251 | \ No newline at end of file |
@@ -829,6 +829,7 @@ discard block |
||
829 | 829 | * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. |
830 | 830 | * All Rights Reserved. |
831 | 831 | * Contributor(s): ______________________________________.. |
832 | + * @param boolean $always_copy |
|
832 | 833 | */ |
833 | 834 | function safe_map_named($request_var, & $focus, $member_var, $always_copy) |
834 | 835 | { |
@@ -1248,6 +1249,7 @@ discard block |
||
1248 | 1249 | * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. |
1249 | 1250 | * All Rights Reserved. |
1250 | 1251 | * Contributor(s): ______________________________________.. |
1252 | + * @param string $varname |
|
1251 | 1253 | */ |
1252 | 1254 | function return_session_value_or_default($varname, $default) |
1253 | 1255 | { |
@@ -1358,6 +1360,9 @@ discard block |
||
1358 | 1360 | |
1359 | 1361 | } |
1360 | 1362 | |
1363 | +/** |
|
1364 | + * @param integer $characters |
|
1365 | + */ |
|
1361 | 1366 | function create_guid_section($characters) |
1362 | 1367 | { |
1363 | 1368 | $return = ""; |
@@ -1368,6 +1373,10 @@ discard block |
||
1368 | 1373 | return $return; |
1369 | 1374 | } |
1370 | 1375 | |
1376 | +/** |
|
1377 | + * @param string $string |
|
1378 | + * @param integer $length |
|
1379 | + */ |
|
1371 | 1380 | function ensure_length(&$string, $length) |
1372 | 1381 | { |
1373 | 1382 | $strlen = strlen($string); |
@@ -1475,6 +1484,9 @@ discard block |
||
1475 | 1484 | |
1476 | 1485 | |
1477 | 1486 | // Check if user is admin for a specific module. |
1487 | +/** |
|
1488 | + * @param string $module |
|
1489 | + */ |
|
1478 | 1490 | function is_admin_for_module($user,$module) { |
1479 | 1491 | if (!isset($user)) { |
1480 | 1492 | return false; |
@@ -1535,6 +1547,7 @@ discard block |
||
1535 | 1547 | * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. |
1536 | 1548 | * All Rights Reserved. |
1537 | 1549 | * Contributor(s): ______________________________________.. |
1550 | + * @param string $selected |
|
1538 | 1551 | */ |
1539 | 1552 | function get_select_options ($option_list, $selected) { |
1540 | 1553 | return get_select_options_with_id($option_list, $selected); |
@@ -1822,7 +1835,7 @@ discard block |
||
1822 | 1835 | |
1823 | 1836 | /** |
1824 | 1837 | * returns a default array of XSS tags to clean |
1825 | - * @return array |
|
1838 | + * @return string |
|
1826 | 1839 | */ |
1827 | 1840 | function getDefaultXssTags() { |
1828 | 1841 | $tmp = array( |
@@ -1849,6 +1862,7 @@ discard block |
||
1849 | 1862 | /** |
1850 | 1863 | * Remove potential xss vectors from strings |
1851 | 1864 | * @param string str String to search for XSS attack vectors |
1865 | + * @param string $str |
|
1852 | 1866 | * @deprecated |
1853 | 1867 | * @return string |
1854 | 1868 | */ |
@@ -1862,6 +1876,7 @@ discard block |
||
1862 | 1876 | * @deprecated |
1863 | 1877 | * @param string str String to search for XSS attack vectors |
1864 | 1878 | * @param bool cleanImg Flag to allow <img> tags to survive - only used by InboundEmail for inline images. |
1879 | + * @param string $str |
|
1865 | 1880 | * @return array Array of matches, empty on clean string |
1866 | 1881 | */ |
1867 | 1882 | function clean_xss($str, $cleanImg=true) { |
@@ -1938,6 +1953,7 @@ discard block |
||
1938 | 1953 | * Helper function used by clean_xss() to parse for known-bad vectors |
1939 | 1954 | * @param string pattern Regex pattern to use |
1940 | 1955 | * @param string str String to parse for badness |
1956 | + * @param string $pattern |
|
1941 | 1957 | * @return array |
1942 | 1958 | */ |
1943 | 1959 | function xss_check_pattern($pattern, $str) { |
@@ -2022,6 +2038,7 @@ discard block |
||
2022 | 2038 | |
2023 | 2039 | /** |
2024 | 2040 | * cleans the given key in superglobals $_GET, $_POST, $_REQUEST |
2041 | + * @param string $key |
|
2025 | 2042 | */ |
2026 | 2043 | function clean_superglobals($key, $filter = 'STANDARD') { |
2027 | 2044 | if(isset($_GET[$key])) clean_string($_GET[$key], $filter); |
@@ -2029,6 +2046,9 @@ discard block |
||
2029 | 2046 | if(isset($_REQUEST[$key])) clean_string($_REQUEST[$key], $filter); |
2030 | 2047 | } |
2031 | 2048 | |
2049 | +/** |
|
2050 | + * @param string $key |
|
2051 | + */ |
|
2032 | 2052 | function set_superglobals($key, $val){ |
2033 | 2053 | $_GET[$key] = $val; |
2034 | 2054 | $_POST[$key] = $val; |
@@ -2108,11 +2128,18 @@ discard block |
||
2108 | 2128 | } |
2109 | 2129 | |
2110 | 2130 | // Returns TRUE if $str begins with $begin |
2131 | +/** |
|
2132 | + * @param string $begin |
|
2133 | + */ |
|
2111 | 2134 | function str_begin($str, $begin) { |
2112 | 2135 | return (substr($str, 0, strlen($begin)) == $begin); |
2113 | 2136 | } |
2114 | 2137 | |
2115 | 2138 | // Returns TRUE if $str ends with $end |
2139 | +/** |
|
2140 | + * @param string $str |
|
2141 | + * @param string $end |
|
2142 | + */ |
|
2116 | 2143 | function str_end($str, $end) { |
2117 | 2144 | return (substr($str, strlen($str) - strlen($end)) == $end); |
2118 | 2145 | } |
@@ -2170,14 +2197,24 @@ discard block |
||
2170 | 2197 | } |
2171 | 2198 | |
2172 | 2199 | |
2200 | +/** |
|
2201 | + * @param string $category |
|
2202 | + */ |
|
2173 | 2203 | function set_register_value($category, $name, $value){ |
2174 | 2204 | return sugar_cache_put("{$category}:{$name}", $value); |
2175 | 2205 | } |
2176 | 2206 | |
2207 | +/** |
|
2208 | + * @param string $category |
|
2209 | + */ |
|
2177 | 2210 | function get_register_value($category,$name){ |
2178 | 2211 | return sugar_cache_retrieve("{$category}:{$name}"); |
2179 | 2212 | } |
2180 | 2213 | |
2214 | +/** |
|
2215 | + * @param string $category |
|
2216 | + * @param string $name |
|
2217 | + */ |
|
2181 | 2218 | function clear_register_value($category,$name){ |
2182 | 2219 | return sugar_cache_clear("{$category}:{$name}"); |
2183 | 2220 | } |
@@ -2379,6 +2416,11 @@ discard block |
||
2379 | 2416 | return $new_array; |
2380 | 2417 | } |
2381 | 2418 | |
2419 | +/** |
|
2420 | + * @param DBManager $db |
|
2421 | + * @param string $from_column |
|
2422 | + * @param string $to_id |
|
2423 | + */ |
|
2382 | 2424 | function clone_relationship(&$db, $tables = array(), $from_column, $from_id, $to_id) |
2383 | 2425 | { |
2384 | 2426 | foreach($tables as $table) |
@@ -2556,6 +2598,10 @@ discard block |
||
2556 | 2598 | return empty($value) && $value != '0'; |
2557 | 2599 | } |
2558 | 2600 | |
2601 | +/** |
|
2602 | + * @param string $bean_name |
|
2603 | + * @param string $display_columns |
|
2604 | + */ |
|
2559 | 2605 | function get_bean_select_array($add_blank=true, $bean_name, $display_columns, $where='', $order_by='', $blank_is_none=false) |
2560 | 2606 | { |
2561 | 2607 | global $beanFiles; |
@@ -2746,6 +2792,11 @@ discard block |
||
2746 | 2792 | //end function js_escape |
2747 | 2793 | } |
2748 | 2794 | |
2795 | +/** |
|
2796 | + * @param string $str |
|
2797 | + * |
|
2798 | + * @return string |
|
2799 | + */ |
|
2749 | 2800 | function br2nl($str) { |
2750 | 2801 | $regex = "#<[^>]+br.+?>#i"; |
2751 | 2802 | preg_match_all($regex, $str, $matches); |
@@ -3265,6 +3316,9 @@ discard block |
||
3265 | 3316 | |
3266 | 3317 | set_error_handler('StackTraceErrorHandler'); |
3267 | 3318 | } |
3319 | +/** |
|
3320 | + * @param string $name |
|
3321 | + */ |
|
3268 | 3322 | function get_sub_cookies($name){ |
3269 | 3323 | $cookies = array(); |
3270 | 3324 | if(isset($_COOKIE[$name])){ |
@@ -3306,6 +3360,7 @@ discard block |
||
3306 | 3360 | |
3307 | 3361 | /** |
3308 | 3362 | * For translating the php.ini memory values into bytes. e.g. input value of '8M' will return 8388608. |
3363 | + * @param string $val |
|
3309 | 3364 | */ |
3310 | 3365 | function return_bytes($val) |
3311 | 3366 | { |
@@ -3413,6 +3468,9 @@ discard block |
||
3413 | 3468 | * Given the bean_name which may be plural or singular return the singular |
3414 | 3469 | * bean_name. This is important when you need to include files. |
3415 | 3470 | */ |
3471 | +/** |
|
3472 | + * @return string |
|
3473 | + */ |
|
3416 | 3474 | function get_singular_bean_name($bean_name){ |
3417 | 3475 | global $beanFiles, $beanList; |
3418 | 3476 | if(array_key_exists($bean_name, $beanList)){ |
@@ -3457,6 +3515,9 @@ discard block |
||
3457 | 3515 | return $singular; |
3458 | 3516 | } |
3459 | 3517 | |
3518 | +/** |
|
3519 | + * @return string |
|
3520 | + */ |
|
3460 | 3521 | function get_label($label_tag, $temp_module_strings){ |
3461 | 3522 | global $app_strings; |
3462 | 3523 | if(!empty($temp_module_strings[$label_tag])){ |
@@ -3562,7 +3623,7 @@ discard block |
||
3562 | 3623 | /** |
3563 | 3624 | * In order to have one place to obtain the proper object name. aCase for example causes issues throughout the application. |
3564 | 3625 | * |
3565 | - * @param string $moduleName |
|
3626 | + * @param string $module_name |
|
3566 | 3627 | */ |
3567 | 3628 | function get_valid_bean_name($module_name){ |
3568 | 3629 | global $beanList; |
@@ -4139,6 +4200,9 @@ discard block |
||
4139 | 4200 | * @return string Relative pathname of the located icon, or '' if not found |
4140 | 4201 | */ |
4141 | 4202 | |
4203 | +/** |
|
4204 | + * @param string $iconFileName |
|
4205 | + */ |
|
4142 | 4206 | function _getIcon($iconFileName) |
4143 | 4207 | { |
4144 | 4208 | |
@@ -4163,7 +4227,7 @@ discard block |
||
4163 | 4227 | /** |
4164 | 4228 | * Function to grab the correct icon image for Studio |
4165 | 4229 | * @param string $iconFileName Name of the icon file |
4166 | - * @param string $altfilename Name of a fallback icon file (displayed if the imagefilename doesn't exist) |
|
4230 | + * @param string $altFileName Name of a fallback icon file (displayed if the imagefilename doesn't exist) |
|
4167 | 4231 | * @param string $width Width of image |
4168 | 4232 | * @param string $height Height of image |
4169 | 4233 | * @param string $align Alignment of image |
@@ -4188,7 +4252,6 @@ discard block |
||
4188 | 4252 | |
4189 | 4253 | /** |
4190 | 4254 | * Function to grab the correct icon image for Dashlets Dialog |
4191 | - * @param string $filename Location of the icon file |
|
4192 | 4255 | * @param string $module Name of the module to fall back onto if file does not exist |
4193 | 4256 | * @param string $width Width of image |
4194 | 4257 | * @param string $height Height of image |
@@ -4601,7 +4664,7 @@ discard block |
||
4601 | 4664 | * 5.5.1RC1 then return 5.5.1 |
4602 | 4665 | * |
4603 | 4666 | * @param string $version |
4604 | - * @return version |
|
4667 | + * @return string |
|
4605 | 4668 | */ |
4606 | 4669 | function getMajorMinorVersion($version){ |
4607 | 4670 | if(preg_match('/^([\d\.]+).*$/si', $version, $matches2)){ |
@@ -4751,6 +4814,9 @@ discard block |
||
4751 | 4814 | } |
4752 | 4815 | } |
4753 | 4816 | |
4817 | +/** |
|
4818 | + * @param string $field_name |
|
4819 | + */ |
|
4754 | 4820 | function order_beans($beans, $field_name) |
4755 | 4821 | { |
4756 | 4822 | //Since php 5.2 doesn't include closures, we must use a global to pass the order field to cmp_beans. |
@@ -4885,7 +4951,7 @@ discard block |
||
4885 | 4951 | * otherwise it return $file |
4886 | 4952 | * |
4887 | 4953 | * @param $file String of filename to check |
4888 | - * @return $file String of filename including custom directory if found |
|
4954 | + * @return string String of filename including custom directory if found |
|
4889 | 4955 | */ |
4890 | 4956 | function get_custom_file_if_exists($file) |
4891 | 4957 | { |
@@ -5037,7 +5103,7 @@ discard block |
||
5037 | 5103 | /** |
5038 | 5104 | * Gets the list of "*type_display*". |
5039 | 5105 | * |
5040 | - * @return array |
|
5106 | + * @return string[] |
|
5041 | 5107 | */ |
5042 | 5108 | function getTypeDisplayList() |
5043 | 5109 | { |
@@ -1,5 +1,7 @@ discard block |
||
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. |
@@ -128,8 +130,9 @@ discard block |
||
128 | 130 | foreach($this->displayColumns as $name => $params) { |
129 | 131 | $this->displayColumns[$name]['width'] = round($this->displayColumns[$name]['width'] / $adjustment, 2); |
130 | 132 | // figure out which contextMenu objectsTypes are required |
131 | - if(!empty($params['contextMenu']['objectType'])) |
|
132 | - $contextMenuObjectsTypes[$params['contextMenu']['objectType']] = true; |
|
133 | + if(!empty($params['contextMenu']['objectType'])) { |
|
134 | + $contextMenuObjectsTypes[$params['contextMenu']['objectType']] = true; |
|
135 | + } |
|
133 | 136 | } |
134 | 137 | $this->th->ss->assign('displayColumns', $this->displayColumns); |
135 | 138 | |
@@ -147,10 +150,17 @@ discard block |
||
147 | 150 | $this->th->ss->assign('searchForm', $this->searchForm->display(false)); |
148 | 151 | //rrs |
149 | 152 | |
150 | - if($this->export) $this->th->ss->assign('exportLink', $this->buildExportLink()); |
|
153 | + if($this->export) { |
|
154 | + $this->th->ss->assign('exportLink', $this->buildExportLink()); |
|
155 | + } |
|
151 | 156 | $this->th->ss->assign('quickViewLinks', $this->quickViewLinks); |
152 | - if($this->mailMerge) $this->th->ss->assign('mergeLink', $this->buildMergeLink()); // still check for mailmerge access |
|
153 | - if($this->mergeduplicates) $this->th->ss->assign('mergedupLink', $this->buildMergeDuplicatesLink()); |
|
157 | + if($this->mailMerge) { |
|
158 | + $this->th->ss->assign('mergeLink', $this->buildMergeLink()); |
|
159 | + } |
|
160 | + // still check for mailmerge access |
|
161 | + if($this->mergeduplicates) { |
|
162 | + $this->th->ss->assign('mergedupLink', $this->buildMergeDuplicatesLink()); |
|
163 | + } |
|
154 | 164 | |
155 | 165 | |
156 | 166 | if (!empty($_REQUEST['mode']) && strtoupper($_REQUEST['mode']) == 'MULTISELECT') { |
@@ -301,7 +311,7 @@ discard block |
||
301 | 311 | |
302 | 312 | if(file_exists('custom/modules/'.$this->module.'/metadata/metafiles.php')){ |
303 | 313 | require('custom/modules/'.$this->module.'/metadata/metafiles.php'); |
304 | - }elseif(file_exists('modules/'.$this->module.'/metadata/metafiles.php')){ |
|
314 | + } elseif(file_exists('modules/'.$this->module.'/metadata/metafiles.php')){ |
|
305 | 315 | require('modules/'.$this->module.'/metadata/metafiles.php'); |
306 | 316 | } |
307 | 317 | |
@@ -321,21 +331,24 @@ discard block |
||
321 | 331 | $displayColumns = array(); |
322 | 332 | if(!empty($_REQUEST['displayColumns'])) { |
323 | 333 | foreach(explode('|', $_REQUEST['displayColumns']) as $num => $col) { |
324 | - if(!empty($listViewDefs[$this->module][$col])) |
|
325 | - $displayColumns[$col] = $this->listviewdefs[$this->module][$col]; |
|
334 | + if(!empty($listViewDefs[$this->module][$col])) { |
|
335 | + $displayColumns[$col] = $this->listviewdefs[$this->module][$col]; |
|
336 | + } |
|
326 | 337 | } |
327 | - } |
|
328 | - else { |
|
338 | + } else { |
|
329 | 339 | foreach($this->listviewdefs[$this->module] as $col => $para) { |
330 | - if(!empty($para['default']) && $para['default']) |
|
331 | - $displayColumns[$col] = $para; |
|
340 | + if(!empty($para['default']) && $para['default']) { |
|
341 | + $displayColumns[$col] = $para; |
|
342 | + } |
|
332 | 343 | } |
333 | 344 | } |
334 | 345 | $params['massupdate'] = true; |
335 | 346 | if(!empty($_REQUEST['orderBy'])) { |
336 | 347 | $params['orderBy'] = $_REQUEST['orderBy']; |
337 | 348 | $params['overrideOrder'] = true; |
338 | - if(!empty($_REQUEST['sortOrder'])) $params['sortOrder'] = $_REQUEST['sortOrder']; |
|
349 | + if(!empty($_REQUEST['sortOrder'])) { |
|
350 | + $params['sortOrder'] = $_REQUEST['sortOrder']; |
|
351 | + } |
|
339 | 352 | } |
340 | 353 | |
341 | 354 | $lv->displayColumns = $displayColumns; |
@@ -453,7 +466,9 @@ discard block |
||
453 | 466 | |
454 | 467 | // Need to include the default whereStatement |
455 | 468 | if(!empty($this->_popupMeta['whereStatement'])){ |
456 | - if(!empty($where))$where .= ' AND '; |
|
469 | + if(!empty($where)) { |
|
470 | + $where .= ' AND '; |
|
471 | + } |
|
457 | 472 | $where .= $this->_popupMeta['whereStatement']; |
458 | 473 | } |
459 | 474 | |
@@ -472,11 +487,13 @@ discard block |
||
472 | 487 | $this->formData[] = array('field' => $data); |
473 | 488 | $value = ''; |
474 | 489 | $this->customFieldDefs[$data['name']]= $data; |
475 | - if(!empty($_REQUEST[$data['name']])) |
|
476 | - $value = $_REQUEST[$data['name']]; |
|
490 | + if(!empty($_REQUEST[$data['name']])) { |
|
491 | + $value = $_REQUEST[$data['name']]; |
|
492 | + } |
|
477 | 493 | $this->customFieldDefs[$data['name']]['value'] = $value; |
478 | - }else |
|
479 | - $this->formData[] = array('field' => array('name'=>$data)); |
|
494 | + } else { |
|
495 | + $this->formData[] = array('field' => array('name'=>$data)); |
|
496 | + } |
|
480 | 497 | } |
481 | 498 | $this->fieldDefs = array(); |
482 | 499 | if($this->seed){ |
@@ -487,13 +504,15 @@ discard block |
||
487 | 504 | //if we have a relate type then reset to name so that we end up with a textbox |
488 | 505 | //rather than a select button |
489 | 506 | $this->fieldDefs[$name]['name'] = $this->fieldDefs[$name]['name']; |
490 | - if($this->fieldDefs[$name]['type'] == 'relate') |
|
491 | - $this->fieldDefs[$name]['type'] = 'name'; |
|
507 | + if($this->fieldDefs[$name]['type'] == 'relate') { |
|
508 | + $this->fieldDefs[$name]['type'] = 'name'; |
|
509 | + } |
|
492 | 510 | if(isset($this->fieldDefs[$name]['options']) && isset($GLOBALS['app_list_strings'][$this->fieldDefs[$name]['options']])) { |
493 | 511 | $this->fieldDefs[$name]['options'] = $GLOBALS['app_list_strings'][$this->fieldDefs[$name]['options']]; // fill in enums |
494 | 512 | } |
495 | - if(!empty($_REQUEST[$name])) |
|
496 | - $value = $_REQUEST[$name]; |
|
513 | + if(!empty($_REQUEST[$name])) { |
|
514 | + $value = $_REQUEST[$name]; |
|
515 | + } |
|
497 | 516 | $this->fieldDefs[$name]['value'] = $value; |
498 | 517 | } |
499 | 518 | } |
@@ -540,8 +559,9 @@ discard block |
||
540 | 559 | EOQ; |
541 | 560 | // if metadata contains custom inputs for the quickcreate |
542 | 561 | if(!empty($this->_popupMeta['customInput']) && is_array($this->_popupMeta['customInput'])) { |
543 | - foreach($this->_popupMeta['customInput'] as $key => $value) |
|
544 | - $formSave .= '<input type="hidden" name="' . $key . '" value="'. $value .'">\n'; |
|
562 | + foreach($this->_popupMeta['customInput'] as $key => $value) { |
|
563 | + $formSave .= '<input type="hidden" name="' . $key . '" value="'. $value .'">\n'; |
|
564 | + } |
|
545 | 565 | } |
546 | 566 | |
547 | 567 |
@@ -70,6 +70,9 @@ discard block |
||
70 | 70 | var $module; |
71 | 71 | var $massUpdateData = ''; |
72 | 72 | |
73 | + /** |
|
74 | + * @param string $module |
|
75 | + */ |
|
73 | 76 | function PopupSmarty($seed, $module){ |
74 | 77 | parent::ListViewSmarty(); |
75 | 78 | $this->th = new TemplateHandler(); |
@@ -108,6 +111,7 @@ discard block |
||
108 | 111 | * @param file file Template file to use |
109 | 112 | * @param data array from ListViewData |
110 | 113 | * @param html_var string the corresponding html var in xtpl per row |
114 | + * @param string $htmlVar |
|
111 | 115 | * |
112 | 116 | */ |
113 | 117 | function process($file, $data, $htmlVar) { |