@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | require_once 'include/clean.php'; |
42 | 42 | class SugarFieldText extends SugarFieldBase { |
43 | 43 | |
44 | - function getDetailViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) { |
|
44 | + function getDetailViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) { |
|
45 | 45 | if(!isset($displayParams['nl2br'])){ |
46 | 46 | $displayParams['nl2br'] = true; |
47 | 47 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | if(!isset($displayParams['url2html'])) { |
52 | 52 | $displayParams['url2html'] = true; |
53 | 53 | } |
54 | - return parent::getDetailViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex); |
|
54 | + return parent::getDetailViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex); |
|
55 | 55 | } |
56 | 56 | function getClassicEditView($field_id='description', $value='', $prefix='', $rich_text=false, $maxlength='', $tabindex=1, $cols=80, $rows=4) { |
57 | 57 | |
@@ -68,19 +68,19 @@ discard block |
||
68 | 68 | |
69 | 69 | |
70 | 70 | $this->ss->assign('displayParams', $displayParams); |
71 | - if(isset($GLOBALS['current_user'])) { |
|
72 | - $height = $GLOBALS['current_user']->getPreference('text_editor_height'); |
|
73 | - $width = $GLOBALS['current_user']->getPreference('text_editor_width'); |
|
74 | - $height = isset($height) ? $height : '300px'; |
|
75 | - $width = isset($width) ? $width : '95%'; |
|
76 | - $this->ss->assign('RICH_TEXT_EDITOR_HEIGHT', $height); |
|
77 | - $this->ss->assign('RICH_TEXT_EDITOR_WIDTH', $width); |
|
78 | - } else { |
|
79 | - $this->ss->assign('RICH_TEXT_EDITOR_HEIGHT', '100px'); |
|
80 | - $this->ss->assign('RICH_TEXT_EDITOR_WIDTH', '95%'); |
|
81 | - } |
|
71 | + if(isset($GLOBALS['current_user'])) { |
|
72 | + $height = $GLOBALS['current_user']->getPreference('text_editor_height'); |
|
73 | + $width = $GLOBALS['current_user']->getPreference('text_editor_width'); |
|
74 | + $height = isset($height) ? $height : '300px'; |
|
75 | + $width = isset($width) ? $width : '95%'; |
|
76 | + $this->ss->assign('RICH_TEXT_EDITOR_HEIGHT', $height); |
|
77 | + $this->ss->assign('RICH_TEXT_EDITOR_WIDTH', $width); |
|
78 | + } else { |
|
79 | + $this->ss->assign('RICH_TEXT_EDITOR_HEIGHT', '100px'); |
|
80 | + $this->ss->assign('RICH_TEXT_EDITOR_WIDTH', '95%'); |
|
81 | + } |
|
82 | 82 | |
83 | - return $this->ss->fetch($this->findTemplate('ClassicEditView')); |
|
83 | + return $this->ss->fetch($this->findTemplate('ClassicEditView')); |
|
84 | 84 | } |
85 | 85 | } |
86 | 86 | ?> |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | var $object_name = 'EmailAddress'; |
57 | 57 | |
58 | 58 | //bug 40068, According to rules in page 6 of http://www.apps.ietf.org/rfc/rfc3696.html#sec-3, |
59 | - //allowed special characters ! # $ % & ' * + - / = ? ^ _ ` . { | } ~ in local part |
|
59 | + //allowed special characters ! # $ % & ' * + - / = ? ^ _ ` . { | } ~ in local part |
|
60 | 60 | var $regex = "/^(?:['\.\-\+&#!\$\*=\?\^_`\{\}~\/\w]+)@(?:(?:\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})|\w+(?:[\.-]*\w+)*(?:\.[\w-]{2,})+)\$/"; |
61 | 61 | var $disable_custom_fields = true; |
62 | 62 | var $db; |
@@ -391,8 +391,8 @@ discard block |
||
391 | 391 | // determine which array to process |
392 | 392 | foreach($_REQUEST as $k => $v) { |
393 | 393 | if(strpos($k, 'emailAddress') !== false) { |
394 | - $fromRequest = true; |
|
395 | - break; |
|
394 | + $fromRequest = true; |
|
395 | + break; |
|
396 | 396 | } |
397 | 397 | $widget_id = $_REQUEST[$module .'_email_widget_id']; |
398 | 398 | } |
@@ -409,30 +409,30 @@ discard block |
||
409 | 409 | |
410 | 410 | $eId = $module . $widget_id; |
411 | 411 | if(isset($_REQUEST[$eId . 'emailAddressPrimaryFlag'])) { |
412 | - $primaryValue = $_REQUEST[$eId . 'emailAddressPrimaryFlag']; |
|
412 | + $primaryValue = $_REQUEST[$eId . 'emailAddressPrimaryFlag']; |
|
413 | 413 | } else if(isset($_REQUEST[$module . 'emailAddressPrimaryFlag'])) { |
414 | - $primaryValue = $_REQUEST[$module . 'emailAddressPrimaryFlag']; |
|
414 | + $primaryValue = $_REQUEST[$module . 'emailAddressPrimaryFlag']; |
|
415 | 415 | } |
416 | 416 | |
417 | 417 | $optOutValues = array(); |
418 | 418 | if(isset($_REQUEST[$eId .'emailAddressOptOutFlag'])) { |
419 | - $optOutValues = $_REQUEST[$eId .'emailAddressOptOutFlag']; |
|
419 | + $optOutValues = $_REQUEST[$eId .'emailAddressOptOutFlag']; |
|
420 | 420 | } else if(isset($_REQUEST[$module . 'emailAddressOptOutFlag'])) { |
421 | - $optOutValues = $_REQUEST[$module . 'emailAddressOptOutFlag']; |
|
421 | + $optOutValues = $_REQUEST[$module . 'emailAddressOptOutFlag']; |
|
422 | 422 | } |
423 | 423 | |
424 | 424 | $invalidValues = array(); |
425 | 425 | if(isset($_REQUEST[$eId .'emailAddressInvalidFlag'])) { |
426 | - $invalidValues = $_REQUEST[$eId .'emailAddressInvalidFlag']; |
|
426 | + $invalidValues = $_REQUEST[$eId .'emailAddressInvalidFlag']; |
|
427 | 427 | } else if(isset($_REQUEST[$module . 'emailAddressInvalidFlag'])) { |
428 | - $invalidValues = $_REQUEST[$module . 'emailAddressInvalidFlag']; |
|
428 | + $invalidValues = $_REQUEST[$module . 'emailAddressInvalidFlag']; |
|
429 | 429 | } |
430 | 430 | |
431 | 431 | $deleteValues = array(); |
432 | 432 | if(isset($_REQUEST[$eId .'emailAddressDeleteFlag'])) { |
433 | - $deleteValues = $_REQUEST[$eId .'emailAddressDeleteFlag']; |
|
433 | + $deleteValues = $_REQUEST[$eId .'emailAddressDeleteFlag']; |
|
434 | 434 | } else if(isset($_REQUEST[$module . 'emailAddressDeleteFlag'])) { |
435 | - $deleteValues = $_REQUEST[$module . 'emailAddressDeleteFlag']; |
|
435 | + $deleteValues = $_REQUEST[$module . 'emailAddressDeleteFlag']; |
|
436 | 436 | } |
437 | 437 | |
438 | 438 | // prep from form save |
@@ -446,9 +446,9 @@ discard block |
||
446 | 446 | |
447 | 447 | if($fromRequest && empty($replyTo)) { |
448 | 448 | if(isset($_REQUEST[$eId .'emailAddressReplyToFlag'])) { |
449 | - $replyToField = $_REQUEST[$eId .'emailAddressReplyToFlag']; |
|
449 | + $replyToField = $_REQUEST[$eId .'emailAddressReplyToFlag']; |
|
450 | 450 | } else if(isset($_REQUEST[$module . 'emailAddressReplyToFlag'])) { |
451 | - $replyToField = $_REQUEST[$module . 'emailAddressReplyToFlag']; |
|
451 | + $replyToField = $_REQUEST[$module . 'emailAddressReplyToFlag']; |
|
452 | 452 | } |
453 | 453 | } |
454 | 454 | if($fromRequest && empty($new_addrs)) { |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | if(preg_match('/'.$eId.'emailAddressVerifiedValue[0-9]+$/i', $k) && !empty($v)) { |
473 | 473 | $validateFlag = str_replace("Value", "Flag", $k); |
474 | 474 | if (isset($_REQUEST[$validateFlag]) && $_REQUEST[$validateFlag] == "true") |
475 | - $new_addrs[$k] = $v; |
|
475 | + $new_addrs[$k] = $v; |
|
476 | 476 | } |
477 | 477 | } |
478 | 478 | } |
@@ -484,18 +484,18 @@ discard block |
||
484 | 484 | $optOutValues = array(); |
485 | 485 | $invalidValues = array(); |
486 | 486 | foreach($new_addrs as $k=>$email) { |
487 | - preg_match('/emailAddress([0-9])+$/', $k, $matches); |
|
488 | - $count = $matches[1]; |
|
489 | - $result = $this->db->query("SELECT opt_out, invalid_email from email_addresses where email_address_caps = '" . $this->db->quote(strtoupper($email)) . "'"); |
|
490 | - if(!empty($result)) { |
|
491 | - $row=$this->db->fetchByAssoc($result); |
|
492 | - if(!empty($row['opt_out'])) { |
|
493 | - $optOutValues[$k] = "emailAddress$count"; |
|
494 | - } |
|
495 | - if(!empty($row['invalid_email'])) { |
|
496 | - $invalidValues[$k] = "emailAddress$count"; |
|
497 | - } |
|
498 | - } |
|
487 | + preg_match('/emailAddress([0-9])+$/', $k, $matches); |
|
488 | + $count = $matches[1]; |
|
489 | + $result = $this->db->query("SELECT opt_out, invalid_email from email_addresses where email_address_caps = '" . $this->db->quote(strtoupper($email)) . "'"); |
|
490 | + if(!empty($result)) { |
|
491 | + $row=$this->db->fetchByAssoc($result); |
|
492 | + if(!empty($row['opt_out'])) { |
|
493 | + $optOutValues[$k] = "emailAddress$count"; |
|
494 | + } |
|
495 | + if(!empty($row['invalid_email'])) { |
|
496 | + $invalidValues[$k] = "emailAddress$count"; |
|
497 | + } |
|
498 | + } |
|
499 | 499 | } |
500 | 500 | } |
501 | 501 | // Re-populate the addresses class variable if we have new address(es). |
@@ -522,7 +522,7 @@ discard block |
||
522 | 522 | |
523 | 523 | //If no widgets, set addresses array to empty |
524 | 524 | if($post_from_email_address_widget && !$hasEmailValue) { |
525 | - $this->addresses = array(); |
|
525 | + $this->addresses = array(); |
|
526 | 526 | } |
527 | 527 | } |
528 | 528 | |
@@ -861,14 +861,14 @@ discard block |
||
861 | 861 | $count = 0; |
862 | 862 | $key = $module . $widget_id . 'emailAddress'.$count; |
863 | 863 | while(isset($_REQUEST[$key])) { |
864 | - $email = $_REQUEST[$key]; |
|
865 | - $prefillDataArr[] = array('email_address'=>$email, |
|
866 | - 'primary_address'=>isset($_REQUEST['emailAddressPrimaryFlag']) && $_REQUEST['emailAddressPrimaryFlag'] == $key, |
|
867 | - 'invalid_email'=>isset($_REQUEST['emailAddressInvalidFlag']) && in_array($key, $_REQUEST['emailAddressInvalidFlag']), |
|
868 | - 'opt_out'=>isset($_REQUEST['emailAddressOptOutFlag']) && in_array($key, $_REQUEST['emailAddressOptOutFlag']), |
|
869 | - 'reply_to_address'=>false |
|
864 | + $email = $_REQUEST[$key]; |
|
865 | + $prefillDataArr[] = array('email_address'=>$email, |
|
866 | + 'primary_address'=>isset($_REQUEST['emailAddressPrimaryFlag']) && $_REQUEST['emailAddressPrimaryFlag'] == $key, |
|
867 | + 'invalid_email'=>isset($_REQUEST['emailAddressInvalidFlag']) && in_array($key, $_REQUEST['emailAddressInvalidFlag']), |
|
868 | + 'opt_out'=>isset($_REQUEST['emailAddressOptOutFlag']) && in_array($key, $_REQUEST['emailAddressOptOutFlag']), |
|
869 | + 'reply_to_address'=>false |
|
870 | 870 | ); |
871 | - $key = $module . $widget_id . 'emailAddress' . ++$count; |
|
871 | + $key = $module . $widget_id . 'emailAddress' . ++$count; |
|
872 | 872 | } //while |
873 | 873 | } |
874 | 874 | |
@@ -985,7 +985,7 @@ discard block |
||
985 | 985 | $this->smarty->assign('emailAddressWidget',$_POST['emailAddressWidget']); |
986 | 986 | |
987 | 987 | if(isset($_POST[$mod . $widget_id . 'emailAddressPrimaryFlag'])) { |
988 | - $primary = $_POST[$mod . $widget_id . 'emailAddressPrimaryFlag']; |
|
988 | + $primary = $_POST[$mod . $widget_id . 'emailAddressPrimaryFlag']; |
|
989 | 989 | } |
990 | 990 | |
991 | 991 | while(isset($_POST[$mod . $widget_id . "emailAddress" . $count])) { |
@@ -994,31 +994,31 @@ discard block |
||
994 | 994 | } |
995 | 995 | |
996 | 996 | if($count == 0) { |
997 | - return ""; |
|
997 | + return ""; |
|
998 | 998 | } |
999 | 999 | |
1000 | 1000 | if(isset($_POST[$mod . $widget_id . 'emailAddressOptOutFlag'])) { |
1001 | - foreach($_POST[$mod . $widget_id . 'emailAddressOptOutFlag'] as $v) { |
|
1002 | - $optOut[] = $v; |
|
1003 | - } |
|
1001 | + foreach($_POST[$mod . $widget_id . 'emailAddressOptOutFlag'] as $v) { |
|
1002 | + $optOut[] = $v; |
|
1003 | + } |
|
1004 | 1004 | } |
1005 | 1005 | |
1006 | 1006 | if(isset($_POST[$mod . $widget_id . 'emailAddressInvalidFlag'])) { |
1007 | - foreach($_POST[$mod . $widget_id . 'emailAddressInvalidFlag'] as $v) { |
|
1008 | - $invalid[] = $v; |
|
1009 | - } |
|
1007 | + foreach($_POST[$mod . $widget_id . 'emailAddressInvalidFlag'] as $v) { |
|
1008 | + $invalid[] = $v; |
|
1009 | + } |
|
1010 | 1010 | } |
1011 | 1011 | |
1012 | 1012 | if(isset($_POST[$mod . $widget_id . 'emailAddressReplyToFlag'])) { |
1013 | - foreach($_POST[$mod . $widget_id . 'emailAddressReplyToFlag'] as $v) { |
|
1014 | - $replyTo[] = $v; |
|
1015 | - } |
|
1013 | + foreach($_POST[$mod . $widget_id . 'emailAddressReplyToFlag'] as $v) { |
|
1014 | + $replyTo[] = $v; |
|
1015 | + } |
|
1016 | 1016 | } |
1017 | 1017 | |
1018 | 1018 | if(isset($_POST[$mod . $widget_id . 'emailAddressDeleteFlag'])) { |
1019 | - foreach($_POST[$mod . $widget_id . 'emailAddressDeleteFlag'] as $v) { |
|
1020 | - $delete[] = $v; |
|
1021 | - } |
|
1019 | + foreach($_POST[$mod . $widget_id . 'emailAddressDeleteFlag'] as $v) { |
|
1020 | + $delete[] = $v; |
|
1021 | + } |
|
1022 | 1022 | } |
1023 | 1023 | |
1024 | 1024 | while(isset($_POST[$mod . $widget_id . "emailAddressVerifiedValue" . $count])) { |
@@ -1052,13 +1052,13 @@ discard block |
||
1052 | 1052 | $get .= '&emailAddressWidget='.$_POST['emailAddressWidget']; |
1053 | 1053 | |
1054 | 1054 | while(isset($_REQUEST[$mod . $widget_id . 'emailAddress' . $count])) { |
1055 | - $get .= "&" . $mod . $widget_id . "emailAddress" . $count . "=" . urlencode($_REQUEST[$mod . $widget_id . 'emailAddress' . $count]); |
|
1056 | - $count++; |
|
1055 | + $get .= "&" . $mod . $widget_id . "emailAddress" . $count . "=" . urlencode($_REQUEST[$mod . $widget_id . 'emailAddress' . $count]); |
|
1056 | + $count++; |
|
1057 | 1057 | } //while |
1058 | 1058 | |
1059 | 1059 | while(isset($_REQUEST[$mod . $widget_id . 'emailAddressVerifiedValue' . $count])) { |
1060 | - $get .= "&" . $mod . $widget_id . "emailAddressVerifiedValue" . $count . "=" . urlencode($_REQUEST[$mod . $widget_id . 'emailAddressVerifiedValue' . $count]); |
|
1061 | - $count++; |
|
1060 | + $get .= "&" . $mod . $widget_id . "emailAddressVerifiedValue" . $count . "=" . urlencode($_REQUEST[$mod . $widget_id . 'emailAddressVerifiedValue' . $count]); |
|
1061 | + $count++; |
|
1062 | 1062 | } //while |
1063 | 1063 | |
1064 | 1064 | $options = array('emailAddressPrimaryFlag', 'emailAddressOptOutFlag', 'emailAddressInvalidFlag', 'emailAddressDeleteFlag', 'emailAddressReplyToFlag'); |
@@ -1067,14 +1067,14 @@ discard block |
||
1067 | 1067 | $count = 0; |
1068 | 1068 | $optionIdentifier = $mod.$widget_id.$option; |
1069 | 1069 | if(isset($_REQUEST[$optionIdentifier])) { |
1070 | - if(is_array($_REQUEST[$optionIdentifier])) { |
|
1071 | - foreach($_REQUEST[$optionIdentifier] as $optOut) { |
|
1072 | - $get .= "&" . $optionIdentifier . "[" . $count . "]=" . $optOut; |
|
1073 | - $count++; |
|
1074 | - } //foreach |
|
1075 | - } else { |
|
1076 | - $get .= "&" . $optionIdentifier . "=" . $_REQUEST[$optionIdentifier]; |
|
1077 | - } |
|
1070 | + if(is_array($_REQUEST[$optionIdentifier])) { |
|
1071 | + foreach($_REQUEST[$optionIdentifier] as $optOut) { |
|
1072 | + $get .= "&" . $optionIdentifier . "[" . $count . "]=" . $optOut; |
|
1073 | + $count++; |
|
1074 | + } //foreach |
|
1075 | + } else { |
|
1076 | + $get .= "&" . $optionIdentifier . "=" . $_REQUEST[$optionIdentifier]; |
|
1077 | + } |
|
1078 | 1078 | } //if |
1079 | 1079 | } //foreach |
1080 | 1080 | return $get; |
@@ -1082,7 +1082,7 @@ discard block |
||
1082 | 1082 | } |
1083 | 1083 | |
1084 | 1084 | function setView($view) { |
1085 | - $this->view = $view; |
|
1085 | + $this->view = $view; |
|
1086 | 1086 | } |
1087 | 1087 | |
1088 | 1088 | /** |
@@ -145,34 +145,34 @@ discard block |
||
145 | 145 | * @return array |
146 | 146 | */ |
147 | 147 | public function getAccessToken($url, |
148 | - Zend_Oauth_Token_Request $token = null, |
|
149 | - $httpMethod = null, |
|
150 | - Zend_Oauth_Http_AccessToken $request = null) |
|
148 | + Zend_Oauth_Token_Request $token = null, |
|
149 | + $httpMethod = null, |
|
150 | + Zend_Oauth_Http_AccessToken $request = null) |
|
151 | 151 | { |
152 | 152 | $this->setAccessTokenUrl($url); |
153 | 153 | $this->_last = $token = parent::getAccessToken($_REQUEST, $this->makeRequestToken()); |
154 | 154 | return array('oauth_token' => $token->getToken(), 'oauth_token_secret' => $token->getTokenSecret()); |
155 | 155 | } |
156 | 156 | |
157 | - /** |
|
158 | - * Fetch URL with OAuth |
|
159 | - * @param string $url |
|
160 | - * @param string $params Query params |
|
161 | - * @param string $method HTTP method |
|
162 | - * @param array $headers HTTP headers |
|
163 | - * @return string |
|
164 | - */ |
|
157 | + /** |
|
158 | + * Fetch URL with OAuth |
|
159 | + * @param string $url |
|
160 | + * @param string $params Query params |
|
161 | + * @param string $method HTTP method |
|
162 | + * @param array $headers HTTP headers |
|
163 | + * @return string |
|
164 | + */ |
|
165 | 165 | |
166 | 166 | public function fetch($url, $params = null, $method = 'GET', $headers = null) |
167 | 167 | { |
168 | 168 | $acc = $this->makeAccessToken(); |
169 | 169 | if ( strpos($url,'?') ) { |
170 | - list($clean_url, $query) = explode('?', $url); |
|
171 | - if($query) { |
|
172 | - $url = $clean_url; |
|
173 | - parse_str($query, $query_params); |
|
174 | - $params = array_merge($params?$params:array(), $query_params); |
|
175 | - } |
|
170 | + list($clean_url, $query) = explode('?', $url); |
|
171 | + if($query) { |
|
172 | + $url = $clean_url; |
|
173 | + parse_str($query, $query_params); |
|
174 | + $params = array_merge($params?$params:array(), $query_params); |
|
175 | + } |
|
176 | 176 | } |
177 | 177 | $client = $acc->getHttpClient($this->_oauth_config, $url); |
178 | 178 | |
@@ -212,33 +212,33 @@ discard block |
||
212 | 212 | $this->_last = $resp = $client->request(); |
213 | 213 | $this->_lastReq = $client->getLastRequest(); |
214 | 214 | return $resp->getBody(); |
215 | - } |
|
215 | + } |
|
216 | 216 | |
217 | - /** |
|
218 | - * Get HTTP client |
|
219 | - * @return Zend_Oauth_Client |
|
220 | - */ |
|
221 | - public function getClient() |
|
222 | - { |
|
217 | + /** |
|
218 | + * Get HTTP client |
|
219 | + * @return Zend_Oauth_Client |
|
220 | + */ |
|
221 | + public function getClient() |
|
222 | + { |
|
223 | 223 | $acc = $this->makeAccessToken(); |
224 | 224 | return $acc->getHttpClient($this->_oauth_config); |
225 | - } |
|
225 | + } |
|
226 | 226 | |
227 | - /** |
|
228 | - * Get last response |
|
229 | - * @return string |
|
230 | - */ |
|
231 | - public function getLastResponse() |
|
232 | - { |
|
227 | + /** |
|
228 | + * Get last response |
|
229 | + * @return string |
|
230 | + */ |
|
231 | + public function getLastResponse() |
|
232 | + { |
|
233 | 233 | return $this->_last; |
234 | - } |
|
234 | + } |
|
235 | 235 | |
236 | - /** |
|
237 | - * Get last request |
|
238 | - * @return string |
|
239 | - */ |
|
240 | - public function getLastRequest() |
|
241 | - { |
|
236 | + /** |
|
237 | + * Get last request |
|
238 | + * @return string |
|
239 | + */ |
|
240 | + public function getLastRequest() |
|
241 | + { |
|
242 | 242 | return $this->_lastReq; |
243 | - } |
|
243 | + } |
|
244 | 244 | } |
@@ -144,7 +144,7 @@ |
||
144 | 144 | $contents = str_replace('"' . $vardef['name'] . '"', '{/literal}"{$fields.' . $vardef['name'] . '.name}"{literal}', $contents); |
145 | 145 | // regex below fixes button javascript for flexi relationship |
146 | 146 | if($vardef['type'] == 'parent') { |
147 | - $contents = str_replace("onclick='open_popup(document.{\$form_name}.parent_type.value, 600, 400, \"\", true, false, {literal}{\"call_back_function\":\"set_return\",\"form_name\":\"EditView\",\"field_to_name_array\":{\"id\":{/literal}\"{\$fields.parent_name.id_name}", "onclick='open_popup(document.{\$form_name}.parent_type.value, 600, 400, \"\", true, false, {literal}{\"call_back_function\":\"set_return\",\"form_name\":\"EditView\",\"field_to_name_array\":{\"id\":{/literal}\"parent_id", $contents); |
|
147 | + $contents = str_replace("onclick='open_popup(document.{\$form_name}.parent_type.value, 600, 400, \"\", true, false, {literal}{\"call_back_function\":\"set_return\",\"form_name\":\"EditView\",\"field_to_name_array\":{\"id\":{/literal}\"{\$fields.parent_name.id_name}", "onclick='open_popup(document.{\$form_name}.parent_type.value, 600, 400, \"\", true, false, {literal}{\"call_back_function\":\"set_return\",\"form_name\":\"EditView\",\"field_to_name_array\":{\"id\":{/literal}\"parent_id", $contents); |
|
148 | 148 | } |
149 | 149 | } |
150 | 150 |
@@ -19,7 +19,7 @@ |
||
19 | 19 | $PHPMAILER_LANG['mailer_not_supported'] = ' برنامج الإرسال غير مدعوم.'; |
20 | 20 | $PHPMAILER_LANG['provide_address'] = 'يجب توفير عنوان البريد الإلكتروني لمستلم واحد على الأقل.'; |
21 | 21 | $PHPMAILER_LANG['recipients_failed'] = 'خطأ SMTP: الأخطاء التالية ' . |
22 | - 'فشل في الارسال لكل من : '; |
|
22 | + 'فشل في الارسال لكل من : '; |
|
23 | 23 | $PHPMAILER_LANG['signing'] = 'خطأ في التوقيع: '; |
24 | 24 | $PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() غير ممكن.'; |
25 | 25 | $PHPMAILER_LANG['smtp_error'] = 'خطأ على مستوى الخادم SMTP: '; |
@@ -54,14 +54,14 @@ discard block |
||
54 | 54 | */ |
55 | 55 | function checkRequired($prefix, $required) |
56 | 56 | { |
57 | - foreach($required as $key) |
|
58 | - { |
|
59 | - if(!isset($_POST[$prefix.$key]) || number_empty($_POST[$prefix.$key])) |
|
60 | - { |
|
61 | - return false; |
|
62 | - } |
|
63 | - } |
|
64 | - return true; |
|
57 | + foreach($required as $key) |
|
58 | + { |
|
59 | + if(!isset($_POST[$prefix.$key]) || number_empty($_POST[$prefix.$key])) |
|
60 | + { |
|
61 | + return false; |
|
62 | + } |
|
63 | + } |
|
64 | + return true; |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | /** |
@@ -75,16 +75,16 @@ discard block |
||
75 | 75 | */ |
76 | 76 | function populateFromPost($prefix, &$focus, $skipRetrieve = false, $checkACL = false) |
77 | 77 | { |
78 | - global $current_user; |
|
78 | + global $current_user; |
|
79 | 79 | |
80 | - if(!empty($_REQUEST[$prefix.'record']) && !$skipRetrieve) |
|
81 | - $focus->retrieve($_REQUEST[$prefix.'record']); |
|
80 | + if(!empty($_REQUEST[$prefix.'record']) && !$skipRetrieve) |
|
81 | + $focus->retrieve($_REQUEST[$prefix.'record']); |
|
82 | 82 | |
83 | - if(!empty($_POST['assigned_user_id']) && |
|
84 | - ($focus->assigned_user_id != $_POST['assigned_user_id']) && |
|
85 | - ($_POST['assigned_user_id'] != $current_user->id)) { |
|
86 | - $GLOBALS['check_notify'] = true; |
|
87 | - } |
|
83 | + if(!empty($_POST['assigned_user_id']) && |
|
84 | + ($focus->assigned_user_id != $_POST['assigned_user_id']) && |
|
85 | + ($_POST['assigned_user_id'] != $current_user->id)) { |
|
86 | + $GLOBALS['check_notify'] = true; |
|
87 | + } |
|
88 | 88 | if(isset($_POST['dup_checked']) && $_POST['dup_checked'] && isset($_POST['id']) && $_POST['id'] != '' ){ |
89 | 89 | $focus->new_with_id = true; |
90 | 90 | } |
@@ -106,15 +106,15 @@ discard block |
||
106 | 106 | $relatedFields[$def['id_name']] = $field; |
107 | 107 | } |
108 | 108 | |
109 | - foreach($focus->field_defs as $field=>$def) { |
|
109 | + foreach($focus->field_defs as $field=>$def) { |
|
110 | 110 | if ( $field == 'id' && !empty($focus->id) ) { |
111 | 111 | // Don't try and overwrite the ID |
112 | 112 | continue; |
113 | 113 | } |
114 | 114 | |
115 | 115 | |
116 | - $type = !empty($def['custom_type']) ? $def['custom_type'] : $def['type']; |
|
117 | - $sf = $sfh->getSugarField($type); |
|
116 | + $type = !empty($def['custom_type']) ? $def['custom_type'] : $def['type']; |
|
117 | + $sf = $sfh->getSugarField($type); |
|
118 | 118 | if($sf != null){ |
119 | 119 | $sf->save($focus, $_POST, $field, $def, $prefix); |
120 | 120 | } else { |
@@ -152,15 +152,15 @@ discard block |
||
152 | 152 | $focus->$field = ''; |
153 | 153 | } |
154 | 154 | */ |
155 | - } |
|
155 | + } |
|
156 | 156 | |
157 | - foreach($focus->additional_column_fields as $field) { |
|
158 | - if(isset($_POST[$prefix.$field])) { |
|
159 | - $value = $_POST[$prefix.$field]; |
|
160 | - $focus->$field = $value; |
|
161 | - } |
|
162 | - } |
|
163 | - return $focus; |
|
157 | + foreach($focus->additional_column_fields as $field) { |
|
158 | + if(isset($_POST[$prefix.$field])) { |
|
159 | + $value = $_POST[$prefix.$field]; |
|
160 | + $focus->$field = $value; |
|
161 | + } |
|
162 | + } |
|
163 | + return $focus; |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | function add_hidden_elements($key, $value) { |
@@ -182,73 +182,73 @@ discard block |
||
182 | 182 | |
183 | 183 | function getPostToForm($ignore='', $isRegularExpression=false) |
184 | 184 | { |
185 | - $fields = ''; |
|
186 | - if(!empty($ignore) && $isRegularExpression) { |
|
187 | - foreach ($_POST as $key=>$value){ |
|
188 | - if(!preg_match($ignore, $key)) { |
|
185 | + $fields = ''; |
|
186 | + if(!empty($ignore) && $isRegularExpression) { |
|
187 | + foreach ($_POST as $key=>$value){ |
|
188 | + if(!preg_match($ignore, $key)) { |
|
189 | 189 | $fields .= add_hidden_elements($key, $value); |
190 | - } |
|
191 | - } |
|
192 | - } else { |
|
193 | - foreach ($_POST as $key=>$value){ |
|
194 | - if($key != $ignore) { |
|
190 | + } |
|
191 | + } |
|
192 | + } else { |
|
193 | + foreach ($_POST as $key=>$value){ |
|
194 | + if($key != $ignore) { |
|
195 | 195 | $fields .= add_hidden_elements($key, $value); |
196 | - } |
|
197 | - } |
|
198 | - } |
|
199 | - return $fields; |
|
196 | + } |
|
197 | + } |
|
198 | + } |
|
199 | + return $fields; |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | function getGetToForm($ignore='', $usePostAsAuthority = false) |
203 | 203 | { |
204 | - $fields = ''; |
|
205 | - foreach ($_GET as $key=>$value) |
|
206 | - { |
|
207 | - if($key != $ignore){ |
|
208 | - if(!$usePostAsAuthority || !isset($_POST[$key])){ |
|
209 | - $fields.= "<input type='hidden' name='$key' value='$value'>"; |
|
210 | - } |
|
211 | - } |
|
212 | - } |
|
213 | - return $fields; |
|
204 | + $fields = ''; |
|
205 | + foreach ($_GET as $key=>$value) |
|
206 | + { |
|
207 | + if($key != $ignore){ |
|
208 | + if(!$usePostAsAuthority || !isset($_POST[$key])){ |
|
209 | + $fields.= "<input type='hidden' name='$key' value='$value'>"; |
|
210 | + } |
|
211 | + } |
|
212 | + } |
|
213 | + return $fields; |
|
214 | 214 | |
215 | 215 | } |
216 | 216 | function getAnyToForm($ignore='', $usePostAsAuthority = false) |
217 | 217 | { |
218 | - $fields = getPostToForm($ignore); |
|
219 | - $fields .= getGetToForm($ignore, $usePostAsAuthority); |
|
220 | - return $fields; |
|
218 | + $fields = getPostToForm($ignore); |
|
219 | + $fields .= getGetToForm($ignore, $usePostAsAuthority); |
|
220 | + return $fields; |
|
221 | 221 | |
222 | 222 | } |
223 | 223 | |
224 | 224 | function handleRedirect($return_id='', $return_module='', $additionalFlags = false) |
225 | 225 | { |
226 | - if(isset($_REQUEST['return_url']) && $_REQUEST['return_url'] != "") |
|
227 | - { |
|
228 | - header("Location: ". $_REQUEST['return_url']); |
|
229 | - exit; |
|
230 | - } |
|
231 | - |
|
232 | - $url = buildRedirectURL($return_id, $return_module); |
|
233 | - header($url); |
|
234 | - exit; |
|
226 | + if(isset($_REQUEST['return_url']) && $_REQUEST['return_url'] != "") |
|
227 | + { |
|
228 | + header("Location: ". $_REQUEST['return_url']); |
|
229 | + exit; |
|
230 | + } |
|
231 | + |
|
232 | + $url = buildRedirectURL($return_id, $return_module); |
|
233 | + header($url); |
|
234 | + exit; |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | //eggsurplus: abstract to simplify unit testing |
238 | 238 | function buildRedirectURL($return_id='', $return_module='') |
239 | 239 | { |
240 | 240 | if(isset($_REQUEST['return_module']) && $_REQUEST['return_module'] != "") |
241 | - { |
|
242 | - $return_module = $_REQUEST['return_module']; |
|
243 | - } |
|
244 | - else |
|
245 | - { |
|
246 | - $return_module = $return_module; |
|
247 | - } |
|
248 | - if(isset($_REQUEST['return_action']) && $_REQUEST['return_action'] != "") |
|
249 | - { |
|
241 | + { |
|
242 | + $return_module = $_REQUEST['return_module']; |
|
243 | + } |
|
244 | + else |
|
245 | + { |
|
246 | + $return_module = $return_module; |
|
247 | + } |
|
248 | + if(isset($_REQUEST['return_action']) && $_REQUEST['return_action'] != "") |
|
249 | + { |
|
250 | 250 | |
251 | - //if we are doing a "Close and Create New" |
|
251 | + //if we are doing a "Close and Create New" |
|
252 | 252 | if(isCloseAndCreateNewPressed()) |
253 | 253 | { |
254 | 254 | $return_action = "EditView"; |
@@ -257,40 +257,40 @@ discard block |
||
257 | 257 | |
258 | 258 | // Meeting Integration |
259 | 259 | if(isset($_REQUEST['meetingIntegrationFlag']) && $_REQUEST['meetingIntegrationFlag'] == 1) { |
260 | - $additionalFlags = array('meetingIntegrationShowForm' => '1'); |
|
260 | + $additionalFlags = array('meetingIntegrationShowForm' => '1'); |
|
261 | 261 | } |
262 | 262 | // END Meeting Integration |
263 | 263 | } |
264 | - // if we create a new record "Save", we want to redirect to the DetailView |
|
265 | - else if(isset($_REQUEST['action']) && $_REQUEST['action'] == "Save" |
|
266 | - && $_REQUEST['return_module'] != 'Activities' |
|
267 | - && $_REQUEST['return_module'] != 'Home' |
|
268 | - && $_REQUEST['return_module'] != 'Forecasts' |
|
269 | - && $_REQUEST['return_module'] != 'Calendar' |
|
270 | - && $_REQUEST['return_module'] != 'MailMerge' |
|
271 | - ) |
|
272 | - { |
|
273 | - $return_action = 'DetailView'; |
|
274 | - } elseif($_REQUEST['return_module'] == 'Activities' || $_REQUEST['return_module'] == 'Calendar') { |
|
275 | - $return_module = $_REQUEST['module']; |
|
276 | - $return_action = $_REQUEST['return_action']; |
|
277 | - // wp: return action needs to be set for one-click close in task list |
|
278 | - } |
|
279 | - else |
|
280 | - { |
|
281 | - // if we "Cancel", we go back to the list view. |
|
282 | - $return_action = $_REQUEST['return_action']; |
|
283 | - } |
|
284 | - } |
|
285 | - else |
|
286 | - { |
|
287 | - $return_action = "DetailView"; |
|
288 | - } |
|
264 | + // if we create a new record "Save", we want to redirect to the DetailView |
|
265 | + else if(isset($_REQUEST['action']) && $_REQUEST['action'] == "Save" |
|
266 | + && $_REQUEST['return_module'] != 'Activities' |
|
267 | + && $_REQUEST['return_module'] != 'Home' |
|
268 | + && $_REQUEST['return_module'] != 'Forecasts' |
|
269 | + && $_REQUEST['return_module'] != 'Calendar' |
|
270 | + && $_REQUEST['return_module'] != 'MailMerge' |
|
271 | + ) |
|
272 | + { |
|
273 | + $return_action = 'DetailView'; |
|
274 | + } elseif($_REQUEST['return_module'] == 'Activities' || $_REQUEST['return_module'] == 'Calendar') { |
|
275 | + $return_module = $_REQUEST['module']; |
|
276 | + $return_action = $_REQUEST['return_action']; |
|
277 | + // wp: return action needs to be set for one-click close in task list |
|
278 | + } |
|
279 | + else |
|
280 | + { |
|
281 | + // if we "Cancel", we go back to the list view. |
|
282 | + $return_action = $_REQUEST['return_action']; |
|
283 | + } |
|
284 | + } |
|
285 | + else |
|
286 | + { |
|
287 | + $return_action = "DetailView"; |
|
288 | + } |
|
289 | 289 | |
290 | - if(isset($_REQUEST['return_id']) && $_REQUEST['return_id'] != "") |
|
291 | - { |
|
292 | - $return_id = $_REQUEST['return_id']; |
|
293 | - } |
|
290 | + if(isset($_REQUEST['return_id']) && $_REQUEST['return_id'] != "") |
|
291 | + { |
|
292 | + $return_id = $_REQUEST['return_id']; |
|
293 | + } |
|
294 | 294 | |
295 | 295 | $add = ""; |
296 | 296 | if(isset($additionalFlags) && !empty($additionalFlags)) { |
@@ -320,16 +320,16 @@ discard block |
||
320 | 320 | return "Location: $url"; |
321 | 321 | } |
322 | 322 | } else { |
323 | - $standard = "action=$return_action&module=$return_module&record=$return_id&isDuplicate=true&return_module=$return_module&return_action=$return_action&status=$status"; |
|
323 | + $standard = "action=$return_action&module=$return_module&record=$return_id&isDuplicate=true&return_module=$return_module&return_action=$return_action&status=$status"; |
|
324 | 324 | $url="index.php?{$standard}{$add}"; |
325 | 325 | if(!empty($_REQUEST['ajax_load'])) |
326 | 326 | { |
327 | 327 | $ajax_ret = array( |
328 | - 'content' => "<script>SUGAR.ajaxUI.loadContent('$url');</script>\n", |
|
329 | - 'menu' => array( |
|
330 | - 'module' => $return_module, |
|
331 | - 'label' => translate($return_module), |
|
332 | - ), |
|
328 | + 'content' => "<script>SUGAR.ajaxUI.loadContent('$url');</script>\n", |
|
329 | + 'menu' => array( |
|
330 | + 'module' => $return_module, |
|
331 | + 'label' => translate($return_module), |
|
332 | + ), |
|
333 | 333 | ); |
334 | 334 | $json = getJSONobj(); |
335 | 335 | echo $json->encode($ajax_ret); |
@@ -341,21 +341,21 @@ discard block |
||
341 | 341 | |
342 | 342 | function getLikeForEachWord($fieldname, $value, $minsize=4) |
343 | 343 | { |
344 | - $value = trim($value); |
|
345 | - $values = explode(' ',$value); |
|
346 | - $ret = ''; |
|
347 | - foreach($values as $val) |
|
348 | - { |
|
349 | - if(strlen($val) >= $minsize) |
|
350 | - { |
|
351 | - if(!empty($ret)) |
|
352 | - { |
|
353 | - $ret .= ' or'; |
|
354 | - } |
|
355 | - $ret .= ' '. $fieldname . ' LIKE %'.$val.'%'; |
|
356 | - } |
|
344 | + $value = trim($value); |
|
345 | + $values = explode(' ',$value); |
|
346 | + $ret = ''; |
|
347 | + foreach($values as $val) |
|
348 | + { |
|
349 | + if(strlen($val) >= $minsize) |
|
350 | + { |
|
351 | + if(!empty($ret)) |
|
352 | + { |
|
353 | + $ret .= ' or'; |
|
354 | + } |
|
355 | + $ret .= ' '. $fieldname . ' LIKE %'.$val.'%'; |
|
356 | + } |
|
357 | 357 | |
358 | - } |
|
358 | + } |
|
359 | 359 | |
360 | 360 | |
361 | 361 | } |
@@ -51,381 +51,381 @@ discard block |
||
51 | 51 | |
52 | 52 | function make_sugar_config(&$sugar_config) |
53 | 53 | { |
54 | - /* used to convert non-array config.php file to array format */ |
|
55 | - global $admin_export_only; |
|
56 | - global $cache_dir; |
|
57 | - global $calculate_response_time; |
|
58 | - global $create_default_user; |
|
59 | - global $dateFormats; |
|
60 | - global $dbconfig; |
|
61 | - global $dbconfigoption; |
|
62 | - global $default_action; |
|
63 | - global $default_charset; |
|
64 | - global $default_currency_name; |
|
65 | - global $default_currency_symbol; |
|
54 | + /* used to convert non-array config.php file to array format */ |
|
55 | + global $admin_export_only; |
|
56 | + global $cache_dir; |
|
57 | + global $calculate_response_time; |
|
58 | + global $create_default_user; |
|
59 | + global $dateFormats; |
|
60 | + global $dbconfig; |
|
61 | + global $dbconfigoption; |
|
62 | + global $default_action; |
|
63 | + global $default_charset; |
|
64 | + global $default_currency_name; |
|
65 | + global $default_currency_symbol; |
|
66 | 66 | global $default_currency_iso4217; |
67 | - global $defaultDateFormat; |
|
68 | - global $default_language; |
|
69 | - global $default_module; |
|
70 | - global $default_password; |
|
71 | - global $default_permission_mode; |
|
72 | - global $default_theme; |
|
73 | - global $defaultTimeFormat; |
|
74 | - global $default_user_is_admin; |
|
75 | - global $default_user_name; |
|
76 | - global $disable_export; |
|
77 | - global $disable_persistent_connections; |
|
78 | - global $display_email_template_variable_chooser; |
|
79 | - global $display_inbound_email_buttons; |
|
80 | - global $history_max_viewed; |
|
81 | - global $host_name; |
|
82 | - global $import_dir; |
|
83 | - global $languages; |
|
84 | - global $list_max_entries_per_page; |
|
85 | - global $lock_default_user_name; |
|
86 | - global $log_memory_usage; |
|
67 | + global $defaultDateFormat; |
|
68 | + global $default_language; |
|
69 | + global $default_module; |
|
70 | + global $default_password; |
|
71 | + global $default_permission_mode; |
|
72 | + global $default_theme; |
|
73 | + global $defaultTimeFormat; |
|
74 | + global $default_user_is_admin; |
|
75 | + global $default_user_name; |
|
76 | + global $disable_export; |
|
77 | + global $disable_persistent_connections; |
|
78 | + global $display_email_template_variable_chooser; |
|
79 | + global $display_inbound_email_buttons; |
|
80 | + global $history_max_viewed; |
|
81 | + global $host_name; |
|
82 | + global $import_dir; |
|
83 | + global $languages; |
|
84 | + global $list_max_entries_per_page; |
|
85 | + global $lock_default_user_name; |
|
86 | + global $log_memory_usage; |
|
87 | 87 | global $nameFormats; |
88 | - global $requireAccounts; |
|
89 | - global $RSS_CACHE_TIME; |
|
90 | - global $session_dir; |
|
91 | - global $site_URL; |
|
92 | - global $site_url; |
|
93 | - global $sugar_version; |
|
94 | - global $timeFormats; |
|
95 | - global $tmp_dir; |
|
96 | - global $translation_string_prefix; |
|
97 | - global $unique_key; |
|
98 | - global $upload_badext; |
|
99 | - global $upload_dir; |
|
100 | - global $upload_maxsize; |
|
101 | - global $import_max_execution_time; |
|
102 | - global $list_max_entries_per_subpanel; |
|
103 | - global $passwordsetting; |
|
104 | - |
|
105 | - // assumes the following variables must be set: |
|
106 | - // $dbconfig, $dbconfigoption, $cache_dir, $session_dir, $site_URL, $upload_dir |
|
107 | - |
|
108 | - $sugar_config = array ( |
|
109 | - 'admin_export_only' => empty($admin_export_only) ? false : $admin_export_only, |
|
110 | - 'export_delimiter' => empty($export_delimiter) ? ',' : $export_delimiter, |
|
111 | - 'cache_dir' => empty($cache_dir) ? 'cache/' : $cache_dir, |
|
112 | - 'calculate_response_time' => empty($calculate_response_time) ? true : $calculate_response_time, |
|
113 | - 'create_default_user' => empty($create_default_user) ? false : $create_default_user, |
|
114 | - 'chartEngine' => 'Jit', |
|
115 | - 'date_formats' => empty($dateFormats) ? array( |
|
116 | - 'Y-m-d'=>'2010-12-23', |
|
117 | - 'd-m-Y' => '23-12-2010', |
|
118 | - 'm-d-Y'=>'12-23-2010', |
|
119 | - 'Y/m/d'=>'2010/12/23', |
|
120 | - 'd/m/Y' => '23/12/2010', |
|
121 | - 'm/d/Y'=>'12/23/2010', |
|
122 | - 'Y.m.d' => '2010.12.23', |
|
123 | - 'd.m.Y' => '23.12.2010', |
|
124 | - 'm.d.Y' => '12.23.2010' |
|
125 | - ) : $dateFormats, |
|
126 | - 'dbconfig' => $dbconfig, // this must be set!! |
|
127 | - 'dbconfigoption' => $dbconfigoption, // this must be set!! |
|
128 | - 'default_action' => empty($default_action) ? 'index' : $default_action, |
|
129 | - 'default_charset' => empty($default_charset) ? 'UTF-8' : $default_charset, |
|
130 | - 'default_currency_name' => empty($default_currency_name) ? 'US Dollar' : $default_currency_name, |
|
131 | - 'default_currency_symbol' => empty($default_currency_symbol) ? '$' : $default_currency_symbol, |
|
132 | - 'default_currency_iso4217' => empty($default_currency_iso4217) ? '$' : $default_currency_iso4217, |
|
133 | - 'default_date_format' => empty($defaultDateFormat) ? 'm/d/Y' : $defaultDateFormat, |
|
88 | + global $requireAccounts; |
|
89 | + global $RSS_CACHE_TIME; |
|
90 | + global $session_dir; |
|
91 | + global $site_URL; |
|
92 | + global $site_url; |
|
93 | + global $sugar_version; |
|
94 | + global $timeFormats; |
|
95 | + global $tmp_dir; |
|
96 | + global $translation_string_prefix; |
|
97 | + global $unique_key; |
|
98 | + global $upload_badext; |
|
99 | + global $upload_dir; |
|
100 | + global $upload_maxsize; |
|
101 | + global $import_max_execution_time; |
|
102 | + global $list_max_entries_per_subpanel; |
|
103 | + global $passwordsetting; |
|
104 | + |
|
105 | + // assumes the following variables must be set: |
|
106 | + // $dbconfig, $dbconfigoption, $cache_dir, $session_dir, $site_URL, $upload_dir |
|
107 | + |
|
108 | + $sugar_config = array ( |
|
109 | + 'admin_export_only' => empty($admin_export_only) ? false : $admin_export_only, |
|
110 | + 'export_delimiter' => empty($export_delimiter) ? ',' : $export_delimiter, |
|
111 | + 'cache_dir' => empty($cache_dir) ? 'cache/' : $cache_dir, |
|
112 | + 'calculate_response_time' => empty($calculate_response_time) ? true : $calculate_response_time, |
|
113 | + 'create_default_user' => empty($create_default_user) ? false : $create_default_user, |
|
114 | + 'chartEngine' => 'Jit', |
|
115 | + 'date_formats' => empty($dateFormats) ? array( |
|
116 | + 'Y-m-d'=>'2010-12-23', |
|
117 | + 'd-m-Y' => '23-12-2010', |
|
118 | + 'm-d-Y'=>'12-23-2010', |
|
119 | + 'Y/m/d'=>'2010/12/23', |
|
120 | + 'd/m/Y' => '23/12/2010', |
|
121 | + 'm/d/Y'=>'12/23/2010', |
|
122 | + 'Y.m.d' => '2010.12.23', |
|
123 | + 'd.m.Y' => '23.12.2010', |
|
124 | + 'm.d.Y' => '12.23.2010' |
|
125 | + ) : $dateFormats, |
|
126 | + 'dbconfig' => $dbconfig, // this must be set!! |
|
127 | + 'dbconfigoption' => $dbconfigoption, // this must be set!! |
|
128 | + 'default_action' => empty($default_action) ? 'index' : $default_action, |
|
129 | + 'default_charset' => empty($default_charset) ? 'UTF-8' : $default_charset, |
|
130 | + 'default_currency_name' => empty($default_currency_name) ? 'US Dollar' : $default_currency_name, |
|
131 | + 'default_currency_symbol' => empty($default_currency_symbol) ? '$' : $default_currency_symbol, |
|
132 | + 'default_currency_iso4217' => empty($default_currency_iso4217) ? '$' : $default_currency_iso4217, |
|
133 | + 'default_date_format' => empty($defaultDateFormat) ? 'm/d/Y' : $defaultDateFormat, |
|
134 | 134 | 'default_locale_name_format' => empty($defaultNameFormat) ? 's f l' : $defaultNameFormat, |
135 | - 'default_export_charset' => 'UTF-8', |
|
136 | - 'default_language' => empty($default_language) ? 'en_us' : $default_language, |
|
137 | - 'default_module' => empty($default_module) ? 'Home' : $default_module, |
|
138 | - 'default_password' => empty($default_password) ? '' : $default_password, |
|
139 | - 'default_permissions' => array ( |
|
140 | - 'dir_mode' => 02770, |
|
141 | - 'file_mode' => 0755, |
|
142 | - 'chown' => '', |
|
143 | - 'chgrp' => '', |
|
144 | - ), |
|
135 | + 'default_export_charset' => 'UTF-8', |
|
136 | + 'default_language' => empty($default_language) ? 'en_us' : $default_language, |
|
137 | + 'default_module' => empty($default_module) ? 'Home' : $default_module, |
|
138 | + 'default_password' => empty($default_password) ? '' : $default_password, |
|
139 | + 'default_permissions' => array ( |
|
140 | + 'dir_mode' => 02770, |
|
141 | + 'file_mode' => 0755, |
|
142 | + 'chown' => '', |
|
143 | + 'chgrp' => '', |
|
144 | + ), |
|
145 | 145 | 'default_theme' => empty($default_theme) ? 'Sugar5' : $default_theme, |
146 | 146 | 'default_time_format' => empty($defaultTimeFormat) ? 'h:ia' : $defaultTimeFormat, |
147 | - 'default_user_is_admin' => empty($default_user_is_admin) ? false : $default_user_is_admin, |
|
148 | - 'default_user_name' => empty($default_user_name) ? '' : $default_user_name, |
|
149 | - 'disable_export' => empty($disable_export) ? false : $disable_export, |
|
147 | + 'default_user_is_admin' => empty($default_user_is_admin) ? false : $default_user_is_admin, |
|
148 | + 'default_user_name' => empty($default_user_name) ? '' : $default_user_name, |
|
149 | + 'disable_export' => empty($disable_export) ? false : $disable_export, |
|
150 | 150 | 'disable_persistent_connections' => empty($disable_persistent_connections) ? false : $disable_persistent_connections, |
151 | 151 | 'display_email_template_variable_chooser' => empty($display_email_template_variable_chooser) ? false : $display_email_template_variable_chooser, |
152 | - 'display_inbound_email_buttons' => empty($display_inbound_email_buttons) ? false : $display_inbound_email_buttons, |
|
153 | - 'history_max_viewed' => empty($history_max_viewed) ? 50 : $history_max_viewed, |
|
154 | - 'host_name' => empty($host_name) ? 'localhost' : $host_name, |
|
155 | - 'import_dir' => $import_dir, // this must be set!! |
|
156 | - 'import_max_records_per_file' => 100, |
|
152 | + 'display_inbound_email_buttons' => empty($display_inbound_email_buttons) ? false : $display_inbound_email_buttons, |
|
153 | + 'history_max_viewed' => empty($history_max_viewed) ? 50 : $history_max_viewed, |
|
154 | + 'host_name' => empty($host_name) ? 'localhost' : $host_name, |
|
155 | + 'import_dir' => $import_dir, // this must be set!! |
|
156 | + 'import_max_records_per_file' => 100, |
|
157 | 157 | 'import_max_records_total_limit' => '', |
158 | - 'languages' => empty($languages) ? array('en_us' => 'English (US)') : $languages, |
|
159 | - 'list_max_entries_per_page' => empty($list_max_entries_per_page) ? 20 : $list_max_entries_per_page, |
|
160 | - 'list_max_entries_per_subpanel' => empty($list_max_entries_per_subpanel) ? 10 : $list_max_entries_per_subpanel, |
|
161 | - 'lock_default_user_name' => empty($lock_default_user_name) ? false : $lock_default_user_name, |
|
162 | - 'log_memory_usage' => empty($log_memory_usage) ? false : $log_memory_usage, |
|
158 | + 'languages' => empty($languages) ? array('en_us' => 'English (US)') : $languages, |
|
159 | + 'list_max_entries_per_page' => empty($list_max_entries_per_page) ? 20 : $list_max_entries_per_page, |
|
160 | + 'list_max_entries_per_subpanel' => empty($list_max_entries_per_subpanel) ? 10 : $list_max_entries_per_subpanel, |
|
161 | + 'lock_default_user_name' => empty($lock_default_user_name) ? false : $lock_default_user_name, |
|
162 | + 'log_memory_usage' => empty($log_memory_usage) ? false : $log_memory_usage, |
|
163 | 163 | 'name_formats' => empty($nameFormats) ? array( |
164 | 164 | 's f l' => 's f l', 'f l' => 'f l', 's l' => 's l', 'l, s f' => 'l, s f', |
165 | 165 | 'l, f' => 'l, f', 's l, f' => 's l, f', 'l s f' => 'l s f', 'l f s' => 'l f s' |
166 | 166 | ) : $nameFormats, |
167 | 167 | 'portal_view' => 'single_user', |
168 | - 'resource_management' => array ( |
|
169 | - 'special_query_limit' => 50000, |
|
170 | - 'special_query_modules' => array('Reports', 'Export', 'Import', 'Administration', 'Sync'), |
|
171 | - 'default_limit' => 1000, |
|
168 | + 'resource_management' => array ( |
|
169 | + 'special_query_limit' => 50000, |
|
170 | + 'special_query_modules' => array('Reports', 'Export', 'Import', 'Administration', 'Sync'), |
|
171 | + 'default_limit' => 1000, |
|
172 | 172 | ), |
173 | - 'require_accounts' => empty($requireAccounts) ? true : $requireAccounts, |
|
174 | - 'rss_cache_time' => empty($RSS_CACHE_TIME) ? '10800' : $RSS_CACHE_TIME, |
|
175 | - 'session_dir' => $session_dir, // this must be set!! |
|
176 | - 'site_url' => empty($site_URL) ? $site_url : $site_URL, // this must be set!! |
|
177 | - 'showDetailData' => true, // if true, read-only ACL fields will still appear on EditViews as non-editable |
|
178 | - 'showThemePicker' => true, |
|
179 | - 'sugar_version' => empty($sugar_version) ? 'unknown' : $sugar_version, |
|
180 | - 'time_formats' => empty($timeFormats) ? array ( |
|
181 | - 'H:i'=>'23:00', 'h:ia'=>'11:00 pm', 'h:iA'=>'11:00PM', |
|
182 | - 'H.i'=>'23.00', 'h.ia'=>'11.00 pm', 'h.iA'=>'11.00PM' ) : $timeFormats, |
|
183 | - 'tmp_dir' => $tmp_dir, // this must be set!! |
|
184 | - 'translation_string_prefix' => empty($translation_string_prefix) ? false : $translation_string_prefix, |
|
185 | - 'unique_key' => empty($unique_key) ? md5(create_guid()) : $unique_key, |
|
186 | - 'upload_badext' => empty($upload_badext) ? array ( |
|
187 | - 'php', 'php3', 'php4', 'php5', 'pl', 'cgi', 'py', |
|
188 | - 'asp', 'cfm', 'js', 'vbs', 'html', 'htm' ) : $upload_badext, |
|
189 | - 'upload_dir' => $upload_dir, // this must be set!! |
|
190 | - 'upload_maxsize' => empty($upload_maxsize) ? 30000000 : $upload_maxsize, |
|
191 | - 'import_max_execution_time' => empty($import_max_execution_time) ? 3600 : $import_max_execution_time, |
|
192 | - 'lock_homepage' => false, |
|
193 | - 'lock_subpanels' => false, |
|
194 | - 'max_dashlets_homepage' => 15, |
|
195 | - 'dashlet_display_row_options' => array('1','3','5','10'), |
|
196 | - 'default_max_tabs' => empty($max_tabs) ? '7' : $max_tabs, |
|
197 | - 'default_subpanel_tabs' => empty($subpanel_tabs) ? true : $subpanel_tabs, |
|
198 | - 'default_subpanel_links' => empty($subpanel_links) ? false : $subpanel_links, |
|
199 | - 'default_swap_last_viewed' => empty($swap_last_viewed) ? false : $swap_last_viewed, |
|
200 | - 'default_swap_shortcuts' => empty($swap_shortcuts) ? false : $swap_shortcuts, |
|
201 | - 'default_navigation_paradigm' => empty($navigation_paradigm) ? 'gm' : $navigation_paradigm, |
|
173 | + 'require_accounts' => empty($requireAccounts) ? true : $requireAccounts, |
|
174 | + 'rss_cache_time' => empty($RSS_CACHE_TIME) ? '10800' : $RSS_CACHE_TIME, |
|
175 | + 'session_dir' => $session_dir, // this must be set!! |
|
176 | + 'site_url' => empty($site_URL) ? $site_url : $site_URL, // this must be set!! |
|
177 | + 'showDetailData' => true, // if true, read-only ACL fields will still appear on EditViews as non-editable |
|
178 | + 'showThemePicker' => true, |
|
179 | + 'sugar_version' => empty($sugar_version) ? 'unknown' : $sugar_version, |
|
180 | + 'time_formats' => empty($timeFormats) ? array ( |
|
181 | + 'H:i'=>'23:00', 'h:ia'=>'11:00 pm', 'h:iA'=>'11:00PM', |
|
182 | + 'H.i'=>'23.00', 'h.ia'=>'11.00 pm', 'h.iA'=>'11.00PM' ) : $timeFormats, |
|
183 | + 'tmp_dir' => $tmp_dir, // this must be set!! |
|
184 | + 'translation_string_prefix' => empty($translation_string_prefix) ? false : $translation_string_prefix, |
|
185 | + 'unique_key' => empty($unique_key) ? md5(create_guid()) : $unique_key, |
|
186 | + 'upload_badext' => empty($upload_badext) ? array ( |
|
187 | + 'php', 'php3', 'php4', 'php5', 'pl', 'cgi', 'py', |
|
188 | + 'asp', 'cfm', 'js', 'vbs', 'html', 'htm' ) : $upload_badext, |
|
189 | + 'upload_dir' => $upload_dir, // this must be set!! |
|
190 | + 'upload_maxsize' => empty($upload_maxsize) ? 30000000 : $upload_maxsize, |
|
191 | + 'import_max_execution_time' => empty($import_max_execution_time) ? 3600 : $import_max_execution_time, |
|
192 | + 'lock_homepage' => false, |
|
193 | + 'lock_subpanels' => false, |
|
194 | + 'max_dashlets_homepage' => 15, |
|
195 | + 'dashlet_display_row_options' => array('1','3','5','10'), |
|
196 | + 'default_max_tabs' => empty($max_tabs) ? '7' : $max_tabs, |
|
197 | + 'default_subpanel_tabs' => empty($subpanel_tabs) ? true : $subpanel_tabs, |
|
198 | + 'default_subpanel_links' => empty($subpanel_links) ? false : $subpanel_links, |
|
199 | + 'default_swap_last_viewed' => empty($swap_last_viewed) ? false : $swap_last_viewed, |
|
200 | + 'default_swap_shortcuts' => empty($swap_shortcuts) ? false : $swap_shortcuts, |
|
201 | + 'default_navigation_paradigm' => empty($navigation_paradigm) ? 'gm' : $navigation_paradigm, |
|
202 | 202 | 'default_call_status' => 'Planned', |
203 | - 'js_lang_version' => 1, |
|
204 | - 'passwordsetting' => empty($passwordsetting) ? array ( |
|
205 | - 'SystemGeneratedPasswordON' => '', |
|
206 | - 'generatepasswordtmpl' => '', |
|
207 | - 'lostpasswordtmpl' => '', |
|
208 | - 'forgotpasswordON' => true, |
|
209 | - 'linkexpiration' => '1', |
|
210 | - 'linkexpirationtime' => '30', |
|
211 | - 'linkexpirationtype' => '1', |
|
212 | - 'systexpiration' => '0', |
|
213 | - 'systexpirationtime' => '', |
|
214 | - 'systexpirationtype' => '0', |
|
215 | - 'systexpirationlogin' => '', |
|
216 | - ) : $passwordsetting, |
|
217 | - 'use_sprites' => function_exists('imagecreatetruecolor'), |
|
218 | - 'search_wildcard_infront' => false, |
|
203 | + 'js_lang_version' => 1, |
|
204 | + 'passwordsetting' => empty($passwordsetting) ? array ( |
|
205 | + 'SystemGeneratedPasswordON' => '', |
|
206 | + 'generatepasswordtmpl' => '', |
|
207 | + 'lostpasswordtmpl' => '', |
|
208 | + 'forgotpasswordON' => true, |
|
209 | + 'linkexpiration' => '1', |
|
210 | + 'linkexpirationtime' => '30', |
|
211 | + 'linkexpirationtype' => '1', |
|
212 | + 'systexpiration' => '0', |
|
213 | + 'systexpirationtime' => '', |
|
214 | + 'systexpirationtype' => '0', |
|
215 | + 'systexpirationlogin' => '', |
|
216 | + ) : $passwordsetting, |
|
217 | + 'use_sprites' => function_exists('imagecreatetruecolor'), |
|
218 | + 'search_wildcard_infront' => false, |
|
219 | 219 | 'search_wildcard_char' => '%', |
220 | - 'jobs' => array( |
|
221 | - 'min_retry_interval' => 60, // minimal job retry delay |
|
222 | - 'max_retries' => 5, // how many times to retry the job |
|
223 | - 'timeout' => 86400, // how long a job may spend as running before being force-failed |
|
224 | - 'soft_lifetime' => 7, // how many days until job record will be soft deleted after completion |
|
225 | - 'hard_lifetime' => 21, // how many days until job record will be purged from DB |
|
226 | - ), |
|
227 | - "cron" => array( |
|
228 | - 'max_cron_jobs' => 10, // max jobs per cron schedule run |
|
229 | - 'max_cron_runtime' => 60, // max runtime for cron jobs |
|
230 | - 'min_cron_interval' => 30, // minimal interval between cron jobs |
|
231 | - ), |
|
232 | - ); |
|
220 | + 'jobs' => array( |
|
221 | + 'min_retry_interval' => 60, // minimal job retry delay |
|
222 | + 'max_retries' => 5, // how many times to retry the job |
|
223 | + 'timeout' => 86400, // how long a job may spend as running before being force-failed |
|
224 | + 'soft_lifetime' => 7, // how many days until job record will be soft deleted after completion |
|
225 | + 'hard_lifetime' => 21, // how many days until job record will be purged from DB |
|
226 | + ), |
|
227 | + "cron" => array( |
|
228 | + 'max_cron_jobs' => 10, // max jobs per cron schedule run |
|
229 | + 'max_cron_runtime' => 60, // max runtime for cron jobs |
|
230 | + 'min_cron_interval' => 30, // minimal interval between cron jobs |
|
231 | + ), |
|
232 | + ); |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | function get_sugar_config_defaults() { |
236 | - global $locale; |
|
237 | - /** |
|
238 | - * used for getting base values for array style config.php. used by the |
|
239 | - * installer and to fill in new entries on upgrades. see also: |
|
240 | - * sugar_config_union |
|
241 | - */ |
|
236 | + global $locale; |
|
237 | + /** |
|
238 | + * used for getting base values for array style config.php. used by the |
|
239 | + * installer and to fill in new entries on upgrades. see also: |
|
240 | + * sugar_config_union |
|
241 | + */ |
|
242 | 242 | |
243 | - $sugar_config_defaults = array ( |
|
244 | - 'admin_export_only' => false, |
|
245 | - 'export_delimiter' => ',', |
|
246 | - 'export_excel_compatible' => false, |
|
247 | - 'cache_dir' => 'cache/', |
|
248 | - 'calculate_response_time' => true, |
|
249 | - 'create_default_user' => false, |
|
250 | - 'chartEngine' => 'Jit', |
|
251 | - 'date_formats' => array ( |
|
252 | - 'Y-m-d' => '2010-12-23', 'm-d-Y' => '12-23-2010', 'd-m-Y' => '23-12-2010', |
|
253 | - 'Y/m/d' => '2010/12/23', 'm/d/Y' => '12/23/2010', 'd/m/Y' => '23/12/2010', |
|
254 | - 'Y.m.d' => '2010.12.23', 'd.m.Y' => '23.12.2010', 'm.d.Y' => '12.23.2010',), |
|
243 | + $sugar_config_defaults = array ( |
|
244 | + 'admin_export_only' => false, |
|
245 | + 'export_delimiter' => ',', |
|
246 | + 'export_excel_compatible' => false, |
|
247 | + 'cache_dir' => 'cache/', |
|
248 | + 'calculate_response_time' => true, |
|
249 | + 'create_default_user' => false, |
|
250 | + 'chartEngine' => 'Jit', |
|
251 | + 'date_formats' => array ( |
|
252 | + 'Y-m-d' => '2010-12-23', 'm-d-Y' => '12-23-2010', 'd-m-Y' => '23-12-2010', |
|
253 | + 'Y/m/d' => '2010/12/23', 'm/d/Y' => '12/23/2010', 'd/m/Y' => '23/12/2010', |
|
254 | + 'Y.m.d' => '2010.12.23', 'd.m.Y' => '23.12.2010', 'm.d.Y' => '12.23.2010',), |
|
255 | 255 | 'name_formats' => array ( |
256 | 256 | 's f l' => 's f l', 'f l' => 'f l', 's l' => 's l', 'l, s f' => 'l, s f', |
257 | 257 | 'l, f' => 'l, f', 's l, f' => 's l, f', 'l s f' => 'l s f', 'l f s' => 'l f s' |
258 | 258 | ), |
259 | - 'dbconfigoption' => array ( |
|
260 | - 'persistent' => true, |
|
261 | - 'autofree' => false, |
|
262 | - 'debug' => 0, |
|
263 | - 'ssl' => false ), |
|
264 | - 'default_action' => 'index', |
|
265 | - 'default_charset' => return_session_value_or_default('default_charset', |
|
266 | - 'UTF-8'), |
|
267 | - 'default_currency_name' => return_session_value_or_default('default_currency_name', 'US Dollar'), |
|
268 | - 'default_currency_symbol' => return_session_value_or_default('default_currency_symbol', '$'), |
|
269 | - 'default_currency_iso4217' => return_session_value_or_default('default_currency_iso4217', 'USD'), |
|
270 | - 'default_currency_significant_digits' => return_session_value_or_default('default_currency_significant_digits', 2), |
|
271 | - 'default_number_grouping_seperator' => return_session_value_or_default('default_number_grouping_seperator', ','), |
|
272 | - 'default_decimal_seperator' => return_session_value_or_default('default_decimal_seperator', '.'), |
|
273 | - 'default_date_format' => 'm/d/Y', |
|
259 | + 'dbconfigoption' => array ( |
|
260 | + 'persistent' => true, |
|
261 | + 'autofree' => false, |
|
262 | + 'debug' => 0, |
|
263 | + 'ssl' => false ), |
|
264 | + 'default_action' => 'index', |
|
265 | + 'default_charset' => return_session_value_or_default('default_charset', |
|
266 | + 'UTF-8'), |
|
267 | + 'default_currency_name' => return_session_value_or_default('default_currency_name', 'US Dollar'), |
|
268 | + 'default_currency_symbol' => return_session_value_or_default('default_currency_symbol', '$'), |
|
269 | + 'default_currency_iso4217' => return_session_value_or_default('default_currency_iso4217', 'USD'), |
|
270 | + 'default_currency_significant_digits' => return_session_value_or_default('default_currency_significant_digits', 2), |
|
271 | + 'default_number_grouping_seperator' => return_session_value_or_default('default_number_grouping_seperator', ','), |
|
272 | + 'default_decimal_seperator' => return_session_value_or_default('default_decimal_seperator', '.'), |
|
273 | + 'default_date_format' => 'm/d/Y', |
|
274 | 274 | 'default_locale_name_format' => 's f l', |
275 | - 'default_export_charset' => 'UTF-8', |
|
276 | - 'default_language' => return_session_value_or_default('default_language', |
|
277 | - 'en_us'), |
|
278 | - 'default_module' => 'Home', |
|
279 | - 'default_password' => '', |
|
280 | - 'default_permissions' => array ( |
|
281 | - 'dir_mode' => 02770, |
|
282 | - 'file_mode' => 0755, |
|
283 | - 'user' => '', |
|
284 | - 'group' => '', |
|
285 | - ), |
|
286 | - 'default_theme' => return_session_value_or_default('site_default_theme', 'Sugar5'), |
|
287 | - 'default_time_format' => 'h:ia', |
|
288 | - 'default_user_is_admin' => false, |
|
289 | - 'default_user_name' => '', |
|
290 | - 'disable_export' => false, |
|
291 | - 'disable_persistent_connections' => |
|
292 | - return_session_value_or_default('disable_persistent_connections', |
|
293 | - 'false'), |
|
275 | + 'default_export_charset' => 'UTF-8', |
|
276 | + 'default_language' => return_session_value_or_default('default_language', |
|
277 | + 'en_us'), |
|
278 | + 'default_module' => 'Home', |
|
279 | + 'default_password' => '', |
|
280 | + 'default_permissions' => array ( |
|
281 | + 'dir_mode' => 02770, |
|
282 | + 'file_mode' => 0755, |
|
283 | + 'user' => '', |
|
284 | + 'group' => '', |
|
285 | + ), |
|
286 | + 'default_theme' => return_session_value_or_default('site_default_theme', 'Sugar5'), |
|
287 | + 'default_time_format' => 'h:ia', |
|
288 | + 'default_user_is_admin' => false, |
|
289 | + 'default_user_name' => '', |
|
290 | + 'disable_export' => false, |
|
291 | + 'disable_persistent_connections' => |
|
292 | + return_session_value_or_default('disable_persistent_connections', |
|
293 | + 'false'), |
|
294 | 294 | 'display_email_template_variable_chooser' => false, |
295 | - 'display_inbound_email_buttons' => false, |
|
296 | - 'dump_slow_queries' => false, |
|
297 | - 'email_address_separator' => ',', // use RFC2368 spec unless we have a noncompliant email client |
|
295 | + 'display_inbound_email_buttons' => false, |
|
296 | + 'dump_slow_queries' => false, |
|
297 | + 'email_address_separator' => ',', // use RFC2368 spec unless we have a noncompliant email client |
|
298 | 298 | 'email_default_editor' => 'html', |
299 | - 'email_default_client' => 'sugar', |
|
300 | - 'email_default_delete_attachments' => true, |
|
301 | - 'history_max_viewed' => 50, |
|
302 | - 'installer_locked' => true, |
|
303 | - 'import_max_records_per_file' => 100, |
|
299 | + 'email_default_client' => 'sugar', |
|
300 | + 'email_default_delete_attachments' => true, |
|
301 | + 'history_max_viewed' => 50, |
|
302 | + 'installer_locked' => true, |
|
303 | + 'import_max_records_per_file' => 100, |
|
304 | 304 | 'import_max_records_total_limit' => '', |
305 | - 'languages' => array('en_us' => 'English (US)'), |
|
306 | - 'large_scale_test' => false, |
|
307 | - 'list_max_entries_per_page' => 20, |
|
308 | - 'list_max_entries_per_subpanel' => 10, |
|
309 | - 'lock_default_user_name' => false, |
|
310 | - 'log_memory_usage' => false, |
|
311 | - 'portal_view' => 'single_user', |
|
305 | + 'languages' => array('en_us' => 'English (US)'), |
|
306 | + 'large_scale_test' => false, |
|
307 | + 'list_max_entries_per_page' => 20, |
|
308 | + 'list_max_entries_per_subpanel' => 10, |
|
309 | + 'lock_default_user_name' => false, |
|
310 | + 'log_memory_usage' => false, |
|
311 | + 'portal_view' => 'single_user', |
|
312 | 312 | 'resource_management' => array ( |
313 | - 'special_query_limit' => 50000, |
|
314 | - 'special_query_modules' => array('Reports', 'Export', 'Import', 'Administration', 'Sync'), |
|
315 | - 'default_limit' => 1000, |
|
313 | + 'special_query_limit' => 50000, |
|
314 | + 'special_query_modules' => array('Reports', 'Export', 'Import', 'Administration', 'Sync'), |
|
315 | + 'default_limit' => 1000, |
|
316 | 316 | ), |
317 | - 'require_accounts' => true, |
|
318 | - 'rss_cache_time' => return_session_value_or_default('rss_cache_time', |
|
319 | - '10800'), |
|
320 | - 'save_query' => 'all', |
|
321 | - 'showDetailData' => true, // if true, read-only ACL fields will still appear on EditViews as non-editable |
|
322 | - 'showThemePicker' => true, |
|
323 | - 'slow_query_time_msec' => '100', |
|
317 | + 'require_accounts' => true, |
|
318 | + 'rss_cache_time' => return_session_value_or_default('rss_cache_time', |
|
319 | + '10800'), |
|
320 | + 'save_query' => 'all', |
|
321 | + 'showDetailData' => true, // if true, read-only ACL fields will still appear on EditViews as non-editable |
|
322 | + 'showThemePicker' => true, |
|
323 | + 'slow_query_time_msec' => '100', |
|
324 | 324 | 'sugarbeet' => true, |
325 | 325 | 'time_formats' => array ( |
326 | 326 | 'H:i'=>'23:00', 'h:ia'=>'11:00pm', 'h:iA'=>'11:00PM', 'h:i a'=>'11:00 pm', 'h:i A'=>'11:00 PM', |
327 | 327 | 'H.i'=>'23.00', 'h.ia'=>'11.00pm', 'h.iA'=>'11.00PM', 'h.i a'=>'11.00 pm', 'h.i A'=>'11.00 PM' ), |
328 | 328 | 'tracker_max_display_length' => 15, |
329 | - 'translation_string_prefix' => |
|
330 | - return_session_value_or_default('translation_string_prefix', false), |
|
331 | - 'upload_badext' => array ( |
|
332 | - 'php', 'php3', 'php4', 'php5', 'pl', 'cgi', 'py', |
|
333 | - 'asp', 'cfm', 'js', 'vbs', 'html', 'htm', 'phtml' ), |
|
334 | - 'upload_maxsize' => 30000000, |
|
335 | - 'import_max_execution_time' => 3600, |
|
329 | + 'translation_string_prefix' => |
|
330 | + return_session_value_or_default('translation_string_prefix', false), |
|
331 | + 'upload_badext' => array ( |
|
332 | + 'php', 'php3', 'php4', 'php5', 'pl', 'cgi', 'py', |
|
333 | + 'asp', 'cfm', 'js', 'vbs', 'html', 'htm', 'phtml' ), |
|
334 | + 'upload_maxsize' => 30000000, |
|
335 | + 'import_max_execution_time' => 3600, |
|
336 | 336 | // 'use_php_code_json' => returnPhpJsonStatus(), |
337 | - 'verify_client_ip' => true, |
|
338 | - 'js_custom_version' => '', |
|
339 | - 'js_lang_version' => 1, |
|
337 | + 'verify_client_ip' => true, |
|
338 | + 'js_custom_version' => '', |
|
339 | + 'js_lang_version' => 1, |
|
340 | 340 | 'lead_conv_activity_opt' => 'donothing', |
341 | - 'default_number_grouping_seperator' => ',', |
|
342 | - 'default_decimal_seperator' => '.', |
|
343 | - 'lock_homepage' => false, |
|
344 | - 'lock_subpanels' => false, |
|
345 | - 'max_dashlets_homepage' => '15', |
|
346 | - 'default_max_tabs' => '7', |
|
347 | - 'dashlet_display_row_options' => array('1','3','5','10'), |
|
348 | - 'default_subpanel_tabs' => true, |
|
349 | - 'default_subpanel_links' => false, |
|
350 | - 'default_swap_last_viewed' => false, |
|
351 | - 'default_swap_shortcuts' => false, |
|
352 | - 'default_navigation_paradigm' => 'gm', |
|
353 | - 'admin_access_control' => false, |
|
354 | - 'use_common_ml_dir' => false, |
|
355 | - 'common_ml_dir' => '', |
|
356 | - 'vcal_time' => '2', |
|
357 | - 'calendar' => array( |
|
358 | - 'default_view' => 'week', |
|
359 | - 'show_calls_by_default' => true, |
|
360 | - 'show_tasks_by_default' => true, |
|
361 | - 'show_completed_by_default' => true, |
|
362 | - 'editview_width' => 990, |
|
363 | - 'editview_height' => 485, |
|
364 | - 'day_timestep' => 15, |
|
365 | - 'week_timestep' => 30, |
|
366 | - 'items_draggable' => true, |
|
367 | - 'items_resizable' => true, |
|
368 | - 'enable_repeat' => true, |
|
369 | - 'max_repeat_count' => 1000, |
|
370 | - ), |
|
371 | - 'passwordsetting' => empty($passwordsetting) ? array ( |
|
372 | - 'SystemGeneratedPasswordON' => '', |
|
373 | - 'generatepasswordtmpl' => '', |
|
374 | - 'lostpasswordtmpl' => '', |
|
375 | - 'forgotpasswordON' => false, |
|
376 | - 'linkexpiration' => '1', |
|
377 | - 'linkexpirationtime' => '30', |
|
378 | - 'linkexpirationtype' => '1', |
|
379 | - 'systexpiration' => '0', |
|
380 | - 'systexpirationtime' => '', |
|
381 | - 'systexpirationtype' => '0', |
|
382 | - 'systexpirationlogin' => '', |
|
383 | - ) : $passwordsetting, |
|
384 | - 'use_real_names' => true, |
|
385 | - |
|
386 | - 'search_wildcard_infront' => false, |
|
341 | + 'default_number_grouping_seperator' => ',', |
|
342 | + 'default_decimal_seperator' => '.', |
|
343 | + 'lock_homepage' => false, |
|
344 | + 'lock_subpanels' => false, |
|
345 | + 'max_dashlets_homepage' => '15', |
|
346 | + 'default_max_tabs' => '7', |
|
347 | + 'dashlet_display_row_options' => array('1','3','5','10'), |
|
348 | + 'default_subpanel_tabs' => true, |
|
349 | + 'default_subpanel_links' => false, |
|
350 | + 'default_swap_last_viewed' => false, |
|
351 | + 'default_swap_shortcuts' => false, |
|
352 | + 'default_navigation_paradigm' => 'gm', |
|
353 | + 'admin_access_control' => false, |
|
354 | + 'use_common_ml_dir' => false, |
|
355 | + 'common_ml_dir' => '', |
|
356 | + 'vcal_time' => '2', |
|
357 | + 'calendar' => array( |
|
358 | + 'default_view' => 'week', |
|
359 | + 'show_calls_by_default' => true, |
|
360 | + 'show_tasks_by_default' => true, |
|
361 | + 'show_completed_by_default' => true, |
|
362 | + 'editview_width' => 990, |
|
363 | + 'editview_height' => 485, |
|
364 | + 'day_timestep' => 15, |
|
365 | + 'week_timestep' => 30, |
|
366 | + 'items_draggable' => true, |
|
367 | + 'items_resizable' => true, |
|
368 | + 'enable_repeat' => true, |
|
369 | + 'max_repeat_count' => 1000, |
|
370 | + ), |
|
371 | + 'passwordsetting' => empty($passwordsetting) ? array ( |
|
372 | + 'SystemGeneratedPasswordON' => '', |
|
373 | + 'generatepasswordtmpl' => '', |
|
374 | + 'lostpasswordtmpl' => '', |
|
375 | + 'forgotpasswordON' => false, |
|
376 | + 'linkexpiration' => '1', |
|
377 | + 'linkexpirationtime' => '30', |
|
378 | + 'linkexpirationtype' => '1', |
|
379 | + 'systexpiration' => '0', |
|
380 | + 'systexpirationtime' => '', |
|
381 | + 'systexpirationtype' => '0', |
|
382 | + 'systexpirationlogin' => '', |
|
383 | + ) : $passwordsetting, |
|
384 | + 'use_real_names' => true, |
|
385 | + |
|
386 | + 'search_wildcard_infront' => false, |
|
387 | 387 | 'search_wildcard_char' => '%', |
388 | - 'jobs' => array( |
|
389 | - 'min_retry_interval' => 30, // 30 seconds minimal job retry |
|
390 | - 'max_retries' => 5, // how many times to retry the job |
|
391 | - 'timeout' => 86400, // how long a job may spend as running before being force-failed |
|
392 | - ), |
|
393 | - "cron" => array( |
|
394 | - 'max_cron_jobs' => 10, // max jobs per cron schedule run |
|
395 | - 'max_cron_runtime' => 30, // max runtime for cron jobs |
|
396 | - 'min_cron_interval' => 30, // minimal interval between cron jobs |
|
397 | - ), |
|
388 | + 'jobs' => array( |
|
389 | + 'min_retry_interval' => 30, // 30 seconds minimal job retry |
|
390 | + 'max_retries' => 5, // how many times to retry the job |
|
391 | + 'timeout' => 86400, // how long a job may spend as running before being force-failed |
|
392 | + ), |
|
393 | + "cron" => array( |
|
394 | + 'max_cron_jobs' => 10, // max jobs per cron schedule run |
|
395 | + 'max_cron_runtime' => 30, // max runtime for cron jobs |
|
396 | + 'min_cron_interval' => 30, // minimal interval between cron jobs |
|
397 | + ), |
|
398 | 398 | ); |
399 | 399 | |
400 | - if(!is_object($locale)) { |
|
401 | - $locale = new Localization(); |
|
402 | - } |
|
400 | + if(!is_object($locale)) { |
|
401 | + $locale = new Localization(); |
|
402 | + } |
|
403 | 403 | |
404 | - $sugar_config_defaults['default_currencies'] = $locale->getDefaultCurrencies(); |
|
404 | + $sugar_config_defaults['default_currencies'] = $locale->getDefaultCurrencies(); |
|
405 | 405 | |
406 | - $sugar_config_defaults = sugarArrayMerge($locale->getLocaleConfigDefaults(), $sugar_config_defaults); |
|
407 | - return( $sugar_config_defaults ); |
|
406 | + $sugar_config_defaults = sugarArrayMerge($locale->getLocaleConfigDefaults(), $sugar_config_defaults); |
|
407 | + return( $sugar_config_defaults ); |
|
408 | 408 | } |
409 | 409 | |
410 | 410 | /** |
411 | 411 | * @deprecated use SugarView::getMenu() instead |
412 | 412 | */ |
413 | 413 | function load_menu($path){ |
414 | - global $module_menu; |
|
414 | + global $module_menu; |
|
415 | 415 | |
416 | - if(file_exists($path . 'Menu.php')) |
|
417 | - { |
|
418 | - require($path . 'Menu.php'); |
|
419 | - } |
|
420 | - if(file_exists('custom/' . $path . 'Ext/Menus/menu.ext.php')) |
|
421 | - { |
|
422 | - require('custom/' . $path . 'Ext/Menus/menu.ext.php'); |
|
423 | - } |
|
424 | - if(file_exists('custom/application/Ext/Menus/menu.ext.php')) |
|
425 | - { |
|
426 | - require('custom/application/Ext/Menus/menu.ext.php'); |
|
427 | - } |
|
428 | - return $module_menu; |
|
416 | + if(file_exists($path . 'Menu.php')) |
|
417 | + { |
|
418 | + require($path . 'Menu.php'); |
|
419 | + } |
|
420 | + if(file_exists('custom/' . $path . 'Ext/Menus/menu.ext.php')) |
|
421 | + { |
|
422 | + require('custom/' . $path . 'Ext/Menus/menu.ext.php'); |
|
423 | + } |
|
424 | + if(file_exists('custom/application/Ext/Menus/menu.ext.php')) |
|
425 | + { |
|
426 | + require('custom/application/Ext/Menus/menu.ext.php'); |
|
427 | + } |
|
428 | + return $module_menu; |
|
429 | 429 | } |
430 | 430 | |
431 | 431 | /** |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | * @return string relative file path to email notifications template file |
436 | 436 | */ |
437 | 437 | function get_notify_template_file($language){ |
438 | - /* |
|
438 | + /* |
|
439 | 439 | * Order of operation: |
440 | 440 | * 1) custom version of specified language |
441 | 441 | * 2) stock version of specified language |
@@ -443,61 +443,61 @@ discard block |
||
443 | 443 | * 4) stock en_us template |
444 | 444 | */ |
445 | 445 | |
446 | - // set $file to the base code template so it's set if none of the conditions pass |
|
447 | - $file = "include/language/en_us.notify_template.html"; |
|
446 | + // set $file to the base code template so it's set if none of the conditions pass |
|
447 | + $file = "include/language/en_us.notify_template.html"; |
|
448 | 448 | |
449 | - if(file_exists("custom/include/language/{$language}.notify_template.html")){ |
|
450 | - $file = "custom/include/language/{$language}.notify_template.html"; |
|
451 | - } |
|
452 | - else if(file_exists("include/language/{$language}.notify_template.html")){ |
|
453 | - $file = "include/language/{$language}.notify_template.html"; |
|
454 | - } |
|
455 | - else if(file_exists("custom/include/language/en_us.notify_template.html")){ |
|
456 | - $file = "custom/include/language/en_us.notify_template.html"; |
|
457 | - } |
|
449 | + if(file_exists("custom/include/language/{$language}.notify_template.html")){ |
|
450 | + $file = "custom/include/language/{$language}.notify_template.html"; |
|
451 | + } |
|
452 | + else if(file_exists("include/language/{$language}.notify_template.html")){ |
|
453 | + $file = "include/language/{$language}.notify_template.html"; |
|
454 | + } |
|
455 | + else if(file_exists("custom/include/language/en_us.notify_template.html")){ |
|
456 | + $file = "custom/include/language/en_us.notify_template.html"; |
|
457 | + } |
|
458 | 458 | |
459 | - return $file; |
|
459 | + return $file; |
|
460 | 460 | } |
461 | 461 | |
462 | 462 | function sugar_config_union( $default, $override ){ |
463 | - // a little different then array_merge and array_merge_recursive. we want |
|
464 | - // the second array to override the first array if the same value exists, |
|
465 | - // otherwise merge the unique keys. it handles arrays of arrays recursively |
|
466 | - // might be suitable for a generic array_union |
|
467 | - if( !is_array( $override ) ){ |
|
468 | - $override = array(); |
|
469 | - } |
|
470 | - foreach( $default as $key => $value ){ |
|
471 | - if( !array_key_exists($key, $override) ){ |
|
472 | - $override[$key] = $value; |
|
473 | - } |
|
474 | - else if( is_array( $key ) ){ |
|
475 | - $override[$key] = sugar_config_union( $value, $override[$key] ); |
|
476 | - } |
|
477 | - } |
|
478 | - return( $override ); |
|
463 | + // a little different then array_merge and array_merge_recursive. we want |
|
464 | + // the second array to override the first array if the same value exists, |
|
465 | + // otherwise merge the unique keys. it handles arrays of arrays recursively |
|
466 | + // might be suitable for a generic array_union |
|
467 | + if( !is_array( $override ) ){ |
|
468 | + $override = array(); |
|
469 | + } |
|
470 | + foreach( $default as $key => $value ){ |
|
471 | + if( !array_key_exists($key, $override) ){ |
|
472 | + $override[$key] = $value; |
|
473 | + } |
|
474 | + else if( is_array( $key ) ){ |
|
475 | + $override[$key] = sugar_config_union( $value, $override[$key] ); |
|
476 | + } |
|
477 | + } |
|
478 | + return( $override ); |
|
479 | 479 | } |
480 | 480 | |
481 | 481 | function make_not_writable( $file ){ |
482 | - // Returns true if the given file/dir has been made not writable |
|
483 | - $ret_val = false; |
|
484 | - if( is_file($file) || is_dir($file) ){ |
|
485 | - if( !is_writable($file) ){ |
|
486 | - $ret_val = true; |
|
487 | - } |
|
488 | - else { |
|
489 | - $original_fileperms = fileperms($file); |
|
490 | - |
|
491 | - // take away writable permissions |
|
492 | - $new_fileperms = $original_fileperms & ~0x0092; |
|
493 | - @sugar_chmod($file, $new_fileperms); |
|
494 | - |
|
495 | - if( !is_writable($file) ){ |
|
496 | - $ret_val = true; |
|
497 | - } |
|
498 | - } |
|
499 | - } |
|
500 | - return $ret_val; |
|
482 | + // Returns true if the given file/dir has been made not writable |
|
483 | + $ret_val = false; |
|
484 | + if( is_file($file) || is_dir($file) ){ |
|
485 | + if( !is_writable($file) ){ |
|
486 | + $ret_val = true; |
|
487 | + } |
|
488 | + else { |
|
489 | + $original_fileperms = fileperms($file); |
|
490 | + |
|
491 | + // take away writable permissions |
|
492 | + $new_fileperms = $original_fileperms & ~0x0092; |
|
493 | + @sugar_chmod($file, $new_fileperms); |
|
494 | + |
|
495 | + if( !is_writable($file) ){ |
|
496 | + $ret_val = true; |
|
497 | + } |
|
498 | + } |
|
499 | + } |
|
500 | + return $ret_val; |
|
501 | 501 | } |
502 | 502 | |
503 | 503 | |
@@ -511,76 +511,76 @@ discard block |
||
511 | 511 | */ |
512 | 512 | function return_name($row, $first_column, $last_column) |
513 | 513 | { |
514 | - $first_name = ""; |
|
515 | - $last_name = ""; |
|
516 | - $full_name = ""; |
|
514 | + $first_name = ""; |
|
515 | + $last_name = ""; |
|
516 | + $full_name = ""; |
|
517 | 517 | |
518 | - if(isset($row[$first_column])) |
|
519 | - { |
|
520 | - $first_name = stripslashes($row[$first_column]); |
|
521 | - } |
|
518 | + if(isset($row[$first_column])) |
|
519 | + { |
|
520 | + $first_name = stripslashes($row[$first_column]); |
|
521 | + } |
|
522 | 522 | |
523 | - if(isset($row[$last_column])) |
|
524 | - { |
|
525 | - $last_name = stripslashes($row[$last_column]); |
|
526 | - } |
|
523 | + if(isset($row[$last_column])) |
|
524 | + { |
|
525 | + $last_name = stripslashes($row[$last_column]); |
|
526 | + } |
|
527 | 527 | |
528 | - $full_name = $first_name; |
|
528 | + $full_name = $first_name; |
|
529 | 529 | |
530 | - // If we have a first name and we have a last name |
|
531 | - if($full_name != "" && $last_name != "") |
|
532 | - { |
|
533 | - // append a space, then the last name |
|
534 | - $full_name .= " ".$last_name; |
|
535 | - } |
|
536 | - // If we have no first name, but we have a last name |
|
537 | - else if($last_name != "") |
|
538 | - { |
|
539 | - // append the last name without the space. |
|
540 | - $full_name .= $last_name; |
|
541 | - } |
|
530 | + // If we have a first name and we have a last name |
|
531 | + if($full_name != "" && $last_name != "") |
|
532 | + { |
|
533 | + // append a space, then the last name |
|
534 | + $full_name .= " ".$last_name; |
|
535 | + } |
|
536 | + // If we have no first name, but we have a last name |
|
537 | + else if($last_name != "") |
|
538 | + { |
|
539 | + // append the last name without the space. |
|
540 | + $full_name .= $last_name; |
|
541 | + } |
|
542 | 542 | |
543 | - return $full_name; |
|
543 | + return $full_name; |
|
544 | 544 | } |
545 | 545 | |
546 | 546 | |
547 | 547 | function get_languages() |
548 | 548 | { |
549 | - global $sugar_config; |
|
550 | - $lang = $sugar_config['languages']; |
|
549 | + global $sugar_config; |
|
550 | + $lang = $sugar_config['languages']; |
|
551 | 551 | if(!empty($sugar_config['disabled_languages'])){ |
552 | 552 | foreach(explode(',', $sugar_config['disabled_languages']) as $disable) { |
553 | 553 | unset($lang[$disable]); |
554 | 554 | } |
555 | 555 | } |
556 | - return $lang; |
|
556 | + return $lang; |
|
557 | 557 | } |
558 | 558 | |
559 | 559 | function get_all_languages() |
560 | 560 | { |
561 | - global $sugar_config; |
|
562 | - return $sugar_config['languages']; |
|
561 | + global $sugar_config; |
|
562 | + return $sugar_config['languages']; |
|
563 | 563 | } |
564 | 564 | |
565 | 565 | |
566 | 566 | function get_language_display($key) |
567 | 567 | { |
568 | - global $sugar_config; |
|
569 | - return $sugar_config['languages'][$key]; |
|
568 | + global $sugar_config; |
|
569 | + return $sugar_config['languages'][$key]; |
|
570 | 570 | } |
571 | 571 | |
572 | 572 | function get_assigned_user_name($assigned_user_id, $is_group = '') { |
573 | - static $saved_user_list = null; |
|
573 | + static $saved_user_list = null; |
|
574 | 574 | |
575 | - if(empty($saved_user_list)) { |
|
576 | - $saved_user_list = get_user_array(false, '', '', false, null, $is_group); |
|
577 | - } |
|
575 | + if(empty($saved_user_list)) { |
|
576 | + $saved_user_list = get_user_array(false, '', '', false, null, $is_group); |
|
577 | + } |
|
578 | 578 | |
579 | - if(isset($saved_user_list[$assigned_user_id])) { |
|
580 | - return $saved_user_list[$assigned_user_id]; |
|
581 | - } |
|
579 | + if(isset($saved_user_list[$assigned_user_id])) { |
|
580 | + return $saved_user_list[$assigned_user_id]; |
|
581 | + } |
|
582 | 582 | |
583 | - return ''; |
|
583 | + return ''; |
|
584 | 584 | } |
585 | 585 | |
586 | 586 | /** |
@@ -589,16 +589,16 @@ discard block |
||
589 | 589 | * @return string |
590 | 590 | */ |
591 | 591 | function get_user_name($id) { |
592 | - global $db; |
|
592 | + global $db; |
|
593 | 593 | |
594 | - if(empty($db)) |
|
595 | - $db = DBManagerFactory::getInstance(); |
|
594 | + if(empty($db)) |
|
595 | + $db = DBManagerFactory::getInstance(); |
|
596 | 596 | |
597 | - $q = "SELECT user_name FROM users WHERE id='{$id}'"; |
|
598 | - $r = $db->query($q); |
|
599 | - $a = $db->fetchByAssoc($r); |
|
597 | + $q = "SELECT user_name FROM users WHERE id='{$id}'"; |
|
598 | + $r = $db->query($q); |
|
599 | + $a = $db->fetchByAssoc($r); |
|
600 | 600 | |
601 | - return (empty($a)) ? '' : $a['user_name']; |
|
601 | + return (empty($a)) ? '' : $a['user_name']; |
|
602 | 602 | } |
603 | 603 | |
604 | 604 | |
@@ -620,27 +620,27 @@ discard block |
||
620 | 620 | * @return array Array of users matching the filter criteria that may be from cache (if similar search was previously run) |
621 | 621 | */ |
622 | 622 | function get_user_array($add_blank=true, $status="Active", $user_id='', $use_real_name=false, $user_name_filter='', $portal_filter=' AND portal_only=0 ', $from_cache = true) { |
623 | - global $locale, $sugar_config, $current_user; |
|
623 | + global $locale, $sugar_config, $current_user; |
|
624 | 624 | |
625 | - if(empty($locale)) { |
|
626 | - $locale = new Localization(); |
|
627 | - } |
|
625 | + if(empty($locale)) { |
|
626 | + $locale = new Localization(); |
|
627 | + } |
|
628 | 628 | |
629 | - if($from_cache) { |
|
629 | + if($from_cache) { |
|
630 | 630 | $key_name = $add_blank. $status . $user_id . $use_real_name . $user_name_filter . $portal_filter; |
631 | - $user_array = get_register_value('user_array', $key_name); |
|
632 | - } |
|
633 | - |
|
634 | - if(empty($user_array)) { |
|
635 | - $db = DBManagerFactory::getInstance(); |
|
636 | - $temp_result = Array(); |
|
637 | - // Including deleted users for now. |
|
638 | - if (empty($status)) { |
|
639 | - $query = "SELECT id, first_name, last_name, user_name from users WHERE 1=1".$portal_filter; |
|
640 | - } |
|
641 | - else { |
|
642 | - $query = "SELECT id, first_name, last_name, user_name from users WHERE status='$status'".$portal_filter; |
|
643 | - } |
|
631 | + $user_array = get_register_value('user_array', $key_name); |
|
632 | + } |
|
633 | + |
|
634 | + if(empty($user_array)) { |
|
635 | + $db = DBManagerFactory::getInstance(); |
|
636 | + $temp_result = Array(); |
|
637 | + // Including deleted users for now. |
|
638 | + if (empty($status)) { |
|
639 | + $query = "SELECT id, first_name, last_name, user_name from users WHERE 1=1".$portal_filter; |
|
640 | + } |
|
641 | + else { |
|
642 | + $query = "SELECT id, first_name, last_name, user_name from users WHERE status='$status'".$portal_filter; |
|
643 | + } |
|
644 | 644 | /* BEGIN - SECURITY GROUPS */ |
645 | 645 | global $current_user, $sugar_config; |
646 | 646 | if(!is_admin($current_user) |
@@ -655,13 +655,13 @@ discard block |
||
655 | 655 | $query .= " AND (".$group_where.") "; |
656 | 656 | } |
657 | 657 | /* END - SECURITY GROUPS */ |
658 | - if (!empty($user_name_filter)) { |
|
659 | - $user_name_filter = $db->quote($user_name_filter); |
|
660 | - $query .= " AND user_name LIKE '$user_name_filter%' "; |
|
661 | - } |
|
662 | - if (!empty($user_id)) { |
|
663 | - $query .= " OR id='{$user_id}'"; |
|
664 | - } |
|
658 | + if (!empty($user_name_filter)) { |
|
659 | + $user_name_filter = $db->quote($user_name_filter); |
|
660 | + $query .= " AND user_name LIKE '$user_name_filter%' "; |
|
661 | + } |
|
662 | + if (!empty($user_id)) { |
|
663 | + $query .= " OR id='{$user_id}'"; |
|
664 | + } |
|
665 | 665 | |
666 | 666 | //get the user preference for name formatting, to be used in order by |
667 | 667 | $order_by_string =' user_name ASC '; |
@@ -683,37 +683,37 @@ discard block |
||
683 | 683 | } |
684 | 684 | } |
685 | 685 | |
686 | - $query = $query.' ORDER BY '.$order_by_string; |
|
687 | - $GLOBALS['log']->debug("get_user_array query: $query"); |
|
688 | - $result = $db->query($query, true, "Error filling in user array: "); |
|
689 | - |
|
690 | - if ($add_blank==true) { |
|
691 | - // Add in a blank row |
|
692 | - $temp_result[''] = ''; |
|
693 | - } |
|
694 | - |
|
695 | - // Get the id and the name. |
|
696 | - while($row = $db->fetchByAssoc($result)) { |
|
697 | - if($use_real_name == true || showFullName()) { |
|
698 | - if(isset($row['last_name'])) { // cn: we will ALWAYS have both first_name and last_name (empty value if blank in db) |
|
699 | - $temp_result[$row['id']] = $locale->getLocaleFormattedName($row['first_name'],$row['last_name']); |
|
700 | - } else { |
|
701 | - $temp_result[$row['id']] = $row['user_name']; |
|
702 | - } |
|
703 | - } else { |
|
704 | - $temp_result[$row['id']] = $row['user_name']; |
|
705 | - } |
|
706 | - } |
|
686 | + $query = $query.' ORDER BY '.$order_by_string; |
|
687 | + $GLOBALS['log']->debug("get_user_array query: $query"); |
|
688 | + $result = $db->query($query, true, "Error filling in user array: "); |
|
689 | + |
|
690 | + if ($add_blank==true) { |
|
691 | + // Add in a blank row |
|
692 | + $temp_result[''] = ''; |
|
693 | + } |
|
694 | + |
|
695 | + // Get the id and the name. |
|
696 | + while($row = $db->fetchByAssoc($result)) { |
|
697 | + if($use_real_name == true || showFullName()) { |
|
698 | + if(isset($row['last_name'])) { // cn: we will ALWAYS have both first_name and last_name (empty value if blank in db) |
|
699 | + $temp_result[$row['id']] = $locale->getLocaleFormattedName($row['first_name'],$row['last_name']); |
|
700 | + } else { |
|
701 | + $temp_result[$row['id']] = $row['user_name']; |
|
702 | + } |
|
703 | + } else { |
|
704 | + $temp_result[$row['id']] = $row['user_name']; |
|
705 | + } |
|
706 | + } |
|
707 | 707 | |
708 | - $user_array = $temp_result; |
|
709 | - if($from_cache) |
|
708 | + $user_array = $temp_result; |
|
709 | + if($from_cache) |
|
710 | 710 | { |
711 | - set_register_value('user_array', $key_name, $temp_result); |
|
711 | + set_register_value('user_array', $key_name, $temp_result); |
|
712 | 712 | } |
713 | - } |
|
713 | + } |
|
714 | 714 | |
715 | 715 | |
716 | - return $user_array; |
|
716 | + return $user_array; |
|
717 | 717 | } |
718 | 718 | |
719 | 719 | |
@@ -724,11 +724,11 @@ discard block |
||
724 | 724 | * @return array Array of Users' details that match passed criteria |
725 | 725 | */ |
726 | 726 | function getUserArrayFromFullName($args, $hide_portal_users = false) { |
727 | - global $locale; |
|
728 | - $db = DBManagerFactory::getInstance(); |
|
727 | + global $locale; |
|
728 | + $db = DBManagerFactory::getInstance(); |
|
729 | 729 | |
730 | - // jmorais@dri - Bug #51411 |
|
731 | - // |
|
730 | + // jmorais@dri - Bug #51411 |
|
731 | + // |
|
732 | 732 | // Refactor the code responsible for parsing supplied $args, this way we |
733 | 733 | // ensure that if $args has at least one space (after trim), the $inClause |
734 | 734 | // will be composed by several clauses ($inClauses) inside parenthesis. |
@@ -754,11 +754,11 @@ discard block |
||
754 | 754 | } |
755 | 755 | // ~jmorais@dri |
756 | 756 | |
757 | - $query = "SELECT id, first_name, last_name, user_name FROM users WHERE status='Active' AND deleted=0 AND "; |
|
758 | - if ( $hide_portal_users ) { |
|
759 | - $query .= " portal_only=0 AND "; |
|
760 | - } |
|
761 | - $query .= $inClause; |
|
757 | + $query = "SELECT id, first_name, last_name, user_name FROM users WHERE status='Active' AND deleted=0 AND "; |
|
758 | + if ( $hide_portal_users ) { |
|
759 | + $query .= " portal_only=0 AND "; |
|
760 | + } |
|
761 | + $query .= $inClause; |
|
762 | 762 | /* BEGIN - SECURITY GROUPS */ |
763 | 763 | global $current_user, $sugar_config; |
764 | 764 | if(!is_admin($current_user) |
@@ -771,15 +771,15 @@ discard block |
||
771 | 771 | $query .= " AND (".$group_where.") "; |
772 | 772 | } |
773 | 773 | /* END - SECURITY GROUPS */ |
774 | - $query .= " ORDER BY last_name ASC"; |
|
774 | + $query .= " ORDER BY last_name ASC"; |
|
775 | 775 | |
776 | - $r = $db->query($query); |
|
777 | - $ret = array(); |
|
778 | - while($a = $db->fetchByAssoc($r)) { |
|
779 | - $ret[$a['id']] = $locale->getLocaleFormattedName($a['first_name'], $a['last_name']); |
|
780 | - } |
|
776 | + $r = $db->query($query); |
|
777 | + $ret = array(); |
|
778 | + while($a = $db->fetchByAssoc($r)) { |
|
779 | + $ret[$a['id']] = $locale->getLocaleFormattedName($a['first_name'], $a['last_name']); |
|
780 | + } |
|
781 | 781 | |
782 | - return $ret; |
|
782 | + return $ret; |
|
783 | 783 | } |
784 | 784 | |
785 | 785 | /** |
@@ -787,28 +787,28 @@ discard block |
||
787 | 787 | * based on user pref then system pref |
788 | 788 | */ |
789 | 789 | function showFullName() { |
790 | - global $sugar_config; |
|
791 | - global $current_user; |
|
792 | - static $showFullName = null; |
|
793 | - |
|
794 | - if (is_null($showFullName)) { |
|
795 | - $sysPref = !empty($sugar_config['use_real_names']); |
|
796 | - $userPref = (is_object($current_user)) ? $current_user->getPreference('use_real_names') : null; |
|
797 | - |
|
798 | - if($userPref != null) { |
|
799 | - $showFullName = ($userPref == 'on'); |
|
800 | - } else { |
|
801 | - $showFullName = $sysPref; |
|
802 | - } |
|
803 | - } |
|
790 | + global $sugar_config; |
|
791 | + global $current_user; |
|
792 | + static $showFullName = null; |
|
793 | + |
|
794 | + if (is_null($showFullName)) { |
|
795 | + $sysPref = !empty($sugar_config['use_real_names']); |
|
796 | + $userPref = (is_object($current_user)) ? $current_user->getPreference('use_real_names') : null; |
|
797 | + |
|
798 | + if($userPref != null) { |
|
799 | + $showFullName = ($userPref == 'on'); |
|
800 | + } else { |
|
801 | + $showFullName = $sysPref; |
|
802 | + } |
|
803 | + } |
|
804 | 804 | |
805 | - return $showFullName; |
|
805 | + return $showFullName; |
|
806 | 806 | } |
807 | 807 | |
808 | 808 | function clean($string, $maxLength) |
809 | 809 | { |
810 | - $string = substr($string, 0, $maxLength); |
|
811 | - return escapeshellcmd($string); |
|
810 | + $string = substr($string, 0, $maxLength); |
|
811 | + return escapeshellcmd($string); |
|
812 | 812 | } |
813 | 813 | |
814 | 814 | /** |
@@ -820,7 +820,7 @@ discard block |
||
820 | 820 | */ |
821 | 821 | function safe_map($request_var, & $focus, $always_copy = false) |
822 | 822 | { |
823 | - safe_map_named($request_var, $focus, $request_var, $always_copy); |
|
823 | + safe_map_named($request_var, $focus, $request_var, $always_copy); |
|
824 | 824 | } |
825 | 825 | |
826 | 826 | /** |
@@ -832,10 +832,10 @@ discard block |
||
832 | 832 | */ |
833 | 833 | function safe_map_named($request_var, & $focus, $member_var, $always_copy) |
834 | 834 | { |
835 | - if (isset($_REQUEST[$request_var]) && ($always_copy || is_null($focus->$member_var))) { |
|
836 | - $GLOBALS['log']->debug("safe map named called assigning '{$_REQUEST[$request_var]}' to $member_var"); |
|
837 | - $focus->$member_var = $_REQUEST[$request_var]; |
|
838 | - } |
|
835 | + if (isset($_REQUEST[$request_var]) && ($always_copy || is_null($focus->$member_var))) { |
|
836 | + $GLOBALS['log']->debug("safe map named called assigning '{$_REQUEST[$request_var]}' to $member_var"); |
|
837 | + $focus->$member_var = $_REQUEST[$request_var]; |
|
838 | + } |
|
839 | 839 | } |
840 | 840 | |
841 | 841 | /** |
@@ -846,35 +846,35 @@ discard block |
||
846 | 846 | */ |
847 | 847 | function return_app_list_strings_language($language) |
848 | 848 | { |
849 | - global $app_list_strings; |
|
850 | - global $sugar_config; |
|
849 | + global $app_list_strings; |
|
850 | + global $sugar_config; |
|
851 | 851 | |
852 | - $cache_key = 'app_list_strings.'.$language; |
|
852 | + $cache_key = 'app_list_strings.'.$language; |
|
853 | 853 | |
854 | - // Check for cached value |
|
855 | - $cache_entry = sugar_cache_retrieve($cache_key); |
|
856 | - if(!empty($cache_entry)) |
|
857 | - { |
|
858 | - return $cache_entry; |
|
859 | - } |
|
854 | + // Check for cached value |
|
855 | + $cache_entry = sugar_cache_retrieve($cache_key); |
|
856 | + if(!empty($cache_entry)) |
|
857 | + { |
|
858 | + return $cache_entry; |
|
859 | + } |
|
860 | 860 | |
861 | - $default_language = isset($sugar_config['default_language']) ? $sugar_config['default_language'] : 'en_us'; |
|
862 | - $temp_app_list_strings = $app_list_strings; |
|
861 | + $default_language = isset($sugar_config['default_language']) ? $sugar_config['default_language'] : 'en_us'; |
|
862 | + $temp_app_list_strings = $app_list_strings; |
|
863 | 863 | |
864 | - $langs = array(); |
|
865 | - if ($language != 'en_us') { |
|
866 | - $langs[] = 'en_us'; |
|
867 | - } |
|
868 | - if ($default_language != 'en_us' && $language != $default_language) { |
|
869 | - $langs[] = $default_language; |
|
870 | - } |
|
871 | - $langs[] = $language; |
|
864 | + $langs = array(); |
|
865 | + if ($language != 'en_us') { |
|
866 | + $langs[] = 'en_us'; |
|
867 | + } |
|
868 | + if ($default_language != 'en_us' && $language != $default_language) { |
|
869 | + $langs[] = $default_language; |
|
870 | + } |
|
871 | + $langs[] = $language; |
|
872 | 872 | |
873 | - $app_list_strings_array = array(); |
|
873 | + $app_list_strings_array = array(); |
|
874 | 874 | |
875 | - foreach ( $langs as $lang ) { |
|
876 | - $app_list_strings = array(); |
|
877 | - if(file_exists("include/language/$lang.lang.php")) { |
|
875 | + foreach ( $langs as $lang ) { |
|
876 | + $app_list_strings = array(); |
|
877 | + if(file_exists("include/language/$lang.lang.php")) { |
|
878 | 878 | include("include/language/$lang.lang.php"); |
879 | 879 | $GLOBALS['log']->info("Found language file: $lang.lang.php"); |
880 | 880 | } |
@@ -906,17 +906,17 @@ discard block |
||
906 | 906 | } |
907 | 907 | } |
908 | 908 | |
909 | - if(!isset($app_list_strings)) { |
|
910 | - $GLOBALS['log']->fatal("Unable to load the application language file for the selected language ($language) or the default language ($default_language) or the en_us language"); |
|
911 | - return null; |
|
912 | - } |
|
909 | + if(!isset($app_list_strings)) { |
|
910 | + $GLOBALS['log']->fatal("Unable to load the application language file for the selected language ($language) or the default language ($default_language) or the en_us language"); |
|
911 | + return null; |
|
912 | + } |
|
913 | 913 | |
914 | - $return_value = $app_list_strings; |
|
915 | - $app_list_strings = $temp_app_list_strings; |
|
914 | + $return_value = $app_list_strings; |
|
915 | + $app_list_strings = $temp_app_list_strings; |
|
916 | 916 | |
917 | - sugar_cache_put($cache_key, $return_value); |
|
917 | + sugar_cache_put($cache_key, $return_value); |
|
918 | 918 | |
919 | - return $return_value; |
|
919 | + return $return_value; |
|
920 | 920 | } |
921 | 921 | |
922 | 922 | /** |
@@ -926,33 +926,33 @@ discard block |
||
926 | 926 | * @param app_list_strings array the golbal strings |
927 | 927 | * @return array |
928 | 928 | */ |
929 | - //jchi 25347 |
|
929 | + //jchi 25347 |
|
930 | 930 | function _mergeCustomAppListStrings($file , $app_list_strings){ |
931 | - $app_list_strings_original = $app_list_strings; |
|
932 | - unset($app_list_strings); |
|
931 | + $app_list_strings_original = $app_list_strings; |
|
932 | + unset($app_list_strings); |
|
933 | 933 | // FG - bug 45525 - $exemptDropdown array is defined (once) here, not inside the foreach |
934 | 934 | // This way, language file can add items to save specific standard codelist from being overwritten |
935 | 935 | $exemptDropdowns = array(); |
936 | - include($file); |
|
937 | - if(!isset($app_list_strings) || !is_array($app_list_strings)){ |
|
938 | - return $app_list_strings_original; |
|
939 | - } |
|
940 | - //Bug 25347: We should not merge custom dropdown fields unless they relate to parent fields or the module list. |
|
936 | + include($file); |
|
937 | + if(!isset($app_list_strings) || !is_array($app_list_strings)){ |
|
938 | + return $app_list_strings_original; |
|
939 | + } |
|
940 | + //Bug 25347: We should not merge custom dropdown fields unless they relate to parent fields or the module list. |
|
941 | 941 | |
942 | 942 | // FG - bug 45525 - Specific codelists must NOT be overwritten |
943 | - $exemptDropdowns[] = "moduleList"; |
|
944 | - $exemptDropdowns[] = "moduleListSingular"; |
|
943 | + $exemptDropdowns[] = "moduleList"; |
|
944 | + $exemptDropdowns[] = "moduleListSingular"; |
|
945 | 945 | $exemptDropdowns = array_merge($exemptDropdowns, getTypeDisplayList()); |
946 | 946 | |
947 | - foreach($app_list_strings as $key=>$value) |
|
948 | - { |
|
949 | - if (!in_array($key, $exemptDropdowns) && array_key_exists($key, $app_list_strings_original)) |
|
950 | - { |
|
951 | - unset($app_list_strings_original["$key"]); |
|
952 | - } |
|
953 | - } |
|
954 | - $app_list_strings = sugarArrayMergeRecursive($app_list_strings_original , $app_list_strings); |
|
955 | - return $app_list_strings; |
|
947 | + foreach($app_list_strings as $key=>$value) |
|
948 | + { |
|
949 | + if (!in_array($key, $exemptDropdowns) && array_key_exists($key, $app_list_strings_original)) |
|
950 | + { |
|
951 | + unset($app_list_strings_original["$key"]); |
|
952 | + } |
|
953 | + } |
|
954 | + $app_list_strings = sugarArrayMergeRecursive($app_list_strings_original , $app_list_strings); |
|
955 | + return $app_list_strings; |
|
956 | 956 | } |
957 | 957 | |
958 | 958 | /** |
@@ -963,35 +963,35 @@ discard block |
||
963 | 963 | */ |
964 | 964 | function return_application_language($language) |
965 | 965 | { |
966 | - global $app_strings, $sugar_config; |
|
966 | + global $app_strings, $sugar_config; |
|
967 | 967 | |
968 | - $cache_key = 'app_strings.'.$language; |
|
968 | + $cache_key = 'app_strings.'.$language; |
|
969 | 969 | |
970 | - // Check for cached value |
|
971 | - $cache_entry = sugar_cache_retrieve($cache_key); |
|
972 | - if(!empty($cache_entry)) |
|
973 | - { |
|
974 | - return $cache_entry; |
|
975 | - } |
|
970 | + // Check for cached value |
|
971 | + $cache_entry = sugar_cache_retrieve($cache_key); |
|
972 | + if(!empty($cache_entry)) |
|
973 | + { |
|
974 | + return $cache_entry; |
|
975 | + } |
|
976 | 976 | |
977 | - $temp_app_strings = $app_strings; |
|
978 | - $default_language = $sugar_config['default_language']; |
|
977 | + $temp_app_strings = $app_strings; |
|
978 | + $default_language = $sugar_config['default_language']; |
|
979 | 979 | |
980 | - $langs = array(); |
|
981 | - if ($language != 'en_us') { |
|
982 | - $langs[] = 'en_us'; |
|
983 | - } |
|
984 | - if ($default_language != 'en_us' && $language != $default_language) { |
|
985 | - $langs[] = $default_language; |
|
986 | - } |
|
980 | + $langs = array(); |
|
981 | + if ($language != 'en_us') { |
|
982 | + $langs[] = 'en_us'; |
|
983 | + } |
|
984 | + if ($default_language != 'en_us' && $language != $default_language) { |
|
985 | + $langs[] = $default_language; |
|
986 | + } |
|
987 | 987 | |
988 | - $langs[] = $language; |
|
988 | + $langs[] = $language; |
|
989 | 989 | |
990 | - $app_strings_array = array(); |
|
990 | + $app_strings_array = array(); |
|
991 | 991 | |
992 | - foreach ( $langs as $lang ) { |
|
993 | - $app_strings = array(); |
|
994 | - if(file_exists("include/language/$lang.lang.php")) { |
|
992 | + foreach ( $langs as $lang ) { |
|
993 | + $app_strings = array(); |
|
994 | + if(file_exists("include/language/$lang.lang.php")) { |
|
995 | 995 | include("include/language/$lang.lang.php"); |
996 | 996 | $GLOBALS['log']->info("Found language file: $lang.lang.php"); |
997 | 997 | } |
@@ -1012,40 +1012,40 @@ discard block |
||
1012 | 1012 | $GLOBALS['log']->info("Found custom language file: $lang.lang.php"); |
1013 | 1013 | } |
1014 | 1014 | $app_strings_array[] = $app_strings; |
1015 | - } |
|
1015 | + } |
|
1016 | 1016 | |
1017 | - $app_strings = array(); |
|
1017 | + $app_strings = array(); |
|
1018 | 1018 | foreach ( $app_strings_array as $app_strings_item ) { |
1019 | 1019 | $app_strings = sugarLangArrayMerge($app_strings, $app_strings_item); |
1020 | 1020 | } |
1021 | 1021 | |
1022 | - if(!isset($app_strings)) { |
|
1023 | - $GLOBALS['log']->fatal("Unable to load the application language strings"); |
|
1024 | - return null; |
|
1025 | - } |
|
1022 | + if(!isset($app_strings)) { |
|
1023 | + $GLOBALS['log']->fatal("Unable to load the application language strings"); |
|
1024 | + return null; |
|
1025 | + } |
|
1026 | 1026 | |
1027 | - // If we are in debug mode for translating, turn on the prefix now! |
|
1027 | + // If we are in debug mode for translating, turn on the prefix now! |
|
1028 | 1028 | if(!empty($sugar_config['translation_string_prefix'])) |
1029 | 1029 | { |
1030 | - foreach($app_strings as $entry_key=>$entry_value) { |
|
1031 | - $app_strings[$entry_key] = $language.' '.$entry_value; |
|
1032 | - } |
|
1033 | - } |
|
1034 | - if(isset($_SESSION['show_deleted'])) { |
|
1035 | - $app_strings['LBL_DELETE_BUTTON'] = $app_strings['LBL_UNDELETE_BUTTON']; |
|
1036 | - $app_strings['LBL_DELETE_BUTTON_LABEL'] = $app_strings['LBL_UNDELETE_BUTTON_LABEL']; |
|
1037 | - $app_strings['LBL_DELETE_BUTTON_TITLE'] = $app_strings['LBL_UNDELETE_BUTTON_TITLE']; |
|
1038 | - $app_strings['LBL_DELETE'] = $app_strings['LBL_UNDELETE']; |
|
1039 | - } |
|
1030 | + foreach($app_strings as $entry_key=>$entry_value) { |
|
1031 | + $app_strings[$entry_key] = $language.' '.$entry_value; |
|
1032 | + } |
|
1033 | + } |
|
1034 | + if(isset($_SESSION['show_deleted'])) { |
|
1035 | + $app_strings['LBL_DELETE_BUTTON'] = $app_strings['LBL_UNDELETE_BUTTON']; |
|
1036 | + $app_strings['LBL_DELETE_BUTTON_LABEL'] = $app_strings['LBL_UNDELETE_BUTTON_LABEL']; |
|
1037 | + $app_strings['LBL_DELETE_BUTTON_TITLE'] = $app_strings['LBL_UNDELETE_BUTTON_TITLE']; |
|
1038 | + $app_strings['LBL_DELETE'] = $app_strings['LBL_UNDELETE']; |
|
1039 | + } |
|
1040 | 1040 | |
1041 | - $app_strings['LBL_ALT_HOT_KEY'] = get_alt_hot_key(); |
|
1041 | + $app_strings['LBL_ALT_HOT_KEY'] = get_alt_hot_key(); |
|
1042 | 1042 | |
1043 | - $return_value = $app_strings; |
|
1044 | - $app_strings = $temp_app_strings; |
|
1043 | + $return_value = $app_strings; |
|
1044 | + $app_strings = $temp_app_strings; |
|
1045 | 1045 | |
1046 | - sugar_cache_put($cache_key, $return_value); |
|
1046 | + sugar_cache_put($cache_key, $return_value); |
|
1047 | 1047 | |
1048 | - return $return_value; |
|
1048 | + return $return_value; |
|
1049 | 1049 | } |
1050 | 1050 | |
1051 | 1051 | /** |
@@ -1058,16 +1058,16 @@ discard block |
||
1058 | 1058 | */ |
1059 | 1059 | function return_module_language($language, $module, $refresh=false) |
1060 | 1060 | { |
1061 | - global $mod_strings; |
|
1062 | - global $sugar_config; |
|
1063 | - global $currentModule; |
|
1064 | - |
|
1065 | - // Jenny - Bug 8119: Need to check if $module is not empty |
|
1066 | - if (empty($module)) { |
|
1067 | - $stack = debug_backtrace(); |
|
1068 | - $GLOBALS['log']->warn("Variable module is not in return_module_language ". var_export($stack, true)); |
|
1069 | - return array(); |
|
1070 | - } |
|
1061 | + global $mod_strings; |
|
1062 | + global $sugar_config; |
|
1063 | + global $currentModule; |
|
1064 | + |
|
1065 | + // Jenny - Bug 8119: Need to check if $module is not empty |
|
1066 | + if (empty($module)) { |
|
1067 | + $stack = debug_backtrace(); |
|
1068 | + $GLOBALS['log']->warn("Variable module is not in return_module_language ". var_export($stack, true)); |
|
1069 | + return array(); |
|
1070 | + } |
|
1071 | 1071 | |
1072 | 1072 | if( !$refresh ) |
1073 | 1073 | { |
@@ -1079,28 +1079,28 @@ discard block |
||
1079 | 1079 | return $cache_entry; |
1080 | 1080 | } |
1081 | 1081 | } |
1082 | - // Store the current mod strings for later |
|
1083 | - $temp_mod_strings = $mod_strings; |
|
1084 | - $loaded_mod_strings = array(); |
|
1085 | - $language_used = $language; |
|
1086 | - $default_language = $sugar_config['default_language']; |
|
1087 | - |
|
1088 | - if(empty($language)) { |
|
1089 | - $language = $default_language; |
|
1090 | - } |
|
1082 | + // Store the current mod strings for later |
|
1083 | + $temp_mod_strings = $mod_strings; |
|
1084 | + $loaded_mod_strings = array(); |
|
1085 | + $language_used = $language; |
|
1086 | + $default_language = $sugar_config['default_language']; |
|
1087 | + |
|
1088 | + if(empty($language)) { |
|
1089 | + $language = $default_language; |
|
1090 | + } |
|
1091 | 1091 | |
1092 | - // Bug 21559 - So we can get all the strings defined in the template, refresh |
|
1093 | - // the vardefs file if the cached language file doesn't exist. |
|
1092 | + // Bug 21559 - So we can get all the strings defined in the template, refresh |
|
1093 | + // the vardefs file if the cached language file doesn't exist. |
|
1094 | 1094 | if(!file_exists(sugar_cached('modules/'). $module . '/language/'.$language.'.lang.php') |
1095 | - && !empty($GLOBALS['beanList'][$module])){ |
|
1096 | - $object = BeanFactory::getObjectName($module); |
|
1097 | - VardefManager::refreshVardefs($module,$object); |
|
1098 | - } |
|
1095 | + && !empty($GLOBALS['beanList'][$module])){ |
|
1096 | + $object = BeanFactory::getObjectName($module); |
|
1097 | + VardefManager::refreshVardefs($module,$object); |
|
1098 | + } |
|
1099 | 1099 | |
1100 | - $loaded_mod_strings = LanguageManager::loadModuleLanguage($module, $language,$refresh); |
|
1100 | + $loaded_mod_strings = LanguageManager::loadModuleLanguage($module, $language,$refresh); |
|
1101 | 1101 | |
1102 | - // cn: bug 6048 - merge en_us with requested language |
|
1103 | - if($language != $sugar_config['default_language']) |
|
1102 | + // cn: bug 6048 - merge en_us with requested language |
|
1103 | + if($language != $sugar_config['default_language']) |
|
1104 | 1104 | $loaded_mod_strings = sugarLangArrayMerge( |
1105 | 1105 | LanguageManager::loadModuleLanguage($module, $sugar_config['default_language'],$refresh), |
1106 | 1106 | $loaded_mod_strings |
@@ -1113,23 +1113,23 @@ discard block |
||
1113 | 1113 | $loaded_mod_strings |
1114 | 1114 | ); |
1115 | 1115 | |
1116 | - // If we are in debug mode for translating, turn on the prefix now! |
|
1117 | - if($sugar_config['translation_string_prefix']) { |
|
1118 | - foreach($loaded_mod_strings as $entry_key=>$entry_value) { |
|
1119 | - $loaded_mod_strings[$entry_key] = $language_used.' '.$entry_value; |
|
1120 | - } |
|
1121 | - } |
|
1116 | + // If we are in debug mode for translating, turn on the prefix now! |
|
1117 | + if($sugar_config['translation_string_prefix']) { |
|
1118 | + foreach($loaded_mod_strings as $entry_key=>$entry_value) { |
|
1119 | + $loaded_mod_strings[$entry_key] = $language_used.' '.$entry_value; |
|
1120 | + } |
|
1121 | + } |
|
1122 | 1122 | |
1123 | - $return_value = $loaded_mod_strings; |
|
1124 | - if(!isset($mod_strings)){ |
|
1125 | - $mod_strings = $return_value; |
|
1126 | - } |
|
1127 | - else |
|
1128 | - $mod_strings = $temp_mod_strings; |
|
1123 | + $return_value = $loaded_mod_strings; |
|
1124 | + if(!isset($mod_strings)){ |
|
1125 | + $mod_strings = $return_value; |
|
1126 | + } |
|
1127 | + else |
|
1128 | + $mod_strings = $temp_mod_strings; |
|
1129 | 1129 | |
1130 | 1130 | $cache_key = LanguageManager::getLanguageCacheKey($module, $language); |
1131 | 1131 | sugar_cache_put($cache_key, $return_value); |
1132 | - return $return_value; |
|
1132 | + return $return_value; |
|
1133 | 1133 | } |
1134 | 1134 | |
1135 | 1135 | |
@@ -1139,61 +1139,61 @@ discard block |
||
1139 | 1139 | * Contributor(s): ______________________________________.. |
1140 | 1140 | * If you are using the current language, do not call this function unless you are loading it for the first time */ |
1141 | 1141 | function return_mod_list_strings_language($language,$module) { |
1142 | - global $mod_list_strings; |
|
1143 | - global $sugar_config; |
|
1144 | - global $currentModule; |
|
1142 | + global $mod_list_strings; |
|
1143 | + global $sugar_config; |
|
1144 | + global $currentModule; |
|
1145 | 1145 | |
1146 | - $cache_key = "mod_list_str_lang.".$language.$module; |
|
1146 | + $cache_key = "mod_list_str_lang.".$language.$module; |
|
1147 | 1147 | |
1148 | - // Check for cached value |
|
1149 | - $cache_entry = sugar_cache_retrieve($cache_key); |
|
1150 | - if(!empty($cache_entry)) |
|
1151 | - { |
|
1152 | - return $cache_entry; |
|
1153 | - } |
|
1148 | + // Check for cached value |
|
1149 | + $cache_entry = sugar_cache_retrieve($cache_key); |
|
1150 | + if(!empty($cache_entry)) |
|
1151 | + { |
|
1152 | + return $cache_entry; |
|
1153 | + } |
|
1154 | 1154 | |
1155 | - $language_used = $language; |
|
1156 | - $temp_mod_list_strings = $mod_list_strings; |
|
1157 | - $default_language = $sugar_config['default_language']; |
|
1155 | + $language_used = $language; |
|
1156 | + $temp_mod_list_strings = $mod_list_strings; |
|
1157 | + $default_language = $sugar_config['default_language']; |
|
1158 | 1158 | |
1159 | - if($currentModule == $module && isset($mod_list_strings) && $mod_list_strings != null) { |
|
1160 | - return $mod_list_strings; |
|
1161 | - } |
|
1159 | + if($currentModule == $module && isset($mod_list_strings) && $mod_list_strings != null) { |
|
1160 | + return $mod_list_strings; |
|
1161 | + } |
|
1162 | 1162 | |
1163 | - // cn: bug 6351 - include en_us if file langpack not available |
|
1164 | - // cn: bug 6048 - merge en_us with requested language |
|
1165 | - include("modules/$module/language/en_us.lang.php"); |
|
1166 | - $en_mod_list_strings = array(); |
|
1167 | - if($language_used != $default_language) |
|
1168 | - $en_mod_list_strings = $mod_list_strings; |
|
1163 | + // cn: bug 6351 - include en_us if file langpack not available |
|
1164 | + // cn: bug 6048 - merge en_us with requested language |
|
1165 | + include("modules/$module/language/en_us.lang.php"); |
|
1166 | + $en_mod_list_strings = array(); |
|
1167 | + if($language_used != $default_language) |
|
1168 | + $en_mod_list_strings = $mod_list_strings; |
|
1169 | 1169 | |
1170 | - if(file_exists("modules/$module/language/$language.lang.php")) { |
|
1171 | - include("modules/$module/language/$language.lang.php"); |
|
1172 | - } |
|
1170 | + if(file_exists("modules/$module/language/$language.lang.php")) { |
|
1171 | + include("modules/$module/language/$language.lang.php"); |
|
1172 | + } |
|
1173 | 1173 | |
1174 | - if(file_exists("modules/$module/language/$language.lang.override.php")){ |
|
1175 | - include("modules/$module/language/$language.lang.override.php"); |
|
1176 | - } |
|
1174 | + if(file_exists("modules/$module/language/$language.lang.override.php")){ |
|
1175 | + include("modules/$module/language/$language.lang.override.php"); |
|
1176 | + } |
|
1177 | 1177 | |
1178 | - if(file_exists("modules/$module/language/$language.lang.php.override")){ |
|
1179 | - echo 'Please Change:<br>' . "modules/$module/language/$language.lang.php.override" . '<br>to<br>' . 'Please Change:<br>' . "modules/$module/language/$language.lang.override.php"; |
|
1180 | - include("modules/$module/language/$language.lang.php.override"); |
|
1181 | - } |
|
1178 | + if(file_exists("modules/$module/language/$language.lang.php.override")){ |
|
1179 | + echo 'Please Change:<br>' . "modules/$module/language/$language.lang.php.override" . '<br>to<br>' . 'Please Change:<br>' . "modules/$module/language/$language.lang.override.php"; |
|
1180 | + include("modules/$module/language/$language.lang.php.override"); |
|
1181 | + } |
|
1182 | 1182 | |
1183 | - // cn: bug 6048 - merge en_us with requested language |
|
1184 | - $mod_list_strings = sugarLangArrayMerge($en_mod_list_strings, $mod_list_strings); |
|
1183 | + // cn: bug 6048 - merge en_us with requested language |
|
1184 | + $mod_list_strings = sugarLangArrayMerge($en_mod_list_strings, $mod_list_strings); |
|
1185 | 1185 | |
1186 | - // if we still don't have a language pack, then log an error |
|
1187 | - if(!isset($mod_list_strings)) { |
|
1188 | - $GLOBALS['log']->fatal("Unable to load the application list language file for the selected language($language) or the default language($default_language) for module({$module})"); |
|
1189 | - return null; |
|
1190 | - } |
|
1186 | + // if we still don't have a language pack, then log an error |
|
1187 | + if(!isset($mod_list_strings)) { |
|
1188 | + $GLOBALS['log']->fatal("Unable to load the application list language file for the selected language($language) or the default language($default_language) for module({$module})"); |
|
1189 | + return null; |
|
1190 | + } |
|
1191 | 1191 | |
1192 | - $return_value = $mod_list_strings; |
|
1193 | - $mod_list_strings = $temp_mod_list_strings; |
|
1192 | + $return_value = $mod_list_strings; |
|
1193 | + $mod_list_strings = $temp_mod_list_strings; |
|
1194 | 1194 | |
1195 | - sugar_cache_put($cache_key, $return_value); |
|
1196 | - return $return_value; |
|
1195 | + sugar_cache_put($cache_key, $return_value); |
|
1196 | + return $return_value; |
|
1197 | 1197 | } |
1198 | 1198 | |
1199 | 1199 | |
@@ -1204,42 +1204,42 @@ discard block |
||
1204 | 1204 | */ |
1205 | 1205 | function return_theme_language($language, $theme) |
1206 | 1206 | { |
1207 | - global $mod_strings, $sugar_config, $current_language; |
|
1207 | + global $mod_strings, $sugar_config, $current_language; |
|
1208 | 1208 | |
1209 | - $language_used = $language; |
|
1210 | - $default_language = $sugar_config['default_language']; |
|
1209 | + $language_used = $language; |
|
1210 | + $default_language = $sugar_config['default_language']; |
|
1211 | 1211 | |
1212 | - include(SugarThemeRegistry::get($theme)->getFilePath()."/language/$current_language.lang.php"); |
|
1213 | - if(file_exists(SugarThemeRegistry::get($theme)->getFilePath()."/language/$current_language.lang.override.php")){ |
|
1214 | - include(SugarThemeRegistry::get($theme)->getFilePath()."/language/$current_language.lang.override.php"); |
|
1215 | - } |
|
1216 | - if(file_exists(SugarThemeRegistry::get($theme)->getFilePath()."/language/$current_language.lang.php.override")){ |
|
1217 | - echo 'Please Change:<br>' . SugarThemeRegistry::get($theme)->getFilePath()."/language/$current_language.lang.php.override" . '<br>to<br>' . 'Please Change:<br>' . SugarThemeRegistry::get($theme)->getFilePath()."/language/$current_language.lang.override.php"; |
|
1218 | - include(SugarThemeRegistry::get($theme)->getFilePath()."/language/$current_language.lang.php.override"); |
|
1219 | - } |
|
1220 | - if(!isset($theme_strings)) |
|
1221 | - { |
|
1222 | - $GLOBALS['log']->warn("Unable to find the theme file for language: ".$language." and theme: ".$theme); |
|
1223 | - require(SugarThemeRegistry::get($theme)->getFilePath()."/language/$default_language.lang.php"); |
|
1224 | - $language_used = $default_language; |
|
1225 | - } |
|
1212 | + include(SugarThemeRegistry::get($theme)->getFilePath()."/language/$current_language.lang.php"); |
|
1213 | + if(file_exists(SugarThemeRegistry::get($theme)->getFilePath()."/language/$current_language.lang.override.php")){ |
|
1214 | + include(SugarThemeRegistry::get($theme)->getFilePath()."/language/$current_language.lang.override.php"); |
|
1215 | + } |
|
1216 | + if(file_exists(SugarThemeRegistry::get($theme)->getFilePath()."/language/$current_language.lang.php.override")){ |
|
1217 | + echo 'Please Change:<br>' . SugarThemeRegistry::get($theme)->getFilePath()."/language/$current_language.lang.php.override" . '<br>to<br>' . 'Please Change:<br>' . SugarThemeRegistry::get($theme)->getFilePath()."/language/$current_language.lang.override.php"; |
|
1218 | + include(SugarThemeRegistry::get($theme)->getFilePath()."/language/$current_language.lang.php.override"); |
|
1219 | + } |
|
1220 | + if(!isset($theme_strings)) |
|
1221 | + { |
|
1222 | + $GLOBALS['log']->warn("Unable to find the theme file for language: ".$language." and theme: ".$theme); |
|
1223 | + require(SugarThemeRegistry::get($theme)->getFilePath()."/language/$default_language.lang.php"); |
|
1224 | + $language_used = $default_language; |
|
1225 | + } |
|
1226 | 1226 | |
1227 | - if(!isset($theme_strings)) |
|
1228 | - { |
|
1229 | - $GLOBALS['log']->fatal("Unable to load the theme($theme) language file for the selected language($language) or the default language($default_language)"); |
|
1230 | - return null; |
|
1231 | - } |
|
1227 | + if(!isset($theme_strings)) |
|
1228 | + { |
|
1229 | + $GLOBALS['log']->fatal("Unable to load the theme($theme) language file for the selected language($language) or the default language($default_language)"); |
|
1230 | + return null; |
|
1231 | + } |
|
1232 | 1232 | |
1233 | - // If we are in debug mode for translating, turn on the prefix now! |
|
1234 | - if($sugar_config['translation_string_prefix']) |
|
1235 | - { |
|
1236 | - foreach($theme_strings as $entry_key=>$entry_value) |
|
1237 | - { |
|
1238 | - $theme_strings[$entry_key] = $language_used.' '.$entry_value; |
|
1239 | - } |
|
1240 | - } |
|
1233 | + // If we are in debug mode for translating, turn on the prefix now! |
|
1234 | + if($sugar_config['translation_string_prefix']) |
|
1235 | + { |
|
1236 | + foreach($theme_strings as $entry_key=>$entry_value) |
|
1237 | + { |
|
1238 | + $theme_strings[$entry_key] = $language_used.' '.$entry_value; |
|
1239 | + } |
|
1240 | + } |
|
1241 | 1241 | |
1242 | - return $theme_strings; |
|
1242 | + return $theme_strings; |
|
1243 | 1243 | } |
1244 | 1244 | |
1245 | 1245 | |
@@ -1251,12 +1251,12 @@ discard block |
||
1251 | 1251 | */ |
1252 | 1252 | function return_session_value_or_default($varname, $default) |
1253 | 1253 | { |
1254 | - if(isset($_SESSION[$varname]) && $_SESSION[$varname] != "") |
|
1255 | - { |
|
1256 | - return $_SESSION[$varname]; |
|
1257 | - } |
|
1254 | + if(isset($_SESSION[$varname]) && $_SESSION[$varname] != "") |
|
1255 | + { |
|
1256 | + return $_SESSION[$varname]; |
|
1257 | + } |
|
1258 | 1258 | |
1259 | - return $default; |
|
1259 | + return $default; |
|
1260 | 1260 | } |
1261 | 1261 | |
1262 | 1262 | /** |
@@ -1271,15 +1271,15 @@ discard block |
||
1271 | 1271 | */ |
1272 | 1272 | function append_where_clause(&$where_clauses, $variable_name, $SQL_name = null) |
1273 | 1273 | { |
1274 | - if($SQL_name == null) |
|
1275 | - { |
|
1276 | - $SQL_name = $variable_name; |
|
1277 | - } |
|
1274 | + if($SQL_name == null) |
|
1275 | + { |
|
1276 | + $SQL_name = $variable_name; |
|
1277 | + } |
|
1278 | 1278 | |
1279 | - if(isset($_REQUEST[$variable_name]) && $_REQUEST[$variable_name] != "") |
|
1280 | - { |
|
1281 | - array_push($where_clauses, "$SQL_name like '".$GLOBALS['db']->quote($_REQUEST[$variable_name])."%'"); |
|
1282 | - } |
|
1279 | + if(isset($_REQUEST[$variable_name]) && $_REQUEST[$variable_name] != "") |
|
1280 | + { |
|
1281 | + array_push($where_clauses, "$SQL_name like '".$GLOBALS['db']->quote($_REQUEST[$variable_name])."%'"); |
|
1282 | + } |
|
1283 | 1283 | } |
1284 | 1284 | |
1285 | 1285 | /** |
@@ -1292,16 +1292,16 @@ discard block |
||
1292 | 1292 | */ |
1293 | 1293 | function generate_where_statement($where_clauses) |
1294 | 1294 | { |
1295 | - $where = ""; |
|
1296 | - foreach($where_clauses as $clause) |
|
1297 | - { |
|
1298 | - if($where != "") |
|
1299 | - $where .= " and "; |
|
1300 | - $where .= $clause; |
|
1301 | - } |
|
1295 | + $where = ""; |
|
1296 | + foreach($where_clauses as $clause) |
|
1297 | + { |
|
1298 | + if($where != "") |
|
1299 | + $where .= " and "; |
|
1300 | + $where .= $clause; |
|
1301 | + } |
|
1302 | 1302 | |
1303 | - $GLOBALS['log']->info("Here is the where clause for the list view: $where"); |
|
1304 | - return $where; |
|
1303 | + $GLOBALS['log']->info("Here is the where clause for the list view: $where"); |
|
1304 | + return $where; |
|
1305 | 1305 | } |
1306 | 1306 | |
1307 | 1307 | /** |
@@ -1310,15 +1310,15 @@ discard block |
||
1310 | 1310 | * @return bool False on failure |
1311 | 1311 | */ |
1312 | 1312 | function is_guid($guid) { |
1313 | - if(strlen($guid) != 36) { |
|
1314 | - return false; |
|
1315 | - } |
|
1313 | + if(strlen($guid) != 36) { |
|
1314 | + return false; |
|
1315 | + } |
|
1316 | 1316 | |
1317 | - if(preg_match("/\w{8}-\w{4}-\w{4}-\w{4}-\w{12}/i", $guid)) { |
|
1318 | - return true; |
|
1319 | - } |
|
1317 | + if(preg_match("/\w{8}-\w{4}-\w{4}-\w{4}-\w{12}/i", $guid)) { |
|
1318 | + return true; |
|
1319 | + } |
|
1320 | 1320 | |
1321 | - return true;; |
|
1321 | + return true;; |
|
1322 | 1322 | } |
1323 | 1323 | |
1324 | 1324 | |
@@ -1332,59 +1332,59 @@ discard block |
||
1332 | 1332 | */ |
1333 | 1333 | function create_guid() |
1334 | 1334 | { |
1335 | - $microTime = microtime(); |
|
1336 | - list($a_dec, $a_sec) = explode(" ", $microTime); |
|
1335 | + $microTime = microtime(); |
|
1336 | + list($a_dec, $a_sec) = explode(" ", $microTime); |
|
1337 | 1337 | |
1338 | - $dec_hex = dechex($a_dec* 1000000); |
|
1339 | - $sec_hex = dechex($a_sec); |
|
1338 | + $dec_hex = dechex($a_dec* 1000000); |
|
1339 | + $sec_hex = dechex($a_sec); |
|
1340 | 1340 | |
1341 | - ensure_length($dec_hex, 5); |
|
1342 | - ensure_length($sec_hex, 6); |
|
1341 | + ensure_length($dec_hex, 5); |
|
1342 | + ensure_length($sec_hex, 6); |
|
1343 | 1343 | |
1344 | - $guid = ""; |
|
1345 | - $guid .= $dec_hex; |
|
1346 | - $guid .= create_guid_section(3); |
|
1347 | - $guid .= '-'; |
|
1348 | - $guid .= create_guid_section(4); |
|
1349 | - $guid .= '-'; |
|
1350 | - $guid .= create_guid_section(4); |
|
1351 | - $guid .= '-'; |
|
1352 | - $guid .= create_guid_section(4); |
|
1353 | - $guid .= '-'; |
|
1354 | - $guid .= $sec_hex; |
|
1355 | - $guid .= create_guid_section(6); |
|
1344 | + $guid = ""; |
|
1345 | + $guid .= $dec_hex; |
|
1346 | + $guid .= create_guid_section(3); |
|
1347 | + $guid .= '-'; |
|
1348 | + $guid .= create_guid_section(4); |
|
1349 | + $guid .= '-'; |
|
1350 | + $guid .= create_guid_section(4); |
|
1351 | + $guid .= '-'; |
|
1352 | + $guid .= create_guid_section(4); |
|
1353 | + $guid .= '-'; |
|
1354 | + $guid .= $sec_hex; |
|
1355 | + $guid .= create_guid_section(6); |
|
1356 | 1356 | |
1357 | - return $guid; |
|
1357 | + return $guid; |
|
1358 | 1358 | |
1359 | 1359 | } |
1360 | 1360 | |
1361 | 1361 | function create_guid_section($characters) |
1362 | 1362 | { |
1363 | - $return = ""; |
|
1364 | - for($i=0; $i<$characters; $i++) |
|
1365 | - { |
|
1366 | - $return .= dechex(mt_rand(0,15)); |
|
1367 | - } |
|
1368 | - return $return; |
|
1363 | + $return = ""; |
|
1364 | + for($i=0; $i<$characters; $i++) |
|
1365 | + { |
|
1366 | + $return .= dechex(mt_rand(0,15)); |
|
1367 | + } |
|
1368 | + return $return; |
|
1369 | 1369 | } |
1370 | 1370 | |
1371 | 1371 | function ensure_length(&$string, $length) |
1372 | 1372 | { |
1373 | - $strlen = strlen($string); |
|
1374 | - if($strlen < $length) |
|
1375 | - { |
|
1376 | - $string = str_pad($string,$length,"0"); |
|
1377 | - } |
|
1378 | - else if($strlen > $length) |
|
1379 | - { |
|
1380 | - $string = substr($string, 0, $length); |
|
1381 | - } |
|
1373 | + $strlen = strlen($string); |
|
1374 | + if($strlen < $length) |
|
1375 | + { |
|
1376 | + $string = str_pad($string,$length,"0"); |
|
1377 | + } |
|
1378 | + else if($strlen > $length) |
|
1379 | + { |
|
1380 | + $string = substr($string, 0, $length); |
|
1381 | + } |
|
1382 | 1382 | } |
1383 | 1383 | |
1384 | 1384 | function microtime_diff($a, $b) { |
1385 | - list($a_dec, $a_sec) = explode(" ", $a); |
|
1386 | - list($b_dec, $b_sec) = explode(" ", $b); |
|
1387 | - return $b_sec - $a_sec + $b_dec - $a_dec; |
|
1385 | + list($a_dec, $a_sec) = explode(" ", $a); |
|
1386 | + list($b_dec, $b_sec) = explode(" ", $b); |
|
1387 | + return $b_sec - $a_sec + $b_dec - $a_dec; |
|
1388 | 1388 | } |
1389 | 1389 | |
1390 | 1390 | // check if Studio is displayed. |
@@ -1397,7 +1397,7 @@ discard block |
||
1397 | 1397 | |
1398 | 1398 | |
1399 | 1399 | |
1400 | - return true; |
|
1400 | + return true; |
|
1401 | 1401 | |
1402 | 1402 | } |
1403 | 1403 | |
@@ -1420,7 +1420,7 @@ discard block |
||
1420 | 1420 | |
1421 | 1421 | } |
1422 | 1422 | |
1423 | - function get_workflow_admin_modules_for_user($user){ |
|
1423 | + function get_workflow_admin_modules_for_user($user){ |
|
1424 | 1424 | if (isset($_SESSION['get_workflow_admin_modules_for_user'])) { |
1425 | 1425 | return $_SESSION['get_workflow_admin_modules_for_user']; |
1426 | 1426 | } |
@@ -1428,22 +1428,22 @@ discard block |
||
1428 | 1428 | global $moduleList; |
1429 | 1429 | $workflow_mod_list = array(); |
1430 | 1430 | foreach($moduleList as $module){ |
1431 | - $workflow_mod_list[$module] = $module; |
|
1432 | - } |
|
1431 | + $workflow_mod_list[$module] = $module; |
|
1432 | + } |
|
1433 | 1433 | |
1434 | - // This list is taken from teh previous version of workflow_utils.php |
|
1434 | + // This list is taken from teh previous version of workflow_utils.php |
|
1435 | 1435 | $workflow_mod_list['Tasks'] = "Tasks"; |
1436 | 1436 | $workflow_mod_list['Calls'] = "Calls"; |
1437 | 1437 | $workflow_mod_list['Meetings'] = "Meetings"; |
1438 | 1438 | $workflow_mod_list['Notes'] = "Notes"; |
1439 | 1439 | $workflow_mod_list['ProjectTask'] = "Project Tasks"; |
1440 | - $workflow_mod_list['Leads'] = "Leads"; |
|
1441 | - $workflow_mod_list['Opportunities'] = "Opportunities"; |
|
1442 | - // End of list |
|
1440 | + $workflow_mod_list['Leads'] = "Leads"; |
|
1441 | + $workflow_mod_list['Opportunities'] = "Opportunities"; |
|
1442 | + // End of list |
|
1443 | 1443 | |
1444 | 1444 | $workflow_admin_modules = array(); |
1445 | 1445 | if(empty($user)) { |
1446 | - return $workflow_admin_modules; |
|
1446 | + return $workflow_admin_modules; |
|
1447 | 1447 | } |
1448 | 1448 | $actions = ACLAction::getUserActions($user->id); |
1449 | 1449 | //check for ForecastSchedule because it doesn't exist in $workflow_mod_list |
@@ -1497,7 +1497,7 @@ discard block |
||
1497 | 1497 | return false; |
1498 | 1498 | } |
1499 | 1499 | |
1500 | - return $user->isAdmin(); |
|
1500 | + return $user->isAdmin(); |
|
1501 | 1501 | } |
1502 | 1502 | |
1503 | 1503 | /** |
@@ -1510,7 +1510,7 @@ discard block |
||
1510 | 1510 | */ |
1511 | 1511 | function get_theme_display($theme) |
1512 | 1512 | { |
1513 | - return SugarThemeRegistry::get($theme)->name; |
|
1513 | + return SugarThemeRegistry::get($theme)->name; |
|
1514 | 1514 | } |
1515 | 1515 | |
1516 | 1516 | /** |
@@ -1537,7 +1537,7 @@ discard block |
||
1537 | 1537 | * Contributor(s): ______________________________________.. |
1538 | 1538 | */ |
1539 | 1539 | function get_select_options ($option_list, $selected) { |
1540 | - return get_select_options_with_id($option_list, $selected); |
|
1540 | + return get_select_options_with_id($option_list, $selected); |
|
1541 | 1541 | } |
1542 | 1542 | |
1543 | 1543 | /** |
@@ -1550,7 +1550,7 @@ discard block |
||
1550 | 1550 | * Contributor(s): ______________________________________.. |
1551 | 1551 | */ |
1552 | 1552 | function get_select_options_with_id ($option_list, $selected_key) { |
1553 | - return get_select_options_with_id_separate_key($option_list, $option_list, $selected_key); |
|
1553 | + return get_select_options_with_id_separate_key($option_list, $option_list, $selected_key); |
|
1554 | 1554 | } |
1555 | 1555 | |
1556 | 1556 | |
@@ -1565,23 +1565,23 @@ discard block |
||
1565 | 1565 | * Contributor(s): ______________________________________.. |
1566 | 1566 | */ |
1567 | 1567 | function get_select_options_with_id_separate_key ($label_list, $key_list, $selected_key, $massupdate=false) { |
1568 | - global $app_strings; |
|
1569 | - $select_options = ""; |
|
1568 | + global $app_strings; |
|
1569 | + $select_options = ""; |
|
1570 | 1570 | |
1571 | - //for setting null selection values to human readable --None-- |
|
1572 | - $pattern = "/'0?'></"; |
|
1573 | - $replacement = "''>".$app_strings['LBL_NONE']."<"; |
|
1571 | + //for setting null selection values to human readable --None-- |
|
1572 | + $pattern = "/'0?'></"; |
|
1573 | + $replacement = "''>".$app_strings['LBL_NONE']."<"; |
|
1574 | 1574 | if($massupdate){ |
1575 | 1575 | $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 | 1576 | } |
1577 | 1577 | |
1578 | - if (empty($key_list)) $key_list = array(); |
|
1579 | - //create the type dropdown domain and set the selected value if $opp value already exists |
|
1580 | - foreach ($key_list as $option_key=>$option_value) { |
|
1578 | + if (empty($key_list)) $key_list = array(); |
|
1579 | + //create the type dropdown domain and set the selected value if $opp value already exists |
|
1580 | + foreach ($key_list as $option_key=>$option_value) { |
|
1581 | 1581 | |
1582 | - $selected_string = ''; |
|
1583 | - // the system is evaluating $selected_key == 0 || '' to true. Be very careful when changing this. Test all cases. |
|
1584 | - // The bug was only happening with one of the users in the drop down. It was being replaced by none. |
|
1582 | + $selected_string = ''; |
|
1583 | + // the system is evaluating $selected_key == 0 || '' to true. Be very careful when changing this. Test all cases. |
|
1584 | + // The bug was only happening with one of the users in the drop down. It was being replaced by none. |
|
1585 | 1585 | if ( |
1586 | 1586 | ($option_key != '' && $selected_key == $option_key) |
1587 | 1587 | || ( |
@@ -1590,15 +1590,15 @@ discard block |
||
1590 | 1590 | ) |
1591 | 1591 | || (is_array($selected_key) && in_array($option_key, $selected_key)) |
1592 | 1592 | ) { |
1593 | - $selected_string = 'selected '; |
|
1594 | - } |
|
1593 | + $selected_string = 'selected '; |
|
1594 | + } |
|
1595 | 1595 | |
1596 | - $html_value = $option_key; |
|
1596 | + $html_value = $option_key; |
|
1597 | 1597 | |
1598 | - $select_options .= "\n<OPTION ".$selected_string."value='$html_value'>$label_list[$option_key]</OPTION>"; |
|
1599 | - } |
|
1600 | - $select_options = preg_replace($pattern, $replacement, $select_options); |
|
1601 | - return $select_options; |
|
1598 | + $select_options .= "\n<OPTION ".$selected_string."value='$html_value'>$label_list[$option_key]</OPTION>"; |
|
1599 | + } |
|
1600 | + $select_options = preg_replace($pattern, $replacement, $select_options); |
|
1601 | + return $select_options; |
|
1602 | 1602 | } |
1603 | 1603 | |
1604 | 1604 | |
@@ -1609,10 +1609,10 @@ discard block |
||
1609 | 1609 | */ |
1610 | 1610 | function sugar_die($error_message, $exit_code = 1) |
1611 | 1611 | { |
1612 | - global $focus; |
|
1613 | - sugar_cleanup(); |
|
1614 | - echo $error_message; |
|
1615 | - die($exit_code); |
|
1612 | + global $focus; |
|
1613 | + sugar_cleanup(); |
|
1614 | + echo $error_message; |
|
1615 | + die($exit_code); |
|
1616 | 1616 | } |
1617 | 1617 | |
1618 | 1618 | |
@@ -1623,7 +1623,7 @@ discard block |
||
1623 | 1623 | * Contributor(s): ______________________________________.. |
1624 | 1624 | */ |
1625 | 1625 | function get_clear_form_js () { |
1626 | - $the_script = <<<EOQ |
|
1626 | + $the_script = <<<EOQ |
|
1627 | 1627 | <script type="text/javascript" language="JavaScript"> |
1628 | 1628 | function clear_form(form) { |
1629 | 1629 | var newLoc = 'index.php?action=' + form.action.value + '&module=' + form.module.value + '&query=true&clear_query=true'; |
@@ -1635,7 +1635,7 @@ discard block |
||
1635 | 1635 | </script> |
1636 | 1636 | EOQ; |
1637 | 1637 | |
1638 | - return $the_script; |
|
1638 | + return $the_script; |
|
1639 | 1639 | } |
1640 | 1640 | |
1641 | 1641 | /** |
@@ -1647,8 +1647,8 @@ discard block |
||
1647 | 1647 | * Contributor(s): ______________________________________.. |
1648 | 1648 | */ |
1649 | 1649 | function get_set_focus_js () { |
1650 | - //TODO Clint 5/20 - Make this function more generic so that it can take in the target form and field names as variables |
|
1651 | - $the_script = <<<EOQ |
|
1650 | + //TODO Clint 5/20 - Make this function more generic so that it can take in the target form and field names as variables |
|
1651 | + $the_script = <<<EOQ |
|
1652 | 1652 | <script type="text/javascript" language="JavaScript"> |
1653 | 1653 | <!-- |
1654 | 1654 | function set_focus() { |
@@ -1672,7 +1672,7 @@ discard block |
||
1672 | 1672 | </script> |
1673 | 1673 | EOQ; |
1674 | 1674 | |
1675 | - return $the_script; |
|
1675 | + return $the_script; |
|
1676 | 1676 | } |
1677 | 1677 | |
1678 | 1678 | /** |
@@ -1688,26 +1688,26 @@ discard block |
||
1688 | 1688 | * Contributor(s): ______________________________________.. |
1689 | 1689 | */ |
1690 | 1690 | function array_csort() { |
1691 | - $args = func_get_args(); |
|
1692 | - $marray = array_shift($args); |
|
1693 | - $i = 0; |
|
1694 | - |
|
1695 | - $msortline = "return(array_multisort("; |
|
1696 | - foreach ($args as $arg) { |
|
1697 | - $i++; |
|
1698 | - if (is_string($arg)) { |
|
1699 | - foreach ($marray as $row) { |
|
1700 | - $sortarr[$i][] = $row[$arg]; |
|
1701 | - } |
|
1702 | - } else { |
|
1703 | - $sortarr[$i] = $arg; |
|
1704 | - } |
|
1705 | - $msortline .= "\$sortarr[".$i."],"; |
|
1706 | - } |
|
1707 | - $msortline .= "\$marray));"; |
|
1691 | + $args = func_get_args(); |
|
1692 | + $marray = array_shift($args); |
|
1693 | + $i = 0; |
|
1694 | + |
|
1695 | + $msortline = "return(array_multisort("; |
|
1696 | + foreach ($args as $arg) { |
|
1697 | + $i++; |
|
1698 | + if (is_string($arg)) { |
|
1699 | + foreach ($marray as $row) { |
|
1700 | + $sortarr[$i][] = $row[$arg]; |
|
1701 | + } |
|
1702 | + } else { |
|
1703 | + $sortarr[$i] = $arg; |
|
1704 | + } |
|
1705 | + $msortline .= "\$sortarr[".$i."],"; |
|
1706 | + } |
|
1707 | + $msortline .= "\$marray));"; |
|
1708 | 1708 | |
1709 | - eval($msortline); |
|
1710 | - return $marray; |
|
1709 | + eval($msortline); |
|
1710 | + return $marray; |
|
1711 | 1711 | } |
1712 | 1712 | |
1713 | 1713 | /** |
@@ -1718,9 +1718,9 @@ discard block |
||
1718 | 1718 | * Contributor(s): ______________________________________.. |
1719 | 1719 | */ |
1720 | 1720 | function parse_calendardate($local_format) { |
1721 | - preg_match('/\(?([^-]{1})[^-]*-([^-]{1})[^-]*-([^-]{1})[^-]*\)/', $local_format, $matches); |
|
1722 | - $calendar_format = "%" . $matches[1] . "-%" . $matches[2] . "-%" . $matches[3]; |
|
1723 | - return str_replace(array("y", "ᅣ1�7", "a", "j"), array("Y", "Y", "Y", "d"), $calendar_format); |
|
1721 | + preg_match('/\(?([^-]{1})[^-]*-([^-]{1})[^-]*-([^-]{1})[^-]*\)/', $local_format, $matches); |
|
1722 | + $calendar_format = "%" . $matches[1] . "-%" . $matches[2] . "-%" . $matches[3]; |
|
1723 | + return str_replace(array("y", "ᅣ1�7", "a", "j"), array("Y", "Y", "Y", "d"), $calendar_format); |
|
1724 | 1724 | } |
1725 | 1725 | |
1726 | 1726 | |
@@ -1728,24 +1728,24 @@ discard block |
||
1728 | 1728 | |
1729 | 1729 | |
1730 | 1730 | function translate($string, $mod='', $selectedValue=''){ |
1731 | - //$test_start = microtime(); |
|
1732 | - //static $mod_strings_results = array(); |
|
1733 | - if(!empty($mod)){ |
|
1734 | - global $current_language; |
|
1735 | - //Bug 31275 |
|
1736 | - if(isset($_REQUEST['login_language'])){ |
|
1737 | - $current_language = ($_REQUEST['login_language'] == $current_language)? $current_language : $_REQUEST['login_language']; |
|
1738 | - } |
|
1739 | - $mod_strings = return_module_language($current_language, $mod); |
|
1731 | + //$test_start = microtime(); |
|
1732 | + //static $mod_strings_results = array(); |
|
1733 | + if(!empty($mod)){ |
|
1734 | + global $current_language; |
|
1735 | + //Bug 31275 |
|
1736 | + if(isset($_REQUEST['login_language'])){ |
|
1737 | + $current_language = ($_REQUEST['login_language'] == $current_language)? $current_language : $_REQUEST['login_language']; |
|
1738 | + } |
|
1739 | + $mod_strings = return_module_language($current_language, $mod); |
|
1740 | 1740 | if ($mod == "") |
1741 | 1741 | echo "Language is <pre>" . $mod_strings . "</pre>"; |
1742 | 1742 | |
1743 | - }else{ |
|
1744 | - global $mod_strings; |
|
1745 | - } |
|
1743 | + }else{ |
|
1744 | + global $mod_strings; |
|
1745 | + } |
|
1746 | 1746 | |
1747 | - $returnValue = ''; |
|
1748 | - global $app_strings, $app_list_strings; |
|
1747 | + $returnValue = ''; |
|
1748 | + global $app_strings, $app_list_strings; |
|
1749 | 1749 | |
1750 | 1750 | if (isset($mod_strings[$string])) |
1751 | 1751 | $returnValue = $mod_strings[$string]; |
@@ -1757,34 +1757,34 @@ discard block |
||
1757 | 1757 | $returnValue = $app_list_strings['moduleList'][$string]; |
1758 | 1758 | |
1759 | 1759 | |
1760 | - //$test_end = microtime(); |
|
1761 | - // |
|
1762 | - // $mod_strings_results[$mod] = microtime_diff($test_start,$test_end); |
|
1763 | - // |
|
1764 | - // echo("translate results:"); |
|
1765 | - // $total_time = 0; |
|
1766 | - // $total_strings = 0; |
|
1767 | - // foreach($mod_strings_results as $key=>$value) |
|
1768 | - // { |
|
1769 | - // echo("Module $key \t\t time $value \t\t<br>"); |
|
1770 | - // $total_time += $value; |
|
1771 | - // } |
|
1772 | - // |
|
1773 | - // echo("Total time: $total_time<br>"); |
|
1760 | + //$test_end = microtime(); |
|
1761 | + // |
|
1762 | + // $mod_strings_results[$mod] = microtime_diff($test_start,$test_end); |
|
1763 | + // |
|
1764 | + // echo("translate results:"); |
|
1765 | + // $total_time = 0; |
|
1766 | + // $total_strings = 0; |
|
1767 | + // foreach($mod_strings_results as $key=>$value) |
|
1768 | + // { |
|
1769 | + // echo("Module $key \t\t time $value \t\t<br>"); |
|
1770 | + // $total_time += $value; |
|
1771 | + // } |
|
1772 | + // |
|
1773 | + // echo("Total time: $total_time<br>"); |
|
1774 | 1774 | |
1775 | 1775 | |
1776 | 1776 | |
1777 | - if(empty($returnValue)){ |
|
1778 | - return $string; |
|
1779 | - } |
|
1777 | + if(empty($returnValue)){ |
|
1778 | + return $string; |
|
1779 | + } |
|
1780 | 1780 | |
1781 | 1781 | // Bug 48996 - Custom enums with '0' value were not returning because of empty check |
1782 | 1782 | // Added a numeric 0 checker to the conditional to allow 0 value indexed to pass |
1783 | - if(is_array($returnValue) && (!empty($selectedValue) || (is_numeric($selectedValue) && $selectedValue == 0)) && isset($returnValue[$selectedValue]) ){ |
|
1784 | - return $returnValue[$selectedValue]; |
|
1785 | - } |
|
1783 | + if(is_array($returnValue) && (!empty($selectedValue) || (is_numeric($selectedValue) && $selectedValue == 0)) && isset($returnValue[$selectedValue]) ){ |
|
1784 | + return $returnValue[$selectedValue]; |
|
1785 | + } |
|
1786 | 1786 | |
1787 | - return $returnValue; |
|
1787 | + return $returnValue; |
|
1788 | 1788 | } |
1789 | 1789 | |
1790 | 1790 | function unTranslateNum($num) { |
@@ -1808,16 +1808,16 @@ discard block |
||
1808 | 1808 | } |
1809 | 1809 | |
1810 | 1810 | function add_http($url) { |
1811 | - if(!preg_match("@://@i", $url)) { |
|
1812 | - $scheme = "http"; |
|
1813 | - if(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on') { |
|
1814 | - $scheme = 'https'; |
|
1815 | - } |
|
1811 | + if(!preg_match("@://@i", $url)) { |
|
1812 | + $scheme = "http"; |
|
1813 | + if(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on') { |
|
1814 | + $scheme = 'https'; |
|
1815 | + } |
|
1816 | 1816 | |
1817 | - return "{$scheme}://{$url}"; |
|
1818 | - } |
|
1817 | + return "{$scheme}://{$url}"; |
|
1818 | + } |
|
1819 | 1819 | |
1820 | - return $url; |
|
1820 | + return $url; |
|
1821 | 1821 | } |
1822 | 1822 | |
1823 | 1823 | /** |
@@ -1825,25 +1825,25 @@ discard block |
||
1825 | 1825 | * @return array |
1826 | 1826 | */ |
1827 | 1827 | function getDefaultXssTags() { |
1828 | - $tmp = array( |
|
1829 | - "applet" => "applet", |
|
1830 | - "base" => "base", |
|
1831 | - "embed" => "embed", |
|
1832 | - "form" => "form", |
|
1833 | - "frame" => "frame", |
|
1834 | - "frameset" => "frameset", |
|
1835 | - "iframe" => "iframe", |
|
1836 | - "import" => "\?import", |
|
1837 | - "layer" => "layer", |
|
1838 | - "link" => "link", |
|
1839 | - "object" => "object", |
|
1840 | - "script" => "script", |
|
1841 | - "xmp" => "xmp", |
|
1842 | - ); |
|
1843 | - |
|
1844 | - $ret = base64_encode(serialize($tmp)); |
|
1845 | - |
|
1846 | - return $ret; |
|
1828 | + $tmp = array( |
|
1829 | + "applet" => "applet", |
|
1830 | + "base" => "base", |
|
1831 | + "embed" => "embed", |
|
1832 | + "form" => "form", |
|
1833 | + "frame" => "frame", |
|
1834 | + "frameset" => "frameset", |
|
1835 | + "iframe" => "iframe", |
|
1836 | + "import" => "\?import", |
|
1837 | + "layer" => "layer", |
|
1838 | + "link" => "link", |
|
1839 | + "object" => "object", |
|
1840 | + "script" => "script", |
|
1841 | + "xmp" => "xmp", |
|
1842 | + ); |
|
1843 | + |
|
1844 | + $ret = base64_encode(serialize($tmp)); |
|
1845 | + |
|
1846 | + return $ret; |
|
1847 | 1847 | } |
1848 | 1848 | |
1849 | 1849 | /** |
@@ -1865,28 +1865,28 @@ discard block |
||
1865 | 1865 | * @return array Array of matches, empty on clean string |
1866 | 1866 | */ |
1867 | 1867 | function clean_xss($str, $cleanImg=true) { |
1868 | - global $sugar_config; |
|
1868 | + global $sugar_config; |
|
1869 | 1869 | |
1870 | - if(empty($sugar_config['email_xss'])) |
|
1871 | - $sugar_config['email_xss'] = getDefaultXssTags(); |
|
1870 | + if(empty($sugar_config['email_xss'])) |
|
1871 | + $sugar_config['email_xss'] = getDefaultXssTags(); |
|
1872 | 1872 | |
1873 | - $xsstags = unserialize(base64_decode($sugar_config['email_xss'])); |
|
1873 | + $xsstags = unserialize(base64_decode($sugar_config['email_xss'])); |
|
1874 | 1874 | |
1875 | - // cn: bug 13079 - "on\w" matched too many non-events (cONTact, strONG, etc.) |
|
1876 | - $jsEvents = "onblur|onfocus|oncontextmenu|onresize|onscroll|onunload|ondblclick|onclick|"; |
|
1877 | - $jsEvents .= "onmouseup|onmouseover|onmousedown|onmouseenter|onmouseleave|onmousemove|onload|onchange|"; |
|
1878 | - $jsEvents .= "onreset|onselect|onsubmit|onkeydown|onkeypress|onkeyup|onabort|onerror|ondragdrop"; |
|
1875 | + // cn: bug 13079 - "on\w" matched too many non-events (cONTact, strONG, etc.) |
|
1876 | + $jsEvents = "onblur|onfocus|oncontextmenu|onresize|onscroll|onunload|ondblclick|onclick|"; |
|
1877 | + $jsEvents .= "onmouseup|onmouseover|onmousedown|onmouseenter|onmouseleave|onmousemove|onload|onchange|"; |
|
1878 | + $jsEvents .= "onreset|onselect|onsubmit|onkeydown|onkeypress|onkeyup|onabort|onerror|ondragdrop"; |
|
1879 | 1879 | |
1880 | - $attribute_regex = "#\b({$jsEvents})\s*=\s*(?|(?!['\"])\S+|['\"].+?['\"])#sim"; |
|
1881 | - $javascript_regex = '@<[^/>][^>]+(expression\(|j\W*a\W*v\W*a|v\W*b\W*s\W*c\W*r|&#|/\*|\*/)[^>]*>@sim'; |
|
1882 | - $imgsrc_regex = '#<[^>]+src[^=]*=([^>]*?http(s)?://[^>]*)>#sim'; |
|
1883 | - $css_url = '#url\(.*\.\w+\)#'; |
|
1880 | + $attribute_regex = "#\b({$jsEvents})\s*=\s*(?|(?!['\"])\S+|['\"].+?['\"])#sim"; |
|
1881 | + $javascript_regex = '@<[^/>][^>]+(expression\(|j\W*a\W*v\W*a|v\W*b\W*s\W*c\W*r|&#|/\*|\*/)[^>]*>@sim'; |
|
1882 | + $imgsrc_regex = '#<[^>]+src[^=]*=([^>]*?http(s)?://[^>]*)>#sim'; |
|
1883 | + $css_url = '#url\(.*\.\w+\)#'; |
|
1884 | 1884 | |
1885 | - $tagsrex = '#<\/?(\w+)((?:\s+(?:\w|\w[\w-]*\w)(?:\s*=\s*(?:\".*?\"|\'.*?\'|[^\'\">\s]+))?)+\s*|\s*)\/?>#im'; |
|
1885 | + $tagsrex = '#<\/?(\w+)((?:\s+(?:\w|\w[\w-]*\w)(?:\s*=\s*(?:\".*?\"|\'.*?\'|[^\'\">\s]+))?)+\s*|\s*)\/?>#im'; |
|
1886 | 1886 | |
1887 | - $tagmatches = array(); |
|
1888 | - $matches = array(); |
|
1889 | - preg_match_all($tagsrex, $str, $tagmatches, PREG_PATTERN_ORDER); |
|
1887 | + $tagmatches = array(); |
|
1888 | + $matches = array(); |
|
1889 | + preg_match_all($tagsrex, $str, $tagmatches, PREG_PATTERN_ORDER); |
|
1890 | 1890 | foreach($tagmatches[1] as $no => $tag) { |
1891 | 1891 | if(in_array($tag, $xsstags)) { |
1892 | 1892 | // dangerous tag - take out whole |
@@ -1900,38 +1900,38 @@ discard block |
||
1900 | 1900 | } |
1901 | 1901 | } |
1902 | 1902 | |
1903 | - $matches = array_merge($matches, xss_check_pattern($javascript_regex, $str)); |
|
1903 | + $matches = array_merge($matches, xss_check_pattern($javascript_regex, $str)); |
|
1904 | 1904 | |
1905 | - if($cleanImg) { |
|
1906 | - $matches = array_merge($matches, |
|
1907 | - xss_check_pattern($imgsrc_regex, $str) |
|
1908 | - ); |
|
1909 | - } |
|
1905 | + if($cleanImg) { |
|
1906 | + $matches = array_merge($matches, |
|
1907 | + xss_check_pattern($imgsrc_regex, $str) |
|
1908 | + ); |
|
1909 | + } |
|
1910 | 1910 | |
1911 | - // cn: bug 13498 - custom white-list of allowed domains that vet remote images |
|
1912 | - preg_match_all($css_url, $str, $cssUrlMatches, PREG_PATTERN_ORDER); |
|
1911 | + // cn: bug 13498 - custom white-list of allowed domains that vet remote images |
|
1912 | + preg_match_all($css_url, $str, $cssUrlMatches, PREG_PATTERN_ORDER); |
|
1913 | 1913 | |
1914 | - if(isset($sugar_config['security_trusted_domains']) && !empty($sugar_config['security_trusted_domains']) && is_array($sugar_config['security_trusted_domains'])) { |
|
1915 | - if(is_array($cssUrlMatches) && count($cssUrlMatches) > 0) { |
|
1916 | - // normalize whitelist |
|
1917 | - foreach($sugar_config['security_trusted_domains'] as $k => $v) { |
|
1918 | - $sugar_config['security_trusted_domains'][$k] = strtolower($v); |
|
1919 | - } |
|
1914 | + if(isset($sugar_config['security_trusted_domains']) && !empty($sugar_config['security_trusted_domains']) && is_array($sugar_config['security_trusted_domains'])) { |
|
1915 | + if(is_array($cssUrlMatches) && count($cssUrlMatches) > 0) { |
|
1916 | + // normalize whitelist |
|
1917 | + foreach($sugar_config['security_trusted_domains'] as $k => $v) { |
|
1918 | + $sugar_config['security_trusted_domains'][$k] = strtolower($v); |
|
1919 | + } |
|
1920 | 1920 | |
1921 | - foreach($cssUrlMatches[0] as $match) { |
|
1922 | - $domain = strtolower(substr(strstr($match, "://"), 3)); |
|
1923 | - $baseUrl = substr($domain, 0, strpos($domain, "/")); |
|
1921 | + foreach($cssUrlMatches[0] as $match) { |
|
1922 | + $domain = strtolower(substr(strstr($match, "://"), 3)); |
|
1923 | + $baseUrl = substr($domain, 0, strpos($domain, "/")); |
|
1924 | 1924 | |
1925 | - if(!in_array($baseUrl, $sugar_config['security_trusted_domains'])) { |
|
1926 | - $matches[] = $match; |
|
1927 | - } |
|
1928 | - } |
|
1929 | - } |
|
1930 | - } else { |
|
1931 | - $matches = array_merge($matches, $cssUrlMatches[0]); |
|
1932 | - } |
|
1925 | + if(!in_array($baseUrl, $sugar_config['security_trusted_domains'])) { |
|
1926 | + $matches[] = $match; |
|
1927 | + } |
|
1928 | + } |
|
1929 | + } |
|
1930 | + } else { |
|
1931 | + $matches = array_merge($matches, $cssUrlMatches[0]); |
|
1932 | + } |
|
1933 | 1933 | |
1934 | - return $matches; |
|
1934 | + return $matches; |
|
1935 | 1935 | } |
1936 | 1936 | |
1937 | 1937 | /** |
@@ -1941,8 +1941,8 @@ discard block |
||
1941 | 1941 | * @return array |
1942 | 1942 | */ |
1943 | 1943 | function xss_check_pattern($pattern, $str) { |
1944 | - preg_match_all($pattern, $str, $matches, PREG_PATTERN_ORDER); |
|
1945 | - return $matches[1]; |
|
1944 | + preg_match_all($pattern, $str, $matches, PREG_PATTERN_ORDER); |
|
1945 | + return $matches[1]; |
|
1946 | 1946 | } |
1947 | 1947 | |
1948 | 1948 | /** |
@@ -1964,80 +1964,80 @@ discard block |
||
1964 | 1964 | */ |
1965 | 1965 | function clean_string($str, $filter = "STANDARD", $dieOnBadData = true) |
1966 | 1966 | { |
1967 | - global $sugar_config; |
|
1968 | - |
|
1969 | - $filters = Array( |
|
1970 | - "STANDARD" => '#[^A-Z0-9\-_\.\@]#i', |
|
1971 | - "STANDARDSPACE" => '#[^A-Z0-9\-_\.\@\ ]#i', |
|
1972 | - "FILE" => '#[^A-Z0-9\-_\.]#i', |
|
1973 | - "NUMBER" => '#[^0-9\-]#i', |
|
1974 | - "SQL_COLUMN_LIST" => '#[^A-Z0-9\(\),_\.]#i', |
|
1975 | - "PATH_NO_URL" => '#://#i', |
|
1976 | - "SAFED_GET" => '#[^A-Z0-9\@\=\&\?\.\/\-_~+]#i', /* range of allowed characters in a GET string */ |
|
1977 | - "UNIFIED_SEARCH" => "#[\\x00]#", /* cn: bug 3356 & 9236 - MBCS search strings */ |
|
1978 | - "AUTO_INCREMENT" => '#[^0-9\-,\ ]#i', |
|
1979 | - "ALPHANUM" => '#[^A-Z0-9\-]#i', |
|
1980 | - ); |
|
1981 | - |
|
1982 | - if (preg_match($filters[$filter], $str)) { |
|
1983 | - if (isset($GLOBALS['log']) && is_object($GLOBALS['log'])) { |
|
1984 | - $GLOBALS['log']->fatal("SECURITY[$filter]: bad data passed in; string: {$str}"); |
|
1985 | - } |
|
1986 | - if ( $dieOnBadData ) { |
|
1987 | - die("Bad data passed in; <a href=\"{$sugar_config['site_url']}\">Return to Home</a>"); |
|
1988 | - } |
|
1989 | - return false; |
|
1990 | - } |
|
1991 | - else { |
|
1992 | - return $str; |
|
1993 | - } |
|
1967 | + global $sugar_config; |
|
1968 | + |
|
1969 | + $filters = Array( |
|
1970 | + "STANDARD" => '#[^A-Z0-9\-_\.\@]#i', |
|
1971 | + "STANDARDSPACE" => '#[^A-Z0-9\-_\.\@\ ]#i', |
|
1972 | + "FILE" => '#[^A-Z0-9\-_\.]#i', |
|
1973 | + "NUMBER" => '#[^0-9\-]#i', |
|
1974 | + "SQL_COLUMN_LIST" => '#[^A-Z0-9\(\),_\.]#i', |
|
1975 | + "PATH_NO_URL" => '#://#i', |
|
1976 | + "SAFED_GET" => '#[^A-Z0-9\@\=\&\?\.\/\-_~+]#i', /* range of allowed characters in a GET string */ |
|
1977 | + "UNIFIED_SEARCH" => "#[\\x00]#", /* cn: bug 3356 & 9236 - MBCS search strings */ |
|
1978 | + "AUTO_INCREMENT" => '#[^0-9\-,\ ]#i', |
|
1979 | + "ALPHANUM" => '#[^A-Z0-9\-]#i', |
|
1980 | + ); |
|
1981 | + |
|
1982 | + if (preg_match($filters[$filter], $str)) { |
|
1983 | + if (isset($GLOBALS['log']) && is_object($GLOBALS['log'])) { |
|
1984 | + $GLOBALS['log']->fatal("SECURITY[$filter]: bad data passed in; string: {$str}"); |
|
1985 | + } |
|
1986 | + if ( $dieOnBadData ) { |
|
1987 | + die("Bad data passed in; <a href=\"{$sugar_config['site_url']}\">Return to Home</a>"); |
|
1988 | + } |
|
1989 | + return false; |
|
1990 | + } |
|
1991 | + else { |
|
1992 | + return $str; |
|
1993 | + } |
|
1994 | 1994 | } |
1995 | 1995 | |
1996 | 1996 | function clean_special_arguments() { |
1997 | - 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"); |
|
2016 | - clean_superglobals('stamp', 'ALPHANUM'); // for vcr controls |
|
2017 | - clean_superglobals('offset', 'ALPHANUM'); |
|
2018 | - clean_superglobals('return_action'); |
|
2019 | - clean_superglobals('return_module'); |
|
2020 | - return TRUE; |
|
1997 | + 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"); |
|
2016 | + clean_superglobals('stamp', 'ALPHANUM'); // for vcr controls |
|
2017 | + clean_superglobals('offset', 'ALPHANUM'); |
|
2018 | + clean_superglobals('return_action'); |
|
2019 | + clean_superglobals('return_module'); |
|
2020 | + return TRUE; |
|
2021 | 2021 | } |
2022 | 2022 | |
2023 | 2023 | /** |
2024 | 2024 | * cleans the given key in superglobals $_GET, $_POST, $_REQUEST |
2025 | 2025 | */ |
2026 | 2026 | 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); |
|
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 | 2030 | } |
2031 | 2031 | |
2032 | 2032 | function set_superglobals($key, $val){ |
2033 | - $_GET[$key] = $val; |
|
2034 | - $_POST[$key] = $val; |
|
2035 | - $_REQUEST[$key] = $val; |
|
2033 | + $_GET[$key] = $val; |
|
2034 | + $_POST[$key] = $val; |
|
2035 | + $_REQUEST[$key] = $val; |
|
2036 | 2036 | } |
2037 | 2037 | |
2038 | 2038 | // Works in conjunction with clean_string() to defeat SQL injection, file inclusion attacks, and XSS |
2039 | 2039 | function clean_incoming_data() { |
2040 | - global $sugar_config; |
|
2040 | + global $sugar_config; |
|
2041 | 2041 | global $RAW_REQUEST; |
2042 | 2042 | |
2043 | 2043 | if(get_magic_quotes_gpc()) { |
@@ -2047,120 +2047,120 @@ discard block |
||
2047 | 2047 | $RAW_REQUEST = $_REQUEST; |
2048 | 2048 | } |
2049 | 2049 | |
2050 | - if (get_magic_quotes_gpc() == 1) { |
|
2051 | - $req = array_map("preprocess_param", $_REQUEST); |
|
2052 | - $post = array_map("preprocess_param", $_POST); |
|
2053 | - $get = array_map("preprocess_param", $_GET); |
|
2054 | - } else { |
|
2050 | + if (get_magic_quotes_gpc() == 1) { |
|
2051 | + $req = array_map("preprocess_param", $_REQUEST); |
|
2052 | + $post = array_map("preprocess_param", $_POST); |
|
2053 | + $get = array_map("preprocess_param", $_GET); |
|
2054 | + } else { |
|
2055 | 2055 | |
2056 | - $req = array_map("securexss", $_REQUEST); |
|
2057 | - $post = array_map("securexss", $_POST); |
|
2058 | - $get = array_map("securexss", $_GET); |
|
2059 | - } |
|
2056 | + $req = array_map("securexss", $_REQUEST); |
|
2057 | + $post = array_map("securexss", $_POST); |
|
2058 | + $get = array_map("securexss", $_GET); |
|
2059 | + } |
|
2060 | 2060 | |
2061 | - // PHP cannot stomp out superglobals reliably |
|
2062 | - foreach($post as $k => $v) { $_POST[$k] = $v; } |
|
2063 | - foreach($get as $k => $v) { $_GET[$k] = $v; } |
|
2064 | - foreach($req as $k => $v) { |
|
2065 | - $_REQUEST[$k] = $v; |
|
2061 | + // PHP cannot stomp out superglobals reliably |
|
2062 | + foreach($post as $k => $v) { $_POST[$k] = $v; } |
|
2063 | + foreach($get as $k => $v) { $_GET[$k] = $v; } |
|
2064 | + foreach($req as $k => $v) { |
|
2065 | + $_REQUEST[$k] = $v; |
|
2066 | 2066 | |
2067 | - //ensure the keys are safe as well. If mbstring encoding translation is on, the post keys don't |
|
2067 | + //ensure the keys are safe as well. If mbstring encoding translation is on, the post keys don't |
|
2068 | 2068 | //get translated, so scrub the data but don't die |
2069 | - if(ini_get('mbstring.encoding_translation')==='1'){ |
|
2069 | + if(ini_get('mbstring.encoding_translation')==='1'){ |
|
2070 | 2070 | securexsskey($k,false); |
2071 | 2071 | }else{ |
2072 | - securexsskey($k,true); |
|
2072 | + securexsskey($k,true); |
|
2073 | 2073 | } |
2074 | 2074 | |
2075 | - } |
|
2076 | - // 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']); |
|
2090 | - |
|
2091 | - if(isset($_REQUEST['lvso'])){ |
|
2092 | - set_superglobals('lvso', (strtolower($_REQUEST['lvso']) === 'desc')?'desc':'asc'); |
|
2093 | - } |
|
2094 | - // Clean "offset" and "order_by" parameters in URL |
|
2095 | - foreach ($_REQUEST as $key => $val) { |
|
2096 | - if (str_end($key, "_offset")) { |
|
2097 | - clean_string($_REQUEST[$key], "ALPHANUM"); // keep this ALPHANUM for disable_count_query |
|
2098 | - set_superglobals($key, $_REQUEST[$key]); |
|
2099 | - } |
|
2100 | - elseif (str_end($key, "_ORDER_BY")) { |
|
2101 | - clean_string($_REQUEST[$key], "SQL_COLUMN_LIST"); |
|
2102 | - set_superglobals($key, $_REQUEST[$key]); |
|
2103 | - } |
|
2104 | - } |
|
2075 | + } |
|
2076 | + // 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']); |
|
2090 | + |
|
2091 | + if(isset($_REQUEST['lvso'])){ |
|
2092 | + set_superglobals('lvso', (strtolower($_REQUEST['lvso']) === 'desc')?'desc':'asc'); |
|
2093 | + } |
|
2094 | + // Clean "offset" and "order_by" parameters in URL |
|
2095 | + foreach ($_REQUEST as $key => $val) { |
|
2096 | + if (str_end($key, "_offset")) { |
|
2097 | + clean_string($_REQUEST[$key], "ALPHANUM"); // keep this ALPHANUM for disable_count_query |
|
2098 | + set_superglobals($key, $_REQUEST[$key]); |
|
2099 | + } |
|
2100 | + elseif (str_end($key, "_ORDER_BY")) { |
|
2101 | + clean_string($_REQUEST[$key], "SQL_COLUMN_LIST"); |
|
2102 | + set_superglobals($key, $_REQUEST[$key]); |
|
2103 | + } |
|
2104 | + } |
|
2105 | 2105 | |
2106 | 2106 | |
2107 | - return 0; |
|
2107 | + return 0; |
|
2108 | 2108 | } |
2109 | 2109 | |
2110 | 2110 | // Returns TRUE if $str begins with $begin |
2111 | 2111 | function str_begin($str, $begin) { |
2112 | - return (substr($str, 0, strlen($begin)) == $begin); |
|
2112 | + return (substr($str, 0, strlen($begin)) == $begin); |
|
2113 | 2113 | } |
2114 | 2114 | |
2115 | 2115 | // Returns TRUE if $str ends with $end |
2116 | 2116 | function str_end($str, $end) { |
2117 | - return (substr($str, strlen($str) - strlen($end)) == $end); |
|
2117 | + return (substr($str, strlen($str) - strlen($end)) == $end); |
|
2118 | 2118 | } |
2119 | 2119 | |
2120 | 2120 | function securexss($value) { |
2121 | - if(is_array($value)){ |
|
2122 | - $new = array(); |
|
2121 | + if(is_array($value)){ |
|
2122 | + $new = array(); |
|
2123 | 2123 | foreach($value as $key=>$val){ |
2124 | - $new[$key] = securexss($val); |
|
2124 | + $new[$key] = securexss($val); |
|
2125 | 2125 | } |
2126 | 2126 | return $new; |
2127 | 2127 | } |
2128 | - static $xss_cleanup= array(""" => "&", '"' =>'"', "'" => ''' , '<' =>'<' , '>'=>'>'); |
|
2129 | - $value = preg_replace(array('/javascript:/i', '/\0/'), array('java script:', ''), $value); |
|
2130 | - $value = preg_replace('/javascript:/i', 'java script:', $value); |
|
2131 | - return str_replace(array_keys($xss_cleanup), array_values($xss_cleanup), $value); |
|
2128 | + static $xss_cleanup= array(""" => "&", '"' =>'"', "'" => ''' , '<' =>'<' , '>'=>'>'); |
|
2129 | + $value = preg_replace(array('/javascript:/i', '/\0/'), array('java script:', ''), $value); |
|
2130 | + $value = preg_replace('/javascript:/i', 'java script:', $value); |
|
2131 | + return str_replace(array_keys($xss_cleanup), array_values($xss_cleanup), $value); |
|
2132 | 2132 | } |
2133 | 2133 | |
2134 | 2134 | function securexsskey($value, $die=true){ |
2135 | - global $sugar_config; |
|
2136 | - $matches = array(); |
|
2137 | - preg_match('/[\'"<>]/', $value, $matches); |
|
2138 | - if(!empty($matches)){ |
|
2139 | - if($die){ |
|
2140 | - die("Bad data passed in; <a href=\"{$sugar_config['site_url']}\">Return to Home</a>"); |
|
2141 | - }else{ |
|
2142 | - unset($_REQUEST[$value]); |
|
2143 | - unset($_POST[$value]); |
|
2144 | - unset($_GET[$value]); |
|
2145 | - } |
|
2146 | - } |
|
2135 | + global $sugar_config; |
|
2136 | + $matches = array(); |
|
2137 | + preg_match('/[\'"<>]/', $value, $matches); |
|
2138 | + if(!empty($matches)){ |
|
2139 | + if($die){ |
|
2140 | + die("Bad data passed in; <a href=\"{$sugar_config['site_url']}\">Return to Home</a>"); |
|
2141 | + }else{ |
|
2142 | + unset($_REQUEST[$value]); |
|
2143 | + unset($_POST[$value]); |
|
2144 | + unset($_GET[$value]); |
|
2145 | + } |
|
2146 | + } |
|
2147 | 2147 | } |
2148 | 2148 | |
2149 | 2149 | function preprocess_param($value){ |
2150 | - if(is_string($value)){ |
|
2151 | - if(get_magic_quotes_gpc() == 1){ |
|
2152 | - $value = stripslashes($value); |
|
2153 | - } |
|
2150 | + if(is_string($value)){ |
|
2151 | + if(get_magic_quotes_gpc() == 1){ |
|
2152 | + $value = stripslashes($value); |
|
2153 | + } |
|
2154 | 2154 | |
2155 | - $value = securexss($value); |
|
2156 | - } |
|
2157 | - else if (is_array($value)){ |
|
2158 | - foreach ($value as $key => $element) { |
|
2159 | - $value[$key] = preprocess_param($element); |
|
2160 | - } |
|
2161 | - } |
|
2155 | + $value = securexss($value); |
|
2156 | + } |
|
2157 | + else if (is_array($value)){ |
|
2158 | + foreach ($value as $key => $element) { |
|
2159 | + $value[$key] = preprocess_param($element); |
|
2160 | + } |
|
2161 | + } |
|
2162 | 2162 | |
2163 | - return $value; |
|
2163 | + return $value; |
|
2164 | 2164 | } |
2165 | 2165 | |
2166 | 2166 | function cleanup_slashes($value) |
@@ -2184,13 +2184,13 @@ discard block |
||
2184 | 2184 | // this function cleans id's when being imported |
2185 | 2185 | function convert_id($string) |
2186 | 2186 | { |
2187 | - return preg_replace_callback( '|[^A-Za-z0-9\-]|', |
|
2188 | - create_function( |
|
2189 | - // single quotes are essential here, |
|
2190 | - // or alternative escape all $ as \$ |
|
2191 | - '$matches', |
|
2192 | - 'return ord($matches[0]);' |
|
2193 | - ) ,$string); |
|
2187 | + return preg_replace_callback( '|[^A-Za-z0-9\-]|', |
|
2188 | + create_function( |
|
2189 | + // single quotes are essential here, |
|
2190 | + // or alternative escape all $ as \$ |
|
2191 | + '$matches', |
|
2192 | + 'return ord($matches[0]);' |
|
2193 | + ) ,$string); |
|
2194 | 2194 | } |
2195 | 2195 | |
2196 | 2196 | /** |
@@ -2201,41 +2201,41 @@ discard block |
||
2201 | 2201 | return SugarThemeRegistry::current()->getImage(basename($image), $other_attributes, empty($width) ? null : $width, empty($height) ? null : $height, $ext, $alt ); |
2202 | 2202 | } |
2203 | 2203 | /** |
2204 | - * @deprecated use SugarTheme::getImageURL() |
|
2205 | - */ |
|
2204 | + * @deprecated use SugarTheme::getImageURL() |
|
2205 | + */ |
|
2206 | 2206 | function getImagePath($image_name) |
2207 | 2207 | { |
2208 | 2208 | return SugarThemeRegistry::current()->getImageURL($image_name); |
2209 | 2209 | } |
2210 | 2210 | |
2211 | 2211 | function getWebPath($relative_path){ |
2212 | - //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); |
|
2215 | - return $relative_path; |
|
2212 | + //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); |
|
2215 | + return $relative_path; |
|
2216 | 2216 | } |
2217 | 2217 | |
2218 | 2218 | function getVersionedPath($path, $additional_attrs='') |
2219 | 2219 | { |
2220 | - if(empty($GLOBALS['sugar_config']['js_custom_version'])) $GLOBALS['sugar_config']['js_custom_version'] = 1; |
|
2221 | - $js_version_key = isset($GLOBALS['js_version_key'])?$GLOBALS['js_version_key']:''; |
|
2222 | - if(inDeveloperMode()) { |
|
2223 | - static $rand; |
|
2224 | - if(empty($rand)) $rand = mt_rand(); |
|
2225 | - $dev = $rand; |
|
2226 | - } else { |
|
2227 | - $dev = ''; |
|
2228 | - } |
|
2229 | - if(is_array($additional_attrs)) { |
|
2230 | - $additional_attrs = join("|",$additional_attrs); |
|
2231 | - } |
|
2232 | - // cutting 2 last chars here because since md5 is 32 chars, it's always == |
|
2233 | - $str = substr(base64_encode(md5("$js_version_key|{$GLOBALS['sugar_config']['js_custom_version']}|$dev|$additional_attrs", true)), 0, -2); |
|
2234 | - // remove / - it confuses some parsers |
|
2235 | - $str = strtr($str, '/+', '-_'); |
|
2236 | - if(empty($path)) return $str; |
|
2220 | + if(empty($GLOBALS['sugar_config']['js_custom_version'])) $GLOBALS['sugar_config']['js_custom_version'] = 1; |
|
2221 | + $js_version_key = isset($GLOBALS['js_version_key'])?$GLOBALS['js_version_key']:''; |
|
2222 | + if(inDeveloperMode()) { |
|
2223 | + static $rand; |
|
2224 | + if(empty($rand)) $rand = mt_rand(); |
|
2225 | + $dev = $rand; |
|
2226 | + } else { |
|
2227 | + $dev = ''; |
|
2228 | + } |
|
2229 | + if(is_array($additional_attrs)) { |
|
2230 | + $additional_attrs = join("|",$additional_attrs); |
|
2231 | + } |
|
2232 | + // cutting 2 last chars here because since md5 is 32 chars, it's always == |
|
2233 | + $str = substr(base64_encode(md5("$js_version_key|{$GLOBALS['sugar_config']['js_custom_version']}|$dev|$additional_attrs", true)), 0, -2); |
|
2234 | + // remove / - it confuses some parsers |
|
2235 | + $str = strtr($str, '/+', '-_'); |
|
2236 | + if(empty($path)) return $str; |
|
2237 | 2237 | |
2238 | - return $path . "?v=$str"; |
|
2238 | + return $path . "?v=$str"; |
|
2239 | 2239 | } |
2240 | 2240 | |
2241 | 2241 | function getVersionedScript($path, $additional_attrs='') |
@@ -2245,19 +2245,19 @@ discard block |
||
2245 | 2245 | |
2246 | 2246 | function getJSPath($relative_path, $additional_attrs='') |
2247 | 2247 | { |
2248 | - if(defined('TEMPLATE_URL'))$relative_path = SugarTemplateUtilities::getWebPath($relative_path); |
|
2249 | - return getVersionedPath($relative_path).(!empty($additional_attrs)?"&$additional_attrs":""); |
|
2248 | + if(defined('TEMPLATE_URL'))$relative_path = SugarTemplateUtilities::getWebPath($relative_path); |
|
2249 | + return getVersionedPath($relative_path).(!empty($additional_attrs)?"&$additional_attrs":""); |
|
2250 | 2250 | } |
2251 | 2251 | |
2252 | 2252 | function getSWFPath($relative_path, $additional_params=''){ |
2253 | - $path = $relative_path; |
|
2254 | - if (!empty($additional_params)){ |
|
2255 | - $path .= '?' . $additional_params; |
|
2256 | - } |
|
2257 | - if (defined('TEMPLATE_URL')){ |
|
2258 | - $path = TEMPLATE_URL . '/' . $path; |
|
2259 | - } |
|
2260 | - return $path; |
|
2253 | + $path = $relative_path; |
|
2254 | + if (!empty($additional_params)){ |
|
2255 | + $path .= '?' . $additional_params; |
|
2256 | + } |
|
2257 | + if (defined('TEMPLATE_URL')){ |
|
2258 | + $path = TEMPLATE_URL . '/' . $path; |
|
2259 | + } |
|
2260 | + return $path; |
|
2261 | 2261 | } |
2262 | 2262 | |
2263 | 2263 | |
@@ -2266,158 +2266,158 @@ discard block |
||
2266 | 2266 | |
2267 | 2267 | function getSQLDate($date_str) |
2268 | 2268 | { |
2269 | - if (preg_match('/^(\d{1,2})-(\d{1,2})-(\d{4})$/',$date_str,$match)) |
|
2270 | - { |
|
2271 | - if ( strlen($match[2]) == 1) |
|
2272 | - { |
|
2273 | - $match[2] = "0".$match[2]; |
|
2274 | - } |
|
2275 | - if ( strlen($match[1]) == 1) |
|
2276 | - { |
|
2277 | - $match[1] = "0".$match[1]; |
|
2278 | - } |
|
2279 | - return "{$match[3]}-{$match[1]}-{$match[2]}"; |
|
2280 | - } |
|
2281 | - else if (preg_match('/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/',$date_str,$match)) |
|
2282 | - { |
|
2283 | - if ( strlen($match[2]) == 1) |
|
2284 | - { |
|
2285 | - $match[2] = "0".$match[2]; |
|
2286 | - } |
|
2287 | - if ( strlen($match[1]) == 1) |
|
2288 | - { |
|
2289 | - $match[1] = "0".$match[1]; |
|
2290 | - } |
|
2291 | - return "{$match[3]}-{$match[1]}-{$match[2]}"; |
|
2292 | - } |
|
2293 | - else |
|
2294 | - { |
|
2295 | - return ""; |
|
2296 | - } |
|
2269 | + if (preg_match('/^(\d{1,2})-(\d{1,2})-(\d{4})$/',$date_str,$match)) |
|
2270 | + { |
|
2271 | + if ( strlen($match[2]) == 1) |
|
2272 | + { |
|
2273 | + $match[2] = "0".$match[2]; |
|
2274 | + } |
|
2275 | + if ( strlen($match[1]) == 1) |
|
2276 | + { |
|
2277 | + $match[1] = "0".$match[1]; |
|
2278 | + } |
|
2279 | + return "{$match[3]}-{$match[1]}-{$match[2]}"; |
|
2280 | + } |
|
2281 | + else if (preg_match('/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/',$date_str,$match)) |
|
2282 | + { |
|
2283 | + if ( strlen($match[2]) == 1) |
|
2284 | + { |
|
2285 | + $match[2] = "0".$match[2]; |
|
2286 | + } |
|
2287 | + if ( strlen($match[1]) == 1) |
|
2288 | + { |
|
2289 | + $match[1] = "0".$match[1]; |
|
2290 | + } |
|
2291 | + return "{$match[3]}-{$match[1]}-{$match[2]}"; |
|
2292 | + } |
|
2293 | + else |
|
2294 | + { |
|
2295 | + return ""; |
|
2296 | + } |
|
2297 | 2297 | } |
2298 | 2298 | |
2299 | 2299 | function clone_history(&$db, $from_id,$to_id, $to_type) |
2300 | 2300 | { |
2301 | - global $timedate; |
|
2302 | - $old_note_id=null; |
|
2303 | - $old_filename=null; |
|
2304 | - require_once('include/upload_file.php'); |
|
2305 | - $tables = array('calls'=>'Call', 'meetings'=>'Meeting', 'notes'=>'Note', 'tasks'=>'Task'); |
|
2306 | - |
|
2307 | - $location=array('Email'=>"modules/Emails/Email.php", |
|
2308 | - 'Call'=>"modules/Calls/Call.php", |
|
2309 | - 'Meeting'=>"modules/Meetings/Meeting.php", |
|
2310 | - 'Note'=>"modules/Notes/Note.php", |
|
2311 | - 'Tasks'=>"modules/Tasks/Task.php", |
|
2312 | - ); |
|
2313 | - |
|
2314 | - |
|
2315 | - foreach($tables as $table=>$bean_class) |
|
2316 | - { |
|
2317 | - |
|
2318 | - if (!class_exists($bean_class)) |
|
2319 | - { |
|
2320 | - require_once($location[$bean_class]); |
|
2321 | - } |
|
2322 | - |
|
2323 | - $bProcessingNotes=false; |
|
2324 | - if ($table=='notes') |
|
2325 | - { |
|
2326 | - $bProcessingNotes=true; |
|
2327 | - } |
|
2328 | - $query = "SELECT id FROM $table WHERE parent_id='$from_id'"; |
|
2329 | - $results = $db->query($query); |
|
2330 | - while($row = $db->fetchByAssoc($results)) |
|
2331 | - { |
|
2332 | - //retrieve existing record. |
|
2333 | - $bean= new $bean_class(); |
|
2334 | - $bean->retrieve($row['id']); |
|
2335 | - //process for new instance. |
|
2336 | - if ($bProcessingNotes) |
|
2337 | - { |
|
2338 | - $old_note_id=$row['id']; |
|
2339 | - $old_filename=$bean->filename; |
|
2340 | - } |
|
2341 | - $bean->id=null; |
|
2342 | - $bean->parent_id=$to_id; |
|
2343 | - $bean->parent_type=$to_type; |
|
2344 | - if ($to_type=='Contacts' and in_array('contact_id',$bean->column_fields)) |
|
2345 | - { |
|
2346 | - $bean->contact_id=$to_id; |
|
2347 | - } |
|
2348 | - $bean->update_date_modified = false; |
|
2301 | + global $timedate; |
|
2302 | + $old_note_id=null; |
|
2303 | + $old_filename=null; |
|
2304 | + require_once('include/upload_file.php'); |
|
2305 | + $tables = array('calls'=>'Call', 'meetings'=>'Meeting', 'notes'=>'Note', 'tasks'=>'Task'); |
|
2306 | + |
|
2307 | + $location=array('Email'=>"modules/Emails/Email.php", |
|
2308 | + 'Call'=>"modules/Calls/Call.php", |
|
2309 | + 'Meeting'=>"modules/Meetings/Meeting.php", |
|
2310 | + 'Note'=>"modules/Notes/Note.php", |
|
2311 | + 'Tasks'=>"modules/Tasks/Task.php", |
|
2312 | + ); |
|
2313 | + |
|
2314 | + |
|
2315 | + foreach($tables as $table=>$bean_class) |
|
2316 | + { |
|
2317 | + |
|
2318 | + if (!class_exists($bean_class)) |
|
2319 | + { |
|
2320 | + require_once($location[$bean_class]); |
|
2321 | + } |
|
2322 | + |
|
2323 | + $bProcessingNotes=false; |
|
2324 | + if ($table=='notes') |
|
2325 | + { |
|
2326 | + $bProcessingNotes=true; |
|
2327 | + } |
|
2328 | + $query = "SELECT id FROM $table WHERE parent_id='$from_id'"; |
|
2329 | + $results = $db->query($query); |
|
2330 | + while($row = $db->fetchByAssoc($results)) |
|
2331 | + { |
|
2332 | + //retrieve existing record. |
|
2333 | + $bean= new $bean_class(); |
|
2334 | + $bean->retrieve($row['id']); |
|
2335 | + //process for new instance. |
|
2336 | + if ($bProcessingNotes) |
|
2337 | + { |
|
2338 | + $old_note_id=$row['id']; |
|
2339 | + $old_filename=$bean->filename; |
|
2340 | + } |
|
2341 | + $bean->id=null; |
|
2342 | + $bean->parent_id=$to_id; |
|
2343 | + $bean->parent_type=$to_type; |
|
2344 | + if ($to_type=='Contacts' and in_array('contact_id',$bean->column_fields)) |
|
2345 | + { |
|
2346 | + $bean->contact_id=$to_id; |
|
2347 | + } |
|
2348 | + $bean->update_date_modified = false; |
|
2349 | 2349 | $bean->update_modified_by = false; |
2350 | 2350 | if(isset($bean->date_modified)) |
2351 | 2351 | $bean->date_modified = $timedate->to_db($bean->date_modified); |
2352 | 2352 | if(isset($bean->date_entered)) |
2353 | 2353 | $bean->date_entered = $timedate->to_db($bean->date_entered); |
2354 | - //save |
|
2355 | - $new_id=$bean->save(); |
|
2354 | + //save |
|
2355 | + $new_id=$bean->save(); |
|
2356 | 2356 | |
2357 | - //duplicate the file now. for notes. |
|
2358 | - if ($bProcessingNotes && !empty($old_filename)) |
|
2359 | - { |
|
2360 | - UploadFile::duplicate_file($old_note_id,$new_id,$old_filename); |
|
2361 | - } |
|
2362 | - //reset the values needed for attachment duplication. |
|
2363 | - $old_note_id=null; |
|
2364 | - $old_filename=null; |
|
2365 | - } |
|
2366 | - } |
|
2357 | + //duplicate the file now. for notes. |
|
2358 | + if ($bProcessingNotes && !empty($old_filename)) |
|
2359 | + { |
|
2360 | + UploadFile::duplicate_file($old_note_id,$new_id,$old_filename); |
|
2361 | + } |
|
2362 | + //reset the values needed for attachment duplication. |
|
2363 | + $old_note_id=null; |
|
2364 | + $old_filename=null; |
|
2365 | + } |
|
2366 | + } |
|
2367 | 2367 | } |
2368 | 2368 | |
2369 | 2369 | function values_to_keys($array) |
2370 | 2370 | { |
2371 | - $new_array = array(); |
|
2372 | - if(!is_array($array)) |
|
2373 | - { |
|
2374 | - return $new_array; |
|
2375 | - } |
|
2376 | - foreach($array as $arr){ |
|
2377 | - $new_array[$arr] = $arr; |
|
2378 | - } |
|
2379 | - return $new_array; |
|
2371 | + $new_array = array(); |
|
2372 | + if(!is_array($array)) |
|
2373 | + { |
|
2374 | + return $new_array; |
|
2375 | + } |
|
2376 | + foreach($array as $arr){ |
|
2377 | + $new_array[$arr] = $arr; |
|
2378 | + } |
|
2379 | + return $new_array; |
|
2380 | 2380 | } |
2381 | 2381 | |
2382 | 2382 | function clone_relationship(&$db, $tables = array(), $from_column, $from_id, $to_id) |
2383 | 2383 | { |
2384 | - foreach($tables as $table) |
|
2385 | - { |
|
2386 | - |
|
2387 | - if ($table == 'emails_beans') { |
|
2388 | - $query = "SELECT * FROM $table WHERE $from_column='$from_id' and bean_module='Leads'"; |
|
2389 | - } else { |
|
2390 | - $query = "SELECT * FROM $table WHERE $from_column='$from_id'"; |
|
2391 | - } |
|
2392 | - $results = $db->query($query); |
|
2393 | - while($row = $db->fetchByAssoc($results)) |
|
2394 | - { |
|
2395 | - $query = "INSERT INTO $table "; |
|
2396 | - $names = ''; |
|
2397 | - $values = ''; |
|
2398 | - $row[$from_column] = $to_id; |
|
2399 | - $row['id'] = create_guid(); |
|
2400 | - if ($table=='emails_beans') { |
|
2401 | - $row['bean_module'] =='Contacts'; |
|
2402 | - } |
|
2384 | + foreach($tables as $table) |
|
2385 | + { |
|
2403 | 2386 | |
2404 | - foreach($row as $name=>$value) |
|
2405 | - { |
|
2406 | - |
|
2407 | - if(empty($names)) |
|
2408 | - { |
|
2409 | - $names .= $name; |
|
2410 | - $values .= "'$value'"; |
|
2411 | - } else |
|
2412 | - { |
|
2413 | - $names .= ', '. $name; |
|
2414 | - $values .= ", '$value'"; |
|
2415 | - } |
|
2416 | - } |
|
2417 | - $query .= "($names) VALUES ($values)"; |
|
2418 | - $db->query($query); |
|
2419 | - } |
|
2420 | - } |
|
2387 | + if ($table == 'emails_beans') { |
|
2388 | + $query = "SELECT * FROM $table WHERE $from_column='$from_id' and bean_module='Leads'"; |
|
2389 | + } else { |
|
2390 | + $query = "SELECT * FROM $table WHERE $from_column='$from_id'"; |
|
2391 | + } |
|
2392 | + $results = $db->query($query); |
|
2393 | + while($row = $db->fetchByAssoc($results)) |
|
2394 | + { |
|
2395 | + $query = "INSERT INTO $table "; |
|
2396 | + $names = ''; |
|
2397 | + $values = ''; |
|
2398 | + $row[$from_column] = $to_id; |
|
2399 | + $row['id'] = create_guid(); |
|
2400 | + if ($table=='emails_beans') { |
|
2401 | + $row['bean_module'] =='Contacts'; |
|
2402 | + } |
|
2403 | + |
|
2404 | + foreach($row as $name=>$value) |
|
2405 | + { |
|
2406 | + |
|
2407 | + if(empty($names)) |
|
2408 | + { |
|
2409 | + $names .= $name; |
|
2410 | + $values .= "'$value'"; |
|
2411 | + } else |
|
2412 | + { |
|
2413 | + $names .= ', '. $name; |
|
2414 | + $values .= ", '$value'"; |
|
2415 | + } |
|
2416 | + } |
|
2417 | + $query .= "($names) VALUES ($values)"; |
|
2418 | + $db->query($query); |
|
2419 | + } |
|
2420 | + } |
|
2421 | 2421 | } |
2422 | 2422 | |
2423 | 2423 | function get_unlinked_email_query($type, $bean) { |
@@ -2426,7 +2426,7 @@ discard block |
||
2426 | 2426 | $return_array['select']='SELECT emails.id '; |
2427 | 2427 | $return_array['from']='FROM emails '; |
2428 | 2428 | $return_array['where']=""; |
2429 | - $return_array['join'] = " JOIN (select DISTINCT email_id from emails_email_addr_rel eear |
|
2429 | + $return_array['join'] = " JOIN (select DISTINCT email_id from emails_email_addr_rel eear |
|
2430 | 2430 | |
2431 | 2431 | join email_addr_bean_rel eabr on eabr.bean_id ='$bean->id' and eabr.bean_module = '$bean->module_dir' and |
2432 | 2432 | eabr.email_address_id = eear.email_address_id and eabr.deleted=0 |
@@ -2435,17 +2435,17 @@ discard block |
||
2435 | 2435 | ) derivedemails on derivedemails.email_id = emails.id"; |
2436 | 2436 | $return_array['join_tables'][0] = ''; |
2437 | 2437 | |
2438 | - if (isset($type) and !empty($type['return_as_array'])) { |
|
2439 | - return $return_array; |
|
2440 | - } |
|
2438 | + if (isset($type) and !empty($type['return_as_array'])) { |
|
2439 | + return $return_array; |
|
2440 | + } |
|
2441 | 2441 | |
2442 | - return $return_array['select'] . $return_array['from'] . $return_array['where'] . $return_array['join'] ; |
|
2442 | + return $return_array['select'] . $return_array['from'] . $return_array['where'] . $return_array['join'] ; |
|
2443 | 2443 | } // fn |
2444 | 2444 | |
2445 | 2445 | function get_emails_by_assign_or_link($params) |
2446 | 2446 | { |
2447 | 2447 | $relation = $params['link']; |
2448 | - $bean = $GLOBALS['app']->controller->bean; |
|
2448 | + $bean = $GLOBALS['app']->controller->bean; |
|
2449 | 2449 | if(empty($bean->$relation)) { |
2450 | 2450 | $bean->load_relationship($relation); |
2451 | 2451 | } |
@@ -2455,8 +2455,8 @@ discard block |
||
2455 | 2455 | } |
2456 | 2456 | $rel_module = $bean->$relation->getRelatedModuleName(); |
2457 | 2457 | $rel_join = $bean->$relation->getJoin(array( |
2458 | - 'join_table_alias' => 'link_bean', |
|
2459 | - 'join_table_link_alias' => 'linkt', |
|
2458 | + 'join_table_alias' => 'link_bean', |
|
2459 | + 'join_table_link_alias' => 'linkt', |
|
2460 | 2460 | )); |
2461 | 2461 | $rel_join = str_replace("{$bean->table_name}.id", "'{$bean->id}'", $rel_join); |
2462 | 2462 | $return_array['select']='SELECT DISTINCT emails.id '; |
@@ -2535,12 +2535,12 @@ discard block |
||
2535 | 2535 | |
2536 | 2536 | $return_array['where']=" WHERE emails.deleted=0 "; |
2537 | 2537 | |
2538 | - //$return_array['join'] = ''; |
|
2538 | + //$return_array['join'] = ''; |
|
2539 | 2539 | $return_array['join_tables'][0] = ''; |
2540 | 2540 | |
2541 | 2541 | if($bean->object_name == "Case" && !empty($bean->case_number)) { |
2542 | 2542 | $where = str_replace("%1", $bean->case_number, $bean->getEmailSubjectMacro()); |
2543 | - $return_array["where"] .= "\n AND (email_ids.source = 'direct' OR emails.name LIKE '%$where%')"; |
|
2543 | + $return_array["where"] .= "\n AND (email_ids.source = 'direct' OR emails.name LIKE '%$where%')"; |
|
2544 | 2544 | } |
2545 | 2545 | |
2546 | 2546 | return $return_array; |
@@ -2553,32 +2553,32 @@ discard block |
||
2553 | 2553 | **/ |
2554 | 2554 | function number_empty($value) |
2555 | 2555 | { |
2556 | - return empty($value) && $value != '0'; |
|
2556 | + return empty($value) && $value != '0'; |
|
2557 | 2557 | } |
2558 | 2558 | |
2559 | 2559 | function get_bean_select_array($add_blank=true, $bean_name, $display_columns, $where='', $order_by='', $blank_is_none=false) |
2560 | 2560 | { |
2561 | - global $beanFiles; |
|
2562 | - require_once($beanFiles[$bean_name]); |
|
2563 | - $focus = new $bean_name(); |
|
2564 | - $user_array = array(); |
|
2561 | + global $beanFiles; |
|
2562 | + require_once($beanFiles[$bean_name]); |
|
2563 | + $focus = new $bean_name(); |
|
2564 | + $user_array = array(); |
|
2565 | 2565 | |
2566 | 2566 | $key = ($bean_name == 'EmailTemplate') ? $bean_name : $bean_name . $display_columns. $where . $order_by; |
2567 | - $user_array = get_register_value('select_array', $key ); |
|
2568 | - if(!$user_array) |
|
2569 | - { |
|
2567 | + $user_array = get_register_value('select_array', $key ); |
|
2568 | + if(!$user_array) |
|
2569 | + { |
|
2570 | 2570 | |
2571 | - $db = DBManagerFactory::getInstance(); |
|
2571 | + $db = DBManagerFactory::getInstance(); |
|
2572 | 2572 | |
2573 | - $temp_result = Array(); |
|
2574 | - $query = "SELECT {$focus->table_name}.id, {$display_columns} as display from {$focus->table_name} "; |
|
2575 | - $query .= "where "; |
|
2576 | - if ( $where != '') |
|
2577 | - { |
|
2578 | - $query .= $where." AND "; |
|
2579 | - } |
|
2573 | + $temp_result = Array(); |
|
2574 | + $query = "SELECT {$focus->table_name}.id, {$display_columns} as display from {$focus->table_name} "; |
|
2575 | + $query .= "where "; |
|
2576 | + if ( $where != '') |
|
2577 | + { |
|
2578 | + $query .= $where." AND "; |
|
2579 | + } |
|
2580 | 2580 | |
2581 | - $query .= " {$focus->table_name}.deleted=0"; |
|
2581 | + $query .= " {$focus->table_name}.deleted=0"; |
|
2582 | 2582 | |
2583 | 2583 | /* BEGIN - SECURITY GROUPS */ |
2584 | 2584 | global $current_user, $sugar_config; |
@@ -2603,35 +2603,35 @@ discard block |
||
2603 | 2603 | } |
2604 | 2604 | /* END - SECURITY GROUPS */ |
2605 | 2605 | |
2606 | - if ( $order_by != '') |
|
2607 | - { |
|
2608 | - $query .= " order by {$focus->table_name}.{$order_by}"; |
|
2609 | - } |
|
2610 | - |
|
2611 | - $GLOBALS['log']->debug("get_user_array query: $query"); |
|
2612 | - $result = $db->query($query, true, "Error filling in user array: "); |
|
2613 | - |
|
2614 | - if ($add_blank==true){ |
|
2615 | - // Add in a blank row |
|
2616 | - if($blank_is_none == true) { // set 'blank row' to "--None--" |
|
2617 | - global $app_strings; |
|
2618 | - $temp_result[''] = $app_strings['LBL_NONE']; |
|
2619 | - } else { |
|
2620 | - $temp_result[''] = ''; |
|
2621 | - } |
|
2622 | - } |
|
2606 | + if ( $order_by != '') |
|
2607 | + { |
|
2608 | + $query .= " order by {$focus->table_name}.{$order_by}"; |
|
2609 | + } |
|
2623 | 2610 | |
2624 | - // Get the id and the name. |
|
2625 | - while($row = $db->fetchByAssoc($result)) |
|
2626 | - { |
|
2627 | - $temp_result[$row['id']] = $row['display']; |
|
2628 | - } |
|
2611 | + $GLOBALS['log']->debug("get_user_array query: $query"); |
|
2612 | + $result = $db->query($query, true, "Error filling in user array: "); |
|
2629 | 2613 | |
2630 | - $user_array = $temp_result; |
|
2631 | - set_register_value('select_array', $key ,$temp_result); |
|
2632 | - } |
|
2614 | + if ($add_blank==true){ |
|
2615 | + // Add in a blank row |
|
2616 | + if($blank_is_none == true) { // set 'blank row' to "--None--" |
|
2617 | + global $app_strings; |
|
2618 | + $temp_result[''] = $app_strings['LBL_NONE']; |
|
2619 | + } else { |
|
2620 | + $temp_result[''] = ''; |
|
2621 | + } |
|
2622 | + } |
|
2623 | + |
|
2624 | + // Get the id and the name. |
|
2625 | + while($row = $db->fetchByAssoc($result)) |
|
2626 | + { |
|
2627 | + $temp_result[$row['id']] = $row['display']; |
|
2628 | + } |
|
2629 | + |
|
2630 | + $user_array = $temp_result; |
|
2631 | + set_register_value('select_array', $key ,$temp_result); |
|
2632 | + } |
|
2633 | 2633 | |
2634 | - return $user_array; |
|
2634 | + return $user_array; |
|
2635 | 2635 | |
2636 | 2636 | } |
2637 | 2637 | /** |
@@ -2643,50 +2643,50 @@ discard block |
||
2643 | 2643 | // searches a list for items in a user's allowed tabs and returns an array that removes unallowed tabs from list |
2644 | 2644 | function parse_list_modules(&$listArray) |
2645 | 2645 | { |
2646 | - global $modListHeader; |
|
2647 | - $returnArray = array(); |
|
2648 | - |
|
2649 | - foreach($listArray as $optionName => $optionVal) |
|
2650 | - { |
|
2651 | - if(array_key_exists($optionName, $modListHeader)) |
|
2652 | - { |
|
2653 | - $returnArray[$optionName] = $optionVal; |
|
2654 | - } |
|
2655 | - |
|
2656 | - // special case for projects |
|
2657 | - if(array_key_exists('Project', $modListHeader)) |
|
2658 | - { |
|
2659 | - $returnArray['ProjectTask'] = $listArray['ProjectTask']; |
|
2660 | - } |
|
2661 | - } |
|
2662 | - $acldenied = ACLController::disabledModuleList($listArray,false); |
|
2663 | - foreach($acldenied as $denied){ |
|
2664 | - unset($returnArray[$denied]); |
|
2665 | - } |
|
2666 | - asort($returnArray); |
|
2646 | + global $modListHeader; |
|
2647 | + $returnArray = array(); |
|
2648 | + |
|
2649 | + foreach($listArray as $optionName => $optionVal) |
|
2650 | + { |
|
2651 | + if(array_key_exists($optionName, $modListHeader)) |
|
2652 | + { |
|
2653 | + $returnArray[$optionName] = $optionVal; |
|
2654 | + } |
|
2655 | + |
|
2656 | + // special case for projects |
|
2657 | + if(array_key_exists('Project', $modListHeader)) |
|
2658 | + { |
|
2659 | + $returnArray['ProjectTask'] = $listArray['ProjectTask']; |
|
2660 | + } |
|
2661 | + } |
|
2662 | + $acldenied = ACLController::disabledModuleList($listArray,false); |
|
2663 | + foreach($acldenied as $denied){ |
|
2664 | + unset($returnArray[$denied]); |
|
2665 | + } |
|
2666 | + asort($returnArray); |
|
2667 | 2667 | |
2668 | - return $returnArray; |
|
2668 | + return $returnArray; |
|
2669 | 2669 | } |
2670 | 2670 | |
2671 | 2671 | function display_notice($msg = false){ |
2672 | - global $error_notice; |
|
2673 | - //no error notice - lets just display the error to the user |
|
2674 | - if(!isset($error_notice)){ |
|
2675 | - echo '<br>'.$msg . '<br>'; |
|
2676 | - }else{ |
|
2677 | - $error_notice .= $msg . '<br>'; |
|
2678 | - } |
|
2672 | + global $error_notice; |
|
2673 | + //no error notice - lets just display the error to the user |
|
2674 | + if(!isset($error_notice)){ |
|
2675 | + echo '<br>'.$msg . '<br>'; |
|
2676 | + }else{ |
|
2677 | + $error_notice .= $msg . '<br>'; |
|
2678 | + } |
|
2679 | 2679 | } |
2680 | 2680 | |
2681 | 2681 | /* checks if it is a number that at least has the plus at the beginning. |
2682 | 2682 | */ |
2683 | 2683 | function skype_formatted($number){ |
2684 | - //kbrill - BUG #15375 |
|
2685 | - if(isset($_REQUEST['action']) && $_REQUEST['action']=="Popup") { |
|
2686 | - return false; |
|
2687 | - } else { |
|
2688 | - return substr($number, 0, 1) == '+' || substr($number, 0, 2) == '00' || substr($number, 0, 3) == '011'; |
|
2689 | - } |
|
2684 | + //kbrill - BUG #15375 |
|
2685 | + if(isset($_REQUEST['action']) && $_REQUEST['action']=="Popup") { |
|
2686 | + return false; |
|
2687 | + } else { |
|
2688 | + return substr($number, 0, 1) == '+' || substr($number, 0, 2) == '00' || substr($number, 0, 3) == '011'; |
|
2689 | + } |
|
2690 | 2690 | // return substr($number, 0, 1) == '+' || substr($number, 0, 2) == '00' || substr($number, 0, 2) == '011'; |
2691 | 2691 | } |
2692 | 2692 | |
@@ -2695,72 +2695,72 @@ discard block |
||
2695 | 2695 | } |
2696 | 2696 | |
2697 | 2697 | function insert_charset_header() { |
2698 | - header('Content-Type: text/html; charset=UTF-8'); |
|
2698 | + header('Content-Type: text/html; charset=UTF-8'); |
|
2699 | 2699 | } |
2700 | 2700 | |
2701 | 2701 | function getCurrentURL() |
2702 | 2702 | { |
2703 | - $href = "http:"; |
|
2704 | - if(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on') |
|
2705 | - { |
|
2706 | - $href = 'https:'; |
|
2707 | - } |
|
2703 | + $href = "http:"; |
|
2704 | + if(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on') |
|
2705 | + { |
|
2706 | + $href = 'https:'; |
|
2707 | + } |
|
2708 | 2708 | |
2709 | - $href.= "//".$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'].'?'.$_SERVER['QUERY_STRING']; |
|
2710 | - return $href; |
|
2709 | + $href.= "//".$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'].'?'.$_SERVER['QUERY_STRING']; |
|
2710 | + return $href; |
|
2711 | 2711 | } |
2712 | 2712 | |
2713 | 2713 | function javascript_escape($str) { |
2714 | - $new_str = ''; |
|
2715 | - |
|
2716 | - for($i = 0; $i < strlen($str); $i++) { |
|
2717 | - |
|
2718 | - if(ord(substr($str, $i, 1))==10){ |
|
2719 | - $new_str .= '\n'; |
|
2720 | - }elseif(ord(substr($str, $i, 1))==13){ |
|
2721 | - $new_str .= '\r'; |
|
2722 | - } |
|
2723 | - else { |
|
2724 | - $new_str .= $str{$i}; |
|
2725 | - } |
|
2726 | - } |
|
2714 | + $new_str = ''; |
|
2715 | + |
|
2716 | + for($i = 0; $i < strlen($str); $i++) { |
|
2717 | + |
|
2718 | + if(ord(substr($str, $i, 1))==10){ |
|
2719 | + $new_str .= '\n'; |
|
2720 | + }elseif(ord(substr($str, $i, 1))==13){ |
|
2721 | + $new_str .= '\r'; |
|
2722 | + } |
|
2723 | + else { |
|
2724 | + $new_str .= $str{$i}; |
|
2725 | + } |
|
2726 | + } |
|
2727 | 2727 | |
2728 | - $new_str = str_replace("'", "\\'", $new_str); |
|
2728 | + $new_str = str_replace("'", "\\'", $new_str); |
|
2729 | 2729 | |
2730 | - return $new_str; |
|
2730 | + return $new_str; |
|
2731 | 2731 | } |
2732 | 2732 | |
2733 | 2733 | function js_escape($str, $keep=true){ |
2734 | - $str = html_entity_decode(str_replace("\\", "", $str), ENT_QUOTES); |
|
2734 | + $str = html_entity_decode(str_replace("\\", "", $str), ENT_QUOTES); |
|
2735 | 2735 | |
2736 | - if($keep){ |
|
2737 | - $str = javascript_escape($str); |
|
2738 | - } |
|
2739 | - else { |
|
2740 | - $str = str_replace("'", " ", $str); |
|
2741 | - $str = str_replace('"', " ", $str); |
|
2742 | - } |
|
2736 | + if($keep){ |
|
2737 | + $str = javascript_escape($str); |
|
2738 | + } |
|
2739 | + else { |
|
2740 | + $str = str_replace("'", " ", $str); |
|
2741 | + $str = str_replace('"', " ", $str); |
|
2742 | + } |
|
2743 | 2743 | |
2744 | - return $str; |
|
2744 | + return $str; |
|
2745 | 2745 | |
2746 | - //end function js_escape |
|
2746 | + //end function js_escape |
|
2747 | 2747 | } |
2748 | 2748 | |
2749 | 2749 | function br2nl($str) { |
2750 | - $regex = "#<[^>]+br.+?>#i"; |
|
2751 | - preg_match_all($regex, $str, $matches); |
|
2750 | + $regex = "#<[^>]+br.+?>#i"; |
|
2751 | + preg_match_all($regex, $str, $matches); |
|
2752 | 2752 | |
2753 | - foreach($matches[0] as $match) { |
|
2754 | - $str = str_replace($match, "<br>", $str); |
|
2755 | - } |
|
2753 | + foreach($matches[0] as $match) { |
|
2754 | + $str = str_replace($match, "<br>", $str); |
|
2755 | + } |
|
2756 | 2756 | |
2757 | - $brs = array('<br>','<br/>', '<br />'); |
|
2758 | - $str = str_replace("\r\n", "\n", $str); // make from windows-returns, *nix-returns |
|
2759 | - $str = str_replace("\n\r", "\n", $str); // make from windows-returns, *nix-returns |
|
2760 | - $str = str_replace("\r", "\n", $str); // make from windows-returns, *nix-returns |
|
2761 | - $str = str_ireplace($brs, "\n", $str); // to retrieve it |
|
2757 | + $brs = array('<br>','<br/>', '<br />'); |
|
2758 | + $str = str_replace("\r\n", "\n", $str); // make from windows-returns, *nix-returns |
|
2759 | + $str = str_replace("\n\r", "\n", $str); // make from windows-returns, *nix-returns |
|
2760 | + $str = str_replace("\r", "\n", $str); // make from windows-returns, *nix-returns |
|
2761 | + $str = str_ireplace($brs, "\n", $str); // to retrieve it |
|
2762 | 2762 | |
2763 | - return $str; |
|
2763 | + return $str; |
|
2764 | 2764 | } |
2765 | 2765 | |
2766 | 2766 | /** |
@@ -2782,29 +2782,29 @@ discard block |
||
2782 | 2782 | * @param $displayStackTrace also show stack trace |
2783 | 2783 | */ |
2784 | 2784 | function _ppl($mixed, $die=false, $displayStackTrace=false, $loglevel="fatal") { |
2785 | - if(!isset($GLOBALS['log']) || empty($GLOBALS['log'])) { |
|
2785 | + if(!isset($GLOBALS['log']) || empty($GLOBALS['log'])) { |
|
2786 | 2786 | |
2787 | - $GLOBALS['log'] = LoggerManager :: getLogger('SugarCRM'); |
|
2788 | - } |
|
2787 | + $GLOBALS['log'] = LoggerManager :: getLogger('SugarCRM'); |
|
2788 | + } |
|
2789 | 2789 | |
2790 | 2790 | |
2791 | - $mix = print_r($mixed, true); // send print_r() output to $mix |
|
2792 | - $stack = debug_backtrace(); |
|
2791 | + $mix = print_r($mixed, true); // send print_r() output to $mix |
|
2792 | + $stack = debug_backtrace(); |
|
2793 | 2793 | |
2794 | - $GLOBALS['log']->$loglevel('------------------------------ _ppLogger() output start -----------------------------'); |
|
2795 | - $GLOBALS['log']->$loglevel($mix); |
|
2796 | - if($displayStackTrace) { |
|
2797 | - foreach($stack as $position) { |
|
2798 | - $GLOBALS['log']->$loglevel($position['file']."({$position['line']})"); |
|
2799 | - } |
|
2800 | - } |
|
2794 | + $GLOBALS['log']->$loglevel('------------------------------ _ppLogger() output start -----------------------------'); |
|
2795 | + $GLOBALS['log']->$loglevel($mix); |
|
2796 | + if($displayStackTrace) { |
|
2797 | + foreach($stack as $position) { |
|
2798 | + $GLOBALS['log']->$loglevel($position['file']."({$position['line']})"); |
|
2799 | + } |
|
2800 | + } |
|
2801 | 2801 | |
2802 | - $GLOBALS['log']->$loglevel('------------------------------ _ppLogger() output end -----------------------------'); |
|
2803 | - $GLOBALS['log']->$loglevel('------------------------------ _ppLogger() file: '.$stack[0]['file'].' line#: '.$stack[0]['line'].'-----------------------------'); |
|
2802 | + $GLOBALS['log']->$loglevel('------------------------------ _ppLogger() output end -----------------------------'); |
|
2803 | + $GLOBALS['log']->$loglevel('------------------------------ _ppLogger() file: '.$stack[0]['file'].' line#: '.$stack[0]['line'].'-----------------------------'); |
|
2804 | 2804 | |
2805 | - if($die) { |
|
2806 | - die(); |
|
2807 | - } |
|
2805 | + if($die) { |
|
2806 | + die(); |
|
2807 | + } |
|
2808 | 2808 | } |
2809 | 2809 | |
2810 | 2810 | /** |
@@ -2869,47 +2869,47 @@ discard block |
||
2869 | 2869 | * @return 1 implies supported, 0 implies unsupported, -1 implies invalid |
2870 | 2870 | */ |
2871 | 2871 | function check_php_version($sys_php_version = '') { |
2872 | - $sys_php_version = empty($sys_php_version) ? constant('PHP_VERSION') : $sys_php_version; |
|
2873 | - // versions below $min_considered_php_version considered invalid by default, |
|
2874 | - // versions equal to or above this ver will be considered depending |
|
2875 | - // on the rules that follow |
|
2876 | - $min_considered_php_version = '5.3.0'; |
|
2877 | - |
|
2878 | - // only the supported versions, |
|
2879 | - // should be mutually exclusive with $invalid_php_versions |
|
2880 | - $supported_php_versions = array ( |
|
2881 | - '5.3.0' |
|
2882 | - ); |
|
2883 | - |
|
2884 | - // invalid versions above the $min_considered_php_version, |
|
2885 | - // should be mutually exclusive with $supported_php_versions |
|
2886 | - |
|
2887 | - // SugarCRM prohibits install on PHP 5.2.7 on all platforms |
|
2888 | - $invalid_php_versions = array('5.2.7'); |
|
2889 | - |
|
2890 | - // default unsupported |
|
2891 | - $retval = 0; |
|
2892 | - |
|
2893 | - // versions below $min_considered_php_version are invalid |
|
2894 | - if(1 == version_compare($sys_php_version, $min_considered_php_version, '<')) { |
|
2895 | - $retval = -1; |
|
2896 | - } |
|
2872 | + $sys_php_version = empty($sys_php_version) ? constant('PHP_VERSION') : $sys_php_version; |
|
2873 | + // versions below $min_considered_php_version considered invalid by default, |
|
2874 | + // versions equal to or above this ver will be considered depending |
|
2875 | + // on the rules that follow |
|
2876 | + $min_considered_php_version = '5.3.0'; |
|
2897 | 2877 | |
2898 | - // supported version check overrides default unsupported |
|
2899 | - foreach($supported_php_versions as $ver) { |
|
2900 | - if(1 == version_compare($sys_php_version, $ver, 'eq') || strpos($sys_php_version,$ver) !== false) { |
|
2901 | - $retval = 1; |
|
2902 | - break; |
|
2903 | - } |
|
2904 | - } |
|
2878 | + // only the supported versions, |
|
2879 | + // should be mutually exclusive with $invalid_php_versions |
|
2880 | + $supported_php_versions = array ( |
|
2881 | + '5.3.0' |
|
2882 | + ); |
|
2905 | 2883 | |
2906 | - // invalid version check overrides default unsupported |
|
2907 | - foreach($invalid_php_versions as $ver) { |
|
2908 | - if(1 == version_compare($sys_php_version, $ver, 'eq') && strpos($sys_php_version,$ver) !== false) { |
|
2909 | - $retval = -1; |
|
2910 | - break; |
|
2911 | - } |
|
2912 | - } |
|
2884 | + // invalid versions above the $min_considered_php_version, |
|
2885 | + // should be mutually exclusive with $supported_php_versions |
|
2886 | + |
|
2887 | + // SugarCRM prohibits install on PHP 5.2.7 on all platforms |
|
2888 | + $invalid_php_versions = array('5.2.7'); |
|
2889 | + |
|
2890 | + // default unsupported |
|
2891 | + $retval = 0; |
|
2892 | + |
|
2893 | + // versions below $min_considered_php_version are invalid |
|
2894 | + if(1 == version_compare($sys_php_version, $min_considered_php_version, '<')) { |
|
2895 | + $retval = -1; |
|
2896 | + } |
|
2897 | + |
|
2898 | + // supported version check overrides default unsupported |
|
2899 | + foreach($supported_php_versions as $ver) { |
|
2900 | + if(1 == version_compare($sys_php_version, $ver, 'eq') || strpos($sys_php_version,$ver) !== false) { |
|
2901 | + $retval = 1; |
|
2902 | + break; |
|
2903 | + } |
|
2904 | + } |
|
2905 | + |
|
2906 | + // invalid version check overrides default unsupported |
|
2907 | + foreach($invalid_php_versions as $ver) { |
|
2908 | + if(1 == version_compare($sys_php_version, $ver, 'eq') && strpos($sys_php_version,$ver) !== false) { |
|
2909 | + $retval = -1; |
|
2910 | + break; |
|
2911 | + } |
|
2912 | + } |
|
2913 | 2913 | |
2914 | 2914 | //allow a redhat distro to install, regardless of version. We are assuming the redhat naming convention is followed |
2915 | 2915 | //and the php version contains 'rh' characters |
@@ -2917,7 +2917,7 @@ discard block |
||
2917 | 2917 | $retval = 1; |
2918 | 2918 | } |
2919 | 2919 | |
2920 | - return $retval; |
|
2920 | + return $retval; |
|
2921 | 2921 | } |
2922 | 2922 | |
2923 | 2923 | /** |
@@ -2929,10 +2929,10 @@ discard block |
||
2929 | 2929 | */ |
2930 | 2930 | function check_iis_version($sys_iis_version = '') { |
2931 | 2931 | |
2932 | - $server_software = $_SERVER["SERVER_SOFTWARE"]; |
|
2933 | - $iis_version = ''; |
|
2934 | - if(strpos($server_software,'Microsoft-IIS') !== false && preg_match_all("/^.*\/(\d+\.?\d*)$/", $server_software, $out)) |
|
2935 | - $iis_version = $out[1][0]; |
|
2932 | + $server_software = $_SERVER["SERVER_SOFTWARE"]; |
|
2933 | + $iis_version = ''; |
|
2934 | + if(strpos($server_software,'Microsoft-IIS') !== false && preg_match_all("/^.*\/(\d+\.?\d*)$/", $server_software, $out)) |
|
2935 | + $iis_version = $out[1][0]; |
|
2936 | 2936 | |
2937 | 2937 | $sys_iis_version = empty($sys_iis_version) ? $iis_version : $sys_iis_version; |
2938 | 2938 | |
@@ -2983,14 +2983,14 @@ discard block |
||
2983 | 2983 | } |
2984 | 2984 | |
2985 | 2985 | function pre_login_check(){ |
2986 | - global $action, $login_error; |
|
2987 | - if(!empty($action)&& $action == 'Login'){ |
|
2988 | - |
|
2989 | - if(!empty($login_error)){ |
|
2990 | - $login_error = htmlentities($login_error); |
|
2991 | - $login_error = str_replace(array("<pre>","</pre>","\r\n", "\n"), "<br>", $login_error); |
|
2992 | - $_SESSION['login_error'] = $login_error; |
|
2993 | - echo '<script> |
|
2986 | + global $action, $login_error; |
|
2987 | + if(!empty($action)&& $action == 'Login'){ |
|
2988 | + |
|
2989 | + if(!empty($login_error)){ |
|
2990 | + $login_error = htmlentities($login_error); |
|
2991 | + $login_error = str_replace(array("<pre>","</pre>","\r\n", "\n"), "<br>", $login_error); |
|
2992 | + $_SESSION['login_error'] = $login_error; |
|
2993 | + echo '<script> |
|
2994 | 2994 | function set_focus() {} |
2995 | 2995 | if(document.getElementById("post_error")) { |
2996 | 2996 | document.getElementById("post_error").innerHTML="'. $login_error. '"; |
@@ -3000,66 +3000,66 @@ discard block |
||
3000 | 3000 | //document.getElementById("user_password").disabled = true; |
3001 | 3001 | } |
3002 | 3002 | </script>'; |
3003 | - } |
|
3004 | - } |
|
3003 | + } |
|
3004 | + } |
|
3005 | 3005 | } |
3006 | 3006 | |
3007 | 3007 | |
3008 | 3008 | |
3009 | 3009 | function sugar_cleanup($exit = false) { |
3010 | - static $called = false; |
|
3011 | - if($called)return; |
|
3012 | - $called = true; |
|
3013 | - set_include_path(realpath(dirname(__FILE__) . '/..') . PATH_SEPARATOR . get_include_path()); |
|
3014 | - chdir(realpath(dirname(__FILE__) . '/..')); |
|
3015 | - global $sugar_config; |
|
3016 | - require_once('include/utils/LogicHook.php'); |
|
3017 | - LogicHook::initialize(); |
|
3018 | - $GLOBALS['logic_hook']->call_custom_logic('', 'server_round_trip'); |
|
3019 | - |
|
3020 | - //added this check to avoid errors during install. |
|
3021 | - if (empty($sugar_config['dbconfig'])) { |
|
3022 | - if ($exit) exit; else return; |
|
3023 | - } |
|
3010 | + static $called = false; |
|
3011 | + if($called)return; |
|
3012 | + $called = true; |
|
3013 | + set_include_path(realpath(dirname(__FILE__) . '/..') . PATH_SEPARATOR . get_include_path()); |
|
3014 | + chdir(realpath(dirname(__FILE__) . '/..')); |
|
3015 | + global $sugar_config; |
|
3016 | + require_once('include/utils/LogicHook.php'); |
|
3017 | + LogicHook::initialize(); |
|
3018 | + $GLOBALS['logic_hook']->call_custom_logic('', 'server_round_trip'); |
|
3019 | + |
|
3020 | + //added this check to avoid errors during install. |
|
3021 | + if (empty($sugar_config['dbconfig'])) { |
|
3022 | + if ($exit) exit; else return; |
|
3023 | + } |
|
3024 | 3024 | |
3025 | 3025 | if (!class_exists('Tracker', true)) { |
3026 | - require_once 'modules/Trackers/Tracker.php'; |
|
3027 | - } |
|
3028 | - Tracker::logPage(); |
|
3029 | - // Now write the cached tracker_queries |
|
3030 | - if(!empty($GLOBALS['savePreferencesToDB']) && $GLOBALS['savePreferencesToDB']) { |
|
3031 | - if ( isset($GLOBALS['current_user']) && $GLOBALS['current_user'] instanceOf User ) |
|
3032 | - $GLOBALS['current_user']->savePreferencesToDB(); |
|
3033 | - } |
|
3026 | + require_once 'modules/Trackers/Tracker.php'; |
|
3027 | + } |
|
3028 | + Tracker::logPage(); |
|
3029 | + // Now write the cached tracker_queries |
|
3030 | + if(!empty($GLOBALS['savePreferencesToDB']) && $GLOBALS['savePreferencesToDB']) { |
|
3031 | + if ( isset($GLOBALS['current_user']) && $GLOBALS['current_user'] instanceOf User ) |
|
3032 | + $GLOBALS['current_user']->savePreferencesToDB(); |
|
3033 | + } |
|
3034 | 3034 | |
3035 | - //check to see if this is not an `ajax call AND the user preference error flag is set |
|
3036 | - if( |
|
3037 | - (isset($_SESSION['USER_PREFRENCE_ERRORS']) && $_SESSION['USER_PREFRENCE_ERRORS']) |
|
3038 | - && ($_REQUEST['action']!='modulelistmenu' && $_REQUEST['action']!='DynamicAction') |
|
3039 | - && ($_REQUEST['action']!='favorites' && $_REQUEST['action']!='DynamicAction') |
|
3040 | - && (empty($_REQUEST['to_pdf']) || !$_REQUEST['to_pdf'] ) |
|
3041 | - && (empty($_REQUEST['sugar_body_only']) || !$_REQUEST['sugar_body_only'] ) |
|
3042 | - |
|
3043 | - ){ |
|
3044 | - global $app_strings; |
|
3045 | - //this is not an ajax call and the user preference error flag is set, so reset the flag and print js to flash message |
|
3046 | - $err_mess = $app_strings['ERROR_USER_PREFS']; |
|
3047 | - $_SESSION['USER_PREFRENCE_ERRORS'] = false; |
|
3048 | - echo " |
|
3035 | + //check to see if this is not an `ajax call AND the user preference error flag is set |
|
3036 | + if( |
|
3037 | + (isset($_SESSION['USER_PREFRENCE_ERRORS']) && $_SESSION['USER_PREFRENCE_ERRORS']) |
|
3038 | + && ($_REQUEST['action']!='modulelistmenu' && $_REQUEST['action']!='DynamicAction') |
|
3039 | + && ($_REQUEST['action']!='favorites' && $_REQUEST['action']!='DynamicAction') |
|
3040 | + && (empty($_REQUEST['to_pdf']) || !$_REQUEST['to_pdf'] ) |
|
3041 | + && (empty($_REQUEST['sugar_body_only']) || !$_REQUEST['sugar_body_only'] ) |
|
3042 | + |
|
3043 | + ){ |
|
3044 | + global $app_strings; |
|
3045 | + //this is not an ajax call and the user preference error flag is set, so reset the flag and print js to flash message |
|
3046 | + $err_mess = $app_strings['ERROR_USER_PREFS']; |
|
3047 | + $_SESSION['USER_PREFRENCE_ERRORS'] = false; |
|
3048 | + echo " |
|
3049 | 3049 | <script> |
3050 | 3050 | ajaxStatus.flashStatus('$err_mess',7000); |
3051 | 3051 | </script>"; |
3052 | 3052 | |
3053 | - } |
|
3053 | + } |
|
3054 | 3054 | |
3055 | - pre_login_check(); |
|
3056 | - if(class_exists('DBManagerFactory')) { |
|
3057 | - $db = DBManagerFactory::getInstance(); |
|
3058 | - $db->disconnect(); |
|
3059 | - if($exit) { |
|
3060 | - exit; |
|
3061 | - } |
|
3062 | - } |
|
3055 | + pre_login_check(); |
|
3056 | + if(class_exists('DBManagerFactory')) { |
|
3057 | + $db = DBManagerFactory::getInstance(); |
|
3058 | + $db->disconnect(); |
|
3059 | + if($exit) { |
|
3060 | + exit; |
|
3061 | + } |
|
3062 | + } |
|
3063 | 3063 | } |
3064 | 3064 | |
3065 | 3065 | register_shutdown_function('sugar_cleanup'); |
@@ -3071,64 +3071,64 @@ discard block |
||
3071 | 3071 | |
3072 | 3072 | */ |
3073 | 3073 | function check_logic_hook_file($module_name, $event, $action_array){ |
3074 | - require_once('include/utils/logic_utils.php'); |
|
3075 | - $add_logic = false; |
|
3074 | + require_once('include/utils/logic_utils.php'); |
|
3075 | + $add_logic = false; |
|
3076 | 3076 | |
3077 | - if(file_exists("custom/modules/$module_name/logic_hooks.php")){ |
|
3077 | + if(file_exists("custom/modules/$module_name/logic_hooks.php")){ |
|
3078 | 3078 | |
3079 | - $hook_array = get_hook_array($module_name); |
|
3079 | + $hook_array = get_hook_array($module_name); |
|
3080 | 3080 | |
3081 | - if(check_existing_element($hook_array, $event, $action_array)==true){ |
|
3082 | - //the hook at hand is present, so do nothing |
|
3083 | - } else { |
|
3084 | - $add_logic = true; |
|
3081 | + if(check_existing_element($hook_array, $event, $action_array)==true){ |
|
3082 | + //the hook at hand is present, so do nothing |
|
3083 | + } else { |
|
3084 | + $add_logic = true; |
|
3085 | 3085 | |
3086 | 3086 | $logic_count = 0; |
3087 | 3087 | if(!empty($hook_array[$event])) |
3088 | 3088 | { |
3089 | - $logic_count = count($hook_array[$event]); |
|
3089 | + $logic_count = count($hook_array[$event]); |
|
3090 | 3090 | } |
3091 | 3091 | |
3092 | - if($action_array[0]==""){ |
|
3093 | - $action_array[0] = $logic_count + 1; |
|
3094 | - } |
|
3095 | - $hook_array[$event][] = $action_array; |
|
3096 | - |
|
3097 | - } |
|
3098 | - //end if the file exists already |
|
3099 | - } else { |
|
3100 | - $add_logic = true; |
|
3101 | - if($action_array[0]==""){ |
|
3102 | - $action_array[0] = 1; |
|
3103 | - } |
|
3104 | - $hook_array = array(); |
|
3105 | - $hook_array[$event][] = $action_array; |
|
3106 | - //end if else file exists already |
|
3107 | - } |
|
3108 | - if($add_logic == true){ |
|
3092 | + if($action_array[0]==""){ |
|
3093 | + $action_array[0] = $logic_count + 1; |
|
3094 | + } |
|
3095 | + $hook_array[$event][] = $action_array; |
|
3096 | + |
|
3097 | + } |
|
3098 | + //end if the file exists already |
|
3099 | + } else { |
|
3100 | + $add_logic = true; |
|
3101 | + if($action_array[0]==""){ |
|
3102 | + $action_array[0] = 1; |
|
3103 | + } |
|
3104 | + $hook_array = array(); |
|
3105 | + $hook_array[$event][] = $action_array; |
|
3106 | + //end if else file exists already |
|
3107 | + } |
|
3108 | + if($add_logic == true){ |
|
3109 | 3109 | |
3110 | - //reorder array by element[0] |
|
3111 | - //$hook_array = reorder_array($hook_array, $event); |
|
3112 | - //!!!Finish this above TODO |
|
3110 | + //reorder array by element[0] |
|
3111 | + //$hook_array = reorder_array($hook_array, $event); |
|
3112 | + //!!!Finish this above TODO |
|
3113 | 3113 | |
3114 | - $new_contents = replace_or_add_logic_type($hook_array); |
|
3115 | - write_logic_file($module_name, $new_contents); |
|
3114 | + $new_contents = replace_or_add_logic_type($hook_array); |
|
3115 | + write_logic_file($module_name, $new_contents); |
|
3116 | 3116 | |
3117 | - //end if add_element is true |
|
3118 | - } |
|
3117 | + //end if add_element is true |
|
3118 | + } |
|
3119 | 3119 | |
3120 | - //end function check_logic_hook_file |
|
3120 | + //end function check_logic_hook_file |
|
3121 | 3121 | } |
3122 | 3122 | |
3123 | 3123 | function remove_logic_hook($module_name, $event, $action_array) { |
3124 | 3124 | require_once('include/utils/logic_utils.php'); |
3125 | - $add_logic = false; |
|
3125 | + $add_logic = false; |
|
3126 | 3126 | |
3127 | - if(file_exists("custom/modules/".$module_name."/logic_hooks.php")){ |
|
3127 | + if(file_exists("custom/modules/".$module_name."/logic_hooks.php")){ |
|
3128 | 3128 | // The file exists, let's make sure the hook is there |
3129 | - $hook_array = get_hook_array($module_name); |
|
3129 | + $hook_array = get_hook_array($module_name); |
|
3130 | 3130 | |
3131 | - if(check_existing_element($hook_array, $event, $action_array)==true){ |
|
3131 | + if(check_existing_element($hook_array, $event, $action_array)==true){ |
|
3132 | 3132 | // The hook is there, time to take it out. |
3133 | 3133 | |
3134 | 3134 | foreach ( $hook_array[$event] as $i => $hook ) { |
@@ -3150,111 +3150,111 @@ discard block |
||
3150 | 3150 | |
3151 | 3151 | function display_stack_trace($textOnly=false){ |
3152 | 3152 | |
3153 | - $stack = debug_backtrace(); |
|
3153 | + $stack = debug_backtrace(); |
|
3154 | 3154 | |
3155 | - echo "\n\n display_stack_trace caller, file: " . $stack[0]['file']. ' line#: ' .$stack[0]['line']; |
|
3155 | + echo "\n\n display_stack_trace caller, file: " . $stack[0]['file']. ' line#: ' .$stack[0]['line']; |
|
3156 | 3156 | |
3157 | - if(!$textOnly) |
|
3158 | - echo '<br>'; |
|
3157 | + if(!$textOnly) |
|
3158 | + echo '<br>'; |
|
3159 | 3159 | |
3160 | - $first = true; |
|
3161 | - $out = ''; |
|
3160 | + $first = true; |
|
3161 | + $out = ''; |
|
3162 | 3162 | |
3163 | - foreach($stack as $item) { |
|
3164 | - $file = ''; |
|
3165 | - $class = ''; |
|
3166 | - $line = ''; |
|
3167 | - $function = ''; |
|
3163 | + foreach($stack as $item) { |
|
3164 | + $file = ''; |
|
3165 | + $class = ''; |
|
3166 | + $line = ''; |
|
3167 | + $function = ''; |
|
3168 | 3168 | |
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']; |
|
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']; |
|
3177 | 3177 | |
3178 | - if(!$first) { |
|
3179 | - if(!$textOnly) { |
|
3180 | - $out .= '<font color="black"><b>'; |
|
3181 | - } |
|
3178 | + if(!$first) { |
|
3179 | + if(!$textOnly) { |
|
3180 | + $out .= '<font color="black"><b>'; |
|
3181 | + } |
|
3182 | 3182 | |
3183 | - $out .= $file; |
|
3183 | + $out .= $file; |
|
3184 | 3184 | |
3185 | - if(!$textOnly) { |
|
3186 | - $out .= '</b></font><font color="blue">'; |
|
3187 | - } |
|
3185 | + if(!$textOnly) { |
|
3186 | + $out .= '</b></font><font color="blue">'; |
|
3187 | + } |
|
3188 | 3188 | |
3189 | - $out .= "[L:{$line}]"; |
|
3189 | + $out .= "[L:{$line}]"; |
|
3190 | 3190 | |
3191 | - if(!$textOnly) { |
|
3192 | - $out .= '</font><font color="red">'; |
|
3193 | - } |
|
3191 | + if(!$textOnly) { |
|
3192 | + $out .= '</font><font color="red">'; |
|
3193 | + } |
|
3194 | 3194 | |
3195 | - $out .= "({$class}:{$function})"; |
|
3195 | + $out .= "({$class}:{$function})"; |
|
3196 | 3196 | |
3197 | - if(!$textOnly) { |
|
3198 | - $out .= '</font><br>'; |
|
3199 | - } else { |
|
3200 | - $out .= "\n"; |
|
3201 | - } |
|
3202 | - } else { |
|
3203 | - $first = false; |
|
3204 | - } |
|
3205 | - } |
|
3197 | + if(!$textOnly) { |
|
3198 | + $out .= '</font><br>'; |
|
3199 | + } else { |
|
3200 | + $out .= "\n"; |
|
3201 | + } |
|
3202 | + } else { |
|
3203 | + $first = false; |
|
3204 | + } |
|
3205 | + } |
|
3206 | 3206 | |
3207 | - echo $out; |
|
3207 | + echo $out; |
|
3208 | 3208 | } |
3209 | 3209 | |
3210 | 3210 | function StackTraceErrorHandler($errno, $errstr, $errfile,$errline, $errcontext) { |
3211 | - $error_msg = " $errstr occurred in <b>$errfile</b> on line $errline [" . date("Y-m-d H:i:s") . ']'; |
|
3212 | - $halt_script = true; |
|
3213 | - switch($errno){ |
|
3214 | - case 2048: return; //depricated we have lots of these ignore them |
|
3215 | - case E_USER_NOTICE: |
|
3216 | - case E_NOTICE: |
|
3217 | - if ( error_reporting() & E_NOTICE ) { |
|
3218 | - $halt_script = false; |
|
3219 | - $type = 'Notice'; |
|
3220 | - } |
|
3221 | - else |
|
3222 | - return; |
|
3223 | - break; |
|
3224 | - case E_USER_WARNING: |
|
3225 | - case E_COMPILE_WARNING: |
|
3226 | - case E_CORE_WARNING: |
|
3227 | - case E_WARNING: |
|
3228 | - |
|
3229 | - $halt_script = false; |
|
3230 | - $type = "Warning"; |
|
3231 | - break; |
|
3232 | - |
|
3233 | - case E_USER_ERROR: |
|
3234 | - case E_COMPILE_ERROR: |
|
3235 | - case E_CORE_ERROR: |
|
3236 | - case E_ERROR: |
|
3237 | - |
|
3238 | - $type = "Fatal Error"; |
|
3239 | - break; |
|
3240 | - |
|
3241 | - case E_PARSE: |
|
3242 | - |
|
3243 | - $type = "Parse Error"; |
|
3244 | - break; |
|
3245 | - |
|
3246 | - default: |
|
3247 | - //don't know what it is might not be so bad |
|
3248 | - $halt_script = false; |
|
3249 | - $type = "Unknown Error ($errno)"; |
|
3250 | - break; |
|
3251 | - } |
|
3252 | - $error_msg = '<b>'.$type.'</b>:' . $error_msg; |
|
3253 | - echo $error_msg; |
|
3254 | - display_stack_trace(); |
|
3255 | - if($halt_script){ |
|
3256 | - exit -1; |
|
3257 | - } |
|
3211 | + $error_msg = " $errstr occurred in <b>$errfile</b> on line $errline [" . date("Y-m-d H:i:s") . ']'; |
|
3212 | + $halt_script = true; |
|
3213 | + switch($errno){ |
|
3214 | + case 2048: return; //depricated we have lots of these ignore them |
|
3215 | + case E_USER_NOTICE: |
|
3216 | + case E_NOTICE: |
|
3217 | + if ( error_reporting() & E_NOTICE ) { |
|
3218 | + $halt_script = false; |
|
3219 | + $type = 'Notice'; |
|
3220 | + } |
|
3221 | + else |
|
3222 | + return; |
|
3223 | + break; |
|
3224 | + case E_USER_WARNING: |
|
3225 | + case E_COMPILE_WARNING: |
|
3226 | + case E_CORE_WARNING: |
|
3227 | + case E_WARNING: |
|
3228 | + |
|
3229 | + $halt_script = false; |
|
3230 | + $type = "Warning"; |
|
3231 | + break; |
|
3232 | + |
|
3233 | + case E_USER_ERROR: |
|
3234 | + case E_COMPILE_ERROR: |
|
3235 | + case E_CORE_ERROR: |
|
3236 | + case E_ERROR: |
|
3237 | + |
|
3238 | + $type = "Fatal Error"; |
|
3239 | + break; |
|
3240 | + |
|
3241 | + case E_PARSE: |
|
3242 | + |
|
3243 | + $type = "Parse Error"; |
|
3244 | + break; |
|
3245 | + |
|
3246 | + default: |
|
3247 | + //don't know what it is might not be so bad |
|
3248 | + $halt_script = false; |
|
3249 | + $type = "Unknown Error ($errno)"; |
|
3250 | + break; |
|
3251 | + } |
|
3252 | + $error_msg = '<b>'.$type.'</b>:' . $error_msg; |
|
3253 | + echo $error_msg; |
|
3254 | + display_stack_trace(); |
|
3255 | + if($halt_script){ |
|
3256 | + exit -1; |
|
3257 | + } |
|
3258 | 3258 | |
3259 | 3259 | |
3260 | 3260 | |
@@ -3263,45 +3263,45 @@ discard block |
||
3263 | 3263 | |
3264 | 3264 | if(isset($sugar_config['stack_trace_errors']) && $sugar_config['stack_trace_errors']){ |
3265 | 3265 | |
3266 | - set_error_handler('StackTraceErrorHandler'); |
|
3266 | + set_error_handler('StackTraceErrorHandler'); |
|
3267 | 3267 | } |
3268 | 3268 | function get_sub_cookies($name){ |
3269 | - $cookies = array(); |
|
3270 | - if(isset($_COOKIE[$name])){ |
|
3271 | - $subs = explode('#', $_COOKIE[$name]); |
|
3272 | - foreach($subs as $cookie){ |
|
3273 | - if(!empty($cookie)){ |
|
3274 | - $cookie = explode('=', $cookie); |
|
3275 | - |
|
3276 | - $cookies[$cookie[0]] = $cookie[1]; |
|
3277 | - } |
|
3278 | - } |
|
3279 | - } |
|
3280 | - return $cookies; |
|
3269 | + $cookies = array(); |
|
3270 | + if(isset($_COOKIE[$name])){ |
|
3271 | + $subs = explode('#', $_COOKIE[$name]); |
|
3272 | + foreach($subs as $cookie){ |
|
3273 | + if(!empty($cookie)){ |
|
3274 | + $cookie = explode('=', $cookie); |
|
3275 | + |
|
3276 | + $cookies[$cookie[0]] = $cookie[1]; |
|
3277 | + } |
|
3278 | + } |
|
3279 | + } |
|
3280 | + return $cookies; |
|
3281 | 3281 | |
3282 | 3282 | } |
3283 | 3283 | |
3284 | 3284 | |
3285 | 3285 | function mark_delete_components($sub_object_array, $run_second_level=false, $sub_sub_array=""){ |
3286 | 3286 | |
3287 | - if(!empty($sub_object_array)){ |
|
3287 | + if(!empty($sub_object_array)){ |
|
3288 | 3288 | |
3289 | - foreach($sub_object_array as $sub_object){ |
|
3289 | + foreach($sub_object_array as $sub_object){ |
|
3290 | 3290 | |
3291 | - //run_second level is set to true if you need to remove sub-sub components |
|
3292 | - if($run_second_level==true){ |
|
3291 | + //run_second level is set to true if you need to remove sub-sub components |
|
3292 | + if($run_second_level==true){ |
|
3293 | 3293 | |
3294 | - mark_delete_components($sub_object->get_linked_beans($sub_sub_array['rel_field'],$sub_sub_array['rel_module'])); |
|
3294 | + mark_delete_components($sub_object->get_linked_beans($sub_sub_array['rel_field'],$sub_sub_array['rel_module'])); |
|
3295 | 3295 | |
3296 | - //end if run_second_level is true |
|
3297 | - } |
|
3298 | - $sub_object->mark_deleted($sub_object->id); |
|
3299 | - //end foreach sub component |
|
3300 | - } |
|
3301 | - //end if this is not empty |
|
3302 | - } |
|
3296 | + //end if run_second_level is true |
|
3297 | + } |
|
3298 | + $sub_object->mark_deleted($sub_object->id); |
|
3299 | + //end foreach sub component |
|
3300 | + } |
|
3301 | + //end if this is not empty |
|
3302 | + } |
|
3303 | 3303 | |
3304 | - //end function mark_delete_components |
|
3304 | + //end function mark_delete_components |
|
3305 | 3305 | } |
3306 | 3306 | |
3307 | 3307 | /** |
@@ -3309,30 +3309,30 @@ discard block |
||
3309 | 3309 | */ |
3310 | 3310 | function return_bytes($val) |
3311 | 3311 | { |
3312 | - $val = trim($val); |
|
3313 | - $last = strtolower($val{strlen($val)-1}); |
|
3314 | - |
|
3315 | - switch($last) |
|
3316 | - { |
|
3317 | - // The 'G' modifier is available since PHP 5.1.0 |
|
3318 | - case 'g': |
|
3319 | - $val *= 1024; |
|
3320 | - case 'm': |
|
3321 | - $val *= 1024; |
|
3322 | - case 'k': |
|
3323 | - $val *= 1024; |
|
3324 | - } |
|
3312 | + $val = trim($val); |
|
3313 | + $last = strtolower($val{strlen($val)-1}); |
|
3325 | 3314 | |
3326 | - return $val; |
|
3315 | + switch($last) |
|
3316 | + { |
|
3317 | + // The 'G' modifier is available since PHP 5.1.0 |
|
3318 | + case 'g': |
|
3319 | + $val *= 1024; |
|
3320 | + case 'm': |
|
3321 | + $val *= 1024; |
|
3322 | + case 'k': |
|
3323 | + $val *= 1024; |
|
3324 | + } |
|
3325 | + |
|
3326 | + return $val; |
|
3327 | 3327 | } |
3328 | 3328 | |
3329 | 3329 | /** |
3330 | 3330 | * Adds the href HTML tags around any URL in the $string |
3331 | 3331 | */ |
3332 | 3332 | function url2html($string) { |
3333 | - // |
|
3334 | - $return_string = preg_replace('/(\w+:\/\/)(\S+)/', ' <a href="\\1\\2" target="_new" style="font-weight: normal;">\\1\\2</a>', $string); |
|
3335 | - return $return_string; |
|
3333 | + // |
|
3334 | + $return_string = preg_replace('/(\w+:\/\/)(\S+)/', ' <a href="\\1\\2" target="_new" style="font-weight: normal;">\\1\\2</a>', $string); |
|
3335 | + return $return_string; |
|
3336 | 3336 | } |
3337 | 3337 | // End customization by Julian |
3338 | 3338 | |
@@ -3353,31 +3353,31 @@ discard block |
||
3353 | 3353 | * @return bool true if writable |
3354 | 3354 | */ |
3355 | 3355 | function is_writable_windows($file) { |
3356 | - if($file{strlen($file)-1}=='/') { |
|
3357 | - return is_writable_windows($file.uniqid(mt_rand()).'.tmp'); |
|
3358 | - } |
|
3356 | + if($file{strlen($file)-1}=='/') { |
|
3357 | + return is_writable_windows($file.uniqid(mt_rand()).'.tmp'); |
|
3358 | + } |
|
3359 | 3359 | |
3360 | - // the assumption here is that Windows has an inherited permissions scheme |
|
3361 | - // any file that is a descendant of an unwritable directory will inherit |
|
3362 | - // that property and will trigger a failure below. |
|
3363 | - if(is_dir($file)) { |
|
3364 | - return true; |
|
3365 | - } |
|
3360 | + // the assumption here is that Windows has an inherited permissions scheme |
|
3361 | + // any file that is a descendant of an unwritable directory will inherit |
|
3362 | + // that property and will trigger a failure below. |
|
3363 | + if(is_dir($file)) { |
|
3364 | + return true; |
|
3365 | + } |
|
3366 | 3366 | |
3367 | - $file = str_replace("/", '\\', $file); |
|
3367 | + $file = str_replace("/", '\\', $file); |
|
3368 | 3368 | |
3369 | - if(file_exists($file)) { |
|
3370 | - if (!($f = @sugar_fopen($file, 'r+'))) |
|
3371 | - return false; |
|
3372 | - fclose($f); |
|
3373 | - return true; |
|
3374 | - } |
|
3369 | + if(file_exists($file)) { |
|
3370 | + if (!($f = @sugar_fopen($file, 'r+'))) |
|
3371 | + return false; |
|
3372 | + fclose($f); |
|
3373 | + return true; |
|
3374 | + } |
|
3375 | 3375 | |
3376 | - if(!($f = @sugar_fopen($file, 'w'))) |
|
3377 | - return false; |
|
3378 | - fclose($f); |
|
3379 | - unlink($file); |
|
3380 | - return true; |
|
3376 | + if(!($f = @sugar_fopen($file, 'w'))) |
|
3377 | + return false; |
|
3378 | + fclose($f); |
|
3379 | + unlink($file); |
|
3380 | + return true; |
|
3381 | 3381 | } |
3382 | 3382 | |
3383 | 3383 | |
@@ -3390,23 +3390,23 @@ discard block |
||
3390 | 3390 | } |
3391 | 3391 | |
3392 | 3392 | function convert_module_to_singular($module_array){ |
3393 | - global $beanList; |
|
3394 | - |
|
3395 | - foreach($module_array as $key => $value){ |
|
3396 | - if(!empty($beanList[$value])) $module_array[$key] = $beanList[$value]; |
|
3397 | - |
|
3398 | - if($value=="Cases") { |
|
3399 | - $module_array[$key] = "Case"; |
|
3400 | - } |
|
3401 | - if($key=="projecttask"){ |
|
3402 | - $module_array['ProjectTask'] = "Project Task"; |
|
3403 | - unset($module_array[$key]); |
|
3404 | - } |
|
3405 | - } |
|
3393 | + global $beanList; |
|
3406 | 3394 | |
3407 | - return $module_array; |
|
3395 | + foreach($module_array as $key => $value){ |
|
3396 | + if(!empty($beanList[$value])) $module_array[$key] = $beanList[$value]; |
|
3397 | + |
|
3398 | + if($value=="Cases") { |
|
3399 | + $module_array[$key] = "Case"; |
|
3400 | + } |
|
3401 | + if($key=="projecttask"){ |
|
3402 | + $module_array['ProjectTask'] = "Project Task"; |
|
3403 | + unset($module_array[$key]); |
|
3404 | + } |
|
3405 | + } |
|
3408 | 3406 | |
3409 | - //end function convert_module_to_singular |
|
3407 | + return $module_array; |
|
3408 | + |
|
3409 | + //end function convert_module_to_singular |
|
3410 | 3410 | } |
3411 | 3411 | |
3412 | 3412 | /* |
@@ -3414,13 +3414,13 @@ discard block |
||
3414 | 3414 | * bean_name. This is important when you need to include files. |
3415 | 3415 | */ |
3416 | 3416 | function get_singular_bean_name($bean_name){ |
3417 | - global $beanFiles, $beanList; |
|
3418 | - if(array_key_exists($bean_name, $beanList)){ |
|
3419 | - return $beanList[$bean_name]; |
|
3420 | - } |
|
3421 | - else{ |
|
3422 | - return $bean_name; |
|
3423 | - } |
|
3417 | + global $beanFiles, $beanList; |
|
3418 | + if(array_key_exists($bean_name, $beanList)){ |
|
3419 | + return $beanList[$bean_name]; |
|
3420 | + } |
|
3421 | + else{ |
|
3422 | + return $bean_name; |
|
3423 | + } |
|
3424 | 3424 | } |
3425 | 3425 | |
3426 | 3426 | /* |
@@ -3458,105 +3458,105 @@ discard block |
||
3458 | 3458 | } |
3459 | 3459 | |
3460 | 3460 | function get_label($label_tag, $temp_module_strings){ |
3461 | - global $app_strings; |
|
3462 | - if(!empty($temp_module_strings[$label_tag])){ |
|
3463 | - |
|
3464 | - $label_name = $temp_module_strings[$label_tag]; |
|
3465 | - } else { |
|
3466 | - if(!empty($app_strings[$label_tag])){ |
|
3467 | - $label_name = $app_strings[$label_tag]; |
|
3468 | - } else { |
|
3469 | - $label_name = $label_tag; |
|
3470 | - } |
|
3471 | - } |
|
3472 | - return $label_name; |
|
3461 | + global $app_strings; |
|
3462 | + if(!empty($temp_module_strings[$label_tag])){ |
|
3463 | + |
|
3464 | + $label_name = $temp_module_strings[$label_tag]; |
|
3465 | + } else { |
|
3466 | + if(!empty($app_strings[$label_tag])){ |
|
3467 | + $label_name = $app_strings[$label_tag]; |
|
3468 | + } else { |
|
3469 | + $label_name = $label_tag; |
|
3470 | + } |
|
3471 | + } |
|
3472 | + return $label_name; |
|
3473 | 3473 | |
3474 | - //end function get_label |
|
3474 | + //end function get_label |
|
3475 | 3475 | } |
3476 | 3476 | |
3477 | 3477 | |
3478 | 3478 | function search_filter_rel_info(& $focus, $tar_rel_module, $relationship_name){ |
3479 | 3479 | |
3480 | - $rel_list = array(); |
|
3480 | + $rel_list = array(); |
|
3481 | 3481 | |
3482 | - foreach($focus->relationship_fields as $rel_key => $rel_value){ |
|
3483 | - if($rel_value == $relationship_name){ |
|
3484 | - $temp_bean = get_module_info($tar_rel_module); |
|
3485 | - // echo $focus->$rel_key; |
|
3486 | - $temp_bean->retrieve($focus->$rel_key); |
|
3487 | - if($temp_bean->id!=""){ |
|
3482 | + foreach($focus->relationship_fields as $rel_key => $rel_value){ |
|
3483 | + if($rel_value == $relationship_name){ |
|
3484 | + $temp_bean = get_module_info($tar_rel_module); |
|
3485 | + // echo $focus->$rel_key; |
|
3486 | + $temp_bean->retrieve($focus->$rel_key); |
|
3487 | + if($temp_bean->id!=""){ |
|
3488 | 3488 | |
3489 | - $rel_list[] = $temp_bean; |
|
3490 | - return $rel_list; |
|
3491 | - } |
|
3492 | - } |
|
3493 | - } |
|
3489 | + $rel_list[] = $temp_bean; |
|
3490 | + return $rel_list; |
|
3491 | + } |
|
3492 | + } |
|
3493 | + } |
|
3494 | 3494 | |
3495 | - foreach($focus->field_defs as $field_name => $field_def){ |
|
3496 | - //Check if the relationship_name matches a "relate" field |
|
3497 | - if(!empty($field_def['type']) && $field_def['type'] == 'relate' |
|
3498 | - && !empty($field_def['id_name']) && !empty($focus->field_defs[$field_def['id_name']]) |
|
3499 | - && !empty($focus->field_defs[$field_def['id_name']]['relationship']) |
|
3500 | - && $focus->field_defs[$field_def['id_name']]['relationship'] == $relationship_name) |
|
3501 | - { |
|
3502 | - $temp_bean = get_module_info($tar_rel_module); |
|
3503 | - // echo $focus->$field_def['id_name']; |
|
3504 | - $temp_bean->retrieve($focus->$field_def['id_name']); |
|
3505 | - if($temp_bean->id!=""){ |
|
3506 | - |
|
3507 | - $rel_list[] = $temp_bean; |
|
3508 | - return $rel_list; |
|
3509 | - } |
|
3510 | - //Check if the relationship_name matches a "link" in a relate field |
|
3511 | - } else if(!empty($rel_value['link']) && !empty($rel_value['id_name']) && $rel_value['link'] == $relationship_name){ |
|
3512 | - $temp_bean = get_module_info($tar_rel_module); |
|
3513 | - // echo $focus->$rel_value['id_name']; |
|
3514 | - $temp_bean->retrieve($focus->$rel_value['id_name']); |
|
3515 | - if($temp_bean->id!=""){ |
|
3516 | - |
|
3517 | - $rel_list[] = $temp_bean; |
|
3518 | - return $rel_list; |
|
3519 | - } |
|
3520 | - } |
|
3521 | - } |
|
3495 | + foreach($focus->field_defs as $field_name => $field_def){ |
|
3496 | + //Check if the relationship_name matches a "relate" field |
|
3497 | + if(!empty($field_def['type']) && $field_def['type'] == 'relate' |
|
3498 | + && !empty($field_def['id_name']) && !empty($focus->field_defs[$field_def['id_name']]) |
|
3499 | + && !empty($focus->field_defs[$field_def['id_name']]['relationship']) |
|
3500 | + && $focus->field_defs[$field_def['id_name']]['relationship'] == $relationship_name) |
|
3501 | + { |
|
3502 | + $temp_bean = get_module_info($tar_rel_module); |
|
3503 | + // echo $focus->$field_def['id_name']; |
|
3504 | + $temp_bean->retrieve($focus->$field_def['id_name']); |
|
3505 | + if($temp_bean->id!=""){ |
|
3522 | 3506 | |
3523 | - // special case for unlisted parent-type relationships |
|
3524 | - if( !empty($focus->parent_type) && $focus->parent_type == $tar_rel_module && !empty($focus->parent_id)) { |
|
3525 | - $temp_bean = get_module_info($tar_rel_module); |
|
3526 | - $temp_bean->retrieve($focus->parent_id); |
|
3527 | - if($temp_bean->id!=""){ |
|
3528 | - $rel_list[] = $temp_bean; |
|
3529 | - return $rel_list; |
|
3530 | - } |
|
3531 | - } |
|
3507 | + $rel_list[] = $temp_bean; |
|
3508 | + return $rel_list; |
|
3509 | + } |
|
3510 | + //Check if the relationship_name matches a "link" in a relate field |
|
3511 | + } else if(!empty($rel_value['link']) && !empty($rel_value['id_name']) && $rel_value['link'] == $relationship_name){ |
|
3512 | + $temp_bean = get_module_info($tar_rel_module); |
|
3513 | + // echo $focus->$rel_value['id_name']; |
|
3514 | + $temp_bean->retrieve($focus->$rel_value['id_name']); |
|
3515 | + if($temp_bean->id!=""){ |
|
3516 | + |
|
3517 | + $rel_list[] = $temp_bean; |
|
3518 | + return $rel_list; |
|
3519 | + } |
|
3520 | + } |
|
3521 | + } |
|
3522 | + |
|
3523 | + // special case for unlisted parent-type relationships |
|
3524 | + if( !empty($focus->parent_type) && $focus->parent_type == $tar_rel_module && !empty($focus->parent_id)) { |
|
3525 | + $temp_bean = get_module_info($tar_rel_module); |
|
3526 | + $temp_bean->retrieve($focus->parent_id); |
|
3527 | + if($temp_bean->id!=""){ |
|
3528 | + $rel_list[] = $temp_bean; |
|
3529 | + return $rel_list; |
|
3530 | + } |
|
3531 | + } |
|
3532 | 3532 | |
3533 | - return $rel_list; |
|
3533 | + return $rel_list; |
|
3534 | 3534 | |
3535 | - //end function search_filter_rel_info |
|
3535 | + //end function search_filter_rel_info |
|
3536 | 3536 | } |
3537 | 3537 | |
3538 | 3538 | function get_module_info($module_name){ |
3539 | - global $beanList; |
|
3540 | - global $dictionary; |
|
3539 | + global $beanList; |
|
3540 | + global $dictionary; |
|
3541 | 3541 | |
3542 | - //Get dictionary and focus data for module |
|
3543 | - $vardef_name = $beanList[$module_name]; |
|
3542 | + //Get dictionary and focus data for module |
|
3543 | + $vardef_name = $beanList[$module_name]; |
|
3544 | 3544 | |
3545 | - if($vardef_name=="aCase"){ |
|
3546 | - $class_name = "Case"; |
|
3547 | - } else { |
|
3548 | - $class_name = $vardef_name; |
|
3549 | - } |
|
3545 | + if($vardef_name=="aCase"){ |
|
3546 | + $class_name = "Case"; |
|
3547 | + } else { |
|
3548 | + $class_name = $vardef_name; |
|
3549 | + } |
|
3550 | 3550 | |
3551 | - if(!file_exists('modules/'. $module_name . '/'.$class_name.'.php')){ |
|
3552 | - return; |
|
3553 | - } |
|
3551 | + if(!file_exists('modules/'. $module_name . '/'.$class_name.'.php')){ |
|
3552 | + return; |
|
3553 | + } |
|
3554 | 3554 | |
3555 | - include_once('modules/'. $module_name . '/'.$class_name.'.php'); |
|
3555 | + include_once('modules/'. $module_name . '/'.$class_name.'.php'); |
|
3556 | 3556 | |
3557 | - $module_bean = new $vardef_name(); |
|
3558 | - return $module_bean; |
|
3559 | - //end function get_module_table |
|
3557 | + $module_bean = new $vardef_name(); |
|
3558 | + return $module_bean; |
|
3559 | + //end function get_module_table |
|
3560 | 3560 | } |
3561 | 3561 | |
3562 | 3562 | /** |
@@ -3565,22 +3565,22 @@ discard block |
||
3565 | 3565 | * @param string $moduleName |
3566 | 3566 | */ |
3567 | 3567 | function get_valid_bean_name($module_name){ |
3568 | - global $beanList; |
|
3568 | + global $beanList; |
|
3569 | 3569 | |
3570 | - $vardef_name = $beanList[$module_name]; |
|
3571 | - if($vardef_name=="aCase"){ |
|
3572 | - $bean_name = "Case"; |
|
3573 | - } else { |
|
3574 | - $bean_name = $vardef_name; |
|
3575 | - } |
|
3576 | - return $bean_name; |
|
3570 | + $vardef_name = $beanList[$module_name]; |
|
3571 | + if($vardef_name=="aCase"){ |
|
3572 | + $bean_name = "Case"; |
|
3573 | + } else { |
|
3574 | + $bean_name = $vardef_name; |
|
3575 | + } |
|
3576 | + return $bean_name; |
|
3577 | 3577 | } |
3578 | 3578 | |
3579 | 3579 | |
3580 | 3580 | |
3581 | 3581 | function checkAuthUserStatus(){ |
3582 | 3582 | |
3583 | - //authUserStatus(); |
|
3583 | + //authUserStatus(); |
|
3584 | 3584 | } |
3585 | 3585 | |
3586 | 3586 | |
@@ -3593,7 +3593,7 @@ discard block |
||
3593 | 3593 | * @author customized for Sugar by Chris N. |
3594 | 3594 | */ |
3595 | 3595 | function getPhpInfo($level=-1) { |
3596 | - /** Name (constant) Value Description |
|
3596 | + /** Name (constant) Value Description |
|
3597 | 3597 | INFO_GENERAL 1 The configuration line, php.ini location, build date, Web Server, System and more. |
3598 | 3598 | INFO_CREDITS 2 PHP Credits. See also phpcredits(). |
3599 | 3599 | INFO_CONFIGURATION 4 Current Local and Master values for PHP directives. See also ini_get(). |
@@ -3602,47 +3602,47 @@ discard block |
||
3602 | 3602 | INFO_VARIABLES 32 Shows all predefined variables from EGPCS (Environment, GET, POST, Cookie, Server). |
3603 | 3603 | INFO_LICENSE 64 PHP License information. See also the license FAQ. |
3604 | 3604 | INFO_ALL -1 Shows all of the above. This is the default value. |
3605 | - */ |
|
3606 | - ob_start(); |
|
3607 | - phpinfo($level); |
|
3608 | - $phpinfo = ob_get_contents(); |
|
3609 | - ob_end_clean(); |
|
3610 | - |
|
3611 | - $phpinfo = strip_tags($phpinfo,'<h1><h2><th><td>'); |
|
3612 | - $phpinfo = preg_replace('/<th[^>]*>([^<]+)<\/th>/',"<info>\\1</info>",$phpinfo); |
|
3613 | - $phpinfo = preg_replace('/<td[^>]*>([^<]+)<\/td>/',"<info>\\1</info>",$phpinfo); |
|
3614 | - $parsedInfo = preg_split('/(<h.?>[^<]+<\/h.>)/', $phpinfo, -1, PREG_SPLIT_DELIM_CAPTURE); |
|
3615 | - $match = ''; |
|
3616 | - $version = ''; |
|
3617 | - $returnInfo = array(); |
|
3618 | - |
|
3619 | - if(preg_match('/<h1 class\=\"p\">PHP Version ([^<]+)<\/h1>/', $phpinfo, $version)) { |
|
3620 | - $returnInfo['PHP Version'] = $version[1]; |
|
3621 | - } |
|
3605 | + */ |
|
3606 | + ob_start(); |
|
3607 | + phpinfo($level); |
|
3608 | + $phpinfo = ob_get_contents(); |
|
3609 | + ob_end_clean(); |
|
3610 | + |
|
3611 | + $phpinfo = strip_tags($phpinfo,'<h1><h2><th><td>'); |
|
3612 | + $phpinfo = preg_replace('/<th[^>]*>([^<]+)<\/th>/',"<info>\\1</info>",$phpinfo); |
|
3613 | + $phpinfo = preg_replace('/<td[^>]*>([^<]+)<\/td>/',"<info>\\1</info>",$phpinfo); |
|
3614 | + $parsedInfo = preg_split('/(<h.?>[^<]+<\/h.>)/', $phpinfo, -1, PREG_SPLIT_DELIM_CAPTURE); |
|
3615 | + $match = ''; |
|
3616 | + $version = ''; |
|
3617 | + $returnInfo = array(); |
|
3618 | + |
|
3619 | + if(preg_match('/<h1 class\=\"p\">PHP Version ([^<]+)<\/h1>/', $phpinfo, $version)) { |
|
3620 | + $returnInfo['PHP Version'] = $version[1]; |
|
3621 | + } |
|
3622 | 3622 | |
3623 | 3623 | |
3624 | - for ($i=1; $i<count($parsedInfo); $i++) { |
|
3625 | - if (preg_match('/<h.>([^<]+)<\/h.>/', $parsedInfo[$i], $match)) { |
|
3626 | - $vName = trim($match[1]); |
|
3627 | - $parsedInfo2 = explode("\n",$parsedInfo[$i+1]); |
|
3624 | + for ($i=1; $i<count($parsedInfo); $i++) { |
|
3625 | + if (preg_match('/<h.>([^<]+)<\/h.>/', $parsedInfo[$i], $match)) { |
|
3626 | + $vName = trim($match[1]); |
|
3627 | + $parsedInfo2 = explode("\n",$parsedInfo[$i+1]); |
|
3628 | 3628 | |
3629 | - foreach ($parsedInfo2 AS $vOne) { |
|
3630 | - $vPat = '<info>([^<]+)<\/info>'; |
|
3631 | - $vPat3 = "/$vPat\s*$vPat\s*$vPat/"; |
|
3632 | - $vPat2 = "/$vPat\s*$vPat/"; |
|
3629 | + foreach ($parsedInfo2 AS $vOne) { |
|
3630 | + $vPat = '<info>([^<]+)<\/info>'; |
|
3631 | + $vPat3 = "/$vPat\s*$vPat\s*$vPat/"; |
|
3632 | + $vPat2 = "/$vPat\s*$vPat/"; |
|
3633 | 3633 | |
3634 | - if (preg_match($vPat3,$vOne,$match)) { // 3cols |
|
3635 | - $returnInfo[$vName][trim($match[1])] = array(trim($match[2]),trim($match[3])); |
|
3636 | - } elseif (preg_match($vPat2,$vOne,$match)) { // 2cols |
|
3637 | - $returnInfo[$vName][trim($match[1])] = trim($match[2]); |
|
3638 | - } |
|
3639 | - } |
|
3640 | - } elseif(true) { |
|
3634 | + if (preg_match($vPat3,$vOne,$match)) { // 3cols |
|
3635 | + $returnInfo[$vName][trim($match[1])] = array(trim($match[2]),trim($match[3])); |
|
3636 | + } elseif (preg_match($vPat2,$vOne,$match)) { // 2cols |
|
3637 | + $returnInfo[$vName][trim($match[1])] = trim($match[2]); |
|
3638 | + } |
|
3639 | + } |
|
3640 | + } elseif(true) { |
|
3641 | 3641 | |
3642 | - } |
|
3643 | - } |
|
3642 | + } |
|
3643 | + } |
|
3644 | 3644 | |
3645 | - return $returnInfo; |
|
3645 | + return $returnInfo; |
|
3646 | 3646 | } |
3647 | 3647 | |
3648 | 3648 | /** |
@@ -3653,7 +3653,7 @@ discard block |
||
3653 | 3653 | * @return $result a formatted string |
3654 | 3654 | */ |
3655 | 3655 | function string_format($format, $args){ |
3656 | - $result = $format; |
|
3656 | + $result = $format; |
|
3657 | 3657 | |
3658 | 3658 | /** Bug47277 fix. |
3659 | 3659 | * If args array has only one argument, and it's empty, so empty single quotes are used '' . That's because |
@@ -3670,10 +3670,10 @@ discard block |
||
3670 | 3670 | } |
3671 | 3671 | /* End of fix */ |
3672 | 3672 | |
3673 | - for($i = 0; $i < count($args); $i++){ |
|
3674 | - $result = str_replace('{'.$i.'}', $args[$i], $result); |
|
3675 | - } |
|
3676 | - return $result; |
|
3673 | + for($i = 0; $i < count($args); $i++){ |
|
3674 | + $result = str_replace('{'.$i.'}', $args[$i], $result); |
|
3675 | + } |
|
3676 | + return $result; |
|
3677 | 3677 | } |
3678 | 3678 | |
3679 | 3679 | /** |
@@ -3687,16 +3687,16 @@ discard block |
||
3687 | 3687 | * @return $result a formatted string |
3688 | 3688 | */ |
3689 | 3689 | function format_number_display($num, $system_id){ |
3690 | - global $sugar_config; |
|
3691 | - if(isset($num) && !empty($num)){ |
|
3692 | - $num=unformat_number($num); |
|
3693 | - if(isset($system_id) && $system_id == 1){ |
|
3694 | - return sprintf("%d", $num); |
|
3695 | - } |
|
3696 | - else{ |
|
3697 | - return sprintf("%d-%d", $num, $system_id); |
|
3698 | - } |
|
3699 | - } |
|
3690 | + global $sugar_config; |
|
3691 | + if(isset($num) && !empty($num)){ |
|
3692 | + $num=unformat_number($num); |
|
3693 | + if(isset($system_id) && $system_id == 1){ |
|
3694 | + return sprintf("%d", $num); |
|
3695 | + } |
|
3696 | + else{ |
|
3697 | + return sprintf("%d-%d", $num, $system_id); |
|
3698 | + } |
|
3699 | + } |
|
3700 | 3700 | } |
3701 | 3701 | function checkLoginUserStatus(){ |
3702 | 3702 | } |
@@ -3709,28 +3709,28 @@ discard block |
||
3709 | 3709 | */ |
3710 | 3710 | function appendPortToHost($url, $port) |
3711 | 3711 | { |
3712 | - $resulturl = $url; |
|
3713 | - |
|
3714 | - // if no port, don't change the url |
|
3715 | - if($port != '') |
|
3716 | - { |
|
3717 | - $split = explode("/", $url); |
|
3718 | - //check if it starts with http, in case they didn't include that in url |
|
3719 | - if(str_begin($url, 'http')) |
|
3720 | - { |
|
3721 | - //third index ($split[2]) will be the host |
|
3722 | - $split[2] .= ":".$port; |
|
3723 | - } |
|
3724 | - else // otherwise assumed to start with host name |
|
3725 | - { |
|
3726 | - //first index ($split[0]) will be the host |
|
3727 | - $split[0] .= ":".$port; |
|
3728 | - } |
|
3729 | - |
|
3730 | - $resulturl = implode("/", $split); |
|
3731 | - } |
|
3712 | + $resulturl = $url; |
|
3713 | + |
|
3714 | + // if no port, don't change the url |
|
3715 | + if($port != '') |
|
3716 | + { |
|
3717 | + $split = explode("/", $url); |
|
3718 | + //check if it starts with http, in case they didn't include that in url |
|
3719 | + if(str_begin($url, 'http')) |
|
3720 | + { |
|
3721 | + //third index ($split[2]) will be the host |
|
3722 | + $split[2] .= ":".$port; |
|
3723 | + } |
|
3724 | + else // otherwise assumed to start with host name |
|
3725 | + { |
|
3726 | + //first index ($split[0]) will be the host |
|
3727 | + $split[0] .= ":".$port; |
|
3728 | + } |
|
3729 | + |
|
3730 | + $resulturl = implode("/", $split); |
|
3731 | + } |
|
3732 | 3732 | |
3733 | - return $resulturl; |
|
3733 | + return $resulturl; |
|
3734 | 3734 | } |
3735 | 3735 | |
3736 | 3736 | /** |
@@ -3738,12 +3738,12 @@ discard block |
||
3738 | 3738 | * @return JSON object |
3739 | 3739 | */ |
3740 | 3740 | function getJSONobj() { |
3741 | - static $json = null; |
|
3742 | - if(!isset($json)) { |
|
3743 | - require_once('include/JSON.php'); |
|
3744 | - $json = new JSON(JSON_LOOSE_TYPE); |
|
3745 | - } |
|
3746 | - return $json; |
|
3741 | + static $json = null; |
|
3742 | + if(!isset($json)) { |
|
3743 | + require_once('include/JSON.php'); |
|
3744 | + $json = new JSON(JSON_LOOSE_TYPE); |
|
3745 | + } |
|
3746 | + return $json; |
|
3747 | 3747 | } |
3748 | 3748 | |
3749 | 3749 | require_once('include/utils/db_utils.php'); |
@@ -3752,28 +3752,28 @@ discard block |
||
3752 | 3752 | * Set default php.ini settings for entry points |
3753 | 3753 | */ |
3754 | 3754 | function setPhpIniSettings() { |
3755 | - // zlib module |
|
3756 | - // Bug 37579 - Comment out force enabling zlib.output_compression, since it can cause problems on certain hosts |
|
3757 | - /* |
|
3755 | + // zlib module |
|
3756 | + // Bug 37579 - Comment out force enabling zlib.output_compression, since it can cause problems on certain hosts |
|
3757 | + /* |
|
3758 | 3758 | if(function_exists('gzclose') && headers_sent() == false) { |
3759 | 3759 | ini_set('zlib.output_compression', 1); |
3760 | 3760 | } |
3761 | 3761 | */ |
3762 | - // mbstring module |
|
3763 | - //nsingh: breaks zip/unzip functionality. Commenting out 4/23/08 |
|
3762 | + // mbstring module |
|
3763 | + //nsingh: breaks zip/unzip functionality. Commenting out 4/23/08 |
|
3764 | 3764 | |
3765 | - /*if(function_exists('mb_strlen')) { |
|
3765 | + /*if(function_exists('mb_strlen')) { |
|
3766 | 3766 | ini_set('mbstring.func_overload', 7); |
3767 | 3767 | ini_set('mbstring.internal_encoding', 'UTF-8'); |
3768 | 3768 | }*/ |
3769 | 3769 | |
3770 | 3770 | |
3771 | - // http://us3.php.net/manual/en/ref.pcre.php#ini.pcre.backtrack-limit |
|
3772 | - // starting with 5.2.0, backtrack_limit breaks JSON decoding |
|
3773 | - $backtrack_limit = ini_get('pcre.backtrack_limit'); |
|
3774 | - if(!empty($backtrack_limit)) { |
|
3775 | - ini_set('pcre.backtrack_limit', '-1'); |
|
3776 | - } |
|
3771 | + // http://us3.php.net/manual/en/ref.pcre.php#ini.pcre.backtrack-limit |
|
3772 | + // starting with 5.2.0, backtrack_limit breaks JSON decoding |
|
3773 | + $backtrack_limit = ini_get('pcre.backtrack_limit'); |
|
3774 | + if(!empty($backtrack_limit)) { |
|
3775 | + ini_set('pcre.backtrack_limit', '-1'); |
|
3776 | + } |
|
3777 | 3777 | } |
3778 | 3778 | |
3779 | 3779 | /** |
@@ -3788,80 +3788,80 @@ discard block |
||
3788 | 3788 | */ |
3789 | 3789 | function sugarLangArrayMerge($gimp, $dom) |
3790 | 3790 | { |
3791 | - if(is_array($gimp) && is_array($dom)) |
|
3791 | + if(is_array($gimp) && is_array($dom)) |
|
3792 | 3792 | { |
3793 | - foreach($dom as $domKey => $domVal) |
|
3793 | + foreach($dom as $domKey => $domVal) |
|
3794 | 3794 | { |
3795 | - if(isset($gimp[$domKey])) |
|
3795 | + if(isset($gimp[$domKey])) |
|
3796 | 3796 | { |
3797 | - if(is_array($domVal)) |
|
3797 | + if(is_array($domVal)) |
|
3798 | 3798 | { |
3799 | - $tempArr = array(); |
|
3799 | + $tempArr = array(); |
|
3800 | 3800 | foreach ( $domVal as $domArrKey => $domArrVal ) |
3801 | 3801 | $tempArr[$domArrKey] = $domArrVal; |
3802 | 3802 | foreach ( $gimp[$domKey] as $gimpArrKey => $gimpArrVal ) |
3803 | 3803 | if ( !isset($tempArr[$gimpArrKey]) ) |
3804 | 3804 | $tempArr[$gimpArrKey] = $gimpArrVal; |
3805 | 3805 | $gimp[$domKey] = $tempArr; |
3806 | - } |
|
3806 | + } |
|
3807 | 3807 | else |
3808 | 3808 | { |
3809 | - $gimp[$domKey] = $domVal; |
|
3810 | - } |
|
3811 | - } |
|
3809 | + $gimp[$domKey] = $domVal; |
|
3810 | + } |
|
3811 | + } |
|
3812 | 3812 | else |
3813 | 3813 | { |
3814 | - $gimp[$domKey] = $domVal; |
|
3815 | - } |
|
3816 | - } |
|
3817 | - } |
|
3814 | + $gimp[$domKey] = $domVal; |
|
3815 | + } |
|
3816 | + } |
|
3817 | + } |
|
3818 | 3818 | // if the passed value for gimp isn't an array, then return the $dom |
3819 | 3819 | elseif(is_array($dom)) |
3820 | 3820 | { |
3821 | 3821 | return $dom; |
3822 | 3822 | } |
3823 | 3823 | |
3824 | - return $gimp; |
|
3824 | + return $gimp; |
|
3825 | 3825 | } |
3826 | 3826 | /** |
3827 | - * like array_merge() but will handle array elements that are themselves arrays; |
|
3828 | - * PHP's version just overwrites the element with the new one. |
|
3829 | - * |
|
3830 | - * @internal Note that this function deviates from the internal array_merge() |
|
3831 | - * functions in that it does does not treat numeric keys differently |
|
3832 | - * than string keys. Additionally, it deviates from |
|
3833 | - * array_merge_recursive() by not creating an array when like values |
|
3834 | - * found. |
|
3835 | - * |
|
3836 | - * @param array gimp the array whose values will be overloaded |
|
3837 | - * @param array dom the array whose values will pwn the gimp's |
|
3838 | - * @return array beaten gimp |
|
3839 | - */ |
|
3827 | + * like array_merge() but will handle array elements that are themselves arrays; |
|
3828 | + * PHP's version just overwrites the element with the new one. |
|
3829 | + * |
|
3830 | + * @internal Note that this function deviates from the internal array_merge() |
|
3831 | + * functions in that it does does not treat numeric keys differently |
|
3832 | + * than string keys. Additionally, it deviates from |
|
3833 | + * array_merge_recursive() by not creating an array when like values |
|
3834 | + * found. |
|
3835 | + * |
|
3836 | + * @param array gimp the array whose values will be overloaded |
|
3837 | + * @param array dom the array whose values will pwn the gimp's |
|
3838 | + * @return array beaten gimp |
|
3839 | + */ |
|
3840 | 3840 | function sugarArrayMerge($gimp, $dom) { |
3841 | - if(is_array($gimp) && is_array($dom)) { |
|
3842 | - foreach($dom as $domKey => $domVal) { |
|
3843 | - if(array_key_exists($domKey, $gimp)) { |
|
3844 | - if(is_array($domVal)) { |
|
3845 | - $tempArr = array(); |
|
3841 | + if(is_array($gimp) && is_array($dom)) { |
|
3842 | + foreach($dom as $domKey => $domVal) { |
|
3843 | + if(array_key_exists($domKey, $gimp)) { |
|
3844 | + if(is_array($domVal)) { |
|
3845 | + $tempArr = array(); |
|
3846 | 3846 | foreach ( $domVal as $domArrKey => $domArrVal ) |
3847 | 3847 | $tempArr[$domArrKey] = $domArrVal; |
3848 | 3848 | foreach ( $gimp[$domKey] as $gimpArrKey => $gimpArrVal ) |
3849 | 3849 | if ( !array_key_exists($gimpArrKey, $tempArr) ) |
3850 | 3850 | $tempArr[$gimpArrKey] = $gimpArrVal; |
3851 | 3851 | $gimp[$domKey] = $tempArr; |
3852 | - } else { |
|
3853 | - $gimp[$domKey] = $domVal; |
|
3854 | - } |
|
3855 | - } else { |
|
3856 | - $gimp[$domKey] = $domVal; |
|
3857 | - } |
|
3858 | - } |
|
3859 | - } |
|
3852 | + } else { |
|
3853 | + $gimp[$domKey] = $domVal; |
|
3854 | + } |
|
3855 | + } else { |
|
3856 | + $gimp[$domKey] = $domVal; |
|
3857 | + } |
|
3858 | + } |
|
3859 | + } |
|
3860 | 3860 | // if the passed value for gimp isn't an array, then return the $dom |
3861 | 3861 | elseif(is_array($dom)) |
3862 | 3862 | return $dom; |
3863 | 3863 | |
3864 | - return $gimp; |
|
3864 | + return $gimp; |
|
3865 | 3865 | } |
3866 | 3866 | |
3867 | 3867 | /** |
@@ -3872,24 +3872,24 @@ discard block |
||
3872 | 3872 | * @return array beaten gimp |
3873 | 3873 | */ |
3874 | 3874 | function sugarArrayMergeRecursive($gimp, $dom) { |
3875 | - if(is_array($gimp) && is_array($dom)) { |
|
3876 | - foreach($dom as $domKey => $domVal) { |
|
3877 | - if(array_key_exists($domKey, $gimp)) { |
|
3878 | - if(is_array($domVal) && is_array($gimp[$domKey])) { |
|
3879 | - $gimp[$domKey] = sugarArrayMergeRecursive($gimp[$domKey], $domVal); |
|
3880 | - } else { |
|
3881 | - $gimp[$domKey] = $domVal; |
|
3882 | - } |
|
3883 | - } else { |
|
3884 | - $gimp[$domKey] = $domVal; |
|
3885 | - } |
|
3886 | - } |
|
3887 | - } |
|
3875 | + if(is_array($gimp) && is_array($dom)) { |
|
3876 | + foreach($dom as $domKey => $domVal) { |
|
3877 | + if(array_key_exists($domKey, $gimp)) { |
|
3878 | + if(is_array($domVal) && is_array($gimp[$domKey])) { |
|
3879 | + $gimp[$domKey] = sugarArrayMergeRecursive($gimp[$domKey], $domVal); |
|
3880 | + } else { |
|
3881 | + $gimp[$domKey] = $domVal; |
|
3882 | + } |
|
3883 | + } else { |
|
3884 | + $gimp[$domKey] = $domVal; |
|
3885 | + } |
|
3886 | + } |
|
3887 | + } |
|
3888 | 3888 | // if the passed value for gimp isn't an array, then return the $dom |
3889 | 3889 | elseif(is_array($dom)) |
3890 | 3890 | return $dom; |
3891 | 3891 | |
3892 | - return $gimp; |
|
3892 | + return $gimp; |
|
3893 | 3893 | } |
3894 | 3894 | |
3895 | 3895 | /** |
@@ -3897,11 +3897,11 @@ discard block |
||
3897 | 3897 | * @return bool True if NOT found or WRONG version |
3898 | 3898 | */ |
3899 | 3899 | function returnPhpJsonStatus() { |
3900 | - if(function_exists('json_encode')) { |
|
3901 | - $phpInfo = getPhpInfo(8); |
|
3900 | + if(function_exists('json_encode')) { |
|
3901 | + $phpInfo = getPhpInfo(8); |
|
3902 | 3902 | return version_compare($phpInfo['json']['json version'], '1.1.1', '<'); |
3903 | - } |
|
3904 | - return true; // not found |
|
3903 | + } |
|
3904 | + return true; // not found |
|
3905 | 3905 | } |
3906 | 3906 | |
3907 | 3907 | |
@@ -3916,114 +3916,114 @@ discard block |
||
3916 | 3916 | * @return string [number]-char formatted string if length of string exceeds the max allowed |
3917 | 3917 | */ |
3918 | 3918 | function getTrackerSubstring($name) { |
3919 | - static $max_tracker_item_length; |
|
3919 | + static $max_tracker_item_length; |
|
3920 | 3920 | |
3921 | - //Trim the name |
|
3922 | - $name = html_entity_decode($name, ENT_QUOTES, 'UTF-8'); |
|
3923 | - $strlen = function_exists('mb_strlen') ? mb_strlen($name) : strlen($name); |
|
3921 | + //Trim the name |
|
3922 | + $name = html_entity_decode($name, ENT_QUOTES, 'UTF-8'); |
|
3923 | + $strlen = function_exists('mb_strlen') ? mb_strlen($name) : strlen($name); |
|
3924 | 3924 | |
3925 | - global $sugar_config; |
|
3925 | + global $sugar_config; |
|
3926 | 3926 | |
3927 | - if(!isset($max_tracker_item_length)) { |
|
3928 | - if(isset($sugar_config['tracker_max_display_length'])) { |
|
3929 | - $max_tracker_item_length = (is_int($sugar_config['tracker_max_display_length']) && $sugar_config['tracker_max_display_length'] > 0 && $sugar_config['tracker_max_display_length'] < 50) ? $sugar_config['tracker_max_display_length'] : 15; |
|
3930 | - } else { |
|
3931 | - $max_tracker_item_length = 15; |
|
3932 | - } |
|
3933 | - } |
|
3927 | + if(!isset($max_tracker_item_length)) { |
|
3928 | + if(isset($sugar_config['tracker_max_display_length'])) { |
|
3929 | + $max_tracker_item_length = (is_int($sugar_config['tracker_max_display_length']) && $sugar_config['tracker_max_display_length'] > 0 && $sugar_config['tracker_max_display_length'] < 50) ? $sugar_config['tracker_max_display_length'] : 15; |
|
3930 | + } else { |
|
3931 | + $max_tracker_item_length = 15; |
|
3932 | + } |
|
3933 | + } |
|
3934 | 3934 | |
3935 | - if($strlen > $max_tracker_item_length) { |
|
3936 | - $chopped = function_exists('mb_substr') ? mb_substr($name, 0, $max_tracker_item_length-3, "UTF-8") : substr($name, 0, $max_tracker_item_length-3); |
|
3937 | - $chopped .= "..."; |
|
3938 | - } else { |
|
3939 | - $chopped = $name; |
|
3940 | - } |
|
3935 | + if($strlen > $max_tracker_item_length) { |
|
3936 | + $chopped = function_exists('mb_substr') ? mb_substr($name, 0, $max_tracker_item_length-3, "UTF-8") : substr($name, 0, $max_tracker_item_length-3); |
|
3937 | + $chopped .= "..."; |
|
3938 | + } else { |
|
3939 | + $chopped = $name; |
|
3940 | + } |
|
3941 | 3941 | |
3942 | - return $chopped; |
|
3942 | + return $chopped; |
|
3943 | 3943 | } |
3944 | 3944 | function generate_search_where ($field_list=array(),$values=array(),&$bean,$add_custom_fields=false,$module='') { |
3945 | - $where_clauses= array(); |
|
3946 | - $like_char='%'; |
|
3947 | - $table_name=$bean->object_name; |
|
3948 | - foreach ($field_list[$module] as $field=>$parms) { |
|
3949 | - if(isset($values[$field]) && $values[$field] != "") { |
|
3950 | - $operator='like'; |
|
3951 | - if (!empty($parms['operator'])) { |
|
3952 | - $operator=$parms['operator']; |
|
3953 | - } |
|
3954 | - if (is_array($values[$field])) { |
|
3955 | - $operator='in'; |
|
3956 | - $field_value=''; |
|
3957 | - foreach ($values[$field] as $key => $val) { |
|
3958 | - if ($val != ' ' and $val != '') { |
|
3959 | - if (!empty($field_value)) { |
|
3960 | - $field_value.=','; |
|
3961 | - } |
|
3962 | - $field_value .= "'".$GLOBALS['db']->quote($val)."'"; |
|
3963 | - } |
|
3964 | - } |
|
3965 | - } else { |
|
3966 | - $field_value=$GLOBALS['db']->quote($values[$field]); |
|
3967 | - } |
|
3968 | - //set db_fields array. |
|
3969 | - if (!isset($parms['db_field']) ) { |
|
3970 | - $parms['db_field'] = array($field); |
|
3971 | - } |
|
3972 | - if (isset($parms['my_items']) and $parms['my_items'] == true) { |
|
3973 | - global $current_user; |
|
3974 | - $field_value = $GLOBALS['db']->quote($current_user->id); |
|
3975 | - $operator='='; |
|
3976 | - } |
|
3945 | + $where_clauses= array(); |
|
3946 | + $like_char='%'; |
|
3947 | + $table_name=$bean->object_name; |
|
3948 | + foreach ($field_list[$module] as $field=>$parms) { |
|
3949 | + if(isset($values[$field]) && $values[$field] != "") { |
|
3950 | + $operator='like'; |
|
3951 | + if (!empty($parms['operator'])) { |
|
3952 | + $operator=$parms['operator']; |
|
3953 | + } |
|
3954 | + if (is_array($values[$field])) { |
|
3955 | + $operator='in'; |
|
3956 | + $field_value=''; |
|
3957 | + foreach ($values[$field] as $key => $val) { |
|
3958 | + if ($val != ' ' and $val != '') { |
|
3959 | + if (!empty($field_value)) { |
|
3960 | + $field_value.=','; |
|
3961 | + } |
|
3962 | + $field_value .= "'".$GLOBALS['db']->quote($val)."'"; |
|
3963 | + } |
|
3964 | + } |
|
3965 | + } else { |
|
3966 | + $field_value=$GLOBALS['db']->quote($values[$field]); |
|
3967 | + } |
|
3968 | + //set db_fields array. |
|
3969 | + if (!isset($parms['db_field']) ) { |
|
3970 | + $parms['db_field'] = array($field); |
|
3971 | + } |
|
3972 | + if (isset($parms['my_items']) and $parms['my_items'] == true) { |
|
3973 | + global $current_user; |
|
3974 | + $field_value = $GLOBALS['db']->quote($current_user->id); |
|
3975 | + $operator='='; |
|
3976 | + } |
|
3977 | 3977 | |
3978 | - $where=''; |
|
3979 | - $itr=0; |
|
3980 | - if ($field_value != '') { |
|
3981 | - |
|
3982 | - foreach ($parms['db_field'] as $db_field) { |
|
3983 | - if (strstr($db_field,'.')===false) { |
|
3984 | - $db_field=$bean->table_name.".".$db_field; |
|
3985 | - } |
|
3986 | - if ($GLOBALS['db']->supports('case_sensitive') && isset($parms['query_type']) && $parms['query_type']=='case_insensitive') { |
|
3987 | - $db_field='upper('.$db_field.")"; |
|
3988 | - $field_value=strtoupper($field_value); |
|
3989 | - } |
|
3990 | - |
|
3991 | - $itr++; |
|
3992 | - if (!empty($where)) { |
|
3993 | - $where .= " OR "; |
|
3994 | - } |
|
3995 | - switch (strtolower($operator)) { |
|
3996 | - case 'like' : |
|
3997 | - $where .= $db_field . " like '".$field_value.$like_char."'"; |
|
3998 | - break; |
|
3999 | - case 'in': |
|
4000 | - $where .= $db_field . " in (".$field_value.')'; |
|
4001 | - break; |
|
4002 | - case '=': |
|
4003 | - $where .= $db_field . " = '".$field_value ."'"; |
|
4004 | - break; |
|
4005 | - } |
|
4006 | - } |
|
4007 | - } |
|
4008 | - if (!empty($where)) { |
|
4009 | - if ($itr>1) { |
|
4010 | - array_push($where_clauses, '( '.$where.' )'); |
|
4011 | - } else { |
|
4012 | - array_push($where_clauses, $where); |
|
4013 | - } |
|
4014 | - } |
|
4015 | - } |
|
4016 | - } |
|
4017 | - if ($add_custom_fields) { |
|
4018 | - require_once('modules/DynamicFields/DynamicField.php'); |
|
4019 | - $bean->setupCustomFields($module); |
|
4020 | - $bean->custom_fields->setWhereClauses($where_clauses); |
|
4021 | - } |
|
4022 | - return $where_clauses; |
|
3978 | + $where=''; |
|
3979 | + $itr=0; |
|
3980 | + if ($field_value != '') { |
|
3981 | + |
|
3982 | + foreach ($parms['db_field'] as $db_field) { |
|
3983 | + if (strstr($db_field,'.')===false) { |
|
3984 | + $db_field=$bean->table_name.".".$db_field; |
|
3985 | + } |
|
3986 | + if ($GLOBALS['db']->supports('case_sensitive') && isset($parms['query_type']) && $parms['query_type']=='case_insensitive') { |
|
3987 | + $db_field='upper('.$db_field.")"; |
|
3988 | + $field_value=strtoupper($field_value); |
|
3989 | + } |
|
3990 | + |
|
3991 | + $itr++; |
|
3992 | + if (!empty($where)) { |
|
3993 | + $where .= " OR "; |
|
3994 | + } |
|
3995 | + switch (strtolower($operator)) { |
|
3996 | + case 'like' : |
|
3997 | + $where .= $db_field . " like '".$field_value.$like_char."'"; |
|
3998 | + break; |
|
3999 | + case 'in': |
|
4000 | + $where .= $db_field . " in (".$field_value.')'; |
|
4001 | + break; |
|
4002 | + case '=': |
|
4003 | + $where .= $db_field . " = '".$field_value ."'"; |
|
4004 | + break; |
|
4005 | + } |
|
4006 | + } |
|
4007 | + } |
|
4008 | + if (!empty($where)) { |
|
4009 | + if ($itr>1) { |
|
4010 | + array_push($where_clauses, '( '.$where.' )'); |
|
4011 | + } else { |
|
4012 | + array_push($where_clauses, $where); |
|
4013 | + } |
|
4014 | + } |
|
4015 | + } |
|
4016 | + } |
|
4017 | + if ($add_custom_fields) { |
|
4018 | + require_once('modules/DynamicFields/DynamicField.php'); |
|
4019 | + $bean->setupCustomFields($module); |
|
4020 | + $bean->custom_fields->setWhereClauses($where_clauses); |
|
4021 | + } |
|
4022 | + return $where_clauses; |
|
4023 | 4023 | } |
4024 | 4024 | |
4025 | 4025 | function add_quotes($str) { |
4026 | - return "'{$str}'"; |
|
4026 | + return "'{$str}'"; |
|
4027 | 4027 | } |
4028 | 4028 | |
4029 | 4029 | /** |
@@ -4033,19 +4033,19 @@ discard block |
||
4033 | 4033 | * @return bool true if successful |
4034 | 4034 | */ |
4035 | 4035 | function rebuildConfigFile($sugar_config, $sugar_version) { |
4036 | - // add defaults to missing values of in-memory sugar_config |
|
4037 | - $sugar_config = sugarArrayMerge(get_sugar_config_defaults(), $sugar_config ); |
|
4038 | - // need to override version with default no matter what |
|
4039 | - $sugar_config['sugar_version'] = $sugar_version; |
|
4036 | + // add defaults to missing values of in-memory sugar_config |
|
4037 | + $sugar_config = sugarArrayMerge(get_sugar_config_defaults(), $sugar_config ); |
|
4038 | + // need to override version with default no matter what |
|
4039 | + $sugar_config['sugar_version'] = $sugar_version; |
|
4040 | 4040 | |
4041 | - ksort( $sugar_config ); |
|
4041 | + ksort( $sugar_config ); |
|
4042 | 4042 | |
4043 | - if( write_array_to_file( "sugar_config", $sugar_config, "config.php" ) ){ |
|
4044 | - return true; |
|
4045 | - } |
|
4046 | - else { |
|
4047 | - return false; |
|
4048 | - } |
|
4043 | + if( write_array_to_file( "sugar_config", $sugar_config, "config.php" ) ){ |
|
4044 | + return true; |
|
4045 | + } |
|
4046 | + else { |
|
4047 | + return false; |
|
4048 | + } |
|
4049 | 4049 | } |
4050 | 4050 | |
4051 | 4051 | /** |
@@ -4072,44 +4072,44 @@ discard block |
||
4072 | 4072 | * @return $site_url The url used to refer to the website |
4073 | 4073 | */ |
4074 | 4074 | function getJavascriptSiteURL() { |
4075 | - global $sugar_config; |
|
4076 | - if(!empty($_SERVER['HTTP_REFERER'])) { |
|
4077 | - $url = parse_url($_SERVER['HTTP_REFERER']); |
|
4078 | - $replacement_url = $url['scheme']."://".$url['host']; |
|
4079 | - if(!empty($url['port'])) |
|
4080 | - $replacement_url .= ':'.$url['port']; |
|
4081 | - $site_url = preg_replace('/^http[s]?\:\/\/[^\/]+/',$replacement_url,$sugar_config['site_url']); |
|
4082 | - } else { |
|
4083 | - $site_url = preg_replace('/^http(s)?\:\/\/[^\/]+/',"http$1://".$_SERVER['HTTP_HOST'],$sugar_config['site_url']); |
|
4084 | - if(!empty($_SERVER['SERVER_PORT']) &&$_SERVER['SERVER_PORT'] == '443') { |
|
4085 | - $site_url = preg_replace('/^http\:/','https:',$site_url); |
|
4086 | - } |
|
4087 | - } |
|
4088 | - $GLOBALS['log']->debug("getJavascriptSiteURL(), site_url=". $site_url); |
|
4089 | - return $site_url; |
|
4075 | + global $sugar_config; |
|
4076 | + if(!empty($_SERVER['HTTP_REFERER'])) { |
|
4077 | + $url = parse_url($_SERVER['HTTP_REFERER']); |
|
4078 | + $replacement_url = $url['scheme']."://".$url['host']; |
|
4079 | + if(!empty($url['port'])) |
|
4080 | + $replacement_url .= ':'.$url['port']; |
|
4081 | + $site_url = preg_replace('/^http[s]?\:\/\/[^\/]+/',$replacement_url,$sugar_config['site_url']); |
|
4082 | + } else { |
|
4083 | + $site_url = preg_replace('/^http(s)?\:\/\/[^\/]+/',"http$1://".$_SERVER['HTTP_HOST'],$sugar_config['site_url']); |
|
4084 | + if(!empty($_SERVER['SERVER_PORT']) &&$_SERVER['SERVER_PORT'] == '443') { |
|
4085 | + $site_url = preg_replace('/^http\:/','https:',$site_url); |
|
4086 | + } |
|
4087 | + } |
|
4088 | + $GLOBALS['log']->debug("getJavascriptSiteURL(), site_url=". $site_url); |
|
4089 | + return $site_url; |
|
4090 | 4090 | } |
4091 | 4091 | |
4092 | 4092 | // works nicely with array_map() -- can be used to wrap single quotes around each element in an array |
4093 | 4093 | function add_squotes($str) { |
4094 | - return "'" . $str . "'"; |
|
4094 | + return "'" . $str . "'"; |
|
4095 | 4095 | } |
4096 | 4096 | |
4097 | 4097 | |
4098 | 4098 | // recursive function to count the number of levels within an array |
4099 | 4099 | function array_depth($array, $depth_count=-1, $depth_array=array()){ |
4100 | - $depth_count++; |
|
4101 | - if (is_array($array)){ |
|
4102 | - foreach ($array as $key => $value){ |
|
4103 | - $depth_array[] = array_depth($value, $depth_count); |
|
4104 | - } |
|
4105 | - } |
|
4106 | - else{ |
|
4107 | - return $depth_count; |
|
4108 | - } |
|
4109 | - foreach ($depth_array as $value){ |
|
4110 | - $depth_count = $value > $depth_count ? $value : $depth_count; |
|
4111 | - } |
|
4112 | - return $depth_count; |
|
4100 | + $depth_count++; |
|
4101 | + if (is_array($array)){ |
|
4102 | + foreach ($array as $key => $value){ |
|
4103 | + $depth_array[] = array_depth($value, $depth_count); |
|
4104 | + } |
|
4105 | + } |
|
4106 | + else{ |
|
4107 | + return $depth_count; |
|
4108 | + } |
|
4109 | + foreach ($depth_array as $value){ |
|
4110 | + $depth_count = $value > $depth_count ? $value : $depth_count; |
|
4111 | + } |
|
4112 | + return $depth_count; |
|
4113 | 4113 | } |
4114 | 4114 | |
4115 | 4115 | /** |
@@ -4120,16 +4120,16 @@ discard block |
||
4120 | 4120 | function createGroupUser($name) { |
4121 | 4121 | |
4122 | 4122 | |
4123 | - $group = new User(); |
|
4124 | - $group->user_name = $name; |
|
4125 | - $group->last_name = $name; |
|
4126 | - $group->is_group = 1; |
|
4127 | - $group->deleted = 0; |
|
4128 | - $group->status = 'Active'; // cn: bug 6711 |
|
4129 | - $group->setPreference('timezone', TimeDate::userTimezone()); |
|
4130 | - $group->save(); |
|
4123 | + $group = new User(); |
|
4124 | + $group->user_name = $name; |
|
4125 | + $group->last_name = $name; |
|
4126 | + $group->is_group = 1; |
|
4127 | + $group->deleted = 0; |
|
4128 | + $group->status = 'Active'; // cn: bug 6711 |
|
4129 | + $group->setPreference('timezone', TimeDate::userTimezone()); |
|
4130 | + $group->save(); |
|
4131 | 4131 | |
4132 | - return $group->id; |
|
4132 | + return $group->id; |
|
4133 | 4133 | } |
4134 | 4134 | |
4135 | 4135 | /* |
@@ -4142,48 +4142,48 @@ discard block |
||
4142 | 4142 | function _getIcon($iconFileName) |
4143 | 4143 | { |
4144 | 4144 | |
4145 | - $iconName = "icon_{$iconFileName}.gif"; |
|
4145 | + $iconName = "icon_{$iconFileName}.gif"; |
|
4146 | 4146 | $iconFound = SugarThemeRegistry::current()->getImageURL($iconName,false); |
4147 | 4147 | |
4148 | 4148 | //First try un-ucfirst-ing the icon name |
4149 | 4149 | if ( empty($iconFound) ) |
4150 | - $iconName = "icon_" . strtolower(substr($iconFileName,0,1)).substr($iconFileName,1) . ".gif"; |
|
4150 | + $iconName = "icon_" . strtolower(substr($iconFileName,0,1)).substr($iconFileName,1) . ".gif"; |
|
4151 | 4151 | $iconFound = SugarThemeRegistry::current()->getImageURL($iconName,false); |
4152 | 4152 | |
4153 | - //Next try removing the icon prefix |
|
4153 | + //Next try removing the icon prefix |
|
4154 | 4154 | if ( empty($iconFound) ) |
4155 | - $iconName = "{$iconFileName}.gif"; |
|
4156 | - $iconFound = SugarThemeRegistry::current()->getImageURL($iconName,false); |
|
4155 | + $iconName = "{$iconFileName}.gif"; |
|
4156 | + $iconFound = SugarThemeRegistry::current()->getImageURL($iconName,false); |
|
4157 | 4157 | |
4158 | - if ( empty($iconFound) ) |
|
4159 | - $iconName = ''; |
|
4158 | + if ( empty($iconFound) ) |
|
4159 | + $iconName = ''; |
|
4160 | 4160 | |
4161 | - return $iconName; |
|
4161 | + return $iconName; |
|
4162 | 4162 | } |
4163 | 4163 | /** |
4164 | - * Function to grab the correct icon image for Studio |
|
4165 | - * @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) |
|
4167 | - * @param string $width Width of image |
|
4168 | - * @param string $height Height of image |
|
4169 | - * @param string $align Alignment of image |
|
4170 | - * @param string $alt Alt tag of image |
|
4171 | - * @return string $string <img> tag with corresponding image |
|
4172 | - */ |
|
4164 | + * Function to grab the correct icon image for Studio |
|
4165 | + * @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) |
|
4167 | + * @param string $width Width of image |
|
4168 | + * @param string $height Height of image |
|
4169 | + * @param string $align Alignment of image |
|
4170 | + * @param string $alt Alt tag of image |
|
4171 | + * @return string $string <img> tag with corresponding image |
|
4172 | + */ |
|
4173 | 4173 | |
4174 | 4174 | function getStudioIcon($iconFileName='', $altFileName='', $width='48', $height='48', $align='baseline', $alt='' ) |
4175 | 4175 | { |
4176 | - global $app_strings, $theme; |
|
4176 | + global $app_strings, $theme; |
|
4177 | 4177 | |
4178 | 4178 | $iconName = _getIcon($iconFileName); |
4179 | - if(empty($iconName)){ |
|
4180 | - $iconName = _getIcon($altFileName); |
|
4181 | - if (empty($iconName)) |
|
4182 | - { |
|
4179 | + if(empty($iconName)){ |
|
4180 | + $iconName = _getIcon($altFileName); |
|
4181 | + if (empty($iconName)) |
|
4182 | + { |
|
4183 | 4183 | return $app_strings['LBL_NO_IMAGE']; |
4184 | - } |
|
4185 | - } |
|
4186 | - return SugarThemeRegistry::current()->getImage($iconName, "align=\"$align\" border=\"0\"", $width, $height); |
|
4184 | + } |
|
4185 | + } |
|
4186 | + return SugarThemeRegistry::current()->getImage($iconName, "align=\"$align\" border=\"0\"", $width, $height); |
|
4187 | 4187 | } |
4188 | 4188 | |
4189 | 4189 | /** |
@@ -4198,16 +4198,16 @@ discard block |
||
4198 | 4198 | */ |
4199 | 4199 | |
4200 | 4200 | function get_dashlets_dialog_icon($module='', $width='32', $height='32', $align='absmiddle',$alt=''){ |
4201 | - global $app_strings, $theme; |
|
4202 | - $iconName = _getIcon($module . "_32"); |
|
4203 | - if (empty($iconName)) |
|
4204 | - { |
|
4205 | - $iconName = _getIcon($module); |
|
4206 | - } |
|
4207 | - if(empty($iconName)){ |
|
4208 | - return $app_strings['LBL_NO_IMAGE']; |
|
4209 | - } |
|
4210 | - return SugarThemeRegistry::current()->getImage($iconName, "align=\"$align\" border=\"0\"", $width, $height); |
|
4201 | + global $app_strings, $theme; |
|
4202 | + $iconName = _getIcon($module . "_32"); |
|
4203 | + if (empty($iconName)) |
|
4204 | + { |
|
4205 | + $iconName = _getIcon($module); |
|
4206 | + } |
|
4207 | + if(empty($iconName)){ |
|
4208 | + return $app_strings['LBL_NO_IMAGE']; |
|
4209 | + } |
|
4210 | + return SugarThemeRegistry::current()->getImage($iconName, "align=\"$align\" border=\"0\"", $width, $height); |
|
4211 | 4211 | } |
4212 | 4212 | |
4213 | 4213 | // works nicely to change UTF8 strings that are html entities - good for PDF conversions |
@@ -4239,23 +4239,23 @@ discard block |
||
4239 | 4239 | } |
4240 | 4240 | |
4241 | 4241 | function str_split_php4($string, $length = 1) { |
4242 | - $string_length = strlen($string); |
|
4243 | - $return = array(); |
|
4244 | - $cursor = 0; |
|
4245 | - if ($length > $string_length) { |
|
4246 | - // use the string_length as the string is shorter than the length |
|
4247 | - $length = $string_length; |
|
4248 | - } |
|
4249 | - for ($cursor = 0; $cursor < $string_length; $cursor = $cursor + $length) { |
|
4250 | - $return[] = substr($string, $cursor, $length); |
|
4251 | - } |
|
4252 | - return $return; |
|
4242 | + $string_length = strlen($string); |
|
4243 | + $return = array(); |
|
4244 | + $cursor = 0; |
|
4245 | + if ($length > $string_length) { |
|
4246 | + // use the string_length as the string is shorter than the length |
|
4247 | + $length = $string_length; |
|
4248 | + } |
|
4249 | + for ($cursor = 0; $cursor < $string_length; $cursor = $cursor + $length) { |
|
4250 | + $return[] = substr($string, $cursor, $length); |
|
4251 | + } |
|
4252 | + return $return; |
|
4253 | 4253 | } |
4254 | 4254 | |
4255 | 4255 | if (version_compare(phpversion(), '5.0.0', '<')) { |
4256 | - function str_split($string, $length = 1) { |
|
4257 | - return str_split_php4($string, $length); |
|
4258 | - } |
|
4256 | + function str_split($string, $length = 1) { |
|
4257 | + return str_split_php4($string, $length); |
|
4258 | + } |
|
4259 | 4259 | } |
4260 | 4260 | |
4261 | 4261 | /* |
@@ -4287,8 +4287,8 @@ discard block |
||
4287 | 4287 | */ |
4288 | 4288 | function chartColors() |
4289 | 4289 | { |
4290 | - if (SugarThemeRegistry::current()->getCSSURL('sugarColors.xml')=='') |
|
4291 | - return SugarThemeRegistry::current()->getImageURL('sugarColors.xml'); |
|
4290 | + if (SugarThemeRegistry::current()->getCSSURL('sugarColors.xml')=='') |
|
4291 | + return SugarThemeRegistry::current()->getImageURL('sugarColors.xml'); |
|
4292 | 4292 | return SugarThemeRegistry::current()->getCSSURL('sugarColors.xml'); |
4293 | 4293 | } |
4294 | 4294 | /* End Chart Dashlet helper functions */ |
@@ -4299,7 +4299,7 @@ discard block |
||
4299 | 4299 | */ |
4300 | 4300 | |
4301 | 4301 | function ajaxInit() { |
4302 | - ini_set('display_errors', 'false'); |
|
4302 | + ini_set('display_errors', 'false'); |
|
4303 | 4303 | } |
4304 | 4304 | |
4305 | 4305 | /** |
@@ -4366,33 +4366,33 @@ discard block |
||
4366 | 4366 | * @return String value of the shortcut keys |
4367 | 4367 | */ |
4368 | 4368 | function get_alt_hot_key() { |
4369 | - $ua = ''; |
|
4369 | + $ua = ''; |
|
4370 | 4370 | if ( isset($_SERVER['HTTP_USER_AGENT']) ) |
4371 | 4371 | $ua = strtolower($_SERVER['HTTP_USER_AGENT']); |
4372 | - $isMac = strpos($ua, 'mac') !== false; |
|
4373 | - $isLinux = strpos($ua, 'linux') !== false; |
|
4372 | + $isMac = strpos($ua, 'mac') !== false; |
|
4373 | + $isLinux = strpos($ua, 'linux') !== false; |
|
4374 | 4374 | |
4375 | - if(!$isMac && !$isLinux && strpos($ua, 'mozilla') !== false) { |
|
4376 | - if(preg_match('/firefox\/(\d)?\./', $ua, $matches)) { |
|
4377 | - return $matches[1] < 2 ? 'Alt+' : 'Alt+Shift+'; |
|
4378 | - } |
|
4379 | - } |
|
4380 | - return $isMac ? 'Ctrl+' : 'Alt+'; |
|
4375 | + if(!$isMac && !$isLinux && strpos($ua, 'mozilla') !== false) { |
|
4376 | + if(preg_match('/firefox\/(\d)?\./', $ua, $matches)) { |
|
4377 | + return $matches[1] < 2 ? 'Alt+' : 'Alt+Shift+'; |
|
4378 | + } |
|
4379 | + } |
|
4380 | + return $isMac ? 'Ctrl+' : 'Alt+'; |
|
4381 | 4381 | } |
4382 | 4382 | |
4383 | 4383 | function can_start_session(){ |
4384 | - if(!empty($_GET['PHPSESSID'])) { |
|
4385 | - return true; |
|
4386 | - } |
|
4387 | - $session_id = session_id(); |
|
4388 | - return empty($session_id) ? true : false; |
|
4384 | + if(!empty($_GET['PHPSESSID'])) { |
|
4385 | + return true; |
|
4386 | + } |
|
4387 | + $session_id = session_id(); |
|
4388 | + return empty($session_id) ? true : false; |
|
4389 | 4389 | } |
4390 | 4390 | |
4391 | 4391 | function load_link_class($properties){ |
4392 | - $class = 'Link2'; |
|
4393 | - if(!empty($properties['link_class']) && !empty($properties['link_file'])){ |
|
4394 | - require_once($properties['link_file']); |
|
4395 | - $class = $properties['link_class']; |
|
4392 | + $class = 'Link2'; |
|
4393 | + if(!empty($properties['link_class']) && !empty($properties['link_file'])){ |
|
4394 | + require_once($properties['link_file']); |
|
4395 | + $class = $properties['link_class']; |
|
4396 | 4396 | } |
4397 | 4397 | return $class; |
4398 | 4398 | } |
@@ -4413,7 +4413,7 @@ discard block |
||
4413 | 4413 | if ( !isset($GLOBALS['sugar_config']['allow_pop_inbound']) || ! $GLOBALS['sugar_config']['allow_pop_inbound'] ) |
4414 | 4414 | { |
4415 | 4415 | if( isset($protocol['pop3']) ) |
4416 | - unset($protocol['pop3']); |
|
4416 | + unset($protocol['pop3']); |
|
4417 | 4417 | } |
4418 | 4418 | else |
4419 | 4419 | $protocol['pop3'] = 'POP3'; |
@@ -4448,15 +4448,15 @@ discard block |
||
4448 | 4448 | * |
4449 | 4449 | */ |
4450 | 4450 | function unencodeMultienum($string) { |
4451 | - if (is_array($string)) |
|
4452 | - { |
|
4453 | - return $string; |
|
4454 | - } |
|
4455 | - if (substr($string, 0 ,1) == "^" && substr($string, -1) == "^") { |
|
4456 | - $string = substr(substr($string, 1), 0, strlen($string) -2); |
|
4457 | - } |
|
4451 | + if (is_array($string)) |
|
4452 | + { |
|
4453 | + return $string; |
|
4454 | + } |
|
4455 | + if (substr($string, 0 ,1) == "^" && substr($string, -1) == "^") { |
|
4456 | + $string = substr(substr($string, 1), 0, strlen($string) -2); |
|
4457 | + } |
|
4458 | 4458 | |
4459 | - return explode('^,^', $string); |
|
4459 | + return explode('^,^', $string); |
|
4460 | 4460 | } |
4461 | 4461 | |
4462 | 4462 | function encodeMultienumValue($arr) { |
@@ -4466,7 +4466,7 @@ discard block |
||
4466 | 4466 | if (empty($arr)) |
4467 | 4467 | return ""; |
4468 | 4468 | |
4469 | - $string = "^" . implode('^,^', $arr) . "^"; |
|
4469 | + $string = "^" . implode('^,^', $arr) . "^"; |
|
4470 | 4470 | |
4471 | 4471 | return $string; |
4472 | 4472 | } |
@@ -4482,86 +4482,86 @@ discard block |
||
4482 | 4482 | * @return $ret_array['join']: extra join condition |
4483 | 4483 | */ |
4484 | 4484 | function create_export_query_relate_link_patch($module, $searchFields, $where){ |
4485 | - if(file_exists('modules/'.$module.'/SearchForm.html')){ |
|
4486 | - $ret_array['where'] = $where; |
|
4487 | - return $ret_array; |
|
4488 | - } |
|
4489 | - $seed = loadBean($module); |
|
4485 | + if(file_exists('modules/'.$module.'/SearchForm.html')){ |
|
4486 | + $ret_array['where'] = $where; |
|
4487 | + return $ret_array; |
|
4488 | + } |
|
4489 | + $seed = loadBean($module); |
|
4490 | 4490 | foreach($seed->field_defs as $name=>$field) |
4491 | - { |
|
4492 | - |
|
4493 | - if( $field['type'] == 'relate' && isset($field['link']) && !empty($searchFields[$name]['value']) ){ |
|
4494 | - $seed->load_relationship($field['link']); |
|
4495 | - $params = array(); |
|
4496 | - if(empty($join_type)) |
|
4497 | - { |
|
4498 | - $params['join_type'] = ' LEFT JOIN '; |
|
4499 | - } |
|
4500 | - else |
|
4501 | - { |
|
4502 | - $params['join_type'] = $join_type; |
|
4503 | - } |
|
4504 | - if(isset($data['join_name'])) |
|
4505 | - { |
|
4506 | - $params['join_table_alias'] = $field['join_name']; |
|
4507 | - } |
|
4508 | - else |
|
4509 | - { |
|
4510 | - $params['join_table_alias'] = 'join_'.$field['name']; |
|
4491 | + { |
|
4511 | 4492 | |
4512 | - } |
|
4513 | - if(isset($data['join_link_name'])) |
|
4514 | - { |
|
4515 | - $params['join_table_link_alias'] = $field['join_link_name']; |
|
4516 | - } |
|
4517 | - else |
|
4518 | - { |
|
4519 | - $params['join_table_link_alias'] = 'join_link_'.$field['name']; |
|
4520 | - } |
|
4521 | - $join = $seed->$field['link']->getJoin($params, true); |
|
4522 | - $join_table_alias = 'join_'.$field['name']; |
|
4523 | - if(isset($field['db_concat_fields'])){ |
|
4524 | - $db_field = db_concat($join_table_alias, $field['db_concat_fields']); |
|
4525 | - $where = preg_replace('/'.$field['name'].'/', $db_field, $where); |
|
4526 | - }else{ |
|
4527 | - $where = preg_replace('/(^|[\s(])' . $field['name'] . '/', '${1}' . $join_table_alias . '.'.$field['rname'], $where); |
|
4528 | - } |
|
4529 | - } |
|
4530 | - } |
|
4493 | + if( $field['type'] == 'relate' && isset($field['link']) && !empty($searchFields[$name]['value']) ){ |
|
4494 | + $seed->load_relationship($field['link']); |
|
4495 | + $params = array(); |
|
4496 | + if(empty($join_type)) |
|
4497 | + { |
|
4498 | + $params['join_type'] = ' LEFT JOIN '; |
|
4499 | + } |
|
4500 | + else |
|
4501 | + { |
|
4502 | + $params['join_type'] = $join_type; |
|
4503 | + } |
|
4504 | + if(isset($data['join_name'])) |
|
4505 | + { |
|
4506 | + $params['join_table_alias'] = $field['join_name']; |
|
4507 | + } |
|
4508 | + else |
|
4509 | + { |
|
4510 | + $params['join_table_alias'] = 'join_'.$field['name']; |
|
4511 | + |
|
4512 | + } |
|
4513 | + if(isset($data['join_link_name'])) |
|
4514 | + { |
|
4515 | + $params['join_table_link_alias'] = $field['join_link_name']; |
|
4516 | + } |
|
4517 | + else |
|
4518 | + { |
|
4519 | + $params['join_table_link_alias'] = 'join_link_'.$field['name']; |
|
4520 | + } |
|
4521 | + $join = $seed->$field['link']->getJoin($params, true); |
|
4522 | + $join_table_alias = 'join_'.$field['name']; |
|
4523 | + if(isset($field['db_concat_fields'])){ |
|
4524 | + $db_field = db_concat($join_table_alias, $field['db_concat_fields']); |
|
4525 | + $where = preg_replace('/'.$field['name'].'/', $db_field, $where); |
|
4526 | + }else{ |
|
4527 | + $where = preg_replace('/(^|[\s(])' . $field['name'] . '/', '${1}' . $join_table_alias . '.'.$field['rname'], $where); |
|
4528 | + } |
|
4529 | + } |
|
4530 | + } |
|
4531 | 4531 | $ret_array = array('where'=>$where, 'join'=> isset($join['join']) ? $join['join'] : ''); |
4532 | - return $ret_array; |
|
4532 | + return $ret_array; |
|
4533 | 4533 | } |
4534 | 4534 | |
4535 | 4535 | /** |
4536 | - * We need to clear all the js cache files, including the js language files in serval places in MB. So I extract them into a util function here. |
|
4537 | - * @Depends on QuickRepairAndRebuild.php |
|
4538 | - * @Relate bug 30642 ,23177 |
|
4539 | - */ |
|
4536 | + * We need to clear all the js cache files, including the js language files in serval places in MB. So I extract them into a util function here. |
|
4537 | + * @Depends on QuickRepairAndRebuild.php |
|
4538 | + * @Relate bug 30642 ,23177 |
|
4539 | + */ |
|
4540 | 4540 | function clearAllJsAndJsLangFilesWithoutOutput(){ |
4541 | - global $current_language , $mod_strings; |
|
4542 | - $MBmodStrings = $mod_strings; |
|
4541 | + global $current_language , $mod_strings; |
|
4542 | + $MBmodStrings = $mod_strings; |
|
4543 | 4543 | $mod_strings = return_module_language ( $current_language, 'Administration' ) ; |
4544 | 4544 | include_once ('modules/Administration/QuickRepairAndRebuild.php') ; |
4545 | 4545 | $repair = new RepairAndClear(); |
4546 | 4546 | $repair->module_list = array(); |
4547 | - $repair->show_output = false; |
|
4548 | - $repair->clearJsLangFiles(); |
|
4549 | - $repair->clearJsFiles(); |
|
4550 | - $mod_strings = $MBmodStrings; |
|
4547 | + $repair->show_output = false; |
|
4548 | + $repair->clearJsLangFiles(); |
|
4549 | + $repair->clearJsFiles(); |
|
4550 | + $mod_strings = $MBmodStrings; |
|
4551 | 4551 | } |
4552 | 4552 | |
4553 | 4553 | /** |
4554 | 4554 | * This function will allow you to get a variable value from query string |
4555 | 4555 | */ |
4556 | 4556 | function getVariableFromQueryString($variable, $string){ |
4557 | - $matches = array(); |
|
4558 | - $number = preg_match("/{$variable}=([a-zA-Z0-9_-]+)[&]?/", $string, $matches); |
|
4559 | - if($number){ |
|
4560 | - return $matches[1]; |
|
4561 | - } |
|
4562 | - else{ |
|
4563 | - return false; |
|
4564 | - } |
|
4557 | + $matches = array(); |
|
4558 | + $number = preg_match("/{$variable}=([a-zA-Z0-9_-]+)[&]?/", $string, $matches); |
|
4559 | + if($number){ |
|
4560 | + return $matches[1]; |
|
4561 | + } |
|
4562 | + else{ |
|
4563 | + return false; |
|
4564 | + } |
|
4565 | 4565 | } |
4566 | 4566 | |
4567 | 4567 | /** |
@@ -4572,14 +4572,14 @@ discard block |
||
4572 | 4572 | * @return boolean flag indicating whether or not iframes module should be hidden |
4573 | 4573 | */ |
4574 | 4574 | function should_hide_iframes() { |
4575 | - //Remove the MySites module |
|
4576 | - if(file_exists('modules/iFrames/iFrame.php')) { |
|
4575 | + //Remove the MySites module |
|
4576 | + if(file_exists('modules/iFrames/iFrame.php')) { |
|
4577 | 4577 | if(!class_exists("iFrame")) { |
4578 | 4578 | require_once('modules/iFrames/iFrame.php'); |
4579 | 4579 | } |
4580 | 4580 | return false; |
4581 | - } |
|
4582 | - return true; |
|
4581 | + } |
|
4582 | + return true; |
|
4583 | 4583 | } |
4584 | 4584 | |
4585 | 4585 | /** |
@@ -4589,11 +4589,11 @@ discard block |
||
4589 | 4589 | * @return string RC, BETA, GA |
4590 | 4590 | */ |
4591 | 4591 | function getVersionStatus($version){ |
4592 | - if(preg_match('/^[\d\.]+?([a-zA-Z]+?)[\d]*?$/si', $version, $matches)) { |
|
4593 | - return strtoupper($matches[1]); |
|
4594 | - }else{ |
|
4595 | - return 'GA'; |
|
4596 | - } |
|
4592 | + if(preg_match('/^[\d\.]+?([a-zA-Z]+?)[\d]*?$/si', $version, $matches)) { |
|
4593 | + return strtoupper($matches[1]); |
|
4594 | + }else{ |
|
4595 | + return 'GA'; |
|
4596 | + } |
|
4597 | 4597 | } |
4598 | 4598 | |
4599 | 4599 | /** |
@@ -4604,16 +4604,16 @@ discard block |
||
4604 | 4604 | * @return version |
4605 | 4605 | */ |
4606 | 4606 | function getMajorMinorVersion($version){ |
4607 | - if(preg_match('/^([\d\.]+).*$/si', $version, $matches2)){ |
|
4608 | - $version = $matches2[1]; |
|
4609 | - $arr = explode('.', $version); |
|
4610 | - if(count($arr) > 2){ |
|
4611 | - if($arr[2] == '0'){ |
|
4612 | - $version = substr($version, 0, 3); |
|
4613 | - } |
|
4614 | - } |
|
4615 | - } |
|
4616 | - return $version; |
|
4607 | + if(preg_match('/^([\d\.]+).*$/si', $version, $matches2)){ |
|
4608 | + $version = $matches2[1]; |
|
4609 | + $arr = explode('.', $version); |
|
4610 | + if(count($arr) > 2){ |
|
4611 | + if($arr[2] == '0'){ |
|
4612 | + $version = substr($version, 0, 3); |
|
4613 | + } |
|
4614 | + } |
|
4615 | + } |
|
4616 | + return $version; |
|
4617 | 4617 | } |
4618 | 4618 | |
4619 | 4619 | /** |
@@ -4622,9 +4622,9 @@ discard block |
||
4622 | 4622 | */ |
4623 | 4623 | function sugar_microtime() |
4624 | 4624 | { |
4625 | - $now = explode(' ', microtime()); |
|
4626 | - $unique_id = $now[1].str_replace('.', '', $now[0]); |
|
4627 | - return $unique_id; |
|
4625 | + $now = explode(' ', microtime()); |
|
4626 | + $unique_id = $now[1].str_replace('.', '', $now[0]); |
|
4627 | + return $unique_id; |
|
4628 | 4628 | } |
4629 | 4629 | |
4630 | 4630 | /** |
@@ -4634,15 +4634,15 @@ discard block |
||
4634 | 4634 | */ |
4635 | 4635 | function getUrls($string) |
4636 | 4636 | { |
4637 | - $lines = explode("<br>", trim($string)); |
|
4638 | - $urls = array(); |
|
4639 | - foreach($lines as $line){ |
|
4640 | - $regex = '/http?\:\/\/[^\" ]+/i'; |
|
4641 | - preg_match_all($regex, $line, $matches); |
|
4642 | - foreach($matches[0] as $match){ |
|
4643 | - $urls[] = $match; |
|
4644 | - } |
|
4645 | - } |
|
4637 | + $lines = explode("<br>", trim($string)); |
|
4638 | + $urls = array(); |
|
4639 | + foreach($lines as $line){ |
|
4640 | + $regex = '/http?\:\/\/[^\" ]+/i'; |
|
4641 | + preg_match_all($regex, $line, $matches); |
|
4642 | + foreach($matches[0] as $match){ |
|
4643 | + $urls[] = $match; |
|
4644 | + } |
|
4645 | + } |
|
4646 | 4646 | return $urls; |
4647 | 4647 | } |
4648 | 4648 | |
@@ -4654,14 +4654,14 @@ discard block |
||
4654 | 4654 | */ |
4655 | 4655 | function verify_image_file($path, $jpeg = false) |
4656 | 4656 | { |
4657 | - if(function_exists('imagepng') && function_exists('imagejpeg') && function_exists('imagecreatefromstring')) { |
|
4657 | + if(function_exists('imagepng') && function_exists('imagejpeg') && function_exists('imagecreatefromstring')) { |
|
4658 | 4658 | $img = imagecreatefromstring(file_get_contents($path)); |
4659 | - if(!$img) { |
|
4660 | - return false; |
|
4661 | - } |
|
4662 | - $img_size = getimagesize($path); |
|
4663 | - $filetype = $img_size['mime']; |
|
4664 | - //if filetype is jpeg or if we are only allowing jpegs, create jpg image |
|
4659 | + if(!$img) { |
|
4660 | + return false; |
|
4661 | + } |
|
4662 | + $img_size = getimagesize($path); |
|
4663 | + $filetype = $img_size['mime']; |
|
4664 | + //if filetype is jpeg or if we are only allowing jpegs, create jpg image |
|
4665 | 4665 | if($filetype == "image/jpeg" || $jpeg) { |
4666 | 4666 | ob_start(); |
4667 | 4667 | imagejpeg($img); |
@@ -4672,19 +4672,19 @@ discard block |
||
4672 | 4672 | } |
4673 | 4673 | } elseif ($filetype == "image/png") { |
4674 | 4674 | // else if the filetype is png, create png |
4675 | - imagealphablending($img, true); |
|
4676 | - imagesavealpha($img, true); |
|
4677 | - ob_start(); |
|
4675 | + imagealphablending($img, true); |
|
4676 | + imagesavealpha($img, true); |
|
4677 | + ob_start(); |
|
4678 | 4678 | imagepng($img); |
4679 | 4679 | $image = ob_get_clean(); |
4680 | - if(file_put_contents($path, $image)) { |
|
4680 | + if(file_put_contents($path, $image)) { |
|
4681 | 4681 | return true; |
4682 | - } |
|
4682 | + } |
|
4683 | 4683 | } else { |
4684 | - return false; |
|
4684 | + return false; |
|
4685 | 4685 | } |
4686 | - } else { |
|
4687 | - // check image manually |
|
4686 | + } else { |
|
4687 | + // check image manually |
|
4688 | 4688 | $fp = fopen($path, "rb"); |
4689 | 4689 | if(!$fp) return false; |
4690 | 4690 | $data = ''; |
@@ -4693,15 +4693,15 @@ discard block |
||
4693 | 4693 | $data .= fread($fp,8192); |
4694 | 4694 | } |
4695 | 4695 | |
4696 | - fclose($fp); |
|
4697 | - if(preg_match("/<(\?php|html|!doctype|script|body|head|plaintext|table|img |pre(>| )|frameset|iframe|object|link|base|style|font|applet|meta|center|form|isindex)/i", |
|
4698 | - $data, $m)) { |
|
4699 | - $GLOBALS['log']->fatal("Found {$m[0]} in $path, not allowing upload"); |
|
4700 | - return false; |
|
4701 | - } |
|
4702 | - return true; |
|
4703 | - } |
|
4704 | - return false; |
|
4696 | + fclose($fp); |
|
4697 | + if(preg_match("/<(\?php|html|!doctype|script|body|head|plaintext|table|img |pre(>| )|frameset|iframe|object|link|base|style|font|applet|meta|center|form|isindex)/i", |
|
4698 | + $data, $m)) { |
|
4699 | + $GLOBALS['log']->fatal("Found {$m[0]} in $path, not allowing upload"); |
|
4700 | + return false; |
|
4701 | + } |
|
4702 | + return true; |
|
4703 | + } |
|
4704 | + return false; |
|
4705 | 4705 | } |
4706 | 4706 | |
4707 | 4707 | /** |
@@ -4718,16 +4718,16 @@ discard block |
||
4718 | 4718 | } |
4719 | 4719 | |
4720 | 4720 | if(!file_exists($path) || !is_file($path)) { |
4721 | - return false; |
|
4722 | - } |
|
4721 | + return false; |
|
4722 | + } |
|
4723 | 4723 | |
4724 | - $img_size = getimagesize($path); |
|
4725 | - $filetype = $img_size['mime']; |
|
4726 | - $ext = end(explode(".", $path)); |
|
4727 | - if(substr_count('..', $path) > 0 || ($ext !== $path && !isset($supportedExtensions[strtolower($ext)])) || |
|
4728 | - !in_array($filetype, array_values($supportedExtensions))) { |
|
4729 | - return false; |
|
4730 | - } |
|
4724 | + $img_size = getimagesize($path); |
|
4725 | + $filetype = $img_size['mime']; |
|
4726 | + $ext = end(explode(".", $path)); |
|
4727 | + if(substr_count('..', $path) > 0 || ($ext !== $path && !isset($supportedExtensions[strtolower($ext)])) || |
|
4728 | + !in_array($filetype, array_values($supportedExtensions))) { |
|
4729 | + return false; |
|
4730 | + } |
|
4731 | 4731 | return verify_image_file($path, $jpeg_only); |
4732 | 4732 | } |
4733 | 4733 | |
@@ -4779,7 +4779,7 @@ discard block |
||
4779 | 4779 | if (isset($GLOBALS['sugar_config']['search_wildcard_infront']) && |
4780 | 4780 | $GLOBALS['sugar_config']['search_wildcard_infront'] == true) { |
4781 | 4781 | if (substr($str,0,1) <> $wildcard) |
4782 | - $str = $wildcard.$str; |
|
4782 | + $str = $wildcard.$str; |
|
4783 | 4783 | } |
4784 | 4784 | |
4785 | 4785 | // add wildcard at the end of search string (default) |
@@ -4794,7 +4794,7 @@ discard block |
||
4794 | 4794 | |
4795 | 4795 | //check to see if custom utils exists |
4796 | 4796 | if(file_exists('custom/include/custom_utils.php')){ |
4797 | - include_once('custom/include/custom_utils.php'); |
|
4797 | + include_once('custom/include/custom_utils.php'); |
|
4798 | 4798 | } |
4799 | 4799 | |
4800 | 4800 | //check to see if custom utils exists in Extension framework |
@@ -4802,12 +4802,12 @@ discard block |
||
4802 | 4802 | include_once('custom/application/Ext/Utils/custom_utils.ext.php'); |
4803 | 4803 | } |
4804 | 4804 | /** |
4805 | - * @param $input - the input string to sanitize |
|
4806 | - * @param int $quotes - use quotes |
|
4807 | - * @param string $charset - the default charset |
|
4808 | - * @param bool $remove - strip tags or not |
|
4809 | - * @return string - the sanitized string |
|
4810 | - */ |
|
4805 | + * @param $input - the input string to sanitize |
|
4806 | + * @param int $quotes - use quotes |
|
4807 | + * @param string $charset - the default charset |
|
4808 | + * @param bool $remove - strip tags or not |
|
4809 | + * @return string - the sanitized string |
|
4810 | + */ |
|
4811 | 4811 | function sanitize($input, $quotes = ENT_QUOTES, $charset = 'UTF-8', $remove = false) |
4812 | 4812 | { |
4813 | 4813 | return htmlentities($input, $quotes, $charset); |
@@ -4854,9 +4854,9 @@ discard block |
||
4854 | 4854 | $result = array(); |
4855 | 4855 | foreach($data as $key=>$val) { |
4856 | 4856 | if(is_array($val)) { |
4857 | - $result[$key] = utf8_recursive_encode($val); |
|
4857 | + $result[$key] = utf8_recursive_encode($val); |
|
4858 | 4858 | } else { |
4859 | - $result[$key] = utf8_encode($val); |
|
4859 | + $result[$key] = utf8_encode($val); |
|
4860 | 4860 | } |
4861 | 4861 | } |
4862 | 4862 | return $result; |
@@ -4938,18 +4938,18 @@ discard block |
||
4938 | 4938 | * @param string $etag ETag to use for this content. |
4939 | 4939 | */ |
4940 | 4940 | function generateETagHeader($etag){ |
4941 | - header("cache-control:"); |
|
4942 | - header('Expires: '); |
|
4943 | - header("ETag: " . $etag); |
|
4944 | - header("Pragma:"); |
|
4945 | - if(isset($_SERVER["HTTP_IF_NONE_MATCH"])){ |
|
4946 | - if($etag == $_SERVER["HTTP_IF_NONE_MATCH"]){ |
|
4947 | - ob_clean(); |
|
4948 | - header("Status: 304 Not Modified"); |
|
4949 | - header("HTTP/1.0 304 Not Modified"); |
|
4950 | - die(); |
|
4951 | - } |
|
4952 | - } |
|
4941 | + header("cache-control:"); |
|
4942 | + header('Expires: '); |
|
4943 | + header("ETag: " . $etag); |
|
4944 | + header("Pragma:"); |
|
4945 | + if(isset($_SERVER["HTTP_IF_NONE_MATCH"])){ |
|
4946 | + if($etag == $_SERVER["HTTP_IF_NONE_MATCH"]){ |
|
4947 | + ob_clean(); |
|
4948 | + header("Status: 304 Not Modified"); |
|
4949 | + header("HTTP/1.0 304 Not Modified"); |
|
4950 | + die(); |
|
4951 | + } |
|
4952 | + } |
|
4953 | 4953 | } |
4954 | 4954 | |
4955 | 4955 | /** |
@@ -4962,22 +4962,22 @@ discard block |
||
4962 | 4962 | * @return string translated report name |
4963 | 4963 | */ |
4964 | 4964 | function getReportNameTranslation($reportName) { |
4965 | - global $current_language; |
|
4965 | + global $current_language; |
|
4966 | 4966 | |
4967 | - // Used for translating reports |
|
4967 | + // Used for translating reports |
|
4968 | 4968 | $mod_strings = return_module_language($current_language, 'Reports'); |
4969 | 4969 | |
4970 | - // Search for the report name in the default language and get the key |
|
4971 | - $key = array_search($reportName, return_module_language("", "Reports")); |
|
4970 | + // Search for the report name in the default language and get the key |
|
4971 | + $key = array_search($reportName, return_module_language("", "Reports")); |
|
4972 | 4972 | |
4973 | - // If the key was found, use it to get a translation, otherwise just use report name |
|
4974 | - if (!empty($key)) { |
|
4975 | - $title = $mod_strings[$key]; |
|
4976 | - } else { |
|
4977 | - $title = $reportName; |
|
4978 | - } |
|
4973 | + // If the key was found, use it to get a translation, otherwise just use report name |
|
4974 | + if (!empty($key)) { |
|
4975 | + $title = $mod_strings[$key]; |
|
4976 | + } else { |
|
4977 | + $title = $reportName; |
|
4978 | + } |
|
4979 | 4979 | |
4980 | - return $title; |
|
4980 | + return $title; |
|
4981 | 4981 | } |
4982 | 4982 | |
4983 | 4983 | /** |
@@ -5085,47 +5085,47 @@ discard block |
||
5085 | 5085 | |
5086 | 5086 | function suite_strlen($input, $encoding = DEFAULT_UTIL_SUITE_ENCODING) |
5087 | 5087 | { |
5088 | - if(function_exists('mb_strlen')) |
|
5089 | - return mb_strlen($input,$encoding); |
|
5090 | - else |
|
5091 | - return strlen($input); |
|
5088 | + if(function_exists('mb_strlen')) |
|
5089 | + return mb_strlen($input,$encoding); |
|
5090 | + else |
|
5091 | + return strlen($input); |
|
5092 | 5092 | } |
5093 | 5093 | |
5094 | 5094 | function suite_substr($input, $start, $length = null,$encoding = DEFAULT_UTIL_SUITE_ENCODING) |
5095 | 5095 | { |
5096 | - if(function_exists('mb_substr')) |
|
5097 | - return mb_substr($input,$start,$length,$encoding); |
|
5098 | - else |
|
5099 | - return substr($input,$start,$length); |
|
5096 | + if(function_exists('mb_substr')) |
|
5097 | + return mb_substr($input,$start,$length,$encoding); |
|
5098 | + else |
|
5099 | + return substr($input,$start,$length); |
|
5100 | 5100 | } |
5101 | 5101 | |
5102 | 5102 | function suite_strtoupper($input,$encoding = DEFAULT_UTIL_SUITE_ENCODING) |
5103 | 5103 | { |
5104 | - if(function_exists('mb_strtoupper')) |
|
5105 | - return mb_strtoupper($input,$encoding); |
|
5106 | - else |
|
5107 | - return strtoupper($input); |
|
5104 | + if(function_exists('mb_strtoupper')) |
|
5105 | + return mb_strtoupper($input,$encoding); |
|
5106 | + else |
|
5107 | + return strtoupper($input); |
|
5108 | 5108 | } |
5109 | 5109 | function suite_strtolower($input,$encoding = DEFAULT_UTIL_SUITE_ENCODING) |
5110 | 5110 | { |
5111 | - if(function_exists('mb_strtolower')) |
|
5112 | - return mb_strtolower($input,$encoding); |
|
5113 | - else |
|
5114 | - return strtolower($input); |
|
5111 | + if(function_exists('mb_strtolower')) |
|
5112 | + return mb_strtolower($input,$encoding); |
|
5113 | + else |
|
5114 | + return strtolower($input); |
|
5115 | 5115 | } |
5116 | 5116 | |
5117 | 5117 | function suite_strpos($haystack,$needle,$offset=0,$encoding = DEFAULT_UTIL_SUITE_ENCODING) |
5118 | 5118 | { |
5119 | - if(function_exists('mb_strpos')) |
|
5120 | - return mb_strpos($haystack,$needle,$offset,$encoding); |
|
5121 | - else |
|
5122 | - return strpos($haystack,$needle,$offset); |
|
5119 | + if(function_exists('mb_strpos')) |
|
5120 | + return mb_strpos($haystack,$needle,$offset,$encoding); |
|
5121 | + else |
|
5122 | + return strpos($haystack,$needle,$offset); |
|
5123 | 5123 | } |
5124 | 5124 | |
5125 | 5125 | function suite_strrpos($haystack,$needle,$offset=0,$encoding = DEFAULT_UTIL_SUITE_ENCODING) |
5126 | 5126 | { |
5127 | - if(function_exists('mb_strrpos')) |
|
5128 | - return mb_strrpos($haystack,$needle,$offset,$encoding); |
|
5129 | - else |
|
5130 | - return strrpos($haystack,$needle,$offset); |
|
5127 | + if(function_exists('mb_strrpos')) |
|
5128 | + return mb_strrpos($haystack,$needle,$offset,$encoding); |
|
5129 | + else |
|
5130 | + return strrpos($haystack,$needle,$offset); |
|
5131 | 5131 | } |
5132 | 5132 | \ No newline at end of file |
@@ -45,13 +45,13 @@ discard block |
||
45 | 45 | define("NUM_COLS", 2); |
46 | 46 | class PopupSmarty extends ListViewSmarty{ |
47 | 47 | |
48 | - var $contextMenus = false; |
|
49 | - var $export = false; |
|
50 | - var $mailmerge = false; |
|
51 | - var $mergeduplicates = false; |
|
52 | - var $quickViewLinks = false; |
|
53 | - var $multiSelect = false; |
|
54 | - var $headerTpl; |
|
48 | + var $contextMenus = false; |
|
49 | + var $export = false; |
|
50 | + var $mailmerge = false; |
|
51 | + var $mergeduplicates = false; |
|
52 | + var $quickViewLinks = false; |
|
53 | + var $multiSelect = false; |
|
54 | + var $headerTpl; |
|
55 | 55 | var $footerTpl; |
56 | 56 | var $th; |
57 | 57 | var $tpl; |
@@ -70,19 +70,19 @@ discard block |
||
70 | 70 | var $module; |
71 | 71 | var $massUpdateData = ''; |
72 | 72 | |
73 | - function PopupSmarty($seed, $module){ |
|
74 | - parent::ListViewSmarty(); |
|
75 | - $this->th = new TemplateHandler(); |
|
76 | - $this->th->loadSmarty(); |
|
77 | - $this->seed = $seed; |
|
78 | - $this->view = 'Popup'; |
|
79 | - $this->module = $module; |
|
80 | - $this->searchForm = new SearchForm($this->seed, $this->module); |
|
81 | - $this->th->deleteTemplate($module, $this->view); |
|
73 | + function PopupSmarty($seed, $module){ |
|
74 | + parent::ListViewSmarty(); |
|
75 | + $this->th = new TemplateHandler(); |
|
76 | + $this->th->loadSmarty(); |
|
77 | + $this->seed = $seed; |
|
78 | + $this->view = 'Popup'; |
|
79 | + $this->module = $module; |
|
80 | + $this->searchForm = new SearchForm($this->seed, $this->module); |
|
81 | + $this->th->deleteTemplate($module, $this->view); |
|
82 | 82 | $this->headerTpl = 'include/Popups/tpls/header.tpl'; |
83 | 83 | $this->footerTpl = 'include/Popups/tpls/footer.tpl'; |
84 | 84 | |
85 | - } |
|
85 | + } |
|
86 | 86 | |
87 | 87 | /** |
88 | 88 | * Assign several arrow image attributes to TemplateHandler smarty. Such as width, height, etc. |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | $this->th->ss->assign('arrowAlt', translate('LBL_SORT')); |
102 | 102 | } |
103 | 103 | |
104 | - /** |
|
104 | + /** |
|
105 | 105 | * Processes the request. Calls ListViewData process. Also assigns all lang strings, export links, |
106 | 106 | * This is called from ListViewDisplay |
107 | 107 | * |
@@ -110,13 +110,13 @@ discard block |
||
110 | 110 | * @param html_var string the corresponding html var in xtpl per row |
111 | 111 | * |
112 | 112 | */ |
113 | - function process($file, $data, $htmlVar) { |
|
113 | + function process($file, $data, $htmlVar) { |
|
114 | 114 | |
115 | - global $odd_bg, $even_bg, $hilite_bg, $click_bg, $app_strings; |
|
116 | - parent::process($file, $data, $htmlVar); |
|
115 | + global $odd_bg, $even_bg, $hilite_bg, $click_bg, $app_strings; |
|
116 | + parent::process($file, $data, $htmlVar); |
|
117 | 117 | |
118 | - $this->tpl = $file; |
|
119 | - $this->data = $data; |
|
118 | + $this->tpl = $file; |
|
119 | + $this->data = $data; |
|
120 | 120 | |
121 | 121 | $totalWidth = 0; |
122 | 122 | foreach($this->displayColumns as $name => $params) { |
@@ -131,47 +131,47 @@ discard block |
||
131 | 131 | if(!empty($params['contextMenu']['objectType'])) |
132 | 132 | $contextMenuObjectsTypes[$params['contextMenu']['objectType']] = true; |
133 | 133 | } |
134 | - $this->th->ss->assign('displayColumns', $this->displayColumns); |
|
134 | + $this->th->ss->assign('displayColumns', $this->displayColumns); |
|
135 | 135 | |
136 | 136 | |
137 | - $this->th->ss->assign('bgHilite', $hilite_bg); |
|
138 | - $this->th->ss->assign('colCount', count($this->displayColumns) + 1); |
|
139 | - $this->th->ss->assign('htmlVar', strtoupper($htmlVar)); |
|
140 | - $this->th->ss->assign('moduleString', $this->moduleString); |
|
137 | + $this->th->ss->assign('bgHilite', $hilite_bg); |
|
138 | + $this->th->ss->assign('colCount', count($this->displayColumns) + 1); |
|
139 | + $this->th->ss->assign('htmlVar', strtoupper($htmlVar)); |
|
140 | + $this->th->ss->assign('moduleString', $this->moduleString); |
|
141 | 141 | $this->th->ss->assign('editLinkString', $GLOBALS['app_strings']['LBL_EDIT_BUTTON']); |
142 | 142 | $this->th->ss->assign('viewLinkString', $GLOBALS['app_strings']['LBL_VIEW_BUTTON']); |
143 | 143 | |
144 | 144 | //rrs |
145 | 145 | $this->searchForm->parsedView = 'popup_query_form'; |
146 | 146 | $this->searchForm->displayType = 'popupView'; |
147 | - $this->th->ss->assign('searchForm', $this->searchForm->display(false)); |
|
147 | + $this->th->ss->assign('searchForm', $this->searchForm->display(false)); |
|
148 | 148 | //rrs |
149 | 149 | |
150 | - if($this->export) $this->th->ss->assign('exportLink', $this->buildExportLink()); |
|
151 | - $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()); |
|
150 | + if($this->export) $this->th->ss->assign('exportLink', $this->buildExportLink()); |
|
151 | + $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()); |
|
154 | 154 | |
155 | 155 | |
156 | - if (!empty($_REQUEST['mode']) && strtoupper($_REQUEST['mode']) == 'MULTISELECT') { |
|
157 | - $this->multiSelect = true; |
|
158 | - } |
|
159 | - // handle save checks and stuff |
|
160 | - if($this->multiSelect) { |
|
161 | - $this->th->ss->assign('selectedObjectsSpan', $this->buildSelectedObjectsSpan()); |
|
162 | - $this->th->ss->assign('multiSelectData', $this->getMultiSelectData()); |
|
163 | - $this->th->ss->assign('MODE', "<input type='hidden' name='mode' value='MultiSelect'>"); |
|
156 | + if (!empty($_REQUEST['mode']) && strtoupper($_REQUEST['mode']) == 'MULTISELECT') { |
|
157 | + $this->multiSelect = true; |
|
158 | + } |
|
159 | + // handle save checks and stuff |
|
160 | + if($this->multiSelect) { |
|
161 | + $this->th->ss->assign('selectedObjectsSpan', $this->buildSelectedObjectsSpan()); |
|
162 | + $this->th->ss->assign('multiSelectData', $this->getMultiSelectData()); |
|
163 | + $this->th->ss->assign('MODE', "<input type='hidden' name='mode' value='MultiSelect'>"); |
|
164 | 164 | $pageTotal = $this->data['pageData']['offsets']['next'] - $this->data['pageData']['offsets']['current']; |
165 | 165 | if($this->data['pageData']['offsets']['next'] < 0){ // If we are on the last page, 'next' is -1, which means we have to have a custom calculation |
166 | 166 | $pageTotal = $this->data['pageData']['offsets']['total'] - $this->data['pageData']['offsets']['current']; |
167 | 167 | } |
168 | - $this->th->ss->assign('selectLink', $this->buildSelectLink('select_link', $this->data['pageData']['offsets']['total'], $pageTotal)); |
|
169 | - } |
|
168 | + $this->th->ss->assign('selectLink', $this->buildSelectLink('select_link', $this->data['pageData']['offsets']['total'], $pageTotal)); |
|
169 | + } |
|
170 | 170 | |
171 | - $this->processArrows($data['pageData']['ordering']); |
|
172 | - $this->th->ss->assign('prerow', $this->multiSelect); |
|
173 | - $this->th->ss->assign('rowColor', array('oddListRow', 'evenListRow')); |
|
174 | - $this->th->ss->assign('bgColor', array($odd_bg, $even_bg)); |
|
171 | + $this->processArrows($data['pageData']['ordering']); |
|
172 | + $this->th->ss->assign('prerow', $this->multiSelect); |
|
173 | + $this->th->ss->assign('rowColor', array('oddListRow', 'evenListRow')); |
|
174 | + $this->th->ss->assign('bgColor', array($odd_bg, $even_bg)); |
|
175 | 175 | $this->th->ss->assign('contextMenus', $this->contextMenus); |
176 | 176 | |
177 | 177 | |
@@ -191,12 +191,12 @@ discard block |
||
191 | 191 | |
192 | 192 | // arrow image attributes |
193 | 193 | $this->processArrowVars(); |
194 | - } |
|
194 | + } |
|
195 | 195 | |
196 | - /* |
|
196 | + /* |
|
197 | 197 | * Display the Smarty template. Here we are using the TemplateHandler for caching per the module. |
198 | 198 | */ |
199 | - function display($end = true) { |
|
199 | + function display($end = true) { |
|
200 | 200 | global $app_strings; |
201 | 201 | |
202 | 202 | if(!is_file(sugar_cached("jsLanguage/{$GLOBALS['current_language']}.js"))) { |
@@ -206,8 +206,8 @@ discard block |
||
206 | 206 | $jsLang = getVersionedScript("cache/jsLanguage/{$GLOBALS['current_language']}.js", $GLOBALS['sugar_config']['js_lang_version']); |
207 | 207 | |
208 | 208 | $this->th->ss->assign('data', $this->data['data']); |
209 | - $this->data['pageData']['offsets']['lastOffsetOnPage'] = $this->data['pageData']['offsets']['current'] + count($this->data['data']); |
|
210 | - $this->th->ss->assign('pageData', $this->data['pageData']); |
|
209 | + $this->data['pageData']['offsets']['lastOffsetOnPage'] = $this->data['pageData']['offsets']['current'] + count($this->data['data']); |
|
210 | + $this->th->ss->assign('pageData', $this->data['pageData']); |
|
211 | 211 | |
212 | 212 | $navStrings = array('next' => $GLOBALS['app_strings']['LNK_LIST_NEXT'], |
213 | 213 | 'previous' => $GLOBALS['app_strings']['LNK_LIST_PREVIOUS'], |
@@ -217,128 +217,128 @@ discard block |
||
217 | 217 | $this->th->ss->assign('navStrings', $navStrings); |
218 | 218 | |
219 | 219 | |
220 | - $associated_row_data = array(); |
|
220 | + $associated_row_data = array(); |
|
221 | 221 | |
222 | - //C.L. - Bug 44324 - Override the NAME entry to not display salutation so that the data returned from the popup can be searched on correctly |
|
223 | - $searchNameOverride = !empty($this->seed) && $this->seed instanceof Person && (isset($this->data['data'][0]['FIRST_NAME']) && isset($this->data['data'][0]['LAST_NAME'])) ? true : false; |
|
222 | + //C.L. - Bug 44324 - Override the NAME entry to not display salutation so that the data returned from the popup can be searched on correctly |
|
223 | + $searchNameOverride = !empty($this->seed) && $this->seed instanceof Person && (isset($this->data['data'][0]['FIRST_NAME']) && isset($this->data['data'][0]['LAST_NAME'])) ? true : false; |
|
224 | 224 | |
225 | - global $locale; |
|
226 | - foreach($this->data['data'] as $val) |
|
227 | - { |
|
228 | - $associated_row_data[$val['ID']] = $val; |
|
229 | - if($searchNameOverride) |
|
230 | - { |
|
231 | - $associated_row_data[$val['ID']]['NAME'] = $locale->getLocaleFormattedName($val['FIRST_NAME'], $val['LAST_NAME']); |
|
232 | - } |
|
233 | - } |
|
234 | - $is_show_fullname = showFullName() ? 1 : 0; |
|
235 | - $json = getJSONobj(); |
|
236 | - $this->th->ss->assign('jsLang', $jsLang); |
|
237 | - $this->th->ss->assign('lang', substr($GLOBALS['current_language'], 0, 2)); |
|
225 | + global $locale; |
|
226 | + foreach($this->data['data'] as $val) |
|
227 | + { |
|
228 | + $associated_row_data[$val['ID']] = $val; |
|
229 | + if($searchNameOverride) |
|
230 | + { |
|
231 | + $associated_row_data[$val['ID']]['NAME'] = $locale->getLocaleFormattedName($val['FIRST_NAME'], $val['LAST_NAME']); |
|
232 | + } |
|
233 | + } |
|
234 | + $is_show_fullname = showFullName() ? 1 : 0; |
|
235 | + $json = getJSONobj(); |
|
236 | + $this->th->ss->assign('jsLang', $jsLang); |
|
237 | + $this->th->ss->assign('lang', substr($GLOBALS['current_language'], 0, 2)); |
|
238 | 238 | $this->th->ss->assign('headerTpl', $this->headerTpl); |
239 | 239 | $this->th->ss->assign('footerTpl', $this->footerTpl); |
240 | 240 | $this->th->ss->assign('ASSOCIATED_JAVASCRIPT_DATA', 'var associated_javascript_data = '.$json->encode($associated_row_data). '; var is_show_fullname = '.$is_show_fullname.';'); |
241 | - $this->th->ss->assign('module', $this->seed->module_dir); |
|
242 | - $request_data = empty($_REQUEST['request_data']) ? '' : $_REQUEST['request_data']; |
|
243 | - |
|
244 | - $this->th->ss->assign('request_data', $request_data); |
|
245 | - $this->th->ss->assign('fields', $this->fieldDefs); |
|
246 | - $this->th->ss->assign('formData', $this->formData); |
|
247 | - $this->th->ss->assign('APP', $GLOBALS['app_strings']); |
|
248 | - $this->th->ss->assign('MOD', $GLOBALS['mod_strings']); |
|
241 | + $this->th->ss->assign('module', $this->seed->module_dir); |
|
242 | + $request_data = empty($_REQUEST['request_data']) ? '' : $_REQUEST['request_data']; |
|
243 | + |
|
244 | + $this->th->ss->assign('request_data', $request_data); |
|
245 | + $this->th->ss->assign('fields', $this->fieldDefs); |
|
246 | + $this->th->ss->assign('formData', $this->formData); |
|
247 | + $this->th->ss->assign('APP', $GLOBALS['app_strings']); |
|
248 | + $this->th->ss->assign('MOD', $GLOBALS['mod_strings']); |
|
249 | 249 | if (isset($this->_popupMeta['create']['createButton'])) |
250 | - { |
|
251 | - $this->_popupMeta['create']['createButton'] = translate($this->_popupMeta['create']['createButton']); |
|
250 | + { |
|
251 | + $this->_popupMeta['create']['createButton'] = translate($this->_popupMeta['create']['createButton']); |
|
252 | 252 | } |
253 | - $this->th->ss->assign('popupMeta', $this->_popupMeta); |
|
253 | + $this->th->ss->assign('popupMeta', $this->_popupMeta); |
|
254 | 254 | $this->th->ss->assign('current_query', base64_encode(serialize($_REQUEST))); |
255 | - $this->th->ss->assign('customFields', $this->customFieldDefs); |
|
256 | - $this->th->ss->assign('numCols', NUM_COLS); |
|
257 | - $this->th->ss->assign('massUpdateData', $this->massUpdateData); |
|
258 | - $this->th->ss->assign('sugarVersion', $GLOBALS['sugar_version']); |
|
255 | + $this->th->ss->assign('customFields', $this->customFieldDefs); |
|
256 | + $this->th->ss->assign('numCols', NUM_COLS); |
|
257 | + $this->th->ss->assign('massUpdateData', $this->massUpdateData); |
|
258 | + $this->th->ss->assign('sugarVersion', $GLOBALS['sugar_version']); |
|
259 | 259 | $this->th->ss->assign('should_process', $this->should_process); |
260 | 260 | |
261 | - if($this->_create){ |
|
262 | - $this->th->ss->assign('ADDFORM', $this->getQuickCreate());//$this->_getAddForm()); |
|
263 | - $this->th->ss->assign('ADDFORMHEADER', $this->_getAddFormHeader()); |
|
264 | - $this->th->ss->assign('object_name', $this->seed->object_name); |
|
265 | - } |
|
266 | - $this->th->ss->assign('LIST_HEADER', get_form_header($GLOBALS['mod_strings']['LBL_LIST_FORM_TITLE'], '', false)); |
|
267 | - $this->th->ss->assign('SEARCH_FORM_HEADER', get_form_header($GLOBALS['mod_strings']['LBL_SEARCH_FORM_TITLE'], '', false)); |
|
268 | - $str = $this->th->displayTemplate($this->seed->module_dir, $this->view, $this->tpl); |
|
269 | - return $str; |
|
270 | - } |
|
271 | - |
|
272 | - /* |
|
261 | + if($this->_create){ |
|
262 | + $this->th->ss->assign('ADDFORM', $this->getQuickCreate());//$this->_getAddForm()); |
|
263 | + $this->th->ss->assign('ADDFORMHEADER', $this->_getAddFormHeader()); |
|
264 | + $this->th->ss->assign('object_name', $this->seed->object_name); |
|
265 | + } |
|
266 | + $this->th->ss->assign('LIST_HEADER', get_form_header($GLOBALS['mod_strings']['LBL_LIST_FORM_TITLE'], '', false)); |
|
267 | + $this->th->ss->assign('SEARCH_FORM_HEADER', get_form_header($GLOBALS['mod_strings']['LBL_SEARCH_FORM_TITLE'], '', false)); |
|
268 | + $str = $this->th->displayTemplate($this->seed->module_dir, $this->view, $this->tpl); |
|
269 | + return $str; |
|
270 | + } |
|
271 | + |
|
272 | + /* |
|
273 | 273 | * Setup up the smarty template. we added an extra step here to add the order by from the popupdefs. |
274 | 274 | */ |
275 | - function setup($seed, $file = null, $where = null, $params = Array(), $offset = 0, $limit = -1, $filter_fields = Array(), $id_field = 'id') { |
|
276 | - $args = func_get_args(); |
|
277 | - return call_user_func_array(array($this, '_setup'), $args); |
|
278 | - } |
|
279 | - function _setup($file) { |
|
280 | - |
|
281 | - if(isset($this->_popupMeta)){ |
|
282 | - if(isset($this->_popupMeta['create']['formBase'])) { |
|
283 | - require_once('modules/' . $this->seed->module_dir . '/' . $this->_popupMeta['create']['formBase']); |
|
284 | - $this->_create = true; |
|
285 | - } |
|
286 | - } |
|
287 | - if(!empty($this->_popupMeta['create'])){ |
|
288 | - $formBase = new $this->_popupMeta['create']['formBaseClass'](); |
|
289 | - if(isset($_REQUEST['doAction']) && $_REQUEST['doAction'] == 'save') |
|
290 | - { |
|
291 | - //If it's a new record, set useRequired to false |
|
292 | - $useRequired = empty($_REQUEST['id']) ? false : true; |
|
293 | - $formBase->handleSave('', false, $useRequired); |
|
294 | - } |
|
295 | - } |
|
296 | - |
|
297 | - $params = array(); |
|
298 | - if(!empty($this->_popupMeta['orderBy'])){ |
|
299 | - $params['orderBy'] = $this->_popupMeta['orderBy']; |
|
300 | - } |
|
301 | - |
|
302 | - if(file_exists('custom/modules/'.$this->module.'/metadata/metafiles.php')){ |
|
303 | - require('custom/modules/'.$this->module.'/metadata/metafiles.php'); |
|
304 | - }elseif(file_exists('modules/'.$this->module.'/metadata/metafiles.php')){ |
|
305 | - require('modules/'.$this->module.'/metadata/metafiles.php'); |
|
306 | - } |
|
307 | - |
|
308 | - if(!empty($metafiles[$this->module]['searchfields'])) { |
|
309 | - require($metafiles[$this->module]['searchfields']); |
|
310 | - } elseif(file_exists('modules/'.$this->module.'/metadata/SearchFields.php')) { |
|
311 | - require('modules/'.$this->module.'/metadata/SearchFields.php'); |
|
312 | - } |
|
275 | + function setup($seed, $file = null, $where = null, $params = Array(), $offset = 0, $limit = -1, $filter_fields = Array(), $id_field = 'id') { |
|
276 | + $args = func_get_args(); |
|
277 | + return call_user_func_array(array($this, '_setup'), $args); |
|
278 | + } |
|
279 | + function _setup($file) { |
|
280 | + |
|
281 | + if(isset($this->_popupMeta)){ |
|
282 | + if(isset($this->_popupMeta['create']['formBase'])) { |
|
283 | + require_once('modules/' . $this->seed->module_dir . '/' . $this->_popupMeta['create']['formBase']); |
|
284 | + $this->_create = true; |
|
285 | + } |
|
286 | + } |
|
287 | + if(!empty($this->_popupMeta['create'])){ |
|
288 | + $formBase = new $this->_popupMeta['create']['formBaseClass'](); |
|
289 | + if(isset($_REQUEST['doAction']) && $_REQUEST['doAction'] == 'save') |
|
290 | + { |
|
291 | + //If it's a new record, set useRequired to false |
|
292 | + $useRequired = empty($_REQUEST['id']) ? false : true; |
|
293 | + $formBase->handleSave('', false, $useRequired); |
|
294 | + } |
|
295 | + } |
|
296 | + |
|
297 | + $params = array(); |
|
298 | + if(!empty($this->_popupMeta['orderBy'])){ |
|
299 | + $params['orderBy'] = $this->_popupMeta['orderBy']; |
|
300 | + } |
|
301 | + |
|
302 | + if(file_exists('custom/modules/'.$this->module.'/metadata/metafiles.php')){ |
|
303 | + require('custom/modules/'.$this->module.'/metadata/metafiles.php'); |
|
304 | + }elseif(file_exists('modules/'.$this->module.'/metadata/metafiles.php')){ |
|
305 | + require('modules/'.$this->module.'/metadata/metafiles.php'); |
|
306 | + } |
|
307 | + |
|
308 | + if(!empty($metafiles[$this->module]['searchfields'])) { |
|
309 | + require($metafiles[$this->module]['searchfields']); |
|
310 | + } elseif(file_exists('modules/'.$this->module.'/metadata/SearchFields.php')) { |
|
311 | + require('modules/'.$this->module.'/metadata/SearchFields.php'); |
|
312 | + } |
|
313 | 313 | $this->searchdefs[$this->module]['templateMeta']['maxColumns'] = 2; |
314 | 314 | $this->searchdefs[$this->module]['templateMeta']['widths']['label'] = 10; |
315 | 315 | $this->searchdefs[$this->module]['templateMeta']['widths']['field'] = 30; |
316 | 316 | |
317 | 317 | $this->searchForm->view = 'PopupSearchForm'; |
318 | - $this->searchForm->setup($this->searchdefs, $searchFields, 'SearchFormGenericAdvanced.tpl', 'advanced_search', $this->listviewdefs); |
|
319 | - |
|
320 | - $lv = new ListViewSmarty(); |
|
321 | - $displayColumns = array(); |
|
322 | - if(!empty($_REQUEST['displayColumns'])) { |
|
323 | - foreach(explode('|', $_REQUEST['displayColumns']) as $num => $col) { |
|
324 | - if(!empty($listViewDefs[$this->module][$col])) |
|
325 | - $displayColumns[$col] = $this->listviewdefs[$this->module][$col]; |
|
326 | - } |
|
327 | - } |
|
328 | - else { |
|
329 | - foreach($this->listviewdefs[$this->module] as $col => $para) { |
|
330 | - if(!empty($para['default']) && $para['default']) |
|
331 | - $displayColumns[$col] = $para; |
|
332 | - } |
|
333 | - } |
|
334 | - $params['massupdate'] = true; |
|
335 | - if(!empty($_REQUEST['orderBy'])) { |
|
336 | - $params['orderBy'] = $_REQUEST['orderBy']; |
|
337 | - $params['overrideOrder'] = true; |
|
338 | - if(!empty($_REQUEST['sortOrder'])) $params['sortOrder'] = $_REQUEST['sortOrder']; |
|
339 | - } |
|
340 | - |
|
341 | - $lv->displayColumns = $displayColumns; |
|
318 | + $this->searchForm->setup($this->searchdefs, $searchFields, 'SearchFormGenericAdvanced.tpl', 'advanced_search', $this->listviewdefs); |
|
319 | + |
|
320 | + $lv = new ListViewSmarty(); |
|
321 | + $displayColumns = array(); |
|
322 | + if(!empty($_REQUEST['displayColumns'])) { |
|
323 | + foreach(explode('|', $_REQUEST['displayColumns']) as $num => $col) { |
|
324 | + if(!empty($listViewDefs[$this->module][$col])) |
|
325 | + $displayColumns[$col] = $this->listviewdefs[$this->module][$col]; |
|
326 | + } |
|
327 | + } |
|
328 | + else { |
|
329 | + foreach($this->listviewdefs[$this->module] as $col => $para) { |
|
330 | + if(!empty($para['default']) && $para['default']) |
|
331 | + $displayColumns[$col] = $para; |
|
332 | + } |
|
333 | + } |
|
334 | + $params['massupdate'] = true; |
|
335 | + if(!empty($_REQUEST['orderBy'])) { |
|
336 | + $params['orderBy'] = $_REQUEST['orderBy']; |
|
337 | + $params['overrideOrder'] = true; |
|
338 | + if(!empty($_REQUEST['sortOrder'])) $params['sortOrder'] = $_REQUEST['sortOrder']; |
|
339 | + } |
|
340 | + |
|
341 | + $lv->displayColumns = $displayColumns; |
|
342 | 342 | $this->searchForm->lv = $lv; |
343 | 343 | $this->searchForm->displaySavedSearch = false; |
344 | 344 | |
@@ -351,25 +351,25 @@ discard block |
||
351 | 351 | $this->should_process = true; |
352 | 352 | |
353 | 353 | if(isset($params['export'])) { |
354 | - $this->export = $params['export']; |
|
354 | + $this->export = $params['export']; |
|
355 | 355 | } |
356 | 356 | if(!empty($params['multiSelectPopup'])) { |
357 | - $this->multi_select_popup = $params['multiSelectPopup']; |
|
357 | + $this->multi_select_popup = $params['multiSelectPopup']; |
|
358 | 358 | } |
359 | - if(!empty($params['massupdate']) && $params['massupdate'] != false) { |
|
360 | - $this->show_mass_update_form = true; |
|
361 | - $this->mass = new MassUpdate(); |
|
362 | - $this->mass->setSugarBean($this->seed); |
|
363 | - if(!empty($params['handleMassupdate']) || !isset($params['handleMassupdate'])) { |
|
359 | + if(!empty($params['massupdate']) && $params['massupdate'] != false) { |
|
360 | + $this->show_mass_update_form = true; |
|
361 | + $this->mass = new MassUpdate(); |
|
362 | + $this->mass->setSugarBean($this->seed); |
|
363 | + if(!empty($params['handleMassupdate']) || !isset($params['handleMassupdate'])) { |
|
364 | 364 | $this->mass->handleMassUpdate(); |
365 | 365 | } |
366 | - } |
|
366 | + } |
|
367 | 367 | |
368 | 368 | // create filter fields based off of display columns |
369 | 369 | if(empty($this->filter_fields) || $this->mergeDisplayColumns) { |
370 | 370 | foreach($this->displayColumns as $columnName => $def) { |
371 | - $this->filter_fields[strtolower($columnName)] = true; |
|
372 | - if(!empty($def['related_fields'])) { |
|
371 | + $this->filter_fields[strtolower($columnName)] = true; |
|
372 | + if(!empty($def['related_fields'])) { |
|
373 | 373 | foreach($def['related_fields'] as $field) { |
374 | 374 | //id column is added by query construction function. This addition creates duplicates |
375 | 375 | //and causes issues in oracle. #10165 |
@@ -379,12 +379,12 @@ discard block |
||
379 | 379 | } |
380 | 380 | } |
381 | 381 | if (!empty($this->seed->field_defs[strtolower($columnName)]['db_concat_fields'])) { |
382 | - foreach($this->seed->field_defs[strtolower($columnName)]['db_concat_fields'] as $index=>$field){ |
|
383 | - if(!isset($this->filter_fields[strtolower($field)]) || !$this->filter_fields[strtolower($field)]) |
|
384 | - { |
|
385 | - $this->filter_fields[strtolower($field)] = true; |
|
386 | - } |
|
387 | - } |
|
382 | + foreach($this->seed->field_defs[strtolower($columnName)]['db_concat_fields'] as $index=>$field){ |
|
383 | + if(!isset($this->filter_fields[strtolower($field)]) || !$this->filter_fields[strtolower($field)]) |
|
384 | + { |
|
385 | + $this->filter_fields[strtolower($field)] = true; |
|
386 | + } |
|
387 | + } |
|
388 | 388 | } |
389 | 389 | } |
390 | 390 | foreach ($this->searchColumns as $columnName => $def ) |
@@ -418,119 +418,119 @@ discard block |
||
418 | 418 | } |
419 | 419 | |
420 | 420 | |
421 | - if (!empty($_REQUEST['query']) || (!empty($GLOBALS['sugar_config']['save_query']) && $GLOBALS['sugar_config']['save_query'] != 'populate_only')) { |
|
422 | - $data = $this->lvd->getListViewData($this->seed, $searchWhere, 0, -1, $this->filter_fields, $params, 'id'); |
|
423 | - } else { |
|
424 | - $this->should_process = false; |
|
425 | - $data = array( |
|
426 | - 'data'=>array(), |
|
427 | - 'pageData'=>array( |
|
428 | - 'bean'=>array('moduleDir'=>$this->seed->module_dir), |
|
429 | - 'ordering'=>'', |
|
430 | - 'offsets'=>array('total'=>0,'next'=>0,'current'=>0), |
|
431 | - ), |
|
432 | - ); |
|
433 | - } |
|
421 | + if (!empty($_REQUEST['query']) || (!empty($GLOBALS['sugar_config']['save_query']) && $GLOBALS['sugar_config']['save_query'] != 'populate_only')) { |
|
422 | + $data = $this->lvd->getListViewData($this->seed, $searchWhere, 0, -1, $this->filter_fields, $params, 'id'); |
|
423 | + } else { |
|
424 | + $this->should_process = false; |
|
425 | + $data = array( |
|
426 | + 'data'=>array(), |
|
427 | + 'pageData'=>array( |
|
428 | + 'bean'=>array('moduleDir'=>$this->seed->module_dir), |
|
429 | + 'ordering'=>'', |
|
430 | + 'offsets'=>array('total'=>0,'next'=>0,'current'=>0), |
|
431 | + ), |
|
432 | + ); |
|
433 | + } |
|
434 | 434 | |
435 | 435 | $this->fillDisplayColumnsWithVardefs(); |
436 | 436 | |
437 | - $this->process($file, $data, $this->seed->object_name); |
|
438 | - } |
|
437 | + $this->process($file, $data, $this->seed->object_name); |
|
438 | + } |
|
439 | 439 | |
440 | - /* |
|
440 | + /* |
|
441 | 441 | * Return the where clause as per the REQUEST. |
442 | 442 | */ |
443 | - function _get_where_clause() |
|
444 | - { |
|
445 | - $where = ''; |
|
446 | - $where_clauses = $this->searchForm->generateSearchWhere(true, $this->seed->module_dir); |
|
447 | - |
|
448 | - // Bug 43452 - FG - Changed the way generated Where array is imploded into the string. |
|
449 | - // Now it's imploding in the same way view.list.php do. |
|
450 | - if (count($where_clauses) > 0 ) { |
|
451 | - $where = '( ' . implode(' and ', $where_clauses) . ' )'; |
|
443 | + function _get_where_clause() |
|
444 | + { |
|
445 | + $where = ''; |
|
446 | + $where_clauses = $this->searchForm->generateSearchWhere(true, $this->seed->module_dir); |
|
447 | + |
|
448 | + // Bug 43452 - FG - Changed the way generated Where array is imploded into the string. |
|
449 | + // Now it's imploding in the same way view.list.php do. |
|
450 | + if (count($where_clauses) > 0 ) { |
|
451 | + $where = '( ' . implode(' and ', $where_clauses) . ' )'; |
|
452 | 452 | } |
453 | 453 | |
454 | 454 | // Need to include the default whereStatement |
455 | - if(!empty($this->_popupMeta['whereStatement'])){ |
|
455 | + if(!empty($this->_popupMeta['whereStatement'])){ |
|
456 | 456 | if(!empty($where))$where .= ' AND '; |
457 | 457 | $where .= $this->_popupMeta['whereStatement']; |
458 | - } |
|
458 | + } |
|
459 | 459 | |
460 | - return $where; |
|
461 | - } |
|
460 | + return $where; |
|
461 | + } |
|
462 | 462 | |
463 | - /* |
|
463 | + /* |
|
464 | 464 | * Generate the data for the search form on the header of the Popup. |
465 | 465 | */ |
466 | - function _build_field_defs(){ |
|
467 | - $this->formData = array(); |
|
468 | - $this->customFieldDefs = array(); |
|
469 | - foreach($this->searchdefs[$this->module]['layout']['advanced_search'] as $data){ |
|
470 | - if(is_array($data)){ |
|
471 | - |
|
472 | - $this->formData[] = array('field' => $data); |
|
473 | - $value = ''; |
|
474 | - $this->customFieldDefs[$data['name']]= $data; |
|
475 | - if(!empty($_REQUEST[$data['name']])) |
|
476 | - $value = $_REQUEST[$data['name']]; |
|
477 | - $this->customFieldDefs[$data['name']]['value'] = $value; |
|
478 | - }else |
|
479 | - $this->formData[] = array('field' => array('name'=>$data)); |
|
480 | - } |
|
481 | - $this->fieldDefs = array(); |
|
482 | - if($this->seed){ |
|
483 | - $this->seed->fill_in_additional_detail_fields(); |
|
484 | - |
|
485 | - foreach($this->seed->toArray() as $name => $value) { |
|
486 | - $this->fieldDefs[$name] = $this->seed->field_defs[$name]; |
|
487 | - //if we have a relate type then reset to name so that we end up with a textbox |
|
488 | - //rather than a select button |
|
489 | - $this->fieldDefs[$name]['name'] = $this->fieldDefs[$name]['name']; |
|
490 | - if($this->fieldDefs[$name]['type'] == 'relate') |
|
491 | - $this->fieldDefs[$name]['type'] = 'name'; |
|
492 | - if(isset($this->fieldDefs[$name]['options']) && isset($GLOBALS['app_list_strings'][$this->fieldDefs[$name]['options']])) { |
|
493 | - $this->fieldDefs[$name]['options'] = $GLOBALS['app_list_strings'][$this->fieldDefs[$name]['options']]; // fill in enums |
|
494 | - } |
|
495 | - if(!empty($_REQUEST[$name])) |
|
496 | - $value = $_REQUEST[$name]; |
|
497 | - $this->fieldDefs[$name]['value'] = $value; |
|
498 | - } |
|
499 | - } |
|
500 | - } |
|
501 | - |
|
502 | - function _getAddForm(){ |
|
503 | - $addform = ''; |
|
466 | + function _build_field_defs(){ |
|
467 | + $this->formData = array(); |
|
468 | + $this->customFieldDefs = array(); |
|
469 | + foreach($this->searchdefs[$this->module]['layout']['advanced_search'] as $data){ |
|
470 | + if(is_array($data)){ |
|
471 | + |
|
472 | + $this->formData[] = array('field' => $data); |
|
473 | + $value = ''; |
|
474 | + $this->customFieldDefs[$data['name']]= $data; |
|
475 | + if(!empty($_REQUEST[$data['name']])) |
|
476 | + $value = $_REQUEST[$data['name']]; |
|
477 | + $this->customFieldDefs[$data['name']]['value'] = $value; |
|
478 | + }else |
|
479 | + $this->formData[] = array('field' => array('name'=>$data)); |
|
480 | + } |
|
481 | + $this->fieldDefs = array(); |
|
482 | + if($this->seed){ |
|
483 | + $this->seed->fill_in_additional_detail_fields(); |
|
484 | + |
|
485 | + foreach($this->seed->toArray() as $name => $value) { |
|
486 | + $this->fieldDefs[$name] = $this->seed->field_defs[$name]; |
|
487 | + //if we have a relate type then reset to name so that we end up with a textbox |
|
488 | + //rather than a select button |
|
489 | + $this->fieldDefs[$name]['name'] = $this->fieldDefs[$name]['name']; |
|
490 | + if($this->fieldDefs[$name]['type'] == 'relate') |
|
491 | + $this->fieldDefs[$name]['type'] = 'name'; |
|
492 | + if(isset($this->fieldDefs[$name]['options']) && isset($GLOBALS['app_list_strings'][$this->fieldDefs[$name]['options']])) { |
|
493 | + $this->fieldDefs[$name]['options'] = $GLOBALS['app_list_strings'][$this->fieldDefs[$name]['options']]; // fill in enums |
|
494 | + } |
|
495 | + if(!empty($_REQUEST[$name])) |
|
496 | + $value = $_REQUEST[$name]; |
|
497 | + $this->fieldDefs[$name]['value'] = $value; |
|
498 | + } |
|
499 | + } |
|
500 | + } |
|
501 | + |
|
502 | + function _getAddForm(){ |
|
503 | + $addform = ''; |
|
504 | 504 | if(!$this->seed->ACLAccess('save')){ |
505 | 505 | return; |
506 | 506 | } |
507 | - if(!empty($this->_popupMeta['create'])){ |
|
508 | - $formBase = new $this->_popupMeta['create']['formBaseClass'](); |
|
507 | + if(!empty($this->_popupMeta['create'])){ |
|
508 | + $formBase = new $this->_popupMeta['create']['formBaseClass'](); |
|
509 | 509 | |
510 | 510 | |
511 | 511 | |
512 | - // TODO: cleanup the construction of $addform |
|
513 | - $prefix = empty($this->_popupMeta['create']['getFormBodyParams'][0]) ? '' : $this->_popupMeta['create']['getFormBodyParams'][0]; |
|
514 | - $mod = empty($this->_popupMeta['create']['getFormBodyParams'][1]) ? '' : $this->_popupMeta['create']['getFormBodyParams'][1]; |
|
515 | - $formBody = empty($this->_popupMeta['create']['getFormBodyParams'][2]) ? '' : $this->_popupMeta['create']['getFormBodyParams'][2]; |
|
512 | + // TODO: cleanup the construction of $addform |
|
513 | + $prefix = empty($this->_popupMeta['create']['getFormBodyParams'][0]) ? '' : $this->_popupMeta['create']['getFormBodyParams'][0]; |
|
514 | + $mod = empty($this->_popupMeta['create']['getFormBodyParams'][1]) ? '' : $this->_popupMeta['create']['getFormBodyParams'][1]; |
|
515 | + $formBody = empty($this->_popupMeta['create']['getFormBodyParams'][2]) ? '' : $this->_popupMeta['create']['getFormBodyParams'][2]; |
|
516 | 516 | |
517 | - $getFormMethod = (empty($this->_popupMeta['create']['getFormMethod']) ? 'getFormBody' : $this->_popupMeta['create']['getFormMethod']); |
|
518 | - $formbody = $formBase->$getFormMethod($prefix, $mod, $formBody); |
|
517 | + $getFormMethod = (empty($this->_popupMeta['create']['getFormMethod']) ? 'getFormBody' : $this->_popupMeta['create']['getFormMethod']); |
|
518 | + $formbody = $formBase->$getFormMethod($prefix, $mod, $formBody); |
|
519 | 519 | |
520 | - $addform = '<table><tr><td nowrap="nowrap" valign="top">' |
|
521 | - . str_replace('<br>', '</td><td nowrap="nowrap" valign="top"> ', $formbody) |
|
522 | - . '</td></tr></table>' |
|
523 | - . '<input type="hidden" name="action" value="Popup" />'; |
|
520 | + $addform = '<table><tr><td nowrap="nowrap" valign="top">' |
|
521 | + . str_replace('<br>', '</td><td nowrap="nowrap" valign="top"> ', $formbody) |
|
522 | + . '</td></tr></table>' |
|
523 | + . '<input type="hidden" name="action" value="Popup" />'; |
|
524 | 524 | |
525 | - return $addform; |
|
526 | - } |
|
527 | - } |
|
525 | + return $addform; |
|
526 | + } |
|
527 | + } |
|
528 | 528 | |
529 | - function _getAddFormHeader(){ |
|
530 | - $lbl_save_button_title = $GLOBALS['app_strings']['LBL_SAVE_BUTTON_TITLE']; |
|
531 | - $lbl_save_button_key = $GLOBALS['app_strings']['LBL_SAVE_BUTTON_KEY']; |
|
532 | - $lbl_save_button_label = $GLOBALS['app_strings']['LBL_SAVE_BUTTON_LABEL']; |
|
533 | - $module_dir = $this->seed->module_dir; |
|
529 | + function _getAddFormHeader(){ |
|
530 | + $lbl_save_button_title = $GLOBALS['app_strings']['LBL_SAVE_BUTTON_TITLE']; |
|
531 | + $lbl_save_button_key = $GLOBALS['app_strings']['LBL_SAVE_BUTTON_KEY']; |
|
532 | + $lbl_save_button_label = $GLOBALS['app_strings']['LBL_SAVE_BUTTON_LABEL']; |
|
533 | + $module_dir = $this->seed->module_dir; |
|
534 | 534 | $formSave = <<<EOQ |
535 | 535 | <input type="hidden" name="create" value="true"> |
536 | 536 | <input type="hidden" name="popup" value="true"> |
@@ -538,21 +538,21 @@ discard block |
||
538 | 538 | <input type="hidden" name="return_module" value="$module_dir"> |
539 | 539 | <input type="hidden" name="return_action" value="Popup"> |
540 | 540 | EOQ; |
541 | - // if metadata contains custom inputs for the quickcreate |
|
542 | - 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'; |
|
545 | - } |
|
546 | - |
|
547 | - |
|
548 | - $addformheader = get_form_header(translate($this->_popupMeta['create']['createButton']), $formSave, false); |
|
549 | - return $addformheader; |
|
550 | - } |
|
551 | - |
|
552 | - function getQuickCreate(){ |
|
553 | - require_once("include/EditView/PopupQuickCreate.php"); |
|
554 | - $qc = new PopupQuickCreate($this->module); |
|
555 | - return $qc->process($this->module); |
|
556 | - } |
|
541 | + // if metadata contains custom inputs for the quickcreate |
|
542 | + 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'; |
|
545 | + } |
|
546 | + |
|
547 | + |
|
548 | + $addformheader = get_form_header(translate($this->_popupMeta['create']['createButton']), $formSave, false); |
|
549 | + return $addformheader; |
|
550 | + } |
|
551 | + |
|
552 | + function getQuickCreate(){ |
|
553 | + require_once("include/EditView/PopupQuickCreate.php"); |
|
554 | + $qc = new PopupQuickCreate($this->module); |
|
555 | + return $qc->process($this->module); |
|
556 | + } |
|
557 | 557 | } |
558 | 558 | ?> |
@@ -13,8 +13,8 @@ |
||
13 | 13 | die('Not A Valid Entry Point'); |
14 | 14 | } |
15 | 15 | /** |
16 | - * Retrieves the requested js language file, building it if it doesn't exist. |
|
17 | - */ |
|
16 | + * Retrieves the requested js language file, building it if it doesn't exist. |
|
17 | + */ |
|
18 | 18 | function getJSLanguage() |
19 | 19 | { |
20 | 20 |