@@ -44,45 +44,45 @@ |
||
44 | 44 | */ |
45 | 45 | class ConnectorFactory{ |
46 | 46 | |
47 | - static $source_map = array(); |
|
47 | + static $source_map = array(); |
|
48 | 48 | |
49 | - public static function getInstance($source_name){ |
|
50 | - if(empty(self::$source_map[$source_name])) { |
|
51 | - require_once('include/connectors/sources/SourceFactory.php'); |
|
52 | - require_once('include/connectors/component.php'); |
|
53 | - $source = SourceFactory::getSource($source_name); |
|
54 | - $component = new component(); |
|
55 | - $component->setSource($source); |
|
56 | - $component->init(); |
|
57 | - self::$source_map[$source_name] = $component; |
|
58 | - } |
|
59 | - return self::$source_map[$source_name]; |
|
60 | - } |
|
49 | + public static function getInstance($source_name){ |
|
50 | + if(empty(self::$source_map[$source_name])) { |
|
51 | + require_once('include/connectors/sources/SourceFactory.php'); |
|
52 | + require_once('include/connectors/component.php'); |
|
53 | + $source = SourceFactory::getSource($source_name); |
|
54 | + $component = new component(); |
|
55 | + $component->setSource($source); |
|
56 | + $component->init(); |
|
57 | + self::$source_map[$source_name] = $component; |
|
58 | + } |
|
59 | + return self::$source_map[$source_name]; |
|
60 | + } |
|
61 | 61 | |
62 | - /** |
|
63 | - * Split the class name by _ and go through the class name |
|
64 | - * which represents the inheritance structure to load up all required parents. |
|
65 | - * @param string $class the root class we want to load. |
|
66 | - */ |
|
67 | - public static function load($class, $type){ |
|
68 | - self::loadClass($class, $type); |
|
69 | - } |
|
62 | + /** |
|
63 | + * Split the class name by _ and go through the class name |
|
64 | + * which represents the inheritance structure to load up all required parents. |
|
65 | + * @param string $class the root class we want to load. |
|
66 | + */ |
|
67 | + public static function load($class, $type){ |
|
68 | + self::loadClass($class, $type); |
|
69 | + } |
|
70 | 70 | |
71 | - /** |
|
72 | - * include a source class file. |
|
73 | - * @param string $class a class file to include. |
|
74 | - */ |
|
75 | - public static function loadClass($class, $type){ |
|
76 | - $dir = str_replace('_','/',$class); |
|
77 | - $parts = explode("/", $dir); |
|
78 | - $file = $parts[count($parts)-1] . '.php'; |
|
79 | - if(file_exists("custom/modules/Connectors/connectors/{$type}/{$dir}/$file")){ |
|
80 | - require_once("custom/modules/Connectors/connectors/{$type}/{$dir}/$file"); |
|
81 | - } else if(file_exists("modules/Connectors/connectors/{$type}/{$dir}/$file")) { |
|
82 | - require_once("modules/Connectors/connectors/{$type}/{$dir}/$file"); |
|
83 | - } else if(file_exists("connectors/{$type}/{$dir}/$file")) { |
|
84 | - require_once("connectors/{$type}/{$dir}/$file"); |
|
85 | - } |
|
86 | - } |
|
71 | + /** |
|
72 | + * include a source class file. |
|
73 | + * @param string $class a class file to include. |
|
74 | + */ |
|
75 | + public static function loadClass($class, $type){ |
|
76 | + $dir = str_replace('_','/',$class); |
|
77 | + $parts = explode("/", $dir); |
|
78 | + $file = $parts[count($parts)-1] . '.php'; |
|
79 | + if(file_exists("custom/modules/Connectors/connectors/{$type}/{$dir}/$file")){ |
|
80 | + require_once("custom/modules/Connectors/connectors/{$type}/{$dir}/$file"); |
|
81 | + } else if(file_exists("modules/Connectors/connectors/{$type}/{$dir}/$file")) { |
|
82 | + require_once("modules/Connectors/connectors/{$type}/{$dir}/$file"); |
|
83 | + } else if(file_exists("connectors/{$type}/{$dir}/$file")) { |
|
84 | + require_once("connectors/{$type}/{$dir}/$file"); |
|
85 | + } |
|
86 | + } |
|
87 | 87 | } |
88 | 88 | ?> |
89 | 89 | \ No newline at end of file |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | 3 | /********************************************************************************* |
4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -42,12 +42,12 @@ discard block |
||
42 | 42 | * Connector factory |
43 | 43 | * @api |
44 | 44 | */ |
45 | -class ConnectorFactory{ |
|
45 | +class ConnectorFactory { |
|
46 | 46 | |
47 | 47 | static $source_map = array(); |
48 | 48 | |
49 | - public static function getInstance($source_name){ |
|
50 | - if(empty(self::$source_map[$source_name])) { |
|
49 | + public static function getInstance($source_name) { |
|
50 | + if (empty(self::$source_map[$source_name])) { |
|
51 | 51 | require_once('include/connectors/sources/SourceFactory.php'); |
52 | 52 | require_once('include/connectors/component.php'); |
53 | 53 | $source = SourceFactory::getSource($source_name); |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * which represents the inheritance structure to load up all required parents. |
65 | 65 | * @param string $class the root class we want to load. |
66 | 66 | */ |
67 | - public static function load($class, $type){ |
|
67 | + public static function load($class, $type) { |
|
68 | 68 | self::loadClass($class, $type); |
69 | 69 | } |
70 | 70 | |
@@ -72,15 +72,15 @@ discard block |
||
72 | 72 | * include a source class file. |
73 | 73 | * @param string $class a class file to include. |
74 | 74 | */ |
75 | - public static function loadClass($class, $type){ |
|
76 | - $dir = str_replace('_','/',$class); |
|
75 | + public static function loadClass($class, $type) { |
|
76 | + $dir = str_replace('_', '/', $class); |
|
77 | 77 | $parts = explode("/", $dir); |
78 | - $file = $parts[count($parts)-1] . '.php'; |
|
79 | - if(file_exists("custom/modules/Connectors/connectors/{$type}/{$dir}/$file")){ |
|
78 | + $file = $parts[count($parts) - 1].'.php'; |
|
79 | + if (file_exists("custom/modules/Connectors/connectors/{$type}/{$dir}/$file")) { |
|
80 | 80 | require_once("custom/modules/Connectors/connectors/{$type}/{$dir}/$file"); |
81 | - } else if(file_exists("modules/Connectors/connectors/{$type}/{$dir}/$file")) { |
|
81 | + } else if (file_exists("modules/Connectors/connectors/{$type}/{$dir}/$file")) { |
|
82 | 82 | require_once("modules/Connectors/connectors/{$type}/{$dir}/$file"); |
83 | - } else if(file_exists("connectors/{$type}/{$dir}/$file")) { |
|
83 | + } else if (file_exists("connectors/{$type}/{$dir}/$file")) { |
|
84 | 84 | require_once("connectors/{$type}/{$dir}/$file"); |
85 | 85 | } |
86 | 86 | } |
@@ -1,5 +1,7 @@ |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if(!defined('sugarEntry') || !sugarEntry) { |
|
3 | + die('Not A Valid Entry Point'); |
|
4 | +} |
|
3 | 5 | /********************************************************************************* |
4 | 6 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 7 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -125,11 +125,11 @@ discard block |
||
125 | 125 | |
126 | 126 | //For the ajaxUI, we need to use output buffering to return the page in an ajax friendly format |
127 | 127 | if ($this->_getOption('json_output')){ |
128 | - ob_start(); |
|
129 | - if(!empty($_REQUEST['ajax_load']) && !empty($_REQUEST['loadLanguageJS'])) { |
|
130 | - echo $this->_getModLanguageJS(); |
|
131 | - } |
|
132 | - } |
|
128 | + ob_start(); |
|
129 | + if(!empty($_REQUEST['ajax_load']) && !empty($_REQUEST['loadLanguageJS'])) { |
|
130 | + echo $this->_getModLanguageJS(); |
|
131 | + } |
|
132 | + } |
|
133 | 133 | |
134 | 134 | if ($this->_getOption('show_header')) { |
135 | 135 | $this->displayHeader(); |
@@ -175,11 +175,11 @@ discard block |
||
175 | 175 | $module = $this->module; |
176 | 176 | $ajax_ret = array( |
177 | 177 | 'content' => mb_detect_encoding($content) == "UTF-8" ? $content : utf8_encode($content), |
178 | - 'menu' => array( |
|
179 | - 'module' => $module, |
|
180 | - 'label' => translate($module), |
|
181 | - $this->getMenu($module), |
|
182 | - ), |
|
178 | + 'menu' => array( |
|
179 | + 'module' => $module, |
|
180 | + 'label' => translate($module), |
|
181 | + $this->getMenu($module), |
|
182 | + ), |
|
183 | 183 | 'title' => $this->getBrowserTitle(), |
184 | 184 | 'action' => isset($_REQUEST['action']) ? $_REQUEST['action'] : "", |
185 | 185 | 'record' => isset($_REQUEST['record']) ? $_REQUEST['record'] : "", |
@@ -422,10 +422,10 @@ discard block |
||
422 | 422 | "URL" => current($attributevalue), |
423 | 423 | "SUBMENU" => array(), |
424 | 424 | ); |
425 | - if(substr($gcls[$key]["URL"], 0, 11) == "javascript:") { |
|
426 | - $gcls[$key]["ONCLICK"] = substr($gcls[$key]["URL"],11); |
|
427 | - $gcls[$key]["URL"] = "javascript:void(0)"; |
|
428 | - } |
|
425 | + if(substr($gcls[$key]["URL"], 0, 11) == "javascript:") { |
|
426 | + $gcls[$key]["ONCLICK"] = substr($gcls[$key]["URL"],11); |
|
427 | + $gcls[$key]["URL"] = "javascript:void(0)"; |
|
428 | + } |
|
429 | 429 | } |
430 | 430 | // and now the sublinks |
431 | 431 | if ( $linkattribute == 'submenu' && is_array($attributevalue) ) { |
@@ -434,10 +434,10 @@ discard block |
||
434 | 434 | "LABEL" => key($submenulinkinfo), |
435 | 435 | "URL" => current($submenulinkinfo), |
436 | 436 | ); |
437 | - if(substr($gcls[$key]['SUBMENU'][$submenulinkkey]["URL"], 0, 11) == "javascript:") { |
|
438 | - $gcls[$key]['SUBMENU'][$submenulinkkey]["ONCLICK"] = substr($gcls[$key]['SUBMENU'][$submenulinkkey]["URL"],11); |
|
439 | - $gcls[$key]['SUBMENU'][$submenulinkkey]["URL"] = "javascript:void(0)"; |
|
440 | - } |
|
437 | + if(substr($gcls[$key]['SUBMENU'][$submenulinkkey]["URL"], 0, 11) == "javascript:") { |
|
438 | + $gcls[$key]['SUBMENU'][$submenulinkkey]["ONCLICK"] = substr($gcls[$key]['SUBMENU'][$submenulinkkey]["URL"],11); |
|
439 | + $gcls[$key]['SUBMENU'][$submenulinkkey]["URL"] = "javascript:void(0)"; |
|
440 | + } |
|
441 | 441 | } |
442 | 442 | } |
443 | 443 | } |
@@ -665,14 +665,14 @@ discard block |
||
665 | 665 | $ss->assign("shortcutExtraMenu",$shortcutExtraMenu); |
666 | 666 | } |
667 | 667 | |
668 | - if(!empty($current_user)){ |
|
669 | - $ss->assign("max_tabs", $current_user->getPreference("max_tabs")); |
|
670 | - } |
|
668 | + if(!empty($current_user)){ |
|
669 | + $ss->assign("max_tabs", $current_user->getPreference("max_tabs")); |
|
670 | + } |
|
671 | 671 | |
672 | 672 | |
673 | 673 | $imageURL = SugarThemeRegistry::current()->getImageURL("dashboard.png"); |
674 | 674 | $homeImage = "<img src='$imageURL'>"; |
675 | - $ss->assign("homeImage",$homeImage); |
|
675 | + $ss->assign("homeImage",$homeImage); |
|
676 | 676 | global $mod_strings; |
677 | 677 | $mod_strings = $bakModStrings; |
678 | 678 | $headerTpl = $themeObject->getTemplate('header.tpl'); |
@@ -777,12 +777,12 @@ discard block |
||
777 | 777 | list ($num_grp_sep, $dec_sep) = get_number_seperators(); |
778 | 778 | |
779 | 779 | $the_script = "<script type=\"text/javascript\">\n" . "\tvar time_reg_format = '" . |
780 | - $timereg['format'] . "';\n" . "\tvar date_reg_format = '" . |
|
781 | - $datereg['format'] . "';\n" . "\tvar date_reg_positions = { $date_pos };\n" . |
|
782 | - "\tvar time_separator = '$time_separator';\n" . |
|
783 | - "\tvar cal_date_format = '$cal_date_format';\n" . |
|
784 | - "\tvar time_offset = $hour_offset;\n" . "\tvar num_grp_sep = '$num_grp_sep';\n" . |
|
785 | - "\tvar dec_sep = '$dec_sep';\n" . "</script>"; |
|
780 | + $timereg['format'] . "';\n" . "\tvar date_reg_format = '" . |
|
781 | + $datereg['format'] . "';\n" . "\tvar date_reg_positions = { $date_pos };\n" . |
|
782 | + "\tvar time_separator = '$time_separator';\n" . |
|
783 | + "\tvar cal_date_format = '$cal_date_format';\n" . |
|
784 | + "\tvar time_offset = $hour_offset;\n" . "\tvar num_grp_sep = '$num_grp_sep';\n" . |
|
785 | + "\tvar dec_sep = '$dec_sep';\n" . "</script>"; |
|
786 | 786 | |
787 | 787 | return $the_script; |
788 | 788 | } |
@@ -847,7 +847,7 @@ discard block |
||
847 | 847 | } |
848 | 848 | echo getVersionedScript('cache/jsLanguage/'. $GLOBALS['current_language'] . '.js', $GLOBALS['sugar_config']['js_lang_version']); |
849 | 849 | |
850 | - echo $this->_getModLanguageJS(); |
|
850 | + echo $this->_getModLanguageJS(); |
|
851 | 851 | |
852 | 852 | if(isset( $sugar_config['disc_client']) && $sugar_config['disc_client']) |
853 | 853 | echo getVersionedScript('modules/Sync/headersync.js'); |
@@ -863,13 +863,13 @@ discard block |
||
863 | 863 | } |
864 | 864 | } |
865 | 865 | |
866 | - protected function _getModLanguageJS(){ |
|
867 | - if (!is_file(sugar_cached('jsLanguage/') . $this->module . '/' . $GLOBALS['current_language'] . '.js')) { |
|
868 | - require_once ('include/language/jsLanguage.php'); |
|
869 | - jsLanguage::createModuleStringsCache($this->module, $GLOBALS['current_language']); |
|
870 | - } |
|
871 | - return getVersionedScript("cache/jsLanguage/{$this->module}/". $GLOBALS['current_language'] . '.js', $GLOBALS['sugar_config']['js_lang_version']); |
|
872 | - } |
|
866 | + protected function _getModLanguageJS(){ |
|
867 | + if (!is_file(sugar_cached('jsLanguage/') . $this->module . '/' . $GLOBALS['current_language'] . '.js')) { |
|
868 | + require_once ('include/language/jsLanguage.php'); |
|
869 | + jsLanguage::createModuleStringsCache($this->module, $GLOBALS['current_language']); |
|
870 | + } |
|
871 | + return getVersionedScript("cache/jsLanguage/{$this->module}/". $GLOBALS['current_language'] . '.js', $GLOBALS['sugar_config']['js_lang_version']); |
|
872 | + } |
|
873 | 873 | |
874 | 874 | /** |
875 | 875 | * Called from process(). This method will display the footer on the page. |
@@ -882,7 +882,7 @@ discard block |
||
882 | 882 | global $sugar_config; |
883 | 883 | global $app_strings; |
884 | 884 | global $mod_strings; |
885 | - $themeObject = SugarThemeRegistry::current(); |
|
885 | + $themeObject = SugarThemeRegistry::current(); |
|
886 | 886 | //decide whether or not to show themepicker, default is to show |
887 | 887 | $showThemePicker = true; |
888 | 888 | if (isset($sugar_config['showThemePicker'])) { |
@@ -893,30 +893,30 @@ discard block |
||
893 | 893 | $ss->assign("AUTHENTICATED",isset($_SESSION["authenticated_user_id"])); |
894 | 894 | $ss->assign('MOD',return_module_language($GLOBALS['current_language'], 'Users')); |
895 | 895 | |
896 | - $bottomLinkList = array(); |
|
897 | - if (isset($this->action) && $this->action != "EditView") { |
|
898 | - $bottomLinkList['print'] = array($app_strings['LNK_PRINT'] => getPrintLink()); |
|
899 | - } |
|
900 | - $bottomLinkList['backtotop'] = array($app_strings['LNK_BACKTOTOP'] => 'javascript:SUGAR.util.top();'); |
|
901 | - |
|
902 | - $bottomLinksStr = ""; |
|
903 | - foreach($bottomLinkList as $key => $value) { |
|
904 | - foreach($value as $text => $link) { |
|
905 | - $href = $link; |
|
906 | - if(substr($link, 0, 11) == "javascript:") { |
|
907 | - $onclick = " onclick=\"".substr($link,11)."\""; |
|
908 | - $href = "javascript:void(0)"; |
|
909 | - } else { |
|
910 | - $onclick = ""; |
|
911 | - } |
|
896 | + $bottomLinkList = array(); |
|
897 | + if (isset($this->action) && $this->action != "EditView") { |
|
898 | + $bottomLinkList['print'] = array($app_strings['LNK_PRINT'] => getPrintLink()); |
|
899 | + } |
|
900 | + $bottomLinkList['backtotop'] = array($app_strings['LNK_BACKTOTOP'] => 'javascript:SUGAR.util.top();'); |
|
901 | + |
|
902 | + $bottomLinksStr = ""; |
|
903 | + foreach($bottomLinkList as $key => $value) { |
|
904 | + foreach($value as $text => $link) { |
|
905 | + $href = $link; |
|
906 | + if(substr($link, 0, 11) == "javascript:") { |
|
907 | + $onclick = " onclick=\"".substr($link,11)."\""; |
|
908 | + $href = "javascript:void(0)"; |
|
909 | + } else { |
|
910 | + $onclick = ""; |
|
911 | + } |
|
912 | 912 | $imageURL = SugarThemeRegistry::current()->getImageURL($key.'.gif'); |
913 | - $bottomLinksStr .= "<a href=\"{$href}\""; |
|
914 | - $bottomLinksStr .= (isset($onclick)) ? $onclick : ""; |
|
915 | - $bottomLinksStr .= "><img src='{$imageURL}' alt=''>"; //keeping alt blank on purpose for 508 (text will be read instead) |
|
916 | - $bottomLinksStr .= " ".$text."</a>"; |
|
917 | - } |
|
918 | - } |
|
919 | - $ss->assign("BOTTOMLINKS",$bottomLinksStr); |
|
913 | + $bottomLinksStr .= "<a href=\"{$href}\""; |
|
914 | + $bottomLinksStr .= (isset($onclick)) ? $onclick : ""; |
|
915 | + $bottomLinksStr .= "><img src='{$imageURL}' alt=''>"; //keeping alt blank on purpose for 508 (text will be read instead) |
|
916 | + $bottomLinksStr .= " ".$text."</a>"; |
|
917 | + } |
|
918 | + } |
|
919 | + $ss->assign("BOTTOMLINKS",$bottomLinksStr); |
|
920 | 920 | if (SugarConfig::getInstance()->get('calculate_response_time', false)) |
921 | 921 | $ss->assign('STATISTICS',$this->_getStatistics()); |
922 | 922 | |
@@ -946,7 +946,7 @@ discard block |
||
946 | 946 | $attribLinkImg = "<img style='margin-top: 2px' border='0' width='120' height='34' src='include/images/poweredby_sugarcrm_65.png' alt='Powered By SugarCRM'>\n"; |
947 | 947 | |
948 | 948 | |
949 | - // handle resizing of the company logo correctly on the fly |
|
949 | + // handle resizing of the company logo correctly on the fly |
|
950 | 950 | $companyLogoURL = $themeObject->getImageURL('company_logo.png'); |
951 | 951 | $companyLogoURL_arr = explode('?', $companyLogoURL); |
952 | 952 | $companyLogoURL = $companyLogoURL_arr[0]; |
@@ -1069,7 +1069,7 @@ discard block |
||
1069 | 1069 | |
1070 | 1070 | |
1071 | 1071 | $trackerManager = TrackerManager::getInstance(); |
1072 | - $trackerManager->save(); |
|
1072 | + $trackerManager->save(); |
|
1073 | 1073 | |
1074 | 1074 | } |
1075 | 1075 | |
@@ -1109,7 +1109,7 @@ discard block |
||
1109 | 1109 | $deltaTime = $endTime - $GLOBALS['startTime']; |
1110 | 1110 | $response_time_string = $GLOBALS['app_strings']['LBL_SERVER_RESPONSE_TIME'] . ' ' . number_format(round($deltaTime, 2), 2) . ' ' . $GLOBALS['app_strings']['LBL_SERVER_RESPONSE_TIME_SECONDS']; |
1111 | 1111 | $return = $response_time_string; |
1112 | - // $return .= '<br />'; |
|
1112 | + // $return .= '<br />'; |
|
1113 | 1113 | if (!empty($GLOBALS['sugar_config']['show_page_resources'])) { |
1114 | 1114 | // Print out the resources used in constructing the page. |
1115 | 1115 | $included_files = get_included_files(); |
@@ -1170,8 +1170,8 @@ discard block |
||
1170 | 1170 | { |
1171 | 1171 | $data = array |
1172 | 1172 | ( |
1173 | - !empty($this->module) ? $this->module : $GLOBALS['app_strings']['LBL_LINK_NONE'], |
|
1174 | - !empty($this->action) ? $this->action : $GLOBALS['app_strings']['LBL_LINK_NONE'], |
|
1173 | + !empty($this->module) ? $this->module : $GLOBALS['app_strings']['LBL_LINK_NONE'], |
|
1174 | + !empty($this->action) ? $this->action : $GLOBALS['app_strings']['LBL_LINK_NONE'], |
|
1175 | 1175 | ); |
1176 | 1176 | |
1177 | 1177 | $output = string_format($GLOBALS['app_strings']['LBL_SERVER_MEMORY_LOG_MESSAGE'], $data) . $newline; |
@@ -1240,15 +1240,15 @@ discard block |
||
1240 | 1240 | } |
1241 | 1241 | |
1242 | 1242 | /** |
1243 | - * Returns the module name which should be highlighted in the module menu |
|
1243 | + * Returns the module name which should be highlighted in the module menu |
|
1244 | 1244 | */ |
1245 | 1245 | protected function _getModuleTab() |
1246 | 1246 | { |
1247 | 1247 | global $app_list_strings, $moduleTabMap, $current_user; |
1248 | 1248 | |
1249 | - $userTabs = query_module_access_list($current_user); |
|
1250 | - //If the home tab is in the user array use it as the default tab, otherwise use the first element in the tab array |
|
1251 | - $defaultTab = (in_array("Home",$userTabs)) ? "Home" : key($userTabs); |
|
1249 | + $userTabs = query_module_access_list($current_user); |
|
1250 | + //If the home tab is in the user array use it as the default tab, otherwise use the first element in the tab array |
|
1251 | + $defaultTab = (in_array("Home",$userTabs)) ? "Home" : key($userTabs); |
|
1252 | 1252 | |
1253 | 1253 | // Need to figure out what tab this module belongs to, most modules have their own tabs, but there are exceptions. |
1254 | 1254 | if ( !empty($_REQUEST['module_tab']) ) |
@@ -1264,17 +1264,17 @@ discard block |
||
1264 | 1264 | elseif ( !isset($app_list_strings['moduleList'][$this->module]) ) |
1265 | 1265 | return $defaultTab; |
1266 | 1266 | elseif ( isset($_REQUEST['action']) && $_REQUEST['action'] == "ajaxui" ) |
1267 | - return $defaultTab; |
|
1267 | + return $defaultTab; |
|
1268 | 1268 | else |
1269 | 1269 | return $this->module; |
1270 | 1270 | } |
1271 | 1271 | |
1272 | - /** |
|
1273 | - * Return the "breadcrumbs" to display at the top of the page |
|
1274 | - * |
|
1275 | - * @param bool $show_help optional, true if we show the help links |
|
1276 | - * @return HTML string containing breadcrumb title |
|
1277 | - */ |
|
1272 | + /** |
|
1273 | + * Return the "breadcrumbs" to display at the top of the page |
|
1274 | + * |
|
1275 | + * @param bool $show_help optional, true if we show the help links |
|
1276 | + * @return HTML string containing breadcrumb title |
|
1277 | + */ |
|
1278 | 1278 | public function getModuleTitle( |
1279 | 1279 | $show_help = true |
1280 | 1280 | ) |
@@ -1288,13 +1288,13 @@ discard block |
||
1288 | 1288 | $params = $this->_getModuleTitleParams(); |
1289 | 1289 | $index = 0; |
1290 | 1290 | |
1291 | - if(SugarThemeRegistry::current()->directionality == "rtl") { |
|
1292 | - $params = array_reverse($params); |
|
1293 | - } |
|
1294 | - if(count($params) > 1) { |
|
1295 | - array_shift($params); |
|
1296 | - } |
|
1297 | - $count = count($params); |
|
1291 | + if(SugarThemeRegistry::current()->directionality == "rtl") { |
|
1292 | + $params = array_reverse($params); |
|
1293 | + } |
|
1294 | + if(count($params) > 1) { |
|
1295 | + array_shift($params); |
|
1296 | + } |
|
1297 | + $count = count($params); |
|
1298 | 1298 | $paramString = ''; |
1299 | 1299 | foreach($params as $parm){ |
1300 | 1300 | $index++; |
@@ -1305,13 +1305,13 @@ discard block |
||
1305 | 1305 | } |
1306 | 1306 | |
1307 | 1307 | if(!empty($paramString)){ |
1308 | - $theTitle .= "<h2> $paramString </h2>"; |
|
1308 | + $theTitle .= "<h2> $paramString </h2>"; |
|
1309 | 1309 | |
1310 | 1310 | if($this->type == "detail"){ |
1311 | 1311 | $theTitle .= "<div class='favorite' record_id='" . $this->bean->id . "' module='" . $this->bean->module_dir . "'><div class='favorite_icon_outline'>" . SugarThemeRegistry::current()->getImage('favorite-star-outline','title="' . translate('LBL_DASHLET_EDIT', 'Home') . '" border="0" align="absmiddle"', null,null,'.gif',translate('LBL_DASHLET_EDIT', 'Home')) . "</div> |
1312 | 1312 | <div class='favorite_icon_fill'>" . SugarThemeRegistry::current()->getImage('favorite-star','title="' . translate('LBL_DASHLET_EDIT', 'Home') . '" border="0" align="absmiddle"', null,null,'.gif',translate('LBL_DASHLET_EDIT', 'Home')) . "</div></div>"; |
1313 | 1313 | } |
1314 | - } |
|
1314 | + } |
|
1315 | 1315 | |
1316 | 1316 | // bug 56131 - restore conditional so that link doesn't appear where it shouldn't |
1317 | 1317 | if($show_help || $this->type == 'list') { |
@@ -1384,7 +1384,7 @@ discard block |
||
1384 | 1384 | protected function _getModuleTitleParams($browserTitle = false) |
1385 | 1385 | { |
1386 | 1386 | $params = array($this->_getModuleTitleListParam($browserTitle)); |
1387 | - //$params = array(); |
|
1387 | + //$params = array(); |
|
1388 | 1388 | if (isset($this->action)){ |
1389 | 1389 | switch ($this->action) { |
1390 | 1390 | case 'EditView': |
@@ -1414,48 +1414,48 @@ discard block |
||
1414 | 1414 | */ |
1415 | 1415 | protected function _getModuleTitleListParam( $browserTitle = false ) |
1416 | 1416 | { |
1417 | - global $current_user; |
|
1418 | - global $app_strings; |
|
1419 | - |
|
1420 | - if(!empty($GLOBALS['app_list_strings']['moduleList'][$this->module])) |
|
1421 | - $firstParam = $GLOBALS['app_list_strings']['moduleList'][$this->module]; |
|
1422 | - else |
|
1423 | - $firstParam = $this->module; |
|
1424 | - |
|
1425 | - $iconPath = $this->getModuleTitleIconPath($this->module); |
|
1426 | - if($this->action == "ListView" || $this->action == "index") { |
|
1427 | - if (!empty($iconPath) && !$browserTitle) { |
|
1428 | - if (SugarThemeRegistry::current()->directionality == "ltr") { |
|
1429 | - return $app_strings['LBL_SEARCH']." " |
|
1430 | - . "$firstParam"; |
|
1431 | - |
|
1432 | - } else { |
|
1433 | - return "$firstParam" |
|
1434 | - . " ".$app_strings['LBL_SEARCH']; |
|
1435 | - } |
|
1436 | - } else { |
|
1437 | - return $firstParam; |
|
1438 | - } |
|
1439 | - } |
|
1440 | - else { |
|
1441 | - if (!empty($iconPath) && !$browserTitle) { |
|
1442 | - //return "<a href='index.php?module={$this->module}&action=index'>$this->module</a>"; |
|
1443 | - } else { |
|
1444 | - return $firstParam; |
|
1445 | - } |
|
1446 | - } |
|
1417 | + global $current_user; |
|
1418 | + global $app_strings; |
|
1419 | + |
|
1420 | + if(!empty($GLOBALS['app_list_strings']['moduleList'][$this->module])) |
|
1421 | + $firstParam = $GLOBALS['app_list_strings']['moduleList'][$this->module]; |
|
1422 | + else |
|
1423 | + $firstParam = $this->module; |
|
1424 | + |
|
1425 | + $iconPath = $this->getModuleTitleIconPath($this->module); |
|
1426 | + if($this->action == "ListView" || $this->action == "index") { |
|
1427 | + if (!empty($iconPath) && !$browserTitle) { |
|
1428 | + if (SugarThemeRegistry::current()->directionality == "ltr") { |
|
1429 | + return $app_strings['LBL_SEARCH']." " |
|
1430 | + . "$firstParam"; |
|
1431 | + |
|
1432 | + } else { |
|
1433 | + return "$firstParam" |
|
1434 | + . " ".$app_strings['LBL_SEARCH']; |
|
1435 | + } |
|
1436 | + } else { |
|
1437 | + return $firstParam; |
|
1438 | + } |
|
1439 | + } |
|
1440 | + else { |
|
1441 | + if (!empty($iconPath) && !$browserTitle) { |
|
1442 | + //return "<a href='index.php?module={$this->module}&action=index'>$this->module</a>"; |
|
1443 | + } else { |
|
1444 | + return $firstParam; |
|
1445 | + } |
|
1446 | + } |
|
1447 | 1447 | } |
1448 | 1448 | |
1449 | 1449 | protected function getModuleTitleIconPath($module) |
1450 | 1450 | { |
1451 | - $iconPath = ""; |
|
1452 | - if(is_file(SugarThemeRegistry::current()->getImageURL('icon_'.$module.'_32.png',false))) { |
|
1453 | - $iconPath = SugarThemeRegistry::current()->getImageURL('icon_'.$module.'_32.png'); |
|
1454 | - } |
|
1455 | - else if (is_file(SugarThemeRegistry::current()->getImageURL('icon_'.ucfirst($module).'_32.png',false))) { |
|
1456 | - $iconPath = SugarThemeRegistry::current()->getImageURL('icon_'.ucfirst($module).'_32.png'); |
|
1457 | - } |
|
1458 | - return $iconPath; |
|
1451 | + $iconPath = ""; |
|
1452 | + if(is_file(SugarThemeRegistry::current()->getImageURL('icon_'.$module.'_32.png',false))) { |
|
1453 | + $iconPath = SugarThemeRegistry::current()->getImageURL('icon_'.$module.'_32.png'); |
|
1454 | + } |
|
1455 | + else if (is_file(SugarThemeRegistry::current()->getImageURL('icon_'.ucfirst($module).'_32.png',false))) { |
|
1456 | + $iconPath = SugarThemeRegistry::current()->getImageURL('icon_'.ucfirst($module).'_32.png'); |
|
1457 | + } |
|
1458 | + return $iconPath; |
|
1459 | 1459 | } |
1460 | 1460 | |
1461 | 1461 | /** |
@@ -1485,11 +1485,11 @@ discard block |
||
1485 | 1485 | */ |
1486 | 1486 | public function getBreadCrumbSymbol() |
1487 | 1487 | { |
1488 | - if(SugarThemeRegistry::current()->directionality == "ltr") { |
|
1489 | - return "<span class='pointer'>»</span>"; |
|
1488 | + if(SugarThemeRegistry::current()->directionality == "ltr") { |
|
1489 | + return "<span class='pointer'>»</span>"; |
|
1490 | 1490 | } |
1491 | 1491 | else { |
1492 | - return "<span class='pointer'>«</span>"; |
|
1492 | + return "<span class='pointer'>«</span>"; |
|
1493 | 1493 | } |
1494 | 1494 | } |
1495 | 1495 | |
@@ -1658,20 +1658,20 @@ discard block |
||
1658 | 1658 | } |
1659 | 1659 | |
1660 | 1660 | /** |
1661 | - * Determines whether the state of the post global array indicates there was an error uploading a |
|
1661 | + * Determines whether the state of the post global array indicates there was an error uploading a |
|
1662 | 1662 | * file that exceeds the post_max_size setting. Such an error can be detected if: |
1663 | 1663 | * 1. The Server['REQUEST_METHOD'] will still point to POST |
1664 | 1664 | * 2. POST and FILES global arrays will be returned empty despite the request method |
1665 | 1665 | * This also results in a redirect to the home page (due to lack of module and action in POST) |
1666 | 1666 | * |
1667 | - * @return boolean indicating true or false |
|
1668 | - */ |
|
1667 | + * @return boolean indicating true or false |
|
1668 | + */ |
|
1669 | 1669 | public function checkPostMaxSizeError(){ |
1670 | - //if the referrer is post, and the post array is empty, then an error has occurred, most likely |
|
1671 | - //while uploading a file that exceeds the post_max_size. |
|
1672 | - if(empty($_FILES) && empty($_POST) && isset($_SERVER['REQUEST_METHOD']) && strtolower($_SERVER['REQUEST_METHOD']) == 'post'){ |
|
1673 | - $GLOBALS['log']->fatal($GLOBALS['app_strings']['UPLOAD_ERROR_HOME_TEXT']); |
|
1674 | - return true; |
|
1670 | + //if the referrer is post, and the post array is empty, then an error has occurred, most likely |
|
1671 | + //while uploading a file that exceeds the post_max_size. |
|
1672 | + if(empty($_FILES) && empty($_POST) && isset($_SERVER['REQUEST_METHOD']) && strtolower($_SERVER['REQUEST_METHOD']) == 'post'){ |
|
1673 | + $GLOBALS['log']->fatal($GLOBALS['app_strings']['UPLOAD_ERROR_HOME_TEXT']); |
|
1674 | + return true; |
|
1675 | 1675 | } |
1676 | 1676 | return false; |
1677 | 1677 | } |
@@ -1387,18 +1387,18 @@ |
||
1387 | 1387 | //$params = array(); |
1388 | 1388 | if (isset($this->action)){ |
1389 | 1389 | switch ($this->action) { |
1390 | - case 'EditView': |
|
1391 | - if(!empty($this->bean->id) && (empty($_REQUEST['isDuplicate']) || $_REQUEST['isDuplicate'] === 'false')) { |
|
1392 | - $params[] = "<a href='index.php?module={$this->module}&action=DetailView&record={$this->bean->id}'>".$this->bean->get_summary_text()."</a>"; |
|
1393 | - $params[] = $GLOBALS['app_strings']['LBL_EDIT_BUTTON_LABEL']; |
|
1394 | - } |
|
1395 | - else |
|
1396 | - $params[] = $GLOBALS['app_strings']['LBL_CREATE_BUTTON_LABEL']; |
|
1397 | - break; |
|
1398 | - case 'DetailView': |
|
1399 | - $beanName = $this->bean->get_summary_text(); |
|
1400 | - $params[] = $beanName; |
|
1401 | - break; |
|
1390 | + case 'EditView': |
|
1391 | + if(!empty($this->bean->id) && (empty($_REQUEST['isDuplicate']) || $_REQUEST['isDuplicate'] === 'false')) { |
|
1392 | + $params[] = "<a href='index.php?module={$this->module}&action=DetailView&record={$this->bean->id}'>".$this->bean->get_summary_text()."</a>"; |
|
1393 | + $params[] = $GLOBALS['app_strings']['LBL_EDIT_BUTTON_LABEL']; |
|
1394 | + } |
|
1395 | + else |
|
1396 | + $params[] = $GLOBALS['app_strings']['LBL_CREATE_BUTTON_LABEL']; |
|
1397 | + break; |
|
1398 | + case 'DetailView': |
|
1399 | + $beanName = $this->bean->get_summary_text(); |
|
1400 | + $params[] = $beanName; |
|
1401 | + break; |
|
1402 | 1402 | } |
1403 | 1403 | } |
1404 | 1404 |
@@ -124,9 +124,9 @@ discard block |
||
124 | 124 | $this->_trackView(); |
125 | 125 | |
126 | 126 | //For the ajaxUI, we need to use output buffering to return the page in an ajax friendly format |
127 | - if ($this->_getOption('json_output')){ |
|
127 | + if ($this->_getOption('json_output')) { |
|
128 | 128 | ob_start(); |
129 | - if(!empty($_REQUEST['ajax_load']) && !empty($_REQUEST['loadLanguageJS'])) { |
|
129 | + if (!empty($_REQUEST['ajax_load']) && !empty($_REQUEST['loadLanguageJS'])) { |
|
130 | 130 | echo $this->_getModLanguageJS(); |
131 | 131 | } |
132 | 132 | } |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | $this->preDisplay(); |
142 | 142 | $this->displayErrors(); |
143 | 143 | $this->display(); |
144 | - if ( !empty($this->module) ) { |
|
144 | + if (!empty($this->module)) { |
|
145 | 145 | $GLOBALS['logic_hook']->call_custom_logic($this->module, 'after_ui_frame'); |
146 | 146 | } else { |
147 | 147 | $GLOBALS['logic_hook']->call_custom_logic('', 'after_ui_frame'); |
@@ -186,10 +186,10 @@ discard block |
||
186 | 186 | 'favicon' => $this->getFavicon(), |
187 | 187 | ); |
188 | 188 | |
189 | - if(SugarThemeRegistry::current()->name == 'Classic' || SugarThemeRegistry::current()->classic) |
|
189 | + if (SugarThemeRegistry::current()->name == 'Classic' || SugarThemeRegistry::current()->classic) |
|
190 | 190 | $ajax_ret['moduleList'] = $this->displayHeader(true); |
191 | 191 | |
192 | - if(empty($this->responseTime)) |
|
192 | + if (empty($this->responseTime)) |
|
193 | 193 | $this->_calculateFooterMetrics(); |
194 | 194 | $ajax_ret['responseTime'] = $this->responseTime; |
195 | 195 | $json = getJSONobj(); |
@@ -208,11 +208,11 @@ discard block |
||
208 | 208 | { |
209 | 209 | $errors = ''; |
210 | 210 | |
211 | - foreach($this->errors as $error) { |
|
212 | - $errors .= '<span class="error">' . $error . '</span><br>'; |
|
211 | + foreach ($this->errors as $error) { |
|
212 | + $errors .= '<span class="error">'.$error.'</span><br>'; |
|
213 | 213 | } |
214 | 214 | |
215 | - if ( !$this->suppressDisplayErrors ) { |
|
215 | + if (!$this->suppressDisplayErrors) { |
|
216 | 216 | echo $errors; |
217 | 217 | } |
218 | 218 | else { |
@@ -249,14 +249,14 @@ discard block |
||
249 | 249 | { |
250 | 250 | $action = strtolower($this->action); |
251 | 251 | //Skip save, tracked in SugarBean instead |
252 | - if($action == 'save') { |
|
252 | + if ($action == 'save') { |
|
253 | 253 | return; |
254 | 254 | } |
255 | 255 | |
256 | 256 | |
257 | 257 | $trackerManager = TrackerManager::getInstance(); |
258 | 258 | $timeStamp = TimeDate::getInstance()->nowDb(); |
259 | - if($monitor = $trackerManager->getMonitor('tracker')){ |
|
259 | + if ($monitor = $trackerManager->getMonitor('tracker')) { |
|
260 | 260 | $monitor->setValue('action', $action); |
261 | 261 | $monitor->setValue('user_id', $GLOBALS['current_user']->id); |
262 | 262 | $monitor->setValue('module_name', $this->module); |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | |
272 | 272 | //If visible is true, but there is no bean, do not track (invalid/unauthorized reference) |
273 | 273 | //Also, do not track save actions where there is no bean id |
274 | - if($monitor->visible && empty($this->bean->id)) { |
|
274 | + if ($monitor->visible && empty($this->bean->id)) { |
|
275 | 275 | $trackerManager->unsetMonitor($monitor); |
276 | 276 | return; |
277 | 277 | } |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | /** |
284 | 284 | * Displays the header on section of the page; basically everything before the content |
285 | 285 | */ |
286 | - public function displayHeader($retModTabs=false) |
|
286 | + public function displayHeader($retModTabs = false) |
|
287 | 287 | { |
288 | 288 | global $theme; |
289 | 289 | global $max_tabs; |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | $ss->assign("APP", $app_strings); |
304 | 304 | $ss->assign("THEME", $theme); |
305 | 305 | $ss->assign("THEME_CONFIG", $themeObject->getConfig()); |
306 | - $ss->assign("THEME_IE6COMPAT", $themeObject->ie6compat ? 'true':'false'); |
|
306 | + $ss->assign("THEME_IE6COMPAT", $themeObject->ie6compat ? 'true' : 'false'); |
|
307 | 307 | $ss->assign("MODULE_NAME", $this->module); |
308 | 308 | $ss->assign("langHeader", get_language_header()); |
309 | 309 | |
@@ -319,17 +319,17 @@ discard block |
||
319 | 319 | if ($this->_getOption('view_print')) { |
320 | 320 | $css .= '<link rel="stylesheet" type="text/css" href="'.$themeObject->getCSSURL('print.css').'" media="all" />'; |
321 | 321 | } |
322 | - $ss->assign("SUGAR_CSS",$css); |
|
322 | + $ss->assign("SUGAR_CSS", $css); |
|
323 | 323 | |
324 | 324 | // get javascript |
325 | 325 | ob_start(); |
326 | 326 | $this->renderJavascript(); |
327 | 327 | |
328 | - $ss->assign("SUGAR_JS",ob_get_contents().$themeObject->getJS()); |
|
328 | + $ss->assign("SUGAR_JS", ob_get_contents().$themeObject->getJS()); |
|
329 | 329 | ob_end_clean(); |
330 | 330 | |
331 | 331 | // get favicon |
332 | - if(isset($GLOBALS['sugar_config']['default_module_favicon'])) |
|
332 | + if (isset($GLOBALS['sugar_config']['default_module_favicon'])) |
|
333 | 333 | $module_favicon = $GLOBALS['sugar_config']['default_module_favicon']; |
334 | 334 | else |
335 | 335 | $module_favicon = false; |
@@ -339,24 +339,24 @@ discard block |
||
339 | 339 | |
340 | 340 | // build the shortcut menu |
341 | 341 | $shortcut_menu = array(); |
342 | - foreach ( $this->getMenu() as $key => $menu_item ) |
|
342 | + foreach ($this->getMenu() as $key => $menu_item) |
|
343 | 343 | $shortcut_menu[$key] = array( |
344 | 344 | "URL" => $menu_item[0], |
345 | 345 | "LABEL" => $menu_item[1], |
346 | 346 | "MODULE_NAME" => $menu_item[2], |
347 | 347 | "IMAGE" => $themeObject |
348 | - ->getImage($menu_item[2],"border='0' align='absmiddle'",null,null,'.gif',$menu_item[1]), |
|
348 | + ->getImage($menu_item[2], "border='0' align='absmiddle'", null, null, '.gif', $menu_item[1]), |
|
349 | 349 | ); |
350 | - $ss->assign("SHORTCUT_MENU",$shortcut_menu); |
|
350 | + $ss->assign("SHORTCUT_MENU", $shortcut_menu); |
|
351 | 351 | |
352 | 352 | // handle rtl text direction |
353 | - if(isset($_REQUEST['RTL']) && $_REQUEST['RTL'] == 'RTL'){ |
|
353 | + if (isset($_REQUEST['RTL']) && $_REQUEST['RTL'] == 'RTL') { |
|
354 | 354 | $_SESSION['RTL'] = true; |
355 | 355 | } |
356 | - if(isset($_REQUEST['LTR']) && $_REQUEST['LTR'] == 'LTR'){ |
|
356 | + if (isset($_REQUEST['LTR']) && $_REQUEST['LTR'] == 'LTR') { |
|
357 | 357 | unset($_SESSION['RTL']); |
358 | 358 | } |
359 | - if(isset($_SESSION['RTL']) && $_SESSION['RTL']){ |
|
359 | + if (isset($_SESSION['RTL']) && $_SESSION['RTL']) { |
|
360 | 360 | $ss->assign("DIR", 'dir="RTL"'); |
361 | 361 | } |
362 | 362 | |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | $companyLogoURL = $companyLogoURL_arr[0]; |
367 | 367 | |
368 | 368 | $company_logo_attributes = sugar_cache_retrieve('company_logo_attributes'); |
369 | - if(!empty($company_logo_attributes)) { |
|
369 | + if (!empty($company_logo_attributes)) { |
|
370 | 370 | $ss->assign("COMPANY_LOGO_MD5", $company_logo_attributes[0]); |
371 | 371 | $ss->assign("COMPANY_LOGO_WIDTH", $company_logo_attributes[1]); |
372 | 372 | $ss->assign("COMPANY_LOGO_HEIGHT", $company_logo_attributes[2]); |
@@ -375,16 +375,16 @@ discard block |
||
375 | 375 | // Always need to md5 the file |
376 | 376 | $ss->assign("COMPANY_LOGO_MD5", md5_file($companyLogoURL)); |
377 | 377 | |
378 | - list($width,$height) = getimagesize($companyLogoURL); |
|
379 | - if ( $width > 212 || $height > 40 ) { |
|
380 | - $resizePctWidth = ($width - 212)/212; |
|
381 | - $resizePctHeight = ($height - 40)/40; |
|
382 | - if ( $resizePctWidth > $resizePctHeight ) |
|
378 | + list($width, $height) = getimagesize($companyLogoURL); |
|
379 | + if ($width > 212 || $height > 40) { |
|
380 | + $resizePctWidth = ($width - 212) / 212; |
|
381 | + $resizePctHeight = ($height - 40) / 40; |
|
382 | + if ($resizePctWidth > $resizePctHeight) |
|
383 | 383 | $resizeAmount = $width / 212; |
384 | 384 | else |
385 | 385 | $resizeAmount = $height / 40; |
386 | - $ss->assign("COMPANY_LOGO_WIDTH", round($width * (1/$resizeAmount))); |
|
387 | - $ss->assign("COMPANY_LOGO_HEIGHT", round($height * (1/$resizeAmount))); |
|
386 | + $ss->assign("COMPANY_LOGO_WIDTH", round($width * (1 / $resizeAmount))); |
|
387 | + $ss->assign("COMPANY_LOGO_HEIGHT", round($height * (1 / $resizeAmount))); |
|
388 | 388 | } |
389 | 389 | else { |
390 | 390 | $ss->assign("COMPANY_LOGO_WIDTH", $width); |
@@ -400,110 +400,110 @@ discard block |
||
400 | 400 | ) |
401 | 401 | ); |
402 | 402 | } |
403 | - $ss->assign("COMPANY_LOGO_URL",getJSPath($companyLogoURL)."&logo_md5=".$ss->get_template_vars("COMPANY_LOGO_MD5")); |
|
403 | + $ss->assign("COMPANY_LOGO_URL", getJSPath($companyLogoURL)."&logo_md5=".$ss->get_template_vars("COMPANY_LOGO_MD5")); |
|
404 | 404 | |
405 | 405 | // get the global links |
406 | 406 | $gcls = array(); |
407 | 407 | $global_control_links = array(); |
408 | 408 | require("include/globalControlLinks.php"); |
409 | 409 | |
410 | - foreach($global_control_links as $key => $value) { |
|
411 | - if ($key == 'users') { //represents logout link. |
|
410 | + foreach ($global_control_links as $key => $value) { |
|
411 | + if ($key == 'users') { //represents logout link. |
|
412 | 412 | $ss->assign("LOGOUT_LINK", $value['linkinfo'][key($value['linkinfo'])]); |
413 | - $ss->assign("LOGOUT_LABEL", key($value['linkinfo']));//key value for first element. |
|
413 | + $ss->assign("LOGOUT_LABEL", key($value['linkinfo'])); //key value for first element. |
|
414 | 414 | continue; |
415 | 415 | } |
416 | 416 | |
417 | 417 | foreach ($value as $linkattribute => $attributevalue) { |
418 | 418 | // get the main link info |
419 | - if ( $linkattribute == 'linkinfo' ) { |
|
419 | + if ($linkattribute == 'linkinfo') { |
|
420 | 420 | $gcls[$key] = array( |
421 | 421 | "LABEL" => key($attributevalue), |
422 | 422 | "URL" => current($attributevalue), |
423 | 423 | "SUBMENU" => array(), |
424 | 424 | ); |
425 | - if(substr($gcls[$key]["URL"], 0, 11) == "javascript:") { |
|
426 | - $gcls[$key]["ONCLICK"] = substr($gcls[$key]["URL"],11); |
|
425 | + if (substr($gcls[$key]["URL"], 0, 11) == "javascript:") { |
|
426 | + $gcls[$key]["ONCLICK"] = substr($gcls[$key]["URL"], 11); |
|
427 | 427 | $gcls[$key]["URL"] = "javascript:void(0)"; |
428 | 428 | } |
429 | 429 | } |
430 | 430 | // and now the sublinks |
431 | - if ( $linkattribute == 'submenu' && is_array($attributevalue) ) { |
|
431 | + if ($linkattribute == 'submenu' && is_array($attributevalue)) { |
|
432 | 432 | foreach ($attributevalue as $submenulinkkey => $submenulinkinfo) |
433 | 433 | $gcls[$key]['SUBMENU'][$submenulinkkey] = array( |
434 | 434 | "LABEL" => key($submenulinkinfo), |
435 | 435 | "URL" => current($submenulinkinfo), |
436 | 436 | ); |
437 | - if(substr($gcls[$key]['SUBMENU'][$submenulinkkey]["URL"], 0, 11) == "javascript:") { |
|
438 | - $gcls[$key]['SUBMENU'][$submenulinkkey]["ONCLICK"] = substr($gcls[$key]['SUBMENU'][$submenulinkkey]["URL"],11); |
|
437 | + if (substr($gcls[$key]['SUBMENU'][$submenulinkkey]["URL"], 0, 11) == "javascript:") { |
|
438 | + $gcls[$key]['SUBMENU'][$submenulinkkey]["ONCLICK"] = substr($gcls[$key]['SUBMENU'][$submenulinkkey]["URL"], 11); |
|
439 | 439 | $gcls[$key]['SUBMENU'][$submenulinkkey]["URL"] = "javascript:void(0)"; |
440 | 440 | } |
441 | 441 | } |
442 | 442 | } |
443 | 443 | } |
444 | - $ss->assign("GCLS",$gcls); |
|
444 | + $ss->assign("GCLS", $gcls); |
|
445 | 445 | |
446 | 446 | $ss->assign("SEARCH", isset($_REQUEST['query_string']) ? $_REQUEST['query_string'] : ''); |
447 | 447 | |
448 | 448 | if ($this->action == "EditView" || $this->action == "Login") |
449 | 449 | $ss->assign("ONLOAD", 'onload="set_focus()"'); |
450 | 450 | |
451 | - $ss->assign("AUTHENTICATED",isset($_SESSION["authenticated_user_id"])); |
|
451 | + $ss->assign("AUTHENTICATED", isset($_SESSION["authenticated_user_id"])); |
|
452 | 452 | |
453 | 453 | // get other things needed for page style popup |
454 | 454 | if (isset($_SESSION["authenticated_user_id"])) { |
455 | 455 | // get the current user name and id |
456 | 456 | $ss->assign("CURRENT_USER", $current_user->full_name == '' || !showFullName() |
457 | - ? $current_user->user_name : $current_user->full_name ); |
|
457 | + ? $current_user->user_name : $current_user->full_name); |
|
458 | 458 | $ss->assign("CURRENT_USER_ID", $current_user->id); |
459 | 459 | |
460 | 460 | // get the last viewed records |
461 | 461 | require_once("modules/Favorites/Favorites.php"); |
462 | 462 | $favorites = new Favorites(); |
463 | 463 | $favorite_records = $favorites->getCurrentUserSidebarFavorites(); |
464 | - $ss->assign("favoriteRecords",$favorite_records); |
|
464 | + $ss->assign("favoriteRecords", $favorite_records); |
|
465 | 465 | |
466 | 466 | $tracker = new Tracker(); |
467 | 467 | $history = $tracker->get_recently_viewed($current_user->id); |
468 | - $ss->assign("recentRecords",$this->processRecentRecords($history)); |
|
468 | + $ss->assign("recentRecords", $this->processRecentRecords($history)); |
|
469 | 469 | } |
470 | 470 | |
471 | 471 | $bakModStrings = $mod_strings; |
472 | - if (isset($_SESSION["authenticated_user_id"]) ) { |
|
472 | + if (isset($_SESSION["authenticated_user_id"])) { |
|
473 | 473 | // get the module list |
474 | 474 | $moduleTopMenu = array(); |
475 | 475 | |
476 | 476 | $max_tabs = $current_user->getPreference('max_tabs'); |
477 | 477 | // Attempt to correct if max tabs count is extremely high. |
478 | - if ( !isset($max_tabs) || $max_tabs <= 0 || $max_tabs > 10 ) { |
|
478 | + if (!isset($max_tabs) || $max_tabs <= 0 || $max_tabs > 10) { |
|
479 | 479 | $max_tabs = $GLOBALS['sugar_config']['default_max_tabs']; |
480 | 480 | $current_user->setPreference('max_tabs', $max_tabs, 0, 'global'); |
481 | 481 | } |
482 | 482 | |
483 | 483 | $moduleTab = $this->_getModuleTab(); |
484 | - $ss->assign('MODULE_TAB',$moduleTab); |
|
484 | + $ss->assign('MODULE_TAB', $moduleTab); |
|
485 | 485 | |
486 | 486 | |
487 | 487 | // See if they are using grouped tabs or not (removed in 6.0, returned in 6.1) |
488 | 488 | $user_navigation_paradigm = $current_user->getPreference('navigation_paradigm'); |
489 | - if ( !isset($user_navigation_paradigm) ) { |
|
489 | + if (!isset($user_navigation_paradigm)) { |
|
490 | 490 | $user_navigation_paradigm = $GLOBALS['sugar_config']['default_navigation_paradigm']; |
491 | 491 | } |
492 | 492 | |
493 | 493 | |
494 | 494 | // Get the full module list for later use |
495 | - foreach ( query_module_access_list($current_user) as $module ) { |
|
495 | + foreach (query_module_access_list($current_user) as $module) { |
|
496 | 496 | // Bug 25948 - Check for the module being in the moduleList |
497 | - if ( isset($app_list_strings['moduleList'][$module]) ) { |
|
497 | + if (isset($app_list_strings['moduleList'][$module])) { |
|
498 | 498 | $fullModuleList[$module] = $app_list_strings['moduleList'][$module]; |
499 | 499 | } |
500 | 500 | } |
501 | 501 | |
502 | 502 | |
503 | - if(!should_hide_iframes()) { |
|
503 | + if (!should_hide_iframes()) { |
|
504 | 504 | $iFrame = new iFrame(); |
505 | 505 | $frames = $iFrame->lookup_frames('tab'); |
506 | - foreach($frames as $key => $values){ |
|
506 | + foreach ($frames as $key => $values) { |
|
507 | 507 | $fullModuleList[$key] = $values; |
508 | 508 | } |
509 | 509 | } |
@@ -511,7 +511,7 @@ discard block |
||
511 | 511 | unset($fullModuleList['iFrames']); |
512 | 512 | } |
513 | 513 | |
514 | - if ( $user_navigation_paradigm == 'gm' && isset($themeObject->group_tabs) && $themeObject->group_tabs) { |
|
514 | + if ($user_navigation_paradigm == 'gm' && isset($themeObject->group_tabs) && $themeObject->group_tabs) { |
|
515 | 515 | // We are using grouped tabs |
516 | 516 | require_once('include/GroupedTabs/GroupedTabStructure.php'); |
517 | 517 | $groupedTabsClass = new GroupedTabStructure(); |
@@ -519,12 +519,12 @@ discard block |
||
519 | 519 | //handle with submoremodules |
520 | 520 | $max_tabs = $current_user->getPreference('max_tabs'); |
521 | 521 | // If the max_tabs isn't set incorrectly, set it within the range, to the default max sub tabs size |
522 | - if ( !isset($max_tabs) || $max_tabs <= 0 || $max_tabs > 10){ |
|
522 | + if (!isset($max_tabs) || $max_tabs <= 0 || $max_tabs > 10) { |
|
523 | 523 | // We have a default value. Use it |
524 | - if(isset($GLOBALS['sugar_config']['default_max_tabs'])){ |
|
524 | + if (isset($GLOBALS['sugar_config']['default_max_tabs'])) { |
|
525 | 525 | $max_tabs = $GLOBALS['sugar_config']['default_max_tabs']; |
526 | 526 | } |
527 | - else{ |
|
527 | + else { |
|
528 | 528 | $max_tabs = 8; |
529 | 529 | } |
530 | 530 | } |
@@ -537,22 +537,22 @@ discard block |
||
537 | 537 | |
538 | 538 | // Setup the default group tab. |
539 | 539 | $allGroup = $app_strings['LBL_TABGROUP_ALL']; |
540 | - $ss->assign('currentGroupTab',$allGroup); |
|
540 | + $ss->assign('currentGroupTab', $allGroup); |
|
541 | 541 | $currentGroupTab = $allGroup; |
542 | 542 | $usersGroup = $current_user->getPreference('theme_current_group'); |
543 | 543 | // Figure out which tab they currently have selected (stored as a user preference) |
544 | - if ( !empty($usersGroup) && isset($groupTabs[$usersGroup]) ) { |
|
544 | + if (!empty($usersGroup) && isset($groupTabs[$usersGroup])) { |
|
545 | 545 | $currentGroupTab = $usersGroup; |
546 | 546 | } else { |
547 | - $current_user->setPreference('theme_current_group',$currentGroupTab); |
|
547 | + $current_user->setPreference('theme_current_group', $currentGroupTab); |
|
548 | 548 | } |
549 | 549 | |
550 | - $ss->assign('currentGroupTab',$currentGroupTab); |
|
550 | + $ss->assign('currentGroupTab', $currentGroupTab); |
|
551 | 551 | $usingGroupTabs = true; |
552 | 552 | |
553 | 553 | } else { |
554 | 554 | // Setup the default group tab. |
555 | - $ss->assign('currentGroupTab',$app_strings['LBL_TABGROUP_ALL']); |
|
555 | + $ss->assign('currentGroupTab', $app_strings['LBL_TABGROUP_ALL']); |
|
556 | 556 | |
557 | 557 | $usingGroupTabs = false; |
558 | 558 | |
@@ -564,31 +564,31 @@ discard block |
||
564 | 564 | $topTabList = array(); |
565 | 565 | |
566 | 566 | // Now time to go through each of the tab sets and fix them up. |
567 | - foreach ( $groupTabs as $tabIdx => $tabData ) { |
|
567 | + foreach ($groupTabs as $tabIdx => $tabData) { |
|
568 | 568 | $topTabs = $tabData['modules']; |
569 | - if ( ! is_array($topTabs) ) { |
|
569 | + if (!is_array($topTabs)) { |
|
570 | 570 | $topTabs = array(); |
571 | 571 | } |
572 | 572 | $extraTabs = array(); |
573 | 573 | |
574 | 574 | // Split it in to the tabs that go across the top, and the ones that are on the extra menu. |
575 | - if ( count($topTabs) > $max_tabs ) { |
|
576 | - $extraTabs = array_splice($topTabs,$max_tabs); |
|
575 | + if (count($topTabs) > $max_tabs) { |
|
576 | + $extraTabs = array_splice($topTabs, $max_tabs); |
|
577 | 577 | } |
578 | 578 | // Make sure the current module is accessable through one of the top tabs |
579 | - if ( !isset($topTabs[$moduleTab]) ) { |
|
579 | + if (!isset($topTabs[$moduleTab])) { |
|
580 | 580 | // Nope, we need to add it. |
581 | 581 | // First, take it out of the extra menu, if it's there |
582 | - if ( isset($extraTabs[$moduleTab]) ) { |
|
582 | + if (isset($extraTabs[$moduleTab])) { |
|
583 | 583 | unset($extraTabs[$moduleTab]); |
584 | 584 | } |
585 | - if ( count($topTabs) >= $max_tabs - 1 ) { |
|
585 | + if (count($topTabs) >= $max_tabs - 1) { |
|
586 | 586 | // We already have the maximum number of tabs, so we need to shuffle the last one |
587 | 587 | // from the top to the first one of the extras |
588 | - $lastElem = array_splice($topTabs,$max_tabs-1); |
|
588 | + $lastElem = array_splice($topTabs, $max_tabs - 1); |
|
589 | 589 | $extraTabs = $lastElem + $extraTabs; |
590 | 590 | } |
591 | - if ( !empty($moduleTab) ) { |
|
591 | + if (!empty($moduleTab)) { |
|
592 | 592 | $topTabs[$moduleTab] = $app_list_strings['moduleList'][$moduleTab]; |
593 | 593 | } |
594 | 594 | } |
@@ -607,7 +607,7 @@ discard block |
||
607 | 607 | */ |
608 | 608 | |
609 | 609 | // Get a unique list of the top tabs so we can build the popup menus for them |
610 | - foreach ( $topTabs as $moduleKey => $module ) { |
|
610 | + foreach ($topTabs as $moduleKey => $module) { |
|
611 | 611 | $topTabList[$moduleKey] = $module; |
612 | 612 | } |
613 | 613 | |
@@ -616,67 +616,67 @@ discard block |
||
616 | 616 | } |
617 | 617 | } |
618 | 618 | |
619 | - if ( isset($topTabList) && is_array($topTabList) ) { |
|
619 | + if (isset($topTabList) && is_array($topTabList)) { |
|
620 | 620 | // Adding shortcuts array to menu array for displaying shortcuts associated with each module |
621 | 621 | $shortcutTopMenu = array(); |
622 | - foreach($topTabList as $module_key => $label) { |
|
622 | + foreach ($topTabList as $module_key => $label) { |
|
623 | 623 | global $mod_strings; |
624 | 624 | $mod_strings = return_module_language($current_language, $module_key); |
625 | - foreach ( $this->getMenu($module_key) as $key => $menu_item ) { |
|
625 | + foreach ($this->getMenu($module_key) as $key => $menu_item) { |
|
626 | 626 | $shortcutTopMenu[$module_key][$key] = array( |
627 | 627 | "URL" => $menu_item[0], |
628 | 628 | "LABEL" => $menu_item[1], |
629 | 629 | "MODULE_NAME" => $menu_item[2], |
630 | 630 | "IMAGE" => $themeObject |
631 | - ->getImage($menu_item[2],"border='0' align='absmiddle'",null,null,'.gif',$menu_item[1]), |
|
631 | + ->getImage($menu_item[2], "border='0' align='absmiddle'", null, null, '.gif', $menu_item[1]), |
|
632 | 632 | "ID" => $menu_item[2]."_link", |
633 | 633 | ); |
634 | 634 | } |
635 | 635 | } |
636 | - if(!empty($sugar_config['lock_homepage']) && $sugar_config['lock_homepage'] == true) $ss->assign('lock_homepage', true); |
|
637 | - $ss->assign("groupTabs",$groupTabs); |
|
638 | - $ss->assign("shortcutTopMenu",$shortcutTopMenu); |
|
639 | - $ss->assign('USE_GROUP_TABS',$usingGroupTabs); |
|
636 | + if (!empty($sugar_config['lock_homepage']) && $sugar_config['lock_homepage'] == true) $ss->assign('lock_homepage', true); |
|
637 | + $ss->assign("groupTabs", $groupTabs); |
|
638 | + $ss->assign("shortcutTopMenu", $shortcutTopMenu); |
|
639 | + $ss->assign('USE_GROUP_TABS', $usingGroupTabs); |
|
640 | 640 | |
641 | 641 | // This is here for backwards compatibility, someday, somewhere, it will be able to be removed |
642 | - $ss->assign("moduleTopMenu",$groupTabs[$app_strings['LBL_TABGROUP_ALL']]['modules']); |
|
643 | - $ss->assign("moduleExtraMenu",$groupTabs[$app_strings['LBL_TABGROUP_ALL']]['extra']); |
|
642 | + $ss->assign("moduleTopMenu", $groupTabs[$app_strings['LBL_TABGROUP_ALL']]['modules']); |
|
643 | + $ss->assign("moduleExtraMenu", $groupTabs[$app_strings['LBL_TABGROUP_ALL']]['extra']); |
|
644 | 644 | |
645 | 645 | |
646 | 646 | } |
647 | 647 | |
648 | - if ( isset($extraTabs) && is_array($extraTabs) ) { |
|
648 | + if (isset($extraTabs) && is_array($extraTabs)) { |
|
649 | 649 | // Adding shortcuts array to extra menu array for displaying shortcuts associated with each module |
650 | 650 | $shortcutExtraMenu = array(); |
651 | - foreach($extraTabs as $module_key => $label) { |
|
651 | + foreach ($extraTabs as $module_key => $label) { |
|
652 | 652 | global $mod_strings; |
653 | 653 | $mod_strings = return_module_language($current_language, $module_key); |
654 | - foreach ( $this->getMenu($module_key) as $key => $menu_item ) { |
|
654 | + foreach ($this->getMenu($module_key) as $key => $menu_item) { |
|
655 | 655 | $shortcutExtraMenu[$module_key][$key] = array( |
656 | 656 | "URL" => $menu_item[0], |
657 | 657 | "LABEL" => $menu_item[1], |
658 | 658 | "MODULE_NAME" => $menu_item[2], |
659 | 659 | "IMAGE" => $themeObject |
660 | - ->getImage($menu_item[2],"border='0' align='absmiddle'",null,null,'.gif',$menu_item[1]), |
|
660 | + ->getImage($menu_item[2], "border='0' align='absmiddle'", null, null, '.gif', $menu_item[1]), |
|
661 | 661 | "ID" => $menu_item[2]."_link", |
662 | 662 | ); |
663 | 663 | } |
664 | 664 | } |
665 | - $ss->assign("shortcutExtraMenu",$shortcutExtraMenu); |
|
665 | + $ss->assign("shortcutExtraMenu", $shortcutExtraMenu); |
|
666 | 666 | } |
667 | 667 | |
668 | - if(!empty($current_user)){ |
|
668 | + if (!empty($current_user)) { |
|
669 | 669 | $ss->assign("max_tabs", $current_user->getPreference("max_tabs")); |
670 | 670 | } |
671 | 671 | |
672 | 672 | |
673 | 673 | $imageURL = SugarThemeRegistry::current()->getImageURL("dashboard.png"); |
674 | 674 | $homeImage = "<img src='$imageURL'>"; |
675 | - $ss->assign("homeImage",$homeImage); |
|
675 | + $ss->assign("homeImage", $homeImage); |
|
676 | 676 | global $mod_strings; |
677 | 677 | $mod_strings = $bakModStrings; |
678 | 678 | $headerTpl = $themeObject->getTemplate('header.tpl'); |
679 | - if (inDeveloperMode() ) |
|
679 | + if (inDeveloperMode()) |
|
680 | 680 | $ss->clear_compiled_tpl($headerTpl); |
681 | 681 | |
682 | 682 | if ($retModTabs) |
@@ -688,9 +688,9 @@ discard block |
||
688 | 688 | $this->includeClassicFile('modules/Administration/DisplayWarnings.php'); |
689 | 689 | |
690 | 690 | $errorMessages = SugarApplication::getErrorMessages(); |
691 | - if ( !empty($errorMessages)) { |
|
692 | - foreach ( $errorMessages as $error_message ) { |
|
693 | - echo('<p class="error">' . $error_message.'</p>'); |
|
691 | + if (!empty($errorMessages)) { |
|
692 | + foreach ($errorMessages as $error_message) { |
|
693 | + echo('<p class="error">'.$error_message.'</p>'); |
|
694 | 694 | } |
695 | 695 | } |
696 | 696 | } |
@@ -725,13 +725,13 @@ discard block |
||
725 | 725 | { |
726 | 726 | global $sugar_config, $timedate; |
727 | 727 | |
728 | - if(isset($this->bean->module_dir)){ |
|
728 | + if (isset($this->bean->module_dir)) { |
|
729 | 729 | echo "<script>var module_sugar_grp1 = '{$this->bean->module_dir}';</script>"; |
730 | 730 | } |
731 | - if(isset($_REQUEST['action'])){ |
|
731 | + if (isset($_REQUEST['action'])) { |
|
732 | 732 | echo "<script>var action_sugar_grp1 = '{$_REQUEST['action']}';</script>"; |
733 | 733 | } |
734 | - echo '<script>jscal_today = 1000*' . $timedate->asUserTs($timedate->getNow()) . '; if(typeof app_strings == "undefined") app_strings = new Array();</script>'; |
|
734 | + echo '<script>jscal_today = 1000*'.$timedate->asUserTs($timedate->getNow()).'; if(typeof app_strings == "undefined") app_strings = new Array();</script>'; |
|
735 | 735 | if (!is_file(sugar_cached("include/javascript/sugar_grp1.js"))) { |
736 | 736 | $_REQUEST['root_directory'] = "."; |
737 | 737 | require_once("jssource/minify_utils.php"); |
@@ -747,7 +747,7 @@ discard block |
||
747 | 747 | if ( typeof(SUGAR.themes) == 'undefined' ) SUGAR.themes = {}; |
748 | 748 | </script> |
749 | 749 | EOQ; |
750 | - if(isset( $sugar_config['disc_client']) && $sugar_config['disc_client']) |
|
750 | + if (isset($sugar_config['disc_client']) && $sugar_config['disc_client']) |
|
751 | 751 | echo getVersionedScript('modules/Sync/headersync.js'); |
752 | 752 | } |
753 | 753 | |
@@ -776,13 +776,13 @@ discard block |
||
776 | 776 | require_once ('modules/Currencies/Currency.php'); |
777 | 777 | list ($num_grp_sep, $dec_sep) = get_number_seperators(); |
778 | 778 | |
779 | - $the_script = "<script type=\"text/javascript\">\n" . "\tvar time_reg_format = '" . |
|
780 | - $timereg['format'] . "';\n" . "\tvar date_reg_format = '" . |
|
781 | - $datereg['format'] . "';\n" . "\tvar date_reg_positions = { $date_pos };\n" . |
|
782 | - "\tvar time_separator = '$time_separator';\n" . |
|
783 | - "\tvar cal_date_format = '$cal_date_format';\n" . |
|
784 | - "\tvar time_offset = $hour_offset;\n" . "\tvar num_grp_sep = '$num_grp_sep';\n" . |
|
785 | - "\tvar dec_sep = '$dec_sep';\n" . "</script>"; |
|
779 | + $the_script = "<script type=\"text/javascript\">\n"."\tvar time_reg_format = '". |
|
780 | + $timereg['format']."';\n"."\tvar date_reg_format = '". |
|
781 | + $datereg['format']."';\n"."\tvar date_reg_positions = { $date_pos };\n". |
|
782 | + "\tvar time_separator = '$time_separator';\n". |
|
783 | + "\tvar cal_date_format = '$cal_date_format';\n". |
|
784 | + "\tvar time_offset = $hour_offset;\n"."\tvar num_grp_sep = '$num_grp_sep';\n". |
|
785 | + "\tvar dec_sep = '$dec_sep';\n"."</script>"; |
|
786 | 786 | |
787 | 787 | return $the_script; |
788 | 788 | } |
@@ -810,13 +810,13 @@ discard block |
||
810 | 810 | "sugar_cache_dir" => "cache/", |
811 | 811 | ); |
812 | 812 | |
813 | - if(isset($this->bean->module_dir)){ |
|
813 | + if (isset($this->bean->module_dir)) { |
|
814 | 814 | $js_vars['module_sugar_grp1'] = $this->bean->module_dir; |
815 | 815 | } |
816 | - if(isset($_REQUEST['action'])){ |
|
816 | + if (isset($_REQUEST['action'])) { |
|
817 | 817 | $js_vars['action_sugar_grp1'] = $_REQUEST['action']; |
818 | 818 | } |
819 | - echo '<script>jscal_today = 1000*' . $timedate->asUserTs($timedate->getNow()) . '; if(typeof app_strings == "undefined") app_strings = new Array();</script>'; |
|
819 | + echo '<script>jscal_today = 1000*'.$timedate->asUserTs($timedate->getNow()).'; if(typeof app_strings == "undefined") app_strings = new Array();</script>'; |
|
820 | 820 | if (!is_file(sugar_cached("include/javascript/sugar_grp1.js")) || !is_file(sugar_cached("include/javascript/sugar_grp1_yui.js")) || !is_file(sugar_cached("include/javascript/sugar_grp1_jquery.js"))) { |
821 | 821 | $_REQUEST['root_directory'] = "."; |
822 | 822 | require_once("jssource/minify_utils.php"); |
@@ -829,33 +829,33 @@ discard block |
||
829 | 829 | |
830 | 830 | // output necessary config js in the top of the page |
831 | 831 | $config_js = $this->getSugarConfigJS(); |
832 | - if(!empty($config_js)){ |
|
832 | + if (!empty($config_js)) { |
|
833 | 833 | echo "<script>\n".implode("\n", $config_js)."</script>\n"; |
834 | 834 | } |
835 | 835 | |
836 | - if ( isset($sugar_config['email_sugarclient_listviewmaxselect']) ) { |
|
836 | + if (isset($sugar_config['email_sugarclient_listviewmaxselect'])) { |
|
837 | 837 | echo "<script>SUGAR.config.email_sugarclient_listviewmaxselect = {$GLOBALS['sugar_config']['email_sugarclient_listviewmaxselect']};</script>"; |
838 | 838 | } |
839 | 839 | |
840 | - $image_server = (defined('TEMPLATE_URL'))?TEMPLATE_URL . '/':''; |
|
841 | - echo '<script type="text/javascript">SUGAR.themes.image_server="' . $image_server . '";</script>'; // cn: bug 12274 - create session-stored key to defend against CSRF |
|
842 | - echo '<script type="text/javascript">var name_format = "' . $locale->getLocaleFormatMacro() . '";</script>'; |
|
840 | + $image_server = (defined('TEMPLATE_URL')) ? TEMPLATE_URL.'/' : ''; |
|
841 | + echo '<script type="text/javascript">SUGAR.themes.image_server="'.$image_server.'";</script>'; // cn: bug 12274 - create session-stored key to defend against CSRF |
|
842 | + echo '<script type="text/javascript">var name_format = "'.$locale->getLocaleFormatMacro().'";</script>'; |
|
843 | 843 | echo self::getJavascriptValidation(); |
844 | - if (!is_file(sugar_cached('jsLanguage/') . $GLOBALS['current_language'] . '.js')) { |
|
844 | + if (!is_file(sugar_cached('jsLanguage/').$GLOBALS['current_language'].'.js')) { |
|
845 | 845 | require_once ('include/language/jsLanguage.php'); |
846 | 846 | jsLanguage::createAppStringsCache($GLOBALS['current_language']); |
847 | 847 | } |
848 | - echo getVersionedScript('cache/jsLanguage/'. $GLOBALS['current_language'] . '.js', $GLOBALS['sugar_config']['js_lang_version']); |
|
848 | + echo getVersionedScript('cache/jsLanguage/'.$GLOBALS['current_language'].'.js', $GLOBALS['sugar_config']['js_lang_version']); |
|
849 | 849 | |
850 | 850 | echo $this->_getModLanguageJS(); |
851 | 851 | |
852 | - if(isset( $sugar_config['disc_client']) && $sugar_config['disc_client']) |
|
852 | + if (isset($sugar_config['disc_client']) && $sugar_config['disc_client']) |
|
853 | 853 | echo getVersionedScript('modules/Sync/headersync.js'); |
854 | 854 | |
855 | 855 | |
856 | 856 | //echo out the $js_vars variables as javascript variables |
857 | 857 | echo "<script type='text/javascript'>\n"; |
858 | - foreach($js_vars as $var=>$value) |
|
858 | + foreach ($js_vars as $var=>$value) |
|
859 | 859 | { |
860 | 860 | echo "var {$var} = '{$value}';\n"; |
861 | 861 | } |
@@ -863,12 +863,12 @@ discard block |
||
863 | 863 | } |
864 | 864 | } |
865 | 865 | |
866 | - protected function _getModLanguageJS(){ |
|
867 | - if (!is_file(sugar_cached('jsLanguage/') . $this->module . '/' . $GLOBALS['current_language'] . '.js')) { |
|
866 | + protected function _getModLanguageJS() { |
|
867 | + if (!is_file(sugar_cached('jsLanguage/').$this->module.'/'.$GLOBALS['current_language'].'.js')) { |
|
868 | 868 | require_once ('include/language/jsLanguage.php'); |
869 | 869 | jsLanguage::createModuleStringsCache($this->module, $GLOBALS['current_language']); |
870 | 870 | } |
871 | - return getVersionedScript("cache/jsLanguage/{$this->module}/". $GLOBALS['current_language'] . '.js', $GLOBALS['sugar_config']['js_lang_version']); |
|
871 | + return getVersionedScript("cache/jsLanguage/{$this->module}/".$GLOBALS['current_language'].'.js', $GLOBALS['sugar_config']['js_lang_version']); |
|
872 | 872 | } |
873 | 873 | |
874 | 874 | /** |
@@ -890,8 +890,8 @@ discard block |
||
890 | 890 | } |
891 | 891 | |
892 | 892 | $ss = new Sugar_Smarty(); |
893 | - $ss->assign("AUTHENTICATED",isset($_SESSION["authenticated_user_id"])); |
|
894 | - $ss->assign('MOD',return_module_language($GLOBALS['current_language'], 'Users')); |
|
893 | + $ss->assign("AUTHENTICATED", isset($_SESSION["authenticated_user_id"])); |
|
894 | + $ss->assign('MOD', return_module_language($GLOBALS['current_language'], 'Users')); |
|
895 | 895 | |
896 | 896 | $bottomLinkList = array(); |
897 | 897 | if (isset($this->action) && $this->action != "EditView") { |
@@ -900,11 +900,11 @@ discard block |
||
900 | 900 | $bottomLinkList['backtotop'] = array($app_strings['LNK_BACKTOTOP'] => 'javascript:SUGAR.util.top();'); |
901 | 901 | |
902 | 902 | $bottomLinksStr = ""; |
903 | - foreach($bottomLinkList as $key => $value) { |
|
904 | - foreach($value as $text => $link) { |
|
903 | + foreach ($bottomLinkList as $key => $value) { |
|
904 | + foreach ($value as $text => $link) { |
|
905 | 905 | $href = $link; |
906 | - if(substr($link, 0, 11) == "javascript:") { |
|
907 | - $onclick = " onclick=\"".substr($link,11)."\""; |
|
906 | + if (substr($link, 0, 11) == "javascript:") { |
|
907 | + $onclick = " onclick=\"".substr($link, 11)."\""; |
|
908 | 908 | $href = "javascript:void(0)"; |
909 | 909 | } else { |
910 | 910 | $onclick = ""; |
@@ -916,9 +916,9 @@ discard block |
||
916 | 916 | $bottomLinksStr .= " ".$text."</a>"; |
917 | 917 | } |
918 | 918 | } |
919 | - $ss->assign("BOTTOMLINKS",$bottomLinksStr); |
|
919 | + $ss->assign("BOTTOMLINKS", $bottomLinksStr); |
|
920 | 920 | if (SugarConfig::getInstance()->get('calculate_response_time', false)) |
921 | - $ss->assign('STATISTICS',$this->_getStatistics()); |
|
921 | + $ss->assign('STATISTICS', $this->_getStatistics()); |
|
922 | 922 | |
923 | 923 | // Under the License referenced above, you are required to leave in all copyright statements in both |
924 | 924 | // the code and end-user application. |
@@ -952,7 +952,7 @@ discard block |
||
952 | 952 | $companyLogoURL = $companyLogoURL_arr[0]; |
953 | 953 | |
954 | 954 | $company_logo_attributes = sugar_cache_retrieve('company_logo_attributes'); |
955 | - if(!empty($company_logo_attributes)) { |
|
955 | + if (!empty($company_logo_attributes)) { |
|
956 | 956 | $ss->assign("COMPANY_LOGO_MD5", $company_logo_attributes[0]); |
957 | 957 | $ss->assign("COMPANY_LOGO_WIDTH", $company_logo_attributes[1]); |
958 | 958 | $ss->assign("COMPANY_LOGO_HEIGHT", $company_logo_attributes[2]); |
@@ -961,16 +961,16 @@ discard block |
||
961 | 961 | // Always need to md5 the file |
962 | 962 | $ss->assign("COMPANY_LOGO_MD5", md5_file($companyLogoURL)); |
963 | 963 | |
964 | - list($width,$height) = getimagesize($companyLogoURL); |
|
965 | - if ( $width > 212 || $height > 40 ) { |
|
966 | - $resizePctWidth = ($width - 212)/212; |
|
967 | - $resizePctHeight = ($height - 40)/40; |
|
968 | - if ( $resizePctWidth > $resizePctHeight ) |
|
964 | + list($width, $height) = getimagesize($companyLogoURL); |
|
965 | + if ($width > 212 || $height > 40) { |
|
966 | + $resizePctWidth = ($width - 212) / 212; |
|
967 | + $resizePctHeight = ($height - 40) / 40; |
|
968 | + if ($resizePctWidth > $resizePctHeight) |
|
969 | 969 | $resizeAmount = $width / 212; |
970 | 970 | else |
971 | 971 | $resizeAmount = $height / 40; |
972 | - $ss->assign("COMPANY_LOGO_WIDTH", round($width * (1/$resizeAmount))); |
|
973 | - $ss->assign("COMPANY_LOGO_HEIGHT", round($height * (1/$resizeAmount))); |
|
972 | + $ss->assign("COMPANY_LOGO_WIDTH", round($width * (1 / $resizeAmount))); |
|
973 | + $ss->assign("COMPANY_LOGO_HEIGHT", round($height * (1 / $resizeAmount))); |
|
974 | 974 | } |
975 | 975 | else { |
976 | 976 | $ss->assign("COMPANY_LOGO_WIDTH", $width); |
@@ -986,28 +986,28 @@ discard block |
||
986 | 986 | ) |
987 | 987 | ); |
988 | 988 | } |
989 | - $ss->assign("COMPANY_LOGO_URL",getJSPath($companyLogoURL)."&logo_md5=".$ss->get_template_vars("COMPANY_LOGO_MD5")); |
|
989 | + $ss->assign("COMPANY_LOGO_URL", getJSPath($companyLogoURL)."&logo_md5=".$ss->get_template_vars("COMPANY_LOGO_MD5")); |
|
990 | 990 | |
991 | 991 | // Bug 38594 - Add in Trademark wording |
992 | 992 | $copyright .= 'SugarCRM is a trademark of SugarCRM, Inc. All other company and product names may be trademarks of the respective companies with which they are associated.<br />'; |
993 | 993 | |
994 | 994 | //rrs bug: 20923 - if this image does not exist as per the license, then the proper image will be displayed regardless, so no need |
995 | 995 | //to display an empty image here. |
996 | - if(file_exists('include/images/poweredby_sugarcrm_65.png')){ |
|
996 | + if (file_exists('include/images/poweredby_sugarcrm_65.png')) { |
|
997 | 997 | $copyright .= $attribLinkImg; |
998 | 998 | } |
999 | 999 | // End Required Image |
1000 | - $ss->assign('COPYRIGHT',$copyright); |
|
1000 | + $ss->assign('COPYRIGHT', $copyright); |
|
1001 | 1001 | |
1002 | 1002 | // here we allocate the help link data |
1003 | 1003 | $help_actions_blacklist = array('Login'); // we don't want to show a context help link here |
1004 | - if (!in_array($this->action,$help_actions_blacklist)) { |
|
1004 | + if (!in_array($this->action, $help_actions_blacklist)) { |
|
1005 | 1005 | $url = 'javascript:void(window.open(\'index.php?module=Administration&action=SupportPortal&view=documentation&version='.$GLOBALS['sugar_version'].'&edition='.$GLOBALS['sugar_flavor'].'&lang='.$GLOBALS['current_language']. |
1006 | 1006 | '&help_module='.$this->module.'&help_action='.$this->action.'&key='.$GLOBALS['server_unique_key'].'\'))'; |
1007 | 1007 | $label = (isset($GLOBALS['app_list_strings']['moduleList'][$this->module]) ? |
1008 | - $GLOBALS['app_list_strings']['moduleList'][$this->module] : $this->module). ' '.$app_strings['LNK_HELP']; |
|
1009 | - $ss->assign('HELP_LINK',SugarThemeRegistry::current()->getLink($url, $label, "id='help_link_two'", |
|
1010 | - 'help-dashlet.png', 'class="icon"',null,null,'','left')); |
|
1008 | + $GLOBALS['app_list_strings']['moduleList'][$this->module] : $this->module).' '.$app_strings['LNK_HELP']; |
|
1009 | + $ss->assign('HELP_LINK', SugarThemeRegistry::current()->getLink($url, $label, "id='help_link_two'", |
|
1010 | + 'help-dashlet.png', 'class="icon"', null, null, '', 'left')); |
|
1011 | 1011 | } |
1012 | 1012 | // end |
1013 | 1013 | |
@@ -1020,7 +1020,7 @@ discard block |
||
1020 | 1020 | */ |
1021 | 1021 | protected function _displaySubPanels() |
1022 | 1022 | { |
1023 | - if (isset($this->bean) && !empty($this->bean->id) && (file_exists('modules/' . $this->module . '/metadata/subpaneldefs.php') || file_exists('custom/modules/' . $this->module . '/metadata/subpaneldefs.php') || file_exists('custom/modules/' . $this->module . '/Ext/Layoutdefs/layoutdefs.ext.php'))) { |
|
1023 | + if (isset($this->bean) && !empty($this->bean->id) && (file_exists('modules/'.$this->module.'/metadata/subpaneldefs.php') || file_exists('custom/modules/'.$this->module.'/metadata/subpaneldefs.php') || file_exists('custom/modules/'.$this->module.'/Ext/Layoutdefs/layoutdefs.ext.php'))) { |
|
1024 | 1024 | $GLOBALS['focus'] = $this->bean; |
1025 | 1025 | require_once ('include/SubPanel/SubPanelTiles.php'); |
1026 | 1026 | $subpanel = new SubPanelTiles($this->bean, $this->module); |
@@ -1078,7 +1078,7 @@ discard block |
||
1078 | 1078 | */ |
1079 | 1079 | protected function _checkModule() |
1080 | 1080 | { |
1081 | - if(!empty($this->module) && !file_exists('modules/'.$this->module)){ |
|
1081 | + if (!empty($this->module) && !file_exists('modules/'.$this->module)) { |
|
1082 | 1082 | $error = str_replace("[module]", "$this->module", $GLOBALS['app_strings']['ERR_CANNOT_FIND_MODULE']); |
1083 | 1083 | $GLOBALS['log']->fatal($error); |
1084 | 1084 | echo $error; |
@@ -1107,7 +1107,7 @@ discard block |
||
1107 | 1107 | { |
1108 | 1108 | $endTime = microtime(true); |
1109 | 1109 | $deltaTime = $endTime - $GLOBALS['startTime']; |
1110 | - $response_time_string = $GLOBALS['app_strings']['LBL_SERVER_RESPONSE_TIME'] . ' ' . number_format(round($deltaTime, 2), 2) . ' ' . $GLOBALS['app_strings']['LBL_SERVER_RESPONSE_TIME_SECONDS']; |
|
1110 | + $response_time_string = $GLOBALS['app_strings']['LBL_SERVER_RESPONSE_TIME'].' '.number_format(round($deltaTime, 2), 2).' '.$GLOBALS['app_strings']['LBL_SERVER_RESPONSE_TIME_SECONDS']; |
|
1111 | 1111 | $return = $response_time_string; |
1112 | 1112 | // $return .= '<br />'; |
1113 | 1113 | if (!empty($GLOBALS['sugar_config']['show_page_resources'])) { |
@@ -1118,16 +1118,16 @@ discard block |
||
1118 | 1118 | // I believe the full get_include_files result set appears to have one entry for each file in real |
1119 | 1119 | // case, and one entry in all lower case. |
1120 | 1120 | $list_of_files_case_insensitive = array(); |
1121 | - foreach($included_files as $key => $name) { |
|
1121 | + foreach ($included_files as $key => $name) { |
|
1122 | 1122 | // preserve the first capitalization encountered. |
1123 | - $list_of_files_case_insensitive[mb_strtolower($name) ] = $name; |
|
1123 | + $list_of_files_case_insensitive[mb_strtolower($name)] = $name; |
|
1124 | 1124 | } |
1125 | - $return .= $GLOBALS['app_strings']['LBL_SERVER_RESPONSE_RESOURCES'] . '(' . DBManager::getQueryCount() . ',' . sizeof($list_of_files_case_insensitive) . ')<br>'; |
|
1125 | + $return .= $GLOBALS['app_strings']['LBL_SERVER_RESPONSE_RESOURCES'].'('.DBManager::getQueryCount().','.sizeof($list_of_files_case_insensitive).')<br>'; |
|
1126 | 1126 | // Display performance of the internal and external caches.... |
1127 | 1127 | $cacheStats = SugarCache::instance()->getCacheStats(); |
1128 | - $return .= "External cache (hits/total=ratio) local ({$cacheStats['localHits']}/{$cacheStats['requests']}=" . round($cacheStats['localHits']*100/$cacheStats['requests'], 0) . "%)"; |
|
1129 | - $return .= " external ({$cacheStats['externalHits']}/{$cacheStats['requests']}=" . round($cacheStats['externalHits']*100/$cacheStats['requests'], 0) . "%)<br />"; |
|
1130 | - $return .= " misses ({$cacheStats['misses']}/{$cacheStats['requests']}=" . round($cacheStats['misses']*100/$cacheStats['requests'], 0) . "%)<br />"; |
|
1128 | + $return .= "External cache (hits/total=ratio) local ({$cacheStats['localHits']}/{$cacheStats['requests']}=".round($cacheStats['localHits'] * 100 / $cacheStats['requests'], 0)."%)"; |
|
1129 | + $return .= " external ({$cacheStats['externalHits']}/{$cacheStats['requests']}=".round($cacheStats['externalHits'] * 100 / $cacheStats['requests'], 0)."%)<br />"; |
|
1130 | + $return .= " misses ({$cacheStats['misses']}/{$cacheStats['requests']}=".round($cacheStats['misses'] * 100 / $cacheStats['requests'], 0)."%)<br />"; |
|
1131 | 1131 | } |
1132 | 1132 | |
1133 | 1133 | $return .= $this->logMemoryStatistics(); |
@@ -1144,37 +1144,36 @@ discard block |
||
1144 | 1144 | * @param $newline String of newline character to use (defaults to </ br>) |
1145 | 1145 | * @return $message String formatted message about memory statistics |
1146 | 1146 | */ |
1147 | - protected function logMemoryStatistics($newline='<br>') |
|
1147 | + protected function logMemoryStatistics($newline = '<br>') |
|
1148 | 1148 | { |
1149 | 1149 | $log_message = ''; |
1150 | 1150 | |
1151 | - if(!empty($GLOBALS['sugar_config']['log_memory_usage'])) |
|
1151 | + if (!empty($GLOBALS['sugar_config']['log_memory_usage'])) |
|
1152 | 1152 | { |
1153 | - if(function_exists('memory_get_usage')) |
|
1153 | + if (function_exists('memory_get_usage')) |
|
1154 | 1154 | { |
1155 | 1155 | $memory_usage = memory_get_usage(); |
1156 | 1156 | $bytes = $GLOBALS['app_strings']['LBL_SERVER_MEMORY_BYTES']; |
1157 | 1157 | $data = array($memory_usage, $bytes); |
1158 | - $log_message = string_format($GLOBALS['app_strings']['LBL_SERVER_MEMORY_USAGE'], $data) . $newline; |
|
1158 | + $log_message = string_format($GLOBALS['app_strings']['LBL_SERVER_MEMORY_USAGE'], $data).$newline; |
|
1159 | 1159 | } |
1160 | 1160 | |
1161 | - if(function_exists('memory_get_peak_usage')) |
|
1161 | + if (function_exists('memory_get_peak_usage')) |
|
1162 | 1162 | { |
1163 | 1163 | $memory_peak_usage = memory_get_peak_usage(); |
1164 | 1164 | $bytes = $GLOBALS['app_strings']['LBL_SERVER_MEMORY_BYTES']; |
1165 | 1165 | $data = array($memory_peak_usage, $bytes); |
1166 | - $log_message .= string_format($GLOBALS['app_strings']['LBL_SERVER_PEAK_MEMORY_USAGE'], $data) . $newline; |
|
1166 | + $log_message .= string_format($GLOBALS['app_strings']['LBL_SERVER_PEAK_MEMORY_USAGE'], $data).$newline; |
|
1167 | 1167 | } |
1168 | 1168 | |
1169 | - if(!empty($log_message)) |
|
1169 | + if (!empty($log_message)) |
|
1170 | 1170 | { |
1171 | - $data = array |
|
1172 | - ( |
|
1171 | + $data = array( |
|
1173 | 1172 | !empty($this->module) ? $this->module : $GLOBALS['app_strings']['LBL_LINK_NONE'], |
1174 | 1173 | !empty($this->action) ? $this->action : $GLOBALS['app_strings']['LBL_LINK_NONE'], |
1175 | 1174 | ); |
1176 | 1175 | |
1177 | - $output = string_format($GLOBALS['app_strings']['LBL_SERVER_MEMORY_LOG_MESSAGE'], $data) . $newline; |
|
1176 | + $output = string_format($GLOBALS['app_strings']['LBL_SERVER_MEMORY_LOG_MESSAGE'], $data).$newline; |
|
1178 | 1177 | $output .= $log_message; |
1179 | 1178 | $fp = fopen("memory_usage.log", "ab"); |
1180 | 1179 | fwrite($fp, $output); |
@@ -1198,30 +1197,30 @@ discard block |
||
1198 | 1197 | { |
1199 | 1198 | global $current_language, $current_user, $mod_strings, $app_strings, $module_menu; |
1200 | 1199 | |
1201 | - if ( empty($module) ) |
|
1200 | + if (empty($module)) |
|
1202 | 1201 | $module = $this->module; |
1203 | 1202 | |
1204 | 1203 | //Need to make sure the mod_strings match the requested module or Menus may fail |
1205 | 1204 | $curr_mod_strings = $mod_strings; |
1206 | - $mod_strings = return_module_language ( $current_language, $module ) ; |
|
1205 | + $mod_strings = return_module_language($current_language, $module); |
|
1207 | 1206 | |
1208 | 1207 | $module_menu = array(); |
1209 | 1208 | |
1210 | - if (file_exists('modules/' . $module . '/Menu.php')) { |
|
1211 | - require('modules/' . $module . '/Menu.php'); |
|
1209 | + if (file_exists('modules/'.$module.'/Menu.php')) { |
|
1210 | + require('modules/'.$module.'/Menu.php'); |
|
1212 | 1211 | } |
1213 | - if (file_exists('custom/modules/' . $module . '/Ext/Menus/menu.ext.php')) { |
|
1214 | - require('custom/modules/' . $module . '/Ext/Menus/menu.ext.php'); |
|
1212 | + if (file_exists('custom/modules/'.$module.'/Ext/Menus/menu.ext.php')) { |
|
1213 | + require('custom/modules/'.$module.'/Ext/Menus/menu.ext.php'); |
|
1215 | 1214 | } |
1216 | - if (!file_exists('modules/' . $module . '/Menu.php') |
|
1217 | - && !file_exists('custom/modules/' . $module . '/Ext/Menus/menu.ext.php') |
|
1215 | + if (!file_exists('modules/'.$module.'/Menu.php') |
|
1216 | + && !file_exists('custom/modules/'.$module.'/Ext/Menus/menu.ext.php') |
|
1218 | 1217 | && !empty($GLOBALS['mod_strings']['LNK_NEW_RECORD'])) { |
1219 | 1218 | $module_menu[] = array("index.php?module=$module&action=EditView&return_module=$module&return_action=DetailView", |
1220 | - $GLOBALS['mod_strings']['LNK_NEW_RECORD'],"{$GLOBALS['app_strings']['LBL_CREATE_BUTTON_LABEL']}$module" ,$module ); |
|
1219 | + $GLOBALS['mod_strings']['LNK_NEW_RECORD'], "{$GLOBALS['app_strings']['LBL_CREATE_BUTTON_LABEL']}$module", $module); |
|
1221 | 1220 | $module_menu[] = array("index.php?module=$module&action=index", $GLOBALS['mod_strings']['LNK_LIST'], |
1222 | 1221 | $module, $module); |
1223 | - if ( ($this->bean instanceOf SugarBean) && !empty($this->bean->importable) ) |
|
1224 | - if ( !empty($mod_strings['LNK_IMPORT_'.strtoupper($module)]) ) |
|
1222 | + if (($this->bean instanceOf SugarBean) && !empty($this->bean->importable)) |
|
1223 | + if (!empty($mod_strings['LNK_IMPORT_'.strtoupper($module)])) |
|
1225 | 1224 | $module_menu[] = array("index.php?module=Import&action=Step1&import_module=$module&return_module=$module&return_action=index", |
1226 | 1225 | $mod_strings['LNK_IMPORT_'.strtoupper($module)], "Import", $module); |
1227 | 1226 | else |
@@ -1248,22 +1247,22 @@ discard block |
||
1248 | 1247 | |
1249 | 1248 | $userTabs = query_module_access_list($current_user); |
1250 | 1249 | //If the home tab is in the user array use it as the default tab, otherwise use the first element in the tab array |
1251 | - $defaultTab = (in_array("Home",$userTabs)) ? "Home" : key($userTabs); |
|
1250 | + $defaultTab = (in_array("Home", $userTabs)) ? "Home" : key($userTabs); |
|
1252 | 1251 | |
1253 | 1252 | // Need to figure out what tab this module belongs to, most modules have their own tabs, but there are exceptions. |
1254 | - if ( !empty($_REQUEST['module_tab']) ) |
|
1253 | + if (!empty($_REQUEST['module_tab'])) |
|
1255 | 1254 | return $_REQUEST['module_tab']; |
1256 | - elseif ( isset($moduleTabMap[$this->module]) ) |
|
1255 | + elseif (isset($moduleTabMap[$this->module])) |
|
1257 | 1256 | return $moduleTabMap[$this->module]; |
1258 | 1257 | // Special cases |
1259 | - elseif ( $this->module == 'MergeRecords' ) |
|
1258 | + elseif ($this->module == 'MergeRecords') |
|
1260 | 1259 | return !empty($_REQUEST['merge_module']) ? $_REQUEST['merge_module'] : $_REQUEST['return_module']; |
1261 | - elseif ( $this->module == 'Users' && $this->action == 'SetTimezone' ) |
|
1260 | + elseif ($this->module == 'Users' && $this->action == 'SetTimezone') |
|
1262 | 1261 | return $defaultTab; |
1263 | 1262 | // Default anonymous pages to be under Home |
1264 | - elseif ( !isset($app_list_strings['moduleList'][$this->module]) ) |
|
1263 | + elseif (!isset($app_list_strings['moduleList'][$this->module])) |
|
1265 | 1264 | return $defaultTab; |
1266 | - elseif ( isset($_REQUEST['action']) && $_REQUEST['action'] == "ajaxui" ) |
|
1265 | + elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == "ajaxui") |
|
1267 | 1266 | return $defaultTab; |
1268 | 1267 | else |
1269 | 1268 | return $this->module; |
@@ -1283,42 +1282,42 @@ discard block |
||
1283 | 1282 | |
1284 | 1283 | $theTitle = "<div class='moduleTitle'>\n"; |
1285 | 1284 | |
1286 | - $module = preg_replace("/ /","",$this->module); |
|
1285 | + $module = preg_replace("/ /", "", $this->module); |
|
1287 | 1286 | |
1288 | 1287 | $params = $this->_getModuleTitleParams(); |
1289 | 1288 | $index = 0; |
1290 | 1289 | |
1291 | - if(SugarThemeRegistry::current()->directionality == "rtl") { |
|
1290 | + if (SugarThemeRegistry::current()->directionality == "rtl") { |
|
1292 | 1291 | $params = array_reverse($params); |
1293 | 1292 | } |
1294 | - if(count($params) > 1) { |
|
1293 | + if (count($params) > 1) { |
|
1295 | 1294 | array_shift($params); |
1296 | 1295 | } |
1297 | 1296 | $count = count($params); |
1298 | 1297 | $paramString = ''; |
1299 | - foreach($params as $parm){ |
|
1298 | + foreach ($params as $parm) { |
|
1300 | 1299 | $index++; |
1301 | 1300 | $paramString .= $parm; |
1302 | - if($index < $count){ |
|
1301 | + if ($index < $count) { |
|
1303 | 1302 | $paramString .= $this->getBreadCrumbSymbol(); |
1304 | 1303 | } |
1305 | 1304 | } |
1306 | 1305 | |
1307 | - if(!empty($paramString)){ |
|
1306 | + if (!empty($paramString)) { |
|
1308 | 1307 | $theTitle .= "<h2> $paramString </h2>"; |
1309 | 1308 | |
1310 | - if($this->type == "detail"){ |
|
1311 | - $theTitle .= "<div class='favorite' record_id='" . $this->bean->id . "' module='" . $this->bean->module_dir . "'><div class='favorite_icon_outline'>" . SugarThemeRegistry::current()->getImage('favorite-star-outline','title="' . translate('LBL_DASHLET_EDIT', 'Home') . '" border="0" align="absmiddle"', null,null,'.gif',translate('LBL_DASHLET_EDIT', 'Home')) . "</div> |
|
1312 | - <div class='favorite_icon_fill'>" . SugarThemeRegistry::current()->getImage('favorite-star','title="' . translate('LBL_DASHLET_EDIT', 'Home') . '" border="0" align="absmiddle"', null,null,'.gif',translate('LBL_DASHLET_EDIT', 'Home')) . "</div></div>"; |
|
1309 | + if ($this->type == "detail") { |
|
1310 | + $theTitle .= "<div class='favorite' record_id='".$this->bean->id."' module='".$this->bean->module_dir."'><div class='favorite_icon_outline'>".SugarThemeRegistry::current()->getImage('favorite-star-outline', 'title="'.translate('LBL_DASHLET_EDIT', 'Home').'" border="0" align="absmiddle"', null, null, '.gif', translate('LBL_DASHLET_EDIT', 'Home'))."</div> |
|
1311 | + <div class='favorite_icon_fill'>" . SugarThemeRegistry::current()->getImage('favorite-star', 'title="'.translate('LBL_DASHLET_EDIT', 'Home').'" border="0" align="absmiddle"', null, null, '.gif', translate('LBL_DASHLET_EDIT', 'Home'))."</div></div>"; |
|
1313 | 1312 | } |
1314 | 1313 | } |
1315 | 1314 | |
1316 | 1315 | // bug 56131 - restore conditional so that link doesn't appear where it shouldn't |
1317 | - if($show_help || $this->type == 'list') { |
|
1316 | + if ($show_help || $this->type == 'list') { |
|
1318 | 1317 | $theTitle .= "<span class='utils'>"; |
1319 | 1318 | $createImageURL = SugarThemeRegistry::current()->getImageURL('create-record.gif'); |
1320 | - if($this->type == 'list') $theTitle .= '<a href="#" class="btn btn-success showsearch"><span class=" glyphicon glyphicon-search" aria-hidden="true"></span></a>';$url = ajaxLink("index.php?module=$module&action=EditView&return_module=$module&return_action=DetailView"); |
|
1321 | - if($show_help) { |
|
1319 | + if ($this->type == 'list') $theTitle .= '<a href="#" class="btn btn-success showsearch"><span class=" glyphicon glyphicon-search" aria-hidden="true"></span></a>'; $url = ajaxLink("index.php?module=$module&action=EditView&return_module=$module&return_action=DetailView"); |
|
1320 | + if ($show_help) { |
|
1322 | 1321 | $theTitle .= <<<EOHTML |
1323 | 1322 | |
1324 | 1323 | <a id="create_image" href="{$url}" class="utilsLink"> |
@@ -1344,31 +1343,31 @@ discard block |
||
1344 | 1343 | { |
1345 | 1344 | $metadataFile = null; |
1346 | 1345 | $foundViewDefs = false; |
1347 | - $viewDef = strtolower($this->type) . 'viewdefs'; |
|
1348 | - $coreMetaPath = 'modules/'.$this->module.'/metadata/' . $viewDef . '.php'; |
|
1349 | - if(file_exists('custom/' .$coreMetaPath )){ |
|
1350 | - $metadataFile = 'custom/' . $coreMetaPath; |
|
1346 | + $viewDef = strtolower($this->type).'viewdefs'; |
|
1347 | + $coreMetaPath = 'modules/'.$this->module.'/metadata/'.$viewDef.'.php'; |
|
1348 | + if (file_exists('custom/'.$coreMetaPath)) { |
|
1349 | + $metadataFile = 'custom/'.$coreMetaPath; |
|
1351 | 1350 | $foundViewDefs = true; |
1352 | - }else{ |
|
1353 | - if(file_exists('custom/modules/'.$this->module.'/metadata/metafiles.php')){ |
|
1351 | + } else { |
|
1352 | + if (file_exists('custom/modules/'.$this->module.'/metadata/metafiles.php')) { |
|
1354 | 1353 | require_once('custom/modules/'.$this->module.'/metadata/metafiles.php'); |
1355 | - if(!empty($metafiles[$this->module][$viewDef])){ |
|
1354 | + if (!empty($metafiles[$this->module][$viewDef])) { |
|
1356 | 1355 | $metadataFile = $metafiles[$this->module][$viewDef]; |
1357 | 1356 | $foundViewDefs = true; |
1358 | 1357 | } |
1359 | - }elseif(file_exists('modules/'.$this->module.'/metadata/metafiles.php')){ |
|
1358 | + }elseif (file_exists('modules/'.$this->module.'/metadata/metafiles.php')) { |
|
1360 | 1359 | require_once('modules/'.$this->module.'/metadata/metafiles.php'); |
1361 | - if(!empty($metafiles[$this->module][$viewDef])){ |
|
1360 | + if (!empty($metafiles[$this->module][$viewDef])) { |
|
1362 | 1361 | $metadataFile = $metafiles[$this->module][$viewDef]; |
1363 | 1362 | $foundViewDefs = true; |
1364 | 1363 | } |
1365 | 1364 | } |
1366 | 1365 | } |
1367 | 1366 | |
1368 | - if(!$foundViewDefs && file_exists($coreMetaPath)){ |
|
1367 | + if (!$foundViewDefs && file_exists($coreMetaPath)) { |
|
1369 | 1368 | $metadataFile = $coreMetaPath; |
1370 | 1369 | } |
1371 | - $GLOBALS['log']->debug("metadatafile=". $metadataFile); |
|
1370 | + $GLOBALS['log']->debug("metadatafile=".$metadataFile); |
|
1372 | 1371 | |
1373 | 1372 | return $metadataFile; |
1374 | 1373 | } |
@@ -1385,10 +1384,10 @@ discard block |
||
1385 | 1384 | { |
1386 | 1385 | $params = array($this->_getModuleTitleListParam($browserTitle)); |
1387 | 1386 | //$params = array(); |
1388 | - if (isset($this->action)){ |
|
1387 | + if (isset($this->action)) { |
|
1389 | 1388 | switch ($this->action) { |
1390 | 1389 | case 'EditView': |
1391 | - if(!empty($this->bean->id) && (empty($_REQUEST['isDuplicate']) || $_REQUEST['isDuplicate'] === 'false')) { |
|
1390 | + if (!empty($this->bean->id) && (empty($_REQUEST['isDuplicate']) || $_REQUEST['isDuplicate'] === 'false')) { |
|
1392 | 1391 | $params[] = "<a href='index.php?module={$this->module}&action=DetailView&record={$this->bean->id}'>".$this->bean->get_summary_text()."</a>"; |
1393 | 1392 | $params[] = $GLOBALS['app_strings']['LBL_EDIT_BUTTON_LABEL']; |
1394 | 1393 | } |
@@ -1412,18 +1411,18 @@ discard block |
||
1412 | 1411 | * there should be no HTML in the string |
1413 | 1412 | * @return string |
1414 | 1413 | */ |
1415 | - protected function _getModuleTitleListParam( $browserTitle = false ) |
|
1414 | + protected function _getModuleTitleListParam($browserTitle = false) |
|
1416 | 1415 | { |
1417 | 1416 | global $current_user; |
1418 | 1417 | global $app_strings; |
1419 | 1418 | |
1420 | - if(!empty($GLOBALS['app_list_strings']['moduleList'][$this->module])) |
|
1419 | + if (!empty($GLOBALS['app_list_strings']['moduleList'][$this->module])) |
|
1421 | 1420 | $firstParam = $GLOBALS['app_list_strings']['moduleList'][$this->module]; |
1422 | 1421 | else |
1423 | 1422 | $firstParam = $this->module; |
1424 | 1423 | |
1425 | 1424 | $iconPath = $this->getModuleTitleIconPath($this->module); |
1426 | - if($this->action == "ListView" || $this->action == "index") { |
|
1425 | + if ($this->action == "ListView" || $this->action == "index") { |
|
1427 | 1426 | if (!empty($iconPath) && !$browserTitle) { |
1428 | 1427 | if (SugarThemeRegistry::current()->directionality == "ltr") { |
1429 | 1428 | return $app_strings['LBL_SEARCH']." " |
@@ -1449,10 +1448,10 @@ discard block |
||
1449 | 1448 | protected function getModuleTitleIconPath($module) |
1450 | 1449 | { |
1451 | 1450 | $iconPath = ""; |
1452 | - if(is_file(SugarThemeRegistry::current()->getImageURL('icon_'.$module.'_32.png',false))) { |
|
1451 | + if (is_file(SugarThemeRegistry::current()->getImageURL('icon_'.$module.'_32.png', false))) { |
|
1453 | 1452 | $iconPath = SugarThemeRegistry::current()->getImageURL('icon_'.$module.'_32.png'); |
1454 | 1453 | } |
1455 | - else if (is_file(SugarThemeRegistry::current()->getImageURL('icon_'.ucfirst($module).'_32.png',false))) { |
|
1454 | + else if (is_file(SugarThemeRegistry::current()->getImageURL('icon_'.ucfirst($module).'_32.png', false))) { |
|
1456 | 1455 | $iconPath = SugarThemeRegistry::current()->getImageURL('icon_'.ucfirst($module).'_32.png'); |
1457 | 1456 | } |
1458 | 1457 | return $iconPath; |
@@ -1469,11 +1468,11 @@ discard block |
||
1469 | 1468 | global $app_strings; |
1470 | 1469 | |
1471 | 1470 | $browserTitle = $app_strings['LBL_BROWSER_TITLE']; |
1472 | - if ( $this->module == 'Users' && ($this->action == 'SetTimezone' || $this->action == 'Login') ) |
|
1471 | + if ($this->module == 'Users' && ($this->action == 'SetTimezone' || $this->action == 'Login')) |
|
1473 | 1472 | return $browserTitle; |
1474 | 1473 | $params = $this->_getModuleTitleParams(true); |
1475 | - foreach ($params as $value ) |
|
1476 | - $browserTitle = strip_tags($value) . ' » ' . $browserTitle; |
|
1474 | + foreach ($params as $value) |
|
1475 | + $browserTitle = strip_tags($value).' » '.$browserTitle; |
|
1477 | 1476 | |
1478 | 1477 | return $browserTitle; |
1479 | 1478 | } |
@@ -1485,7 +1484,7 @@ discard block |
||
1485 | 1484 | */ |
1486 | 1485 | public function getBreadCrumbSymbol() |
1487 | 1486 | { |
1488 | - if(SugarThemeRegistry::current()->directionality == "ltr") { |
|
1487 | + if (SugarThemeRegistry::current()->directionality == "ltr") { |
|
1489 | 1488 | return "<span class='pointer'>»</span>"; |
1490 | 1489 | } |
1491 | 1490 | else { |
@@ -1498,29 +1497,29 @@ discard block |
||
1498 | 1497 | * |
1499 | 1498 | * @return array |
1500 | 1499 | */ |
1501 | - protected function getSugarConfigJS(){ |
|
1500 | + protected function getSugarConfigJS() { |
|
1502 | 1501 | global $sugar_config; |
1503 | 1502 | |
1504 | 1503 | // Set all the config parameters in the JS config as necessary |
1505 | 1504 | $config_js = array(); |
1506 | 1505 | // AjaxUI stock banned modules |
1507 | 1506 | $config_js[] = "SUGAR.config.stockAjaxBannedModules = ".json_encode(ajaxBannedModules()).";"; |
1508 | - if ( isset($sugar_config['quicksearch_querydelay']) ) { |
|
1507 | + if (isset($sugar_config['quicksearch_querydelay'])) { |
|
1509 | 1508 | $config_js[] = $this->prepareConfigVarForJs('quicksearch_querydelay', $sugar_config['quicksearch_querydelay']); |
1510 | 1509 | } |
1511 | - if ( empty($sugar_config['disableAjaxUI']) ) { |
|
1510 | + if (empty($sugar_config['disableAjaxUI'])) { |
|
1512 | 1511 | $config_js[] = "SUGAR.config.disableAjaxUI = false;"; |
1513 | 1512 | } |
1514 | - else{ |
|
1513 | + else { |
|
1515 | 1514 | $config_js[] = "SUGAR.config.disableAjaxUI = true;"; |
1516 | 1515 | } |
1517 | - if ( !empty($sugar_config['addAjaxBannedModules']) ){ |
|
1516 | + if (!empty($sugar_config['addAjaxBannedModules'])) { |
|
1518 | 1517 | $config_js[] = $this->prepareConfigVarForJs('addAjaxBannedModules', $sugar_config['addAjaxBannedModules']); |
1519 | 1518 | } |
1520 | - if ( !empty($sugar_config['overrideAjaxBannedModules']) ){ |
|
1519 | + if (!empty($sugar_config['overrideAjaxBannedModules'])) { |
|
1521 | 1520 | $config_js[] = $this->prepareConfigVarForJs('overrideAjaxBannedModules', $sugar_config['overrideAjaxBannedModules']); |
1522 | 1521 | } |
1523 | - if (!empty($sugar_config['js_available']) && is_array ($sugar_config['js_available'])) |
|
1522 | + if (!empty($sugar_config['js_available']) && is_array($sugar_config['js_available'])) |
|
1524 | 1523 | { |
1525 | 1524 | foreach ($sugar_config['js_available'] as $configKey) |
1526 | 1525 | { |
@@ -1581,7 +1580,7 @@ discard block |
||
1581 | 1580 | protected function getFavicon() |
1582 | 1581 | { |
1583 | 1582 | // get favicon |
1584 | - if(isset($GLOBALS['sugar_config']['default_module_favicon'])) |
|
1583 | + if (isset($GLOBALS['sugar_config']['default_module_favicon'])) |
|
1585 | 1584 | $module_favicon = $GLOBALS['sugar_config']['default_module_favicon']; |
1586 | 1585 | else |
1587 | 1586 | $module_favicon = false; |
@@ -1589,10 +1588,10 @@ discard block |
||
1589 | 1588 | $themeObject = SugarThemeRegistry::current(); |
1590 | 1589 | |
1591 | 1590 | $favicon = ''; |
1592 | - if ( $module_favicon ) |
|
1593 | - $favicon = $themeObject->getImageURL($this->module.'.gif',false); |
|
1594 | - if ( !sugar_is_file($favicon) || !$module_favicon ) |
|
1595 | - $favicon = $themeObject->getImageURL('sugar_icon.ico',false); |
|
1591 | + if ($module_favicon) |
|
1592 | + $favicon = $themeObject->getImageURL($this->module.'.gif', false); |
|
1593 | + if (!sugar_is_file($favicon) || !$module_favicon) |
|
1594 | + $favicon = $themeObject->getImageURL('sugar_icon.ico', false); |
|
1596 | 1595 | |
1597 | 1596 | $extension = pathinfo($favicon, PATHINFO_EXTENSION); |
1598 | 1597 | switch ($extension) |
@@ -1649,10 +1648,10 @@ discard block |
||
1649 | 1648 | * @return array augmented history with image link and shortened name |
1650 | 1649 | */ |
1651 | 1650 | protected function processRecentRecords($history) { |
1652 | - foreach ( $history as $key => $row ) { |
|
1651 | + foreach ($history as $key => $row) { |
|
1653 | 1652 | $history[$key]['item_summary_short'] = to_html(getTrackerSubstring($row['item_summary'])); //bug 56373 - need to re-HTML-encode |
1654 | 1653 | $history[$key]['image'] = SugarThemeRegistry::current() |
1655 | - ->getImage($row['module_name'],'border="0" align="absmiddle"',null,null,'.gif',$row['item_summary']); |
|
1654 | + ->getImage($row['module_name'], 'border="0" align="absmiddle"', null, null, '.gif', $row['item_summary']); |
|
1656 | 1655 | } |
1657 | 1656 | return $history; |
1658 | 1657 | } |
@@ -1666,10 +1665,10 @@ discard block |
||
1666 | 1665 | * |
1667 | 1666 | * @return boolean indicating true or false |
1668 | 1667 | */ |
1669 | - public function checkPostMaxSizeError(){ |
|
1668 | + public function checkPostMaxSizeError() { |
|
1670 | 1669 | //if the referrer is post, and the post array is empty, then an error has occurred, most likely |
1671 | 1670 | //while uploading a file that exceeds the post_max_size. |
1672 | - if(empty($_FILES) && empty($_POST) && isset($_SERVER['REQUEST_METHOD']) && strtolower($_SERVER['REQUEST_METHOD']) == 'post'){ |
|
1671 | + if (empty($_FILES) && empty($_POST) && isset($_SERVER['REQUEST_METHOD']) && strtolower($_SERVER['REQUEST_METHOD']) == 'post') { |
|
1673 | 1672 | $GLOBALS['log']->fatal($GLOBALS['app_strings']['UPLOAD_ERROR_HOME_TEXT']); |
1674 | 1673 | return true; |
1675 | 1674 | } |
@@ -161,13 +161,17 @@ discard block |
||
161 | 161 | echo $jsAlerts->getScript(); |
162 | 162 | } |
163 | 163 | |
164 | - if ($this->_getOption('show_subpanels') && !empty($_REQUEST['record'])) $this->_displaySubPanels(); |
|
164 | + if ($this->_getOption('show_subpanels') && !empty($_REQUEST['record'])) { |
|
165 | + $this->_displaySubPanels(); |
|
166 | + } |
|
165 | 167 | |
166 | 168 | if ($this->action === 'Login') { |
167 | 169 | //this is needed for a faster loading login page ie won't render unless the tables are closed |
168 | 170 | ob_flush(); |
169 | 171 | } |
170 | - if ($this->_getOption('show_footer')) $this->displayFooter(); |
|
172 | + if ($this->_getOption('show_footer')) { |
|
173 | + $this->displayFooter(); |
|
174 | + } |
|
171 | 175 | $GLOBALS['logic_hook']->call_custom_logic('', 'after_ui_footer'); |
172 | 176 | if ($this->_getOption('json_output')) |
173 | 177 | { |
@@ -186,11 +190,13 @@ discard block |
||
186 | 190 | 'favicon' => $this->getFavicon(), |
187 | 191 | ); |
188 | 192 | |
189 | - if(SugarThemeRegistry::current()->name == 'Classic' || SugarThemeRegistry::current()->classic) |
|
190 | - $ajax_ret['moduleList'] = $this->displayHeader(true); |
|
193 | + if(SugarThemeRegistry::current()->name == 'Classic' || SugarThemeRegistry::current()->classic) { |
|
194 | + $ajax_ret['moduleList'] = $this->displayHeader(true); |
|
195 | + } |
|
191 | 196 | |
192 | - if(empty($this->responseTime)) |
|
193 | - $this->_calculateFooterMetrics(); |
|
197 | + if(empty($this->responseTime)) { |
|
198 | + $this->_calculateFooterMetrics(); |
|
199 | + } |
|
194 | 200 | $ajax_ret['responseTime'] = $this->responseTime; |
195 | 201 | $json = getJSONobj(); |
196 | 202 | echo $json->encode($ajax_ret); |
@@ -214,8 +220,7 @@ discard block |
||
214 | 220 | |
215 | 221 | if ( !$this->suppressDisplayErrors ) { |
216 | 222 | echo $errors; |
217 | - } |
|
218 | - else { |
|
223 | + } else { |
|
219 | 224 | return $errors; |
220 | 225 | } |
221 | 226 | } |
@@ -329,24 +334,26 @@ discard block |
||
329 | 334 | ob_end_clean(); |
330 | 335 | |
331 | 336 | // get favicon |
332 | - if(isset($GLOBALS['sugar_config']['default_module_favicon'])) |
|
333 | - $module_favicon = $GLOBALS['sugar_config']['default_module_favicon']; |
|
334 | - else |
|
335 | - $module_favicon = false; |
|
337 | + if(isset($GLOBALS['sugar_config']['default_module_favicon'])) { |
|
338 | + $module_favicon = $GLOBALS['sugar_config']['default_module_favicon']; |
|
339 | + } else { |
|
340 | + $module_favicon = false; |
|
341 | + } |
|
336 | 342 | |
337 | 343 | $favicon = $this->getFavicon(); |
338 | 344 | $ss->assign('FAVICON_URL', $favicon['url']); |
339 | 345 | |
340 | 346 | // build the shortcut menu |
341 | 347 | $shortcut_menu = array(); |
342 | - foreach ( $this->getMenu() as $key => $menu_item ) |
|
343 | - $shortcut_menu[$key] = array( |
|
348 | + foreach ( $this->getMenu() as $key => $menu_item ) { |
|
349 | + $shortcut_menu[$key] = array( |
|
344 | 350 | "URL" => $menu_item[0], |
345 | 351 | "LABEL" => $menu_item[1], |
346 | 352 | "MODULE_NAME" => $menu_item[2], |
347 | 353 | "IMAGE" => $themeObject |
348 | 354 | ->getImage($menu_item[2],"border='0' align='absmiddle'",null,null,'.gif',$menu_item[1]), |
349 | 355 | ); |
356 | + } |
|
350 | 357 | $ss->assign("SHORTCUT_MENU",$shortcut_menu); |
351 | 358 | |
352 | 359 | // handle rtl text direction |
@@ -370,8 +377,7 @@ discard block |
||
370 | 377 | $ss->assign("COMPANY_LOGO_MD5", $company_logo_attributes[0]); |
371 | 378 | $ss->assign("COMPANY_LOGO_WIDTH", $company_logo_attributes[1]); |
372 | 379 | $ss->assign("COMPANY_LOGO_HEIGHT", $company_logo_attributes[2]); |
373 | - } |
|
374 | - else { |
|
380 | + } else { |
|
375 | 381 | // Always need to md5 the file |
376 | 382 | $ss->assign("COMPANY_LOGO_MD5", md5_file($companyLogoURL)); |
377 | 383 | |
@@ -379,14 +385,14 @@ discard block |
||
379 | 385 | if ( $width > 212 || $height > 40 ) { |
380 | 386 | $resizePctWidth = ($width - 212)/212; |
381 | 387 | $resizePctHeight = ($height - 40)/40; |
382 | - if ( $resizePctWidth > $resizePctHeight ) |
|
383 | - $resizeAmount = $width / 212; |
|
384 | - else |
|
385 | - $resizeAmount = $height / 40; |
|
388 | + if ( $resizePctWidth > $resizePctHeight ) { |
|
389 | + $resizeAmount = $width / 212; |
|
390 | + } else { |
|
391 | + $resizeAmount = $height / 40; |
|
392 | + } |
|
386 | 393 | $ss->assign("COMPANY_LOGO_WIDTH", round($width * (1/$resizeAmount))); |
387 | 394 | $ss->assign("COMPANY_LOGO_HEIGHT", round($height * (1/$resizeAmount))); |
388 | - } |
|
389 | - else { |
|
395 | + } else { |
|
390 | 396 | $ss->assign("COMPANY_LOGO_WIDTH", $width); |
391 | 397 | $ss->assign("COMPANY_LOGO_HEIGHT", $height); |
392 | 398 | } |
@@ -429,11 +435,12 @@ discard block |
||
429 | 435 | } |
430 | 436 | // and now the sublinks |
431 | 437 | if ( $linkattribute == 'submenu' && is_array($attributevalue) ) { |
432 | - foreach ($attributevalue as $submenulinkkey => $submenulinkinfo) |
|
433 | - $gcls[$key]['SUBMENU'][$submenulinkkey] = array( |
|
438 | + foreach ($attributevalue as $submenulinkkey => $submenulinkinfo) { |
|
439 | + $gcls[$key]['SUBMENU'][$submenulinkkey] = array( |
|
434 | 440 | "LABEL" => key($submenulinkinfo), |
435 | 441 | "URL" => current($submenulinkinfo), |
436 | 442 | ); |
443 | + } |
|
437 | 444 | if(substr($gcls[$key]['SUBMENU'][$submenulinkkey]["URL"], 0, 11) == "javascript:") { |
438 | 445 | $gcls[$key]['SUBMENU'][$submenulinkkey]["ONCLICK"] = substr($gcls[$key]['SUBMENU'][$submenulinkkey]["URL"],11); |
439 | 446 | $gcls[$key]['SUBMENU'][$submenulinkkey]["URL"] = "javascript:void(0)"; |
@@ -445,8 +452,9 @@ discard block |
||
445 | 452 | |
446 | 453 | $ss->assign("SEARCH", isset($_REQUEST['query_string']) ? $_REQUEST['query_string'] : ''); |
447 | 454 | |
448 | - if ($this->action == "EditView" || $this->action == "Login") |
|
449 | - $ss->assign("ONLOAD", 'onload="set_focus()"'); |
|
455 | + if ($this->action == "EditView" || $this->action == "Login") { |
|
456 | + $ss->assign("ONLOAD", 'onload="set_focus()"'); |
|
457 | + } |
|
450 | 458 | |
451 | 459 | $ss->assign("AUTHENTICATED",isset($_SESSION["authenticated_user_id"])); |
452 | 460 | |
@@ -506,8 +514,7 @@ discard block |
||
506 | 514 | foreach($frames as $key => $values){ |
507 | 515 | $fullModuleList[$key] = $values; |
508 | 516 | } |
509 | - } |
|
510 | - elseif (isset($fullModuleList['iFrames'])) { |
|
517 | + } elseif (isset($fullModuleList['iFrames'])) { |
|
511 | 518 | unset($fullModuleList['iFrames']); |
512 | 519 | } |
513 | 520 | |
@@ -523,8 +530,7 @@ discard block |
||
523 | 530 | // We have a default value. Use it |
524 | 531 | if(isset($GLOBALS['sugar_config']['default_max_tabs'])){ |
525 | 532 | $max_tabs = $GLOBALS['sugar_config']['default_max_tabs']; |
526 | - } |
|
527 | - else{ |
|
533 | + } else{ |
|
528 | 534 | $max_tabs = 8; |
529 | 535 | } |
530 | 536 | } |
@@ -633,7 +639,9 @@ discard block |
||
633 | 639 | ); |
634 | 640 | } |
635 | 641 | } |
636 | - if(!empty($sugar_config['lock_homepage']) && $sugar_config['lock_homepage'] == true) $ss->assign('lock_homepage', true); |
|
642 | + if(!empty($sugar_config['lock_homepage']) && $sugar_config['lock_homepage'] == true) { |
|
643 | + $ss->assign('lock_homepage', true); |
|
644 | + } |
|
637 | 645 | $ss->assign("groupTabs",$groupTabs); |
638 | 646 | $ss->assign("shortcutTopMenu",$shortcutTopMenu); |
639 | 647 | $ss->assign('USE_GROUP_TABS',$usingGroupTabs); |
@@ -676,8 +684,9 @@ discard block |
||
676 | 684 | global $mod_strings; |
677 | 685 | $mod_strings = $bakModStrings; |
678 | 686 | $headerTpl = $themeObject->getTemplate('header.tpl'); |
679 | - if (inDeveloperMode() ) |
|
680 | - $ss->clear_compiled_tpl($headerTpl); |
|
687 | + if (inDeveloperMode() ) { |
|
688 | + $ss->clear_compiled_tpl($headerTpl); |
|
689 | + } |
|
681 | 690 | |
682 | 691 | if ($retModTabs) |
683 | 692 | { |
@@ -716,8 +725,9 @@ discard block |
||
716 | 725 | global $gridline, $request_string, $modListHeader, $dashletData, $authController, $locale, $currentModule, $import_bean_map, $image_path, $license; |
717 | 726 | global $user_unique_key, $server_unique_key, $barChartColors, $modules_exempt_from_availability_check, $dictionary, $current_language, $beanList, $beanFiles, $sugar_build, $sugar_codename; |
718 | 727 | global $timedate, $login_error; // cn: bug 13855 - timedate not available to classic views. |
719 | - if (!empty($this->module)) |
|
720 | - $currentModule = $this->module; |
|
728 | + if (!empty($this->module)) { |
|
729 | + $currentModule = $this->module; |
|
730 | + } |
|
721 | 731 | require_once ($file); |
722 | 732 | } |
723 | 733 | |
@@ -747,8 +757,9 @@ discard block |
||
747 | 757 | if ( typeof(SUGAR.themes) == 'undefined' ) SUGAR.themes = {}; |
748 | 758 | </script> |
749 | 759 | EOQ; |
750 | - if(isset( $sugar_config['disc_client']) && $sugar_config['disc_client']) |
|
751 | - echo getVersionedScript('modules/Sync/headersync.js'); |
|
760 | + if(isset( $sugar_config['disc_client']) && $sugar_config['disc_client']) { |
|
761 | + echo getVersionedScript('modules/Sync/headersync.js'); |
|
762 | + } |
|
752 | 763 | } |
753 | 764 | |
754 | 765 | /** |
@@ -849,8 +860,9 @@ discard block |
||
849 | 860 | |
850 | 861 | echo $this->_getModLanguageJS(); |
851 | 862 | |
852 | - if(isset( $sugar_config['disc_client']) && $sugar_config['disc_client']) |
|
853 | - echo getVersionedScript('modules/Sync/headersync.js'); |
|
863 | + if(isset( $sugar_config['disc_client']) && $sugar_config['disc_client']) { |
|
864 | + echo getVersionedScript('modules/Sync/headersync.js'); |
|
865 | + } |
|
854 | 866 | |
855 | 867 | |
856 | 868 | //echo out the $js_vars variables as javascript variables |
@@ -917,8 +929,9 @@ discard block |
||
917 | 929 | } |
918 | 930 | } |
919 | 931 | $ss->assign("BOTTOMLINKS",$bottomLinksStr); |
920 | - if (SugarConfig::getInstance()->get('calculate_response_time', false)) |
|
921 | - $ss->assign('STATISTICS',$this->_getStatistics()); |
|
932 | + if (SugarConfig::getInstance()->get('calculate_response_time', false)) { |
|
933 | + $ss->assign('STATISTICS',$this->_getStatistics()); |
|
934 | + } |
|
922 | 935 | |
923 | 936 | // Under the License referenced above, you are required to leave in all copyright statements in both |
924 | 937 | // the code and end-user application. |
@@ -956,8 +969,7 @@ discard block |
||
956 | 969 | $ss->assign("COMPANY_LOGO_MD5", $company_logo_attributes[0]); |
957 | 970 | $ss->assign("COMPANY_LOGO_WIDTH", $company_logo_attributes[1]); |
958 | 971 | $ss->assign("COMPANY_LOGO_HEIGHT", $company_logo_attributes[2]); |
959 | - } |
|
960 | - else { |
|
972 | + } else { |
|
961 | 973 | // Always need to md5 the file |
962 | 974 | $ss->assign("COMPANY_LOGO_MD5", md5_file($companyLogoURL)); |
963 | 975 | |
@@ -965,14 +977,14 @@ discard block |
||
965 | 977 | if ( $width > 212 || $height > 40 ) { |
966 | 978 | $resizePctWidth = ($width - 212)/212; |
967 | 979 | $resizePctHeight = ($height - 40)/40; |
968 | - if ( $resizePctWidth > $resizePctHeight ) |
|
969 | - $resizeAmount = $width / 212; |
|
970 | - else |
|
971 | - $resizeAmount = $height / 40; |
|
980 | + if ( $resizePctWidth > $resizePctHeight ) { |
|
981 | + $resizeAmount = $width / 212; |
|
982 | + } else { |
|
983 | + $resizeAmount = $height / 40; |
|
984 | + } |
|
972 | 985 | $ss->assign("COMPANY_LOGO_WIDTH", round($width * (1/$resizeAmount))); |
973 | 986 | $ss->assign("COMPANY_LOGO_HEIGHT", round($height * (1/$resizeAmount))); |
974 | - } |
|
975 | - else { |
|
987 | + } else { |
|
976 | 988 | $ss->assign("COMPANY_LOGO_WIDTH", $width); |
977 | 989 | $ss->assign("COMPANY_LOGO_HEIGHT", $height); |
978 | 990 | } |
@@ -1030,8 +1042,9 @@ discard block |
||
1030 | 1042 | |
1031 | 1043 | protected function _buildModuleList() |
1032 | 1044 | { |
1033 | - if (!empty($GLOBALS['current_user']) && empty($GLOBALS['modListHeader'])) |
|
1034 | - $GLOBALS['modListHeader'] = query_module_access_list($GLOBALS['current_user']); |
|
1045 | + if (!empty($GLOBALS['current_user']) && empty($GLOBALS['modListHeader'])) { |
|
1046 | + $GLOBALS['modListHeader'] = query_module_access_list($GLOBALS['current_user']); |
|
1047 | + } |
|
1035 | 1048 | } |
1036 | 1049 | |
1037 | 1050 | /** |
@@ -1051,7 +1064,9 @@ discard block |
||
1051 | 1064 | return $this->options['show_all']; |
1052 | 1065 | } elseif (!empty($this->options) && isset($this->options[$option])) { |
1053 | 1066 | return $this->options[$option]; |
1054 | - } else return $default; |
|
1067 | + } else { |
|
1068 | + return $default; |
|
1069 | + } |
|
1055 | 1070 | } |
1056 | 1071 | |
1057 | 1072 | /** |
@@ -1088,10 +1103,11 @@ discard block |
||
1088 | 1103 | |
1089 | 1104 | public function renderJavascript() |
1090 | 1105 | { |
1091 | - if ($this->action !== 'Login') |
|
1092 | - $this->_displayJavascript(); |
|
1093 | - else |
|
1094 | - $this->_displayLoginJS(); |
|
1106 | + if ($this->action !== 'Login') { |
|
1107 | + $this->_displayJavascript(); |
|
1108 | + } else { |
|
1109 | + $this->_displayLoginJS(); |
|
1110 | + } |
|
1095 | 1111 | } |
1096 | 1112 | |
1097 | 1113 | private function _calculateFooterMetrics() |
@@ -1198,8 +1214,9 @@ discard block |
||
1198 | 1214 | { |
1199 | 1215 | global $current_language, $current_user, $mod_strings, $app_strings, $module_menu; |
1200 | 1216 | |
1201 | - if ( empty($module) ) |
|
1202 | - $module = $this->module; |
|
1217 | + if ( empty($module) ) { |
|
1218 | + $module = $this->module; |
|
1219 | + } |
|
1203 | 1220 | |
1204 | 1221 | //Need to make sure the mod_strings match the requested module or Menus may fail |
1205 | 1222 | $curr_mod_strings = $mod_strings; |
@@ -1220,13 +1237,14 @@ discard block |
||
1220 | 1237 | $GLOBALS['mod_strings']['LNK_NEW_RECORD'],"{$GLOBALS['app_strings']['LBL_CREATE_BUTTON_LABEL']}$module" ,$module ); |
1221 | 1238 | $module_menu[] = array("index.php?module=$module&action=index", $GLOBALS['mod_strings']['LNK_LIST'], |
1222 | 1239 | $module, $module); |
1223 | - if ( ($this->bean instanceOf SugarBean) && !empty($this->bean->importable) ) |
|
1224 | - if ( !empty($mod_strings['LNK_IMPORT_'.strtoupper($module)]) ) |
|
1240 | + if ( ($this->bean instanceOf SugarBean) && !empty($this->bean->importable) ) { |
|
1241 | + if ( !empty($mod_strings['LNK_IMPORT_'.strtoupper($module)]) ) |
|
1225 | 1242 | $module_menu[] = array("index.php?module=Import&action=Step1&import_module=$module&return_module=$module&return_action=index", |
1226 | 1243 | $mod_strings['LNK_IMPORT_'.strtoupper($module)], "Import", $module); |
1227 | - else |
|
1228 | - $module_menu[] = array("index.php?module=Import&action=Step1&import_module=$module&return_module=$module&return_action=index", |
|
1244 | + } else { |
|
1245 | + $module_menu[] = array("index.php?module=Import&action=Step1&import_module=$module&return_module=$module&return_action=index", |
|
1229 | 1246 | $app_strings['LBL_IMPORT'], "Import", $module); |
1247 | + } |
|
1230 | 1248 | } |
1231 | 1249 | if (file_exists('custom/application/Ext/Menus/menu.ext.php')) { |
1232 | 1250 | require('custom/application/Ext/Menus/menu.ext.php'); |
@@ -1251,22 +1269,25 @@ discard block |
||
1251 | 1269 | $defaultTab = (in_array("Home",$userTabs)) ? "Home" : key($userTabs); |
1252 | 1270 | |
1253 | 1271 | // Need to figure out what tab this module belongs to, most modules have their own tabs, but there are exceptions. |
1254 | - if ( !empty($_REQUEST['module_tab']) ) |
|
1255 | - return $_REQUEST['module_tab']; |
|
1256 | - elseif ( isset($moduleTabMap[$this->module]) ) |
|
1257 | - return $moduleTabMap[$this->module]; |
|
1272 | + if ( !empty($_REQUEST['module_tab']) ) { |
|
1273 | + return $_REQUEST['module_tab']; |
|
1274 | + } elseif ( isset($moduleTabMap[$this->module]) ) { |
|
1275 | + return $moduleTabMap[$this->module]; |
|
1276 | + } |
|
1258 | 1277 | // Special cases |
1259 | - elseif ( $this->module == 'MergeRecords' ) |
|
1260 | - return !empty($_REQUEST['merge_module']) ? $_REQUEST['merge_module'] : $_REQUEST['return_module']; |
|
1261 | - elseif ( $this->module == 'Users' && $this->action == 'SetTimezone' ) |
|
1262 | - return $defaultTab; |
|
1278 | + elseif ( $this->module == 'MergeRecords' ) { |
|
1279 | + return !empty($_REQUEST['merge_module']) ? $_REQUEST['merge_module'] : $_REQUEST['return_module']; |
|
1280 | + } elseif ( $this->module == 'Users' && $this->action == 'SetTimezone' ) { |
|
1281 | + return $defaultTab; |
|
1282 | + } |
|
1263 | 1283 | // Default anonymous pages to be under Home |
1264 | - elseif ( !isset($app_list_strings['moduleList'][$this->module]) ) |
|
1265 | - return $defaultTab; |
|
1266 | - elseif ( isset($_REQUEST['action']) && $_REQUEST['action'] == "ajaxui" ) |
|
1267 | - return $defaultTab; |
|
1268 | - else |
|
1269 | - return $this->module; |
|
1284 | + elseif ( !isset($app_list_strings['moduleList'][$this->module]) ) { |
|
1285 | + return $defaultTab; |
|
1286 | + } elseif ( isset($_REQUEST['action']) && $_REQUEST['action'] == "ajaxui" ) { |
|
1287 | + return $defaultTab; |
|
1288 | + } else { |
|
1289 | + return $this->module; |
|
1290 | + } |
|
1270 | 1291 | } |
1271 | 1292 | |
1272 | 1293 | /** |
@@ -1317,7 +1338,10 @@ discard block |
||
1317 | 1338 | if($show_help || $this->type == 'list') { |
1318 | 1339 | $theTitle .= "<span class='utils'>"; |
1319 | 1340 | $createImageURL = SugarThemeRegistry::current()->getImageURL('create-record.gif'); |
1320 | - if($this->type == 'list') $theTitle .= '<a href="#" class="btn btn-success showsearch"><span class=" glyphicon glyphicon-search" aria-hidden="true"></span></a>';$url = ajaxLink("index.php?module=$module&action=EditView&return_module=$module&return_action=DetailView"); |
|
1341 | + if($this->type == 'list') { |
|
1342 | + $theTitle .= '<a href="#" class="btn btn-success showsearch"><span class=" glyphicon glyphicon-search" aria-hidden="true"></span></a>'; |
|
1343 | + } |
|
1344 | + $url = ajaxLink("index.php?module=$module&action=EditView&return_module=$module&return_action=DetailView"); |
|
1321 | 1345 | if($show_help) { |
1322 | 1346 | $theTitle .= <<<EOHTML |
1323 | 1347 | |
@@ -1349,14 +1373,14 @@ discard block |
||
1349 | 1373 | if(file_exists('custom/' .$coreMetaPath )){ |
1350 | 1374 | $metadataFile = 'custom/' . $coreMetaPath; |
1351 | 1375 | $foundViewDefs = true; |
1352 | - }else{ |
|
1376 | + } else{ |
|
1353 | 1377 | if(file_exists('custom/modules/'.$this->module.'/metadata/metafiles.php')){ |
1354 | 1378 | require_once('custom/modules/'.$this->module.'/metadata/metafiles.php'); |
1355 | 1379 | if(!empty($metafiles[$this->module][$viewDef])){ |
1356 | 1380 | $metadataFile = $metafiles[$this->module][$viewDef]; |
1357 | 1381 | $foundViewDefs = true; |
1358 | 1382 | } |
1359 | - }elseif(file_exists('modules/'.$this->module.'/metadata/metafiles.php')){ |
|
1383 | + } elseif(file_exists('modules/'.$this->module.'/metadata/metafiles.php')){ |
|
1360 | 1384 | require_once('modules/'.$this->module.'/metadata/metafiles.php'); |
1361 | 1385 | if(!empty($metafiles[$this->module][$viewDef])){ |
1362 | 1386 | $metadataFile = $metafiles[$this->module][$viewDef]; |
@@ -1391,9 +1415,9 @@ discard block |
||
1391 | 1415 | if(!empty($this->bean->id) && (empty($_REQUEST['isDuplicate']) || $_REQUEST['isDuplicate'] === 'false')) { |
1392 | 1416 | $params[] = "<a href='index.php?module={$this->module}&action=DetailView&record={$this->bean->id}'>".$this->bean->get_summary_text()."</a>"; |
1393 | 1417 | $params[] = $GLOBALS['app_strings']['LBL_EDIT_BUTTON_LABEL']; |
1418 | + } else { |
|
1419 | + $params[] = $GLOBALS['app_strings']['LBL_CREATE_BUTTON_LABEL']; |
|
1394 | 1420 | } |
1395 | - else |
|
1396 | - $params[] = $GLOBALS['app_strings']['LBL_CREATE_BUTTON_LABEL']; |
|
1397 | 1421 | break; |
1398 | 1422 | case 'DetailView': |
1399 | 1423 | $beanName = $this->bean->get_summary_text(); |
@@ -1417,10 +1441,11 @@ discard block |
||
1417 | 1441 | global $current_user; |
1418 | 1442 | global $app_strings; |
1419 | 1443 | |
1420 | - if(!empty($GLOBALS['app_list_strings']['moduleList'][$this->module])) |
|
1421 | - $firstParam = $GLOBALS['app_list_strings']['moduleList'][$this->module]; |
|
1422 | - else |
|
1423 | - $firstParam = $this->module; |
|
1444 | + if(!empty($GLOBALS['app_list_strings']['moduleList'][$this->module])) { |
|
1445 | + $firstParam = $GLOBALS['app_list_strings']['moduleList'][$this->module]; |
|
1446 | + } else { |
|
1447 | + $firstParam = $this->module; |
|
1448 | + } |
|
1424 | 1449 | |
1425 | 1450 | $iconPath = $this->getModuleTitleIconPath($this->module); |
1426 | 1451 | if($this->action == "ListView" || $this->action == "index") { |
@@ -1436,8 +1461,7 @@ discard block |
||
1436 | 1461 | } else { |
1437 | 1462 | return $firstParam; |
1438 | 1463 | } |
1439 | - } |
|
1440 | - else { |
|
1464 | + } else { |
|
1441 | 1465 | if (!empty($iconPath) && !$browserTitle) { |
1442 | 1466 | //return "<a href='index.php?module={$this->module}&action=index'>$this->module</a>"; |
1443 | 1467 | } else { |
@@ -1451,8 +1475,7 @@ discard block |
||
1451 | 1475 | $iconPath = ""; |
1452 | 1476 | if(is_file(SugarThemeRegistry::current()->getImageURL('icon_'.$module.'_32.png',false))) { |
1453 | 1477 | $iconPath = SugarThemeRegistry::current()->getImageURL('icon_'.$module.'_32.png'); |
1454 | - } |
|
1455 | - else if (is_file(SugarThemeRegistry::current()->getImageURL('icon_'.ucfirst($module).'_32.png',false))) { |
|
1478 | + } else if (is_file(SugarThemeRegistry::current()->getImageURL('icon_'.ucfirst($module).'_32.png',false))) { |
|
1456 | 1479 | $iconPath = SugarThemeRegistry::current()->getImageURL('icon_'.ucfirst($module).'_32.png'); |
1457 | 1480 | } |
1458 | 1481 | return $iconPath; |
@@ -1469,11 +1492,13 @@ discard block |
||
1469 | 1492 | global $app_strings; |
1470 | 1493 | |
1471 | 1494 | $browserTitle = $app_strings['LBL_BROWSER_TITLE']; |
1472 | - if ( $this->module == 'Users' && ($this->action == 'SetTimezone' || $this->action == 'Login') ) |
|
1473 | - return $browserTitle; |
|
1495 | + if ( $this->module == 'Users' && ($this->action == 'SetTimezone' || $this->action == 'Login') ) { |
|
1496 | + return $browserTitle; |
|
1497 | + } |
|
1474 | 1498 | $params = $this->_getModuleTitleParams(true); |
1475 | - foreach ($params as $value ) |
|
1476 | - $browserTitle = strip_tags($value) . ' » ' . $browserTitle; |
|
1499 | + foreach ($params as $value ) { |
|
1500 | + $browserTitle = strip_tags($value) . ' » ' . $browserTitle; |
|
1501 | + } |
|
1477 | 1502 | |
1478 | 1503 | return $browserTitle; |
1479 | 1504 | } |
@@ -1487,8 +1512,7 @@ discard block |
||
1487 | 1512 | { |
1488 | 1513 | if(SugarThemeRegistry::current()->directionality == "ltr") { |
1489 | 1514 | return "<span class='pointer'>»</span>"; |
1490 | - } |
|
1491 | - else { |
|
1515 | + } else { |
|
1492 | 1516 | return "<span class='pointer'>«</span>"; |
1493 | 1517 | } |
1494 | 1518 | } |
@@ -1510,8 +1534,7 @@ discard block |
||
1510 | 1534 | } |
1511 | 1535 | if ( empty($sugar_config['disableAjaxUI']) ) { |
1512 | 1536 | $config_js[] = "SUGAR.config.disableAjaxUI = false;"; |
1513 | - } |
|
1514 | - else{ |
|
1537 | + } else{ |
|
1515 | 1538 | $config_js[] = "SUGAR.config.disableAjaxUI = true;"; |
1516 | 1539 | } |
1517 | 1540 | if ( !empty($sugar_config['addAjaxBannedModules']) ){ |
@@ -1581,18 +1604,21 @@ discard block |
||
1581 | 1604 | protected function getFavicon() |
1582 | 1605 | { |
1583 | 1606 | // get favicon |
1584 | - if(isset($GLOBALS['sugar_config']['default_module_favicon'])) |
|
1585 | - $module_favicon = $GLOBALS['sugar_config']['default_module_favicon']; |
|
1586 | - else |
|
1587 | - $module_favicon = false; |
|
1607 | + if(isset($GLOBALS['sugar_config']['default_module_favicon'])) { |
|
1608 | + $module_favicon = $GLOBALS['sugar_config']['default_module_favicon']; |
|
1609 | + } else { |
|
1610 | + $module_favicon = false; |
|
1611 | + } |
|
1588 | 1612 | |
1589 | 1613 | $themeObject = SugarThemeRegistry::current(); |
1590 | 1614 | |
1591 | 1615 | $favicon = ''; |
1592 | - if ( $module_favicon ) |
|
1593 | - $favicon = $themeObject->getImageURL($this->module.'.gif',false); |
|
1594 | - if ( !sugar_is_file($favicon) || !$module_favicon ) |
|
1595 | - $favicon = $themeObject->getImageURL('sugar_icon.ico',false); |
|
1616 | + if ( $module_favicon ) { |
|
1617 | + $favicon = $themeObject->getImageURL($this->module.'.gif',false); |
|
1618 | + } |
|
1619 | + if ( !sugar_is_file($favicon) || !$module_favicon ) { |
|
1620 | + $favicon = $themeObject->getImageURL('sugar_icon.ico',false); |
|
1621 | + } |
|
1596 | 1622 | |
1597 | 1623 | $extension = pathinfo($favicon, PATHINFO_EXTENSION); |
1598 | 1624 | switch ($extension) |
@@ -44,43 +44,43 @@ |
||
44 | 44 | */ |
45 | 45 | class ControllerFactory |
46 | 46 | { |
47 | - /** |
|
48 | - * Obtain an instance of the correct controller. |
|
49 | - * |
|
50 | - * @return an instance of SugarController |
|
51 | - */ |
|
52 | - static function getController($module){ |
|
53 | - $class = ucfirst($module).'Controller'; |
|
54 | - $customClass = 'Custom' . $class; |
|
55 | - if(file_exists('custom/modules/'.$module.'/controller.php')){ |
|
56 | - $customClass = 'Custom' . $class; |
|
57 | - require_once('custom/modules/'.$module.'/controller.php'); |
|
58 | - if(class_exists($customClass)){ |
|
59 | - $controller = new $customClass(); |
|
60 | - }else if(class_exists($class)){ |
|
61 | - $controller = new $class(); |
|
62 | - } |
|
63 | - }elseif(file_exists('modules/'.$module.'/controller.php')){ |
|
64 | - require_once('modules/'.$module.'/controller.php'); |
|
65 | - if(class_exists($customClass)){ |
|
66 | - $controller = new $customClass(); |
|
67 | - }else if(class_exists($class)){ |
|
68 | - $controller = new $class(); |
|
69 | - } |
|
70 | - }else{ |
|
71 | - if(file_exists('custom/include/MVC/Controller/SugarController.php')){ |
|
72 | - require_once('custom/include/MVC/Controller/SugarController.php'); |
|
73 | - } |
|
74 | - if(class_exists('CustomSugarController')){ |
|
75 | - $controller = new CustomSugarController(); |
|
76 | - }else{ |
|
77 | - $controller = new SugarController(); |
|
78 | - } |
|
79 | - } |
|
80 | - //setup the controller |
|
81 | - $controller->setup($module); |
|
82 | - return $controller; |
|
83 | - } |
|
47 | + /** |
|
48 | + * Obtain an instance of the correct controller. |
|
49 | + * |
|
50 | + * @return an instance of SugarController |
|
51 | + */ |
|
52 | + static function getController($module){ |
|
53 | + $class = ucfirst($module).'Controller'; |
|
54 | + $customClass = 'Custom' . $class; |
|
55 | + if(file_exists('custom/modules/'.$module.'/controller.php')){ |
|
56 | + $customClass = 'Custom' . $class; |
|
57 | + require_once('custom/modules/'.$module.'/controller.php'); |
|
58 | + if(class_exists($customClass)){ |
|
59 | + $controller = new $customClass(); |
|
60 | + }else if(class_exists($class)){ |
|
61 | + $controller = new $class(); |
|
62 | + } |
|
63 | + }elseif(file_exists('modules/'.$module.'/controller.php')){ |
|
64 | + require_once('modules/'.$module.'/controller.php'); |
|
65 | + if(class_exists($customClass)){ |
|
66 | + $controller = new $customClass(); |
|
67 | + }else if(class_exists($class)){ |
|
68 | + $controller = new $class(); |
|
69 | + } |
|
70 | + }else{ |
|
71 | + if(file_exists('custom/include/MVC/Controller/SugarController.php')){ |
|
72 | + require_once('custom/include/MVC/Controller/SugarController.php'); |
|
73 | + } |
|
74 | + if(class_exists('CustomSugarController')){ |
|
75 | + $controller = new CustomSugarController(); |
|
76 | + }else{ |
|
77 | + $controller = new SugarController(); |
|
78 | + } |
|
79 | + } |
|
80 | + //setup the controller |
|
81 | + $controller->setup($module); |
|
82 | + return $controller; |
|
83 | + } |
|
84 | 84 | |
85 | 85 | } |
86 | 86 | ?> |
87 | 87 | \ No newline at end of file |
@@ -49,31 +49,31 @@ |
||
49 | 49 | * |
50 | 50 | * @return an instance of SugarController |
51 | 51 | */ |
52 | - static function getController($module){ |
|
52 | + static function getController($module) { |
|
53 | 53 | $class = ucfirst($module).'Controller'; |
54 | - $customClass = 'Custom' . $class; |
|
55 | - if(file_exists('custom/modules/'.$module.'/controller.php')){ |
|
56 | - $customClass = 'Custom' . $class; |
|
54 | + $customClass = 'Custom'.$class; |
|
55 | + if (file_exists('custom/modules/'.$module.'/controller.php')) { |
|
56 | + $customClass = 'Custom'.$class; |
|
57 | 57 | require_once('custom/modules/'.$module.'/controller.php'); |
58 | - if(class_exists($customClass)){ |
|
58 | + if (class_exists($customClass)) { |
|
59 | 59 | $controller = new $customClass(); |
60 | - }else if(class_exists($class)){ |
|
60 | + } else if (class_exists($class)) { |
|
61 | 61 | $controller = new $class(); |
62 | 62 | } |
63 | - }elseif(file_exists('modules/'.$module.'/controller.php')){ |
|
63 | + }elseif (file_exists('modules/'.$module.'/controller.php')) { |
|
64 | 64 | require_once('modules/'.$module.'/controller.php'); |
65 | - if(class_exists($customClass)){ |
|
65 | + if (class_exists($customClass)) { |
|
66 | 66 | $controller = new $customClass(); |
67 | - }else if(class_exists($class)){ |
|
67 | + } else if (class_exists($class)) { |
|
68 | 68 | $controller = new $class(); |
69 | 69 | } |
70 | - }else{ |
|
71 | - if(file_exists('custom/include/MVC/Controller/SugarController.php')){ |
|
70 | + } else { |
|
71 | + if (file_exists('custom/include/MVC/Controller/SugarController.php')) { |
|
72 | 72 | require_once('custom/include/MVC/Controller/SugarController.php'); |
73 | 73 | } |
74 | - if(class_exists('CustomSugarController')){ |
|
74 | + if (class_exists('CustomSugarController')) { |
|
75 | 75 | $controller = new CustomSugarController(); |
76 | - }else{ |
|
76 | + } else { |
|
77 | 77 | $controller = new SugarController(); |
78 | 78 | } |
79 | 79 | } |
@@ -57,23 +57,23 @@ |
||
57 | 57 | require_once('custom/modules/'.$module.'/controller.php'); |
58 | 58 | if(class_exists($customClass)){ |
59 | 59 | $controller = new $customClass(); |
60 | - }else if(class_exists($class)){ |
|
60 | + } else if(class_exists($class)){ |
|
61 | 61 | $controller = new $class(); |
62 | 62 | } |
63 | - }elseif(file_exists('modules/'.$module.'/controller.php')){ |
|
63 | + } elseif(file_exists('modules/'.$module.'/controller.php')){ |
|
64 | 64 | require_once('modules/'.$module.'/controller.php'); |
65 | 65 | if(class_exists($customClass)){ |
66 | 66 | $controller = new $customClass(); |
67 | - }else if(class_exists($class)){ |
|
67 | + } else if(class_exists($class)){ |
|
68 | 68 | $controller = new $class(); |
69 | 69 | } |
70 | - }else{ |
|
70 | + } else{ |
|
71 | 71 | if(file_exists('custom/include/MVC/Controller/SugarController.php')){ |
72 | 72 | require_once('custom/include/MVC/Controller/SugarController.php'); |
73 | 73 | } |
74 | 74 | if(class_exists('CustomSugarController')){ |
75 | 75 | $controller = new CustomSugarController(); |
76 | - }else{ |
|
76 | + } else{ |
|
77 | 77 | $controller = new SugarController(); |
78 | 78 | } |
79 | 79 | } |
@@ -44,247 +44,247 @@ discard block |
||
44 | 44 | * @api |
45 | 45 | */ |
46 | 46 | class SugarController{ |
47 | - /** |
|
48 | - * remap actions in here |
|
49 | - * e.g. make all detail views go to edit views |
|
50 | - * $action_remap = array('detailview'=>'editview'); |
|
51 | - */ |
|
52 | - protected $action_remap = array('index'=>'listview'); |
|
53 | - /** |
|
54 | - * The name of the current module. |
|
55 | - */ |
|
56 | - public $module = 'Home'; |
|
57 | - /** |
|
58 | - * The name of the target module. |
|
59 | - */ |
|
60 | - public $target_module = null; |
|
61 | - /** |
|
62 | - * The name of the current action. |
|
63 | - */ |
|
64 | - public $action = 'index'; |
|
65 | - /** |
|
66 | - * The id of the current record. |
|
67 | - */ |
|
68 | - public $record = ''; |
|
69 | - /** |
|
70 | - * The name of the return module. |
|
71 | - */ |
|
72 | - public $return_module = null; |
|
73 | - /** |
|
74 | - * The name of the return action. |
|
75 | - */ |
|
76 | - public $return_action = null; |
|
77 | - /** |
|
78 | - * The id of the return record. |
|
79 | - */ |
|
80 | - public $return_id = null; |
|
81 | - /** |
|
82 | - * If the action was remapped it will be set to do_action and then we will just |
|
83 | - * use do_action for the actual action to perform. |
|
84 | - */ |
|
85 | - protected $do_action = 'index'; |
|
86 | - /** |
|
87 | - * If a bean is present that set it. |
|
88 | - */ |
|
89 | - public $bean = null; |
|
90 | - /** |
|
91 | - * url to redirect to |
|
92 | - */ |
|
93 | - public $redirect_url = ''; |
|
94 | - /** |
|
95 | - * any subcontroller can modify this to change the view |
|
96 | - */ |
|
97 | - public $view = 'classic'; |
|
98 | - /** |
|
99 | - * this array will hold the mappings between a key and an object for use within the view. |
|
100 | - */ |
|
101 | - public $view_object_map = array(); |
|
47 | + /** |
|
48 | + * remap actions in here |
|
49 | + * e.g. make all detail views go to edit views |
|
50 | + * $action_remap = array('detailview'=>'editview'); |
|
51 | + */ |
|
52 | + protected $action_remap = array('index'=>'listview'); |
|
53 | + /** |
|
54 | + * The name of the current module. |
|
55 | + */ |
|
56 | + public $module = 'Home'; |
|
57 | + /** |
|
58 | + * The name of the target module. |
|
59 | + */ |
|
60 | + public $target_module = null; |
|
61 | + /** |
|
62 | + * The name of the current action. |
|
63 | + */ |
|
64 | + public $action = 'index'; |
|
65 | + /** |
|
66 | + * The id of the current record. |
|
67 | + */ |
|
68 | + public $record = ''; |
|
69 | + /** |
|
70 | + * The name of the return module. |
|
71 | + */ |
|
72 | + public $return_module = null; |
|
73 | + /** |
|
74 | + * The name of the return action. |
|
75 | + */ |
|
76 | + public $return_action = null; |
|
77 | + /** |
|
78 | + * The id of the return record. |
|
79 | + */ |
|
80 | + public $return_id = null; |
|
81 | + /** |
|
82 | + * If the action was remapped it will be set to do_action and then we will just |
|
83 | + * use do_action for the actual action to perform. |
|
84 | + */ |
|
85 | + protected $do_action = 'index'; |
|
86 | + /** |
|
87 | + * If a bean is present that set it. |
|
88 | + */ |
|
89 | + public $bean = null; |
|
90 | + /** |
|
91 | + * url to redirect to |
|
92 | + */ |
|
93 | + public $redirect_url = ''; |
|
94 | + /** |
|
95 | + * any subcontroller can modify this to change the view |
|
96 | + */ |
|
97 | + public $view = 'classic'; |
|
98 | + /** |
|
99 | + * this array will hold the mappings between a key and an object for use within the view. |
|
100 | + */ |
|
101 | + public $view_object_map = array(); |
|
102 | 102 | |
103 | - /** |
|
104 | - * This array holds the methods that handleAction() will invoke, in sequence. |
|
105 | - */ |
|
106 | - protected $tasks = array( |
|
107 | - 'pre_action', |
|
108 | - 'do_action', |
|
109 | - 'post_action' |
|
110 | - ); |
|
111 | - /** |
|
112 | - * List of options to run through within the process() method. |
|
113 | - * This list is meant to easily allow additions for new functionality as well as |
|
114 | - * the ability to add a controller's own handling. |
|
115 | - */ |
|
116 | - public $process_tasks = array( |
|
117 | - 'blockFileAccess', |
|
118 | - 'handleEntryPoint', |
|
119 | - 'callLegacyCode', |
|
120 | - 'remapAction', |
|
121 | - 'handle_action', |
|
122 | - 'handleActionMaps', |
|
123 | - ); |
|
124 | - /** |
|
125 | - * Whether or not the action has been handled by $process_tasks |
|
126 | - * |
|
127 | - * @var bool |
|
128 | - */ |
|
129 | - protected $_processed = false; |
|
130 | - /** |
|
131 | - * Map an action directly to a file |
|
132 | - */ |
|
133 | - /** |
|
134 | - * Map an action directly to a file. This will be loaded from action_file_map.php |
|
135 | - */ |
|
136 | - protected $action_file_map = array(); |
|
137 | - /** |
|
138 | - * Map an action directly to a view |
|
139 | - */ |
|
140 | - /** |
|
141 | - * Map an action directly to a view. This will be loaded from action_view_map.php |
|
142 | - */ |
|
143 | - protected $action_view_map = array(); |
|
103 | + /** |
|
104 | + * This array holds the methods that handleAction() will invoke, in sequence. |
|
105 | + */ |
|
106 | + protected $tasks = array( |
|
107 | + 'pre_action', |
|
108 | + 'do_action', |
|
109 | + 'post_action' |
|
110 | + ); |
|
111 | + /** |
|
112 | + * List of options to run through within the process() method. |
|
113 | + * This list is meant to easily allow additions for new functionality as well as |
|
114 | + * the ability to add a controller's own handling. |
|
115 | + */ |
|
116 | + public $process_tasks = array( |
|
117 | + 'blockFileAccess', |
|
118 | + 'handleEntryPoint', |
|
119 | + 'callLegacyCode', |
|
120 | + 'remapAction', |
|
121 | + 'handle_action', |
|
122 | + 'handleActionMaps', |
|
123 | + ); |
|
124 | + /** |
|
125 | + * Whether or not the action has been handled by $process_tasks |
|
126 | + * |
|
127 | + * @var bool |
|
128 | + */ |
|
129 | + protected $_processed = false; |
|
130 | + /** |
|
131 | + * Map an action directly to a file |
|
132 | + */ |
|
133 | + /** |
|
134 | + * Map an action directly to a file. This will be loaded from action_file_map.php |
|
135 | + */ |
|
136 | + protected $action_file_map = array(); |
|
137 | + /** |
|
138 | + * Map an action directly to a view |
|
139 | + */ |
|
140 | + /** |
|
141 | + * Map an action directly to a view. This will be loaded from action_view_map.php |
|
142 | + */ |
|
143 | + protected $action_view_map = array(); |
|
144 | 144 | |
145 | - /** |
|
146 | - * This can be set from the application to tell us whether we have authorization to |
|
147 | - * process the action. If this is set we will default to the noaccess view. |
|
148 | - */ |
|
149 | - public $hasAccess = true; |
|
145 | + /** |
|
146 | + * This can be set from the application to tell us whether we have authorization to |
|
147 | + * process the action. If this is set we will default to the noaccess view. |
|
148 | + */ |
|
149 | + public $hasAccess = true; |
|
150 | 150 | |
151 | - /** |
|
152 | - * Map case sensitive filenames to action. This is used for linux/unix systems |
|
153 | - * where filenames are case sensitive |
|
154 | - */ |
|
155 | - public static $action_case_file = array( |
|
156 | - 'editview'=>'EditView', |
|
157 | - 'detailview'=>'DetailView', |
|
158 | - 'listview'=>'ListView' |
|
159 | - ); |
|
160 | - |
|
161 | - /** |
|
162 | - * Constructor. This ie meant tot load up the module, action, record as well |
|
163 | - * as the mapping arrays. |
|
164 | - */ |
|
165 | - function SugarController(){ |
|
166 | - } |
|
151 | + /** |
|
152 | + * Map case sensitive filenames to action. This is used for linux/unix systems |
|
153 | + * where filenames are case sensitive |
|
154 | + */ |
|
155 | + public static $action_case_file = array( |
|
156 | + 'editview'=>'EditView', |
|
157 | + 'detailview'=>'DetailView', |
|
158 | + 'listview'=>'ListView' |
|
159 | + ); |
|
167 | 160 | |
168 | - /** |
|
169 | - * Called from SugarApplication and is meant to perform the setup operations |
|
170 | - * on the controller. |
|
171 | - * |
|
172 | - */ |
|
173 | - public function setup($module = ''){ |
|
174 | - if(empty($module) && !empty($_REQUEST['module'])) |
|
175 | - $module = $_REQUEST['module']; |
|
176 | - //set the module |
|
177 | - if(!empty($module)) |
|
178 | - $this->setModule($module); |
|
179 | - |
|
180 | - if(!empty($_REQUEST['target_module']) && $_REQUEST['target_module'] != 'undefined') { |
|
181 | - $this->target_module = $_REQUEST['target_module']; |
|
182 | - } |
|
183 | - //set properties on the controller from the $_REQUEST |
|
184 | - $this->loadPropertiesFromRequest(); |
|
185 | - //load the mapping files |
|
186 | - $this->loadMappings(); |
|
187 | - } |
|
188 | - /** |
|
189 | - * Set the module on the Controller |
|
190 | - * |
|
191 | - * @param object $module |
|
192 | - */ |
|
193 | - public function setModule($module){ |
|
194 | - $this->module = $module; |
|
195 | - } |
|
161 | + /** |
|
162 | + * Constructor. This ie meant tot load up the module, action, record as well |
|
163 | + * as the mapping arrays. |
|
164 | + */ |
|
165 | + function SugarController(){ |
|
166 | + } |
|
196 | 167 | |
197 | - /** |
|
198 | - * Set properties on the Controller from the $_REQUEST |
|
199 | - * |
|
200 | - */ |
|
201 | - private function loadPropertiesFromRequest(){ |
|
202 | - if(!empty($_REQUEST['action'])) |
|
203 | - $this->action = $_REQUEST['action']; |
|
204 | - if(!empty($_REQUEST['record'])) |
|
205 | - $this->record = $_REQUEST['record']; |
|
206 | - if(!empty($_REQUEST['view'])) |
|
207 | - $this->view = $_REQUEST['view']; |
|
208 | - if(!empty($_REQUEST['return_module'])) |
|
209 | - $this->return_module = $_REQUEST['return_module']; |
|
210 | - if(!empty($_REQUEST['return_action'])) |
|
211 | - $this->return_action = $_REQUEST['return_action']; |
|
212 | - if(!empty($_REQUEST['return_id'])) |
|
213 | - $this->return_id = $_REQUEST['return_id']; |
|
214 | - } |
|
168 | + /** |
|
169 | + * Called from SugarApplication and is meant to perform the setup operations |
|
170 | + * on the controller. |
|
171 | + * |
|
172 | + */ |
|
173 | + public function setup($module = ''){ |
|
174 | + if(empty($module) && !empty($_REQUEST['module'])) |
|
175 | + $module = $_REQUEST['module']; |
|
176 | + //set the module |
|
177 | + if(!empty($module)) |
|
178 | + $this->setModule($module); |
|
179 | + |
|
180 | + if(!empty($_REQUEST['target_module']) && $_REQUEST['target_module'] != 'undefined') { |
|
181 | + $this->target_module = $_REQUEST['target_module']; |
|
182 | + } |
|
183 | + //set properties on the controller from the $_REQUEST |
|
184 | + $this->loadPropertiesFromRequest(); |
|
185 | + //load the mapping files |
|
186 | + $this->loadMappings(); |
|
187 | + } |
|
188 | + /** |
|
189 | + * Set the module on the Controller |
|
190 | + * |
|
191 | + * @param object $module |
|
192 | + */ |
|
193 | + public function setModule($module){ |
|
194 | + $this->module = $module; |
|
195 | + } |
|
215 | 196 | |
216 | - /** |
|
217 | - * Load map files for use within the Controller |
|
218 | - * |
|
219 | - */ |
|
220 | - private function loadMappings(){ |
|
221 | - $this->loadMapping('action_view_map'); |
|
222 | - $this->loadMapping('action_file_map'); |
|
223 | - $this->loadMapping('action_remap', true); |
|
224 | - } |
|
197 | + /** |
|
198 | + * Set properties on the Controller from the $_REQUEST |
|
199 | + * |
|
200 | + */ |
|
201 | + private function loadPropertiesFromRequest(){ |
|
202 | + if(!empty($_REQUEST['action'])) |
|
203 | + $this->action = $_REQUEST['action']; |
|
204 | + if(!empty($_REQUEST['record'])) |
|
205 | + $this->record = $_REQUEST['record']; |
|
206 | + if(!empty($_REQUEST['view'])) |
|
207 | + $this->view = $_REQUEST['view']; |
|
208 | + if(!empty($_REQUEST['return_module'])) |
|
209 | + $this->return_module = $_REQUEST['return_module']; |
|
210 | + if(!empty($_REQUEST['return_action'])) |
|
211 | + $this->return_action = $_REQUEST['return_action']; |
|
212 | + if(!empty($_REQUEST['return_id'])) |
|
213 | + $this->return_id = $_REQUEST['return_id']; |
|
214 | + } |
|
225 | 215 | |
226 | - /** |
|
227 | - * Given a record id load the bean. This bean is accessible from any sub controllers. |
|
228 | - */ |
|
229 | - public function loadBean() |
|
230 | - { |
|
231 | - if(!empty($GLOBALS['beanList'][$this->module])){ |
|
232 | - $class = $GLOBALS['beanList'][$this->module]; |
|
233 | - if(!empty($GLOBALS['beanFiles'][$class])){ |
|
234 | - require_once($GLOBALS['beanFiles'][$class]); |
|
235 | - $this->bean = new $class(); |
|
236 | - if(!empty($this->record)){ |
|
237 | - $this->bean->retrieve($this->record); |
|
238 | - if($this->bean) |
|
239 | - $GLOBALS['FOCUS'] = $this->bean; |
|
240 | - } |
|
241 | - } |
|
242 | - } |
|
243 | - } |
|
216 | + /** |
|
217 | + * Load map files for use within the Controller |
|
218 | + * |
|
219 | + */ |
|
220 | + private function loadMappings(){ |
|
221 | + $this->loadMapping('action_view_map'); |
|
222 | + $this->loadMapping('action_file_map'); |
|
223 | + $this->loadMapping('action_remap', true); |
|
224 | + } |
|
244 | 225 | |
245 | - /** |
|
246 | - * Generic load method to load mapping arrays. |
|
247 | - */ |
|
248 | - private function loadMapping($var, $merge = false){ |
|
249 | - $$var = sugar_cache_retrieve("CONTROLLER_". $var . "_".$this->module); |
|
250 | - if(!$$var){ |
|
251 | - if($merge && !empty($this->$var)){ |
|
252 | - $$var = $this->$var; |
|
253 | - }else{ |
|
254 | - $$var = array(); |
|
255 | - } |
|
256 | - if(file_exists('include/MVC/Controller/'. $var . '.php')){ |
|
257 | - require('include/MVC/Controller/'. $var . '.php'); |
|
258 | - } |
|
259 | - if(file_exists('modules/'.$this->module.'/'. $var . '.php')){ |
|
260 | - require('modules/'.$this->module.'/'. $var . '.php'); |
|
261 | - } |
|
262 | - if(file_exists('custom/modules/'.$this->module.'/'. $var . '.php')){ |
|
263 | - require('custom/modules/'.$this->module.'/'. $var . '.php'); |
|
264 | - } |
|
265 | - if(file_exists('custom/include/MVC/Controller/'. $var . '.php')){ |
|
266 | - require('custom/include/MVC/Controller/'. $var . '.php'); |
|
267 | - } |
|
226 | + /** |
|
227 | + * Given a record id load the bean. This bean is accessible from any sub controllers. |
|
228 | + */ |
|
229 | + public function loadBean() |
|
230 | + { |
|
231 | + if(!empty($GLOBALS['beanList'][$this->module])){ |
|
232 | + $class = $GLOBALS['beanList'][$this->module]; |
|
233 | + if(!empty($GLOBALS['beanFiles'][$class])){ |
|
234 | + require_once($GLOBALS['beanFiles'][$class]); |
|
235 | + $this->bean = new $class(); |
|
236 | + if(!empty($this->record)){ |
|
237 | + $this->bean->retrieve($this->record); |
|
238 | + if($this->bean) |
|
239 | + $GLOBALS['FOCUS'] = $this->bean; |
|
240 | + } |
|
241 | + } |
|
242 | + } |
|
243 | + } |
|
244 | + |
|
245 | + /** |
|
246 | + * Generic load method to load mapping arrays. |
|
247 | + */ |
|
248 | + private function loadMapping($var, $merge = false){ |
|
249 | + $$var = sugar_cache_retrieve("CONTROLLER_". $var . "_".$this->module); |
|
250 | + if(!$$var){ |
|
251 | + if($merge && !empty($this->$var)){ |
|
252 | + $$var = $this->$var; |
|
253 | + }else{ |
|
254 | + $$var = array(); |
|
255 | + } |
|
256 | + if(file_exists('include/MVC/Controller/'. $var . '.php')){ |
|
257 | + require('include/MVC/Controller/'. $var . '.php'); |
|
258 | + } |
|
259 | + if(file_exists('modules/'.$this->module.'/'. $var . '.php')){ |
|
260 | + require('modules/'.$this->module.'/'. $var . '.php'); |
|
261 | + } |
|
262 | + if(file_exists('custom/modules/'.$this->module.'/'. $var . '.php')){ |
|
263 | + require('custom/modules/'.$this->module.'/'. $var . '.php'); |
|
264 | + } |
|
265 | + if(file_exists('custom/include/MVC/Controller/'. $var . '.php')){ |
|
266 | + require('custom/include/MVC/Controller/'. $var . '.php'); |
|
267 | + } |
|
268 | 268 | |
269 | 269 | // entry_point_registry -> EntryPointRegistry |
270 | 270 | |
271 | - $varname = str_replace(" ","",ucwords(str_replace("_"," ", $var))); |
|
271 | + $varname = str_replace(" ","",ucwords(str_replace("_"," ", $var))); |
|
272 | 272 | if(file_exists("custom/application/Ext/$varname/$var.ext.php")){ |
273 | - require("custom/application/Ext/$varname/$var.ext.php"); |
|
274 | - } |
|
275 | - if(file_exists("custom/modules/{$this->module}/Ext/$varname/$var.ext.php")){ |
|
276 | - require("custom/modules/{$this->module}/Ext/$varname/$var.ext.php"); |
|
277 | - } |
|
278 | - |
|
279 | - sugar_cache_put("CONTROLLER_". $var . "_".$this->module, $$var); |
|
280 | - } |
|
281 | - $this->$var = $$var; |
|
282 | - } |
|
273 | + require("custom/application/Ext/$varname/$var.ext.php"); |
|
274 | + } |
|
275 | + if(file_exists("custom/modules/{$this->module}/Ext/$varname/$var.ext.php")){ |
|
276 | + require("custom/modules/{$this->module}/Ext/$varname/$var.ext.php"); |
|
277 | + } |
|
283 | 278 | |
284 | - /** |
|
285 | - * This method is called from SugarApplication->execute and it will bootstrap the entire controller process |
|
286 | - */ |
|
287 | - final public function execute() |
|
279 | + sugar_cache_put("CONTROLLER_". $var . "_".$this->module, $$var); |
|
280 | + } |
|
281 | + $this->$var = $$var; |
|
282 | + } |
|
283 | + |
|
284 | + /** |
|
285 | + * This method is called from SugarApplication->execute and it will bootstrap the entire controller process |
|
286 | + */ |
|
287 | + final public function execute() |
|
288 | 288 | { |
289 | 289 | |
290 | 290 | try |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | } |
297 | 297 | elseif(!empty($this->redirect_url)) |
298 | 298 | { |
299 | - $this->redirect(); |
|
299 | + $this->redirect(); |
|
300 | 300 | } |
301 | 301 | } |
302 | 302 | catch (Exception $e) |
@@ -306,12 +306,12 @@ discard block |
||
306 | 306 | |
307 | 307 | |
308 | 308 | |
309 | - } |
|
309 | + } |
|
310 | 310 | |
311 | 311 | /** |
312 | - * Handle exception |
|
313 | - * @param Exception $e |
|
314 | - */ |
|
312 | + * Handle exception |
|
313 | + * @param Exception $e |
|
314 | + */ |
|
315 | 315 | protected function handleException(Exception $e) |
316 | 316 | { |
317 | 317 | $GLOBALS['log']->fatal('Exception in Controller: ' . $e->getMessage()); |
@@ -328,52 +328,52 @@ discard block |
||
328 | 328 | } |
329 | 329 | } |
330 | 330 | |
331 | - /** |
|
332 | - * Display the appropriate view. |
|
333 | - */ |
|
334 | - private function processView(){ |
|
335 | - if(!isset($this->view_object_map['remap_action']) && isset($this->action_view_map[strtolower($this->action)])) |
|
336 | - { |
|
337 | - $this->view_object_map['remap_action'] = $this->action_view_map[strtolower($this->action)]; |
|
338 | - } |
|
339 | - $view = ViewFactory::loadView($this->view, $this->module, $this->bean, $this->view_object_map, $this->target_module); |
|
340 | - $GLOBALS['current_view'] = $view; |
|
341 | - if(!empty($this->bean) && !$this->bean->ACLAccess($view->type) && $view->type != 'list'){ |
|
342 | - ACLController::displayNoAccess(true); |
|
343 | - sugar_cleanup(true); |
|
344 | - } |
|
345 | - if(isset($this->errors)){ |
|
346 | - $view->errors = $this->errors; |
|
347 | - } |
|
348 | - $view->process(); |
|
349 | - } |
|
331 | + /** |
|
332 | + * Display the appropriate view. |
|
333 | + */ |
|
334 | + private function processView(){ |
|
335 | + if(!isset($this->view_object_map['remap_action']) && isset($this->action_view_map[strtolower($this->action)])) |
|
336 | + { |
|
337 | + $this->view_object_map['remap_action'] = $this->action_view_map[strtolower($this->action)]; |
|
338 | + } |
|
339 | + $view = ViewFactory::loadView($this->view, $this->module, $this->bean, $this->view_object_map, $this->target_module); |
|
340 | + $GLOBALS['current_view'] = $view; |
|
341 | + if(!empty($this->bean) && !$this->bean->ACLAccess($view->type) && $view->type != 'list'){ |
|
342 | + ACLController::displayNoAccess(true); |
|
343 | + sugar_cleanup(true); |
|
344 | + } |
|
345 | + if(isset($this->errors)){ |
|
346 | + $view->errors = $this->errors; |
|
347 | + } |
|
348 | + $view->process(); |
|
349 | + } |
|
350 | 350 | |
351 | - /** |
|
352 | - * Meant to be overridden by a subclass and allows for specific functionality to be |
|
353 | - * injected prior to the process() method being called. |
|
354 | - */ |
|
355 | - public function preProcess() |
|
356 | - {} |
|
357 | - |
|
358 | - /** |
|
359 | - * if we have a function to support the action use it otherwise use the default action |
|
360 | - * |
|
361 | - * 1) check for file |
|
362 | - * 2) check for action |
|
363 | - */ |
|
364 | - public function process(){ |
|
365 | - $GLOBALS['action'] = $this->action; |
|
366 | - $GLOBALS['module'] = $this->module; |
|
351 | + /** |
|
352 | + * Meant to be overridden by a subclass and allows for specific functionality to be |
|
353 | + * injected prior to the process() method being called. |
|
354 | + */ |
|
355 | + public function preProcess() |
|
356 | + {} |
|
367 | 357 | |
368 | - //check to ensure we have access to the module. |
|
369 | - if($this->hasAccess){ |
|
370 | - $this->do_action = $this->action; |
|
358 | + /** |
|
359 | + * if we have a function to support the action use it otherwise use the default action |
|
360 | + * |
|
361 | + * 1) check for file |
|
362 | + * 2) check for action |
|
363 | + */ |
|
364 | + public function process(){ |
|
365 | + $GLOBALS['action'] = $this->action; |
|
366 | + $GLOBALS['module'] = $this->module; |
|
371 | 367 | |
372 | - $file = self::getActionFilename($this->do_action); |
|
368 | + //check to ensure we have access to the module. |
|
369 | + if($this->hasAccess){ |
|
370 | + $this->do_action = $this->action; |
|
373 | 371 | |
374 | - $this->loadBean(); |
|
372 | + $file = self::getActionFilename($this->do_action); |
|
375 | 373 | |
376 | - $processed = false; |
|
374 | + $this->loadBean(); |
|
375 | + |
|
376 | + $processed = false; |
|
377 | 377 | if (!$this->_processed) { |
378 | 378 | foreach ($this->process_tasks as $process) { |
379 | 379 | $this->$process(); |
@@ -383,173 +383,173 @@ discard block |
||
383 | 383 | } |
384 | 384 | } |
385 | 385 | |
386 | - $this->redirect(); |
|
387 | - }else{ |
|
388 | - $this->no_access(); |
|
389 | - } |
|
390 | - } |
|
386 | + $this->redirect(); |
|
387 | + }else{ |
|
388 | + $this->no_access(); |
|
389 | + } |
|
390 | + } |
|
391 | 391 | |
392 | - /** |
|
393 | - * This method is called from the process method. I could also be called within an action_* method. |
|
394 | - * It allows a developer to override any one of these methods contained within, |
|
395 | - * or if the developer so chooses they can override the entire action_* method. |
|
396 | - * |
|
397 | - * @return true if any one of the pre_, do_, or post_ methods have been defined, |
|
398 | - * false otherwise. This is important b/c if none of these methods exists, then we will run the |
|
399 | - * action_default() method. |
|
400 | - */ |
|
401 | - protected function handle_action(){ |
|
402 | - $processed = false; |
|
403 | - foreach($this->tasks as $task){ |
|
404 | - $processed = ($this->$task() || $processed); |
|
405 | - } |
|
406 | - $this->_processed = $processed; |
|
407 | - } |
|
392 | + /** |
|
393 | + * This method is called from the process method. I could also be called within an action_* method. |
|
394 | + * It allows a developer to override any one of these methods contained within, |
|
395 | + * or if the developer so chooses they can override the entire action_* method. |
|
396 | + * |
|
397 | + * @return true if any one of the pre_, do_, or post_ methods have been defined, |
|
398 | + * false otherwise. This is important b/c if none of these methods exists, then we will run the |
|
399 | + * action_default() method. |
|
400 | + */ |
|
401 | + protected function handle_action(){ |
|
402 | + $processed = false; |
|
403 | + foreach($this->tasks as $task){ |
|
404 | + $processed = ($this->$task() || $processed); |
|
405 | + } |
|
406 | + $this->_processed = $processed; |
|
407 | + } |
|
408 | 408 | |
409 | - /** |
|
410 | - * Perform an action prior to the specified action. |
|
411 | - * This can be overridde in a sub-class |
|
412 | - */ |
|
413 | - private function pre_action(){ |
|
414 | - $function = 'pre_' . $this->action; |
|
415 | - if($this->hasFunction($function)){ |
|
416 | - $GLOBALS['log']->debug('Performing pre_action'); |
|
417 | - $this->$function(); |
|
418 | - return true; |
|
419 | - } |
|
420 | - return false; |
|
421 | - } |
|
409 | + /** |
|
410 | + * Perform an action prior to the specified action. |
|
411 | + * This can be overridde in a sub-class |
|
412 | + */ |
|
413 | + private function pre_action(){ |
|
414 | + $function = 'pre_' . $this->action; |
|
415 | + if($this->hasFunction($function)){ |
|
416 | + $GLOBALS['log']->debug('Performing pre_action'); |
|
417 | + $this->$function(); |
|
418 | + return true; |
|
419 | + } |
|
420 | + return false; |
|
421 | + } |
|
422 | 422 | |
423 | - /** |
|
424 | - * Perform the specified action. |
|
425 | - * This can be overridde in a sub-class |
|
426 | - */ |
|
427 | - private function do_action(){ |
|
428 | - $function = 'action_'. strtolower($this->do_action); |
|
429 | - if($this->hasFunction($function)){ |
|
430 | - $GLOBALS['log']->debug('Performing action: '.$function.' MODULE: '.$this->module); |
|
431 | - $this->$function(); |
|
432 | - return true; |
|
433 | - } |
|
434 | - return false; |
|
435 | - } |
|
423 | + /** |
|
424 | + * Perform the specified action. |
|
425 | + * This can be overridde in a sub-class |
|
426 | + */ |
|
427 | + private function do_action(){ |
|
428 | + $function = 'action_'. strtolower($this->do_action); |
|
429 | + if($this->hasFunction($function)){ |
|
430 | + $GLOBALS['log']->debug('Performing action: '.$function.' MODULE: '.$this->module); |
|
431 | + $this->$function(); |
|
432 | + return true; |
|
433 | + } |
|
434 | + return false; |
|
435 | + } |
|
436 | 436 | |
437 | - /** |
|
438 | - * Perform an action after to the specified action has occurred. |
|
439 | - * This can be overridde in a sub-class |
|
440 | - */ |
|
441 | - private function post_action(){ |
|
442 | - $function = 'post_' . $this->action; |
|
443 | - if($this->hasFunction($function)){ |
|
444 | - $GLOBALS['log']->debug('Performing post_action'); |
|
445 | - $this->$function(); |
|
446 | - return true; |
|
447 | - } |
|
448 | - return false; |
|
449 | - } |
|
437 | + /** |
|
438 | + * Perform an action after to the specified action has occurred. |
|
439 | + * This can be overridde in a sub-class |
|
440 | + */ |
|
441 | + private function post_action(){ |
|
442 | + $function = 'post_' . $this->action; |
|
443 | + if($this->hasFunction($function)){ |
|
444 | + $GLOBALS['log']->debug('Performing post_action'); |
|
445 | + $this->$function(); |
|
446 | + return true; |
|
447 | + } |
|
448 | + return false; |
|
449 | + } |
|
450 | 450 | |
451 | - /** |
|
452 | - * If there is no action found then display an error to the user. |
|
453 | - */ |
|
454 | - protected function no_action(){ |
|
455 | - sugar_die($GLOBALS['app_strings']['LBL_NO_ACTION']); |
|
456 | - } |
|
451 | + /** |
|
452 | + * If there is no action found then display an error to the user. |
|
453 | + */ |
|
454 | + protected function no_action(){ |
|
455 | + sugar_die($GLOBALS['app_strings']['LBL_NO_ACTION']); |
|
456 | + } |
|
457 | 457 | |
458 | - /** |
|
459 | - * The default action handler for instances where we do not have access to process. |
|
460 | - */ |
|
461 | - protected function no_access(){ |
|
462 | - $this->view = 'noaccess'; |
|
463 | - } |
|
458 | + /** |
|
459 | + * The default action handler for instances where we do not have access to process. |
|
460 | + */ |
|
461 | + protected function no_access(){ |
|
462 | + $this->view = 'noaccess'; |
|
463 | + } |
|
464 | 464 | |
465 | - /////////////////////////////////////////////// |
|
466 | - /////// HELPER FUNCTIONS |
|
467 | - /////////////////////////////////////////////// |
|
465 | + /////////////////////////////////////////////// |
|
466 | + /////// HELPER FUNCTIONS |
|
467 | + /////////////////////////////////////////////// |
|
468 | 468 | |
469 | - /** |
|
470 | - * Determine if a given function exists on the objects |
|
471 | - * @param function - the function to check |
|
472 | - * @return true if the method exists on the object, false otherwise |
|
473 | - */ |
|
474 | - protected function hasFunction($function){ |
|
475 | - return method_exists($this, $function); |
|
476 | - } |
|
469 | + /** |
|
470 | + * Determine if a given function exists on the objects |
|
471 | + * @param function - the function to check |
|
472 | + * @return true if the method exists on the object, false otherwise |
|
473 | + */ |
|
474 | + protected function hasFunction($function){ |
|
475 | + return method_exists($this, $function); |
|
476 | + } |
|
477 | 477 | |
478 | 478 | |
479 | - /** |
|
480 | - * Set the url to which we will want to redirect |
|
481 | - * |
|
482 | - * @param string url - the url to which we will want to redirect |
|
483 | - */ |
|
484 | - protected function set_redirect($url){ |
|
485 | - $this->redirect_url = $url; |
|
486 | - } |
|
479 | + /** |
|
480 | + * Set the url to which we will want to redirect |
|
481 | + * |
|
482 | + * @param string url - the url to which we will want to redirect |
|
483 | + */ |
|
484 | + protected function set_redirect($url){ |
|
485 | + $this->redirect_url = $url; |
|
486 | + } |
|
487 | 487 | |
488 | - /** |
|
489 | - * Perform redirection based on the redirect_url |
|
490 | - * |
|
491 | - */ |
|
492 | - protected function redirect(){ |
|
488 | + /** |
|
489 | + * Perform redirection based on the redirect_url |
|
490 | + * |
|
491 | + */ |
|
492 | + protected function redirect(){ |
|
493 | 493 | |
494 | - if(!empty($this->redirect_url)) |
|
495 | - SugarApplication::redirect($this->redirect_url); |
|
496 | - } |
|
494 | + if(!empty($this->redirect_url)) |
|
495 | + SugarApplication::redirect($this->redirect_url); |
|
496 | + } |
|
497 | 497 | |
498 | - //////////////////////////////////////////////////////// |
|
499 | - ////// DEFAULT ACTIONS |
|
500 | - /////////////////////////////////////////////////////// |
|
498 | + //////////////////////////////////////////////////////// |
|
499 | + ////// DEFAULT ACTIONS |
|
500 | + /////////////////////////////////////////////////////// |
|
501 | 501 | |
502 | - /* |
|
502 | + /* |
|
503 | 503 | * Save a bean |
504 | 504 | */ |
505 | 505 | |
506 | - /** |
|
507 | - * Do some processing before saving the bean to the database. |
|
508 | - */ |
|
509 | - public function pre_save(){ |
|
510 | - if(!empty($_POST['assigned_user_id']) && $_POST['assigned_user_id'] != $this->bean->assigned_user_id && $_POST['assigned_user_id'] != $GLOBALS['current_user']->id && empty($GLOBALS['sugar_config']['exclude_notifications'][$this->bean->module_dir])){ |
|
511 | - $this->bean->notify_on_save = true; |
|
512 | - } |
|
513 | - $GLOBALS['log']->debug("SugarController:: performing pre_save."); |
|
506 | + /** |
|
507 | + * Do some processing before saving the bean to the database. |
|
508 | + */ |
|
509 | + public function pre_save(){ |
|
510 | + if(!empty($_POST['assigned_user_id']) && $_POST['assigned_user_id'] != $this->bean->assigned_user_id && $_POST['assigned_user_id'] != $GLOBALS['current_user']->id && empty($GLOBALS['sugar_config']['exclude_notifications'][$this->bean->module_dir])){ |
|
511 | + $this->bean->notify_on_save = true; |
|
512 | + } |
|
513 | + $GLOBALS['log']->debug("SugarController:: performing pre_save."); |
|
514 | 514 | require_once('include/SugarFields/SugarFieldHandler.php'); |
515 | 515 | $sfh = new SugarFieldHandler(); |
516 | - foreach($this->bean->field_defs as $field => $properties) { |
|
517 | - $type = !empty($properties['custom_type']) ? $properties['custom_type'] : $properties['type']; |
|
518 | - $sf = $sfh->getSugarField(ucfirst($type), true); |
|
519 | - if(isset($_POST[$field])) { |
|
520 | - if(is_array($_POST[$field]) && !empty($properties['isMultiSelect'])) { |
|
521 | - if(empty($_POST[$field][0])) { |
|
522 | - unset($_POST[$field][0]); |
|
523 | - } |
|
524 | - $_POST[$field] = encodeMultienumValue($_POST[$field]); |
|
525 | - } |
|
526 | - $this->bean->$field = $_POST[$field]; |
|
527 | - } else if(!empty($properties['isMultiSelect']) && !isset($_POST[$field]) && isset($_POST[$field . '_multiselect'])) { |
|
528 | - $this->bean->$field = ''; |
|
529 | - } |
|
516 | + foreach($this->bean->field_defs as $field => $properties) { |
|
517 | + $type = !empty($properties['custom_type']) ? $properties['custom_type'] : $properties['type']; |
|
518 | + $sf = $sfh->getSugarField(ucfirst($type), true); |
|
519 | + if(isset($_POST[$field])) { |
|
520 | + if(is_array($_POST[$field]) && !empty($properties['isMultiSelect'])) { |
|
521 | + if(empty($_POST[$field][0])) { |
|
522 | + unset($_POST[$field][0]); |
|
523 | + } |
|
524 | + $_POST[$field] = encodeMultienumValue($_POST[$field]); |
|
525 | + } |
|
526 | + $this->bean->$field = $_POST[$field]; |
|
527 | + } else if(!empty($properties['isMultiSelect']) && !isset($_POST[$field]) && isset($_POST[$field . '_multiselect'])) { |
|
528 | + $this->bean->$field = ''; |
|
529 | + } |
|
530 | 530 | if($sf != null){ |
531 | 531 | $sf->save($this->bean, $_POST, $field, $properties); |
532 | 532 | } |
533 | - } |
|
534 | - |
|
535 | - foreach($this->bean->relationship_fields as $field=>$link){ |
|
536 | - if(!empty($_POST[$field])){ |
|
537 | - $this->bean->$field = $_POST[$field]; |
|
538 | - } |
|
539 | - } |
|
540 | - if(!$this->bean->ACLAccess('save')){ |
|
541 | - ACLController::displayNoAccess(true); |
|
542 | - sugar_cleanup(true); |
|
543 | - } |
|
544 | - $this->bean->unformat_all_fields(); |
|
545 | - } |
|
533 | + } |
|
546 | 534 | |
547 | - /** |
|
548 | - * Perform the actual save |
|
549 | - */ |
|
550 | - public function action_save(){ |
|
551 | - $this->bean->save(!empty($this->bean->notify_on_save)); |
|
552 | - } |
|
535 | + foreach($this->bean->relationship_fields as $field=>$link){ |
|
536 | + if(!empty($_POST[$field])){ |
|
537 | + $this->bean->$field = $_POST[$field]; |
|
538 | + } |
|
539 | + } |
|
540 | + if(!$this->bean->ACLAccess('save')){ |
|
541 | + ACLController::displayNoAccess(true); |
|
542 | + sugar_cleanup(true); |
|
543 | + } |
|
544 | + $this->bean->unformat_all_fields(); |
|
545 | + } |
|
546 | + |
|
547 | + /** |
|
548 | + * Perform the actual save |
|
549 | + */ |
|
550 | + public function action_save(){ |
|
551 | + $this->bean->save(!empty($this->bean->notify_on_save)); |
|
552 | + } |
|
553 | 553 | |
554 | 554 | |
555 | 555 | public function action_spot() |
@@ -558,43 +558,43 @@ discard block |
||
558 | 558 | } |
559 | 559 | |
560 | 560 | |
561 | - /** |
|
562 | - * Specify what happens after the save has occurred. |
|
563 | - */ |
|
564 | - protected function post_save(){ |
|
565 | - $module = (!empty($this->return_module) ? $this->return_module : $this->module); |
|
566 | - $action = (!empty($this->return_action) ? $this->return_action : 'DetailView'); |
|
567 | - $id = (!empty($this->return_id) ? $this->return_id : $this->bean->id); |
|
561 | + /** |
|
562 | + * Specify what happens after the save has occurred. |
|
563 | + */ |
|
564 | + protected function post_save(){ |
|
565 | + $module = (!empty($this->return_module) ? $this->return_module : $this->module); |
|
566 | + $action = (!empty($this->return_action) ? $this->return_action : 'DetailView'); |
|
567 | + $id = (!empty($this->return_id) ? $this->return_id : $this->bean->id); |
|
568 | 568 | |
569 | - $url = "index.php?module=".$module."&action=".$action."&record=".$id; |
|
570 | - $this->set_redirect($url); |
|
571 | - } |
|
569 | + $url = "index.php?module=".$module."&action=".$action."&record=".$id; |
|
570 | + $this->set_redirect($url); |
|
571 | + } |
|
572 | 572 | |
573 | - /* |
|
573 | + /* |
|
574 | 574 | * Delete a bean |
575 | 575 | */ |
576 | 576 | |
577 | - /** |
|
578 | - * Perform the actual deletion. |
|
579 | - */ |
|
580 | - protected function action_delete(){ |
|
581 | - //do any pre delete processing |
|
582 | - //if there is some custom logic for deletion. |
|
583 | - if(!empty($_REQUEST['record'])){ |
|
584 | - if(!$this->bean->ACLAccess('Delete')){ |
|
585 | - ACLController::displayNoAccess(true); |
|
586 | - sugar_cleanup(true); |
|
587 | - } |
|
588 | - $this->bean->mark_deleted($_REQUEST['record']); |
|
589 | - }else{ |
|
590 | - sugar_die("A record number must be specified to delete"); |
|
591 | - } |
|
592 | - } |
|
577 | + /** |
|
578 | + * Perform the actual deletion. |
|
579 | + */ |
|
580 | + protected function action_delete(){ |
|
581 | + //do any pre delete processing |
|
582 | + //if there is some custom logic for deletion. |
|
583 | + if(!empty($_REQUEST['record'])){ |
|
584 | + if(!$this->bean->ACLAccess('Delete')){ |
|
585 | + ACLController::displayNoAccess(true); |
|
586 | + sugar_cleanup(true); |
|
587 | + } |
|
588 | + $this->bean->mark_deleted($_REQUEST['record']); |
|
589 | + }else{ |
|
590 | + sugar_die("A record number must be specified to delete"); |
|
591 | + } |
|
592 | + } |
|
593 | 593 | |
594 | - /** |
|
595 | - * Specify what happens after the deletion has occurred. |
|
596 | - */ |
|
597 | - protected function post_delete(){ |
|
594 | + /** |
|
595 | + * Specify what happens after the deletion has occurred. |
|
596 | + */ |
|
597 | + protected function post_delete(){ |
|
598 | 598 | if (empty($_REQUEST['return_url'])) { |
599 | 599 | $return_module = isset($_REQUEST['return_module']) ? |
600 | 600 | $_REQUEST['return_module'] : |
@@ -610,23 +610,23 @@ discard block |
||
610 | 610 | $url = $_REQUEST['return_url']; |
611 | 611 | } |
612 | 612 | |
613 | - //eggsurplus Bug 23816: maintain VCR after an edit/save. If it is a duplicate then don't worry about it. The offset is now worthless. |
|
614 | - if(isset($_REQUEST['offset']) && empty($_REQUEST['duplicateSave'])) { |
|
615 | - $url .= "&offset=".$_REQUEST['offset']; |
|
616 | - } |
|
613 | + //eggsurplus Bug 23816: maintain VCR after an edit/save. If it is a duplicate then don't worry about it. The offset is now worthless. |
|
614 | + if(isset($_REQUEST['offset']) && empty($_REQUEST['duplicateSave'])) { |
|
615 | + $url .= "&offset=".$_REQUEST['offset']; |
|
616 | + } |
|
617 | 617 | |
618 | - $this->set_redirect($url); |
|
619 | - } |
|
620 | - /** |
|
621 | - * Perform the actual massupdate. |
|
622 | - */ |
|
623 | - protected function action_massupdate(){ |
|
624 | - if(!empty($_REQUEST['massupdate']) && $_REQUEST['massupdate'] == 'true' && (!empty($_REQUEST['uid']) || !empty($_REQUEST['entire']))){ |
|
625 | - if(!empty($_REQUEST['Delete']) && $_REQUEST['Delete']=='true' && !$this->bean->ACLAccess('delete') |
|
618 | + $this->set_redirect($url); |
|
619 | + } |
|
620 | + /** |
|
621 | + * Perform the actual massupdate. |
|
622 | + */ |
|
623 | + protected function action_massupdate(){ |
|
624 | + if(!empty($_REQUEST['massupdate']) && $_REQUEST['massupdate'] == 'true' && (!empty($_REQUEST['uid']) || !empty($_REQUEST['entire']))){ |
|
625 | + if(!empty($_REQUEST['Delete']) && $_REQUEST['Delete']=='true' && !$this->bean->ACLAccess('delete') |
|
626 | 626 | || (empty($_REQUEST['Delete']) || $_REQUEST['Delete']!='true') && !$this->bean->ACLAccess('save')){ |
627 | - ACLController::displayNoAccess(true); |
|
628 | - sugar_cleanup(true); |
|
629 | - } |
|
627 | + ACLController::displayNoAccess(true); |
|
628 | + sugar_cleanup(true); |
|
629 | + } |
|
630 | 630 | |
631 | 631 | set_time_limit(0);//I'm wondering if we will set it never goes timeout here. |
632 | 632 | // until we have more efficient way of handling MU, we have to disable the limit |
@@ -652,35 +652,35 @@ discard block |
||
652 | 652 | unset($_REQUEST[$seed->module_dir.'2_'.strtoupper($seed->object_name).'_offset']);//after massupdate, the page should redirect to no offset page |
653 | 653 | $storeQuery->saveFromRequest($_REQUEST['module']); |
654 | 654 | $_REQUEST = array('return_module' => $temp_req['return_module'], 'return_action' => $temp_req['return_action']);//for post_massupdate, to go back to original page. |
655 | - }else{ |
|
656 | - sugar_die("You must massupdate at least one record"); |
|
657 | - } |
|
658 | - } |
|
659 | - /** |
|
660 | - * Specify what happens after the massupdate has occurred. |
|
661 | - */ |
|
662 | - protected function post_massupdate(){ |
|
663 | - $return_module = isset($_REQUEST['return_module']) ? |
|
664 | - $_REQUEST['return_module'] : |
|
665 | - $GLOBALS['sugar_config']['default_module']; |
|
666 | - $return_action = isset($_REQUEST['return_action']) ? |
|
667 | - $_REQUEST['return_action'] : |
|
668 | - $GLOBALS['sugar_config']['default_action']; |
|
669 | - $url = "index.php?module=".$return_module."&action=".$return_action; |
|
670 | - if($return_module == 'Emails'){//specificly for My Achieves |
|
671 | - if(!empty($this->req_for_email['type']) && !empty($this->req_for_email['ie_assigned_user_id'])) { |
|
672 | - $url = $url . "&type=".$this->req_for_email['type']."&assigned_user_id=".$this->req_for_email['ie_assigned_user_id']; |
|
673 | - } |
|
674 | - } |
|
675 | - $this->set_redirect($url); |
|
676 | - } |
|
677 | - /** |
|
678 | - * Perform the listview action |
|
679 | - */ |
|
680 | - protected function action_listview(){ |
|
681 | - $this->view_object_map['bean'] = $this->bean; |
|
682 | - $this->view = 'list'; |
|
683 | - } |
|
655 | + }else{ |
|
656 | + sugar_die("You must massupdate at least one record"); |
|
657 | + } |
|
658 | + } |
|
659 | + /** |
|
660 | + * Specify what happens after the massupdate has occurred. |
|
661 | + */ |
|
662 | + protected function post_massupdate(){ |
|
663 | + $return_module = isset($_REQUEST['return_module']) ? |
|
664 | + $_REQUEST['return_module'] : |
|
665 | + $GLOBALS['sugar_config']['default_module']; |
|
666 | + $return_action = isset($_REQUEST['return_action']) ? |
|
667 | + $_REQUEST['return_action'] : |
|
668 | + $GLOBALS['sugar_config']['default_action']; |
|
669 | + $url = "index.php?module=".$return_module."&action=".$return_action; |
|
670 | + if($return_module == 'Emails'){//specificly for My Achieves |
|
671 | + if(!empty($this->req_for_email['type']) && !empty($this->req_for_email['ie_assigned_user_id'])) { |
|
672 | + $url = $url . "&type=".$this->req_for_email['type']."&assigned_user_id=".$this->req_for_email['ie_assigned_user_id']; |
|
673 | + } |
|
674 | + } |
|
675 | + $this->set_redirect($url); |
|
676 | + } |
|
677 | + /** |
|
678 | + * Perform the listview action |
|
679 | + */ |
|
680 | + protected function action_listview(){ |
|
681 | + $this->view_object_map['bean'] = $this->bean; |
|
682 | + $this->view = 'list'; |
|
683 | + } |
|
684 | 684 | |
685 | 685 | /* |
686 | 686 | |
@@ -689,63 +689,63 @@ discard block |
||
689 | 689 | } |
690 | 690 | */ |
691 | 691 | |
692 | - /** |
|
693 | - * Action to handle when using a file as was done in previous versions of Sugar. |
|
694 | - */ |
|
695 | - protected function action_default(){ |
|
696 | - $this->view = 'classic'; |
|
697 | - } |
|
692 | + /** |
|
693 | + * Action to handle when using a file as was done in previous versions of Sugar. |
|
694 | + */ |
|
695 | + protected function action_default(){ |
|
696 | + $this->view = 'classic'; |
|
697 | + } |
|
698 | 698 | |
699 | - /** |
|
700 | - * this method id used within a Dashlet when performing an ajax call |
|
701 | - */ |
|
702 | - protected function action_callmethoddashlet(){ |
|
703 | - if(!empty($_REQUEST['id'])) { |
|
704 | - $id = $_REQUEST['id']; |
|
705 | - $requestedMethod = $_REQUEST['method']; |
|
706 | - $dashletDefs = $GLOBALS['current_user']->getPreference('dashlets', 'Home'); // load user's dashlets config |
|
707 | - if(!empty($dashletDefs[$id])) { |
|
708 | - require_once($dashletDefs[$id]['fileLocation']); |
|
709 | - |
|
710 | - $dashlet = new $dashletDefs[$id]['className']($id, (isset($dashletDefs[$id]['options']) ? $dashletDefs[$id]['options'] : array())); |
|
711 | - |
|
712 | - if(method_exists($dashlet, $requestedMethod) || method_exists($dashlet, '__call')) { |
|
713 | - echo $dashlet->$requestedMethod(); |
|
714 | - } |
|
715 | - else { |
|
716 | - echo 'no method'; |
|
717 | - } |
|
718 | - } |
|
719 | - } |
|
720 | - } |
|
699 | + /** |
|
700 | + * this method id used within a Dashlet when performing an ajax call |
|
701 | + */ |
|
702 | + protected function action_callmethoddashlet(){ |
|
703 | + if(!empty($_REQUEST['id'])) { |
|
704 | + $id = $_REQUEST['id']; |
|
705 | + $requestedMethod = $_REQUEST['method']; |
|
706 | + $dashletDefs = $GLOBALS['current_user']->getPreference('dashlets', 'Home'); // load user's dashlets config |
|
707 | + if(!empty($dashletDefs[$id])) { |
|
708 | + require_once($dashletDefs[$id]['fileLocation']); |
|
709 | + |
|
710 | + $dashlet = new $dashletDefs[$id]['className']($id, (isset($dashletDefs[$id]['options']) ? $dashletDefs[$id]['options'] : array())); |
|
711 | + |
|
712 | + if(method_exists($dashlet, $requestedMethod) || method_exists($dashlet, '__call')) { |
|
713 | + echo $dashlet->$requestedMethod(); |
|
714 | + } |
|
715 | + else { |
|
716 | + echo 'no method'; |
|
717 | + } |
|
718 | + } |
|
719 | + } |
|
720 | + } |
|
721 | 721 | |
722 | - /** |
|
723 | - * this method is used within a Dashlet when the options configuration is posted |
|
724 | - */ |
|
725 | - protected function action_configuredashlet(){ |
|
726 | - global $current_user, $mod_strings; |
|
727 | - |
|
728 | - if(!empty($_REQUEST['id'])) { |
|
729 | - $id = $_REQUEST['id']; |
|
730 | - $dashletDefs = $current_user->getPreference('dashlets', $_REQUEST['module']); // load user's dashlets config |
|
731 | - require_once($dashletDefs[$id]['fileLocation']); |
|
732 | - |
|
733 | - $dashlet = new $dashletDefs[$id]['className']($id, (isset($dashletDefs[$id]['options']) ? $dashletDefs[$id]['options'] : array())); |
|
734 | - if(!empty($_REQUEST['configure']) && $_REQUEST['configure']) { // save settings |
|
735 | - $dashletDefs[$id]['options'] = $dashlet->saveOptions($_REQUEST); |
|
736 | - $current_user->setPreference('dashlets', $dashletDefs, 0, $_REQUEST['module']); |
|
737 | - } |
|
738 | - else { // display options |
|
739 | - $json = getJSONobj(); |
|
740 | - return 'result = ' . $json->encode((array('header' => $dashlet->title . ' : ' . $mod_strings['LBL_OPTIONS'], |
|
741 | - 'body' => $dashlet->displayOptions()))); |
|
742 | - |
|
743 | - } |
|
744 | - } |
|
745 | - else { |
|
746 | - return '0'; |
|
747 | - } |
|
748 | - } |
|
722 | + /** |
|
723 | + * this method is used within a Dashlet when the options configuration is posted |
|
724 | + */ |
|
725 | + protected function action_configuredashlet(){ |
|
726 | + global $current_user, $mod_strings; |
|
727 | + |
|
728 | + if(!empty($_REQUEST['id'])) { |
|
729 | + $id = $_REQUEST['id']; |
|
730 | + $dashletDefs = $current_user->getPreference('dashlets', $_REQUEST['module']); // load user's dashlets config |
|
731 | + require_once($dashletDefs[$id]['fileLocation']); |
|
732 | + |
|
733 | + $dashlet = new $dashletDefs[$id]['className']($id, (isset($dashletDefs[$id]['options']) ? $dashletDefs[$id]['options'] : array())); |
|
734 | + if(!empty($_REQUEST['configure']) && $_REQUEST['configure']) { // save settings |
|
735 | + $dashletDefs[$id]['options'] = $dashlet->saveOptions($_REQUEST); |
|
736 | + $current_user->setPreference('dashlets', $dashletDefs, 0, $_REQUEST['module']); |
|
737 | + } |
|
738 | + else { // display options |
|
739 | + $json = getJSONobj(); |
|
740 | + return 'result = ' . $json->encode((array('header' => $dashlet->title . ' : ' . $mod_strings['LBL_OPTIONS'], |
|
741 | + 'body' => $dashlet->displayOptions()))); |
|
742 | + |
|
743 | + } |
|
744 | + } |
|
745 | + else { |
|
746 | + return '0'; |
|
747 | + } |
|
748 | + } |
|
749 | 749 | |
750 | 750 | /** |
751 | 751 | * Global method to delete an attachment |
@@ -775,84 +775,84 @@ discard block |
||
775 | 775 | sugar_cleanup(true); |
776 | 776 | } |
777 | 777 | |
778 | - /** |
|
779 | - * getActionFilename |
|
780 | - */ |
|
781 | - public static function getActionFilename($action) { |
|
782 | - if(isset(self::$action_case_file[$action])) { |
|
783 | - return self::$action_case_file[$action]; |
|
784 | - } |
|
785 | - return $action; |
|
786 | - } |
|
778 | + /** |
|
779 | + * getActionFilename |
|
780 | + */ |
|
781 | + public static function getActionFilename($action) { |
|
782 | + if(isset(self::$action_case_file[$action])) { |
|
783 | + return self::$action_case_file[$action]; |
|
784 | + } |
|
785 | + return $action; |
|
786 | + } |
|
787 | 787 | |
788 | - /********************************************************************/ |
|
789 | - // PROCESS TASKS |
|
790 | - /********************************************************************/ |
|
788 | + /********************************************************************/ |
|
789 | + // PROCESS TASKS |
|
790 | + /********************************************************************/ |
|
791 | 791 | |
792 | - /** |
|
793 | - * Given the module and action, determine whether the super/admin has prevented access |
|
794 | - * to this url. In addition if any links specified for this module, load the links into |
|
795 | - * GLOBALS |
|
796 | - * |
|
797 | - * @return true if we want to stop processing, false if processing should continue |
|
798 | - */ |
|
799 | - private function blockFileAccess(){ |
|
800 | - //check if the we have enabled file_access_control and if so then check the mappings on the request; |
|
801 | - if(!empty($GLOBALS['sugar_config']['admin_access_control']) && $GLOBALS['sugar_config']['admin_access_control']){ |
|
802 | - $this->loadMapping('file_access_control_map'); |
|
803 | - //since we have this turned on, check the mapping file |
|
804 | - $module = strtolower($this->module); |
|
805 | - $action = strtolower($this->do_action); |
|
806 | - if(!empty($this->file_access_control_map['modules'][$module]['links'])){ |
|
807 | - $GLOBALS['admin_access_control_links'] = $this->file_access_control_map['modules'][$module]['links']; |
|
808 | - } |
|
809 | - |
|
810 | - if(!empty($this->file_access_control_map['modules'][$module]['actions']) && (in_array($action, $this->file_access_control_map['modules'][$module]['actions']) || !empty($this->file_access_control_map['modules'][$module]['actions'][$action]))){ |
|
811 | - //check params |
|
812 | - if(!empty($this->file_access_control_map['modules'][$module]['actions'][$action]['params'])){ |
|
813 | - $block = true; |
|
814 | - $params = $this->file_access_control_map['modules'][$module]['actions'][$action]['params']; |
|
815 | - foreach($params as $param => $paramVals){ |
|
816 | - if(!empty($_REQUEST[$param])){ |
|
817 | - if(!in_array($_REQUEST[$param], $paramVals)){ |
|
818 | - $block = false; |
|
819 | - break; |
|
820 | - } |
|
821 | - } |
|
822 | - } |
|
823 | - if($block){ |
|
824 | - $this->_processed = true; |
|
825 | - $this->no_access(); |
|
826 | - } |
|
827 | - }else{ |
|
828 | - $this->_processed = true; |
|
829 | - $this->no_access(); |
|
830 | - } |
|
831 | - } |
|
832 | - }else |
|
833 | - $this->_processed = false; |
|
834 | - } |
|
792 | + /** |
|
793 | + * Given the module and action, determine whether the super/admin has prevented access |
|
794 | + * to this url. In addition if any links specified for this module, load the links into |
|
795 | + * GLOBALS |
|
796 | + * |
|
797 | + * @return true if we want to stop processing, false if processing should continue |
|
798 | + */ |
|
799 | + private function blockFileAccess(){ |
|
800 | + //check if the we have enabled file_access_control and if so then check the mappings on the request; |
|
801 | + if(!empty($GLOBALS['sugar_config']['admin_access_control']) && $GLOBALS['sugar_config']['admin_access_control']){ |
|
802 | + $this->loadMapping('file_access_control_map'); |
|
803 | + //since we have this turned on, check the mapping file |
|
804 | + $module = strtolower($this->module); |
|
805 | + $action = strtolower($this->do_action); |
|
806 | + if(!empty($this->file_access_control_map['modules'][$module]['links'])){ |
|
807 | + $GLOBALS['admin_access_control_links'] = $this->file_access_control_map['modules'][$module]['links']; |
|
808 | + } |
|
835 | 809 | |
836 | - /** |
|
837 | - * This code is part of the entry points reworking. We have consolidated all |
|
838 | - * entry points to go through index.php. Now in order to bring up an entry point |
|
839 | - * it will follow the format: |
|
840 | - * 'index.php?entryPoint=download' |
|
841 | - * the download entry point is mapped in the following file: entry_point_registry.php |
|
842 | - * |
|
843 | - */ |
|
844 | - private function handleEntryPoint(){ |
|
845 | - if(!empty($_REQUEST['entryPoint'])){ |
|
846 | - $this->loadMapping('entry_point_registry'); |
|
847 | - $entryPoint = $_REQUEST['entryPoint']; |
|
848 | - |
|
849 | - if(!empty($this->entry_point_registry[$entryPoint])){ |
|
850 | - require_once($this->entry_point_registry[$entryPoint]['file']); |
|
851 | - $this->_processed = true; |
|
852 | - $this->view = ''; |
|
853 | - } |
|
854 | - } |
|
855 | - } |
|
810 | + if(!empty($this->file_access_control_map['modules'][$module]['actions']) && (in_array($action, $this->file_access_control_map['modules'][$module]['actions']) || !empty($this->file_access_control_map['modules'][$module]['actions'][$action]))){ |
|
811 | + //check params |
|
812 | + if(!empty($this->file_access_control_map['modules'][$module]['actions'][$action]['params'])){ |
|
813 | + $block = true; |
|
814 | + $params = $this->file_access_control_map['modules'][$module]['actions'][$action]['params']; |
|
815 | + foreach($params as $param => $paramVals){ |
|
816 | + if(!empty($_REQUEST[$param])){ |
|
817 | + if(!in_array($_REQUEST[$param], $paramVals)){ |
|
818 | + $block = false; |
|
819 | + break; |
|
820 | + } |
|
821 | + } |
|
822 | + } |
|
823 | + if($block){ |
|
824 | + $this->_processed = true; |
|
825 | + $this->no_access(); |
|
826 | + } |
|
827 | + }else{ |
|
828 | + $this->_processed = true; |
|
829 | + $this->no_access(); |
|
830 | + } |
|
831 | + } |
|
832 | + }else |
|
833 | + $this->_processed = false; |
|
834 | + } |
|
835 | + |
|
836 | + /** |
|
837 | + * This code is part of the entry points reworking. We have consolidated all |
|
838 | + * entry points to go through index.php. Now in order to bring up an entry point |
|
839 | + * it will follow the format: |
|
840 | + * 'index.php?entryPoint=download' |
|
841 | + * the download entry point is mapped in the following file: entry_point_registry.php |
|
842 | + * |
|
843 | + */ |
|
844 | + private function handleEntryPoint(){ |
|
845 | + if(!empty($_REQUEST['entryPoint'])){ |
|
846 | + $this->loadMapping('entry_point_registry'); |
|
847 | + $entryPoint = $_REQUEST['entryPoint']; |
|
848 | + |
|
849 | + if(!empty($this->entry_point_registry[$entryPoint])){ |
|
850 | + require_once($this->entry_point_registry[$entryPoint]['file']); |
|
851 | + $this->_processed = true; |
|
852 | + $this->view = ''; |
|
853 | + } |
|
854 | + } |
|
855 | + } |
|
856 | 856 | |
857 | 857 | /** |
858 | 858 | * Checks to see if the requested entry point requires auth |
@@ -870,67 +870,67 @@ discard block |
||
870 | 870 | return true; |
871 | 871 | } |
872 | 872 | |
873 | - /** |
|
874 | - * Meant to handle old views e.g. DetailView.php. |
|
875 | - * |
|
876 | - */ |
|
877 | - protected function callLegacyCode() |
|
878 | - { |
|
879 | - $file = self::getActionFilename($this->do_action); |
|
880 | - if ( isset($this->action_view_map[strtolower($this->do_action)]) ) { |
|
881 | - $action = $this->action_view_map[strtolower($this->do_action)]; |
|
882 | - } |
|
883 | - else { |
|
884 | - $action = $this->do_action; |
|
885 | - } |
|
886 | - // index actions actually maps to the view.list.php view |
|
887 | - if ( $action == 'index' ) { |
|
888 | - $action = 'list'; |
|
889 | - } |
|
890 | - |
|
891 | - if ((file_exists('modules/' . $this->module . '/'. $file . '.php') |
|
873 | + /** |
|
874 | + * Meant to handle old views e.g. DetailView.php. |
|
875 | + * |
|
876 | + */ |
|
877 | + protected function callLegacyCode() |
|
878 | + { |
|
879 | + $file = self::getActionFilename($this->do_action); |
|
880 | + if ( isset($this->action_view_map[strtolower($this->do_action)]) ) { |
|
881 | + $action = $this->action_view_map[strtolower($this->do_action)]; |
|
882 | + } |
|
883 | + else { |
|
884 | + $action = $this->do_action; |
|
885 | + } |
|
886 | + // index actions actually maps to the view.list.php view |
|
887 | + if ( $action == 'index' ) { |
|
888 | + $action = 'list'; |
|
889 | + } |
|
890 | + |
|
891 | + if ((file_exists('modules/' . $this->module . '/'. $file . '.php') |
|
892 | 892 | && !file_exists('modules/' . $this->module . '/views/view.'. $action . '.php')) |
893 | 893 | || (file_exists('custom/modules/' . $this->module . '/'. $file . '.php') |
894 | 894 | && !file_exists('custom/modules/' . $this->module . '/views/view.'. $action . '.php')) |
895 | 895 | ) { |
896 | - // A 'classic' module, using the old pre-MVC display files |
|
897 | - // We should now discard the bean we just obtained for tracking as the pre-MVC module will instantiate its own |
|
898 | - unset($GLOBALS['FOCUS']); |
|
899 | - $GLOBALS['log']->debug('Module:' . $this->module . ' using file: '. $file); |
|
900 | - $this->action_default(); |
|
901 | - $this->_processed = true; |
|
902 | - } |
|
903 | - } |
|
896 | + // A 'classic' module, using the old pre-MVC display files |
|
897 | + // We should now discard the bean we just obtained for tracking as the pre-MVC module will instantiate its own |
|
898 | + unset($GLOBALS['FOCUS']); |
|
899 | + $GLOBALS['log']->debug('Module:' . $this->module . ' using file: '. $file); |
|
900 | + $this->action_default(); |
|
901 | + $this->_processed = true; |
|
902 | + } |
|
903 | + } |
|
904 | 904 | |
905 | - /** |
|
906 | - * If the action has been remapped to a different action as defined in |
|
907 | - * action_file_map.php or action_view_map.php load those maps here. |
|
908 | - * |
|
909 | - */ |
|
910 | - private function handleActionMaps(){ |
|
911 | - if(!empty($this->action_file_map[strtolower($this->do_action)])){ |
|
912 | - $this->view = ''; |
|
913 | - $GLOBALS['log']->debug('Using Action File Map:' . $this->action_file_map[strtolower($this->do_action)]); |
|
914 | - require_once($this->action_file_map[strtolower($this->do_action)]); |
|
915 | - $this->_processed = true; |
|
916 | - }elseif(!empty($this->action_view_map[strtolower($this->do_action)])){ |
|
917 | - $GLOBALS['log']->debug('Using Action View Map:' . $this->action_view_map[strtolower($this->do_action)]); |
|
918 | - $this->view = $this->action_view_map[strtolower($this->do_action)]; |
|
919 | - $this->_processed = true; |
|
920 | - }else |
|
921 | - $this->no_action(); |
|
922 | - } |
|
905 | + /** |
|
906 | + * If the action has been remapped to a different action as defined in |
|
907 | + * action_file_map.php or action_view_map.php load those maps here. |
|
908 | + * |
|
909 | + */ |
|
910 | + private function handleActionMaps(){ |
|
911 | + if(!empty($this->action_file_map[strtolower($this->do_action)])){ |
|
912 | + $this->view = ''; |
|
913 | + $GLOBALS['log']->debug('Using Action File Map:' . $this->action_file_map[strtolower($this->do_action)]); |
|
914 | + require_once($this->action_file_map[strtolower($this->do_action)]); |
|
915 | + $this->_processed = true; |
|
916 | + }elseif(!empty($this->action_view_map[strtolower($this->do_action)])){ |
|
917 | + $GLOBALS['log']->debug('Using Action View Map:' . $this->action_view_map[strtolower($this->do_action)]); |
|
918 | + $this->view = $this->action_view_map[strtolower($this->do_action)]; |
|
919 | + $this->_processed = true; |
|
920 | + }else |
|
921 | + $this->no_action(); |
|
922 | + } |
|
923 | 923 | |
924 | - /** |
|
925 | - * Actually remap the action if required. |
|
926 | - * |
|
927 | - */ |
|
928 | - protected function remapAction(){ |
|
929 | - if(!empty($this->action_remap[$this->do_action])){ |
|
930 | - $this->action = $this->action_remap[$this->do_action]; |
|
931 | - $this->do_action = $this->action; |
|
932 | - } |
|
933 | - } |
|
924 | + /** |
|
925 | + * Actually remap the action if required. |
|
926 | + * |
|
927 | + */ |
|
928 | + protected function remapAction(){ |
|
929 | + if(!empty($this->action_remap[$this->do_action])){ |
|
930 | + $this->action = $this->action_remap[$this->do_action]; |
|
931 | + $this->do_action = $this->action; |
|
932 | + } |
|
933 | + } |
|
934 | 934 | |
935 | 935 | } |
936 | 936 | ?> |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * Main SugarCRM controller |
44 | 44 | * @api |
45 | 45 | */ |
46 | -class SugarController{ |
|
46 | +class SugarController { |
|
47 | 47 | /** |
48 | 48 | * remap actions in here |
49 | 49 | * e.g. make all detail views go to edit views |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | * Constructor. This ie meant tot load up the module, action, record as well |
163 | 163 | * as the mapping arrays. |
164 | 164 | */ |
165 | - function SugarController(){ |
|
165 | + function SugarController() { |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | /** |
@@ -170,14 +170,14 @@ discard block |
||
170 | 170 | * on the controller. |
171 | 171 | * |
172 | 172 | */ |
173 | - public function setup($module = ''){ |
|
174 | - if(empty($module) && !empty($_REQUEST['module'])) |
|
173 | + public function setup($module = '') { |
|
174 | + if (empty($module) && !empty($_REQUEST['module'])) |
|
175 | 175 | $module = $_REQUEST['module']; |
176 | 176 | //set the module |
177 | - if(!empty($module)) |
|
177 | + if (!empty($module)) |
|
178 | 178 | $this->setModule($module); |
179 | 179 | |
180 | - if(!empty($_REQUEST['target_module']) && $_REQUEST['target_module'] != 'undefined') { |
|
180 | + if (!empty($_REQUEST['target_module']) && $_REQUEST['target_module'] != 'undefined') { |
|
181 | 181 | $this->target_module = $_REQUEST['target_module']; |
182 | 182 | } |
183 | 183 | //set properties on the controller from the $_REQUEST |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | * |
191 | 191 | * @param object $module |
192 | 192 | */ |
193 | - public function setModule($module){ |
|
193 | + public function setModule($module) { |
|
194 | 194 | $this->module = $module; |
195 | 195 | } |
196 | 196 | |
@@ -198,18 +198,18 @@ discard block |
||
198 | 198 | * Set properties on the Controller from the $_REQUEST |
199 | 199 | * |
200 | 200 | */ |
201 | - private function loadPropertiesFromRequest(){ |
|
202 | - if(!empty($_REQUEST['action'])) |
|
201 | + private function loadPropertiesFromRequest() { |
|
202 | + if (!empty($_REQUEST['action'])) |
|
203 | 203 | $this->action = $_REQUEST['action']; |
204 | - if(!empty($_REQUEST['record'])) |
|
204 | + if (!empty($_REQUEST['record'])) |
|
205 | 205 | $this->record = $_REQUEST['record']; |
206 | - if(!empty($_REQUEST['view'])) |
|
206 | + if (!empty($_REQUEST['view'])) |
|
207 | 207 | $this->view = $_REQUEST['view']; |
208 | - if(!empty($_REQUEST['return_module'])) |
|
208 | + if (!empty($_REQUEST['return_module'])) |
|
209 | 209 | $this->return_module = $_REQUEST['return_module']; |
210 | - if(!empty($_REQUEST['return_action'])) |
|
210 | + if (!empty($_REQUEST['return_action'])) |
|
211 | 211 | $this->return_action = $_REQUEST['return_action']; |
212 | - if(!empty($_REQUEST['return_id'])) |
|
212 | + if (!empty($_REQUEST['return_id'])) |
|
213 | 213 | $this->return_id = $_REQUEST['return_id']; |
214 | 214 | } |
215 | 215 | |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | * Load map files for use within the Controller |
218 | 218 | * |
219 | 219 | */ |
220 | - private function loadMappings(){ |
|
220 | + private function loadMappings() { |
|
221 | 221 | $this->loadMapping('action_view_map'); |
222 | 222 | $this->loadMapping('action_file_map'); |
223 | 223 | $this->loadMapping('action_remap', true); |
@@ -228,14 +228,14 @@ discard block |
||
228 | 228 | */ |
229 | 229 | public function loadBean() |
230 | 230 | { |
231 | - if(!empty($GLOBALS['beanList'][$this->module])){ |
|
231 | + if (!empty($GLOBALS['beanList'][$this->module])) { |
|
232 | 232 | $class = $GLOBALS['beanList'][$this->module]; |
233 | - if(!empty($GLOBALS['beanFiles'][$class])){ |
|
233 | + if (!empty($GLOBALS['beanFiles'][$class])) { |
|
234 | 234 | require_once($GLOBALS['beanFiles'][$class]); |
235 | 235 | $this->bean = new $class(); |
236 | - if(!empty($this->record)){ |
|
236 | + if (!empty($this->record)) { |
|
237 | 237 | $this->bean->retrieve($this->record); |
238 | - if($this->bean) |
|
238 | + if ($this->bean) |
|
239 | 239 | $GLOBALS['FOCUS'] = $this->bean; |
240 | 240 | } |
241 | 241 | } |
@@ -245,38 +245,38 @@ discard block |
||
245 | 245 | /** |
246 | 246 | * Generic load method to load mapping arrays. |
247 | 247 | */ |
248 | - private function loadMapping($var, $merge = false){ |
|
249 | - $$var = sugar_cache_retrieve("CONTROLLER_". $var . "_".$this->module); |
|
250 | - if(!$$var){ |
|
251 | - if($merge && !empty($this->$var)){ |
|
248 | + private function loadMapping($var, $merge = false) { |
|
249 | + $$var = sugar_cache_retrieve("CONTROLLER_".$var."_".$this->module); |
|
250 | + if (!$$var) { |
|
251 | + if ($merge && !empty($this->$var)) { |
|
252 | 252 | $$var = $this->$var; |
253 | - }else{ |
|
253 | + } else { |
|
254 | 254 | $$var = array(); |
255 | 255 | } |
256 | - if(file_exists('include/MVC/Controller/'. $var . '.php')){ |
|
257 | - require('include/MVC/Controller/'. $var . '.php'); |
|
256 | + if (file_exists('include/MVC/Controller/'.$var.'.php')) { |
|
257 | + require('include/MVC/Controller/'.$var.'.php'); |
|
258 | 258 | } |
259 | - if(file_exists('modules/'.$this->module.'/'. $var . '.php')){ |
|
260 | - require('modules/'.$this->module.'/'. $var . '.php'); |
|
259 | + if (file_exists('modules/'.$this->module.'/'.$var.'.php')) { |
|
260 | + require('modules/'.$this->module.'/'.$var.'.php'); |
|
261 | 261 | } |
262 | - if(file_exists('custom/modules/'.$this->module.'/'. $var . '.php')){ |
|
263 | - require('custom/modules/'.$this->module.'/'. $var . '.php'); |
|
262 | + if (file_exists('custom/modules/'.$this->module.'/'.$var.'.php')) { |
|
263 | + require('custom/modules/'.$this->module.'/'.$var.'.php'); |
|
264 | 264 | } |
265 | - if(file_exists('custom/include/MVC/Controller/'. $var . '.php')){ |
|
266 | - require('custom/include/MVC/Controller/'. $var . '.php'); |
|
265 | + if (file_exists('custom/include/MVC/Controller/'.$var.'.php')) { |
|
266 | + require('custom/include/MVC/Controller/'.$var.'.php'); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | // entry_point_registry -> EntryPointRegistry |
270 | 270 | |
271 | - $varname = str_replace(" ","",ucwords(str_replace("_"," ", $var))); |
|
272 | - if(file_exists("custom/application/Ext/$varname/$var.ext.php")){ |
|
271 | + $varname = str_replace(" ", "", ucwords(str_replace("_", " ", $var))); |
|
272 | + if (file_exists("custom/application/Ext/$varname/$var.ext.php")) { |
|
273 | 273 | require("custom/application/Ext/$varname/$var.ext.php"); |
274 | 274 | } |
275 | - if(file_exists("custom/modules/{$this->module}/Ext/$varname/$var.ext.php")){ |
|
275 | + if (file_exists("custom/modules/{$this->module}/Ext/$varname/$var.ext.php")) { |
|
276 | 276 | require("custom/modules/{$this->module}/Ext/$varname/$var.ext.php"); |
277 | 277 | } |
278 | 278 | |
279 | - sugar_cache_put("CONTROLLER_". $var . "_".$this->module, $$var); |
|
279 | + sugar_cache_put("CONTROLLER_".$var."_".$this->module, $$var); |
|
280 | 280 | } |
281 | 281 | $this->$var = $$var; |
282 | 282 | } |
@@ -290,11 +290,11 @@ discard block |
||
290 | 290 | try |
291 | 291 | { |
292 | 292 | $this->process(); |
293 | - if(!empty($this->view)) |
|
293 | + if (!empty($this->view)) |
|
294 | 294 | { |
295 | 295 | $this->processView(); |
296 | 296 | } |
297 | - elseif(!empty($this->redirect_url)) |
|
297 | + elseif (!empty($this->redirect_url)) |
|
298 | 298 | { |
299 | 299 | $this->redirect(); |
300 | 300 | } |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | */ |
315 | 315 | protected function handleException(Exception $e) |
316 | 316 | { |
317 | - $GLOBALS['log']->fatal('Exception in Controller: ' . $e->getMessage()); |
|
317 | + $GLOBALS['log']->fatal('Exception in Controller: '.$e->getMessage()); |
|
318 | 318 | $logicHook = new LogicHook(); |
319 | 319 | |
320 | 320 | if (isset($this->bean)) |
@@ -331,18 +331,18 @@ discard block |
||
331 | 331 | /** |
332 | 332 | * Display the appropriate view. |
333 | 333 | */ |
334 | - private function processView(){ |
|
335 | - if(!isset($this->view_object_map['remap_action']) && isset($this->action_view_map[strtolower($this->action)])) |
|
334 | + private function processView() { |
|
335 | + if (!isset($this->view_object_map['remap_action']) && isset($this->action_view_map[strtolower($this->action)])) |
|
336 | 336 | { |
337 | 337 | $this->view_object_map['remap_action'] = $this->action_view_map[strtolower($this->action)]; |
338 | 338 | } |
339 | 339 | $view = ViewFactory::loadView($this->view, $this->module, $this->bean, $this->view_object_map, $this->target_module); |
340 | 340 | $GLOBALS['current_view'] = $view; |
341 | - if(!empty($this->bean) && !$this->bean->ACLAccess($view->type) && $view->type != 'list'){ |
|
341 | + if (!empty($this->bean) && !$this->bean->ACLAccess($view->type) && $view->type != 'list') { |
|
342 | 342 | ACLController::displayNoAccess(true); |
343 | 343 | sugar_cleanup(true); |
344 | 344 | } |
345 | - if(isset($this->errors)){ |
|
345 | + if (isset($this->errors)) { |
|
346 | 346 | $view->errors = $this->errors; |
347 | 347 | } |
348 | 348 | $view->process(); |
@@ -361,12 +361,12 @@ discard block |
||
361 | 361 | * 1) check for file |
362 | 362 | * 2) check for action |
363 | 363 | */ |
364 | - public function process(){ |
|
364 | + public function process() { |
|
365 | 365 | $GLOBALS['action'] = $this->action; |
366 | 366 | $GLOBALS['module'] = $this->module; |
367 | 367 | |
368 | 368 | //check to ensure we have access to the module. |
369 | - if($this->hasAccess){ |
|
369 | + if ($this->hasAccess) { |
|
370 | 370 | $this->do_action = $this->action; |
371 | 371 | |
372 | 372 | $file = self::getActionFilename($this->do_action); |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | } |
385 | 385 | |
386 | 386 | $this->redirect(); |
387 | - }else{ |
|
387 | + } else { |
|
388 | 388 | $this->no_access(); |
389 | 389 | } |
390 | 390 | } |
@@ -398,9 +398,9 @@ discard block |
||
398 | 398 | * false otherwise. This is important b/c if none of these methods exists, then we will run the |
399 | 399 | * action_default() method. |
400 | 400 | */ |
401 | - protected function handle_action(){ |
|
401 | + protected function handle_action() { |
|
402 | 402 | $processed = false; |
403 | - foreach($this->tasks as $task){ |
|
403 | + foreach ($this->tasks as $task) { |
|
404 | 404 | $processed = ($this->$task() || $processed); |
405 | 405 | } |
406 | 406 | $this->_processed = $processed; |
@@ -410,9 +410,9 @@ discard block |
||
410 | 410 | * Perform an action prior to the specified action. |
411 | 411 | * This can be overridde in a sub-class |
412 | 412 | */ |
413 | - private function pre_action(){ |
|
414 | - $function = 'pre_' . $this->action; |
|
415 | - if($this->hasFunction($function)){ |
|
413 | + private function pre_action() { |
|
414 | + $function = 'pre_'.$this->action; |
|
415 | + if ($this->hasFunction($function)) { |
|
416 | 416 | $GLOBALS['log']->debug('Performing pre_action'); |
417 | 417 | $this->$function(); |
418 | 418 | return true; |
@@ -424,9 +424,9 @@ discard block |
||
424 | 424 | * Perform the specified action. |
425 | 425 | * This can be overridde in a sub-class |
426 | 426 | */ |
427 | - private function do_action(){ |
|
428 | - $function = 'action_'. strtolower($this->do_action); |
|
429 | - if($this->hasFunction($function)){ |
|
427 | + private function do_action() { |
|
428 | + $function = 'action_'.strtolower($this->do_action); |
|
429 | + if ($this->hasFunction($function)) { |
|
430 | 430 | $GLOBALS['log']->debug('Performing action: '.$function.' MODULE: '.$this->module); |
431 | 431 | $this->$function(); |
432 | 432 | return true; |
@@ -438,9 +438,9 @@ discard block |
||
438 | 438 | * Perform an action after to the specified action has occurred. |
439 | 439 | * This can be overridde in a sub-class |
440 | 440 | */ |
441 | - private function post_action(){ |
|
442 | - $function = 'post_' . $this->action; |
|
443 | - if($this->hasFunction($function)){ |
|
441 | + private function post_action() { |
|
442 | + $function = 'post_'.$this->action; |
|
443 | + if ($this->hasFunction($function)) { |
|
444 | 444 | $GLOBALS['log']->debug('Performing post_action'); |
445 | 445 | $this->$function(); |
446 | 446 | return true; |
@@ -451,14 +451,14 @@ discard block |
||
451 | 451 | /** |
452 | 452 | * If there is no action found then display an error to the user. |
453 | 453 | */ |
454 | - protected function no_action(){ |
|
454 | + protected function no_action() { |
|
455 | 455 | sugar_die($GLOBALS['app_strings']['LBL_NO_ACTION']); |
456 | 456 | } |
457 | 457 | |
458 | 458 | /** |
459 | 459 | * The default action handler for instances where we do not have access to process. |
460 | 460 | */ |
461 | - protected function no_access(){ |
|
461 | + protected function no_access() { |
|
462 | 462 | $this->view = 'noaccess'; |
463 | 463 | } |
464 | 464 | |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | * @param function - the function to check |
472 | 472 | * @return true if the method exists on the object, false otherwise |
473 | 473 | */ |
474 | - protected function hasFunction($function){ |
|
474 | + protected function hasFunction($function) { |
|
475 | 475 | return method_exists($this, $function); |
476 | 476 | } |
477 | 477 | |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | * |
482 | 482 | * @param string url - the url to which we will want to redirect |
483 | 483 | */ |
484 | - protected function set_redirect($url){ |
|
484 | + protected function set_redirect($url) { |
|
485 | 485 | $this->redirect_url = $url; |
486 | 486 | } |
487 | 487 | |
@@ -489,9 +489,9 @@ discard block |
||
489 | 489 | * Perform redirection based on the redirect_url |
490 | 490 | * |
491 | 491 | */ |
492 | - protected function redirect(){ |
|
492 | + protected function redirect() { |
|
493 | 493 | |
494 | - if(!empty($this->redirect_url)) |
|
494 | + if (!empty($this->redirect_url)) |
|
495 | 495 | SugarApplication::redirect($this->redirect_url); |
496 | 496 | } |
497 | 497 | |
@@ -506,38 +506,38 @@ discard block |
||
506 | 506 | /** |
507 | 507 | * Do some processing before saving the bean to the database. |
508 | 508 | */ |
509 | - public function pre_save(){ |
|
510 | - if(!empty($_POST['assigned_user_id']) && $_POST['assigned_user_id'] != $this->bean->assigned_user_id && $_POST['assigned_user_id'] != $GLOBALS['current_user']->id && empty($GLOBALS['sugar_config']['exclude_notifications'][$this->bean->module_dir])){ |
|
509 | + public function pre_save() { |
|
510 | + if (!empty($_POST['assigned_user_id']) && $_POST['assigned_user_id'] != $this->bean->assigned_user_id && $_POST['assigned_user_id'] != $GLOBALS['current_user']->id && empty($GLOBALS['sugar_config']['exclude_notifications'][$this->bean->module_dir])) { |
|
511 | 511 | $this->bean->notify_on_save = true; |
512 | 512 | } |
513 | 513 | $GLOBALS['log']->debug("SugarController:: performing pre_save."); |
514 | 514 | require_once('include/SugarFields/SugarFieldHandler.php'); |
515 | 515 | $sfh = new SugarFieldHandler(); |
516 | - foreach($this->bean->field_defs as $field => $properties) { |
|
516 | + foreach ($this->bean->field_defs as $field => $properties) { |
|
517 | 517 | $type = !empty($properties['custom_type']) ? $properties['custom_type'] : $properties['type']; |
518 | 518 | $sf = $sfh->getSugarField(ucfirst($type), true); |
519 | - if(isset($_POST[$field])) { |
|
520 | - if(is_array($_POST[$field]) && !empty($properties['isMultiSelect'])) { |
|
521 | - if(empty($_POST[$field][0])) { |
|
519 | + if (isset($_POST[$field])) { |
|
520 | + if (is_array($_POST[$field]) && !empty($properties['isMultiSelect'])) { |
|
521 | + if (empty($_POST[$field][0])) { |
|
522 | 522 | unset($_POST[$field][0]); |
523 | 523 | } |
524 | 524 | $_POST[$field] = encodeMultienumValue($_POST[$field]); |
525 | 525 | } |
526 | 526 | $this->bean->$field = $_POST[$field]; |
527 | - } else if(!empty($properties['isMultiSelect']) && !isset($_POST[$field]) && isset($_POST[$field . '_multiselect'])) { |
|
527 | + } else if (!empty($properties['isMultiSelect']) && !isset($_POST[$field]) && isset($_POST[$field.'_multiselect'])) { |
|
528 | 528 | $this->bean->$field = ''; |
529 | 529 | } |
530 | - if($sf != null){ |
|
530 | + if ($sf != null) { |
|
531 | 531 | $sf->save($this->bean, $_POST, $field, $properties); |
532 | 532 | } |
533 | 533 | } |
534 | 534 | |
535 | - foreach($this->bean->relationship_fields as $field=>$link){ |
|
536 | - if(!empty($_POST[$field])){ |
|
535 | + foreach ($this->bean->relationship_fields as $field=>$link) { |
|
536 | + if (!empty($_POST[$field])) { |
|
537 | 537 | $this->bean->$field = $_POST[$field]; |
538 | 538 | } |
539 | 539 | } |
540 | - if(!$this->bean->ACLAccess('save')){ |
|
540 | + if (!$this->bean->ACLAccess('save')) { |
|
541 | 541 | ACLController::displayNoAccess(true); |
542 | 542 | sugar_cleanup(true); |
543 | 543 | } |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | /** |
548 | 548 | * Perform the actual save |
549 | 549 | */ |
550 | - public function action_save(){ |
|
550 | + public function action_save() { |
|
551 | 551 | $this->bean->save(!empty($this->bean->notify_on_save)); |
552 | 552 | } |
553 | 553 | |
@@ -561,7 +561,7 @@ discard block |
||
561 | 561 | /** |
562 | 562 | * Specify what happens after the save has occurred. |
563 | 563 | */ |
564 | - protected function post_save(){ |
|
564 | + protected function post_save() { |
|
565 | 565 | $module = (!empty($this->return_module) ? $this->return_module : $this->module); |
566 | 566 | $action = (!empty($this->return_action) ? $this->return_action : 'DetailView'); |
567 | 567 | $id = (!empty($this->return_id) ? $this->return_id : $this->bean->id); |
@@ -577,16 +577,16 @@ discard block |
||
577 | 577 | /** |
578 | 578 | * Perform the actual deletion. |
579 | 579 | */ |
580 | - protected function action_delete(){ |
|
580 | + protected function action_delete() { |
|
581 | 581 | //do any pre delete processing |
582 | 582 | //if there is some custom logic for deletion. |
583 | - if(!empty($_REQUEST['record'])){ |
|
584 | - if(!$this->bean->ACLAccess('Delete')){ |
|
583 | + if (!empty($_REQUEST['record'])) { |
|
584 | + if (!$this->bean->ACLAccess('Delete')) { |
|
585 | 585 | ACLController::displayNoAccess(true); |
586 | 586 | sugar_cleanup(true); |
587 | 587 | } |
588 | 588 | $this->bean->mark_deleted($_REQUEST['record']); |
589 | - }else{ |
|
589 | + } else { |
|
590 | 590 | sugar_die("A record number must be specified to delete"); |
591 | 591 | } |
592 | 592 | } |
@@ -594,24 +594,21 @@ discard block |
||
594 | 594 | /** |
595 | 595 | * Specify what happens after the deletion has occurred. |
596 | 596 | */ |
597 | - protected function post_delete(){ |
|
597 | + protected function post_delete() { |
|
598 | 598 | if (empty($_REQUEST['return_url'])) { |
599 | 599 | $return_module = isset($_REQUEST['return_module']) ? |
600 | - $_REQUEST['return_module'] : |
|
601 | - $GLOBALS['sugar_config']['default_module']; |
|
600 | + $_REQUEST['return_module'] : $GLOBALS['sugar_config']['default_module']; |
|
602 | 601 | $return_action = isset($_REQUEST['return_action']) ? |
603 | - $_REQUEST['return_action'] : |
|
604 | - $GLOBALS['sugar_config']['default_action']; |
|
602 | + $_REQUEST['return_action'] : $GLOBALS['sugar_config']['default_action']; |
|
605 | 603 | $return_id = isset($_REQUEST['return_id']) ? |
606 | - $_REQUEST['return_id'] : |
|
607 | - ''; |
|
604 | + $_REQUEST['return_id'] : ''; |
|
608 | 605 | $url = "index.php?module=".$return_module."&action=".$return_action."&record=".$return_id; |
609 | 606 | } else { |
610 | 607 | $url = $_REQUEST['return_url']; |
611 | 608 | } |
612 | 609 | |
613 | 610 | //eggsurplus Bug 23816: maintain VCR after an edit/save. If it is a duplicate then don't worry about it. The offset is now worthless. |
614 | - if(isset($_REQUEST['offset']) && empty($_REQUEST['duplicateSave'])) { |
|
611 | + if (isset($_REQUEST['offset']) && empty($_REQUEST['duplicateSave'])) { |
|
615 | 612 | $url .= "&offset=".$_REQUEST['offset']; |
616 | 613 | } |
617 | 614 | |
@@ -620,15 +617,15 @@ discard block |
||
620 | 617 | /** |
621 | 618 | * Perform the actual massupdate. |
622 | 619 | */ |
623 | - protected function action_massupdate(){ |
|
624 | - if(!empty($_REQUEST['massupdate']) && $_REQUEST['massupdate'] == 'true' && (!empty($_REQUEST['uid']) || !empty($_REQUEST['entire']))){ |
|
625 | - if(!empty($_REQUEST['Delete']) && $_REQUEST['Delete']=='true' && !$this->bean->ACLAccess('delete') |
|
626 | - || (empty($_REQUEST['Delete']) || $_REQUEST['Delete']!='true') && !$this->bean->ACLAccess('save')){ |
|
620 | + protected function action_massupdate() { |
|
621 | + if (!empty($_REQUEST['massupdate']) && $_REQUEST['massupdate'] == 'true' && (!empty($_REQUEST['uid']) || !empty($_REQUEST['entire']))) { |
|
622 | + if (!empty($_REQUEST['Delete']) && $_REQUEST['Delete'] == 'true' && !$this->bean->ACLAccess('delete') |
|
623 | + || (empty($_REQUEST['Delete']) || $_REQUEST['Delete'] != 'true') && !$this->bean->ACLAccess('save')) { |
|
627 | 624 | ACLController::displayNoAccess(true); |
628 | 625 | sugar_cleanup(true); |
629 | 626 | } |
630 | 627 | |
631 | - set_time_limit(0);//I'm wondering if we will set it never goes timeout here. |
|
628 | + set_time_limit(0); //I'm wondering if we will set it never goes timeout here. |
|
632 | 629 | // until we have more efficient way of handling MU, we have to disable the limit |
633 | 630 | $GLOBALS['db']->setQueryLimit(0); |
634 | 631 | require_once("include/MassUpdate.php"); |
@@ -636,40 +633,38 @@ discard block |
||
636 | 633 | $seed = loadBean($_REQUEST['module']); |
637 | 634 | $mass = new MassUpdate(); |
638 | 635 | $mass->setSugarBean($seed); |
639 | - if(isset($_REQUEST['entire']) && empty($_POST['mass'])) { |
|
636 | + if (isset($_REQUEST['entire']) && empty($_POST['mass'])) { |
|
640 | 637 | $mass->generateSearchWhere($_REQUEST['module'], $_REQUEST['current_query_by_page']); |
641 | 638 | } |
642 | 639 | $mass->handleMassUpdate(); |
643 | - $storeQuery = new StoreQuery();//restore the current search. to solve bug 24722 for multi tabs massupdate. |
|
640 | + $storeQuery = new StoreQuery(); //restore the current search. to solve bug 24722 for multi tabs massupdate. |
|
644 | 641 | $temp_req = array('current_query_by_page' => $_REQUEST['current_query_by_page'], 'return_module' => $_REQUEST['return_module'], 'return_action' => $_REQUEST['return_action']); |
645 | - if($_REQUEST['return_module'] == 'Emails') { |
|
646 | - if(!empty($_REQUEST['type']) && !empty($_REQUEST['ie_assigned_user_id'])) { |
|
642 | + if ($_REQUEST['return_module'] == 'Emails') { |
|
643 | + if (!empty($_REQUEST['type']) && !empty($_REQUEST['ie_assigned_user_id'])) { |
|
647 | 644 | $this->req_for_email = array('type' => $_REQUEST['type'], 'ie_assigned_user_id' => $_REQUEST['ie_assigned_user_id']); // Specifically for My Achieves |
648 | 645 | } |
649 | 646 | } |
650 | 647 | $_REQUEST = array(); |
651 | 648 | $_REQUEST = unserialize(base64_decode($temp_req['current_query_by_page'])); |
652 | - unset($_REQUEST[$seed->module_dir.'2_'.strtoupper($seed->object_name).'_offset']);//after massupdate, the page should redirect to no offset page |
|
649 | + unset($_REQUEST[$seed->module_dir.'2_'.strtoupper($seed->object_name).'_offset']); //after massupdate, the page should redirect to no offset page |
|
653 | 650 | $storeQuery->saveFromRequest($_REQUEST['module']); |
654 | - $_REQUEST = array('return_module' => $temp_req['return_module'], 'return_action' => $temp_req['return_action']);//for post_massupdate, to go back to original page. |
|
655 | - }else{ |
|
651 | + $_REQUEST = array('return_module' => $temp_req['return_module'], 'return_action' => $temp_req['return_action']); //for post_massupdate, to go back to original page. |
|
652 | + } else { |
|
656 | 653 | sugar_die("You must massupdate at least one record"); |
657 | 654 | } |
658 | 655 | } |
659 | 656 | /** |
660 | 657 | * Specify what happens after the massupdate has occurred. |
661 | 658 | */ |
662 | - protected function post_massupdate(){ |
|
659 | + protected function post_massupdate() { |
|
663 | 660 | $return_module = isset($_REQUEST['return_module']) ? |
664 | - $_REQUEST['return_module'] : |
|
665 | - $GLOBALS['sugar_config']['default_module']; |
|
661 | + $_REQUEST['return_module'] : $GLOBALS['sugar_config']['default_module']; |
|
666 | 662 | $return_action = isset($_REQUEST['return_action']) ? |
667 | - $_REQUEST['return_action'] : |
|
668 | - $GLOBALS['sugar_config']['default_action']; |
|
663 | + $_REQUEST['return_action'] : $GLOBALS['sugar_config']['default_action']; |
|
669 | 664 | $url = "index.php?module=".$return_module."&action=".$return_action; |
670 | - if($return_module == 'Emails'){//specificly for My Achieves |
|
671 | - if(!empty($this->req_for_email['type']) && !empty($this->req_for_email['ie_assigned_user_id'])) { |
|
672 | - $url = $url . "&type=".$this->req_for_email['type']."&assigned_user_id=".$this->req_for_email['ie_assigned_user_id']; |
|
665 | + if ($return_module == 'Emails') {//specificly for My Achieves |
|
666 | + if (!empty($this->req_for_email['type']) && !empty($this->req_for_email['ie_assigned_user_id'])) { |
|
667 | + $url = $url."&type=".$this->req_for_email['type']."&assigned_user_id=".$this->req_for_email['ie_assigned_user_id']; |
|
673 | 668 | } |
674 | 669 | } |
675 | 670 | $this->set_redirect($url); |
@@ -677,7 +672,7 @@ discard block |
||
677 | 672 | /** |
678 | 673 | * Perform the listview action |
679 | 674 | */ |
680 | - protected function action_listview(){ |
|
675 | + protected function action_listview() { |
|
681 | 676 | $this->view_object_map['bean'] = $this->bean; |
682 | 677 | $this->view = 'list'; |
683 | 678 | } |
@@ -692,24 +687,24 @@ discard block |
||
692 | 687 | /** |
693 | 688 | * Action to handle when using a file as was done in previous versions of Sugar. |
694 | 689 | */ |
695 | - protected function action_default(){ |
|
690 | + protected function action_default() { |
|
696 | 691 | $this->view = 'classic'; |
697 | 692 | } |
698 | 693 | |
699 | 694 | /** |
700 | 695 | * this method id used within a Dashlet when performing an ajax call |
701 | 696 | */ |
702 | - protected function action_callmethoddashlet(){ |
|
703 | - if(!empty($_REQUEST['id'])) { |
|
697 | + protected function action_callmethoddashlet() { |
|
698 | + if (!empty($_REQUEST['id'])) { |
|
704 | 699 | $id = $_REQUEST['id']; |
705 | 700 | $requestedMethod = $_REQUEST['method']; |
706 | 701 | $dashletDefs = $GLOBALS['current_user']->getPreference('dashlets', 'Home'); // load user's dashlets config |
707 | - if(!empty($dashletDefs[$id])) { |
|
702 | + if (!empty($dashletDefs[$id])) { |
|
708 | 703 | require_once($dashletDefs[$id]['fileLocation']); |
709 | 704 | |
710 | 705 | $dashlet = new $dashletDefs[$id]['className']($id, (isset($dashletDefs[$id]['options']) ? $dashletDefs[$id]['options'] : array())); |
711 | 706 | |
712 | - if(method_exists($dashlet, $requestedMethod) || method_exists($dashlet, '__call')) { |
|
707 | + if (method_exists($dashlet, $requestedMethod) || method_exists($dashlet, '__call')) { |
|
713 | 708 | echo $dashlet->$requestedMethod(); |
714 | 709 | } |
715 | 710 | else { |
@@ -722,22 +717,22 @@ discard block |
||
722 | 717 | /** |
723 | 718 | * this method is used within a Dashlet when the options configuration is posted |
724 | 719 | */ |
725 | - protected function action_configuredashlet(){ |
|
720 | + protected function action_configuredashlet() { |
|
726 | 721 | global $current_user, $mod_strings; |
727 | 722 | |
728 | - if(!empty($_REQUEST['id'])) { |
|
723 | + if (!empty($_REQUEST['id'])) { |
|
729 | 724 | $id = $_REQUEST['id']; |
730 | 725 | $dashletDefs = $current_user->getPreference('dashlets', $_REQUEST['module']); // load user's dashlets config |
731 | 726 | require_once($dashletDefs[$id]['fileLocation']); |
732 | 727 | |
733 | 728 | $dashlet = new $dashletDefs[$id]['className']($id, (isset($dashletDefs[$id]['options']) ? $dashletDefs[$id]['options'] : array())); |
734 | - if(!empty($_REQUEST['configure']) && $_REQUEST['configure']) { // save settings |
|
729 | + if (!empty($_REQUEST['configure']) && $_REQUEST['configure']) { // save settings |
|
735 | 730 | $dashletDefs[$id]['options'] = $dashlet->saveOptions($_REQUEST); |
736 | 731 | $current_user->setPreference('dashlets', $dashletDefs, 0, $_REQUEST['module']); |
737 | 732 | } |
738 | 733 | else { // display options |
739 | 734 | $json = getJSONobj(); |
740 | - return 'result = ' . $json->encode((array('header' => $dashlet->title . ' : ' . $mod_strings['LBL_OPTIONS'], |
|
735 | + return 'result = '.$json->encode((array('header' => $dashlet->title.' : '.$mod_strings['LBL_OPTIONS'], |
|
741 | 736 | 'body' => $dashlet->displayOptions()))); |
742 | 737 | |
743 | 738 | } |
@@ -761,7 +756,7 @@ discard block |
||
761 | 756 | ob_clean(); |
762 | 757 | $retval = false; |
763 | 758 | |
764 | - if(method_exists($this->bean, 'deleteAttachment')) { |
|
759 | + if (method_exists($this->bean, 'deleteAttachment')) { |
|
765 | 760 | $duplicate = "false"; |
766 | 761 | if (isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == "true") { |
767 | 762 | $duplicate = "true"; |
@@ -779,7 +774,7 @@ discard block |
||
779 | 774 | * getActionFilename |
780 | 775 | */ |
781 | 776 | public static function getActionFilename($action) { |
782 | - if(isset(self::$action_case_file[$action])) { |
|
777 | + if (isset(self::$action_case_file[$action])) { |
|
783 | 778 | return self::$action_case_file[$action]; |
784 | 779 | } |
785 | 780 | return $action; |
@@ -796,40 +791,40 @@ discard block |
||
796 | 791 | * |
797 | 792 | * @return true if we want to stop processing, false if processing should continue |
798 | 793 | */ |
799 | - private function blockFileAccess(){ |
|
794 | + private function blockFileAccess() { |
|
800 | 795 | //check if the we have enabled file_access_control and if so then check the mappings on the request; |
801 | - if(!empty($GLOBALS['sugar_config']['admin_access_control']) && $GLOBALS['sugar_config']['admin_access_control']){ |
|
796 | + if (!empty($GLOBALS['sugar_config']['admin_access_control']) && $GLOBALS['sugar_config']['admin_access_control']) { |
|
802 | 797 | $this->loadMapping('file_access_control_map'); |
803 | 798 | //since we have this turned on, check the mapping file |
804 | 799 | $module = strtolower($this->module); |
805 | 800 | $action = strtolower($this->do_action); |
806 | - if(!empty($this->file_access_control_map['modules'][$module]['links'])){ |
|
801 | + if (!empty($this->file_access_control_map['modules'][$module]['links'])) { |
|
807 | 802 | $GLOBALS['admin_access_control_links'] = $this->file_access_control_map['modules'][$module]['links']; |
808 | 803 | } |
809 | 804 | |
810 | - if(!empty($this->file_access_control_map['modules'][$module]['actions']) && (in_array($action, $this->file_access_control_map['modules'][$module]['actions']) || !empty($this->file_access_control_map['modules'][$module]['actions'][$action]))){ |
|
805 | + if (!empty($this->file_access_control_map['modules'][$module]['actions']) && (in_array($action, $this->file_access_control_map['modules'][$module]['actions']) || !empty($this->file_access_control_map['modules'][$module]['actions'][$action]))) { |
|
811 | 806 | //check params |
812 | - if(!empty($this->file_access_control_map['modules'][$module]['actions'][$action]['params'])){ |
|
807 | + if (!empty($this->file_access_control_map['modules'][$module]['actions'][$action]['params'])) { |
|
813 | 808 | $block = true; |
814 | 809 | $params = $this->file_access_control_map['modules'][$module]['actions'][$action]['params']; |
815 | - foreach($params as $param => $paramVals){ |
|
816 | - if(!empty($_REQUEST[$param])){ |
|
817 | - if(!in_array($_REQUEST[$param], $paramVals)){ |
|
810 | + foreach ($params as $param => $paramVals) { |
|
811 | + if (!empty($_REQUEST[$param])) { |
|
812 | + if (!in_array($_REQUEST[$param], $paramVals)) { |
|
818 | 813 | $block = false; |
819 | 814 | break; |
820 | 815 | } |
821 | 816 | } |
822 | 817 | } |
823 | - if($block){ |
|
818 | + if ($block) { |
|
824 | 819 | $this->_processed = true; |
825 | 820 | $this->no_access(); |
826 | 821 | } |
827 | - }else{ |
|
822 | + } else { |
|
828 | 823 | $this->_processed = true; |
829 | 824 | $this->no_access(); |
830 | 825 | } |
831 | 826 | } |
832 | - }else |
|
827 | + } else |
|
833 | 828 | $this->_processed = false; |
834 | 829 | } |
835 | 830 | |
@@ -841,12 +836,12 @@ discard block |
||
841 | 836 | * the download entry point is mapped in the following file: entry_point_registry.php |
842 | 837 | * |
843 | 838 | */ |
844 | - private function handleEntryPoint(){ |
|
845 | - if(!empty($_REQUEST['entryPoint'])){ |
|
839 | + private function handleEntryPoint() { |
|
840 | + if (!empty($_REQUEST['entryPoint'])) { |
|
846 | 841 | $this->loadMapping('entry_point_registry'); |
847 | 842 | $entryPoint = $_REQUEST['entryPoint']; |
848 | 843 | |
849 | - if(!empty($this->entry_point_registry[$entryPoint])){ |
|
844 | + if (!empty($this->entry_point_registry[$entryPoint])) { |
|
850 | 845 | require_once($this->entry_point_registry[$entryPoint]['file']); |
851 | 846 | $this->_processed = true; |
852 | 847 | $this->view = ''; |
@@ -864,8 +859,8 @@ discard block |
||
864 | 859 | { |
865 | 860 | $this->loadMapping('entry_point_registry'); |
866 | 861 | |
867 | - if ( isset($this->entry_point_registry[$entryPoint]['auth']) |
|
868 | - && !$this->entry_point_registry[$entryPoint]['auth'] ) |
|
862 | + if (isset($this->entry_point_registry[$entryPoint]['auth']) |
|
863 | + && !$this->entry_point_registry[$entryPoint]['auth']) |
|
869 | 864 | return false; |
870 | 865 | return true; |
871 | 866 | } |
@@ -877,26 +872,26 @@ discard block |
||
877 | 872 | protected function callLegacyCode() |
878 | 873 | { |
879 | 874 | $file = self::getActionFilename($this->do_action); |
880 | - if ( isset($this->action_view_map[strtolower($this->do_action)]) ) { |
|
875 | + if (isset($this->action_view_map[strtolower($this->do_action)])) { |
|
881 | 876 | $action = $this->action_view_map[strtolower($this->do_action)]; |
882 | 877 | } |
883 | 878 | else { |
884 | 879 | $action = $this->do_action; |
885 | 880 | } |
886 | 881 | // index actions actually maps to the view.list.php view |
887 | - if ( $action == 'index' ) { |
|
882 | + if ($action == 'index') { |
|
888 | 883 | $action = 'list'; |
889 | 884 | } |
890 | 885 | |
891 | - if ((file_exists('modules/' . $this->module . '/'. $file . '.php') |
|
892 | - && !file_exists('modules/' . $this->module . '/views/view.'. $action . '.php')) |
|
893 | - || (file_exists('custom/modules/' . $this->module . '/'. $file . '.php') |
|
894 | - && !file_exists('custom/modules/' . $this->module . '/views/view.'. $action . '.php')) |
|
886 | + if ((file_exists('modules/'.$this->module.'/'.$file.'.php') |
|
887 | + && !file_exists('modules/'.$this->module.'/views/view.'.$action.'.php')) |
|
888 | + || (file_exists('custom/modules/'.$this->module.'/'.$file.'.php') |
|
889 | + && !file_exists('custom/modules/'.$this->module.'/views/view.'.$action.'.php')) |
|
895 | 890 | ) { |
896 | 891 | // A 'classic' module, using the old pre-MVC display files |
897 | 892 | // We should now discard the bean we just obtained for tracking as the pre-MVC module will instantiate its own |
898 | 893 | unset($GLOBALS['FOCUS']); |
899 | - $GLOBALS['log']->debug('Module:' . $this->module . ' using file: '. $file); |
|
894 | + $GLOBALS['log']->debug('Module:'.$this->module.' using file: '.$file); |
|
900 | 895 | $this->action_default(); |
901 | 896 | $this->_processed = true; |
902 | 897 | } |
@@ -907,17 +902,17 @@ discard block |
||
907 | 902 | * action_file_map.php or action_view_map.php load those maps here. |
908 | 903 | * |
909 | 904 | */ |
910 | - private function handleActionMaps(){ |
|
911 | - if(!empty($this->action_file_map[strtolower($this->do_action)])){ |
|
905 | + private function handleActionMaps() { |
|
906 | + if (!empty($this->action_file_map[strtolower($this->do_action)])) { |
|
912 | 907 | $this->view = ''; |
913 | - $GLOBALS['log']->debug('Using Action File Map:' . $this->action_file_map[strtolower($this->do_action)]); |
|
908 | + $GLOBALS['log']->debug('Using Action File Map:'.$this->action_file_map[strtolower($this->do_action)]); |
|
914 | 909 | require_once($this->action_file_map[strtolower($this->do_action)]); |
915 | 910 | $this->_processed = true; |
916 | - }elseif(!empty($this->action_view_map[strtolower($this->do_action)])){ |
|
917 | - $GLOBALS['log']->debug('Using Action View Map:' . $this->action_view_map[strtolower($this->do_action)]); |
|
911 | + }elseif (!empty($this->action_view_map[strtolower($this->do_action)])) { |
|
912 | + $GLOBALS['log']->debug('Using Action View Map:'.$this->action_view_map[strtolower($this->do_action)]); |
|
918 | 913 | $this->view = $this->action_view_map[strtolower($this->do_action)]; |
919 | 914 | $this->_processed = true; |
920 | - }else |
|
915 | + } else |
|
921 | 916 | $this->no_action(); |
922 | 917 | } |
923 | 918 | |
@@ -925,8 +920,8 @@ discard block |
||
925 | 920 | * Actually remap the action if required. |
926 | 921 | * |
927 | 922 | */ |
928 | - protected function remapAction(){ |
|
929 | - if(!empty($this->action_remap[$this->do_action])){ |
|
923 | + protected function remapAction() { |
|
924 | + if (!empty($this->action_remap[$this->do_action])) { |
|
930 | 925 | $this->action = $this->action_remap[$this->do_action]; |
931 | 926 | $this->do_action = $this->action; |
932 | 927 | } |
@@ -171,11 +171,13 @@ discard block |
||
171 | 171 | * |
172 | 172 | */ |
173 | 173 | public function setup($module = ''){ |
174 | - if(empty($module) && !empty($_REQUEST['module'])) |
|
175 | - $module = $_REQUEST['module']; |
|
174 | + if(empty($module) && !empty($_REQUEST['module'])) { |
|
175 | + $module = $_REQUEST['module']; |
|
176 | + } |
|
176 | 177 | //set the module |
177 | - if(!empty($module)) |
|
178 | - $this->setModule($module); |
|
178 | + if(!empty($module)) { |
|
179 | + $this->setModule($module); |
|
180 | + } |
|
179 | 181 | |
180 | 182 | if(!empty($_REQUEST['target_module']) && $_REQUEST['target_module'] != 'undefined') { |
181 | 183 | $this->target_module = $_REQUEST['target_module']; |
@@ -199,18 +201,24 @@ discard block |
||
199 | 201 | * |
200 | 202 | */ |
201 | 203 | private function loadPropertiesFromRequest(){ |
202 | - if(!empty($_REQUEST['action'])) |
|
203 | - $this->action = $_REQUEST['action']; |
|
204 | - if(!empty($_REQUEST['record'])) |
|
205 | - $this->record = $_REQUEST['record']; |
|
206 | - if(!empty($_REQUEST['view'])) |
|
207 | - $this->view = $_REQUEST['view']; |
|
208 | - if(!empty($_REQUEST['return_module'])) |
|
209 | - $this->return_module = $_REQUEST['return_module']; |
|
210 | - if(!empty($_REQUEST['return_action'])) |
|
211 | - $this->return_action = $_REQUEST['return_action']; |
|
212 | - if(!empty($_REQUEST['return_id'])) |
|
213 | - $this->return_id = $_REQUEST['return_id']; |
|
204 | + if(!empty($_REQUEST['action'])) { |
|
205 | + $this->action = $_REQUEST['action']; |
|
206 | + } |
|
207 | + if(!empty($_REQUEST['record'])) { |
|
208 | + $this->record = $_REQUEST['record']; |
|
209 | + } |
|
210 | + if(!empty($_REQUEST['view'])) { |
|
211 | + $this->view = $_REQUEST['view']; |
|
212 | + } |
|
213 | + if(!empty($_REQUEST['return_module'])) { |
|
214 | + $this->return_module = $_REQUEST['return_module']; |
|
215 | + } |
|
216 | + if(!empty($_REQUEST['return_action'])) { |
|
217 | + $this->return_action = $_REQUEST['return_action']; |
|
218 | + } |
|
219 | + if(!empty($_REQUEST['return_id'])) { |
|
220 | + $this->return_id = $_REQUEST['return_id']; |
|
221 | + } |
|
214 | 222 | } |
215 | 223 | |
216 | 224 | /** |
@@ -235,8 +243,9 @@ discard block |
||
235 | 243 | $this->bean = new $class(); |
236 | 244 | if(!empty($this->record)){ |
237 | 245 | $this->bean->retrieve($this->record); |
238 | - if($this->bean) |
|
239 | - $GLOBALS['FOCUS'] = $this->bean; |
|
246 | + if($this->bean) { |
|
247 | + $GLOBALS['FOCUS'] = $this->bean; |
|
248 | + } |
|
240 | 249 | } |
241 | 250 | } |
242 | 251 | } |
@@ -250,7 +259,7 @@ discard block |
||
250 | 259 | if(!$$var){ |
251 | 260 | if($merge && !empty($this->$var)){ |
252 | 261 | $$var = $this->$var; |
253 | - }else{ |
|
262 | + } else{ |
|
254 | 263 | $$var = array(); |
255 | 264 | } |
256 | 265 | if(file_exists('include/MVC/Controller/'. $var . '.php')){ |
@@ -293,13 +302,11 @@ discard block |
||
293 | 302 | if(!empty($this->view)) |
294 | 303 | { |
295 | 304 | $this->processView(); |
296 | - } |
|
297 | - elseif(!empty($this->redirect_url)) |
|
305 | + } elseif(!empty($this->redirect_url)) |
|
298 | 306 | { |
299 | 307 | $this->redirect(); |
300 | 308 | } |
301 | - } |
|
302 | - catch (Exception $e) |
|
309 | + } catch (Exception $e) |
|
303 | 310 | { |
304 | 311 | $this->handleException($e); |
305 | 312 | } |
@@ -321,8 +328,7 @@ discard block |
||
321 | 328 | { |
322 | 329 | $logicHook->setBean($this->bean); |
323 | 330 | $logicHook->call_custom_logic($this->bean->module_dir, "handle_exception", $e); |
324 | - } |
|
325 | - else |
|
331 | + } else |
|
326 | 332 | { |
327 | 333 | $logicHook->call_custom_logic('', "handle_exception", $e); |
328 | 334 | } |
@@ -384,7 +390,7 @@ discard block |
||
384 | 390 | } |
385 | 391 | |
386 | 392 | $this->redirect(); |
387 | - }else{ |
|
393 | + } else{ |
|
388 | 394 | $this->no_access(); |
389 | 395 | } |
390 | 396 | } |
@@ -491,8 +497,9 @@ discard block |
||
491 | 497 | */ |
492 | 498 | protected function redirect(){ |
493 | 499 | |
494 | - if(!empty($this->redirect_url)) |
|
495 | - SugarApplication::redirect($this->redirect_url); |
|
500 | + if(!empty($this->redirect_url)) { |
|
501 | + SugarApplication::redirect($this->redirect_url); |
|
502 | + } |
|
496 | 503 | } |
497 | 504 | |
498 | 505 | //////////////////////////////////////////////////////// |
@@ -586,7 +593,7 @@ discard block |
||
586 | 593 | sugar_cleanup(true); |
587 | 594 | } |
588 | 595 | $this->bean->mark_deleted($_REQUEST['record']); |
589 | - }else{ |
|
596 | + } else{ |
|
590 | 597 | sugar_die("A record number must be specified to delete"); |
591 | 598 | } |
592 | 599 | } |
@@ -652,7 +659,7 @@ discard block |
||
652 | 659 | unset($_REQUEST[$seed->module_dir.'2_'.strtoupper($seed->object_name).'_offset']);//after massupdate, the page should redirect to no offset page |
653 | 660 | $storeQuery->saveFromRequest($_REQUEST['module']); |
654 | 661 | $_REQUEST = array('return_module' => $temp_req['return_module'], 'return_action' => $temp_req['return_action']);//for post_massupdate, to go back to original page. |
655 | - }else{ |
|
662 | + } else{ |
|
656 | 663 | sugar_die("You must massupdate at least one record"); |
657 | 664 | } |
658 | 665 | } |
@@ -711,8 +718,7 @@ discard block |
||
711 | 718 | |
712 | 719 | if(method_exists($dashlet, $requestedMethod) || method_exists($dashlet, '__call')) { |
713 | 720 | echo $dashlet->$requestedMethod(); |
714 | - } |
|
715 | - else { |
|
721 | + } else { |
|
716 | 722 | echo 'no method'; |
717 | 723 | } |
718 | 724 | } |
@@ -734,15 +740,13 @@ discard block |
||
734 | 740 | if(!empty($_REQUEST['configure']) && $_REQUEST['configure']) { // save settings |
735 | 741 | $dashletDefs[$id]['options'] = $dashlet->saveOptions($_REQUEST); |
736 | 742 | $current_user->setPreference('dashlets', $dashletDefs, 0, $_REQUEST['module']); |
737 | - } |
|
738 | - else { // display options |
|
743 | + } else { // display options |
|
739 | 744 | $json = getJSONobj(); |
740 | 745 | return 'result = ' . $json->encode((array('header' => $dashlet->title . ' : ' . $mod_strings['LBL_OPTIONS'], |
741 | 746 | 'body' => $dashlet->displayOptions()))); |
742 | 747 | |
743 | 748 | } |
744 | - } |
|
745 | - else { |
|
749 | + } else { |
|
746 | 750 | return '0'; |
747 | 751 | } |
748 | 752 | } |
@@ -824,13 +828,14 @@ discard block |
||
824 | 828 | $this->_processed = true; |
825 | 829 | $this->no_access(); |
826 | 830 | } |
827 | - }else{ |
|
831 | + } else{ |
|
828 | 832 | $this->_processed = true; |
829 | 833 | $this->no_access(); |
830 | 834 | } |
831 | 835 | } |
832 | - }else |
|
833 | - $this->_processed = false; |
|
836 | + } else { |
|
837 | + $this->_processed = false; |
|
838 | + } |
|
834 | 839 | } |
835 | 840 | |
836 | 841 | /** |
@@ -865,8 +870,9 @@ discard block |
||
865 | 870 | $this->loadMapping('entry_point_registry'); |
866 | 871 | |
867 | 872 | if ( isset($this->entry_point_registry[$entryPoint]['auth']) |
868 | - && !$this->entry_point_registry[$entryPoint]['auth'] ) |
|
869 | - return false; |
|
873 | + && !$this->entry_point_registry[$entryPoint]['auth'] ) { |
|
874 | + return false; |
|
875 | + } |
|
870 | 876 | return true; |
871 | 877 | } |
872 | 878 | |
@@ -879,8 +885,7 @@ discard block |
||
879 | 885 | $file = self::getActionFilename($this->do_action); |
880 | 886 | if ( isset($this->action_view_map[strtolower($this->do_action)]) ) { |
881 | 887 | $action = $this->action_view_map[strtolower($this->do_action)]; |
882 | - } |
|
883 | - else { |
|
888 | + } else { |
|
884 | 889 | $action = $this->do_action; |
885 | 890 | } |
886 | 891 | // index actions actually maps to the view.list.php view |
@@ -913,12 +918,13 @@ discard block |
||
913 | 918 | $GLOBALS['log']->debug('Using Action File Map:' . $this->action_file_map[strtolower($this->do_action)]); |
914 | 919 | require_once($this->action_file_map[strtolower($this->do_action)]); |
915 | 920 | $this->_processed = true; |
916 | - }elseif(!empty($this->action_view_map[strtolower($this->do_action)])){ |
|
921 | + } elseif(!empty($this->action_view_map[strtolower($this->do_action)])){ |
|
917 | 922 | $GLOBALS['log']->debug('Using Action View Map:' . $this->action_view_map[strtolower($this->do_action)]); |
918 | 923 | $this->view = $this->action_view_map[strtolower($this->do_action)]; |
919 | 924 | $this->_processed = true; |
920 | - }else |
|
921 | - $this->no_action(); |
|
925 | + } else { |
|
926 | + $this->no_action(); |
|
927 | + } |
|
922 | 928 | } |
923 | 929 | |
924 | 930 | /** |
@@ -39,19 +39,19 @@ discard block |
||
39 | 39 | ********************************************************************************/ |
40 | 40 | |
41 | 41 | $entry_point_registry = array( |
42 | - 'emailImage' => array('file' => 'modules/EmailMan/EmailImage.php', 'auth' => false), |
|
43 | - 'download' => array('file' => 'download.php', 'auth' => true), |
|
44 | - 'export' => array('file' => 'export.php', 'auth' => true), |
|
45 | - 'export_dataset' => array('file' => 'export_dataset.php', 'auth' => true), |
|
46 | - 'Changenewpassword' => array('file' => 'modules/Users/Changenewpassword.php', 'auth' => false), |
|
47 | - 'GeneratePassword' => array('file' => 'modules/Users/GeneratePassword.php', 'auth' => false), |
|
48 | - 'vCard' => array('file' => 'vCard.php', 'auth' => true), |
|
49 | - 'pdf' => array('file' => 'pdf.php', 'auth' => true), |
|
50 | - 'minify' => array('file' => 'jssource/minify.php', 'auth' => true), |
|
42 | + 'emailImage' => array('file' => 'modules/EmailMan/EmailImage.php', 'auth' => false), |
|
43 | + 'download' => array('file' => 'download.php', 'auth' => true), |
|
44 | + 'export' => array('file' => 'export.php', 'auth' => true), |
|
45 | + 'export_dataset' => array('file' => 'export_dataset.php', 'auth' => true), |
|
46 | + 'Changenewpassword' => array('file' => 'modules/Users/Changenewpassword.php', 'auth' => false), |
|
47 | + 'GeneratePassword' => array('file' => 'modules/Users/GeneratePassword.php', 'auth' => false), |
|
48 | + 'vCard' => array('file' => 'vCard.php', 'auth' => true), |
|
49 | + 'pdf' => array('file' => 'pdf.php', 'auth' => true), |
|
50 | + 'minify' => array('file' => 'jssource/minify.php', 'auth' => true), |
|
51 | 51 | 'json_server' => array('file' => 'json_server.php', 'auth' => true), |
52 | 52 | 'get_url' => array('file' => 'get_url.php', 'auth' => true), |
53 | - 'HandleAjaxCall' => array('file' => 'HandleAjaxCall.php', 'auth' => true), |
|
54 | - 'TreeData' => array('file' => 'TreeData.php', 'auth' => true), |
|
53 | + 'HandleAjaxCall' => array('file' => 'HandleAjaxCall.php', 'auth' => true), |
|
54 | + 'TreeData' => array('file' => 'TreeData.php', 'auth' => true), |
|
55 | 55 | 'image' => array('file' => 'modules/Campaigns/image.php', 'auth' => false), |
56 | 56 | 'campaign_trackerv2' => array('file' => 'modules/Campaigns/Tracker.php', 'auth' => false), |
57 | 57 | 'WebToLeadCapture' => array('file' => 'modules/Campaigns/WebToLeadCapture.php', 'auth' => false), |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | 'acceptDecline' => array('file' => 'modules/Contacts/AcceptDecline.php', 'auth' => false), |
60 | 60 | 'leadCapture' => array('file' => 'modules/Leads/Capture.php', 'auth' => false), |
61 | 61 | 'process_queue' => array('file' => 'process_queue.php', 'auth' => true), |
62 | - 'zipatcher' => array('file' => 'zipatcher.php', 'auth' => true), |
|
62 | + 'zipatcher' => array('file' => 'zipatcher.php', 'auth' => true), |
|
63 | 63 | 'mm_get_doc' => array('file' => 'modules/MailMerge/get_doc.php', 'auth' => true), |
64 | 64 | 'getImage' => array('file' => 'include/SugarTheme/getImage.php', 'auth' => false), |
65 | 65 | 'GenerateQuickComposeFrame' => array('file' => 'modules/Emails/GenerateQuickComposeFrame.php', 'auth' => true), |
@@ -68,18 +68,18 @@ discard block |
||
68 | 68 | 'UploadFileCheck' => array('file' => 'modules/Configurator/UploadFileCheck.php', 'auth' => true), |
69 | 69 | 'SAML'=> array('file' => 'modules/Users/authentication/SAMLAuthenticate/index.php', 'auth' => false), |
70 | 70 | 'jslang'=> array('file' => 'include/language/getJSLanguage.php', 'auth' => true), |
71 | - 'deleteAttachment' => array('file' => 'modules/FP_events/responseEntryPoint.php', 'auth' => false), |
|
72 | - 'responseEntryPoint' => array('file' => 'modules/FP_events/responseEntryPoint.php', 'auth' => false), |
|
73 | - 'formLetter' => array('file' => 'modules/AOS_PDF_Templates/formLetterPdf.php' , 'auth' => true), |
|
74 | - 'generatePdf' => array('file' => 'modules/AOS_PDF_Templates/generatePdf.php' , 'auth' => true), |
|
75 | - 'Reschedule' => array('file' => 'modules/Calls_Reschedule/Reschedule_popup.php' , 'auth' => true), |
|
76 | - 'Reschedule2' => array('file' => 'modules/Calls/Reschedule.php' , 'auth' => true), |
|
77 | - 'social' => array('file' => 'include/social/get_data.php' , 'auth' => true), |
|
78 | - 'social_reader' => array('file' => 'include/social/get_feed_data.php' , 'auth' => true), |
|
79 | - 'add_dash_page' => array('file' => 'modules/Home/AddDashboardPages.php' , 'auth' => true), |
|
80 | - 'retrieve_dash_page' => array('file' => 'include/MySugar/retrieve_dash_page.php' , 'auth' => true), |
|
81 | - 'remove_dash_page' => array('file' => 'modules/Home/RemoveDashboardPages.php' , 'auth' => true), |
|
82 | - 'rename_dash_page' => array('file' => 'modules/Home/RenameDashboardPages.php' , 'auth' => true) |
|
71 | + 'deleteAttachment' => array('file' => 'modules/FP_events/responseEntryPoint.php', 'auth' => false), |
|
72 | + 'responseEntryPoint' => array('file' => 'modules/FP_events/responseEntryPoint.php', 'auth' => false), |
|
73 | + 'formLetter' => array('file' => 'modules/AOS_PDF_Templates/formLetterPdf.php' , 'auth' => true), |
|
74 | + 'generatePdf' => array('file' => 'modules/AOS_PDF_Templates/generatePdf.php' , 'auth' => true), |
|
75 | + 'Reschedule' => array('file' => 'modules/Calls_Reschedule/Reschedule_popup.php' , 'auth' => true), |
|
76 | + 'Reschedule2' => array('file' => 'modules/Calls/Reschedule.php' , 'auth' => true), |
|
77 | + 'social' => array('file' => 'include/social/get_data.php' , 'auth' => true), |
|
78 | + 'social_reader' => array('file' => 'include/social/get_feed_data.php' , 'auth' => true), |
|
79 | + 'add_dash_page' => array('file' => 'modules/Home/AddDashboardPages.php' , 'auth' => true), |
|
80 | + 'retrieve_dash_page' => array('file' => 'include/MySugar/retrieve_dash_page.php' , 'auth' => true), |
|
81 | + 'remove_dash_page' => array('file' => 'modules/Home/RemoveDashboardPages.php' , 'auth' => true), |
|
82 | + 'rename_dash_page' => array('file' => 'modules/Home/RenameDashboardPages.php' , 'auth' => true) |
|
83 | 83 | ); |
84 | 84 | |
85 | 85 | ?> |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | 3 | /********************************************************************************* |
4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -70,16 +70,16 @@ discard block |
||
70 | 70 | 'jslang'=> array('file' => 'include/language/getJSLanguage.php', 'auth' => true), |
71 | 71 | 'deleteAttachment' => array('file' => 'modules/FP_events/responseEntryPoint.php', 'auth' => false), |
72 | 72 | 'responseEntryPoint' => array('file' => 'modules/FP_events/responseEntryPoint.php', 'auth' => false), |
73 | - 'formLetter' => array('file' => 'modules/AOS_PDF_Templates/formLetterPdf.php' , 'auth' => true), |
|
74 | - 'generatePdf' => array('file' => 'modules/AOS_PDF_Templates/generatePdf.php' , 'auth' => true), |
|
75 | - 'Reschedule' => array('file' => 'modules/Calls_Reschedule/Reschedule_popup.php' , 'auth' => true), |
|
76 | - 'Reschedule2' => array('file' => 'modules/Calls/Reschedule.php' , 'auth' => true), |
|
77 | - 'social' => array('file' => 'include/social/get_data.php' , 'auth' => true), |
|
78 | - 'social_reader' => array('file' => 'include/social/get_feed_data.php' , 'auth' => true), |
|
79 | - 'add_dash_page' => array('file' => 'modules/Home/AddDashboardPages.php' , 'auth' => true), |
|
80 | - 'retrieve_dash_page' => array('file' => 'include/MySugar/retrieve_dash_page.php' , 'auth' => true), |
|
81 | - 'remove_dash_page' => array('file' => 'modules/Home/RemoveDashboardPages.php' , 'auth' => true), |
|
82 | - 'rename_dash_page' => array('file' => 'modules/Home/RenameDashboardPages.php' , 'auth' => true) |
|
73 | + 'formLetter' => array('file' => 'modules/AOS_PDF_Templates/formLetterPdf.php', 'auth' => true), |
|
74 | + 'generatePdf' => array('file' => 'modules/AOS_PDF_Templates/generatePdf.php', 'auth' => true), |
|
75 | + 'Reschedule' => array('file' => 'modules/Calls_Reschedule/Reschedule_popup.php', 'auth' => true), |
|
76 | + 'Reschedule2' => array('file' => 'modules/Calls/Reschedule.php', 'auth' => true), |
|
77 | + 'social' => array('file' => 'include/social/get_data.php', 'auth' => true), |
|
78 | + 'social_reader' => array('file' => 'include/social/get_feed_data.php', 'auth' => true), |
|
79 | + 'add_dash_page' => array('file' => 'modules/Home/AddDashboardPages.php', 'auth' => true), |
|
80 | + 'retrieve_dash_page' => array('file' => 'include/MySugar/retrieve_dash_page.php', 'auth' => true), |
|
81 | + 'remove_dash_page' => array('file' => 'modules/Home/RemoveDashboardPages.php', 'auth' => true), |
|
82 | + 'rename_dash_page' => array('file' => 'modules/Home/RenameDashboardPages.php', 'auth' => true) |
|
83 | 83 | ); |
84 | 84 | |
85 | 85 | ?> |
@@ -1,5 +1,7 @@ |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if(!defined('sugarEntry') || !sugarEntry) { |
|
3 | + die('Not A Valid Entry Point'); |
|
4 | +} |
|
3 | 5 | /********************************************************************************* |
4 | 6 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 7 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -43,7 +43,7 @@ |
||
43 | 43 | * To change the template for this generated file go to |
44 | 44 | * Window - Preferences - PHPeclipse - PHP - Code Templates |
45 | 45 | */ |
46 | - //format '<action_name>' => '<view_name>' |
|
46 | + //format '<action_name>' => '<view_name>' |
|
47 | 47 | $action_view_map['multieditview']= 'multiedit'; |
48 | 48 | $action_view_map['detailview']= 'detail'; |
49 | 49 | $action_view_map['editview']= 'edit'; |
@@ -44,21 +44,21 @@ |
||
44 | 44 | * Window - Preferences - PHPeclipse - PHP - Code Templates |
45 | 45 | */ |
46 | 46 | //format '<action_name>' => '<view_name>' |
47 | -$action_view_map['multieditview']= 'multiedit'; |
|
48 | -$action_view_map['detailview']= 'detail'; |
|
49 | -$action_view_map['editview']= 'edit'; |
|
50 | -$action_view_map['listview']= 'list'; |
|
51 | -$action_view_map['popup']= 'popup'; |
|
52 | -$action_view_map['vcard']= 'vcard'; |
|
53 | -$action_view_map['importvcard']= 'importvcard'; |
|
54 | -$action_view_map['importvcardsave']= 'importvcardsave'; |
|
55 | -$action_view_map['modulelistmenu']= 'modulelistmenu'; |
|
56 | -$action_view_map['favorites']= 'favorites'; |
|
57 | -$action_view_map['ajaxui']= 'ajaxui'; |
|
58 | -$action_view_map['noaccess']= 'noaccess'; |
|
47 | +$action_view_map['multieditview'] = 'multiedit'; |
|
48 | +$action_view_map['detailview'] = 'detail'; |
|
49 | +$action_view_map['editview'] = 'edit'; |
|
50 | +$action_view_map['listview'] = 'list'; |
|
51 | +$action_view_map['popup'] = 'popup'; |
|
52 | +$action_view_map['vcard'] = 'vcard'; |
|
53 | +$action_view_map['importvcard'] = 'importvcard'; |
|
54 | +$action_view_map['importvcardsave'] = 'importvcardsave'; |
|
55 | +$action_view_map['modulelistmenu'] = 'modulelistmenu'; |
|
56 | +$action_view_map['favorites'] = 'favorites'; |
|
57 | +$action_view_map['ajaxui'] = 'ajaxui'; |
|
58 | +$action_view_map['noaccess'] = 'noaccess'; |
|
59 | 59 | |
60 | 60 | // SugarPDF |
61 | -$action_view_map['sugarpdf']= 'sugarpdf'; |
|
61 | +$action_view_map['sugarpdf'] = 'sugarpdf'; |
|
62 | 62 | $action_view_map['dc'] = 'dc'; |
63 | 63 | $action_view_map['dcajax'] = 'dcajax'; |
64 | 64 | $action_view_map['quick'] = 'quick'; |
@@ -46,29 +46,29 @@ |
||
46 | 46 | * Contributor(s): ______________________________________.. |
47 | 47 | ********************************************************************************/ |
48 | 48 | $file_access_control_map = array( |
49 | - 'modules' => array( |
|
50 | - 'administration' => array( |
|
51 | - 'actions' => array( |
|
52 | - 'backups', |
|
53 | - 'updater', |
|
54 | - ), |
|
55 | - 'links' => array( |
|
56 | - 'update', |
|
57 | - 'backup_management', |
|
58 | - 'upgrade_wizard', |
|
59 | - 'moduleBuilder', |
|
60 | - ), |
|
61 | - ), |
|
62 | - 'upgradewizard' => array( |
|
63 | - 'actions' => array( |
|
64 | - 'index', |
|
65 | - ), |
|
66 | - ), |
|
67 | - 'modulebuilder' => array( |
|
68 | - 'actions' => array( |
|
69 | - 'index' => array('params' => array('type' => array('mb'))), |
|
70 | - ), |
|
71 | - ), |
|
72 | - ) |
|
49 | + 'modules' => array( |
|
50 | + 'administration' => array( |
|
51 | + 'actions' => array( |
|
52 | + 'backups', |
|
53 | + 'updater', |
|
54 | + ), |
|
55 | + 'links' => array( |
|
56 | + 'update', |
|
57 | + 'backup_management', |
|
58 | + 'upgrade_wizard', |
|
59 | + 'moduleBuilder', |
|
60 | + ), |
|
61 | + ), |
|
62 | + 'upgradewizard' => array( |
|
63 | + 'actions' => array( |
|
64 | + 'index', |
|
65 | + ), |
|
66 | + ), |
|
67 | + 'modulebuilder' => array( |
|
68 | + 'actions' => array( |
|
69 | + 'index' => array('params' => array('type' => array('mb'))), |
|
70 | + ), |
|
71 | + ), |
|
72 | + ) |
|
73 | 73 | ); |
74 | 74 | ?> |
75 | 75 | \ No newline at end of file |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | 3 | /********************************************************************************* |
4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -1,5 +1,7 @@ |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if(!defined('sugarEntry') || !sugarEntry) { |
|
3 | + die('Not A Valid Entry Point'); |
|
4 | +} |
|
3 | 5 | /********************************************************************************* |
4 | 6 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 7 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -42,28 +42,28 @@ discard block |
||
42 | 42 | require_once("include/utils/db_utils.php"); |
43 | 43 | |
44 | 44 | class jsAlerts{ |
45 | - var $script; |
|
45 | + var $script; |
|
46 | 46 | |
47 | - function jsAlerts(){ |
|
48 | - global $app_strings; |
|
49 | - $this->script .= <<<EOQ |
|
47 | + function jsAlerts(){ |
|
48 | + global $app_strings; |
|
49 | + $this->script .= <<<EOQ |
|
50 | 50 | if (!alertsTimeoutId) { |
51 | 51 | checkAlerts(); |
52 | 52 | } |
53 | 53 | |
54 | 54 | EOQ; |
55 | - $this->addActivities(); |
|
56 | - Reminder::addNotifications($this); |
|
57 | - if(!empty($GLOBALS['sugar_config']['enable_timeout_alerts'])){ |
|
58 | - $this->addAlert($app_strings['ERROR_JS_ALERT_SYSTEM_CLASS'], $app_strings['ERROR_JS_ALERT_TIMEOUT_TITLE'],'', $app_strings['ERROR_JS_ALERT_TIMEOUT_MSG_1'], (session_cache_expire() - 2) * 60 ); |
|
59 | - $this->addAlert($app_strings['ERROR_JS_ALERT_SYSTEM_CLASS'], $app_strings['ERROR_JS_ALERT_TIMEOUT_TITLE'],'', $app_strings['ERROR_JS_ALERT_TIMEOUT_MSG_2'], (session_cache_expire()) * 60 , 'index.php'); |
|
60 | - } |
|
61 | - } |
|
62 | - function addAlert($type, $name, $subtitle, $description, $countdown, $redirect='') |
|
55 | + $this->addActivities(); |
|
56 | + Reminder::addNotifications($this); |
|
57 | + if(!empty($GLOBALS['sugar_config']['enable_timeout_alerts'])){ |
|
58 | + $this->addAlert($app_strings['ERROR_JS_ALERT_SYSTEM_CLASS'], $app_strings['ERROR_JS_ALERT_TIMEOUT_TITLE'],'', $app_strings['ERROR_JS_ALERT_TIMEOUT_MSG_1'], (session_cache_expire() - 2) * 60 ); |
|
59 | + $this->addAlert($app_strings['ERROR_JS_ALERT_SYSTEM_CLASS'], $app_strings['ERROR_JS_ALERT_TIMEOUT_TITLE'],'', $app_strings['ERROR_JS_ALERT_TIMEOUT_MSG_2'], (session_cache_expire()) * 60 , 'index.php'); |
|
60 | + } |
|
61 | + } |
|
62 | + function addAlert($type, $name, $subtitle, $description, $countdown, $redirect='') |
|
63 | 63 | { |
64 | - $script = 'addAlert(' . json_encode($type) .',' . json_encode($name). ',' . json_encode($subtitle). ','. json_encode(str_replace(array("\r", "\n"), array('','<br>'),$description)) . ',' . $countdown . ','.json_encode($redirect).');' . "\n"; |
|
64 | + $script = 'addAlert(' . json_encode($type) .',' . json_encode($name). ',' . json_encode($subtitle). ','. json_encode(str_replace(array("\r", "\n"), array('','<br>'),$description)) . ',' . $countdown . ','.json_encode($redirect).');' . "\n"; |
|
65 | 65 | $this->script .= $script; |
66 | - } |
|
66 | + } |
|
67 | 67 | |
68 | 68 | function getScript() |
69 | 69 | { |
@@ -87,29 +87,29 @@ discard block |
||
87 | 87 | } |
88 | 88 | |
89 | 89 | function addActivities(){ |
90 | - global $app_list_strings, $timedate, $current_user, $app_strings; |
|
91 | - global $sugar_config; |
|
90 | + global $app_list_strings, $timedate, $current_user, $app_strings; |
|
91 | + global $sugar_config; |
|
92 | 92 | |
93 | - if (empty($current_user->id)) { |
|
93 | + if (empty($current_user->id)) { |
|
94 | 94 | return; |
95 | - } |
|
95 | + } |
|
96 | 96 | |
97 | 97 | //Create separate variable to hold timedate value |
98 | 98 | $alertDateTimeNow = $timedate->nowDb(); |
99 | 99 | |
100 | - // cn: get a boundary limiter |
|
101 | - $dateTimeMax = $timedate->getNow()->modify("+{$app_list_strings['reminder_max_time']} seconds")->asDb(); |
|
102 | - $dateTimeNow = $timedate->nowDb(); |
|
100 | + // cn: get a boundary limiter |
|
101 | + $dateTimeMax = $timedate->getNow()->modify("+{$app_list_strings['reminder_max_time']} seconds")->asDb(); |
|
102 | + $dateTimeNow = $timedate->nowDb(); |
|
103 | 103 | |
104 | - global $db; |
|
105 | - $dateTimeNow = $db->convert($db->quoted($dateTimeNow), 'datetime'); |
|
106 | - $dateTimeMax = $db->convert($db->quoted($dateTimeMax), 'datetime'); |
|
107 | - $desc = $db->convert("description", "text2char"); |
|
108 | - if($desc != "description") { |
|
109 | - $desc .= " description"; |
|
110 | - } |
|
104 | + global $db; |
|
105 | + $dateTimeNow = $db->convert($db->quoted($dateTimeNow), 'datetime'); |
|
106 | + $dateTimeMax = $db->convert($db->quoted($dateTimeMax), 'datetime'); |
|
107 | + $desc = $db->convert("description", "text2char"); |
|
108 | + if($desc != "description") { |
|
109 | + $desc .= " description"; |
|
110 | + } |
|
111 | 111 | |
112 | - // Prep Meetings Query |
|
112 | + // Prep Meetings Query |
|
113 | 113 | $selectMeetings = "SELECT meetings.id, name,reminder_time, $desc,location, status, parent_type, parent_id, date_start, assigned_user_id |
114 | 114 | FROM meetings LEFT JOIN meetings_users ON meetings.id = meetings_users.meeting_id |
115 | 115 | WHERE meetings_users.user_id ='".$current_user->id."' |
@@ -119,61 +119,61 @@ discard block |
||
119 | 119 | AND meetings.status = 'Planned' |
120 | 120 | AND date_start >= $dateTimeNow |
121 | 121 | AND date_start <= $dateTimeMax"; |
122 | - $result = $db->query($selectMeetings); |
|
123 | - |
|
124 | - /////////////////////////////////////////////////////////////////////// |
|
125 | - //// MEETING INTEGRATION |
|
126 | - $meetingIntegration = null; |
|
127 | - if(isset($sugar_config['meeting_integration']) && !empty($sugar_config['meeting_integration'])) { |
|
128 | - if(!class_exists($sugar_config['meeting_integration'])) { |
|
129 | - require_once("modules/{$sugar_config['meeting_integration']}/{$sugar_config['meeting_integration']}.php"); |
|
130 | - } |
|
131 | - $meetingIntegration = new $sugar_config['meeting_integration'](); |
|
132 | - } |
|
133 | - //// END MEETING INTEGRATION |
|
134 | - /////////////////////////////////////////////////////////////////////// |
|
135 | - |
|
136 | - while($row = $db->fetchByAssoc($result)) { |
|
137 | - // need to concatenate since GMT times can bridge two local days |
|
138 | - $timeStart = strtotime($db->fromConvert($row['date_start'], 'datetime')); |
|
139 | - $timeRemind = $row['reminder_time']; |
|
140 | - $timeStart -= $timeRemind; |
|
141 | - |
|
142 | - $url = 'index.php?action=DetailView&module=Meetings&record=' . $row['id']; |
|
143 | - $instructions = $app_strings['MSG_JS_ALERT_MTG_REMINDER_MEETING_MSG']; |
|
144 | - |
|
145 | - /////////////////////////////////////////////////////////////////// |
|
146 | - //// MEETING INTEGRATION |
|
147 | - if(!empty($meetingIntegration) && $meetingIntegration->isIntegratedMeeting($row['id'])) { |
|
148 | - $url = $meetingIntegration->miUrlGetJsAlert($row); |
|
149 | - $instructions = $meetingIntegration->miGetJsAlertInstructions(); |
|
150 | - } |
|
151 | - //// END MEETING INTEGRATION |
|
152 | - /////////////////////////////////////////////////////////////////// |
|
153 | - |
|
154 | - $meetingName = from_html($row['name']); |
|
155 | - $desc1 = from_html($row['description']); |
|
156 | - $location = from_html($row['location']); |
|
122 | + $result = $db->query($selectMeetings); |
|
123 | + |
|
124 | + /////////////////////////////////////////////////////////////////////// |
|
125 | + //// MEETING INTEGRATION |
|
126 | + $meetingIntegration = null; |
|
127 | + if(isset($sugar_config['meeting_integration']) && !empty($sugar_config['meeting_integration'])) { |
|
128 | + if(!class_exists($sugar_config['meeting_integration'])) { |
|
129 | + require_once("modules/{$sugar_config['meeting_integration']}/{$sugar_config['meeting_integration']}.php"); |
|
130 | + } |
|
131 | + $meetingIntegration = new $sugar_config['meeting_integration'](); |
|
132 | + } |
|
133 | + //// END MEETING INTEGRATION |
|
134 | + /////////////////////////////////////////////////////////////////////// |
|
135 | + |
|
136 | + while($row = $db->fetchByAssoc($result)) { |
|
137 | + // need to concatenate since GMT times can bridge two local days |
|
138 | + $timeStart = strtotime($db->fromConvert($row['date_start'], 'datetime')); |
|
139 | + $timeRemind = $row['reminder_time']; |
|
140 | + $timeStart -= $timeRemind; |
|
141 | + |
|
142 | + $url = 'index.php?action=DetailView&module=Meetings&record=' . $row['id']; |
|
143 | + $instructions = $app_strings['MSG_JS_ALERT_MTG_REMINDER_MEETING_MSG']; |
|
144 | + |
|
145 | + /////////////////////////////////////////////////////////////////// |
|
146 | + //// MEETING INTEGRATION |
|
147 | + if(!empty($meetingIntegration) && $meetingIntegration->isIntegratedMeeting($row['id'])) { |
|
148 | + $url = $meetingIntegration->miUrlGetJsAlert($row); |
|
149 | + $instructions = $meetingIntegration->miGetJsAlertInstructions(); |
|
150 | + } |
|
151 | + //// END MEETING INTEGRATION |
|
152 | + /////////////////////////////////////////////////////////////////// |
|
153 | + |
|
154 | + $meetingName = from_html($row['name']); |
|
155 | + $desc1 = from_html($row['description']); |
|
156 | + $location = from_html($row['location']); |
|
157 | 157 | |
158 | 158 | $relatedToMeeting = $this->getRelatedName($row['parent_type'], $row['parent_id']); |
159 | 159 | |
160 | - $description = empty($desc1) ? '' : $app_strings['MSG_JS_ALERT_MTG_REMINDER_AGENDA'].$desc1."\n"; |
|
160 | + $description = empty($desc1) ? '' : $app_strings['MSG_JS_ALERT_MTG_REMINDER_AGENDA'].$desc1."\n"; |
|
161 | 161 | $description = $description ."\n" .$app_strings['MSG_JS_ALERT_MTG_REMINDER_STATUS'] . $row['status'] ."\n". $app_strings['MSG_JS_ALERT_MTG_REMINDER_RELATED_TO']. $relatedToMeeting; |
162 | 162 | |
163 | 163 | |
164 | - // standard functionality |
|
165 | - $this->addAlert($app_strings['MSG_JS_ALERT_MTG_REMINDER_MEETING'], $meetingName, |
|
166 | - $app_strings['MSG_JS_ALERT_MTG_REMINDER_TIME'].$timedate->to_display_date_time($db->fromConvert($row['date_start'], 'datetime')), |
|
167 | - $app_strings['MSG_JS_ALERT_MTG_REMINDER_LOC'].$location. |
|
168 | - $description. |
|
169 | - $instructions, |
|
170 | - $timeStart - strtotime($alertDateTimeNow), |
|
171 | - $url |
|
172 | - ); |
|
173 | - } |
|
164 | + // standard functionality |
|
165 | + $this->addAlert($app_strings['MSG_JS_ALERT_MTG_REMINDER_MEETING'], $meetingName, |
|
166 | + $app_strings['MSG_JS_ALERT_MTG_REMINDER_TIME'].$timedate->to_display_date_time($db->fromConvert($row['date_start'], 'datetime')), |
|
167 | + $app_strings['MSG_JS_ALERT_MTG_REMINDER_LOC'].$location. |
|
168 | + $description. |
|
169 | + $instructions, |
|
170 | + $timeStart - strtotime($alertDateTimeNow), |
|
171 | + $url |
|
172 | + ); |
|
173 | + } |
|
174 | 174 | |
175 | - // Prep Calls Query |
|
176 | - $selectCalls = " |
|
175 | + // Prep Calls Query |
|
176 | + $selectCalls = " |
|
177 | 177 | SELECT calls.id, name, reminder_time, $desc, date_start, status, parent_type, parent_id |
178 | 178 | FROM calls LEFT JOIN calls_users ON calls.id = calls_users.call_id |
179 | 179 | WHERE calls_users.user_id ='".$current_user->id."' |
@@ -184,14 +184,14 @@ discard block |
||
184 | 184 | AND date_start >= $dateTimeNow |
185 | 185 | AND date_start <= $dateTimeMax"; |
186 | 186 | |
187 | - $result = $db->query($selectCalls); |
|
187 | + $result = $db->query($selectCalls); |
|
188 | 188 | |
189 | - while($row = $db->fetchByAssoc($result)){ |
|
190 | - // need to concatenate since GMT times can bridge two local days |
|
191 | - $timeStart = strtotime($db->fromConvert($row['date_start'], 'datetime')); |
|
192 | - $timeRemind = $row['reminder_time']; |
|
193 | - $timeStart -= $timeRemind; |
|
194 | - $row['description'] = (isset($row['description'])) ? $row['description'] : ''; |
|
189 | + while($row = $db->fetchByAssoc($result)){ |
|
190 | + // need to concatenate since GMT times can bridge two local days |
|
191 | + $timeStart = strtotime($db->fromConvert($row['date_start'], 'datetime')); |
|
192 | + $timeRemind = $row['reminder_time']; |
|
193 | + $timeStart -= $timeRemind; |
|
194 | + $row['description'] = (isset($row['description'])) ? $row['description'] : ''; |
|
195 | 195 | |
196 | 196 | $relatedToCall = $this->getRelatedName($row['parent_type'], $row['parent_id']); |
197 | 197 | |
@@ -199,8 +199,8 @@ discard block |
||
199 | 199 | |
200 | 200 | |
201 | 201 | $this->addAlert($app_strings['MSG_JS_ALERT_MTG_REMINDER_CALL'], $row['name'], $app_strings['MSG_JS_ALERT_MTG_REMINDER_TIME'].$timedate->to_display_date_time($db->fromConvert($row['date_start'], 'datetime')) , $app_strings['MSG_JS_ALERT_MTG_REMINDER_DESC'].$callDescription , $timeStart - strtotime($alertDateTimeNow), 'index.php?action=DetailView&module=Calls&record=' . $row['id']); |
202 | - } |
|
203 | - } |
|
202 | + } |
|
203 | + } |
|
204 | 204 | |
205 | 205 | |
206 | 206 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | 3 | /********************************************************************************* |
4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -41,10 +41,10 @@ discard block |
||
41 | 41 | |
42 | 42 | require_once("include/utils/db_utils.php"); |
43 | 43 | |
44 | -class jsAlerts{ |
|
44 | +class jsAlerts { |
|
45 | 45 | var $script; |
46 | 46 | |
47 | - function jsAlerts(){ |
|
47 | + function jsAlerts() { |
|
48 | 48 | global $app_strings; |
49 | 49 | $this->script .= <<<EOQ |
50 | 50 | if (!alertsTimeoutId) { |
@@ -54,20 +54,20 @@ discard block |
||
54 | 54 | EOQ; |
55 | 55 | $this->addActivities(); |
56 | 56 | Reminder::addNotifications($this); |
57 | - if(!empty($GLOBALS['sugar_config']['enable_timeout_alerts'])){ |
|
58 | - $this->addAlert($app_strings['ERROR_JS_ALERT_SYSTEM_CLASS'], $app_strings['ERROR_JS_ALERT_TIMEOUT_TITLE'],'', $app_strings['ERROR_JS_ALERT_TIMEOUT_MSG_1'], (session_cache_expire() - 2) * 60 ); |
|
59 | - $this->addAlert($app_strings['ERROR_JS_ALERT_SYSTEM_CLASS'], $app_strings['ERROR_JS_ALERT_TIMEOUT_TITLE'],'', $app_strings['ERROR_JS_ALERT_TIMEOUT_MSG_2'], (session_cache_expire()) * 60 , 'index.php'); |
|
57 | + if (!empty($GLOBALS['sugar_config']['enable_timeout_alerts'])) { |
|
58 | + $this->addAlert($app_strings['ERROR_JS_ALERT_SYSTEM_CLASS'], $app_strings['ERROR_JS_ALERT_TIMEOUT_TITLE'], '', $app_strings['ERROR_JS_ALERT_TIMEOUT_MSG_1'], (session_cache_expire() - 2) * 60); |
|
59 | + $this->addAlert($app_strings['ERROR_JS_ALERT_SYSTEM_CLASS'], $app_strings['ERROR_JS_ALERT_TIMEOUT_TITLE'], '', $app_strings['ERROR_JS_ALERT_TIMEOUT_MSG_2'], (session_cache_expire()) * 60, 'index.php'); |
|
60 | 60 | } |
61 | 61 | } |
62 | - function addAlert($type, $name, $subtitle, $description, $countdown, $redirect='') |
|
62 | + function addAlert($type, $name, $subtitle, $description, $countdown, $redirect = '') |
|
63 | 63 | { |
64 | - $script = 'addAlert(' . json_encode($type) .',' . json_encode($name). ',' . json_encode($subtitle). ','. json_encode(str_replace(array("\r", "\n"), array('','<br>'),$description)) . ',' . $countdown . ','.json_encode($redirect).');' . "\n"; |
|
64 | + $script = 'addAlert('.json_encode($type).','.json_encode($name).','.json_encode($subtitle).','.json_encode(str_replace(array("\r", "\n"), array('', '<br>'), $description)).','.$countdown.','.json_encode($redirect).');'."\n"; |
|
65 | 65 | $this->script .= $script; |
66 | 66 | } |
67 | 67 | |
68 | 68 | function getScript() |
69 | 69 | { |
70 | - return "<script>secondsSinceLoad = 0; alertList = [];" . $this->script . "</script>"; |
|
70 | + return "<script>secondsSinceLoad = 0; alertList = [];".$this->script."</script>"; |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | /* |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | return ''; |
87 | 87 | } |
88 | 88 | |
89 | - function addActivities(){ |
|
89 | + function addActivities() { |
|
90 | 90 | global $app_list_strings, $timedate, $current_user, $app_strings; |
91 | 91 | global $sugar_config; |
92 | 92 | |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | $dateTimeNow = $db->convert($db->quoted($dateTimeNow), 'datetime'); |
106 | 106 | $dateTimeMax = $db->convert($db->quoted($dateTimeMax), 'datetime'); |
107 | 107 | $desc = $db->convert("description", "text2char"); |
108 | - if($desc != "description") { |
|
108 | + if ($desc != "description") { |
|
109 | 109 | $desc .= " description"; |
110 | 110 | } |
111 | 111 | |
@@ -124,8 +124,8 @@ discard block |
||
124 | 124 | /////////////////////////////////////////////////////////////////////// |
125 | 125 | //// MEETING INTEGRATION |
126 | 126 | $meetingIntegration = null; |
127 | - if(isset($sugar_config['meeting_integration']) && !empty($sugar_config['meeting_integration'])) { |
|
128 | - if(!class_exists($sugar_config['meeting_integration'])) { |
|
127 | + if (isset($sugar_config['meeting_integration']) && !empty($sugar_config['meeting_integration'])) { |
|
128 | + if (!class_exists($sugar_config['meeting_integration'])) { |
|
129 | 129 | require_once("modules/{$sugar_config['meeting_integration']}/{$sugar_config['meeting_integration']}.php"); |
130 | 130 | } |
131 | 131 | $meetingIntegration = new $sugar_config['meeting_integration'](); |
@@ -133,18 +133,18 @@ discard block |
||
133 | 133 | //// END MEETING INTEGRATION |
134 | 134 | /////////////////////////////////////////////////////////////////////// |
135 | 135 | |
136 | - while($row = $db->fetchByAssoc($result)) { |
|
136 | + while ($row = $db->fetchByAssoc($result)) { |
|
137 | 137 | // need to concatenate since GMT times can bridge two local days |
138 | 138 | $timeStart = strtotime($db->fromConvert($row['date_start'], 'datetime')); |
139 | 139 | $timeRemind = $row['reminder_time']; |
140 | 140 | $timeStart -= $timeRemind; |
141 | 141 | |
142 | - $url = 'index.php?action=DetailView&module=Meetings&record=' . $row['id']; |
|
142 | + $url = 'index.php?action=DetailView&module=Meetings&record='.$row['id']; |
|
143 | 143 | $instructions = $app_strings['MSG_JS_ALERT_MTG_REMINDER_MEETING_MSG']; |
144 | 144 | |
145 | 145 | /////////////////////////////////////////////////////////////////// |
146 | 146 | //// MEETING INTEGRATION |
147 | - if(!empty($meetingIntegration) && $meetingIntegration->isIntegratedMeeting($row['id'])) { |
|
147 | + if (!empty($meetingIntegration) && $meetingIntegration->isIntegratedMeeting($row['id'])) { |
|
148 | 148 | $url = $meetingIntegration->miUrlGetJsAlert($row); |
149 | 149 | $instructions = $meetingIntegration->miGetJsAlertInstructions(); |
150 | 150 | } |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | $relatedToMeeting = $this->getRelatedName($row['parent_type'], $row['parent_id']); |
159 | 159 | |
160 | 160 | $description = empty($desc1) ? '' : $app_strings['MSG_JS_ALERT_MTG_REMINDER_AGENDA'].$desc1."\n"; |
161 | - $description = $description ."\n" .$app_strings['MSG_JS_ALERT_MTG_REMINDER_STATUS'] . $row['status'] ."\n". $app_strings['MSG_JS_ALERT_MTG_REMINDER_RELATED_TO']. $relatedToMeeting; |
|
161 | + $description = $description."\n".$app_strings['MSG_JS_ALERT_MTG_REMINDER_STATUS'].$row['status']."\n".$app_strings['MSG_JS_ALERT_MTG_REMINDER_RELATED_TO'].$relatedToMeeting; |
|
162 | 162 | |
163 | 163 | |
164 | 164 | // standard functionality |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | |
187 | 187 | $result = $db->query($selectCalls); |
188 | 188 | |
189 | - while($row = $db->fetchByAssoc($result)){ |
|
189 | + while ($row = $db->fetchByAssoc($result)) { |
|
190 | 190 | // need to concatenate since GMT times can bridge two local days |
191 | 191 | $timeStart = strtotime($db->fromConvert($row['date_start'], 'datetime')); |
192 | 192 | $timeRemind = $row['reminder_time']; |
@@ -195,10 +195,10 @@ discard block |
||
195 | 195 | |
196 | 196 | $relatedToCall = $this->getRelatedName($row['parent_type'], $row['parent_id']); |
197 | 197 | |
198 | - $callDescription = $row['description'] ."\n" .$app_strings['MSG_JS_ALERT_MTG_REMINDER_STATUS'] . $row['status'] ."\n". $app_strings['MSG_JS_ALERT_MTG_REMINDER_RELATED_TO']. $relatedToCall; |
|
198 | + $callDescription = $row['description']."\n".$app_strings['MSG_JS_ALERT_MTG_REMINDER_STATUS'].$row['status']."\n".$app_strings['MSG_JS_ALERT_MTG_REMINDER_RELATED_TO'].$relatedToCall; |
|
199 | 199 | |
200 | 200 | |
201 | - $this->addAlert($app_strings['MSG_JS_ALERT_MTG_REMINDER_CALL'], $row['name'], $app_strings['MSG_JS_ALERT_MTG_REMINDER_TIME'].$timedate->to_display_date_time($db->fromConvert($row['date_start'], 'datetime')) , $app_strings['MSG_JS_ALERT_MTG_REMINDER_DESC'].$callDescription , $timeStart - strtotime($alertDateTimeNow), 'index.php?action=DetailView&module=Calls&record=' . $row['id']); |
|
201 | + $this->addAlert($app_strings['MSG_JS_ALERT_MTG_REMINDER_CALL'], $row['name'], $app_strings['MSG_JS_ALERT_MTG_REMINDER_TIME'].$timedate->to_display_date_time($db->fromConvert($row['date_start'], 'datetime')), $app_strings['MSG_JS_ALERT_MTG_REMINDER_DESC'].$callDescription, $timeStart - strtotime($alertDateTimeNow), 'index.php?action=DetailView&module=Calls&record='.$row['id']); |
|
202 | 202 | } |
203 | 203 | } |
204 | 204 |
@@ -1,5 +1,7 @@ |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if(!defined('sugarEntry') || !sugarEntry) { |
|
3 | + die('Not A Valid Entry Point'); |
|
4 | +} |
|
3 | 5 | /********************************************************************************* |
4 | 6 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 7 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -42,13 +42,13 @@ discard block |
||
42 | 42 | |
43 | 43 | $yui_path = array( |
44 | 44 | "2.9.0" => "include/javascript/yui", |
45 | - "2_9_0" => "include/javascript/yui", |
|
46 | - "3.3.0" => "include/javascript/yui3", |
|
47 | - "3_3_0" => "include/javascript/yui3" |
|
45 | + "2_9_0" => "include/javascript/yui", |
|
46 | + "3.3.0" => "include/javascript/yui3", |
|
47 | + "3_3_0" => "include/javascript/yui3" |
|
48 | 48 | ); |
49 | 49 | $types = array( |
50 | 50 | "js" => "application/javascript", |
51 | - "css" => "text/css", |
|
51 | + "css" => "text/css", |
|
52 | 52 | ); |
53 | 53 | $out = ""; |
54 | 54 | |
@@ -57,36 +57,36 @@ discard block |
||
57 | 57 | |
58 | 58 | foreach ($_REQUEST as $param => $val) |
59 | 59 | { |
60 | - //No backtracking in the path |
|
61 | - if (strpos($param, "..") !== false) |
|
60 | + //No backtracking in the path |
|
61 | + if (strpos($param, "..") !== false) |
|
62 | 62 | continue; |
63 | 63 | |
64 | - $version = explode("/", $param); |
|
65 | - $version = $version[0]; |
|
64 | + $version = explode("/", $param); |
|
65 | + $version = $version[0]; |
|
66 | 66 | if (empty($yui_path[$version])) continue; |
67 | 67 | |
68 | 68 | $path = $yui_path[$version] . substr($param, strlen($version)); |
69 | 69 | |
70 | - $extension = substr($path, strrpos($path, "_") + 1); |
|
70 | + $extension = substr($path, strrpos($path, "_") + 1); |
|
71 | 71 | |
72 | - //Only allowed file extensions |
|
73 | - if (empty($types[$extension])) |
|
74 | - continue; |
|
72 | + //Only allowed file extensions |
|
73 | + if (empty($types[$extension])) |
|
74 | + continue; |
|
75 | 75 | |
76 | - if (empty($contentType)) |
|
76 | + if (empty($contentType)) |
|
77 | 77 | { |
78 | 78 | $contentType = $types[$extension]; |
79 | 79 | } |
80 | - //Put together the final filepath |
|
81 | - $path = substr($path, 0, strrpos($path, "_")) . "." . $extension; |
|
82 | - $contents = ''; |
|
83 | - if (is_file($path)) { |
|
84 | - $out .= "/*" . $path . "*/\n"; |
|
85 | - $contents = file_get_contents($path); |
|
86 | - $out .= $contents . "\n"; |
|
87 | - } |
|
88 | - $path = empty($contents) ? $path : $contents; |
|
89 | - $allpath .= md5($path); |
|
80 | + //Put together the final filepath |
|
81 | + $path = substr($path, 0, strrpos($path, "_")) . "." . $extension; |
|
82 | + $contents = ''; |
|
83 | + if (is_file($path)) { |
|
84 | + $out .= "/*" . $path . "*/\n"; |
|
85 | + $contents = file_get_contents($path); |
|
86 | + $out .= $contents . "\n"; |
|
87 | + } |
|
88 | + $path = empty($contents) ? $path : $contents; |
|
89 | + $allpath .= md5($path); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | $etag = '"'.md5($allpath).'"'; |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | 3 | /********************************************************************************* |
4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | $version = $version[0]; |
66 | 66 | if (empty($yui_path[$version])) continue; |
67 | 67 | |
68 | - $path = $yui_path[$version] . substr($param, strlen($version)); |
|
68 | + $path = $yui_path[$version].substr($param, strlen($version)); |
|
69 | 69 | |
70 | 70 | $extension = substr($path, strrpos($path, "_") + 1); |
71 | 71 | |
@@ -78,12 +78,12 @@ discard block |
||
78 | 78 | $contentType = $types[$extension]; |
79 | 79 | } |
80 | 80 | //Put together the final filepath |
81 | - $path = substr($path, 0, strrpos($path, "_")) . "." . $extension; |
|
81 | + $path = substr($path, 0, strrpos($path, "_")).".".$extension; |
|
82 | 82 | $contents = ''; |
83 | 83 | if (is_file($path)) { |
84 | - $out .= "/*" . $path . "*/\n"; |
|
85 | - $contents = file_get_contents($path); |
|
86 | - $out .= $contents . "\n"; |
|
84 | + $out .= "/*".$path."*/\n"; |
|
85 | + $contents = file_get_contents($path); |
|
86 | + $out .= $contents."\n"; |
|
87 | 87 | } |
88 | 88 | $path = empty($contents) ? $path : $contents; |
89 | 89 | $allpath .= md5($path); |
@@ -95,6 +95,6 @@ discard block |
||
95 | 95 | header("Cache-Control: private"); |
96 | 96 | header("Pragma: dummy=bogus"); |
97 | 97 | header("Etag: $etag"); |
98 | -header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + 2592000)); |
|
98 | +header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + 2592000)); |
|
99 | 99 | header("Content-Type: $contentType"); |
100 | 100 | echo ($out); |
101 | 101 | \ No newline at end of file |
@@ -1,5 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if(!defined('sugarEntry') || !sugarEntry) { |
|
3 | + die('Not A Valid Entry Point'); |
|
4 | +} |
|
3 | 5 | /********************************************************************************* |
4 | 6 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 7 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -38,7 +40,9 @@ discard block |
||
38 | 40 | * display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM". |
39 | 41 | ********************************************************************************/ |
40 | 42 | |
41 | -if (empty($_REQUEST)) die(); |
|
43 | +if (empty($_REQUEST)) { |
|
44 | + die(); |
|
45 | +} |
|
42 | 46 | |
43 | 47 | $yui_path = array( |
44 | 48 | "2.9.0" => "include/javascript/yui", |
@@ -58,20 +62,24 @@ discard block |
||
58 | 62 | foreach ($_REQUEST as $param => $val) |
59 | 63 | { |
60 | 64 | //No backtracking in the path |
61 | - if (strpos($param, "..") !== false) |
|
62 | - continue; |
|
65 | + if (strpos($param, "..") !== false) { |
|
66 | + continue; |
|
67 | + } |
|
63 | 68 | |
64 | 69 | $version = explode("/", $param); |
65 | 70 | $version = $version[0]; |
66 | - if (empty($yui_path[$version])) continue; |
|
71 | + if (empty($yui_path[$version])) { |
|
72 | + continue; |
|
73 | + } |
|
67 | 74 | |
68 | 75 | $path = $yui_path[$version] . substr($param, strlen($version)); |
69 | 76 | |
70 | 77 | $extension = substr($path, strrpos($path, "_") + 1); |
71 | 78 | |
72 | 79 | //Only allowed file extensions |
73 | - if (empty($types[$extension])) |
|
74 | - continue; |
|
80 | + if (empty($types[$extension])) { |
|
81 | + continue; |
|
82 | + } |
|
75 | 83 | |
76 | 84 | if (empty($contentType)) |
77 | 85 | { |