Completed
Push — develop ( 351294...7e4f1d )
by Dmytro
10:56 queued 05:03
created
manager/includes/controls/phpmailer/PHPMailer.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3968,7 +3968,7 @@
 block discarded – undo
3968 3968
      * @param int|string $options Either a PATHINFO_* constant,
3969 3969
      *                            or a string name to return only the specified piece
3970 3970
      *
3971
-     * @return string|array
3971
+     * @return string
3972 3972
      */
3973 3973
     public static function mb_pathinfo($path, $options = null)
3974 3974
     {
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2059,7 +2059,8 @@  discard block
 block discarded – undo
2059 2059
      */
2060 2060
     public function addrFormat($addr)
2061 2061
     {
2062
-        if (empty($addr[1])) { // No name provided
2062
+        if (empty($addr[1])) {
2063
+// No name provided
2063 2064
             return $this->secureHeader($addr[0]);
2064 2065
         }
2065 2066
 
@@ -3425,7 +3426,7 @@  discard block
 block discarded – undo
3425 3426
     {
3426 3427
         $this->RecipientsQueue = array_filter(
3427 3428
             $this->RecipientsQueue,
3428
-            function ($params) use ($kind) {
3429
+            function ($params) use ($kind){
3429 3430
                 return $params[0] != $kind;
3430 3431
             }
3431 3432
         );
Please login to merge, or discard this patch.
Spacing   +135 added lines, -136 removed lines patch added patch discarded remove patch
@@ -1076,10 +1076,10 @@  discard block
 block discarded – undo
1076 1076
             $list = imap_rfc822_parse_adrlist($addrstr, '');
1077 1077
             foreach ($list as $address) {
1078 1078
                 if ('.SYNTAX-ERROR.' != $address->host) {
1079
-                    if (static::validateAddress($address->mailbox . '@' . $address->host)) {
1079
+                    if (static::validateAddress($address->mailbox.'@'.$address->host)) {
1080 1080
                         $addresses[] = array(
1081 1081
                             'name' => (property_exists($address, 'personal') ? $address->personal : ''),
1082
-                            'address' => $address->mailbox . '@' . $address->host,
1082
+                            'address' => $address->mailbox.'@'.$address->host,
1083 1083
                         );
1084 1084
                     }
1085 1085
                 }
@@ -1225,14 +1225,14 @@  discard block
 block discarded – undo
1225 1225
                  * Feel free to use and redistribute this code. But please keep this copyright notice.
1226 1226
                  */
1227 1227
                 return (bool) preg_match(
1228
-                    '/^(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){255,})(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){65,}@)' .
1229
-                    '((?>(?>(?>((?>(?>(?>\x0D\x0A)?[\t ])+|(?>[\t ]*\x0D\x0A)?[\t ]+)?)(\((?>(?2)' .
1230
-                    '(?>[\x01-\x08\x0B\x0C\x0E-\'*-\[\]-\x7F]|\\\[\x00-\x7F]|(?3)))*(?2)\)))+(?2))|(?2))?)' .
1231
-                    '([!#-\'*+\/-9=?^-~-]+|"(?>(?2)(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\x7F]))*' .
1232
-                    '(?2)")(?>(?1)\.(?1)(?4))*(?1)@(?!(?1)[a-z0-9-]{64,})(?1)(?>([a-z0-9](?>[a-z0-9-]*[a-z0-9])?)' .
1233
-                    '(?>(?1)\.(?!(?1)[a-z0-9-]{64,})(?1)(?5)){0,126}|\[(?:(?>IPv6:(?>([a-f0-9]{1,4})(?>:(?6)){7}' .
1234
-                    '|(?!(?:.*[a-f0-9][:\]]){8,})((?6)(?>:(?6)){0,6})?::(?7)?))|(?>(?>IPv6:(?>(?6)(?>:(?6)){5}:' .
1235
-                    '|(?!(?:.*[a-f0-9]:){6,})(?8)?::(?>((?6)(?>:(?6)){0,4}):)?))?(25[0-5]|2[0-4][0-9]|1[0-9]{2}' .
1228
+                    '/^(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){255,})(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){65,}@)'.
1229
+                    '((?>(?>(?>((?>(?>(?>\x0D\x0A)?[\t ])+|(?>[\t ]*\x0D\x0A)?[\t ]+)?)(\((?>(?2)'.
1230
+                    '(?>[\x01-\x08\x0B\x0C\x0E-\'*-\[\]-\x7F]|\\\[\x00-\x7F]|(?3)))*(?2)\)))+(?2))|(?2))?)'.
1231
+                    '([!#-\'*+\/-9=?^-~-]+|"(?>(?2)(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\x7F]))*'.
1232
+                    '(?2)")(?>(?1)\.(?1)(?4))*(?1)@(?!(?1)[a-z0-9-]{64,})(?1)(?>([a-z0-9](?>[a-z0-9-]*[a-z0-9])?)'.
1233
+                    '(?>(?1)\.(?!(?1)[a-z0-9-]{64,})(?1)(?5)){0,126}|\[(?:(?>IPv6:(?>([a-f0-9]{1,4})(?>:(?6)){7}'.
1234
+                    '|(?!(?:.*[a-f0-9][:\]]){8,})((?6)(?>:(?6)){0,6})?::(?7)?))|(?>(?>IPv6:(?>(?6)(?>:(?6)){5}:'.
1235
+                    '|(?!(?:.*[a-f0-9]:){6,})(?8)?::(?>((?6)(?>:(?6)){0,4}):)?))?(25[0-5]|2[0-4][0-9]|1[0-9]{2}'.
1236 1236
                     '|[1-9]?[0-9])(?>\.(?9)){3}))\])(?1)$/isD',
1237 1237
                     $address
1238 1238
                 );
@@ -1243,7 +1243,7 @@  discard block
 block discarded – undo
1243 1243
                  * @see http://www.whatwg.org/specs/web-apps/current-work/#e-mail-state-(type=email)
1244 1244
                  */
1245 1245
                 return (bool) preg_match(
1246
-                    '/^[a-zA-Z0-9.!#$%&\'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}' .
1246
+                    '/^[a-zA-Z0-9.!#$%&\'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}'.
1247 1247
                     '[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/sD',
1248 1248
                     $address
1249 1249
                 );
@@ -1294,7 +1294,7 @@  discard block
 block discarded – undo
1294 1294
                 $errorcode = 0;
1295 1295
                 $punycode = idn_to_ascii($domain, $errorcode, INTL_IDNA_VARIANT_UTS46);
1296 1296
                 if (false !== $punycode) {
1297
-                    return substr($address, 0, $pos) . $punycode;
1297
+                    return substr($address, 0, $pos).$punycode;
1298 1298
                 }
1299 1299
             }
1300 1300
         }
@@ -1358,8 +1358,8 @@  discard block
 block discarded – undo
1358 1358
                     and version_compare(PHP_VERSION, '7.1.3', '<')))
1359 1359
         ) {
1360 1360
             trigger_error(
1361
-                'Your version of PHP is affected by a bug that may result in corrupted messages.' .
1362
-                ' To fix it, switch to sending using SMTP, disable the mail.add_x_header option in' .
1361
+                'Your version of PHP is affected by a bug that may result in corrupted messages.'.
1362
+                ' To fix it, switch to sending using SMTP, disable the mail.add_x_header option in'.
1363 1363
                 ' your php.ini, switch to MacOS or Linux, or upgrade your PHP to version 7.0.17+ or 7.1.3+.',
1364 1364
                 E_USER_WARNING
1365 1365
             );
@@ -1443,12 +1443,12 @@  discard block
 block discarded – undo
1443 1443
                 )
1444 1444
             ) {
1445 1445
                 $header_dkim = $this->DKIM_Add(
1446
-                    $this->MIMEHeader . $this->mailHeader,
1446
+                    $this->MIMEHeader.$this->mailHeader,
1447 1447
                     $this->encodeHeader($this->secureHeader($this->Subject)),
1448 1448
                     $this->MIMEBody
1449 1449
                 );
1450
-                $this->MIMEHeader = rtrim($this->MIMEHeader, "\r\n ") . static::$LE .
1451
-                    static::normalizeBreaks($header_dkim) . static::$LE;
1450
+                $this->MIMEHeader = rtrim($this->MIMEHeader, "\r\n ").static::$LE.
1451
+                    static::normalizeBreaks($header_dkim).static::$LE;
1452 1452
             }
1453 1453
 
1454 1454
             return true;
@@ -1482,7 +1482,7 @@  discard block
 block discarded – undo
1482 1482
                 case 'mail':
1483 1483
                     return $this->mailSend($this->MIMEHeader, $this->MIMEBody);
1484 1484
                 default:
1485
-                    $sendMethod = $this->Mailer . 'Send';
1485
+                    $sendMethod = $this->Mailer.'Send';
1486 1486
                     if (method_exists($this, $sendMethod)) {
1487 1487
                         return $this->$sendMethod($this->MIMEHeader, $this->MIMEBody);
1488 1488
                     }
@@ -1535,9 +1535,9 @@  discard block
 block discarded – undo
1535 1535
             foreach ($this->SingleToArray as $toAddr) {
1536 1536
                 $mail = @popen($sendmail, 'w');
1537 1537
                 if (!$mail) {
1538
-                    throw new Exception($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
1538
+                    throw new Exception($this->lang('execute').$this->Sendmail, self::STOP_CRITICAL);
1539 1539
                 }
1540
-                fwrite($mail, 'To: ' . $toAddr . "\n");
1540
+                fwrite($mail, 'To: '.$toAddr."\n");
1541 1541
                 fwrite($mail, $header);
1542 1542
                 fwrite($mail, $body);
1543 1543
                 $result = pclose($mail);
@@ -1552,13 +1552,13 @@  discard block
 block discarded – undo
1552 1552
                     array()
1553 1553
                 );
1554 1554
                 if (0 !== $result) {
1555
-                    throw new Exception($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
1555
+                    throw new Exception($this->lang('execute').$this->Sendmail, self::STOP_CRITICAL);
1556 1556
                 }
1557 1557
             }
1558 1558
         } else {
1559 1559
             $mail = @popen($sendmail, 'w');
1560 1560
             if (!$mail) {
1561
-                throw new Exception($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
1561
+                throw new Exception($this->lang('execute').$this->Sendmail, self::STOP_CRITICAL);
1562 1562
             }
1563 1563
             fwrite($mail, $header);
1564 1564
             fwrite($mail, $body);
@@ -1574,7 +1574,7 @@  discard block
 block discarded – undo
1574 1574
                 array()
1575 1575
             );
1576 1576
             if (0 !== $result) {
1577
-                throw new Exception($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
1577
+                throw new Exception($this->lang('execute').$this->Sendmail, self::STOP_CRITICAL);
1578 1578
             }
1579 1579
         }
1580 1580
 
@@ -1732,7 +1732,7 @@  discard block
 block discarded – undo
1732 1732
             $smtp_from = $this->Sender;
1733 1733
         }
1734 1734
         if (!$this->smtp->mail($smtp_from)) {
1735
-            $this->setError($this->lang('from_failed') . $smtp_from . ' : ' . implode(',', $this->smtp->getError()));
1735
+            $this->setError($this->lang('from_failed').$smtp_from.' : '.implode(',', $this->smtp->getError()));
1736 1736
             throw new Exception($this->ErrorInfo, self::STOP_CRITICAL);
1737 1737
         }
1738 1738
 
@@ -1753,7 +1753,7 @@  discard block
 block discarded – undo
1753 1753
         }
1754 1754
 
1755 1755
         // Only send the DATA command if we have viable recipients
1756
-        if ((count($this->all_recipients) > count($bad_rcpt)) and !$this->smtp->data($header . $body)) {
1756
+        if ((count($this->all_recipients) > count($bad_rcpt)) and !$this->smtp->data($header.$body)) {
1757 1757
             throw new Exception($this->lang('data_not_accepted'), self::STOP_CRITICAL);
1758 1758
         }
1759 1759
 
@@ -1783,10 +1783,10 @@  discard block
 block discarded – undo
1783 1783
         if (count($bad_rcpt) > 0) {
1784 1784
             $errstr = '';
1785 1785
             foreach ($bad_rcpt as $bad) {
1786
-                $errstr .= $bad['to'] . ': ' . $bad['error'];
1786
+                $errstr .= $bad['to'].': '.$bad['error'];
1787 1787
             }
1788 1788
             throw new Exception(
1789
-                $this->lang('recipients_failed') . $errstr,
1789
+                $this->lang('recipients_failed').$errstr,
1790 1790
                 self::STOP_CONTINUE
1791 1791
             );
1792 1792
         }
@@ -1836,7 +1836,7 @@  discard block
 block discarded – undo
1836 1836
                 trim($hostentry),
1837 1837
                 $hostinfo
1838 1838
             )) {
1839
-                static::edebug($this->lang('connect_host') . ' ' . $hostentry);
1839
+                static::edebug($this->lang('connect_host').' '.$hostentry);
1840 1840
                 // Not a valid host entry
1841 1841
                 continue;
1842 1842
             }
@@ -1848,7 +1848,7 @@  discard block
 block discarded – undo
1848 1848
 
1849 1849
             //Check the host name is a valid name or IP address before trying to use it
1850 1850
             if (!static::isValidHost($hostinfo[3])) {
1851
-                static::edebug($this->lang('connect_host') . ' ' . $hostentry);
1851
+                static::edebug($this->lang('connect_host').' '.$hostentry);
1852 1852
                 continue;
1853 1853
             }
1854 1854
             $prefix = '';
@@ -1868,7 +1868,7 @@  discard block
 block discarded – undo
1868 1868
             if ('tls' === $secure or 'ssl' === $secure) {
1869 1869
                 //Check for an OpenSSL constant rather than using extension_loaded, which is sometimes disabled
1870 1870
                 if (!$sslext) {
1871
-                    throw new Exception($this->lang('extension_missing') . 'openssl', self::STOP_CRITICAL);
1871
+                    throw new Exception($this->lang('extension_missing').'openssl', self::STOP_CRITICAL);
1872 1872
                 }
1873 1873
             }
1874 1874
             $host = $hostinfo[3];
@@ -1877,7 +1877,7 @@  discard block
 block discarded – undo
1877 1877
             if ($tport > 0 and $tport < 65536) {
1878 1878
                 $port = $tport;
1879 1879
             }
1880
-            if ($this->smtp->connect($prefix . $host, $port, $this->Timeout, $options)) {
1880
+            if ($this->smtp->connect($prefix.$host, $port, $this->Timeout, $options)) {
1881 1881
                 try {
1882 1882
                     if ($this->Helo) {
1883 1883
                         $hello = $this->Helo;
@@ -1994,14 +1994,14 @@  discard block
 block discarded – undo
1994 1994
         );
1995 1995
         if (empty($lang_path)) {
1996 1996
             // Calculate an absolute path so it can work if CWD is not here
1997
-            $lang_path = __DIR__ . DIRECTORY_SEPARATOR . 'language' . DIRECTORY_SEPARATOR;
1997
+            $lang_path = __DIR__.DIRECTORY_SEPARATOR.'language'.DIRECTORY_SEPARATOR;
1998 1998
         }
1999 1999
         //Validate $langcode
2000 2000
         if (!preg_match('/^[a-z]{2}(?:_[a-zA-Z]{2})?$/', $langcode)) {
2001 2001
             $langcode = 'en';
2002 2002
         }
2003 2003
         $foundlang = true;
2004
-        $lang_file = $lang_path . 'phpmailer.lang-' . $langcode . '.php';
2004
+        $lang_file = $lang_path.'phpmailer.lang-'.$langcode.'.php';
2005 2005
         // There is no English translation file
2006 2006
         if ('en' != $langcode) {
2007 2007
             // Make sure language file path is readable
@@ -2046,7 +2046,7 @@  discard block
 block discarded – undo
2046 2046
             $addresses[] = $this->addrFormat($address);
2047 2047
         }
2048 2048
 
2049
-        return $type . ': ' . implode(', ', $addresses) . static::$LE;
2049
+        return $type.': '.implode(', ', $addresses).static::$LE;
2050 2050
     }
2051 2051
 
2052 2052
     /**
@@ -2063,9 +2063,9 @@  discard block
 block discarded – undo
2063 2063
             return $this->secureHeader($addr[0]);
2064 2064
         }
2065 2065
 
2066
-        return $this->encodeHeader($this->secureHeader($addr[1]), 'phrase') . ' <' . $this->secureHeader(
2066
+        return $this->encodeHeader($this->secureHeader($addr[1]), 'phrase').' <'.$this->secureHeader(
2067 2067
                 $addr[0]
2068
-            ) . '>';
2068
+            ).'>';
2069 2069
     }
2070 2070
 
2071 2071
     /**
@@ -2122,10 +2122,10 @@  discard block
 block discarded – undo
2122 2122
                             }
2123 2123
                             $part = substr($word, 0, $len);
2124 2124
                             $word = substr($word, $len);
2125
-                            $buf .= ' ' . $part;
2126
-                            $message .= $buf . sprintf('=%s', static::$LE);
2125
+                            $buf .= ' '.$part;
2126
+                            $message .= $buf.sprintf('=%s', static::$LE);
2127 2127
                         } else {
2128
-                            $message .= $buf . $soft_break;
2128
+                            $message .= $buf.$soft_break;
2129 2129
                         }
2130 2130
                         $buf = '';
2131 2131
                     }
@@ -2145,7 +2145,7 @@  discard block
 block discarded – undo
2145 2145
                         $word = substr($word, $len);
2146 2146
 
2147 2147
                         if (strlen($word) > 0) {
2148
-                            $message .= $part . sprintf('=%s', static::$LE);
2148
+                            $message .= $part.sprintf('=%s', static::$LE);
2149 2149
                         } else {
2150 2150
                             $buf = $part;
2151 2151
                         }
@@ -2158,13 +2158,13 @@  discard block
 block discarded – undo
2158 2158
                     $buf .= $word;
2159 2159
 
2160 2160
                     if (strlen($buf) > $length and '' != $buf_o) {
2161
-                        $message .= $buf_o . $soft_break;
2161
+                        $message .= $buf_o.$soft_break;
2162 2162
                         $buf = $word;
2163 2163
                     }
2164 2164
                 }
2165 2165
                 $firstword = false;
2166 2166
             }
2167
-            $message .= $buf . static::$LE;
2167
+            $message .= $buf.static::$LE;
2168 2168
         }
2169 2169
 
2170 2170
         return $message;
@@ -2310,7 +2310,7 @@  discard block
 block discarded – undo
2310 2310
         if ('' == $this->XMailer) {
2311 2311
             $result .= $this->headerLine(
2312 2312
                 'X-Mailer',
2313
-                'PHPMailer ' . self::VERSION . ' (https://github.com/PHPMailer/PHPMailer)'
2313
+                'PHPMailer '.self::VERSION.' (https://github.com/PHPMailer/PHPMailer)'
2314 2314
             );
2315 2315
         } else {
2316 2316
             $myXmailer = trim($this->XMailer);
@@ -2320,7 +2320,7 @@  discard block
 block discarded – undo
2320 2320
         }
2321 2321
 
2322 2322
         if ('' != $this->ConfirmReadingTo) {
2323
-            $result .= $this->headerLine('Disposition-Notification-To', '<' . $this->ConfirmReadingTo . '>');
2323
+            $result .= $this->headerLine('Disposition-Notification-To', '<'.$this->ConfirmReadingTo.'>');
2324 2324
         }
2325 2325
 
2326 2326
         // Add custom headers
@@ -2350,23 +2350,23 @@  discard block
 block discarded – undo
2350 2350
         switch ($this->message_type) {
2351 2351
             case 'inline':
2352 2352
                 $result .= $this->headerLine('Content-Type', 'multipart/related;');
2353
-                $result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"');
2353
+                $result .= $this->textLine("\tboundary=\"".$this->boundary[1].'"');
2354 2354
                 break;
2355 2355
             case 'attach':
2356 2356
             case 'inline_attach':
2357 2357
             case 'alt_attach':
2358 2358
             case 'alt_inline_attach':
2359 2359
                 $result .= $this->headerLine('Content-Type', 'multipart/mixed;');
2360
-                $result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"');
2360
+                $result .= $this->textLine("\tboundary=\"".$this->boundary[1].'"');
2361 2361
                 break;
2362 2362
             case 'alt':
2363 2363
             case 'alt_inline':
2364 2364
                 $result .= $this->headerLine('Content-Type', 'multipart/alternative;');
2365
-                $result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"');
2365
+                $result .= $this->textLine("\tboundary=\"".$this->boundary[1].'"');
2366 2366
                 break;
2367 2367
             default:
2368 2368
                 // Catches case 'plain': and case '':
2369
-                $result .= $this->textLine('Content-Type: ' . $this->ContentType . '; charset=' . $this->CharSet);
2369
+                $result .= $this->textLine('Content-Type: '.$this->ContentType.'; charset='.$this->CharSet);
2370 2370
                 $ismultipart = false;
2371 2371
                 break;
2372 2372
         }
@@ -2401,7 +2401,7 @@  discard block
 block discarded – undo
2401 2401
      */
2402 2402
     public function getSentMIMEMessage()
2403 2403
     {
2404
-        return rtrim($this->MIMEHeader . $this->mailHeader, "\n\r") . static::$LE . static::$LE . $this->MIMEBody;
2404
+        return rtrim($this->MIMEHeader.$this->mailHeader, "\n\r").static::$LE.static::$LE.$this->MIMEBody;
2405 2405
     }
2406 2406
 
2407 2407
     /**
@@ -2438,12 +2438,12 @@  discard block
 block discarded – undo
2438 2438
         $body = '';
2439 2439
         //Create unique IDs and preset boundaries
2440 2440
         $this->uniqueid = $this->generateId();
2441
-        $this->boundary[1] = 'b1_' . $this->uniqueid;
2442
-        $this->boundary[2] = 'b2_' . $this->uniqueid;
2443
-        $this->boundary[3] = 'b3_' . $this->uniqueid;
2441
+        $this->boundary[1] = 'b1_'.$this->uniqueid;
2442
+        $this->boundary[2] = 'b2_'.$this->uniqueid;
2443
+        $this->boundary[3] = 'b3_'.$this->uniqueid;
2444 2444
 
2445 2445
         if ($this->sign_key_file) {
2446
-            $body .= $this->getMailMIME() . static::$LE;
2446
+            $body .= $this->getMailMIME().static::$LE;
2447 2447
         }
2448 2448
 
2449 2449
         $this->setWordWrap();
@@ -2476,7 +2476,7 @@  discard block
 block discarded – undo
2476 2476
             $altBodyEncoding = 'quoted-printable';
2477 2477
         }
2478 2478
         //Use this as a preamble in all multipart message types
2479
-        $mimepre = 'This is a multi-part message in MIME format.' . static::$LE;
2479
+        $mimepre = 'This is a multi-part message in MIME format.'.static::$LE;
2480 2480
         switch ($this->message_type) {
2481 2481
             case 'inline':
2482 2482
                 $body .= $mimepre;
@@ -2494,9 +2494,9 @@  discard block
 block discarded – undo
2494 2494
                 break;
2495 2495
             case 'inline_attach':
2496 2496
                 $body .= $mimepre;
2497
-                $body .= $this->textLine('--' . $this->boundary[1]);
2497
+                $body .= $this->textLine('--'.$this->boundary[1]);
2498 2498
                 $body .= $this->headerLine('Content-Type', 'multipart/related;');
2499
-                $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
2499
+                $body .= $this->textLine("\tboundary=\"".$this->boundary[2].'"');
2500 2500
                 $body .= static::$LE;
2501 2501
                 $body .= $this->getBoundary($this->boundary[2], $bodyCharSet, '', $bodyEncoding);
2502 2502
                 $body .= $this->encodeString($this->Body, $bodyEncoding);
@@ -2525,9 +2525,9 @@  discard block
 block discarded – undo
2525 2525
                 $body .= $this->getBoundary($this->boundary[1], $altBodyCharSet, 'text/plain', $altBodyEncoding);
2526 2526
                 $body .= $this->encodeString($this->AltBody, $altBodyEncoding);
2527 2527
                 $body .= static::$LE;
2528
-                $body .= $this->textLine('--' . $this->boundary[1]);
2528
+                $body .= $this->textLine('--'.$this->boundary[1]);
2529 2529
                 $body .= $this->headerLine('Content-Type', 'multipart/related;');
2530
-                $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
2530
+                $body .= $this->textLine("\tboundary=\"".$this->boundary[2].'"');
2531 2531
                 $body .= static::$LE;
2532 2532
                 $body .= $this->getBoundary($this->boundary[2], $bodyCharSet, 'text/html', $bodyEncoding);
2533 2533
                 $body .= $this->encodeString($this->Body, $bodyEncoding);
@@ -2538,9 +2538,9 @@  discard block
 block discarded – undo
2538 2538
                 break;
2539 2539
             case 'alt_attach':
2540 2540
                 $body .= $mimepre;
2541
-                $body .= $this->textLine('--' . $this->boundary[1]);
2541
+                $body .= $this->textLine('--'.$this->boundary[1]);
2542 2542
                 $body .= $this->headerLine('Content-Type', 'multipart/alternative;');
2543
-                $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
2543
+                $body .= $this->textLine("\tboundary=\"".$this->boundary[2].'"');
2544 2544
                 $body .= static::$LE;
2545 2545
                 $body .= $this->getBoundary($this->boundary[2], $altBodyCharSet, 'text/plain', $altBodyEncoding);
2546 2546
                 $body .= $this->encodeString($this->AltBody, $altBodyEncoding);
@@ -2558,16 +2558,16 @@  discard block
 block discarded – undo
2558 2558
                 break;
2559 2559
             case 'alt_inline_attach':
2560 2560
                 $body .= $mimepre;
2561
-                $body .= $this->textLine('--' . $this->boundary[1]);
2561
+                $body .= $this->textLine('--'.$this->boundary[1]);
2562 2562
                 $body .= $this->headerLine('Content-Type', 'multipart/alternative;');
2563
-                $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
2563
+                $body .= $this->textLine("\tboundary=\"".$this->boundary[2].'"');
2564 2564
                 $body .= static::$LE;
2565 2565
                 $body .= $this->getBoundary($this->boundary[2], $altBodyCharSet, 'text/plain', $altBodyEncoding);
2566 2566
                 $body .= $this->encodeString($this->AltBody, $altBodyEncoding);
2567 2567
                 $body .= static::$LE;
2568
-                $body .= $this->textLine('--' . $this->boundary[2]);
2568
+                $body .= $this->textLine('--'.$this->boundary[2]);
2569 2569
                 $body .= $this->headerLine('Content-Type', 'multipart/related;');
2570
-                $body .= $this->textLine("\tboundary=\"" . $this->boundary[3] . '"');
2570
+                $body .= $this->textLine("\tboundary=\"".$this->boundary[3].'"');
2571 2571
                 $body .= static::$LE;
2572 2572
                 $body .= $this->getBoundary($this->boundary[3], $bodyCharSet, 'text/html', $bodyEncoding);
2573 2573
                 $body .= $this->encodeString($this->Body, $bodyEncoding);
@@ -2594,12 +2594,12 @@  discard block
 block discarded – undo
2594 2594
         } elseif ($this->sign_key_file) {
2595 2595
             try {
2596 2596
                 if (!defined('PKCS7_TEXT')) {
2597
-                    throw new Exception($this->lang('extension_missing') . 'openssl');
2597
+                    throw new Exception($this->lang('extension_missing').'openssl');
2598 2598
                 }
2599 2599
                 // @TODO would be nice to use php://temp streams here
2600 2600
                 $file = tempnam(sys_get_temp_dir(), 'mail');
2601 2601
                 if (false === file_put_contents($file, $body)) {
2602
-                    throw new Exception($this->lang('signing') . ' Could not write temp file');
2602
+                    throw new Exception($this->lang('signing').' Could not write temp file');
2603 2603
                 }
2604 2604
                 $signed = tempnam(sys_get_temp_dir(), 'signed');
2605 2605
                 //Workaround for PHP bug https://bugs.php.net/bug.php?id=69197
@@ -2607,16 +2607,16 @@  discard block
 block discarded – undo
2607 2607
                     $sign = @openssl_pkcs7_sign(
2608 2608
                         $file,
2609 2609
                         $signed,
2610
-                        'file://' . realpath($this->sign_cert_file),
2611
-                        array('file://' . realpath($this->sign_key_file), $this->sign_key_pass),
2610
+                        'file://'.realpath($this->sign_cert_file),
2611
+                        array('file://'.realpath($this->sign_key_file), $this->sign_key_pass),
2612 2612
                         array()
2613 2613
                     );
2614 2614
                 } else {
2615 2615
                     $sign = @openssl_pkcs7_sign(
2616 2616
                         $file,
2617 2617
                         $signed,
2618
-                        'file://' . realpath($this->sign_cert_file),
2619
-                        array('file://' . realpath($this->sign_key_file), $this->sign_key_pass),
2618
+                        'file://'.realpath($this->sign_cert_file),
2619
+                        array('file://'.realpath($this->sign_key_file), $this->sign_key_pass),
2620 2620
                         array(),
2621 2621
                         PKCS7_DETACHED,
2622 2622
                         $this->sign_extracerts_file
@@ -2628,11 +2628,11 @@  discard block
 block discarded – undo
2628 2628
                     @unlink($signed);
2629 2629
                     //The message returned by openssl contains both headers and body, so need to split them up
2630 2630
                     $parts = explode("\n\n", $body, 2);
2631
-                    $this->MIMEHeader .= $parts[0] . static::$LE . static::$LE;
2631
+                    $this->MIMEHeader .= $parts[0].static::$LE.static::$LE;
2632 2632
                     $body = $parts[1];
2633 2633
                 } else {
2634 2634
                     @unlink($signed);
2635
-                    throw new Exception($this->lang('signing') . openssl_error_string());
2635
+                    throw new Exception($this->lang('signing').openssl_error_string());
2636 2636
                 }
2637 2637
             } catch (Exception $exc) {
2638 2638
                 $body = '';
@@ -2667,7 +2667,7 @@  discard block
 block discarded – undo
2667 2667
         if ('' == $encoding) {
2668 2668
             $encoding = $this->Encoding;
2669 2669
         }
2670
-        $result .= $this->textLine('--' . $boundary);
2670
+        $result .= $this->textLine('--'.$boundary);
2671 2671
         $result .= sprintf('Content-Type: %s; charset=%s', $contentType, $charSet);
2672 2672
         $result .= static::$LE;
2673 2673
         // RFC1341 part 5 says 7bit is assumed if not specified
@@ -2688,7 +2688,7 @@  discard block
 block discarded – undo
2688 2688
      */
2689 2689
     protected function endBoundary($boundary)
2690 2690
     {
2691
-        return static::$LE . '--' . $boundary . '--' . static::$LE;
2691
+        return static::$LE.'--'.$boundary.'--'.static::$LE;
2692 2692
     }
2693 2693
 
2694 2694
     /**
@@ -2724,7 +2724,7 @@  discard block
 block discarded – undo
2724 2724
      */
2725 2725
     public function headerLine($name, $value)
2726 2726
     {
2727
-        return $name . ': ' . $value . static::$LE;
2727
+        return $name.': '.$value.static::$LE;
2728 2728
     }
2729 2729
 
2730 2730
     /**
@@ -2736,7 +2736,7 @@  discard block
 block discarded – undo
2736 2736
      */
2737 2737
     public function textLine($value)
2738 2738
     {
2739
-        return $value . static::$LE;
2739
+        return $value.static::$LE;
2740 2740
     }
2741 2741
 
2742 2742
     /**
@@ -2758,7 +2758,7 @@  discard block
 block discarded – undo
2758 2758
     {
2759 2759
         try {
2760 2760
             if (!@is_file($path)) {
2761
-                throw new Exception($this->lang('file_access') . $path, self::STOP_CONTINUE);
2761
+                throw new Exception($this->lang('file_access').$path, self::STOP_CONTINUE);
2762 2762
             }
2763 2763
 
2764 2764
             // If a MIME type is not specified, try to work it out from the file name
@@ -2885,7 +2885,7 @@  discard block
 block discarded – undo
2885 2885
                             'Content-Disposition: %s; filename="%s"%s',
2886 2886
                             $disposition,
2887 2887
                             $encoded_name,
2888
-                            static::$LE . static::$LE
2888
+                            static::$LE.static::$LE
2889 2889
                         );
2890 2890
                     } else {
2891 2891
                         if (!empty($encoded_name)) {
@@ -2893,13 +2893,13 @@  discard block
 block discarded – undo
2893 2893
                                 'Content-Disposition: %s; filename=%s%s',
2894 2894
                                 $disposition,
2895 2895
                                 $encoded_name,
2896
-                                static::$LE . static::$LE
2896
+                                static::$LE.static::$LE
2897 2897
                             );
2898 2898
                         } else {
2899 2899
                             $mime[] = sprintf(
2900 2900
                                 'Content-Disposition: %s%s',
2901 2901
                                 $disposition,
2902
-                                static::$LE . static::$LE
2902
+                                static::$LE.static::$LE
2903 2903
                             );
2904 2904
                         }
2905 2905
                     }
@@ -2940,11 +2940,11 @@  discard block
 block discarded – undo
2940 2940
     {
2941 2941
         try {
2942 2942
             if (!file_exists($path)) {
2943
-                throw new Exception($this->lang('file_open') . $path, self::STOP_CONTINUE);
2943
+                throw new Exception($this->lang('file_open').$path, self::STOP_CONTINUE);
2944 2944
             }
2945 2945
             $file_buffer = file_get_contents($path);
2946 2946
             if (false === $file_buffer) {
2947
-                throw new Exception($this->lang('file_open') . $path, self::STOP_CONTINUE);
2947
+                throw new Exception($this->lang('file_open').$path, self::STOP_CONTINUE);
2948 2948
             }
2949 2949
             $file_buffer = $this->encodeString($file_buffer, $encoding);
2950 2950
 
@@ -2991,7 +2991,7 @@  discard block
 block discarded – undo
2991 2991
                 $encoded = $this->encodeQP($str);
2992 2992
                 break;
2993 2993
             default:
2994
-                $this->setError($this->lang('encoding') . $encoding);
2994
+                $this->setError($this->lang('encoding').$encoding);
2995 2995
                 break;
2996 2996
         }
2997 2997
 
@@ -3058,7 +3058,7 @@  discard block
 block discarded – undo
3058 3058
                 $maxlen -= $maxlen % 4;
3059 3059
                 $encoded = trim(chunk_split($encoded, $maxlen, "\n"));
3060 3060
             }
3061
-            $encoded = preg_replace('/^(.*)$/m', ' =?' . $this->CharSet . "?$encoding?\\1?=", $encoded);
3061
+            $encoded = preg_replace('/^(.*)$/m', ' =?'.$this->CharSet."?$encoding?\\1?=", $encoded);
3062 3062
         } elseif ($matchcount > 0) {
3063 3063
             //1 or more chars need encoding, use Q-encode
3064 3064
             $encoding = 'Q';
@@ -3066,8 +3066,8 @@  discard block
 block discarded – undo
3066 3066
             $maxlen = static::STD_LINE_LENGTH - $lengthsub - 8 - strlen($this->CharSet);
3067 3067
             $encoded = $this->encodeQ($str, $position);
3068 3068
             $encoded = $this->wrapText($encoded, $maxlen, true);
3069
-            $encoded = str_replace('=' . static::$LE, "\n", trim($encoded));
3070
-            $encoded = preg_replace('/^(.*)$/m', ' =?' . $this->CharSet . "?$encoding?\\1?=", $encoded);
3069
+            $encoded = str_replace('='.static::$LE, "\n", trim($encoded));
3070
+            $encoded = preg_replace('/^(.*)$/m', ' =?'.$this->CharSet."?$encoding?\\1?=", $encoded);
3071 3071
         } elseif (strlen($str) > $maxlen) {
3072 3072
             //No chars need encoding, but line is too long, so fold it
3073 3073
             $encoded = trim($this->wrapText($str, $maxlen, false));
@@ -3128,7 +3128,7 @@  discard block
 block discarded – undo
3128 3128
      */
3129 3129
     public function base64EncodeWrapMB($str, $linebreak = null)
3130 3130
     {
3131
-        $start = '=?' . $this->CharSet . '?B?';
3131
+        $start = '=?'.$this->CharSet.'?B?';
3132 3132
         $end = '?=';
3133 3133
         $encoded = '';
3134 3134
         if (null === $linebreak) {
@@ -3151,7 +3151,7 @@  discard block
 block discarded – undo
3151 3151
                 $chunk = base64_encode($chunk);
3152 3152
                 ++$lookBack;
3153 3153
             } while (strlen($chunk) > $length);
3154
-            $encoded .= $chunk . $linebreak;
3154
+            $encoded .= $chunk.$linebreak;
3155 3155
         }
3156 3156
 
3157 3157
         // Chomp the last linefeed
@@ -3205,7 +3205,7 @@  discard block
 block discarded – undo
3205 3205
                 // RFC 2047 section 5.1
3206 3206
                 // Replace every high ascii, control, =, ? and _ characters
3207 3207
                 /** @noinspection SuspiciousAssignmentsInspection */
3208
-                $pattern = '\000-\011\013\014\016-\037\075\077\137\177-\377' . $pattern;
3208
+                $pattern = '\000-\011\013\014\016-\037\075\077\137\177-\377'.$pattern;
3209 3209
                 break;
3210 3210
         }
3211 3211
         $matches = array();
@@ -3218,7 +3218,7 @@  discard block
 block discarded – undo
3218 3218
                 array_unshift($matches[0], '=');
3219 3219
             }
3220 3220
             foreach (array_unique($matches[0]) as $char) {
3221
-                $encoded = str_replace($char, '=' . sprintf('%02X', ord($char)), $encoded);
3221
+                $encoded = str_replace($char, '='.sprintf('%02X', ord($char)), $encoded);
3222 3222
             }
3223 3223
         }
3224 3224
         // Replace spaces with _ (more readable than =20)
@@ -3243,7 +3243,7 @@  discard block
 block discarded – undo
3243 3243
         $encoding = 'base64',
3244 3244
         $type = '',
3245 3245
         $disposition = 'attachment'
3246
-    ) {
3246
+    ){
3247 3247
         // If a MIME type is not specified, try to work it out from the file name
3248 3248
         if ('' == $type) {
3249 3249
             $type = static::filenameToType($filename);
@@ -3283,7 +3283,7 @@  discard block
 block discarded – undo
3283 3283
     public function addEmbeddedImage($path, $cid, $name = '', $encoding = 'base64', $type = '', $disposition = 'inline')
3284 3284
     {
3285 3285
         if (!@is_file($path)) {
3286
-            $this->setError($this->lang('file_access') . $path);
3286
+            $this->setError($this->lang('file_access').$path);
3287 3287
 
3288 3288
             return false;
3289 3289
         }
@@ -3337,7 +3337,7 @@  discard block
 block discarded – undo
3337 3337
         $encoding = 'base64',
3338 3338
         $type = '',
3339 3339
         $disposition = 'inline'
3340
-    ) {
3340
+    ){
3341 3341
         // If a MIME type is not specified, try to work it out from the name
3342 3342
         if ('' == $type and !empty($name)) {
3343 3343
             $type = static::filenameToType($name);
@@ -3427,7 +3427,7 @@  discard block
 block discarded – undo
3427 3427
     {
3428 3428
         $this->RecipientsQueue = array_filter(
3429 3429
             $this->RecipientsQueue,
3430
-            function ($params) use ($kind) {
3430
+            function($params) use ($kind) {
3431 3431
                 return $params[0] != $kind;
3432 3432
             }
3433 3433
         );
@@ -3517,15 +3517,15 @@  discard block
 block discarded – undo
3517 3517
         if ('smtp' == $this->Mailer and null !== $this->smtp) {
3518 3518
             $lasterror = $this->smtp->getError();
3519 3519
             if (!empty($lasterror['error'])) {
3520
-                $msg .= $this->lang('smtp_error') . $lasterror['error'];
3520
+                $msg .= $this->lang('smtp_error').$lasterror['error'];
3521 3521
                 if (!empty($lasterror['detail'])) {
3522
-                    $msg .= ' Detail: ' . $lasterror['detail'];
3522
+                    $msg .= ' Detail: '.$lasterror['detail'];
3523 3523
                 }
3524 3524
                 if (!empty($lasterror['smtp_code'])) {
3525
-                    $msg .= ' SMTP code: ' . $lasterror['smtp_code'];
3525
+                    $msg .= ' SMTP code: '.$lasterror['smtp_code'];
3526 3526
                 }
3527 3527
                 if (!empty($lasterror['smtp_code_ex'])) {
3528
-                    $msg .= ' Additional SMTP info: ' . $lasterror['smtp_code_ex'];
3528
+                    $msg .= ' Additional SMTP info: '.$lasterror['smtp_code_ex'];
3529 3529
                 }
3530 3530
             }
3531 3531
         }
@@ -3598,7 +3598,7 @@  discard block
 block discarded – undo
3598 3598
             //Is it a valid IPv4 address?
3599 3599
             return (bool) filter_var($host, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4);
3600 3600
         }
3601
-        if (filter_var('http://' . $host, FILTER_VALIDATE_URL, FILTER_FLAG_HOST_REQUIRED)) {
3601
+        if (filter_var('http://'.$host, FILTER_VALIDATE_URL, FILTER_FLAG_HOST_REQUIRED)) {
3602 3602
             //Is it a syntactically valid hostname?
3603 3603
             return true;
3604 3604
         }
@@ -3624,7 +3624,7 @@  discard block
 block discarded – undo
3624 3624
                 //Include a link to troubleshooting docs on SMTP connection failure
3625 3625
                 //this is by far the biggest cause of support questions
3626 3626
                 //but it's usually not PHPMailer's fault.
3627
-                return $this->language[$key] . ' https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting';
3627
+                return $this->language[$key].' https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting';
3628 3628
             }
3629 3629
 
3630 3630
             return $this->language[$key];
@@ -3712,14 +3712,14 @@  discard block
 block discarded – undo
3712 3712
                     }
3713 3713
                     //Hash the decoded data, not the URL so that the same data-URI image used in multiple places
3714 3714
                     //will only be embedded once, even if it used a different encoding
3715
-                    $cid = hash('sha256', $data) . '@phpmailer.0'; // RFC2392 S 2
3715
+                    $cid = hash('sha256', $data).'@phpmailer.0'; // RFC2392 S 2
3716 3716
 
3717 3717
                     if (!$this->cidExists($cid)) {
3718
-                        $this->addStringEmbeddedImage($data, $cid, 'embed' . $imgindex, 'base64', $match[1]);
3718
+                        $this->addStringEmbeddedImage($data, $cid, 'embed'.$imgindex, 'base64', $match[1]);
3719 3719
                     }
3720 3720
                     $message = str_replace(
3721 3721
                         $images[0][$imgindex],
3722
-                        $images[1][$imgindex] . '="cid:' . $cid . '"',
3722
+                        $images[1][$imgindex].'="cid:'.$cid.'"',
3723 3723
                         $message
3724 3724
                     );
3725 3725
                     continue;
@@ -3738,7 +3738,7 @@  discard block
 block discarded – undo
3738 3738
                     if ('.' == $directory) {
3739 3739
                         $directory = '';
3740 3740
                     }
3741
-                    $cid = hash('sha256', $url) . '@phpmailer.0'; // RFC2392 S 2
3741
+                    $cid = hash('sha256', $url).'@phpmailer.0'; // RFC2392 S 2
3742 3742
                     if (strlen($basedir) > 1 and '/' != substr($basedir, -1)) {
3743 3743
                         $basedir .= '/';
3744 3744
                     }
@@ -3746,7 +3746,7 @@  discard block
 block discarded – undo
3746 3746
                         $directory .= '/';
3747 3747
                     }
3748 3748
                     if ($this->addEmbeddedImage(
3749
-                        $basedir . $directory . $filename,
3749
+                        $basedir.$directory.$filename,
3750 3750
                         $cid,
3751 3751
                         $filename,
3752 3752
                         'base64',
@@ -3754,8 +3754,8 @@  discard block
 block discarded – undo
3754 3754
                     )
3755 3755
                     ) {
3756 3756
                         $message = preg_replace(
3757
-                            '/' . $images[1][$imgindex] . '=["\']' . preg_quote($url, '/') . '["\']/Ui',
3758
-                            $images[1][$imgindex] . '="cid:' . $cid . '"',
3757
+                            '/'.$images[1][$imgindex].'=["\']'.preg_quote($url, '/').'["\']/Ui',
3758
+                            $images[1][$imgindex].'="cid:'.$cid.'"',
3759 3759
                             $message
3760 3760
                         );
3761 3761
                     }
@@ -4029,7 +4029,7 @@  discard block
 block discarded – undo
4029 4029
 
4030 4030
             return true;
4031 4031
         }
4032
-        $this->setError($this->lang('variable_set') . $name);
4032
+        $this->setError($this->lang('variable_set').$name);
4033 4033
 
4034 4034
         return false;
4035 4035
     }
@@ -4123,7 +4123,7 @@  discard block
 block discarded – undo
4123 4123
             if (((0x21 <= $ord) and ($ord <= 0x3A)) or $ord == 0x3C or ((0x3E <= $ord) and ($ord <= 0x7E))) {
4124 4124
                 $line .= $txt[$i];
4125 4125
             } else {
4126
-                $line .= '=' . sprintf('%02X', $ord);
4126
+                $line .= '='.sprintf('%02X', $ord);
4127 4127
             }
4128 4128
         }
4129 4129
 
@@ -4143,14 +4143,13 @@  discard block
 block discarded – undo
4143 4143
     {
4144 4144
         if (!defined('PKCS7_TEXT')) {
4145 4145
             if ($this->exceptions) {
4146
-                throw new Exception($this->lang('extension_missing') . 'openssl');
4146
+                throw new Exception($this->lang('extension_missing').'openssl');
4147 4147
             }
4148 4148
 
4149 4149
             return '';
4150 4150
         }
4151 4151
         $privKeyStr = !empty($this->DKIM_private_string) ?
4152
-            $this->DKIM_private_string :
4153
-            file_get_contents($this->DKIM_private);
4152
+            $this->DKIM_private_string : file_get_contents($this->DKIM_private);
4154 4153
         if ('' != $this->DKIM_passphrase) {
4155 4154
             $privKey = openssl_pkey_get_private($privKeyStr, $this->DKIM_passphrase);
4156 4155
         } else {
@@ -4202,7 +4201,7 @@  discard block
 block discarded – undo
4202 4201
             //But then says to delete space before and after the colon.
4203 4202
             //Net result is the same as trimming both ends of the value.
4204 4203
             //by elimination, the same applies to the field name
4205
-            $lines[$key] = trim($heading, " \t") . ':' . trim($value, " \t");
4204
+            $lines[$key] = trim($heading, " \t").':'.trim($value, " \t");
4206 4205
         }
4207 4206
 
4208 4207
         return implode("\r\n", $lines);
@@ -4228,7 +4227,7 @@  discard block
 block discarded – undo
4228 4227
         $body = static::normalizeBreaks($body, "\r\n");
4229 4228
 
4230 4229
         //Reduce multiple trailing line breaks to a single one
4231
-        return rtrim($body, "\r\n") . "\r\n";
4230
+        return rtrim($body, "\r\n")."\r\n";
4232 4231
     }
4233 4232
 
4234 4233
     /**
@@ -4284,33 +4283,33 @@  discard block
 block discarded – undo
4284 4283
         if ('' == $this->DKIM_identity) {
4285 4284
             $ident = '';
4286 4285
         } else {
4287
-            $ident = ' i=' . $this->DKIM_identity . ';';
4288
-        }
4289
-        $dkimhdrs = 'DKIM-Signature: v=1; a=' .
4290
-            $DKIMsignatureType . '; q=' .
4291
-            $DKIMquery . '; l=' .
4292
-            $DKIMlen . '; s=' .
4293
-            $this->DKIM_selector .
4294
-            ";\r\n" .
4295
-            "\tt=" . $DKIMtime . '; c=' . $DKIMcanonicalization . ";\r\n" .
4296
-            "\th=From:To:Date:Subject;\r\n" .
4297
-            "\td=" . $this->DKIM_domain . ';' . $ident . "\r\n" .
4298
-            "\tz=$from\r\n" .
4299
-            "\t|$to\r\n" .
4300
-            "\t|$date\r\n" .
4301
-            "\t|$subject;\r\n" .
4302
-            "\tbh=" . $DKIMb64 . ";\r\n" .
4286
+            $ident = ' i='.$this->DKIM_identity.';';
4287
+        }
4288
+        $dkimhdrs = 'DKIM-Signature: v=1; a='.
4289
+            $DKIMsignatureType.'; q='.
4290
+            $DKIMquery.'; l='.
4291
+            $DKIMlen.'; s='.
4292
+            $this->DKIM_selector.
4293
+            ";\r\n".
4294
+            "\tt=".$DKIMtime.'; c='.$DKIMcanonicalization.";\r\n".
4295
+            "\th=From:To:Date:Subject;\r\n".
4296
+            "\td=".$this->DKIM_domain.';'.$ident."\r\n".
4297
+            "\tz=$from\r\n".
4298
+            "\t|$to\r\n".
4299
+            "\t|$date\r\n".
4300
+            "\t|$subject;\r\n".
4301
+            "\tbh=".$DKIMb64.";\r\n".
4303 4302
             "\tb=";
4304 4303
         $toSign = $this->DKIM_HeaderC(
4305
-            $from_header . "\r\n" .
4306
-            $to_header . "\r\n" .
4307
-            $date_header . "\r\n" .
4308
-            $subject_header . "\r\n" .
4304
+            $from_header."\r\n".
4305
+            $to_header."\r\n".
4306
+            $date_header."\r\n".
4307
+            $subject_header."\r\n".
4309 4308
             $dkimhdrs
4310 4309
         );
4311 4310
         $signed = $this->DKIM_Sign($toSign);
4312 4311
 
4313
-        return static::normalizeBreaks($dkimhdrs . $signed) . static::$LE;
4312
+        return static::normalizeBreaks($dkimhdrs.$signed).static::$LE;
4314 4313
     }
4315 4314
 
4316 4315
     /**
@@ -4323,7 +4322,7 @@  discard block
 block discarded – undo
4323 4322
      */
4324 4323
     public static function hasLineLongerThanMax($str)
4325 4324
     {
4326
-        return (bool) preg_match('/^(.{' . (self::MAX_LINE_LENGTH + strlen(static::$LE)) . ',})/m', $str);
4325
+        return (bool) preg_match('/^(.{'.(self::MAX_LINE_LENGTH + strlen(static::$LE)).',})/m', $str);
4327 4326
     }
4328 4327
 
4329 4328
     /**
Please login to merge, or discard this patch.
manager/includes/controls/phpmailer/POP3.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -209,7 +209,7 @@
 block discarded – undo
209 209
      * Connect to a POP3 server.
210 210
      *
211 211
      * @param string   $host
212
-     * @param int|bool $port
212
+     * @param integer $port
213 213
      * @param int      $tval
214 214
      *
215 215
      * @return bool
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
         $username = '',
150 150
         $password = '',
151 151
         $debug_level = 0
152
-    ) {
152
+    ){
153 153
         $pop = new self();
154 154
 
155 155
         return $pop->authorise($host, $port, $timeout, $username, $password, $debug_level);
@@ -288,11 +288,11 @@  discard block
 block discarded – undo
288 288
         }
289 289
 
290 290
         // Send the Username
291
-        $this->sendString("USER $username" . static::LE);
291
+        $this->sendString("USER $username".static::LE);
292 292
         $pop3_response = $this->getResponse();
293 293
         if ($this->checkResponse($pop3_response)) {
294 294
             // Send the Password
295
-            $this->sendString("PASS $password" . static::LE);
295
+            $this->sendString("PASS $password".static::LE);
296 296
             $pop3_response = $this->getResponse();
297 297
             if ($this->checkResponse($pop3_response)) {
298 298
                 return true;
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
     protected function catchWarning($errno, $errstr, $errfile, $errline)
413 413
     {
414 414
         $this->setError(
415
-            'Connecting to the POP3 server raised a PHP warning:' .
415
+            'Connecting to the POP3 server raised a PHP warning:'.
416 416
             "errno: $errno errstr: $errstr; errfile: $errfile; errline: $errline"
417 417
         );
418 418
     }
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -344,7 +344,8 @@
 block discarded – undo
344 344
     protected function sendString($string)
345 345
     {
346 346
         if ($this->pop_conn) {
347
-            if ($this->do_debug >= 2) { //Show client messages when debug >= 2
347
+            if ($this->do_debug >= 2) {
348
+//Show client messages when debug >= 2
348 349
                 echo 'Client -> Server: ', $string;
349 350
             }
350 351
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -288,11 +288,11 @@
 block discarded – undo
288 288
         }
289 289
 
290 290
         // Send the Username
291
-        $this->sendString("USER $username" . static::LE);
291
+        $this->sendString("user $username" . static::LE);
292 292
         $pop3_response = $this->getResponse();
293 293
         if ($this->checkResponse($pop3_response)) {
294 294
             // Send the Password
295
-            $this->sendString("PASS $password" . static::LE);
295
+            $this->sendString("pass $password" . static::LE);
296 296
             $pop3_response = $this->getResponse();
297 297
             if ($this->checkResponse($pop3_response)) {
298 298
                 return true;
Please login to merge, or discard this patch.
manager/includes/controls/phpmailer/SMTP.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1314,7 +1314,7 @@
 block discarded – undo
1314 1314
      * If no reply has been received yet, it will return null.
1315 1315
      * If no pattern was matched, it will return false.
1316 1316
      *
1317
-     * @return bool|null|string
1317
+     * @return string
1318 1318
      *
1319 1319
      * @see recordLastTransactionID()
1320 1320
      */
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
         }
308 308
         // Connect to the SMTP server
309 309
         $this->edebug(
310
-            "Connection: opening to $host:$port, timeout=$timeout, options=" .
310
+            "Connection: opening to $host:$port, timeout=$timeout, options=".
311 311
             (count($options) > 0 ? var_export($options, true) : 'array()'),
312 312
             self::DEBUG_CONNECTION
313 313
         );
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
             $socket_context = stream_context_create($options);
318 318
             set_error_handler(array($this, 'errorHandler'));
319 319
             $this->smtp_conn = stream_socket_client(
320
-                $host . ':' . $port,
320
+                $host.':'.$port,
321 321
                 $errno,
322 322
                 $errstr,
323 323
                 $timeout,
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
                 (string) $errstr
351 351
             );
352 352
             $this->edebug(
353
-                'SMTP ERROR: ' . $this->error['error']
353
+                'SMTP ERROR: '.$this->error['error']
354 354
                 . ": $errstr ($errno)",
355 355
                 self::DEBUG_CLIENT
356 356
             );
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
         }
371 371
         // Get any announcement
372 372
         $announce = $this->get_lines();
373
-        $this->edebug('SERVER -> CLIENT: ' . $announce, self::DEBUG_SERVER);
373
+        $this->edebug('SERVER -> CLIENT: '.$announce, self::DEBUG_SERVER);
374 374
 
375 375
         return true;
376 376
     }
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
         $password,
427 427
         $authtype = null,
428 428
         $OAuth = null
429
-    ) {
429
+    ){
430 430
         if (!$this->server_caps) {
431 431
             $this->setError('Authentication is not allowed before HELO/EHLO');
432 432
 
@@ -443,15 +443,15 @@  discard block
 block discarded – undo
443 443
                 return false;
444 444
             }
445 445
 
446
-            $this->edebug('Auth method requested: ' . ($authtype ? $authtype : 'UNKNOWN'), self::DEBUG_LOWLEVEL);
446
+            $this->edebug('Auth method requested: '.($authtype ? $authtype : 'UNKNOWN'), self::DEBUG_LOWLEVEL);
447 447
             $this->edebug(
448
-                'Auth methods available on the server: ' . implode(',', $this->server_caps['AUTH']),
448
+                'Auth methods available on the server: '.implode(',', $this->server_caps['AUTH']),
449 449
                 self::DEBUG_LOWLEVEL
450 450
             );
451 451
 
452 452
             //If we have requested a specific auth type, check the server supports it before trying others
453 453
             if (!in_array($authtype, $this->server_caps['AUTH'])) {
454
-                $this->edebug('Requested auth method not available: ' . $authtype, self::DEBUG_LOWLEVEL);
454
+                $this->edebug('Requested auth method not available: '.$authtype, self::DEBUG_LOWLEVEL);
455 455
                 $authtype = null;
456 456
             }
457 457
 
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
 
470 470
                     return false;
471 471
                 }
472
-                self::edebug('Auth method selected: ' . $authtype, self::DEBUG_LOWLEVEL);
472
+                self::edebug('Auth method selected: '.$authtype, self::DEBUG_LOWLEVEL);
473 473
             }
474 474
 
475 475
             if (!in_array($authtype, $this->server_caps['AUTH'])) {
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
                 // Send encoded username and password
490 490
                 if (!$this->sendCommand(
491 491
                     'User & Password',
492
-                    base64_encode("\0" . $username . "\0" . $password),
492
+                    base64_encode("\0".$username."\0".$password),
493 493
                     235
494 494
                 )
495 495
                 ) {
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
                 $challenge = base64_decode(substr($this->last_reply, 4));
518 518
 
519 519
                 // Build the response
520
-                $response = $username . ' ' . $this->hmac($challenge, $password);
520
+                $response = $username.' '.$this->hmac($challenge, $password);
521 521
 
522 522
                 // send encoded credentials
523 523
                 return $this->sendCommand('Username', base64_encode($response), 235);
@@ -529,7 +529,7 @@  discard block
 block discarded – undo
529 529
                 $oauth = $OAuth->getOauth64();
530 530
 
531 531
                 // Start authentication
532
-                if (!$this->sendCommand('AUTH', 'AUTH XOAUTH2 ' . $oauth, 235)) {
532
+                if (!$this->sendCommand('AUTH', 'AUTH XOAUTH2 '.$oauth, 235)) {
533 533
                     return false;
534 534
                 }
535 535
                 break;
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
         $k_ipad = $key ^ $ipad;
577 577
         $k_opad = $key ^ $opad;
578 578
 
579
-        return md5($k_opad . pack('H*', md5($k_ipad . $data)));
579
+        return md5($k_opad.pack('H*', md5($k_ipad.$data)));
580 580
     }
581 581
 
582 582
     /**
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
                 }
692 692
                 //If processing headers add a LWSP-char to the front of new line RFC822 section 3.1.1
693 693
                 if ($in_headers) {
694
-                    $line = "\t" . $line;
694
+                    $line = "\t".$line;
695 695
                 }
696 696
             }
697 697
             $lines_out[] = $line;
@@ -700,9 +700,9 @@  discard block
 block discarded – undo
700 700
             foreach ($lines_out as $line_out) {
701 701
                 //RFC2821 section 4.5.2
702 702
                 if (!empty($line_out) and $line_out[0] == '.') {
703
-                    $line_out = '.' . $line_out;
703
+                    $line_out = '.'.$line_out;
704 704
                 }
705
-                $this->client_send($line_out . static::LE, 'DATA');
705
+                $this->client_send($line_out.static::LE, 'DATA');
706 706
             }
707 707
         }
708 708
 
@@ -748,7 +748,7 @@  discard block
 block discarded – undo
748 748
      */
749 749
     protected function sendHello($hello, $host)
750 750
     {
751
-        $noerror = $this->sendCommand($hello, $hello . ' ' . $host, 250);
751
+        $noerror = $this->sendCommand($hello, $hello.' '.$host, 250);
752 752
         $this->helo_rply = $this->last_reply;
753 753
         if ($noerror) {
754 754
             $this->parseHelloFields($hello);
@@ -819,7 +819,7 @@  discard block
 block discarded – undo
819 819
 
820 820
         return $this->sendCommand(
821 821
             'MAIL FROM',
822
-            'MAIL FROM:<' . $from . '>' . $useVerp,
822
+            'MAIL FROM:<'.$from.'>'.$useVerp,
823 823
             250
824 824
         );
825 825
     }
@@ -859,7 +859,7 @@  discard block
 block discarded – undo
859 859
     {
860 860
         return $this->sendCommand(
861 861
             'RCPT TO',
862
-            'RCPT TO:<' . $address . '>',
862
+            'RCPT TO:<'.$address.'>',
863 863
             array(250, 251)
864 864
         );
865 865
     }
@@ -898,7 +898,7 @@  discard block
 block discarded – undo
898 898
 
899 899
             return false;
900 900
         }
901
-        $this->client_send($commandstring . static::LE, $command);
901
+        $this->client_send($commandstring.static::LE, $command);
902 902
 
903 903
         $this->last_reply = $this->get_lines();
904 904
         // Fetch SMTP code and possible error code explanation
@@ -908,8 +908,8 @@  discard block
 block discarded – undo
908 908
             $code_ex = (count($matches) > 2 ? $matches[2] : null);
909 909
             // Cut off error code from each response line
910 910
             $detail = preg_replace(
911
-                "/{$code}[ -]" .
912
-                ($code_ex ? str_replace('.', '\\.', $code_ex) . ' ' : '') . '/m',
911
+                "/{$code}[ -]".
912
+                ($code_ex ? str_replace('.', '\\.', $code_ex).' ' : '').'/m',
913 913
                 '',
914 914
                 $this->last_reply
915 915
             );
@@ -920,7 +920,7 @@  discard block
 block discarded – undo
920 920
             $detail = substr($this->last_reply, 4);
921 921
         }
922 922
 
923
-        $this->edebug('SERVER -> CLIENT: ' . $this->last_reply, self::DEBUG_SERVER);
923
+        $this->edebug('SERVER -> CLIENT: '.$this->last_reply, self::DEBUG_SERVER);
924 924
 
925 925
         if (!in_array($code, (array) $expect)) {
926 926
             $this->setError(
@@ -930,7 +930,7 @@  discard block
 block discarded – undo
930 930
                 $code_ex
931 931
             );
932 932
             $this->edebug(
933
-                'SMTP ERROR: ' . $this->error['error'] . ': ' . $this->last_reply,
933
+                'SMTP ERROR: '.$this->error['error'].': '.$this->last_reply,
934 934
                 self::DEBUG_CLIENT
935 935
             );
936 936
 
@@ -996,7 +996,7 @@  discard block
 block discarded – undo
996 996
     public function turn()
997 997
     {
998 998
         $this->setError('The SMTP TURN command is not implemented');
999
-        $this->edebug('SMTP NOTICE: ' . $this->error['error'], self::DEBUG_CLIENT);
999
+        $this->edebug('SMTP NOTICE: '.$this->error['error'], self::DEBUG_CLIENT);
1000 1000
 
1001 1001
         return false;
1002 1002
     }
@@ -1017,7 +1017,7 @@  discard block
 block discarded – undo
1017 1017
             in_array($command, array('User & Password', 'Username', 'Password'), true)) {
1018 1018
             $this->edebug('CLIENT -> SERVER: <credentials hidden>', self::DEBUG_CLIENT);
1019 1019
         } else {
1020
-            $this->edebug('CLIENT -> SERVER: ' . $data, self::DEBUG_CLIENT);
1020
+            $this->edebug('CLIENT -> SERVER: '.$data, self::DEBUG_CLIENT);
1021 1021
         }
1022 1022
         set_error_handler(array($this, 'errorHandler'));
1023 1023
         $result = fwrite($this->smtp_conn, $data);
@@ -1123,14 +1123,14 @@  discard block
 block discarded – undo
1123 1123
             //Must pass vars in here as params are by reference
1124 1124
             if (!stream_select($selR, $selW, $selW, $this->Timelimit)) {
1125 1125
                 $this->edebug(
1126
-                    'SMTP -> get_lines(): timed-out (' . $this->Timeout . ' sec)',
1126
+                    'SMTP -> get_lines(): timed-out ('.$this->Timeout.' sec)',
1127 1127
                     self::DEBUG_LOWLEVEL
1128 1128
                 );
1129 1129
                 break;
1130 1130
             }
1131 1131
             //Deliberate noise suppression - errors are handled afterwards
1132 1132
             $str = @fgets($this->smtp_conn, 515);
1133
-            $this->edebug('SMTP INBOUND: "' . trim($str) . '"', self::DEBUG_LOWLEVEL);
1133
+            $this->edebug('SMTP INBOUND: "'.trim($str).'"', self::DEBUG_LOWLEVEL);
1134 1134
             $data .= $str;
1135 1135
             // If response is only 3 chars (not valid, but RFC5321 S4.2 says it must be handled),
1136 1136
             // or 4th character is a space, we are done reading, break the loop,
@@ -1142,7 +1142,7 @@  discard block
 block discarded – undo
1142 1142
             $info = stream_get_meta_data($this->smtp_conn);
1143 1143
             if ($info['timed_out']) {
1144 1144
                 $this->edebug(
1145
-                    'SMTP -> get_lines(): timed-out (' . $this->Timeout . ' sec)',
1145
+                    'SMTP -> get_lines(): timed-out ('.$this->Timeout.' sec)',
1146 1146
                     self::DEBUG_LOWLEVEL
1147 1147
                 );
1148 1148
                 break;
@@ -1150,8 +1150,8 @@  discard block
 block discarded – undo
1150 1150
             // Now check if reads took too long
1151 1151
             if ($endtime and time() > $endtime) {
1152 1152
                 $this->edebug(
1153
-                    'SMTP -> get_lines(): timelimit reached (' .
1154
-                    $this->Timelimit . ' sec)',
1153
+                    'SMTP -> get_lines(): timelimit reached ('.
1154
+                    $this->Timelimit.' sec)',
1155 1155
                     self::DEBUG_LOWLEVEL
1156 1156
                 );
1157 1157
                 break;
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -888,7 +888,7 @@  discard block
 block discarded – undo
888 888
     protected function sendCommand($command, $commandstring, $expect)
889 889
     {
890 890
         if (!$this->connected()) {
891
-            $this->setError("Called $command without being connected");
891
+            $this->setError("called $command without being connected");
892 892
 
893 893
             return false;
894 894
         }
@@ -970,7 +970,7 @@  discard block
 block discarded – undo
970 970
      */
971 971
     public function verify($name)
972 972
     {
973
-        return $this->sendCommand('VRFY', "VRFY $name", array(250, 251));
973
+        return $this->sendCommand('VRFY', "vrfy $name", array(250, 251));
974 974
     }
975 975
 
976 976
     /**
Please login to merge, or discard this patch.
manager/media/rss/extlib/Snoopy.class.inc 3 patches
Doc Comments   +7 added lines patch added patch discarded remove patch
@@ -616,6 +616,9 @@  discard block
 block discarded – undo
616 616
         Output:
617 617
     \*======================================================================*/
618 618
 
619
+    /**
620
+     * @param string $http_method
621
+     */
619 622
     function _httprequest($url, $fp, $URI, $http_method, $content_type = "", $body = "")
620 623
     {
621 624
         $cookie_headers = '';
@@ -923,6 +926,10 @@  discard block
 block discarded – undo
923 926
         Output:		post body
924 927
     \*======================================================================*/
925 928
 
929
+    /**
930
+     * @param string $formvars
931
+     * @param string $formfiles
932
+     */
926 933
     function _prepare_post_body($formvars, $formfiles)
927 934
     {
928 935
         settype($formvars, "array");
Please login to merge, or discard this patch.
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
                         // using proxy, send entire URI
150 150
                         $this->_httprequest($URI, $fp, $URI, $this->_httpmethod);
151 151
                     } else {
152
-                        $path = $URI_PARTS["path"] . ($URI_PARTS["query"] ? "?" . $URI_PARTS["query"] : "");
152
+                        $path = $URI_PARTS["path"].($URI_PARTS["query"] ? "?".$URI_PARTS["query"] : "");
153 153
                         // no proxy, send only the path
154 154
                         $this->_httprequest($path, $fp, $URI, $this->_httpmethod);
155 155
                     }
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
                         /* url was redirected, check if we've hit the max depth */
161 161
                         if ($this->maxredirs > $this->_redirectdepth) {
162 162
                             // only follow redirect if it's on this site, or offsiteok is true
163
-                            if (preg_match("|^https?://" . preg_quote($this->host) . "|i", $this->_redirectaddr) || $this->offsiteok) {
163
+                            if (preg_match("|^https?://".preg_quote($this->host)."|i", $this->_redirectaddr) || $this->offsiteok) {
164 164
                                 /* follow the redirect */
165 165
                                 $this->_redirectdepth++;
166 166
                                 $this->lastredirectaddr = $this->_redirectaddr;
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
                 break;
189 189
             default:
190 190
                 // not a valid protocol
191
-                $this->error = 'Invalid protocol "' . $URI_PARTS["scheme"] . '"\n';
191
+                $this->error = 'Invalid protocol "'.$URI_PARTS["scheme"].'"\n';
192 192
                 return false;
193 193
                 break;
194 194
         }
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
                         // using proxy, send entire URI
240 240
                         $this->_httprequest($URI, $fp, $URI, $this->_submit_method, $this->_submit_type, $postdata);
241 241
                     } else {
242
-                        $path = $URI_PARTS["path"] . ($URI_PARTS["query"] ? "?" . $URI_PARTS["query"] : "");
242
+                        $path = $URI_PARTS["path"].($URI_PARTS["query"] ? "?".$URI_PARTS["query"] : "");
243 243
                         // no proxy, send only the path
244 244
                         $this->_httprequest($path, $fp, $URI, $this->_submit_method, $this->_submit_type, $postdata);
245 245
                     }
@@ -249,11 +249,11 @@  discard block
 block discarded – undo
249 249
                     if ($this->_redirectaddr) {
250 250
                         /* url was redirected, check if we've hit the max depth */
251 251
                         if ($this->maxredirs > $this->_redirectdepth) {
252
-                            if (!preg_match("|^" . $URI_PARTS["scheme"] . "://|", $this->_redirectaddr))
253
-                                $this->_redirectaddr = $this->_expandlinks($this->_redirectaddr, $URI_PARTS["scheme"] . "://" . $URI_PARTS["host"]);
252
+                            if (!preg_match("|^".$URI_PARTS["scheme"]."://|", $this->_redirectaddr))
253
+                                $this->_redirectaddr = $this->_expandlinks($this->_redirectaddr, $URI_PARTS["scheme"]."://".$URI_PARTS["host"]);
254 254
 
255 255
                             // only follow redirect if it's on this site, or offsiteok is true
256
-                            if (preg_match("|^https?://" . preg_quote($this->host) . "|i", $this->_redirectaddr) || $this->offsiteok) {
256
+                            if (preg_match("|^https?://".preg_quote($this->host)."|i", $this->_redirectaddr) || $this->offsiteok) {
257 257
                                 /* follow the redirect */
258 258
                                 $this->_redirectdepth++;
259 259
                                 $this->lastredirectaddr = $this->_redirectaddr;
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
                 break;
286 286
             default:
287 287
                 // not a valid protocol
288
-                $this->error = 'Invalid protocol "' . $URI_PARTS["scheme"] . '"\n';
288
+                $this->error = 'Invalid protocol "'.$URI_PARTS["scheme"].'"\n';
289 289
                 return false;
290 290
                 break;
291 291
         }
@@ -585,9 +585,9 @@  discard block
 block discarded – undo
585 585
         $match = preg_replace("|/$|", "", $match);
586 586
         $match_part = parse_url($match);
587 587
         $match_root =
588
-            $match_part["scheme"] . "://" . $match_part["host"];
588
+            $match_part["scheme"]."://".$match_part["host"];
589 589
 
590
-        $search = array("|^http://" . preg_quote($this->host) . "|i",
590
+        $search = array("|^http://".preg_quote($this->host)."|i",
591 591
             "|^(\/)|i",
592 592
             "|^(?!http://)(?!mailto:)|i",
593 593
             "|/\./|",
@@ -595,8 +595,8 @@  discard block
 block discarded – undo
595 595
         );
596 596
 
597 597
         $replace = array("",
598
-            $match_root . "/",
599
-            $match . "/",
598
+            $match_root."/",
599
+            $match."/",
600 600
             "/",
601 601
             "/"
602 602
         );
@@ -625,17 +625,17 @@  discard block
 block discarded – undo
625 625
         $URI_PARTS = parse_url($URI);
626 626
         if (empty($url))
627 627
             $url = "/";
628
-        $headers = $http_method . " " . $url . " " . $this->_httpversion . "\r\n";
628
+        $headers = $http_method." ".$url." ".$this->_httpversion."\r\n";
629 629
         if (!empty($this->host) && !isset($this->rawheaders['Host'])) {
630
-            $headers .= "Host: " . $this->host;
630
+            $headers .= "Host: ".$this->host;
631 631
             if (!empty($this->port) && $this->port != '80')
632
-                $headers .= ":" . $this->port;
632
+                $headers .= ":".$this->port;
633 633
             $headers .= "\r\n";
634 634
         }
635 635
         if (!empty($this->agent))
636
-            $headers .= "User-Agent: " . $this->agent . "\r\n";
636
+            $headers .= "User-Agent: ".$this->agent."\r\n";
637 637
         if (!empty($this->accept))
638
-            $headers .= "Accept: " . $this->accept . "\r\n";
638
+            $headers .= "Accept: ".$this->accept."\r\n";
639 639
         if ($this->use_gzip) {
640 640
             // make sure PHP was built with --with-zlib
641 641
             // and we can handle gzipp'ed data
@@ -643,46 +643,46 @@  discard block
 block discarded – undo
643 643
                 $headers .= "Accept-encoding: gzip\r\n";
644 644
             } else {
645 645
                 trigger_error(
646
-                    "use_gzip is on, but PHP was built without zlib support." .
646
+                    "use_gzip is on, but PHP was built without zlib support.".
647 647
                     "  Requesting file(s) without gzip encoding.",
648 648
                     E_USER_NOTICE);
649 649
             }
650 650
         }
651 651
         if (!empty($this->referer))
652
-            $headers .= "Referer: " . $this->referer . "\r\n";
652
+            $headers .= "Referer: ".$this->referer."\r\n";
653 653
         if (!empty($this->cookies)) {
654 654
             if (!is_array($this->cookies))
655
-                $this->cookies = (array)$this->cookies;
655
+                $this->cookies = (array) $this->cookies;
656 656
 
657 657
             reset($this->cookies);
658 658
             if (count($this->cookies) > 0) {
659 659
                 $cookie_headers .= 'Cookie: ';
660 660
                 foreach ($this->cookies as $cookieKey => $cookieVal) {
661
-                    $cookie_headers .= $cookieKey . "=" . urlencode($cookieVal) . "; ";
661
+                    $cookie_headers .= $cookieKey."=".urlencode($cookieVal)."; ";
662 662
                 }
663
-                $headers .= substr($cookie_headers, 0, -2) . "\r\n";
663
+                $headers .= substr($cookie_headers, 0, -2)."\r\n";
664 664
             }
665 665
         }
666 666
         if (!empty($this->rawheaders)) {
667 667
             if (!is_array($this->rawheaders))
668
-                $this->rawheaders = (array)$this->rawheaders;
668
+                $this->rawheaders = (array) $this->rawheaders;
669 669
             while (list($headerKey, $headerVal) = each($this->rawheaders))
670
-                $headers .= $headerKey . ": " . $headerVal . "\r\n";
670
+                $headers .= $headerKey.": ".$headerVal."\r\n";
671 671
         }
672 672
         if (!empty($content_type)) {
673 673
             $headers .= "Content-type: $content_type";
674 674
             if ($content_type == "multipart/form-data")
675
-                $headers .= "; boundary=" . $this->_mime_boundary;
675
+                $headers .= "; boundary=".$this->_mime_boundary;
676 676
             $headers .= "\r\n";
677 677
         }
678 678
         if (!empty($body))
679
-            $headers .= "Content-length: " . strlen($body) . "\r\n";
679
+            $headers .= "Content-length: ".strlen($body)."\r\n";
680 680
         if (!empty($this->user) || !empty($this->pass))
681
-            $headers .= "Authorization: Basic " . base64_encode($this->user . ":" . $this->pass) . "\r\n";
681
+            $headers .= "Authorization: Basic ".base64_encode($this->user.":".$this->pass)."\r\n";
682 682
 
683 683
         //add proxy auth headers
684 684
         if (!empty($this->proxy_user))
685
-            $headers .= 'Proxy-Authorization: ' . 'Basic ' . base64_encode($this->proxy_user . ':' . $this->proxy_pass) . "\r\n";
685
+            $headers .= 'Proxy-Authorization: '.'Basic '.base64_encode($this->proxy_user.':'.$this->proxy_pass)."\r\n";
686 686
 
687 687
 
688 688
         $headers .= "\r\n";
@@ -692,7 +692,7 @@  discard block
 block discarded – undo
692 692
             socket_set_timeout($fp, $this->read_timeout);
693 693
         $this->timed_out = false;
694 694
 
695
-        fwrite($fp, $headers . $body, strlen($headers . $body));
695
+        fwrite($fp, $headers.$body, strlen($headers.$body));
696 696
 
697 697
         $this->_redirectaddr = false;
698 698
         unset($this->headers);
@@ -716,10 +716,10 @@  discard block
 block discarded – undo
716 716
                 // look for :// in the Location header to see if hostname is included
717 717
                 if (!preg_match("|\:\/\/|", $matches[2])) {
718 718
                     // no host in the path, so prepend
719
-                    $this->_redirectaddr = $URI_PARTS["scheme"] . "://" . $this->host . ":" . $this->port;
719
+                    $this->_redirectaddr = $URI_PARTS["scheme"]."://".$this->host.":".$this->port;
720 720
                     // eliminate double slash
721 721
                     if (!preg_match("|^/|", $matches[2]))
722
-                        $this->_redirectaddr .= "/" . $matches[2];
722
+                        $this->_redirectaddr .= "/".$matches[2];
723 723
                     else
724 724
                         $this->_redirectaddr .= $matches[2];
725 725
                 } else
@@ -771,7 +771,7 @@  discard block
 block discarded – undo
771 771
         if (($this->_framedepth < $this->maxframes) && preg_match_all("'<frame\s+.*src[\s]*=[\'\"]?([^\'\"\>]+)'i", $results, $match)) {
772 772
             $this->results[] = $results;
773 773
             for ($x = 0; $x < count($match[1]); $x++)
774
-                $this->_frameurls[] = $this->_expandlinks($match[1][$x], $URI_PARTS["scheme"] . "://" . $this->host);
774
+                $this->_frameurls[] = $this->_expandlinks($match[1][$x], $URI_PARTS["scheme"]."://".$this->host);
775 775
         } // have we already fetched framed content?
776 776
         elseif (is_array($this->results))
777 777
             $this->results[] = $results;
@@ -858,14 +858,14 @@  discard block
 block discarded – undo
858 858
                     $context_opts['ssl']['capath'] = $this->capath;
859 859
             }
860 860
                     
861
-            $host = 'ssl://' . $host;
861
+            $host = 'ssl://'.$host;
862 862
         }
863 863
 
864 864
         $context = stream_context_create($context_opts);
865 865
 
866 866
         if (version_compare(PHP_VERSION, '5.0.0', '>')) {
867
-            if($this->scheme == 'http')
868
-                $host = "tcp://" . $host;
867
+            if ($this->scheme == 'http')
868
+                $host = "tcp://".$host;
869 869
             $fp = stream_socket_client(
870 870
                 "$host:$port",
871 871
                 $errno,
@@ -897,7 +897,7 @@  discard block
 block discarded – undo
897 897
                 case -5:
898 898
                     $this->error = "connection refused or timed out (-5)";
899 899
                 default:
900
-                    $this->error = "connection failed (" . $errno . ")";
900
+                    $this->error = "connection failed (".$errno.")";
901 901
             }
902 902
             return false;
903 903
         }
@@ -938,26 +938,26 @@  discard block
 block discarded – undo
938 938
                 while (list($key, $val) = each($formvars)) {
939 939
                     if (is_array($val) || is_object($val)) {
940 940
                         while (list($cur_key, $cur_val) = each($val)) {
941
-                            $postdata .= urlencode($key) . "[]=" . urlencode($cur_val) . "&";
941
+                            $postdata .= urlencode($key)."[]=".urlencode($cur_val)."&";
942 942
                         }
943 943
                     } else
944
-                        $postdata .= urlencode($key) . "=" . urlencode($val) . "&";
944
+                        $postdata .= urlencode($key)."=".urlencode($val)."&";
945 945
                 }
946 946
                 break;
947 947
 
948 948
             case "multipart/form-data":
949
-                $this->_mime_boundary = "Snoopy" . md5(uniqid(microtime()));
949
+                $this->_mime_boundary = "Snoopy".md5(uniqid(microtime()));
950 950
 
951 951
                 reset($formvars);
952 952
                 while (list($key, $val) = each($formvars)) {
953 953
                     if (is_array($val) || is_object($val)) {
954 954
                         while (list($cur_key, $cur_val) = each($val)) {
955
-                            $postdata .= "--" . $this->_mime_boundary . "\r\n";
955
+                            $postdata .= "--".$this->_mime_boundary."\r\n";
956 956
                             $postdata .= "Content-Disposition: form-data; name=\"$key\[\]\"\r\n\r\n";
957 957
                             $postdata .= "$cur_val\r\n";
958 958
                         }
959 959
                     } else {
960
-                        $postdata .= "--" . $this->_mime_boundary . "\r\n";
960
+                        $postdata .= "--".$this->_mime_boundary."\r\n";
961 961
                         $postdata .= "Content-Disposition: form-data; name=\"$key\"\r\n\r\n";
962 962
                         $postdata .= "$val\r\n";
963 963
                     }
@@ -974,12 +974,12 @@  discard block
 block discarded – undo
974 974
                         fclose($fp);
975 975
                         $base_name = basename($file_name);
976 976
 
977
-                        $postdata .= "--" . $this->_mime_boundary . "\r\n";
977
+                        $postdata .= "--".$this->_mime_boundary."\r\n";
978 978
                         $postdata .= "Content-Disposition: form-data; name=\"$field_name\"; filename=\"$base_name\"\r\n\r\n";
979 979
                         $postdata .= "$file_content\r\n";
980 980
                     }
981 981
                 }
982
-                $postdata .= "--" . $this->_mime_boundary . "--\r\n";
982
+                $postdata .= "--".$this->_mime_boundary."--\r\n";
983 983
                 break;
984 984
         }
985 985
 
Please login to merge, or discard this patch.
Braces   +192 added lines, -127 removed lines patch added patch discarded remove patch
@@ -121,14 +121,18 @@  discard block
 block discarded – undo
121 121
     {
122 122
 
123 123
         $URI_PARTS = parse_url($URI);
124
-        if (!empty($URI_PARTS["user"]))
125
-            $this->user = $URI_PARTS["user"];
126
-        if (!empty($URI_PARTS["pass"]))
127
-            $this->pass = $URI_PARTS["pass"];
128
-        if (empty($URI_PARTS["query"]))
129
-            $URI_PARTS["query"] = '';
130
-        if (empty($URI_PARTS["path"]))
131
-            $URI_PARTS["path"] = '';
124
+        if (!empty($URI_PARTS["user"])) {
125
+                    $this->user = $URI_PARTS["user"];
126
+        }
127
+        if (!empty($URI_PARTS["pass"])) {
128
+                    $this->pass = $URI_PARTS["pass"];
129
+        }
130
+        if (empty($URI_PARTS["query"])) {
131
+                    $URI_PARTS["query"] = '';
132
+        }
133
+        if (empty($URI_PARTS["path"])) {
134
+                    $URI_PARTS["path"] = '';
135
+        }
132 136
 
133 137
         $fp = null;
134 138
 
@@ -142,8 +146,9 @@  discard block
 block discarded – undo
142 146
             case "http":
143 147
                 $this->scheme = strtolower($URI_PARTS["scheme"]);
144 148
                 $this->host = $URI_PARTS["host"];
145
-                if (!empty($URI_PARTS["port"]))
146
-                    $this->port = $URI_PARTS["port"];
149
+                if (!empty($URI_PARTS["port"])) {
150
+                                    $this->port = $URI_PARTS["port"];
151
+                }
147 152
                 if ($this->_connect($fp)) {
148 153
                     if ($this->_isproxy) {
149 154
                         // using proxy, send entire URI
@@ -177,8 +182,9 @@  discard block
 block discarded – undo
177 182
                             if ($this->_framedepth < $this->maxframes) {
178 183
                                 $this->fetch($frameurl);
179 184
                                 $this->_framedepth++;
180
-                            } else
181
-                                break;
185
+                            } else {
186
+                                                            break;
187
+                            }
182 188
                         }
183 189
                     }
184 190
                 } else {
@@ -213,14 +219,18 @@  discard block
 block discarded – undo
213 219
         $postdata = $this->_prepare_post_body($formvars, $formfiles);
214 220
 
215 221
         $URI_PARTS = parse_url($URI);
216
-        if (!empty($URI_PARTS["user"]))
217
-            $this->user = $URI_PARTS["user"];
218
-        if (!empty($URI_PARTS["pass"]))
219
-            $this->pass = $URI_PARTS["pass"];
220
-        if (empty($URI_PARTS["query"]))
221
-            $URI_PARTS["query"] = '';
222
-        if (empty($URI_PARTS["path"]))
223
-            $URI_PARTS["path"] = '';
222
+        if (!empty($URI_PARTS["user"])) {
223
+                    $this->user = $URI_PARTS["user"];
224
+        }
225
+        if (!empty($URI_PARTS["pass"])) {
226
+                    $this->pass = $URI_PARTS["pass"];
227
+        }
228
+        if (empty($URI_PARTS["query"])) {
229
+                    $URI_PARTS["query"] = '';
230
+        }
231
+        if (empty($URI_PARTS["path"])) {
232
+                    $URI_PARTS["path"] = '';
233
+        }
224 234
 
225 235
         switch (strtolower($URI_PARTS["scheme"])) {
226 236
             case "https":
@@ -232,8 +242,9 @@  discard block
 block discarded – undo
232 242
             case "http":
233 243
                 $this->scheme = strtolower($URI_PARTS["scheme"]);
234 244
                 $this->host = $URI_PARTS["host"];
235
-                if (!empty($URI_PARTS["port"]))
236
-                    $this->port = $URI_PARTS["port"];
245
+                if (!empty($URI_PARTS["port"])) {
246
+                                    $this->port = $URI_PARTS["port"];
247
+                }
237 248
                 if ($this->_connect($fp)) {
238 249
                     if ($this->_isproxy) {
239 250
                         // using proxy, send entire URI
@@ -249,18 +260,22 @@  discard block
 block discarded – undo
249 260
                     if ($this->_redirectaddr) {
250 261
                         /* url was redirected, check if we've hit the max depth */
251 262
                         if ($this->maxredirs > $this->_redirectdepth) {
252
-                            if (!preg_match("|^" . $URI_PARTS["scheme"] . "://|", $this->_redirectaddr))
253
-                                $this->_redirectaddr = $this->_expandlinks($this->_redirectaddr, $URI_PARTS["scheme"] . "://" . $URI_PARTS["host"]);
263
+                            if (!preg_match("|^" . $URI_PARTS["scheme"] . "://|", $this->_redirectaddr)) {
264
+                                                            $this->_redirectaddr = $this->_expandlinks($this->_redirectaddr, $URI_PARTS["scheme"] . "://" . $URI_PARTS["host"]);
265
+                            }
254 266
 
255 267
                             // only follow redirect if it's on this site, or offsiteok is true
256 268
                             if (preg_match("|^https?://" . preg_quote($this->host) . "|i", $this->_redirectaddr) || $this->offsiteok) {
257 269
                                 /* follow the redirect */
258 270
                                 $this->_redirectdepth++;
259 271
                                 $this->lastredirectaddr = $this->_redirectaddr;
260
-                                if (strpos($this->_redirectaddr, "?") > 0)
261
-                                    $this->fetch($this->_redirectaddr); // the redirect has changed the request method from post to get
262
-                                else
263
-                                    $this->submit($this->_redirectaddr, $formvars, $formfiles);
272
+                                if (strpos($this->_redirectaddr, "?") > 0) {
273
+                                                                    $this->fetch($this->_redirectaddr);
274
+                                }
275
+                                // the redirect has changed the request method from post to get
276
+                                else {
277
+                                                                    $this->submit($this->_redirectaddr, $formvars, $formfiles);
278
+                                }
264 279
                             }
265 280
                         }
266 281
                     }
@@ -273,8 +288,9 @@  discard block
 block discarded – undo
273 288
                             if ($this->_framedepth < $this->maxframes) {
274 289
                                 $this->fetch($frameurl);
275 290
                                 $this->_framedepth++;
276
-                            } else
277
-                                break;
291
+                            } else {
292
+                                                            break;
293
+                            }
278 294
                         }
279 295
                     }
280 296
 
@@ -302,19 +318,24 @@  discard block
 block discarded – undo
302 318
     function fetchlinks($URI)
303 319
     {
304 320
         if ($this->fetch($URI) !== false) {
305
-            if ($this->lastredirectaddr)
306
-                $URI = $this->lastredirectaddr;
321
+            if ($this->lastredirectaddr) {
322
+                            $URI = $this->lastredirectaddr;
323
+            }
307 324
             if (is_array($this->results)) {
308
-                for ($x = 0; $x < count($this->results); $x++)
309
-                    $this->results[$x] = $this->_striplinks($this->results[$x]);
310
-            } else
311
-                $this->results = $this->_striplinks($this->results);
325
+                for ($x = 0; $x < count($this->results); $x++) {
326
+                                    $this->results[$x] = $this->_striplinks($this->results[$x]);
327
+                }
328
+            } else {
329
+                            $this->results = $this->_striplinks($this->results);
330
+            }
312 331
 
313
-            if ($this->expandlinks)
314
-                $this->results = $this->_expandlinks($this->results, $URI);
332
+            if ($this->expandlinks) {
333
+                            $this->results = $this->_expandlinks($this->results, $URI);
334
+            }
315 335
             return $this;
316
-        } else
317
-            return false;
336
+        } else {
337
+                    return false;
338
+        }
318 339
     }
319 340
 
320 341
     /*======================================================================*\
@@ -330,14 +351,17 @@  discard block
 block discarded – undo
330 351
         if ($this->fetch($URI) !== false) {
331 352
 
332 353
             if (is_array($this->results)) {
333
-                for ($x = 0; $x < count($this->results); $x++)
334
-                    $this->results[$x] = $this->_stripform($this->results[$x]);
335
-            } else
336
-                $this->results = $this->_stripform($this->results);
354
+                for ($x = 0; $x < count($this->results); $x++) {
355
+                                    $this->results[$x] = $this->_stripform($this->results[$x]);
356
+                }
357
+            } else {
358
+                            $this->results = $this->_stripform($this->results);
359
+            }
337 360
 
338 361
             return $this;
339
-        } else
340
-            return false;
362
+        } else {
363
+                    return false;
364
+        }
341 365
     }
342 366
 
343 367
 
@@ -352,13 +376,16 @@  discard block
 block discarded – undo
352 376
     {
353 377
         if ($this->fetch($URI) !== false) {
354 378
             if (is_array($this->results)) {
355
-                for ($x = 0; $x < count($this->results); $x++)
356
-                    $this->results[$x] = $this->_striptext($this->results[$x]);
357
-            } else
358
-                $this->results = $this->_striptext($this->results);
379
+                for ($x = 0; $x < count($this->results); $x++) {
380
+                                    $this->results[$x] = $this->_striptext($this->results[$x]);
381
+                }
382
+            } else {
383
+                            $this->results = $this->_striptext($this->results);
384
+            }
359 385
             return $this;
360
-        } else
361
-            return false;
386
+        } else {
387
+                    return false;
388
+        }
362 389
     }
363 390
 
364 391
     /*======================================================================*\
@@ -371,22 +398,26 @@  discard block
 block discarded – undo
371 398
     function submitlinks($URI, $formvars = "", $formfiles = "")
372 399
     {
373 400
         if ($this->submit($URI, $formvars, $formfiles) !== false) {
374
-            if ($this->lastredirectaddr)
375
-                $URI = $this->lastredirectaddr;
401
+            if ($this->lastredirectaddr) {
402
+                            $URI = $this->lastredirectaddr;
403
+            }
376 404
             if (is_array($this->results)) {
377 405
                 for ($x = 0; $x < count($this->results); $x++) {
378 406
                     $this->results[$x] = $this->_striplinks($this->results[$x]);
379
-                    if ($this->expandlinks)
380
-                        $this->results[$x] = $this->_expandlinks($this->results[$x], $URI);
407
+                    if ($this->expandlinks) {
408
+                                            $this->results[$x] = $this->_expandlinks($this->results[$x], $URI);
409
+                    }
381 410
                 }
382 411
             } else {
383 412
                 $this->results = $this->_striplinks($this->results);
384
-                if ($this->expandlinks)
385
-                    $this->results = $this->_expandlinks($this->results, $URI);
413
+                if ($this->expandlinks) {
414
+                                    $this->results = $this->_expandlinks($this->results, $URI);
415
+                }
386 416
             }
387 417
             return $this;
388
-        } else
389
-            return false;
418
+        } else {
419
+                    return false;
420
+        }
390 421
     }
391 422
 
392 423
     /*======================================================================*\
@@ -399,22 +430,26 @@  discard block
 block discarded – undo
399 430
     function submittext($URI, $formvars = "", $formfiles = "")
400 431
     {
401 432
         if ($this->submit($URI, $formvars, $formfiles) !== false) {
402
-            if ($this->lastredirectaddr)
403
-                $URI = $this->lastredirectaddr;
433
+            if ($this->lastredirectaddr) {
434
+                            $URI = $this->lastredirectaddr;
435
+            }
404 436
             if (is_array($this->results)) {
405 437
                 for ($x = 0; $x < count($this->results); $x++) {
406 438
                     $this->results[$x] = $this->_striptext($this->results[$x]);
407
-                    if ($this->expandlinks)
408
-                        $this->results[$x] = $this->_expandlinks($this->results[$x], $URI);
439
+                    if ($this->expandlinks) {
440
+                                            $this->results[$x] = $this->_expandlinks($this->results[$x], $URI);
441
+                    }
409 442
                 }
410 443
             } else {
411 444
                 $this->results = $this->_striptext($this->results);
412
-                if ($this->expandlinks)
413
-                    $this->results = $this->_expandlinks($this->results, $URI);
445
+                if ($this->expandlinks) {
446
+                                    $this->results = $this->_expandlinks($this->results, $URI);
447
+                }
414 448
             }
415 449
             return $this;
416
-        } else
417
-            return false;
450
+        } else {
451
+                    return false;
452
+        }
418 453
     }
419 454
 
420 455
 
@@ -468,13 +503,15 @@  discard block
 block discarded – undo
468 503
         // catenate the non-empty matches from the conditional subpattern
469 504
 
470 505
         while (list($key, $val) = each($links[2])) {
471
-            if (!empty($val))
472
-                $match[] = $val;
506
+            if (!empty($val)) {
507
+                            $match[] = $val;
508
+            }
473 509
         }
474 510
 
475 511
         while (list($key, $val) = each($links[3])) {
476
-            if (!empty($val))
477
-                $match[] = $val;
512
+            if (!empty($val)) {
513
+                            $match[] = $val;
514
+            }
478 515
         }
479 516
 
480 517
         // return the links
@@ -619,23 +656,28 @@  discard block
 block discarded – undo
619 656
     function _httprequest($url, $fp, $URI, $http_method, $content_type = "", $body = "")
620 657
     {
621 658
         $cookie_headers = '';
622
-        if ($this->passcookies && $this->_redirectaddr)
623
-            $this->setcookies();
659
+        if ($this->passcookies && $this->_redirectaddr) {
660
+                    $this->setcookies();
661
+        }
624 662
 
625 663
         $URI_PARTS = parse_url($URI);
626
-        if (empty($url))
627
-            $url = "/";
664
+        if (empty($url)) {
665
+                    $url = "/";
666
+        }
628 667
         $headers = $http_method . " " . $url . " " . $this->_httpversion . "\r\n";
629 668
         if (!empty($this->host) && !isset($this->rawheaders['Host'])) {
630 669
             $headers .= "Host: " . $this->host;
631
-            if (!empty($this->port) && $this->port != '80')
632
-                $headers .= ":" . $this->port;
670
+            if (!empty($this->port) && $this->port != '80') {
671
+                            $headers .= ":" . $this->port;
672
+            }
633 673
             $headers .= "\r\n";
634 674
         }
635
-        if (!empty($this->agent))
636
-            $headers .= "User-Agent: " . $this->agent . "\r\n";
637
-        if (!empty($this->accept))
638
-            $headers .= "Accept: " . $this->accept . "\r\n";
675
+        if (!empty($this->agent)) {
676
+                    $headers .= "User-Agent: " . $this->agent . "\r\n";
677
+        }
678
+        if (!empty($this->accept)) {
679
+                    $headers .= "Accept: " . $this->accept . "\r\n";
680
+        }
639 681
         if ($this->use_gzip) {
640 682
             // make sure PHP was built with --with-zlib
641 683
             // and we can handle gzipp'ed data
@@ -648,11 +690,13 @@  discard block
 block discarded – undo
648 690
                     E_USER_NOTICE);
649 691
             }
650 692
         }
651
-        if (!empty($this->referer))
652
-            $headers .= "Referer: " . $this->referer . "\r\n";
693
+        if (!empty($this->referer)) {
694
+                    $headers .= "Referer: " . $this->referer . "\r\n";
695
+        }
653 696
         if (!empty($this->cookies)) {
654
-            if (!is_array($this->cookies))
655
-                $this->cookies = (array)$this->cookies;
697
+            if (!is_array($this->cookies)) {
698
+                            $this->cookies = (array)$this->cookies;
699
+            }
656 700
 
657 701
             reset($this->cookies);
658 702
             if (count($this->cookies) > 0) {
@@ -664,32 +708,39 @@  discard block
 block discarded – undo
664 708
             }
665 709
         }
666 710
         if (!empty($this->rawheaders)) {
667
-            if (!is_array($this->rawheaders))
668
-                $this->rawheaders = (array)$this->rawheaders;
669
-            while (list($headerKey, $headerVal) = each($this->rawheaders))
670
-                $headers .= $headerKey . ": " . $headerVal . "\r\n";
711
+            if (!is_array($this->rawheaders)) {
712
+                            $this->rawheaders = (array)$this->rawheaders;
713
+            }
714
+            while (list($headerKey, $headerVal) = each($this->rawheaders)) {
715
+                            $headers .= $headerKey . ": " . $headerVal . "\r\n";
716
+            }
671 717
         }
672 718
         if (!empty($content_type)) {
673 719
             $headers .= "Content-type: $content_type";
674
-            if ($content_type == "multipart/form-data")
675
-                $headers .= "; boundary=" . $this->_mime_boundary;
720
+            if ($content_type == "multipart/form-data") {
721
+                            $headers .= "; boundary=" . $this->_mime_boundary;
722
+            }
676 723
             $headers .= "\r\n";
677 724
         }
678
-        if (!empty($body))
679
-            $headers .= "Content-length: " . strlen($body) . "\r\n";
680
-        if (!empty($this->user) || !empty($this->pass))
681
-            $headers .= "Authorization: Basic " . base64_encode($this->user . ":" . $this->pass) . "\r\n";
725
+        if (!empty($body)) {
726
+                    $headers .= "Content-length: " . strlen($body) . "\r\n";
727
+        }
728
+        if (!empty($this->user) || !empty($this->pass)) {
729
+                    $headers .= "Authorization: Basic " . base64_encode($this->user . ":" . $this->pass) . "\r\n";
730
+        }
682 731
 
683 732
         //add proxy auth headers
684
-        if (!empty($this->proxy_user))
685
-            $headers .= 'Proxy-Authorization: ' . 'Basic ' . base64_encode($this->proxy_user . ':' . $this->proxy_pass) . "\r\n";
733
+        if (!empty($this->proxy_user)) {
734
+                    $headers .= 'Proxy-Authorization: ' . 'Basic ' . base64_encode($this->proxy_user . ':' . $this->proxy_pass) . "\r\n";
735
+        }
686 736
 
687 737
 
688 738
         $headers .= "\r\n";
689 739
 
690 740
         // set the read timeout if needed
691
-        if ($this->read_timeout > 0)
692
-            socket_set_timeout($fp, $this->read_timeout);
741
+        if ($this->read_timeout > 0) {
742
+                    socket_set_timeout($fp, $this->read_timeout);
743
+        }
693 744
         $this->timed_out = false;
694 745
 
695 746
         fwrite($fp, $headers . $body, strlen($headers . $body));
@@ -706,8 +757,9 @@  discard block
 block discarded – undo
706 757
                 return false;
707 758
             }
708 759
 
709
-            if ($currentHeader == "\r\n")
710
-                break;
760
+            if ($currentHeader == "\r\n") {
761
+                            break;
762
+            }
711 763
 
712 764
             // if a header begins with Location: or URI:, set the redirect
713 765
             if (preg_match("/^(Location:|URI:)/i", $currentHeader)) {
@@ -718,12 +770,14 @@  discard block
 block discarded – undo
718 770
                     // no host in the path, so prepend
719 771
                     $this->_redirectaddr = $URI_PARTS["scheme"] . "://" . $this->host . ":" . $this->port;
720 772
                     // eliminate double slash
721
-                    if (!preg_match("|^/|", $matches[2]))
722
-                        $this->_redirectaddr .= "/" . $matches[2];
723
-                    else
724
-                        $this->_redirectaddr .= $matches[2];
725
-                } else
726
-                    $this->_redirectaddr = $matches[2];
773
+                    if (!preg_match("|^/|", $matches[2])) {
774
+                                            $this->_redirectaddr .= "/" . $matches[2];
775
+                    } else {
776
+                                            $this->_redirectaddr .= $matches[2];
777
+                    }
778
+                } else {
779
+                                    $this->_redirectaddr = $matches[2];
780
+                }
727 781
             }
728 782
 
729 783
             if (preg_match("|^HTTP/|", $currentHeader)) {
@@ -770,14 +824,17 @@  discard block
 block discarded – undo
770 824
         // have we hit our frame depth and is there frame src to fetch?
771 825
         if (($this->_framedepth < $this->maxframes) && preg_match_all("'<frame\s+.*src[\s]*=[\'\"]?([^\'\"\>]+)'i", $results, $match)) {
772 826
             $this->results[] = $results;
773
-            for ($x = 0; $x < count($match[1]); $x++)
774
-                $this->_frameurls[] = $this->_expandlinks($match[1][$x], $URI_PARTS["scheme"] . "://" . $this->host);
827
+            for ($x = 0; $x < count($match[1]); $x++) {
828
+                            $this->_frameurls[] = $this->_expandlinks($match[1][$x], $URI_PARTS["scheme"] . "://" . $this->host);
829
+            }
775 830
         } // have we already fetched framed content?
776
-        elseif (is_array($this->results))
777
-            $this->results[] = $results;
831
+        elseif (is_array($this->results)) {
832
+                    $this->results[] = $results;
833
+        }
778 834
         // no framed content
779
-        else
780
-            $this->results = $results;
835
+        else {
836
+                    $this->results = $results;
837
+        }
781 838
 
782 839
         return $this;
783 840
     }
@@ -790,8 +847,9 @@  discard block
 block discarded – undo
790 847
     function setcookies()
791 848
     {
792 849
         for ($x = 0; $x < count($this->headers); $x++) {
793
-            if (preg_match('/^set-cookie:[\s]+([^=]+)=([^;]+)/i', $this->headers[$x], $match))
794
-                $this->cookies[$match[1]] = urldecode($match[2]);
850
+            if (preg_match('/^set-cookie:[\s]+([^=]+)=([^;]+)/i', $this->headers[$x], $match)) {
851
+                            $this->cookies[$match[1]] = urldecode($match[2]);
852
+            }
795 853
         }
796 854
         return $this;
797 855
     }
@@ -852,10 +910,12 @@  discard block
 block discarded – undo
852 910
                     'disable_compression' => true,
853 911
                 );
854 912
 
855
-                if (isset($this->cafile))
856
-                    $context_opts['ssl']['cafile'] = $this->cafile;
857
-                if (isset($this->capath))
858
-                    $context_opts['ssl']['capath'] = $this->capath;
913
+                if (isset($this->cafile)) {
914
+                                    $context_opts['ssl']['cafile'] = $this->cafile;
915
+                }
916
+                if (isset($this->capath)) {
917
+                                    $context_opts['ssl']['capath'] = $this->capath;
918
+                }
859 919
             }
860 920
                     
861 921
             $host = 'ssl://' . $host;
@@ -864,8 +924,9 @@  discard block
 block discarded – undo
864 924
         $context = stream_context_create($context_opts);
865 925
 
866 926
         if (version_compare(PHP_VERSION, '5.0.0', '>')) {
867
-            if($this->scheme == 'http')
868
-                $host = "tcp://" . $host;
927
+            if($this->scheme == 'http') {
928
+                            $host = "tcp://" . $host;
929
+            }
869 930
             $fp = stream_socket_client(
870 931
                 "$host:$port",
871 932
                 $errno,
@@ -929,8 +990,9 @@  discard block
 block discarded – undo
929 990
         settype($formfiles, "array");
930 991
         $postdata = '';
931 992
 
932
-        if (count($formvars) == 0 && count($formfiles) == 0)
933
-            return;
993
+        if (count($formvars) == 0 && count($formfiles) == 0) {
994
+                    return;
995
+        }
934 996
 
935 997
         switch ($this->_submit_type) {
936 998
             case "application/x-www-form-urlencoded":
@@ -940,8 +1002,9 @@  discard block
 block discarded – undo
940 1002
                         while (list($cur_key, $cur_val) = each($val)) {
941 1003
                             $postdata .= urlencode($key) . "[]=" . urlencode($cur_val) . "&";
942 1004
                         }
943
-                    } else
944
-                        $postdata .= urlencode($key) . "=" . urlencode($val) . "&";
1005
+                    } else {
1006
+                                            $postdata .= urlencode($key) . "=" . urlencode($val) . "&";
1007
+                    }
945 1008
                 }
946 1009
                 break;
947 1010
 
@@ -967,7 +1030,9 @@  discard block
 block discarded – undo
967 1030
                 while (list($field_name, $file_names) = each($formfiles)) {
968 1031
                     settype($file_names, "array");
969 1032
                     while (list(, $file_name) = each($file_names)) {
970
-                        if (!is_readable($file_name)) continue;
1033
+                        if (!is_readable($file_name)) {
1034
+                            continue;
1035
+                        }
971 1036
 
972 1037
                         $fp = fopen($file_name, "r");
973 1038
                         $file_content = fread($fp, filesize($file_name));
Please login to merge, or discard this patch.
manager/media/rss/rss_fetch.inc 4 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -243,6 +243,9 @@  discard block
 block discarded – undo
243 243
         }
244 244
 }
245 245
 
246
+/**
247
+ * @param integer $lvl
248
+ */
246 249
 function debug ($debugmsg, $lvl=E_USER_NOTICE) {
247 250
     trigger_error("MagpieRSS [debug] $debugmsg", $lvl);
248 251
 }
@@ -289,6 +292,9 @@  discard block
 block discarded – undo
289 292
     Input:      an HTTP response object (see Snoopy)
290 293
     Output:     parsed RSS object (see rss_parse)
291 294
 \*=======================================================================*/
295
+/**
296
+ * @param Snoopy $resp
297
+ */
292 298
 function _response_to_rss ($resp) {
293 299
     $rss = new MagpieRSS( $resp->results, MAGPIE_OUTPUT_ENCODING, MAGPIE_INPUT_ENCODING, MAGPIE_DETECT_ENCODING );
294 300
     
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -166,7 +166,7 @@
 block discarded – undo
166 166
         $resp = _fetch_remote_file( $url, $request_headers );
167 167
         
168 168
         if (isset($resp) and $resp) {
169
-          if ($resp->status == '304' ) {
169
+            if ($resp->status == '304' ) {
170 170
                 // we have the most current copy
171 171
                 if ( MAGPIE_DEBUG > 1) {
172 172
                     debug("Got 304 for $url");
Please login to merge, or discard this patch.
Spacing   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -24,19 +24,19 @@  discard block
 block discarded – undo
24 24
 }
25 25
 
26 26
 if (!defined('MAGPIE_DIR')) {
27
-    define('MAGPIE_DIR', dirname(__FILE__) . DIR_SEP);
27
+    define('MAGPIE_DIR', dirname(__FILE__).DIR_SEP);
28 28
 }
29 29
 
30 30
 if (!defined('MAGPIE_CACHE_DIR')) {
31
-    define('MAGPIE_CACHE_DIR', MODX_BASE_PATH . 'assets/cache/rss');
31
+    define('MAGPIE_CACHE_DIR', MODX_BASE_PATH.'assets/cache/rss');
32 32
 }
33 33
 
34
-require_once( MAGPIE_DIR . 'rss_parse.inc' );
35
-require_once( MAGPIE_DIR . 'rss_cache.inc' );
34
+require_once(MAGPIE_DIR.'rss_parse.inc');
35
+require_once(MAGPIE_DIR.'rss_cache.inc');
36 36
 
37 37
 // for including 3rd party libraries
38
-define('MAGPIE_EXTLIB', MAGPIE_DIR . 'extlib' . DIR_SEP);
39
-require_once( MAGPIE_EXTLIB . 'Snoopy.class.inc');
38
+define('MAGPIE_EXTLIB', MAGPIE_DIR.'extlib'.DIR_SEP);
39
+require_once(MAGPIE_EXTLIB.'Snoopy.class.inc');
40 40
 
41 41
 
42 42
 /*
@@ -89,21 +89,21 @@  discard block
 block discarded – undo
89 89
 
90 90
 $MAGPIE_ERROR = "";
91 91
 
92
-function fetch_rss ($url) {
92
+function fetch_rss($url){
93 93
     // initialize constants
94 94
     init();
95 95
 
96
-    if ( !isset($url) ) {
96
+    if (!isset($url)) {
97 97
         error("fetch_rss called without a url");
98 98
         return false;
99 99
     }
100 100
 
101 101
     // if cache is disabled
102
-    if ( !MAGPIE_CACHE_ON ) {
102
+    if (!MAGPIE_CACHE_ON) {
103 103
         // fetch file, and parse it
104
-        $resp = _fetch_remote_file( $url );
105
-        if ( is_success( $resp->status ) ) {
106
-            return _response_to_rss( $resp );
104
+        $resp = _fetch_remote_file($url);
105
+        if (is_success($resp->status)) {
106
+            return _response_to_rss($resp);
107 107
         }
108 108
         else {
109 109
             error("Failed to fetch $url and cache is off");
@@ -118,34 +118,34 @@  discard block
 block discarded – undo
118 118
         // 3. if cached obj fails freshness check, fetch remote
119 119
         // 4. if remote fails, return stale object, or error
120 120
 
121
-        $cache = new RSSCache( MAGPIE_CACHE_DIR, MAGPIE_CACHE_AGE );
121
+        $cache = new RSSCache(MAGPIE_CACHE_DIR, MAGPIE_CACHE_AGE);
122 122
 
123 123
         if (MAGPIE_DEBUG and $cache->ERROR) {
124 124
             debug($cache->ERROR, E_USER_WARNING);
125 125
         }
126 126
 
127 127
 
128
-        $cache_status    = 0;       // response of check_cache
128
+        $cache_status    = 0; // response of check_cache
129 129
         $request_headers = array(); // HTTP headers to send with fetch
130
-        $rss             = 0;       // parsed RSS object
131
-        $errormsg        = 0;       // errors, if any
130
+        $rss             = 0; // parsed RSS object
131
+        $errormsg        = 0; // errors, if any
132 132
 
133 133
         // store parsed XML by desired output encoding
134 134
         // as character munging happens at parse time
135
-        $cache_key       = $url . MAGPIE_OUTPUT_ENCODING;
135
+        $cache_key = $url.MAGPIE_OUTPUT_ENCODING;
136 136
 
137 137
         if (!$cache->ERROR) {
138 138
             // return cache HIT, MISS, or STALE
139
-            $cache_status = $cache->check_cache( $cache_key);
139
+            $cache_status = $cache->check_cache($cache_key);
140 140
         }
141 141
 
142 142
         // if object cached, and cache is fresh, return cached obj
143
-        if ( $cache_status == 'HIT' ) {
144
-            $rss = $cache->get( $cache_key );
145
-            if ( isset($rss) and $rss ) {
143
+        if ($cache_status == 'HIT') {
144
+            $rss = $cache->get($cache_key);
145
+            if (isset($rss) and $rss) {
146 146
                 // should be cache age
147 147
                 $rss->from_cache = 1;
148
-                if ( MAGPIE_DEBUG > 1) {
148
+                if (MAGPIE_DEBUG > 1) {
149 149
                     debug("MagpieRSS: Cache HIT", E_USER_NOTICE);
150 150
                 }
151 151
                 return $rss;
@@ -155,50 +155,50 @@  discard block
 block discarded – undo
155 155
         // else attempt a conditional get
156 156
 
157 157
         // setup headers
158
-        if ( $cache_status == 'STALE' ) {
159
-            $rss = $cache->get( $cache_key );
160
-            if ( $rss and $rss->etag and $rss->last_modified ) {
158
+        if ($cache_status == 'STALE') {
159
+            $rss = $cache->get($cache_key);
160
+            if ($rss and $rss->etag and $rss->last_modified) {
161 161
                 $request_headers['If-None-Match'] = $rss->etag;
162 162
                 $request_headers['If-Last-Modified'] = $rss->last_modified;
163 163
             }
164 164
         }
165 165
 
166
-        $resp = _fetch_remote_file( $url, $request_headers );
166
+        $resp = _fetch_remote_file($url, $request_headers);
167 167
 
168 168
         if (isset($resp) and $resp) {
169
-          if ($resp->status == '304' ) {
169
+          if ($resp->status == '304') {
170 170
                 // we have the most current copy
171
-                if ( MAGPIE_DEBUG > 1) {
171
+                if (MAGPIE_DEBUG > 1) {
172 172
                     debug("Got 304 for $url");
173 173
                 }
174 174
                 // reset cache on 304 (at minutillo insistent prodding)
175 175
                 $cache->set($cache_key, $rss);
176 176
                 return $rss;
177 177
             }
178
-            elseif ( is_success( $resp->status ) ) {
179
-                $rss = _response_to_rss( $resp );
180
-                if ( $rss ) {
178
+            elseif (is_success($resp->status)) {
179
+                $rss = _response_to_rss($resp);
180
+                if ($rss) {
181 181
                     if (MAGPIE_DEBUG > 1) {
182 182
                         debug("Fetch successful");
183 183
                     }
184 184
                     // add object to cache
185
-                    $cache->set( $cache_key, $rss );
185
+                    $cache->set($cache_key, $rss);
186 186
                     return $rss;
187 187
                 }
188 188
             }
189 189
             else {
190 190
                 $errormsg = "Failed to fetch $url ";
191
-                if ( $resp->status == '-100' ) {
192
-                    $errormsg .= "(Request timed out after " . MAGPIE_FETCH_TIME_OUT . " seconds)";
191
+                if ($resp->status == '-100') {
192
+                    $errormsg .= "(Request timed out after ".MAGPIE_FETCH_TIME_OUT." seconds)";
193 193
                 }
194
-                elseif ( $resp->error ) {
194
+                elseif ($resp->error) {
195 195
                     # compensate for Snoopy's annoying habbit to tacking
196 196
                     # on '\n'
197 197
                     $http_error = substr($resp->error, 0, -2);
198 198
                     $errormsg .= "(HTTP Error: $http_error)";
199 199
                 }
200 200
                 else {
201
-                    $errormsg .=  "(HTTP Response: " . $resp->response_code .')';
201
+                    $errormsg .= "(HTTP Response: ".$resp->response_code.')';
202 202
                 }
203 203
             }
204 204
         }
@@ -210,14 +210,14 @@  discard block
 block discarded – undo
210 210
 
211 211
         // attempt to return cached object
212 212
         if ($rss) {
213
-            if ( MAGPIE_DEBUG ) {
213
+            if (MAGPIE_DEBUG) {
214 214
                 debug("Returning STALE object for $url");
215 215
             }
216 216
             return $rss;
217 217
         }
218 218
 
219 219
         // else we totally failed
220
-        error( $errormsg );
220
+        error($errormsg);
221 221
 
222 222
         return false;
223 223
 
@@ -229,21 +229,21 @@  discard block
 block discarded – undo
229 229
     Purpose:    set MAGPIE_ERROR, and trigger error
230 230
 \*=======================================================================*/
231 231
 
232
-function error ($errormsg, $lvl=E_USER_WARNING) {
232
+function error($errormsg, $lvl = E_USER_WARNING){
233 233
         global $MAGPIE_ERROR;
234 234
 
235 235
         // append PHP's error message if track_errors enabled
236
-        if ( isset($php_errormsg) ) {
236
+        if (isset($php_errormsg)) {
237 237
             $errormsg .= " ($php_errormsg)";
238 238
         }
239
-        if ( $errormsg ) {
239
+        if ($errormsg) {
240 240
             $errormsg = "MagpieRSS: $errormsg";
241 241
             $MAGPIE_ERROR = $errormsg;
242
-            trigger_error( $errormsg, $lvl);
242
+            trigger_error($errormsg, $lvl);
243 243
         }
244 244
 }
245 245
 
246
-function debug ($debugmsg, $lvl=E_USER_NOTICE) {
246
+function debug($debugmsg, $lvl = E_USER_NOTICE){
247 247
     trigger_error("MagpieRSS [debug] $debugmsg", $lvl);
248 248
 }
249 249
 
@@ -251,10 +251,10 @@  discard block
 block discarded – undo
251 251
     Function:   magpie_error
252 252
     Purpose:    accessor for the magpie error variable
253 253
 \*=======================================================================*/
254
-function magpie_error ($errormsg="") {
254
+function magpie_error($errormsg = ""){
255 255
     global $MAGPIE_ERROR;
256 256
 
257
-    if ( isset($errormsg) and $errormsg ) {
257
+    if (isset($errormsg) and $errormsg) {
258 258
         $MAGPIE_ERROR = $errormsg;
259 259
     }
260 260
 
@@ -268,13 +268,13 @@  discard block
 block discarded – undo
268 268
                 headers to send along with the request (optional)
269 269
     Output:     an HTTP response object (see Snoopy.class.inc)
270 270
 \*=======================================================================*/
271
-function _fetch_remote_file ($url, $headers = "" ) {
271
+function _fetch_remote_file($url, $headers = ""){
272 272
     // Snoopy is an HTTP client in PHP
273 273
     $client = new Snoopy();
274 274
     $client->agent = MAGPIE_USER_AGENT;
275 275
     $client->read_timeout = MAGPIE_FETCH_TIME_OUT;
276 276
     $client->use_gzip = MAGPIE_USE_GZIP;
277
-    if (is_array($headers) ) {
277
+    if (is_array($headers)) {
278 278
         $client->rawheaders = $headers;
279 279
     }
280 280
 
@@ -289,14 +289,14 @@  discard block
 block discarded – undo
289 289
     Input:      an HTTP response object (see Snoopy)
290 290
     Output:     parsed RSS object (see rss_parse)
291 291
 \*=======================================================================*/
292
-function _response_to_rss ($resp) {
293
-    $rss = new MagpieRSS( $resp->results, MAGPIE_OUTPUT_ENCODING, MAGPIE_INPUT_ENCODING, MAGPIE_DETECT_ENCODING );
292
+function _response_to_rss($resp){
293
+    $rss = new MagpieRSS($resp->results, MAGPIE_OUTPUT_ENCODING, MAGPIE_INPUT_ENCODING, MAGPIE_DETECT_ENCODING);
294 294
 
295 295
     // if RSS parsed successfully
296
-    if ( $rss and !$rss->ERROR) {
296
+    if ($rss and !$rss->ERROR) {
297 297
 
298 298
         // find Etag, and Last-Modified
299
-        foreach($resp->headers as $h) {
299
+        foreach ($resp->headers as $h) {
300 300
             // 2003-03-02 - Nicola Asuni (www.tecnick.com) - fixed bug "Undefined offset: 1"
301 301
             if (strpos($h, ": ")) {
302 302
                 list($field, $val) = explode(": ", $h, 2);
@@ -306,11 +306,11 @@  discard block
 block discarded – undo
306 306
                 $val = "";
307 307
             }
308 308
 
309
-            if ( $field == 'ETag' ) {
309
+            if ($field == 'ETag') {
310 310
                 $rss->etag = $val;
311 311
             }
312 312
 
313
-            if ( $field == 'Last-Modified' ) {
313
+            if ($field == 'Last-Modified') {
314 314
                 $rss->last_modified = $val;
315 315
             }
316 316
         }
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
         $errormsg = "Failed to parse RSS file.";
322 322
 
323 323
         if ($rss) {
324
-            $errormsg .= " (" . $rss->ERROR . ")";
324
+            $errormsg .= " (".$rss->ERROR.")";
325 325
         }
326 326
         error($errormsg);
327 327
 
@@ -334,67 +334,67 @@  discard block
 block discarded – undo
334 334
     Purpose:    setup constants with default values
335 335
                 check for user overrides
336 336
 \*=======================================================================*/
337
-function init () {
338
-    if ( defined('MAGPIE_INITALIZED') ) {
337
+function init(){
338
+    if (defined('MAGPIE_INITALIZED')) {
339 339
         return;
340 340
     }
341 341
     else {
342 342
         define('MAGPIE_INITALIZED', true);
343 343
     }
344 344
 
345
-    if ( !defined('MAGPIE_CACHE_ON') ) {
345
+    if (!defined('MAGPIE_CACHE_ON')) {
346 346
         define('MAGPIE_CACHE_ON', true);
347 347
     }
348 348
 
349
-    if ( !defined('MAGPIE_CACHE_DIR') ) {
349
+    if (!defined('MAGPIE_CACHE_DIR')) {
350 350
         define('MAGPIE_CACHE_DIR', './cache');
351 351
     }
352 352
 
353
-    if ( !defined('MAGPIE_CACHE_AGE') ) {
354
-        define('MAGPIE_CACHE_AGE', 60*60); // one hour
353
+    if (!defined('MAGPIE_CACHE_AGE')) {
354
+        define('MAGPIE_CACHE_AGE', 60 * 60); // one hour
355 355
     }
356 356
 
357
-    if ( !defined('MAGPIE_CACHE_FRESH_ONLY') ) {
357
+    if (!defined('MAGPIE_CACHE_FRESH_ONLY')) {
358 358
         define('MAGPIE_CACHE_FRESH_ONLY', false);
359 359
     }
360 360
 
361
-    if ( !defined('MAGPIE_OUTPUT_ENCODING') ) {
361
+    if (!defined('MAGPIE_OUTPUT_ENCODING')) {
362 362
         global $modx_manager_charset;
363
-        if(empty($modx_manager_charset)) $modx_manager_charset = 'ISO-8859-1';
363
+        if (empty($modx_manager_charset)) $modx_manager_charset = 'ISO-8859-1';
364 364
         define('MAGPIE_OUTPUT_ENCODING', $modx_manager_charset);
365 365
     }
366 366
 
367
-    if ( !defined('MAGPIE_INPUT_ENCODING') ) {
367
+    if (!defined('MAGPIE_INPUT_ENCODING')) {
368 368
         define('MAGPIE_INPUT_ENCODING', null);
369 369
     }
370 370
 
371
-    if ( !defined('MAGPIE_DETECT_ENCODING') ) {
371
+    if (!defined('MAGPIE_DETECT_ENCODING')) {
372 372
         define('MAGPIE_DETECT_ENCODING', true);
373 373
     }
374 374
 
375
-    if ( !defined('MAGPIE_DEBUG') ) {
375
+    if (!defined('MAGPIE_DEBUG')) {
376 376
         define('MAGPIE_DEBUG', 0);
377 377
     }
378 378
 
379
-    if ( !defined('MAGPIE_USER_AGENT') ) {
380
-        $ua = 'MagpieRSS/'. MAGPIE_VERSION . ' (+http://magpierss.sf.net';
379
+    if (!defined('MAGPIE_USER_AGENT')) {
380
+        $ua = 'MagpieRSS/'.MAGPIE_VERSION.' (+http://magpierss.sf.net';
381 381
 
382
-        if ( MAGPIE_CACHE_ON ) {
383
-            $ua = $ua . ')';
382
+        if (MAGPIE_CACHE_ON) {
383
+            $ua = $ua.')';
384 384
         }
385 385
         else {
386
-            $ua = $ua . '; No cache)';
386
+            $ua = $ua.'; No cache)';
387 387
         }
388 388
 
389 389
         define('MAGPIE_USER_AGENT', $ua);
390 390
     }
391 391
 
392
-    if ( !defined('MAGPIE_FETCH_TIME_OUT') ) {
392
+    if (!defined('MAGPIE_FETCH_TIME_OUT')) {
393 393
         define('MAGPIE_FETCH_TIME_OUT', 5); // 5 second timeout
394 394
     }
395 395
 
396 396
     // use gzip encoding to fetch rss files if supported?
397
-    if ( !defined('MAGPIE_USE_GZIP') ) {
397
+    if (!defined('MAGPIE_USE_GZIP')) {
398 398
         define('MAGPIE_USE_GZIP', true);
399 399
     }
400 400
 }
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
     Function:   is_info
418 418
     Purpose:    return true if Informational status code
419 419
 \*=======================================================================*/
420
-function is_info ($sc) {
420
+function is_info($sc){
421 421
     return $sc >= 100 && $sc < 200;
422 422
 }
423 423
 
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
     Function:   is_success
426 426
     Purpose:    return true if Successful status code
427 427
 \*=======================================================================*/
428
-function is_success ($sc) {
428
+function is_success($sc){
429 429
     return $sc >= 200 && $sc < 300;
430 430
 }
431 431
 
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
     Function:   is_redirect
434 434
     Purpose:    return true if Redirection status code
435 435
 \*=======================================================================*/
436
-function is_redirect ($sc) {
436
+function is_redirect($sc){
437 437
     return $sc >= 300 && $sc < 400;
438 438
 }
439 439
 
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
     Function:   is_error
442 442
     Purpose:    return true if Error status code
443 443
 \*=======================================================================*/
444
-function is_error ($sc) {
444
+function is_error($sc){
445 445
     return $sc >= 400 && $sc < 600;
446 446
 }
447 447
 
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
     Function:   is_client_error
450 450
     Purpose:    return true if Error status code, and its a client error
451 451
 \*=======================================================================*/
452
-function is_client_error ($sc) {
452
+function is_client_error($sc){
453 453
     return $sc >= 400 && $sc < 500;
454 454
 }
455 455
 
@@ -457,6 +457,6 @@  discard block
 block discarded – undo
457 457
     Function:   is_client_error
458 458
     Purpose:    return true if Error status code, and its a server error
459 459
 \*=======================================================================*/
460
-function is_server_error ($sc) {
460
+function is_server_error($sc){
461 461
     return $sc >= 500 && $sc < 600;
462 462
 }
Please login to merge, or discard this patch.
Braces   +38 added lines, -32 removed lines patch added patch discarded remove patch
@@ -89,7 +89,8 @@  discard block
 block discarded – undo
89 89
 
90 90
 $MAGPIE_ERROR = "";
91 91
 
92
-function fetch_rss ($url) {
92
+function fetch_rss ($url)
93
+{
93 94
     // initialize constants
94 95
     init();
95 96
 
@@ -104,8 +105,7 @@  discard block
 block discarded – undo
104 105
         $resp = _fetch_remote_file( $url );
105 106
         if ( is_success( $resp->status ) ) {
106 107
             return _response_to_rss( $resp );
107
-        }
108
-        else {
108
+        } else {
109 109
             error("Failed to fetch $url and cache is off");
110 110
             return false;
111 111
         }
@@ -174,8 +174,7 @@  discard block
 block discarded – undo
174 174
                 // reset cache on 304 (at minutillo insistent prodding)
175 175
                 $cache->set($cache_key, $rss);
176 176
                 return $rss;
177
-            }
178
-            elseif ( is_success( $resp->status ) ) {
177
+            } elseif ( is_success( $resp->status ) ) {
179 178
                 $rss = _response_to_rss( $resp );
180 179
                 if ( $rss ) {
181 180
                     if (MAGPIE_DEBUG > 1) {
@@ -185,24 +184,20 @@  discard block
 block discarded – undo
185 184
                     $cache->set( $cache_key, $rss );
186 185
                     return $rss;
187 186
                 }
188
-            }
189
-            else {
187
+            } else {
190 188
                 $errormsg = "Failed to fetch $url ";
191 189
                 if ( $resp->status == '-100' ) {
192 190
                     $errormsg .= "(Request timed out after " . MAGPIE_FETCH_TIME_OUT . " seconds)";
193
-                }
194
-                elseif ( $resp->error ) {
191
+                } elseif ( $resp->error ) {
195 192
                     # compensate for Snoopy's annoying habbit to tacking
196 193
                     # on '\n'
197 194
                     $http_error = substr($resp->error, 0, -2);
198 195
                     $errormsg .= "(HTTP Error: $http_error)";
199
-                }
200
-                else {
196
+                } else {
201 197
                     $errormsg .=  "(HTTP Response: " . $resp->response_code .')';
202 198
                 }
203 199
             }
204
-        }
205
-        else {
200
+        } else {
206 201
             $errormsg = "Unable to retrieve RSS file for unknown reasons.";
207 202
         }
208 203
 
@@ -229,7 +224,8 @@  discard block
 block discarded – undo
229 224
     Purpose:    set MAGPIE_ERROR, and trigger error
230 225
 \*=======================================================================*/
231 226
 
232
-function error ($errormsg, $lvl=E_USER_WARNING) {
227
+function error ($errormsg, $lvl=E_USER_WARNING)
228
+{
233 229
         global $MAGPIE_ERROR;
234 230
 
235 231
         // append PHP's error message if track_errors enabled
@@ -243,7 +239,8 @@  discard block
 block discarded – undo
243 239
         }
244 240
 }
245 241
 
246
-function debug ($debugmsg, $lvl=E_USER_NOTICE) {
242
+function debug ($debugmsg, $lvl=E_USER_NOTICE)
243
+{
247 244
     trigger_error("MagpieRSS [debug] $debugmsg", $lvl);
248 245
 }
249 246
 
@@ -251,7 +248,8 @@  discard block
 block discarded – undo
251 248
     Function:   magpie_error
252 249
     Purpose:    accessor for the magpie error variable
253 250
 \*=======================================================================*/
254
-function magpie_error ($errormsg="") {
251
+function magpie_error ($errormsg="")
252
+{
255 253
     global $MAGPIE_ERROR;
256 254
 
257 255
     if ( isset($errormsg) and $errormsg ) {
@@ -268,7 +266,8 @@  discard block
 block discarded – undo
268 266
                 headers to send along with the request (optional)
269 267
     Output:     an HTTP response object (see Snoopy.class.inc)
270 268
 \*=======================================================================*/
271
-function _fetch_remote_file ($url, $headers = "" ) {
269
+function _fetch_remote_file ($url, $headers = "" )
270
+{
272 271
     // Snoopy is an HTTP client in PHP
273 272
     $client = new Snoopy();
274 273
     $client->agent = MAGPIE_USER_AGENT;
@@ -289,7 +288,8 @@  discard block
 block discarded – undo
289 288
     Input:      an HTTP response object (see Snoopy)
290 289
     Output:     parsed RSS object (see rss_parse)
291 290
 \*=======================================================================*/
292
-function _response_to_rss ($resp) {
291
+function _response_to_rss ($resp)
292
+{
293 293
     $rss = new MagpieRSS( $resp->results, MAGPIE_OUTPUT_ENCODING, MAGPIE_INPUT_ENCODING, MAGPIE_DETECT_ENCODING );
294 294
 
295 295
     // if RSS parsed successfully
@@ -300,8 +300,7 @@  discard block
 block discarded – undo
300 300
             // 2003-03-02 - Nicola Asuni (www.tecnick.com) - fixed bug "Undefined offset: 1"
301 301
             if (strpos($h, ": ")) {
302 302
                 list($field, $val) = explode(": ", $h, 2);
303
-            }
304
-            else {
303
+            } else {
305 304
                 $field = $h;
306 305
                 $val = "";
307 306
             }
@@ -334,11 +333,11 @@  discard block
 block discarded – undo
334 333
     Purpose:    setup constants with default values
335 334
                 check for user overrides
336 335
 \*=======================================================================*/
337
-function init () {
336
+function init ()
337
+{
338 338
     if ( defined('MAGPIE_INITALIZED') ) {
339 339
         return;
340
-    }
341
-    else {
340
+    } else {
342 341
         define('MAGPIE_INITALIZED', true);
343 342
     }
344 343
 
@@ -360,7 +359,9 @@  discard block
 block discarded – undo
360 359
 
361 360
     if ( !defined('MAGPIE_OUTPUT_ENCODING') ) {
362 361
         global $modx_manager_charset;
363
-        if(empty($modx_manager_charset)) $modx_manager_charset = 'ISO-8859-1';
362
+        if(empty($modx_manager_charset)) {
363
+            $modx_manager_charset = 'ISO-8859-1';
364
+        }
364 365
         define('MAGPIE_OUTPUT_ENCODING', $modx_manager_charset);
365 366
     }
366 367
 
@@ -381,8 +382,7 @@  discard block
 block discarded – undo
381 382
 
382 383
         if ( MAGPIE_CACHE_ON ) {
383 384
             $ua = $ua . ')';
384
-        }
385
-        else {
385
+        } else {
386 386
             $ua = $ua . '; No cache)';
387 387
         }
388 388
 
@@ -417,7 +417,8 @@  discard block
 block discarded – undo
417 417
     Function:   is_info
418 418
     Purpose:    return true if Informational status code
419 419
 \*=======================================================================*/
420
-function is_info ($sc) {
420
+function is_info ($sc)
421
+{
421 422
     return $sc >= 100 && $sc < 200;
422 423
 }
423 424
 
@@ -425,7 +426,8 @@  discard block
 block discarded – undo
425 426
     Function:   is_success
426 427
     Purpose:    return true if Successful status code
427 428
 \*=======================================================================*/
428
-function is_success ($sc) {
429
+function is_success ($sc)
430
+{
429 431
     return $sc >= 200 && $sc < 300;
430 432
 }
431 433
 
@@ -433,7 +435,8 @@  discard block
 block discarded – undo
433 435
     Function:   is_redirect
434 436
     Purpose:    return true if Redirection status code
435 437
 \*=======================================================================*/
436
-function is_redirect ($sc) {
438
+function is_redirect ($sc)
439
+{
437 440
     return $sc >= 300 && $sc < 400;
438 441
 }
439 442
 
@@ -441,7 +444,8 @@  discard block
 block discarded – undo
441 444
     Function:   is_error
442 445
     Purpose:    return true if Error status code
443 446
 \*=======================================================================*/
444
-function is_error ($sc) {
447
+function is_error ($sc)
448
+{
445 449
     return $sc >= 400 && $sc < 600;
446 450
 }
447 451
 
@@ -449,7 +453,8 @@  discard block
 block discarded – undo
449 453
     Function:   is_client_error
450 454
     Purpose:    return true if Error status code, and its a client error
451 455
 \*=======================================================================*/
452
-function is_client_error ($sc) {
456
+function is_client_error ($sc)
457
+{
453 458
     return $sc >= 400 && $sc < 500;
454 459
 }
455 460
 
@@ -457,6 +462,7 @@  discard block
 block discarded – undo
457 462
     Function:   is_client_error
458 463
     Purpose:    return true if Error status code, and its a server error
459 464
 \*=======================================================================*/
460
-function is_server_error ($sc) {
465
+function is_server_error ($sc)
466
+{
461 467
     return $sc >= 500 && $sc < 600;
462 468
 }
Please login to merge, or discard this patch.
install/setup.info.php 4 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@
 block discarded – undo
36 36
                 $params['modx_category'],
37 37
                 $params['lock_template'],
38 38
                 array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false,
39
-                isset($params['save_sql_id_as']) ? $params['save_sql_id_as'] : NULL // Nessecary to fix template-ID for demo-site
39
+                isset($params['save_sql_id_as']) ? $params['save_sql_id_as'] : null // Nessecary to fix template-ID for demo-site
40 40
             );
41 41
         }
42 42
     }
Please login to merge, or discard this patch.
Braces   +23 added lines, -15 removed lines patch added patch discarded remove patch
@@ -4,7 +4,9 @@  discard block
 block discarded – undo
4 4
 if (is_file($base_path . 'assets/cache/siteManager.php')) {
5 5
     include_once($base_path . 'assets/cache/siteManager.php');
6 6
 }
7
-if(!defined('MGR_DIR')) define('MGR_DIR', 'manager');
7
+if(!defined('MGR_DIR')) {
8
+    define('MGR_DIR', 'manager');
9
+}
8 10
 
9 11
 require_once('../'.MGR_DIR.'/includes/version.inc.php');
10 12
 
@@ -19,12 +21,12 @@  discard block
 block discarded – undo
19 21
 $mt = &$moduleTemplates;
20 22
 if(is_dir($templatePath) && is_readable($templatePath)) {
21 23
     $d = dir($templatePath);
22
-    while (false !== ($tplfile = $d->read()))
23
-    {
24
-        if(substr($tplfile, -4) != '.tpl') continue;
24
+    while (false !== ($tplfile = $d->read())) {
25
+        if(substr($tplfile, -4) != '.tpl') {
26
+            continue;
27
+        }
25 28
         $params = parse_docblock($templatePath, $tplfile);
26
-        if(is_array($params) && (count($params)>0))
27
-        {
29
+        if(is_array($params) && (count($params)>0)) {
28 30
             $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}";
29 31
             $mt[] = array
30 32
             (
@@ -48,7 +50,9 @@  discard block
 block discarded – undo
48 50
 if(is_dir($tvPath) && is_readable($tvPath)) {
49 51
     $d = dir($tvPath);
50 52
     while (false !== ($tplfile = $d->read())) {
51
-        if(substr($tplfile, -4) != '.tpl') continue;
53
+        if(substr($tplfile, -4) != '.tpl') {
54
+            continue;
55
+        }
52 56
         $params = parse_docblock($tvPath, $tplfile);
53 57
         if(is_array($params) && (count($params)>0)) {
54 58
             $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}";
@@ -241,7 +245,8 @@  discard block
 block discarded – undo
241 245
 // setup callback function
242 246
 $callBackFnc = "clean_up";
243 247
 
244
-function clean_up($sqlParser) {
248
+function clean_up($sqlParser)
249
+{
245 250
     $ids = array();
246 251
 
247 252
     // secure web documents - privateweb
@@ -254,9 +259,10 @@  discard block
 block discarded – undo
254 259
     $ds = mysqli_query($sqlParser->conn,$sql);
255 260
     if(!$ds) {
256 261
         echo "An error occurred while executing a query: ".mysqli_error($sqlParser->conn);
257
-    }
258
-    else {
259
-        while($r = mysqli_fetch_assoc($ds)) $ids[]=$r["id"];
262
+    } else {
263
+        while($r = mysqli_fetch_assoc($ds)) {
264
+            $ids[]=$r["id"];
265
+        }
260 266
         if(count($ids)>0) {
261 267
             mysqli_query($sqlParser->conn,"UPDATE `".$sqlParser->prefix."site_content` SET privateweb = 1 WHERE id IN (".implode(", ",$ids).")");
262 268
             unset($ids);
@@ -273,9 +279,10 @@  discard block
 block discarded – undo
273 279
     $ds = mysqli_query($sqlParser->conn,$sql);
274 280
     if(!$ds) {
275 281
         echo "An error occurred while executing a query: ".mysqli_error($sqlParser->conn);
276
-    }
277
-    else {
278
-        while($r = mysqli_fetch_assoc($ds)) $ids[]=$r["id"];
282
+    } else {
283
+        while($r = mysqli_fetch_assoc($ds)) {
284
+            $ids[]=$r["id"];
285
+        }
279 286
         if(count($ids)>0) {
280 287
             mysqli_query($sqlParser->conn,"UPDATE `".$sqlParser->prefix."site_content` SET privatemgr = 1 WHERE id IN (".implode(", ",$ids).")");
281 288
             unset($ids);
@@ -283,7 +290,8 @@  discard block
 block discarded – undo
283 290
     }
284 291
 }
285 292
 
286
-function parse_docblock($element_dir, $filename) {
293
+function parse_docblock($element_dir, $filename)
294
+{
287 295
     $params = array();
288 296
     $fullpath = $element_dir . '/' . $filename;
289 297
     if(is_readable($fullpath)) {
Please login to merge, or discard this patch.
Indentation   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -170,70 +170,70 @@
 block discarded – undo
170 170
                 array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false
171 171
             );
172 172
         }
173
-		if ((int)$params['shareparams'] || !empty($params['dependencies'])) {
174
-			$dependencies = explode(',', $params['dependencies']);
175
-			foreach ($dependencies as $dependency) {
176
-				$dependency = explode(':', $dependency);
177
-				switch (trim($dependency[0])) {
178
-					case 'template':
179
-						$mdp[] = array(
180
-							'module' => $params['name'],
181
-							'table' => 'templates',
182
-							'column' => 'templatename',
183
-							'type' => 50,
184
-							'name' => trim($dependency[1])
185
-						);
186
-						break;
187
-					case 'tv':
188
-					case 'tmplvar':
189
-						$mdp[] = array(
190
-							'module' => $params['name'],
191
-							'table' => 'tmplvars',
192
-							'column' => 'name',
193
-							'type' => 60,
194
-							'name' => trim($dependency[1])
195
-						);
196
-						break;
197
-					case 'chunk':
198
-					case 'htmlsnippet':
199
-						$mdp[] = array(
200
-							'module' => $params['name'],
201
-							'table' => 'htmlsnippets',
202
-							'column' => 'name',
203
-							'type' => 10,
204
-							'name' => trim($dependency[1])
205
-						);
206
-						break;
207
-					case 'snippet':
208
-						$mdp[] = array(
209
-							'module' => $params['name'],
210
-							'table' => 'snippets',
211
-							'column' => 'name',
212
-							'type' => 40,
213
-							'name' => trim($dependency[1])
214
-						);
215
-						break;
216
-					case 'plugin':
217
-						$mdp[] = array(
218
-							'module' => $params['name'],
219
-							'table' => 'plugins',
220
-							'column' => 'name',
221
-							'type' => 30,
222
-							'name' => trim($dependency[1])
223
-						);
224
-						break;
225
-					case 'resource':
226
-						$mdp[] = array(
227
-							'module' => $params['name'],
228
-							'table' => 'content',
229
-							'column' => 'pagetitle',
230
-							'type' => 20,
231
-							'name' => trim($dependency[1])
232
-						);
233
-						break;
234
-				}
235
-			}
236
-		}
173
+        if ((int)$params['shareparams'] || !empty($params['dependencies'])) {
174
+            $dependencies = explode(',', $params['dependencies']);
175
+            foreach ($dependencies as $dependency) {
176
+                $dependency = explode(':', $dependency);
177
+                switch (trim($dependency[0])) {
178
+                    case 'template':
179
+                        $mdp[] = array(
180
+                            'module' => $params['name'],
181
+                            'table' => 'templates',
182
+                            'column' => 'templatename',
183
+                            'type' => 50,
184
+                            'name' => trim($dependency[1])
185
+                        );
186
+                        break;
187
+                    case 'tv':
188
+                    case 'tmplvar':
189
+                        $mdp[] = array(
190
+                            'module' => $params['name'],
191
+                            'table' => 'tmplvars',
192
+                            'column' => 'name',
193
+                            'type' => 60,
194
+                            'name' => trim($dependency[1])
195
+                        );
196
+                        break;
197
+                    case 'chunk':
198
+                    case 'htmlsnippet':
199
+                        $mdp[] = array(
200
+                            'module' => $params['name'],
201
+                            'table' => 'htmlsnippets',
202
+                            'column' => 'name',
203
+                            'type' => 10,
204
+                            'name' => trim($dependency[1])
205
+                        );
206
+                        break;
207
+                    case 'snippet':
208
+                        $mdp[] = array(
209
+                            'module' => $params['name'],
210
+                            'table' => 'snippets',
211
+                            'column' => 'name',
212
+                            'type' => 40,
213
+                            'name' => trim($dependency[1])
214
+                        );
215
+                        break;
216
+                    case 'plugin':
217
+                        $mdp[] = array(
218
+                            'module' => $params['name'],
219
+                            'table' => 'plugins',
220
+                            'column' => 'name',
221
+                            'type' => 30,
222
+                            'name' => trim($dependency[1])
223
+                        );
224
+                        break;
225
+                    case 'resource':
226
+                        $mdp[] = array(
227
+                            'module' => $params['name'],
228
+                            'table' => 'content',
229
+                            'column' => 'pagetitle',
230
+                            'type' => 20,
231
+                            'name' => trim($dependency[1])
232
+                        );
233
+                        break;
234
+                }
235
+            }
236
+        }
237 237
     }
238 238
     $d->close();
239 239
 }
Please login to merge, or discard this patch.
Spacing   +65 added lines, -66 removed lines patch added patch discarded remove patch
@@ -1,33 +1,32 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 //:: EVO Installer Setup file
3 3
 //:::::::::::::::::::::::::::::::::::::::::
4
-if (is_file($base_path . 'assets/cache/siteManager.php')) {
5
-    include_once($base_path . 'assets/cache/siteManager.php');
4
+if (is_file($base_path.'assets/cache/siteManager.php')) {
5
+    include_once($base_path.'assets/cache/siteManager.php');
6 6
 }
7
-if(!defined('MGR_DIR')) define('MGR_DIR', 'manager');
7
+if (!defined('MGR_DIR')) define('MGR_DIR', 'manager');
8 8
 
9 9
 require_once('../'.MGR_DIR.'/includes/version.inc.php');
10 10
 
11
-$chunkPath    = $base_path .'install/assets/chunks';
12
-$snippetPath  = $base_path .'install/assets/snippets';
13
-$pluginPath   = $base_path .'install/assets/plugins';
14
-$modulePath   = $base_path .'install/assets/modules';
15
-$templatePath = $base_path .'install/assets/templates';
16
-$tvPath = $base_path .'install/assets/tvs';
11
+$chunkPath    = $base_path.'install/assets/chunks';
12
+$snippetPath  = $base_path.'install/assets/snippets';
13
+$pluginPath   = $base_path.'install/assets/plugins';
14
+$modulePath   = $base_path.'install/assets/modules';
15
+$templatePath = $base_path.'install/assets/templates';
16
+$tvPath = $base_path.'install/assets/tvs';
17 17
 
18 18
 // setup Template template files - array : name, description, type - 0:file or 1:content, parameters, category
19 19
 $mt = &$moduleTemplates;
20
-if(is_dir($templatePath) && is_readable($templatePath)) {
20
+if (is_dir($templatePath) && is_readable($templatePath)) {
21 21
     $d = dir($templatePath);
22 22
     while (false !== ($tplfile = $d->read()))
23 23
     {
24
-        if(substr($tplfile, -4) != '.tpl') continue;
24
+        if (substr($tplfile, -4) != '.tpl') continue;
25 25
         $params = parse_docblock($templatePath, $tplfile);
26
-        if(is_array($params) && (count($params)>0))
26
+        if (is_array($params) && (count($params) > 0))
27 27
         {
28 28
             $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}";
29
-            $mt[] = array
30
-            (
29
+            $mt[] = array(
31 30
                 $params['name'],
32 31
                 $description,
33 32
                 // Don't think this is gonna be used ... but adding it just in case 'type'
@@ -45,12 +44,12 @@  discard block
 block discarded – undo
45 44
 
46 45
 // setup Template Variable template files
47 46
 $mtv = &$moduleTVs;
48
-if(is_dir($tvPath) && is_readable($tvPath)) {
47
+if (is_dir($tvPath) && is_readable($tvPath)) {
49 48
     $d = dir($tvPath);
50 49
     while (false !== ($tplfile = $d->read())) {
51
-        if(substr($tplfile, -4) != '.tpl') continue;
50
+        if (substr($tplfile, -4) != '.tpl') continue;
52 51
         $params = parse_docblock($tvPath, $tplfile);
53
-        if(is_array($params) && (count($params)>0)) {
52
+        if (is_array($params) && (count($params) > 0)) {
54 53
             $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}";
55 54
             $mtv[] = array(
56 55
                 $params['name'],
@@ -62,9 +61,9 @@  discard block
 block discarded – undo
62 61
                 $params['output_widget'],
63 62
                 $params['output_widget_params'],
64 63
                 "$templatePath/{$params['filename']}", /* not currently used */
65
-                $params['template_assignments']!="*"?$params['template_assignments']:implode(",",array_map(create_function('$v','return $v[0];'),$mt)), /* comma-separated list of template names */
64
+                $params['template_assignments'] != "*" ? $params['template_assignments'] : implode(",", array_map(create_function('$v', 'return $v[0];'), $mt)), /* comma-separated list of template names */
66 65
                 $params['modx_category'],
67
-                $params['lock_tv'],  /* value should be 1 or 0 */
66
+                $params['lock_tv'], /* value should be 1 or 0 */
68 67
                 array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false
69 68
             );
70 69
         }
@@ -74,14 +73,14 @@  discard block
 block discarded – undo
74 73
 
75 74
 // setup chunks template files - array : name, description, type - 0:file or 1:content, file or content
76 75
 $mc = &$moduleChunks;
77
-if(is_dir($chunkPath) && is_readable($chunkPath)) {
76
+if (is_dir($chunkPath) && is_readable($chunkPath)) {
78 77
     $d = dir($chunkPath);
79 78
     while (false !== ($tplfile = $d->read())) {
80
-        if(substr($tplfile, -4) != '.tpl') {
79
+        if (substr($tplfile, -4) != '.tpl') {
81 80
             continue;
82 81
         }
83 82
         $params = parse_docblock($chunkPath, $tplfile);
84
-        if(is_array($params) && count($params) > 0) {
83
+        if (is_array($params) && count($params) > 0) {
85 84
             $mc[] = array(
86 85
                 $params['name'],
87 86
                 $params['description'],
@@ -97,14 +96,14 @@  discard block
 block discarded – undo
97 96
 
98 97
 // setup snippets template files - array : name, description, type - 0:file or 1:content, file or content,properties
99 98
 $ms = &$moduleSnippets;
100
-if(is_dir($snippetPath) && is_readable($snippetPath)) {
99
+if (is_dir($snippetPath) && is_readable($snippetPath)) {
101 100
     $d = dir($snippetPath);
102 101
     while (false !== ($tplfile = $d->read())) {
103
-        if(substr($tplfile, -4) != '.tpl') {
102
+        if (substr($tplfile, -4) != '.tpl') {
104 103
             continue;
105 104
         }
106 105
         $params = parse_docblock($snippetPath, $tplfile);
107
-        if(is_array($params) && count($params) > 0) {
106
+        if (is_array($params) && count($params) > 0) {
108 107
             $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}";
109 108
             $ms[] = array(
110 109
                 $params['name'],
@@ -121,14 +120,14 @@  discard block
 block discarded – undo
121 120
 
122 121
 // setup plugins template files - array : name, description, type - 0:file or 1:content, file or content,properties
123 122
 $mp = &$modulePlugins;
124
-if(is_dir($pluginPath) && is_readable($pluginPath)) {
123
+if (is_dir($pluginPath) && is_readable($pluginPath)) {
125 124
     $d = dir($pluginPath);
126 125
     while (false !== ($tplfile = $d->read())) {
127
-        if(substr($tplfile, -4) != '.tpl') {
126
+        if (substr($tplfile, -4) != '.tpl') {
128 127
             continue;
129 128
         }
130 129
         $params = parse_docblock($pluginPath, $tplfile);
131
-        if(is_array($params) && count($params) > 0) {
130
+        if (is_array($params) && count($params) > 0) {
132 131
             $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}";
133 132
             $mp[] = array(
134 133
                 $params['name'],
@@ -140,7 +139,7 @@  discard block
 block discarded – undo
140 139
                 $params['modx_category'],
141 140
                 $params['legacy_names'],
142 141
                 array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false,
143
-                (int)$params['disabled']
142
+                (int) $params['disabled']
144 143
             );
145 144
         }
146 145
     }
@@ -150,14 +149,14 @@  discard block
 block discarded – undo
150 149
 // setup modules - array : name, description, type - 0:file or 1:content, file or content,properties, guid,enable_sharedparams
151 150
 $mm = &$moduleModules;
152 151
 $mdp = &$moduleDependencies;
153
-if(is_dir($modulePath) && is_readable($modulePath)) {
152
+if (is_dir($modulePath) && is_readable($modulePath)) {
154 153
     $d = dir($modulePath);
155 154
     while (false !== ($tplfile = $d->read())) {
156
-        if(substr($tplfile, -4) != '.tpl') {
155
+        if (substr($tplfile, -4) != '.tpl') {
157 156
             continue;
158 157
         }
159 158
         $params = parse_docblock($modulePath, $tplfile);
160
-        if(is_array($params) && count($params) > 0) {
159
+        if (is_array($params) && count($params) > 0) {
161 160
             $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}";
162 161
             $mm[] = array(
163 162
                 $params['name'],
@@ -165,12 +164,12 @@  discard block
 block discarded – undo
165 164
                 "$modulePath/{$params['filename']}",
166 165
                 $params['properties'],
167 166
                 $params['guid'],
168
-                (int)$params['shareparams'],
167
+                (int) $params['shareparams'],
169 168
                 $params['modx_category'],
170 169
                 array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false
171 170
             );
172 171
         }
173
-		if ((int)$params['shareparams'] || !empty($params['dependencies'])) {
172
+		if ((int) $params['shareparams'] || !empty($params['dependencies'])) {
174 173
 			$dependencies = explode(',', $params['dependencies']);
175 174
 			foreach ($dependencies as $dependency) {
176 175
 				$dependency = explode(':', $dependency);
@@ -241,103 +240,103 @@  discard block
 block discarded – undo
241 240
 // setup callback function
242 241
 $callBackFnc = "clean_up";
243 242
 
244
-function clean_up($sqlParser) {
243
+function clean_up($sqlParser){
245 244
     $ids = array();
246 245
 
247 246
     // secure web documents - privateweb
248
-    mysqli_query($sqlParser->conn,"UPDATE `".$sqlParser->prefix."site_content` SET privateweb = 0 WHERE privateweb = 1");
249
-    $sql =  "SELECT DISTINCT sc.id
247
+    mysqli_query($sqlParser->conn, "UPDATE `".$sqlParser->prefix."site_content` SET privateweb = 0 WHERE privateweb = 1");
248
+    $sql = "SELECT DISTINCT sc.id
250 249
              FROM `".$sqlParser->prefix."site_content` sc
251 250
              LEFT JOIN `".$sqlParser->prefix."document_groups` dg ON dg.document = sc.id
252 251
              LEFT JOIN `".$sqlParser->prefix."webgroup_access` wga ON wga.documentgroup = dg.document_group
253 252
              WHERE wga.id>0";
254
-    $ds = mysqli_query($sqlParser->conn,$sql);
255
-    if(!$ds) {
253
+    $ds = mysqli_query($sqlParser->conn, $sql);
254
+    if (!$ds) {
256 255
         echo "An error occurred while executing a query: ".mysqli_error($sqlParser->conn);
257 256
     }
258 257
     else {
259
-        while($r = mysqli_fetch_assoc($ds)) $ids[]=$r["id"];
260
-        if(count($ids)>0) {
261
-            mysqli_query($sqlParser->conn,"UPDATE `".$sqlParser->prefix."site_content` SET privateweb = 1 WHERE id IN (".implode(", ",$ids).")");
258
+        while ($r = mysqli_fetch_assoc($ds)) $ids[] = $r["id"];
259
+        if (count($ids) > 0) {
260
+            mysqli_query($sqlParser->conn, "UPDATE `".$sqlParser->prefix."site_content` SET privateweb = 1 WHERE id IN (".implode(", ", $ids).")");
262 261
             unset($ids);
263 262
         }
264 263
     }
265 264
 
266 265
     // secure manager documents privatemgr
267
-    mysqli_query($sqlParser->conn,"UPDATE `".$sqlParser->prefix."site_content` SET privatemgr = 0 WHERE privatemgr = 1");
268
-    $sql =  "SELECT DISTINCT sc.id
266
+    mysqli_query($sqlParser->conn, "UPDATE `".$sqlParser->prefix."site_content` SET privatemgr = 0 WHERE privatemgr = 1");
267
+    $sql = "SELECT DISTINCT sc.id
269 268
              FROM `".$sqlParser->prefix."site_content` sc
270 269
              LEFT JOIN `".$sqlParser->prefix."document_groups` dg ON dg.document = sc.id
271 270
              LEFT JOIN `".$sqlParser->prefix."membergroup_access` mga ON mga.documentgroup = dg.document_group
272 271
              WHERE mga.id>0";
273
-    $ds = mysqli_query($sqlParser->conn,$sql);
274
-    if(!$ds) {
272
+    $ds = mysqli_query($sqlParser->conn, $sql);
273
+    if (!$ds) {
275 274
         echo "An error occurred while executing a query: ".mysqli_error($sqlParser->conn);
276 275
     }
277 276
     else {
278
-        while($r = mysqli_fetch_assoc($ds)) $ids[]=$r["id"];
279
-        if(count($ids)>0) {
280
-            mysqli_query($sqlParser->conn,"UPDATE `".$sqlParser->prefix."site_content` SET privatemgr = 1 WHERE id IN (".implode(", ",$ids).")");
277
+        while ($r = mysqli_fetch_assoc($ds)) $ids[] = $r["id"];
278
+        if (count($ids) > 0) {
279
+            mysqli_query($sqlParser->conn, "UPDATE `".$sqlParser->prefix."site_content` SET privatemgr = 1 WHERE id IN (".implode(", ", $ids).")");
281 280
             unset($ids);
282 281
         }
283 282
     }
284 283
 }
285 284
 
286
-function parse_docblock($element_dir, $filename) {
285
+function parse_docblock($element_dir, $filename){
287 286
     $params = array();
288
-    $fullpath = $element_dir . '/' . $filename;
289
-    if(is_readable($fullpath)) {
287
+    $fullpath = $element_dir.'/'.$filename;
288
+    if (is_readable($fullpath)) {
290 289
         $tpl = @fopen($fullpath, "r");
291
-        if($tpl) {
290
+        if ($tpl) {
292 291
             $params['filename'] = $filename;
293 292
             $docblock_start_found = false;
294 293
             $name_found = false;
295 294
             $description_found = false;
296 295
 
297
-            while(!feof($tpl)) {
296
+            while (!feof($tpl)) {
298 297
                 $line = fgets($tpl);
299
-                if(!$docblock_start_found) {
298
+                if (!$docblock_start_found) {
300 299
                     // find docblock start
301
-                    if(strpos($line, '/**') !== false) {
300
+                    if (strpos($line, '/**') !== false) {
302 301
                         $docblock_start_found = true;
303 302
                     }
304 303
                     continue;
305
-                } elseif(!$name_found) {
304
+                } elseif (!$name_found) {
306 305
                     // find name
307 306
                     $ma = null;
308
-                    if(preg_match("/^\s+\*\s+(.+)/", $line, $ma)) {
307
+                    if (preg_match("/^\s+\*\s+(.+)/", $line, $ma)) {
309 308
                         $params['name'] = trim($ma[1]);
310 309
                         $name_found = !empty($params['name']);
311 310
                     }
312 311
                     continue;
313
-                } elseif(!$description_found) {
312
+                } elseif (!$description_found) {
314 313
                     // find description
315 314
                     $ma = null;
316
-                    if(preg_match("/^\s+\*\s+(.+)/", $line, $ma)) {
315
+                    if (preg_match("/^\s+\*\s+(.+)/", $line, $ma)) {
317 316
                         $params['description'] = trim($ma[1]);
318 317
                         $description_found = !empty($params['description']);
319 318
                     }
320 319
                     continue;
321 320
                 } else {
322 321
                     $ma = null;
323
-                    if(preg_match("/^\s+\*\s+\@([^\s]+)\s+(.+)/", $line, $ma)) {
322
+                    if (preg_match("/^\s+\*\s+\@([^\s]+)\s+(.+)/", $line, $ma)) {
324 323
                         $param = trim($ma[1]);
325 324
                         $val = trim($ma[2]);
326
-                        if(!empty($param) && !empty($val)) {
327
-                            if($param == 'internal') {
325
+                        if (!empty($param) && !empty($val)) {
326
+                            if ($param == 'internal') {
328 327
                                 $ma = null;
329
-                                if(preg_match("/\@([^\s]+)\s+(.+)/", $val, $ma)) {
328
+                                if (preg_match("/\@([^\s]+)\s+(.+)/", $val, $ma)) {
330 329
                                     $param = trim($ma[1]);
331 330
                                     $val = trim($ma[2]);
332 331
                                 }
333 332
                                 //if($val !== '0' && (empty($param) || empty($val))) {
334
-                                if(empty($param)) {
333
+                                if (empty($param)) {
335 334
                                     continue;
336 335
                                 }
337 336
                             }
338 337
                             $params[$param] = $val;
339 338
                         }
340
-                    } elseif(preg_match("/^\s*\*\/\s*$/", $line)) {
339
+                    } elseif (preg_match("/^\s*\*\/\s*$/", $line)) {
341 340
                         break;
342 341
                     }
343 342
                 }
Please login to merge, or discard this patch.
install/actions/action_install.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
 <form name="install" id="install_form" action="index.php?action=options" method="post">
21 21
 <?php
22 22
 if ($errors == 0) {
23
-	// check if install folder is removeable
23
+    // check if install folder is removeable
24 24
     if (is_writable("../install")) { ?>
25 25
 <span id="removeinstall" style="float:left;cursor:pointer;color:#505050;line-height:18px;" onclick="var chk=document.install.rminstaller; if(chk) chk.checked=!chk.checked;"><input type="checkbox" name="rminstaller" onclick="event.cancelBubble=true;" <?php echo (empty ($errors) ? 'checked="checked"' : '') ?> style="cursor:default;" /><?php echo $_lang['remove_install_folder_auto'] ?></span>
26 26
 <?php 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,10 +43,10 @@
 block discarded – undo
43 43
 	var chk = document.install.rminstaller;
44 44
 	if(chk && chk.checked) {
45 45
 		// remove install folder and files
46
-		window.location.href = "../<?php echo MGR_DIR;?>/processors/remove_installer.processor.php?rminstall=1";
46
+		window.location.href = "../<?php echo MGR_DIR; ?>/processors/remove_installer.processor.php?rminstall=1";
47 47
 	}
48 48
 	else {
49
-		window.location.href = "../<?php echo MGR_DIR;?>/";
49
+		window.location.href = "../<?php echo MGR_DIR; ?>/";
50 50
 	}
51 51
 }
52 52
 /* ]]> */
Please login to merge, or discard this patch.
install/connection.databasetest.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,10 +8,10 @@
 block discarded – undo
8 8
 $self = 'install/connection.databasetest.php';
9 9
 $base_path = str_replace($self,'',str_replace('\\','/', __FILE__));
10 10
 if (is_file("{$base_path}assets/cache/siteManager.php")) {
11
-	include_once("{$base_path}assets/cache/siteManager.php");
11
+    include_once("{$base_path}assets/cache/siteManager.php");
12 12
 }
13 13
 if(!defined('MGR_DIR') && is_dir("{$base_path}manager")) {
14
-	define('MGR_DIR','manager');
14
+    define('MGR_DIR','manager');
15 15
 }
16 16
 require_once("lang.php");
17 17
 
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -6,12 +6,12 @@  discard block
 block discarded – undo
6 6
 $installMode = $_POST['installMode'];
7 7
 
8 8
 $self = 'install/connection.databasetest.php';
9
-$base_path = str_replace($self,'',str_replace('\\','/', __FILE__));
9
+$base_path = str_replace($self, '', str_replace('\\', '/', __FILE__));
10 10
 if (is_file("{$base_path}assets/cache/siteManager.php")) {
11 11
 	include_once("{$base_path}assets/cache/siteManager.php");
12 12
 }
13
-if(!defined('MGR_DIR') && is_dir("{$base_path}manager")) {
14
-	define('MGR_DIR','manager');
13
+if (!defined('MGR_DIR') && is_dir("{$base_path}manager")) {
14
+	define('MGR_DIR', 'manager');
15 15
 }
16 16
 require_once("lang.php");
17 17
 
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
         $database_charset = substr($database_collation, 0, strpos($database_collation, '_'));
32 32
         $query = "CREATE DATABASE `".$database_name."` CHARACTER SET ".$database_charset." COLLATE ".$database_collation.";";
33 33
 
34
-        if (! mysqli_query($conn, $query)){
34
+        if (!mysqli_query($conn, $query)) {
35 35
             $output .= '<span id="database_fail" style="color:#FF0000;">'.$_lang['status_failed_could_not_create_database'].'</span>';
36 36
         }
37 37
         else {
Please login to merge, or discard this patch.
Braces   +6 added lines, -11 removed lines patch added patch discarded remove patch
@@ -18,8 +18,7 @@  discard block
 block discarded – undo
18 18
 $output = $_lang["status_checking_database"];
19 19
 if (!$conn = mysqli_connect($host, $uid, $pwd)) {
20 20
     $output .= '<span id="database_fail" style="color:#FF0000;">'.$_lang['status_failed'].'</span>';
21
-}
22
-else {
21
+} else {
23 22
     $database_name = mysqli_real_escape_string($conn, $_POST['database_name']);
24 23
     $database_name = str_replace("`", "", $database_name);
25 24
     $tableprefix = mysqli_real_escape_string($conn, $_POST['tableprefix']);
@@ -31,20 +30,16 @@  discard block
 block discarded – undo
31 30
         $database_charset = substr($database_collation, 0, strpos($database_collation, '_'));
32 31
         $query = "CREATE DATABASE `".$database_name."` CHARACTER SET ".$database_charset." COLLATE ".$database_collation.";";
33 32
 
34
-        if (! mysqli_query($conn, $query)){
33
+        if (! mysqli_query($conn, $query)) {
35 34
             $output .= '<span id="database_fail" style="color:#FF0000;">'.$_lang['status_failed_could_not_create_database'].'</span>';
36
-        }
37
-        else {
35
+        } else {
38 36
             $output .= '<span id="database_pass" style="color:#80c000;">'.$_lang['status_passed_database_created'].'</span>';
39 37
         }
40
-    }
41
-    elseif (($installMode == 0) && (mysqli_query($conn, "SELECT COUNT(*) FROM {$database_name}.`{$tableprefix}site_content`"))) {
38
+    } elseif (($installMode == 0) && (mysqli_query($conn, "SELECT COUNT(*) FROM {$database_name}.`{$tableprefix}site_content`"))) {
42 39
         $output .= '<span id="database_fail" style="color:#FF0000;">'.$_lang['status_failed_table_prefix_already_in_use'].'</span>';
43
-    }
44
-    elseif (($database_connection_method != 'SET NAMES') && ($rs = mysqli_query($conn, "show variables like 'collation_database'")) && ($row = mysqli_fetch_row($rs)) && ($row[1] != $database_collation)) {
40
+    } elseif (($database_connection_method != 'SET NAMES') && ($rs = mysqli_query($conn, "show variables like 'collation_database'")) && ($row = mysqli_fetch_row($rs)) && ($row[1] != $database_collation)) {
45 41
         $output .= '<span id="database_fail" style="color:#FF0000;">'.sprintf($_lang['status_failed_database_collation_does_not_match'], $row[1]).'</span>';
46
-    }
47
-    else {
42
+    } else {
48 43
         $output .= '<span id="database_pass" style="color:#80c000;">'.$_lang['status_passed'].'</span>';
49 44
     }
50 45
 }
Please login to merge, or discard this patch.
install/index.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,10 +16,10 @@
 block discarded – undo
16 16
 error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED);
17 17
 
18 18
 if (is_file("{$base_path}assets/cache/siteManager.php")) {
19
-	include_once("{$base_path}assets/cache/siteManager.php");
19
+    include_once("{$base_path}assets/cache/siteManager.php");
20 20
 }
21 21
 if(!defined('MGR_DIR') && is_dir("{$base_path}manager")) {
22
-	define('MGR_DIR', 'manager');
22
+    define('MGR_DIR', 'manager');
23 23
 }
24 24
 
25 25
 
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 }
10 10
 
11 11
 $self = 'install/index.php';
12
-$base_path = str_replace($self,'',str_replace('\\','/', __FILE__));
12
+$base_path = str_replace($self, '', str_replace('\\', '/', __FILE__));
13 13
 require_once("{$base_path}install/functions.php");
14 14
 
15 15
 // set error reporting
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 if (is_file("{$base_path}assets/cache/siteManager.php")) {
19 19
 	include_once("{$base_path}assets/cache/siteManager.php");
20 20
 }
21
-if(!defined('MGR_DIR') && is_dir("{$base_path}manager")) {
21
+if (!defined('MGR_DIR') && is_dir("{$base_path}manager")) {
22 22
 	define('MGR_DIR', 'manager');
23 23
 }
24 24
 
@@ -38,26 +38,26 @@  discard block
 block discarded – undo
38 38
 $moduleSQLDataFile = "setup.data.sql";
39 39
 $moduleSQLResetFile = "setup.data.reset.sql";
40 40
 
41
-$moduleChunks = array (); // chunks - array : name, description, type - 0:file or 1:content, file or content
42
-$moduleTemplates = array (); // templates - array : name, description, type - 0:file or 1:content, file or content
43
-$moduleSnippets = array (); // snippets - array : name, description, type - 0:file or 1:content, file or content,properties
44
-$modulePlugins = array (); // plugins - array : name, description, type - 0:file or 1:content, file or content,properties, events,guid
45
-$moduleModules = array (); // modules - array : name, description, type - 0:file or 1:content, file or content,properties, guid
46
-$moduleTemplates = array (); // templates - array : name, description, type - 0:file or 1:content, file or content,properties
47
-$moduleTVs = array (); // template variables - array : name, description, type - 0:file or 1:content, file or content,properties
41
+$moduleChunks = array(); // chunks - array : name, description, type - 0:file or 1:content, file or content
42
+$moduleTemplates = array(); // templates - array : name, description, type - 0:file or 1:content, file or content
43
+$moduleSnippets = array(); // snippets - array : name, description, type - 0:file or 1:content, file or content,properties
44
+$modulePlugins = array(); // plugins - array : name, description, type - 0:file or 1:content, file or content,properties, events,guid
45
+$moduleModules = array(); // modules - array : name, description, type - 0:file or 1:content, file or content,properties, guid
46
+$moduleTemplates = array(); // templates - array : name, description, type - 0:file or 1:content, file or content,properties
47
+$moduleTVs = array(); // template variables - array : name, description, type - 0:file or 1:content, file or content,properties
48 48
 $moduleDependencies = array(); // module depedencies - array : module, table, column, type, name
49 49
 
50
-$errors= 0;
50
+$errors = 0;
51 51
 
52 52
 // get post back status
53 53
 $isPostBack = (count($_POST));
54 54
 
55 55
 $ph = ph();
56
-$ph = array_merge($ph,$_lang);
56
+$ph = array_merge($ph, $_lang);
57 57
 $ph['install_language'] = $install_language;
58 58
 
59 59
 ob_start();
60
-$action= isset ($_GET['action']) ? trim(strip_tags($_GET['action'])) : 'language';
60
+$action = isset ($_GET['action']) ? trim(strip_tags($_GET['action'])) : 'language';
61 61
 if (!@include_once("actions/action_{$action}.php")) {
62 62
     die ("Invalid install action attempted. [action={$action}]");
63 63
 }
@@ -65,5 +65,5 @@  discard block
 block discarded – undo
65 65
 ob_end_clean();
66 66
 
67 67
 $tpl = file_get_contents("{$base_path}install/template.tpl");
68
-echo parse($tpl,$ph);
68
+echo parse($tpl, $ph);
69 69
 
Please login to merge, or discard this patch.