Commit eb3211ef authored by Son Nguyen's avatar Son Nguyen
Browse files

Bug 1613481: Updating Zend framework to 1.12.19

Following instructions in readme_moodle.txt

behatnotneeded

Change-Id: I079b683f28a75805b1fb4d85326f9d836130817d
parent 87d79be9
......@@ -4,7 +4,7 @@ Zend Web Services in Mahara
Please see the associated readme_moodle.txt
Website: http://framework.zend.com/
Version: 1.12.17
Version: 1.12.19
Changes:
......
......@@ -77,11 +77,8 @@ class Zend_Crypt_Math extends Zend_Crypt_Math_BigInteger
if ($length <= 0) {
return false;
}
if (function_exists('openssl_random_pseudo_bytes')) {
$bytes = openssl_random_pseudo_bytes($length, $usable);
if ($strong === $usable) {
return $bytes;
}
if (function_exists('random_bytes')) { // available in PHP 7
return random_bytes($length);
}
if (function_exists('mcrypt_create_iv')) {
$bytes = mcrypt_create_iv($length, MCRYPT_DEV_URANDOM);
......@@ -134,6 +131,9 @@ class Zend_Crypt_Math extends Zend_Crypt_Math_BigInteger
'The supplied range is too great to generate'
);
}
if (function_exists('random_int')) { // available in PHP 7
return random_int($min, $max);
}
// calculate number of bits required to store range on this machine
$r = $range;
$bits = 0;
......
......@@ -24,6 +24,9 @@
*/
require_once 'Zend/Filter/Encrypt/Interface.php';
/** @see Zend_Crypt_Math */
require_once 'Zend/Crypt/Math.php';
/**
* Encryption adapter for mcrypt
*
......@@ -355,9 +358,8 @@ class Zend_Filter_Encrypt_Mcrypt implements Zend_Filter_Encrypt_Interface
if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
return;
}
if (!self::$_srandCalled) {
srand((double) microtime() * 1000000);
srand(Zend_Crypt_Math::randInteger(0, PHP_INT_MAX));
self::$_srandCalled = true;
}
}
......
......@@ -25,6 +25,9 @@
*/
require_once 'Zend/Http/Client.php';
/** @see Zend_Crypt_Math */
require_once 'Zend/Crypt/Math.php';
/**
* Gdata Http Client object.
*
......@@ -210,7 +213,7 @@ class Zend_Gdata_HttpClient extends Zend_Http_Client
if ($this->getAuthSubPrivateKeyId() != null) {
// secure AuthSub
$time = time();
$nonce = mt_rand(0, 999999999);
$nonce = Zend_Crypt_Math::randInteger(0, 999999999);
$dataToSign = $method . ' ' . $url . ' ' . $time . ' ' . $nonce;
// compute signature
......
This diff is collapsed.
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Health
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$
*/
/**
* @see Zend_Gdata_Entry
*/
require_once 'Zend/Gdata/Entry.php';
/**
* @see Zend_Gdata_YouTube_Extension_VideoId
*/
require_once 'Zend/Gdata/YouTube/Extension/VideoId.php';
/**
* @see Zend_Gdata_YouTube_Extension_Username
*/
require_once 'Zend/Gdata/YouTube/Extension/Username.php';
/**
* @see Zend_Gdata_YouTube_Extension_Rating
*/
require_once 'Zend/Gdata/Extension/Rating.php';
/**
* A concrete class for working with YouTube user activity entries.
*
* @link http://code.google.com/apis/youtube/
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_YouTube_ActivityEntry extends Zend_Gdata_Entry
{
const ACTIVITY_CATEGORY_SCHEME =
'http://gdata.youtube.com/schemas/2007/userevents.cat';
/**
* The classname for individual user activity entry elements.
*
* @var string
*/
protected $_entryClassName = 'Zend_Gdata_YouTube_ActivityEntry';
/**
* The ID of the video that was part of the activity
*
* @var Zend_Gdata_YouTube_VideoId
*/
protected $_videoId = null;
/**
* The username for the user that was part of the activity
*
* @var Zend_Gdata_YouTube_Username
*/
protected $_username = null;
/**
* The rating element that was part of the activity
*
* @var Zend_Gdata_Extension_Rating
*/
protected $_rating = null;
/**
* Constructs a new Zend_Gdata_YouTube_ActivityEntry object.
* @param DOMElement $element (optional) The DOMElement on which to
* base this object.
*/
public function __construct($element = null)
{
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct($element);
}
/**
* Retrieves a DOMElement which corresponds to this element and all
* child properties. This is used to build an entry back into a DOM
* and eventually XML text for application storage/persistence.
*
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
* @return DOMElement The DOMElement representing this element and all
* child properties.
*/
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
{
$element = parent::getDOM($doc, $majorVersion, $minorVersion);
if ($this->_videoId !== null) {
$element->appendChild($this->_videoId->getDOM(
$element->ownerDocument));
}
if ($this->_username !== null) {
$element->appendChild($this->_username->getDOM(
$element->ownerDocument));
}
if ($this->_rating !== null) {
$element->appendChild($this->_rating->getDOM(
$element->ownerDocument));
}
return $element;
}
/**
* Creates individual Entry objects of the appropriate type and
* stores them as members of this entry based upon DOM data.
*
* @param DOMNode $child The DOMNode to process
*/
protected function takeChildFromDOM($child)
{
$absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
switch ($absoluteNodeName) {
case $this->lookupNamespace('yt') . ':' . 'videoid':
$videoId = new Zend_Gdata_YouTube_Extension_VideoId();
$videoId->transferFromDOM($child);
$this->_videoId = $videoId;
break;
case $this->lookupNamespace('yt') . ':' . 'username':
$username = new Zend_Gdata_YouTube_Extension_Username();
$username->transferFromDOM($child);
$this->_username = $username;
break;
case $this->lookupNamespace('gd') . ':' . 'rating':
$rating = new Zend_Gdata_Extension_Rating();
$rating->transferFromDOM($child);
$this->_rating = $rating;
break;
default:
parent::takeChildFromDOM($child);
break;
}
}
/**
* Returns the video ID for this activity entry.
*
* @return null|Zend_Gdata_YouTube_Extension_VideoId
*/
public function getVideoId()
{
return $this->_videoId;
}
/**
* Returns the username for this activity entry.
*
* @return null|Zend_Gdata_YouTube_Extension_Username
*/
public function getUsername()
{
return $this->_username;
}
/**
* Returns the rating for this activity entry.
*
* @return null|Zend_Gdata_YouTube_Extension_Rating
*/
public function getRating()
{
return $this->_rating;
}
/**
* Return the value of the rating for this video entry.
*
* Convenience method to save needless typing.
*
* @return integer|null The value of the rating that was created, if found.
*/
public function getRatingValue()
{
$rating = $this->_rating;
if ($rating) {
return $rating->getValue();
}
return null;
}
/**
* Return the activity type that was performed.
*
* Convenience method that inspects category where scheme is
* http://gdata.youtube.com/schemas/2007/userevents.cat.
*
* @return string|null The activity category if found.
*/
public function getActivityType()
{
$categories = $this->getCategory();
foreach($categories as $category) {
if ($category->getScheme() == self::ACTIVITY_CATEGORY_SCHEME) {
return $category->getTerm();
}
}
return null;
}
/**
* Convenience method to quickly get access to the author of the activity
*
* @return string The author of the activity
*/
public function getAuthorName()
{
$authors = $this->getAuthor();
return $authors[0]->getName()->getText();
}
}
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$
*/
/**
* @see Zend_Gdata_Feed
*/
require_once 'Zend/Gdata/Feed.php';
/**
* @see Zend_Gdata_YouTube_ActivityEntry
*/
require_once 'Zend/Gdata/YouTube/ActivityEntry.php';
/**
* A feed of user activity entries for YouTube
*
* @link http://code.google.com/apis/youtube/
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_YouTube_ActivityFeed extends Zend_Gdata_Feed
{
/**
* The classname for individual feed elements.
*
* @var string
*/
protected $_entryClassName = 'Zend_Gdata_YouTube_ActivityEntry';
/**
* Creates an Activity feed, representing a list of activity entries
*
* @param DOMElement $element (optional) DOMElement from which this
* object should be constructed.
*/
public function __construct($element = null)
{
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct($element);
}
}
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$
*/
/**
* @see Zend_Gdata_Media_Feed
*/
require_once 'Zend/Gdata/Media/Feed.php';
/**
* The YouTube comments flavor of an Atom Entry
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_YouTube_CommentEntry extends Zend_Gdata_Entry
{
/**
* The classname for individual feed elements.
*
* @var string
*/
protected $_entryClassName = 'Zend_Gdata_YouTube_CommentEntry';
/**
* Constructs a new Zend_Gdata_YouTube_CommentEntry object.
* @param DOMElement $element (optional) The DOMElement on which to
* base this object.
*/
public function __construct($element = null)
{
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct($element);
}
}
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$
*/
/**
* @see Zend_Gdata_feed
*/
require_once 'Zend/Gdata/Feed.php';
/**
* @see Zend_Gdata_YouTube_CommentEntry
*/
require_once 'Zend/Gdata/YouTube/CommentEntry.php';
/**
* The YouTube comments flavor of an Atom Feed
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_YouTube_CommentFeed extends Zend_Gdata_Feed
{
/**
* The classname for individual feed elements.
*
* @var string
*/
protected $_entryClassName = 'Zend_Gdata_YouTube_CommentEntry';
/**
* Constructs a new YouTube Comment Feed object, to represent
* a feed of comments for an individual video
*
* @param DOMElement $element (optional) DOMElement from which this
* object should be constructed.
*/
public function __construct($element = null)
{
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct($element);
}
}
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$
*/
/**
* @see Zend_Gdata_YouTube_UserProfileEntry
*/
require_once 'Zend/Gdata/YouTube/UserProfileEntry.php';
/**
* @see Zend_Gdata_YouTube_Extension_Status
*/
require_once 'Zend/Gdata/YouTube/Extension/Status.php';
/**
* The YouTube contacts flavor of an Atom Entry with media support
* Represents a an individual contact
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_YouTube_ContactEntry extends Zend_Gdata_YouTube_UserProfileEntry
{
/**
* The classname for individual feed elements.
*
* @var string
*/
protected $_entryClassName = 'Zend_Gdata_YouTube_ContactEntry';
/**
* Status of the user as a contact
*
* @var string
*/
protected $_status = null;
/**
* Constructs a new Contact Entry object, to represent
* an individual contact for a user
*
* @param DOMElement $element (optional) DOMElement from which this
* object should be constructed.
*/
public function __construct($element = null)
{
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct($element);
}
/**
* Retrieves a DOMElement which corresponds to this element and all
* child properties. This is used to build an entry back into a DOM
* and eventually XML text for sending to the server upon updates, or
* for application storage/persistence.
*
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
* @return DOMElement The DOMElement representing this element and all
* child properties.
*/
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
{
$element = parent::getDOM($doc, $majorVersion, $minorVersion);
if ($this->_status != null) {
$element->appendChild($this->_status->getDOM($element->ownerDocument));
}
return $element;
}
/**
* Creates individual Entry objects of the appropriate type and
* stores them in the $_entry array based upon DOM data.
*