Completed
Push — 1.10.x ( ef999d...bae640 )
by Julito
80:09 queued 50:37
created
main/inc/lib/pear/Text/Diff/Engine/native.php 2 patches
Doc Comments   +5 added lines patch added patch discarded remove patch
@@ -147,6 +147,7 @@  discard block
 block discarded – undo
147 147
      * the two files do not match, and likewise that the last lines do not
148 148
      * match.  The caller must trim matching lines from the beginning and end
149 149
      * of the portions it is going to specify.
150
+     * @param double $nchunks
150 151
      */
151 152
     function _diag ($xoff, $xlim, $yoff, $ylim, $nchunks)
152 153
     {
@@ -267,6 +268,10 @@  discard block
 block discarded – undo
267 268
      *
268 269
      * Note that XLIM, YLIM are exclusive bounds.  All line numbers are
269 270
      * origin-0 and discarded lines are not counted.
271
+     * @param integer $xoff
272
+     * @param integer $xlim
273
+     * @param integer $yoff
274
+     * @param integer $ylim
270 275
      */
271 276
     function _compareseq ($xoff, $xlim, $yoff, $ylim)
272 277
     {
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
      * match.  The caller must trim matching lines from the beginning and end
149 149
      * of the portions it is going to specify.
150 150
      */
151
-    function _diag ($xoff, $xlim, $yoff, $ylim, $nchunks)
151
+    function _diag($xoff, $xlim, $yoff, $ylim, $nchunks)
152 152
     {
153 153
         $flip = false;
154 154
 
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
         }
172 172
 
173 173
         $this->lcs = 0;
174
-        $this->seq[0]= $yoff - 1;
174
+        $this->seq[0] = $yoff - 1;
175 175
         $this->in_seq = array();
176 176
         $ymids[0] = array();
177 177
 
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
                 }
185 185
             }
186 186
 
187
-            $x1 = $xoff + (int)(($numer + ($xlim - $xoff) * $chunk) / $nchunks);
187
+            $x1 = $xoff + (int) (($numer + ($xlim - $xoff) * $chunk) / $nchunks);
188 188
             for (; $x < $x1; $x++) {
189 189
                 $line = $flip ? $this->yv[$x] : $this->xv[$x];
190 190
                 if (empty($ymatches[$line])) {
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
         $seps[] = $flip ? array($yoff, $xoff) : array($xoff, $yoff);
221 221
         $ymid = $ymids[$this->lcs];
222 222
         for ($n = 0; $n < $nchunks - 1; $n++) {
223
-            $x1 = $xoff + (int)(($numer + ($xlim - $xoff) * $n) / $nchunks);
223
+            $x1 = $xoff + (int) (($numer + ($xlim - $xoff) * $n) / $nchunks);
224 224
             $y1 = $ymid[$n] + 1;
225 225
             $seps[] = $flip ? array($y1, $x1) : array($x1, $y1);
226 226
         }
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 
241 241
         $beg = 1;
242 242
         while ($beg < $end) {
243
-            $mid = (int)(($beg + $end) / 2);
243
+            $mid = (int) (($beg + $end) / 2);
244 244
             if ($ypos > $this->seq[$mid]) {
245 245
                 $beg = $mid + 1;
246 246
             } else {
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
      * Note that XLIM, YLIM are exclusive bounds.  All line numbers are
269 269
      * origin-0 and discarded lines are not counted.
270 270
      */
271
-    function _compareseq ($xoff, $xlim, $yoff, $ylim)
271
+    function _compareseq($xoff, $xlim, $yoff, $ylim)
272 272
     {
273 273
         /* Slide down the bottom initial diagonal. */
274 274
         while ($xoff < $xlim && $yoff < $ylim
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
             reset($seps);
310 310
             $pt1 = $seps[0];
311 311
             while ($pt2 = next($seps)) {
312
-                $this->_compareseq ($pt1[0], $pt2[0], $pt1[1], $pt2[1]);
312
+                $this->_compareseq($pt1[0], $pt2[0], $pt1[1], $pt2[1]);
313 313
                 $pt1 = $pt2;
314 314
             }
315 315
         }
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
                 $j++;
353 353
             }
354 354
 
355
-            while ($i < $len && ! $changed[$i]) {
355
+            while ($i < $len && !$changed[$i]) {
356 356
                 assert('$j < $other_len && ! $other_changed[$j]');
357 357
                 $i++; $j++;
358 358
                 while ($j < $other_len && $other_changed[$j]) {
Please login to merge, or discard this patch.
main/inc/lib/pear/Text/Diff/Renderer.php 4 patches
Doc Comments   +9 added lines patch added patch discarded remove patch
@@ -143,6 +143,12 @@  discard block
 block discarded – undo
143 143
         return $output . $this->_endDiff();
144 144
     }
145 145
 
146
+    /**
147
+     * @param integer $xbeg
148
+     * @param integer $xlen
149
+     * @param integer $ybeg
150
+     * @param integer $ylen
151
+     */
146 152
     function _block($xbeg, $xlen, $ybeg, $ylen, &$edits)
147 153
     {
148 154
         $output = $this->_startBlock($this->_blockHeader($xbeg, $xlen, $ybeg, $ylen));
@@ -199,6 +205,9 @@  discard block
 block discarded – undo
199 205
         return $xbeg . ($xlen ? ($ylen ? 'c' : 'd') : 'a') . $ybeg;
200 206
     }
201 207
 
208
+    /**
209
+     * @param string $header
210
+     */
202 211
     function _startBlock($header)
203 212
     {
204 213
         return $header . "\n";
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -104,8 +104,8 @@  discard block
 block discarded – undo
104 104
                         }
105 105
                         /* @todo */
106 106
                         $output .= $this->_block($x0, $ntrail + $xi - $x0,
107
-                                                 $y0, $ntrail + $yi - $y0,
108
-                                                 $block);
107
+                                                    $y0, $ntrail + $yi - $y0,
108
+                                                    $block);
109 109
                         $block = false;
110 110
                     }
111 111
                 }
@@ -136,8 +136,8 @@  discard block
 block discarded – undo
136 136
 
137 137
         if (is_array($block)) {
138 138
             $output .= $this->_block($x0, $xi - $x0,
139
-                                     $y0, $yi - $y0,
140
-                                     $block);
139
+                                        $y0, $yi - $y0,
140
+                                        $block);
141 141
         }
142 142
 
143 143
         return $output . $this->_endDiff();
Please login to merge, or discard this patch.
Switch Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -149,21 +149,21 @@
 block discarded – undo
149 149
 
150 150
         foreach ($edits as $edit) {
151 151
             switch (strtolower(get_class($edit))) {
152
-            case 'text_diff_op_copy':
153
-                $output .= $this->_context($edit->orig);
154
-                break;
152
+                case 'text_diff_op_copy':
153
+                    $output .= $this->_context($edit->orig);
154
+                    break;
155 155
 
156
-            case 'text_diff_op_add':
157
-                $output .= $this->_added($edit->final);
158
-                break;
156
+                case 'text_diff_op_add':
157
+                    $output .= $this->_added($edit->final);
158
+                    break;
159 159
 
160
-            case 'text_diff_op_delete':
161
-                $output .= $this->_deleted($edit->orig);
162
-                break;
160
+                case 'text_diff_op_delete':
161
+                    $output .= $this->_deleted($edit->orig);
162
+                    break;
163 163
 
164
-            case 'text_diff_op_change':
165
-                $output .= $this->_changed($edit->orig, $edit->final);
166
-                break;
164
+                case 'text_diff_op_change':
165
+                    $output .= $this->_changed($edit->orig, $edit->final);
166
+                    break;
167 167
             }
168 168
         }
169 169
 
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
     function Text_Diff_Renderer($params = array())
39 39
     {
40 40
         foreach ($params as $param => $value) {
41
-            $v = '_' . $param;
41
+            $v = '_'.$param;
42 42
             if (isset($this->$v)) {
43 43
                 $this->$v = $value;
44 44
             }
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
                                      $block);
141 141
         }
142 142
 
143
-        return $output . $this->_endDiff();
143
+        return $output.$this->_endDiff();
144 144
     }
145 145
 
146 146
     function _block($xbeg, $xlen, $ybeg, $ylen, &$edits)
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
             }
168 168
         }
169 169
 
170
-        return $output . $this->_endBlock();
170
+        return $output.$this->_endBlock();
171 171
     }
172 172
 
173 173
     function _startDiff()
@@ -183,10 +183,10 @@  discard block
 block discarded – undo
183 183
     function _blockHeader($xbeg, $xlen, $ybeg, $ylen)
184 184
     {
185 185
         if ($xlen > 1) {
186
-            $xbeg .= ',' . ($xbeg + $xlen - 1);
186
+            $xbeg .= ','.($xbeg + $xlen - 1);
187 187
         }
188 188
         if ($ylen > 1) {
189
-            $ybeg .= ',' . ($ybeg + $ylen - 1);
189
+            $ybeg .= ','.($ybeg + $ylen - 1);
190 190
         }
191 191
 
192 192
         // this matches the GNU Diff behaviour
@@ -196,12 +196,12 @@  discard block
 block discarded – undo
196 196
             $xbeg--;
197 197
         }
198 198
 
199
-        return $xbeg . ($xlen ? ($ylen ? 'c' : 'd') : 'a') . $ybeg;
199
+        return $xbeg.($xlen ? ($ylen ? 'c' : 'd') : 'a').$ybeg;
200 200
     }
201 201
 
202 202
     function _startBlock($header)
203 203
     {
204
-        return $header . "\n";
204
+        return $header."\n";
205 205
     }
206 206
 
207 207
     function _endBlock()
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 
212 212
     function _lines($lines, $prefix = ' ')
213 213
     {
214
-        return $prefix . implode("\n$prefix", $lines) . "\n";
214
+        return $prefix.implode("\n$prefix", $lines)."\n";
215 215
     }
216 216
 
217 217
     function _context($lines)
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 
232 232
     function _changed($orig, $final)
233 233
     {
234
-        return $this->_deleted($orig) . "---\n" . $this->_added($final);
234
+        return $this->_deleted($orig)."---\n".$this->_added($final);
235 235
     }
236 236
 
237 237
 }
Please login to merge, or discard this patch.
main/inc/lib/pear/Text/Diff/Renderer/inline.php 3 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -74,6 +74,9 @@  discard block
 block discarded – undo
74 74
         return $header;
75 75
     }
76 76
 
77
+    /**
78
+     * @param string[] $lines
79
+     */
77 80
     function _lines($lines, $prefix = ' ', $encode = true)
78 81
     {
79 82
         if ($encode) {
@@ -141,6 +144,9 @@  discard block
 block discarded – undo
141 144
         return str_replace($nl, "\n", $renderer->render($diff)) . "\n";
142 145
     }
143 146
 
147
+    /**
148
+     * @param string $string
149
+     */
144 150
     function _splitOnWords($string, $newlineEscape = "\n")
145 151
     {
146 152
         // Ignore \0; otherwise the while loop will never finish.
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -129,13 +129,13 @@
 block discarded – undo
129 129
          * preserve whitespace as well. Therefore we split on words,
130 130
          * but include all blocks of whitespace in the wordlist. */
131 131
         $diff = new Text_Diff('native',
132
-                              array($this->_splitOnWords($text1, $nl),
132
+                                array($this->_splitOnWords($text1, $nl),
133 133
                                     $this->_splitOnWords($text2, $nl)));
134 134
 
135 135
         /* Get the diff in inline format. */
136 136
         $renderer = new Text_Diff_Renderer_inline
137 137
             (array_merge($this->getParams(),
138
-                         array('split_level' => 'words')));
138
+                            array('split_level' => 'words')));
139 139
 
140 140
         /* Run the diff and get the output. */
141 141
         return str_replace($nl, "\n", $renderer->render($diff)) . "\n";
Please login to merge, or discard this patch.
Spacing   +6 added lines, -7 removed lines patch added patch discarded remove patch
@@ -83,14 +83,14 @@  discard block
 block discarded – undo
83 83
         if ($this->_split_level == 'words') {
84 84
             return implode('', $lines);
85 85
         } else {
86
-            return implode("\n", $lines) . "\n";
86
+            return implode("\n", $lines)."\n";
87 87
         }
88 88
     }
89 89
 
90 90
     function _added($lines)
91 91
     {
92 92
         array_walk($lines, array(&$this, '_encode'));
93
-        $lines[0] = $this->_ins_prefix . $lines[0];
93
+        $lines[0] = $this->_ins_prefix.$lines[0];
94 94
         $lines[count($lines) - 1] .= $this->_ins_suffix;
95 95
         return $this->_lines($lines, ' ', false);
96 96
     }
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
     function _deleted($lines, $words = false)
99 99
     {
100 100
         array_walk($lines, array(&$this, '_encode'));
101
-        $lines[0] = $this->_del_prefix . $lines[0];
101
+        $lines[0] = $this->_del_prefix.$lines[0];
102 102
         $lines[count($lines) - 1] .= $this->_del_suffix;
103 103
         return $this->_lines($lines, ' ', false);
104 104
     }
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
                 $orig[0] = substr($orig[0], 1);
117 117
                 $final[0] = substr($final[0], 1);
118 118
             }
119
-            return $prefix . $this->_deleted($orig) . $this->_added($final);
119
+            return $prefix.$this->_deleted($orig).$this->_added($final);
120 120
         }
121 121
 
122 122
         $text1 = implode("\n", $orig);
@@ -133,12 +133,11 @@  discard block
 block discarded – undo
133 133
                                     $this->_splitOnWords($text2, $nl)));
134 134
 
135 135
         /* Get the diff in inline format. */
136
-        $renderer = new Text_Diff_Renderer_inline
137
-            (array_merge($this->getParams(),
136
+        $renderer = new Text_Diff_Renderer_inline(array_merge($this->getParams(),
138 137
                          array('split_level' => 'words')));
139 138
 
140 139
         /* Run the diff and get the output. */
141
-        return str_replace($nl, "\n", $renderer->render($diff)) . "\n";
140
+        return str_replace($nl, "\n", $renderer->render($diff))."\n";
142 141
     }
143 142
 
144 143
     function _splitOnWords($string, $newlineEscape = "\n")
Please login to merge, or discard this patch.
main/inc/lib/pear/Text/Password.php 4 patches
Doc Comments   +10 added lines patch added patch discarded remove patch
@@ -180,6 +180,7 @@  discard block
 block discarded – undo
180 180
      * @access private
181 181
      * @param  string  Login
182 182
      * @param  integer Key
183
+     * @param integer $key
183 184
      * @return string
184 185
      */
185 186
     function _xor($login, $key)
@@ -208,6 +209,7 @@  discard block
 block discarded – undo
208 209
      * @access private
209 210
      * @param  string  Login
210 211
      * @param  integer Key
212
+     * @param integer $key
211 213
      * @return string
212 214
      */
213 215
     function _rotx($login, $key)
@@ -241,6 +243,7 @@  discard block
 block discarded – undo
241 243
      * @access private
242 244
      * @param  string  Login
243 245
      * @param  integer Key
246
+     * @param integer $key
244 247
      * @return string
245 248
      */
246 249
     function _rotxpp($login, $key)
@@ -274,6 +277,7 @@  discard block
 block discarded – undo
274 277
      * @access private
275 278
      * @param  string  Login
276 279
      * @param  integer Key
280
+     * @param integer $key
277 281
      * @return string
278 282
      */
279 283
     function _rotxmm($login, $key)
@@ -306,6 +310,7 @@  discard block
 block discarded – undo
306 310
      * @access private
307 311
      * @param  string  Login
308 312
      * @param  integer Key
313
+     * @param integer $key
309 314
      * @return string
310 315
      */
311 316
     function _asciiRotx($login, $key)
@@ -340,6 +345,7 @@  discard block
 block discarded – undo
340 345
      * @access private
341 346
      * @param  string  Login
342 347
      * @param  integer Key
348
+     * @param integer $key
343 349
      * @return string
344 350
      */
345 351
     function _asciiRotxpp($login, $key)
@@ -374,6 +380,7 @@  discard block
 block discarded – undo
374 380
      * @access private
375 381
      * @param  string  Login
376 382
      * @param  integer Key
383
+     * @param integer $key
377 384
      * @return string
378 385
      */
379 386
     function _asciiRotxmm($login, $key)
@@ -430,6 +437,7 @@  discard block
 block discarded – undo
430 437
      *
431 438
      * @access private
432 439
      * @param  integer Length of the password
440
+     * @param integer $length
433 441
      * @return string  Returns the password
434 442
      */
435 443
     function _createPronounceable($length)
@@ -475,6 +483,8 @@  discard block
 block discarded – undo
475 483
      * @param  string  Character which could be use in the
476 484
      *                 unpronounceable password ex : 'ABCDEFG'
477 485
      *                 or numeric, alphabetical or alphanumeric.
486
+     * @param integer $length
487
+     * @param string $chars
478 488
      * @return string  Returns the password
479 489
      */
480 490
     function _createUnpronounceable($length, $chars)
Please login to merge, or discard this patch.
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -441,17 +441,17 @@  discard block
 block discarded – undo
441 441
          * List of vowels and vowel sounds
442 442
          */
443 443
         $v = array('a', 'e', 'i', 'o', 'u', 'ae', 'ou', 'io',
444
-                   'ea', 'ou', 'ia', 'ai'
445
-                   );
444
+                    'ea', 'ou', 'ia', 'ai'
445
+                    );
446 446
 
447 447
         /**
448 448
          * List of consonants and consonant sounds
449 449
          */
450 450
         $c = array('b', 'c', 'd', 'g', 'h', 'j', 'k', 'l', 'm',
451
-                   'n', 'p', 'r', 's', 't', 'u', 'v', 'w',
452
-                   'tr', 'cr', 'fr', 'dr', 'wr', 'pr', 'th',
453
-                   'ch', 'ph', 'st', 'sl', 'cl'
454
-                   );
451
+                    'n', 'p', 'r', 's', 't', 'u', 'v', 'w',
452
+                    'tr', 'cr', 'fr', 'dr', 'wr', 'pr', 'th',
453
+                    'ch', 'ph', 'st', 'sl', 'cl'
454
+                    );
455 455
 
456 456
         $v_count = 12;
457 457
         $c_count = 29;
@@ -484,50 +484,50 @@  discard block
 block discarded – undo
484 484
         /**
485 485
          * List of character which could be use in the password
486 486
          */
487
-         switch($chars) {
487
+            switch($chars) {
488 488
 
489
-         case 'alphanumeric':
489
+            case 'alphanumeric':
490 490
              $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
491
-             $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 62;
492
-             break;
491
+                $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 62;
492
+                break;
493 493
 
494
-         case 'alphabetical':
494
+            case 'alphabetical':
495 495
              $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
496
-             $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 52;
497
-             break;
496
+                $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 52;
497
+                break;
498 498
 
499
-         case 'numeric':
499
+            case 'numeric':
500 500
              $chars = '0123456789';
501
-             $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 10;
502
-             break;
501
+                $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 10;
502
+                break;
503 503
 
504
-         case '':
504
+            case '':
505 505
              $chars = '_#@%&ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
506
-             $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 67;
507
-             break;
506
+                $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 67;
507
+                break;
508 508
 
509
-         default:
509
+            default:
510 510
              /**
511 511
               * Some characters shouldn't be used
512 512
               */
513 513
              $chars = trim($chars);
514
-             $chars = str_replace(array('+', '|', '$', '^', '/', '\\', ','), '', $chars);
515
-
516
-             $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = strlen($chars);
517
-         }
518
-
519
-         /**
520
-          * Generate password
521
-          */
522
-         for ($i = 0; $i < $length; $i++) {
523
-             $num = mt_rand(0, $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] - 1);
524
-             $password .= $chars{$num};
525
-         }
526
-
527
-         /**
528
-          * Return password
529
-          */
530
-         return $password;
514
+                $chars = str_replace(array('+', '|', '$', '^', '/', '\\', ','), '', $chars);
515
+
516
+                $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = strlen($chars);
517
+            }
518
+
519
+            /**
520
+             * Generate password
521
+             */
522
+            for ($i = 0; $i < $length; $i++) {
523
+                $num = mt_rand(0, $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] - 1);
524
+                $password .= $chars{$num};
525
+            }
526
+
527
+            /**
528
+             * Return password
529
+             */
530
+            return $password;
531 531
     }
532 532
 }
533 533
 ?>
Please login to merge, or discard this patch.
Switch Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -55,12 +55,12 @@  discard block
 block discarded – undo
55 55
     function create($length = 10, $type = 'pronounceable', $chars = '')
56 56
     {
57 57
         switch ($type) {
58
-        case 'unpronounceable' :
59
-            return Text_Password::_createUnpronounceable($length, $chars);
58
+            case 'unpronounceable' :
59
+                return Text_Password::_createUnpronounceable($length, $chars);
60 60
 
61
-        case 'pronounceable' :
62
-        default :
63
-            return Text_Password::_createPronounceable($length);
61
+            case 'pronounceable' :
62
+            default :
63
+                return Text_Password::_createPronounceable($length);
64 64
         }
65 65
     }
66 66
 
@@ -110,35 +110,35 @@  discard block
 block discarded – undo
110 110
     function createFromLogin($login, $type, $key = 0)
111 111
     {
112 112
         switch ($type) {
113
-        case 'reverse':
114
-            return strrev($login);
113
+            case 'reverse':
114
+                return strrev($login);
115 115
 
116
-        case 'shuffle':
117
-            return Text_Password::_shuffle($login);
116
+            case 'shuffle':
117
+                return Text_Password::_shuffle($login);
118 118
 
119
-        case 'xor':
120
-            return Text_Password::_xor($login, $key);
119
+            case 'xor':
120
+                return Text_Password::_xor($login, $key);
121 121
 
122
-        case 'rot13':
123
-            return str_rot13($login);
122
+            case 'rot13':
123
+                return str_rot13($login);
124 124
 
125
-        case 'rotx':
126
-            return Text_Password::_rotx($login, $key);
125
+            case 'rotx':
126
+                return Text_Password::_rotx($login, $key);
127 127
 
128
-        case 'rotx++':
129
-            return Text_Password::_rotxpp($login, $key);
128
+            case 'rotx++':
129
+                return Text_Password::_rotxpp($login, $key);
130 130
 
131
-        case 'rotx--':
132
-            return Text_Password::_rotxmm($login, $key);
131
+            case 'rotx--':
132
+                return Text_Password::_rotxmm($login, $key);
133 133
 
134
-        case 'ascii_rotx':
135
-            return Text_Password::_asciiRotx($login, $key);
134
+            case 'ascii_rotx':
135
+                return Text_Password::_asciiRotx($login, $key);
136 136
 
137
-        case 'ascii_rotx++':
138
-            return Text_Password::_asciiRotxpp($login, $key);
137
+            case 'ascii_rotx++':
138
+                return Text_Password::_asciiRotxpp($login, $key);
139 139
 
140
-        case 'ascii_rotx--':
141
-            return Text_Password::_asciiRotxmm($login, $key);
140
+            case 'ascii_rotx--':
141
+                return Text_Password::_asciiRotxmm($login, $key);
142 142
         }
143 143
     }
144 144
 
@@ -320,11 +320,11 @@  discard block
 block discarded – undo
320 320
                 $next += 255;
321 321
             }
322 322
             switch ($next) { // delete white space
323
-            case 0x09:
324
-            case 0x20:
325
-            case 0x0A:
326
-            case 0x0D:
327
-                $next++;
323
+                case 0x09:
324
+                case 0x20:
325
+                case 0x0A:
326
+                case 0x0D:
327
+                    $next++;
328 328
             }
329 329
             $tmp .= chr($next);
330 330
         }
@@ -354,11 +354,11 @@  discard block
 block discarded – undo
354 354
                 $next += 255;
355 355
             }
356 356
             switch ($next) { // delete white space
357
-            case 0x09:
358
-            case 0x20:
359
-            case 0x0A:
360
-            case 0x0D:
361
-                $next++;
357
+                case 0x09:
358
+                case 0x20:
359
+                case 0x0A:
360
+                case 0x0D:
361
+                    $next++;
362 362
             }
363 363
             $tmp .= chr($next);
364 364
         }
@@ -388,11 +388,11 @@  discard block
 block discarded – undo
388 388
                 $next += 255;
389 389
             }
390 390
             switch ($next) { // delete white space
391
-            case 0x09:
392
-            case 0x20:
393
-            case 0x0A:
394
-            case 0x0D:
395
-                $next++;
391
+                case 0x09:
392
+                case 0x20:
393
+                case 0x0A:
394
+                case 0x0D:
395
+                    $next++;
396 396
             }
397 397
             $tmp .= chr($next);
398 398
         }
@@ -486,34 +486,34 @@  discard block
 block discarded – undo
486 486
          */
487 487
          switch($chars) {
488 488
 
489
-         case 'alphanumeric':
490
-             $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
491
-             $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 62;
492
-             break;
489
+             case 'alphanumeric':
490
+                 $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
491
+                 $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 62;
492
+                 break;
493 493
 
494
-         case 'alphabetical':
495
-             $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
496
-             $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 52;
497
-             break;
494
+             case 'alphabetical':
495
+                 $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
496
+                 $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 52;
497
+                 break;
498 498
 
499
-         case 'numeric':
500
-             $chars = '0123456789';
501
-             $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 10;
502
-             break;
499
+             case 'numeric':
500
+                 $chars = '0123456789';
501
+                 $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 10;
502
+                 break;
503 503
 
504
-         case '':
505
-             $chars = '_#@%&ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
506
-             $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 67;
507
-             break;
504
+             case '':
505
+                 $chars = '_#@%&ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
506
+                 $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 67;
507
+                 break;
508 508
 
509
-         default:
510
-             /**
509
+             default:
510
+                 /**
511 511
               * Some characters shouldn't be used
512 512
               */
513
-             $chars = trim($chars);
514
-             $chars = str_replace(array('+', '|', '$', '^', '/', '\\', ','), '', $chars);
513
+                 $chars = trim($chars);
514
+                 $chars = str_replace(array('+', '|', '$', '^', '/', '\\', ','), '', $chars);
515 515
 
516
-             $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = strlen($chars);
516
+                 $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = strlen($chars);
517 517
          }
518 518
 
519 519
          /**
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
         $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = $v_count + $c_count;
460 460
 
461 461
         for ($i = 0; $i < $length; $i++) {
462
-            $retVal .= $c[mt_rand(0, $c_count-1)] . $v[mt_rand(0, $v_count-1)];
462
+            $retVal .= $c[mt_rand(0, $c_count - 1)].$v[mt_rand(0, $v_count - 1)];
463 463
         }
464 464
 
465 465
         return substr($retVal, 0, $length);
@@ -484,7 +484,7 @@  discard block
 block discarded – undo
484 484
         /**
485 485
          * List of character which could be use in the password
486 486
          */
487
-         switch($chars) {
487
+         switch ($chars) {
488 488
 
489 489
          case 'alphanumeric':
490 490
              $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
Please login to merge, or discard this patch.
main/inc/lib/phpmailer/class.phpmailer.php 4 patches
Doc Comments   +15 added lines, -3 removed lines patch added patch discarded remove patch
@@ -891,6 +891,7 @@  discard block
 block discarded – undo
891 891
   /**
892 892
    * Creates recipient headers.
893 893
    * @access public
894
+   * @param string $type
894 895
    * @return string
895 896
    */
896 897
   public function AddrAppend($type, $addr) {
@@ -1258,6 +1259,9 @@  discard block
 block discarded – undo
1258 1259
   /**
1259 1260
    * Returns the start of a message boundary.
1260 1261
    * @access private
1262
+   * @param string $charSet
1263
+   * @param string $contentType
1264
+   * @param string $encoding
1261 1265
    */
1262 1266
   private function GetBoundary($boundary, $charSet, $contentType, $encoding) {
1263 1267
     $result = '';
@@ -1311,6 +1315,7 @@  discard block
 block discarded – undo
1311 1315
   /**
1312 1316
    *  Returns a formatted header line.
1313 1317
    * @access public
1318
+   * @param string $name
1314 1319
    * @return string
1315 1320
    */
1316 1321
   public function HeaderLine($name, $value) {
@@ -1320,6 +1325,7 @@  discard block
 block discarded – undo
1320 1325
   /**
1321 1326
    * Returns a formatted mail line.
1322 1327
    * @access public
1328
+   * @param string $value
1323 1329
    * @return string
1324 1330
    */
1325 1331
   public function TextLine($value) {
@@ -1521,6 +1527,7 @@  discard block
 block discarded – undo
1521 1527
   /**
1522 1528
    * Encode a header string to best (shortest) of Q, B, quoted or none.
1523 1529
    * @access public
1530
+   * @param string $str
1524 1531
    * @return string
1525 1532
    */
1526 1533
   public function EncodeHeader($str, $position = 'text') {
@@ -1647,7 +1654,6 @@  discard block
 block discarded – undo
1647 1654
   * Encode string to quoted-printable.
1648 1655
   * Only uses standard PHP, slow, but will always work
1649 1656
   * @access public
1650
-  * @param string $string the text to encode
1651 1657
   * @param integer $line_max Number of chars allowed on a line before wrapping
1652 1658
   * @return string
1653 1659
   */
@@ -1917,6 +1923,7 @@  discard block
 block discarded – undo
1917 1923
   /**
1918 1924
    * Adds the error message to the error container.
1919 1925
    * @access protected
1926
+   * @param string $msg
1920 1927
    * @return void
1921 1928
    */
1922 1929
   protected function SetError($msg) {
@@ -1966,6 +1973,7 @@  discard block
 block discarded – undo
1966 1973
   /**
1967 1974
    * Returns a message in the appropriate language.
1968 1975
    * @access private
1976
+   * @param string $key
1969 1977
    * @return string
1970 1978
    */
1971 1979
   private function Lang($key) {
@@ -1992,6 +2000,7 @@  discard block
 block discarded – undo
1992 2000
   /**
1993 2001
    * Changes every end of line from CR or LF to CRLF.
1994 2002
    * @access private
2003
+   * @param string $str
1995 2004
    * @return string
1996 2005
    */
1997 2006
   private function FixEOL($str) {
@@ -2203,8 +2212,6 @@  discard block
 block discarded – undo
2203 2212
    * Set the private key file and password to sign the message.
2204 2213
    *
2205 2214
    * @access public
2206
-   * @param string $key_filename Parameter File Name
2207
-   * @param string $key_pass Password for private key
2208 2215
    */
2209 2216
   public function DKIM_QP($txt) {
2210 2217
     $tmp="";
@@ -2318,6 +2325,11 @@  discard block
 block discarded – undo
2318 2325
     return "X-PHPMAILER-DKIM: phpmailer.worxware.com\r\n".$dkimhdrs.$signed."\r\n";
2319 2326
   }
2320 2327
 
2328
+  /**
2329
+   * @param integer $isSent
2330
+   * @param string $subject
2331
+   * @param string $body
2332
+   */
2321 2333
   protected function doCallback($isSent,$to,$cc,$bcc,$subject,$body) {
2322 2334
     if (!empty($this->action_function) && function_exists($this->action_function)) {
2323 2335
       $params = array($isSent,$to,$cc,$bcc,$subject,$body);
Please login to merge, or discard this patch.
Indentation   +1454 added lines, -1454 removed lines patch added patch discarded remove patch
@@ -42,441 +42,441 @@  discard block
 block discarded – undo
42 42
 
43 43
 class PHPMailer {
44 44
 
45
-  /////////////////////////////////////////////////
46
-  // PROPERTIES, PUBLIC
47
-  /////////////////////////////////////////////////
48
-
49
-  /**
50
-   * Email priority (1 = High, 3 = Normal, 5 = low).
51
-   * @var int
52
-   */
53
-  public $Priority          = 3;
54
-
55
-  /**
56
-   * Sets the CharSet of the message.
57
-   * @var string
58
-   */
59
-  public $CharSet           = 'iso-8859-1';
60
-
61
-  /**
62
-   * Sets the Content-type of the message.
63
-   * @var string
64
-   */
65
-  public $ContentType       = 'text/plain';
66
-
67
-  /**
68
-   * Sets the Encoding of the message. Options for this are
69
-   *  "8bit", "7bit", "binary", "base64", and "quoted-printable".
70
-   * @var string
71
-   */
72
-  public $Encoding          = '8bit';
73
-
74
-  /**
75
-   * Holds the most recent mailer error message.
76
-   * @var string
77
-   */
78
-  public $ErrorInfo         = '';
79
-
80
-  /**
81
-   * Sets the From email address for the message.
82
-   * @var string
83
-   */
84
-  public $From              = 'root@localhost';
85
-
86
-  /**
87
-   * Sets the From name of the message.
88
-   * @var string
89
-   */
90
-  public $FromName          = 'Root User';
91
-
92
-  /**
93
-   * Sets the Sender email (Return-Path) of the message.  If not empty,
94
-   * will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode.
95
-   * @var string
96
-   */
97
-  public $Sender            = '';
98
-
99
-  /**
100
-   * Sets the Subject of the message.
101
-   * @var string
102
-   */
103
-  public $Subject           = '';
104
-
105
-  /**
106
-   * Sets the Body of the message.  This can be either an HTML or text body.
107
-   * If HTML then run IsHTML(true).
108
-   * @var string
109
-   */
110
-  public $Body              = '';
111
-
112
-  /**
113
-   * Sets the text-only body of the message.  This automatically sets the
114
-   * email to multipart/alternative.  This body can be read by mail
115
-   * clients that do not have HTML email capability such as mutt. Clients
116
-   * that can read HTML will view the normal Body.
117
-   * @var string
118
-   */
119
-  public $AltBody           = '';
120
-
121
-  /**
122
-   * Sets word wrapping on the body of the message to a given number of
123
-   * characters.
124
-   * @var int
125
-   */
126
-  public $WordWrap          = 0;
127
-
128
-  /**
129
-   * Method to send mail: ("mail", "sendmail", or "smtp").
130
-   * @var string
131
-   */
132
-  public $Mailer            = 'mail';
133
-
134
-  /**
135
-   * Sets the path of the sendmail program.
136
-   * @var string
137
-   */
138
-  public $Sendmail          = '/usr/sbin/sendmail';
139
-
140
-  /**
141
-   * Path to PHPMailer plugins.  Useful if the SMTP class
142
-   * is in a different directory than the PHP include path.
143
-   * @var string
144
-   */
145
-  public $PluginDir         = '';
146
-
147
-  /**
148
-   * Sets the email address that a reading confirmation will be sent.
149
-   * @var string
150
-   */
151
-  public $ConfirmReadingTo  = '';
152
-
153
-  /**
154
-   * Sets the hostname to use in Message-Id and Received headers
155
-   * and as default HELO string. If empty, the value returned
156
-   * by SERVER_NAME is used or 'localhost.localdomain'.
157
-   * @var string
158
-   */
159
-  public $Hostname          = '';
160
-
161
-  /**
162
-   * Sets the message ID to be used in the Message-Id header.
163
-   * If empty, a unique id will be generated.
164
-   * @var string
165
-   */
166
-  public $MessageID         = '';
167
-
168
-  /////////////////////////////////////////////////
169
-  // PROPERTIES FOR SMTP
170
-  /////////////////////////////////////////////////
171
-
172
-  /**
173
-   * Sets the SMTP hosts.  All hosts must be separated by a
174
-   * semicolon.  You can also specify a different port
175
-   * for each host by using this format: [hostname:port]
176
-   * (e.g. "smtp1.example.com:25;smtp2.example.com").
177
-   * Hosts will be tried in order.
178
-   * @var string
179
-   */
180
-  public $Host          = 'localhost';
181
-
182
-  /**
183
-   * Sets the default SMTP server port.
184
-   * @var int
185
-   */
186
-  public $Port          = 25;
187
-
188
-  /**
189
-   * Sets the SMTP HELO of the message (Default is $Hostname).
190
-   * @var string
191
-   */
192
-  public $Helo          = '';
193
-
194
-  /**
195
-   * Sets connection prefix.
196
-   * Options are "", "ssl" or "tls"
197
-   * @var string
198
-   */
199
-  public $SMTPSecure    = '';
200
-
201
-  /**
202
-   * Sets SMTP authentication. Utilizes the Username and Password variables.
203
-   * @var bool
204
-   */
205
-  public $SMTPAuth      = false;
206
-
207
-  /**
208
-   * Sets SMTP username.
209
-   * @var string
210
-   */
211
-  public $Username      = '';
212
-
213
-  /**
214
-   * Sets SMTP password.
215
-   * @var string
216
-   */
217
-  public $Password      = '';
218
-
219
-  /**
220
-   * Sets the SMTP server timeout in seconds.
221
-   * This function will not work with the win32 version.
222
-   * @var int
223
-   */
224
-  public $Timeout       = 10;
225
-
226
-  /**
227
-   * Sets SMTP class debugging on or off.
228
-   * @var bool
229
-   */
230
-  public $SMTPDebug     = false;
231
-
232
-  /**
233
-   * Prevents the SMTP connection from being closed after each mail
234
-   * sending.  If this is set to true then to close the connection
235
-   * requires an explicit call to SmtpClose().
236
-   * @var bool
237
-   */
238
-  public $SMTPKeepAlive = false;
239
-
240
-  /**
241
-   * Provides the ability to have the TO field process individual
242
-   * emails, instead of sending to entire TO addresses
243
-   * @var bool
244
-   */
245
-  public $SingleTo      = false;
246
-
247
-   /**
248
-   * If SingleTo is true, this provides the array to hold the email addresses
249
-   * @var bool
250
-   */
251
-  public $SingleToArray = array();
252
-
253
- /**
254
-   * Provides the ability to change the line ending
255
-   * @var string
256
-   */
257
-  public $LE              = "\n";
258
-
259
-  /**
260
-   * Used with DKIM DNS Resource Record
261
-   * @var string
262
-   */
263
-  public $DKIM_selector   = 'phpmailer';
264
-
265
-  /**
266
-   * Used with DKIM DNS Resource Record
267
-   * optional, in format of email address '[email protected]'
268
-   * @var string
269
-   */
270
-  public $DKIM_identity   = '';
271
-
272
-  /**
273
-   * Used with DKIM DNS Resource Record
274
-   * optional, in format of email address '[email protected]'
275
-   * @var string
276
-   */
277
-  public $DKIM_domain     = '';
278
-
279
-  /**
280
-   * Used with DKIM DNS Resource Record
281
-   * optional, in format of email address '[email protected]'
282
-   * @var string
283
-   */
284
-  public $DKIM_private    = '';
285
-
286
-  /**
287
-   * Callback Action function name
288
-   * the function that handles the result of the send email action. Parameters:
289
-   *   bool    $result        result of the send action
290
-   *   string  $to            email address of the recipient
291
-   *   string  $cc            cc email addresses
292
-   *   string  $bcc           bcc email addresses
293
-   *   string  $subject       the subject
294
-   *   string  $body          the email body
295
-   * @var string
296
-   */
297
-  public $action_function = ''; //'callbackAction';
298
-
299
-  /**
300
-   * Sets the PHPMailer Version number
301
-   * @var string
302
-   */
303
-  public $Version         = '5.1';
304
-
305
-  /////////////////////////////////////////////////
306
-  // PROPERTIES, PRIVATE AND PROTECTED
307
-  /////////////////////////////////////////////////
308
-
309
-  private   $smtp           = NULL;
310
-  private   $to             = array();
311
-  private   $cc             = array();
312
-  private   $bcc            = array();
313
-  private   $ReplyTo        = array();
314
-  private   $all_recipients = array();
315
-  private   $attachment     = array();
316
-  private   $CustomHeader   = array();
317
-  private   $message_type   = '';
318
-  private   $boundary       = array();
319
-  protected $language       = array();
320
-  private   $error_count    = 0;
321
-  private   $sign_cert_file = "";
322
-  private   $sign_key_file  = "";
323
-  private   $sign_key_pass  = "";
324
-  private   $exceptions     = false;
325
-
326
-  /////////////////////////////////////////////////
327
-  // CONSTANTS
328
-  /////////////////////////////////////////////////
329
-
330
-  const STOP_MESSAGE  = 0; // message only, continue processing
331
-  const STOP_CONTINUE = 1; // message?, likely ok to continue processing
332
-  const STOP_CRITICAL = 2; // message, plus full stop, critical error reached
333
-
334
-  /////////////////////////////////////////////////
335
-  // METHODS, VARIABLES
336
-  /////////////////////////////////////////////////
337
-
338
-  /**
339
-   * Constructor
340
-   * @param boolean $exceptions Should we throw external exceptions?
341
-   */
342
-  public function __construct($exceptions = false) {
45
+    /////////////////////////////////////////////////
46
+    // PROPERTIES, PUBLIC
47
+    /////////////////////////////////////////////////
48
+
49
+    /**
50
+     * Email priority (1 = High, 3 = Normal, 5 = low).
51
+     * @var int
52
+     */
53
+    public $Priority          = 3;
54
+
55
+    /**
56
+     * Sets the CharSet of the message.
57
+     * @var string
58
+     */
59
+    public $CharSet           = 'iso-8859-1';
60
+
61
+    /**
62
+     * Sets the Content-type of the message.
63
+     * @var string
64
+     */
65
+    public $ContentType       = 'text/plain';
66
+
67
+    /**
68
+     * Sets the Encoding of the message. Options for this are
69
+     *  "8bit", "7bit", "binary", "base64", and "quoted-printable".
70
+     * @var string
71
+     */
72
+    public $Encoding          = '8bit';
73
+
74
+    /**
75
+     * Holds the most recent mailer error message.
76
+     * @var string
77
+     */
78
+    public $ErrorInfo         = '';
79
+
80
+    /**
81
+     * Sets the From email address for the message.
82
+     * @var string
83
+     */
84
+    public $From              = 'root@localhost';
85
+
86
+    /**
87
+     * Sets the From name of the message.
88
+     * @var string
89
+     */
90
+    public $FromName          = 'Root User';
91
+
92
+    /**
93
+     * Sets the Sender email (Return-Path) of the message.  If not empty,
94
+     * will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode.
95
+     * @var string
96
+     */
97
+    public $Sender            = '';
98
+
99
+    /**
100
+     * Sets the Subject of the message.
101
+     * @var string
102
+     */
103
+    public $Subject           = '';
104
+
105
+    /**
106
+     * Sets the Body of the message.  This can be either an HTML or text body.
107
+     * If HTML then run IsHTML(true).
108
+     * @var string
109
+     */
110
+    public $Body              = '';
111
+
112
+    /**
113
+     * Sets the text-only body of the message.  This automatically sets the
114
+     * email to multipart/alternative.  This body can be read by mail
115
+     * clients that do not have HTML email capability such as mutt. Clients
116
+     * that can read HTML will view the normal Body.
117
+     * @var string
118
+     */
119
+    public $AltBody           = '';
120
+
121
+    /**
122
+     * Sets word wrapping on the body of the message to a given number of
123
+     * characters.
124
+     * @var int
125
+     */
126
+    public $WordWrap          = 0;
127
+
128
+    /**
129
+     * Method to send mail: ("mail", "sendmail", or "smtp").
130
+     * @var string
131
+     */
132
+    public $Mailer            = 'mail';
133
+
134
+    /**
135
+     * Sets the path of the sendmail program.
136
+     * @var string
137
+     */
138
+    public $Sendmail          = '/usr/sbin/sendmail';
139
+
140
+    /**
141
+     * Path to PHPMailer plugins.  Useful if the SMTP class
142
+     * is in a different directory than the PHP include path.
143
+     * @var string
144
+     */
145
+    public $PluginDir         = '';
146
+
147
+    /**
148
+     * Sets the email address that a reading confirmation will be sent.
149
+     * @var string
150
+     */
151
+    public $ConfirmReadingTo  = '';
152
+
153
+    /**
154
+     * Sets the hostname to use in Message-Id and Received headers
155
+     * and as default HELO string. If empty, the value returned
156
+     * by SERVER_NAME is used or 'localhost.localdomain'.
157
+     * @var string
158
+     */
159
+    public $Hostname          = '';
160
+
161
+    /**
162
+     * Sets the message ID to be used in the Message-Id header.
163
+     * If empty, a unique id will be generated.
164
+     * @var string
165
+     */
166
+    public $MessageID         = '';
167
+
168
+    /////////////////////////////////////////////////
169
+    // PROPERTIES FOR SMTP
170
+    /////////////////////////////////////////////////
171
+
172
+    /**
173
+     * Sets the SMTP hosts.  All hosts must be separated by a
174
+     * semicolon.  You can also specify a different port
175
+     * for each host by using this format: [hostname:port]
176
+     * (e.g. "smtp1.example.com:25;smtp2.example.com").
177
+     * Hosts will be tried in order.
178
+     * @var string
179
+     */
180
+    public $Host          = 'localhost';
181
+
182
+    /**
183
+     * Sets the default SMTP server port.
184
+     * @var int
185
+     */
186
+    public $Port          = 25;
187
+
188
+    /**
189
+     * Sets the SMTP HELO of the message (Default is $Hostname).
190
+     * @var string
191
+     */
192
+    public $Helo          = '';
193
+
194
+    /**
195
+     * Sets connection prefix.
196
+     * Options are "", "ssl" or "tls"
197
+     * @var string
198
+     */
199
+    public $SMTPSecure    = '';
200
+
201
+    /**
202
+     * Sets SMTP authentication. Utilizes the Username and Password variables.
203
+     * @var bool
204
+     */
205
+    public $SMTPAuth      = false;
206
+
207
+    /**
208
+     * Sets SMTP username.
209
+     * @var string
210
+     */
211
+    public $Username      = '';
212
+
213
+    /**
214
+     * Sets SMTP password.
215
+     * @var string
216
+     */
217
+    public $Password      = '';
218
+
219
+    /**
220
+     * Sets the SMTP server timeout in seconds.
221
+     * This function will not work with the win32 version.
222
+     * @var int
223
+     */
224
+    public $Timeout       = 10;
225
+
226
+    /**
227
+     * Sets SMTP class debugging on or off.
228
+     * @var bool
229
+     */
230
+    public $SMTPDebug     = false;
231
+
232
+    /**
233
+     * Prevents the SMTP connection from being closed after each mail
234
+     * sending.  If this is set to true then to close the connection
235
+     * requires an explicit call to SmtpClose().
236
+     * @var bool
237
+     */
238
+    public $SMTPKeepAlive = false;
239
+
240
+    /**
241
+     * Provides the ability to have the TO field process individual
242
+     * emails, instead of sending to entire TO addresses
243
+     * @var bool
244
+     */
245
+    public $SingleTo      = false;
246
+
247
+    /**
248
+     * If SingleTo is true, this provides the array to hold the email addresses
249
+     * @var bool
250
+     */
251
+    public $SingleToArray = array();
252
+
253
+    /**
254
+     * Provides the ability to change the line ending
255
+     * @var string
256
+     */
257
+    public $LE              = "\n";
258
+
259
+    /**
260
+     * Used with DKIM DNS Resource Record
261
+     * @var string
262
+     */
263
+    public $DKIM_selector   = 'phpmailer';
264
+
265
+    /**
266
+     * Used with DKIM DNS Resource Record
267
+     * optional, in format of email address '[email protected]'
268
+     * @var string
269
+     */
270
+    public $DKIM_identity   = '';
271
+
272
+    /**
273
+     * Used with DKIM DNS Resource Record
274
+     * optional, in format of email address '[email protected]'
275
+     * @var string
276
+     */
277
+    public $DKIM_domain     = '';
278
+
279
+    /**
280
+     * Used with DKIM DNS Resource Record
281
+     * optional, in format of email address '[email protected]'
282
+     * @var string
283
+     */
284
+    public $DKIM_private    = '';
285
+
286
+    /**
287
+     * Callback Action function name
288
+     * the function that handles the result of the send email action. Parameters:
289
+     *   bool    $result        result of the send action
290
+     *   string  $to            email address of the recipient
291
+     *   string  $cc            cc email addresses
292
+     *   string  $bcc           bcc email addresses
293
+     *   string  $subject       the subject
294
+     *   string  $body          the email body
295
+     * @var string
296
+     */
297
+    public $action_function = ''; //'callbackAction';
298
+
299
+    /**
300
+     * Sets the PHPMailer Version number
301
+     * @var string
302
+     */
303
+    public $Version         = '5.1';
304
+
305
+    /////////////////////////////////////////////////
306
+    // PROPERTIES, PRIVATE AND PROTECTED
307
+    /////////////////////////////////////////////////
308
+
309
+    private   $smtp           = NULL;
310
+    private   $to             = array();
311
+    private   $cc             = array();
312
+    private   $bcc            = array();
313
+    private   $ReplyTo        = array();
314
+    private   $all_recipients = array();
315
+    private   $attachment     = array();
316
+    private   $CustomHeader   = array();
317
+    private   $message_type   = '';
318
+    private   $boundary       = array();
319
+    protected $language       = array();
320
+    private   $error_count    = 0;
321
+    private   $sign_cert_file = "";
322
+    private   $sign_key_file  = "";
323
+    private   $sign_key_pass  = "";
324
+    private   $exceptions     = false;
325
+
326
+    /////////////////////////////////////////////////
327
+    // CONSTANTS
328
+    /////////////////////////////////////////////////
329
+
330
+    const STOP_MESSAGE  = 0; // message only, continue processing
331
+    const STOP_CONTINUE = 1; // message?, likely ok to continue processing
332
+    const STOP_CRITICAL = 2; // message, plus full stop, critical error reached
333
+
334
+    /////////////////////////////////////////////////
335
+    // METHODS, VARIABLES
336
+    /////////////////////////////////////////////////
337
+
338
+    /**
339
+     * Constructor
340
+     * @param boolean $exceptions Should we throw external exceptions?
341
+     */
342
+    public function __construct($exceptions = false) {
343 343
     $this->exceptions = ($exceptions == true);
344
-  }
345
-
346
-  /**
347
-   * Sets message type to HTML.
348
-   * @param bool $ishtml
349
-   * @return void
350
-   */
351
-  public function IsHTML($ishtml = true) {
344
+    }
345
+
346
+    /**
347
+     * Sets message type to HTML.
348
+     * @param bool $ishtml
349
+     * @return void
350
+     */
351
+    public function IsHTML($ishtml = true) {
352 352
     if ($ishtml) {
353
-      $this->ContentType = 'text/html';
353
+        $this->ContentType = 'text/html';
354 354
     } else {
355
-      $this->ContentType = 'text/plain';
355
+        $this->ContentType = 'text/plain';
356
+    }
356 357
     }
357
-  }
358 358
 
359
-  /**
360
-   * Sets Mailer to send message using SMTP.
361
-   * @return void
362
-   */
363
-  public function IsSMTP() {
359
+    /**
360
+     * Sets Mailer to send message using SMTP.
361
+     * @return void
362
+     */
363
+    public function IsSMTP() {
364 364
     $this->Mailer = 'smtp';
365
-  }
365
+    }
366 366
 
367
-  /**
368
-   * Sets Mailer to send message using PHP mail() function.
369
-   * @return void
370
-   */
371
-  public function IsMail() {
367
+    /**
368
+     * Sets Mailer to send message using PHP mail() function.
369
+     * @return void
370
+     */
371
+    public function IsMail() {
372 372
     $this->Mailer = 'mail';
373
-  }
373
+    }
374 374
 
375
-  /**
376
-   * Sets Mailer to send message using the $Sendmail program.
377
-   * @return void
378
-   */
379
-  public function IsSendmail() {
375
+    /**
376
+     * Sets Mailer to send message using the $Sendmail program.
377
+     * @return void
378
+     */
379
+    public function IsSendmail() {
380 380
     if (!stristr(ini_get('sendmail_path'), 'sendmail')) {
381
-      $this->Sendmail = '/var/qmail/bin/sendmail';
381
+        $this->Sendmail = '/var/qmail/bin/sendmail';
382 382
     }
383 383
     $this->Mailer = 'sendmail';
384
-  }
384
+    }
385 385
 
386
-  /**
387
-   * Sets Mailer to send message using the qmail MTA.
388
-   * @return void
389
-   */
390
-  public function IsQmail() {
386
+    /**
387
+     * Sets Mailer to send message using the qmail MTA.
388
+     * @return void
389
+     */
390
+    public function IsQmail() {
391 391
     if (stristr(ini_get('sendmail_path'), 'qmail')) {
392
-      $this->Sendmail = '/var/qmail/bin/sendmail';
392
+        $this->Sendmail = '/var/qmail/bin/sendmail';
393 393
     }
394 394
     $this->Mailer = 'sendmail';
395
-  }
396
-
397
-  /////////////////////////////////////////////////
398
-  // METHODS, RECIPIENTS
399
-  /////////////////////////////////////////////////
400
-
401
-  /**
402
-   * Adds a "To" address.
403
-   * @param string $address
404
-   * @param string $name
405
-   * @return boolean true on success, false if address already used
406
-   */
407
-  public function AddAddress($address, $name = '') {
395
+    }
396
+
397
+    /////////////////////////////////////////////////
398
+    // METHODS, RECIPIENTS
399
+    /////////////////////////////////////////////////
400
+
401
+    /**
402
+     * Adds a "To" address.
403
+     * @param string $address
404
+     * @param string $name
405
+     * @return boolean true on success, false if address already used
406
+     */
407
+    public function AddAddress($address, $name = '') {
408 408
     return $this->AddAnAddress('to', $address, $name);
409
-  }
410
-
411
-  /**
412
-   * Adds a "Cc" address.
413
-   * Note: this function works with the SMTP mailer on win32, not with the "mail" mailer.
414
-   * @param string $address
415
-   * @param string $name
416
-   * @return boolean true on success, false if address already used
417
-   */
418
-  public function AddCC($address, $name = '') {
409
+    }
410
+
411
+    /**
412
+     * Adds a "Cc" address.
413
+     * Note: this function works with the SMTP mailer on win32, not with the "mail" mailer.
414
+     * @param string $address
415
+     * @param string $name
416
+     * @return boolean true on success, false if address already used
417
+     */
418
+    public function AddCC($address, $name = '') {
419 419
     return $this->AddAnAddress('cc', $address, $name);
420
-  }
421
-
422
-  /**
423
-   * Adds a "Bcc" address.
424
-   * Note: this function works with the SMTP mailer on win32, not with the "mail" mailer.
425
-   * @param string $address
426
-   * @param string $name
427
-   * @return boolean true on success, false if address already used
428
-   */
429
-  public function AddBCC($address, $name = '') {
420
+    }
421
+
422
+    /**
423
+     * Adds a "Bcc" address.
424
+     * Note: this function works with the SMTP mailer on win32, not with the "mail" mailer.
425
+     * @param string $address
426
+     * @param string $name
427
+     * @return boolean true on success, false if address already used
428
+     */
429
+    public function AddBCC($address, $name = '') {
430 430
     return $this->AddAnAddress('bcc', $address, $name);
431
-  }
432
-
433
-  /**
434
-   * Adds a "Reply-to" address.
435
-   * @param string $address
436
-   * @param string $name
437
-   * @return boolean
438
-   */
439
-  public function AddReplyTo($address, $name = '') {
431
+    }
432
+
433
+    /**
434
+     * Adds a "Reply-to" address.
435
+     * @param string $address
436
+     * @param string $name
437
+     * @return boolean
438
+     */
439
+    public function AddReplyTo($address, $name = '') {
440 440
     return $this->AddAnAddress('ReplyTo', $address, $name);
441
-  }
442
-
443
-  /**
444
-   * Adds an address to one of the recipient arrays
445
-   * Addresses that have been added already return false, but do not throw exceptions
446
-   * @param string $kind One of 'to', 'cc', 'bcc', 'ReplyTo'
447
-   * @param string $address The email address to send to
448
-   * @param string $name
449
-   * @return boolean true on success, false if address already used or invalid in some way
450
-   * @access private
451
-   */
452
-  private function AddAnAddress($kind, $address, $name = '') {
441
+    }
442
+
443
+    /**
444
+     * Adds an address to one of the recipient arrays
445
+     * Addresses that have been added already return false, but do not throw exceptions
446
+     * @param string $kind One of 'to', 'cc', 'bcc', 'ReplyTo'
447
+     * @param string $address The email address to send to
448
+     * @param string $name
449
+     * @return boolean true on success, false if address already used or invalid in some way
450
+     * @access private
451
+     */
452
+    private function AddAnAddress($kind, $address, $name = '') {
453 453
     if (!preg_match('/^(to|cc|bcc|ReplyTo)$/', $kind)) {
454
-      error_log('Invalid recipient array: ' . $kind);
455
-      return false;
454
+        error_log('Invalid recipient array: ' . $kind);
455
+        return false;
456 456
     }
457 457
     $address = trim($address);
458 458
     $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim
459 459
     if (!self::ValidateAddress($address)) {
460
-      $this->SetError($this->Lang('invalid_address').': '. $address);
461
-      if ($this->exceptions) {
460
+        $this->SetError($this->Lang('invalid_address').': '. $address);
461
+        if ($this->exceptions) {
462 462
         throw new phpmailerException($this->Lang('invalid_address').': '.$address);
463
-      }
464
-      error_log($this->Lang('invalid_address').': '.$address);
465
-      return false;
463
+        }
464
+        error_log($this->Lang('invalid_address').': '.$address);
465
+        return false;
466 466
     }
467 467
     if ($kind != 'ReplyTo') {
468
-      if (!isset($this->all_recipients[strtolower($address)])) {
468
+        if (!isset($this->all_recipients[strtolower($address)])) {
469 469
         array_push($this->$kind, array($address, $name));
470 470
         $this->all_recipients[strtolower($address)] = true;
471 471
         return true;
472
-      }
472
+        }
473 473
     } else {
474
-      if (!array_key_exists(strtolower($address), $this->ReplyTo)) {
474
+        if (!array_key_exists(strtolower($address), $this->ReplyTo)) {
475 475
         $this->ReplyTo[strtolower($address)] = array($address, $name);
476
-      return true;
476
+        return true;
477
+    }
477 478
     }
478
-  }
479
-  return false;
479
+    return false;
480 480
 }
481 481
 
482 482
 /**
@@ -485,125 +485,125 @@  discard block
 block discarded – undo
485 485
  * @param string $name
486 486
  * @return boolean
487 487
  */
488
-  public function SetFrom($address, $name = '',$auto=1) {
488
+    public function SetFrom($address, $name = '',$auto=1) {
489 489
     $address = trim($address);
490 490
     $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim
491 491
     if (!self::ValidateAddress($address)) {
492
-      $this->SetError($this->Lang('invalid_address').': '. $address);
493
-      if ($this->exceptions) {
492
+        $this->SetError($this->Lang('invalid_address').': '. $address);
493
+        if ($this->exceptions) {
494 494
         throw new phpmailerException($this->Lang('invalid_address').': '.$address);
495
-      }
496
-      error_log($this->Lang('invalid_address').': '.$address);
497
-      return false;
495
+        }
496
+        error_log($this->Lang('invalid_address').': '.$address);
497
+        return false;
498 498
     }
499 499
     $this->From = $address;
500 500
     $this->FromName = $name;
501 501
     if ($auto) {
502
-      if (empty($this->ReplyTo)) {
502
+        if (empty($this->ReplyTo)) {
503 503
         $this->AddAnAddress('ReplyTo', $address, $name);
504
-      }
505
-      if (empty($this->Sender)) {
504
+        }
505
+        if (empty($this->Sender)) {
506 506
         $this->Sender = $address;
507
-      }
507
+        }
508 508
     }
509 509
     return true;
510
-  }
511
-
512
-  /**
513
-   * Check that a string looks roughly like an email address should
514
-   * Static so it can be used without instantiation
515
-   * Tries to use PHP built-in validator in the filter extension (from PHP 5.2), falls back to a reasonably competent regex validator
516
-   * Conforms approximately to RFC2822
517
-   * @link http://www.hexillion.com/samples/#Regex Original pattern found here
518
-   * @param string $address The email address to check
519
-   * @return boolean
520
-   * @static
521
-   * @access public
522
-   */
523
-  public static function ValidateAddress($address) {
510
+    }
511
+
512
+    /**
513
+     * Check that a string looks roughly like an email address should
514
+     * Static so it can be used without instantiation
515
+     * Tries to use PHP built-in validator in the filter extension (from PHP 5.2), falls back to a reasonably competent regex validator
516
+     * Conforms approximately to RFC2822
517
+     * @link http://www.hexillion.com/samples/#Regex Original pattern found here
518
+     * @param string $address The email address to check
519
+     * @return boolean
520
+     * @static
521
+     * @access public
522
+     */
523
+    public static function ValidateAddress($address) {
524 524
     if (function_exists('filter_var')) { //Introduced in PHP 5.2
525
-      if(filter_var($address, FILTER_VALIDATE_EMAIL) === FALSE) {
525
+        if(filter_var($address, FILTER_VALIDATE_EMAIL) === FALSE) {
526 526
         return false;
527
-      } else {
527
+        } else {
528 528
         return true;
529
-      }
529
+        }
530 530
     } else {
531
-      return preg_match('/^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9_](?:[a-zA-Z0-9_\-](?!\.)){0,61}[a-zA-Z0-9_-]?\.)+[a-zA-Z0-9_](?:[a-zA-Z0-9_\-](?!$)){0,61}[a-zA-Z0-9_]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/', $address);
531
+        return preg_match('/^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9_](?:[a-zA-Z0-9_\-](?!\.)){0,61}[a-zA-Z0-9_-]?\.)+[a-zA-Z0-9_](?:[a-zA-Z0-9_\-](?!$)){0,61}[a-zA-Z0-9_]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/', $address);
532
+    }
532 533
     }
533
-  }
534 534
 
535
-  /////////////////////////////////////////////////
536
-  // METHODS, MAIL SENDING
537
-  /////////////////////////////////////////////////
535
+    /////////////////////////////////////////////////
536
+    // METHODS, MAIL SENDING
537
+    /////////////////////////////////////////////////
538 538
 
539
-  /**
540
-   * Creates message and assigns Mailer. If the message is
541
-   * not sent successfully then it returns false.  Use the ErrorInfo
542
-   * variable to view description of the error.
543
-   * @return bool
544
-   */
545
-  public function Send() {
539
+    /**
540
+     * Creates message and assigns Mailer. If the message is
541
+     * not sent successfully then it returns false.  Use the ErrorInfo
542
+     * variable to view description of the error.
543
+     * @return bool
544
+     */
545
+    public function Send() {
546 546
     try {
547
-      if ((count($this->to) + count($this->cc) + count($this->bcc)) < 1) {
547
+        if ((count($this->to) + count($this->cc) + count($this->bcc)) < 1) {
548 548
         throw new phpmailerException($this->Lang('provide_address'), self::STOP_CRITICAL);
549
-      }
549
+        }
550 550
 
551
-      // Set whether the message is multipart/alternative
552
-      if(!empty($this->AltBody)) {
551
+        // Set whether the message is multipart/alternative
552
+        if(!empty($this->AltBody)) {
553 553
         $this->ContentType = 'multipart/alternative';
554
-      }
554
+        }
555 555
 
556
-      $this->error_count = 0; // reset errors
557
-      $this->SetMessageType();
558
-      $header = $this->CreateHeader();
559
-      $body = $this->CreateBody();
556
+        $this->error_count = 0; // reset errors
557
+        $this->SetMessageType();
558
+        $header = $this->CreateHeader();
559
+        $body = $this->CreateBody();
560 560
 
561
-      if (empty($this->Body)) {
561
+        if (empty($this->Body)) {
562 562
         throw new phpmailerException($this->Lang('empty_message'), self::STOP_CRITICAL);
563
-      }
563
+        }
564 564
 
565
-      // digitally sign with DKIM if enabled
566
-      if ($this->DKIM_domain && $this->DKIM_private) {
565
+        // digitally sign with DKIM if enabled
566
+        if ($this->DKIM_domain && $this->DKIM_private) {
567 567
         $header_dkim = $this->DKIM_Add($header,$this->Subject,$body);
568 568
         $header = str_replace("\r\n","\n",$header_dkim) . $header;
569
-      }
569
+        }
570 570
 
571
-      // Choose the mailer and send through it
572
-      switch($this->Mailer) {
571
+        // Choose the mailer and send through it
572
+        switch($this->Mailer) {
573 573
         case 'sendmail':
574 574
           return $this->SendmailSend($header, $body);
575 575
         case 'smtp':
576 576
           return $this->SmtpSend($header, $body);
577 577
         default:
578 578
           return $this->MailSend($header, $body);
579
-      }
579
+        }
580 580
 
581 581
     } catch (phpmailerException $e) {
582
-      $this->SetError($e->getMessage());
583
-      if ($this->exceptions) {
582
+        $this->SetError($e->getMessage());
583
+        if ($this->exceptions) {
584 584
         throw $e;
585
-      }
586
-      return false;
587
-    }
588
-  }
589
-
590
-  /**
591
-   * Sends mail using the $Sendmail program.
592
-   * @param string $header The message headers
593
-   * @param string $body The message body
594
-   * @access protected
595
-   * @return bool
596
-   */
597
-  protected function SendmailSend($header, $body) {
585
+        }
586
+        return false;
587
+    }
588
+    }
589
+
590
+    /**
591
+     * Sends mail using the $Sendmail program.
592
+     * @param string $header The message headers
593
+     * @param string $body The message body
594
+     * @access protected
595
+     * @return bool
596
+     */
597
+    protected function SendmailSend($header, $body) {
598 598
     if ($this->Sender != '') {
599
-      $sendmail = sprintf("%s -oi -f %s -t", escapeshellcmd($this->Sendmail), escapeshellarg($this->Sender));
599
+        $sendmail = sprintf("%s -oi -f %s -t", escapeshellcmd($this->Sendmail), escapeshellarg($this->Sender));
600 600
     } else {
601
-      $sendmail = sprintf("%s -oi -t", escapeshellcmd($this->Sendmail));
601
+        $sendmail = sprintf("%s -oi -t", escapeshellcmd($this->Sendmail));
602 602
     }
603 603
     if ($this->SingleTo === true) {
604
-      foreach ($this->SingleToArray as $key => $val) {
604
+        foreach ($this->SingleToArray as $key => $val) {
605 605
         if(!@$mail = popen($sendmail, 'w')) {
606
-          throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
606
+            throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
607 607
         }
608 608
         fputs($mail, "To: " . $val . "\n");
609 609
         fputs($mail, $header);
@@ -613,164 +613,164 @@  discard block
 block discarded – undo
613 613
         $isSent = ($result == 0) ? 1 : 0;
614 614
         $this->doCallback($isSent,$val,$this->cc,$this->bcc,$this->Subject,$body);
615 615
         if($result != 0) {
616
-          throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
616
+            throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
617
+        }
617 618
         }
618
-      }
619 619
     } else {
620
-      if(!@$mail = popen($sendmail, 'w')) {
620
+        if(!@$mail = popen($sendmail, 'w')) {
621 621
         throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
622
-      }
623
-      fputs($mail, $header);
624
-      fputs($mail, $body);
625
-      $result = pclose($mail);
626
-      // implement call back function if it exists
627
-      $isSent = ($result == 0) ? 1 : 0;
628
-      $this->doCallback($isSent,$this->to,$this->cc,$this->bcc,$this->Subject,$body);
629
-      if($result != 0) {
622
+        }
623
+        fputs($mail, $header);
624
+        fputs($mail, $body);
625
+        $result = pclose($mail);
626
+        // implement call back function if it exists
627
+        $isSent = ($result == 0) ? 1 : 0;
628
+        $this->doCallback($isSent,$this->to,$this->cc,$this->bcc,$this->Subject,$body);
629
+        if($result != 0) {
630 630
         throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
631
-      }
631
+        }
632 632
     }
633 633
     return true;
634
-  }
635
-
636
-  /**
637
-   * Sends mail using the PHP mail() function.
638
-   * @param string $header The message headers
639
-   * @param string $body The message body
640
-   * @access protected
641
-   * @return bool
642
-   */
643
-  protected function MailSend($header, $body) {
634
+    }
635
+
636
+    /**
637
+     * Sends mail using the PHP mail() function.
638
+     * @param string $header The message headers
639
+     * @param string $body The message body
640
+     * @access protected
641
+     * @return bool
642
+     */
643
+    protected function MailSend($header, $body) {
644 644
     $toArr = array();
645 645
     foreach($this->to as $t) {
646
-      $toArr[] = $this->AddrFormat($t);
646
+        $toArr[] = $this->AddrFormat($t);
647 647
     }
648 648
     $to = implode(', ', $toArr);
649 649
 
650 650
     $params = sprintf("-oi -f %s", $this->Sender);
651 651
     if ($this->Sender != '' && strlen(ini_get('safe_mode'))< 1) {
652
-      $old_from = ini_get('sendmail_from');
653
-      ini_set('sendmail_from', $this->Sender);
654
-      if ($this->SingleTo === true && count($toArr) > 1) {
652
+        $old_from = ini_get('sendmail_from');
653
+        ini_set('sendmail_from', $this->Sender);
654
+        if ($this->SingleTo === true && count($toArr) > 1) {
655 655
         foreach ($toArr as $key => $val) {
656
-          $rt = @mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
657
-          // implement call back function if it exists
658
-          $isSent = ($rt == 1) ? 1 : 0;
659
-          $this->doCallback($isSent,$val,$this->cc,$this->bcc,$this->Subject,$body);
656
+            $rt = @mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
657
+            // implement call back function if it exists
658
+            $isSent = ($rt == 1) ? 1 : 0;
659
+            $this->doCallback($isSent,$val,$this->cc,$this->bcc,$this->Subject,$body);
660 660
         }
661
-      } else {
661
+        } else {
662 662
         $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
663 663
         // implement call back function if it exists
664 664
         $isSent = ($rt == 1) ? 1 : 0;
665 665
         $this->doCallback($isSent,$to,$this->cc,$this->bcc,$this->Subject,$body);
666
-      }
666
+        }
667 667
     } else {
668
-      if ($this->SingleTo === true && count($toArr) > 1) {
668
+        if ($this->SingleTo === true && count($toArr) > 1) {
669 669
         foreach ($toArr as $key => $val) {
670
-          $rt = @mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
671
-          // implement call back function if it exists
672
-          $isSent = ($rt == 1) ? 1 : 0;
673
-          $this->doCallback($isSent,$val,$this->cc,$this->bcc,$this->Subject,$body);
670
+            $rt = @mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
671
+            // implement call back function if it exists
672
+            $isSent = ($rt == 1) ? 1 : 0;
673
+            $this->doCallback($isSent,$val,$this->cc,$this->bcc,$this->Subject,$body);
674 674
         }
675
-      } else {
675
+        } else {
676 676
         $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header);
677 677
         // implement call back function if it exists
678 678
         $isSent = ($rt == 1) ? 1 : 0;
679 679
         $this->doCallback($isSent,$to,$this->cc,$this->bcc,$this->Subject,$body);
680
-      }
680
+        }
681 681
     }
682 682
     if (isset($old_from)) {
683
-      ini_set('sendmail_from', $old_from);
683
+        ini_set('sendmail_from', $old_from);
684 684
     }
685 685
     if(!$rt) {
686
-      throw new phpmailerException($this->Lang('instantiate'), self::STOP_CRITICAL);
686
+        throw new phpmailerException($this->Lang('instantiate'), self::STOP_CRITICAL);
687 687
     }
688 688
     return true;
689
-  }
690
-
691
-  /**
692
-   * Sends mail via SMTP using PhpSMTP
693
-   * Returns false if there is a bad MAIL FROM, RCPT, or DATA input.
694
-   * @param string $header The message headers
695
-   * @param string $body The message body
696
-   * @uses SMTP
697
-   * @access protected
698
-   * @return bool
699
-   */
700
-  protected function SmtpSend($header, $body) {
689
+    }
690
+
691
+    /**
692
+     * Sends mail via SMTP using PhpSMTP
693
+     * Returns false if there is a bad MAIL FROM, RCPT, or DATA input.
694
+     * @param string $header The message headers
695
+     * @param string $body The message body
696
+     * @uses SMTP
697
+     * @access protected
698
+     * @return bool
699
+     */
700
+    protected function SmtpSend($header, $body) {
701 701
     require_once $this->PluginDir . 'class.smtp.php';
702 702
     $bad_rcpt = array();
703 703
 
704 704
     if(!$this->SmtpConnect()) {
705
-      throw new phpmailerException($this->Lang('smtp_connect_failed'), self::STOP_CRITICAL);
705
+        throw new phpmailerException($this->Lang('smtp_connect_failed'), self::STOP_CRITICAL);
706 706
     }
707 707
     $smtp_from = ($this->Sender == '') ? $this->From : $this->Sender;
708 708
     if(!$this->smtp->Mail($smtp_from)) {
709
-      throw new phpmailerException($this->Lang('from_failed') . $smtp_from, self::STOP_CRITICAL);
709
+        throw new phpmailerException($this->Lang('from_failed') . $smtp_from, self::STOP_CRITICAL);
710 710
     }
711 711
 
712 712
     // Attempt to send attach all recipients
713 713
     foreach($this->to as $to) {
714
-      if (!$this->smtp->Recipient($to[0])) {
714
+        if (!$this->smtp->Recipient($to[0])) {
715 715
         $bad_rcpt[] = $to[0];
716 716
         // implement call back function if it exists
717 717
         $isSent = 0;
718 718
         $this->doCallback($isSent,$to[0],'','',$this->Subject,$body);
719
-      } else {
719
+        } else {
720 720
         // implement call back function if it exists
721 721
         $isSent = 1;
722 722
         $this->doCallback($isSent,$to[0],'','',$this->Subject,$body);
723
-      }
723
+        }
724 724
     }
725 725
     foreach($this->cc as $cc) {
726
-      if (!$this->smtp->Recipient($cc[0])) {
726
+        if (!$this->smtp->Recipient($cc[0])) {
727 727
         $bad_rcpt[] = $cc[0];
728 728
         // implement call back function if it exists
729 729
         $isSent = 0;
730 730
         $this->doCallback($isSent,'',$cc[0],'',$this->Subject,$body);
731
-      } else {
731
+        } else {
732 732
         // implement call back function if it exists
733 733
         $isSent = 1;
734 734
         $this->doCallback($isSent,'',$cc[0],'',$this->Subject,$body);
735
-      }
735
+        }
736 736
     }
737 737
     foreach($this->bcc as $bcc) {
738
-      if (!$this->smtp->Recipient($bcc[0])) {
738
+        if (!$this->smtp->Recipient($bcc[0])) {
739 739
         $bad_rcpt[] = $bcc[0];
740 740
         // implement call back function if it exists
741 741
         $isSent = 0;
742 742
         $this->doCallback($isSent,'','',$bcc[0],$this->Subject,$body);
743
-      } else {
743
+        } else {
744 744
         // implement call back function if it exists
745 745
         $isSent = 1;
746 746
         $this->doCallback($isSent,'','',$bcc[0],$this->Subject,$body);
747
-      }
747
+        }
748 748
     }
749 749
 
750 750
 
751 751
     if (count($bad_rcpt) > 0 ) { //Create error message for any bad addresses
752
-      $badaddresses = implode(', ', $bad_rcpt);
753
-      throw new phpmailerException($this->Lang('recipients_failed') . $badaddresses);
752
+        $badaddresses = implode(', ', $bad_rcpt);
753
+        throw new phpmailerException($this->Lang('recipients_failed') . $badaddresses);
754 754
     }
755 755
     if(!$this->smtp->Data($header . $body)) {
756
-      throw new phpmailerException($this->Lang('data_not_accepted'), self::STOP_CRITICAL);
756
+        throw new phpmailerException($this->Lang('data_not_accepted'), self::STOP_CRITICAL);
757 757
     }
758 758
     if($this->SMTPKeepAlive == true) {
759
-      $this->smtp->Reset();
759
+        $this->smtp->Reset();
760 760
     }
761 761
     return true;
762
-  }
763
-
764
-  /**
765
-   * Initiates a connection to an SMTP server.
766
-   * Returns false if the operation failed.
767
-   * @uses SMTP
768
-   * @access public
769
-   * @return bool
770
-   */
771
-  public function SmtpConnect() {
762
+    }
763
+
764
+    /**
765
+     * Initiates a connection to an SMTP server.
766
+     * Returns false if the operation failed.
767
+     * @uses SMTP
768
+     * @access public
769
+     * @return bool
770
+     */
771
+    public function SmtpConnect() {
772 772
     if(is_null($this->smtp)) {
773
-      $this->smtp = new SMTP();
773
+        $this->smtp = new SMTP();
774 774
     }
775 775
 
776 776
     $this->smtp->do_debug = $this->SMTPDebug;
@@ -780,14 +780,14 @@  discard block
 block discarded – undo
780 780
 
781 781
     // Retry while there is no connection
782 782
     try {
783
-      while($index < count($hosts) && !$connection) {
783
+        while($index < count($hosts) && !$connection) {
784 784
         $hostinfo = array();
785 785
         if (preg_match('/^(.+):([0-9]+)$/', $hosts[$index], $hostinfo)) {
786
-          $host = $hostinfo[1];
787
-          $port = $hostinfo[2];
786
+            $host = $hostinfo[1];
787
+            $port = $hostinfo[2];
788 788
         } else {
789
-          $host = $hosts[$index];
790
-          $port = $this->Port;
789
+            $host = $hosts[$index];
790
+            $port = $this->Port;
791 791
         }
792 792
 
793 793
         $tls = ($this->SMTPSecure == 'tls');
@@ -795,140 +795,140 @@  discard block
 block discarded – undo
795 795
 
796 796
         if ($this->smtp->Connect(($ssl ? 'ssl://':'').$host, $port, $this->Timeout)) {
797 797
 
798
-          $hello = ($this->Helo != '' ? $this->Helo : $this->ServerHostname());
799
-          $this->smtp->Hello($hello);
798
+            $hello = ($this->Helo != '' ? $this->Helo : $this->ServerHostname());
799
+            $this->smtp->Hello($hello);
800 800
 
801
-          if ($tls) {
801
+            if ($tls) {
802 802
             if (!$this->smtp->StartTLS()) {
803
-              throw new phpmailerException($this->Lang('tls'));
803
+                throw new phpmailerException($this->Lang('tls'));
804 804
             }
805 805
 
806 806
             //We must resend HELO after tls negotiation
807 807
             $this->smtp->Hello($hello);
808
-          }
808
+            }
809 809
 
810
-          $connection = true;
811
-          if ($this->SMTPAuth) {
810
+            $connection = true;
811
+            if ($this->SMTPAuth) {
812 812
             if (!$this->smtp->Authenticate($this->Username, $this->Password)) {
813
-              throw new phpmailerException($this->Lang('authenticate'));
813
+                throw new phpmailerException($this->Lang('authenticate'));
814
+            }
814 815
             }
815
-          }
816 816
         }
817 817
         $index++;
818 818
         if (!$connection) {
819
-          throw new phpmailerException($this->Lang('connect_host'));
819
+            throw new phpmailerException($this->Lang('connect_host'));
820
+        }
820 821
         }
821
-      }
822 822
     } catch (phpmailerException $e) {
823
-      $this->smtp->Reset();
824
-      throw $e;
823
+        $this->smtp->Reset();
824
+        throw $e;
825 825
     }
826 826
     return true;
827
-  }
827
+    }
828 828
 
829
-  /**
830
-   * Closes the active SMTP session if one exists.
831
-   * @return void
832
-   */
833
-  public function SmtpClose() {
829
+    /**
830
+     * Closes the active SMTP session if one exists.
831
+     * @return void
832
+     */
833
+    public function SmtpClose() {
834 834
     if(!is_null($this->smtp)) {
835
-      if($this->smtp->Connected()) {
835
+        if($this->smtp->Connected()) {
836 836
         $this->smtp->Quit();
837 837
         $this->smtp->Close();
838
-      }
839
-    }
840
-  }
841
-
842
-  /**
843
-  * Sets the language for all class error messages.
844
-  * Returns false if it cannot load the language file.  The default language is English.
845
-  * @param string $langcode ISO 639-1 2-character language code (e.g. Portuguese: "br")
846
-  * @param string $lang_path Path to the language file directory
847
-  * @access public
848
-  */
849
-  function SetLanguage($langcode = 'en', $lang_path = 'language/') {
838
+        }
839
+    }
840
+    }
841
+
842
+    /**
843
+     * Sets the language for all class error messages.
844
+     * Returns false if it cannot load the language file.  The default language is English.
845
+     * @param string $langcode ISO 639-1 2-character language code (e.g. Portuguese: "br")
846
+     * @param string $lang_path Path to the language file directory
847
+     * @access public
848
+     */
849
+    function SetLanguage($langcode = 'en', $lang_path = 'language/') {
850 850
     //Define full set of translatable strings
851 851
     $PHPMAILER_LANG = array(
852
-      'provide_address' => 'You must provide at least one recipient email address.',
853
-      'mailer_not_supported' => ' mailer is not supported.',
854
-      'execute' => 'Could not execute: ',
855
-      'instantiate' => 'Could not instantiate mail function.',
856
-      'authenticate' => 'SMTP Error: Could not authenticate.',
857
-      'from_failed' => 'The following From address failed: ',
858
-      'recipients_failed' => 'SMTP Error: The following recipients failed: ',
859
-      'data_not_accepted' => 'SMTP Error: Data not accepted.',
860
-      'connect_host' => 'SMTP Error: Could not connect to SMTP host.',
861
-      'file_access' => 'Could not access file: ',
862
-      'file_open' => 'File Error: Could not open file: ',
863
-      'encoding' => 'Unknown encoding: ',
864
-      'signing' => 'Signing Error: ',
865
-      'smtp_error' => 'SMTP server error: ',
866
-      'empty_message' => 'Message body empty',
867
-      'invalid_address' => 'Invalid address',
868
-      'variable_set' => 'Cannot set or reset variable: '
852
+        'provide_address' => 'You must provide at least one recipient email address.',
853
+        'mailer_not_supported' => ' mailer is not supported.',
854
+        'execute' => 'Could not execute: ',
855
+        'instantiate' => 'Could not instantiate mail function.',
856
+        'authenticate' => 'SMTP Error: Could not authenticate.',
857
+        'from_failed' => 'The following From address failed: ',
858
+        'recipients_failed' => 'SMTP Error: The following recipients failed: ',
859
+        'data_not_accepted' => 'SMTP Error: Data not accepted.',
860
+        'connect_host' => 'SMTP Error: Could not connect to SMTP host.',
861
+        'file_access' => 'Could not access file: ',
862
+        'file_open' => 'File Error: Could not open file: ',
863
+        'encoding' => 'Unknown encoding: ',
864
+        'signing' => 'Signing Error: ',
865
+        'smtp_error' => 'SMTP server error: ',
866
+        'empty_message' => 'Message body empty',
867
+        'invalid_address' => 'Invalid address',
868
+        'variable_set' => 'Cannot set or reset variable: '
869 869
     );
870 870
     //Overwrite language-specific strings. This way we'll never have missing translations - no more "language string failed to load"!
871 871
     $l = true;
872 872
     if ($langcode != 'en') { //There is no English translation file
873
-      $l = @include $lang_path.'phpmailer.lang-'.$langcode.'.php';
873
+        $l = @include $lang_path.'phpmailer.lang-'.$langcode.'.php';
874 874
     }
875 875
     $this->language = $PHPMAILER_LANG;
876 876
     return ($l == true); //Returns false if language not found
877
-  }
877
+    }
878 878
 
879
-  /**
880
-  * Return the current array of language strings
881
-  * @return array
882
-  */
883
-  public function GetTranslations() {
879
+    /**
880
+     * Return the current array of language strings
881
+     * @return array
882
+     */
883
+    public function GetTranslations() {
884 884
     return $this->language;
885
-  }
886
-
887
-  /////////////////////////////////////////////////
888
-  // METHODS, MESSAGE CREATION
889
-  /////////////////////////////////////////////////
890
-
891
-  /**
892
-   * Creates recipient headers.
893
-   * @access public
894
-   * @return string
895
-   */
896
-  public function AddrAppend($type, $addr) {
885
+    }
886
+
887
+    /////////////////////////////////////////////////
888
+    // METHODS, MESSAGE CREATION
889
+    /////////////////////////////////////////////////
890
+
891
+    /**
892
+     * Creates recipient headers.
893
+     * @access public
894
+     * @return string
895
+     */
896
+    public function AddrAppend($type, $addr) {
897 897
     $addr_str = $type . ': ';
898 898
     $addresses = array();
899 899
     foreach ($addr as $a) {
900
-      $addresses[] = $this->AddrFormat($a);
900
+        $addresses[] = $this->AddrFormat($a);
901 901
     }
902 902
     $addr_str .= implode(', ', $addresses);
903 903
     $addr_str .= $this->LE;
904 904
 
905 905
     return $addr_str;
906
-  }
907
-
908
-  /**
909
-   * Formats an address correctly.
910
-   * @access public
911
-   * @return string
912
-   */
913
-  public function AddrFormat($addr) {
906
+    }
907
+
908
+    /**
909
+     * Formats an address correctly.
910
+     * @access public
911
+     * @return string
912
+     */
913
+    public function AddrFormat($addr) {
914 914
     if (empty($addr[1])) {
915
-      return $this->SecureHeader($addr[0]);
915
+        return $this->SecureHeader($addr[0]);
916 916
     } else {
917
-      return $this->EncodeHeader($this->SecureHeader($addr[1]), 'phrase') . " <" . $this->SecureHeader($addr[0]) . ">";
918
-    }
919
-  }
920
-
921
-  /**
922
-   * Wraps message for use with mailers that do not
923
-   * automatically perform wrapping and for quoted-printable.
924
-   * Original written by philippe.
925
-   * @param string $message The message to wrap
926
-   * @param integer $length The line length to wrap to
927
-   * @param boolean $qp_mode Whether to run in Quoted-Printable mode
928
-   * @access public
929
-   * @return string
930
-   */
931
-  public function WrapText($message, $length, $qp_mode = false) {
917
+        return $this->EncodeHeader($this->SecureHeader($addr[1]), 'phrase') . " <" . $this->SecureHeader($addr[0]) . ">";
918
+    }
919
+    }
920
+
921
+    /**
922
+     * Wraps message for use with mailers that do not
923
+     * automatically perform wrapping and for quoted-printable.
924
+     * Original written by philippe.
925
+     * @param string $message The message to wrap
926
+     * @param integer $length The line length to wrap to
927
+     * @param boolean $qp_mode Whether to run in Quoted-Printable mode
928
+     * @access public
929
+     * @return string
930
+     */
931
+    public function WrapText($message, $length, $qp_mode = false) {
932 932
     $soft_break = ($qp_mode) ? sprintf(" =%s", $this->LE) : $this->LE;
933 933
     // If utf-8 encoding is used, we will need to make sure we don't
934 934
     // split multibyte characters when we wrap
@@ -936,140 +936,140 @@  discard block
 block discarded – undo
936 936
 
937 937
     $message = $this->FixEOL($message);
938 938
     if (substr($message, -1) == $this->LE) {
939
-      $message = substr($message, 0, -1);
939
+        $message = substr($message, 0, -1);
940 940
     }
941 941
 
942 942
     $line = explode($this->LE, $message);
943 943
     $message = '';
944 944
     for ($i=0 ;$i < count($line); $i++) {
945
-      $line_part = explode(' ', $line[$i]);
946
-      $buf = '';
947
-      for ($e = 0; $e<count($line_part); $e++) {
945
+        $line_part = explode(' ', $line[$i]);
946
+        $buf = '';
947
+        for ($e = 0; $e<count($line_part); $e++) {
948 948
         $word = $line_part[$e];
949 949
         if ($qp_mode and (strlen($word) > $length)) {
950
-          $space_left = $length - strlen($buf) - 1;
951
-          if ($e != 0) {
950
+            $space_left = $length - strlen($buf) - 1;
951
+            if ($e != 0) {
952 952
             if ($space_left > 20) {
953
-              $len = $space_left;
954
-              if ($is_utf8) {
953
+                $len = $space_left;
954
+                if ($is_utf8) {
955 955
                 $len = $this->UTF8CharBoundary($word, $len);
956
-              } elseif (substr($word, $len - 1, 1) == "=") {
956
+                } elseif (substr($word, $len - 1, 1) == "=") {
957 957
                 $len--;
958
-              } elseif (substr($word, $len - 2, 1) == "=") {
958
+                } elseif (substr($word, $len - 2, 1) == "=") {
959 959
                 $len -= 2;
960
-              }
961
-              $part = substr($word, 0, $len);
962
-              $word = substr($word, $len);
963
-              $buf .= ' ' . $part;
964
-              $message .= $buf . sprintf("=%s", $this->LE);
960
+                }
961
+                $part = substr($word, 0, $len);
962
+                $word = substr($word, $len);
963
+                $buf .= ' ' . $part;
964
+                $message .= $buf . sprintf("=%s", $this->LE);
965 965
             } else {
966
-              $message .= $buf . $soft_break;
966
+                $message .= $buf . $soft_break;
967 967
             }
968 968
             $buf = '';
969
-          }
970
-          while (strlen($word) > 0) {
969
+            }
970
+            while (strlen($word) > 0) {
971 971
             $len = $length;
972 972
             if ($is_utf8) {
973
-              $len = $this->UTF8CharBoundary($word, $len);
973
+                $len = $this->UTF8CharBoundary($word, $len);
974 974
             } elseif (substr($word, $len - 1, 1) == "=") {
975
-              $len--;
975
+                $len--;
976 976
             } elseif (substr($word, $len - 2, 1) == "=") {
977
-              $len -= 2;
977
+                $len -= 2;
978 978
             }
979 979
             $part = substr($word, 0, $len);
980 980
             $word = substr($word, $len);
981 981
 
982 982
             if (strlen($word) > 0) {
983
-              $message .= $part . sprintf("=%s", $this->LE);
983
+                $message .= $part . sprintf("=%s", $this->LE);
984 984
             } else {
985
-              $buf = $part;
985
+                $buf = $part;
986
+            }
986 987
             }
987
-          }
988 988
         } else {
989
-          $buf_o = $buf;
990
-          $buf .= ($e == 0) ? $word : (' ' . $word);
989
+            $buf_o = $buf;
990
+            $buf .= ($e == 0) ? $word : (' ' . $word);
991 991
 
992
-          if (strlen($buf) > $length and $buf_o != '') {
992
+            if (strlen($buf) > $length and $buf_o != '') {
993 993
             $message .= $buf_o . $soft_break;
994 994
             $buf = $word;
995
-          }
995
+            }
996
+        }
996 997
         }
997
-      }
998
-      $message .= $buf . $this->LE;
998
+        $message .= $buf . $this->LE;
999 999
     }
1000 1000
 
1001 1001
     return $message;
1002
-  }
1003
-
1004
-  /**
1005
-   * Finds last character boundary prior to maxLength in a utf-8
1006
-   * quoted (printable) encoded string.
1007
-   * Original written by Colin Brown.
1008
-   * @access public
1009
-   * @param string $encodedText utf-8 QP text
1010
-   * @param int    $maxLength   find last character boundary prior to this length
1011
-   * @return int
1012
-   */
1013
-  public function UTF8CharBoundary($encodedText, $maxLength) {
1002
+    }
1003
+
1004
+    /**
1005
+     * Finds last character boundary prior to maxLength in a utf-8
1006
+     * quoted (printable) encoded string.
1007
+     * Original written by Colin Brown.
1008
+     * @access public
1009
+     * @param string $encodedText utf-8 QP text
1010
+     * @param int    $maxLength   find last character boundary prior to this length
1011
+     * @return int
1012
+     */
1013
+    public function UTF8CharBoundary($encodedText, $maxLength) {
1014 1014
     $foundSplitPos = false;
1015 1015
     $lookBack = 3;
1016 1016
     while (!$foundSplitPos) {
1017
-      $lastChunk = substr($encodedText, $maxLength - $lookBack, $lookBack);
1018
-      $encodedCharPos = strpos($lastChunk, "=");
1019
-      if ($encodedCharPos !== false) {
1017
+        $lastChunk = substr($encodedText, $maxLength - $lookBack, $lookBack);
1018
+        $encodedCharPos = strpos($lastChunk, "=");
1019
+        if ($encodedCharPos !== false) {
1020 1020
         // Found start of encoded character byte within $lookBack block.
1021 1021
         // Check the encoded byte value (the 2 chars after the '=')
1022 1022
         $hex = substr($encodedText, $maxLength - $lookBack + $encodedCharPos + 1, 2);
1023 1023
         $dec = hexdec($hex);
1024 1024
         if ($dec < 128) { // Single byte character.
1025
-          // If the encoded char was found at pos 0, it will fit
1026
-          // otherwise reduce maxLength to start of the encoded char
1027
-          $maxLength = ($encodedCharPos == 0) ? $maxLength :
1025
+            // If the encoded char was found at pos 0, it will fit
1026
+            // otherwise reduce maxLength to start of the encoded char
1027
+            $maxLength = ($encodedCharPos == 0) ? $maxLength :
1028 1028
           $maxLength - ($lookBack - $encodedCharPos);
1029
-          $foundSplitPos = true;
1029
+            $foundSplitPos = true;
1030 1030
         } elseif ($dec >= 192) { // First byte of a multi byte character
1031
-          // Reduce maxLength to split at start of character
1032
-          $maxLength = $maxLength - ($lookBack - $encodedCharPos);
1033
-          $foundSplitPos = true;
1031
+            // Reduce maxLength to split at start of character
1032
+            $maxLength = $maxLength - ($lookBack - $encodedCharPos);
1033
+            $foundSplitPos = true;
1034 1034
         } elseif ($dec < 192) { // Middle byte of a multi byte character, look further back
1035
-          $lookBack += 3;
1035
+            $lookBack += 3;
1036 1036
         }
1037
-      } else {
1037
+        } else {
1038 1038
         // No encoded character found
1039 1039
         $foundSplitPos = true;
1040
-      }
1040
+        }
1041 1041
     }
1042 1042
     return $maxLength;
1043
-  }
1043
+    }
1044 1044
 
1045 1045
 
1046
-  /**
1047
-   * Set the body wrapping.
1048
-   * @access public
1049
-   * @return void
1050
-   */
1051
-  public function SetWordWrap() {
1046
+    /**
1047
+     * Set the body wrapping.
1048
+     * @access public
1049
+     * @return void
1050
+     */
1051
+    public function SetWordWrap() {
1052 1052
     if($this->WordWrap < 1) {
1053
-      return;
1053
+        return;
1054 1054
     }
1055 1055
 
1056 1056
     switch($this->message_type) {
1057
-      case 'alt':
1057
+        case 'alt':
1058 1058
       case 'alt_attachments':
1059 1059
         $this->AltBody = $this->WrapText($this->AltBody, $this->WordWrap);
1060 1060
         break;
1061
-      default:
1061
+        default:
1062 1062
         $this->Body = $this->WrapText($this->Body, $this->WordWrap);
1063 1063
         break;
1064 1064
     }
1065
-  }
1065
+    }
1066 1066
 
1067
-  /**
1068
-   * Assembles message header.
1069
-   * @access public
1070
-   * @return string The assembled header
1071
-   */
1072
-  public function CreateHeader() {
1067
+    /**
1068
+     * Assembles message header.
1069
+     * @access public
1070
+     * @return string The assembled header
1071
+     */
1072
+    public function CreateHeader() {
1073 1073
     $result = '';
1074 1074
 
1075 1075
     // Set the boundaries
@@ -1079,24 +1079,24 @@  discard block
 block discarded – undo
1079 1079
 
1080 1080
     $result .= $this->HeaderLine('Date', self::RFCDate());
1081 1081
     if($this->Sender == '') {
1082
-      $result .= $this->HeaderLine('Return-Path', trim($this->From));
1082
+        $result .= $this->HeaderLine('Return-Path', trim($this->From));
1083 1083
     } else {
1084
-      $result .= $this->HeaderLine('Return-Path', trim($this->Sender));
1084
+        $result .= $this->HeaderLine('Return-Path', trim($this->Sender));
1085 1085
     }
1086 1086
 
1087 1087
     // To be created automatically by mail()
1088 1088
     if($this->Mailer != 'mail') {
1089
-      if ($this->SingleTo === true) {
1089
+        if ($this->SingleTo === true) {
1090 1090
         foreach($this->to as $t) {
1091
-          $this->SingleToArray[] = $this->AddrFormat($t);
1091
+            $this->SingleToArray[] = $this->AddrFormat($t);
1092 1092
         }
1093
-      } else {
1093
+        } else {
1094 1094
         if(count($this->to) > 0) {
1095
-          $result .= $this->AddrAppend('To', $this->to);
1095
+            $result .= $this->AddrAppend('To', $this->to);
1096 1096
         } elseif (count($this->cc) == 0) {
1097
-          $result .= $this->HeaderLine('To', 'undisclosed-recipients:;');
1097
+            $result .= $this->HeaderLine('To', 'undisclosed-recipients:;');
1098
+        }
1098 1099
         }
1099
-      }
1100 1100
     }
1101 1101
 
1102 1102
     $from = array();
@@ -1106,97 +1106,97 @@  discard block
 block discarded – undo
1106 1106
 
1107 1107
     // sendmail and mail() extract Cc from the header before sending
1108 1108
     if(count($this->cc) > 0) {
1109
-      $result .= $this->AddrAppend('Cc', $this->cc);
1109
+        $result .= $this->AddrAppend('Cc', $this->cc);
1110 1110
     }
1111 1111
 
1112 1112
     // sendmail and mail() extract Bcc from the header before sending
1113 1113
     if((($this->Mailer == 'sendmail') || ($this->Mailer == 'mail')) && (count($this->bcc) > 0)) {
1114
-      $result .= $this->AddrAppend('Bcc', $this->bcc);
1114
+        $result .= $this->AddrAppend('Bcc', $this->bcc);
1115 1115
     }
1116 1116
 
1117 1117
     if(count($this->ReplyTo) > 0) {
1118
-      $result .= $this->AddrAppend('Reply-to', $this->ReplyTo);
1118
+        $result .= $this->AddrAppend('Reply-to', $this->ReplyTo);
1119 1119
     }
1120 1120
 
1121 1121
     // mail() sets the subject itself
1122 1122
     if($this->Mailer != 'mail') {
1123
-      $result .= $this->HeaderLine('Subject', $this->EncodeHeader($this->SecureHeader($this->Subject)));
1123
+        $result .= $this->HeaderLine('Subject', $this->EncodeHeader($this->SecureHeader($this->Subject)));
1124 1124
     }
1125 1125
 
1126 1126
     if($this->MessageID != '') {
1127
-      $result .= $this->HeaderLine('Message-ID',$this->MessageID);
1127
+        $result .= $this->HeaderLine('Message-ID',$this->MessageID);
1128 1128
     } else {
1129
-      $result .= sprintf("Message-ID: <%s@%s>%s", $uniq_id, $this->ServerHostname(), $this->LE);
1129
+        $result .= sprintf("Message-ID: <%s@%s>%s", $uniq_id, $this->ServerHostname(), $this->LE);
1130 1130
     }
1131 1131
     $result .= $this->HeaderLine('X-Priority', $this->Priority);
1132 1132
     $result .= $this->HeaderLine('X-Mailer', 'PHPMailer '.$this->Version.' (phpmailer.sourceforge.net)');
1133 1133
 
1134 1134
     if($this->ConfirmReadingTo != '') {
1135
-      $result .= $this->HeaderLine('Disposition-Notification-To', '<' . trim($this->ConfirmReadingTo) . '>');
1135
+        $result .= $this->HeaderLine('Disposition-Notification-To', '<' . trim($this->ConfirmReadingTo) . '>');
1136 1136
     }
1137 1137
 
1138 1138
     // Add custom headers
1139 1139
     for($index = 0; $index < count($this->CustomHeader); $index++) {
1140
-      $result .= $this->HeaderLine(trim($this->CustomHeader[$index][0]), $this->EncodeHeader(trim($this->CustomHeader[$index][1])));
1140
+        $result .= $this->HeaderLine(trim($this->CustomHeader[$index][0]), $this->EncodeHeader(trim($this->CustomHeader[$index][1])));
1141 1141
     }
1142 1142
     if (!$this->sign_key_file) {
1143
-      $result .= $this->HeaderLine('MIME-Version', '1.0');
1144
-      $result .= $this->GetMailMIME();
1143
+        $result .= $this->HeaderLine('MIME-Version', '1.0');
1144
+        $result .= $this->GetMailMIME();
1145 1145
     }
1146 1146
 
1147 1147
     return $result;
1148
-  }
1149
-
1150
-  /**
1151
-   * Returns the message MIME.
1152
-   * @access public
1153
-   * @return string
1154
-   */
1155
-  public function GetMailMIME() {
1148
+    }
1149
+
1150
+    /**
1151
+     * Returns the message MIME.
1152
+     * @access public
1153
+     * @return string
1154
+     */
1155
+    public function GetMailMIME() {
1156 1156
     $result = '';
1157 1157
     switch($this->message_type) {
1158
-      case 'plain':
1158
+        case 'plain':
1159 1159
         $result .= $this->HeaderLine('Content-Transfer-Encoding', $this->Encoding);
1160 1160
         $result .= sprintf("Content-Type: %s; charset=\"%s\"", $this->ContentType, $this->CharSet);
1161 1161
         break;
1162
-      case 'attachments':
1162
+        case 'attachments':
1163 1163
       case 'alt_attachments':
1164 1164
         if($this->InlineImageExists()){
1165
-          $result .= sprintf("Content-Type: %s;%s\ttype=\"text/html\";%s\tboundary=\"%s\"%s", 'multipart/related', $this->LE, $this->LE, $this->boundary[1], $this->LE);
1165
+            $result .= sprintf("Content-Type: %s;%s\ttype=\"text/html\";%s\tboundary=\"%s\"%s", 'multipart/related', $this->LE, $this->LE, $this->boundary[1], $this->LE);
1166 1166
         } else {
1167
-          $result .= $this->HeaderLine('Content-Type', 'multipart/mixed;');
1168
-          $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
1167
+            $result .= $this->HeaderLine('Content-Type', 'multipart/mixed;');
1168
+            $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
1169 1169
         }
1170 1170
         break;
1171
-      case 'alt':
1171
+        case 'alt':
1172 1172
         $result .= $this->HeaderLine('Content-Type', 'multipart/alternative;');
1173 1173
         $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
1174 1174
         break;
1175 1175
     }
1176 1176
 
1177 1177
     if($this->Mailer != 'mail') {
1178
-      $result .= $this->LE.$this->LE;
1178
+        $result .= $this->LE.$this->LE;
1179 1179
     }
1180 1180
 
1181 1181
     return $result;
1182
-  }
1183
-
1184
-  /**
1185
-   * Assembles the message body.  Returns an empty string on failure.
1186
-   * @access public
1187
-   * @return string The assembled message body
1188
-   */
1189
-  public function CreateBody() {
1182
+    }
1183
+
1184
+    /**
1185
+     * Assembles the message body.  Returns an empty string on failure.
1186
+     * @access public
1187
+     * @return string The assembled message body
1188
+     */
1189
+    public function CreateBody() {
1190 1190
     $body = '';
1191 1191
 
1192 1192
     if ($this->sign_key_file) {
1193
-      $body .= $this->GetMailMIME();
1193
+        $body .= $this->GetMailMIME();
1194 1194
     }
1195 1195
 
1196 1196
     $this->SetWordWrap();
1197 1197
 
1198 1198
     switch($this->message_type) {
1199
-      case 'alt':
1199
+        case 'alt':
1200 1200
         $body .= $this->GetBoundary($this->boundary[1], '', 'text/plain', '');
1201 1201
         $body .= $this->EncodeString($this->AltBody, $this->Encoding);
1202 1202
         $body .= $this->LE.$this->LE;
@@ -1205,16 +1205,16 @@  discard block
 block discarded – undo
1205 1205
         $body .= $this->LE.$this->LE;
1206 1206
         $body .= $this->EndBoundary($this->boundary[1]);
1207 1207
         break;
1208
-      case 'plain':
1208
+        case 'plain':
1209 1209
         $body .= $this->EncodeString($this->Body, $this->Encoding);
1210 1210
         break;
1211
-      case 'attachments':
1211
+        case 'attachments':
1212 1212
         $body .= $this->GetBoundary($this->boundary[1], '', '', '');
1213 1213
         $body .= $this->EncodeString($this->Body, $this->Encoding);
1214 1214
         $body .= $this->LE;
1215 1215
         $body .= $this->AttachAll();
1216 1216
         break;
1217
-      case 'alt_attachments':
1217
+        case 'alt_attachments':
1218 1218
         $body .= sprintf("--%s%s", $this->boundary[1], $this->LE);
1219 1219
         $body .= sprintf("Content-Type: %s;%s" . "\tboundary=\"%s\"%s", 'multipart/alternative', $this->LE, $this->boundary[2], $this->LE.$this->LE);
1220 1220
         $body .= $this->GetBoundary($this->boundary[2], '', 'text/plain', '') . $this->LE; // Create text body
@@ -1229,46 +1229,46 @@  discard block
 block discarded – undo
1229 1229
     }
1230 1230
 
1231 1231
     if ($this->IsError()) {
1232
-      $body = '';
1232
+        $body = '';
1233 1233
     } elseif ($this->sign_key_file) {
1234
-      try {
1234
+        try {
1235 1235
         $file = tempnam('', 'mail');
1236 1236
         file_put_contents($file, $body); //TODO check this worked
1237 1237
         $signed = tempnam("", "signed");
1238 1238
         if (@openssl_pkcs7_sign($file, $signed, "file://".$this->sign_cert_file, array("file://".$this->sign_key_file, $this->sign_key_pass), NULL)) {
1239
-          @unlink($file);
1240
-          @unlink($signed);
1241
-          $body = file_get_contents($signed);
1239
+            @unlink($file);
1240
+            @unlink($signed);
1241
+            $body = file_get_contents($signed);
1242 1242
         } else {
1243
-          @unlink($file);
1244
-          @unlink($signed);
1245
-          throw new phpmailerException($this->Lang("signing").openssl_error_string());
1243
+            @unlink($file);
1244
+            @unlink($signed);
1245
+            throw new phpmailerException($this->Lang("signing").openssl_error_string());
1246 1246
         }
1247
-      } catch (phpmailerException $e) {
1247
+        } catch (phpmailerException $e) {
1248 1248
         $body = '';
1249 1249
         if ($this->exceptions) {
1250
-          throw $e;
1250
+            throw $e;
1251
+        }
1251 1252
         }
1252
-      }
1253 1253
     }
1254 1254
 
1255 1255
     return $body;
1256
-  }
1256
+    }
1257 1257
 
1258
-  /**
1259
-   * Returns the start of a message boundary.
1260
-   * @access private
1261
-   */
1262
-  private function GetBoundary($boundary, $charSet, $contentType, $encoding) {
1258
+    /**
1259
+     * Returns the start of a message boundary.
1260
+     * @access private
1261
+     */
1262
+    private function GetBoundary($boundary, $charSet, $contentType, $encoding) {
1263 1263
     $result = '';
1264 1264
     if($charSet == '') {
1265
-      $charSet = $this->CharSet;
1265
+        $charSet = $this->CharSet;
1266 1266
     }
1267 1267
     if($contentType == '') {
1268
-      $contentType = $this->ContentType;
1268
+        $contentType = $this->ContentType;
1269 1269
     }
1270 1270
     if($encoding == '') {
1271
-      $encoding = $this->Encoding;
1271
+        $encoding = $this->Encoding;
1272 1272
     }
1273 1273
     $result .= $this->TextLine('--' . $boundary);
1274 1274
     $result .= sprintf("Content-Type: %s; charset = \"%s\"", $contentType, $charSet);
@@ -1277,80 +1277,80 @@  discard block
 block discarded – undo
1277 1277
     $result .= $this->LE;
1278 1278
 
1279 1279
     return $result;
1280
-  }
1280
+    }
1281 1281
 
1282
-  /**
1283
-   * Returns the end of a message boundary.
1284
-   * @access private
1285
-   */
1286
-  private function EndBoundary($boundary) {
1282
+    /**
1283
+     * Returns the end of a message boundary.
1284
+     * @access private
1285
+     */
1286
+    private function EndBoundary($boundary) {
1287 1287
     return $this->LE . '--' . $boundary . '--' . $this->LE;
1288
-  }
1289
-
1290
-  /**
1291
-   * Sets the message type.
1292
-   * @access private
1293
-   * @return void
1294
-   */
1295
-  private function SetMessageType() {
1288
+    }
1289
+
1290
+    /**
1291
+     * Sets the message type.
1292
+     * @access private
1293
+     * @return void
1294
+     */
1295
+    private function SetMessageType() {
1296 1296
     if(count($this->attachment) < 1 && strlen($this->AltBody) < 1) {
1297
-      $this->message_type = 'plain';
1297
+        $this->message_type = 'plain';
1298 1298
     } else {
1299
-      if(count($this->attachment) > 0) {
1299
+        if(count($this->attachment) > 0) {
1300 1300
         $this->message_type = 'attachments';
1301
-      }
1302
-      if(strlen($this->AltBody) > 0 && count($this->attachment) < 1) {
1301
+        }
1302
+        if(strlen($this->AltBody) > 0 && count($this->attachment) < 1) {
1303 1303
         $this->message_type = 'alt';
1304
-      }
1305
-      if(strlen($this->AltBody) > 0 && count($this->attachment) > 0) {
1304
+        }
1305
+        if(strlen($this->AltBody) > 0 && count($this->attachment) > 0) {
1306 1306
         $this->message_type = 'alt_attachments';
1307
-      }
1307
+        }
1308
+    }
1308 1309
     }
1309
-  }
1310 1310
 
1311
-  /**
1312
-   *  Returns a formatted header line.
1313
-   * @access public
1314
-   * @return string
1315
-   */
1316
-  public function HeaderLine($name, $value) {
1311
+    /**
1312
+     *  Returns a formatted header line.
1313
+     * @access public
1314
+     * @return string
1315
+     */
1316
+    public function HeaderLine($name, $value) {
1317 1317
     return $name . ': ' . $value . $this->LE;
1318
-  }
1319
-
1320
-  /**
1321
-   * Returns a formatted mail line.
1322
-   * @access public
1323
-   * @return string
1324
-   */
1325
-  public function TextLine($value) {
1318
+    }
1319
+
1320
+    /**
1321
+     * Returns a formatted mail line.
1322
+     * @access public
1323
+     * @return string
1324
+     */
1325
+    public function TextLine($value) {
1326 1326
     return $value . $this->LE;
1327
-  }
1328
-
1329
-  /////////////////////////////////////////////////
1330
-  // CLASS METHODS, ATTACHMENTS
1331
-  /////////////////////////////////////////////////
1332
-
1333
-  /**
1334
-   * Adds an attachment from a path on the filesystem.
1335
-   * Returns false if the file could not be found
1336
-   * or accessed.
1337
-   * @param string $path Path to the attachment.
1338
-   * @param string $name Overrides the attachment name.
1339
-   * @param string $encoding File encoding (see $Encoding).
1340
-   * @param string $type File extension (MIME) type.
1341
-   * @return bool
1342
-   */
1343
-  public function AddAttachment($path, $name = '', $encoding = 'base64', $type = 'application/octet-stream') {
1327
+    }
1328
+
1329
+    /////////////////////////////////////////////////
1330
+    // CLASS METHODS, ATTACHMENTS
1331
+    /////////////////////////////////////////////////
1332
+
1333
+    /**
1334
+     * Adds an attachment from a path on the filesystem.
1335
+     * Returns false if the file could not be found
1336
+     * or accessed.
1337
+     * @param string $path Path to the attachment.
1338
+     * @param string $name Overrides the attachment name.
1339
+     * @param string $encoding File encoding (see $Encoding).
1340
+     * @param string $type File extension (MIME) type.
1341
+     * @return bool
1342
+     */
1343
+    public function AddAttachment($path, $name = '', $encoding = 'base64', $type = 'application/octet-stream') {
1344 1344
     try {
1345
-      if ( !@is_file($path) ) {
1345
+        if ( !@is_file($path) ) {
1346 1346
         throw new phpmailerException($this->Lang('file_access') . $path, self::STOP_CONTINUE);
1347
-      }
1348
-      $filename = basename($path);
1349
-      if ( $name == '' ) {
1347
+        }
1348
+        $filename = basename($path);
1349
+        if ( $name == '' ) {
1350 1350
         $name = $filename;
1351
-      }
1351
+        }
1352 1352
 
1353
-      $this->attachment[] = array(
1353
+        $this->attachment[] = array(
1354 1354
         0 => $path,
1355 1355
         1 => $filename,
1356 1356
         2 => $name,
@@ -1359,36 +1359,36 @@  discard block
 block discarded – undo
1359 1359
         5 => false,  // isStringAttachment
1360 1360
         6 => 'attachment',
1361 1361
         7 => 0
1362
-      );
1362
+        );
1363 1363
 
1364 1364
     } catch (phpmailerException $e) {
1365
-      $this->SetError($e->getMessage());
1366
-      if ($this->exceptions) {
1365
+        $this->SetError($e->getMessage());
1366
+        if ($this->exceptions) {
1367 1367
         throw $e;
1368
-      }
1369
-      error_log($e->getMessage()."\n");
1370
-      if ( $e->getCode() == self::STOP_CRITICAL ) {
1368
+        }
1369
+        error_log($e->getMessage()."\n");
1370
+        if ( $e->getCode() == self::STOP_CRITICAL ) {
1371 1371
         return false;
1372
-      }
1372
+        }
1373 1373
     }
1374 1374
     return true;
1375
-  }
1375
+    }
1376 1376
 
1377
-  /**
1378
-  * Return the current array of attachments
1379
-  * @return array
1380
-  */
1381
-  public function GetAttachments() {
1377
+    /**
1378
+     * Return the current array of attachments
1379
+     * @return array
1380
+     */
1381
+    public function GetAttachments() {
1382 1382
     return $this->attachment;
1383
-  }
1384
-
1385
-  /**
1386
-   * Attaches all fs, string, and binary attachments to the message.
1387
-   * Returns an empty string on failure.
1388
-   * @access private
1389
-   * @return string
1390
-   */
1391
-  private function AttachAll() {
1383
+    }
1384
+
1385
+    /**
1386
+     * Attaches all fs, string, and binary attachments to the message.
1387
+     * Returns an empty string on failure.
1388
+     * @access private
1389
+     * @return string
1390
+     */
1391
+    private function AttachAll() {
1392 1392
     // Return text of body
1393 1393
     $mime = array();
1394 1394
     $cidUniq = array();
@@ -1396,70 +1396,70 @@  discard block
 block discarded – undo
1396 1396
 
1397 1397
     // Add all attachments
1398 1398
     foreach ($this->attachment as $attachment) {
1399
-      // Check for string attachment
1400
-      $bString = $attachment[5];
1401
-      if ($bString) {
1399
+        // Check for string attachment
1400
+        $bString = $attachment[5];
1401
+        if ($bString) {
1402 1402
         $string = $attachment[0];
1403
-      } else {
1403
+        } else {
1404 1404
         $path = $attachment[0];
1405
-      }
1406
-
1407
-      if (in_array($attachment[0], $incl)) { continue; }
1408
-      $filename    = $attachment[1];
1409
-      $name        = $attachment[2];
1410
-      $encoding    = $attachment[3];
1411
-      $type        = $attachment[4];
1412
-      $disposition = $attachment[6];
1413
-      $cid         = $attachment[7];
1414
-      $incl[]      = $attachment[0];
1415
-      if ( $disposition == 'inline' && isset($cidUniq[$cid]) ) { continue; }
1416
-      $cidUniq[$cid] = true;
1417
-
1418
-      $mime[] = sprintf("--%s%s", $this->boundary[1], $this->LE);
1419
-      $mime[] = sprintf("Content-Type: %s; name=\"%s\"%s", $type, $this->EncodeHeader($this->SecureHeader($name)), $this->LE);
1420
-      $mime[] = sprintf("Content-Transfer-Encoding: %s%s", $encoding, $this->LE);
1421
-
1422
-      if($disposition == 'inline') {
1405
+        }
1406
+
1407
+        if (in_array($attachment[0], $incl)) { continue; }
1408
+        $filename    = $attachment[1];
1409
+        $name        = $attachment[2];
1410
+        $encoding    = $attachment[3];
1411
+        $type        = $attachment[4];
1412
+        $disposition = $attachment[6];
1413
+        $cid         = $attachment[7];
1414
+        $incl[]      = $attachment[0];
1415
+        if ( $disposition == 'inline' && isset($cidUniq[$cid]) ) { continue; }
1416
+        $cidUniq[$cid] = true;
1417
+
1418
+        $mime[] = sprintf("--%s%s", $this->boundary[1], $this->LE);
1419
+        $mime[] = sprintf("Content-Type: %s; name=\"%s\"%s", $type, $this->EncodeHeader($this->SecureHeader($name)), $this->LE);
1420
+        $mime[] = sprintf("Content-Transfer-Encoding: %s%s", $encoding, $this->LE);
1421
+
1422
+        if($disposition == 'inline') {
1423 1423
         $mime[] = sprintf("Content-ID: <%s>%s", $cid, $this->LE);
1424
-      }
1424
+        }
1425 1425
 
1426
-      $mime[] = sprintf("Content-Disposition: %s; filename=\"%s\"%s", $disposition, $this->EncodeHeader($this->SecureHeader($name)), $this->LE.$this->LE);
1426
+        $mime[] = sprintf("Content-Disposition: %s; filename=\"%s\"%s", $disposition, $this->EncodeHeader($this->SecureHeader($name)), $this->LE.$this->LE);
1427 1427
 
1428
-      // Encode as string attachment
1429
-      if($bString) {
1428
+        // Encode as string attachment
1429
+        if($bString) {
1430 1430
         $mime[] = $this->EncodeString($string, $encoding);
1431 1431
         if($this->IsError()) {
1432
-          return '';
1432
+            return '';
1433 1433
         }
1434 1434
         $mime[] = $this->LE.$this->LE;
1435
-      } else {
1435
+        } else {
1436 1436
         $mime[] = $this->EncodeFile($path, $encoding);
1437 1437
         if($this->IsError()) {
1438
-          return '';
1438
+            return '';
1439 1439
         }
1440 1440
         $mime[] = $this->LE.$this->LE;
1441
-      }
1441
+        }
1442 1442
     }
1443 1443
 
1444 1444
     $mime[] = sprintf("--%s--%s", $this->boundary[1], $this->LE);
1445 1445
 
1446 1446
     return join('', $mime);
1447
-  }
1448
-
1449
-  /**
1450
-   * Encodes attachment in requested format.
1451
-   * Returns an empty string on failure.
1452
-   * @param string $path The full path to the file
1453
-   * @param string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable'
1454
-   * @see EncodeFile()
1455
-   * @access private
1456
-   * @return string
1457
-   */
1458
-  private function EncodeFile($path, $encoding = 'base64') {
1447
+    }
1448
+
1449
+    /**
1450
+     * Encodes attachment in requested format.
1451
+     * Returns an empty string on failure.
1452
+     * @param string $path The full path to the file
1453
+     * @param string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable'
1454
+     * @see EncodeFile()
1455
+     * @access private
1456
+     * @return string
1457
+     */
1458
+    private function EncodeFile($path, $encoding = 'base64') {
1459 1459
     try {
1460
-      if (!is_readable($path)) {
1460
+        if (!is_readable($path)) {
1461 1461
         throw new phpmailerException($this->Lang('file_open') . $path, self::STOP_CONTINUE);
1462
-      }
1462
+        }
1463 1463
         $magic_quotes = get_magic_quotes_runtime();
1464 1464
         if ($magic_quotes) {
1465 1465
             if (version_compare(PHP_VERSION, '5.3.0', '<')) {
@@ -1479,114 +1479,114 @@  discard block
 block discarded – undo
1479 1479
         }
1480 1480
         return $file_buffer;
1481 1481
     } catch (Exception $e) {
1482
-      $this->SetError($e->getMessage());
1483
-      return '';
1484
-    }
1485
-  }
1486
-
1487
-  /**
1488
-   * Encodes string to requested format.
1489
-   * Returns an empty string on failure.
1490
-   * @param string $str The text to encode
1491
-   * @param string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable'
1492
-   * @access public
1493
-   * @return string
1494
-   */
1495
-  public function EncodeString ($str, $encoding = 'base64') {
1482
+        $this->SetError($e->getMessage());
1483
+        return '';
1484
+    }
1485
+    }
1486
+
1487
+    /**
1488
+     * Encodes string to requested format.
1489
+     * Returns an empty string on failure.
1490
+     * @param string $str The text to encode
1491
+     * @param string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable'
1492
+     * @access public
1493
+     * @return string
1494
+     */
1495
+    public function EncodeString ($str, $encoding = 'base64') {
1496 1496
     $encoded = '';
1497 1497
     switch(strtolower($encoding)) {
1498
-      case 'base64':
1498
+        case 'base64':
1499 1499
         $encoded = chunk_split(base64_encode($str), 76, $this->LE);
1500 1500
         break;
1501
-      case '7bit':
1501
+        case '7bit':
1502 1502
       case '8bit':
1503 1503
         $encoded = $this->FixEOL($str);
1504 1504
         //Make sure it ends with a line break
1505 1505
         if (substr($encoded, -(strlen($this->LE))) != $this->LE)
1506
-          $encoded .= $this->LE;
1506
+            $encoded .= $this->LE;
1507 1507
         break;
1508
-      case 'binary':
1508
+        case 'binary':
1509 1509
         $encoded = $str;
1510 1510
         break;
1511
-      case 'quoted-printable':
1511
+        case 'quoted-printable':
1512 1512
         $encoded = $this->EncodeQP($str);
1513 1513
         break;
1514
-      default:
1514
+        default:
1515 1515
         $this->SetError($this->Lang('encoding') . $encoding);
1516 1516
         break;
1517 1517
     }
1518 1518
     return $encoded;
1519
-  }
1520
-
1521
-  /**
1522
-   * Encode a header string to best (shortest) of Q, B, quoted or none.
1523
-   * @access public
1524
-   * @return string
1525
-   */
1526
-  public function EncodeHeader($str, $position = 'text') {
1519
+    }
1520
+
1521
+    /**
1522
+     * Encode a header string to best (shortest) of Q, B, quoted or none.
1523
+     * @access public
1524
+     * @return string
1525
+     */
1526
+    public function EncodeHeader($str, $position = 'text') {
1527 1527
     $x = 0;
1528 1528
 
1529 1529
     switch (strtolower($position)) {
1530
-      case 'phrase':
1530
+        case 'phrase':
1531 1531
         if (!preg_match('/[\200-\377]/', $str)) {
1532
-          // Can't use addslashes as we don't know what value has magic_quotes_sybase
1533
-          $encoded = addcslashes($str, "\0..\37\177\\\"");
1534
-          if (($str == $encoded) && !preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $str)) {
1532
+            // Can't use addslashes as we don't know what value has magic_quotes_sybase
1533
+            $encoded = addcslashes($str, "\0..\37\177\\\"");
1534
+            if (($str == $encoded) && !preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $str)) {
1535 1535
             return ($encoded);
1536
-          } else {
1536
+            } else {
1537 1537
             return ("\"$encoded\"");
1538
-          }
1538
+            }
1539 1539
         }
1540 1540
         $x = preg_match_all('/[^\040\041\043-\133\135-\176]/', $str, $matches);
1541 1541
         break;
1542
-      case 'comment':
1542
+        case 'comment':
1543 1543
         $x = preg_match_all('/[()"]/', $str, $matches);
1544 1544
         // Fall-through
1545
-      case 'text':
1545
+        case 'text':
1546 1546
       default:
1547 1547
         $x += preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/', $str, $matches);
1548 1548
         break;
1549 1549
     }
1550 1550
 
1551 1551
     if ($x == 0) {
1552
-      return ($str);
1552
+        return ($str);
1553 1553
     }
1554 1554
 
1555 1555
     $maxlen = 75 - 7 - strlen($this->CharSet);
1556 1556
     // Try to select the encoding which should produce the shortest output
1557 1557
     if (strlen($str)/3 < $x) {
1558
-      $encoding = 'B';
1559
-      // Modified by Ivan Tcholakov, 24-JAN-2010.
1560
-      //if (function_exists('mb_strlen') && $this->HasMultiBytes($str)) {
1561
-      if ($this->HasMultiBytes($str)) {
1562
-      //
1558
+        $encoding = 'B';
1559
+        // Modified by Ivan Tcholakov, 24-JAN-2010.
1560
+        //if (function_exists('mb_strlen') && $this->HasMultiBytes($str)) {
1561
+        if ($this->HasMultiBytes($str)) {
1562
+        //
1563 1563
         // Use a custom function which correctly encodes and wraps long
1564 1564
         // multibyte strings without breaking lines within a character
1565 1565
         $encoded = $this->Base64EncodeWrapMB($str);
1566
-      } else {
1566
+        } else {
1567 1567
         $encoded = base64_encode($str);
1568 1568
         $maxlen -= $maxlen % 4;
1569 1569
         $encoded = trim(chunk_split($encoded, $maxlen, "\n"));
1570
-      }
1570
+        }
1571 1571
     } else {
1572
-      $encoding = 'Q';
1573
-      $encoded = $this->EncodeQ($str, $position);
1574
-      $encoded = $this->WrapText($encoded, $maxlen, true);
1575
-      $encoded = str_replace('='.$this->LE, "\n", trim($encoded));
1572
+        $encoding = 'Q';
1573
+        $encoded = $this->EncodeQ($str, $position);
1574
+        $encoded = $this->WrapText($encoded, $maxlen, true);
1575
+        $encoded = str_replace('='.$this->LE, "\n", trim($encoded));
1576 1576
     }
1577 1577
 
1578 1578
     $encoded = preg_replace('/^(.*)$/m', " =?".$this->CharSet."?$encoding?\\1?=", $encoded);
1579 1579
     $encoded = trim(str_replace("\n", $this->LE, $encoded));
1580 1580
 
1581 1581
     return $encoded;
1582
-  }
1583
-
1584
-  /**
1585
-   * Checks if a string contains multibyte characters.
1586
-   * @access public
1587
-   * @param string $str multi-byte text to wrap encode
1588
-   * @return bool
1589
-   */
1582
+    }
1583
+
1584
+    /**
1585
+     * Checks if a string contains multibyte characters.
1586
+     * @access public
1587
+     * @param string $str multi-byte text to wrap encode
1588
+     * @return bool
1589
+     */
1590 1590
     public function HasMultiBytes($str)
1591 1591
     {
1592 1592
         if (function_exists('mb_strlen')) {
@@ -1597,15 +1597,15 @@  discard block
 block discarded – undo
1597 1597
 
1598 1598
     }
1599 1599
 
1600
-  /**
1601
-   * Correctly encodes and wraps long multibyte strings for mail headers
1602
-   * without breaking lines within a character.
1603
-   * Adapted from a function by paravoid at http://uk.php.net/manual/en/function.mb-encode-mimeheader.php
1604
-   * @access public
1605
-   * @param string $str multi-byte text to wrap encode
1606
-   * @return string
1607
-   */
1608
-  public function Base64EncodeWrapMB($str) {
1600
+    /**
1601
+     * Correctly encodes and wraps long multibyte strings for mail headers
1602
+     * without breaking lines within a character.
1603
+     * Adapted from a function by paravoid at http://uk.php.net/manual/en/function.mb-encode-mimeheader.php
1604
+     * @access public
1605
+     * @param string $str multi-byte text to wrap encode
1606
+     * @return string
1607
+     */
1608
+    public function Base64EncodeWrapMB($str) {
1609 1609
     $start = "=?".$this->CharSet."?B?";
1610 1610
     $end = "?=";
1611 1611
     $encoded = "";
@@ -1622,9 +1622,9 @@  discard block
 block discarded – undo
1622 1622
     $offset = $avgLength = floor($length * $ratio * .75);
1623 1623
 
1624 1624
     for ($i = 0; $i < $mb_length; $i += $offset) {
1625
-      $lookBack = 0;
1625
+        $lookBack = 0;
1626 1626
 
1627
-      do {
1627
+        do {
1628 1628
         $offset = $avgLength - $lookBack;
1629 1629
         // Modified by Ivan Tcholakov, 24-JAN-2010.
1630 1630
         //$chunk = mb_substr($str, $i, $offset, $this->CharSet);
@@ -1632,85 +1632,85 @@  discard block
 block discarded – undo
1632 1632
         //
1633 1633
         $chunk = base64_encode($chunk);
1634 1634
         $lookBack++;
1635
-      }
1636
-      while (strlen($chunk) > $length);
1635
+        }
1636
+        while (strlen($chunk) > $length);
1637 1637
 
1638
-      $encoded .= $chunk . $this->LE;
1638
+        $encoded .= $chunk . $this->LE;
1639 1639
     }
1640 1640
 
1641 1641
     // Chomp the last linefeed
1642 1642
     $encoded = substr($encoded, 0, -strlen($this->LE));
1643 1643
     return $encoded;
1644
-  }
1645
-
1646
-  /**
1647
-  * Encode string to quoted-printable.
1648
-  * Only uses standard PHP, slow, but will always work
1649
-  * @access public
1650
-  * @param string $string the text to encode
1651
-  * @param integer $line_max Number of chars allowed on a line before wrapping
1652
-  * @return string
1653
-  */
1654
-  public function EncodeQPphp( $input = '', $line_max = 76, $space_conv = false) {
1644
+    }
1645
+
1646
+    /**
1647
+     * Encode string to quoted-printable.
1648
+     * Only uses standard PHP, slow, but will always work
1649
+     * @access public
1650
+     * @param string $string the text to encode
1651
+     * @param integer $line_max Number of chars allowed on a line before wrapping
1652
+     * @return string
1653
+     */
1654
+    public function EncodeQPphp( $input = '', $line_max = 76, $space_conv = false) {
1655 1655
     $hex = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
1656 1656
     $lines = preg_split('/(?:\r\n|\r|\n)/', $input);
1657 1657
     $eol = "\r\n";
1658 1658
     $escape = '=';
1659 1659
     $output = '';
1660 1660
     while( list(, $line) = each($lines) ) {
1661
-      $linlen = strlen($line);
1662
-      $newline = '';
1663
-      for($i = 0; $i < $linlen; $i++) {
1661
+        $linlen = strlen($line);
1662
+        $newline = '';
1663
+        for($i = 0; $i < $linlen; $i++) {
1664 1664
         $c = substr( $line, $i, 1 );
1665 1665
         $dec = ord( $c );
1666 1666
         if ( ( $i == 0 ) && ( $dec == 46 ) ) { // convert first point in the line into =2E
1667
-          $c = '=2E';
1667
+            $c = '=2E';
1668 1668
         }
1669 1669
         if ( $dec == 32 ) {
1670
-          if ( $i == ( $linlen - 1 ) ) { // convert space at eol only
1670
+            if ( $i == ( $linlen - 1 ) ) { // convert space at eol only
1671 1671
             $c = '=20';
1672
-          } else if ( $space_conv ) {
1672
+            } else if ( $space_conv ) {
1673 1673
             $c = '=20';
1674
-          }
1674
+            }
1675 1675
         } elseif ( ($dec == 61) || ($dec < 32 ) || ($dec > 126) ) { // always encode "\t", which is *not* required
1676
-          $h2 = floor($dec/16);
1677
-          $h1 = floor($dec%16);
1678
-          $c = $escape.$hex[$h2].$hex[$h1];
1676
+            $h2 = floor($dec/16);
1677
+            $h1 = floor($dec%16);
1678
+            $c = $escape.$hex[$h2].$hex[$h1];
1679 1679
         }
1680 1680
         if ( (strlen($newline) + strlen($c)) >= $line_max ) { // CRLF is not counted
1681
-          $output .= $newline.$escape.$eol; //  soft line break; " =\r\n" is okay
1682
-          $newline = '';
1683
-          // check if newline first character will be point or not
1684
-          if ( $dec == 46 ) {
1681
+            $output .= $newline.$escape.$eol; //  soft line break; " =\r\n" is okay
1682
+            $newline = '';
1683
+            // check if newline first character will be point or not
1684
+            if ( $dec == 46 ) {
1685 1685
             $c = '=2E';
1686
-          }
1686
+            }
1687 1687
         }
1688 1688
         $newline .= $c;
1689
-      } // end of for
1690
-      $output .= $newline.$eol;
1689
+        } // end of for
1690
+        $output .= $newline.$eol;
1691 1691
     } // end of while
1692 1692
     return $output;
1693
-  }
1694
-
1695
-  /**
1696
-  * Encode string to RFC2045 (6.7) quoted-printable format
1697
-  * Uses a PHP5 stream filter to do the encoding about 64x faster than the old version
1698
-  * Also results in same content as you started with after decoding
1699
-  * @see EncodeQPphp()
1700
-  * @access public
1701
-  * @param string $string the text to encode
1702
-  * @param integer $line_max Number of chars allowed on a line before wrapping
1703
-  * @param boolean $space_conv Dummy param for compatibility with existing EncodeQP function
1704
-  * @return string
1705
-  * @author Marcus Bointon
1706
-  */
1707
-  public function EncodeQP($string, $line_max = 76, $space_conv = false) {
1693
+    }
1694
+
1695
+    /**
1696
+     * Encode string to RFC2045 (6.7) quoted-printable format
1697
+     * Uses a PHP5 stream filter to do the encoding about 64x faster than the old version
1698
+     * Also results in same content as you started with after decoding
1699
+     * @see EncodeQPphp()
1700
+     * @access public
1701
+     * @param string $string the text to encode
1702
+     * @param integer $line_max Number of chars allowed on a line before wrapping
1703
+     * @param boolean $space_conv Dummy param for compatibility with existing EncodeQP function
1704
+     * @return string
1705
+     * @author Marcus Bointon
1706
+     */
1707
+    public function EncodeQP($string, $line_max = 76, $space_conv = false) {
1708 1708
     if (function_exists('quoted_printable_encode')) { //Use native function if it's available (>= PHP5.3)
1709
-      return quoted_printable_encode($string);
1709
+        return quoted_printable_encode($string);
1710 1710
     }
1711 1711
     $filters = stream_get_filters();
1712 1712
     if (!in_array('convert.*', $filters)) { //Got convert stream filter?
1713
-      return $this->EncodeQPphp($string, $line_max, $space_conv); //Fall back to old implementation
1713
+        return $this->EncodeQPphp($string, $line_max, $space_conv); //Fall back to old implementation
1714 1714
     }
1715 1715
     $fp = fopen('php://temp/', 'r+');
1716 1716
     $string = preg_replace('/\r\n?/', $this->LE, $string); //Normalise line breaks
@@ -1723,32 +1723,32 @@  discard block
 block discarded – undo
1723 1723
     $out = preg_replace('/^\./m', '=2E', $out); //Encode . if it is first char on a line, workaround for bug in Exchange
1724 1724
     fclose($fp);
1725 1725
     return $out;
1726
-  }
1727
-
1728
-  /**
1729
-   * Encode string to q encoding.
1730
-   * @link http://tools.ietf.org/html/rfc2047
1731
-   * @param string $str the text to encode
1732
-   * @param string $position Where the text is going to be used, see the RFC for what that means
1733
-   * @access public
1734
-   * @return string
1735
-   */
1736
-  public function EncodeQ ($str, $position = 'text') {
1726
+    }
1727
+
1728
+    /**
1729
+     * Encode string to q encoding.
1730
+     * @link http://tools.ietf.org/html/rfc2047
1731
+     * @param string $str the text to encode
1732
+     * @param string $position Where the text is going to be used, see the RFC for what that means
1733
+     * @access public
1734
+     * @return string
1735
+     */
1736
+    public function EncodeQ ($str, $position = 'text') {
1737 1737
     // There should not be any EOL in the string
1738 1738
     $encoded = preg_replace('/[\r\n]*/', '', $str);
1739 1739
 
1740 1740
     switch (strtolower($position)) {
1741
-      case 'phrase':
1741
+        case 'phrase':
1742 1742
         $encoded = preg_replace("/([^A-Za-z0-9!*+\/ -])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded);
1743 1743
         break;
1744
-      case 'comment':
1744
+        case 'comment':
1745 1745
         $encoded = preg_replace("/([\(\)\"])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded);
1746
-      case 'text':
1746
+        case 'text':
1747 1747
       default:
1748 1748
         // Replace every high ascii, control =, ? and _ characters
1749 1749
         //TODO using /e (equivalent to eval()) is probably not a good idea
1750 1750
         $encoded = preg_replace('/([\000-\011\013\014\016-\037\075\077\137\177-\377])/e',
1751
-              "'='.sprintf('%02X', ord('\\1'))", $encoded);
1751
+                "'='.sprintf('%02X', ord('\\1'))", $encoded);
1752 1752
         break;
1753 1753
     }
1754 1754
 
@@ -1756,187 +1756,187 @@  discard block
 block discarded – undo
1756 1756
     $encoded = str_replace(' ', '_', $encoded);
1757 1757
 
1758 1758
     return $encoded;
1759
-  }
1760
-
1761
-  /**
1762
-   * Adds a string or binary attachment (non-filesystem) to the list.
1763
-   * This method can be used to attach ascii or binary data,
1764
-   * such as a BLOB record from a database.
1765
-   * @param string $string String attachment data.
1766
-   * @param string $filename Name of the attachment.
1767
-   * @param string $encoding File encoding (see $Encoding).
1768
-   * @param string $type File extension (MIME) type.
1769
-   * @return void
1770
-   */
1771
-  public function AddStringAttachment($string, $filename, $encoding = 'base64', $type = 'application/octet-stream') {
1759
+    }
1760
+
1761
+    /**
1762
+     * Adds a string or binary attachment (non-filesystem) to the list.
1763
+     * This method can be used to attach ascii or binary data,
1764
+     * such as a BLOB record from a database.
1765
+     * @param string $string String attachment data.
1766
+     * @param string $filename Name of the attachment.
1767
+     * @param string $encoding File encoding (see $Encoding).
1768
+     * @param string $type File extension (MIME) type.
1769
+     * @return void
1770
+     */
1771
+    public function AddStringAttachment($string, $filename, $encoding = 'base64', $type = 'application/octet-stream') {
1772 1772
     // Append to $attachment array
1773 1773
     $this->attachment[] = array(
1774
-      0 => $string,
1775
-      1 => $filename,
1776
-      2 => basename($filename),
1777
-      3 => $encoding,
1778
-      4 => $type,
1779
-      5 => true,  // isStringAttachment
1780
-      6 => 'attachment',
1781
-      7 => 0
1774
+        0 => $string,
1775
+        1 => $filename,
1776
+        2 => basename($filename),
1777
+        3 => $encoding,
1778
+        4 => $type,
1779
+        5 => true,  // isStringAttachment
1780
+        6 => 'attachment',
1781
+        7 => 0
1782 1782
     );
1783
-  }
1784
-
1785
-  /**
1786
-   * Adds an embedded attachment.  This can include images, sounds, and
1787
-   * just about any other document.  Make sure to set the $type to an
1788
-   * image type.  For JPEG images use "image/jpeg" and for GIF images
1789
-   * use "image/gif".
1790
-   * @param string $path Path to the attachment.
1791
-   * @param string $cid Content ID of the attachment.  Use this to identify
1792
-   *        the Id for accessing the image in an HTML form.
1793
-   * @param string $name Overrides the attachment name.
1794
-   * @param string $encoding File encoding (see $Encoding).
1795
-   * @param string $type File extension (MIME) type.
1796
-   * @return bool
1797
-   */
1798
-  public function AddEmbeddedImage($path, $cid, $name = '', $encoding = 'base64', $type = 'application/octet-stream') {
1783
+    }
1784
+
1785
+    /**
1786
+     * Adds an embedded attachment.  This can include images, sounds, and
1787
+     * just about any other document.  Make sure to set the $type to an
1788
+     * image type.  For JPEG images use "image/jpeg" and for GIF images
1789
+     * use "image/gif".
1790
+     * @param string $path Path to the attachment.
1791
+     * @param string $cid Content ID of the attachment.  Use this to identify
1792
+     *        the Id for accessing the image in an HTML form.
1793
+     * @param string $name Overrides the attachment name.
1794
+     * @param string $encoding File encoding (see $Encoding).
1795
+     * @param string $type File extension (MIME) type.
1796
+     * @return bool
1797
+     */
1798
+    public function AddEmbeddedImage($path, $cid, $name = '', $encoding = 'base64', $type = 'application/octet-stream') {
1799 1799
 
1800 1800
     if ( !@is_file($path) ) {
1801
-      $this->SetError($this->Lang('file_access') . $path);
1802
-      return false;
1801
+        $this->SetError($this->Lang('file_access') . $path);
1802
+        return false;
1803 1803
     }
1804 1804
 
1805 1805
     $filename = basename($path);
1806 1806
     if ( $name == '' ) {
1807
-      $name = $filename;
1807
+        $name = $filename;
1808 1808
     }
1809 1809
 
1810 1810
     // Append to $attachment array
1811 1811
     $this->attachment[] = array(
1812
-      0 => $path,
1813
-      1 => $filename,
1814
-      2 => $name,
1815
-      3 => $encoding,
1816
-      4 => $type,
1817
-      5 => false,  // isStringAttachment
1818
-      6 => 'inline',
1819
-      7 => $cid
1812
+        0 => $path,
1813
+        1 => $filename,
1814
+        2 => $name,
1815
+        3 => $encoding,
1816
+        4 => $type,
1817
+        5 => false,  // isStringAttachment
1818
+        6 => 'inline',
1819
+        7 => $cid
1820 1820
     );
1821 1821
 
1822 1822
     return true;
1823
-  }
1824
-
1825
-  /**
1826
-   * Returns true if an inline attachment is present.
1827
-   * @access public
1828
-   * @return bool
1829
-   */
1830
-  public function InlineImageExists() {
1823
+    }
1824
+
1825
+    /**
1826
+     * Returns true if an inline attachment is present.
1827
+     * @access public
1828
+     * @return bool
1829
+     */
1830
+    public function InlineImageExists() {
1831 1831
     foreach($this->attachment as $attachment) {
1832
-      if ($attachment[6] == 'inline') {
1832
+        if ($attachment[6] == 'inline') {
1833 1833
         return true;
1834
-      }
1834
+        }
1835 1835
     }
1836 1836
     return false;
1837
-  }
1837
+    }
1838 1838
 
1839
-  /////////////////////////////////////////////////
1840
-  // CLASS METHODS, MESSAGE RESET
1841
-  /////////////////////////////////////////////////
1839
+    /////////////////////////////////////////////////
1840
+    // CLASS METHODS, MESSAGE RESET
1841
+    /////////////////////////////////////////////////
1842 1842
 
1843
-  /**
1844
-   * Clears all recipients assigned in the TO array.  Returns void.
1845
-   * @return void
1846
-   */
1847
-  public function ClearAddresses() {
1843
+    /**
1844
+     * Clears all recipients assigned in the TO array.  Returns void.
1845
+     * @return void
1846
+     */
1847
+    public function ClearAddresses() {
1848 1848
     foreach($this->to as $to) {
1849
-      unset($this->all_recipients[strtolower($to[0])]);
1849
+        unset($this->all_recipients[strtolower($to[0])]);
1850 1850
     }
1851 1851
     $this->to = array();
1852
-  }
1852
+    }
1853 1853
 
1854
-  /**
1855
-   * Clears all recipients assigned in the CC array.  Returns void.
1856
-   * @return void
1857
-   */
1858
-  public function ClearCCs() {
1854
+    /**
1855
+     * Clears all recipients assigned in the CC array.  Returns void.
1856
+     * @return void
1857
+     */
1858
+    public function ClearCCs() {
1859 1859
     foreach($this->cc as $cc) {
1860
-      unset($this->all_recipients[strtolower($cc[0])]);
1860
+        unset($this->all_recipients[strtolower($cc[0])]);
1861 1861
     }
1862 1862
     $this->cc = array();
1863
-  }
1863
+    }
1864 1864
 
1865
-  /**
1866
-   * Clears all recipients assigned in the BCC array.  Returns void.
1867
-   * @return void
1868
-   */
1869
-  public function ClearBCCs() {
1865
+    /**
1866
+     * Clears all recipients assigned in the BCC array.  Returns void.
1867
+     * @return void
1868
+     */
1869
+    public function ClearBCCs() {
1870 1870
     foreach($this->bcc as $bcc) {
1871
-      unset($this->all_recipients[strtolower($bcc[0])]);
1871
+        unset($this->all_recipients[strtolower($bcc[0])]);
1872 1872
     }
1873 1873
     $this->bcc = array();
1874
-  }
1874
+    }
1875 1875
 
1876
-  /**
1877
-   * Clears all recipients assigned in the ReplyTo array.  Returns void.
1878
-   * @return void
1879
-   */
1880
-  public function ClearReplyTos() {
1876
+    /**
1877
+     * Clears all recipients assigned in the ReplyTo array.  Returns void.
1878
+     * @return void
1879
+     */
1880
+    public function ClearReplyTos() {
1881 1881
     $this->ReplyTo = array();
1882
-  }
1883
-
1884
-  /**
1885
-   * Clears all recipients assigned in the TO, CC and BCC
1886
-   * array.  Returns void.
1887
-   * @return void
1888
-   */
1889
-  public function ClearAllRecipients() {
1882
+    }
1883
+
1884
+    /**
1885
+     * Clears all recipients assigned in the TO, CC and BCC
1886
+     * array.  Returns void.
1887
+     * @return void
1888
+     */
1889
+    public function ClearAllRecipients() {
1890 1890
     $this->to = array();
1891 1891
     $this->cc = array();
1892 1892
     $this->bcc = array();
1893 1893
     $this->all_recipients = array();
1894
-  }
1895
-
1896
-  /**
1897
-   * Clears all previously set filesystem, string, and binary
1898
-   * attachments.  Returns void.
1899
-   * @return void
1900
-   */
1901
-  public function ClearAttachments() {
1894
+    }
1895
+
1896
+    /**
1897
+     * Clears all previously set filesystem, string, and binary
1898
+     * attachments.  Returns void.
1899
+     * @return void
1900
+     */
1901
+    public function ClearAttachments() {
1902 1902
     $this->attachment = array();
1903
-  }
1903
+    }
1904 1904
 
1905
-  /**
1906
-   * Clears all custom headers.  Returns void.
1907
-   * @return void
1908
-   */
1909
-  public function ClearCustomHeaders() {
1905
+    /**
1906
+     * Clears all custom headers.  Returns void.
1907
+     * @return void
1908
+     */
1909
+    public function ClearCustomHeaders() {
1910 1910
     $this->CustomHeader = array();
1911
-  }
1912
-
1913
-  /////////////////////////////////////////////////
1914
-  // CLASS METHODS, MISCELLANEOUS
1915
-  /////////////////////////////////////////////////
1916
-
1917
-  /**
1918
-   * Adds the error message to the error container.
1919
-   * @access protected
1920
-   * @return void
1921
-   */
1922
-  protected function SetError($msg) {
1911
+    }
1912
+
1913
+    /////////////////////////////////////////////////
1914
+    // CLASS METHODS, MISCELLANEOUS
1915
+    /////////////////////////////////////////////////
1916
+
1917
+    /**
1918
+     * Adds the error message to the error container.
1919
+     * @access protected
1920
+     * @return void
1921
+     */
1922
+    protected function SetError($msg) {
1923 1923
     $this->error_count++;
1924 1924
     if ($this->Mailer == 'smtp' and !is_null($this->smtp)) {
1925
-      $lasterror = $this->smtp->getError();
1926
-      if (!empty($lasterror) and array_key_exists('smtp_msg', $lasterror)) {
1925
+        $lasterror = $this->smtp->getError();
1926
+        if (!empty($lasterror) and array_key_exists('smtp_msg', $lasterror)) {
1927 1927
         $msg .= '<p>' . $this->Lang('smtp_error') . $lasterror['smtp_msg'] . "</p>\n";
1928
-      }
1928
+        }
1929 1929
     }
1930 1930
     $this->ErrorInfo = $msg;
1931
-  }
1932
-
1933
-  /**
1934
-   * Returns the proper RFC 822 formatted date.
1935
-   * @access public
1936
-   * @return string
1937
-   * @static
1938
-   */
1939
-  public static function RFCDate() {
1931
+    }
1932
+
1933
+    /**
1934
+     * Returns the proper RFC 822 formatted date.
1935
+     * @access public
1936
+     * @return string
1937
+     * @static
1938
+     */
1939
+    public static function RFCDate() {
1940 1940
     $tz = date('Z');
1941 1941
     $tzs = ($tz < 0) ? '-' : '+';
1942 1942
     $tz = abs($tz);
@@ -1944,346 +1944,346 @@  discard block
 block discarded – undo
1944 1944
     $result = sprintf("%s %s%04d", date('D, j M Y H:i:s'), $tzs, $tz);
1945 1945
 
1946 1946
     return $result;
1947
-  }
1948
-
1949
-  /**
1950
-   * Returns the server hostname or 'localhost.localdomain' if unknown.
1951
-   * @access private
1952
-   * @return string
1953
-   */
1954
-  private function ServerHostname() {
1947
+    }
1948
+
1949
+    /**
1950
+     * Returns the server hostname or 'localhost.localdomain' if unknown.
1951
+     * @access private
1952
+     * @return string
1953
+     */
1954
+    private function ServerHostname() {
1955 1955
     if (!empty($this->Hostname)) {
1956
-      $result = $this->Hostname;
1956
+        $result = $this->Hostname;
1957 1957
     } elseif (isset($_SERVER['SERVER_NAME'])) {
1958
-      $result = $_SERVER['SERVER_NAME'];
1958
+        $result = $_SERVER['SERVER_NAME'];
1959 1959
     } else {
1960
-      $result = 'localhost.localdomain';
1960
+        $result = 'localhost.localdomain';
1961 1961
     }
1962 1962
 
1963 1963
     return $result;
1964
-  }
1965
-
1966
-  /**
1967
-   * Returns a message in the appropriate language.
1968
-   * @access private
1969
-   * @return string
1970
-   */
1971
-  private function Lang($key) {
1964
+    }
1965
+
1966
+    /**
1967
+     * Returns a message in the appropriate language.
1968
+     * @access private
1969
+     * @return string
1970
+     */
1971
+    private function Lang($key) {
1972 1972
     if(count($this->language) < 1) {
1973
-      $this->SetLanguage('en'); // set the default language
1973
+        $this->SetLanguage('en'); // set the default language
1974 1974
     }
1975 1975
 
1976 1976
     if(isset($this->language[$key])) {
1977
-      return $this->language[$key];
1977
+        return $this->language[$key];
1978 1978
     } else {
1979
-      return 'Language string failed to load: ' . $key;
1979
+        return 'Language string failed to load: ' . $key;
1980
+    }
1980 1981
     }
1981
-  }
1982 1982
 
1983
-  /**
1984
-   * Returns true if an error occurred.
1985
-   * @access public
1986
-   * @return bool
1987
-   */
1988
-  public function IsError() {
1983
+    /**
1984
+     * Returns true if an error occurred.
1985
+     * @access public
1986
+     * @return bool
1987
+     */
1988
+    public function IsError() {
1989 1989
     return ($this->error_count > 0);
1990
-  }
1991
-
1992
-  /**
1993
-   * Changes every end of line from CR or LF to CRLF.
1994
-   * @access private
1995
-   * @return string
1996
-   */
1997
-  private function FixEOL($str) {
1990
+    }
1991
+
1992
+    /**
1993
+     * Changes every end of line from CR or LF to CRLF.
1994
+     * @access private
1995
+     * @return string
1996
+     */
1997
+    private function FixEOL($str) {
1998 1998
     $str = str_replace("\r\n", "\n", $str);
1999 1999
     $str = str_replace("\r", "\n", $str);
2000 2000
     $str = str_replace("\n", $this->LE, $str);
2001 2001
     return $str;
2002
-  }
2003
-
2004
-  /**
2005
-   * Adds a custom header.
2006
-   * @access public
2007
-   * @return void
2008
-   */
2009
-  public function AddCustomHeader($custom_header) {
2002
+    }
2003
+
2004
+    /**
2005
+     * Adds a custom header.
2006
+     * @access public
2007
+     * @return void
2008
+     */
2009
+    public function AddCustomHeader($custom_header) {
2010 2010
     $this->CustomHeader[] = explode(':', $custom_header, 2);
2011
-  }
2012
-
2013
-  /**
2014
-   * Evaluates the message and returns modifications for inline images and backgrounds
2015
-   * @access public
2016
-   * @return $message
2017
-   */
2018
-  public function MsgHTML($message, $basedir = '') {
2011
+    }
2012
+
2013
+    /**
2014
+     * Evaluates the message and returns modifications for inline images and backgrounds
2015
+     * @access public
2016
+     * @return $message
2017
+     */
2018
+    public function MsgHTML($message, $basedir = '') {
2019 2019
     preg_match_all("/(src|background)=\"(.*)\"/Ui", $message, $images);
2020 2020
     if(isset($images[2])) {
2021
-      foreach($images[2] as $i => $url) {
2021
+        foreach($images[2] as $i => $url) {
2022 2022
         // do not change urls for absolute images (thanks to corvuscorax)
2023 2023
         if (!preg_match('#^[A-z]+://#',$url)) {
2024
-          $filename = basename($url);
2025
-          $directory = dirname($url);
2026
-          ($directory == '.')?$directory='':'';
2027
-          $cid = 'cid:' . md5($filename);
2028
-          $ext = pathinfo($filename, PATHINFO_EXTENSION);
2029
-          $mimeType  = self::_mime_types($ext);
2030
-          if ( strlen($basedir) > 1 && substr($basedir,-1) != '/') { $basedir .= '/'; }
2031
-          if ( strlen($directory) > 1 && substr($directory,-1) != '/') { $directory .= '/'; }
2032
-          if ( $this->AddEmbeddedImage($basedir.$directory.$filename, md5($filename), $filename, 'base64',$mimeType) ) {
2024
+            $filename = basename($url);
2025
+            $directory = dirname($url);
2026
+            ($directory == '.')?$directory='':'';
2027
+            $cid = 'cid:' . md5($filename);
2028
+            $ext = pathinfo($filename, PATHINFO_EXTENSION);
2029
+            $mimeType  = self::_mime_types($ext);
2030
+            if ( strlen($basedir) > 1 && substr($basedir,-1) != '/') { $basedir .= '/'; }
2031
+            if ( strlen($directory) > 1 && substr($directory,-1) != '/') { $directory .= '/'; }
2032
+            if ( $this->AddEmbeddedImage($basedir.$directory.$filename, md5($filename), $filename, 'base64',$mimeType) ) {
2033 2033
             $message = preg_replace("/".$images[1][$i]."=\"".preg_quote($url, '/')."\"/Ui", $images[1][$i]."=\"".$cid."\"", $message);
2034
-          }
2034
+            }
2035
+        }
2035 2036
         }
2036
-      }
2037 2037
     }
2038 2038
     $this->IsHTML(true);
2039 2039
     $this->Body = $message;
2040 2040
     $textMsg = trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/s','',$message)));
2041 2041
     if (!empty($textMsg) && empty($this->AltBody)) {
2042
-      $this->AltBody = html_entity_decode($textMsg);
2042
+        $this->AltBody = html_entity_decode($textMsg);
2043 2043
     }
2044 2044
     if (empty($this->AltBody)) {
2045
-      $this->AltBody = 'To view this email message, open it in a program that understands HTML!' . "\n\n";
2046
-    }
2047
-  }
2048
-
2049
-  /**
2050
-   * Gets the MIME type of the embedded or inline image
2051
-   * @param string File extension
2052
-   * @access public
2053
-   * @return string MIME type of ext
2054
-   * @static
2055
-   */
2056
-  public static function _mime_types($ext = '') {
2045
+        $this->AltBody = 'To view this email message, open it in a program that understands HTML!' . "\n\n";
2046
+    }
2047
+    }
2048
+
2049
+    /**
2050
+     * Gets the MIME type of the embedded or inline image
2051
+     * @param string File extension
2052
+     * @access public
2053
+     * @return string MIME type of ext
2054
+     * @static
2055
+     */
2056
+    public static function _mime_types($ext = '') {
2057 2057
     $mimes = array(
2058
-      'hqx'   =>  'application/mac-binhex40',
2059
-      'cpt'   =>  'application/mac-compactpro',
2060
-      'doc'   =>  'application/msword',
2061
-      'bin'   =>  'application/macbinary',
2062
-      'dms'   =>  'application/octet-stream',
2063
-      'lha'   =>  'application/octet-stream',
2064
-      'lzh'   =>  'application/octet-stream',
2065
-      'exe'   =>  'application/octet-stream',
2066
-      'class' =>  'application/octet-stream',
2067
-      'psd'   =>  'application/octet-stream',
2068
-      'so'    =>  'application/octet-stream',
2069
-      'sea'   =>  'application/octet-stream',
2070
-      'dll'   =>  'application/octet-stream',
2071
-      'oda'   =>  'application/oda',
2072
-      'pdf'   =>  'application/pdf',
2073
-      'ai'    =>  'application/postscript',
2074
-      'eps'   =>  'application/postscript',
2075
-      'ps'    =>  'application/postscript',
2076
-      'smi'   =>  'application/smil',
2077
-      'smil'  =>  'application/smil',
2078
-      'mif'   =>  'application/vnd.mif',
2079
-      'xls'   =>  'application/vnd.ms-excel',
2080
-      'ppt'   =>  'application/vnd.ms-powerpoint',
2081
-      'wbxml' =>  'application/vnd.wap.wbxml',
2082
-      'wmlc'  =>  'application/vnd.wap.wmlc',
2083
-      'dcr'   =>  'application/x-director',
2084
-      'dir'   =>  'application/x-director',
2085
-      'dxr'   =>  'application/x-director',
2086
-      'dvi'   =>  'application/x-dvi',
2087
-      'gtar'  =>  'application/x-gtar',
2088
-      'php'   =>  'application/x-httpd-php',
2089
-      'php4'  =>  'application/x-httpd-php',
2090
-      'php3'  =>  'application/x-httpd-php',
2091
-      'phtml' =>  'application/x-httpd-php',
2092
-      'phps'  =>  'application/x-httpd-php-source',
2093
-      'js'    =>  'application/x-javascript',
2094
-      'swf'   =>  'application/x-shockwave-flash',
2095
-      'sit'   =>  'application/x-stuffit',
2096
-      'tar'   =>  'application/x-tar',
2097
-      'tgz'   =>  'application/x-tar',
2098
-      'xhtml' =>  'application/xhtml+xml',
2099
-      'xht'   =>  'application/xhtml+xml',
2100
-      'zip'   =>  'application/zip',
2101
-      'mid'   =>  'audio/midi',
2102
-      'midi'  =>  'audio/midi',
2103
-      'mpga'  =>  'audio/mpeg',
2104
-      'mp2'   =>  'audio/mpeg',
2105
-      'mp3'   =>  'audio/mpeg',
2106
-      'aif'   =>  'audio/x-aiff',
2107
-      'aiff'  =>  'audio/x-aiff',
2108
-      'aifc'  =>  'audio/x-aiff',
2109
-      'ram'   =>  'audio/x-pn-realaudio',
2110
-      'rm'    =>  'audio/x-pn-realaudio',
2111
-      'rpm'   =>  'audio/x-pn-realaudio-plugin',
2112
-      'ra'    =>  'audio/x-realaudio',
2113
-      'rv'    =>  'video/vnd.rn-realvideo',
2114
-      'wav'   =>  'audio/x-wav',
2115
-      'bmp'   =>  'image/bmp',
2116
-      'gif'   =>  'image/gif',
2117
-      'jpeg'  =>  'image/jpeg',
2118
-      'jpg'   =>  'image/jpeg',
2119
-      'jpe'   =>  'image/jpeg',
2120
-      'png'   =>  'image/png',
2121
-      'tiff'  =>  'image/tiff',
2122
-      'tif'   =>  'image/tiff',
2123
-      'css'   =>  'text/css',
2124
-      'html'  =>  'text/html',
2125
-      'htm'   =>  'text/html',
2126
-      'shtml' =>  'text/html',
2127
-      'txt'   =>  'text/plain',
2128
-      'text'  =>  'text/plain',
2129
-      'log'   =>  'text/plain',
2130
-      'rtx'   =>  'text/richtext',
2131
-      'rtf'   =>  'text/rtf',
2132
-      'xml'   =>  'text/xml',
2133
-      'xsl'   =>  'text/xml',
2134
-      'mpeg'  =>  'video/mpeg',
2135
-      'mpg'   =>  'video/mpeg',
2136
-      'mpe'   =>  'video/mpeg',
2137
-      'qt'    =>  'video/quicktime',
2138
-      'mov'   =>  'video/quicktime',
2139
-      'avi'   =>  'video/x-msvideo',
2140
-      'movie' =>  'video/x-sgi-movie',
2141
-      'doc'   =>  'application/msword',
2142
-      'word'  =>  'application/msword',
2143
-      'xl'    =>  'application/excel',
2144
-      'eml'   =>  'message/rfc822'
2058
+        'hqx'   =>  'application/mac-binhex40',
2059
+        'cpt'   =>  'application/mac-compactpro',
2060
+        'doc'   =>  'application/msword',
2061
+        'bin'   =>  'application/macbinary',
2062
+        'dms'   =>  'application/octet-stream',
2063
+        'lha'   =>  'application/octet-stream',
2064
+        'lzh'   =>  'application/octet-stream',
2065
+        'exe'   =>  'application/octet-stream',
2066
+        'class' =>  'application/octet-stream',
2067
+        'psd'   =>  'application/octet-stream',
2068
+        'so'    =>  'application/octet-stream',
2069
+        'sea'   =>  'application/octet-stream',
2070
+        'dll'   =>  'application/octet-stream',
2071
+        'oda'   =>  'application/oda',
2072
+        'pdf'   =>  'application/pdf',
2073
+        'ai'    =>  'application/postscript',
2074
+        'eps'   =>  'application/postscript',
2075
+        'ps'    =>  'application/postscript',
2076
+        'smi'   =>  'application/smil',
2077
+        'smil'  =>  'application/smil',
2078
+        'mif'   =>  'application/vnd.mif',
2079
+        'xls'   =>  'application/vnd.ms-excel',
2080
+        'ppt'   =>  'application/vnd.ms-powerpoint',
2081
+        'wbxml' =>  'application/vnd.wap.wbxml',
2082
+        'wmlc'  =>  'application/vnd.wap.wmlc',
2083
+        'dcr'   =>  'application/x-director',
2084
+        'dir'   =>  'application/x-director',
2085
+        'dxr'   =>  'application/x-director',
2086
+        'dvi'   =>  'application/x-dvi',
2087
+        'gtar'  =>  'application/x-gtar',
2088
+        'php'   =>  'application/x-httpd-php',
2089
+        'php4'  =>  'application/x-httpd-php',
2090
+        'php3'  =>  'application/x-httpd-php',
2091
+        'phtml' =>  'application/x-httpd-php',
2092
+        'phps'  =>  'application/x-httpd-php-source',
2093
+        'js'    =>  'application/x-javascript',
2094
+        'swf'   =>  'application/x-shockwave-flash',
2095
+        'sit'   =>  'application/x-stuffit',
2096
+        'tar'   =>  'application/x-tar',
2097
+        'tgz'   =>  'application/x-tar',
2098
+        'xhtml' =>  'application/xhtml+xml',
2099
+        'xht'   =>  'application/xhtml+xml',
2100
+        'zip'   =>  'application/zip',
2101
+        'mid'   =>  'audio/midi',
2102
+        'midi'  =>  'audio/midi',
2103
+        'mpga'  =>  'audio/mpeg',
2104
+        'mp2'   =>  'audio/mpeg',
2105
+        'mp3'   =>  'audio/mpeg',
2106
+        'aif'   =>  'audio/x-aiff',
2107
+        'aiff'  =>  'audio/x-aiff',
2108
+        'aifc'  =>  'audio/x-aiff',
2109
+        'ram'   =>  'audio/x-pn-realaudio',
2110
+        'rm'    =>  'audio/x-pn-realaudio',
2111
+        'rpm'   =>  'audio/x-pn-realaudio-plugin',
2112
+        'ra'    =>  'audio/x-realaudio',
2113
+        'rv'    =>  'video/vnd.rn-realvideo',
2114
+        'wav'   =>  'audio/x-wav',
2115
+        'bmp'   =>  'image/bmp',
2116
+        'gif'   =>  'image/gif',
2117
+        'jpeg'  =>  'image/jpeg',
2118
+        'jpg'   =>  'image/jpeg',
2119
+        'jpe'   =>  'image/jpeg',
2120
+        'png'   =>  'image/png',
2121
+        'tiff'  =>  'image/tiff',
2122
+        'tif'   =>  'image/tiff',
2123
+        'css'   =>  'text/css',
2124
+        'html'  =>  'text/html',
2125
+        'htm'   =>  'text/html',
2126
+        'shtml' =>  'text/html',
2127
+        'txt'   =>  'text/plain',
2128
+        'text'  =>  'text/plain',
2129
+        'log'   =>  'text/plain',
2130
+        'rtx'   =>  'text/richtext',
2131
+        'rtf'   =>  'text/rtf',
2132
+        'xml'   =>  'text/xml',
2133
+        'xsl'   =>  'text/xml',
2134
+        'mpeg'  =>  'video/mpeg',
2135
+        'mpg'   =>  'video/mpeg',
2136
+        'mpe'   =>  'video/mpeg',
2137
+        'qt'    =>  'video/quicktime',
2138
+        'mov'   =>  'video/quicktime',
2139
+        'avi'   =>  'video/x-msvideo',
2140
+        'movie' =>  'video/x-sgi-movie',
2141
+        'doc'   =>  'application/msword',
2142
+        'word'  =>  'application/msword',
2143
+        'xl'    =>  'application/excel',
2144
+        'eml'   =>  'message/rfc822'
2145 2145
     );
2146 2146
     return (!isset($mimes[strtolower($ext)])) ? 'application/octet-stream' : $mimes[strtolower($ext)];
2147
-  }
2148
-
2149
-  /**
2150
-  * Set (or reset) Class Objects (variables)
2151
-  *
2152
-  * Usage Example:
2153
-  * $page->set('X-Priority', '3');
2154
-  *
2155
-  * @access public
2156
-  * @param string $name Parameter Name
2157
-  * @param mixed $value Parameter Value
2158
-  * NOTE: will not work with arrays, there are no arrays to set/reset
2159
-  * @todo Should this not be using __set() magic function?
2160
-  */
2161
-  public function set($name, $value = '') {
2147
+    }
2148
+
2149
+    /**
2150
+     * Set (or reset) Class Objects (variables)
2151
+     *
2152
+     * Usage Example:
2153
+     * $page->set('X-Priority', '3');
2154
+     *
2155
+     * @access public
2156
+     * @param string $name Parameter Name
2157
+     * @param mixed $value Parameter Value
2158
+     * NOTE: will not work with arrays, there are no arrays to set/reset
2159
+     * @todo Should this not be using __set() magic function?
2160
+     */
2161
+    public function set($name, $value = '') {
2162 2162
     try {
2163
-      if (isset($this->$name) ) {
2163
+        if (isset($this->$name) ) {
2164 2164
         $this->$name = $value;
2165
-      } else {
2165
+        } else {
2166 2166
         throw new phpmailerException($this->Lang('variable_set') . $name, self::STOP_CRITICAL);
2167
-      }
2167
+        }
2168 2168
     } catch (Exception $e) {
2169
-      $this->SetError($e->getMessage());
2170
-      if ($e->getCode() == self::STOP_CRITICAL) {
2169
+        $this->SetError($e->getMessage());
2170
+        if ($e->getCode() == self::STOP_CRITICAL) {
2171 2171
         return false;
2172
-      }
2172
+        }
2173 2173
     }
2174 2174
     return true;
2175
-  }
2176
-
2177
-  /**
2178
-   * Strips newlines to prevent header injection.
2179
-   * @access public
2180
-   * @param string $str String
2181
-   * @return string
2182
-   */
2183
-  public function SecureHeader($str) {
2175
+    }
2176
+
2177
+    /**
2178
+     * Strips newlines to prevent header injection.
2179
+     * @access public
2180
+     * @param string $str String
2181
+     * @return string
2182
+     */
2183
+    public function SecureHeader($str) {
2184 2184
     $str = str_replace("\r", '', $str);
2185 2185
     $str = str_replace("\n", '', $str);
2186 2186
     return trim($str);
2187
-  }
2188
-
2189
-  /**
2190
-   * Set the private key file and password to sign the message.
2191
-   *
2192
-   * @access public
2193
-   * @param string $key_filename Parameter File Name
2194
-   * @param string $key_pass Password for private key
2195
-   */
2196
-  public function Sign($cert_filename, $key_filename, $key_pass) {
2187
+    }
2188
+
2189
+    /**
2190
+     * Set the private key file and password to sign the message.
2191
+     *
2192
+     * @access public
2193
+     * @param string $key_filename Parameter File Name
2194
+     * @param string $key_pass Password for private key
2195
+     */
2196
+    public function Sign($cert_filename, $key_filename, $key_pass) {
2197 2197
     $this->sign_cert_file = $cert_filename;
2198 2198
     $this->sign_key_file = $key_filename;
2199 2199
     $this->sign_key_pass = $key_pass;
2200
-  }
2201
-
2202
-  /**
2203
-   * Set the private key file and password to sign the message.
2204
-   *
2205
-   * @access public
2206
-   * @param string $key_filename Parameter File Name
2207
-   * @param string $key_pass Password for private key
2208
-   */
2209
-  public function DKIM_QP($txt) {
2200
+    }
2201
+
2202
+    /**
2203
+     * Set the private key file and password to sign the message.
2204
+     *
2205
+     * @access public
2206
+     * @param string $key_filename Parameter File Name
2207
+     * @param string $key_pass Password for private key
2208
+     */
2209
+    public function DKIM_QP($txt) {
2210 2210
     $tmp="";
2211 2211
     $line="";
2212 2212
     for ($i=0;$i<strlen($txt);$i++) {
2213
-      $ord=ord($txt[$i]);
2214
-      if ( ((0x21 <= $ord) && ($ord <= 0x3A)) || $ord == 0x3C || ((0x3E <= $ord) && ($ord <= 0x7E)) ) {
2213
+        $ord=ord($txt[$i]);
2214
+        if ( ((0x21 <= $ord) && ($ord <= 0x3A)) || $ord == 0x3C || ((0x3E <= $ord) && ($ord <= 0x7E)) ) {
2215 2215
         $line.=$txt[$i];
2216
-      } else {
2216
+        } else {
2217 2217
         $line.="=".sprintf("%02X",$ord);
2218
-      }
2218
+        }
2219 2219
     }
2220 2220
     return $line;
2221
-  }
2222
-
2223
-  /**
2224
-   * Generate DKIM signature
2225
-   *
2226
-   * @access public
2227
-   * @param string $s Header
2228
-   */
2229
-  public function DKIM_Sign($s) {
2221
+    }
2222
+
2223
+    /**
2224
+     * Generate DKIM signature
2225
+     *
2226
+     * @access public
2227
+     * @param string $s Header
2228
+     */
2229
+    public function DKIM_Sign($s) {
2230 2230
     $privKeyStr = file_get_contents($this->DKIM_private);
2231 2231
     if ($this->DKIM_passphrase!='') {
2232
-      $privKey = openssl_pkey_get_private($privKeyStr,$this->DKIM_passphrase);
2232
+        $privKey = openssl_pkey_get_private($privKeyStr,$this->DKIM_passphrase);
2233 2233
     } else {
2234
-      $privKey = $privKeyStr;
2234
+        $privKey = $privKeyStr;
2235 2235
     }
2236 2236
     if (openssl_sign($s, $signature, $privKey)) {
2237
-      return base64_encode($signature);
2237
+        return base64_encode($signature);
2238
+    }
2238 2239
     }
2239
-  }
2240 2240
 
2241
-  /**
2242
-   * Generate DKIM Canonicalization Header
2243
-   *
2244
-   * @access public
2245
-   * @param string $s Header
2246
-   */
2247
-  public function DKIM_HeaderC($s) {
2241
+    /**
2242
+     * Generate DKIM Canonicalization Header
2243
+     *
2244
+     * @access public
2245
+     * @param string $s Header
2246
+     */
2247
+    public function DKIM_HeaderC($s) {
2248 2248
     $s=preg_replace("/\r\n\s+/"," ",$s);
2249 2249
     $lines=explode("\r\n",$s);
2250 2250
     foreach ($lines as $key=>$line) {
2251
-      list($heading,$value)=explode(":",$line,2);
2252
-      $heading=strtolower($heading);
2253
-      $value=preg_replace("/\s+/"," ",$value) ; // Compress useless spaces
2254
-      $lines[$key]=$heading.":".trim($value) ; // Don't forget to remove WSP around the value
2251
+        list($heading,$value)=explode(":",$line,2);
2252
+        $heading=strtolower($heading);
2253
+        $value=preg_replace("/\s+/"," ",$value) ; // Compress useless spaces
2254
+        $lines[$key]=$heading.":".trim($value) ; // Don't forget to remove WSP around the value
2255 2255
     }
2256 2256
     $s=implode("\r\n",$lines);
2257 2257
     return $s;
2258
-  }
2259
-
2260
-  /**
2261
-   * Generate DKIM Canonicalization Body
2262
-   *
2263
-   * @access public
2264
-   * @param string $body Message Body
2265
-   */
2266
-  public function DKIM_BodyC($body) {
2258
+    }
2259
+
2260
+    /**
2261
+     * Generate DKIM Canonicalization Body
2262
+     *
2263
+     * @access public
2264
+     * @param string $body Message Body
2265
+     */
2266
+    public function DKIM_BodyC($body) {
2267 2267
     if ($body == '') return "\r\n";
2268 2268
     // stabilize line endings
2269 2269
     $body=str_replace("\r\n","\n",$body);
2270 2270
     $body=str_replace("\n","\r\n",$body);
2271 2271
     // END stabilize line endings
2272 2272
     while (substr($body,strlen($body)-4,4) == "\r\n\r\n") {
2273
-      $body=substr($body,0,strlen($body)-2);
2273
+        $body=substr($body,0,strlen($body)-2);
2274 2274
     }
2275 2275
     return $body;
2276
-  }
2277
-
2278
-  /**
2279
-   * Create the DKIM header, body, as new header
2280
-   *
2281
-   * @access public
2282
-   * @param string $headers_line Header lines
2283
-   * @param string $subject Subject
2284
-   * @param string $body Body
2285
-   */
2286
-  public function DKIM_Add($headers_line,$subject,$body) {
2276
+    }
2277
+
2278
+    /**
2279
+     * Create the DKIM header, body, as new header
2280
+     *
2281
+     * @access public
2282
+     * @param string $headers_line Header lines
2283
+     * @param string $subject Subject
2284
+     * @param string $body Body
2285
+     */
2286
+    public function DKIM_Add($headers_line,$subject,$body) {
2287 2287
     $DKIMsignatureType    = 'rsa-sha1'; // Signature & hash algorithms
2288 2288
     $DKIMcanonicalization = 'relaxed/simple'; // Canonicalization of header/body
2289 2289
     $DKIMquery            = 'dns/txt'; // Query method
@@ -2291,11 +2291,11 @@  discard block
 block discarded – undo
2291 2291
     $subject_header       = "Subject: $subject";
2292 2292
     $headers              = explode("\r\n",$headers_line);
2293 2293
     foreach($headers as $header) {
2294
-      if (strpos($header,'From:') === 0) {
2294
+        if (strpos($header,'From:') === 0) {
2295 2295
         $from_header=$header;
2296
-      } elseif (strpos($header,'To:') === 0) {
2296
+        } elseif (strpos($header,'To:') === 0) {
2297 2297
         $to_header=$header;
2298
-      }
2298
+        }
2299 2299
     }
2300 2300
     $from     = str_replace('|','=7C',$this->DKIM_QP($from_header));
2301 2301
     $to       = str_replace('|','=7C',$this->DKIM_QP($to_header));
@@ -2316,20 +2316,20 @@  discard block
 block discarded – undo
2316 2316
     $toSign   = $this->DKIM_HeaderC($from_header . "\r\n" . $to_header . "\r\n" . $subject_header . "\r\n" . $dkimhdrs);
2317 2317
     $signed   = $this->DKIM_Sign($toSign);
2318 2318
     return "X-PHPMAILER-DKIM: phpmailer.worxware.com\r\n".$dkimhdrs.$signed."\r\n";
2319
-  }
2319
+    }
2320 2320
 
2321
-  protected function doCallback($isSent,$to,$cc,$bcc,$subject,$body) {
2321
+    protected function doCallback($isSent,$to,$cc,$bcc,$subject,$body) {
2322 2322
     if (!empty($this->action_function) && function_exists($this->action_function)) {
2323
-      $params = array($isSent,$to,$cc,$bcc,$subject,$body);
2324
-      call_user_func_array($this->action_function,$params);
2323
+        $params = array($isSent,$to,$cc,$bcc,$subject,$body);
2324
+        call_user_func_array($this->action_function,$params);
2325
+    }
2325 2326
     }
2326
-  }
2327 2327
 }
2328 2328
 
2329 2329
 class phpmailerException extends Exception {
2330
-  public function errorMessage() {
2330
+    public function errorMessage() {
2331 2331
     $errorMsg = '<strong>' . $this->getMessage() . "</strong><br />\n";
2332 2332
     return $errorMsg;
2333
-  }
2333
+    }
2334 2334
 }
2335 2335
 ?>
Please login to merge, or discard this patch.
Spacing   +235 added lines, -236 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
  * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
39 39
  */
40 40
 
41
-if (version_compare(PHP_VERSION, '5.0.0', '<') ) exit("Sorry, this version of PHPMailer will only run on PHP version 5 or greater!\n");
41
+if (version_compare(PHP_VERSION, '5.0.0', '<')) exit("Sorry, this version of PHPMailer will only run on PHP version 5 or greater!\n");
42 42
 
43 43
 class PHPMailer {
44 44
 
@@ -50,64 +50,64 @@  discard block
 block discarded – undo
50 50
    * Email priority (1 = High, 3 = Normal, 5 = low).
51 51
    * @var int
52 52
    */
53
-  public $Priority          = 3;
53
+  public $Priority = 3;
54 54
 
55 55
   /**
56 56
    * Sets the CharSet of the message.
57 57
    * @var string
58 58
    */
59
-  public $CharSet           = 'iso-8859-1';
59
+  public $CharSet = 'iso-8859-1';
60 60
 
61 61
   /**
62 62
    * Sets the Content-type of the message.
63 63
    * @var string
64 64
    */
65
-  public $ContentType       = 'text/plain';
65
+  public $ContentType = 'text/plain';
66 66
 
67 67
   /**
68 68
    * Sets the Encoding of the message. Options for this are
69 69
    *  "8bit", "7bit", "binary", "base64", and "quoted-printable".
70 70
    * @var string
71 71
    */
72
-  public $Encoding          = '8bit';
72
+  public $Encoding = '8bit';
73 73
 
74 74
   /**
75 75
    * Holds the most recent mailer error message.
76 76
    * @var string
77 77
    */
78
-  public $ErrorInfo         = '';
78
+  public $ErrorInfo = '';
79 79
 
80 80
   /**
81 81
    * Sets the From email address for the message.
82 82
    * @var string
83 83
    */
84
-  public $From              = 'root@localhost';
84
+  public $From = 'root@localhost';
85 85
 
86 86
   /**
87 87
    * Sets the From name of the message.
88 88
    * @var string
89 89
    */
90
-  public $FromName          = 'Root User';
90
+  public $FromName = 'Root User';
91 91
 
92 92
   /**
93 93
    * Sets the Sender email (Return-Path) of the message.  If not empty,
94 94
    * will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode.
95 95
    * @var string
96 96
    */
97
-  public $Sender            = '';
97
+  public $Sender = '';
98 98
 
99 99
   /**
100 100
    * Sets the Subject of the message.
101 101
    * @var string
102 102
    */
103
-  public $Subject           = '';
103
+  public $Subject = '';
104 104
 
105 105
   /**
106 106
    * Sets the Body of the message.  This can be either an HTML or text body.
107 107
    * If HTML then run IsHTML(true).
108 108
    * @var string
109 109
    */
110
-  public $Body              = '';
110
+  public $Body = '';
111 111
 
112 112
   /**
113 113
    * Sets the text-only body of the message.  This automatically sets the
@@ -116,39 +116,39 @@  discard block
 block discarded – undo
116 116
    * that can read HTML will view the normal Body.
117 117
    * @var string
118 118
    */
119
-  public $AltBody           = '';
119
+  public $AltBody = '';
120 120
 
121 121
   /**
122 122
    * Sets word wrapping on the body of the message to a given number of
123 123
    * characters.
124 124
    * @var int
125 125
    */
126
-  public $WordWrap          = 0;
126
+  public $WordWrap = 0;
127 127
 
128 128
   /**
129 129
    * Method to send mail: ("mail", "sendmail", or "smtp").
130 130
    * @var string
131 131
    */
132
-  public $Mailer            = 'mail';
132
+  public $Mailer = 'mail';
133 133
 
134 134
   /**
135 135
    * Sets the path of the sendmail program.
136 136
    * @var string
137 137
    */
138
-  public $Sendmail          = '/usr/sbin/sendmail';
138
+  public $Sendmail = '/usr/sbin/sendmail';
139 139
 
140 140
   /**
141 141
    * Path to PHPMailer plugins.  Useful if the SMTP class
142 142
    * is in a different directory than the PHP include path.
143 143
    * @var string
144 144
    */
145
-  public $PluginDir         = '';
145
+  public $PluginDir = '';
146 146
 
147 147
   /**
148 148
    * Sets the email address that a reading confirmation will be sent.
149 149
    * @var string
150 150
    */
151
-  public $ConfirmReadingTo  = '';
151
+  public $ConfirmReadingTo = '';
152 152
 
153 153
   /**
154 154
    * Sets the hostname to use in Message-Id and Received headers
@@ -156,14 +156,14 @@  discard block
 block discarded – undo
156 156
    * by SERVER_NAME is used or 'localhost.localdomain'.
157 157
    * @var string
158 158
    */
159
-  public $Hostname          = '';
159
+  public $Hostname = '';
160 160
 
161 161
   /**
162 162
    * Sets the message ID to be used in the Message-Id header.
163 163
    * If empty, a unique id will be generated.
164 164
    * @var string
165 165
    */
166
-  public $MessageID         = '';
166
+  public $MessageID = '';
167 167
 
168 168
   /////////////////////////////////////////////////
169 169
   // PROPERTIES FOR SMTP
@@ -177,57 +177,57 @@  discard block
 block discarded – undo
177 177
    * Hosts will be tried in order.
178 178
    * @var string
179 179
    */
180
-  public $Host          = 'localhost';
180
+  public $Host = 'localhost';
181 181
 
182 182
   /**
183 183
    * Sets the default SMTP server port.
184 184
    * @var int
185 185
    */
186
-  public $Port          = 25;
186
+  public $Port = 25;
187 187
 
188 188
   /**
189 189
    * Sets the SMTP HELO of the message (Default is $Hostname).
190 190
    * @var string
191 191
    */
192
-  public $Helo          = '';
192
+  public $Helo = '';
193 193
 
194 194
   /**
195 195
    * Sets connection prefix.
196 196
    * Options are "", "ssl" or "tls"
197 197
    * @var string
198 198
    */
199
-  public $SMTPSecure    = '';
199
+  public $SMTPSecure = '';
200 200
 
201 201
   /**
202 202
    * Sets SMTP authentication. Utilizes the Username and Password variables.
203 203
    * @var bool
204 204
    */
205
-  public $SMTPAuth      = false;
205
+  public $SMTPAuth = false;
206 206
 
207 207
   /**
208 208
    * Sets SMTP username.
209 209
    * @var string
210 210
    */
211
-  public $Username      = '';
211
+  public $Username = '';
212 212
 
213 213
   /**
214 214
    * Sets SMTP password.
215 215
    * @var string
216 216
    */
217
-  public $Password      = '';
217
+  public $Password = '';
218 218
 
219 219
   /**
220 220
    * Sets the SMTP server timeout in seconds.
221 221
    * This function will not work with the win32 version.
222 222
    * @var int
223 223
    */
224
-  public $Timeout       = 10;
224
+  public $Timeout = 10;
225 225
 
226 226
   /**
227 227
    * Sets SMTP class debugging on or off.
228 228
    * @var bool
229 229
    */
230
-  public $SMTPDebug     = false;
230
+  public $SMTPDebug = false;
231 231
 
232 232
   /**
233 233
    * Prevents the SMTP connection from being closed after each mail
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
    * emails, instead of sending to entire TO addresses
243 243
    * @var bool
244 244
    */
245
-  public $SingleTo      = false;
245
+  public $SingleTo = false;
246 246
 
247 247
    /**
248 248
    * If SingleTo is true, this provides the array to hold the email addresses
@@ -254,34 +254,34 @@  discard block
 block discarded – undo
254 254
    * Provides the ability to change the line ending
255 255
    * @var string
256 256
    */
257
-  public $LE              = "\n";
257
+  public $LE = "\n";
258 258
 
259 259
   /**
260 260
    * Used with DKIM DNS Resource Record
261 261
    * @var string
262 262
    */
263
-  public $DKIM_selector   = 'phpmailer';
263
+  public $DKIM_selector = 'phpmailer';
264 264
 
265 265
   /**
266 266
    * Used with DKIM DNS Resource Record
267 267
    * optional, in format of email address '[email protected]'
268 268
    * @var string
269 269
    */
270
-  public $DKIM_identity   = '';
270
+  public $DKIM_identity = '';
271 271
 
272 272
   /**
273 273
    * Used with DKIM DNS Resource Record
274 274
    * optional, in format of email address '[email protected]'
275 275
    * @var string
276 276
    */
277
-  public $DKIM_domain     = '';
277
+  public $DKIM_domain = '';
278 278
 
279 279
   /**
280 280
    * Used with DKIM DNS Resource Record
281 281
    * optional, in format of email address '[email protected]'
282 282
    * @var string
283 283
    */
284
-  public $DKIM_private    = '';
284
+  public $DKIM_private = '';
285 285
 
286 286
   /**
287 287
    * Callback Action function name
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
    * Sets the PHPMailer Version number
301 301
    * @var string
302 302
    */
303
-  public $Version         = '5.1';
303
+  public $Version = '5.1';
304 304
 
305 305
   /////////////////////////////////////////////////
306 306
   // PROPERTIES, PRIVATE AND PROTECTED
@@ -451,13 +451,13 @@  discard block
 block discarded – undo
451 451
    */
452 452
   private function AddAnAddress($kind, $address, $name = '') {
453 453
     if (!preg_match('/^(to|cc|bcc|ReplyTo)$/', $kind)) {
454
-      error_log('Invalid recipient array: ' . $kind);
454
+      error_log('Invalid recipient array: '.$kind);
455 455
       return false;
456 456
     }
457 457
     $address = trim($address);
458 458
     $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim
459 459
     if (!self::ValidateAddress($address)) {
460
-      $this->SetError($this->Lang('invalid_address').': '. $address);
460
+      $this->SetError($this->Lang('invalid_address').': '.$address);
461 461
       if ($this->exceptions) {
462 462
         throw new phpmailerException($this->Lang('invalid_address').': '.$address);
463 463
       }
@@ -485,11 +485,11 @@  discard block
 block discarded – undo
485 485
  * @param string $name
486 486
  * @return boolean
487 487
  */
488
-  public function SetFrom($address, $name = '',$auto=1) {
488
+  public function SetFrom($address, $name = '', $auto = 1) {
489 489
     $address = trim($address);
490 490
     $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim
491 491
     if (!self::ValidateAddress($address)) {
492
-      $this->SetError($this->Lang('invalid_address').': '. $address);
492
+      $this->SetError($this->Lang('invalid_address').': '.$address);
493 493
       if ($this->exceptions) {
494 494
         throw new phpmailerException($this->Lang('invalid_address').': '.$address);
495 495
       }
@@ -522,7 +522,7 @@  discard block
 block discarded – undo
522 522
    */
523 523
   public static function ValidateAddress($address) {
524 524
     if (function_exists('filter_var')) { //Introduced in PHP 5.2
525
-      if(filter_var($address, FILTER_VALIDATE_EMAIL) === FALSE) {
525
+      if (filter_var($address, FILTER_VALIDATE_EMAIL) === FALSE) {
526 526
         return false;
527 527
       } else {
528 528
         return true;
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
       }
550 550
 
551 551
       // Set whether the message is multipart/alternative
552
-      if(!empty($this->AltBody)) {
552
+      if (!empty($this->AltBody)) {
553 553
         $this->ContentType = 'multipart/alternative';
554 554
       }
555 555
 
@@ -564,12 +564,12 @@  discard block
 block discarded – undo
564 564
 
565 565
       // digitally sign with DKIM if enabled
566 566
       if ($this->DKIM_domain && $this->DKIM_private) {
567
-        $header_dkim = $this->DKIM_Add($header,$this->Subject,$body);
568
-        $header = str_replace("\r\n","\n",$header_dkim) . $header;
567
+        $header_dkim = $this->DKIM_Add($header, $this->Subject, $body);
568
+        $header = str_replace("\r\n", "\n", $header_dkim).$header;
569 569
       }
570 570
 
571 571
       // Choose the mailer and send through it
572
-      switch($this->Mailer) {
572
+      switch ($this->Mailer) {
573 573
         case 'sendmail':
574 574
           return $this->SendmailSend($header, $body);
575 575
         case 'smtp':
@@ -602,32 +602,32 @@  discard block
 block discarded – undo
602 602
     }
603 603
     if ($this->SingleTo === true) {
604 604
       foreach ($this->SingleToArray as $key => $val) {
605
-        if(!@$mail = popen($sendmail, 'w')) {
606
-          throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
605
+        if (!@$mail = popen($sendmail, 'w')) {
606
+          throw new phpmailerException($this->Lang('execute').$this->Sendmail, self::STOP_CRITICAL);
607 607
         }
608
-        fputs($mail, "To: " . $val . "\n");
608
+        fputs($mail, "To: ".$val."\n");
609 609
         fputs($mail, $header);
610 610
         fputs($mail, $body);
611 611
         $result = pclose($mail);
612 612
         // implement call back function if it exists
613 613
         $isSent = ($result == 0) ? 1 : 0;
614
-        $this->doCallback($isSent,$val,$this->cc,$this->bcc,$this->Subject,$body);
615
-        if($result != 0) {
616
-          throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
614
+        $this->doCallback($isSent, $val, $this->cc, $this->bcc, $this->Subject, $body);
615
+        if ($result != 0) {
616
+          throw new phpmailerException($this->Lang('execute').$this->Sendmail, self::STOP_CRITICAL);
617 617
         }
618 618
       }
619 619
     } else {
620
-      if(!@$mail = popen($sendmail, 'w')) {
621
-        throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
620
+      if (!@$mail = popen($sendmail, 'w')) {
621
+        throw new phpmailerException($this->Lang('execute').$this->Sendmail, self::STOP_CRITICAL);
622 622
       }
623 623
       fputs($mail, $header);
624 624
       fputs($mail, $body);
625 625
       $result = pclose($mail);
626 626
       // implement call back function if it exists
627 627
       $isSent = ($result == 0) ? 1 : 0;
628
-      $this->doCallback($isSent,$this->to,$this->cc,$this->bcc,$this->Subject,$body);
629
-      if($result != 0) {
630
-        throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
628
+      $this->doCallback($isSent, $this->to, $this->cc, $this->bcc, $this->Subject, $body);
629
+      if ($result != 0) {
630
+        throw new phpmailerException($this->Lang('execute').$this->Sendmail, self::STOP_CRITICAL);
631 631
       }
632 632
     }
633 633
     return true;
@@ -642,13 +642,13 @@  discard block
 block discarded – undo
642 642
    */
643 643
   protected function MailSend($header, $body) {
644 644
     $toArr = array();
645
-    foreach($this->to as $t) {
645
+    foreach ($this->to as $t) {
646 646
       $toArr[] = $this->AddrFormat($t);
647 647
     }
648 648
     $to = implode(', ', $toArr);
649 649
 
650 650
     $params = sprintf("-oi -f %s", $this->Sender);
651
-    if ($this->Sender != '' && strlen(ini_get('safe_mode'))< 1) {
651
+    if ($this->Sender != '' && strlen(ini_get('safe_mode')) < 1) {
652 652
       $old_from = ini_get('sendmail_from');
653 653
       ini_set('sendmail_from', $this->Sender);
654 654
       if ($this->SingleTo === true && count($toArr) > 1) {
@@ -656,13 +656,13 @@  discard block
 block discarded – undo
656 656
           $rt = @mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
657 657
           // implement call back function if it exists
658 658
           $isSent = ($rt == 1) ? 1 : 0;
659
-          $this->doCallback($isSent,$val,$this->cc,$this->bcc,$this->Subject,$body);
659
+          $this->doCallback($isSent, $val, $this->cc, $this->bcc, $this->Subject, $body);
660 660
         }
661 661
       } else {
662 662
         $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
663 663
         // implement call back function if it exists
664 664
         $isSent = ($rt == 1) ? 1 : 0;
665
-        $this->doCallback($isSent,$to,$this->cc,$this->bcc,$this->Subject,$body);
665
+        $this->doCallback($isSent, $to, $this->cc, $this->bcc, $this->Subject, $body);
666 666
       }
667 667
     } else {
668 668
       if ($this->SingleTo === true && count($toArr) > 1) {
@@ -670,19 +670,19 @@  discard block
 block discarded – undo
670 670
           $rt = @mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
671 671
           // implement call back function if it exists
672 672
           $isSent = ($rt == 1) ? 1 : 0;
673
-          $this->doCallback($isSent,$val,$this->cc,$this->bcc,$this->Subject,$body);
673
+          $this->doCallback($isSent, $val, $this->cc, $this->bcc, $this->Subject, $body);
674 674
         }
675 675
       } else {
676 676
         $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header);
677 677
         // implement call back function if it exists
678 678
         $isSent = ($rt == 1) ? 1 : 0;
679
-        $this->doCallback($isSent,$to,$this->cc,$this->bcc,$this->Subject,$body);
679
+        $this->doCallback($isSent, $to, $this->cc, $this->bcc, $this->Subject, $body);
680 680
       }
681 681
     }
682 682
     if (isset($old_from)) {
683 683
       ini_set('sendmail_from', $old_from);
684 684
     }
685
-    if(!$rt) {
685
+    if (!$rt) {
686 686
       throw new phpmailerException($this->Lang('instantiate'), self::STOP_CRITICAL);
687 687
     }
688 688
     return true;
@@ -698,64 +698,64 @@  discard block
 block discarded – undo
698 698
    * @return bool
699 699
    */
700 700
   protected function SmtpSend($header, $body) {
701
-    require_once $this->PluginDir . 'class.smtp.php';
701
+    require_once $this->PluginDir.'class.smtp.php';
702 702
     $bad_rcpt = array();
703 703
 
704
-    if(!$this->SmtpConnect()) {
704
+    if (!$this->SmtpConnect()) {
705 705
       throw new phpmailerException($this->Lang('smtp_connect_failed'), self::STOP_CRITICAL);
706 706
     }
707 707
     $smtp_from = ($this->Sender == '') ? $this->From : $this->Sender;
708
-    if(!$this->smtp->Mail($smtp_from)) {
709
-      throw new phpmailerException($this->Lang('from_failed') . $smtp_from, self::STOP_CRITICAL);
708
+    if (!$this->smtp->Mail($smtp_from)) {
709
+      throw new phpmailerException($this->Lang('from_failed').$smtp_from, self::STOP_CRITICAL);
710 710
     }
711 711
 
712 712
     // Attempt to send attach all recipients
713
-    foreach($this->to as $to) {
713
+    foreach ($this->to as $to) {
714 714
       if (!$this->smtp->Recipient($to[0])) {
715 715
         $bad_rcpt[] = $to[0];
716 716
         // implement call back function if it exists
717 717
         $isSent = 0;
718
-        $this->doCallback($isSent,$to[0],'','',$this->Subject,$body);
718
+        $this->doCallback($isSent, $to[0], '', '', $this->Subject, $body);
719 719
       } else {
720 720
         // implement call back function if it exists
721 721
         $isSent = 1;
722
-        $this->doCallback($isSent,$to[0],'','',$this->Subject,$body);
722
+        $this->doCallback($isSent, $to[0], '', '', $this->Subject, $body);
723 723
       }
724 724
     }
725
-    foreach($this->cc as $cc) {
725
+    foreach ($this->cc as $cc) {
726 726
       if (!$this->smtp->Recipient($cc[0])) {
727 727
         $bad_rcpt[] = $cc[0];
728 728
         // implement call back function if it exists
729 729
         $isSent = 0;
730
-        $this->doCallback($isSent,'',$cc[0],'',$this->Subject,$body);
730
+        $this->doCallback($isSent, '', $cc[0], '', $this->Subject, $body);
731 731
       } else {
732 732
         // implement call back function if it exists
733 733
         $isSent = 1;
734
-        $this->doCallback($isSent,'',$cc[0],'',$this->Subject,$body);
734
+        $this->doCallback($isSent, '', $cc[0], '', $this->Subject, $body);
735 735
       }
736 736
     }
737
-    foreach($this->bcc as $bcc) {
737
+    foreach ($this->bcc as $bcc) {
738 738
       if (!$this->smtp->Recipient($bcc[0])) {
739 739
         $bad_rcpt[] = $bcc[0];
740 740
         // implement call back function if it exists
741 741
         $isSent = 0;
742
-        $this->doCallback($isSent,'','',$bcc[0],$this->Subject,$body);
742
+        $this->doCallback($isSent, '', '', $bcc[0], $this->Subject, $body);
743 743
       } else {
744 744
         // implement call back function if it exists
745 745
         $isSent = 1;
746
-        $this->doCallback($isSent,'','',$bcc[0],$this->Subject,$body);
746
+        $this->doCallback($isSent, '', '', $bcc[0], $this->Subject, $body);
747 747
       }
748 748
     }
749 749
 
750 750
 
751
-    if (count($bad_rcpt) > 0 ) { //Create error message for any bad addresses
751
+    if (count($bad_rcpt) > 0) { //Create error message for any bad addresses
752 752
       $badaddresses = implode(', ', $bad_rcpt);
753
-      throw new phpmailerException($this->Lang('recipients_failed') . $badaddresses);
753
+      throw new phpmailerException($this->Lang('recipients_failed').$badaddresses);
754 754
     }
755
-    if(!$this->smtp->Data($header . $body)) {
755
+    if (!$this->smtp->Data($header.$body)) {
756 756
       throw new phpmailerException($this->Lang('data_not_accepted'), self::STOP_CRITICAL);
757 757
     }
758
-    if($this->SMTPKeepAlive == true) {
758
+    if ($this->SMTPKeepAlive == true) {
759 759
       $this->smtp->Reset();
760 760
     }
761 761
     return true;
@@ -769,7 +769,7 @@  discard block
 block discarded – undo
769 769
    * @return bool
770 770
    */
771 771
   public function SmtpConnect() {
772
-    if(is_null($this->smtp)) {
772
+    if (is_null($this->smtp)) {
773 773
       $this->smtp = new SMTP();
774 774
     }
775 775
 
@@ -780,7 +780,7 @@  discard block
 block discarded – undo
780 780
 
781 781
     // Retry while there is no connection
782 782
     try {
783
-      while($index < count($hosts) && !$connection) {
783
+      while ($index < count($hosts) && !$connection) {
784 784
         $hostinfo = array();
785 785
         if (preg_match('/^(.+):([0-9]+)$/', $hosts[$index], $hostinfo)) {
786 786
           $host = $hostinfo[1];
@@ -793,7 +793,7 @@  discard block
 block discarded – undo
793 793
         $tls = ($this->SMTPSecure == 'tls');
794 794
         $ssl = ($this->SMTPSecure == 'ssl');
795 795
 
796
-        if ($this->smtp->Connect(($ssl ? 'ssl://':'').$host, $port, $this->Timeout)) {
796
+        if ($this->smtp->Connect(($ssl ? 'ssl://' : '').$host, $port, $this->Timeout)) {
797 797
 
798 798
           $hello = ($this->Helo != '' ? $this->Helo : $this->ServerHostname());
799 799
           $this->smtp->Hello($hello);
@@ -831,8 +831,8 @@  discard block
 block discarded – undo
831 831
    * @return void
832 832
    */
833 833
   public function SmtpClose() {
834
-    if(!is_null($this->smtp)) {
835
-      if($this->smtp->Connected()) {
834
+    if (!is_null($this->smtp)) {
835
+      if ($this->smtp->Connected()) {
836 836
         $this->smtp->Quit();
837 837
         $this->smtp->Close();
838 838
       }
@@ -894,7 +894,7 @@  discard block
 block discarded – undo
894 894
    * @return string
895 895
    */
896 896
   public function AddrAppend($type, $addr) {
897
-    $addr_str = $type . ': ';
897
+    $addr_str = $type.': ';
898 898
     $addresses = array();
899 899
     foreach ($addr as $a) {
900 900
       $addresses[] = $this->AddrFormat($a);
@@ -914,7 +914,7 @@  discard block
 block discarded – undo
914 914
     if (empty($addr[1])) {
915 915
       return $this->SecureHeader($addr[0]);
916 916
     } else {
917
-      return $this->EncodeHeader($this->SecureHeader($addr[1]), 'phrase') . " <" . $this->SecureHeader($addr[0]) . ">";
917
+      return $this->EncodeHeader($this->SecureHeader($addr[1]), 'phrase')." <".$this->SecureHeader($addr[0]).">";
918 918
     }
919 919
   }
920 920
 
@@ -941,10 +941,10 @@  discard block
 block discarded – undo
941 941
 
942 942
     $line = explode($this->LE, $message);
943 943
     $message = '';
944
-    for ($i=0 ;$i < count($line); $i++) {
944
+    for ($i = 0; $i < count($line); $i++) {
945 945
       $line_part = explode(' ', $line[$i]);
946 946
       $buf = '';
947
-      for ($e = 0; $e<count($line_part); $e++) {
947
+      for ($e = 0; $e < count($line_part); $e++) {
948 948
         $word = $line_part[$e];
949 949
         if ($qp_mode and (strlen($word) > $length)) {
950 950
           $space_left = $length - strlen($buf) - 1;
@@ -960,10 +960,10 @@  discard block
 block discarded – undo
960 960
               }
961 961
               $part = substr($word, 0, $len);
962 962
               $word = substr($word, $len);
963
-              $buf .= ' ' . $part;
964
-              $message .= $buf . sprintf("=%s", $this->LE);
963
+              $buf .= ' '.$part;
964
+              $message .= $buf.sprintf("=%s", $this->LE);
965 965
             } else {
966
-              $message .= $buf . $soft_break;
966
+              $message .= $buf.$soft_break;
967 967
             }
968 968
             $buf = '';
969 969
           }
@@ -980,22 +980,22 @@  discard block
 block discarded – undo
980 980
             $word = substr($word, $len);
981 981
 
982 982
             if (strlen($word) > 0) {
983
-              $message .= $part . sprintf("=%s", $this->LE);
983
+              $message .= $part.sprintf("=%s", $this->LE);
984 984
             } else {
985 985
               $buf = $part;
986 986
             }
987 987
           }
988 988
         } else {
989 989
           $buf_o = $buf;
990
-          $buf .= ($e == 0) ? $word : (' ' . $word);
990
+          $buf .= ($e == 0) ? $word : (' '.$word);
991 991
 
992 992
           if (strlen($buf) > $length and $buf_o != '') {
993
-            $message .= $buf_o . $soft_break;
993
+            $message .= $buf_o.$soft_break;
994 994
             $buf = $word;
995 995
           }
996 996
         }
997 997
       }
998
-      $message .= $buf . $this->LE;
998
+      $message .= $buf.$this->LE;
999 999
     }
1000 1000
 
1001 1001
     return $message;
@@ -1024,8 +1024,7 @@  discard block
 block discarded – undo
1024 1024
         if ($dec < 128) { // Single byte character.
1025 1025
           // If the encoded char was found at pos 0, it will fit
1026 1026
           // otherwise reduce maxLength to start of the encoded char
1027
-          $maxLength = ($encodedCharPos == 0) ? $maxLength :
1028
-          $maxLength - ($lookBack - $encodedCharPos);
1027
+          $maxLength = ($encodedCharPos == 0) ? $maxLength : $maxLength - ($lookBack - $encodedCharPos);
1029 1028
           $foundSplitPos = true;
1030 1029
         } elseif ($dec >= 192) { // First byte of a multi byte character
1031 1030
           // Reduce maxLength to split at start of character
@@ -1049,11 +1048,11 @@  discard block
 block discarded – undo
1049 1048
    * @return void
1050 1049
    */
1051 1050
   public function SetWordWrap() {
1052
-    if($this->WordWrap < 1) {
1051
+    if ($this->WordWrap < 1) {
1053 1052
       return;
1054 1053
     }
1055 1054
 
1056
-    switch($this->message_type) {
1055
+    switch ($this->message_type) {
1057 1056
       case 'alt':
1058 1057
       case 'alt_attachments':
1059 1058
         $this->AltBody = $this->WrapText($this->AltBody, $this->WordWrap);
@@ -1074,24 +1073,24 @@  discard block
 block discarded – undo
1074 1073
 
1075 1074
     // Set the boundaries
1076 1075
     $uniq_id = md5(uniqid(time()));
1077
-    $this->boundary[1] = 'b1_' . $uniq_id;
1078
-    $this->boundary[2] = 'b2_' . $uniq_id;
1076
+    $this->boundary[1] = 'b1_'.$uniq_id;
1077
+    $this->boundary[2] = 'b2_'.$uniq_id;
1079 1078
 
1080 1079
     $result .= $this->HeaderLine('Date', self::RFCDate());
1081
-    if($this->Sender == '') {
1080
+    if ($this->Sender == '') {
1082 1081
       $result .= $this->HeaderLine('Return-Path', trim($this->From));
1083 1082
     } else {
1084 1083
       $result .= $this->HeaderLine('Return-Path', trim($this->Sender));
1085 1084
     }
1086 1085
 
1087 1086
     // To be created automatically by mail()
1088
-    if($this->Mailer != 'mail') {
1087
+    if ($this->Mailer != 'mail') {
1089 1088
       if ($this->SingleTo === true) {
1090
-        foreach($this->to as $t) {
1089
+        foreach ($this->to as $t) {
1091 1090
           $this->SingleToArray[] = $this->AddrFormat($t);
1092 1091
         }
1093 1092
       } else {
1094
-        if(count($this->to) > 0) {
1093
+        if (count($this->to) > 0) {
1095 1094
           $result .= $this->AddrAppend('To', $this->to);
1096 1095
         } elseif (count($this->cc) == 0) {
1097 1096
           $result .= $this->HeaderLine('To', 'undisclosed-recipients:;');
@@ -1105,38 +1104,38 @@  discard block
 block discarded – undo
1105 1104
     $result .= $this->AddrAppend('From', $from);
1106 1105
 
1107 1106
     // sendmail and mail() extract Cc from the header before sending
1108
-    if(count($this->cc) > 0) {
1107
+    if (count($this->cc) > 0) {
1109 1108
       $result .= $this->AddrAppend('Cc', $this->cc);
1110 1109
     }
1111 1110
 
1112 1111
     // sendmail and mail() extract Bcc from the header before sending
1113
-    if((($this->Mailer == 'sendmail') || ($this->Mailer == 'mail')) && (count($this->bcc) > 0)) {
1112
+    if ((($this->Mailer == 'sendmail') || ($this->Mailer == 'mail')) && (count($this->bcc) > 0)) {
1114 1113
       $result .= $this->AddrAppend('Bcc', $this->bcc);
1115 1114
     }
1116 1115
 
1117
-    if(count($this->ReplyTo) > 0) {
1116
+    if (count($this->ReplyTo) > 0) {
1118 1117
       $result .= $this->AddrAppend('Reply-to', $this->ReplyTo);
1119 1118
     }
1120 1119
 
1121 1120
     // mail() sets the subject itself
1122
-    if($this->Mailer != 'mail') {
1121
+    if ($this->Mailer != 'mail') {
1123 1122
       $result .= $this->HeaderLine('Subject', $this->EncodeHeader($this->SecureHeader($this->Subject)));
1124 1123
     }
1125 1124
 
1126
-    if($this->MessageID != '') {
1127
-      $result .= $this->HeaderLine('Message-ID',$this->MessageID);
1125
+    if ($this->MessageID != '') {
1126
+      $result .= $this->HeaderLine('Message-ID', $this->MessageID);
1128 1127
     } else {
1129 1128
       $result .= sprintf("Message-ID: <%s@%s>%s", $uniq_id, $this->ServerHostname(), $this->LE);
1130 1129
     }
1131 1130
     $result .= $this->HeaderLine('X-Priority', $this->Priority);
1132 1131
     $result .= $this->HeaderLine('X-Mailer', 'PHPMailer '.$this->Version.' (phpmailer.sourceforge.net)');
1133 1132
 
1134
-    if($this->ConfirmReadingTo != '') {
1135
-      $result .= $this->HeaderLine('Disposition-Notification-To', '<' . trim($this->ConfirmReadingTo) . '>');
1133
+    if ($this->ConfirmReadingTo != '') {
1134
+      $result .= $this->HeaderLine('Disposition-Notification-To', '<'.trim($this->ConfirmReadingTo).'>');
1136 1135
     }
1137 1136
 
1138 1137
     // Add custom headers
1139
-    for($index = 0; $index < count($this->CustomHeader); $index++) {
1138
+    for ($index = 0; $index < count($this->CustomHeader); $index++) {
1140 1139
       $result .= $this->HeaderLine(trim($this->CustomHeader[$index][0]), $this->EncodeHeader(trim($this->CustomHeader[$index][1])));
1141 1140
     }
1142 1141
     if (!$this->sign_key_file) {
@@ -1154,27 +1153,27 @@  discard block
 block discarded – undo
1154 1153
    */
1155 1154
   public function GetMailMIME() {
1156 1155
     $result = '';
1157
-    switch($this->message_type) {
1156
+    switch ($this->message_type) {
1158 1157
       case 'plain':
1159 1158
         $result .= $this->HeaderLine('Content-Transfer-Encoding', $this->Encoding);
1160 1159
         $result .= sprintf("Content-Type: %s; charset=\"%s\"", $this->ContentType, $this->CharSet);
1161 1160
         break;
1162 1161
       case 'attachments':
1163 1162
       case 'alt_attachments':
1164
-        if($this->InlineImageExists()){
1163
+        if ($this->InlineImageExists()) {
1165 1164
           $result .= sprintf("Content-Type: %s;%s\ttype=\"text/html\";%s\tboundary=\"%s\"%s", 'multipart/related', $this->LE, $this->LE, $this->boundary[1], $this->LE);
1166 1165
         } else {
1167 1166
           $result .= $this->HeaderLine('Content-Type', 'multipart/mixed;');
1168
-          $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
1167
+          $result .= $this->TextLine("\tboundary=\"".$this->boundary[1].'"');
1169 1168
         }
1170 1169
         break;
1171 1170
       case 'alt':
1172 1171
         $result .= $this->HeaderLine('Content-Type', 'multipart/alternative;');
1173
-        $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
1172
+        $result .= $this->TextLine("\tboundary=\"".$this->boundary[1].'"');
1174 1173
         break;
1175 1174
     }
1176 1175
 
1177
-    if($this->Mailer != 'mail') {
1176
+    if ($this->Mailer != 'mail') {
1178 1177
       $result .= $this->LE.$this->LE;
1179 1178
     }
1180 1179
 
@@ -1195,7 +1194,7 @@  discard block
 block discarded – undo
1195 1194
 
1196 1195
     $this->SetWordWrap();
1197 1196
 
1198
-    switch($this->message_type) {
1197
+    switch ($this->message_type) {
1199 1198
       case 'alt':
1200 1199
         $body .= $this->GetBoundary($this->boundary[1], '', 'text/plain', '');
1201 1200
         $body .= $this->EncodeString($this->AltBody, $this->Encoding);
@@ -1216,11 +1215,11 @@  discard block
 block discarded – undo
1216 1215
         break;
1217 1216
       case 'alt_attachments':
1218 1217
         $body .= sprintf("--%s%s", $this->boundary[1], $this->LE);
1219
-        $body .= sprintf("Content-Type: %s;%s" . "\tboundary=\"%s\"%s", 'multipart/alternative', $this->LE, $this->boundary[2], $this->LE.$this->LE);
1220
-        $body .= $this->GetBoundary($this->boundary[2], '', 'text/plain', '') . $this->LE; // Create text body
1218
+        $body .= sprintf("Content-Type: %s;%s"."\tboundary=\"%s\"%s", 'multipart/alternative', $this->LE, $this->boundary[2], $this->LE.$this->LE);
1219
+        $body .= $this->GetBoundary($this->boundary[2], '', 'text/plain', '').$this->LE; // Create text body
1221 1220
         $body .= $this->EncodeString($this->AltBody, $this->Encoding);
1222 1221
         $body .= $this->LE.$this->LE;
1223
-        $body .= $this->GetBoundary($this->boundary[2], '', 'text/html', '') . $this->LE; // Create the HTML body
1222
+        $body .= $this->GetBoundary($this->boundary[2], '', 'text/html', '').$this->LE; // Create the HTML body
1224 1223
         $body .= $this->EncodeString($this->Body, $this->Encoding);
1225 1224
         $body .= $this->LE.$this->LE;
1226 1225
         $body .= $this->EndBoundary($this->boundary[2]);
@@ -1261,16 +1260,16 @@  discard block
 block discarded – undo
1261 1260
    */
1262 1261
   private function GetBoundary($boundary, $charSet, $contentType, $encoding) {
1263 1262
     $result = '';
1264
-    if($charSet == '') {
1263
+    if ($charSet == '') {
1265 1264
       $charSet = $this->CharSet;
1266 1265
     }
1267
-    if($contentType == '') {
1266
+    if ($contentType == '') {
1268 1267
       $contentType = $this->ContentType;
1269 1268
     }
1270
-    if($encoding == '') {
1269
+    if ($encoding == '') {
1271 1270
       $encoding = $this->Encoding;
1272 1271
     }
1273
-    $result .= $this->TextLine('--' . $boundary);
1272
+    $result .= $this->TextLine('--'.$boundary);
1274 1273
     $result .= sprintf("Content-Type: %s; charset = \"%s\"", $contentType, $charSet);
1275 1274
     $result .= $this->LE;
1276 1275
     $result .= $this->HeaderLine('Content-Transfer-Encoding', $encoding);
@@ -1284,7 +1283,7 @@  discard block
 block discarded – undo
1284 1283
    * @access private
1285 1284
    */
1286 1285
   private function EndBoundary($boundary) {
1287
-    return $this->LE . '--' . $boundary . '--' . $this->LE;
1286
+    return $this->LE.'--'.$boundary.'--'.$this->LE;
1288 1287
   }
1289 1288
 
1290 1289
   /**
@@ -1293,16 +1292,16 @@  discard block
 block discarded – undo
1293 1292
    * @return void
1294 1293
    */
1295 1294
   private function SetMessageType() {
1296
-    if(count($this->attachment) < 1 && strlen($this->AltBody) < 1) {
1295
+    if (count($this->attachment) < 1 && strlen($this->AltBody) < 1) {
1297 1296
       $this->message_type = 'plain';
1298 1297
     } else {
1299
-      if(count($this->attachment) > 0) {
1298
+      if (count($this->attachment) > 0) {
1300 1299
         $this->message_type = 'attachments';
1301 1300
       }
1302
-      if(strlen($this->AltBody) > 0 && count($this->attachment) < 1) {
1301
+      if (strlen($this->AltBody) > 0 && count($this->attachment) < 1) {
1303 1302
         $this->message_type = 'alt';
1304 1303
       }
1305
-      if(strlen($this->AltBody) > 0 && count($this->attachment) > 0) {
1304
+      if (strlen($this->AltBody) > 0 && count($this->attachment) > 0) {
1306 1305
         $this->message_type = 'alt_attachments';
1307 1306
       }
1308 1307
     }
@@ -1314,7 +1313,7 @@  discard block
 block discarded – undo
1314 1313
    * @return string
1315 1314
    */
1316 1315
   public function HeaderLine($name, $value) {
1317
-    return $name . ': ' . $value . $this->LE;
1316
+    return $name.': '.$value.$this->LE;
1318 1317
   }
1319 1318
 
1320 1319
   /**
@@ -1323,7 +1322,7 @@  discard block
 block discarded – undo
1323 1322
    * @return string
1324 1323
    */
1325 1324
   public function TextLine($value) {
1326
-    return $value . $this->LE;
1325
+    return $value.$this->LE;
1327 1326
   }
1328 1327
 
1329 1328
   /////////////////////////////////////////////////
@@ -1342,11 +1341,11 @@  discard block
 block discarded – undo
1342 1341
    */
1343 1342
   public function AddAttachment($path, $name = '', $encoding = 'base64', $type = 'application/octet-stream') {
1344 1343
     try {
1345
-      if ( !@is_file($path) ) {
1346
-        throw new phpmailerException($this->Lang('file_access') . $path, self::STOP_CONTINUE);
1344
+      if (!@is_file($path)) {
1345
+        throw new phpmailerException($this->Lang('file_access').$path, self::STOP_CONTINUE);
1347 1346
       }
1348 1347
       $filename = basename($path);
1349
-      if ( $name == '' ) {
1348
+      if ($name == '') {
1350 1349
         $name = $filename;
1351 1350
       }
1352 1351
 
@@ -1356,7 +1355,7 @@  discard block
 block discarded – undo
1356 1355
         2 => $name,
1357 1356
         3 => $encoding,
1358 1357
         4 => $type,
1359
-        5 => false,  // isStringAttachment
1358
+        5 => false, // isStringAttachment
1360 1359
         6 => 'attachment',
1361 1360
         7 => 0
1362 1361
       );
@@ -1367,7 +1366,7 @@  discard block
 block discarded – undo
1367 1366
         throw $e;
1368 1367
       }
1369 1368
       error_log($e->getMessage()."\n");
1370
-      if ( $e->getCode() == self::STOP_CRITICAL ) {
1369
+      if ($e->getCode() == self::STOP_CRITICAL) {
1371 1370
         return false;
1372 1371
       }
1373 1372
     }
@@ -1412,29 +1411,29 @@  discard block
 block discarded – undo
1412 1411
       $disposition = $attachment[6];
1413 1412
       $cid         = $attachment[7];
1414 1413
       $incl[]      = $attachment[0];
1415
-      if ( $disposition == 'inline' && isset($cidUniq[$cid]) ) { continue; }
1414
+      if ($disposition == 'inline' && isset($cidUniq[$cid])) { continue; }
1416 1415
       $cidUniq[$cid] = true;
1417 1416
 
1418 1417
       $mime[] = sprintf("--%s%s", $this->boundary[1], $this->LE);
1419 1418
       $mime[] = sprintf("Content-Type: %s; name=\"%s\"%s", $type, $this->EncodeHeader($this->SecureHeader($name)), $this->LE);
1420 1419
       $mime[] = sprintf("Content-Transfer-Encoding: %s%s", $encoding, $this->LE);
1421 1420
 
1422
-      if($disposition == 'inline') {
1421
+      if ($disposition == 'inline') {
1423 1422
         $mime[] = sprintf("Content-ID: <%s>%s", $cid, $this->LE);
1424 1423
       }
1425 1424
 
1426 1425
       $mime[] = sprintf("Content-Disposition: %s; filename=\"%s\"%s", $disposition, $this->EncodeHeader($this->SecureHeader($name)), $this->LE.$this->LE);
1427 1426
 
1428 1427
       // Encode as string attachment
1429
-      if($bString) {
1428
+      if ($bString) {
1430 1429
         $mime[] = $this->EncodeString($string, $encoding);
1431
-        if($this->IsError()) {
1430
+        if ($this->IsError()) {
1432 1431
           return '';
1433 1432
         }
1434 1433
         $mime[] = $this->LE.$this->LE;
1435 1434
       } else {
1436 1435
         $mime[] = $this->EncodeFile($path, $encoding);
1437
-        if($this->IsError()) {
1436
+        if ($this->IsError()) {
1438 1437
           return '';
1439 1438
         }
1440 1439
         $mime[] = $this->LE.$this->LE;
@@ -1458,7 +1457,7 @@  discard block
 block discarded – undo
1458 1457
   private function EncodeFile($path, $encoding = 'base64') {
1459 1458
     try {
1460 1459
       if (!is_readable($path)) {
1461
-        throw new phpmailerException($this->Lang('file_open') . $path, self::STOP_CONTINUE);
1460
+        throw new phpmailerException($this->Lang('file_open').$path, self::STOP_CONTINUE);
1462 1461
       }
1463 1462
         $magic_quotes = get_magic_quotes_runtime();
1464 1463
         if ($magic_quotes) {
@@ -1492,9 +1491,9 @@  discard block
 block discarded – undo
1492 1491
    * @access public
1493 1492
    * @return string
1494 1493
    */
1495
-  public function EncodeString ($str, $encoding = 'base64') {
1494
+  public function EncodeString($str, $encoding = 'base64') {
1496 1495
     $encoded = '';
1497
-    switch(strtolower($encoding)) {
1496
+    switch (strtolower($encoding)) {
1498 1497
       case 'base64':
1499 1498
         $encoded = chunk_split(base64_encode($str), 76, $this->LE);
1500 1499
         break;
@@ -1512,7 +1511,7 @@  discard block
 block discarded – undo
1512 1511
         $encoded = $this->EncodeQP($str);
1513 1512
         break;
1514 1513
       default:
1515
-        $this->SetError($this->Lang('encoding') . $encoding);
1514
+        $this->SetError($this->Lang('encoding').$encoding);
1516 1515
         break;
1517 1516
     }
1518 1517
     return $encoded;
@@ -1554,7 +1553,7 @@  discard block
 block discarded – undo
1554 1553
 
1555 1554
     $maxlen = 75 - 7 - strlen($this->CharSet);
1556 1555
     // Try to select the encoding which should produce the shortest output
1557
-    if (strlen($str)/3 < $x) {
1556
+    if (strlen($str) / 3 < $x) {
1558 1557
       $encoding = 'B';
1559 1558
       // Modified by Ivan Tcholakov, 24-JAN-2010.
1560 1559
       //if (function_exists('mb_strlen') && $this->HasMultiBytes($str)) {
@@ -1635,7 +1634,7 @@  discard block
 block discarded – undo
1635 1634
       }
1636 1635
       while (strlen($chunk) > $length);
1637 1636
 
1638
-      $encoded .= $chunk . $this->LE;
1637
+      $encoded .= $chunk.$this->LE;
1639 1638
     }
1640 1639
 
1641 1640
     // Chomp the last linefeed
@@ -1651,37 +1650,37 @@  discard block
 block discarded – undo
1651 1650
   * @param integer $line_max Number of chars allowed on a line before wrapping
1652 1651
   * @return string
1653 1652
   */
1654
-  public function EncodeQPphp( $input = '', $line_max = 76, $space_conv = false) {
1655
-    $hex = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
1653
+  public function EncodeQPphp($input = '', $line_max = 76, $space_conv = false) {
1654
+    $hex = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F');
1656 1655
     $lines = preg_split('/(?:\r\n|\r|\n)/', $input);
1657 1656
     $eol = "\r\n";
1658 1657
     $escape = '=';
1659 1658
     $output = '';
1660
-    while( list(, $line) = each($lines) ) {
1659
+    while (list(, $line) = each($lines)) {
1661 1660
       $linlen = strlen($line);
1662 1661
       $newline = '';
1663
-      for($i = 0; $i < $linlen; $i++) {
1664
-        $c = substr( $line, $i, 1 );
1665
-        $dec = ord( $c );
1666
-        if ( ( $i == 0 ) && ( $dec == 46 ) ) { // convert first point in the line into =2E
1662
+      for ($i = 0; $i < $linlen; $i++) {
1663
+        $c = substr($line, $i, 1);
1664
+        $dec = ord($c);
1665
+        if (($i == 0) && ($dec == 46)) { // convert first point in the line into =2E
1667 1666
           $c = '=2E';
1668 1667
         }
1669
-        if ( $dec == 32 ) {
1670
-          if ( $i == ( $linlen - 1 ) ) { // convert space at eol only
1668
+        if ($dec == 32) {
1669
+          if ($i == ($linlen - 1)) { // convert space at eol only
1671 1670
             $c = '=20';
1672
-          } else if ( $space_conv ) {
1671
+          } else if ($space_conv) {
1673 1672
             $c = '=20';
1674 1673
           }
1675
-        } elseif ( ($dec == 61) || ($dec < 32 ) || ($dec > 126) ) { // always encode "\t", which is *not* required
1676
-          $h2 = floor($dec/16);
1677
-          $h1 = floor($dec%16);
1674
+        } elseif (($dec == 61) || ($dec < 32) || ($dec > 126)) { // always encode "\t", which is *not* required
1675
+          $h2 = floor($dec / 16);
1676
+          $h1 = floor($dec % 16);
1678 1677
           $c = $escape.$hex[$h2].$hex[$h1];
1679 1678
         }
1680
-        if ( (strlen($newline) + strlen($c)) >= $line_max ) { // CRLF is not counted
1679
+        if ((strlen($newline) + strlen($c)) >= $line_max) { // CRLF is not counted
1681 1680
           $output .= $newline.$escape.$eol; //  soft line break; " =\r\n" is okay
1682 1681
           $newline = '';
1683 1682
           // check if newline first character will be point or not
1684
-          if ( $dec == 46 ) {
1683
+          if ($dec == 46) {
1685 1684
             $c = '=2E';
1686 1685
           }
1687 1686
         }
@@ -1733,7 +1732,7 @@  discard block
 block discarded – undo
1733 1732
    * @access public
1734 1733
    * @return string
1735 1734
    */
1736
-  public function EncodeQ ($str, $position = 'text') {
1735
+  public function EncodeQ($str, $position = 'text') {
1737 1736
     // There should not be any EOL in the string
1738 1737
     $encoded = preg_replace('/[\r\n]*/', '', $str);
1739 1738
 
@@ -1776,7 +1775,7 @@  discard block
 block discarded – undo
1776 1775
       2 => basename($filename),
1777 1776
       3 => $encoding,
1778 1777
       4 => $type,
1779
-      5 => true,  // isStringAttachment
1778
+      5 => true, // isStringAttachment
1780 1779
       6 => 'attachment',
1781 1780
       7 => 0
1782 1781
     );
@@ -1797,13 +1796,13 @@  discard block
 block discarded – undo
1797 1796
    */
1798 1797
   public function AddEmbeddedImage($path, $cid, $name = '', $encoding = 'base64', $type = 'application/octet-stream') {
1799 1798
 
1800
-    if ( !@is_file($path) ) {
1801
-      $this->SetError($this->Lang('file_access') . $path);
1799
+    if (!@is_file($path)) {
1800
+      $this->SetError($this->Lang('file_access').$path);
1802 1801
       return false;
1803 1802
     }
1804 1803
 
1805 1804
     $filename = basename($path);
1806
-    if ( $name == '' ) {
1805
+    if ($name == '') {
1807 1806
       $name = $filename;
1808 1807
     }
1809 1808
 
@@ -1814,7 +1813,7 @@  discard block
 block discarded – undo
1814 1813
       2 => $name,
1815 1814
       3 => $encoding,
1816 1815
       4 => $type,
1817
-      5 => false,  // isStringAttachment
1816
+      5 => false, // isStringAttachment
1818 1817
       6 => 'inline',
1819 1818
       7 => $cid
1820 1819
     );
@@ -1828,7 +1827,7 @@  discard block
 block discarded – undo
1828 1827
    * @return bool
1829 1828
    */
1830 1829
   public function InlineImageExists() {
1831
-    foreach($this->attachment as $attachment) {
1830
+    foreach ($this->attachment as $attachment) {
1832 1831
       if ($attachment[6] == 'inline') {
1833 1832
         return true;
1834 1833
       }
@@ -1845,7 +1844,7 @@  discard block
 block discarded – undo
1845 1844
    * @return void
1846 1845
    */
1847 1846
   public function ClearAddresses() {
1848
-    foreach($this->to as $to) {
1847
+    foreach ($this->to as $to) {
1849 1848
       unset($this->all_recipients[strtolower($to[0])]);
1850 1849
     }
1851 1850
     $this->to = array();
@@ -1856,7 +1855,7 @@  discard block
 block discarded – undo
1856 1855
    * @return void
1857 1856
    */
1858 1857
   public function ClearCCs() {
1859
-    foreach($this->cc as $cc) {
1858
+    foreach ($this->cc as $cc) {
1860 1859
       unset($this->all_recipients[strtolower($cc[0])]);
1861 1860
     }
1862 1861
     $this->cc = array();
@@ -1867,7 +1866,7 @@  discard block
 block discarded – undo
1867 1866
    * @return void
1868 1867
    */
1869 1868
   public function ClearBCCs() {
1870
-    foreach($this->bcc as $bcc) {
1869
+    foreach ($this->bcc as $bcc) {
1871 1870
       unset($this->all_recipients[strtolower($bcc[0])]);
1872 1871
     }
1873 1872
     $this->bcc = array();
@@ -1924,7 +1923,7 @@  discard block
 block discarded – undo
1924 1923
     if ($this->Mailer == 'smtp' and !is_null($this->smtp)) {
1925 1924
       $lasterror = $this->smtp->getError();
1926 1925
       if (!empty($lasterror) and array_key_exists('smtp_msg', $lasterror)) {
1927
-        $msg .= '<p>' . $this->Lang('smtp_error') . $lasterror['smtp_msg'] . "</p>\n";
1926
+        $msg .= '<p>'.$this->Lang('smtp_error').$lasterror['smtp_msg']."</p>\n";
1928 1927
       }
1929 1928
     }
1930 1929
     $this->ErrorInfo = $msg;
@@ -1940,7 +1939,7 @@  discard block
 block discarded – undo
1940 1939
     $tz = date('Z');
1941 1940
     $tzs = ($tz < 0) ? '-' : '+';
1942 1941
     $tz = abs($tz);
1943
-    $tz = (int)($tz/3600)*100 + ($tz%3600)/60;
1942
+    $tz = (int) ($tz / 3600) * 100 + ($tz % 3600) / 60;
1944 1943
     $result = sprintf("%s %s%04d", date('D, j M Y H:i:s'), $tzs, $tz);
1945 1944
 
1946 1945
     return $result;
@@ -1969,14 +1968,14 @@  discard block
 block discarded – undo
1969 1968
    * @return string
1970 1969
    */
1971 1970
   private function Lang($key) {
1972
-    if(count($this->language) < 1) {
1971
+    if (count($this->language) < 1) {
1973 1972
       $this->SetLanguage('en'); // set the default language
1974 1973
     }
1975 1974
 
1976
-    if(isset($this->language[$key])) {
1975
+    if (isset($this->language[$key])) {
1977 1976
       return $this->language[$key];
1978 1977
     } else {
1979
-      return 'Language string failed to load: ' . $key;
1978
+      return 'Language string failed to load: '.$key;
1980 1979
     }
1981 1980
   }
1982 1981
 
@@ -2017,19 +2016,19 @@  discard block
 block discarded – undo
2017 2016
    */
2018 2017
   public function MsgHTML($message, $basedir = '') {
2019 2018
     preg_match_all("/(src|background)=\"(.*)\"/Ui", $message, $images);
2020
-    if(isset($images[2])) {
2021
-      foreach($images[2] as $i => $url) {
2019
+    if (isset($images[2])) {
2020
+      foreach ($images[2] as $i => $url) {
2022 2021
         // do not change urls for absolute images (thanks to corvuscorax)
2023
-        if (!preg_match('#^[A-z]+://#',$url)) {
2022
+        if (!preg_match('#^[A-z]+://#', $url)) {
2024 2023
           $filename = basename($url);
2025 2024
           $directory = dirname($url);
2026
-          ($directory == '.')?$directory='':'';
2027
-          $cid = 'cid:' . md5($filename);
2025
+          ($directory == '.') ? $directory = '' : '';
2026
+          $cid = 'cid:'.md5($filename);
2028 2027
           $ext = pathinfo($filename, PATHINFO_EXTENSION);
2029
-          $mimeType  = self::_mime_types($ext);
2030
-          if ( strlen($basedir) > 1 && substr($basedir,-1) != '/') { $basedir .= '/'; }
2031
-          if ( strlen($directory) > 1 && substr($directory,-1) != '/') { $directory .= '/'; }
2032
-          if ( $this->AddEmbeddedImage($basedir.$directory.$filename, md5($filename), $filename, 'base64',$mimeType) ) {
2028
+          $mimeType = self::_mime_types($ext);
2029
+          if (strlen($basedir) > 1 && substr($basedir, -1) != '/') { $basedir .= '/'; }
2030
+          if (strlen($directory) > 1 && substr($directory, -1) != '/') { $directory .= '/'; }
2031
+          if ($this->AddEmbeddedImage($basedir.$directory.$filename, md5($filename), $filename, 'base64', $mimeType)) {
2033 2032
             $message = preg_replace("/".$images[1][$i]."=\"".preg_quote($url, '/')."\"/Ui", $images[1][$i]."=\"".$cid."\"", $message);
2034 2033
           }
2035 2034
         }
@@ -2037,12 +2036,12 @@  discard block
 block discarded – undo
2037 2036
     }
2038 2037
     $this->IsHTML(true);
2039 2038
     $this->Body = $message;
2040
-    $textMsg = trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/s','',$message)));
2039
+    $textMsg = trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/s', '', $message)));
2041 2040
     if (!empty($textMsg) && empty($this->AltBody)) {
2042 2041
       $this->AltBody = html_entity_decode($textMsg);
2043 2042
     }
2044 2043
     if (empty($this->AltBody)) {
2045
-      $this->AltBody = 'To view this email message, open it in a program that understands HTML!' . "\n\n";
2044
+      $this->AltBody = 'To view this email message, open it in a program that understands HTML!'."\n\n";
2046 2045
     }
2047 2046
   }
2048 2047
 
@@ -2160,10 +2159,10 @@  discard block
 block discarded – undo
2160 2159
   */
2161 2160
   public function set($name, $value = '') {
2162 2161
     try {
2163
-      if (isset($this->$name) ) {
2162
+      if (isset($this->$name)) {
2164 2163
         $this->$name = $value;
2165 2164
       } else {
2166
-        throw new phpmailerException($this->Lang('variable_set') . $name, self::STOP_CRITICAL);
2165
+        throw new phpmailerException($this->Lang('variable_set').$name, self::STOP_CRITICAL);
2167 2166
       }
2168 2167
     } catch (Exception $e) {
2169 2168
       $this->SetError($e->getMessage());
@@ -2207,14 +2206,14 @@  discard block
 block discarded – undo
2207 2206
    * @param string $key_pass Password for private key
2208 2207
    */
2209 2208
   public function DKIM_QP($txt) {
2210
-    $tmp="";
2211
-    $line="";
2212
-    for ($i=0;$i<strlen($txt);$i++) {
2213
-      $ord=ord($txt[$i]);
2214
-      if ( ((0x21 <= $ord) && ($ord <= 0x3A)) || $ord == 0x3C || ((0x3E <= $ord) && ($ord <= 0x7E)) ) {
2215
-        $line.=$txt[$i];
2209
+    $tmp = "";
2210
+    $line = "";
2211
+    for ($i = 0; $i < strlen($txt); $i++) {
2212
+      $ord = ord($txt[$i]);
2213
+      if (((0x21 <= $ord) && ($ord <= 0x3A)) || $ord == 0x3C || ((0x3E <= $ord) && ($ord <= 0x7E))) {
2214
+        $line .= $txt[$i];
2216 2215
       } else {
2217
-        $line.="=".sprintf("%02X",$ord);
2216
+        $line .= "=".sprintf("%02X", $ord);
2218 2217
       }
2219 2218
     }
2220 2219
     return $line;
@@ -2228,8 +2227,8 @@  discard block
 block discarded – undo
2228 2227
    */
2229 2228
   public function DKIM_Sign($s) {
2230 2229
     $privKeyStr = file_get_contents($this->DKIM_private);
2231
-    if ($this->DKIM_passphrase!='') {
2232
-      $privKey = openssl_pkey_get_private($privKeyStr,$this->DKIM_passphrase);
2230
+    if ($this->DKIM_passphrase != '') {
2231
+      $privKey = openssl_pkey_get_private($privKeyStr, $this->DKIM_passphrase);
2233 2232
     } else {
2234 2233
       $privKey = $privKeyStr;
2235 2234
     }
@@ -2245,15 +2244,15 @@  discard block
 block discarded – undo
2245 2244
    * @param string $s Header
2246 2245
    */
2247 2246
   public function DKIM_HeaderC($s) {
2248
-    $s=preg_replace("/\r\n\s+/"," ",$s);
2249
-    $lines=explode("\r\n",$s);
2247
+    $s = preg_replace("/\r\n\s+/", " ", $s);
2248
+    $lines = explode("\r\n", $s);
2250 2249
     foreach ($lines as $key=>$line) {
2251
-      list($heading,$value)=explode(":",$line,2);
2252
-      $heading=strtolower($heading);
2253
-      $value=preg_replace("/\s+/"," ",$value) ; // Compress useless spaces
2254
-      $lines[$key]=$heading.":".trim($value) ; // Don't forget to remove WSP around the value
2250
+      list($heading, $value) = explode(":", $line, 2);
2251
+      $heading = strtolower($heading);
2252
+      $value = preg_replace("/\s+/", " ", $value); // Compress useless spaces
2253
+      $lines[$key] = $heading.":".trim($value); // Don't forget to remove WSP around the value
2255 2254
     }
2256
-    $s=implode("\r\n",$lines);
2255
+    $s = implode("\r\n", $lines);
2257 2256
     return $s;
2258 2257
   }
2259 2258
 
@@ -2266,11 +2265,11 @@  discard block
 block discarded – undo
2266 2265
   public function DKIM_BodyC($body) {
2267 2266
     if ($body == '') return "\r\n";
2268 2267
     // stabilize line endings
2269
-    $body=str_replace("\r\n","\n",$body);
2270
-    $body=str_replace("\n","\r\n",$body);
2268
+    $body = str_replace("\r\n", "\n", $body);
2269
+    $body = str_replace("\n", "\r\n", $body);
2271 2270
     // END stabilize line endings
2272
-    while (substr($body,strlen($body)-4,4) == "\r\n\r\n") {
2273
-      $body=substr($body,0,strlen($body)-2);
2271
+    while (substr($body, strlen($body) - 4, 4) == "\r\n\r\n") {
2272
+      $body = substr($body, 0, strlen($body) - 2);
2274 2273
     }
2275 2274
     return $body;
2276 2275
   }
@@ -2283,52 +2282,52 @@  discard block
 block discarded – undo
2283 2282
    * @param string $subject Subject
2284 2283
    * @param string $body Body
2285 2284
    */
2286
-  public function DKIM_Add($headers_line,$subject,$body) {
2285
+  public function DKIM_Add($headers_line, $subject, $body) {
2287 2286
     $DKIMsignatureType    = 'rsa-sha1'; // Signature & hash algorithms
2288 2287
     $DKIMcanonicalization = 'relaxed/simple'; // Canonicalization of header/body
2289 2288
     $DKIMquery            = 'dns/txt'; // Query method
2290
-    $DKIMtime             = time() ; // Signature Timestamp = seconds since 00:00:00 - Jan 1, 1970 (UTC time zone)
2289
+    $DKIMtime             = time(); // Signature Timestamp = seconds since 00:00:00 - Jan 1, 1970 (UTC time zone)
2291 2290
     $subject_header       = "Subject: $subject";
2292
-    $headers              = explode("\r\n",$headers_line);
2293
-    foreach($headers as $header) {
2294
-      if (strpos($header,'From:') === 0) {
2295
-        $from_header=$header;
2296
-      } elseif (strpos($header,'To:') === 0) {
2297
-        $to_header=$header;
2291
+    $headers              = explode("\r\n", $headers_line);
2292
+    foreach ($headers as $header) {
2293
+      if (strpos($header, 'From:') === 0) {
2294
+        $from_header = $header;
2295
+      } elseif (strpos($header, 'To:') === 0) {
2296
+        $to_header = $header;
2298 2297
       }
2299 2298
     }
2300
-    $from     = str_replace('|','=7C',$this->DKIM_QP($from_header));
2301
-    $to       = str_replace('|','=7C',$this->DKIM_QP($to_header));
2302
-    $subject  = str_replace('|','=7C',$this->DKIM_QP($subject_header)) ; // Copied header fields (dkim-quoted-printable
2299
+    $from     = str_replace('|', '=7C', $this->DKIM_QP($from_header));
2300
+    $to       = str_replace('|', '=7C', $this->DKIM_QP($to_header));
2301
+    $subject  = str_replace('|', '=7C', $this->DKIM_QP($subject_header)); // Copied header fields (dkim-quoted-printable
2303 2302
     $body     = $this->DKIM_BodyC($body);
2304
-    $DKIMlen  = strlen($body) ; // Length of body
2305
-    $DKIMb64  = base64_encode(pack("H*", sha1($body))) ; // Base64 of packed binary SHA-1 hash of body
2306
-    $ident    = ($this->DKIM_identity == '')? '' : " i=" . $this->DKIM_identity . ";";
2307
-    $dkimhdrs = "DKIM-Signature: v=1; a=" . $DKIMsignatureType . "; q=" . $DKIMquery . "; l=" . $DKIMlen . "; s=" . $this->DKIM_selector . ";\r\n".
2308
-                "\tt=" . $DKIMtime . "; c=" . $DKIMcanonicalization . ";\r\n".
2303
+    $DKIMlen  = strlen($body); // Length of body
2304
+    $DKIMb64  = base64_encode(pack("H*", sha1($body))); // Base64 of packed binary SHA-1 hash of body
2305
+    $ident    = ($this->DKIM_identity == '') ? '' : " i=".$this->DKIM_identity.";";
2306
+    $dkimhdrs = "DKIM-Signature: v=1; a=".$DKIMsignatureType."; q=".$DKIMquery."; l=".$DKIMlen."; s=".$this->DKIM_selector.";\r\n".
2307
+                "\tt=".$DKIMtime."; c=".$DKIMcanonicalization.";\r\n".
2309 2308
                 "\th=From:To:Subject;\r\n".
2310
-                "\td=" . $this->DKIM_domain . ";" . $ident . "\r\n".
2309
+                "\td=".$this->DKIM_domain.";".$ident."\r\n".
2311 2310
                 "\tz=$from\r\n".
2312 2311
                 "\t|$to\r\n".
2313 2312
                 "\t|$subject;\r\n".
2314
-                "\tbh=" . $DKIMb64 . ";\r\n".
2313
+                "\tbh=".$DKIMb64.";\r\n".
2315 2314
                 "\tb=";
2316
-    $toSign   = $this->DKIM_HeaderC($from_header . "\r\n" . $to_header . "\r\n" . $subject_header . "\r\n" . $dkimhdrs);
2315
+    $toSign   = $this->DKIM_HeaderC($from_header."\r\n".$to_header."\r\n".$subject_header."\r\n".$dkimhdrs);
2317 2316
     $signed   = $this->DKIM_Sign($toSign);
2318 2317
     return "X-PHPMAILER-DKIM: phpmailer.worxware.com\r\n".$dkimhdrs.$signed."\r\n";
2319 2318
   }
2320 2319
 
2321
-  protected function doCallback($isSent,$to,$cc,$bcc,$subject,$body) {
2320
+  protected function doCallback($isSent, $to, $cc, $bcc, $subject, $body) {
2322 2321
     if (!empty($this->action_function) && function_exists($this->action_function)) {
2323
-      $params = array($isSent,$to,$cc,$bcc,$subject,$body);
2324
-      call_user_func_array($this->action_function,$params);
2322
+      $params = array($isSent, $to, $cc, $bcc, $subject, $body);
2323
+      call_user_func_array($this->action_function, $params);
2325 2324
     }
2326 2325
   }
2327 2326
 }
2328 2327
 
2329 2328
 class phpmailerException extends Exception {
2330 2329
   public function errorMessage() {
2331
-    $errorMsg = '<strong>' . $this->getMessage() . "</strong><br />\n";
2330
+    $errorMsg = '<strong>'.$this->getMessage()."</strong><br />\n";
2332 2331
     return $errorMsg;
2333 2332
   }
2334 2333
 }
Please login to merge, or discard this patch.
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -38,7 +38,9 @@  discard block
 block discarded – undo
38 38
  * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
39 39
  */
40 40
 
41
-if (version_compare(PHP_VERSION, '5.0.0', '<') ) exit("Sorry, this version of PHPMailer will only run on PHP version 5 or greater!\n");
41
+if (version_compare(PHP_VERSION, '5.0.0', '<') ) {
42
+    exit("Sorry, this version of PHPMailer will only run on PHP version 5 or greater!\n");
43
+}
42 44
 
43 45
 class PHPMailer {
44 46
 
@@ -1502,8 +1504,9 @@  discard block
 block discarded – undo
1502 1504
       case '8bit':
1503 1505
         $encoded = $this->FixEOL($str);
1504 1506
         //Make sure it ends with a line break
1505
-        if (substr($encoded, -(strlen($this->LE))) != $this->LE)
1506
-          $encoded .= $this->LE;
1507
+        if (substr($encoded, -(strlen($this->LE))) != $this->LE) {
1508
+                  $encoded .= $this->LE;
1509
+        }
1507 1510
         break;
1508 1511
       case 'binary':
1509 1512
         $encoded = $str;
@@ -2264,7 +2267,9 @@  discard block
 block discarded – undo
2264 2267
    * @param string $body Message Body
2265 2268
    */
2266 2269
   public function DKIM_BodyC($body) {
2267
-    if ($body == '') return "\r\n";
2270
+    if ($body == '') {
2271
+        return "\r\n";
2272
+    }
2268 2273
     // stabilize line endings
2269 2274
     $body=str_replace("\r\n","\n",$body);
2270 2275
     $body=str_replace("\n","\r\n",$body);
Please login to merge, or discard this patch.
main/inc/lib/phpmailer/class.pop3.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -192,7 +192,7 @@
 block discarded – undo
192 192
    * @param string $host
193 193
    * @param integer $port
194 194
    * @param integer $tval
195
-   * @return boolean
195
+   * @return boolean|null
196 196
    */
197 197
   public function Connect ($host, $port = false, $tval = 30) {
198 198
     //  Are we already connected?
Please login to merge, or discard this patch.
Indentation   +203 added lines, -203 removed lines patch added patch discarded remove patch
@@ -60,103 +60,103 @@  discard block
 block discarded – undo
60 60
  */
61 61
 
62 62
 class POP3 {
63
-  /**
64
-   * Default POP3 port
65
-   * @var int
66
-   */
67
-  public $POP3_PORT = 110;
68
-
69
-  /**
70
-   * Default Timeout
71
-   * @var int
72
-   */
73
-  public $POP3_TIMEOUT = 30;
74
-
75
-  /**
76
-   * POP3 Carriage Return + Line Feed
77
-   * @var string
78
-   */
79
-  public $CRLF = "\r\n";
80
-
81
-  /**
82
-   * Displaying Debug warnings? (0 = now, 1+ = yes)
83
-   * @var int
84
-   */
85
-  public $do_debug = 2;
86
-
87
-  /**
88
-   * POP3 Mail Server
89
-   * @var string
90
-   */
91
-  public $host;
92
-
93
-  /**
94
-   * POP3 Port
95
-   * @var int
96
-   */
97
-  public $port;
98
-
99
-  /**
100
-   * POP3 Timeout Value
101
-   * @var int
102
-   */
103
-  public $tval;
104
-
105
-  /**
106
-   * POP3 Username
107
-   * @var string
108
-   */
109
-  public $username;
110
-
111
-  /**
112
-   * POP3 Password
113
-   * @var string
114
-   */
115
-  public $password;
116
-
117
-  /////////////////////////////////////////////////
118
-  // PROPERTIES, PRIVATE AND PROTECTED
119
-  /////////////////////////////////////////////////
120
-
121
-  private $pop_conn;
122
-  private $connected;
123
-  private $error;     //  Error log array
124
-
125
-  /**
126
-   * Constructor, sets the initial values
127
-   * @access public
128
-   * @return POP3
129
-   */
130
-  public function __construct() {
63
+    /**
64
+     * Default POP3 port
65
+     * @var int
66
+     */
67
+    public $POP3_PORT = 110;
68
+
69
+    /**
70
+     * Default Timeout
71
+     * @var int
72
+     */
73
+    public $POP3_TIMEOUT = 30;
74
+
75
+    /**
76
+     * POP3 Carriage Return + Line Feed
77
+     * @var string
78
+     */
79
+    public $CRLF = "\r\n";
80
+
81
+    /**
82
+     * Displaying Debug warnings? (0 = now, 1+ = yes)
83
+     * @var int
84
+     */
85
+    public $do_debug = 2;
86
+
87
+    /**
88
+     * POP3 Mail Server
89
+     * @var string
90
+     */
91
+    public $host;
92
+
93
+    /**
94
+     * POP3 Port
95
+     * @var int
96
+     */
97
+    public $port;
98
+
99
+    /**
100
+     * POP3 Timeout Value
101
+     * @var int
102
+     */
103
+    public $tval;
104
+
105
+    /**
106
+     * POP3 Username
107
+     * @var string
108
+     */
109
+    public $username;
110
+
111
+    /**
112
+     * POP3 Password
113
+     * @var string
114
+     */
115
+    public $password;
116
+
117
+    /////////////////////////////////////////////////
118
+    // PROPERTIES, PRIVATE AND PROTECTED
119
+    /////////////////////////////////////////////////
120
+
121
+    private $pop_conn;
122
+    private $connected;
123
+    private $error;     //  Error log array
124
+
125
+    /**
126
+     * Constructor, sets the initial values
127
+     * @access public
128
+     * @return POP3
129
+     */
130
+    public function __construct() {
131 131
     $this->pop_conn  = 0;
132 132
     $this->connected = false;
133 133
     $this->error     = null;
134
-  }
135
-
136
-  /**
137
-   * Combination of public events - connect, login, disconnect
138
-   * @access public
139
-   * @param string $host
140
-   * @param integer $port
141
-   * @param integer $tval
142
-   * @param string $username
143
-   * @param string $password
144
-   */
145
-  public function Authorise ($host, $port = false, $tval = false, $username, $password, $debug_level = 0) {
134
+    }
135
+
136
+    /**
137
+     * Combination of public events - connect, login, disconnect
138
+     * @access public
139
+     * @param string $host
140
+     * @param integer $port
141
+     * @param integer $tval
142
+     * @param string $username
143
+     * @param string $password
144
+     */
145
+    public function Authorise ($host, $port = false, $tval = false, $username, $password, $debug_level = 0) {
146 146
     $this->host = $host;
147 147
 
148 148
     //  If no port value is passed, retrieve it
149 149
     if ($port == false) {
150
-      $this->port = $this->POP3_PORT;
150
+        $this->port = $this->POP3_PORT;
151 151
     } else {
152
-      $this->port = $port;
152
+        $this->port = $port;
153 153
     }
154 154
 
155 155
     //  If no port value is passed, retrieve it
156 156
     if ($tval == false) {
157
-      $this->tval = $this->POP3_TIMEOUT;
157
+        $this->tval = $this->POP3_TIMEOUT;
158 158
     } else {
159
-      $this->tval = $tval;
159
+        $this->tval = $tval;
160 160
     }
161 161
 
162 162
     $this->do_debug = $debug_level;
@@ -170,13 +170,13 @@  discard block
 block discarded – undo
170 170
     $result = $this->Connect($this->host, $this->port, $this->tval);
171 171
 
172 172
     if ($result) {
173
-      $login_result = $this->Login($this->username, $this->password);
173
+        $login_result = $this->Login($this->username, $this->password);
174 174
 
175
-      if ($login_result) {
175
+        if ($login_result) {
176 176
         $this->Disconnect();
177 177
 
178 178
         return true;
179
-      }
179
+        }
180 180
 
181 181
     }
182 182
 
@@ -184,20 +184,20 @@  discard block
 block discarded – undo
184 184
     $this->Disconnect();
185 185
 
186 186
     return false;
187
-  }
188
-
189
-  /**
190
-   * Connect to the POP3 server
191
-   * @access public
192
-   * @param string $host
193
-   * @param integer $port
194
-   * @param integer $tval
195
-   * @return boolean
196
-   */
197
-  public function Connect ($host, $port = false, $tval = 30) {
187
+    }
188
+
189
+    /**
190
+     * Connect to the POP3 server
191
+     * @access public
192
+     * @param string $host
193
+     * @param integer $port
194
+     * @param integer $tval
195
+     * @return boolean
196
+     */
197
+    public function Connect ($host, $port = false, $tval = 30) {
198 198
     //  Are we already connected?
199 199
     if ($this->connected) {
200
-      return true;
200
+        return true;
201 201
     }
202 202
 
203 203
     /*
@@ -209,45 +209,45 @@  discard block
 block discarded – undo
209 209
 
210 210
     //  Connect to the POP3 server
211 211
     $this->pop_conn = fsockopen($host,    //  POP3 Host
212
-                  $port,    //  Port #
213
-                  $errno,   //  Error Number
214
-                  $errstr,  //  Error Message
215
-                  $tval);   //  Timeout (seconds)
212
+                    $port,    //  Port #
213
+                    $errno,   //  Error Number
214
+                    $errstr,  //  Error Message
215
+                    $tval);   //  Timeout (seconds)
216 216
 
217 217
     //  Restore the error handler
218 218
     restore_error_handler();
219 219
 
220 220
     //  Does the Error Log now contain anything?
221 221
     if ($this->error && $this->do_debug >= 1) {
222
-      $this->displayErrors();
222
+        $this->displayErrors();
223 223
     }
224 224
 
225 225
     //  Did we connect?
226 226
     if ($this->pop_conn == false) {
227
-      //  It would appear not...
228
-      $this->error = array(
227
+        //  It would appear not...
228
+        $this->error = array(
229 229
         'error' => "Failed to connect to server $host on port $port",
230 230
         'errno' => $errno,
231 231
         'errstr' => $errstr
232
-      );
232
+        );
233 233
 
234
-      if ($this->do_debug >= 1) {
234
+        if ($this->do_debug >= 1) {
235 235
         $this->displayErrors();
236
-      }
236
+        }
237 237
 
238
-      return false;
238
+        return false;
239 239
     }
240 240
 
241 241
     //  Increase the stream time-out
242 242
 
243 243
     //  Check for PHP 4.3.0 or later
244 244
     if (version_compare(phpversion(), '5.0.0', 'ge')) {
245
-      stream_set_timeout($this->pop_conn, $tval, 0);
245
+        stream_set_timeout($this->pop_conn, $tval, 0);
246 246
     } else {
247
-      //  Does not work on Windows
248
-      if (substr(PHP_OS, 0, 3) !== 'WIN') {
247
+        //  Does not work on Windows
248
+        if (substr(PHP_OS, 0, 3) !== 'WIN') {
249 249
         socket_set_timeout($this->pop_conn, $tval, 0);
250
-      }
250
+        }
251 251
     }
252 252
 
253 253
     //  Get the POP3 server response
@@ -257,33 +257,33 @@  discard block
 block discarded – undo
257 257
     if ($this->checkResponse($pop3_response)) {
258 258
     //  The connection is established and the POP3 server is talking
259 259
     $this->connected = true;
260
-      return true;
260
+        return true;
261 261
     }
262 262
 
263
-  }
263
+    }
264 264
 
265
-  /**
266
-   * Login to the POP3 server (does not support APOP yet)
267
-   * @access public
268
-   * @param string $username
269
-   * @param string $password
270
-   * @return boolean
271
-   */
272
-  public function Login ($username = '', $password = '') {
265
+    /**
266
+     * Login to the POP3 server (does not support APOP yet)
267
+     * @access public
268
+     * @param string $username
269
+     * @param string $password
270
+     * @return boolean
271
+     */
272
+    public function Login ($username = '', $password = '') {
273 273
     if ($this->connected == false) {
274
-      $this->error = 'Not connected to POP3 server';
274
+        $this->error = 'Not connected to POP3 server';
275 275
 
276
-      if ($this->do_debug >= 1) {
276
+        if ($this->do_debug >= 1) {
277 277
         $this->displayErrors();
278
-      }
278
+        }
279 279
     }
280 280
 
281 281
     if (empty($username)) {
282
-      $username = $this->username;
282
+        $username = $this->username;
283 283
     }
284 284
 
285 285
     if (empty($password)) {
286
-      $password = $this->password;
286
+        $password = $this->password;
287 287
     }
288 288
 
289 289
     $pop_username = "USER $username" . $this->CRLF;
@@ -294,114 +294,114 @@  discard block
 block discarded – undo
294 294
     $pop3_response = $this->getResponse();
295 295
 
296 296
     if ($this->checkResponse($pop3_response)) {
297
-      //  Send the Password
298
-      $this->sendString($pop_password);
299
-      $pop3_response = $this->getResponse();
297
+        //  Send the Password
298
+        $this->sendString($pop_password);
299
+        $pop3_response = $this->getResponse();
300 300
 
301
-      if ($this->checkResponse($pop3_response)) {
301
+        if ($this->checkResponse($pop3_response)) {
302 302
         return true;
303
-      } else {
303
+        } else {
304 304
         return false;
305
-      }
305
+        }
306 306
     } else {
307
-      return false;
307
+        return false;
308
+    }
308 309
     }
309
-  }
310 310
 
311
-  /**
312
-   * Disconnect from the POP3 server
313
-   * @access public
314
-   */
315
-  public function Disconnect () {
311
+    /**
312
+     * Disconnect from the POP3 server
313
+     * @access public
314
+     */
315
+    public function Disconnect () {
316 316
     $this->sendString('QUIT');
317 317
 
318 318
     fclose($this->pop_conn);
319
-  }
320
-
321
-  /////////////////////////////////////////////////
322
-  //  Private Methods
323
-  /////////////////////////////////////////////////
324
-
325
-  /**
326
-   * Get the socket response back.
327
-   * $size is the maximum number of bytes to retrieve
328
-   * @access private
329
-   * @param integer $size
330
-   * @return string
331
-   */
332
-  private function getResponse ($size = 128) {
319
+    }
320
+
321
+    /////////////////////////////////////////////////
322
+    //  Private Methods
323
+    /////////////////////////////////////////////////
324
+
325
+    /**
326
+     * Get the socket response back.
327
+     * $size is the maximum number of bytes to retrieve
328
+     * @access private
329
+     * @param integer $size
330
+     * @return string
331
+     */
332
+    private function getResponse ($size = 128) {
333 333
     $pop3_response = fgets($this->pop_conn, $size);
334 334
 
335 335
     return $pop3_response;
336
-  }
337
-
338
-  /**
339
-   * Send a string down the open socket connection to the POP3 server
340
-   * @access private
341
-   * @param string $string
342
-   * @return integer
343
-   */
344
-  private function sendString ($string) {
336
+    }
337
+
338
+    /**
339
+     * Send a string down the open socket connection to the POP3 server
340
+     * @access private
341
+     * @param string $string
342
+     * @return integer
343
+     */
344
+    private function sendString ($string) {
345 345
     $bytes_sent = fwrite($this->pop_conn, $string, strlen($string));
346 346
 
347 347
     return $bytes_sent;
348
-  }
349
-
350
-  /**
351
-   * Checks the POP3 server response for +OK or -ERR
352
-   * @access private
353
-   * @param string $string
354
-   * @return boolean
355
-   */
356
-  private function checkResponse ($string) {
348
+    }
349
+
350
+    /**
351
+     * Checks the POP3 server response for +OK or -ERR
352
+     * @access private
353
+     * @param string $string
354
+     * @return boolean
355
+     */
356
+    private function checkResponse ($string) {
357 357
     if (substr($string, 0, 3) !== '+OK') {
358
-      $this->error = array(
358
+        $this->error = array(
359 359
         'error' => "Server reported an error: $string",
360 360
         'errno' => 0,
361 361
         'errstr' => ''
362
-      );
362
+        );
363 363
 
364
-      if ($this->do_debug >= 1) {
364
+        if ($this->do_debug >= 1) {
365 365
         $this->displayErrors();
366
-      }
366
+        }
367 367
 
368
-      return false;
368
+        return false;
369 369
     } else {
370
-      return true;
370
+        return true;
371 371
     }
372 372
 
373
-  }
373
+    }
374 374
 
375
-  /**
376
-   * If debug is enabled, display the error message array
377
-   * @access private
378
-   */
379
-  private function displayErrors () {
375
+    /**
376
+     * If debug is enabled, display the error message array
377
+     * @access private
378
+     */
379
+    private function displayErrors () {
380 380
     echo '<pre>';
381 381
 
382 382
     foreach ($this->error as $single_error) {
383
-      print_r($single_error);
383
+        print_r($single_error);
384 384
     }
385 385
 
386 386
     echo '</pre>';
387
-  }
388
-
389
-  /**
390
-   * Takes over from PHP for the socket warning handler
391
-   * @access private
392
-   * @param integer $errno
393
-   * @param string $errstr
394
-   * @param string $errfile
395
-   * @param integer $errline
396
-   */
397
-  private function catchWarning ($errno, $errstr, $errfile, $errline) {
387
+    }
388
+
389
+    /**
390
+     * Takes over from PHP for the socket warning handler
391
+     * @access private
392
+     * @param integer $errno
393
+     * @param string $errstr
394
+     * @param string $errfile
395
+     * @param integer $errline
396
+     */
397
+    private function catchWarning ($errno, $errstr, $errfile, $errline) {
398 398
     $this->error[] = array(
399
-      'error' => "Connecting to the POP3 server raised a PHP warning: ",
400
-      'errno' => $errno,
401
-      'errstr' => $errstr
399
+        'error' => "Connecting to the POP3 server raised a PHP warning: ",
400
+        'errno' => $errno,
401
+        'errstr' => $errstr
402 402
     );
403
-  }
403
+    }
404 404
 
405
-  //  End of class
405
+    //  End of class
406 406
 }
407 407
 ?>
408 408
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 
121 121
   private $pop_conn;
122 122
   private $connected;
123
-  private $error;     //  Error log array
123
+  private $error; //  Error log array
124 124
 
125 125
   /**
126 126
    * Constructor, sets the initial values
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
    * @param string $username
143 143
    * @param string $password
144 144
    */
145
-  public function Authorise ($host, $port = false, $tval = false, $username, $password, $debug_level = 0) {
145
+  public function Authorise($host, $port = false, $tval = false, $username, $password, $debug_level = 0) {
146 146
     $this->host = $host;
147 147
 
148 148
     //  If no port value is passed, retrieve it
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
    * @param integer $tval
195 195
    * @return boolean
196 196
    */
197
-  public function Connect ($host, $port = false, $tval = 30) {
197
+  public function Connect($host, $port = false, $tval = 30) {
198 198
     //  Are we already connected?
199 199
     if ($this->connected) {
200 200
       return true;
@@ -208,11 +208,11 @@  discard block
 block discarded – undo
208 208
     set_error_handler(array(&$this, 'catchWarning'));
209 209
 
210 210
     //  Connect to the POP3 server
211
-    $this->pop_conn = fsockopen($host,    //  POP3 Host
212
-                  $port,    //  Port #
213
-                  $errno,   //  Error Number
214
-                  $errstr,  //  Error Message
215
-                  $tval);   //  Timeout (seconds)
211
+    $this->pop_conn = fsockopen($host, //  POP3 Host
212
+                  $port, //  Port #
213
+                  $errno, //  Error Number
214
+                  $errstr, //  Error Message
215
+                  $tval); //  Timeout (seconds)
216 216
 
217 217
     //  Restore the error handler
218 218
     restore_error_handler();
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
    * @param string $password
270 270
    * @return boolean
271 271
    */
272
-  public function Login ($username = '', $password = '') {
272
+  public function Login($username = '', $password = '') {
273 273
     if ($this->connected == false) {
274 274
       $this->error = 'Not connected to POP3 server';
275 275
 
@@ -286,8 +286,8 @@  discard block
 block discarded – undo
286 286
       $password = $this->password;
287 287
     }
288 288
 
289
-    $pop_username = "USER $username" . $this->CRLF;
290
-    $pop_password = "PASS $password" . $this->CRLF;
289
+    $pop_username = "USER $username".$this->CRLF;
290
+    $pop_password = "PASS $password".$this->CRLF;
291 291
 
292 292
     //  Send the Username
293 293
     $this->sendString($pop_username);
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
    * Disconnect from the POP3 server
313 313
    * @access public
314 314
    */
315
-  public function Disconnect () {
315
+  public function Disconnect() {
316 316
     $this->sendString('QUIT');
317 317
 
318 318
     fclose($this->pop_conn);
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
    * @param integer $size
330 330
    * @return string
331 331
    */
332
-  private function getResponse ($size = 128) {
332
+  private function getResponse($size = 128) {
333 333
     $pop3_response = fgets($this->pop_conn, $size);
334 334
 
335 335
     return $pop3_response;
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
    * @param string $string
342 342
    * @return integer
343 343
    */
344
-  private function sendString ($string) {
344
+  private function sendString($string) {
345 345
     $bytes_sent = fwrite($this->pop_conn, $string, strlen($string));
346 346
 
347 347
     return $bytes_sent;
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
    * @param string $string
354 354
    * @return boolean
355 355
    */
356
-  private function checkResponse ($string) {
356
+  private function checkResponse($string) {
357 357
     if (substr($string, 0, 3) !== '+OK') {
358 358
       $this->error = array(
359 359
         'error' => "Server reported an error: $string",
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
    * If debug is enabled, display the error message array
377 377
    * @access private
378 378
    */
379
-  private function displayErrors () {
379
+  private function displayErrors() {
380 380
     echo '<pre>';
381 381
 
382 382
     foreach ($this->error as $single_error) {
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
    * @param string $errfile
395 395
    * @param integer $errline
396 396
    */
397
-  private function catchWarning ($errno, $errstr, $errfile, $errline) {
397
+  private function catchWarning($errno, $errstr, $errfile, $errline) {
398 398
     $this->error[] = array(
399 399
       'error' => "Connecting to the POP3 server raised a PHP warning: ",
400 400
       'errno' => $errno,
Please login to merge, or discard this patch.
main/inc/lib/phpmailer/class.smtp.php 4 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -321,6 +321,7 @@  discard block
 block discarded – undo
321 321
    * SMTP CODE FAILURE: 451,554
322 322
    * SMTP CODE ERROR  : 500,501,503,421
323 323
    * @access public
324
+   * @param string $msg_data
324 325
    * @return bool
325 326
    */
326 327
   public function Data($msg_data) {
@@ -488,6 +489,8 @@  discard block
 block discarded – undo
488 489
   /**
489 490
    * Sends a HELO/EHLO command.
490 491
    * @access private
492
+   * @param string $hello
493
+   * @param string $host
491 494
    * @return bool
492 495
    */
493 496
   private function SendHello($hello, $host) {
@@ -528,6 +531,7 @@  discard block
 block discarded – undo
528 531
    * SMTP CODE SUCCESS: 552,451,452
529 532
    * SMTP CODE SUCCESS: 500,501,421
530 533
    * @access public
534
+   * @param string $from
531 535
    * @return bool
532 536
    */
533 537
   public function Mail($from) {
Please login to merge, or discard this patch.
Indentation   +429 added lines, -429 removed lines patch added patch discarded remove patch
@@ -47,130 +47,130 @@  discard block
 block discarded – undo
47 47
  */
48 48
 
49 49
 class SMTP {
50
-  /**
51
-   *  SMTP server port
52
-   *  @var int
53
-   */
54
-  public $SMTP_PORT = 25;
55
-
56
-  /**
57
-   *  SMTP reply line ending
58
-   *  @var string
59
-   */
60
-  public $CRLF = "\r\n";
61
-
62
-  /**
63
-   *  Sets whether debugging is turned on
64
-   *  @var bool
65
-   */
66
-  public $do_debug;       // the level of debug to perform
67
-
68
-  /**
69
-   *  Sets VERP use on/off (default is off)
70
-   *  @var bool
71
-   */
72
-  public $do_verp = false;
73
-
74
-  /////////////////////////////////////////////////
75
-  // PROPERTIES, PRIVATE AND PROTECTED
76
-  /////////////////////////////////////////////////
77
-
78
-  private $smtp_conn; // the socket to the server
79
-  private $error;     // error if any on the last call
80
-  private $helo_rply; // the reply the server sent to us for HELO
81
-
82
-  /**
83
-   * Initialize the class so that the data is in a known state.
84
-   * @access public
85
-   * @return void
86
-   */
87
-  public function __construct() {
50
+    /**
51
+     *  SMTP server port
52
+     *  @var int
53
+     */
54
+    public $SMTP_PORT = 25;
55
+
56
+    /**
57
+     *  SMTP reply line ending
58
+     *  @var string
59
+     */
60
+    public $CRLF = "\r\n";
61
+
62
+    /**
63
+     *  Sets whether debugging is turned on
64
+     *  @var bool
65
+     */
66
+    public $do_debug;       // the level of debug to perform
67
+
68
+    /**
69
+     *  Sets VERP use on/off (default is off)
70
+     *  @var bool
71
+     */
72
+    public $do_verp = false;
73
+
74
+    /////////////////////////////////////////////////
75
+    // PROPERTIES, PRIVATE AND PROTECTED
76
+    /////////////////////////////////////////////////
77
+
78
+    private $smtp_conn; // the socket to the server
79
+    private $error;     // error if any on the last call
80
+    private $helo_rply; // the reply the server sent to us for HELO
81
+
82
+    /**
83
+     * Initialize the class so that the data is in a known state.
84
+     * @access public
85
+     * @return void
86
+     */
87
+    public function __construct() {
88 88
     $this->smtp_conn = 0;
89 89
     $this->error = null;
90 90
     $this->helo_rply = null;
91 91
 
92 92
     $this->do_debug = 0;
93
-  }
94
-
95
-  /////////////////////////////////////////////////
96
-  // CONNECTION FUNCTIONS
97
-  /////////////////////////////////////////////////
98
-
99
-  /**
100
-   * Connect to the server specified on the port specified.
101
-   * If the port is not specified use the default SMTP_PORT.
102
-   * If tval is specified then a connection will try and be
103
-   * established with the server for that number of seconds.
104
-   * If tval is not specified the default is 30 seconds to
105
-   * try on the connection.
106
-   *
107
-   * SMTP CODE SUCCESS: 220
108
-   * SMTP CODE FAILURE: 421
109
-   * @access public
110
-   * @return bool
111
-   */
112
-  public function Connect($host, $port = 0, $tval = 30) {
93
+    }
94
+
95
+    /////////////////////////////////////////////////
96
+    // CONNECTION FUNCTIONS
97
+    /////////////////////////////////////////////////
98
+
99
+    /**
100
+     * Connect to the server specified on the port specified.
101
+     * If the port is not specified use the default SMTP_PORT.
102
+     * If tval is specified then a connection will try and be
103
+     * established with the server for that number of seconds.
104
+     * If tval is not specified the default is 30 seconds to
105
+     * try on the connection.
106
+     *
107
+     * SMTP CODE SUCCESS: 220
108
+     * SMTP CODE FAILURE: 421
109
+     * @access public
110
+     * @return bool
111
+     */
112
+    public function Connect($host, $port = 0, $tval = 30) {
113 113
     // set the error val to null so there is no confusion
114 114
     $this->error = null;
115 115
 
116 116
     // make sure we are __not__ connected
117 117
     if($this->connected()) {
118
-      // already connected, generate error
119
-      $this->error = array("error" => "Already connected to a server");
120
-      return false;
118
+        // already connected, generate error
119
+        $this->error = array("error" => "Already connected to a server");
120
+        return false;
121 121
     }
122 122
 
123 123
     if(empty($port)) {
124
-      $port = $this->SMTP_PORT;
124
+        $port = $this->SMTP_PORT;
125 125
     }
126 126
 
127 127
     // connect to the smtp server
128 128
     $this->smtp_conn = @fsockopen($host,    // the host of the server
129
-                                 $port,    // the port to use
130
-                                 $errno,   // error number if any
131
-                                 $errstr,  // error message if any
132
-                                 $tval);   // give up after ? secs
129
+                                    $port,    // the port to use
130
+                                    $errno,   // error number if any
131
+                                    $errstr,  // error message if any
132
+                                    $tval);   // give up after ? secs
133 133
     // verify we connected properly
134 134
     if(empty($this->smtp_conn)) {
135
-      $this->error = array("error" => "Failed to connect to server",
136
-                           "errno" => $errno,
137
-                           "errstr" => $errstr);
138
-      if($this->do_debug >= 1) {
135
+        $this->error = array("error" => "Failed to connect to server",
136
+                            "errno" => $errno,
137
+                            "errstr" => $errstr);
138
+        if($this->do_debug >= 1) {
139 139
         echo "SMTP -> ERROR: " . $this->error["error"] . ": $errstr ($errno)" . $this->CRLF . '<br />';
140
-      }
141
-      return false;
140
+        }
141
+        return false;
142 142
     }
143 143
 
144 144
     // SMTP server can take longer to respond, give longer timeout for first read
145 145
     // Windows does not have support for this timeout function
146 146
     if(substr(PHP_OS, 0, 3) != "WIN")
147
-     socket_set_timeout($this->smtp_conn, $tval, 0);
147
+        socket_set_timeout($this->smtp_conn, $tval, 0);
148 148
 
149 149
     // get any announcement
150 150
     $announce = $this->get_lines();
151 151
 
152 152
     if($this->do_debug >= 2) {
153
-      echo "SMTP -> FROM SERVER:" . $announce . $this->CRLF . '<br />';
153
+        echo "SMTP -> FROM SERVER:" . $announce . $this->CRLF . '<br />';
154 154
     }
155 155
 
156 156
     return true;
157
-  }
158
-
159
-  /**
160
-   * Initiate a TLS communication with the server.
161
-   *
162
-   * SMTP CODE 220 Ready to start TLS
163
-   * SMTP CODE 501 Syntax error (no parameters allowed)
164
-   * SMTP CODE 454 TLS not available due to temporary reason
165
-   * @access public
166
-   * @return bool success
167
-   */
168
-  public function StartTLS() {
157
+    }
158
+
159
+    /**
160
+     * Initiate a TLS communication with the server.
161
+     *
162
+     * SMTP CODE 220 Ready to start TLS
163
+     * SMTP CODE 501 Syntax error (no parameters allowed)
164
+     * SMTP CODE 454 TLS not available due to temporary reason
165
+     * @access public
166
+     * @return bool success
167
+     */
168
+    public function StartTLS() {
169 169
     $this->error = null; # to avoid confusion
170 170
 
171 171
     if(!$this->connected()) {
172
-      $this->error = array("error" => "Called StartTLS() without being connected");
173
-      return false;
172
+        $this->error = array("error" => "Called StartTLS() without being connected");
173
+        return false;
174 174
     }
175 175
 
176 176
     fputs($this->smtp_conn,"STARTTLS" . $this->CRLF);
@@ -179,35 +179,35 @@  discard block
 block discarded – undo
179 179
     $code = substr($rply,0,3);
180 180
 
181 181
     if($this->do_debug >= 2) {
182
-      echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
182
+        echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
183 183
     }
184 184
 
185 185
     if($code != 220) {
186
-      $this->error =
187
-         array("error"     => "STARTTLS not accepted from server",
188
-               "smtp_code" => $code,
189
-               "smtp_msg"  => substr($rply,4));
190
-      if($this->do_debug >= 1) {
186
+        $this->error =
187
+            array("error"     => "STARTTLS not accepted from server",
188
+                "smtp_code" => $code,
189
+                "smtp_msg"  => substr($rply,4));
190
+        if($this->do_debug >= 1) {
191 191
         echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
192
-      }
193
-      return false;
192
+        }
193
+        return false;
194 194
     }
195 195
 
196 196
     // Begin encrypted connection
197 197
     if(!stream_socket_enable_crypto($this->smtp_conn, true, STREAM_CRYPTO_METHOD_TLS_CLIENT)) {
198
-      return false;
198
+        return false;
199 199
     }
200 200
 
201 201
     return true;
202
-  }
203
-
204
-  /**
205
-   * Performs SMTP authentication.  Must be run after running the
206
-   * Hello() method.  Returns true if successfully authenticated.
207
-   * @access public
208
-   * @return bool
209
-   */
210
-  public function Authenticate($username, $password) {
202
+    }
203
+
204
+    /**
205
+     * Performs SMTP authentication.  Must be run after running the
206
+     * Hello() method.  Returns true if successfully authenticated.
207
+     * @access public
208
+     * @return bool
209
+     */
210
+    public function Authenticate($username, $password) {
211 211
     // Start authentication
212 212
     fputs($this->smtp_conn,"AUTH LOGIN" . $this->CRLF);
213 213
 
@@ -215,14 +215,14 @@  discard block
 block discarded – undo
215 215
     $code = substr($rply,0,3);
216 216
 
217 217
     if($code != 334) {
218
-      $this->error =
218
+        $this->error =
219 219
         array("error" => "AUTH not accepted from server",
220
-              "smtp_code" => $code,
221
-              "smtp_msg" => substr($rply,4));
222
-      if($this->do_debug >= 1) {
220
+                "smtp_code" => $code,
221
+                "smtp_msg" => substr($rply,4));
222
+        if($this->do_debug >= 1) {
223 223
         echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
224
-      }
225
-      return false;
224
+        }
225
+        return false;
226 226
     }
227 227
 
228 228
     // Send encoded username
@@ -232,14 +232,14 @@  discard block
 block discarded – undo
232 232
     $code = substr($rply,0,3);
233 233
 
234 234
     if($code != 334) {
235
-      $this->error =
235
+        $this->error =
236 236
         array("error" => "Username not accepted from server",
237
-              "smtp_code" => $code,
238
-              "smtp_msg" => substr($rply,4));
239
-      if($this->do_debug >= 1) {
237
+                "smtp_code" => $code,
238
+                "smtp_msg" => substr($rply,4));
239
+        if($this->do_debug >= 1) {
240 240
         echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
241
-      }
242
-      return false;
241
+        }
242
+        return false;
243 243
     }
244 244
 
245 245
     // Send encoded password
@@ -249,87 +249,87 @@  discard block
 block discarded – undo
249 249
     $code = substr($rply,0,3);
250 250
 
251 251
     if($code != 235) {
252
-      $this->error =
252
+        $this->error =
253 253
         array("error" => "Password not accepted from server",
254
-              "smtp_code" => $code,
255
-              "smtp_msg" => substr($rply,4));
256
-      if($this->do_debug >= 1) {
254
+                "smtp_code" => $code,
255
+                "smtp_msg" => substr($rply,4));
256
+        if($this->do_debug >= 1) {
257 257
         echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
258
-      }
259
-      return false;
258
+        }
259
+        return false;
260 260
     }
261 261
 
262 262
     return true;
263
-  }
264
-
265
-  /**
266
-   * Returns true if connected to a server otherwise false
267
-   * @access public
268
-   * @return bool
269
-   */
270
-  public function Connected() {
263
+    }
264
+
265
+    /**
266
+     * Returns true if connected to a server otherwise false
267
+     * @access public
268
+     * @return bool
269
+     */
270
+    public function Connected() {
271 271
     if(!empty($this->smtp_conn)) {
272
-      $sock_status = socket_get_status($this->smtp_conn);
273
-      if($sock_status["eof"]) {
272
+        $sock_status = socket_get_status($this->smtp_conn);
273
+        if($sock_status["eof"]) {
274 274
         // the socket is valid but we are not connected
275 275
         if($this->do_debug >= 1) {
276 276
             echo "SMTP -> NOTICE:" . $this->CRLF . "EOF caught while checking if connected";
277 277
         }
278 278
         $this->Close();
279 279
         return false;
280
-      }
281
-      return true; // everything looks good
280
+        }
281
+        return true; // everything looks good
282 282
     }
283 283
     return false;
284
-  }
285
-
286
-  /**
287
-   * Closes the socket and cleans up the state of the class.
288
-   * It is not considered good to use this function without
289
-   * first trying to use QUIT.
290
-   * @access public
291
-   * @return void
292
-   */
293
-  public function Close() {
284
+    }
285
+
286
+    /**
287
+     * Closes the socket and cleans up the state of the class.
288
+     * It is not considered good to use this function without
289
+     * first trying to use QUIT.
290
+     * @access public
291
+     * @return void
292
+     */
293
+    public function Close() {
294 294
     $this->error = null; // so there is no confusion
295 295
     $this->helo_rply = null;
296 296
     if(!empty($this->smtp_conn)) {
297
-      // close the connection and cleanup
298
-      fclose($this->smtp_conn);
299
-      $this->smtp_conn = 0;
300
-    }
301
-  }
302
-
303
-  /////////////////////////////////////////////////
304
-  // SMTP COMMANDS
305
-  /////////////////////////////////////////////////
306
-
307
-  /**
308
-   * Issues a data command and sends the msg_data to the server
309
-   * finializing the mail transaction. $msg_data is the message
310
-   * that is to be send with the headers. Each header needs to be
311
-   * on a single line followed by a <CRLF> with the message headers
312
-   * and the message body being seperated by and additional <CRLF>.
313
-   *
314
-   * Implements rfc 821: DATA <CRLF>
315
-   *
316
-   * SMTP CODE INTERMEDIATE: 354
317
-   *     [data]
318
-   *     <CRLF>.<CRLF>
319
-   *     SMTP CODE SUCCESS: 250
320
-   *     SMTP CODE FAILURE: 552,554,451,452
321
-   * SMTP CODE FAILURE: 451,554
322
-   * SMTP CODE ERROR  : 500,501,503,421
323
-   * @access public
324
-   * @return bool
325
-   */
326
-  public function Data($msg_data) {
297
+        // close the connection and cleanup
298
+        fclose($this->smtp_conn);
299
+        $this->smtp_conn = 0;
300
+    }
301
+    }
302
+
303
+    /////////////////////////////////////////////////
304
+    // SMTP COMMANDS
305
+    /////////////////////////////////////////////////
306
+
307
+    /**
308
+     * Issues a data command and sends the msg_data to the server
309
+     * finializing the mail transaction. $msg_data is the message
310
+     * that is to be send with the headers. Each header needs to be
311
+     * on a single line followed by a <CRLF> with the message headers
312
+     * and the message body being seperated by and additional <CRLF>.
313
+     *
314
+     * Implements rfc 821: DATA <CRLF>
315
+     *
316
+     * SMTP CODE INTERMEDIATE: 354
317
+     *     [data]
318
+     *     <CRLF>.<CRLF>
319
+     *     SMTP CODE SUCCESS: 250
320
+     *     SMTP CODE FAILURE: 552,554,451,452
321
+     * SMTP CODE FAILURE: 451,554
322
+     * SMTP CODE ERROR  : 500,501,503,421
323
+     * @access public
324
+     * @return bool
325
+     */
326
+    public function Data($msg_data) {
327 327
     $this->error = null; // so no confusion is caused
328 328
 
329 329
     if(!$this->connected()) {
330
-      $this->error = array(
331
-              "error" => "Called Data() without being connected");
332
-      return false;
330
+        $this->error = array(
331
+                "error" => "Called Data() without being connected");
332
+        return false;
333 333
     }
334 334
 
335 335
     fputs($this->smtp_conn,"DATA" . $this->CRLF);
@@ -338,18 +338,18 @@  discard block
 block discarded – undo
338 338
     $code = substr($rply,0,3);
339 339
 
340 340
     if($this->do_debug >= 2) {
341
-      echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
341
+        echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
342 342
     }
343 343
 
344 344
     if($code != 354) {
345
-      $this->error =
345
+        $this->error =
346 346
         array("error" => "DATA command not accepted from server",
347
-              "smtp_code" => $code,
348
-              "smtp_msg" => substr($rply,4));
349
-      if($this->do_debug >= 1) {
347
+                "smtp_code" => $code,
348
+                "smtp_msg" => substr($rply,4));
349
+        if($this->do_debug >= 1) {
350 350
         echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
351
-      }
352
-      return false;
351
+        }
352
+        return false;
353 353
     }
354 354
 
355 355
     /* the server is ready to accept data!
@@ -380,49 +380,49 @@  discard block
 block discarded – undo
380 380
     $field = substr($lines[0],0,strpos($lines[0],":"));
381 381
     $in_headers = false;
382 382
     if(!empty($field) && !strstr($field," ")) {
383
-      $in_headers = true;
383
+        $in_headers = true;
384 384
     }
385 385
 
386 386
     $max_line_length = 998; // used below; set here for ease in change
387 387
 
388 388
     while(list(,$line) = @each($lines)) {
389
-      $lines_out = null;
390
-      if($line == "" && $in_headers) {
389
+        $lines_out = null;
390
+        if($line == "" && $in_headers) {
391 391
         $in_headers = false;
392
-      }
393
-      // ok we need to break this line up into several smaller lines
394
-      while(strlen($line) > $max_line_length) {
392
+        }
393
+        // ok we need to break this line up into several smaller lines
394
+        while(strlen($line) > $max_line_length) {
395 395
         $pos = strrpos(substr($line,0,$max_line_length)," ");
396 396
 
397 397
         // Patch to fix DOS attack
398 398
         if(!$pos) {
399
-          $pos = $max_line_length - 1;
400
-          $lines_out[] = substr($line,0,$pos);
401
-          $line = substr($line,$pos);
399
+            $pos = $max_line_length - 1;
400
+            $lines_out[] = substr($line,0,$pos);
401
+            $line = substr($line,$pos);
402 402
         } else {
403
-          $lines_out[] = substr($line,0,$pos);
404
-          $line = substr($line,$pos + 1);
403
+            $lines_out[] = substr($line,0,$pos);
404
+            $line = substr($line,$pos + 1);
405 405
         }
406 406
 
407 407
         /* if processing headers add a LWSP-char to the front of new line
408 408
          * rfc 822 on long msg headers
409 409
          */
410 410
         if($in_headers) {
411
-          $line = "\t" . $line;
411
+            $line = "\t" . $line;
412 412
         }
413
-      }
414
-      $lines_out[] = $line;
413
+        }
414
+        $lines_out[] = $line;
415 415
 
416
-      // send the lines to the server
417
-      while(list(,$line_out) = @each($lines_out)) {
416
+        // send the lines to the server
417
+        while(list(,$line_out) = @each($lines_out)) {
418 418
         if(strlen($line_out) > 0)
419 419
         {
420
-          if(substr($line_out, 0, 1) == ".") {
420
+            if(substr($line_out, 0, 1) == ".") {
421 421
             $line_out = "." . $line_out;
422
-          }
422
+            }
423 423
         }
424 424
         fputs($this->smtp_conn,$line_out . $this->CRLF);
425
-      }
425
+        }
426 426
     }
427 427
 
428 428
     // message data has been sent
@@ -432,111 +432,111 @@  discard block
 block discarded – undo
432 432
     $code = substr($rply,0,3);
433 433
 
434 434
     if($this->do_debug >= 2) {
435
-      echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
435
+        echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
436 436
     }
437 437
 
438 438
     if($code != 250) {
439
-      $this->error =
439
+        $this->error =
440 440
         array("error" => "DATA not accepted from server",
441
-              "smtp_code" => $code,
442
-              "smtp_msg" => substr($rply,4));
443
-      if($this->do_debug >= 1) {
441
+                "smtp_code" => $code,
442
+                "smtp_msg" => substr($rply,4));
443
+        if($this->do_debug >= 1) {
444 444
         echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
445
-      }
446
-      return false;
445
+        }
446
+        return false;
447 447
     }
448 448
     return true;
449
-  }
450
-
451
-  /**
452
-   * Sends the HELO command to the smtp server.
453
-   * This makes sure that we and the server are in
454
-   * the same known state.
455
-   *
456
-   * Implements from rfc 821: HELO <SP> <domain> <CRLF>
457
-   *
458
-   * SMTP CODE SUCCESS: 250
459
-   * SMTP CODE ERROR  : 500, 501, 504, 421
460
-   * @access public
461
-   * @return bool
462
-   */
463
-  public function Hello($host = '') {
449
+    }
450
+
451
+    /**
452
+     * Sends the HELO command to the smtp server.
453
+     * This makes sure that we and the server are in
454
+     * the same known state.
455
+     *
456
+     * Implements from rfc 821: HELO <SP> <domain> <CRLF>
457
+     *
458
+     * SMTP CODE SUCCESS: 250
459
+     * SMTP CODE ERROR  : 500, 501, 504, 421
460
+     * @access public
461
+     * @return bool
462
+     */
463
+    public function Hello($host = '') {
464 464
     $this->error = null; // so no confusion is caused
465 465
 
466 466
     if(!$this->connected()) {
467
-      $this->error = array(
467
+        $this->error = array(
468 468
             "error" => "Called Hello() without being connected");
469
-      return false;
469
+        return false;
470 470
     }
471 471
 
472 472
     // if hostname for HELO was not specified send default
473 473
     if(empty($host)) {
474
-      // determine appropriate default to send to server
475
-      $host = "localhost";
474
+        // determine appropriate default to send to server
475
+        $host = "localhost";
476 476
     }
477 477
 
478 478
     // Send extended hello first (RFC 2821)
479 479
     if(!$this->SendHello("EHLO", $host)) {
480
-      if(!$this->SendHello("HELO", $host)) {
480
+        if(!$this->SendHello("HELO", $host)) {
481 481
         return false;
482
-      }
482
+        }
483 483
     }
484 484
 
485 485
     return true;
486
-  }
487
-
488
-  /**
489
-   * Sends a HELO/EHLO command.
490
-   * @access private
491
-   * @return bool
492
-   */
493
-  private function SendHello($hello, $host) {
486
+    }
487
+
488
+    /**
489
+     * Sends a HELO/EHLO command.
490
+     * @access private
491
+     * @return bool
492
+     */
493
+    private function SendHello($hello, $host) {
494 494
     fputs($this->smtp_conn, $hello . " " . $host . $this->CRLF);
495 495
 
496 496
     $rply = $this->get_lines();
497 497
     $code = substr($rply,0,3);
498 498
 
499 499
     if($this->do_debug >= 2) {
500
-      echo "SMTP -> FROM SERVER: " . $rply . $this->CRLF . '<br />';
500
+        echo "SMTP -> FROM SERVER: " . $rply . $this->CRLF . '<br />';
501 501
     }
502 502
 
503 503
     if($code != 250) {
504
-      $this->error =
504
+        $this->error =
505 505
         array("error" => $hello . " not accepted from server",
506
-              "smtp_code" => $code,
507
-              "smtp_msg" => substr($rply,4));
508
-      if($this->do_debug >= 1) {
506
+                "smtp_code" => $code,
507
+                "smtp_msg" => substr($rply,4));
508
+        if($this->do_debug >= 1) {
509 509
         echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
510
-      }
511
-      return false;
510
+        }
511
+        return false;
512 512
     }
513 513
 
514 514
     $this->helo_rply = $rply;
515 515
 
516 516
     return true;
517
-  }
518
-
519
-  /**
520
-   * Starts a mail transaction from the email address specified in
521
-   * $from. Returns true if successful or false otherwise. If True
522
-   * the mail transaction is started and then one or more Recipient
523
-   * commands may be called followed by a Data command.
524
-   *
525
-   * Implements rfc 821: MAIL <SP> FROM:<reverse-path> <CRLF>
526
-   *
527
-   * SMTP CODE SUCCESS: 250
528
-   * SMTP CODE SUCCESS: 552,451,452
529
-   * SMTP CODE SUCCESS: 500,501,421
530
-   * @access public
531
-   * @return bool
532
-   */
533
-  public function Mail($from) {
517
+    }
518
+
519
+    /**
520
+     * Starts a mail transaction from the email address specified in
521
+     * $from. Returns true if successful or false otherwise. If True
522
+     * the mail transaction is started and then one or more Recipient
523
+     * commands may be called followed by a Data command.
524
+     *
525
+     * Implements rfc 821: MAIL <SP> FROM:<reverse-path> <CRLF>
526
+     *
527
+     * SMTP CODE SUCCESS: 250
528
+     * SMTP CODE SUCCESS: 552,451,452
529
+     * SMTP CODE SUCCESS: 500,501,421
530
+     * @access public
531
+     * @return bool
532
+     */
533
+    public function Mail($from) {
534 534
     $this->error = null; // so no confusion is caused
535 535
 
536 536
     if(!$this->connected()) {
537
-      $this->error = array(
538
-              "error" => "Called Mail() without being connected");
539
-      return false;
537
+        $this->error = array(
538
+                "error" => "Called Mail() without being connected");
539
+        return false;
540 540
     }
541 541
 
542 542
     $useVerp = ($this->do_verp ? "XVERP" : "");
@@ -546,40 +546,40 @@  discard block
 block discarded – undo
546 546
     $code = substr($rply,0,3);
547 547
 
548 548
     if($this->do_debug >= 2) {
549
-      echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
549
+        echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
550 550
     }
551 551
 
552 552
     if($code != 250) {
553
-      $this->error =
553
+        $this->error =
554 554
         array("error" => "MAIL not accepted from server",
555
-              "smtp_code" => $code,
556
-              "smtp_msg" => substr($rply,4));
557
-      if($this->do_debug >= 1) {
555
+                "smtp_code" => $code,
556
+                "smtp_msg" => substr($rply,4));
557
+        if($this->do_debug >= 1) {
558 558
         echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
559
-      }
560
-      return false;
559
+        }
560
+        return false;
561 561
     }
562 562
     return true;
563
-  }
564
-
565
-  /**
566
-   * Sends the quit command to the server and then closes the socket
567
-   * if there is no error or the $close_on_error argument is true.
568
-   *
569
-   * Implements from rfc 821: QUIT <CRLF>
570
-   *
571
-   * SMTP CODE SUCCESS: 221
572
-   * SMTP CODE ERROR  : 500
573
-   * @access public
574
-   * @return bool
575
-   */
576
-  public function Quit($close_on_error = true) {
563
+    }
564
+
565
+    /**
566
+     * Sends the quit command to the server and then closes the socket
567
+     * if there is no error or the $close_on_error argument is true.
568
+     *
569
+     * Implements from rfc 821: QUIT <CRLF>
570
+     *
571
+     * SMTP CODE SUCCESS: 221
572
+     * SMTP CODE ERROR  : 500
573
+     * @access public
574
+     * @return bool
575
+     */
576
+    public function Quit($close_on_error = true) {
577 577
     $this->error = null; // so there is no confusion
578 578
 
579 579
     if(!$this->connected()) {
580
-      $this->error = array(
581
-              "error" => "Called Quit() without being connected");
582
-      return false;
580
+        $this->error = array(
581
+                "error" => "Called Quit() without being connected");
582
+        return false;
583 583
     }
584 584
 
585 585
     // send the quit command to the server
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
     $byemsg = $this->get_lines();
590 590
 
591 591
     if($this->do_debug >= 2) {
592
-      echo "SMTP -> FROM SERVER:" . $byemsg . $this->CRLF . '<br />';
592
+        echo "SMTP -> FROM SERVER:" . $byemsg . $this->CRLF . '<br />';
593 593
     }
594 594
 
595 595
     $rval = true;
@@ -597,42 +597,42 @@  discard block
 block discarded – undo
597 597
 
598 598
     $code = substr($byemsg,0,3);
599 599
     if($code != 221) {
600
-      // use e as a tmp var cause Close will overwrite $this->error
601
-      $e = array("error" => "SMTP server rejected quit command",
602
-                 "smtp_code" => $code,
603
-                 "smtp_rply" => substr($byemsg,4));
604
-      $rval = false;
605
-      if($this->do_debug >= 1) {
600
+        // use e as a tmp var cause Close will overwrite $this->error
601
+        $e = array("error" => "SMTP server rejected quit command",
602
+                    "smtp_code" => $code,
603
+                    "smtp_rply" => substr($byemsg,4));
604
+        $rval = false;
605
+        if($this->do_debug >= 1) {
606 606
         echo "SMTP -> ERROR: " . $e["error"] . ": " . $byemsg . $this->CRLF . '<br />';
607
-      }
607
+        }
608 608
     }
609 609
 
610 610
     if(empty($e) || $close_on_error) {
611
-      $this->Close();
611
+        $this->Close();
612 612
     }
613 613
 
614 614
     return $rval;
615
-  }
616
-
617
-  /**
618
-   * Sends the command RCPT to the SMTP server with the TO: argument of $to.
619
-   * Returns true if the recipient was accepted false if it was rejected.
620
-   *
621
-   * Implements from rfc 821: RCPT <SP> TO:<forward-path> <CRLF>
622
-   *
623
-   * SMTP CODE SUCCESS: 250,251
624
-   * SMTP CODE FAILURE: 550,551,552,553,450,451,452
625
-   * SMTP CODE ERROR  : 500,501,503,421
626
-   * @access public
627
-   * @return bool
628
-   */
629
-  public function Recipient($to) {
615
+    }
616
+
617
+    /**
618
+     * Sends the command RCPT to the SMTP server with the TO: argument of $to.
619
+     * Returns true if the recipient was accepted false if it was rejected.
620
+     *
621
+     * Implements from rfc 821: RCPT <SP> TO:<forward-path> <CRLF>
622
+     *
623
+     * SMTP CODE SUCCESS: 250,251
624
+     * SMTP CODE FAILURE: 550,551,552,553,450,451,452
625
+     * SMTP CODE ERROR  : 500,501,503,421
626
+     * @access public
627
+     * @return bool
628
+     */
629
+    public function Recipient($to) {
630 630
     $this->error = null; // so no confusion is caused
631 631
 
632 632
     if(!$this->connected()) {
633
-      $this->error = array(
634
-              "error" => "Called Recipient() without being connected");
635
-      return false;
633
+        $this->error = array(
634
+                "error" => "Called Recipient() without being connected");
635
+        return false;
636 636
     }
637 637
 
638 638
     fputs($this->smtp_conn,"RCPT TO:<" . $to . ">" . $this->CRLF);
@@ -641,41 +641,41 @@  discard block
 block discarded – undo
641 641
     $code = substr($rply,0,3);
642 642
 
643 643
     if($this->do_debug >= 2) {
644
-      echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
644
+        echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
645 645
     }
646 646
 
647 647
     if($code != 250 && $code != 251) {
648
-      $this->error =
648
+        $this->error =
649 649
         array("error" => "RCPT not accepted from server",
650
-              "smtp_code" => $code,
651
-              "smtp_msg" => substr($rply,4));
652
-      if($this->do_debug >= 1) {
650
+                "smtp_code" => $code,
651
+                "smtp_msg" => substr($rply,4));
652
+        if($this->do_debug >= 1) {
653 653
         echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
654
-      }
655
-      return false;
654
+        }
655
+        return false;
656 656
     }
657 657
     return true;
658
-  }
659
-
660
-  /**
661
-   * Sends the RSET command to abort and transaction that is
662
-   * currently in progress. Returns true if successful false
663
-   * otherwise.
664
-   *
665
-   * Implements rfc 821: RSET <CRLF>
666
-   *
667
-   * SMTP CODE SUCCESS: 250
668
-   * SMTP CODE ERROR  : 500,501,504,421
669
-   * @access public
670
-   * @return bool
671
-   */
672
-  public function Reset() {
658
+    }
659
+
660
+    /**
661
+     * Sends the RSET command to abort and transaction that is
662
+     * currently in progress. Returns true if successful false
663
+     * otherwise.
664
+     *
665
+     * Implements rfc 821: RSET <CRLF>
666
+     *
667
+     * SMTP CODE SUCCESS: 250
668
+     * SMTP CODE ERROR  : 500,501,504,421
669
+     * @access public
670
+     * @return bool
671
+     */
672
+    public function Reset() {
673 673
     $this->error = null; // so no confusion is caused
674 674
 
675 675
     if(!$this->connected()) {
676
-      $this->error = array(
677
-              "error" => "Called Reset() without being connected");
678
-      return false;
676
+        $this->error = array(
677
+                "error" => "Called Reset() without being connected");
678
+        return false;
679 679
     }
680 680
 
681 681
     fputs($this->smtp_conn,"RSET" . $this->CRLF);
@@ -684,46 +684,46 @@  discard block
 block discarded – undo
684 684
     $code = substr($rply,0,3);
685 685
 
686 686
     if($this->do_debug >= 2) {
687
-      echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
687
+        echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
688 688
     }
689 689
 
690 690
     if($code != 250) {
691
-      $this->error =
691
+        $this->error =
692 692
         array("error" => "RSET failed",
693
-              "smtp_code" => $code,
694
-              "smtp_msg" => substr($rply,4));
695
-      if($this->do_debug >= 1) {
693
+                "smtp_code" => $code,
694
+                "smtp_msg" => substr($rply,4));
695
+        if($this->do_debug >= 1) {
696 696
         echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
697
-      }
698
-      return false;
697
+        }
698
+        return false;
699 699
     }
700 700
 
701 701
     return true;
702
-  }
703
-
704
-  /**
705
-   * Starts a mail transaction from the email address specified in
706
-   * $from. Returns true if successful or false otherwise. If True
707
-   * the mail transaction is started and then one or more Recipient
708
-   * commands may be called followed by a Data command. This command
709
-   * will send the message to the users terminal if they are logged
710
-   * in and send them an email.
711
-   *
712
-   * Implements rfc 821: SAML <SP> FROM:<reverse-path> <CRLF>
713
-   *
714
-   * SMTP CODE SUCCESS: 250
715
-   * SMTP CODE SUCCESS: 552,451,452
716
-   * SMTP CODE SUCCESS: 500,501,502,421
717
-   * @access public
718
-   * @return bool
719
-   */
720
-  public function SendAndMail($from) {
702
+    }
703
+
704
+    /**
705
+     * Starts a mail transaction from the email address specified in
706
+     * $from. Returns true if successful or false otherwise. If True
707
+     * the mail transaction is started and then one or more Recipient
708
+     * commands may be called followed by a Data command. This command
709
+     * will send the message to the users terminal if they are logged
710
+     * in and send them an email.
711
+     *
712
+     * Implements rfc 821: SAML <SP> FROM:<reverse-path> <CRLF>
713
+     *
714
+     * SMTP CODE SUCCESS: 250
715
+     * SMTP CODE SUCCESS: 552,451,452
716
+     * SMTP CODE SUCCESS: 500,501,502,421
717
+     * @access public
718
+     * @return bool
719
+     */
720
+    public function SendAndMail($from) {
721 721
     $this->error = null; // so no confusion is caused
722 722
 
723 723
     if(!$this->connected()) {
724
-      $this->error = array(
725
-          "error" => "Called SendAndMail() without being connected");
726
-      return false;
724
+        $this->error = array(
725
+            "error" => "Called SendAndMail() without being connected");
726
+        return false;
727 727
     }
728 728
 
729 729
     fputs($this->smtp_conn,"SAML FROM:" . $from . $this->CRLF);
@@ -732,82 +732,82 @@  discard block
 block discarded – undo
732 732
     $code = substr($rply,0,3);
733 733
 
734 734
     if($this->do_debug >= 2) {
735
-      echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
735
+        echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
736 736
     }
737 737
 
738 738
     if($code != 250) {
739
-      $this->error =
739
+        $this->error =
740 740
         array("error" => "SAML not accepted from server",
741
-              "smtp_code" => $code,
742
-              "smtp_msg" => substr($rply,4));
743
-      if($this->do_debug >= 1) {
741
+                "smtp_code" => $code,
742
+                "smtp_msg" => substr($rply,4));
743
+        if($this->do_debug >= 1) {
744 744
         echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
745
-      }
746
-      return false;
745
+        }
746
+        return false;
747 747
     }
748 748
     return true;
749
-  }
750
-
751
-  /**
752
-   * This is an optional command for SMTP that this class does not
753
-   * support. This method is here to make the RFC821 Definition
754
-   * complete for this class and __may__ be implimented in the future
755
-   *
756
-   * Implements from rfc 821: TURN <CRLF>
757
-   *
758
-   * SMTP CODE SUCCESS: 250
759
-   * SMTP CODE FAILURE: 502
760
-   * SMTP CODE ERROR  : 500, 503
761
-   * @access public
762
-   * @return bool
763
-   */
764
-  public function Turn() {
749
+    }
750
+
751
+    /**
752
+     * This is an optional command for SMTP that this class does not
753
+     * support. This method is here to make the RFC821 Definition
754
+     * complete for this class and __may__ be implimented in the future
755
+     *
756
+     * Implements from rfc 821: TURN <CRLF>
757
+     *
758
+     * SMTP CODE SUCCESS: 250
759
+     * SMTP CODE FAILURE: 502
760
+     * SMTP CODE ERROR  : 500, 503
761
+     * @access public
762
+     * @return bool
763
+     */
764
+    public function Turn() {
765 765
     $this->error = array("error" => "This method, TURN, of the SMTP ".
766 766
                                     "is not implemented");
767 767
     if($this->do_debug >= 1) {
768
-      echo "SMTP -> NOTICE: " . $this->error["error"] . $this->CRLF . '<br />';
768
+        echo "SMTP -> NOTICE: " . $this->error["error"] . $this->CRLF . '<br />';
769 769
     }
770 770
     return false;
771
-  }
772
-
773
-  /**
774
-  * Get the current error
775
-  * @access public
776
-  * @return array
777
-  */
778
-  public function getError() {
771
+    }
772
+
773
+    /**
774
+     * Get the current error
775
+     * @access public
776
+     * @return array
777
+     */
778
+    public function getError() {
779 779
     return $this->error;
780
-  }
781
-
782
-  /////////////////////////////////////////////////
783
-  // INTERNAL FUNCTIONS
784
-  /////////////////////////////////////////////////
785
-
786
-  /**
787
-   * Read in as many lines as possible
788
-   * either before eof or socket timeout occurs on the operation.
789
-   * With SMTP we can tell if we have more lines to read if the
790
-   * 4th character is '-' symbol. If it is a space then we don't
791
-   * need to read anything else.
792
-   * @access private
793
-   * @return string
794
-   */
795
-  private function get_lines() {
780
+    }
781
+
782
+    /////////////////////////////////////////////////
783
+    // INTERNAL FUNCTIONS
784
+    /////////////////////////////////////////////////
785
+
786
+    /**
787
+     * Read in as many lines as possible
788
+     * either before eof or socket timeout occurs on the operation.
789
+     * With SMTP we can tell if we have more lines to read if the
790
+     * 4th character is '-' symbol. If it is a space then we don't
791
+     * need to read anything else.
792
+     * @access private
793
+     * @return string
794
+     */
795
+    private function get_lines() {
796 796
     $data = "";
797 797
     while($str = @fgets($this->smtp_conn,515)) {
798
-      if($this->do_debug >= 4) {
798
+        if($this->do_debug >= 4) {
799 799
         echo "SMTP -> get_lines(): \$data was \"$data\"" . $this->CRLF . '<br />';
800 800
         echo "SMTP -> get_lines(): \$str is \"$str\"" . $this->CRLF . '<br />';
801
-      }
802
-      $data .= $str;
803
-      if($this->do_debug >= 4) {
801
+        }
802
+        $data .= $str;
803
+        if($this->do_debug >= 4) {
804 804
         echo "SMTP -> get_lines(): \$data is \"$data\"" . $this->CRLF . '<br />';
805
-      }
806
-      // if 4th character is a space, we are done reading, break the loop
807
-      if(substr($str,3,1) == " ") { break; }
805
+        }
806
+        // if 4th character is a space, we are done reading, break the loop
807
+        if(substr($str,3,1) == " ") { break; }
808 808
     }
809 809
     return $data;
810
-  }
810
+    }
811 811
 
812 812
 }
813 813
 
Please login to merge, or discard this patch.
Spacing   +154 added lines, -154 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
    *  Sets whether debugging is turned on
64 64
    *  @var bool
65 65
    */
66
-  public $do_debug;       // the level of debug to perform
66
+  public $do_debug; // the level of debug to perform
67 67
 
68 68
   /**
69 69
    *  Sets VERP use on/off (default is off)
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
   /////////////////////////////////////////////////
77 77
 
78 78
   private $smtp_conn; // the socket to the server
79
-  private $error;     // error if any on the last call
79
+  private $error; // error if any on the last call
80 80
   private $helo_rply; // the reply the server sent to us for HELO
81 81
 
82 82
   /**
@@ -114,43 +114,43 @@  discard block
 block discarded – undo
114 114
     $this->error = null;
115 115
 
116 116
     // make sure we are __not__ connected
117
-    if($this->connected()) {
117
+    if ($this->connected()) {
118 118
       // already connected, generate error
119 119
       $this->error = array("error" => "Already connected to a server");
120 120
       return false;
121 121
     }
122 122
 
123
-    if(empty($port)) {
123
+    if (empty($port)) {
124 124
       $port = $this->SMTP_PORT;
125 125
     }
126 126
 
127 127
     // connect to the smtp server
128
-    $this->smtp_conn = @fsockopen($host,    // the host of the server
129
-                                 $port,    // the port to use
130
-                                 $errno,   // error number if any
131
-                                 $errstr,  // error message if any
132
-                                 $tval);   // give up after ? secs
128
+    $this->smtp_conn = @fsockopen($host, // the host of the server
129
+                                 $port, // the port to use
130
+                                 $errno, // error number if any
131
+                                 $errstr, // error message if any
132
+                                 $tval); // give up after ? secs
133 133
     // verify we connected properly
134
-    if(empty($this->smtp_conn)) {
134
+    if (empty($this->smtp_conn)) {
135 135
       $this->error = array("error" => "Failed to connect to server",
136 136
                            "errno" => $errno,
137 137
                            "errstr" => $errstr);
138
-      if($this->do_debug >= 1) {
139
-        echo "SMTP -> ERROR: " . $this->error["error"] . ": $errstr ($errno)" . $this->CRLF . '<br />';
138
+      if ($this->do_debug >= 1) {
139
+        echo "SMTP -> ERROR: ".$this->error["error"].": $errstr ($errno)".$this->CRLF.'<br />';
140 140
       }
141 141
       return false;
142 142
     }
143 143
 
144 144
     // SMTP server can take longer to respond, give longer timeout for first read
145 145
     // Windows does not have support for this timeout function
146
-    if(substr(PHP_OS, 0, 3) != "WIN")
146
+    if (substr(PHP_OS, 0, 3) != "WIN")
147 147
      socket_set_timeout($this->smtp_conn, $tval, 0);
148 148
 
149 149
     // get any announcement
150 150
     $announce = $this->get_lines();
151 151
 
152
-    if($this->do_debug >= 2) {
153
-      echo "SMTP -> FROM SERVER:" . $announce . $this->CRLF . '<br />';
152
+    if ($this->do_debug >= 2) {
153
+      echo "SMTP -> FROM SERVER:".$announce.$this->CRLF.'<br />';
154 154
     }
155 155
 
156 156
     return true;
@@ -168,33 +168,33 @@  discard block
 block discarded – undo
168 168
   public function StartTLS() {
169 169
     $this->error = null; # to avoid confusion
170 170
 
171
-    if(!$this->connected()) {
171
+    if (!$this->connected()) {
172 172
       $this->error = array("error" => "Called StartTLS() without being connected");
173 173
       return false;
174 174
     }
175 175
 
176
-    fputs($this->smtp_conn,"STARTTLS" . $this->CRLF);
176
+    fputs($this->smtp_conn, "STARTTLS".$this->CRLF);
177 177
 
178 178
     $rply = $this->get_lines();
179
-    $code = substr($rply,0,3);
179
+    $code = substr($rply, 0, 3);
180 180
 
181
-    if($this->do_debug >= 2) {
182
-      echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
181
+    if ($this->do_debug >= 2) {
182
+      echo "SMTP -> FROM SERVER:".$rply.$this->CRLF.'<br />';
183 183
     }
184 184
 
185
-    if($code != 220) {
185
+    if ($code != 220) {
186 186
       $this->error =
187 187
          array("error"     => "STARTTLS not accepted from server",
188 188
                "smtp_code" => $code,
189
-               "smtp_msg"  => substr($rply,4));
190
-      if($this->do_debug >= 1) {
191
-        echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
189
+               "smtp_msg"  => substr($rply, 4));
190
+      if ($this->do_debug >= 1) {
191
+        echo "SMTP -> ERROR: ".$this->error["error"].": ".$rply.$this->CRLF.'<br />';
192 192
       }
193 193
       return false;
194 194
     }
195 195
 
196 196
     // Begin encrypted connection
197
-    if(!stream_socket_enable_crypto($this->smtp_conn, true, STREAM_CRYPTO_METHOD_TLS_CLIENT)) {
197
+    if (!stream_socket_enable_crypto($this->smtp_conn, true, STREAM_CRYPTO_METHOD_TLS_CLIENT)) {
198 198
       return false;
199 199
     }
200 200
 
@@ -209,52 +209,52 @@  discard block
 block discarded – undo
209 209
    */
210 210
   public function Authenticate($username, $password) {
211 211
     // Start authentication
212
-    fputs($this->smtp_conn,"AUTH LOGIN" . $this->CRLF);
212
+    fputs($this->smtp_conn, "AUTH LOGIN".$this->CRLF);
213 213
 
214 214
     $rply = $this->get_lines();
215
-    $code = substr($rply,0,3);
215
+    $code = substr($rply, 0, 3);
216 216
 
217
-    if($code != 334) {
217
+    if ($code != 334) {
218 218
       $this->error =
219 219
         array("error" => "AUTH not accepted from server",
220 220
               "smtp_code" => $code,
221
-              "smtp_msg" => substr($rply,4));
222
-      if($this->do_debug >= 1) {
223
-        echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
221
+              "smtp_msg" => substr($rply, 4));
222
+      if ($this->do_debug >= 1) {
223
+        echo "SMTP -> ERROR: ".$this->error["error"].": ".$rply.$this->CRLF.'<br />';
224 224
       }
225 225
       return false;
226 226
     }
227 227
 
228 228
     // Send encoded username
229
-    fputs($this->smtp_conn, base64_encode($username) . $this->CRLF);
229
+    fputs($this->smtp_conn, base64_encode($username).$this->CRLF);
230 230
 
231 231
     $rply = $this->get_lines();
232
-    $code = substr($rply,0,3);
232
+    $code = substr($rply, 0, 3);
233 233
 
234
-    if($code != 334) {
234
+    if ($code != 334) {
235 235
       $this->error =
236 236
         array("error" => "Username not accepted from server",
237 237
               "smtp_code" => $code,
238
-              "smtp_msg" => substr($rply,4));
239
-      if($this->do_debug >= 1) {
240
-        echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
238
+              "smtp_msg" => substr($rply, 4));
239
+      if ($this->do_debug >= 1) {
240
+        echo "SMTP -> ERROR: ".$this->error["error"].": ".$rply.$this->CRLF.'<br />';
241 241
       }
242 242
       return false;
243 243
     }
244 244
 
245 245
     // Send encoded password
246
-    fputs($this->smtp_conn, base64_encode($password) . $this->CRLF);
246
+    fputs($this->smtp_conn, base64_encode($password).$this->CRLF);
247 247
 
248 248
     $rply = $this->get_lines();
249
-    $code = substr($rply,0,3);
249
+    $code = substr($rply, 0, 3);
250 250
 
251
-    if($code != 235) {
251
+    if ($code != 235) {
252 252
       $this->error =
253 253
         array("error" => "Password not accepted from server",
254 254
               "smtp_code" => $code,
255
-              "smtp_msg" => substr($rply,4));
256
-      if($this->do_debug >= 1) {
257
-        echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
255
+              "smtp_msg" => substr($rply, 4));
256
+      if ($this->do_debug >= 1) {
257
+        echo "SMTP -> ERROR: ".$this->error["error"].": ".$rply.$this->CRLF.'<br />';
258 258
       }
259 259
       return false;
260 260
     }
@@ -268,12 +268,12 @@  discard block
 block discarded – undo
268 268
    * @return bool
269 269
    */
270 270
   public function Connected() {
271
-    if(!empty($this->smtp_conn)) {
271
+    if (!empty($this->smtp_conn)) {
272 272
       $sock_status = socket_get_status($this->smtp_conn);
273
-      if($sock_status["eof"]) {
273
+      if ($sock_status["eof"]) {
274 274
         // the socket is valid but we are not connected
275
-        if($this->do_debug >= 1) {
276
-            echo "SMTP -> NOTICE:" . $this->CRLF . "EOF caught while checking if connected";
275
+        if ($this->do_debug >= 1) {
276
+            echo "SMTP -> NOTICE:".$this->CRLF."EOF caught while checking if connected";
277 277
         }
278 278
         $this->Close();
279 279
         return false;
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
   public function Close() {
294 294
     $this->error = null; // so there is no confusion
295 295
     $this->helo_rply = null;
296
-    if(!empty($this->smtp_conn)) {
296
+    if (!empty($this->smtp_conn)) {
297 297
       // close the connection and cleanup
298 298
       fclose($this->smtp_conn);
299 299
       $this->smtp_conn = 0;
@@ -326,28 +326,28 @@  discard block
 block discarded – undo
326 326
   public function Data($msg_data) {
327 327
     $this->error = null; // so no confusion is caused
328 328
 
329
-    if(!$this->connected()) {
329
+    if (!$this->connected()) {
330 330
       $this->error = array(
331 331
               "error" => "Called Data() without being connected");
332 332
       return false;
333 333
     }
334 334
 
335
-    fputs($this->smtp_conn,"DATA" . $this->CRLF);
335
+    fputs($this->smtp_conn, "DATA".$this->CRLF);
336 336
 
337 337
     $rply = $this->get_lines();
338
-    $code = substr($rply,0,3);
338
+    $code = substr($rply, 0, 3);
339 339
 
340
-    if($this->do_debug >= 2) {
341
-      echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
340
+    if ($this->do_debug >= 2) {
341
+      echo "SMTP -> FROM SERVER:".$rply.$this->CRLF.'<br />';
342 342
     }
343 343
 
344
-    if($code != 354) {
344
+    if ($code != 354) {
345 345
       $this->error =
346 346
         array("error" => "DATA command not accepted from server",
347 347
               "smtp_code" => $code,
348
-              "smtp_msg" => substr($rply,4));
349
-      if($this->do_debug >= 1) {
350
-        echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
348
+              "smtp_msg" => substr($rply, 4));
349
+      if ($this->do_debug >= 1) {
350
+        echo "SMTP -> ERROR: ".$this->error["error"].": ".$rply.$this->CRLF.'<br />';
351 351
       }
352 352
       return false;
353 353
     }
@@ -364,9 +364,9 @@  discard block
 block discarded – undo
364 364
      */
365 365
 
366 366
     // normalize the line breaks so we know the explode works
367
-    $msg_data = str_replace("\r\n","\n",$msg_data);
368
-    $msg_data = str_replace("\r","\n",$msg_data);
369
-    $lines = explode("\n",$msg_data);
367
+    $msg_data = str_replace("\r\n", "\n", $msg_data);
368
+    $msg_data = str_replace("\r", "\n", $msg_data);
369
+    $lines = explode("\n", $msg_data);
370 370
 
371 371
     /* we need to find a good way to determine is headers are
372 372
      * in the msg_data or if it is a straight msg body
@@ -377,71 +377,71 @@  discard block
 block discarded – undo
377 377
      * headers.
378 378
      */
379 379
 
380
-    $field = substr($lines[0],0,strpos($lines[0],":"));
380
+    $field = substr($lines[0], 0, strpos($lines[0], ":"));
381 381
     $in_headers = false;
382
-    if(!empty($field) && !strstr($field," ")) {
382
+    if (!empty($field) && !strstr($field, " ")) {
383 383
       $in_headers = true;
384 384
     }
385 385
 
386 386
     $max_line_length = 998; // used below; set here for ease in change
387 387
 
388
-    while(list(,$line) = @each($lines)) {
388
+    while (list(,$line) = @each($lines)) {
389 389
       $lines_out = null;
390
-      if($line == "" && $in_headers) {
390
+      if ($line == "" && $in_headers) {
391 391
         $in_headers = false;
392 392
       }
393 393
       // ok we need to break this line up into several smaller lines
394
-      while(strlen($line) > $max_line_length) {
395
-        $pos = strrpos(substr($line,0,$max_line_length)," ");
394
+      while (strlen($line) > $max_line_length) {
395
+        $pos = strrpos(substr($line, 0, $max_line_length), " ");
396 396
 
397 397
         // Patch to fix DOS attack
398
-        if(!$pos) {
398
+        if (!$pos) {
399 399
           $pos = $max_line_length - 1;
400
-          $lines_out[] = substr($line,0,$pos);
401
-          $line = substr($line,$pos);
400
+          $lines_out[] = substr($line, 0, $pos);
401
+          $line = substr($line, $pos);
402 402
         } else {
403
-          $lines_out[] = substr($line,0,$pos);
404
-          $line = substr($line,$pos + 1);
403
+          $lines_out[] = substr($line, 0, $pos);
404
+          $line = substr($line, $pos + 1);
405 405
         }
406 406
 
407 407
         /* if processing headers add a LWSP-char to the front of new line
408 408
          * rfc 822 on long msg headers
409 409
          */
410
-        if($in_headers) {
411
-          $line = "\t" . $line;
410
+        if ($in_headers) {
411
+          $line = "\t".$line;
412 412
         }
413 413
       }
414 414
       $lines_out[] = $line;
415 415
 
416 416
       // send the lines to the server
417
-      while(list(,$line_out) = @each($lines_out)) {
418
-        if(strlen($line_out) > 0)
417
+      while (list(,$line_out) = @each($lines_out)) {
418
+        if (strlen($line_out) > 0)
419 419
         {
420
-          if(substr($line_out, 0, 1) == ".") {
421
-            $line_out = "." . $line_out;
420
+          if (substr($line_out, 0, 1) == ".") {
421
+            $line_out = ".".$line_out;
422 422
           }
423 423
         }
424
-        fputs($this->smtp_conn,$line_out . $this->CRLF);
424
+        fputs($this->smtp_conn, $line_out.$this->CRLF);
425 425
       }
426 426
     }
427 427
 
428 428
     // message data has been sent
429
-    fputs($this->smtp_conn, $this->CRLF . "." . $this->CRLF);
429
+    fputs($this->smtp_conn, $this->CRLF.".".$this->CRLF);
430 430
 
431 431
     $rply = $this->get_lines();
432
-    $code = substr($rply,0,3);
432
+    $code = substr($rply, 0, 3);
433 433
 
434
-    if($this->do_debug >= 2) {
435
-      echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
434
+    if ($this->do_debug >= 2) {
435
+      echo "SMTP -> FROM SERVER:".$rply.$this->CRLF.'<br />';
436 436
     }
437 437
 
438
-    if($code != 250) {
438
+    if ($code != 250) {
439 439
       $this->error =
440 440
         array("error" => "DATA not accepted from server",
441 441
               "smtp_code" => $code,
442
-              "smtp_msg" => substr($rply,4));
443
-      if($this->do_debug >= 1) {
444
-        echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
442
+              "smtp_msg" => substr($rply, 4));
443
+      if ($this->do_debug >= 1) {
444
+        echo "SMTP -> ERROR: ".$this->error["error"].": ".$rply.$this->CRLF.'<br />';
445 445
       }
446 446
       return false;
447 447
     }
@@ -463,21 +463,21 @@  discard block
 block discarded – undo
463 463
   public function Hello($host = '') {
464 464
     $this->error = null; // so no confusion is caused
465 465
 
466
-    if(!$this->connected()) {
466
+    if (!$this->connected()) {
467 467
       $this->error = array(
468 468
             "error" => "Called Hello() without being connected");
469 469
       return false;
470 470
     }
471 471
 
472 472
     // if hostname for HELO was not specified send default
473
-    if(empty($host)) {
473
+    if (empty($host)) {
474 474
       // determine appropriate default to send to server
475 475
       $host = "localhost";
476 476
     }
477 477
 
478 478
     // Send extended hello first (RFC 2821)
479
-    if(!$this->SendHello("EHLO", $host)) {
480
-      if(!$this->SendHello("HELO", $host)) {
479
+    if (!$this->SendHello("EHLO", $host)) {
480
+      if (!$this->SendHello("HELO", $host)) {
481 481
         return false;
482 482
       }
483 483
     }
@@ -491,22 +491,22 @@  discard block
 block discarded – undo
491 491
    * @return bool
492 492
    */
493 493
   private function SendHello($hello, $host) {
494
-    fputs($this->smtp_conn, $hello . " " . $host . $this->CRLF);
494
+    fputs($this->smtp_conn, $hello." ".$host.$this->CRLF);
495 495
 
496 496
     $rply = $this->get_lines();
497
-    $code = substr($rply,0,3);
497
+    $code = substr($rply, 0, 3);
498 498
 
499
-    if($this->do_debug >= 2) {
500
-      echo "SMTP -> FROM SERVER: " . $rply . $this->CRLF . '<br />';
499
+    if ($this->do_debug >= 2) {
500
+      echo "SMTP -> FROM SERVER: ".$rply.$this->CRLF.'<br />';
501 501
     }
502 502
 
503
-    if($code != 250) {
503
+    if ($code != 250) {
504 504
       $this->error =
505
-        array("error" => $hello . " not accepted from server",
505
+        array("error" => $hello." not accepted from server",
506 506
               "smtp_code" => $code,
507
-              "smtp_msg" => substr($rply,4));
508
-      if($this->do_debug >= 1) {
509
-        echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
507
+              "smtp_msg" => substr($rply, 4));
508
+      if ($this->do_debug >= 1) {
509
+        echo "SMTP -> ERROR: ".$this->error["error"].": ".$rply.$this->CRLF.'<br />';
510 510
       }
511 511
       return false;
512 512
     }
@@ -533,29 +533,29 @@  discard block
 block discarded – undo
533 533
   public function Mail($from) {
534 534
     $this->error = null; // so no confusion is caused
535 535
 
536
-    if(!$this->connected()) {
536
+    if (!$this->connected()) {
537 537
       $this->error = array(
538 538
               "error" => "Called Mail() without being connected");
539 539
       return false;
540 540
     }
541 541
 
542 542
     $useVerp = ($this->do_verp ? "XVERP" : "");
543
-    fputs($this->smtp_conn,"MAIL FROM:<" . $from . ">" . $useVerp . $this->CRLF);
543
+    fputs($this->smtp_conn, "MAIL FROM:<".$from.">".$useVerp.$this->CRLF);
544 544
 
545 545
     $rply = $this->get_lines();
546
-    $code = substr($rply,0,3);
546
+    $code = substr($rply, 0, 3);
547 547
 
548
-    if($this->do_debug >= 2) {
549
-      echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
548
+    if ($this->do_debug >= 2) {
549
+      echo "SMTP -> FROM SERVER:".$rply.$this->CRLF.'<br />';
550 550
     }
551 551
 
552
-    if($code != 250) {
552
+    if ($code != 250) {
553 553
       $this->error =
554 554
         array("error" => "MAIL not accepted from server",
555 555
               "smtp_code" => $code,
556
-              "smtp_msg" => substr($rply,4));
557
-      if($this->do_debug >= 1) {
558
-        echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
556
+              "smtp_msg" => substr($rply, 4));
557
+      if ($this->do_debug >= 1) {
558
+        echo "SMTP -> ERROR: ".$this->error["error"].": ".$rply.$this->CRLF.'<br />';
559 559
       }
560 560
       return false;
561 561
     }
@@ -576,38 +576,38 @@  discard block
 block discarded – undo
576 576
   public function Quit($close_on_error = true) {
577 577
     $this->error = null; // so there is no confusion
578 578
 
579
-    if(!$this->connected()) {
579
+    if (!$this->connected()) {
580 580
       $this->error = array(
581 581
               "error" => "Called Quit() without being connected");
582 582
       return false;
583 583
     }
584 584
 
585 585
     // send the quit command to the server
586
-    fputs($this->smtp_conn,"quit" . $this->CRLF);
586
+    fputs($this->smtp_conn, "quit".$this->CRLF);
587 587
 
588 588
     // get any good-bye messages
589 589
     $byemsg = $this->get_lines();
590 590
 
591
-    if($this->do_debug >= 2) {
592
-      echo "SMTP -> FROM SERVER:" . $byemsg . $this->CRLF . '<br />';
591
+    if ($this->do_debug >= 2) {
592
+      echo "SMTP -> FROM SERVER:".$byemsg.$this->CRLF.'<br />';
593 593
     }
594 594
 
595 595
     $rval = true;
596 596
     $e = null;
597 597
 
598
-    $code = substr($byemsg,0,3);
599
-    if($code != 221) {
598
+    $code = substr($byemsg, 0, 3);
599
+    if ($code != 221) {
600 600
       // use e as a tmp var cause Close will overwrite $this->error
601 601
       $e = array("error" => "SMTP server rejected quit command",
602 602
                  "smtp_code" => $code,
603
-                 "smtp_rply" => substr($byemsg,4));
603
+                 "smtp_rply" => substr($byemsg, 4));
604 604
       $rval = false;
605
-      if($this->do_debug >= 1) {
606
-        echo "SMTP -> ERROR: " . $e["error"] . ": " . $byemsg . $this->CRLF . '<br />';
605
+      if ($this->do_debug >= 1) {
606
+        echo "SMTP -> ERROR: ".$e["error"].": ".$byemsg.$this->CRLF.'<br />';
607 607
       }
608 608
     }
609 609
 
610
-    if(empty($e) || $close_on_error) {
610
+    if (empty($e) || $close_on_error) {
611 611
       $this->Close();
612 612
     }
613 613
 
@@ -629,28 +629,28 @@  discard block
 block discarded – undo
629 629
   public function Recipient($to) {
630 630
     $this->error = null; // so no confusion is caused
631 631
 
632
-    if(!$this->connected()) {
632
+    if (!$this->connected()) {
633 633
       $this->error = array(
634 634
               "error" => "Called Recipient() without being connected");
635 635
       return false;
636 636
     }
637 637
 
638
-    fputs($this->smtp_conn,"RCPT TO:<" . $to . ">" . $this->CRLF);
638
+    fputs($this->smtp_conn, "RCPT TO:<".$to.">".$this->CRLF);
639 639
 
640 640
     $rply = $this->get_lines();
641
-    $code = substr($rply,0,3);
641
+    $code = substr($rply, 0, 3);
642 642
 
643
-    if($this->do_debug >= 2) {
644
-      echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
643
+    if ($this->do_debug >= 2) {
644
+      echo "SMTP -> FROM SERVER:".$rply.$this->CRLF.'<br />';
645 645
     }
646 646
 
647
-    if($code != 250 && $code != 251) {
647
+    if ($code != 250 && $code != 251) {
648 648
       $this->error =
649 649
         array("error" => "RCPT not accepted from server",
650 650
               "smtp_code" => $code,
651
-              "smtp_msg" => substr($rply,4));
652
-      if($this->do_debug >= 1) {
653
-        echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
651
+              "smtp_msg" => substr($rply, 4));
652
+      if ($this->do_debug >= 1) {
653
+        echo "SMTP -> ERROR: ".$this->error["error"].": ".$rply.$this->CRLF.'<br />';
654 654
       }
655 655
       return false;
656 656
     }
@@ -672,28 +672,28 @@  discard block
 block discarded – undo
672 672
   public function Reset() {
673 673
     $this->error = null; // so no confusion is caused
674 674
 
675
-    if(!$this->connected()) {
675
+    if (!$this->connected()) {
676 676
       $this->error = array(
677 677
               "error" => "Called Reset() without being connected");
678 678
       return false;
679 679
     }
680 680
 
681
-    fputs($this->smtp_conn,"RSET" . $this->CRLF);
681
+    fputs($this->smtp_conn, "RSET".$this->CRLF);
682 682
 
683 683
     $rply = $this->get_lines();
684
-    $code = substr($rply,0,3);
684
+    $code = substr($rply, 0, 3);
685 685
 
686
-    if($this->do_debug >= 2) {
687
-      echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
686
+    if ($this->do_debug >= 2) {
687
+      echo "SMTP -> FROM SERVER:".$rply.$this->CRLF.'<br />';
688 688
     }
689 689
 
690
-    if($code != 250) {
690
+    if ($code != 250) {
691 691
       $this->error =
692 692
         array("error" => "RSET failed",
693 693
               "smtp_code" => $code,
694
-              "smtp_msg" => substr($rply,4));
695
-      if($this->do_debug >= 1) {
696
-        echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
694
+              "smtp_msg" => substr($rply, 4));
695
+      if ($this->do_debug >= 1) {
696
+        echo "SMTP -> ERROR: ".$this->error["error"].": ".$rply.$this->CRLF.'<br />';
697 697
       }
698 698
       return false;
699 699
     }
@@ -720,28 +720,28 @@  discard block
 block discarded – undo
720 720
   public function SendAndMail($from) {
721 721
     $this->error = null; // so no confusion is caused
722 722
 
723
-    if(!$this->connected()) {
723
+    if (!$this->connected()) {
724 724
       $this->error = array(
725 725
           "error" => "Called SendAndMail() without being connected");
726 726
       return false;
727 727
     }
728 728
 
729
-    fputs($this->smtp_conn,"SAML FROM:" . $from . $this->CRLF);
729
+    fputs($this->smtp_conn, "SAML FROM:".$from.$this->CRLF);
730 730
 
731 731
     $rply = $this->get_lines();
732
-    $code = substr($rply,0,3);
732
+    $code = substr($rply, 0, 3);
733 733
 
734
-    if($this->do_debug >= 2) {
735
-      echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
734
+    if ($this->do_debug >= 2) {
735
+      echo "SMTP -> FROM SERVER:".$rply.$this->CRLF.'<br />';
736 736
     }
737 737
 
738
-    if($code != 250) {
738
+    if ($code != 250) {
739 739
       $this->error =
740 740
         array("error" => "SAML not accepted from server",
741 741
               "smtp_code" => $code,
742
-              "smtp_msg" => substr($rply,4));
743
-      if($this->do_debug >= 1) {
744
-        echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
742
+              "smtp_msg" => substr($rply, 4));
743
+      if ($this->do_debug >= 1) {
744
+        echo "SMTP -> ERROR: ".$this->error["error"].": ".$rply.$this->CRLF.'<br />';
745 745
       }
746 746
       return false;
747 747
     }
@@ -764,8 +764,8 @@  discard block
 block discarded – undo
764 764
   public function Turn() {
765 765
     $this->error = array("error" => "This method, TURN, of the SMTP ".
766 766
                                     "is not implemented");
767
-    if($this->do_debug >= 1) {
768
-      echo "SMTP -> NOTICE: " . $this->error["error"] . $this->CRLF . '<br />';
767
+    if ($this->do_debug >= 1) {
768
+      echo "SMTP -> NOTICE: ".$this->error["error"].$this->CRLF.'<br />';
769 769
     }
770 770
     return false;
771 771
   }
@@ -794,17 +794,17 @@  discard block
 block discarded – undo
794 794
    */
795 795
   private function get_lines() {
796 796
     $data = "";
797
-    while($str = @fgets($this->smtp_conn,515)) {
798
-      if($this->do_debug >= 4) {
799
-        echo "SMTP -> get_lines(): \$data was \"$data\"" . $this->CRLF . '<br />';
800
-        echo "SMTP -> get_lines(): \$str is \"$str\"" . $this->CRLF . '<br />';
797
+    while ($str = @fgets($this->smtp_conn, 515)) {
798
+      if ($this->do_debug >= 4) {
799
+        echo "SMTP -> get_lines(): \$data was \"$data\"".$this->CRLF.'<br />';
800
+        echo "SMTP -> get_lines(): \$str is \"$str\"".$this->CRLF.'<br />';
801 801
       }
802 802
       $data .= $str;
803
-      if($this->do_debug >= 4) {
804
-        echo "SMTP -> get_lines(): \$data is \"$data\"" . $this->CRLF . '<br />';
803
+      if ($this->do_debug >= 4) {
804
+        echo "SMTP -> get_lines(): \$data is \"$data\"".$this->CRLF.'<br />';
805 805
       }
806 806
       // if 4th character is a space, we are done reading, break the loop
807
-      if(substr($str,3,1) == " ") { break; }
807
+      if (substr($str, 3, 1) == " ") { break; }
808 808
     }
809 809
     return $data;
810 810
   }
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -143,8 +143,9 @@
 block discarded – undo
143 143
 
144 144
     // SMTP server can take longer to respond, give longer timeout for first read
145 145
     // Windows does not have support for this timeout function
146
-    if(substr(PHP_OS, 0, 3) != "WIN")
147
-     socket_set_timeout($this->smtp_conn, $tval, 0);
146
+    if(substr(PHP_OS, 0, 3) != "WIN") {
147
+         socket_set_timeout($this->smtp_conn, $tval, 0);
148
+    }
148 149
 
149 150
     // get any announcement
150 151
     $announce = $this->get_lines();
Please login to merge, or discard this patch.
main/inc/lib/phpseclib/Crypt/DES.php 3 patches
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -742,6 +742,7 @@  discard block
 block discarded – undo
742 742
      * CRYPT_DES_MODE_ECB or CRYPT_DES_MODE_CBC.  If not explictly set, CRYPT_DES_MODE_CBC will be used.
743 743
      *
744 744
      * @param optional Integer $mode
745
+     * @param integer $mode
745 746
      * @return Crypt_DES
746 747
      * @access public
747 748
      */
@@ -1445,6 +1446,7 @@  discard block
 block discarded – undo
1445 1446
      *
1446 1447
      * @see Crypt_DES::_unpad()
1447 1448
      * @access private
1449
+     * @param string $text
1448 1450
      */
1449 1451
     function _pad($text)
1450 1452
     {
Please login to merge, or discard this patch.
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -1137,7 +1137,7 @@  discard block
 block discarded – undo
1137 1137
                 if ($this->continuousBuffer) {
1138 1138
                     $this->encryptIV = $xor;
1139 1139
                     if ($start = strlen($plaintext) & 7) {
1140
-                         $buffer['xor'] = substr($key, $start) . $buffer['xor'];
1140
+                            $buffer['xor'] = substr($key, $start) . $buffer['xor'];
1141 1141
                     }
1142 1142
                 }
1143 1143
         }
@@ -1332,7 +1332,7 @@  discard block
 block discarded – undo
1332 1332
                 if ($this->continuousBuffer) {
1333 1333
                     $this->decryptIV = $xor;
1334 1334
                     if ($start = strlen($ciphertext) % 8) {
1335
-                         $buffer['xor'] = substr($key, $start) . $buffer['xor'];
1335
+                            $buffer['xor'] = substr($key, $start) . $buffer['xor'];
1336 1336
                     }
1337 1337
                 }
1338 1338
         }
@@ -1518,13 +1518,13 @@  discard block
 block discarded – undo
1518 1518
         $t = unpack('Nl/Nr', $block);
1519 1519
         list($l, $r) = array($t['l'], $t['r']);
1520 1520
         $block = ($shuffle[$ipmap[$r & 0xFF]] & "\x80\x80\x80\x80\x80\x80\x80\x80") |
1521
-                 ($shuffle[$ipmap[($r >> 8) & 0xFF]] & "\x40\x40\x40\x40\x40\x40\x40\x40") |
1522
-                 ($shuffle[$ipmap[($r >> 16) & 0xFF]] & "\x20\x20\x20\x20\x20\x20\x20\x20") |
1523
-                 ($shuffle[$ipmap[($r >> 24) & 0xFF]] & "\x10\x10\x10\x10\x10\x10\x10\x10") |
1524
-                 ($shuffle[$ipmap[$l & 0xFF]] & "\x08\x08\x08\x08\x08\x08\x08\x08") |
1525
-                 ($shuffle[$ipmap[($l >> 8) & 0xFF]] & "\x04\x04\x04\x04\x04\x04\x04\x04") |
1526
-                 ($shuffle[$ipmap[($l >> 16) & 0xFF]] & "\x02\x02\x02\x02\x02\x02\x02\x02") |
1527
-                 ($shuffle[$ipmap[($l >> 24) & 0xFF]] & "\x01\x01\x01\x01\x01\x01\x01\x01");
1521
+                    ($shuffle[$ipmap[($r >> 8) & 0xFF]] & "\x40\x40\x40\x40\x40\x40\x40\x40") |
1522
+                    ($shuffle[$ipmap[($r >> 16) & 0xFF]] & "\x20\x20\x20\x20\x20\x20\x20\x20") |
1523
+                    ($shuffle[$ipmap[($r >> 24) & 0xFF]] & "\x10\x10\x10\x10\x10\x10\x10\x10") |
1524
+                    ($shuffle[$ipmap[$l & 0xFF]] & "\x08\x08\x08\x08\x08\x08\x08\x08") |
1525
+                    ($shuffle[$ipmap[($l >> 8) & 0xFF]] & "\x04\x04\x04\x04\x04\x04\x04\x04") |
1526
+                    ($shuffle[$ipmap[($l >> 16) & 0xFF]] & "\x02\x02\x02\x02\x02\x02\x02\x02") |
1527
+                    ($shuffle[$ipmap[($l >> 24) & 0xFF]] & "\x01\x01\x01\x01\x01\x01\x01\x01");
1528 1528
 
1529 1529
         // Extract L0 and R0.
1530 1530
         $t = unpack('Nl/Nr', $block);
@@ -1540,9 +1540,9 @@  discard block
 block discarded – undo
1540 1540
 
1541 1541
             // S-box indexing.
1542 1542
             $t = $sbox1[($b1 >> 24) & 0x3F] ^ $sbox2[($b2 >> 24) & 0x3F] ^
1543
-                 $sbox3[($b1 >> 16) & 0x3F] ^ $sbox4[($b2 >> 16) & 0x3F] ^
1544
-                 $sbox5[($b1 >> 8) & 0x3F] ^ $sbox6[($b2 >> 8) & 0x3F] ^
1545
-                 $sbox7[$b1 & 0x3F] ^ $sbox8[$b2 & 0x3F] ^ $l;
1543
+                    $sbox3[($b1 >> 16) & 0x3F] ^ $sbox4[($b2 >> 16) & 0x3F] ^
1544
+                    $sbox5[($b1 >> 8) & 0x3F] ^ $sbox6[($b2 >> 8) & 0x3F] ^
1545
+                    $sbox7[$b1 & 0x3F] ^ $sbox8[$b2 & 0x3F] ^ $l;
1546 1546
             // end of "the Feistel (F) function"
1547 1547
 
1548 1548
             $l = $r;
@@ -1551,13 +1551,13 @@  discard block
 block discarded – undo
1551 1551
 
1552 1552
         // Perform the inverse IP permutation.
1553 1553
         return ($shuffle[$invipmap[($l >> 24) & 0xFF]] & "\x80\x80\x80\x80\x80\x80\x80\x80") |
1554
-               ($shuffle[$invipmap[($r >> 24) & 0xFF]] & "\x40\x40\x40\x40\x40\x40\x40\x40") |
1555
-               ($shuffle[$invipmap[($l >> 16) & 0xFF]] & "\x20\x20\x20\x20\x20\x20\x20\x20") |
1556
-               ($shuffle[$invipmap[($r >> 16) & 0xFF]] & "\x10\x10\x10\x10\x10\x10\x10\x10") |
1557
-               ($shuffle[$invipmap[($l >> 8) & 0xFF]] & "\x08\x08\x08\x08\x08\x08\x08\x08") |
1558
-               ($shuffle[$invipmap[($r >> 8) & 0xFF]] & "\x04\x04\x04\x04\x04\x04\x04\x04") |
1559
-               ($shuffle[$invipmap[$l & 0xFF]] & "\x02\x02\x02\x02\x02\x02\x02\x02") |
1560
-               ($shuffle[$invipmap[$r & 0xFF]] & "\x01\x01\x01\x01\x01\x01\x01\x01");
1554
+                ($shuffle[$invipmap[($r >> 24) & 0xFF]] & "\x40\x40\x40\x40\x40\x40\x40\x40") |
1555
+                ($shuffle[$invipmap[($l >> 16) & 0xFF]] & "\x20\x20\x20\x20\x20\x20\x20\x20") |
1556
+                ($shuffle[$invipmap[($r >> 16) & 0xFF]] & "\x10\x10\x10\x10\x10\x10\x10\x10") |
1557
+                ($shuffle[$invipmap[($l >> 8) & 0xFF]] & "\x08\x08\x08\x08\x08\x08\x08\x08") |
1558
+                ($shuffle[$invipmap[($r >> 8) & 0xFF]] & "\x04\x04\x04\x04\x04\x04\x04\x04") |
1559
+                ($shuffle[$invipmap[$l & 0xFF]] & "\x02\x02\x02\x02\x02\x02\x02\x02") |
1560
+                ($shuffle[$invipmap[$r & 0xFF]] & "\x01\x01\x01\x01\x01\x01\x01\x01");
1561 1561
     }
1562 1562
 
1563 1563
     /**
@@ -2025,13 +2025,13 @@  discard block
 block discarded – undo
2025 2025
         $t = unpack('Nl/Nr', $key);
2026 2026
         list($l, $r) = array($t['l'], $t['r']);
2027 2027
         $key = ($this->shuffle[$pc1map[$r & 0xFF]] & "\x80\x80\x80\x80\x80\x80\x80\x00") |
2028
-               ($this->shuffle[$pc1map[($r >> 8) & 0xFF]] & "\x40\x40\x40\x40\x40\x40\x40\x00") |
2029
-               ($this->shuffle[$pc1map[($r >> 16) & 0xFF]] & "\x20\x20\x20\x20\x20\x20\x20\x00") |
2030
-               ($this->shuffle[$pc1map[($r >> 24) & 0xFF]] & "\x10\x10\x10\x10\x10\x10\x10\x00") |
2031
-               ($this->shuffle[$pc1map[$l & 0xFF]] & "\x08\x08\x08\x08\x08\x08\x08\x00") |
2032
-               ($this->shuffle[$pc1map[($l >> 8) & 0xFF]] & "\x04\x04\x04\x04\x04\x04\x04\x00") |
2033
-               ($this->shuffle[$pc1map[($l >> 16) & 0xFF]] & "\x02\x02\x02\x02\x02\x02\x02\x00") |
2034
-               ($this->shuffle[$pc1map[($l >> 24) & 0xFF]] & "\x01\x01\x01\x01\x01\x01\x01\x00");
2028
+                ($this->shuffle[$pc1map[($r >> 8) & 0xFF]] & "\x40\x40\x40\x40\x40\x40\x40\x00") |
2029
+                ($this->shuffle[$pc1map[($r >> 16) & 0xFF]] & "\x20\x20\x20\x20\x20\x20\x20\x00") |
2030
+                ($this->shuffle[$pc1map[($r >> 24) & 0xFF]] & "\x10\x10\x10\x10\x10\x10\x10\x00") |
2031
+                ($this->shuffle[$pc1map[$l & 0xFF]] & "\x08\x08\x08\x08\x08\x08\x08\x00") |
2032
+                ($this->shuffle[$pc1map[($l >> 8) & 0xFF]] & "\x04\x04\x04\x04\x04\x04\x04\x00") |
2033
+                ($this->shuffle[$pc1map[($l >> 16) & 0xFF]] & "\x02\x02\x02\x02\x02\x02\x02\x00") |
2034
+                ($this->shuffle[$pc1map[($l >> 24) & 0xFF]] & "\x01\x01\x01\x01\x01\x01\x01\x00");
2035 2035
         $key = unpack('Nc/Nd', $key);
2036 2036
         $c = ($key['c'] >> 4) & 0x0FFFFFFF;
2037 2037
         $d = (($key['d'] >> 4) & 0x0FFFFFF0) | ($key['c'] & 0x0F);
@@ -2045,9 +2045,9 @@  discard block
 block discarded – undo
2045 2045
 
2046 2046
             // Perform the PC-2 transformation.
2047 2047
             $cp = $pc2mapc1[$c >> 24] | $pc2mapc2[($c >> 16) & 0xFF] |
2048
-                  $pc2mapc3[($c >> 8) & 0xFF] | $pc2mapc4[$c & 0xFF];
2048
+                    $pc2mapc3[($c >> 8) & 0xFF] | $pc2mapc4[$c & 0xFF];
2049 2049
             $dp = $pc2mapd1[$d >> 24] | $pc2mapd2[($d >> 16) & 0xFF] |
2050
-                  $pc2mapd3[($d >> 8) & 0xFF] | $pc2mapd4[$d & 0xFF];
2050
+                    $pc2mapd3[($d >> 8) & 0xFF] | $pc2mapd4[$d & 0xFF];
2051 2051
 
2052 2052
             // Reorder: odd bytes/even bytes. Push the result in key schedule.
2053 2053
             $keys[] = array(
Please login to merge, or discard this patch.
Spacing   +95 added lines, -95 removed lines patch added patch discarded remove patch
@@ -747,7 +747,7 @@  discard block
 block discarded – undo
747 747
      */
748 748
     function Crypt_DES($mode = CRYPT_DES_MODE_CBC)
749 749
     {
750
-        if ( !defined('CRYPT_DES_MODE') ) {
750
+        if (!defined('CRYPT_DES_MODE')) {
751 751
             switch (true) {
752 752
                 case extension_loaded('mcrypt') && in_array('des', mcrypt_list_algorithms()):
753 753
                     define('CRYPT_DES_MODE', CRYPT_DES_MODE_MCRYPT);
@@ -757,7 +757,7 @@  discard block
 block discarded – undo
757 757
             }
758 758
         }
759 759
 
760
-        switch ( CRYPT_DES_MODE ) {
760
+        switch (CRYPT_DES_MODE) {
761 761
             case CRYPT_DES_MODE_MCRYPT:
762 762
                 switch ($mode) {
763 763
                     case CRYPT_DES_MODE_ECB:
@@ -823,7 +823,7 @@  discard block
 block discarded – undo
823 823
      */
824 824
     function setKey($key)
825 825
     {
826
-        $this->keys = ( CRYPT_DES_MODE == CRYPT_DES_MODE_MCRYPT ) ? str_pad(substr($key, 0, 8), 8, chr(0)) : $this->_prepareKey($key);
826
+        $this->keys = (CRYPT_DES_MODE == CRYPT_DES_MODE_MCRYPT) ? str_pad(substr($key, 0, 8), 8, chr(0)) : $this->_prepareKey($key);
827 827
         $this->enchanged = true;
828 828
         $this->dechanged = true;
829 829
     }
@@ -845,7 +845,7 @@  discard block
 block discarded – undo
845 845
 
846 846
         switch ($method) {
847 847
             default: // 'pbkdf2'
848
-                list(, , $hash, $salt, $count) = func_get_args();
848
+                list(,, $hash, $salt, $count) = func_get_args();
849 849
                 if (!isset($hash)) {
850 850
                     $hash = 'sha1';
851 851
                 }
@@ -869,12 +869,12 @@  discard block
 block discarded – undo
869 869
                     $hmac = new Crypt_Hash();
870 870
                     $hmac->setHash($hash);
871 871
                     $hmac->setKey($password);
872
-                    $f = $u = $hmac->hash($salt . pack('N', $i++));
872
+                    $f = $u = $hmac->hash($salt.pack('N', $i++));
873 873
                     for ($j = 2; $j <= $count; $j++) {
874 874
                         $u = $hmac->hash($u);
875
-                        $f^= $u;
875
+                        $f ^= $u;
876 876
                     }
877
-                    $key.= $f;
877
+                    $key .= $f;
878 878
                 }
879 879
         }
880 880
 
@@ -911,7 +911,7 @@  discard block
 block discarded – undo
911 911
     function _generate_xor(&$iv)
912 912
     {
913 913
         $xor = $iv;
914
-        for ($j = 4; $j <= 8; $j+=4) {
914
+        for ($j = 4; $j <= 8; $j += 4) {
915 915
             $temp = substr($iv, -$j, 4);
916 916
             switch ($temp) {
917 917
                 case "\xFF\xFF\xFF\xFF":
@@ -953,7 +953,7 @@  discard block
 block discarded – undo
953 953
             $plaintext = $this->_pad($plaintext);
954 954
         }
955 955
 
956
-        if ( CRYPT_DES_MODE == CRYPT_DES_MODE_MCRYPT ) {
956
+        if (CRYPT_DES_MODE == CRYPT_DES_MODE_MCRYPT) {
957 957
             if ($this->enchanged) {
958 958
                 mcrypt_generic_init($this->enmcrypt, $this->keys, $this->encryptIV);
959 959
                 if ($this->mode == 'ncfb') {
@@ -975,11 +975,11 @@  discard block
 block discarded – undo
975 975
                     $max = 8 - $pos;
976 976
                     if ($len >= $max) {
977 977
                         $i = $max;
978
-                        $len-= $max;
978
+                        $len -= $max;
979 979
                         $pos = 0;
980 980
                     } else {
981 981
                         $i = $len;
982
-                        $pos+= $len;
982
+                        $pos += $len;
983 983
                         $len = 0;
984 984
                     }
985 985
                     $ciphertext = substr($iv, $orig_pos) ^ $plaintext;
@@ -992,15 +992,15 @@  discard block
 block discarded – undo
992 992
                             mcrypt_generic_init($this->enmcrypt, $this->keys, $iv);
993 993
                             $this->enbuffer['enmcrypt_init'] = false;
994 994
                         }
995
-                        $ciphertext.= mcrypt_generic($this->enmcrypt, substr($plaintext, $i, $len - $len % 8));
995
+                        $ciphertext .= mcrypt_generic($this->enmcrypt, substr($plaintext, $i, $len - $len % 8));
996 996
                         $iv = substr($ciphertext, -8);
997
-                        $len%= 8;
997
+                        $len %= 8;
998 998
                     } else {
999 999
                         while ($len >= 8) {
1000 1000
                             $iv = mcrypt_generic($this->ecb, $iv) ^ substr($plaintext, $i, 8);
1001
-                            $ciphertext.= $iv;
1002
-                            $len-= 8;
1003
-                            $i+= 8;
1001
+                            $ciphertext .= $iv;
1002
+                            $len -= 8;
1003
+                            $i += 8;
1004 1004
                         }
1005 1005
                     }
1006 1006
                 } 
@@ -1008,7 +1008,7 @@  discard block
 block discarded – undo
1008 1008
                     $iv = mcrypt_generic($this->ecb, $iv);
1009 1009
                     $block = $iv ^ substr($plaintext, -$len);
1010 1010
                     $iv = substr_replace($iv, $block, 0, $len);
1011
-                    $ciphertext.= $block;
1011
+                    $ciphertext .= $block;
1012 1012
                     $pos = $len;
1013 1013
                 }
1014 1014
                 return $ciphertext;
@@ -1035,17 +1035,17 @@  discard block
 block discarded – undo
1035 1035
         $ciphertext = '';
1036 1036
         switch ($this->mode) {
1037 1037
             case CRYPT_DES_MODE_ECB:
1038
-                for ($i = 0; $i < strlen($plaintext); $i+=8) {
1039
-                    $ciphertext.= $this->_processBlock(substr($plaintext, $i, 8), CRYPT_DES_ENCRYPT);
1038
+                for ($i = 0; $i < strlen($plaintext); $i += 8) {
1039
+                    $ciphertext .= $this->_processBlock(substr($plaintext, $i, 8), CRYPT_DES_ENCRYPT);
1040 1040
                 }
1041 1041
                 break;
1042 1042
             case CRYPT_DES_MODE_CBC:
1043 1043
                 $xor = $this->encryptIV;
1044
-                for ($i = 0; $i < strlen($plaintext); $i+=8) {
1044
+                for ($i = 0; $i < strlen($plaintext); $i += 8) {
1045 1045
                     $block = substr($plaintext, $i, 8);
1046 1046
                     $block = $this->_processBlock($block ^ $xor, CRYPT_DES_ENCRYPT);
1047 1047
                     $xor = $block;
1048
-                    $ciphertext.= $block;
1048
+                    $ciphertext .= $block;
1049 1049
                 }
1050 1050
                 if ($this->continuousBuffer) {
1051 1051
                     $this->encryptIV = $xor;
@@ -1054,25 +1054,25 @@  discard block
 block discarded – undo
1054 1054
             case CRYPT_DES_MODE_CTR:
1055 1055
                 $xor = $this->encryptIV;
1056 1056
                 if (strlen($buffer['encrypted'])) {
1057
-                    for ($i = 0; $i < strlen($plaintext); $i+=8) {
1057
+                    for ($i = 0; $i < strlen($plaintext); $i += 8) {
1058 1058
                         $block = substr($plaintext, $i, 8);
1059 1059
                         if (strlen($block) > strlen($buffer['encrypted'])) {
1060
-                            $buffer['encrypted'].= $this->_processBlock($this->_generate_xor($xor), CRYPT_DES_ENCRYPT);
1060
+                            $buffer['encrypted'] .= $this->_processBlock($this->_generate_xor($xor), CRYPT_DES_ENCRYPT);
1061 1061
                         }
1062 1062
                         $key = $this->_string_shift($buffer['encrypted']);
1063
-                        $ciphertext.= $block ^ $key;
1063
+                        $ciphertext .= $block ^ $key;
1064 1064
                     }
1065 1065
                 } else {
1066
-                    for ($i = 0; $i < strlen($plaintext); $i+=8) {
1066
+                    for ($i = 0; $i < strlen($plaintext); $i += 8) {
1067 1067
                         $block = substr($plaintext, $i, 8);
1068 1068
                         $key = $this->_processBlock($this->_generate_xor($xor), CRYPT_DES_ENCRYPT);
1069
-                        $ciphertext.= $block ^ $key;
1069
+                        $ciphertext .= $block ^ $key;
1070 1070
                     }
1071 1071
                 }
1072 1072
                 if ($this->continuousBuffer) {
1073 1073
                     $this->encryptIV = $xor;
1074 1074
                     if ($start = strlen($plaintext) & 7) {
1075
-                        $buffer['encrypted'] = substr($key, $start) . $buffer['encrypted'];
1075
+                        $buffer['encrypted'] = substr($key, $start).$buffer['encrypted'];
1076 1076
                     }
1077 1077
                 }
1078 1078
                 break;
@@ -1091,11 +1091,11 @@  discard block
 block discarded – undo
1091 1091
                     $max = 8 - $pos;
1092 1092
                     if ($len >= $max) {
1093 1093
                         $i = $max;
1094
-                        $len-= $max;
1094
+                        $len -= $max;
1095 1095
                         $pos = 0;
1096 1096
                     } else {
1097 1097
                         $i = $len;
1098
-                        $pos+= $len;
1098
+                        $pos += $len;
1099 1099
                         $len = 0;
1100 1100
                     }
1101 1101
                     $ciphertext = substr($iv, $orig_pos) ^ $plaintext;
@@ -1103,41 +1103,41 @@  discard block
 block discarded – undo
1103 1103
                 }
1104 1104
                 while ($len >= 8) {
1105 1105
                     $iv = $this->_processBlock($iv, CRYPT_DES_ENCRYPT) ^ substr($plaintext, $i, 8);
1106
-                    $ciphertext.= $iv;
1107
-                    $len-= 8;
1108
-                    $i+= 8;
1106
+                    $ciphertext .= $iv;
1107
+                    $len -= 8;
1108
+                    $i += 8;
1109 1109
                 }
1110 1110
                 if ($len) {
1111 1111
                     $iv = $this->_processBlock($iv, CRYPT_DES_ENCRYPT);
1112 1112
                     $block = $iv ^ substr($plaintext, $i);
1113 1113
                     $iv = substr_replace($iv, $block, 0, $len);
1114
-                    $ciphertext.= $block;
1114
+                    $ciphertext .= $block;
1115 1115
                     $pos = $len;
1116 1116
                 }
1117 1117
                 return $ciphertext;
1118 1118
             case CRYPT_DES_MODE_OFB:
1119 1119
                 $xor = $this->encryptIV;
1120 1120
                 if (strlen($buffer['xor'])) {
1121
-                    for ($i = 0; $i < strlen($plaintext); $i+=8) {
1121
+                    for ($i = 0; $i < strlen($plaintext); $i += 8) {
1122 1122
                         $block = substr($plaintext, $i, 8);
1123 1123
                         if (strlen($block) > strlen($buffer['xor'])) {
1124 1124
                             $xor = $this->_processBlock($xor, CRYPT_DES_ENCRYPT);
1125
-                            $buffer['xor'].= $xor;
1125
+                            $buffer['xor'] .= $xor;
1126 1126
                         }
1127 1127
                         $key = $this->_string_shift($buffer['xor']);
1128
-                        $ciphertext.= $block ^ $key;
1128
+                        $ciphertext .= $block ^ $key;
1129 1129
                     }
1130 1130
                 } else {
1131
-                    for ($i = 0; $i < strlen($plaintext); $i+=8) {
1131
+                    for ($i = 0; $i < strlen($plaintext); $i += 8) {
1132 1132
                         $xor = $this->_processBlock($xor, CRYPT_DES_ENCRYPT);
1133
-                        $ciphertext.= substr($plaintext, $i, 8) ^ $xor;
1133
+                        $ciphertext .= substr($plaintext, $i, 8) ^ $xor;
1134 1134
                     }
1135 1135
                     $key = $xor;
1136 1136
                 }
1137 1137
                 if ($this->continuousBuffer) {
1138 1138
                     $this->encryptIV = $xor;
1139 1139
                     if ($start = strlen($plaintext) & 7) {
1140
-                         $buffer['xor'] = substr($key, $start) . $buffer['xor'];
1140
+                         $buffer['xor'] = substr($key, $start).$buffer['xor'];
1141 1141
                     }
1142 1142
                 }
1143 1143
         }
@@ -1162,7 +1162,7 @@  discard block
 block discarded – undo
1162 1162
             $ciphertext = str_pad($ciphertext, (strlen($ciphertext) + 7) & 0xFFFFFFF8, chr(0));
1163 1163
         }
1164 1164
 
1165
-        if ( CRYPT_DES_MODE == CRYPT_DES_MODE_MCRYPT ) {
1165
+        if (CRYPT_DES_MODE == CRYPT_DES_MODE_MCRYPT) {
1166 1166
             if ($this->dechanged) {
1167 1167
                 mcrypt_generic_init($this->demcrypt, $this->keys, $this->decryptIV);
1168 1168
                 if ($this->mode == 'ncfb') {
@@ -1184,11 +1184,11 @@  discard block
 block discarded – undo
1184 1184
                     $max = 8 - $pos;
1185 1185
                     if ($len >= $max) {
1186 1186
                         $i = $max;
1187
-                        $len-= $max;
1187
+                        $len -= $max;
1188 1188
                         $pos = 0;
1189 1189
                     } else {
1190 1190
                         $i = $len;
1191
-                        $pos+= $len;
1191
+                        $pos += $len;
1192 1192
                         $len = 0;
1193 1193
                     }
1194 1194
                     $plaintext = substr($iv, $orig_pos) ^ $ciphertext;
@@ -1196,13 +1196,13 @@  discard block
 block discarded – undo
1196 1196
                 }
1197 1197
                 if ($len >= 8) {
1198 1198
                     $cb = substr($ciphertext, $i, $len - $len % 8);
1199
-                    $plaintext.= mcrypt_generic($this->ecb, $iv . $cb) ^ $cb;
1199
+                    $plaintext .= mcrypt_generic($this->ecb, $iv.$cb) ^ $cb;
1200 1200
                     $iv = substr($cb, -8);
1201
-                    $len%= 8;
1201
+                    $len %= 8;
1202 1202
                 }
1203 1203
                 if ($len) {
1204 1204
                     $iv = mcrypt_generic($this->ecb, $iv);
1205
-                    $plaintext.= $iv ^ substr($ciphertext, -$len);
1205
+                    $plaintext .= $iv ^ substr($ciphertext, -$len);
1206 1206
                     $iv = substr_replace($iv, substr($ciphertext, -$len), 0, $len);
1207 1207
                     $pos = $len;
1208 1208
                 }
@@ -1230,15 +1230,15 @@  discard block
 block discarded – undo
1230 1230
         $plaintext = '';
1231 1231
         switch ($this->mode) {
1232 1232
             case CRYPT_DES_MODE_ECB:
1233
-                for ($i = 0; $i < strlen($ciphertext); $i+=8) {
1234
-                    $plaintext.= $this->_processBlock(substr($ciphertext, $i, 8), CRYPT_DES_DECRYPT);
1233
+                for ($i = 0; $i < strlen($ciphertext); $i += 8) {
1234
+                    $plaintext .= $this->_processBlock(substr($ciphertext, $i, 8), CRYPT_DES_DECRYPT);
1235 1235
                 }
1236 1236
                 break;
1237 1237
             case CRYPT_DES_MODE_CBC:
1238 1238
                 $xor = $this->decryptIV;
1239
-                for ($i = 0; $i < strlen($ciphertext); $i+=8) {
1239
+                for ($i = 0; $i < strlen($ciphertext); $i += 8) {
1240 1240
                     $block = substr($ciphertext, $i, 8);
1241
-                    $plaintext.= $this->_processBlock($block, CRYPT_DES_DECRYPT) ^ $xor;
1241
+                    $plaintext .= $this->_processBlock($block, CRYPT_DES_DECRYPT) ^ $xor;
1242 1242
                     $xor = $block;
1243 1243
                 }
1244 1244
                 if ($this->continuousBuffer) {
@@ -1248,25 +1248,25 @@  discard block
 block discarded – undo
1248 1248
             case CRYPT_DES_MODE_CTR:
1249 1249
                 $xor = $this->decryptIV;
1250 1250
                 if (strlen($buffer['ciphertext'])) {
1251
-                    for ($i = 0; $i < strlen($ciphertext); $i+=8) {
1251
+                    for ($i = 0; $i < strlen($ciphertext); $i += 8) {
1252 1252
                         $block = substr($ciphertext, $i, 8);
1253 1253
                         if (strlen($block) > strlen($buffer['ciphertext'])) {
1254
-                            $buffer['ciphertext'].= $this->_processBlock($this->_generate_xor($xor), CRYPT_DES_ENCRYPT);
1254
+                            $buffer['ciphertext'] .= $this->_processBlock($this->_generate_xor($xor), CRYPT_DES_ENCRYPT);
1255 1255
                         }
1256 1256
                         $key = $this->_string_shift($buffer['ciphertext']);
1257
-                        $plaintext.= $block ^ $key;
1257
+                        $plaintext .= $block ^ $key;
1258 1258
                     }
1259 1259
                 } else {
1260
-                    for ($i = 0; $i < strlen($ciphertext); $i+=8) {
1260
+                    for ($i = 0; $i < strlen($ciphertext); $i += 8) {
1261 1261
                         $block = substr($ciphertext, $i, 8);
1262 1262
                         $key = $this->_processBlock($this->_generate_xor($xor), CRYPT_DES_ENCRYPT);
1263
-                        $plaintext.= $block ^ $key;
1263
+                        $plaintext .= $block ^ $key;
1264 1264
                     }
1265 1265
                 }
1266 1266
                 if ($this->continuousBuffer) {
1267 1267
                     $this->decryptIV = $xor;
1268 1268
                     if ($start = strlen($ciphertext) % 8) {
1269
-                        $buffer['ciphertext'] = substr($key, $start) . $buffer['ciphertext'];
1269
+                        $buffer['ciphertext'] = substr($key, $start).$buffer['ciphertext'];
1270 1270
                     }
1271 1271
                 }
1272 1272
                 break;
@@ -1285,11 +1285,11 @@  discard block
 block discarded – undo
1285 1285
                     $max = 8 - $pos;
1286 1286
                     if ($len >= $max) {
1287 1287
                         $i = $max;
1288
-                        $len-= $max;
1288
+                        $len -= $max;
1289 1289
                         $pos = 0;
1290 1290
                     } else {
1291 1291
                         $i = $len;
1292
-                        $pos+= $len;
1292
+                        $pos += $len;
1293 1293
                         $len = 0;
1294 1294
                     }
1295 1295
                     $plaintext = substr($iv, $orig_pos) ^ $ciphertext;
@@ -1298,14 +1298,14 @@  discard block
 block discarded – undo
1298 1298
                 while ($len >= 8) {
1299 1299
                     $iv = $this->_processBlock($iv, CRYPT_DES_ENCRYPT);
1300 1300
                     $cb = substr($ciphertext, $i, 8);
1301
-                    $plaintext.= $iv ^ $cb;
1301
+                    $plaintext .= $iv ^ $cb;
1302 1302
                     $iv = $cb;
1303
-                    $len-= 8;
1304
-                    $i+= 8;
1303
+                    $len -= 8;
1304
+                    $i += 8;
1305 1305
                 }
1306 1306
                 if ($len) {
1307 1307
                     $iv = $this->_processBlock($iv, CRYPT_DES_ENCRYPT);
1308
-                    $plaintext.= $iv ^ substr($ciphertext, $i);
1308
+                    $plaintext .= $iv ^ substr($ciphertext, $i);
1309 1309
                     $iv = substr_replace($iv, substr($ciphertext, $i), 0, $len);
1310 1310
                     $pos = $len;
1311 1311
                 }
@@ -1313,26 +1313,26 @@  discard block
 block discarded – undo
1313 1313
             case CRYPT_DES_MODE_OFB:
1314 1314
                 $xor = $this->decryptIV;
1315 1315
                 if (strlen($buffer['xor'])) {
1316
-                    for ($i = 0; $i < strlen($ciphertext); $i+=8) {
1316
+                    for ($i = 0; $i < strlen($ciphertext); $i += 8) {
1317 1317
                         $block = substr($ciphertext, $i, 8);
1318 1318
                         if (strlen($block) > strlen($buffer['xor'])) {
1319 1319
                             $xor = $this->_processBlock($xor, CRYPT_DES_ENCRYPT);
1320
-                            $buffer['xor'].= $xor;
1320
+                            $buffer['xor'] .= $xor;
1321 1321
                         }
1322 1322
                         $key = $this->_string_shift($buffer['xor']);
1323
-                        $plaintext.= $block ^ $key;
1323
+                        $plaintext .= $block ^ $key;
1324 1324
                     }
1325 1325
                 } else {
1326
-                    for ($i = 0; $i < strlen($ciphertext); $i+=8) {
1326
+                    for ($i = 0; $i < strlen($ciphertext); $i += 8) {
1327 1327
                         $xor = $this->_processBlock($xor, CRYPT_DES_ENCRYPT);
1328
-                        $plaintext.= substr($ciphertext, $i, 8) ^ $xor;
1328
+                        $plaintext .= substr($ciphertext, $i, 8) ^ $xor;
1329 1329
                     }
1330 1330
                     $key = $xor;
1331 1331
                 }
1332 1332
                 if ($this->continuousBuffer) {
1333 1333
                     $this->decryptIV = $xor;
1334 1334
                     if ($start = strlen($ciphertext) % 8) {
1335
-                         $buffer['xor'] = substr($key, $start) . $buffer['xor'];
1335
+                         $buffer['xor'] = substr($key, $start).$buffer['xor'];
1336 1336
                     }
1337 1337
                 }
1338 1338
         }
@@ -2100,7 +2100,7 @@  discard block
 block discarded – undo
2100 2100
      */
2101 2101
     function inline_crypt_setup($des_rounds = 1)
2102 2102
     {
2103
-        $lambda_functions =& Crypt_DES::get_lambda_functions();
2103
+        $lambda_functions = & Crypt_DES::get_lambda_functions();
2104 2104
         $block_size = 8;
2105 2105
         $mode = $this->mode;
2106 2106
 
@@ -2139,7 +2139,7 @@  discard block
 block discarded – undo
2139 2139
                     ($shuffle[$ipmap[($l >> 24) & 0xFF]] & "\x01\x01\x01\x01\x01\x01\x01\x01")
2140 2140
                 );
2141 2141
 
2142
-                '.'' /* Extract L0 and R0 */ .'
2142
+                '.'' /* Extract L0 and R0 */.'
2143 2143
                 $l = $in[1];
2144 2144
                 $r = $in[2];
2145 2145
             ';
@@ -2153,19 +2153,19 @@  discard block
 block discarded – undo
2153 2153
                 // Merge key schedule.
2154 2154
                 for ($i = 0; $i < 8; ++$i) {
2155 2155
                     $_cryptBlock .= '
2156
-                        $b1 = (($' . $r . ' >>  3) & 0x1FFFFFFF)  ^ ($' . $r . ' << 29) ^ $k_'.(++$ki).';
2157
-                        $b2 = (($' . $r . ' >> 31) & 0x00000001)  ^ ($' . $r . ' <<  1) ^ $k_'.(++$ki).';
2158
-                        $' . $l . '  = $sbox1[($b1 >> 24) & 0x3F] ^ $sbox2[($b2 >> 24) & 0x3F] ^
2156
+                        $b1 = (($' . $r.' >>  3) & 0x1FFFFFFF)  ^ ($'.$r.' << 29) ^ $k_'.(++$ki).';
2157
+                        $b2 = (($' . $r.' >> 31) & 0x00000001)  ^ ($'.$r.' <<  1) ^ $k_'.(++$ki).';
2158
+                        $' . $l.'  = $sbox1[($b1 >> 24) & 0x3F] ^ $sbox2[($b2 >> 24) & 0x3F] ^
2159 2159
                               $sbox3[($b1 >> 16) & 0x3F] ^ $sbox4[($b2 >> 16) & 0x3F] ^
2160 2160
                               $sbox5[($b1 >>  8) & 0x3F] ^ $sbox6[($b2 >>  8) & 0x3F] ^
2161
-                              $sbox7[ $b1        & 0x3F] ^ $sbox8[ $b2        & 0x3F] ^ $' . $l . ';
2161
+                              $sbox7[ $b1        & 0x3F] ^ $sbox8[ $b2        & 0x3F] ^ $' . $l.';
2162 2162
 
2163
-                        $b1 = (($' . $l . ' >>  3) & 0x1FFFFFFF)  ^ ($' . $l . ' << 29) ^ $k_'.(++$ki).';
2164
-                        $b2 = (($' . $l . ' >> 31) & 0x00000001)  ^ ($' . $l . ' <<  1) ^ $k_'.(++$ki).';
2165
-                        $' . $r . '  = $sbox1[($b1 >> 24) & 0x3F] ^ $sbox2[($b2 >> 24) & 0x3F] ^
2163
+                        $b1 = (($' . $l.' >>  3) & 0x1FFFFFFF)  ^ ($'.$l.' << 29) ^ $k_'.(++$ki).';
2164
+                        $b2 = (($' . $l.' >> 31) & 0x00000001)  ^ ($'.$l.' <<  1) ^ $k_'.(++$ki).';
2165
+                        $' . $r.'  = $sbox1[($b1 >> 24) & 0x3F] ^ $sbox2[($b2 >> 24) & 0x3F] ^
2166 2166
                               $sbox3[($b1 >> 16) & 0x3F] ^ $sbox4[($b2 >> 16) & 0x3F] ^
2167 2167
                               $sbox5[($b1 >>  8) & 0x3F] ^ $sbox6[($b2 >>  8) & 0x3F] ^
2168
-                              $sbox7[ $b1        & 0x3F] ^ $sbox8[ $b2        & 0x3F] ^ $' . $r . ';
2168
+                              $sbox7[ $b1        & 0x3F] ^ $sbox8[ $b2        & 0x3F] ^ $' . $r.';
2169 2169
                     ';
2170 2170
                 }
2171 2171
 
@@ -2177,21 +2177,21 @@  discard block
 block discarded – undo
2177 2177
 
2178 2178
             // Perform the inverse IP permutation.
2179 2179
             $_cryptBlock .= '$in = (
2180
-                    ($shuffle[$invipmap[($' . $r . ' >> 24) & 0xFF]] & "\x80\x80\x80\x80\x80\x80\x80\x80") |
2181
-                    ($shuffle[$invipmap[($' . $l . ' >> 24) & 0xFF]] & "\x40\x40\x40\x40\x40\x40\x40\x40") |
2182
-                    ($shuffle[$invipmap[($' . $r . ' >> 16) & 0xFF]] & "\x20\x20\x20\x20\x20\x20\x20\x20") |
2183
-                    ($shuffle[$invipmap[($' . $l . ' >> 16) & 0xFF]] & "\x10\x10\x10\x10\x10\x10\x10\x10") |
2184
-                    ($shuffle[$invipmap[($' . $r . ' >>  8) & 0xFF]] & "\x08\x08\x08\x08\x08\x08\x08\x08") |
2185
-                    ($shuffle[$invipmap[($' . $l . ' >>  8) & 0xFF]] & "\x04\x04\x04\x04\x04\x04\x04\x04") |
2186
-                    ($shuffle[$invipmap[ $' . $r . '        & 0xFF]] & "\x02\x02\x02\x02\x02\x02\x02\x02") |
2187
-                    ($shuffle[$invipmap[ $' . $l . '        & 0xFF]] & "\x01\x01\x01\x01\x01\x01\x01\x01")
2180
+                    ($shuffle[$invipmap[($' . $r.' >> 24) & 0xFF]] & "\x80\x80\x80\x80\x80\x80\x80\x80") |
2181
+                    ($shuffle[$invipmap[($' . $l.' >> 24) & 0xFF]] & "\x40\x40\x40\x40\x40\x40\x40\x40") |
2182
+                    ($shuffle[$invipmap[($' . $r.' >> 16) & 0xFF]] & "\x20\x20\x20\x20\x20\x20\x20\x20") |
2183
+                    ($shuffle[$invipmap[($' . $l.' >> 16) & 0xFF]] & "\x10\x10\x10\x10\x10\x10\x10\x10") |
2184
+                    ($shuffle[$invipmap[($' . $r.' >>  8) & 0xFF]] & "\x08\x08\x08\x08\x08\x08\x08\x08") |
2185
+                    ($shuffle[$invipmap[($' . $l.' >>  8) & 0xFF]] & "\x04\x04\x04\x04\x04\x04\x04\x04") |
2186
+                    ($shuffle[$invipmap[ $' . $r.'        & 0xFF]] & "\x02\x02\x02\x02\x02\x02\x02\x02") |
2187
+                    ($shuffle[$invipmap[ $' . $l.'        & 0xFF]] & "\x01\x01\x01\x01\x01\x01\x01\x01")
2188 2188
                 );
2189 2189
             ';
2190 2190
 
2191 2191
             // Generating mode of operation code:
2192 2192
             switch ($mode) {
2193 2193
                 case CRYPT_DES_MODE_ECB:
2194
-                    $encrypt = $init_cryptBlock . '
2194
+                    $encrypt = $init_cryptBlock.'
2195 2195
                         extract($self->keys[CRYPT_DES_ENCRYPT_1DIM],  EXTR_PREFIX_ALL, "k");
2196 2196
                         $ciphertext = "";
2197 2197
                         $plaintext_len = strlen($text);
@@ -2205,7 +2205,7 @@  discard block
 block discarded – undo
2205 2205
                         return $ciphertext;
2206 2206
                         ';
2207 2207
 
2208
-                    $decrypt = $init_cryptBlock . '
2208
+                    $decrypt = $init_cryptBlock.'
2209 2209
                         extract($self->keys[CRYPT_DES_DECRYPT_1DIM],  EXTR_PREFIX_ALL, "k");
2210 2210
                         $plaintext = "";
2211 2211
                         $ciphertext_len = strlen($text);
@@ -2220,7 +2220,7 @@  discard block
 block discarded – undo
2220 2220
                         ';
2221 2221
                     break;
2222 2222
                 case CRYPT_DES_MODE_CBC:
2223
-                    $encrypt = $init_cryptBlock . '
2223
+                    $encrypt = $init_cryptBlock.'
2224 2224
                         extract($self->keys[CRYPT_DES_ENCRYPT_1DIM],  EXTR_PREFIX_ALL, "k");
2225 2225
                         $ciphertext = "";
2226 2226
                         $plaintext_len = strlen($text);
@@ -2240,7 +2240,7 @@  discard block
 block discarded – undo
2240 2240
                         return $ciphertext;
2241 2241
                         ';
2242 2242
 
2243
-                    $decrypt = $init_cryptBlock . '
2243
+                    $decrypt = $init_cryptBlock.'
2244 2244
                         extract($self->keys[CRYPT_DES_DECRYPT_1DIM],  EXTR_PREFIX_ALL, "k");
2245 2245
                         $plaintext = "";
2246 2246
                         $ciphertext_len = strlen($text);
@@ -2262,7 +2262,7 @@  discard block
 block discarded – undo
2262 2262
                         ';
2263 2263
                     break;
2264 2264
                 case CRYPT_DES_MODE_CTR:
2265
-                    $encrypt = $init_cryptBlock . '
2265
+                    $encrypt = $init_cryptBlock.'
2266 2266
                         extract($self->keys[CRYPT_DES_ENCRYPT_1DIM],  EXTR_PREFIX_ALL, "k");
2267 2267
                         $ciphertext = "";
2268 2268
                         $plaintext_len = strlen($text);
@@ -2299,7 +2299,7 @@  discard block
 block discarded – undo
2299 2299
                         return $ciphertext;
2300 2300
                     ';
2301 2301
 
2302
-                    $decrypt = $init_cryptBlock . '
2302
+                    $decrypt = $init_cryptBlock.'
2303 2303
                         extract($self->keys[CRYPT_DES_ENCRYPT_1DIM],  EXTR_PREFIX_ALL, "k");
2304 2304
                         $plaintext = "";
2305 2305
                         $ciphertext_len = strlen($text);
@@ -2337,7 +2337,7 @@  discard block
 block discarded – undo
2337 2337
                         ';
2338 2338
                     break;
2339 2339
                 case CRYPT_DES_MODE_CFB:
2340
-                    $encrypt = $init_cryptBlock . '
2340
+                    $encrypt = $init_cryptBlock.'
2341 2341
                         extract($self->keys[CRYPT_DES_ENCRYPT_1DIM],  EXTR_PREFIX_ALL, "k");
2342 2342
                         $ciphertext = "";
2343 2343
                         $buffer = &$self->enbuffer;
@@ -2386,7 +2386,7 @@  discard block
 block discarded – undo
2386 2386
                         return $ciphertext;
2387 2387
                     ';
2388 2388
 
2389
-                    $decrypt = $init_cryptBlock . '
2389
+                    $decrypt = $init_cryptBlock.'
2390 2390
                         extract($self->keys[CRYPT_DES_ENCRYPT_1DIM],  EXTR_PREFIX_ALL, "k");
2391 2391
                         $plaintext = "";
2392 2392
                         $buffer = &$self->debuffer;
@@ -2438,7 +2438,7 @@  discard block
 block discarded – undo
2438 2438
                         ';
2439 2439
                     break;
2440 2440
                 case CRYPT_DES_MODE_OFB:
2441
-                    $encrypt = $init_cryptBlock . '
2441
+                    $encrypt = $init_cryptBlock.'
2442 2442
                         extract($self->keys[CRYPT_DES_ENCRYPT_1DIM],  EXTR_PREFIX_ALL, "k");
2443 2443
                         $ciphertext = "";
2444 2444
                         $plaintext_len = strlen($text);
@@ -2475,7 +2475,7 @@  discard block
 block discarded – undo
2475 2475
                         return $ciphertext;
2476 2476
                         ';
2477 2477
 
2478
-                    $decrypt = $init_cryptBlock . '
2478
+                    $decrypt = $init_cryptBlock.'
2479 2479
                         extract($self->keys[CRYPT_DES_ENCRYPT_1DIM],  EXTR_PREFIX_ALL, "k");
2480 2480
                         $plaintext = "";
2481 2481
                         $ciphertext_len = strlen($text);
Please login to merge, or discard this patch.
main/inc/lib/phpseclib/Crypt/Hash.php 3 patches
Doc Comments   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -783,8 +783,7 @@
 block discarded – undo
783 783
      * _sha256() adds multiple unsigned 32-bit integers.  Since PHP doesn't support unsigned integers and since the
784 784
      * possibility of overflow exists, care has to be taken.  Math_BigInteger() could be used but this should be faster.
785 785
      *
786
-     * @param Integer $...
787
-     * @return Integer
786
+     * @return double
788 787
      * @see _sha256()
789 788
      * @access private
790 789
      */
Please login to merge, or discard this patch.
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -257,27 +257,27 @@  discard block
 block discarded – undo
257 257
         switch ($hash) {
258 258
             case 'md2':
259 259
                  $this->b = 16;
260
-                 $this->hash = array($this, '_md2');
261
-                 break;
260
+                    $this->hash = array($this, '_md2');
261
+                    break;
262 262
             case 'md5':
263 263
             case 'md5-96':
264 264
                  $this->b = 64;
265
-                 $this->hash = array($this, '_md5');
266
-                 break;
265
+                    $this->hash = array($this, '_md5');
266
+                    break;
267 267
             case 'sha256':
268 268
                  $this->b = 64;
269
-                 $this->hash = array($this, '_sha256');
270
-                 break;
269
+                    $this->hash = array($this, '_sha256');
270
+                    break;
271 271
             case 'sha384':
272 272
             case 'sha512':
273 273
                  $this->b = 128;
274
-                 $this->hash = array($this, '_sha512');
275
-                 break;
274
+                    $this->hash = array($this, '_sha512');
275
+                    break;
276 276
             case 'sha1':
277 277
             case 'sha1-96':
278 278
             default:
279 279
                  $this->b = 64;
280
-                 $this->hash = array($this, '_sha1');
280
+                    $this->hash = array($this, '_sha1');
281 281
         }
282 282
 
283 283
         $this->ipad = str_repeat(chr(0x36), $this->b);
@@ -378,24 +378,24 @@  discard block
 block discarded – undo
378 378
     function _md2($m)
379 379
     {
380 380
         static $s = array(
381
-             41,  46,  67, 201, 162, 216, 124,   1,  61,  54,  84, 161, 236, 240, 6,
382
-             19,  98, 167,   5, 243, 192, 199, 115, 140, 152, 147,  43, 217, 188,
383
-             76, 130, 202,  30, 155,  87,  60, 253, 212, 224,  22, 103,  66, 111, 24,
381
+                41,  46,  67, 201, 162, 216, 124,   1,  61,  54,  84, 161, 236, 240, 6,
382
+                19,  98, 167,   5, 243, 192, 199, 115, 140, 152, 147,  43, 217, 188,
383
+                76, 130, 202,  30, 155,  87,  60, 253, 212, 224,  22, 103,  66, 111, 24,
384 384
             138,  23, 229,  18, 190,  78, 196, 214, 218, 158, 222,  73, 160, 251,
385 385
             245, 142, 187,  47, 238, 122, 169, 104, 121, 145,  21, 178,   7,  63,
386 386
             148, 194,  16, 137,  11,  34,  95,  33, 128, 127,  93, 154,  90, 144, 50,
387
-             39,  53,  62, 204, 231, 191, 247, 151,   3, 255,  25,  48, 179,  72, 165,
387
+                39,  53,  62, 204, 231, 191, 247, 151,   3, 255,  25,  48, 179,  72, 165,
388 388
             181, 209, 215,  94, 146,  42, 172,  86, 170, 198,  79, 184,  56, 210,
389 389
             150, 164, 125, 182, 118, 252, 107, 226, 156, 116,   4, 241,  69, 157,
390 390
             112,  89, 100, 113, 135,  32, 134,  91, 207, 101, 230,  45, 168,   2, 27,
391
-             96,  37, 173, 174, 176, 185, 246,  28,  70,  97, 105,  52,  64, 126, 15,
392
-             85,  71, 163,  35, 221,  81, 175,  58, 195,  92, 249, 206, 186, 197,
391
+                96,  37, 173, 174, 176, 185, 246,  28,  70,  97, 105,  52,  64, 126, 15,
392
+                85,  71, 163,  35, 221,  81, 175,  58, 195,  92, 249, 206, 186, 197,
393 393
             234,  38,  44,  83,  13, 110, 133,  40, 132,   9, 211, 223, 205, 244, 65,
394 394
             129,  77,  82, 106, 220,  55, 200, 108, 193, 171, 250,  36, 225, 123,
395
-              8,  12, 189, 177,  74, 120, 136, 149, 139, 227,  99, 232, 109, 233,
395
+                8,  12, 189, 177,  74, 120, 136, 149, 139, 227,  99, 232, 109, 233,
396 396
             203, 213, 254,  59,   0,  29,  57, 242, 239, 183,  14, 102,  88, 208, 228,
397 397
             166, 119, 114, 248, 235, 117,  75,  10,  49,  68,  80, 180, 143, 237,
398
-             31,  26, 219, 153, 141,  51, 159,  17, 131, 20
398
+                31,  26, 219, 153, 141,  51, 159,  17, 131, 20
399 399
         );
400 400
 
401 401
         // Step 1. Append Padding Bytes
@@ -494,11 +494,11 @@  discard block
 block discarded – undo
494 494
             // Extend the sixteen 32-bit words into sixty-four 32-bit words
495 495
             for ($i = 16; $i < 64; $i++) {
496 496
                 $s0 = $this->_rightRotate($w[$i - 15],  7) ^
497
-                      $this->_rightRotate($w[$i - 15], 18) ^
498
-                      $this->_rightShift( $w[$i - 15],  3);
497
+                        $this->_rightRotate($w[$i - 15], 18) ^
498
+                        $this->_rightShift( $w[$i - 15],  3);
499 499
                 $s1 = $this->_rightRotate($w[$i - 2], 17) ^
500
-                      $this->_rightRotate($w[$i - 2], 19) ^
501
-                      $this->_rightShift( $w[$i - 2], 10);
500
+                        $this->_rightRotate($w[$i - 2], 19) ^
501
+                        $this->_rightShift( $w[$i - 2], 10);
502 502
                 $w[$i] = $this->_add($w[$i - 16], $s0, $w[$i - 7], $s1);
503 503
 
504 504
             }
@@ -509,18 +509,18 @@  discard block
 block discarded – undo
509 509
             // Main loop
510 510
             for ($i = 0; $i < 64; $i++) {
511 511
                 $s0 = $this->_rightRotate($a,  2) ^
512
-                      $this->_rightRotate($a, 13) ^
513
-                      $this->_rightRotate($a, 22);
512
+                        $this->_rightRotate($a, 13) ^
513
+                        $this->_rightRotate($a, 22);
514 514
                 $maj = ($a & $b) ^
515
-                       ($a & $c) ^
516
-                       ($b & $c);
515
+                        ($a & $c) ^
516
+                        ($b & $c);
517 517
                 $t2 = $this->_add($s0, $maj);
518 518
 
519 519
                 $s1 = $this->_rightRotate($e,  6) ^
520
-                      $this->_rightRotate($e, 11) ^
521
-                      $this->_rightRotate($e, 25);
520
+                        $this->_rightRotate($e, 11) ^
521
+                        $this->_rightRotate($e, 25);
522 522
                 $ch = ($e & $f) ^
523
-                      ($this->_not($e) & $g);
523
+                        ($this->_not($e) & $g);
524 524
                 $t1 = $this->_add($h, $s1, $ch, $k[$i], $w[$i]);
525 525
 
526 526
                 $h = $g;
@@ -635,16 +635,16 @@  discard block
 block discarded – undo
635 635
             // Extend the sixteen 32-bit words into eighty 32-bit words
636 636
             for ($i = 16; $i < 80; $i++) {
637 637
                 $temp = array(
638
-                          $w[$i - 15]->bitwise_rightRotate(1),
639
-                          $w[$i - 15]->bitwise_rightRotate(8),
640
-                          $w[$i - 15]->bitwise_rightShift(7)
638
+                            $w[$i - 15]->bitwise_rightRotate(1),
639
+                            $w[$i - 15]->bitwise_rightRotate(8),
640
+                            $w[$i - 15]->bitwise_rightShift(7)
641 641
                 );
642 642
                 $s0 = $temp[0]->bitwise_xor($temp[1]);
643 643
                 $s0 = $s0->bitwise_xor($temp[2]);
644 644
                 $temp = array(
645
-                          $w[$i - 2]->bitwise_rightRotate(19),
646
-                          $w[$i - 2]->bitwise_rightRotate(61),
647
-                          $w[$i - 2]->bitwise_rightShift(6)
645
+                            $w[$i - 2]->bitwise_rightRotate(19),
646
+                            $w[$i - 2]->bitwise_rightRotate(61),
647
+                            $w[$i - 2]->bitwise_rightShift(6)
648 648
                 );
649 649
                 $s1 = $temp[0]->bitwise_xor($temp[1]);
650 650
                 $s1 = $s1->bitwise_xor($temp[2]);
Please login to merge, or discard this patch.
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -66,11 +66,11 @@  discard block
 block discarded – undo
66 66
 /**
67 67
  * Toggles the mhash() implementation, which has been deprecated on PHP 5.3.0+.
68 68
  */
69
-define('CRYPT_HASH_MODE_MHASH',    2);
69
+define('CRYPT_HASH_MODE_MHASH', 2);
70 70
 /**
71 71
  * Toggles the hash() implementation, which works on PHP 5.1.2+.
72 72
  */
73
-define('CRYPT_HASH_MODE_HASH',     3);
73
+define('CRYPT_HASH_MODE_HASH', 3);
74 74
 /**#@-*/
75 75
 
76 76
 /**
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
      */
146 146
     function Crypt_Hash($hash = 'sha1')
147 147
     {
148
-        if ( !defined('CRYPT_HASH_MODE') ) {
148
+        if (!defined('CRYPT_HASH_MODE')) {
149 149
             switch (true) {
150 150
                 case extension_loaded('hash'):
151 151
                     define('CRYPT_HASH_MODE', CRYPT_HASH_MODE_HASH);
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
                 $mode = CRYPT_HASH_MODE;
219 219
         }
220 220
 
221
-        switch ( $mode ) {
221
+        switch ($mode) {
222 222
             case CRYPT_HASH_MODE_MHASH:
223 223
                 switch ($hash) {
224 224
                     case 'md5':
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
         $mode = is_array($this->hash) ? CRYPT_HASH_MODE_INTERNAL : CRYPT_HASH_MODE;
297 297
 
298 298
         if (!empty($this->key) || is_string($this->key)) {
299
-            switch ( $mode ) {
299
+            switch ($mode) {
300 300
                 case CRYPT_HASH_MODE_MHASH:
301 301
                     $output = mhash($this->hash, $text, $this->key);
302 302
                     break;
@@ -310,16 +310,16 @@  discard block
 block discarded – undo
310 310
                         -- http://tools.ietf.org/html/rfc2104#section-2 */
311 311
                     $key = strlen($this->key) > $this->b ? call_user_func($this->hash, $this->key) : $this->key;
312 312
 
313
-                    $key    = str_pad($key, $this->b, chr(0));      // step 1
314
-                    $temp   = $this->ipad ^ $key;                   // step 2
315
-                    $temp  .= $text;                                // step 3
316
-                    $temp   = call_user_func($this->hash, $temp);   // step 4
317
-                    $output = $this->opad ^ $key;                   // step 5
318
-                    $output.= $temp;                                // step 6
313
+                    $key    = str_pad($key, $this->b, chr(0)); // step 1
314
+                    $temp   = $this->ipad ^ $key; // step 2
315
+                    $temp  .= $text; // step 3
316
+                    $temp   = call_user_func($this->hash, $temp); // step 4
317
+                    $output = $this->opad ^ $key; // step 5
318
+                    $output .= $temp; // step 6
319 319
                     $output = call_user_func($this->hash, $output); // step 7
320 320
             }
321 321
         } else {
322
-            switch ( $mode ) {
322
+            switch ($mode) {
323 323
                 case CRYPT_HASH_MODE_MHASH:
324 324
                     $output = mhash($this->hash, $text);
325 325
                     break;
@@ -378,36 +378,36 @@  discard block
 block discarded – undo
378 378
     function _md2($m)
379 379
     {
380 380
         static $s = array(
381
-             41,  46,  67, 201, 162, 216, 124,   1,  61,  54,  84, 161, 236, 240, 6,
382
-             19,  98, 167,   5, 243, 192, 199, 115, 140, 152, 147,  43, 217, 188,
383
-             76, 130, 202,  30, 155,  87,  60, 253, 212, 224,  22, 103,  66, 111, 24,
384
-            138,  23, 229,  18, 190,  78, 196, 214, 218, 158, 222,  73, 160, 251,
385
-            245, 142, 187,  47, 238, 122, 169, 104, 121, 145,  21, 178,   7,  63,
386
-            148, 194,  16, 137,  11,  34,  95,  33, 128, 127,  93, 154,  90, 144, 50,
387
-             39,  53,  62, 204, 231, 191, 247, 151,   3, 255,  25,  48, 179,  72, 165,
388
-            181, 209, 215,  94, 146,  42, 172,  86, 170, 198,  79, 184,  56, 210,
389
-            150, 164, 125, 182, 118, 252, 107, 226, 156, 116,   4, 241,  69, 157,
390
-            112,  89, 100, 113, 135,  32, 134,  91, 207, 101, 230,  45, 168,   2, 27,
391
-             96,  37, 173, 174, 176, 185, 246,  28,  70,  97, 105,  52,  64, 126, 15,
392
-             85,  71, 163,  35, 221,  81, 175,  58, 195,  92, 249, 206, 186, 197,
393
-            234,  38,  44,  83,  13, 110, 133,  40, 132,   9, 211, 223, 205, 244, 65,
394
-            129,  77,  82, 106, 220,  55, 200, 108, 193, 171, 250,  36, 225, 123,
395
-              8,  12, 189, 177,  74, 120, 136, 149, 139, 227,  99, 232, 109, 233,
396
-            203, 213, 254,  59,   0,  29,  57, 242, 239, 183,  14, 102,  88, 208, 228,
397
-            166, 119, 114, 248, 235, 117,  75,  10,  49,  68,  80, 180, 143, 237,
398
-             31,  26, 219, 153, 141,  51, 159,  17, 131, 20
381
+             41, 46, 67, 201, 162, 216, 124, 1, 61, 54, 84, 161, 236, 240, 6,
382
+             19, 98, 167, 5, 243, 192, 199, 115, 140, 152, 147, 43, 217, 188,
383
+             76, 130, 202, 30, 155, 87, 60, 253, 212, 224, 22, 103, 66, 111, 24,
384
+            138, 23, 229, 18, 190, 78, 196, 214, 218, 158, 222, 73, 160, 251,
385
+            245, 142, 187, 47, 238, 122, 169, 104, 121, 145, 21, 178, 7, 63,
386
+            148, 194, 16, 137, 11, 34, 95, 33, 128, 127, 93, 154, 90, 144, 50,
387
+             39, 53, 62, 204, 231, 191, 247, 151, 3, 255, 25, 48, 179, 72, 165,
388
+            181, 209, 215, 94, 146, 42, 172, 86, 170, 198, 79, 184, 56, 210,
389
+            150, 164, 125, 182, 118, 252, 107, 226, 156, 116, 4, 241, 69, 157,
390
+            112, 89, 100, 113, 135, 32, 134, 91, 207, 101, 230, 45, 168, 2, 27,
391
+             96, 37, 173, 174, 176, 185, 246, 28, 70, 97, 105, 52, 64, 126, 15,
392
+             85, 71, 163, 35, 221, 81, 175, 58, 195, 92, 249, 206, 186, 197,
393
+            234, 38, 44, 83, 13, 110, 133, 40, 132, 9, 211, 223, 205, 244, 65,
394
+            129, 77, 82, 106, 220, 55, 200, 108, 193, 171, 250, 36, 225, 123,
395
+              8, 12, 189, 177, 74, 120, 136, 149, 139, 227, 99, 232, 109, 233,
396
+            203, 213, 254, 59, 0, 29, 57, 242, 239, 183, 14, 102, 88, 208, 228,
397
+            166, 119, 114, 248, 235, 117, 75, 10, 49, 68, 80, 180, 143, 237,
398
+             31, 26, 219, 153, 141, 51, 159, 17, 131, 20
399 399
         );
400 400
 
401 401
         // Step 1. Append Padding Bytes
402 402
         $pad = 16 - (strlen($m) & 0xF);
403
-        $m.= str_repeat(chr($pad), $pad);
403
+        $m .= str_repeat(chr($pad), $pad);
404 404
 
405 405
         $length = strlen($m);
406 406
 
407 407
         // Step 2. Append Checksum
408 408
         $c = str_repeat(chr(0), 16);
409 409
         $l = chr(0);
410
-        for ($i = 0; $i < $length; $i+= 16) {
410
+        for ($i = 0; $i < $length; $i += 16) {
411 411
             for ($j = 0; $j < 16; $j++) {
412 412
                 // RFC1319 incorrectly states that C[j] should be set to S[c xor L]
413 413
                 //$c[$j] = chr($s[ord($m[$i + $j] ^ $l)]);
@@ -416,15 +416,15 @@  discard block
 block discarded – undo
416 416
                 $l = $c[$j];
417 417
             }
418 418
         }
419
-        $m.= $c;
419
+        $m .= $c;
420 420
 
421
-        $length+= 16;
421
+        $length += 16;
422 422
 
423 423
         // Step 3. Initialize MD Buffer
424 424
         $x = str_repeat(chr(0), 48);
425 425
 
426 426
         // Step 4. Process Message in 16-Byte Blocks
427
-        for ($i = 0; $i < $length; $i+= 16) {
427
+        for ($i = 0; $i < $length; $i += 16) {
428 428
             for ($j = 0; $j < 16; $j++) {
429 429
                 $x[$j + 16] = $m[$i + $j];
430 430
                 $x[$j + 32] = $x[$j + 16] ^ $x[$j];
@@ -477,10 +477,10 @@  discard block
 block discarded – undo
477 477
         // Pre-processing
478 478
         $length = strlen($m);
479 479
         // to round to nearest 56 mod 64, we'll add 64 - (length + (64 - 56)) % 64
480
-        $m.= str_repeat(chr(0), 64 - (($length + 8) & 0x3F));
480
+        $m .= str_repeat(chr(0), 64 - (($length + 8) & 0x3F));
481 481
         $m[$length] = chr(0x80);
482 482
         // we don't support hashing strings 512MB long
483
-        $m.= pack('N2', 0, $length << 3);
483
+        $m .= pack('N2', 0, $length << 3);
484 484
 
485 485
         // Process the message in successive 512-bit chunks
486 486
         $chunks = str_split($m, 64);
@@ -493,12 +493,12 @@  discard block
 block discarded – undo
493 493
 
494 494
             // Extend the sixteen 32-bit words into sixty-four 32-bit words
495 495
             for ($i = 16; $i < 64; $i++) {
496
-                $s0 = $this->_rightRotate($w[$i - 15],  7) ^
496
+                $s0 = $this->_rightRotate($w[$i - 15], 7) ^
497 497
                       $this->_rightRotate($w[$i - 15], 18) ^
498
-                      $this->_rightShift( $w[$i - 15],  3);
498
+                      $this->_rightShift($w[$i - 15], 3);
499 499
                 $s1 = $this->_rightRotate($w[$i - 2], 17) ^
500 500
                       $this->_rightRotate($w[$i - 2], 19) ^
501
-                      $this->_rightShift( $w[$i - 2], 10);
501
+                      $this->_rightShift($w[$i - 2], 10);
502 502
                 $w[$i] = $this->_add($w[$i - 16], $s0, $w[$i - 7], $s1);
503 503
 
504 504
             }
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
 
509 509
             // Main loop
510 510
             for ($i = 0; $i < 64; $i++) {
511
-                $s0 = $this->_rightRotate($a,  2) ^
511
+                $s0 = $this->_rightRotate($a, 2) ^
512 512
                       $this->_rightRotate($a, 13) ^
513 513
                       $this->_rightRotate($a, 22);
514 514
                 $maj = ($a & $b) ^
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
                        ($b & $c);
517 517
                 $t2 = $this->_add($s0, $maj);
518 518
 
519
-                $s1 = $this->_rightRotate($e,  6) ^
519
+                $s1 = $this->_rightRotate($e, 6) ^
520 520
                       $this->_rightRotate($e, 11) ^
521 521
                       $this->_rightRotate($e, 25);
522 522
                 $ch = ($e & $f) ^
@@ -617,10 +617,10 @@  discard block
 block discarded – undo
617 617
         // Pre-processing
618 618
         $length = strlen($m);
619 619
         // to round to nearest 112 mod 128, we'll add 128 - (length + (128 - 112)) % 128
620
-        $m.= str_repeat(chr(0), 128 - (($length + 16) & 0x7F));
620
+        $m .= str_repeat(chr(0), 128 - (($length + 16) & 0x7F));
621 621
         $m[$length] = chr(0x80);
622 622
         // we don't support hashing strings 512MB long
623
-        $m.= pack('N4', 0, 0, 0, $length << 3);
623
+        $m .= pack('N4', 0, 0, 0, $length << 3);
624 624
 
625 625
         // Process the message in successive 1024-bit chunks
626 626
         $chunks = str_split($m, 128);
@@ -724,10 +724,10 @@  discard block
 block discarded – undo
724 724
 
725 725
         // Produce the final hash value (big-endian)
726 726
         // (Crypt_Hash::hash() trims the output for hashes but not for HMACs.  as such, we trim the output here)
727
-        $temp = $hash[0]->toBytes() . $hash[1]->toBytes() . $hash[2]->toBytes() . $hash[3]->toBytes() .
728
-                $hash[4]->toBytes() . $hash[5]->toBytes();
727
+        $temp = $hash[0]->toBytes().$hash[1]->toBytes().$hash[2]->toBytes().$hash[3]->toBytes().
728
+                $hash[4]->toBytes().$hash[5]->toBytes();
729 729
         if ($this->l != 48) {
730
-            $temp.= $hash[6]->toBytes() . $hash[7]->toBytes();
730
+            $temp .= $hash[6]->toBytes().$hash[7]->toBytes();
731 731
         }
732 732
 
733 733
         return $temp;
@@ -798,7 +798,7 @@  discard block
 block discarded – undo
798 798
         $result = 0;
799 799
         $arguments = func_get_args();
800 800
         foreach ($arguments as $argument) {
801
-            $result+= $argument < 0 ? ($argument & 0x7FFFFFFF) + 0x80000000 : $argument;
801
+            $result += $argument < 0 ? ($argument & 0x7FFFFFFF) + 0x80000000 : $argument;
802 802
         }
803 803
 
804 804
         return fmod($result, $mod);
Please login to merge, or discard this patch.