aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--_css/css.php (renamed from css/css.php)0
-rw-r--r--_graphics/blockquote.png (renamed from graphics/blockquote.png)bin377 -> 377 bytes
-rw-r--r--_graphics/footer.gif (renamed from graphics/footer.gif)bin567 -> 567 bytes
-rw-r--r--_graphics/header.gif (renamed from graphics/header.gif)bin2555 -> 2555 bytes
-rw-r--r--_graphics/sidebar-bottom.gif (renamed from graphics/sidebar-bottom.gif)bin189 -> 189 bytes
-rw-r--r--_graphics/sidebar-top.gif (renamed from graphics/sidebar-top.gif)bin189 -> 189 bytes
-rw-r--r--engine/lib/pagehandler.php106
-rw-r--r--htaccess_dist8
-rw-r--r--pagehandler.php26
-rw-r--r--views/default/css.php10
-rw-r--r--views/default/page_elements/header.php2
11 files changed, 143 insertions, 9 deletions
diff --git a/css/css.php b/_css/css.php
index 33a5305ed..33a5305ed 100644
--- a/css/css.php
+++ b/_css/css.php
diff --git a/graphics/blockquote.png b/_graphics/blockquote.png
index 3fd144f59..3fd144f59 100644
--- a/graphics/blockquote.png
+++ b/_graphics/blockquote.png
Binary files differ
diff --git a/graphics/footer.gif b/_graphics/footer.gif
index 450458751..450458751 100644
--- a/graphics/footer.gif
+++ b/_graphics/footer.gif
Binary files differ
diff --git a/graphics/header.gif b/_graphics/header.gif
index 410baff22..410baff22 100644
--- a/graphics/header.gif
+++ b/_graphics/header.gif
Binary files differ
diff --git a/graphics/sidebar-bottom.gif b/_graphics/sidebar-bottom.gif
index b89f99b29..b89f99b29 100644
--- a/graphics/sidebar-bottom.gif
+++ b/_graphics/sidebar-bottom.gif
Binary files differ
diff --git a/graphics/sidebar-top.gif b/_graphics/sidebar-top.gif
index 84f7e628a..84f7e628a 100644
--- a/graphics/sidebar-top.gif
+++ b/_graphics/sidebar-top.gif
Binary files differ
diff --git a/engine/lib/pagehandler.php b/engine/lib/pagehandler.php
new file mode 100644
index 000000000..b5bb831db
--- /dev/null
+++ b/engine/lib/pagehandler.php
@@ -0,0 +1,106 @@
+<?php
+
+ /**
+ * Elgg page handler functions
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.org/
+ */
+
+ /**
+ * Turns the current page over to the page handler, allowing registered handlers to take over
+ *
+ * @param string $handler The name of the handler type (eg 'blog')
+ * @param array $page The parameters to the page, as an array (exploded by '/' slashes)
+ * @return true|false Depending on whether a registered page handler was found
+ */
+ function page_handler($handler, $page) {
+
+ global $CONFIG;
+
+ $page = explode('/',$page);
+ if (!isset($CONFIG->pagehandler) || empty($handler)) {
+ $result = false;
+ } else if (isset($CONFIG->pagehandler[$handler]) && is_callable($CONFIG->pagehandler[$handler])) {
+ $function = $CONFIG->pagehandler[$handler];
+ $result = $function($page, $handler);
+ if ($result !== false) {
+ $result = true;
+ }
+ } else {
+ $result = false;
+ }
+
+ if (!$result) {
+ $result = default_page_handler($page, $handler);
+ }
+ if ($result !== false) $result = true;
+
+ return $result;
+
+ }
+
+ /**
+ * Registers a page handler for a particular identifier
+ *
+ * eg, you can register a function called 'blog_page_handler' for handler type 'blog'
+ *
+ * Now for all URLs of type http://yoururl/blog/*, the blog_page_handler function will be called.
+ * The part of the URL marked with * above will be exploded on '/' characters and passed as an
+ * array to that function, eg:
+ *
+ * For the URL http://yoururl/blog/username/friends/:
+ * blog_page_handler('blog', array('username','friends'));
+ *
+ * @param string $handler The page type to handle
+ * @param string $function Your function name
+ * @return true|false Depending on success
+ */
+ function register_page_handler($handler, $function) {
+
+ global $CONFIG;
+ if (!isset($CONFIG->pagehandler))
+ $CONFIG->pagehandler = array();
+ if (is_callable($function)) {
+ $CONFIG->pagehandler[$handler] = $function;
+ return true;
+ }
+ return false;
+
+ }
+
+ /**
+ * A default page handler that attempts to load the actual file at a given page handler location
+ *
+ * @param array $page The page URL elements
+ * @param string $handler The base handler
+ * @return true|false Depending on success
+ */
+ function default_page_handler($page, $handler) {
+
+ global $CONFIG;
+ $page = implode('/',$page);
+ if (($questionmark = strripos($page, '?')))
+ $page = substr($page, 0, $questionmark);
+
+ $script = str_replace("..","",$script);
+ $callpath = $CONFIG->path . $handler . "/" . $page;
+ if (!include($callpath)) {
+ if (substr_count($callpath,'.php') == 0) {
+ if (substr($callpath,strlen($callpath) - 1, 1) != "/")
+ $callpath .= "/";
+ $callpath .= "index.php";
+ if (!include($callpath))
+ return false;
+ }
+ }
+
+ return true;
+
+ }
+
+?> \ No newline at end of file
diff --git a/htaccess_dist b/htaccess_dist
index d3f5480d8..8db85934d 100644
--- a/htaccess_dist
+++ b/htaccess_dist
@@ -9,7 +9,9 @@ RewriteEngine on
RewriteRule ^action\/([A-Za-z\_\-\/]+)$ action.php?action=$1
RewriteRule ^actions\/([A-Za-z\_\-\/]+)$ action.php?action=$1
-RewriteRule ^css\/css\.css$ css/css.php
-
RewriteRule ^odd\/([A-Za-z\_\-\/]+)$ odd/handler.php?guid=$1
-RewriteRule ^odd\/([A-Za-z\_\-\/]+)\/([A-Za-z\_\-\/]+)\/([A-Za-z\_\-\/]+)$ odd/handler.php?guid=$1&type=$2&idname=$3 \ No newline at end of file
+RewriteRule ^odd\/([A-Za-z\_\-\/]+)\/([A-Za-z\_\-\/]+)\/([A-Za-z\_\-\/]+)$ odd/handler.php?guid=$1&type=$2&idname=$3>>>>>>> .r470
+
+RewriteRule ^\_css\/css\.css$ css/css.php
+
+RewriteRule ^([A-Za-z]+)\/(.*)\/$ pagehandler.php?handler=$1&page=$2
diff --git a/pagehandler.php b/pagehandler.php
new file mode 100644
index 000000000..eceff9ce1
--- /dev/null
+++ b/pagehandler.php
@@ -0,0 +1,26 @@
+<?php
+
+ /**
+ * Elgg page handler
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.org/
+ */
+
+ // Load Elgg engine
+ require_once(dirname(__FILE__) . "/engine/start.php");
+
+ // Get input
+ $handler = get_input('handler');
+ $page = get_input('page');
+
+ // Call the page handler functions
+ if (!page_handler($handler, $page)) {
+ forward();
+ }
+
+?> \ No newline at end of file
diff --git a/views/default/css.php b/views/default/css.php
index 5d4415009..e8386223c 100644
--- a/views/default/css.php
+++ b/views/default/css.php
@@ -25,7 +25,7 @@
*/
body {
- background:#fff url(<?php echo $vars['url']; ?>/graphics/header.gif) repeat-x; /* #d9e2f2 */
+ background:#fff url(<?php echo $vars['url']; ?>/_graphics/header.gif) repeat-x; /* #d9e2f2 */
color:#697C83;
font-family:'Trebuchet MS','Lucida Grande', Arial, sans-serif;
text-align:left;
@@ -58,7 +58,7 @@ h2, h3, h4, h5 {
}
blockquote{
- background: #EEE url(<?php echo $vars['url']; ?>/graphics/blockquote.png) no-repeat bottom left;
+ background: #EEE url(<?php echo $vars['url']; ?>/_graphics/blockquote.png) no-repeat bottom left;
padding: 10px;
padding-bottom: 40px;
margin: 1em;
@@ -167,11 +167,11 @@ div#sidebar_menu {
margin:20px 10px 20px 0;
padding:0;
float: right;
- background:#efefef url(<?php echo $vars['url']; ?>/graphics/sidebar-top.gif) no-repeat top;
+ background:#efefef url(<?php echo $vars['url']; ?>/_graphics/sidebar-top.gif) no-repeat top;
}
div#sidebar-menu-bottom {
- background:url(<?php echo $vars['url']; ?>/graphics/sidebar-bottom.gif) no-repeat bottom;
+ background:url(<?php echo $vars['url']; ?>/_graphics/sidebar-bottom.gif) no-repeat bottom;
height:9px;
width:250px;
margin:0;
@@ -234,7 +234,7 @@ div#footer {
font-weight:bold;
width:100%;
padding:3px 0 0 0;
- background:url(<?php echo $vars['url']; ?>/graphics/footer.gif) repeat-x;
+ background:url(<?php echo $vars['url']; ?>/_graphics/footer.gif) repeat-x;
}
div#footer img {
diff --git a/views/default/page_elements/header.php b/views/default/page_elements/header.php
index d644ccb56..99d2dc3a0 100644
--- a/views/default/page_elements/header.php
+++ b/views/default/page_elements/header.php
@@ -34,7 +34,7 @@
<title><?php echo $title; ?></title>
<!-- include links to jQuery here? -->
<!-- include the default css file -->
- <link rel="stylesheet" href="<?php echo $vars['url']; ?>css/css.php" type="text/css" />
+ <link rel="stylesheet" href="<?php echo $vars['url']; ?>_css/css.css" type="text/css" />
</head>
<body>
<div id="container">