aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore20
-rw-r--r--.travis.yml10
-rw-r--r--CHANGES.txt139
-rw-r--r--INSTALL.txt24
-rw-r--r--README.txt4
-rw-r--r--_graphics/ajax_loader.gifbin4421 -> 2608 bytes
-rw-r--r--_graphics/ajax_loader_bw.gifbin3394 -> 2608 bytes
-rw-r--r--actions/admin/plugins/activate.php2
-rw-r--r--actions/admin/plugins/activate_all.php2
-rw-r--r--actions/admin/plugins/deactivate.php2
-rw-r--r--actions/admin/plugins/deactivate_all.php2
-rw-r--r--actions/admin/plugins/set_priority.php2
-rw-r--r--actions/admin/site/flush_cache.php2
-rw-r--r--actions/admin/site/update_advanced.php28
-rw-r--r--actions/admin/site/update_basic.php3
-rw-r--r--actions/avatar/crop.php8
-rw-r--r--actions/avatar/remove.php34
-rw-r--r--actions/comments/delete.php17
-rw-r--r--actions/friends/add.php4
-rw-r--r--actions/login.php21
-rw-r--r--actions/profile/fields/add.php1
-rw-r--r--actions/profile/fields/delete.php1
-rw-r--r--actions/profile/fields/reorder.php4
-rw-r--r--actions/register.php4
-rw-r--r--actions/useradd.php4
-rw-r--r--documentation/examples/plugins/start.php12
-rw-r--r--documentation/info/config.php6
-rw-r--r--engine/classes/ElggBatch.php95
-rw-r--r--engine/classes/ElggCache.php8
-rw-r--r--engine/classes/ElggDiskFilestore.php2
-rw-r--r--engine/classes/ElggEntity.php154
-rw-r--r--engine/classes/ElggExtender.php22
-rw-r--r--engine/classes/ElggFileCache.php19
-rw-r--r--engine/classes/ElggGroup.php30
-rw-r--r--engine/classes/ElggMemcache.php24
-rw-r--r--engine/classes/ElggMenuBuilder.php10
-rw-r--r--engine/classes/ElggMenuItem.php22
-rw-r--r--engine/classes/ElggMetadata.php7
-rw-r--r--engine/classes/ElggObject.php31
-rw-r--r--engine/classes/ElggPlugin.php68
-rw-r--r--engine/classes/ElggPluginManifest.php33
-rw-r--r--engine/classes/ElggPluginPackage.php2
-rw-r--r--engine/classes/ElggRelationship.php6
-rw-r--r--engine/classes/ElggRiverItem.php14
-rw-r--r--engine/classes/ElggSite.php37
-rw-r--r--engine/classes/ElggUser.php65
-rw-r--r--engine/classes/ElggWidget.php57
-rw-r--r--engine/classes/ODDDocument.php2
-rw-r--r--engine/classes/ODDEntity.php72
-rw-r--r--engine/classes/ODDMetaData.php39
-rw-r--r--engine/classes/ODDRelationship.php33
-rw-r--r--engine/classes/SuccessResult.php2
-rw-r--r--engine/classes/XMLRPCCall.php4
-rw-r--r--engine/handlers/cache_handler.php21
-rw-r--r--engine/handlers/export_handler.php6
-rw-r--r--engine/lib/access.php58
-rw-r--r--engine/lib/actions.php18
-rw-r--r--engine/lib/admin.php25
-rw-r--r--engine/lib/annotations.php60
-rw-r--r--engine/lib/cache.php175
-rw-r--r--engine/lib/configuration.php109
-rw-r--r--engine/lib/database.php41
-rw-r--r--engine/lib/deprecated-1.8.php6
-rw-r--r--engine/lib/elgglib.php147
-rw-r--r--engine/lib/entities.php150
-rw-r--r--engine/lib/extender.php7
-rw-r--r--engine/lib/filestore.php8
-rw-r--r--engine/lib/group.php26
-rw-r--r--engine/lib/input.php4
-rw-r--r--engine/lib/languages.php124
-rw-r--r--engine/lib/metadata.php81
-rw-r--r--engine/lib/metastrings.php29
-rw-r--r--engine/lib/navigation.php10
-rw-r--r--engine/lib/notification.php1
-rw-r--r--engine/lib/objects.php7
-rw-r--r--engine/lib/output.php22
-rw-r--r--engine/lib/pagehandler.php3
-rw-r--r--engine/lib/pageowner.php7
-rw-r--r--engine/lib/plugins.php46
-rw-r--r--engine/lib/private_settings.php2
-rw-r--r--engine/lib/relationships.php4
-rw-r--r--engine/lib/river.php22
-rw-r--r--engine/lib/sessions.php21
-rw-r--r--engine/lib/sites.php40
-rw-r--r--engine/lib/statistics.php6
-rw-r--r--engine/lib/system_log.php34
-rw-r--r--engine/lib/upgrades/2011010101.php2
-rw-r--r--engine/lib/upgrades/2011030700-1.8_svn-blog_status_metadata-4645225d7b440876.php3
-rw-r--r--engine/lib/upgrades/2011061200-1.8b1-sites_need_a_site_guid-6d9dcbf46c0826cc.php1
-rw-r--r--engine/lib/upgrades/2011123100-1.8.2-fix_friend_river-b17e7ff8345c2269.php12
-rw-r--r--engine/lib/upgrades/2011123101-1.8.2-fix_blog_status-b14c2a0e7b9e7d55.php25
-rw-r--r--engine/lib/upgrades/2012012000-1.8.3-ip_in_syslog-87fe0f068cf62428.php12
-rw-r--r--engine/lib/upgrades/2012012100-1.8.3-system_cache-93100e7d55a24a11.php13
-rw-r--r--engine/lib/upgrades/2012041800-1.8.3-dont_filter_passwords-c0ca4a18b38ae2bc.php11
-rw-r--r--engine/lib/upgrades/2012041801-1.8.3-multiple_user_tokens-852225f7fd89f6c5.php13
-rw-r--r--engine/lib/user_settings.php6
-rw-r--r--engine/lib/users.php62
-rw-r--r--engine/lib/views.php85
-rw-r--r--engine/lib/web_services.php2
-rw-r--r--engine/lib/widgets.php5
-rw-r--r--engine/schema/mysql.sql1
-rw-r--r--engine/settings.example.php2
-rw-r--r--engine/start.php111
-rw-r--r--engine/tests/api/annotations.php24
-rw-r--r--engine/tests/api/helpers.php83
-rw-r--r--engine/tests/api/metadata.php111
-rw-r--r--engine/tests/api/metastrings.php6
-rw-r--r--engine/tests/objects/entities.php35
-rw-r--r--engine/tests/objects/objects.php92
-rw-r--r--engine/tests/regression/trac_bugs.php18
-rw-r--r--install/ElggInstaller.php56
-rw-r--r--install/languages/en.php6
-rw-r--r--js/lib/ui.river.js14
-rw-r--r--js/lib/ui.widgets.js25
-rw-r--r--languages/en.php55
-rw-r--r--mod/blog/actions/blog/save.php6
-rw-r--r--mod/blog/classes/ElggBlog.php4
-rw-r--r--mod/blog/languages/en.php11
-rw-r--r--mod/blog/lib/blog.php17
-rw-r--r--mod/blog/start.php55
-rw-r--r--mod/blog/views/default/blog/group_module.php3
-rw-r--r--mod/blog/views/default/blog/sidebar.php2
-rw-r--r--mod/blog/views/default/blog/sidebar/archives.php10
-rw-r--r--mod/blog/views/default/object/blog.php6
-rw-r--r--mod/bookmarks/actions/bookmarks/save.php2
-rw-r--r--mod/bookmarks/languages/en.php11
-rw-r--r--mod/bookmarks/pages/bookmarks/all.php2
-rw-r--r--mod/bookmarks/pages/bookmarks/owner.php2
-rw-r--r--mod/bookmarks/pages/bookmarks/view.php4
-rw-r--r--mod/bookmarks/start.php24
-rw-r--r--mod/bookmarks/views/default/object/bookmarks.php3
-rw-r--r--mod/categories/languages/en.php2
-rw-r--r--mod/developers/actions/developers/settings.php6
-rw-r--r--mod/developers/languages/en.php12
-rw-r--r--mod/developers/start.php9
-rw-r--r--mod/developers/views/default/admin/develop_tools/unit_tests.php17
-rw-r--r--mod/developers/views/default/admin/developers/settings.php4
-rw-r--r--mod/developers/views/default/theme_preview/components.php15
-rw-r--r--mod/developers/views/default/theme_preview/components/table.php2
-rw-r--r--mod/diagnostics/languages/en.php66
-rw-r--r--mod/diagnostics/start.php2
-rw-r--r--mod/diagnostics/views/default/admin/administer_utilities/diagnostics.php17
-rw-r--r--mod/diagnostics/views/default/admin/develop_utilities/diagnostics.php38
-rw-r--r--mod/embed/manifest.xml4
-rw-r--r--mod/embed/views/default/embed/layout.php3
-rw-r--r--mod/embed/views/default/js/embed/embed.php7
-rw-r--r--mod/embed/views/default/navigation/menu/embed.php2
-rw-r--r--mod/externalpages/actions/edit.php24
-rw-r--r--mod/externalpages/start.php11
-rw-r--r--mod/externalpages/views/default/expages/menu.php4
-rw-r--r--mod/externalpages/views/default/expages/wrapper.php16
-rw-r--r--mod/externalpages/views/default/forms/expages/edit.php4
-rw-r--r--mod/file/actions/file/upload.php33
-rw-r--r--mod/file/graphics/icons/application.gifbin2543 -> 2465 bytes
-rw-r--r--mod/file/graphics/icons/application_lrg.gifbin7916 -> 7781 bytes
-rw-r--r--mod/file/graphics/icons/archive.gifbin2479 -> 2419 bytes
-rw-r--r--mod/file/graphics/icons/archive_lrg.gifbin8080 -> 7918 bytes
-rw-r--r--mod/file/graphics/icons/excel.gifbin2632 -> 2509 bytes
-rw-r--r--mod/file/graphics/icons/excel_lrg.gifbin8098 -> 7571 bytes
-rw-r--r--mod/file/graphics/icons/general.gifbin1528 -> 1528 bytes
-rw-r--r--mod/file/graphics/icons/general_lrg.gifbin4731 -> 4594 bytes
-rw-r--r--mod/file/graphics/icons/music.gifbin2524 -> 2297 bytes
-rw-r--r--mod/file/graphics/icons/music_lrg.gifbin7397 -> 6748 bytes
-rw-r--r--mod/file/graphics/icons/openoffice.gifbin2502 -> 2313 bytes
-rw-r--r--mod/file/graphics/icons/openoffice_lrg.gifbin7265 -> 6617 bytes
-rw-r--r--mod/file/graphics/icons/pages.gifbin3098 -> 2766 bytes
-rw-r--r--mod/file/graphics/icons/pages_lrg.gifbin11394 -> 10234 bytes
-rw-r--r--mod/file/graphics/icons/pdf.gifbin2345 -> 2197 bytes
-rw-r--r--mod/file/graphics/icons/pdf_lrg.gifbin6770 -> 6014 bytes
-rw-r--r--mod/file/graphics/icons/ppt.gifbin2556 -> 2495 bytes
-rw-r--r--mod/file/graphics/icons/ppt_lrg.gifbin7964 -> 7423 bytes
-rw-r--r--mod/file/graphics/icons/text.gifbin2896 -> 2881 bytes
-rw-r--r--mod/file/graphics/icons/text_lrg.gifbin10928 -> 9855 bytes
-rw-r--r--mod/file/graphics/icons/vcard.gifbin2536 -> 2385 bytes
-rw-r--r--mod/file/graphics/icons/vcard_lrg.gifbin7504 -> 6798 bytes
-rw-r--r--mod/file/graphics/icons/video.gifbin2722 -> 2603 bytes
-rw-r--r--mod/file/graphics/icons/video_lrg.gifbin7868 -> 7319 bytes
-rw-r--r--mod/file/graphics/icons/word.gifbin2642 -> 2479 bytes
-rw-r--r--mod/file/graphics/icons/word_lrg.gifbin7925 -> 7350 bytes
-rw-r--r--mod/file/languages/en.php10
-rw-r--r--mod/file/pages/file/download.php2
-rw-r--r--mod/file/pages/file/view.php4
-rw-r--r--mod/file/start.php20
-rw-r--r--mod/file/views/default/file/specialcontent/image/default.php10
-rw-r--r--mod/file/views/default/object/file.php3
-rw-r--r--mod/groups/actions/discussion/reply/save.php6
-rw-r--r--mod/groups/actions/discussion/save.php2
-rw-r--r--mod/groups/actions/groups/edit.php20
-rw-r--r--mod/groups/actions/groups/membership/delete_invite.php4
-rw-r--r--mod/groups/icon.php12
-rw-r--r--mod/groups/languages/en.php12
-rw-r--r--mod/groups/lib/discussion.php6
-rw-r--r--mod/groups/lib/groups.php6
-rw-r--r--mod/groups/start.php56
-rw-r--r--mod/groups/upgrades/2011030101.php16
-rw-r--r--mod/groups/views/default/forms/groups/find.php16
-rw-r--r--mod/groups/views/default/forms/groups/search.php14
-rw-r--r--mod/groups/views/default/group/default.php3
-rw-r--r--mod/groups/views/default/groups/group_sort_menu.php10
-rw-r--r--mod/groups/views/default/groups/js.php3
-rw-r--r--mod/groups/views/default/groups/sidebar/find.php2
-rw-r--r--mod/groups/views/default/groups/sidebar/members.php3
-rw-r--r--mod/groups/views/default/groups/sidebar/search.php15
-rw-r--r--mod/htmlawed/manifest.xml2
-rw-r--r--mod/likes/views/default/likes/button.php5
-rw-r--r--mod/logbrowser/languages/en.php3
-rw-r--r--mod/logbrowser/views/default/admin/administer_utilities/logbrowser.php28
-rw-r--r--mod/logbrowser/views/default/forms/logbrowser/refine.php25
-rw-r--r--mod/logbrowser/views/default/logbrowser/table.php17
-rw-r--r--mod/members/pages/members/search.php9
-rw-r--r--mod/messageboard/actions/delete.php1
-rw-r--r--mod/messageboard/views/default/messageboard/js.php3
-rw-r--r--mod/messages/views/default/forms/messages/process.php4
-rw-r--r--mod/messages/views/default/messages/js.php3
-rw-r--r--mod/pages/actions/pages/delete.php5
-rw-r--r--mod/pages/actions/pages/edit.php14
-rw-r--r--mod/pages/images/pages.gifbin3098 -> 2766 bytes
-rw-r--r--mod/pages/images/pages_lrg.gifbin11394 -> 10234 bytes
-rw-r--r--mod/pages/languages/en.php11
-rw-r--r--mod/pages/lib/pages.php8
-rw-r--r--mod/pages/manifest.xml2
-rw-r--r--mod/pages/pages/pages/history.php7
-rw-r--r--mod/pages/pages/pages/owner.php1
-rw-r--r--mod/pages/pages/pages/view.php4
-rw-r--r--mod/pages/start.php17
-rw-r--r--mod/pages/views/default/forms/pages/edit.php15
-rw-r--r--mod/pages/views/default/object/page_top.php3
-rw-r--r--mod/profile/icondirect.php9
-rw-r--r--mod/profile/views/default/profile/js.php5
-rw-r--r--mod/search/pages/search/index.php12
-rw-r--r--mod/search/search_hooks.php2
-rw-r--r--mod/search/start.php7
-rw-r--r--mod/search/views/default/search/list.php2
-rw-r--r--mod/search/views/default/search/search_box.php3
-rw-r--r--mod/thewire/actions/add.php2
-rw-r--r--mod/thewire/classes/ElggWire.php4
-rw-r--r--mod/thewire/pages/thewire/owner.php4
-rw-r--r--mod/thewire/pages/thewire/view.php30
-rw-r--r--mod/thewire/start.php23
-rw-r--r--mod/thewire/tests/regex.php6
-rw-r--r--mod/twitter_api/actions/twitter_api/interstitial_settings.php4
-rw-r--r--mod/twitter_api/lib/twitter_api.php2
-rw-r--r--mod/uservalidationbyemail/start.php6
-rw-r--r--mod/uservalidationbyemail/views/default/forms/uservalidationbyemail/bulk_action.php2
-rw-r--r--pages/avatar/edit.php9
-rw-r--r--pages/friends/index.php3
-rw-r--r--pages/friends/of.php3
-rw-r--r--pages/river.php3
-rw-r--r--upgrade.php10
-rw-r--r--version.php4
-rw-r--r--views/default/admin/plugins.php8
-rw-r--r--views/default/admin/statistics/overview.php4
-rw-r--r--views/default/admin/statistics/overview/basic.php (renamed from views/default/admin/statistics/basic.php)0
-rw-r--r--views/default/admin/statistics/overview/numentities.php (renamed from views/default/admin/statistics/numentities.php)0
-rw-r--r--views/default/admin/statistics/server.php8
-rw-r--r--views/default/admin/statistics/server/php.php50
-rw-r--r--views/default/admin/statistics/server/web_server.php16
-rw-r--r--views/default/core/avatar/upload.php12
-rw-r--r--views/default/core/river/filter.php16
-rw-r--r--views/default/core/settings/account/default_access.php24
-rw-r--r--views/default/core/settings/account/email.php24
-rw-r--r--views/default/core/settings/account/language.php29
-rw-r--r--views/default/core/settings/account/name.php29
-rw-r--r--views/default/core/settings/account/notifications.php45
-rw-r--r--views/default/core/settings/account/password.php54
-rw-r--r--views/default/core/settings/statistics/numentities.php63
-rw-r--r--views/default/core/settings/statistics/online.php48
-rw-r--r--views/default/core/settings/tools.php3
-rw-r--r--views/default/core/walled_garden/body.php11
-rw-r--r--views/default/core/walled_garden/login.php8
-rw-r--r--views/default/core/walled_garden/lost_password.php8
-rw-r--r--views/default/core/walled_garden/register.php8
-rw-r--r--views/default/css/admin.php55
-rw-r--r--views/default/css/elements/components.php15
-rw-r--r--views/default/css/elements/icons.php4
-rw-r--r--views/default/css/elements/modules.php2
-rw-r--r--views/default/css/walled_garden.php13
-rw-r--r--views/default/forms/admin/site/update_advanced.php16
-rw-r--r--views/default/forms/login.php2
-rw-r--r--views/default/forms/register.php4
-rw-r--r--views/default/icon/default.php5
-rw-r--r--views/default/js/walled_garden.php54
-rw-r--r--views/default/navigation/menu/elements/item.php6
-rw-r--r--views/default/navigation/pagination.php12
-rw-r--r--views/default/navigation/tabs.php95
-rw-r--r--views/default/object/elements/summary.php4
-rw-r--r--views/default/object/plugin.php4
-rw-r--r--views/default/object/plugin/full.php40
-rw-r--r--views/default/object/plugin/invalid.php5
-rw-r--r--views/default/object/widget.php3
-rw-r--r--views/default/object/widget/elements/controls.php4
-rw-r--r--views/default/object/widget/elements/settings.php14
-rw-r--r--views/default/output/access.php5
-rw-r--r--views/default/output/tagcloud.php12
-rw-r--r--views/default/output/tags.php38
-rw-r--r--views/default/page/components/list.php2
-rw-r--r--views/default/page/default.php4
-rw-r--r--views/default/page/elements/comments.php2
-rw-r--r--views/default/page/layouts/walled_garden.php16
-rw-r--r--views/default/river/elements/body.php2
-rw-r--r--views/default/river/elements/summary.php11
-rw-r--r--views/default/widgets/friends/content.php1
-rw-r--r--views/failsafe/messages/exceptions/admin_exception.php30
-rw-r--r--views/failsafe/messages/exceptions/exception.php26
-rw-r--r--views/installation/forms/install/template.php2
-rw-r--r--views/installation/install/nav.php4
306 files changed, 3595 insertions, 1867 deletions
diff --git a/.gitignore b/.gitignore
index edfede73b..c0bba2c6c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,9 +1,9 @@
+# ignore Elgg configuration
/engine/settings.php
/.htaccess
-/.buildpath
-/.settings
-/.project
/mod/*
+
+# don't ignore bundled plugins
!/mod/blog/
!/mod/bookmarks/
!/mod/categories/
@@ -38,3 +38,17 @@
!/mod/uservalidationbyemail/
!/mod/zaudio/
+# ignore IDE/hidden/OS cache files
+.*
+*~
+/nbproject
+/nb-configuration.xml
+Session.vim
+*.tmproj
+*.tmproject
+tmtags
+Thumbs.db
+Desktop.ini
+
+# don't ignore travis config
+!/.travis.yml
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 000000000..5cc8f375a
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,10 @@
+language: php
+phps:
+ - 5.2
+ - 5.3
+
+script: phpunit --help
+
+branches:
+ only:
+ - master \ No newline at end of file
diff --git a/CHANGES.txt b/CHANGES.txt
index 5232deadc..b502b8411 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,3 +1,142 @@
+Version 1.8.6
+(June 18, 2012 from https://github.com/Elgg/Elgg/tree/1.8)
+
+ Contributing Developers:
+ * Cash Costello
+ * Evan Winslow
+ * Ismayil Khayredinov
+ * Jeff Tilson
+ * Jerome Bakker
+ * Paweł Sroka
+ * Sem
+ * Steve Clay
+
+ Enhancements:
+ * New ajax spinner
+ * Detecting docx, xlsx, and pptx files in file plugin
+ * Showing ajax spinner when uploading file with embed plugin
+
+ Bugfixes:
+ * Fixed some language caching issues.
+ * Users can add sub-pages to another user's page in a group.
+ * Over 30 other bug fixes.
+
+
+Version 1.8.5
+(May 17, 2012 from https://github.com/Elgg/Elgg/tree/1.8)
+
+ Contributing Developers:
+ * Brett Profitt
+ * Evan Winslow
+ * Sem
+ * Steve Clay
+ * Jeroen Dalsem
+ * Jerome Bakker
+
+ Security Enhancements:
+ * Fixed possible XSS vulnerability if using a crafted URL.
+ * Fixed exploit to bypass new user validation if using a crafted form.
+ * Fixed incorrect caching of access lists that could allow plugins
+ to show private entities to non-admin and non-owning users. (Non-exploitable)
+
+ Bugfixes:
+ * Twitter API: New users are forwarded to the correct page after creating
+ an account with Twitter.
+ * Files: PDF files are downloaded as "inline" to display in the browser.
+ * Fixed possible duplication errors when writing metadata with multiple values.
+ * Fixed possible upgrade issue if using a plugin uses the system_log hooks.
+ * Fixed problems when enabling more than 50 metadata or annotations.
+
+ API:
+ * River entries' timestamps use elgg_view_friendly_time() and can be
+ overridden with the friendly time output view.
+
+
+Version 1.8.4
+(April 24, 2012 from https://github.com/Elgg/Elgg/tree/1.8)
+
+ Contributing Developers:
+ * Adayth Talavera
+ * Brett Profitt
+ * Cash Costello
+ * Evan Winslow
+ * Ismayil Khayredinov
+ * Janek Lasocki-Biczysko
+ * Jerome Baker
+ * Sem
+ * Steve Clay
+ * Webgalli
+
+ Security Enhancements:
+ * Fixed an issue in the web services auth.get_token endpoint that
+ would give valid auth tokens to invalid credentials. Thanks to
+ Christian for reporting this!
+ * Fixed an that could show which plugins are loaded on a site.
+
+ Enhancements:
+ * UI: All bundled plugins' list pages display a no content message if there is nothing to list.
+ * UI: Site default access is limited to core access levels.
+ * UI: Showing a system message to the admin if plugins are disabled with the "disabled"
+ magic file.
+ * UI: Added transparent backgrounds for files and pages icons.
+ * External (Site) Pages: If in Wall Garden mode, Site Pages use the Walled Garden
+ theme when logged out.
+ * UI: Database errors only show the query to admin users.
+ * UI: Cannot set the data path to a relative path in installation or site settings.
+ * UI: Cleaned up notifications for bundled plugins.
+ * UI: Hiding crop button if no avatar is uploaded.
+ * UI: Bundled plugins are displayed with a gold border in the plugin admin area.
+ * UI: Can see all the categories a plugin belongs to.
+ * Web Services: Multiple tokens allowed for users.
+ * API: More efficient entity loading.
+ * API: Added IP address to system log.
+ * API: Languages are cached.
+ * API: ElggBatch supports disabling offsets for callbacks that delete entities.
+ * API: Cleaned up the boot process.
+ * API: Fixed situation in which the cache isn't properly cleared if a file can't be unlinked.
+
+ Bugfixes:
+ * UI: Tags display in the case they were saved.
+ * UI: Friendly titles keep -s.
+ * UI: Removed pagination in friends widget.
+ * UI: Profile settings actions correctly displays error messages as errors.
+ * UI: Tag search works for tags with spaces.
+ * UI: Fixed river display for friending that happens during registration.
+ * Groups: Link for managing join requests is restored in the sidebar.
+ * Walled Garden: Cron and web services endpoints are exposed as public sites.
+ * The Wire: UTF usernames are correctly linked with @ syntax.
+ * The Wire: No longer selecting the "Mine" tab for users who aren't you.
+ * Blogs: Notifications restored.
+ * Message Board: Fixed delete.
+ * Groups: Forwarding to correct page if trying to access closed group.
+ * API: entities loaded via elgg_get_entities_from_relationship() have the correct time_created.
+ * API: Deleting entities recursively works when code is logged out.
+ * API: Fixed multiple uses of deprecated functions.
+
+
+Version 1.8.3
+(January 12, 2012 from https://github.com/Elgg/Elgg/tree/1.8)
+
+ Enhancements:
+ * Adds a white list for ajax views
+ * Improved navigation tab options
+ * Added group specific search
+ * Added button for reverting avatar
+ * Improved documentation for core class attributes
+ * Adds a server info page under administer -> statistics
+ * Improving caching of icons and js/css
+ * Deprecation notices not displayed to non-admin users
+
+ Bugfixes:
+ * Fixed upgrade scripts for blog posts and groups forum posts
+ * Can now delete invitations to invisible groups
+ * Fixed several widget bugs
+ * Fixed access level on add to group river item
+ * Fixed recursive entity enabling
+ * Fixed limit on pages in sidebar navigation
+ * Fixed deletion of large numbers of annotations
+
+
Version 1.8.2
(December 21, 2011 from https://github.com/Elgg/Elgg/tree/1.8)
diff --git a/INSTALL.txt b/INSTALL.txt
index f558a26e2..f4ecbffe1 100644
--- a/INSTALL.txt
+++ b/INSTALL.txt
@@ -11,7 +11,8 @@ TECHNICAL REQUIREMENTS
Elgg runs on a combination of the Apache web server, MySQL database
system and the PHP interpreted scripting language. This is the most
-popular web server environment in the world.
+popular web server environment in the world. (Elgg can also run on
+other web servers such a nginx and IIS, but requires further configuration).
Due to Elgg's advanced functionality, there are some extra
configuration requirements:
@@ -20,25 +21,17 @@ configuration requirements:
modules:
o mod_rewrite
o PHP
- * MySQL 5+ with sql_mode in standard mode (ie not in traditional
- or any other mode).
- * PHP 5.2+ needs to be installed as an Apache module (not in CGI
- mode or safe mode) with the following libraries:
- o GD (for graphics processing, eg user icon rescaling)
- o JSON (for API functionality)
- o XML (not installed/compiled by default on all systems)
- o Multibyte String support (for internationalisation)
+ * MySQL 5+.
+ * PHP 5.2+ needs to be installed as an Apache module
+ with the following libraries:
+ o GD (for graphics processing such as avatar cropping)
+ o Multibyte String support (for internationalization)
It is recommended that you increase the memory available to PHP
threads beyond the standard 8 or 12M, and increase the maximum
uploaded filesize (which defaults to 2M). In both cases, this can be
found in your php.ini.
- * The following PHP libraries are also recommended for some
- plugins and extra functionality:
- o SOAP
- o DOM
-
INSTALLING ELGG
@@ -104,7 +97,8 @@ If your web server does not have permission to create these files, you
will need to either
1. Change the permissions on the directory where you are installing
- Elgg and the engine directory and try again.
+ Elgg and the engine directory and try again. Remember to change the
+ permissions back to the original values after installation is complete.
2. Copy engine/settings.example.php to engine/settings.php, open
it up in a text editor and fill in your database details. Then
diff --git a/README.txt b/README.txt
index 3cffcc8c7..5d9261ee4 100644
--- a/README.txt
+++ b/README.txt
@@ -1,12 +1,12 @@
Elgg
-Copyright (c) 2008-2011 See COPYRIGHT.txt
+Copyright (c) 2008-2012 See COPYRIGHT.txt
See CONTRIBUTORS.txt for development credits.
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
+individually independent organization that operates in the best interest of Elgg
as an open source project.
The project site can be found at http://elgg.org/
diff --git a/_graphics/ajax_loader.gif b/_graphics/ajax_loader.gif
index 5a9af96d2..b55e148bb 100644
--- a/_graphics/ajax_loader.gif
+++ b/_graphics/ajax_loader.gif
Binary files differ
diff --git a/_graphics/ajax_loader_bw.gif b/_graphics/ajax_loader_bw.gif
index 95bad9128..e195e1fd8 100644
--- a/_graphics/ajax_loader_bw.gif
+++ b/_graphics/ajax_loader_bw.gif
Binary files differ
diff --git a/actions/admin/plugins/activate.php b/actions/admin/plugins/activate.php
index 224b5a2ae..286cf5a4f 100644
--- a/actions/admin/plugins/activate.php
+++ b/actions/admin/plugins/activate.php
@@ -38,7 +38,7 @@ foreach ($plugin_guids as $guid) {
// don't regenerate the simplecache because the plugin won't be
// loaded until next run. Just invalidate and let it regenerate as needed
elgg_invalidate_simplecache();
-elgg_filepath_cache_reset();
+elgg_reset_system_cache();
if (count($activated_guids) === 1) {
$url = 'admin/plugins';
diff --git a/actions/admin/plugins/activate_all.php b/actions/admin/plugins/activate_all.php
index 19c142346..4514ccbdf 100644
--- a/actions/admin/plugins/activate_all.php
+++ b/actions/admin/plugins/activate_all.php
@@ -28,6 +28,6 @@ foreach ($guids as $guid) {
// don't regenerate the simplecache because the plugin won't be
// loaded until next run. Just invalidate and let it regnerate as needed
elgg_invalidate_simplecache();
-elgg_filepath_cache_reset();
+elgg_reset_system_cache();
forward(REFERER); \ No newline at end of file
diff --git a/actions/admin/plugins/deactivate.php b/actions/admin/plugins/deactivate.php
index 2ce796eff..e7ce65625 100644
--- a/actions/admin/plugins/deactivate.php
+++ b/actions/admin/plugins/deactivate.php
@@ -37,7 +37,7 @@ foreach ($plugin_guids as $guid) {
// don't regenerate the simplecache because the plugin won't be
// loaded until next run. Just invalidate and let it regnerate as needed
elgg_invalidate_simplecache();
-elgg_filepath_cache_reset();
+elgg_reset_system_cache();
if (count($plugin_guids) == 1) {
$url = 'admin/plugins';
diff --git a/actions/admin/plugins/deactivate_all.php b/actions/admin/plugins/deactivate_all.php
index 479e9c607..8b347a633 100644
--- a/actions/admin/plugins/deactivate_all.php
+++ b/actions/admin/plugins/deactivate_all.php
@@ -28,6 +28,6 @@ foreach ($guids as $guid) {
// don't regenerate the simplecache because the plugin won't be
// loaded until next run. Just invalidate and let it regnerate as needed
elgg_invalidate_simplecache();
-elgg_filepath_cache_reset();
+elgg_reset_system_cache();
forward(REFERER);
diff --git a/actions/admin/plugins/set_priority.php b/actions/admin/plugins/set_priority.php
index 79b1c4c53..edd735371 100644
--- a/actions/admin/plugins/set_priority.php
+++ b/actions/admin/plugins/set_priority.php
@@ -34,6 +34,6 @@ if ($plugin->setPriority($priority)) {
// don't regenerate the simplecache because the plugin won't be
// loaded until next run. Just invalidate and let it regnerate as needed
elgg_invalidate_simplecache();
-elgg_filepath_cache_reset();
+elgg_reset_system_cache();
forward(REFERER); \ No newline at end of file
diff --git a/actions/admin/site/flush_cache.php b/actions/admin/site/flush_cache.php
index b81f5fc83..ebb8296c7 100644
--- a/actions/admin/site/flush_cache.php
+++ b/actions/admin/site/flush_cache.php
@@ -4,7 +4,7 @@
*/
elgg_invalidate_simplecache();
-elgg_filepath_cache_reset();
+elgg_reset_system_cache();
system_message(elgg_echo('admin:cache:flushed'));
forward(REFERER); \ No newline at end of file
diff --git a/actions/admin/site/update_advanced.php b/actions/admin/site/update_advanced.php
index 7d57f78ea..897a2f983 100644
--- a/actions/admin/site/update_advanced.php
+++ b/actions/admin/site/update_advanced.php
@@ -9,8 +9,7 @@
* @subpackage Administration.Site
*/
-if (datalist_get('default_site')) {
- $site = get_entity(datalist_get('default_site'));
+if ($site = elgg_get_site_entity()) {
if (!($site instanceof ElggSite)) {
throw new InstallationException(elgg_echo('InvalidParameterException:NonElggSite'));
}
@@ -18,7 +17,24 @@ if (datalist_get('default_site')) {
$site->url = get_input('wwwroot');
datalist_set('path', sanitise_filepath(get_input('path')));
- datalist_set('dataroot', sanitise_filepath(get_input('dataroot')));
+ $dataroot = sanitise_filepath(get_input('dataroot'));
+
+ // check for relative paths
+ if (stripos(PHP_OS, 'win') === 0) {
+ if (strpos($dataroot, ':') !== 1) {
+ $msg = elgg_echo('admin:configuration:dataroot:relative_path', array($dataroot));
+ register_error($msg);
+ forward(REFERER);
+ }
+ } else {
+ if (strpos($dataroot, '/') !== 0) {
+ $msg = elgg_echo('admin:configuration:dataroot:relative_path', array($dataroot));
+ register_error($msg);
+ forward(REFERER);
+ }
+ }
+
+ datalist_set('dataroot', $dataroot);
if (get_input('simplecache_enabled')) {
elgg_enable_simplecache();
@@ -26,10 +42,10 @@ if (datalist_get('default_site')) {
elgg_disable_simplecache();
}
- if (get_input('viewpath_cache_enabled')) {
- elgg_enable_filepath_cache();
+ if (get_input('system_cache_enabled')) {
+ elgg_enable_system_cache();
} else {
- elgg_disable_filepath_cache();
+ elgg_disable_system_cache();
}
set_config('default_access', get_input('default_access', ACCESS_PRIVATE), $site->getGUID());
diff --git a/actions/admin/site/update_basic.php b/actions/admin/site/update_basic.php
index 45f00a20d..97d258b65 100644
--- a/actions/admin/site/update_basic.php
+++ b/actions/admin/site/update_basic.php
@@ -10,8 +10,7 @@
* @subpackage Administration.Site
*/
-if (datalist_get('default_site')) {
- $site = get_entity(datalist_get('default_site'));
+if ($site = elgg_get_site_entity()) {
if (!($site instanceof ElggSite)) {
throw new InstallationException(elgg_echo('InvalidParameterException:NonElggSite'));
}
diff --git a/actions/avatar/crop.php b/actions/avatar/crop.php
index 6d71b6f06..b9a80f331 100644
--- a/actions/avatar/crop.php
+++ b/actions/avatar/crop.php
@@ -22,6 +22,12 @@ $filehandler->owner_guid = $owner->getGUID();
$filehandler->setFilename("profile/" . $owner->guid . "master" . ".jpg");
$filename = $filehandler->getFilenameOnFilestore();
+// ensuring the avatar image exists in the first place
+if (!file_exists($filename)) {
+ register_error(elgg_echo('avatar:crop:fail'));
+ forward(REFERER);
+}
+
$icon_sizes = elgg_get_config('icon_sizes');
unset($icon_sizes['master']);
@@ -46,7 +52,7 @@ foreach ($icon_sizes as $name => $size_info) {
$file->delete();
}
- system_message(elgg_echo('avatar:resize:fail'));
+ register_error(elgg_echo('avatar:resize:fail'));
forward(REFERER);
}
}
diff --git a/actions/avatar/remove.php b/actions/avatar/remove.php
new file mode 100644
index 000000000..cd38e456a
--- /dev/null
+++ b/actions/avatar/remove.php
@@ -0,0 +1,34 @@
+<?php
+/**
+ * Avatar remove action
+ */
+
+$guid = get_input('guid');
+$user = get_entity($guid);
+if ($user) {
+ // Delete all icons from diskspace
+ $icon_sizes = elgg_get_config('icon_sizes');
+ foreach ($icon_sizes as $name => $size_info) {
+ $file = new ElggFile();
+ $file->owner_guid = $guid;
+ $file->setFilename("profile/{$guid}{$name}.jpg");
+ $filepath = $file->getFilenameOnFilestore();
+ if (!$file->delete()) {
+ elgg_log("Avatar file remove failed. Remove $filepath manually, please.", 'WARNING');
+ }
+ }
+
+ // Remove crop coords
+ unset($user->x1);
+ unset($user->x2);
+ unset($user->y1);
+ unset($user->y2);
+
+ // Remove icon
+ unset($user->icontime);
+ system_message(elgg_echo('avatar:remove:success'));
+} else {
+ register_error(elgg_echo('avatar:remove:fail'));
+}
+
+forward(REFERER);
diff --git a/actions/comments/delete.php b/actions/comments/delete.php
index f8458a152..f2c058ff4 100644
--- a/actions/comments/delete.php
+++ b/actions/comments/delete.php
@@ -12,19 +12,12 @@ if (!elgg_is_logged_in()) {
// Make sure we can get the comment in question
$annotation_id = (int) get_input('annotation_id');
-if ($comment = elgg_get_annotation_from_id($annotation_id)) {
-
- $entity = get_entity($comment->entity_guid);
-
- if ($comment->canEdit()) {
- $comment->delete();
- system_message(elgg_echo("generic_comment:deleted"));
- forward($entity->getURL());
- }
-
+$comment = elgg_get_annotation_from_id($annotation_id);
+if ($comment && $comment->canEdit()) {
+ $comment->delete();
+ system_message(elgg_echo("generic_comment:deleted"));
} else {
- $url = "";
+ register_error(elgg_echo("generic_comment:notdeleted"));
}
-register_error(elgg_echo("generic_comment:notdeleted"));
forward(REFERER); \ No newline at end of file
diff --git a/actions/friends/add.php b/actions/friends/add.php
index 7d38674c1..d1800ee14 100644
--- a/actions/friends/add.php
+++ b/actions/friends/add.php
@@ -9,6 +9,10 @@
// Get the GUID of the user to friend
$friend_guid = get_input('friend');
$friend = get_entity($friend_guid);
+if (!$friend) {
+ register_error(elgg_echo('error:missing_data'));
+ forward(REFERER);
+}
$errors = false;
diff --git a/actions/login.php b/actions/login.php
index c717faadd..ea7fb3508 100644
--- a/actions/login.php
+++ b/actions/login.php
@@ -18,9 +18,9 @@ if (isset($_SESSION['last_forward_from']) && $_SESSION['last_forward_from']) {
}
$username = get_input('username');
-$password = get_input("password");
-$persistent = get_input("persistent", FALSE);
-$result = FALSE;
+$password = get_input('password', null, false);
+$persistent = get_input("persistent", false);
+$result = false;
if (empty($username) || empty($password)) {
register_error(elgg_echo('login:empty'));
@@ -28,7 +28,7 @@ if (empty($username) || empty($password)) {
}
// check if logging in with email address
-if (strpos($username, '@') !== FALSE && ($users = get_user_by_email($username))) {
+if (strpos($username, '@') !== false && ($users = get_user_by_email($username))) {
$username = $users[0]->username;
}
@@ -46,10 +46,21 @@ if (!$user) {
try {
login($user, $persistent);
+ // re-register at least the core language file for users with language other than site default
+ register_translations(dirname(dirname(__FILE__)) . "/languages/");
} catch (LoginException $e) {
register_error($e->getMessage());
forward(REFERER);
}
-system_message(elgg_echo('loginok'));
+// elgg_echo() caches the language and does not provide a way to change the language.
+// @todo we need to use the config object to store this so that the current language
+// can be changed. Refs #4171
+if ($user->language) {
+ $message = elgg_echo('loginok', array(), $user->language);
+} else {
+ $message = elgg_echo('loginok');
+}
+
+system_message($message);
forward($forward_url);
diff --git a/actions/profile/fields/add.php b/actions/profile/fields/add.php
index b35df1549..fce783092 100644
--- a/actions/profile/fields/add.php
+++ b/actions/profile/fields/add.php
@@ -2,7 +2,6 @@
/**
* Elgg profile plugin edit default profile action
*
- * @package ElggProfile
*/
$label = get_input('label');
diff --git a/actions/profile/fields/delete.php b/actions/profile/fields/delete.php
index 26ab48cba..9879feb3f 100644
--- a/actions/profile/fields/delete.php
+++ b/actions/profile/fields/delete.php
@@ -2,7 +2,6 @@
/**
* Elgg profile plugin edit default profile action removal
*
- * @package ElggProfile
*/
$id = get_input('id');
diff --git a/actions/profile/fields/reorder.php b/actions/profile/fields/reorder.php
index dd7a682a6..27c716749 100644
--- a/actions/profile/fields/reorder.php
+++ b/actions/profile/fields/reorder.php
@@ -2,11 +2,11 @@
/**
* Elgg profile plugin reorder fields
*
- * @package ElggProfile
*/
$ordering = get_input('fieldorder');
$result = elgg_save_config('profile_custom_fields', $ordering);
-exit; \ No newline at end of file
+// called by ajax so we exit
+exit;
diff --git a/actions/register.php b/actions/register.php
index 360b7cb4b..f23d5b381 100644
--- a/actions/register.php
+++ b/actions/register.php
@@ -10,8 +10,8 @@ elgg_make_sticky_form('register');
// Get variables
$username = get_input('username');
-$password = get_input('password');
-$password2 = get_input('password2');
+$password = get_input('password', null, false);
+$password2 = get_input('password2', null, false);
$email = get_input('email');
$name = get_input('name');
$friend_guid = (int) get_input('friend_guid', 0);
diff --git a/actions/useradd.php b/actions/useradd.php
index fdcd7e438..17459021b 100644
--- a/actions/useradd.php
+++ b/actions/useradd.php
@@ -10,8 +10,8 @@ elgg_make_sticky_form('useradd');
// Get variables
$username = get_input('username');
-$password = get_input('password');
-$password2 = get_input('password2');
+$password = get_input('password', null, false);
+$password2 = get_input('password2', null, false);
$email = get_input('email');
$name = get_input('name');
diff --git a/documentation/examples/plugins/start.php b/documentation/examples/plugins/start.php
index ea1e894b2..3af50ce38 100644
--- a/documentation/examples/plugins/start.php
+++ b/documentation/examples/plugins/start.php
@@ -8,5 +8,15 @@ elgg_register_event_handler('init', 'system', 'my_plugin_init');
function my_plugin_init() {
// Rename this function based on the name of your plugin and update the
// elgg_register_event_handler() call accordingly
-
+
+ // Register a script to handle (usually) a POST request (an action)
+ $base_dir = elgg_get_plugins_path() . 'my_plugin/actions/my_plugin';
+ elgg_register_action('my_plugin', "$base_dir/my_action.php");
+
+ // Extend the main CSS file
+ elgg_extend_view('css/elgg', 'my_plugin/css');
+
+ // Add a menu item to the main site menu
+ $item = new ElggMenuItem('my_plugin', elgg_echo('my_plugin:menu'), 'my_url');
+ elgg_register_menu_item('site', $item);
}
diff --git a/documentation/info/config.php b/documentation/info/config.php
index 19e76c8ae..b45428477 100644
--- a/documentation/info/config.php
+++ b/documentation/info/config.php
@@ -218,11 +218,11 @@ $CONFIG->dataroot;
$CONFIG->simplecache_enabled;
/**
- * Is view paths cache enabled
+ * Is the system cache enabled
*
- * @global string $CONFIG->viewpath_cache_enabled
+ * @global string $CONFIG->system_cache_enabled
*/
-$CONFIG->viewpath_cache_enabled;
+$CONFIG->system_cache_enabled;
/**
* The site description from the current site object.
diff --git a/engine/classes/ElggBatch.php b/engine/classes/ElggBatch.php
index 62128e34f..c1a77a0d9 100644
--- a/engine/classes/ElggBatch.php
+++ b/engine/classes/ElggBatch.php
@@ -3,47 +3,51 @@
* Efficiently run operations on batches of results for any function
* that supports an options array.
*
- * This is usually used with elgg_get_entities() and friends, elgg_get_annotations()
- * and elgg_get_metadata().
+ * This is usually used with elgg_get_entities() and friends,
+ * elgg_get_annotations(), and elgg_get_metadata().
*
- * If you pass a valid PHP callback, all results will be run through that callback.
- * You can still foreach() through the result set after. Valid PHP callbacks
- * can be a string, an array, or a closure.
+ * If you pass a valid PHP callback, all results will be run through that
+ * callback. You can still foreach() through the result set after. Valid
+ * PHP callbacks can be a string, an array, or a closure.
* {@link http://php.net/manual/en/language.pseudo-types.php}
*
- * The callback function must accept 3 arguments: an entity, the getter used, and the options used.
+ * The callback function must accept 3 arguments: an entity, the getter
+ * used, and the options used.
*
- * Results from the callback are stored in callbackResult.
- * If the callback returns only booleans, callbackResults will be the combined
- * result of all calls.
+ * Results from the callback are stored in callbackResult. If the callback
+ * returns only booleans, callbackResults will be the combined result of
+ * all calls. If no entities are processed, callbackResults will be null.
*
- * If the callback returns anything else, callbackresult will be an indexed array
- * of whatever the callback returns. If returning error handling information,
- * you should include enough information to determine which result you're referring
- * to.
+ * If the callback returns anything else, callbackresult will be an indexed
+ * array of whatever the callback returns. If returning error handling
+ * information, you should include enough information to determine which
+ * result you're referring to.
*
* Don't combine returning bools and returning something else.
*
* Note that returning false will not stop the foreach.
*
+ * @warning If your callback or foreach loop deletes or disable entities
+ * you MUST call setIncrementOffset(false) or set that when instantiating.
+ * This forces the offset to stay what it was in the $options array.
+ *
* @example
* <code>
+ * // using foreach
* $batch = new ElggBatch('elgg_get_entities', array());
+ * $batch->setIncrementOffset(false);
*
* foreach ($batch as $entity) {
* $entity->disable();
* }
*
+ * // using both a callback
* $callback = function($result, $getter, $options) {
- * var_dump("Going to delete annotation id: $result->id");
+ * var_dump("Looking at annotation id: $result->id");
* return true;
* }
*
* $batch = new ElggBatch('elgg_get_annotations', array('guid' => 2), $callback);
- *
- * foreach ($batch as $annotation) {
- * $annotation->delete();
- * }
* </code>
*
* @package Elgg.Core
@@ -92,7 +96,7 @@ class ElggBatch
/**
* Stop after this many results.
*
- * @var unknown_type
+ * @var int
*/
private $limit = 0;
@@ -139,6 +143,13 @@ class ElggBatch
public $callbackResult = null;
/**
+ * If false, offset will not be incremented. This is used for callbacks/loops that delete.
+ *
+ * @var bool
+ */
+ private $incrementOffset = true;
+
+ /**
* Batches operations on any elgg_get_*() or compatible function that supports
* an options array.
*
@@ -147,19 +158,27 @@ class ElggBatch
*
* @param string $getter The function used to get objects. Usually
* an elgg_get_*() function, but can be any valid PHP callback.
- * @param array $options The options array to pass to the getter function
+ * @param array $options The options array to pass to the getter function. If limit is
+ * not set, 10 is used as the default. In most cases that is not
+ * what you want.
* @param mixed $callback An optional callback function that all results will be passed
* to upon load. The callback needs to accept $result, $getter,
* $options.
* @param int $chunk_size The number of entities to pull in before requesting more.
* You have to balance this between running out of memory in PHP
* and hitting the db server too often.
+ * @param bool $inc_offset Increment the offset on each fetch. This must be false for
+ * callbacks that delete rows. You can set this after the
+ * object is created with {@see ElggBatch::setIncrementOffset()}.
*/
- public function __construct($getter, $options, $callback = null, $chunk_size = 25) {
+ public function __construct($getter, $options, $callback = null, $chunk_size = 25,
+ $inc_offset = true) {
+
$this->getter = $getter;
$this->options = $options;
$this->callback = $callback;
$this->chunkSize = $chunk_size;
+ $this->setIncrementOffset($inc_offset);
if ($this->chunkSize <= 0) {
$this->chunkSize = 25;
@@ -172,7 +191,7 @@ class ElggBatch
// if passed a callback, create a new ElggBatch with the same options
// and pass each to the callback.
if ($callback && is_callable($callback)) {
- $batch = new ElggBatch($getter, $options, null, $chunk_size);
+ $batch = new ElggBatch($getter, $options, null, $chunk_size, $inc_offset);
$all_results = null;
@@ -234,20 +253,24 @@ class ElggBatch
}
// if original limit < chunk size, set limit to original limit
+ // else if the number of results we'll fetch if greater than the original limit
if ($this->limit < $this->chunkSize) {
$limit = $this->limit;
- }
-
- // if the number of results we'll fetch is greater than the original limit,
- // set the limit to the number of results remaining in the original limit
- elseif ($this->retrievedResults + $this->chunkSize > $this->limit) {
+ } elseif ($this->retrievedResults + $this->chunkSize > $this->limit) {
+ // set the limit to the number of results remaining in the original limit
$limit = $this->limit - $this->retrievedResults;
}
}
+ if ($this->incrementOffset) {
+ $offset = $this->offset + $this->retrievedResults;
+ } else {
+ $offset = $this->offset;
+ }
+
$current_options = array(
'limit' => $limit,
- 'offset' => $this->offset + $this->retrievedResults
+ 'offset' => $offset
);
$options = array_merge($this->options, $current_options);
@@ -270,6 +293,16 @@ class ElggBatch
}
/**
+ * Increment the offset from the original options array? Setting to
+ * false is required for callbacks that delete rows.
+ *
+ * @param bool $increment
+ */
+ public function setIncrementOffset($increment = true) {
+ $this->incrementOffset = (bool) $increment;
+ }
+
+ /**
* Implements Iterator
*/
@@ -319,13 +352,13 @@ class ElggBatch
*/
public function next() {
// if we'll be at the end.
- if ($this->processedResults + 1 >= $this->limit && $this->limit > 0) {
+ if (($this->processedResults + 1) >= $this->limit && $this->limit > 0) {
$this->results = array();
return false;
}
// if we'll need new results.
- if ($this->resultIndex + 1 >= $this->chunkSize) {
+ if (($this->resultIndex + 1) >= $this->chunkSize) {
if (!$this->getNextResultsChunk()) {
$this->results = array();
return false;
@@ -356,4 +389,4 @@ class ElggBatch
$key = key($this->results);
return ($key !== NULL && $key !== FALSE);
}
-} \ No newline at end of file
+}
diff --git a/engine/classes/ElggCache.php b/engine/classes/ElggCache.php
index 5c2cafcb7..4317f4be9 100644
--- a/engine/classes/ElggCache.php
+++ b/engine/classes/ElggCache.php
@@ -29,7 +29,7 @@ abstract class ElggCache implements ArrayAccess {
*
* @return void
*
- * @deprecated 1.8 Use ElggAccess:setVariable()
+ * @deprecated 1.8 Use ElggCache:setVariable()
*/
public function set_variable($variable, $value) {
elgg_deprecated_notice('ElggCache::set_variable() is deprecated by ElggCache::setVariable()', 1.8);
@@ -191,8 +191,8 @@ abstract class ElggCache implements ArrayAccess {
*
* @see ArrayAccess::offsetSet()
*
- * @param mixed $key The key (offset) to assign the value to.
- * @param mixed $value The value to set.
+ * @param mixed $key The key (offset) to assign the value to.
+ * @param mixed $value The value to set.
*
* @return void
*/
@@ -205,7 +205,7 @@ abstract class ElggCache implements ArrayAccess {
*
* @see ArrayAccess::offsetGet()
*
- * @param mixed $offset The key (offset) to retrieve.
+ * @param mixed $key The key (offset) to retrieve.
*
* @return mixed
*/
diff --git a/engine/classes/ElggDiskFilestore.php b/engine/classes/ElggDiskFilestore.php
index 11b2bd947..f00376481 100644
--- a/engine/classes/ElggDiskFilestore.php
+++ b/engine/classes/ElggDiskFilestore.php
@@ -205,7 +205,7 @@ class ElggDiskFilestore extends ElggFilestore {
$owner = elgg_get_logged_in_user_entity();
}
- if ((!$owner) || (!$owner->username)) {
+ if (!$owner) {
$msg = elgg_echo('InvalidParameterException:MissingOwner',
array($file->getFilename(), $file->guid));
throw new InvalidParameterException($msg);
diff --git a/engine/classes/ElggEntity.php b/engine/classes/ElggEntity.php
index df87082fe..77c2bbf4d 100644
--- a/engine/classes/ElggEntity.php
+++ b/engine/classes/ElggEntity.php
@@ -24,7 +24,6 @@
*
* @package Elgg.Core
* @subpackage DataModel.Entities
- * @link http://docs.elgg.org/DataModel/ElggEntity
*
* @property string $type object, user, group, or site (read-only after save)
* @property string $subtype Further clarifies the nature of the entity (read-only after save)
@@ -201,8 +200,11 @@ abstract class ElggEntity extends ElggData implements
/**
* Sets the value of a property.
*
- * If $name is defined in $this->attributes that value is set, otherwise it will
- * set the appropriate item of metadata.
+ * If $name is defined in $this->attributes that value is set, otherwise it is
+ * saved as metadata.
+ *
+ * @warning Metadata set this way will inherit the entity's owner and access ID. If you want
+ * to set metadata with a different owner, use create_metadata().
*
* @warning It is important that your class populates $this->attributes with keys
* for all base attributes, anything not in their gets set as METADATA.
@@ -248,7 +250,12 @@ abstract class ElggEntity extends ElggData implements
public function getMetaData($name) {
if ((int) ($this->guid) == 0) {
if (isset($this->temp_metadata[$name])) {
- return $this->temp_metadata[$name];
+ // md is returned as an array only if more than 1 entry
+ if (count($this->temp_metadata[$name]) == 1) {
+ return $this->temp_metadata[$name][0];
+ } else {
+ return $this->temp_metadata[$name];
+ }
} else {
return null;
}
@@ -291,80 +298,78 @@ abstract class ElggEntity extends ElggData implements
/**
* Set a piece of metadata.
*
- * @tip Plugin authors should use the magic methods.
+ * Plugin authors should use the magic methods or create_metadata().
+ *
+ * @warning The metadata will inherit the parent entity's owner and access ID.
+ * If you want to write metadata with a different owner, use create_metadata().
*
* @access private
*
* @param string $name Name of the metadata
- * @param mixed $value Value of the metadata
+ * @param mixed $value Value of the metadata (doesn't support assoc arrays)
* @param string $value_type Types supported: integer and string. Will auto-identify if not set
* @param bool $multiple Allow multiple values for a single name (doesn't support assoc arrays)
*
* @return bool
*/
- public function setMetaData($name, $value, $value_type = "", $multiple = false) {
- $delete_first = false;
- // if multiple is set that always means don't delete.
- // if multiple isn't set it means override. set it to true on arrays for the foreach.
- if (!$multiple) {
- $delete_first = true;
- $multiple = is_array($value);
- }
-
- if (!$this->guid) {
- // real metadata only returns as an array if there are multiple elements
- if (is_array($value) && count($value) == 1) {
- $value = $value[0];
- }
-
- $value_is_array = is_array($value);
+ public function setMetaData($name, $value, $value_type = null, $multiple = false) {
- if (!isset($this->temp_metadata[$name]) || $delete_first) {
- // need to remove the indexes because real metadata doesn't have them.
- if ($value_is_array) {
- $this->temp_metadata[$name] = array_values($value);
- } else {
- $this->temp_metadata[$name] = $value;
- }
- } else {
- // multiple is always true at this point.
- // if we're setting multiple and temp isn't array, it needs to be.
- if (!is_array($this->temp_metadata[$name])) {
- $this->temp_metadata[$name] = array($this->temp_metadata[$name]);
- }
-
- if ($value_is_array) {
- $this->temp_metadata[$name] = array_merge($this->temp_metadata[$name], array_values($value));
- } else {
- $this->temp_metadata[$name][] = $value;
- }
- }
+ // normalize value to an array that we will loop over
+ // remove indexes if value already an array.
+ if (is_array($value)) {
+ $value = array_values($value);
} else {
- if ($delete_first) {
+ $value = array($value);
+ }
+
+ // saved entity. persist md to db.
+ if ($this->guid) {
+ // if overwriting, delete first.
+ if (!$multiple) {
$options = array(
'guid' => $this->getGUID(),
'metadata_name' => $name,
'limit' => 0
);
- // @todo this doesn't check if it exists so we can't handle failed deletes
- // is it worth the overhead of more SQL calls to check?
- elgg_delete_metadata($options);
- }
- // save into real metadata
- if (!is_array($value)) {
- $value = array($value);
+ // @todo in 1.9 make this return false if can't add metadata
+ // http://trac.elgg.org/ticket/4520
+ //
+ // need to remove access restrictions right now to delete
+ // because this is the expected behavior
+ $ia = elgg_set_ignore_access(true);
+ if (false === elgg_delete_metadata($options)) {
+ return false;
+ }
+ elgg_set_ignore_access($ia);
}
- foreach ($value as $v) {
- $result = create_metadata($this->getGUID(), $name, $v, $value_type,
- $this->getOwnerGUID(), $this->getAccessId(), $multiple);
- if (!$result) {
+ // add new md
+ $result = true;
+ foreach ($value as $value_tmp) {
+ // at this point $value should be appended because it was cleared above if needed.
+ $md_id = create_metadata($this->getGUID(), $name, $value_tmp, $value_type,
+ $this->getOwnerGUID(), $this->getAccessId(), true);
+ if (!$md_id) {
return false;
}
}
+
+ return $result;
}
- return true;
+ // unsaved entity. store in temp array
+ // returning single entries instead of an array of 1 element is decided in
+ // getMetaData(), just like pulling from the db.
+ else {
+ // if overwrite, delete first
+ if (!$multiple || !isset($this->temp_metadata[$name])) {
+ $this->temp_metadata[$name] = array();
+ }
+
+ // add new md
+ $this->temp_metadata[$name] = array_merge($this->temp_metadata[$name], $value);
+ return true;
+ }
}
/**
@@ -575,7 +580,6 @@ abstract class ElggEntity extends ElggData implements
* @param mixed $value Value of private setting
*
* @return bool
- * @link http://docs.elgg.org/DataModel/Entities/PrivateSettings
*/
function setPrivateSetting($name, $value) {
if ((int) $this->guid > 0) {
@@ -734,8 +738,6 @@ abstract class ElggEntity extends ElggData implements
* @param string $vartype The type of annotation value
*
* @return bool
- *
- * @link http://docs.elgg.org/DataModel/Annotations
*/
function annotate($name, $value, $access_id = ACCESS_PRIVATE, $owner_id = 0, $vartype = "") {
if ((int) $this->guid > 0) {
@@ -1311,12 +1313,16 @@ abstract class ElggEntity extends ElggData implements
/**
* Loads attributes from the entities table into the object.
*
- * @param int $guid GUID of Entity
+ * @param mixed $guid GUID of entity or stdClass object from entities table
*
* @return bool
*/
protected function load($guid) {
- $row = get_entity_as_row($guid);
+ if ($guid instanceof stdClass) {
+ $row = $guid;
+ } else {
+ $row = get_entity_as_row($guid);
+ }
if ($row) {
// Create the array if necessary - all subclasses should test before creating
@@ -1583,36 +1589,36 @@ abstract class ElggEntity extends ElggData implements
foreach ($this->attributes as $k => $v) {
$meta = NULL;
- if (in_array( $k, $exportable_values)) {
+ if (in_array($k, $exportable_values)) {
switch ($k) {
- case 'guid' : // Dont use guid in OpenDD
- case 'type' : // Type and subtype already taken care of
- case 'subtype' :
- break;
+ case 'guid': // Dont use guid in OpenDD
+ case 'type': // Type and subtype already taken care of
+ case 'subtype':
+ break;
- case 'time_created' : // Created = published
+ case 'time_created': // Created = published
$odd->setAttribute('published', date("r", $v));
- break;
+ break;
- case 'site_guid' : // Container
+ case 'site_guid': // Container
$k = 'site_uuid';
$v = guid_to_uuid($v);
$meta = new ODDMetaData($uuid . "attr/$k/", $uuid, $k, $v);
- break;
+ break;
- case 'container_guid' : // Container
+ case 'container_guid': // Container
$k = 'container_uuid';
$v = guid_to_uuid($v);
$meta = new ODDMetaData($uuid . "attr/$k/", $uuid, $k, $v);
- break;
+ break;
- case 'owner_guid' : // Convert owner guid to uuid, this will be stored in metadata
+ case 'owner_guid': // Convert owner guid to uuid, this will be stored in metadata
$k = 'owner_uuid';
$v = guid_to_uuid($v);
$meta = new ODDMetaData($uuid . "attr/$k/", $uuid, $k, $v);
- break;
+ break;
- default :
+ default:
$meta = new ODDMetaData($uuid . "attr/$k/", $uuid, $k, $v);
}
diff --git a/engine/classes/ElggExtender.php b/engine/classes/ElggExtender.php
index d6f79d18d..d94bad837 100644
--- a/engine/classes/ElggExtender.php
+++ b/engine/classes/ElggExtender.php
@@ -3,8 +3,7 @@
* The base class for ElggEntity extenders.
*
* Extenders allow you to attach extended information to an
- * ElggEntity. Core supports two: ElggAnnotation, ElggMetadata,
- * and ElggRelationship
+ * ElggEntity. Core supports two: ElggAnnotation and ElggMetadata.
*
* Saving the extender data to database is handled by the child class.
*
@@ -16,9 +15,24 @@
* @link http://docs.elgg.org/DataModel/Extenders
* @see ElggAnnotation
* @see ElggMetadata
+ *
+ * @property string $type annotation or metadata (read-only after save)
+ * @property int $id The unique identifier (read-only)
+ * @property int $entity_guid The GUID of the entity that this extender describes
+ * @property int $access_id Specifies the visibility level of this extender
+ * @property string $name The name of this extender
+ * @property mixed $value The value of the extender (int or string)
+ * @property int $time_created A UNIX timestamp of when the extender was created (read-only, set on first save)
*/
-abstract class ElggExtender extends ElggData
-{
+abstract class ElggExtender extends ElggData {
+
+ /**
+ * (non-PHPdoc)
+ *
+ * @see ElggData::initializeAttributes()
+ *
+ * @return void
+ */
protected function initializeAttributes() {
parent::initializeAttributes();
diff --git a/engine/classes/ElggFileCache.php b/engine/classes/ElggFileCache.php
index 8304372dc..34178d452 100644
--- a/engine/classes/ElggFileCache.php
+++ b/engine/classes/ElggFileCache.php
@@ -161,12 +161,25 @@ class ElggFileCache extends ElggCache {
}
/**
- * This was probably meant to delete everything?
+ * Delete all files in the directory of this file cache
*
* @return void
*/
public function clear() {
- // @todo writeme
+ $dir = $this->getVariable("cache_path");
+
+ $exclude = array(".", "..");
+
+ $files = scandir($dir);
+ if (!$files) {
+ return;
+ }
+
+ foreach ($files as $f) {
+ if (!in_array($f, $exclude)) {
+ unlink($dir . $f);
+ }
+ }
}
/**
@@ -184,7 +197,7 @@ class ElggFileCache extends ElggCache {
return;
}
- $exclude = array(".","..");
+ $exclude = array(".", "..");
$files = scandir($dir);
if (!$files) {
diff --git a/engine/classes/ElggGroup.php b/engine/classes/ElggGroup.php
index 0190e5eac..f7f67bf41 100644
--- a/engine/classes/ElggGroup.php
+++ b/engine/classes/ElggGroup.php
@@ -5,6 +5,9 @@
*
* @package Elgg.Core
* @subpackage Groups
+ *
+ * @property string $name A short name that captures the purpose of the group
+ * @property string $description A longer body of content that gives more details about the group
*/
class ElggGroup extends ElggEntity
implements Friendable {
@@ -26,12 +29,12 @@ class ElggGroup extends ElggEntity
}
/**
- * Construct a new user entity, optionally from a given id value.
+ * Construct a new group entity, optionally from a given guid value.
*
* @param mixed $guid If an int, load that GUID.
- * If a db row then will attempt to load the rest of the data.
+ * If an entity table db row, then will load the rest of the data.
*
- * @throws Exception if there was a problem creating the user.
+ * @throws Exception if there was a problem creating the group.
*/
function __construct($guid = null) {
$this->initializeAttributes();
@@ -40,15 +43,15 @@ class ElggGroup extends ElggEntity
$this->initialise_attributes(false);
if (!empty($guid)) {
- // Is $guid is a DB row - either a entity row, or a user table row.
+ // Is $guid is a entity table DB row
if ($guid instanceof stdClass) {
// Load the rest
- if (!$this->load($guid->guid)) {
+ if (!$this->load($guid)) {
$msg = elgg_echo('IOException:FailedToLoadGUID', array(get_class(), $guid->guid));
throw new IOException($msg);
}
- // Is $guid is an ElggGroup? Use a copy constructor
+ // Is $guid is an ElggGroup? Use a copy constructor
} else if ($guid instanceof ElggGroup) {
elgg_deprecated_notice('This type of usage of the ElggGroup constructor was deprecated. Please use the clone method.', 1.7);
@@ -56,11 +59,11 @@ class ElggGroup extends ElggEntity
$this->attributes[$key] = $value;
}
- // Is this is an ElggEntity but not an ElggGroup = ERROR!
+ // Is this is an ElggEntity but not an ElggGroup = ERROR!
} else if ($guid instanceof ElggEntity) {
throw new InvalidParameterException(elgg_echo('InvalidParameterException:NonElggGroup'));
- // We assume if we have got this far, $guid is an int
+ // Is it a GUID
} else if (is_numeric($guid)) {
if (!$this->load($guid)) {
throw new IOException(elgg_echo('IOException:FailedToLoadGUID', array(get_class(), $guid)));
@@ -316,11 +319,9 @@ class ElggGroup extends ElggEntity
}
/**
- * Override the load function.
- * This function will ensure that all data is loaded (were possible), so
- * if only part of the ElggGroup is loaded, it'll load the rest.
+ * Load the ElggGroup data from the database
*
- * @param int $guid GUID of an ElggGroup entity
+ * @param mixed $guid GUID of an ElggGroup entity or database row from entity table
*
* @return bool
*/
@@ -330,6 +331,11 @@ class ElggGroup extends ElggEntity
return false;
}
+ // Only work with GUID from here
+ if ($guid instanceof stdClass) {
+ $guid = $guid->guid;
+ }
+
// Check the type
if ($this->attributes['type'] != 'group') {
$msg = elgg_echo('InvalidClassException:NotValidElggStar', array($guid, get_class()));
diff --git a/engine/classes/ElggMemcache.php b/engine/classes/ElggMemcache.php
index a54c29723..f27b017d0 100644
--- a/engine/classes/ElggMemcache.php
+++ b/engine/classes/ElggMemcache.php
@@ -114,27 +114,11 @@ class ElggMemcache extends ElggSharedMemoryCache {
* Combine a key with the namespace.
* Memcache can only accept <250 char key. If the given key is too long it is shortened.
*
- * @deprecated 1.8 Use ElggMemcache::_makeMemcacheKey()
- *
- * @param string $key The key
- *
- * @return string The new key.
- */
- private function make_memcache_key($key) {
- elgg_deprecated_notice('ElggMemcache::make_memcache_key() is deprecated by ::_makeMemcacheKey()', 1.8);
-
- return $this->_makeMemcacheKey($key);
- }
-
- /**
- * Combine a key with the namespace.
- * Memcache can only accept <250 char key. If the given key is too long it is shortened.
- *
* @param string $key The key
*
* @return string The new key.
*/
- private function _makeMemcacheKey($key) {
+ private function makeMemcacheKey($key) {
$prefix = $this->getNamespace() . ":";
if (strlen($prefix . $key) > 250) {
@@ -154,7 +138,7 @@ class ElggMemcache extends ElggSharedMemoryCache {
* @return bool
*/
public function save($key, $data, $expires = null) {
- $key = $this->_makeMemcacheKey($key);
+ $key = $this->makeMemcacheKey($key);
if ($expires === null) {
$expires = $this->expires;
@@ -178,7 +162,7 @@ class ElggMemcache extends ElggSharedMemoryCache {
* @return mixed
*/
public function load($key, $offset = 0, $limit = null) {
- $key = $this->_makeMemcacheKey($key);
+ $key = $this->makeMemcacheKey($key);
$result = $this->memcache->get($key);
if ($result === false) {
@@ -196,7 +180,7 @@ class ElggMemcache extends ElggSharedMemoryCache {
* @return bool
*/
public function delete($key) {
- $key = $this->_makeMemcacheKey($key);
+ $key = $this->makeMemcacheKey($key);
return $this->memcache->delete($key, 0);
}
diff --git a/engine/classes/ElggMenuBuilder.php b/engine/classes/ElggMenuBuilder.php
index cadfee7f5..de0017599 100644
--- a/engine/classes/ElggMenuBuilder.php
+++ b/engine/classes/ElggMenuBuilder.php
@@ -4,8 +4,7 @@
*
* @package Elgg.Core
* @subpackage Navigation
- *
- * @since 1.8.0
+ * @since 1.8.0
*/
class ElggMenuBuilder {
@@ -16,16 +15,16 @@ class ElggMenuBuilder {
/**
* ElggMenuBuilder constructor
*
- * @param string $name Identifier of the menu
+ * @param array $menu Array of ElggMenuItem objects
*/
- public function __construct($menu) {
+ public function __construct(array $menu) {
$this->menu = $menu;
}
/**
* Get a prepared menu array
*
- * @param mixed $sort_by
+ * @param mixed $sort_by Method to sort the menu by. @see ElggMenuBuilder::sort()
* @return array
*/
public function getMenu($sort_by = 'text') {
@@ -80,6 +79,7 @@ class ElggMenuBuilder {
/**
* Group the menu items into sections
+ *
* @return void
*/
protected function setupSections() {
diff --git a/engine/classes/ElggMenuItem.php b/engine/classes/ElggMenuItem.php
index 62547134a..4bc9144d4 100644
--- a/engine/classes/ElggMenuItem.php
+++ b/engine/classes/ElggMenuItem.php
@@ -2,12 +2,11 @@
/**
* Elgg Menu Item
*
- * @package Elgg.Core
- * @subpackage Navigation
- *
* To create a menu item that is not a link, pass false for $href.
*
- * @since 1.8.0
+ * @package Elgg.Core
+ * @subpackage Navigation
+ * @since 1.8.0
*/
class ElggMenuItem {
@@ -70,9 +69,9 @@ class ElggMenuItem {
/**
* ElggMenuItem constructor
*
- * @param string $name Identifier of the menu item
- * @param string $text Display text of the menu item
- * @param string $href URL of the menu item (false if not a link)
+ * @param string $name Identifier of the menu item
+ * @param string $text Display text of the menu item
+ * @param string $href URL of the menu item (false if not a link)
*/
public function __construct($name, $text, $href) {
//$this->name = $name;
@@ -182,7 +181,7 @@ class ElggMenuItem {
/**
* Set the identifier of the menu item
*
- * @param string Unique identifier
+ * @param string $name Unique identifier
* @return void
*/
public function setName($name) {
@@ -491,7 +490,7 @@ class ElggMenuItem {
/**
* Set the parent menu item
*
- * @param ElggMenuItem $parent
+ * @param ElggMenuItem $parent The parent of this menu item
* @return void
*/
public function setParent($parent) {
@@ -510,7 +509,7 @@ class ElggMenuItem {
/**
* Add a child menu item
*
- * @param ElggMenuItem $item
+ * @param ElggMenuItem $item A child menu item
* @return void
*/
public function addChild($item) {
@@ -549,9 +548,8 @@ class ElggMenuItem {
/**
* Get the menu item content (usually a link)
*
- * @params array $vars Options to pass to output/url if a link
+ * @param array $vars Options to pass to output/url if a link
* @return string
- *
* @todo View code in a model. How do we feel about that?
*/
public function getContent(array $vars = array()) {
diff --git a/engine/classes/ElggMetadata.php b/engine/classes/ElggMetadata.php
index 32e7b32f1..634a122e5 100644
--- a/engine/classes/ElggMetadata.php
+++ b/engine/classes/ElggMetadata.php
@@ -9,6 +9,13 @@
*/
class ElggMetadata extends ElggExtender {
+ /**
+ * (non-PHPdoc)
+ *
+ * @see ElggData::initializeAttributes()
+ *
+ * @return void
+ */
protected function initializeAttributes() {
parent::initializeAttributes();
diff --git a/engine/classes/ElggObject.php b/engine/classes/ElggObject.php
index 0b8340697..b4bae6825 100644
--- a/engine/classes/ElggObject.php
+++ b/engine/classes/ElggObject.php
@@ -14,6 +14,10 @@
*
* @package Elgg.Core
* @subpackage DataModel.Object
+ *
+ * @property string $title The title, name, or summary of this object
+ * @property string $description The body, description, or content of the object
+ * @property array $tags Array of tags that describe the object
*/
class ElggObject extends ElggEntity {
@@ -37,12 +41,12 @@ class ElggObject extends ElggEntity {
*
* If no arguments are passed, create a new entity.
*
- * If an argument is passed attempt to load a full Object entity. Arguments
- * can be:
+ * If an argument is passed, attempt to load a full ElggObject entity.
+ * Arguments can be:
* - The GUID of an object entity.
- * - A DB result object with a guid property
+ * - A DB result object from the entities table with a guid property
*
- * @param mixed $guid If an int, load that GUID. If a db row then will attempt to
+ * @param mixed $guid If an int, load that GUID. If a db row, then will attempt to
* load the rest of the data.
*
* @throws IOException If passed an incorrect guid
@@ -55,15 +59,15 @@ class ElggObject extends ElggEntity {
$this->initialise_attributes(false);
if (!empty($guid)) {
- // Is $guid is a DB row - either a entity row, or a object table row.
+ // Is $guid is a DB row from the entity table
if ($guid instanceof stdClass) {
// Load the rest
- if (!$this->load($guid->guid)) {
+ if (!$this->load($guid)) {
$msg = elgg_echo('IOException:FailedToLoadGUID', array(get_class(), $guid->guid));
throw new IOException($msg);
}
- // Is $guid is an ElggObject? Use a copy constructor
+ // Is $guid is an ElggObject? Use a copy constructor
} else if ($guid instanceof ElggObject) {
elgg_deprecated_notice('This type of usage of the ElggObject constructor was deprecated. Please use the clone method.', 1.7);
@@ -71,11 +75,11 @@ class ElggObject extends ElggEntity {
$this->attributes[$key] = $value;
}
- // Is this is an ElggEntity but not an ElggObject = ERROR!
+ // Is this is an ElggEntity but not an ElggObject = ERROR!
} else if ($guid instanceof ElggEntity) {
throw new InvalidParameterException(elgg_echo('InvalidParameterException:NonElggObject'));
- // We assume if we have got this far, $guid is an int
+ // Is it a GUID
} else if (is_numeric($guid)) {
if (!$this->load($guid)) {
throw new IOException(elgg_echo('IOException:FailedToLoadGUID', array(get_class(), $guid)));
@@ -89,17 +93,22 @@ class ElggObject extends ElggEntity {
/**
* Loads the full ElggObject when given a guid.
*
- * @param int $guid Guid of an ElggObject
+ * @param mixed $guid GUID of an ElggObject or the stdClass object from entities table
*
* @return bool
* @throws InvalidClassException
*/
protected function load($guid) {
- // Test to see if we have the generic stuff
+ // Load data from entity table if needed
if (!parent::load($guid)) {
return false;
}
+ // Only work with GUID from here
+ if ($guid instanceof stdClass) {
+ $guid = $guid->guid;
+ }
+
// Check the type
if ($this->attributes['type'] != 'object') {
$msg = elgg_echo('InvalidClassException:NotValidElggStar', array($guid, get_class()));
diff --git a/engine/classes/ElggPlugin.php b/engine/classes/ElggPlugin.php
index c4d6ec034..8c9093834 100644
--- a/engine/classes/ElggPlugin.php
+++ b/engine/classes/ElggPlugin.php
@@ -79,6 +79,68 @@ class ElggPlugin extends ElggObject {
}
/**
+ * Overridden from ElggEntity and ElggObject::load(). Core always inits plugins with
+ * a query joined to the objects_entity table, so all the info is there.
+ *
+ * @param mixed $guid GUID of an ElggObject or the stdClass object from entities table
+ *
+ * @return bool
+ * @throws InvalidClassException
+ */
+ protected function load($guid) {
+
+ $expected_attributes = $this->attributes;
+ unset($expected_attributes['tables_split']);
+ unset($expected_attributes['tables_loaded']);
+
+ // this was loaded with a full join
+ $needs_loaded = false;
+
+ if ($guid instanceof stdClass) {
+ $row = (array) $guid;
+ $missing_attributes = array_diff_key($expected_attributes, $row);
+ if ($missing_attributes) {
+ $needs_loaded = true;
+ $old_guid = $guid;
+ $guid = $row['guid'];
+ } else {
+ $this->attributes = $row;
+ }
+ } else {
+ $needs_loaded = true;
+ }
+
+ if ($needs_loaded) {
+ $entity = (array) get_entity_as_row($guid);
+ $object = (array) get_object_entity_as_row($guid);
+
+ if (!$entity || !$object) {
+ return false;
+ }
+
+ $this->attributes = array_merge($this->attributes, $entity, $object);
+ }
+
+ $this->attributes['tables_loaded'] = 2;
+
+ // Check the type
+ if ($this->attributes['type'] != 'object') {
+ $msg = elgg_echo('InvalidClassException:NotValidElggStar', array($guid, get_class()));
+ throw new InvalidClassException($msg);
+ }
+
+ // guid needs to be an int http://trac.elgg.org/ticket/4111
+ $this->attributes['guid'] = (int)$this->attributes['guid'];
+
+ // cache the entity
+ if ($this->attributes['guid']) {
+ cache_entity($this);
+ }
+
+ return true;
+ }
+
+ /**
* Save the plugin object. Make sure required values exist.
*
* @see ElggObject::save()
@@ -707,9 +769,9 @@ class ElggPlugin extends ElggObject {
* @throws PluginException
*/
public function start($flags) {
-// if (!$this->canActivate()) {
-// return false;
-// }
+ //if (!$this->canActivate()) {
+ // return false;
+ //}
// include classes
if ($flags & ELGG_PLUGIN_REGISTER_CLASSES) {
diff --git a/engine/classes/ElggPluginManifest.php b/engine/classes/ElggPluginManifest.php
index 7592eb667..7e79c15c8 100644
--- a/engine/classes/ElggPluginManifest.php
+++ b/engine/classes/ElggPluginManifest.php
@@ -319,12 +319,26 @@ class ElggPluginManifest {
* @return array
*/
public function getCategories() {
+ $bundled_plugins = array('blog', 'bookmarks', 'categories',
+ 'custom_index', 'dashboard', 'developers', 'diagnostics',
+ 'embed', 'externalpages', 'file', 'garbagecollector',
+ 'groups', 'htmlawed', 'invitefriends', 'likes',
+ 'logbrowser', 'logrotate', 'members', 'messageboard',
+ 'messages', 'notifications', 'oauth_api', 'pages', 'profile',
+ 'reportedcontent', 'search', 'tagcloud', 'thewire', 'tinymce',
+ 'twitter', 'twitter_api', 'uservalidationbyemail', 'zaudio',
+ );
+
$cats = $this->parser->getAttribute('category');
if (!$cats) {
$cats = array();
}
+ if (in_array('bundled', $cats) && !in_array($this->getPluginID(), $bundled_plugins)) {
+ unset($cats[array_search('bundled', $cats)]);
+ }
+
return $cats;
}
@@ -592,4 +606,23 @@ class ElggPluginManifest {
return $return;
}
+
+ /**
+ * Returns a category's friendly name. This can be localized by
+ * defining the string 'admin:plugins:category:<category>'. If no
+ * localization is found, returns the category with _ and - converted to ' '
+ * and then ucwords()'d.
+ *
+ * @param str $category The category as defined in the manifest.
+ * @return str A human-readable category
+ */
+ static public function getFriendlyCategory($category) {
+ $cat_raw_string = "admin:plugins:category:$category";
+ $cat_display_string = elgg_echo($cat_raw_string);
+ if ($cat_display_string == $cat_raw_string) {
+ $category = str_replace(array('-', '_'), ' ', $category);
+ $cat_display_string = ucwords($category);
+ }
+ return $cat_display_string;
+ }
}
diff --git a/engine/classes/ElggPluginPackage.php b/engine/classes/ElggPluginPackage.php
index d240af477..2dc4bdb3d 100644
--- a/engine/classes/ElggPluginPackage.php
+++ b/engine/classes/ElggPluginPackage.php
@@ -303,6 +303,8 @@ class ElggPluginPackage {
/**
* Returns an array of present and readable text files
+ *
+ * @return array
*/
public function getTextFilenames() {
return $this->textFiles;
diff --git a/engine/classes/ElggRelationship.php b/engine/classes/ElggRelationship.php
index 2d9a32cbd..efc0f7eff 100644
--- a/engine/classes/ElggRelationship.php
+++ b/engine/classes/ElggRelationship.php
@@ -4,6 +4,12 @@
*
* @package Elgg.Core
* @subpackage Core
+ *
+ * @property int $id The unique identifier (read-only)
+ * @property int $guid_one The GUID of the subject of the relationship
+ * @property string $relationship The name of the relationship
+ * @property int $guid_two The GUID of the object of the relationship
+ * @property int $time_created A UNIX timestamp of when the relationship was created (read-only, set on first save)
*/
class ElggRelationship extends ElggData implements
Importable
diff --git a/engine/classes/ElggRiverItem.php b/engine/classes/ElggRiverItem.php
index fcc8f9c85..d3d09cd91 100644
--- a/engine/classes/ElggRiverItem.php
+++ b/engine/classes/ElggRiverItem.php
@@ -4,9 +4,19 @@
*
* @package Elgg.Core
* @subpackage Core
+ *
+ * @property int $id The unique identifier (read-only)
+ * @property int $subject_guid The GUID of the actor
+ * @property int $object_guid The GUID of the object
+ * @property int $annotation_id The ID of the annotation involved in the action
+ * @property string $type The type of one of the entities involved in the action
+ * @property string $subtype The subtype of one of the entities involved in the action
+ * @property string $action_type The name of the action
+ * @property string $view The view for displaying this river item
+ * @property int $access_id The visibility of the river item
+ * @property int $posted UNIX timestamp when the action occurred
*/
-class ElggRiverItem
-{
+class ElggRiverItem {
public $id;
public $subject_guid;
public $object_guid;
diff --git a/engine/classes/ElggSite.php b/engine/classes/ElggSite.php
index 3ccb146fb..e793ab9c6 100644
--- a/engine/classes/ElggSite.php
+++ b/engine/classes/ElggSite.php
@@ -21,6 +21,10 @@
* @package Elgg.Core
* @subpackage DataMode.Site
* @link http://docs.elgg.org/DataModel/Sites
+ *
+ * @property string $name The name or title of the website
+ * @property string $description A motto, mission statement, or description of the website
+ * @property string $url The root web address for the site, including trailing slash
*/
class ElggSite extends ElggEntity {
@@ -53,8 +57,8 @@ class ElggSite extends ElggEntity {
* - A URL as stored in ElggSite->url
* - A DB result object with a guid property
*
- * @param mixed $guid If an int, load that GUID. If a db row then will attempt
- * to load the rest of the data.
+ * @param mixed $guid If an int, load that GUID. If a db row then will
+ * load the rest of the data.
*
* @throws IOException If passed an incorrect guid
* @throws InvalidParameterException If passed an Elgg* Entity that isn't an ElggSite
@@ -66,15 +70,15 @@ class ElggSite extends ElggEntity {
$this->initialise_attributes(false);
if (!empty($guid)) {
- // Is $guid is a DB row - either a entity row, or a site table row.
+ // Is $guid is a DB entity table row
if ($guid instanceof stdClass) {
// Load the rest
- if (!$this->load($guid->guid)) {
+ if (!$this->load($guid)) {
$msg = elgg_echo('IOException:FailedToLoadGUID', array(get_class(), $guid->guid));
throw new IOException($msg);
}
- // Is $guid is an ElggSite? Use a copy constructor
+ // Is $guid is an ElggSite? Use a copy constructor
} else if ($guid instanceof ElggSite) {
elgg_deprecated_notice('This type of usage of the ElggSite constructor was deprecated. Please use the clone method.', 1.7);
@@ -82,18 +86,18 @@ class ElggSite extends ElggEntity {
$this->attributes[$key] = $value;
}
- // Is this is an ElggEntity but not an ElggSite = ERROR!
+ // Is this is an ElggEntity but not an ElggSite = ERROR!
} else if ($guid instanceof ElggEntity) {
throw new InvalidParameterException(elgg_echo('InvalidParameterException:NonElggSite'));
- // See if this is a URL
+ // See if this is a URL
} else if (strpos($guid, "http") !== false) {
$guid = get_site_by_url($guid);
foreach ($guid->attributes as $key => $value) {
$this->attributes[$key] = $value;
}
- // We assume if we have got this far, $guid is an int
+ // Is it a GUID
} else if (is_numeric($guid)) {
if (!$this->load($guid)) {
throw new IOException(elgg_echo('IOException:FailedToLoadGUID', array(get_class(), $guid)));
@@ -107,7 +111,7 @@ class ElggSite extends ElggEntity {
/**
* Loads the full ElggSite when given a guid.
*
- * @param int $guid Guid of ElggSite entity
+ * @param mixed $guid GUID of ElggSite entity or database row object
*
* @return bool
* @throws InvalidClassException
@@ -118,6 +122,11 @@ class ElggSite extends ElggEntity {
return false;
}
+ // Only work with GUID from here
+ if ($guid instanceof stdClass) {
+ $guid = $guid->guid;
+ }
+
// Check the type
if ($this->attributes['type'] != 'site') {
$msg = elgg_echo('InvalidClassException:NotValidElggStar', array($guid, get_class()));
@@ -192,7 +201,7 @@ class ElggSite extends ElggEntity {
*
* @note You cannot disable the current site.
*
- * @param string $reason Optional reason for disabling
+ * @param string $reason Optional reason for disabling
* @param bool $recursive Recursively disable all contained entities?
*
* @return bool
@@ -215,7 +224,7 @@ class ElggSite extends ElggEntity {
* accepted by elgg_get_entities(). Common parameters
* include 'limit', and 'offset'.
* Note: this was $limit before version 1.8
- * @param int $offset Offset @deprecated parameter
+ * @param int $offset Offset @deprecated parameter
*
* @todo remove $offset in 2.0
*
@@ -231,6 +240,7 @@ class ElggSite extends ElggEntity {
}
$defaults = array(
+ 'site_guids' => ELGG_ENTITIES_ANY_VALUE,
'relationship' => 'member_of_site',
'relationship_guid' => $this->getGUID(),
'inverse_relationship' => TRUE,
@@ -254,6 +264,7 @@ class ElggSite extends ElggEntity {
*/
public function listMembers($options = array()) {
$defaults = array(
+ 'site_guids' => ELGG_ENTITIES_ANY_VALUE,
'relationship' => 'member_of_site',
'relationship_guid' => $this->getGUID(),
'inverse_relationship' => TRUE,
@@ -411,6 +422,8 @@ class ElggSite extends ElggEntity {
// default public pages
$defaults = array(
+ 'walled_garden/.*',
+ 'login',
'action/login',
'register',
'action/register',
@@ -427,6 +440,8 @@ class ElggSite extends ElggEntity {
'js/.*',
'cache/css/.*',
'cache/js/.*',
+ 'cron/.*',
+ 'services/.*',
);
// include a hook for plugin authors to include public pages
diff --git a/engine/classes/ElggUser.php b/engine/classes/ElggUser.php
index a1c7147a5..d7bb89265 100644
--- a/engine/classes/ElggUser.php
+++ b/engine/classes/ElggUser.php
@@ -6,6 +6,15 @@
*
* @package Elgg.Core
* @subpackage DataModel.User
+ *
+ * @property string $name The display name that the user will be known by in the network
+ * @property string $username The short, reference name for the user in the network
+ * @property string $email The email address to which Elgg will send email notifications
+ * @property string $language The language preference of the user (ISO 639-1 formatted)
+ * @property string $banned 'yes' if the user is banned from the network, 'no' otherwise
+ * @property string $admin 'yes' if the user is an administrator of the network, 'no' otherwise
+ * @property string $password The hashed password of the user
+ * @property string $salt The salt used to secure the password before hashing
*/
class ElggUser extends ElggEntity
implements Friendable {
@@ -38,7 +47,7 @@ class ElggUser extends ElggEntity
* Construct a new user entity, optionally from a given id value.
*
* @param mixed $guid If an int, load that GUID.
- * If a db row then will attempt to load the rest of the data.
+ * If an entity table db row then will load the rest of the data.
*
* @throws Exception if there was a problem creating the user.
*/
@@ -49,15 +58,15 @@ class ElggUser extends ElggEntity
$this->initialise_attributes(false);
if (!empty($guid)) {
- // Is $guid is a DB row - either a entity row, or a user table row.
+ // Is $guid is a DB entity row
if ($guid instanceof stdClass) {
// Load the rest
- if (!$this->load($guid->guid)) {
+ if (!$this->load($guid)) {
$msg = elgg_echo('IOException:FailedToLoadGUID', array(get_class(), $guid->guid));
throw new IOException($msg);
}
- // See if this is a username
+ // See if this is a username
} else if (is_string($guid)) {
$user = get_user_by_username($guid);
if ($user) {
@@ -66,7 +75,7 @@ class ElggUser extends ElggEntity
}
}
- // Is $guid is an ElggUser? Use a copy constructor
+ // Is $guid is an ElggUser? Use a copy constructor
} else if ($guid instanceof ElggUser) {
elgg_deprecated_notice('This type of usage of the ElggUser constructor was deprecated. Please use the clone method.', 1.7);
@@ -74,11 +83,11 @@ class ElggUser extends ElggEntity
$this->attributes[$key] = $value;
}
- // Is this is an ElggEntity but not an ElggUser = ERROR!
+ // Is this is an ElggEntity but not an ElggUser = ERROR!
} else if ($guid instanceof ElggEntity) {
throw new InvalidParameterException(elgg_echo('InvalidParameterException:NonElggUser'));
- // We assume if we have got this far, $guid is an int
+ // Is it a GUID
} else if (is_numeric($guid)) {
if (!$this->load($guid)) {
throw new IOException(elgg_echo('IOException:FailedToLoadGUID', array(get_class(), $guid)));
@@ -90,13 +99,11 @@ class ElggUser extends ElggEntity
}
/**
- * Override the load function.
- * This function will ensure that all data is loaded (were possible), so
- * if only part of the ElggUser is loaded, it'll load the rest.
+ * Load the ElggUser data from the database
*
- * @param int $guid ElggUser GUID
+ * @param mixed $guid ElggUser GUID or stdClass database row from entity table
*
- * @return true|false
+ * @return bool
*/
protected function load($guid) {
// Test to see if we have the generic stuff
@@ -104,6 +111,11 @@ class ElggUser extends ElggEntity
return false;
}
+ // Only work with GUID from here
+ if ($guid instanceof stdClass) {
+ $guid = $guid->guid;
+ }
+
// Check the type
if ($this->attributes['type'] != 'user') {
$msg = elgg_echo('InvalidClassException:NotValidElggStar', array($guid, get_class()));
@@ -132,7 +144,7 @@ class ElggUser extends ElggEntity
/**
* Saves this user to the database.
*
- * @return true|false
+ * @return bool
*/
public function save() {
// Save generic stuff
@@ -252,7 +264,7 @@ class ElggUser extends ElggEntity
* @param int $limit The number of results to return
* @param int $offset Any indexing offset
*
- * @return bool
+ * @return array
*/
function getSites($subtype = "", $limit = 10, $offset = 0) {
return get_user_sites($this->getGUID(), $subtype, $limit, $offset);
@@ -263,7 +275,7 @@ class ElggUser extends ElggEntity
*
* @param int $site_guid The guid of the site to add it to
*
- * @return true|false
+ * @return bool
*/
function addToSite($site_guid) {
return add_site_user($site_guid, $this->getGUID());
@@ -274,7 +286,7 @@ class ElggUser extends ElggEntity
*
* @param int $site_guid The guid of the site to remove it from
*
- * @return true|false
+ * @return bool
*/
function removeFromSite($site_guid) {
return remove_site_user($site_guid, $this->getGUID());
@@ -285,7 +297,7 @@ class ElggUser extends ElggEntity
*
* @param int $friend_guid The GUID of the user to add
*
- * @return true|false Depending on success
+ * @return bool
*/
function addFriend($friend_guid) {
return user_add_friend($this->getGUID(), $friend_guid);
@@ -296,7 +308,7 @@ class ElggUser extends ElggEntity
*
* @param int $friend_guid The GUID of the user to remove
*
- * @return true|false Depending on success
+ * @return bool
*/
function removeFriend($friend_guid) {
return user_remove_friend($this->getGUID(), $friend_guid);
@@ -305,8 +317,7 @@ class ElggUser extends ElggEntity
/**
* Determines whether or not this user is a friend of the currently logged in user
*
- *
- * @return true|false
+ * @return bool
*/
function isFriend() {
return $this->isFriendOf(elgg_get_logged_in_user_guid());
@@ -317,7 +328,7 @@ class ElggUser extends ElggEntity
*
* @param int $user_guid The GUID of the user to check against
*
- * @return true|false
+ * @return bool
*/
function isFriendsWith($user_guid) {
return user_is_friend($this->getGUID(), $user_guid);
@@ -328,7 +339,7 @@ class ElggUser extends ElggEntity
*
* @param int $user_guid The GUID of the user to check against
*
- * @return true|false
+ * @return bool
*/
function isFriendOf($user_guid) {
return user_is_friend($user_guid, $this->getGUID());
@@ -376,7 +387,6 @@ class ElggUser extends ElggEntity
'relationship' => 'friend',
'relationship_guid' => $this->guid,
'limit' => $limit,
- 'offset' => get_input('offset', 0),
'full_view' => false,
);
@@ -450,7 +460,14 @@ class ElggUser extends ElggEntity
* @return array|false
*/
public function getObjects($subtype = "", $limit = 10, $offset = 0) {
- return get_user_objects($this->getGUID(), $subtype, $limit, $offset);
+ $params = array(
+ 'type' => 'object',
+ 'subtype' => $subtype,
+ 'owner_guid' => $this->getGUID(),
+ 'limit' => $limit,
+ 'offset' => $offset
+ );
+ return elgg_get_entities($params);
}
/**
diff --git a/engine/classes/ElggWidget.php b/engine/classes/ElggWidget.php
index 0eb83913b..99708f66a 100644
--- a/engine/classes/ElggWidget.php
+++ b/engine/classes/ElggWidget.php
@@ -115,6 +115,8 @@ class ElggWidget extends ElggObject {
$options = array(
'type' => 'object',
'subtype' => 'widget',
+ 'container_guid' => $this->container_guid,
+ 'limit' => false,
'private_setting_name_value_pairs' => array(
array('name' => 'context', 'value' => $this->getContext()),
array('name' => 'column', 'value' => $column)
@@ -129,21 +131,60 @@ class ElggWidget extends ElggObject {
usort($widgets, create_function('$a,$b','return (int)$a->order > (int)$b->order;'));
+ // remove widgets from inactive plugins
+ $widget_types = elgg_get_widget_types($this->context);
+ $inactive_widgets = array();
+ foreach ($widgets as $index => $widget) {
+ if (!array_key_exists($widget->handler, $widget_types)) {
+ $inactive_widgets[] = $widget;
+ unset($widgets[$index]);
+ }
+ }
+
if ($rank == 0) {
// top of the column
- $this->order = $widgets[0]->order - 10;
- } elseif ($rank == count($widgets)) {
- // bottom of the column
+ $this->order = reset($widgets)->order - 10;
+ } elseif ($rank == (count($widgets) - 1)) {
+ // bottom of the column of active widgets
$this->order = end($widgets)->order + 10;
} else {
- // reorder widgets that are below
- $this->order = $widgets[$rank]->order;
- for ($index = $rank; $index < count($widgets); $index++) {
- if ($widgets[$index]->guid != $this->guid) {
- $widgets[$index]-> order += 10;
+ // reorder widgets
+
+ // remove the widget that's being moved from the array
+ foreach ($widgets as $index => $widget) {
+ if ($widget->guid == $this->guid) {
+ unset($widgets[$index]);
+ }
+ }
+
+ // split the array in two and recombine with the moved widget in middle
+ $before = array_slice($widgets, 0, $rank);
+ array_push($before, $this);
+ $after = array_slice($widgets, $rank);
+ $widgets = array_merge($before, $after);
+ ksort($widgets);
+ $order = 0;
+ foreach ($widgets as $widget) {
+ $widget->order = $order;
+ $order += 10;
+ }
+ }
+
+ // put inactive widgets at the bottom
+ if ($inactive_widgets) {
+ $bottom = 0;
+ foreach ($widgets as $widget) {
+ if ($widget->order > $bottom) {
+ $bottom = $widget->order;
}
}
+ $bottom += 10;
+ foreach ($inactive_widgets as $widget) {
+ $widget->order = $bottom;
+ $bottom += 10;
+ }
}
+
$this->column = $column;
}
diff --git a/engine/classes/ODDDocument.php b/engine/classes/ODDDocument.php
index 4d185aba5..540c35a3b 100644
--- a/engine/classes/ODDDocument.php
+++ b/engine/classes/ODDDocument.php
@@ -70,8 +70,8 @@ class ODDDocument implements Iterator {
public function addElement(ODD $element) {
if (!is_array($this->elements)) {
$this->elements = array();
- $this->elements[] = $element;
}
+ $this->elements[] = $element;
}
/**
diff --git a/engine/classes/ODDEntity.php b/engine/classes/ODDEntity.php
index ab3a49168..e9bb5da6a 100644
--- a/engine/classes/ODDEntity.php
+++ b/engine/classes/ODDEntity.php
@@ -32,75 +32,3 @@ class ODDEntity extends ODD {
return "entity";
}
}
-
-/**
- * ODD Metadata class.
- *
- * @package Elgg.Core
- * @subpackage ODD
- */
-class ODDMetaData extends ODD {
-
- /**
- * New ODD metadata
- *
- * @param unknown_type $uuid Unique ID
- * @param unknown_type $entity_uuid Another unique ID
- * @param unknown_type $name Name
- * @param unknown_type $value Value
- * @param unknown_type $type Type
- * @param unknown_type $owner_uuid Owner ID
- */
- function __construct($uuid, $entity_uuid, $name, $value, $type = "", $owner_uuid = "") {
- parent::__construct();
-
- $this->setAttribute('uuid', $uuid);
- $this->setAttribute('entity_uuid', $entity_uuid);
- $this->setAttribute('name', $name);
- $this->setAttribute('type', $type);
- $this->setAttribute('owner_uuid', $owner_uuid);
- $this->setBody($value);
- }
-
- /**
- * Returns 'metadata'
- *
- * @return 'metadata'
- */
- protected function getTagName() {
- return "metadata";
- }
-}
-
-/**
- * ODD Relationship class.
- *
- * @package Elgg
- * @subpackage Core
- */
-class ODDRelationship extends ODD {
-
- /**
- * New ODD Relationship
- *
- * @param unknown_type $uuid1 First UUID
- * @param unknown_type $type Type of telationship
- * @param unknown_type $uuid2 Second UUId
- */
- function __construct($uuid1, $type, $uuid2) {
- parent::__construct();
-
- $this->setAttribute('uuid1', $uuid1);
- $this->setAttribute('type', $type);
- $this->setAttribute('uuid2', $uuid2);
- }
-
- /**
- * Returns 'relationship'
- *
- * @return 'relationship'
- */
- protected function getTagName() {
- return "relationship";
- }
-}
diff --git a/engine/classes/ODDMetaData.php b/engine/classes/ODDMetaData.php
new file mode 100644
index 000000000..58862e0fb
--- /dev/null
+++ b/engine/classes/ODDMetaData.php
@@ -0,0 +1,39 @@
+<?php
+/**
+ * ODD Metadata class.
+ *
+ * @package Elgg.Core
+ * @subpackage ODD
+ */
+class ODDMetaData extends ODD {
+
+ /**
+ * New ODD metadata
+ *
+ * @param unknown_type $uuid Unique ID
+ * @param unknown_type $entity_uuid Another unique ID
+ * @param unknown_type $name Name
+ * @param unknown_type $value Value
+ * @param unknown_type $type Type
+ * @param unknown_type $owner_uuid Owner ID
+ */
+ function __construct($uuid, $entity_uuid, $name, $value, $type = "", $owner_uuid = "") {
+ parent::__construct();
+
+ $this->setAttribute('uuid', $uuid);
+ $this->setAttribute('entity_uuid', $entity_uuid);
+ $this->setAttribute('name', $name);
+ $this->setAttribute('type', $type);
+ $this->setAttribute('owner_uuid', $owner_uuid);
+ $this->setBody($value);
+ }
+
+ /**
+ * Returns 'metadata'
+ *
+ * @return 'metadata'
+ */
+ protected function getTagName() {
+ return "metadata";
+ }
+}
diff --git a/engine/classes/ODDRelationship.php b/engine/classes/ODDRelationship.php
new file mode 100644
index 000000000..2906b1c73
--- /dev/null
+++ b/engine/classes/ODDRelationship.php
@@ -0,0 +1,33 @@
+<?php
+/**
+ * ODD Relationship class.
+ *
+ * @package Elgg
+ * @subpackage Core
+ */
+class ODDRelationship extends ODD {
+
+ /**
+ * New ODD Relationship
+ *
+ * @param unknown_type $uuid1 First UUID
+ * @param unknown_type $type Type of telationship
+ * @param unknown_type $uuid2 Second UUId
+ */
+ function __construct($uuid1, $type, $uuid2) {
+ parent::__construct();
+
+ $this->setAttribute('uuid1', $uuid1);
+ $this->setAttribute('type', $type);
+ $this->setAttribute('uuid2', $uuid2);
+ }
+
+ /**
+ * Returns 'relationship'
+ *
+ * @return 'relationship'
+ */
+ protected function getTagName() {
+ return "relationship";
+ }
+}
diff --git a/engine/classes/SuccessResult.php b/engine/classes/SuccessResult.php
index c8578a2cf..ab5468ad8 100644
--- a/engine/classes/SuccessResult.php
+++ b/engine/classes/SuccessResult.php
@@ -15,7 +15,7 @@ class SuccessResult extends GenericResult {
*
* @param string $result The result
*/
- public function SuccessResult($result) {
+ public function __construct($result) {
$this->setResult($result);
$this->setStatusCode(SuccessResult::$RESULT_SUCCESS);
}
diff --git a/engine/classes/XMLRPCCall.php b/engine/classes/XMLRPCCall.php
index 8eeba0c29..fd28f1e3e 100644
--- a/engine/classes/XMLRPCCall.php
+++ b/engine/classes/XMLRPCCall.php
@@ -18,7 +18,7 @@ class XMLRPCCall {
* @param string $xml XML
*/
function __construct($xml) {
- $this->_parse($xml);
+ $this->parse($xml);
}
/**
@@ -45,7 +45,7 @@ class XMLRPCCall {
*
* @return void
*/
- private function _parse($xml) {
+ private function parse($xml) {
$xml = xml_to_object($xml);
// sanity check
diff --git a/engine/handlers/cache_handler.php b/engine/handlers/cache_handler.php
index 94a0e64e9..b332ec379 100644
--- a/engine/handlers/cache_handler.php
+++ b/engine/handlers/cache_handler.php
@@ -60,26 +60,31 @@ preg_match($regex, $request, $matches);
$type = $matches[1];
$viewtype = $matches[2];
$view = $matches[3];
+$ts = $matches[4];
+
+// If is the same ETag, content didn't changed.
+$etag = $ts;
+if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && trim($_SERVER['HTTP_IF_NONE_MATCH']) == $etag) {
+ header("HTTP/1.1 304 Not Modified");
+ exit;
+}
switch ($type) {
case 'css':
header("Content-type: text/css", true);
- header('Expires: ' . date('r', strtotime("+6 months")), true);
- header("Pragma: public", true);
- header("Cache-Control: public", true);
-
$view = "css/$view";
break;
case 'js':
header('Content-type: text/javascript', true);
- header('Expires: ' . date('r', strtotime("+6 months")), true);
- header("Pragma: public", true);
- header("Cache-Control: public", true);
-
$view = "js/$view";
break;
}
+header('Expires: ' . date('r', strtotime("+6 months")), true);
+header("Pragma: public", true);
+header("Cache-Control: public", true);
+header("ETag: $etag");
+
$filename = $dataroot . 'views_simplecache/' . md5($viewtype . $view);
if (file_exists($filename)) {
diff --git a/engine/handlers/export_handler.php b/engine/handlers/export_handler.php
index b91a037e8..aa5214c23 100644
--- a/engine/handlers/export_handler.php
+++ b/engine/handlers/export_handler.php
@@ -72,8 +72,10 @@ if (($guid != "") && ($type == "") && ($id_or_name == "")) {
$r = get_relationship($id_or_name);
break;
case 'volatile' :
- $m = elgg_trigger_plugin_hook('volatile', 'metadata',
- array('guid' => $guid, 'varname' => $id_or_name));
+ $m = elgg_trigger_plugin_hook('volatile', 'metadata', array(
+ 'guid' => $guid,
+ 'varname' => $id_or_name,
+ ));
break;
default :
diff --git a/engine/lib/access.php b/engine/lib/access.php
index 08b9283cd..e8b3b0d52 100644
--- a/engine/lib/access.php
+++ b/engine/lib/access.php
@@ -31,7 +31,7 @@ function get_access_list($user_id = 0, $site_id = 0, $flush = false) {
global $CONFIG, $init_finished;
static $access_list;
- if (!isset($access_list) || !$init_finished) {
+ if (!isset($access_list)) {
$access_list = array();
}
@@ -49,9 +49,16 @@ function get_access_list($user_id = 0, $site_id = 0, $flush = false) {
return $access_list[$user_id];
}
- $access_list[$user_id] = "(" . implode(",", get_access_array($user_id, $site_id, $flush)) . ")";
+ $access = "(" . implode(",", get_access_array($user_id, $site_id, $flush)) . ")";
- return $access_list[$user_id];
+ // only cache if done with init and access is enabled (unless admin user)
+ // session is loaded before init is finished, so don't need to check for user session
+ if ($init_finished && (elgg_is_admin_logged_in() || !elgg_get_ignore_access())) {
+ $access_list[$user_id] = $access;
+ return $access_list[$user_id];
+ } else {
+ return $access;
+ }
}
/**
@@ -83,7 +90,7 @@ function get_access_array($user_id = 0, $site_id = 0, $flush = false) {
// this cache might be redundant. But db cache is flushed on every db write.
static $access_array;
- if (!isset($access_array) || (!isset($init_finished)) || (!$init_finished)) {
+ if (!isset($access_array)) {
$access_array = array();
}
@@ -137,12 +144,12 @@ function get_access_array($user_id = 0, $site_id = 0, $flush = false) {
$tmp_access_array[] = ACCESS_PRIVATE;
}
- $access_array[$user_id] = $tmp_access_array;
- } else {
- // No user id logged in so we can only access public info
- $tmp_return = $tmp_access_array;
+ // only cache if done with init and access is enabled (unless admin user)
+ // session is loaded before init is finished, so don't need to check for user session
+ if ($init_finished && (elgg_is_admin_logged_in() || !elgg_get_ignore_access())) {
+ $access_array[$user_id] = $tmp_access_array;
+ }
}
-
} else {
$tmp_access_array = $access_array[$user_id];
}
@@ -671,8 +678,10 @@ function add_user_to_access_collection($user_guid, $collection_id) {
return false;
}
+ // if someone tries to insert the same data twice, we do a no-op on duplicate key
$q = "INSERT INTO {$CONFIG->dbprefix}access_collection_membership
- SET access_collection_id = {$collection_id}, user_guid = {$user_guid}";
+ SET access_collection_id = $collection_id, user_guid = $user_guid
+ ON DUPLICATE KEY UPDATE user_guid = user_guid";
$result = insert_data($q);
return $result !== false;
@@ -838,7 +847,7 @@ function elgg_list_entities_from_access_id(array $options = array()) {
*
* @param int $entity_access_id The entity's access id
*
- * @return string 'Public', 'Private', etc. or false if error.
+ * @return string 'Public', 'Private', etc.
* @since 1.7.0
* @todo I think this probably wants get_access_array() instead of get_write_access_array(),
* but those two functions return different types of arrays.
@@ -849,15 +858,12 @@ function get_readable_access_level($entity_access_id) {
//get the access level for object in readable string
$options = get_write_access_array();
- //@todo Really? Use array_key_exists()
- foreach ($options as $key => $option) {
- if ($key == $access) {
- $entity_acl = htmlentities($option, ENT_QUOTES, 'UTF-8');
- return $entity_acl;
- break;
- }
+ if (array_key_exists($access, $options)) {
+ return $options[$access];
}
- return false;
+
+ // return 'Limited' if the user does not have access to the access collection
+ return elgg_echo('access:limited:label');
}
/**
@@ -947,7 +953,8 @@ function elgg_get_access_object() {
*
* @global bool $init_finished
* @access private
- * @todo investigate why this is needed
+ * @todo This is required to tell the access system to start caching because
+ * calls are made while in ignore access mode and before the user is logged in.
*/
$init_finished = false;
@@ -987,9 +994,9 @@ function elgg_override_permissions($hook, $type, $value, $params) {
}
// don't do this so ignore access still works with no one logged in
-// if (!$user instanceof ElggUser) {
-// return false;
-// }
+ //if (!$user instanceof ElggUser) {
+ // return false;
+ //}
// check for admin
if ($user_guid && elgg_is_admin_user($user_guid)) {
@@ -1015,8 +1022,9 @@ function access_test($hook, $type, $value, $params) {
return $value;
}
-// This function will let us know when 'init' has finished
-elgg_register_event_handler('init', 'system', 'access_init', 9999);
+// Tell the access functions the system has booted, plugins are loaded,
+// and the user is logged in so it can start caching
+elgg_register_event_handler('ready', 'system', 'access_init');
// For overrided permissions
elgg_register_plugin_hook_handler('permissions_check', 'all', 'elgg_override_permissions');
diff --git a/engine/lib/actions.php b/engine/lib/actions.php
index f415842ab..3a7c02488 100644
--- a/engine/lib/actions.php
+++ b/engine/lib/actions.php
@@ -273,8 +273,19 @@ function validate_action_token($visibleerrors = TRUE, $token = NULL, $ts = NULL)
} else if ($visibleerrors) {
register_error(elgg_echo('actiongatekeeper:tokeninvalid'));
}
- } else if ($visibleerrors) {
- register_error(elgg_echo('actiongatekeeper:missingfields'));
+ } else {
+ if (! empty($_SERVER['CONTENT_LENGTH']) && empty($_POST)) {
+ // The size of $_POST or uploaded file has exceed the size limit
+ $error_msg = elgg_trigger_plugin_hook('action_gatekeeper:upload_exceeded_msg', 'all', array(
+ 'post_size' => $_SERVER['CONTENT_LENGTH'],
+ 'visible_errors' => $visibleerrors,
+ ), elgg_echo('actiongatekeeper:uploadexceeded'));
+ } else {
+ $error_msg = elgg_echo('actiongatekeeper:missingfields');
+ }
+ if ($visibleerrors) {
+ register_error($error_msg);
+ }
}
return FALSE;
@@ -459,8 +470,7 @@ function ajax_forward_hook($hook, $type, $reason, $params) {
// however some browsers will not accept the JSON MIME type.
if (stripos($_SERVER['HTTP_ACCEPT'], 'application/json') === FALSE) {
header("Content-type: text/plain");
- }
- else {
+ } else {
header("Content-type: application/json");
}
diff --git a/engine/lib/admin.php b/engine/lib/admin.php
index a191d740b..b65d98c95 100644
--- a/engine/lib/admin.php
+++ b/engine/lib/admin.php
@@ -79,6 +79,10 @@ function elgg_add_admin_notice($id, $message) {
if (elgg_admin_notice_exists($id)) {
return false;
}
+
+ // need to handle when no one is logged in
+ $old_ia = elgg_set_ignore_access(true);
+
$admin_notice = new ElggObject();
$admin_notice->subtype = 'admin_notice';
// admins can see ACCESS_PRIVATE but no one else can.
@@ -86,13 +90,16 @@ function elgg_add_admin_notice($id, $message) {
$admin_notice->admin_notice_id = $id;
$admin_notice->description = $message;
- return $admin_notice->save();
+ $result = $admin_notice->save();
+
+ elgg_set_ignore_access($old_ia);
+
+ return (bool)$result;
}
- return FALSE;
+ return false;
}
-
/**
* Remove an admin notice by ID.
*
@@ -172,10 +179,10 @@ function elgg_admin_notice_exists($id) {
*
* This function handles registering the parent if it has not been registered.
*
- * @param string $section The menu section to add to
- * @param string $menu_id The unique ID of section
- * @param string $parent_id If a child section, the parent section id
- * @param int $priority The menu item priority
+ * @param string $section The menu section to add to
+ * @param string $menu_id The unique ID of section
+ * @param string $parent_id If a child section, the parent section id
+ * @param int $priority The menu item priority
*
* @return bool
* @since 1.8.0
@@ -237,6 +244,7 @@ function admin_init() {
elgg_register_action('profile/fields/delete', '', 'admin');
elgg_register_action('profile/fields/reorder', '', 'admin');
+ elgg_register_simplecache_view('css/admin');
elgg_register_simplecache_view('js/admin');
$url = elgg_get_simplecache_url('js', 'admin');
elgg_register_js('elgg.admin', $url);
@@ -255,6 +263,7 @@ function admin_init() {
// statistics
elgg_register_admin_menu_item('administer', 'statistics', null, 20);
elgg_register_admin_menu_item('administer', 'overview', 'statistics');
+ elgg_register_admin_menu_item('administer', 'server', 'statistics');
// users
elgg_register_admin_menu_item('administer', 'users', null, 20);
@@ -563,7 +572,7 @@ function admin_markdown_page_handler($pages) {
if (!$plugin) {
$error = elgg_echo('admin:plugins:markdown:unknown_plugin');
$body = elgg_view_layout('admin', array('content' => $error, 'title' => $error));
- echo elgg_view_page($title, $body, 'admin');
+ echo elgg_view_page($error, $body, 'admin');
return true;
}
diff --git a/engine/lib/annotations.php b/engine/lib/annotations.php
index bfd40d1e8..2036ccd61 100644
--- a/engine/lib/annotations.php
+++ b/engine/lib/annotations.php
@@ -95,8 +95,6 @@ $owner_guid = 0, $access_id = ACCESS_PRIVATE) {
$entity = get_entity($entity_guid);
if (elgg_trigger_event('annotate', $entity->type, $entity)) {
- system_log($entity, 'annotate');
-
// If ok then add it
$result = insert_data("INSERT into {$CONFIG->dbprefix}annotations
(entity_guid, name_id, value_id, value_type, owner_guid, time_created, access_id) VALUES
@@ -163,13 +161,9 @@ function update_annotation($annotation_id, $name, $value, $value_type, $owner_gu
where id=$annotation_id and $access");
if ($result !== false) {
+ // @todo add plugin hook that sends old and new annotation information before db access
$obj = elgg_get_annotation_from_id($annotation_id);
- if (elgg_trigger_event('update', 'annotation', $obj)) {
- return true;
- } else {
- // @todo add plugin hook that sends old and new annotation information before db access
- elgg_delete_annotation_by_id($annotation_id);
- }
+ elgg_trigger_event('update', 'annotation', $obj);
}
return $result;
@@ -183,21 +177,23 @@ function update_annotation($annotation_id, $name, $value, $value_type, $owner_gu
*
* @param array $options Array in format:
*
- * annotation_names => NULL|ARR Annotation names
- *
- * annotation_values => NULL|ARR Annotation values
- *
- * annotation_ids => NULL|ARR annotation ids
- *
- * annotation_case_sensitive => BOOL Overall Case sensitive
- *
- * annotation_owner_guids => NULL|ARR guids for annotation owners
+ * annotation_names => NULL|ARR Annotation names
+ * annotation_values => NULL|ARR Annotation values
+ * annotation_ids => NULL|ARR annotation ids
+ * annotation_case_sensitive => BOOL Overall Case sensitive
+ * annotation_owner_guids => NULL|ARR guids for annotation owners
+ * annotation_created_time_lower => INT Lower limit for created time.
+ * annotation_created_time_upper => INT Upper limit for created time.
+ * annotation_calculation => STR Perform the MySQL function on the annotation values returned.
+ * Do not confuse this "annotation_calculation" option with the
+ * "calculation" option to elgg_get_entities_from_annotation_calculation().
+ * The "annotation_calculation" option causes this function to
+ * return the result of performing a mathematical calculation on
+ * all annotations that match the query instead of ElggAnnotation
+ * objects.
+ * See the docs for elgg_get_entities_from_annotation_calculation()
+ * for the proper use of the "calculation" option.
*
- * annotation_created_time_lower => INT Lower limit for created time.
- *
- * annotation_created_time_upper => INT Upper limit for created time.
- *
- * annotation_calculation => STR Perform the MySQL function on the annotation values returned.
*
* @return mixed
* @since 1.8.0
@@ -211,9 +207,11 @@ function elgg_get_annotations(array $options = array()) {
* Deletes annotations based on $options.
*
* @warning Unlike elgg_get_annotations() this will not accept an empty options array!
+ * This requires at least one constraint: annotation_owner_guid(s),
+ * annotation_name(s), annotation_value(s), or guid(s) must be set.
*
* @param array $options An options array. {@See elgg_get_annotations()}
- * @return mixed
+ * @return mixed Null if the metadata name is invalid. Bool on success or fail.
* @since 1.8.0
*/
function elgg_delete_annotations(array $options) {
@@ -222,7 +220,7 @@ function elgg_delete_annotations(array $options) {
}
$options['metastring_type'] = 'annotations';
- return elgg_batch_metastring_based_objects($options, 'elgg_batch_delete_callback');
+ return elgg_batch_metastring_based_objects($options, 'elgg_batch_delete_callback', false);
}
/**
@@ -239,8 +237,8 @@ function elgg_disable_annotations(array $options) {
return false;
}
- $options['metastrings_type'] = 'annotations';
- return elgg_batch_metastring_based_objects($options, 'elgg_batch_disable_callback');
+ $options['metastring_type'] = 'annotations';
+ return elgg_batch_metastring_based_objects($options, 'elgg_batch_disable_callback', false);
}
/**
@@ -388,8 +386,14 @@ function elgg_list_entities_from_annotations($options = array()) {
* Get entities ordered by a mathematical calculation on annotation values
*
* @param array $options An options array:
- * 'annotation_calculation' => The calculation to use. Must be a valid MySQL function.
+ * 'calculation' => The calculation to use. Must be a valid MySQL function.
* Defaults to sum. Result selected as 'annotation_calculation'.
+ * Don't confuse this "calculation" option with the
+ * "annotation_calculation" option to elgg_get_annotations().
+ * This "calculation" option is applied to each entity's set of
+ * annotations and is selected as annotation_calculation for that row.
+ * See the docs for elgg_get_annotations() for proper use of the
+ * "annotation_calculation" option.
* 'order_by' => The order for the sorting. Defaults to 'annotation_calculation desc'.
* 'annotation_names' => The names of annotations on the entity.
* 'annotation_values' => The values of annotations on the entity.
@@ -545,8 +549,8 @@ function elgg_comment_url_handler(ElggAnnotation $comment) {
/**
* Register an annotation url handler.
*
- * @param string $function_name The function.
* @param string $extender_name The name, default 'all'.
+ * @param string $function_name The function.
*
* @return string
*/
diff --git a/engine/lib/cache.php b/engine/lib/cache.php
index a6ebe2a30..be1c43e14 100644
--- a/engine/lib/cache.php
+++ b/engine/lib/cache.php
@@ -10,15 +10,14 @@
/* Filepath Cache */
/**
- * Returns an ElggCache object suitable for caching view
- * file load paths to disk under $CONFIG->dataroot.
+ * Returns an ElggCache object suitable for caching system information
*
* @todo Can this be done in a cleaner way?
* @todo Swap to memcache etc?
*
- * @return ElggFileCache A cache object suitable for caching file load paths.
+ * @return ElggFileCache
*/
-function elgg_get_filepath_cache() {
+function elgg_get_system_cache() {
global $CONFIG;
/**
@@ -27,35 +26,34 @@ function elgg_get_filepath_cache() {
static $FILE_PATH_CACHE;
if (!$FILE_PATH_CACHE) {
- $FILE_PATH_CACHE = new ElggFileCache($CONFIG->dataroot);
+ $FILE_PATH_CACHE = new ElggFileCache($CONFIG->dataroot . 'system_cache/');
}
return $FILE_PATH_CACHE;
}
/**
- * Function which resets the file path cache.
+ * Reset the system cache by deleting the caches
*
+ * @return void
*/
-function elgg_filepath_cache_reset() {
- $cache = elgg_get_filepath_cache();
- $view_types_result = $cache->delete('view_types');
- $views_result = $cache->delete('views');
- return $view_types_result && $views_result;
+function elgg_reset_system_cache() {
+ $cache = elgg_get_system_cache();
+ $cache->clear();
}
/**
- * Saves a filepath cache.
+ * Saves a system cache.
*
- * @param string $type
- * @param string $data
+ * @param string $type The type or identifier of the cache
+ * @param string $data The data to be saved
* @return bool
*/
-function elgg_filepath_cache_save($type, $data) {
+function elgg_save_system_cache($type, $data) {
global $CONFIG;
- if ($CONFIG->viewpath_cache_enabled) {
- $cache = elgg_get_filepath_cache();
+ if ($CONFIG->system_cache_enabled) {
+ $cache = elgg_get_system_cache();
return $cache->save($type, $data);
}
@@ -63,16 +61,16 @@ function elgg_filepath_cache_save($type, $data) {
}
/**
- * Retrieve the contents of the filepath cache.
+ * Retrieve the contents of a system cache.
*
* @param string $type The type of cache to load
* @return string
*/
-function elgg_filepath_cache_load($type) {
+function elgg_load_system_cache($type) {
global $CONFIG;
- if ($CONFIG->viewpath_cache_enabled) {
- $cache = elgg_get_filepath_cache();
+ if ($CONFIG->system_cache_enabled) {
+ $cache = elgg_get_system_cache();
$cached_data = $cache->load($type);
if ($cached_data) {
@@ -84,35 +82,74 @@ function elgg_filepath_cache_load($type) {
}
/**
- * Enables the views file paths disk cache.
+ * Enables the system disk cache.
*
- * Uses the 'viewpath_cache_enabled' datalist with a boolean value.
- * Resets the views paths cache.
+ * Uses the 'system_cache_enabled' datalist with a boolean value.
+ * Resets the system cache.
*
* @return void
*/
-function elgg_enable_filepath_cache() {
+function elgg_enable_system_cache() {
global $CONFIG;
- datalist_set('viewpath_cache_enabled', 1);
- $CONFIG->viewpath_cache_enabled = 1;
- elgg_filepath_cache_reset();
+ datalist_set('system_cache_enabled', 1);
+ $CONFIG->system_cache_enabled = 1;
+ elgg_reset_system_cache();
}
/**
- * Disables the views file paths disk cache.
+ * Disables the system disk cache.
*
- * Uses the 'viewpath_cache_enabled' datalist with a boolean value.
- * Resets the views paths cache.
+ * Uses the 'system_cache_enabled' datalist with a boolean value.
+ * Resets the system cache.
*
* @return void
*/
-function elgg_disable_filepath_cache() {
+function elgg_disable_system_cache() {
global $CONFIG;
- datalist_set('viewpath_cache_enabled', 0);
- $CONFIG->viewpath_cache_enabled = 0;
- elgg_filepath_cache_reset();
+ datalist_set('system_cache_enabled', 0);
+ $CONFIG->system_cache_enabled = 0;
+ elgg_reset_system_cache();
+}
+
+/** @todo deprecate in Elgg 1.9 **/
+
+/**
+ * @access private
+ */
+function elgg_get_filepath_cache() {
+ return elgg_get_system_cache();
+}
+/**
+ * @access private
+ */
+function elgg_filepath_cache_reset() {
+ return elgg_reset_system_cache();
+}
+/**
+ * @access private
+ */
+function elgg_filepath_cache_save($type, $data) {
+ return elgg_save_system_cache($type, $data);
+}
+/**
+ * @access private
+ */
+function elgg_filepath_cache_load($type) {
+ return elgg_load_system_cache($type);
+}
+/**
+ * @access private
+ */
+function elgg_enable_filepath_cache() {
+ return elgg_enable_system_cache();
+}
+/**
+ * @access private
+ */
+function elgg_disable_filepath_cache() {
+ return elgg_disable_system_cache();
}
/* Simplecache */
@@ -332,7 +369,7 @@ function elgg_invalidate_simplecache() {
$return = true;
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
- $return = $return && unlink($CONFIG->dataroot . 'views_simplecache/' . $file);
+ $return &= unlink($CONFIG->dataroot . 'views_simplecache/' . $file);
}
}
closedir($handle);
@@ -345,9 +382,71 @@ function elgg_invalidate_simplecache() {
}
foreach ($viewtypes as $viewtype) {
- $return = $return && datalist_set("simplecache_lastupdate_$viewtype", 0);
- $return = $return && datalist_set("simplecache_lastcached_$viewtype", 0);
+ $return &= datalist_set("simplecache_lastupdate_$viewtype", 0);
+ $return &= datalist_set("simplecache_lastcached_$viewtype", 0);
}
return $return;
}
+
+/**
+ * @see elgg_reset_system_cache()
+ * @access private
+ */
+function _elgg_load_cache() {
+ global $CONFIG;
+
+ $CONFIG->system_cache_loaded = false;
+
+ $CONFIG->views = new stdClass();
+ $data = elgg_load_system_cache('view_locations');
+ if (!is_string($data)) {
+ return;
+ }
+ $CONFIG->views->locations = unserialize($data);
+
+ $data = elgg_load_system_cache('view_types');
+ if (!is_string($data)) {
+ return;
+ }
+ $CONFIG->view_types = unserialize($data);
+
+ $CONFIG->system_cache_loaded = true;
+}
+
+/**
+ * @access private
+ */
+function _elgg_cache_init() {
+ global $CONFIG;
+
+ $viewtype = elgg_get_viewtype();
+
+ // Regenerate the simple cache if expired.
+ // Don't do it on upgrade because upgrade does it itself.
+ // @todo - move into function and perhaps run off init system event
+ if (!defined('UPGRADING')) {
+ $lastupdate = datalist_get("simplecache_lastupdate_$viewtype");
+ $lastcached = datalist_get("simplecache_lastcached_$viewtype");
+ if ($lastupdate == 0 || $lastcached < $lastupdate) {
+ elgg_regenerate_simplecache($viewtype);
+ $lastcached = datalist_get("simplecache_lastcached_$viewtype");
+ }
+ $CONFIG->lastcache = $lastcached;
+ }
+
+ // cache system data if enabled and not loaded
+ if ($CONFIG->system_cache_enabled && !$CONFIG->system_cache_loaded) {
+ elgg_save_system_cache('view_locations', serialize($CONFIG->views->locations));
+ elgg_save_system_cache('view_types', serialize($CONFIG->view_types));
+ }
+
+ if ($CONFIG->system_cache_enabled && !$CONFIG->i18n_loaded_from_cache) {
+ reload_all_translations();
+ foreach ($CONFIG->translations as $lang => $map) {
+ elgg_save_system_cache("$lang.php", serialize($map));
+ }
+ }
+}
+
+elgg_register_event_handler('ready', 'system', '_elgg_cache_init');
diff --git a/engine/lib/configuration.php b/engine/lib/configuration.php
index 615063f3d..305aa00b6 100644
--- a/engine/lib/configuration.php
+++ b/engine/lib/configuration.php
@@ -3,8 +3,9 @@
* Elgg configuration procedural code.
*
* Includes functions for manipulating the configuration values stored in the database
- * Plugin authors should use the {@link get_config()}, {@link set_config()},
- * and {@unset_config()} functions to access or update config values.
+ * Plugin authors should use the {@link elgg_get_config()}, {@link elgg_set_config()},
+ * {@link elgg_save_config()}, and {@unset_config()} functions to access or update
+ * config values.
*
* Elgg's configuration is split among 2 tables and 1 file:
* - dbprefix_config
@@ -302,7 +303,7 @@ function datalist_set($name, $value) {
. " set name = '{$sanitised_name}', value = '{$sanitised_value}'"
. " ON DUPLICATE KEY UPDATE value='{$sanitised_value}'");
- if ($success) {
+ if ($success !== FALSE) {
$DATALIST_CACHE[$name] = $value;
return true;
} else {
@@ -475,10 +476,12 @@ function get_config($name, $site_guid = 0) {
break;
}
+ // @todo these haven't really been implemented in Elgg 1.8. Complete in 1.9.
// show dep message
if ($new_name) {
+ // $msg = "Config value $name has been renamed as $new_name";
$name = $new_name;
- elgg_deprecated_notice($msg, $dep_version);
+ // elgg_deprecated_notice($msg, $dep_version);
}
// decide from where to return the value
@@ -517,10 +520,10 @@ function get_all_config($site_guid = 0) {
$site_guid = (int) $site_guid;
if ($site_guid == 0) {
- $site_guid = (int) $CONFIG->site_id;
+ $site_guid = (int) $CONFIG->site_guid;
}
- if ($result = get_data("SELECT * from {$CONFIG->dbprefix}config where site_guid = {$site_guid}")) {
+ if ($result = get_data("SELECT * FROM {$CONFIG->dbprefix}config WHERE site_guid = $site_guid")) {
foreach ($result as $r) {
$name = $r->name;
$value = $r->value;
@@ -533,37 +536,49 @@ function get_all_config($site_guid = 0) {
}
/**
- * Sets defaults for or attempts to autodetect some common config values and
- * loads them into $CONFIG.
+ * Loads configuration related to this site
*
- * @return true
+ * This loads from the config database table and the site entity
* @access private
*/
-function set_default_config() {
+function _elgg_load_site_config() {
global $CONFIG;
- $install_root = str_replace("\\", "/", dirname(dirname(dirname(__FILE__))));
-
- // @todo this seldom works right.
- $pathpart = str_replace("//", "/", str_replace($_SERVER['DOCUMENT_ROOT'], "", $install_root));
- if (substr($pathpart, 0, 1) != "/") {
- $pathpart = "/" . $pathpart;
+ $CONFIG->site_guid = (int) datalist_get('default_site');
+ $CONFIG->site_id = $CONFIG->site_guid;
+ $CONFIG->site = get_entity($CONFIG->site_guid);
+ if (!$CONFIG->site) {
+ throw new InstallationException(elgg_echo('InstallationException:SiteNotInstalled'));
}
- $www_root = "http://" . $_SERVER['HTTP_HOST'] . $pathpart;
+ $CONFIG->wwwroot = $CONFIG->site->url;
+ $CONFIG->sitename = $CONFIG->site->name;
+ $CONFIG->sitedescription = $CONFIG->site->description;
+ $CONFIG->siteemail = $CONFIG->site->email;
+ $CONFIG->url = $CONFIG->wwwroot;
+
+ get_all_config();
+}
+
+/**
+ * Loads configuration related to Elgg as an application
+ *
+ * This loads from the datalists database table
+ * @access private
+ */
+function _elgg_load_application_config() {
+ global $CONFIG;
+
+ $install_root = str_replace("\\", "/", dirname(dirname(dirname(__FILE__))));
$defaults = array(
'path' => "$install_root/",
'view_path' => "$install_root/views/",
'plugins_path' => "$install_root/mod/",
- 'wwwroot' => $www_root,
- 'url' => $www_root,
- 'site_name' => 'New Elgg site',
'language' => 'en',
- // compatibility with old names for ppl not using get_config()
+ // compatibility with old names for plugins not using elgg_get_config()
'viewpath' => "$install_root/views/",
'pluginspath' => "$install_root/mod/",
- 'sitename' => 'New Elgg site',
);
foreach ($defaults as $name => $value) {
@@ -572,25 +587,6 @@ function set_default_config() {
}
}
- $CONFIG->context = array();
-
- return true;
-}
-
-/**
- * Loads values into $CONFIG.
- *
- * If Elgg is installed, this function pulls all rows from dbprefix_config
- * and cherry picks some values from dbprefix_datalists. This also extracts
- * some commonly used values from the default site object.
- *
- * @elgg_event boot system
- * @return true|null
- * @access private
- */
-function configuration_boot() {
- global $CONFIG;
-
$path = datalist_get('path');
if (!empty($path)) {
$CONFIG->path = $path;
@@ -605,22 +601,23 @@ function configuration_boot() {
} else {
$CONFIG->simplecache_enabled = 1;
}
- $viewpath_cache_enabled = datalist_get('viewpath_cache_enabled');
- if ($viewpath_cache_enabled !== false) {
- $CONFIG->viewpath_cache_enabled = $viewpath_cache_enabled;
+ $system_cache_enabled = datalist_get('system_cache_enabled');
+ if ($system_cache_enabled !== false) {
+ $CONFIG->system_cache_enabled = $system_cache_enabled;
} else {
- $CONFIG->viewpath_cache_enabled = 1;
+ $CONFIG->system_cache_enabled = 1;
}
- if (isset($CONFIG->site) && ($CONFIG->site instanceof ElggSite)) {
- $CONFIG->wwwroot = $CONFIG->site->url;
- $CONFIG->sitename = $CONFIG->site->name;
- $CONFIG->sitedescription = $CONFIG->site->description;
- $CONFIG->siteemail = $CONFIG->site->email;
- }
- $CONFIG->url = $CONFIG->wwwroot;
- // Load default settings from database
- get_all_config();
-}
+ // initialize context here so it is set before the get_input call
+ $CONFIG->context = array();
+
+ // needs to be set before system, init for links in html head
+ $viewtype = get_input('view', 'default');
+ $lastcached = datalist_get("simplecache_lastcached_$viewtype");
+ $CONFIG->lastcache = $lastcached;
-elgg_register_event_handler('boot', 'system', 'configuration_boot', 10);
+ $CONFIG->i18n_loaded_from_cache = false;
+
+ // this must be synced with the enum for the entities table
+ $CONFIG->entity_types = array('group', 'object', 'site', 'user');
+}
diff --git a/engine/lib/database.php b/engine/lib/database.php
index c44fdf1fd..cc2b99f6a 100644
--- a/engine/lib/database.php
+++ b/engine/lib/database.php
@@ -189,22 +189,6 @@ function db_delayedexecution_shutdown_hook() {
}
/**
- * Registers shutdown functions for database profiling and delayed queries.
- *
- * @note Database connections are established upon first call to database.
- *
- * @return true
- * @elgg_event_handler boot system
- * @access private
- */
-function init_db() {
- register_shutdown_function('db_delayedexecution_shutdown_hook');
- register_shutdown_function('db_profiling_shutdown_hook');
-
- return true;
-}
-
-/**
* Returns (if required, also creates) a database link resource.
*
* Database link resources are stored in the {@link $dblink} global. These
@@ -728,9 +712,9 @@ function sanitize_string($string) {
/**
* Sanitises an integer for database use.
*
- * @param int $int Integer
- * @param bool[optional] $signed Whether negative values should be allowed (true)
- * @return int Sanitised integer
+ * @param int $int Value to be sanitized
+ * @param bool $signed Whether negative values should be allowed (true)
+ * @return int
*/
function sanitise_int($int, $signed = true) {
$int = (int) $int;
@@ -745,18 +729,25 @@ function sanitise_int($int, $signed = true) {
}
/**
- * Sanitises an integer for database use.
+ * Sanitizes an integer for database use.
* Wrapper function for alternate English spelling (@see sanitise_int)
*
- * @param int $int Integer
- * @param bool[optional] $signed Whether negative values should be allowed (true)
- * @return int Sanitised integer
+ * @param int $int Value to be sanitized
+ * @param bool $signed Whether negative values should be allowed (true)
+ * @return int
*/
function sanitize_int($int, $signed = true) {
return sanitise_int($int, $signed);
}
/**
- * @elgg_register_event boot system init_db
+ * Registers shutdown functions for database profiling and delayed queries.
+ *
+ * @access private
*/
-elgg_register_event_handler('boot', 'system', 'init_db', 0);
+function init_db() {
+ register_shutdown_function('db_delayedexecution_shutdown_hook');
+ register_shutdown_function('db_profiling_shutdown_hook');
+}
+
+elgg_register_event_handler('init', 'system', 'init_db');
diff --git a/engine/lib/deprecated-1.8.php b/engine/lib/deprecated-1.8.php
index e1866498b..4b9d41543 100644
--- a/engine/lib/deprecated-1.8.php
+++ b/engine/lib/deprecated-1.8.php
@@ -1674,7 +1674,7 @@ function get_plugin_list() {
* otherwise you may experience view display artifacts. Do this with the following code:
*
* elgg_regenerate_simplecache();
- * elgg_filepath_cache_reset();
+ * elgg_reset_system_cache();
*
* @deprecated 1.8 Use elgg_generate_plugin_entities() and elgg_set_plugin_priorities()
*
@@ -1841,7 +1841,7 @@ function get_installed_plugins($status = 'all') {
* otherwise you may experience view display artifacts. Do this with the following code:
*
* elgg_regenerate_simplecache();
- * elgg_filepath_cache_reset();
+ * elgg_reset_system_cache();
*
* @deprecated 1.8 Use ElggPlugin->activate()
*
@@ -1882,7 +1882,7 @@ function enable_plugin($plugin, $site_guid = null) {
* otherwise you may experience view display artifacts. Do this with the following code:
*
* elgg_regenerate_simplecache();
- * elgg_filepath_cache_reset();
+ * elgg_reset_system_cache();
*
* @deprecated 1.8 Use ElggPlugin->deactivate()
*
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php
index 57d602450..62cb2d5bb 100644
--- a/engine/lib/elgglib.php
+++ b/engine/lib/elgglib.php
@@ -995,7 +995,8 @@ function elgg_trigger_plugin_hook($hook, $type, $params = null, $returnvalue = n
* @access private
*/
function _elgg_php_exception_handler($exception) {
- error_log("*** FATAL EXCEPTION *** : " . $exception);
+ $timestamp = time();
+ error_log("Exception #$timestamp: $exception");
// Wipe any existing output buffer
ob_end_clean();
@@ -1011,7 +1012,17 @@ function _elgg_php_exception_handler($exception) {
$CONFIG->pagesetupdone = true;
elgg_set_viewtype('failsafe');
- $body = elgg_view("messages/exceptions/exception", array('object' => $exception));
+ if (elgg_is_admin_logged_in()) {
+ $body = elgg_view("messages/exceptions/admin_exception", array(
+ 'object' => $exception,
+ 'ts' => $timestamp
+ ));
+ } else {
+ $body = elgg_view("messages/exceptions/exception", array(
+ 'object' => $exception,
+ 'ts' => $timestamp
+ ));
+ }
echo elgg_view_page(elgg_echo('exception:title'), $body);
} catch (Exception $e) {
$timestamp = time();
@@ -1042,12 +1053,14 @@ function _elgg_php_exception_handler($exception) {
*
* @return true
* @access private
+ * @todo Replace error_log calls with elgg_log calls.
*/
function _elgg_php_error_handler($errno, $errmsg, $filename, $linenum, $vars) {
$error = date("Y-m-d H:i:s (T)") . ": \"$errmsg\" in file $filename (line $linenum)";
switch ($errno) {
case E_USER_ERROR:
+ case E_RECOVERABLE_ERROR: // (e.g. type hint violation)
error_log("PHP ERROR: $error");
register_error("ERROR: $error");
@@ -1081,8 +1094,8 @@ function _elgg_php_error_handler($errno, $errmsg, $filename, $linenum, $vars) {
*
* @note No messages will be displayed unless debugging has been enabled.
*
- * @param str $message User message
- * @param str $level NOTICE | WARNING | ERROR | DEBUG
+ * @param string $message User message
+ * @param string $level NOTICE | WARNING | ERROR | DEBUG
*
* @return bool
* @since 1.7.0
@@ -1144,9 +1157,11 @@ function elgg_dump($value, $to_screen = TRUE, $level = 'NOTICE') {
global $CONFIG;
// plugin can return false to stop the default logging method
- $params = array('level' => $level,
- 'msg' => $value,
- 'to_screen' => $to_screen);
+ $params = array(
+ 'level' => $level,
+ 'msg' => $value,
+ 'to_screen' => $to_screen,
+ );
if (!elgg_trigger_plugin_hook('debug', 'log', $params, true)) {
return;
}
@@ -1172,7 +1187,9 @@ function elgg_dump($value, $to_screen = TRUE, $level = 'NOTICE') {
*
* This function either displays or logs the deprecation message,
* depending upon the deprecation policies in {@link CODING.txt}.
- * Logged messages are sent with the level of 'WARNING'.
+ * Logged messages are sent with the level of 'WARNING'. Only admins
+ * get visual deprecation notices. When non-admins are logged in, the
+ * notices are sent to PHP's log through elgg_dump().
*
* A user-visual message will be displayed if $dep_version is greater
* than 1 minor releases lower than the current Elgg version, or at all
@@ -1183,11 +1200,12 @@ function elgg_dump($value, $to_screen = TRUE, $level = 'NOTICE') {
*
* @see CODING.txt
*
- * @param str $msg Message to log / display.
- * @param str $dep_version Human-readable *release* version: 1.7, 1.7.3
- * @param int $backtrace_level How many levels back to display the backtrace. Useful if calling from
- * functions that are called from other places (like elgg_view()). Set
- * to -1 for a full backtrace.
+ * @param string $msg Message to log / display.
+ * @param string $dep_version Human-readable *release* version: 1.7, 1.8, ...
+ * @param int $backtrace_level How many levels back to display the backtrace.
+ * Useful if calling from functions that are called
+ * from other places (like elgg_view()). Set to -1
+ * for a full backtrace.
*
* @return bool
* @since 1.7.0
@@ -1196,13 +1214,13 @@ function elgg_deprecated_notice($msg, $dep_version, $backtrace_level = 1) {
// if it's a major release behind, visual and logged
// if it's a 1 minor release behind, visual and logged
// if it's for current minor release, logged.
- // bugfixes don't matter because you're not deprecating between them, RIGHT?
+ // bugfixes don't matter because we are not deprecating between them
if (!$dep_version) {
- return FALSE;
+ return false;
}
- $elgg_version = get_version(TRUE);
+ $elgg_version = get_version(true);
$elgg_version_arr = explode('.', $elgg_version);
$elgg_major_version = (int)$elgg_version_arr[0];
$elgg_minor_version = (int)$elgg_version_arr[1];
@@ -1210,16 +1228,16 @@ function elgg_deprecated_notice($msg, $dep_version, $backtrace_level = 1) {
$dep_major_version = (int)$dep_version;
$dep_minor_version = 10 * ($dep_version - $dep_major_version);
- $visual = FALSE;
+ $visual = false;
if (($dep_major_version < $elgg_major_version) ||
($dep_minor_version < $elgg_minor_version)) {
- $visual = TRUE;
+ $visual = true;
}
$msg = "Deprecated in $dep_major_version.$dep_minor_version: $msg";
- if ($visual) {
+ if ($visual && elgg_is_admin_logged_in()) {
register_error($msg);
}
@@ -1247,9 +1265,9 @@ function elgg_deprecated_notice($msg, $dep_version, $backtrace_level = 1) {
$msg .= implode("<br /> -> ", $stack);
- elgg_log($msg, 'WARNING');
+ elgg_dump($msg, elgg_is_admin_logged_in(), 'WARNING');
- return TRUE;
+ return true;
}
/**
@@ -1772,6 +1790,12 @@ function elgg_ajax_page_handler($page) {
unset($page[0]);
$view = implode('/', $page);
+ $allowed_views = elgg_get_config('allowed_ajax_views');
+ if (!array_key_exists($view, $allowed_views)) {
+ header('HTTP/1.1 403 Forbidden');
+ exit;
+ }
+
// pull out GET parameters through filter
$vars = array();
foreach ($_GET as $name => $value) {
@@ -1948,7 +1972,7 @@ function elgg_is_valid_options_for_batch_operation($options, $type) {
// at least one of these is required.
$required = array(
// generic restraints
- 'guid', 'guids', 'limit'
+ 'guid', 'guids'
);
switch ($type) {
@@ -1992,17 +2016,31 @@ function elgg_is_valid_options_for_batch_operation($options, $type) {
*
* @link http://docs.elgg.org/Tutorials/WalledGarden
* @elgg_plugin_hook index system
+ *
+ * @param string $hook The name of the hook
+ * @param string $type The type of hook
+ * @param bool $value Has a plugin already rendered an index page?
+ * @param array $params Array of parameters (should be empty)
* @return bool
* @access private
*/
-function elgg_walled_garden_index() {
- elgg_register_css('elgg.walled_garden', '/css/walled_garden.css');
+function elgg_walled_garden_index($hook, $type, $value, $params) {
+ if ($value) {
+ // do not create a second index page so return
+ return;
+ }
+
elgg_load_css('elgg.walled_garden');
- elgg_register_js('elgg.walled_garden', '/js/walled_garden.js');
elgg_load_js('elgg.walled_garden');
- $body = elgg_view('core/walled_garden/body');
+ $content = elgg_view('core/walled_garden/login');
+ $params = array(
+ 'content' => $content,
+ 'class' => 'elgg-walledgarden-double',
+ 'id' => 'elgg-walledgarden-login',
+ );
+ $body = elgg_view_layout('walled_garden', $params);
echo elgg_view_page('', $body, 'walled_garden');
// return true to prevent other plugins from adding a front page
@@ -2010,6 +2048,24 @@ function elgg_walled_garden_index() {
}
/**
+ * Serve walled garden sections
+ *
+ * @param array $page Array of URL segments
+ * @return string
+ * @access private
+ */
+function _elgg_walled_garden_ajax_handler($page) {
+ $view = $page[0];
+ $params = array(
+ 'content' => elgg_view("core/walled_garden/$view"),
+ 'class' => 'elgg-walledgarden-single hidden',
+ 'id' => str_replace('_', '-', "elgg-walledgarden-$view"),
+ );
+ echo elgg_view_layout('walled_garden', $params);
+ return true;
+}
+
+/**
* Checks the status of the Walled Garden and forwards to a login page
* if required.
*
@@ -2026,6 +2082,11 @@ function elgg_walled_garden_index() {
function elgg_walled_garden() {
global $CONFIG;
+ elgg_register_css('elgg.walled_garden', '/css/walled_garden.css');
+ elgg_register_js('elgg.walled_garden', '/js/walled_garden.js');
+
+ elgg_register_page_handler('walled_garden', '_elgg_walled_garden_ajax_handler');
+
// check for external page view
if (isset($CONFIG->site) && $CONFIG->site instanceof ElggSite) {
$CONFIG->site->checkWalledGarden();
@@ -2033,6 +2094,38 @@ function elgg_walled_garden() {
}
/**
+ * Boots the engine
+ *
+ * 1. sets error handlers
+ * 2. connects to database
+ * 3. verifies the installation suceeded
+ * 4. loads application configuration
+ * 5. loads i18n data
+ * 6. loads site configuration
+ *
+ * @access private
+ */
+function _elgg_engine_boot() {
+ // Register the error handlers
+ set_error_handler('_elgg_php_error_handler');
+ set_exception_handler('_elgg_php_exception_handler');
+
+ setup_db_connections();
+
+ verify_installation();
+
+ _elgg_load_application_config();
+
+ _elgg_load_site_config();
+
+ _elgg_session_boot();
+
+ _elgg_load_cache();
+
+ _elgg_load_translations();
+}
+
+/**
* Elgg's main init.
*
* Handles core actions for comments, the JS pagehandler, and the shutdown function.
@@ -2058,6 +2151,7 @@ function elgg_init() {
elgg_register_js('jquery.easing', 'vendors/jquery/jquery.easing.1.3.packed.js');
elgg_register_js('elgg.avatar_cropper', 'js/lib/ui.avatar_cropper.js');
elgg_register_js('jquery.imgareaselect', 'vendors/jquery/jquery.imgareaselect-0.9.8/scripts/jquery.imgareaselect.min.js');
+ elgg_register_js('elgg.ui.river', 'js/lib/ui.river.js');
elgg_register_css('jquery.imgareaselect', 'vendors/jquery/jquery.imgareaselect-0.9.8/css/imgareaselect-deprecated.css');
@@ -2155,6 +2249,7 @@ define('REFERRER', -1);
define('REFERER', -1);
elgg_register_event_handler('init', 'system', 'elgg_init');
+elgg_register_event_handler('boot', 'system', '_elgg_engine_boot', 1);
elgg_register_plugin_hook_handler('unit_test', 'system', 'elgg_api_test');
elgg_register_event_handler('init', 'system', 'add_custom_menu_items', 1000);
diff --git a/engine/lib/entities.php b/engine/lib/entities.php
index daced6740..d950261a2 100644
--- a/engine/lib/entities.php
+++ b/engine/lib/entities.php
@@ -331,7 +331,7 @@ function remove_subtype($type, $subtype) {
}
/**
- * Update a registered ElggEntity type, subtype, and classname
+ * Update a registered ElggEntity type, subtype, and class name
*
* @param string $type Type
* @param string $subtype Subtype
@@ -340,7 +340,7 @@ function remove_subtype($type, $subtype) {
* @return bool
*/
function update_subtype($type, $subtype, $class = '') {
- global $CONFIG;
+ global $CONFIG, $SUBTYPE_CACHE;
if (!$id = get_subtype_id($type, $subtype)) {
return FALSE;
@@ -348,10 +348,16 @@ function update_subtype($type, $subtype, $class = '') {
$type = sanitise_string($type);
$subtype = sanitise_string($subtype);
- return update_data("UPDATE {$CONFIG->dbprefix}entity_subtypes
+ $result = update_data("UPDATE {$CONFIG->dbprefix}entity_subtypes
SET type = '$type', subtype = '$subtype', class = '$class'
WHERE id = $id
");
+
+ if ($result && isset($SUBTYPE_CACHE[$id])) {
+ $SUBTYPE_CACHE[$id]->class = $class;
+ }
+
+ return $result;
}
/**
@@ -738,6 +744,7 @@ function elgg_entity_exists($guid) {
* Joined with subtypes by AND. See below)
*
* subtypes => NULL|STR entity subtype (SQL: subtype IN ('subtype1', 'subtype2))
+ * Use ELGG_ENTITIES_NO_VALUE for no subtype.
*
* type_subtype_pairs => NULL|ARR (array('type' => 'subtype'))
* (type = '$type' AND subtype = '$subtype') pairs
@@ -923,7 +930,7 @@ function elgg_get_entities(array $options = array()) {
}
if ($options['limit']) {
- $limit = sanitise_int($options['limit']);
+ $limit = sanitise_int($options['limit'], false);
$offset = sanitise_int($options['offset'], false);
$query .= " LIMIT $offset, $limit";
}
@@ -960,8 +967,8 @@ function elgg_get_entity_type_subtype_where_sql($table, $types, $subtypes, $pair
return '';
}
- // these are the only valid types for entities in elgg as defined in the DB.
- $valid_types = array('object', 'user', 'group', 'site');
+ // these are the only valid types for entities in elgg
+ $valid_types = elgg_get_config('entity_types');
// pairs override
$wheres = array();
@@ -1378,34 +1385,33 @@ function disable_entity($guid, $reason = "", $recursive = true) {
}
if ($recursive) {
- // Temporary token overriding access controls
- // @todo Do this better.
- static $__RECURSIVE_DELETE_TOKEN;
- // Make it slightly harder to guess
- $__RECURSIVE_DELETE_TOKEN = md5(elgg_get_logged_in_user_guid());
-
- $sub_entities = get_data("SELECT * from {$CONFIG->dbprefix}entities
- WHERE container_guid=$guid
- or owner_guid=$guid
- or site_guid=$guid", 'entity_row_to_elggstar');
+ $hidden = 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
+ OR site_guid = $guid
+ ) AND enabled='yes'", 'entity_row_to_elggstar');
if ($sub_entities) {
foreach ($sub_entities as $e) {
+ add_entity_relationship($e->guid, 'disabled_with', $entity->guid);
$e->disable($reason);
}
}
-
- $__RECURSIVE_DELETE_TOKEN = null;
+ access_show_hidden_entities($hidden);
+ elgg_set_ignore_access($ia);
}
$entity->disableMetadata();
$entity->disableAnnotations();
- // relationships can't be disabled. hope they join to the entities table.
- //$entity->disableRelationships();
$res = update_data("UPDATE {$CONFIG->dbprefix}entities
- set enabled='no'
- where guid={$guid}");
+ SET enabled = 'no'
+ WHERE guid = $guid");
return $res;
}
@@ -1420,40 +1426,52 @@ function disable_entity($guid, $reason = "", $recursive = true) {
* @warning In order to enable an entity using ElggEntity::enable(),
* you must first use {@link access_show_hidden_entities()}.
*
- * @param int $guid GUID of entity to enable
+ * @param int $guid GUID of entity to enable
+ * @param bool $recursive Recursively enable all entities disabled with the entity?
*
* @return bool
*/
-function enable_entity($guid) {
+function enable_entity($guid, $recursive = true) {
global $CONFIG;
$guid = (int)$guid;
// Override access only visible entities
- $access_status = access_get_show_hidden_status();
+ $old_access_status = access_get_show_hidden_status();
access_show_hidden_entities(true);
+ $result = false;
if ($entity = get_entity($guid)) {
if (elgg_trigger_event('enable', $entity->type, $entity)) {
if ($entity->canEdit()) {
- access_show_hidden_entities($access_status);
-
$result = update_data("UPDATE {$CONFIG->dbprefix}entities
- set enabled='yes'
- where guid={$guid}");
+ SET enabled = 'yes'
+ WHERE guid = $guid");
$entity->deleteMetadata('disable_reason');
$entity->enableMetadata();
$entity->enableAnnotations();
- return $result;
+ if ($recursive) {
+ $disabled_with_it = elgg_get_entities_from_relationship(array(
+ 'relationship' => 'disabled_with',
+ 'relationship_guid' => $entity->guid,
+ 'inverse_relationship' => true,
+ 'limit' => 0,
+ ));
+
+ foreach ($disabled_with_it as $e) {
+ $e->enable();
+ remove_entity_relationship($e->guid, 'disabled_with', $entity->guid);
+ }
+ }
}
}
}
- access_show_hidden_entities($access_status);
- return false;
+ access_show_hidden_entities($old_access_status);
+ return $result;
}
/**
@@ -1510,18 +1528,23 @@ 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
- or site_guid=$guid", 'entity_row_to_elggstar');
- if ($sub_entities) {
- foreach ($sub_entities as $e) {
- // check for equality so that an entity that is its own
- // owner or container does not cause infinite loop
- if ($e->guid != $guid) {
- $e->delete(true);
- }
- }
+
+ // @todo there was logic in the original code that ignored
+ // entities with owner or container guids of themselves.
+ // this should probably be prevented in ElggEntity instead of checked for here
+ $options = array(
+ 'wheres' => array(
+ "((container_guid = $guid OR owner_guid = $guid OR site_guid = $guid)"
+ . " AND guid != $guid)"
+ ),
+ 'limit' => 0
+ );
+
+ $batch = new ElggBatch('elgg_get_entities', $options);
+ $batch->setIncrementOffset(false);
+
+ foreach ($batch as $e) {
+ $e->delete(true);
}
access_show_hidden_entities($entity_disable_override);
@@ -1751,7 +1774,7 @@ function import_entity_plugin_hook($hook, $entity_type, $returnvalue, $params) {
if ($tmp) {
// Make sure its saved
if (!$tmp->save()) {
- elgg_echo('ImportException:ProblemSaving', array($element->getAttribute('uuid')));
+ $msg = elgg_echo('ImportException:ProblemSaving', array($element->getAttribute('uuid')));
throw new ImportException($msg);
}
@@ -1955,7 +1978,7 @@ function elgg_register_entity_type($type, $subtype = null) {
global $CONFIG;
$type = strtolower($type);
- if (!in_array($type, array('object', 'site', 'group', 'user'))) {
+ if (!in_array($type, $CONFIG->entity_types)) {
return FALSE;
}
@@ -1990,7 +2013,7 @@ function unregister_entity_type($type, $subtype) {
global $CONFIG;
$type = strtolower($type);
- if (!in_array($type, array('object', 'site', 'group', 'user'))) {
+ if (!in_array($type, $CONFIG->entity_types)) {
return FALSE;
}
@@ -2158,31 +2181,8 @@ function elgg_list_registered_entities(array $options = array()) {
$entities = array();
}
- return elgg_view_entity_list($entities, $count, $options['offset'],
- $options['limit'], $options['full_view'], $options['list_type_toggle'], $options['pagination']);
-}
-
-/**
- * Check the recursive delete permissions token.
- *
- * If an entity is deleted recursively, a permissions override is required to allow
- * contained or owned entities to be removed.
- *
- * @return bool
- * @elgg_plugin_hook_handler permissions_check all
- * @elgg_plugin_hook_handler permissions_check:metadata all
- * @access private
- */
-function recursive_delete_permissions_check() {
- static $__RECURSIVE_DELETE_TOKEN;
-
- if ((elgg_is_logged_in()) && ($__RECURSIVE_DELETE_TOKEN)
- && (strcmp($__RECURSIVE_DELETE_TOKEN, md5(elgg_get_logged_in_user_guid())))) {
- return true;
- }
-
- // consult next function
- return NULL;
+ $options['count'] = $count;
+ return elgg_view_entity_list($entities, $options);
}
/**
@@ -2299,11 +2299,6 @@ function entities_init() {
elgg_register_plugin_hook_handler('unit_test', 'system', 'entities_test');
- // Allow a permission override for recursive entity deletion
- // @todo Can this be done better?
- elgg_register_plugin_hook_handler('permissions_check', 'all', 'recursive_delete_permissions_check');
- elgg_register_plugin_hook_handler('permissions_check:metadata', 'all', 'recursive_delete_permissions_check');
-
elgg_register_plugin_hook_handler('gc', 'system', 'entities_gc');
}
@@ -2318,3 +2313,4 @@ elgg_register_plugin_hook_handler('volatile', 'metadata', 'volatile_data_export_
/** Register init system event **/
elgg_register_event_handler('init', 'system', 'entities_init');
+
diff --git a/engine/lib/extender.php b/engine/lib/extender.php
index 51fc62c30..43421342c 100644
--- a/engine/lib/extender.php
+++ b/engine/lib/extender.php
@@ -105,6 +105,7 @@ function import_extender_plugin_hook($hook, $entity_type, $returnvalue, $params)
// Save
if (!$entity->save()) {
+ $attr_name = $element->getAttribute('name');
$msg = elgg_echo('ImportException:ProblemUpdatingMeta', array($attr_name, $entity_uuid));
throw new ImportException($msg);
}
@@ -120,7 +121,7 @@ function import_extender_plugin_hook($hook, $entity_type, $returnvalue, $params)
* @param string $type 'metadata' or 'annotation'
* @param int $user_guid The GUID of the user
*
- * @return true|false
+ * @return bool
*/
function can_edit_extender($extender_id, $type, $user_guid = 0) {
if (!elgg_is_logged_in()) {
@@ -155,7 +156,7 @@ function can_edit_extender($extender_id, $type, $user_guid = 0) {
}
// Trigger plugin hooks
- $params = array('entity' => $entity, 'user' => $user);
+ $params = array('entity' => $extender->getEntity(), 'user' => $user);
return elgg_trigger_plugin_hook('permissions_check', $type, $params, false);
}
@@ -164,9 +165,9 @@ function can_edit_extender($extender_id, $type, $user_guid = 0) {
* It is recommended that you do not call this directly, instead use
* one of the wrapper functions such as elgg_register_annotation_url_handler().
*
- * @param string $function_name The function to register
* @param string $extender_type Extender type ('annotation', 'metadata')
* @param string $extender_name The name of the extender
+ * @param string $function_name The function to register
*
* @return bool
*/
diff --git a/engine/lib/filestore.php b/engine/lib/filestore.php
index a13d8aa27..93a127257 100644
--- a/engine/lib/filestore.php
+++ b/engine/lib/filestore.php
@@ -18,7 +18,7 @@
*/
function get_dir_size($dir, $totalsize = 0) {
$handle = @opendir($dir);
- while ($file = @readdir ($handle)) {
+ while ($file = @readdir($handle)) {
if (eregi("^\.{1,2}$", $file)) {
continue;
}
@@ -149,6 +149,12 @@ $x1 = 0, $y1 = 0, $x2 = 0, $y2 = 0, $upscale = FALSE) {
return FALSE;
}
+ // color transparencies white (default is black)
+ imagefilledrectangle(
+ $new_image, 0, 0, $params['newwidth'], $params['newheight'],
+ imagecolorallocate($new_image, 255, 255, 255)
+ );
+
$rtn_code = imagecopyresampled( $new_image,
$original_image,
0,
diff --git a/engine/lib/group.php b/engine/lib/group.php
index 29330eeca..feb1f1e7f 100644
--- a/engine/lib/group.php
+++ b/engine/lib/group.php
@@ -261,16 +261,24 @@ function group_gatekeeper($forward = true) {
if ($group = elgg_get_page_owner_entity()) {
if ($group instanceof ElggGroup) {
$url = $group->getURL();
- if (
- ((!elgg_is_logged_in()) && (!$group->isPublicMembership())) ||
- ((!$group->isMember(elgg_get_logged_in_user_entity()) && (!$group->isPublicMembership())))
- ) {
- $allowed = false;
- }
+ if (!$group->isPublicMembership()) {
+ // closed group so must be member or an admin
+
+ if (!elgg_is_logged_in()) {
+ $allowed = false;
+ if ($forward == true) {
+ $_SESSION['last_forward_from'] = current_page_url();
+ register_error(elgg_echo('loggedinrequired'));
+ forward('', 'login');
+ }
+ } else if (!$group->isMember(elgg_get_logged_in_user_entity())) {
+ $allowed = false;
+ }
- // Admin override
- if (elgg_is_admin_logged_in()) {
- $allowed = true;
+ // Admin override
+ if (elgg_is_admin_logged_in()) {
+ $allowed = true;
+ }
}
}
}
diff --git a/engine/lib/input.php b/engine/lib/input.php
index 57e35786f..dda8211b6 100644
--- a/engine/lib/input.php
+++ b/engine/lib/input.php
@@ -188,8 +188,8 @@ function elgg_get_sticky_value($form_name, $variable = '', $default = NULL, $fil
/**
* Get all the values in a sticky form in an array
*
- * @param string $form_name The name of the form
- * @param bool $filter_result Filter for bad input if true
+ * @param string $form_name The name of the form
+ * @param bool $filter_result Filter for bad input if true
*
* @return array
* @since 1.8.0
diff --git a/engine/lib/languages.php b/engine/lib/languages.php
index 0400843af..15c48f902 100644
--- a/engine/lib/languages.php
+++ b/engine/lib/languages.php
@@ -8,6 +8,62 @@
*/
/**
+ * Given a message key, returns an appropriately translated full-text string
+ *
+ * @param string $message_key The short message code
+ * @param array $args An array of arguments to pass through vsprintf().
+ * @param string $language Optionally, the standard language code
+ * (defaults to site/user default, then English)
+ *
+ * @return string Either the translated string, the English string,
+ * or the original language string.
+ */
+function elgg_echo($message_key, $args = array(), $language = "") {
+ global $CONFIG;
+
+ static $CURRENT_LANGUAGE;
+
+ // old param order is deprecated
+ if (!is_array($args)) {
+ elgg_deprecated_notice(
+ 'As of Elgg 1.8, the 2nd arg to elgg_echo() is an array of string replacements and the 3rd arg is the language.',
+ 1.8
+ );
+
+ $language = $args;
+ $args = array();
+ }
+
+ if (!isset($CONFIG->translations)) {
+ // this means we probably had an exception before translations were initialized
+ register_translations(dirname(dirname(dirname(__FILE__))) . "/languages/");
+ }
+
+ if (!$CURRENT_LANGUAGE) {
+ $CURRENT_LANGUAGE = get_language();
+ }
+ if (!$language) {
+ $language = $CURRENT_LANGUAGE;
+ }
+
+ if (isset($CONFIG->translations[$language][$message_key])) {
+ $string = $CONFIG->translations[$language][$message_key];
+ } else if (isset($CONFIG->translations["en"][$message_key])) {
+ $string = $CONFIG->translations["en"][$message_key];
+ } else {
+ $string = $message_key;
+ }
+
+ // only pass through if we have arguments to allow backward compatibility
+ // with manual sprintf() calls.
+ if ($args) {
+ $string = vsprintf($string, $args);
+ }
+
+ return $string;
+}
+
+/**
* Add a translation.
*
* Translations are arrays in the Zend Translation array format, eg:
@@ -82,56 +138,34 @@ function get_language() {
return false;
}
-/**
- * Given a message shortcode, returns an appropriately translated full-text string
- *
- * @param string $message_key The short message code
- * @param array $args An array of arguments to pass through vsprintf().
- * @param string $language Optionally, the standard language code
- * (defaults to site/user default, then English)
- *
- * @return string Either the translated string, the English string,
- * or the original language string.
- */
-function elgg_echo($message_key, $args = array(), $language = "") {
+function _elgg_load_translations() {
global $CONFIG;
- static $CURRENT_LANGUAGE;
-
- // old param order is deprecated
- if (!is_array($args)) {
- elgg_deprecated_notice(
- 'As of Elgg 1.8, the 2nd arg to elgg_echo() is an array of string replacements and the 3rd arg is the language.',
- 1.8
- );
-
- $language = $args;
- $args = array();
- }
+ if ($CONFIG->system_cache_enabled) {
+ $loaded = true;
+ $languages = array_unique(array('en', get_current_language()));
+ foreach ($languages as $language) {
+ $data = elgg_load_system_cache("$language.php");
+ if ($data) {
+ add_translation($language, unserialize($data));
+ } else {
+ $loaded = false;
+ }
+ }
- if (!$CURRENT_LANGUAGE) {
- $CURRENT_LANGUAGE = get_language();
- }
- if (!$language) {
- $language = $CURRENT_LANGUAGE;
+ if ($loaded) {
+ $CONFIG->i18n_loaded_from_cache = true;
+ // this is here to force
+ $CONFIG->language_paths[dirname(dirname(dirname(__FILE__))) . "/languages/"] = true;
+ return;
+ }
}
- if (isset($CONFIG->translations[$language][$message_key])) {
- $string = $CONFIG->translations[$language][$message_key];
- } else if (isset($CONFIG->translations["en"][$message_key])) {
- $string = $CONFIG->translations["en"][$message_key];
- } else {
- $string = $message_key;
- }
+ // load core translations from languages directory
+ register_translations(dirname(dirname(dirname(__FILE__))) . "/languages/");
+}
- // only pass through if we have arguments to allow backward compatibility
- // with manual sprintf() calls.
- if ($args) {
- $string = vsprintf($string, $args);
- }
- return $string;
-}
/**
* When given a full path, finds translation files and loads them
@@ -307,9 +341,7 @@ function get_missing_language_keys($language) {
*/
function elgg_languages_init() {
$lang = get_current_language();
- elgg_register_simplecache_view("cache/js/languages/$lang");
+ elgg_register_simplecache_view("js/languages/$lang");
}
elgg_register_event_handler('init', 'system', 'elgg_languages_init');
-
-register_translations(dirname(dirname(dirname(__FILE__))) . "/languages/");
diff --git a/engine/lib/metadata.php b/engine/lib/metadata.php
index 050e69526..0ff3a43dc 100644
--- a/engine/lib/metadata.php
+++ b/engine/lib/metadata.php
@@ -216,12 +216,11 @@ function update_metadata($id, $name, $value, $value_type, $owner_guid, $access_i
$result = update_data($query);
if ($result !== false) {
+ // @todo this event tells you the metadata has been updated, but does not
+ // let you do anything about it. What is needed is a plugin hook before
+ // the update that passes old and new values.
$obj = elgg_get_metadata_from_id($id);
- if (elgg_trigger_event('update', 'metadata', $obj)) {
- return true;
- } else {
- elgg_delete_metadata_by_id($id);
- }
+ elgg_trigger_event('update', 'metadata', $obj);
}
return $result;
@@ -270,21 +269,18 @@ $access_id = ACCESS_PRIVATE, $allow_multiple = false) {
*
* @param array $options Array in format:
*
- * metadata_names => NULL|ARR metadata names
- *
- * metadata_values => NULL|ARR metadata values
- *
-* metadata_ids => NULL|ARR metadata ids
- *
- * metadata_case_sensitive => BOOL Overall Case sensitive
- *
- * metadata_owner_guids => NULL|ARR guids for metadata owners
- *
- * metadata_created_time_lower => INT Lower limit for created time.
- *
- * metadata_created_time_upper => INT Upper limit for created time.
- *
- * metadata_calculation => STR Perform the MySQL function on the metadata values returned.
+ * metadata_names => NULL|ARR metadata names
+ * metadata_values => NULL|ARR metadata values
+ * metadata_ids => NULL|ARR metadata ids
+ * metadata_case_sensitive => BOOL Overall Case sensitive
+ * metadata_owner_guids => NULL|ARR guids for metadata owners
+ * metadata_created_time_lower => INT Lower limit for created time.
+ * metadata_created_time_upper => INT Upper limit for created time.
+ * metadata_calculation => STR Perform the MySQL function on the metadata values returned.
+ * The "metadata_calculation" option causes this function to
+ * return the result of performing a mathematical calculation on
+ * all metadata that match the query instead of returning
+ * ElggMetadata objects.
*
* @return mixed
* @since 1.8.0
@@ -298,11 +294,13 @@ function elgg_get_metadata(array $options = array()) {
* Deletes metadata based on $options.
*
* @warning Unlike elgg_get_metadata() this will not accept an empty options array!
- * This requires some constraints: metadata_owner_guid(s),
- * metadata_name(s), metadata_value(s), or limit must be set.
+ * This requires at least one constraint: metadata_owner_guid(s),
+ * metadata_name(s), metadata_value(s), or guid(s) must be set.
*
- * @param array $options An options array. {@See elgg_get_metadata()}
- * @return mixed
+ * @warning This returns null on no ops.
+ *
+ * @param array $options An options array. {@see elgg_get_metadata()}
+ * @return mixed Null if the metadata name is invalid. Bool on success or fail.
* @since 1.8.0
*/
function elgg_delete_metadata(array $options) {
@@ -311,7 +309,7 @@ function elgg_delete_metadata(array $options) {
}
$options['metastring_type'] = 'metadata';
- return elgg_batch_metastring_based_objects($options, 'elgg_batch_delete_callback');
+ return elgg_batch_metastring_based_objects($options, 'elgg_batch_delete_callback', false);
}
/**
@@ -319,6 +317,8 @@ function elgg_delete_metadata(array $options) {
*
* @warning Unlike elgg_get_metadata() this will not accept an empty options array!
*
+ * @warning This returns null on no ops.
+ *
* @param array $options An options array. {@See elgg_get_metadata()}
* @return mixed
* @since 1.8.0
@@ -328,8 +328,8 @@ function elgg_disable_metadata(array $options) {
return false;
}
- $options['metastrings_type'] = 'metadata';
- return elgg_batch_metastring_based_objects($options, 'elgg_batch_disable_callback');
+ $options['metastring_type'] = 'metadata';
+ return elgg_batch_metastring_based_objects($options, 'elgg_batch_disable_callback', false);
}
/**
@@ -337,6 +337,8 @@ function elgg_disable_metadata(array $options) {
*
* @warning Unlike elgg_get_metadata() this will not accept an empty options array!
*
+ * @warning This returns null on no ops.
+ *
* @param array $options An options array. {@See elgg_get_metadata()}
* @return mixed
* @since 1.8.0
@@ -403,15 +405,15 @@ function elgg_enable_metadata(array $options) {
*/
function elgg_get_entities_from_metadata(array $options = array()) {
$defaults = array(
- 'metadata_names' => ELGG_ENTITIES_ANY_VALUE,
- 'metadata_values' => ELGG_ENTITIES_ANY_VALUE,
- 'metadata_name_value_pairs' => ELGG_ENTITIES_ANY_VALUE,
+ 'metadata_names' => ELGG_ENTITIES_ANY_VALUE,
+ 'metadata_values' => ELGG_ENTITIES_ANY_VALUE,
+ 'metadata_name_value_pairs' => ELGG_ENTITIES_ANY_VALUE,
- 'metadata_name_value_pairs_operator'=> 'AND',
- 'metadata_case_sensitive' => TRUE,
- 'order_by_metadata' => array(),
+ 'metadata_name_value_pairs_operator' => 'AND',
+ 'metadata_case_sensitive' => TRUE,
+ 'order_by_metadata' => array(),
- 'metadata_owner_guids' => ELGG_ENTITIES_ANY_VALUE,
+ 'metadata_owner_guids' => ELGG_ENTITIES_ANY_VALUE,
);
$options = array_merge($defaults, $options);
@@ -634,7 +636,7 @@ $owner_guids = NULL) {
$i++;
}
- if ($where = implode (" $pair_operator ", $pair_wheres)) {
+ if ($where = implode(" $pair_operator ", $pair_wheres)) {
$wheres[] = "($where)";
}
}
@@ -749,7 +751,7 @@ function export_metadata_plugin_hook($hook, $entity_type, $returnvalue, $params)
/**
* Takes in a comma-separated string and returns an array of tags
- * which have been trimmed and set to lower case
+ * which have been trimmed
*
* @param string $string Comma-separated tag string
*
@@ -758,12 +760,7 @@ function export_metadata_plugin_hook($hook, $entity_type, $returnvalue, $params)
function string_to_tag_array($string) {
if (is_string($string)) {
$ar = explode(",", $string);
- // trim blank spaces
$ar = array_map('trim', $ar);
- // make lower case : [Marcus Povey 20090605 - Using mb wrapper function
- // using UTF8 safe function where available]
- $ar = array_map('elgg_strtolower', $ar);
- // Remove null values
$ar = array_filter($ar, 'is_not_null');
return $ar;
}
@@ -872,8 +869,8 @@ function metadata_update($event, $object_type, $object) {
/**
* Register a metadata url handler.
*
- * @param string $function_name The function.
* @param string $extender_name The name, default 'all'.
+ * @param string $function The function name.
*
* @return bool
*/
diff --git a/engine/lib/metastrings.php b/engine/lib/metastrings.php
index 9fe9b4bff..cf6dd4d98 100644
--- a/engine/lib/metastrings.php
+++ b/engine/lib/metastrings.php
@@ -609,8 +609,7 @@ function elgg_get_metastring_sql($table, $names = null, $values = null,
}
/**
- * Normalizes metadata / annotation option names to their
- * corresponding metastrings name.
+ * Normalizes metadata / annotation option names to their corresponding metastrings name.
*
* @param array $options An options array
* @since 1.8.0
@@ -631,10 +630,10 @@ function elgg_normalize_metastrings_options(array $options = array()) {
// map the metadata_* options to metastring_* options
$map = array(
- 'names' => 'metastring_names',
- 'values' => 'metastring_values',
- 'case_sensitive' => 'metastring_case_sensitive',
- 'owner_guids' => 'metastring_owner_guids',
+ 'names' => 'metastring_names',
+ 'values' => 'metastring_values',
+ 'case_sensitive' => 'metastring_case_sensitive',
+ 'owner_guids' => 'metastring_owner_guids',
'created_time_lower' => 'metastring_created_time_lower',
'created_time_upper' => 'metastring_created_time_upper',
'calculation' => 'metastring_calculation',
@@ -717,21 +716,23 @@ function elgg_set_metastring_based_object_enabled_by_id($id, $enabled, $type) {
* @warning Unlike elgg_get_metastring_based_objects() this will not accept an
* empty options array!
*
- * @param array $options An options array. {@See elgg_get_metastring_based_objects()}
- * @param string $callback The callback to pass each result through
- * @return mixed
+ * @warning This returns null on no ops.
+ *
+ * @param array $options An options array. {@See elgg_get_metastring_based_objects()}
+ * @param string $callback The callback to pass each result through
+ * @param bool $inc_offset Increment the offset? Pass false for callbacks that delete / disable
+ *
+ * @return bool|null true on success, false on failure, null if no objects are found.
* @since 1.8.0
* @access private
*/
-function elgg_batch_metastring_based_objects(array $options, $callback) {
+function elgg_batch_metastring_based_objects(array $options, $callback, $inc_offset = true) {
if (!$options || !is_array($options)) {
return false;
}
- $batch = new ElggBatch('elgg_get_metastring_based_objects', $options, $callback);
- $r = $batch->callbackResult;
-
- return $r;
+ $batch = new ElggBatch('elgg_get_metastring_based_objects', $options, $callback, 50, $inc_offset);
+ return $batch->callbackResult;
}
/**
diff --git a/engine/lib/navigation.php b/engine/lib/navigation.php
index 956ca220a..4ff009bfb 100644
--- a/engine/lib/navigation.php
+++ b/engine/lib/navigation.php
@@ -78,7 +78,11 @@
* link_class => STR A class or classes for the <a> tag
* item_class => STR A class or classes for the <li> tag
*
- * Custom options can be added as key value pairs.
+ * Additional options that the view output/url takes can be
+ * passed in the array. If the 'confirm' key is passed, the
+ * menu link uses the 'output/confirmlink' view. Custom
+ * options can be added by using the 'data' key with the
+ * value being an associative array.
*
* @return bool
* @since 1.8.0
@@ -226,7 +230,7 @@ function elgg_pop_breadcrumb() {
global $CONFIG;
if (is_array($CONFIG->breadcrumbs)) {
- array_pop($CONFIG->breadcrumbs);
+ return array_pop($CONFIG->breadcrumbs);
}
return FALSE;
@@ -301,7 +305,7 @@ function elgg_site_menu_setup($hook, $type, $return, $params) {
// if only one item on more menu, stick it with the rest
$num_menu_items = count($return['default']);
if ($num_menu_items > ($max_display_items + 1)) {
- $return['more'] = array_splice($return['default'], $max_display_items);
+ $return['more'] = array_splice($return['default'], $max_display_items);
}
}
diff --git a/engine/lib/notification.php b/engine/lib/notification.php
index eb7e594c6..5a2f5f8ac 100644
--- a/engine/lib/notification.php
+++ b/engine/lib/notification.php
@@ -487,6 +487,7 @@ function object_notifications($event, $object_type, $object) {
// (Person defined by container_guid so we can also subscribe to groups if we want)
foreach ($NOTIFICATION_HANDLERS as $method => $foo) {
$interested_users = elgg_get_entities_from_relationship(array(
+ 'site_guids' => ELGG_ENTITIES_ANY_VALUE,
'relationship' => 'notify' . $method,
'relationship_guid' => $object->container_guid,
'inverse_relationship' => TRUE,
diff --git a/engine/lib/objects.php b/engine/lib/objects.php
index 63d0f5cef..f186c66cb 100644
--- a/engine/lib/objects.php
+++ b/engine/lib/objects.php
@@ -52,11 +52,8 @@ function create_object_entity($guid, $title, $description) {
if ($result != false) {
// Update succeeded, continue
$entity = get_entity($guid);
- if (elgg_trigger_event('update', $entity->type, $entity)) {
- return $guid;
- } else {
- $entity->delete();
- }
+ elgg_trigger_event('update', $entity->type, $entity);
+ return $guid;
}
} else {
// Update failed, attempt an insert.
diff --git a/engine/lib/output.php b/engine/lib/output.php
index 6554481f5..b1245a924 100644
--- a/engine/lib/output.php
+++ b/engine/lib/output.php
@@ -67,7 +67,7 @@ function autop($pee, $br = 1) {
$pee = preg_replace('/\n?(.+?)(?:\n\s*\n|\z)/s', "<p>$1</p>\n", $pee); // make paragraphs, including one at the end
$pee = preg_replace('|<p>\s*?</p>|', '', $pee); // under certain strange conditions it could create a P of entirely whitespace
$pee = preg_replace('!<p>([^<]+)\s*?(</(?:div|address|form)[^>]*>)!', "<p>$1</p>$2", $pee);
- $pee = preg_replace( '|<p>|', "$1<p>", $pee );
+ $pee = preg_replace('|<p>|', "$1<p>", $pee);
$pee = preg_replace('!<p>\s*(</?' . $allblocks . '[^>]*>)\s*</p>!', "$1", $pee); // don't pee all over a tag
$pee = preg_replace("|<p>(<li.+?)</p>|", "$1", $pee); // problem with nested lists
$pee = preg_replace('|<p><blockquote([^>]*)>|i', "<blockquote$1><p>", $pee);
@@ -81,11 +81,11 @@ function autop($pee, $br = 1) {
}
$pee = preg_replace('!(</?' . $allblocks . '[^>]*>)\s*<br />!', "$1", $pee);
$pee = preg_replace('!<br />(\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)[^>]*>)!', '$1', $pee);
-// if (strpos($pee, '<pre') !== false) {
-// mind the space between the ? and >. Only there because of the comment.
-// $pee = preg_replace_callback('!(<pre.*? >)(.*?)</pre>!is', 'clean_pre', $pee );
-// }
- $pee = preg_replace( "|\n</p>$|", '</p>', $pee );
+ //if (strpos($pee, '<pre') !== false) {
+ // mind the space between the ? and >. Only there because of the comment.
+ // $pee = preg_replace_callback('!(<pre.*? >)(.*?)</pre>!is', 'clean_pre', $pee );
+ //}
+ $pee = preg_replace("|\n</p>$|", '</p>', $pee);
return $pee;
}
@@ -310,15 +310,19 @@ function elgg_get_friendly_title($title) {
return $result;
}
+ // @todo not using this because of locale concerns
//$title = iconv('UTF-8', 'ASCII//TRANSLIT', $title);
+ // @todo this uses a utf8 character class. can use if
+ // we want to support utf8 in the url.
+ //$title = preg_replace('/[^\p{L}\- ]/u', '', $title);
+
// use A-Za-z0-9_ instead of \w because \w is locale sensitive
- $title = preg_replace("/[^A-Za-z0-9_ ]/", "", $title);
- $title = preg_replace("/[^\w ]/", "", $title);
+ $title = preg_replace("/[^A-Za-z0-9_\- ]/", "", $title);
$title = str_replace(" ", "-", $title);
$title = str_replace("--", "-", $title);
$title = trim($title);
- $title = strtolower($title);
+ $title = elgg_strtolower($title);
return $title;
}
diff --git a/engine/lib/pagehandler.php b/engine/lib/pagehandler.php
index ffcfc5b6a..46c7d059e 100644
--- a/engine/lib/pagehandler.php
+++ b/engine/lib/pagehandler.php
@@ -120,6 +120,7 @@ function elgg_unregister_page_handler($handler) {
* @param string $type The type of the hook
* @param bool $result The current value of the hook
* @param array $params Parameters related to the hook
+ * @return void
*/
function elgg_error_page_handler($hook, $type, $result, $params) {
if (elgg_view_exists("errors/$type")) {
@@ -128,7 +129,7 @@ function elgg_error_page_handler($hook, $type, $result, $params) {
$content = elgg_view("errors/default", $params);
}
$body = elgg_view_layout('error', array('content' => $content));
- echo elgg_view_page($title, $body, 'error');
+ echo elgg_view_page('', $body, 'error');
exit;
}
diff --git a/engine/lib/pageowner.php b/engine/lib/pageowner.php
index 9d41d74c1..0cf0e0625 100644
--- a/engine/lib/pageowner.php
+++ b/engine/lib/pageowner.php
@@ -54,7 +54,7 @@ function elgg_get_page_owner_entity() {
* Set the guid of the entity that owns this page
*
* @param int $guid The guid of the page owner
- *
+ * @return void
* @since 1.8.0
*/
function elgg_set_page_owner_guid($guid) {
@@ -173,7 +173,7 @@ function default_page_owner_handler($hook, $entity_type, $returnvalue, $params)
* @warning The context is not available until the page_handler runs (after
* the 'init, system' event processing has completed).
*
- * @param string $context The context of the page
+ * @param string $context The context of the page
* @return bool
* @since 1.8.0
*/
@@ -216,6 +216,7 @@ function elgg_get_context() {
* Push a context onto the top of the stack
*
* @param string $context The context string to add to the context stack
+ * @return void
* @since 1.8.0
*/
function elgg_push_context($context) {
@@ -244,7 +245,7 @@ function elgg_pop_context() {
* itself differently based on being on the dashboard or profile pages, it
* can check the stack.
*
- * @param string $context The context string to check for
+ * @param string $context The context string to check for
* @return bool
* @since 1.8.0
*/
diff --git a/engine/lib/plugins.php b/engine/lib/plugins.php
index be871d025..d5cd4fe76 100644
--- a/engine/lib/plugins.php
+++ b/engine/lib/plugins.php
@@ -62,7 +62,7 @@ function elgg_get_plugin_ids_in_dir($dir = null) {
$dir = elgg_get_plugins_path();
}
- $plugin_idss = array();
+ $plugin_ids = array();
$handle = opendir($dir);
if ($handle) {
@@ -93,10 +93,13 @@ function elgg_get_plugin_ids_in_dir($dir = null) {
function elgg_generate_plugin_entities() {
$site = get_config('site');
$dir = elgg_get_plugins_path();
+ $db_prefix = elgg_get_config('dbprefix');
$options = array(
'type' => 'object',
'subtype' => 'plugin',
+ 'selects' => array('plugin_oe.*'),
+ 'joins' => array("JOIN {$db_prefix}objects_entity plugin_oe on plugin_oe.guid = e.guid"),
'limit' => ELGG_ENTITIES_NO_VALUE
);
@@ -298,22 +301,20 @@ function elgg_load_plugins() {
// temporary disable all plugins if there is a file called 'disabled' in the plugin dir
if (file_exists("$plugins_path/disabled")) {
+ if (elgg_is_admin_logged_in() && elgg_in_context('admin')) {
+ system_message(elgg_echo('plugins:disabled'));
+ }
return false;
}
- // Load view caches if available
- $cached_view_paths = elgg_filepath_cache_load('views');
- $cached_view_types = elgg_filepath_cache_load('view_types');
- $cached_view_info = is_string($cached_view_paths) && is_string($cached_view_types);
-
- if ($cached_view_info) {
- $CONFIG->views = unserialize($cached_view_paths);
- $CONFIG->view_types = unserialize($cached_view_types);
-
- // don't need to register views
+ if (elgg_get_config('system_cache_loaded')) {
$start_flags = $start_flags & ~ELGG_PLUGIN_REGISTER_VIEWS;
}
+ if (elgg_get_config('i18n_loaded_from_cache')) {
+ $start_flags = $start_flags & ~ELGG_PLUGIN_REGISTER_LANGUAGES;
+ }
+
$return = true;
$plugins = elgg_get_plugins('active');
if ($plugins) {
@@ -332,12 +333,6 @@ function elgg_load_plugins() {
}
}
- // Cache results
- if (!$cached_view_info) {
- elgg_filepath_cache_save('views', serialize($CONFIG->views));
- elgg_filepath_cache_save('view_types', serialize($CONFIG->view_types));
- }
-
return $return;
}
@@ -364,7 +359,11 @@ function elgg_get_plugins($status = 'active', $site_guid = null) {
'type' => 'object',
'subtype' => 'plugin',
'limit' => ELGG_ENTITIES_NO_VALUE,
- 'joins' => array("JOIN {$db_prefix}private_settings ps on ps.entity_guid = e.guid"),
+ 'selects' => array('plugin_oe.*'),
+ 'joins' => array(
+ "JOIN {$db_prefix}private_settings ps on ps.entity_guid = e.guid",
+ "JOIN {$db_prefix}objects_entity plugin_oe on plugin_oe.guid = e.guid"
+ ),
'wheres' => array("ps.name = '$priority'"),
'order_by' => "CAST(ps.value as unsigned), e.guid"
);
@@ -439,9 +438,9 @@ function elgg_set_plugin_priorities(array $order) {
}
}
- // set the missing plugins priorities
+ // set the missing plugins' priorities
if ($return && $missing_plugins) {
- if (!$priority) {
+ if (!isset($priority)) {
$priority = 0;
}
foreach ($missing_plugins as $plugin) {
@@ -480,9 +479,10 @@ function elgg_reindex_plugin_priorities() {
*/
function elgg_namespace_plugin_private_setting($type, $name, $id = null) {
switch ($type) {
-// case 'setting':
-// $name = ELGG_PLUGIN_SETTING_PREFIX . $name;
-// break;
+ // commented out because it breaks $plugin->$name access to variables
+ //case 'setting':
+ // $name = ELGG_PLUGIN_SETTING_PREFIX . $name;
+ // break;
case 'user_setting':
if (!$id) {
diff --git a/engine/lib/private_settings.php b/engine/lib/private_settings.php
index 386af5279..1fa9bdb66 100644
--- a/engine/lib/private_settings.php
+++ b/engine/lib/private_settings.php
@@ -240,7 +240,7 @@ $pairs = NULL, $pair_operator = 'AND', $name_prefix = '') {
$i++;
}
- $where = implode (" $pair_operator ", $pair_wheres);
+ $where = implode(" $pair_operator ", $pair_wheres);
if ($where) {
$wheres[] = "($where)";
}
diff --git a/engine/lib/relationships.php b/engine/lib/relationships.php
index 5b7080b56..f50c4a485 100644
--- a/engine/lib/relationships.php
+++ b/engine/lib/relationships.php
@@ -290,7 +290,7 @@ function elgg_get_entities_from_relationship($options) {
$options['selects'] = array();
}
- $select = array('r.*');
+ $select = array('r.id');
$options['selects'] = array_merge($options['selects'], $select);
}
@@ -399,8 +399,8 @@ function elgg_list_entities_from_relationship_count($options) {
/**
* Sets the URL handler for a particular relationship type
*
- * @param string $function_name The function to register
* @param string $relationship_type The relationship type.
+ * @param string $function_name The function to register
*
* @return bool Depending on success
*/
diff --git a/engine/lib/river.php b/engine/lib/river.php
index 421813441..711832f70 100644
--- a/engine/lib/river.php
+++ b/engine/lib/river.php
@@ -44,12 +44,18 @@ $posted = 0, $annotation_id = 0) {
if ($access_id === "") {
$access_id = $object->access_id;
}
- $annotation_id = (int)$annotation_id;
$type = $object->getType();
$subtype = $object->getSubtype();
+
+ $view = sanitise_string($view);
$action_type = sanitise_string($action_type);
+ $subject_guid = sanitise_int($subject_guid);
+ $object_guid = sanitise_int($object_guid);
+ $access_id = sanitise_int($access_id);
+ $posted = sanitise_int($posted);
+ $annotation_id = sanitise_int($annotation_id);
- $params = array(
+ $values = array(
'type' => $type,
'subtype' => $subtype,
'action_type' => $action_type,
@@ -62,13 +68,13 @@ $posted = 0, $annotation_id = 0) {
);
// return false to stop insert
- $params = elgg_trigger_plugin_hook('creating', 'river', null, $params);
- if ($params == false) {
+ $values = elgg_trigger_plugin_hook('creating', 'river', null, $values);
+ if ($values == false) {
// inserting did not fail - it was just prevented
return true;
}
- extract($params);
+ extract($values);
// Attempt to save river item; return success status
$id = insert_data("insert into {$CONFIG->dbprefix}river " .
@@ -102,7 +108,7 @@ $posted = 0, $annotation_id = 0) {
*
* @warning not checking access (should we?)
*
- * @param array $options
+ * @param array $options Parameters:
* ids => INT|ARR River item id(s)
* subject_guids => INT|ARR Subject guid(s)
* object_guids => INT|ARR Object guid(s)
@@ -209,7 +215,7 @@ function elgg_delete_river(array $options = array()) {
*
* @note If using types and subtypes in a query, they are joined with an AND.
*
- * @param array $options
+ * @param array $options Parameters:
* ids => INT|ARR River item id(s)
* subject_guids => INT|ARR Subject guid(s)
* object_guids => INT|ARR Object guid(s)
@@ -542,7 +548,7 @@ function elgg_river_get_action_where_sql($types) {
/**
* Get the where clause based on river view strings
*
- * @param array $types Array of view strings
+ * @param array $views Array of view strings
*
* @return string
* @since 1.8.0
diff --git a/engine/lib/sessions.php b/engine/lib/sessions.php
index 97a05e2e8..72ca0a1c2 100644
--- a/engine/lib/sessions.php
+++ b/engine/lib/sessions.php
@@ -127,6 +127,10 @@ function elgg_is_admin_user($user_guid) {
/**
* Perform user authentication with a given username and password.
*
+ * @warning This returns an error message on failure. Use the identical operator to check
+ * for access: if (true === elgg_authenticate()) { ... }.
+ *
+ *
* @see login
*
* @param string $username The username
@@ -355,7 +359,7 @@ function logout() {
session_destroy();
// starting a default session to store any post-logout messages.
- session_init(NULL, NULL, NULL);
+ _elgg_session_boot(NULL, NULL, NULL);
$_SESSION['msg'] = $old_msg;
return TRUE;
@@ -372,14 +376,10 @@ function logout() {
*
* @uses $_SESSION
*
- * @param string $event Event name
- * @param string $object_type Object type
- * @param mixed $object Object
- *
* @return bool
* @access private
*/
-function session_init($event, $object_type, $object) {
+function _elgg_session_boot() {
global $DB_PREFIX, $CONFIG;
// Use database for sessions
@@ -444,8 +444,8 @@ function session_init($event, $object_type, $object) {
set_last_action($_SESSION['guid']);
}
- elgg_register_action("login", '', 'public');
- elgg_register_action("logout");
+ elgg_register_action('login', '', 'public');
+ elgg_register_action('logout');
// Register a default PAM handler
register_pam_handler('pam_auth_userpass');
@@ -460,9 +460,6 @@ function session_init($event, $object_type, $object) {
return false;
}
- // Since we have loaded a new user, this user may have different language preferences
- register_translations(dirname(dirname(dirname(__FILE__))) . "/languages/");
-
return true;
}
@@ -654,5 +651,3 @@ function _elgg_session_gc($maxlifetime) {
return true;
}
-
-elgg_register_event_handler("boot", "system", "session_init", 20);
diff --git a/engine/lib/sites.php b/engine/lib/sites.php
index 337b2d180..850092cad 100644
--- a/engine/lib/sites.php
+++ b/engine/lib/sites.php
@@ -231,43 +231,6 @@ function get_site_domain($guid) {
}
/**
- * Initialise site handling
- *
- * Called at the beginning of system running, to set the ID of the current site.
- * This is 0 by default, but plugins may alter this behaviour by attaching functions
- * to the sites init event and changing $CONFIG->site_id.
- *
- * @uses $CONFIG
- *
- * @param string $event Event API required parameter
- * @param string $object_type Event API required parameter
- * @param null $object Event API required parameter
- *
- * @return true
- * @access private
- */
-function sites_boot($event, $object_type, $object) {
- global $CONFIG;
-
- $site = elgg_trigger_plugin_hook("siteid", "system");
- if ($site === null || $site === false) {
- $CONFIG->site_id = (int) datalist_get('default_site');
- } else {
- $CONFIG->site_id = $site;
- }
- $CONFIG->site_guid = $CONFIG->site_id;
- $CONFIG->site = get_entity($CONFIG->site_guid);
-
- return true;
-}
-
-// Register event handlers
-elgg_register_event_handler('boot', 'system', 'sites_boot', 2);
-
-// Register with unit test
-elgg_register_plugin_hook_handler('unit_test', 'system', 'sites_test');
-
-/**
* Unit tests for sites
*
* @param sting $hook unit_test
@@ -283,3 +246,6 @@ function sites_test($hook, $type, $value, $params) {
$value[] = "{$CONFIG->path}engine/tests/objects/sites.php";
return $value;
}
+
+// Register with unit test
+elgg_register_plugin_hook_handler('unit_test', 'system', 'sites_test');
diff --git a/engine/lib/statistics.php b/engine/lib/statistics.php
index 7c170f3bb..5ee640549 100644
--- a/engine/lib/statistics.php
+++ b/engine/lib/statistics.php
@@ -95,14 +95,12 @@ function get_number_users($show_deactivated = false) {
* @return string
*/
function get_online_users() {
- $offset = get_input('offset', 0);
- $count = find_active_users(600, 10, $offset, true);
- $objects = find_active_users(600, 10, $offset);
+ $count = find_active_users(600, 10, 0, true);
+ $objects = find_active_users(600, 10);
if ($objects) {
return elgg_view_entity_list($objects, array(
'count' => $count,
- 'offset' => $offset,
'limit' => 10
));
}
diff --git a/engine/lib/system_log.php b/engine/lib/system_log.php
index fd5644135..53fa24557 100644
--- a/engine/lib/system_log.php
+++ b/engine/lib/system_log.php
@@ -11,6 +11,7 @@
* Retrieve the system log based on a number of parameters.
*
* @param int|array $by_user The guid(s) of the user(s) who initiated the event.
+ * Use 0 for unowned entries. Anything else falsey means anyone.
* @param string $event The event you are searching on.
* @param string $class The class of object it effects.
* @param string $type The type
@@ -21,11 +22,12 @@
* @param int $timebefore Lower time limit
* @param int $timeafter Upper time limit
* @param int $object_id GUID of an object
- *
+ * @param str $ip_address The IP address.
* @return mixed
*/
function get_system_log($by_user = "", $event = "", $class = "", $type = "", $subtype = "",
-$limit = 10, $offset = 0, $count = false, $timebefore = 0, $timeafter = 0, $object_id = 0) {
+$limit = 10, $offset = 0, $count = false, $timebefore = 0, $timeafter = 0, $object_id = 0,
+$ip_address = false) {
global $CONFIG;
@@ -37,16 +39,18 @@ $limit = 10, $offset = 0, $count = false, $timebefore = 0, $timeafter = 0, $obje
} else {
$by_user = (int)$by_user;
}
+
$event = sanitise_string($event);
$class = sanitise_string($class);
$type = sanitise_string($type);
$subtype = sanitise_string($subtype);
+ $ip_address = sanitise_string($ip_address);
$limit = (int)$limit;
$offset = (int)$offset;
$where = array();
- if ($by_user_orig !== "") {
+ if ($by_user_orig !== "" && $by_user_orig !== false && $by_user_orig !== null) {
if (is_int($by_user)) {
$where[] = "performed_by_guid=$by_user";
} else if (is_array($by_user)) {
@@ -75,6 +79,9 @@ $limit = 10, $offset = 0, $count = false, $timebefore = 0, $timeafter = 0, $obje
if ($object_id) {
$where[] = "object_id = " . ((int) $object_id);
}
+ if ($ip_address) {
+ $where[] = "ip_address = '$ip_address'";
+ }
$select = "*";
if ($count) {
@@ -91,7 +98,8 @@ $limit = 10, $offset = 0, $count = false, $timebefore = 0, $timeafter = 0, $obje
}
if ($count) {
- if ($numrows = get_data_row($query)) {
+ $numrows = get_data_row($query);
+ if ($numrows) {
return $numrows->count;
}
} else {
@@ -148,9 +156,8 @@ function get_object_from_log_entry($entry_id) {
* This is called by the event system and should not be called directly.
*
* @param object $object The object you're talking about.
- * @param string $event String The event being logged
- *
- * @return mixed
+ * @param string $event The event being logged
+ * @return void
*/
function system_log($object, $event) {
global $CONFIG;
@@ -158,6 +165,12 @@ function system_log($object, $event) {
static $cache_size = 0;
if ($object instanceof Loggable) {
+
+ if (datalist_get('version') < 2012012000) {
+ // this is a site that doesn't have the ip_address column yet
+ return;
+ }
+
// reset cache if it has grown too large
if (!is_array($log_cache) || $cache_size > 500) {
$log_cache = array();
@@ -171,6 +184,7 @@ function system_log($object, $event) {
$object_subtype = $object->getSubtype();
$event = sanitise_string($event);
$time = time();
+ $ip_address = sanitise_string($_SERVER['REMOTE_ADDR']);
$performed_by = elgg_get_logged_in_user_guid();
if (isset($object->access_id)) {
@@ -194,18 +208,16 @@ function system_log($object, $event) {
if (!isset($log_cache[$time][$object_id][$event])) {
$query = "INSERT DELAYED into {$CONFIG->dbprefix}system_log
(object_id, object_class, object_type, object_subtype, event,
- performed_by_guid, owner_guid, access_id, enabled, time_created)
+ performed_by_guid, owner_guid, access_id, enabled, time_created, ip_address)
VALUES
('$object_id','$object_class','$object_type', '$object_subtype', '$event',
- $performed_by, $owner_guid, $access_id, '$enabled', '$time')";
+ $performed_by, $owner_guid, $access_id, '$enabled', '$time', '$ip_address')";
insert_data($query);
$log_cache[$time][$object_id][$event] = true;
$cache_size += 1;
}
-
- return true;
}
}
diff --git a/engine/lib/upgrades/2011010101.php b/engine/lib/upgrades/2011010101.php
index b063c249b..a1ee92622 100644
--- a/engine/lib/upgrades/2011010101.php
+++ b/engine/lib/upgrades/2011010101.php
@@ -66,7 +66,7 @@ if ($old_enabled_plugins) {
// invalidate caches
elgg_invalidate_simplecache();
-elgg_filepath_cache_reset();
+elgg_reset_system_cache();
// clean up.
remove_metadata($site->guid, 'pluginorder');
diff --git a/engine/lib/upgrades/2011030700-1.8_svn-blog_status_metadata-4645225d7b440876.php b/engine/lib/upgrades/2011030700-1.8_svn-blog_status_metadata-4645225d7b440876.php
index e4ab9c137..fe2af9928 100644
--- a/engine/lib/upgrades/2011030700-1.8_svn-blog_status_metadata-4645225d7b440876.php
+++ b/engine/lib/upgrades/2011030700-1.8_svn-blog_status_metadata-4645225d7b440876.php
@@ -9,7 +9,8 @@
$ia = elgg_set_ignore_access(true);
$options = array(
'type' => 'object',
- 'subtype' => 'blog'
+ 'subtype' => 'blog',
+ 'limit' => 0,
);
$batch = new ElggBatch('elgg_get_entities', $options);
diff --git a/engine/lib/upgrades/2011061200-1.8b1-sites_need_a_site_guid-6d9dcbf46c0826cc.php b/engine/lib/upgrades/2011061200-1.8b1-sites_need_a_site_guid-6d9dcbf46c0826cc.php
index 4fc59ac41..41ab29998 100644
--- a/engine/lib/upgrades/2011061200-1.8b1-sites_need_a_site_guid-6d9dcbf46c0826cc.php
+++ b/engine/lib/upgrades/2011061200-1.8b1-sites_need_a_site_guid-6d9dcbf46c0826cc.php
@@ -16,6 +16,7 @@ access_show_hidden_entities(true);
$options = array(
'type' => 'site',
'site_guid' => 0,
+ 'limit' => 0,
);
$batch = new ElggBatch('elgg_get_entities', $options);
diff --git a/engine/lib/upgrades/2011123100-1.8.2-fix_friend_river-b17e7ff8345c2269.php b/engine/lib/upgrades/2011123100-1.8.2-fix_friend_river-b17e7ff8345c2269.php
new file mode 100644
index 000000000..4dc43cd32
--- /dev/null
+++ b/engine/lib/upgrades/2011123100-1.8.2-fix_friend_river-b17e7ff8345c2269.php
@@ -0,0 +1,12 @@
+<?php
+/**
+ * Elgg 1.8.2 upgrade 2011123100
+ * fix_friend_river
+ *
+ * Action type was incorrect due to previoud friends river upgrade
+ */
+
+$query = "UPDATE {$CONFIG->dbprefix}river
+ SET action_type='friend'
+ WHERE view='river/relationship/friend/create' AND action_type='create'";
+update_data($query);
diff --git a/engine/lib/upgrades/2011123101-1.8.2-fix_blog_status-b14c2a0e7b9e7d55.php b/engine/lib/upgrades/2011123101-1.8.2-fix_blog_status-b14c2a0e7b9e7d55.php
new file mode 100644
index 000000000..e351c6ac9
--- /dev/null
+++ b/engine/lib/upgrades/2011123101-1.8.2-fix_blog_status-b14c2a0e7b9e7d55.php
@@ -0,0 +1,25 @@
+<?php
+/**
+ * Elgg 1.8.2 upgrade 2011123101
+ * fix_blog_status
+ *
+ * Most blog posts did not have their status properly set with 1.8 upgrade so we run
+ * the blog status upgrade again
+ */
+
+$ia = elgg_set_ignore_access(true);
+$options = array(
+ 'type' => 'object',
+ 'subtype' => 'blog',
+ 'limit' => 0,
+);
+$batch = new ElggBatch('elgg_get_entities', $options);
+
+foreach ($batch as $entity) {
+ if (!$entity->status) {
+ // create metadata owned by the original owner
+ create_metadata($entity->getGUID(), 'status', 'published', '', $entity->owner_guid,
+ $entity->access_id);
+ }
+}
+elgg_set_ignore_access($ia); \ No newline at end of file
diff --git a/engine/lib/upgrades/2012012000-1.8.3-ip_in_syslog-87fe0f068cf62428.php b/engine/lib/upgrades/2012012000-1.8.3-ip_in_syslog-87fe0f068cf62428.php
new file mode 100644
index 000000000..b9514e156
--- /dev/null
+++ b/engine/lib/upgrades/2012012000-1.8.3-ip_in_syslog-87fe0f068cf62428.php
@@ -0,0 +1,12 @@
+<?php
+/**
+ * Elgg 1.8.3 upgrade 2012012000
+ * ip_in_syslog
+ *
+ * Adds a field for an IP address in the system log table
+ */
+
+$db_prefix = elgg_get_config('dbprefix');
+$q = "ALTER TABLE {$db_prefix}system_log ADD ip_address VARCHAR(15) NOT NULL AFTER time_created";
+
+update_data($q); \ No newline at end of file
diff --git a/engine/lib/upgrades/2012012100-1.8.3-system_cache-93100e7d55a24a11.php b/engine/lib/upgrades/2012012100-1.8.3-system_cache-93100e7d55a24a11.php
new file mode 100644
index 000000000..3a9aae2a1
--- /dev/null
+++ b/engine/lib/upgrades/2012012100-1.8.3-system_cache-93100e7d55a24a11.php
@@ -0,0 +1,13 @@
+<?php
+/**
+ * Elgg 1.8.3 upgrade 2012012100
+ * system_cache
+ *
+ * Convert viewpath cache to system cache
+ */
+
+$value = datalist_get('viewpath_cache_enabled');
+datalist_set('system_cache_enabled', $value);
+
+$query = "DELETE FROM {$CONFIG->dbprefix}datalists WHERE name='viewpath_cache_enabled'";
+delete_data($query);
diff --git a/engine/lib/upgrades/2012041800-1.8.3-dont_filter_passwords-c0ca4a18b38ae2bc.php b/engine/lib/upgrades/2012041800-1.8.3-dont_filter_passwords-c0ca4a18b38ae2bc.php
new file mode 100644
index 000000000..b82ffbebf
--- /dev/null
+++ b/engine/lib/upgrades/2012041800-1.8.3-dont_filter_passwords-c0ca4a18b38ae2bc.php
@@ -0,0 +1,11 @@
+<?php
+/**
+ * Elgg 1.8.3 upgrade 2012041800
+ * dont_filter_passwords
+ *
+ * Add admin notice that password handling has changed and if
+ * users can't login to have them reset their passwords.
+ */
+elgg_add_admin_notice('dont_filter_passwords', 'Password handling has been updated to be more secure and flexible. '
+ . 'This change may prevent a small number of users from logging in with their existing passwords. '
+ . 'If a user is unable to log in, please advise him or her to reset their password, or reset it as an admin user.');
diff --git a/engine/lib/upgrades/2012041801-1.8.3-multiple_user_tokens-852225f7fd89f6c5.php b/engine/lib/upgrades/2012041801-1.8.3-multiple_user_tokens-852225f7fd89f6c5.php
new file mode 100644
index 000000000..07732f261
--- /dev/null
+++ b/engine/lib/upgrades/2012041801-1.8.3-multiple_user_tokens-852225f7fd89f6c5.php
@@ -0,0 +1,13 @@
+<?php
+/**
+ * Elgg 1.8.3 upgrade 2012041801
+ * multiple_user_tokens
+ *
+ * Fixes http://trac.elgg.org/ticket/4291
+ * Removes the unique index on users_apisessions for user_guid and site_guid
+ */
+
+$db_prefix = elgg_get_config('dbprefix');
+$q = "ALTER TABLE {$db_prefix}users_apisessions DROP INDEX user_guid,
+ ADD INDEX user_guid (user_guid, site_guid)";
+update_data($q); \ No newline at end of file
diff --git a/engine/lib/user_settings.php b/engine/lib/user_settings.php
index af30d8f0d..e4069fb53 100644
--- a/engine/lib/user_settings.php
+++ b/engine/lib/user_settings.php
@@ -33,9 +33,9 @@ function users_settings_save() {
* @access private
*/
function elgg_set_user_password() {
- $current_password = get_input('current_password');
- $password = get_input('password');
- $password2 = get_input('password2');
+ $current_password = get_input('current_password', null, false);
+ $password = get_input('password', null, false);
+ $password2 = get_input('password2', null, false);
$user_guid = get_input('guid');
if (!$user_guid) {
diff --git a/engine/lib/users.php b/engine/lib/users.php
index 1b3cca799..241b524f9 100644
--- a/engine/lib/users.php
+++ b/engine/lib/users.php
@@ -60,13 +60,12 @@ function create_user_entity($guid, $name, $username, $password, $salt, $email, $
$row = get_entity_as_row($guid);
if ($row) {
// Exists and you have access to it
-
$query = "SELECT guid from {$CONFIG->dbprefix}users_entity where guid = {$guid}";
if ($exists = get_data_row($query)) {
$query = "UPDATE {$CONFIG->dbprefix}users_entity
- set name='$name', username='$username', password='$password', salt='$salt',
- email='$email', language='$language', code='$code', last_action = "
- . time() . " where guid = {$guid}";
+ SET name='$name', username='$username', password='$password', salt='$salt',
+ email='$email', language='$language', code='$code'
+ WHERE guid = $guid";
$result = update_data($query);
if ($result != false) {
@@ -79,7 +78,7 @@ function create_user_entity($guid, $name, $username, $password, $salt, $email, $
}
}
} else {
- // Update failed, attempt an insert.
+ // Exists query failed, attempt an insert.
$query = "INSERT into {$CONFIG->dbprefix}users_entity
(guid, name, username, password, salt, email, language, code)
values ($guid, '$name', '$username', '$password', '$salt', '$email', '$language', '$code')";
@@ -90,7 +89,7 @@ function create_user_entity($guid, $name, $username, $password, $salt, $email, $
if (elgg_trigger_event('create', $entity->type, $entity)) {
return $guid;
} else {
- $entity->delete(); //delete_entity($guid);
+ $entity->delete();
}
}
}
@@ -299,13 +298,14 @@ function get_user_sites($user_guid, $limit = 10, $offset = 0) {
$offset = (int)$offset;
return elgg_get_entities_from_relationship(array(
+ 'site_guids' => ELGG_ENTITIES_ANY_VALUE,
'relationship' => 'member_of_site',
'relationship_guid' => $user_guid,
'inverse_relationship' => FALSE,
'types' => 'site',
'limit' => $limit,
- 'offset' => $offset)
- );
+ 'offset' => $offset,
+ ));
}
/**
@@ -497,20 +497,26 @@ $timelower = 0, $timeupper = 0) {
* @param int $timelower The earliest time the entity can have been created. Default: all
* @param int $timeupper The latest time the entity can have been created. Default: all
*
- * @return string The list in a form suitable to display
+ * @return string
*/
function list_user_friends_objects($user_guid, $subtype = "", $limit = 10, $full_view = true,
$listtypetoggle = true, $pagination = true, $timelower = 0, $timeupper = 0) {
- $offset = (int) get_input('offset');
- $limit = (int) $limit;
- $count = (int) count_user_friends_objects($user_guid, $subtype, $timelower, $timeupper);
+ $offset = (int)get_input('offset');
+ $limit = (int)$limit;
+ $count = (int)count_user_friends_objects($user_guid, $subtype, $timelower, $timeupper);
$entities = get_user_friends_objects($user_guid, $subtype, $limit, $offset,
$timelower, $timeupper);
- return elgg_view_entity_list($entities, $count, $offset, $limit, $full_view,
- $listtypetoggle, $pagination);
+ return elgg_view_entity_list($entities, array(
+ 'count' => $count,
+ 'offset' => $offset,
+ 'limit' => $limit,
+ 'full_view' => $full_view,
+ 'list_type_toggle' => $listtypetoggle,
+ 'pagination' => $pagination,
+ ));
}
/**
@@ -606,11 +612,11 @@ function get_user_by_code($code) {
}
/**
- * Get an array of users from their email addresses
+ * Get an array of users from an email address
*
* @param string $email Email address.
*
- * @return Array of users
+ * @return array
*/
function get_user_by_email($email) {
global $CONFIG;
@@ -630,10 +636,10 @@ function get_user_by_email($email) {
* A function that returns a maximum of $limit users who have done something within the last
* $seconds seconds or the total count of active users.
*
- * @param int $seconds Number of seconds (default 600 = 10min)
- * @param int $limit Limit, default 10.
- * @param int $offset Offset, default 0.
- * @param bool $count Count, default false.
+ * @param int $seconds Number of seconds (default 600 = 10min)
+ * @param int $limit Limit, default 10.
+ * @param int $offset Offset, default 0.
+ * @param bool $count Count, default false.
*
* @return mixed
*/
@@ -804,6 +810,12 @@ function validate_username($username) {
$msg = elgg_echo('registration:usernametooshort', array($CONFIG->minusername));
throw new RegistrationException($msg);
}
+
+ // username in the database has a limit of 128 characters
+ if (strlen($username) > 128) {
+ $msg = elgg_echo('registration:usernametoolong', array(128));
+ throw new RegistrationException($msg);
+ }
// Blacklist for bad characters (partially nicked from mediawiki)
$blacklist = '/[' .
@@ -952,6 +964,7 @@ $allow_multiple_emails = false, $friend_guid = 0, $invitecode = '') {
$user->password = generate_user_password($user, $password);
$user->owner_guid = 0; // Users aren't owned by anyone, even if they are admin created.
$user->container_guid = 0; // Users aren't contained by anyone, even if they are admin created.
+ $user->language = get_current_language();
$user->save();
// If $friend_guid has been set, make mutual friends
@@ -962,8 +975,8 @@ $allow_multiple_emails = false, $friend_guid = 0, $invitecode = '') {
$friend_user->addFriend($user->guid);
// @todo Should this be in addFriend?
- add_to_river('friends/river/create', 'friend', $user->getGUID(), $friend_guid);
- add_to_river('friends/river/create', 'friend', $friend_guid, $user->getGUID());
+ add_to_river('river/relationship/friend/create', 'friend', $user->getGUID(), $friend_guid);
+ add_to_river('river/relationship/friend/create', 'friend', $friend_guid, $user->getGUID());
}
}
}
@@ -1485,7 +1498,7 @@ function users_pagesetup() {
if ($viewer) {
elgg_register_menu_item('topbar', array(
'name' => 'profile',
- 'href' => $viewer->getURL(),
+ 'href' => $viewer->getURL(),
'text' => elgg_view('output/img', array(
'src' => $viewer->getIconURL('topbar'),
'alt' => $viewer->name,
@@ -1544,11 +1557,12 @@ function users_init() {
elgg_register_plugin_hook_handler('register', 'menu:user_hover', 'elgg_user_hover_menu');
elgg_register_action('register', '', 'public');
- elgg_register_action('useradd', '', 'public');
+ elgg_register_action('useradd', '', 'admin');
elgg_register_action('friends/add');
elgg_register_action('friends/remove');
elgg_register_action('avatar/upload');
elgg_register_action('avatar/crop');
+ elgg_register_action('avatar/remove');
elgg_register_action('profile/edit');
elgg_register_action('friends/collections/add');
diff --git a/engine/lib/views.php b/engine/lib/views.php
index b938dd60e..c98ad4e78 100644
--- a/engine/lib/views.php
+++ b/engine/lib/views.php
@@ -103,7 +103,10 @@ function elgg_get_viewtype() {
$viewtype = get_input('view', NULL);
if ($viewtype) {
- return $viewtype;
+ // only word characters allowed.
+ if (!preg_match('[\W]', $viewtype)) {
+ return $viewtype;
+ }
}
if (isset($CONFIG->view) && !empty($CONFIG->view)) {
@@ -196,6 +199,37 @@ function elgg_does_viewtype_fallback($viewtype) {
return FALSE;
}
+/**
+ * Register a view to be available for ajax calls
+ *
+ * @param string $view The view name
+ * @return void
+ * @since 1.8.3
+ */
+function elgg_register_ajax_view($view) {
+ global $CONFIG;
+
+ if (!isset($CONFIG->allowed_ajax_views)) {
+ $CONFIG->allowed_ajax_views = array();
+ }
+
+ $CONFIG->allowed_ajax_views[$view] = true;
+}
+
+/**
+ * Unregister a view for ajax calls
+ *
+ * @param string $view The view name
+ * @return void
+ * @since 1.8.3
+ */
+function elgg_unregister_ajax_view($view) {
+ global $CONFIG;
+
+ if (isset($CONFIG->allowed_ajax_views[$view])) {
+ unset($CONFIG->allowed_ajax_views[$view]);
+ }
+}
/**
* Returns the file location for a view.
@@ -369,7 +403,7 @@ function elgg_view($view, $vars = array(), $bypass = false, $debug = false, $vie
$view_orig = $view;
// Trigger the pagesetup event
- if (!isset($CONFIG->pagesetupdone)) {
+ if (!isset($CONFIG->pagesetupdone) && $CONFIG->boot_complete) {
$CONFIG->pagesetupdone = true;
elgg_trigger_event('pagesetup', 'system');
}
@@ -415,7 +449,6 @@ function elgg_view($view, $vars = array(), $bypass = false, $debug = false, $vie
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'] = '';
@@ -530,7 +563,7 @@ function elgg_view($view, $vars = array(), $bypass = false, $debug = false, $vie
*
* @return void
* @since 1.7.0
- * @link http://docs.elgg.org/Views/Ejxtend
+ * @link http://docs.elgg.org/Views/Extend
* @example views/extend.php
*/
function elgg_extend_view($view, $view_extension, $priority = 501, $viewtype = '') {
@@ -939,12 +972,7 @@ function elgg_view_annotation(ElggAnnotation $annotation, array $vars = array(),
return elgg_view($view, $vars, $bypass, $debug);
}
- // @todo would be better to always make sure name is initialized properly
$name = $annotation->name;
- $intname = (int) $name;
- if ("{$intname}" == "{$name}") {
- $name = get_metastring($intname);
- }
if (empty($name)) {
return false;
}
@@ -1300,21 +1328,18 @@ function elgg_view_form($action, $form_vars = array(), $body_vars = array()) {
* @access private
*/
function elgg_view_list_item($item, array $vars = array()) {
+ global $CONFIG;
- switch ($item->getType()) {
- case 'user':
- case 'object':
- case 'group':
- case 'site':
- return elgg_view_entity($item, $vars);
- case 'annotation':
- return elgg_view_annotation($item, $vars);
- case 'river':
- return elgg_view_river_item($item, $vars);
- default:
- return false;
- break;
+ $type = $item->getType();
+ if (in_array($type, $CONFIG->entity_types)) {
+ return elgg_view_entity($item, $vars);
+ } else if ($type == 'annotation') {
+ return elgg_view_annotation($item, $vars);
+ } else if ($type == 'river') {
+ return elgg_view_river_item($item, $vars);
}
+
+ return false;
}
/**
@@ -1611,6 +1636,8 @@ function elgg_views_boot() {
elgg_register_css('elgg', $elgg_css_url);
elgg_load_css('elgg');
+ elgg_register_ajax_view('js/languages');
+
elgg_register_plugin_hook_handler('output:before', 'layout', 'elgg_views_add_rss_link');
// discover the built-in view types
@@ -1628,16 +1655,16 @@ function elgg_views_boot() {
// set default icon sizes - can be overridden in settings.php or with plugin
if (!elgg_get_config('icon_sizes')) {
$icon_sizes = array(
- 'topbar' => array('w'=>16, 'h'=>16, 'square'=>TRUE, 'upscale'=>TRUE),
- 'tiny' => array('w'=>25, 'h'=>25, 'square'=>TRUE, 'upscale'=>TRUE),
- 'small' => array('w'=>40, 'h'=>40, 'square'=>TRUE, 'upscale'=>TRUE),
- 'medium' => array('w'=>100, 'h'=>100, 'square'=>TRUE, 'upscale'=>TRUE),
- 'large' => array('w'=>200, 'h'=>200, 'square'=>FALSE, 'upscale'=>FALSE),
- 'master' => array('w'=>550, 'h'=>550, 'square'=>FALSE, 'upscale'=>FALSE),
+ 'topbar' => array('w' => 16, 'h' => 16, 'square' => TRUE, 'upscale' => TRUE),
+ 'tiny' => array('w' => 25, 'h' => 25, 'square' => TRUE, 'upscale' => TRUE),
+ 'small' => array('w' => 40, 'h' => 40, 'square' => TRUE, 'upscale' => TRUE),
+ 'medium' => array('w' => 100, 'h' => 100, 'square' => TRUE, 'upscale' => TRUE),
+ 'large' => array('w' => 200, 'h' => 200, 'square' => FALSE, 'upscale' => FALSE),
+ 'master' => array('w' => 550, 'h' => 550, 'square' => FALSE, 'upscale' => FALSE),
);
elgg_set_config('icon_sizes', $icon_sizes);
}
}
-elgg_register_event_handler('boot', 'system', 'elgg_views_boot', 1000);
+elgg_register_event_handler('boot', 'system', 'elgg_views_boot');
elgg_register_event_handler('init', 'system', 'elgg_views_handle_deprecated_views');
diff --git a/engine/lib/web_services.php b/engine/lib/web_services.php
index 1c77b757e..da3ed76a9 100644
--- a/engine/lib/web_services.php
+++ b/engine/lib/web_services.php
@@ -1165,7 +1165,7 @@ function list_all_apis() {
* @access private
*/
function auth_gettoken($username, $password) {
- if (authenticate($username, $password)) {
+ if (true === elgg_authenticate($username, $password)) {
$token = create_user_token($username);
if ($token) {
return $token;
diff --git a/engine/lib/widgets.php b/engine/lib/widgets.php
index 46f34391a..d73dd6330 100644
--- a/engine/lib/widgets.php
+++ b/engine/lib/widgets.php
@@ -316,7 +316,12 @@ function elgg_default_widgets_init() {
// override permissions for creating widget on logged out / just created entities
elgg_register_plugin_hook_handler('container_permissions_check', 'object', 'elgg_default_widgets_permissions_override');
+ // only register the callback once per event
+ $events = array();
foreach ($default_widgets as $info) {
+ $events[$info['event'] . ',' . $info['entity_type']] = $info;
+ }
+ foreach ($events as $info) {
elgg_register_event_handler($info['event'], $info['entity_type'], 'elgg_create_default_widgets');
}
}
diff --git a/engine/schema/mysql.sql b/engine/schema/mysql.sql
index 74cf2ce74..6c6e9db89 100644
--- a/engine/schema/mysql.sql
+++ b/engine/schema/mysql.sql
@@ -361,6 +361,7 @@ CREATE TABLE `prefix_system_log` (
`access_id` int(11) NOT NULL,
`enabled` enum('yes','no') NOT NULL DEFAULT 'yes',
`time_created` int(11) NOT NULL,
+ `ip_address` varchar(15) NOT NULL,
PRIMARY KEY (`id`),
KEY `object_id` (`object_id`),
KEY `object_class` (`object_class`),
diff --git a/engine/settings.example.php b/engine/settings.example.php
index 011770f89..3b139d710 100644
--- a/engine/settings.example.php
+++ b/engine/settings.example.php
@@ -107,7 +107,7 @@ $CONFIG->broken_mta = FALSE;
*
* Elgg stores each query and its results in a query cache.
* On large sites or long-running scripts, this cache can grow to be
- * large. To disable query caching, set this to FALSE.
+ * large. To disable query caching, set this to TRUE.
*
* @global bool $CONFIG->db_disable_query_cache
*/
diff --git a/engine/start.php b/engine/start.php
index 00bdc3197..5f4bded45 100644
--- a/engine/start.php
+++ b/engine/start.php
@@ -1,12 +1,12 @@
<?php
/**
- * Bootstraps and starts the Elgg engine.
+ * Bootstraps the Elgg engine.
*
* This file loads the full Elgg engine, checks the installation
- * state, then emits a series of events to finish booting Elgg:
+ * state, and triggers a series of events to finish booting Elgg:
* - {@elgg_event boot system}
- * - {@elgg_event plugins_boot system}
* - {@elgg_event init system}
+ * - {@elgg_event ready system}
*
* If Elgg is fully uninstalled, the browser will be redirected to an
* installation page.
@@ -36,13 +36,12 @@ $START_MICROTIME = microtime(true);
* Configuration values.
*
* The $CONFIG global contains configuration values required
- * for running Elgg as defined in the settings.php file. The following
- * array keys are defined by core Elgg:
+ * for running Elgg as defined in the settings.php file.
*
- * Plugin authors are encouraged to use get_config() instead of accessing the
- * global directly.
+ * Plugin authors are encouraged to use elgg_get_config() instead of accessing
+ * the global directly.
*
- * @see get_config()
+ * @see elgg_get_config()
* @see engine/settings.php
* @global stdClass $CONFIG
*/
@@ -50,59 +49,39 @@ global $CONFIG;
if (!isset($CONFIG)) {
$CONFIG = new stdClass;
}
+$CONFIG->boot_complete = false;
$lib_dir = dirname(__FILE__) . '/lib/';
-/**
- * The minimum required libs to bootstrap an Elgg installation.
- *
- * @var array
- */
-$required_files = array(
- 'elgglib.php', 'views.php', 'access.php', 'system_log.php', 'export.php',
- 'sessions.php', 'languages.php', 'pageowner.php', 'input.php', 'cache.php',
- 'output.php'
-);
-
-// include bootstraping libs
-foreach ($required_files as $file) {
- $path = $lib_dir . $file;
- if (!include($path)) {
- echo "Could not load file '$path'. "
- . 'Please check your Elgg installation for all required files.';
- exit;
- }
+// Load the bootstrapping library
+$path = $lib_dir . 'elgglib.php';
+if (!include_once($path)) {
+ echo "Could not load file '$path'. Please check your Elgg installation for all required files.";
+ exit;
}
-// Register the error handler
-set_error_handler('_elgg_php_error_handler');
-set_exception_handler('_elgg_php_exception_handler');
-
-/**
- * Load the system settings
- */
+// Load the system settings
if (!include_once(dirname(__FILE__) . "/settings.php")) {
- $msg = elgg_echo('InstallationException:CannotLoadSettings');
+ $msg = 'Elgg could not load the settings file. It does not exist or there is a file permissions issue.';
throw new InstallationException($msg);
}
// load the rest of the library files from engine/lib/
$lib_files = array(
- // these need to be loaded first.
- 'database.php', 'actions.php',
-
- 'admin.php', 'annotations.php', 'calendar.php',
- 'configuration.php', 'cron.php', 'entities.php', 'export.php',
- 'extender.php', 'filestore.php', 'group.php',
- 'location.php', 'mb_wrapper.php', 'memcache.php', 'metadata.php',
- 'metastrings.php', 'navigation.php', 'notification.php', 'objects.php',
- 'opendd.php', 'pagehandler.php', 'pam.php', 'plugins.php',
- 'private_settings.php', 'relationships.php', 'river.php', 'sites.php',
- 'statistics.php', 'tags.php', 'user_settings.php', 'users.php',
- 'upgrade.php', 'web_services.php', 'widgets.php', 'xml.php', 'xml-rpc.php',
+ 'access.php', 'actions.php', 'admin.php', 'annotations.php', 'cache.php',
+ 'calendar.php', 'configuration.php', 'cron.php', 'database.php',
+ 'entities.php', 'export.php', 'extender.php', 'filestore.php', 'group.php',
+ 'input.php', 'languages.php', 'location.php', 'mb_wrapper.php',
+ 'memcache.php', 'metadata.php', 'metastrings.php', 'navigation.php',
+ 'notification.php', 'objects.php', 'opendd.php', 'output.php',
+ 'pagehandler.php', 'pageowner.php', 'pam.php', 'plugins.php',
+ 'private_settings.php', 'relationships.php', 'river.php', 'sessions.php',
+ 'sites.php', 'statistics.php', 'system_log.php', 'tags.php',
+ 'user_settings.php', 'users.php', 'upgrade.php', 'views.php',
+ 'web_services.php', 'widgets.php', 'xml.php', 'xml-rpc.php',
- //backwards compatibility
+ // backward compatibility
'deprecated-1.7.php', 'deprecated-1.8.php',
);
@@ -110,48 +89,24 @@ foreach ($lib_files as $file) {
$file = $lib_dir . $file;
elgg_log("Loading $file...");
if (!include_once($file)) {
- $msg = sprintf(elgg_echo('InstallationException:MissingLibrary'), $file);
+ $msg = "Could not load $file";
throw new InstallationException($msg);
}
}
-// connect to db
-setup_db_connections();
-
-// confirm that the installation completed successfully
-verify_installation();
-
-// Autodetect some default configuration settings
-set_default_config();
-
-// needs to be set for links in html head
-$viewtype = get_input('view', 'default');
-$lastcached = datalist_get("simplecache_lastcached_$viewtype");
-$CONFIG->lastcache = $lastcached;
-
-// Trigger boot events for core. Plugins can't hook
-// into this because they haven't been loaded yet.
+// Connect to database, load language files, load configuration, init session
+// Plugins can't use this event because they haven't been loaded yet.
elgg_trigger_event('boot', 'system');
// Load the plugins that are active
elgg_load_plugins();
+// @todo deprecate as plugins can use 'init', 'system' event
elgg_trigger_event('plugins_boot', 'system');
-// Trigger system init event for plugins
+// Complete the boot process for both engine and plugins
elgg_trigger_event('init', 'system');
-// Regenerate the simple cache if expired.
-// Don't do it on upgrade because upgrade does it itself.
-// @todo - move into function and perhaps run off init system event
-if (!defined('UPGRADING')) {
- $lastupdate = datalist_get("simplecache_lastupdate_$viewtype");
- $lastcached = datalist_get("simplecache_lastcached_$viewtype");
- if ($lastupdate == 0 || $lastcached < $lastupdate) {
- elgg_regenerate_simplecache($viewtype);
- $lastcached = datalist_get("simplecache_lastcached_$viewtype");
- }
- $CONFIG->lastcache = $lastcached;
-}
+$CONFIG->boot_complete = true;
// System loaded and ready
elgg_trigger_event('ready', 'system');
diff --git a/engine/tests/api/annotations.php b/engine/tests/api/annotations.php
index d7551a0fa..947292970 100644
--- a/engine/tests/api/annotations.php
+++ b/engine/tests/api/annotations.php
@@ -43,4 +43,28 @@ class ElggCoreAnnotationAPITest extends ElggCoreUnitTest {
$this->object->delete();
}
+
+ public function testElggDeleteAnnotations() {
+ $e = new ElggObject();
+ $e->save();
+
+ for ($i=0; $i<30; $i++) {
+ $e->annotate('test_annotation', rand(0,10000));
+ }
+
+ $options = array(
+ 'guid' => $e->getGUID(),
+ 'limit' => 0
+ );
+
+ $annotations = elgg_get_annotations($options);
+ $this->assertIdentical(30, count($annotations));
+
+ $this->assertTrue(elgg_delete_annotations($options));
+
+ $annotations = elgg_get_annotations($options);
+ $this->assertTrue(empty($annotations));
+
+ $this->assertTrue($e->delete());
+ }
}
diff --git a/engine/tests/api/helpers.php b/engine/tests/api/helpers.php
index 77205138d..62e4471e0 100644
--- a/engine/tests/api/helpers.php
+++ b/engine/tests/api/helpers.php
@@ -518,4 +518,87 @@ class ElggCoreHelpersTest extends ElggCoreUnitTest {
$this->assertIdentical($elements_sorted_string, $test_elements);
}
+
+ // see http://trac.elgg.org/ticket/4288
+ public function testElggBatchIncOffset() {
+ // normal increment
+ $options = array(
+ 'offset' => 0,
+ 'limit' => 11
+ );
+ $batch = new ElggBatch(array('ElggCoreHelpersTest', 'elgg_batch_callback_test'), $options,
+ null, 5);
+ $j = 0;
+ foreach ($batch as $e) {
+ $offset = floor($j / 5) * 5;
+ $this->assertEqual($offset, $e['offset']);
+ $this->assertEqual($j + 1, $e['index']);
+ $j++;
+ }
+
+ $this->assertEqual(11, $j);
+
+ // no increment, 0 start
+ ElggCoreHelpersTest::elgg_batch_callback_test(array(), true);
+ $options = array(
+ 'offset' => 0,
+ 'limit' => 11
+ );
+ $batch = new ElggBatch(array('ElggCoreHelpersTest', 'elgg_batch_callback_test'), $options,
+ null, 5);
+ $batch->setIncrementOffset(false);
+
+ $j = 0;
+ foreach ($batch as $e) {
+ $this->assertEqual(0, $e['offset']);
+ // should always be the same 5
+ $this->assertEqual($e['index'], $j + 1 - (floor($j / 5) * 5));
+ $j++;
+ }
+ $this->assertEqual(11, $j);
+
+ // no increment, 3 start
+ ElggCoreHelpersTest::elgg_batch_callback_test(array(), true);
+ $options = array(
+ 'offset' => 3,
+ 'limit' => 11
+ );
+ $batch = new ElggBatch(array('ElggCoreHelpersTest', 'elgg_batch_callback_test'), $options,
+ null, 5);
+ $batch->setIncrementOffset(false);
+
+ $j = 0;
+ foreach ($batch as $e) {
+ $this->assertEqual(3, $e['offset']);
+ // same 5 results
+ $this->assertEqual($e['index'], $j + 4 - (floor($j / 5) * 5));
+ $j++;
+ }
+
+ $this->assertEqual(11, $j);
+ }
+
+ static function elgg_batch_callback_test($options, $reset = false) {
+ static $count = 1;
+
+ if ($reset) {
+ $count = 1;
+ return true;
+ }
+
+ if ($count > 20) {
+ return false;
+ }
+
+ for ($j = 0; ($options['limit'] < 5) ? $j < $options['limit'] : $j < 5; $j++) {
+ $return[] = array(
+ 'offset' => $options['offset'],
+ 'limit' => $options['limit'],
+ 'count' => $count++,
+ 'index' => 1 + $options['offset'] + $j
+ );
+ }
+
+ return $return;
+ }
} \ No newline at end of file
diff --git a/engine/tests/api/metadata.php b/engine/tests/api/metadata.php
index f5b615ca8..244036f80 100644
--- a/engine/tests/api/metadata.php
+++ b/engine/tests/api/metadata.php
@@ -43,9 +43,6 @@ class ElggCoreMetadataAPITest extends ElggCoreUnitTest {
{
$this->assertTrue(in_array($string, $this->metastrings));
}
-
- // clean up
- $this->delete_metastrings();
}
public function testElggGetEntitiesFromMetadata() {
@@ -77,7 +74,6 @@ class ElggCoreMetadataAPITest extends ElggCoreUnitTest {
// clean up
$this->object->delete();
- $this->delete_metastrings();
}
public function testElggGetMetadataCount() {
@@ -99,20 +95,111 @@ class ElggCoreMetadataAPITest extends ElggCoreUnitTest {
$this->object->delete();
}
+ public function testElggDeleteMetadata() {
+ $e = new ElggObject();
+ $e->save();
- protected function create_metastring($string) {
- global $CONFIG, $METASTRINGS_CACHE, $METASTRINGS_DEADNAME_CACHE;
- $METASTRINGS_CACHE = $METASTRINGS_DEADNAME_CACHE = array();
+ for ($i=0; $i<30; $i++) {
+ $name = "test_metadata" . rand(0, 10000);
+ $e->$name = rand(0, 10000);
+ }
- mysql_query("INSERT INTO {$CONFIG->dbprefix}metastrings (string) VALUES ('$string')");
- $this->metastrings[$string] = mysql_insert_id();
+ $options = array(
+ 'guid' => $e->getGUID(),
+ 'limit' => 0
+ );
+
+ $md = elgg_get_metadata($options);
+ $this->assertIdentical(30, count($md));
+
+ $this->assertTrue(elgg_delete_metadata($options));
+
+ $md = elgg_get_metadata($options);
+ $this->assertTrue(empty($md));
+
+ $e->delete();
}
- protected function delete_metastrings() {
+ // Make sure metadata with multiple values is correctly deleted when re-written
+ // by another user
+ // http://trac.elgg.org/ticket/2776
+ public function test_elgg_metadata_multiple_values() {
+ $u1 = new ElggUser();
+ $u1->username = rand();
+ $u1->save();
+
+ $u2 = new ElggUser();
+ $u2->username = rand();
+ $u2->save();
+
+ $obj = new ElggObject();
+ $obj->owner_guid = $u1->guid;
+ $obj->container_guid = $u1->guid;
+ $obj->access_id = ACCESS_PUBLIC;
+ $obj->save();
+
+ $md_values = array(
+ 'one',
+ 'two',
+ 'three'
+ );
+
+ // need to fake different logins.
+ // good times without mocking.
+ $original_user = elgg_get_logged_in_user_entity();
+ $_SESSION['user'] = $u1;
+
+ elgg_set_ignore_access(false);
+
+ // add metadata as one user
+ $obj->test = $md_values;
+
+ // check only these md exists
+ $db_prefix = elgg_get_config('dbprefix');
+ $q = "SELECT * FROM {$db_prefix}metadata WHERE entity_guid = $obj->guid";
+ $data = get_data($q);
+
+ $this->assertEqual(count($md_values), count($data));
+ foreach ($data as $md_row) {
+ $md = elgg_get_metadata_from_id($md_row->id);
+ $this->assertTrue(in_array($md->value, $md_values));
+ $this->assertEqual('test', $md->name);
+ }
+
+ // add md w/ same name as a different user
+ $_SESSION['user'] = $u2;
+ $md_values2 = array(
+ 'four',
+ 'five',
+ 'six',
+ 'seven'
+ );
+
+ $obj->test = $md_values2;
+
+ $q = "SELECT * FROM {$db_prefix}metadata WHERE entity_guid = $obj->guid";
+ $data = get_data($q);
+
+ $this->assertEqual(count($md_values2), count($data));
+ foreach ($data as $md_row) {
+ $md = elgg_get_metadata_from_id($md_row->id);
+ $this->assertTrue(in_array($md->value, $md_values2));
+ $this->assertEqual('test', $md->name);
+ }
+
+ $_SESSION['user'] = $original_user;
+
+ $obj->delete();
+ $u1->delete();
+ $u2->delete();
+ }
+
+
+ protected function create_metastring($string) {
global $CONFIG, $METASTRINGS_CACHE, $METASTRINGS_DEADNAME_CACHE;
$METASTRINGS_CACHE = $METASTRINGS_DEADNAME_CACHE = array();
- $strings = implode(', ', $this->metastrings);
- mysql_query("DELETE FROM {$CONFIG->dbprefix}metastrings WHERE id IN ($strings)");
+ mysql_query("INSERT INTO {$CONFIG->dbprefix}metastrings (string) VALUES ('$string')");
+ $this->metastrings[$string] = mysql_insert_id();
}
}
diff --git a/engine/tests/api/metastrings.php b/engine/tests/api/metastrings.php
index a96388217..0a8945084 100644
--- a/engine/tests/api/metastrings.php
+++ b/engine/tests/api/metastrings.php
@@ -132,7 +132,7 @@ class ElggCoreMetastringsTest extends ElggCoreUnitTest {
public function testKeepMeFromDeletingEverything() {
foreach ($this->metastringTypes as $type) {
$required = array(
- 'guid', 'guids', 'limit'
+ 'guid', 'guids'
);
switch ($type) {
@@ -160,6 +160,10 @@ class ElggCoreMetastringsTest extends ElggCoreUnitTest {
$options = array();
$this->assertFalse(elgg_is_valid_options_for_batch_operation($options, $type));
+ // limit alone isn't valid:
+ $options = array('limit' => 10);
+ $this->assertFalse(elgg_is_valid_options_for_batch_operation($options, $type));
+
foreach ($required as $key) {
$options = array();
diff --git a/engine/tests/objects/entities.php b/engine/tests/objects/entities.php
index 1772f7c1a..248b85c9e 100644
--- a/engine/tests/objects/entities.php
+++ b/engine/tests/objects/entities.php
@@ -98,7 +98,7 @@ class ElggCoreEntityTest extends ElggCoreUnitTest {
// check internal metadata array
$metadata = $this->entity->expose_metadata();
- $this->assertIdentical($metadata['existent'], 'testing');
+ $this->assertIdentical($metadata['existent'], array('testing'));
}
public function testElggEnityGetAndSetAnnotations() {
@@ -226,6 +226,39 @@ class ElggCoreEntityTest extends ElggCoreUnitTest {
$this->assertTrue($this->entity->delete());
}
+ public function testElggEntityRecursiveDisableAndEnable() {
+ global $CONFIG;
+
+ $this->save_entity();
+ $obj1 = new ElggObject();
+ $obj1->container_guid = $this->entity->getGUID();
+ $obj1->save();
+ $obj2 = new ElggObject();
+ $obj2->container_guid = $this->entity->getGUID();
+ $obj2->save();
+
+ // disable $obj2 before disabling the container
+ $this->assertTrue($obj2->disable());
+
+ // disable entities container by $this->entity
+ $this->assertTrue($this->entity->disable());
+ $entity = get_data_row("SELECT * FROM {$CONFIG->dbprefix}entities WHERE guid = '{$obj1->guid}'");
+ $this->assertIdentical($entity->enabled, 'no');
+
+ // enable entities that were disabled with the container (but not $obj2)
+ $this->assertTrue($this->entity->enable());
+ $entity = get_data_row("SELECT * FROM {$CONFIG->dbprefix}entities WHERE guid = '{$obj1->guid}'");
+ $this->assertIdentical($entity->enabled, 'yes');
+ $entity = get_data_row("SELECT * FROM {$CONFIG->dbprefix}entities WHERE guid = '{$obj2->guid}'");
+ $this->assertIdentical($entity->enabled, 'no');
+
+ // cleanup
+ $this->assertTrue($obj2->enable());
+ $this->assertTrue($obj2->delete());
+ $this->assertTrue($obj1->delete());
+ $this->assertTrue($this->entity->delete());
+ }
+
public function testElggEntityMetadata() {
// let's delete a non-existent metadata
$this->assertFalse($this->entity->deleteMetadata('important'));
diff --git a/engine/tests/objects/objects.php b/engine/tests/objects/objects.php
index 0d0df6b75..915594e0a 100644
--- a/engine/tests/objects/objects.php
+++ b/engine/tests/objects/objects.php
@@ -194,7 +194,99 @@ class ElggCoreObjectTest extends ElggCoreUnitTest {
$old = elgg_set_ignore_access(true);
}
+ // see http://trac.elgg.org/ticket/1196
+ public function testElggEntityRecursiveDisableWhenLoggedOut() {
+ $e1 = new ElggObject();
+ $e1->access_id = ACCESS_PUBLIC;
+ $e1->owner_guid = 0;
+ $e1->container_guid = 0;
+ $e1->save();
+ $guid1 = $e1->getGUID();
+
+ $e2 = new ElggObject();
+ $e2->container_guid = $guid1;
+ $e2->access_id = ACCESS_PUBLIC;
+ $e2->owner_guid = 0;
+ $e2->save();
+ $guid2 = $e2->getGUID();
+
+ // fake being logged out
+ $user = $_SESSION['user'];
+ unset($_SESSION['user']);
+ $ia = elgg_set_ignore_access(true);
+
+ $this->assertTrue(disable_entity($guid1, null, true));
+
+ // "log in" original user
+ $_SESSION['user'] = $user;
+ elgg_set_ignore_access($ia);
+
+ $this->assertFalse(get_entity($guid1));
+ $this->assertFalse(get_entity($guid2));
+
+ $db_prefix = get_config('dbprefix');
+ $q = "SELECT * FROM {$db_prefix}entities WHERE guid = $guid1";
+ $r = get_data_row($q);
+ $this->assertEqual('no', $r->enabled);
+
+ $q = "SELECT * FROM {$db_prefix}entities WHERE guid = $guid2";
+ $r = get_data_row($q);
+ $this->assertEqual('no', $r->enabled);
+
+ access_show_hidden_entities(true);
+ delete_entity($guid1);
+ delete_entity($guid2);
+ access_show_hidden_entities(false);
+ }
+
+ public function testElggRecursiveDelete() {
+ $types = array('ElggGroup', 'ElggObject', 'ElggUser', 'ElggSite');
+ $db_prefix = elgg_get_config('dbprefix');
+
+ foreach ($types as $type) {
+ $parent = new $type();
+ $this->assertTrue($parent->save());
+
+ $child = new ElggObject();
+ $child->container_guid = $parent->guid;
+ $this->assertTrue($child->save());
+
+ $grandchild = new ElggObject();
+ $grandchild->container_guid = $child->guid;
+ $this->assertTrue($grandchild->save());
+
+ $this->assertTrue($parent->delete(true));
+
+ $q = "SELECT * FROM {$db_prefix}entities WHERE guid = $parent->guid";
+ $r = get_data($q);
+ $this->assertFalse($r);
+
+ $q = "SELECT * FROM {$db_prefix}entities WHERE guid = $child->guid";
+ $r = get_data($q);
+ $this->assertFalse($r);
+ $q = "SELECT * FROM {$db_prefix}entities WHERE guid = $grandchild->guid";
+ $r = get_data($q);
+ $this->assertFalse($r);
+ }
+
+ // object that owns itself
+ // can't check container_guid because of infinite loops in can_edit_entity()
+ $obj = new ElggObject();
+ $obj->save();
+ $obj->owner_guid = $obj->guid;
+ $obj->save();
+
+ $q = "SELECT * FROM {$db_prefix}entities WHERE guid = $obj->guid";
+ $r = get_data_row($q);
+ $this->assertEqual($obj->guid, $r->owner_guid);
+
+ $this->assertTrue($obj->delete(true));
+
+ $q = "SELECT * FROM {$db_prefix}entities WHERE guid = $obj->guid";
+ $r = get_data_row($q);
+ $this->assertFalse($r);
+ }
protected function get_object_row($guid) {
global $CONFIG;
diff --git a/engine/tests/regression/trac_bugs.php b/engine/tests/regression/trac_bugs.php
index 99cf81774..26a45ab6a 100644
--- a/engine/tests/regression/trac_bugs.php
+++ b/engine/tests/regression/trac_bugs.php
@@ -199,4 +199,22 @@ class ElggCoreRegressionBugsTest extends ElggCoreUnitTest {
$this->assertFalse($result);
$this->assertEqual(array(), $DB_DELAYED_QUERIES);
}
+
+ /**
+ * http://trac.elgg.org/ticket/3210 - Don't remove -s in friendly titles
+ * @todo: http://trac.elgg.org/ticket/2276 - improve char encoding
+ */
+ public function test_friendly_title() {
+ $cases = array(
+ 'Simple Test' => 'simple-test',
+ 'Test top-level page' => 'test-top-level-page',
+// 'éclair' => 'éclair',
+// 'English, Español, and 日本語' => 'english-español-and-日本語'
+ );
+
+ foreach ($cases as $case => $expected) {
+ $friendly_title = elgg_get_friendly_title($case);
+ $this->assertIdentical($expected, $friendly_title);
+ }
+ }
}
diff --git a/install/ElggInstaller.php b/install/ElggInstaller.php
index d556ba744..03c84a43e 100644
--- a/install/ElggInstaller.php
+++ b/install/ElggInstaller.php
@@ -391,7 +391,7 @@ class ElggInstaller {
$formVars = array(
'sitename' => array(
'type' => 'text',
- 'value' => 'New Elgg site',
+ 'value' => 'My New Community',
'required' => TRUE,
),
'siteemail' => array(
@@ -535,8 +535,6 @@ class ElggInstaller {
$params['destination'] = 'index.php';
}
- elgg_invalidate_simplecache();
-
$this->render('complete', $params);
}
@@ -754,6 +752,7 @@ class ElggInstaller {
protected function finishBootstraping($step) {
$dbIndex = array_search('database', $this->getSteps());
+ $settingsIndex = array_search('settings', $this->getSteps());
$adminIndex = array_search('admin', $this->getSteps());
$completeIndex = array_search('complete', $this->getSteps());
$stepIndex = array_search($step, $this->getSteps());
@@ -790,8 +789,8 @@ class ElggInstaller {
'private_settings.php', 'relationships.php', 'river.php',
'sites.php', 'statistics.php', 'tags.php', 'user_settings.php',
'users.php', 'upgrade.php', 'web_services.php',
- 'widgets.php', 'xml.php', 'xml-rpc.php', 'deprecated-1.7.php',
- 'deprecated-1.8.php',
+ 'widgets.php', 'xml.php', 'xml-rpc.php',
+ 'deprecated-1.7.php', 'deprecated-1.8.php',
);
foreach ($lib_files as $file) {
@@ -802,9 +801,17 @@ class ElggInstaller {
}
}
- set_default_config();
+ setup_db_connections();
+ register_translations(dirname(dirname(__FILE__)) . "/languages/");
+
+ if ($stepIndex > $settingsIndex) {
+ $CONFIG->site_guid = (int) datalist_get('default_site');
+ $CONFIG->site_id = $CONFIG->site_guid;
+ $CONFIG->site = get_entity($CONFIG->site_guid);
+ $CONFIG->dataroot = datalist_get('dataroot');
+ _elgg_session_boot(NULL, NULL, NULL);
+ }
- elgg_trigger_event('boot', 'system');
elgg_trigger_event('init', 'system');
}
}
@@ -823,8 +830,10 @@ class ElggInstaller {
$CONFIG->wwwroot = $this->getBaseUrl();
$CONFIG->url = $CONFIG->wwwroot;
$CONFIG->path = dirname(dirname(__FILE__)) . '/';
- $CONFIG->lastcache = 0;
+ $CONFIG->viewpath = $CONFIG->path . 'views/';
+ $CONFIG->pluginspath = $CONFIG->path . 'mod/';
$CONFIG->context = array();
+ $CONFIG->entity_types = array('group', 'object', 'site', 'user');
}
/**
@@ -1328,6 +1337,21 @@ class ElggInstaller {
}
}
+ // check that data root is absolute path
+ if (stripos(PHP_OS, 'win') === 0) {
+ if (strpos($submissionVars['dataroot'], ':') !== 1) {
+ $msg = elgg_echo('install:error:relative_path', array($submissionVars['dataroot']));
+ register_error($msg);
+ return FALSE;
+ }
+ } else {
+ if (strpos($submissionVars['dataroot'], '/') !== 0) {
+ $msg = elgg_echo('install:error:relative_path', array($submissionVars['dataroot']));
+ register_error($msg);
+ return FALSE;
+ }
+ }
+
// check that data root exists
if (!file_exists($submissionVars['dataroot'])) {
$msg = elgg_echo('install:error:datadirectoryexists', array($submissionVars['dataroot']));
@@ -1380,11 +1404,11 @@ class ElggInstaller {
$submissionVars['wwwroot'] = sanitise_filepath($submissionVars['wwwroot']);
$site = new ElggSite();
- $site->name = $submissionVars['sitename'];
- $site->url = $submissionVars['wwwroot'];
+ $site->name = $submissionVars['sitename'];
+ $site->url = $submissionVars['wwwroot'];
$site->access_id = ACCESS_PUBLIC;
- $site->email = $submissionVars['siteemail'];
- $guid = $site->save();
+ $site->email = $submissionVars['siteemail'];
+ $guid = $site->save();
if (!$guid) {
register_error(elgg_echo('install:error:createsite'));
@@ -1401,7 +1425,7 @@ class ElggInstaller {
datalist_set('default_site', $site->getGUID());
datalist_set('version', get_version());
datalist_set('simplecache_enabled', 1);
- datalist_set('viewpath_cache_enabled', 1);
+ datalist_set('system_cache_enabled', 1);
// new installations have run all the upgrades
$upgrades = elgg_get_upgrade_files($submissionVars['path'] . 'engine/lib/upgrades/');
@@ -1416,12 +1440,6 @@ class ElggInstaller {
$this->enablePlugins();
- // reset the views path in case of installing over an old data dir.
- $dataroot = $submissionVars['dataroot'];
- $CONFIG->dataroot = $dataroot;
- $cache = new ElggFileCache($dataroot);
- $cache->delete('view_paths');
-
return TRUE;
}
diff --git a/install/languages/en.php b/install/languages/en.php
index bbcd72d20..3a692e020 100644
--- a/install/languages/en.php
+++ b/install/languages/en.php
@@ -15,6 +15,9 @@ $english = array(
'install:admin' => 'Create admin account',
'install:complete' => 'Finished',
+ 'install:next' => 'Next',
+ 'install:refresh' => 'Refresh',
+
'install:welcome:instructions' => "Installing Elgg has 6 simple steps and reading this welcome is the first one!
If you haven't already, read through the installation instructions included with Elgg (or click the instructions link at the bottom of the page).
@@ -85,7 +88,7 @@ If you are ready to proceed, click the Next button.",
'install:settings:help:siteemail' => 'Email address used by Elgg for communication with users',
'install:settings:help:wwwroot' => 'The address of the site (Elgg usually guesses this correctly)',
'install:settings:help:path' => 'The directory where you put the Elgg code (Elgg usually guesses this correctly)',
- 'install:settings:help:dataroot' => 'The directory that you created for Elgg to save files (the permissions on this directory are checked when you click Next)',
+ 'install:settings:help:dataroot' => 'The directory that you created for Elgg to save files (the permissions on this directory are checked when you click Next). It must be an absolute path.',
'install:settings:help:dataroot:apache' => 'You have the option of Elgg creating the data directory or entering the directory that you already created for storing user files (the permissions on this directory are checked when you click Next)',
'install:settings:help:language' => 'The default language for the site',
'install:settings:help:siteaccess' => 'The default access level for new user created content',
@@ -128,6 +131,7 @@ If you are ready to proceed, click the Next button.",
'install:error:readsettingsphp' => 'Unable to read engine/settings.example.php',
'install:error:writesettingphp' => 'Unable to write engine/settings.php',
'install:error:requiredfield' => '%s is required',
+ 'install:error:relative_path' => 'We don\'t think "%s" is an absoluate path for your data directory',
'install:error:datadirectoryexists' => 'Your data directory %s does not exist.',
'install:error:writedatadirectory' => 'Your data directory %s is not writable by the web server.',
'install:error:locationdatadirectory' => 'Your data directory %s must be outside of your install path for security.',
diff --git a/js/lib/ui.river.js b/js/lib/ui.river.js
new file mode 100644
index 000000000..a56a664a4
--- /dev/null
+++ b/js/lib/ui.river.js
@@ -0,0 +1,14 @@
+elgg.provide('elgg.ui.river');
+
+elgg.ui.river.init = function() {
+ $('#elgg-river-selector').change(function() {
+ var url = window.location.href;
+ if (window.location.search.length) {
+ url = url.substring(0, url.indexOf('?'));
+ }
+ url += '?' + $(this).val();
+ elgg.forward(url);
+ });
+};
+
+elgg.register_hook_handler('init', 'system', elgg.ui.river.init); \ No newline at end of file
diff --git a/js/lib/ui.widgets.js b/js/lib/ui.widgets.js
index 47e43c876..d897564b4 100644
--- a/js/lib/ui.widgets.js
+++ b/js/lib/ui.widgets.js
@@ -15,7 +15,7 @@ elgg.ui.widgets.init = function() {
$(".elgg-widgets").sortable({
items: 'div.elgg-module-widget.elgg-state-draggable',
connectWith: '.elgg-widgets',
- handle: 'div.elgg-head',
+ handle: '.elgg-widget-handle',
forcePlaceholderSize: true,
placeholder: 'elgg-widget-placeholder',
opacity: 0.8,
@@ -29,7 +29,7 @@ elgg.ui.widgets.init = function() {
$('.elgg-widget-edit > form ').live('submit', elgg.ui.widgets.saveSettings);
$('a.elgg-widget-collapse-button').live('click', elgg.ui.widgets.collapseToggle);
- elgg.ui.widgets.equalHeight(".elgg-widgets");
+ elgg.ui.widgets.setMinHeight(".elgg-widgets");
};
/**
@@ -175,22 +175,29 @@ elgg.ui.widgets.saveSettings = function(event) {
};
/**
- * Make all elements have the same min-height
+ * Set the min-height so that all widget column bottoms are the same
*
* This addresses the issue of trying to drag a widget into a column that does
- * not have any widgets.
+ * not have any widgets or many fewer widgets than other columns.
*
* @param {String} selector
* @return void
*/
-elgg.ui.widgets.equalHeight = function(selector) {
- var maxHeight = 0;
+elgg.ui.widgets.setMinHeight = function(selector) {
+ var maxBottom = 0;
$(selector).each(function() {
- if ($(this).height() > maxHeight) {
- maxHeight = $(this).height();
+ var bottom = parseInt($(this).offset().top + $(this).height());
+ if (bottom > maxBottom) {
+ maxBottom = bottom;
+ }
+ })
+ $(selector).each(function() {
+ var bottom = parseInt($(this).offset().top + $(this).height());
+ if (bottom < maxBottom) {
+ var newMinHeight = parseInt($(this).height() + (maxBottom - bottom));
+ $(this).css('min-height', newMinHeight + 'px');
}
})
- $(selector).css('min-height', maxHeight + 'px');
};
elgg.register_hook_handler('init', 'system', elgg.ui.widgets.init);
diff --git a/languages/en.php b/languages/en.php
index 93099c98f..e9c333041 100644
--- a/languages/en.php
+++ b/languages/en.php
@@ -37,6 +37,7 @@ $english = array(
* Errors
*/
'exception:title' => "Fatal Error.",
+ 'exception:contact_admin' => 'An unrecoverable error has occurred and has been logged. Contact the site administrator with the following information:',
'actionundefined' => "The requested action (%s) was not defined in the system.",
'actionnotfound' => "The action file for %s was not found.",
@@ -238,7 +239,8 @@ $english = array(
'pageownerunavailable' => 'Warning: The page owner %d is not accessible!',
'viewfailure' => 'There was an internal failure in the view %s',
'changebookmark' => 'Please change your bookmark for this page',
- 'noaccess' => 'This content has been removed, is invalid, or you do not have permission to view it.',
+ 'noaccess' => 'The content you were trying to view has been removed or you do not have permission to view it.',
+ 'error:missing_data' => 'There was some data missing in your request',
'error:default' => 'Oops...something went wrong.',
'error:404' => 'Sorry. We could not find the page that you requested.',
@@ -270,6 +272,8 @@ $english = array(
'PUBLIC' => "Public",
'access:friends:label' => "Friends",
'access' => "Access",
+ 'access:limited:label' => "Limited",
+ 'access:help' => "The access level",
/**
* Dashboard and widgets
@@ -291,7 +295,7 @@ $english = array(
'widget' => "Widget",
'item:object:widget' => "Widgets",
'widgets:save:success' => "The widget was successfully saved.",
- 'widgets:save:failure' => "We could not save your widget. Please try again.",
+ 'widgets:save:failure' => "We could not save your widget.",
'widgets:add:success' => "The widget was successfully added.",
'widgets:add:failure' => "We could not add your widget.",
'widgets:move:failure' => "We could not store the new widget position.",
@@ -322,12 +326,12 @@ $english = array(
'friend:remove' => "Remove friend",
'friends:add:successful' => "You have successfully added %s as a friend.",
- 'friends:add:failure' => "We couldn't add %s as a friend. Please try again.",
+ 'friends:add:failure' => "We couldn't add %s as a friend.",
'friends:remove:successful' => "You have successfully removed %s from your friends.",
- 'friends:remove:failure' => "We couldn't remove %s from your friends. Please try again.",
+ 'friends:remove:failure' => "We couldn't remove %s from your friends.",
- 'friends:none' => "This user hasn't added anyone as a friend yet.",
+ 'friends:none' => "No friends yet.",
'friends:none:you' => "You don't have any friends yet.",
'friends:none:found' => "No friends were found.",
@@ -363,6 +367,7 @@ $english = array(
'avatar:preview' => 'Preview',
'avatar:upload' => 'Upload a new avatar',
'avatar:current' => 'Current avatar',
+ 'avatar:remove' => 'Remove your avatar and set the default icon',
'avatar:crop:title' => 'Avatar cropping tool',
'avatar:upload:instructions' => "Your avatar is displayed throughout the site. You can change it as often as you'd like. (File formats accepted: GIF, JPG or PNG)",
'avatar:create:instructions' => 'Click and drag a square below to match how you want your avatar cropped. A preview will appear in the box on the right. When you are happy with the preview, click \'Create your avatar\'. This cropped version will be used throughout the site as your avatar.',
@@ -371,6 +376,8 @@ $english = array(
'avatar:resize:fail' => 'Resize of the avatar failed',
'avatar:crop:success' => 'Cropping the avatar succeeded',
'avatar:crop:fail' => 'Avatar cropping failed',
+ 'avatar:remove:success' => 'Removing the avatar succeeded',
+ 'avatar:remove:fail' => 'Avatar remove failed',
'profile:edit' => 'Edit profile',
'profile:aboutme' => "About me",
@@ -405,6 +412,8 @@ $english = array(
'profile:explainchangefields' => "You can replace the existing profile fields with your own using the form below. \n\n Give the new profile field a label, for example, 'Favorite team', then select the field type (eg. text, url, tags), and click the 'Add' button. To re-order the fields drag on the handle next to the field label. To edit a field label - click on the label's text to make it editable. \n\n At any time you can revert back to the default profile set up, but you will lose any information already entered into custom fields on profile pages.",
'profile:editdefault:success' => 'New profile field added',
'profile:editdefault:fail' => 'Default profile could not be saved',
+ 'profile:field_too_long' => 'Cannot save your profile information because the "%s" section is too long.',
+ 'profile:noaccess' => "You do not have permission to edit this profile.",
/**
@@ -443,7 +452,7 @@ $english = array(
* Notifications
*/
'notifications:usersettings' => "Notification settings",
- 'notifications:methods' => "Please specify which methods you want to permit.",
+ 'notifications:methods' => "Select your notification methods.",
'notification:method:email' => 'Email',
'notifications:usersettings:save:ok' => "Your notification settings were successfully saved.",
@@ -496,6 +505,7 @@ $english = array(
'registration:notemail' => 'The email address you provided does not appear to be a valid email address.',
'registration:userexists' => 'That username already exists',
'registration:usernametooshort' => 'Your username must be a minimum of %u characters long.',
+ 'registration:usernametoolong' => 'Your username is too long. It can have a maximum of %u characters.',
'registration:passwordtooshort' => 'The password must be a minimum of %u characters long.',
'registration:dupeemail' => 'This email address has already been registered.',
'registration:invalidchars' => 'Sorry, your username contains the character %s which is invalid. The following characters are invalid: %s',
@@ -555,6 +565,7 @@ $english = array(
'admin:configuration:success' => "Your settings have been saved.",
'admin:configuration:fail' => "Your settings could not be saved.",
+ 'admin:configuration:dataroot:relative_path' => 'Cannot set "%s" as the dataroot because it is not an absolute path.',
'admin:unknown_section' => 'Invalid Admin Section.',
@@ -563,6 +574,7 @@ $english = array(
'admin:statistics' => "Statistics",
'admin:statistics:overview' => 'Overview',
+ 'admin:statistics:server' => 'Server Info',
'admin:appearance' => 'Appearance',
'admin:administer_utilities' => 'Utilities',
@@ -658,6 +670,7 @@ $english = array(
/**
* Plugins
*/
+ 'plugins:disabled' => 'Plugins are not being loaded because a file named "disabled" is in the mod directory.',
'plugins:settings:save:ok' => "Settings for the %s plugin were saved successfully.",
'plugins:settings:save:fail' => "There was a problem saving settings for the %s plugin.",
'plugins:usersettings:save:ok' => "User settings for the %s plugin were saved successfully.",
@@ -721,6 +734,20 @@ $english = array(
'admin:statistics:label:version:release' => "Release",
'admin:statistics:label:version:version' => "Version",
+ 'admin:server:label:php' => 'PHP',
+ 'admin:server:label:web_server' => 'Web Server',
+ 'admin:server:label:server' => 'Server',
+ 'admin:server:label:log_location' => 'Log Location',
+ 'admin:server:label:php_version' => 'PHP version',
+ 'admin:server:label:php_ini' => 'PHP ini file location',
+ 'admin:server:label:php_log' => 'PHP Log',
+ 'admin:server:label:mem_avail' => 'Memory available',
+ 'admin:server:label:mem_used' => 'Memory used',
+ 'admin:server:error_log' => "Web server's error log",
+ 'admin:server:label:post_max_size' => 'POST maximum size',
+ 'admin:server:label:upload_max_filesize' => 'Upload maximum size',
+ 'admin:server:warning:post_max_too_small' => '(Note: post_max_size must be larger than this value to support uploads of this size)',
+
'admin:user:label:search' => "Find users:",
'admin:user:label:searchbutton' => "Search",
@@ -787,7 +814,7 @@ $english = array(
*/
'river:all' => 'All Site Activity',
'river:mine' => 'My Activity',
- 'river:friends' => 'Friends Activty',
+ 'river:friends' => 'Friends Activity',
'river:select' => 'Show %s',
'river:comments:more' => '+%u more',
'river:generic_comment' => 'commented on %s %s',
@@ -840,6 +867,8 @@ $english = array(
'new' => 'New',
'add' => 'Add',
'create' => 'Create',
+ 'remove' => 'Remove',
+ 'revert' => 'Revert',
'site' => 'Site',
'activity' => 'Activity',
@@ -912,6 +941,7 @@ $english = array(
*/
'deleteconfirm' => "Are you sure you want to delete this item?",
+ 'deleteconfirm:plural' => "Are you sure you want to delete these items?",
'fileexists' => "A file has already been uploaded. To replace it, select it below:",
/**
@@ -1013,12 +1043,12 @@ Once you have logged in, we highly recommend that you change your password.
'installation:simplecache:description' => "The simple cache increases performance by caching static content including some CSS and JavaScript files. Normally you will want this on.",
'installation:simplecache:label' => "Use simple cache (recommended)",
- 'installation:viewpathcache:description' => "The view filepath cache decreases the loading times of plugins by caching the location of their views.",
- 'installation:viewpathcache:label' => "Use view filepath cache (recommended)",
+ 'installation:systemcache:description' => "The system cache decreases the loading time of the Elgg engine by caching data to files.",
+ 'installation:systemcache:label' => "Use system cache (recommended)",
'upgrading' => 'Upgrading...',
'upgrade:db' => 'Your database was upgraded.',
- 'upgrade:core' => 'Your elgg installation was upgraded.',
+ 'upgrade:core' => 'Your Elgg installation was upgraded.',
'upgrade:unable_to_upgrade' => 'Unable to upgrade.',
'upgrade:unable_to_upgrade_info' =>
'This installation cannot be upgraded because legacy views
@@ -1110,7 +1140,7 @@ If you requested this, click on the link below. Otherwise ignore this email.
'generic_comment:blank' => "Sorry, you need to actually put something in your comment before we can save it.",
'generic_comment:notfound' => "Sorry, we could not find the specified item.",
'generic_comment:notdeleted' => "Sorry, we could not delete this comment.",
- 'generic_comment:failure' => "An unexpected error occurred when adding your comment. Please try again.",
+ 'generic_comment:failure' => "An unexpected error occurred when adding your comment.",
'generic_comment:none' => 'No comments',
'generic_comment:title' => 'Comment by %s',
@@ -1146,9 +1176,10 @@ You cannot reply to this email.",
* Action gatekeeper
*/
'actiongatekeeper:missingfields' => 'Form is missing __token or __ts fields',
- 'actiongatekeeper:tokeninvalid' => "We encountered an error (token mismatch). This probably means that the page you were using expired. Please try again.",
+ 'actiongatekeeper:tokeninvalid' => "We encountered an error (token mismatch). This probably means that the page you were using expired.",
'actiongatekeeper:timeerror' => 'The page you were using has expired. Please refresh and try again.',
'actiongatekeeper:pluginprevents' => 'A extension has prevented this form from being submitted.',
+ 'actiongatekeeper:uploadexceeded' => 'The size of file(s) uploaded exceeded the limit set by your site administrator',
/**
diff --git a/mod/blog/actions/blog/save.php b/mod/blog/actions/blog/save.php
index 8ca8ce846..8923cd0d2 100644
--- a/mod/blog/actions/blog/save.php
+++ b/mod/blog/actions/blog/save.php
@@ -78,11 +78,8 @@ foreach ($values as $name => $default) {
case 'excerpt':
if ($value) {
- $value = elgg_get_excerpt($value);
- } else {
- $value = elgg_get_excerpt($values['description']);
+ $values[$name] = elgg_get_excerpt($value);
}
- $values[$name] = $value;
break;
case 'container_guid':
@@ -144,7 +141,6 @@ if (!$error) {
system_message(elgg_echo('blog:message:saved'));
$status = $blog->status;
- $db_prefix = elgg_get_config('dbprefix');
// add to river if changing status or published, regardless of new post
// because we remove it for drafts.
diff --git a/mod/blog/classes/ElggBlog.php b/mod/blog/classes/ElggBlog.php
index ee2ec73ef..8d4401c57 100644
--- a/mod/blog/classes/ElggBlog.php
+++ b/mod/blog/classes/ElggBlog.php
@@ -1,6 +1,10 @@
<?php
/**
* Extended class to override the time_created
+ *
+ * @property string $status The published status of the blog post (published, draft)
+ * @property string $comments_on Whether commenting is allowed (Off, On)
+ * @property string $excerpt An excerpt of the blog post used when displaying the post
*/
class ElggBlog extends ElggObject {
diff --git a/mod/blog/languages/en.php b/mod/blog/languages/en.php
index 8a21c1f8d..5248a6f51 100644
--- a/mod/blog/languages/en.php
+++ b/mod/blog/languages/en.php
@@ -41,7 +41,6 @@ $english = array(
'blog:message:saved' => 'Blog post saved.',
'blog:error:cannot_save' => 'Cannot save blog post.',
'blog:error:cannot_write_to_container' => 'Insufficient access to save blog to group.',
- 'blog:error:post_not_found' => 'This post has been removed, is invalid, or you do not have permission to view it.',
'blog:messages:warning:draft' => 'There is an unsaved draft of this post!',
'blog:edit_revision_notice' => '(Old version)',
'blog:message:deleted_post' => 'Blog post deleted.',
@@ -58,6 +57,16 @@ $english = array(
// notifications
'blog:newpost' => 'A new blog post',
+ 'blog:notification' =>
+'
+%s made a new blog post.
+
+%s
+%s
+
+View and comment on the new blog post:
+%s
+',
// widget
'blog:widget:description' => 'Display your latest blog posts',
diff --git a/mod/blog/lib/blog.php b/mod/blog/lib/blog.php
index 590547a8c..43de7a646 100644
--- a/mod/blog/lib/blog.php
+++ b/mod/blog/lib/blog.php
@@ -22,11 +22,11 @@ function blog_get_page_content_read($guid = NULL) {
$return['filter'] = '';
if (!elgg_instanceof($blog, 'object', 'blog')) {
- $return['content'] = elgg_echo('blog:error:post_not_found');
+ $return['content'] = elgg_echo('noaccess');
return $return;
}
- $return['title'] = htmlspecialchars($blog->title);
+ $return['title'] = $blog->title;
$container = $blog->getContainerEntity();
$crumbs_title = $container->name;
@@ -187,11 +187,16 @@ function blog_get_page_content_archive($owner_guid, $lower = 0, $upper = 0) {
$now = time();
- $user = get_user($owner_guid);
+ $owner = get_entity($owner_guid);
elgg_set_page_owner_guid($owner_guid);
- $crumbs_title = $user->name;
- elgg_push_breadcrumb($crumbs_title, "blog/owner/{$user->username}");
+ $crumbs_title = $owner->name;
+ if (elgg_instanceof($owner, 'user')) {
+ $url = "blog/owner/{$owner->username}";
+ } else {
+ $url = "blog/group/$owner->guid/all";
+ }
+ elgg_push_breadcrumb($crumbs_title, $url);
elgg_push_breadcrumb(elgg_echo('blog:archives'));
if ($lower) {
@@ -209,7 +214,7 @@ function blog_get_page_content_archive($owner_guid, $lower = 0, $upper = 0) {
);
if ($owner_guid) {
- $options['owner_guid'] = $owner_guid;
+ $options['container_guid'] = $owner_guid;
}
// admin / owners can see any posts
diff --git a/mod/blog/start.php b/mod/blog/start.php
index fa57e7b96..9faf1794e 100644
--- a/mod/blog/start.php
+++ b/mod/blog/start.php
@@ -60,7 +60,7 @@ function blog_init() {
elgg_extend_view('groups/tool_latest', 'blog/group_module');
// add a blog widget
- elgg_register_widget_type('blog', elgg_echo('blog'), elgg_echo('blog:widget:description'), 'profile');
+ elgg_register_widget_type('blog', elgg_echo('blog'), elgg_echo('blog:widget:description'));
// register actions
$action_path = elgg_get_plugins_path() . 'blog/actions/blog';
@@ -125,6 +125,7 @@ function blog_page_handler($page) {
$params = blog_get_page_content_archive($user->guid, $page[2], $page[3]);
break;
case 'view':
+ case 'read': // Elgg 1.7 compatibility
$params = blog_get_page_content_read($page[1]);
break;
case 'add':
@@ -136,7 +137,11 @@ function blog_page_handler($page) {
$params = blog_get_page_content_edit($page_type, $page[1], $page[2]);
break;
case 'group':
- $params = blog_get_page_content_list($page[1]);
+ if ($page[2] == 'all') {
+ $params = blog_get_page_content_list($page[1]);
+ } else {
+ $params = blog_get_page_content_archive($page[1], $page[3], $page[4]);
+ }
break;
case 'all':
$params = blog_get_page_content_list();
@@ -222,6 +227,33 @@ function blog_entity_menu_setup($hook, $type, $return, $params) {
}
/**
+ * Set the notification message body
+ *
+ * @param string $hook Hook name
+ * @param string $type Hook type
+ * @param string $message The current message body
+ * @param array $params Parameters about the blog posted
+ * @return string
+ */
+function blog_notify_message($hook, $type, $message, $params) {
+ $entity = $params['entity'];
+ $to_entity = $params['to_entity'];
+ $method = $params['method'];
+ if (elgg_instanceof($entity, 'object', 'blog')) {
+ $descr = $entity->excerpt;
+ $title = $entity->title;
+ $owner = $entity->getOwnerEntity();
+ return elgg_echo('blog:notification', array(
+ $owner->name,
+ $title,
+ $descr,
+ $entity->getURL()
+ ));
+ }
+ return null;
+}
+
+/**
* Register blogs with ECML.
*/
function blog_ecml_views_hook($hook, $entity_type, $return_value, $params) {
@@ -234,7 +266,7 @@ function blog_ecml_views_hook($hook, $entity_type, $return_value, $params) {
* Upgrade from 1.7 to 1.8.
*/
function blog_run_upgrades($event, $type, $details) {
- $blog_upgrade_version = get_plugin_setting('upgrade_version', 'blogs');
+ $blog_upgrade_version = elgg_get_plugin_setting('upgrade_version', 'blogs');
if (!$blog_upgrade_version) {
// When upgrading, check if the ElggBlog class has been registered as this
@@ -243,23 +275,6 @@ function blog_run_upgrades($event, $type, $details) {
add_subtype('object', 'blog', 'ElggBlog');
}
- // only run this on the first migration to 1.8
- // add excerpt to all blogs that don't have it.
- $ia = elgg_set_ignore_access(true);
- $options = array(
- 'type' => 'object',
- 'subtype' => 'blog'
- );
-
- $blogs = new ElggBatch('elgg_get_entities', $options);
- foreach ($blogs as $blog) {
- if (!$blog->excerpt) {
- $blog->excerpt = elgg_get_excerpt($blog->description);
- }
- }
-
- elgg_set_ignore_access($ia);
-
elgg_set_plugin_setting('upgrade_version', 1, 'blogs');
}
}
diff --git a/mod/blog/views/default/blog/group_module.php b/mod/blog/views/default/blog/group_module.php
index 028827178..6082cdafd 100644
--- a/mod/blog/views/default/blog/group_module.php
+++ b/mod/blog/views/default/blog/group_module.php
@@ -20,11 +20,12 @@ $options = array(
'type' => 'object',
'subtype' => 'blog',
'container_guid' => elgg_get_page_owner_guid(),
+ 'metadata_name_value_pairs' => array('name' => 'status', 'value' => 'published'),
'limit' => 6,
'full_view' => false,
'pagination' => false,
);
-$content = elgg_list_entities($options);
+$content = elgg_list_entities_from_metadata($options);
elgg_pop_context();
if (!$content) {
diff --git a/mod/blog/views/default/blog/sidebar.php b/mod/blog/views/default/blog/sidebar.php
index 97a23c17e..0ae2b431c 100644
--- a/mod/blog/views/default/blog/sidebar.php
+++ b/mod/blog/views/default/blog/sidebar.php
@@ -18,7 +18,7 @@ if ($vars['page'] == 'all') {
}
// only users can have archives at present
-if (elgg_instanceof(elgg_get_page_owner_entity(), 'user')) {
+if ($vars['page'] == 'owner' || $vars['page'] == 'group') {
echo elgg_view('blog/sidebar/archives', $vars);
}
diff --git a/mod/blog/views/default/blog/sidebar/archives.php b/mod/blog/views/default/blog/sidebar/archives.php
index 3aa3db44f..3d8f28ca4 100644
--- a/mod/blog/views/default/blog/sidebar/archives.php
+++ b/mod/blog/views/default/blog/sidebar/archives.php
@@ -6,6 +6,12 @@
$loggedin_user = elgg_get_logged_in_user_entity();
$page_owner = elgg_get_page_owner_entity();
+if (elgg_instanceof($page_owner, 'user')) {
+ $url_segment = 'blog/archive/' . $page_owner->username;
+} else {
+ $url_segment = 'blog/group/' . $page_owner->getGUID() . '/archive';
+}
+
// This is a limitation of the URL schema.
if ($page_owner && $vars['page'] != 'friends') {
$dates = get_entity_dates('object', 'blog', $page_owner->getGUID());
@@ -13,11 +19,11 @@ if ($page_owner && $vars['page'] != 'friends') {
if ($dates) {
$title = elgg_echo('blog:archives');
$content = '<ul class="blog-archives">';
- foreach($dates as $date) {
+ foreach ($dates as $date) {
$timestamplow = mktime(0, 0, 0, substr($date,4,2) , 1, substr($date, 0, 4));
$timestamphigh = mktime(0, 0, 0, ((int) substr($date, 4, 2)) + 1, 1, substr($date, 0, 4));
- $link = elgg_get_site_url() . 'blog/archive/' . $page_owner->username . '/' . $timestamplow . '/' . $timestamphigh;
+ $link = elgg_get_site_url() . $url_segment . '/' . $timestamplow . '/' . $timestamphigh;
$month = elgg_echo('date:month:' . substr($date, 4, 2), array(substr($date, 0, 4)));
$content .= "<li><a href=\"$link\" title=\"$month\">$month</a></li>";
}
diff --git a/mod/blog/views/default/object/blog.php b/mod/blog/views/default/object/blog.php
index 3525b3d48..4403a6006 100644
--- a/mod/blog/views/default/object/blog.php
+++ b/mod/blog/views/default/object/blog.php
@@ -16,6 +16,9 @@ $owner = $blog->getOwnerEntity();
$container = $blog->getContainerEntity();
$categories = elgg_view('output/categories', $vars);
$excerpt = $blog->excerpt;
+if (!$excerpt) {
+ $excerpt = elgg_get_excerpt($blog->description);
+}
$owner_icon = elgg_view_entity_icon($owner, 'tiny');
$owner_link = elgg_view('output/url', array(
@@ -24,7 +27,6 @@ $owner_link = elgg_view('output/url', array(
'is_trusted' => true,
));
$author_text = elgg_echo('byline', array($owner_link));
-$tags = elgg_view('output/tags', array('tags' => $blog->tags));
$date = elgg_view_friendly_time($blog->time_created);
// The "on" status changes for comments, so best to check for !Off
@@ -71,7 +73,6 @@ if ($full) {
'title' => false,
'metadata' => $metadata,
'subtitle' => $subtitle,
- 'tags' => $tags,
);
$params = $params + $vars;
$summary = elgg_view('object/elements/summary', $params);
@@ -89,7 +90,6 @@ if ($full) {
'entity' => $blog,
'metadata' => $metadata,
'subtitle' => $subtitle,
- 'tags' => $tags,
'content' => $excerpt,
);
$params = $params + $vars;
diff --git a/mod/bookmarks/actions/bookmarks/save.php b/mod/bookmarks/actions/bookmarks/save.php
index f240c4b26..3ca6bef32 100644
--- a/mod/bookmarks/actions/bookmarks/save.php
+++ b/mod/bookmarks/actions/bookmarks/save.php
@@ -5,8 +5,6 @@
* @package Bookmarks
*/
-gatekeeper();
-
$title = strip_tags(get_input('title'));
$description = get_input('description');
$address = get_input('address');
diff --git a/mod/bookmarks/languages/en.php b/mod/bookmarks/languages/en.php
index 2c589c207..d4980280d 100644
--- a/mod/bookmarks/languages/en.php
+++ b/mod/bookmarks/languages/en.php
@@ -23,10 +23,19 @@ $english = array(
'bookmarks:more' => "More",
'bookmarks:with' => "Share with",
'bookmarks:new' => "A new bookmark",
- 'bookmarks:via' => "via bookmarks",
'bookmarks:address' => "Address of the bookmark",
'bookmarks:none' => 'No bookmarks',
+ 'bookmarks:notification' =>
+'%s added a new bookmark:
+
+%s - %s
+%s
+
+View and comment on the new bookmark:
+%s
+',
+
'bookmarks:delete:confirm' => "Are you sure you want to delete this resource?",
'bookmarks:numbertodisplay' => 'Number of bookmarks to display',
diff --git a/mod/bookmarks/pages/bookmarks/all.php b/mod/bookmarks/pages/bookmarks/all.php
index f57776752..bdb8fc793 100644
--- a/mod/bookmarks/pages/bookmarks/all.php
+++ b/mod/bookmarks/pages/bookmarks/all.php
@@ -10,12 +10,10 @@ elgg_push_breadcrumb(elgg_echo('bookmarks'));
elgg_register_title_button();
-$offset = (int)get_input('offset', 0);
$content = elgg_list_entities(array(
'type' => 'object',
'subtype' => 'bookmarks',
'limit' => 10,
- 'offset' => $offset,
'full_view' => false,
'view_toggle_type' => false
));
diff --git a/mod/bookmarks/pages/bookmarks/owner.php b/mod/bookmarks/pages/bookmarks/owner.php
index 7f55e08de..a024ff352 100644
--- a/mod/bookmarks/pages/bookmarks/owner.php
+++ b/mod/bookmarks/pages/bookmarks/owner.php
@@ -14,13 +14,11 @@ elgg_push_breadcrumb($page_owner->name);
elgg_register_title_button();
-$offset = (int)get_input('offset', 0);
$content .= elgg_list_entities(array(
'type' => 'object',
'subtype' => 'bookmarks',
'container_guid' => $page_owner->guid,
'limit' => 10,
- 'offset' => $offset,
'full_view' => false,
'view_toggle_type' => false
));
diff --git a/mod/bookmarks/pages/bookmarks/view.php b/mod/bookmarks/pages/bookmarks/view.php
index 2439d2ee8..c819b8b41 100644
--- a/mod/bookmarks/pages/bookmarks/view.php
+++ b/mod/bookmarks/pages/bookmarks/view.php
@@ -6,6 +6,10 @@
*/
$bookmark = get_entity(get_input('guid'));
+if (!$bookmark) {
+ register_error(elgg_echo('noaccess'));
+ forward('');
+}
$page_owner = elgg_get_page_owner_entity();
diff --git a/mod/bookmarks/start.php b/mod/bookmarks/start.php
index 21a2d8940..56bac984a 100644
--- a/mod/bookmarks/start.php
+++ b/mod/bookmarks/start.php
@@ -245,21 +245,15 @@ function bookmarks_notify_message($hook, $entity_type, $returnvalue, $params) {
if (($entity instanceof ElggEntity) && ($entity->getSubtype() == 'bookmarks')) {
$descr = $entity->description;
$title = $entity->title;
- global $CONFIG;
- $url = elgg_get_site_url() . "view/" . $entity->guid;
- if ($method == 'sms') {
- $owner = $entity->getOwnerEntity();
- return $owner->name . ' ' . elgg_echo("bookmarks:via") . ': ' . $url . ' (' . $title . ')';
- }
- if ($method == 'email') {
- $owner = $entity->getOwnerEntity();
- return $owner->name . ' ' . elgg_echo("bookmarks:via") . ': ' . $title . "\n\n" . $descr . "\n\n" . $entity->getURL();
- }
- if ($method == 'web') {
- $owner = $entity->getOwnerEntity();
- return $owner->name . ' ' . elgg_echo("bookmarks:via") . ': ' . $title . "\n\n" . $descr . "\n\n" . $entity->getURL();
- }
-
+ $owner = $entity->getOwnerEntity();
+
+ return elgg_echo('bookmarks:notification', array(
+ $owner->name,
+ $title,
+ $entity->address,
+ $descr,
+ $entity->getURL()
+ ));
}
return null;
}
diff --git a/mod/bookmarks/views/default/object/bookmarks.php b/mod/bookmarks/views/default/object/bookmarks.php
index 89a0d03e0..83bae2b13 100644
--- a/mod/bookmarks/views/default/object/bookmarks.php
+++ b/mod/bookmarks/views/default/object/bookmarks.php
@@ -27,7 +27,6 @@ $owner_link = elgg_view('output/url', array(
));
$author_text = elgg_echo('byline', array($owner_link));
-$tags = elgg_view('output/tags', array('tags' => $bookmark->tags));
$date = elgg_view_friendly_time($bookmark->time_created);
$comments_count = $bookmark->countComments();
@@ -64,7 +63,6 @@ if ($full && !elgg_in_context('gallery')) {
'title' => false,
'metadata' => $metadata,
'subtitle' => $subtitle,
- 'tags' => $tags,
);
$params = $params + $vars;
$summary = elgg_view('object/elements/summary', $params);
@@ -120,7 +118,6 @@ HTML;
'entity' => $bookmark,
'metadata' => $metadata,
'subtitle' => $subtitle,
- 'tags' => $tags,
'content' => $content,
);
$params = $params + $vars;
diff --git a/mod/categories/languages/en.php b/mod/categories/languages/en.php
index eaa65b13e..422fe81a4 100644
--- a/mod/categories/languages/en.php
+++ b/mod/categories/languages/en.php
@@ -9,7 +9,7 @@ $english = array(
'categories:explanation' => 'To set some predefined site-wide categories that will be used throughout your system, enter them below, separated with commas. Compatible tools will then display them when the user creates or edits content.',
'categories:save:success' => 'Site categories were successfully saved.',
'categories:results' => "Results for the site category: %s",
- 'categories:on_activate_reminder' => "Site-wide Cateogires won't work until you add categories. <a href=\"%s\">Add categories now.</a>",
+ 'categories:on_activate_reminder' => "Site-wide Categories won't work until you add categories. <a href=\"%s\">Add categories now.</a>",
);
add_translation("en", $english); \ No newline at end of file
diff --git a/mod/developers/actions/developers/settings.php b/mod/developers/actions/developers/settings.php
index 811fd22c0..7c91e2f5f 100644
--- a/mod/developers/actions/developers/settings.php
+++ b/mod/developers/actions/developers/settings.php
@@ -11,10 +11,10 @@ if (get_input('simple_cache')) {
elgg_disable_simplecache();
}
-if (get_input('view_path_cache')) {
- elgg_enable_filepath_cache();
+if (get_input('system_cache')) {
+ elgg_enable_system_cache();
} else {
- elgg_disable_filepath_cache();
+ elgg_disable_system_cache();
}
$debug = get_input('debug_level');
diff --git a/mod/developers/languages/en.php b/mod/developers/languages/en.php
index a2682363c..262759e23 100644
--- a/mod/developers/languages/en.php
+++ b/mod/developers/languages/en.php
@@ -9,15 +9,16 @@ $english = array(
'admin:develop_tools' => 'Tools',
'admin:develop_tools:preview' => 'Theming Sandbox',
'admin:develop_tools:inspect' => 'Inspect',
+ 'admin:develop_tools:unit_tests' => 'Unit Tests',
'admin:developers' => 'Developers',
'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.',
'developers:label:simple_cache' => 'Use simple cache',
- 'developers:help:simple_cache' => 'Turn off the file cache when developing. Otherwise, changes to your views (including css) will be ignored.',
- 'developers:label:view_path_cache' => 'Use view path cache',
- 'developers:help:view_path_cache' => 'Turn this off when developing. Otherwise, new views in your plugins will not be registered.',
+ 'developers:help:simple_cache' => 'Turn off this cache when developing. Otherwise, changes to your CSS and JavaScript will be ignored.',
+ 'developers:label:system_cache' => 'Use system cache',
+ 'developers:help:system_cache' => 'Turn this off when developing. Otherwise, changes in your plugins will not be registered.',
'developers:label:debug_level' => "Trace level",
'developers:help:debug_level' => "This controls the amount of information logged. See elgg_log() for more information.",
'developers:label:display_errors' => 'Display fatal PHP errors',
@@ -54,6 +55,11 @@ $english = array(
'theme_preview:navigation' => 'Navigation',
'theme_preview:typography' => 'Typography',
+ // unit tests
+ 'developers:unit_tests:description' => 'Elgg has unit and integration tests for detecting bugs in its core classes and functions.',
+ 'developers:unit_tests:warning' => 'Warning: Do Not Run These Tests on a Production Site. They can corrupt your database.',
+ 'developers:unit_tests:run' => 'Run',
+
// status messages
'developers:settings:success' => 'Settings saved',
);
diff --git a/mod/developers/start.php b/mod/developers/start.php
index 79ec0655a..d77a96b36 100644
--- a/mod/developers/start.php
+++ b/mod/developers/start.php
@@ -63,6 +63,7 @@ function developers_setup_menu() {
if (elgg_in_context('admin')) {
elgg_register_admin_menu_item('develop', 'inspect', 'develop_tools');
elgg_register_admin_menu_item('develop', 'preview', 'develop_tools');
+ elgg_register_admin_menu_item('develop', 'unit_tests', 'develop_tools');
elgg_register_menu_item('page', array(
'name' => 'dev_settings',
@@ -76,8 +77,8 @@ function developers_setup_menu() {
}
/**
-* Clear all the strings so the raw descriptor strings are displayed
-*/
+ * Clear all the strings so the raw descriptor strings are displayed
+ */
function developers_clear_strings() {
global $CONFIG;
@@ -121,8 +122,8 @@ function developers_wrap_views($hook, $type, $result, $params) {
}
/**
-* Log the events and plugin hooks
-*/
+ * Log the events and plugin hooks
+ */
function developers_log_events($name, $type) {
// filter out some very common events
diff --git a/mod/developers/views/default/admin/develop_tools/unit_tests.php b/mod/developers/views/default/admin/develop_tools/unit_tests.php
new file mode 100644
index 000000000..81658e88b
--- /dev/null
+++ b/mod/developers/views/default/admin/develop_tools/unit_tests.php
@@ -0,0 +1,17 @@
+<?php
+/**
+ * Elgg unit and integration tests
+ *
+ */
+
+echo '<p>' . elgg_echo('developers:unit_tests:description') . '</p>';
+echo '<p><strong>' . elgg_echo('developers:unit_tests:warning') . '</strong></p>';
+
+// create a button to run tests
+$params = array(
+ 'text' => elgg_echo('developers:unit_tests:run'),
+ 'href' => 'engine/tests/suite.php',
+ 'class' => 'elgg-button elgg-button-submit',
+ 'is_trusted' => true,
+);
+echo '<p>' . elgg_view('output/url', $params) . '</p>';
diff --git a/mod/developers/views/default/admin/developers/settings.php b/mod/developers/views/default/admin/developers/settings.php
index dcc0a3e4f..459cbabad 100644
--- a/mod/developers/views/default/admin/developers/settings.php
+++ b/mod/developers/views/default/admin/developers/settings.php
@@ -10,10 +10,10 @@ $data = array(
'checked' => elgg_get_config('simplecache_enabled') == 1,
),
- 'view_path_cache' => array(
+ 'system_cache' => array(
'type' => 'checkbox',
'value' => 1,
- 'checked' => elgg_get_config('viewpath_cache_enabled') == 1,
+ 'checked' => elgg_get_config('system_cache_enabled') == 1,
),
'display_errors' => array(
diff --git a/mod/developers/views/default/theme_preview/components.php b/mod/developers/views/default/theme_preview/components.php
index ab5a6e941..45f520f2c 100644
--- a/mod/developers/views/default/theme_preview/components.php
+++ b/mod/developers/views/default/theme_preview/components.php
@@ -3,10 +3,17 @@
* CSS Objects: list, module, image_block, table, messages
*/
-echo elgg_view_module('info', 'Image Block (.elgg-image-block)', elgg_view('theme_preview/components/image_block'));
+$body = elgg_view('theme_preview/components/image_block');
+echo elgg_view_module('info', 'Image Block (.elgg-image-block)', $body);
-echo elgg_view_module('info', 'List (.elgg-list)', elgg_view('theme_preview/components/list'));
+$body = elgg_view('theme_preview/components/list');
+echo elgg_view_module('info', 'List (.elgg-list)', $body);
-echo elgg_view_module('info', 'Table (.elgg-table)', elgg_view('theme_preview/components/table'));
+$body = elgg_view('theme_preview/components/table', array('class' => 'elgg-table'));
+echo elgg_view_module('info', 'Table (.elgg-table)', $body);
-echo elgg_view_module('info', 'Messages (.elgg-message)', elgg_view('theme_preview/components/messages'));
+$body = elgg_view('theme_preview/components/table', array('class' => 'elgg-table-alt'));
+echo elgg_view_module('info', 'Table Alternate (.elgg-table-alt)', $body);
+
+$body = elgg_view('theme_preview/components/messages');
+echo elgg_view_module('info', 'Messages (.elgg-message)', $body);
diff --git a/mod/developers/views/default/theme_preview/components/table.php b/mod/developers/views/default/theme_preview/components/table.php
index e9ef32143..8b8b13e76 100644
--- a/mod/developers/views/default/theme_preview/components/table.php
+++ b/mod/developers/views/default/theme_preview/components/table.php
@@ -1,4 +1,4 @@
-<table class="elgg-table">
+<table class="<?php echo $vars['class']; ?>">
<?php
echo "<thead><tr><th>column 1</th><th>column 2</th></tr></thead>";
for ($i = 1; $i < 5; $i++) {
diff --git a/mod/diagnostics/languages/en.php b/mod/diagnostics/languages/en.php
index c4e337b50..54859941d 100644
--- a/mod/diagnostics/languages/en.php
+++ b/mod/diagnostics/languages/en.php
@@ -1,71 +1,45 @@
<?php
- /**
- * Elgg diagnostics language pack.
- *
- * @package ElggDiagnostics
- */
-
- $english = array(
-
- 'admin:develop_utilities:diagnostics' => 'System Diagnostics',
- 'diagnostics' => 'System diagnostics',
- 'diagnostics:report' => 'Diagnostics Report',
- 'diagnostics:unittester' => 'Unit Tests',
-
- 'diagnostics:description' => 'The following diagnostic report is useful for diagnosing any problems with Elgg, and should be attached to any bug reports you file.',
- 'diagnostics:unittester:description' => 'The following are diagnostic tests which are registered by plugins and may be performed in order to debug parts of the Elgg framework.',
-
- 'diagnostics:unittester:description' => 'Unit tests check Elgg Core for broken or buggy APIs.',
- 'diagnostics:unittester:debug' => 'The site must be in debug mode to run unit tests.',
- 'diagnostics:unittester:warning' => 'WARNING: These tests can leave behind debugging objects in your database.<br />DO NOT USE ON A PRODUCTION SITE!',
-
- 'diagnostics:test:executetest' => 'Execute test',
- 'diagnostics:test:executeall' => 'Execute All',
- 'diagnostics:unittester:notests' => 'Sorry, there are no unit test modules currently installed.',
- 'diagnostics:unittester:testnotfound' => 'Sorry, the report could not be generated because that test was not found',
-
- 'diagnostics:unittester:testresult:nottestclass' => 'FAIL - Result not a test class',
- 'diagnostics:unittester:testresult:fail' => 'FAIL',
- 'diagnostics:unittester:testresult:success' => 'SUCCESS',
-
- 'diagnostics:unittest:example' => 'Example unit test, only available in debug mode.',
-
- 'diagnostics:unittester:report' => 'Test report for %s',
-
- 'diagnostics:download' => 'Download',
-
-
- 'diagnostics:header' => '========================================================================
+/**
+ * Elgg diagnostics language pack.
+ *
+ * @package ElggDiagnostics
+ */
+
+$english = array(
+ 'admin:administer_utilities:diagnostics' => 'System Diagnostics',
+ 'diagnostics' => 'System diagnostics',
+ 'diagnostics:report' => 'Diagnostics Report',
+ 'diagnostics:description' => 'The following diagnostic report can be useful for diagnosing problems with Elgg. The developers of Elgg may request that you attach it to a bug report.',
+ 'diagnostics:download' => 'Download',
+ 'diagnostics:header' => '========================================================================
Elgg Diagnostic Report
Generated %s by %s
========================================================================
',
- 'diagnostics:report:basic' => '
+ 'diagnostics:report:basic' => '
Elgg Release %s, version %s
------------------------------------------------------------------------',
- 'diagnostics:report:php' => '
+ 'diagnostics:report:php' => '
PHP info:
%s
------------------------------------------------------------------------',
- 'diagnostics:report:plugins' => '
+ 'diagnostics:report:plugins' => '
Installed plugins and details:
%s
------------------------------------------------------------------------',
- 'diagnostics:report:md5' => '
+ 'diagnostics:report:md5' => '
Installed files and checksums:
%s
------------------------------------------------------------------------',
- 'diagnostics:report:globals' => '
+ 'diagnostics:report:globals' => '
Global variables:
%s
------------------------------------------------------------------------',
+);
- );
-
- add_translation("en",$english);
-?> \ No newline at end of file
+add_translation("en", $english);
diff --git a/mod/diagnostics/start.php b/mod/diagnostics/start.php
index 0bcc08bd9..55842800a 100644
--- a/mod/diagnostics/start.php
+++ b/mod/diagnostics/start.php
@@ -13,7 +13,7 @@ elgg_register_event_handler('init', 'system', 'diagnostics_init');
function diagnostics_init() {
// Add admin menu item
- elgg_register_admin_menu_item('develop', 'diagnostics', 'develop_utilities');
+ elgg_register_admin_menu_item('administer', 'diagnostics', 'administer_utilities');
// Register some actions
$file = elgg_get_plugins_path() . "diagnostics/actions/download.php";
diff --git a/mod/diagnostics/views/default/admin/administer_utilities/diagnostics.php b/mod/diagnostics/views/default/admin/administer_utilities/diagnostics.php
new file mode 100644
index 000000000..c7ff3d5fc
--- /dev/null
+++ b/mod/diagnostics/views/default/admin/administer_utilities/diagnostics.php
@@ -0,0 +1,17 @@
+<?php
+/**
+ * Diagnostics admin page
+ */
+
+$diagnostics_title = elgg_echo('diagnostics:report');
+$diagnostics = '<p>' . elgg_echo('diagnostics:description') .'</p>';
+$params = array(
+ 'text' => elgg_echo('diagnostics:download'),
+ 'href' => 'action/diagnostics/download',
+ 'class' => 'elgg-button elgg-button-submit',
+ 'is_action' => true,
+ 'is_trusted' => true,
+);
+$diagnostics .= '<p>' . elgg_view('output/url', $params) . '</p>';
+
+echo elgg_view_module('inline', $diagnostics_title, $diagnostics, array('class' => 'elgg-form-settings'));
diff --git a/mod/diagnostics/views/default/admin/develop_utilities/diagnostics.php b/mod/diagnostics/views/default/admin/develop_utilities/diagnostics.php
deleted file mode 100644
index 89e235279..000000000
--- a/mod/diagnostics/views/default/admin/develop_utilities/diagnostics.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-/**
- * Diagnostics admin page
- */
-
-$diagnostics_title = elgg_echo('diagnostics:report');
-$diagnostics = '<p>' . elgg_echo('diagnostics:description') .'</p>';
-$params = array(
- 'text' => elgg_echo('diagnostics:download'),
- 'href' => 'action/diagnostics/download',
- 'class' => 'elgg-button elgg-button-submit',
- 'is_action' => true,
- 'is_trusted' => true,
-);
-$diagnostics .= '<p>' . elgg_view('output/url', $params) . '</p>';
-
-// unit tests
-$unit_tests_title = elgg_echo('diagnostics:unittester');
-$unit_tests .= '<p>' . elgg_echo('diagnostics:unittester:description') . '</p>';
-$unit_tests .= '<p>' . elgg_echo('diagnostics:unittester:warning') . '</p>';
-
-if (elgg_get_config('debug')) {
- // create a button to run tests
- $params = array(
- 'text' => elgg_echo('diagnostics:test:executeall'),
- 'href' => 'engine/tests/suite.php',
- 'class' => 'elgg-button elgg-button-submit',
- 'is_trusted' => true,
- );
- $unit_tests .= '<p>' . elgg_view('output/url', $params) . '</p>';
-} else {
- // no tests when not in debug mode
- $unit_tests .= elgg_echo('diagnostics:unittester:debug');
-}
-
-// display admin body
-echo elgg_view_module('inline', $diagnostics_title, $diagnostics, array('class' => 'elgg-form-settings'));
-echo elgg_view_module('inline', $unit_tests_title, $unit_tests, array('class' => 'elgg-form-settings'));
diff --git a/mod/embed/manifest.xml b/mod/embed/manifest.xml
index 46ab2df9e..81ca9194e 100644
--- a/mod/embed/manifest.xml
+++ b/mod/embed/manifest.xml
@@ -13,10 +13,10 @@
<type>elgg_release</type>
<version>1.8</version>
</requires>
- <suggests>
+ <requires>
<type>plugin</type>
<name>file</name>
<version>1.8.1</version>
- </suggests>
+ </requires>
<activate_on_install>true</activate_on_install>
</plugin_manifest>
diff --git a/mod/embed/views/default/embed/layout.php b/mod/embed/views/default/embed/layout.php
index e906160b1..1ca263037 100644
--- a/mod/embed/views/default/embed/layout.php
+++ b/mod/embed/views/default/embed/layout.php
@@ -21,6 +21,9 @@ if ($selected->getData('view')) {
}
}
+$tab .= elgg_view('graphics/ajax_loader', array(
+ 'class' => 'embed-throbber mtl',
+));
$container_info = elgg_view('input/hidden', array(
'name' => 'embed_container_guid',
diff --git a/mod/embed/views/default/js/embed/embed.php b/mod/embed/views/default/js/embed/embed.php
index 5fd534a09..0c8442292 100644
--- a/mod/embed/views/default/js/embed/embed.php
+++ b/mod/embed/views/default/js/embed/embed.php
@@ -85,11 +85,14 @@ elgg.embed.submit = function(event) {
}
}
},
- error: function(xhr, status) {
- // nothing for now
+ error : function(xhr, status) {
+ // @todo nothing for now
}
});
+ $('.elgg-form-file-upload').hide();
+ $('.embed-throbber').show();
+
// this was bubbling up the DOM causing a submission
event.preventDefault();
event.stopPropagation();
diff --git a/mod/embed/views/default/navigation/menu/embed.php b/mod/embed/views/default/navigation/menu/embed.php
index 1a6a18f05..bca673f59 100644
--- a/mod/embed/views/default/navigation/menu/embed.php
+++ b/mod/embed/views/default/navigation/menu/embed.php
@@ -10,7 +10,7 @@ foreach ($vars['menu']['default'] as $menu_item) {
$tabs[] = array(
'title' => $menu_item->getText(),
'url' => 'embed/tab/' . $menu_item->getName(),
- 'url_class' => 'embed-section',
+ 'link_class' => 'embed-section',
'selected' => $menu_item->getSelected(),
);
}
diff --git a/mod/externalpages/actions/edit.php b/mod/externalpages/actions/edit.php
index edfffe168..184aa3d82 100644
--- a/mod/externalpages/actions/edit.php
+++ b/mod/externalpages/actions/edit.php
@@ -1,18 +1,28 @@
<?php
/**
- * Elgg external pages: add/edit
+ * Elgg external pages: create or update
*
*/
-// Get input data
+// Get input data and don't filter the content
$contents = get_input('expagescontent', '', false);
$type = get_input('content_type');
-$previous_guid = get_input('expage_guid');
+$guid = get_input('guid');
-// create object to hold the page details
-$expages = new ElggObject();
-$expages->subtype = $type;
-$expages->owner_guid = get_loggedin_userid();
+if ($guid) {
+ // update
+ $expages = get_entity($guid);
+ if (!$expages) {
+ register_error(elgg_echo("expages:error"));
+ forward(REFERER);
+ }
+} else {
+ // create
+ $expages = new ElggObject();
+ $expages->subtype = $type;
+}
+
+$expages->owner_guid = elgg_get_logged_in_user_guid();
$expages->access_id = ACCESS_PUBLIC;
$expages->title = $type;
$expages->description = $contents;
diff --git a/mod/externalpages/start.php b/mod/externalpages/start.php
index 152a8b4d9..74da7f828 100644
--- a/mod/externalpages/start.php
+++ b/mod/externalpages/start.php
@@ -77,9 +77,16 @@ function expages_page_handler($page, $handler) {
} else {
$content .= elgg_echo("expages:notset");
}
+ $content = elgg_view('expages/wrapper', array('content' => $content));
- $body = elgg_view_layout("one_sidebar", array('content' => $content));
- echo elgg_view_page($title, $body);
+ if (elgg_is_logged_in() || !elgg_get_config('walled_garden')) {
+ $body = elgg_view_layout('one_sidebar', array('content' => $content));
+ echo elgg_view_page($title, $body);
+ } else {
+ elgg_load_css('elgg.walled_garden');
+ $body = elgg_view_layout('walled_garden', array('content' => $content));
+ echo elgg_view_page($title, $body, 'walled_garden');
+ }
return true;
}
diff --git a/mod/externalpages/views/default/expages/menu.php b/mod/externalpages/views/default/expages/menu.php
index 6ed521629..831be9125 100644
--- a/mod/externalpages/views/default/expages/menu.php
+++ b/mod/externalpages/views/default/expages/menu.php
@@ -7,8 +7,8 @@
$type = $vars['type'];
- //set the url
- $url = $vars['url'] . "admin/site/expages?type=";
+//set the url
+$url = $vars['url'] . "admin/site/expages?type=";
$pages = array('about', 'terms', 'privacy');
$tabs = array();
diff --git a/mod/externalpages/views/default/expages/wrapper.php b/mod/externalpages/views/default/expages/wrapper.php
new file mode 100644
index 000000000..8eb0b2f84
--- /dev/null
+++ b/mod/externalpages/views/default/expages/wrapper.php
@@ -0,0 +1,16 @@
+<?php
+/**
+ * Wrapper for site pages content area
+ *
+ * @uses $vars['content']
+ */
+
+echo $vars['content'];
+
+echo '<div class="mtm">';
+echo elgg_view('output/url', array(
+ 'text' => 'Back',
+ 'href' => $_SERVER['HTTP_REFERER'],
+ 'class' => 'float-alt'
+));
+echo '</div>';
diff --git a/mod/externalpages/views/default/forms/expages/edit.php b/mod/externalpages/views/default/forms/expages/edit.php
index ca83ea7df..a15f2a7aa 100644
--- a/mod/externalpages/views/default/forms/expages/edit.php
+++ b/mod/externalpages/views/default/forms/expages/edit.php
@@ -50,9 +50,9 @@ echo <<<EOT
$input_area
</div>
<div class="elgg-foot">
-$hidden_value
+$hidden_guid
$hidden_type
$submit_input
-<div>
+</div>
EOT;
diff --git a/mod/file/actions/file/upload.php b/mod/file/actions/file/upload.php
index 3edc87952..d72d04eb7 100644
--- a/mod/file/actions/file/upload.php
+++ b/mod/file/actions/file/upload.php
@@ -94,8 +94,31 @@ if (isset($_FILES['upload']['name']) && !empty($_FILES['upload']['name'])) {
$filestorename = elgg_strtolower(time().$_FILES['upload']['name']);
}
- $mime_type = $file->detectMimeType($_FILES['upload']['tmp_name'], $_FILES['upload']['type']);
$file->setFilename($prefix . $filestorename);
+ $mime_type = ElggFile::detectMimeType($_FILES['upload']['tmp_name'], $_FILES['upload']['type']);
+
+ // hack for Microsoft zipped formats
+ $info = pathinfo($_FILES['upload']['name']);
+ $office_formats = array('docx', 'xlsx', 'pptx');
+ if ($mime_type == "application/zip" && in_array($info['extension'], $office_formats)) {
+ switch ($info['extension']) {
+ case 'docx':
+ $mime_type = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
+ break;
+ case 'xlsx':
+ $mime_type = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
+ break;
+ case 'pptx':
+ $mime_type = "application/vnd.openxmlformats-officedocument.presentationml.presentation";
+ break;
+ }
+ }
+
+ // check for bad ppt detection
+ if ($mime_type == "application/vnd.ms-office" && $info['extension'] == "ppt") {
+ $mime_type = "application/vnd.ms-powerpoint";
+ }
+
$file->setMimeType($mime_type);
$file->originalfilename = $_FILES['upload']['name'];
$file->simpletype = file_get_simple_type($mime_type);
@@ -109,7 +132,9 @@ if (isset($_FILES['upload']['name']) && !empty($_FILES['upload']['name'])) {
// if image, we need to create thumbnails (this should be moved into a function)
if ($guid && $file->simpletype == "image") {
- $thumbnail = get_resized_image_from_existing_file($file->getFilenameOnFilestore(),60,60, true);
+ $file->icontime = time();
+
+ $thumbnail = get_resized_image_from_existing_file($file->getFilenameOnFilestore(), 60, 60, true);
if ($thumbnail) {
$thumb = new ElggFile();
$thumb->setMimeType($_FILES['upload']['type']);
@@ -123,7 +148,7 @@ if (isset($_FILES['upload']['name']) && !empty($_FILES['upload']['name'])) {
unset($thumbnail);
}
- $thumbsmall = get_resized_image_from_existing_file($file->getFilenameOnFilestore(),153,153, true);
+ $thumbsmall = get_resized_image_from_existing_file($file->getFilenameOnFilestore(), 153, 153, true);
if ($thumbsmall) {
$thumb->setFilename($prefix."smallthumb".$filestorename);
$thumb->open("write");
@@ -133,7 +158,7 @@ if (isset($_FILES['upload']['name']) && !empty($_FILES['upload']['name'])) {
unset($thumbsmall);
}
- $thumblarge = get_resized_image_from_existing_file($file->getFilenameOnFilestore(),600,600, false);
+ $thumblarge = get_resized_image_from_existing_file($file->getFilenameOnFilestore(), 600, 600, false);
if ($thumblarge) {
$thumb->setFilename($prefix."largethumb".$filestorename);
$thumb->open("write");
diff --git a/mod/file/graphics/icons/application.gif b/mod/file/graphics/icons/application.gif
index f78903c0a..bfba76a97 100644
--- a/mod/file/graphics/icons/application.gif
+++ b/mod/file/graphics/icons/application.gif
Binary files differ
diff --git a/mod/file/graphics/icons/application_lrg.gif b/mod/file/graphics/icons/application_lrg.gif
index c6955f749..65f8eadb4 100644
--- a/mod/file/graphics/icons/application_lrg.gif
+++ b/mod/file/graphics/icons/application_lrg.gif
Binary files differ
diff --git a/mod/file/graphics/icons/archive.gif b/mod/file/graphics/icons/archive.gif
index 044cd042a..2213cdadd 100644
--- a/mod/file/graphics/icons/archive.gif
+++ b/mod/file/graphics/icons/archive.gif
Binary files differ
diff --git a/mod/file/graphics/icons/archive_lrg.gif b/mod/file/graphics/icons/archive_lrg.gif
index 0d0856cdd..6e3df3fd4 100644
--- a/mod/file/graphics/icons/archive_lrg.gif
+++ b/mod/file/graphics/icons/archive_lrg.gif
Binary files differ
diff --git a/mod/file/graphics/icons/excel.gif b/mod/file/graphics/icons/excel.gif
index f74f74fd7..ecd1d57d2 100644
--- a/mod/file/graphics/icons/excel.gif
+++ b/mod/file/graphics/icons/excel.gif
Binary files differ
diff --git a/mod/file/graphics/icons/excel_lrg.gif b/mod/file/graphics/icons/excel_lrg.gif
index 9b53d6dc7..84d1375d5 100644
--- a/mod/file/graphics/icons/excel_lrg.gif
+++ b/mod/file/graphics/icons/excel_lrg.gif
Binary files differ
diff --git a/mod/file/graphics/icons/general.gif b/mod/file/graphics/icons/general.gif
index cd5cf467a..20958b9a4 100644
--- a/mod/file/graphics/icons/general.gif
+++ b/mod/file/graphics/icons/general.gif
Binary files differ
diff --git a/mod/file/graphics/icons/general_lrg.gif b/mod/file/graphics/icons/general_lrg.gif
index 7c7a3c80a..3458915e5 100644
--- a/mod/file/graphics/icons/general_lrg.gif
+++ b/mod/file/graphics/icons/general_lrg.gif
Binary files differ
diff --git a/mod/file/graphics/icons/music.gif b/mod/file/graphics/icons/music.gif
index c44d7c987..5e9df08bc 100644
--- a/mod/file/graphics/icons/music.gif
+++ b/mod/file/graphics/icons/music.gif
Binary files differ
diff --git a/mod/file/graphics/icons/music_lrg.gif b/mod/file/graphics/icons/music_lrg.gif
index 780a252d6..1c0792cc3 100644
--- a/mod/file/graphics/icons/music_lrg.gif
+++ b/mod/file/graphics/icons/music_lrg.gif
Binary files differ
diff --git a/mod/file/graphics/icons/openoffice.gif b/mod/file/graphics/icons/openoffice.gif
index 3cfdc7196..053ad5bb5 100644
--- a/mod/file/graphics/icons/openoffice.gif
+++ b/mod/file/graphics/icons/openoffice.gif
Binary files differ
diff --git a/mod/file/graphics/icons/openoffice_lrg.gif b/mod/file/graphics/icons/openoffice_lrg.gif
index 5cdb13353..da28607fa 100644
--- a/mod/file/graphics/icons/openoffice_lrg.gif
+++ b/mod/file/graphics/icons/openoffice_lrg.gif
Binary files differ
diff --git a/mod/file/graphics/icons/pages.gif b/mod/file/graphics/icons/pages.gif
index 2e4ee761a..7efcb7278 100644
--- a/mod/file/graphics/icons/pages.gif
+++ b/mod/file/graphics/icons/pages.gif
Binary files differ
diff --git a/mod/file/graphics/icons/pages_lrg.gif b/mod/file/graphics/icons/pages_lrg.gif
index 2e41e4739..234a52672 100644
--- a/mod/file/graphics/icons/pages_lrg.gif
+++ b/mod/file/graphics/icons/pages_lrg.gif
Binary files differ
diff --git a/mod/file/graphics/icons/pdf.gif b/mod/file/graphics/icons/pdf.gif
index e7854b1e0..94362a4f0 100644
--- a/mod/file/graphics/icons/pdf.gif
+++ b/mod/file/graphics/icons/pdf.gif
Binary files differ
diff --git a/mod/file/graphics/icons/pdf_lrg.gif b/mod/file/graphics/icons/pdf_lrg.gif
index 5cd62b69c..aff869d04 100644
--- a/mod/file/graphics/icons/pdf_lrg.gif
+++ b/mod/file/graphics/icons/pdf_lrg.gif
Binary files differ
diff --git a/mod/file/graphics/icons/ppt.gif b/mod/file/graphics/icons/ppt.gif
index 44aef679b..88ab26d5c 100644
--- a/mod/file/graphics/icons/ppt.gif
+++ b/mod/file/graphics/icons/ppt.gif
Binary files differ
diff --git a/mod/file/graphics/icons/ppt_lrg.gif b/mod/file/graphics/icons/ppt_lrg.gif
index 71965711d..075590fd8 100644
--- a/mod/file/graphics/icons/ppt_lrg.gif
+++ b/mod/file/graphics/icons/ppt_lrg.gif
Binary files differ
diff --git a/mod/file/graphics/icons/text.gif b/mod/file/graphics/icons/text.gif
index 107e7ca37..897aa77f9 100644
--- a/mod/file/graphics/icons/text.gif
+++ b/mod/file/graphics/icons/text.gif
Binary files differ
diff --git a/mod/file/graphics/icons/text_lrg.gif b/mod/file/graphics/icons/text_lrg.gif
index 5f7c95519..d42ea4de1 100644
--- a/mod/file/graphics/icons/text_lrg.gif
+++ b/mod/file/graphics/icons/text_lrg.gif
Binary files differ
diff --git a/mod/file/graphics/icons/vcard.gif b/mod/file/graphics/icons/vcard.gif
index f7fdda9c0..202df68dd 100644
--- a/mod/file/graphics/icons/vcard.gif
+++ b/mod/file/graphics/icons/vcard.gif
Binary files differ
diff --git a/mod/file/graphics/icons/vcard_lrg.gif b/mod/file/graphics/icons/vcard_lrg.gif
index 6cd4c45e0..68ced88d2 100644
--- a/mod/file/graphics/icons/vcard_lrg.gif
+++ b/mod/file/graphics/icons/vcard_lrg.gif
Binary files differ
diff --git a/mod/file/graphics/icons/video.gif b/mod/file/graphics/icons/video.gif
index 09abfad3b..56aca7589 100644
--- a/mod/file/graphics/icons/video.gif
+++ b/mod/file/graphics/icons/video.gif
Binary files differ
diff --git a/mod/file/graphics/icons/video_lrg.gif b/mod/file/graphics/icons/video_lrg.gif
index b23dbad91..69cc706d9 100644
--- a/mod/file/graphics/icons/video_lrg.gif
+++ b/mod/file/graphics/icons/video_lrg.gif
Binary files differ
diff --git a/mod/file/graphics/icons/word.gif b/mod/file/graphics/icons/word.gif
index f906c75bd..6f7dff340 100644
--- a/mod/file/graphics/icons/word.gif
+++ b/mod/file/graphics/icons/word.gif
Binary files differ
diff --git a/mod/file/graphics/icons/word_lrg.gif b/mod/file/graphics/icons/word_lrg.gif
index 018c8e334..4c39108de 100644
--- a/mod/file/graphics/icons/word_lrg.gif
+++ b/mod/file/graphics/icons/word_lrg.gif
Binary files differ
diff --git a/mod/file/languages/en.php b/mod/file/languages/en.php
index 278076927..b3344cb43 100644
--- a/mod/file/languages/en.php
+++ b/mod/file/languages/en.php
@@ -22,7 +22,6 @@ $english = array(
'file:gallery_list' => "Gallery or list view",
'file:num_files' => "Number of files to display",
'file:user:gallery'=>'View %s gallery',
- 'file:via' => 'via files',
'file:upload' => "Upload a file",
'file:replace' => 'Replace file content (leave blank to not change file)',
'file:list:title' => "%s's %s %s",
@@ -79,6 +78,15 @@ $english = array(
'item:object:file' => 'Files',
'file:newupload' => 'A new file has been uploaded',
+ 'file:notification' =>
+'%s uploaded a new file:
+
+%s
+%s
+
+View and comment on the new file:
+%s
+',
/**
* Embed media
diff --git a/mod/file/pages/file/download.php b/mod/file/pages/file/download.php
index 00e6d500e..76c1f1272 100644
--- a/mod/file/pages/file/download.php
+++ b/mod/file/pages/file/download.php
@@ -26,7 +26,7 @@ $filename = $file->originalfilename;
header("Pragma: public");
header("Content-type: $mime");
-if (strpos($mime, "image/") !== false) {
+if (strpos($mime, "image/") !== false || $mime == "application/pdf") {
header("Content-Disposition: inline; filename=\"$filename\"");
} else {
header("Content-Disposition: attachment; filename=\"$filename\"");
diff --git a/mod/file/pages/file/view.php b/mod/file/pages/file/view.php
index a571c9d68..ec51b30e6 100644
--- a/mod/file/pages/file/view.php
+++ b/mod/file/pages/file/view.php
@@ -6,6 +6,10 @@
*/
$file = get_entity(get_input('guid'));
+if (!$file) {
+ register_error(elgg_echo('noaccess'));
+ forward('');
+}
$owner = elgg_get_page_owner_entity();
diff --git a/mod/file/start.php b/mod/file/start.php
index e15a9ad61..172042332 100644
--- a/mod/file/start.php
+++ b/mod/file/start.php
@@ -122,6 +122,7 @@ function file_page_handler($page) {
include "$file_dir/friends.php";
break;
case 'view':
+ case 'read': // Elgg 1.7 compatibility
set_input('guid', $page[1]);
include "$file_dir/view.php";
break;
@@ -199,9 +200,13 @@ function file_notify_message($hook, $entity_type, $returnvalue, $params) {
if (($entity instanceof ElggEntity) && ($entity->getSubtype() == 'file')) {
$descr = $entity->description;
$title = $entity->title;
- $url = elgg_get_site_url() . "view/" . $entity->guid;
$owner = $entity->getOwnerEntity();
- return $owner->name . ' ' . elgg_echo("file:via") . ': ' . $entity->title . "\n\n" . $descr . "\n\n" . $entity->getURL();
+ return elgg_echo('file:notification', array(
+ $owner->name,
+ $title,
+ $descr,
+ $entity->getURL()
+ ));
}
return null;
}
@@ -235,11 +240,15 @@ function file_get_simple_type($mimetype) {
switch ($mimetype) {
case "application/msword":
+ case "application/vnd.openxmlformats-officedocument.wordprocessingml.document":
return "document";
break;
case "application/pdf":
return "document";
break;
+ case "application/ogg":
+ return "audio";
+ break;
}
if (substr_count($mimetype, 'text/')) {
@@ -345,17 +354,22 @@ function file_icon_url_override($hook, $type, $returnvalue, $params) {
// thumbnails get first priority
if ($file->thumbnail) {
- return "mod/file/thumbnail.php?file_guid=$file->guid&size=$size";
+ $ts = (int)$file->icontime;
+ return "mod/file/thumbnail.php?file_guid=$file->guid&size=$size&icontime=$ts";
}
$mapping = array(
'application/excel' => 'excel',
'application/msword' => 'word',
+ 'application/ogg' => 'music',
'application/pdf' => 'pdf',
'application/powerpoint' => 'ppt',
'application/vnd.ms-excel' => 'excel',
'application/vnd.ms-powerpoint' => 'ppt',
'application/vnd.oasis.opendocument.text' => 'openoffice',
+ 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' => 'word',
+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' => 'excel',
+ 'application/vnd.openxmlformats-officedocument.presentationml.presentation' => 'ppt',
'application/x-gzip' => 'archive',
'application/x-rar-compressed' => 'archive',
'application/x-stuffit' => 'archive',
diff --git a/mod/file/views/default/file/specialcontent/image/default.php b/mod/file/views/default/file/specialcontent/image/default.php
index fbd994a0b..431ac9f4f 100644
--- a/mod/file/views/default/file/specialcontent/image/default.php
+++ b/mod/file/views/default/file/specialcontent/image/default.php
@@ -1,13 +1,17 @@
<?php
/**
* Display an image
+ *
+ * @uses $vars['entity']
*/
-$image_url = elgg_get_site_url() . "mod/file/thumbnail.php?file_guid={$vars['entity']->getGUID()}&size=large";
+$file = $vars['entity'];
+
+$image_url = $file->getIconURL('large');
$image_url = elgg_format_url($image_url);
-$download_url = elgg_get_site_url() . "mod/file/download.php?file_guid={$vars['entity']->getGUID()}";
+$download_url = elgg_get_site_url() . "file/download/{$file->getGUID()}";
-if ($vars['full_view'] && $smallthumb = $vars['entity']->smallthumb) {
+if ($vars['full_view']) {
echo <<<HTML
<div class="file-photo">
<a href="$download_url"><img class="elgg-photo" src="$image_url" /></a>
diff --git a/mod/file/views/default/object/file.php b/mod/file/views/default/object/file.php
index 1db9863c9..b3f530183 100644
--- a/mod/file/views/default/object/file.php
+++ b/mod/file/views/default/object/file.php
@@ -28,7 +28,6 @@ $author_text = elgg_echo('byline', array($owner_link));
$file_icon = elgg_view_entity_icon($file, 'small');
-$tags = elgg_view('output/tags', array('tags' => $file->tags));
$date = elgg_view_friendly_time($file->time_created);
$comments_count = $file->countComments();
@@ -71,7 +70,6 @@ if ($full && !elgg_in_context('gallery')) {
'entity' => $file,
'metadata' => $metadata,
'subtitle' => $subtitle,
- 'tags' => $tags,
);
$params = $params + $vars;
$summary = elgg_view('object/elements/summary', $params);
@@ -100,7 +98,6 @@ if ($full && !elgg_in_context('gallery')) {
'entity' => $file,
'metadata' => $metadata,
'subtitle' => $subtitle,
- 'tags' => $tags,
'content' => $excerpt,
);
$params = $params + $vars;
diff --git a/mod/groups/actions/discussion/reply/save.php b/mod/groups/actions/discussion/reply/save.php
index a1ed036b6..f8be8aa2c 100644
--- a/mod/groups/actions/discussion/reply/save.php
+++ b/mod/groups/actions/discussion/reply/save.php
@@ -4,8 +4,6 @@
*
*/
-gatekeeper();
-
// Get input
$entity_guid = (int) get_input('entity_guid');
$text = get_input('group_topic_post');
@@ -23,10 +21,10 @@ if (!$topic) {
forward(REFERER);
}
-$user = get_loggedin_user();
+$user = elgg_get_logged_in_user_entity();
$group = $topic->getContainerEntity();
-if (!$group->canWriteToContainer($user)) {
+if (!$group->canWriteToContainer()) {
register_error(elgg_echo('groups:notmember'));
forward(REFERER);
}
diff --git a/mod/groups/actions/discussion/save.php b/mod/groups/actions/discussion/save.php
index a51775cd6..de4afadfb 100644
--- a/mod/groups/actions/discussion/save.php
+++ b/mod/groups/actions/discussion/save.php
@@ -21,7 +21,7 @@ if (!$title || !$desc) {
}
$container = get_entity($container_guid);
-if (!$container || !$container->canWriteToContainer()) {
+if (!$container || !$container->canWriteToContainer(0, 'object', 'groupforumtopic')) {
register_error(elgg_echo('discussion:error:permissions'));
forward(REFERER);
}
diff --git a/mod/groups/actions/groups/edit.php b/mod/groups/actions/groups/edit.php
index c4cf6667e..b513a6098 100644
--- a/mod/groups/actions/groups/edit.php
+++ b/mod/groups/actions/groups/edit.php
@@ -89,14 +89,10 @@ if ($new_group_flag) {
$group->save();
-// group creator needs to be member of new group and river entry created
-if ($new_group_flag) {
- elgg_set_page_owner_guid($group->guid);
- $group->join($user);
- add_to_river('river/group/create', 'create', $user->guid, $group->guid);
-}
-
// Invisible group support
+// @todo this requires save to be called to create the acl for the group. This
+// is an odd requirement and should be removed. Either the acl creation happens
+// in the action or the visibility moves to a plugin hook
if (elgg_get_plugin_setting('hidden_groups', 'groups') == 'yes') {
$visibility = (int)get_input('vis', '', false);
if ($visibility != ACCESS_PUBLIC && $visibility != ACCESS_LOGGED_IN) {
@@ -105,10 +101,18 @@ if (elgg_get_plugin_setting('hidden_groups', 'groups') == 'yes') {
if ($group->access_id != $visibility) {
$group->access_id = $visibility;
- $group->save();
}
}
+$group->save();
+
+// group creator needs to be member of new group and river entry created
+if ($new_group_flag) {
+ elgg_set_page_owner_guid($group->guid);
+ $group->join($user);
+ add_to_river('river/group/create', 'create', $user->guid, $group->guid, $group->access_id);
+}
+
// Now see if we have a file icon
if ((isset($_FILES['icon'])) && (substr_count($_FILES['icon']['type'],'image/'))) {
diff --git a/mod/groups/actions/groups/membership/delete_invite.php b/mod/groups/actions/groups/membership/delete_invite.php
index 4b654f0b6..d21aa0309 100644
--- a/mod/groups/actions/groups/membership/delete_invite.php
+++ b/mod/groups/actions/groups/membership/delete_invite.php
@@ -9,7 +9,11 @@ $user_guid = get_input('user_guid', elgg_get_logged_in_user_guid());
$group_guid = get_input('group_guid');
$user = get_entity($user_guid);
+
+// invisible groups require overriding access to delete invite
+$old_access = elgg_set_ignore_access(true);
$group = get_entity($group_guid);
+elgg_set_ignore_access($old_access);
// If join request made
if (check_entity_relationship($group->guid, 'invited', $user->guid)) {
diff --git a/mod/groups/icon.php b/mod/groups/icon.php
index f4c0f8010..f86f84fa5 100644
--- a/mod/groups/icon.php
+++ b/mod/groups/icon.php
@@ -10,8 +10,15 @@ require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
$group_guid = get_input('group_guid');
$group = get_entity($group_guid);
+// If is the same ETag, content didn't changed.
+$etag = $group->icontime . $group_guid;
+if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && trim($_SERVER['HTTP_IF_NONE_MATCH']) == $etag) {
+ header("HTTP/1.1 304 Not Modified");
+ exit;
+}
+
$size = strtolower(get_input('size'));
-if (!in_array($size,array('large','medium','small','tiny','master','topbar')))
+if (!in_array($size, array('large', 'medium', 'small', 'tiny', 'master', 'topbar')))
$size = "medium";
$success = false;
@@ -28,7 +35,7 @@ if ($filehandler->open("read")) {
}
if (!$success) {
- $location = elgg_get_plugins_path() . "groups/graphics/default{$size}.jpg";
+ $location = elgg_get_plugins_path() . "groups/graphics/default{$size}.gif";
$contents = @file_get_contents($location);
}
@@ -37,4 +44,5 @@ header('Expires: ' . date('r',time() + 864000));
header("Pragma: public");
header("Cache-Control: public");
header("Content-Length: " . strlen($contents));
+header("ETag: $etag");
echo $contents;
diff --git a/mod/groups/languages/en.php b/mod/groups/languages/en.php
index 09feaf8d1..e51e51a14 100644
--- a/mod/groups/languages/en.php
+++ b/mod/groups/languages/en.php
@@ -61,6 +61,18 @@ $english = array(
'groups:search:tags' => "tag",
'groups:search:title' => "Search for groups tagged with '%s'",
'groups:search:none' => "No matching groups were found",
+ 'groups:search_in_group' => "Search in this group",
+ 'groups:acl' => "Group: %s",
+
+ 'groups:notification' =>
+'%s added a new discussion topic to %s:
+
+%s
+%s
+
+View and reply to the discussion:
+%s
+',
'groups:activity' => "Group activity",
'groups:enableactivity' => 'Enable group activity',
diff --git a/mod/groups/lib/discussion.php b/mod/groups/lib/discussion.php
index 2bda4678e..55642644d 100644
--- a/mod/groups/lib/discussion.php
+++ b/mod/groups/lib/discussion.php
@@ -92,8 +92,8 @@ function discussion_handle_edit_page($type, $guid) {
forward();
}
- // make sure user has permissions to write to container
- if (!$group->canWriteToContainer()) {
+ // make sure user has permissions to add a topic to container
+ if (!$group->canWriteToContainer(0, 'object', 'groupforumtopic')) {
register_error(elgg_echo('groups:permissions:error'));
forward($group->getURL());
}
@@ -173,7 +173,7 @@ function discussion_handle_view_page($guid) {
'show_add_form' => false,
));
$content .= elgg_view('discussion/closed');
- } elseif ($group->canWriteToContainer() || elgg_is_admin_logged_in()) {
+ } elseif ($group->canWriteToContainer(0, 'object', 'groupforumtopic') || elgg_is_admin_logged_in()) {
$content .= elgg_view('discussion/replies', array(
'entity' => $topic,
'show_add_form' => true,
diff --git a/mod/groups/lib/groups.php b/mod/groups/lib/groups.php
index f8ff2d74b..498766df0 100644
--- a/mod/groups/lib/groups.php
+++ b/mod/groups/lib/groups.php
@@ -249,7 +249,11 @@ function groups_handle_profile_page($guid) {
$content = elgg_view('groups/profile/layout', array('entity' => $group));
if (group_gatekeeper(false)) {
- $sidebar = elgg_view('groups/sidebar/members', array('entity' => $group));
+ $sidebar = '';
+ if (elgg_is_active_plugin('search')) {
+ $sidebar .= elgg_view('groups/sidebar/search', array('entity' => $group));
+ }
+ $sidebar .= elgg_view('groups/sidebar/members', array('entity' => $group));
} else {
$sidebar = '';
}
diff --git a/mod/groups/start.php b/mod/groups/start.php
index 09362cbbc..aeab0649a 100644
--- a/mod/groups/start.php
+++ b/mod/groups/start.php
@@ -663,7 +663,7 @@ function group_access_options($group) {
ACCESS_PRIVATE => 'private',
ACCESS_LOGGED_IN => 'logged in users',
ACCESS_PUBLIC => 'public',
- $group->group_acl => 'Group: ' . $group->name,
+ $group->group_acl => elgg_echo('groups:acl', array($group->name)),
);
return $access_array;
}
@@ -741,7 +741,6 @@ function discussion_init() {
// notifications
register_notification_object('object', 'groupforumtopic', elgg_echo('groupforumtopic:new'));
- elgg_register_plugin_hook_handler('object:notifications', 'object', 'group_object_notifications_intercept');
elgg_register_plugin_hook_handler('notify:entity:message', 'object', 'groupforumtopic_notify_message');
}
@@ -855,41 +854,19 @@ function discussion_add_to_river_menu($hook, $type, $return, $params) {
function group_object_notifications($event, $object_type, $object) {
static $flag;
- if (!isset($flag))
+ if (!isset($flag)) {
$flag = 0;
+ }
if (is_callable('object_notifications'))
if ($object instanceof ElggObject) {
if ($object->getSubtype() == 'groupforumtopic') {
- //if ($object->countAnnotations('group_topic_post') > 0) {
if ($flag == 0) {
$flag = 1;
object_notifications($event, $object_type, $object);
}
- //}
- }
- }
-}
-
-/**
- * Intercepts the notification on group topic creation and prevents a notification from going out
- * (because one will be sent on the annotation)
- *
- * @param unknown_type $hook
- * @param unknown_type $entity_type
- * @param unknown_type $returnvalue
- * @param unknown_type $params
- * @return unknown
- */
-function group_object_notifications_intercept($hook, $entity_type, $returnvalue, $params) {
- if (isset($params)) {
- if ($params['event'] == 'create' && $params['object'] instanceof ElggObject) {
- if ($params['object']->getSubtype() == 'groupforumtopic') {
- return true;
}
}
- }
- return null;
}
/**
@@ -904,26 +881,23 @@ function groupforumtopic_notify_message($hook, $entity_type, $returnvalue, $para
$entity = $params['entity'];
$to_entity = $params['to_entity'];
$method = $params['method'];
- if (($entity instanceof ElggEntity) && ($entity->getSubtype() == 'groupforumtopic')) {
+ if (($entity instanceof ElggEntity) && ($entity->getSubtype() == 'groupforumtopic')) {
$descr = $entity->description;
$title = $entity->title;
$url = $entity->getURL();
-
- $msg = get_input('topicmessage');
- if (empty($msg))
- $msg = get_input('topic_post');
- if (!empty($msg))
- $msg = $msg . "\n\n"; else
- $msg = '';
-
- $owner = get_entity($entity->container_guid);
- if ($method == 'sms') {
- return elgg_echo("groupforumtopic:new") . ': ' . $url . " ({$owner->name}: {$title})";
- } else {
- return elgg_get_logged_in_user_entity()->name . ' ' . elgg_echo("groups:viagroups") . ': ' . $title . "\n\n" . $msg . "\n\n" . $entity->getURL();
- }
+ $owner = $entity->getOwnerEntity();
+ $group = $entity->getContainerEntity();
+
+ return elgg_echo('groups:notification', array(
+ $owner->name,
+ $group->name,
+ $entity->title,
+ $entity->description,
+ $entity->getURL()
+ ));
}
+
return null;
}
diff --git a/mod/groups/upgrades/2011030101.php b/mod/groups/upgrades/2011030101.php
index c2a80c08c..55edb1a16 100644
--- a/mod/groups/upgrades/2011030101.php
+++ b/mod/groups/upgrades/2011030101.php
@@ -9,6 +9,7 @@ $topics = elgg_get_entities(array(
'type' => 'object',
'subtype' => 'groupforumtopic',
'limit' => 5,
+ 'order_by' => 'e.time_created asc',
));
// if not topics, no upgrade required
@@ -25,12 +26,17 @@ foreach ($topics as $topic) {
/**
- * Condense annotation into object
+ * Condense first annotation into object
*
* @param ElggObject $topic
*/
function groups_2011030101($topic) {
+ // do not upgrade topics that have already been upgraded
+ if ($topic->description) {
+ return true;
+ }
+
$annotation = $topic->getAnnotations('group_topic_post', 1);
if (!$annotation) {
// no text for this forum post so we delete (probably caused by #2624)
@@ -43,8 +49,14 @@ function groups_2011030101($topic) {
return $annotation[0]->delete();
}
-$options = array('type' => 'object', 'subtype' => 'groupforumtopic');
+$previous_access = elgg_set_ignore_access(true);
+$options = array(
+ 'type' => 'object',
+ 'subtype' => 'groupforumtopic',
+ 'limit' => 0,
+);
$batch = new ElggBatch('elgg_get_entities', $options, 'groups_2011030101', 100);
+elgg_set_ignore_access($previous_access);
if ($batch->callbackResult) {
error_log("Elgg Groups upgrade (2011030101) succeeded");
diff --git a/mod/groups/views/default/forms/groups/find.php b/mod/groups/views/default/forms/groups/find.php
new file mode 100644
index 000000000..ddf639b74
--- /dev/null
+++ b/mod/groups/views/default/forms/groups/find.php
@@ -0,0 +1,16 @@
+<?php
+/**
+ * Group tag-based search form body
+ */
+
+$tag_string = elgg_echo('groups:search:tags');
+
+$params = array(
+ 'name' => 'tag',
+ 'class' => 'elgg-input-search mbm',
+ 'value' => $tag_string,
+ 'onclick' => "if (this.value=='$tag_string') { this.value='' }",
+);
+echo elgg_view('input/text', $params);
+
+echo elgg_view('input/submit', array('value' => elgg_echo('search:go')));
diff --git a/mod/groups/views/default/forms/groups/search.php b/mod/groups/views/default/forms/groups/search.php
index ddf639b74..850b6088e 100644
--- a/mod/groups/views/default/forms/groups/search.php
+++ b/mod/groups/views/default/forms/groups/search.php
@@ -1,16 +1,20 @@
<?php
/**
- * Group tag-based search form body
+ * Group search form
+ *
+ * @uses $vars['entity'] ElggGroup
*/
-$tag_string = elgg_echo('groups:search:tags');
-
$params = array(
- 'name' => 'tag',
+ 'name' => 'q',
'class' => 'elgg-input-search mbm',
'value' => $tag_string,
- 'onclick' => "if (this.value=='$tag_string') { this.value='' }",
);
echo elgg_view('input/text', $params);
+echo elgg_view('input/hidden', array(
+ 'name' => 'container_guid',
+ 'value' => $vars['entity']->getGUID(),
+));
+
echo elgg_view('input/submit', array('value' => elgg_echo('search:go')));
diff --git a/mod/groups/views/default/group/default.php b/mod/groups/views/default/group/default.php
index 6eae467c6..d9460dff4 100644
--- a/mod/groups/views/default/group/default.php
+++ b/mod/groups/views/default/group/default.php
@@ -22,10 +22,9 @@ if (elgg_in_context('owner_block') || elgg_in_context('widgets')) {
if ($vars['full_view']) {
- echo elgg_view("groups/profile/profile_block", $vars);
+ echo elgg_view('groups/profile/summary', $vars);
} else {
// brief view
-
$params = array(
'entity' => $group,
'metadata' => $metadata,
diff --git a/mod/groups/views/default/groups/group_sort_menu.php b/mod/groups/views/default/groups/group_sort_menu.php
index c53b49c8e..f5631a31f 100644
--- a/mod/groups/views/default/groups/group_sort_menu.php
+++ b/mod/groups/views/default/groups/group_sort_menu.php
@@ -2,6 +2,7 @@
/**
* All groups listing page navigation
*
+ * @uses $vars['selected'] Name of the tab that has been selected
*/
$tabs = array(
@@ -22,14 +23,13 @@ $tabs = array(
),
);
-// sets default selected item
-if (strpos(full_url(), 'filter') === false) {
- $tabs['newest']['selected'] = true;
-}
-
foreach ($tabs as $name => $tab) {
$tab['name'] = $name;
+ if ($vars['selected'] == $name) {
+ $tab['selected'] = true;
+ }
+
elgg_register_menu_item('filter', $tab);
}
diff --git a/mod/groups/views/default/groups/js.php b/mod/groups/views/default/groups/js.php
index ad742445b..1b4d33f32 100644
--- a/mod/groups/views/default/groups/js.php
+++ b/mod/groups/views/default/groups/js.php
@@ -1,5 +1,6 @@
-$(function() {
+// this adds a class to support IE8 and older
+elgg.register_hook_handler('init', 'system', function() {
// jQuery uses 0-based indexing
$('#groups-tools').children('li:even').addClass('odd');
});
diff --git a/mod/groups/views/default/groups/sidebar/find.php b/mod/groups/views/default/groups/sidebar/find.php
index c5c986759..c1a8da3c2 100644
--- a/mod/groups/views/default/groups/sidebar/find.php
+++ b/mod/groups/views/default/groups/sidebar/find.php
@@ -5,7 +5,7 @@
* @package ElggGroups
*/
$url = elgg_get_site_url() . 'groups/search';
-$body = elgg_view_form('groups/search', array(
+$body = elgg_view_form('groups/find', array(
'action' => $url,
'method' => 'get',
'disable_security' => true,
diff --git a/mod/groups/views/default/groups/sidebar/members.php b/mod/groups/views/default/groups/sidebar/members.php
index 49f14697c..11273d0e6 100644
--- a/mod/groups/views/default/groups/sidebar/members.php
+++ b/mod/groups/views/default/groups/sidebar/members.php
@@ -8,7 +8,7 @@
* @uses $vars['limit'] The number of members to display
*/
-$limit = elgg_extract('limit', $vars, 10);
+$limit = elgg_extract('limit', $vars, 14);
$all_link = elgg_view('output/url', array(
'href' => 'groups/members/' . $vars['entity']->guid,
@@ -24,6 +24,7 @@ $body = elgg_list_entities_from_relationship(array(
'limit' => $limit,
'list_type' => 'gallery',
'gallery_class' => 'elgg-gallery-users',
+ 'pagination' => false
));
$body .= "<div class='center mts'>$all_link</div>";
diff --git a/mod/groups/views/default/groups/sidebar/search.php b/mod/groups/views/default/groups/sidebar/search.php
new file mode 100644
index 000000000..226835715
--- /dev/null
+++ b/mod/groups/views/default/groups/sidebar/search.php
@@ -0,0 +1,15 @@
+<?php
+/**
+ * Search for content in this group
+ *
+ * @uses vars['entity'] ElggGroup
+ */
+
+$url = elgg_get_site_url() . 'search';
+$body = elgg_view_form('groups/search', array(
+ 'action' => $url,
+ 'method' => 'get',
+ 'disable_security' => true,
+), $vars);
+
+echo elgg_view_module('aside', elgg_echo('groups:search_in_group'), $body); \ No newline at end of file
diff --git a/mod/htmlawed/manifest.xml b/mod/htmlawed/manifest.xml
index 5c1f14cb5..074f98fb3 100644
--- a/mod/htmlawed/manifest.xml
+++ b/mod/htmlawed/manifest.xml
@@ -8,7 +8,7 @@
<description>Provides security filtering. Disabling this plugin is extremely insecure. DO NOT DISABLE.</description>
<website>http://www.elgg.org/</website>
<copyright>See COPYRIGHT.txt</copyright>
- <license>GNU General Public License version 3</license>
+ <license>GNU General Public License version 2</license>
<requires>
<type>elgg_release</type>
<version>1.8</version>
diff --git a/mod/likes/views/default/likes/button.php b/mod/likes/views/default/likes/button.php
index 3f2f073cc..bc7c8fd8a 100644
--- a/mod/likes/views/default/likes/button.php
+++ b/mod/likes/views/default/likes/button.php
@@ -24,11 +24,6 @@ if (elgg_is_logged_in() && $vars['entity']->canAnnotate(0, 'likes')) {
);
$likes_button = elgg_view('output/url', $params);
} else {
- $options = array(
- 'guid' => $guid,
- 'annotation_name' => 'likes',
- 'owner_guid' => elgg_get_logged_in_user_guid()
- );
$url = elgg_get_site_url() . "action/likes/delete?guid={$guid}";
$params = array(
'href' => $url,
diff --git a/mod/logbrowser/languages/en.php b/mod/logbrowser/languages/en.php
index 3b6ead272..b1d2681dd 100644
--- a/mod/logbrowser/languages/en.php
+++ b/mod/logbrowser/languages/en.php
@@ -17,11 +17,14 @@ $english = array(
'logbrowser:explore' => 'Explore log',
'logbrowser:date' => 'Date and time',
+ 'logbrowser:ip_address' => 'IP address',
'logbrowser:user:name' => 'User',
'logbrowser:user:guid' => 'User GUID',
'logbrowser:object' => 'Object type',
'logbrowser:object:guid' => 'Object GUID',
'logbrowser:action' => 'Action',
+
+ 'logbrowser:no_result' => 'No results',
);
add_translation("en", $english); \ No newline at end of file
diff --git a/mod/logbrowser/views/default/admin/administer_utilities/logbrowser.php b/mod/logbrowser/views/default/admin/administer_utilities/logbrowser.php
index a04ef686a..9506c9d9f 100644
--- a/mod/logbrowser/views/default/admin/administer_utilities/logbrowser.php
+++ b/mod/logbrowser/views/default/admin/administer_utilities/logbrowser.php
@@ -12,13 +12,20 @@ $offset = get_input('offset');
$search_username = get_input('search_username');
if ($search_username) {
- if ($user = get_user_by_username($search_username)) {
+ $user = get_user_by_username($search_username);
+ if ($user) {
$user_guid = $user->guid;
+ } else {
+ $user_guid = null;
}
} else {
- $user_guid = get_input('user_guid',0);
+ $user_guid = get_input('user_guid', null);
if ($user_guid) {
$user_guid = (int) $user_guid;
+ $user = get_entity($user_guid);
+ if ($user) {
+ $search_username = $user->username;
+ }
} else {
$user_guid = null;
}
@@ -34,15 +41,26 @@ if ($timeupper) {
$timeupper = strtotime($timeupper);
}
+$ip_address = get_input('ip_address');
+
$refine = elgg_view('logbrowser/refine', array(
- 'user_guid' => $user_guid,
'timeupper' => $timeupper,
'timelower' => $timelower,
+ 'ip_address' => $ip_address,
+ 'username' => $search_username,
));
// Get log entries
-$log = get_system_log($user_guid, "", "", "","", $limit, $offset, false, $timeupper, $timelower);
-$count = get_system_log($user_guid, "", "", "","", $limit, $offset, true, $timeupper, $timelower);
+$log = get_system_log($user_guid, "", "", "","", $limit, $offset, false, $timeupper, $timelower,
+ 0, $ip_address);
+$count = get_system_log($user_guid, "", "", "","", $limit, $offset, true, $timeupper, $timelower,
+ 0, $ip_address);
+
+// if user does not exist, we have no results
+if ($search_username && is_null($user_guid)) {
+ $log = false;
+ $count = 0;
+}
$table = elgg_view('logbrowser/table', array('log_entries' => $log));
diff --git a/mod/logbrowser/views/default/forms/logbrowser/refine.php b/mod/logbrowser/views/default/forms/logbrowser/refine.php
index ff3f48b03..ebf7f10ed 100644
--- a/mod/logbrowser/views/default/forms/logbrowser/refine.php
+++ b/mod/logbrowser/views/default/forms/logbrowser/refine.php
@@ -3,34 +3,35 @@
* Form body for refining the log browser search.
* Look for a particular person or in a time window.
*
- * @uses $vars['user_guid']
+ * @uses $vars['username']
+ * @uses $vars['ip_address']
* @uses $vars['timelower']
* @uses $vars['timeupper']
*/
if (isset($vars['timelower'])) {
- $lowerval = date('r',$vars['timelower']);
+ $lowerval = date('r', $vars['timelower']);
} else {
$lowerval = "";
}
if (isset($vars['timeupper'])) {
- $upperval = date('r',$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 = "";
-}
-
+$ip_address = elgg_extract('ip_address', $vars);
+$username = elgg_extract('username', $vars);
$form = "<div>" . elgg_echo('logbrowser:user');
$form .= elgg_view('input/text', array(
'name' => 'search_username',
- 'value' => $userval,
+ 'value' => $username,
+)) . "</div>";
+
+$form .= "<div>" . elgg_echo('logbrowser:ip_address');
+$form .= elgg_view('input/text', array(
+ 'name' => 'ip_address',
+ 'value' => $ip_address,
)) . "</div>";
$form .= "<div>" . elgg_echo('logbrowser:starttime');
diff --git a/mod/logbrowser/views/default/logbrowser/table.php b/mod/logbrowser/views/default/logbrowser/table.php
index b7f6a1f20..1223c1456 100644
--- a/mod/logbrowser/views/default/logbrowser/table.php
+++ b/mod/logbrowser/views/default/logbrowser/table.php
@@ -11,6 +11,7 @@ $log_entries = $vars['log_entries'];
<table class="elgg-table">
<tr>
<th><?php echo elgg_echo('logbrowser:date'); ?></th>
+ <th><?php echo elgg_echo('logbrowser:ip_address'); ?></th>
<th><?php echo elgg_echo('logbrowser:user:name'); ?></th>
<th><?php echo elgg_echo('logbrowser:user:guid'); ?></th>
<th><?php echo elgg_echo('logbrowser:object'); ?></th>
@@ -20,6 +21,12 @@ $log_entries = $vars['log_entries'];
<?php
$alt = '';
foreach ($log_entries as $entry) {
+ if ($entry->ip_address) {
+ $ip_address = $entry->ip_address;
+ } else {
+ $ip_address = '&nbsp;';
+ }
+
$user = get_entity($entry->performed_by_guid);
if ($user) {
$user_link = elgg_view('output/url', array(
@@ -51,6 +58,9 @@ $log_entries = $vars['log_entries'];
<td class="log-entry-time">
<?php echo date('r', $entry->time_created); ?>
</td>
+ <td class="log-entry-ip-address">
+ <?php echo $ip_address; ?>
+ </td>
<td class="log-entry-user">
<?php echo $user_link; ?>
</td>
@@ -72,4 +82,9 @@ $log_entries = $vars['log_entries'];
$alt = $alt ? '' : 'class="alt"';
}
?>
-</table> \ No newline at end of file
+</table>
+<?php
+if (!$log_entries) {
+ echo elgg_echo('logbrowser:no_result');
+ return true;
+}
diff --git a/mod/members/pages/members/search.php b/mod/members/pages/members/search.php
index 94127768a..1f0444d67 100644
--- a/mod/members/pages/members/search.php
+++ b/mod/members/pages/members/search.php
@@ -17,7 +17,14 @@ if ($vars['search_type'] == 'tag') {
$results = elgg_trigger_plugin_hook('search', 'tags', $options, array());
$count = $results['count'];
$users = $results['entities'];
- $content = elgg_view_entity_list($users, $count, $offset, $limit, false, false, true);
+ $content = elgg_view_entity_list($users, array(
+ 'count' => $count,
+ 'offset' => $offset,
+ 'limit' => $limit,
+ 'full_view' => false,
+ 'list_type_toggle' => false,
+ 'pagination' => true,
+ ));
} else {
$name = sanitize_string(get_input('name'));
diff --git a/mod/messageboard/actions/delete.php b/mod/messageboard/actions/delete.php
index a40329cb5..a1f62278c 100644
--- a/mod/messageboard/actions/delete.php
+++ b/mod/messageboard/actions/delete.php
@@ -9,7 +9,6 @@ $annotation_id = (int) get_input('annotation_id');
$message = elgg_get_annotation_from_id($annotation_id);
if ($message && $message->canEdit() && $message->delete()) {
- remove_from_river_by_annotation($annotation_id);
system_message(elgg_echo("messageboard:deleted"));
} else {
system_message(elgg_echo("messageboard:notdeleted"));
diff --git a/mod/messageboard/views/default/messageboard/js.php b/mod/messageboard/views/default/messageboard/js.php
index 3295c68de..79472069d 100644
--- a/mod/messageboard/views/default/messageboard/js.php
+++ b/mod/messageboard/views/default/messageboard/js.php
@@ -44,7 +44,8 @@ elgg.messageboard.deletePost = function(e) {
if (confirm(confirmText)) {
elgg.action($(this).attr('href'), {
success: function() {
- $(link).closest('li').remove();
+ var item = $(link).closest('.elgg-item');
+ item.remove();
}
});
}
diff --git a/mod/messages/views/default/forms/messages/process.php b/mod/messages/views/default/forms/messages/process.php
index f86c3217a..cb30792e9 100644
--- a/mod/messages/views/default/forms/messages/process.php
+++ b/mod/messages/views/default/forms/messages/process.php
@@ -19,10 +19,12 @@ echo $messages;
echo '</div>';
echo '<div class="elgg-foot messages-buttonbank">';
+
echo elgg_view('input/submit', array(
'value' => elgg_echo('delete'),
'name' => 'delete',
- 'class' => 'elgg-button-delete',
+ 'class' => 'elgg-button-delete elgg-requires-confirmation',
+ 'title' => elgg_echo('deleteconfirm:plural'),
));
if ($vars['folder'] == "inbox") {
diff --git a/mod/messages/views/default/messages/js.php b/mod/messages/views/default/messages/js.php
index 39f93e645..60cf36b92 100644
--- a/mod/messages/views/default/messages/js.php
+++ b/mod/messages/views/default/messages/js.php
@@ -1,5 +1,6 @@
-$(function() {
+// messages plugin toggle
+elgg.register_hook_handler('init', 'system', function() {
$("#messages-toggle").click(function() {
$('input[type=checkbox]').click();
});
diff --git a/mod/pages/actions/pages/delete.php b/mod/pages/actions/pages/delete.php
index dfa0de98d..7a314a280 100644
--- a/mod/pages/actions/pages/delete.php
+++ b/mod/pages/actions/pages/delete.php
@@ -9,8 +9,9 @@
$guid = get_input('guid');
$page = get_entity($guid);
-if ($page) {
- if ($page->canEdit()) {
+if (elgg_instanceof($page, 'object', 'page') || elgg_instanceof($page, 'object', 'page_top')) {
+ // only allow owners and admin to delete
+ if (elgg_is_admin_logged_in() || elgg_get_logged_in_user_guid() == $page->getOwnerGuid()) {
$container = get_entity($page->container_guid);
// Bring all child elements forward
diff --git a/mod/pages/actions/pages/edit.php b/mod/pages/actions/pages/edit.php
index 6950d4b2f..a32e4a4ba 100644
--- a/mod/pages/actions/pages/edit.php
+++ b/mod/pages/actions/pages/edit.php
@@ -47,7 +47,19 @@ if ($page_guid) {
}
if (sizeof($input) > 0) {
+ // don't change access if not an owner/admin
+ $user = elgg_get_logged_in_user_entity();
+ $can_change_access = true;
+
+ if ($user && $page) {
+ $can_change_access = $user->isAdmin() || $user->getGUID() == $page->owner_guid;
+ }
+
foreach ($input as $name => $value) {
+ if (($name == 'access_id' || $name == 'write_access_id') && !$can_change_access) {
+ continue;
+ }
+
$page->$name = $value;
}
}
@@ -74,6 +86,6 @@ if ($page->save()) {
forward($page->getURL());
} else {
- register_error(elgg_echo('pages:error:no_save'));
+ register_error(elgg_echo('pages:error:notsaved'));
forward(REFERER);
}
diff --git a/mod/pages/images/pages.gif b/mod/pages/images/pages.gif
index 2e4ee761a..7efcb7278 100644
--- a/mod/pages/images/pages.gif
+++ b/mod/pages/images/pages.gif
Binary files differ
diff --git a/mod/pages/images/pages_lrg.gif b/mod/pages/images/pages_lrg.gif
index 2e41e4739..234a52672 100644
--- a/mod/pages/images/pages_lrg.gif
+++ b/mod/pages/images/pages_lrg.gif
Binary files differ
diff --git a/mod/pages/languages/en.php b/mod/pages/languages/en.php
index 1c6d0318c..eb9d22708 100644
--- a/mod/pages/languages/en.php
+++ b/mod/pages/languages/en.php
@@ -27,7 +27,16 @@ $english = array(
'pages:revision' => "Revision",
'pages:navigation' => "Navigation",
- 'pages:via' => "via pages",
+ 'pages:new' => "A new page",
+ 'pages:notification' =>
+'%s added a new page:
+
+%s
+%s
+
+View and comment on the new page:
+%s
+',
'item:object:page_top' => 'Top-level pages',
'item:object:page' => 'Pages',
'pages:nogroup' => 'This group does not have any pages yet',
diff --git a/mod/pages/lib/pages.php b/mod/pages/lib/pages.php
index 0a6f3a620..3f27118a6 100644
--- a/mod/pages/lib/pages.php
+++ b/mod/pages/lib/pages.php
@@ -78,8 +78,13 @@ function pages_register_navigation_tree($container) {
'type' => 'object',
'subtype' => 'page_top',
'container_guid' => $container->getGUID(),
+ 'limit' => 0,
));
+ if (!$top_pages) {
+ return;
+ }
+
foreach ($top_pages as $page) {
elgg_register_menu_item('pages_nav', array(
'name' => $page->getGUID(),
@@ -96,6 +101,7 @@ function pages_register_navigation_tree($container) {
'subtype' => 'page',
'metadata_name' => 'parent_guid',
'metadata_value' => $parent->getGUID(),
+ 'limit' => 0,
));
foreach ($children as $child) {
@@ -109,4 +115,4 @@ function pages_register_navigation_tree($container) {
}
}
}
-}
+} \ No newline at end of file
diff --git a/mod/pages/manifest.xml b/mod/pages/manifest.xml
index 6990bd6b0..4cf999f45 100644
--- a/mod/pages/manifest.xml
+++ b/mod/pages/manifest.xml
@@ -6,7 +6,7 @@
<category>bundled</category>
<category>content</category>
<category>widget</category>
- <description>Elgg Pages</description>
+ <description>Collaborative editing tool. Enables users to create pages similar to a wiki without having to know wiki syntax.</description>
<website>http://www.elgg.org</website>
<copyright>See COPYRIGHT.txt</copyright>
<license>GNU General Public License version 2</license>
diff --git a/mod/pages/pages/pages/history.php b/mod/pages/pages/pages/history.php
index a63b37a7a..872596179 100644
--- a/mod/pages/pages/pages/history.php
+++ b/mod/pages/pages/pages/history.php
@@ -30,7 +30,12 @@ elgg_push_breadcrumb(elgg_echo('pages:history'));
$title = $page->title . ": " . elgg_echo('pages:history');
-$content = list_annotations($page_guid, 'page', 20, false);
+$content = elgg_list_annotations(array(
+ 'guid' => $page_guid,
+ 'annotation_name' => 'page',
+ 'limit' => 20,
+ 'order_by' => "n_table.time_created desc"
+));
$body = elgg_view_layout('content', array(
'filter' => '',
diff --git a/mod/pages/pages/pages/owner.php b/mod/pages/pages/pages/owner.php
index 2ff45ae0c..b29332ee1 100644
--- a/mod/pages/pages/pages/owner.php
+++ b/mod/pages/pages/pages/owner.php
@@ -23,7 +23,6 @@ $content = elgg_list_entities(array(
'types' => 'object',
'subtypes' => 'page_top',
'container_guid' => elgg_get_page_owner_guid(),
- 'limit' => $limit,
'full_view' => false,
));
if (!$content) {
diff --git a/mod/pages/pages/pages/view.php b/mod/pages/pages/pages/view.php
index 5dfb76b55..6b9d03f49 100644
--- a/mod/pages/pages/pages/view.php
+++ b/mod/pages/pages/pages/view.php
@@ -8,6 +8,7 @@
$page_guid = get_input('guid');
$page = get_entity($page_guid);
if (!$page) {
+ register_error(elgg_echo('noaccess'));
forward();
}
@@ -32,7 +33,8 @@ elgg_push_breadcrumb($title);
$content = elgg_view_entity($page, array('full_view' => true));
$content .= elgg_view_comments($page);
-if (elgg_get_logged_in_user_guid() == $page->getOwnerGuid()) {
+// can add subpage if can edit this page and write to container (such as a group)
+if ($page->canEdit() && $container->canWriteToContainer(0, 'object', 'page')) {
$url = "pages/add/$page->guid";
elgg_register_menu_item('title', array(
'name' => 'subpage',
diff --git a/mod/pages/start.php b/mod/pages/start.php
index b2f26c719..834e98870 100644
--- a/mod/pages/start.php
+++ b/mod/pages/start.php
@@ -189,10 +189,12 @@ function pages_icon_url_override($hook, $type, $returnvalue, $params) {
if (elgg_instanceof($entity, 'object', 'page_top') ||
elgg_instanceof($entity, 'object', 'page')) {
switch ($params['size']) {
+ case 'topbar':
+ case 'tiny':
case 'small':
return 'mod/pages/images/pages.gif';
break;
- case 'medium':
+ default:
return 'mod/pages/images/pages_lrg.gif';
break;
}
@@ -264,13 +266,18 @@ function page_notify_message($hook, $entity_type, $returnvalue, $params) {
$entity = $params['entity'];
$to_entity = $params['to_entity'];
$method = $params['method'];
- if (($entity instanceof ElggEntity) && (($entity->getSubtype() == 'page_top') || ($entity->getSubtype() == 'page'))) {
+
+ if (elgg_instanceof($entity, 'object', 'page') || elgg_instanceof($entity, 'object', 'page_top')) {
$descr = $entity->description;
$title = $entity->title;
- //@todo why?
- $url = elgg_get_site_url() . "view/" . $entity->guid;
$owner = $entity->getOwnerEntity();
- return $owner->name . ' ' . elgg_echo("pages:via") . ': ' . $title . "\n\n" . $descr . "\n\n" . $entity->getURL();
+
+ return elgg_echo('pages:notification', array(
+ $owner->name,
+ $title,
+ $descr,
+ $entity->getURL()
+ ));
}
return null;
}
diff --git a/mod/pages/views/default/forms/pages/edit.php b/mod/pages/views/default/forms/pages/edit.php
index 20737a121..9469f5eb9 100644
--- a/mod/pages/views/default/forms/pages/edit.php
+++ b/mod/pages/views/default/forms/pages/edit.php
@@ -6,7 +6,18 @@
*/
$variables = elgg_get_config('pages');
+$user = elgg_get_logged_in_user_entity();
+$entity = elgg_extract('entity', $vars);
+$can_change_access = true;
+if ($user && $entity) {
+ $can_change_access = ($user->isAdmin() || $user->getGUID() == $entity->owner_guid);
+}
+
foreach ($variables as $name => $type) {
+ // don't show read / write access inputs for non-owners or admin when editing
+ if (($type == 'access' || $type == 'write_access') && !$can_change_access) {
+ continue;
+ }
?>
<div>
<label><?php echo elgg_echo("pages:$name") ?></label>
@@ -14,8 +25,8 @@ foreach ($variables as $name => $type) {
if ($type != 'longtext') {
echo '<br />';
}
- ?>
- <?php echo elgg_view("input/$type", array(
+
+ echo elgg_view("input/$type", array(
'name' => $name,
'value' => $vars[$name],
));
diff --git a/mod/pages/views/default/object/page_top.php b/mod/pages/views/default/object/page_top.php
index e78289f28..945a22eed 100644
--- a/mod/pages/views/default/object/page_top.php
+++ b/mod/pages/views/default/object/page_top.php
@@ -45,7 +45,6 @@ $editor_link = elgg_view('output/url', array(
$date = elgg_view_friendly_time($annotation->time_created);
$editor_text = elgg_echo('pages:strapline', array($date, $editor_link));
-$tags = elgg_view('output/tags', array('tags' => $page->tags));
$categories = elgg_view('output/categories', $vars);
$comments_count = $page->countComments();
@@ -82,7 +81,6 @@ if ($full) {
'entity' => $page,
'metadata' => $metadata,
'subtitle' => $subtitle,
- 'tags' => $tags,
);
$params = $params + $vars;
$summary = elgg_view('object/elements/summary', $params);
@@ -104,7 +102,6 @@ if ($full) {
'entity' => $page,
'metadata' => $metadata,
'subtitle' => $subtitle,
- 'tags' => $tags,
'content' => $excerpt,
);
$params = $params + $vars;
diff --git a/mod/profile/icondirect.php b/mod/profile/icondirect.php
index f7188455e..6c3148f2b 100644
--- a/mod/profile/icondirect.php
+++ b/mod/profile/icondirect.php
@@ -12,8 +12,16 @@ require_once(dirname(dirname(dirname(__FILE__))). '/engine/settings.php');
global $CONFIG;
$join_date = (int)$_GET['joindate'];
+$last_cache = (int)$_GET['lastcache']; // icontime
$guid = (int)$_GET['guid'];
+// If is the same ETag, content didn't changed.
+$etag = $last_cache . $guid;
+if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && trim($_SERVER['HTTP_IF_NONE_MATCH']) == $etag) {
+ header("HTTP/1.1 304 Not Modified");
+ exit;
+}
+
$size = strtolower($_GET['size']);
if (!in_array($size, array('large', 'medium', 'small', 'tiny', 'master', 'topbar'))) {
$size = "medium";
@@ -48,6 +56,7 @@ if ($mysql_dblink) {
header("Pragma: public");
header("Cache-Control: public");
header("Content-Length: " . strlen($contents));
+ header("ETag: $etag");
// this chunking is done for supposedly better performance
$split_string = str_split($contents, 1024);
foreach ($split_string as $chunk) {
diff --git a/mod/profile/views/default/profile/js.php b/mod/profile/views/default/profile/js.php
index 16dec59df..5a08a90bd 100644
--- a/mod/profile/views/default/profile/js.php
+++ b/mod/profile/views/default/profile/js.php
@@ -1,6 +1,9 @@
+
+// force the first column to at least be as large as the profile box in cols 2 and 3
+// we also want to run before the widget init happens so priority is < 500
elgg.register_hook_handler('init', 'system', function() {
// 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
+}, 400);
diff --git a/mod/search/pages/search/index.php b/mod/search/pages/search/index.php
index efa3ec037..fcd95c43e 100644
--- a/mod/search/pages/search/index.php
+++ b/mod/search/pages/search/index.php
@@ -145,11 +145,7 @@ foreach ($custom_types as $type) {
$data = htmlspecialchars(http_build_query(array(
'q' => $query,
- 'entity_subtype' => $entity_subtype,
- 'entity_type' => $entity_type,
- 'owner_guid' => $owner_guid,
'search_type' => $type,
- 'friends' => $friends
)));
$url = elgg_get_site_url()."search?$data";
@@ -240,8 +236,6 @@ if ($search_type != 'entities' || $search_type == 'all') {
$current_params = $params;
$current_params['search_type'] = $type;
- // custom search types have no subtype.
- unset($current_params['subtype']);
$results = elgg_trigger_plugin_hook('search', $type, $current_params, array());
@@ -263,7 +257,11 @@ if ($search_type != 'entities' || $search_type == 'all') {
}
// highlight search terms
-$searched_words = search_remove_ignored_words($display_query, 'array');
+if ($search_type == 'tags') {
+ $searched_words = array($display_query);
+} else {
+ $searched_words = search_remove_ignored_words($display_query, 'array');
+}
$highlighted_query = search_highlight_words($searched_words, $display_query);
$body = elgg_view_title(elgg_echo('search:results', array("\"$highlighted_query\"")));
diff --git a/mod/search/search_hooks.php b/mod/search/search_hooks.php
index ab000f6f6..2143a0d24 100644
--- a/mod/search/search_hooks.php
+++ b/mod/search/search_hooks.php
@@ -284,7 +284,7 @@ function search_tags_hook($hook, $type, $value, $params) {
}
$tags_str = implode('. ', $matched_tags_strs);
- $tags_str = search_get_highlighted_relevant_substrings($tags_str, $params['query']);
+ $tags_str = search_get_highlighted_relevant_substrings($tags_str, $params['query'], 30, 300, true);
$entity->setVolatileData('search_matched_title', $title_str);
$entity->setVolatileData('search_matched_description', $desc_str);
diff --git a/mod/search/start.php b/mod/search/start.php
index bb8531e9c..d2d7ed3c2 100644
--- a/mod/search/start.php
+++ b/mod/search/start.php
@@ -83,15 +83,18 @@ function search_page_handler($page) {
* @param string $query
* @param int $min_match_context = 30
* @param int $max_length = 300
+ * @param bool $tag_match Search is for tags. Don't ignore words.
* @return string
*/
-function search_get_highlighted_relevant_substrings($haystack, $query, $min_match_context = 30, $max_length = 300) {
+function search_get_highlighted_relevant_substrings($haystack, $query, $min_match_context = 30, $max_length = 300, $tag_match = false) {
$haystack = strip_tags($haystack);
$haystack_length = elgg_strlen($haystack);
$haystack_lc = elgg_strtolower($haystack);
- $words = search_remove_ignored_words($query, 'array');
+ if (!$tag_match) {
+ $words = search_remove_ignored_words($query, 'array');
+ }
// if haystack < $max_length return the entire haystack w/formatting immediately
if ($haystack_length <= $max_length) {
diff --git a/mod/search/views/default/search/list.php b/mod/search/views/default/search/list.php
index c5249fe77..1ed40be1b 100644
--- a/mod/search/views/default/search/list.php
+++ b/mod/search/views/default/search/list.php
@@ -39,7 +39,7 @@ $url = elgg_get_site_url() . "search?$query";
// get pagination
if (array_key_exists('pagination', $vars['params']) && $vars['params']['pagination']) {
$nav = elgg_view('navigation/pagination',array(
- 'baseurl' => $url,
+ 'base_url' => $url,
'offset' => $vars['params']['offset'],
'count' => $vars['results']['count'],
'limit' => $vars['params']['limit'],
diff --git a/mod/search/views/default/search/search_box.php b/mod/search/views/default/search/search_box.php
index 87d59519c..ff12ae4f0 100644
--- a/mod/search/views/default/search/search_box.php
+++ b/mod/search/views/default/search/search_box.php
@@ -38,6 +38,7 @@ $display_query = htmlspecialchars($display_query, ENT_QUOTES, 'UTF-8', false);
<form class="<?php echo $class; ?>" action="<?php echo elgg_get_site_url(); ?>search" method="get">
<fieldset>
<input type="text" class="search-input" size="21" name="q" value="<?php echo elgg_echo('search'); ?>" onblur="if (this.value=='') { this.value='<?php echo elgg_echo('search'); ?>' }" onfocus="if (this.value=='<?php echo elgg_echo('search'); ?>') { this.value='' };" />
+ <input type="hidden" name="search_type" value="all" />
<input type="submit" value="<?php echo elgg_echo('search:go'); ?>" class="search-submit-button" />
</fieldset>
-</form> \ No newline at end of file
+</form>
diff --git a/mod/thewire/actions/add.php b/mod/thewire/actions/add.php
index 97b630678..6b3d8d5ba 100644
--- a/mod/thewire/actions/add.php
+++ b/mod/thewire/actions/add.php
@@ -17,7 +17,7 @@ if (empty($body)) {
forward(REFERER);
}
-$guid = thewire_save_post($body, get_loggedin_userid(), $access_id, $parent_guid, $method);
+$guid = thewire_save_post($body, elgg_get_logged_in_user_guid(), $access_id, $parent_guid, $method);
if (!$guid) {
register_error(elgg_echo("thewire:error"));
forward(REFERER);
diff --git a/mod/thewire/classes/ElggWire.php b/mod/thewire/classes/ElggWire.php
index 3242dd5cb..9c92dd8f2 100644
--- a/mod/thewire/classes/ElggWire.php
+++ b/mod/thewire/classes/ElggWire.php
@@ -1,6 +1,10 @@
<?php
/**
* ElggWire Class
+ *
+ * @property string $method The method used to create the wire post (site, sms, api)
+ * @property bool $reply Whether this wire post was a reply to another post
+ * @property int $wire_thread The identifier of the thread for this wire post
*/
class ElggWire extends ElggObject {
diff --git a/mod/thewire/pages/thewire/owner.php b/mod/thewire/pages/thewire/owner.php
index f544aa655..6246c1770 100644
--- a/mod/thewire/pages/thewire/owner.php
+++ b/mod/thewire/pages/thewire/owner.php
@@ -14,10 +14,12 @@ $title = elgg_echo('thewire:user', array($owner->name));
elgg_push_breadcrumb(elgg_echo('thewire'), "thewire/all");
elgg_push_breadcrumb($owner->name);
+$context = '';
if (elgg_get_logged_in_user_guid() == $owner->guid) {
$form_vars = array('class' => 'thewire-form');
$content = elgg_view_form('thewire/add', $form_vars);
$content .= elgg_view('input/urlshortener');
+ $context = 'mine';
}
$content .= elgg_list_entities(array(
@@ -28,7 +30,7 @@ $content .= elgg_list_entities(array(
));
$body = elgg_view_layout('content', array(
- 'filter_context' => 'mine',
+ 'filter_context' => $context,
'content' => $content,
'title' => $title,
'sidebar' => elgg_view('thewire/sidebar'),
diff --git a/mod/thewire/pages/thewire/view.php b/mod/thewire/pages/thewire/view.php
new file mode 100644
index 000000000..1818e725a
--- /dev/null
+++ b/mod/thewire/pages/thewire/view.php
@@ -0,0 +1,30 @@
+<?php
+/**
+ * View individual wire post
+ */
+
+$post = get_entity(get_input('guid'));
+if (!$post) {
+ register_error(elgg_echo('noaccess'));
+ forward('');
+}
+$owner = $post->getOwnerEntity();
+if (!$owner) {
+ forward();
+}
+
+$title = elgg_echo('thewire:by', array($owner->name));
+
+elgg_push_breadcrumb(elgg_echo('thewire'), 'thewire/all');
+elgg_push_breadcrumb($owner->name, 'thewire/owner/' . $owner->username);
+elgg_push_breadcrumb($title);
+
+$content = elgg_view_entity($post);
+
+$body = elgg_view_layout('content', array(
+ 'filter' => false,
+ 'content' => $content,
+ 'title' => $title,
+));
+
+echo elgg_view_page($title, $body);
diff --git a/mod/thewire/start.php b/mod/thewire/start.php
index 328e5d46c..8e3b5224a 100644
--- a/mod/thewire/start.php
+++ b/mod/thewire/start.php
@@ -18,18 +18,14 @@ elgg_register_event_handler('init', 'system', 'thewire_init');
* The Wire initialization
*/
function thewire_init() {
- global $CONFIG;
-
- // this can be removed in favor of activate/deactivate scripts
- if (!update_subtype('object', 'thewire', 'ElggWire')) {
- add_subtype('object', 'thewire', 'ElggWire');
- }
// register the wire's JavaScript
$thewire_js = elgg_get_simplecache_url('js', 'thewire');
elgg_register_simplecache_view('js/thewire');
elgg_register_js('elgg.thewire', $thewire_js, 'footer');
+ elgg_register_ajax_view('thewire/previous');
+
// add a site navigation item
$item = new ElggMenuItem('thewire', elgg_echo('thewire'), 'thewire/all');
elgg_register_menu_item('site', $item);
@@ -66,7 +62,7 @@ function thewire_init() {
elgg_register_plugin_hook_handler('notify:entity:message', 'object', 'thewire_notify_message');
// Register actions
- $action_base = $CONFIG->pluginspath . 'thewire/actions';
+ $action_base = elgg_get_plugins_path() . 'thewire/actions';
elgg_register_action("thewire/add", "$action_base/add.php");
elgg_register_action("thewire/delete", "$action_base/delete.php");
@@ -81,7 +77,8 @@ function thewire_init() {
* thewire/owner/<username> View this user's wire posts
* thewire/following/<username> View the posts of those this user follows
* thewire/reply/<guid> Reply to a post
- * thewire/view/<guid> View a conversation thread
+ * thewire/view/<guid> View a post
+ * thewire/thread/<id> View a conversation thread
* thewire/tag/<tag> View wire posts tagged with <tag>
*
* @param array $page From the page_handler function
@@ -108,6 +105,12 @@ function thewire_page_handler($page) {
include "$base_dir/owner.php";
break;
+ case "view":
+ if (isset($page[1])) {
+ set_input('guid', $page[1]);
+ }
+ include "$base_dir/view.php";
+
case "thread":
if (isset($page[1])) {
set_input('thread_id', $page[1]);
@@ -217,7 +220,7 @@ function thewire_filter($text) {
// usernames
$text = preg_replace(
- '/(^|[^\w])@([\w.]+)/',
+ '/(^|[^\w])@([\p{L}\p{Nd}._]+)/u',
'$1<a href="' . $CONFIG->wwwroot . 'thewire/owner/$2">@$2</a>',
$text);
@@ -308,7 +311,7 @@ function thewire_save_post($text, $userid, $access_id, $parent_guid = 0, $method
*/
function thewire_send_response_notification($guid, $parent_guid, $user) {
$parent_owner = get_entity($parent_guid)->getOwnerEntity();
- $user = get_loggedin_user();
+ $user = elgg_get_logged_in_user_entity();
// check to make sure user is not responding to self
if ($parent_owner->guid != $user->guid) {
diff --git a/mod/thewire/tests/regex.php b/mod/thewire/tests/regex.php
index f5487a422..c73e06bdc 100644
--- a/mod/thewire/tests/regex.php
+++ b/mod/thewire/tests/regex.php
@@ -127,6 +127,12 @@ class TheWireRegexTest extends ElggCoreUnitTest {
$expected = "test (" . $this->getUserWireLink('user') . ") test";
$result = thewire_filter($text);
$this->assertEqual($result, $expected);
+
+ // utf8 characters
+ $text = "@tyúkanyó";
+ $expected = $this->getUserWireLink('tyúkanyó');
+ $result = thewire_filter($text);
+ $this->assertEqual($result, $expected);
}
/**
diff --git a/mod/twitter_api/actions/twitter_api/interstitial_settings.php b/mod/twitter_api/actions/twitter_api/interstitial_settings.php
index 5f742efd8..880623973 100644
--- a/mod/twitter_api/actions/twitter_api/interstitial_settings.php
+++ b/mod/twitter_api/actions/twitter_api/interstitial_settings.php
@@ -6,8 +6,8 @@ elgg_make_sticky_form('twitter_api_interstitial');
$display_name = get_input('display_name');
$email = get_input('email');
-$password_1 = get_input('password_1');
-$password_2 = get_input('password_2');
+$password_1 = get_input('password_1', null, false);
+$password_2 = get_input('password_2', null, false);
if (!$display_name) {
register_error(elgg_echo('twitter_api:interstitial:no_display_name'));
diff --git a/mod/twitter_api/lib/twitter_api.php b/mod/twitter_api/lib/twitter_api.php
index 355123992..fbce00d34 100644
--- a/mod/twitter_api/lib/twitter_api.php
+++ b/mod/twitter_api/lib/twitter_api.php
@@ -109,7 +109,7 @@ function twitter_api_login() {
$user = twitter_api_create_user($twitter);
$site_name = elgg_get_site_entity()->name;
system_message(elgg_echo('twitter_api:login:email', array($site_name)));
- $forward = "twitter_api/intersitial";
+ $forward = "twitter_api/interstitial";
}
// set twitter services tokens
diff --git a/mod/uservalidationbyemail/start.php b/mod/uservalidationbyemail/start.php
index ea59a2e7b..f98f57faf 100644
--- a/mod/uservalidationbyemail/start.php
+++ b/mod/uservalidationbyemail/start.php
@@ -184,7 +184,11 @@ function uservalidationbyemail_page_handler($page) {
$user->enable();
elgg_pop_context();
- login($user);
+ try {
+ login($user);
+ } catch(LoginException $e){
+ register_error($e->getMessage());
+ }
} else {
register_error(elgg_echo('email:confirm:fail'));
}
diff --git a/mod/uservalidationbyemail/views/default/forms/uservalidationbyemail/bulk_action.php b/mod/uservalidationbyemail/views/default/forms/uservalidationbyemail/bulk_action.php
index 2afd6022d..cbd13a709 100644
--- a/mod/uservalidationbyemail/views/default/forms/uservalidationbyemail/bulk_action.php
+++ b/mod/uservalidationbyemail/views/default/forms/uservalidationbyemail/bulk_action.php
@@ -40,7 +40,7 @@ elgg_set_ignore_access($ia);
// setup pagination
$pagination = elgg_view('navigation/pagination',array(
- 'baseurl' => 'admin/users/unvalidated',
+ 'base_url' => 'admin/users/unvalidated',
'offset' => $offset,
'count' => $count,
'limit' => $limit,
diff --git a/pages/avatar/edit.php b/pages/avatar/edit.php
index eef8f8f8b..c71633b8b 100644
--- a/pages/avatar/edit.php
+++ b/pages/avatar/edit.php
@@ -10,8 +10,13 @@ elgg_set_context('profile_edit');
$title = elgg_echo('avatar:edit');
-$content = elgg_view('core/avatar/upload', array('entity' => elgg_get_page_owner_entity()));
-$content .= elgg_view('core/avatar/crop', array('entity' => elgg_get_page_owner_entity()));
+$entity = elgg_get_page_owner_entity();
+$content = elgg_view('core/avatar/upload', array('entity' => $entity));
+
+// only offer the crop view if an avatar has been uploaded
+if (isset($entity->icontime)) {
+ $content .= elgg_view('core/avatar/crop', array('entity' => $entity));
+}
$params = array(
'content' => $content,
diff --git a/pages/friends/index.php b/pages/friends/index.php
index 707402c64..63518a413 100644
--- a/pages/friends/index.php
+++ b/pages/friends/index.php
@@ -22,6 +22,9 @@ $options = array(
'full_view' => FALSE
);
$content = elgg_list_entities_from_relationship($options);
+if (!$content) {
+ $content = elgg_echo('friends:none');
+}
$params = array(
'content' => $content,
diff --git a/pages/friends/of.php b/pages/friends/of.php
index 5bbfa6dff..aa9ee8bee 100644
--- a/pages/friends/of.php
+++ b/pages/friends/of.php
@@ -22,6 +22,9 @@ $options = array(
'full_view' => FALSE
);
$content = elgg_list_entities_from_relationship($options);
+if (!$content) {
+ $content = elgg_echo('friends:none');
+}
$params = array(
'content' => $content,
diff --git a/pages/river.php b/pages/river.php
index 601faf16f..0e1511334 100644
--- a/pages/river.php
+++ b/pages/river.php
@@ -40,6 +40,9 @@ switch ($page_type) {
}
$activity = elgg_list_river($options);
+if (!$activity) {
+ $activity = elgg_echo('river:none');
+}
$content = elgg_view('core/river/filter', array('selector' => $selector));
diff --git a/upgrade.php b/upgrade.php
index ab769f542..963523200 100644
--- a/upgrade.php
+++ b/upgrade.php
@@ -20,17 +20,21 @@ define('UPGRADING', 'upgrading');
require_once(dirname(__FILE__) . "/engine/start.php");
if (get_input('upgrade') == 'upgrade') {
+ // disable the system log for upgrades to avoid exceptions when the schema changes.
+ elgg_unregister_event_handler('log', 'systemlog', 'system_log_default_logger');
+ elgg_unregister_event_handler('all', 'all', 'system_log_listener');
+
if (elgg_get_unprocessed_upgrades()) {
version_upgrade();
}
elgg_trigger_event('upgrade', 'system', null);
elgg_invalidate_simplecache();
- elgg_filepath_cache_reset();
+ elgg_reset_system_cache();
} else {
// if upgrading from < 1.8.0, check for the core view 'welcome' and bail if it's found.
// see http://trac.elgg.org/ticket/3064
- // we're not checking the exact view location because it's likely themes will have this view.
- // we're only concerned with core.
+ // we're not checking the view itself because it's likely themes will override this view.
+ // we're only concerned with core files.
$welcome = dirname(__FILE__) . '/views/default/welcome.php';
if (file_exists($welcome)) {
elgg_set_viewtype('failsafe');
diff --git a/version.php b/version.php
index 29870f93f..0fb757b9c 100644
--- a/version.php
+++ b/version.php
@@ -11,7 +11,7 @@
// YYYYMMDD = Elgg Date
// XX = Interim incrementer
-$version = 2011122100;
+$version = 2012061800;
// Human-friendly version name
-$release = '1.8.2';
+$release = '1.8.6';
diff --git a/views/default/admin/plugins.php b/views/default/admin/plugins.php
index b793175e0..42f153d0f 100644
--- a/views/default/admin/plugins.php
+++ b/views/default/admin/plugins.php
@@ -64,13 +64,7 @@ foreach ($installed_plugins as $id => $plugin) {
if (isset($plugin_categories)) {
foreach ($plugin_categories as $category) {
if (!array_key_exists($category, $categories)) {
- // 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;
+ $categories[$category] = ElggPluginManifest::getFriendlyCategory($category);
}
}
}
diff --git a/views/default/admin/statistics/overview.php b/views/default/admin/statistics/overview.php
index 2f5b25121..ac5aaac36 100644
--- a/views/default/admin/statistics/overview.php
+++ b/views/default/admin/statistics/overview.php
@@ -8,6 +8,6 @@
echo elgg_view('admin/statistics/extend');
-echo elgg_view_module('inline', elgg_echo('admin:statistics:label:basic'), elgg_view('admin/statistics/basic'));
+echo elgg_view_module('inline', elgg_echo('admin:statistics:label:basic'), elgg_view('admin/statistics/overview/basic'));
-echo elgg_view_module('inline', elgg_echo('admin:statistics:label:numentities'), elgg_view('admin/statistics/numentities')); \ No newline at end of file
+echo elgg_view_module('inline', elgg_echo('admin:statistics:label:numentities'), elgg_view('admin/statistics/overview/numentities'));
diff --git a/views/default/admin/statistics/basic.php b/views/default/admin/statistics/overview/basic.php
index 2c9b3b88e..2c9b3b88e 100644
--- a/views/default/admin/statistics/basic.php
+++ b/views/default/admin/statistics/overview/basic.php
diff --git a/views/default/admin/statistics/numentities.php b/views/default/admin/statistics/overview/numentities.php
index af4ae2773..af4ae2773 100644
--- a/views/default/admin/statistics/numentities.php
+++ b/views/default/admin/statistics/overview/numentities.php
diff --git a/views/default/admin/statistics/server.php b/views/default/admin/statistics/server.php
new file mode 100644
index 000000000..9d21addc1
--- /dev/null
+++ b/views/default/admin/statistics/server.php
@@ -0,0 +1,8 @@
+<?php
+/**
+ * Server information
+ */
+
+echo elgg_view_module('inline', elgg_echo('admin:server:label:web_server'), elgg_view('admin/statistics/server/web_server'));
+
+echo elgg_view_module('inline', elgg_echo('admin:server:label:php'), elgg_view('admin/statistics/server/php'));
diff --git a/views/default/admin/statistics/server/php.php b/views/default/admin/statistics/server/php.php
new file mode 100644
index 000000000..7c6a51383
--- /dev/null
+++ b/views/default/admin/statistics/server/php.php
@@ -0,0 +1,50 @@
+<?php
+/**
+ * Server PHP info
+ */
+
+$php_log = ini_get('error_log');
+if (!$php_log) {
+ $php_log = elgg_echo('admin:server:error_log');
+}
+
+$post_max_size = elgg_get_ini_setting_in_bytes('post_max_size');
+$upload_max_filesize = elgg_get_ini_setting_in_bytes('upload_max_filesize');
+
+$post_max_size_warning = '';
+if ($upload_max_filesize > $post_max_size) {
+ // @todo show a link to something like http://nigel.mcnie.name/blog/uploadmaxfilesizepostmaxsize-experimentation ?
+ $post_max_size_warning = elgg_echo('admin:server:warning:post_max_too_small');
+}
+
+?>
+<table class="elgg-table-alt">
+ <tr class="odd">
+ <td><b><?php echo elgg_echo('admin:server:label:php_version'); ?> :</b></td>
+ <td><?php echo phpversion(); ?></td>
+ </tr>
+ <tr class="even">
+ <td><b><?php echo elgg_echo('admin:server:label:php_ini'); ?> :</b></td>
+ <td><?php echo php_ini_loaded_file(); ?></td>
+ </tr>
+ <tr class="odd">
+ <td><b><?php echo elgg_echo('admin:server:label:php_log'); ?> :</b></td>
+ <td><?php echo $php_log; ?></td>
+ </tr>
+ <tr class="even">
+ <td><b><?php echo elgg_echo('admin:server:label:mem_avail'); ?> :</b></td>
+ <td><?php echo number_format(elgg_get_ini_setting_in_bytes('memory_limit')); ?></td>
+ </tr>
+ <tr class="odd">
+ <td><b><?php echo elgg_echo('admin:server:label:mem_used'); ?> :</b></td>
+ <td><?php echo number_format(memory_get_peak_usage()); ?></td>
+ </tr>
+ <tr class="even">
+ <td><b><?php echo elgg_echo('admin:server:label:post_max_size'); ?> :</b></td>
+ <td><?php echo number_format($post_max_size); ?></td>
+ </tr>
+ <tr class="odd">
+ <td><b><?php echo elgg_echo('admin:server:label:upload_max_filesize'); ?> :</b></td>
+ <td><?php echo number_format($upload_max_filesize) . '&nbsp; ' . $post_max_size_warning; ?></td>
+ </tr>
+</table>
diff --git a/views/default/admin/statistics/server/web_server.php b/views/default/admin/statistics/server/web_server.php
new file mode 100644
index 000000000..904a54f4b
--- /dev/null
+++ b/views/default/admin/statistics/server/web_server.php
@@ -0,0 +1,16 @@
+<?php
+/**
+ * Web server info
+ */
+
+?>
+<table class="elgg-table-alt">
+ <tr class="odd">
+ <td><b><?php echo elgg_echo('admin:server:label:server'); ?> :</b></td>
+ <td><?php echo $_SERVER['SERVER_SOFTWARE']; ?></td>
+ </tr>
+ <tr class="even">
+ <td><b><?php echo elgg_echo('admin:server:label:log_location'); ?> :</b></td>
+ <td><?php echo getenv('APACHE_LOG_DIR'); ?></td>
+ </tr>
+</table>
diff --git a/views/default/core/avatar/upload.php b/views/default/core/avatar/upload.php
index 4aa86373a..6f9124192 100644
--- a/views/default/core/avatar/upload.php
+++ b/views/default/core/avatar/upload.php
@@ -12,6 +12,17 @@ $user_avatar = elgg_view('output/img', array(
$current_label = elgg_echo('avatar:current');
+$remove_button = '';
+if ($vars['entity']->icontime) {
+ $remove_button = elgg_view('output/url', array(
+ 'text' => elgg_echo('remove'),
+ 'title' => elgg_echo('avatar:remove'),
+ 'href' => 'action/avatar/remove?guid=' . elgg_get_page_owner_guid(),
+ 'is_action' => true,
+ 'class' => 'elgg-button elgg-button-cancel mll',
+ ));
+}
+
$form_params = array('enctype' => 'multipart/form-data');
$upload_form = elgg_view_form('avatar/upload', $form_params, $vars);
@@ -28,6 +39,7 @@ $image = <<<HTML
<label>$current_label</label><br />
$user_avatar
</div>
+$remove_button
HTML;
$body = <<<HTML
diff --git a/views/default/core/river/filter.php b/views/default/core/river/filter.php
index 87380b561..9b7fadaa8 100644
--- a/views/default/core/river/filter.php
+++ b/views/default/core/river/filter.php
@@ -34,17 +34,5 @@ if ($selector) {
$params['value'] = $selector;
}
echo elgg_view('input/dropdown', $params);
-?>
-<?php //@todo JS 1.8: no ?>
-<script type="text/javascript">
-elgg.register_hook_handler('init', 'system', function() {
- $('#elgg-river-selector').change(function() {
- var url = window.location.href;
- if (window.location.search.length) {
- url = url.substring(0, url.indexOf('?'));
- }
- url += '?' + $(this).val();
- elgg.forward(url);
- });
-});
-</script>
+
+elgg_load_js('elgg.ui.river');
diff --git a/views/default/core/settings/account/default_access.php b/views/default/core/settings/account/default_access.php
index e33211460..690f2714a 100644
--- a/views/default/core/settings/account/default_access.php
+++ b/views/default/core/settings/account/default_access.php
@@ -12,22 +12,14 @@ if (elgg_get_config('allow_user_default_access')) {
if (false === ($default_access = $user->getPrivateSetting('elgg_default_access'))) {
$default_access = elgg_get_config('default_access');
}
-?>
-<div class="elgg-module elgg-module-info">
- <div class="elgg-head">
- <h3><?php echo elgg_echo('default_access:settings'); ?></h3>
- </div>
- <div class="elgg-body">
- <p>
- <?php echo elgg_echo('default_access:label'); ?>:
- <?php
- echo elgg_view('input/access', array('name' => 'default_access', 'value' => $default_access));
+ $title = elgg_echo('default_access:settings');
+ $content = elgg_echo('default_access:label') . ': ';
+ $content .= elgg_view('input/access', array(
+ 'name' => 'default_access',
+ 'value' => $default_access,
+ ));
- ?>
- </p>
- </div>
-</div>
-<?php
+ echo elgg_view_module('info', $title, $content);
}
-} \ No newline at end of file
+}
diff --git a/views/default/core/settings/account/email.php b/views/default/core/settings/account/email.php
index fda83e795..4bcdbb100 100644
--- a/views/default/core/settings/account/email.php
+++ b/views/default/core/settings/account/email.php
@@ -9,19 +9,11 @@
$user = elgg_get_page_owner_entity();
if ($user) {
-?>
-<div class="elgg-module elgg-module-info">
- <div class="elgg-head">
- <h3><?php echo elgg_echo('email:settings'); ?></h3>
- </div>
- <div class="elgg-body">
- <p>
- <?php echo elgg_echo('email:address:label'); ?>:
- <?php
- echo elgg_view('input/email',array('name' => 'email', 'value' => $user->email));
- ?>
- </p>
- </div>
-</div>
-<?php
-} \ No newline at end of file
+ $title = elgg_echo('email:settings');
+ $content = elgg_echo('email:address:label') . ': ';
+ $content .= elgg_view('input/email', array(
+ 'name' => 'email',
+ 'value' => $user->email,
+ ));
+ echo elgg_view_module('info', $title, $content);
+}
diff --git a/views/default/core/settings/account/language.php b/views/default/core/settings/account/language.php
index 3a992966f..b36057422 100644
--- a/views/default/core/settings/account/language.php
+++ b/views/default/core/settings/account/language.php
@@ -9,23 +9,12 @@
$user = elgg_get_page_owner_entity();
if ($user) {
-?>
-<div class="elgg-module elgg-module-info">
- <div class="elgg-head">
- <h3><?php echo elgg_echo('user:set:language'); ?></h3>
- </div>
- <div class="elgg-body">
- <p>
- <?php echo elgg_echo('user:language:label'); ?>:
- <?php
- echo elgg_view("input/dropdown", array(
- 'name' => 'language',
- 'value' => $user->language,
- 'options_values' => get_installed_translations()
- ));
- ?>
- </p>
- </div>
-</div>
-<?php
-} \ No newline at end of file
+ $title = elgg_echo('user:set:language');
+ $content = elgg_echo('user:language:label') . ': ';
+ $content .= elgg_view("input/dropdown", array(
+ 'name' => 'language',
+ 'value' => $user->language,
+ 'options_values' => get_installed_translations()
+ ));
+ echo elgg_view_module('info', $title, $content);
+}
diff --git a/views/default/core/settings/account/name.php b/views/default/core/settings/account/name.php
index f719a84de..e356146a3 100644
--- a/views/default/core/settings/account/name.php
+++ b/views/default/core/settings/account/name.php
@@ -7,20 +7,15 @@
*/
$user = elgg_get_page_owner_entity();
-?>
-<div class="elgg-module elgg-module-info">
- <div class="elgg-head">
- <h3><?php echo elgg_echo('user:name:label'); ?></h3>
- </div>
- <div class="elgg-body">
- <p>
- <?php echo elgg_echo('name'); ?>:
- <?php
- echo elgg_view('input/text', array('name' => 'name', 'value' => $user->name));
- ?>
- </p>
- </div>
-</div>
-<?php
-// need the user's guid to make sure the correct user gets updated
-echo elgg_view('input/hidden', array('name' => 'guid', 'value' => $user->guid));
+if ($user) {
+ $title = elgg_echo('user:name:label');
+ $content = elgg_echo('name') . ': ';
+ $content .= elgg_view('input/text', array(
+ 'name' => 'name',
+ 'value' => $user->name,
+ ));
+ echo elgg_view_module('info', $title, $content);
+
+ // need the user's guid to make sure the correct user gets updated
+ echo elgg_view('input/hidden', array('name' => 'guid', 'value' => $user->guid));
+}
diff --git a/views/default/core/settings/account/notifications.php b/views/default/core/settings/account/notifications.php
index 51292b2c9..c212b3886 100644
--- a/views/default/core/settings/account/notifications.php
+++ b/views/default/core/settings/account/notifications.php
@@ -9,33 +9,20 @@
global $NOTIFICATION_HANDLERS;
$notification_settings = get_user_notification_settings(elgg_get_page_owner_guid());
-?>
-<div class="elgg-module elgg-module-info">
- <div class="elgg-head">
- <h3><?php echo elgg_echo('notifications:usersettings'); ?></h3>
- </div>
- <div class="elgg-body">
+$title = elgg_echo('notifications:usersettings');
-<p><?php echo elgg_echo('notifications:methods'); ?>
+$rows = '';
-<table>
-<?php
- // Loop through options
- foreach ($NOTIFICATION_HANDLERS as $k => $v) {
-?>
- <tr>
- <td><?php echo elgg_echo("notification:method:$k"); ?>: </td>
-
- <td>
-<?php
+// Loop through options
+foreach ($NOTIFICATION_HANDLERS as $k => $v) {
if ($notification_settings->$k) {
$val = "yes";
} else {
$val = "no";
}
-
- echo elgg_view('input/radio', array(
+
+ $radio = elgg_view('input/radio', array(
'name' => "method[$k]",
'value' => $val,
'options' => array(
@@ -44,12 +31,14 @@ $notification_settings = get_user_notification_settings(elgg_get_page_owner_guid
),
));
-?>
- </td>
- </tr>
-<?php
- }
-?>
-</table>
- </div>
-</div> \ No newline at end of file
+ $cells = '<td class="prm pbl">' . elgg_echo("notification:method:$k") . ': </td>';
+ $cells .= "<td>$radio</td>";
+
+ $rows .= "<tr>$cells</tr>";
+}
+
+
+$content = elgg_echo('notifications:methods');
+$content .= "<table>$rows</table>";
+
+echo elgg_view_module('info', $title, $content);
diff --git a/views/default/core/settings/account/password.php b/views/default/core/settings/account/password.php
index a80f3df6b..4857034b2 100644
--- a/views/default/core/settings/account/password.php
+++ b/views/default/core/settings/account/password.php
@@ -1,45 +1,33 @@
<?php
+
/**
* Provide a way of setting your password
*
* @package Elgg
* @subpackage Core
*/
-
$user = elgg_get_page_owner_entity();
if ($user) {
-?>
-<div class="elgg-module elgg-module-info">
- <div class="elgg-head">
- <h3><?php echo elgg_echo('user:set:password'); ?></h3>
- </div>
- <div class="elgg-body">
- <?php
- // only make the admin user enter current password for changing his own password.
- if (!elgg_is_admin_logged_in() || elgg_is_admin_logged_in() && $user->guid == elgg_get_logged_in_user_guid()) {
- ?>
- <p>
- <?php echo elgg_echo('user:current_password:label'); ?>:
- <?php
- echo elgg_view('input/password', array('name' => 'current_password'));
- ?>
- </p>
- <?php } ?>
+ $title = elgg_echo('user:set:password');
- <p>
- <?php echo elgg_echo('user:password:label'); ?>:
- <?php
- echo elgg_view('input/password', array('name' => 'password'));
- ?>
- </p>
+ // only make the admin user enter current password for changing his own password.
+ $admin = '';
+ if (!elgg_is_admin_logged_in() || elgg_is_admin_logged_in() && $user->guid == elgg_get_logged_in_user_guid()) {
+ $admin .= elgg_echo('user:current_password:label') . ': ';
+ $admin .= elgg_view('input/password', array('name' => 'current_password'));
+ $admin = "<p>$admin</p>";
+ }
- <p>
- <?php echo elgg_echo('user:password2:label'); ?>: <?php
- echo elgg_view('input/password', array('name' => 'password2'));
- ?>
- </p>
- </div>
-</div>
-<?php
-} \ No newline at end of file
+ $password = elgg_echo('user:password:label') . ': ';
+ $password .= elgg_view('input/password', array('name' => 'password'));
+ $password = "<p>$password</p>";
+
+ $password2 = elgg_echo('user:password2:label') . ': ';
+ $password2 .= elgg_view('input/password', array('name' => 'password2'));
+ $password2 = "<p>$password2</p>";
+
+ $content = $admin . $password . $password2;
+
+ echo elgg_view_module('info', $title, $content);
+}
diff --git a/views/default/core/settings/statistics/numentities.php b/views/default/core/settings/statistics/numentities.php
index 245fd67be..ce1705a2e 100644
--- a/views/default/core/settings/statistics/numentities.php
+++ b/views/default/core/settings/statistics/numentities.php
@@ -10,42 +10,35 @@
$entity_stats = get_entity_statistics(elgg_get_logged_in_user_guid());
if ($entity_stats) {
-?>
-<div class="elgg-module elgg-module-info">
- <div class="elgg-head">
- <h3><?php echo elgg_echo('usersettings:statistics:label:numentities'); ?></h3>
- </div>
- <div class="elgg-body">
- <table class="elgg-table-alt">
- <?php
- foreach ($entity_stats as $k => $entry) {
- foreach ($entry as $a => $b) {
+ $rows = '';
+ foreach ($entity_stats as $k => $entry) {
+ foreach ($entry as $a => $b) {
- //This function controls the alternating class
- $even_odd = ( 'odd' != $even_odd ) ? 'odd' : 'even';
+ // This function controls the alternating class
+ $even_odd = ( 'odd' != $even_odd ) ? 'odd' : 'even';
- if ($a == "__base__") {
- $a = elgg_echo("item:{$k}");
- if (empty($a)) {
- $a = $k;
- }
- } else {
- $a = elgg_echo("item:{$k}:{$a}");
- if (empty($a)) {
- $a = "$k $a";
- }
- }
- echo <<< END
- <tr class="{$even_odd}">
- <td class="column-one"><b>{$a}:</b></td>
- <td>{$b}</td>
- </tr>
-END;
+ if ($a == "__base__") {
+ $a = elgg_echo("item:{$k}");
+ if (empty($a)) {
+ $a = $k;
+ }
+ } else {
+ $a = elgg_echo("item:{$k}:{$a}");
+ if (empty($a)) {
+ $a = "$k $a";
}
}
- ?>
- </table>
- </div>
-</div>
-<?php
-} \ No newline at end of file
+ $rows .= <<< END
+ <tr class="{$even_odd}">
+ <td class="column-one"><b>{$a}:</b></td>
+ <td>{$b}</td>
+ </tr>
+END;
+ }
+ }
+
+ $title = elgg_echo('usersettings:statistics:label:numentities');
+ $content = "<table class=\"elgg-table-alt\">$rows</table>";
+
+ echo elgg_view_module('info', $title, $content);
+}
diff --git a/views/default/core/settings/statistics/online.php b/views/default/core/settings/statistics/online.php
index 65db42cb1..ce7ff35fb 100644
--- a/views/default/core/settings/statistics/online.php
+++ b/views/default/core/settings/statistics/online.php
@@ -1,6 +1,6 @@
<?php
/**
- * Elgg statistics screen showing online users.
+ * Statistics about this user.
*
* @package Elgg
* @subpackage Core
@@ -15,17 +15,35 @@ if ($log) {
$logged_in = $log[0]->time_created;
}
-?>
-<div class="elgg-module elgg-module-info">
- <div class="elgg-head">
- <h3><?php echo elgg_echo('usersettings:statistics:yourdetails'); ?></h3>
- </div>
- <div class="elgg-body">
- <table class="elgg-table-alt">
- <tr class="odd"><td class="column-one"><?php echo elgg_echo('usersettings:statistics:label:name'); ?></td><td><?php echo $user->name; ?></td></tr>
- <tr class="even"><td class="column-one"><?php echo elgg_echo('usersettings:statistics:label:email'); ?></td><td><?php echo $user->email; ?></td></tr>
- <tr class="odd"><td class="column-one"><?php echo elgg_echo('usersettings:statistics:label:membersince'); ?></td><td><?php echo date("r",$user->time_created); ?></td></tr>
- <tr class="even"><td class="column-one"><?php echo elgg_echo('usersettings:statistics:label:lastlogin'); ?></td><td><?php echo date("r",$logged_in); ?></td></tr>
- </table>
- </div>
-</div> \ No newline at end of file
+$label_name = elgg_echo('usersettings:statistics:label:name');
+$label_email = elgg_echo('usersettings:statistics:label:email');
+$label_member_since = elgg_echo('usersettings:statistics:label:membersince');
+$label_last_login = elgg_echo('usersettings:statistics:label:lastlogin');
+
+$time_created = date("r", $user->time_created);
+$last_login = date("r", $logged_in);
+
+$title = elgg_echo('usersettings:statistics:yourdetails');
+
+$content = <<<__HTML
+<table class="elgg-table-alt">
+ <tr class="odd">
+ <td class="column-one">$label_name</td>
+ <td>$user->name</td>
+ </tr>
+ <tr class="even">
+ <td class="column-one">$label_email</td>
+ <td>$user->email</td>
+ </tr>
+ <tr class="odd">
+ <td class="column-one">$label_member_since</td>
+ <td>$time_created</td>
+ </tr>
+ <tr class="even">
+ <td class="column-one">$label_last_login</td>
+ <td>$last_login</td>
+ </tr>
+</table>
+__HTML;
+
+echo elgg_view_module('info', $title, $content);
diff --git a/views/default/core/settings/tools.php b/views/default/core/settings/tools.php
index a249adf82..195db1d61 100644
--- a/views/default/core/settings/tools.php
+++ b/views/default/core/settings/tools.php
@@ -14,9 +14,6 @@ echo elgg_view('output/longtext', array(
'class' => 'user-settings mtn mbm',
));
-$limit = get_input('limit', 10);
-$offset = get_input('offset', 0);
-
// Get the installed plugins
$installed_plugins = $vars['installed_plugins'];
$count = count($installed_plugins);
diff --git a/views/default/core/walled_garden/body.php b/views/default/core/walled_garden/body.php
deleted file mode 100644
index 67d8e0c37..000000000
--- a/views/default/core/walled_garden/body.php
+++ /dev/null
@@ -1,11 +0,0 @@
-<?php
-/**
- * Walled garden body
- */
-
-echo elgg_view('core/walled_garden/login');
-echo elgg_view('core/walled_garden/lost_password');
-
-if (elgg_get_config('allow_registration')) {
- echo elgg_view('core/walled_garden/register');
-}
diff --git a/views/default/core/walled_garden/login.php b/views/default/core/walled_garden/login.php
index 0a8b4a908..42b79607d 100644
--- a/views/default/core/walled_garden/login.php
+++ b/views/default/core/walled_garden/login.php
@@ -14,7 +14,7 @@ $menu = elgg_view_menu('walled_garden', array(
$login_box = elgg_view('core/account/login_box', array('module' => 'walledgarden-login'));
-$content = <<<HTML
+echo <<<HTML
<div class="elgg-col elgg-col-1of2">
<div class="elgg-inner">
<h1 class="elgg-heading-walledgarden">
@@ -29,9 +29,3 @@ $content = <<<HTML
</div>
</div>
HTML;
-
-echo elgg_view_module('walledgarden', '', $content, array(
- 'class' => 'elgg-walledgarden-double',
- 'header' => ' ',
- 'footer' => ' ',
-));
diff --git a/views/default/core/walled_garden/lost_password.php b/views/default/core/walled_garden/lost_password.php
index ce75b558b..82f8caf50 100644
--- a/views/default/core/walled_garden/lost_password.php
+++ b/views/default/core/walled_garden/lost_password.php
@@ -5,15 +5,9 @@
$title = elgg_echo('user:password:lost');
$body = elgg_view_form('user/requestnewpassword');
-$lost = <<<HTML
+echo <<<HTML
<div class="elgg-inner">
<h3>$title</h3>
$body
</div>
HTML;
-
-echo elgg_view_module('walledgarden', '', $lost, array(
- 'class' => 'elgg-walledgarden-single elgg-walledgarden-password hidden',
- 'header' => ' ',
- 'footer' => ' ',
-));
diff --git a/views/default/core/walled_garden/register.php b/views/default/core/walled_garden/register.php
index 7f6aac99b..1ce2f8716 100644
--- a/views/default/core/walled_garden/register.php
+++ b/views/default/core/walled_garden/register.php
@@ -9,15 +9,9 @@ $body = elgg_view_form('register', array(), array(
'invitecode' => get_input('invitecode'),
));
-$content = <<<__HTML
+echo <<<__HTML
<div class="elgg-inner">
<h2>$title</h2>
$body
</div>
__HTML;
-
-echo elgg_view_module('walledgarden', '', $content, array(
- 'class' => 'elgg-walledgarden-single elgg-walledgarden-register hidden',
- 'header' => ' ',
- 'footer' => ' ',
-)); \ No newline at end of file
diff --git a/views/default/css/admin.php b/views/default/css/admin.php
index dc1b503cb..65797172f 100644
--- a/views/default/css/admin.php
+++ b/views/default/css/admin.php
@@ -106,7 +106,14 @@ a:hover {
text-decoration: underline;
}
pre, code {
- background: #EBF5FF;
+ background-color: #EEE;
+ border: 1px solid #DDD;
+ color: #444;
+ font-family: Monaco, "Courier New", Courier, monospace;
+ font-size: 13px;
+ overflow: auto;
+ margin: 15px 0;
+ padding: 5px;
}
blockquote {
background: #EBF5FF;
@@ -817,6 +824,27 @@ a.elgg-button {
}
/* ***************************************
+ WIDGET MENU
+*************************************** */
+.elgg-menu-widget > li {
+ position: absolute;
+ top: 4px;
+ display: inline-block;
+ width: 18px;
+ height: 18px;
+ padding: 2px 2px 0 0;
+}
+.elgg-menu-widget > .elgg-menu-item-collapse {
+ left: 5px;
+}
+.elgg-menu-widget > .elgg-menu-item-delete {
+ right: 5px;
+}
+.elgg-menu-widget > .elgg-menu-item-settings {
+ right: 25px;
+}
+
+/* ***************************************
MORE MENUS
*************************************** */
/* Horizontal menus w/ separator support */
@@ -915,22 +943,16 @@ a.elgg-button {
height: 26px;
overflow: hidden;
}
+.elgg-module-widget.elgg-state-draggable .elgg-widget-handle {
+ cursor: move;
+}
.elgg-module-widget > .elgg-head h3 {
float: left;
padding: 4px 45px 0 20px;
color: #333;
}
-.elgg-module-widget > .elgg-head a {
- position: absolute;
- top: 4px;
- display: inline-block;
- width: 18px;
- height: 18px;
- padding: 2px 2px 0 0;
-}
.elgg-widget-collapse-button {
- left: 5px;
color: #c5c5c5;
text-decoration: none;
}
@@ -945,12 +967,6 @@ a.elgg-widget-collapse-button:before {
a.elgg-widget-collapsed:before {
content: "\25BA";
}
-.elgg-widget-delete-button {
- right: 5px;
-}
-.elgg-widget-edit-button {
- right: 25px;
-}
.elgg-module-widget > .elgg-body {
border-top: 1px solid #dedede;
background-color: white;
@@ -1246,6 +1262,13 @@ a.elgg-widget-collapsed:before {
padding: 5px 10px;
margin: 4px 0;
}
+ul.elgg-plugin-categories, ul.elgg-plugin-categories > li {
+ display: inline;
+}
+.elgg-plugin-category-bundled {
+ border-width: 2px;
+ border-color: #0054A7;
+}
/****************************************
MARKDOWN
diff --git a/views/default/css/elements/components.php b/views/default/css/elements/components.php
index 77313fa1a..7fe535d57 100644
--- a/views/default/css/elements/components.php
+++ b/views/default/css/elements/components.php
@@ -85,7 +85,11 @@
width: 100%;
border-top: 1px solid #ccc;
}
-.elgg-table-alt td {
+.elgg-table-alt th {
+ background-color: #eee;
+ font-weight: bold;
+}
+.elgg-table-alt td, .elgg-table-alt th {
padding: 2px 4px 2px 4px;
border-bottom: 1px solid #ccc;
}
@@ -265,17 +269,16 @@
Tags
*************************************** */
.elgg-tags {
- display: inline;
font-size: 85%;
}
-.elgg-tags li {
- display: inline;
+.elgg-tags > li {
+ float:left;
margin-right: 5px;
}
-.elgg-tags li:after {
+.elgg-tags li.elgg-tag:after {
content: ",";
}
-.elgg-tags li:last-child:after {
+.elgg-tags li.elgg-tag:last-child:after {
content: "";
}
.elgg-tagcloud {
diff --git a/views/default/css/elements/icons.php b/views/default/css/elements/icons.php
index f7c789e33..9b12e0a57 100644
--- a/views/default/css/elements/icons.php
+++ b/views/default/css/elements/icons.php
@@ -288,8 +288,8 @@
.elgg-ajax-loader {
background: white url(<?php echo elgg_get_site_url(); ?>_graphics/ajax_loader_bw.gif) no-repeat center center;
- min-height: 33px;
- min-width: 33px;
+ min-height: 31px;
+ min-width: 31px;
}
/* ***************************************
diff --git a/views/default/css/elements/modules.php b/views/default/css/elements/modules.php
index 7750c208f..74092c774 100644
--- a/views/default/css/elements/modules.php
+++ b/views/default/css/elements/modules.php
@@ -155,7 +155,7 @@
padding: 4px 45px 0 20px;
color: #666;
}
-.elgg-module-widget.elgg-state-draggable > .elgg-head {
+.elgg-module-widget.elgg-state-draggable .elgg-widget-handle {
cursor: move;
}
a.elgg-widget-collapse-button {
diff --git a/views/default/css/walled_garden.php b/views/default/css/walled_garden.php
index ea2543587..f6f7f97dc 100644
--- a/views/default/css/walled_garden.php
+++ b/views/default/css/walled_garden.php
@@ -54,8 +54,8 @@ $url = elgg_get_site_url();
padding: 0 8px;
}
-.elgg-walledgarden-single > .elgg-body > .elgg-inner {
- padding: 0 8px;
+.elgg-walledgarden-single > .elgg-body {
+ padding: 0 18px;
}
.elgg-module-walledgarden-login {
@@ -68,7 +68,14 @@ $url = elgg_get_site_url();
}
.elgg-heading-walledgarden {
- color: #666666;
margin-top: 60px;
line-height: 1.1em;
}
+
+h1, h2, h3, h4, h5, h6 {
+ color: #666;
+}
+
+a {
+ color: #999;
+} \ No newline at end of file
diff --git a/views/default/forms/admin/site/update_advanced.php b/views/default/forms/admin/site/update_advanced.php
index 5155fc415..b935090f0 100644
--- a/views/default/forms/admin/site/update_advanced.php
+++ b/views/default/forms/admin/site/update_advanced.php
@@ -19,6 +19,12 @@ foreach (array('wwwroot', 'path', 'dataroot') as $field) {
$form_body .= "<div>" . elgg_echo('admin:site:access:warning') . "<br />";
$form_body .= "<label>" . elgg_echo('installation:sitepermissions') . "</label>";
$form_body .= elgg_view('input/access', array(
+ 'options_values' => array(
+ ACCESS_PRIVATE => elgg_echo("PRIVATE"),
+ ACCESS_FRIENDS => elgg_echo("access:friends:label"),
+ ACCESS_LOGGED_IN => elgg_echo("LOGGED_IN"),
+ ACCESS_PUBLIC => elgg_echo("PUBLIC")
+ ),
'name' => 'default_access',
'value' => elgg_get_config('default_access'),
)) . "</div>";
@@ -34,11 +40,11 @@ $form_body .= elgg_view("input/checkboxes", array(
'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 .= "<div>" . elgg_echo('installation:systemcache:description') . "<br />";
$form_body .= elgg_view("input/checkboxes", array(
- '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') : ""),
+ 'options' => array(elgg_echo('installation:systemcache:label') => elgg_echo('installation:systemcache:label')),
+ 'name' => 'system_cache_enabled',
+ 'value' => (elgg_get_config('system_cache_enabled') ? elgg_echo('installation:systemcache:label') : ""),
)) . "</div>";
$debug_options = array('0' => elgg_echo('installation:debug:none'), 'ERROR' => elgg_echo('installation:debug:error'), 'WARNING' => elgg_echo('installation:debug:warning'), 'NOTICE' => elgg_echo('installation:debug:notice'));
@@ -95,4 +101,4 @@ $form_body .= '<div class="elgg-foot">';
$form_body .= elgg_view('input/submit', array('value' => elgg_echo("save")));
$form_body .= '</div>';
-echo $form_body; \ No newline at end of file
+echo $form_body;
diff --git a/views/default/forms/login.php b/views/default/forms/login.php
index 6f6cc9906..d2c6e6221 100644
--- a/views/default/forms/login.php
+++ b/views/default/forms/login.php
@@ -20,7 +20,7 @@
<?php echo elgg_view('input/password', array('name' => 'password')); ?>
</div>
-<?php echo elgg_view('login/extend'); ?>
+<?php echo elgg_view('login/extend', $vars); ?>
<div class="elgg-foot">
<label class="mtm float-alt">
diff --git a/views/default/forms/register.php b/views/default/forms/register.php
index 411152205..75ecd3450 100644
--- a/views/default/forms/register.php
+++ b/views/default/forms/register.php
@@ -66,10 +66,10 @@ if (elgg_is_sticky_form('register')) {
<?php
// view to extend to add more fields to the registration form
-echo elgg_view('register/extend');
+echo elgg_view('register/extend', $vars);
// Add captcha hook
-echo elgg_view('input/captcha');
+echo elgg_view('input/captcha', $vars);
echo '<div class="elgg-foot">';
echo elgg_view('input/hidden', array('name' => 'friend_guid', 'value' => $vars['friend_guid']));
diff --git a/views/default/icon/default.php b/views/default/icon/default.php
index 22c20b3a7..087c7eae9 100644
--- a/views/default/icon/default.php
+++ b/views/default/icon/default.php
@@ -34,10 +34,15 @@ if (isset($vars['href'])) {
$url = $vars['href'];
}
+$icon_sizes = elgg_get_config('icon_sizes');
+$size = $vars['size'];
+
$img = elgg_view('output/img', array(
'src' => $entity->getIconURL($vars['size']),
'alt' => $title,
'class' => $class,
+ 'width' => $size != 'master' ? $icon_sizes[$size]['w'] : NULL,
+ 'height' => $size != 'master' ? $icon_sizes[$size]['h'] : NULL,
));
if ($url) {
diff --git a/views/default/js/walled_garden.php b/views/default/js/walled_garden.php
index 46c2934ff..13ec83c04 100644
--- a/views/default/js/walled_garden.php
+++ b/views/default/js/walled_garden.php
@@ -2,9 +2,10 @@
/**
* Walled garden JavaScript
*
- * @todo update for new JS lib
+ * @since 1.8
*/
+// note that this assumes the button view is not using single quotes
$cancel_button = elgg_view('input/button', array(
'value' => elgg_echo('cancel'),
'class' => 'elgg-button-cancel mlm',
@@ -13,28 +14,43 @@ $cancel_button = trim($cancel_button);
?>
-$(document).ready(function() {
+elgg.provide('elgg.walled_garden');
- // add cancel button to inline forms
- $(".elgg-walledgarden-password").find('input.elgg-button-submit').after('<?php echo $cancel_button; ?>');
- $('.elgg-walledgarden-register').find('input.elgg-button-submit').after('<?php echo $cancel_button; ?>');
+elgg.walled_garden.init = function () {
- $(".forgot_link").click(function(event) {
- event.preventDefault();
- $(".elgg-walledgarden-password").fadeToggle();
- });
+ $('.forgot_link').click(elgg.walled_garden.load('lost_password'));
+ $('.registration_link').click(elgg.walled_garden.load('register'));
- $(".registration_link").click(function(event) {
+ $('input.elgg-button-cancel').live('click', function(event) {
+ if ($('.elgg-walledgarden-single').is(':visible')) {
+ $('.elgg-walledgarden-double').fadeToggle();
+ $('.elgg-walledgarden-single').fadeToggle();
+ $('.elgg-walledgarden-single').remove();
+ }
event.preventDefault();
- $(".elgg-walledgarden-register").fadeToggle();
});
+};
- $('input.elgg-button-cancel').click(function(event) {
- if ($(".elgg-walledgarden-password").is(':visible')) {
- $(".forgot_link").click();
- } else if ($('.elgg-walledgarden-register').is(':visible')) {
- $(".registration_link").click();
- }
+/**
+ * Creates a closure for loading walled garden content through ajax
+ *
+ * @param {String} view Name of the walled garden view
+ * @return {Object}
+ */
+elgg.walled_garden.load = function(view) {
+ return function(event) {
+ var id = '#elgg-walledgarden-' + view;
+ id = id.replace('_', '-');
+ elgg.get('walled_garden/' + view, {
+ 'success' : function(data) {
+ $('.elgg-body-walledgarden').append(data);
+ $(id).find('input.elgg-button-submit').after('<?php echo $cancel_button; ?>');
+ $('#elgg-walledgarden-login').fadeToggle();
+ $(id).fadeToggle();
+ },
+ });
event.preventDefault();
- });
-}); \ No newline at end of file
+ };
+};
+
+elgg.register_hook_handler('init', 'system', elgg.walled_garden.init); \ No newline at end of file
diff --git a/views/default/navigation/menu/elements/item.php b/views/default/navigation/menu/elements/item.php
index 22383ce0b..fd9738826 100644
--- a/views/default/navigation/menu/elements/item.php
+++ b/views/default/navigation/menu/elements/item.php
@@ -13,7 +13,8 @@ $item = $vars['item'];
$link_class = 'elgg-menu-closed';
if ($item->getSelected()) {
- $item->setItemClass('elgg-state-selected');
+ // @todo switch to addItemClass when that is implemented
+ //$item->setItemClass('elgg-state-selected');
$link_class = 'elgg-menu-opened';
}
@@ -24,6 +25,9 @@ if ($children) {
}
$item_class = $item->getItemClass();
+if ($item->getSelected()) {
+ $item_class = "$item_class elgg-state-selected";
+}
if (isset($vars['item_class']) && $vars['item_class']) {
$item_class .= ' ' . $vars['item_class'];
}
diff --git a/views/default/navigation/pagination.php b/views/default/navigation/pagination.php
index ad4689d83..04044c51c 100644
--- a/views/default/navigation/pagination.php
+++ b/views/default/navigation/pagination.php
@@ -8,7 +8,7 @@
* @uses int $vars['offset'] The offset in the list
* @uses int $vars['limit'] Number of items per page
* @uses int $vars['count'] Number of items in list
- * @uses string $vars['baseurl'] Base URL to use in links
+ * @uses string $vars['base_url'] Base URL to use in links
* @uses string $vars['offset_key'] The string to use for offet in the URL
*/
@@ -28,6 +28,9 @@ $offset_key = elgg_extract('offset_key', $vars, 'offset');
// some views pass an empty string for base_url
if (isset($vars['base_url']) && $vars['base_url']) {
$base_url = $vars['base_url'];
+} else if (isset($vars['baseurl']) && $vars['baseurl']) {
+ elgg_deprecated_notice("Use 'base_url' instead of 'baseurl' for the navigation/pagination view", 1.8);
+ $base_url = $vars['baseurl'];
} else {
$base_url = current_page_url();
}
@@ -110,7 +113,12 @@ foreach ($pages->items as $page) {
} else {
$page_offset = (($page - 1) * $limit);
$url = elgg_http_add_url_query_elements($base_url, array($offset_key => $page_offset));
- echo "<li><a href=\"$url\">$page</a></li>";
+ $link = elgg_view('output/url', array(
+ 'href' => $url,
+ 'text' => $page,
+ 'is_trusted' => true,
+ ));
+ echo "<li>$link</li>";
}
}
diff --git a/views/default/navigation/tabs.php b/views/default/navigation/tabs.php
index e8fde3579..95e3f2669 100644
--- a/views/default/navigation/tabs.php
+++ b/views/default/navigation/tabs.php
@@ -5,68 +5,77 @@
* @uses string $vars['type'] horizontal || vertical - Defaults to horizontal
* @uses string $vars['class'] Additional class to add to ul
* @uses array $vars['tabs'] A multi-dimensional array of tab entries in the format array(
- * 'title' => string, // Title of link
- * 'url' => string, // URL for the link
+ * 'text' => string, // The string between the <a></a> tags
+ * 'href' => string, // URL for the link
* 'class' => string // Class of the li element
* 'id' => string, // ID of the li element
- * 'selected' => bool // if this li element is currently selected
- * 'url_class' => string, // Class to pass to the link
- * 'url_id' => string, // ID to pass to the link
+ * 'selected' => bool // if this tab is currently selected (applied to li element)
+ * 'link_class' => string, // Class to pass to the link
+ * 'link_id' => string, // ID to pass to the link
* )
*/
+$options = elgg_clean_vars($vars);
$type = elgg_extract('type', $vars, 'horizontal');
+
if ($type == 'horizontal') {
- $type_class = "elgg-tabs elgg-htabs";
+ $options['class'] = "elgg-tabs elgg-htabs";
} else {
- $type_class = "elgg-tabs elgg-vtabs";
+ $options['class'] = "elgg-tabs elgg-vtabs";
}
-
if (isset($vars['class'])) {
- $type_class = "$type_class {$vars['class']}";
+ $options['class'] = "{$options['class']} {$vars['class']}";
}
+unset($options['tabs']);
+unset($options['type']);
+
+$attributes = elgg_format_attributes($options);
+
if (isset($vars['tabs']) && is_array($vars['tabs']) && !empty($vars['tabs'])) {
-?>
- <ul class="<?php echo $type_class; ?>">
- <?php
- foreach ($vars['tabs'] as $info) {
- $class = elgg_extract('class', $info, '');
- $id = elgg_extract('id', $info, '');
-
- $selected = elgg_extract('selected', $info, FALSE);
- if ($selected) {
- $class .= ' elgg-state-selected';
- }
+ ?>
+ <ul <?php echo $attributes; ?>>
+ <?php
+ foreach ($vars['tabs'] as $info) {
+ $class = elgg_extract('class', $info, '');
+ $id = elgg_extract('id', $info, '');
- $class_str = ($class) ? "class=\"$class\"" : '';
- $id_str = ($id) ? "id=\"$id\"" : '';
- $title = htmlspecialchars($info['title'], ENT_QUOTES, 'UTF-8');
- $url = htmlspecialchars($info['url'], ENT_QUOTES, 'UTF-8');
+ $selected = elgg_extract('selected', $info, FALSE);
+ if ($selected) {
+ $class .= ' elgg-state-selected';
+ }
- $options = array(
- 'href' => $url,
- 'title' => $title,
- 'text' => $title,
- );
+ $class_str = ($class) ? "class=\"$class\"" : '';
+ $id_str = ($id) ? "id=\"$id\"" : '';
- if (isset($info['url_class'])) {
- $options['class'] = $info['url_class'];
- }
+ $options = $info;
+ unset($options['class']);
+ unset($options['id']);
+ unset($options['selected']);
- if (isset($info['url_id'])) {
- $options['id'] = $info['url_id'];
- }
+ if (!isset($info['href']) && isset($info['url'])) {
+ $options['href'] = $info['url'];
+ unset($options['url']);
+ }
+ if (!isset($info['text']) && isset($info['title'])) {
+ $options['text'] = $options['title'];
+ unset($options['title']);
+ }
+ if (isset($info['link_class'])) {
+ $options['class'] = $options['link_class'];
+ unset($options['link_class']);
+ }
- if (!isset($info['rel']) && !isset($info['is_trusted'])) {
- $options['is_trusted'] = true;
- }
+ if (isset($info['link_id'])) {
+ $options['id'] = $options['link_id'];
+ unset($options['link_id']);
+ }
- $link = elgg_view('output/url', $options);
+ $link = elgg_view('output/url', $options);
- echo "<li $class_str $js>$link</li>";
- }
- ?>
- </ul>
+ echo "<li $id_str $class_str>$link</li>";
+ }
+ ?>
+ </ul>
<?php
}
diff --git a/views/default/object/elements/summary.php b/views/default/object/elements/summary.php
index 22db03f51..c0f3ad340 100644
--- a/views/default/object/elements/summary.php
+++ b/views/default/object/elements/summary.php
@@ -13,7 +13,7 @@
* @uses $vars['title'] Title link (optional) false = no title, '' = default
* @uses $vars['metadata'] HTML for entity menu and metadata (optional)
* @uses $vars['subtitle'] HTML for the subtitle (optional)
- * @uses $vars['tags'] HTML for the tags (optional)
+ * @uses $vars['tags'] HTML for the tags (default is tags on entity, pass false for no tags)
* @uses $vars['content'] HTML for the entity content (optional)
*/
@@ -39,7 +39,7 @@ $subtitle = elgg_extract('subtitle', $vars, '');
$content = elgg_extract('content', $vars, '');
$tags = elgg_extract('tags', $vars, '');
-if ($tags !== false) {
+if ($tags === '') {
$tags = elgg_view('output/tags', array('tags' => $entity->tags));
}
diff --git a/views/default/object/plugin.php b/views/default/object/plugin.php
index 2f64cfcc9..5c7138e96 100644
--- a/views/default/object/plugin.php
+++ b/views/default/object/plugin.php
@@ -7,6 +7,10 @@
*
*/
+if (!elgg_in_context('admin')) {
+ forward('/', 403);
+}
+
$plugin = $vars['entity'];
if (!$plugin->isValid()) {
diff --git a/views/default/object/plugin/full.php b/views/default/object/plugin/full.php
index 8955178a6..db0a52416 100644
--- a/views/default/object/plugin/full.php
+++ b/views/default/object/plugin/full.php
@@ -17,19 +17,17 @@ $reordering = elgg_extract('display_reordering', $vars, false);
$priority = $plugin->getPriority();
$active = $plugin->isActive();
-$name = $plugin->getManifest()->getName();
$can_activate = $plugin->canActivate();
$max_priority = elgg_get_max_plugin_priority();
$actions_base = '/action/admin/plugins/';
-
-$ts = time();
-$token = generate_action_token($ts);
+$css_id = preg_replace('/[^a-z0-9-]/i', '-', $plugin->getID());
// build reordering links
$links = '';
+$classes = array('elgg-plugin');
if ($reordering) {
- $draggable = 'elgg-state-draggable';
+ $classes[] = 'elgg-state-draggable';
// top and up link only if not at top
if ($priority > 1) {
@@ -89,7 +87,7 @@ if ($reordering) {
)) . "</li>";
}
} else {
- $draggable = 'elgg-state-undraggable';
+ $classes[] = 'elgg-state-undraggable';
}
@@ -101,22 +99,22 @@ $options = array(
'is_trusted' => true,
);
if ($active) {
- $active_class = 'elgg-state-active';
+ $classes[] = 'elgg-state-active';
$action = 'deactivate';
$options['text'] = elgg_echo('admin:plugins:deactivate');
$options['class'] = "elgg-button elgg-button-cancel";
if (!$can_activate) {
- $active_class = 'elgg-state-active';
+ $classes[] = 'elgg-state-active';
$options['class'] = 'elgg-button elgg-state-warning';
}
} else if ($can_activate) {
- $active_class = 'elgg-state-inactive';
+ $classes[] = 'elgg-state-inactive';
$action = 'activate';
$options['text'] = elgg_echo('admin:plugins:activate');
$options['class'] = "elgg-button elgg-button-submit";
} else {
- $active_class = 'elgg-state-inactive';
+ $classes[] = 'elgg-state-inactive';
$action = '';
$options['text'] = elgg_echo('admin:plugins:cannot_activate');
$options['class'] = "elgg-button elgg-button-disabled";
@@ -132,18 +130,20 @@ if ($action) {
}
$action_button = elgg_view('output/url', $options);
-// Display categories
+// Display categories and make category classes
+$categories = $plugin->getManifest()->getCategories();
$categories_html = '';
if ($categories) {
- $categories_arr = array();
$base_url = elgg_get_site_url() . "admin/plugins?category=";
foreach ($categories as $category) {
+ $css_class = preg_replace('/[^a-z0-9-]/i', '-', $category);
+ $classes[] = "elgg-plugin-category-$css_class";
+
$url = $base_url . urlencode($category);
- $categories_arr[] = "<a href=\"$url\">" . htmlspecialchars($category) . '</a>';
+ $friendly_category = htmlspecialchars(ElggPluginManifest::getFriendlyCategory($category));
+ $categories_html .= "<li class=\"elgg-plugin-category prm\"><a href=\"$url\">$friendly_category</a></li>";
}
-
- $categories_html = implode(', ', $categories_arr);
}
$screenshots_html = '';
@@ -196,7 +196,7 @@ if ($files) {
?>
-<div class="<?php echo $draggable; ?> elgg-plugin <?php echo $active_class ?>" id="<?php echo $plugin->getID(); ?>">
+<div class="<?php echo implode(' ', $classes); ?>" id="<?php echo $css_id; ?>">
<div class="elgg-image-block">
<div class="elgg-image-alt">
<?php if ($links) : ?>
@@ -218,7 +218,7 @@ if (elgg_view_exists($settings_view_old) || elgg_view_exists($settings_view_new)
}
?>
<div class="elgg-head">
- <h3><?php echo $plugin->getManifest()->getName(). " $version $settings_link"; ?></h3>
+ <h3><?php echo $plugin->getManifest()->getName() . " $version $settings_link"; ?></h3>
</div>
<?php
if ($plugin->getManifest()->getApiVersion() < 1.8) {
@@ -247,7 +247,7 @@ if (elgg_view_exists($settings_view_old) || elgg_view_exists($settings_view_new)
<div class="pts">
<?php
echo elgg_view('output/url', array(
- 'href' => "#elgg-plugin-manifest-{$plugin->getID()}",
+ 'href' => "#elgg-plugin-manifest-$css_id",
'text' => elgg_echo("admin:plugins:label:moreinfo"),
'rel' => 'toggle',
));
@@ -255,7 +255,7 @@ if (elgg_view_exists($settings_view_old) || elgg_view_exists($settings_view_new)
</div>
</div>
</div>
- <div class="elgg-plugin-more hidden" id="elgg-plugin-manifest-<?php echo $plugin->getID(); ?>">
+ <div class="elgg-plugin-more hidden" id="elgg-plugin-manifest-<?php echo $css_id; ?>">
<?php
if ($screenshots_html) {
@@ -266,7 +266,7 @@ if (elgg_view_exists($settings_view_old) || elgg_view_exists($settings_view_new)
if ($categories_html) {
?>
- <div><?php echo elgg_echo('admin:plugins:label:categories') . ": " . $categories_html; ?></div>
+ <div><?php echo elgg_echo('admin:plugins:label:categories') . ": <ul class=\"elgg-plugin-categories\">$categories_html</ul>"; ?></div>
<?php
}
diff --git a/views/default/object/plugin/invalid.php b/views/default/object/plugin/invalid.php
index bb518cd53..f24e1836c 100644
--- a/views/default/object/plugin/invalid.php
+++ b/views/default/object/plugin/invalid.php
@@ -16,6 +16,7 @@ $id = $plugin->getID();
$path = htmlspecialchars($plugin->getPath());
$message = elgg_echo('admin:plugins:warning:invalid', array($id));
$error = $plugin->getError();
+$css_id = preg_replace('/[^a-z0-9-]/i', '-', $plugin->getID());
?>
@@ -27,14 +28,14 @@ $error = $plugin->getError();
<div class="pts">
<?php
echo elgg_view('output/url', array(
- 'href' => "#elgg-plugin-manifest-{$plugin->getID()}",
+ 'href' => "#elgg-plugin-manifest-$css_id",
'text' => elgg_echo("admin:plugins:label:moreinfo"),
'rel' => 'toggle',
));
?>
</div>
- <div class="hidden elgg-plugin-more" id="elgg-plugin-manifest-<?php echo $plugin->getID(); ?>">
+ <div class="hidden elgg-plugin-more" id="elgg-plugin-manifest-<?php echo $css_id; ?>">
<p><?php echo elgg_echo('admin:plugins:label:location') . ": " . $path; ?></p>
<p><?php echo $error; ?></p>
</div>
diff --git a/views/default/object/widget.php b/views/default/object/widget.php
index f84c44e1c..0c7994f2b 100644
--- a/views/default/object/widget.php
+++ b/views/default/object/widget.php
@@ -55,8 +55,9 @@ if ($can_edit) {
}
$widget_header = <<<HEADER
- <h3>$title</h3>
+ <div class="elgg-widget-handle clearfix"><h3>$title</h3>
$controls
+ </div>
HEADER;
$widget_body = <<<BODY
diff --git a/views/default/object/widget/elements/controls.php b/views/default/object/widget/elements/controls.php
index d1d630c4f..57a935f62 100644
--- a/views/default/object/widget/elements/controls.php
+++ b/views/default/object/widget/elements/controls.php
@@ -8,9 +8,7 @@
echo elgg_view_menu('widget', array(
'entity' => elgg_extract('widget', $vars),
- 'params' => array(
- 'show_edit' => elgg_extract('show_edit', $vars, true)
- ),
+ 'show_edit' => elgg_extract('show_edit', $vars, true),
'sort_by' => 'priority',
'class' => 'elgg-menu-hz',
));
diff --git a/views/default/object/widget/elements/settings.php b/views/default/object/widget/elements/settings.php
index 5afe56ed8..25cda58c9 100644
--- a/views/default/object/widget/elements/settings.php
+++ b/views/default/object/widget/elements/settings.php
@@ -6,8 +6,20 @@
*/
$widget = elgg_extract('widget', $vars);
+
+// not using elgg_view_form() so that we can detect if the form is empty
+$form_body = elgg_view('forms/widgets/save', $vars);
+if (!$form_body) {
+ return true;
+}
+
+$form = elgg_view('input/form', array(
+ 'action' => 'action/widgets/save',
+ 'body' => $form_body,
+ 'class' => 'elgg-form-widgets-save',
+));
?>
<div class="elgg-widget-edit" id="widget-edit-<?php echo $widget->guid; ?>">
- <?php echo elgg_view_form('widgets/save', array(), $vars); ?>
+ <?php echo $form; ?>
</div>
diff --git a/views/default/output/access.php b/views/default/output/access.php
index 811948323..91c5c721e 100644
--- a/views/default/output/access.php
+++ b/views/default/output/access.php
@@ -11,6 +11,7 @@ if (isset($vars['entity']) && elgg_instanceof($vars['entity'])) {
$access_id = $vars['entity']->access_id;
$access_class = 'elgg-access';
$access_id_string = get_readable_access_level($access_id);
+ $access_id_string = htmlentities($access_id_string, ENT_QUOTES, 'UTF-8');
// if within a group or shared access collection display group name and open/closed membership status
// @todo have a better way to do this instead of checking against subtype / class.
@@ -35,5 +36,7 @@ if (isset($vars['entity']) && elgg_instanceof($vars['entity'])) {
$access_class .= ' elgg-access-private';
}
- echo "<span class=\"$access_class\">$access_id_string</span>";
+ $help_text = elgg_echo('access:help');
+
+ echo "<span title=\"$help_text\" class=\"$access_class\">$access_id_string</span>";
}
diff --git a/views/default/output/tagcloud.php b/views/default/output/tagcloud.php
index 22b6cf49d..a212becd8 100644
--- a/views/default/output/tagcloud.php
+++ b/views/default/output/tagcloud.php
@@ -47,9 +47,15 @@ if (!empty($vars['tagcloud']) && is_array($vars['tagcloud'])) {
if ($size < 100) {
$size = 100;
}
- $url = elgg_get_site_url()."search?q=". urlencode($tag->tag) . "&search_type=tags$type$subtype";
- $url = elgg_format_url($url);
- $cloud .= "<a href=\"$url\" style=\"font-size: $size%\" title=\"".addslashes($tag->tag)." ($tag->total)\">" . htmlspecialchars($tag->tag, ENT_QUOTES, 'UTF-8') . "</a>";
+ $url = "search?q=". urlencode($tag->tag) . "&search_type=tags$type$subtype";
+
+ $cloud .= elgg_view('output/url', array(
+ 'text' => $tag->tag,
+ 'href' => $url,
+ 'style' => "font-size: $size%;",
+ 'title' => "$tag->tag ($tag->total)",
+ 'rel' => 'tag'
+ ));
}
$cloud .= elgg_view('tagcloud/extend');
diff --git a/views/default/output/tags.php b/views/default/output/tags.php
index 6dedfacc7..3082dd41e 100644
--- a/views/default/output/tags.php
+++ b/views/default/output/tags.php
@@ -7,6 +7,9 @@
* @uses $vars['type'] The entity type, optional
* @uses $vars['subtype'] The entity subtype, optional
* @uses $vars['entity'] Optional. Entity whose tags are being displayed (metadata ->tags)
+ * @uses $vars['list_class'] Optional. Additional classes to be passed to <ul> element
+ * @uses $vars['item_class'] Optional. Additional classes to be passed to <li> elements
+ * @uses $vars['icon_class'] Optional. Additional classes to be passed to tags icon image
*/
if (isset($vars['entity'])) {
@@ -38,9 +41,19 @@ if (!empty($vars['tags'])) {
$vars['tags'] = array($vars['tags']);
}
- echo '<div>';
- echo elgg_view_icon('tag');
- echo '<ul class="elgg-tags">';
+ $list_class = "elgg-tags";
+ if (isset($vars['list_class'])) {
+ $list_class = "$list_class {$vars['list_class']}";
+ }
+
+ $item_class = "elgg-tag";
+ if (isset($vars['item_class'])) {
+ $item_class = "$item_class {$vars['item_class']}";
+ }
+
+ $icon_class = elgg_extract('icon_class', $vars);
+ $list_items = '<li>' . elgg_view_icon('tag', $icon_class) . '</li>';
+
foreach($vars['tags'] as $tag) {
if (!empty($vars['type'])) {
$type = "&type={$vars['type']}";
@@ -49,11 +62,20 @@ if (!empty($vars['tags'])) {
}
$url = elgg_get_site_url() . 'search?q=' . urlencode($tag) . "&search_type=tags{$type}{$subtype}{$object}";
if (is_string($tag)) {
- echo '<li>';
- echo elgg_view('output/url', array('href' => $url, 'text' => $tag, 'rel' => 'tag'));
- echo '</li>';
+ $list_items .= "<li class=\"$item_class\">";
+ $list_items .= elgg_view('output/url', array('href' => $url, 'text' => $tag, 'rel' => 'tag'));
+ $list_items .= '</li>';
}
}
- echo '</ul>';
- echo '</div>';
+
+ $list = <<<___HTML
+ <div class="clearfix">
+ <ul class="$list_class">
+ $list_items
+ </ul>
+ </div>
+___HTML;
+
+ echo $list;
}
+
diff --git a/views/default/page/components/list.php b/views/default/page/components/list.php
index c0db50bc5..28c907ab6 100644
--- a/views/default/page/components/list.php
+++ b/views/default/page/components/list.php
@@ -40,7 +40,7 @@ $nav = "";
if ($pagination && $count) {
$nav .= elgg_view('navigation/pagination', array(
- 'baseurl' => $base_url,
+ 'base_url' => $base_url,
'offset' => $offset,
'count' => $count,
'limit' => $limit,
diff --git a/views/default/page/default.php b/views/default/page/default.php
index 892069fad..3724bffd8 100644
--- a/views/default/page/default.php
+++ b/views/default/page/default.php
@@ -14,7 +14,9 @@
// backward compatability support for plugins that are not using the new approach
// of routing through admin. See reportedcontent plugin for a simple example.
if (elgg_get_context() == 'admin') {
- elgg_deprecated_notice("admin plugins should route through 'admin'.", 1.8);
+ if (get_input('handler') != 'admin') {
+ elgg_deprecated_notice("admin plugins should route through 'admin'.", 1.8);
+ }
elgg_admin_add_plugin_settings_menu();
elgg_unregister_css('elgg');
echo elgg_view('page/admin', $vars);
diff --git a/views/default/page/elements/comments.php b/views/default/page/elements/comments.php
index ebc7d3df5..cf9b5f08b 100644
--- a/views/default/page/elements/comments.php
+++ b/views/default/page/elements/comments.php
@@ -12,7 +12,7 @@ $show_add_form = elgg_extract('show_add_form', $vars, true);
$id = '';
if (isset($vars['id'])) {
- $id = "id =\"{$vars['id']}\"";
+ $id = "id=\"{$vars['id']}\"";
}
$class = 'elgg-comments';
diff --git a/views/default/page/layouts/walled_garden.php b/views/default/page/layouts/walled_garden.php
new file mode 100644
index 000000000..6ecd941ef
--- /dev/null
+++ b/views/default/page/layouts/walled_garden.php
@@ -0,0 +1,16 @@
+<?php
+/**
+ * Walled Garden layout
+ *
+ * @uses $vars['content'] Main content
+ * @uses $vars['class'] CSS classes
+ * @uses $vars['id'] CSS id
+ */
+
+$class = elgg_extract('class', $vars, 'elgg-walledgarden-single');
+echo elgg_view_module('walledgarden', '', $vars['content'], array(
+ 'class' => $class,
+ 'id' => elgg_extract('id', $vars, ''),
+ 'header' => ' ',
+ 'footer' => ' ',
+));
diff --git a/views/default/river/elements/body.php b/views/default/river/elements/body.php
index 6894b81e2..2cd7f2289 100644
--- a/views/default/river/elements/body.php
+++ b/views/default/river/elements/body.php
@@ -18,7 +18,7 @@ $menu = elgg_view_menu('river', array(
));
// river item header
-$timestamp = elgg_get_friendly_time($item->getPostedTime());
+$timestamp = elgg_view_friendly_time($item->getPostedTime());
$summary = elgg_extract('summary', $vars, elgg_view('river/elements/summary', array('item' => $vars['item'])));
if ($summary === false) {
diff --git a/views/default/river/elements/summary.php b/views/default/river/elements/summary.php
index 84941131f..4402c6f65 100644
--- a/views/default/river/elements/summary.php
+++ b/views/default/river/elements/summary.php
@@ -40,5 +40,14 @@ if ($container instanceof ElggGroup) {
$group_string = elgg_echo('river:ingroup', array($group_link));
}
+// check summary translation keys.
+// will use the $type:$subtype if that's defined, otherwise just uses $type
+$key = "river:$action:$type:$subtype";
+$summary = elgg_echo($key, array($subject_link, $object_link));
+
+if ($summary == $key) {
+ $key = "river:$action:$type";
+ $summary = elgg_echo($key, array($subject_link, $object_link));
+}
-echo elgg_echo("river:$action:$type:$subtype", array($subject_link, $object_link)); \ No newline at end of file
+echo $summary; \ No newline at end of file
diff --git a/views/default/widgets/friends/content.php b/views/default/widgets/friends/content.php
index bb5bd7a8d..98814c244 100644
--- a/views/default/widgets/friends/content.php
+++ b/views/default/widgets/friends/content.php
@@ -17,6 +17,7 @@ if (elgg_instanceof($owner, 'user')) {
$html = $owner->listFriends('', $num, array(
'size' => $size,
'list_type' => 'gallery',
+ 'pagination' => false
));
if ($html) {
echo $html;
diff --git a/views/failsafe/messages/exceptions/admin_exception.php b/views/failsafe/messages/exceptions/admin_exception.php
new file mode 100644
index 000000000..57665d9c0
--- /dev/null
+++ b/views/failsafe/messages/exceptions/admin_exception.php
@@ -0,0 +1,30 @@
+<?php
+/**
+ * Elgg exception (failsafe mode)
+ * Displays a single exception
+ *
+ * @package Elgg
+ * @subpackage Core
+ *
+ * @uses $vars['object'] An exception
+ */
+
+?>
+
+<p class="elgg-messages-exception">
+ <span title="<?php echo get_class($vars['object']); ?>">
+ <?php
+
+ echo nl2br($vars['object']->getMessage());
+
+ ?>
+ </span>
+</p>
+
+<p class="elgg-messages-exception">
+ <?php
+
+ echo nl2br(htmlentities(print_r($vars['object'], true), ENT_QUOTES, 'UTF-8'));
+
+ ?>
+</p> \ No newline at end of file
diff --git a/views/failsafe/messages/exceptions/exception.php b/views/failsafe/messages/exceptions/exception.php
index c35d80c87..1873ca0d9 100644
--- a/views/failsafe/messages/exceptions/exception.php
+++ b/views/failsafe/messages/exceptions/exception.php
@@ -12,27 +12,9 @@
?>
<p class="elgg-messages-exception">
- <span title="<?php echo get_class($vars['object']); ?>">
- <?php
-
- echo nl2br($vars['object']->getMessage());
-
- ?>
+ <span title="Unrecoverable Error">
+ <?php echo elgg_echo('exception:contact_admin'); ?>
+ <br /><br />
+ Exception #<?php echo $vars['ts']; ?>.
</span>
</p>
-
-<?php
-
-if (elgg_get_config('debug')) {
-?>
-
-<p class="elgg-messages-exception">
- <?php
-
- echo nl2br(htmlentities(print_r($vars['object'], true), ENT_QUOTES, 'UTF-8'));
-
- ?>
-</p>
-<?php
-
-}
diff --git a/views/installation/forms/install/template.php b/views/installation/forms/install/template.php
index 385168fe4..a01914f12 100644
--- a/views/installation/forms/install/template.php
+++ b/views/installation/forms/install/template.php
@@ -23,7 +23,7 @@ foreach ($variables as $field => $params) {
}
$submit_params = array(
- 'value' => elgg_echo('next'),
+ 'value' => elgg_echo('install:next'),
);
$form_body .= elgg_view('input/submit', $submit_params);
diff --git a/views/installation/install/nav.php b/views/installation/install/nav.php
index 76bd2ac50..c150cb2cb 100644
--- a/views/installation/install/nav.php
+++ b/views/installation/install/nav.php
@@ -12,12 +12,12 @@
// has a refresh button been requested
$refresh = '';
if (isset($vars['refresh']) && $vars['refresh']) {
- $refresh_text = elgg_echo('Refresh');
+ $refresh_text = elgg_echo('install:refresh');
$refresh = "<a href=\"\">$refresh_text</a>";
}
// create next button and selectively disable
-$next_text = elgg_echo('next');
+$next_text = elgg_echo('install:next');
$next_link = elgg_get_site_url()."install.php?step={$vars['next_step']}";
$next = "<a href=\"$next_link\">$next_text</a>";
if (isset($vars['advance']) && !$vars['advance']) {