From 95d7c27e5a65f6df5221842bb4427619ccec3327 Mon Sep 17 00:00:00 2001 From: nickw Date: Fri, 14 May 2010 14:30:37 +0000 Subject: Updating core code to allow public pages using new Walled Garden functionality. git-svn-id: http://code.elgg.org/elgg/trunk@6047 36083f99-b078-4883-b0ff-0f9b5a30f544 --- _css/css.php | 21 +-------------------- _css/js.php | 20 +------------------- engine/handlers/action_handler.php | 1 - engine/handlers/cron_handler.php | 1 - engine/handlers/pagehandler.php | 1 - engine/handlers/service_handler.php | 1 - engine/handlers/xml-rpc_handler.php | 1 - engine/lib/cron.php | 20 ++++++++++++++++++++ engine/lib/sites.php | 2 ++ index.php | 1 - mod/externalpages/read.php | 1 - upgrade.php | 1 - 12 files changed, 24 insertions(+), 47 deletions(-) diff --git a/_css/css.php b/_css/css.php index c2b2cfbc7..6d240351c 100644 --- a/_css/css.php +++ b/_css/css.php @@ -8,33 +8,14 @@ * @link http://elgg.org/ */ -/* - -require_once(dirname(dirname(__FILE__)) . "/engine/start.php"); - -$default_css = elgg_view("css"); - -header("Content-type: text/css", true); -header('Expires: ' . date('r',time() + 864000), true); -header("Pragma: public", true); -header("Cache-Control: public", true); -header("Content-Length: " . strlen($default_css)); - -echo $default_css; -*/ - -define('externalpage',true); - global $viewinput, $override; + $viewinput['view'] = 'css'; $viewinput['viewtype'] = $_GET['viewtype']; -//$override = true; - header("Content-type: text/css", true); header('Expires: ' . date('r',time() + 86400000), true); header("Pragma: public", true); header("Cache-Control: public", true); -// header("Content-Length: " . strlen($default_css)); require_once(dirname(dirname(__FILE__)) . '/simplecache/view.php'); diff --git a/_css/js.php b/_css/js.php index 8ffb7945e..6eb056426 100644 --- a/_css/js.php +++ b/_css/js.php @@ -8,25 +8,8 @@ * @link http://elgg.org/ */ -/* - -require_once(dirname(dirname(__FILE__)) . "/engine/start.php"); - -$default_css = elgg_view("css"); - -header("Content-type: text/css", true); -header('Expires: ' . date('r',time() + 864000), true); -header("Pragma: public", true); -header("Cache-Control: public", true); -header("Content-Length: " . strlen($default_css)); - -echo $default_css; -*/ - -define('externalpage',true); - global $viewinput, $override; -//$override = true; + $viewinput['view'] = 'js/' . $_GET['js']; $viewinput['viewtype'] = $_GET['viewtype']; @@ -34,6 +17,5 @@ header('Content-type: text/javascript'); header('Expires: ' . date('r',time() + 864000000)); header("Pragma: public"); header("Cache-Control: public"); -// header("Content-Length: " . strlen($return)); require_once(dirname(dirname(__FILE__)) . '/simplecache/view.php'); \ No newline at end of file diff --git a/engine/handlers/action_handler.php b/engine/handlers/action_handler.php index 52c1a2633..f99e1efdc 100644 --- a/engine/handlers/action_handler.php +++ b/engine/handlers/action_handler.php @@ -12,7 +12,6 @@ /** * Load Elgg framework */ -define('externalpage',true); require_once("../start.php"); $action = get_input("action"); action($action); \ No newline at end of file diff --git a/engine/handlers/cron_handler.php b/engine/handlers/cron_handler.php index 37a0335f6..a86cf7f4c 100644 --- a/engine/handlers/cron_handler.php +++ b/engine/handlers/cron_handler.php @@ -9,7 +9,6 @@ */ // Load Elgg engine -define('externalpage',true); require_once("../start.php"); global $CONFIG; diff --git a/engine/handlers/pagehandler.php b/engine/handlers/pagehandler.php index a0837caa1..24bef4d03 100644 --- a/engine/handlers/pagehandler.php +++ b/engine/handlers/pagehandler.php @@ -9,7 +9,6 @@ */ // Load Elgg engine -// define('externalpage',true); require_once("../start.php"); // Get input diff --git a/engine/handlers/service_handler.php b/engine/handlers/service_handler.php index 51ec2a689..4cc54a987 100644 --- a/engine/handlers/service_handler.php +++ b/engine/handlers/service_handler.php @@ -10,7 +10,6 @@ // Load Elgg engine -define('externalpage',true); require_once("../start.php"); // Get input diff --git a/engine/handlers/xml-rpc_handler.php b/engine/handlers/xml-rpc_handler.php index 26c1454bf..67d99a6ac 100644 --- a/engine/handlers/xml-rpc_handler.php +++ b/engine/handlers/xml-rpc_handler.php @@ -9,7 +9,6 @@ */ // Load Elgg engine -define('externalpage',true); require_once("../start.php"); global $CONFIG; diff --git a/engine/lib/cron.php b/engine/lib/cron.php index b4952e2ee..75897fb21 100644 --- a/engine/lib/cron.php +++ b/engine/lib/cron.php @@ -18,6 +18,9 @@ class CronException extends Exception {} function cron_init() { // Register a pagehandler for cron register_page_handler('cron','cron_page_handler'); + + // register a hook for Walled Garden public pages + register_plugin_hook('public_pages', 'walled_garden', 'cron_public_pages'); } /** @@ -53,5 +56,22 @@ function cron_page_handler($page) { } } +function cron_public_pages($hook, $type, $return_value, $params) { + global $CONFIG; + + $return_value[] = "{$CONFIG->url}pg/cron/minute"; + $return_value[] = "{$CONFIG->url}pg/cron/fiveminute"; + $return_value[] = "{$CONFIG->url}pg/cron/fifteenmin"; + $return_value[] = "{$CONFIG->url}pg/cron/halfhour"; + $return_value[] = "{$CONFIG->url}pg/cron/hourly"; + $return_value[] = "{$CONFIG->url}pg/cron/daily"; + $return_value[] = "{$CONFIG->url}pg/cron/weekly"; + $return_value[] = "{$CONFIG->url}pg/cron/monthly"; + $return_value[] = "{$CONFIG->url}pg/cron/yearly"; + $return_value[] = "{$CONFIG->url}pg/cron/reboot"; + + return $return_value; +} + // Register a startup event register_elgg_event_handler('init','system','cron_init'); \ No newline at end of file diff --git a/engine/lib/sites.php b/engine/lib/sites.php index fb9b66725..fb47dc012 100644 --- a/engine/lib/sites.php +++ b/engine/lib/sites.php @@ -279,6 +279,8 @@ class ElggSite extends ElggEntity { "{$CONFIG->url}action/user/requestnewpassword", "{$CONFIG->url}pg/resetpassword", "{$CONFIG->url}upgrade.php", + "{$CONFIG->url}xml-rpc.php", + "{$CONFIG->url}mt/mt-xmlrpc.cgi", ); // include a hook for plugin authors to include public pages diff --git a/index.php b/index.php index 72ae9b616..8787d22c0 100644 --- a/index.php +++ b/index.php @@ -11,7 +11,6 @@ /** * Start the Elgg engine */ -define('externalpage', TRUE); require_once(dirname(__FILE__) . "/engine/start.php"); if (!trigger_plugin_hook('index', 'system', null, FALSE)) { diff --git a/mod/externalpages/read.php b/mod/externalpages/read.php index 466c3a0be..d8d0eb007 100644 --- a/mod/externalpages/read.php +++ b/mod/externalpages/read.php @@ -10,7 +10,6 @@ */ // Load Elgg engine -define('externalpage',true); require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); // set some variables diff --git a/upgrade.php b/upgrade.php index af06552cd..d659d415c 100644 --- a/upgrade.php +++ b/upgrade.php @@ -13,7 +13,6 @@ // Include elgg engine define('upgrading','upgrading'); -define('externalpage',true); require_once(dirname(__FILE__) . "/engine/start.php"); if (get_input('upgrade') == 'upgrade') { -- cgit v1.2.3