diff options
Diffstat (limited to 'engine/handlers')
| -rw-r--r-- | engine/handlers/cache_handler.php | 19 | ||||
| -rw-r--r-- | engine/handlers/page_handler.php | 8 | ||||
| -rw-r--r-- | engine/handlers/xml-rpc_handler.php | 44 |
3 files changed, 57 insertions, 14 deletions
diff --git a/engine/handlers/cache_handler.php b/engine/handlers/cache_handler.php index b332ec379..36fc665bb 100644 --- a/engine/handlers/cache_handler.php +++ b/engine/handlers/cache_handler.php @@ -64,7 +64,7 @@ $ts = $matches[4]; // If is the same ETag, content didn't changed. $etag = $ts; -if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && trim($_SERVER['HTTP_IF_NONE_MATCH']) == $etag) { +if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && trim($_SERVER['HTTP_IF_NONE_MATCH']) == "\"$etag\"") { header("HTTP/1.1 304 Not Modified"); exit; } @@ -80,23 +80,26 @@ switch ($type) { break; } -header('Expires: ' . date('r', strtotime("+6 months")), true); +header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', strtotime("+6 months")), true); header("Pragma: public", true); header("Cache-Control: public", true); -header("ETag: $etag"); +header("ETag: \"$etag\""); $filename = $dataroot . 'views_simplecache/' . md5($viewtype . $view); if (file_exists($filename)) { - $contents = file_get_contents($filename); + readfile($filename); } else { // someone trying to access a non-cached file or a race condition with cache flushing mysql_close($mysql_dblink); require_once(dirname(dirname(__FILE__)) . "/start.php"); - elgg_regenerate_simplecache(); + + global $CONFIG; + if (!in_array($view, $CONFIG->views->simplecache)) { + header("HTTP/1.1 404 Not Found"); + exit; + } elgg_set_viewtype($viewtype); - $contents = elgg_view($view); + echo elgg_view($view); } - -echo $contents; diff --git a/engine/handlers/page_handler.php b/engine/handlers/page_handler.php index 7eca37bb1..1ed295b7d 100644 --- a/engine/handlers/page_handler.php +++ b/engine/handlers/page_handler.php @@ -13,16 +13,12 @@ * * cache * * services * * export - * * js - * * css + * * mt + * * xml-rpc.php * * rewrite.php * * tag (deprecated, reserved for backwards compatibility) * * pg (deprecated, reserved for backwards compatibility) * - * These additionally are reserved for the xml-rpc plugin - * * mt - * * xml-rpc.php - * * {@link page_handler()} explodes the pages string by / and sends it to * the page handler function as registered by {@link elgg_register_page_handler()}. * If a valid page handler isn't found, plugins have a chance to provide a 404. diff --git a/engine/handlers/xml-rpc_handler.php b/engine/handlers/xml-rpc_handler.php new file mode 100644 index 000000000..2ee29e5b7 --- /dev/null +++ b/engine/handlers/xml-rpc_handler.php @@ -0,0 +1,44 @@ +<?php +/** + * XML-RPC handler. + * + * @warning This is very old code. Does it work at all? + * + * @package Elgg.Core + * @subpackage XMLRPC + * @link http://docs.elgg.org/Tutorials/XMLRPC + * @todo Does this work? + */ + +require_once(dirname(dirname(__FILE__)) . "/start.php"); + +// Register the error handler +error_reporting(E_ALL); +set_error_handler('_php_xmlrpc_error_handler'); + +// Register a default exception handler +set_exception_handler('_php_xmlrpc_exception_handler'); + +// Set some defaults +$result = null; +set_input('view', 'xml'); // Set default view regardless + +// Get the post data +$input = get_post_data(); + +if ($input) { + // Parse structures from xml + $call = new XMLRPCCall($input); + + // Process call + $result = trigger_xmlrpc_handler($call); +} else { + throw new CallException(elgg_echo('xmlrpc:noinputdata')); +} + +if (!($result instanceof XMLRPCResponse)) { + throw new APIException(elgg_echo('APIException:ApiResultUnknown')); +} + +// Output result +echo elgg_view_page("XML-RPC", elgg_view("xml-rpc/output", array('result' => $result))); |
