Completed
Push — 1.10.x ( ad23de...73a570 )
by Yannick
448:11 queued 407:15
created
main/inc/lib/phpmailer/class.smtp.php 1 patch
Spacing   +154 added lines, -154 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
    *  Sets whether debugging is turned on
64 64
    *  @var bool
65 65
    */
66
-  public $do_debug;       // the level of debug to perform
66
+  public $do_debug; // the level of debug to perform
67 67
 
68 68
   /**
69 69
    *  Sets VERP use on/off (default is off)
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
   /////////////////////////////////////////////////
77 77
 
78 78
   private $smtp_conn; // the socket to the server
79
-  private $error;     // error if any on the last call
79
+  private $error; // error if any on the last call
80 80
   private $helo_rply; // the reply the server sent to us for HELO
81 81
 
82 82
   /**
@@ -114,43 +114,43 @@  discard block
 block discarded – undo
114 114
     $this->error = null;
115 115
 
116 116
     // make sure we are __not__ connected
117
-    if($this->connected()) {
117
+    if ($this->connected()) {
118 118
       // already connected, generate error
119 119
       $this->error = array("error" => "Already connected to a server");
120 120
       return false;
121 121
     }
122 122
 
123
-    if(empty($port)) {
123
+    if (empty($port)) {
124 124
       $port = $this->SMTP_PORT;
125 125
     }
126 126
 
127 127
     // connect to the smtp server
128
-    $this->smtp_conn = @fsockopen($host,    // the host of the server
129
-                                 $port,    // the port to use
130
-                                 $errno,   // error number if any
131
-                                 $errstr,  // error message if any
132
-                                 $tval);   // give up after ? secs
128
+    $this->smtp_conn = @fsockopen($host, // the host of the server
129
+                                 $port, // the port to use
130
+                                 $errno, // error number if any
131
+                                 $errstr, // error message if any
132
+                                 $tval); // give up after ? secs
133 133
     // verify we connected properly
134
-    if(empty($this->smtp_conn)) {
134
+    if (empty($this->smtp_conn)) {
135 135
       $this->error = array("error" => "Failed to connect to server",
136 136
                            "errno" => $errno,
137 137
                            "errstr" => $errstr);
138
-      if($this->do_debug >= 1) {
139
-        echo "SMTP -> ERROR: " . $this->error["error"] . ": $errstr ($errno)" . $this->CRLF . '<br />';
138
+      if ($this->do_debug >= 1) {
139
+        echo "SMTP -> ERROR: ".$this->error["error"].": $errstr ($errno)".$this->CRLF.'<br />';
140 140
       }
141 141
       return false;
142 142
     }
143 143
 
144 144
     // SMTP server can take longer to respond, give longer timeout for first read
145 145
     // Windows does not have support for this timeout function
146
-    if(substr(PHP_OS, 0, 3) != "WIN")
146
+    if (substr(PHP_OS, 0, 3) != "WIN")
147 147
      socket_set_timeout($this->smtp_conn, $tval, 0);
148 148
 
149 149
     // get any announcement
150 150
     $announce = $this->get_lines();
151 151
 
152
-    if($this->do_debug >= 2) {
153
-      echo "SMTP -> FROM SERVER:" . $announce . $this->CRLF . '<br />';
152
+    if ($this->do_debug >= 2) {
153
+      echo "SMTP -> FROM SERVER:".$announce.$this->CRLF.'<br />';
154 154
     }
155 155
 
156 156
     return true;
@@ -168,33 +168,33 @@  discard block
 block discarded – undo
168 168
   public function StartTLS() {
169 169
     $this->error = null; # to avoid confusion
170 170
 
171
-    if(!$this->connected()) {
171
+    if (!$this->connected()) {
172 172
       $this->error = array("error" => "Called StartTLS() without being connected");
173 173
       return false;
174 174
     }
175 175
 
176
-    fputs($this->smtp_conn,"STARTTLS" . $this->CRLF);
176
+    fputs($this->smtp_conn, "STARTTLS".$this->CRLF);
177 177
 
178 178
     $rply = $this->get_lines();
179
-    $code = substr($rply,0,3);
179
+    $code = substr($rply, 0, 3);
180 180
 
181
-    if($this->do_debug >= 2) {
182
-      echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
181
+    if ($this->do_debug >= 2) {
182
+      echo "SMTP -> FROM SERVER:".$rply.$this->CRLF.'<br />';
183 183
     }
184 184
 
185
-    if($code != 220) {
185
+    if ($code != 220) {
186 186
       $this->error =
187 187
          array("error"     => "STARTTLS not accepted from server",
188 188
                "smtp_code" => $code,
189
-               "smtp_msg"  => substr($rply,4));
190
-      if($this->do_debug >= 1) {
191
-        echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
189
+               "smtp_msg"  => substr($rply, 4));
190
+      if ($this->do_debug >= 1) {
191
+        echo "SMTP -> ERROR: ".$this->error["error"].": ".$rply.$this->CRLF.'<br />';
192 192
       }
193 193
       return false;
194 194
     }
195 195
 
196 196
     // Begin encrypted connection
197
-    if(!stream_socket_enable_crypto($this->smtp_conn, true, STREAM_CRYPTO_METHOD_TLS_CLIENT)) {
197
+    if (!stream_socket_enable_crypto($this->smtp_conn, true, STREAM_CRYPTO_METHOD_TLS_CLIENT)) {
198 198
       return false;
199 199
     }
200 200
 
@@ -209,52 +209,52 @@  discard block
 block discarded – undo
209 209
    */
210 210
   public function Authenticate($username, $password) {
211 211
     // Start authentication
212
-    fputs($this->smtp_conn,"AUTH LOGIN" . $this->CRLF);
212
+    fputs($this->smtp_conn, "AUTH LOGIN".$this->CRLF);
213 213
 
214 214
     $rply = $this->get_lines();
215
-    $code = substr($rply,0,3);
215
+    $code = substr($rply, 0, 3);
216 216
 
217
-    if($code != 334) {
217
+    if ($code != 334) {
218 218
       $this->error =
219 219
         array("error" => "AUTH not accepted from server",
220 220
               "smtp_code" => $code,
221
-              "smtp_msg" => substr($rply,4));
222
-      if($this->do_debug >= 1) {
223
-        echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
221
+              "smtp_msg" => substr($rply, 4));
222
+      if ($this->do_debug >= 1) {
223
+        echo "SMTP -> ERROR: ".$this->error["error"].": ".$rply.$this->CRLF.'<br />';
224 224
       }
225 225
       return false;
226 226
     }
227 227
 
228 228
     // Send encoded username
229
-    fputs($this->smtp_conn, base64_encode($username) . $this->CRLF);
229
+    fputs($this->smtp_conn, base64_encode($username).$this->CRLF);
230 230
 
231 231
     $rply = $this->get_lines();
232
-    $code = substr($rply,0,3);
232
+    $code = substr($rply, 0, 3);
233 233
 
234
-    if($code != 334) {
234
+    if ($code != 334) {
235 235
       $this->error =
236 236
         array("error" => "Username not accepted from server",
237 237
               "smtp_code" => $code,
238
-              "smtp_msg" => substr($rply,4));
239
-      if($this->do_debug >= 1) {
240
-        echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
238
+              "smtp_msg" => substr($rply, 4));
239
+      if ($this->do_debug >= 1) {
240
+        echo "SMTP -> ERROR: ".$this->error["error"].": ".$rply.$this->CRLF.'<br />';
241 241
       }
242 242
       return false;
243 243
     }
244 244
 
245 245
     // Send encoded password
246
-    fputs($this->smtp_conn, base64_encode($password) . $this->CRLF);
246
+    fputs($this->smtp_conn, base64_encode($password).$this->CRLF);
247 247
 
248 248
     $rply = $this->get_lines();
249
-    $code = substr($rply,0,3);
249
+    $code = substr($rply, 0, 3);
250 250
 
251
-    if($code != 235) {
251
+    if ($code != 235) {
252 252
       $this->error =
253 253
         array("error" => "Password not accepted from server",
254 254
               "smtp_code" => $code,
255
-              "smtp_msg" => substr($rply,4));
256
-      if($this->do_debug >= 1) {
257
-        echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
255
+              "smtp_msg" => substr($rply, 4));
256
+      if ($this->do_debug >= 1) {
257
+        echo "SMTP -> ERROR: ".$this->error["error"].": ".$rply.$this->CRLF.'<br />';
258 258
       }
259 259
       return false;
260 260
     }
@@ -268,12 +268,12 @@  discard block
 block discarded – undo
268 268
    * @return bool
269 269
    */
270 270
   public function Connected() {
271
-    if(!empty($this->smtp_conn)) {
271
+    if (!empty($this->smtp_conn)) {
272 272
       $sock_status = socket_get_status($this->smtp_conn);
273
-      if($sock_status["eof"]) {
273
+      if ($sock_status["eof"]) {
274 274
         // the socket is valid but we are not connected
275
-        if($this->do_debug >= 1) {
276
-            echo "SMTP -> NOTICE:" . $this->CRLF . "EOF caught while checking if connected";
275
+        if ($this->do_debug >= 1) {
276
+            echo "SMTP -> NOTICE:".$this->CRLF."EOF caught while checking if connected";
277 277
         }
278 278
         $this->Close();
279 279
         return false;
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
   public function Close() {
294 294
     $this->error = null; // so there is no confusion
295 295
     $this->helo_rply = null;
296
-    if(!empty($this->smtp_conn)) {
296
+    if (!empty($this->smtp_conn)) {
297 297
       // close the connection and cleanup
298 298
       fclose($this->smtp_conn);
299 299
       $this->smtp_conn = 0;
@@ -326,28 +326,28 @@  discard block
 block discarded – undo
326 326
   public function Data($msg_data) {
327 327
     $this->error = null; // so no confusion is caused
328 328
 
329
-    if(!$this->connected()) {
329
+    if (!$this->connected()) {
330 330
       $this->error = array(
331 331
               "error" => "Called Data() without being connected");
332 332
       return false;
333 333
     }
334 334
 
335
-    fputs($this->smtp_conn,"DATA" . $this->CRLF);
335
+    fputs($this->smtp_conn, "DATA".$this->CRLF);
336 336
 
337 337
     $rply = $this->get_lines();
338
-    $code = substr($rply,0,3);
338
+    $code = substr($rply, 0, 3);
339 339
 
340
-    if($this->do_debug >= 2) {
341
-      echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
340
+    if ($this->do_debug >= 2) {
341
+      echo "SMTP -> FROM SERVER:".$rply.$this->CRLF.'<br />';
342 342
     }
343 343
 
344
-    if($code != 354) {
344
+    if ($code != 354) {
345 345
       $this->error =
346 346
         array("error" => "DATA command not accepted from server",
347 347
               "smtp_code" => $code,
348
-              "smtp_msg" => substr($rply,4));
349
-      if($this->do_debug >= 1) {
350
-        echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
348
+              "smtp_msg" => substr($rply, 4));
349
+      if ($this->do_debug >= 1) {
350
+        echo "SMTP -> ERROR: ".$this->error["error"].": ".$rply.$this->CRLF.'<br />';
351 351
       }
352 352
       return false;
353 353
     }
@@ -364,9 +364,9 @@  discard block
 block discarded – undo
364 364
      */
365 365
 
366 366
     // normalize the line breaks so we know the explode works
367
-    $msg_data = str_replace("\r\n","\n",$msg_data);
368
-    $msg_data = str_replace("\r","\n",$msg_data);
369
-    $lines = explode("\n",$msg_data);
367
+    $msg_data = str_replace("\r\n", "\n", $msg_data);
368
+    $msg_data = str_replace("\r", "\n", $msg_data);
369
+    $lines = explode("\n", $msg_data);
370 370
 
371 371
     /* we need to find a good way to determine is headers are
372 372
      * in the msg_data or if it is a straight msg body
@@ -377,71 +377,71 @@  discard block
 block discarded – undo
377 377
      * headers.
378 378
      */
379 379
 
380
-    $field = substr($lines[0],0,strpos($lines[0],":"));
380
+    $field = substr($lines[0], 0, strpos($lines[0], ":"));
381 381
     $in_headers = false;
382
-    if(!empty($field) && !strstr($field," ")) {
382
+    if (!empty($field) && !strstr($field, " ")) {
383 383
       $in_headers = true;
384 384
     }
385 385
 
386 386
     $max_line_length = 998; // used below; set here for ease in change
387 387
 
388
-    while(list(,$line) = @each($lines)) {
388
+    while (list(,$line) = @each($lines)) {
389 389
       $lines_out = null;
390
-      if($line == "" && $in_headers) {
390
+      if ($line == "" && $in_headers) {
391 391
         $in_headers = false;
392 392
       }
393 393
       // ok we need to break this line up into several smaller lines
394
-      while(strlen($line) > $max_line_length) {
395
-        $pos = strrpos(substr($line,0,$max_line_length)," ");
394
+      while (strlen($line) > $max_line_length) {
395
+        $pos = strrpos(substr($line, 0, $max_line_length), " ");
396 396
 
397 397
         // Patch to fix DOS attack
398
-        if(!$pos) {
398
+        if (!$pos) {
399 399
           $pos = $max_line_length - 1;
400
-          $lines_out[] = substr($line,0,$pos);
401
-          $line = substr($line,$pos);
400
+          $lines_out[] = substr($line, 0, $pos);
401
+          $line = substr($line, $pos);
402 402
         } else {
403
-          $lines_out[] = substr($line,0,$pos);
404
-          $line = substr($line,$pos + 1);
403
+          $lines_out[] = substr($line, 0, $pos);
404
+          $line = substr($line, $pos + 1);
405 405
         }
406 406
 
407 407
         /* if processing headers add a LWSP-char to the front of new line
408 408
          * rfc 822 on long msg headers
409 409
          */
410
-        if($in_headers) {
411
-          $line = "\t" . $line;
410
+        if ($in_headers) {
411
+          $line = "\t".$line;
412 412
         }
413 413
       }
414 414
       $lines_out[] = $line;
415 415
 
416 416
       // send the lines to the server
417
-      while(list(,$line_out) = @each($lines_out)) {
418
-        if(strlen($line_out) > 0)
417
+      while (list(,$line_out) = @each($lines_out)) {
418
+        if (strlen($line_out) > 0)
419 419
         {
420
-          if(substr($line_out, 0, 1) == ".") {
421
-            $line_out = "." . $line_out;
420
+          if (substr($line_out, 0, 1) == ".") {
421
+            $line_out = ".".$line_out;
422 422
           }
423 423
         }
424
-        fputs($this->smtp_conn,$line_out . $this->CRLF);
424
+        fputs($this->smtp_conn, $line_out.$this->CRLF);
425 425
       }
426 426
     }
427 427
 
428 428
     // message data has been sent
429
-    fputs($this->smtp_conn, $this->CRLF . "." . $this->CRLF);
429
+    fputs($this->smtp_conn, $this->CRLF.".".$this->CRLF);
430 430
 
431 431
     $rply = $this->get_lines();
432
-    $code = substr($rply,0,3);
432
+    $code = substr($rply, 0, 3);
433 433
 
434
-    if($this->do_debug >= 2) {
435
-      echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
434
+    if ($this->do_debug >= 2) {
435
+      echo "SMTP -> FROM SERVER:".$rply.$this->CRLF.'<br />';
436 436
     }
437 437
 
438
-    if($code != 250) {
438
+    if ($code != 250) {
439 439
       $this->error =
440 440
         array("error" => "DATA not accepted from server",
441 441
               "smtp_code" => $code,
442
-              "smtp_msg" => substr($rply,4));
443
-      if($this->do_debug >= 1) {
444
-        echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
442
+              "smtp_msg" => substr($rply, 4));
443
+      if ($this->do_debug >= 1) {
444
+        echo "SMTP -> ERROR: ".$this->error["error"].": ".$rply.$this->CRLF.'<br />';
445 445
       }
446 446
       return false;
447 447
     }
@@ -463,21 +463,21 @@  discard block
 block discarded – undo
463 463
   public function Hello($host = '') {
464 464
     $this->error = null; // so no confusion is caused
465 465
 
466
-    if(!$this->connected()) {
466
+    if (!$this->connected()) {
467 467
       $this->error = array(
468 468
             "error" => "Called Hello() without being connected");
469 469
       return false;
470 470
     }
471 471
 
472 472
     // if hostname for HELO was not specified send default
473
-    if(empty($host)) {
473
+    if (empty($host)) {
474 474
       // determine appropriate default to send to server
475 475
       $host = "localhost";
476 476
     }
477 477
 
478 478
     // Send extended hello first (RFC 2821)
479
-    if(!$this->SendHello("EHLO", $host)) {
480
-      if(!$this->SendHello("HELO", $host)) {
479
+    if (!$this->SendHello("EHLO", $host)) {
480
+      if (!$this->SendHello("HELO", $host)) {
481 481
         return false;
482 482
       }
483 483
     }
@@ -491,22 +491,22 @@  discard block
 block discarded – undo
491 491
    * @return bool
492 492
    */
493 493
   private function SendHello($hello, $host) {
494
-    fputs($this->smtp_conn, $hello . " " . $host . $this->CRLF);
494
+    fputs($this->smtp_conn, $hello." ".$host.$this->CRLF);
495 495
 
496 496
     $rply = $this->get_lines();
497
-    $code = substr($rply,0,3);
497
+    $code = substr($rply, 0, 3);
498 498
 
499
-    if($this->do_debug >= 2) {
500
-      echo "SMTP -> FROM SERVER: " . $rply . $this->CRLF . '<br />';
499
+    if ($this->do_debug >= 2) {
500
+      echo "SMTP -> FROM SERVER: ".$rply.$this->CRLF.'<br />';
501 501
     }
502 502
 
503
-    if($code != 250) {
503
+    if ($code != 250) {
504 504
       $this->error =
505
-        array("error" => $hello . " not accepted from server",
505
+        array("error" => $hello." not accepted from server",
506 506
               "smtp_code" => $code,
507
-              "smtp_msg" => substr($rply,4));
508
-      if($this->do_debug >= 1) {
509
-        echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
507
+              "smtp_msg" => substr($rply, 4));
508
+      if ($this->do_debug >= 1) {
509
+        echo "SMTP -> ERROR: ".$this->error["error"].": ".$rply.$this->CRLF.'<br />';
510 510
       }
511 511
       return false;
512 512
     }
@@ -533,29 +533,29 @@  discard block
 block discarded – undo
533 533
   public function Mail($from) {
534 534
     $this->error = null; // so no confusion is caused
535 535
 
536
-    if(!$this->connected()) {
536
+    if (!$this->connected()) {
537 537
       $this->error = array(
538 538
               "error" => "Called Mail() without being connected");
539 539
       return false;
540 540
     }
541 541
 
542 542
     $useVerp = ($this->do_verp ? "XVERP" : "");
543
-    fputs($this->smtp_conn,"MAIL FROM:<" . $from . ">" . $useVerp . $this->CRLF);
543
+    fputs($this->smtp_conn, "MAIL FROM:<".$from.">".$useVerp.$this->CRLF);
544 544
 
545 545
     $rply = $this->get_lines();
546
-    $code = substr($rply,0,3);
546
+    $code = substr($rply, 0, 3);
547 547
 
548
-    if($this->do_debug >= 2) {
549
-      echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
548
+    if ($this->do_debug >= 2) {
549
+      echo "SMTP -> FROM SERVER:".$rply.$this->CRLF.'<br />';
550 550
     }
551 551
 
552
-    if($code != 250) {
552
+    if ($code != 250) {
553 553
       $this->error =
554 554
         array("error" => "MAIL not accepted from server",
555 555
               "smtp_code" => $code,
556
-              "smtp_msg" => substr($rply,4));
557
-      if($this->do_debug >= 1) {
558
-        echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
556
+              "smtp_msg" => substr($rply, 4));
557
+      if ($this->do_debug >= 1) {
558
+        echo "SMTP -> ERROR: ".$this->error["error"].": ".$rply.$this->CRLF.'<br />';
559 559
       }
560 560
       return false;
561 561
     }
@@ -576,38 +576,38 @@  discard block
 block discarded – undo
576 576
   public function Quit($close_on_error = true) {
577 577
     $this->error = null; // so there is no confusion
578 578
 
579
-    if(!$this->connected()) {
579
+    if (!$this->connected()) {
580 580
       $this->error = array(
581 581
               "error" => "Called Quit() without being connected");
582 582
       return false;
583 583
     }
584 584
 
585 585
     // send the quit command to the server
586
-    fputs($this->smtp_conn,"quit" . $this->CRLF);
586
+    fputs($this->smtp_conn, "quit".$this->CRLF);
587 587
 
588 588
     // get any good-bye messages
589 589
     $byemsg = $this->get_lines();
590 590
 
591
-    if($this->do_debug >= 2) {
592
-      echo "SMTP -> FROM SERVER:" . $byemsg . $this->CRLF . '<br />';
591
+    if ($this->do_debug >= 2) {
592
+      echo "SMTP -> FROM SERVER:".$byemsg.$this->CRLF.'<br />';
593 593
     }
594 594
 
595 595
     $rval = true;
596 596
     $e = null;
597 597
 
598
-    $code = substr($byemsg,0,3);
599
-    if($code != 221) {
598
+    $code = substr($byemsg, 0, 3);
599
+    if ($code != 221) {
600 600
       // use e as a tmp var cause Close will overwrite $this->error
601 601
       $e = array("error" => "SMTP server rejected quit command",
602 602
                  "smtp_code" => $code,
603
-                 "smtp_rply" => substr($byemsg,4));
603
+                 "smtp_rply" => substr($byemsg, 4));
604 604
       $rval = false;
605
-      if($this->do_debug >= 1) {
606
-        echo "SMTP -> ERROR: " . $e["error"] . ": " . $byemsg . $this->CRLF . '<br />';
605
+      if ($this->do_debug >= 1) {
606
+        echo "SMTP -> ERROR: ".$e["error"].": ".$byemsg.$this->CRLF.'<br />';
607 607
       }
608 608
     }
609 609
 
610
-    if(empty($e) || $close_on_error) {
610
+    if (empty($e) || $close_on_error) {
611 611
       $this->Close();
612 612
     }
613 613
 
@@ -629,28 +629,28 @@  discard block
 block discarded – undo
629 629
   public function Recipient($to) {
630 630
     $this->error = null; // so no confusion is caused
631 631
 
632
-    if(!$this->connected()) {
632
+    if (!$this->connected()) {
633 633
       $this->error = array(
634 634
               "error" => "Called Recipient() without being connected");
635 635
       return false;
636 636
     }
637 637
 
638
-    fputs($this->smtp_conn,"RCPT TO:<" . $to . ">" . $this->CRLF);
638
+    fputs($this->smtp_conn, "RCPT TO:<".$to.">".$this->CRLF);
639 639
 
640 640
     $rply = $this->get_lines();
641
-    $code = substr($rply,0,3);
641
+    $code = substr($rply, 0, 3);
642 642
 
643
-    if($this->do_debug >= 2) {
644
-      echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
643
+    if ($this->do_debug >= 2) {
644
+      echo "SMTP -> FROM SERVER:".$rply.$this->CRLF.'<br />';
645 645
     }
646 646
 
647
-    if($code != 250 && $code != 251) {
647
+    if ($code != 250 && $code != 251) {
648 648
       $this->error =
649 649
         array("error" => "RCPT not accepted from server",
650 650
               "smtp_code" => $code,
651
-              "smtp_msg" => substr($rply,4));
652
-      if($this->do_debug >= 1) {
653
-        echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
651
+              "smtp_msg" => substr($rply, 4));
652
+      if ($this->do_debug >= 1) {
653
+        echo "SMTP -> ERROR: ".$this->error["error"].": ".$rply.$this->CRLF.'<br />';
654 654
       }
655 655
       return false;
656 656
     }
@@ -672,28 +672,28 @@  discard block
 block discarded – undo
672 672
   public function Reset() {
673 673
     $this->error = null; // so no confusion is caused
674 674
 
675
-    if(!$this->connected()) {
675
+    if (!$this->connected()) {
676 676
       $this->error = array(
677 677
               "error" => "Called Reset() without being connected");
678 678
       return false;
679 679
     }
680 680
 
681
-    fputs($this->smtp_conn,"RSET" . $this->CRLF);
681
+    fputs($this->smtp_conn, "RSET".$this->CRLF);
682 682
 
683 683
     $rply = $this->get_lines();
684
-    $code = substr($rply,0,3);
684
+    $code = substr($rply, 0, 3);
685 685
 
686
-    if($this->do_debug >= 2) {
687
-      echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
686
+    if ($this->do_debug >= 2) {
687
+      echo "SMTP -> FROM SERVER:".$rply.$this->CRLF.'<br />';
688 688
     }
689 689
 
690
-    if($code != 250) {
690
+    if ($code != 250) {
691 691
       $this->error =
692 692
         array("error" => "RSET failed",
693 693
               "smtp_code" => $code,
694
-              "smtp_msg" => substr($rply,4));
695
-      if($this->do_debug >= 1) {
696
-        echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
694
+              "smtp_msg" => substr($rply, 4));
695
+      if ($this->do_debug >= 1) {
696
+        echo "SMTP -> ERROR: ".$this->error["error"].": ".$rply.$this->CRLF.'<br />';
697 697
       }
698 698
       return false;
699 699
     }
@@ -720,28 +720,28 @@  discard block
 block discarded – undo
720 720
   public function SendAndMail($from) {
721 721
     $this->error = null; // so no confusion is caused
722 722
 
723
-    if(!$this->connected()) {
723
+    if (!$this->connected()) {
724 724
       $this->error = array(
725 725
           "error" => "Called SendAndMail() without being connected");
726 726
       return false;
727 727
     }
728 728
 
729
-    fputs($this->smtp_conn,"SAML FROM:" . $from . $this->CRLF);
729
+    fputs($this->smtp_conn, "SAML FROM:".$from.$this->CRLF);
730 730
 
731 731
     $rply = $this->get_lines();
732
-    $code = substr($rply,0,3);
732
+    $code = substr($rply, 0, 3);
733 733
 
734
-    if($this->do_debug >= 2) {
735
-      echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
734
+    if ($this->do_debug >= 2) {
735
+      echo "SMTP -> FROM SERVER:".$rply.$this->CRLF.'<br />';
736 736
     }
737 737
 
738
-    if($code != 250) {
738
+    if ($code != 250) {
739 739
       $this->error =
740 740
         array("error" => "SAML not accepted from server",
741 741
               "smtp_code" => $code,
742
-              "smtp_msg" => substr($rply,4));
743
-      if($this->do_debug >= 1) {
744
-        echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
742
+              "smtp_msg" => substr($rply, 4));
743
+      if ($this->do_debug >= 1) {
744
+        echo "SMTP -> ERROR: ".$this->error["error"].": ".$rply.$this->CRLF.'<br />';
745 745
       }
746 746
       return false;
747 747
     }
@@ -764,8 +764,8 @@  discard block
 block discarded – undo
764 764
   public function Turn() {
765 765
     $this->error = array("error" => "This method, TURN, of the SMTP ".
766 766
                                     "is not implemented");
767
-    if($this->do_debug >= 1) {
768
-      echo "SMTP -> NOTICE: " . $this->error["error"] . $this->CRLF . '<br />';
767
+    if ($this->do_debug >= 1) {
768
+      echo "SMTP -> NOTICE: ".$this->error["error"].$this->CRLF.'<br />';
769 769
     }
770 770
     return false;
771 771
   }
@@ -794,17 +794,17 @@  discard block
 block discarded – undo
794 794
    */
795 795
   private function get_lines() {
796 796
     $data = "";
797
-    while($str = @fgets($this->smtp_conn,515)) {
798
-      if($this->do_debug >= 4) {
799
-        echo "SMTP -> get_lines(): \$data was \"$data\"" . $this->CRLF . '<br />';
800
-        echo "SMTP -> get_lines(): \$str is \"$str\"" . $this->CRLF . '<br />';
797
+    while ($str = @fgets($this->smtp_conn, 515)) {
798
+      if ($this->do_debug >= 4) {
799
+        echo "SMTP -> get_lines(): \$data was \"$data\"".$this->CRLF.'<br />';
800
+        echo "SMTP -> get_lines(): \$str is \"$str\"".$this->CRLF.'<br />';
801 801
       }
802 802
       $data .= $str;
803
-      if($this->do_debug >= 4) {
804
-        echo "SMTP -> get_lines(): \$data is \"$data\"" . $this->CRLF . '<br />';
803
+      if ($this->do_debug >= 4) {
804
+        echo "SMTP -> get_lines(): \$data is \"$data\"".$this->CRLF.'<br />';
805 805
       }
806 806
       // if 4th character is a space, we are done reading, break the loop
807
-      if(substr($str,3,1) == " ") { break; }
807
+      if (substr($str, 3, 1) == " ") { break; }
808 808
     }
809 809
     return $data;
810 810
   }
Please login to merge, or discard this patch.
main/inc/lib/phpmailer/class.pop3.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 
121 121
   private $pop_conn;
122 122
   private $connected;
123
-  private $error;     //  Error log array
123
+  private $error; //  Error log array
124 124
 
125 125
   /**
126 126
    * Constructor, sets the initial values
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
    * @param string $username
143 143
    * @param string $password
144 144
    */
145
-  public function Authorise ($host, $port = false, $tval = false, $username, $password, $debug_level = 0) {
145
+  public function Authorise($host, $port = false, $tval = false, $username, $password, $debug_level = 0) {
146 146
     $this->host = $host;
147 147
 
148 148
     //  If no port value is passed, retrieve it
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
    * @param integer $tval
195 195
    * @return boolean
196 196
    */
197
-  public function Connect ($host, $port = false, $tval = 30) {
197
+  public function Connect($host, $port = false, $tval = 30) {
198 198
     //  Are we already connected?
199 199
     if ($this->connected) {
200 200
       return true;
@@ -208,11 +208,11 @@  discard block
 block discarded – undo
208 208
     set_error_handler(array(&$this, 'catchWarning'));
209 209
 
210 210
     //  Connect to the POP3 server
211
-    $this->pop_conn = fsockopen($host,    //  POP3 Host
212
-                  $port,    //  Port #
213
-                  $errno,   //  Error Number
214
-                  $errstr,  //  Error Message
215
-                  $tval);   //  Timeout (seconds)
211
+    $this->pop_conn = fsockopen($host, //  POP3 Host
212
+                  $port, //  Port #
213
+                  $errno, //  Error Number
214
+                  $errstr, //  Error Message
215
+                  $tval); //  Timeout (seconds)
216 216
 
217 217
     //  Restore the error handler
218 218
     restore_error_handler();
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
    * @param string $password
270 270
    * @return boolean
271 271
    */
272
-  public function Login ($username = '', $password = '') {
272
+  public function Login($username = '', $password = '') {
273 273
     if ($this->connected == false) {
274 274
       $this->error = 'Not connected to POP3 server';
275 275
 
@@ -286,8 +286,8 @@  discard block
 block discarded – undo
286 286
       $password = $this->password;
287 287
     }
288 288
 
289
-    $pop_username = "USER $username" . $this->CRLF;
290
-    $pop_password = "PASS $password" . $this->CRLF;
289
+    $pop_username = "USER $username".$this->CRLF;
290
+    $pop_password = "PASS $password".$this->CRLF;
291 291
 
292 292
     //  Send the Username
293 293
     $this->sendString($pop_username);
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
    * Disconnect from the POP3 server
313 313
    * @access public
314 314
    */
315
-  public function Disconnect () {
315
+  public function Disconnect() {
316 316
     $this->sendString('QUIT');
317 317
 
318 318
     fclose($this->pop_conn);
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
    * @param integer $size
330 330
    * @return string
331 331
    */
332
-  private function getResponse ($size = 128) {
332
+  private function getResponse($size = 128) {
333 333
     $pop3_response = fgets($this->pop_conn, $size);
334 334
 
335 335
     return $pop3_response;
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
    * @param string $string
342 342
    * @return integer
343 343
    */
344
-  private function sendString ($string) {
344
+  private function sendString($string) {
345 345
     $bytes_sent = fwrite($this->pop_conn, $string, strlen($string));
346 346
 
347 347
     return $bytes_sent;
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
    * @param string $string
354 354
    * @return boolean
355 355
    */
356
-  private function checkResponse ($string) {
356
+  private function checkResponse($string) {
357 357
     if (substr($string, 0, 3) !== '+OK') {
358 358
       $this->error = array(
359 359
         'error' => "Server reported an error: $string",
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
    * If debug is enabled, display the error message array
377 377
    * @access private
378 378
    */
379
-  private function displayErrors () {
379
+  private function displayErrors() {
380 380
     echo '<pre>';
381 381
 
382 382
     foreach ($this->error as $single_error) {
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
    * @param string $errfile
395 395
    * @param integer $errline
396 396
    */
397
-  private function catchWarning ($errno, $errstr, $errfile, $errline) {
397
+  private function catchWarning($errno, $errstr, $errfile, $errline) {
398 398
     $this->error[] = array(
399 399
       'error' => "Connecting to the POP3 server raised a PHP warning: ",
400 400
       'errno' => $errno,
Please login to merge, or discard this patch.
main/inc/lib/phpmailer/language/phpmailer.lang-ar.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 //$PHPMAILER_LANG['invalid_email']        = 'Not sending, email address is invalid: ';
19 19
 $PHPMAILER_LANG['mailer_not_supported'] = ' mailer غير مدعوم.';
20 20
 //$PHPMAILER_LANG['provide_address']      = 'You must provide at least one recipient email address.';
21
-$PHPMAILER_LANG['recipients_failed']    = 'SMTP Error: الأخطاء التالية ' .
21
+$PHPMAILER_LANG['recipients_failed']    = 'SMTP Error: الأخطاء التالية '.
22 22
                                           'فشل في الارسال لكل من : ';
23 23
 $PHPMAILER_LANG['signing']              = 'خطأ في التوقيع: ';
24 24
 //$PHPMAILER_LANG['smtp_connect_failed']  = 'SMTP Connect() failed.';
Please login to merge, or discard this patch.
main/inc/lib/phpmailer/class.phpmailer.php 1 patch
Spacing   +235 added lines, -236 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
  * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
39 39
  */
40 40
 
41
-if (version_compare(PHP_VERSION, '5.0.0', '<') ) exit("Sorry, this version of PHPMailer will only run on PHP version 5 or greater!\n");
41
+if (version_compare(PHP_VERSION, '5.0.0', '<')) exit("Sorry, this version of PHPMailer will only run on PHP version 5 or greater!\n");
42 42
 
43 43
 class PHPMailer {
44 44
 
@@ -50,64 +50,64 @@  discard block
 block discarded – undo
50 50
    * Email priority (1 = High, 3 = Normal, 5 = low).
51 51
    * @var int
52 52
    */
53
-  public $Priority          = 3;
53
+  public $Priority = 3;
54 54
 
55 55
   /**
56 56
    * Sets the CharSet of the message.
57 57
    * @var string
58 58
    */
59
-  public $CharSet           = 'iso-8859-1';
59
+  public $CharSet = 'iso-8859-1';
60 60
 
61 61
   /**
62 62
    * Sets the Content-type of the message.
63 63
    * @var string
64 64
    */
65
-  public $ContentType       = 'text/plain';
65
+  public $ContentType = 'text/plain';
66 66
 
67 67
   /**
68 68
    * Sets the Encoding of the message. Options for this are
69 69
    *  "8bit", "7bit", "binary", "base64", and "quoted-printable".
70 70
    * @var string
71 71
    */
72
-  public $Encoding          = '8bit';
72
+  public $Encoding = '8bit';
73 73
 
74 74
   /**
75 75
    * Holds the most recent mailer error message.
76 76
    * @var string
77 77
    */
78
-  public $ErrorInfo         = '';
78
+  public $ErrorInfo = '';
79 79
 
80 80
   /**
81 81
    * Sets the From email address for the message.
82 82
    * @var string
83 83
    */
84
-  public $From              = 'root@localhost';
84
+  public $From = 'root@localhost';
85 85
 
86 86
   /**
87 87
    * Sets the From name of the message.
88 88
    * @var string
89 89
    */
90
-  public $FromName          = 'Root User';
90
+  public $FromName = 'Root User';
91 91
 
92 92
   /**
93 93
    * Sets the Sender email (Return-Path) of the message.  If not empty,
94 94
    * will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode.
95 95
    * @var string
96 96
    */
97
-  public $Sender            = '';
97
+  public $Sender = '';
98 98
 
99 99
   /**
100 100
    * Sets the Subject of the message.
101 101
    * @var string
102 102
    */
103
-  public $Subject           = '';
103
+  public $Subject = '';
104 104
 
105 105
   /**
106 106
    * Sets the Body of the message.  This can be either an HTML or text body.
107 107
    * If HTML then run IsHTML(true).
108 108
    * @var string
109 109
    */
110
-  public $Body              = '';
110
+  public $Body = '';
111 111
 
112 112
   /**
113 113
    * Sets the text-only body of the message.  This automatically sets the
@@ -116,39 +116,39 @@  discard block
 block discarded – undo
116 116
    * that can read HTML will view the normal Body.
117 117
    * @var string
118 118
    */
119
-  public $AltBody           = '';
119
+  public $AltBody = '';
120 120
 
121 121
   /**
122 122
    * Sets word wrapping on the body of the message to a given number of
123 123
    * characters.
124 124
    * @var int
125 125
    */
126
-  public $WordWrap          = 0;
126
+  public $WordWrap = 0;
127 127
 
128 128
   /**
129 129
    * Method to send mail: ("mail", "sendmail", or "smtp").
130 130
    * @var string
131 131
    */
132
-  public $Mailer            = 'mail';
132
+  public $Mailer = 'mail';
133 133
 
134 134
   /**
135 135
    * Sets the path of the sendmail program.
136 136
    * @var string
137 137
    */
138
-  public $Sendmail          = '/usr/sbin/sendmail';
138
+  public $Sendmail = '/usr/sbin/sendmail';
139 139
 
140 140
   /**
141 141
    * Path to PHPMailer plugins.  Useful if the SMTP class
142 142
    * is in a different directory than the PHP include path.
143 143
    * @var string
144 144
    */
145
-  public $PluginDir         = '';
145
+  public $PluginDir = '';
146 146
 
147 147
   /**
148 148
    * Sets the email address that a reading confirmation will be sent.
149 149
    * @var string
150 150
    */
151
-  public $ConfirmReadingTo  = '';
151
+  public $ConfirmReadingTo = '';
152 152
 
153 153
   /**
154 154
    * Sets the hostname to use in Message-Id and Received headers
@@ -156,14 +156,14 @@  discard block
 block discarded – undo
156 156
    * by SERVER_NAME is used or 'localhost.localdomain'.
157 157
    * @var string
158 158
    */
159
-  public $Hostname          = '';
159
+  public $Hostname = '';
160 160
 
161 161
   /**
162 162
    * Sets the message ID to be used in the Message-Id header.
163 163
    * If empty, a unique id will be generated.
164 164
    * @var string
165 165
    */
166
-  public $MessageID         = '';
166
+  public $MessageID = '';
167 167
 
168 168
   /////////////////////////////////////////////////
169 169
   // PROPERTIES FOR SMTP
@@ -177,57 +177,57 @@  discard block
 block discarded – undo
177 177
    * Hosts will be tried in order.
178 178
    * @var string
179 179
    */
180
-  public $Host          = 'localhost';
180
+  public $Host = 'localhost';
181 181
 
182 182
   /**
183 183
    * Sets the default SMTP server port.
184 184
    * @var int
185 185
    */
186
-  public $Port          = 25;
186
+  public $Port = 25;
187 187
 
188 188
   /**
189 189
    * Sets the SMTP HELO of the message (Default is $Hostname).
190 190
    * @var string
191 191
    */
192
-  public $Helo          = '';
192
+  public $Helo = '';
193 193
 
194 194
   /**
195 195
    * Sets connection prefix.
196 196
    * Options are "", "ssl" or "tls"
197 197
    * @var string
198 198
    */
199
-  public $SMTPSecure    = '';
199
+  public $SMTPSecure = '';
200 200
 
201 201
   /**
202 202
    * Sets SMTP authentication. Utilizes the Username and Password variables.
203 203
    * @var bool
204 204
    */
205
-  public $SMTPAuth      = false;
205
+  public $SMTPAuth = false;
206 206
 
207 207
   /**
208 208
    * Sets SMTP username.
209 209
    * @var string
210 210
    */
211
-  public $Username      = '';
211
+  public $Username = '';
212 212
 
213 213
   /**
214 214
    * Sets SMTP password.
215 215
    * @var string
216 216
    */
217
-  public $Password      = '';
217
+  public $Password = '';
218 218
 
219 219
   /**
220 220
    * Sets the SMTP server timeout in seconds.
221 221
    * This function will not work with the win32 version.
222 222
    * @var int
223 223
    */
224
-  public $Timeout       = 10;
224
+  public $Timeout = 10;
225 225
 
226 226
   /**
227 227
    * Sets SMTP class debugging on or off.
228 228
    * @var bool
229 229
    */
230
-  public $SMTPDebug     = false;
230
+  public $SMTPDebug = false;
231 231
 
232 232
   /**
233 233
    * Prevents the SMTP connection from being closed after each mail
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
    * emails, instead of sending to entire TO addresses
243 243
    * @var bool
244 244
    */
245
-  public $SingleTo      = false;
245
+  public $SingleTo = false;
246 246
 
247 247
    /**
248 248
    * If SingleTo is true, this provides the array to hold the email addresses
@@ -254,34 +254,34 @@  discard block
 block discarded – undo
254 254
    * Provides the ability to change the line ending
255 255
    * @var string
256 256
    */
257
-  public $LE              = "\n";
257
+  public $LE = "\n";
258 258
 
259 259
   /**
260 260
    * Used with DKIM DNS Resource Record
261 261
    * @var string
262 262
    */
263
-  public $DKIM_selector   = 'phpmailer';
263
+  public $DKIM_selector = 'phpmailer';
264 264
 
265 265
   /**
266 266
    * Used with DKIM DNS Resource Record
267 267
    * optional, in format of email address '[email protected]'
268 268
    * @var string
269 269
    */
270
-  public $DKIM_identity   = '';
270
+  public $DKIM_identity = '';
271 271
 
272 272
   /**
273 273
    * Used with DKIM DNS Resource Record
274 274
    * optional, in format of email address '[email protected]'
275 275
    * @var string
276 276
    */
277
-  public $DKIM_domain     = '';
277
+  public $DKIM_domain = '';
278 278
 
279 279
   /**
280 280
    * Used with DKIM DNS Resource Record
281 281
    * optional, in format of email address '[email protected]'
282 282
    * @var string
283 283
    */
284
-  public $DKIM_private    = '';
284
+  public $DKIM_private = '';
285 285
 
286 286
   /**
287 287
    * Callback Action function name
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
    * Sets the PHPMailer Version number
301 301
    * @var string
302 302
    */
303
-  public $Version         = '5.1';
303
+  public $Version = '5.1';
304 304
 
305 305
   /////////////////////////////////////////////////
306 306
   // PROPERTIES, PRIVATE AND PROTECTED
@@ -451,13 +451,13 @@  discard block
 block discarded – undo
451 451
    */
452 452
   private function AddAnAddress($kind, $address, $name = '') {
453 453
     if (!preg_match('/^(to|cc|bcc|ReplyTo)$/', $kind)) {
454
-      error_log('Invalid recipient array: ' . $kind);
454
+      error_log('Invalid recipient array: '.$kind);
455 455
       return false;
456 456
     }
457 457
     $address = trim($address);
458 458
     $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim
459 459
     if (!self::ValidateAddress($address)) {
460
-      $this->SetError($this->Lang('invalid_address').': '. $address);
460
+      $this->SetError($this->Lang('invalid_address').': '.$address);
461 461
       if ($this->exceptions) {
462 462
         throw new phpmailerException($this->Lang('invalid_address').': '.$address);
463 463
       }
@@ -485,11 +485,11 @@  discard block
 block discarded – undo
485 485
  * @param string $name
486 486
  * @return boolean
487 487
  */
488
-  public function SetFrom($address, $name = '',$auto=1) {
488
+  public function SetFrom($address, $name = '', $auto = 1) {
489 489
     $address = trim($address);
490 490
     $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim
491 491
     if (!self::ValidateAddress($address)) {
492
-      $this->SetError($this->Lang('invalid_address').': '. $address);
492
+      $this->SetError($this->Lang('invalid_address').': '.$address);
493 493
       if ($this->exceptions) {
494 494
         throw new phpmailerException($this->Lang('invalid_address').': '.$address);
495 495
       }
@@ -522,7 +522,7 @@  discard block
 block discarded – undo
522 522
    */
523 523
   public static function ValidateAddress($address) {
524 524
     if (function_exists('filter_var')) { //Introduced in PHP 5.2
525
-      if(filter_var($address, FILTER_VALIDATE_EMAIL) === FALSE) {
525
+      if (filter_var($address, FILTER_VALIDATE_EMAIL) === FALSE) {
526 526
         return false;
527 527
       } else {
528 528
         return true;
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
       }
550 550
 
551 551
       // Set whether the message is multipart/alternative
552
-      if(!empty($this->AltBody)) {
552
+      if (!empty($this->AltBody)) {
553 553
         $this->ContentType = 'multipart/alternative';
554 554
       }
555 555
 
@@ -564,12 +564,12 @@  discard block
 block discarded – undo
564 564
 
565 565
       // digitally sign with DKIM if enabled
566 566
       if ($this->DKIM_domain && $this->DKIM_private) {
567
-        $header_dkim = $this->DKIM_Add($header,$this->Subject,$body);
568
-        $header = str_replace("\r\n","\n",$header_dkim) . $header;
567
+        $header_dkim = $this->DKIM_Add($header, $this->Subject, $body);
568
+        $header = str_replace("\r\n", "\n", $header_dkim).$header;
569 569
       }
570 570
 
571 571
       // Choose the mailer and send through it
572
-      switch($this->Mailer) {
572
+      switch ($this->Mailer) {
573 573
         case 'sendmail':
574 574
           return $this->SendmailSend($header, $body);
575 575
         case 'smtp':
@@ -602,32 +602,32 @@  discard block
 block discarded – undo
602 602
     }
603 603
     if ($this->SingleTo === true) {
604 604
       foreach ($this->SingleToArray as $key => $val) {
605
-        if(!@$mail = popen($sendmail, 'w')) {
606
-          throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
605
+        if (!@$mail = popen($sendmail, 'w')) {
606
+          throw new phpmailerException($this->Lang('execute').$this->Sendmail, self::STOP_CRITICAL);
607 607
         }
608
-        fputs($mail, "To: " . $val . "\n");
608
+        fputs($mail, "To: ".$val."\n");
609 609
         fputs($mail, $header);
610 610
         fputs($mail, $body);
611 611
         $result = pclose($mail);
612 612
         // implement call back function if it exists
613 613
         $isSent = ($result == 0) ? 1 : 0;
614
-        $this->doCallback($isSent,$val,$this->cc,$this->bcc,$this->Subject,$body);
615
-        if($result != 0) {
616
-          throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
614
+        $this->doCallback($isSent, $val, $this->cc, $this->bcc, $this->Subject, $body);
615
+        if ($result != 0) {
616
+          throw new phpmailerException($this->Lang('execute').$this->Sendmail, self::STOP_CRITICAL);
617 617
         }
618 618
       }
619 619
     } else {
620
-      if(!@$mail = popen($sendmail, 'w')) {
621
-        throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
620
+      if (!@$mail = popen($sendmail, 'w')) {
621
+        throw new phpmailerException($this->Lang('execute').$this->Sendmail, self::STOP_CRITICAL);
622 622
       }
623 623
       fputs($mail, $header);
624 624
       fputs($mail, $body);
625 625
       $result = pclose($mail);
626 626
       // implement call back function if it exists
627 627
       $isSent = ($result == 0) ? 1 : 0;
628
-      $this->doCallback($isSent,$this->to,$this->cc,$this->bcc,$this->Subject,$body);
629
-      if($result != 0) {
630
-        throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
628
+      $this->doCallback($isSent, $this->to, $this->cc, $this->bcc, $this->Subject, $body);
629
+      if ($result != 0) {
630
+        throw new phpmailerException($this->Lang('execute').$this->Sendmail, self::STOP_CRITICAL);
631 631
       }
632 632
     }
633 633
     return true;
@@ -642,13 +642,13 @@  discard block
 block discarded – undo
642 642
    */
643 643
   protected function MailSend($header, $body) {
644 644
     $toArr = array();
645
-    foreach($this->to as $t) {
645
+    foreach ($this->to as $t) {
646 646
       $toArr[] = $this->AddrFormat($t);
647 647
     }
648 648
     $to = implode(', ', $toArr);
649 649
 
650 650
     $params = sprintf("-oi -f %s", $this->Sender);
651
-    if ($this->Sender != '' && strlen(ini_get('safe_mode'))< 1) {
651
+    if ($this->Sender != '' && strlen(ini_get('safe_mode')) < 1) {
652 652
       $old_from = ini_get('sendmail_from');
653 653
       ini_set('sendmail_from', $this->Sender);
654 654
       if ($this->SingleTo === true && count($toArr) > 1) {
@@ -656,13 +656,13 @@  discard block
 block discarded – undo
656 656
           $rt = @mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
657 657
           // implement call back function if it exists
658 658
           $isSent = ($rt == 1) ? 1 : 0;
659
-          $this->doCallback($isSent,$val,$this->cc,$this->bcc,$this->Subject,$body);
659
+          $this->doCallback($isSent, $val, $this->cc, $this->bcc, $this->Subject, $body);
660 660
         }
661 661
       } else {
662 662
         $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
663 663
         // implement call back function if it exists
664 664
         $isSent = ($rt == 1) ? 1 : 0;
665
-        $this->doCallback($isSent,$to,$this->cc,$this->bcc,$this->Subject,$body);
665
+        $this->doCallback($isSent, $to, $this->cc, $this->bcc, $this->Subject, $body);
666 666
       }
667 667
     } else {
668 668
       if ($this->SingleTo === true && count($toArr) > 1) {
@@ -670,19 +670,19 @@  discard block
 block discarded – undo
670 670
           $rt = @mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
671 671
           // implement call back function if it exists
672 672
           $isSent = ($rt == 1) ? 1 : 0;
673
-          $this->doCallback($isSent,$val,$this->cc,$this->bcc,$this->Subject,$body);
673
+          $this->doCallback($isSent, $val, $this->cc, $this->bcc, $this->Subject, $body);
674 674
         }
675 675
       } else {
676 676
         $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header);
677 677
         // implement call back function if it exists
678 678
         $isSent = ($rt == 1) ? 1 : 0;
679
-        $this->doCallback($isSent,$to,$this->cc,$this->bcc,$this->Subject,$body);
679
+        $this->doCallback($isSent, $to, $this->cc, $this->bcc, $this->Subject, $body);
680 680
       }
681 681
     }
682 682
     if (isset($old_from)) {
683 683
       ini_set('sendmail_from', $old_from);
684 684
     }
685
-    if(!$rt) {
685
+    if (!$rt) {
686 686
       throw new phpmailerException($this->Lang('instantiate'), self::STOP_CRITICAL);
687 687
     }
688 688
     return true;
@@ -698,64 +698,64 @@  discard block
 block discarded – undo
698 698
    * @return bool
699 699
    */
700 700
   protected function SmtpSend($header, $body) {
701
-    require_once $this->PluginDir . 'class.smtp.php';
701
+    require_once $this->PluginDir.'class.smtp.php';
702 702
     $bad_rcpt = array();
703 703
 
704
-    if(!$this->SmtpConnect()) {
704
+    if (!$this->SmtpConnect()) {
705 705
       throw new phpmailerException($this->Lang('smtp_connect_failed'), self::STOP_CRITICAL);
706 706
     }
707 707
     $smtp_from = ($this->Sender == '') ? $this->From : $this->Sender;
708
-    if(!$this->smtp->Mail($smtp_from)) {
709
-      throw new phpmailerException($this->Lang('from_failed') . $smtp_from, self::STOP_CRITICAL);
708
+    if (!$this->smtp->Mail($smtp_from)) {
709
+      throw new phpmailerException($this->Lang('from_failed').$smtp_from, self::STOP_CRITICAL);
710 710
     }
711 711
 
712 712
     // Attempt to send attach all recipients
713
-    foreach($this->to as $to) {
713
+    foreach ($this->to as $to) {
714 714
       if (!$this->smtp->Recipient($to[0])) {
715 715
         $bad_rcpt[] = $to[0];
716 716
         // implement call back function if it exists
717 717
         $isSent = 0;
718
-        $this->doCallback($isSent,$to[0],'','',$this->Subject,$body);
718
+        $this->doCallback($isSent, $to[0], '', '', $this->Subject, $body);
719 719
       } else {
720 720
         // implement call back function if it exists
721 721
         $isSent = 1;
722
-        $this->doCallback($isSent,$to[0],'','',$this->Subject,$body);
722
+        $this->doCallback($isSent, $to[0], '', '', $this->Subject, $body);
723 723
       }
724 724
     }
725
-    foreach($this->cc as $cc) {
725
+    foreach ($this->cc as $cc) {
726 726
       if (!$this->smtp->Recipient($cc[0])) {
727 727
         $bad_rcpt[] = $cc[0];
728 728
         // implement call back function if it exists
729 729
         $isSent = 0;
730
-        $this->doCallback($isSent,'',$cc[0],'',$this->Subject,$body);
730
+        $this->doCallback($isSent, '', $cc[0], '', $this->Subject, $body);
731 731
       } else {
732 732
         // implement call back function if it exists
733 733
         $isSent = 1;
734
-        $this->doCallback($isSent,'',$cc[0],'',$this->Subject,$body);
734
+        $this->doCallback($isSent, '', $cc[0], '', $this->Subject, $body);
735 735
       }
736 736
     }
737
-    foreach($this->bcc as $bcc) {
737
+    foreach ($this->bcc as $bcc) {
738 738
       if (!$this->smtp->Recipient($bcc[0])) {
739 739
         $bad_rcpt[] = $bcc[0];
740 740
         // implement call back function if it exists
741 741
         $isSent = 0;
742
-        $this->doCallback($isSent,'','',$bcc[0],$this->Subject,$body);
742
+        $this->doCallback($isSent, '', '', $bcc[0], $this->Subject, $body);
743 743
       } else {
744 744
         // implement call back function if it exists
745 745
         $isSent = 1;
746
-        $this->doCallback($isSent,'','',$bcc[0],$this->Subject,$body);
746
+        $this->doCallback($isSent, '', '', $bcc[0], $this->Subject, $body);
747 747
       }
748 748
     }
749 749
 
750 750
 
751
-    if (count($bad_rcpt) > 0 ) { //Create error message for any bad addresses
751
+    if (count($bad_rcpt) > 0) { //Create error message for any bad addresses
752 752
       $badaddresses = implode(', ', $bad_rcpt);
753
-      throw new phpmailerException($this->Lang('recipients_failed') . $badaddresses);
753
+      throw new phpmailerException($this->Lang('recipients_failed').$badaddresses);
754 754
     }
755
-    if(!$this->smtp->Data($header . $body)) {
755
+    if (!$this->smtp->Data($header.$body)) {
756 756
       throw new phpmailerException($this->Lang('data_not_accepted'), self::STOP_CRITICAL);
757 757
     }
758
-    if($this->SMTPKeepAlive == true) {
758
+    if ($this->SMTPKeepAlive == true) {
759 759
       $this->smtp->Reset();
760 760
     }
761 761
     return true;
@@ -769,7 +769,7 @@  discard block
 block discarded – undo
769 769
    * @return bool
770 770
    */
771 771
   public function SmtpConnect() {
772
-    if(is_null($this->smtp)) {
772
+    if (is_null($this->smtp)) {
773 773
       $this->smtp = new SMTP();
774 774
     }
775 775
 
@@ -780,7 +780,7 @@  discard block
 block discarded – undo
780 780
 
781 781
     // Retry while there is no connection
782 782
     try {
783
-      while($index < count($hosts) && !$connection) {
783
+      while ($index < count($hosts) && !$connection) {
784 784
         $hostinfo = array();
785 785
         if (preg_match('/^(.+):([0-9]+)$/', $hosts[$index], $hostinfo)) {
786 786
           $host = $hostinfo[1];
@@ -793,7 +793,7 @@  discard block
 block discarded – undo
793 793
         $tls = ($this->SMTPSecure == 'tls');
794 794
         $ssl = ($this->SMTPSecure == 'ssl');
795 795
 
796
-        if ($this->smtp->Connect(($ssl ? 'ssl://':'').$host, $port, $this->Timeout)) {
796
+        if ($this->smtp->Connect(($ssl ? 'ssl://' : '').$host, $port, $this->Timeout)) {
797 797
 
798 798
           $hello = ($this->Helo != '' ? $this->Helo : $this->ServerHostname());
799 799
           $this->smtp->Hello($hello);
@@ -831,8 +831,8 @@  discard block
 block discarded – undo
831 831
    * @return void
832 832
    */
833 833
   public function SmtpClose() {
834
-    if(!is_null($this->smtp)) {
835
-      if($this->smtp->Connected()) {
834
+    if (!is_null($this->smtp)) {
835
+      if ($this->smtp->Connected()) {
836 836
         $this->smtp->Quit();
837 837
         $this->smtp->Close();
838 838
       }
@@ -894,7 +894,7 @@  discard block
 block discarded – undo
894 894
    * @return string
895 895
    */
896 896
   public function AddrAppend($type, $addr) {
897
-    $addr_str = $type . ': ';
897
+    $addr_str = $type.': ';
898 898
     $addresses = array();
899 899
     foreach ($addr as $a) {
900 900
       $addresses[] = $this->AddrFormat($a);
@@ -914,7 +914,7 @@  discard block
 block discarded – undo
914 914
     if (empty($addr[1])) {
915 915
       return $this->SecureHeader($addr[0]);
916 916
     } else {
917
-      return $this->EncodeHeader($this->SecureHeader($addr[1]), 'phrase') . " <" . $this->SecureHeader($addr[0]) . ">";
917
+      return $this->EncodeHeader($this->SecureHeader($addr[1]), 'phrase')." <".$this->SecureHeader($addr[0]).">";
918 918
     }
919 919
   }
920 920
 
@@ -941,10 +941,10 @@  discard block
 block discarded – undo
941 941
 
942 942
     $line = explode($this->LE, $message);
943 943
     $message = '';
944
-    for ($i=0 ;$i < count($line); $i++) {
944
+    for ($i = 0; $i < count($line); $i++) {
945 945
       $line_part = explode(' ', $line[$i]);
946 946
       $buf = '';
947
-      for ($e = 0; $e<count($line_part); $e++) {
947
+      for ($e = 0; $e < count($line_part); $e++) {
948 948
         $word = $line_part[$e];
949 949
         if ($qp_mode and (strlen($word) > $length)) {
950 950
           $space_left = $length - strlen($buf) - 1;
@@ -960,10 +960,10 @@  discard block
 block discarded – undo
960 960
               }
961 961
               $part = substr($word, 0, $len);
962 962
               $word = substr($word, $len);
963
-              $buf .= ' ' . $part;
964
-              $message .= $buf . sprintf("=%s", $this->LE);
963
+              $buf .= ' '.$part;
964
+              $message .= $buf.sprintf("=%s", $this->LE);
965 965
             } else {
966
-              $message .= $buf . $soft_break;
966
+              $message .= $buf.$soft_break;
967 967
             }
968 968
             $buf = '';
969 969
           }
@@ -980,22 +980,22 @@  discard block
 block discarded – undo
980 980
             $word = substr($word, $len);
981 981
 
982 982
             if (strlen($word) > 0) {
983
-              $message .= $part . sprintf("=%s", $this->LE);
983
+              $message .= $part.sprintf("=%s", $this->LE);
984 984
             } else {
985 985
               $buf = $part;
986 986
             }
987 987
           }
988 988
         } else {
989 989
           $buf_o = $buf;
990
-          $buf .= ($e == 0) ? $word : (' ' . $word);
990
+          $buf .= ($e == 0) ? $word : (' '.$word);
991 991
 
992 992
           if (strlen($buf) > $length and $buf_o != '') {
993
-            $message .= $buf_o . $soft_break;
993
+            $message .= $buf_o.$soft_break;
994 994
             $buf = $word;
995 995
           }
996 996
         }
997 997
       }
998
-      $message .= $buf . $this->LE;
998
+      $message .= $buf.$this->LE;
999 999
     }
1000 1000
 
1001 1001
     return $message;
@@ -1024,8 +1024,7 @@  discard block
 block discarded – undo
1024 1024
         if ($dec < 128) { // Single byte character.
1025 1025
           // If the encoded char was found at pos 0, it will fit
1026 1026
           // otherwise reduce maxLength to start of the encoded char
1027
-          $maxLength = ($encodedCharPos == 0) ? $maxLength :
1028
-          $maxLength - ($lookBack - $encodedCharPos);
1027
+          $maxLength = ($encodedCharPos == 0) ? $maxLength : $maxLength - ($lookBack - $encodedCharPos);
1029 1028
           $foundSplitPos = true;
1030 1029
         } elseif ($dec >= 192) { // First byte of a multi byte character
1031 1030
           // Reduce maxLength to split at start of character
@@ -1049,11 +1048,11 @@  discard block
 block discarded – undo
1049 1048
    * @return void
1050 1049
    */
1051 1050
   public function SetWordWrap() {
1052
-    if($this->WordWrap < 1) {
1051
+    if ($this->WordWrap < 1) {
1053 1052
       return;
1054 1053
     }
1055 1054
 
1056
-    switch($this->message_type) {
1055
+    switch ($this->message_type) {
1057 1056
       case 'alt':
1058 1057
       case 'alt_attachments':
1059 1058
         $this->AltBody = $this->WrapText($this->AltBody, $this->WordWrap);
@@ -1074,24 +1073,24 @@  discard block
 block discarded – undo
1074 1073
 
1075 1074
     // Set the boundaries
1076 1075
     $uniq_id = md5(uniqid(time()));
1077
-    $this->boundary[1] = 'b1_' . $uniq_id;
1078
-    $this->boundary[2] = 'b2_' . $uniq_id;
1076
+    $this->boundary[1] = 'b1_'.$uniq_id;
1077
+    $this->boundary[2] = 'b2_'.$uniq_id;
1079 1078
 
1080 1079
     $result .= $this->HeaderLine('Date', self::RFCDate());
1081
-    if($this->Sender == '') {
1080
+    if ($this->Sender == '') {
1082 1081
       $result .= $this->HeaderLine('Return-Path', trim($this->From));
1083 1082
     } else {
1084 1083
       $result .= $this->HeaderLine('Return-Path', trim($this->Sender));
1085 1084
     }
1086 1085
 
1087 1086
     // To be created automatically by mail()
1088
-    if($this->Mailer != 'mail') {
1087
+    if ($this->Mailer != 'mail') {
1089 1088
       if ($this->SingleTo === true) {
1090
-        foreach($this->to as $t) {
1089
+        foreach ($this->to as $t) {
1091 1090
           $this->SingleToArray[] = $this->AddrFormat($t);
1092 1091
         }
1093 1092
       } else {
1094
-        if(count($this->to) > 0) {
1093
+        if (count($this->to) > 0) {
1095 1094
           $result .= $this->AddrAppend('To', $this->to);
1096 1095
         } elseif (count($this->cc) == 0) {
1097 1096
           $result .= $this->HeaderLine('To', 'undisclosed-recipients:;');
@@ -1105,38 +1104,38 @@  discard block
 block discarded – undo
1105 1104
     $result .= $this->AddrAppend('From', $from);
1106 1105
 
1107 1106
     // sendmail and mail() extract Cc from the header before sending
1108
-    if(count($this->cc) > 0) {
1107
+    if (count($this->cc) > 0) {
1109 1108
       $result .= $this->AddrAppend('Cc', $this->cc);
1110 1109
     }
1111 1110
 
1112 1111
     // sendmail and mail() extract Bcc from the header before sending
1113
-    if((($this->Mailer == 'sendmail') || ($this->Mailer == 'mail')) && (count($this->bcc) > 0)) {
1112
+    if ((($this->Mailer == 'sendmail') || ($this->Mailer == 'mail')) && (count($this->bcc) > 0)) {
1114 1113
       $result .= $this->AddrAppend('Bcc', $this->bcc);
1115 1114
     }
1116 1115
 
1117
-    if(count($this->ReplyTo) > 0) {
1116
+    if (count($this->ReplyTo) > 0) {
1118 1117
       $result .= $this->AddrAppend('Reply-to', $this->ReplyTo);
1119 1118
     }
1120 1119
 
1121 1120
     // mail() sets the subject itself
1122
-    if($this->Mailer != 'mail') {
1121
+    if ($this->Mailer != 'mail') {
1123 1122
       $result .= $this->HeaderLine('Subject', $this->EncodeHeader($this->SecureHeader($this->Subject)));
1124 1123
     }
1125 1124
 
1126
-    if($this->MessageID != '') {
1127
-      $result .= $this->HeaderLine('Message-ID',$this->MessageID);
1125
+    if ($this->MessageID != '') {
1126
+      $result .= $this->HeaderLine('Message-ID', $this->MessageID);
1128 1127
     } else {
1129 1128
       $result .= sprintf("Message-ID: <%s@%s>%s", $uniq_id, $this->ServerHostname(), $this->LE);
1130 1129
     }
1131 1130
     $result .= $this->HeaderLine('X-Priority', $this->Priority);
1132 1131
     $result .= $this->HeaderLine('X-Mailer', 'PHPMailer '.$this->Version.' (phpmailer.sourceforge.net)');
1133 1132
 
1134
-    if($this->ConfirmReadingTo != '') {
1135
-      $result .= $this->HeaderLine('Disposition-Notification-To', '<' . trim($this->ConfirmReadingTo) . '>');
1133
+    if ($this->ConfirmReadingTo != '') {
1134
+      $result .= $this->HeaderLine('Disposition-Notification-To', '<'.trim($this->ConfirmReadingTo).'>');
1136 1135
     }
1137 1136
 
1138 1137
     // Add custom headers
1139
-    for($index = 0; $index < count($this->CustomHeader); $index++) {
1138
+    for ($index = 0; $index < count($this->CustomHeader); $index++) {
1140 1139
       $result .= $this->HeaderLine(trim($this->CustomHeader[$index][0]), $this->EncodeHeader(trim($this->CustomHeader[$index][1])));
1141 1140
     }
1142 1141
     if (!$this->sign_key_file) {
@@ -1154,27 +1153,27 @@  discard block
 block discarded – undo
1154 1153
    */
1155 1154
   public function GetMailMIME() {
1156 1155
     $result = '';
1157
-    switch($this->message_type) {
1156
+    switch ($this->message_type) {
1158 1157
       case 'plain':
1159 1158
         $result .= $this->HeaderLine('Content-Transfer-Encoding', $this->Encoding);
1160 1159
         $result .= sprintf("Content-Type: %s; charset=\"%s\"", $this->ContentType, $this->CharSet);
1161 1160
         break;
1162 1161
       case 'attachments':
1163 1162
       case 'alt_attachments':
1164
-        if($this->InlineImageExists()){
1163
+        if ($this->InlineImageExists()) {
1165 1164
           $result .= sprintf("Content-Type: %s;%s\ttype=\"text/html\";%s\tboundary=\"%s\"%s", 'multipart/related', $this->LE, $this->LE, $this->boundary[1], $this->LE);
1166 1165
         } else {
1167 1166
           $result .= $this->HeaderLine('Content-Type', 'multipart/mixed;');
1168
-          $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
1167
+          $result .= $this->TextLine("\tboundary=\"".$this->boundary[1].'"');
1169 1168
         }
1170 1169
         break;
1171 1170
       case 'alt':
1172 1171
         $result .= $this->HeaderLine('Content-Type', 'multipart/alternative;');
1173
-        $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
1172
+        $result .= $this->TextLine("\tboundary=\"".$this->boundary[1].'"');
1174 1173
         break;
1175 1174
     }
1176 1175
 
1177
-    if($this->Mailer != 'mail') {
1176
+    if ($this->Mailer != 'mail') {
1178 1177
       $result .= $this->LE.$this->LE;
1179 1178
     }
1180 1179
 
@@ -1195,7 +1194,7 @@  discard block
 block discarded – undo
1195 1194
 
1196 1195
     $this->SetWordWrap();
1197 1196
 
1198
-    switch($this->message_type) {
1197
+    switch ($this->message_type) {
1199 1198
       case 'alt':
1200 1199
         $body .= $this->GetBoundary($this->boundary[1], '', 'text/plain', '');
1201 1200
         $body .= $this->EncodeString($this->AltBody, $this->Encoding);
@@ -1216,11 +1215,11 @@  discard block
 block discarded – undo
1216 1215
         break;
1217 1216
       case 'alt_attachments':
1218 1217
         $body .= sprintf("--%s%s", $this->boundary[1], $this->LE);
1219
-        $body .= sprintf("Content-Type: %s;%s" . "\tboundary=\"%s\"%s", 'multipart/alternative', $this->LE, $this->boundary[2], $this->LE.$this->LE);
1220
-        $body .= $this->GetBoundary($this->boundary[2], '', 'text/plain', '') . $this->LE; // Create text body
1218
+        $body .= sprintf("Content-Type: %s;%s"."\tboundary=\"%s\"%s", 'multipart/alternative', $this->LE, $this->boundary[2], $this->LE.$this->LE);
1219
+        $body .= $this->GetBoundary($this->boundary[2], '', 'text/plain', '').$this->LE; // Create text body
1221 1220
         $body .= $this->EncodeString($this->AltBody, $this->Encoding);
1222 1221
         $body .= $this->LE.$this->LE;
1223
-        $body .= $this->GetBoundary($this->boundary[2], '', 'text/html', '') . $this->LE; // Create the HTML body
1222
+        $body .= $this->GetBoundary($this->boundary[2], '', 'text/html', '').$this->LE; // Create the HTML body
1224 1223
         $body .= $this->EncodeString($this->Body, $this->Encoding);
1225 1224
         $body .= $this->LE.$this->LE;
1226 1225
         $body .= $this->EndBoundary($this->boundary[2]);
@@ -1261,16 +1260,16 @@  discard block
 block discarded – undo
1261 1260
    */
1262 1261
   private function GetBoundary($boundary, $charSet, $contentType, $encoding) {
1263 1262
     $result = '';
1264
-    if($charSet == '') {
1263
+    if ($charSet == '') {
1265 1264
       $charSet = $this->CharSet;
1266 1265
     }
1267
-    if($contentType == '') {
1266
+    if ($contentType == '') {
1268 1267
       $contentType = $this->ContentType;
1269 1268
     }
1270
-    if($encoding == '') {
1269
+    if ($encoding == '') {
1271 1270
       $encoding = $this->Encoding;
1272 1271
     }
1273
-    $result .= $this->TextLine('--' . $boundary);
1272
+    $result .= $this->TextLine('--'.$boundary);
1274 1273
     $result .= sprintf("Content-Type: %s; charset = \"%s\"", $contentType, $charSet);
1275 1274
     $result .= $this->LE;
1276 1275
     $result .= $this->HeaderLine('Content-Transfer-Encoding', $encoding);
@@ -1284,7 +1283,7 @@  discard block
 block discarded – undo
1284 1283
    * @access private
1285 1284
    */
1286 1285
   private function EndBoundary($boundary) {
1287
-    return $this->LE . '--' . $boundary . '--' . $this->LE;
1286
+    return $this->LE.'--'.$boundary.'--'.$this->LE;
1288 1287
   }
1289 1288
 
1290 1289
   /**
@@ -1293,16 +1292,16 @@  discard block
 block discarded – undo
1293 1292
    * @return void
1294 1293
    */
1295 1294
   private function SetMessageType() {
1296
-    if(count($this->attachment) < 1 && strlen($this->AltBody) < 1) {
1295
+    if (count($this->attachment) < 1 && strlen($this->AltBody) < 1) {
1297 1296
       $this->message_type = 'plain';
1298 1297
     } else {
1299
-      if(count($this->attachment) > 0) {
1298
+      if (count($this->attachment) > 0) {
1300 1299
         $this->message_type = 'attachments';
1301 1300
       }
1302
-      if(strlen($this->AltBody) > 0 && count($this->attachment) < 1) {
1301
+      if (strlen($this->AltBody) > 0 && count($this->attachment) < 1) {
1303 1302
         $this->message_type = 'alt';
1304 1303
       }
1305
-      if(strlen($this->AltBody) > 0 && count($this->attachment) > 0) {
1304
+      if (strlen($this->AltBody) > 0 && count($this->attachment) > 0) {
1306 1305
         $this->message_type = 'alt_attachments';
1307 1306
       }
1308 1307
     }
@@ -1314,7 +1313,7 @@  discard block
 block discarded – undo
1314 1313
    * @return string
1315 1314
    */
1316 1315
   public function HeaderLine($name, $value) {
1317
-    return $name . ': ' . $value . $this->LE;
1316
+    return $name.': '.$value.$this->LE;
1318 1317
   }
1319 1318
 
1320 1319
   /**
@@ -1323,7 +1322,7 @@  discard block
 block discarded – undo
1323 1322
    * @return string
1324 1323
    */
1325 1324
   public function TextLine($value) {
1326
-    return $value . $this->LE;
1325
+    return $value.$this->LE;
1327 1326
   }
1328 1327
 
1329 1328
   /////////////////////////////////////////////////
@@ -1342,11 +1341,11 @@  discard block
 block discarded – undo
1342 1341
    */
1343 1342
   public function AddAttachment($path, $name = '', $encoding = 'base64', $type = 'application/octet-stream') {
1344 1343
     try {
1345
-      if ( !@is_file($path) ) {
1346
-        throw new phpmailerException($this->Lang('file_access') . $path, self::STOP_CONTINUE);
1344
+      if (!@is_file($path)) {
1345
+        throw new phpmailerException($this->Lang('file_access').$path, self::STOP_CONTINUE);
1347 1346
       }
1348 1347
       $filename = basename($path);
1349
-      if ( $name == '' ) {
1348
+      if ($name == '') {
1350 1349
         $name = $filename;
1351 1350
       }
1352 1351
 
@@ -1356,7 +1355,7 @@  discard block
 block discarded – undo
1356 1355
         2 => $name,
1357 1356
         3 => $encoding,
1358 1357
         4 => $type,
1359
-        5 => false,  // isStringAttachment
1358
+        5 => false, // isStringAttachment
1360 1359
         6 => 'attachment',
1361 1360
         7 => 0
1362 1361
       );
@@ -1367,7 +1366,7 @@  discard block
 block discarded – undo
1367 1366
         throw $e;
1368 1367
       }
1369 1368
       error_log($e->getMessage()."\n");
1370
-      if ( $e->getCode() == self::STOP_CRITICAL ) {
1369
+      if ($e->getCode() == self::STOP_CRITICAL) {
1371 1370
         return false;
1372 1371
       }
1373 1372
     }
@@ -1412,29 +1411,29 @@  discard block
 block discarded – undo
1412 1411
       $disposition = $attachment[6];
1413 1412
       $cid         = $attachment[7];
1414 1413
       $incl[]      = $attachment[0];
1415
-      if ( $disposition == 'inline' && isset($cidUniq[$cid]) ) { continue; }
1414
+      if ($disposition == 'inline' && isset($cidUniq[$cid])) { continue; }
1416 1415
       $cidUniq[$cid] = true;
1417 1416
 
1418 1417
       $mime[] = sprintf("--%s%s", $this->boundary[1], $this->LE);
1419 1418
       $mime[] = sprintf("Content-Type: %s; name=\"%s\"%s", $type, $this->EncodeHeader($this->SecureHeader($name)), $this->LE);
1420 1419
       $mime[] = sprintf("Content-Transfer-Encoding: %s%s", $encoding, $this->LE);
1421 1420
 
1422
-      if($disposition == 'inline') {
1421
+      if ($disposition == 'inline') {
1423 1422
         $mime[] = sprintf("Content-ID: <%s>%s", $cid, $this->LE);
1424 1423
       }
1425 1424
 
1426 1425
       $mime[] = sprintf("Content-Disposition: %s; filename=\"%s\"%s", $disposition, $this->EncodeHeader($this->SecureHeader($name)), $this->LE.$this->LE);
1427 1426
 
1428 1427
       // Encode as string attachment
1429
-      if($bString) {
1428
+      if ($bString) {
1430 1429
         $mime[] = $this->EncodeString($string, $encoding);
1431
-        if($this->IsError()) {
1430
+        if ($this->IsError()) {
1432 1431
           return '';
1433 1432
         }
1434 1433
         $mime[] = $this->LE.$this->LE;
1435 1434
       } else {
1436 1435
         $mime[] = $this->EncodeFile($path, $encoding);
1437
-        if($this->IsError()) {
1436
+        if ($this->IsError()) {
1438 1437
           return '';
1439 1438
         }
1440 1439
         $mime[] = $this->LE.$this->LE;
@@ -1458,7 +1457,7 @@  discard block
 block discarded – undo
1458 1457
   private function EncodeFile($path, $encoding = 'base64') {
1459 1458
     try {
1460 1459
       if (!is_readable($path)) {
1461
-        throw new phpmailerException($this->Lang('file_open') . $path, self::STOP_CONTINUE);
1460
+        throw new phpmailerException($this->Lang('file_open').$path, self::STOP_CONTINUE);
1462 1461
       }
1463 1462
         $magic_quotes = get_magic_quotes_runtime();
1464 1463
         if ($magic_quotes) {
@@ -1492,9 +1491,9 @@  discard block
 block discarded – undo
1492 1491
    * @access public
1493 1492
    * @return string
1494 1493
    */
1495
-  public function EncodeString ($str, $encoding = 'base64') {
1494
+  public function EncodeString($str, $encoding = 'base64') {
1496 1495
     $encoded = '';
1497
-    switch(strtolower($encoding)) {
1496
+    switch (strtolower($encoding)) {
1498 1497
       case 'base64':
1499 1498
         $encoded = chunk_split(base64_encode($str), 76, $this->LE);
1500 1499
         break;
@@ -1512,7 +1511,7 @@  discard block
 block discarded – undo
1512 1511
         $encoded = $this->EncodeQP($str);
1513 1512
         break;
1514 1513
       default:
1515
-        $this->SetError($this->Lang('encoding') . $encoding);
1514
+        $this->SetError($this->Lang('encoding').$encoding);
1516 1515
         break;
1517 1516
     }
1518 1517
     return $encoded;
@@ -1554,7 +1553,7 @@  discard block
 block discarded – undo
1554 1553
 
1555 1554
     $maxlen = 75 - 7 - strlen($this->CharSet);
1556 1555
     // Try to select the encoding which should produce the shortest output
1557
-    if (strlen($str)/3 < $x) {
1556
+    if (strlen($str) / 3 < $x) {
1558 1557
       $encoding = 'B';
1559 1558
       // Modified by Ivan Tcholakov, 24-JAN-2010.
1560 1559
       //if (function_exists('mb_strlen') && $this->HasMultiBytes($str)) {
@@ -1635,7 +1634,7 @@  discard block
 block discarded – undo
1635 1634
       }
1636 1635
       while (strlen($chunk) > $length);
1637 1636
 
1638
-      $encoded .= $chunk . $this->LE;
1637
+      $encoded .= $chunk.$this->LE;
1639 1638
     }
1640 1639
 
1641 1640
     // Chomp the last linefeed
@@ -1651,37 +1650,37 @@  discard block
 block discarded – undo
1651 1650
   * @param integer $line_max Number of chars allowed on a line before wrapping
1652 1651
   * @return string
1653 1652
   */
1654
-  public function EncodeQPphp( $input = '', $line_max = 76, $space_conv = false) {
1655
-    $hex = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
1653
+  public function EncodeQPphp($input = '', $line_max = 76, $space_conv = false) {
1654
+    $hex = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F');
1656 1655
     $lines = preg_split('/(?:\r\n|\r|\n)/', $input);
1657 1656
     $eol = "\r\n";
1658 1657
     $escape = '=';
1659 1658
     $output = '';
1660
-    while( list(, $line) = each($lines) ) {
1659
+    while (list(, $line) = each($lines)) {
1661 1660
       $linlen = strlen($line);
1662 1661
       $newline = '';
1663
-      for($i = 0; $i < $linlen; $i++) {
1664
-        $c = substr( $line, $i, 1 );
1665
-        $dec = ord( $c );
1666
-        if ( ( $i == 0 ) && ( $dec == 46 ) ) { // convert first point in the line into =2E
1662
+      for ($i = 0; $i < $linlen; $i++) {
1663
+        $c = substr($line, $i, 1);
1664
+        $dec = ord($c);
1665
+        if (($i == 0) && ($dec == 46)) { // convert first point in the line into =2E
1667 1666
           $c = '=2E';
1668 1667
         }
1669
-        if ( $dec == 32 ) {
1670
-          if ( $i == ( $linlen - 1 ) ) { // convert space at eol only
1668
+        if ($dec == 32) {
1669
+          if ($i == ($linlen - 1)) { // convert space at eol only
1671 1670
             $c = '=20';
1672
-          } else if ( $space_conv ) {
1671
+          } else if ($space_conv) {
1673 1672
             $c = '=20';
1674 1673
           }
1675
-        } elseif ( ($dec == 61) || ($dec < 32 ) || ($dec > 126) ) { // always encode "\t", which is *not* required
1676
-          $h2 = floor($dec/16);
1677
-          $h1 = floor($dec%16);
1674
+        } elseif (($dec == 61) || ($dec < 32) || ($dec > 126)) { // always encode "\t", which is *not* required
1675
+          $h2 = floor($dec / 16);
1676
+          $h1 = floor($dec % 16);
1678 1677
           $c = $escape.$hex[$h2].$hex[$h1];
1679 1678
         }
1680
-        if ( (strlen($newline) + strlen($c)) >= $line_max ) { // CRLF is not counted
1679
+        if ((strlen($newline) + strlen($c)) >= $line_max) { // CRLF is not counted
1681 1680
           $output .= $newline.$escape.$eol; //  soft line break; " =\r\n" is okay
1682 1681
           $newline = '';
1683 1682
           // check if newline first character will be point or not
1684
-          if ( $dec == 46 ) {
1683
+          if ($dec == 46) {
1685 1684
             $c = '=2E';
1686 1685
           }
1687 1686
         }
@@ -1733,7 +1732,7 @@  discard block
 block discarded – undo
1733 1732
    * @access public
1734 1733
    * @return string
1735 1734
    */
1736
-  public function EncodeQ ($str, $position = 'text') {
1735
+  public function EncodeQ($str, $position = 'text') {
1737 1736
     // There should not be any EOL in the string
1738 1737
     $encoded = preg_replace('/[\r\n]*/', '', $str);
1739 1738
 
@@ -1776,7 +1775,7 @@  discard block
 block discarded – undo
1776 1775
       2 => basename($filename),
1777 1776
       3 => $encoding,
1778 1777
       4 => $type,
1779
-      5 => true,  // isStringAttachment
1778
+      5 => true, // isStringAttachment
1780 1779
       6 => 'attachment',
1781 1780
       7 => 0
1782 1781
     );
@@ -1797,13 +1796,13 @@  discard block
 block discarded – undo
1797 1796
    */
1798 1797
   public function AddEmbeddedImage($path, $cid, $name = '', $encoding = 'base64', $type = 'application/octet-stream') {
1799 1798
 
1800
-    if ( !@is_file($path) ) {
1801
-      $this->SetError($this->Lang('file_access') . $path);
1799
+    if (!@is_file($path)) {
1800
+      $this->SetError($this->Lang('file_access').$path);
1802 1801
       return false;
1803 1802
     }
1804 1803
 
1805 1804
     $filename = basename($path);
1806
-    if ( $name == '' ) {
1805
+    if ($name == '') {
1807 1806
       $name = $filename;
1808 1807
     }
1809 1808
 
@@ -1814,7 +1813,7 @@  discard block
 block discarded – undo
1814 1813
       2 => $name,
1815 1814
       3 => $encoding,
1816 1815
       4 => $type,
1817
-      5 => false,  // isStringAttachment
1816
+      5 => false, // isStringAttachment
1818 1817
       6 => 'inline',
1819 1818
       7 => $cid
1820 1819
     );
@@ -1828,7 +1827,7 @@  discard block
 block discarded – undo
1828 1827
    * @return bool
1829 1828
    */
1830 1829
   public function InlineImageExists() {
1831
-    foreach($this->attachment as $attachment) {
1830
+    foreach ($this->attachment as $attachment) {
1832 1831
       if ($attachment[6] == 'inline') {
1833 1832
         return true;
1834 1833
       }
@@ -1845,7 +1844,7 @@  discard block
 block discarded – undo
1845 1844
    * @return void
1846 1845
    */
1847 1846
   public function ClearAddresses() {
1848
-    foreach($this->to as $to) {
1847
+    foreach ($this->to as $to) {
1849 1848
       unset($this->all_recipients[strtolower($to[0])]);
1850 1849
     }
1851 1850
     $this->to = array();
@@ -1856,7 +1855,7 @@  discard block
 block discarded – undo
1856 1855
    * @return void
1857 1856
    */
1858 1857
   public function ClearCCs() {
1859
-    foreach($this->cc as $cc) {
1858
+    foreach ($this->cc as $cc) {
1860 1859
       unset($this->all_recipients[strtolower($cc[0])]);
1861 1860
     }
1862 1861
     $this->cc = array();
@@ -1867,7 +1866,7 @@  discard block
 block discarded – undo
1867 1866
    * @return void
1868 1867
    */
1869 1868
   public function ClearBCCs() {
1870
-    foreach($this->bcc as $bcc) {
1869
+    foreach ($this->bcc as $bcc) {
1871 1870
       unset($this->all_recipients[strtolower($bcc[0])]);
1872 1871
     }
1873 1872
     $this->bcc = array();
@@ -1924,7 +1923,7 @@  discard block
 block discarded – undo
1924 1923
     if ($this->Mailer == 'smtp' and !is_null($this->smtp)) {
1925 1924
       $lasterror = $this->smtp->getError();
1926 1925
       if (!empty($lasterror) and array_key_exists('smtp_msg', $lasterror)) {
1927
-        $msg .= '<p>' . $this->Lang('smtp_error') . $lasterror['smtp_msg'] . "</p>\n";
1926
+        $msg .= '<p>'.$this->Lang('smtp_error').$lasterror['smtp_msg']."</p>\n";
1928 1927
       }
1929 1928
     }
1930 1929
     $this->ErrorInfo = $msg;
@@ -1940,7 +1939,7 @@  discard block
 block discarded – undo
1940 1939
     $tz = date('Z');
1941 1940
     $tzs = ($tz < 0) ? '-' : '+';
1942 1941
     $tz = abs($tz);
1943
-    $tz = (int)($tz/3600)*100 + ($tz%3600)/60;
1942
+    $tz = (int) ($tz / 3600) * 100 + ($tz % 3600) / 60;
1944 1943
     $result = sprintf("%s %s%04d", date('D, j M Y H:i:s'), $tzs, $tz);
1945 1944
 
1946 1945
     return $result;
@@ -1969,14 +1968,14 @@  discard block
 block discarded – undo
1969 1968
    * @return string
1970 1969
    */
1971 1970
   private function Lang($key) {
1972
-    if(count($this->language) < 1) {
1971
+    if (count($this->language) < 1) {
1973 1972
       $this->SetLanguage('en'); // set the default language
1974 1973
     }
1975 1974
 
1976
-    if(isset($this->language[$key])) {
1975
+    if (isset($this->language[$key])) {
1977 1976
       return $this->language[$key];
1978 1977
     } else {
1979
-      return 'Language string failed to load: ' . $key;
1978
+      return 'Language string failed to load: '.$key;
1980 1979
     }
1981 1980
   }
1982 1981
 
@@ -2017,19 +2016,19 @@  discard block
 block discarded – undo
2017 2016
    */
2018 2017
   public function MsgHTML($message, $basedir = '') {
2019 2018
     preg_match_all("/(src|background)=\"(.*)\"/Ui", $message, $images);
2020
-    if(isset($images[2])) {
2021
-      foreach($images[2] as $i => $url) {
2019
+    if (isset($images[2])) {
2020
+      foreach ($images[2] as $i => $url) {
2022 2021
         // do not change urls for absolute images (thanks to corvuscorax)
2023
-        if (!preg_match('#^[A-z]+://#',$url)) {
2022
+        if (!preg_match('#^[A-z]+://#', $url)) {
2024 2023
           $filename = basename($url);
2025 2024
           $directory = dirname($url);
2026
-          ($directory == '.')?$directory='':'';
2027
-          $cid = 'cid:' . md5($filename);
2025
+          ($directory == '.') ? $directory = '' : '';
2026
+          $cid = 'cid:'.md5($filename);
2028 2027
           $ext = pathinfo($filename, PATHINFO_EXTENSION);
2029
-          $mimeType  = self::_mime_types($ext);
2030
-          if ( strlen($basedir) > 1 && substr($basedir,-1) != '/') { $basedir .= '/'; }
2031
-          if ( strlen($directory) > 1 && substr($directory,-1) != '/') { $directory .= '/'; }
2032
-          if ( $this->AddEmbeddedImage($basedir.$directory.$filename, md5($filename), $filename, 'base64',$mimeType) ) {
2028
+          $mimeType = self::_mime_types($ext);
2029
+          if (strlen($basedir) > 1 && substr($basedir, -1) != '/') { $basedir .= '/'; }
2030
+          if (strlen($directory) > 1 && substr($directory, -1) != '/') { $directory .= '/'; }
2031
+          if ($this->AddEmbeddedImage($basedir.$directory.$filename, md5($filename), $filename, 'base64', $mimeType)) {
2033 2032
             $message = preg_replace("/".$images[1][$i]."=\"".preg_quote($url, '/')."\"/Ui", $images[1][$i]."=\"".$cid."\"", $message);
2034 2033
           }
2035 2034
         }
@@ -2037,12 +2036,12 @@  discard block
 block discarded – undo
2037 2036
     }
2038 2037
     $this->IsHTML(true);
2039 2038
     $this->Body = $message;
2040
-    $textMsg = trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/s','',$message)));
2039
+    $textMsg = trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/s', '', $message)));
2041 2040
     if (!empty($textMsg) && empty($this->AltBody)) {
2042 2041
       $this->AltBody = html_entity_decode($textMsg);
2043 2042
     }
2044 2043
     if (empty($this->AltBody)) {
2045
-      $this->AltBody = 'To view this email message, open it in a program that understands HTML!' . "\n\n";
2044
+      $this->AltBody = 'To view this email message, open it in a program that understands HTML!'."\n\n";
2046 2045
     }
2047 2046
   }
2048 2047
 
@@ -2160,10 +2159,10 @@  discard block
 block discarded – undo
2160 2159
   */
2161 2160
   public function set($name, $value = '') {
2162 2161
     try {
2163
-      if (isset($this->$name) ) {
2162
+      if (isset($this->$name)) {
2164 2163
         $this->$name = $value;
2165 2164
       } else {
2166
-        throw new phpmailerException($this->Lang('variable_set') . $name, self::STOP_CRITICAL);
2165
+        throw new phpmailerException($this->Lang('variable_set').$name, self::STOP_CRITICAL);
2167 2166
       }
2168 2167
     } catch (Exception $e) {
2169 2168
       $this->SetError($e->getMessage());
@@ -2207,14 +2206,14 @@  discard block
 block discarded – undo
2207 2206
    * @param string $key_pass Password for private key
2208 2207
    */
2209 2208
   public function DKIM_QP($txt) {
2210
-    $tmp="";
2211
-    $line="";
2212
-    for ($i=0;$i<strlen($txt);$i++) {
2213
-      $ord=ord($txt[$i]);
2214
-      if ( ((0x21 <= $ord) && ($ord <= 0x3A)) || $ord == 0x3C || ((0x3E <= $ord) && ($ord <= 0x7E)) ) {
2215
-        $line.=$txt[$i];
2209
+    $tmp = "";
2210
+    $line = "";
2211
+    for ($i = 0; $i < strlen($txt); $i++) {
2212
+      $ord = ord($txt[$i]);
2213
+      if (((0x21 <= $ord) && ($ord <= 0x3A)) || $ord == 0x3C || ((0x3E <= $ord) && ($ord <= 0x7E))) {
2214
+        $line .= $txt[$i];
2216 2215
       } else {
2217
-        $line.="=".sprintf("%02X",$ord);
2216
+        $line .= "=".sprintf("%02X", $ord);
2218 2217
       }
2219 2218
     }
2220 2219
     return $line;
@@ -2228,8 +2227,8 @@  discard block
 block discarded – undo
2228 2227
    */
2229 2228
   public function DKIM_Sign($s) {
2230 2229
     $privKeyStr = file_get_contents($this->DKIM_private);
2231
-    if ($this->DKIM_passphrase!='') {
2232
-      $privKey = openssl_pkey_get_private($privKeyStr,$this->DKIM_passphrase);
2230
+    if ($this->DKIM_passphrase != '') {
2231
+      $privKey = openssl_pkey_get_private($privKeyStr, $this->DKIM_passphrase);
2233 2232
     } else {
2234 2233
       $privKey = $privKeyStr;
2235 2234
     }
@@ -2245,15 +2244,15 @@  discard block
 block discarded – undo
2245 2244
    * @param string $s Header
2246 2245
    */
2247 2246
   public function DKIM_HeaderC($s) {
2248
-    $s=preg_replace("/\r\n\s+/"," ",$s);
2249
-    $lines=explode("\r\n",$s);
2247
+    $s = preg_replace("/\r\n\s+/", " ", $s);
2248
+    $lines = explode("\r\n", $s);
2250 2249
     foreach ($lines as $key=>$line) {
2251
-      list($heading,$value)=explode(":",$line,2);
2252
-      $heading=strtolower($heading);
2253
-      $value=preg_replace("/\s+/"," ",$value) ; // Compress useless spaces
2254
-      $lines[$key]=$heading.":".trim($value) ; // Don't forget to remove WSP around the value
2250
+      list($heading, $value) = explode(":", $line, 2);
2251
+      $heading = strtolower($heading);
2252
+      $value = preg_replace("/\s+/", " ", $value); // Compress useless spaces
2253
+      $lines[$key] = $heading.":".trim($value); // Don't forget to remove WSP around the value
2255 2254
     }
2256
-    $s=implode("\r\n",$lines);
2255
+    $s = implode("\r\n", $lines);
2257 2256
     return $s;
2258 2257
   }
2259 2258
 
@@ -2266,11 +2265,11 @@  discard block
 block discarded – undo
2266 2265
   public function DKIM_BodyC($body) {
2267 2266
     if ($body == '') return "\r\n";
2268 2267
     // stabilize line endings
2269
-    $body=str_replace("\r\n","\n",$body);
2270
-    $body=str_replace("\n","\r\n",$body);
2268
+    $body = str_replace("\r\n", "\n", $body);
2269
+    $body = str_replace("\n", "\r\n", $body);
2271 2270
     // END stabilize line endings
2272
-    while (substr($body,strlen($body)-4,4) == "\r\n\r\n") {
2273
-      $body=substr($body,0,strlen($body)-2);
2271
+    while (substr($body, strlen($body) - 4, 4) == "\r\n\r\n") {
2272
+      $body = substr($body, 0, strlen($body) - 2);
2274 2273
     }
2275 2274
     return $body;
2276 2275
   }
@@ -2283,52 +2282,52 @@  discard block
 block discarded – undo
2283 2282
    * @param string $subject Subject
2284 2283
    * @param string $body Body
2285 2284
    */
2286
-  public function DKIM_Add($headers_line,$subject,$body) {
2285
+  public function DKIM_Add($headers_line, $subject, $body) {
2287 2286
     $DKIMsignatureType    = 'rsa-sha1'; // Signature & hash algorithms
2288 2287
     $DKIMcanonicalization = 'relaxed/simple'; // Canonicalization of header/body
2289 2288
     $DKIMquery            = 'dns/txt'; // Query method
2290
-    $DKIMtime             = time() ; // Signature Timestamp = seconds since 00:00:00 - Jan 1, 1970 (UTC time zone)
2289
+    $DKIMtime             = time(); // Signature Timestamp = seconds since 00:00:00 - Jan 1, 1970 (UTC time zone)
2291 2290
     $subject_header       = "Subject: $subject";
2292
-    $headers              = explode("\r\n",$headers_line);
2293
-    foreach($headers as $header) {
2294
-      if (strpos($header,'From:') === 0) {
2295
-        $from_header=$header;
2296
-      } elseif (strpos($header,'To:') === 0) {
2297
-        $to_header=$header;
2291
+    $headers              = explode("\r\n", $headers_line);
2292
+    foreach ($headers as $header) {
2293
+      if (strpos($header, 'From:') === 0) {
2294
+        $from_header = $header;
2295
+      } elseif (strpos($header, 'To:') === 0) {
2296
+        $to_header = $header;
2298 2297
       }
2299 2298
     }
2300
-    $from     = str_replace('|','=7C',$this->DKIM_QP($from_header));
2301
-    $to       = str_replace('|','=7C',$this->DKIM_QP($to_header));
2302
-    $subject  = str_replace('|','=7C',$this->DKIM_QP($subject_header)) ; // Copied header fields (dkim-quoted-printable
2299
+    $from     = str_replace('|', '=7C', $this->DKIM_QP($from_header));
2300
+    $to       = str_replace('|', '=7C', $this->DKIM_QP($to_header));
2301
+    $subject  = str_replace('|', '=7C', $this->DKIM_QP($subject_header)); // Copied header fields (dkim-quoted-printable
2303 2302
     $body     = $this->DKIM_BodyC($body);
2304
-    $DKIMlen  = strlen($body) ; // Length of body
2305
-    $DKIMb64  = base64_encode(pack("H*", sha1($body))) ; // Base64 of packed binary SHA-1 hash of body
2306
-    $ident    = ($this->DKIM_identity == '')? '' : " i=" . $this->DKIM_identity . ";";
2307
-    $dkimhdrs = "DKIM-Signature: v=1; a=" . $DKIMsignatureType . "; q=" . $DKIMquery . "; l=" . $DKIMlen . "; s=" . $this->DKIM_selector . ";\r\n".
2308
-                "\tt=" . $DKIMtime . "; c=" . $DKIMcanonicalization . ";\r\n".
2303
+    $DKIMlen  = strlen($body); // Length of body
2304
+    $DKIMb64  = base64_encode(pack("H*", sha1($body))); // Base64 of packed binary SHA-1 hash of body
2305
+    $ident    = ($this->DKIM_identity == '') ? '' : " i=".$this->DKIM_identity.";";
2306
+    $dkimhdrs = "DKIM-Signature: v=1; a=".$DKIMsignatureType."; q=".$DKIMquery."; l=".$DKIMlen."; s=".$this->DKIM_selector.";\r\n".
2307
+                "\tt=".$DKIMtime."; c=".$DKIMcanonicalization.";\r\n".
2309 2308
                 "\th=From:To:Subject;\r\n".
2310
-                "\td=" . $this->DKIM_domain . ";" . $ident . "\r\n".
2309
+                "\td=".$this->DKIM_domain.";".$ident."\r\n".
2311 2310
                 "\tz=$from\r\n".
2312 2311
                 "\t|$to\r\n".
2313 2312
                 "\t|$subject;\r\n".
2314
-                "\tbh=" . $DKIMb64 . ";\r\n".
2313
+                "\tbh=".$DKIMb64.";\r\n".
2315 2314
                 "\tb=";
2316
-    $toSign   = $this->DKIM_HeaderC($from_header . "\r\n" . $to_header . "\r\n" . $subject_header . "\r\n" . $dkimhdrs);
2315
+    $toSign   = $this->DKIM_HeaderC($from_header."\r\n".$to_header."\r\n".$subject_header."\r\n".$dkimhdrs);
2317 2316
     $signed   = $this->DKIM_Sign($toSign);
2318 2317
     return "X-PHPMAILER-DKIM: phpmailer.worxware.com\r\n".$dkimhdrs.$signed."\r\n";
2319 2318
   }
2320 2319
 
2321
-  protected function doCallback($isSent,$to,$cc,$bcc,$subject,$body) {
2320
+  protected function doCallback($isSent, $to, $cc, $bcc, $subject, $body) {
2322 2321
     if (!empty($this->action_function) && function_exists($this->action_function)) {
2323
-      $params = array($isSent,$to,$cc,$bcc,$subject,$body);
2324
-      call_user_func_array($this->action_function,$params);
2322
+      $params = array($isSent, $to, $cc, $bcc, $subject, $body);
2323
+      call_user_func_array($this->action_function, $params);
2325 2324
     }
2326 2325
   }
2327 2326
 }
2328 2327
 
2329 2328
 class phpmailerException extends Exception {
2330 2329
   public function errorMessage() {
2331
-    $errorMsg = '<strong>' . $this->getMessage() . "</strong><br />\n";
2330
+    $errorMsg = '<strong>'.$this->getMessage()."</strong><br />\n";
2332 2331
     return $errorMsg;
2333 2332
   }
2334 2333
 }
Please login to merge, or discard this patch.
main/inc/lib/chat.lib.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
         $to_user_id,
187 187
         $message,
188 188
         $printResult = true,
189
-        $sanitize =  true
189
+        $sanitize = true
190 190
     )
191 191
     {
192 192
         $user_friend_relation = SocialManager::get_relation_between_contacts(
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
                 $messagesan = $message;
207 207
             }
208 208
 
209
-            error_log(print_r($sanitize) . '----' . $messagesan);
209
+            error_log(print_r($sanitize).'----'.$messagesan);
210 210
 
211 211
             if (!isset($_SESSION['chatHistory'][$to_user_id])) {
212 212
                 $_SESSION['chatHistory'][$to_user_id] = array();
@@ -289,9 +289,9 @@  discard block
 block discarded – undo
289 289
      */
290 290
     public static function disableChat()
291 291
     {
292
-        if (!empty($_SESSION['disable_chat'])){
292
+        if (!empty($_SESSION['disable_chat'])) {
293 293
             $status = $_SESSION['disable_chat'];
294
-            if ($status == true){
294
+            if ($status == true) {
295 295
                 $_SESSION['disable_chat'] = null;
296 296
                 return true;
297 297
             }
Please login to merge, or discard this patch.
main/inc/lib/array.lib.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -110,10 +110,10 @@  discard block
 block discarded – undo
110 110
 {
111 111
 	$old_locale = setlocale(LC_ALL, null);
112 112
 	$code = api_get_language_isocode();
113
-	$locale_list = array($code.'.utf8', 'en.utf8','en_US.utf8','en_GB.utf8');
113
+	$locale_list = array($code.'.utf8', 'en.utf8', 'en_US.utf8', 'en_GB.utf8');
114 114
 	$try_sort = false;
115 115
 
116
-	foreach($locale_list as $locale) {
116
+	foreach ($locale_list as $locale) {
117 117
 		$my_local = setlocale(LC_COLLATE, $locale);
118 118
 		if ($my_local) {
119 119
 			$try_sort = true;
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
     $flatten = array();
152 152
     array_walk_recursive(
153 153
         $array,
154
-        function ($value) use (&$flatten) {
154
+        function($value) use (&$flatten) {
155 155
             $flatten[] = $value;
156 156
         }
157 157
     );
Please login to merge, or discard this patch.
main/inc/lib/surveymanager.lib.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
     {
20 20
         // Database table definitions
21 21
         $table_survey = Database :: get_course_table(TABLE_SURVEY);
22
-        $table_survey_question 	= Database :: get_course_table(TABLE_SURVEY_QUESTION);
22
+        $table_survey_question = Database :: get_course_table(TABLE_SURVEY_QUESTION);
23 23
         $table_user = Database :: get_main_table(TABLE_MAIN_USER);
24 24
 
25 25
         // searching
@@ -45,23 +45,23 @@  discard block
 block discarded – undo
45 45
 				GROUP BY survey.survey_id";
46 46
 
47 47
         $res = Database::query($sql);
48
-        $surveys_parents = array ();
48
+        $surveys_parents = array();
49 49
         $refs = array();
50 50
         $list = array();
51
-        $plain_array=array();
51
+        $plain_array = array();
52 52
 
53
-        while ($survey = Database::fetch_array($res,'ASSOC')) {
54
-            $plain_array[$survey['survey_id']]=$survey;
55
-            $surveys_parents[]=$survey['survey_version'];
56
-            $thisref = &$refs[ $survey['survey_id'] ];
53
+        while ($survey = Database::fetch_array($res, 'ASSOC')) {
54
+            $plain_array[$survey['survey_id']] = $survey;
55
+            $surveys_parents[] = $survey['survey_version'];
56
+            $thisref = &$refs[$survey['survey_id']];
57 57
             $thisref['parent_id'] = $survey['parent_id'];
58 58
             $thisref['name'] = $survey['name'];
59 59
             $thisref['id'] = $survey['survey_id'];
60 60
             $thisref['survey_version'] = $survey['survey_version'];
61 61
             if ($survey['parent_id'] == 0) {
62
-                $list[ $survey['survey_id'] ] = &$thisref;
62
+                $list[$survey['survey_id']] = &$thisref;
63 63
             } else {
64
-                $refs[ $survey['parent_id'] ]['children'][ $survey['survey_id'] ] = &$thisref;
64
+                $refs[$survey['parent_id']]['children'][$survey['survey_id']] = &$thisref;
65 65
             }
66 66
         }
67 67
         $this->surveylist = $list;
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
     public function getParentId($id)
81 81
     {
82 82
         $node = $this->plainsurveylist[$id];
83
-        if (is_array($node)&& !empty($node['parent_id'])) {
83
+        if (is_array($node) && !empty($node['parent_id'])) {
84 84
             return $node['parent_id'];
85 85
         } else {
86 86
             return -1;
@@ -100,12 +100,12 @@  discard block
 block discarded – undo
100 100
         if (is_array($list)) {
101 101
             foreach ($list as $key => $node) {
102 102
                 if (isset($node['children']) && is_array($node['children'])) {
103
-                    $result[$key]= $node['name'];
103
+                    $result[$key] = $node['name'];
104 104
                     $re = self::createList($node['children']);
105 105
                     if (!empty($re)) {
106 106
                         if (is_array($re)) {
107 107
                             foreach ($re as $key => $r) {
108
-                                $result[$key] = '' . $r;
108
+                                $result[$key] = ''.$r;
109 109
                             }
110 110
                         } else {
111 111
                             $result[] = $re;
Please login to merge, or discard this patch.
main/inc/lib/notebook.lib.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
         return "<script>
30 30
 				function confirmation (name)
31 31
 				{
32
-					if (confirm(\" " . get_lang("NoteConfirmDelete") . " \"+ name + \" ?\"))
32
+					if (confirm(\" " . get_lang("NoteConfirmDelete")." \"+ name + \" ?\"))
33 33
 						{return true;}
34 34
 					else
35 35
 						{return false;}
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
                 description 		AS note_comment,
108 108
                 session_id			AS session_id
109 109
                FROM $t_notebook
110
-               WHERE c_id = $course_id AND notebook_id = '" . intval($notebook_id) . "' ";
110
+               WHERE c_id = $course_id AND notebook_id = '".intval($notebook_id)."' ";
111 111
         $result = Database::query($sql);
112 112
         if (Database::num_rows($result) != 1) {
113 113
             return array();
@@ -181,8 +181,8 @@  discard block
 block discarded – undo
181 181
         $sql = "DELETE FROM $t_notebook
182 182
                 WHERE
183 183
                     c_id = $course_id AND
184
-                    notebook_id='" . intval($notebook_id) . "' AND
185
-                    user_id = '" . api_get_user_id() . "'";
184
+                    notebook_id='".intval($notebook_id)."' AND
185
+                    user_id = '" . api_get_user_id()."'";
186 186
         $result = Database::query($sql);
187 187
         $affected_rows = Database::affected_rows($result);
188 188
         if ($affected_rows != 1) {
@@ -220,22 +220,22 @@  discard block
 block discarded – undo
220 220
         echo '<div class="actions">';
221 221
         if (!api_is_anonymous()) {
222 222
             if (api_get_session_id() == 0)
223
-                echo '<a href="index.php?' . api_get_cidreq() . '&action=addnote">' .
224
-                    Display::return_icon('new_note.png', get_lang('NoteAddNew'), '', '32') . '</a>';
223
+                echo '<a href="index.php?'.api_get_cidreq().'&action=addnote">'.
224
+                    Display::return_icon('new_note.png', get_lang('NoteAddNew'), '', '32').'</a>';
225 225
             elseif (api_is_allowed_to_session_edit(false, true)) {
226
-                echo '<a href="index.php?' . api_get_cidreq() . '&action=addnote">' .
227
-                    Display::return_icon('new_note.png', get_lang('NoteAddNew'), '', '32') . '</a>';
226
+                echo '<a href="index.php?'.api_get_cidreq().'&action=addnote">'.
227
+                    Display::return_icon('new_note.png', get_lang('NoteAddNew'), '', '32').'</a>';
228 228
             }
229 229
         } else {
230
-            echo '<a href="javascript:void(0)">' . Display::return_icon('new_note.png', get_lang('NoteAddNew'), '', '32') . '</a>';
230
+            echo '<a href="javascript:void(0)">'.Display::return_icon('new_note.png', get_lang('NoteAddNew'), '', '32').'</a>';
231 231
         }
232 232
 
233
-        echo '<a href="index.php?' . api_get_cidreq() . '&action=changeview&view=creation_date&direction=' . $link_sort_direction . '">' .
234
-            Display::return_icon('notes_order_by_date_new.png', get_lang('OrderByCreationDate'), '', '32') . '</a>';
235
-        echo '<a href="index.php?' . api_get_cidreq() . '&action=changeview&view=update_date&direction=' . $link_sort_direction . '">' .
236
-            Display::return_icon('notes_order_by_date_mod.png', get_lang('OrderByModificationDate'), '', '32') . '</a>';
237
-        echo '<a href="index.php?' . api_get_cidreq() . '&action=changeview&view=title&direction=' . $link_sort_direction . '">' .
238
-            Display::return_icon('notes_order_by_title.png', get_lang('OrderByTitle'), '', '32') . '</a>';
233
+        echo '<a href="index.php?'.api_get_cidreq().'&action=changeview&view=creation_date&direction='.$link_sort_direction.'">'.
234
+            Display::return_icon('notes_order_by_date_new.png', get_lang('OrderByCreationDate'), '', '32').'</a>';
235
+        echo '<a href="index.php?'.api_get_cidreq().'&action=changeview&view=update_date&direction='.$link_sort_direction.'">'.
236
+            Display::return_icon('notes_order_by_date_mod.png', get_lang('OrderByModificationDate'), '', '32').'</a>';
237
+        echo '<a href="index.php?'.api_get_cidreq().'&action=changeview&view=title&direction='.$link_sort_direction.'">'.
238
+            Display::return_icon('notes_order_by_title.png', get_lang('OrderByTitle'), '', '32').'</a>';
239 239
         echo '</div>';
240 240
 
241 241
         if (!isset($_SESSION['notebook_view']) || !in_array($_SESSION['notebook_view'], array('creation_date', 'update_date', 'title'))) {
@@ -246,9 +246,9 @@  discard block
 block discarded – undo
246 246
         $t_notebook = Database :: get_course_table(TABLE_NOTEBOOK);
247 247
         $order_by = "";
248 248
         if ($_SESSION['notebook_view'] == 'creation_date' || $_SESSION['notebook_view'] == 'update_date') {
249
-            $order_by = " ORDER BY " . $_SESSION['notebook_view'] . " $sort_direction ";
249
+            $order_by = " ORDER BY ".$_SESSION['notebook_view']." $sort_direction ";
250 250
         } else {
251
-            $order_by = " ORDER BY " . $_SESSION['notebook_view'] . " $sort_direction ";
251
+            $order_by = " ORDER BY ".$_SESSION['notebook_view']." $sort_direction ";
252 252
         }
253 253
 
254 254
         //condition for the session
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
         $sql = "SELECT * FROM $t_notebook
262 262
                 WHERE
263 263
                     c_id = $course_id AND
264
-                    user_id = '" . api_get_user_id() . "'
264
+                    user_id = '".api_get_user_id()."'
265 265
                     $condition_session
266 266
                     $cond_extra $order_by
267 267
                 ";
@@ -274,18 +274,18 @@  discard block
 block discarded – undo
274 274
 
275 275
             $updateValue = '';
276 276
             if ($row['update_date'] <> $row['creation_date']) {
277
-                $updateValue = ', ' . get_lang('UpdateDate') . ': ' . date_to_str_ago($update_date) . '&nbsp;&nbsp;<span class="dropbox_date">' . $update_date . '</span>';
277
+                $updateValue = ', '.get_lang('UpdateDate').': '.date_to_str_ago($update_date).'&nbsp;&nbsp;<span class="dropbox_date">'.$update_date.'</span>';
278 278
             }
279 279
 
280
-            $actions = '<a href="' . api_get_self() . '?action=editnote&notebook_id=' . $row['notebook_id'] . '">' .
281
-                Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL) . '</a>';
282
-            $actions .= '<a href="' . api_get_self() . '?action=deletenote&notebook_id=' . $row['notebook_id'] . '" onclick="return confirmation(\'' . $row['title'] . '\');">' .
283
-                Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL) . '</a>';
280
+            $actions = '<a href="'.api_get_self().'?action=editnote&notebook_id='.$row['notebook_id'].'">'.
281
+                Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>';
282
+            $actions .= '<a href="'.api_get_self().'?action=deletenote&notebook_id='.$row['notebook_id'].'" onclick="return confirmation(\''.$row['title'].'\');">'.
283
+                Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>';
284 284
 
285 285
             echo Display::panel(
286 286
                 $row['description'],
287
-                $row['title'] . $session_img.' <div class="pull-right">'.$actions.'</div>',
288
-                get_lang('CreationDate') . ': ' . date_to_str_ago($creation_date) . '&nbsp;&nbsp;<span class="dropbox_date">' . $creation_date . $updateValue."</span>"
287
+                $row['title'].$session_img.' <div class="pull-right">'.$actions.'</div>',
288
+                get_lang('CreationDate').': '.date_to_str_ago($creation_date).'&nbsp;&nbsp;<span class="dropbox_date">'.$creation_date.$updateValue."</span>"
289 289
             );
290 290
         }
291 291
     }
Please login to merge, or discard this patch.
main/inc/lib/legal.lib.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
             Database::insert($legal_table, $params);
45 45
 
46 46
             return true;
47
-        } elseif($last['type'] != $type && $language==$last['language_id']) {
47
+        } elseif ($last['type'] != $type && $language == $last['language_id']) {
48 48
             //update
49 49
             $id = $last['legal_id'];
50 50
             $params = [
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 	public static function get_last_condition_version($language)
78 78
     {
79 79
 		$legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL);
80
-		$language= Database::escape_string($language);
80
+		$language = Database::escape_string($language);
81 81
 		$sql = "SELECT version FROM $legal_conditions_table
82 82
 		        WHERE language_id = '".$language."'
83 83
 		        ORDER BY legal_id DESC LIMIT 1 ";
@@ -97,10 +97,10 @@  discard block
 block discarded – undo
97 97
 	 * @param int $language language id
98 98
 	 * @return array all the info of a Term and condition
99 99
 	 */
100
-	public static function get_last_condition ($language)
100
+	public static function get_last_condition($language)
101 101
     {
102 102
 		$legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL);
103
-		$language= Database::escape_string($language);
103
+		$language = Database::escape_string($language);
104 104
 		$sql = "SELECT * FROM $legal_conditions_table
105 105
                 WHERE language_id = '".$language."'
106 106
                 ORDER BY version DESC
@@ -124,9 +124,9 @@  discard block
 block discarded – undo
124 124
                 ORDER BY version DESC
125 125
                 LIMIT 1 ";
126 126
         $result = Database::query($sql);
127
-        if (Database::num_rows($result)>0){
127
+        if (Database::num_rows($result) > 0) {
128 128
             $version = Database::fetch_array($result);
129
-            $version = explode(':',$version[0]);
129
+            $version = explode(':', $version[0]);
130 130
 
131 131
             return $version[0];
132 132
         } else {
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
                 break;
154 154
                 // Page link
155 155
             case 1:
156
-                $preview ='<fieldset>
156
+                $preview = '<fieldset>
157 157
                              <legend>'.get_lang('TermsAndConditions').'</legend>';
158 158
                 $preview .= '<div id="legal-accept-wrapper" class="form-item">
159 159
                 <label class="option" for="legal-accept">
@@ -185,25 +185,25 @@  discard block
 block discarded – undo
185 185
 		$number_of_items = intval($number_of_items);
186 186
 		$column = intval($column);
187 187
 
188
- 		$sql  = "SELECT version, original_name as language, content, changes, type, FROM_UNIXTIME(date)
188
+ 		$sql = "SELECT version, original_name as language, content, changes, type, FROM_UNIXTIME(date)
189 189
 				FROM $legal_conditions_table inner join $lang_table l on(language_id = l.id) ";
190 190
 		$sql .= "ORDER BY language, version ASC ";
191 191
 		$sql .= "LIMIT $from, $number_of_items ";
192 192
 
193 193
 		$result = Database::query($sql);
194
-		$legals = array ();
195
-		$versions = array ();
194
+		$legals = array();
195
+		$versions = array();
196 196
 		while ($legal = Database::fetch_array($result)) {
197 197
 			// max 2000 chars
198 198
 			//echo strlen($legal[1]); echo '<br>';
199
-			$versions[]=$legal[0];
200
-			$languages[]=$legal[1];
201
-			if (strlen($legal[2])>2000)
202
-				$legal[2]= substr($legal[2],0,2000).' ... ';
203
-			if ($legal[4]==0)
204
-				$legal[4]= get_lang('HTMLText');
205
-			elseif($legal[4]==1)
206
-				$legal[4]=get_lang('PageLink');
199
+			$versions[] = $legal[0];
200
+			$languages[] = $legal[1];
201
+			if (strlen($legal[2]) > 2000)
202
+				$legal[2] = substr($legal[2], 0, 2000).' ... ';
203
+			if ($legal[4] == 0)
204
+				$legal[4] = get_lang('HTMLText');
205
+			elseif ($legal[4] == 1)
206
+				$legal[4] = get_lang('PageLink');
207 207
 			$legals[] = $legal;
208 208
 		}
209 209
 		return $legals;
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 		        FROM $legal_conditions_table
221 221
 		        ORDER BY legal_id DESC ";
222 222
 		$result = Database::query($sql);
223
-		$url = Database::fetch_array($result,'ASSOC');
223
+		$url = Database::fetch_array($result, 'ASSOC');
224 224
 		$result = $url['count_result'];
225 225
 
226 226
 		return $result;
@@ -241,6 +241,6 @@  discard block
 block discarded – undo
241 241
 		        WHERE legal_id="'.$legal_id.'" AND language_id="'.$language_id.'"';
242 242
 		$rs = Database::query($sql);
243 243
 
244
-		return Database::result($rs,0,'type');
244
+		return Database::result($rs, 0, 'type');
245 245
 	}
246 246
 }
Please login to merge, or discard this patch.