aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mod/externalpages/start.php36
1 files changed, 27 insertions, 9 deletions
diff --git a/mod/externalpages/start.php b/mod/externalpages/start.php
index 696b617da..051da183a 100644
--- a/mod/externalpages/start.php
+++ b/mod/externalpages/start.php
@@ -8,6 +8,9 @@ register_elgg_event_handler('init', 'system', 'expages_init');
function expages_init() {
// Register a page handler, so we can have nice URLs
+ elgg_register_page_handler('about', 'expages_page_handler');
+ elgg_register_page_handler('terms', 'expages_page_handler');
+ elgg_register_page_handler('privacy', 'expages_page_handler');
elgg_register_page_handler('expages', 'expages_page_handler');
// add a menu item for the admin edit page
@@ -25,21 +28,25 @@ function expages_init() {
* Setup the links to site pages
*/
function expages_setup_footer_menu() {
- $pages = array('about', 'terms', 'privacy');
- foreach ($pages as $page) {
- $url = "expages/read/$page";
- $item = new ElggMenuItem($page, elgg_echo("expages:$page"), $url);
- elgg_register_menu_item('footer', $item);
- }
+ $pages = array('about', 'terms', 'privacy');
+ foreach ($pages as $page) {
+ $url = "$page";
+ $item = new ElggMenuItem($page, elgg_echo("expages:$page"), $url);
+ elgg_register_menu_item('footer', $item);
+ }
}
/**
* External pages page handler
*
- * @param array $page
+ * @param array $page URL segements
+ * @param string $handler Handler identifier
*/
-function expages_page_handler($page) {
- $type = strtolower($page[1]);
+function expages_page_handler($page, $handler) {
+ if ($handler == 'expages') {
+ expages_url_forwarder($page[1]);
+ }
+ $type = strtolower($handler);
$title = elgg_echo("expages:$type");
$content = elgg_view_title($title);
@@ -58,3 +65,14 @@ function expages_page_handler($page) {
$body = elgg_view_layout("one_sidebar", array('content' => $content));
echo elgg_view_page($title, $body);
}
+
+/**
+ * Forward to the new style of URLs
+ *
+ * @param string $page
+ */
+function expages_url_forwarder($page) {
+ global $CONFIG;
+ $url = "{$CONFIG->wwwroot}{$page}";
+ forward($url);
+}