diff options
author | Brett Profitt <brett.profitt@gmail.com> | 2011-09-29 18:16:03 -0700 |
---|---|---|
committer | Brett Profitt <brett.profitt@gmail.com> | 2011-09-29 18:16:03 -0700 |
commit | bfdb9bb8a87a29038ba1ae25355684ae19678fdd (patch) | |
tree | a074e2d6bfa19c17b284c3950b4555cf584eabe2 | |
parent | 7be23080f34a8f92ca1f8d49c3aa0e6ce3472f4c (diff) | |
parent | a458ae4e0f8e5b19884860fead6e5f901b95eca4 (diff) | |
download | elgg-bfdb9bb8a87a29038ba1ae25355684ae19678fdd.tar.gz elgg-bfdb9bb8a87a29038ba1ae25355684ae19678fdd.tar.bz2 |
Merge branch 'master' of github.com:brettp/Elgg
150 files changed, 2269 insertions, 1273 deletions
diff --git a/.gitignore b/.gitignore index 1540c7db6..edfede73b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,40 @@ -engine/settings.php +/engine/settings.php /.htaccess /.buildpath /.settings /.project +/mod/* +!/mod/blog/ +!/mod/bookmarks/ +!/mod/categories/ +!/mod/custom_index/ +!/mod/dashboard/ +!/mod/developers/ +!/mod/diagnostics/ +!/mod/embed/ +!/mod/externalpages/ +!/mod/file/ +!/mod/garbagecollector/ +!/mod/groups/ +!/mod/htmlawed/ +!/mod/invitefriends/ +!/mod/likes/ +!/mod/logbrowser/ +!/mod/logrotate/ +!/mod/members/ +!/mod/messageboard/ +!/mod/messages/ +!/mod/notifications/ +!/mod/oauth_api/ +!/mod/pages/ +!/mod/profile/ +!/mod/reportedcontent/ +!/mod/search/ +!/mod/tagcloud/ +!/mod/thewire/ +!/mod/tinymce/ +!/mod/twitter/ +!/mod/twitter_api/ +!/mod/uservalidationbyemail/ +!/mod/zaudio/ + diff --git a/CHANGES.txt b/CHANGES.txt index 779ad4236..2df4d2637 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,47 +1,122 @@ Version 1.8.0 (Jackie) -(??? from http://code.elgg.org/branches/1.8/) +(September 5th, 2011 from git://github.com/Elgg/Elgg.git) + + Notes: + Elgg 1.8 contains the most changes in Elgg since the transition from Elgg + 0.9 to Elgg 1.0. The core team tried to make the transition as smooth as + possible, but in the interest of following standards and simplifying the + development process for core and third party developers, we have made + changes that will require updating plugins. We believe these changes + will help Elgg development be easier for everyone. + + It is unreasonable and unhelpful to list the full details of all changes in + this file. Instead, we will list the high level, overarching changes to + systems. If you are interested in the specifics, Elgg 1.8's source code is + highly documented and serves as a good guide and the git commit log can + provide excruciating details of what has changed between 1.7 and 1.8. + + Please post your feedback, questions, and comments to the community site + at http://community.elgg.org. As always, thank you for using Elgg! + + --The Elgg Core Development Team + + A tip about updating plugins: + It's not difficult to update 1.7 plugins for 1.8. There is a detailed + document outlining this process on the wiki: + http://docs.elgg.org/wiki/Updating_plugins_for_Elgg_1.8 + + The basic process is: + 1. Clean up the plugin to make sure it conforms to coding standards, + official structure, and best practices. + 2. Update any uses of deprecated functions. Functions deprecated in 1.7 will + produce visible notices in 1.8! + 3. Use the new manifest format. + 4. Use the new menu functions. + 5. Use the new JS features. + 6. Update the views to use core CSS helper functions and classes instead of + writing your own. + + The documentation directory and the wiki has more information. User-visible changes: * New default theme. - * Separated admin interface. + * New installation. + * Separate and updated admin interface. + * Updated plugin themes. Generic API changes: - * Added elgg_instanceof(). - * Added remove_subtype() and update_subtype(). - * Added elgg_format_url(). - * ElggDiskFilestore supports non-user owners. - - Deprecated APIs: - * ElggAccess::get_ignore_access() by ElggAccess::getIgnoreAccess(). - * ElggAccess::set_ignore_access() by ElggAccess::setIgnoreAccess(). - * ElggCache::set_variable() by ElggCache::setVariable(). - * ElggCache::get_variable() by ElggCache::getVariable(). - * ElggDiskFilestore::make_directory_root() by ElggDiskFilestore::makeDirectoryRoot(). - * ElggDiskFilestore::make_file_matrix() and ElggDiskFilestore::user_file_matrix() by - ElggDiskFilestore::makeFileMatrix(). - * ElggDiskFilestore::mb_string_split() removed. - * ElggEntity::initialise_attriutes() by ElggEntity::initializeAttributes(). Same for - all sub classes of ElggEntity. - * ElggFileCache::create_file() by ::createFile(). - * ElggFileCache::sanitise_filename() by ::sanitizeFilename(). - * ElggMemcache::make_memcache_key() by ::_makeMemcacheKey(). - * ElggGroup::initialise_attributes() by ::initializeAttributes(). - * ElggPlugin::initialise_attributes() by ::initializeAttributes(). - * XMLRPCCall::parse() by XMLRPCCALL::_parse(). - * __get_annotations_calculate_x() by get_annotations_calculate_x(). - * __get_entities_from_annotations_calculate_x() by get_entities_from_annotations_calculate_x(). - * __php_api_error_handler() by _php_api_error_handler(). - * __php_api_exception_handler() by _php_api_exception_handler(). - * __elgg_php_error_handler() by _elgg_php_error_handler(). - * __elgg_php_exception_handler() by _elgg_php_exception_handler(). - * __process_element() by _process_element(). - * All __elgg_session_*() by _elgg_session_*(). - - UI/UX API changes: - * Added elgg_push_breadcrumb(), elgg_pop_breadcrumb(), and elgg_get_breadcrumbs(). - * Added navigation/breadcrumbs. - * Added sticky form support with elgg_make_sticky_form(), - elgg_clear_sticky_form(), elgg_is_sticky_form(), and elgg_get_sticky_value(). + * Improved the markup and CSS. + * Restructured and simplified the views layouts. + * Added a new menu system. + * Added new CSS and JS file registration functions. + * Added a JS engine. + * Added a breadcrumb system. + * Added a sticky forms system. + + New plugins: + * Dashboard - The activity stream is now the default index page. A 1.7-style + dashboard is provided through the dashboard plugin. + * Developers Plugins - Developer tools. + * Likes - Allows users to "like" other users' content. + * oAuth API - A generic, reusable oAuth library. + * Tag Cloud - A widget-based tag cloud generator. + * Twitter API - A generic Twitter library that allows signin with Twitter + and pushing content to tweets. Replaces twitter_service. + + Deprecated plugins: + * captcha - Captchas have long since stopped being useful as a deterrent + against spam. + * crontrigger - Real cron should be used. + * default_widgets - This functionality is now part of core. + * friends - This functionality is now part of core. + * riverdashboard - Displaying the river (activity stream) is default in + core. The original dashboard can be restored by the new Dashboard plugin. + * twitter_service - Replaced by Twitter API. + + Elgg 1.8.0.1 was released immediately after 1.8.0 to correct a problem in + installation. + + +Previous and Merged Changes: + +Version 1.7.11 +(August 15, 2011 from http://github.com/Elgg/elgg) + + Security Enhancements: + * Fixed possible XSS vector in the embed plugin. Thanks to Aung Khant from YEHG for the report. + * Fixed possible SQL exposure exploit in the search plugin. Thanks again to Aung Khant. + * Fixed possible SQL injection vector in the search plugin. Thanks to Lostmon Lords for the report. + + Bugfixes: + * Filtering by content works in the dashboard again. + * Dragging widgets works in IE9. + + API Changes: + * Deleting a container will delete all contained objects regardless of access_id. + * setLocation() and setLatLong() no longer double escapes strings. + * Calling elgg_list_entities() with count set no longer breaks the display. + + +Version 1.7.10 +(June 14, 2011 from http://code.elgg.org/branches/1.7) + + Security Enhancements: + * Changes to prevent numerous reflected cross site scripting vectors. Thanks to Aung Khant for + the reports! + + Enhancements: + * Banned users are more apparent in user lists and profiles. + + Bugfixes: + * TinyMCE: Using Elgg's default font to prevent small font sizes. + * Files: Optimizations to allow uploading and downloading larger files. + * Fixed bugs preventing users from adding and removing friends in Friends Collections. + * $CONFIG->lastcache is correctly set for pages that regenerate the cache. + + API Changes: + * Added unit tests for access collections. + * Added can_edit_access_collection(). + * Access collection functions no longer check permissions. Do this in actions instead. Version 1.7.9 @@ -264,13 +339,13 @@ Version 1.7.1 * Tag search works in groups and members. * Tag clouds correctly link to tag search. * RSS views added to search. - * Wrapper function for get_entities() correctly rewrites container_guid to + * Wrapper function for get_entities() correctly rewrites container_guid to owner_guid. * output/url correctly appends http:// again. * full_url() urlencode()'s ' and " to avoid a security problem in IE. - + API changes: - * Moved admin flag to users_entity table and added ElggUser->isAdmin(), + * Moved admin flag to users_entity table and added ElggUser->isAdmin(), ->makeAdmin(), and ->removeAdmin() to replace the metadata. * Plugin hook for reported content includes the report object. * UTF8 upgrade checks server defaults before running to avoid @@ -339,4 +414,4 @@ Version 1.7.0 * New plugin hook rest:init so plugins can configure authentication modules * Moved auth.gettoken to POST for increased security * Fixed REST POST bug #1114 - * Fixed #881, #1214, #1215, #1216, #1217, #1218, #1219, #1220, #1298, #1364 + * Fixed #881, #1214, #1215, #1216, #1217, #1218, #1219, #1220, #1298, #1364 diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index 5bab98530..75eb016c2 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -2,7 +2,7 @@ The following have made notable contributions to the Elgg Project. (List in alphabetical order.) -Cash Costello - http://cashcostello.com/ +Cash Costello - cash@elgg.org, http://cashcostello.com/ Pete Harris - http://www.peteharris.co.uk/ @@ -14,7 +14,7 @@ Jon Maul - MITRE http://www.mitre.org/ Marcus Povey - http://marcuspovey.co.uk/ -Brett Profitt - brett.profitt@gmail.com, http://twitter.com/brettprofitt +Brett Profitt - brett@elgg.org, http://twitter.com/brettprofitt Nathan Rackliffe - MITRE http://mitre.org/ @@ -28,4 +28,4 @@ Ben Werdmuller - http://benwerd.com/ Nicholas Whitt - nick.whitt@gmail.com, http://twitter.com/nogoodnick -Evan Winslow - http://evanwinslow.com/ +Evan Winslow - evan@elgg.org, http://evanwinslow.com/ diff --git a/README.txt b/README.txt index 4ab2b563a..0d4015238 100644 --- a/README.txt +++ b/README.txt @@ -3,14 +3,22 @@ Copyright (c) 2008-2010 See COPYRIGHT.txt See CONTRIBUTORS.txt for development credits. -The Elgg project was started in 2004 by: -Ben Werdmuller <ben@benwerd.com, http://benwerd.com> and -Dave Tosh <davidgtosh@gmail.com> +Elgg is managed by the Elgg Foundation, a nonprofit organization that was +founded to govern, protect, and promote the Elgg open source social network +engine. The Foundation aims to provide a stable, commercially and +individually independent organization that moves in the best interest of Elgg +as an open source project. The project site can be found at http://elgg.org/ +The Elgg project was started in 2004 by: +Ben Werdmuller <ben@benwerd.com, http://benwerd.com> and +Dave Tosh <davidgtosh@gmail.com> + Elgg is released under the GNU Public License (GPL) Version 2 and the Massachusetts Institute of Technology (MIT) License. See LICENSE.txt in the root of the package you downloaded. -For installation instructions, please see the INSTALL.txt file. +For installation instructions, see INSTALL.txt. + +For upgrade instructions, see UPGRADE.txt.
\ No newline at end of file diff --git a/UPGRADE.txt b/UPGRADE.txt index 032d285e9..0f1cd2ba3 100644 --- a/UPGRADE.txt +++ b/UPGRADE.txt @@ -1,19 +1,69 @@ +Elgg Upgrade Instructions +========================= -ELGG UPGRADE INSTRUCTIONS +Note: Upgrades are one way--You cannot downgrade once you run the upgrade + script. Always back up your database, code, and data directory + before upgrading! -1. Backup your Elgg database and code -2. Download the new version of Elgg from elgg.org. +Upgrading from Elgg 1.7 to 1.8. +---------------------------------------------------- -3. Overwrite your existing Elgg files. Any modifications should - have been written within plugins, so that they are not lost - on overwriting. If this is not the case, take care to - maintain your modifications, although Elgg is not guaranteed - to work correctly in this instance. +1. Back up your Elgg database, code, and data directory. -4. Visit http://your-elgg-site-URL/upgrade.php +2. Download the latest version of Elgg from http://elgg.org/. -5. Copy htaccess_dist to .htaccess, replacing your existing version. - Any modifications to the original .htaccess should be moved to the - new .htaccess file. +3. Identify and save any changes to core files. Pay special attention to + the views and actions directories. You will need to put these changes + in plugins once you have installed Elgg 1.8. +3. Delete the following directories in the Elgg root on your server: + * _css + * account + * actions + * admin + * dashboard + * entities + * friends + * search + * settings + * simplecache + * views + +4. Delete the following core plugins from the Elgg mod directory. These + plugins are deprecated and no longer supported by Elgg's core developers. + If you modified these plugins, you will need to upgrade the plugin to work + in Elgg 1.8. + * captcha + * crontrigger + * default_widgets + * friends + * riverdashboard + * twitter_service + +5. Upload and overwrite your existing Elgg files with the Elgg 1.8 files. + +6. Copy htaccess_dist to .htaccess, replacing your existing version. Any + modifications to the original .htaccess should be moved to the new + .htaccess file. + +7. Visit http://your-elgg-site/upgrade.php + + +Upgrading to the latest release +----------------------------------------- + +1. Back up your Elgg database, code, and data directory. + +2. Download the latest version of Elgg from http://elgg.org/. + +3. Upload and overwrite your existing Elgg files. Any modifications should + have been written within plugins so that they are not lost. If this is + not the case, take care to maintain your modifications. If you have + modified core files, Elgg may not work correctly. + +4. Copy htaccess_dist to .htaccess, replacing your existing version. Any + modifications to the original .htaccess should be moved to the new + .htaccess file. + +5. Visit http://your-elgg-site/upgrade.php diff --git a/_graphics/elgg_sprites.png b/_graphics/elgg_sprites.png Binary files differindex 703ff0c81..02b452d94 100644 --- a/_graphics/elgg_sprites.png +++ b/_graphics/elgg_sprites.png diff --git a/actions/admin/plugins/activate.php b/actions/admin/plugins/activate.php index 5a945e8eb..0049878e3 100644 --- a/actions/admin/plugins/activate.php +++ b/actions/admin/plugins/activate.php @@ -47,5 +47,10 @@ if (count($activated_guids) === 1) { $plugin = get_entity($plugin_guids[0]); forward("$url#{$plugin->getID()}"); } else { - forward(REFERER); + // forward to top of page with a failure so remove any #foo + $url = $_SERVER['HTTP_REFERER']; + if (strpos($url, '#')) { + $url = substr(0, strpos($url, '#')); + } + forward($url); }
\ No newline at end of file diff --git a/actions/friends/collections/add.php b/actions/friends/collections/add.php index 8ec6a085f..1e2bc1d5c 100644 --- a/actions/friends/collections/add.php +++ b/actions/friends/collections/add.php @@ -9,28 +9,24 @@ $collection_name = get_input('collection_name'); $friends = get_input('friends_collection'); -//first check to make sure that a collection name has been set and create the new colection -if ($collection_name) { +if (!$collection_name) { + register_error(elgg_echo("friends:nocollectionname")); + forward(REFERER); +} - //create the collection - $create_collection = create_access_collection($collection_name, elgg_get_logged_in_user_guid()); +$id = create_access_collection($collection_name); - //if the collection was created and the user passed some friends from the form, add them - if ($create_collection && (!empty($friends))) { - //add friends to the collection - foreach ($friends as $friend) { - add_user_to_access_collection($friend, $create_collection); - } +if ($id) { + $result = update_access_collection($id, $friends); + if ($result) { + system_message(elgg_echo("friends:collectionadded")); + // go to the collections page + forward("pg/collections/" . get_loggedin_user()->username); + } else { + register_error(elgg_echo("friends:nocollectionname")); + forward(REFERER); } - - // Success message - system_message(elgg_echo("friends:collectionadded")); - // Forward to the collections page - forward("collections/" . elgg_get_logged_in_user_entity()->username); - } else { register_error(elgg_echo("friends:nocollectionname")); - - // Forward to the add collection page - forward("collections/add"); -} + forward(REFERER); +}
\ No newline at end of file diff --git a/actions/friends/collections/delete.php b/actions/friends/collections/delete.php index fe719d74b..ff8f1fb55 100644 --- a/actions/friends/collections/delete.php +++ b/actions/friends/collections/delete.php @@ -8,29 +8,16 @@ $collection_id = (int) get_input('collection'); -// Check to see that the access collection exist and grab its owner -$get_collection = get_access_collection($collection_id); - -if ($get_collection) { - - if ($get_collection->owner_guid == elgg_get_logged_in_user_guid()) { - - $delete_collection = delete_access_collection($collection_id); +// check the ACL exists and we can edit +if (!can_edit_access_collection($collection_id)) { + register_error(elgg_echo("friends:collectiondeletefailed")); + forward(REFERER); +} - // Success message - if ($delete_collection) { - system_message(elgg_echo("friends:collectiondeleted")); - } else { - register_error(elgg_echo("friends:collectiondeletefailed")); - } - } else { - // Failure message - register_error(elgg_echo("friends:collectiondeletefailed")); - } +if (delete_access_collection($collection_id)) { + system_message(elgg_echo("friends:collectiondeleted")); } else { - // Failure message register_error(elgg_echo("friends:collectiondeletefailed")); } -// Forward to the collections page -forward("collections/" . elgg_get_logged_in_user_entity()->username); +forward(REFERER); diff --git a/actions/friends/collections/edit.php b/actions/friends/collections/edit.php index b7fb716f2..9eb5e1eab 100644 --- a/actions/friends/collections/edit.php +++ b/actions/friends/collections/edit.php @@ -9,7 +9,15 @@ $collection_id = get_input('collection_id'); $friends = get_input('friend'); -//chech the collection exists and the current user owners it -update_access_collection($collection_id, $friends); +// check it exists and we can edit +if (!can_edit_access_collection($collection_id)) { + system_message(elgg_echo('friends:collection:edit_failed')); +} -exit; +if (update_access_collection($collection_id, $friends)) { + system_message(elgg_echo('friends:collections:edited')); +} else { + system_message(elgg_echo('friends:collection:edit_failed')); +} + +forward(REFERER);
\ No newline at end of file diff --git a/engine/classes/ElggEntity.php b/engine/classes/ElggEntity.php index 6edc99dd4..2fa0d7b02 100644 --- a/engine/classes/ElggEntity.php +++ b/engine/classes/ElggEntity.php @@ -371,13 +371,18 @@ abstract class ElggEntity extends ElggData implements * Deletes all metadata on this object (metadata.entity_guid = $this->guid). * If you pass a name, only metadata matching that name will be deleted. * - * @warning Calling this with no or empty arguments will clear all metadata on the entity. + * @warning Calling this with no $name will clear all metadata on the entity. * - * @param null|string $name The metadata name to remove. + * @param null|string $name The name of the metadata to remove. * @return bool * @since 1.8 */ public function deleteMetadata($name = null) { + + if (!$this->guid) { + return false; + } + $options = array( 'guid' => $this->guid, 'limit' => 0 @@ -1432,11 +1437,7 @@ abstract class ElggEntity extends ElggData implements * @return true */ public function setLocation($location) { - $location = sanitise_string($location); - - $this->location = $location; - - return true; + return $this->location = $location; } /** @@ -1449,9 +1450,6 @@ abstract class ElggEntity extends ElggData implements * @todo Unimplemented */ public function setLatLong($lat, $long) { - $lat = sanitise_string($lat); - $long = sanitise_string($long); - $this->set('geo:lat', $lat); $this->set('geo:long', $long); diff --git a/engine/classes/ElggMenuItem.php b/engine/classes/ElggMenuItem.php index cfdc2f5fa..b9c81fd78 100644 --- a/engine/classes/ElggMenuItem.php +++ b/engine/classes/ElggMenuItem.php @@ -59,7 +59,7 @@ class ElggMenuItem { /** * @var string Tooltip */ - protected $title = ''; + protected $title = false; /** * @var string The string to display if link is clicked @@ -543,7 +543,7 @@ class ElggMenuItem { if ($this->data['linkClass']) { if (isset($vars['class'])) { - $vars['class'] += $this->getLinkClass(); + $vars['class'] = $vars['class'] . ' ' . $this->getLinkClass(); } else { $vars['class'] = $this->getLinkClass(); } @@ -552,6 +552,8 @@ class ElggMenuItem { if ($this->confirm) { $vars['confirm'] = $this->confirm; return elgg_view('output/confirmlink', $vars); + } else { + unset($vars['confirm']); } return elgg_view('output/url', $vars); diff --git a/engine/classes/ElggPluginManifest.php b/engine/classes/ElggPluginManifest.php index 0f3b1d7a8..0e47f388d 100644 --- a/engine/classes/ElggPluginManifest.php +++ b/engine/classes/ElggPluginManifest.php @@ -224,20 +224,15 @@ class ElggPluginManifest { /** * Returns the plugin name * - * @param bool $elgg_echo Run the name through elgg_echo. * @return string */ - public function getName($elgg_echo = true) { + public function getName() { $name = $this->parser->getAttribute('name'); if (!$name && $this->pluginID) { $name = ucwords(str_replace('_', ' ', $this->pluginID)); } - if ($elgg_echo) { - $name = elgg_echo($name); - } - return $name; } @@ -245,33 +240,21 @@ class ElggPluginManifest { /** * Return the description * - * @param bool $elgg_echo Run the description through elgg_echo. * @return string */ - public function getDescription($elgg_echo = true) { - $desc = $this->parser->getAttribute('description'); - - if ($elgg_echo) { - return elgg_echo($desc); - } else { - return $desc; - } + public function getDescription() { + return $this->parser->getAttribute('description'); } /** * Return the short description * - * @param bool $elgg_echo Run the blurb through elgg_echo. * @return string */ - public function getBlurb($elgg_echo = true) { + public function getBlurb() { $blurb = $this->parser->getAttribute('blurb'); - if ($blurb) { - if ($elgg_echo) { - $blurb = elgg_echo($blurb); - } - } else { + if (!$blurb) { $blurb = elgg_get_excerpt($this->getDescription()); } @@ -348,10 +331,9 @@ class ElggPluginManifest { /** * Return the screenshots listed. * - * @param bool $elgg_echo Run the screenshot's description through elgg_echo. * @return array */ - public function getScreenshots($elgg_echo = true) { + public function getScreenshots() { $ss = $this->parser->getAttribute('screenshot'); if (!$ss) { @@ -360,13 +342,7 @@ class ElggPluginManifest { $normalized = array(); foreach ($ss as $s) { - $normalized_s = $this->buildStruct($this->screenshotStruct, $s); - - if ($elgg_echo) { - $normalized_s['description'] = elgg_echo($normalized_s['description']); - } - - $normalized[] = $normalized_s; + $normalized[] = $this->buildStruct($this->screenshotStruct, $s); } return $normalized; diff --git a/engine/classes/ElggPluginPackage.php b/engine/classes/ElggPluginPackage.php index 977b72d76..02b985285 100644 --- a/engine/classes/ElggPluginPackage.php +++ b/engine/classes/ElggPluginPackage.php @@ -334,7 +334,11 @@ class ElggPluginPackage { // first, check if any active plugin conflicts with us. foreach ($enabled_plugins as $plugin) { - $temp_conflicts = $plugin->getManifest()->getConflicts(); + $temp_conflicts = array(); + $temp_manifest = $plugin->getManifest(); + if ($temp_manifest instanceof ElggPluginManifest) { + $temp_conflicts = $plugin->getManifest()->getConflicts(); + } foreach ($temp_conflicts as $conflict) { if ($conflict['type'] == 'plugin' && $conflict['name'] == $this_id) { $result = $this->checkDepPlugin($conflict, $enabled_plugins, false); diff --git a/engine/handlers/cache_handler.php b/engine/handlers/cache_handler.php index 7d6f42dc3..94a0e64e9 100644 --- a/engine/handlers/cache_handler.php +++ b/engine/handlers/cache_handler.php @@ -64,7 +64,7 @@ $view = $matches[3]; switch ($type) { case 'css': header("Content-type: text/css", true); - header('Expires: ' . date('r', time() + 86400000), true); + header('Expires: ' . date('r', strtotime("+6 months")), true); header("Pragma: public", true); header("Cache-Control: public", true); @@ -72,7 +72,7 @@ switch ($type) { break; case 'js': header('Content-type: text/javascript', true); - header('Expires: ' . date('r', time() + 864000000), true); + header('Expires: ' . date('r', strtotime("+6 months")), true); header("Pragma: public", true); header("Cache-Control: public", true); diff --git a/engine/lib/access.php b/engine/lib/access.php index cde3d256f..6da747463 100644 --- a/engine/lib/access.php +++ b/engine/lib/access.php @@ -410,6 +410,43 @@ function get_write_access_array($user_id = 0, $site_id = 0, $flush = false) { return $tmp_access_array; } + +/** + * Can the user write to the access collection? + * + * Hook into the access:collections:write, user to change this. + * + * Respects access control disabling for admin users and {@see elgg_set_ignore_access()} + * + * @see get_write_access_array() + * + * @param int $collection_id The collection id + * @param mixed $user_guid The user GUID to check for. Defaults to logged in user. + * @return bool + */ +function can_edit_access_collection($collection_id, $user_guid = null) { + if ($user_guid) { + $user = get_entity((int) $user_guid); + } else { + $user = get_loggedin_user(); + } + + $collection = get_access_collection($collection_id); + + if (!($user instanceof ElggUser) || !$collection) { + return false; + } + + $write_access = get_write_access_array($user->getGUID(), null, true); + + // don't ignore access when checking users. + if ($user_guid) { + return array_key_exists($collection_id, $write_access); + } else { + return elgg_get_ignore_access() || array_key_exists($collection_id, $write_access); + } +} + /** * Creates a new access collection. * @@ -483,37 +520,30 @@ function create_access_collection($name, $owner_guid = 0, $site_guid = 0) { function update_access_collection($collection_id, $members) { global $CONFIG; - $collection_id = (int) $collection_id; - $members = (is_array($members)) ? $members : array(); + $acl = get_access_collection($collection_id); - $collections = get_write_access_array(); - - if (array_key_exists($collection_id, $collections)) { - $cur_members = get_members_of_access_collection($collection_id, true); - $cur_members = (is_array($cur_members)) ? $cur_members : array(); + if (!$acl) { + return false; + } + $members = (is_array($members)) ? $members : array(); - $remove_members = array_diff($cur_members, $members); - $add_members = array_diff($members, $cur_members); + $cur_members = get_members_of_access_collection($collection_id, true); + $cur_members = (is_array($cur_members)) ? $cur_members : array(); - $params = array( - 'collection_id' => $collection_id, - 'members' => $members, - 'add_members' => $add_members, - 'remove_members' => $remove_members - ); + $remove_members = array_diff($cur_members, $members); + $add_members = array_diff($members, $cur_members); - foreach ($add_members as $guid) { - add_user_to_access_collection($guid, $collection_id); - } + $result = true; - foreach ($remove_members as $guid) { - remove_user_from_access_collection($guid, $collection_id); - } + foreach ($add_members as $guid) { + $result = $result && add_user_to_access_collection($guid, $collection_id); + } - return true; + foreach ($remove_members as $guid) { + $result = $result && remove_user_from_access_collection($guid, $collection_id); } - return false; + return $result; } /** @@ -527,27 +557,26 @@ function update_access_collection($collection_id, $members) { * @see update_access_collection() */ function delete_access_collection($collection_id) { + global $CONFIG; + $collection_id = (int) $collection_id; - $collections = get_write_access_array(null, null, TRUE); $params = array('collection_id' => $collection_id); if (!elgg_trigger_plugin_hook('access:collections:deletecollection', 'collection', $params, true)) { return false; } - if (array_key_exists($collection_id, $collections)) { - global $CONFIG; - $query = "delete from {$CONFIG->dbprefix}access_collection_membership" - . " where access_collection_id = {$collection_id}"; - delete_data($query); + // Deleting membership doesn't affect result of deleting ACL. + $q = "DELETE FROM {$CONFIG->dbprefix}access_collection_membership + WHERE access_collection_id = {$collection_id}"; + delete_data($q); - $query = "delete from {$CONFIG->dbprefix}access_collections where id = {$collection_id}"; - delete_data($query); - return true; - } else { - return false; - } + $q = "DELETE FROM {$CONFIG->dbprefix}access_collections + WHERE id = {$collection_id}"; + $result = delete_data($q); + + return $result; } /** @@ -584,45 +613,34 @@ function get_access_collection($collection_id) { * @see remove_user_from_access_collection() */ function add_user_to_access_collection($user_guid, $collection_id) { + global $CONFIG; + $collection_id = (int) $collection_id; $user_guid = (int) $user_guid; - $collections = get_write_access_array(); + $user = get_user($user_guid); - if (!($collection = get_access_collection($collection_id))) { - return false; - } + $collection = get_access_collection($collection_id); - $user = get_user($user_guid); - if (!$user) { + if (!($user instanceof Elgguser) || !$collection) { return false; } - // to add someone to a collection, the user must be a member of the collection or - // no one must own it - if ((array_key_exists($collection_id, $collections) || $collection->owner_guid == 0)) { - $result = true; - } else { - $result = false; - } - $params = array( 'collection_id' => $collection_id, - 'collection' => $collection, 'user_guid' => $user_guid ); - $result = elgg_trigger_plugin_hook('access:collections:add_user', 'collection', $params, $result); + $result = elgg_trigger_plugin_hook('access:collections:add_user', 'collection', $params, true); if ($result == false) { return false; } try { - global $CONFIG; - $query = "insert into {$CONFIG->dbprefix}access_collection_membership" - . " set access_collection_id = {$collection_id}, user_guid = {$user_guid}"; - insert_data($query); + $q = "INSERT INTO {$CONFIG->dbprefix}access_collection_membership + SET access_collection_id = {$collection_id}, + user_guid = {$user_guid}"; + insert_data($q); } catch (DatabaseException $e) { - // nothing. return false; } @@ -640,34 +658,32 @@ function add_user_to_access_collection($user_guid, $collection_id) { * @return true|false Depending on success */ function remove_user_from_access_collection($user_guid, $collection_id) { + global $CONFIG; + $collection_id = (int) $collection_id; $user_guid = (int) $user_guid; - $collections = get_write_access_array(); - $user = $user = get_user($user_guid); + $user = get_user($user_guid); + + $collection = get_access_collection($collection_id); - if (!($collection = get_access_collection($collection_id))) { + if (!($user instanceof Elgguser) || !$collection) { return false; } - if ((array_key_exists($collection_id, $collections) || $collection->owner_guid == 0) && $user) { - global $CONFIG; - $params = array( - 'collection_id' => $collection_id, - 'user_guid' => $user_guid - ); - - if (!elgg_trigger_plugin_hook('access:collections:remove_user', 'collection', $params, true)) { - return false; - } - - delete_data("delete from {$CONFIG->dbprefix}access_collection_membership " - . "where access_collection_id = {$collection_id} and user_guid = {$user_guid}"); - - return true; + $params = array( + 'collection_id' => $collection_id, + 'user_guid' => $user_guid + ); + if (!elgg_trigger_plugin_hook('access:collections:remove_user', 'collection', $params, true)) { + return false; } - return false; + $q = "DELETE FROM {$CONFIG->dbprefix}access_collection_membership + WHERE access_collection_id = {$collection_id} + AND user_guid = {$user_guid}"; + + return delete_data($q); } /** @@ -939,8 +955,18 @@ function access_init() { * @since 1.7.0 * @elgg_event_handler permissions_check all */ -function elgg_override_permissions_hook() { - $user_guid = elgg_get_logged_in_user_guid(); +function elgg_override_permissions_hook($hook, $type, $value, $params) { + $user = elgg_extract('user', $params); + if (!$user) { + $user = elgg_get_logged_in_user_entity(); + } + + // don't do this so ignore access still works. +// if (!$user instanceof ElggUser) { +// return false; +// } + + $user_guid = $user->guid; // check for admin if ($user_guid && elgg_is_admin_user($user_guid)) { @@ -956,9 +982,20 @@ function elgg_override_permissions_hook() { return NULL; } +/** + * Runs unit tests for the entities object. + */ +function access_test($hook, $type, $value, $params) { + global $CONFIG; + $value[] = $CONFIG->path . 'engine/tests/api/access_collections.php'; + return $value; +} + // This function will let us know when 'init' has finished elgg_register_event_handler('init', 'system', 'access_init', 9999); // For overrided permissions elgg_register_plugin_hook_handler('permissions_check', 'all', 'elgg_override_permissions_hook'); elgg_register_plugin_hook_handler('container_permissions_check', 'all', 'elgg_override_permissions_hook'); + +elgg_register_plugin_hook_handler('unit_test', 'system', 'access_test');
\ No newline at end of file diff --git a/engine/lib/actions.php b/engine/lib/actions.php index 4ccffd267..99e22e104 100644 --- a/engine/lib/actions.php +++ b/engine/lib/actions.php @@ -446,7 +446,17 @@ function ajax_forward_hook($hook, $type, $reason, $params) { $params['status'] = -1; } - header("Content-type: application/json"); + // Check the requester can accept JSON responses, if not fall back to + // returning JSON in a plain-text response. Some libraries request + // JSON in an invisible iframe which they then read from the iframe, + // however some browsers will not accept the JSON MIME type. + if (stripos($_SERVER['HTTP_ACCEPT'], 'application/json') === FALSE) { + header("Content-type: text/plain"); + } + else { + header("Content-type: application/json"); + } + echo json_encode($params); exit; } diff --git a/engine/lib/admin.php b/engine/lib/admin.php index c16da9295..93ee43008 100644 --- a/engine/lib/admin.php +++ b/engine/lib/admin.php @@ -239,6 +239,9 @@ function admin_init() { elgg_register_action('profile/fields/reorder', '', 'admin'); elgg_register_simplecache_view('js/admin'); + $url = elgg_get_simplecache_url('js', 'admin'); + elgg_register_js('elgg.admin', $url); + elgg_register_js('jquery.jeditable', 'vendors/jquery/jquery.jeditable.mini.js'); // administer // dashboard @@ -434,11 +437,7 @@ function admin_settings_page_handler($page) { elgg_set_context('admin'); elgg_unregister_css('elgg'); - $url = elgg_get_simplecache_url('js', 'admin'); - elgg_register_js('elgg.admin', $url); elgg_load_js('elgg.admin'); - - elgg_register_js('jquery.jeditable', 'vendors/jquery/jquery.jeditable.mini.js'); elgg_load_js('jquery.jeditable'); // default to dashboard @@ -548,9 +547,8 @@ function admin_markdown_page_handler($pages) { elgg_set_context('admin'); elgg_unregister_css('elgg'); - $url = elgg_get_simplecache_url('js', 'admin'); - elgg_register_js('elgg.admin', $url); elgg_load_js('elgg.admin'); + elgg_load_js('jquery.jeditable'); elgg_load_library('elgg:markdown'); $plugin_id = elgg_extract(0, $pages); diff --git a/engine/lib/deprecated-1.8.php b/engine/lib/deprecated-1.8.php index ff4fa0756..beba7d2b7 100644 --- a/engine/lib/deprecated-1.8.php +++ b/engine/lib/deprecated-1.8.php @@ -1146,7 +1146,7 @@ function get_entities_from_metadata_groups_multi($group_guid, $meta_array, $enti * @param bool $navigation Display pagination? Default: true * * @return string A viewable list of entities - * @deprecated 1.8 + * @deprecated 1.8 Use elgg_get_entities_from_location() */ function list_entities_in_area($lat, $long, $radius, $type = "", $subtype = "", $owner_guid = 0, $limit = 10, $fullview = true, $listtypetoggle = false, $navigation = true) { elgg_deprecated_notice('list_entities_in_area() was deprecated. Use elgg_list_entities_from_location()', 1.8); @@ -1195,7 +1195,7 @@ function list_entities_in_area($lat, $long, $radius, $type = "", $subtype = "", * @param bool $navigation Display pagination? Default: true * * @return string A viewable list of entities - * @deprecated 1.8 + * @deprecated 1.8 Use elgg_list_entities_from_location() */ function list_entities_location($location, $type = "", $subtype = "", $owner_guid = 0, $limit = 10, $fullview = true, $listtypetoggle = false, $navigation = true) { elgg_deprecated_notice('list_entities_location() was deprecated. Use elgg_list_entities_from_metadata()', 1.8); @@ -1220,7 +1220,7 @@ function list_entities_location($location, $type = "", $subtype = "", $owner_gui * @param int|array $container_guid Container GUID * * @return array A list of entities. - * @deprecated 1.8 + * @deprecated 1.8 Use elgg_get_entities_from_location() */ function get_entities_in_area($lat, $long, $radius, $type = "", $subtype = "", $owner_guid = 0, $order_by = "", $limit = 10, $offset = 0, $count = false, $site_guid = 0, $container_guid = NULL) { elgg_deprecated_notice('get_entities_in_area() was deprecated by elgg_get_entities_from_location()!', 1.8); @@ -1369,7 +1369,7 @@ function list_entities_from_metadata_multi($meta_array, $entity_type = "", $enti * Deprecated by elgg_register_menu_item(). Set $menu_name to 'page'. * * @see elgg_register_menu_item() - * @deprecated 1.8 + * @deprecated 1.8 Use the new menu system * * @param string $label The label * @param string $link The link @@ -1411,7 +1411,7 @@ function add_submenu_item($label, $link, $group = 'default', $onclick = false, $ /** * Remove an item from submenu by label * - * @deprecated 1.8 + * @deprecated 1.8 Use the new menu system * @see elgg_unregister_menu_item() * * @param string $label The item label @@ -1429,7 +1429,7 @@ function remove_submenu_item($label, $group = 'a') { * Use elgg_view_menu(). Set $menu_name to 'owner_block'. * * @see elgg_view_menu() - * @deprecated 1.8 + * @deprecated 1.8 Use the new menu system. elgg_view_menu() * * @return string */ @@ -1465,7 +1465,7 @@ function add_menu($menu_name, $menu_url, $menu_children = array(), $context = "" * @param string $menu_name The name of the menu item * * @return true|false Depending on success - * @deprecated 1.8 + * @deprecated 1.8 Use the new menu system */ function remove_menu($menu_name) { elgg_deprecated_notice("remove_menu() deprecated by elgg_unregister_menu_item()", 1.8); @@ -1478,7 +1478,7 @@ function remove_menu($menu_name) { * @param string $title The title * * @return string The optimised title - * @deprecated 1.8 + * @deprecated 1.8 Use elgg_get_friendly_title() */ function friendly_title($title) { elgg_deprecated_notice('friendly_title was deprecated by elgg_get_friendly_title', 1.8); @@ -1491,7 +1491,7 @@ function friendly_title($title) { * @param int $time A UNIX epoch timestamp * * @return string The friendly time - * @deprecated 1.8 + * @deprecated 1.8 Use elgg_view_friendly_time() */ function friendly_time($time) { elgg_deprecated_notice('friendly_time was deprecated by elgg_view_friendly_time', 1.8); @@ -1501,7 +1501,7 @@ function friendly_time($time) { /** * Filters a string into an array of significant words * - * @deprecated 1.8 + * @deprecated 1.8 Don't use this. * * @param string $string A string * @@ -1539,7 +1539,7 @@ function filter_string($string) { /** * Returns true if the word in $input is considered significant * - * @deprecated 1.8 + * @deprecated 1.8 Don't use this. * * @param string $input A word * @@ -1576,7 +1576,7 @@ function page_owner() { /** * Gets the owner entity for the current page. * - * @deprecated 1.8 Use elgg_get_page_owner() + * @deprecated 1.8 Use elgg_get_page_owner_entity() * @return ElggEntity|false The current page owner or false if none. */ function page_owner_entity() { @@ -1645,7 +1645,7 @@ function get_context() { /** * Returns a list of plugins to load, in the order that they should be loaded. * - * @deprecated 1.8 + * @deprecated 1.8 Use elgg_get_plugin_ids_in_dir() or elgg_get_plugins() * * @return array List of plugins */ @@ -1676,7 +1676,7 @@ function get_plugin_list() { * elgg_regenerate_simplecache(); * elgg_filepath_cache_reset(); * - * @deprecated 1.8 + * @deprecated 1.8 Use elgg_generate_plugin_entities() and elgg_set_plugin_priorities() * * @param array $pluginorder Optionally, a list of existing plugins and their orders * @@ -1708,7 +1708,7 @@ function regenerate_plugin_list($pluginorder = FALSE) { * * i.e., if the last plugin was in /mod/foobar/, get_plugin_name would return foo_bar. * - * @deprecated 1.8 + * @deprecated 1.8 Use elgg_get_calling_plugin_id() * * @param boolean $mainfilename If set to true, this will instead determine the * context from the main script filename called by @@ -1727,7 +1727,7 @@ function get_plugin_name($mainfilename = false) { * * @example plugins/manifest.xml Example 1.8-style manifest file. * - * @deprecated 1.8 + * @deprecated 1.8 Use ElggPlugin->getManifest() * * @param string $plugin Plugin name. * @return array of values @@ -1750,7 +1750,7 @@ function load_plugin_manifest($plugin) { * This function checks a plugin manifest 'elgg_version' value against the current install * returning TRUE if the elgg_version is >= the current install's version. * - * @deprecated 1.8 + * @deprecated 1.8 Use ElggPlugin->canActivate() * * @param string $manifest_elgg_version_string The build version (eg 2009010201). * @return bool @@ -1773,7 +1773,7 @@ function check_plugin_compatibility($manifest_elgg_version_string) { /** * Shorthand function for finding the plugin settings. * - * @deprecated 1.8 + * @deprecated 1.8 Use elgg_get_calling_plugin_entity() or elgg_get_plugin_from_id() * * @param string $plugin_id Optional plugin id, if not specified * then it is detected from where you are calling. @@ -1792,7 +1792,7 @@ function find_plugin_settings($plugin_id = null) { /** * Return an array of installed plugins. * - * @deprecated 1.8 + * @deprecated 1.8 use elgg_get_plugins() * * @param string $status any|enabled|disabled * @return array @@ -1843,7 +1843,7 @@ function get_installed_plugins($status = 'all') { * elgg_regenerate_simplecache(); * elgg_filepath_cache_reset(); * - * @deprecated 1.8 + * @deprecated 1.8 Use ElggPlugin->activate() * * @param string $plugin The plugin name. * @param int $site_guid The site id, if not specified then this is detected. @@ -1884,7 +1884,7 @@ function enable_plugin($plugin, $site_guid = null) { * elgg_regenerate_simplecache(); * elgg_filepath_cache_reset(); * - * @deprecated 1.8 + * @deprecated 1.8 Use ElggPlugin->deactivate() * * @param string $plugin The plugin name. * @param int $site_guid The site id, if not specified then this is detected. @@ -1915,7 +1915,7 @@ function disable_plugin($plugin, $site_guid = 0) { /** * Return whether a plugin is enabled or not. * - * @deprecated 1.8 + * @deprecated 1.8 Use elgg_is_active_plugin() * * @param string $plugin The plugin name. * @param int $site_guid The site id, if not specified then this is detected. @@ -1943,7 +1943,7 @@ function is_plugin_enabled($plugin, $site_guid = 0) { * @param mixed $container_guid The container(s) GUIDs * * @return array A list of entities. - * @deprecated 1.8 + * @deprecated 1.8 Use elgg_get_entities_from_private_settings() */ function get_entities_from_private_setting($name = "", $value = "", $type = "", $subtype = "", $owner_guid = 0, $order_by = "", $limit = 10, $offset = 0, $count = false, $site_guid = 0, @@ -2022,13 +2022,13 @@ $container_guid = null) { * @param mixed $container_guid Container GUID * * @return array A list of entities. - * @deprecated 1.8 + * @deprecated 1.8 Use elgg_get_entities_from_private_settings() */ function get_entities_from_private_setting_multi(array $name, $type = "", $subtype = "", $owner_guid = 0, $order_by = "", $limit = 10, $offset = 0, $count = false, $site_guid = 0, $container_guid = null) { - elgg_deprecated_notice('get_entities_from_private_setting_multi() was deprecated by elgg_get_entities_from_private_setting()!', 1.8); + elgg_deprecated_notice('get_entities_from_private_setting_multi() was deprecated by elgg_get_entities_from_private_settings()!', 1.8); $options = array(); @@ -2194,7 +2194,7 @@ $subtype = "", $owner_guid = 0, $limit = 10, $offset = 0, $count = false, $site_ /** * Displays a human-readable list of entities * - * @deprecated 1.8 + * @deprecated 1.8 Use elgg_list_entities_from_relationship_count() * * @param string $relationship The relationship eg "friends_of" * @param bool $inverse_relationship Inverse relationship owners @@ -2245,7 +2245,7 @@ $listtypetoggle = false, $pagination = true) { * Gets the number of entities by a the number of entities related to * them in a particular way also constrained by metadata. * - * @deprecated 1.8 + * @deprecated 1.8 Use elgg_get_entities_from_relationship() * * @param string $relationship The relationship eg "friends_of" * @param int $relationship_guid The guid of the entity to use query @@ -2337,7 +2337,7 @@ $subtype = "", $owner_guid = 0, $limit = 10, $offset = 0, $count = false, $site_ * @param int $posted_max The maximum time period to look at. Default: none * * @return array|false Depending on success - * @deprecated 1.8 + * @deprecated 1.8 Use elgg_get_river() */ function get_river_items($subject_guid = 0, $object_guid = 0, $subject_relationship = '', $type = '', $subtype = '', $action_type = '', $limit = 20, $offset = 0, $posted_min = 0, @@ -2404,7 +2404,7 @@ $posted_max = 0) { * @param bool $pagination Show pagination? * * @return string Human-readable river. - * @deprecated 1.8 + * @deprecated 1.8 Use elgg_list_river() */ function elgg_view_river_items($subject_guid = 0, $object_guid = 0, $subject_relationship = '', $type = '', $subtype = '', $action_type = '', $limit = 20, $posted_min = 0, @@ -2424,7 +2424,7 @@ $posted_max = 0, $pagination = true) { 'offset' => $offset, 'limit' => $limit, 'pagination' => $pagination, - 'list-class' => 'elgg-river-list', + 'list-class' => 'elgg-list-river', ); return elgg_view('page/components/list', $params); @@ -2433,7 +2433,8 @@ $posted_max = 0, $pagination = true) { /** * Construct and execute the query required for the activity stream. * - * @deprecated 1.8 + * @deprecated 1.8 This is outdated and uses the systemlog table instead of the river table. + * Don't use it. */ function get_activity_stream_data($limit = 10, $offset = 0, $type = "", $subtype = "", $owner_guid = "", $owner_relationship = "") { @@ -2668,7 +2669,7 @@ function list_site_members($site_guid, $limit = 10, $fullview = true) { * @param int $collection_guid Collection GUID * * @return mixed - * @deprecated 1.8 + * @deprecated 1.8 Don't use this. */ function add_site_collection($site_guid, $collection_guid) { elgg_deprecated_notice("add_site_collection has been deprecated", 1.8); @@ -2687,7 +2688,7 @@ function add_site_collection($site_guid, $collection_guid) { * @param int $collection_guid Collection GUID * * @return mixed - * @deprecated 1.8 + * @deprecated 1.8 Don't use this. */ function remove_site_collection($site_guid, $collection_guid) { elgg_deprecated_notice("remove_site_collection has been deprecated", 1.8); @@ -2706,7 +2707,7 @@ function remove_site_collection($site_guid, $collection_guid) { * @param int $offset Offset * * @return mixed - * @deprecated 1.8 + * @deprecated 1.8 Don't use this. */ function get_site_collections($site_guid, $subtype = "", $limit = 10, $offset = 0) { elgg_deprecated_notice("get_site_collections has been deprecated", 1.8); @@ -2944,7 +2945,7 @@ $limit = 0, $offset = 0) { * @param bool $status Validated (true) or false * @param string $method Optional method to say how a user was validated * @return bool - * @deprecated 1.8 + * @deprecated 1.8 Use elgg_set_user_validation_status() */ function set_user_validation_status($user_guid, $status, $method = '') { elgg_deprecated_notice("set_user_validation_status() is deprecated", 1.8); @@ -2957,7 +2958,7 @@ function set_user_validation_status($user_guid, $status, $method = '') { * This function invalidates any existing validation value. * * @param int $user_guid User's GUID - * @deprecated 1.8 + * @deprecated 1.8 Hook into the register, user plugin hook and request validation. */ function request_user_validation($user_guid) { elgg_deprecated_notice("request_user_validation() is deprecated. @@ -3314,7 +3315,7 @@ function clear_all_plugin_settings($plugin_id = "") { * @param int $entity_owner_guid Owner guid for the entity * * @return array - * @deprecated 1.8 + * @deprecated 1.8 Use elgg_get_annotations() */ function get_annotations($entity_guid = 0, $entity_type = "", $entity_subtype = "", $name = "", $value = "", $owner_guid = 0, $limit = 10, $offset = 0, $order_by = "asc", $timelower = 0, @@ -3379,7 +3380,7 @@ $timeupper = 0, $entity_owner_guid = 0) { * @param true|false $asc Display annotations in ascending order. (Default: true) * * @return string HTML (etc) version of the annotation list - * @deprecated 1.8 + * @deprecated 1.8 Use elgg_list_annotations() */ function list_annotations($entity_guid, $name = "", $limit = 25, $asc = true) { elgg_deprecated_notice('list_annotations() is deprecated by elgg_list_annotations()', 1.8); @@ -3412,7 +3413,7 @@ function list_annotations($entity_guid, $name = "", $limit = 25, $asc = true) { * @param unknown_type $timelower * @param unknown_type $timeupper * @param unknown_type $calculation - * @deprecated 1.8 + * @internal Don't use this at all. */ function elgg_deprecated_annotation_calculation($entity_guid = 0, $entity_type = "", $entity_subtype = "", $name = "", $value = "", $value_type = "", $owner_guid = 0, $timelower = 0, @@ -3590,7 +3591,7 @@ $value = "", $value_type = "", $owner_guid = 0) { * @param int $timeupper Upper time limit * * @return int - * @deprecated 1.8 + * @deprecated 1.8 Use elgg_get_annotations() and pass anntoation_calculation => <calculation> */ function get_annotations_calculate_x($sum = "avg", $entity_guid, $entity_type = "", $entity_subtype = "", $name = "", $value = "", $value_type = "", $owner_guid = 0, @@ -4501,7 +4502,7 @@ function save_widget_info($widget_guid, $params) { * @param int $owner Owner guid * * @return void - * @deprecated 1.8 + * @deprecated 1.8 Don't use. */ function reorder_widgets_from_panel($panelstring1, $panelstring2, $panelstring3, $context, $owner) { elgg_deprecated_notice("reorder_widgets_from_panel() is deprecated", 1.8); @@ -4609,7 +4610,7 @@ function reorder_widgets_from_panel($panelstring1, $panelstring2, $panelstring3, * @param string $context The context we wish to enable context for * * @return void - * @deprecated 1.8 + * @deprecated 1.8 Don't use. */ function use_widgets($context) { elgg_deprecated_notice("use_widgets is deprecated", 1.8); @@ -4632,7 +4633,7 @@ function use_widgets($context) { * Determines whether or not the current context is using widgets * * @return bool Depending on widget status - * @deprecated 1.8 + * @deprecated 1.8 Don't use. */ function using_widgets() { elgg_deprecated_notice("using_widgets is deprecated", 1.8); @@ -4654,7 +4655,7 @@ function using_widgets() { * @param ElggObject $widget The widget to display * @return string The HTML for the widget, including JavaScript wrapper * - * @deprecated 1.8 + * @deprecated 1.8 Use elgg_view_entity() */ function display_widget(ElggObject $widget) { elgg_deprecated_notice("display_widget() was been deprecated. Use elgg_view_entity().", 1.8); diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index 198ffe60c..7bdc5972a 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -278,7 +278,7 @@ function elgg_get_loaded_css() { * @return bool * @since 1.8.0 */ -function elgg_register_external_file($type, $name, $url, $location, $priority = null) { +function elgg_register_external_file($type, $name, $url, $location, $priority = 500) { global $CONFIG; if (empty($name) || empty($url)) { @@ -291,7 +291,15 @@ function elgg_register_external_file($type, $name, $url, $location, $priority = elgg_bootstrap_externals_data_structure($type); $name = trim(strtolower($name)); + + // normalize bogus priorities, but allow empty, null, and false to be defaults. + if (!is_numeric($priority)) { + $priority = 500; + } + + // no negative priorities right now. $priority = max((int)$priority, 0); + $item = elgg_extract($name, $CONFIG->externals_map[$type]); if ($item) { diff --git a/engine/lib/entities.php b/engine/lib/entities.php index 10313fc8c..abf7395e7 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -846,9 +846,6 @@ function elgg_get_entities(array $options = array()) { $wheres[] = elgg_get_entity_time_where_sql('e', $options['created_time_upper'], $options['created_time_lower'], $options['modified_time_upper'], $options['modified_time_lower']); - // remove identical where clauses - $wheres = array_unique($wheres); - // see if any functions failed // remove empty strings on successful functions foreach ($wheres as $i => $where) { @@ -859,6 +856,9 @@ function elgg_get_entities(array $options = array()) { } } + // remove identical where clauses + $wheres = array_unique($wheres); + // evaluate join clauses if (!is_array($options['joins'])) { $options['joins'] = array($options['joins']); @@ -1118,8 +1118,12 @@ function elgg_get_guid_based_where_sql($column, $guids) { $guids_sanitized = array(); foreach ($guids as $guid) { - if (($guid != sanitise_int($guid))) { - return FALSE; + if ($guid !== ELGG_ENTITIES_NO_VALUE) { + $guid = sanitise_int($guid); + + if (!$guid) { + return false; + } } $guids_sanitized[] = $guid; } @@ -1494,6 +1498,7 @@ function delete_entity($guid, $recursive = true) { $entity_disable_override = access_get_show_hidden_status(); access_show_hidden_entities(true); + $ia = elgg_set_ignore_access(true); $sub_entities = get_data("SELECT * from {$CONFIG->dbprefix}entities WHERE container_guid=$guid or owner_guid=$guid @@ -1506,6 +1511,7 @@ function delete_entity($guid, $recursive = true) { access_show_hidden_entities($entity_disable_override); $__RECURSIVE_DELETE_TOKEN = null; + elgg_set_ignore_access($ia); } // Now delete the entity itself diff --git a/engine/lib/metastrings.php b/engine/lib/metastrings.php index d444121d0..8c00fb2ad 100644 --- a/engine/lib/metastrings.php +++ b/engine/lib/metastrings.php @@ -360,9 +360,6 @@ function elgg_get_metastring_based_objects($options) { $wheres[] = elgg_get_guid_based_where_sql('n_table.owner_guid', $options['metastring_owner_guids']); - // remove identical where clauses - $wheres = array_unique($wheres); - // see if any functions failed // remove empty strings on successful functions foreach ($wheres as $i => $where) { @@ -373,6 +370,9 @@ function elgg_get_metastring_based_objects($options) { } } + // remove identical where clauses + $wheres = array_unique($wheres); + // evaluate join clauses if (!is_array($options['joins'])) { $options['joins'] = array($options['joins']); diff --git a/engine/lib/navigation.php b/engine/lib/navigation.php index cefe40ecf..27af26be2 100644 --- a/engine/lib/navigation.php +++ b/engine/lib/navigation.php @@ -53,6 +53,9 @@ * 'register', 'menu:<menu_name>'. If you do, you may end up with many incorrect * links on a context-sensitive menu. * + * @warning A menu item's name must be unique per menu. If more than one menu + * item with the same name are registered, the last menu item takes priority. + * * @see elgg_view_menu() for the plugin hooks available for modifying a menu as * it is being rendered. * @@ -282,7 +285,9 @@ function elgg_site_menu_setup($hook, $type, $return, $params) { } $return['default'] = $featured; - $return['more'] = $registered; + if (count($registered) > 0) { + $return['more'] = $registered; + } } else { // no featured menu items set $max_display_items = 5; diff --git a/engine/lib/output.php b/engine/lib/output.php index 04c737062..9479fee53 100644 --- a/engine/lib/output.php +++ b/engine/lib/output.php @@ -215,6 +215,14 @@ function elgg_clean_vars(array $vars = array()) { unset($vars['internalid']); } + if (isset($vars['__ignoreInternalid'])) { + unset($vars['__ignoreInternalid']); + } + + if (isset($vars['__ignoreInternalname'])) { + unset($vars['__ignoreInternalname']); + } + return $vars; } diff --git a/engine/lib/plugins.php b/engine/lib/plugins.php index 88217b782..fd85ed9f0 100644 --- a/engine/lib/plugins.php +++ b/engine/lib/plugins.php @@ -548,7 +548,12 @@ function elgg_get_plugins_provides($type = null, $name = null) { $provides = array(); foreach ($active_plugins as $plugin) { - if ($plugin_provides = $plugin->getManifest()->getProvides()) { + $plugin_provides = array(); + $manifest = $plugin->getManifest(); + if ($manifest instanceof ElggPluginManifest) { + $plugin_provides = $plugin->getManifest()->getProvides(); + } + if ($plugin_provides) { foreach ($plugin_provides as $provided) { $provides[$provided['type']][$provided['name']] = array( 'version' => $provided['version'], @@ -811,7 +816,7 @@ function elgg_set_plugin_user_setting($name, $value, $user_guid = null, $plugin_ /** * Unsets a user-specific plugin setting * - * @param str $name Name of the plugin setting + * @param str $name Name of the setting * @param int $user_guid Defaults to logged in user * @param str $plugin_id Defaults to contextual plugin name * @@ -834,7 +839,7 @@ function elgg_unset_plugin_user_setting($name, $user_guid = null, $plugin_id = n /** * Get a user specific setting for a plugin. * - * @param string $name The name. + * @param string $name The name of the setting. * @param int $user_guid Guid of owning user * @param string $plugin_id Optional plugin name, if not specified * it is detected from where you are calling. @@ -858,7 +863,7 @@ function elgg_get_plugin_user_setting($name, $user_guid = null, $plugin_id = nul /** * Set a setting for a plugin. * - * @param string $name The name - note, can't be "title". + * @param string $name The name of the setting - note, can't be "title". * @param mixed $value The value. * @param string $plugin_id Optional plugin name, if not specified * then it is detected from where you are calling from. @@ -882,7 +887,7 @@ function elgg_set_plugin_setting($name, $value, $plugin_id = null) { /** * Get setting for a plugin. * - * @param string $name The name. + * @param string $name The name of the setting. * @param string $plugin_id Optional plugin name, if not specified * then it is detected from where you are calling from. * @@ -905,7 +910,7 @@ function elgg_get_plugin_setting($name, $plugin_id = null) { /** * Unsets a plugin setting. * - * @param string $name The name. + * @param string $name The name of the setting. * @param string $plugin_id Optional plugin name, if not specified * then it is detected from where you are calling from. * diff --git a/engine/lib/river.php b/engine/lib/river.php index 64ddcfdc1..e283c0595 100644 --- a/engine/lib/river.php +++ b/engine/lib/river.php @@ -170,9 +170,6 @@ function elgg_delete_river(array $options = array()) { $wheres[] = "rv.posted <= {$options['posted_time_upper']}"; } - // remove identical where clauses - $wheres = array_unique($wheres); - // see if any functions failed // remove empty strings on successful functions foreach ($wheres as $i => $where) { @@ -183,6 +180,9 @@ function elgg_delete_river(array $options = array()) { } } + // remove identical where clauses + $wheres = array_unique($wheres); + $query = "DELETE rv.* FROM {$CONFIG->dbprefix}river rv "; // remove identical join clauses @@ -304,9 +304,6 @@ function elgg_get_river(array $options = array()) { } } - // remove identical where clauses - $wheres = array_unique($wheres); - // see if any functions failed // remove empty strings on successful functions foreach ($wheres as $i => $where) { @@ -317,6 +314,9 @@ function elgg_get_river(array $options = array()) { } } + // remove identical where clauses + $wheres = array_unique($wheres); + if (!$options['count']) { $query = "SELECT DISTINCT rv.* FROM {$CONFIG->dbprefix}river rv "; } else { @@ -378,7 +378,7 @@ function elgg_list_river(array $options = array()) { 'offset' => (int) max(get_input('offset', 0), 0), 'limit' => (int) max(get_input('limit', 20), 0), 'pagination' => TRUE, - 'list_class' => 'elgg-river', + 'list_class' => 'elgg-list-river elgg-river', // @todo remove elgg-river in Elgg 1.9 ); $options = array_merge($defaults, $options); diff --git a/engine/lib/tags.php b/engine/lib/tags.php index 1116d63f3..64feed5b2 100644 --- a/engine/lib/tags.php +++ b/engine/lib/tags.php @@ -184,9 +184,6 @@ function elgg_get_tags(array $options = array()) { $wheres[] = elgg_get_entity_time_where_sql('e', $options['created_time_upper'], $options['created_time_lower'], $options['modified_time_upper'], $options['modified_time_lower']); - // remove identical where clauses - $wheres = array_unique($wheres); - // see if any functions failed // remove empty strings on successful functions foreach ($wheres as $i => $where) { @@ -197,6 +194,8 @@ function elgg_get_tags(array $options = array()) { } } + // remove identical where clauses + $wheres = array_unique($wheres); $joins = $options['joins']; diff --git a/engine/lib/upgrade.php b/engine/lib/upgrade.php index dc3911062..dc1213187 100644 --- a/engine/lib/upgrade.php +++ b/engine/lib/upgrade.php @@ -160,7 +160,7 @@ function elgg_get_upgrade_files($upgrade_path = null) { } /** - * Get the current version information + * Get the current Elgg version information * * @param bool $humanreadable Whether to return a human readable version (default: false) * @@ -169,13 +169,18 @@ function elgg_get_upgrade_files($upgrade_path = null) { function get_version($humanreadable = false) { global $CONFIG; + static $version, $release; + if (isset($CONFIG->path)) { - if (include($CONFIG->path . "version.php")) { - return (!$humanreadable) ? $version : $release; + if (!isset($version) || !isset($release)) { + if (!include($CONFIG->path . "version.php")) { + return false; + } } + return (!$humanreadable) ? $version : $release; } - return FALSE; + return false; } /** diff --git a/engine/lib/upgrades/2011092500-1.8.0.1-forum_reply_river_view-5758ce8d86ac56ce.php b/engine/lib/upgrades/2011092500-1.8.0.1-forum_reply_river_view-5758ce8d86ac56ce.php new file mode 100644 index 000000000..3a9200b51 --- /dev/null +++ b/engine/lib/upgrades/2011092500-1.8.0.1-forum_reply_river_view-5758ce8d86ac56ce.php @@ -0,0 +1,12 @@ +<?php +/** + * Elgg 1.8.0.1 upgrade 2011092500 + * forum_reply_river_view + * + * The forum reply river view is in a new location in Elgg 1.8 + */ + +$query = "UPDATE {$CONFIG->dbprefix}river SET view='river/annotation/group_topic_post/reply', + action_type='reply' + WHERE view='river/forum/create' AND action_type='create'"; +update_data($query); diff --git a/engine/lib/users.php b/engine/lib/users.php index 48f10f974..36e137876 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -1419,11 +1419,14 @@ function elgg_profile_page_handler($page) { */ function users_pagesetup() { - if (elgg_get_page_owner_guid()) { + $owner = elgg_get_page_owner_entity(); + $viewer = elgg_get_logged_in_user_entity(); + + if ($owner) { $params = array( 'name' => 'friends', 'text' => elgg_echo('friends'), - 'href' => 'friends/' . elgg_get_page_owner_entity()->username, + 'href' => 'friends/' . $owner->username, 'contexts' => array('friends') ); elgg_register_menu_item('page', $params); @@ -1431,43 +1434,43 @@ function users_pagesetup() { $params = array( 'name' => 'friends:of', 'text' => elgg_echo('friends:of'), - 'href' => 'friendsof/' . elgg_get_page_owner_entity()->username, + 'href' => 'friendsof/' . $owner->username, 'contexts' => array('friends') ); elgg_register_menu_item('page', $params); - } - - // topbar - $user = elgg_get_logged_in_user_entity(); - if ($user) { + elgg_register_menu_item('page', array( 'name' => 'edit_avatar', - 'href' => "avatar/edit/{$user->username}", + 'href' => "avatar/edit/{$owner->username}", 'text' => elgg_echo('avatar:edit'), 'contexts' => array('profile_edit'), )); elgg_register_menu_item('page', array( 'name' => 'edit_profile', - 'href' => "profile/{$user->username}/edit", + 'href' => "profile/{$owner->username}/edit", 'text' => elgg_echo('profile:edit'), 'contexts' => array('profile_edit'), )); + } - $icon_url = $user->getIconURL('topbar'); + // topbar + if ($viewer) { + + $icon_url = $viewer->getIconURL('topbar'); $class = 'elgg-border-plain elgg-transition'; $title = elgg_echo('profile'); elgg_register_menu_item('topbar', array( 'name' => 'profile', - 'href' => $user->getURL(), - 'text' => "<img src=\"$icon_url\" alt=\"$user->name\" title=\"$title\" class=\"$class\" />", + 'href' => $viewer->getURL(), + 'text' => "<img src=\"$icon_url\" alt=\"$viewer->name\" title=\"$title\" class=\"$class\" />", 'priority' => 100, 'link_class' => 'elgg-topbar-avatar', )); elgg_register_menu_item('topbar', array( 'name' => 'friends', - 'href' => "friends/{$user->username}", + 'href' => "friends/{$viewer->username}", 'text' => elgg_view_icon('users'), 'title' => elgg_echo('friends'), 'priority' => 300, @@ -1475,7 +1478,7 @@ function users_pagesetup() { elgg_register_menu_item('topbar', array( 'name' => 'usersettings', - 'href' => "settings/user/{$user->username}", + 'href' => "settings/user/{$viewer->username}", 'text' => elgg_view_icon('settings') . elgg_echo('settings'), 'priority' => 500, 'section' => 'alt', @@ -1489,7 +1492,6 @@ function users_pagesetup() { 'priority' => 1000, 'section' => 'alt', )); - } } diff --git a/engine/lib/views.php b/engine/lib/views.php index fe3265347..c31f61e84 100644 --- a/engine/lib/views.php +++ b/engine/lib/views.php @@ -369,8 +369,8 @@ function elgg_view($view, $vars = array(), $bypass = false, $debug = false, $vie // Trigger the pagesetup event if (!isset($CONFIG->pagesetupdone)) { - elgg_trigger_event('pagesetup', 'system'); $CONFIG->pagesetupdone = true; + elgg_trigger_event('pagesetup', 'system'); } if (!is_array($usercache)) { @@ -411,19 +411,25 @@ function elgg_view($view, $vars = array(), $bypass = false, $debug = false, $vie } // internalname => name (1.8) - if (isset($vars['internalname']) && !isset($vars['name'])) { + if (isset($vars['internalname']) && !isset($vars['__ignoreInternalname']) && !isset($vars['name'])) { elgg_deprecated_notice('You should pass $vars[\'name\'] now instead of $vars[\'internalname\']', 1.8, 2); $vars['name'] = $vars['internalname']; $test=false; } elseif (isset($vars['name'])) { + if (!isset($vars['internalname'])) { + $vars['__ignoreInternalname'] = ''; + } $vars['internalname'] = $vars['name']; } // internalid => id (1.8) - if (isset($vars['internalid']) && !isset($vars['name'])) { + if (isset($vars['internalid']) && !isset($vars['__ignoreInternalid']) && !isset($vars['name'])) { elgg_deprecated_notice('You should pass $vars[\'id\'] now instead of $vars[\'internalid\']', 1.8, 2); $vars['id'] = $vars['internalid']; } elseif (isset($vars['id'])) { + if (!isset($vars['internalid'])) { + $vars['__ignoreInternalid'] = ''; + } $vars['internalid'] = $vars['id']; } @@ -617,13 +623,12 @@ function elgg_view_page($title, $body, $page_shell = 'default', $vars = array()) $vars['title'] = $title; $vars['body'] = $body; $vars['sysmessages'] = $messages; + + $vars = elgg_trigger_plugin_hook('output:before', 'page', null, $vars); // check for deprecated view if ($page_shell == 'default' && elgg_view_exists('pageshells/pageshell')) { elgg_deprecated_notice("pageshells/pageshell is deprecated by page/$page_shell", 1.8); - global $CONFIG; - - $vars['config'] = $CONFIG; $output = elgg_view('pageshells/pageshell', $vars); } else { $output = elgg_view("page/$page_shell", $vars); @@ -681,15 +686,19 @@ function elgg_view_layout($layout_name, $vars = array()) { $param_array = $vars; } + $params = elgg_trigger_plugin_hook('output:before', 'layout', null, $param_array); + // check deprecated location if (elgg_view_exists("canvas/layouts/$layout_name")) { elgg_deprecated_notice("canvas/layouts/$layout_name is deprecated by page/layouts/$layout_name", 1.8); - return elgg_view("canvas/layouts/$layout_name", $param_array); + $output = elgg_view("canvas/layouts/$layout_name", $params); } elseif (elgg_view_exists("page/layouts/$layout_name")) { - return elgg_view("page/layouts/$layout_name", $param_array); + $output = elgg_view("page/layouts/$layout_name", $params); } else { - return elgg_view("page/layouts/default", $param_array); + $output = elgg_view("page/layouts/default", $params); } + + return elgg_trigger_plugin_hook('output:after', 'layout', $params, $output); } /** @@ -1035,7 +1044,7 @@ $list_type_toggle = true, $pagination = true) { function elgg_view_annotation_list($annotations, array $vars = array()) { $defaults = array( 'items' => $annotations, - 'list_class' => 'elgg-annotation-list', + 'list_class' => 'elgg-list-annotation elgg-annotation-list', // @todo remove elgg-annotation-list in Elgg 1.9 'full_view' => true, 'offset_key' => 'annoff', ); @@ -1224,6 +1233,9 @@ function elgg_view_river_item($item, array $vars = array()) { * sets the action by default to "action/$action". Automatically wraps the forms/$action * view with a <form> tag and inserts the anti-csrf security tokens. * + * @tip This automatically appends elgg-form-action-name to the form's class. It replaces any + * slashes with dashes (blog/save becomes elgg-form-blog-save) + * * @example * <code>echo elgg_view_form('login');</code> * @@ -1253,9 +1265,18 @@ function elgg_view_form($action, $form_vars = array(), $body_vars = array()) { $defaults = array( 'action' => $CONFIG->wwwroot . "action/$action", - 'body' => elgg_view("forms/$action", $body_vars), + 'body' => elgg_view("forms/$action", $body_vars) ); + $form_class = 'elgg-form-' . preg_replace('/[^a-z0-9]/i', '-', $action); + + // append elgg-form class to any class options set + if (isset($form_vars['class'])) { + $form_vars['class'] = $form_vars['class'] . " $form_class"; + } else { + $form_vars['class'] = $form_class; + } + return elgg_view('input/form', array_merge($defaults, $form_vars)); } @@ -1293,15 +1314,16 @@ function elgg_view_list_item($item, array $vars = array()) { * Shorthand for <span class="elgg-icon elgg-icon-$name"></span> * * @param string $name The specific icon to display - * @param bool $float Whether to float the icon + * @param string $class Additional class: float, float-alt, or custom class * * @return string The html for displaying an icon */ -function elgg_view_icon($name, $float = false) { - if ($float) { - $float = 'float'; +function elgg_view_icon($name, $class = '') { + // @todo deprecate boolean in Elgg 1.9 + if (is_bool($class) && $class === true) { + $class = 'float'; } - return "<span class=\"elgg-icon elgg-icon-$name $float\"></span>"; + return "<span class=\"elgg-icon elgg-icon-$name $class\"></span>"; } /** @@ -1531,6 +1553,7 @@ function elgg_views_boot() { elgg_register_simplecache_view('css/elgg'); elgg_register_simplecache_view('css/ie'); elgg_register_simplecache_view('css/ie6'); + elgg_register_simplecache_view('css/ie7'); elgg_register_simplecache_view('js/elgg'); elgg_register_js('jquery', '/vendors/jquery/jquery-1.6.2.min.js', 'head'); @@ -1548,14 +1571,14 @@ function elgg_views_boot() { elgg_register_simplecache_view('js/lightbox'); $lightbox_js_url = elgg_get_simplecache_url('js', 'lightbox'); elgg_register_js('lightbox', $lightbox_js_url); - $lightbox_css_url = 'vendors/jquery/fancybox/jquery.fancybox-1.3.4.css'; + $lightbox_css_url = elgg_get_simplecache_url('css', 'lightbox'); elgg_register_css('lightbox', $lightbox_css_url); $elgg_css_url = elgg_get_simplecache_url('css', 'elgg'); - elgg_register_css('elgg', $elgg_css_url, 1); + elgg_register_css('elgg', $elgg_css_url); elgg_load_css('elgg'); - elgg_register_event_handler('pagesetup', 'system', 'elgg_views_add_rss_link'); + elgg_register_plugin_hook_handler('output:before', 'layout', 'elgg_views_add_rss_link'); // discover the built-in view types // @todo the cache is loaded in load_plugins() but we need to know view_types earlier diff --git a/engine/start.php b/engine/start.php index 713d94cc6..132c060b4 100644 --- a/engine/start.php +++ b/engine/start.php @@ -144,7 +144,9 @@ if (!defined('UPGRADING')) { $lastcached = datalist_get("simplecache_lastcached_$viewtype"); if ($lastupdate == 0 || $lastcached < $lastupdate) { elgg_regenerate_simplecache($viewtype); + $lastcached = datalist_get("simplecache_lastcached_$viewtype"); } + $CONFIG->lastcache = $lastcached; } // System loaded and ready diff --git a/engine/tests/api/access_collections.php b/engine/tests/api/access_collections.php new file mode 100644 index 000000000..1e61c45bb --- /dev/null +++ b/engine/tests/api/access_collections.php @@ -0,0 +1,269 @@ +<?php +/** + * Access Collections tests + * + * @package Elgg + * @subpackage Test + */ +class ElggCoreAccessCollectionsTest extends ElggCoreUnitTest { + + /** + * Called before each test object. + */ + public function __construct() { + parent::__construct(); + + $this->dbPrefix = get_config("dbprefix"); + + $user = new ElggUser(); + $user->username = 'test_user_' . rand(); + $user->email = 'fake_email@fake.com' . rand(); + $user->name = 'fake user'; + $user->access_id = ACCESS_PUBLIC; + $user->salt = generate_random_cleartext_password(); + $user->password = generate_user_password($user, rand()); + $user->owner_guid = 0; + $user->container_guid = 0; + $user->save(); + + $this->user = $user; + } + + /** + * Called before each test method. + */ + public function setUp() { + + } + + /** + * Called after each test method. + */ + public function tearDown() { + // do not allow SimpleTest to interpret Elgg notices as exceptions + $this->swallowErrors(); + } + + /** + * Called after each test object. + */ + public function __destruct() { + // all __destruct() code should go above here + $this->user->delete(); + parent::__destruct(); + } + + public function testCreateGetDeleteACL() { + global $DB_QUERY_CACHE; + + $acl_name = 'test access collection'; + $acl_id = create_access_collection($acl_name); + + $this->assertTrue(is_int($acl_id)); + + $q = "SELECT * FROM {$this->dbPrefix}access_collections WHERE id = $acl_id"; + $acl = get_data_row($q); + + $this->assertEqual($acl->id, $acl_id); + + if ($acl) { + $DB_QUERY_CACHE = array(); + + $this->assertEqual($acl->name, $acl_name); + + $result = delete_access_collection($acl_id); + $this->assertTrue($result); + + $q = "SELECT * FROM {$this->dbPrefix}access_collections WHERE id = $acl_id"; + $data = get_data($q); + $this->assertFalse($data); + } + } + + public function testAddRemoveUserToACL() { + $acl_id = create_access_collection('test acl'); + + $result = add_user_to_access_collection($this->user->guid, $acl_id); + $this->assertTrue($result); + + if ($result) { + $result = remove_user_from_access_collection($this->user->guid, $acl_id); + $this->assertTrue($result); + } + + delete_access_collection($acl_id); + } + + public function testUpdateACL() { + // another fake user to test with + $user = new ElggUser(); + $user->username = 'test_user_' . rand(); + $user->email = 'fake_email@fake.com' . rand(); + $user->name = 'fake user'; + $user->access_id = ACCESS_PUBLIC; + $user->salt = generate_random_cleartext_password(); + $user->password = generate_user_password($user, rand()); + $user->owner_guid = 0; + $user->container_guid = 0; + $user->save(); + + $acl_id = create_access_collection('test acl'); + + $member_lists = array( + // adding + array( + $this->user->guid, + $user->guid + ), + // removing one, keeping one. + array( + $user->guid + ), + // removing one, adding one + array( + $this->user->guid, + ), + // removing all. + array() + ); + + foreach ($member_lists as $members) { + $result = update_access_collection($acl_id, $members); + $this->assertTrue($result); + + if ($result) { + $q = "SELECT * FROM {$this->dbPrefix}access_collection_membership + WHERE access_collection_id = $acl_id"; + $data = get_data($q); + + if (count($members) == 0) { + $this->assertFalse($data); + } else { + $this->assertEqual(count($members), count($data)); + } + foreach ($data as $row) { + $this->assertTrue(in_array($row->user_guid, $members)); + } + } + } + + delete_access_collection($acl_id); + $user->delete(); + } + + public function testCanEditACL() { + $acl_id = create_access_collection('test acl', $this->user->guid); + + // should be true since it's the owner + $result = can_edit_access_collection($acl_id, $this->user->guid); + $this->assertTrue($result); + + // should be true since IA is on. + $ia = elgg_set_ignore_access(true); + $result = can_edit_access_collection($acl_id); + $this->assertTrue($result); + elgg_set_ignore_access($ia); + + // should be false since IA is off + $ia = elgg_set_ignore_access(false); + $result = can_edit_access_collection($acl_id); + $this->assertFalse($result); + elgg_set_ignore_access($ia); + + delete_access_collection($acl_id); + } + + public function testCanEditACLHook() { + // if only we supported closures! + global $acl_test_info; + + $acl_id = create_access_collection('test acl'); + + $acl_test_info = array( + 'acl_id' => $acl_id, + 'user' => $this->user + ); + + function test_acl_access_hook($hook, $type, $value, $params) { + global $acl_test_info; + if ($params['user_id'] == $acl_test_info['user']->guid) { + $acl = get_access_collection($acl_test_info['acl_id']); + $value[$acl->id] = $acl->name; + } + + return $value; + } + + register_plugin_hook('access:collections:write', 'all', 'test_acl_access_hook'); + + // enable security since we usually run as admin + $ia = elgg_set_ignore_access(false); + $result = can_edit_access_collection($acl_id, $this->user->guid); + $this->assertTrue($result); + $ia = elgg_set_ignore_access($ia); + + unregister_plugin_hook('access:collections:write', 'all', 'test_acl_access_hook'); + } + + // groups interface + // only runs if the groups plugin is enabled because implementation is split between + // core and the plugin. + public function testCreateDeleteGroupACL() { + if (!is_plugin_enabled('groups')) { + return; + } + + $group = new ElggGroup(); + $group->name = 'Test group'; + $group->save(); + $acl = get_access_collection($group->group_acl); + + // ACLs are owned by groups + $this->assertEqual($acl->owner_guid, $group->guid); + + // removing group and acl + $this->assertTrue($group->delete()); + + $acl = get_access_collection($group->group_acl); + $this->assertFalse($acl); + + $group->delete(); + } + + public function testJoinLeaveGroupACL() { + if (!is_plugin_enabled('groups')) { + return; + } + + $group = new ElggGroup(); + $group->name = 'Test group'; + $group->save(); + + $result = $group->join($this->user); + $this->assertTrue($result); + + // disable security since we run as admin + $ia = elgg_set_ignore_access(false); + + // need to set the page owner to emulate being in a group context. + // this is kinda hacky. + elgg_set_page_owner_guid($group->getGUID()); + + if ($result) { + $can_edit = can_edit_access_collection($group->group_acl, $this->user->guid); + $this->assertTrue($can_edit); + } + + $result = $group->leave($this->user); + $this->assertTrue($result); + + if ($result) { + $can_edit = can_edit_access_collection($group->group_acl, $this->user->guid); + $this->assertFalse($can_edit); + } + + elgg_set_ignore_access($ia); + + $group->delete(); + } +} diff --git a/engine/tests/api/entity_getter_functions.php b/engine/tests/api/entity_getter_functions.php index aef7a991e..59b48999c 100644 --- a/engine/tests/api/entity_getter_functions.php +++ b/engine/tests/api/entity_getter_functions.php @@ -2789,4 +2789,13 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { $this->assertEqual($a_e_map[$a->id], $a->owner_guid); } } + + public function testElggGetEntitiesBadWheres() { + $options = array( + 'container_guid' => 'abc' + ); + + $entities = elgg_get_entities($options); + $this->assertFalse($entities); + } } diff --git a/engine/tests/api/helpers.php b/engine/tests/api/helpers.php index ee2e64cfe..36d680d54 100644 --- a/engine/tests/api/helpers.php +++ b/engine/tests/api/helpers.php @@ -204,7 +204,7 @@ class ElggCoreHelpersTest extends ElggCoreUnitTest { $this->assertTrue($result); $js_urls = elgg_get_loaded_js('footer'); - $this->assertIdentical(array('http://test1.com'), $js_urls); + $this->assertIdentical(array(500 => 'http://test1.com'), $js_urls); } /** @@ -227,9 +227,10 @@ class ElggCoreHelpersTest extends ElggCoreUnitTest { } $js_urls = elgg_get_loaded_js('head'); - $this->assertIdentical($js_urls[0], $urls['id1']); - $this->assertIdentical($js_urls[1], $urls['id2']); - $this->assertIdentical($js_urls[2], $urls['id3']); + + $this->assertIdentical($js_urls[500], $urls['id1']); + $this->assertIdentical($js_urls[501], $urls['id2']); + $this->assertIdentical($js_urls[502], $urls['id3']); $js_urls = elgg_get_loaded_js('footer'); $this->assertIdentical(array(), $js_urls); diff --git a/engine/tests/api/plugins.php b/engine/tests/api/plugins.php index 00b0d4513..72092b688 100644 --- a/engine/tests/api/plugins.php +++ b/engine/tests/api/plugins.php @@ -215,18 +215,6 @@ class ElggCorePluginsAPITest extends ElggCoreUnitTest { $this->assertEqual($this->package17->getManifest()->getDescription(), 'A 1.7-style manifest.'); } - public function testElggPluginManifestGetDescriptionTranslated() { - $en = array( - $this->package18->getManifest()->getDescription() => 'A translated 1.8 description!', - $this->package17->getManifest()->getDescription() => 'A translated 1.7 description!', - ); - - add_translation('en', $en); - - $this->assertEqual($this->package18->getManifest()->getDescription(), 'A translated 1.8 description!'); - $this->assertEqual($this->package17->getManifest()->getDescription(), 'A translated 1.7 description!'); - } - public function testElggPluginManifestGetCategories() { $categories = array( 'Admin', 'ServiceAPI' diff --git a/js/lib/elgglib.js b/js/lib/elgglib.js index f2545fb6c..9a372738d 100644 --- a/js/lib/elgglib.js +++ b/js/lib/elgglib.js @@ -379,4 +379,19 @@ elgg.getSelectorFromUrlFragment = function(url) { } } return ''; -};
\ No newline at end of file +}; + +/** + * Triggers the init hook when the library is ready + * + * Current requirements: + * - DOM is ready + * - languages loaded + * + */ +elgg.initWhenReady = function() { + if (elgg.config.languageReady && elgg.config.domReady) { + elgg.trigger_hook('init', 'system'); + elgg.trigger_hook('ready', 'system'); + } +}
\ No newline at end of file diff --git a/js/lib/languages.js b/js/lib/languages.js index 4cfe84968..ae7ba63e2 100644 --- a/js/lib/languages.js +++ b/js/lib/languages.js @@ -32,6 +32,8 @@ elgg.reload_all_translations = function(language) { }, success: function(json) { elgg.add_translation(lang, json); + elgg.config.languageReady = true; + elgg.initWhenReady(); } }); }; diff --git a/js/lib/ui.js b/js/lib/ui.js index 4426917ed..7abf7626f 100644 --- a/js/lib/ui.js +++ b/js/lib/ui.js @@ -275,5 +275,6 @@ elgg.ui.initDatePicker = function() { }); } + elgg.register_hook_handler('init', 'system', elgg.ui.init); elgg.register_hook_handler('getOptions', 'ui.popup', elgg.ui.LoginHandler);
\ No newline at end of file diff --git a/languages/en.php b/languages/en.php index c30a1bdd8..9d0590b2d 100644 --- a/languages/en.php +++ b/languages/en.php @@ -103,6 +103,7 @@ $english = array( 'ElggPlugin:Dependencies:Priority:Uninstalled' => '%s is not installed', 'ElggPlugin:Dependencies:Suggests:Unsatisfied' => 'Missing', + 'ElggPlugin:InvalidAndDeactivated' => '%s is an invalid plugin and has been deactivated.', 'InvalidParameterException:NonElggUser' => "Passing a non-ElggUser to an ElggUser constructor!", @@ -343,6 +344,8 @@ $english = array( 'friends:nocollectionname' => "You need to give your collection a name before it can be created.", 'friends:collections:members' => "Collection members", 'friends:collections:edit' => "Edit collection", + 'friends:collections:edited' => "Saved collection", + 'friends:collection:edit_failed' => 'Could not save collection.', 'friendspicker:chararray' => 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', @@ -405,6 +408,7 @@ $english = array( 'river' => "River", 'river:friend:user:default' => "%s is now a friend with %s", 'river:update:user:avatar' => '%s has a new avatar', + 'river:update:user:profile' => '%s has updated their profile', 'river:noaccess' => 'You do not have permission to view this item.', 'river:posted:generic' => '%s posted', 'riveritem:single:user' => 'a user', @@ -541,7 +545,8 @@ $english = array( 'admin:statistics:overview' => 'Overview', 'admin:appearance' => 'Appearance', - 'admin:utilities' => 'Utilities', + 'admin:administer_utilities' => 'Utilities', + 'admin:develop_utilities' => 'Utilities', 'admin:users' => "Users", 'admin:users:online' => 'Currently Online', @@ -598,6 +603,7 @@ $english = array( 'admin:plugins:category:inactive' => 'Inactive plugins', 'admin:plugins:category:admin' => 'Admin', 'admin:plugins:category:bundled' => 'Bundled', + 'admin:plugins:category:nonbundled' => 'Non-bundled', 'admin:plugins:category:content' => 'Content', 'admin:plugins:category:development' => 'Development', 'admin:plugins:category:enhancement' => 'Enhancements', @@ -608,6 +614,7 @@ $english = array( 'admin:plugins:category:multimedia' => 'Multimedia', 'admin:plugins:category:theme' => 'Themes', 'admin:plugins:category:widget' => 'Widgets', + 'admin:plugins:category:utility' => 'Utilities', 'admin:plugins:sort:priority' => 'Priority', 'admin:plugins:sort:alpha' => 'Alphabetical', @@ -806,6 +813,9 @@ $english = array( 'upgrade' => 'Upgrade', 'sort' => 'Sort', 'filter' => 'Filter', + 'new' => 'New', + 'add' => 'Add', + 'create' => 'Create', 'site' => 'Site', 'activity' => 'Activity', @@ -1048,10 +1058,10 @@ If you requested this click on the link below, otherwise ignore this email. * user default access */ -'default_access:settings' => "Your default access level", -'default_access:label' => "Default access", -'user:default_access:success' => "Your new default access level was saved.", -'user:default_access:failure' => "Your new default access level could not be saved.", + 'default_access:settings' => "Your default access level", + 'default_access:label' => "Default access", + 'user:default_access:success' => "Your new default access level was saved.", + 'user:default_access:failure' => "Your new default access level could not be saved.", /** * XML-RPC diff --git a/mod/dashboard/languages/en.php b/mod/dashboard/languages/en.php new file mode 100644 index 000000000..e1378f2f1 --- /dev/null +++ b/mod/dashboard/languages/en.php @@ -0,0 +1,14 @@ +<?php +/** + * User dashboard languages + */ + +$english = array( + 'dashboard:widget:group:title' => 'Group activity', + 'dashboard:widget:group:desc' => 'View the activity in one of your groups', + 'dashboard:widget:group:select' => 'Select a group', + 'dashboard:widget:group:noactivity' => 'There is no activity in this group', + 'dashboard:widget:group:noselect' => 'Edit this widget to select a group', +); + +add_translation("en", $english); diff --git a/mod/dashboard/start.php b/mod/dashboard/start.php index 69572bd32..5635ead57 100644 --- a/mod/dashboard/start.php +++ b/mod/dashboard/start.php @@ -18,6 +18,14 @@ function dashboard_init() { 'section' => 'alt', )); + elgg_register_widget_type( + 'group_activity', + elgg_echo('dashboard:widget:group:title'), + elgg_echo('dashboard:widget:group:desc'), + 'dashboard', + true + ); + elgg_register_plugin_hook_handler('get_list', 'default_widgets', 'dashboard_default_widgets'); } diff --git a/mod/dashboard/views/default/widgets/group_activity/content.php b/mod/dashboard/views/default/widgets/group_activity/content.php new file mode 100644 index 000000000..60a9b352c --- /dev/null +++ b/mod/dashboard/views/default/widgets/group_activity/content.php @@ -0,0 +1,36 @@ +<?php +/** + * Group activity widget + */ + +$num = (int) $vars['entity']->num_display; +$guid = $vars['entity']->group_guid; + +$content = ''; + +if ($guid) { + $title = get_entity($guid)->name; + $content = "<h3>$title</h3>"; + + elgg_push_context('widgets'); + $db_prefix = elgg_get_config('dbprefix'); + $activity = elgg_list_river(array( + 'limit' => $num, + 'pagination' => false, + 'joins' => array("JOIN {$db_prefix}entities e1 ON e1.guid = rv.object_guid"), + 'wheres' => array("(e1.container_guid = $guid)"), + )); + if (!$activity) { + $activity = '<p>' . elgg_echo('dashboard:widget:group:noactivity') . '</p>'; + } + elgg_pop_context(); + + $content .= $activity; +} else { + // no group selected yet + if ($vars['entity']->canEdit()) { + $content = '<p>' . elgg_echo('dashboard:widget:group:noselect') . '</p>'; + } +} + +echo $content; diff --git a/mod/dashboard/views/default/widgets/group_activity/edit.php b/mod/dashboard/views/default/widgets/group_activity/edit.php new file mode 100644 index 000000000..4e10f6ad4 --- /dev/null +++ b/mod/dashboard/views/default/widgets/group_activity/edit.php @@ -0,0 +1,45 @@ +<?php +/** + * Group activity widget settings + */ + +// once autocomplete is working use that +$groups = elgg_get_logged_in_user_entity()->getGroups("", 0); +$mygroups = array(); +if (!$vars['entity']->group_guid) { + $mygroups[0] = ''; +} +foreach ($groups as $group) { + $mygroups[$group->guid] = $group->name; +} +$params = array( + 'name' => 'params[group_guid]', + 'value' => $vars['entity']->group_guid, + 'options_values' => $mygroups, +); +$group_dropdown = elgg_view('input/dropdown', $params); +?> +<div> + <?php echo elgg_echo('dashboard:widget:group:select'); ?>: + <?php echo $group_dropdown; ?> +</div> +<?php + +// set default value for number to display +if (!isset($vars['entity']->num_display)) { + $vars['entity']->num_display = 8; +} + +$params = array( + 'name' => 'params[num_display]', + 'value' => $vars['entity']->num_display, + 'options' => array(5, 8, 10, 12, 15, 20), +); +$num_dropdown = elgg_view('input/dropdown', $params); + +?> +<div> + <?php echo elgg_echo('widget:numbertodisplay'); ?>: + <?php echo $num_dropdown; ?> +</div> + diff --git a/mod/developers/languages/en.php b/mod/developers/languages/en.php index 42df52134..a2682363c 100644 --- a/mod/developers/languages/en.php +++ b/mod/developers/languages/en.php @@ -6,10 +6,11 @@ $english = array( // menu + 'admin:develop_tools' => 'Tools', + 'admin:develop_tools:preview' => 'Theming Sandbox', + 'admin:develop_tools:inspect' => 'Inspect', 'admin:developers' => 'Developers', - 'admin:developers:settings' => 'Developer Settings', - 'admin:developers:preview' => 'Theming Preview', - 'admin:developers:inspect' => 'Inspect', + 'admin:developers:settings' => 'Settings', // settings 'elgg_dev_tools:settings:explanation' => 'Control your development and debugging settings below. Some of these settings are also available on other admin pages.', diff --git a/mod/developers/start.php b/mod/developers/start.php index d9e1141e0..ab9a174a4 100644 --- a/mod/developers/start.php +++ b/mod/developers/start.php @@ -59,9 +59,17 @@ function developers_process_settings() { function developers_setup_menu() { if (elgg_in_context('admin')) { - elgg_register_admin_menu_item('develop', 'settings', 'developers'); - elgg_register_admin_menu_item('develop', 'inspect', 'developers'); - elgg_register_admin_menu_item('develop', 'preview', 'developers'); + elgg_register_admin_menu_item('develop', 'inspect', 'develop_tools'); + elgg_register_admin_menu_item('develop', 'preview', 'develop_tools'); + + elgg_register_menu_item('page', array( + 'name' => 'dev_settings', + 'href' => 'admin/developers/settings', + 'text' => elgg_echo('settings'), + 'context' => 'admin', + 'priority' => 10, + 'section' => 'develop' + )); } } diff --git a/mod/developers/views/default/admin/developers/inspect.php b/mod/developers/views/default/admin/develop_tools/inspect.php index cfa3de2ea..cfa3de2ea 100644 --- a/mod/developers/views/default/admin/developers/inspect.php +++ b/mod/developers/views/default/admin/develop_tools/inspect.php diff --git a/mod/developers/views/default/admin/developers/preview.php b/mod/developers/views/default/admin/develop_tools/preview.php index 920047d98..920047d98 100644 --- a/mod/developers/views/default/admin/developers/preview.php +++ b/mod/developers/views/default/admin/develop_tools/preview.php diff --git a/mod/developers/views/default/js/developers/developers.php b/mod/developers/views/default/js/developers/developers.php index e6c249eb1..09e6ddd12 100644 --- a/mod/developers/views/default/js/developers/developers.php +++ b/mod/developers/views/default/js/developers/developers.php @@ -23,6 +23,7 @@ elgg.dev.inspectSubmit = function(event) { $("#developers-ajax-loader").show(); $(this).ajaxSubmit({ + dataType : 'json', success : function(response) { if (response) { $("#developers-inspect-results").html(response.output); diff --git a/mod/diagnostics/languages/en.php b/mod/diagnostics/languages/en.php index 6d71945e3..c4e337b50 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:develop_utilities:diagnostics' => 'System Diagnostics', 'diagnostics' => 'System diagnostics', 'diagnostics:report' => 'Diagnostics Report', 'diagnostics:unittester' => 'Unit Tests', diff --git a/mod/diagnostics/start.php b/mod/diagnostics/start.php index c55b10483..735e15042 100644 --- a/mod/diagnostics/start.php +++ b/mod/diagnostics/start.php @@ -16,7 +16,7 @@ function diagnostics_init() { elgg_register_page_handler('diagnostics','diagnostics_page_handler'); // Add admin menu item - elgg_register_admin_menu_item('develop', 'diagnostics', 'utilities'); + elgg_register_admin_menu_item('develop', 'diagnostics', 'develop_utilities'); // Register some actions $file = elgg_get_plugins_path() . "diagnostics/actions/download.php"; diff --git a/mod/diagnostics/views/default/admin/utilities/diagnostics.php b/mod/diagnostics/views/default/admin/develop_utilities/diagnostics.php index 76f12b0ae..76f12b0ae 100644 --- a/mod/diagnostics/views/default/admin/utilities/diagnostics.php +++ b/mod/diagnostics/views/default/admin/develop_utilities/diagnostics.php diff --git a/mod/embed/languages/en.php b/mod/embed/languages/en.php index f3a49e38b..287d34ca1 100644 --- a/mod/embed/languages/en.php +++ b/mod/embed/languages/en.php @@ -15,6 +15,8 @@ $english = array( // messages 'embed:no_upload_content' => 'No upload content!', 'embed:no_section_content' => 'No items found.', + + 'embed:no_sections' => 'No supported embed plugins found. Ask the site administrator to enabled a plugin with embed support.', ); add_translation("en", $english);
\ No newline at end of file diff --git a/mod/embed/manifest.xml b/mod/embed/manifest.xml index f61d27c23..02c012330 100644 --- a/mod/embed/manifest.xml +++ b/mod/embed/manifest.xml @@ -13,6 +13,10 @@ <type>elgg_version</type> <version>2010030101</version> </requires> + <requires> + <type>plugin</type> + <name>file</name> + </requires> <activate_on_install>true</activate_on_install> <admin_interface>advanced</admin_interface> </plugin_manifest> diff --git a/mod/embed/start.php b/mod/embed/start.php index bdd832b4e..6c26163e9 100644 --- a/mod/embed/start.php +++ b/mod/embed/start.php @@ -74,13 +74,34 @@ function embed_page_handler($page) { // listing // item // default to embed/listing | item if not found. - // @todo trigger for all right now. If we categorize these later we can trigger - // for certain categories. - $sections = elgg_trigger_plugin_hook('embed_get_sections', 'all', NULL, array()); - $upload_sections = elgg_trigger_plugin_hook('embed_get_upload_sections', 'all', NULL, array()); - - elgg_sort_3d_array_by_value($sections, 'name'); - elgg_sort_3d_array_by_value($upload_sections, 'name'); + + // @todo the menu system is good for registering and sorting, but not great for + // displaying tabs. + // Pulling in the menu manually and passing it through the embed/tabs view. + // We should work on making it easier to use tabs through the menu system, then fix + // this mess. + $menus = get_config('menus'); + $menu = $menus['embed:sections']; + + $sections = array(); + $upload_sections = array(); + + foreach ($menu as $item) { + switch ($item->section) { + case 'upload': + $upload_sections[$item->getName()] = array( + 'name' => $item->getText(), + ); + break; + + default: + $sections[$item->getName()] = array( + 'name' => $item->getText(), + ); + break; + } + } + $active_section = get_input('active_section', ''); $active_section = preg_replace('[\W]', '', $active_section); $internal_id = get_input('internal_id', ''); @@ -97,4 +118,4 @@ function embed_page_handler($page) { // exit because this is in a modal display. exit; -} +}
\ No newline at end of file diff --git a/mod/embed/views/default/embed/css.php b/mod/embed/views/default/embed/css.php index 150dc8733..03373da2b 100644 --- a/mod/embed/views/default/embed/css.php +++ b/mod/embed/views/default/embed/css.php @@ -8,7 +8,7 @@ .embed-wrapper { width: 730px; min-height: 400px; - margin: 5px; + margin: 15px; } .embed-wrapper h2 { color: #333333; diff --git a/mod/embed/views/default/embed/embed.php b/mod/embed/views/default/embed/embed.php index 2d8de1ca4..2bd329690 100644 --- a/mod/embed/views/default/embed/embed.php +++ b/mod/embed/views/default/embed/embed.php @@ -12,7 +12,6 @@ $sections = elgg_extract('sections', $vars, array()); $active_section = elgg_extract('active_section', $vars, array_shift(array_keys($sections)), false); $upload_sections = elgg_extract('upload_sections', $vars, array()); -$internal_id = elgg_extract('internal_id', $vars); if (!$sections) { $content = elgg_echo('embed:no_sections'); @@ -23,57 +22,17 @@ if (!$sections) { $offset = (int)max(0, get_input('offset', 0)); $limit = (int)get_input('limit', 5); - // build the items and layout. - if ($active_section == 'upload' || array_key_exists($active_section, $sections)) { - $section_info = $sections[$active_section]; - $layout = isset($section_info['layout']) ? $section_info['layout'] : 'list'; - - $params = array( - 'offset' => $offset, - 'limit' => $limit, - 'section' => $active_section, - 'upload_sections' => $upload_sections, - 'internal_id' => $internal_id - ); - - // allow full override for this section - // check for standard hook - if ($section_content = elgg_view("embed/$active_section/content", $params)) { - // handles its own pagination - $content .= $section_content; - } else { - // see if anyone has any items to display for the active section - $result = array('items' => array(), 'count' => 0); - $embed_info = elgg_trigger_plugin_hook('embed_get_items', $active_section, $params, $result); + // find the view to display + // @todo make it so you don't have to manually create views for each page + $view = "embed/$active_section/content"; + + $section_content = elgg_view($view, $vars); - // do we use default view or has someone defined "embed/$active_section/item/$layout" - $view = "embed/$active_section/item/$layout"; - if (!elgg_view_exists($view)) { - $view = "embed/item/$layout"; - } - - if (!isset($embed_info['items']) || !is_array($embed_info['items']) || !count($embed_info['items'])) { - $content .= elgg_echo('embed:no_section_content'); - } else { - - elgg_push_context('widgets'); - $content .= elgg_view_entity_list($embed_info['items'], array( - 'full_view' => false, - 'count' => $embed_info['count'], - 'pagination' => true, - 'position' => 'before', - 'offset' => $offset, - 'limit' => $limit, - )); - elgg_pop_context(); - - $js = elgg_view('js/embed/inline', array( - 'items' => $embed_info['items'], - )); - } - } + // build the items and layout. + if ($section_content) { + $content .= $section_content; } else { - $content .= elgg_echo('embed:invalid_section'); + $content .= elgg_echo('embed:no_section_content'); } } diff --git a/mod/embed/views/default/embed/item/gallery.php b/mod/embed/views/default/embed/item/gallery.php deleted file mode 100644 index daee8ee94..000000000 --- a/mod/embed/views/default/embed/item/gallery.php +++ /dev/null @@ -1,54 +0,0 @@ -<?php -/** - * Default item view for embed items in gallery display. - * - * Why don't we recycle the view/type/subtype views? - * Because we need to have special JavaScript that fires when you click on - * the icon / title. - * - * @todo Yes this is copy and pasted. Pete needs to theme. I'll DRY it up later. - * - * @uses object $vars['item'] The item to display - * @return string A formatted item - */ - -$item = $vars['item']; -$section = $vars['section']; -$target = $vars['target']; -$ecml_keyword = (isset($vars['ecml_enabled']) && isset($vars['ecml_keyword'])) ? $vars['ecml_keyword'] : NULL; -$icon_size = $vars['icon_size']; - -// @todo add entity checking. - -// different entity types have different title attribute names. -$title = isset($item->name) ? $item->name : $item->title; -// don't let it be too long -$title = elgg_get_excerpt($title); - -// @todo you can disable plugins that are required by other plugins -// (embed requires ecml) so fallback to a hard-coded check to see if ecml is enabled. -// #grumble -if ($ecml_keyword) { - $embed_code = "[$ecml_keyword guid={$item->getGUID()}]"; -} else { - // fallback to inserting a hard link to the object with its icon - $icon = "<img src=\"{$item->getIcon($icon_size)}\" />" . htmlentities($title, ENT_QUOTES, 'UTF-8'); - - $embed_code = elgg_view('output/url', array( - 'href' => $item->getURL(), - 'title' => $title, - 'text' => $title, - 'encode_text' => FALSE - )); -} - -$icon = "<img src=\"{$item->getIcon($icon_size)}\" />"; -$info = htmlentities($title, ENT_QUOTES, 'UTF-8'); - -$listing = elgg_view('entities/gallery_listing', array('icon' => $icon, 'info' => $info)); - -// @todo JS 1.8: no -echo "<div class=\"embed_data\" id=\"embed_{$item->getGUID()}\">$listing</div>"; -echo "<script type=\"text/javascript\"> - $('#embed_{$item->getGUID()}').data('embed_code', " . json_encode($embed_code) . "); -</script>";
\ No newline at end of file diff --git a/mod/embed/views/default/embed/item/list.php b/mod/embed/views/default/embed/item/list.php deleted file mode 100644 index 89a2ffb63..000000000 --- a/mod/embed/views/default/embed/item/list.php +++ /dev/null @@ -1,63 +0,0 @@ -<?php -/** - * Default item view for embed items in list display. - * - * Why don't we recycle the view/type/subtype views? - * Because we need to have special JavaScript that fires when you click on - * the icon / title. - * - * @uses object $vars['item'] The item to display - * @return string A formatted item - */ - -$item = $vars['item']; -$section = $vars['section']; -$target = $vars['target']; -$ecml_keyword = (isset($vars['ecml_enabled']) && $vars['ecml_enabled'] && isset($vars['ecml_keyword'])) ? $vars['ecml_keyword'] : NULL; -$icon_size = $vars['icon_size']; -$owner = $item->getOwnerEntity(); - -// @todo add entity checking. - -// different entity types have different title attribute names. -$title = isset($item->name) ? $item->name : $item->title; -// don't let it be too long -$title = elgg_get_excerpt($title); - -$author_text = elgg_echo('byline', array($owner->name)); -$date = elgg_view_friendly_time($item->time_created); - -$subtitle = "$author_text $date"; - -// @todo you can disable plugins that are required by other plugins -// (embed requires ecml) so fallback to a hard-coded check to see if ecml is enabled. -// #grumble -if ($ecml_keyword) { - $embed_code = "[$ecml_keyword guid={$item->getGUID()}]"; -} else { - // fallback to inserting a hard link to the object with its icon - $icon = "<img src=\"{$item->getIcon($icon_size)}\" />" . htmlentities($title, ENT_QUOTES, 'UTF-8'); - - $embed_code = elgg_view('output/url', array( - 'href' => $item->getURL(), - 'title' => $title, - 'text' => $icon, - 'encode_text' => FALSE - )); -} - -$item_icon = elgg_view_entity_icon($item, $icon_size); - -$params = array( - 'title' => $title, - 'entity' => $item, - 'subtitle' => $subtitle, - 'tags' => FALSE, -); -$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>'; -echo "<script type=\"text/javascript\"> - $('#embed_{$item->getGUID()}').data('embed_code', " . json_encode($embed_code) . "); -</script>";
\ No newline at end of file diff --git a/mod/embed/views/default/embed/layouts/gallery.php b/mod/embed/views/default/embed/layouts/gallery.php deleted file mode 100644 index 70b6d33a5..000000000 --- a/mod/embed/views/default/embed/layouts/gallery.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php -/** - * Embed - Gallery items - * - * @uses string $vars['content'] Pre-formatted content. - * - */ -$active_section = elgg_extract('section', $vars, array()); - -echo "<div class='embed_modal_$active_section'>" . elgg_extract('content', $vars, '') . "</div>"; diff --git a/mod/embed/views/default/embed/layouts/list.php b/mod/embed/views/default/embed/layouts/list.php deleted file mode 100644 index 5d62e572b..000000000 --- a/mod/embed/views/default/embed/layouts/list.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php -/** - * Embed - List items - * - * @uses string $vars['content'] Pre-formatted content. - * - */ -$active_section = elgg_extract('section', $vars, array()); - -echo "<div class='embed_modal_$active_section'>" . elgg_extract('content', $vars, '') . "</div>";
\ No newline at end of file diff --git a/mod/embed/views/default/embed/upload/content.php b/mod/embed/views/default/embed/upload/content.php deleted file mode 100644 index 8bedf5ad1..000000000 --- a/mod/embed/views/default/embed/upload/content.php +++ /dev/null @@ -1,41 +0,0 @@ -<?php -/** - * Special upload form - */ -$upload_sections = elgg_extract('upload_sections', $vars, array()); -$active_section = get_input('active_upload_section', array_shift(array_keys($upload_sections))); -$active_section = preg_replace('[\W]', '', $active_section); - -$options = array(); - -if ($upload_sections) { - foreach ($upload_sections as $id => $info) { - $options[$id] = $info['name']; - } - - $input = elgg_view('input/dropdown', array( - 'name' => 'download_section', - 'options_values' => $options, - 'id' => 'embed_upload', - 'value' => $active_section - )); - - // hack this in for now as we clean up this mess - $form_vars = array( - 'enctype' => 'multipart/form-data', - 'class' => 'elgg-form', - ); - $upload_content = elgg_view_form('file/upload', $form_vars); -/* - if (!$upload_content = elgg_view($upload_sections[$active_section]['view'])) { - $upload_content = elgg_echo('embed:no_upload_content'); - } -*/ - echo "<div class='mbm'>" . elgg_echo('embed:upload_type') . "$input</div>"; - echo "<div class='embed-upload'>"; - echo $upload_content; - echo "</div>"; - -} else { - echo elgg_echo('embed:no_upload_sections'); -} diff --git a/mod/embed/views/default/js/embed/embed.php b/mod/embed/views/default/js/embed/embed.php index ea92ba1fd..e9e08f9a0 100644 --- a/mod/embed/views/default/js/embed/embed.php +++ b/mod/embed/views/default/js/embed/embed.php @@ -1,9 +1,10 @@ +//<script> elgg.provide('elgg.embed'); elgg.embed.init = function() { // inserts the embed content into the textarea - $(".embed-wrapper .elgg-item").live('click', elgg.embed.insert); + $(".embed_data").live('click', elgg.embed.insert); // caches the current textarea id $(".embed-control").live('click', function() { @@ -30,7 +31,6 @@ elgg.embed.init = function() { * @return void */ elgg.embed.insert = function(event) { - var textAreaId = elgg.embed.textAreaId; var content = $(this).data('embed_code'); diff --git a/mod/embed/views/default/js/embed/inline.php b/mod/embed/views/default/js/embed/inline.php deleted file mode 100644 index 0672a68f8..000000000 --- a/mod/embed/views/default/js/embed/inline.php +++ /dev/null @@ -1,26 +0,0 @@ -<?php -/** - * Inline embed JavaScript for attaching the insert data to list items - * - * @uses $vars['items'] - */ - -foreach ($vars['items'] as $item) { - - // different entity types have different title attribute names. - $title = isset($item->name) ? $item->name : $item->title; - // don't let it be too long - $title = elgg_get_excerpt($title); - - $icon = "<img src=\"{$item->getIcon($icon_size)}\" />" . htmlspecialchars($title, ENT_QUOTES, 'UTF-8', false); - - $embed_code = elgg_view('output/url', array( - 'href' => $item->getURL(), - 'title' => $title, - 'text' => $icon, - 'encode_text' => false, - )); - $embed_code = json_encode($embed_code); - - echo "$('#elgg-object-{$item->getGUID()}').data('embed_code', $embed_code);"; -}
\ No newline at end of file diff --git a/mod/externalpages/manifest.xml b/mod/externalpages/manifest.xml index 453cef259..32528585d 100644 --- a/mod/externalpages/manifest.xml +++ b/mod/externalpages/manifest.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <plugin_manifest xmlns="http://www.elgg.org/plugin_manifest/1.8"> - <name>External Pages</name> + <name>Site Pages</name> <author>Core developers</author> <version>1.8</version> <category>bundled</category> diff --git a/mod/file/languages/en.php b/mod/file/languages/en.php index 72b198d54..aa30084a9 100644 --- a/mod/file/languages/en.php +++ b/mod/file/languages/en.php @@ -75,6 +75,8 @@ $english = array( 'item:object:file' => 'Files', + 'file:newupload' => 'A new file has been uploaded', + /** * Embed media **/ diff --git a/mod/file/pages/file/search.php b/mod/file/pages/file/search.php index 3e85d45db..402a28933 100644 --- a/mod/file/pages/file/search.php +++ b/mod/file/pages/file/search.php @@ -6,6 +6,11 @@ */ $page_owner_guid = get_input('page_owner', null); + +if ($page_owner_guid !== null) { + $page_owner_guid = sanitise_int($page_owner_guid); +} + if ($page_owner_guid) { elgg_set_page_owner_guid($page_owner_guid); } diff --git a/mod/file/start.php b/mod/file/start.php index b94dc309a..749d7a519 100644 --- a/mod/file/start.php +++ b/mod/file/start.php @@ -57,11 +57,23 @@ function file_init() { // temporary - see #2010 elgg_register_action("file/download", "$action_path/download.php"); - // embed support - elgg_register_plugin_hook_handler('embed_get_sections', 'all', 'file_embed_get_sections'); - elgg_register_plugin_hook_handler('embed_get_items', 'file', 'file_embed_get_items'); - elgg_register_plugin_hook_handler('embed_get_upload_sections', 'all', 'file_embed_get_upload_sections'); + $item = ElggMenuItem::factory(array( + 'name' => 'file', + 'text' => elgg_echo('file'), + 'href' => '#', + 'section' => 'select' + )); + elgg_register_menu_item('embed:sections', $item); + + $item = ElggMenuItem::factory(array( + 'name' => 'file_upload', + 'text' => elgg_echo('file:upload'), + 'href' => '#', + 'section' => 'upload' + )); + + elgg_register_menu_item('embed:sections', $item); } /** @@ -332,69 +344,4 @@ function file_icon_url_override($hook, $type, $returnvalue, $params) { $url = elgg_trigger_plugin_hook('file:icon:url', 'override', $params, $url); return $url; } -} - -/** - * Register file as an embed type. - * - * @param unknown_type $hook - * @param unknown_type $type - * @param unknown_type $value - * @param unknown_type $params - */ -function file_embed_get_sections($hook, $type, $value, $params) { - $value['file'] = array( - 'name' => elgg_echo('file'), - 'layout' => 'list', - 'icon_size' => 'small', - ); - - return $value; -} - -/** - * Return a list of files for embedding - * - * @param unknown_type $hook - * @param unknown_type $type - * @param unknown_type $value - * @param unknown_type $params - */ -function file_embed_get_items($hook, $type, $value, $params) { - $options = array( - 'owner_guid' => elgg_get_logged_in_user_guid(), - 'type_subtype_pair' => array('object' => 'file'), - 'count' => TRUE - ); - - if ($count = elgg_get_entities($options)) { - $value['count'] += $count; - - unset($options['count']); - $options['offset'] = $params['offset']; - $options['limit'] = $params['limit']; - - $items = elgg_get_entities($options); - - $value['items'] = array_merge($items, $value['items']); - } - - return $value; -} - -/** - * Register file as an embed type. - * - * @param unknown_type $hook - * @param unknown_type $type - * @param unknown_type $value - * @param unknown_type $params - */ -function file_embed_get_upload_sections($hook, $type, $value, $params) { - $value['file'] = array( - 'name' => elgg_echo('file'), - 'view' => 'file/embed_upload' - ); - - return $value; -} +}
\ No newline at end of file diff --git a/mod/file/views/default/embed/file/content.php b/mod/file/views/default/embed/file/content.php new file mode 100644 index 000000000..eadcd1a6d --- /dev/null +++ b/mod/file/views/default/embed/file/content.php @@ -0,0 +1,61 @@ +<?php +/** + * List files available for upload + */ + +$active_section = elgg_extract('active_section', $vars); + +$options = array( + 'owner_guid' => elgg_get_logged_in_user_guid(), + 'type_subtype_pair' => array('object' => 'file'), + 'count' => true +); + +$count = elgg_get_entities($options); + +if ($count) { + echo "<div class='embed_modal_$active_section'>"; + + unset($options['count']); + $items = elgg_get_entities($options); + + foreach ($items as $item) { + + // different entity types have different title attribute names. + $title = isset($item->name) ? $item->name : $item->title; + // don't let it be too long + $title = elgg_get_excerpt($title); + + $author_text = elgg_echo('byline', array($owner->name)); + $date = elgg_view_friendly_time($item->time_created); + + $subtitle = "$author_text $date"; + + $icon = "<img src=\"{$item->getIconURL($icon_size)}\" />"; + + $embed_code = elgg_view('output/url', array( + 'href' => $item->getURL(), + 'title' => $title, + 'text' => $icon, + 'encode_text' => FALSE + )); + + $item_icon = elgg_view_entity_icon($item, $icon_size); + + $params = array( + 'title' => $title, + 'entity' => $item, + 'subtitle' => $subtitle, + 'tags' => FALSE, + ); + $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>'; + echo "<script type=\"text/javascript\"> + $('#embed_{$item->getGUID()}').data('embed_code', " . json_encode($embed_code) . "); + </script>"; + } + + echo '</div>'; +}
\ No newline at end of file diff --git a/mod/file/views/default/embed/file_upload/content.php b/mod/file/views/default/embed/file_upload/content.php new file mode 100644 index 000000000..13c18f745 --- /dev/null +++ b/mod/file/views/default/embed/file_upload/content.php @@ -0,0 +1,15 @@ +<?php +/** + * Upload a file through the embed interface + */ + +$form_vars = array( + 'enctype' => 'multipart/form-data', + 'class' => 'elgg-form', +); +$upload_content = elgg_view_form('file/upload', $form_vars); + +echo "<div class='mbm'>" . elgg_echo('embed:upload_type') . "$input</div>"; +echo "<div class='embed-upload'>"; +echo $upload_content; +echo "</div>";
\ No newline at end of file diff --git a/mod/garbagecollector/views/default/settings/garbagecollector/edit.php b/mod/garbagecollector/views/default/plugins/garbagecollector/settings.php index 3ade780f9..3ade780f9 100644 --- a/mod/garbagecollector/views/default/settings/garbagecollector/edit.php +++ b/mod/garbagecollector/views/default/plugins/garbagecollector/settings.php diff --git a/mod/groups/actions/groups/membership/join.php b/mod/groups/actions/groups/membership/join.php index 210e285a5..b4f4e280c 100644 --- a/mod/groups/actions/groups/membership/join.php +++ b/mod/groups/actions/groups/membership/join.php @@ -10,6 +10,8 @@ * @package ElggGroups */ +global $CONFIG; + $user_guid = get_input('user_guid', elgg_get_logged_in_user_guid()); $group_guid = get_input('group_guid'); @@ -45,7 +47,7 @@ if (($user instanceof ElggUser) && ($group instanceof ElggGroup)) { add_entity_relationship($user->guid, 'membership_request', $group->guid); // Notify group owner - $url = "{$CONFIG->url}mod/groups/membershipreq.php?group_guid={$group->guid}"; + $url = "{$CONFIG->url}groups/requests/$group->guid"; $subject = elgg_echo('groups:request:subject', array( $user->name, $group->name, diff --git a/mod/groups/lib/groups.php b/mod/groups/lib/groups.php index 12a22deb4..86e6f018e 100644 --- a/mod/groups/lib/groups.php +++ b/mod/groups/lib/groups.php @@ -17,7 +17,7 @@ function groups_handle_all_page() { $selected_tab = get_input('filter', 'newest'); switch ($selected_tab) { - case 'pop': + case 'popular': $content = elgg_list_entities_from_relationship_count(array( 'type' => 'group', 'relationship' => 'member', @@ -25,7 +25,7 @@ function groups_handle_all_page() { 'full_view' => false, )); break; - case 'active': + case 'discussion': $content = elgg_list_entities(array( 'type' => 'object', 'subtype' => 'groupforumtopic', @@ -198,7 +198,7 @@ function groups_handle_invitations_page() { elgg_push_breadcrumb($title); // @todo temporary workaround for exts #287. - $invitations = groups_get_invited_groups($user->getGUID()); + $invitations = groups_get_invited_groups(elgg_get_logged_in_user_guid()); $content = elgg_view('groups/invitationrequests', array('invitations' => $invitations)); $params = array( diff --git a/mod/groups/views/default/groups/invitationrequests.php b/mod/groups/views/default/groups/invitationrequests.php index 788788324..9c2df8b9c 100644 --- a/mod/groups/views/default/groups/invitationrequests.php +++ b/mod/groups/views/default/groups/invitationrequests.php @@ -10,7 +10,7 @@ if (!empty($vars['invitations']) && is_array($vars['invitations'])) { echo '<ul class="elgg-list">'; foreach ($vars['invitations'] as $group) { if ($group instanceof ElggGroup) { - $icon = elgg_view_entity_icon($group, 'tiny', array('override' => 'true')); + $icon = elgg_view_entity_icon($group, 'tiny', array('hover' => 'true')); $group_title = elgg_view('output/url', array( 'href' => $group->getURL(), diff --git a/mod/groups/views/default/groups/membershiprequests.php b/mod/groups/views/default/groups/membershiprequests.php index 4d1c78c8c..7f33b83e0 100644 --- a/mod/groups/views/default/groups/membershiprequests.php +++ b/mod/groups/views/default/groups/membershiprequests.php @@ -11,7 +11,7 @@ if (!empty($vars['requests']) && is_array($vars['requests'])) { echo '<ul class="elgg-list">'; foreach ($vars['requests'] as $user) { if ($user instanceof ElggUser) { - $icon = elgg_view_entity_icon($user, 'tiny', array('override' => 'true')); + $icon = elgg_view_entity_icon($user, 'tiny', array('hover' => 'true')); $user_title = elgg_view('output/url', array( 'href' => $user->getURL(), diff --git a/mod/groups/views/default/settings/groups/edit.php b/mod/groups/views/default/plugins/groups/settings.php index 7197dcb37..7197dcb37 100644 --- a/mod/groups/views/default/settings/groups/edit.php +++ b/mod/groups/views/default/plugins/groups/settings.php diff --git a/mod/groups/views/default/widgets/a_users_groups/content.php b/mod/groups/views/default/widgets/a_users_groups/content.php index 81d355442..114fd7565 100644 --- a/mod/groups/views/default/widgets/a_users_groups/content.php +++ b/mod/groups/views/default/widgets/a_users_groups/content.php @@ -21,7 +21,7 @@ $content = elgg_list_entities_from_relationship($options); echo $content; if ($content) { - $url = "group/member/" . elgg_get_page_owner_entity()->username; + $url = "groups/member/" . elgg_get_page_owner_entity()->username; $more_link = elgg_view('output/url', array( 'href' => $url, 'text' => elgg_echo('groups:more'), diff --git a/mod/likes/actions/likes/add.php b/mod/likes/actions/likes/add.php index b76c1bea9..a6a8d6c45 100644 --- a/mod/likes/actions/likes/add.php +++ b/mod/likes/actions/likes/add.php @@ -41,18 +41,7 @@ if (!$annotation) { // notify if poster wasn't owner if ($entity->owner_guid != $user->guid) { - notify_user($entity->owner_guid, - $user->guid, - elgg_echo('likes:email:subject'), - elgg_echo('likes:email:body', array( - $user->name, - $entity->title, - //$comment_text, - $entity->getURL(), - $user->name, - $user->getURL() - )) - ); + likes_notify_user($entity->getOwnerEntity(), $user, $entity); } system_message(elgg_echo("likes:likes")); diff --git a/mod/likes/languages/en.php b/mod/likes/languages/en.php index aad2a7f24..29b379506 100644 --- a/mod/likes/languages/en.php +++ b/mod/likes/languages/en.php @@ -17,9 +17,28 @@ $english = array( 'likes:userlikedthis' => '%s like', 'likes:userslikedthis' => '%s likes', 'likes:river:annotate' => 'likes', - 'likes:email:body' => '%s liked %s', - 'likes:email:subject' => 'A user liked one of your objects', + 'river:likes' => 'likes %s %s', + + // notifications. yikes. + 'likes:notifications:subject' => '%s likes your post "%s"', + 'likes:notifications:body' => +'Hi %1$s, + +%2$s likes your post "%3$s" on %4$s! + +See your original post here: + +%5$s + +or view %2$s\'s profile here: + +%6$s + +Thanks, +%4$s +', + ); add_translation('en', $english); diff --git a/mod/likes/start.php b/mod/likes/start.php index d45fb96b3..76b48a369 100644 --- a/mod/likes/start.php +++ b/mod/likes/start.php @@ -109,3 +109,52 @@ function likes_count($entity) { return $entity->countAnnotations('likes'); } } + +/** + * Notify $user that $liker liked his $entity. + * + * @param type $user + * @param type $liker + * @param type $entity + */ +function likes_notify_user(ElggUser $user, ElggUser $liker, ElggEntity $entity) { + + if (!$user instanceof ElggUser) { + return false; + } + + if (!$liker instanceof ElggUser) { + return false; + } + + if (!$entity instanceof ElggEntity) { + return false; + } + + $title_str = $entity->title; + if (!$title_str) { + $title_str = elgg_get_excerpt($entity->description); + } + + $site = get_config('site'); + + $subject = elgg_echo('likes:notifications:subject', array( + $liker->name, + $title_str + )); + + $body = elgg_echo('likes:notifications:body', array( + $user->name, + $liker->name, + $title_str, + $site->name, + $entity->getURL(), + $liker->getURL() + )); + + notify_user($user->guid, + $liker->guid, + $subject, + $body + ); +}
\ No newline at end of file diff --git a/mod/likes/views/default/likes/count.php b/mod/likes/views/default/likes/count.php index bdc50bcd1..071a069bd 100644 --- a/mod/likes/views/default/likes/count.php +++ b/mod/likes/views/default/likes/count.php @@ -24,8 +24,13 @@ if ($num_of_likes) { 'href' => "#likes-$guid" ); $list = elgg_view('output/url', $params); - $list .= "<div class='elgg-module elgg-module-popup elgg-likes-list hidden clearfix' id='likes-$guid'>"; - $list .= elgg_list_annotations(array('guid' => $guid, 'annotation_name' => 'likes', 'limit' => 99)); + $list .= "<div class='elgg-module elgg-module-popup elgg-likes hidden clearfix' id='likes-$guid'>"; + $list .= elgg_list_annotations(array( + 'guid' => $guid, + 'annotation_name' => 'likes', + 'limit' => 99, + 'list_class' => 'elgg-list-likes' + )); $list .= "</div>"; echo $list; } diff --git a/mod/likes/views/default/likes/css.php b/mod/likes/views/default/likes/css.php index fabf54e46..1ec07b366 100644 --- a/mod/likes/views/default/likes/css.php +++ b/mod/likes/views/default/likes/css.php @@ -7,7 +7,7 @@ /* *************************************** Likes *************************************** */ -.elgg-likes-list { +.elgg-likes { width: 345px; position: absolute; } diff --git a/mod/likes/views/default/likes/js.php b/mod/likes/views/default/likes/js.php index b7e000539..f701ebedf 100644 --- a/mod/likes/views/default/likes/js.php +++ b/mod/likes/views/default/likes/js.php @@ -15,7 +15,7 @@ * @return {Object} */ elgg.ui.likesPopupHandler = function(hook, type, params, options) { - if (params.target.hasClass('elgg-likes-list')) { + if (params.target.hasClass('elgg-likes')) { options.my = 'right bottom'; options.at = 'left top'; return options; diff --git a/mod/logbrowser/languages/en.php b/mod/logbrowser/languages/en.php index 90689a1b0..3b6ead272 100644 --- a/mod/logbrowser/languages/en.php +++ b/mod/logbrowser/languages/en.php @@ -6,7 +6,7 @@ */ $english = array( - 'admin:utilities:logbrowser' => 'Log browser', + 'admin:administer_utilities:logbrowser' => 'Log browser', 'logbrowser' => 'Log browser', 'logbrowser:browse' => 'Browse system log', 'logbrowser:search' => 'Refine results', diff --git a/mod/logbrowser/start.php b/mod/logbrowser/start.php index eedc9d8ad..3bffe800a 100644 --- a/mod/logbrowser/start.php +++ b/mod/logbrowser/start.php @@ -14,7 +14,7 @@ function logbrowser_init() { elgg_register_plugin_hook_handler('register', 'menu:user_hover', 'logbrowser_user_hover_menu'); - elgg_register_admin_menu_item('administer', 'logbrowser', 'utilities'); + elgg_register_admin_menu_item('administer', 'logbrowser', 'administer_utilities'); } /** @@ -23,7 +23,7 @@ function logbrowser_init() { function logbrowser_user_hover_menu($hook, $type, $return, $params) { $user = $params['entity']; - $url = "admin/overview/logbrowser?user_guid={$user->guid}"; + $url = "admin/utilities/logbrowser?user_guid={$user->guid}"; $item = new ElggMenuItem('logbrowser', elgg_echo('logbrowser:explore'), $url); $item->setSection('admin'); $return[] = $item; diff --git a/mod/logbrowser/views/default/admin/utilities/logbrowser.php b/mod/logbrowser/views/default/admin/administer_utilities/logbrowser.php index dadc6cda3..2be1f33dc 100644 --- a/mod/logbrowser/views/default/admin/utilities/logbrowser.php +++ b/mod/logbrowser/views/default/admin/administer_utilities/logbrowser.php @@ -34,7 +34,7 @@ if ($timeupper) { $timeupper = strtotime($timeupper); } -$form = elgg_view('logbrowser/form', array( +$refine = elgg_view('logbrowser/refine', array( 'user_guid' => $user, 'timeupper' => $timeupper, 'timelower' => $timelower, @@ -54,7 +54,7 @@ $nav = elgg_view('navigation/pagination',array( // display admin body $body = <<<__HTML -$form +$refine $nav $table $nav diff --git a/mod/logbrowser/views/default/forms/logbrowser/refine.php b/mod/logbrowser/views/default/forms/logbrowser/refine.php new file mode 100644 index 000000000..ff3f48b03 --- /dev/null +++ b/mod/logbrowser/views/default/forms/logbrowser/refine.php @@ -0,0 +1,53 @@ +<?php +/** + * Form body for refining the log browser search. + * Look for a particular person or in a time window. + * + * @uses $vars['user_guid'] + * @uses $vars['timelower'] + * @uses $vars['timeupper'] + */ + +if (isset($vars['timelower'])) { + $lowerval = date('r',$vars['timelower']); +} else { + $lowerval = ""; +} +if (isset($vars['timeupper'])) { + $upperval = date('r',$vars['timeupper']); +} else { + $upperval = ""; +} +if (isset($vars['user_guid'])) { + if ($user = get_entity($vars['user_guid'])) { + $userval = $user->username; + } +} else { + $userval = ""; +} + + +$form = "<div>" . elgg_echo('logbrowser:user'); +$form .= elgg_view('input/text', array( + 'name' => 'search_username', + 'value' => $userval, +)) . "</div>"; + +$form .= "<div>" . elgg_echo('logbrowser:starttime'); +$form .= elgg_view('input/text', array( + 'name' => 'timelower', + 'value' => $lowerval, +)) . "</div>"; + +$form .= "<div>" . elgg_echo('logbrowser:endtime'); +$form .= elgg_view('input/text', array( + 'name' => 'timeupper', + 'value' => $upperval, +)) . "</div>"; +$form .= '<div class="elgg-foot">'; +$form .= elgg_view('input/submit', array( + 'value' => elgg_echo('search'), +)); +$form .= '</div>'; + +echo $form; diff --git a/mod/logbrowser/views/default/logbrowser/form.php b/mod/logbrowser/views/default/logbrowser/form.php deleted file mode 100644 index d5cf9f6b8..000000000 --- a/mod/logbrowser/views/default/logbrowser/form.php +++ /dev/null @@ -1,76 +0,0 @@ -<?php -/** - * Log browser search form - * - * @package ElggLogBrowser - */ -?> - -<div id="logbrowser-search-area"> -<?php - - if ($vars['timelower']) { - $lowerval = date('r',$vars['timelower']); - } else { - $lowerval = ""; - } - if ($vars['timeupper']) { - $upperval = date('r',$vars['timeupper']); - } else { - $upperval = ""; - } - if ($vars['user_guid']) { - if ($user = get_entity($vars['user_guid'])) - $userval = $user->username; - } else { - $userval = ""; - } - - - $form = "<p>" . elgg_echo('logbrowser:user'); - $form .= elgg_view('input/text', array( - 'name' => 'search_username', - 'value' => $userval, - )) . "</p>"; - - $form .= "<p>" . elgg_echo('logbrowser:starttime'); - $form .= elgg_view('input/text', array( - 'name' => 'timelower', - 'value' => $lowerval, - )) . "</p>"; - - $form .= "<p>" . elgg_echo('logbrowser:endtime'); - $form .= elgg_view('input/text', array( - 'name' => 'timeupper', - 'value' => $upperval, - )) . "</p>"; - $form .= elgg_view('input/submit', array( - 'value' => elgg_echo('search'), - )); - - //@todo Forms 1.8: Convert to use elgg_view_form() - $wrappedform = elgg_view('input/form', array( - 'body' => $form, - 'method' => 'get', - 'action' => "admin/overview/logbrowser", - 'disable_security' => true, - )); - - $toggle_link = elgg_view('output/url', array( - 'href' => '#log-browser-search-form', - 'text' => elgg_echo('logbrowser:search'), - 'rel' => 'toggle', - )); -?> - <p> - <?php echo $toggle_link; ?> - </p> - <div id="log-browser-search-form" class="elgg-module elgg-module-inline hidden"> - <div class="elgg-head"> - <h3><?php echo elgg_echo('logbrowser:search'); ?></h3> - </div> - <div class="elgg-body"> - <?php echo $wrappedform; ?> - </div> - </div> -</div>
\ No newline at end of file diff --git a/mod/logbrowser/views/default/logbrowser/refine.php b/mod/logbrowser/views/default/logbrowser/refine.php new file mode 100644 index 000000000..27cb6042f --- /dev/null +++ b/mod/logbrowser/views/default/logbrowser/refine.php @@ -0,0 +1,35 @@ +<?php +/** + * Log browser search form + * + * @package ElggLogBrowser + */ + +$form_vars = array( + 'method' => 'get', + 'action' => 'admin/administer_utilities/logbrowser', + 'disable_security' => true, +); +$form = elgg_view_form('logbrowser/refine', $form_vars, $vars); + +$toggle_link = elgg_view('output/url', array( + 'href' => '#log-browser-search-form', + 'text' => elgg_echo('logbrowser:search'), + 'rel' => 'toggle', +)); + +?> + +<div id="logbrowser-search-area" class="mbm"> + <div> + <?php echo $toggle_link; ?> + </div> + <div id="log-browser-search-form" class="elgg-module elgg-module-inline hidden"> + <div class="elgg-head"> + <h3><?php echo elgg_echo('logbrowser:search'); ?></h3> + </div> + <div class="elgg-body"> + <?php echo $form; ?> + </div> + </div> +</div>
\ No newline at end of file diff --git a/mod/logrotate/languages/en.php b/mod/logrotate/languages/en.php index c3cf2d8ad..27731d732 100644 --- a/mod/logrotate/languages/en.php +++ b/mod/logrotate/languages/en.php @@ -15,7 +15,7 @@ $english = array( 'logrotate:logrotated' => "Log rotated\n", 'logrotate:lognotrotated' => "Error rotating log\n", - 'logrotate:date' => 'Delete archived logs older than a', + 'logrotate:delete' => 'Delete archived logs older than a', 'logrotate:week' => 'week', 'logrotate:month' => 'month', diff --git a/mod/logrotate/start.php b/mod/logrotate/start.php index c05506d83..28f14ad14 100644 --- a/mod/logrotate/start.php +++ b/mod/logrotate/start.php @@ -9,7 +9,7 @@ elgg_register_event_handler('init', 'system', 'logrotate_init'); function logrotate_init() { $period = elgg_get_plugin_setting('period', 'logrotate'); - $time = elgg_get_plugin_setting('time', 'logrotate'); + $delete = elgg_get_plugin_setting('delete', 'logrotate'); switch ($period) { case 'weekly': case 'monthly' : @@ -22,7 +22,7 @@ function logrotate_init() { // Register cron hook for archival of logs elgg_register_plugin_hook_handler('cron', $period, 'logrotate_archive_cron'); // Register cron hook for deletion of selected archived logs - elgg_register_plugin_hook_handler('cron', $time, 'logrotate_delete_cron'); + elgg_register_plugin_hook_handler('cron', $delete, 'logrotate_delete_cron'); } /** @@ -64,7 +64,7 @@ function logrotate_delete_cron($hook, $entity_type, $returnvalue, $params) { $day = 86400; $offset = 0; - $period = elgg_get_plugin_setting('time', 'logrotate'); + $period = elgg_get_plugin_setting('delete', 'logrotate'); switch ($period) { case 'weekly': $offset = $day * 7; @@ -90,7 +90,6 @@ function logrotate_delete_cron($hook, $entity_type, $returnvalue, $params) { * * @param int $time_of_delete An offset in seconds from now to delete (useful for log deletion) */ - function log_browser_delete_log($time_of_delete) { global $CONFIG; diff --git a/mod/logrotate/views/default/settings/logrotate/edit.php b/mod/logrotate/views/default/plugins/logrotate/settings.php index 64c7bf743..d9c4032fe 100644 --- a/mod/logrotate/views/default/settings/logrotate/edit.php +++ b/mod/logrotate/views/default/plugins/logrotate/settings.php @@ -16,9 +16,9 @@ if (!$time) { } ?> <div> - <?php echo elgg_echo('logrotate:period'); ?> - <?php + + echo elgg_echo('logrotate:period') . ' '; echo elgg_view('input/dropdown', array( 'name' => 'params[period]', 'options_values' => array( @@ -29,14 +29,13 @@ if (!$time) { 'value' => $period )); ?> - - <?php echo elgg_echo('</div><div>'); ?> - - <?php echo elgg_echo('logrotate:date'); ?> - +</div> +<div> <?php - echo elgg_view('input/pulldown', array( - 'name' => 'params[time]', + + echo elgg_echo('logrotate:delete') . ' '; + echo elgg_view('input/dropdown', array( + 'name' => 'params[delete]', 'options_values' => array( 'weekly' => elgg_echo('logrotate:week'), 'monthly' => elgg_echo('logrotate:month'), diff --git a/mod/messageboard/views/default/messageboard/js.php b/mod/messageboard/views/default/messageboard/js.php index 5d89fcd69..e5495409a 100644 --- a/mod/messageboard/views/default/messageboard/js.php +++ b/mod/messageboard/views/default/messageboard/js.php @@ -23,7 +23,7 @@ elgg.messageboard.submit = function(e) { data: data, success: function(json) { // the action always returns the full ul and li wrapped annotation. - var ul = form.next('ul.elgg-annotation-list'); + var ul = form.next('ul.elgg-list-annotation'); if (ul.length < 1) { form.parent().append(json.output); diff --git a/mod/notifications/views/default/notifications/subscriptions/forminternals.php b/mod/notifications/views/default/notifications/subscriptions/forminternals.php index 106eadc54..a7fbec2fd 100644 --- a/mod/notifications/views/default/notifications/subscriptions/forminternals.php +++ b/mod/notifications/views/default/notifications/subscriptions/forminternals.php @@ -234,7 +234,7 @@ END; <td class="namefield"> <a href="<?php echo $friend->getURL(); ?>"> <?php - echo elgg_view_entity_icon($friend, 'tiny', array('override' => true)); + echo elgg_view_entity_icon($friend, 'tiny', array('hover' => false)); ?> </a> <p class="namefieldlink"> diff --git a/mod/pages/pages/pages/edit.php b/mod/pages/pages/pages/edit.php index e6c2ea015..6f54d72bf 100644 --- a/mod/pages/pages/pages/edit.php +++ b/mod/pages/pages/pages/edit.php @@ -7,15 +7,15 @@ gatekeeper(); -$page_guid = get_input('guid'); +$page_guid = (int)get_input('guid'); $page = get_entity($page_guid); if (!$page) { - + } $container = $page->getContainerEntity(); if (!$container) { - + } elgg_set_page_owner_guid($container->getGUID()); diff --git a/mod/profile/views/default/profile/js.php b/mod/profile/views/default/profile/js.php index edf68543c..16dec59df 100644 --- a/mod/profile/views/default/profile/js.php +++ b/mod/profile/views/default/profile/js.php @@ -1,3 +1,6 @@ elgg.register_hook_handler('init', 'system', function() { - $('#elgg-widget-col-1').css('min-height', $('.profile').outerHeight(true) + 1); + // only do this on the profile page's widget canvas. + if ($('.profile').length) { + $('#elgg-widget-col-1').css('min-height', $('.profile').outerHeight(true) + 1); + } });
\ No newline at end of file diff --git a/mod/profile/views/default/profile/owner_block.php b/mod/profile/views/default/profile/owner_block.php index 5a65a3a26..05cb41a14 100644 --- a/mod/profile/views/default/profile/owner_block.php +++ b/mod/profile/views/default/profile/owner_block.php @@ -11,7 +11,7 @@ if (!$user) { return TRUE; } -$icon = elgg_view_entity_icon($user, 'large', array('override' => 'true')); +$icon = elgg_view_entity_icon($user, 'large', array('hover' => 'true')); // grab the actions and admin menu items from user hover $menu = elgg_trigger_plugin_hook('register', "menu:user_hover", array('entity' => $user), array()); diff --git a/mod/reportedcontent/languages/en.php b/mod/reportedcontent/languages/en.php index c047644e3..c2e197879 100644 --- a/mod/reportedcontent/languages/en.php +++ b/mod/reportedcontent/languages/en.php @@ -8,7 +8,7 @@ $english = array( 'item:object:reported_content' => 'Reported items', - 'admin:utilities:reportedcontent' => 'Reported content', + 'admin:administer_utilities:reportedcontent' => 'Reported content', 'reportedcontent' => 'Reported content', 'reportedcontent:this' => 'Report this', 'reportedcontent:this:tooltip' => 'Report this page to an administrator', diff --git a/mod/reportedcontent/start.php b/mod/reportedcontent/start.php index 87b4b3c7b..66a1248d9 100644 --- a/mod/reportedcontent/start.php +++ b/mod/reportedcontent/start.php @@ -39,7 +39,7 @@ function reportedcontent_init() { // Add admin menu item // @todo Might want to move this to a 'feedback' section. something other than utils - elgg_register_admin_menu_item('administer', 'reportedcontent', 'utilities'); + elgg_register_admin_menu_item('administer', 'reportedcontent', 'administer_utilities'); elgg_register_widget_type( 'reportedcontent', diff --git a/mod/reportedcontent/views/default/admin/utilities/reportedcontent.php b/mod/reportedcontent/views/default/admin/administer_utilities/reportedcontent.php index 32f108312..32f108312 100644 --- a/mod/reportedcontent/views/default/admin/utilities/reportedcontent.php +++ b/mod/reportedcontent/views/default/admin/administer_utilities/reportedcontent.php diff --git a/mod/reportedcontent/views/default/object/reported_content.php b/mod/reportedcontent/views/default/object/reported_content.php index 6bcbf6e5d..b0176c11f 100644 --- a/mod/reportedcontent/views/default/object/reported_content.php +++ b/mod/reportedcontent/views/default/object/reported_content.php @@ -29,7 +29,7 @@ if ($report->state == 'archived') { 'href' => $archive_url, 'text' => elgg_echo('reportedcontent:archive'), 'is_action' => true, - 'class' => 'elgg-button elgg-button-action', + 'class' => 'elgg-button elgg-button-action mrm', ); echo elgg_view('output/url', $params); } diff --git a/mod/reportedcontent/views/default/reportedcontent/admin_css.php b/mod/reportedcontent/views/default/reportedcontent/admin_css.php index 2eba964a1..1ed240f3b 100644 --- a/mod/reportedcontent/views/default/reportedcontent/admin_css.php +++ b/mod/reportedcontent/views/default/reportedcontent/admin_css.php @@ -28,7 +28,7 @@ } .reported-content .controls { float: right; - margin: 0 0 0 10px; + margin: 5px 0 0 10px; } .report-details { background-color: white; diff --git a/mod/search/search_hooks.php b/mod/search/search_hooks.php index 428d6f700..b302272fb 100644 --- a/mod/search/search_hooks.php +++ b/mod/search/search_hooks.php @@ -202,6 +202,10 @@ function search_tags_hook($hook, $type, $value, $params) { $search_tag_names = $valid_tag_names; } + if (!$search_tag_names) { + return array('entities' => array(), 'count' => $count); + } + // don't use elgg_get_entities_from_metadata() here because of // performance issues. since we don't care what matches at this point // use an IN clause to grab everything that matches at once and sort @@ -337,7 +341,7 @@ function search_comments_hook($hook, $type, $value, $params) { $container_and = ''; if ($params['container_guid'] && $params['container_guid'] !== ELGG_ENTITIES_ANY_VALUE) { - $container_and = 'AND e.container_guid = ' . sanitise_string($params['container_guid']); + $container_and = 'AND e.container_guid = ' . sanitise_int($params['container_guid']); } $e_access = get_access_sql_suffix('e'); diff --git a/mod/search/views/default/search/css.php b/mod/search/views/default/search/css.php index 601536c81..0b8f34b60 100644 --- a/mod/search/views/default/search/css.php +++ b/mod/search/views/default/search/css.php @@ -30,11 +30,11 @@ Search plugin font-size: 12px; font-weight: bold; padding: 2px 4px 2px 26px; - background: transparent url(<?php echo elgg_get_site_url(); ?>_graphics/elgg_sprites.png) no-repeat 2px -718px; + background: transparent url(<?php echo elgg_get_site_url(); ?>_graphics/elgg_sprites.png) no-repeat 2px -934px; } .elgg-search input[type=text]:focus, .elgg-search input[type=text]:active { background-color: white; - background-position: 2px -700px; + background-position: 2px -916px; border: 1px solid white; color: #0054A7; } diff --git a/mod/twitter_api/views/default/settings/twitter_api/edit.php b/mod/twitter_api/views/default/plugins/twitter_api/settings.php index 4e52a5c9d..0b9afd4cf 100644 --- a/mod/twitter_api/views/default/settings/twitter_api/edit.php +++ b/mod/twitter_api/views/default/plugins/twitter_api/settings.php @@ -9,14 +9,14 @@ $consumer_key_string = elgg_echo('twitter_api:consumer_key'); $consumer_key_view = elgg_view('input/text', array( 'name' => 'params[consumer_key]', 'value' => $vars['entity']->consumer_key, - 'class' => 'text_input', + 'class' => 'elgg-input-thin', )); $consumer_secret_string = elgg_echo('twitter_api:consumer_secret'); $consumer_secret_view = elgg_view('input/text', array( 'name' => 'params[consumer_secret]', 'value' => $vars['entity']->consumer_secret, - 'class' => 'text_input twitter-secret', + 'class' => 'elgg-input-thin', )); $sign_on_with_twitter_string = elgg_echo('twitter_api:login'); @@ -40,7 +40,7 @@ $new_users_with_twitter_view = elgg_view('input/dropdown', array( )); $settings = <<<__HTML -<div class="elgg-instructs mtm"><p>$instructions</p></div> +<div class="elgg-content-thin mtm"><p>$instructions</p></div> <div><label>$consumer_key_string</label><br /> $consumer_key_view</div> <div><label>$consumer_secret_string</label><br /> $consumer_secret_view</div> <div>$sign_on_with_twitter_string $sign_on_with_twitter_view</div> diff --git a/mod/twitter_api/views/default/usersettings/twitter_api/edit.php b/mod/twitter_api/views/default/plugins/twitter_api/usersettings.php index acb8d9af5..65d04b883 100644 --- a/mod/twitter_api/views/default/usersettings/twitter_api/edit.php +++ b/mod/twitter_api/views/default/plugins/twitter_api/usersettings.php @@ -5,9 +5,9 @@ $user = elgg_get_logged_in_user_entity(); $user_guid = $user->getGUID(); -$twitter_name = get_plugin_usersetting('twitter_name', $user_guid, 'twitter_api'); -$access_key = get_plugin_usersetting('access_key', $user_guid, 'twitter_api'); -$access_secret = get_plugin_usersetting('access_secret', $user_guid, 'twitter_api'); +$twitter_name = elgg_get_plugin_user_setting('twitter_name', $user_guid, 'twitter_api'); +$access_key = elgg_get_plugin_user_setting('access_key', $user_guid, 'twitter_api'); +$access_secret = elgg_get_plugin_user_setting('access_secret', $user_guid, 'twitter_api'); $site_name = elgg_get_site_entity()->name; echo '<div>' . elgg_echo('twitter_api:usersettings:description', array($site_name)) . '</div>'; @@ -21,7 +21,7 @@ if (!$access_key || !$access_secret) { // let them disassociate their account. if ($user->email) { $url = elgg_get_site_url() . "twitter_api/revoke"; - echo '<div class="twitter_anywhere">' . elgg_echo('twitter_api:usersettings:authorized', array($site_name, $twitter_name)) . '</div>'; + echo '<div>' . elgg_echo('twitter_api:usersettings:authorized', array($site_name, $twitter_name)) . '</div>'; echo '<div>' . sprintf(elgg_echo('twitter_api:usersettings:revoke'), $url) . '</div>'; } else { echo elgg_echo('twitter_api:usersettings:cannot_revoke', array(elgg_normalize_url('twitter_api/interstitial'))); diff --git a/version.php b/version.php index ce26e9797..d49ce5eb0 100644 --- a/version.php +++ b/version.php @@ -11,7 +11,7 @@ // YYYYMMDD = Elgg Date // XX = Interim incrementer -$version = 2011061200; +$version = 2011092500; // Human-friendly version name -$release = '1.8b2'; +$release = '1.8.0.1'; diff --git a/views/default/admin/appearance/profile_fields.php b/views/default/admin/appearance/profile_fields.php index 7077687cc..8371ce83c 100644 --- a/views/default/admin/appearance/profile_fields.php +++ b/views/default/admin/appearance/profile_fields.php @@ -10,9 +10,7 @@ $reset = elgg_view_form('profile/fields/reset', array(), array()); $body = <<<__HTML $add $list -<div class="default_profile_reset"> - $reset -</div> +$reset __HTML; echo $body; diff --git a/views/default/admin/plugins.php b/views/default/admin/plugins.php index 1aa899fcc..451936335 100644 --- a/views/default/admin/plugins.php +++ b/views/default/admin/plugins.php @@ -20,6 +20,11 @@ $categories = array(); foreach ($installed_plugins as $id => $plugin) { if (!$plugin->isValid()) { + if ($plugin->isActive()) { + // force disable and warn + register_error(elgg_echo('ElggPlugin:InvalidAndDeactivated', array($plugin->getId()))); + $plugin->deactivate(); + } continue; } @@ -40,6 +45,11 @@ foreach ($installed_plugins as $id => $plugin) { unset($installed_plugins[$id]); } break; + case 'nonbundled': + if (in_array('bundled', $plugin_categories)) { + unset($installed_plugins[$id]); + } + break; default: if (!in_array($show_category, $plugin_categories)) { unset($installed_plugins[$id]); @@ -50,7 +60,13 @@ foreach ($installed_plugins as $id => $plugin) { if (isset($plugin_categories)) { foreach ($plugin_categories as $category) { if (!array_key_exists($category, $categories)) { - $categories[$category] = elgg_echo("admin:plugins:category:$category"); + // if localization string not defined, fall back to original category string + $cat_raw_string = "admin:plugins:category:$category"; + $cat_display_string = elgg_echo($cat_raw_string); + if ($cat_display_string == $cat_raw_string) { + $cat_display_string = ucwords($category); + } + $categories[$category] = $cat_display_string; } } } @@ -91,10 +107,16 @@ switch ($sort) { asort($categories); +// we want bundled/nonbundled pulled to be at the top of the list +unset($categories['bundled']); +unset($categories['nonbundled']); + $common_categories = array( 'all' => elgg_echo('admin:plugins:category:all'), 'active' => elgg_echo('admin:plugins:category:active'), 'inactive' => elgg_echo('admin:plugins:category:inactive'), + 'bundled' => elgg_echo('admin:plugins:category:bundled'), + 'nonbundled' => elgg_echo('admin:plugins:category:nonbundled'), ); $categories = array_merge($common_categories, $categories); diff --git a/views/default/core/avatar/upload.php b/views/default/core/avatar/upload.php index 6887eab5c..11902cf4a 100644 --- a/views/default/core/avatar/upload.php +++ b/views/default/core/avatar/upload.php @@ -5,7 +5,7 @@ * @uses $vars['entity'] */ -$user_avatar = $vars['entity']->getIcon('medium'); +$user_avatar = $vars['entity']->getIconUrl('medium'); $current_label = elgg_echo('avatar:current'); diff --git a/views/default/css/admin.php b/views/default/css/admin.php index 8993ec66d..c032ee3fc 100644 --- a/views/default/css/admin.php +++ b/views/default/css/admin.php @@ -38,26 +38,26 @@ html, body { margin-bottom: 1px; } img { - border-width:0; - border-color:transparent; + border-width: 0; + border-color: transparent; } :focus { - outline:0 none; + outline: 0 none; } ol, ul { list-style: none; } em, i { - font-style:italic; + font-style: italic; } ins { - text-decoration:none; + text-decoration: none; } del { text-decoration:line-through; } strong, b { - font-weight:bold; + font-weight: bold; } table { border-collapse: collapse; @@ -79,7 +79,6 @@ blockquote, q { /* *************************************** BASICS *************************************** */ - body { background-color: #eee; font-size: 80%; @@ -116,15 +115,8 @@ p { margin-bottom: 15px; } -.elgg-output dt { font-weight: bold } -.elgg-output dd { margin: 0 0 1em 2em } - -table.mceLayout { - width:100% !important; -} - .clearfloat { - clear:both; + clear: both; } /* Clearfix! */ @@ -150,10 +142,10 @@ table.mceLayout { content: " x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x "; } .hidden { - display:none; + display: none; } .centered { - margin:0 auto; + margin: 0 auto; } .center { text-align: center; @@ -164,6 +156,9 @@ table.mceLayout { .float-alt { float: right; } +.elgg-toggle { + cursor: pointer; +} /* *************************************** PAGE WRAPPER @@ -211,7 +206,7 @@ table.mceLayout { .elgg-menu-user li { display: inline; } -.elgg-menu-user li:after{ +.elgg-menu-user li:after { content: "|"; display: inline-block; font-weight: normal; @@ -222,6 +217,9 @@ table.mceLayout { content: ""; } +/* *************************************** + MESSAGES +*************************************** */ .elgg-page-messages { padding: 20px 0 0; width: 500px; @@ -248,13 +246,35 @@ table.mceLayout { border-color: #c6d880; } +.elgg-admin-notices { + padding-bottom: 15px; +} +.elgg-admin-notices p { + background-color: #BDE5F8; + color: black; + border: 1px solid blue; + font-weight: bold; + padding: 3px 0px 3px 10px; + + -webkit-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.45); + -moz-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.45); + box-shadow: 0 2px 5px rgba(0, 0, 0, 0.45); + + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; +} +.elgg-admin-notices a { + float: right; +} + /* *************************************** BODY *************************************** */ .elgg-page-body { padding: 20px 0; } -.elgg-main { +.elgg-main { background-color: #fff; border: 1px solid #ccc; padding: 20px; @@ -384,31 +404,19 @@ table.mceLayout { float: right; margin-left: 5px; } - .elgg-item { margin: 3px; } -.elgg-menu-metadata { - float: right; - margin-left: 15px; - font-size: 90%; -} -.elgg-menu-metadata > li { - float: left; - margin-left: 15px; -} -.elgg-menu-metadata, .elgg-menu-metadata a { - color: #aaa; -} .elgg-simple-list li { margin-bottom: 5px; } + /* *************************************** FORMS AND INPUT *************************************** */ label { font-weight: bold; - color:#333333; + color: #333333; font-size: 110%; } fieldset > div { @@ -421,7 +429,7 @@ input { font: 120% Arial, Helvetica, sans-serif; padding: 5px; border: 1px solid #ccc; - color:#666; + color: #666; -webkit-border-radius: 5px; -moz-border-radius: 5px; @@ -432,50 +440,63 @@ input { .elgg-input-tags, .elgg-input-url, .elgg-input-plaintext { - width:98%; + width: 98%; } textarea { height: 100px; } -input[type="submit"], .elgg-button-submit, .elgg-button-action, .elgg-button-cancel { +.elgg-input-thin { + width: 400px; +} + +.elgg-button { font-size: 14px; font-weight: bold; - color: white; text-decoration: none; - background-color: #333; - border-color: #333; - + -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; - display: inline-block; width: auto; padding: 2px 4px; - margin: 10px 5px 10px 0; cursor: pointer; outline: none; } -input[type="submit"]:hover, .elgg-button-submit:hover, .elgg-button-action:hover { +a.elgg-button { + padding: 3px 6px; +} + +.elgg-button-submit, +.elgg-button-action { + color: white; + border: 1px solid #333; + background-color: #333; + text-shadow: 1px 1px 0px black; +} +.elgg-button-submit:hover, +.elgg-button-action:hover { color: white; background-color: #000; text-decoration: none; } -.elgg-button-submit, .elgg-button-action, .elgg-button-cancel { - padding: 4px 8px; +.elgg-button-submit.elgg-state-disabled, +.elgg-button-action.elgg-state-disabled { + color: #999; + cursor: default; } + .elgg-button-cancel { color: #333; background-color: #999; + border: 1px solid #999; } .elgg-button-cancel:hover { color: #222; background-color: #666; text-decoration: none; } -.elgg-button-action.elgg-state-disabled { - background-color: #aaa; -} + /* ************************************** DATE PICKER *************************************** */ @@ -546,6 +567,7 @@ input[type="submit"]:hover, .elgg-button-submit:hover, .elgg-button-action:hover color: #333; background: #ddd; } + /* *************************************** PAGINATION *************************************** */ @@ -571,14 +593,13 @@ input[type="submit"]:hover, .elgg-button-submit:hover, .elgg-button-action:hover color: white; text-decoration: none; } - -.elgg-pagination .elgg-state-disabled { +.elgg-pagination .elgg-state-disabled span { color: #CCC; border-color: #CCC; } -.elgg-pagination .elgg-state-selected { - color: #555; - border-color: #555; +.elgg-pagination .elgg-state-selected span { + color: #000; + border-color: #ccc; } /* *************************************** @@ -636,7 +657,6 @@ input[type="submit"]:hover, .elgg-button-submit:hover, .elgg-button-action:hover -moz-border-radius: 5px; border-radius: 5px; } - .elgg-admin-sidebar-menu a:hover { text-decoration: none; background: black; @@ -646,12 +666,10 @@ input[type="submit"]:hover, .elgg-button-submit:hover, .elgg-button-action:hover .elgg-admin-sidebar-menu li.elgg-state-selected > a { background-color: #BBB; } - .elgg-admin-sidebar-menu .elgg-menu-closed:before { content: "\25B8"; padding-right: 4px; } - .elgg-admin-sidebar-menu .elgg-menu-opened:before { content: "\25BE"; padding-right: 4px; @@ -676,7 +694,6 @@ input[type="submit"]:hover, .elgg-button-submit:hover, .elgg-button-action:hover .elgg-menu-title { float: right; } - .elgg-menu-title > li { display: inline-block; margin-left: 4px; @@ -685,12 +702,13 @@ input[type="submit"]:hover, .elgg-button-submit:hover, .elgg-button-action:hover /* *************************************** FOOTER MENU *************************************** */ -.elgg-menu-footer {color:gray} - +.elgg-menu-footer { + color: gray; +} .elgg-menu-footer li { float: left; } -.elgg-menu-footer li:after{ +.elgg-menu-footer li:after { content: "\007C"; display: inline-block; padding: 0 4px 0 4px; @@ -750,8 +768,8 @@ input[type="submit"]:hover, .elgg-button-submit:hover, .elgg-button-action:hover .elgg-menu-hz > li, .elgg-menu-hz > li:after, .elgg-menu-hz > li > a { - display:inline-block; - vertical-align:middle; + display: inline-block; + vertical-align: middle; } /* Allow inline image blocks in horizontal menus */ .elgg-menu-hz .elgg-body:after { @@ -766,6 +784,19 @@ input[type="submit"]:hover, .elgg-button-submit:hover, .elgg-button-action:hover .elgg-menu-longtext { float: right; } +.elgg-menu-metadata { + list-style-type: none; + float: right; + margin-left: 15px; + font-size: 90%; +} +.elgg-menu-metadata > li { + float: left; + margin-left: 15px; +} +.elgg-menu-metadata, .elgg-menu-metadata a { + color: #aaa; +} /* *************************************** WIDGETS @@ -926,23 +957,8 @@ a.elgg-widget-collapsed:before { width: 83.33%; } - -.elgg-subtext { - color: #666; - font-size: 85%; - line-height: 1.2em; - font-style: italic; - margin-bottom: 5px; -} - -.elgg-longtext-control { - margin-left: 14px; - font-size: 80%; - cursor: pointer; -} - /* *************************************** - Spacing (from OOCSS) + SPACING (from OOCSS) *************************************** */ .pan{padding:0} .pas{padding:5px} @@ -1049,6 +1065,7 @@ a.elgg-widget-collapsed:before { *************************************** */ .elgg-avatar { position: relative; + display: inline-block; } .elgg-avatar > a > img { display: block; @@ -1156,94 +1173,32 @@ a.elgg-widget-collapsed:before { height: 200px; } - -.elgg-menu-metadata { - list-style-type: none; - float: right; - margin-left: 15px; - font-size: 90%; -} -.elgg-menu-metadata > li { - float: left; - margin-left: 15px; -} - -.right {float:right} -.elgg-toggle {cursor:pointer} - -<?php //@todo elgg-drag-handle instead? ?> -.elgg-state-draggable .elgg-head { - cursor: move; -} - /* *************************************** - ADMIN MISC -*************************************** */ - -.elgg-instructs { - max-width: 600px; -} - -.manifest_file { - background-color:#eee; - - -webkit-border-radius: 8px; - -moz-border-radius: 8px; - border-radius: 8px; - - padding:5px 10px; - margin:4px 0; -} - - -.plugin_controls { - padding: 3px 3px 3px 0; - font-weight: bold; - float: left; - width: 150px; -} -form.admin_plugins_simpleview .elgg-button-submit { - margin-right:20px; -} -.plugin_info { - margin: 3px; - padding-left: 150px; - display: block; -} -.plugin_metadata { - display:block; - color:#999; -} -.plugin_name input[type="checkbox"] { - margin-right: 10px; -} -ul.admin_plugins { - margin-bottom: 0; - padding-left: 0; - list-style: none; -} + PLUGINS +**************************************** */ .elgg-plugin { - border:1px solid #999; - margin:0 0 5px; - padding:0 7px 4px 10px; + border: 1px solid #999; + margin: 0 0 5px; + padding: 0 7px 4px 10px; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; } - +.elgg-plugin.elgg-state-draggable > .elgg-image-block .elgg-head { + cursor: move; +} .elgg-plugin p { - margin:0; - padding:0; + margin: 0; } .elgg-plugin h3 { - color:black; + color: black; padding-bottom: 10px; } -.plugin_settings { +.elgg-plugin-settings { font-weight: normal; + font-size: 0.9em; } - .elgg-plugin-screenshot { display: inline; } @@ -1263,64 +1218,43 @@ ul.admin_plugins { border-radius: 8px; } .elgg-plugin-screenshot-lightbox h2 { - color:black; + color: black; } - .elgg-plugin.elgg-state-active { background: white; } .elgg-plugin.elgg-state-inactive { background: #dedede; } - -.elgg-state-error { +.elgg-plugin .elgg-state-error { background: #fbe3e4; color: #8a1f11; border-color: #fbc2c4; font-weight: bold; } -.elgg-state-warning { +.elgg-plugin .elgg-state-warning { background: #fbedb5; color: #000000; border-color: #fbe58b; font-weight: bold; } +.elgg-plugin-more { + background-color: #eee; -.admin_notices { - padding-bottom: 15px; -} -.admin_notices p { - background-color:#BDE5F8; - color: black; - border: 1px solid blue; - font-weight: bold; - padding: 3px 0px 3px 10px; - - -webkit-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.45); - -moz-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.45); - box-shadow: 0 2px 5px rgba(0, 0, 0, 0.45); - - -webkit-border-radius: 4px; - -moz-border-radius: 4px; - border-radius: 4px; -} - -.admin_notices a { - float: right; -} + -webkit-border-radius: 8px; + -moz-border-radius: 8px; + border-radius: 8px; -.add-user form { - width:300px; + padding: 5px 10px; + margin: 4px 0; } /**************************************** - Markdown Text + MARKDOWN ****************************************/ - .elgg-markdown { margin: 15px; } - .elgg-markdown h1, .elgg-markdown h2, .elgg-markdown h3, @@ -1330,17 +1264,46 @@ ul.admin_plugins { margin: 1em 0 1em -15px; color: #333; } - .elgg-markdown ol { list-style: decimal; padding-left: 2em; } - .elgg-markdown ul { list-style: disc; padding-left: 2em; } - .elgg-markdown p { margin: 15px 0; -}
\ No newline at end of file +} + +/* *************************************** + MISC +*************************************** */ +.elgg-content-thin { + max-width: 600px; +} + +.elgg-subtext { + color: #666; + font-size: 85%; + line-height: 1.2em; + font-style: italic; + margin-bottom: 5px; +} + +.elgg-longtext-control { + margin-left: 14px; + font-size: 80%; + cursor: pointer; +} + +table.mceLayout { + width:100% !important; +} + +.elgg-output dt { + font-weight: bold; +} +.elgg-output dd { + margin: 0 0 1em 2em; +} diff --git a/views/default/css/elements/components.php b/views/default/css/elements/components.php index 4a09ca74e..f675ab7cb 100644 --- a/views/default/css/elements/components.php +++ b/views/default/css/elements/components.php @@ -146,10 +146,10 @@ /* *************************************** River *************************************** */ -.elgg-river { +.elgg-list-river { border-top: 1px solid #CCC; } -.elgg-river > li { +.elgg-list-river > li { border-bottom: 1px solid #CCC; } .elgg-river-item { diff --git a/views/default/css/elements/core.php b/views/default/css/elements/core.php index af4a1882a..627cae55c 100644 --- a/views/default/css/elements/core.php +++ b/views/default/css/elements/core.php @@ -98,8 +98,4 @@ position: relative; display: inline-block; - - /* Inline-block: IE 6, 7 */ - zoom: 1; - *display: inline; } diff --git a/views/default/css/elements/icons.php b/views/default/css/elements/icons.php index 1bc056072..f7c789e33 100644 --- a/views/default/css/elements/icons.php +++ b/views/default/css/elements/icons.php @@ -27,215 +27,254 @@ .elgg-icon-arrow-two-head { background-position: 0 -36px; } -.elgg-icon-calendar { +.elgg-icon-attention:hover { background-position: 0 -54px; } -.elgg-icon-checkmark:hover { +.elgg-icon-attention { background-position: 0 -72px; } -.elgg-icon-checkmark { +.elgg-icon-calendar { background-position: 0 -90px; } -.elgg-icon-clip:hover { +.elgg-icon-cell-phone { background-position: 0 -108px; } -.elgg-icon-clip { +.elgg-icon-checkmark:hover { background-position: 0 -126px; } -.elgg-icon-cursor-drag-arrow { +.elgg-icon-checkmark { background-position: 0 -144px; } -.elgg-icon-delete-alt:hover { +.elgg-icon-clip:hover { background-position: 0 -162px; } -.elgg-icon-delete-alt { +.elgg-icon-clip { background-position: 0 -180px; } -.elgg-icon-delete:hover { +.elgg-icon-cursor-drag-arrow { background-position: 0 -198px; } -.elgg-icon-delete { +.elgg-icon-delete-alt:hover { background-position: 0 -216px; } -.elgg-icon-download:hover { +.elgg-icon-delete-alt { background-position: 0 -234px; } -.elgg-icon-download { +.elgg-icon-delete:hover { background-position: 0 -252px; } -.elgg-icon-facebook { +.elgg-icon-delete { background-position: 0 -270px; } -.elgg-icon-home:hover { +.elgg-icon-download:hover { background-position: 0 -288px; } -.elgg-icon-home { +.elgg-icon-download { background-position: 0 -306px; } -.elgg-icon-hover-menu:hover { +.elgg-icon-eye { background-position: 0 -324px; } -.elgg-icon-hover-menu { +.elgg-icon-facebook { background-position: 0 -342px; } -.elgg-icon-link:hover { +.elgg-icon-grid:hover { background-position: 0 -360px; } -.elgg-icon-link { +.elgg-icon-grid { background-position: 0 -378px; } -.elgg-icon-mail-alt:hover { +.elgg-icon-home:hover { background-position: 0 -396px; } -.elgg-icon-mail-alt { +.elgg-icon-home { background-position: 0 -414px; } -.elgg-icon-mail:hover { +.elgg-icon-hover-menu:hover { background-position: 0 -432px; } -.elgg-icon-mail { +.elgg-icon-hover-menu { background-position: 0 -450px; } -.elgg-icon-print-alt { +.elgg-icon-info:hover { background-position: 0 -468px; } -.elgg-icon-print { +.elgg-icon-info { background-position: 0 -486px; } -.elgg-icon-push-pin-alt { +.elgg-icon-link:hover { background-position: 0 -504px; } -.elgg-icon-push-pin { +.elgg-icon-link { background-position: 0 -522px; } -.elgg-icon-redo { +.elgg-icon-list { background-position: 0 -540px; } -.elgg-icon-refresh:hover { +.elgg-icon-lock-closed { background-position: 0 -558px; } -.elgg-icon-refresh { +.elgg-icon-lock-open { background-position: 0 -576px; } -.elgg-icon-round-arrow-left { +.elgg-icon-mail-alt:hover { background-position: 0 -594px; } -.elgg-icon-round-arrow-right { +.elgg-icon-mail-alt { background-position: 0 -612px; } -.elgg-icon-round-checkmark { +.elgg-icon-mail:hover { background-position: 0 -630px; } -.elgg-icon-round-minus { +.elgg-icon-mail { background-position: 0 -648px; } -.elgg-icon-round-plus { +.elgg-icon-photo { background-position: 0 -666px; } -.elgg-icon-rss { +.elgg-icon-print-alt { background-position: 0 -684px; } -.elgg-icon-search-focus { +.elgg-icon-print { background-position: 0 -702px; } -.elgg-icon-search { +.elgg-icon-push-pin-alt { background-position: 0 -720px; } -.elgg-icon-settings-alt:hover { +.elgg-icon-push-pin { background-position: 0 -738px; } -.elgg-icon-settings-alt { +.elgg-icon-redo { background-position: 0 -756px; } -.elgg-icon-settings { +.elgg-icon-refresh:hover { background-position: 0 -774px; } -.elgg-icon-share:hover { +.elgg-icon-refresh { background-position: 0 -792px; } -.elgg-icon-share { +.elgg-icon-round-arrow-left { background-position: 0 -810px; } -.elgg-icon-shop-cart:hover { +.elgg-icon-round-arrow-right { background-position: 0 -828px; } -.elgg-icon-shop-cart { +.elgg-icon-round-checkmark { background-position: 0 -846px; } -.elgg-icon-speech-bubble-alt:hover { +.elgg-icon-round-minus { background-position: 0 -864px; } -.elgg-icon-speech-bubble-alt { +.elgg-icon-round-plus { background-position: 0 -882px; } -.elgg-icon-speech-bubble:hover { +.elgg-icon-rss { background-position: 0 -900px; } -.elgg-icon-speech-bubble { +.elgg-icon-search-focus { background-position: 0 -918px; } -.elgg-icon-star-alt { +.elgg-icon-search { background-position: 0 -936px; } -.elgg-icon-star-empty:hover { +.elgg-icon-settings-alt:hover { background-position: 0 -954px; } -.elgg-icon-star-empty { +.elgg-icon-settings-alt { background-position: 0 -972px; } -.elgg-icon-star:hover { +.elgg-icon-settings { background-position: 0 -990px; } -.elgg-icon-star { +.elgg-icon-share:hover { background-position: 0 -1008px; } -.elgg-icon-tag:hover { +.elgg-icon-share { background-position: 0 -1026px; } -.elgg-icon-tag { +.elgg-icon-shop-cart:hover { background-position: 0 -1044px; } -.elgg-icon-thumbs-down-alt:hover { +.elgg-icon-shop-cart { background-position: 0 -1062px; } -.elgg-icon-thumbs-down:hover, -.elgg-icon-thumbs-down-alt { +.elgg-icon-speech-bubble-alt:hover { background-position: 0 -1080px; } -.elgg-icon-thumbs-down { +.elgg-icon-speech-bubble-alt { background-position: 0 -1098px; } -.elgg-icon-thumbs-up-alt:hover { +.elgg-icon-speech-bubble:hover { background-position: 0 -1116px; } -.elgg-icon-thumbs-up:hover, -.elgg-icon-thumbs-up-alt { +.elgg-icon-speech-bubble { background-position: 0 -1134px; } -.elgg-icon-thumbs-up { +.elgg-icon-star-alt { background-position: 0 -1152px; } -.elgg-icon-trash { +.elgg-icon-star-empty:hover { background-position: 0 -1170px; } -.elgg-icon-twitter { +.elgg-icon-star-empty { background-position: 0 -1188px; } -.elgg-icon-undo { +.elgg-icon-star:hover { background-position: 0 -1206px; } -.elgg-icon-user { +.elgg-icon-star { background-position: 0 -1224px; } -.elgg-icon-user:hover { +.elgg-icon-tag:hover { background-position: 0 -1242px; } -.elgg-icon-users:hover { +.elgg-icon-tag { background-position: 0 -1260px; } -.elgg-icon-users { +.elgg-icon-thumbs-down-alt:hover { background-position: 0 -1278px; } +.elgg-icon-thumbs-down:hover, +.elgg-icon-thumbs-down-alt { + background-position: 0 -1296px; +} +.elgg-icon-thumbs-down { + background-position: 0 -1314px; +} +.elgg-icon-thumbs-up-alt:hover { + background-position: 0 -1332px; +} +.elgg-icon-thumbs-up:hover, +.elgg-icon-thumbs-up-alt { + background-position: 0 -1350px; +} +.elgg-icon-thumbs-up { + background-position: 0 -1368px; +} +.elgg-icon-trash { + background-position: 0 -1386px; +} +.elgg-icon-twitter { + background-position: 0 -1404px; +} +.elgg-icon-undo { + background-position: 0 -1422px; +} +.elgg-icon-user:hover { + background-position: 0 -1440px; +} +.elgg-icon-user { + background-position: 0 -1458px; +} +.elgg-icon-users:hover { + background-position: 0 -1476px; +} +.elgg-icon-users { + background-position: 0 -1494px; +} +.elgg-icon-video { + background-position: 0 -1512px; +} .elgg-avatar > .elgg-icon-hover-menu { @@ -258,6 +297,7 @@ *************************************** */ .elgg-avatar { position: relative; + display: inline-block; } .elgg-avatar > a > img { display: block; diff --git a/views/default/css/elements/navigation.php b/views/default/css/elements/navigation.php index b5388715e..bee1312ec 100644 --- a/views/default/css/elements/navigation.php +++ b/views/default/css/elements/navigation.php @@ -98,7 +98,7 @@ .elgg-breadcrumbs > li { display: inline-block; } -.elgg-breadcrumbs > li:after{ +.elgg-breadcrumbs > li:after { content: "\003E"; padding: 0 4px; font-weight: normal; @@ -178,7 +178,6 @@ text-decoration: none; } - .elgg-menu-site-default { position: absolute; bottom: 0; @@ -191,62 +190,68 @@ margin-right: 1px; } -.elgg-menu-site-default > li > a {color: white} +.elgg-menu-site-default > li > a { + color: white; +} + +.elgg-menu-site > li > ul { + display: none; + background-color: white; +} +.elgg-menu-site > li:hover > ul { + display: block; +} .elgg-menu-site-default > .elgg-state-selected > a, .elgg-menu-site-default > li:hover > a { background: white; color: #555; - + -webkit-box-shadow: 2px -1px 1px rgba(0, 0, 0, 0.25); -moz-box-shadow: 2px -1px 1px rgba(0, 0, 0, 0.25); box-shadow: 2px -1px 1px rgba(0, 0, 0, 0.25); - + -webkit-border-radius: 4px 4px 0 0; -moz-border-radius: 4px 4px 0 0; border-radius: 4px 4px 0 0; } .elgg-menu-site-more { - display: none; position: relative; left: -1px; width: 100%; - z-index: 1; min-width: 150px; border: 1px solid #999; border-top: 0; - + -webkit-border-radius: 0 0 4px 4px; -moz-border-radius: 0 0 4px 4px; border-radius: 0 0 4px 4px; - + -webkit-box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.25); -moz-box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.25); box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.25); } -li:hover > .elgg-menu-site-more { - display: block; -} - .elgg-menu-site-more > li > a { - background: white; + background-color: white; color: #555; - + -webkit-border-radius: 0; -moz-border-radius: 0; border-radius: 0; - + -webkit-box-shadow: none; -moz-box-shadow: none; box-shadow: none; } + .elgg-menu-site-more > li > a:hover { background: #4690D6; color: white; } + .elgg-menu-site-more > li:last-child > a, .elgg-menu-site-more > li:last-child > a:hover { -webkit-border-radius: 0 0 4px 4px; @@ -407,7 +412,7 @@ li:hover > .elgg-menu-site-more { .elgg-menu-footer > li, .elgg-menu-footer > li > a { display: inline-block; - color:#999; + color: #999; } .elgg-menu-footer > li:after { diff --git a/views/default/css/ie.php b/views/default/css/ie.php index 6760d3886..4bddd4d55 100644 --- a/views/default/css/ie.php +++ b/views/default/css/ie.php @@ -1,74 +1,8 @@ /** - * elgg_layout css for Internet Explorer > ie6 - * @uses $vars['wwwroot'] The site URL -*/ -* {zoom: 1;} /* trigger hasLayout in IE */ + * CSS for IE8 and above + */ -/* tools drop-down menu */ -#elgg-header {z-index:1;} -.navigation li a:hover ul {display:block; position:absolute; top:21px; left:0;} -.navigation li a:hover ul li a {display:block;} -.navigation li.navigation-more ul li a {width:150px;background-color: #dedede;} - -.clearfix { display: block; } -.hidden.clearfix { display: none; } -#elgg-page-contents {overflow: hidden;} /* remove horizontal scroll on riverdash */ -#breadcrumbs {top:-2px; margin-bottom: 5px;} - -/* entity list views */ -.entity-metadata {max-width: 300px;} -.entity-edit {float:right;} -.access_level {float:left;} -.elgg-image-block .entity-metadata { - min-width:400px; - text-align: right; -} - -/* profile */ -.elgg-tabs.profile .profile_name {margin-left: -260px;} -#profile_content .river_comment_form.hidden .input-text { width:510px; } - -/* notifications */ -.friends-picker-navigation {margin:0;padding:0;} -.friends-picker-container h3 {margin:0;padding:0;line-height: 1em;} - -/* private messages */ -#elgg-topbar-contents a.privatemessages.new span { - display:block; - padding:1px; - position:relative; - text-align:center; - float:left; - top:-1px; - right:auto; -} -#elgg-topbar-contents a.privatemessages.new {padding:0 0 0 20px;} -#elgg-topbar-contents a.privatemessages:hover {background-position:left 2px;} -#elgg-topbar-contents a.privatemessages.new:hover {background-position: left 2px;} - -/* riverdashboard mod rules */ -#riverdashboard_updates {clear:both;} -#riverdashboard_updates a.update_link {margin:0 0 9px 0;} -.riverdashboard_filtermenu {margin:10px 0 0 0;} -.river_comment_form.hidden .input-text { - width:530px; - float:left; -} -.river_link_divider { - width:10px; - text-align: center; -} - -/* shared access */ -.shared_access_collection h2.shared_access_name {margin-top:-15px;} - -/* dropdown login */ -*:first-child+html #login-dropdown #signin-button { - line-height:10px; -} -*:first-child+html #login-dropdown #signin-button a.signin span { - background-position:-150px -54px; +/* ie8 does not like shrink wrapping this div with inline-block */ +.elgg-avatar { + display: block; } -*:first-child+html #login-dropdown #signin-button a.signin.menu-open span { - background-position:-150px -74px; -}
\ No newline at end of file diff --git a/views/default/css/ie6.php b/views/default/css/ie6.php index f8ed208f6..cf49d33f2 100644 --- a/views/default/css/ie6.php +++ b/views/default/css/ie6.php @@ -1,15 +1,11 @@ /** - * elgg_layout css for Internet Explorer6 - * @uses $vars['wwwroot'] The site URL -*/ + * CSS for IE6 + */ * {zoom: 1;} /* trigger hasLayout in IE */ /* main nav drop-down */ #elgg-header {z-index:1;} -.navigation li a:hover ul {display:block; position:absolute; top:21px; left:0;} -.navigation li a:hover ul li a {display:block;} -.navigation li.navigation-more ul li a {width:150px;background-color: #dedede;} /* @todo check this one */ .elgg-button-delete a { background-position-y: 2px; } diff --git a/views/default/css/ie7.php b/views/default/css/ie7.php new file mode 100644 index 000000000..56047b954 --- /dev/null +++ b/views/default/css/ie7.php @@ -0,0 +1,53 @@ +/** + * CSS for IE7 + */ + +/* trigger hasLayout in IE */ +* { + zoom: 1; +} + +/* site menu drop-down z-index fix for IE7 */ +.elgg-page-header { + z-index: 1; +} + +/* inline-block fixes */ +.elgg-gallery > li, +.elgg-button, +.elgg-icon, +.elgg-menu-hz > li, +.elgg-menu-hz > li:after, +.elgg-menu-hz > li > a, +.elgg-menu-hz > li > span, +.elgg-breadcrumbs > li, +.elgg-menu-footer > li > a, +.elgg-menu-footer li { + display: inline; +} + +/* IE7 does not support :after */ +.elgg-breadcrumbs > li > a { + display: inline; + padding-right: 4px; + margin-right: 4px; + border-right: 1px solid #bababa; +} +.elgg-menu-footer li, +.elgg-menu-user li { + padding-left: 4px; + padding-right: 4px; +} + +/* longtext menu would not display horizontally without this */ +.elgg-menu-longtext { + width: 100%; +} +.elgg-menu-longtext li { + width: 100px; + float: right; +} + +.elgg-avatar { + display: inline; +}
\ No newline at end of file diff --git a/views/default/css/lightbox.php b/views/default/css/lightbox.php new file mode 100644 index 000000000..7d5917cc3 --- /dev/null +++ b/views/default/css/lightbox.php @@ -0,0 +1,371 @@ +<?php +/** + * Fancybox lightbox CSS. + * + * Used as a view because we need to pass a full URL to AlphaImageLoader. + * + * @package Elgg.Core + * @subpackage UI + */ + +$jquery_path = elgg_get_site_url() . 'vendors/jquery/'; +?> + +/* + * FancyBox - jQuery Plugin + * Simple and fancy lightbox alternative + * + * Examples and documentation at: http://fancybox.net + * + * Copyright (c) 2008 - 2010 Janis Skarnelis + * That said, it is hardly a one-person project. Many people have submitted bugs, code, and offered their advice freely. Their support is greatly appreciated. + * + * Version: 1.3.4 (11/11/2010) + * Requires: jQuery v1.3+ + * + * Dual licensed under the MIT and GPL licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + */ + +#fancybox-loading { + position: fixed; + top: 50%; + left: 50%; + width: 40px; + height: 40px; + margin-top: -20px; + margin-left: -20px; + cursor: pointer; + overflow: hidden; + z-index: 1104; + display: none; +} + +#fancybox-loading div { + position: absolute; + top: 0; + left: 0; + width: 40px; + height: 480px; + background-image: url('<?php echo $jquery_path; ?>fancybox/fancybox.png'); +} + +#fancybox-overlay { + position: absolute; + top: 0; + left: 0; + width: 100%; + z-index: 1100; + display: none; +} + +#fancybox-tmp { + padding: 0; + margin: 0; + border: 0; + overflow: auto; + display: none; +} + +#fancybox-wrap { + position: absolute; + top: 0; + left: 0; + padding: 20px; + z-index: 1101; + outline: none; + display: none; +} + +#fancybox-outer { + position: relative; + width: 100%; + height: 100%; + background: #fff; +} + +#fancybox-content { + width: 0; + height: 0; + padding: 0; + outline: none; + position: relative; + overflow: hidden; + z-index: 1102; + border: 0px solid #fff; +} + +#fancybox-hide-sel-frame { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + background: transparent; + z-index: 1101; +} + +#fancybox-close { + position: absolute; + top: -15px; + right: -15px; + width: 30px; + height: 30px; + background: transparent url('<?php echo $jquery_path; ?>fancybox/fancybox.png') -40px 0px; + cursor: pointer; + z-index: 1103; + display: none; +} + +#fancybox-error { + color: #444; + font: normal 12px/20px Arial; + padding: 14px; + margin: 0; +} + +#fancybox-img { + width: 100%; + height: 100%; + padding: 0; + margin: 0; + border: none; + outline: none; + line-height: 0; + vertical-align: top; +} + +#fancybox-frame { + width: 100%; + height: 100%; + border: none; + display: block; +} + +#fancybox-left, #fancybox-right { + position: absolute; + bottom: 0px; + height: 100%; + width: 35%; + cursor: pointer; + outline: none; + background: transparent url('<?php echo $jquery_path; ?>fancybox/blank.gif'); + z-index: 1102; + display: none; +} + +#fancybox-left { + left: 0px; +} + +#fancybox-right { + right: 0px; +} + +#fancybox-left-ico, #fancybox-right-ico { + position: absolute; + top: 50%; + left: -9999px; + width: 30px; + height: 30px; + margin-top: -15px; + cursor: pointer; + z-index: 1102; + display: block; +} + +#fancybox-left-ico { + background-image: url('<?php echo $jquery_path; ?>fancybox/fancybox.png'); + background-position: -40px -30px; +} + +#fancybox-right-ico { + background-image: url('<?php echo $jquery_path; ?>fancybox/fancybox.png'); + background-position: -40px -60px; +} + +#fancybox-left:hover, #fancybox-right:hover { + visibility: visible; /* IE6 */ +} + +#fancybox-left:hover span { + left: 20px; +} + +#fancybox-right:hover span { + left: auto; + right: 20px; +} + +.fancybox-bg { + position: absolute; + padding: 0; + margin: 0; + border: 0; + width: 20px; + height: 20px; + z-index: 1001; +} + +#fancybox-bg-n { + top: -20px; + left: 0; + width: 100%; + background-image: url('<?php echo $jquery_path; ?>fancybox/fancybox-x.png'); +} + +#fancybox-bg-ne { + top: -20px; + right: -20px; + background-image: url('<?php echo $jquery_path; ?>fancybox/fancybox.png'); + background-position: -40px -162px; +} + +#fancybox-bg-e { + top: 0; + right: -20px; + height: 100%; + background-image: url('<?php echo $jquery_path; ?>fancybox/fancybox-y.png'); + background-position: -20px 0px; +} + +#fancybox-bg-se { + bottom: -20px; + right: -20px; + background-image: url('<?php echo $jquery_path; ?>fancybox/fancybox.png'); + background-position: -40px -182px; +} + +#fancybox-bg-s { + bottom: -20px; + left: 0; + width: 100%; + background-image: url('<?php echo $jquery_path; ?>fancybox/fancybox-x.png'); + background-position: 0px -20px; +} + +#fancybox-bg-sw { + bottom: -20px; + left: -20px; + background-image: url('<?php echo $jquery_path; ?>fancybox/fancybox.png'); + background-position: -40px -142px; +} + +#fancybox-bg-w { + top: 0; + left: -20px; + height: 100%; + background-image: url('<?php echo $jquery_path; ?>fancybox/fancybox-y.png'); +} + +#fancybox-bg-nw { + top: -20px; + left: -20px; + background-image: url('<?php echo $jquery_path; ?>fancybox/fancybox.png'); + background-position: -40px -122px; +} + +#fancybox-title { + font-family: Helvetica; + font-size: 12px; + z-index: 1102; +} + +.fancybox-title-inside { + padding-bottom: 10px; + text-align: center; + color: #333; + background: #fff; + position: relative; +} + +.fancybox-title-outside { + padding-top: 10px; + color: #fff; +} + +.fancybox-title-over { + position: absolute; + bottom: 0; + left: 0; + color: #FFF; + text-align: left; +} + +#fancybox-title-over { + padding: 10px; + background-image: url('<?php echo $jquery_path; ?>fancybox/fancy_title_over.png'); + display: block; +} + +.fancybox-title-float { + position: absolute; + left: 0; + bottom: -20px; + height: 32px; +} + +#fancybox-title-float-wrap { + border: none; + border-collapse: collapse; + width: auto; +} + +#fancybox-title-float-wrap td { + border: none; + white-space: nowrap; +} + +#fancybox-title-float-left { + padding: 0 0 0 15px; + background: url('<?php echo $jquery_path; ?>fancybox/fancybox.png') -40px -90px no-repeat; +} + +#fancybox-title-float-main { + color: #FFF; + line-height: 29px; + font-weight: bold; + padding: 0 0 3px 0; + background: url('<?php echo $jquery_path; ?>fancybox/fancybox-x.png') 0px -40px; +} + +#fancybox-title-float-right { + padding: 0 0 0 15px; + background: url('<?php echo $jquery_path; ?>fancybox/fancybox.png') -55px -90px no-repeat; +} + +/* IE6 */ + +.fancybox-ie6 #fancybox-close { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='<?php echo $jquery_path; ?>fancybox/fancy_close.png', sizingMethod='scale'); } + +.fancybox-ie6 #fancybox-left-ico { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='<?php echo $jquery_path; ?>fancybox/fancy_nav_left.png', sizingMethod='scale'); } +.fancybox-ie6 #fancybox-right-ico { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='<?php echo $jquery_path; ?>fancybox/fancy_nav_right.png', sizingMethod='scale'); } + +.fancybox-ie6 #fancybox-title-over { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='<?php echo $jquery_path; ?>fancybox/fancy_title_over.png', sizingMethod='scale'); zoom: 1; } +.fancybox-ie6 #fancybox-title-float-left { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='<?php echo $jquery_path; ?>fancybox/fancy_title_left.png', sizingMethod='scale'); } +.fancybox-ie6 #fancybox-title-float-main { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='<?php echo $jquery_path; ?>fancybox/fancy_title_main.png', sizingMethod='scale'); } +.fancybox-ie6 #fancybox-title-float-right { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='<?php echo $jquery_path; ?>fancybox/fancy_title_right.png', sizingMethod='scale'); } + +.fancybox-ie6 #fancybox-bg-w, .fancybox-ie6 #fancybox-bg-e, .fancybox-ie6 #fancybox-left, .fancybox-ie6 #fancybox-right, #fancybox-hide-sel-frame { + height: expression(this.parentNode.clientHeight + "px"); +} + +#fancybox-loading.fancybox-ie6 { + position: absolute; margin-top: 0; + top: expression( (-20 + (document.documentElement.clientHeight ? document.documentElement.clientHeight/2 : document.body.clientHeight/2 ) + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop )) + 'px'); +} + +#fancybox-loading.fancybox-ie6 div { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='<?php echo $jquery_path; ?>fancybox/fancy_loading.png', sizingMethod='scale'); } + +/* IE6, IE7, IE8 */ +.fancybox-ie .fancybox-bg { background: transparent !important; } + +.fancybox-ie #fancybox-bg-n { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='<?php echo $jquery_path; ?>fancybox/fancy_shadow_n.png', sizingMethod='scale'); } +.fancybox-ie #fancybox-bg-ne { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='<?php echo $jquery_path; ?>fancybox/fancy_shadow_ne.png', sizingMethod='scale'); } +.fancybox-ie #fancybox-bg-e { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='<?php echo $jquery_path; ?>fancybox/fancy_shadow_e.png', sizingMethod='scale'); } +.fancybox-ie #fancybox-bg-se { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='<?php echo $jquery_path; ?>fancybox/fancy_shadow_se.png', sizingMethod='scale'); } +.fancybox-ie #fancybox-bg-s { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='<?php echo $jquery_path; ?>fancybox/fancy_shadow_s.png', sizingMethod='scale'); } +.fancybox-ie #fancybox-bg-sw { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='<?php echo $jquery_path; ?>fancybox/fancy_shadow_sw.png', sizingMethod='scale'); } +.fancybox-ie #fancybox-bg-w { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='<?php echo $jquery_path; ?>fancybox/fancy_shadow_w.png', sizingMethod='scale'); } +.fancybox-ie #fancybox-bg-nw { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='<?php echo $jquery_path; ?>fancybox/fancy_shadow_nw.png', sizingMethod='scale'); }
\ No newline at end of file diff --git a/views/default/forms/account/settings.php b/views/default/forms/account/settings.php index 824b2280b..3967207ce 100644 --- a/views/default/forms/account/settings.php +++ b/views/default/forms/account/settings.php @@ -5,4 +5,6 @@ * This form is extended by Elgg with the views in core/settings/account. * Plugins can additionally extend it and then register for the * 'usersettings:save', 'user' plugin hook. + * + * This view is included by "forms/usersettings/save" */ diff --git a/views/default/forms/admin/plugins/change_state.php b/views/default/forms/admin/plugins/change_state.php index ba5d873e7..730c8ff32 100644 --- a/views/default/forms/admin/plugins/change_state.php +++ b/views/default/forms/admin/plugins/change_state.php @@ -9,6 +9,7 @@ $guids = elgg_extract('guids', $vars, array()); $guids = implode(',', $guids); +echo '<div>'; echo elgg_view('input/hidden', array( 'name' => 'guids', 'value' => $guids, @@ -16,5 +17,6 @@ echo elgg_view('input/hidden', array( echo elgg_view('input/submit', array( 'value' => elgg_echo("admin:plugins:{$vars['action']}_all"), - 'class' => 'elgg-button elgg-button-action' + 'class' => 'elgg-button elgg-button-action mrm' )); +echo '</div>'; diff --git a/views/default/forms/admin/plugins/filter.php b/views/default/forms/admin/plugins/filter.php index d00906e6a..fd1b618bc 100644 --- a/views/default/forms/admin/plugins/filter.php +++ b/views/default/forms/admin/plugins/filter.php @@ -7,6 +7,7 @@ * @uses $vvars['sort'] */ +echo '<div>'; echo elgg_view('input/dropdown', array( 'name' => 'category', 'options_values' => $vars['category_options'], @@ -22,3 +23,4 @@ echo elgg_view('input/submit', array( 'value' => elgg_echo('filter'), 'class' => 'elgg-button elgg-button-action', )); +echo '</div>'; diff --git a/views/default/forms/admin/plugins/sort.php b/views/default/forms/admin/plugins/sort.php index 284e085e6..7f2246bad 100644 --- a/views/default/forms/admin/plugins/sort.php +++ b/views/default/forms/admin/plugins/sort.php @@ -7,6 +7,7 @@ * @uses $vars['category'] */ +echo '<div class="mtm">'; echo elgg_view('input/dropdown', array( 'name' => 'sort', 'options_values' => $vars['sort_options'], @@ -22,3 +23,4 @@ echo elgg_view('input/submit', array( 'value' => elgg_echo('sort'), 'class' => 'elgg-button elgg-button-action' )); +echo '</div>'; diff --git a/views/default/forms/admin/site/update_advanced.php b/views/default/forms/admin/site/update_advanced.php index fa253967c..e12764092 100644 --- a/views/default/forms/admin/site/update_advanced.php +++ b/views/default/forms/admin/site/update_advanced.php @@ -17,26 +17,26 @@ foreach (array('wwwroot', 'path', 'dataroot') as $field) { } $form_body .= "<div>" . elgg_echo('admin:site:access:warning') . "<br />"; -$form_body .= elgg_echo('installation:sitepermissions'); +$form_body .= "<label>" . elgg_echo('installation:sitepermissions') . "</label>"; $form_body .= elgg_view('input/access', array( 'name' => 'default_access', 'value' => elgg_get_config('default_access'), )) . "</div>"; $form_body .= "<div>" . elgg_echo('installation:allow_user_default_access:description') . "<br />"; $form_body .= elgg_view("input/checkboxes", array( - 'options' => array(elgg_echo('installation:allow_user_default_access:label')), + 'options' => array(elgg_echo('installation:allow_user_default_access:label') => elgg_echo('installation:allow_user_default_access:label')), 'name' => 'allow_user_default_access', 'value' => (elgg_get_config('allow_user_default_access') ? elgg_echo('installation:allow_user_default_access:label') : ""), )) . "</div>"; $form_body .= "<div>" . elgg_echo('installation:simplecache:description') . "<br />"; $form_body .= elgg_view("input/checkboxes", array( - 'options' => array(elgg_echo('installation:simplecache:label')), + 'options' => array(elgg_echo('installation:simplecache:label') => elgg_echo('installation:simplecache:label')), 'name' => 'simplecache_enabled', 'value' => (elgg_get_config('simplecache_enabled') ? elgg_echo('installation:simplecache:label') : ""), )) . "</div>"; $form_body .= "<div>" . elgg_echo('installation:viewpathcache:description') . "<br />"; $form_body .= elgg_view("input/checkboxes", array( - 'options' => array(elgg_echo('installation:viewpathcache:label')), + 'options' => array(elgg_echo('installation:viewpathcache:label') => elgg_echo('installation:viewpathcache:label')), 'name' => 'viewpath_cache_enabled', 'value' => (elgg_get_config('viewpath_cache_enabled') ? elgg_echo('installation:viewpathcache:label') : ""), )) . "</div>"; @@ -52,7 +52,7 @@ $form_body .= '</div>'; // control new user registration $options = array( - 'options' => array(elgg_echo('installation:registration:label')), + 'options' => array(elgg_echo('installation:registration:label') => elgg_echo('installation:registration:label')), 'name' => 'allow_registration', 'value' => elgg_get_config('allow_registration') ? elgg_echo('installation:registration:label') : '', ); @@ -62,7 +62,7 @@ $form_body .= '<br />' .elgg_view('input/checkboxes', $options) . '</div>'; // control walled garden $walled_garden = elgg_get_config(walled_garden); $options = array( - 'options' => array(elgg_echo('installation:walled_garden:label')), + 'options' => array(elgg_echo('installation:walled_garden:label') => elgg_echo('installation:walled_garden:label')), 'name' => 'walled_garden', 'value' => $walled_garden ? elgg_echo('installation:walled_garden:label') : '', ); @@ -71,7 +71,7 @@ $form_body .= '<br />' . elgg_view('input/checkboxes', $options) . '</div>'; $form_body .= "<div>" . elgg_echo('installation:httpslogin') . "<br />"; $form_body .= elgg_view("input/checkboxes", array( - 'options' => array(elgg_echo('installation:httpslogin:label')), + 'options' => array(elgg_echo('installation:httpslogin:label') => elgg_echo('installation:httpslogin:label')), 'name' => 'https_login', 'value' => (elgg_get_config('https_login') ? elgg_echo('installation:httpslogin:label') : "") )) . "</div>"; @@ -83,7 +83,7 @@ if ($disable_api) { $on = (disable_api ? "" : elgg_echo('installation:disableapi:label')); } $form_body .= elgg_view("input/checkboxes", array( - 'options' => array(elgg_echo('installation:disableapi:label')), + 'options' => array(elgg_echo('installation:disableapi:label') => elgg_echo('installation:disableapi:label')), 'name' => 'api', 'value' => $on, )); diff --git a/views/default/forms/avatar/crop.php b/views/default/forms/avatar/crop.php index dc5e3d77f..9fcae25c4 100644 --- a/views/default/forms/avatar/crop.php +++ b/views/default/forms/avatar/crop.php @@ -5,7 +5,7 @@ * @uses $vars['entity'] */ -$master_image = $vars['entity']->getIcon('master'); +$master_image = $vars['entity']->getIconUrl('master'); ?> <div class="clearfix"> diff --git a/views/default/forms/login.php b/views/default/forms/login.php index 5cfdcd4c6..91e9cda42 100644 --- a/views/default/forms/login.php +++ b/views/default/forms/login.php @@ -18,7 +18,7 @@ <?php echo elgg_view('login/extend'); ?> -<div> +<div class="elgg-foot"> <?php echo elgg_view('input/submit', array('value' => elgg_echo('login'))); ?> <label class="right mtm"> @@ -31,15 +31,15 @@ echo elgg_view('input/hidden', array('name' => 'returntoreferer', 'value' => 'true')); } ?> -</div> -<ul class="elgg-menu elgg-menu-footer"> -<?php - if (elgg_get_config('allow_registration')) { - 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(); ?>forgotpassword"> - <?php echo elgg_echo('user:password:lost'); ?> - </a></li> -</ul>
\ No newline at end of file + <ul class="elgg-menu elgg-menu-footer mtm"> + <?php + if (elgg_get_config('allow_registration')) { + echo '<li><a class="registration_link" href="' . elgg_get_site_url() . 'register">' . elgg_echo('register') . '</a></li>'; + } + ?> + <li><a href="<?php echo elgg_get_site_url(); ?>forgotpassword"> + <?php echo elgg_echo('user:password:lost'); ?> + </a></li> + </ul> +</div> diff --git a/views/default/forms/plugins/settings/save.php b/views/default/forms/plugins/settings/save.php index c3d8f231f..dc7b2fef7 100644 --- a/views/default/forms/plugins/settings/save.php +++ b/views/default/forms/plugins/settings/save.php @@ -1,6 +1,6 @@ <?php /** - * Used to show plugin user settings. + * Used to show plugin settings for both users and admins. * * @package Elgg.Core * @subpackage Plugins diff --git a/views/default/forms/plugins/usersettings/save.php b/views/default/forms/plugins/usersettings/save.php index bf243ae6b..ced88f818 100644 --- a/views/default/forms/plugins/usersettings/save.php +++ b/views/default/forms/plugins/usersettings/save.php @@ -1,4 +1,13 @@ <?php +/** + * Plugin user settings + * + * Calls the plugin admin settings form body with type set to 'user' + * + * @package Elgg.Core + * @subpackage Plugins + */ + $vars['type'] = 'user'; // Can't use elgg_view_form() because it overrides the $vars['action'] parameter diff --git a/views/default/forms/profile/fields/add.php b/views/default/forms/profile/fields/add.php index 7961037e6..c1d07d2ce 100644 --- a/views/default/forms/profile/fields/add.php +++ b/views/default/forms/profile/fields/add.php @@ -1,8 +1,6 @@ <?php /** - * Elgg profile index - * - * @package ElggProfile + * Add a new field to the set of custom profile fields */ $label_text = elgg_echo('profile:label'); @@ -20,9 +18,9 @@ $type_control = elgg_view('input/dropdown', array('name' => 'type', 'options_val $submit_control = elgg_view('input/submit', array('name' => elgg_echo('add'), 'value' => elgg_echo('add'))); $formbody = <<< END - <p>$label_text: $label_control + <div class="elgg-foot">$label_text: $label_control $type_text: $type_control - $submit_control</p> + $submit_control</div> END; echo autop(elgg_echo('profile:explainchangefields')); diff --git a/views/default/forms/profile/fields/reset.php b/views/default/forms/profile/fields/reset.php index 4e0f51dc6..c0bb1b7f4 100644 --- a/views/default/forms/profile/fields/reset.php +++ b/views/default/forms/profile/fields/reset.php @@ -3,8 +3,10 @@ * Reset profile fields form */ +echo '<div class="elgg-foot">'; $params = array( 'value' => elgg_echo('profile:resetdefault'), 'class' => 'elgg-button-cancel', ); echo elgg_view('input/submit', $params); +echo '</div>'; diff --git a/views/default/forms/register.php b/views/default/forms/register.php index 4e0a521ab..6e18cd53d 100644 --- a/views/default/forms/register.php +++ b/views/default/forms/register.php @@ -70,9 +70,11 @@ echo elgg_view('register/extend'); // Add captcha hook echo elgg_view('input/captcha'); +echo '<div class="elgg-foot">'; echo elgg_view('input/hidden', array('name' => 'friend_guid', 'value' => $vars['friend_guid'])); echo elgg_view('input/hidden', array('name' => 'invitecode', 'value' => $vars['invitecode'])); echo elgg_view('input/submit', array('name' => 'submit', 'value' => elgg_echo('register'))); +echo '</div>'; ?> <script type="text/javascript"> $(function() { diff --git a/views/default/forms/usersettings/save.php b/views/default/forms/usersettings/save.php index ea53f2571..71323083f 100644 --- a/views/default/forms/usersettings/save.php +++ b/views/default/forms/usersettings/save.php @@ -1,5 +1,11 @@ <?php -$form_body = elgg_view("forms/account/settings"); +/** + * User account settings. + * + * Plugins should extend "forms/account/settings" to add to the settings. + */ + +$form_body = elgg_view("forms/account/settings", $vars); $form_body .= '<div class="elgg-foot">'; $form_body .= elgg_view('input/submit', array('value' => elgg_echo('save'))); diff --git a/views/default/icon/user/default.php b/views/default/icon/user/default.php index 6f5c6e2da..aca03521f 100644 --- a/views/default/icon/user/default.php +++ b/views/default/icon/user/default.php @@ -37,6 +37,10 @@ if (!$icontime) { $js = elgg_extract('js', $vars, ''); $hover = elgg_extract('hover', $vars, true); +if (isset($vars['override'])) { + elgg_deprecated_notice("Use 'hover' rather than 'override' with user avatars", 1.8, 5); + $hover = false; +} $spacer_url = elgg_get_site_url() . '_graphics/spacer.gif'; diff --git a/views/default/input/checkboxes.php b/views/default/input/checkboxes.php index 985858b85..db4b06949 100644 --- a/views/default/input/checkboxes.php +++ b/views/default/input/checkboxes.php @@ -49,7 +49,6 @@ $id = ''; if (isset($vars['id'])) { $id = "id=\"{$vars['id']}\""; unset($vars['id']); - unset($vars['internalid']); } if (is_array($vars['value'])) { diff --git a/views/default/input/date.php b/views/default/input/date.php index ceeb2105c..35a951a0b 100644 --- a/views/default/input/date.php +++ b/views/default/input/date.php @@ -44,7 +44,6 @@ if ($timestamp) { $vars['class'] = "{$vars['class']} elgg-input-timestamp"; $vars['id'] = $vars['name']; unset($vars['name']); - unset($vars['internalname']); } // convert timestamps to text for display diff --git a/views/default/input/dropdown.php b/views/default/input/dropdown.php index 4673a9301..9f07874f1 100644 --- a/views/default/input/dropdown.php +++ b/views/default/input/dropdown.php @@ -11,7 +11,7 @@ * @uses $vars['value'] The current value, if any * @uses $vars['options'] An array of strings representing the options for the dropdown field * @uses $vars['options_values'] An associative array of "value" => "option" - * where "value" is an internal name and "option" is + * where "value" is the name and "option" is * the value displayed on the button. Replaces * $vars['options'] when defined. * @uses $vars['class'] Additional CSS class diff --git a/views/default/input/friendspicker.php b/views/default/input/friendspicker.php index 1a60e0d88..ecf468da3 100644 --- a/views/default/input/friendspicker.php +++ b/views/default/input/friendspicker.php @@ -187,7 +187,7 @@ if (!isset($vars['replacement'])) { } //echo "<p>" . $user->name . "</p>"; - $label = elgg_view_entity_icon($friend, 'tiny', array('override' => true)); + $label = elgg_view_entity_icon($friend, 'tiny', array('hover' => false)); $options[$label] = $friend->getGUID(); if ($vars['highlight'] == 'all' diff --git a/views/default/input/radio.php b/views/default/input/radio.php index a8b278efd..ef860a773 100644 --- a/views/default/input/radio.php +++ b/views/default/input/radio.php @@ -32,7 +32,6 @@ $id = ''; if (isset($vars['id'])) { $id = "id=\"{$vars['id']}\""; unset($vars['id']); - unset($vars['internalid']); } $class = "elgg-input-radios elgg-{$vars['align']}"; diff --git a/views/default/input/userpicker.php b/views/default/input/userpicker.php index dcd65072a..b852d24fc 100644 --- a/views/default/input/userpicker.php +++ b/views/default/input/userpicker.php @@ -6,15 +6,15 @@ * @subpackage Core * * @uses $vars['value'] Array of user guids for already selected users or null - * @uses $vars['name'] The name of the input field * + * The name of the hidden fields is members[] * * Defaults to lazy load user lists in paginated alphabetical order. User needs - * two type two characters before seeing the user popup list. + * to type two characters before seeing the user popup list. * * As users are checked they move down to a "users" box. - * When this happens, a hidden input is created also. - * {$internalnal}[] with the value the GUID. + * When this happens, a hidden input is created with the + * name of members[] and a value of the GUID. * * @warning: this is not stable */ diff --git a/views/default/js/admin.php b/views/default/js/admin.php index 2f2f59287..253a73887 100644 --- a/views/default/js/admin.php +++ b/views/default/js/admin.php @@ -32,6 +32,7 @@ elgg.admin.init = function () { }); // in-line editing for custom profile fields. + // @note this requires jquery.jeditable plugin $(".elgg-state-editable").editable(elgg.admin.editProfileField, { type: 'text', onblur: 'submit', diff --git a/views/default/js/elgg.php b/views/default/js/elgg.php index 76388f80c..133e128a4 100644 --- a/views/default/js/elgg.php +++ b/views/default/js/elgg.php @@ -56,11 +56,13 @@ elgg.version = '<?php echo get_version(); ?>'; elgg.release = '<?php echo get_version(true); ?>'; elgg.config.wwwroot = '<?php echo elgg_get_site_url(); ?>'; elgg.security.interval = 5 * 60 * 1000; <?php //@todo make this configurable ?> +elgg.config.domReady = false; +elgg.config.languageReady = false; //After the DOM is ready $(function() { - elgg.trigger_hook('init', 'system'); - elgg.trigger_hook('ready', 'system'); + elgg.config.domReady = true; + elgg.initWhenReady(); }); <?php diff --git a/views/default/navigation/menu/site.php b/views/default/navigation/menu/site.php index 1409f54af..38b42bda9 100644 --- a/views/default/navigation/menu/site.php +++ b/views/default/navigation/menu/site.php @@ -11,11 +11,11 @@ foreach ($vars['menu']['default'] as $menu_item) { echo elgg_view('navigation/menu/elements/item', array('item' => $menu_item)); } -if (isset($vars['menu']['more'])) { +if (isset($vars['menu']['more']) && !empty($vars['menu']['more'])) { echo '<li class="elgg-more">'; $more = elgg_echo('more'); - echo "<a title=\"$more\">$more</a>"; + echo "<a href=\"#\">$more</a>"; echo elgg_view('navigation/menu/elements/section', array( 'class' => 'elgg-menu elgg-menu-site elgg-menu-site-more', diff --git a/views/default/object/plugin/advanced.php b/views/default/object/plugin/advanced.php index 08da89c01..1fabaff04 100644 --- a/views/default/object/plugin/advanced.php +++ b/views/default/object/plugin/advanced.php @@ -197,7 +197,7 @@ if ($files) { <?php echo $links; ?> </ul> <?php endif; ?> - <div class="clearfloat right mtm"> + <div class="clearfloat float-alt mtm"> <?php echo $action_button; ?> </div> </div> @@ -207,7 +207,7 @@ $settings_view_old = 'settings/' . $plugin->getID() . '/edit'; $settings_view_new = 'plugins/' . $plugin->getID() . '/settings'; if (elgg_view_exists($settings_view_old) || elgg_view_exists($settings_view_new)) { $link = elgg_get_site_url() . "admin/plugin_settings/" . $plugin->getID(); - $settings_link = "<a class='plugin_settings small link' href='$link'>[" . elgg_echo('settings') . "]</a>"; + $settings_link = "<a class='elgg-plugin-settings' href='$link'>[" . elgg_echo('settings') . "]</a>"; } ?> <div class="elgg-head"> @@ -233,8 +233,8 @@ if (elgg_view_exists($settings_view_old) || elgg_view_exists($settings_view_new) } ?> - <div class="plugin_description"><?php echo $description; ?></div> - <p class="plugin_author"><?php echo $author . ' - ' . $website; ?></p> + <div><?php echo $description; ?></div> + <p><?php echo $author . ' - ' . $website; ?></p> <?php echo $docs; ?> <div class="pts"> @@ -248,7 +248,7 @@ if (elgg_view_exists($settings_view_old) || elgg_view_exists($settings_view_new) </div> </div> </div> - <div class="hidden manifest_file" id="elgg-plugin-manifest-<?php echo $plugin->getID(); ?>"> + <div class="elgg-plugin-more hidden" id="elgg-plugin-manifest-<?php echo $plugin->getID(); ?>"> <?php if ($screenshots_html) { diff --git a/views/default/object/plugin/elements/dependencies.php b/views/default/object/plugin/elements/dependencies.php index 5f4aa4392..8abd61692 100644 --- a/views/default/object/plugin/elements/dependencies.php +++ b/views/default/object/plugin/elements/dependencies.php @@ -13,7 +13,7 @@ $deps = $plugin->getPackage()->checkDependencies(true); $columns = array('type', 'name', 'expected_value', 'local_value', 'comment'); -echo '<table class="elgg-plugins-dependencies styled"><tr>'; +echo '<table class="elgg-plugin-dependencies styled"><tr>'; foreach ($columns as $column) { $column = elgg_echo("admin:plugins:dependencies:$column"); diff --git a/views/default/object/plugin/invalid.php b/views/default/object/plugin/invalid.php index f29ee8d12..bb518cd53 100644 --- a/views/default/object/plugin/invalid.php +++ b/views/default/object/plugin/invalid.php @@ -34,7 +34,7 @@ $error = $plugin->getError(); ?> </div> - <div class="hidden manifest_file" id="elgg-plugin-manifest-<?php echo $plugin->getID(); ?>"> + <div class="hidden elgg-plugin-more" id="elgg-plugin-manifest-<?php echo $plugin->getID(); ?>"> <p><?php echo elgg_echo('admin:plugins:label:location') . ": " . $path; ?></p> <p><?php echo $error; ?></p> </div> diff --git a/views/default/object/plugin/simple.php b/views/default/object/plugin/simple.php index 5f5b08f10..f4cc944f4 100644 --- a/views/default/object/plugin/simple.php +++ b/views/default/object/plugin/simple.php @@ -57,7 +57,7 @@ foreach ($files as $file => $path) { if (elgg_view_exists("settings/$plugin_id/edit")) { $settings_href = elgg_get_site_url() . "admin/plugin_settings/$plugin_id"; - $plugin_footer .= "<li><a class='plugin_settings link' href='$settings_href'>" . elgg_echo('settings') . "</a></li>"; + $plugin_footer .= "<li><a class='elgg-plugin-settings' href='$settings_href'>" . elgg_echo('settings') . "</a></li>"; } $plugin_footer .= "</ul>"; diff --git a/views/default/output/confirmlink.php b/views/default/output/confirmlink.php index 5059a656e..31a34ae63 100644 --- a/views/default/output/confirmlink.php +++ b/views/default/output/confirmlink.php @@ -25,8 +25,8 @@ if ($encode) { $text = htmlspecialchars($text, ENT_QUOTES, 'UTF-8', false); } -if (!isset($vars['title'])) { - $vars['title'] = addslashes($confirm); +if (!isset($vars['title']) && isset($vars['confirm'])) { + $vars['title'] = $vars['rel']; } if (isset($vars['class'])) { diff --git a/views/default/page/admin.php b/views/default/page/admin.php index 2b2ec9e4a..cd03541d5 100644 --- a/views/default/page/admin.php +++ b/views/default/page/admin.php @@ -22,7 +22,7 @@ if ($notices) { $notices_html .= elgg_view_entity($notice); } - $notices_html = "<div class=\"admin_notices\">$notices_html</div>"; + $notices_html = "<div class=\"elgg-admin-notices\">$notices_html</div>"; } ?> diff --git a/views/default/page/elements/head.php b/views/default/page/elements/head.php index 8776f07a7..e968e95ce 100644 --- a/views/default/page/elements/head.php +++ b/views/default/page/elements/head.php @@ -48,11 +48,15 @@ $release = get_version(true); <?php $ie_url = elgg_get_simplecache_url('css', 'ie'); + $ie7_url = elgg_get_simplecache_url('css', 'ie7'); $ie6_url = elgg_get_simplecache_url('css', 'ie6'); ?> - <!--[if gt IE 6]> + <!--[if gt IE 7]> <link rel="stylesheet" type="text/css" href="<?php echo $ie_url; ?>" /> <![endif]--> + <!--[if IE 7]> + <link rel="stylesheet" type="text/css" href="<?php echo $ie7_url; ?>" /> + <![endif]--> <!--[if IE 6]> <link rel="stylesheet" type="text/css" href="<?php echo $ie6_url; ?>" /> <![endif]--> diff --git a/views/default/river/user/default/profileupdate.php b/views/default/river/user/default/profileupdate.php new file mode 100644 index 000000000..a344131d6 --- /dev/null +++ b/views/default/river/user/default/profileupdate.php @@ -0,0 +1,19 @@ +<?php +/** + * Update profile river view + */ + +$subject = $vars['item']->getSubjectEntity(); + +$subject_link = elgg_view('output/url', array( + 'href' => $subject->getURL(), + 'text' => $subject->name, + 'class' => 'elgg-river-subject', +)); + +$string = elgg_echo('river:update:user:profile', array($subject_link)); + +echo elgg_view('river/item', array( + 'item' => $vars['item'], + 'summary' => $string, +)); |