Test Failed
Push — CI ( 0f01dd...c95a04 )
by Adam
55:13
created
include/Dashlets/DashletRssFeedTitle.php 2 patches
Indentation   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -43,79 +43,79 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	 *
92 92
 	 */
93 93
 	public function getTitle() {
94
-		$matches = array ();
94
+		$matches = array();
95 95
 		preg_match("/<title>.*?<\/title>/i", $this->contents, $matches);
96 96
 		if (isset($matches[0])) {
97 97
 			$this->title = str_replace(array('<![CDATA[', '<title>', '</title>', ']]>'), '', $matches[0]);
@@ -100,12 +100,12 @@  discard block
 block discarded – undo
100 100
 
101 101
 	public function cutLength() {
102 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;
103
+			$this->title = mb_substr($this->title, 0, $this->cut, $this->defaultEncoding).$this->endWith;
104 104
 		}
105 105
 	}
106 106
 
107 107
 	private function _identifyXmlEncoding() {
108
-		$matches = array ();
108
+		$matches = array();
109 109
 		preg_match('/encoding\=*\".*?\"/', $this->contents, $matches);
110 110
 		if (isset($matches[0])) {
111 111
 			$this->xmlEncoding = trim(str_replace('encoding="', '"', $matches[0]), '"');
Please login to merge, or discard this patch.
include/SugarPHPMailer.php 3 patches
Indentation   +237 added lines, -237 removed lines patch added patch discarded remove patch
@@ -48,116 +48,116 @@  discard block
 block discarded – undo
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
 block discarded – undo
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 />&nbsp;<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 />&nbsp;<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
 block discarded – undo
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
 block discarded – undo
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.
Please login to merge, or discard this patch.
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
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.
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 		$admin = new Administration();
68 68
 		$admin->retrieveSettings();
69 69
 
70
-		if(isset($admin->settings['disclosure_enable']) && !empty($admin->settings['disclosure_enable'])) {
70
+		if (isset($admin->settings['disclosure_enable']) && !empty($admin->settings['disclosure_enable'])) {
71 71
 			$this->disclosureEnabled = true;
72 72
 			$this->disclosureText = $admin->settings['disclosure_text'];
73 73
 		}
@@ -76,14 +76,14 @@  discard block
 block discarded – undo
76 76
 		$this->oe->getUserMailerSettings($current_user);
77 77
 
78 78
 		$this->SetLanguage('en', 'include/phpmailer/language/');
79
-		$this->PluginDir	= 'include/phpmailer/';
80
-		$this->Mailer	 	= 'smtp';
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';
84
-        $this->IsHTML(false);  // default to plain-text email
83
+		$this->Encoding = 'quoted-printable';
84
+        $this->IsHTML(false); // default to plain-text email
85 85
         $this->Hostname = $sugar_config['host_name'];
86
-        $this->WordWrap		= 996;
86
+        $this->WordWrap = 996;
87 87
 		// cn: gmail fix
88 88
 		$this->protocol = ($this->oe->mail_smtpssl == 1) ? "ssl://" : $this->protocol;
89 89
 
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 		// ssl or tcp - keeping outside isSMTP b/c a default may inadvertently set ssl://
104 104
 		$this->protocol = ($oe->mail_smtpssl) ? "ssl://" : "tcp://";
105 105
 
106
-		if($oe->mail_sendtype == "SMTP")
106
+		if ($oe->mail_sendtype == "SMTP")
107 107
 		{
108 108
     		//Set mail send type information
109 109
     		$this->Mailer = "smtp";
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
             	$this->SMTPSecure = 'tls';
117 117
             } // if
118 118
 
119
-    		if($oe->mail_smtpauth_req) {
119
+    		if ($oe->mail_smtpauth_req) {
120 120
     			$this->SMTPAuth = TRUE;
121 121
     			$this->Username = $oe->mail_smtpuser;
122 122
     			$this->Password = $oe->mail_smtppass;
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 		// ssl or tcp - keeping outside isSMTP b/c a default may inadvertantly set ssl://
138 138
 		$this->protocol = ($oe->mail_smtpssl) ? "ssl://" : "tcp://";
139 139
 
140
-		if($oe->mail_sendtype == "SMTP")
140
+		if ($oe->mail_sendtype == "SMTP")
141 141
 		{
142 142
     		//Set mail send type information
143 143
     		$this->Mailer = "smtp";
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
             if ($oe->mail_smtpssl == 2) {
150 150
             	$this->SMTPSecure = 'tls';
151 151
             } // if
152
-    		if($oe->mail_smtpauth_req) {
152
+    		if ($oe->mail_smtpauth_req) {
153 153
     			$this->SMTPAuth = TRUE;
154 154
     			$this->Username = $oe->mail_smtpuser;
155 155
     			$this->Password = $oe->mail_smtppass;
@@ -223,31 +223,31 @@  discard block
 block discarded – undo
223 223
 	function prepForOutbound() {
224 224
 		global $locale;
225 225
 
226
-		if($this->preppedForOutbound == false) {
226
+		if ($this->preppedForOutbound == false) {
227 227
 			//bug 28534. We should not set it to true to circumvent the following conversion as each email is independent.
228 228
 			//$this->preppedForOutbound = true; // flag so we don't redo this
229 229
 			$OBCharset = $locale->getPrecedentPreference('default_email_charset');
230 230
 
231 231
 			// handle disclosure
232
-			if($this->disclosureEnabled) {
232
+			if ($this->disclosureEnabled) {
233 233
 				$this->Body .= "<br />&nbsp;<br />{$this->disclosureText}";
234 234
 				$this->AltBody .= "\r\r{$this->disclosureText}";
235 235
 			}
236 236
 
237 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
-            $subjectUTF8		= from_html(trim($this->Subject));
241
-            $subject			= $locale->translateCharset($subjectUTF8, 'UTF-8', $OBCharset);
242
-            $this->Subject		= $locale->translateCharset($subjectUTF8, 'UTF-8', $OBCharset);
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
+            $subjectUTF8 = from_html(trim($this->Subject));
241
+            $subject = $locale->translateCharset($subjectUTF8, 'UTF-8', $OBCharset);
242
+            $this->Subject = $locale->translateCharset($subjectUTF8, 'UTF-8', $OBCharset);
243 243
 
244 244
 			// HTML email RFC compliance
245
-			if($this->ContentType == "text/html") {
246
-				if(strpos($this->Body, '<html') === false) {
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>
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 			// Headers /////////////////////////////////
264 264
 			// the below is done in PHPMailer::CreateHeader();
265 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);
266
+			$this->FromName = $locale->translateCharset(trim($this->FromName), 'UTF-8', $OBCharset);
267 267
 			/*
268 268
 			foreach($this->ReplyTo as $k => $v) {
269 269
 				$this->ReplyTo[$k][1] = $locale->translateCharset(trim($v[1]), 'UTF-8', $OBCharset);
@@ -296,14 +296,14 @@  discard block
 block discarded – undo
296 296
 	{
297 297
 		preg_match_all("#<img[^>]*[\s]+src[^=]*=[\s]*[\"']($regex)(.+?)[\"']#si", $this->Body, $matches);
298 298
 		$i = 0;
299
-        foreach($matches[2] as $match) {
299
+        foreach ($matches[2] as $match) {
300 300
 			$filename = urldecode($match);
301 301
 			$cid = $filename;
302 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])) {
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 307
 			            case 'documents':
308 308
 			                $beanname = 'DocumentRevisions';
309 309
 			                break;
@@ -313,10 +313,10 @@  discard block
 block discarded – undo
313 313
 			        }
314 314
 			    }
315 315
 			    $mime_type = "application/octet-stream";
316
-			    if(isset($beanname)) {
316
+			    if (isset($beanname)) {
317 317
 			        $bean = SugarModule::get($beanname)->loadBean();
318 318
     			    $bean->retrieve($filename);
319
-    			    if(!empty($bean->id)) {
319
+    			    if (!empty($bean->id)) {
320 320
         			    $mime_type = $bean->file_mime_type;
321 321
         			    $filename = $bean->filename;
322 322
     			    }
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
 		    $i++;
331 331
         }
332 332
 		//replace references to cache with cid tag
333
-		$this->Body = preg_replace("|\"$regex|i",'"cid:',$this->Body);
333
+		$this->Body = preg_replace("|\"$regex|i", '"cid:', $this->Body);
334 334
 		// remove bad img line from outbound email
335 335
 		$this->Body = preg_replace('#<img[^>]+src[^=]*=\"\/([^>]*?[^>]*)>#sim', '', $this->Body);
336 336
 	}
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
 		$this->ClearAttachments();
346 346
 
347 347
 		//replace references to cache/images with cid tag
348
-        $this->Body = preg_replace(';=\s*"'.preg_quote(sugar_cached('images/'), ';').';','="cid:',$this->Body);
348
+        $this->Body = preg_replace(';=\s*"'.preg_quote(sugar_cached('images/'), ';').';', '="cid:', $this->Body);
349 349
 
350 350
 		$this->replaceImageByRegex("(?:{$sugar_config['site_url']})?/?cache/images/", sugar_cached("images/"));
351 351
 
@@ -356,13 +356,13 @@  discard block
 block discarded – undo
356 356
 				return;
357 357
 		}
358 358
 		//Handle regular attachments.
359
-		foreach($notes as $note) {
359
+		foreach ($notes as $note) {
360 360
 				$mime_type = 'text/plain';
361 361
 				$file_location = '';
362 362
 				$filename = '';
363 363
 
364
-				if($note->object_name == 'Note') {
365
-					if (! empty($note->file->temp_file_location) && is_file($note->file->temp_file_location)) {
364
+				if ($note->object_name == 'Note') {
365
+					if (!empty($note->file->temp_file_location) && is_file($note->file->temp_file_location)) {
366 366
 						$file_location = $note->file->temp_file_location;
367 367
 						$filename = $note->file->original_file_name;
368 368
 						$mime_type = $note->file->mime_type;
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
 						$filename = $note->id.$note->filename;
372 372
 						$mime_type = $note->file_mime_type;
373 373
 					}
374
-				} elseif($note->object_name == 'DocumentRevision') { // from Documents
374
+				} elseif ($note->object_name == 'DocumentRevision') { // from Documents
375 375
 					$filename = $note->id.$note->filename;
376 376
 					$file_location = "upload://$filename";
377 377
 					$mime_type = $note->file_mime_type;
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
 		$connection = parent::SmtpConnect();
398 398
 		if (!$connection) {
399 399
 			global $app_strings;
400
-			if(isset($this->oe) && $this->oe->type == "system") {
400
+			if (isset($this->oe) && $this->oe->type == "system") {
401 401
 				$this->SetError($app_strings['LBL_EMAIL_INVALID_SYSTEM_OUTBOUND']);
402 402
 			} else {
403 403
 				$this->SetError($app_strings['LBL_EMAIL_INVALID_PERSONAL_OUTBOUND']);
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
      */
412 412
     public function PreSend() {
413 413
         //check to see if message body is empty
414
-        if(empty($this->Body)){
414
+        if (empty($this->Body)) {
415 415
             //PHPMailer will throw an error if the body is empty, so insert a blank space if body is empty
416 416
             $this->Body = " ";
417 417
         }
Please login to merge, or discard this patch.
Braces   +10 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -121,9 +123,9 @@  discard block
 block discarded – undo
121 123
     			$this->Username = $oe->mail_smtpuser;
122 124
     			$this->Password = $oe->mail_smtppass;
123 125
     		}
126
+		} else {
127
+					$this->Mailer = "sendmail";
124 128
 		}
125
-		else
126
-			$this->Mailer = "sendmail";
127 129
 	}
128 130
 
129 131
 	/**
@@ -154,9 +156,9 @@  discard block
 block discarded – undo
154 156
     			$this->Username = $oe->mail_smtpuser;
155 157
     			$this->Password = $oe->mail_smtppass;
156 158
     		}
159
+		} else {
160
+				  $this->Mailer = "sendmail";
157 161
 		}
158
-		else
159
-		  $this->Mailer = "sendmail";
160 162
 	}
161 163
 
162 164
     /**
@@ -300,7 +302,9 @@  discard block
 block discarded – undo
300 302
 			$filename = urldecode($match);
301 303
 			$cid = $filename;
302 304
 			$file_location = $local_prefix.$filename;
303
-			if(!file_exists($file_location)) continue;
305
+			if(!file_exists($file_location)) {
306
+			    continue;
307
+			}
304 308
 			if($object) {
305 309
 			    if(preg_match('#&(?:amp;)?type=([\w]+)#i', $matches[0][$i], $typematch)) {
306 310
 			        switch(strtolower($typematch[1])) {
Please login to merge, or discard this patch.
include/MySugar/retrieve_dash_page.php 2 patches
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
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,7 +42,7 @@  discard block
 block discarded – undo
42 42
 require_once('include/MySugar/MySugar.php');
43 43
 
44 44
 // build dashlet cache file if not found
45
-if(!is_file($cachefile = sugar_cached('dashlets/dashlets.php'))) {
45
+if (!is_file($cachefile = sugar_cached('dashlets/dashlets.php'))) {
46 46
     require_once('include/Dashlets/DashletCacheBuilder.php');
47 47
 
48 48
     $dc = new DashletCacheBuilder();
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 
61 61
 $hasUserPreferences = (!isset($pages) || empty($pages) || !isset($dashlets) || empty($dashlets)) ? false : true;
62 62
 
63
-if(!$hasUserPreferences){
63
+if (!$hasUserPreferences) {
64 64
     $dashlets = array();
65 65
 
66 66
     //list of preferences to move over and to where
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
     $old_columns = $current_user->getPreference('columns', 'home');
86 86
     $old_dashlets = $current_user->getPreference('dashlets', 'home');
87 87
 
88
-    if (isset($old_columns) && !empty($old_columns) && isset($old_dashlets) && !empty($old_dashlets)){
88
+    if (isset($old_columns) && !empty($old_columns) && isset($old_dashlets) && !empty($old_dashlets)) {
89 89
         $columns = $old_columns;
90 90
         $dashlets = $old_dashlets;
91 91
 
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
         $current_user->setPreference('columns', $old_columns, 0, 'home');
96 96
         $current_user->setPreference('dashlets', $old_dashlets, 0, 'home');
97 97
     }
98
-    else{
98
+    else {
99 99
         // This is here to get Sugar dashlets added above the rest
100 100
         $dashlets[create_guid()] = array('className' => 'iFrameDashlet',
101 101
             'module' => 'Home',
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
                 'height' => 315,
107 107
             ));
108 108
 
109
-        $dashlets[create_guid()] = array ('className' => 'SugarFeedDashlet',
109
+        $dashlets[create_guid()] = array('className' => 'SugarFeedDashlet',
110 110
             'module' => 'SugarFeed',
111 111
             'forceColumn' => 1,
112 112
             'fileLocation' => $dashletsFiles['SugarFeedDashlet']['file'],
@@ -121,15 +121,15 @@  discard block
 block discarded – undo
121 121
                 'height' => 315,
122 122
             ));
123 123
 
124
-        foreach($defaultDashlets as $dashletName=>$module){
124
+        foreach ($defaultDashlets as $dashletName=>$module) {
125 125
             // clint - fixes bug #20398
126 126
             // only display dashlets that are from visibile modules and that the user has permission to list
127 127
             $myDashlet = new MySugar($module);
128 128
             $displayDashlet = $myDashlet->checkDashletDisplay();
129
-            if (isset($dashletsFiles[$dashletName]) && $displayDashlet){
129
+            if (isset($dashletsFiles[$dashletName]) && $displayDashlet) {
130 130
                 $options = array();
131
-                $prefsforthisdashlet = array_keys($prefstomove,$dashletName);
132
-                foreach ( $prefsforthisdashlet as $pref ) {
131
+                $prefsforthisdashlet = array_keys($prefstomove, $dashletName);
132
+                foreach ($prefsforthisdashlet as $pref) {
133 133
                     $options[$pref] = $current_user->getPreference($pref);
134 134
                 }
135 135
                 $dashlets[create_guid()] = array('className' => $dashletName,
@@ -149,8 +149,8 @@  discard block
 block discarded – undo
149 149
         $columns[1]['width'] = '40%';
150 150
         $columns[1]['dashlets'] = array();
151 151
 
152
-        foreach($dashlets as $guid=>$dashlet) {
153
-            if( $dashlet['forceColumn'] == 0 ) array_push($columns[0]['dashlets'], $guid);
152
+        foreach ($dashlets as $guid=>$dashlet) {
153
+            if ($dashlet['forceColumn'] == 0) array_push($columns[0]['dashlets'], $guid);
154 154
             else array_push($columns[1]['dashlets'], $guid);
155 155
             $count++;
156 156
         }
@@ -165,29 +165,29 @@  discard block
 block discarded – undo
165 165
 // handles upgrading from versions that had the 'Dashboard' module; move those items over to the Home page
166 166
 $pagesDashboard = $current_user->getPreference('pages', 'Dashboard');
167 167
 $dashletsDashboard = $current_user->getPreference('dashlets', 'Dashboard');
168
-if ( !empty($pagesDashboard) ) {
168
+if (!empty($pagesDashboard)) {
169 169
     // move dashlets from the dashboard to be at the end of the home screen dashlets
170
-    foreach ($pagesDashboard[0]['columns'] as $dashboardColumnKey => $dashboardColumn ) {
171
-        foreach ($dashboardColumn['dashlets'] as $dashletItem ) {
170
+    foreach ($pagesDashboard[0]['columns'] as $dashboardColumnKey => $dashboardColumn) {
171
+        foreach ($dashboardColumn['dashlets'] as $dashletItem) {
172 172
             $pages[0]['columns'][$dashboardColumnKey]['dashlets'][] = $dashletItem;
173 173
         }
174 174
     }
175
-    $pages = array_merge($pages,$pagesDashboard);
175
+    $pages = array_merge($pages, $pagesDashboard);
176 176
     $current_user->setPreference('pages', $pages, 0, 'Home');
177 177
 }
178
-if ( !empty($dashletsDashboard) ) {
179
-    $dashlets = array_merge($dashlets,$dashletsDashboard);
178
+if (!empty($dashletsDashboard)) {
179
+    $dashlets = array_merge($dashlets, $dashletsDashboard);
180 180
     $current_user->setPreference('dashlets', $dashlets, 0, 'Home');
181 181
 }
182
-if ( !empty($pagesDashboard) || !empty($dashletsDashboard) )
182
+if (!empty($pagesDashboard) || !empty($dashletsDashboard))
183 183
     $current_user->resetPreferences('Dashboard');
184 184
 
185
-if (empty($pages)){
185
+if (empty($pages)) {
186 186
     $pages = array();
187 187
     $pageIndex = 0;
188 188
     $pages[0]['columns'] = $columns;
189 189
     $pages[0]['numColumns'] = '2';
190
-    $pages[0]['pageTitleLabel'] = 'LBL_HOME_PAGE_1_NAME';	// "My Sugar"
190
+    $pages[0]['pageTitleLabel'] = 'LBL_HOME_PAGE_1_NAME'; // "My Sugar"
191 191
     $pageIndex++;
192 192
     $current_user->setPreference('pages', $pages, 0, 'Home');
193 193
     $activePage = 0;
@@ -206,32 +206,32 @@  discard block
 block discarded – undo
206 206
 $dashletIds = array(); // collect ids to pass to javascript
207 207
 $display = array();
208 208
 
209
-foreach($pages[$activePage]['columns'] as $colNum => $column) {
210
-    if ($colNum == $numCols){
209
+foreach ($pages[$activePage]['columns'] as $colNum => $column) {
210
+    if ($colNum == $numCols) {
211 211
         break;
212 212
     }
213 213
     $display[$colNum]['width'] = $column['width'];
214 214
     $display[$colNum]['dashlets'] = array();
215
-    foreach($column['dashlets'] as $num => $id) {
215
+    foreach ($column['dashlets'] as $num => $id) {
216 216
         // clint - fixes bug #20398
217 217
         // only display dashlets that are from visibile modules and that the user has permission to list
218
-        if(!empty($id) && isset($dashlets[$id]) && is_file($dashlets[$id]['fileLocation'])) {
218
+        if (!empty($id) && isset($dashlets[$id]) && is_file($dashlets[$id]['fileLocation'])) {
219 219
             $module = 'Home';
220
-            if ( !empty($dashletsFiles[$dashlets[$id]['className']]['module']) )
220
+            if (!empty($dashletsFiles[$dashlets[$id]['className']]['module']))
221 221
                 $module = $dashletsFiles[$dashlets[$id]['className']]['module'];
222 222
             // Bug 24772 - Look into the user preference for the module the dashlet is a part of in case
223 223
             //             of the Report Chart dashlets.
224
-            elseif ( !empty($dashlets[$id]['module']) )
224
+            elseif (!empty($dashlets[$id]['module']))
225 225
                 $module = $dashlets[$id]['module'];
226 226
 
227 227
             $myDashlet = new MySugar($module);
228 228
 
229
-            if($myDashlet->checkDashletDisplay()) {
229
+            if ($myDashlet->checkDashletDisplay()) {
230 230
                 require_once($dashlets[$id]['fileLocation']);
231 231
                 $dashlet = new $dashlets[$id]['className']($id, (isset($dashlets[$id]['options']) ? $dashlets[$id]['options'] : array()));
232 232
                 // Need to add support to dynamically display/hide dashlets
233 233
                 // If it has a method 'shouldDisplay' we will call it to see if we should display it or not
234
-                if (method_exists($dashlet,'shouldDisplay')) {
234
+                if (method_exists($dashlet, 'shouldDisplay')) {
235 235
                     if (!$dashlet->shouldDisplay()) {
236 236
                         // This dashlet doesn't want us to show it, skip it.
237 237
                         continue;
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 
243 243
                 $dashlets = $current_user->getPreference('dashlets', 'Home'); // Using hardcoded 'Home' because DynamicAction.php $_REQUEST['module'] value is always Home
244 244
                 $lvsParams = array();
245
-                if(!empty($dashlets[$id]['sort_options'])){
245
+                if (!empty($dashlets[$id]['sort_options'])) {
246 246
                     $lvsParams = $dashlets[$id]['sort_options'];
247 247
                 }
248 248
 
@@ -251,10 +251,10 @@  discard block
 block discarded – undo
251 251
                     $display[$colNum]['dashlets'][$id]['display'] = $dashlet->display();
252 252
                     $display[$colNum]['dashlets'][$id]['displayHeader'] = $dashlet->getHeader();
253 253
                     $display[$colNum]['dashlets'][$id]['displayFooter'] = $dashlet->getFooter();
254
-                    if($dashlet->hasScript) {
254
+                    if ($dashlet->hasScript) {
255 255
                         $display[$colNum]['dashlets'][$id]['script'] = $dashlet->displayScript();
256 256
                     }
257
-                } catch (Exception $ex) {
257
+                }catch (Exception $ex) {
258 258
                     $display[$colNum]['dashlets'][$id]['display'] = $ex->getMessage();
259 259
                     $display[$colNum]['dashlets'][$id]['displayHeader'] = $dashlet->getHeader();
260 260
                     $display[$colNum]['dashlets'][$id]['displayFooter'] = $dashlet->getFooter();
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 $_SESSION['current_tab'] = $activePage;
268 268
 
269 269
 
270
-if(!empty($sugar_config['lock_homepage']) && $sugar_config['lock_homepage'] == true) $sugar_smarty->assign('lock_homepage', true);
270
+if (!empty($sugar_config['lock_homepage']) && $sugar_config['lock_homepage'] == true) $sugar_smarty->assign('lock_homepage', true);
271 271
 
272 272
 
273 273
 $sugar_smarty->assign('sugarVersion', $sugar_version);
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 
278 278
 $sugar_smarty->assign('maxCount', empty($sugar_config['max_dashlets_homepage']) ? 15 : $sugar_config['max_dashlets_homepage']);
279 279
 $sugar_smarty->assign('dashletCount', $count);
280
-$sugar_smarty->assign('dashletIds', '["' . implode('","', $dashletIds) . '"]');
280
+$sugar_smarty->assign('dashletIds', '["'.implode('","', $dashletIds).'"]');
281 281
 $sugar_smarty->assign('columns', $display);
282 282
 
283 283
 global $theme;
Please login to merge, or discard this patch.
Braces   +20 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -94,8 +96,7 @@  discard block
 block discarded – undo
94 96
         $old_dashlets = array();
95 97
         $current_user->setPreference('columns', $old_columns, 0, 'home');
96 98
         $current_user->setPreference('dashlets', $old_dashlets, 0, 'home');
97
-    }
98
-    else{
99
+    } else{
99 100
         // This is here to get Sugar dashlets added above the rest
100 101
         $dashlets[create_guid()] = array('className' => 'iFrameDashlet',
101 102
             'module' => 'Home',
@@ -150,8 +151,11 @@  discard block
 block discarded – undo
150 151
         $columns[1]['dashlets'] = array();
151 152
 
152 153
         foreach($dashlets as $guid=>$dashlet) {
153
-            if( $dashlet['forceColumn'] == 0 ) array_push($columns[0]['dashlets'], $guid);
154
-            else array_push($columns[1]['dashlets'], $guid);
154
+            if( $dashlet['forceColumn'] == 0 ) {
155
+                array_push($columns[0]['dashlets'], $guid);
156
+            } else {
157
+                array_push($columns[1]['dashlets'], $guid);
158
+            }
155 159
             $count++;
156 160
         }
157 161
     }
@@ -179,8 +183,9 @@  discard block
 block discarded – undo
179 183
     $dashlets = array_merge($dashlets,$dashletsDashboard);
180 184
     $current_user->setPreference('dashlets', $dashlets, 0, 'Home');
181 185
 }
182
-if ( !empty($pagesDashboard) || !empty($dashletsDashboard) )
186
+if ( !empty($pagesDashboard) || !empty($dashletsDashboard) ) {
183 187
     $current_user->resetPreferences('Dashboard');
188
+}
184 189
 
185 190
 if (empty($pages)){
186 191
     $pages = array();
@@ -217,12 +222,14 @@  discard block
 block discarded – undo
217 222
         // only display dashlets that are from visibile modules and that the user has permission to list
218 223
         if(!empty($id) && isset($dashlets[$id]) && is_file($dashlets[$id]['fileLocation'])) {
219 224
             $module = 'Home';
220
-            if ( !empty($dashletsFiles[$dashlets[$id]['className']]['module']) )
221
-                $module = $dashletsFiles[$dashlets[$id]['className']]['module'];
225
+            if ( !empty($dashletsFiles[$dashlets[$id]['className']]['module']) ) {
226
+                            $module = $dashletsFiles[$dashlets[$id]['className']]['module'];
227
+            }
222 228
             // Bug 24772 - Look into the user preference for the module the dashlet is a part of in case
223 229
             //             of the Report Chart dashlets.
224
-            elseif ( !empty($dashlets[$id]['module']) )
225
-                $module = $dashlets[$id]['module'];
230
+            elseif ( !empty($dashlets[$id]['module']) ) {
231
+                            $module = $dashlets[$id]['module'];
232
+            }
226 233
 
227 234
             $myDashlet = new MySugar($module);
228 235
 
@@ -267,7 +274,9 @@  discard block
 block discarded – undo
267 274
 $_SESSION['current_tab'] = $activePage;
268 275
 
269 276
 
270
-if(!empty($sugar_config['lock_homepage']) && $sugar_config['lock_homepage'] == true) $sugar_smarty->assign('lock_homepage', true);
277
+if(!empty($sugar_config['lock_homepage']) && $sugar_config['lock_homepage'] == true) {
278
+    $sugar_smarty->assign('lock_homepage', true);
279
+}
271 280
 
272 281
 
273 282
 $sugar_smarty->assign('sugarVersion', $sugar_version);
Please login to merge, or discard this patch.
include/Smarty/plugins/function.sugar_number_format.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,11 +37,11 @@
 block discarded – undo
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
 
44
-    if ( !isset($params['precision']) ) {
44
+    if (!isset($params['precision'])) {
45 45
         $params['precision'] = $locale->getPrecedentPreference('default_currency_significant_digits');
46 46
     }
47 47
 
Please login to merge, or discard this patch.
include/Smarty/plugins/modifier.wordwrap.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,9 +21,9 @@
 block discarded – undo
21 21
  * @param boolean
22 22
  * @return string
23 23
  */
24
-function smarty_modifier_wordwrap($string,$length=80,$break="\n",$cut=false)
24
+function smarty_modifier_wordwrap($string, $length = 80, $break = "\n", $cut = false)
25 25
 {
26
-    return wordwrap($string,$length,$break,$cut);
26
+    return wordwrap($string, $length, $break, $cut);
27 27
 }
28 28
 
29 29
 ?>
Please login to merge, or discard this patch.
include/Smarty/plugins/function.html_options.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
  */
30 30
 function smarty_function_html_options($params, &$smarty)
31 31
 {
32
-    require_once $smarty->_get_plugin_filepath('shared','escape_special_chars');
32
+    require_once $smarty->_get_plugin_filepath('shared', 'escape_special_chars');
33 33
     
34 34
     $name = null;
35 35
     $values = null;
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
     
40 40
     $extra = '';
41 41
     
42
-    foreach($params as $_key => $_val) {
43
-        switch($_key) {
42
+    foreach ($params as $_key => $_val) {
43
+        switch ($_key) {
44 44
             case 'name':
45 45
                 $$_key = (string)$_val;
46 46
                 break;
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
                 break;
60 60
                 
61 61
             default:
62
-                if(!is_array($_val)) {
62
+                if (!is_array($_val)) {
63 63
                     $extra .= ' '.$_key.'="'.smarty_function_escape_special_chars($_val).'"';
64 64
                 } else {
65 65
                     $smarty->trigger_error("html_options: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
 
88 88
     }
89 89
 
90
-    if(!empty($name)) {
91
-        $_html_result = '<select name="' . $name . '"' . $extra . '>' . "\n" . $_html_result . '</select>' . "\n";
90
+    if (!empty($name)) {
91
+        $_html_result = '<select name="'.$name.'"'.$extra.'>'."\n".$_html_result.'</select>'."\n";
92 92
     }
93 93
 
94 94
     return $_html_result;
@@ -96,12 +96,12 @@  discard block
 block discarded – undo
96 96
 }
97 97
 
98 98
 function smarty_function_html_options_optoutput($key, $value, $selected) {
99
-    if(!is_array($value)) {
100
-        $_html_result = '<option label="' . smarty_function_escape_special_chars($value) . '" value="' .
101
-            smarty_function_escape_special_chars($key) . '"';
99
+    if (!is_array($value)) {
100
+        $_html_result = '<option label="'.smarty_function_escape_special_chars($value).'" value="'.
101
+            smarty_function_escape_special_chars($key).'"';
102 102
         if (in_array((string)$key, $selected))
103 103
             $_html_result .= ' selected="selected"';
104
-        $_html_result .= '>' . smarty_function_escape_special_chars($value) . '</option>' . "\n";
104
+        $_html_result .= '>'.smarty_function_escape_special_chars($value).'</option>'."\n";
105 105
     } else {
106 106
         $_html_result = smarty_function_html_options_optgroup($key, $value, $selected);
107 107
     }
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 }
110 110
 
111 111
 function smarty_function_html_options_optgroup($key, $values, $selected) {
112
-    $optgroup_html = '<optgroup label="' . smarty_function_escape_special_chars($key) . '">' . "\n";
112
+    $optgroup_html = '<optgroup label="'.smarty_function_escape_special_chars($key).'">'."\n";
113 113
     foreach ($values as $key => $value) {
114 114
         $optgroup_html .= smarty_function_html_options_optoutput($key, $value, $selected);
115 115
     }
Please login to merge, or discard this patch.
Braces   +10 added lines, -6 removed lines patch added patch discarded remove patch
@@ -68,15 +68,18 @@  discard block
 block discarded – undo
68 68
         }
69 69
     }
70 70
 
71
-    if (!isset($options) && !isset($values))
72
-        return ''; /* raise error here? */
71
+    if (!isset($options) && !isset($values)) {
72
+            return '';
73
+    }
74
+    /* raise error here? */
73 75
 
74 76
     $_html_result = '';
75 77
 
76 78
     if (isset($options)) {
77 79
         
78
-        foreach ($options as $_key=>$_val)
79
-            $_html_result .= smarty_function_html_options_optoutput($_key, $_val, $selected);
80
+        foreach ($options as $_key=>$_val) {
81
+                    $_html_result .= smarty_function_html_options_optoutput($_key, $_val, $selected);
82
+        }
80 83
 
81 84
     } else {
82 85
         
@@ -99,8 +102,9 @@  discard block
 block discarded – undo
99 102
     if(!is_array($value)) {
100 103
         $_html_result = '<option label="' . smarty_function_escape_special_chars($value) . '" value="' .
101 104
             smarty_function_escape_special_chars($key) . '"';
102
-        if (in_array((string)$key, $selected))
103
-            $_html_result .= ' selected="selected"';
105
+        if (in_array((string)$key, $selected)) {
106
+                    $_html_result .= ' selected="selected"';
107
+        }
104 108
         $_html_result .= '>' . smarty_function_escape_special_chars($value) . '</option>' . "\n";
105 109
     } else {
106 110
         $_html_result = smarty_function_html_options_optgroup($key, $value, $selected);
Please login to merge, or discard this patch.
include/Smarty/plugins/block.nocache.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,6 +2,6 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
include/Smarty/plugins/function.html_radios.php 4 patches
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
  */
41 41
 function smarty_function_html_radios($params, &$smarty)
42 42
 {
43
-    require_once $smarty->_get_plugin_filepath('shared','escape_special_chars');
43
+    require_once $smarty->_get_plugin_filepath('shared', 'escape_special_chars');
44 44
    
45 45
     $name = 'radio';
46 46
     $values = null;
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
     $output = null;
53 53
     $extra = '';
54 54
 
55
-    foreach($params as $_key => $_val) {
56
-        switch($_key) {
55
+    foreach ($params as $_key => $_val) {
56
+        switch ($_key) {
57 57
             case 'name':
58 58
             case 'separator':
59 59
                 $$_key = (string)$_val;
@@ -61,8 +61,8 @@  discard block
 block discarded – undo
61 61
 
62 62
             case 'checked':
63 63
             case 'selected':
64
-                if(is_array($_val)) {
65
-                    $smarty->trigger_error('html_radios: the "' . $_key . '" attribute cannot be an array', E_USER_WARNING);
64
+                if (is_array($_val)) {
65
+                    $smarty->trigger_error('html_radios: the "'.$_key.'" attribute cannot be an array', E_USER_WARNING);
66 66
                 } else {
67 67
                     $selected = (string)$_val;
68 68
                 }
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
                 break;
92 92
 
93 93
             default:
94
-                if(!is_array($_val)) {
94
+                if (!is_array($_val)) {
95 95
                     $extra .= ' '.$_key.'="'.smarty_function_escape_special_chars($_val).'"';
96 96
                 } else {
97 97
                     $smarty->trigger_error("html_radios: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
@@ -119,10 +119,10 @@  discard block
 block discarded – undo
119 119
 
120 120
     }
121 121
 
122
-    if(!empty($params['assign'])) {
122
+    if (!empty($params['assign'])) {
123 123
         $smarty->assign($params['assign'], $_html_result);
124 124
     } else {
125
-        return implode("\n",$_html_result);
125
+        return implode("\n", $_html_result);
126 126
     }
127 127
 
128 128
 }
@@ -130,25 +130,25 @@  discard block
 block discarded – undo
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 . '">';
133
+      if ($label_ids) {
134
+          $_id = smarty_function_escape_special_chars(preg_replace('![^\w\-\.]!', '_', $name.'_'.$value));
135
+          $_output .= '<label for="'.$_id.'">';
136 136
       } else {
137 137
           $_output .= '<label>';           
138 138
       }
139 139
    }
140 140
    $_output .= '<input type="radio" name="'
141
-        . smarty_function_escape_special_chars($name) . '" value="'
142
-        . smarty_function_escape_special_chars($value) . '"';
141
+        . smarty_function_escape_special_chars($name).'" value="'
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
-    if ((string)$value==$selected) {
146
+    if ((string)$value == $selected) {
147 147
         $_output .= ' checked="checked"';
148 148
     }
149
-    $_output .= $extra . ' />' . $output;
149
+    $_output .= $extra.' />'.$output;
150 150
     if ($labels) $_output .= '</label>';
151
-    $_output .=  $separator;
151
+    $_output .= $separator;
152 152
 
153 153
     return $_output;
154 154
 }
Please login to merge, or discard this patch.
Braces   +13 added lines, -6 removed lines patch added patch discarded remove patch
@@ -100,15 +100,18 @@  discard block
 block discarded – undo
100 100
         }
101 101
     }
102 102
 
103
-    if (!isset($options) && !isset($values))
104
-        return ''; /* raise error here? */
103
+    if (!isset($options) && !isset($values)) {
104
+            return '';
105
+    }
106
+    /* raise error here? */
105 107
 
106 108
     $_html_result = array();
107 109
 
108 110
     if (isset($options)) {
109 111
 
110
-        foreach ($options as $_key=>$_val)
111
-            $_html_result[] = smarty_function_html_radios_output($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids);
112
+        foreach ($options as $_key=>$_val) {
113
+                    $_html_result[] = smarty_function_html_radios_output($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids);
114
+        }
112 115
 
113 116
     } else {
114 117
 
@@ -141,13 +144,17 @@  discard block
 block discarded – undo
141 144
         . smarty_function_escape_special_chars($name) . '" value="'
142 145
         . smarty_function_escape_special_chars($value) . '"';
143 146
 
144
-   if ($labels && $label_ids) $_output .= ' id="' . $_id . '"';
147
+   if ($labels && $label_ids) {
148
+       $_output .= ' id="' . $_id . '"';
149
+   }
145 150
 
146 151
     if ((string)$value==$selected) {
147 152
         $_output .= ' checked="checked"';
148 153
     }
149 154
     $_output .= $extra . ' />' . $output;
150
-    if ($labels) $_output .= '</label>';
155
+    if ($labels) {
156
+        $_output .= '</label>';
157
+    }
151 158
     $_output .=  $separator;
152 159
 
153 160
     return $_output;
Please login to merge, or discard this patch.
Doc Comments   +8 added lines patch added patch discarded remove patch
@@ -127,6 +127,14 @@
 block discarded – undo
127 127
 
128 128
 }
129 129
 
130
+/**
131
+ * @param string $name
132
+ * @param null|string $selected
133
+ * @param string $extra
134
+ * @param string $separator
135
+ * @param boolean $labels
136
+ * @param boolean $label_ids
137
+ */
130 138
 function smarty_function_html_radios_output($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids) {
131 139
     $_output = '';
132 140
     if ($labels) {
Please login to merge, or discard this patch.
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -130,18 +130,18 @@
 block discarded – undo
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"';
Please login to merge, or discard this patch.
include/Smarty/plugins/function.sugar_getimage.php 3 patches
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -53,28 +53,28 @@
 block discarded – undo
53 53
 
54 54
 function smarty_function_sugar_getimage($params, &$smarty) {
55 55
 
56
-	// error checking for required parameters
57
-	if(!isset($params['name'])) 
58
-		$smarty->trigger_error($GLOBALS['app_strings']['ERR_MISSING_REQUIRED_FIELDS'] . 'name');
56
+    // error checking for required parameters
57
+    if(!isset($params['name'])) 
58
+        $smarty->trigger_error($GLOBALS['app_strings']['ERR_MISSING_REQUIRED_FIELDS'] . 'name');
59 59
 
60
-	// temp hack to deprecate the use of other_attributes
61
-	if(isset($params['other_attributes']))
62
-		$params['attr'] = $params['other_attributes'];
60
+    // temp hack to deprecate the use of other_attributes
61
+    if(isset($params['other_attributes']))
62
+        $params['attr'] = $params['other_attributes'];
63 63
 
64
-	// set defaults
65
-	if(!isset($params['attr']))
66
-		$params['attr'] = '';
67
-	if(!isset($params['width']))
68
-		$params['width'] = null;
69
-	if(!isset($params['height']))
70
-		$params['height'] = null;
71
-	if(!isset($params['alt'])) 
72
-		$params['alt'] = '';
64
+    // set defaults
65
+    if(!isset($params['attr']))
66
+        $params['attr'] = '';
67
+    if(!isset($params['width']))
68
+        $params['width'] = null;
69
+    if(!isset($params['height']))
70
+        $params['height'] = null;
71
+    if(!isset($params['alt'])) 
72
+        $params['alt'] = '';
73 73
 
74
-	// deprecated ?
75
-	if(!isset($params['ext']))
76
-		$params['ext'] = null;
74
+    // deprecated ?
75
+    if(!isset($params['ext']))
76
+        $params['ext'] = null;
77 77
 
78
-	return SugarThemeRegistry::current()->getImage($params['name'], $params['attr'], $params['width'], $params['height'], $params['ext'], $params['alt']);	
78
+    return SugarThemeRegistry::current()->getImage($params['name'], $params['attr'], $params['width'], $params['height'], $params['ext'], $params['alt']);	
79 79
 }
80 80
 ?>
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -54,25 +54,25 @@
 block discarded – undo
54 54
 function smarty_function_sugar_getimage($params, &$smarty) {
55 55
 
56 56
 	// error checking for required parameters
57
-	if(!isset($params['name'])) 
58
-		$smarty->trigger_error($GLOBALS['app_strings']['ERR_MISSING_REQUIRED_FIELDS'] . 'name');
57
+	if (!isset($params['name'])) 
58
+		$smarty->trigger_error($GLOBALS['app_strings']['ERR_MISSING_REQUIRED_FIELDS'].'name');
59 59
 
60 60
 	// temp hack to deprecate the use of other_attributes
61
-	if(isset($params['other_attributes']))
61
+	if (isset($params['other_attributes']))
62 62
 		$params['attr'] = $params['other_attributes'];
63 63
 
64 64
 	// set defaults
65
-	if(!isset($params['attr']))
65
+	if (!isset($params['attr']))
66 66
 		$params['attr'] = '';
67
-	if(!isset($params['width']))
67
+	if (!isset($params['width']))
68 68
 		$params['width'] = null;
69
-	if(!isset($params['height']))
69
+	if (!isset($params['height']))
70 70
 		$params['height'] = null;
71
-	if(!isset($params['alt'])) 
71
+	if (!isset($params['alt'])) 
72 72
 		$params['alt'] = '';
73 73
 
74 74
 	// deprecated ?
75
-	if(!isset($params['ext']))
75
+	if (!isset($params['ext']))
76 76
 		$params['ext'] = null;
77 77
 
78 78
 	return SugarThemeRegistry::current()->getImage($params['name'], $params['attr'], $params['width'], $params['height'], $params['ext'], $params['alt']);	
Please login to merge, or discard this patch.
Braces   +21 added lines, -14 removed lines patch added patch discarded remove patch
@@ -54,26 +54,33 @@
 block discarded – undo
54 54
 function smarty_function_sugar_getimage($params, &$smarty) {
55 55
 
56 56
 	// error checking for required parameters
57
-	if(!isset($params['name'])) 
58
-		$smarty->trigger_error($GLOBALS['app_strings']['ERR_MISSING_REQUIRED_FIELDS'] . 'name');
57
+	if(!isset($params['name'])) {
58
+			$smarty->trigger_error($GLOBALS['app_strings']['ERR_MISSING_REQUIRED_FIELDS'] . 'name');
59
+	}
59 60
 
60 61
 	// temp hack to deprecate the use of other_attributes
61
-	if(isset($params['other_attributes']))
62
-		$params['attr'] = $params['other_attributes'];
62
+	if(isset($params['other_attributes'])) {
63
+			$params['attr'] = $params['other_attributes'];
64
+	}
63 65
 
64 66
 	// set defaults
65
-	if(!isset($params['attr']))
66
-		$params['attr'] = '';
67
-	if(!isset($params['width']))
68
-		$params['width'] = null;
69
-	if(!isset($params['height']))
70
-		$params['height'] = null;
71
-	if(!isset($params['alt'])) 
72
-		$params['alt'] = '';
67
+	if(!isset($params['attr'])) {
68
+			$params['attr'] = '';
69
+	}
70
+	if(!isset($params['width'])) {
71
+			$params['width'] = null;
72
+	}
73
+	if(!isset($params['height'])) {
74
+			$params['height'] = null;
75
+	}
76
+	if(!isset($params['alt'])) {
77
+			$params['alt'] = '';
78
+	}
73 79
 
74 80
 	// deprecated ?
75
-	if(!isset($params['ext']))
76
-		$params['ext'] = null;
81
+	if(!isset($params['ext'])) {
82
+			$params['ext'] = null;
83
+	}
77 84
 
78 85
 	return SugarThemeRegistry::current()->getImage($params['name'], $params['attr'], $params['width'], $params['height'], $params['ext'], $params['alt']);	
79 86
 }
Please login to merge, or discard this patch.