diff options
Diffstat (limited to 'engine/classes')
-rw-r--r-- | engine/classes/ElggEntity.php | 3 | ||||
-rw-r--r-- | engine/classes/ElggGroup.php | 9 | ||||
-rw-r--r-- | engine/classes/ElggMemcache.php | 4 | ||||
-rw-r--r-- | engine/classes/ElggObject.php | 5 | ||||
-rw-r--r-- | engine/classes/ElggPluginManifest.php | 2 | ||||
-rw-r--r-- | engine/classes/ElggSite.php | 11 | ||||
-rw-r--r-- | engine/classes/ElggUser.php | 5 | ||||
-rw-r--r-- | engine/classes/XMLRPCArrayParameter.php | 56 | ||||
-rw-r--r-- | engine/classes/XMLRPCBase64Parameter.php | 28 | ||||
-rw-r--r-- | engine/classes/XMLRPCBoolParameter.php | 30 | ||||
-rw-r--r-- | engine/classes/XMLRPCCall.php | 62 | ||||
-rw-r--r-- | engine/classes/XMLRPCDateParameter.php | 33 | ||||
-rw-r--r-- | engine/classes/XMLRPCDoubleParameter.php | 29 | ||||
-rw-r--r-- | engine/classes/XMLRPCErrorResponse.php | 36 | ||||
-rw-r--r-- | engine/classes/XMLRPCIntParameter.php | 29 | ||||
-rw-r--r-- | engine/classes/XMLRPCParameter.php | 16 | ||||
-rw-r--r-- | engine/classes/XMLRPCResponse.php | 71 | ||||
-rw-r--r-- | engine/classes/XMLRPCStringParameter.php | 30 | ||||
-rw-r--r-- | engine/classes/XMLRPCStructParameter.php | 55 | ||||
-rw-r--r-- | engine/classes/XMLRPCSuccessResponse.php | 22 |
20 files changed, 27 insertions, 509 deletions
diff --git a/engine/classes/ElggEntity.php b/engine/classes/ElggEntity.php index fdf2a80ea..df87082fe 100644 --- a/engine/classes/ElggEntity.php +++ b/engine/classes/ElggEntity.php @@ -1335,6 +1335,9 @@ abstract class ElggEntity extends ElggData implements $this->attributes['tables_loaded']++; } + // guid needs to be an int http://trac.elgg.org/ticket/4111 + $this->attributes['guid'] = (int)$this->attributes['guid']; + // Cache object handle if ($this->attributes['guid']) { cache_entity($this); diff --git a/engine/classes/ElggGroup.php b/engine/classes/ElggGroup.php index 49ba27204..0190e5eac 100644 --- a/engine/classes/ElggGroup.php +++ b/engine/classes/ElggGroup.php @@ -309,7 +309,7 @@ class ElggGroup extends ElggEntity * * @param ElggUser $user User * - * @return void + * @return bool */ public function leave(ElggUser $user) { return leave_group($this->getGUID(), $user->getGUID()); @@ -322,7 +322,7 @@ class ElggGroup extends ElggEntity * * @param int $guid GUID of an ElggGroup entity * - * @return true + * @return bool */ protected function load($guid) { // Test to see if we have the generic stuff @@ -340,7 +340,7 @@ class ElggGroup extends ElggEntity $row = get_group_entity_as_row($guid); if (($row) && (!$this->isFullyLoaded())) { // If $row isn't a cached copy then increment the counter - $this->attributes['tables_loaded'] ++; + $this->attributes['tables_loaded']++; } // Now put these into the attributes array as core values @@ -349,6 +349,9 @@ class ElggGroup extends ElggEntity $this->attributes[$key] = $value; } + // guid needs to be an int http://trac.elgg.org/ticket/4111 + $this->attributes['guid'] = (int)$this->attributes['guid']; + return true; } diff --git a/engine/classes/ElggMemcache.php b/engine/classes/ElggMemcache.php index 1fd3be0d1..a54c29723 100644 --- a/engine/classes/ElggMemcache.php +++ b/engine/classes/ElggMemcache.php @@ -161,7 +161,7 @@ class ElggMemcache extends ElggSharedMemoryCache { } $result = $this->memcache->set($key, $data, null, $expires); - if (!$result) { + if ($result === false) { elgg_log("MEMCACHE: FAILED TO SAVE $key", 'ERROR'); } @@ -181,7 +181,7 @@ class ElggMemcache extends ElggSharedMemoryCache { $key = $this->_makeMemcacheKey($key); $result = $this->memcache->get($key); - if (!$result) { + if ($result === false) { elgg_log("MEMCACHE: FAILED TO LOAD $key", 'ERROR'); } diff --git a/engine/classes/ElggObject.php b/engine/classes/ElggObject.php index caccfb038..0b8340697 100644 --- a/engine/classes/ElggObject.php +++ b/engine/classes/ElggObject.php @@ -110,7 +110,7 @@ class ElggObject extends ElggEntity { $row = get_object_entity_as_row($guid); if (($row) && (!$this->isFullyLoaded())) { // If $row isn't a cached copy then increment the counter - $this->attributes['tables_loaded'] ++; + $this->attributes['tables_loaded']++; } // Now put these into the attributes array as core values @@ -119,6 +119,9 @@ class ElggObject extends ElggEntity { $this->attributes[$key] = $value; } + // guid needs to be an int http://trac.elgg.org/ticket/4111 + $this->attributes['guid'] = (int)$this->attributes['guid']; + return true; } diff --git a/engine/classes/ElggPluginManifest.php b/engine/classes/ElggPluginManifest.php index eacc16455..7592eb667 100644 --- a/engine/classes/ElggPluginManifest.php +++ b/engine/classes/ElggPluginManifest.php @@ -553,7 +553,7 @@ class ElggPluginManifest { } /** - * Returns the admin interface to use. + * Should this plugin be activated when Elgg is installed * * @return bool */ diff --git a/engine/classes/ElggSite.php b/engine/classes/ElggSite.php index 16b80b9d3..2d6238a19 100644 --- a/engine/classes/ElggSite.php +++ b/engine/classes/ElggSite.php @@ -128,7 +128,7 @@ class ElggSite extends ElggEntity { $row = get_site_entity_as_row($guid); if (($row) && (!$this->isFullyLoaded())) { // If $row isn't a cached copy then increment the counter - $this->attributes['tables_loaded'] ++; + $this->attributes['tables_loaded']++; } // Now put these into the attributes array as core values @@ -137,6 +137,9 @@ class ElggSite extends ElggEntity { $this->attributes[$key] = $value; } + // guid needs to be an int http://trac.elgg.org/ticket/4111 + $this->attributes['guid'] = (int)$this->attributes['guid']; + return true; } @@ -418,10 +421,10 @@ class ElggSite extends ElggEntity { 'action/security/refreshtoken', 'ajax/view/js/languages', 'upgrade\.php', - 'xml-rpc\.php', - 'mt/mt-xmlrpc\.cgi', 'css/.*', - 'js/.*' + 'js/.*', + 'cache/css/.*', + 'cache/js/.*', ); // include a hook for plugin authors to include public pages diff --git a/engine/classes/ElggUser.php b/engine/classes/ElggUser.php index 75ac008f6..a1c7147a5 100644 --- a/engine/classes/ElggUser.php +++ b/engine/classes/ElggUser.php @@ -114,7 +114,7 @@ class ElggUser extends ElggEntity $row = get_user_entity_as_row($guid); if (($row) && (!$this->isFullyLoaded())) { // If $row isn't a cached copy then increment the counter - $this->attributes['tables_loaded'] ++; + $this->attributes['tables_loaded']++; } // Now put these into the attributes array as core values @@ -123,6 +123,9 @@ class ElggUser extends ElggEntity $this->attributes[$key] = $value; } + // guid needs to be an int http://trac.elgg.org/ticket/4111 + $this->attributes['guid'] = (int)$this->attributes['guid']; + return true; } diff --git a/engine/classes/XMLRPCArrayParameter.php b/engine/classes/XMLRPCArrayParameter.php deleted file mode 100644 index a8edccba7..000000000 --- a/engine/classes/XMLRPCArrayParameter.php +++ /dev/null @@ -1,56 +0,0 @@ -<?php - -/** - * An array containing other XMLRPCParameter objects. - * - * @package Elgg.Core - * @subpackage XMLRPC - * - */ -class XMLRPCArrayParameter extends XMLRPCParameter -{ - /** - * Construct an array. - * - * @param array $parameters Optional array of parameters, if not provided - * then addField must be used. - */ - function __construct($parameters = NULL) { - parent::__construct(); - - if (is_array($parameters)) { - foreach ($parameters as $v) { - $this->addField($v); - } - } - } - - /** - * Add a field to the container. - * - * @param XMLRPCParameter $value The value. - * - * @return void - */ - public function addField(XMLRPCParameter $value) { - if (!is_array($this->value)) { - $this->value = array(); - } - - $this->value[] = $value; - } - - /** - * Converts XML array to string - * - * @return string - */ - function __toString() { - $params = ""; - foreach ($this->value as $value) { - $params .= "$value"; - } - - return "<array><data>$params</data></array>"; - } -} diff --git a/engine/classes/XMLRPCBase64Parameter.php b/engine/classes/XMLRPCBase64Parameter.php deleted file mode 100644 index 7db0a761c..000000000 --- a/engine/classes/XMLRPCBase64Parameter.php +++ /dev/null @@ -1,28 +0,0 @@ -<?php -/** - * A base 64 encoded blob of binary. - * - * @package Elgg.Core - * @subpackage XMLRPC - */ -class XMLRPCBase64Parameter extends XMLRPCParameter { - /** - * Construct a base64 encoded block - * - * @param string $blob Unencoded binary blob - */ - function __construct($blob) { - parent::__construct(); - - $this->value = base64_encode($blob); - } - - /** - * Convert to string - * - * @return string - */ - function __toString() { - return "<value><base64>{$value}</base64></value>"; - } -} diff --git a/engine/classes/XMLRPCBoolParameter.php b/engine/classes/XMLRPCBoolParameter.php deleted file mode 100644 index 607841cb8..000000000 --- a/engine/classes/XMLRPCBoolParameter.php +++ /dev/null @@ -1,30 +0,0 @@ -<?php -/** - * A boolean. - * - * @package Elgg.Core - * @subpackage XMLRPC - */ -class XMLRPCBoolParameter extends XMLRPCParameter { - - /** - * New bool parameter - * - * @param bool $value Value - */ - function __construct($value) { - parent::__construct(); - - $this->value = (bool)$value; - } - - /** - * Convert to string - * - * @return string - */ - function __toString() { - $code = ($this->value) ? "1" : "0"; - return "<value><boolean>{$code}</boolean></value>"; - } -} diff --git a/engine/classes/XMLRPCCall.php b/engine/classes/XMLRPCCall.php deleted file mode 100644 index 8eeba0c29..000000000 --- a/engine/classes/XMLRPCCall.php +++ /dev/null @@ -1,62 +0,0 @@ -<?php -/** - * An XMLRPC call - * - * @package Elgg.Core - * @subpackage XMLRPC - */ -class XMLRPCCall { - /** Method name */ - private $methodname; - - /** Parameters */ - private $params; - - /** - * Construct a new XML RPC Call - * - * @param string $xml XML - */ - function __construct($xml) { - $this->_parse($xml); - } - - /** - * Return the method name associated with the call. - * - * @return string - */ - public function getMethodName() { return $this->methodname; } - - /** - * Return the parameters. - * Returns a nested array of XmlElement. - * - * @see XmlElement - * @return array - */ - public function getParameters() { return $this->params; } - - /** - * Parse the xml into its components according to spec. - * This first version is a little primitive. - * - * @param string $xml XML - * - * @return void - */ - private function _parse($xml) { - $xml = xml_to_object($xml); - - // sanity check - if ((isset($xml->name)) && (strcasecmp($xml->name, "methodCall") != 0)) { - throw new CallException(elgg_echo('CallException:NotRPCCall')); - } - - // method name - $this->methodname = $xml->children[0]->content; - - // parameters - $this->params = $xml->children[1]->children; - } -} diff --git a/engine/classes/XMLRPCDateParameter.php b/engine/classes/XMLRPCDateParameter.php deleted file mode 100644 index 93bbbd8f5..000000000 --- a/engine/classes/XMLRPCDateParameter.php +++ /dev/null @@ -1,33 +0,0 @@ -<?php -/** - * An ISO8601 data and time. - * - * @package Elgg.Core - * @subpackage XMLRPC - */ -class XMLRPCDateParameter extends XMLRPCParameter { - /** - * Construct a date - * - * @param int $timestamp The unix timestamp, or blank for "now". - */ - function __construct($timestamp = 0) { - parent::__construct(); - - $this->value = $timestamp; - - if (!$timestamp) { - $this->value = time(); - } - } - - /** - * Convert to string - * - * @return string - */ - function __toString() { - $value = date('c', $this->value); - return "<value><dateTime.iso8601>{$value}</dateTime.iso8601></value>"; - } -} diff --git a/engine/classes/XMLRPCDoubleParameter.php b/engine/classes/XMLRPCDoubleParameter.php deleted file mode 100644 index b7834650e..000000000 --- a/engine/classes/XMLRPCDoubleParameter.php +++ /dev/null @@ -1,29 +0,0 @@ -<?php -/** - * A double precision signed floating point number. - * - * @package Elgg.Core - * @subpackage XMLRPC - */ -class XMLRPCDoubleParameter extends XMLRPCParameter { - - /** - * New XML Double - * - * @param int $value Value - */ - function __construct($value) { - parent::__construct(); - - $this->value = (float)$value; - } - - /** - * Convert to string - * - * @return string - */ - function __toString() { - return "<value><double>{$this->value}</double></value>"; - } -} diff --git a/engine/classes/XMLRPCErrorResponse.php b/engine/classes/XMLRPCErrorResponse.php deleted file mode 100644 index 425c075cc..000000000 --- a/engine/classes/XMLRPCErrorResponse.php +++ /dev/null @@ -1,36 +0,0 @@ -<?php - -/** - * XMLRPC Error Response - * - * @package Elgg.Core - * @subpackage XMLRPC - */ -class XMLRPCErrorResponse extends XMLRPCResponse { - /** - * Set the error response and error code. - * - * @param string $message The message - * @param int $code Error code (default = system error as defined by - * http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php) - */ - function __construct($message, $code = -32400) { - $this->addParameter( - new XMLRPCStructParameter( - array ( - 'faultCode' => new XMLRPCIntParameter($code), - 'faultString' => new XMLRPCStringParameter($message) - ) - ) - ); - } - - /** - * Output to XML. - * - * @return string - */ - public function __toString() { - return "<methodResponse><fault><value>{$this->parameters[0]}</value></fault></methodResponse>"; - } -} diff --git a/engine/classes/XMLRPCIntParameter.php b/engine/classes/XMLRPCIntParameter.php deleted file mode 100644 index 0fc146165..000000000 --- a/engine/classes/XMLRPCIntParameter.php +++ /dev/null @@ -1,29 +0,0 @@ -<?php -/** - * An Integer. - * - * @package Elgg.Core - * @subpackage XMLRPC - */ -class XMLRPCIntParameter extends XMLRPCParameter { - - /** - * A new XML int - * - * @param int $value Value - */ - function __construct($value) { - parent::__construct(); - - $this->value = (int)$value; - } - - /** - * Convert to string - * - * @return string - */ - function __toString() { - return "<value><i4>{$this->value}</i4></value>"; - } -} diff --git a/engine/classes/XMLRPCParameter.php b/engine/classes/XMLRPCParameter.php deleted file mode 100644 index ffbad8082..000000000 --- a/engine/classes/XMLRPCParameter.php +++ /dev/null @@ -1,16 +0,0 @@ -<?php -/** - * Superclass for all RPC parameters. - * - * @package Elgg.Core - * @subpackage XMLRPC - */ -abstract class XMLRPCParameter { - protected $value; - - /** - * Set initial values - */ - function __construct() { } - -} diff --git a/engine/classes/XMLRPCResponse.php b/engine/classes/XMLRPCResponse.php deleted file mode 100644 index a6256d385..000000000 --- a/engine/classes/XMLRPCResponse.php +++ /dev/null @@ -1,71 +0,0 @@ -<?php - -/** - * XML-RPC Response. - * - * @package Elgg.Core - * @subpackage XMLRPC - */ -abstract class XMLRPCResponse { - /** An array of parameters */ - protected $parameters = array(); - - /** - * Add a parameter here. - * - * @param XMLRPCParameter $param The parameter. - * - * @return void - */ - public function addParameter(XMLRPCParameter $param) { - if (!is_array($this->parameters)) { - $this->parameters = array(); - } - - $this->parameters[] = $param; - } - - /** - * Add an integer - * - * @param int $value Value - * - * @return void - */ - public function addInt($value) { - $this->addParameter(new XMLRPCIntParameter($value)); - } - - /** - * Add a string - * - * @param string $value Value - * - * @return void - */ - public function addString($value) { - $this->addParameter(new XMLRPCStringParameter($value)); - } - - /** - * Add a double - * - * @param int $value Value - * - * @return void - */ - public function addDouble($value) { - $this->addParameter(new XMLRPCDoubleParameter($value)); - } - - /** - * Add a boolean - * - * @param bool $value Value - * - * @return void - */ - public function addBoolean($value) { - $this->addParameter(new XMLRPCBoolParameter($value)); - } -} diff --git a/engine/classes/XMLRPCStringParameter.php b/engine/classes/XMLRPCStringParameter.php deleted file mode 100644 index 35b28214b..000000000 --- a/engine/classes/XMLRPCStringParameter.php +++ /dev/null @@ -1,30 +0,0 @@ -<?php -/** - * A string. - * - * @package Elgg.Core - * @subpackage XMLRPC - */ -class XMLRPCStringParameter extends XMLRPCParameter { - - /** - * A new XML string - * - * @param string $value Value - */ - function __construct($value) { - parent::__construct(); - - $this->value = $value; - } - - /** - * Convert to XML string - * - * @return string - */ - function __toString() { - $value = htmlentities($this->value); - return "<value><string>{$value}</string></value>"; - } -} diff --git a/engine/classes/XMLRPCStructParameter.php b/engine/classes/XMLRPCStructParameter.php deleted file mode 100644 index 694ddf5df..000000000 --- a/engine/classes/XMLRPCStructParameter.php +++ /dev/null @@ -1,55 +0,0 @@ -<?php - -/** - * A structure containing other XMLRPCParameter objects. - * - * @package Elgg.Core - * @subpackage XMLRPC - */ -class XMLRPCStructParameter extends XMLRPCParameter { - /** - * Construct a struct. - * - * @param array $parameters Optional associated array of parameters, if - * not provided then addField must be used. - */ - function __construct($parameters = NULL) { - parent::__construct(); - - if (is_array($parameters)) { - foreach ($parameters as $k => $v) { - $this->addField($k, $v); - } - } - } - - /** - * Add a field to the container. - * - * @param string $name The name of the field. - * @param XMLRPCParameter $value The value. - * - * @return void - */ - public function addField($name, XMLRPCParameter $value) { - if (!is_array($this->value)) { - $this->value = array(); - } - - $this->value[$name] = $value; - } - - /** - * Convert to string - * - * @return string - */ - function __toString() { - $params = ""; - foreach ($this->value as $k => $v) { - $params .= "<member><name>$k</name>$v</member>"; - } - - return "<value><struct>$params</struct></value>"; - } -} diff --git a/engine/classes/XMLRPCSuccessResponse.php b/engine/classes/XMLRPCSuccessResponse.php deleted file mode 100644 index e02e82c5c..000000000 --- a/engine/classes/XMLRPCSuccessResponse.php +++ /dev/null @@ -1,22 +0,0 @@ -<?php -/** - * Success Response - * - * @package Elgg.Core - * @subpackage XMLRPC - */ -class XMLRPCSuccessResponse extends XMLRPCResponse { - /** - * Output to XML. - * - * @return string - */ - public function __toString() { - $params = ""; - foreach ($this->parameters as $param) { - $params .= "<param>$param</param>\n"; - } - - return "<methodResponse><params>$params</params></methodResponse>"; - } -} |