Completed
Push — 1.10.x ( 501d19...0db498 )
by Yannick
89:35 queued 49:03
created
main/inc/lib/pear/OLE/PPS/Root.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
     *
66 66
     * @access public
67 67
     * @param string $dir The dir to be used as temp dir
68
-    * @return true if given dir is valid, false otherwise
68
+    * @return boolean if given dir is valid, false otherwise
69 69
     */
70 70
     function setTempDir($dir)
71 71
     {
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
     *
143 143
     * @access private
144 144
     * @param array $raList Reference to an array of PPS's
145
-    * @return array The array of numbers
145
+    * @return double[] The array of numbers
146 146
     */
147 147
     function _calcSize(&$raList)
148 148
     {
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
     * @access private
181 181
     * @param integer $i2 The argument
182 182
     * @see save()
183
-    * @return integer
183
+    * @return double
184 184
     */
185 185
     function _adjust2($i2)
186 186
     {
Please login to merge, or discard this patch.
Indentation   +101 added lines, -101 removed lines patch added patch discarded remove patch
@@ -32,41 +32,41 @@  discard block
 block discarded – undo
32 32
 class OLE_PPS_Root extends OLE_PPS
33 33
 {
34 34
     /**
35
-    * The temporary dir for storing the OLE file
36
-    * @var string
37
-    */
35
+     * The temporary dir for storing the OLE file
36
+     * @var string
37
+     */
38 38
     var $_tmp_dir;
39 39
 
40 40
     /**
41
-    * Constructor
42
-    *
43
-    * @access public
44
-    * @param integer $time_1st A timestamp
45
-    * @param integer $time_2nd A timestamp
46
-    */
41
+     * Constructor
42
+     *
43
+     * @access public
44
+     * @param integer $time_1st A timestamp
45
+     * @param integer $time_2nd A timestamp
46
+     */
47 47
     function OLE_PPS_Root($time_1st, $time_2nd, $raChild)
48 48
     {
49 49
         $this->_tmp_dir = '';
50 50
         $this->OLE_PPS(
51
-           null,
52
-           OLE::Asc2Ucs('Root Entry'),
53
-           OLE_PPS_TYPE_ROOT,
54
-           null,
55
-           null,
56
-           null,
57
-           $time_1st,
58
-           $time_2nd,
59
-           null,
60
-           $raChild);
51
+            null,
52
+            OLE::Asc2Ucs('Root Entry'),
53
+            OLE_PPS_TYPE_ROOT,
54
+            null,
55
+            null,
56
+            null,
57
+            $time_1st,
58
+            $time_2nd,
59
+            null,
60
+            $raChild);
61 61
     }
62 62
 
63 63
     /**
64
-    * Sets the temp dir used for storing the OLE file
65
-    *
66
-    * @access public
67
-    * @param string $dir The dir to be used as temp dir
68
-    * @return true if given dir is valid, false otherwise
69
-    */
64
+     * Sets the temp dir used for storing the OLE file
65
+     *
66
+     * @access public
67
+     * @param string $dir The dir to be used as temp dir
68
+     * @return true if given dir is valid, false otherwise
69
+     */
70 70
     function setTempDir($dir)
71 71
     {
72 72
         if (is_dir($dir)) {
@@ -77,21 +77,21 @@  discard block
 block discarded – undo
77 77
     }
78 78
 
79 79
     /**
80
-    * Method for saving the whole OLE container (including files).
81
-    * In fact, if called with an empty argument (or '-'), it saves to a
82
-    * temporary file and then outputs it's contents to stdout.
83
-    *
84
-    * @param string $filename The name of the file where to save the OLE container
85
-    * @access public
86
-    * @return mixed true on success, PEAR_Error on failure
87
-    */
80
+     * Method for saving the whole OLE container (including files).
81
+     * In fact, if called with an empty argument (or '-'), it saves to a
82
+     * temporary file and then outputs it's contents to stdout.
83
+     *
84
+     * @param string $filename The name of the file where to save the OLE container
85
+     * @access public
86
+     * @return mixed true on success, PEAR_Error on failure
87
+     */
88 88
     function save($filename)
89 89
     {
90 90
         // Initial Setting for saving
91 91
         $this->_BIG_BLOCK_SIZE  = pow(2,
92
-                      ((isset($this->_BIG_BLOCK_SIZE))? $this->_adjust2($this->_BIG_BLOCK_SIZE)  : 9));
92
+                        ((isset($this->_BIG_BLOCK_SIZE))? $this->_adjust2($this->_BIG_BLOCK_SIZE)  : 9));
93 93
         $this->_SMALL_BLOCK_SIZE= pow(2,
94
-                      ((isset($this->_SMALL_BLOCK_SIZE))?  $this->_adjust2($this->_SMALL_BLOCK_SIZE): 6));
94
+                        ((isset($this->_SMALL_BLOCK_SIZE))?  $this->_adjust2($this->_SMALL_BLOCK_SIZE): 6));
95 95
 
96 96
         // Open temp file if we are sending output to stdout
97 97
         if (($filename == '-') || ($filename == '')) {
@@ -138,12 +138,12 @@  discard block
 block discarded – undo
138 138
     }
139 139
 
140 140
     /**
141
-    * Calculate some numbers
142
-    *
143
-    * @access private
144
-    * @param array $raList Reference to an array of PPS's
145
-    * @return array The array of numbers
146
-    */
141
+     * Calculate some numbers
142
+     *
143
+     * @access private
144
+     * @param array $raList Reference to an array of PPS's
145
+     * @return array The array of numbers
146
+     */
147 147
     function _calcSize(&$raList)
148 148
     {
149 149
         // Calculate Basic Setting
@@ -175,13 +175,13 @@  discard block
 block discarded – undo
175 175
     }
176 176
 
177 177
     /**
178
-    * Helper function for caculating a magic value for block sizes
179
-    *
180
-    * @access private
181
-    * @param integer $i2 The argument
182
-    * @see save()
183
-    * @return integer
184
-    */
178
+     * Helper function for caculating a magic value for block sizes
179
+     *
180
+     * @access private
181
+     * @param integer $i2 The argument
182
+     * @see save()
183
+     * @return integer
184
+     */
185 185
     function _adjust2($i2)
186 186
     {
187 187
         $iWk = log($i2)/log(2);
@@ -189,13 +189,13 @@  discard block
 block discarded – undo
189 189
     }
190 190
 
191 191
     /**
192
-    * Save OLE header
193
-    *
194
-    * @access private
195
-    * @param integer $iSBDcnt
196
-    * @param integer $iBBcnt
197
-    * @param integer $iPPScnt
198
-    */
192
+     * Save OLE header
193
+     *
194
+     * @access private
195
+     * @param integer $iSBDcnt
196
+     * @param integer $iBBcnt
197
+     * @param integer $iPPScnt
198
+     */
199 199
     function _saveHeader($iSBDcnt, $iBBcnt, $iPPScnt)
200 200
     {
201 201
         $FILE = $this->_FILEH_;
@@ -225,32 +225,32 @@  discard block
 block discarded – undo
225 225
 
226 226
         // Save Header
227 227
         fwrite($FILE,
228
-                  "\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1"
229
-                  . "\x00\x00\x00\x00"
230
-                  . "\x00\x00\x00\x00"
231
-                  . "\x00\x00\x00\x00"
232
-                  . "\x00\x00\x00\x00"
233
-                  . pack("v", 0x3b)
234
-                  . pack("v", 0x03)
235
-                  . pack("v", -2)
236
-                  . pack("v", 9)
237
-                  . pack("v", 6)
238
-                  . pack("v", 0)
239
-                  . "\x00\x00\x00\x00"
240
-                  . "\x00\x00\x00\x00"
241
-                  . pack("V", $iBdCnt)
242
-                  . pack("V", $iBBcnt+$iSBDcnt) //ROOT START
243
-                  . pack("V", 0)
244
-                  . pack("V", 0x1000)
245
-                  . pack("V", 0)                  //Small Block Depot
246
-                  . pack("V", 1)
247
-          );
228
+                    "\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1"
229
+                    . "\x00\x00\x00\x00"
230
+                    . "\x00\x00\x00\x00"
231
+                    . "\x00\x00\x00\x00"
232
+                    . "\x00\x00\x00\x00"
233
+                    . pack("v", 0x3b)
234
+                    . pack("v", 0x03)
235
+                    . pack("v", -2)
236
+                    . pack("v", 9)
237
+                    . pack("v", 6)
238
+                    . pack("v", 0)
239
+                    . "\x00\x00\x00\x00"
240
+                    . "\x00\x00\x00\x00"
241
+                    . pack("V", $iBdCnt)
242
+                    . pack("V", $iBBcnt+$iSBDcnt) //ROOT START
243
+                    . pack("V", 0)
244
+                    . pack("V", 0x1000)
245
+                    . pack("V", 0)                  //Small Block Depot
246
+                    . pack("V", 1)
247
+            );
248 248
         // Extra BDList Start, Count
249 249
         if ($iBdCnt < $i1stBdL) {
250 250
             fwrite($FILE,
251
-                      pack("V", -2).      // Extra BDList Start
252
-                      pack("V", 0)        // Extra BDList Count
253
-                  );
251
+                        pack("V", -2).      // Extra BDList Start
252
+                        pack("V", 0)        // Extra BDList Count
253
+                    );
254 254
         } else {
255 255
             fwrite($FILE, pack("V", $iAll+$iBdCnt) . pack("V", $iBdExL));
256 256
         }
@@ -267,12 +267,12 @@  discard block
 block discarded – undo
267 267
     }
268 268
 
269 269
     /**
270
-    * Saving big data (PPS's with data bigger than OLE_DATA_SIZE_SMALL)
271
-    *
272
-    * @access private
273
-    * @param integer $iStBlk
274
-    * @param array &$raList Reference to array of PPS's
275
-    */
270
+     * Saving big data (PPS's with data bigger than OLE_DATA_SIZE_SMALL)
271
+     *
272
+     * @access private
273
+     * @param integer $iStBlk
274
+     * @param array &$raList Reference to array of PPS's
275
+     */
276 276
     function _saveBigData($iStBlk, &$raList)
277 277
     {
278 278
         $FILE = $this->_FILEH_;
@@ -318,11 +318,11 @@  discard block
 block discarded – undo
318 318
     }
319 319
 
320 320
     /**
321
-    * get small data (PPS's with data smaller than OLE_DATA_SIZE_SMALL)
322
-    *
323
-    * @access private
324
-    * @param array &$raList Reference to array of PPS's
325
-    */
321
+     * get small data (PPS's with data smaller than OLE_DATA_SIZE_SMALL)
322
+     *
323
+     * @access private
324
+     * @param array &$raList Reference to array of PPS's
325
+     */
326 326
     function _makeSmallData(&$raList)
327 327
     {
328 328
         $sRes = '';
@@ -374,11 +374,11 @@  discard block
 block discarded – undo
374 374
     }
375 375
 
376 376
     /**
377
-    * Saves all the PPS's WKs
378
-    *
379
-    * @access private
380
-    * @param array $raList Reference to an array with all PPS's
381
-    */
377
+     * Saves all the PPS's WKs
378
+     *
379
+     * @access private
380
+     * @param array $raList Reference to an array with all PPS's
381
+     */
382 382
     function _savePps(&$raList)
383 383
     {
384 384
         // Save each PPS WK
@@ -396,13 +396,13 @@  discard block
 block discarded – undo
396 396
     }
397 397
 
398 398
     /**
399
-    * Saving Big Block Depot
400
-    *
401
-    * @access private
402
-    * @param integer $iSbdSize
403
-    * @param integer $iBsize
404
-    * @param integer $iPpsCnt
405
-    */
399
+     * Saving Big Block Depot
400
+     *
401
+     * @access private
402
+     * @param integer $iSbdSize
403
+     * @param integer $iBsize
404
+     * @param integer $iPpsCnt
405
+     */
406 406
     function _saveBbd($iSbdSize, $iBsize, $iPpsCnt)
407 407
     {
408 408
         $FILE = $this->_FILEH_;
Please login to merge, or discard this patch.
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -89,14 +89,14 @@  discard block
 block discarded – undo
89 89
     {
90 90
         // Initial Setting for saving
91 91
         $this->_BIG_BLOCK_SIZE  = pow(2,
92
-                      ((isset($this->_BIG_BLOCK_SIZE))? $this->_adjust2($this->_BIG_BLOCK_SIZE)  : 9));
93
-        $this->_SMALL_BLOCK_SIZE= pow(2,
94
-                      ((isset($this->_SMALL_BLOCK_SIZE))?  $this->_adjust2($this->_SMALL_BLOCK_SIZE): 6));
92
+                      ((isset($this->_BIG_BLOCK_SIZE)) ? $this->_adjust2($this->_BIG_BLOCK_SIZE) : 9));
93
+        $this->_SMALL_BLOCK_SIZE = pow(2,
94
+                      ((isset($this->_SMALL_BLOCK_SIZE)) ? $this->_adjust2($this->_SMALL_BLOCK_SIZE) : 6));
95 95
 
96 96
         // Open temp file if we are sending output to stdout
97 97
         if (($filename == '-') || ($filename == '')) {
98 98
             $this->_tmp_filename = tempnam($this->_tmp_dir, "OLE_PPS_Root");
99
-            $this->_FILEH_ = @fopen($this->_tmp_filename,"w+b");
99
+            $this->_FILEH_ = @fopen($this->_tmp_filename, "w+b");
100 100
             if ($this->_FILEH_ == false) {
101 101
                 return $this->raiseError("Can't create temporary file.");
102 102
             }
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
     function _calcSize(&$raList)
148 148
     {
149 149
         // Calculate Basic Setting
150
-        list($iSBDcnt, $iBBcnt, $iPPScnt) = array(0,0,0);
150
+        list($iSBDcnt, $iBBcnt, $iPPScnt) = array(0, 0, 0);
151 151
         $iSmallLen = 0;
152 152
         $iSBcnt = 0;
153 153
         for ($i = 0; $i < count($raList); $i++) {
@@ -155,21 +155,21 @@  discard block
 block discarded – undo
155 155
                 $raList[$i]->Size = $raList[$i]->_DataLen();
156 156
                 if ($raList[$i]->Size < OLE_DATA_SIZE_SMALL) {
157 157
                     $iSBcnt += floor($raList[$i]->Size / $this->_SMALL_BLOCK_SIZE)
158
-                                  + (($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE)? 1: 0);
158
+                                  + (($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE) ? 1 : 0);
159 159
                 } else {
160 160
                     $iBBcnt += (floor($raList[$i]->Size / $this->_BIG_BLOCK_SIZE) +
161
-                        (($raList[$i]->Size % $this->_BIG_BLOCK_SIZE)? 1: 0));
161
+                        (($raList[$i]->Size % $this->_BIG_BLOCK_SIZE) ? 1 : 0));
162 162
                 }
163 163
             }
164 164
         }
165 165
         $iSmallLen = $iSBcnt * $this->_SMALL_BLOCK_SIZE;
166 166
         $iSlCnt = floor($this->_BIG_BLOCK_SIZE / OLE_LONG_INT_SIZE);
167
-        $iSBDcnt = floor($iSBcnt / $iSlCnt) + (($iSBcnt % $iSlCnt)? 1:0);
168
-        $iBBcnt +=  (floor($iSmallLen / $this->_BIG_BLOCK_SIZE) +
169
-                      (( $iSmallLen % $this->_BIG_BLOCK_SIZE)? 1: 0));
167
+        $iSBDcnt = floor($iSBcnt / $iSlCnt) + (($iSBcnt % $iSlCnt) ? 1 : 0);
168
+        $iBBcnt += (floor($iSmallLen / $this->_BIG_BLOCK_SIZE) +
169
+                      (($iSmallLen % $this->_BIG_BLOCK_SIZE) ? 1 : 0));
170 170
         $iCnt = count($raList);
171 171
         $iBdCnt = $this->_BIG_BLOCK_SIZE / OLE_PPS_SIZE;
172
-        $iPPScnt = (floor($iCnt/$iBdCnt) + (($iCnt % $iBdCnt)? 1: 0));
172
+        $iPPScnt = (floor($iCnt / $iBdCnt) + (($iCnt % $iBdCnt) ? 1 : 0));
173 173
 
174 174
         return array($iSBDcnt, $iBBcnt, $iPPScnt);
175 175
     }
@@ -184,8 +184,8 @@  discard block
 block discarded – undo
184 184
     */
185 185
     function _adjust2($i2)
186 186
     {
187
-        $iWk = log($i2)/log(2);
188
-        return ($iWk > floor($iWk))? floor($iWk)+1:$iWk;
187
+        $iWk = log($i2) / log(2);
188
+        return ($iWk > floor($iWk)) ? floor($iWk) + 1 : $iWk;
189 189
     }
190 190
 
191 191
     /**
@@ -207,17 +207,17 @@  discard block
 block discarded – undo
207 207
         $iBdExL = 0;
208 208
         $iAll = $iBBcnt + $iPPScnt + $iSBDcnt;
209 209
         $iAllW = $iAll;
210
-        $iBdCntW = floor($iAllW / $iBlCnt) + (($iAllW % $iBlCnt)? 1: 0);
211
-        $iBdCnt = floor(($iAll + $iBdCntW) / $iBlCnt) + ((($iAllW+$iBdCntW) % $iBlCnt)? 1: 0);
210
+        $iBdCntW = floor($iAllW / $iBlCnt) + (($iAllW % $iBlCnt) ? 1 : 0);
211
+        $iBdCnt = floor(($iAll + $iBdCntW) / $iBlCnt) + ((($iAllW + $iBdCntW) % $iBlCnt) ? 1 : 0);
212 212
 
213 213
         // Calculate BD count
214 214
         if ($iBdCnt > $i1stBdL) {
215 215
             while (1) {
216 216
                 $iBdExL++;
217 217
                 $iAllW++;
218
-                $iBdCntW = floor($iAllW / $iBlCnt) + (($iAllW % $iBlCnt)? 1: 0);
219
-                $iBdCnt = floor(($iAllW + $iBdCntW) / $iBlCnt) + ((($iAllW+$iBdCntW) % $iBlCnt)? 1: 0);
220
-                if ($iBdCnt <= ($iBdExL*$iBlCnt+ $i1stBdL)) {
218
+                $iBdCntW = floor($iAllW / $iBlCnt) + (($iAllW % $iBlCnt) ? 1 : 0);
219
+                $iBdCnt = floor(($iAllW + $iBdCntW) / $iBlCnt) + ((($iAllW + $iBdCntW) % $iBlCnt) ? 1 : 0);
220
+                if ($iBdCnt <= ($iBdExL * $iBlCnt + $i1stBdL)) {
221 221
                     break;
222 222
                 }
223 223
             }
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
                   . "\x00\x00\x00\x00"
240 240
                   . "\x00\x00\x00\x00"
241 241
                   . pack("V", $iBdCnt)
242
-                  . pack("V", $iBBcnt+$iSBDcnt) //ROOT START
242
+                  . pack("V", $iBBcnt + $iSBDcnt) //ROOT START
243 243
                   . pack("V", 0)
244 244
                   . pack("V", 0x1000)
245 245
                   . pack("V", 0)                  //Small Block Depot
@@ -248,19 +248,19 @@  discard block
 block discarded – undo
248 248
         // Extra BDList Start, Count
249 249
         if ($iBdCnt < $i1stBdL) {
250 250
             fwrite($FILE,
251
-                      pack("V", -2).      // Extra BDList Start
251
+                      pack("V", -2).// Extra BDList Start
252 252
                       pack("V", 0)        // Extra BDList Count
253 253
                   );
254 254
         } else {
255
-            fwrite($FILE, pack("V", $iAll+$iBdCnt) . pack("V", $iBdExL));
255
+            fwrite($FILE, pack("V", $iAll + $iBdCnt).pack("V", $iBdExL));
256 256
         }
257 257
 
258 258
         // BDList
259 259
         for ($i = 0; $i < $i1stBdL && $i < $iBdCnt; $i++) {
260
-            fwrite($FILE, pack("V", $iAll+$i));
260
+            fwrite($FILE, pack("V", $iAll + $i));
261 261
         }
262 262
         if ($i < $i1stBdL) {
263
-            for ($j = 0; $j < ($i1stBdL-$i); $j++) {
263
+            for ($j = 0; $j < ($i1stBdL - $i); $j++) {
264 264
                 fwrite($FILE, (pack("V", -1)));
265 265
             }
266 266
         }
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
                     if (isset($raList[$i]->_PPS_FILE)) {
289 289
                         $iLen = 0;
290 290
                         fseek($raList[$i]->_PPS_FILE, 0); // To The Top
291
-                        while($sBuff = fread($raList[$i]->_PPS_FILE, 4096)) {
291
+                        while ($sBuff = fread($raList[$i]->_PPS_FILE, 4096)) {
292 292
                             $iLen += strlen($sBuff);
293 293
                             fwrite($FILE, $sBuff);
294 294
                         }
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
                     $raList[$i]->_StartBlock = $iStBlk;
306 306
                     $iStBlk +=
307 307
                             (floor($raList[$i]->Size / $this->_BIG_BLOCK_SIZE) +
308
-                                (($raList[$i]->Size % $this->_BIG_BLOCK_SIZE)? 1: 0));
308
+                                (($raList[$i]->Size % $this->_BIG_BLOCK_SIZE) ? 1 : 0));
309 309
                 }
310 310
                 // Close file for each PPS, and unlink it
311 311
                 if (isset($raList[$i]->_PPS_FILE)) {
@@ -337,10 +337,10 @@  discard block
 block discarded – undo
337 337
                 }
338 338
                 if ($raList[$i]->Size < OLE_DATA_SIZE_SMALL) {
339 339
                     $iSmbCnt = floor($raList[$i]->Size / $this->_SMALL_BLOCK_SIZE)
340
-                                  + (($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE)? 1: 0);
340
+                                  + (($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE) ? 1 : 0);
341 341
                     // Add to SBD
342
-                    for ($j = 0; $j < ($iSmbCnt-1); $j++) {
343
-                        fwrite($FILE, pack("V", $j+$iSmBlk+1));
342
+                    for ($j = 0; $j < ($iSmbCnt - 1); $j++) {
343
+                        fwrite($FILE, pack("V", $j + $iSmBlk + 1));
344 344
                     }
345 345
                     fwrite($FILE, pack("V", -2));
346 346
 
@@ -413,16 +413,16 @@  discard block
 block discarded – undo
413 413
         $iBdExL = 0;
414 414
         $iAll = $iBsize + $iPpsCnt + $iSbdSize;
415 415
         $iAllW = $iAll;
416
-        $iBdCntW = floor($iAllW / $iBbCnt) + (($iAllW % $iBbCnt)? 1: 0);
417
-        $iBdCnt = floor(($iAll + $iBdCntW) / $iBbCnt) + ((($iAllW+$iBdCntW) % $iBbCnt)? 1: 0);
416
+        $iBdCntW = floor($iAllW / $iBbCnt) + (($iAllW % $iBbCnt) ? 1 : 0);
417
+        $iBdCnt = floor(($iAll + $iBdCntW) / $iBbCnt) + ((($iAllW + $iBdCntW) % $iBbCnt) ? 1 : 0);
418 418
         // Calculate BD count
419
-        if ($iBdCnt >$i1stBdL) {
419
+        if ($iBdCnt > $i1stBdL) {
420 420
             while (1) {
421 421
                 $iBdExL++;
422 422
                 $iAllW++;
423
-                $iBdCntW = floor($iAllW / $iBbCnt) + (($iAllW % $iBbCnt)? 1: 0);
424
-                $iBdCnt = floor(($iAllW + $iBdCntW) / $iBbCnt) + ((($iAllW+$iBdCntW) % $iBbCnt)? 1: 0);
425
-                if ($iBdCnt <= ($iBdExL*$iBbCnt+ $i1stBdL)) {
423
+                $iBdCntW = floor($iAllW / $iBbCnt) + (($iAllW % $iBbCnt) ? 1 : 0);
424
+                $iBdCnt = floor(($iAllW + $iBdCntW) / $iBbCnt) + ((($iAllW + $iBdCntW) % $iBbCnt) ? 1 : 0);
425
+                if ($iBdCnt <= ($iBdExL * $iBbCnt + $i1stBdL)) {
426 426
                     break;
427 427
                 }
428 428
             }
@@ -432,19 +432,19 @@  discard block
 block discarded – undo
432 432
         // Set for SBD
433 433
         if ($iSbdSize > 0) {
434 434
             for ($i = 0; $i < ($iSbdSize - 1); $i++) {
435
-                fwrite($FILE, pack("V", $i+1));
435
+                fwrite($FILE, pack("V", $i + 1));
436 436
             }
437 437
             fwrite($FILE, pack("V", -2));
438 438
         }
439 439
         // Set for B
440 440
         for ($i = 0; $i < ($iBsize - 1); $i++) {
441
-            fwrite($FILE, pack("V", $i+$iSbdSize+1));
441
+            fwrite($FILE, pack("V", $i + $iSbdSize + 1));
442 442
         }
443 443
         fwrite($FILE, pack("V", -2));
444 444
 
445 445
         // Set for PPS
446 446
         for ($i = 0; $i < ($iPpsCnt - 1); $i++) {
447
-            fwrite($FILE, pack("V", $i+$iSbdSize+$iBsize+1));
447
+            fwrite($FILE, pack("V", $i + $iSbdSize + $iBsize + 1));
448 448
         }
449 449
         fwrite($FILE, pack("V", -2));
450 450
         // Set for BBD itself ( 0xFFFFFFFD : BBD)
@@ -463,17 +463,17 @@  discard block
 block discarded – undo
463 463
         }
464 464
         // Extra BDList
465 465
         if ($iBdCnt > $i1stBdL) {
466
-            $iN=0;
467
-            $iNb=0;
468
-            for ($i = $i1stBdL;$i < $iBdCnt; $i++, $iN++) {
466
+            $iN = 0;
467
+            $iNb = 0;
468
+            for ($i = $i1stBdL; $i < $iBdCnt; $i++, $iN++) {
469 469
                 if ($iN >= ($iBbCnt - 1)) {
470 470
                     $iN = 0;
471 471
                     $iNb++;
472
-                    fwrite($FILE, pack("V", $iAll+$iBdCnt+$iNb));
472
+                    fwrite($FILE, pack("V", $iAll + $iBdCnt + $iNb));
473 473
                 }
474
-                fwrite($FILE, pack("V", $iBsize+$iSbdSize+$iPpsCnt+$i));
474
+                fwrite($FILE, pack("V", $iBsize + $iSbdSize + $iPpsCnt + $i));
475 475
             }
476
-            if (($iBdCnt-$i1stBdL) % ($iBbCnt-1)) {
476
+            if (($iBdCnt - $i1stBdL) % ($iBbCnt - 1)) {
477 477
                 for ($i = 0; $i < (($iBbCnt - 1) - (($iBdCnt - $i1stBdL) % ($iBbCnt - 1))); $i++) {
478 478
                     fwrite($FILE, pack("V", -1));
479 479
                 }
Please login to merge, or discard this patch.
main/inc/lib/pear/Pager/Common.php 3 patches
Doc Comments   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
      *
593 593
      * @param integer $index Offset to get pageID for
594 594
      *
595
-     * @return integer PageID for given offset
595
+     * @return PEAR_Error PageID for given offset
596 596
      * @access public
597 597
      */
598 598
     function getPageIdByOffset($index)
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
      *
613 613
      * @param integer $pageID PageID to get offsets for
614 614
      *
615
-     * @return array  First and last offsets
615
+     * @return integer[]  First and last offsets
616 616
      * @access public
617 617
      */
618 618
     function getOffsetByPageId($pageID = null)
@@ -639,7 +639,7 @@  discard block
 block discarded – undo
639 639
      *
640 640
      * @param integer $pageID PageID to get offsets for
641 641
      *
642
-     * @return array First and last offsets
642
+     * @return PEAR_Error First and last offsets
643 643
      * @access public
644 644
      */
645 645
     function getPageRangeByPageId($pageID = null)
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
      * @param string  $next_html HTML to put inside the next link
669 669
      *                           [deprecated: use the factory instead]
670 670
      *
671
-     * @return array back/next/first/last and page links
671
+     * @return PEAR_Error back/next/first/last and page links
672 672
      * @access public
673 673
      */
674 674
     function getLinks($pageID=null, $next_html='')
@@ -698,7 +698,7 @@  discard block
 block discarded – undo
698 698
      * Returns next page ID. If current page is last page
699 699
      * this function returns FALSE
700 700
      *
701
-     * @return mixed Next page ID or false
701
+     * @return integer Next page ID or false
702 702
      * @access public
703 703
      */
704 704
     function getNextPageID()
@@ -713,7 +713,7 @@  discard block
 block discarded – undo
713 713
      * Returns previous page ID. If current page is first page
714 714
      * this function returns FALSE
715 715
      *
716
-     * @return mixed Previous page ID or false
716
+     * @return integer Previous page ID or false
717 717
      * @access public
718 718
      */
719 719
     function getPreviousPageID()
@@ -994,7 +994,7 @@  discard block
 block discarded – undo
994 994
      *
995 995
      * @param string $string the pattern to check
996 996
      *
997
-     * @return boolean
997
+     * @return integer
998 998
      * @access private
999 999
      */
1000 1000
     function _isRegexp($string) {
@@ -1136,7 +1136,7 @@  discard block
 block discarded – undo
1136 1136
      *
1137 1137
      * @param string $url URL to use in the link [deprecated: use the factory instead]
1138 1138
      *
1139
-     * @return string Links
1139
+     * @return PEAR_Error Links
1140 1140
      * @access private
1141 1141
      */
1142 1142
     function _getPageLinks($url='')
Please login to merge, or discard this patch.
Spacing   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -61,12 +61,12 @@  discard block
 block discarded – undo
61 61
 /**
62 62
  * Error codes
63 63
  */
64
-define('PAGER_OK',                         0);
65
-define('ERROR_PAGER',                     -1);
66
-define('ERROR_PAGER_INVALID',             -2);
64
+define('PAGER_OK', 0);
65
+define('ERROR_PAGER', -1);
66
+define('ERROR_PAGER_INVALID', -2);
67 67
 define('ERROR_PAGER_INVALID_PLACEHOLDER', -3);
68
-define('ERROR_PAGER_INVALID_USAGE',       -4);
69
-define('ERROR_PAGER_NOT_IMPLEMENTED',     -5);
68
+define('ERROR_PAGER_INVALID_USAGE', -4);
69
+define('ERROR_PAGER_NOT_IMPLEMENTED', -5);
70 70
 
71 71
 /**
72 72
  * Pager_Common - Common base class for [Sliding|Jumping] Window Pager
@@ -94,13 +94,13 @@  discard block
 block discarded – undo
94 94
      * @var integer number of items per page
95 95
      * @access private
96 96
      */
97
-    var $_perPage     = 10;
97
+    var $_perPage = 10;
98 98
 
99 99
     /**
100 100
      * @var integer number of page links for each window
101 101
      * @access private
102 102
      */
103
-    var $_delta       = 10;
103
+    var $_delta = 10;
104 104
 
105 105
     /**
106 106
      * @var integer current page number
@@ -112,13 +112,13 @@  discard block
 block discarded – undo
112 112
      * @var integer total pages number
113 113
      * @access private
114 114
      */
115
-    var $_totalPages  = 1;
115
+    var $_totalPages = 1;
116 116
 
117 117
     /**
118 118
      * @var string CSS class for links
119 119
      * @access private
120 120
      */
121
-    var $_linkClass   = '';
121
+    var $_linkClass = '';
122 122
 
123 123
     /**
124 124
      * @var string wrapper for CSS class name
@@ -130,13 +130,13 @@  discard block
 block discarded – undo
130 130
      * @var string path name
131 131
      * @access private
132 132
      */
133
-    var $_path        = PAGER_CURRENT_PATHNAME;
133
+    var $_path = PAGER_CURRENT_PATHNAME;
134 134
 
135 135
     /**
136 136
      * @var string file name
137 137
      * @access private
138 138
      */
139
-    var $_fileName    = PAGER_CURRENT_FILENAME;
139
+    var $_fileName = PAGER_CURRENT_FILENAME;
140 140
 
141 141
     /**
142 142
      * @var boolean If false, don't override the fileName option. Use at your own risk.
@@ -148,19 +148,19 @@  discard block
 block discarded – undo
148 148
      * @var boolean you have to use FALSE with mod_rewrite
149 149
      * @access private
150 150
      */
151
-    var $_append      = true;
151
+    var $_append = true;
152 152
 
153 153
     /**
154 154
      * @var string specifies which HTTP method to use
155 155
      * @access private
156 156
      */
157
-    var $_httpMethod  = 'GET';
157
+    var $_httpMethod = 'GET';
158 158
 
159 159
     /**
160 160
      * @var string specifies which HTML form to use
161 161
      * @access private
162 162
      */
163
-    var $_formID      = '';
163
+    var $_formID = '';
164 164
 
165 165
     /**
166 166
      * @var boolean whether or not to import submitted data
@@ -172,19 +172,19 @@  discard block
 block discarded – undo
172 172
      * @var string name of the querystring var for pageID
173 173
      * @access private
174 174
      */
175
-    var $_urlVar      = 'pageID';
175
+    var $_urlVar = 'pageID';
176 176
 
177 177
     /**
178 178
      * @var array data to pass through the link
179 179
      * @access private
180 180
      */
181
-    var $_linkData    = array();
181
+    var $_linkData = array();
182 182
 
183 183
     /**
184 184
      * @var array additional URL vars
185 185
      * @access private
186 186
      */
187
-    var $_extraVars   = array();
187
+    var $_extraVars = array();
188 188
 
189 189
     /**
190 190
      * @var array URL vars to ignore
@@ -196,19 +196,19 @@  discard block
 block discarded – undo
196 196
      * @var boolean TRUE => expanded mode (for Pager_Sliding)
197 197
      * @access private
198 198
      */
199
-    var $_expanded    = true;
199
+    var $_expanded = true;
200 200
 
201 201
     /**
202 202
      * @var boolean TRUE => show accesskey attribute on <a> tags
203 203
      * @access private
204 204
      */
205
-    var $_accesskey   = false;
205
+    var $_accesskey = false;
206 206
 
207 207
     /**
208 208
      * @var string extra attributes for the <a> tag
209 209
      * @access private
210 210
      */
211
-    var $_attributes  = '';
211
+    var $_attributes = '';
212 212
 
213 213
     /**
214 214
      * @var string onclick
@@ -220,37 +220,37 @@  discard block
 block discarded – undo
220 220
      * @var string alt text for "first page" (use "%d" placeholder for page number)
221 221
      * @access private
222 222
      */
223
-    var $_altFirst     = 'first page';
223
+    var $_altFirst = 'first page';
224 224
 
225 225
     /**
226 226
      * @var string alt text for "previous page"
227 227
      * @access private
228 228
      */
229
-    var $_altPrev     = 'previous page';
229
+    var $_altPrev = 'previous page';
230 230
 
231 231
     /**
232 232
      * @var string alt text for "next page"
233 233
      * @access private
234 234
      */
235
-    var $_altNext     = 'next page';
235
+    var $_altNext = 'next page';
236 236
 
237 237
     /**
238 238
      * @var string alt text for "last page" (use "%d" placeholder for page number)
239 239
      * @access private
240 240
      */
241
-    var $_altLast     = 'last page';
241
+    var $_altLast = 'last page';
242 242
 
243 243
     /**
244 244
      * @var string alt text for "page" (use optional "%d" placeholder for page number)
245 245
      * @access private
246 246
      */
247
-    var $_altPage     = 'page';
247
+    var $_altPage = 'page';
248 248
 
249 249
     /**
250 250
      * @var string image/text to use as "prev" link
251 251
      * @access private
252 252
      */
253
-    var $_prevImg     = '&lt;&lt; Back';
253
+    var $_prevImg = '&lt;&lt; Back';
254 254
 
255 255
     /**
256 256
      * image/text to use as "prev" link when no prev link is needed  (e.g. on the first page)
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
      * @var string image/text to use as "next" link
266 266
      * @access private
267 267
      */
268
-    var $_nextImg     = 'Next &gt;&gt;';
268
+    var $_nextImg = 'Next &gt;&gt;';
269 269
 
270 270
     /**
271 271
      * image/text to use as "next" link when
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
      * @var string link separator
282 282
      * @access private
283 283
      */
284
-    var $_separator   = '';
284
+    var $_separator = '';
285 285
 
286 286
     /**
287 287
      * @var integer number of spaces before separator
@@ -293,31 +293,31 @@  discard block
 block discarded – undo
293 293
      * @var integer number of spaces after separator
294 294
      * @access private
295 295
      */
296
-    var $_spacesAfterSeparator  = 1;
296
+    var $_spacesAfterSeparator = 1;
297 297
 
298 298
     /**
299 299
      * @var string CSS class name for current page link
300 300
      * @access private
301 301
      */
302
-    var $_curPageLinkClassName  = '';
302
+    var $_curPageLinkClassName = '';
303 303
 
304 304
     /**
305 305
      * @var string Text before current page link
306 306
      * @access private
307 307
      */
308
-    var $_curPageSpanPre        = '';
308
+    var $_curPageSpanPre = '';
309 309
 
310 310
     /**
311 311
      * @var string Text after current page link
312 312
      * @access private
313 313
      */
314
-    var $_curPageSpanPost       = '';
314
+    var $_curPageSpanPost = '';
315 315
 
316 316
     /**
317 317
      * @var string Text before first page link
318 318
      * @access private
319 319
      */
320
-    var $_firstPagePre  = '[';
320
+    var $_firstPagePre = '[';
321 321
 
322 322
     /**
323 323
      * @var string Text to be used for first page link
@@ -335,31 +335,31 @@  discard block
 block discarded – undo
335 335
      * @var string Text before last page link
336 336
      * @access private
337 337
      */
338
-    var $_lastPagePre   = '[';
338
+    var $_lastPagePre = '[';
339 339
 
340 340
     /**
341 341
      * @var string Text to be used for last page link
342 342
      * @access private
343 343
      */
344
-    var $_lastPageText  = '';
344
+    var $_lastPageText = '';
345 345
 
346 346
     /**
347 347
      * @var string Text after last page link
348 348
      * @access private
349 349
      */
350
-    var $_lastPagePost  = ']';
350
+    var $_lastPagePost = ']';
351 351
 
352 352
     /**
353 353
      * @var string Will contain the HTML code for the spaces
354 354
      * @access private
355 355
      */
356
-    var $_spacesBefore  = '';
356
+    var $_spacesBefore = '';
357 357
 
358 358
     /**
359 359
      * @var string Will contain the HTML code for the spaces
360 360
      * @access private
361 361
      */
362
-    var $_spacesAfter   = '';
362
+    var $_spacesAfter = '';
363 363
 
364 364
     /**
365 365
      * @var string String used as title in <link rel="first"> tag
@@ -389,37 +389,37 @@  discard block
 block discarded – undo
389 389
      * @var string Text to be used for the 'show all' option in the select box
390 390
      * @access private
391 391
      */
392
-    var $_showAllText   = '';
392
+    var $_showAllText = '';
393 393
 
394 394
     /**
395 395
      * @var array data to be paged
396 396
      * @access private
397 397
      */
398
-    var $_itemData      = null;
398
+    var $_itemData = null;
399 399
 
400 400
     /**
401 401
      * @var boolean If TRUE and there's only one page, links aren't shown
402 402
      * @access private
403 403
      */
404
-    var $_clearIfVoid   = true;
404
+    var $_clearIfVoid = true;
405 405
 
406 406
     /**
407 407
      * @var boolean Use session for storing the number of items per page
408 408
      * @access private
409 409
      */
410
-    var $_useSessions   = false;
410
+    var $_useSessions = false;
411 411
 
412 412
     /**
413 413
      * @var boolean Close the session when finished reading/writing data
414 414
      * @access private
415 415
      */
416
-    var $_closeSession  = false;
416
+    var $_closeSession = false;
417 417
 
418 418
     /**
419 419
      * @var string name of the session var for number of items per page
420 420
      * @access private
421 421
      */
422
-    var $_sessionVar    = 'setPerPage';
422
+    var $_sessionVar = 'setPerPage';
423 423
 
424 424
     /**
425 425
      * Pear error mode (when raiseError is called)
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
      * @return array back/next/first/last and page links
672 672
      * @access public
673 673
      */
674
-    function getLinks($pageID=null, $next_html='')
674
+    function getLinks($pageID = null, $next_html = '')
675 675
     {
676 676
         $msg = 'function "getLinks()" not implemented.';
677 677
         return $this->raiseError($msg, ERROR_PAGER_NOT_IMPLEMENTED);
@@ -746,7 +746,7 @@  discard block
 block discarded – undo
746 746
      */
747 747
     function numPages()
748 748
     {
749
-        return (int)$this->_totalPages;
749
+        return (int) $this->_totalPages;
750 750
     }
751 751
 
752 752
     // }}}
@@ -806,7 +806,7 @@  discard block
 block discarded – undo
806 806
         if (!is_null($this->_itemData)) {
807 807
             $this->_totalItems = count($this->_itemData);
808 808
         }
809
-        $this->_totalPages = ceil((float)$this->_totalItems / (float)$this->_perPage);
809
+        $this->_totalPages = ceil((float) $this->_totalItems / (float) $this->_perPage);
810 810
         $i = 1;
811 811
         if (!empty($this->_itemData)) {
812 812
             foreach ($this->_itemData as $key => $value) {
@@ -839,7 +839,7 @@  discard block
 block discarded – undo
839 839
     {
840 840
         if ($this->_httpMethod == 'GET') {
841 841
             if ($this->_append) {
842
-                $href = '?' . $this->_http_build_query_wrapper($this->_linkData);
842
+                $href = '?'.$this->_http_build_query_wrapper($this->_linkData);
843 843
             } else {
844 844
                 $href = str_replace('%d', $this->_linkData[$this->_urlVar], $this->_fileName);
845 845
             }
@@ -850,25 +850,25 @@  discard block
 block discarded – undo
850 850
             return sprintf('<a href="%s"%s%s%s%s title="%s">%s</a>',
851 851
                            // Modified by Ivan Tcholakov, 17-OCT-2008.
852 852
                            //htmlentities($this->_url . $href, ENT_COMPAT, 'UTF-8'),
853
-                           api_htmlentities($this->_url . $href),
853
+                           api_htmlentities($this->_url.$href),
854 854
                            //
855 855
                            empty($this->_classString) ? '' : ' '.$this->_classString,
856
-                           empty($this->_attributes)  ? '' : ' '.$this->_attributes,
857
-                           empty($this->_accesskey)   ? '' : ' accesskey="'.$this->_linkData[$this->_urlVar].'"',
858
-                           empty($onclick)            ? '' : ' onclick="'.$onclick.'"',
856
+                           empty($this->_attributes) ? '' : ' '.$this->_attributes,
857
+                           empty($this->_accesskey) ? '' : ' accesskey="'.$this->_linkData[$this->_urlVar].'"',
858
+                           empty($onclick) ? '' : ' onclick="'.$onclick.'"',
859 859
                            $altText,
860 860
                            $linkText
861 861
             );
862 862
         } elseif ($this->_httpMethod == 'POST') {
863 863
             $href = $this->_url;
864 864
             if (!empty($_GET)) {
865
-                $href .= '?' . $this->_http_build_query_wrapper($_GET);
865
+                $href .= '?'.$this->_http_build_query_wrapper($_GET);
866 866
             }
867 867
             return sprintf("<a href='javascript:void(0)' onclick='%s'%s%s%s title='%s'>%s</a>",
868 868
                            $this->_generateFormOnClick($href, $this->_linkData),
869 869
                            empty($this->_classString) ? '' : ' '.$this->_classString,
870
-                           empty($this->_attributes)  ? '' : ' '.$this->_attributes,
871
-                           empty($this->_accesskey)   ? '' : ' accesskey=\''.$this->_linkData[$this->_urlVar].'\'',
870
+                           empty($this->_attributes) ? '' : ' '.$this->_attributes,
871
+                           empty($this->_accesskey) ? '' : ' accesskey=\''.$this->_linkData[$this->_urlVar].'\'',
872 872
                            $altText,
873 873
                            $linkText
874 874
             );
@@ -956,7 +956,7 @@  discard block
 block discarded – undo
956 956
         $str = '';
957 957
         if (is_array($data) || is_object($data)) {
958 958
             // foreach key/visible member
959
-            foreach ((array)$data as $key => $val) {
959
+            foreach ((array) $data as $key => $val) {
960 960
                 // append [$key] to prev
961 961
                 $tempKey = sprintf('%s[%s]', $prev, $key);
962 962
                 $str .= $this->_generateFormOnClickHelper($val, $tempKey);
@@ -1106,7 +1106,7 @@  discard block
 block discarded – undo
1106 1106
      * @return string The link
1107 1107
      * @access private
1108 1108
      */
1109
-    function _getBackLink($url='', $link='')
1109
+    function _getBackLink($url = '', $link = '')
1110 1110
     {
1111 1111
         //legacy settings... the preferred way to set an option
1112 1112
         //now is passing it to the factory
@@ -1120,10 +1120,10 @@  discard block
 block discarded – undo
1120 1120
         if ($this->_currentPage > 1) {
1121 1121
             $this->_linkData[$this->_urlVar] = $this->getPreviousPageID();
1122 1122
             $back = $this->_renderLink($this->_altPrev, $this->_prevImg)
1123
-                  . $this->_spacesBefore . $this->_spacesAfter;
1123
+                  . $this->_spacesBefore.$this->_spacesAfter;
1124 1124
         } else if ($this->_prevImgEmpty !== null && $this->_totalPages > 1) {
1125 1125
             $back = $this->_prevImgEmpty
1126
-                  . $this->_spacesBefore . $this->_spacesAfter;
1126
+                  . $this->_spacesBefore.$this->_spacesAfter;
1127 1127
         }
1128 1128
         return $back;
1129 1129
     }
@@ -1139,7 +1139,7 @@  discard block
 block discarded – undo
1139 1139
      * @return string Links
1140 1140
      * @access private
1141 1141
      */
1142
-    function _getPageLinks($url='')
1142
+    function _getPageLinks($url = '')
1143 1143
     {
1144 1144
         $msg = 'function "_getPageLinks()" not implemented.';
1145 1145
         return $this->raiseError($msg, ERROR_PAGER_NOT_IMPLEMENTED);
@@ -1157,7 +1157,7 @@  discard block
 block discarded – undo
1157 1157
      * @return string The link
1158 1158
      * @access private
1159 1159
      */
1160
-    function _getNextLink($url='', $link='')
1160
+    function _getNextLink($url = '', $link = '')
1161 1161
     {
1162 1162
         //legacy settings... the preferred way to set an option
1163 1163
         //now is passing it to the factory
@@ -1172,11 +1172,11 @@  discard block
 block discarded – undo
1172 1172
             $this->_linkData[$this->_urlVar] = $this->getNextPageID();
1173 1173
             $next = $this->_spacesAfter
1174 1174
                   . $this->_renderLink($this->_altNext, $this->_nextImg)
1175
-                  . $this->_spacesBefore . $this->_spacesAfter;
1175
+                  . $this->_spacesBefore.$this->_spacesAfter;
1176 1176
         } else if ($this->_nextImgEmpty !== null && $this->_totalPages > 1) {
1177 1177
             $next = $this->_spacesAfter
1178 1178
                   . $this->_nextImgEmpty
1179
-                  . $this->_spacesBefore . $this->_spacesAfter;
1179
+                  . $this->_spacesBefore.$this->_spacesAfter;
1180 1180
         }
1181 1181
         return $next;
1182 1182
     }
@@ -1308,13 +1308,13 @@  discard block
 block discarded – undo
1308 1308
     {
1309 1309
         $this->_linkData[$this->_urlVar] = $pageID;
1310 1310
         if ($this->_append) {
1311
-            $href = '?' . $this->_http_build_query_wrapper($this->_linkData);
1311
+            $href = '?'.$this->_http_build_query_wrapper($this->_linkData);
1312 1312
         } else {
1313 1313
             $href = str_replace('%d', $this->_linkData[$this->_urlVar], $this->_fileName);
1314 1314
         }
1315 1315
         // Modified by Ivan Tcholakov, 17-OCT-2008.
1316 1316
         //return htmlentities($this->_url . $href, ENT_COMPAT, 'UTF-8');
1317
-        return api_htmlentities($this->_url . $href);
1317
+        return api_htmlentities($this->_url.$href);
1318 1318
         //
1319 1319
     }
1320 1320
 
@@ -1342,7 +1342,7 @@  discard block
 block discarded – undo
1342 1342
      * @return string xhtml select box
1343 1343
      * @access public
1344 1344
      */
1345
-    function getPerPageSelectBox($start=5, $end=30, $step=5, $showAllData=false, $extraParams=array())
1345
+    function getPerPageSelectBox($start = 5, $end = 30, $step = 5, $showAllData = false, $extraParams = array())
1346 1346
     {
1347 1347
         include_once 'Pager/HtmlWidgets.php';
1348 1348
         $widget = new Pager_HtmlWidgets($this);
@@ -1393,8 +1393,8 @@  discard block
 block discarded – undo
1393 1393
         $this->_linkData[$this->_urlVar] = 1;
1394 1394
         return $this->_renderLink(
1395 1395
                 str_replace('%d', 1, $this->_altFirst),
1396
-                $this->_firstPagePre . $this->_firstPageText . $this->_firstPagePost
1397
-        ) . $this->_spacesBefore . $this->_spacesAfter;
1396
+                $this->_firstPagePre.$this->_firstPageText.$this->_firstPagePost
1397
+        ).$this->_spacesBefore.$this->_spacesAfter;
1398 1398
     }
1399 1399
 
1400 1400
     // }}}
@@ -1415,7 +1415,7 @@  discard block
 block discarded – undo
1415 1415
         $this->_linkData[$this->_urlVar] = $this->_totalPages;
1416 1416
         return $this->_renderLink(
1417 1417
                 str_replace('%d', $this->_totalPages, $this->_altLast),
1418
-                $this->_lastPagePre . $this->_lastPageText . $this->_lastPagePost
1418
+                $this->_lastPagePre.$this->_lastPageText.$this->_lastPagePost
1419 1419
         );
1420 1420
     }
1421 1421
 
@@ -1455,7 +1455,7 @@  discard block
 block discarded – undo
1455 1455
      */
1456 1456
     function _http_build_query_wrapper($data)
1457 1457
     {
1458
-        $data = (array)$data;
1458
+        $data = (array) $data;
1459 1459
         if (empty($data)) {
1460 1460
             return '';
1461 1461
         }
@@ -1463,12 +1463,12 @@  discard block
 block discarded – undo
1463 1463
         if ($separator == '&amp;') {
1464 1464
             $separator = '&'; //the string is escaped by htmlentities anyway...
1465 1465
         }
1466
-        $tmp = array ();
1466
+        $tmp = array();
1467 1467
         foreach ($data as $key => $val) {
1468 1468
             if (is_scalar($val)) {
1469 1469
                 //array_push($tmp, $key.'='.$val);
1470 1470
                 $val = urlencode($val);
1471
-                array_push($tmp, $key .'='. str_replace('%2F', '/', $val));
1471
+                array_push($tmp, $key.'='.str_replace('%2F', '/', $val));
1472 1472
                 continue;
1473 1473
             }
1474 1474
             // If the value is an array, recursively parse it
@@ -1494,7 +1494,7 @@  discard block
 block discarded – undo
1494 1494
      */
1495 1495
     function __http_build_query($array, $name)
1496 1496
     {
1497
-        $tmp = array ();
1497
+        $tmp = array();
1498 1498
         $separator = ini_get('arg_separator.output');
1499 1499
         if ($separator == '&amp;') {
1500 1500
             $separator = '&'; //the string is escaped by htmlentities anyway...
@@ -1569,7 +1569,7 @@  discard block
 block discarded – undo
1569 1569
     {
1570 1570
         foreach ($options as $key => $value) {
1571 1571
             if (in_array($key, $this->_allowed_options) && (!is_null($value))) {
1572
-                $this->{'_' . $key} = $value;
1572
+                $this->{'_'.$key} = $value;
1573 1573
             }
1574 1574
         }
1575 1575
 
@@ -1584,7 +1584,7 @@  discard block
 block discarded – undo
1584 1584
         }
1585 1585
 
1586 1586
         if (substr($this->_path, -1, 1) == '/') {
1587
-            $this->_fileName = ltrim($this->_fileName, '/');  //strip leading slash
1587
+            $this->_fileName = ltrim($this->_fileName, '/'); //strip leading slash
1588 1588
         }
1589 1589
 
1590 1590
         if ($this->_append) {
@@ -1615,8 +1615,8 @@  discard block
 block discarded – undo
1615 1615
         }
1616 1616
 
1617 1617
         if (strlen($this->_curPageLinkClassName)) {
1618
-            $this->_curPageSpanPre  .= '<span class="'.$this->_curPageLinkClassName.'">';
1619
-            $this->_curPageSpanPost = '</span>' . $this->_curPageSpanPost;
1618
+            $this->_curPageSpanPre .= '<span class="'.$this->_curPageLinkClassName.'">';
1619
+            $this->_curPageSpanPost = '</span>'.$this->_curPageSpanPost;
1620 1620
         }
1621 1621
 
1622 1622
         $this->_perPage = max($this->_perPage, 1); //avoid possible user errors
@@ -1625,7 +1625,7 @@  discard block
 block discarded – undo
1625 1625
             session_start();
1626 1626
         }
1627 1627
         if (!empty($_REQUEST[$this->_sessionVar])) {
1628
-            $this->_perPage = max(1, (int)$_REQUEST[$this->_sessionVar]);
1628
+            $this->_perPage = max(1, (int) $_REQUEST[$this->_sessionVar]);
1629 1629
             if ($this->_useSessions) {
1630 1630
                 $_SESSION[$this->_sessionVar] = $this->_perPage;
1631 1631
             }
@@ -1647,7 +1647,7 @@  discard block
 block discarded – undo
1647 1647
         //
1648 1648
 
1649 1649
         if (isset($_REQUEST[$this->_urlVar]) && empty($options['currentPage'])) {
1650
-            $this->_currentPage = (int)$_REQUEST[$this->_urlVar];
1650
+            $this->_currentPage = (int) $_REQUEST[$this->_urlVar];
1651 1651
         }
1652 1652
         $this->_currentPage = max($this->_currentPage, 1);
1653 1653
         $this->_linkData = $this->_getLinksData();
@@ -1672,7 +1672,7 @@  discard block
 block discarded – undo
1672 1672
             $msg = 'invalid option: '.$name;
1673 1673
             return $this->raiseError($msg, ERROR_PAGER_INVALID);
1674 1674
         }
1675
-        return $this->{'_' . $name};
1675
+        return $this->{'_'.$name};
1676 1676
     }
1677 1677
 
1678 1678
     // }}}
@@ -1688,7 +1688,7 @@  discard block
 block discarded – undo
1688 1688
     {
1689 1689
         $options = array();
1690 1690
         foreach ($this->_allowed_options as $option) {
1691
-            $options[$option] = $this->{'_' . $option};
1691
+            $options[$option] = $this->{'_'.$option};
1692 1692
         }
1693 1693
         return $options;
1694 1694
     }
Please login to merge, or discard this patch.
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -626,7 +626,7 @@  discard block
 block discarded – undo
626 626
             return array(
627 627
                         max(($this->_perPage * ($pageID - 1)) + 1, 1),
628 628
                         min($this->_totalItems, $this->_perPage * $pageID)
629
-                   );
629
+                    );
630 630
         }
631 631
         return array(0, 0);
632 632
     }
@@ -848,16 +848,16 @@  discard block
 block discarded – undo
848 848
                 $onclick = str_replace('%d', $this->_linkData[$this->_urlVar], $this->_onclick);
849 849
             }
850 850
             return sprintf('<a href="%s"%s%s%s%s title="%s">%s</a>',
851
-                           // Modified by Ivan Tcholakov, 17-OCT-2008.
852
-                           //htmlentities($this->_url . $href, ENT_COMPAT, 'UTF-8'),
853
-                           api_htmlentities($this->_url . $href),
854
-                           //
855
-                           empty($this->_classString) ? '' : ' '.$this->_classString,
856
-                           empty($this->_attributes)  ? '' : ' '.$this->_attributes,
857
-                           empty($this->_accesskey)   ? '' : ' accesskey="'.$this->_linkData[$this->_urlVar].'"',
858
-                           empty($onclick)            ? '' : ' onclick="'.$onclick.'"',
859
-                           $altText,
860
-                           $linkText
851
+                            // Modified by Ivan Tcholakov, 17-OCT-2008.
852
+                            //htmlentities($this->_url . $href, ENT_COMPAT, 'UTF-8'),
853
+                            api_htmlentities($this->_url . $href),
854
+                            //
855
+                            empty($this->_classString) ? '' : ' '.$this->_classString,
856
+                            empty($this->_attributes)  ? '' : ' '.$this->_attributes,
857
+                            empty($this->_accesskey)   ? '' : ' accesskey="'.$this->_linkData[$this->_urlVar].'"',
858
+                            empty($onclick)            ? '' : ' onclick="'.$onclick.'"',
859
+                            $altText,
860
+                            $linkText
861 861
             );
862 862
         } elseif ($this->_httpMethod == 'POST') {
863 863
             $href = $this->_url;
@@ -865,12 +865,12 @@  discard block
 block discarded – undo
865 865
                 $href .= '?' . $this->_http_build_query_wrapper($_GET);
866 866
             }
867 867
             return sprintf("<a href='javascript:void(0)' onclick='%s'%s%s%s title='%s'>%s</a>",
868
-                           $this->_generateFormOnClick($href, $this->_linkData),
869
-                           empty($this->_classString) ? '' : ' '.$this->_classString,
870
-                           empty($this->_attributes)  ? '' : ' '.$this->_attributes,
871
-                           empty($this->_accesskey)   ? '' : ' accesskey=\''.$this->_linkData[$this->_urlVar].'\'',
872
-                           $altText,
873
-                           $linkText
868
+                            $this->_generateFormOnClick($href, $this->_linkData),
869
+                            empty($this->_classString) ? '' : ' '.$this->_classString,
870
+                            empty($this->_attributes)  ? '' : ' '.$this->_attributes,
871
+                            empty($this->_accesskey)   ? '' : ' accesskey=\''.$this->_linkData[$this->_urlVar].'\'',
872
+                            $altText,
873
+                            $linkText
874 874
             );
875 875
         }
876 876
         return '';
@@ -1120,10 +1120,10 @@  discard block
 block discarded – undo
1120 1120
         if ($this->_currentPage > 1) {
1121 1121
             $this->_linkData[$this->_urlVar] = $this->getPreviousPageID();
1122 1122
             $back = $this->_renderLink($this->_altPrev, $this->_prevImg)
1123
-                  . $this->_spacesBefore . $this->_spacesAfter;
1123
+                    . $this->_spacesBefore . $this->_spacesAfter;
1124 1124
         } else if ($this->_prevImgEmpty !== null && $this->_totalPages > 1) {
1125 1125
             $back = $this->_prevImgEmpty
1126
-                  . $this->_spacesBefore . $this->_spacesAfter;
1126
+                    . $this->_spacesBefore . $this->_spacesAfter;
1127 1127
         }
1128 1128
         return $back;
1129 1129
     }
@@ -1171,12 +1171,12 @@  discard block
 block discarded – undo
1171 1171
         if ($this->_currentPage < $this->_totalPages) {
1172 1172
             $this->_linkData[$this->_urlVar] = $this->getNextPageID();
1173 1173
             $next = $this->_spacesAfter
1174
-                  . $this->_renderLink($this->_altNext, $this->_nextImg)
1175
-                  . $this->_spacesBefore . $this->_spacesAfter;
1174
+                    . $this->_renderLink($this->_altNext, $this->_nextImg)
1175
+                    . $this->_spacesBefore . $this->_spacesAfter;
1176 1176
         } else if ($this->_nextImgEmpty !== null && $this->_totalPages > 1) {
1177 1177
             $next = $this->_spacesAfter
1178
-                  . $this->_nextImgEmpty
1179
-                  . $this->_spacesBefore . $this->_spacesAfter;
1178
+                    . $this->_nextImgEmpty
1179
+                    . $this->_spacesBefore . $this->_spacesAfter;
1180 1180
         }
1181 1181
         return $next;
1182 1182
     }
@@ -1632,7 +1632,7 @@  discard block
 block discarded – undo
1632 1632
         }
1633 1633
 
1634 1634
         if (!empty($_SESSION[$this->_sessionVar]) && $this->_useSessions) {
1635
-             $this->_perPage = $_SESSION[$this->_sessionVar];
1635
+                $this->_perPage = $_SESSION[$this->_sessionVar];
1636 1636
         }
1637 1637
 
1638 1638
         if ($this->_closeSession) {
@@ -1713,7 +1713,7 @@  discard block
 block discarded – undo
1713 1713
                 ERROR_PAGER_INVALID             => 'invalid',
1714 1714
                 ERROR_PAGER_INVALID_PLACEHOLDER => 'invalid format - use "%d" as placeholder.',
1715 1715
                 ERROR_PAGER_INVALID_USAGE       => 'if $options[\'append\'] is set to false, '
1716
-                                                  .' $options[\'fileName\'] MUST contain the "%d" placeholder.',
1716
+                                                    .' $options[\'fileName\'] MUST contain the "%d" placeholder.',
1717 1717
                 ERROR_PAGER_NOT_IMPLEMENTED     => 'not implemented'
1718 1718
             );
1719 1719
         }
Please login to merge, or discard this patch.
main/inc/lib/pear/Pager/HtmlWidgets.php 3 patches
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,8 @@
 block discarded – undo
55 55
     /**
56 56
      * Constructor
57 57
      *
58
-     * @param object &$pager Pager instance
58
+     * @param object &$pager Pager instance
59
+     * @param Pager_Common $pager
59 60
      */
60 61
     function Pager_HtmlWidgets(&$pager)
61 62
     {
Please login to merge, or discard this patch.
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -153,12 +153,12 @@  discard block
 block discarded – undo
153 153
                     $href = htmlentities($this->pager->_url . str_replace('%d', $selector, $this->pager->_fileName), ENT_COMPAT, 'UTF-8');
154 154
                 }
155 155
                 $tmp .= ' onchange="document.location.href=\''
156
-                     . $href .'\''
157
-                     . '"';
156
+                        . $href .'\''
157
+                        . '"';
158 158
             } elseif ($this->pager->_httpMethod == 'POST') {
159 159
                 $tmp .= " onchange='"
160
-                     . $this->pager->_generateFormOnClick($this->pager->_url, $this->pager->_linkData)
161
-                     . "'";
160
+                        . $this->pager->_generateFormOnClick($this->pager->_url, $this->pager->_linkData)
161
+                        . "'";
162 162
                 $tmp = preg_replace(
163 163
                     '/(input\.name = \"'.$this->pager->_sessionVar.'\"; input\.value =) \"(\d+)\";/',
164 164
                     '\\1 this.options[this.selectedIndex].value;',
@@ -259,12 +259,12 @@  discard block
 block discarded – undo
259 259
                     //
260 260
                 }
261 261
                 $tmp .= ' onchange="javascript: document.location.href=\''
262
-                     . $href .'\''
263
-                     . '"';
262
+                        . $href .'\''
263
+                        . '"';
264 264
             } elseif ($this->pager->_httpMethod == 'POST') {
265 265
                 $tmp .= " onchange='"
266
-                     . $this->pager->_generateFormOnClick($this->pager->_url, $this->pager->_linkData)
267
-                     . "'";
266
+                        . $this->pager->_generateFormOnClick($this->pager->_url, $this->pager->_linkData)
267
+                        . "'";
268 268
                 $tmp = preg_replace(
269 269
                     '/(input\.name = \"'.$this->pager->_urlVar.'\"; input\.value =) \"(\d+)\";/',
270 270
                     '\\1 this.options[this.selectedIndex].value;',
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
      */
60 60
     function Pager_HtmlWidgets(&$pager)
61 61
     {
62
-        $this->pager =& $pager;
62
+        $this->pager = & $pager;
63 63
     }
64 64
 
65 65
     // }}}
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
      * @return string xhtml select box
91 91
      * @access public
92 92
      */
93
-    function getPerPageSelectBox($start=5, $end=30, $step=5, $showAllData=false, $extraParams=array())
93
+    function getPerPageSelectBox($start = 5, $end = 30, $step = 5, $showAllData = false, $extraParams = array())
94 94
     {
95 95
         // FIXME: needs POST support
96 96
         $optionText = '%d';
@@ -117,11 +117,11 @@  discard block
 block discarded – undo
117 117
                 ERROR_PAGER_INVALID_PLACEHOLDER
118 118
             );
119 119
         }
120
-        $start = (int)$start;
121
-        $end   = (int)$end;
122
-        $step  = (int)$step;
120
+        $start = (int) $start;
121
+        $end   = (int) $end;
122
+        $step  = (int) $step;
123 123
         if (!empty($_SESSION[$this->pager->_sessionVar])) {
124
-            $selected = (int)$_SESSION[$this->pager->_sessionVar];
124
+            $selected = (int) $_SESSION[$this->pager->_sessionVar];
125 125
         } else {
126 126
             $selected = $this->pager->_perPage;
127 127
         }
@@ -143,17 +143,17 @@  discard block
 block discarded – undo
143 143
                         $tmpLinkData[$this->pager->_urlVar] = $this->pager->getCurrentPageID();
144 144
                     }
145 145
                     $tmpLinkData[$this->pager->_sessionVar] = '1';
146
-                    $href = '?' . $this->pager->_http_build_query_wrapper($tmpLinkData);
147
-                    $href = htmlentities($this->pager->_url, ENT_COMPAT, 'UTF-8'). preg_replace(
146
+                    $href = '?'.$this->pager->_http_build_query_wrapper($tmpLinkData);
147
+                    $href = htmlentities($this->pager->_url, ENT_COMPAT, 'UTF-8').preg_replace(
148 148
                         '/(&|&amp;|\?)('.$this->pager->_sessionVar.'=)(\d+)/',
149 149
                         '\\1\\2'.$selector,
150 150
                         htmlentities($href, ENT_COMPAT, 'UTF-8')
151 151
                     );
152 152
                 } else {
153
-                    $href = htmlentities($this->pager->_url . str_replace('%d', $selector, $this->pager->_fileName), ENT_COMPAT, 'UTF-8');
153
+                    $href = htmlentities($this->pager->_url.str_replace('%d', $selector, $this->pager->_fileName), ENT_COMPAT, 'UTF-8');
154 154
                 }
155 155
                 $tmp .= ' onchange="document.location.href=\''
156
-                     . $href .'\''
156
+                     . $href.'\''
157 157
                      . '"';
158 158
             } elseif ($this->pager->_httpMethod == 'POST') {
159 159
                 $tmp .= " onchange='"
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 
171 171
         $tmp .= '>';
172 172
         $last = $start;
173
-        for ($i=$start; $i<=$end; $i+=$step) {
173
+        for ($i = $start; $i <= $end; $i += $step) {
174 174
             $last = $i;
175 175
             $tmp .= '<option value="'.$i.'"';
176 176
             if ($i == $selected) {
@@ -240,13 +240,13 @@  discard block
 block discarded – undo
240 240
             if ($this->pager->_httpMethod == 'GET') {
241 241
                 $selector = '\' + '.'this.options[this.selectedIndex].value + \'';
242 242
                 if ($this->pager->_append) {
243
-                    $href = '?' . $this->pager->_http_build_query_wrapper($this->pager->_linkData);
243
+                    $href = '?'.$this->pager->_http_build_query_wrapper($this->pager->_linkData);
244 244
                     // Modified by Ivan Tcholakov, 17-OCT-2008.
245 245
                     //$href = htmlentities($this->pager->_url, ENT_COMPAT, 'UTF-8'). preg_replace(
246 246
                     //    '/(&|&amp;|\?)('.$this->pager->_urlVar.'=)(\d+)/',
247 247
                     //    '\\1\\2'.$selector,
248 248
                     //    htmlentities($href, ENT_COMPAT, 'UTF-8')
249
-                    $href = api_htmlentities($this->pager->_url). preg_replace(
249
+                    $href = api_htmlentities($this->pager->_url).preg_replace(
250 250
                         '/(&|&amp;|\?)('.$this->pager->_urlVar.'=)(\d+)/',
251 251
                         '\\1\\2'.$selector,
252 252
                         api_htmlentities($href)
@@ -255,11 +255,11 @@  discard block
 block discarded – undo
255 255
                 } else {
256 256
                     // Modified by Ivan Tcholakov, 17-OCT-2008.
257 257
                     //$href = htmlentities($this->pager->_url . str_replace('%d', $selector, $this->pager->_fileName), ENT_COMPAT, 'UTF-8');
258
-                    $href = api_htmlentities($this->pager->_url . str_replace('%d', $selector, $this->pager->_fileName));
258
+                    $href = api_htmlentities($this->pager->_url.str_replace('%d', $selector, $this->pager->_fileName));
259 259
                     //
260 260
                 }
261 261
                 $tmp .= ' onchange="javascript: document.location.href=\''
262
-                     . $href .'\''
262
+                     . $href.'\''
263 263
                      . '"';
264 264
             } elseif ($this->pager->_httpMethod == 'POST') {
265 265
                 $tmp .= " onchange='"
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
         $start = 1;
277 277
         $end   = $this->pager->numPages();
278 278
         $selected = $this->pager->getCurrentPageID();
279
-        for ($i=$start; $i<=$end; $i++) {
279
+        for ($i = $start; $i <= $end; $i++) {
280 280
             $tmp .= '<option value="'.$i.'"';
281 281
             if ($i == $selected) {
282 282
                 $tmp .= ' selected="selected"';
Please login to merge, or discard this patch.
main/inc/lib/pear/Pager/Jumping.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -112,7 +112,7 @@
 block discarded – undo
112 112
      *
113 113
      * @param integer $pageid PageID to get offsets for
114 114
      *
115
-     * @return array  First and last offsets
115
+     * @return integer[]  First and last offsets
116 116
      * @access public
117 117
      */
118 118
     function getPageRangeByPageId($pageid = null)
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -250,7 +250,7 @@
 block discarded – undo
250 250
                 $links .= $this->_curPageSpanPre . $i . $this->_curPageSpanPost;
251 251
             }
252 252
             $links .= $this->_spacesBefore
253
-                   . (($i != $this->_totalPages) ? $this->_separator.$this->_spacesAfter : '');
253
+                    . (($i != $this->_totalPages) ? $this->_separator.$this->_spacesAfter : '');
254 254
         }
255 255
         return $links;
256 256
     }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
         }
92 92
 
93 93
         if (($index % $this->_perPage) > 0) {
94
-            $pageID = ceil((float)$index / (float)$this->_perPage);
94
+            $pageID = ceil((float) $index / (float) $this->_perPage);
95 95
         } else {
96 96
             $pageID = $index / $this->_perPage;
97 97
         }
@@ -117,14 +117,14 @@  discard block
 block discarded – undo
117 117
      */
118 118
     function getPageRangeByPageId($pageid = null)
119 119
     {
120
-        $pageid = isset($pageid) ? (int)$pageid : $this->_currentPage;
120
+        $pageid = isset($pageid) ? (int) $pageid : $this->_currentPage;
121 121
         if (isset($this->_pageData[$pageid]) || is_null($this->_itemData)) {
122 122
             // I'm sure I'm missing something here, but this formula works
123 123
             // so I'm using it until I find something simpler.
124
-            $start = ((($pageid + (($this->_delta - ($pageid % $this->_delta))) % $this->_delta) / $this->_delta) - 1) * $this->_delta +1;
124
+            $start = ((($pageid + (($this->_delta - ($pageid % $this->_delta))) % $this->_delta) / $this->_delta) - 1) * $this->_delta + 1;
125 125
             return array(
126 126
                 max($start, 1),
127
-                min($start+$this->_delta-1, $this->_totalPages)
127
+                min($start + $this->_delta - 1, $this->_totalPages)
128 128
             );
129 129
         } else {
130 130
             return array(0, 0);
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
      *
154 154
      * @return array Back/pages/next links
155 155
      */
156
-    function getLinks($pageID=null, $next_html='')
156
+    function getLinks($pageID = null, $next_html = '')
157 157
     {
158 158
         //BC hack
159 159
         if (!empty($next_html)) {
@@ -240,14 +240,14 @@  discard block
 block discarded – undo
240 240
         $links = '';
241 241
         $limits = $this->getPageRangeByPageId($this->_currentPage);
242 242
 
243
-        for ($i=$limits[0]; $i<=min($limits[1], $this->_totalPages); $i++) {
243
+        for ($i = $limits[0]; $i <= min($limits[1], $this->_totalPages); $i++) {
244 244
             if ($i != $this->_currentPage) {
245 245
                 $this->range[$i] = false;
246 246
                 $this->_linkData[$this->_urlVar] = $i;
247 247
                 $links .= $this->_renderLink(str_replace('%d', $i, $this->_altPage), $i);
248 248
             } else {
249 249
                 $this->range[$i] = true;
250
-                $links .= $this->_curPageSpanPre . $i . $this->_curPageSpanPost;
250
+                $links .= $this->_curPageSpanPre.$i.$this->_curPageSpanPost;
251 251
             }
252 252
             $links .= $this->_spacesBefore
253 253
                    . (($i != $this->_totalPages) ? $this->_separator.$this->_spacesAfter : '');
Please login to merge, or discard this patch.
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.
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.
Indentation   +1480 added lines, -1480 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,148 +485,148 @@  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)
598
-  {
599
-      if (!(is_file($this->Sendmail) and is_executable($this->Sendmail))) {
600
-          throw new phpmailerException(
601
-              $this->lang('execute').$this->Sendmail,
602
-              self::STOP_CRITICAL
603
-          );
604
-      }
605
-      if (!empty($this->Sender) and $this->validateAddress($this->Sender)) {
606
-          if ($this->Mailer == 'qmail') {
607
-              $sendmail = sprintf(
608
-                  '%s -f%s',
609
-                  escapeshellcmd($this->Sendmail),
610
-                  escapeshellarg($this->Sender)
611
-              );
612
-          } else {
613
-              $sendmail = sprintf(
614
-                  '%s -oi -f%s -t',
615
-                  escapeshellcmd($this->Sendmail),
616
-                  escapeshellarg($this->Sender)
617
-              );
618
-          }
619
-      } else {
620
-          if ($this->Mailer == 'qmail') {
621
-              $sendmail = sprintf('%s', escapeshellcmd($this->Sendmail));
622
-          } else {
623
-              $sendmail = sprintf('%s -oi -t', escapeshellcmd($this->Sendmail));
624
-          }
625
-      }
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
+    {
599
+        if (!(is_file($this->Sendmail) and is_executable($this->Sendmail))) {
600
+            throw new phpmailerException(
601
+                $this->lang('execute').$this->Sendmail,
602
+                self::STOP_CRITICAL
603
+            );
604
+        }
605
+        if (!empty($this->Sender) and $this->validateAddress($this->Sender)) {
606
+            if ($this->Mailer == 'qmail') {
607
+                $sendmail = sprintf(
608
+                    '%s -f%s',
609
+                    escapeshellcmd($this->Sendmail),
610
+                    escapeshellarg($this->Sender)
611
+                );
612
+            } else {
613
+                $sendmail = sprintf(
614
+                    '%s -oi -f%s -t',
615
+                    escapeshellcmd($this->Sendmail),
616
+                    escapeshellarg($this->Sender)
617
+                );
618
+            }
619
+        } else {
620
+            if ($this->Mailer == 'qmail') {
621
+                $sendmail = sprintf('%s', escapeshellcmd($this->Sendmail));
622
+            } else {
623
+                $sendmail = sprintf('%s -oi -t', escapeshellcmd($this->Sendmail));
624
+            }
625
+        }
626 626
     if ($this->SingleTo === true) {
627
-      foreach ($this->SingleToArray as $key => $val) {
627
+        foreach ($this->SingleToArray as $key => $val) {
628 628
         if(!@$mail = popen($sendmail, 'w')) {
629
-          throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
629
+            throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
630 630
         }
631 631
         fputs($mail, "To: " . $val . "\n");
632 632
         fputs($mail, $header);
@@ -636,96 +636,96 @@  discard block
 block discarded – undo
636 636
         $isSent = ($result == 0) ? 1 : 0;
637 637
         $this->doCallback($isSent,$val,$this->cc,$this->bcc,$this->Subject,$body);
638 638
         if($result != 0) {
639
-          throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
639
+            throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
640
+        }
640 641
         }
641
-      }
642 642
     } else {
643
-      if(!@$mail = popen($sendmail, 'w')) {
643
+        if(!@$mail = popen($sendmail, 'w')) {
644 644
         throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
645
-      }
646
-      fputs($mail, $header);
647
-      fputs($mail, $body);
648
-      $result = pclose($mail);
649
-      // implement call back function if it exists
650
-      $isSent = ($result == 0) ? 1 : 0;
651
-      $this->doCallback($isSent,$this->to,$this->cc,$this->bcc,$this->Subject,$body);
652
-      if($result != 0) {
645
+        }
646
+        fputs($mail, $header);
647
+        fputs($mail, $body);
648
+        $result = pclose($mail);
649
+        // implement call back function if it exists
650
+        $isSent = ($result == 0) ? 1 : 0;
651
+        $this->doCallback($isSent,$this->to,$this->cc,$this->bcc,$this->Subject,$body);
652
+        if($result != 0) {
653 653
         throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
654
-      }
654
+        }
655 655
     }
656 656
     return true;
657
-  }
658
-
659
-  /**
660
-   * Sends mail using the PHP mail() function.
661
-   * @param string $header The message headers
662
-   * @param string $body The message body
663
-   * @access protected
664
-   * @return bool
665
-   */
666
-  protected function MailSend($header, $body) {
657
+    }
658
+
659
+    /**
660
+     * Sends mail using the PHP mail() function.
661
+     * @param string $header The message headers
662
+     * @param string $body The message body
663
+     * @access protected
664
+     * @return bool
665
+     */
666
+    protected function MailSend($header, $body) {
667 667
     $toArr = array();
668 668
     foreach($this->to as $t) {
669
-      $toArr[] = $this->AddrFormat($t);
669
+        $toArr[] = $this->AddrFormat($t);
670 670
     }
671 671
     $to = implode(', ', $toArr);
672 672
 
673 673
     $params = sprintf("-oi -f %s", $this->Sender);
674 674
     if (!empty($this->Sender) and !ini_get('safe_mode') and $this->validateAddress($this->Sender)) {
675
-      $old_from = ini_get('sendmail_from');
676
-      ini_set('sendmail_from', $this->Sender);
677
-      if ($this->SingleTo === true && count($toArr) > 1) {
675
+        $old_from = ini_get('sendmail_from');
676
+        ini_set('sendmail_from', $this->Sender);
677
+        if ($this->SingleTo === true && count($toArr) > 1) {
678 678
         foreach ($toArr as $key => $val) {
679
-          $rt = @mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
680
-          // implement call back function if it exists
681
-          $isSent = ($rt == 1) ? 1 : 0;
682
-          $this->doCallback($isSent,$val,$this->cc,$this->bcc,$this->Subject,$body);
679
+            $rt = @mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
680
+            // implement call back function if it exists
681
+            $isSent = ($rt == 1) ? 1 : 0;
682
+            $this->doCallback($isSent,$val,$this->cc,$this->bcc,$this->Subject,$body);
683 683
         }
684
-      } else {
684
+        } else {
685 685
         $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
686 686
         // implement call back function if it exists
687 687
         $isSent = ($rt == 1) ? 1 : 0;
688 688
         $this->doCallback($isSent,$to,$this->cc,$this->bcc,$this->Subject,$body);
689
-      }
689
+        }
690 690
     } else {
691
-      if ($this->SingleTo === true && count($toArr) > 1) {
691
+        if ($this->SingleTo === true && count($toArr) > 1) {
692 692
         foreach ($toArr as $key => $val) {
693
-          $rt = @mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
694
-          // implement call back function if it exists
695
-          $isSent = ($rt == 1) ? 1 : 0;
696
-          $this->doCallback($isSent,$val,$this->cc,$this->bcc,$this->Subject,$body);
693
+            $rt = @mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
694
+            // implement call back function if it exists
695
+            $isSent = ($rt == 1) ? 1 : 0;
696
+            $this->doCallback($isSent,$val,$this->cc,$this->bcc,$this->Subject,$body);
697 697
         }
698
-      } else {
698
+        } else {
699 699
         $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header);
700 700
         // implement call back function if it exists
701 701
         $isSent = ($rt == 1) ? 1 : 0;
702 702
         $this->doCallback($isSent,$to,$this->cc,$this->bcc,$this->Subject,$body);
703
-      }
703
+        }
704 704
     }
705 705
     if (isset($old_from)) {
706
-      ini_set('sendmail_from', $old_from);
706
+        ini_set('sendmail_from', $old_from);
707 707
     }
708 708
     if(!$rt) {
709
-      throw new phpmailerException($this->Lang('instantiate'), self::STOP_CRITICAL);
709
+        throw new phpmailerException($this->Lang('instantiate'), self::STOP_CRITICAL);
710 710
     }
711 711
     return true;
712
-  }
713
-
714
-  /**
715
-   * Sends mail via SMTP using PhpSMTP
716
-   * Returns false if there is a bad MAIL FROM, RCPT, or DATA input.
717
-   * @param string $header The message headers
718
-   * @param string $body The message body
719
-   * @uses SMTP
720
-   * @access protected
721
-   * @return bool
722
-   */
723
-  protected function SmtpSend($header, $body) {
712
+    }
713
+
714
+    /**
715
+     * Sends mail via SMTP using PhpSMTP
716
+     * Returns false if there is a bad MAIL FROM, RCPT, or DATA input.
717
+     * @param string $header The message headers
718
+     * @param string $body The message body
719
+     * @uses SMTP
720
+     * @access protected
721
+     * @return bool
722
+     */
723
+    protected function SmtpSend($header, $body) {
724 724
     require_once $this->PluginDir . 'class.smtp.php';
725 725
     $bad_rcpt = array();
726 726
 
727 727
     if(!$this->SmtpConnect()) {
728
-      throw new phpmailerException($this->Lang('smtp_connect_failed'), self::STOP_CRITICAL);
728
+        throw new phpmailerException($this->Lang('smtp_connect_failed'), self::STOP_CRITICAL);
729 729
     }
730 730
 
731 731
     if (!empty($this->Sender) and $this->validateAddress($this->Sender)) {
@@ -734,71 +734,71 @@  discard block
 block discarded – undo
734 734
         $smtp_from = $this->From;
735 735
     }
736 736
     if(!$this->smtp->Mail($smtp_from)) {
737
-      throw new phpmailerException($this->Lang('from_failed') . $smtp_from, self::STOP_CRITICAL);
737
+        throw new phpmailerException($this->Lang('from_failed') . $smtp_from, self::STOP_CRITICAL);
738 738
     }
739 739
 
740 740
     // Attempt to send attach all recipients
741 741
     foreach($this->to as $to) {
742
-      if (!$this->smtp->Recipient($to[0])) {
742
+        if (!$this->smtp->Recipient($to[0])) {
743 743
         $bad_rcpt[] = $to[0];
744 744
         // implement call back function if it exists
745 745
         $isSent = 0;
746 746
         $this->doCallback($isSent,$to[0],'','',$this->Subject,$body);
747
-      } else {
747
+        } else {
748 748
         // implement call back function if it exists
749 749
         $isSent = 1;
750 750
         $this->doCallback($isSent,$to[0],'','',$this->Subject,$body);
751
-      }
751
+        }
752 752
     }
753 753
     foreach($this->cc as $cc) {
754
-      if (!$this->smtp->Recipient($cc[0])) {
754
+        if (!$this->smtp->Recipient($cc[0])) {
755 755
         $bad_rcpt[] = $cc[0];
756 756
         // implement call back function if it exists
757 757
         $isSent = 0;
758 758
         $this->doCallback($isSent,'',$cc[0],'',$this->Subject,$body);
759
-      } else {
759
+        } else {
760 760
         // implement call back function if it exists
761 761
         $isSent = 1;
762 762
         $this->doCallback($isSent,'',$cc[0],'',$this->Subject,$body);
763
-      }
763
+        }
764 764
     }
765 765
     foreach($this->bcc as $bcc) {
766
-      if (!$this->smtp->Recipient($bcc[0])) {
766
+        if (!$this->smtp->Recipient($bcc[0])) {
767 767
         $bad_rcpt[] = $bcc[0];
768 768
         // implement call back function if it exists
769 769
         $isSent = 0;
770 770
         $this->doCallback($isSent,'','',$bcc[0],$this->Subject,$body);
771
-      } else {
771
+        } else {
772 772
         // implement call back function if it exists
773 773
         $isSent = 1;
774 774
         $this->doCallback($isSent,'','',$bcc[0],$this->Subject,$body);
775
-      }
775
+        }
776 776
     }
777 777
 
778 778
 
779 779
     if (count($bad_rcpt) > 0 ) { //Create error message for any bad addresses
780
-      $badaddresses = implode(', ', $bad_rcpt);
781
-      throw new phpmailerException($this->Lang('recipients_failed') . $badaddresses);
780
+        $badaddresses = implode(', ', $bad_rcpt);
781
+        throw new phpmailerException($this->Lang('recipients_failed') . $badaddresses);
782 782
     }
783 783
     if(!$this->smtp->Data($header . $body)) {
784
-      throw new phpmailerException($this->Lang('data_not_accepted'), self::STOP_CRITICAL);
784
+        throw new phpmailerException($this->Lang('data_not_accepted'), self::STOP_CRITICAL);
785 785
     }
786 786
     if($this->SMTPKeepAlive == true) {
787
-      $this->smtp->Reset();
787
+        $this->smtp->Reset();
788 788
     }
789 789
     return true;
790
-  }
791
-
792
-  /**
793
-   * Initiates a connection to an SMTP server.
794
-   * Returns false if the operation failed.
795
-   * @uses SMTP
796
-   * @access public
797
-   * @return bool
798
-   */
799
-  public function SmtpConnect() {
790
+    }
791
+
792
+    /**
793
+     * Initiates a connection to an SMTP server.
794
+     * Returns false if the operation failed.
795
+     * @uses SMTP
796
+     * @access public
797
+     * @return bool
798
+     */
799
+    public function SmtpConnect() {
800 800
     if(is_null($this->smtp)) {
801
-      $this->smtp = new SMTP();
801
+        $this->smtp = new SMTP();
802 802
     }
803 803
 
804 804
     $this->smtp->do_debug = $this->SMTPDebug;
@@ -808,14 +808,14 @@  discard block
 block discarded – undo
808 808
 
809 809
     // Retry while there is no connection
810 810
     try {
811
-      while($index < count($hosts) && !$connection) {
811
+        while($index < count($hosts) && !$connection) {
812 812
         $hostinfo = array();
813 813
         if (preg_match('/^(.+):([0-9]+)$/', $hosts[$index], $hostinfo)) {
814
-          $host = $hostinfo[1];
815
-          $port = $hostinfo[2];
814
+            $host = $hostinfo[1];
815
+            $port = $hostinfo[2];
816 816
         } else {
817
-          $host = $hosts[$index];
818
-          $port = $this->Port;
817
+            $host = $hosts[$index];
818
+            $port = $this->Port;
819 819
         }
820 820
 
821 821
         $tls = ($this->SMTPSecure == 'tls');
@@ -823,140 +823,140 @@  discard block
 block discarded – undo
823 823
 
824 824
         if ($this->smtp->Connect(($ssl ? 'ssl://':'').$host, $port, $this->Timeout)) {
825 825
 
826
-          $hello = ($this->Helo != '' ? $this->Helo : $this->ServerHostname());
827
-          $this->smtp->Hello($hello);
826
+            $hello = ($this->Helo != '' ? $this->Helo : $this->ServerHostname());
827
+            $this->smtp->Hello($hello);
828 828
 
829
-          if ($tls) {
829
+            if ($tls) {
830 830
             if (!$this->smtp->StartTLS()) {
831
-              throw new phpmailerException($this->Lang('tls'));
831
+                throw new phpmailerException($this->Lang('tls'));
832 832
             }
833 833
 
834 834
             //We must resend HELO after tls negotiation
835 835
             $this->smtp->Hello($hello);
836
-          }
836
+            }
837 837
 
838
-          $connection = true;
839
-          if ($this->SMTPAuth) {
838
+            $connection = true;
839
+            if ($this->SMTPAuth) {
840 840
             if (!$this->smtp->Authenticate($this->Username, $this->Password)) {
841
-              throw new phpmailerException($this->Lang('authenticate'));
841
+                throw new phpmailerException($this->Lang('authenticate'));
842
+            }
842 843
             }
843
-          }
844 844
         }
845 845
         $index++;
846 846
         if (!$connection) {
847
-          throw new phpmailerException($this->Lang('connect_host'));
847
+            throw new phpmailerException($this->Lang('connect_host'));
848
+        }
848 849
         }
849
-      }
850 850
     } catch (phpmailerException $e) {
851
-      $this->smtp->Reset();
852
-      throw $e;
851
+        $this->smtp->Reset();
852
+        throw $e;
853 853
     }
854 854
     return true;
855
-  }
855
+    }
856 856
 
857
-  /**
858
-   * Closes the active SMTP session if one exists.
859
-   * @return void
860
-   */
861
-  public function SmtpClose() {
857
+    /**
858
+     * Closes the active SMTP session if one exists.
859
+     * @return void
860
+     */
861
+    public function SmtpClose() {
862 862
     if(!is_null($this->smtp)) {
863
-      if($this->smtp->Connected()) {
863
+        if($this->smtp->Connected()) {
864 864
         $this->smtp->Quit();
865 865
         $this->smtp->Close();
866
-      }
867
-    }
868
-  }
869
-
870
-  /**
871
-  * Sets the language for all class error messages.
872
-  * Returns false if it cannot load the language file.  The default language is English.
873
-  * @param string $langcode ISO 639-1 2-character language code (e.g. Portuguese: "br")
874
-  * @param string $lang_path Path to the language file directory
875
-  * @access public
876
-  */
877
-  function SetLanguage($langcode = 'en', $lang_path = 'language/') {
866
+        }
867
+    }
868
+    }
869
+
870
+    /**
871
+     * Sets the language for all class error messages.
872
+     * Returns false if it cannot load the language file.  The default language is English.
873
+     * @param string $langcode ISO 639-1 2-character language code (e.g. Portuguese: "br")
874
+     * @param string $lang_path Path to the language file directory
875
+     * @access public
876
+     */
877
+    function SetLanguage($langcode = 'en', $lang_path = 'language/') {
878 878
     //Define full set of translatable strings
879 879
     $PHPMAILER_LANG = array(
880
-      'provide_address' => 'You must provide at least one recipient email address.',
881
-      'mailer_not_supported' => ' mailer is not supported.',
882
-      'execute' => 'Could not execute: ',
883
-      'instantiate' => 'Could not instantiate mail function.',
884
-      'authenticate' => 'SMTP Error: Could not authenticate.',
885
-      'from_failed' => 'The following From address failed: ',
886
-      'recipients_failed' => 'SMTP Error: The following recipients failed: ',
887
-      'data_not_accepted' => 'SMTP Error: Data not accepted.',
888
-      'connect_host' => 'SMTP Error: Could not connect to SMTP host.',
889
-      'file_access' => 'Could not access file: ',
890
-      'file_open' => 'File Error: Could not open file: ',
891
-      'encoding' => 'Unknown encoding: ',
892
-      'signing' => 'Signing Error: ',
893
-      'smtp_error' => 'SMTP server error: ',
894
-      'empty_message' => 'Message body empty',
895
-      'invalid_address' => 'Invalid address',
896
-      'variable_set' => 'Cannot set or reset variable: '
880
+        'provide_address' => 'You must provide at least one recipient email address.',
881
+        'mailer_not_supported' => ' mailer is not supported.',
882
+        'execute' => 'Could not execute: ',
883
+        'instantiate' => 'Could not instantiate mail function.',
884
+        'authenticate' => 'SMTP Error: Could not authenticate.',
885
+        'from_failed' => 'The following From address failed: ',
886
+        'recipients_failed' => 'SMTP Error: The following recipients failed: ',
887
+        'data_not_accepted' => 'SMTP Error: Data not accepted.',
888
+        'connect_host' => 'SMTP Error: Could not connect to SMTP host.',
889
+        'file_access' => 'Could not access file: ',
890
+        'file_open' => 'File Error: Could not open file: ',
891
+        'encoding' => 'Unknown encoding: ',
892
+        'signing' => 'Signing Error: ',
893
+        'smtp_error' => 'SMTP server error: ',
894
+        'empty_message' => 'Message body empty',
895
+        'invalid_address' => 'Invalid address',
896
+        'variable_set' => 'Cannot set or reset variable: '
897 897
     );
898 898
     //Overwrite language-specific strings. This way we'll never have missing translations - no more "language string failed to load"!
899 899
     $l = true;
900 900
     if ($langcode != 'en') { //There is no English translation file
901
-      $l = @include $lang_path.'phpmailer.lang-'.$langcode.'.php';
901
+        $l = @include $lang_path.'phpmailer.lang-'.$langcode.'.php';
902 902
     }
903 903
     $this->language = $PHPMAILER_LANG;
904 904
     return ($l == true); //Returns false if language not found
905
-  }
905
+    }
906 906
 
907
-  /**
908
-  * Return the current array of language strings
909
-  * @return array
910
-  */
911
-  public function GetTranslations() {
907
+    /**
908
+     * Return the current array of language strings
909
+     * @return array
910
+     */
911
+    public function GetTranslations() {
912 912
     return $this->language;
913
-  }
914
-
915
-  /////////////////////////////////////////////////
916
-  // METHODS, MESSAGE CREATION
917
-  /////////////////////////////////////////////////
918
-
919
-  /**
920
-   * Creates recipient headers.
921
-   * @access public
922
-   * @return string
923
-   */
924
-  public function AddrAppend($type, $addr) {
913
+    }
914
+
915
+    /////////////////////////////////////////////////
916
+    // METHODS, MESSAGE CREATION
917
+    /////////////////////////////////////////////////
918
+
919
+    /**
920
+     * Creates recipient headers.
921
+     * @access public
922
+     * @return string
923
+     */
924
+    public function AddrAppend($type, $addr) {
925 925
     $addr_str = $type . ': ';
926 926
     $addresses = array();
927 927
     foreach ($addr as $a) {
928
-      $addresses[] = $this->AddrFormat($a);
928
+        $addresses[] = $this->AddrFormat($a);
929 929
     }
930 930
     $addr_str .= implode(', ', $addresses);
931 931
     $addr_str .= $this->LE;
932 932
 
933 933
     return $addr_str;
934
-  }
935
-
936
-  /**
937
-   * Formats an address correctly.
938
-   * @access public
939
-   * @return string
940
-   */
941
-  public function AddrFormat($addr) {
934
+    }
935
+
936
+    /**
937
+     * Formats an address correctly.
938
+     * @access public
939
+     * @return string
940
+     */
941
+    public function AddrFormat($addr) {
942 942
     if (empty($addr[1])) {
943
-      return $this->SecureHeader($addr[0]);
943
+        return $this->SecureHeader($addr[0]);
944 944
     } else {
945
-      return $this->EncodeHeader($this->SecureHeader($addr[1]), 'phrase') . " <" . $this->SecureHeader($addr[0]) . ">";
946
-    }
947
-  }
948
-
949
-  /**
950
-   * Wraps message for use with mailers that do not
951
-   * automatically perform wrapping and for quoted-printable.
952
-   * Original written by philippe.
953
-   * @param string $message The message to wrap
954
-   * @param integer $length The line length to wrap to
955
-   * @param boolean $qp_mode Whether to run in Quoted-Printable mode
956
-   * @access public
957
-   * @return string
958
-   */
959
-  public function WrapText($message, $length, $qp_mode = false) {
945
+        return $this->EncodeHeader($this->SecureHeader($addr[1]), 'phrase') . " <" . $this->SecureHeader($addr[0]) . ">";
946
+    }
947
+    }
948
+
949
+    /**
950
+     * Wraps message for use with mailers that do not
951
+     * automatically perform wrapping and for quoted-printable.
952
+     * Original written by philippe.
953
+     * @param string $message The message to wrap
954
+     * @param integer $length The line length to wrap to
955
+     * @param boolean $qp_mode Whether to run in Quoted-Printable mode
956
+     * @access public
957
+     * @return string
958
+     */
959
+    public function WrapText($message, $length, $qp_mode = false) {
960 960
     $soft_break = ($qp_mode) ? sprintf(" =%s", $this->LE) : $this->LE;
961 961
     // If utf-8 encoding is used, we will need to make sure we don't
962 962
     // split multibyte characters when we wrap
@@ -964,140 +964,140 @@  discard block
 block discarded – undo
964 964
 
965 965
     $message = $this->FixEOL($message);
966 966
     if (substr($message, -1) == $this->LE) {
967
-      $message = substr($message, 0, -1);
967
+        $message = substr($message, 0, -1);
968 968
     }
969 969
 
970 970
     $line = explode($this->LE, $message);
971 971
     $message = '';
972 972
     for ($i=0 ;$i < count($line); $i++) {
973
-      $line_part = explode(' ', $line[$i]);
974
-      $buf = '';
975
-      for ($e = 0; $e<count($line_part); $e++) {
973
+        $line_part = explode(' ', $line[$i]);
974
+        $buf = '';
975
+        for ($e = 0; $e<count($line_part); $e++) {
976 976
         $word = $line_part[$e];
977 977
         if ($qp_mode and (strlen($word) > $length)) {
978
-          $space_left = $length - strlen($buf) - 1;
979
-          if ($e != 0) {
978
+            $space_left = $length - strlen($buf) - 1;
979
+            if ($e != 0) {
980 980
             if ($space_left > 20) {
981
-              $len = $space_left;
982
-              if ($is_utf8) {
981
+                $len = $space_left;
982
+                if ($is_utf8) {
983 983
                 $len = $this->UTF8CharBoundary($word, $len);
984
-              } elseif (substr($word, $len - 1, 1) == "=") {
984
+                } elseif (substr($word, $len - 1, 1) == "=") {
985 985
                 $len--;
986
-              } elseif (substr($word, $len - 2, 1) == "=") {
986
+                } elseif (substr($word, $len - 2, 1) == "=") {
987 987
                 $len -= 2;
988
-              }
989
-              $part = substr($word, 0, $len);
990
-              $word = substr($word, $len);
991
-              $buf .= ' ' . $part;
992
-              $message .= $buf . sprintf("=%s", $this->LE);
988
+                }
989
+                $part = substr($word, 0, $len);
990
+                $word = substr($word, $len);
991
+                $buf .= ' ' . $part;
992
+                $message .= $buf . sprintf("=%s", $this->LE);
993 993
             } else {
994
-              $message .= $buf . $soft_break;
994
+                $message .= $buf . $soft_break;
995 995
             }
996 996
             $buf = '';
997
-          }
998
-          while (strlen($word) > 0) {
997
+            }
998
+            while (strlen($word) > 0) {
999 999
             $len = $length;
1000 1000
             if ($is_utf8) {
1001
-              $len = $this->UTF8CharBoundary($word, $len);
1001
+                $len = $this->UTF8CharBoundary($word, $len);
1002 1002
             } elseif (substr($word, $len - 1, 1) == "=") {
1003
-              $len--;
1003
+                $len--;
1004 1004
             } elseif (substr($word, $len - 2, 1) == "=") {
1005
-              $len -= 2;
1005
+                $len -= 2;
1006 1006
             }
1007 1007
             $part = substr($word, 0, $len);
1008 1008
             $word = substr($word, $len);
1009 1009
 
1010 1010
             if (strlen($word) > 0) {
1011
-              $message .= $part . sprintf("=%s", $this->LE);
1011
+                $message .= $part . sprintf("=%s", $this->LE);
1012 1012
             } else {
1013
-              $buf = $part;
1013
+                $buf = $part;
1014
+            }
1014 1015
             }
1015
-          }
1016 1016
         } else {
1017
-          $buf_o = $buf;
1018
-          $buf .= ($e == 0) ? $word : (' ' . $word);
1017
+            $buf_o = $buf;
1018
+            $buf .= ($e == 0) ? $word : (' ' . $word);
1019 1019
 
1020
-          if (strlen($buf) > $length and $buf_o != '') {
1020
+            if (strlen($buf) > $length and $buf_o != '') {
1021 1021
             $message .= $buf_o . $soft_break;
1022 1022
             $buf = $word;
1023
-          }
1023
+            }
1024 1024
         }
1025
-      }
1026
-      $message .= $buf . $this->LE;
1025
+        }
1026
+        $message .= $buf . $this->LE;
1027 1027
     }
1028 1028
 
1029 1029
     return $message;
1030
-  }
1031
-
1032
-  /**
1033
-   * Finds last character boundary prior to maxLength in a utf-8
1034
-   * quoted (printable) encoded string.
1035
-   * Original written by Colin Brown.
1036
-   * @access public
1037
-   * @param string $encodedText utf-8 QP text
1038
-   * @param int    $maxLength   find last character boundary prior to this length
1039
-   * @return int
1040
-   */
1041
-  public function UTF8CharBoundary($encodedText, $maxLength) {
1030
+    }
1031
+
1032
+    /**
1033
+     * Finds last character boundary prior to maxLength in a utf-8
1034
+     * quoted (printable) encoded string.
1035
+     * Original written by Colin Brown.
1036
+     * @access public
1037
+     * @param string $encodedText utf-8 QP text
1038
+     * @param int    $maxLength   find last character boundary prior to this length
1039
+     * @return int
1040
+     */
1041
+    public function UTF8CharBoundary($encodedText, $maxLength) {
1042 1042
     $foundSplitPos = false;
1043 1043
     $lookBack = 3;
1044 1044
     while (!$foundSplitPos) {
1045
-      $lastChunk = substr($encodedText, $maxLength - $lookBack, $lookBack);
1046
-      $encodedCharPos = strpos($lastChunk, "=");
1047
-      if ($encodedCharPos !== false) {
1045
+        $lastChunk = substr($encodedText, $maxLength - $lookBack, $lookBack);
1046
+        $encodedCharPos = strpos($lastChunk, "=");
1047
+        if ($encodedCharPos !== false) {
1048 1048
         // Found start of encoded character byte within $lookBack block.
1049 1049
         // Check the encoded byte value (the 2 chars after the '=')
1050 1050
         $hex = substr($encodedText, $maxLength - $lookBack + $encodedCharPos + 1, 2);
1051 1051
         $dec = hexdec($hex);
1052 1052
         if ($dec < 128) { // Single byte character.
1053
-          // If the encoded char was found at pos 0, it will fit
1054
-          // otherwise reduce maxLength to start of the encoded char
1055
-          $maxLength = ($encodedCharPos == 0) ? $maxLength :
1053
+            // If the encoded char was found at pos 0, it will fit
1054
+            // otherwise reduce maxLength to start of the encoded char
1055
+            $maxLength = ($encodedCharPos == 0) ? $maxLength :
1056 1056
           $maxLength - ($lookBack - $encodedCharPos);
1057
-          $foundSplitPos = true;
1057
+            $foundSplitPos = true;
1058 1058
         } elseif ($dec >= 192) { // First byte of a multi byte character
1059
-          // Reduce maxLength to split at start of character
1060
-          $maxLength = $maxLength - ($lookBack - $encodedCharPos);
1061
-          $foundSplitPos = true;
1059
+            // Reduce maxLength to split at start of character
1060
+            $maxLength = $maxLength - ($lookBack - $encodedCharPos);
1061
+            $foundSplitPos = true;
1062 1062
         } elseif ($dec < 192) { // Middle byte of a multi byte character, look further back
1063
-          $lookBack += 3;
1063
+            $lookBack += 3;
1064 1064
         }
1065
-      } else {
1065
+        } else {
1066 1066
         // No encoded character found
1067 1067
         $foundSplitPos = true;
1068
-      }
1068
+        }
1069 1069
     }
1070 1070
     return $maxLength;
1071
-  }
1071
+    }
1072 1072
 
1073 1073
 
1074
-  /**
1075
-   * Set the body wrapping.
1076
-   * @access public
1077
-   * @return void
1078
-   */
1079
-  public function SetWordWrap() {
1074
+    /**
1075
+     * Set the body wrapping.
1076
+     * @access public
1077
+     * @return void
1078
+     */
1079
+    public function SetWordWrap() {
1080 1080
     if($this->WordWrap < 1) {
1081
-      return;
1081
+        return;
1082 1082
     }
1083 1083
 
1084 1084
     switch($this->message_type) {
1085
-      case 'alt':
1085
+        case 'alt':
1086 1086
       case 'alt_attachments':
1087 1087
         $this->AltBody = $this->WrapText($this->AltBody, $this->WordWrap);
1088 1088
         break;
1089
-      default:
1089
+        default:
1090 1090
         $this->Body = $this->WrapText($this->Body, $this->WordWrap);
1091 1091
         break;
1092 1092
     }
1093
-  }
1093
+    }
1094 1094
 
1095
-  /**
1096
-   * Assembles message header.
1097
-   * @access public
1098
-   * @return string The assembled header
1099
-   */
1100
-  public function CreateHeader() {
1095
+    /**
1096
+     * Assembles message header.
1097
+     * @access public
1098
+     * @return string The assembled header
1099
+     */
1100
+    public function CreateHeader() {
1101 1101
     $result = '';
1102 1102
 
1103 1103
     // Set the boundaries
@@ -1107,24 +1107,24 @@  discard block
 block discarded – undo
1107 1107
 
1108 1108
     $result .= $this->HeaderLine('Date', self::RFCDate());
1109 1109
     if($this->Sender == '') {
1110
-      $result .= $this->HeaderLine('Return-Path', trim($this->From));
1110
+        $result .= $this->HeaderLine('Return-Path', trim($this->From));
1111 1111
     } else {
1112
-      $result .= $this->HeaderLine('Return-Path', trim($this->Sender));
1112
+        $result .= $this->HeaderLine('Return-Path', trim($this->Sender));
1113 1113
     }
1114 1114
 
1115 1115
     // To be created automatically by mail()
1116 1116
     if($this->Mailer != 'mail') {
1117
-      if ($this->SingleTo === true) {
1117
+        if ($this->SingleTo === true) {
1118 1118
         foreach($this->to as $t) {
1119
-          $this->SingleToArray[] = $this->AddrFormat($t);
1119
+            $this->SingleToArray[] = $this->AddrFormat($t);
1120 1120
         }
1121
-      } else {
1121
+        } else {
1122 1122
         if(count($this->to) > 0) {
1123
-          $result .= $this->AddrAppend('To', $this->to);
1123
+            $result .= $this->AddrAppend('To', $this->to);
1124 1124
         } elseif (count($this->cc) == 0) {
1125
-          $result .= $this->HeaderLine('To', 'undisclosed-recipients:;');
1125
+            $result .= $this->HeaderLine('To', 'undisclosed-recipients:;');
1126
+        }
1126 1127
         }
1127
-      }
1128 1128
     }
1129 1129
 
1130 1130
     $from = array();
@@ -1134,97 +1134,97 @@  discard block
 block discarded – undo
1134 1134
 
1135 1135
     // sendmail and mail() extract Cc from the header before sending
1136 1136
     if(count($this->cc) > 0) {
1137
-      $result .= $this->AddrAppend('Cc', $this->cc);
1137
+        $result .= $this->AddrAppend('Cc', $this->cc);
1138 1138
     }
1139 1139
 
1140 1140
     // sendmail and mail() extract Bcc from the header before sending
1141 1141
     if((($this->Mailer == 'sendmail') || ($this->Mailer == 'mail')) && (count($this->bcc) > 0)) {
1142
-      $result .= $this->AddrAppend('Bcc', $this->bcc);
1142
+        $result .= $this->AddrAppend('Bcc', $this->bcc);
1143 1143
     }
1144 1144
 
1145 1145
     if(count($this->ReplyTo) > 0) {
1146
-      $result .= $this->AddrAppend('Reply-to', $this->ReplyTo);
1146
+        $result .= $this->AddrAppend('Reply-to', $this->ReplyTo);
1147 1147
     }
1148 1148
 
1149 1149
     // mail() sets the subject itself
1150 1150
     if($this->Mailer != 'mail') {
1151
-      $result .= $this->HeaderLine('Subject', $this->EncodeHeader($this->SecureHeader($this->Subject)));
1151
+        $result .= $this->HeaderLine('Subject', $this->EncodeHeader($this->SecureHeader($this->Subject)));
1152 1152
     }
1153 1153
 
1154 1154
     if($this->MessageID != '') {
1155
-      $result .= $this->HeaderLine('Message-ID',$this->MessageID);
1155
+        $result .= $this->HeaderLine('Message-ID',$this->MessageID);
1156 1156
     } else {
1157
-      $result .= sprintf("Message-ID: <%s@%s>%s", $uniq_id, $this->ServerHostname(), $this->LE);
1157
+        $result .= sprintf("Message-ID: <%s@%s>%s", $uniq_id, $this->ServerHostname(), $this->LE);
1158 1158
     }
1159 1159
     $result .= $this->HeaderLine('X-Priority', $this->Priority);
1160 1160
     $result .= $this->HeaderLine('X-Mailer', 'PHPMailer '.$this->Version.' (phpmailer.sourceforge.net)');
1161 1161
 
1162 1162
     if($this->ConfirmReadingTo != '') {
1163
-      $result .= $this->HeaderLine('Disposition-Notification-To', '<' . trim($this->ConfirmReadingTo) . '>');
1163
+        $result .= $this->HeaderLine('Disposition-Notification-To', '<' . trim($this->ConfirmReadingTo) . '>');
1164 1164
     }
1165 1165
 
1166 1166
     // Add custom headers
1167 1167
     for($index = 0; $index < count($this->CustomHeader); $index++) {
1168
-      $result .= $this->HeaderLine(trim($this->CustomHeader[$index][0]), $this->EncodeHeader(trim($this->CustomHeader[$index][1])));
1168
+        $result .= $this->HeaderLine(trim($this->CustomHeader[$index][0]), $this->EncodeHeader(trim($this->CustomHeader[$index][1])));
1169 1169
     }
1170 1170
     if (!$this->sign_key_file) {
1171
-      $result .= $this->HeaderLine('MIME-Version', '1.0');
1172
-      $result .= $this->GetMailMIME();
1171
+        $result .= $this->HeaderLine('MIME-Version', '1.0');
1172
+        $result .= $this->GetMailMIME();
1173 1173
     }
1174 1174
 
1175 1175
     return $result;
1176
-  }
1177
-
1178
-  /**
1179
-   * Returns the message MIME.
1180
-   * @access public
1181
-   * @return string
1182
-   */
1183
-  public function GetMailMIME() {
1176
+    }
1177
+
1178
+    /**
1179
+     * Returns the message MIME.
1180
+     * @access public
1181
+     * @return string
1182
+     */
1183
+    public function GetMailMIME() {
1184 1184
     $result = '';
1185 1185
     switch($this->message_type) {
1186
-      case 'plain':
1186
+        case 'plain':
1187 1187
         $result .= $this->HeaderLine('Content-Transfer-Encoding', $this->Encoding);
1188 1188
         $result .= sprintf("Content-Type: %s; charset=\"%s\"", $this->ContentType, $this->CharSet);
1189 1189
         break;
1190
-      case 'attachments':
1190
+        case 'attachments':
1191 1191
       case 'alt_attachments':
1192 1192
         if($this->InlineImageExists()){
1193
-          $result .= sprintf("Content-Type: %s;%s\ttype=\"text/html\";%s\tboundary=\"%s\"%s", 'multipart/related', $this->LE, $this->LE, $this->boundary[1], $this->LE);
1193
+            $result .= sprintf("Content-Type: %s;%s\ttype=\"text/html\";%s\tboundary=\"%s\"%s", 'multipart/related', $this->LE, $this->LE, $this->boundary[1], $this->LE);
1194 1194
         } else {
1195
-          $result .= $this->HeaderLine('Content-Type', 'multipart/mixed;');
1196
-          $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
1195
+            $result .= $this->HeaderLine('Content-Type', 'multipart/mixed;');
1196
+            $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
1197 1197
         }
1198 1198
         break;
1199
-      case 'alt':
1199
+        case 'alt':
1200 1200
         $result .= $this->HeaderLine('Content-Type', 'multipart/alternative;');
1201 1201
         $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
1202 1202
         break;
1203 1203
     }
1204 1204
 
1205 1205
     if($this->Mailer != 'mail') {
1206
-      $result .= $this->LE.$this->LE;
1206
+        $result .= $this->LE.$this->LE;
1207 1207
     }
1208 1208
 
1209 1209
     return $result;
1210
-  }
1211
-
1212
-  /**
1213
-   * Assembles the message body.  Returns an empty string on failure.
1214
-   * @access public
1215
-   * @return string The assembled message body
1216
-   */
1217
-  public function CreateBody() {
1210
+    }
1211
+
1212
+    /**
1213
+     * Assembles the message body.  Returns an empty string on failure.
1214
+     * @access public
1215
+     * @return string The assembled message body
1216
+     */
1217
+    public function CreateBody() {
1218 1218
     $body = '';
1219 1219
 
1220 1220
     if ($this->sign_key_file) {
1221
-      $body .= $this->GetMailMIME();
1221
+        $body .= $this->GetMailMIME();
1222 1222
     }
1223 1223
 
1224 1224
     $this->SetWordWrap();
1225 1225
 
1226 1226
     switch($this->message_type) {
1227
-      case 'alt':
1227
+        case 'alt':
1228 1228
         $body .= $this->GetBoundary($this->boundary[1], '', 'text/plain', '');
1229 1229
         $body .= $this->EncodeString($this->AltBody, $this->Encoding);
1230 1230
         $body .= $this->LE.$this->LE;
@@ -1233,16 +1233,16 @@  discard block
 block discarded – undo
1233 1233
         $body .= $this->LE.$this->LE;
1234 1234
         $body .= $this->EndBoundary($this->boundary[1]);
1235 1235
         break;
1236
-      case 'plain':
1236
+        case 'plain':
1237 1237
         $body .= $this->EncodeString($this->Body, $this->Encoding);
1238 1238
         break;
1239
-      case 'attachments':
1239
+        case 'attachments':
1240 1240
         $body .= $this->GetBoundary($this->boundary[1], '', '', '');
1241 1241
         $body .= $this->EncodeString($this->Body, $this->Encoding);
1242 1242
         $body .= $this->LE;
1243 1243
         $body .= $this->AttachAll();
1244 1244
         break;
1245
-      case 'alt_attachments':
1245
+        case 'alt_attachments':
1246 1246
         $body .= sprintf("--%s%s", $this->boundary[1], $this->LE);
1247 1247
         $body .= sprintf("Content-Type: %s;%s" . "\tboundary=\"%s\"%s", 'multipart/alternative', $this->LE, $this->boundary[2], $this->LE.$this->LE);
1248 1248
         $body .= $this->GetBoundary($this->boundary[2], '', 'text/plain', '') . $this->LE; // Create text body
@@ -1257,46 +1257,46 @@  discard block
 block discarded – undo
1257 1257
     }
1258 1258
 
1259 1259
     if ($this->IsError()) {
1260
-      $body = '';
1260
+        $body = '';
1261 1261
     } elseif ($this->sign_key_file) {
1262
-      try {
1262
+        try {
1263 1263
         $file = tempnam('', 'mail');
1264 1264
         file_put_contents($file, $body); //TODO check this worked
1265 1265
         $signed = tempnam("", "signed");
1266 1266
         if (@openssl_pkcs7_sign($file, $signed, "file://".$this->sign_cert_file, array("file://".$this->sign_key_file, $this->sign_key_pass), NULL)) {
1267
-          @unlink($file);
1268
-          @unlink($signed);
1269
-          $body = file_get_contents($signed);
1267
+            @unlink($file);
1268
+            @unlink($signed);
1269
+            $body = file_get_contents($signed);
1270 1270
         } else {
1271
-          @unlink($file);
1272
-          @unlink($signed);
1273
-          throw new phpmailerException($this->Lang("signing").openssl_error_string());
1271
+            @unlink($file);
1272
+            @unlink($signed);
1273
+            throw new phpmailerException($this->Lang("signing").openssl_error_string());
1274 1274
         }
1275
-      } catch (phpmailerException $e) {
1275
+        } catch (phpmailerException $e) {
1276 1276
         $body = '';
1277 1277
         if ($this->exceptions) {
1278
-          throw $e;
1278
+            throw $e;
1279
+        }
1279 1280
         }
1280
-      }
1281 1281
     }
1282 1282
 
1283 1283
     return $body;
1284
-  }
1284
+    }
1285 1285
 
1286
-  /**
1287
-   * Returns the start of a message boundary.
1288
-   * @access private
1289
-   */
1290
-  private function GetBoundary($boundary, $charSet, $contentType, $encoding) {
1286
+    /**
1287
+     * Returns the start of a message boundary.
1288
+     * @access private
1289
+     */
1290
+    private function GetBoundary($boundary, $charSet, $contentType, $encoding) {
1291 1291
     $result = '';
1292 1292
     if($charSet == '') {
1293
-      $charSet = $this->CharSet;
1293
+        $charSet = $this->CharSet;
1294 1294
     }
1295 1295
     if($contentType == '') {
1296
-      $contentType = $this->ContentType;
1296
+        $contentType = $this->ContentType;
1297 1297
     }
1298 1298
     if($encoding == '') {
1299
-      $encoding = $this->Encoding;
1299
+        $encoding = $this->Encoding;
1300 1300
     }
1301 1301
     $result .= $this->TextLine('--' . $boundary);
1302 1302
     $result .= sprintf("Content-Type: %s; charset = \"%s\"", $contentType, $charSet);
@@ -1305,80 +1305,80 @@  discard block
 block discarded – undo
1305 1305
     $result .= $this->LE;
1306 1306
 
1307 1307
     return $result;
1308
-  }
1308
+    }
1309 1309
 
1310
-  /**
1311
-   * Returns the end of a message boundary.
1312
-   * @access private
1313
-   */
1314
-  private function EndBoundary($boundary) {
1310
+    /**
1311
+     * Returns the end of a message boundary.
1312
+     * @access private
1313
+     */
1314
+    private function EndBoundary($boundary) {
1315 1315
     return $this->LE . '--' . $boundary . '--' . $this->LE;
1316
-  }
1317
-
1318
-  /**
1319
-   * Sets the message type.
1320
-   * @access private
1321
-   * @return void
1322
-   */
1323
-  private function SetMessageType() {
1316
+    }
1317
+
1318
+    /**
1319
+     * Sets the message type.
1320
+     * @access private
1321
+     * @return void
1322
+     */
1323
+    private function SetMessageType() {
1324 1324
     if(count($this->attachment) < 1 && strlen($this->AltBody) < 1) {
1325
-      $this->message_type = 'plain';
1325
+        $this->message_type = 'plain';
1326 1326
     } else {
1327
-      if(count($this->attachment) > 0) {
1327
+        if(count($this->attachment) > 0) {
1328 1328
         $this->message_type = 'attachments';
1329
-      }
1330
-      if(strlen($this->AltBody) > 0 && count($this->attachment) < 1) {
1329
+        }
1330
+        if(strlen($this->AltBody) > 0 && count($this->attachment) < 1) {
1331 1331
         $this->message_type = 'alt';
1332
-      }
1333
-      if(strlen($this->AltBody) > 0 && count($this->attachment) > 0) {
1332
+        }
1333
+        if(strlen($this->AltBody) > 0 && count($this->attachment) > 0) {
1334 1334
         $this->message_type = 'alt_attachments';
1335
-      }
1335
+        }
1336
+    }
1336 1337
     }
1337
-  }
1338 1338
 
1339
-  /**
1340
-   *  Returns a formatted header line.
1341
-   * @access public
1342
-   * @return string
1343
-   */
1344
-  public function HeaderLine($name, $value) {
1339
+    /**
1340
+     *  Returns a formatted header line.
1341
+     * @access public
1342
+     * @return string
1343
+     */
1344
+    public function HeaderLine($name, $value) {
1345 1345
     return $name . ': ' . $value . $this->LE;
1346
-  }
1347
-
1348
-  /**
1349
-   * Returns a formatted mail line.
1350
-   * @access public
1351
-   * @return string
1352
-   */
1353
-  public function TextLine($value) {
1346
+    }
1347
+
1348
+    /**
1349
+     * Returns a formatted mail line.
1350
+     * @access public
1351
+     * @return string
1352
+     */
1353
+    public function TextLine($value) {
1354 1354
     return $value . $this->LE;
1355
-  }
1356
-
1357
-  /////////////////////////////////////////////////
1358
-  // CLASS METHODS, ATTACHMENTS
1359
-  /////////////////////////////////////////////////
1360
-
1361
-  /**
1362
-   * Adds an attachment from a path on the filesystem.
1363
-   * Returns false if the file could not be found
1364
-   * or accessed.
1365
-   * @param string $path Path to the attachment.
1366
-   * @param string $name Overrides the attachment name.
1367
-   * @param string $encoding File encoding (see $Encoding).
1368
-   * @param string $type File extension (MIME) type.
1369
-   * @return bool
1370
-   */
1371
-  public function AddAttachment($path, $name = '', $encoding = 'base64', $type = 'application/octet-stream') {
1355
+    }
1356
+
1357
+    /////////////////////////////////////////////////
1358
+    // CLASS METHODS, ATTACHMENTS
1359
+    /////////////////////////////////////////////////
1360
+
1361
+    /**
1362
+     * Adds an attachment from a path on the filesystem.
1363
+     * Returns false if the file could not be found
1364
+     * or accessed.
1365
+     * @param string $path Path to the attachment.
1366
+     * @param string $name Overrides the attachment name.
1367
+     * @param string $encoding File encoding (see $Encoding).
1368
+     * @param string $type File extension (MIME) type.
1369
+     * @return bool
1370
+     */
1371
+    public function AddAttachment($path, $name = '', $encoding = 'base64', $type = 'application/octet-stream') {
1372 1372
     try {
1373
-      if ( !@is_file($path) ) {
1373
+        if ( !@is_file($path) ) {
1374 1374
         throw new phpmailerException($this->Lang('file_access') . $path, self::STOP_CONTINUE);
1375
-      }
1376
-      $filename = basename($path);
1377
-      if ( $name == '' ) {
1375
+        }
1376
+        $filename = basename($path);
1377
+        if ( $name == '' ) {
1378 1378
         $name = $filename;
1379
-      }
1379
+        }
1380 1380
 
1381
-      $this->attachment[] = array(
1381
+        $this->attachment[] = array(
1382 1382
         0 => $path,
1383 1383
         1 => $filename,
1384 1384
         2 => $name,
@@ -1387,36 +1387,36 @@  discard block
 block discarded – undo
1387 1387
         5 => false,  // isStringAttachment
1388 1388
         6 => 'attachment',
1389 1389
         7 => 0
1390
-      );
1390
+        );
1391 1391
 
1392 1392
     } catch (phpmailerException $e) {
1393
-      $this->SetError($e->getMessage());
1394
-      if ($this->exceptions) {
1393
+        $this->SetError($e->getMessage());
1394
+        if ($this->exceptions) {
1395 1395
         throw $e;
1396
-      }
1397
-      error_log($e->getMessage()."\n");
1398
-      if ( $e->getCode() == self::STOP_CRITICAL ) {
1396
+        }
1397
+        error_log($e->getMessage()."\n");
1398
+        if ( $e->getCode() == self::STOP_CRITICAL ) {
1399 1399
         return false;
1400
-      }
1400
+        }
1401 1401
     }
1402 1402
     return true;
1403
-  }
1403
+    }
1404 1404
 
1405
-  /**
1406
-  * Return the current array of attachments
1407
-  * @return array
1408
-  */
1409
-  public function GetAttachments() {
1405
+    /**
1406
+     * Return the current array of attachments
1407
+     * @return array
1408
+     */
1409
+    public function GetAttachments() {
1410 1410
     return $this->attachment;
1411
-  }
1412
-
1413
-  /**
1414
-   * Attaches all fs, string, and binary attachments to the message.
1415
-   * Returns an empty string on failure.
1416
-   * @access private
1417
-   * @return string
1418
-   */
1419
-  private function AttachAll() {
1411
+    }
1412
+
1413
+    /**
1414
+     * Attaches all fs, string, and binary attachments to the message.
1415
+     * Returns an empty string on failure.
1416
+     * @access private
1417
+     * @return string
1418
+     */
1419
+    private function AttachAll() {
1420 1420
     // Return text of body
1421 1421
     $mime = array();
1422 1422
     $cidUniq = array();
@@ -1424,70 +1424,70 @@  discard block
 block discarded – undo
1424 1424
 
1425 1425
     // Add all attachments
1426 1426
     foreach ($this->attachment as $attachment) {
1427
-      // Check for string attachment
1428
-      $bString = $attachment[5];
1429
-      if ($bString) {
1427
+        // Check for string attachment
1428
+        $bString = $attachment[5];
1429
+        if ($bString) {
1430 1430
         $string = $attachment[0];
1431
-      } else {
1431
+        } else {
1432 1432
         $path = $attachment[0];
1433
-      }
1434
-
1435
-      if (in_array($attachment[0], $incl)) { continue; }
1436
-      $filename    = $attachment[1];
1437
-      $name        = $attachment[2];
1438
-      $encoding    = $attachment[3];
1439
-      $type        = $attachment[4];
1440
-      $disposition = $attachment[6];
1441
-      $cid         = $attachment[7];
1442
-      $incl[]      = $attachment[0];
1443
-      if ( $disposition == 'inline' && isset($cidUniq[$cid]) ) { continue; }
1444
-      $cidUniq[$cid] = true;
1445
-
1446
-      $mime[] = sprintf("--%s%s", $this->boundary[1], $this->LE);
1447
-      $mime[] = sprintf("Content-Type: %s; name=\"%s\"%s", $type, $this->EncodeHeader($this->SecureHeader($name)), $this->LE);
1448
-      $mime[] = sprintf("Content-Transfer-Encoding: %s%s", $encoding, $this->LE);
1449
-
1450
-      if($disposition == 'inline') {
1433
+        }
1434
+
1435
+        if (in_array($attachment[0], $incl)) { continue; }
1436
+        $filename    = $attachment[1];
1437
+        $name        = $attachment[2];
1438
+        $encoding    = $attachment[3];
1439
+        $type        = $attachment[4];
1440
+        $disposition = $attachment[6];
1441
+        $cid         = $attachment[7];
1442
+        $incl[]      = $attachment[0];
1443
+        if ( $disposition == 'inline' && isset($cidUniq[$cid]) ) { continue; }
1444
+        $cidUniq[$cid] = true;
1445
+
1446
+        $mime[] = sprintf("--%s%s", $this->boundary[1], $this->LE);
1447
+        $mime[] = sprintf("Content-Type: %s; name=\"%s\"%s", $type, $this->EncodeHeader($this->SecureHeader($name)), $this->LE);
1448
+        $mime[] = sprintf("Content-Transfer-Encoding: %s%s", $encoding, $this->LE);
1449
+
1450
+        if($disposition == 'inline') {
1451 1451
         $mime[] = sprintf("Content-ID: <%s>%s", $cid, $this->LE);
1452
-      }
1452
+        }
1453 1453
 
1454
-      $mime[] = sprintf("Content-Disposition: %s; filename=\"%s\"%s", $disposition, $this->EncodeHeader($this->SecureHeader($name)), $this->LE.$this->LE);
1454
+        $mime[] = sprintf("Content-Disposition: %s; filename=\"%s\"%s", $disposition, $this->EncodeHeader($this->SecureHeader($name)), $this->LE.$this->LE);
1455 1455
 
1456
-      // Encode as string attachment
1457
-      if($bString) {
1456
+        // Encode as string attachment
1457
+        if($bString) {
1458 1458
         $mime[] = $this->EncodeString($string, $encoding);
1459 1459
         if($this->IsError()) {
1460
-          return '';
1460
+            return '';
1461 1461
         }
1462 1462
         $mime[] = $this->LE.$this->LE;
1463
-      } else {
1463
+        } else {
1464 1464
         $mime[] = $this->EncodeFile($path, $encoding);
1465 1465
         if($this->IsError()) {
1466
-          return '';
1466
+            return '';
1467 1467
         }
1468 1468
         $mime[] = $this->LE.$this->LE;
1469
-      }
1469
+        }
1470 1470
     }
1471 1471
 
1472 1472
     $mime[] = sprintf("--%s--%s", $this->boundary[1], $this->LE);
1473 1473
 
1474 1474
     return join('', $mime);
1475
-  }
1476
-
1477
-  /**
1478
-   * Encodes attachment in requested format.
1479
-   * Returns an empty string on failure.
1480
-   * @param string $path The full path to the file
1481
-   * @param string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable'
1482
-   * @see EncodeFile()
1483
-   * @access private
1484
-   * @return string
1485
-   */
1486
-  private function EncodeFile($path, $encoding = 'base64') {
1475
+    }
1476
+
1477
+    /**
1478
+     * Encodes attachment in requested format.
1479
+     * Returns an empty string on failure.
1480
+     * @param string $path The full path to the file
1481
+     * @param string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable'
1482
+     * @see EncodeFile()
1483
+     * @access private
1484
+     * @return string
1485
+     */
1486
+    private function EncodeFile($path, $encoding = 'base64') {
1487 1487
     try {
1488
-      if (!is_readable($path)) {
1488
+        if (!is_readable($path)) {
1489 1489
         throw new phpmailerException($this->Lang('file_open') . $path, self::STOP_CONTINUE);
1490
-      }
1490
+        }
1491 1491
         $magic_quotes = get_magic_quotes_runtime();
1492 1492
         if ($magic_quotes) {
1493 1493
             if (version_compare(PHP_VERSION, '5.3.0', '<')) {
@@ -1507,114 +1507,114 @@  discard block
 block discarded – undo
1507 1507
         }
1508 1508
         return $file_buffer;
1509 1509
     } catch (Exception $e) {
1510
-      $this->SetError($e->getMessage());
1511
-      return '';
1512
-    }
1513
-  }
1514
-
1515
-  /**
1516
-   * Encodes string to requested format.
1517
-   * Returns an empty string on failure.
1518
-   * @param string $str The text to encode
1519
-   * @param string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable'
1520
-   * @access public
1521
-   * @return string
1522
-   */
1523
-  public function EncodeString ($str, $encoding = 'base64') {
1510
+        $this->SetError($e->getMessage());
1511
+        return '';
1512
+    }
1513
+    }
1514
+
1515
+    /**
1516
+     * Encodes string to requested format.
1517
+     * Returns an empty string on failure.
1518
+     * @param string $str The text to encode
1519
+     * @param string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable'
1520
+     * @access public
1521
+     * @return string
1522
+     */
1523
+    public function EncodeString ($str, $encoding = 'base64') {
1524 1524
     $encoded = '';
1525 1525
     switch(strtolower($encoding)) {
1526
-      case 'base64':
1526
+        case 'base64':
1527 1527
         $encoded = chunk_split(base64_encode($str), 76, $this->LE);
1528 1528
         break;
1529
-      case '7bit':
1529
+        case '7bit':
1530 1530
       case '8bit':
1531 1531
         $encoded = $this->FixEOL($str);
1532 1532
         //Make sure it ends with a line break
1533 1533
         if (substr($encoded, -(strlen($this->LE))) != $this->LE)
1534
-          $encoded .= $this->LE;
1534
+            $encoded .= $this->LE;
1535 1535
         break;
1536
-      case 'binary':
1536
+        case 'binary':
1537 1537
         $encoded = $str;
1538 1538
         break;
1539
-      case 'quoted-printable':
1539
+        case 'quoted-printable':
1540 1540
         $encoded = $this->EncodeQP($str);
1541 1541
         break;
1542
-      default:
1542
+        default:
1543 1543
         $this->SetError($this->Lang('encoding') . $encoding);
1544 1544
         break;
1545 1545
     }
1546 1546
     return $encoded;
1547
-  }
1548
-
1549
-  /**
1550
-   * Encode a header string to best (shortest) of Q, B, quoted or none.
1551
-   * @access public
1552
-   * @return string
1553
-   */
1554
-  public function EncodeHeader($str, $position = 'text') {
1547
+    }
1548
+
1549
+    /**
1550
+     * Encode a header string to best (shortest) of Q, B, quoted or none.
1551
+     * @access public
1552
+     * @return string
1553
+     */
1554
+    public function EncodeHeader($str, $position = 'text') {
1555 1555
     $x = 0;
1556 1556
 
1557 1557
     switch (strtolower($position)) {
1558
-      case 'phrase':
1558
+        case 'phrase':
1559 1559
         if (!preg_match('/[\200-\377]/', $str)) {
1560
-          // Can't use addslashes as we don't know what value has magic_quotes_sybase
1561
-          $encoded = addcslashes($str, "\0..\37\177\\\"");
1562
-          if (($str == $encoded) && !preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $str)) {
1560
+            // Can't use addslashes as we don't know what value has magic_quotes_sybase
1561
+            $encoded = addcslashes($str, "\0..\37\177\\\"");
1562
+            if (($str == $encoded) && !preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $str)) {
1563 1563
             return ($encoded);
1564
-          } else {
1564
+            } else {
1565 1565
             return ("\"$encoded\"");
1566
-          }
1566
+            }
1567 1567
         }
1568 1568
         $x = preg_match_all('/[^\040\041\043-\133\135-\176]/', $str, $matches);
1569 1569
         break;
1570
-      case 'comment':
1570
+        case 'comment':
1571 1571
         $x = preg_match_all('/[()"]/', $str, $matches);
1572 1572
         // Fall-through
1573
-      case 'text':
1573
+        case 'text':
1574 1574
       default:
1575 1575
         $x += preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/', $str, $matches);
1576 1576
         break;
1577 1577
     }
1578 1578
 
1579 1579
     if ($x == 0) {
1580
-      return ($str);
1580
+        return ($str);
1581 1581
     }
1582 1582
 
1583 1583
     $maxlen = 75 - 7 - strlen($this->CharSet);
1584 1584
     // Try to select the encoding which should produce the shortest output
1585 1585
     if (strlen($str)/3 < $x) {
1586
-      $encoding = 'B';
1587
-      // Modified by Ivan Tcholakov, 24-JAN-2010.
1588
-      //if (function_exists('mb_strlen') && $this->HasMultiBytes($str)) {
1589
-      if ($this->HasMultiBytes($str)) {
1590
-      //
1586
+        $encoding = 'B';
1587
+        // Modified by Ivan Tcholakov, 24-JAN-2010.
1588
+        //if (function_exists('mb_strlen') && $this->HasMultiBytes($str)) {
1589
+        if ($this->HasMultiBytes($str)) {
1590
+        //
1591 1591
         // Use a custom function which correctly encodes and wraps long
1592 1592
         // multibyte strings without breaking lines within a character
1593 1593
         $encoded = $this->Base64EncodeWrapMB($str);
1594
-      } else {
1594
+        } else {
1595 1595
         $encoded = base64_encode($str);
1596 1596
         $maxlen -= $maxlen % 4;
1597 1597
         $encoded = trim(chunk_split($encoded, $maxlen, "\n"));
1598
-      }
1598
+        }
1599 1599
     } else {
1600
-      $encoding = 'Q';
1601
-      $encoded = $this->EncodeQ($str, $position);
1602
-      $encoded = $this->WrapText($encoded, $maxlen, true);
1603
-      $encoded = str_replace('='.$this->LE, "\n", trim($encoded));
1600
+        $encoding = 'Q';
1601
+        $encoded = $this->EncodeQ($str, $position);
1602
+        $encoded = $this->WrapText($encoded, $maxlen, true);
1603
+        $encoded = str_replace('='.$this->LE, "\n", trim($encoded));
1604 1604
     }
1605 1605
 
1606 1606
     $encoded = preg_replace('/^(.*)$/m', " =?".$this->CharSet."?$encoding?\\1?=", $encoded);
1607 1607
     $encoded = trim(str_replace("\n", $this->LE, $encoded));
1608 1608
 
1609 1609
     return $encoded;
1610
-  }
1611
-
1612
-  /**
1613
-   * Checks if a string contains multibyte characters.
1614
-   * @access public
1615
-   * @param string $str multi-byte text to wrap encode
1616
-   * @return bool
1617
-   */
1610
+    }
1611
+
1612
+    /**
1613
+     * Checks if a string contains multibyte characters.
1614
+     * @access public
1615
+     * @param string $str multi-byte text to wrap encode
1616
+     * @return bool
1617
+     */
1618 1618
     public function HasMultiBytes($str)
1619 1619
     {
1620 1620
         if (function_exists('mb_strlen')) {
@@ -1625,15 +1625,15 @@  discard block
 block discarded – undo
1625 1625
 
1626 1626
     }
1627 1627
 
1628
-  /**
1629
-   * Correctly encodes and wraps long multibyte strings for mail headers
1630
-   * without breaking lines within a character.
1631
-   * Adapted from a function by paravoid at http://uk.php.net/manual/en/function.mb-encode-mimeheader.php
1632
-   * @access public
1633
-   * @param string $str multi-byte text to wrap encode
1634
-   * @return string
1635
-   */
1636
-  public function Base64EncodeWrapMB($str) {
1628
+    /**
1629
+     * Correctly encodes and wraps long multibyte strings for mail headers
1630
+     * without breaking lines within a character.
1631
+     * Adapted from a function by paravoid at http://uk.php.net/manual/en/function.mb-encode-mimeheader.php
1632
+     * @access public
1633
+     * @param string $str multi-byte text to wrap encode
1634
+     * @return string
1635
+     */
1636
+    public function Base64EncodeWrapMB($str) {
1637 1637
     $start = "=?".$this->CharSet."?B?";
1638 1638
     $end = "?=";
1639 1639
     $encoded = "";
@@ -1650,9 +1650,9 @@  discard block
 block discarded – undo
1650 1650
     $offset = $avgLength = floor($length * $ratio * .75);
1651 1651
 
1652 1652
     for ($i = 0; $i < $mb_length; $i += $offset) {
1653
-      $lookBack = 0;
1653
+        $lookBack = 0;
1654 1654
 
1655
-      do {
1655
+        do {
1656 1656
         $offset = $avgLength - $lookBack;
1657 1657
         // Modified by Ivan Tcholakov, 24-JAN-2010.
1658 1658
         //$chunk = mb_substr($str, $i, $offset, $this->CharSet);
@@ -1660,85 +1660,85 @@  discard block
 block discarded – undo
1660 1660
         //
1661 1661
         $chunk = base64_encode($chunk);
1662 1662
         $lookBack++;
1663
-      }
1664
-      while (strlen($chunk) > $length);
1663
+        }
1664
+        while (strlen($chunk) > $length);
1665 1665
 
1666
-      $encoded .= $chunk . $this->LE;
1666
+        $encoded .= $chunk . $this->LE;
1667 1667
     }
1668 1668
 
1669 1669
     // Chomp the last linefeed
1670 1670
     $encoded = substr($encoded, 0, -strlen($this->LE));
1671 1671
     return $encoded;
1672
-  }
1673
-
1674
-  /**
1675
-  * Encode string to quoted-printable.
1676
-  * Only uses standard PHP, slow, but will always work
1677
-  * @access public
1678
-  * @param string $string the text to encode
1679
-  * @param integer $line_max Number of chars allowed on a line before wrapping
1680
-  * @return string
1681
-  */
1682
-  public function EncodeQPphp( $input = '', $line_max = 76, $space_conv = false) {
1672
+    }
1673
+
1674
+    /**
1675
+     * Encode string to quoted-printable.
1676
+     * Only uses standard PHP, slow, but will always work
1677
+     * @access public
1678
+     * @param string $string the text to encode
1679
+     * @param integer $line_max Number of chars allowed on a line before wrapping
1680
+     * @return string
1681
+     */
1682
+    public function EncodeQPphp( $input = '', $line_max = 76, $space_conv = false) {
1683 1683
     $hex = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
1684 1684
     $lines = preg_split('/(?:\r\n|\r|\n)/', $input);
1685 1685
     $eol = "\r\n";
1686 1686
     $escape = '=';
1687 1687
     $output = '';
1688 1688
     while( list(, $line) = each($lines) ) {
1689
-      $linlen = strlen($line);
1690
-      $newline = '';
1691
-      for($i = 0; $i < $linlen; $i++) {
1689
+        $linlen = strlen($line);
1690
+        $newline = '';
1691
+        for($i = 0; $i < $linlen; $i++) {
1692 1692
         $c = substr( $line, $i, 1 );
1693 1693
         $dec = ord( $c );
1694 1694
         if ( ( $i == 0 ) && ( $dec == 46 ) ) { // convert first point in the line into =2E
1695
-          $c = '=2E';
1695
+            $c = '=2E';
1696 1696
         }
1697 1697
         if ( $dec == 32 ) {
1698
-          if ( $i == ( $linlen - 1 ) ) { // convert space at eol only
1698
+            if ( $i == ( $linlen - 1 ) ) { // convert space at eol only
1699 1699
             $c = '=20';
1700
-          } else if ( $space_conv ) {
1700
+            } else if ( $space_conv ) {
1701 1701
             $c = '=20';
1702
-          }
1702
+            }
1703 1703
         } elseif ( ($dec == 61) || ($dec < 32 ) || ($dec > 126) ) { // always encode "\t", which is *not* required
1704
-          $h2 = floor($dec/16);
1705
-          $h1 = floor($dec%16);
1706
-          $c = $escape.$hex[$h2].$hex[$h1];
1704
+            $h2 = floor($dec/16);
1705
+            $h1 = floor($dec%16);
1706
+            $c = $escape.$hex[$h2].$hex[$h1];
1707 1707
         }
1708 1708
         if ( (strlen($newline) + strlen($c)) >= $line_max ) { // CRLF is not counted
1709
-          $output .= $newline.$escape.$eol; //  soft line break; " =\r\n" is okay
1710
-          $newline = '';
1711
-          // check if newline first character will be point or not
1712
-          if ( $dec == 46 ) {
1709
+            $output .= $newline.$escape.$eol; //  soft line break; " =\r\n" is okay
1710
+            $newline = '';
1711
+            // check if newline first character will be point or not
1712
+            if ( $dec == 46 ) {
1713 1713
             $c = '=2E';
1714
-          }
1714
+            }
1715 1715
         }
1716 1716
         $newline .= $c;
1717
-      } // end of for
1718
-      $output .= $newline.$eol;
1717
+        } // end of for
1718
+        $output .= $newline.$eol;
1719 1719
     } // end of while
1720 1720
     return $output;
1721
-  }
1722
-
1723
-  /**
1724
-  * Encode string to RFC2045 (6.7) quoted-printable format
1725
-  * Uses a PHP5 stream filter to do the encoding about 64x faster than the old version
1726
-  * Also results in same content as you started with after decoding
1727
-  * @see EncodeQPphp()
1728
-  * @access public
1729
-  * @param string $string the text to encode
1730
-  * @param integer $line_max Number of chars allowed on a line before wrapping
1731
-  * @param boolean $space_conv Dummy param for compatibility with existing EncodeQP function
1732
-  * @return string
1733
-  * @author Marcus Bointon
1734
-  */
1735
-  public function EncodeQP($string, $line_max = 76, $space_conv = false) {
1721
+    }
1722
+
1723
+    /**
1724
+     * Encode string to RFC2045 (6.7) quoted-printable format
1725
+     * Uses a PHP5 stream filter to do the encoding about 64x faster than the old version
1726
+     * Also results in same content as you started with after decoding
1727
+     * @see EncodeQPphp()
1728
+     * @access public
1729
+     * @param string $string the text to encode
1730
+     * @param integer $line_max Number of chars allowed on a line before wrapping
1731
+     * @param boolean $space_conv Dummy param for compatibility with existing EncodeQP function
1732
+     * @return string
1733
+     * @author Marcus Bointon
1734
+     */
1735
+    public function EncodeQP($string, $line_max = 76, $space_conv = false) {
1736 1736
     if (function_exists('quoted_printable_encode')) { //Use native function if it's available (>= PHP5.3)
1737
-      return quoted_printable_encode($string);
1737
+        return quoted_printable_encode($string);
1738 1738
     }
1739 1739
     $filters = stream_get_filters();
1740 1740
     if (!in_array('convert.*', $filters)) { //Got convert stream filter?
1741
-      return $this->EncodeQPphp($string, $line_max, $space_conv); //Fall back to old implementation
1741
+        return $this->EncodeQPphp($string, $line_max, $space_conv); //Fall back to old implementation
1742 1742
     }
1743 1743
     $fp = fopen('php://temp/', 'r+');
1744 1744
     $string = preg_replace('/\r\n?/', $this->LE, $string); //Normalise line breaks
@@ -1751,32 +1751,32 @@  discard block
 block discarded – undo
1751 1751
     $out = preg_replace('/^\./m', '=2E', $out); //Encode . if it is first char on a line, workaround for bug in Exchange
1752 1752
     fclose($fp);
1753 1753
     return $out;
1754
-  }
1755
-
1756
-  /**
1757
-   * Encode string to q encoding.
1758
-   * @link http://tools.ietf.org/html/rfc2047
1759
-   * @param string $str the text to encode
1760
-   * @param string $position Where the text is going to be used, see the RFC for what that means
1761
-   * @access public
1762
-   * @return string
1763
-   */
1764
-  public function EncodeQ ($str, $position = 'text') {
1754
+    }
1755
+
1756
+    /**
1757
+     * Encode string to q encoding.
1758
+     * @link http://tools.ietf.org/html/rfc2047
1759
+     * @param string $str the text to encode
1760
+     * @param string $position Where the text is going to be used, see the RFC for what that means
1761
+     * @access public
1762
+     * @return string
1763
+     */
1764
+    public function EncodeQ ($str, $position = 'text') {
1765 1765
     // There should not be any EOL in the string
1766 1766
     $encoded = preg_replace('/[\r\n]*/', '', $str);
1767 1767
 
1768 1768
     switch (strtolower($position)) {
1769
-      case 'phrase':
1769
+        case 'phrase':
1770 1770
         $encoded = @preg_replace("/([^A-Za-z0-9!*+\/ -])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded);
1771 1771
         break;
1772
-      case 'comment':
1772
+        case 'comment':
1773 1773
         $encoded = @preg_replace("/([\(\)\"])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded);
1774
-      case 'text':
1774
+        case 'text':
1775 1775
       default:
1776 1776
         // Replace every high ascii, control =, ? and _ characters
1777 1777
         //TODO using /e (equivalent to eval()) is probably not a good idea
1778 1778
         $encoded = @preg_replace('/([\000-\011\013\014\016-\037\075\077\137\177-\377])/e',
1779
-              "'='.sprintf('%02X', ord('\\1'))", $encoded);
1779
+                "'='.sprintf('%02X', ord('\\1'))", $encoded);
1780 1780
         break;
1781 1781
     }
1782 1782
 
@@ -1784,187 +1784,187 @@  discard block
 block discarded – undo
1784 1784
     $encoded = str_replace(' ', '_', $encoded);
1785 1785
 
1786 1786
     return $encoded;
1787
-  }
1788
-
1789
-  /**
1790
-   * Adds a string or binary attachment (non-filesystem) to the list.
1791
-   * This method can be used to attach ascii or binary data,
1792
-   * such as a BLOB record from a database.
1793
-   * @param string $string String attachment data.
1794
-   * @param string $filename Name of the attachment.
1795
-   * @param string $encoding File encoding (see $Encoding).
1796
-   * @param string $type File extension (MIME) type.
1797
-   * @return void
1798
-   */
1799
-  public function AddStringAttachment($string, $filename, $encoding = 'base64', $type = 'application/octet-stream') {
1787
+    }
1788
+
1789
+    /**
1790
+     * Adds a string or binary attachment (non-filesystem) to the list.
1791
+     * This method can be used to attach ascii or binary data,
1792
+     * such as a BLOB record from a database.
1793
+     * @param string $string String attachment data.
1794
+     * @param string $filename Name of the attachment.
1795
+     * @param string $encoding File encoding (see $Encoding).
1796
+     * @param string $type File extension (MIME) type.
1797
+     * @return void
1798
+     */
1799
+    public function AddStringAttachment($string, $filename, $encoding = 'base64', $type = 'application/octet-stream') {
1800 1800
     // Append to $attachment array
1801 1801
     $this->attachment[] = array(
1802
-      0 => $string,
1803
-      1 => $filename,
1804
-      2 => basename($filename),
1805
-      3 => $encoding,
1806
-      4 => $type,
1807
-      5 => true,  // isStringAttachment
1808
-      6 => 'attachment',
1809
-      7 => 0
1802
+        0 => $string,
1803
+        1 => $filename,
1804
+        2 => basename($filename),
1805
+        3 => $encoding,
1806
+        4 => $type,
1807
+        5 => true,  // isStringAttachment
1808
+        6 => 'attachment',
1809
+        7 => 0
1810 1810
     );
1811
-  }
1812
-
1813
-  /**
1814
-   * Adds an embedded attachment.  This can include images, sounds, and
1815
-   * just about any other document.  Make sure to set the $type to an
1816
-   * image type.  For JPEG images use "image/jpeg" and for GIF images
1817
-   * use "image/gif".
1818
-   * @param string $path Path to the attachment.
1819
-   * @param string $cid Content ID of the attachment.  Use this to identify
1820
-   *        the Id for accessing the image in an HTML form.
1821
-   * @param string $name Overrides the attachment name.
1822
-   * @param string $encoding File encoding (see $Encoding).
1823
-   * @param string $type File extension (MIME) type.
1824
-   * @return bool
1825
-   */
1826
-  public function AddEmbeddedImage($path, $cid, $name = '', $encoding = 'base64', $type = 'application/octet-stream') {
1811
+    }
1812
+
1813
+    /**
1814
+     * Adds an embedded attachment.  This can include images, sounds, and
1815
+     * just about any other document.  Make sure to set the $type to an
1816
+     * image type.  For JPEG images use "image/jpeg" and for GIF images
1817
+     * use "image/gif".
1818
+     * @param string $path Path to the attachment.
1819
+     * @param string $cid Content ID of the attachment.  Use this to identify
1820
+     *        the Id for accessing the image in an HTML form.
1821
+     * @param string $name Overrides the attachment name.
1822
+     * @param string $encoding File encoding (see $Encoding).
1823
+     * @param string $type File extension (MIME) type.
1824
+     * @return bool
1825
+     */
1826
+    public function AddEmbeddedImage($path, $cid, $name = '', $encoding = 'base64', $type = 'application/octet-stream') {
1827 1827
 
1828 1828
     if ( !@is_file($path) ) {
1829
-      $this->SetError($this->Lang('file_access') . $path);
1830
-      return false;
1829
+        $this->SetError($this->Lang('file_access') . $path);
1830
+        return false;
1831 1831
     }
1832 1832
 
1833 1833
     $filename = basename($path);
1834 1834
     if ( $name == '' ) {
1835
-      $name = $filename;
1835
+        $name = $filename;
1836 1836
     }
1837 1837
 
1838 1838
     // Append to $attachment array
1839 1839
     $this->attachment[] = array(
1840
-      0 => $path,
1841
-      1 => $filename,
1842
-      2 => $name,
1843
-      3 => $encoding,
1844
-      4 => $type,
1845
-      5 => false,  // isStringAttachment
1846
-      6 => 'inline',
1847
-      7 => $cid
1840
+        0 => $path,
1841
+        1 => $filename,
1842
+        2 => $name,
1843
+        3 => $encoding,
1844
+        4 => $type,
1845
+        5 => false,  // isStringAttachment
1846
+        6 => 'inline',
1847
+        7 => $cid
1848 1848
     );
1849 1849
 
1850 1850
     return true;
1851
-  }
1852
-
1853
-  /**
1854
-   * Returns true if an inline attachment is present.
1855
-   * @access public
1856
-   * @return bool
1857
-   */
1858
-  public function InlineImageExists() {
1851
+    }
1852
+
1853
+    /**
1854
+     * Returns true if an inline attachment is present.
1855
+     * @access public
1856
+     * @return bool
1857
+     */
1858
+    public function InlineImageExists() {
1859 1859
     foreach($this->attachment as $attachment) {
1860
-      if ($attachment[6] == 'inline') {
1860
+        if ($attachment[6] == 'inline') {
1861 1861
         return true;
1862
-      }
1862
+        }
1863 1863
     }
1864 1864
     return false;
1865
-  }
1865
+    }
1866 1866
 
1867
-  /////////////////////////////////////////////////
1868
-  // CLASS METHODS, MESSAGE RESET
1869
-  /////////////////////////////////////////////////
1867
+    /////////////////////////////////////////////////
1868
+    // CLASS METHODS, MESSAGE RESET
1869
+    /////////////////////////////////////////////////
1870 1870
 
1871
-  /**
1872
-   * Clears all recipients assigned in the TO array.  Returns void.
1873
-   * @return void
1874
-   */
1875
-  public function ClearAddresses() {
1871
+    /**
1872
+     * Clears all recipients assigned in the TO array.  Returns void.
1873
+     * @return void
1874
+     */
1875
+    public function ClearAddresses() {
1876 1876
     foreach($this->to as $to) {
1877
-      unset($this->all_recipients[strtolower($to[0])]);
1877
+        unset($this->all_recipients[strtolower($to[0])]);
1878 1878
     }
1879 1879
     $this->to = array();
1880
-  }
1880
+    }
1881 1881
 
1882
-  /**
1883
-   * Clears all recipients assigned in the CC array.  Returns void.
1884
-   * @return void
1885
-   */
1886
-  public function ClearCCs() {
1882
+    /**
1883
+     * Clears all recipients assigned in the CC array.  Returns void.
1884
+     * @return void
1885
+     */
1886
+    public function ClearCCs() {
1887 1887
     foreach($this->cc as $cc) {
1888
-      unset($this->all_recipients[strtolower($cc[0])]);
1888
+        unset($this->all_recipients[strtolower($cc[0])]);
1889 1889
     }
1890 1890
     $this->cc = array();
1891
-  }
1891
+    }
1892 1892
 
1893
-  /**
1894
-   * Clears all recipients assigned in the BCC array.  Returns void.
1895
-   * @return void
1896
-   */
1897
-  public function ClearBCCs() {
1893
+    /**
1894
+     * Clears all recipients assigned in the BCC array.  Returns void.
1895
+     * @return void
1896
+     */
1897
+    public function ClearBCCs() {
1898 1898
     foreach($this->bcc as $bcc) {
1899
-      unset($this->all_recipients[strtolower($bcc[0])]);
1899
+        unset($this->all_recipients[strtolower($bcc[0])]);
1900 1900
     }
1901 1901
     $this->bcc = array();
1902
-  }
1902
+    }
1903 1903
 
1904
-  /**
1905
-   * Clears all recipients assigned in the ReplyTo array.  Returns void.
1906
-   * @return void
1907
-   */
1908
-  public function ClearReplyTos() {
1904
+    /**
1905
+     * Clears all recipients assigned in the ReplyTo array.  Returns void.
1906
+     * @return void
1907
+     */
1908
+    public function ClearReplyTos() {
1909 1909
     $this->ReplyTo = array();
1910
-  }
1911
-
1912
-  /**
1913
-   * Clears all recipients assigned in the TO, CC and BCC
1914
-   * array.  Returns void.
1915
-   * @return void
1916
-   */
1917
-  public function ClearAllRecipients() {
1910
+    }
1911
+
1912
+    /**
1913
+     * Clears all recipients assigned in the TO, CC and BCC
1914
+     * array.  Returns void.
1915
+     * @return void
1916
+     */
1917
+    public function ClearAllRecipients() {
1918 1918
     $this->to = array();
1919 1919
     $this->cc = array();
1920 1920
     $this->bcc = array();
1921 1921
     $this->all_recipients = array();
1922
-  }
1923
-
1924
-  /**
1925
-   * Clears all previously set filesystem, string, and binary
1926
-   * attachments.  Returns void.
1927
-   * @return void
1928
-   */
1929
-  public function ClearAttachments() {
1922
+    }
1923
+
1924
+    /**
1925
+     * Clears all previously set filesystem, string, and binary
1926
+     * attachments.  Returns void.
1927
+     * @return void
1928
+     */
1929
+    public function ClearAttachments() {
1930 1930
     $this->attachment = array();
1931
-  }
1931
+    }
1932 1932
 
1933
-  /**
1934
-   * Clears all custom headers.  Returns void.
1935
-   * @return void
1936
-   */
1937
-  public function ClearCustomHeaders() {
1933
+    /**
1934
+     * Clears all custom headers.  Returns void.
1935
+     * @return void
1936
+     */
1937
+    public function ClearCustomHeaders() {
1938 1938
     $this->CustomHeader = array();
1939
-  }
1940
-
1941
-  /////////////////////////////////////////////////
1942
-  // CLASS METHODS, MISCELLANEOUS
1943
-  /////////////////////////////////////////////////
1944
-
1945
-  /**
1946
-   * Adds the error message to the error container.
1947
-   * @access protected
1948
-   * @return void
1949
-   */
1950
-  protected function SetError($msg) {
1939
+    }
1940
+
1941
+    /////////////////////////////////////////////////
1942
+    // CLASS METHODS, MISCELLANEOUS
1943
+    /////////////////////////////////////////////////
1944
+
1945
+    /**
1946
+     * Adds the error message to the error container.
1947
+     * @access protected
1948
+     * @return void
1949
+     */
1950
+    protected function SetError($msg) {
1951 1951
     $this->error_count++;
1952 1952
     if ($this->Mailer == 'smtp' and !is_null($this->smtp)) {
1953
-      $lasterror = $this->smtp->getError();
1954
-      if (!empty($lasterror) and array_key_exists('smtp_msg', $lasterror)) {
1953
+        $lasterror = $this->smtp->getError();
1954
+        if (!empty($lasterror) and array_key_exists('smtp_msg', $lasterror)) {
1955 1955
         $msg .= '<p>' . $this->Lang('smtp_error') . $lasterror['smtp_msg'] . "</p>\n";
1956
-      }
1956
+        }
1957 1957
     }
1958 1958
     $this->ErrorInfo = $msg;
1959
-  }
1960
-
1961
-  /**
1962
-   * Returns the proper RFC 822 formatted date.
1963
-   * @access public
1964
-   * @return string
1965
-   * @static
1966
-   */
1967
-  public static function RFCDate() {
1959
+    }
1960
+
1961
+    /**
1962
+     * Returns the proper RFC 822 formatted date.
1963
+     * @access public
1964
+     * @return string
1965
+     * @static
1966
+     */
1967
+    public static function RFCDate() {
1968 1968
     $tz = date('Z');
1969 1969
     $tzs = ($tz < 0) ? '-' : '+';
1970 1970
     $tz = abs($tz);
@@ -1972,346 +1972,346 @@  discard block
 block discarded – undo
1972 1972
     $result = sprintf("%s %s%04d", date('D, j M Y H:i:s'), $tzs, $tz);
1973 1973
 
1974 1974
     return $result;
1975
-  }
1976
-
1977
-  /**
1978
-   * Returns the server hostname or 'localhost.localdomain' if unknown.
1979
-   * @access private
1980
-   * @return string
1981
-   */
1982
-  private function ServerHostname() {
1975
+    }
1976
+
1977
+    /**
1978
+     * Returns the server hostname or 'localhost.localdomain' if unknown.
1979
+     * @access private
1980
+     * @return string
1981
+     */
1982
+    private function ServerHostname() {
1983 1983
     if (!empty($this->Hostname)) {
1984
-      $result = $this->Hostname;
1984
+        $result = $this->Hostname;
1985 1985
     } elseif (isset($_SERVER['SERVER_NAME'])) {
1986
-      $result = $_SERVER['SERVER_NAME'];
1986
+        $result = $_SERVER['SERVER_NAME'];
1987 1987
     } else {
1988
-      $result = 'localhost.localdomain';
1988
+        $result = 'localhost.localdomain';
1989 1989
     }
1990 1990
 
1991 1991
     return $result;
1992
-  }
1993
-
1994
-  /**
1995
-   * Returns a message in the appropriate language.
1996
-   * @access private
1997
-   * @return string
1998
-   */
1999
-  private function Lang($key) {
1992
+    }
1993
+
1994
+    /**
1995
+     * Returns a message in the appropriate language.
1996
+     * @access private
1997
+     * @return string
1998
+     */
1999
+    private function Lang($key) {
2000 2000
     if(count($this->language) < 1) {
2001
-      $this->SetLanguage('en'); // set the default language
2001
+        $this->SetLanguage('en'); // set the default language
2002 2002
     }
2003 2003
 
2004 2004
     if(isset($this->language[$key])) {
2005
-      return $this->language[$key];
2005
+        return $this->language[$key];
2006 2006
     } else {
2007
-      return 'Language string failed to load: ' . $key;
2007
+        return 'Language string failed to load: ' . $key;
2008
+    }
2008 2009
     }
2009
-  }
2010 2010
 
2011
-  /**
2012
-   * Returns true if an error occurred.
2013
-   * @access public
2014
-   * @return bool
2015
-   */
2016
-  public function IsError() {
2011
+    /**
2012
+     * Returns true if an error occurred.
2013
+     * @access public
2014
+     * @return bool
2015
+     */
2016
+    public function IsError() {
2017 2017
     return ($this->error_count > 0);
2018
-  }
2019
-
2020
-  /**
2021
-   * Changes every end of line from CR or LF to CRLF.
2022
-   * @access private
2023
-   * @return string
2024
-   */
2025
-  private function FixEOL($str) {
2018
+    }
2019
+
2020
+    /**
2021
+     * Changes every end of line from CR or LF to CRLF.
2022
+     * @access private
2023
+     * @return string
2024
+     */
2025
+    private function FixEOL($str) {
2026 2026
     $str = str_replace("\r\n", "\n", $str);
2027 2027
     $str = str_replace("\r", "\n", $str);
2028 2028
     $str = str_replace("\n", $this->LE, $str);
2029 2029
     return $str;
2030
-  }
2031
-
2032
-  /**
2033
-   * Adds a custom header.
2034
-   * @access public
2035
-   * @return void
2036
-   */
2037
-  public function AddCustomHeader($custom_header) {
2030
+    }
2031
+
2032
+    /**
2033
+     * Adds a custom header.
2034
+     * @access public
2035
+     * @return void
2036
+     */
2037
+    public function AddCustomHeader($custom_header) {
2038 2038
     $this->CustomHeader[] = explode(':', $custom_header, 2);
2039
-  }
2040
-
2041
-  /**
2042
-   * Evaluates the message and returns modifications for inline images and backgrounds
2043
-   * @access public
2044
-   * @return $message
2045
-   */
2046
-  public function MsgHTML($message, $basedir = '') {
2039
+    }
2040
+
2041
+    /**
2042
+     * Evaluates the message and returns modifications for inline images and backgrounds
2043
+     * @access public
2044
+     * @return $message
2045
+     */
2046
+    public function MsgHTML($message, $basedir = '') {
2047 2047
     preg_match_all("/(src|background)=\"(.*)\"/Ui", $message, $images);
2048 2048
     if(isset($images[2])) {
2049
-      foreach($images[2] as $i => $url) {
2049
+        foreach($images[2] as $i => $url) {
2050 2050
         // do not change urls for absolute images (thanks to corvuscorax)
2051 2051
         if (!preg_match('#^[A-z]+://#',$url)) {
2052
-          $filename = basename($url);
2053
-          $directory = dirname($url);
2054
-          ($directory == '.')?$directory='':'';
2055
-          $cid = 'cid:' . md5($filename);
2056
-          $ext = pathinfo($filename, PATHINFO_EXTENSION);
2057
-          $mimeType  = self::_mime_types($ext);
2058
-          if ( strlen($basedir) > 1 && substr($basedir,-1) != '/') { $basedir .= '/'; }
2059
-          if ( strlen($directory) > 1 && substr($directory,-1) != '/') { $directory .= '/'; }
2060
-          if ( $this->AddEmbeddedImage($basedir.$directory.$filename, md5($filename), $filename, 'base64',$mimeType) ) {
2052
+            $filename = basename($url);
2053
+            $directory = dirname($url);
2054
+            ($directory == '.')?$directory='':'';
2055
+            $cid = 'cid:' . md5($filename);
2056
+            $ext = pathinfo($filename, PATHINFO_EXTENSION);
2057
+            $mimeType  = self::_mime_types($ext);
2058
+            if ( strlen($basedir) > 1 && substr($basedir,-1) != '/') { $basedir .= '/'; }
2059
+            if ( strlen($directory) > 1 && substr($directory,-1) != '/') { $directory .= '/'; }
2060
+            if ( $this->AddEmbeddedImage($basedir.$directory.$filename, md5($filename), $filename, 'base64',$mimeType) ) {
2061 2061
             $message = preg_replace("/".$images[1][$i]."=\"".preg_quote($url, '/')."\"/Ui", $images[1][$i]."=\"".$cid."\"", $message);
2062
-          }
2062
+            }
2063
+        }
2063 2064
         }
2064
-      }
2065 2065
     }
2066 2066
     $this->IsHTML(true);
2067 2067
     $this->Body = $message;
2068 2068
     $textMsg = trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/s','',$message)));
2069 2069
     if (!empty($textMsg) && empty($this->AltBody)) {
2070
-      $this->AltBody = html_entity_decode($textMsg);
2070
+        $this->AltBody = html_entity_decode($textMsg);
2071 2071
     }
2072 2072
     if (empty($this->AltBody)) {
2073
-      $this->AltBody = 'To view this email message, open it in a program that understands HTML!' . "\n\n";
2074
-    }
2075
-  }
2076
-
2077
-  /**
2078
-   * Gets the MIME type of the embedded or inline image
2079
-   * @param string File extension
2080
-   * @access public
2081
-   * @return string MIME type of ext
2082
-   * @static
2083
-   */
2084
-  public static function _mime_types($ext = '') {
2073
+        $this->AltBody = 'To view this email message, open it in a program that understands HTML!' . "\n\n";
2074
+    }
2075
+    }
2076
+
2077
+    /**
2078
+     * Gets the MIME type of the embedded or inline image
2079
+     * @param string File extension
2080
+     * @access public
2081
+     * @return string MIME type of ext
2082
+     * @static
2083
+     */
2084
+    public static function _mime_types($ext = '') {
2085 2085
     $mimes = array(
2086
-      'hqx'   =>  'application/mac-binhex40',
2087
-      'cpt'   =>  'application/mac-compactpro',
2088
-      'doc'   =>  'application/msword',
2089
-      'bin'   =>  'application/macbinary',
2090
-      'dms'   =>  'application/octet-stream',
2091
-      'lha'   =>  'application/octet-stream',
2092
-      'lzh'   =>  'application/octet-stream',
2093
-      'exe'   =>  'application/octet-stream',
2094
-      'class' =>  'application/octet-stream',
2095
-      'psd'   =>  'application/octet-stream',
2096
-      'so'    =>  'application/octet-stream',
2097
-      'sea'   =>  'application/octet-stream',
2098
-      'dll'   =>  'application/octet-stream',
2099
-      'oda'   =>  'application/oda',
2100
-      'pdf'   =>  'application/pdf',
2101
-      'ai'    =>  'application/postscript',
2102
-      'eps'   =>  'application/postscript',
2103
-      'ps'    =>  'application/postscript',
2104
-      'smi'   =>  'application/smil',
2105
-      'smil'  =>  'application/smil',
2106
-      'mif'   =>  'application/vnd.mif',
2107
-      'xls'   =>  'application/vnd.ms-excel',
2108
-      'ppt'   =>  'application/vnd.ms-powerpoint',
2109
-      'wbxml' =>  'application/vnd.wap.wbxml',
2110
-      'wmlc'  =>  'application/vnd.wap.wmlc',
2111
-      'dcr'   =>  'application/x-director',
2112
-      'dir'   =>  'application/x-director',
2113
-      'dxr'   =>  'application/x-director',
2114
-      'dvi'   =>  'application/x-dvi',
2115
-      'gtar'  =>  'application/x-gtar',
2116
-      'php'   =>  'application/x-httpd-php',
2117
-      'php4'  =>  'application/x-httpd-php',
2118
-      'php3'  =>  'application/x-httpd-php',
2119
-      'phtml' =>  'application/x-httpd-php',
2120
-      'phps'  =>  'application/x-httpd-php-source',
2121
-      'js'    =>  'application/x-javascript',
2122
-      'swf'   =>  'application/x-shockwave-flash',
2123
-      'sit'   =>  'application/x-stuffit',
2124
-      'tar'   =>  'application/x-tar',
2125
-      'tgz'   =>  'application/x-tar',
2126
-      'xhtml' =>  'application/xhtml+xml',
2127
-      'xht'   =>  'application/xhtml+xml',
2128
-      'zip'   =>  'application/zip',
2129
-      'mid'   =>  'audio/midi',
2130
-      'midi'  =>  'audio/midi',
2131
-      'mpga'  =>  'audio/mpeg',
2132
-      'mp2'   =>  'audio/mpeg',
2133
-      'mp3'   =>  'audio/mpeg',
2134
-      'aif'   =>  'audio/x-aiff',
2135
-      'aiff'  =>  'audio/x-aiff',
2136
-      'aifc'  =>  'audio/x-aiff',
2137
-      'ram'   =>  'audio/x-pn-realaudio',
2138
-      'rm'    =>  'audio/x-pn-realaudio',
2139
-      'rpm'   =>  'audio/x-pn-realaudio-plugin',
2140
-      'ra'    =>  'audio/x-realaudio',
2141
-      'rv'    =>  'video/vnd.rn-realvideo',
2142
-      'wav'   =>  'audio/x-wav',
2143
-      'bmp'   =>  'image/bmp',
2144
-      'gif'   =>  'image/gif',
2145
-      'jpeg'  =>  'image/jpeg',
2146
-      'jpg'   =>  'image/jpeg',
2147
-      'jpe'   =>  'image/jpeg',
2148
-      'png'   =>  'image/png',
2149
-      'tiff'  =>  'image/tiff',
2150
-      'tif'   =>  'image/tiff',
2151
-      'css'   =>  'text/css',
2152
-      'html'  =>  'text/html',
2153
-      'htm'   =>  'text/html',
2154
-      'shtml' =>  'text/html',
2155
-      'txt'   =>  'text/plain',
2156
-      'text'  =>  'text/plain',
2157
-      'log'   =>  'text/plain',
2158
-      'rtx'   =>  'text/richtext',
2159
-      'rtf'   =>  'text/rtf',
2160
-      'xml'   =>  'text/xml',
2161
-      'xsl'   =>  'text/xml',
2162
-      'mpeg'  =>  'video/mpeg',
2163
-      'mpg'   =>  'video/mpeg',
2164
-      'mpe'   =>  'video/mpeg',
2165
-      'qt'    =>  'video/quicktime',
2166
-      'mov'   =>  'video/quicktime',
2167
-      'avi'   =>  'video/x-msvideo',
2168
-      'movie' =>  'video/x-sgi-movie',
2169
-      'doc'   =>  'application/msword',
2170
-      'word'  =>  'application/msword',
2171
-      'xl'    =>  'application/excel',
2172
-      'eml'   =>  'message/rfc822'
2086
+        'hqx'   =>  'application/mac-binhex40',
2087
+        'cpt'   =>  'application/mac-compactpro',
2088
+        'doc'   =>  'application/msword',
2089
+        'bin'   =>  'application/macbinary',
2090
+        'dms'   =>  'application/octet-stream',
2091
+        'lha'   =>  'application/octet-stream',
2092
+        'lzh'   =>  'application/octet-stream',
2093
+        'exe'   =>  'application/octet-stream',
2094
+        'class' =>  'application/octet-stream',
2095
+        'psd'   =>  'application/octet-stream',
2096
+        'so'    =>  'application/octet-stream',
2097
+        'sea'   =>  'application/octet-stream',
2098
+        'dll'   =>  'application/octet-stream',
2099
+        'oda'   =>  'application/oda',
2100
+        'pdf'   =>  'application/pdf',
2101
+        'ai'    =>  'application/postscript',
2102
+        'eps'   =>  'application/postscript',
2103
+        'ps'    =>  'application/postscript',
2104
+        'smi'   =>  'application/smil',
2105
+        'smil'  =>  'application/smil',
2106
+        'mif'   =>  'application/vnd.mif',
2107
+        'xls'   =>  'application/vnd.ms-excel',
2108
+        'ppt'   =>  'application/vnd.ms-powerpoint',
2109
+        'wbxml' =>  'application/vnd.wap.wbxml',
2110
+        'wmlc'  =>  'application/vnd.wap.wmlc',
2111
+        'dcr'   =>  'application/x-director',
2112
+        'dir'   =>  'application/x-director',
2113
+        'dxr'   =>  'application/x-director',
2114
+        'dvi'   =>  'application/x-dvi',
2115
+        'gtar'  =>  'application/x-gtar',
2116
+        'php'   =>  'application/x-httpd-php',
2117
+        'php4'  =>  'application/x-httpd-php',
2118
+        'php3'  =>  'application/x-httpd-php',
2119
+        'phtml' =>  'application/x-httpd-php',
2120
+        'phps'  =>  'application/x-httpd-php-source',
2121
+        'js'    =>  'application/x-javascript',
2122
+        'swf'   =>  'application/x-shockwave-flash',
2123
+        'sit'   =>  'application/x-stuffit',
2124
+        'tar'   =>  'application/x-tar',
2125
+        'tgz'   =>  'application/x-tar',
2126
+        'xhtml' =>  'application/xhtml+xml',
2127
+        'xht'   =>  'application/xhtml+xml',
2128
+        'zip'   =>  'application/zip',
2129
+        'mid'   =>  'audio/midi',
2130
+        'midi'  =>  'audio/midi',
2131
+        'mpga'  =>  'audio/mpeg',
2132
+        'mp2'   =>  'audio/mpeg',
2133
+        'mp3'   =>  'audio/mpeg',
2134
+        'aif'   =>  'audio/x-aiff',
2135
+        'aiff'  =>  'audio/x-aiff',
2136
+        'aifc'  =>  'audio/x-aiff',
2137
+        'ram'   =>  'audio/x-pn-realaudio',
2138
+        'rm'    =>  'audio/x-pn-realaudio',
2139
+        'rpm'   =>  'audio/x-pn-realaudio-plugin',
2140
+        'ra'    =>  'audio/x-realaudio',
2141
+        'rv'    =>  'video/vnd.rn-realvideo',
2142
+        'wav'   =>  'audio/x-wav',
2143
+        'bmp'   =>  'image/bmp',
2144
+        'gif'   =>  'image/gif',
2145
+        'jpeg'  =>  'image/jpeg',
2146
+        'jpg'   =>  'image/jpeg',
2147
+        'jpe'   =>  'image/jpeg',
2148
+        'png'   =>  'image/png',
2149
+        'tiff'  =>  'image/tiff',
2150
+        'tif'   =>  'image/tiff',
2151
+        'css'   =>  'text/css',
2152
+        'html'  =>  'text/html',
2153
+        'htm'   =>  'text/html',
2154
+        'shtml' =>  'text/html',
2155
+        'txt'   =>  'text/plain',
2156
+        'text'  =>  'text/plain',
2157
+        'log'   =>  'text/plain',
2158
+        'rtx'   =>  'text/richtext',
2159
+        'rtf'   =>  'text/rtf',
2160
+        'xml'   =>  'text/xml',
2161
+        'xsl'   =>  'text/xml',
2162
+        'mpeg'  =>  'video/mpeg',
2163
+        'mpg'   =>  'video/mpeg',
2164
+        'mpe'   =>  'video/mpeg',
2165
+        'qt'    =>  'video/quicktime',
2166
+        'mov'   =>  'video/quicktime',
2167
+        'avi'   =>  'video/x-msvideo',
2168
+        'movie' =>  'video/x-sgi-movie',
2169
+        'doc'   =>  'application/msword',
2170
+        'word'  =>  'application/msword',
2171
+        'xl'    =>  'application/excel',
2172
+        'eml'   =>  'message/rfc822'
2173 2173
     );
2174 2174
     return (!isset($mimes[strtolower($ext)])) ? 'application/octet-stream' : $mimes[strtolower($ext)];
2175
-  }
2176
-
2177
-  /**
2178
-  * Set (or reset) Class Objects (variables)
2179
-  *
2180
-  * Usage Example:
2181
-  * $page->set('X-Priority', '3');
2182
-  *
2183
-  * @access public
2184
-  * @param string $name Parameter Name
2185
-  * @param mixed $value Parameter Value
2186
-  * NOTE: will not work with arrays, there are no arrays to set/reset
2187
-  * @todo Should this not be using __set() magic function?
2188
-  */
2189
-  public function set($name, $value = '') {
2175
+    }
2176
+
2177
+    /**
2178
+     * Set (or reset) Class Objects (variables)
2179
+     *
2180
+     * Usage Example:
2181
+     * $page->set('X-Priority', '3');
2182
+     *
2183
+     * @access public
2184
+     * @param string $name Parameter Name
2185
+     * @param mixed $value Parameter Value
2186
+     * NOTE: will not work with arrays, there are no arrays to set/reset
2187
+     * @todo Should this not be using __set() magic function?
2188
+     */
2189
+    public function set($name, $value = '') {
2190 2190
     try {
2191
-      if (isset($this->$name) ) {
2191
+        if (isset($this->$name) ) {
2192 2192
         $this->$name = $value;
2193
-      } else {
2193
+        } else {
2194 2194
         throw new phpmailerException($this->Lang('variable_set') . $name, self::STOP_CRITICAL);
2195
-      }
2195
+        }
2196 2196
     } catch (Exception $e) {
2197
-      $this->SetError($e->getMessage());
2198
-      if ($e->getCode() == self::STOP_CRITICAL) {
2197
+        $this->SetError($e->getMessage());
2198
+        if ($e->getCode() == self::STOP_CRITICAL) {
2199 2199
         return false;
2200
-      }
2200
+        }
2201 2201
     }
2202 2202
     return true;
2203
-  }
2204
-
2205
-  /**
2206
-   * Strips newlines to prevent header injection.
2207
-   * @access public
2208
-   * @param string $str String
2209
-   * @return string
2210
-   */
2211
-  public function SecureHeader($str) {
2203
+    }
2204
+
2205
+    /**
2206
+     * Strips newlines to prevent header injection.
2207
+     * @access public
2208
+     * @param string $str String
2209
+     * @return string
2210
+     */
2211
+    public function SecureHeader($str) {
2212 2212
     $str = str_replace("\r", '', $str);
2213 2213
     $str = str_replace("\n", '', $str);
2214 2214
     return trim($str);
2215
-  }
2216
-
2217
-  /**
2218
-   * Set the private key file and password to sign the message.
2219
-   *
2220
-   * @access public
2221
-   * @param string $key_filename Parameter File Name
2222
-   * @param string $key_pass Password for private key
2223
-   */
2224
-  public function Sign($cert_filename, $key_filename, $key_pass) {
2215
+    }
2216
+
2217
+    /**
2218
+     * Set the private key file and password to sign the message.
2219
+     *
2220
+     * @access public
2221
+     * @param string $key_filename Parameter File Name
2222
+     * @param string $key_pass Password for private key
2223
+     */
2224
+    public function Sign($cert_filename, $key_filename, $key_pass) {
2225 2225
     $this->sign_cert_file = $cert_filename;
2226 2226
     $this->sign_key_file = $key_filename;
2227 2227
     $this->sign_key_pass = $key_pass;
2228
-  }
2229
-
2230
-  /**
2231
-   * Set the private key file and password to sign the message.
2232
-   *
2233
-   * @access public
2234
-   * @param string $key_filename Parameter File Name
2235
-   * @param string $key_pass Password for private key
2236
-   */
2237
-  public function DKIM_QP($txt) {
2228
+    }
2229
+
2230
+    /**
2231
+     * Set the private key file and password to sign the message.
2232
+     *
2233
+     * @access public
2234
+     * @param string $key_filename Parameter File Name
2235
+     * @param string $key_pass Password for private key
2236
+     */
2237
+    public function DKIM_QP($txt) {
2238 2238
     $tmp="";
2239 2239
     $line="";
2240 2240
     for ($i=0;$i<strlen($txt);$i++) {
2241
-      $ord=ord($txt[$i]);
2242
-      if ( ((0x21 <= $ord) && ($ord <= 0x3A)) || $ord == 0x3C || ((0x3E <= $ord) && ($ord <= 0x7E)) ) {
2241
+        $ord=ord($txt[$i]);
2242
+        if ( ((0x21 <= $ord) && ($ord <= 0x3A)) || $ord == 0x3C || ((0x3E <= $ord) && ($ord <= 0x7E)) ) {
2243 2243
         $line.=$txt[$i];
2244
-      } else {
2244
+        } else {
2245 2245
         $line.="=".sprintf("%02X",$ord);
2246
-      }
2246
+        }
2247 2247
     }
2248 2248
     return $line;
2249
-  }
2250
-
2251
-  /**
2252
-   * Generate DKIM signature
2253
-   *
2254
-   * @access public
2255
-   * @param string $s Header
2256
-   */
2257
-  public function DKIM_Sign($s) {
2249
+    }
2250
+
2251
+    /**
2252
+     * Generate DKIM signature
2253
+     *
2254
+     * @access public
2255
+     * @param string $s Header
2256
+     */
2257
+    public function DKIM_Sign($s) {
2258 2258
     $privKeyStr = file_get_contents($this->DKIM_private);
2259 2259
     if ($this->DKIM_passphrase!='') {
2260
-      $privKey = openssl_pkey_get_private($privKeyStr,$this->DKIM_passphrase);
2260
+        $privKey = openssl_pkey_get_private($privKeyStr,$this->DKIM_passphrase);
2261 2261
     } else {
2262
-      $privKey = $privKeyStr;
2262
+        $privKey = $privKeyStr;
2263 2263
     }
2264 2264
     if (openssl_sign($s, $signature, $privKey)) {
2265
-      return base64_encode($signature);
2265
+        return base64_encode($signature);
2266
+    }
2266 2267
     }
2267
-  }
2268 2268
 
2269
-  /**
2270
-   * Generate DKIM Canonicalization Header
2271
-   *
2272
-   * @access public
2273
-   * @param string $s Header
2274
-   */
2275
-  public function DKIM_HeaderC($s) {
2269
+    /**
2270
+     * Generate DKIM Canonicalization Header
2271
+     *
2272
+     * @access public
2273
+     * @param string $s Header
2274
+     */
2275
+    public function DKIM_HeaderC($s) {
2276 2276
     $s=preg_replace("/\r\n\s+/"," ",$s);
2277 2277
     $lines=explode("\r\n",$s);
2278 2278
     foreach ($lines as $key=>$line) {
2279
-      list($heading,$value)=explode(":",$line,2);
2280
-      $heading=strtolower($heading);
2281
-      $value=preg_replace("/\s+/"," ",$value) ; // Compress useless spaces
2282
-      $lines[$key]=$heading.":".trim($value) ; // Don't forget to remove WSP around the value
2279
+        list($heading,$value)=explode(":",$line,2);
2280
+        $heading=strtolower($heading);
2281
+        $value=preg_replace("/\s+/"," ",$value) ; // Compress useless spaces
2282
+        $lines[$key]=$heading.":".trim($value) ; // Don't forget to remove WSP around the value
2283 2283
     }
2284 2284
     $s=implode("\r\n",$lines);
2285 2285
     return $s;
2286
-  }
2287
-
2288
-  /**
2289
-   * Generate DKIM Canonicalization Body
2290
-   *
2291
-   * @access public
2292
-   * @param string $body Message Body
2293
-   */
2294
-  public function DKIM_BodyC($body) {
2286
+    }
2287
+
2288
+    /**
2289
+     * Generate DKIM Canonicalization Body
2290
+     *
2291
+     * @access public
2292
+     * @param string $body Message Body
2293
+     */
2294
+    public function DKIM_BodyC($body) {
2295 2295
     if ($body == '') return "\r\n";
2296 2296
     // stabilize line endings
2297 2297
     $body=str_replace("\r\n","\n",$body);
2298 2298
     $body=str_replace("\n","\r\n",$body);
2299 2299
     // END stabilize line endings
2300 2300
     while (substr($body,strlen($body)-4,4) == "\r\n\r\n") {
2301
-      $body=substr($body,0,strlen($body)-2);
2301
+        $body=substr($body,0,strlen($body)-2);
2302 2302
     }
2303 2303
     return $body;
2304
-  }
2305
-
2306
-  /**
2307
-   * Create the DKIM header, body, as new header
2308
-   *
2309
-   * @access public
2310
-   * @param string $headers_line Header lines
2311
-   * @param string $subject Subject
2312
-   * @param string $body Body
2313
-   */
2314
-  public function DKIM_Add($headers_line,$subject,$body) {
2304
+    }
2305
+
2306
+    /**
2307
+     * Create the DKIM header, body, as new header
2308
+     *
2309
+     * @access public
2310
+     * @param string $headers_line Header lines
2311
+     * @param string $subject Subject
2312
+     * @param string $body Body
2313
+     */
2314
+    public function DKIM_Add($headers_line,$subject,$body) {
2315 2315
     $DKIMsignatureType    = 'rsa-sha1'; // Signature & hash algorithms
2316 2316
     $DKIMcanonicalization = 'relaxed/simple'; // Canonicalization of header/body
2317 2317
     $DKIMquery            = 'dns/txt'; // Query method
@@ -2319,11 +2319,11 @@  discard block
 block discarded – undo
2319 2319
     $subject_header       = "Subject: $subject";
2320 2320
     $headers              = explode("\r\n",$headers_line);
2321 2321
     foreach($headers as $header) {
2322
-      if (strpos($header,'From:') === 0) {
2322
+        if (strpos($header,'From:') === 0) {
2323 2323
         $from_header=$header;
2324
-      } elseif (strpos($header,'To:') === 0) {
2324
+        } elseif (strpos($header,'To:') === 0) {
2325 2325
         $to_header=$header;
2326
-      }
2326
+        }
2327 2327
     }
2328 2328
     $from     = str_replace('|','=7C',$this->DKIM_QP($from_header));
2329 2329
     $to       = str_replace('|','=7C',$this->DKIM_QP($to_header));
@@ -2344,19 +2344,19 @@  discard block
 block discarded – undo
2344 2344
     $toSign   = $this->DKIM_HeaderC($from_header . "\r\n" . $to_header . "\r\n" . $subject_header . "\r\n" . $dkimhdrs);
2345 2345
     $signed   = $this->DKIM_Sign($toSign);
2346 2346
     return "X-PHPMAILER-DKIM: phpmailer.worxware.com\r\n".$dkimhdrs.$signed."\r\n";
2347
-  }
2347
+    }
2348 2348
 
2349
-  protected function doCallback($isSent,$to,$cc,$bcc,$subject,$body) {
2349
+    protected function doCallback($isSent,$to,$cc,$bcc,$subject,$body) {
2350 2350
     if (!empty($this->action_function) && function_exists($this->action_function)) {
2351
-      $params = array($isSent,$to,$cc,$bcc,$subject,$body);
2352
-      call_user_func_array($this->action_function,$params);
2351
+        $params = array($isSent,$to,$cc,$bcc,$subject,$body);
2352
+        call_user_func_array($this->action_function,$params);
2353
+    }
2353 2354
     }
2354
-  }
2355 2355
 }
2356 2356
 
2357 2357
 class phpmailerException extends Exception {
2358
-  public function errorMessage() {
2358
+    public function errorMessage() {
2359 2359
     $errorMsg = '<strong>' . $this->getMessage() . "</strong><br />\n";
2360 2360
     return $errorMsg;
2361
-  }
2361
+    }
2362 2362
 }
Please login to merge, or discard this patch.
Spacing   +234 added lines, -235 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':
@@ -625,32 +625,32 @@  discard block
 block discarded – undo
625 625
       }
626 626
     if ($this->SingleTo === true) {
627 627
       foreach ($this->SingleToArray as $key => $val) {
628
-        if(!@$mail = popen($sendmail, 'w')) {
629
-          throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
628
+        if (!@$mail = popen($sendmail, 'w')) {
629
+          throw new phpmailerException($this->Lang('execute').$this->Sendmail, self::STOP_CRITICAL);
630 630
         }
631
-        fputs($mail, "To: " . $val . "\n");
631
+        fputs($mail, "To: ".$val."\n");
632 632
         fputs($mail, $header);
633 633
         fputs($mail, $body);
634 634
         $result = pclose($mail);
635 635
         // implement call back function if it exists
636 636
         $isSent = ($result == 0) ? 1 : 0;
637
-        $this->doCallback($isSent,$val,$this->cc,$this->bcc,$this->Subject,$body);
638
-        if($result != 0) {
639
-          throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
637
+        $this->doCallback($isSent, $val, $this->cc, $this->bcc, $this->Subject, $body);
638
+        if ($result != 0) {
639
+          throw new phpmailerException($this->Lang('execute').$this->Sendmail, self::STOP_CRITICAL);
640 640
         }
641 641
       }
642 642
     } else {
643
-      if(!@$mail = popen($sendmail, 'w')) {
644
-        throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
643
+      if (!@$mail = popen($sendmail, 'w')) {
644
+        throw new phpmailerException($this->Lang('execute').$this->Sendmail, self::STOP_CRITICAL);
645 645
       }
646 646
       fputs($mail, $header);
647 647
       fputs($mail, $body);
648 648
       $result = pclose($mail);
649 649
       // implement call back function if it exists
650 650
       $isSent = ($result == 0) ? 1 : 0;
651
-      $this->doCallback($isSent,$this->to,$this->cc,$this->bcc,$this->Subject,$body);
652
-      if($result != 0) {
653
-        throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
651
+      $this->doCallback($isSent, $this->to, $this->cc, $this->bcc, $this->Subject, $body);
652
+      if ($result != 0) {
653
+        throw new phpmailerException($this->Lang('execute').$this->Sendmail, self::STOP_CRITICAL);
654 654
       }
655 655
     }
656 656
     return true;
@@ -665,7 +665,7 @@  discard block
 block discarded – undo
665 665
    */
666 666
   protected function MailSend($header, $body) {
667 667
     $toArr = array();
668
-    foreach($this->to as $t) {
668
+    foreach ($this->to as $t) {
669 669
       $toArr[] = $this->AddrFormat($t);
670 670
     }
671 671
     $to = implode(', ', $toArr);
@@ -679,13 +679,13 @@  discard block
 block discarded – undo
679 679
           $rt = @mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
680 680
           // implement call back function if it exists
681 681
           $isSent = ($rt == 1) ? 1 : 0;
682
-          $this->doCallback($isSent,$val,$this->cc,$this->bcc,$this->Subject,$body);
682
+          $this->doCallback($isSent, $val, $this->cc, $this->bcc, $this->Subject, $body);
683 683
         }
684 684
       } else {
685 685
         $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
686 686
         // implement call back function if it exists
687 687
         $isSent = ($rt == 1) ? 1 : 0;
688
-        $this->doCallback($isSent,$to,$this->cc,$this->bcc,$this->Subject,$body);
688
+        $this->doCallback($isSent, $to, $this->cc, $this->bcc, $this->Subject, $body);
689 689
       }
690 690
     } else {
691 691
       if ($this->SingleTo === true && count($toArr) > 1) {
@@ -693,19 +693,19 @@  discard block
 block discarded – undo
693 693
           $rt = @mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
694 694
           // implement call back function if it exists
695 695
           $isSent = ($rt == 1) ? 1 : 0;
696
-          $this->doCallback($isSent,$val,$this->cc,$this->bcc,$this->Subject,$body);
696
+          $this->doCallback($isSent, $val, $this->cc, $this->bcc, $this->Subject, $body);
697 697
         }
698 698
       } else {
699 699
         $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header);
700 700
         // implement call back function if it exists
701 701
         $isSent = ($rt == 1) ? 1 : 0;
702
-        $this->doCallback($isSent,$to,$this->cc,$this->bcc,$this->Subject,$body);
702
+        $this->doCallback($isSent, $to, $this->cc, $this->bcc, $this->Subject, $body);
703 703
       }
704 704
     }
705 705
     if (isset($old_from)) {
706 706
       ini_set('sendmail_from', $old_from);
707 707
     }
708
-    if(!$rt) {
708
+    if (!$rt) {
709 709
       throw new phpmailerException($this->Lang('instantiate'), self::STOP_CRITICAL);
710 710
     }
711 711
     return true;
@@ -721,10 +721,10 @@  discard block
 block discarded – undo
721 721
    * @return bool
722 722
    */
723 723
   protected function SmtpSend($header, $body) {
724
-    require_once $this->PluginDir . 'class.smtp.php';
724
+    require_once $this->PluginDir.'class.smtp.php';
725 725
     $bad_rcpt = array();
726 726
 
727
-    if(!$this->SmtpConnect()) {
727
+    if (!$this->SmtpConnect()) {
728 728
       throw new phpmailerException($this->Lang('smtp_connect_failed'), self::STOP_CRITICAL);
729 729
     }
730 730
 
@@ -733,57 +733,57 @@  discard block
 block discarded – undo
733 733
     } else {
734 734
         $smtp_from = $this->From;
735 735
     }
736
-    if(!$this->smtp->Mail($smtp_from)) {
737
-      throw new phpmailerException($this->Lang('from_failed') . $smtp_from, self::STOP_CRITICAL);
736
+    if (!$this->smtp->Mail($smtp_from)) {
737
+      throw new phpmailerException($this->Lang('from_failed').$smtp_from, self::STOP_CRITICAL);
738 738
     }
739 739
 
740 740
     // Attempt to send attach all recipients
741
-    foreach($this->to as $to) {
741
+    foreach ($this->to as $to) {
742 742
       if (!$this->smtp->Recipient($to[0])) {
743 743
         $bad_rcpt[] = $to[0];
744 744
         // implement call back function if it exists
745 745
         $isSent = 0;
746
-        $this->doCallback($isSent,$to[0],'','',$this->Subject,$body);
746
+        $this->doCallback($isSent, $to[0], '', '', $this->Subject, $body);
747 747
       } else {
748 748
         // implement call back function if it exists
749 749
         $isSent = 1;
750
-        $this->doCallback($isSent,$to[0],'','',$this->Subject,$body);
750
+        $this->doCallback($isSent, $to[0], '', '', $this->Subject, $body);
751 751
       }
752 752
     }
753
-    foreach($this->cc as $cc) {
753
+    foreach ($this->cc as $cc) {
754 754
       if (!$this->smtp->Recipient($cc[0])) {
755 755
         $bad_rcpt[] = $cc[0];
756 756
         // implement call back function if it exists
757 757
         $isSent = 0;
758
-        $this->doCallback($isSent,'',$cc[0],'',$this->Subject,$body);
758
+        $this->doCallback($isSent, '', $cc[0], '', $this->Subject, $body);
759 759
       } else {
760 760
         // implement call back function if it exists
761 761
         $isSent = 1;
762
-        $this->doCallback($isSent,'',$cc[0],'',$this->Subject,$body);
762
+        $this->doCallback($isSent, '', $cc[0], '', $this->Subject, $body);
763 763
       }
764 764
     }
765
-    foreach($this->bcc as $bcc) {
765
+    foreach ($this->bcc as $bcc) {
766 766
       if (!$this->smtp->Recipient($bcc[0])) {
767 767
         $bad_rcpt[] = $bcc[0];
768 768
         // implement call back function if it exists
769 769
         $isSent = 0;
770
-        $this->doCallback($isSent,'','',$bcc[0],$this->Subject,$body);
770
+        $this->doCallback($isSent, '', '', $bcc[0], $this->Subject, $body);
771 771
       } else {
772 772
         // implement call back function if it exists
773 773
         $isSent = 1;
774
-        $this->doCallback($isSent,'','',$bcc[0],$this->Subject,$body);
774
+        $this->doCallback($isSent, '', '', $bcc[0], $this->Subject, $body);
775 775
       }
776 776
     }
777 777
 
778 778
 
779
-    if (count($bad_rcpt) > 0 ) { //Create error message for any bad addresses
779
+    if (count($bad_rcpt) > 0) { //Create error message for any bad addresses
780 780
       $badaddresses = implode(', ', $bad_rcpt);
781
-      throw new phpmailerException($this->Lang('recipients_failed') . $badaddresses);
781
+      throw new phpmailerException($this->Lang('recipients_failed').$badaddresses);
782 782
     }
783
-    if(!$this->smtp->Data($header . $body)) {
783
+    if (!$this->smtp->Data($header.$body)) {
784 784
       throw new phpmailerException($this->Lang('data_not_accepted'), self::STOP_CRITICAL);
785 785
     }
786
-    if($this->SMTPKeepAlive == true) {
786
+    if ($this->SMTPKeepAlive == true) {
787 787
       $this->smtp->Reset();
788 788
     }
789 789
     return true;
@@ -797,7 +797,7 @@  discard block
 block discarded – undo
797 797
    * @return bool
798 798
    */
799 799
   public function SmtpConnect() {
800
-    if(is_null($this->smtp)) {
800
+    if (is_null($this->smtp)) {
801 801
       $this->smtp = new SMTP();
802 802
     }
803 803
 
@@ -808,7 +808,7 @@  discard block
 block discarded – undo
808 808
 
809 809
     // Retry while there is no connection
810 810
     try {
811
-      while($index < count($hosts) && !$connection) {
811
+      while ($index < count($hosts) && !$connection) {
812 812
         $hostinfo = array();
813 813
         if (preg_match('/^(.+):([0-9]+)$/', $hosts[$index], $hostinfo)) {
814 814
           $host = $hostinfo[1];
@@ -821,7 +821,7 @@  discard block
 block discarded – undo
821 821
         $tls = ($this->SMTPSecure == 'tls');
822 822
         $ssl = ($this->SMTPSecure == 'ssl');
823 823
 
824
-        if ($this->smtp->Connect(($ssl ? 'ssl://':'').$host, $port, $this->Timeout)) {
824
+        if ($this->smtp->Connect(($ssl ? 'ssl://' : '').$host, $port, $this->Timeout)) {
825 825
 
826 826
           $hello = ($this->Helo != '' ? $this->Helo : $this->ServerHostname());
827 827
           $this->smtp->Hello($hello);
@@ -859,8 +859,8 @@  discard block
 block discarded – undo
859 859
    * @return void
860 860
    */
861 861
   public function SmtpClose() {
862
-    if(!is_null($this->smtp)) {
863
-      if($this->smtp->Connected()) {
862
+    if (!is_null($this->smtp)) {
863
+      if ($this->smtp->Connected()) {
864 864
         $this->smtp->Quit();
865 865
         $this->smtp->Close();
866 866
       }
@@ -922,7 +922,7 @@  discard block
 block discarded – undo
922 922
    * @return string
923 923
    */
924 924
   public function AddrAppend($type, $addr) {
925
-    $addr_str = $type . ': ';
925
+    $addr_str = $type.': ';
926 926
     $addresses = array();
927 927
     foreach ($addr as $a) {
928 928
       $addresses[] = $this->AddrFormat($a);
@@ -942,7 +942,7 @@  discard block
 block discarded – undo
942 942
     if (empty($addr[1])) {
943 943
       return $this->SecureHeader($addr[0]);
944 944
     } else {
945
-      return $this->EncodeHeader($this->SecureHeader($addr[1]), 'phrase') . " <" . $this->SecureHeader($addr[0]) . ">";
945
+      return $this->EncodeHeader($this->SecureHeader($addr[1]), 'phrase')." <".$this->SecureHeader($addr[0]).">";
946 946
     }
947 947
   }
948 948
 
@@ -969,10 +969,10 @@  discard block
 block discarded – undo
969 969
 
970 970
     $line = explode($this->LE, $message);
971 971
     $message = '';
972
-    for ($i=0 ;$i < count($line); $i++) {
972
+    for ($i = 0; $i < count($line); $i++) {
973 973
       $line_part = explode(' ', $line[$i]);
974 974
       $buf = '';
975
-      for ($e = 0; $e<count($line_part); $e++) {
975
+      for ($e = 0; $e < count($line_part); $e++) {
976 976
         $word = $line_part[$e];
977 977
         if ($qp_mode and (strlen($word) > $length)) {
978 978
           $space_left = $length - strlen($buf) - 1;
@@ -988,10 +988,10 @@  discard block
 block discarded – undo
988 988
               }
989 989
               $part = substr($word, 0, $len);
990 990
               $word = substr($word, $len);
991
-              $buf .= ' ' . $part;
992
-              $message .= $buf . sprintf("=%s", $this->LE);
991
+              $buf .= ' '.$part;
992
+              $message .= $buf.sprintf("=%s", $this->LE);
993 993
             } else {
994
-              $message .= $buf . $soft_break;
994
+              $message .= $buf.$soft_break;
995 995
             }
996 996
             $buf = '';
997 997
           }
@@ -1008,22 +1008,22 @@  discard block
 block discarded – undo
1008 1008
             $word = substr($word, $len);
1009 1009
 
1010 1010
             if (strlen($word) > 0) {
1011
-              $message .= $part . sprintf("=%s", $this->LE);
1011
+              $message .= $part.sprintf("=%s", $this->LE);
1012 1012
             } else {
1013 1013
               $buf = $part;
1014 1014
             }
1015 1015
           }
1016 1016
         } else {
1017 1017
           $buf_o = $buf;
1018
-          $buf .= ($e == 0) ? $word : (' ' . $word);
1018
+          $buf .= ($e == 0) ? $word : (' '.$word);
1019 1019
 
1020 1020
           if (strlen($buf) > $length and $buf_o != '') {
1021
-            $message .= $buf_o . $soft_break;
1021
+            $message .= $buf_o.$soft_break;
1022 1022
             $buf = $word;
1023 1023
           }
1024 1024
         }
1025 1025
       }
1026
-      $message .= $buf . $this->LE;
1026
+      $message .= $buf.$this->LE;
1027 1027
     }
1028 1028
 
1029 1029
     return $message;
@@ -1052,8 +1052,7 @@  discard block
 block discarded – undo
1052 1052
         if ($dec < 128) { // Single byte character.
1053 1053
           // If the encoded char was found at pos 0, it will fit
1054 1054
           // otherwise reduce maxLength to start of the encoded char
1055
-          $maxLength = ($encodedCharPos == 0) ? $maxLength :
1056
-          $maxLength - ($lookBack - $encodedCharPos);
1055
+          $maxLength = ($encodedCharPos == 0) ? $maxLength : $maxLength - ($lookBack - $encodedCharPos);
1057 1056
           $foundSplitPos = true;
1058 1057
         } elseif ($dec >= 192) { // First byte of a multi byte character
1059 1058
           // Reduce maxLength to split at start of character
@@ -1077,11 +1076,11 @@  discard block
 block discarded – undo
1077 1076
    * @return void
1078 1077
    */
1079 1078
   public function SetWordWrap() {
1080
-    if($this->WordWrap < 1) {
1079
+    if ($this->WordWrap < 1) {
1081 1080
       return;
1082 1081
     }
1083 1082
 
1084
-    switch($this->message_type) {
1083
+    switch ($this->message_type) {
1085 1084
       case 'alt':
1086 1085
       case 'alt_attachments':
1087 1086
         $this->AltBody = $this->WrapText($this->AltBody, $this->WordWrap);
@@ -1102,24 +1101,24 @@  discard block
 block discarded – undo
1102 1101
 
1103 1102
     // Set the boundaries
1104 1103
     $uniq_id = md5(uniqid(time()));
1105
-    $this->boundary[1] = 'b1_' . $uniq_id;
1106
-    $this->boundary[2] = 'b2_' . $uniq_id;
1104
+    $this->boundary[1] = 'b1_'.$uniq_id;
1105
+    $this->boundary[2] = 'b2_'.$uniq_id;
1107 1106
 
1108 1107
     $result .= $this->HeaderLine('Date', self::RFCDate());
1109
-    if($this->Sender == '') {
1108
+    if ($this->Sender == '') {
1110 1109
       $result .= $this->HeaderLine('Return-Path', trim($this->From));
1111 1110
     } else {
1112 1111
       $result .= $this->HeaderLine('Return-Path', trim($this->Sender));
1113 1112
     }
1114 1113
 
1115 1114
     // To be created automatically by mail()
1116
-    if($this->Mailer != 'mail') {
1115
+    if ($this->Mailer != 'mail') {
1117 1116
       if ($this->SingleTo === true) {
1118
-        foreach($this->to as $t) {
1117
+        foreach ($this->to as $t) {
1119 1118
           $this->SingleToArray[] = $this->AddrFormat($t);
1120 1119
         }
1121 1120
       } else {
1122
-        if(count($this->to) > 0) {
1121
+        if (count($this->to) > 0) {
1123 1122
           $result .= $this->AddrAppend('To', $this->to);
1124 1123
         } elseif (count($this->cc) == 0) {
1125 1124
           $result .= $this->HeaderLine('To', 'undisclosed-recipients:;');
@@ -1133,38 +1132,38 @@  discard block
 block discarded – undo
1133 1132
     $result .= $this->AddrAppend('From', $from);
1134 1133
 
1135 1134
     // sendmail and mail() extract Cc from the header before sending
1136
-    if(count($this->cc) > 0) {
1135
+    if (count($this->cc) > 0) {
1137 1136
       $result .= $this->AddrAppend('Cc', $this->cc);
1138 1137
     }
1139 1138
 
1140 1139
     // sendmail and mail() extract Bcc from the header before sending
1141
-    if((($this->Mailer == 'sendmail') || ($this->Mailer == 'mail')) && (count($this->bcc) > 0)) {
1140
+    if ((($this->Mailer == 'sendmail') || ($this->Mailer == 'mail')) && (count($this->bcc) > 0)) {
1142 1141
       $result .= $this->AddrAppend('Bcc', $this->bcc);
1143 1142
     }
1144 1143
 
1145
-    if(count($this->ReplyTo) > 0) {
1144
+    if (count($this->ReplyTo) > 0) {
1146 1145
       $result .= $this->AddrAppend('Reply-to', $this->ReplyTo);
1147 1146
     }
1148 1147
 
1149 1148
     // mail() sets the subject itself
1150
-    if($this->Mailer != 'mail') {
1149
+    if ($this->Mailer != 'mail') {
1151 1150
       $result .= $this->HeaderLine('Subject', $this->EncodeHeader($this->SecureHeader($this->Subject)));
1152 1151
     }
1153 1152
 
1154
-    if($this->MessageID != '') {
1155
-      $result .= $this->HeaderLine('Message-ID',$this->MessageID);
1153
+    if ($this->MessageID != '') {
1154
+      $result .= $this->HeaderLine('Message-ID', $this->MessageID);
1156 1155
     } else {
1157 1156
       $result .= sprintf("Message-ID: <%s@%s>%s", $uniq_id, $this->ServerHostname(), $this->LE);
1158 1157
     }
1159 1158
     $result .= $this->HeaderLine('X-Priority', $this->Priority);
1160 1159
     $result .= $this->HeaderLine('X-Mailer', 'PHPMailer '.$this->Version.' (phpmailer.sourceforge.net)');
1161 1160
 
1162
-    if($this->ConfirmReadingTo != '') {
1163
-      $result .= $this->HeaderLine('Disposition-Notification-To', '<' . trim($this->ConfirmReadingTo) . '>');
1161
+    if ($this->ConfirmReadingTo != '') {
1162
+      $result .= $this->HeaderLine('Disposition-Notification-To', '<'.trim($this->ConfirmReadingTo).'>');
1164 1163
     }
1165 1164
 
1166 1165
     // Add custom headers
1167
-    for($index = 0; $index < count($this->CustomHeader); $index++) {
1166
+    for ($index = 0; $index < count($this->CustomHeader); $index++) {
1168 1167
       $result .= $this->HeaderLine(trim($this->CustomHeader[$index][0]), $this->EncodeHeader(trim($this->CustomHeader[$index][1])));
1169 1168
     }
1170 1169
     if (!$this->sign_key_file) {
@@ -1182,27 +1181,27 @@  discard block
 block discarded – undo
1182 1181
    */
1183 1182
   public function GetMailMIME() {
1184 1183
     $result = '';
1185
-    switch($this->message_type) {
1184
+    switch ($this->message_type) {
1186 1185
       case 'plain':
1187 1186
         $result .= $this->HeaderLine('Content-Transfer-Encoding', $this->Encoding);
1188 1187
         $result .= sprintf("Content-Type: %s; charset=\"%s\"", $this->ContentType, $this->CharSet);
1189 1188
         break;
1190 1189
       case 'attachments':
1191 1190
       case 'alt_attachments':
1192
-        if($this->InlineImageExists()){
1191
+        if ($this->InlineImageExists()) {
1193 1192
           $result .= sprintf("Content-Type: %s;%s\ttype=\"text/html\";%s\tboundary=\"%s\"%s", 'multipart/related', $this->LE, $this->LE, $this->boundary[1], $this->LE);
1194 1193
         } else {
1195 1194
           $result .= $this->HeaderLine('Content-Type', 'multipart/mixed;');
1196
-          $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
1195
+          $result .= $this->TextLine("\tboundary=\"".$this->boundary[1].'"');
1197 1196
         }
1198 1197
         break;
1199 1198
       case 'alt':
1200 1199
         $result .= $this->HeaderLine('Content-Type', 'multipart/alternative;');
1201
-        $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
1200
+        $result .= $this->TextLine("\tboundary=\"".$this->boundary[1].'"');
1202 1201
         break;
1203 1202
     }
1204 1203
 
1205
-    if($this->Mailer != 'mail') {
1204
+    if ($this->Mailer != 'mail') {
1206 1205
       $result .= $this->LE.$this->LE;
1207 1206
     }
1208 1207
 
@@ -1223,7 +1222,7 @@  discard block
 block discarded – undo
1223 1222
 
1224 1223
     $this->SetWordWrap();
1225 1224
 
1226
-    switch($this->message_type) {
1225
+    switch ($this->message_type) {
1227 1226
       case 'alt':
1228 1227
         $body .= $this->GetBoundary($this->boundary[1], '', 'text/plain', '');
1229 1228
         $body .= $this->EncodeString($this->AltBody, $this->Encoding);
@@ -1244,11 +1243,11 @@  discard block
 block discarded – undo
1244 1243
         break;
1245 1244
       case 'alt_attachments':
1246 1245
         $body .= sprintf("--%s%s", $this->boundary[1], $this->LE);
1247
-        $body .= sprintf("Content-Type: %s;%s" . "\tboundary=\"%s\"%s", 'multipart/alternative', $this->LE, $this->boundary[2], $this->LE.$this->LE);
1248
-        $body .= $this->GetBoundary($this->boundary[2], '', 'text/plain', '') . $this->LE; // Create text body
1246
+        $body .= sprintf("Content-Type: %s;%s"."\tboundary=\"%s\"%s", 'multipart/alternative', $this->LE, $this->boundary[2], $this->LE.$this->LE);
1247
+        $body .= $this->GetBoundary($this->boundary[2], '', 'text/plain', '').$this->LE; // Create text body
1249 1248
         $body .= $this->EncodeString($this->AltBody, $this->Encoding);
1250 1249
         $body .= $this->LE.$this->LE;
1251
-        $body .= $this->GetBoundary($this->boundary[2], '', 'text/html', '') . $this->LE; // Create the HTML body
1250
+        $body .= $this->GetBoundary($this->boundary[2], '', 'text/html', '').$this->LE; // Create the HTML body
1252 1251
         $body .= $this->EncodeString($this->Body, $this->Encoding);
1253 1252
         $body .= $this->LE.$this->LE;
1254 1253
         $body .= $this->EndBoundary($this->boundary[2]);
@@ -1289,16 +1288,16 @@  discard block
 block discarded – undo
1289 1288
    */
1290 1289
   private function GetBoundary($boundary, $charSet, $contentType, $encoding) {
1291 1290
     $result = '';
1292
-    if($charSet == '') {
1291
+    if ($charSet == '') {
1293 1292
       $charSet = $this->CharSet;
1294 1293
     }
1295
-    if($contentType == '') {
1294
+    if ($contentType == '') {
1296 1295
       $contentType = $this->ContentType;
1297 1296
     }
1298
-    if($encoding == '') {
1297
+    if ($encoding == '') {
1299 1298
       $encoding = $this->Encoding;
1300 1299
     }
1301
-    $result .= $this->TextLine('--' . $boundary);
1300
+    $result .= $this->TextLine('--'.$boundary);
1302 1301
     $result .= sprintf("Content-Type: %s; charset = \"%s\"", $contentType, $charSet);
1303 1302
     $result .= $this->LE;
1304 1303
     $result .= $this->HeaderLine('Content-Transfer-Encoding', $encoding);
@@ -1312,7 +1311,7 @@  discard block
 block discarded – undo
1312 1311
    * @access private
1313 1312
    */
1314 1313
   private function EndBoundary($boundary) {
1315
-    return $this->LE . '--' . $boundary . '--' . $this->LE;
1314
+    return $this->LE.'--'.$boundary.'--'.$this->LE;
1316 1315
   }
1317 1316
 
1318 1317
   /**
@@ -1321,16 +1320,16 @@  discard block
 block discarded – undo
1321 1320
    * @return void
1322 1321
    */
1323 1322
   private function SetMessageType() {
1324
-    if(count($this->attachment) < 1 && strlen($this->AltBody) < 1) {
1323
+    if (count($this->attachment) < 1 && strlen($this->AltBody) < 1) {
1325 1324
       $this->message_type = 'plain';
1326 1325
     } else {
1327
-      if(count($this->attachment) > 0) {
1326
+      if (count($this->attachment) > 0) {
1328 1327
         $this->message_type = 'attachments';
1329 1328
       }
1330
-      if(strlen($this->AltBody) > 0 && count($this->attachment) < 1) {
1329
+      if (strlen($this->AltBody) > 0 && count($this->attachment) < 1) {
1331 1330
         $this->message_type = 'alt';
1332 1331
       }
1333
-      if(strlen($this->AltBody) > 0 && count($this->attachment) > 0) {
1332
+      if (strlen($this->AltBody) > 0 && count($this->attachment) > 0) {
1334 1333
         $this->message_type = 'alt_attachments';
1335 1334
       }
1336 1335
     }
@@ -1342,7 +1341,7 @@  discard block
 block discarded – undo
1342 1341
    * @return string
1343 1342
    */
1344 1343
   public function HeaderLine($name, $value) {
1345
-    return $name . ': ' . $value . $this->LE;
1344
+    return $name.': '.$value.$this->LE;
1346 1345
   }
1347 1346
 
1348 1347
   /**
@@ -1351,7 +1350,7 @@  discard block
 block discarded – undo
1351 1350
    * @return string
1352 1351
    */
1353 1352
   public function TextLine($value) {
1354
-    return $value . $this->LE;
1353
+    return $value.$this->LE;
1355 1354
   }
1356 1355
 
1357 1356
   /////////////////////////////////////////////////
@@ -1370,11 +1369,11 @@  discard block
 block discarded – undo
1370 1369
    */
1371 1370
   public function AddAttachment($path, $name = '', $encoding = 'base64', $type = 'application/octet-stream') {
1372 1371
     try {
1373
-      if ( !@is_file($path) ) {
1374
-        throw new phpmailerException($this->Lang('file_access') . $path, self::STOP_CONTINUE);
1372
+      if (!@is_file($path)) {
1373
+        throw new phpmailerException($this->Lang('file_access').$path, self::STOP_CONTINUE);
1375 1374
       }
1376 1375
       $filename = basename($path);
1377
-      if ( $name == '' ) {
1376
+      if ($name == '') {
1378 1377
         $name = $filename;
1379 1378
       }
1380 1379
 
@@ -1384,7 +1383,7 @@  discard block
 block discarded – undo
1384 1383
         2 => $name,
1385 1384
         3 => $encoding,
1386 1385
         4 => $type,
1387
-        5 => false,  // isStringAttachment
1386
+        5 => false, // isStringAttachment
1388 1387
         6 => 'attachment',
1389 1388
         7 => 0
1390 1389
       );
@@ -1395,7 +1394,7 @@  discard block
 block discarded – undo
1395 1394
         throw $e;
1396 1395
       }
1397 1396
       error_log($e->getMessage()."\n");
1398
-      if ( $e->getCode() == self::STOP_CRITICAL ) {
1397
+      if ($e->getCode() == self::STOP_CRITICAL) {
1399 1398
         return false;
1400 1399
       }
1401 1400
     }
@@ -1440,29 +1439,29 @@  discard block
 block discarded – undo
1440 1439
       $disposition = $attachment[6];
1441 1440
       $cid         = $attachment[7];
1442 1441
       $incl[]      = $attachment[0];
1443
-      if ( $disposition == 'inline' && isset($cidUniq[$cid]) ) { continue; }
1442
+      if ($disposition == 'inline' && isset($cidUniq[$cid])) { continue; }
1444 1443
       $cidUniq[$cid] = true;
1445 1444
 
1446 1445
       $mime[] = sprintf("--%s%s", $this->boundary[1], $this->LE);
1447 1446
       $mime[] = sprintf("Content-Type: %s; name=\"%s\"%s", $type, $this->EncodeHeader($this->SecureHeader($name)), $this->LE);
1448 1447
       $mime[] = sprintf("Content-Transfer-Encoding: %s%s", $encoding, $this->LE);
1449 1448
 
1450
-      if($disposition == 'inline') {
1449
+      if ($disposition == 'inline') {
1451 1450
         $mime[] = sprintf("Content-ID: <%s>%s", $cid, $this->LE);
1452 1451
       }
1453 1452
 
1454 1453
       $mime[] = sprintf("Content-Disposition: %s; filename=\"%s\"%s", $disposition, $this->EncodeHeader($this->SecureHeader($name)), $this->LE.$this->LE);
1455 1454
 
1456 1455
       // Encode as string attachment
1457
-      if($bString) {
1456
+      if ($bString) {
1458 1457
         $mime[] = $this->EncodeString($string, $encoding);
1459
-        if($this->IsError()) {
1458
+        if ($this->IsError()) {
1460 1459
           return '';
1461 1460
         }
1462 1461
         $mime[] = $this->LE.$this->LE;
1463 1462
       } else {
1464 1463
         $mime[] = $this->EncodeFile($path, $encoding);
1465
-        if($this->IsError()) {
1464
+        if ($this->IsError()) {
1466 1465
           return '';
1467 1466
         }
1468 1467
         $mime[] = $this->LE.$this->LE;
@@ -1486,7 +1485,7 @@  discard block
 block discarded – undo
1486 1485
   private function EncodeFile($path, $encoding = 'base64') {
1487 1486
     try {
1488 1487
       if (!is_readable($path)) {
1489
-        throw new phpmailerException($this->Lang('file_open') . $path, self::STOP_CONTINUE);
1488
+        throw new phpmailerException($this->Lang('file_open').$path, self::STOP_CONTINUE);
1490 1489
       }
1491 1490
         $magic_quotes = get_magic_quotes_runtime();
1492 1491
         if ($magic_quotes) {
@@ -1520,9 +1519,9 @@  discard block
 block discarded – undo
1520 1519
    * @access public
1521 1520
    * @return string
1522 1521
    */
1523
-  public function EncodeString ($str, $encoding = 'base64') {
1522
+  public function EncodeString($str, $encoding = 'base64') {
1524 1523
     $encoded = '';
1525
-    switch(strtolower($encoding)) {
1524
+    switch (strtolower($encoding)) {
1526 1525
       case 'base64':
1527 1526
         $encoded = chunk_split(base64_encode($str), 76, $this->LE);
1528 1527
         break;
@@ -1540,7 +1539,7 @@  discard block
 block discarded – undo
1540 1539
         $encoded = $this->EncodeQP($str);
1541 1540
         break;
1542 1541
       default:
1543
-        $this->SetError($this->Lang('encoding') . $encoding);
1542
+        $this->SetError($this->Lang('encoding').$encoding);
1544 1543
         break;
1545 1544
     }
1546 1545
     return $encoded;
@@ -1582,7 +1581,7 @@  discard block
 block discarded – undo
1582 1581
 
1583 1582
     $maxlen = 75 - 7 - strlen($this->CharSet);
1584 1583
     // Try to select the encoding which should produce the shortest output
1585
-    if (strlen($str)/3 < $x) {
1584
+    if (strlen($str) / 3 < $x) {
1586 1585
       $encoding = 'B';
1587 1586
       // Modified by Ivan Tcholakov, 24-JAN-2010.
1588 1587
       //if (function_exists('mb_strlen') && $this->HasMultiBytes($str)) {
@@ -1663,7 +1662,7 @@  discard block
 block discarded – undo
1663 1662
       }
1664 1663
       while (strlen($chunk) > $length);
1665 1664
 
1666
-      $encoded .= $chunk . $this->LE;
1665
+      $encoded .= $chunk.$this->LE;
1667 1666
     }
1668 1667
 
1669 1668
     // Chomp the last linefeed
@@ -1679,37 +1678,37 @@  discard block
 block discarded – undo
1679 1678
   * @param integer $line_max Number of chars allowed on a line before wrapping
1680 1679
   * @return string
1681 1680
   */
1682
-  public function EncodeQPphp( $input = '', $line_max = 76, $space_conv = false) {
1683
-    $hex = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
1681
+  public function EncodeQPphp($input = '', $line_max = 76, $space_conv = false) {
1682
+    $hex = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F');
1684 1683
     $lines = preg_split('/(?:\r\n|\r|\n)/', $input);
1685 1684
     $eol = "\r\n";
1686 1685
     $escape = '=';
1687 1686
     $output = '';
1688
-    while( list(, $line) = each($lines) ) {
1687
+    while (list(, $line) = each($lines)) {
1689 1688
       $linlen = strlen($line);
1690 1689
       $newline = '';
1691
-      for($i = 0; $i < $linlen; $i++) {
1692
-        $c = substr( $line, $i, 1 );
1693
-        $dec = ord( $c );
1694
-        if ( ( $i == 0 ) && ( $dec == 46 ) ) { // convert first point in the line into =2E
1690
+      for ($i = 0; $i < $linlen; $i++) {
1691
+        $c = substr($line, $i, 1);
1692
+        $dec = ord($c);
1693
+        if (($i == 0) && ($dec == 46)) { // convert first point in the line into =2E
1695 1694
           $c = '=2E';
1696 1695
         }
1697
-        if ( $dec == 32 ) {
1698
-          if ( $i == ( $linlen - 1 ) ) { // convert space at eol only
1696
+        if ($dec == 32) {
1697
+          if ($i == ($linlen - 1)) { // convert space at eol only
1699 1698
             $c = '=20';
1700
-          } else if ( $space_conv ) {
1699
+          } else if ($space_conv) {
1701 1700
             $c = '=20';
1702 1701
           }
1703
-        } elseif ( ($dec == 61) || ($dec < 32 ) || ($dec > 126) ) { // always encode "\t", which is *not* required
1704
-          $h2 = floor($dec/16);
1705
-          $h1 = floor($dec%16);
1702
+        } elseif (($dec == 61) || ($dec < 32) || ($dec > 126)) { // always encode "\t", which is *not* required
1703
+          $h2 = floor($dec / 16);
1704
+          $h1 = floor($dec % 16);
1706 1705
           $c = $escape.$hex[$h2].$hex[$h1];
1707 1706
         }
1708
-        if ( (strlen($newline) + strlen($c)) >= $line_max ) { // CRLF is not counted
1707
+        if ((strlen($newline) + strlen($c)) >= $line_max) { // CRLF is not counted
1709 1708
           $output .= $newline.$escape.$eol; //  soft line break; " =\r\n" is okay
1710 1709
           $newline = '';
1711 1710
           // check if newline first character will be point or not
1712
-          if ( $dec == 46 ) {
1711
+          if ($dec == 46) {
1713 1712
             $c = '=2E';
1714 1713
           }
1715 1714
         }
@@ -1761,7 +1760,7 @@  discard block
 block discarded – undo
1761 1760
    * @access public
1762 1761
    * @return string
1763 1762
    */
1764
-  public function EncodeQ ($str, $position = 'text') {
1763
+  public function EncodeQ($str, $position = 'text') {
1765 1764
     // There should not be any EOL in the string
1766 1765
     $encoded = preg_replace('/[\r\n]*/', '', $str);
1767 1766
 
@@ -1804,7 +1803,7 @@  discard block
 block discarded – undo
1804 1803
       2 => basename($filename),
1805 1804
       3 => $encoding,
1806 1805
       4 => $type,
1807
-      5 => true,  // isStringAttachment
1806
+      5 => true, // isStringAttachment
1808 1807
       6 => 'attachment',
1809 1808
       7 => 0
1810 1809
     );
@@ -1825,13 +1824,13 @@  discard block
 block discarded – undo
1825 1824
    */
1826 1825
   public function AddEmbeddedImage($path, $cid, $name = '', $encoding = 'base64', $type = 'application/octet-stream') {
1827 1826
 
1828
-    if ( !@is_file($path) ) {
1829
-      $this->SetError($this->Lang('file_access') . $path);
1827
+    if (!@is_file($path)) {
1828
+      $this->SetError($this->Lang('file_access').$path);
1830 1829
       return false;
1831 1830
     }
1832 1831
 
1833 1832
     $filename = basename($path);
1834
-    if ( $name == '' ) {
1833
+    if ($name == '') {
1835 1834
       $name = $filename;
1836 1835
     }
1837 1836
 
@@ -1842,7 +1841,7 @@  discard block
 block discarded – undo
1842 1841
       2 => $name,
1843 1842
       3 => $encoding,
1844 1843
       4 => $type,
1845
-      5 => false,  // isStringAttachment
1844
+      5 => false, // isStringAttachment
1846 1845
       6 => 'inline',
1847 1846
       7 => $cid
1848 1847
     );
@@ -1856,7 +1855,7 @@  discard block
 block discarded – undo
1856 1855
    * @return bool
1857 1856
    */
1858 1857
   public function InlineImageExists() {
1859
-    foreach($this->attachment as $attachment) {
1858
+    foreach ($this->attachment as $attachment) {
1860 1859
       if ($attachment[6] == 'inline') {
1861 1860
         return true;
1862 1861
       }
@@ -1873,7 +1872,7 @@  discard block
 block discarded – undo
1873 1872
    * @return void
1874 1873
    */
1875 1874
   public function ClearAddresses() {
1876
-    foreach($this->to as $to) {
1875
+    foreach ($this->to as $to) {
1877 1876
       unset($this->all_recipients[strtolower($to[0])]);
1878 1877
     }
1879 1878
     $this->to = array();
@@ -1884,7 +1883,7 @@  discard block
 block discarded – undo
1884 1883
    * @return void
1885 1884
    */
1886 1885
   public function ClearCCs() {
1887
-    foreach($this->cc as $cc) {
1886
+    foreach ($this->cc as $cc) {
1888 1887
       unset($this->all_recipients[strtolower($cc[0])]);
1889 1888
     }
1890 1889
     $this->cc = array();
@@ -1895,7 +1894,7 @@  discard block
 block discarded – undo
1895 1894
    * @return void
1896 1895
    */
1897 1896
   public function ClearBCCs() {
1898
-    foreach($this->bcc as $bcc) {
1897
+    foreach ($this->bcc as $bcc) {
1899 1898
       unset($this->all_recipients[strtolower($bcc[0])]);
1900 1899
     }
1901 1900
     $this->bcc = array();
@@ -1952,7 +1951,7 @@  discard block
 block discarded – undo
1952 1951
     if ($this->Mailer == 'smtp' and !is_null($this->smtp)) {
1953 1952
       $lasterror = $this->smtp->getError();
1954 1953
       if (!empty($lasterror) and array_key_exists('smtp_msg', $lasterror)) {
1955
-        $msg .= '<p>' . $this->Lang('smtp_error') . $lasterror['smtp_msg'] . "</p>\n";
1954
+        $msg .= '<p>'.$this->Lang('smtp_error').$lasterror['smtp_msg']."</p>\n";
1956 1955
       }
1957 1956
     }
1958 1957
     $this->ErrorInfo = $msg;
@@ -1968,7 +1967,7 @@  discard block
 block discarded – undo
1968 1967
     $tz = date('Z');
1969 1968
     $tzs = ($tz < 0) ? '-' : '+';
1970 1969
     $tz = abs($tz);
1971
-    $tz = (int)($tz/3600)*100 + ($tz%3600)/60;
1970
+    $tz = (int) ($tz / 3600) * 100 + ($tz % 3600) / 60;
1972 1971
     $result = sprintf("%s %s%04d", date('D, j M Y H:i:s'), $tzs, $tz);
1973 1972
 
1974 1973
     return $result;
@@ -1997,14 +1996,14 @@  discard block
 block discarded – undo
1997 1996
    * @return string
1998 1997
    */
1999 1998
   private function Lang($key) {
2000
-    if(count($this->language) < 1) {
1999
+    if (count($this->language) < 1) {
2001 2000
       $this->SetLanguage('en'); // set the default language
2002 2001
     }
2003 2002
 
2004
-    if(isset($this->language[$key])) {
2003
+    if (isset($this->language[$key])) {
2005 2004
       return $this->language[$key];
2006 2005
     } else {
2007
-      return 'Language string failed to load: ' . $key;
2006
+      return 'Language string failed to load: '.$key;
2008 2007
     }
2009 2008
   }
2010 2009
 
@@ -2045,19 +2044,19 @@  discard block
 block discarded – undo
2045 2044
    */
2046 2045
   public function MsgHTML($message, $basedir = '') {
2047 2046
     preg_match_all("/(src|background)=\"(.*)\"/Ui", $message, $images);
2048
-    if(isset($images[2])) {
2049
-      foreach($images[2] as $i => $url) {
2047
+    if (isset($images[2])) {
2048
+      foreach ($images[2] as $i => $url) {
2050 2049
         // do not change urls for absolute images (thanks to corvuscorax)
2051
-        if (!preg_match('#^[A-z]+://#',$url)) {
2050
+        if (!preg_match('#^[A-z]+://#', $url)) {
2052 2051
           $filename = basename($url);
2053 2052
           $directory = dirname($url);
2054
-          ($directory == '.')?$directory='':'';
2055
-          $cid = 'cid:' . md5($filename);
2053
+          ($directory == '.') ? $directory = '' : '';
2054
+          $cid = 'cid:'.md5($filename);
2056 2055
           $ext = pathinfo($filename, PATHINFO_EXTENSION);
2057
-          $mimeType  = self::_mime_types($ext);
2058
-          if ( strlen($basedir) > 1 && substr($basedir,-1) != '/') { $basedir .= '/'; }
2059
-          if ( strlen($directory) > 1 && substr($directory,-1) != '/') { $directory .= '/'; }
2060
-          if ( $this->AddEmbeddedImage($basedir.$directory.$filename, md5($filename), $filename, 'base64',$mimeType) ) {
2056
+          $mimeType = self::_mime_types($ext);
2057
+          if (strlen($basedir) > 1 && substr($basedir, -1) != '/') { $basedir .= '/'; }
2058
+          if (strlen($directory) > 1 && substr($directory, -1) != '/') { $directory .= '/'; }
2059
+          if ($this->AddEmbeddedImage($basedir.$directory.$filename, md5($filename), $filename, 'base64', $mimeType)) {
2061 2060
             $message = preg_replace("/".$images[1][$i]."=\"".preg_quote($url, '/')."\"/Ui", $images[1][$i]."=\"".$cid."\"", $message);
2062 2061
           }
2063 2062
         }
@@ -2065,12 +2064,12 @@  discard block
 block discarded – undo
2065 2064
     }
2066 2065
     $this->IsHTML(true);
2067 2066
     $this->Body = $message;
2068
-    $textMsg = trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/s','',$message)));
2067
+    $textMsg = trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/s', '', $message)));
2069 2068
     if (!empty($textMsg) && empty($this->AltBody)) {
2070 2069
       $this->AltBody = html_entity_decode($textMsg);
2071 2070
     }
2072 2071
     if (empty($this->AltBody)) {
2073
-      $this->AltBody = 'To view this email message, open it in a program that understands HTML!' . "\n\n";
2072
+      $this->AltBody = 'To view this email message, open it in a program that understands HTML!'."\n\n";
2074 2073
     }
2075 2074
   }
2076 2075
 
@@ -2188,10 +2187,10 @@  discard block
 block discarded – undo
2188 2187
   */
2189 2188
   public function set($name, $value = '') {
2190 2189
     try {
2191
-      if (isset($this->$name) ) {
2190
+      if (isset($this->$name)) {
2192 2191
         $this->$name = $value;
2193 2192
       } else {
2194
-        throw new phpmailerException($this->Lang('variable_set') . $name, self::STOP_CRITICAL);
2193
+        throw new phpmailerException($this->Lang('variable_set').$name, self::STOP_CRITICAL);
2195 2194
       }
2196 2195
     } catch (Exception $e) {
2197 2196
       $this->SetError($e->getMessage());
@@ -2235,14 +2234,14 @@  discard block
 block discarded – undo
2235 2234
    * @param string $key_pass Password for private key
2236 2235
    */
2237 2236
   public function DKIM_QP($txt) {
2238
-    $tmp="";
2239
-    $line="";
2240
-    for ($i=0;$i<strlen($txt);$i++) {
2241
-      $ord=ord($txt[$i]);
2242
-      if ( ((0x21 <= $ord) && ($ord <= 0x3A)) || $ord == 0x3C || ((0x3E <= $ord) && ($ord <= 0x7E)) ) {
2243
-        $line.=$txt[$i];
2237
+    $tmp = "";
2238
+    $line = "";
2239
+    for ($i = 0; $i < strlen($txt); $i++) {
2240
+      $ord = ord($txt[$i]);
2241
+      if (((0x21 <= $ord) && ($ord <= 0x3A)) || $ord == 0x3C || ((0x3E <= $ord) && ($ord <= 0x7E))) {
2242
+        $line .= $txt[$i];
2244 2243
       } else {
2245
-        $line.="=".sprintf("%02X",$ord);
2244
+        $line .= "=".sprintf("%02X", $ord);
2246 2245
       }
2247 2246
     }
2248 2247
     return $line;
@@ -2256,8 +2255,8 @@  discard block
 block discarded – undo
2256 2255
    */
2257 2256
   public function DKIM_Sign($s) {
2258 2257
     $privKeyStr = file_get_contents($this->DKIM_private);
2259
-    if ($this->DKIM_passphrase!='') {
2260
-      $privKey = openssl_pkey_get_private($privKeyStr,$this->DKIM_passphrase);
2258
+    if ($this->DKIM_passphrase != '') {
2259
+      $privKey = openssl_pkey_get_private($privKeyStr, $this->DKIM_passphrase);
2261 2260
     } else {
2262 2261
       $privKey = $privKeyStr;
2263 2262
     }
@@ -2273,15 +2272,15 @@  discard block
 block discarded – undo
2273 2272
    * @param string $s Header
2274 2273
    */
2275 2274
   public function DKIM_HeaderC($s) {
2276
-    $s=preg_replace("/\r\n\s+/"," ",$s);
2277
-    $lines=explode("\r\n",$s);
2275
+    $s = preg_replace("/\r\n\s+/", " ", $s);
2276
+    $lines = explode("\r\n", $s);
2278 2277
     foreach ($lines as $key=>$line) {
2279
-      list($heading,$value)=explode(":",$line,2);
2280
-      $heading=strtolower($heading);
2281
-      $value=preg_replace("/\s+/"," ",$value) ; // Compress useless spaces
2282
-      $lines[$key]=$heading.":".trim($value) ; // Don't forget to remove WSP around the value
2278
+      list($heading, $value) = explode(":", $line, 2);
2279
+      $heading = strtolower($heading);
2280
+      $value = preg_replace("/\s+/", " ", $value); // Compress useless spaces
2281
+      $lines[$key] = $heading.":".trim($value); // Don't forget to remove WSP around the value
2283 2282
     }
2284
-    $s=implode("\r\n",$lines);
2283
+    $s = implode("\r\n", $lines);
2285 2284
     return $s;
2286 2285
   }
2287 2286
 
@@ -2294,11 +2293,11 @@  discard block
 block discarded – undo
2294 2293
   public function DKIM_BodyC($body) {
2295 2294
     if ($body == '') return "\r\n";
2296 2295
     // stabilize line endings
2297
-    $body=str_replace("\r\n","\n",$body);
2298
-    $body=str_replace("\n","\r\n",$body);
2296
+    $body = str_replace("\r\n", "\n", $body);
2297
+    $body = str_replace("\n", "\r\n", $body);
2299 2298
     // END stabilize line endings
2300
-    while (substr($body,strlen($body)-4,4) == "\r\n\r\n") {
2301
-      $body=substr($body,0,strlen($body)-2);
2299
+    while (substr($body, strlen($body) - 4, 4) == "\r\n\r\n") {
2300
+      $body = substr($body, 0, strlen($body) - 2);
2302 2301
     }
2303 2302
     return $body;
2304 2303
   }
@@ -2311,52 +2310,52 @@  discard block
 block discarded – undo
2311 2310
    * @param string $subject Subject
2312 2311
    * @param string $body Body
2313 2312
    */
2314
-  public function DKIM_Add($headers_line,$subject,$body) {
2313
+  public function DKIM_Add($headers_line, $subject, $body) {
2315 2314
     $DKIMsignatureType    = 'rsa-sha1'; // Signature & hash algorithms
2316 2315
     $DKIMcanonicalization = 'relaxed/simple'; // Canonicalization of header/body
2317 2316
     $DKIMquery            = 'dns/txt'; // Query method
2318
-    $DKIMtime             = time() ; // Signature Timestamp = seconds since 00:00:00 - Jan 1, 1970 (UTC time zone)
2317
+    $DKIMtime             = time(); // Signature Timestamp = seconds since 00:00:00 - Jan 1, 1970 (UTC time zone)
2319 2318
     $subject_header       = "Subject: $subject";
2320
-    $headers              = explode("\r\n",$headers_line);
2321
-    foreach($headers as $header) {
2322
-      if (strpos($header,'From:') === 0) {
2323
-        $from_header=$header;
2324
-      } elseif (strpos($header,'To:') === 0) {
2325
-        $to_header=$header;
2319
+    $headers              = explode("\r\n", $headers_line);
2320
+    foreach ($headers as $header) {
2321
+      if (strpos($header, 'From:') === 0) {
2322
+        $from_header = $header;
2323
+      } elseif (strpos($header, 'To:') === 0) {
2324
+        $to_header = $header;
2326 2325
       }
2327 2326
     }
2328
-    $from     = str_replace('|','=7C',$this->DKIM_QP($from_header));
2329
-    $to       = str_replace('|','=7C',$this->DKIM_QP($to_header));
2330
-    $subject  = str_replace('|','=7C',$this->DKIM_QP($subject_header)) ; // Copied header fields (dkim-quoted-printable
2327
+    $from     = str_replace('|', '=7C', $this->DKIM_QP($from_header));
2328
+    $to       = str_replace('|', '=7C', $this->DKIM_QP($to_header));
2329
+    $subject  = str_replace('|', '=7C', $this->DKIM_QP($subject_header)); // Copied header fields (dkim-quoted-printable
2331 2330
     $body     = $this->DKIM_BodyC($body);
2332
-    $DKIMlen  = strlen($body) ; // Length of body
2333
-    $DKIMb64  = base64_encode(pack("H*", sha1($body))) ; // Base64 of packed binary SHA-1 hash of body
2334
-    $ident    = ($this->DKIM_identity == '')? '' : " i=" . $this->DKIM_identity . ";";
2335
-    $dkimhdrs = "DKIM-Signature: v=1; a=" . $DKIMsignatureType . "; q=" . $DKIMquery . "; l=" . $DKIMlen . "; s=" . $this->DKIM_selector . ";\r\n".
2336
-                "\tt=" . $DKIMtime . "; c=" . $DKIMcanonicalization . ";\r\n".
2331
+    $DKIMlen  = strlen($body); // Length of body
2332
+    $DKIMb64  = base64_encode(pack("H*", sha1($body))); // Base64 of packed binary SHA-1 hash of body
2333
+    $ident    = ($this->DKIM_identity == '') ? '' : " i=".$this->DKIM_identity.";";
2334
+    $dkimhdrs = "DKIM-Signature: v=1; a=".$DKIMsignatureType."; q=".$DKIMquery."; l=".$DKIMlen."; s=".$this->DKIM_selector.";\r\n".
2335
+                "\tt=".$DKIMtime."; c=".$DKIMcanonicalization.";\r\n".
2337 2336
                 "\th=From:To:Subject;\r\n".
2338
-                "\td=" . $this->DKIM_domain . ";" . $ident . "\r\n".
2337
+                "\td=".$this->DKIM_domain.";".$ident."\r\n".
2339 2338
                 "\tz=$from\r\n".
2340 2339
                 "\t|$to\r\n".
2341 2340
                 "\t|$subject;\r\n".
2342
-                "\tbh=" . $DKIMb64 . ";\r\n".
2341
+                "\tbh=".$DKIMb64.";\r\n".
2343 2342
                 "\tb=";
2344
-    $toSign   = $this->DKIM_HeaderC($from_header . "\r\n" . $to_header . "\r\n" . $subject_header . "\r\n" . $dkimhdrs);
2343
+    $toSign   = $this->DKIM_HeaderC($from_header."\r\n".$to_header."\r\n".$subject_header."\r\n".$dkimhdrs);
2345 2344
     $signed   = $this->DKIM_Sign($toSign);
2346 2345
     return "X-PHPMAILER-DKIM: phpmailer.worxware.com\r\n".$dkimhdrs.$signed."\r\n";
2347 2346
   }
2348 2347
 
2349
-  protected function doCallback($isSent,$to,$cc,$bcc,$subject,$body) {
2348
+  protected function doCallback($isSent, $to, $cc, $bcc, $subject, $body) {
2350 2349
     if (!empty($this->action_function) && function_exists($this->action_function)) {
2351
-      $params = array($isSent,$to,$cc,$bcc,$subject,$body);
2352
-      call_user_func_array($this->action_function,$params);
2350
+      $params = array($isSent, $to, $cc, $bcc, $subject, $body);
2351
+      call_user_func_array($this->action_function, $params);
2353 2352
     }
2354 2353
   }
2355 2354
 }
2356 2355
 
2357 2356
 class phpmailerException extends Exception {
2358 2357
   public function errorMessage() {
2359
-    $errorMsg = '<strong>' . $this->getMessage() . "</strong><br />\n";
2358
+    $errorMsg = '<strong>'.$this->getMessage()."</strong><br />\n";
2360 2359
     return $errorMsg;
2361 2360
   }
2362 2361
 }
Please login to merge, or discard this patch.