diff options
73 files changed, 551 insertions, 470 deletions
diff --git a/_graphics/walled_garden/one_column_bottom.png b/_graphics/walled_garden/one_column_bottom.png Binary files differnew file mode 100644 index 000000000..1dfd7f8ad --- /dev/null +++ b/_graphics/walled_garden/one_column_bottom.png diff --git a/_graphics/walled_garden/one_column_middle.png b/_graphics/walled_garden/one_column_middle.png Binary files differnew file mode 100644 index 000000000..f53abc123 --- /dev/null +++ b/_graphics/walled_garden/one_column_middle.png diff --git a/_graphics/walled_garden/one_column_top.png b/_graphics/walled_garden/one_column_top.png Binary files differnew file mode 100644 index 000000000..429a88b75 --- /dev/null +++ b/_graphics/walled_garden/one_column_top.png diff --git a/_graphics/walled_garden/two_column_bottom.png b/_graphics/walled_garden/two_column_bottom.png Binary files differnew file mode 100644 index 000000000..8aeceeeee --- /dev/null +++ b/_graphics/walled_garden/two_column_bottom.png diff --git a/_graphics/walled_garden/two_column_middle.png b/_graphics/walled_garden/two_column_middle.png Binary files differnew file mode 100644 index 000000000..9a93f19a9 --- /dev/null +++ b/_graphics/walled_garden/two_column_middle.png diff --git a/_graphics/walled_garden/two_column_top.png b/_graphics/walled_garden/two_column_top.png Binary files differnew file mode 100644 index 000000000..c28b3f630 --- /dev/null +++ b/_graphics/walled_garden/two_column_top.png diff --git a/_graphics/walled_garden_background_bottom.gif b/_graphics/walled_garden_background_bottom.gif Binary files differdeleted file mode 100644 index 7e25fbedc..000000000 --- a/_graphics/walled_garden_background_bottom.gif +++ /dev/null diff --git a/_graphics/walled_garden_background_extend.gif b/_graphics/walled_garden_background_extend.gif Binary files differdeleted file mode 100644 index 09f7318e3..000000000 --- a/_graphics/walled_garden_background_extend.gif +++ /dev/null diff --git a/_graphics/walled_garden_background_top.gif b/_graphics/walled_garden_background_top.gif Binary files differdeleted file mode 100644 index 20d551e2f..000000000 --- a/_graphics/walled_garden_background_top.gif +++ /dev/null diff --git a/_graphics/walled_garden_backgroundfull_bottom.gif b/_graphics/walled_garden_backgroundfull_bottom.gif Binary files differdeleted file mode 100644 index c05447cc8..000000000 --- a/_graphics/walled_garden_backgroundfull_bottom.gif +++ /dev/null diff --git a/_graphics/walled_garden_backgroundfull_top.gif b/_graphics/walled_garden_backgroundfull_top.gif Binary files differdeleted file mode 100644 index 99b4832ec..000000000 --- a/_graphics/walled_garden_backgroundfull_top.gif +++ /dev/null diff --git a/engine/lib/admin.php b/engine/lib/admin.php index ae6429baf..3baf2ff61 100644 --- a/engine/lib/admin.php +++ b/engine/lib/admin.php @@ -314,7 +314,7 @@ function admin_init() { // automatic adding of widgets for admin elgg_register_event_handler('make_admin', 'user', 'elgg_add_admin_widgets'); - elgg_register_page_handler('admin', 'admin_settings_page_handler'); + elgg_register_page_handler('admin', 'admin_page_handler'); elgg_register_page_handler('admin_plugin_screenshot', 'admin_plugin_screenshot_page_handler'); elgg_register_page_handler('admin_plugin_text_file', 'admin_markdown_page_handler'); } @@ -427,10 +427,10 @@ function admin_pagesetup() { * * @param array $page Array of pages * - * @return void + * @return bool * @access private */ -function admin_settings_page_handler($page) { +function admin_page_handler($page) { admin_gatekeeper(); elgg_admin_add_plugin_settings_menu(); @@ -478,6 +478,7 @@ function admin_settings_page_handler($page) { $body = elgg_view_layout('admin', array('content' => $content, 'title' => $title)); echo elgg_view_page($title, $body, 'admin'); + return true; } /** @@ -485,7 +486,7 @@ function admin_settings_page_handler($page) { * admin_plugin_screenshot/<plugin_id>/<size>/<ss_name>.<ext> * * @param array $pages The pages array - * @return true + * @return bool * @access private */ function admin_plugin_screenshot_page_handler($pages) { @@ -524,7 +525,6 @@ function admin_plugin_screenshot_page_handler($pages) { echo file_get_contents($file); break; } - return true; } @@ -541,6 +541,7 @@ function admin_plugin_screenshot_page_handler($pages) { * * LICENSE.txt * * @param type $page + * @return bool * @access private */ function admin_markdown_page_handler($pages) { @@ -596,6 +597,7 @@ function admin_markdown_page_handler($pages) { )); echo elgg_view_page($title, $body, 'admin'); + return true; } /** diff --git a/engine/lib/cron.php b/engine/lib/cron.php index 8c0b62a53..8af640396 100644 --- a/engine/lib/cron.php +++ b/engine/lib/cron.php @@ -25,7 +25,7 @@ function cron_init() { * * @param array $page Pages * - * @return void + * @return bool * @access private */ function cron_page_handler($page) { @@ -63,6 +63,7 @@ function cron_page_handler($page) { $std_out = ob_get_clean(); echo $std_out . $old_stdout; + return true; } /** diff --git a/engine/lib/deprecated-1.8.php b/engine/lib/deprecated-1.8.php index beba7d2b7..e1866498b 100644 --- a/engine/lib/deprecated-1.8.php +++ b/engine/lib/deprecated-1.8.php @@ -4735,3 +4735,40 @@ function remove_from_river_by_id($id) { return elgg_delete_river(array('id' => $id)); } + +/** + * A default page handler + * Tries to locate a suitable file to include. Only works for core pages, not plugins. + * + * @param array $page The page URL elements + * @param string $handler The base handler + * + * @return true|false Depending on success + * @deprecated 1.8 + */ +function default_page_handler($page, $handler) { + global $CONFIG; + + elgg_deprecated_notice("default_page_handler is deprecated", "1.8"); + + $page = implode('/', $page); + + // protect against including arbitary files + $page = str_replace("..", "", $page); + + $callpath = $CONFIG->path . $handler . "/" . $page; + if (is_dir($callpath)) { + $callpath = sanitise_filepath($callpath); + $callpath .= "index.php"; + if (file_exists($callpath)) { + if (include($callpath)) { + return TRUE; + } + } + } else if (file_exists($callpath)) { + include($callpath); + return TRUE; + } + + return FALSE; +} diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index 66268cc96..10804fdca 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -1740,7 +1740,7 @@ function _elgg_shutdown_hook() { * * @param array $page The page array * - * @return void + * @return bool * @elgg_pagehandler js * @access private */ @@ -1755,7 +1755,7 @@ function elgg_js_page_handler($page) { * * @param array $page The page array * - * @return void + * @return bool * @elgg_pagehandler ajax * @access private */ @@ -1776,9 +1776,9 @@ function elgg_ajax_page_handler($page) { } echo elgg_view($view, $vars); + return true; } - - return true; + return false; } /** @@ -1809,7 +1809,7 @@ function elgg_css_page_handler($page) { * @param array $page The page array * @param string $type The type: js or css * - * @return mixed + * @return bool * @access private */ function elgg_cacheable_view_page_handler($page, $type) { @@ -1850,9 +1850,8 @@ function elgg_cacheable_view_page_handler($page, $type) { //header("Content-Length: " . strlen($return)); echo $return; + return true; } - - return true; } /** @@ -1886,6 +1885,8 @@ function elgg_sql_reverse_order_by_clause($order_by) { * * Used as a callback for ElggBatch. * + * @todo why aren't these static methods on ElggBatch? + * * @param object $object The object to enable * @return bool * @access private @@ -1990,10 +1991,12 @@ function elgg_is_valid_options_for_batch_operation($options, $type) { function elgg_walled_garden_index() { elgg_register_css('elgg.walled_garden', '/css/walled_garden.css'); elgg_load_css('elgg.walled_garden'); + elgg_register_js('elgg.walled_garden', '/js/walled_garden.js'); + elgg_load_js('elgg.walled_garden'); - $login = elgg_view('core/account/login_walled_garden'); + $body = elgg_view('core/walled_garden/body'); - echo elgg_view_page('', $login, 'walled_garden'); + echo elgg_view_page('', $body, 'walled_garden'); // return true to prevent other plugins from adding a front page return true; diff --git a/engine/lib/entities.php b/engine/lib/entities.php index a76ce11fe..ff90e3185 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -306,6 +306,8 @@ function add_subtype($type, $subtype, $class = "") { if ($id == 0) { return insert_data("insert into {$CONFIG->dbprefix}entity_subtypes" . " (type, subtype, class) values ('$type','$subtype','$class')"); + } else { + update_subtype($type, $subtype, $class); } return $id; @@ -2078,7 +2080,7 @@ function is_registered_entity_type($type, $subtype = null) { * * @param array $page Page elements from pain page handler * - * @return void + * @return bool * @elgg_page_handler view * @access private */ @@ -2087,7 +2089,9 @@ function entities_page_handler($page) { global $CONFIG; set_input('guid', $page[0]); include($CONFIG->path . "pages/entities/index.php"); + return true; } + return false; } /** diff --git a/engine/lib/pagehandler.php b/engine/lib/pagehandler.php index 0d5e5f89b..f331e2aae 100644 --- a/engine/lib/pagehandler.php +++ b/engine/lib/pagehandler.php @@ -9,12 +9,10 @@ /** * Turns the current page over to the page handler, allowing registered handlers to take over. * - * If a page handler returns FALSE, the request is handed over to the default_page_handler. - * * @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 + * @return bool * @access private */ function page_handler($handler, $page) { @@ -42,26 +40,13 @@ function page_handler($handler, $page) { $handler = $params['handler']; $page = $params['segments']; - if (!isset($CONFIG->pagehandler) || empty($handler)) { - $result = false; - } else if (isset($CONFIG->pagehandler[$handler]) && is_callable($CONFIG->pagehandler[$handler])) { + $result = false; + if (isset($CONFIG->pagehandler) && !empty($handler) && isset($CONFIG->pagehandler[$handler])) { $function = $CONFIG->pagehandler[$handler]; $result = call_user_func($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; + return $result || headers_sent(); } /** @@ -74,14 +59,16 @@ function page_handler($handler, $page) { * For example, the URL http://yoururl/blog/username/friends/ would result in the call: * blog_page_handler(array('username','friends'), blog); * - * Page handler functions should return true or the default page handler will be called. - * * A request to register a page handler with the same identifier as previously registered * handler will replace the previous one. * * The context is set to the page handler identifier before the registered * page handler function is called. For the above example, the context is set to 'blog'. * + * Page handlers should return true to indicate that they handled the request. + * Requests not handled are forwarded to the front page with a reason of 404. + * Plugins can register for the 'forward', '404' plugin hook. @see forward() + * * @param string $handler The page type to handle * @param string $function Your function name * @@ -119,38 +106,3 @@ function elgg_unregister_page_handler($handler) { unset($CONFIG->pagehandler[$handler]); } - -/** - * A default page handler - * Tries to locate a suitable file to include. Only works for core pages, not plugins. - * - * @param array $page The page URL elements - * @param string $handler The base handler - * - * @return true|false Depending on success - * @access private - */ -function default_page_handler($page, $handler) { - global $CONFIG; - - $page = implode('/', $page); - - // protect against including arbitary files - $page = str_replace("..", "", $page); - - $callpath = $CONFIG->path . $handler . "/" . $page; - if (is_dir($callpath)) { - $callpath = sanitise_filepath($callpath); - $callpath .= "index.php"; - if (file_exists($callpath)) { - if (include($callpath)) { - return TRUE; - } - } - } else if (file_exists($callpath)) { - include($callpath); - return TRUE; - } - - return FALSE; -} diff --git a/engine/lib/river.php b/engine/lib/river.php index f430eb224..466eca253 100644 --- a/engine/lib/river.php +++ b/engine/lib/river.php @@ -586,6 +586,7 @@ function update_river_access_by_object($object_guid, $access_id) { * Page handler for activiy * * @param array $page + * @return bool * @access private */ function elgg_river_page_handler($page) { @@ -606,6 +607,7 @@ function elgg_river_page_handler($page) { $entity_subtype = ''; require_once("{$CONFIG->path}pages/river.php"); + return true; } /** diff --git a/engine/lib/tags.php b/engine/lib/tags.php index 6275d653c..a0887d0f3 100644 --- a/engine/lib/tags.php +++ b/engine/lib/tags.php @@ -321,25 +321,23 @@ function elgg_get_registered_tag_metadata_names() { * * @param array $page Page array * - * @return void + * @return bool * @access private */ function elgg_tagcloud_page_handler($page) { - switch ($page[0]) { - default: - $title = elgg_view_title(elgg_echo('tags:site_cloud')); - $options = array( - 'threshold' => 0, - 'limit' => 100, - 'tag_name' => 'tags', - ); - $tags = elgg_view_tagcloud($options); - $content = $title . $tags; - $body = elgg_view_layout('one_sidebar', array('content' => $content)); - - echo elgg_view_page(elgg_echo('tags:site_cloud'), $body); - break; - } + + $title = elgg_view_title(elgg_echo('tags:site_cloud')); + $options = array( + 'threshold' => 0, + 'limit' => 100, + 'tag_name' => 'tags', + ); + $tags = elgg_view_tagcloud($options); + $content = $title . $tags; + $body = elgg_view_layout('one_sidebar', array('content' => $content)); + + echo elgg_view_page(elgg_echo('tags:site_cloud'), $body); + return true; } /** diff --git a/engine/lib/user_settings.php b/engine/lib/user_settings.php index bb5d8d6c4..1e2d6db10 100644 --- a/engine/lib/user_settings.php +++ b/engine/lib/user_settings.php @@ -294,7 +294,7 @@ function usersettings_pagesetup() { * * @param array $page Pages array * - * @return void + * @return bool * @access private */ function usersettings_page_handler($page) { @@ -304,7 +304,7 @@ function usersettings_page_handler($page) { $page[0] = 'user'; } - if ($page[1]) { + if (isset($page[1])) { $user = get_user_by_username($page[1]); elgg_set_page_owner_guid($user->guid); } else { @@ -324,12 +324,14 @@ function usersettings_page_handler($page) { $path = $CONFIG->path . "pages/settings/tools.php"; break; case 'user': - default: $path = $CONFIG->path . "pages/settings/account.php"; break; } - require($path); + if (isset($path)) { + require $path; + return true; + } } /** diff --git a/engine/lib/users.php b/engine/lib/users.php index 843b897e9..3aff2ca9d 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -1048,7 +1048,7 @@ function collections_submenu_items() { * * @param array $page_elements Page elements * - * @return void + * @return bool * @access private */ function friends_page_handler($page_elements) { @@ -1059,6 +1059,7 @@ function friends_page_handler($page_elements) { collections_submenu_items(); } require_once(dirname(dirname(dirname(__FILE__))) . "/pages/friends/index.php"); + return true; } /** @@ -1066,18 +1067,19 @@ function friends_page_handler($page_elements) { * * @param array $page_elements Page elements * - * @return void + * @return bool * @access private */ function friends_of_page_handler($page_elements) { elgg_set_context('friends'); if (isset($page_elements[0]) && $user = get_user_by_username($page_elements[0])) { - set_page_owner($user->getGUID()); + elgg_set_page_owner_guid($user->getGUID()); } if (elgg_get_logged_in_user_guid() == elgg_get_page_owner_guid()) { collections_submenu_items(); } require_once(dirname(dirname(dirname(__FILE__))) . "/pages/friends/of.php"); + return true; } /** @@ -1085,7 +1087,7 @@ function friends_of_page_handler($page_elements) { * * @param array $page_elements Page elements * - * @return void + * @return bool * @access private */ function collections_page_handler($page_elements) { @@ -1096,6 +1098,7 @@ function collections_page_handler($page_elements) { set_page_owner(elgg_get_logged_in_user_guid()); collections_submenu_items(); require_once "{$base}pages/friends/collections/add.php"; + return true; } else { $user = get_user_by_username($page_elements[0]); if ($user) { @@ -1104,9 +1107,11 @@ function collections_page_handler($page_elements) { collections_submenu_items(); } require_once "{$base}pages/friends/collections/view.php"; + return true; } } } + return false; } /** @@ -1115,7 +1120,7 @@ function collections_page_handler($page_elements) { * @param array $page_elements Page elements * @param string $handler The handler string * - * @return void + * @return bool * @access private */ function elgg_user_account_page_handler($page_elements, $handler) { @@ -1131,7 +1136,10 @@ function elgg_user_account_page_handler($page_elements, $handler) { case 'register': require_once("$base_dir/register.php"); break; + default: + return false; } + return true; } /** @@ -1140,17 +1148,18 @@ function elgg_user_account_page_handler($page_elements, $handler) { * This is a fallback for non-JS users who click on the * dropdown login link. * - * @return void + * @return bool * @access private */ function elgg_user_login_page_handler() { if (elgg_is_logged_in()) { - forward(); + forward(''); } $login_box = elgg_view('core/account/login_box'); $content = elgg_view_layout('one_column', array('content' => $login_box)); echo elgg_view_page(elgg_echo('login'), $content); + return true; } /** @@ -1404,6 +1413,7 @@ function elgg_profile_fields_setup() { * /avatar/view/<username>/<size>/<icontime> * * @param array $page + * @return bool * @access private */ function elgg_avatar_page_handler($page) { @@ -1416,16 +1426,20 @@ function elgg_avatar_page_handler($page) { if ($page[0] == 'edit') { require_once("{$CONFIG->path}pages/avatar/edit.php"); + return true; } else { set_input('size', $page[2]); require_once("{$CONFIG->path}pages/avatar/view.php"); + return true; } + return false; } /** * Profile page handler * * @param array $page + * @return bool * @access private */ function elgg_profile_page_handler($page) { @@ -1436,7 +1450,9 @@ function elgg_profile_page_handler($page) { if ($page[1] == 'edit') { require_once("{$CONFIG->path}pages/profile/edit.php"); + return true; } + return false; } /** diff --git a/js/classes/ElggPriorityList.js b/js/classes/ElggPriorityList.js index 831342f21..b4cec5044 100644 --- a/js/classes/ElggPriorityList.js +++ b/js/classes/ElggPriorityList.js @@ -16,7 +16,10 @@ elgg.ElggPriorityList = function() { * @return {Void} */ elgg.ElggPriorityList.prototype.insert = function(obj, opt_priority) { - var priority = parseInt(opt_priority || 500, 10); + var priority = 500; + if (arguments.length == 2 && opt_priority != undefined) { + priority = parseInt(opt_priority, 10); + } priority = Math.max(priority, 0); @@ -31,7 +34,7 @@ elgg.ElggPriorityList.prototype.insert = function(obj, opt_priority) { /** * Iterates through each element in order. * -* Unlike every, this ignores the return value of the callback. + * Unlike every, this ignores the return value of the callback. * * @param {Function} callback The callback function to pass each element through. See * Array.prototype.every() for details. diff --git a/js/lib/elgglib.js b/js/lib/elgglib.js index d963a62be..85251c1e8 100644 --- a/js/lib/elgglib.js +++ b/js/lib/elgglib.js @@ -535,7 +535,7 @@ elgg.push_to_object_array = function(object, parent, value) { object[parent] = [] } - if (object[parent].indexOf(value) < 0) { + if ($.inArray(value, object[parent]) < 0) { return object[parent].push(value); } @@ -553,7 +553,7 @@ elgg.is_in_object_array = function(object, parent, value) { elgg.assertTypeOf('object', object); elgg.assertTypeOf('string', parent); - return typeof(object[parent]) != 'undefined' && object[parent].indexOf(value) >= 0; + return typeof(object[parent]) != 'undefined' && $.inArray(value, object[parent]) >= 0; }; /** diff --git a/js/lib/hooks.js b/js/lib/hooks.js index 7bac471f6..5e1808e22 100644 --- a/js/lib/hooks.js +++ b/js/lib/hooks.js @@ -115,7 +115,7 @@ elgg.trigger_hook = function(name, type, params, value) { return true; }); - return (tempReturnValue !== null) ? tempReturnValue : returnValue; + return (tempReturnValue != null) ? tempReturnValue : returnValue; }; /** diff --git a/js/tests/ElggLanguagesTest.js b/js/tests/ElggLanguagesTest.js index 1f66fc35b..9186ff5bb 100644 --- a/js/tests/ElggLanguagesTest.js +++ b/js/tests/ElggLanguagesTest.js @@ -6,7 +6,7 @@ ElggLanguagesTest.prototype.setUp = function() { //Immediately execute some dummy "returned" javascript instead of sending //an actual ajax request $.ajax = function(settings) { - var lang = settings.data.js.split('/')[1]; + var lang = settings.data.language; elgg.config.translations[lang] = {'language':lang}; }; }; diff --git a/js/tests/ElggPriorityListTest.js b/js/tests/ElggPriorityListTest.js index 2549e0ee0..2329a8490 100644 --- a/js/tests/ElggPriorityListTest.js +++ b/js/tests/ElggPriorityListTest.js @@ -15,7 +15,7 @@ ElggPriorityListTest.prototype.testInsert = function() { this.list.insert('bar', 501); - assertEquals('foo', this.list.priorities_[501][0]); + assertEquals('bar', this.list.priorities_[501][0]); }; ElggPriorityListTest.prototype.testInsertRespectsPriority = function() { @@ -25,9 +25,9 @@ ElggPriorityListTest.prototype.testInsertRespectsPriority = function() { this.list.insert(values[i], values[i]); } - this.list.forEach(function(elem, idx)) { + this.list.forEach(function(elem, idx) { assertEquals(elem, idx); - } + }) }; ElggPriorityListTest.prototype.testInsertHandlesDuplicatePriorities = function() { diff --git a/js/tests/ElggSecurityTest.js b/js/tests/ElggSecurityTest.js index f1111168f..c7309d55f 100644 --- a/js/tests/ElggSecurityTest.js +++ b/js/tests/ElggSecurityTest.js @@ -31,10 +31,10 @@ ElggSecurityTest.prototype.testAddTokenAcceptsString = function() { str = "__elgg_ts=" + this.ts + "&__elgg_token=" + this.token; input = ""; - assertEquals(str, elgg.security.addToken(input)); + assertEquals('?' + str, elgg.security.addToken(input)); - input = "data=sofar"; - assertEquals(input+'&'+str, elgg.security.addToken(input)); + input = "?data=sofar"; + assertEquals(input + '&' + str, elgg.security.addToken(input)); }; diff --git a/js/tests/jsTestDriver.conf b/js/tests/jsTestDriver.conf index 1bb06e811..1f9c0a6f7 100644 --- a/js/tests/jsTestDriver.conf +++ b/js/tests/jsTestDriver.conf @@ -1,9 +1,10 @@ server: http://localhost:42442 load: - - vendors/jquery/jquery-1.4.2.min.js + - vendors/jquery/jquery-1.6.2.min.js - vendors/sprintf.js - js/lib/elgglib.js + - js/lib/hooks.js - js/classes/*.js - js/lib/*.js - js/tests/*.js
\ No newline at end of file diff --git a/mod/blog/start.php b/mod/blog/start.php index 9e77b0a93..052c63651 100644 --- a/mod/blog/start.php +++ b/mod/blog/start.php @@ -93,14 +93,14 @@ function blog_init() { * @todo no archives for all blogs or friends * * @param array $page - * @return NULL + * @return bool */ function blog_page_handler($page) { elgg_load_library('elgg:blog'); // @todo remove the forwarder in 1.9 - // forward to correct URL for bookmarks pre-1.7.5 + // forward to correct URL for blog pages pre-1.7.5 blog_url_forwarder($page); // push all blogs breadcrumb @@ -139,10 +139,10 @@ function blog_page_handler($page) { $params = blog_get_page_content_list($page[1]); break; case 'all': - default: - $title = elgg_echo('blog:title:all_blogs'); $params = blog_get_page_content_list(); break; + default: + return false; } $params['sidebar'] .= elgg_view('blog/sidebar', array('page' => $page_type)); @@ -150,6 +150,7 @@ function blog_page_handler($page) { $body = elgg_view_layout('content', $params); echo elgg_view_page($params['title'], $body); + return true; } /** diff --git a/mod/bookmarks/start.php b/mod/bookmarks/start.php index 2a7b44e97..21a2d8940 100644 --- a/mod/bookmarks/start.php +++ b/mod/bookmarks/start.php @@ -83,6 +83,7 @@ function bookmarks_init() { * Title is ignored * * @param array $page + * @return bool */ function bookmarks_page_handler($page) { elgg_load_library('elgg:bookmarks'); @@ -151,7 +152,6 @@ function bookmarks_page_handler($page) { } elgg_pop_context(); - return true; } diff --git a/mod/categories/start.php b/mod/categories/start.php index b6bc4a55c..0aacf11e7 100644 --- a/mod/categories/start.php +++ b/mod/categories/start.php @@ -27,12 +27,12 @@ function categories_init() { /** - * Page handler - * + * Category page handler + * @return bool */ function categories_page_handler() { include(dirname(__FILE__) . "/pages/categories/listing.php"); - return TRUE; + return true; } /** diff --git a/mod/custom_index/views/default/custom_index/css.php b/mod/custom_index/views/default/custom_index/css.php index 841b66761..4c780a905 100644 --- a/mod/custom_index/views/default/custom_index/css.php +++ b/mod/custom_index/views/default/custom_index/css.php @@ -11,12 +11,12 @@ .custom-index { padding: 10px 0; } -.elgg-module-front { +.elgg-module-highlight { -webkit-box-shadow: 1px 1px 5px #CCC; -moz-box-shadow: 1px 1px 5px #CCC; box-shadow: 1px 1px 5px #CCC; } -.elgg-module-front:hover { +.elgg-module-highlight:hover { -webkit-box-shadow: 1px 1px 6px #AAA; -moz-box-shadow: 1px 1px 6px #AAA; box-shadow: 1px 1px 6px #AAA; diff --git a/mod/custom_index/views/default/page/layouts/custom_index.php b/mod/custom_index/views/default/page/layouts/custom_index.php index 46efa11e2..1267e19b2 100644 --- a/mod/custom_index/views/default/page/layouts/custom_index.php +++ b/mod/custom_index/views/default/page/layouts/custom_index.php @@ -7,7 +7,7 @@ * */ -$mod_params = array('class' => 'elgg-module-featured'); +$mod_params = array('class' => 'elgg-module-highlight'); ?> @@ -25,22 +25,19 @@ if (elgg_is_logged_in()) { } else { $top_box = $vars['login']; } -echo elgg_view_module('front', '', $top_box, array( - 'header' => false, - 'class' => 'elgg-module-featured', -)); +echo elgg_view_module('featured', '', $top_box, $mod_params); // a view for plugins to extend echo elgg_view("index/lefthandside"); // files if (elgg_is_active_plugin('file')) { - echo elgg_view_module('front', elgg_echo("custom:files"), $vars['files'], $mod_params); + echo elgg_view_module('featured', elgg_echo("custom:files"), $vars['files'], $mod_params); } // groups if (elgg_is_active_plugin('groups')) { - echo elgg_view_module('front', elgg_echo("custom:groups"), $vars['groups'], $mod_params); + echo elgg_view_module('featured', elgg_echo("custom:groups"), $vars['groups'], $mod_params); } ?> </div> @@ -54,16 +51,16 @@ if (elgg_is_active_plugin('groups')) { echo elgg_view("index/righthandside"); // files -echo elgg_view_module('front', elgg_echo("custom:members"), $vars['members'], $mod_params); +echo elgg_view_module('featured', elgg_echo("custom:members"), $vars['members'], $mod_params); // groups if (elgg_is_active_plugin('blog')) { - echo elgg_view_module('front', elgg_echo("custom:blogs"), $vars['blogs'], $mod_params); + echo elgg_view_module('featured', elgg_echo("custom:blogs"), $vars['blogs'], $mod_params); } // files if (elgg_is_active_plugin('bookmarks')) { - echo elgg_view_module('front', elgg_echo("custom:bookmarks"), $vars['bookmarks'], $mod_params); + echo elgg_view_module('featured', elgg_echo("custom:bookmarks"), $vars['bookmarks'], $mod_params); } ?> </div> diff --git a/mod/dashboard/start.php b/mod/dashboard/start.php index 5635ead57..65007d1a8 100644 --- a/mod/dashboard/start.php +++ b/mod/dashboard/start.php @@ -29,6 +29,10 @@ function dashboard_init() { elgg_register_plugin_hook_handler('get_list', 'default_widgets', 'dashboard_default_widgets'); } +/** + * Dashboard page handler + * @return bool + */ function dashboard_page_handler() { // Ensure that only logged-in users can see this page gatekeeper(); @@ -51,6 +55,7 @@ function dashboard_page_handler() { $body = elgg_view_layout('one_column', array('content' => $widgets)); echo elgg_view_page($title, $body); + return true; } diff --git a/mod/developers/start.php b/mod/developers/start.php index ab9a174a4..2e3df7663 100644 --- a/mod/developers/start.php +++ b/mod/developers/start.php @@ -157,6 +157,7 @@ function developers_log_events($name, $type) { * Serve the theme preview pages * * @param array $page + * @return bool */ function developers_theme_preview_controller($page) { if (!isset($page[0])) { @@ -191,4 +192,5 @@ function developers_theme_preview_controller($page) { )); echo elgg_view_page($title, $layout, 'theme_preview'); + return true; } diff --git a/mod/diagnostics/start.php b/mod/diagnostics/start.php index 735e15042..0bcc08bd9 100644 --- a/mod/diagnostics/start.php +++ b/mod/diagnostics/start.php @@ -12,9 +12,6 @@ elgg_register_event_handler('init', 'system', 'diagnostics_init'); */ function diagnostics_init() { - // Register a page handler, so we can have nice URLs - elgg_register_page_handler('diagnostics','diagnostics_page_handler'); - // Add admin menu item elgg_register_admin_menu_item('develop', 'diagnostics', 'develop_utilities'); diff --git a/mod/externalpages/start.php b/mod/externalpages/start.php index 3169503be..13235af53 100644 --- a/mod/externalpages/start.php +++ b/mod/externalpages/start.php @@ -53,6 +53,7 @@ function expages_setup_footer_menu() { * * @param array $page URL segements * @param string $handler Handler identifier + * @return bool */ function expages_page_handler($page, $handler) { if ($handler == 'expages') { @@ -76,6 +77,7 @@ function expages_page_handler($page, $handler) { $body = elgg_view_layout("one_sidebar", array('content' => $content)); echo elgg_view_page($title, $body); + return true; } /** diff --git a/mod/file/start.php b/mod/file/start.php index 9007fc9ba..f8b7fa423 100644 --- a/mod/file/start.php +++ b/mod/file/start.php @@ -100,7 +100,7 @@ function file_init() { * Title is ignored * * @param array $page - * @return NULL + * @return bool */ function file_page_handler($page) { @@ -136,19 +136,21 @@ function file_page_handler($page) { include "$file_dir/owner.php"; break; case 'all': - default: include "$file_dir/world.php"; break; + default: + return false; } + return true; } /** * Creates the notification message body * - * @param unknown_type $hook - * @param unknown_type $entity_type - * @param unknown_type $returnvalue - * @param unknown_type $params + * @param string $hook + * @param string $entity_type + * @param string $returnvalue + * @param array $params */ function file_notify_message($hook, $entity_type, $returnvalue, $params) { $entity = $params['entity']; diff --git a/mod/groups/languages/en.php b/mod/groups/languages/en.php index 0818e5602..09feaf8d1 100644 --- a/mod/groups/languages/en.php +++ b/mod/groups/languages/en.php @@ -114,6 +114,7 @@ $english = array( 'discussion:latest' => 'Latest discussion', 'discussion:group' => 'Group discussion', 'discussion:none' => 'No discussion', + 'discussion:reply:title' => 'Reply by %s', 'discussion:topic:created' => 'The discussion topic was created.', 'discussion:topic:updated' => 'The discussion topic was updated.', diff --git a/mod/groups/start.php b/mod/groups/start.php index 1b5b03ce7..5469da013 100644 --- a/mod/groups/start.php +++ b/mod/groups/start.php @@ -192,6 +192,7 @@ function groups_setup_sidebar_menus() { * Group members: groups/members/<guid> * * @param array $page Array of url segments for routing + * @return bool */ function groups_page_handler($page) { @@ -238,13 +239,17 @@ function groups_page_handler($page) { case 'requests': groups_handle_requests_page($page[1]); break; + default: + return false; } + return true; } /** * Handle group icons. * - * @param unknown_type $page + * @param array $page + * @return void */ function groups_icon_handler($page) { @@ -750,6 +755,7 @@ function discussion_init() { * Edit discussion topic: discussion/edit/<guid> * * @param array $page Array of url segments for routing + * @return bool */ function discussion_page_handler($page) { @@ -773,7 +779,10 @@ function discussion_page_handler($page) { case 'view': discussion_handle_view_page($page[1]); break; + default: + return false; } + return true; } /** diff --git a/mod/groups/views/rss/annotation/group_topic_post.php b/mod/groups/views/rss/annotation/group_topic_post.php new file mode 100644 index 000000000..0d3a40117 --- /dev/null +++ b/mod/groups/views/rss/annotation/group_topic_post.php @@ -0,0 +1,32 @@ +<?php +/** + * RSS view for a discussion reply + * + * @uses $vars['annotation'] + */ + +$annotation = $vars['annotation']; + +$poster = $annotation->getOwnerEntity(); +$poster_name = htmlspecialchars($poster->name, ENT_NOQUOTES, 'UTF-8'); +$pubdate = date('r', $annotation->getTimeCreated()); +$permalink = $annotation->getURL(); + +$title = elgg_echo('discussion:reply:title', array($poster_name)); + +$creator = elgg_view('page/components/creator', array('entity' => $annotation)); +$extensions = elgg_view('extensions/item', $vars); + +$item = <<<__HTML +<item> + <guid isPermaLink='true'>$permalink</guid> + <pubDate>$pubdate</pubDate> + <link>$permalink</link> + <title><![CDATA[$title]]></title> + <description><![CDATA[{$vars['annotation']->value}]]></description> + $creator$extensions +</item> + +__HTML; + +echo $item; diff --git a/mod/groups/views/rss/discussion/replies.php b/mod/groups/views/rss/discussion/replies.php new file mode 100644 index 000000000..419003b21 --- /dev/null +++ b/mod/groups/views/rss/discussion/replies.php @@ -0,0 +1,12 @@ +<?php +/** + * List replies RSS view + * + * @uses $vars['entity'] ElggEntity + */ + +$options = array( + 'guid' => $vars['entity']->getGUID(), + 'annotation_name' => 'group_topic_post', +); +echo elgg_list_annotations($options); diff --git a/mod/groups/views/rss/forum/topicposts.php b/mod/groups/views/rss/forum/topicposts.php deleted file mode 100644 index 15c5adc7f..000000000 --- a/mod/groups/views/rss/forum/topicposts.php +++ /dev/null @@ -1,3 +0,0 @@ -<?php - -?>
\ No newline at end of file diff --git a/mod/groups/views/rss/forum/topics.php b/mod/groups/views/rss/forum/topics.php deleted file mode 100644 index 1cb22aaea..000000000 --- a/mod/groups/views/rss/forum/topics.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php - /** - * Elgg groups plugin - * - * @package ElggGroups - */ - - // If there are any topics to view, view them - echo $vars['topics']; -?>
\ No newline at end of file diff --git a/mod/groups/views/rss/forum/viewposts.php b/mod/groups/views/rss/forum/viewposts.php deleted file mode 100644 index ad52365e6..000000000 --- a/mod/groups/views/rss/forum/viewposts.php +++ /dev/null @@ -1,22 +0,0 @@ -<?php - - /** - * Elgg groups plugin display topic posts - * - * @package ElggGroups - */ - - //display follow up comments - $count = $vars['entity']->countAnnotations('group_topic_post'); - $offset = (int) get_input('offset',0); - - foreach($vars['entity']->getAnnotations('group_topic_post', 50, $offset, "asc") as $post) { - - $post->title = ''; - $post->description = $post->value; - echo elgg_view('object/default', array('entity' => $post)); - // echo elgg_view("forum/topicposts",array('entity' => $post)); - - } - -?>
\ No newline at end of file diff --git a/mod/groups/views/rss/groups/contentwrapper.php b/mod/groups/views/rss/groups/contentwrapper.php deleted file mode 100644 index 15397d552..000000000 --- a/mod/groups/views/rss/groups/contentwrapper.php +++ /dev/null @@ -1,5 +0,0 @@ -<?php - - echo $vars['body']; - -?>
\ No newline at end of file diff --git a/mod/groups/views/rss/groups/profile/layout.php b/mod/groups/views/rss/groups/profile/layout.php new file mode 100644 index 000000000..3eeb9eaf2 --- /dev/null +++ b/mod/groups/views/rss/groups/profile/layout.php @@ -0,0 +1,13 @@ +<?php +/** + * Group profile RSS view + * + * Displays a list of the latest content in the group + * + * @uses $vars['entity'] ElggGroup object + */ + +echo elgg_list_entities(array( + 'type' => 'object', + 'container_guid' => $vars['entity']->getGUID(), +)); diff --git a/mod/groups/views/rss/groups/profileitems.php b/mod/groups/views/rss/groups/profileitems.php deleted file mode 100644 index 5e595a379..000000000 --- a/mod/groups/views/rss/groups/profileitems.php +++ /dev/null @@ -1,15 +0,0 @@ -<?php - /** - * Elgg groups items view. - * This is the messageboard, members, pages and latest forums posts. Each plugin will extend the views - * - * @package ElggGroups - */ - - //right column - if ($forae = elgg_get_entities(array('types' => 'object', 'container_guid' => $vars['entity']->guid))) { - foreach($forae as $forum) - echo elgg_view_entity($forum); - } - -?>
\ No newline at end of file diff --git a/mod/groups/views/rss/object/groupforumtopic.php b/mod/groups/views/rss/object/groupforumtopic.php index 19297b350..d730ef796 100644 --- a/mod/groups/views/rss/object/groupforumtopic.php +++ b/mod/groups/views/rss/object/groupforumtopic.php @@ -1,32 +1,35 @@ <?php /** - * Elgg groupforumtopic view + * Elgg groupforumtopic RSS view * - * @package Elgg - * @subpackage Core + * @package ElggGroups */ $title = $vars['entity']->title; - -$body = ''; -$annotation = $vars['entity']->getAnnotations('group_topic_post', 1, 0, "asc"); -if (count($annotation == 1)) { - $body = $annotation[0]->value; +if (empty($title)) { + $title = strip_tags($vars['entity']->description); + $title = elgg_get_excerpt($title, 32); } -?> +$permalink = htmlspecialchars($vars['entity']->getURL(), ENT_NOQUOTES, 'UTF-8'); +$pubdate = date('r', $vars['entity']->getTimeCreated()); + +$description = autop($vars['entity']->description); + +$creator = elgg_view('page/components/creator', $vars); +$georss = elgg_view('page/components/georss', $vars); +$extension = elgg_view('extensions/item', $vars); + +$item = <<<__HTML <item> -<guid isPermaLink='true'><?php echo htmlspecialchars($vars['entity']->getURL()); ?></guid> -<pubDate><?php echo date("r",$vars['entity']->time_created) ?></pubDate> -<link><?php echo htmlspecialchars($vars['entity']->getURL()); ?></link> -<title><![CDATA[<?php echo $title; ?>]]></title> -<description><![CDATA[<?php echo (autop($body)); ?>]]></description> -<?php - $owner = $vars['entity']->getOwnerEntity(); - if ($owner) { -?> -<dc:creator><?php echo $owner->name; ?></dc:creator> -<?php - } -?> -</item>
\ No newline at end of file + <guid isPermaLink="true">$permalink</guid> + <pubDate>$pubdate</pubDate> + <link>$permalink</link> + <title><![CDATA[$title]]></title> + <description><![CDATA[$description]]></description> + $creator$georss$extension +</item> + +__HTML; + +echo $item; diff --git a/mod/invitefriends/start.php b/mod/invitefriends/start.php index f39d25f4b..be853f2ce 100644 --- a/mod/invitefriends/start.php +++ b/mod/invitefriends/start.php @@ -27,6 +27,7 @@ function invitefriends_init() { * Page handler function * * @param array $page Page URL segments + * @return bool */ function invitefriends_page_handler($page) { gatekeeper(); @@ -45,4 +46,5 @@ function invitefriends_page_handler($page) { $body = elgg_view_layout('one_sidebar', $params); echo elgg_view_page($title, $body); + return true; } diff --git a/mod/members/start.php b/mod/members/start.php index 2c1793c17..54787cd16 100644 --- a/mod/members/start.php +++ b/mod/members/start.php @@ -19,6 +19,7 @@ function members_init() { * Members page handler * * @param array $page url segments + * @return bool */ function members_page_handler($page) { $base = elgg_get_plugins_path() . 'members/pages/members'; @@ -36,4 +37,5 @@ function members_page_handler($page) { } else { require_once "$base/index.php"; } + return true; } diff --git a/mod/messageboard/start.php b/mod/messageboard/start.php index 0b0155069..0c65edc4f 100644 --- a/mod/messageboard/start.php +++ b/mod/messageboard/start.php @@ -84,8 +84,10 @@ function messageboard_page_handler($page) { set_input('page_owner_guid', $owner_guid); include "$pages/owner.php"; break; - } + default: + return false; + } return true; } diff --git a/mod/messages/start.php b/mod/messages/start.php index 4a3b0b250..e4ef4d43a 100644 --- a/mod/messages/start.php +++ b/mod/messages/start.php @@ -115,7 +115,6 @@ function messages_page_handler($page) { default: return false; } - return true; } diff --git a/mod/notifications/start.php b/mod/notifications/start.php index c6701cc3e..761f17e40 100644 --- a/mod/notifications/start.php +++ b/mod/notifications/start.php @@ -36,6 +36,7 @@ function notifications_plugin_init() { * Route page requests * * @param array $page Array of url parameters + * @return bool */ function notifications_page_handler($page) { @@ -51,12 +52,12 @@ function notifications_page_handler($page) { require "$base/groups.php"; break; case 'personal': - default: require "$base/index.php"; break; + default: + return false; } - - return TRUE; + return true; } /** diff --git a/mod/pages/start.php b/mod/pages/start.php index 744306649..b2f26c719 100644 --- a/mod/pages/start.php +++ b/mod/pages/start.php @@ -100,6 +100,7 @@ function pages_init() { * Title is ignored * * @param array $page + * @return bool */ function pages_page_handler($page) { @@ -149,12 +150,12 @@ function pages_page_handler($page) { include "$base_dir/revision.php"; break; case 'all': - default: include "$base_dir/world.php"; break; + default: + return false; } - - return; + return true; } /** diff --git a/mod/profile/start.php b/mod/profile/start.php index 0f13ad844..0ee2d0152 100644 --- a/mod/profile/start.php +++ b/mod/profile/start.php @@ -48,6 +48,7 @@ function profile_init() { * Profile page handler * * @param array $page Array of URL segments passed by the page handling mechanism + * @return bool */ function profile_page_handler($page) { @@ -84,6 +85,7 @@ function profile_page_handler($page) { $body = elgg_view_layout('one_column', array('content' => $content)); echo elgg_view_page($title, $body); + return true; } /** diff --git a/mod/reportedcontent/start.php b/mod/reportedcontent/start.php index 66a1248d9..8b18a4d64 100644 --- a/mod/reportedcontent/start.php +++ b/mod/reportedcontent/start.php @@ -60,6 +60,7 @@ function reportedcontent_init() { * Serves the add report page * * @param array $page Array of page routing elements + * @return bool */ function reportedcontent_page_handler($page) { // only logged in users can report things @@ -76,6 +77,7 @@ function reportedcontent_page_handler($page) { $body = elgg_view_layout('one_sidebar', $params); echo elgg_view_page(elgg_echo('reportedcontent:this'), $body); + return true; } /** diff --git a/mod/search/start.php b/mod/search/start.php index 9ab14f42f..73a96dc0a 100644 --- a/mod/search/start.php +++ b/mod/search/start.php @@ -14,7 +14,7 @@ function search_init() { require_once 'search_hooks.php'; // page handler for search actions and results - elgg_register_page_handler('search','search_page_handler'); + elgg_register_page_handler('search', 'search_page_handler'); // register some default search hooks elgg_register_plugin_hook_handler('search', 'object', 'search_objects_hook'); @@ -55,7 +55,8 @@ function search_init() { /** * Page handler for search * - * @param array $page Page elements from pain page handler + * @param array $page Page elements from core page handler + * @return bool */ function search_page_handler($page) { @@ -71,6 +72,7 @@ function search_page_handler($page) { $base_dir = elgg_get_plugins_path() . 'search/pages/search'; include_once("$base_dir/index.php"); + return true; } /** diff --git a/mod/thewire/start.php b/mod/thewire/start.php index d5e995359..2ed0f0b4d 100644 --- a/mod/thewire/start.php +++ b/mod/thewire/start.php @@ -84,57 +84,60 @@ function thewire_init() { * thewire/tag/<tag> View wire posts tagged with <tag> * * @param array $page From the page_handler function - * @return true|false Depending on success + * @return bool */ function thewire_page_handler($page) { $base_dir = elgg_get_plugins_path() . 'thewire/pages/thewire'; - // if just /thewire go to global view in the else statement - if (isset($page[0]) && $page[0]) { - - switch ($page[0]) { - case "all": - include "$base_dir/everyone.php"; - break; - - case "friends": - include "$base_dir/friends.php"; - break; - - case "owner": - include "$base_dir/owner.php"; - break; - - case "thread": - if (isset($page[1])) { - set_input('thread_id', $page[1]); - } - include "$base_dir/thread.php"; - break; - case "reply": - if (isset($page[1])) { - set_input('guid', $page[1]); - } - include "$base_dir/reply.php"; - break; - case "tag": - if (isset($page[1])) { - set_input('tag', $page[1]); - } - include "$base_dir/tag.php"; - break; - case "previous": - if (isset($page[1])) { - set_input('guid', $page[1]); - } - include "$base_dir/previous.php"; - break; - } - } else { - include "$base_dir/everyone.php"; + if (!isset($page[0])) { + $page = array('all'); } + switch ($page[0]) { + case "all": + include "$base_dir/everyone.php"; + break; + + case "friends": + include "$base_dir/friends.php"; + break; + + case "owner": + include "$base_dir/owner.php"; + break; + + case "thread": + if (isset($page[1])) { + set_input('thread_id', $page[1]); + } + include "$base_dir/thread.php"; + break; + + case "reply": + if (isset($page[1])) { + set_input('guid', $page[1]); + } + include "$base_dir/reply.php"; + break; + + case "tag": + if (isset($page[1])) { + set_input('tag', $page[1]); + } + include "$base_dir/tag.php"; + break; + + case "previous": + if (isset($page[1])) { + set_input('guid', $page[1]); + } + include "$base_dir/previous.php"; + break; + + default: + return false; + } return true; } diff --git a/mod/twitter_api/start.php b/mod/twitter_api/start.php index b17643c8c..08bce5479 100644 --- a/mod/twitter_api/start.php +++ b/mod/twitter_api/start.php @@ -45,6 +45,7 @@ function twitter_api_init() { * Handles old pg/twitterservice/ handler * * @param array $page + * @return bool */ function twitter_api_pagehandler_deprecated($page) { $url = elgg_get_site_url() . 'pg/twitter_api/authorize'; @@ -59,10 +60,11 @@ function twitter_api_pagehandler_deprecated($page) { * Serves pages for twitter. * * @param array $page + * @return void */ function twitter_api_pagehandler($page) { if (!isset($page[0])) { - forward(); + return false; } switch ($page[0]) { @@ -91,9 +93,9 @@ function twitter_api_pagehandler($page) { include "$pages/interstitial.php"; break; default: - forward(); - break; + return false; } + return true; } /** diff --git a/mod/uservalidationbyemail/start.php b/mod/uservalidationbyemail/start.php index d3d0c3488..6904ce9e2 100644 --- a/mod/uservalidationbyemail/start.php +++ b/mod/uservalidationbyemail/start.php @@ -149,6 +149,7 @@ function uservalidationbyemail_check_auth_attempt($credentials) { * Checks sent passed validation code and user guids and validates the user. * * @param array $page + * @return bool */ function uservalidationbyemail_page_handler($page) { @@ -162,7 +163,7 @@ function uservalidationbyemail_page_handler($page) { $user = get_entity($user_guid); - if (($code) && ($user)) { + if ($code && $user) { if (uservalidationbyemail_validate_email($user_guid, $code)) { elgg_push_context('uservalidationbyemail_validate_user'); @@ -184,7 +185,8 @@ function uservalidationbyemail_page_handler($page) { register_error(elgg_echo('email:confirm:fail')); } - forward(); + // forward to front page + forward(''); } /** diff --git a/views/default/core/account/login_box.php b/views/default/core/account/login_box.php index 8c586d425..f39113653 100644 --- a/views/default/core/account/login_box.php +++ b/views/default/core/account/login_box.php @@ -4,8 +4,12 @@ * * @package Elgg * @subpackage Core + * + * @uses $vars['module'] The module name. Default: aside */ +$module = elgg_extract('module', $vars, 'aside'); + $login_url = elgg_get_site_url(); if (elgg_get_config('https_login')) { $login_url = str_replace("http:", "https:", $login_url); @@ -14,4 +18,4 @@ if (elgg_get_config('https_login')) { $title = elgg_echo('login'); $body = elgg_view_form('login', array('action' => "{$login_url}action/login")); -echo elgg_view_module('aside', $title, $body); +echo elgg_view_module($module, $title, $body); diff --git a/views/default/core/account/login_walled_garden.php b/views/default/core/account/login_walled_garden.php deleted file mode 100644 index 1606b9592..000000000 --- a/views/default/core/account/login_walled_garden.php +++ /dev/null @@ -1,100 +0,0 @@ -<?php -/** - * Walled Garden Login Form - * - * @todo still requires clean up - */ - -$reg_url = elgg_normalize_url('register'); -$forgot_url = elgg_normalize_url('forgotpassword'); -$cancel_button = elgg_view('input/button', array( - 'value' => elgg_echo('cancel'), - 'class' => 'elgg-button-cancel mlm', -)); - -$form_body = elgg_view('forms/login'); -$form_body .= elgg_view('input/hidden', array( - 'name' => 'returntoreferer', - 'value' => 'true', -)); - -$login_url = elgg_get_site_url(); -if (elgg_get_config('https_login')) { - $login_url = str_replace("http:", "https:", elgg_get_site_url()); -} - -?> -<h2><?php echo elgg_echo('login'); ?></h2> -<?php -//@todo Forms 1.8: Convert to use elgg_view_form() -echo elgg_view('input/form', array( - 'body' => $form_body, - 'action' => "{$login_url}action/login", -)); - -if (elgg_get_config('allow_registration')) { - $title = elgg_echo('register'); - $body = elgg_view_form('register', array(), array( - 'friend_guid' => (int) get_input('friend_guid', 0), - 'invitecode' => get_input('invitecode'), - )); - - echo <<<__HTML -<div id="elgg-walledgarden-registration" class="hidden clearfix"> - <div class="elgg-hiddenform-body" class="clearfix"> - <h2>$title</h2> - $body - </div> - <div class="elgg-hiddenform-bottom"></div> -</div> -__HTML; -} - -$title = elgg_echo('user:password:lost'); -$body = elgg_view_form('user/requestnewpassword'); -echo <<<__HTML -<div id="elgg-walledgarden-lostpassword" class="hidden clearfix"> - <div class="elgg-hiddenform-body" class="clearfix"> - <h2>$title</h2> - $body - </div> - <div class="elgg-hiddenform-bottom"></div> -</div> -__HTML; - -//@todo JS 1.8: no -?> -<script type="text/javascript"> -$(document).ready(function() { - $('input.username').focus(); - - // add cancel button to inline forms - $('#elgg-walledgarden-registration').find('input.elgg-button-submit').after('<?php echo $cancel_button; ?>'); - $('#elgg-walledgarden-lostpassword').find('input.elgg-button-submit').after('<?php echo $cancel_button; ?>'); - - function elgg_slide_hiddenform(activateLink, parentElement, toggleElement) { - $(activateLink).closest(parentElement).find(toggleElement).fadeToggle('medium'); - } - - $('a[href="<?php echo $reg_url; ?>"]').click(function(e) { - e.preventDefault(); - elgg_slide_hiddenform(this, '#elgg-walledgarden-login', '#elgg-walledgarden-registration'); - $('input.name').focus(); - }); - - $('a[href="<?php echo $forgot_url; ?>"]').click(function(e) { - e.preventDefault(); - elgg_slide_hiddenform(this, '#elgg-walledgarden-login', '#elgg-walledgarden-lostpassword'); - $('input.lostusername').focus(); - }); - - $('input.elgg-button-cancel').click(function() { - if ($('#elgg-walledgarden-lostpassword').is(':visible')) { - $('a[href="<?php echo $forgot_url; ?>"]').click(); - } else if ($('#elgg-walledgarden-registration').is(':visible')) { - $('a[href="<?php echo $reg_url; ?>"]').click(); - } - return false; - }); -}); -</script> diff --git a/views/default/core/walled_garden/body.php b/views/default/core/walled_garden/body.php new file mode 100644 index 000000000..67d8e0c37 --- /dev/null +++ b/views/default/core/walled_garden/body.php @@ -0,0 +1,11 @@ +<?php +/** + * Walled garden body + */ + +echo elgg_view('core/walled_garden/login'); +echo elgg_view('core/walled_garden/lost_password'); + +if (elgg_get_config('allow_registration')) { + echo elgg_view('core/walled_garden/register'); +} diff --git a/views/default/core/walled_garden/login.php b/views/default/core/walled_garden/login.php new file mode 100644 index 000000000..0a8b4a908 --- /dev/null +++ b/views/default/core/walled_garden/login.php @@ -0,0 +1,37 @@ +<?php +/** + * Walled garden login + */ + +$title = elgg_get_site_entity()->name; +$welcome = elgg_echo('walled_garden:welcome'); +$welcome .= ': <br/>' . $title; + +$menu = elgg_view_menu('walled_garden', array( + 'sort_by' => 'priority', + 'class' => 'elgg-menu-general elgg-menu-hz', +)); + +$login_box = elgg_view('core/account/login_box', array('module' => 'walledgarden-login')); + +$content = <<<HTML +<div class="elgg-col elgg-col-1of2"> + <div class="elgg-inner"> + <h1 class="elgg-heading-walledgarden"> + $welcome + </h1> + $menu + </div> +</div> +<div class="elgg-col elgg-col-1of2"> + <div class="elgg-inner"> + $login_box + </div> +</div> +HTML; + +echo elgg_view_module('walledgarden', '', $content, array( + 'class' => 'elgg-walledgarden-double', + 'header' => ' ', + 'footer' => ' ', +)); diff --git a/views/default/core/walled_garden/lost_password.php b/views/default/core/walled_garden/lost_password.php new file mode 100644 index 000000000..ce75b558b --- /dev/null +++ b/views/default/core/walled_garden/lost_password.php @@ -0,0 +1,19 @@ +<?php +/** + * Walled garden lost password + */ + +$title = elgg_echo('user:password:lost'); +$body = elgg_view_form('user/requestnewpassword'); +$lost = <<<HTML +<div class="elgg-inner"> + <h3>$title</h3> + $body +</div> +HTML; + +echo elgg_view_module('walledgarden', '', $lost, array( + 'class' => 'elgg-walledgarden-single elgg-walledgarden-password hidden', + 'header' => ' ', + 'footer' => ' ', +)); diff --git a/views/default/core/walled_garden/register.php b/views/default/core/walled_garden/register.php new file mode 100644 index 000000000..7f6aac99b --- /dev/null +++ b/views/default/core/walled_garden/register.php @@ -0,0 +1,23 @@ +<?php +/** + * Walled garden registration + */ + +$title = elgg_echo('register'); +$body = elgg_view_form('register', array(), array( + 'friend_guid' => (int) get_input('friend_guid', 0), + 'invitecode' => get_input('invitecode'), +)); + +$content = <<<__HTML +<div class="elgg-inner"> + <h2>$title</h2> + $body +</div> +__HTML; + +echo elgg_view_module('walledgarden', '', $content, array( + 'class' => 'elgg-walledgarden-single elgg-walledgarden-register hidden', + 'header' => ' ', + 'footer' => ' ', +));
\ No newline at end of file diff --git a/views/default/css/ie7.php b/views/default/css/ie7.php index 754ed3664..db0125b4b 100644 --- a/views/default/css/ie7.php +++ b/views/default/css/ie7.php @@ -53,4 +53,13 @@ .elgg-avatar { display: inline; +} + +.elgg-body-walledgarden .elgg-col-1of2 { + width: 255px; +} + +.elgg-module-walledgarden > .elgg-head, +.elgg-module-walledgarden > .elgg-foot { + width: 530px; }
\ No newline at end of file diff --git a/views/default/css/walled_garden.php b/views/default/css/walled_garden.php index 47850425b..ea2543587 100644 --- a/views/default/css/walled_garden.php +++ b/views/default/css/walled_garden.php @@ -6,36 +6,65 @@ $url = elgg_get_site_url(); ?> -#elgg-walledgarden { +.elgg-body-walledgarden { margin: 100px auto 0 auto; - width: 563px; - min-height: 230px; - background: url(<?php echo $url; ?>_graphics/walled_garden_background_top.gif) no-repeat left top; - padding: 0; position: relative; + width: 530px; } - -#elgg-walledgarden-bottom { - margin:0 auto; - background: url(<?php echo $url; ?>_graphics/walled_garden_background_bottom.gif) no-repeat left bottom; - width:563px; - height:54px; +.elgg-module-walledgarden { + position: absolute; + top: 0; + left: 0; +} +.elgg-module-walledgarden > .elgg-head { + height: 17px; +} +.elgg-module-walledgarden > .elgg-body { + padding: 0 10px; +} +.elgg-module-walledgarden > .elgg-foot { + height: 17px; +} +.elgg-walledgarden-double > .elgg-head { + background: url(<?php echo $url; ?>_graphics/walled_garden/two_column_top.png) no-repeat left top; +} +.elgg-walledgarden-double > .elgg-body { + background: url(<?php echo $url; ?>_graphics/walled_garden/two_column_middle.png) repeat-y left top; +} +.elgg-walledgarden-double > .elgg-foot { + background: url(<?php echo $url; ?>_graphics/walled_garden/two_column_bottom.png) no-repeat left top; +} +.elgg-walledgarden-single > .elgg-head { + background: url(<?php echo $url; ?>_graphics/walled_garden/one_column_top.png) no-repeat left top; +} +.elgg-walledgarden-single > .elgg-body { + background: url(<?php echo $url; ?>_graphics/walled_garden/one_column_middle.png) repeat-y left top; +} +.elgg-walledgarden-single > .elgg-foot { + background: url(<?php echo $url; ?>_graphics/walled_garden/one_column_bottom.png) no-repeat left top; } -#elgg-walledgarden-intro { - width: 230px; - float: left; - margin: 35px 15px 15px 35px; +.elgg-col > .elgg-inner { + margin: 0 0 0 5px; +} +.elgg-col:first-child > .elgg-inner { + margin: 0 5px 0 0; +} +.elgg-col > .elgg-inner { + padding: 0 8px; } -#elgg-walledgarden-intro ul { - float: left; +.elgg-walledgarden-single > .elgg-body > .elgg-inner { + padding: 0 8px; } -#elgg-walledgarden-login { - width: 230px; - float: left; - margin: 30px 15px 45px 19px; +.elgg-module-walledgarden-login { + margin: 0; +} +.elgg-body-walledgarden h3 { + font-size: 1.5em; + line-height: 1.1em; + padding-bottom: 5px; } .elgg-heading-walledgarden { @@ -43,27 +72,3 @@ $url = elgg_get_site_url(); margin-top: 60px; line-height: 1.1em; } - -#elgg-walledgarden-lostpassword, -#elgg-walledgarden-registration { - position: absolute; - right: 0; - top: 0; - width: 563px; - background-color: white; - padding: 0; - background: url(<?php echo $url; ?>_graphics/walled_garden_backgroundfull_top.gif) no-repeat left top; - height: auto; -} - -.elgg-hiddenform-body { - padding: 30px 40px 0 40px; - height: auto; -} -.elgg-hiddenform-bottom { - margin: 0 auto; - background: url(<?php echo $url; ?>_graphics/walled_garden_backgroundfull_bottom.gif) no-repeat left bottom; - width: 563px; - height: 54px; - position: relative; -} diff --git a/views/default/forms/login.php b/views/default/forms/login.php index 07f084660..9536bb439 100644 --- a/views/default/forms/login.php +++ b/views/default/forms/login.php @@ -23,13 +23,13 @@ <?php echo elgg_view('login/extend'); ?> <div class="elgg-foot"> - <?php echo elgg_view('input/submit', array('value' => elgg_echo('login'))); ?> - - <label class="right mtm"> + <label class="mtm float-alt"> <input type="checkbox" name="persistent" value="true" /> <?php echo elgg_echo('user:persistent'); ?> </label> + <?php echo elgg_view('input/submit', array('value' => elgg_echo('login'))); ?> + <?php if ($vars['returntoreferer']) { echo elgg_view('input/hidden', array('name' => 'returntoreferer', 'value' => 'true')); @@ -42,7 +42,7 @@ echo '<li><a class="registration_link" href="' . elgg_get_site_url() . 'register">' . elgg_echo('register') . '</a></li>'; } ?> - <li><a href="<?php echo elgg_get_site_url(); ?>forgotpassword"> + <li><a class="forgot_link" href="<?php echo elgg_get_site_url(); ?>forgotpassword"> <?php echo elgg_echo('user:password:lost'); ?> </a></li> </ul> diff --git a/views/default/js/walled_garden.php b/views/default/js/walled_garden.php new file mode 100644 index 000000000..46c2934ff --- /dev/null +++ b/views/default/js/walled_garden.php @@ -0,0 +1,40 @@ +<?php +/** + * Walled garden JavaScript + * + * @todo update for new JS lib + */ + +$cancel_button = elgg_view('input/button', array( + 'value' => elgg_echo('cancel'), + 'class' => 'elgg-button-cancel mlm', +)); +$cancel_button = trim($cancel_button); + +?> + +$(document).ready(function() { + + // add cancel button to inline forms + $(".elgg-walledgarden-password").find('input.elgg-button-submit').after('<?php echo $cancel_button; ?>'); + $('.elgg-walledgarden-register').find('input.elgg-button-submit').after('<?php echo $cancel_button; ?>'); + + $(".forgot_link").click(function(event) { + event.preventDefault(); + $(".elgg-walledgarden-password").fadeToggle(); + }); + + $(".registration_link").click(function(event) { + event.preventDefault(); + $(".elgg-walledgarden-register").fadeToggle(); + }); + + $('input.elgg-button-cancel').click(function(event) { + if ($(".elgg-walledgarden-password").is(':visible')) { + $(".forgot_link").click(); + } else if ($('.elgg-walledgarden-register').is(':visible')) { + $(".registration_link").click(); + } + event.preventDefault(); + }); +});
\ No newline at end of file diff --git a/views/default/page/components/module.php b/views/default/page/components/module.php index b1198ee9a..0a2f1c35a 100644 --- a/views/default/page/components/module.php +++ b/views/default/page/components/module.php @@ -2,10 +2,10 @@ /** * Elgg module element * - * @uses $vars['title'] Title text - * @uses $vars['header'] HTML content of the header + * @uses $vars['title'] Optional title text (do not pass header with this option) + * @uses $vars['header'] Optional HTML content of the header * @uses $vars['body'] HTML content of the body - * @uses $vars['footer'] HTML content of the footer + * @uses $vars['footer'] Optional HTML content of the footer * @uses $vars['class'] Optional additional class for module * @uses $vars['id'] Optional id for module * @uses $vars['show_inner'] Optional flag to leave out inner div (default: false) @@ -28,22 +28,16 @@ if (isset($vars['id'])) { $id = "id=\"{$vars['id']}\""; } -if (isset($vars['header'])) { - if ($vars['header']) { - $header = "<div class=\"elgg-head\">$header</div>"; - } -} else { +if ($vars['header']) { + $header = "<div class=\"elgg-head\">$header</div>"; +} elseif ($title) { $header = "<div class=\"elgg-head\"><h3>$title</h3></div>"; } $body = "<div class=\"elgg-body\">$body</div>"; -if (isset($vars['footer'])) { - if ($vars['footer']) { - $footer = "<div class=\"elgg-foot\">$footer</div>"; - } -} else { - $footer = "<div class=\"elgg-foot\"></div>"; +if ($footer) { + $footer = "<div class=\"elgg-foot\">$footer</div>"; } $contents = $header . $body . $footer; diff --git a/views/default/page/walled_garden.php b/views/default/page/walled_garden.php index 625c63ddb..ff8e317c7 100644 --- a/views/default/page/walled_garden.php +++ b/views/default/page/walled_garden.php @@ -7,12 +7,9 @@ // Set the content type header("Content-type: text/html; charset=UTF-8"); - -$site = elgg_get_site_entity(); -$title = $site->name; - ?> -<html> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <?php echo elgg_view('page/elements/head', $vars); ?> </head> @@ -21,28 +18,8 @@ $title = $site->name; <div class="elgg-page-messages"> <?php echo elgg_view('page/elements/messages', array('object' => $vars['sysmessages'])); ?> </div> - <div class="elgg-page-body"> - <div id="elgg-walledgarden"> - <div id="elgg-walledgarden-intro"> - <h1 class="elgg-heading-walledgarden"> - <?php - echo elgg_echo('walled_garden:welcome'); - echo ': <br/>'; - echo $title; - ?> - </h1> - <?php - echo elgg_view_menu('walled_garden', array( - 'sort_by' => 'priority', - 'class' => 'elgg-menu-general elgg-menu-hz', - )); - ?> - </div> - <div id="elgg-walledgarden-login"> - <?php echo $vars['body']; ?> - </div> - </div> - <div id="elgg-walledgarden-bottom"></div> + <div class="elgg-body-walledgarden"> + <?php echo $vars['body']; ?> </div> </div> <?php echo elgg_view('page/elements/foot'); ?> |