diff options
Diffstat (limited to 'engine/lib')
-rw-r--r-- | engine/lib/deprecated-1.9.php (renamed from engine/lib/calendar.php) | 29 | ||||
-rw-r--r-- | engine/lib/xml-rpc.php | 203 |
2 files changed, 20 insertions, 212 deletions
diff --git a/engine/lib/calendar.php b/engine/lib/deprecated-1.9.php index 9a06c5292..31d03428f 100644 --- a/engine/lib/calendar.php +++ b/engine/lib/deprecated-1.9.php @@ -1,14 +1,5 @@ <?php /** - * Elgg calendar / entity / event functions. - * - * @package Elgg.Core - * @subpackage Calendar - * - * @todo Implement or remove - */ - -/** * Return a timestamp for the start of a given day (defaults today). * * @param int $day Day @@ -17,8 +8,10 @@ * * @return int * @access private + * @deprecated 1.9 */ function get_day_start($day = null, $month = null, $year = null) { + elgg_deprecated_notice('get_day_start() has been deprecated', 1.9); return mktime(0, 0, 0, $month, $day, $year); } @@ -31,8 +24,10 @@ function get_day_start($day = null, $month = null, $year = null) { * * @return int * @access private + * @deprecated 1.9 */ function get_day_end($day = null, $month = null, $year = null) { + elgg_deprecated_notice('get_day_end() has been deprecated', 1.9); return mktime(23, 59, 59, $month, $day, $year); } @@ -53,10 +48,12 @@ function get_day_end($day = null, $month = null, $year = null) { * * @return array|false * @access private + * @deprecated 1.9 */ function get_notable_entities($start_time, $end_time, $type = "", $subtype = "", $owner_guid = 0, $order_by = "asc", $limit = 10, $offset = 0, $count = false, $site_guid = 0, $container_guid = null) { + elgg_deprecated_notice('get_notable_entities() has been deprecated', 1.9); global $CONFIG; if ($subtype === false || $subtype === null || $subtype === 0) { @@ -201,10 +198,12 @@ $container_guid = null) { * * @return int|array A list of entities, or a count if $count is set to true * @access private + * @deprecated 1.9 */ function get_notable_entities_from_metadata($start_time, $end_time, $meta_name, $meta_value = "", $entity_type = "", $entity_subtype = "", $owner_guid = 0, $limit = 10, $offset = 0, $order_by = "", $site_guid = 0, $count = false) { + elgg_deprecated_notice('get_notable_entities_from_metadata() has been deprecated', 1.9); global $CONFIG; @@ -331,10 +330,12 @@ $site_guid = 0, $count = false) { * * @return array|int|false An array of entities, or the number of entities, or false on failure * @access private + * @deprecated 1.9 */ function get_noteable_entities_from_relationship($start_time, $end_time, $relationship, $relationship_guid, $inverse_relationship = false, $type = "", $subtype = "", $owner_guid = 0, $order_by = "", $limit = 10, $offset = 0, $count = false, $site_guid = 0) { + elgg_deprecated_notice('get_noteable_entities_from_relationship() has been deprecated', 1.9); global $CONFIG; @@ -441,9 +442,11 @@ $order_by = "", $limit = 10, $offset = 0, $count = false, $site_guid = 0) { * * @return array|false * @access private + * @deprecated 1.9 */ function get_todays_entities($type = "", $subtype = "", $owner_guid = 0, $order_by = "", $limit = 10, $offset = 0, $count = false, $site_guid = 0, $container_guid = null) { + elgg_deprecated_notice('get_todays_entities() has been deprecated', 1.9); $day_start = get_day_start(); $day_end = get_day_end(); @@ -468,10 +471,12 @@ $limit = 10, $offset = 0, $count = false, $site_guid = 0, $container_guid = null * * @return int|array A list of entities, or a count if $count is set to true * @access private + * @deprecated 1.9 */ function get_todays_entities_from_metadata($meta_name, $meta_value = "", $entity_type = "", $entity_subtype = "", $owner_guid = 0, $limit = 10, $offset = 0, $order_by = "", $site_guid = 0, $count = false) { + elgg_deprecated_notice('get_todays_entities_from_metadata() has been deprecated', 1.9); $day_start = get_day_start(); $day_end = get_day_end(); @@ -499,10 +504,12 @@ $count = false) { * * @return array|int|false An array of entities, or the number of entities, or false on failure * @access private + * @deprecated 1.9 */ function get_todays_entities_from_relationship($relationship, $relationship_guid, $inverse_relationship = false, $type = "", $subtype = "", $owner_guid = 0, $order_by = "", $limit = 10, $offset = 0, $count = false, $site_guid = 0) { + elgg_deprecated_notice('get_todays_entities_from_relationship() has been deprecated', 1.9); $day_start = get_day_start(); $day_end = get_day_end(); @@ -529,9 +536,11 @@ $order_by = "", $limit = 10, $offset = 0, $count = false, $site_guid = 0) { * * @return string A viewable list of entities * @access private + * @deprecated 1.9 */ function list_notable_entities($start_time, $end_time, $type= "", $subtype = "", $owner_guid = 0, $limit = 10, $fullview = true, $listtypetoggle = false, $navigation = true) { + elgg_deprecated_notice('list_notable_entities() has been deprecated', 1.9); $offset = (int) get_input('offset'); $count = get_notable_entities($start_time, $end_time, $type, $subtype, @@ -559,9 +568,11 @@ $limit = 10, $fullview = true, $listtypetoggle = false, $navigation = true) { * * @return string A viewable list of entities * @access private + * @deprecated 1.9 */ function list_todays_entities($type= "", $subtype = "", $owner_guid = 0, $limit = 10, $fullview = true, $listtypetoggle = false, $navigation = true) { + elgg_deprecated_notice('list_todays_entities() has been deprecated', 1.9); $day_start = get_day_start(); $day_end = get_day_end(); diff --git a/engine/lib/xml-rpc.php b/engine/lib/xml-rpc.php deleted file mode 100644 index bfe1a8645..000000000 --- a/engine/lib/xml-rpc.php +++ /dev/null @@ -1,203 +0,0 @@ -<?php -/** - * Elgg XML-RPC library. - * Contains functions and classes to handle XML-RPC services, currently only server only. - * - * @package Elgg.Core - * @subpackage XMLRPC - */ - -/** - * parse XMLRPCCall parameters - * - * Convert an XMLRPCCall result array into native data types - * - * @param array $parameters An array of params - * - * @return array - * @access private - */ -function xmlrpc_parse_params($parameters) { - $result = array(); - - foreach ($parameters as $parameter) { - $result[] = xmlrpc_scalar_value($parameter); - } - - return $result; -} - -/** - * Extract the scalar value of an XMLObject type result array - * - * @param XMLObject $object And object - * - * @return mixed - * @access private - */ -function xmlrpc_scalar_value($object) { - if ($object->name == 'param') { - $object = $object->children[0]->children[0]; - } - - switch ($object->name) { - case 'string': - return $object->content; - - case 'array': - foreach ($object->children[0]->children as $child) { - $value[] = xmlrpc_scalar_value($child); - } - return $value; - - case 'struct': - foreach ($object->children as $child) { - if (isset($child->children[1]->children[0])) { - $value[$child->children[0]->content] = xmlrpc_scalar_value($child->children[1]->children[0]); - } else { - $value[$child->children[0]->content] = $child->children[1]->content; - } - } - return $value; - - case 'boolean': - return (boolean) $object->content; - - case 'i4': - case 'int': - return (int) $object->content; - - case 'double': - return (double) $object->content; - - case 'dateTime.iso8601': - return (int) strtotime($object->content); - - case 'base64': - return base64_decode($object->content); - - case 'value': - return xmlrpc_scalar_value($object->children[0]); - - default: - // @todo unsupported, throw an error - return false; - } -} - -// Functions for adding handlers ////////////////////////////////////////////////////////// - -/** XML-RPC Handlers */ -global $XML_RPC_HANDLERS; -$XML_RPC_HANDLERS = array(); - -/** - * Register a method handler for a given XML-RPC method. - * - * @param string $method Method parameter. - * @param string $handler The handler function. This function accepts - * one XMLRPCCall object and must return a XMLRPCResponse object. - * - * @return bool - */ -function register_xmlrpc_handler($method, $handler) { - global $XML_RPC_HANDLERS; - - $XML_RPC_HANDLERS[$method] = $handler; -} - -/** - * Trigger a method call and pass the relevant parameters to the funciton. - * - * @param XMLRPCCall $parameters The call and parameters. - * - * @return XMLRPCCall - * @access private - */ -function trigger_xmlrpc_handler(XMLRPCCall $parameters) { - global $XML_RPC_HANDLERS; - - // Go through and see if we have a handler - if (isset($XML_RPC_HANDLERS[$parameters->getMethodName()])) { - $handler = $XML_RPC_HANDLERS[$parameters->getMethodName()]; - $result = $handler($parameters); - - if (!($result instanceof XMLRPCResponse)) { - $msg = elgg_echo('InvalidParameterException:UnexpectedReturnFormat', - array($parameters->getMethodName())); - throw new InvalidParameterException($msg); - } - - // Result in right format, return it. - return $result; - } - - // if no handler then throw exception - $msg = elgg_echo('NotImplementedException:XMLRPCMethodNotImplemented', - array($parameters->getMethodName())); - throw new NotImplementedException($msg); -} - -/** - * PHP Error handler function. - * This function acts as a wrapper to catch and report PHP error messages. - * - * @see http://uk3.php.net/set-error-handler - * - * @param int $errno Error number - * @param string $errmsg Human readable message - * @param string $filename Filename - * @param int $linenum Line number - * @param array $vars Vars - * - * @return void - * @access private - */ -function _php_xmlrpc_error_handler($errno, $errmsg, $filename, $linenum, $vars) { - $error = date("Y-m-d H:i:s (T)") . ": \"" . $errmsg . "\" in file " - . $filename . " (line " . $linenum . ")"; - - switch ($errno) { - case E_USER_ERROR: - error_log("ERROR: " . $error); - - // Since this is a fatal error, we want to stop any further execution but do so gracefully. - throw new Exception("ERROR: " . $error); - break; - - case E_WARNING : - case E_USER_WARNING : - error_log("WARNING: " . $error); - break; - - default: - error_log("DEBUG: " . $error); - } -} - -/** - * PHP Exception handler for XMLRPC. - * - * @param Exception $exception The exception - * - * @return void - * @access private - */ -function _php_xmlrpc_exception_handler($exception) { - - error_log("*** FATAL EXCEPTION (XML-RPC) *** : " . $exception); - - $code = $exception->getCode(); - - if ($code == 0) { - $code = -32400; - } - - $result = new XMLRPCErrorResponse($exception->getMessage(), $code); - - $vars = array('result' => $result); - - $content = elgg_view("xml-rpc/output", $vars); - - echo elgg_view_page($exception->getMessage(), $content); -} |