diff options
125 files changed, 1625 insertions, 597 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index 10770ba1e..779ad4236 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -10,8 +10,6 @@ Version 1.8.0 (Jackie) * Added remove_subtype() and update_subtype(). * Added elgg_format_url(). * ElggDiskFilestore supports non-user owners. - * Removed unnecessary executable permissions on a number of files. (Thanks to - pauloortiz for the report!) Deprecated APIs: * ElggAccess::get_ignore_access() by ElggAccess::getIgnoreAccess(). @@ -46,6 +44,185 @@ Version 1.8.0 (Jackie) elgg_clear_sticky_form(), elgg_is_sticky_form(), and elgg_get_sticky_value(). +Version 1.7.9 +(June 1, 2011 from http://code.elgg.org/branches/1.7) + + Security Enhancements: + * Blocking possible access to restricted pages if headers are output too early. Thanks to Vazco + for reporting! + + Bugfixes: + * Admins can delete Pages again. + * TinyMCE upgraded to 3.4.2 to fix IE support. + * Autocomplete input works correctly. + * Fixed Message Board "all" posts. + * Fixed deleting internal messages on some non-English sites. + * Better feedback if an error occurs when saving widgets. + * Messages from deleted users no longer show the recipient's avatar. + * Https logins on fully https sites work correctly. + + API Changes: + * Added "creating", "river" plugin hook. + * User metadata is registered as independent higher in the boot sequence. + * Group ACLs are updated correctly when joining a non-logged in user to a group. + * Can return 0 for plugin hook 'comments', 'count'. + + +Version 1.7.8 +(April 4, 2011 from http://code.elgg.org/branches/1.7) + + Security Enhancements: + * Properly encoding search queries (Thanks to lord epsylon (of Lorea) for the report!) + + Bugfixes: + * Blogs - Fixed disappearing blog draft issue. + * Groups - Editing a topic from discussion list page works now. + * Search - Group names used in titles. + * InviteFriends - Invitation link no longer shows up when logged out. + * Messages - Denormalized the message calculation for better performance. + * Sorting by time_created in relationship functions supported. + * Metadata and annotation names can now be updated. + * Fixed error with deleting a user with disabled entities. + * Removed unnecessary executable permissions on a number of files. (Thanks to + pauloortiz for the report!) + + API Changes: + * Added delete_submenu_item() for removing sidebar menu items. + + +Version 1.7.7 +(January 31, 2011 from http://code.elgg.org/branches/1.7) + + Security Enhancements: + * Only admins can view the unvalidated users page (Thanks to Manacim + Medriano for the report!) + + Bugfixes: + * Fixed deprecation notices for locales that use comma as radix point. + * Groups - Files can be completely disabled per group. + * Pages - Deleting and creating subpages is restricted to owner or group member. + * Groups - group icons deleted when group is deleted. + * Pagination will not display when all content id displayed. + * Fixed issue with get_context() when trailing slash is missing. + + API Changes: + * Added $CONFIG->action_token_timeout. + * Added callback option to elgg_get_entities(). + + +Version 1.7.6 +(December 23, 2010 from http://code.elgg.org/branches/1.7) + + Security Enhancements: + * Fixed a possible SQL injection attack when using a crafted + URL. Thanks to Gerrit Venema from Gol Gol (golgol.nl) for + the report. + + Bugfixes: + * Pages - Fixed "All Pages" link on "All Site Pages" page. + * Messages - Fixed invalid URLs when using old-style + pg/messages/<username> links. + * Messages - Fixed redirect after deleting a message. + + API Changes: + * Added get_entities_from_access_collection() and deprecated it. + * is_registered_entity_type() returns correctly when requesting + just a type and not a subtype. + + +Version 1.7.5 +(November 26, 2010 from http://code.elgg.org/branches/1.7) + + Security Enhancements: + * Fixed a security flaw in the Bookmarks plugin that could + allow an XSS attack using crafted URLs. Thanks to Akhilesh + Gupta for the bug report. + * Fixed a security flaw in the widgets system that could allow + an XSS attack using crafted URLs. + + Bugfixes: + * Checking for mismatched passwords before creating user when + manually adding users. + * 'large' size profile icons created when cropped. + * Fixed menu entry for user's files link. + * Fixed caching issues with plugin-added view types. + * Fixed XFN links on profile page and user lists. + * Fixed PHP warnings about invalid foreaches in plugins.php + * Fixed problems in elgg_get_entities_*() when using an array + for owner_guid. + * Group profile edit action correctly encodes and saves array input. + * Language string corrections. + + UI/UX Changes: + * Users must verify their current password before they can changing + passwords. + * Using pagehandlers instead of mod/mod_name/ calls in Blogs, + Bookmarks, Members, Pages, The Wire, Groups, Invite Friends, + and Messages. + * Added a page to view Wire posts by user. + + API Changes: + * Added remove_group_tool_option(). + * Wrapped Twitter Service's vendor's oAuth lib in class_exists(). + * Added elgg_list_entities_from_relationship(). + * Exposed order_by param in list_entities_from_relationship(). + * Added a default annotation view. + + +Version 1.7.4 +(October 14, 2010 from http://code.elgg.org/branches/1.7) + + Bugfixes: + * Upgrade Twitter Services to use oAuth so The Wire can post + to Twitter. See http://el.gg/twitteroauth for instructions. + * WSOD fixed when viewing an invalid profile page. + * Checking for mismatched passwords earlier in registration to avoid + creating a user who can never log in and wasting a username/email. + * POST data in the web services API is correctly quoted on servers + with magic quotes enabled. + * WSOD fixed when trying to update an invalid entity. + * Group file widget only shows when Files are enabled for the group. + * Fixed misformatting of some group forum posts in the River. + * Fixed resizing tall non-square images. + * Non-English languages work when using memcache. + * User avatar menus work when switching filters on River Dashboard page. + * CSS is correctly cached for newly enabled plugins. + * Can no longer add bookmarks without a title. Previous bookmarks with + out titles can now be deleted. + + UI/UX Changes: + * Pages: Admin users can edit user-defined "Welcome page." + * Pages: Group "Welcome page" can be edited. + * User Validation: Added an admin section for unvalidated users. An + admin user can resend validation request, validate, or delete + unvalidated users. + + API Changes: + * test_ip() removed. + * is_ip_in_range() removed. + * Read/write DB connections can use different credentials. + * Twitter services plugin allows other plugins to tweet + if the user authorizes them. See twitterservice/README.txt + + +Version 1.7.3 +(September 2, 2010 from http://code.elgg.org/branches/1.7) + + Security enhancements: + * Fixed a security flaw that allowed an SQL injection attack + using crafted POSTs. Thanks to Georg-Christian Pranschke of + www.sensepost.com for the bug report. + + UI/UX Changes: + * Entering an invalid captcha now forwards to referring page. + + Bugfixes: + * Multiple owners support fixed for legacy get_entity*() functions. + * "Edit details" and "Edit profile icon" only show up for user's own + profile. + * get_objects_in_group() works correctly. + + Version 1.7.2 (August 18, 2010 from http://code.elgg.org/elgg/branches/1.7) diff --git a/LICENCE.txt b/LICENSE.txt index f833d881e..f833d881e 100644 --- a/LICENCE.txt +++ b/LICENSE.txt diff --git a/actions/admin/plugins/activate.php b/actions/admin/plugins/activate.php index e04ee6298..feb986b27 100644 --- a/actions/admin/plugins/activate.php +++ b/actions/admin/plugins/activate.php @@ -39,7 +39,12 @@ elgg_invalidate_simplecache(); elgg_filepath_cache_reset(); if (count($activated_guids) === 1) { - forward("admin/plugins/advanced#elgg-plugin-" . $plugin_guids[0]); + $url = 'admin/plugins'; + $query = (string)parse_url($_SERVER['HTTP_REFERER'], PHP_URL_QUERY); + if ($query) { + $url .= "?$query"; + } + forward($url . '#elgg-plugin-' . $plugin_guids[0]); } else { forward(REFERER); }
\ No newline at end of file diff --git a/actions/admin/plugins/activate_all.php b/actions/admin/plugins/activate_all.php index 0f0352877..19eb82142 100644 --- a/actions/admin/plugins/activate_all.php +++ b/actions/admin/plugins/activate_all.php @@ -1,21 +1,25 @@ <?php /** - * Activates all installed and inactive plugins. + * Activates all specified installed and inactive plugins. * - * All plugins in the mod/ directory are that aren't active are activated and the views + * All specified plugins in the mod/ directory are that aren't active are activated and the views * cache and simplecache are invalidated. * * @package Elgg.Core * @subpackage Administration.Plugins */ -$plugins = elgg_get_plugins('inactive'); +$guids = get_input('guids'); +$guids = explode(',', $guids); -foreach ($plugins as $plugin) { - if ($plugin->activate()) { - //system_message(elgg_echo('admin:plugins:activate:yes', array($plugin->getManifest()->getName()))); - } else { - register_error(elgg_echo('admin:plugins:activate:no', array($plugin->getManifest()->getName()))); +foreach ($guids as $guid) { + $plugin = get_entity($guid); + if (!$plugin->isActive()) { + if ($plugin->activate()) { + //system_message(elgg_echo('admin:plugins:activate:yes', array($plugin->getManifest()->getName()))); + } else { + register_error(elgg_echo('admin:plugins:activate:no', array($plugin->getManifest()->getName()))); + } } } diff --git a/actions/admin/plugins/deactivate.php b/actions/admin/plugins/deactivate.php index 9ec620e13..6c9a55c15 100644 --- a/actions/admin/plugins/deactivate.php +++ b/actions/admin/plugins/deactivate.php @@ -38,7 +38,12 @@ elgg_invalidate_simplecache(); elgg_filepath_cache_reset(); if (count($plugin_guids) == 1) { - forward("admin/plugins/advanced#elgg-plugin-" . $plugin_guids[0]); + $url = 'admin/plugins'; + $query = (string)parse_url($_SERVER['HTTP_REFERER'], PHP_URL_QUERY); + if ($query) { + $url .= "?$query"; + } + forward($url . '#elgg-plugin-' . $plugin_guids[0]); } else { forward(REFERER); } diff --git a/actions/admin/plugins/deactivate_all.php b/actions/admin/plugins/deactivate_all.php index 446cad8c0..436a3ad30 100644 --- a/actions/admin/plugins/deactivate_all.php +++ b/actions/admin/plugins/deactivate_all.php @@ -1,21 +1,25 @@ <?php /** - * Disable all installed plugins. + * Disable all specified installed plugins. * - * All plugins in the mod/ directory are disabled and the views cache and simplecache + * Specified plugins in the mod/ directory are disabled and the views cache and simplecache * are reset. * * @package Elgg.Core * @subpackage Administration.Plugins */ -$plugins = elgg_get_plugins('active'); +$guids = get_input('guids'); +$guids = explode(',', $guids); -foreach ($plugins as $plugin) { - if ($plugin->deactivate()) { - //system_message(elgg_echo('admin:plugins:deactivate:yes', array($plugin->getManifest()->getName()))); - } else { - register_error(elgg_echo('admin:plugins:deactivate:no', array($plugin->getManifest()->getName()))); +foreach ($guids as $guid) { + $plugin = get_entity($guid); + if ($plugin->isActive()) { + if ($plugin->deactivate()) { + //system_message(elgg_echo('admin:plugins:activate:yes', array($plugin->getManifest()->getName()))); + } else { + register_error(elgg_echo('admin:plugins:deactivate:no', array($plugin->getManifest()->getName()))); + } } } diff --git a/actions/avatar/crop.php b/actions/avatar/crop.php index ed5faecfa..9c57530ae 100644 --- a/actions/avatar/crop.php +++ b/actions/avatar/crop.php @@ -65,5 +65,8 @@ $owner->y1 = $y1; $owner->y2 = $y2; system_message(elgg_echo('avatar:crop:success')); +$view = 'river/user/default/profileiconupdate'; +elgg_delete_river(array('subject_guid' => $owner->guid, 'view' => $view)); +add_to_river($view, 'update', $owner->guid, $owner->guid); forward(REFERER); diff --git a/actions/avatar/upload.php b/actions/avatar/upload.php index 052212e97..e21aa49c8 100644 --- a/actions/avatar/upload.php +++ b/actions/avatar/upload.php @@ -50,6 +50,10 @@ foreach ($icon_sizes as $name => $size_info) { $owner->icontime = time(); if (elgg_trigger_event('profileiconupdate', $owner->type, $owner)) { system_message(elgg_echo("avatar:upload:success")); + + $view = 'river/user/default/profileiconupdate'; + elgg_delete_river(array('subject_guid' => $owner->guid, 'view' => $view)); + add_to_river($view, 'update', $owner->guid, $owner->guid); } forward(REFERER); diff --git a/engine/classes/ElggMenuItem.php b/engine/classes/ElggMenuItem.php index 61dbf539e..cd6267ad6 100644 --- a/engine/classes/ElggMenuItem.php +++ b/engine/classes/ElggMenuItem.php @@ -132,7 +132,7 @@ class ElggMenuItem { $item->setItemClass($options['item_class']); unset($options['item_class']); } - + foreach ($options as $key => $value) { $item->$key = $value; } @@ -153,9 +153,20 @@ class ElggMenuItem { public function getName() { return $this->name; } + + /** + * Set the display text of the menu item + * + * @param string $text The display text + * + * @return void + */ + public function setText($text) { + $this->text = $text; + } /** - * Get the display text of the menu + * Get the display text of the menu item * * @return string */ @@ -164,6 +175,15 @@ class ElggMenuItem { } /** + * Set the URL of the menu item + * + * @return void + */ + public function setHref($href) { + $this->href = $href; + } + + /** * Get the URL of the menu item * * @return string @@ -325,7 +345,16 @@ class ElggMenuItem { * @return string */ public function getItemClass() { - return implode(' ', $this->itemClass); + //allow people to specify name with underscores and colons + $name = str_replace('_', '-', $this->getName()); + $name = str_replace(':', '-', $name); + + $class = implode(' ', $this->itemClass); + if ($class) { + return "elgg-menu-item-$name $class"; + } else { + return "elgg-menu-item-$name"; + } } /** @@ -420,6 +449,17 @@ class ElggMenuItem { } /** + * Set the menu item's children + * + * @param array $children Array of ElggMenuItems + * + * @return void + */ + public function setChildren($children) { + $this->children = $children; + } + + /** * Get the children menu items * * @return array @@ -445,7 +485,7 @@ class ElggMenuItem { * @params array $vars Options to pass to output/url if a link * * @return string - * + * * @todo View code in a model. How do we feel about that? */ public function getContent(array $vars = array()) { @@ -455,7 +495,7 @@ class ElggMenuItem { } $vars['text'] = $this->text; - + if ($this->href) { $vars['href'] = $this->href; } @@ -463,15 +503,15 @@ class ElggMenuItem { if ($this->linkClass) { $vars['class'] = $this->getLinkClass(); } - + if ($this->rel) { $vars['rel'] = $this->rel; } - + if ($this->title) { $vars['title'] = $this->title; } - + if ($this->is_action) { $vars['is_action'] = $this->is_action; } diff --git a/engine/classes/ElggSite.php b/engine/classes/ElggSite.php index d3cb0d488..e3b8b8f1a 100644 --- a/engine/classes/ElggSite.php +++ b/engine/classes/ElggSite.php @@ -148,11 +148,20 @@ class ElggSite extends ElggEntity { * @return bool */ public function save() { + global $CONFIG; + // Save generic stuff if (!parent::save()) { return false; } + // make sure the site guid is set (if not, set to self) + if (!$this->get('site_guid')) { + $guid = $this->get('guid'); + update_data("UPDATE {$CONFIG->dbprefix}entities SET site_guid=$guid + WHERE guid=$guid"); + } + // Now save specific stuff return create_site_entity($this->get('guid'), $this->get('name'), $this->get('description'), $this->get('url')); @@ -400,7 +409,7 @@ class ElggSite extends ElggEntity { 'action/login', 'register', 'action/register', - 'pages/account/forgotten_password\.php', + 'forgotpassword', 'action/user/requestnewpassword', 'resetpassword', 'upgrade\.php', diff --git a/engine/lib/admin.php b/engine/lib/admin.php index 8016a2fd6..3bfb69102 100644 --- a/engine/lib/admin.php +++ b/engine/lib/admin.php @@ -183,7 +183,7 @@ function elgg_admin_notice_exists($id) { function elgg_register_admin_menu_item($section, $menu_id, $parent_id = NULL, $priority = 100) { // make sure parent is registered - if ($parent_id && !elgg_is_menu_item_registered($menu_id, $parent_id)) { + if ($parent_id && !elgg_is_menu_item_registered('page', $parent_id)) { elgg_register_admin_menu_item($section, $parent_id); } @@ -211,7 +211,7 @@ function elgg_register_admin_menu_item($section, $menu_id, $parent_id = NULL, $p } /** - * Initialise the admin backend. + * Initialize the admin backend. * * @return void */ @@ -262,11 +262,18 @@ function admin_init() { // configure // plugins - elgg_register_admin_menu_item('configure', 'plugins', null, 10); - elgg_register_admin_menu_item('configure', 'simple', 'plugins', 10); - elgg_register_admin_menu_item('configure', 'advanced', 'plugins', 20); + elgg_register_menu_item('page', array( + 'name' => 'plugins', + 'href' => 'admin/plugins', + 'text' => elgg_echo('admin:plugins'), + 'context' => 'admin', + 'priority' => 75, + 'section' => 'configure' + )); // settings + elgg_register_admin_menu_item('configure', 'appearance', null, 50); + elgg_register_admin_menu_item('configure', 'settings', null, 100); elgg_register_admin_menu_item('configure', 'basic', 'settings', 10); elgg_register_admin_menu_item('configure', 'advanced', 'settings', 20); elgg_register_admin_menu_item('configure', 'menu_items', 'appearance', 30); @@ -277,6 +284,11 @@ function admin_init() { // plugin settings are added in elgg_admin_add_plugin_settings_menu() via the admin page handler // for performance reasons. + // we want plugin settings menu items to be sorted alphabetical + if (elgg_in_context('admin')) { + elgg_register_plugin_hook_handler('prepare', 'menu:page', 'elgg_admin_sort_page_menu'); + } + if (elgg_is_admin_logged_in()) { elgg_register_menu_item('topbar', array( 'name' => 'administration', @@ -314,6 +326,7 @@ function admin_init() { * * @return void * @access private + * @since 1.8.0 */ function elgg_admin_add_plugin_settings_menu() { @@ -341,6 +354,33 @@ function elgg_admin_add_plugin_settings_menu() { } /** + * Sort the plugin settings menu items + * + * @param string $hook + * @param string $type + * @param array $return + * @param array $params + * + * @return void + * @since 1.8.0 + */ +function elgg_admin_sort_page_menu($hook, $type, $return, $params) { + $configure_items = $return['configure']; + foreach ($configure_items as $menu_item) { + if ($menu_item->getName() == 'settings') { + $settings = $menu_item; + } + } + + // keep the basic and advanced settings at the top + $children = $settings->getChildren(); + $site_settings = array_splice($children, 0, 2); + usort($children, array('ElggMenuBuilder', 'compareByText')); + array_splice($children, 0, 0, $site_settings); + $settings->setChildren($children); +} + +/** * Handles any set up required for administration pages * * @return void diff --git a/engine/lib/deprecated-1.8.php b/engine/lib/deprecated-1.8.php index 12398c8d5..d92257a09 100644 --- a/engine/lib/deprecated-1.8.php +++ b/engine/lib/deprecated-1.8.php @@ -208,6 +208,12 @@ function get_entities_from_annotations_calculate_x($sum = "sum", $entity_type = /** * Returns entities ordered by the sum of an annotation * + * @warning This is function uses sum instead of count. THIS IS SLOW. See #3366. + * This should be used when you have annotations with different values and you + * want a list of entities ordered by the sum of all of those values. + * If you want a list of entities ordered by the number of annotations on each entity, + * use __get_entities_from_annotations_calculate_x() and pass 'count' as the first param. + * * @deprecated 1.8 Use elgg_get_entities_from_annotation_calculation() * * @param string $entity_type Type of Entity @@ -4667,3 +4673,61 @@ function elgg_count_comments($entity) { return 0; } + +/** + * Removes all items relating to a particular acting entity from the river + * + * @param int $subject_guid The GUID of the entity + * + * @return bool Depending on success + * @deprecated 1.8 Use elgg_delete_river() + */ +function remove_from_river_by_subject($subject_guid) { + elgg_deprecated_notice("remove_from_river_by_subject() deprecated by elgg_delete_river()", 1.8); + + return elgg_delete_river(array('subject_guid' => $subject_guid)); +} + +/** + * Removes all items relating to a particular entity being acted upon from the river + * + * @param int $object_guid The GUID of the entity + * + * @return bool Depending on success + * @deprecated 1.8 Use elgg_delete_river() + */ +function remove_from_river_by_object($object_guid) { + elgg_deprecated_notice("remove_from_river_by_object() deprecated by elgg_delete_river()", 1.8); + + return elgg_delete_river(array('object_guid' => $object_guid)); +} + +/** + * Removes all items relating to a particular annotation being acted upon from the river + * + * @param int $annotation_id The ID of the annotation + * + * @return bool Depending on success + * @since 1.7.0 + * @deprecated 1.8 Use elgg_delete_river() + */ +function remove_from_river_by_annotation($annotation_id) { + elgg_deprecated_notice("remove_from_river_by_annotation() deprecated by elgg_delete_river()", 1.8); + + return elgg_delete_river(array('annotation_id' => $annotation_id)); +} + +/** + * Removes a single river entry + * + * @param int $id The ID of the river entry + * + * @return bool Depending on success + * @since 1.7.2 + * @deprecated 1.8 Use elgg_delete_river() + */ +function remove_from_river_by_id($id) { + elgg_deprecated_notice("remove_from_river_by_id() deprecated by elgg_delete_river()", 1.8); + + return elgg_delete_river(array('id' => $id)); +} diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index 170750849..df78515f2 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -1789,8 +1789,9 @@ function elgg_cacheable_view_page_handler($page, $type) { // translates to the url /js/calendars/jquery.fullcalendar.min.<ts>.js // and the view js/calendars/jquery.fullcalendar.min // we ignore the last two dots for the ts and the ext. + // Additionally, the timestamp is optional. $page = implode('/', $page); - $regex = '|(.+)\.([^\.]+)\.([^.]+)$|'; + $regex = '|(.+?)\.([\d]+\.)?\w+$|'; preg_match($regex, $page, $matches); $view = $matches[1]; $return = elgg_view("$type/$view"); @@ -2002,8 +2003,9 @@ function elgg_init() { elgg_register_menu_item('topbar', array( 'name' => 'elgg_logo', 'href' => 'http://www.elgg.org/', - 'text' => "<img src=\"$logo_url\" alt=\"Elgg logo\" />", + 'text' => "<img src=\"$logo_url\" alt=\"Elgg logo\" width=\"38\" height=\"20\" />", 'priority' => 1, + 'link_class' => 'elgg-topbar-logo', )); // Sets a blacklist of words in the current language. diff --git a/engine/lib/river.php b/engine/lib/river.php index c467a351c..36dde7f05 100644 --- a/engine/lib/river.php +++ b/engine/lib/river.php @@ -98,75 +98,107 @@ $posted = 0, $annotation_id = 0) { } /** - * Removes all items relating to a particular acting entity from the river + * Delete river items * - * @param int $subject_guid The GUID of the entity + * @warning not checking access (should we?) * - * @return bool Depending on success + * @param array $options + * ids => INT|ARR River item id(s) + * subject_guids => INT|ARR Subject guid(s) + * object_guids => INT|ARR Object guid(s) + * annotation_ids => INT|ARR The identifier of the annotation(s) + * action_types => STR|ARR The river action type(s) identifier + * views => STR|ARR River view(s) + * + * types => STR|ARR Entity type string(s) + * subtypes => STR|ARR Entity subtype string(s) + * type_subtype_pairs => ARR Array of type => subtype pairs where subtype + * can be an array of subtype strings + * + * posted_time_lower => INT The lower bound on the time posted + * posted_time_upper => INT The upper bound on the time posted + * + * @return bool + * @since 1.8.0 */ -function remove_from_river_by_subject($subject_guid) { - // Sanitise - $subject_guid = (int) $subject_guid; - - // Load config +function elgg_delete_river(array $options = array()) { global $CONFIG; - // Remove - return delete_data("delete from {$CONFIG->dbprefix}river where subject_guid = {$subject_guid}"); -} + $defaults = array( + 'ids' => ELGG_ENTITIES_ANY_VALUE, -/** - * Removes all items relating to a particular entity being acted upon from the river - * - * @param int $object_guid The GUID of the entity - * - * @return bool Depending on success - */ -function remove_from_river_by_object($object_guid) { - // Sanitise - $object_guid = (int) $object_guid; + 'subject_guids' => ELGG_ENTITIES_ANY_VALUE, + 'object_guids' => ELGG_ENTITIES_ANY_VALUE, + 'annotation_ids' => ELGG_ENTITIES_ANY_VALUE, - // Load config - global $CONFIG; + 'views' => ELGG_ENTITIES_ANY_VALUE, + 'action_types' => ELGG_ENTITIES_ANY_VALUE, - // Remove - return delete_data("delete from {$CONFIG->dbprefix}river where object_guid = {$object_guid}"); -} + 'types' => ELGG_ENTITIES_ANY_VALUE, + 'subtypes' => ELGG_ENTITIES_ANY_VALUE, + 'type_subtype_pairs' => ELGG_ENTITIES_ANY_VALUE, -/** - * Removes all items relating to a particular annotation being acted upon from the river - * - * @param int $annotation_id The ID of the annotation - * - * @return bool Depending on success - * @since 1.7.0 - */ -function remove_from_river_by_annotation($annotation_id) { - // Sanitise - $annotation_id = (int) $annotation_id; + 'posted_time_lower' => ELGG_ENTITIES_ANY_VALUE, + 'posted_time_upper' => ELGG_ENTITIES_ANY_VALUE, - // Load config - global $CONFIG; + 'wheres' => array(), + 'joins' => array(), - // Remove - return delete_data("delete from {$CONFIG->dbprefix}river where annotation_id = {$annotation_id}"); -} + ); -/** - * Removes a single river entry - * - * @param int $id The ID of the river entry - * - * @return bool Depending on success - * @since 1.7.2 - */ -function remove_from_river_by_id($id) { - global $CONFIG; + $options = array_merge($defaults, $options); - // Sanitise - $id = (int) $id; + $singulars = array('id', 'subject_guid', 'object_guid', 'annotation_id', 'action_type', 'view', 'type', 'subtype'); + $options = elgg_normalise_plural_options_array($options, $singulars); + + $wheres = $options['wheres']; + + $wheres[] = elgg_get_guid_based_where_sql('rv.id', $options['ids']); + $wheres[] = elgg_get_guid_based_where_sql('rv.subject_guid', $options['subject_guids']); + $wheres[] = elgg_get_guid_based_where_sql('rv.object_guid', $options['object_guids']); + $wheres[] = elgg_get_guid_based_where_sql('rv.annotation_id', $options['annotation_ids']); + $wheres[] = elgg_river_get_action_where_sql($options['action_types']); + $wheres[] = elgg_river_get_view_where_sql($options['views']); + $wheres[] = elgg_get_river_type_subtype_where_sql('rv', $options['types'], + $options['subtypes'], $options['type_subtype_pairs']); + + if ($options['posted_time_lower'] && is_int($options['posted_time_lower'])) { + $wheres[] = "rv.posted >= {$options['posted_time_lower']}"; + } + + if ($options['posted_time_upper'] && is_int($options['posted_time_upper'])) { + $wheres[] = "rv.posted <= {$options['posted_time_upper']}"; + } + + // remove identical where clauses + $wheres = array_unique($wheres); - return delete_data("delete from {$CONFIG->dbprefix}river where id = {$id}"); + // see if any functions failed + // remove empty strings on successful functions + foreach ($wheres as $i => $where) { + if ($where === FALSE) { + return FALSE; + } elseif (empty($where)) { + unset($wheres[$i]); + } + } + + $query = "DELETE rv.* FROM {$CONFIG->dbprefix}river rv "; + + // add joins + foreach ($joins as $j) { + $query .= " $j "; + } + + // add wheres + $query .= ' WHERE '; + + foreach ($wheres as $w) { + $query .= " $w AND "; + } + $query .= "1=1"; + + return delete_data($query); } /** @@ -482,7 +514,7 @@ function elgg_river_get_action_where_sql($types) { if (!is_array($types)) { $types = sanitise_string($types); - return "'(rv.action_type = '$types')"; + return "(rv.action_type = '$types')"; } // sanitize types array @@ -496,6 +528,35 @@ function elgg_river_get_action_where_sql($types) { } /** + * Get the where clause based on river view strings + * + * @param array $types Array of view strings + * + * @return string + * @since 1.8.0 + * @access private + */ +function elgg_river_get_view_where_sql($views) { + if (!$views) { + return ''; + } + + if (!is_array($views)) { + $views = sanitise_string($views); + return "(rv.view = '$views')"; + } + + // sanitize views array + $views_sanitized = array(); + foreach ($views as $view) { + $views_sanitized[] = sanitise_string($view); + } + + $view_str = implode("','", $views_sanitized); + return "(rv.view IN ('$view_str'))"; +} + +/** * Sets the access ID on river items for a particular object * * @param int $object_guid The GUID of the entity diff --git a/engine/lib/upgrades/2011052801.php b/engine/lib/upgrades/2011052801.php new file mode 100644 index 000000000..8084bc06c --- /dev/null +++ b/engine/lib/upgrades/2011052801.php @@ -0,0 +1,45 @@ +<?php +/** + * Make sure all users have the relationship member_of_site + */ +global $DB_QUERY_CACHE, $DB_PROFILE, $ENTITY_CACHE, $CONFIG; +$db_prefix = get_config('dbprefix'); + +$limit = 100; + +$q = "SELECT e.* FROM {$db_prefix}entities e + WHERE e.type = 'user' AND e.guid NOT IN ( + SELECT guid_one FROM {$db_prefix}entity_relationships + WHERE guid_two = 1 AND relationship = 'member_of_site' + ) + LIMIT $limit"; + +$users = get_data($q); + +while ($users) { + $DB_QUERY_CACHE = $DB_PROFILE = $ENTITY_CACHE = array(); + + // do manually to not trigger any events because these aren't new users. + foreach ($users as $user) { + $rel_q = "INSERT INTO {$db_prefix}entity_relationships VALUES ( + '', + '$user->guid', + 'member_of_site', + '$user->site_guid', + '$user->time_created' + )"; + + insert_data($rel_q); + } + + // every time we run this query we've just reduced the rows it returns by $limit + // so don't pass an offset. + $q = "SELECT e.* FROM {$db_prefix}entities e + WHERE e.type = 'user' AND e.guid NOT IN ( + SELECT guid_one FROM {$db_prefix}entity_relationships + WHERE guid_two = 1 AND relationship = 'member_of_site' + ) + LIMIT $limit"; + + $users = get_data($q); +}
\ No newline at end of file diff --git a/engine/lib/upgrades/2011061200-1.8b1-sites_need_a_site_guid-6d9dcbf46c0826cc.php b/engine/lib/upgrades/2011061200-1.8b1-sites_need_a_site_guid-6d9dcbf46c0826cc.php new file mode 100644 index 000000000..4fc59ac41 --- /dev/null +++ b/engine/lib/upgrades/2011061200-1.8b1-sites_need_a_site_guid-6d9dcbf46c0826cc.php @@ -0,0 +1,30 @@ +<?php +/** + * Elgg 1.8b1 upgrade 2011061200 + * sites_need_a_site_guid + * + * Sites did not have a site guid. This causes problems with getting + * metadata on site objects since we default to the current site. + */ + +global $CONFIG; + +$ia = elgg_set_ignore_access(true); +$access_status = access_get_show_hidden_status(); +access_show_hidden_entities(true); + +$options = array( + 'type' => 'site', + 'site_guid' => 0, +); +$batch = new ElggBatch('elgg_get_entities', $options); + +foreach ($batch as $entity) { + if (!$entity->site_guid) { + update_data("UPDATE {$CONFIG->dbprefix}entities SET site_guid=$entity->guid + WHERE guid=$entity->guid"); + } +} + +access_show_hidden_entities($access_status); +elgg_set_ignore_access($ia); diff --git a/engine/lib/users.php b/engine/lib/users.php index a7765a5e5..59bfa1259 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -748,40 +748,6 @@ function execute_new_password_request($user_guid, $conf_code) { } /** - * Handles pages for password reset requests. - * - * @param array $page Pages array - * - * @return void - */ -function elgg_user_resetpassword_page_handler($page) { - - $user_guid = get_input('u'); - $code = get_input('c'); - - $user = get_entity($user_guid); - - // don't check code here to avoid automated attacks - if (!$user instanceof ElggUser) { - register_error(elgg_echo('user:passwordreset:unknown_user')); - forward(); - } - - $params = array( - 'guid' => $user_guid, - 'code' => $code, - ); - $form = elgg_view_form('user/passwordreset', array(), $params); - - $title = elgg_echo('resetpassword'); - $content = elgg_view_title(elgg_echo('resetpassword')) . $form; - - $body = elgg_view_layout('one_column', array('content' => $content)); - - echo elgg_view_page($title, $body); -} - -/** * Simple function that will generate a random clear text password * suitable for feeding into generate_user_password(). * @@ -1129,14 +1095,27 @@ function collections_page_handler($page_elements) { } /** - * Page handler for registration + * Page handler for account related pages * - * @param array $page_elements Page elements + * @param array $page_elements Page elements + * @param string $handler The handler string * * @return void */ -function registration_page_handler($page_elements) { - require_once(dirname(dirname(dirname(__FILE__))) . "/pages/account/register.php"); +function elgg_user_account_page_handler($page_elements, $handler) { + + $base_dir = elgg_get_root_path() . 'pages/account'; + switch ($handler) { + case 'forgotpassword': + require_once("$base_dir/forgotten_password.php"); + break; + case 'resetpassword': + require_once("$base_dir/reset_password.php"); + break; + case 'register': + require_once("$base_dir/register.php"); + break; + } } /** @@ -1345,7 +1324,7 @@ function elgg_profile_fields_setup() { $profile_defaults = array ( 'description' => 'longtext', 'briefdescription' => 'text', - 'location' => 'tags', + 'location' => 'location', 'interests' => 'tags', 'skills' => 'tags', 'contactemail' => 'email', @@ -1379,7 +1358,7 @@ function elgg_profile_fields_setup() { // register any tag metadata names foreach ($CONFIG->profile_fields as $name => $type) { - if ($type == 'tags') { + if ($type == 'tags' || $type == 'location' || $type == 'tag') { elgg_register_tag_metadata_name($name); // register a tag name translation add_translation(get_current_language(), array("tag_names:$name" => elgg_echo("profile:$name"))); @@ -1474,6 +1453,7 @@ function users_pagesetup() { 'href' => $user->getURL(), 'text' => "<img src=\"$icon_url\" alt=\"$user->name\" title=\"$title\" class=\"$class\" />", 'priority' => 100, + 'link_class' => 'elgg-topbar-avatar', )); elgg_register_menu_item('topbar', array( @@ -1513,8 +1493,9 @@ function users_init() { elgg_register_page_handler('friends', 'friends_page_handler'); elgg_register_page_handler('friendsof', 'friends_of_page_handler'); - elgg_register_page_handler('register', 'registration_page_handler'); - elgg_register_page_handler('resetpassword', 'elgg_user_resetpassword_page_handler'); + elgg_register_page_handler('register', 'elgg_user_account_page_handler'); + elgg_register_page_handler('forgotpassword', 'elgg_user_account_page_handler'); + elgg_register_page_handler('resetpassword', 'elgg_user_account_page_handler'); elgg_register_page_handler('login', 'elgg_user_login_page_handler'); elgg_register_page_handler('avatar', 'elgg_avatar_page_handler'); elgg_register_page_handler('profile', 'elgg_profile_page_handler'); @@ -26,9 +26,6 @@ if (elgg_is_logged_in()) { $content = elgg_view_title(elgg_echo('content:latest')); $content .= elgg_list_river(); -global $autofeed; -$autofeed = FALSE; - $login_box = elgg_view('core/account/login_box'); $params = array( diff --git a/install/css/install.css b/install/css/install.css index b1a038d1b..e7290c130 100644 --- a/install/css/install.css +++ b/install/css/install.css @@ -108,7 +108,7 @@ ul { margin-bottom: 40px; } -.install-nav { +.elgg-install-nav { width: 100%; text-align: right; position: absolute; @@ -213,7 +213,7 @@ select { padding-bottom: 50px; } -.install-nav a { +.elgg-install-nav a { font-family: Arial, Helvetica, sans-serif; font-size: 16px; font-weight: bold; @@ -231,12 +231,13 @@ select { float: right; } -.install-nav a:hover { +.elgg-install-nav a:hover { text-decoration: none; background: #0054a7; border: 4px solid #0054a7; } -.install-nav .disabled, .install-nav .disabled:hover { +.elgg-install-nav .elgg-state-disabled, +.elgg-install-nav .elgg-state-disabled:hover { background: #555555; border-color: #555555; cursor: default; diff --git a/languages/en.php b/languages/en.php index cbe229c26..7649bcbc3 100644 --- a/languages/en.php +++ b/languages/en.php @@ -344,8 +344,6 @@ $english = array( 'friends:collections:members' => "Collection members", 'friends:collections:edit' => "Edit collection", - 'river:friend:user:default' => "%s is now a friend with %s", - 'friendspicker:chararray' => 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'avatar' => 'Avatar', @@ -377,7 +375,7 @@ $english = array( 'profile:twitter' => "Twitter username", 'profile:saved' => "Your profile was successfully saved.", - 'admin:appearance:profile_fields' => 'Edit profile fields', + 'admin:appearance:profile_fields' => 'Edit Profile Fields', 'profile:edit:default' => 'Edit profile fields', 'profile:label' => "Profile label", 'profile:type' => "Profile type", @@ -385,7 +383,7 @@ $english = array( 'profile:editdefault:delete:success' => 'Default profile item deleted!', 'profile:defaultprofile:reset' => 'Default system profile reset', 'profile:resetdefault' => 'Reset default profile', - 'profile:explainchangefields' => "You can replace the existing profile fields with your own using the form below. \n\n Give the new profile field a label, for example, 'Favorite team', then select the field type (eg. text, url, tags), and click the 'Add' button. To re-order the fields drag on the handle next to the field label. To edit a field label - click on the label's text to make it editable. \n\n At any time you can revert back to the default profile set up, but you will loose any information already entered into custom fields on profile pages.", + 'profile:explainchangefields' => "You can replace the existing profile fields with your own using the form below. \n\n Give the new profile field a label, for example, 'Favorite team', then select the field type (eg. text, url, tags), and click the 'Add' button. To re-order the fields drag on the handle next to the field label. To edit a field label - click on the label's text to make it editable. \n\n At any time you can revert back to the default profile set up, but you will lose any information already entered into custom fields on profile pages.", 'profile:editdefault:success' => 'Item successfully added to default profile', 'profile:editdefault:fail' => 'Default profile could not be saved', @@ -406,6 +404,8 @@ $english = array( */ 'river' => "River", 'river:relationship:friend' => 'is now friends with', + 'friends:river:add' => "is now a friend with %s", + 'profile:river:iconupdate' => 'updated their profile icon', 'river:noaccess' => 'You do not have permission to view this item.', 'river:posted:generic' => '%s posted', 'riveritem:single:user' => 'a user', @@ -594,6 +594,8 @@ $english = array( 'admin:footer:blog' => 'Elgg Blog', 'admin:plugins:category:all' => 'All plugins', + 'admin:plugins:category:active' => 'Active plugins', + 'admin:plugins:category:inactive' => 'Inactive plugins', 'admin:plugins:category:admin' => 'Admin', 'admin:plugins:category:bundled' => 'Bundled', 'admin:plugins:category:content' => 'Content', @@ -607,6 +609,10 @@ $english = array( 'admin:plugins:category:theme' => 'Themes', 'admin:plugins:category:widget' => 'Widgets', + 'admin:plugins:sort:priority' => 'Priority', + 'admin:plugins:sort:alpha' => 'Alphabetical', + 'admin:plugins:sort:date' => 'Newest', + 'admin:plugins:markdown:unknown_plugin' => 'Unknown plugin.', 'admin:plugins:markdown:unknown_file' => 'Unknown file.', @@ -715,7 +721,7 @@ $english = array( 'admin:appearance:default_widgets' => 'Default Widgets', 'admin:default_widgets:unknown_type' => 'Unknown widget type', 'admin:default_widgets:instructions' => 'Add, remove, position, and configure default widgets for the selected widget page.' - . ' These changes will apply only to new content on the site.', + . ' These changes will only affect new users on the site.', /** * User settings @@ -769,6 +775,7 @@ $english = array( 'cancel' => "Cancel", 'saving' => "Saving ...", 'update' => "Update", + 'preview' => "Preview", 'edit' => "Edit", 'delete' => "Delete", 'accept' => "Accept", diff --git a/mod/blog/actions/blog/save.php b/mod/blog/actions/blog/save.php index c42845037..8be67ec6c 100644 --- a/mod/blog/actions/blog/save.php +++ b/mod/blog/actions/blog/save.php @@ -8,6 +8,9 @@ // start a new sticky form session in case of failure elgg_make_sticky_form('blog'); +// save or preview +$save = (bool)get_input('save'); + // store errors to pass along $error = FALSE; $error_forward_url = REFERER; @@ -106,6 +109,11 @@ foreach ($values as $name => $default) { } } +// if preview, force status to be draft +if ($save == false) { + $values['status'] = 'draft'; +} + // assign values to the entity, stopping on error. if (!$error) { foreach ($values as $name => $value) { @@ -148,12 +156,13 @@ if (!$error) { $blog->save(); } } elseif ($old_status == 'published' && $status == 'draft') { - $q = "DELETE FROM {$db_prefix}river - WHERE object_guid = $blog->guid AND action_type = 'create'"; - delete_data($q); + elgg_delete_river(array( + 'object_guid' => $blog->guid, + 'action_type' => 'create', + )); } - if ($blog->status == 'published') { + if ($blog->status == 'published' || $save == false) { forward($blog->getURL()); } else { forward("blog/edit/$blog->guid"); diff --git a/mod/blog/views/default/forms/blog/save.php b/mod/blog/views/default/forms/blog/save.php index b2d20579f..d99f45f01 100644 --- a/mod/blog/views/default/forms/blog/save.php +++ b/mod/blog/views/default/forms/blog/save.php @@ -5,6 +5,8 @@ * @package Blog */ +$blog = get_entity($vars['guid']); + $draft_warning = $vars['draft_warning']; if ($draft_warning) { $draft_warning = '<span class="message warning">' . $draft_warning . '</span>'; @@ -12,6 +14,7 @@ if ($draft_warning) { $action_buttons = ''; $delete_link = ''; +$preview_button = ''; if ($vars['guid']) { // add a delete button if editing @@ -19,12 +22,24 @@ if ($vars['guid']) { $delete_link = elgg_view('output/confirmlink', array( 'href' => $delete_url, 'text' => elgg_echo('delete'), - 'class' => 'elgg-button elgg-button-delete elgg-state-disabled' + 'class' => 'elgg-button elgg-button-delete elgg-state-disabled float-alt' )); } -$save_button = elgg_view('input/submit', array('value' => elgg_echo('save'))); -$action_buttons = $save_button . $delete_link; +// published blogs do not get the preview button +if (!$vars['guid'] || ($blog && $blog->status != 'published')) { + $preview_button = elgg_view('input/submit', array( + 'value' => elgg_echo('preview'), + 'name' => 'preview', + 'class' => 'mls', + )); +} + +$save_button = elgg_view('input/submit', array( + 'value' => elgg_echo('save'), + 'name' => 'save', +)); +$action_buttons = $save_button . $preview_button . $delete_link; $title_label = elgg_echo('title'); $title_input = elgg_view('input/text', array( @@ -135,13 +150,15 @@ $body_input $categories_input -<div class="elgg-subtext pvm mbn elgg-divide-top"> +<div class="elgg-form-footer-alt"> + <div class="elgg-subtext mbm"> $save_status <span class="blog-save-status-time">$saved</span> -</div> + </div> -$guid_input -$container_guid_input + $guid_input + $container_guid_input -$action_buttons + $action_buttons +</div> ___HTML; diff --git a/mod/blog/views/default/object/blog.php b/mod/blog/views/default/object/blog.php index 048a68a1a..8456829fe 100644 --- a/mod/blog/views/default/object/blog.php +++ b/mod/blog/views/default/object/blog.php @@ -74,7 +74,7 @@ if ($full) { 'subtitle' => $subtitle, 'tags' => $tags, ); - $list_body = elgg_view('page/components/summary', $params); + $list_body = elgg_view('object/elements/summary', $params); $blog_info = elgg_view_image_block($owner_icon, $list_body); @@ -94,7 +94,7 @@ HTML; 'tags' => $tags, 'content' => $excerpt, ); - $list_body = elgg_view('page/components/summary', $params); + $list_body = elgg_view('object/elements/summary', $params); echo elgg_view_image_block($owner_icon, $list_body); } diff --git a/mod/bookmarks/views/default/object/bookmarks.php b/mod/bookmarks/views/default/object/bookmarks.php index ab00e23c6..38b0a721a 100644 --- a/mod/bookmarks/views/default/object/bookmarks.php +++ b/mod/bookmarks/views/default/object/bookmarks.php @@ -65,7 +65,7 @@ if ($full && !elgg_in_context('gallery')) { 'subtitle' => $subtitle, 'tags' => $tags, ); - $list_body = elgg_view('page/components/summary', $params); + $list_body = elgg_view('object/elements/summary', $params); $bookmark_info = elgg_view_image_block($owner_icon, $list_body); $bookmark_icon = elgg_view_icon('push-pin-alt'); @@ -119,6 +119,6 @@ HTML; 'content' => $content, ); - $body = elgg_view('page/components/summary', $params); + $body = elgg_view('object/elements/summary', $params); echo elgg_view_image_block($owner_icon, $body); }
\ No newline at end of file diff --git a/mod/categories/views/default/settings/categories/edit.php b/mod/categories/views/default/settings/categories/edit.php index 583292e72..3802da95a 100644 --- a/mod/categories/views/default/settings/categories/edit.php +++ b/mod/categories/views/default/settings/categories/edit.php @@ -14,8 +14,9 @@ if (empty($categories)) { } ?> -<p> - <?php echo elgg_echo('categories:explanation'); ?> -</p> +<div> + <p><?php echo elgg_echo('categories:explanation'); ?></p> <?php -echo elgg_view('input/tags', array('value' => $categories, 'name' => 'categories')); + echo elgg_view('input/tags', array('value' => $categories, 'name' => 'categories')); +?> +</div>
\ No newline at end of file diff --git a/mod/custom_index/index.php b/mod/custom_index/index.php index 94a1a16c6..e39e6ef29 100644 --- a/mod/custom_index/index.php +++ b/mod/custom_index/index.php @@ -60,4 +60,8 @@ $params = array( ); $body = elgg_view_layout('custom_index', $params); +// no RSS feed with a "widget" front page +global $autofeed; +$autofeed = FALSE; + echo elgg_view_page('', $body); diff --git a/mod/dashboard/start.php b/mod/dashboard/start.php index 4fa048b3d..9de1ee4af 100644 --- a/mod/dashboard/start.php +++ b/mod/dashboard/start.php @@ -8,6 +8,8 @@ elgg_register_event_handler('init', 'system', 'dashboard_init'); function dashboard_init() { elgg_register_page_handler('dashboard', 'dashboard_page_handler'); + elgg_extend_view('css/elgg', 'dashboard/css'); + elgg_register_menu_item('topbar', array( 'name' => 'dashboard', 'href' => 'dashboard', diff --git a/mod/dashboard/views/default/dashboard/blurb.php b/mod/dashboard/views/default/dashboard/blurb.php index 202be1dc5..9293e513a 100644 --- a/mod/dashboard/views/default/dashboard/blurb.php +++ b/mod/dashboard/views/default/dashboard/blurb.php @@ -9,7 +9,7 @@ <?php echo elgg_view('output/longtext', array( 'id' => 'dashboard-info', - 'class' => 'elgg-inner elgg-border-plain pam mhs mbl mtn', + 'class' => 'elgg-inner pam mhs mtn', 'value' => elgg_echo("dashboard:nowidgets"), )); diff --git a/mod/dashboard/views/default/dashboard/css.php b/mod/dashboard/views/default/dashboard/css.php new file mode 100644 index 000000000..f49293293 --- /dev/null +++ b/mod/dashboard/views/default/dashboard/css.php @@ -0,0 +1,10 @@ +<?php +/** + * User dashboard CSS + */ +?> + +#dashboard-info { + border: 2px solid #dedede; + margin-bottom: 15px; +} diff --git a/mod/developers/languages/en.php b/mod/developers/languages/en.php index 26deb5fcf..53a9cd686 100644 --- a/mod/developers/languages/en.php +++ b/mod/developers/languages/en.php @@ -27,6 +27,8 @@ $english = array( 'developers:debug:notice' => 'Notice', // theme preview + 'theme_preview:general' => 'Introduction', + 'theme_preview:breakout' => 'Break out of iframe', 'theme_preview:buttons' => 'Buttons', 'theme_preview:components' => 'Components', 'theme_preview:forms' => 'Forms', diff --git a/mod/developers/views/default/theme_preview/general.php b/mod/developers/views/default/theme_preview/general.php new file mode 100644 index 000000000..1a0b54c88 --- /dev/null +++ b/mod/developers/views/default/theme_preview/general.php @@ -0,0 +1,22 @@ +<?php +/** + * Quick introduction to the theme preview + * + * @todo links to resources? + */ +?> + +<p>This theme preview provides a visual catalog for many of the theming elements + that Elgg uses. The primary css selector is listed with each theme element. + The preview is divided into sections that are listed in the page menu + (usually in the sidebar but depends on your current theme). +</p> +<p> +<?php + echo elgg_view('output/url', array( + 'text' => elgg_echo('theme_preview:breakout'), + 'href' => current_page_url(), + 'target' => '_parent', + )); +?> +</p> diff --git a/mod/diagnostics/languages/en.php b/mod/diagnostics/languages/en.php index 0b90957f9..6d71945e3 100644 --- a/mod/diagnostics/languages/en.php +++ b/mod/diagnostics/languages/en.php @@ -7,7 +7,7 @@ $english = array( - 'admin:utilities:diagnostics' => 'System diagnostics', + 'admin:utilities:diagnostics' => 'System Diagnostics', 'diagnostics' => 'System diagnostics', 'diagnostics:report' => 'Diagnostics Report', 'diagnostics:unittester' => 'Unit Tests', diff --git a/mod/diagnostics/manifest.xml b/mod/diagnostics/manifest.xml index 7821d128d..e85b19aef 100644 --- a/mod/diagnostics/manifest.xml +++ b/mod/diagnostics/manifest.xml @@ -4,7 +4,7 @@ <author>Core developers</author> <version>1.8</version> <category>bundled</category> - <category>developer</category> + <category>development</category> <category>admin</category> <description>Elgg diagnostics tool</description> <website>http://www.elgg.org/</website> diff --git a/mod/embed/views/default/embed/item/list.php b/mod/embed/views/default/embed/item/list.php index 232f0558b..89a2ffb63 100644 --- a/mod/embed/views/default/embed/item/list.php +++ b/mod/embed/views/default/embed/item/list.php @@ -54,7 +54,7 @@ $params = array( 'subtitle' => $subtitle, 'tags' => FALSE, ); -$list_body = elgg_view('page/components/summary', $params); +$list_body = elgg_view('object/elements/summary', $params); // @todo JS 1.8: is this approach better than inline js? echo "<div class=\"embed_data\" id=\"embed_{$item->getGUID()}\">" . elgg_view_image_block($item_icon, $list_body) . '</div>'; diff --git a/mod/externalpages/languages/en.php b/mod/externalpages/languages/en.php index 196a04c0b..5f0f4ad7b 100644 --- a/mod/externalpages/languages/en.php +++ b/mod/externalpages/languages/en.php @@ -9,7 +9,7 @@ $english = array( * Menu items and titles */ 'expages' => "Site pages", - 'admin:appearance:expages' => "Site pages", + 'admin:appearance:expages' => "Site Pages", 'expages:about' => "About", 'expages:terms' => "Terms", 'expages:privacy' => "Privacy", diff --git a/mod/externalpages/views/default/forms/expages/edit.php b/mod/externalpages/views/default/forms/expages/edit.php index 58c174d6e..b0060477e 100644 --- a/mod/externalpages/views/default/forms/expages/edit.php +++ b/mod/externalpages/views/default/forms/expages/edit.php @@ -45,11 +45,13 @@ $external_page_title = elgg_echo("expages:$type"); //construct the form echo <<<EOT -<h3 class="mvm">$external_page_title</h3> -<div>$input_area</div> - $hidden_value - $hidden_type - $submit_input +<div class="mtm"> + <label>$external_page_title</label> + $input_area +</div> +$hidden_value +$hidden_type +$submit_input EOT; diff --git a/mod/file/actions/file/upload.php b/mod/file/actions/file/upload.php index 5d5c28bee..c5fe763cb 100644 --- a/mod/file/actions/file/upload.php +++ b/mod/file/actions/file/upload.php @@ -106,9 +106,10 @@ if (isset($_FILES['upload']['name']) && !empty($_FILES['upload']['name'])) { $file->originalfilename = $_FILES['upload']['name']; $file->simpletype = file_get_simple_type($_FILES['upload']['type']); + // Open the file to guarantee the directory exists $file->open("write"); - $file->write(get_uploaded_file('upload')); $file->close(); + move_uploaded_file($_FILES['upload']['tmp_name'], $file->getFilenameOnFilestore()); $guid = $file->save(); diff --git a/mod/file/download.php b/mod/file/download.php index a386d490f..8e0287a1e 100644 --- a/mod/file/download.php +++ b/mod/file/download.php @@ -33,8 +33,7 @@ if (strpos($mime, "image/") !== false) { header("Content-Disposition: attachment; filename=\"$filename\""); } -$contents = $file->grabFile(); -$splitString = str_split($contents, 8192); -foreach ($splitString as $chunk) { - echo $chunk; -} +ob_clean(); +flush(); +readfile($file->getFilenameOnFilestore()); +exit; diff --git a/mod/file/pages/file/view.php b/mod/file/pages/file/view.php index daa2a400e..45e112d4d 100644 --- a/mod/file/pages/file/view.php +++ b/mod/file/pages/file/view.php @@ -25,11 +25,17 @@ elgg_push_breadcrumb($title); $content = elgg_view_entity($file, true); $content .= elgg_view_comments($file); +$download = elgg_view('output/url', array( + 'href' => "mod/file/download.php?file_guid=$file->guid", + 'text' => elgg_echo("file:download"), + 'class' => 'elgg-button elgg-button-action float-alt', +)); + $body = elgg_view_layout('content', array( 'content' => $content, 'title' => $title, 'filter' => '', - 'header' => '', + 'buttons' => $download, )); echo elgg_view_page($title, $body); diff --git a/mod/file/views/default/forms/file/upload.php b/mod/file/views/default/forms/file/upload.php index 001e66674..b8a7a1668 100644 --- a/mod/file/views/default/forms/file/upload.php +++ b/mod/file/views/default/forms/file/upload.php @@ -16,8 +16,10 @@ $ajax = elgg_extract('ajax', $vars, FALSE); if ($guid) { $file_label = elgg_echo("file:replace"); + $submit_label = elgg_echo('save'); } else { $file_label = elgg_echo("file:file"); + $submit_label = elgg_echo('upload'); } ?> @@ -63,7 +65,7 @@ if ($guid) { echo elgg_view('input/hidden', array('name' => 'file_guid', 'value' => $guid)); } -echo elgg_view('input/submit', array('value' => elgg_echo("save"))); +echo elgg_view('input/submit', array('value' => $submit_label)); ?> </div> diff --git a/mod/file/views/default/object/file.php b/mod/file/views/default/object/file.php index 0b58ca76f..c6ac2a429 100644 --- a/mod/file/views/default/object/file.php +++ b/mod/file/views/default/object/file.php @@ -67,12 +67,6 @@ if ($full && !elgg_in_context('gallery')) { $extra = elgg_view("file/specialcontent/$base_type/default", $vars); } - $download = elgg_view('output/url', array( - 'href' => "mod/file/download.php?file_guid=$file->guid", - 'text' => elgg_echo("file:download"), - 'class' => 'elgg-button elgg-button-action', - )); - $header = elgg_view_title($file->title); $params = array( @@ -82,17 +76,15 @@ if ($full && !elgg_in_context('gallery')) { 'subtitle' => $subtitle, 'tags' => $tags, ); - $list_body = elgg_view('page/components/summary', $params); + $list_body = elgg_view('object/elements/summary', $params); $file_info = elgg_view_image_block($file_icon, $list_body); echo <<<HTML -$header $file_info <div class="file elgg-content"> $body $extra - <p>$download</p> </div> HTML; @@ -112,7 +104,7 @@ HTML; 'tags' => $tags, 'content' => $excerpt, ); - $list_body = elgg_view('page/components/summary', $params); + $list_body = elgg_view('object/elements/summary', $params); echo elgg_view_image_block($file_icon, $list_body); } diff --git a/mod/garbagecollector/views/default/settings/garbagecollector/edit.php b/mod/garbagecollector/views/default/settings/garbagecollector/edit.php index a0f9677a0..3ade780f9 100644 --- a/mod/garbagecollector/views/default/settings/garbagecollector/edit.php +++ b/mod/garbagecollector/views/default/settings/garbagecollector/edit.php @@ -9,9 +9,9 @@ $period = $vars['entity']->period; if (!$period) { $period = 'monthly'; } - + ?> -<p> +<div> <?php echo elgg_echo('garbagecollector:period'); ?> <?php @@ -25,4 +25,4 @@ if (!$period) { 'value' => $period )); ?> -</p> +</div> diff --git a/mod/groups/actions/groups/delete.php b/mod/groups/actions/groups/delete.php index 932d03355..2ff6c339c 100644 --- a/mod/groups/actions/groups/delete.php +++ b/mod/groups/actions/groups/delete.php @@ -3,7 +3,12 @@ * Delete a group */ -$guid = (int) get_input('group_guid'); +$guid = (int) get_input('guid'); +if (!$guid) { + // backward compatible + elgg_deprecated_notice("Use 'guid' for group delete action", 1.8); + $guid = (int)get_input('group_guid'); +} $entity = get_entity($guid); if (!$entity->canEdit()) { diff --git a/mod/groups/actions/groups/membership/remove.php b/mod/groups/actions/groups/membership/remove.php new file mode 100644 index 000000000..650d35286 --- /dev/null +++ b/mod/groups/actions/groups/membership/remove.php @@ -0,0 +1,31 @@ +<?php +/** + * Remove a user from a group + * + * @package ElggGroups + */ + +$user_guid = get_input('user_guid'); +$group_guid = get_input('group_guid'); + +$user = get_entity($user_guid); +$group = get_entity($group_guid); + +elgg_set_page_owner_guid($group->guid); + +if (($user instanceof ElggUser) && ($group instanceof ElggGroup) && $group->canEdit()) { + // Don't allow removing group owner + if ($group->getOwnerGUID() != $user->getGUID()) { + if ($group->leave($user)) { + system_message(elgg_echo("groups:removed", array($user->name))); + } else { + register_error(elgg_echo("groups:cantremove")); + } + } else { + register_error(elgg_echo("groups:cantremove")); + } +} else { + register_error(elgg_echo("groups:cantremove")); +} + +forward(REFERER); diff --git a/mod/groups/languages/en.php b/mod/groups/languages/en.php index 1afd42e86..9f8bed9a4 100644 --- a/mod/groups/languages/en.php +++ b/mod/groups/languages/en.php @@ -166,6 +166,9 @@ $english = array( 'groups:notitle' => 'Groups must have a title', 'groups:cantjoin' => 'Can not join group', 'groups:cantleave' => 'Could not leave group', + 'groups:removeuser' => 'Remove from group', + 'groups:cantremove' => 'Cannot remove user from group', + 'groups:removed' => 'Successfully removed %s from group', 'groups:addedtogroup' => 'Successfully added the user to the group', 'groups:joinrequestnotmade' => 'Could not request to join group', 'groups:joinrequestmade' => 'Requested to join group', diff --git a/mod/groups/start.php b/mod/groups/start.php index 5aaba017c..066b309a5 100644 --- a/mod/groups/start.php +++ b/mod/groups/start.php @@ -44,6 +44,7 @@ function groups_init() { elgg_register_action("groups/invite", "$action_base/invite.php"); elgg_register_action("groups/join", "$action_base/join.php"); elgg_register_action("groups/leave", "$action_base/leave.php"); + elgg_register_action("groups/remove", "$action_base/remove.php"); elgg_register_action("groups/killrequest", "$action_base/delete_request.php"); elgg_register_action("groups/killinvitation", "$action_base/delete_invite.php"); elgg_register_action("groups/addtogroup", "$action_base/add.php"); @@ -60,6 +61,9 @@ function groups_init() { // group entity menu elgg_register_plugin_hook_handler('register', 'menu:entity', 'groups_entity_menu_setup'); + + // group user hover menu + elgg_register_plugin_hook_handler('register', 'menu:user_hover', 'groups_user_entity_menu_setup'); //extend some views elgg_extend_view('css/elgg', 'groups/css'); @@ -367,6 +371,44 @@ function groups_entity_menu_setup($hook, $type, $return, $params) { } /** + * Add a remove user link to user hover menu when the page owner is a group + */ +function groups_user_entity_menu_setup($hook, $type, $return, $params) { + if (elgg_is_logged_in()) { + $group = elgg_get_page_owner_entity(); + + // Check for valid group + if (!elgg_instanceof($group, 'group')) { + return $return; + } + + $entity = $params['entity']; + + // Make sure we have a user and that user is a member of the group + if (!elgg_instanceof($entity, 'user') || !$group->isMember($entity)) { + return $return; + } + + // Add remove link if we can edit the group, and if we're not trying to remove the group owner + if ($group->canEdit() && $group->getOwnerGUID() != $entity->guid) { + $remove = elgg_view('output/confirmlink', array( + 'href' => "action/groups/remove?user_guid={$entity->guid}&group_guid={$group->guid}", + 'text' => elgg_echo('groups:removeuser'), + )); + + $options = array( + 'name' => 'removeuser', + 'text' => $remove, + 'priority' => 999, + ); + $return[] = ElggMenuItem::factory($options); + } + } + + return $return; +} + +/** * Groups created so create an access list for it */ function groups_create_event_listener($event, $object_type, $object) { diff --git a/mod/groups/views/default/forms/groups/delete.php b/mod/groups/views/default/forms/groups/delete.php deleted file mode 100644 index 28c2eb9bf..000000000 --- a/mod/groups/views/default/forms/groups/delete.php +++ /dev/null @@ -1,17 +0,0 @@ -<?php -/** - * Group delete form body - */ - -$warning = elgg_echo("groups:deletewarning"); - -echo elgg_view('input/hidden', array( - 'name' => 'group_guid', - 'value' => $vars['entity']->getGUID(), -)); - -echo elgg_view('input/submit', array( - 'class' => "elgg-button elgg-button-delete right", - 'value' => elgg_echo('groups:delete'), - 'onclick' => "return confirm('$warning');", -)); diff --git a/mod/groups/views/default/forms/groups/edit.php b/mod/groups/views/default/forms/groups/edit.php index 1a4e95513..b67134c63 100644 --- a/mod/groups/views/default/forms/groups/edit.php +++ b/mod/groups/views/default/forms/groups/edit.php @@ -126,7 +126,7 @@ if ($tools) { } } ?> -<div class="elgg-divide-top"> +<div class="elgg-form-footer-alt"> <?php if (isset($vars['entity'])) { @@ -137,5 +137,15 @@ if (isset($vars['entity'])) { } echo elgg_view('input/submit', array('value' => elgg_echo('save'))); + +if (isset($vars['entity'])) { + $delete_url = 'action/groups/delete?guid=' . $vars['entity']->getGUID(); + echo elgg_view('output/confirmlink', array( + 'text' => elgg_echo('groups:delete'), + 'href' => $delete_url, + 'confirm' => elgg_echo('groups:deletewarning'), + 'class' => 'elgg-button elgg-button-delete float-alt', + )); +} ?> </div> diff --git a/mod/groups/views/default/forms/groups/invite.php b/mod/groups/views/default/forms/groups/invite.php index a49bbe2fb..83139c2ee 100644 --- a/mod/groups/views/default/forms/groups/invite.php +++ b/mod/groups/views/default/forms/groups/invite.php @@ -12,9 +12,11 @@ $friends = elgg_get_logged_in_user_entity()->getFriends('', 0); if ($friends) { echo elgg_view('input/friendspicker', array('entities' => $friends, 'name' => 'user_guid', 'highlight' => 'all')); + echo '<div class="elgg-form-footer">'; echo elgg_view('input/hidden', array('name' => 'forward_url', 'value' => $forward_url)); echo elgg_view('input/hidden', array('name' => 'group_guid', 'value' => $group->guid)); echo elgg_view('input/submit', array('value' => elgg_echo('invite'))); + echo '</div>'; } else { echo elgg_echo('groups:nofriendsatall'); }
\ No newline at end of file diff --git a/mod/groups/views/default/group/default.php b/mod/groups/views/default/group/default.php index 1f1035a38..2aa377813 100644 --- a/mod/groups/views/default/group/default.php +++ b/mod/groups/views/default/group/default.php @@ -31,7 +31,7 @@ if ($vars['full_view']) { 'metadata' => $metadata, 'subtitle' => $group->briefdescription, ); - $list_body = elgg_view('page/components/summary', $params); + $list_body = elgg_view('group/elements/summary', $params); echo elgg_view_image_block($icon, $list_body); } diff --git a/mod/groups/views/default/groups/css.php b/mod/groups/views/default/groups/css.php index 06b86d1ee..37fc5dc10 100644 --- a/mod/groups/views/default/groups/css.php +++ b/mod/groups/views/default/groups/css.php @@ -32,6 +32,10 @@ margin-bottom: 7px; } +.groups-profile-fields .elgg-output { + margin: 0; +} + #groups-tools > .elgg-module { float: left; margin-bottom: 40px; diff --git a/mod/groups/views/default/groups/edit.php b/mod/groups/views/default/groups/edit.php index 2434bd14f..5076cc49a 100644 --- a/mod/groups/views/default/groups/edit.php +++ b/mod/groups/views/default/groups/edit.php @@ -10,9 +10,3 @@ $entity = elgg_extract('entity', $vars, null); $form_vars = array('enctype' => 'multipart/form-data'); $body_vars = array('entity' => $entity); echo elgg_view_form('groups/edit', $form_vars, $body_vars); - -if ($entity) { - echo '<div class="delete_group">'; - echo elgg_view_form('groups/delete', array(), array('entity' => $entity)); - echo '</div>'; -} diff --git a/mod/groups/views/default/groups/profile/fields.php b/mod/groups/views/default/groups/profile/fields.php index 5cd06025f..14827f11a 100644 --- a/mod/groups/views/default/groups/profile/fields.php +++ b/mod/groups/views/default/groups/profile/fields.php @@ -26,12 +26,12 @@ if (is_array($profile_fields) && count($profile_fields) > 0) { $options['tag_names'] = $key; } - echo "<p class=\"{$even_odd}\">"; + echo "<div class=\"{$even_odd}\">"; echo "<b>"; echo elgg_echo("groups:$key"); echo ": </b>"; echo elgg_view("output/$valtype", $options); - echo "</p>"; + echo "</div>"; $even_odd = ($even_odd == 'even') ? 'odd' : 'even'; } diff --git a/mod/groups/views/default/object/groupforumtopic.php b/mod/groups/views/default/object/groupforumtopic.php index 9589d1fb8..3a4decbe4 100644 --- a/mod/groups/views/default/object/groupforumtopic.php +++ b/mod/groups/views/default/object/groupforumtopic.php @@ -67,7 +67,7 @@ if ($full) { 'subtitle' => $subtitle, 'tags' => $tags, ); - $list_body = elgg_view('page/components/summary', $params); + $list_body = elgg_view('object/elements/summary', $params); $info = elgg_view_image_block($poster_icon, $list_body); @@ -90,7 +90,7 @@ HTML; 'tags' => $tags, 'content' => $excerpt, ); - $list_body = elgg_view('page/components/summary', $params); + $list_body = elgg_view('object/elements/summary', $params); echo elgg_view_image_block($poster_icon, $list_body); } diff --git a/mod/invitefriends/manifest.xml b/mod/invitefriends/manifest.xml index d445c5025..e02c19c36 100644 --- a/mod/invitefriends/manifest.xml +++ b/mod/invitefriends/manifest.xml @@ -14,4 +14,5 @@ <version>2010030101</version> </requires> <admin_interface>advanced</admin_interface> + <activate_on_install>true</activate_on_install> </plugin_manifest> diff --git a/mod/invitefriends/views/default/forms/invitefriends/invite.php b/mod/invitefriends/views/default/forms/invitefriends/invite.php index 2597598de..5af8b5da0 100644 --- a/mod/invitefriends/views/default/forms/invitefriends/invite.php +++ b/mod/invitefriends/views/default/forms/invitefriends/invite.php @@ -27,7 +27,9 @@ if (elgg_get_config('allow_registration')) { </div> HTML; + echo '<div>'; echo elgg_view('input/submit', array('value' => elgg_echo('send'))); + echo '</div>'; } else { echo elgg_echo('invitefriends:registration_disabled'); } diff --git a/mod/likes/start.php b/mod/likes/start.php index 638f2028c..b2aa83260 100644 --- a/mod/likes/start.php +++ b/mod/likes/start.php @@ -1,7 +1,7 @@ <?php /** * Likes plugin - * + * */ elgg_register_event_handler('init', 'system', 'likes_init'); @@ -50,32 +50,13 @@ function likes_river_menu_setup($hook, $type, $return, $params) { $object = $item->getObjectEntity(); if (!elgg_in_context('widgets') && $item->annotation_id == 0) { if ($object->canAnnotate(0, 'likes')) { - if (!elgg_annotation_exists($object->getGUID(), 'likes')) { - // user has not liked this yet - $url = "action/likes/add?guid={$object->getGUID()}"; - $options = array( - 'name' => 'likes', - 'href' => $url, - 'text' => elgg_view('likes/display', array('entity' => $object)), - 'is_action' => true, - 'priority' => 100, - ); - } else { - // user has liked this - $likes = elgg_get_annotations(array( - 'guid' => $object->getGUID(), - 'annotation_name' => 'likes', - 'annotation_owner_guid' => elgg_get_logged_in_user_guid() - )); - $url = elgg_get_site_url() . "action/likes/delete?annotation_id={$likes[0]->id}"; - $options = array( - 'name' => 'likes', - 'href' => $url, - 'text' => elgg_view('likes/display', array('entity' => $object)), - 'is_action' => true, - 'priority' => 100, - ); - } + $options = array( + 'name' => 'likes', + 'href' => false, + 'text' => elgg_view('likes/display', array('entity' => $object)), + 'is_action' => true, + 'priority' => 100, + ); $return[] = ElggMenuItem::factory($options); } } @@ -87,7 +68,7 @@ function likes_river_menu_setup($hook, $type, $return, $params) { /** * Count how many people have liked an entity. * - * @param ElggEntity $entity + * @param ElggEntity $entity * * @return int Number of likes */ diff --git a/mod/logrotate/views/default/settings/logrotate/edit.php b/mod/logrotate/views/default/settings/logrotate/edit.php index 206051780..32d59faa5 100644 --- a/mod/logrotate/views/default/settings/logrotate/edit.php +++ b/mod/logrotate/views/default/settings/logrotate/edit.php @@ -15,7 +15,7 @@ if (!$time) { $time = 'monthly'; } ?> -<p> +<div> <?php echo elgg_echo('logrotate:period'); ?> <?php @@ -30,7 +30,7 @@ if (!$time) { )); ?> - <?php echo elgg_echo('<br>'); ?> + <?php echo elgg_echo('</div><div>'); ?> <?php echo elgg_echo('logrotate:date'); ?> @@ -45,4 +45,4 @@ if (!$time) { 'value' => $time )); ?> -</p> +</div> diff --git a/mod/members/pages/members/search.php b/mod/members/pages/members/search.php index 39b54990e..94127768a 100644 --- a/mod/members/pages/members/search.php +++ b/mod/members/pages/members/search.php @@ -19,16 +19,16 @@ if ($vars['search_type'] == 'tag') { $users = $results['entities']; $content = elgg_view_entity_list($users, $count, $offset, $limit, false, false, true); } else { - $name = get_input('name'); + $name = sanitize_string(get_input('name')); $title = elgg_echo('members:title:searchname', array($name)); - global $CONFIG; + $db_prefix = elgg_get_config('dbprefix'); $params = array( 'type' => 'user', 'full_view' => false, - 'joins' => array("join {$CONFIG->dbprefix}users_entity u on e.guid=u.guid"), - 'wheres' => array("(u.name like \"%{$name}%\" or u.username like \"%{$name}%\")"), + 'joins' => array("JOIN {$db_prefix}users_entity u ON e.guid=u.guid"), + 'wheres' => array("(u.name LIKE \"%{$name}%\" OR u.username LIKE \"%{$name}%\")"), ); $content .= elgg_list_entities($params); } diff --git a/mod/messages/languages/en.php b/mod/messages/languages/en.php index 8e4cd015f..2002905b7 100644 --- a/mod/messages/languages/en.php +++ b/mod/messages/languages/en.php @@ -88,6 +88,9 @@ $english = array( 'messages:nomessages' => "There are no messages.", 'messages:user:nonexist' => "We could not find the recipient in the user database.", 'messages:user:blank' => "You did not select someone to send this to.", + + 'messages:deleted_sender' => 'Deleted user', + ); add_translation("en", $english);
\ No newline at end of file diff --git a/mod/messages/views/default/object/messages.php b/mod/messages/views/default/object/messages.php index b52b86a3a..b2d127d85 100644 --- a/mod/messages/views/default/object/messages.php +++ b/mod/messages/views/default/object/messages.php @@ -19,11 +19,16 @@ if ($full) { if ($message->toId == elgg_get_page_owner_guid()) { // received $user = get_entity($message->fromId); - $icon = elgg_view_entity_icon($user, 'tiny'); - $user_link = elgg_view('output/url', array( - 'href' => "messages/compose?send_to=$user->guid", - 'text' => $user->name, - )); + if ($user) { + $icon = elgg_view_entity_icon($user, 'tiny'); + $user_link = elgg_view('output/url', array( + 'href' => "messages/compose?send_to=$user->guid", + 'text' => $user->name, + )); + } else { + $icon = ''; + $user_link = elgg_echo('messages:deleted_sender'); + } if ($message->readYet) { $class = 'message read'; @@ -34,11 +39,17 @@ if ($message->toId == elgg_get_page_owner_guid()) { } else { // sent $user = get_entity($message->toId); - $icon = elgg_view_entity_icon($user, 'tiny'); - $user_link = elgg_view('output/url', array( - 'href' => "messages/compose?send_to=$user->guid", - 'text' => elgg_echo('messages:to_user', array($user->name)), - )); + + if ($user) { + $icon = elgg_view_entity_icon($user, 'tiny'); + $user_link = elgg_view('output/url', array( + 'href' => "messages/compose?send_to=$user->guid", + 'text' => elgg_echo('messages:to_user', array($user->name)), + )); + } else { + $icon = ''; + $user_link = elgg_echo('messages:deleted_sender'); + } $class = 'message read'; } diff --git a/mod/notifications/views/default/notifications/subscriptions/forminternals.php b/mod/notifications/views/default/notifications/subscriptions/forminternals.php index d286d37a3..b059db487 100644 --- a/mod/notifications/views/default/notifications/subscriptions/forminternals.php +++ b/mod/notifications/views/default/notifications/subscriptions/forminternals.php @@ -325,7 +325,7 @@ if (!isset($vars['replacement'])) { ?> - <div class="elgg-divide-top mtm ptm"> + <div class="elgg-form-footer-alt"> <?php echo elgg_view('input/submit', array( 'value' => elgg_echo('save'), diff --git a/mod/pages/pages/pages/view.php b/mod/pages/pages/pages/view.php index b9f1fde83..b73bc985c 100644 --- a/mod/pages/pages/pages/view.php +++ b/mod/pages/pages/pages/view.php @@ -33,7 +33,7 @@ $content = elgg_view_entity($page, true); $content .= elgg_view_comments($page); $buttons = ''; -if ($page->canEdit()) { +if (elgg_get_logged_in_user_guid() == $page->getOwnerGuid()) { $url = "pages/add/$page->guid"; $buttons = elgg_view('output/url', array( 'text' => elgg_echo('pages:newchild'), diff --git a/mod/pages/start.php b/mod/pages/start.php index 2e2bc1ed6..744306649 100644 --- a/mod/pages/start.php +++ b/mod/pages/start.php @@ -65,7 +65,7 @@ function pages_init() { 'description' => 'longtext', 'tags' => 'tags', 'access_id' => 'access', - 'write_access_id' => 'access', + 'write_access_id' => 'write_access', )); elgg_register_plugin_hook_handler('register', 'menu:owner_block', 'pages_owner_block_menu'); @@ -231,6 +231,15 @@ function pages_entity_menu_setup($hook, $type, $return, $params) { return $return; } + // remove delete if not owner or admin + if (!elgg_is_admin_logged_in() && elgg_get_logged_in_user_guid() != $entity->getOwnerGuid()) { + foreach ($return as $index => $item) { + if ($item->getName() == 'delete') { + unset($return[$index]); + } + } + } + $options = array( 'name' => 'history', 'text' => elgg_echo('pages:history'), diff --git a/mod/pages/views/default/input/write_access.php b/mod/pages/views/default/input/write_access.php new file mode 100644 index 000000000..69277ca20 --- /dev/null +++ b/mod/pages/views/default/input/write_access.php @@ -0,0 +1,35 @@ +<?php +/** + * Write access + * + * Removes the public option found in input/access + * + * @uses $vars['value'] The current value, if any + * @uses $vars['options_values'] + * @uses $vars['name'] The name of the input field + * @uses $vars['entity'] Optional. The entity for this access control (uses write_access_id) + */ + +$options = get_write_access_array(); +unset($options[ACCESS_PUBLIC]); + +$defaults = array( + 'class' => 'elgg-input-access', + 'disabled' => FALSE, + 'value' => get_default_access(), + 'options_values' => $options, +); + +if (isset($vars['entity'])) { + $defaults['value'] = $vars['entity']->write_access_id; + unset($vars['entity']); +} + +$vars = array_merge($defaults, $vars); + +if ($vars['value'] == ACCESS_DEFAULT) { + $vars['value'] = get_default_access(); +} +$vars['value'] = ($vars['value'] == ACCESS_PUBLIC) ? ACCESS_LOGGED_IN : $vars['value']; + +echo elgg_view('input/dropdown', $vars); diff --git a/mod/pages/views/default/object/page_top.php b/mod/pages/views/default/object/page_top.php index 756c542b4..2ad44e38c 100644 --- a/mod/pages/views/default/object/page_top.php +++ b/mod/pages/views/default/object/page_top.php @@ -18,6 +18,13 @@ if (!$page) { return TRUE; } +// pages used to use Public for write access +if ($page->write_access_id == ACCESS_PUBLIC) { + // this works because this metadata is public + $page->write_access_id = ACCESS_LOGGED_IN; +} + + if ($revision) { $annotation = $revision; } else { @@ -75,7 +82,7 @@ if ($full) { 'subtitle' => $subtitle, 'tags' => $tags, ); - $list_body = elgg_view('page/components/summary', $params); + $list_body = elgg_view('object/elements/summary', $params); $info = elgg_view_image_block($page_icon, $list_body); @@ -96,7 +103,7 @@ HTML; 'tags' => $tags, 'content' => $excerpt, ); - $list_body = elgg_view('page/components/summary', $params); + $list_body = elgg_view('object/elements/summary', $params); echo elgg_view_image_block($page_icon, $list_body); } diff --git a/mod/profile/start.php b/mod/profile/start.php index d91b66371..2c38fdd2d 100644 --- a/mod/profile/start.php +++ b/mod/profile/start.php @@ -7,6 +7,10 @@ elgg_register_event_handler('init', 'system', 'profile_init', 1); +// Metadata on users needs to be independent +// outside of init so it happens earlier in boot. See #3316 +register_metadata_as_independent('user'); + /** * Profile init function */ @@ -16,8 +20,6 @@ function profile_init() { // will dictate the URL for all ElggUser objects elgg_register_entity_url_handler('user', 'all', 'profile_url'); - // Metadata on users needs to be independent - register_metadata_as_independent('user'); elgg_register_simplecache_view('icon/user/default/tiny'); elgg_register_simplecache_view('icon/user/default/topbar'); @@ -127,4 +129,4 @@ function profile_default_widgets_hook($hook, $type, $return, $params) { ); return $return; -}
\ No newline at end of file +} diff --git a/mod/profile/views/default/profile/details.php b/mod/profile/views/default/profile/details.php index 04d95001d..3af5cb756 100644 --- a/mod/profile/views/default/profile/details.php +++ b/mod/profile/views/default/profile/details.php @@ -25,12 +25,12 @@ if (is_array($profile_fields) && sizeof($profile_fields) > 0) { //This function controls the alternating class $even_odd = ( 'odd' != $even_odd ) ? 'odd' : 'even'; ?> - <p class="<?php echo $even_odd; ?>"> + <div class="<?php echo $even_odd; ?>"> <b><?php echo elgg_echo("profile:{$shortname}"); ?>: </b> <?php echo elgg_view("output/{$valtype}", array('value' => $user->$shortname)); ?> - </p> + </div> <?php } } @@ -45,7 +45,7 @@ if (!elgg_get_config('profile_custom_fields')) { if ($user->description) { echo "<p class='profile-aboutme-title'><b>" . elgg_echo("profile:aboutme") . "</b></p>"; echo "<div class='profile-aboutme-contents'>"; - echo elgg_view('output/longtext', array('value' => $user->description)); + echo elgg_view('output/longtext', array('value' => $user->description, 'class' => 'mtn')); echo "</div>"; } } diff --git a/mod/profile/views/default/profile/owner_block.php b/mod/profile/views/default/profile/owner_block.php index c93398034..48d7ff24f 100644 --- a/mod/profile/views/default/profile/owner_block.php +++ b/mod/profile/views/default/profile/owner_block.php @@ -22,7 +22,7 @@ $admin = elgg_extract('admin', $menu, array()); $profile_actions = ''; if (elgg_is_logged_in() && $actions) { - $profile_actions = '<ul class="elgg-menu">'; + $profile_actions = '<ul class="elgg-menu profile-action-menu mvm">'; foreach ($actions as $action) { $profile_actions .= '<li>' . $action->getContent(array('class' => 'elgg-button elgg-button-action')) . '</li>'; } diff --git a/mod/reportedcontent/languages/en.php b/mod/reportedcontent/languages/en.php index 407717082..c047644e3 100644 --- a/mod/reportedcontent/languages/en.php +++ b/mod/reportedcontent/languages/en.php @@ -23,8 +23,8 @@ $english = array( 'reportedcontent:archived' => 'The report has been archived', 'reportedcontent:visit' => 'Visit reported item', 'reportedcontent:by' => 'Report by', - 'reportedcontent:objecttitle' => 'Object title', - 'reportedcontent:objecturl' => 'Object url', + 'reportedcontent:objecttitle' => 'Page title', + 'reportedcontent:objecturl' => 'Page url', 'reportedcontent:reason' => 'Reason for report', 'reportedcontent:description' => 'Why are you reporting this?', 'reportedcontent:address' => 'Location of the item', diff --git a/mod/reportedcontent/views/default/object/reported_content.php b/mod/reportedcontent/views/default/object/reported_content.php index 044a40012..b8c443450 100644 --- a/mod/reportedcontent/views/default/object/reported_content.php +++ b/mod/reportedcontent/views/default/object/reported_content.php @@ -21,7 +21,8 @@ if ($report->state == 'archived') { ?> <div class="reported-content <?php echo $reportedcontent_background; ?>"> - <div class="clearfix controls"> + <div class="clearfix"> + <div class="clearfix controls"> <?php if ($report->state != 'archived') { $params = array( @@ -40,28 +41,29 @@ if ($report->state == 'archived') { ); echo elgg_view('output/url', $params); ?> + </div> + <p> + <b><?php echo elgg_echo('reportedcontent:by'); ?>:</b> + <?php echo elgg_view('output/url', array( + 'href' => $reporter->getURL(), + 'text' => $reporter->name + )); + ?>, + <?php echo elgg_view_friendly_time($report->time_created); ?> + </p> + <p> + <b><?php echo elgg_echo('reportedcontent:objecttitle'); ?>:</b> + <?php echo $report->title; ?> + <br /> + <?php echo elgg_view('output/url', array( + 'href' => "#report-$report->guid", + 'text' => elgg_echo('reportedcontent:moreinfo'), + 'class' => "elgg-toggler", + )); + ?> + </p> </div> - <p> - <b><?php echo elgg_echo('reportedcontent:by'); ?>:</b> - <?php echo elgg_view('output/url', array( - 'href' => $reporter->getURL(), - 'text' => $reporter->name - )); - ?>, - <?php echo elgg_view_friendly_time($report->time_created); ?> - </p> - <p> - <b><?php echo elgg_echo('reportedcontent:objecttitle'); ?>:</b> - <?php echo $report->title; ?> - <br /> - <?php echo elgg_view('output/url', array( - 'href' => "#report-$report->guid", - 'text' => elgg_echo('reportedcontent:moreinfo'), - 'class' => "elgg-toggler", - )); - ?> - </p> - <div class="hidden" id="report-<?php echo $report->getGUID();?>"> + <div class="report-details hidden" id="report-<?php echo $report->getGUID();?>"> <p> <b><?php echo elgg_echo('reportedcontent:objecturl'); ?>:</b> <?php echo elgg_view('output/url', array( diff --git a/mod/reportedcontent/views/default/reportedcontent/admin_css.php b/mod/reportedcontent/views/default/reportedcontent/admin_css.php index b1e96f56c..2eba964a1 100644 --- a/mod/reportedcontent/views/default/reportedcontent/admin_css.php +++ b/mod/reportedcontent/views/default/reportedcontent/admin_css.php @@ -28,5 +28,19 @@ } .reported-content .controls { float: right; - margin: 14px 5px 0 0; + margin: 0 0 0 10px; +} +.report-details { + background-color: white; + padding: 5px; + margin-bottom: 5px; + max-width: 500px; + + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + border-radius: 5px; +} +.elgg-widget-content .reported-content .elgg-button { + display: block; + margin: 5px; } diff --git a/mod/thewire/languages/en.php b/mod/thewire/languages/en.php index 07f821e87..e2dd5fdac 100644 --- a/mod/thewire/languages/en.php +++ b/mod/thewire/languages/en.php @@ -13,7 +13,7 @@ $english = array( 'thewire:user' => "%s's wire posts", 'thewire:friends' => "Friends' wire posts", 'thewire:reply' => "Reply", - 'thewire:replying' => "Replying to %s who wrote", + 'thewire:replying' => "Replying to %s (@%s) who wrote", 'thewire:thread' => "Thread", 'thewire:charleft' => "characters remaining", 'thewire:tags' => "Wire posts tagged with '%s'", @@ -43,7 +43,7 @@ $english = array( */ 'thewire:posted' => "Your message was successfully posted to the wire.", 'thewire:deleted' => "The wire post was successfully deleted.", - 'thewire:blank' => "Sorry, you need to enter come text before we can post this.", + 'thewire:blank' => "Sorry, you need to enter some text before we can post this.", 'thewire:notfound' => "Sorry, we could not find the specified wire post.", 'thewire:notdeleted' => "Sorry. We could not delete this wire post.", diff --git a/mod/thewire/start.php b/mod/thewire/start.php index 0e6bd7794..2d66c475c 100644 --- a/mod/thewire/start.php +++ b/mod/thewire/start.php @@ -401,7 +401,7 @@ function thewire_setup_entity_menu_items($hook, $type, $value, $params) { 'text' => elgg_echo('thewire:previous'), 'href' => "thewire/previous/$entity->guid", 'priority' => 160, - 'class' => 'thewire-previous', + 'link_class' => 'thewire-previous', 'title' => elgg_echo('thewire:previous:help'), ); $value[] = ElggMenuItem::factory($options); diff --git a/mod/thewire/views/default/js/thewire.php b/mod/thewire/views/default/js/thewire.php index 1eda90bee..d9bf6d10e 100644 --- a/mod/thewire/views/default/js/thewire.php +++ b/mod/thewire/views/default/js/thewire.php @@ -30,7 +30,7 @@ elgg.thewire.init = function() { */ elgg.thewire.textCounter = function(textarea, status, limit) { - var remaining_chars = limit - textarea.value.length; + var remaining_chars = limit - $(textarea).val().length; status.html(remaining_chars); if (remaining_chars < 0) { @@ -83,4 +83,4 @@ elgg.thewire.viewPrevious = function(event) { event.preventDefault(); } -elgg.register_hook_handler('init', 'system', elgg.thewire.init);
\ No newline at end of file +elgg.register_hook_handler('init', 'system', elgg.thewire.init); diff --git a/mod/thewire/views/default/object/thewire.php b/mod/thewire/views/default/object/thewire.php index 7beb197ee..3ae347711 100644 --- a/mod/thewire/views/default/object/thewire.php +++ b/mod/thewire/views/default/object/thewire.php @@ -51,7 +51,7 @@ $params = array( 'content' => thewire_filter($post->description), 'tags' => false, ); -$list_body = elgg_view('page/components/summary', $params); +$list_body = elgg_view('object/elements/summary', $params); echo elgg_view_image_block($owner_icon, $list_body); diff --git a/mod/thewire/views/default/thewire/reply.php b/mod/thewire/views/default/thewire/reply.php index 3794e1454..341b691b1 100644 --- a/mod/thewire/views/default/thewire/reply.php +++ b/mod/thewire/views/default/thewire/reply.php @@ -5,7 +5,10 @@ $post = $vars['post']; $poster = $post->getOwnerEntity(); - +$poster_details = array( + htmlspecialchars($poster->name, ENT_QUOTES, 'UTF-8'), + htmlspecialchars($poster->username, ENT_QUOTES, 'UTF-8'), +); ?> -<b><?php echo elgg_echo('thewire:replying', array($poster->name)); ?>: </b> +<b><?php echo elgg_echo('thewire:replying', $poster_details); ?>: </b> <?php echo $post->description;
\ No newline at end of file diff --git a/mod/tinymce/views/default/js/tinymce.php b/mod/tinymce/views/default/js/tinymce.php index 9809aa841..092983d1d 100644 --- a/mod/tinymce/views/default/js/tinymce.php +++ b/mod/tinymce/views/default/js/tinymce.php @@ -50,6 +50,7 @@ elgg.tinymce.init = function() { theme_advanced_statusbar_location : "bottom", theme_advanced_resizing : true, theme_advanced_path : true, + width : "100%", extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name|style],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]", setup : function(ed) { //show the number of words diff --git a/mod/twitter/views/default/twitter/css.php b/mod/twitter/views/default/twitter/css.php index cb58e8fb1..eb0cda98a 100644 --- a/mod/twitter/views/default/twitter/css.php +++ b/mod/twitter/views/default/twitter/css.php @@ -54,7 +54,7 @@ p.twitter_username .input-text { padding:2px; margin:0 0 5px 0; } -#twitter_widget li a { +#twitter_widget li > a { display:block; margin:0 0 0 4px; } diff --git a/mod/twitter_api/languages/en.php b/mod/twitter_api/languages/en.php index b63cebcf8..940a49d9b 100644 --- a/mod/twitter_api/languages/en.php +++ b/mod/twitter_api/languages/en.php @@ -23,7 +23,7 @@ $english = array( 'twitter_api:revoke:success' => 'Twitter access has been revoked.', 'twitter_api:login' => 'Allow existing users who have connected their Twitter account to sign in with Twitter?', - 'twitter_api:new_users' => 'Allow new users to sign up using their Twitter account even if manual registration is disabled?', + 'twitter_api:new_users' => 'Allow new users to sign up using their Twitter account even if user registration is disabled?', 'twitter_api:login:success' => 'You have been logged in.', 'twitter_api:login:error' => 'Unable to login with Twitter.', 'twitter_api:login:email' => "You must enter a valid email address for your new %s account.", diff --git a/pages/account/forgotten_password.php b/pages/account/forgotten_password.php index 93d786e22..bf6ef87e0 100644 --- a/pages/account/forgotten_password.php +++ b/pages/account/forgotten_password.php @@ -6,8 +6,6 @@ * @subpackage Registration */ -require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); - if (elgg_is_logged_in()) { forward(); } @@ -15,7 +13,9 @@ if (elgg_is_logged_in()) { $title = elgg_echo("user:password:lost"); $content = elgg_view_title($title); -$content .= elgg_view_form('user/requestnewpassword'); +$content .= elgg_view_form('user/requestnewpassword', array( + 'class' => 'elgg-form-account', +)); $body = elgg_view_layout("one_column", array('content' => $content)); diff --git a/pages/account/register.php b/pages/account/register.php index 58544ef49..5eb2b4001 100644 --- a/pages/account/register.php +++ b/pages/account/register.php @@ -35,7 +35,10 @@ $register_url = elgg_get_site_url() . 'action/register'; if (elgg_get_config('https_login')) { $register_url = str_replace("http:", "https:", $register_url); } -$form_params = array('action' => $register_url); +$form_params = array( + 'action' => $register_url, + 'class' => 'elgg-form-account float', +); $body_params = array( 'friend_guid' => $friend_guid, @@ -43,6 +46,8 @@ $body_params = array( ); $content .= elgg_view_form('register', $form_params, $body_params); +$content .= elgg_view('help/register'); + $body = elgg_view_layout("one_column", array('content' => $content)); echo elgg_view_page($title, $body); diff --git a/pages/account/reset_password.php b/pages/account/reset_password.php new file mode 100644 index 000000000..6515bfc5d --- /dev/null +++ b/pages/account/reset_password.php @@ -0,0 +1,35 @@ +<?php +/** + * Page for resetting a forgotten password + * + * @package Elgg.Core + * @subpackage Registration + */ + +if (elgg_is_logged_in()) { + forward(); +} + +$user_guid = get_input('u'); +$code = get_input('c'); + +$user = get_entity($user_guid); + +// don't check code here to avoid automated attacks +if (!$user instanceof ElggUser) { + register_error(elgg_echo('user:passwordreset:unknown_user')); + forward(); +} + +$params = array( + 'guid' => $user_guid, + 'code' => $code, +); +$form = elgg_view_form('user/passwordreset', array('class' => 'elgg-form-account'), $params); + +$title = elgg_echo('resetpassword'); +$content = elgg_view_title(elgg_echo('resetpassword')) . $form; + +$body = elgg_view_layout('one_column', array('content' => $content)); + +echo elgg_view_page($title, $body); diff --git a/version.php b/version.php index f3e7010b0..9d3bf43e3 100644 --- a/version.php +++ b/version.php @@ -11,7 +11,7 @@ // YYYYMMDD = Elgg Date // XX = Interim incrementer -$version = 2011032200; +$version = 2011061200; // Human-friendly version name $release = '1.8b1'; diff --git a/views/default/admin/plugins.php b/views/default/admin/plugins.php new file mode 100644 index 000000000..1aa899fcc --- /dev/null +++ b/views/default/admin/plugins.php @@ -0,0 +1,177 @@ +<?php +/** + * Elgg administration plugin screen + * + * Shows a list of plugins that can be sorted and filtered. + * + * @package Elgg.Core + * @subpackage Admin.Plugins + */ + +elgg_generate_plugin_entities(); +$installed_plugins = elgg_get_plugins('any'); +$show_category = get_input('category', 'all'); +$sort = get_input('sort', 'priority'); + +// Get a list of the all categories +// and trim down the plugin list if we're not viewing all categories. +// @todo this could be cached somewhere after have the manifest loaded +$categories = array(); + +foreach ($installed_plugins as $id => $plugin) { + if (!$plugin->isValid()) { + continue; + } + + $plugin_categories = $plugin->getManifest()->getCategories(); + + // handle plugins that don't declare categories + // unset them here because this is the list we foreach + switch ($show_category) { + case 'all': + break; + case 'active': + if (!$plugin->isActive()) { + unset($installed_plugins[$id]); + } + break; + case 'inactive': + if ($plugin->isActive()) { + unset($installed_plugins[$id]); + } + break; + default: + if (!in_array($show_category, $plugin_categories)) { + unset($installed_plugins[$id]); + } + break; + } + + if (isset($plugin_categories)) { + foreach ($plugin_categories as $category) { + if (!array_key_exists($category, $categories)) { + $categories[$category] = elgg_echo("admin:plugins:category:$category"); + } + } + } +} + +$guids = array(); +foreach ($installed_plugins as $plugin) { + $guids[] = $plugin->getGUID(); +} + +// sort plugins +switch ($sort) { + case 'date': + $plugin_list = array(); + foreach ($installed_plugins as $plugin) { + $create_date = $plugin->getTimeCreated(); + while (isset($plugin_list[$create_date])) { + $create_date++; + } + $plugin_list[$create_date] = $plugin; + } + krsort($plugin_list); + break; + case 'alpha': + $plugin_list = array(); + foreach ($installed_plugins as $plugin) { + $plugin_list[$plugin->getManifest()->getName()] = $plugin; + } + ksort($plugin_list); + break; + case 'priority': + default: + $plugin_list = $installed_plugins; + break; +} + + + +asort($categories); + +$common_categories = array( + 'all' => elgg_echo('admin:plugins:category:all'), + 'active' => elgg_echo('admin:plugins:category:active'), + 'inactive' => elgg_echo('admin:plugins:category:inactive'), +); + +$categories = array_merge($common_categories, $categories); +// security - only want a defined option +if (!array_key_exists($show_category, $categories)) { + $show_category = reset($categories); +} + +$category_form = elgg_view_form('admin/plugins/filter', array( + 'action' => 'admin/plugins', + 'method' => 'get', + 'disable_security' => true, +), array( + 'category' => $show_category, + 'category_options' => $categories, + 'sort' => $sort, +)); + + +$sort_options = array( + 'priority' => elgg_echo('admin:plugins:sort:priority'), + 'alpha' => elgg_echo('admin:plugins:sort:alpha'), + 'date' => elgg_echo('admin:plugins:sort:date'), +); +// security - only want a defined option +if (!array_key_exists($sort, $sort_options)) { + $sort = reset($sort_options); +} + +$sort_form = elgg_view_form('admin/plugins/sort', array( + 'action' => 'admin/plugins', + 'method' => 'get', + 'disable_security' => true, +), array( + 'sort' => $sort, + 'sort_options' => $sort_options, + 'category' => $show_category, +)); + +$buttons = "<div class=\"clearfix mbm\">"; +$buttons .= elgg_view_form('admin/plugins/change_state', array( + 'action' => 'action/admin/plugins/activate_all', + 'class' => 'float', +), array( + 'guids' => $guids, + 'action' => 'activate', +)); +$buttons .= elgg_view_form('admin/plugins/change_state', array( + 'action' => 'action/admin/plugins/deactivate_all', + 'class' => 'float', +), array( + 'guids' => $guids, + 'action' => 'deactivate', +)); +$buttons .= "</div>"; + +$buttons .= $category_form . $sort_form; + +// construct page header +?> +<div id="content_header" class="mbm clearfix"> + <div class="content-header-options"><?php echo $buttons ?></div> +</div> + +<div id="elgg-plugin-list"> +<?php + +$options = array( + 'limit' => 0, + 'full_view' => true, + 'list_type_toggle' => false, + 'pagination' => false, +); +if ($show_category == 'all' && $sort == 'priority') { + $options['display_reordering'] = true; +} +echo elgg_view_entity_list($plugin_list, $options); + +?> +</div>
\ No newline at end of file diff --git a/views/default/admin/plugins/advanced.php b/views/default/admin/plugins/advanced.php deleted file mode 100644 index 4cefa0b3e..000000000 --- a/views/default/admin/plugins/advanced.php +++ /dev/null @@ -1,93 +0,0 @@ -<?php -/** - * Elgg administration advanced plugin screen - * - * Shows a list of all plugins sorted by load order. - * - * @package Elgg.Core - * @subpackage Admin.Plugins - */ - -elgg_generate_plugin_entities(); -$installed_plugins = elgg_get_plugins('any'); -$show_category = get_input('category', null); - -// Get a list of the all categories -// and trim down the plugin list if we're not viewing all categories. -// @todo this could be cached somewhere after have the manifest loaded -$categories = array(); - -foreach ($installed_plugins as $id => $plugin) { - if (!$plugin->isValid()) { - continue; - } - - $plugin_categories = $plugin->getManifest()->getCategories(); - - // handle plugins that don't declare categories - // unset them here because this is the list we foreach - if ($show_category && !in_array($show_category, $plugin_categories)) { - unset($installed_plugins[$id]); - } - - if (isset($plugin_categories)) { - foreach ($plugin_categories as $category) { - if (!array_key_exists($category, $categories)) { - $categories[$category] = elgg_echo("admin:plugins:category:$category"); - } - } - } -} - -asort($categories); - -$categories = array_merge(array('' => elgg_echo('admin:plugins:category:all')), $categories); - -$category_dropdown = elgg_view('input/dropdown', array( - 'name' => 'category', - 'options_values' => $categories, - 'value' => $show_category -)); - -$category_button = elgg_view('input/submit', array( - 'value' => elgg_echo('filter'), - 'class' => 'elgg-button elgg-button-action' -)); - -$category_form = elgg_view('input/form', array( - 'body' => $category_dropdown . $category_button, - 'method' => 'get', - 'action' => 'admin/plugins/advanced', - 'disable_security' => true, -)); - -// @todo Until "en/deactivate all" means "All plugins on this page" hide when not looking at all. -if (!isset($show_category) || empty($show_category)) { - $activate_url = "action/admin/plugins/activate_all"; - $activate_url = elgg_add_action_tokens_to_url($activate_url); - $deactivate_url = "action/admin/plugins/deactivate_all"; - $deactivate_url = elgg_add_action_tokens_to_url($deactivate_url); - - $buttons = "<div class=\"mbl\">"; - $buttons .= "<a class='elgg-button elgg-button-action' href=\"$activate_url\">" . elgg_echo('admin:plugins:activate_all') . '</a> '; - $buttons .= "<a class='elgg-button elgg-button-cancel' href=\"$deactivate_url\">" . elgg_echo('admin:plugins:deactivate_all') . '</a> '; - $buttons .= "</div>"; -} else { - $buttons = ''; -} - -$buttons .= $category_form; - -// construct page header -?> -<div id="content_header" class="mbm clearfix"> - <div class="content-header-options"><?php echo $buttons ?></div> -</div> - -<div id="elgg-plugin-list"> -<?php - -echo elgg_view_entity_list($installed_plugins, 0, 0, 0, true, false, false); - -?> -</div>
\ No newline at end of file diff --git a/views/default/admin/plugins/simple.php b/views/default/admin/plugins/simple.php deleted file mode 100644 index 28c1cc25e..000000000 --- a/views/default/admin/plugins/simple.php +++ /dev/null @@ -1,11 +0,0 @@ -<?php -/** - * Elgg administration simple plugin screen - * - * Shows an alphabetical list of "simple" plugins. - * - * @package Elgg - * @subpackage Core - */ - -echo elgg_view_form('admin/plugins/simple_update_states', array('class' => 'admin_plugins_simpleview')); diff --git a/views/default/core/account/login_walled_garden.php b/views/default/core/account/login_walled_garden.php index 9b5019096..1606b9592 100644 --- a/views/default/core/account/login_walled_garden.php +++ b/views/default/core/account/login_walled_garden.php @@ -6,7 +6,7 @@ */ $reg_url = elgg_normalize_url('register'); -$forgot_url = elgg_normalize_url('pages/account/forgotten_password.php'); +$forgot_url = elgg_normalize_url('forgotpassword'); $cancel_button = elgg_view('input/button', array( 'value' => elgg_echo('cancel'), 'class' => 'elgg-button-cancel mlm', diff --git a/views/default/core/settings/tools.php b/views/default/core/settings/tools.php index 87c98902f..a249adf82 100644 --- a/views/default/core/settings/tools.php +++ b/views/default/core/settings/tools.php @@ -11,7 +11,7 @@ // Description of what's going on echo elgg_view('output/longtext', array( 'value' => elgg_echo("usersettings:plugins:description"), - 'class' => 'user-settings mtm', + 'class' => 'user-settings mtn mbm', )); $limit = get_input('limit', 10); diff --git a/views/default/css/admin.php b/views/default/css/admin.php index 744211a20..a4d413781 100644 --- a/views/default/css/admin.php +++ b/views/default/css/admin.php @@ -158,6 +158,13 @@ table.mceLayout { .center { text-align: center; } +.float { + float: left; +} +.float-alt { + float: right; +} + /* *************************************** PAGE WRAPPER *************************************** */ @@ -678,6 +685,9 @@ input[type="submit"]:hover, .elgg-button-submit:hover, .elgg-button-action:hover .elgg-menu-admin-footer > li { padding-right: 25px; } +.elgg-menu-longtext { + float: right; +} /* *************************************** WIDGETS @@ -847,9 +857,10 @@ a.elgg-widget-collapsed:before { margin-bottom: 5px; } -a.elgg-longtext-control { - float: right; +.elgg-longtext-control { margin-left: 14px; + font-size: 80%; + cursor: pointer; } /* *************************************** diff --git a/views/default/css/elements/forms.php b/views/default/css/elements/forms.php index 0230cbc54..af7b2be19 100644 --- a/views/default/css/elements/forms.php +++ b/views/default/css/elements/forms.php @@ -16,6 +16,12 @@ fieldset > div { fieldset > div:last-child { margin-bottom: 0; } +.elgg-form-footer { +} +.elgg-form-footer-alt { + border-top: 1px solid #CCC; + padding: 10px 0; +} label { font-weight: bold; @@ -73,9 +79,17 @@ input[type="radio"] { padding-right: 10px; } +.elgg-form-account input[type="text"], +.elgg-form-account input[type="password"] { + width: 300px; +} + /* *************************************** FRIENDS PICKER *************************************** */ +.friends-picker-main-wrapper { + margin-bottom: 15px; +} .friends-picker-container h3 { font-size:4em !important; text-align: left; diff --git a/views/default/css/elements/layout.php b/views/default/css/elements/layout.php index d52938aee..a5854f8c1 100644 --- a/views/default/css/elements/layout.php +++ b/views/default/css/elements/layout.php @@ -15,6 +15,10 @@ PAGE LAYOUT *************************************** */ /***** DEFAULT LAYOUT ******/ +<?php // the width is on the page rather than topbar to handle small viewports ?> +.elgg-page-default { + min-width: 998px; +} .elgg-page-default .elgg-page-header > .elgg-inner { width: 990px; margin: 0 auto; @@ -35,7 +39,6 @@ .elgg-page-topbar { background: #333333 url(<?php echo elgg_get_site_url(); ?>_graphics/toptoolbar_background.gif) repeat-x top left; border-bottom: 1px solid #000000; - min-width: 998px; position: relative; height: 24px; z-index: 9000; diff --git a/views/default/css/elements/modules.php b/views/default/css/elements/modules.php index a5b907ddc..c4808478b 100644 --- a/views/default/css/elements/modules.php +++ b/views/default/css/elements/modules.php @@ -197,6 +197,7 @@ a.elgg-widget-edit-button { width: 96%; padding: 2%; border-bottom: 2px solid #dedede; + background-color: #f9f9f9; } .elgg-widget-content { padding: 10px; diff --git a/views/default/css/elements/navigation.php b/views/default/css/elements/navigation.php index e4709cb27..d930d3a89 100644 --- a/views/default/css/elements/navigation.php +++ b/views/default/css/elements/navigation.php @@ -130,7 +130,7 @@ } .elgg-menu-topbar > li > a { - padding: 2px 15px; + padding: 2px 15px 0; color: #eee; margin-top: 1px; } @@ -144,6 +144,18 @@ float: right; } +.elgg-menu-topbar > li > a.elgg-topbar-logo { + margin-top: 0; + padding-left: 5px; + width: 38px; + height: 20px; +} + +.elgg-menu-topbar > li > a.elgg-topbar-avatar { + width: 18px; + height: 18px; +} + /* *************************************** SITE MENU *************************************** */ diff --git a/views/default/css/elgg.php b/views/default/css/elgg.php index 675af860d..4960e6ade 100644 --- a/views/default/css/elgg.php +++ b/views/default/css/elgg.php @@ -26,13 +26,12 @@ if ($old_css_view != elgg_get_config('viewpath')) { Base CSS * CSS reset * core - * helpers + * helpers (moved to end to have a higher priority) * grid *******************************************************************************/ echo elgg_view('css/elements/reset', $vars); echo elgg_view('css/elements/core', $vars); -echo elgg_view('css/elements/helpers', $vars); echo elgg_view('css/elements/grid', $vars); @@ -61,5 +60,9 @@ echo elgg_view('css/elements/layout', $vars); echo elgg_view('css/elements/misc', $vars); +// included last to have higher priority +echo elgg_view('css/elements/helpers', $vars); + + // in case plugins are still extending the old 'css' view, display it echo elgg_view('css', $vars); diff --git a/views/default/forms/admin/plugins/change_state.php b/views/default/forms/admin/plugins/change_state.php new file mode 100644 index 000000000..ba5d873e7 --- /dev/null +++ b/views/default/forms/admin/plugins/change_state.php @@ -0,0 +1,20 @@ +<?php +/** + * Activate/deactive all plugins specified by guids array + * + * @uses $vars['guids'] Array of GUIDs + * @uses $vars['action'] 'activate' or 'deactivate' + */ + +$guids = elgg_extract('guids', $vars, array()); +$guids = implode(',', $guids); + +echo elgg_view('input/hidden', array( + 'name' => 'guids', + 'value' => $guids, +)); + +echo elgg_view('input/submit', array( + 'value' => elgg_echo("admin:plugins:{$vars['action']}_all"), + 'class' => 'elgg-button elgg-button-action' +)); diff --git a/views/default/forms/admin/plugins/filter.php b/views/default/forms/admin/plugins/filter.php new file mode 100644 index 000000000..d00906e6a --- /dev/null +++ b/views/default/forms/admin/plugins/filter.php @@ -0,0 +1,24 @@ +<?php +/** + * Category filter for plugins + * + * @uses $vars['category'] + * @uses $vars['category_options'] + * @uses $vvars['sort'] + */ + +echo elgg_view('input/dropdown', array( + 'name' => 'category', + 'options_values' => $vars['category_options'], + 'value' => $vars['category'], +)); + +echo elgg_view('input/hidden', array( + 'name' => 'sort', + 'value' => $vars['sort'], +)); + +echo elgg_view('input/submit', array( + 'value' => elgg_echo('filter'), + 'class' => 'elgg-button elgg-button-action', +)); diff --git a/views/default/forms/admin/plugins/simple_update_states.php b/views/default/forms/admin/plugins/simple_update_states.php deleted file mode 100644 index cc1c1a710..000000000 --- a/views/default/forms/admin/plugins/simple_update_states.php +++ /dev/null @@ -1,28 +0,0 @@ -<?php -/** - * Elgg administration simple plugin screen - * - * Shows an alphabetical list of "simple" plugins. - * - * @package Elgg - * @subpackage Core - */ - -elgg_generate_plugin_entities(); -$installed_plugins = elgg_get_plugins('any'); -$plugin_list = array(); - -foreach ($installed_plugins as $plugin) { - if (!$plugin->isValid()) { - continue; - } - $interface = $plugin->getManifest()->getAdminInterface(); - if ($interface == 'simple') { - $plugin_list[$plugin->getManifest()->getName()] = $plugin; - } -} - -ksort($plugin_list); - -echo elgg_view_entity_list($plugin_list, 0, 0, 0, false, false, false); -echo elgg_view('input/submit', array('value' => elgg_echo('save'))); diff --git a/views/default/forms/admin/plugins/sort.php b/views/default/forms/admin/plugins/sort.php new file mode 100644 index 000000000..284e085e6 --- /dev/null +++ b/views/default/forms/admin/plugins/sort.php @@ -0,0 +1,24 @@ +<?php +/** + * Sort plugins form body + * + * @uses $vars['sort'] + * @uses $vars['sort_options'] + * @uses $vars['category'] + */ + +echo elgg_view('input/dropdown', array( + 'name' => 'sort', + 'options_values' => $vars['sort_options'], + 'value' => $vars['sort'], +)); + +echo elgg_view('input/hidden', array( + 'name' => 'category', + 'value' => $vars['category'], +)); + +echo elgg_view('input/submit', array( + 'value' => elgg_echo('sort'), + 'class' => 'elgg-button elgg-button-action' +)); diff --git a/views/default/forms/avatar/crop.php b/views/default/forms/avatar/crop.php index 857a54e1f..3deec66bd 100644 --- a/views/default/forms/avatar/crop.php +++ b/views/default/forms/avatar/crop.php @@ -8,11 +8,10 @@ $master_image = $vars['entity']->getIcon('master'); ?> -<div> +<div class="clearfix"> <img id="user-avatar" class="mrl" src="<?php echo $master_image; ?>" alt="<?php echo elgg_echo('avatar'); ?>" /> </div> - -<div class="clearfloat"></div> +<div> <?php $coords = array('x1', 'x2', 'y1', 'y2'); foreach ($coords as $coord) { @@ -24,6 +23,7 @@ echo elgg_view('input/hidden', array('name' => 'guid', 'value' => $vars['entity' echo elgg_view('input/submit', array('value' => elgg_echo('avatar:create'))); ?> +</div> <!-- grab the required js for icon cropping --> <script type="text/javascript" src="<?php echo elgg_get_site_url(); ?>vendors/jquery/jquery.imgareaselect-0.8.min.js"></script> <?php //@todo JS 1.8: no ?> diff --git a/views/default/forms/avatar/upload.php b/views/default/forms/avatar/upload.php index 08db1f7e0..b099b8c4c 100644 --- a/views/default/forms/avatar/upload.php +++ b/views/default/forms/avatar/upload.php @@ -5,11 +5,12 @@ * @uses $vars['entity'] */ -echo elgg_view('input/hidden', array('name' => 'guid', 'value' => $vars['entity']->guid)); ?> <div> <label><?php echo elgg_echo("avatar:upload"); ?></label><br /> <?php echo elgg_view("input/file",array('name' => 'avatar')); ?> -<br /> +</div> +<div class="elgg-form-footer"> + <?php echo elgg_view('input/hidden', array('name' => 'guid', 'value' => $vars['entity']->guid)); ?> <?php echo elgg_view('input/submit', array('value' => elgg_echo('upload'))); ?> </div> diff --git a/views/default/forms/comments/add.php b/views/default/forms/comments/add.php index 6d674838a..40e574338 100644 --- a/views/default/forms/comments/add.php +++ b/views/default/forms/comments/add.php @@ -18,16 +18,20 @@ if (isset($vars['entity']) && elgg_is_logged_in()) { echo elgg_view('input/submit', array('value' => elgg_echo('comment'))); } else { ?> - <div> - <label><?php echo elgg_echo("generic_comments:add"); ?></label> - <?php echo elgg_view('input/longtext', array('name' => 'generic_comment')); ?> - </div> + <div> + <label><?php echo elgg_echo("generic_comments:add"); ?></label> + <?php echo elgg_view('input/longtext', array('name' => 'generic_comment')); ?> + </div> + <div> <?php echo elgg_view('input/submit', array('value' => elgg_echo("generic_comments:post"))); +?> + </div> +<?php } echo elgg_view('input/hidden', array( 'name' => 'entity_guid', 'value' => $vars['entity']->getGUID() )); -}
\ No newline at end of file +} diff --git a/views/default/forms/login.php b/views/default/forms/login.php index 452c4c425..5cfdcd4c6 100644 --- a/views/default/forms/login.php +++ b/views/default/forms/login.php @@ -39,7 +39,7 @@ echo '<li><a class="registration_link" href="' . elgg_get_site_url() . 'register">' . elgg_echo('register') . '</a></li>'; } ?> - <li><a class="forgotten_password_link" href="<?php echo elgg_get_site_url(); ?>pages/account/forgotten_password.php"> + <li><a class="forgotten_password_link" href="<?php echo elgg_get_site_url(); ?>forgotpassword"> <?php echo elgg_echo('user:password:lost'); ?> </a></li> </ul>
\ No newline at end of file diff --git a/views/default/forms/user/requestnewpassword.php b/views/default/forms/user/requestnewpassword.php index f2f276417..970938327 100644 --- a/views/default/forms/user/requestnewpassword.php +++ b/views/default/forms/user/requestnewpassword.php @@ -11,7 +11,7 @@ <?php echo elgg_echo('user:password:text'); ?> </div> <div> - <label><?php echo elgg_echo('username'); ?></label> + <label><?php echo elgg_echo('username'); ?></label><br /> <?php echo elgg_view('input/text', array('name' => 'username')); ?> </div> <?php echo elgg_view('input/captcha'); ?> diff --git a/views/default/forms/usersettings/save.php b/views/default/forms/usersettings/save.php index 62593e699..35871144b 100644 --- a/views/default/forms/usersettings/save.php +++ b/views/default/forms/usersettings/save.php @@ -1,7 +1,7 @@ <?php $form_body = elgg_view("forms/account/settings"); -$form_body .= '<div class="elgg-divide-top">'; +$form_body .= '<div class="elgg-form-footer-alt">'; $form_body .= elgg_view('input/submit', array('value' => elgg_echo('save'))); $form_body .= '</div>'; diff --git a/views/default/group/elements/summary.php b/views/default/group/elements/summary.php new file mode 100644 index 000000000..395ed5292 --- /dev/null +++ b/views/default/group/elements/summary.php @@ -0,0 +1,13 @@ +<?php +/** + * Group summary + * + * @uses $vars['entity'] ElggEntity + * @uses $vars['title'] Title link (optional) false = no title, '' = default + * @uses $vars['metadata'] HTML for entity metadata and actions (optional) + * @uses $vars['subtitle'] HTML for the subtitle (optional) + * @uses $vars['tags'] HTML for the tags (optional) + * @uses $vars['content'] HTML for the entity content (optional) + */ + +echo elgg_view('object/elements/summary', $vars); diff --git a/views/default/input/location.php b/views/default/input/location.php new file mode 100644 index 000000000..d7ae2bbbd --- /dev/null +++ b/views/default/input/location.php @@ -0,0 +1,21 @@ +<?php +/** + * Location input field + * + * @uses $vars['entity'] The ElggEntity that has a location + * @uses $vars['value'] The default value for the location + */ + +$defaults = array( + 'class' => 'elgg-input-location', + 'disabled' => FALSE, +); + +if (isset($vars['entity'])) { + $defaults['value'] = $vars['entity']->location; + unset($vars['entity']); +} + +$vars = array_merge($defaults, $vars); + +echo elgg_view('input/tag', $vars); diff --git a/views/default/input/tag.php b/views/default/input/tag.php new file mode 100644 index 000000000..a78ec3163 --- /dev/null +++ b/views/default/input/tag.php @@ -0,0 +1,17 @@ +<?php +/** + * Elgg tag input + * + * Accepts a single tag value + * + * @uses $vars['value'] The default value for the tag + */ + +$defaults = array( + 'class' => 'elgg-input-tag', + 'disabled' => FALSE, +); + +$vars = array_merge($defaults, $vars); + +echo elgg_view('input/text', $vars);
\ No newline at end of file diff --git a/views/default/navigation/menu/elements/item.php b/views/default/navigation/menu/elements/item.php index 55ddc2fe4..f3e46315b 100644 --- a/views/default/navigation/menu/elements/item.php +++ b/views/default/navigation/menu/elements/item.php @@ -22,13 +22,7 @@ if ($children) { $item_class = $item->getItemClass(); -//allow people to specify name with underscores -$name = str_replace('_', '-', $item->getName()); -if ($item_class) { - $class = "class=\"elgg-menu-item-$name $item_class\""; -} - -echo "<li $class>"; +echo "<li class=\"$item_class\">"; echo $item->getContent(); if ($children) { echo elgg_view('navigation/menu/elements/section', array( diff --git a/views/default/object/default.php b/views/default/object/default.php index 2cf9805f0..27bb1890e 100644 --- a/views/default/object/default.php +++ b/views/default/object/default.php @@ -42,6 +42,6 @@ $params = array( 'subtitle' => $subtitle, 'tags' => $vars['entity']->tags, ); -$body = elgg_view('page/components/summary', $params); +$body = elgg_view('object/elements/summary', $params); echo elgg_view_image_block($icon, $body); diff --git a/views/default/object/elements/summary.php b/views/default/object/elements/summary.php new file mode 100644 index 000000000..d3a6ea862 --- /dev/null +++ b/views/default/object/elements/summary.php @@ -0,0 +1,53 @@ +<?php +/** + * Object summary + * + * Sample output + * <ul class="elgg-menu elgg-menu-metadata"><li>Public</li><li>Like this</li></ul> + * <h3><a href="">Title</a></h3> + * <p class="elgg-subtext">Posted 3 hours ago by George</p> + * <p class="elgg-tags"><a href="">one</a>, <a href="">two</a></p> + * <div class="elgg-list-content">Excerpt text</div> + * + * @uses $vars['entity'] ElggEntity + * @uses $vars['title'] Title link (optional) false = no title, '' = default + * @uses $vars['metadata'] HTML for entity metadata and actions (optional) + * @uses $vars['subtitle'] HTML for the subtitle (optional) + * @uses $vars['tags'] HTML for the tags (optional) + * @uses $vars['content'] HTML for the entity content (optional) + */ + +$entity = $vars['entity']; + +$title_link = elgg_extract('title', $vars, ''); +if ($title_link === '') { + if (isset($entity->title)) { + $text = $entity->title; + } else { + $text = $entity->name; + } + $params = array( + 'text' => $text, + 'href' => $entity->getURL(), + ); + $title_link = elgg_view('output/url', $params); +} + +$metadata = elgg_extract('metadata', $vars, ''); +$subtitle = elgg_extract('subtitle', $vars, ''); +$content = elgg_extract('content', $vars, ''); + +$tags = elgg_extract('tags', $vars, ''); +if ($tags !== false) { + $tags = elgg_view('output/tags', array('tags' => $entity->tags)); +} + +if ($metadata) { + echo $metadata; +} +echo "<h3>$title_link</h3>"; +echo "<div class=\"elgg-subtext\">$subtitle</div>"; +echo $tags; +if ($content) { + echo "<div class=\"elgg-list-content\">$content</div>"; +} diff --git a/views/default/object/plugin/advanced.php b/views/default/object/plugin/advanced.php index 56e680ad5..51fb69d17 100644 --- a/views/default/object/plugin/advanced.php +++ b/views/default/object/plugin/advanced.php @@ -5,11 +5,15 @@ * This file renders a plugin for the admin screen, including active/deactive, * manifest details & display plugin settings. * + * @uses $vars['entity'] + * @uses $vars['display_reordering'] Do we display the priority reordering links? + * * @package Elgg.Core * @subpackage Plugins */ $plugin = $vars['entity']; +$reordering = elgg_extract('display_reordering', $vars, false); $priority = $plugin->getPriority(); $active = $plugin->isActive(); @@ -24,60 +28,67 @@ $token = generate_action_token($ts); // build reordering links $links = ''; -// top and up link only if not at top -if ($priority > 1) { - $top_url = elgg_http_add_url_query_elements($actions_base . 'set_priority', array( - 'plugin_guid' => $plugin->guid, - 'priority' => 'first', - 'is_action' => true - )); +if ($reordering) { + $draggable = 'elgg-state-draggable'; - $links .= "<li>" . elgg_view('output/url', array( - 'href' => $top_url, - 'text' => elgg_echo('top'), - 'is_action' => true - )) . "</li>"; + // top and up link only if not at top + if ($priority > 1) { + $top_url = elgg_http_add_url_query_elements($actions_base . 'set_priority', array( + 'plugin_guid' => $plugin->guid, + 'priority' => 'first', + 'is_action' => true + )); - $up_url = elgg_http_add_url_query_elements($actions_base . 'set_priority', array( - 'plugin_guid' => $plugin->guid, - 'priority' => '-1', - 'is_action' => true - )); + $links .= "<li>" . elgg_view('output/url', array( + 'href' => $top_url, + 'text' => elgg_echo('top'), + 'is_action' => true + )) . "</li>"; - $links .= "<li>" . elgg_view('output/url', array( - 'href' => $up_url, - 'text' => elgg_echo('up'), - 'is_action' => true - )) . "</li>"; -} + $up_url = elgg_http_add_url_query_elements($actions_base . 'set_priority', array( + 'plugin_guid' => $plugin->guid, + 'priority' => '-1', + 'is_action' => true + )); -// down and bottom links only if not at bottom -if ($priority < $max_priority) { - $down_url = elgg_http_add_url_query_elements($actions_base . 'set_priority', array( - 'plugin_guid' => $plugin->guid, - 'priority' => '+1', - 'is_action' => true - )); + $links .= "<li>" . elgg_view('output/url', array( + 'href' => $up_url, + 'text' => elgg_echo('up'), + 'is_action' => true + )) . "</li>"; + } - $links .= "<li>" . elgg_view('output/url', array( - 'href' => $down_url, - 'text' => elgg_echo('down'), - 'is_action' => true - )) . "</li>"; + // down and bottom links only if not at bottom + if ($priority < $max_priority) { + $down_url = elgg_http_add_url_query_elements($actions_base . 'set_priority', array( + 'plugin_guid' => $plugin->guid, + 'priority' => '+1', + 'is_action' => true + )); - $bottom_url = elgg_http_add_url_query_elements($actions_base . 'set_priority', array( - 'plugin_guid' => $plugin->guid, - 'priority' => 'last', - 'is_action' => true - )); + $links .= "<li>" . elgg_view('output/url', array( + 'href' => $down_url, + 'text' => elgg_echo('down'), + 'is_action' => true + )) . "</li>"; + + $bottom_url = elgg_http_add_url_query_elements($actions_base . 'set_priority', array( + 'plugin_guid' => $plugin->guid, + 'priority' => 'last', + 'is_action' => true + )); - $links .= "<li>" . elgg_view('output/url', array( - 'href' => $bottom_url, - 'text' => elgg_echo('bottom'), - 'is_action' => true - )) . "</li>"; + $links .= "<li>" . elgg_view('output/url', array( + 'href' => $bottom_url, + 'text' => elgg_echo('bottom'), + 'is_action' => true + )) . "</li>"; + } +} else { + $draggable = 'elgg-state-undraggable'; } + // activate / deactivate links // always let them deactivate @@ -178,12 +189,14 @@ if ($files) { ?> -<div class="elgg-state-draggable elgg-plugin <?php echo $active_class ?>" id="elgg-plugin-<?php echo $plugin->guid; ?>"> +<div class="<?php echo $draggable; ?> elgg-plugin <?php echo $active_class ?>" id="elgg-plugin-<?php echo $plugin->guid; ?>"> <div class="elgg-image-block"> <div class="elgg-image-alt"> + <?php if ($links) : ?> <ul class="elgg-menu elgg-menu-metadata"> - <?php echo "$links"; ?> + <?php echo $links; ?> </ul> + <?php endif; ?> <div class="clearfloat right mtm"> <?php echo $action_button; ?> </div> diff --git a/views/default/object/plugin/elements/dependencies.php b/views/default/object/plugin/elements/dependencies.php index f4d1ccc5a..5f4aa4392 100644 --- a/views/default/object/plugin/elements/dependencies.php +++ b/views/default/object/plugin/elements/dependencies.php @@ -20,7 +20,7 @@ foreach ($columns as $column) { echo "<th class=\"pas\">$column</th>"; } -echo '<tr/>'; +echo '</tr>'; $row = 'odd'; foreach ($deps as $dep) { diff --git a/views/default/output/location.php b/views/default/output/location.php new file mode 100644 index 000000000..e3619d2e1 --- /dev/null +++ b/views/default/output/location.php @@ -0,0 +1,14 @@ +<?php +/** + * Display a location + * + * @uses $vars['entity'] The ElggEntity that has a location + * @uses $vars['value'] The location string if the entity is not passed + */ + +if (isset($vars['entity'])) { + $vars['value'] = $vars['entity']->location; + unset($vars['entity']); +} + +echo elgg_view('output/tag', $vars); diff --git a/views/default/output/tag.php b/views/default/output/tag.php new file mode 100644 index 000000000..abae9c4b2 --- /dev/null +++ b/views/default/output/tag.php @@ -0,0 +1,30 @@ +<?php +/** + * Elgg single tag output + * + * @uses $vars['value'] String + * @uses $vars['type'] The entity type, optional + * @uses $vars['subtype'] The entity subtype, optional + * + */ + +if (!empty($vars['subtype'])) { + $subtype = "&subtype=" . urlencode($vars['subtype']); +} else { + $subtype = ""; +} +if (!empty($vars['object'])) { + $object = "&object=" . urlencode($vars['object']); +} else { + $object = ""; +} + +if (isset($vars['value'])) { + if (!empty($vars['type'])) { + $type = "&type={$vars['type']}"; + } else { + $type = ""; + } + $url = elgg_get_site_url() . 'search?q=' . urlencode($vars['value']) . "&search_type=tags{$type}{$subtype}{$object}"; + echo elgg_view('output/url', array('href' => $url, 'text' => $vars['value'], 'rel' => 'tag')); +} diff --git a/views/default/output/tags.php b/views/default/output/tags.php index 57cb21ea7..6dedfacc7 100644 --- a/views/default/output/tags.php +++ b/views/default/output/tags.php @@ -10,7 +10,7 @@ */ if (isset($vars['entity'])) { - $defaults['value'] = $vars['entity']->tags; + $vars['tags'] = $vars['entity']->tags; unset($vars['entity']); } diff --git a/views/default/page/components/summary.php b/views/default/page/components/summary.php index 578e9b9cf..ea61a6e4b 100644 --- a/views/default/page/components/summary.php +++ b/views/default/page/components/summary.php @@ -1,53 +1,4 @@ <?php -/** - * List body - * - * Sample output - * <ul class="elgg-menu elgg-menu-metadata"><li>Public</li><li>Like this</li></ul> - * <h3><a href="">Title</a></h3> - * <p class="elgg-subtext">Posted 3 hours ago by George</p> - * <p class="elgg-tags"><a href="">one</a>, <a href="">two</a></p> - * <div class="elgg-list-content">Excerpt text</div> - * - * @uses $vars['entity'] ElggEntity - * @uses $vars['title'] Title link (optional) false = no title, '' = default - * @uses $vars['metadata'] HTML for entity metadata and actions (optional) - * @uses $vars['subtitle'] HTML for the subtitle (optional) - * @uses $vars['tags'] HTML for the tags (optional) - * @uses $vars['content'] HTML for the entity content (optional) - */ -$entity = $vars['entity']; - -$title_link = elgg_extract('title', $vars, ''); -if ($title_link === '') { - if (isset($entity->title)) { - $text = $entity->title; - } else { - $text = $entity->name; - } - $params = array( - 'text' => $text, - 'href' => $entity->getURL(), - ); - $title_link = elgg_view('output/url', $params); -} - -$metadata = elgg_extract('metadata', $vars, ''); -$subtitle = elgg_extract('subtitle', $vars, ''); -$content = elgg_extract('content', $vars, ''); - -$tags = elgg_extract('tags', $vars, ''); -if ($tags !== false) { - $tags = elgg_view('output/tags', array('tags' => $entity->tags)); -} - -if ($metadata) { - echo $metadata; -} -echo "<h3>$title_link</h3>"; -echo "<div class=\"elgg-subtext\">$subtitle</div>"; -echo $tags; -if ($content) { - echo "<div class=\"elgg-list-content\">$content</div>"; -} +// Deprecated in favor of type/elements/summary +echo elgg_view('object/elements/summary', $vars); diff --git a/views/default/page/default.php b/views/default/page/default.php index 9effce1ec..0e27cda52 100644 --- a/views/default/page/default.php +++ b/views/default/page/default.php @@ -17,7 +17,7 @@ if (elgg_get_context() == 'admin') { elgg_deprecated_notice("admin plugins should route through 'admin'.", 1.8); elgg_admin_add_plugin_settings_menu(); elgg_unregister_css('elgg'); - echo elgg_view('page/shells/admin', $vars); + echo elgg_view('page/admin', $vars); return true; } diff --git a/views/default/page/layouts/widgets/add_panel.php b/views/default/page/layouts/widgets/add_panel.php index 2786e83b2..9eb78cdb6 100644 --- a/views/default/page/layouts/widgets/add_panel.php +++ b/views/default/page/layouts/widgets/add_panel.php @@ -12,6 +12,7 @@ $context = $vars['context']; $exact = elgg_extract('exact_match', $vars, false); $widget_types = elgg_get_widget_types($context, $exact); +uasort($widget_types, create_function('$a,$b', 'return strcmp($a->name,$b->name);')); $current_handlers = array(); foreach ($widgets as $column_widgets) { diff --git a/views/default/river/user/default/profileiconupdate.php b/views/default/river/user/default/profileiconupdate.php new file mode 100644 index 000000000..a723c5335 --- /dev/null +++ b/views/default/river/user/default/profileiconupdate.php @@ -0,0 +1,13 @@ +<?php +/** + * Update avatar river view + */ +$subject = $vars['item']->getSubjectEntity(); + +$subject_icon = elgg_view_entity_icon($subject, 'tiny'); + +echo elgg_echo("profile:river:iconupdate"); + +echo '<div class="elgg-river-content clearfix">'; +echo $subject_icon; +echo '</div>'; diff --git a/views/default/user/default.php b/views/default/user/default.php index 501949306..c0c18f85f 100644 --- a/views/default/user/default.php +++ b/views/default/user/default.php @@ -51,7 +51,7 @@ if (elgg_get_context() == 'gallery') { ); } - $list_body = elgg_view('page/components/summary', $params); + $list_body = elgg_view('user/elements/summary', $params); echo elgg_view_image_block($icon, $list_body); } diff --git a/views/default/user/elements/summary.php b/views/default/user/elements/summary.php new file mode 100644 index 000000000..46d11c14c --- /dev/null +++ b/views/default/user/elements/summary.php @@ -0,0 +1,13 @@ +<?php +/** + * User summary + * + * @uses $vars['entity'] ElggEntity + * @uses $vars['title'] Title link (optional) false = no title, '' = default + * @uses $vars['metadata'] HTML for entity metadata and actions (optional) + * @uses $vars['subtitle'] HTML for the subtitle (optional) + * @uses $vars['tags'] HTML for the tags (optional) + * @uses $vars['content'] HTML for the entity content (optional) + */ + +echo elgg_view('object/elements/summary', $vars); diff --git a/views/default/widgets/friends/content.php b/views/default/widgets/friends/content.php index 4c5ef5b4a..ec842a252 100644 --- a/views/default/widgets/friends/content.php +++ b/views/default/widgets/friends/content.php @@ -13,12 +13,12 @@ $num = (int) $vars['entity']->num_display; // get the correct size $size = $vars['entity']->icon_size; -$html = $owner->listFriends('', $num, array( - 'size' => $size, - 'gallery' => true, -)); -if ($html) { - echo $html; -} else { - +if (elgg_instanceof($owner, 'user')) { + $html = $owner->listFriends('', $num, array( + 'size' => $size, + 'gallery' => true, + )); + if ($html) { + echo $html; + } } diff --git a/views/installation/install/nav.php b/views/installation/install/nav.php index 5426071c6..76bd2ac50 100644 --- a/views/installation/install/nav.php +++ b/views/installation/install/nav.php @@ -27,7 +27,7 @@ if (isset($vars['advance']) && !$vars['advance']) { echo <<<___END -<div class="install-nav"> +<div class="elgg-install-nav"> $next $refresh </div> diff --git a/views/installation/install/pages/complete.php b/views/installation/install/pages/complete.php index 0c9821fc2..2f5a04854 100644 --- a/views/installation/install/pages/complete.php +++ b/views/installation/install/pages/complete.php @@ -7,7 +7,7 @@ echo autop(elgg_echo('install:complete:instructions')); ?> -<div class="install-nav"> +<div class="elgg-install-nav"> <?php $url = elgg_get_site_url() . $vars['destination']; $text = elgg_echo('install:complete:gotosite'); |