Regenerated the third_party libraries.

This commit is contained in:
Alex Tselegidis 2016-04-24 10:24:16 +02:00
parent c0a5a9b562
commit aae60c8b4e
11 changed files with 517 additions and 301 deletions

View file

@ -4,4 +4,4 @@
require_once __DIR__ . '/composer' . '/autoload_real.php';
return ComposerAutoloaderInitc1b442ad6654c006bdaf24db72724a82::getLoader();
return ComposerAutoloaderInit643d16bb26f1ca0b505db35afcc43aff::getLoader();

View file

@ -1,5 +1,5 @@
Copyright (c) 2015 Nils Adermann, Jordi Boggiano
Copyright (c) 2016 Nils Adermann, Jordi Boggiano
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View file

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInitc1b442ad6654c006bdaf24db72724a82
class ComposerAutoloaderInit643d16bb26f1ca0b505db35afcc43aff
{
private static $loader;
@ -19,9 +19,9 @@ class ComposerAutoloaderInitc1b442ad6654c006bdaf24db72724a82
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInitc1b442ad6654c006bdaf24db72724a82', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit643d16bb26f1ca0b505db35afcc43aff', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInitc1b442ad6654c006bdaf24db72724a82', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit643d16bb26f1ca0b505db35afcc43aff', 'loadClassLoader'));
$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {

View file

@ -51,17 +51,17 @@
},
{
"name": "phpmailer/phpmailer",
"version": "v5.2.13",
"version_normalized": "5.2.13.0",
"version": "v5.2.14",
"version_normalized": "5.2.14.0",
"source": {
"type": "git",
"url": "https://github.com/PHPMailer/PHPMailer.git",
"reference": "45df3a88f7f46071e10d0b600f228d19f95911b3"
"reference": "e774bc9152de85547336e22b8926189e582ece95"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/45df3a88f7f46071e10d0b600f228d19f95911b3",
"reference": "45df3a88f7f46071e10d0b600f228d19f95911b3",
"url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/e774bc9152de85547336e22b8926189e582ece95",
"reference": "e774bc9152de85547336e22b8926189e582ece95",
"shasum": ""
},
"require": {
@ -72,9 +72,10 @@
"phpunit/phpunit": "4.7.*"
},
"suggest": {
"league/oauth2-client": "Needed for Gmail's XOAUTH2 authentication system"
"league/oauth2-client": "Needed for XOAUTH2 authentication",
"league/oauth2-google": "Needed for Gmail XOAUTH2"
},
"time": "2015-09-14 09:18:12",
"time": "2015-11-01 10:15:28",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -110,5 +111,39 @@
}
],
"description": "PHPMailer is a full-featured email creation and transfer class for PHP"
},
{
"name": "codeigniter/framework",
"version": "3.0.6",
"version_normalized": "3.0.6.0",
"source": {
"type": "git",
"url": "https://github.com/bcit-ci/CodeIgniter.git",
"reference": "8082544c5b4b33175790f505587e202e3ca9e488"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/bcit-ci/CodeIgniter/zipball/8082544c5b4b33175790f505587e202e3ca9e488",
"reference": "8082544c5b4b33175790f505587e202e3ca9e488",
"shasum": ""
},
"require": {
"php": ">=5.2.4"
},
"require-dev": {
"mikey179/vfsstream": "1.1.*"
},
"suggest": {
"paragonie/random_compat": "Provides better randomness in PHP 5.x"
},
"time": "2016-03-21 16:26:30",
"type": "project",
"installation-source": "dist",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "The CodeIgniter framework",
"homepage": "https://codeigniter.com"
}
]

View file

@ -1 +1 @@
5.2.13
5.2.14

File diff suppressed because it is too large Load diff

View file

@ -27,38 +27,38 @@ class PHPMailerOAuth extends PHPMailer
{
/**
* The OAuth user's email address
* @type string
* @var string
*/
public $oauthUserEmail = '';
/**
* The OAuth refresh token
* @type string
* @var string
*/
public $oauthRefreshToken = '';
/**
* The OAuth client ID
* @type string
* @var string
*/
public $oauthClientId = '';
/**
* The OAuth client secret
* @type string
* @var string
*/
public $oauthClientSecret = '';
/**
* An instance of the OAuth class.
* @type OAuth
* An instance of the PHPMailerOAuthGoogle class.
* @var PHPMailerOAuthGoogle
* @access protected
*/
protected $oauth = null;
/**
* Get an OAuth instance to use.
* @return OAuth
* Get a PHPMailerOAuthGoogle instance to use.
* @return PHPMailerOAuthGoogle
*/
public function getOAUTHInstance()
{
@ -79,19 +79,18 @@ class PHPMailerOAuth extends PHPMailer
* @param array $options An array of options compatible with stream_context_create()
* @uses SMTP
* @access public
* @throws phpmailerException
* @return boolean
* @return bool
*/
public function smtpConnect($options = array())
{
if (is_null($this->smtp)) {
$this->smtp = $this->getSMTPInstance();
}
if (is_null($this->oauth)) {
$this->oauth = $this->getOAUTHInstance();
}
// Already connected?
if ($this->smtp->connected()) {
return true;

View file

@ -30,7 +30,13 @@ class PHPMailerOAuthGoogle
private $oauthRefreshToken = '';
private $oauthClientId = '';
private $oauthClientSecret = '';
/**
* @param string $UserEmail
* @param string $ClientSecret
* @param string $ClientId
* @param string $RefreshToken
*/
public function __construct(
$UserEmail,
$ClientSecret,
@ -49,19 +55,19 @@ class PHPMailerOAuthGoogle
'clientSecret' => $this->oauthClientSecret
]);
}
private function getGrant()
{
return new \League\OAuth2\Client\Grant\RefreshToken();
}
private function getToken()
{
$provider = $this->getProvider();
$grant = $this->getGrant();
return $provider->getAccessToken($grant, ['refresh_token' => $this->oauthRefreshToken]);
}
public function getOauth64()
{
$token = $this->getToken();

View file

@ -31,28 +31,28 @@ class POP3
{
/**
* The POP3 PHPMailer Version number.
* @type string
* @var string
* @access public
*/
public $Version = '5.2.13';
public $Version = '5.2.14';
/**
* Default POP3 port number.
* @type integer
* @var integer
* @access public
*/
public $POP3_PORT = 110;
/**
* Default timeout in seconds.
* @type integer
* @var integer
* @access public
*/
public $POP3_TIMEOUT = 30;
/**
* POP3 Carriage Return + Line Feed.
* @type string
* @var string
* @access public
* @deprecated Use the constant instead
*/
@ -61,66 +61,66 @@ class POP3
/**
* Debug display level.
* Options: 0 = no, 1+ = yes
* @type integer
* @var integer
* @access public
*/
public $do_debug = 0;
/**
* POP3 mail server hostname.
* @type string
* @var string
* @access public
*/
public $host;
/**
* POP3 port number.
* @type integer
* @var integer
* @access public
*/
public $port;
/**
* POP3 Timeout Value in seconds.
* @type integer
* @var integer
* @access public
*/
public $tval;
/**
* POP3 username
* @type string
* @var string
* @access public
*/
public $username;
/**
* POP3 password.
* @type string
* @var string
* @access public
*/
public $password;
/**
* Resource handle for the POP3 connection socket.
* @type resource
* @access private
* @var resource
* @access protected
*/
private $pop_conn;
protected $pop_conn;
/**
* Are we connected?
* @type boolean
* @access private
* @var boolean
* @access protected
*/
private $connected = false;
protected $connected = false;
/**
* Error container.
* @type array
* @access private
* @var array
* @access protected
*/
private $errors = array();
protected $errors = array();
/**
* Line break constant
@ -310,9 +310,9 @@ class POP3
* $size is the maximum number of bytes to retrieve
* @param integer $size
* @return string
* @access private
* @access protected
*/
private function getResponse($size = 128)
protected function getResponse($size = 128)
{
$response = fgets($this->pop_conn, $size);
if ($this->do_debug >= 1) {
@ -325,9 +325,9 @@ class POP3
* Send raw data to the POP3 server.
* @param string $string
* @return integer
* @access private
* @access protected
*/
private function sendString($string)
protected function sendString($string)
{
if ($this->pop_conn) {
if ($this->do_debug >= 2) { //Show client messages when debug >= 2
@ -343,9 +343,9 @@ class POP3
* Looks for for +OK or -ERR.
* @param string $string
* @return boolean
* @access private
* @access protected
*/
private function checkResponse($string)
protected function checkResponse($string)
{
if (substr($string, 0, 3) !== '+OK') {
$this->setError(array(
@ -363,8 +363,9 @@ class POP3
* Add an error to the internal error store.
* Also display debug output if it's enabled.
* @param $error
* @access protected
*/
private function setError($error)
protected function setError($error)
{
$this->errors[] = $error;
if ($this->do_debug >= 1) {
@ -376,15 +377,24 @@ class POP3
}
}
/**
* Get an array of error messages, if any.
* @return array
*/
public function getErrors()
{
return $this->errors;
}
/**
* POP3 connection error handler.
* @param integer $errno
* @param string $errstr
* @param string $errfile
* @param integer $errline
* @access private
* @access protected
*/
private function catchWarning($errno, $errstr, $errfile, $errline)
protected function catchWarning($errno, $errstr, $errfile, $errline)
{
$this->setError(array(
'error' => "Connecting to the POP3 server raised a PHP warning: ",

View file

@ -28,25 +28,25 @@ class SMTP
{
/**
* The PHPMailer SMTP version number.
* @type string
* @var string
*/
const VERSION = '5.2.13';
const VERSION = '5.2.14';
/**
* SMTP line break constant.
* @type string
* @var string
*/
const CRLF = "\r\n";
/**
* The SMTP port to use if one is not specified.
* @type integer
* @var integer
*/
const DEFAULT_SMTP_PORT = 25;
/**
* The maximum line length allowed by RFC 2822 section 2.1.1
* @type integer
* @var integer
*/
const MAX_LINE_LENGTH = 998;
@ -77,15 +77,15 @@ class SMTP
/**
* The PHPMailer SMTP Version number.
* @type string
* @var string
* @deprecated Use the `VERSION` constant instead
* @see SMTP::VERSION
*/
public $Version = '5.2.13';
public $Version = '5.2.14';
/**
* SMTP server port number.
* @type integer
* @var integer
* @deprecated This is only ever used as a default value, so use the `DEFAULT_SMTP_PORT` constant instead
* @see SMTP::DEFAULT_SMTP_PORT
*/
@ -93,7 +93,7 @@ class SMTP
/**
* SMTP reply line ending.
* @type string
* @var string
* @deprecated Use the `CRLF` constant instead
* @see SMTP::CRLF
*/
@ -107,7 +107,7 @@ class SMTP
* * self::DEBUG_SERVER (`2`) Client commands and server responses
* * self::DEBUG_CONNECTION (`3`) As DEBUG_SERVER plus connection status
* * self::DEBUG_LOWLEVEL (`4`) Low-level data output, all messages
* @type integer
* @var integer
*/
public $do_debug = self::DEBUG_OFF;
@ -122,7 +122,7 @@ class SMTP
* <code>
* $smtp->Debugoutput = function($str, $level) {echo "debug level $level; message: $str";};
* </code>
* @type string|callable
* @var string|callable
*/
public $Debugoutput = 'echo';
@ -130,7 +130,7 @@ class SMTP
* Whether to use VERP.
* @link http://en.wikipedia.org/wiki/Variable_envelope_return_path
* @link http://www.postfix.org/VERP_README.html Info on VERP
* @type boolean
* @var boolean
*/
public $do_verp = false;
@ -139,26 +139,26 @@ class SMTP
* Default of 5 minutes (300sec) is from RFC2821 section 4.5.3.2
* This needs to be quite high to function correctly with hosts using greetdelay as an anti-spam measure.
* @link http://tools.ietf.org/html/rfc2821#section-4.5.3.2
* @type integer
* @var integer
*/
public $Timeout = 300;
/**
* How long to wait for commands to complete, in seconds.
* Default of 5 minutes (300sec) is from RFC2821 section 4.5.3.2
* @type integer
* @var integer
*/
public $Timelimit = 300;
/**
* The socket for the server connection.
* @type resource
* @var resource
*/
protected $smtp_conn;
/**
* Error information, if any, for the last SMTP command.
* @type array
* @var array
*/
protected $error = array(
'error' => '',
@ -170,7 +170,7 @@ class SMTP
/**
* The reply the server sent to us for HELO.
* If null, no HELO string has yet been received.
* @type string|null
* @var string|null
*/
protected $helo_rply = null;
@ -181,13 +181,13 @@ class SMTP
* represents the server name. In case of HELO it is the only element of the array.
* Other values can be boolean TRUE or an array containing extension options.
* If null, no HELO/EHLO string has yet been received.
* @type array|null
* @var array|null
*/
protected $server_caps = null;
/**
* The most recent reply received from the server.
* @type string
* @var string
*/
protected $last_reply = '';
@ -356,7 +356,7 @@ class SMTP
* @param string $authtype The auth type (PLAIN, LOGIN, NTLM, CRAM-MD5, XOAUTH2)
* @param string $realm The auth realm for NTLM
* @param string $workstation The auth workstation for NTLM
* @param null|OAuth $OAuth An optional OAuth instance (@see PHPMailerOAuth)
* @param null|OAuth $OAuth An optional OAuth instance (@see PHPMailerOAuth)
* @return bool True if successfully authenticated.* @access public
*/
public function authenticate(
@ -814,15 +814,15 @@ class SMTP
* Sets the TO argument to $toaddr.
* Returns true if the recipient was accepted false if it was rejected.
* Implements from rfc 821: RCPT <SP> TO:<forward-path> <CRLF>
* @param string $toaddr The address the message is being sent to
* @param string $address The address the message is being sent to
* @access public
* @return boolean
*/
public function recipient($toaddr)
public function recipient($address)
{
return $this->sendCommand(
'RCPT TO',
'RCPT TO:<' . $toaddr . '>',
'RCPT TO:<' . $address . '>',
array(250, 251)
);
}
@ -841,9 +841,9 @@ class SMTP
/**
* Send a command to an SMTP server and check its return code.
* @param string $command The command name - not sent to the server
* @param string $command The command name - not sent to the server
* @param string $commandstring The actual command to send
* @param integer|array $expect One or more expected integer success codes
* @param integer|array $expect One or more expected integer success codes
* @access protected
* @return boolean True on success.
*/
@ -853,6 +853,11 @@ class SMTP
$this->setError("Called $command without being connected");
return false;
}
//Reject line breaks in all commands
if (strpos($commandstring, "\n") !== false or strpos($commandstring, "\r") !== false) {
$this->setError("Command '$command' contained line breaks");
return false;
}
$this->client_send($commandstring . self::CRLF);
$this->last_reply = $this->get_lines();

View file

@ -1,64 +1,60 @@
<?php
/**
* Get an OAuth2 token from Google.
* * Install this script on your server so that it's accessible
* as [https/http]://<yourdomain>/<folder>/get_oauth_token.php
* e.g.: http://localhost/phpmail/get_oauth_token.php
* * Ensure dependencies are installed with 'composer install'
* * Set up an app in your Google developer console
* * Set the script address as the app's redirect URL
* If no refresh token is obtained when running this file, revoke access to your app
* using link: https://accounts.google.com/b/0/IssuedAuthSubTokens and run the script again.
* This script requires PHP 5.4 or later
*/
require 'vendor/autoload.php';
session_start();
//If this automatic URL doesn't work, set it yourself manually
$redirectUri = isset($_SERVER['HTTPS']) ? 'https://' : 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
//$redirectUri = 'http://localhost/phpmailer/get_oauth_token.php';
$clientId = 'RANDOMCHARS-----duv1n2.apps.googleusercontent.com';
$clientSecret = 'RANDOMCHARS-----lGyjPcRtvP';
//All details obtained by setting up app in Google developer console.
//Set Redirect URI in Developer Console as [https/http]://<yourdomain>/<folder>/get_oauth_token.php
$provider = new League\OAuth2\Client\Provider\Google (
[
'clientId' => $clientId,
'clientSecret' => $clientSecret,
'redirectUri' => $redirectUri,
'scopes' => ['https://mail.google.com/'],
'accessType' => 'offline'
]
);
if (!isset($_GET['code'])) {
// If we don't have an authorization code then get one
$authUrl = $provider->getAuthorizationUrl();
$_SESSION['oauth2state'] = $provider->state;
header('Location: ' . $authUrl);
exit;
// Check given state against previously stored one to mitigate CSRF attack
} elseif (empty($_GET['state']) || ($_GET['state'] !== $_SESSION['oauth2state'])) {
unset($_SESSION['oauth2state']);
exit('Invalid state');
} else {
$provider->accessType = 'offline';
// Try to get an access token (using the authorization code grant)
$token = $provider->getAccessToken(
'authorization_code',
[
'code' => $_GET['code']
]
);
// Use this to interact with an API on the users behalf
// echo $token->accessToken.'<br>';
// Use this to get a new access token if the old one expires
echo 'Refresh Token: ' . $token->refreshToken;
// Unix timestamp of when the token will expire, and need refreshing
// echo $token->expires;
}
<?php
/**
* Get an OAuth2 token from Google.
* * Install this script on your server so that it's accessible
* as [https/http]://<yourdomain>/<folder>/get_oauth_token.php
* e.g.: http://localhost/phpmail/get_oauth_token.php
* * Ensure dependencies are installed with 'composer install'
* * Set up an app in your Google developer console
* * Set the script address as the app's redirect URL
* If no refresh token is obtained when running this file, revoke access to your app
* using link: https://accounts.google.com/b/0/IssuedAuthSubTokens and run the script again.
* This script requires PHP 5.4 or later
* PHP Version 5.4
*/
require 'vendor/autoload.php';
session_start();
//If this automatic URL doesn't work, set it yourself manually
$redirectUri = isset($_SERVER['HTTPS']) ? 'https://' : 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
//$redirectUri = 'http://localhost/phpmailer/get_oauth_token.php';
//These details obtained are by setting up app in Google developer console.
$clientId = 'RANDOMCHARS-----duv1n2.apps.googleusercontent.com';
$clientSecret = 'RANDOMCHARS-----lGyjPcRtvP';
//Set Redirect URI in Developer Console as [https/http]://<yourdomain>/<folder>/get_oauth_token.php
$provider = new League\OAuth2\Client\Provider\Google(
array(
'clientId' => $clientId,
'clientSecret' => $clientSecret,
'redirectUri' => $redirectUri,
'scopes' => array('https://mail.google.com/'),
'accessType' => 'offline'
)
);
if (!isset($_GET['code'])) {
// If we don't have an authorization code then get one
$authUrl = $provider->getAuthorizationUrl();
$_SESSION['oauth2state'] = $provider->getState();
header('Location: ' . $authUrl);
exit;
// Check given state against previously stored one to mitigate CSRF attack
} elseif (empty($_GET['state']) || ($_GET['state'] !== $_SESSION['oauth2state'])) {
unset($_SESSION['oauth2state']);
exit('Invalid state');
} else {
// Try to get an access token (using the authorization code grant)
$token = $provider->getAccessToken(
'authorization_code',
array(
'code' => $_GET['code']
)
);
// Use this to get a new access token if the old one expires
echo 'Refresh Token: ' . $token->getRefreshToken();
}