@@ -1076,10 +1076,10 @@ discard block |
||
| 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[] = [ |
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 1552 | 1552 | [] |
| 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 |
||
| 1574 | 1574 | [] |
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 2607 | 2607 | $sign = @openssl_pkcs7_sign( |
| 2608 | 2608 | $file, |
| 2609 | 2609 | $signed, |
| 2610 | - 'file://' . realpath($this->sign_cert_file), |
|
| 2611 | - ['file://' . realpath($this->sign_key_file), $this->sign_key_pass], |
|
| 2610 | + 'file://'.realpath($this->sign_cert_file), |
|
| 2611 | + ['file://'.realpath($this->sign_key_file), $this->sign_key_pass], |
|
| 2612 | 2612 | [] |
| 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 | - ['file://' . realpath($this->sign_key_file), $this->sign_key_pass], |
|
| 2618 | + 'file://'.realpath($this->sign_cert_file), |
|
| 2619 | + ['file://'.realpath($this->sign_key_file), $this->sign_key_pass], |
|
| 2620 | 2620 | [], |
| 2621 | 2621 | PKCS7_DETACHED, |
| 2622 | 2622 | $this->sign_extracerts_file |
@@ -2628,11 +2628,11 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | |
@@ -3057,7 +3057,7 @@ discard block |
||
| 3057 | 3057 | $maxlen -= $maxlen % 4; |
| 3058 | 3058 | $encoded = trim(chunk_split($encoded, $maxlen, "\n")); |
| 3059 | 3059 | } |
| 3060 | - $encoded = preg_replace('/^(.*)$/m', ' =?' . $this->CharSet . "?$encoding?\\1?=", $encoded); |
|
| 3060 | + $encoded = preg_replace('/^(.*)$/m', ' =?'.$this->CharSet."?$encoding?\\1?=", $encoded); |
|
| 3061 | 3061 | } elseif ($matchcount > 0) { |
| 3062 | 3062 | //1 or more chars need encoding, use Q-encode |
| 3063 | 3063 | $encoding = 'Q'; |
@@ -3065,8 +3065,8 @@ discard block |
||
| 3065 | 3065 | $maxlen = static::STD_LINE_LENGTH - $lengthsub - 8 - strlen($this->CharSet); |
| 3066 | 3066 | $encoded = $this->encodeQ($str, $position); |
| 3067 | 3067 | $encoded = $this->wrapText($encoded, $maxlen, true); |
| 3068 | - $encoded = str_replace('=' . static::$LE, "\n", trim($encoded)); |
|
| 3069 | - $encoded = preg_replace('/^(.*)$/m', ' =?' . $this->CharSet . "?$encoding?\\1?=", $encoded); |
|
| 3068 | + $encoded = str_replace('='.static::$LE, "\n", trim($encoded)); |
|
| 3069 | + $encoded = preg_replace('/^(.*)$/m', ' =?'.$this->CharSet."?$encoding?\\1?=", $encoded); |
|
| 3070 | 3070 | } elseif (strlen($str) > $maxlen) { |
| 3071 | 3071 | //No chars need encoding, but line is too long, so fold it |
| 3072 | 3072 | $encoded = trim($this->wrapText($str, $maxlen, false)); |
@@ -3127,7 +3127,7 @@ discard block |
||
| 3127 | 3127 | */ |
| 3128 | 3128 | public function base64EncodeWrapMB($str, $linebreak = null) |
| 3129 | 3129 | { |
| 3130 | - $start = '=?' . $this->CharSet . '?B?'; |
|
| 3130 | + $start = '=?'.$this->CharSet.'?B?'; |
|
| 3131 | 3131 | $end = '?='; |
| 3132 | 3132 | $encoded = ''; |
| 3133 | 3133 | if (null === $linebreak) { |
@@ -3150,7 +3150,7 @@ discard block |
||
| 3150 | 3150 | $chunk = base64_encode($chunk); |
| 3151 | 3151 | ++$lookBack; |
| 3152 | 3152 | } while (strlen($chunk) > $length); |
| 3153 | - $encoded .= $chunk . $linebreak; |
|
| 3153 | + $encoded .= $chunk.$linebreak; |
|
| 3154 | 3154 | } |
| 3155 | 3155 | |
| 3156 | 3156 | // Chomp the last linefeed |
@@ -3203,7 +3203,7 @@ discard block |
||
| 3203 | 3203 | // RFC 2047 section 5.1 |
| 3204 | 3204 | // Replace every high ascii, control, =, ? and _ characters |
| 3205 | 3205 | /** @noinspection SuspiciousAssignmentsInspection */ |
| 3206 | - $pattern = '\000-\011\013\014\016-\037\075\077\137\177-\377' . $pattern; |
|
| 3206 | + $pattern = '\000-\011\013\014\016-\037\075\077\137\177-\377'.$pattern; |
|
| 3207 | 3207 | break; |
| 3208 | 3208 | } |
| 3209 | 3209 | $matches = []; |
@@ -3216,7 +3216,7 @@ discard block |
||
| 3216 | 3216 | array_unshift($matches[0], '='); |
| 3217 | 3217 | } |
| 3218 | 3218 | foreach (array_unique($matches[0]) as $char) { |
| 3219 | - $encoded = str_replace($char, '=' . sprintf('%02X', ord($char)), $encoded); |
|
| 3219 | + $encoded = str_replace($char, '='.sprintf('%02X', ord($char)), $encoded); |
|
| 3220 | 3220 | } |
| 3221 | 3221 | } |
| 3222 | 3222 | // Replace spaces with _ (more readable than =20) |
@@ -3241,7 +3241,7 @@ discard block |
||
| 3241 | 3241 | $encoding = 'base64', |
| 3242 | 3242 | $type = '', |
| 3243 | 3243 | $disposition = 'attachment' |
| 3244 | - ) { |
|
| 3244 | + ){ |
|
| 3245 | 3245 | // If a MIME type is not specified, try to work it out from the file name |
| 3246 | 3246 | if ('' == $type) { |
| 3247 | 3247 | $type = static::filenameToType($filename); |
@@ -3281,7 +3281,7 @@ discard block |
||
| 3281 | 3281 | public function addEmbeddedImage($path, $cid, $name = '', $encoding = 'base64', $type = '', $disposition = 'inline') |
| 3282 | 3282 | { |
| 3283 | 3283 | if (!@is_file($path)) { |
| 3284 | - $this->setError($this->lang('file_access') . $path); |
|
| 3284 | + $this->setError($this->lang('file_access').$path); |
|
| 3285 | 3285 | |
| 3286 | 3286 | return false; |
| 3287 | 3287 | } |
@@ -3335,7 +3335,7 @@ discard block |
||
| 3335 | 3335 | $encoding = 'base64', |
| 3336 | 3336 | $type = '', |
| 3337 | 3337 | $disposition = 'inline' |
| 3338 | - ) { |
|
| 3338 | + ){ |
|
| 3339 | 3339 | // If a MIME type is not specified, try to work it out from the name |
| 3340 | 3340 | if ('' == $type and !empty($name)) { |
| 3341 | 3341 | $type = static::filenameToType($name); |
@@ -3425,7 +3425,7 @@ discard block |
||
| 3425 | 3425 | { |
| 3426 | 3426 | $this->RecipientsQueue = array_filter( |
| 3427 | 3427 | $this->RecipientsQueue, |
| 3428 | - function ($params) use ($kind) { |
|
| 3428 | + function($params) use ($kind) { |
|
| 3429 | 3429 | return $params[0] != $kind; |
| 3430 | 3430 | } |
| 3431 | 3431 | ); |
@@ -3515,15 +3515,15 @@ discard block |
||
| 3515 | 3515 | if ('smtp' == $this->Mailer and null !== $this->smtp) { |
| 3516 | 3516 | $lasterror = $this->smtp->getError(); |
| 3517 | 3517 | if (!empty($lasterror['error'])) { |
| 3518 | - $msg .= $this->lang('smtp_error') . $lasterror['error']; |
|
| 3518 | + $msg .= $this->lang('smtp_error').$lasterror['error']; |
|
| 3519 | 3519 | if (!empty($lasterror['detail'])) { |
| 3520 | - $msg .= ' Detail: ' . $lasterror['detail']; |
|
| 3520 | + $msg .= ' Detail: '.$lasterror['detail']; |
|
| 3521 | 3521 | } |
| 3522 | 3522 | if (!empty($lasterror['smtp_code'])) { |
| 3523 | - $msg .= ' SMTP code: ' . $lasterror['smtp_code']; |
|
| 3523 | + $msg .= ' SMTP code: '.$lasterror['smtp_code']; |
|
| 3524 | 3524 | } |
| 3525 | 3525 | if (!empty($lasterror['smtp_code_ex'])) { |
| 3526 | - $msg .= ' Additional SMTP info: ' . $lasterror['smtp_code_ex']; |
|
| 3526 | + $msg .= ' Additional SMTP info: '.$lasterror['smtp_code_ex']; |
|
| 3527 | 3527 | } |
| 3528 | 3528 | } |
| 3529 | 3529 | } |
@@ -3596,7 +3596,7 @@ discard block |
||
| 3596 | 3596 | //Is it a valid IPv4 address? |
| 3597 | 3597 | return (bool) filter_var($host, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4); |
| 3598 | 3598 | } |
| 3599 | - if (filter_var('http://' . $host, FILTER_VALIDATE_URL, FILTER_FLAG_HOST_REQUIRED)) { |
|
| 3599 | + if (filter_var('http://'.$host, FILTER_VALIDATE_URL, FILTER_FLAG_HOST_REQUIRED)) { |
|
| 3600 | 3600 | //Is it a syntactically valid hostname? |
| 3601 | 3601 | return true; |
| 3602 | 3602 | } |
@@ -3622,7 +3622,7 @@ discard block |
||
| 3622 | 3622 | //Include a link to troubleshooting docs on SMTP connection failure |
| 3623 | 3623 | //this is by far the biggest cause of support questions |
| 3624 | 3624 | //but it's usually not PHPMailer's fault. |
| 3625 | - return $this->language[$key] . ' https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting'; |
|
| 3625 | + return $this->language[$key].' https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting'; |
|
| 3626 | 3626 | } |
| 3627 | 3627 | |
| 3628 | 3628 | return $this->language[$key]; |
@@ -3710,14 +3710,14 @@ discard block |
||
| 3710 | 3710 | } |
| 3711 | 3711 | //Hash the decoded data, not the URL so that the same data-URI image used in multiple places |
| 3712 | 3712 | //will only be embedded once, even if it used a different encoding |
| 3713 | - $cid = hash('sha256', $data) . '@phpmailer.0'; // RFC2392 S 2 |
|
| 3713 | + $cid = hash('sha256', $data).'@phpmailer.0'; // RFC2392 S 2 |
|
| 3714 | 3714 | |
| 3715 | 3715 | if (!$this->cidExists($cid)) { |
| 3716 | - $this->addStringEmbeddedImage($data, $cid, 'embed' . $imgindex, 'base64', $match[1]); |
|
| 3716 | + $this->addStringEmbeddedImage($data, $cid, 'embed'.$imgindex, 'base64', $match[1]); |
|
| 3717 | 3717 | } |
| 3718 | 3718 | $message = str_replace( |
| 3719 | 3719 | $images[0][$imgindex], |
| 3720 | - $images[1][$imgindex] . '="cid:' . $cid . '"', |
|
| 3720 | + $images[1][$imgindex].'="cid:'.$cid.'"', |
|
| 3721 | 3721 | $message |
| 3722 | 3722 | ); |
| 3723 | 3723 | continue; |
@@ -3736,7 +3736,7 @@ discard block |
||
| 3736 | 3736 | if ('.' == $directory) { |
| 3737 | 3737 | $directory = ''; |
| 3738 | 3738 | } |
| 3739 | - $cid = hash('sha256', $url) . '@phpmailer.0'; // RFC2392 S 2 |
|
| 3739 | + $cid = hash('sha256', $url).'@phpmailer.0'; // RFC2392 S 2 |
|
| 3740 | 3740 | if (strlen($basedir) > 1 and '/' != substr($basedir, -1)) { |
| 3741 | 3741 | $basedir .= '/'; |
| 3742 | 3742 | } |
@@ -3744,7 +3744,7 @@ discard block |
||
| 3744 | 3744 | $directory .= '/'; |
| 3745 | 3745 | } |
| 3746 | 3746 | if ($this->addEmbeddedImage( |
| 3747 | - $basedir . $directory . $filename, |
|
| 3747 | + $basedir.$directory.$filename, |
|
| 3748 | 3748 | $cid, |
| 3749 | 3749 | $filename, |
| 3750 | 3750 | 'base64', |
@@ -3752,8 +3752,8 @@ discard block |
||
| 3752 | 3752 | ) |
| 3753 | 3753 | ) { |
| 3754 | 3754 | $message = preg_replace( |
| 3755 | - '/' . $images[1][$imgindex] . '=["\']' . preg_quote($url, '/') . '["\']/Ui', |
|
| 3756 | - $images[1][$imgindex] . '="cid:' . $cid . '"', |
|
| 3755 | + '/'.$images[1][$imgindex].'=["\']'.preg_quote($url, '/').'["\']/Ui', |
|
| 3756 | + $images[1][$imgindex].'="cid:'.$cid.'"', |
|
| 3757 | 3757 | $message |
| 3758 | 3758 | ); |
| 3759 | 3759 | } |
@@ -4027,7 +4027,7 @@ discard block |
||
| 4027 | 4027 | |
| 4028 | 4028 | return true; |
| 4029 | 4029 | } |
| 4030 | - $this->setError($this->lang('variable_set') . $name); |
|
| 4030 | + $this->setError($this->lang('variable_set').$name); |
|
| 4031 | 4031 | |
| 4032 | 4032 | return false; |
| 4033 | 4033 | } |
@@ -4121,7 +4121,7 @@ discard block |
||
| 4121 | 4121 | if (((0x21 <= $ord) and ($ord <= 0x3A)) or $ord == 0x3C or ((0x3E <= $ord) and ($ord <= 0x7E))) { |
| 4122 | 4122 | $line .= $txt[$i]; |
| 4123 | 4123 | } else { |
| 4124 | - $line .= '=' . sprintf('%02X', $ord); |
|
| 4124 | + $line .= '='.sprintf('%02X', $ord); |
|
| 4125 | 4125 | } |
| 4126 | 4126 | } |
| 4127 | 4127 | |
@@ -4141,14 +4141,13 @@ discard block |
||
| 4141 | 4141 | { |
| 4142 | 4142 | if (!defined('PKCS7_TEXT')) { |
| 4143 | 4143 | if ($this->exceptions) { |
| 4144 | - throw new Exception($this->lang('extension_missing') . 'openssl'); |
|
| 4144 | + throw new Exception($this->lang('extension_missing').'openssl'); |
|
| 4145 | 4145 | } |
| 4146 | 4146 | |
| 4147 | 4147 | return ''; |
| 4148 | 4148 | } |
| 4149 | 4149 | $privKeyStr = !empty($this->DKIM_private_string) ? |
| 4150 | - $this->DKIM_private_string : |
|
| 4151 | - file_get_contents($this->DKIM_private); |
|
| 4150 | + $this->DKIM_private_string : file_get_contents($this->DKIM_private); |
|
| 4152 | 4151 | if ('' != $this->DKIM_passphrase) { |
| 4153 | 4152 | $privKey = openssl_pkey_get_private($privKeyStr, $this->DKIM_passphrase); |
| 4154 | 4153 | } else { |
@@ -4200,7 +4199,7 @@ discard block |
||
| 4200 | 4199 | //But then says to delete space before and after the colon. |
| 4201 | 4200 | //Net result is the same as trimming both ends of the value. |
| 4202 | 4201 | //by elimination, the same applies to the field name |
| 4203 | - $lines[$key] = trim($heading, " \t") . ':' . trim($value, " \t"); |
|
| 4202 | + $lines[$key] = trim($heading, " \t").':'.trim($value, " \t"); |
|
| 4204 | 4203 | } |
| 4205 | 4204 | |
| 4206 | 4205 | return implode("\r\n", $lines); |
@@ -4226,7 +4225,7 @@ discard block |
||
| 4226 | 4225 | $body = static::normalizeBreaks($body, "\r\n"); |
| 4227 | 4226 | |
| 4228 | 4227 | //Reduce multiple trailing line breaks to a single one |
| 4229 | - return rtrim($body, "\r\n") . "\r\n"; |
|
| 4228 | + return rtrim($body, "\r\n")."\r\n"; |
|
| 4230 | 4229 | } |
| 4231 | 4230 | |
| 4232 | 4231 | /** |
@@ -4282,33 +4281,33 @@ discard block |
||
| 4282 | 4281 | if ('' == $this->DKIM_identity) { |
| 4283 | 4282 | $ident = ''; |
| 4284 | 4283 | } else { |
| 4285 | - $ident = ' i=' . $this->DKIM_identity . ';'; |
|
| 4286 | - } |
|
| 4287 | - $dkimhdrs = 'DKIM-Signature: v=1; a=' . |
|
| 4288 | - $DKIMsignatureType . '; q=' . |
|
| 4289 | - $DKIMquery . '; l=' . |
|
| 4290 | - $DKIMlen . '; s=' . |
|
| 4291 | - $this->DKIM_selector . |
|
| 4292 | - ";\r\n" . |
|
| 4293 | - "\tt=" . $DKIMtime . '; c=' . $DKIMcanonicalization . ";\r\n" . |
|
| 4294 | - "\th=From:To:Date:Subject;\r\n" . |
|
| 4295 | - "\td=" . $this->DKIM_domain . ';' . $ident . "\r\n" . |
|
| 4296 | - "\tz=$from\r\n" . |
|
| 4297 | - "\t|$to\r\n" . |
|
| 4298 | - "\t|$date\r\n" . |
|
| 4299 | - "\t|$subject;\r\n" . |
|
| 4300 | - "\tbh=" . $DKIMb64 . ";\r\n" . |
|
| 4284 | + $ident = ' i='.$this->DKIM_identity.';'; |
|
| 4285 | + } |
|
| 4286 | + $dkimhdrs = 'DKIM-Signature: v=1; a='. |
|
| 4287 | + $DKIMsignatureType.'; q='. |
|
| 4288 | + $DKIMquery.'; l='. |
|
| 4289 | + $DKIMlen.'; s='. |
|
| 4290 | + $this->DKIM_selector. |
|
| 4291 | + ";\r\n". |
|
| 4292 | + "\tt=".$DKIMtime.'; c='.$DKIMcanonicalization.";\r\n". |
|
| 4293 | + "\th=From:To:Date:Subject;\r\n". |
|
| 4294 | + "\td=".$this->DKIM_domain.';'.$ident."\r\n". |
|
| 4295 | + "\tz=$from\r\n". |
|
| 4296 | + "\t|$to\r\n". |
|
| 4297 | + "\t|$date\r\n". |
|
| 4298 | + "\t|$subject;\r\n". |
|
| 4299 | + "\tbh=".$DKIMb64.";\r\n". |
|
| 4301 | 4300 | "\tb="; |
| 4302 | 4301 | $toSign = $this->DKIM_HeaderC( |
| 4303 | - $from_header . "\r\n" . |
|
| 4304 | - $to_header . "\r\n" . |
|
| 4305 | - $date_header . "\r\n" . |
|
| 4306 | - $subject_header . "\r\n" . |
|
| 4302 | + $from_header."\r\n". |
|
| 4303 | + $to_header."\r\n". |
|
| 4304 | + $date_header."\r\n". |
|
| 4305 | + $subject_header."\r\n". |
|
| 4307 | 4306 | $dkimhdrs |
| 4308 | 4307 | ); |
| 4309 | 4308 | $signed = $this->DKIM_Sign($toSign); |
| 4310 | 4309 | |
| 4311 | - return static::normalizeBreaks($dkimhdrs . $signed) . static::$LE; |
|
| 4310 | + return static::normalizeBreaks($dkimhdrs.$signed).static::$LE; |
|
| 4312 | 4311 | } |
| 4313 | 4312 | |
| 4314 | 4313 | /** |
@@ -4321,7 +4320,7 @@ discard block |
||
| 4321 | 4320 | */ |
| 4322 | 4321 | public static function hasLineLongerThanMax($str) |
| 4323 | 4322 | { |
| 4324 | - return (bool) preg_match('/^(.{' . (self::MAX_LINE_LENGTH + strlen(static::$LE)) . ',})/m', $str); |
|
| 4323 | + return (bool) preg_match('/^(.{'.(self::MAX_LINE_LENGTH + strlen(static::$LE)).',})/m', $str); |
|
| 4325 | 4324 | } |
| 4326 | 4325 | |
| 4327 | 4326 | /** |
@@ -1,16 +1,16 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | $pattern = '/<img[\s\n]+.*src=[\s\n]*"([^"]+\.(jpg|jpeg|png|gif))"[^>]+>/i'; |
| 3 | -preg_match_all($pattern , $value , $images); |
|
| 4 | -if($opt==='') |
|
| 3 | +preg_match_all($pattern, $value, $images); |
|
| 4 | +if ($opt === '') |
|
| 5 | 5 | { |
| 6 | - if($images[1][0]) return $images[1][0]; |
|
| 6 | + if ($images[1][0]) return $images[1][0]; |
|
| 7 | 7 | else return ''; |
| 8 | 8 | } |
| 9 | 9 | else |
| 10 | 10 | { |
| 11 | - foreach($images[0] as $i=>$image) |
|
| 11 | + foreach ($images[0] as $i=>$image) |
|
| 12 | 12 | { |
| 13 | - if(strpos($image,$opt)!==false) return $images[1][$i]; |
|
| 13 | + if (strpos($image, $opt) !== false) return $images[1][$i]; |
|
| 14 | 14 | } |
| 15 | 15 | } |
| 16 | 16 | |
@@ -1,2 +1,2 @@ |
||
| 1 | 1 | <?php |
| 2 | -return preg_replace_callback("~(\b\w+\b)~",function($m) use($wrapat) {return wordwrap($m[1],$wrapat,' ',1);},$value); |
|
| 2 | +return preg_replace_callback("~(\b\w+\b)~", function($m) use($wrapat) {return wordwrap($m[1], $wrapat, ' ', 1); },$value); |
|
@@ -1,21 +1,21 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | $text = $modx->filter->parseDocumentSource($value); |
| 3 | -$text = str_replace(array("\r\n","\r"),"\n",$text); |
|
| 3 | +$text = str_replace(array("\r\n", "\r"), "\n", $text); |
|
| 4 | 4 | |
| 5 | 5 | $blockElms = 'br,table,tbody,tr,td,th,thead,tfoot,caption,colgroup,div'; |
| 6 | 6 | $blockElms .= ',dl,dd,dt,ul,ol,li,pre,select,option,form,map,area,blockquote'; |
| 7 | 7 | $blockElms .= ',address,math,style,input,p,h1,h2,h3,h4,h5,h6,hr,object,param,embed'; |
| 8 | 8 | $blockElms .= ',noframes,noscript,section,article,aside,hgroup,footer,address,code'; |
| 9 | 9 | $blockElms = explode(',', $blockElms); |
| 10 | -$lines = explode("\n",$text); |
|
| 10 | +$lines = explode("\n", $text); |
|
| 11 | 11 | $c = count($lines); |
| 12 | -foreach($lines as $i=>$line) |
|
| 12 | +foreach ($lines as $i=>$line) |
|
| 13 | 13 | { |
| 14 | 14 | $line = rtrim($line); |
| 15 | - if($i===$c-1) break; |
|
| 16 | - foreach($blockElms as $block) |
|
| 15 | + if ($i === $c - 1) break; |
|
| 16 | + foreach ($blockElms as $block) |
|
| 17 | 17 | { |
| 18 | - if(preg_match("@</?{$block}" . '[^>]*>$@',$line)) |
|
| 18 | + if (preg_match("@</?{$block}".'[^>]*>$@', $line)) |
|
| 19 | 19 | continue 2; |
| 20 | 20 | } |
| 21 | 21 | $lines[$i] = "{$line}<br />"; |
@@ -2,22 +2,22 @@ |
||
| 2 | 2 | $userID = abs($modx->getLoginUserID('web')); |
| 3 | 3 | $modx->qs_hash = md5($modx->qs_hash."^{$userID}^"); |
| 4 | 4 | |
| 5 | -$groupNames = ($this->strlen($opt) > 0 ) ? explode(',',$opt) : array(); |
|
| 5 | +$groupNames = ($this->strlen($opt) > 0) ? explode(',', $opt) : array(); |
|
| 6 | 6 | |
| 7 | 7 | // if $groupNames is not an array return false |
| 8 | -if(!is_array($groupNames)) return 0; |
|
| 8 | +if (!is_array($groupNames)) return 0; |
|
| 9 | 9 | |
| 10 | 10 | // Creates an array with all webgroups the user id is in |
| 11 | 11 | if (isset($modx->filter->cache['mo'][$userID])) $grpNames = $modx->filter->cache['mo'][$userID]; |
| 12 | 12 | else { |
| 13 | - $from = sprintf("[+prefix+]webgroup_names wgn INNER JOIN [+prefix+]web_groups wg ON wg.webgroup=wgn.id AND wg.webuser='%s'",$userID); |
|
| 14 | - $rs = $modx->db->select('wgn.name',$from); |
|
| 15 | - $modx->filter->cache['mo'][$userID] = $grpNames = $modx->db->getColumn('name',$rs); |
|
| 13 | + $from = sprintf("[+prefix+]webgroup_names wgn INNER JOIN [+prefix+]web_groups wg ON wg.webgroup=wgn.id AND wg.webuser='%s'", $userID); |
|
| 14 | + $rs = $modx->db->select('wgn.name', $from); |
|
| 15 | + $modx->filter->cache['mo'][$userID] = $grpNames = $modx->db->getColumn('name', $rs); |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | // Check if a supplied group matches a webgroup from the array we just created |
| 19 | -foreach($groupNames as $k=>$v) { |
|
| 20 | - if(in_array(trim($v),$grpNames)) return 1; |
|
| 19 | +foreach ($groupNames as $k=>$v) { |
|
| 20 | + if (in_array(trim($v), $grpNames)) return 1; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | // If we get here the above logic did not find a match, so return false |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if( ! function_exists('f_owc')){ |
|
| 2 | +if (!function_exists('f_owc')) { |
|
| 3 | 3 | /** |
| 4 | 4 | * @param $path |
| 5 | 5 | * @param $data |
@@ -12,30 +12,30 @@ discard block |
||
| 12 | 12 | fwrite($hnd, $data); |
| 13 | 13 | fclose($hnd); |
| 14 | 14 | |
| 15 | - if(null !== $mode) chmod($path, $mode); |
|
| 16 | - }catch(Exception $e){ |
|
| 15 | + if (null !== $mode) chmod($path, $mode); |
|
| 16 | + } catch (Exception $e) { |
|
| 17 | 17 | // Nothing, this is NOT normal |
| 18 | 18 | unset($e); |
| 19 | 19 | } |
| 20 | 20 | } |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | -$installMode = isset($_POST['installmode']) ? (int)$_POST['installmode'] : 0; |
|
| 24 | -if( ! isset($_lang)) $_lang = array(); |
|
| 23 | +$installMode = isset($_POST['installmode']) ? (int) $_POST['installmode'] : 0; |
|
| 24 | +if (!isset($_lang)) $_lang = array(); |
|
| 25 | 25 | |
| 26 | 26 | echo '<div class="stepcontainer"> |
| 27 | 27 | <ul class="progressbar"> |
| 28 | - <li class="visited">' . $_lang['choose_language'] . '</li> |
|
| 29 | - <li class="visited">' . $_lang['installation_mode'] . '</li> |
|
| 30 | - <li class="visited">' . $_lang['optional_items'] . '</li> |
|
| 31 | - <li class="active">' . $_lang['preinstall_validation'] . '</li> |
|
| 32 | - <li>' . $_lang['install_results'] . '</li> |
|
| 28 | + <li class="visited">' . $_lang['choose_language'].'</li> |
|
| 29 | + <li class="visited">' . $_lang['installation_mode'].'</li> |
|
| 30 | + <li class="visited">' . $_lang['optional_items'].'</li> |
|
| 31 | + <li class="active">' . $_lang['preinstall_validation'].'</li> |
|
| 32 | + <li>' . $_lang['install_results'].'</li> |
|
| 33 | 33 | </ul> |
| 34 | 34 | <div class="clearleft"></div> |
| 35 | 35 | </div>'; |
| 36 | 36 | |
| 37 | -echo '<h2>' . $_lang['preinstall_validation'] . '</h2>'; |
|
| 38 | -echo '<h3>' . $_lang['summary_setup_check'] . '</h3>'; |
|
| 37 | +echo '<h2>'.$_lang['preinstall_validation'].'</h2>'; |
|
| 38 | +echo '<h3>'.$_lang['summary_setup_check'].'</h3>'; |
|
| 39 | 39 | |
| 40 | 40 | $errors = 0; |
| 41 | 41 | |
@@ -43,73 +43,73 @@ discard block |
||
| 43 | 43 | // check PHP version |
| 44 | 44 | define('PHP_MIN_VERSION', '5.4.0'); |
| 45 | 45 | $phpMinVersion = PHP_MIN_VERSION; // Maybe not necessary. For backward compatibility |
| 46 | -echo '<p>' . $_lang['checking_php_version']; |
|
| 46 | +echo '<p>'.$_lang['checking_php_version']; |
|
| 47 | 47 | // -1 if left is less, 0 if equal, +1 if left is higher |
| 48 | 48 | if (version_compare(phpversion(), PHP_MIN_VERSION) < 0) { |
| 49 | 49 | $errors++; |
| 50 | - $tmp = $_lang['you_running_php'] . phpversion() . str_replace('[+min_version+]', PHP_MIN_VERSION, $_lang["modx_requires_php"]); |
|
| 51 | - echo '<span class="notok">' . $_lang['failed'] . '</span>' . $tmp . '</p>'; |
|
| 50 | + $tmp = $_lang['you_running_php'].phpversion().str_replace('[+min_version+]', PHP_MIN_VERSION, $_lang["modx_requires_php"]); |
|
| 51 | + echo '<span class="notok">'.$_lang['failed'].'</span>'.$tmp.'</p>'; |
|
| 52 | 52 | } else { |
| 53 | - echo '<span class="ok">' . $_lang['ok'] . '</span></p>'; |
|
| 53 | + echo '<span class="ok">'.$_lang['ok'].'</span></p>'; |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | |
| 57 | 57 | // check if iconv is available |
| 58 | -echo '<p>' . $_lang['checking_iconv']; |
|
| 58 | +echo '<p>'.$_lang['checking_iconv']; |
|
| 59 | 59 | $iconv = (int) function_exists('iconv'); |
| 60 | -if ($iconv == '0'){ |
|
| 61 | - echo '<span class="notok">' . $_lang['failed'].'</span></p><p><strong>'.$_lang['checking_iconv_note'].'</strong></p>'; |
|
| 60 | +if ($iconv == '0') { |
|
| 61 | + echo '<span class="notok">'.$_lang['failed'].'</span></p><p><strong>'.$_lang['checking_iconv_note'].'</strong></p>'; |
|
| 62 | 62 | $errors++; |
| 63 | 63 | } else { |
| 64 | - echo '<span class="ok">' . $_lang['ok'] . '</span></p>'; |
|
| 64 | + echo '<span class="ok">'.$_lang['ok'].'</span></p>'; |
|
| 65 | 65 | } |
| 66 | 66 | // check sessions |
| 67 | -echo '<p>' . $_lang['checking_sessions']; |
|
| 67 | +echo '<p>'.$_lang['checking_sessions']; |
|
| 68 | 68 | if ($_SESSION['test'] != 1) { |
| 69 | - echo '<span class="notok">' . $_lang['failed']. '</span></p>'; |
|
| 69 | + echo '<span class="notok">'.$_lang['failed'].'</span></p>'; |
|
| 70 | 70 | $errors++; |
| 71 | 71 | } else { |
| 72 | - echo '<span class="ok">' . $_lang['ok'] . '</span></p>'; |
|
| 72 | + echo '<span class="ok">'.$_lang['ok'].'</span></p>'; |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | |
| 76 | 76 | // check directories |
| 77 | 77 | // cache exists? |
| 78 | -echo '<p>' . $_lang['checking_if_cache_exist']; |
|
| 78 | +echo '<p>'.$_lang['checking_if_cache_exist']; |
|
| 79 | 79 | if (!file_exists("../assets/cache") || !file_exists("../assets/cache/rss")) { |
| 80 | - echo '<span class="notok">' . $_lang['failed'] . '</span></p>'; |
|
| 80 | + echo '<span class="notok">'.$_lang['failed'].'</span></p>'; |
|
| 81 | 81 | $errors++; |
| 82 | 82 | } else { |
| 83 | - echo '<span class="ok">' . $_lang['ok'] . '</span></p>'; |
|
| 83 | + echo '<span class="ok">'.$_lang['ok'].'</span></p>'; |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | |
| 87 | 87 | // cache writable? |
| 88 | -echo '<p>' . $_lang['checking_if_cache_writable']; |
|
| 88 | +echo '<p>'.$_lang['checking_if_cache_writable']; |
|
| 89 | 89 | if (!is_writable("../assets/cache")) { |
| 90 | 90 | $errors++; |
| 91 | - echo '<span class="notok">' . $_lang['failed'] . '</span></p>'; |
|
| 91 | + echo '<span class="notok">'.$_lang['failed'].'</span></p>'; |
|
| 92 | 92 | } else { |
| 93 | - echo '<span class="ok">' . $_lang['ok'] . '</span></p>'; |
|
| 93 | + echo '<span class="ok">'.$_lang['ok'].'</span></p>'; |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | |
| 97 | 97 | // cache files writable? |
| 98 | -echo '<p>' . $_lang['checking_if_cache_file_writable']; |
|
| 98 | +echo '<p>'.$_lang['checking_if_cache_file_writable']; |
|
| 99 | 99 | $tmp = "../assets/cache/siteCache.idx.php"; |
| 100 | -if ( ! file_exists($tmp)) { |
|
| 100 | +if (!file_exists($tmp)) { |
|
| 101 | 101 | f_owc($tmp, "<?php //EVO site cache file ?>"); |
| 102 | 102 | } |
| 103 | -if ( ! is_writable($tmp)) { |
|
| 103 | +if (!is_writable($tmp)) { |
|
| 104 | 104 | $errors++; |
| 105 | - echo '<span class="notok">' . $_lang['failed'] . '</span></p>'; |
|
| 105 | + echo '<span class="notok">'.$_lang['failed'].'</span></p>'; |
|
| 106 | 106 | } else { |
| 107 | 107 | echo '<span class="ok">'.$_lang['ok'].'</span></p>'; |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | |
| 111 | 111 | echo '<p>'.$_lang['checking_if_cache_file2_writable']; |
| 112 | -if ( ! is_writable("../assets/cache/sitePublishing.idx.php")) { |
|
| 112 | +if (!is_writable("../assets/cache/sitePublishing.idx.php")) { |
|
| 113 | 113 | $errors++; |
| 114 | 114 | echo '<span class="notok">'.$_lang['failed'].'</span></p>'; |
| 115 | 115 | } else { |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | |
| 120 | 120 | // File Browser directories exists? |
| 121 | 121 | echo '<p>'.$_lang['checking_if_images_exist']; |
| 122 | -switch(true){ |
|
| 122 | +switch (true) { |
|
| 123 | 123 | case !file_exists("../assets/images"): |
| 124 | 124 | case !file_exists("../assets/files"): |
| 125 | 125 | case !file_exists("../assets/backup"): |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | |
| 135 | 135 | // File Browser directories writable? |
| 136 | 136 | echo '<p>'.$_lang['checking_if_images_writable']; |
| 137 | -switch(true){ |
|
| 137 | +switch (true) { |
|
| 138 | 138 | case !is_writable("../assets/images"): |
| 139 | 139 | case !is_writable("../assets/files"): |
| 140 | 140 | case !is_writable("../assets/backup"): |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | $database_charset = substr($database_collation, 0, strpos($database_collation, '_') - 1); |
| 195 | 195 | $database_connection_charset = $_POST['database_connection_charset']; |
| 196 | 196 | $database_connection_method = $_POST['database_connection_method']; |
| 197 | - $dbase = '`' . $_POST['database_name'] . '`'; |
|
| 197 | + $dbase = '`'.$_POST['database_name'].'`'; |
|
| 198 | 198 | $table_prefix = $_POST['tableprefix']; |
| 199 | 199 | } |
| 200 | 200 | echo '<p>'.$_lang['creating_database_connection']; |
@@ -234,54 +234,54 @@ discard block |
||
| 234 | 234 | |
| 235 | 235 | // check table prefix |
| 236 | 236 | if ($conn && $installMode == 0) { |
| 237 | - echo '<p>' . $_lang['checking_table_prefix'] . $table_prefix . '`: '; |
|
| 238 | - if ($rs= mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`" . $table_prefix . "site_content`")) { |
|
| 239 | - echo '<span class="notok">' . $_lang['failed'] . '</span></b>' . $_lang['table_prefix_already_inuse'] . '</p>'; |
|
| 237 | + echo '<p>'.$_lang['checking_table_prefix'].$table_prefix.'`: '; |
|
| 238 | + if ($rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`".$table_prefix."site_content`")) { |
|
| 239 | + echo '<span class="notok">'.$_lang['failed'].'</span></b>'.$_lang['table_prefix_already_inuse'].'</p>'; |
|
| 240 | 240 | $errors++; |
| 241 | - echo "<p>" . $_lang['table_prefix_already_inuse_note'] . '</p>'; |
|
| 241 | + echo "<p>".$_lang['table_prefix_already_inuse_note'].'</p>'; |
|
| 242 | 242 | } else { |
| 243 | - echo '<span class="ok">' . $_lang['ok'] . '</span></p>'; |
|
| 243 | + echo '<span class="ok">'.$_lang['ok'].'</span></p>'; |
|
| 244 | 244 | } |
| 245 | 245 | } elseif ($conn && $installMode == 2) { |
| 246 | - echo '<p>' . $_lang['checking_table_prefix'] . $table_prefix . '`: '; |
|
| 247 | - if (!$rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`" . $table_prefix . "site_content`")) { |
|
| 248 | - echo '<span class="notok">' . $_lang['failed'] . '</span></b>' . $_lang['table_prefix_not_exist'] . '</p>'; |
|
| 246 | + echo '<p>'.$_lang['checking_table_prefix'].$table_prefix.'`: '; |
|
| 247 | + if (!$rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`".$table_prefix."site_content`")) { |
|
| 248 | + echo '<span class="notok">'.$_lang['failed'].'</span></b>'.$_lang['table_prefix_not_exist'].'</p>'; |
|
| 249 | 249 | $errors++; |
| 250 | - echo '<p>' . $_lang['table_prefix_not_exist_note'] . '</p>'; |
|
| 250 | + echo '<p>'.$_lang['table_prefix_not_exist_note'].'</p>'; |
|
| 251 | 251 | } else { |
| 252 | - echo '<span class="ok">' . $_lang['ok'] . '</span></p>'; |
|
| 252 | + echo '<span class="ok">'.$_lang['ok'].'</span></p>'; |
|
| 253 | 253 | } |
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | // check mysql version |
| 257 | 257 | if ($conn) { |
| 258 | - echo '<p>' . $_lang['checking_mysql_version']; |
|
| 259 | - if ( version_compare(mysqli_get_server_info($conn), '5.0.51', '=') ) { |
|
| 260 | - echo '<span class="notok">' . $_lang['warning'] . '</span></b> <strong>' . $_lang['mysql_5051'] . '</strong></p>'; |
|
| 261 | - echo '<p><span class="notok">' . $_lang['mysql_5051_warning'] . '</span></p>'; |
|
| 258 | + echo '<p>'.$_lang['checking_mysql_version']; |
|
| 259 | + if (version_compare(mysqli_get_server_info($conn), '5.0.51', '=')) { |
|
| 260 | + echo '<span class="notok">'.$_lang['warning'].'</span></b> <strong>'.$_lang['mysql_5051'].'</strong></p>'; |
|
| 261 | + echo '<p><span class="notok">'.$_lang['mysql_5051_warning'].'</span></p>'; |
|
| 262 | 262 | } else { |
| 263 | - echo '<span class="ok">' . $_lang['ok'] . '</span> <strong>' . $_lang['mysql_version_is'] . mysqli_get_server_info($conn) . '</strong></p>'; |
|
| 263 | + echo '<span class="ok">'.$_lang['ok'].'</span> <strong>'.$_lang['mysql_version_is'].mysqli_get_server_info($conn).'</strong></p>'; |
|
| 264 | 264 | } |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | // check for strict mode |
| 268 | 268 | if ($conn) { |
| 269 | - echo '<p>'. $_lang['checking_mysql_strict_mode']; |
|
| 269 | + echo '<p>'.$_lang['checking_mysql_strict_mode']; |
|
| 270 | 270 | $mysqlmode = mysqli_query($conn, "SELECT @@global.sql_mode"); |
| 271 | - if (mysqli_num_rows($mysqlmode) > 0){ |
|
| 271 | + if (mysqli_num_rows($mysqlmode) > 0) { |
|
| 272 | 272 | $modes = mysqli_fetch_array($mysqlmode, MYSQLI_NUM); |
| 273 | 273 | //$modes = array("STRICT_TRANS_TABLES"); // for testing |
| 274 | 274 | // print_r($modes); |
| 275 | 275 | foreach ($modes as $mode) { |
| 276 | 276 | if (stristr($mode, "STRICT_TRANS_TABLES") !== false || stristr($mode, "STRICT_ALL_TABLES") !== false) { |
| 277 | - echo '<span class="notok">' . $_lang['warning'] . '</span></b> <strong> ' . $_lang['strict_mode'] . '</strong></p>'; |
|
| 278 | - echo '<p><span class="notok">' . $_lang['strict_mode_error'] . '</span></p>'; |
|
| 277 | + echo '<span class="notok">'.$_lang['warning'].'</span></b> <strong> '.$_lang['strict_mode'].'</strong></p>'; |
|
| 278 | + echo '<p><span class="notok">'.$_lang['strict_mode_error'].'</span></p>'; |
|
| 279 | 279 | } else { |
| 280 | - echo '<span class="ok">' . $_lang['ok'] . '</span></p>'; |
|
| 280 | + echo '<span class="ok">'.$_lang['ok'].'</span></p>'; |
|
| 281 | 281 | } |
| 282 | 282 | } |
| 283 | 283 | } else { |
| 284 | - echo '<span class="ok">' . $_lang['ok'] . '</span></p>'; |
|
| 284 | + echo '<span class="ok">'.$_lang['ok'].'</span></p>'; |
|
| 285 | 285 | } |
| 286 | 286 | } |
| 287 | 287 | // Version and strict mode check end |
@@ -297,18 +297,18 @@ discard block |
||
| 297 | 297 | f_owc("../assets/cache/installProc.inc.php", '<?php $installStartTime = '.time().'; ?>'); |
| 298 | 298 | } |
| 299 | 299 | |
| 300 | -if($installMode > 0 && $_POST['installdata'] == "1") { |
|
| 301 | - echo '<p class="notes"><strong>' . $_lang['sample_web_site'] . ':</strong> ' . $_lang['sample_web_site_note'] . '</p>'; |
|
| 300 | +if ($installMode > 0 && $_POST['installdata'] == "1") { |
|
| 301 | + echo '<p class="notes"><strong>'.$_lang['sample_web_site'].':</strong> '.$_lang['sample_web_site_note'].'</p>'; |
|
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | if ($errors > 0) { |
| 305 | 305 | echo '<p>'; |
| 306 | - echo $_lang['setup_cannot_continue'] . ' '; |
|
| 306 | + echo $_lang['setup_cannot_continue'].' '; |
|
| 307 | 307 | |
| 308 | - if($errors > 1){ |
|
| 309 | - echo $errors . " " . $_lang['errors'] . $_lang['please_correct_errors'] . $_lang['and_try_again_plural']; |
|
| 310 | - }else{ |
|
| 311 | - echo $_lang['error'] . $_lang['please_correct_error'] . $_lang['and_try_again']; |
|
| 308 | + if ($errors > 1) { |
|
| 309 | + echo $errors." ".$_lang['errors'].$_lang['please_correct_errors'].$_lang['and_try_again_plural']; |
|
| 310 | + } else { |
|
| 311 | + echo $_lang['error'].$_lang['please_correct_error'].$_lang['and_try_again']; |
|
| 312 | 312 | } |
| 313 | 313 | |
| 314 | 314 | echo $_lang['visit_forum']; |
@@ -317,10 +317,10 @@ discard block |
||
| 317 | 317 | |
| 318 | 318 | echo '<p> </p>'; |
| 319 | 319 | |
| 320 | -$nextAction= $errors > 0 ? 'summary' : 'install'; |
|
| 321 | -$nextButton= $errors > 0 ? $_lang['retry'] : $_lang['install']; |
|
| 322 | -$nextVisibility= $errors > 0 || isset($_POST['chkagree']) ? 'visible' : 'hidden'; |
|
| 323 | -$agreeToggle= $errors > 0 ? '' : ' onclick="if(document.getElementById(\'chkagree\').checked){document.getElementById(\'nextbutton\').style.visibility=\'visible\';}else{document.getElementById(\'nextbutton\').style.visibility=\'hidden\';}"'; |
|
| 320 | +$nextAction = $errors > 0 ? 'summary' : 'install'; |
|
| 321 | +$nextButton = $errors > 0 ? $_lang['retry'] : $_lang['install']; |
|
| 322 | +$nextVisibility = $errors > 0 || isset($_POST['chkagree']) ? 'visible' : 'hidden'; |
|
| 323 | +$agreeToggle = $errors > 0 ? '' : ' onclick="if(document.getElementById(\'chkagree\').checked){document.getElementById(\'nextbutton\').style.visibility=\'visible\';}else{document.getElementById(\'nextbutton\').style.visibility=\'hidden\';}"'; |
|
| 324 | 324 | ?> |
| 325 | 325 | <form name="install" id="install_form" action="index.php?action=<?php echo $nextAction ?>" method="post"> |
| 326 | 326 | <div> |
@@ -342,32 +342,32 @@ discard block |
||
| 342 | 342 | |
| 343 | 343 | <input type="hidden" value="<?php echo $_POST['installdata'] ?>" name="installdata" /> |
| 344 | 344 | <?php |
| 345 | - $templates = isset ($_POST['template']) ? $_POST['template'] : array (); |
|
| 345 | + $templates = isset ($_POST['template']) ? $_POST['template'] : array(); |
|
| 346 | 346 | foreach ($templates as $i => $template) echo '<input type="hidden" name="template[]" value="'.$template.'" />'; |
| 347 | 347 | |
| 348 | - $tvs = isset ($_POST['tv']) ? $_POST['tv'] : array (); |
|
| 348 | + $tvs = isset ($_POST['tv']) ? $_POST['tv'] : array(); |
|
| 349 | 349 | foreach ($tvs as $i => $tv) echo '<input type="hidden" name="tv[]" value="'.$tv.'" />'; |
| 350 | 350 | |
| 351 | - $chunks = isset ($_POST['chunk']) ? $_POST['chunk'] : array (); |
|
| 351 | + $chunks = isset ($_POST['chunk']) ? $_POST['chunk'] : array(); |
|
| 352 | 352 | foreach ($chunks as $i => $chunk) echo '<input type="hidden" name="chunk[]" value="'.$chunk.'" />'; |
| 353 | 353 | |
| 354 | - $snippets = isset ($_POST['snippet']) ? $_POST['snippet'] : array (); |
|
| 354 | + $snippets = isset ($_POST['snippet']) ? $_POST['snippet'] : array(); |
|
| 355 | 355 | foreach ($snippets as $i => $snippet) echo '<input type="hidden" name="snippet[]" value="'.$snippet.'" />'; |
| 356 | 356 | |
| 357 | - $plugins = isset ($_POST['plugin']) ? $_POST['plugin'] : array (); |
|
| 357 | + $plugins = isset ($_POST['plugin']) ? $_POST['plugin'] : array(); |
|
| 358 | 358 | foreach ($plugins as $i => $plugin) echo '<input type="hidden" name="plugin[]" value="'.$plugin.'" />'; |
| 359 | 359 | |
| 360 | - $modules = isset ($_POST['module']) ? $_POST['module'] : array (); |
|
| 360 | + $modules = isset ($_POST['module']) ? $_POST['module'] : array(); |
|
| 361 | 361 | foreach ($modules as $i => $module) echo '<input type="hidden" name="module[]" value="'.$module.'" />'; |
| 362 | 362 | ?> |
| 363 | 363 | </div> |
| 364 | 364 | |
| 365 | -<h2><?php echo $_lang['agree_to_terms'];?></h2> |
|
| 365 | +<h2><?php echo $_lang['agree_to_terms']; ?></h2> |
|
| 366 | 366 | <p> |
| 367 | -<input type="checkbox" value="1" id="chkagree" name="chkagree" style="line-height:18px" <?php echo isset($_POST['chkagree']) ? 'checked="checked" ':""; ?><?php echo $agreeToggle;?>/><label for="chkagree" style="display:inline;float:none;line-height:18px;"> <?php echo $_lang['iagree_box']?> </label> |
|
| 367 | +<input type="checkbox" value="1" id="chkagree" name="chkagree" style="line-height:18px" <?php echo isset($_POST['chkagree']) ? 'checked="checked" ' : ""; ?><?php echo $agreeToggle; ?>/><label for="chkagree" style="display:inline;float:none;line-height:18px;"> <?php echo $_lang['iagree_box']?> </label> |
|
| 368 | 368 | </p> |
| 369 | 369 | <p class="buttonlinks"> |
| 370 | 370 | <a href="javascript:document.getElementById('install_form').action='index.php?action=options&language=<?php echo $install_language?>';document.getElementById('install_form').submit();" class="prev" title="<?php echo $_lang['btnback_value']?>"><span><?php echo $_lang['btnback_value']?></span></a> |
| 371 | - <a id="nextbutton" href="javascript:document.getElementById('install_form').submit();" title="<?php echo $nextButton ?>" style="visibility:<?php echo $nextVisibility;?>"><span><?php echo $nextButton ?></span></a> |
|
| 371 | + <a id="nextbutton" href="javascript:document.getElementById('install_form').submit();" title="<?php echo $nextButton ?>" style="visibility:<?php echo $nextVisibility; ?>"><span><?php echo $nextButton ?></span></a> |
|
| 372 | 372 | </p> |
| 373 | 373 | </form> |
@@ -22,35 +22,35 @@ |
||
| 22 | 22 | NOTE: http://www.w3.org/TR/NOTE-datetime |
| 23 | 23 | \*======================================================================*/ |
| 24 | 24 | |
| 25 | -function parse_w3cdtf ( $date_str ) { |
|
| 25 | +function parse_w3cdtf($date_str){ |
|
| 26 | 26 | |
| 27 | 27 | # regex to match wc3dtf |
| 28 | 28 | $pat = "/(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(:(\d{2}))?(?:([-+])(\d{2}):?(\d{2})|(Z))?/"; |
| 29 | 29 | |
| 30 | - if ( preg_match( $pat, $date_str, $match ) ) { |
|
| 31 | - list( $year, $month, $day, $hours, $minutes, $seconds) = |
|
| 32 | - array( $match[1], $match[2], $match[3], $match[4], $match[5], $match[6]); |
|
| 30 | + if (preg_match($pat, $date_str, $match)) { |
|
| 31 | + list($year, $month, $day, $hours, $minutes, $seconds) = |
|
| 32 | + array($match[1], $match[2], $match[3], $match[4], $match[5], $match[6]); |
|
| 33 | 33 | |
| 34 | 34 | # calc epoch for current date assuming GMT |
| 35 | - $epoch = gmmktime( $hours, $minutes, $seconds, $month, $day, $year); |
|
| 35 | + $epoch = gmmktime($hours, $minutes, $seconds, $month, $day, $year); |
|
| 36 | 36 | |
| 37 | 37 | $offset = 0; |
| 38 | - if ( $match[10] == 'Z' ) { |
|
| 38 | + if ($match[10] == 'Z') { |
|
| 39 | 39 | # zulu time, aka GMT |
| 40 | 40 | } |
| 41 | 41 | else { |
| 42 | - list( $tz_mod, $tz_hour, $tz_min ) = |
|
| 43 | - array( $match[8], $match[9], $match[10]); |
|
| 42 | + list($tz_mod, $tz_hour, $tz_min) = |
|
| 43 | + array($match[8], $match[9], $match[10]); |
|
| 44 | 44 | |
| 45 | 45 | # zero out the variables |
| 46 | - if ( ! $tz_hour ) { $tz_hour = 0; } |
|
| 47 | - if ( ! $tz_min ) { $tz_min = 0; } |
|
| 46 | + if (!$tz_hour) { $tz_hour = 0; } |
|
| 47 | + if (!$tz_min) { $tz_min = 0; } |
|
| 48 | 48 | |
| 49 | - $offset_secs = (($tz_hour*60)+$tz_min)*60; |
|
| 49 | + $offset_secs = (($tz_hour * 60) + $tz_min) * 60; |
|
| 50 | 50 | |
| 51 | 51 | # is timezone ahead of GMT? then subtract offset |
| 52 | 52 | # |
| 53 | - if ( $tz_mod == '+' ) { |
|
| 53 | + if ($tz_mod == '+') { |
|
| 54 | 54 | $offset_secs = $offset_secs * -1; |
| 55 | 55 | } |
| 56 | 56 | |
@@ -24,19 +24,19 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | header("Content-Type: text/javascript"); |
| 19 | 19 | die; |
| 20 | 20 | } |
| 21 | -$file = "lang/" . $input->get['lng'] . ".php"; |
|
| 21 | +$file = "lang/".$input->get['lng'].".php"; |
|
| 22 | 22 | $files = dir::content("lang", array( |
| 23 | 23 | 'types' => "file", |
| 24 | 24 | 'pattern' => '/^.*\.php$/' |
@@ -33,4 +33,4 @@ discard block |
||
| 33 | 33 | header("Content-Type: text/javascript; charset={$lang['_charset']}"); |
| 34 | 34 | foreach ($lang as $english => $native) |
| 35 | 35 | if (substr($english, 0, 1) != "_") |
| 36 | - echo "browser.labels['" . text::jsValue($english) . "']=\"" . text::jsValue($native) . "\";"; |
|
| 36 | + echo "browser.labels['".text::jsValue($english)."']=\"".text::jsValue($native)."\";"; |
|