@@ -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 |
@@ -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 | } |
@@ -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).'"'; |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | */ |
| 140 | 140 | public function setRefreshIcon() |
| 141 | 141 | { |
| 142 | - $additionalTitle = ''; |
|
| 142 | + $additionalTitle = ''; |
|
| 143 | 143 | if($this->isRefreshable) |
| 144 | 144 | |
| 145 | 145 | $additionalTitle .= '<a href="#" onclick="SUGAR.mySugar.retrieveDashlet(\'' |
@@ -165,9 +165,9 @@ discard block |
||
| 165 | 165 | public function displayScript() |
| 166 | 166 | { |
| 167 | 167 | |
| 168 | - require_once('include/SugarCharts/SugarChartFactory.php'); |
|
| 169 | - $sugarChart = SugarChartFactory::getInstance(); |
|
| 170 | - return $sugarChart->getDashletScript($this->id); |
|
| 168 | + require_once('include/SugarCharts/SugarChartFactory.php'); |
|
| 169 | + $sugarChart = SugarChartFactory::getInstance(); |
|
| 170 | + return $sugarChart->getDashletScript($this->id); |
|
| 171 | 171 | |
| 172 | 172 | } |
| 173 | 173 | |
@@ -272,11 +272,11 @@ discard block |
||
| 272 | 272 | $this->getConfigureSmartyInstance()->assign('showClearButton', $this->isConfigPanelClearShown); |
| 273 | 273 | |
| 274 | 274 | if($this->isAutoRefreshable()) { |
| 275 | - $this->getConfigureSmartyInstance()->assign('isRefreshable', true); |
|
| 276 | - $this->getConfigureSmartyInstance()->assign('autoRefresh', $GLOBALS['app_strings']['LBL_DASHLET_CONFIGURE_AUTOREFRESH']); |
|
| 277 | - $this->getConfigureSmartyInstance()->assign('autoRefreshOptions', $this->getAutoRefreshOptions()); |
|
| 278 | - $this->getConfigureSmartyInstance()->assign('autoRefreshSelect', $this->autoRefresh); |
|
| 279 | - } |
|
| 275 | + $this->getConfigureSmartyInstance()->assign('isRefreshable', true); |
|
| 276 | + $this->getConfigureSmartyInstance()->assign('autoRefresh', $GLOBALS['app_strings']['LBL_DASHLET_CONFIGURE_AUTOREFRESH']); |
|
| 277 | + $this->getConfigureSmartyInstance()->assign('autoRefreshOptions', $this->getAutoRefreshOptions()); |
|
| 278 | + $this->getConfigureSmartyInstance()->assign('autoRefreshSelect', $this->autoRefresh); |
|
| 279 | + } |
|
| 280 | 280 | |
| 281 | 281 | return parent::displayOptions() . $this->getConfigureSmartyInstance()->fetch($this->_configureTpl); |
| 282 | 282 | } |
@@ -339,7 +339,7 @@ discard block |
||
| 339 | 339 | $dashletOffset = 0; |
| 340 | 340 | $module = $_REQUEST['module']; |
| 341 | 341 | if(isset($_REQUEST[$module.'2_'.strtoupper($this->getSeedBean()->object_name).'_offset'])) { |
| 342 | - $dashletOffset = $_REQUEST[$module.'2_'.strtoupper($this->getSeedBean()->object_name).'_offset']; |
|
| 342 | + $dashletOffset = $_REQUEST[$module.'2_'.strtoupper($this->getSeedBean()->object_name).'_offset']; |
|
| 343 | 343 | } |
| 344 | 344 | } |
| 345 | 345 | |
@@ -43,79 +43,79 @@ |
||
| 43 | 43 | * Created: Sep 12, 2011 |
| 44 | 44 | */ |
| 45 | 45 | class DashletRssFeedTitle { |
| 46 | - public $defaultEncoding = "UTF-8"; |
|
| 47 | - public $readBytes = 8192; |
|
| 48 | - public $url; |
|
| 49 | - public $cut = 70; |
|
| 50 | - public $contents = ""; |
|
| 51 | - public $title = ""; |
|
| 52 | - public $endWith = "..."; |
|
| 53 | - public $xmlEncoding = false; |
|
| 54 | - public $fileOpen = false; |
|
| 46 | + public $defaultEncoding = "UTF-8"; |
|
| 47 | + public $readBytes = 8192; |
|
| 48 | + public $url; |
|
| 49 | + public $cut = 70; |
|
| 50 | + public $contents = ""; |
|
| 51 | + public $title = ""; |
|
| 52 | + public $endWith = "..."; |
|
| 53 | + public $xmlEncoding = false; |
|
| 54 | + public $fileOpen = false; |
|
| 55 | 55 | |
| 56 | - public function __construct($url) { |
|
| 57 | - $this->url = $url; |
|
| 58 | - } |
|
| 56 | + public function __construct($url) { |
|
| 57 | + $this->url = $url; |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | - public function generateTitle() { |
|
| 61 | - if ($this->readFeed()) { |
|
| 62 | - $this->getTitle(); |
|
| 63 | - if (!empty($this->title)) { |
|
| 64 | - $this->convertEncoding(); |
|
| 65 | - $this->cutLength(); |
|
| 66 | - } |
|
| 67 | - } |
|
| 68 | - return $this->title; |
|
| 69 | - } |
|
| 60 | + public function generateTitle() { |
|
| 61 | + if ($this->readFeed()) { |
|
| 62 | + $this->getTitle(); |
|
| 63 | + if (!empty($this->title)) { |
|
| 64 | + $this->convertEncoding(); |
|
| 65 | + $this->cutLength(); |
|
| 66 | + } |
|
| 67 | + } |
|
| 68 | + return $this->title; |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | - /** |
|
| 72 | - * @todo use curl with waiting timeout instead of fopen |
|
| 73 | - */ |
|
| 74 | - public function readFeed() { |
|
| 75 | - if ($this->url) { |
|
| 71 | + /** |
|
| 72 | + * @todo use curl with waiting timeout instead of fopen |
|
| 73 | + */ |
|
| 74 | + public function readFeed() { |
|
| 75 | + if ($this->url) { |
|
| 76 | 76 | if (!in_array(strtolower(parse_url($this->url, PHP_URL_SCHEME)), array("http", "https"), true)) { |
| 77 | 77 | return false; |
| 78 | 78 | } |
| 79 | - $fileOpen = @fopen($this->url, 'r'); |
|
| 80 | - if ($fileOpen) { |
|
| 81 | - $this->fileOpen = true; |
|
| 82 | - $this->contents = fread($fileOpen, $this->readBytes); |
|
| 83 | - fclose($fileOpen); |
|
| 84 | - return true; |
|
| 85 | - } |
|
| 86 | - } |
|
| 87 | - return false; |
|
| 88 | - } |
|
| 79 | + $fileOpen = @fopen($this->url, 'r'); |
|
| 80 | + if ($fileOpen) { |
|
| 81 | + $this->fileOpen = true; |
|
| 82 | + $this->contents = fread($fileOpen, $this->readBytes); |
|
| 83 | + fclose($fileOpen); |
|
| 84 | + return true; |
|
| 85 | + } |
|
| 86 | + } |
|
| 87 | + return false; |
|
| 88 | + } |
|
| 89 | 89 | |
| 90 | - /** |
|
| 91 | - * |
|
| 92 | - */ |
|
| 93 | - public function getTitle() { |
|
| 94 | - $matches = array (); |
|
| 95 | - preg_match("/<title>.*?<\/title>/i", $this->contents, $matches); |
|
| 96 | - if (isset($matches[0])) { |
|
| 97 | - $this->title = str_replace(array('<![CDATA[', '<title>', '</title>', ']]>'), '', $matches[0]); |
|
| 98 | - } |
|
| 99 | - } |
|
| 90 | + /** |
|
| 91 | + * |
|
| 92 | + */ |
|
| 93 | + public function getTitle() { |
|
| 94 | + $matches = array (); |
|
| 95 | + preg_match("/<title>.*?<\/title>/i", $this->contents, $matches); |
|
| 96 | + if (isset($matches[0])) { |
|
| 97 | + $this->title = str_replace(array('<![CDATA[', '<title>', '</title>', ']]>'), '', $matches[0]); |
|
| 98 | + } |
|
| 99 | + } |
|
| 100 | 100 | |
| 101 | - public function cutLength() { |
|
| 102 | - if (mb_strlen(trim($this->title), $this->defaultEncoding) > $this->cut) { |
|
| 103 | - $this->title = mb_substr($this->title, 0, $this->cut, $this->defaultEncoding) . $this->endWith; |
|
| 104 | - } |
|
| 105 | - } |
|
| 101 | + public function cutLength() { |
|
| 102 | + if (mb_strlen(trim($this->title), $this->defaultEncoding) > $this->cut) { |
|
| 103 | + $this->title = mb_substr($this->title, 0, $this->cut, $this->defaultEncoding) . $this->endWith; |
|
| 104 | + } |
|
| 105 | + } |
|
| 106 | 106 | |
| 107 | - private function _identifyXmlEncoding() { |
|
| 108 | - $matches = array (); |
|
| 109 | - preg_match('/encoding\=*\".*?\"/', $this->contents, $matches); |
|
| 110 | - if (isset($matches[0])) { |
|
| 111 | - $this->xmlEncoding = trim(str_replace('encoding="', '"', $matches[0]), '"'); |
|
| 112 | - } |
|
| 113 | - } |
|
| 107 | + private function _identifyXmlEncoding() { |
|
| 108 | + $matches = array (); |
|
| 109 | + preg_match('/encoding\=*\".*?\"/', $this->contents, $matches); |
|
| 110 | + if (isset($matches[0])) { |
|
| 111 | + $this->xmlEncoding = trim(str_replace('encoding="', '"', $matches[0]), '"'); |
|
| 112 | + } |
|
| 113 | + } |
|
| 114 | 114 | |
| 115 | - public function convertEncoding() { |
|
| 116 | - $this->_identifyXmlEncoding(); |
|
| 117 | - if ($this->xmlEncoding && $this->xmlEncoding != $this->defaultEncoding) { |
|
| 118 | - $this->title = iconv($this->xmlEncoding, $this->defaultEncoding, $this->title); |
|
| 119 | - } |
|
| 120 | - } |
|
| 115 | + public function convertEncoding() { |
|
| 116 | + $this->_identifyXmlEncoding(); |
|
| 117 | + if ($this->xmlEncoding && $this->xmlEncoding != $this->defaultEncoding) { |
|
| 118 | + $this->title = iconv($this->xmlEncoding, $this->defaultEncoding, $this->title); |
|
| 119 | + } |
|
| 120 | + } |
|
| 121 | 121 | } |
@@ -48,116 +48,116 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | class SugarPHPMailer extends PHPMailer |
| 50 | 50 | { |
| 51 | - var $oe; // OutboundEmail |
|
| 52 | - var $protocol = "tcp://"; |
|
| 53 | - var $preppedForOutbound = false; |
|
| 54 | - var $disclosureEnabled; |
|
| 55 | - var $disclosureText; |
|
| 56 | - var $isHostEmpty = false; |
|
| 57 | - var $opensslOpened = true; |
|
| 58 | - |
|
| 59 | - /** |
|
| 60 | - * Sole constructor |
|
| 61 | - */ |
|
| 62 | - function SugarPHPMailer() { |
|
| 63 | - global $locale; |
|
| 64 | - global $current_user; |
|
| 65 | - global $sugar_config; |
|
| 66 | - |
|
| 67 | - $admin = new Administration(); |
|
| 68 | - $admin->retrieveSettings(); |
|
| 69 | - |
|
| 70 | - if(isset($admin->settings['disclosure_enable']) && !empty($admin->settings['disclosure_enable'])) { |
|
| 71 | - $this->disclosureEnabled = true; |
|
| 72 | - $this->disclosureText = $admin->settings['disclosure_text']; |
|
| 73 | - } |
|
| 74 | - |
|
| 75 | - $this->oe = new OutboundEmail(); |
|
| 76 | - $this->oe->getUserMailerSettings($current_user); |
|
| 77 | - |
|
| 78 | - $this->SetLanguage('en', 'include/phpmailer/language/'); |
|
| 79 | - $this->PluginDir = 'include/phpmailer/'; |
|
| 80 | - $this->Mailer = 'smtp'; |
|
| 51 | + var $oe; // OutboundEmail |
|
| 52 | + var $protocol = "tcp://"; |
|
| 53 | + var $preppedForOutbound = false; |
|
| 54 | + var $disclosureEnabled; |
|
| 55 | + var $disclosureText; |
|
| 56 | + var $isHostEmpty = false; |
|
| 57 | + var $opensslOpened = true; |
|
| 58 | + |
|
| 59 | + /** |
|
| 60 | + * Sole constructor |
|
| 61 | + */ |
|
| 62 | + function SugarPHPMailer() { |
|
| 63 | + global $locale; |
|
| 64 | + global $current_user; |
|
| 65 | + global $sugar_config; |
|
| 66 | + |
|
| 67 | + $admin = new Administration(); |
|
| 68 | + $admin->retrieveSettings(); |
|
| 69 | + |
|
| 70 | + if(isset($admin->settings['disclosure_enable']) && !empty($admin->settings['disclosure_enable'])) { |
|
| 71 | + $this->disclosureEnabled = true; |
|
| 72 | + $this->disclosureText = $admin->settings['disclosure_text']; |
|
| 73 | + } |
|
| 74 | + |
|
| 75 | + $this->oe = new OutboundEmail(); |
|
| 76 | + $this->oe->getUserMailerSettings($current_user); |
|
| 77 | + |
|
| 78 | + $this->SetLanguage('en', 'include/phpmailer/language/'); |
|
| 79 | + $this->PluginDir = 'include/phpmailer/'; |
|
| 80 | + $this->Mailer = 'smtp'; |
|
| 81 | 81 | // cn: i18n |
| 82 | 82 | $this->CharSet = $locale->getPrecedentPreference('default_email_charset'); |
| 83 | - $this->Encoding = 'quoted-printable'; |
|
| 83 | + $this->Encoding = 'quoted-printable'; |
|
| 84 | 84 | $this->IsHTML(false); // default to plain-text email |
| 85 | 85 | $this->Hostname = $sugar_config['host_name']; |
| 86 | 86 | $this->WordWrap = 996; |
| 87 | - // cn: gmail fix |
|
| 88 | - $this->protocol = ($this->oe->mail_smtpssl == 1) ? "ssl://" : $this->protocol; |
|
| 87 | + // cn: gmail fix |
|
| 88 | + $this->protocol = ($this->oe->mail_smtpssl == 1) ? "ssl://" : $this->protocol; |
|
| 89 | 89 | |
| 90 | - } |
|
| 90 | + } |
|
| 91 | 91 | |
| 92 | 92 | |
| 93 | - /** |
|
| 94 | - * Prefills outbound details |
|
| 95 | - */ |
|
| 96 | - function setMailer() { |
|
| 97 | - global $current_user; |
|
| 93 | + /** |
|
| 94 | + * Prefills outbound details |
|
| 95 | + */ |
|
| 96 | + function setMailer() { |
|
| 97 | + global $current_user; |
|
| 98 | 98 | |
| 99 | - require_once("include/OutboundEmail/OutboundEmail.php"); |
|
| 100 | - $oe = new OutboundEmail(); |
|
| 101 | - $oe = $oe->getUserMailerSettings($current_user); |
|
| 99 | + require_once("include/OutboundEmail/OutboundEmail.php"); |
|
| 100 | + $oe = new OutboundEmail(); |
|
| 101 | + $oe = $oe->getUserMailerSettings($current_user); |
|
| 102 | 102 | |
| 103 | - // ssl or tcp - keeping outside isSMTP b/c a default may inadvertently set ssl:// |
|
| 104 | - $this->protocol = ($oe->mail_smtpssl) ? "ssl://" : "tcp://"; |
|
| 103 | + // ssl or tcp - keeping outside isSMTP b/c a default may inadvertently set ssl:// |
|
| 104 | + $this->protocol = ($oe->mail_smtpssl) ? "ssl://" : "tcp://"; |
|
| 105 | 105 | |
| 106 | - if($oe->mail_sendtype == "SMTP") |
|
| 107 | - { |
|
| 108 | - //Set mail send type information |
|
| 109 | - $this->Mailer = "smtp"; |
|
| 110 | - $this->Host = $oe->mail_smtpserver; |
|
| 111 | - $this->Port = $oe->mail_smtpport; |
|
| 106 | + if($oe->mail_sendtype == "SMTP") |
|
| 107 | + { |
|
| 108 | + //Set mail send type information |
|
| 109 | + $this->Mailer = "smtp"; |
|
| 110 | + $this->Host = $oe->mail_smtpserver; |
|
| 111 | + $this->Port = $oe->mail_smtpport; |
|
| 112 | 112 | if ($oe->mail_smtpssl == 1) { |
| 113 | - $this->SMTPSecure = 'ssl'; |
|
| 113 | + $this->SMTPSecure = 'ssl'; |
|
| 114 | 114 | } // if |
| 115 | 115 | if ($oe->mail_smtpssl == 2) { |
| 116 | - $this->SMTPSecure = 'tls'; |
|
| 116 | + $this->SMTPSecure = 'tls'; |
|
| 117 | 117 | } // if |
| 118 | 118 | |
| 119 | - if($oe->mail_smtpauth_req) { |
|
| 120 | - $this->SMTPAuth = TRUE; |
|
| 121 | - $this->Username = $oe->mail_smtpuser; |
|
| 122 | - $this->Password = $oe->mail_smtppass; |
|
| 123 | - } |
|
| 124 | - } |
|
| 125 | - else |
|
| 126 | - $this->Mailer = "sendmail"; |
|
| 127 | - } |
|
| 128 | - |
|
| 129 | - /** |
|
| 130 | - * Prefills mailer for system |
|
| 131 | - */ |
|
| 132 | - function setMailerForSystem() { |
|
| 133 | - require_once("include/OutboundEmail/OutboundEmail.php"); |
|
| 134 | - $oe = new OutboundEmail(); |
|
| 135 | - $oe = $oe->getSystemMailerSettings(); |
|
| 136 | - |
|
| 137 | - // ssl or tcp - keeping outside isSMTP b/c a default may inadvertantly set ssl:// |
|
| 138 | - $this->protocol = ($oe->mail_smtpssl) ? "ssl://" : "tcp://"; |
|
| 139 | - |
|
| 140 | - if($oe->mail_sendtype == "SMTP") |
|
| 141 | - { |
|
| 142 | - //Set mail send type information |
|
| 143 | - $this->Mailer = "smtp"; |
|
| 144 | - $this->Host = $oe->mail_smtpserver; |
|
| 145 | - $this->Port = $oe->mail_smtpport; |
|
| 119 | + if($oe->mail_smtpauth_req) { |
|
| 120 | + $this->SMTPAuth = TRUE; |
|
| 121 | + $this->Username = $oe->mail_smtpuser; |
|
| 122 | + $this->Password = $oe->mail_smtppass; |
|
| 123 | + } |
|
| 124 | + } |
|
| 125 | + else |
|
| 126 | + $this->Mailer = "sendmail"; |
|
| 127 | + } |
|
| 128 | + |
|
| 129 | + /** |
|
| 130 | + * Prefills mailer for system |
|
| 131 | + */ |
|
| 132 | + function setMailerForSystem() { |
|
| 133 | + require_once("include/OutboundEmail/OutboundEmail.php"); |
|
| 134 | + $oe = new OutboundEmail(); |
|
| 135 | + $oe = $oe->getSystemMailerSettings(); |
|
| 136 | + |
|
| 137 | + // ssl or tcp - keeping outside isSMTP b/c a default may inadvertantly set ssl:// |
|
| 138 | + $this->protocol = ($oe->mail_smtpssl) ? "ssl://" : "tcp://"; |
|
| 139 | + |
|
| 140 | + if($oe->mail_sendtype == "SMTP") |
|
| 141 | + { |
|
| 142 | + //Set mail send type information |
|
| 143 | + $this->Mailer = "smtp"; |
|
| 144 | + $this->Host = $oe->mail_smtpserver; |
|
| 145 | + $this->Port = $oe->mail_smtpport; |
|
| 146 | 146 | if ($oe->mail_smtpssl == 1) { |
| 147 | 147 | $this->SMTPSecure = 'ssl'; |
| 148 | 148 | } // if |
| 149 | 149 | if ($oe->mail_smtpssl == 2) { |
| 150 | - $this->SMTPSecure = 'tls'; |
|
| 150 | + $this->SMTPSecure = 'tls'; |
|
| 151 | 151 | } // if |
| 152 | - if($oe->mail_smtpauth_req) { |
|
| 153 | - $this->SMTPAuth = TRUE; |
|
| 154 | - $this->Username = $oe->mail_smtpuser; |
|
| 155 | - $this->Password = $oe->mail_smtppass; |
|
| 156 | - } |
|
| 157 | - } |
|
| 158 | - else |
|
| 159 | - $this->Mailer = "sendmail"; |
|
| 160 | - } |
|
| 152 | + if($oe->mail_smtpauth_req) { |
|
| 153 | + $this->SMTPAuth = TRUE; |
|
| 154 | + $this->Username = $oe->mail_smtpuser; |
|
| 155 | + $this->Password = $oe->mail_smtppass; |
|
| 156 | + } |
|
| 157 | + } |
|
| 158 | + else |
|
| 159 | + $this->Mailer = "sendmail"; |
|
| 160 | + } |
|
| 161 | 161 | |
| 162 | 162 | /** |
| 163 | 163 | * Attaches all fs, string, and binary attachments to the message. |
@@ -216,38 +216,38 @@ discard block |
||
| 216 | 216 | return join("", $mime); |
| 217 | 217 | }*/ |
| 218 | 218 | |
| 219 | - /** |
|
| 220 | - * handles Charset translation for all visual parts of the email. |
|
| 221 | - * @param string charset Default = '' |
|
| 222 | - */ |
|
| 223 | - function prepForOutbound() { |
|
| 224 | - global $locale; |
|
| 225 | - |
|
| 226 | - if($this->preppedForOutbound == false) { |
|
| 227 | - //bug 28534. We should not set it to true to circumvent the following conversion as each email is independent. |
|
| 228 | - //$this->preppedForOutbound = true; // flag so we don't redo this |
|
| 229 | - $OBCharset = $locale->getPrecedentPreference('default_email_charset'); |
|
| 230 | - |
|
| 231 | - // handle disclosure |
|
| 232 | - if($this->disclosureEnabled) { |
|
| 233 | - $this->Body .= "<br /> <br />{$this->disclosureText}"; |
|
| 234 | - $this->AltBody .= "\r\r{$this->disclosureText}"; |
|
| 235 | - } |
|
| 219 | + /** |
|
| 220 | + * handles Charset translation for all visual parts of the email. |
|
| 221 | + * @param string charset Default = '' |
|
| 222 | + */ |
|
| 223 | + function prepForOutbound() { |
|
| 224 | + global $locale; |
|
| 225 | + |
|
| 226 | + if($this->preppedForOutbound == false) { |
|
| 227 | + //bug 28534. We should not set it to true to circumvent the following conversion as each email is independent. |
|
| 228 | + //$this->preppedForOutbound = true; // flag so we don't redo this |
|
| 229 | + $OBCharset = $locale->getPrecedentPreference('default_email_charset'); |
|
| 230 | + |
|
| 231 | + // handle disclosure |
|
| 232 | + if($this->disclosureEnabled) { |
|
| 233 | + $this->Body .= "<br /> <br />{$this->disclosureText}"; |
|
| 234 | + $this->AltBody .= "\r\r{$this->disclosureText}"; |
|
| 235 | + } |
|
| 236 | 236 | |
| 237 | - // body text |
|
| 238 | - $this->Body = from_html($locale->translateCharset(trim($this->Body), 'UTF-8', $OBCharset)); |
|
| 239 | - $this->AltBody = from_html($locale->translateCharset(trim($this->AltBody), 'UTF-8', $OBCharset)); |
|
| 237 | + // body text |
|
| 238 | + $this->Body = from_html($locale->translateCharset(trim($this->Body), 'UTF-8', $OBCharset)); |
|
| 239 | + $this->AltBody = from_html($locale->translateCharset(trim($this->AltBody), 'UTF-8', $OBCharset)); |
|
| 240 | 240 | $subjectUTF8 = from_html(trim($this->Subject)); |
| 241 | 241 | $subject = $locale->translateCharset($subjectUTF8, 'UTF-8', $OBCharset); |
| 242 | 242 | $this->Subject = $locale->translateCharset($subjectUTF8, 'UTF-8', $OBCharset); |
| 243 | 243 | |
| 244 | - // HTML email RFC compliance |
|
| 245 | - if($this->ContentType == "text/html") { |
|
| 246 | - if(strpos($this->Body, '<html') === false) { |
|
| 244 | + // HTML email RFC compliance |
|
| 245 | + if($this->ContentType == "text/html") { |
|
| 246 | + if(strpos($this->Body, '<html') === false) { |
|
| 247 | 247 | |
| 248 | 248 | $langHeader = get_language_header(); |
| 249 | 249 | |
| 250 | - $head=<<<eoq |
|
| 250 | + $head=<<<eoq |
|
| 251 | 251 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 252 | 252 | <html xmlns="http://www.w3.org/1999/xhtml" {$langHeader}> |
| 253 | 253 | <head> |
@@ -256,15 +256,15 @@ discard block |
||
| 256 | 256 | </head> |
| 257 | 257 | <body> |
| 258 | 258 | eoq; |
| 259 | - $this->Body = $head.$this->Body."</body></html>"; |
|
| 260 | - } |
|
| 261 | - } |
|
| 259 | + $this->Body = $head.$this->Body."</body></html>"; |
|
| 260 | + } |
|
| 261 | + } |
|
| 262 | 262 | |
| 263 | - // Headers ///////////////////////////////// |
|
| 264 | - // the below is done in PHPMailer::CreateHeader(); |
|
| 265 | - //$this->Subject = $locale->translateCharsetMIME(trim($this->Subject), 'UTF-8', $locale->getPrecedentPreference('default_email_charset')); |
|
| 266 | - $this->FromName = $locale->translateCharset(trim($this->FromName), 'UTF-8', $OBCharset); |
|
| 267 | - /* |
|
| 263 | + // Headers ///////////////////////////////// |
|
| 264 | + // the below is done in PHPMailer::CreateHeader(); |
|
| 265 | + //$this->Subject = $locale->translateCharsetMIME(trim($this->Subject), 'UTF-8', $locale->getPrecedentPreference('default_email_charset')); |
|
| 266 | + $this->FromName = $locale->translateCharset(trim($this->FromName), 'UTF-8', $OBCharset); |
|
| 267 | + /* |
|
| 268 | 268 | foreach($this->ReplyTo as $k => $v) { |
| 269 | 269 | $this->ReplyTo[$k][1] = $locale->translateCharset(trim($v[1]), 'UTF-8', $OBCharset); |
| 270 | 270 | } |
@@ -282,129 +282,129 @@ discard block |
||
| 282 | 282 | } |
| 283 | 283 | */ |
| 284 | 284 | |
| 285 | - } |
|
| 286 | - } |
|
| 287 | - |
|
| 288 | - /** |
|
| 289 | - * Replace images with locations specified by regex with cid: images |
|
| 290 | - * and attach needed files |
|
| 291 | - * @param string $regex Regular expression |
|
| 292 | - * @param string $local_prefix Prefix where local files are stored |
|
| 293 | - * @param bool $object Use attachment object |
|
| 294 | - */ |
|
| 295 | - public function replaceImageByRegex($regex, $local_prefix, $object = false) |
|
| 296 | - { |
|
| 297 | - preg_match_all("#<img[^>]*[\s]+src[^=]*=[\s]*[\"']($regex)(.+?)[\"']#si", $this->Body, $matches); |
|
| 298 | - $i = 0; |
|
| 285 | + } |
|
| 286 | + } |
|
| 287 | + |
|
| 288 | + /** |
|
| 289 | + * Replace images with locations specified by regex with cid: images |
|
| 290 | + * and attach needed files |
|
| 291 | + * @param string $regex Regular expression |
|
| 292 | + * @param string $local_prefix Prefix where local files are stored |
|
| 293 | + * @param bool $object Use attachment object |
|
| 294 | + */ |
|
| 295 | + public function replaceImageByRegex($regex, $local_prefix, $object = false) |
|
| 296 | + { |
|
| 297 | + preg_match_all("#<img[^>]*[\s]+src[^=]*=[\s]*[\"']($regex)(.+?)[\"']#si", $this->Body, $matches); |
|
| 298 | + $i = 0; |
|
| 299 | 299 | foreach($matches[2] as $match) { |
| 300 | - $filename = urldecode($match); |
|
| 301 | - $cid = $filename; |
|
| 302 | - $file_location = $local_prefix.$filename; |
|
| 303 | - if(!file_exists($file_location)) continue; |
|
| 304 | - if($object) { |
|
| 305 | - if(preg_match('#&(?:amp;)?type=([\w]+)#i', $matches[0][$i], $typematch)) { |
|
| 306 | - switch(strtolower($typematch[1])) { |
|
| 307 | - case 'documents': |
|
| 308 | - $beanname = 'DocumentRevisions'; |
|
| 309 | - break; |
|
| 310 | - case 'notes': |
|
| 311 | - $beanname = 'Notes'; |
|
| 312 | - break; |
|
| 313 | - } |
|
| 314 | - } |
|
| 315 | - $mime_type = "application/octet-stream"; |
|
| 316 | - if(isset($beanname)) { |
|
| 317 | - $bean = SugarModule::get($beanname)->loadBean(); |
|
| 318 | - $bean->retrieve($filename); |
|
| 319 | - if(!empty($bean->id)) { |
|
| 320 | - $mime_type = $bean->file_mime_type; |
|
| 321 | - $filename = $bean->filename; |
|
| 322 | - } |
|
| 323 | - } |
|
| 324 | - } else { |
|
| 325 | - $mime_type = "image/".strtolower(pathinfo($filename, PATHINFO_EXTENSION)); |
|
| 326 | - } |
|
| 327 | - if (!$this->embeddedAttachmentExists($cid)) { |
|
| 328 | - $this->AddEmbeddedImage($file_location, $cid, $filename, 'base64', $mime_type); |
|
| 329 | - } |
|
| 330 | - $i++; |
|
| 300 | + $filename = urldecode($match); |
|
| 301 | + $cid = $filename; |
|
| 302 | + $file_location = $local_prefix.$filename; |
|
| 303 | + if(!file_exists($file_location)) continue; |
|
| 304 | + if($object) { |
|
| 305 | + if(preg_match('#&(?:amp;)?type=([\w]+)#i', $matches[0][$i], $typematch)) { |
|
| 306 | + switch(strtolower($typematch[1])) { |
|
| 307 | + case 'documents': |
|
| 308 | + $beanname = 'DocumentRevisions'; |
|
| 309 | + break; |
|
| 310 | + case 'notes': |
|
| 311 | + $beanname = 'Notes'; |
|
| 312 | + break; |
|
| 313 | + } |
|
| 314 | + } |
|
| 315 | + $mime_type = "application/octet-stream"; |
|
| 316 | + if(isset($beanname)) { |
|
| 317 | + $bean = SugarModule::get($beanname)->loadBean(); |
|
| 318 | + $bean->retrieve($filename); |
|
| 319 | + if(!empty($bean->id)) { |
|
| 320 | + $mime_type = $bean->file_mime_type; |
|
| 321 | + $filename = $bean->filename; |
|
| 322 | + } |
|
| 323 | + } |
|
| 324 | + } else { |
|
| 325 | + $mime_type = "image/".strtolower(pathinfo($filename, PATHINFO_EXTENSION)); |
|
| 326 | + } |
|
| 327 | + if (!$this->embeddedAttachmentExists($cid)) { |
|
| 328 | + $this->AddEmbeddedImage($file_location, $cid, $filename, 'base64', $mime_type); |
|
| 329 | + } |
|
| 330 | + $i++; |
|
| 331 | 331 | } |
| 332 | - //replace references to cache with cid tag |
|
| 333 | - $this->Body = preg_replace("|\"$regex|i",'"cid:',$this->Body); |
|
| 334 | - // remove bad img line from outbound email |
|
| 335 | - $this->Body = preg_replace('#<img[^>]+src[^=]*=\"\/([^>]*?[^>]*)>#sim', '', $this->Body); |
|
| 336 | - } |
|
| 332 | + //replace references to cache with cid tag |
|
| 333 | + $this->Body = preg_replace("|\"$regex|i",'"cid:',$this->Body); |
|
| 334 | + // remove bad img line from outbound email |
|
| 335 | + $this->Body = preg_replace('#<img[^>]+src[^=]*=\"\/([^>]*?[^>]*)>#sim', '', $this->Body); |
|
| 336 | + } |
|
| 337 | 337 | |
| 338 | - /** |
|
| 339 | - * @param notes array of note beans |
|
| 340 | - */ |
|
| 341 | - function handleAttachments($notes) { |
|
| 342 | - global $sugar_config; |
|
| 338 | + /** |
|
| 339 | + * @param notes array of note beans |
|
| 340 | + */ |
|
| 341 | + function handleAttachments($notes) { |
|
| 342 | + global $sugar_config; |
|
| 343 | 343 | |
| 344 | - // cn: bug 4864 - reusing same SugarPHPMailer class, need to clear attachments |
|
| 345 | - $this->ClearAttachments(); |
|
| 344 | + // cn: bug 4864 - reusing same SugarPHPMailer class, need to clear attachments |
|
| 345 | + $this->ClearAttachments(); |
|
| 346 | 346 | |
| 347 | - //replace references to cache/images with cid tag |
|
| 347 | + //replace references to cache/images with cid tag |
|
| 348 | 348 | $this->Body = preg_replace(';=\s*"'.preg_quote(sugar_cached('images/'), ';').';','="cid:',$this->Body); |
| 349 | 349 | |
| 350 | - $this->replaceImageByRegex("(?:{$sugar_config['site_url']})?/?cache/images/", sugar_cached("images/")); |
|
| 351 | - |
|
| 352 | - //Replace any embeded images using the secure entryPoint for src url. |
|
| 353 | - $this->replaceImageByRegex("(?:{$sugar_config['site_url']})?index.php[?]entryPoint=download&(?:amp;)?[^\"]+?id=", "upload://", true); |
|
| 354 | - |
|
| 355 | - if (empty($notes)) { |
|
| 356 | - return; |
|
| 357 | - } |
|
| 358 | - //Handle regular attachments. |
|
| 359 | - foreach($notes as $note) { |
|
| 360 | - $mime_type = 'text/plain'; |
|
| 361 | - $file_location = ''; |
|
| 362 | - $filename = ''; |
|
| 363 | - |
|
| 364 | - if($note->object_name == 'Note') { |
|
| 365 | - if (! empty($note->file->temp_file_location) && is_file($note->file->temp_file_location)) { |
|
| 366 | - $file_location = $note->file->temp_file_location; |
|
| 367 | - $filename = $note->file->original_file_name; |
|
| 368 | - $mime_type = $note->file->mime_type; |
|
| 369 | - } else { |
|
| 370 | - $file_location = "upload://{$note->id}"; |
|
| 371 | - $filename = $note->id.$note->filename; |
|
| 372 | - $mime_type = $note->file_mime_type; |
|
| 373 | - } |
|
| 374 | - } elseif($note->object_name == 'DocumentRevision') { // from Documents |
|
| 375 | - $filename = $note->id.$note->filename; |
|
| 376 | - $file_location = "upload://$filename"; |
|
| 377 | - $mime_type = $note->file_mime_type; |
|
| 378 | - } |
|
| 379 | - |
|
| 380 | - $filename = substr($filename, 36, strlen($filename)); // strip GUID for PHPMailer class to name outbound file |
|
| 381 | - if (!$note->embed_flag) { |
|
| 382 | - $this->AddAttachment($file_location, $filename, 'base64', $mime_type); |
|
| 383 | - } // else |
|
| 384 | - } |
|
| 385 | - } |
|
| 386 | - |
|
| 387 | - /** |
|
| 388 | - * overloads class.phpmailer's SetError() method so that we can log errors in sugarcrm.log |
|
| 389 | - * |
|
| 390 | - */ |
|
| 391 | - function SetError($msg) { |
|
| 392 | - $GLOBALS['log']->fatal("SugarPHPMailer encountered an error: {$msg}"); |
|
| 393 | - parent::SetError($msg); |
|
| 394 | - } |
|
| 395 | - |
|
| 396 | - function SmtpConnect($options = array()) { |
|
| 397 | - $connection = parent::SmtpConnect(); |
|
| 398 | - if (!$connection) { |
|
| 399 | - global $app_strings; |
|
| 400 | - if(isset($this->oe) && $this->oe->type == "system") { |
|
| 401 | - $this->SetError($app_strings['LBL_EMAIL_INVALID_SYSTEM_OUTBOUND']); |
|
| 402 | - } else { |
|
| 403 | - $this->SetError($app_strings['LBL_EMAIL_INVALID_PERSONAL_OUTBOUND']); |
|
| 404 | - } // else |
|
| 405 | - } |
|
| 406 | - return $connection; |
|
| 407 | - } // fn |
|
| 350 | + $this->replaceImageByRegex("(?:{$sugar_config['site_url']})?/?cache/images/", sugar_cached("images/")); |
|
| 351 | + |
|
| 352 | + //Replace any embeded images using the secure entryPoint for src url. |
|
| 353 | + $this->replaceImageByRegex("(?:{$sugar_config['site_url']})?index.php[?]entryPoint=download&(?:amp;)?[^\"]+?id=", "upload://", true); |
|
| 354 | + |
|
| 355 | + if (empty($notes)) { |
|
| 356 | + return; |
|
| 357 | + } |
|
| 358 | + //Handle regular attachments. |
|
| 359 | + foreach($notes as $note) { |
|
| 360 | + $mime_type = 'text/plain'; |
|
| 361 | + $file_location = ''; |
|
| 362 | + $filename = ''; |
|
| 363 | + |
|
| 364 | + if($note->object_name == 'Note') { |
|
| 365 | + if (! empty($note->file->temp_file_location) && is_file($note->file->temp_file_location)) { |
|
| 366 | + $file_location = $note->file->temp_file_location; |
|
| 367 | + $filename = $note->file->original_file_name; |
|
| 368 | + $mime_type = $note->file->mime_type; |
|
| 369 | + } else { |
|
| 370 | + $file_location = "upload://{$note->id}"; |
|
| 371 | + $filename = $note->id.$note->filename; |
|
| 372 | + $mime_type = $note->file_mime_type; |
|
| 373 | + } |
|
| 374 | + } elseif($note->object_name == 'DocumentRevision') { // from Documents |
|
| 375 | + $filename = $note->id.$note->filename; |
|
| 376 | + $file_location = "upload://$filename"; |
|
| 377 | + $mime_type = $note->file_mime_type; |
|
| 378 | + } |
|
| 379 | + |
|
| 380 | + $filename = substr($filename, 36, strlen($filename)); // strip GUID for PHPMailer class to name outbound file |
|
| 381 | + if (!$note->embed_flag) { |
|
| 382 | + $this->AddAttachment($file_location, $filename, 'base64', $mime_type); |
|
| 383 | + } // else |
|
| 384 | + } |
|
| 385 | + } |
|
| 386 | + |
|
| 387 | + /** |
|
| 388 | + * overloads class.phpmailer's SetError() method so that we can log errors in sugarcrm.log |
|
| 389 | + * |
|
| 390 | + */ |
|
| 391 | + function SetError($msg) { |
|
| 392 | + $GLOBALS['log']->fatal("SugarPHPMailer encountered an error: {$msg}"); |
|
| 393 | + parent::SetError($msg); |
|
| 394 | + } |
|
| 395 | + |
|
| 396 | + function SmtpConnect($options = array()) { |
|
| 397 | + $connection = parent::SmtpConnect(); |
|
| 398 | + if (!$connection) { |
|
| 399 | + global $app_strings; |
|
| 400 | + if(isset($this->oe) && $this->oe->type == "system") { |
|
| 401 | + $this->SetError($app_strings['LBL_EMAIL_INVALID_SYSTEM_OUTBOUND']); |
|
| 402 | + } else { |
|
| 403 | + $this->SetError($app_strings['LBL_EMAIL_INVALID_PERSONAL_OUTBOUND']); |
|
| 404 | + } // else |
|
| 405 | + } |
|
| 406 | + return $connection; |
|
| 407 | + } // fn |
|
| 408 | 408 | |
| 409 | 409 | /* |
| 410 | 410 | * overloads PHPMailer::PreSend() to allow for empty messages to go out. |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | function smarty_function_sugar_number_format($params, &$smarty) { |
| 38 | 38 | global $locale; |
| 39 | 39 | |
| 40 | - if(!isset($params['var']) || $params['var'] === '') { |
|
| 40 | + if(!isset($params['var']) || $params['var'] === '') { |
|
| 41 | 41 | return ''; |
| 42 | 42 | } |
| 43 | 43 | |
@@ -2,6 +2,6 @@ |
||
| 2 | 2 | //implements Smarty 3 style {nocache}{/nocache} block to prevent caching of a section of a template. |
| 3 | 3 | //remove this upon upgrade to Smarty 3 |
| 4 | 4 | function smarty_block_nocache($param, $content, &$smarty) { |
| 5 | - return $content; |
|
| 5 | + return $content; |
|
| 6 | 6 | } |
| 7 | 7 | ?> |
| 8 | 8 | \ No newline at end of file |
@@ -1,9 +1,9 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Smarty plugin |
|
| 4 | - * @package Smarty |
|
| 5 | - * @subpackage plugins |
|
| 6 | - */ |
|
| 3 | + * Smarty plugin |
|
| 4 | + * @package Smarty |
|
| 5 | + * @subpackage plugins |
|
| 6 | + */ |
|
| 7 | 7 | |
| 8 | 8 | |
| 9 | 9 | /** |
@@ -130,18 +130,18 @@ discard block |
||
| 130 | 130 | function smarty_function_html_radios_output($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids) { |
| 131 | 131 | $_output = ''; |
| 132 | 132 | if ($labels) { |
| 133 | - if($label_ids) { |
|
| 134 | - $_id = smarty_function_escape_special_chars(preg_replace('![^\w\-\.]!', '_', $name . '_' . $value)); |
|
| 135 | - $_output .= '<label for="' . $_id . '">'; |
|
| 136 | - } else { |
|
| 137 | - $_output .= '<label>'; |
|
| 138 | - } |
|
| 139 | - } |
|
| 140 | - $_output .= '<input type="radio" name="' |
|
| 133 | + if($label_ids) { |
|
| 134 | + $_id = smarty_function_escape_special_chars(preg_replace('![^\w\-\.]!', '_', $name . '_' . $value)); |
|
| 135 | + $_output .= '<label for="' . $_id . '">'; |
|
| 136 | + } else { |
|
| 137 | + $_output .= '<label>'; |
|
| 138 | + } |
|
| 139 | + } |
|
| 140 | + $_output .= '<input type="radio" name="' |
|
| 141 | 141 | . smarty_function_escape_special_chars($name) . '" value="' |
| 142 | 142 | . smarty_function_escape_special_chars($value) . '"'; |
| 143 | 143 | |
| 144 | - if ($labels && $label_ids) $_output .= ' id="' . $_id . '"'; |
|
| 144 | + if ($labels && $label_ids) $_output .= ' id="' . $_id . '"'; |
|
| 145 | 145 | |
| 146 | 146 | if ((string)$value==$selected) { |
| 147 | 147 | $_output .= ' checked="checked"'; |