aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES.txt77
-rw-r--r--actions/admin/plugins/simple_update_states.php48
-rw-r--r--actions/useradd.php2
-rw-r--r--actions/widgets/save.php7
-rw-r--r--documentation/examples/plugins/manifest.xml4
-rw-r--r--engine/classes/ElggAnnotation.php2
-rw-r--r--engine/classes/ElggMenuItem.php4
-rw-r--r--engine/classes/ElggPlugin.php22
-rw-r--r--engine/classes/ElggPluginManifest.php18
-rw-r--r--engine/classes/ElggPluginManifestParser18.php3
-rw-r--r--engine/classes/ElggPluginPackage.php4
-rw-r--r--engine/classes/ElggPriorityList.php2
-rw-r--r--engine/classes/ElggSite.php3
-rw-r--r--engine/lib/access.php299
-rw-r--r--engine/lib/actions.php164
-rw-r--r--engine/lib/admin.php9
-rw-r--r--engine/lib/annotations.php23
-rw-r--r--engine/lib/cache.php5
-rw-r--r--engine/lib/calendar.php10
-rw-r--r--engine/lib/configuration.php8
-rw-r--r--engine/lib/cron.php3
-rw-r--r--engine/lib/database.php24
-rw-r--r--engine/lib/elgglib.php27
-rw-r--r--engine/lib/entities.php39
-rw-r--r--engine/lib/export.php5
-rw-r--r--engine/lib/extender.php1
-rw-r--r--engine/lib/filestore.php3
-rw-r--r--engine/lib/group.php1
-rw-r--r--engine/lib/input.php4
-rw-r--r--engine/lib/metadata.php10
-rw-r--r--engine/lib/metastrings.php16
-rw-r--r--engine/lib/navigation.php5
-rw-r--r--engine/lib/notification.php4
-rw-r--r--engine/lib/objects.php2
-rw-r--r--engine/lib/opendd.php3
-rw-r--r--engine/lib/output.php26
-rw-r--r--engine/lib/pagehandler.php2
-rw-r--r--engine/lib/pageowner.php7
-rw-r--r--engine/lib/pam.php1
-rw-r--r--engine/lib/plugins.php54
-rw-r--r--engine/lib/private_settings.php19
-rw-r--r--engine/lib/relationships.php18
-rw-r--r--engine/lib/river.php2
-rw-r--r--engine/lib/sessions.php11
-rw-r--r--engine/lib/sites.php5
-rw-r--r--engine/lib/statistics.php1
-rw-r--r--engine/lib/system_log.php1
-rw-r--r--engine/lib/tags.php6
-rw-r--r--engine/lib/upgrade.php16
-rw-r--r--engine/lib/user_settings.php34
-rw-r--r--engine/lib/users.php24
-rw-r--r--engine/lib/views.php27
-rw-r--r--engine/lib/web_services.php25
-rw-r--r--engine/lib/widgets.php57
-rw-r--r--engine/lib/xml-rpc.php5
-rw-r--r--engine/tests/api/access_collections.php10
-rw-r--r--engine/tests/api/entity_getter_functions.php2
-rw-r--r--engine/tests/api/helpers.php16
-rw-r--r--engine/tests/api/metadata.php9
-rw-r--r--engine/tests/api/plugins.php5
-rw-r--r--engine/tests/objects/entities.php36
-rw-r--r--engine/tests/objects/sites.php2
-rw-r--r--engine/tests/objects/users.php23
-rw-r--r--engine/tests/regression/trac_bugs.php4
-rw-r--r--engine/tests/test_files/plugin_18/manifest.xml1
-rw-r--r--engine/tests/ui/submenu.php103
-rw-r--r--js/lib/elgglib.js175
-rw-r--r--js/lib/hooks.js75
-rw-r--r--js/lib/security.js20
-rw-r--r--js/lib/ui.js2
-rw-r--r--languages/en.php17
-rw-r--r--mod/blog/lib/blog.php3
-rw-r--r--mod/blog/manifest.xml1
-rw-r--r--mod/blog/views/default/blog/group_module.php2
-rw-r--r--mod/blog/views/default/blog/sidebar/revisions.php6
-rw-r--r--mod/blog/views/default/object/blog.php2
-rw-r--r--mod/blog/views/default/widgets/blog/content.php1
-rw-r--r--mod/bookmarks/manifest.xml1
-rw-r--r--mod/bookmarks/pages/bookmarks/friends.php3
-rw-r--r--mod/bookmarks/pages/bookmarks/owner.php3
-rw-r--r--mod/bookmarks/views/default/bookmarks/group_module.php2
-rw-r--r--mod/bookmarks/views/default/object/bookmarks.php9
-rw-r--r--mod/bookmarks/views/default/widgets/bookmarks/content.php1
-rw-r--r--mod/bookmarks/views/default/widgets/bookmarks/edit.php8
-rw-r--r--mod/categories/manifest.xml1
-rw-r--r--mod/categories/pages/categories/listing.php (renamed from mod/categories/listing.php)7
-rw-r--r--mod/categories/start.php2
-rw-r--r--mod/custom_index/manifest.xml1
-rw-r--r--mod/dashboard/manifest.xml3
-rw-r--r--mod/developers/manifest.xml3
-rw-r--r--mod/developers/views/default/theme_preview/general.php1
-rw-r--r--mod/diagnostics/manifest.xml1
-rw-r--r--mod/diagnostics/views/default/admin/develop_utilities/diagnostics.php1
-rw-r--r--mod/embed/manifest.xml1
-rw-r--r--mod/externalpages/manifest.xml1
-rw-r--r--mod/file/actions/file/upload.php6
-rw-r--r--mod/file/languages/en.php2
-rw-r--r--mod/file/manifest.xml1
-rw-r--r--mod/file/pages/file/friends.php3
-rw-r--r--mod/file/pages/file/owner.php3
-rw-r--r--mod/file/views/default/file/group_module.php2
-rw-r--r--mod/file/views/default/icon/object/file.php1
-rw-r--r--mod/file/views/default/object/file.php2
-rw-r--r--mod/file/views/default/widgets/filerepo/content.php1
-rw-r--r--mod/garbagecollector/manifest.xml1
-rw-r--r--mod/groups/manifest.xml1
-rw-r--r--mod/groups/start.php6
-rw-r--r--mod/groups/views/default/discussion/group_module.php2
-rw-r--r--mod/groups/views/default/groups/invitationrequests.php2
-rw-r--r--mod/groups/views/default/groups/membershiprequests.php2
-rw-r--r--mod/groups/views/default/groups/profile/activity_module.php1
-rw-r--r--mod/groups/views/default/groups/profile/summary.php1
-rw-r--r--mod/groups/views/default/groups/sidebar/members.php1
-rw-r--r--mod/groups/views/default/object/groupforumtopic.php2
-rw-r--r--mod/groups/views/default/widgets/a_users_groups/content.php1
-rw-r--r--mod/htmlawed/manifest.xml1
-rw-r--r--mod/invitefriends/manifest.xml1
-rw-r--r--mod/likes/manifest.xml3
-rw-r--r--mod/likes/views/default/annotation/likes.php1
-rw-r--r--mod/likes/views/default/likes/button.php2
-rw-r--r--mod/logbrowser/manifest.xml1
-rw-r--r--mod/logbrowser/views/default/logbrowser/table.php9
-rw-r--r--mod/logrotate/manifest.xml1
-rw-r--r--mod/logrotate/views/default/plugins/logrotate/settings.php10
-rw-r--r--mod/members/manifest.xml3
-rw-r--r--mod/messageboard/manifest.xml1
-rw-r--r--mod/messageboard/views/default/widgets/messageboard/content.php1
-rw-r--r--mod/messages/languages/en.php2
-rw-r--r--mod/messages/manifest.xml1
-rw-r--r--mod/messages/views/default/object/messages.php3
-rw-r--r--mod/notifications/languages/en.php1
-rw-r--r--mod/notifications/manifest.xml1
-rw-r--r--mod/pages/manifest.xml1
-rw-r--r--mod/pages/pages/pages/friends.php2
-rw-r--r--mod/pages/pages/pages/owner.php2
-rw-r--r--mod/pages/views/default/annotation/page.php2
-rw-r--r--mod/pages/views/default/object/page_top.php2
-rw-r--r--mod/pages/views/default/pages/group_module.php2
-rw-r--r--mod/pages/views/default/widgets/pages/content.php1
-rw-r--r--mod/profile/manifest.xml1
-rw-r--r--mod/reportedcontent/manifest.xml1
-rw-r--r--mod/reportedcontent/views/default/object/reported_content.php8
-rw-r--r--mod/search/manifest.xml1
-rw-r--r--mod/tagcloud/manifest.xml1
-rw-r--r--mod/thewire/manifest.xml1
-rw-r--r--mod/thewire/pages/thewire/friends.php3
-rw-r--r--mod/thewire/pages/thewire/owner.php3
-rw-r--r--mod/thewire/views/default/object/thewire.php1
-rw-r--r--mod/thewire/views/default/river/object/thewire/create.php2
-rw-r--r--mod/thewire/views/default/thewire/profile_status.php1
-rw-r--r--mod/thewire/views/default/widgets/thewire/content.php1
-rw-r--r--mod/tinymce/manifest.xml1
-rw-r--r--mod/twitter/manifest.xml1
-rw-r--r--mod/twitter_api/languages/en.php2
-rw-r--r--mod/twitter_api/views/default/forms/twitter_api/interstitial_settings.php1
-rw-r--r--mod/twitter_api/views/default/plugins/twitter_api/usersettings.php8
-rw-r--r--mod/uservalidationbyemail/manifest.xml1
-rw-r--r--mod/uservalidationbyemail/views/default/forms/uservalidationbyemail/bulk_action.php21
-rw-r--r--mod/zaudio/manifest.xml1
-rw-r--r--version.php2
-rw-r--r--views/default/admin/appearance/default_widgets.php1
-rw-r--r--views/default/admin/appearance/profile_fields/list.php14
-rw-r--r--views/default/admin/header.php2
-rw-r--r--views/default/core/account/login_box.php9
-rw-r--r--views/default/core/settings/account/notifications.php2
-rw-r--r--views/default/css/admin.php7
-rw-r--r--views/default/forms/login.php6
-rw-r--r--views/default/forms/profile/fields/add.php12
-rw-r--r--views/default/forms/register.php7
-rw-r--r--views/default/forms/user/requestnewpassword.php12
-rw-r--r--views/default/icon/default.php1
-rw-r--r--views/default/icon/user/default.php1
-rw-r--r--views/default/navigation/breadcrumbs.php1
-rw-r--r--views/default/navigation/menu/user_hover.php1
-rw-r--r--views/default/navigation/pagination.php2
-rw-r--r--views/default/navigation/tabs.php6
-rw-r--r--views/default/object/admin_notice.php3
-rw-r--r--views/default/object/default.php1
-rw-r--r--views/default/object/elements/summary.php1
-rw-r--r--views/default/object/plugin/advanced.php33
-rw-r--r--views/default/object/plugin/simple.php3
-rw-r--r--views/default/object/widget/elements/controls.php1
-rw-r--r--views/default/output/tag.php6
-rw-r--r--views/default/output/url.php15
-rw-r--r--views/default/page/elements/footer.php1
-rw-r--r--views/default/page/elements/tagcloud_block.php1
-rw-r--r--views/default/page/layouts/widgets/add_button.php1
-rw-r--r--views/default/river/elements/body.php2
-rw-r--r--views/default/river/elements/responses.php1
-rw-r--r--views/default/river/elements/summary.php3
-rw-r--r--views/default/river/user/default/profileiconupdate.php3
-rw-r--r--views/default/river/user/default/profileupdate.php1
-rw-r--r--views/default/widgets/content_stats/content.php1
193 files changed, 1375 insertions, 709 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index 2df4d2637..fb5870700 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,3 +1,80 @@
+Version 1.8.1b
+(October 11, 2011 from git://github.com/Elgg/Elgg.git)
+
+ Enhancements:
+ * New group activity widget for user dashboard.
+ * Added more sprites.
+ * version.php information cached instead of loaded 100s of times.
+ * Added class elgg-autofocus to add focus on inputs when the page loads.
+ * Admins can edit user avatars again.
+ * Added a filter for non-bundled plugins in plugin admin.
+ * Improvements to admin area theme.
+
+ Bugfixes:
+ * Fixed site dropdown menu for IE.
+ * ElggEntity->deleteMetadata() no longer deletes all metadata ever if
+ called on an unsaved entity.
+ * Fixed Embed plugin.
+ * Fixed activate and deactivate all plugins.
+ * Fixed URL for group membership request in notification email.
+ * Fixed log browser plugin's admin area display.
+ * Fixed RSS icon not showing up on some pages.
+ * Fixed river entries for forum posts that were lost if upgrading from 1.7.
+ * Better displaying of errors when activating, deactivating, or
+ reordering plugins.
+ * Fixed Developer Plugin's inspection tool.
+ * Fixed avatar cropping on IE 7.
+ * Bookmarks plugin accepts URLs with dashes.
+ * "More" menu item on site menu hidden if items are manually specified.
+ * Fixed hover menu floating if unrestrained.
+ * JS init, system fired when DOM and languages are read.
+ * Fixed the date picker input view.
+ * Fixed stack overflow when calling elgg_view() from a pagesetup
+ event.
+ * Menu links no longer have empty titles and confirm attributes.
+ * Fixed crash when attempting to change password to an invalid value.
+ * Fixed "More groups" link for groups widget.
+ * Fixed output/confirmlink to use a default question if not specified.
+ * Added missing language strings. Also added "new", "add", and "create".
+ * Registered security token refresh page as external to avoid token refresh
+ problems on Walled Garden sites.
+ * Displaying more accurate message if uploading an avatar fails.
+ * "Leave group" button doesn't display for group owners.
+ * Request group membership button displays only when logged in.
+ * Fixed the number of displayed items for Bookmarks widget.
+ * Fixed fallback to deprecated views for widgets.
+
+ API changes:
+ * Menus names must be unique to the entire menu, not just section.
+ * Input views that encode text use the option 'encode_text'.
+ * Added ElggPlugin->getFriendlyName().
+ * elgg_view_icon() accepts a class.
+ * Added hook output:before, page.
+ * Added hook output:before, layout.
+ * elgg_get_entities() and related functions return false if passed
+ valid options with invalid values.
+ * Can disable the user hover menu by passing hover => false to
+ elgg_view_icon(). Previously it was override => true.
+ * Embed plugin uses menu system. See readme for embed plugin.
+ * Manifest attributes are no longer translated via elgg_echo().
+ * Fixed livesearch ajax endpoint.
+ * Fixed site unit test.
+ * Unit tests tidy up after themselves better.
+ * forward() throws an exception if headers are already sent.
+ * Better errors if adding a user through admin area fails.
+ * Localized profile fields.
+ * Added 'is_trusted' parameter output/url to avoid escaping and filtering.
+ Defaults to false.
+ * Added elgg_unregister_action()
+ * Fixed ElggPriorityList::rewind().
+ * Fixed forwarding after login for login-protected pages.
+ * get_site_by_url() respects class inheritance for subclassing ElggSite.
+
+ Internal changes:
+ * Updated deprecated uses of internalname/id.
+ * Using wwwroot instead of www_root because of inconsistencies.
+
+
Version 1.8.0 (Jackie)
(September 5th, 2011 from git://github.com/Elgg/Elgg.git)
diff --git a/actions/admin/plugins/simple_update_states.php b/actions/admin/plugins/simple_update_states.php
deleted file mode 100644
index 7601013a7..000000000
--- a/actions/admin/plugins/simple_update_states.php
+++ /dev/null
@@ -1,48 +0,0 @@
-<?php
-/**
- * Bulk activate/deactivate for plugins appearing in the "simple" interface.
- *
- * Plugins marked as using the "simple" interface can be activated/deactivated
- * en masse by passing the plugins to activate as an array of their plugin guids
- * in $_REQUEST['enabled_plugins']. All "simple" plugins not in this array will be
- * deactivated.
- *
- * Simplecache and views cache are reset.
- *
- * @uses array $_REQUEST['activated_plugin_guids'] Array of plugin guids to activate.
- *
- * @since 1.8
- * @package Elgg.Core
- * @subpackage Administration.Plugins
- */
-
-$active_plugin_guids = get_input('active_plugin_guids', array());
-$installed_plugins = elgg_get_plugins('any');
-$success = TRUE;
-
-foreach ($installed_plugins as $plugin) {
- // this is only for simple plugins.
- if ($plugin->getManifest()->getAdminInterface() != 'simple') {
- continue;
- }
-
- // only effect changes to plugins not already in that state.
- if ($plugin->isActive() && !in_array($plugin->guid, $active_plugin_guids)) {
- $success = $success && $plugin->deactivate();
- } elseif (!$plugin->isActive() && in_array($plugin->guid, $active_plugin_guids)) {
- $success = $success && $plugin->activate();
- }
-}
-
-if ($success) {
- //system_message(elgg_echo('admin:plugins:simple_simple_success'));
-} else {
- register_error(elgg_echo('admin:plugins:simple_simple_fail'));
-}
-
-// 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();
-
-forward(REFERER); \ No newline at end of file
diff --git a/actions/useradd.php b/actions/useradd.php
index be08b4be5..3df41af79 100644
--- a/actions/useradd.php
+++ b/actions/useradd.php
@@ -37,7 +37,7 @@ try {
if ($guid) {
$new_user = get_entity($guid);
- if (($guid) && ($admin)) {
+ if ($uew_user && $admin && elgg_is_admin_logged_in()) {
$new_user->makeAdmin();
}
diff --git a/actions/widgets/save.php b/actions/widgets/save.php
index 0a2de0c4d..dad48b30b 100644
--- a/actions/widgets/save.php
+++ b/actions/widgets/save.php
@@ -16,7 +16,12 @@ $widget = get_entity($guid);
if ($widget && $widget->saveSettings($params)) {
elgg_set_page_owner_guid($widget->getContainerGUID());
if (!$default_widgets) {
- $view = "widgets/$widget->handler/content";
+ if (elgg_view_exists("widgets/$widget->handler/content")) {
+ $view = "widgets/$widget->handler/content";
+ } else {
+ elgg_deprecated_notice("widgets use content as the display view", 1.8);
+ $view = "widgets/$widget->handler/view";
+ }
echo elgg_view($view, array('entity' => $widget));
}
} else {
diff --git a/documentation/examples/plugins/manifest.xml b/documentation/examples/plugins/manifest.xml
index 1602a7358..2a8a2bd5c 100644
--- a/documentation/examples/plugins/manifest.xml
+++ b/documentation/examples/plugins/manifest.xml
@@ -32,10 +32,6 @@
<category>admin</category>
<category>api</category>
- <on_enable>setup_function</on_enable>
- <on_disable>teardown_function</on_disable>
- <admin_interface>simple</admin_interface>
-
<requires>
<type>php_extension</type>
<name>gd</name>
diff --git a/engine/classes/ElggAnnotation.php b/engine/classes/ElggAnnotation.php
index 78d29ee7f..511b5151f 100644
--- a/engine/classes/ElggAnnotation.php
+++ b/engine/classes/ElggAnnotation.php
@@ -78,7 +78,7 @@ class ElggAnnotation extends ElggExtender {
* @return bool
*/
function delete() {
- remove_from_river_by_annotation($this->id);
+ elgg_delete_river(array('annotation_id' => $this->id));
return elgg_delete_metastring_based_object_by_id($this->id, 'annotations');
}
diff --git a/engine/classes/ElggMenuItem.php b/engine/classes/ElggMenuItem.php
index b9c81fd78..8ddb1ecd8 100644
--- a/engine/classes/ElggMenuItem.php
+++ b/engine/classes/ElggMenuItem.php
@@ -549,6 +549,10 @@ class ElggMenuItem {
}
}
+ if (!isset($vars['rel']) && !isset($vars['is_trusted'])) {
+ $vars['is_trusted'] = true;
+ }
+
if ($this->confirm) {
$vars['confirm'] = $this->confirm;
return elgg_view('output/confirmlink', $vars);
diff --git a/engine/classes/ElggPlugin.php b/engine/classes/ElggPlugin.php
index 4aee1e898..c4d6ec034 100644
--- a/engine/classes/ElggPlugin.php
+++ b/engine/classes/ElggPlugin.php
@@ -264,8 +264,6 @@ class ElggPlugin extends ElggObject {
/**
* Returns a plugin setting
*
- * @todo These need to be namespaced
- *
* @param string $name The setting name
* @return mixed
*/
@@ -318,7 +316,6 @@ class ElggPlugin extends ElggObject {
* Set a plugin setting for the plugin
*
* @todo This will only work once the plugin has a GUID.
- * @todo These need to be namespaced.
*
* @param string $name The name to set
* @param string $value The value to set
@@ -329,13 +326,6 @@ class ElggPlugin extends ElggObject {
if (!$this->guid) {
return false;
}
- // Hook to validate setting
- $value = elgg_trigger_plugin_hook('setting', 'plugin', array(
- 'plugin_id' => $this->pluginID,
- 'plugin' => $this,
- 'name' => $name,
- 'value' => $value
- ), $value);
return $this->set($name, $value);
}
@@ -902,7 +892,9 @@ class ElggPlugin extends ElggObject {
}
/**
- * Save a value to private settings.
+ * Save a value as private setting or attribute.
+ *
+ * Attributes include title and description.
*
* @param string $name Name
* @param mixed $value Value
@@ -920,6 +912,14 @@ class ElggPlugin extends ElggObject {
return true;
} else {
+ // Hook to validate setting
+ $value = elgg_trigger_plugin_hook('setting', 'plugin', array(
+ 'plugin_id' => $this->pluginID,
+ 'plugin' => $this,
+ 'name' => $name,
+ 'value' => $value
+ ), $value);
+
return $this->setPrivateSetting($name, $value);
}
}
diff --git a/engine/classes/ElggPluginManifest.php b/engine/classes/ElggPluginManifest.php
index 0e47f388d..eacc16455 100644
--- a/engine/classes/ElggPluginManifest.php
+++ b/engine/classes/ElggPluginManifest.php
@@ -555,24 +555,6 @@ class ElggPluginManifest {
/**
* Returns the admin interface to use.
*
- * @return string simple or advanced
- */
- public function getAdminInterface() {
- $interface = $this->parser->getAttribute('admin_interface');
-
- switch ($interface) {
- case 'simple':
- case 'advanced':
- return $interface;
-
- default:
- return 'advanced';
- }
- }
-
- /**
- * Returns the admin interface to use.
- *
* @return bool
*/
public function getActivateOnInstall() {
diff --git a/engine/classes/ElggPluginManifestParser18.php b/engine/classes/ElggPluginManifestParser18.php
index db8b3dc6a..554e28c02 100644
--- a/engine/classes/ElggPluginManifestParser18.php
+++ b/engine/classes/ElggPluginManifestParser18.php
@@ -16,7 +16,7 @@ class ElggPluginManifestParser18 extends ElggPluginManifestParser {
'name', 'author', 'version', 'blurb', 'description',
'website', 'copyright', 'license', 'requires', 'suggests',
'screenshot', 'category', 'conflicts', 'provides',
- 'admin_interface', 'activate_on_install'
+ 'activate_on_install'
);
/**
@@ -46,7 +46,6 @@ class ElggPluginManifestParser18 extends ElggPluginManifestParser {
case 'website':
case 'copyright':
case 'license':
- case 'admin_interface':
case 'activate_on_install':
$parsed[$element->name] = $element->content;
break;
diff --git a/engine/classes/ElggPluginPackage.php b/engine/classes/ElggPluginPackage.php
index 145f71fcd..d240af477 100644
--- a/engine/classes/ElggPluginPackage.php
+++ b/engine/classes/ElggPluginPackage.php
@@ -33,7 +33,9 @@ class ElggPluginPackage {
*/
private $textFiles = array(
'README.txt', 'CHANGES.txt',
- 'INSTALL.txt', 'COPYRIGHT.txt', 'LICENSE.txt'
+ 'INSTALL.txt', 'COPYRIGHT.txt', 'LICENSE.txt',
+
+ 'README', 'README.md', 'README.markdown'
);
/**
diff --git a/engine/classes/ElggPriorityList.php b/engine/classes/ElggPriorityList.php
index aa33831ff..8a3b836a8 100644
--- a/engine/classes/ElggPriorityList.php
+++ b/engine/classes/ElggPriorityList.php
@@ -303,7 +303,7 @@ class ElggPriorityList
*/
public function rewind() {
$this->sortIfUnsorted();
- return rewind($this->elements);
+ return reset($this->elements);
}
/**
diff --git a/engine/classes/ElggSite.php b/engine/classes/ElggSite.php
index 40bfca060..8708800cf 100644
--- a/engine/classes/ElggSite.php
+++ b/engine/classes/ElggSite.php
@@ -371,6 +371,7 @@ class ElggSite extends ElggEntity {
elgg_register_plugin_hook_handler('index', 'system', 'elgg_walled_garden_index', 1);
if (!$this->isPublicPage()) {
+ $_SESSION['last_forward_from'] = current_page_url();
register_error(elgg_echo('loggedinrequired'));
forward();
}
@@ -413,6 +414,8 @@ class ElggSite extends ElggEntity {
'resetpassword',
'action/user/requestnewpassword',
'action/user/passwordreset',
+ 'action/security/refreshtoken',
+ 'ajax/view/js/languages',
'upgrade\.php',
'xml-rpc\.php',
'mt/mt-xmlrpc\.cgi',
diff --git a/engine/lib/access.php b/engine/lib/access.php
index 1fe21861d..ae64f832a 100644
--- a/engine/lib/access.php
+++ b/engine/lib/access.php
@@ -1,9 +1,9 @@
<?php
/**
- * Primary function for Elgg's entity and metadata access systems.
+ * Functions for Elgg's access system for entities, metadata, and annotations.
*
* Access is generally saved in the database as access_id. This corresponds to
- * one of the ACCESS_* constants defined in {@link elgglib.php}, or the ID of an
+ * one of the ACCESS_* constants defined in {@link elgglib.php} or the ID of an
* access collection.
*
* @package Elgg.Core
@@ -16,15 +16,16 @@
*
* @uses get_access_array
*
- * @return string A list of access collections suitable for injection in an SQL call
* @link http://docs.elgg.org/Access
* @see get_access_array()
*
* @param int $user_id User ID; defaults to currently logged in user
* @param int $site_id Site ID; defaults to current site
- * @param bool $flush If set to true, will refresh the access list from the database
+ * @param bool $flush If set to true, will refresh the access list from the
+ * database rather than using this function's cache.
*
- * @return string
+ * @return string A list of access collections suitable for using in an SQL call
+ * @access private
*/
function get_access_list($user_id = 0, $site_id = 0, $flush = false) {
global $CONFIG, $init_finished;
@@ -56,20 +57,30 @@ function get_access_list($user_id = 0, $site_id = 0, $flush = false) {
/**
* Returns an array of access IDs a user is permitted to see.
*
- * Can be overridden with the access:collections:read, user plugin hook.
+ * Can be overridden with the 'access:collections:read', 'user' plugin hook.
+ *
+ * This returns a list of all the collection ids a user owns or belongs
+ * to plus public and logged in access levels. If the user is an admin, it includes
+ * the private access level.
+ *
+ * @internal this is only used in core for creating the SQL where clause when
+ * retrieving content from the database. The friends access level is handled by
+ * get_access_sql_suffix().
*
- * @param int $user_id User ID; defaults to currently logged in user
- * @param int $site_id Site ID; defaults to current site
- * @param boolean $flush If set to true, will refresh the access list from the database
+ * @see get_write_access_array() for the access levels that a user can write to.
+ *
+ * @param int $user_id User ID; defaults to currently logged in user
+ * @param int $site_id Site ID; defaults to current site
+ * @param bool $flush If set to true, will refresh the access ids from the
+ * database rather than using this function's cache.
*
* @return array An array of access collections ids
- * @see get_access_list()
*/
function get_access_array($user_id = 0, $site_id = 0, $flush = false) {
global $CONFIG, $init_finished;
// @todo everything from the db is cached.
- // this cache might be redundant. But cache is flushed on every db write.
+ // 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)) {
@@ -103,7 +114,7 @@ function get_access_array($user_id = 0, $site_id = 0, $flush = false) {
if ($collections = get_data($query)) {
foreach ($collections as $collection) {
if (!empty($collection->access_collection_id)) {
- $tmp_access_array[] = $collection->access_collection_id;
+ $tmp_access_array[] = (int)$collection->access_collection_id;
}
}
}
@@ -115,7 +126,7 @@ function get_access_array($user_id = 0, $site_id = 0, $flush = false) {
if ($collections = get_data($query)) {
foreach ($collections as $collection) {
if (!empty($collection->id)) {
- $tmp_access_array[] = $collection->id;
+ $tmp_access_array[] = (int)$collection->id;
}
}
}
@@ -180,11 +191,9 @@ $ENTITY_SHOW_HIDDEN_OVERRIDE = false;
/**
* Show or hide disabled entities.
*
- * @access private
- *
* @param bool $show_hidden Show disabled entities.
- *
* @return void
+ * @access private
*/
function access_show_hidden_entities($show_hidden) {
global $ENTITY_SHOW_HIDDEN_OVERRIDE;
@@ -194,8 +203,8 @@ function access_show_hidden_entities($show_hidden) {
/**
* Return current status of showing disabled entities.
*
- * @access private
* @return bool
+ * @access private
*/
function access_get_show_hidden_status() {
global $ENTITY_SHOW_HIDDEN_OVERRIDE;
@@ -203,48 +212,11 @@ function access_get_show_hidden_status() {
}
/**
- * Add annotation restriction
- *
- * Returns an SQL fragment that is true (or optionally false) if the given user has
- * added an annotation with the given name to the given entity.
- *
- * @todo This is fairly generic so perhaps it could be moved to annotations.php
- *
- * @param string $annotation_name Name of the annotation
- * @param string $entity_guid SQL GUID of entity the annotation is attached to.
- * @param string $owner_guid SQL string that evaluates to the GUID of the annotation owner
- * @param boolean $exists If true, returns BOOL if the annotation exists
- *
- * @return string An SQL fragment suitable for inserting into a WHERE clause
- * @todo Document and maybe even remove. At least rename to something that makes sense.
- */
-function get_annotation_sql($annotation_name, $entity_guid, $owner_guid, $exists) {
- global $CONFIG;
-
- if ($exists) {
- $not = '';
- } else {
- $not = 'NOT';
- }
-
- $sql = <<<END
-$not EXISTS (SELECT * FROM {$CONFIG->dbprefix}annotations a
-INNER JOIN {$CONFIG->dbprefix}metastrings ms ON (a.name_id = ms.id)
-WHERE ms.string = '$annotation_name'
-AND a.entity_guid = $entity_guid
-AND a.owner_guid = $owner_guid)
-END;
- return $sql;
-}
-
-/**
* Returns the SQL where clause for a table with a access_id and enabled columns.
*
- * This handles returning where clauses for ACCESS_FRIENDS, and the currently
- * unused block and filter lists.
- *
- * @warning If an admin is logged in or {@link elgg_set_ignore_access()} is true,
- * this will return blank.
+ * This handles returning where clauses for ACCESS_FRIENDS and the currently
+ * unused block and filter lists in addition to using get_access_list() for
+ * access collections and the standard access levels.
*
* @param string $table_prefix Optional table. prefix for the access code.
* @param int $owner The guid to check access for. Defaults to logged in user.
@@ -260,7 +232,7 @@ function get_access_sql_suffix($table_prefix = '', $owner = null) {
$enemies_bit = "";
if ($table_prefix) {
- $table_prefix = sanitise_string($table_prefix) . ".";
+ $table_prefix = sanitise_string($table_prefix) . ".";
}
if (!isset($owner)) {
@@ -277,6 +249,7 @@ function get_access_sql_suffix($table_prefix = '', $owner = null) {
if ($ignore_access) {
$sql = " (1 = 1) ";
} else if ($owner != -1) {
+ // we have an entity's guid and auto check for friend relationships
$friends_bit = "{$table_prefix}access_id = " . ACCESS_FRIENDS . "
AND {$table_prefix}owner_guid IN (
SELECT guid_one FROM {$CONFIG->dbprefix}entity_relationships
@@ -285,14 +258,15 @@ function get_access_sql_suffix($table_prefix = '', $owner = null) {
$friends_bit = '(' . $friends_bit . ') OR ';
+ // @todo untested and unsupported at present
if ((isset($CONFIG->user_block_and_filter_enabled)) && ($CONFIG->user_block_and_filter_enabled)) {
// check to see if the user is in the entity owner's block list
// or if the entity owner is in the user's filter list
// if so, disallow access
- $enemies_bit = get_annotation_sql('elgg_block_list', "{$table_prefix}owner_guid", $owner, false);
+ $enemies_bit = get_access_restriction_sql('elgg_block_list', "{$table_prefix}owner_guid", $owner, false);
$enemies_bit = '('
. $enemies_bit
- . ' AND ' . get_annotation_sql('elgg_filter_list', $owner, "{$table_prefix}owner_guid", false)
+ . ' AND ' . get_access_restriction_sql('elgg_filter_list', $owner, "{$table_prefix}owner_guid", false)
. ')';
}
}
@@ -319,19 +293,59 @@ function get_access_sql_suffix($table_prefix = '', $owner = null) {
}
/**
- * Can $user access $entity.
+ * Get the where clause for an access restriction based on annotations
+ *
+ * Returns an SQL fragment that is true (or optionally false) if the given user has
+ * added an annotation with the given name to the given entity.
+ *
+ * @warning this is a private function for an untested capability and will likely
+ * be removed from a future version of Elgg.
+ *
+ * @param string $annotation_name Name of the annotation
+ * @param string $entity_guid SQL GUID of entity the annotation is attached to.
+ * @param string $owner_guid SQL string that evaluates to the GUID of the annotation owner
+ * @param boolean $exists If true, returns BOOL if the annotation exists
+ *
+ * @return string An SQL fragment suitable for inserting into a WHERE clause
+ * @access private
+ */
+function get_access_restriction_sql($annotation_name, $entity_guid, $owner_guid, $exists) {
+ global $CONFIG;
+
+ if ($exists) {
+ $not = '';
+ } else {
+ $not = 'NOT';
+ }
+
+ $sql = <<<END
+$not EXISTS (SELECT * FROM {$CONFIG->dbprefix}annotations a
+INNER JOIN {$CONFIG->dbprefix}metastrings ms ON (a.name_id = ms.id)
+WHERE ms.string = '$annotation_name'
+AND a.entity_guid = $entity_guid
+AND a.owner_guid = $owner_guid)
+END;
+ return $sql;
+}
+
+/**
+ * Can a user access an entity.
*
* @warning If a logged in user doesn't have access to an entity, the
* core engine will not load that entity.
*
- * @tip This is mostly useful for checking if a 3rd user has access
- * to an entity that is currently loaded.
+ * @tip This is mostly useful for checking if a user other than the logged in
+ * user has access to an entity that is currently loaded.
+ *
+ * @todo This function would be much more useful if we could pass the guid of the
+ * entity to test access for. We need to be able to tell whether the entity exists
+ * and whether the user has access to the entity.
*
* @param ElggEntity $entity The entity to check access for.
* @param ElggUser $user Optionally user to check access for. Defaults to
- * logged in user (which doesn't make sense).
+ * logged in user (which is a useless default).
*
- * @return boolean True if the user can access the entity
+ * @return bool
* @link http://docs.elgg.org/Access
*/
function has_access_to_entity($entity, $user = null) {
@@ -354,12 +368,27 @@ function has_access_to_entity($entity, $user = null) {
}
/**
- * Returns an array of access permissions that the user is allowed to save objects with.
- * Permissions are of the form ('id' => 'Description')
+ * Returns an array of access permissions that the user is allowed to save content with.
+ * Permissions returned are of the form (id => 'name').
+ *
+ * Example return value in English:
+ * array(
+ * 0 => 'Private',
+ * -2 => 'Friends',
+ * 1 => 'Logged in users',
+ * 2 => 'Public',
+ * 34 => 'My favorite friends',
+ * );
+ *
+ * Plugin hook of 'access:collections:write', 'user'
+ *
+ * @warning this only returns access collections that the user owns plus the
+ * standard access levels. It does not return access collections that the user
+ * belongs to such as the access collection for a group.
*
* @param int $user_id The user's GUID.
* @param int $site_id The current site.
- * @param bool $flush If this is set to true, this will ignore any cached version
+ * @param bool $flush If this is set to true, this will ignore a cached access array
*
* @return array List of access permissions
* @link http://docs.elgg.org/Access
@@ -384,15 +413,18 @@ function get_write_access_array($user_id = 0, $site_id = 0, $flush = false) {
$query = "SELECT ag.* FROM {$CONFIG->dbprefix}access_collections ag ";
$query .= " WHERE (ag.site_guid = {$site_id} OR ag.site_guid = 0)";
$query .= " AND (ag.owner_guid = {$user_id})";
+ // ACCESS_PRIVATE through ACCESS_PUBLIC take 0 through 2
+ // @todo this AND clause is unnecessary because of id starts at 3 for table
$query .= " AND ag.id >= 3";
$tmp_access_array = 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")
- );
- if ($collections = get_data($query)) {
+ ACCESS_PRIVATE => elgg_echo("PRIVATE"),
+ ACCESS_FRIENDS => elgg_echo("access:friends:label"),
+ ACCESS_LOGGED_IN => elgg_echo("LOGGED_IN"),
+ ACCESS_PUBLIC => elgg_echo("PUBLIC")
+ );
+ $collections = get_data($query);
+ if ($collections) {
foreach ($collections as $collection) {
$tmp_access_array[$collection->id] = $collection->name;
}
@@ -410,11 +442,11 @@ function get_write_access_array($user_id = 0, $site_id = 0, $flush = false) {
return $tmp_access_array;
}
-
/**
- * Can the user write to the access collection?
+ * Can the user change this access collection?
*
- * Hook into the access:collections:write, user to change this.
+ * Use the plugin hook of 'access:collections:write', 'user' to change this.
+ * @see get_write_access_array() for details on the hook.
*
* Respects access control disabling for admin users and {@see elgg_set_ignore_access()}
*
@@ -428,7 +460,7 @@ function can_edit_access_collection($collection_id, $user_guid = null) {
if ($user_guid) {
$user = get_entity((int) $user_guid);
} else {
- $user = get_loggedin_user();
+ $user = elgg_get_logged_in_user_entity();
}
$collection = get_access_collection($collection_id);
@@ -453,6 +485,8 @@ function can_edit_access_collection($collection_id, $user_guid = null) {
* Access colletions allow plugins and users to create granular access
* for entities.
*
+ * Triggers plugin hook 'access:collections:addcollection', 'collection'
+ *
* @internal Access collections are stored in the access_collections table.
* Memberships to collections are in access_collections_membership.
*
@@ -460,7 +494,7 @@ function can_edit_access_collection($collection_id, $user_guid = null) {
* @param int $owner_guid The GUID of the owner (default: currently logged in user).
* @param int $site_guid The GUID of the site (default: current site).
*
- * @return int|false Depending on success (the collection ID if successful).
+ * @return int|false The collection ID if successful and false on failure.
* @link http://docs.elgg.org/Access/Collections
* @see update_access_collection()
* @see delete_access_collection()
@@ -485,7 +519,8 @@ function create_access_collection($name, $owner_guid = 0, $site_guid = 0) {
SET name = '{$name}',
owner_guid = {$owner_guid},
site_guid = {$site_guid}";
- if (!$id = insert_data($q)) {
+ $id = insert_data($q);
+ if (!$id) {
return false;
}
@@ -504,7 +539,7 @@ function create_access_collection($name, $owner_guid = 0, $site_guid = 0) {
* Updates the membership in an access collection.
*
* @warning Expects a full list of all members that should
- * be part o the access collection
+ * be part of the access collection
*
* @note This will run all hooks associated with adding or removing
* members to access collections.
@@ -512,7 +547,7 @@ function create_access_collection($name, $owner_guid = 0, $site_guid = 0) {
* @param int $collection_id The ID of the collection.
* @param array $members Array of member GUIDs
*
- * @return true|false Depending on success
+ * @return bool
* @link http://docs.elgg.org/Access/Collections
* @see add_user_to_access_collection()
* @see remove_user_from_access_collection()
@@ -585,6 +620,8 @@ function delete_access_collection($collection_id) {
* @note This doesn't return the members of an access collection,
* just the database row of the actual collection.
*
+ * @see get_members_of_access_collection()
+ *
* @param int $collection_id The collection ID
*
* @return object|false
@@ -602,15 +639,15 @@ function get_access_collection($collection_id) {
/**
* Adds a user to an access collection.
*
- * Emits the access:collections:add_user, collection plugin hook.
+ * Triggers the 'access:collections:add_user', 'collection' plugin hook.
*
* @param int $user_guid The GUID of the user to add
* @param int $collection_id The ID of the collection to add them to
*
- * @return true|false Depending on success
- * @link http://docs.elgg.org/Access/Collections
+ * @return bool
* @see update_access_collection()
* @see remove_user_from_access_collection()
+ * @link http://docs.elgg.org/Access/Collections
*/
function add_user_to_access_collection($user_guid, $collection_id) {
global $CONFIG;
@@ -635,27 +672,25 @@ function add_user_to_access_collection($user_guid, $collection_id) {
return false;
}
- try {
- $q = "INSERT INTO {$CONFIG->dbprefix}access_collection_membership
- SET access_collection_id = {$collection_id},
- user_guid = {$user_guid}";
- insert_data($q);
- } catch (DatabaseException $e) {
- return false;
- }
+ $q = "INSERT INTO {$CONFIG->dbprefix}access_collection_membership
+ SET access_collection_id = {$collection_id}, user_guid = {$user_guid}";
+ $result = insert_data($q);
- return true;
+ return $result !== false;
}
/**
* Removes a user from an access collection.
*
- * Emits the access:collections:remove_user, collection plugin hook.
+ * Triggers the 'access:collections:remove_user', 'collection' plugin hook.
*
* @param int $user_guid The user GUID
* @param int $collection_id The access collection ID
*
- * @return true|false Depending on success
+ * @return bool
+ * @see update_access_collection()
+ * @see remove_user_from_access_collection()
+ * @link http://docs.elgg.org/Access/Collections
*/
function remove_user_from_access_collection($user_guid, $collection_id) {
global $CONFIG;
@@ -751,32 +786,13 @@ function get_members_of_access_collection($collection, $idonly = FALSE) {
}
/**
- * Displays a user's access collections, using the core/friends/collections view
- *
- * @param int $owner_guid The GUID of the owning user
- *
- * @return string A formatted rendition of the collections
- * @todo Move to the friends/collection.php page.
- */
-function elgg_view_access_collections($owner_guid) {
- if ($collections = get_user_access_collections($owner_guid)) {
- foreach ($collections as $key => $collection) {
- $collections[$key]->members = get_members_of_access_collection($collection->id, true);
- $collections[$key]->entities = get_user_friends($owner_guid, "", 9999);
- }
- }
-
- return elgg_view('core/friends/collections', array('collections' => $collections));
-}
-
-/**
* Return entities based upon access id.
*
- * @param array $options Any options accepted by {@link elgg_get_entities()} and:
+ * @param array $options Any options accepted by {@link elgg_get_entities()} and
* access_id => int The access ID of the entity.
*
* @see elgg_get_entities()
- * @return mixed if count, int. if not count, array or false if no entities. false also on errors.
+ * @return mixed if count, int. if not count, array. false on errors.
* @since 1.7.0
*/
function elgg_get_entities_from_access_id(array $options = array()) {
@@ -809,7 +825,7 @@ function elgg_get_entities_from_access_id(array $options = array()) {
* @see elgg_list_entities()
* @see elgg_get_entities_from_access_id()
*
- * @return str
+ * @return string
*/
function elgg_list_entities_from_access_id(array $options = array()) {
return elgg_list_entities($options, 'elgg_get_entities_from_access_id');
@@ -821,15 +837,15 @@ function elgg_list_entities_from_access_id(array $options = array()) {
*
* @warning This function probably doesn't work how it's meant to.
*
- * @param int $entity_accessid The entity's access id
+ * @param int $entity_access_id The entity's access id
*
- * @return string e.g. Public, Private etc
+ * @return string 'Public', 'Private', etc. or false if error.
* @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.
*/
-function get_readable_access_level($entity_accessid) {
- $access = (int) $entity_accessid;
+function get_readable_access_level($entity_access_id) {
+ $access = (int) $entity_access_id;
//get the access level for object in readable string
$options = get_write_access_array();
@@ -851,13 +867,13 @@ function get_readable_access_level($entity_accessid) {
* The access system will not return entities in any getter
* functions if the user doesn't have access.
*
- * @internal For performance reasons this is done at the database level.
+ * @internal For performance reasons this is done at the database access clause level.
*
* @tip Use this to access entities in automated scripts
* when no user is logged in.
*
- * @warning This will not show disabled entities. Use {@link $ENTITY_SHOW_HIDDEN_OVERRIDE}
- * for that.
+ * @warning This will not show disabled entities.
+ * Use {@link access_show_hidden_entities()} to access disabled entities.
*
* @param bool $ignore If true, disables all access checks.
*
@@ -884,17 +900,20 @@ function elgg_get_ignore_access() {
}
/**
- * Decides if the access system is being ignored.
+ * Decides if the access system should be ignored for a user.
*
- * The access system can be ignored if 1) an admin user is logged in
- * or 2) {@link elgg_set_ignore_access()} was called with true.
+ * Returns true (meaning ignore access) if either of these 2 conditions are true:
+ * 1) an admin user guid is passed to this function.
+ * 2) {@link elgg_get_ignore_access()} returns true.
*
- * @param mixed $user_guid The user to check against. Defaults to logged in.
+ * @see elgg_set_ignore_access()
+ *
+ * @param int $user_guid The user to check against.
*
* @return bool
* @since 1.7.0
*/
-function elgg_check_access_overrides($user_guid = null) {
+function elgg_check_access_overrides($user_guid = 0) {
if (!$user_guid || $user_guid <= 0) {
$is_admin = false;
} else {
@@ -907,6 +926,7 @@ function elgg_check_access_overrides($user_guid = null) {
/**
* Returns the ElggAccess object.
*
+ * // @todo comment is incomplete
* This is used to
*
* @return ElggAccess
@@ -946,16 +966,20 @@ function access_init() {
}
/**
- * Check if the access system should be overridden.
+ * Overrides the access system if appropriate.
*
* Allows admin users and calls after {@link elgg_set_ignore_access} to
- * by pass the access system.
+ * bypass the access system.
+ *
+ * Registered for the 'permissions_check', 'all' and the
+ * 'container_permissions_check', 'all' plugin hooks.
+ *
+ * Returns true to override the access system or null if no change is needed.
*
* @return true|null
- * @since 1.7.0
- * @elgg_event_handler permissions_check all
+ * @access private
*/
-function elgg_override_permissions_hook($hook, $type, $value, $params) {
+function elgg_override_permissions($hook, $type, $value, $params) {
$user = elgg_extract('user', $params);
if (!$user) {
$user = elgg_get_logged_in_user_entity();
@@ -984,6 +1008,7 @@ function elgg_override_permissions_hook($hook, $type, $value, $params) {
/**
* Runs unit tests for the entities object.
+ * @access private
*/
function access_test($hook, $type, $value, $params) {
global $CONFIG;
@@ -995,7 +1020,7 @@ function access_test($hook, $type, $value, $params) {
elgg_register_event_handler('init', 'system', 'access_init', 9999);
// For overrided permissions
-elgg_register_plugin_hook_handler('permissions_check', 'all', 'elgg_override_permissions_hook');
-elgg_register_plugin_hook_handler('container_permissions_check', 'all', 'elgg_override_permissions_hook');
+elgg_register_plugin_hook_handler('permissions_check', 'all', 'elgg_override_permissions');
+elgg_register_plugin_hook_handler('container_permissions_check', 'all', 'elgg_override_permissions');
elgg_register_plugin_hook_handler('unit_test', 'system', 'access_test'); \ No newline at end of file
diff --git a/engine/lib/actions.php b/engine/lib/actions.php
index 99e22e104..f415842ab 100644
--- a/engine/lib/actions.php
+++ b/engine/lib/actions.php
@@ -2,21 +2,23 @@
/**
* Elgg Actions
*
- * Actions are the primary controllers (The C in MVC) in Elgg. They are
- * registered by {@link register_elgg_action()} and are called either by URL
- * http://elggsite.org/action/action_name or {@link action($action_name}. For
- * URLs, a rewrite rule in .htaccess passes the action name to
- * engine/handlers/action_handler.php, which dispatches the action.
+ * Actions are one of the primary controllers (The C in MVC) in Elgg. They are
+ * registered by {@link register_elgg_action()} and are called by URL
+ * http://elggsite.org/action/action_name. For URLs, a rewrite rule in
+ * .htaccess passes the action name to engine/handlers/action_handler.php,
+ * which dispatches the request for the action.
*
- * An action name should be registered to exactly one file in the system, usually under
- * the actions/ directory.
+ * An action name must be registered to a file in the system. Core actions are
+ * found in /actions/ and plugin actions are usually under /mod/<plugin>/actions/.
+ * It is recommended that actions be namespaced to avoid collisions.
*
* All actions require security tokens. Using the {@elgg_view input/form} view
- * will automatically add tokens as hidden inputs. To manually add hidden inputs,
- * use the {@elgg_view input/securitytoken} view.
+ * will automatically add tokens as hidden inputs as will the elgg_view_form()
+ * function. To manually add hidden inputs, use the {@elgg_view input/securitytoken} view.
*
* To include security tokens for actions called via GET, use
- * {@link elgg_add_security_tokens_to_url()}.
+ * {@link elgg_add_security_tokens_to_url()} or specify is_action as true when
+ * using {@lgg_view output/url}.
*
* Action tokens can be manually generated by using {@link generate_action_token()}.
*
@@ -31,30 +33,30 @@
*/
/**
-* Perform an action.
-*
-* This function executes the action with name $action as
-* registered by {@link elgg_register_action()}.
-*
-* The plugin hook action, $action_name will be emitted before
-* the action is executed. If a handler returns false, it will
-* prevent the action from being called.
-*
-* @note If an action isn't registered in the system or is registered
-* to an unavailable file the user will be forwarded to the site front
-* page and an error will be emitted via {@link register_error()}.
-*
-* @warning All actions require {@link http://docs.elgg.org/Actions/Tokens Action Tokens}.
-* @warning Most plugin shouldn't call this manually.
-*
-* @param string $action The requested action
-* @param string $forwarder Optionally, the location to forward to
-*
-* @link http://docs.elgg.org/Actions
-* @see elgg_register_action()
-*
-* @return void
-*/
+ * Perform an action.
+ *
+ * This function executes the action with name $action as registered
+ * by {@link elgg_register_action()}.
+ *
+ * The plugin hook 'action', $action_name will be triggered before the action
+ * is executed. If a handler returns false, it will prevent the action script
+ * from being called.
+ *
+ * @note If an action isn't registered in the system or is registered
+ * to an unavailable file the user will be forwarded to the site front
+ * page and an error will be emitted via {@link register_error()}.
+ *
+ * @warning All actions require {@link http://docs.elgg.org/Actions/Tokens Action Tokens}.
+ *
+ * @param string $action The requested action
+ * @param string $forwarder Optionally, the location to forward to
+ *
+ * @link http://docs.elgg.org/Actions
+ * @see elgg_register_action()
+ *
+ * @return void
+ * @access private
+ */
function action($action, $forwarder = "") {
global $CONFIG;
@@ -123,9 +125,8 @@ function action($action, $forwarder = "") {
/**
* Registers an action.
*
- * Actions are registered to a single file in the system and are executed
- * either by the URL http://elggsite.org/action/action_name or by calling
- * {@link action()}.
+ * Actions are registered to a script in the system and are executed
+ * either by the URL http://elggsite.org/action/action_name/.
*
* $filename must be the full path of the file to register, or a path relative
* to the core actions/ dir.
@@ -137,8 +138,7 @@ function action($action, $forwarder = "") {
*
* @tip Put action files under the actions/<plugin_name> directory of your plugin.
*
- * @tip You don't need to include engine/start.php, call {@link gatekeeper()},
- * or call {@link admin_gatekeeper()}.
+ * @tip You don't need to include engine/start.php in your action files.
*
* @internal Actions are saved in $CONFIG->actions as an array in the form:
* <code>
@@ -151,13 +151,13 @@ function action($action, $forwarder = "") {
* @param string $action The name of the action (eg "register", "account/settings/save")
* @param string $filename Optionally, the filename where this action is located. If not specified,
* will assume the action is in elgg/actions/<action>.php
- * @param string $access Who is allowed to execute this action: admin, public, or logged_in.
+ * @param string $access Who is allowed to execute this action: public, logged_in, admin.
* (default: logged_in)
*
* @see action()
* @see http://docs.elgg.org/Actions
*
- * @return true
+ * @return bool
*/
function elgg_register_action($action, $filename = "", $access = 'logged_in') {
global $CONFIG;
@@ -187,16 +187,31 @@ function elgg_register_action($action, $filename = "", $access = 'logged_in') {
}
/**
+ * Unregisters an action
+ *
+ * @param string $action Action name
+ * @return bool
+ * @since 1.8.1
+ */
+function elgg_unregister_action($action) {
+ global $CONFIG;
+
+ if (isset($CONFIG->actions[$action])) {
+ unset($CONFIG->actions[$action]);
+ return true;
+ } else {
+ return false;
+ }
+}
+
+/**
* Validate an action token.
*
- * Calls to actions will automatically validate tokens.
- * If tokens are not present or invalid, the action will be
- * denied and the user will be redirected to the front page.
+ * Calls to actions will automatically validate tokens. If tokens are not
+ * present or invalid, the action will be denied and the user will be redirected.
*
* Plugin authors should never have to manually validate action tokens.
*
- * @access private
- *
* @param bool $visibleerrors Emit {@link register_error()} errors on failure?
* @param mixed $token The token to test against. Default: $_REQUEST['__elgg_token']
* @param mixed $ts The time stamp to test against. Default: $_REQUEST['__elgg_ts']
@@ -204,6 +219,7 @@ function elgg_register_action($action, $filename = "", $access = 'logged_in') {
* @return bool
* @see generate_action_token()
* @link http://docs.elgg.org/Actions/Tokens
+ * @access private
*/
function validate_action_token($visibleerrors = TRUE, $token = NULL, $ts = NULL) {
global $CONFIG;
@@ -265,17 +281,17 @@ function validate_action_token($visibleerrors = TRUE, $token = NULL, $ts = NULL)
}
/**
-* Validates the presence of action tokens.
-*
-* This function is called for all actions. If action tokens are missing,
-* the user will be forwarded to the site front page and an error emitted.
-*
-* This function verifies form input for security features (like a generated token), and forwards
-* the page if they are invalid.
-*
-* @access private
-* @return mixed True if valid, or redirects to front page and exists.
-*/
+ * Validates the presence of action tokens.
+ *
+ * This function is called for all actions. If action tokens are missing,
+ * the user will be forwarded to the site front page and an error emitted.
+ *
+ * This function verifies form input for security features (like a generated token),
+ * and forwards if they are invalid.
+ *
+ * @return mixed True if valid or redirects.
+ * @access private
+ */
function action_gatekeeper() {
if (validate_action_token()) {
return TRUE;
@@ -301,6 +317,7 @@ function action_gatekeeper() {
* @example actions/manual_tokens.php
*
* @return string|false
+ * @access private
*/
function generate_action_token($timestamp) {
$site_secret = get_site_secret();
@@ -352,7 +369,7 @@ function get_site_secret() {
}
/**
- * Check if an action is registered and its file exists.
+ * Check if an action is registered and its script exists.
*
* @param string $action Action name
*
@@ -366,21 +383,10 @@ function elgg_action_exists($action) {
}
/**
- * Initialize some ajaxy actions features
- */
-function actions_init() {
- elgg_register_action('security/refreshtoken', '', 'public');
-
- elgg_register_simplecache_view('js/languages/en');
-
- elgg_register_plugin_hook_handler('action', 'all', 'ajax_action_hook');
- elgg_register_plugin_hook_handler('forward', 'all', 'ajax_forward_hook');
-}
-
-/**
* Checks whether the request was requested via ajax
*
* @return bool whether page was requested via ajax
+ * @since 1.8.0
*/
function elgg_is_xhr() {
return isset($_SERVER['HTTP_X_REQUESTED_WITH'])
@@ -409,7 +415,8 @@ function elgg_is_xhr() {
* @param string $type
* @param string $reason
* @param array $params
- *
+ * @return void
+ * @access private
*/
function ajax_forward_hook($hook, $type, $reason, $params) {
if (elgg_is_xhr()) {
@@ -464,6 +471,8 @@ function ajax_forward_hook($hook, $type, $reason, $params) {
/**
* Buffer all output echo'd directly in the action for inclusion in the returned JSON.
+ * @return void
+ * @access private
*/
function ajax_action_hook() {
if (elgg_is_xhr()) {
@@ -471,4 +480,17 @@ function ajax_action_hook() {
}
}
+/**
+ * Initialize some ajaxy actions features
+ * @access private
+ */
+function actions_init() {
+ elgg_register_action('security/refreshtoken', '', 'public');
+
+ elgg_register_simplecache_view('js/languages/en');
+
+ elgg_register_plugin_hook_handler('action', 'all', 'ajax_action_hook');
+ elgg_register_plugin_hook_handler('forward', 'all', 'ajax_forward_hook');
+}
+
elgg_register_event_handler('init', 'system', 'actions_init');
diff --git a/engine/lib/admin.php b/engine/lib/admin.php
index 93ee43008..ae6429baf 100644
--- a/engine/lib/admin.php
+++ b/engine/lib/admin.php
@@ -212,8 +212,8 @@ function elgg_register_admin_menu_item($section, $menu_id, $parent_id = NULL, $p
/**
* Initialize the admin backend.
- *
* @return void
+ * @access private
*/
function admin_init() {
elgg_register_action('admin/user/ban', '', 'admin');
@@ -230,8 +230,6 @@ function admin_init() {
elgg_register_action('admin/delete_admin_notice', '', 'admin');
- elgg_register_action('admin/plugins/simple_update_states', '', 'admin');
-
elgg_register_action('profile/fields/reset', '', 'admin');
elgg_register_action('profile/fields/add', '', 'admin');
elgg_register_action('profile/fields/edit', '', 'admin');
@@ -366,6 +364,7 @@ function elgg_admin_add_plugin_settings_menu() {
*
* @return void
* @since 1.8.0
+ * @access private
*/
function elgg_admin_sort_page_menu($hook, $type, $return, $params) {
$configure_items = $return['configure'];
@@ -429,6 +428,7 @@ function admin_pagesetup() {
* @param array $page Array of pages
*
* @return void
+ * @access private
*/
function admin_settings_page_handler($page) {
@@ -486,6 +486,7 @@ function admin_settings_page_handler($page) {
*
* @param array $pages The pages array
* @return true
+ * @access private
*/
function admin_plugin_screenshot_page_handler($pages) {
// only admins can use this for security
@@ -540,6 +541,7 @@ function admin_plugin_screenshot_page_handler($pages) {
* * LICENSE.txt
*
* @param type $page
+ * @access private
*/
function admin_markdown_page_handler($pages) {
admin_gatekeeper();
@@ -600,6 +602,7 @@ function admin_markdown_page_handler($pages) {
* Adds default admin widgets to the admin dashboard.
*
* @return void
+ * @access private
*/
function elgg_add_admin_widgets($event, $type, $user) {
elgg_set_ignore_access(true);
diff --git a/engine/lib/annotations.php b/engine/lib/annotations.php
index 14893aee6..66c6454c3 100644
--- a/engine/lib/annotations.php
+++ b/engine/lib/annotations.php
@@ -13,6 +13,7 @@
* @param stdClass $row Db row result object
*
* @return ElggAnnotation
+ * @access private
*/
function row_to_elggannotation($row) {
if (!($row instanceof stdClass)) {
@@ -55,14 +56,14 @@ function elgg_delete_annotation_by_id($id) {
* @param int $entity_guid Entity Guid
* @param string $name Name of annotation
* @param string $value Value of annotation
- * @param string $value_type Type of value
- * @param int $owner_guid Owner of annotation
+ * @param string $value_type Type of value (default is auto detection)
+ * @param int $owner_guid Owner of annotation (default is logged in user)
* @param int $access_id Access level of annotation
*
* @return int|bool id on success or false on failure
*/
-function create_annotation($entity_guid, $name, $value, $value_type,
-$owner_guid, $access_id = ACCESS_PRIVATE) {
+function create_annotation($entity_guid, $name, $value, $value_type = '',
+$owner_guid = 0, $access_id = ACCESS_PRIVATE) {
global $CONFIG;
$result = false;
@@ -213,7 +214,7 @@ function elgg_get_annotations(array $options = array()) {
*
* @param array $options An options array. {@See elgg_get_annotations()}
* @return mixed
- * @since 1.8
+ * @since 1.8.0
*/
function elgg_delete_annotations(array $options) {
if (!elgg_is_valid_options_for_batch_operation($options, 'annotations')) {
@@ -231,7 +232,7 @@ function elgg_delete_annotations(array $options) {
*
* @param array $options An options array. {@See elgg_get_annotations()}
* @return mixed
- * @since 1.8
+ * @since 1.8.0
*/
function elgg_disable_annotations(array $options) {
if (!elgg_is_valid_options_for_batch_operation($options, 'annotations')) {
@@ -249,7 +250,7 @@ function elgg_disable_annotations(array $options) {
*
* @param array $options An options array. {@See elgg_get_annotations()}
* @return mixed
- * @since 1.8
+ * @since 1.8.0
*/
function elgg_enable_annotations(array $options) {
if (!$options || !is_array($options)) {
@@ -267,7 +268,7 @@ function elgg_enable_annotations(array $options) {
* {@see elgg_get_annotations()} and {@see elgg_list_entities()}.
*
* @return string The list of entities
- * @since 1.8
+ * @since 1.8.0
*/
function elgg_list_annotations($options) {
$defaults = array(
@@ -288,7 +289,7 @@ function elgg_list_annotations($options) {
* Returns entities based upon annotations. Also accepts all options available
* to elgg_get_entities() and elgg_get_entities_from_metadata().
*
- * Entity creation time is selected as max_time. To sort based upon
+ * Entity creation time is selected as maxtime. To sort based upon
* this, pass 'order_by' => 'maxtime asc' || 'maxtime desc'
*
* @see elgg_get_entities
@@ -377,7 +378,7 @@ function elgg_get_entities_from_annotations(array $options = array()) {
* @see elgg_get_entities_from_annotations()
* @see elgg_list_entities()
*
- * @return str
+ * @return string
*/
function elgg_list_entities_from_annotations($options = array()) {
return elgg_list_entities($options, 'elgg_get_entities_from_annotations');
@@ -449,6 +450,7 @@ function elgg_list_entities_from_annotation_calculation($options) {
* @elgg_plugin_hook export all
*
* @return mixed
+ * @access private
*/
function export_annotation_plugin_hook($hook, $entity_type, $returnvalue, $params) {
// Sanity check values
@@ -545,6 +547,7 @@ elgg_register_plugin_hook_handler('unit_test', 'system', 'annotations_test');
/**
* Register annotation unit tests
+ * @access private
*/
function annotations_test($hook, $type, $value, $params) {
global $CONFIG;
diff --git a/engine/lib/cache.php b/engine/lib/cache.php
index 11c95e78a..2bd3b2349 100644
--- a/engine/lib/cache.php
+++ b/engine/lib/cache.php
@@ -89,7 +89,7 @@ function elgg_filepath_cache_load($type) {
* Uses the 'viewpath_cache_enabled' datalist with a boolean value.
* Resets the views paths cache.
*
- * @return null
+ * @return void
*/
function elgg_enable_filepath_cache() {
global $CONFIG;
@@ -105,7 +105,7 @@ function elgg_enable_filepath_cache() {
* Uses the 'viewpath_cache_enabled' datalist with a boolean value.
* Resets the views paths cache.
*
- * @return null
+ * @return void
*/
function elgg_disable_filepath_cache() {
global $CONFIG;
@@ -325,4 +325,3 @@ function elgg_invalidate_simplecache() {
return $return;
}
-
diff --git a/engine/lib/calendar.php b/engine/lib/calendar.php
index a882aedbe..9a06c5292 100644
--- a/engine/lib/calendar.php
+++ b/engine/lib/calendar.php
@@ -16,6 +16,7 @@
* @param int $year Year
*
* @return int
+ * @access private
*/
function get_day_start($day = null, $month = null, $year = null) {
return mktime(0, 0, 0, $month, $day, $year);
@@ -29,6 +30,7 @@ function get_day_start($day = null, $month = null, $year = null) {
* @param int $year Year
*
* @return int
+ * @access private
*/
function get_day_end($day = null, $month = null, $year = null) {
return mktime(23, 59, 59, $month, $day, $year);
@@ -50,6 +52,7 @@ function get_day_end($day = null, $month = null, $year = null) {
* @param mixed $container_guid Container or containers to get entities from (default: any).
*
* @return array|false
+ * @access private
*/
function get_notable_entities($start_time, $end_time, $type = "", $subtype = "", $owner_guid = 0,
$order_by = "asc", $limit = 10, $offset = 0, $count = false, $site_guid = 0,
@@ -197,6 +200,7 @@ $container_guid = null) {
* @param bool $count If true, returns count instead of entities. (Default: false)
*
* @return int|array A list of entities, or a count if $count is set to true
+ * @access private
*/
function get_notable_entities_from_metadata($start_time, $end_time, $meta_name, $meta_value = "",
$entity_type = "", $entity_subtype = "", $owner_guid = 0, $limit = 10, $offset = 0, $order_by = "",
@@ -326,6 +330,7 @@ $site_guid = 0, $count = false) {
* @param int $site_guid Site to get entities for. Default 0 = current site. -1 = any
*
* @return array|int|false An array of entities, or the number of entities, or false on failure
+ * @access private
*/
function get_noteable_entities_from_relationship($start_time, $end_time, $relationship,
$relationship_guid, $inverse_relationship = false, $type = "", $subtype = "", $owner_guid = 0,
@@ -435,6 +440,7 @@ $order_by = "", $limit = 10, $offset = 0, $count = false, $site_guid = 0) {
* @param mixed $container_guid Container(s) to get entities from (default: any).
*
* @return array|false
+ * @access private
*/
function get_todays_entities($type = "", $subtype = "", $owner_guid = 0, $order_by = "",
$limit = 10, $offset = 0, $count = false, $site_guid = 0, $container_guid = null) {
@@ -461,6 +467,7 @@ $limit = 10, $offset = 0, $count = false, $site_guid = 0, $container_guid = null
* @param bool $count If true, returns count instead of entities. (Default: false)
*
* @return int|array A list of entities, or a count if $count is set to true
+ * @access private
*/
function get_todays_entities_from_metadata($meta_name, $meta_value = "", $entity_type = "",
$entity_subtype = "", $owner_guid = 0, $limit = 10, $offset = 0, $order_by = "", $site_guid = 0,
@@ -491,6 +498,7 @@ $count = false) {
* @param int $site_guid Site to get entities for. Default 0 = current site. -1 = any
*
* @return array|int|false An array of entities, or the number of entities, or false on failure
+ * @access private
*/
function get_todays_entities_from_relationship($relationship, $relationship_guid,
$inverse_relationship = false, $type = "", $subtype = "", $owner_guid = 0,
@@ -520,6 +528,7 @@ $order_by = "", $limit = 10, $offset = 0, $count = false, $site_guid = 0) {
* @param boolean $navigation Display pagination? Default: true
*
* @return string A viewable list of entities
+ * @access private
*/
function list_notable_entities($start_time, $end_time, $type= "", $subtype = "", $owner_guid = 0,
$limit = 10, $fullview = true, $listtypetoggle = false, $navigation = true) {
@@ -549,6 +558,7 @@ $limit = 10, $fullview = true, $listtypetoggle = false, $navigation = true) {
* @param boolean $navigation Display pagination? Default: true
*
* @return string A viewable list of entities
+ * @access private
*/
function list_todays_entities($type= "", $subtype = "", $owner_guid = 0, $limit = 10,
$fullview = true, $listtypetoggle = false, $navigation = true) {
diff --git a/engine/lib/configuration.php b/engine/lib/configuration.php
index 3a2364057..c6db515e8 100644
--- a/engine/lib/configuration.php
+++ b/engine/lib/configuration.php
@@ -168,6 +168,7 @@ function elgg_save_config($name, $value, $site_guid = 0) {
*
* @throws InstallationException
* @return void
+ * @access private
*/
function verify_installation() {
global $CONFIG;
@@ -212,6 +213,7 @@ $DATALIST_CACHE = array();
*
* @param string $name The name of the datalist
* @return string|null|false String if value exists, null if doesn't, false on error
+ * @access private
*/
function datalist_get($name) {
global $CONFIG, $DATALIST_CACHE;
@@ -272,6 +274,7 @@ function datalist_get($name) {
* @param string $value The new value
*
* @return bool
+ * @access private
*/
function datalist_set($name, $value) {
global $CONFIG, $DATALIST_CACHE;
@@ -402,6 +405,7 @@ function unset_config($name, $site_guid = 0) {
* @todo Use "INSERT ... ON DUPLICATE KEY UPDATE" instead of trying to delete then add.
* @see unset_config()
* @see get_config()
+ * @access private
*/
function set_config($name, $value, $site_guid = 0) {
global $CONFIG;
@@ -443,6 +447,7 @@ function set_config($name, $value, $site_guid = 0) {
* @return mixed|null
* @see set_config()
* @see unset_config()
+ * @access private
*/
function get_config($name, $site_guid = 0) {
global $CONFIG;
@@ -504,6 +509,7 @@ function get_config($name, $site_guid = 0) {
* @param int $site_guid Optionally, the GUID of the site (current site is assumed by default)
*
* @return bool
+ * @access private
*/
function get_all_config($site_guid = 0) {
global $CONFIG;
@@ -531,6 +537,7 @@ function get_all_config($site_guid = 0) {
* loads them into $CONFIG.
*
* @return true
+ * @access private
*/
function set_default_config() {
global $CONFIG;
@@ -577,6 +584,7 @@ function set_default_config() {
*
* @elgg_event boot system
* @return true|null
+ * @access private
*/
function configuration_boot() {
global $CONFIG;
diff --git a/engine/lib/cron.php b/engine/lib/cron.php
index 2a0b1d665..8c0b62a53 100644
--- a/engine/lib/cron.php
+++ b/engine/lib/cron.php
@@ -10,6 +10,7 @@
* Cron initialization
*
* @return void
+ * @access private
*/
function cron_init() {
// Register a pagehandler for cron
@@ -25,6 +26,7 @@ function cron_init() {
* @param array $page Pages
*
* @return void
+ * @access private
*/
function cron_page_handler($page) {
global $CONFIG;
@@ -72,6 +74,7 @@ function cron_page_handler($page) {
* @param mixed $params Params
*
* @return array
+ * @access private
*/
function cron_public_pages($hook, $type, $return_value, $params) {
$return_value[] = 'cron/minute';
diff --git a/engine/lib/database.php b/engine/lib/database.php
index f12b50079..b5ad7897f 100644
--- a/engine/lib/database.php
+++ b/engine/lib/database.php
@@ -72,6 +72,7 @@ $dbcalls = 0;
* resource. eg "read", "write", or "readwrite".
*
* @return void
+ * @access private
*/
function establish_db_link($dblinkname = "readwrite") {
// Get configuration, and globalise database link
@@ -130,6 +131,7 @@ function establish_db_link($dblinkname = "readwrite") {
* links up separately; otherwise just create the one database link.
*
* @return void
+ * @access private
*/
function setup_db_connections() {
global $CONFIG, $dblink;
@@ -146,6 +148,7 @@ function setup_db_connections() {
* Display profiling information about db at NOTICE debug level upon shutdown.
*
* @return void
+ * @access private
*/
function db_profiling_shutdown_hook() {
global $dbcalls;
@@ -158,6 +161,7 @@ function db_profiling_shutdown_hook() {
* Execute any delayed queries upon shutdown.
*
* @return void
+ * @access private
*/
function db_delayedexecution_shutdown_hook() {
global $DB_DELAYED_QUERIES;
@@ -191,6 +195,7 @@ function db_delayedexecution_shutdown_hook() {
*
* @return true
* @elgg_event_handler boot system
+ * @access private
*/
function init_db() {
register_shutdown_function('db_delayedexecution_shutdown_hook');
@@ -209,6 +214,7 @@ function init_db() {
* @param string $dblinktype The type of link we want: "read", "write" or "readwrite".
*
* @return object Database link
+ * @access private
*/
function get_db_link($dblinktype) {
global $dblink;
@@ -230,6 +236,7 @@ function get_db_link($dblinktype) {
* @param mixed $link The database link resource to user.
*
* @return mixed An object of the query's result, or FALSE
+ * @access private
*/
function explain_query($query, $link) {
if ($result = execute_query("explain " . $query, $link)) {
@@ -253,6 +260,7 @@ function explain_query($query, $link) {
*
* @return The result of mysql_query()
* @throws DatabaseException
+ * @access private
*/
function execute_query($query, $dblink) {
global $CONFIG, $dbcalls;
@@ -283,6 +291,7 @@ function execute_query($query, $dblink) {
* @param string $handler A callback function to pass the results array to
*
* @return true
+ * @access private
*/
function execute_delayed_query($query, $dblink, $handler = "") {
global $DB_DELAYED_QUERIES;
@@ -315,6 +324,7 @@ function execute_delayed_query($query, $dblink, $handler = "") {
* @return true
* @uses execute_delayed_query()
* @uses get_db_link()
+ * @access private
*/
function execute_delayed_write_query($query, $handler = "") {
return execute_delayed_query($query, 'write', $handler);
@@ -329,6 +339,7 @@ function execute_delayed_write_query($query, $handler = "") {
* @return true
* @uses execute_delayed_query()
* @uses get_db_link()
+ * @access private
*/
function execute_delayed_read_query($query, $handler = "") {
return execute_delayed_query($query, 'read', $handler);
@@ -348,6 +359,7 @@ function execute_delayed_read_query($query, $handler = "") {
*
* @return array An array of database result objects or callback function results. If the query
* returned nothing, an empty array.
+ * @access private
*/
function get_data($query, $callback = "") {
return elgg_query_runner($query, $callback, false);
@@ -364,6 +376,7 @@ function get_data($query, $callback = "") {
* @param string $callback A callback function
*
* @return mixed A single database result object or the result of the callback function.
+ * @access private
*/
function get_data_row($query, $callback = "") {
return elgg_query_runner($query, $callback, true);
@@ -382,6 +395,7 @@ function get_data_row($query, $callback = "") {
* @return array An array of database result objects or callback function results. If the query
* returned nothing, an empty array.
* @since 1.8.0
+ * @access private
*/
function elgg_query_runner($query, $callback = null, $single = false) {
global $CONFIG, $DB_QUERY_CACHE;
@@ -447,6 +461,7 @@ function elgg_query_runner($query, $callback = null, $single = false) {
*
* @return int|false The database id of the inserted row if a AUTO_INCREMENT field is
* defined, 0 if not, and false on failure.
+ * @access private
*/
function insert_data($query) {
global $CONFIG, $DB_QUERY_CACHE;
@@ -477,7 +492,8 @@ function insert_data($query) {
*
* @param string $query The query to run.
*
- * @return Bool
+ * @return bool
+ * @access private
*/
function update_data($query) {
global $CONFIG, $DB_QUERY_CACHE;
@@ -508,6 +524,7 @@ function update_data($query) {
* @param string $query The SQL query to run
*
* @return int|false The number of affected rows or false on failure
+ * @access private
*/
function delete_data($query) {
global $CONFIG, $DB_QUERY_CACHE;
@@ -537,6 +554,7 @@ function delete_data($query) {
*
* @return array|false List of tables or false on failure
* @static array $tables Tables found matching the database prefix
+ * @access private
*/
function get_db_tables() {
global $CONFIG;
@@ -579,6 +597,7 @@ function get_db_tables() {
* @param string $table The name of the table to optimise
*
* @return bool
+ * @access private
*/
function optimize_table($table) {
$table = sanitise_string($table);
@@ -591,6 +610,7 @@ function optimize_table($table) {
* @param resource $dblink The DB link
*
* @return string Database error message
+ * @access private
*/
function get_db_error($dblink) {
return mysql_error($dblink);
@@ -615,6 +635,7 @@ function get_db_error($dblink) {
*
* @return void
* @throws DatabaseException
+ * @access private
*/
function run_sql_script($scriptlocation) {
if ($script = file_get_contents($scriptlocation)) {
@@ -659,6 +680,7 @@ function run_sql_script($scriptlocation) {
*
* @param string $query Query string
* @return string
+ * @access private
*/
function elgg_format_query($query) {
// remove newlines and extra spaces so logs are easier to read
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php
index 5c9479f74..53a15ba7a 100644
--- a/engine/lib/elgglib.php
+++ b/engine/lib/elgglib.php
@@ -18,6 +18,7 @@ elgg_register_classes(dirname(dirname(__FILE__)) . '/classes');
*
* @return void
* @throws Exception
+ * @access private
*/
function _elgg_autoload($class) {
global $CONFIG;
@@ -414,6 +415,7 @@ function elgg_get_loaded_external_files($type, $location) {
* Bootstraps the externals data structure in $CONFIG.
*
* @param string $type The type of external, js or css.
+ * @access private
*/
function elgg_bootstrap_externals_data_structure($type) {
global $CONFIG;
@@ -422,7 +424,7 @@ function elgg_bootstrap_externals_data_structure($type) {
$CONFIG->externals = array();
}
- if (!$CONFIG->externals[$type] instanceof ElggPriorityList) {
+ if (!isset($CONFIG->externals[$type]) || !$CONFIG->externals[$type] instanceof ElggPriorityList) {
$CONFIG->externals[$type] = new ElggPriorityList();
}
@@ -987,6 +989,7 @@ function elgg_trigger_plugin_hook($hook, $type, $params = null, $returnvalue = n
* @param Exception $exception The exception being handled
*
* @return void
+ * @access private
*/
function _elgg_php_exception_handler($exception) {
error_log("*** FATAL EXCEPTION *** : " . $exception);
@@ -1035,6 +1038,7 @@ function _elgg_php_exception_handler($exception) {
* @param array $vars An array that points to the active symbol table where error occurred
*
* @return true
+ * @access private
*/
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)";
@@ -1669,9 +1673,9 @@ function is_not_null($string) {
* @param array $options The options array. $options['keys'] = 'values';
* @param array $singulars A list of singular words to pluralize by adding 's'.
*
- * @access private
* @return array
* @since 1.7.0
+ * @access private
*/
function elgg_normalise_plural_options_array($options, $singulars) {
foreach ($singulars as $singular) {
@@ -1709,6 +1713,7 @@ function elgg_normalise_plural_options_array($options, $singulars) {
*
* @return void
* @see register_shutdown_hook()
+ * @access private
*/
function _elgg_shutdown_hook() {
global $START_MICROTIME;
@@ -1737,6 +1742,7 @@ function _elgg_shutdown_hook() {
*
* @return void
* @elgg_pagehandler js
+ * @access private
*/
function elgg_js_page_handler($page) {
return elgg_cacheable_view_page_handler($page, 'js');
@@ -1751,6 +1757,7 @@ function elgg_js_page_handler($page) {
*
* @return void
* @elgg_pagehandler ajax
+ * @access private
*/
function elgg_ajax_page_handler($page) {
if (is_array($page) && sizeof($page)) {
@@ -1783,6 +1790,7 @@ function elgg_ajax_page_handler($page) {
*
* @return void
* @elgg_pagehandler css
+ * @access private
*/
function elgg_css_page_handler($page) {
if (!isset($page[0])) {
@@ -1802,6 +1810,7 @@ function elgg_css_page_handler($page) {
* @param string $type The type: js or css
*
* @return mixed
+ * @access private
*/
function elgg_cacheable_view_page_handler($page, $type) {
@@ -1855,6 +1864,7 @@ function elgg_cacheable_view_page_handler($page, $type) {
* @param string $order_by An order by clause
* @access private
* @return string
+ * @access private
*/
function elgg_sql_reverse_order_by_clause($order_by) {
$order_by = strtolower($order_by);
@@ -1877,8 +1887,8 @@ function elgg_sql_reverse_order_by_clause($order_by) {
* Used as a callback for ElggBatch.
*
* @param object $object The object to enable
- * @access private
* @return bool
+ * @access private
*/
function elgg_batch_enable_callback($object) {
// our db functions return the number of rows affected...
@@ -1891,8 +1901,8 @@ function elgg_batch_enable_callback($object) {
* Used as a callback for ElggBatch.
*
* @param object $object The object to disable
- * @access private
* @return bool
+ * @access private
*/
function elgg_batch_disable_callback($object) {
// our db functions return the number of rows affected...
@@ -1905,8 +1915,8 @@ function elgg_batch_disable_callback($object) {
* Used as a callback for ElggBatch.
*
* @param object $object The object to disable
- * @access private
* @return bool
+ * @access private
*/
function elgg_batch_delete_callback($object) {
// our db functions return the number of rows affected...
@@ -1920,6 +1930,7 @@ function elgg_batch_delete_callback($object) {
* @param array $options Options array
* @param string $type Options type: metadata or annotations
* @return bool
+ * @access private
*/
function elgg_is_valid_options_for_batch_operation($options, $type) {
if (!$options || !is_array($options)) {
@@ -1973,7 +1984,8 @@ function elgg_is_valid_options_for_batch_operation($options, $type) {
*
* @link http://docs.elgg.org/Tutorials/WalledGarden
* @elgg_plugin_hook index system
- * @return boolean
+ * @return bool
+ * @access private
*/
function elgg_walled_garden_index() {
elgg_register_css('elgg.walled_garden', '/css/walled_garden.css');
@@ -1999,6 +2011,7 @@ function elgg_walled_garden_index() {
* @elgg_event_handler init system
* @link http://docs.elgg.org/Tutorials/WalledGarden
* @return void
+ * @access private
*/
function elgg_walled_garden() {
global $CONFIG;
@@ -2016,6 +2029,7 @@ function elgg_walled_garden() {
*
* @elgg_event_handler init system
* @return void
+ * @access private
*/
function elgg_init() {
global $CONFIG;
@@ -2070,6 +2084,7 @@ function elgg_init() {
*
* @elgg_plugin_hook unit_tests system
* @return void
+ * @access private
*/
function elgg_api_test($hook, $type, $value, $params) {
global $CONFIG;
diff --git a/engine/lib/entities.php b/engine/lib/entities.php
index 927be4b1d..f1352ba8d 100644
--- a/engine/lib/entities.php
+++ b/engine/lib/entities.php
@@ -452,8 +452,10 @@ function can_write_to_container($user_guid = 0, $container_guid = 0, $type = 'al
$container_guid = elgg_get_page_owner_guid();
}
+ $return = false;
+
if (!$container_guid) {
- $return = TRUE;
+ $return = true;
}
$container = get_entity($container_guid);
@@ -461,16 +463,16 @@ function can_write_to_container($user_guid = 0, $container_guid = 0, $type = 'al
if ($container) {
// If the user can edit the container, they can also write to it
if ($container->canEdit($user_guid)) {
- $return = TRUE;
+ $return = true;
}
// Basics, see if the user is a member of the group.
// @todo this should be moved to the groups plugin/library
if ($user && $container instanceof ElggGroup) {
if (!$container->isMember($user)) {
- $return = FALSE;
+ $return = false;
} else {
- $return = TRUE;
+ $return = true;
}
}
}
@@ -507,8 +509,8 @@ function can_write_to_container($user_guid = 0, $container_guid = 0, $type = 'al
*
* @return int|false The new entity's GUID, or false on failure
* @throws InvalidParameterException
- * @access private
* @link http://docs.elgg.org/DataModel/Entities
+ * @access private
*/
function create_entity($type, $subtype, $owner_guid, $access_id, $site_guid = 0,
$container_guid = 0) {
@@ -1358,9 +1360,9 @@ $order_by = 'time_created') {
* @param bool $recursive Recursively disable all entities owned or contained by $guid?
*
* @return bool
- * @access private
* @see access_show_hidden_entities()
* @link http://docs.elgg.org/Entities
+ * @access private
*/
function disable_entity($guid, $reason = "", $recursive = true) {
global $CONFIG;
@@ -1472,8 +1474,8 @@ function enable_entity($guid) {
* @param bool $recursive If true (default) then all entities which are
* owned or contained by $guid will also be deleted.
*
- * @access private
* @return bool
+ * @access private
*/
function delete_entity($guid, $recursive = true) {
global $CONFIG, $ENTITY_CACHE;
@@ -1505,7 +1507,11 @@ function delete_entity($guid, $recursive = true) {
or site_guid=$guid", 'entity_row_to_elggstar');
if ($sub_entities) {
foreach ($sub_entities as $e) {
- $e->delete(true);
+ // 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);
+ }
}
}
@@ -1566,7 +1572,7 @@ function delete_entity($guid, $recursive = true) {
* @param string $returnvalue Return value from previous hook
* @param array $params The parameters, passed 'guid' and 'varname'
*
- * @return null
+ * @return void
* @elgg_plugin_hook_handler volatile metadata
* @todo investigate more.
* @access private
@@ -1610,6 +1616,7 @@ function volatile_data_export_plugin_hook($hook, $entity_type, $returnvalue, $pa
*
* @elgg_event_handler export all
* @return mixed
+ * @access private
*/
function export_entity_plugin_hook($hook, $entity_type, $returnvalue, $params) {
// Sanity check values
@@ -1651,6 +1658,7 @@ function export_entity_plugin_hook($hook, $entity_type, $returnvalue, $params) {
*
* @return ElggEntity the unsaved entity which should be populated by items.
* @todo Remove this.
+ * @access private
*/
function oddentity_to_elggentity(ODDEntity $element) {
$class = $element->getAttribute('class');
@@ -1721,7 +1729,7 @@ function oddentity_to_elggentity(ODDEntity $element) {
* @return mixed
* @elgg_plugin_hook_handler import all
* @todo document
- *
+ * @access private
*/
function import_entity_plugin_hook($hook, $entity_type, $returnvalue, $params) {
$element = $params['element'];
@@ -2058,6 +2066,7 @@ function is_registered_entity_type($type, $subtype = null) {
*
* @return void
* @elgg_page_handler view
+ * @access private
*/
function entities_page_handler($page) {
if (isset($page[0])) {
@@ -2138,10 +2147,10 @@ function elgg_list_registered_entities(array $options = array()) {
* If an entity is deleted recursively, a permissions override is required to allow
* contained or owned entities to be removed.
*
- * @access private
* @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;
@@ -2190,8 +2199,6 @@ function elgg_instanceof($entity, $type = NULL, $subtype = NULL, $class = NULL)
/**
* Update the last_action column in the entities table for $guid.
*
- * This determines the sort order of 1.8's default river.
- *
* @warning This is different to time_updated. Time_updated is automatically set,
* while last_action is only set when explicitly called.
*
@@ -2199,7 +2206,8 @@ function elgg_instanceof($entity, $type = NULL, $subtype = NULL, $class = NULL)
* @param int $posted Timestamp of last action
*
* @return bool
- **/
+ * @access private
+ */
function update_entity_last_action($guid, $posted = NULL) {
global $CONFIG;
$guid = (int)$guid;
@@ -2228,6 +2236,7 @@ function update_entity_last_action($guid, $posted = NULL) {
*
* @return void
* @elgg_plugin_hook_handler gc system
+ * @access private
*/
function entities_gc() {
global $CONFIG;
@@ -2249,6 +2258,7 @@ function entities_gc() {
* @param mixed $params Params
*
* @return array
+ * @access private
*/
function entities_test($hook, $type, $value, $params) {
global $CONFIG;
@@ -2261,6 +2271,7 @@ function entities_test($hook, $type, $value, $params) {
*
* @return void
* @elgg_event_handler init system
+ * @access private
*/
function entities_init() {
elgg_register_page_handler('view', 'entities_page_handler');
diff --git a/engine/lib/export.php b/engine/lib/export.php
index f81bee2fe..ae9be95ce 100644
--- a/engine/lib/export.php
+++ b/engine/lib/export.php
@@ -111,6 +111,7 @@ $IMPORTED_OBJECT_COUNTER = 0;
* @param ODD $odd The odd element to process
*
* @return bool
+ * @access private
*/
function _process_element(ODD $odd) {
global $IMPORTED_DATA, $IMPORTED_OBJECT_COUNTER;
@@ -140,6 +141,7 @@ function _process_element(ODD $odd) {
*
* @return array
* @throws ExportException
+ * @access private
*/
function exportAsArray($guid) {
$guid = (int)$guid;
@@ -167,6 +169,7 @@ function exportAsArray($guid) {
*
* @return xml
* @see ElggEntity for an example of its usage.
+ * @access private
*/
function export($guid) {
$odd = new ODDDocument(exportAsArray($guid));
@@ -182,6 +185,7 @@ function export($guid) {
*
* @return bool
* @throws Exception if there was a problem importing the data.
+ * @access private
*/
function import($xml) {
global $IMPORTED_DATA, $IMPORTED_OBJECT_COUNTER;
@@ -210,6 +214,7 @@ function import($xml) {
* Register the OpenDD import action
*
* @return void
+ * @access private
*/
function export_init() {
global $CONFIG;
diff --git a/engine/lib/extender.php b/engine/lib/extender.php
index 50b05579b..51fc62c30 100644
--- a/engine/lib/extender.php
+++ b/engine/lib/extender.php
@@ -44,6 +44,7 @@ function detect_extender_valuetype($value, $value_type = "") {
* @param ODDMetaData $element The OpenDD element
*
* @return bool
+ * @access private
*/
function oddmetadata_to_elggextender(ElggEntity $entity, ODDMetaData $element) {
// Get the type of extender (metadata, type, attribute etc)
diff --git a/engine/lib/filestore.php b/engine/lib/filestore.php
index 1e257c8b0..70b8bfb4c 100644
--- a/engine/lib/filestore.php
+++ b/engine/lib/filestore.php
@@ -465,6 +465,7 @@ function set_default_filestore(ElggFilestore $filestore) {
* ElggFile.
*
* @return void
+ * @access private
*/
function filestore_run_once() {
// Register a class
@@ -476,6 +477,7 @@ function filestore_run_once() {
* Listens to system boot and registers any appropriate file types and classes
*
* @return void
+ * @access private
*/
function filestore_init() {
global $CONFIG;
@@ -496,6 +498,7 @@ function filestore_init() {
* @param mixed $params Params
*
* @return array
+ * @access private
*/
function filestore_test($hook, $type, $value, $params) {
global $CONFIG;
diff --git a/engine/lib/group.php b/engine/lib/group.php
index 7fa188cd6..29330eeca 100644
--- a/engine/lib/group.php
+++ b/engine/lib/group.php
@@ -14,6 +14,7 @@
* @param int $guid GUID for a group
*
* @return array|false
+ * @access private
*/
function get_group_entity_as_row($guid) {
global $CONFIG;
diff --git a/engine/lib/input.php b/engine/lib/input.php
index f2cefc3e5..4900817a5 100644
--- a/engine/lib/input.php
+++ b/engine/lib/input.php
@@ -16,7 +16,7 @@
*
* Note: this function does not handle nested arrays (ex: form input of param[m][n])
* because of the filtering done in htmlawed from the filter_tags call.
- * @todo Is this ^ still?
+ * @todo Is this ^ still true?
*
* @param string $variable The variable we want to return.
* @param mixed $default A default value for the variable if it is not found.
@@ -234,6 +234,7 @@ function elgg_clear_sticky_value($form_name, $variable) {
* limit int default is 10
*
* @return string JSON string is returned and then exit
+ * @access private
*/
function input_livesearch_page_handler($page) {
global $CONFIG;
@@ -431,6 +432,7 @@ function input_livesearch_page_handler($page) {
* Register input functions and sanitize input
*
* @return void
+ * @access private
*/
function input_init() {
// register an endpoint for live search / autocomplete.
diff --git a/engine/lib/metadata.php b/engine/lib/metadata.php
index e5389df38..0220e6c1f 100644
--- a/engine/lib/metadata.php
+++ b/engine/lib/metadata.php
@@ -13,6 +13,7 @@
* @param stdClass $row An object from the database
*
* @return stdClass or ElggMetadata
+ * @access private
*/
function row_to_elggmetadata($row) {
if (!($row instanceof stdClass)) {
@@ -302,7 +303,7 @@ function elgg_get_metadata(array $options = array()) {
*
* @param array $options An options array. {@See elgg_get_metadata()}
* @return mixed
- * @since 1.8
+ * @since 1.8.0
*/
function elgg_delete_metadata(array $options) {
if (!elgg_is_valid_options_for_batch_operation($options, 'metadata')) {
@@ -320,7 +321,7 @@ function elgg_delete_metadata(array $options) {
*
* @param array $options An options array. {@See elgg_get_metadata()}
* @return mixed
- * @since 1.8
+ * @since 1.8.0
*/
function elgg_disable_metadata(array $options) {
if (!elgg_is_valid_options_for_batch_operation($options, 'metadata')) {
@@ -338,7 +339,7 @@ function elgg_disable_metadata(array $options) {
*
* @param array $options An options array. {@See elgg_get_metadata()}
* @return mixed
- * @since 1.8
+ * @since 1.8.0
*/
function elgg_enable_metadata(array $options) {
if (!$options || !is_array($options)) {
@@ -448,6 +449,7 @@ function elgg_get_entities_from_metadata(array $options = array()) {
*
* @return FALSE|array False on fail, array('joins', 'wheres')
* @since 1.7.0
+ * @access private
*/
function elgg_get_entity_metadata_where_sql($e_table, $n_table, $names = NULL, $values = NULL,
$pairs = NULL, $pair_operator = 'AND', $case_sensitive = TRUE, $order_by_metadata = NULL,
@@ -716,6 +718,7 @@ function elgg_list_entities_from_metadata($options) {
* @param mixed $params Params
*
* @return array
+ * @access private
*/
function export_metadata_plugin_hook($hook, $entity_type, $returnvalue, $params) {
// Sanity check values
@@ -896,6 +899,7 @@ elgg_register_plugin_hook_handler('unit_test', 'system', 'metadata_test');
* @param mixed $params Params
*
* @return array
+ * @access private
*/
function metadata_test($hook, $type, $value, $params) {
global $CONFIG;
diff --git a/engine/lib/metastrings.php b/engine/lib/metastrings.php
index 8c00fb2ad..9dccec700 100644
--- a/engine/lib/metastrings.php
+++ b/engine/lib/metastrings.php
@@ -161,6 +161,7 @@ function add_metastring($string, $case_sensitive = true) {
* Delete any orphaned entries in metastrings. This is run by the garbage collector.
*
* @return bool
+ * @access private
*/
function delete_orphaned_metastrings() {
global $CONFIG;
@@ -504,6 +505,7 @@ function elgg_get_metastring_based_objects($options) {
* @param bool $case_sensitive Should name and values be case sensitive?
*
* @return array
+ * @access private
*/
function elgg_get_metastring_sql($table, $names = null, $values = null,
$pairs = null, $ids = null, $case_sensitive = false) {
@@ -611,9 +613,9 @@ function elgg_get_metastring_sql($table, $names = null, $values = null,
* corresponding metastrings name.
*
* @param array $options An options array
- * @since 1.8
- * @access private
+ * @since 1.8.0
* @return array
+ * @access private
*/
function elgg_normalize_metastrings_options(array $options = array()) {
@@ -665,7 +667,7 @@ function elgg_normalize_metastrings_options(array $options = array()) {
* @param string $type The type of table to use: metadata or anntations
*
* @return bool
- * @since 1.8
+ * @since 1.8.0
* @access private
*/
function elgg_set_metastring_based_object_enabled_by_id($id, $enabled, $type) {
@@ -718,8 +720,8 @@ function elgg_set_metastring_based_object_enabled_by_id($id, $enabled, $type) {
* @param array $options An options array. {@See elgg_get_metastring_based_objects()}
* @param string $callback The callback to pass each result through
* @return mixed
+ * @since 1.8.0
* @access private
- * @since 1.8
*/
function elgg_batch_metastring_based_objects(array $options, $callback) {
if (!$options || !is_array($options)) {
@@ -739,7 +741,7 @@ function elgg_batch_metastring_based_objects(array $options, $callback) {
* @param string $type The type: annotation or metadata
* @return mixed
*
- * @since 1.8
+ * @since 1.8.0
* @access private
*/
function elgg_get_metastring_based_object_from_id($id, $type) {
@@ -769,7 +771,7 @@ function elgg_get_metastring_based_object_from_id($id, $type) {
* @param string $type The object's metastring type: annotation or metadata
* @return bool
*
- * @since 1.8
+ * @since 1.8.0
* @access private
*/
function elgg_delete_metastring_based_object_by_id($id, $type) {
@@ -827,6 +829,7 @@ function elgg_delete_metastring_based_object_by_id($id, $type) {
*
* @return array
* @since 1.7.0
+ * @access private
*/
function elgg_entities_get_metastrings_options($type, $options) {
$valid_types = array('metadata', 'annotation');
@@ -891,6 +894,7 @@ elgg_register_plugin_hook_handler('unit_test', 'system', 'metastrings_test');
* @param mixed $params Params
*
* @return array
+ * @access private
*/
function metastrings_test($hook, $type, $value, $params) {
global $CONFIG;
diff --git a/engine/lib/navigation.php b/engine/lib/navigation.php
index 3f3a8ecd5..aaf9fb544 100644
--- a/engine/lib/navigation.php
+++ b/engine/lib/navigation.php
@@ -255,6 +255,7 @@ function elgg_get_breadcrumbs() {
* @param array $return Menu array
* @param array $params
* @return array
+ * @access private
*/
function elgg_site_menu_setup($hook, $type, $return, $params) {
@@ -305,6 +306,7 @@ function elgg_site_menu_setup($hook, $type, $return, $params) {
/**
* Add the comment and like links to river actions menu
+ * @access private
*/
function elgg_river_menu_setup($hook, $type, $return, $params) {
if (elgg_is_logged_in()) {
@@ -332,6 +334,7 @@ function elgg_river_menu_setup($hook, $type, $return, $params) {
/**
* Entity menu is list of links and info on any entity
+ * @access private
*/
function elgg_entity_menu_setup($hook, $type, $return, $params) {
if (elgg_in_context('widgets')) {
@@ -379,6 +382,7 @@ function elgg_entity_menu_setup($hook, $type, $return, $params) {
/**
* Adds a delete link to "generic_comment" annotations
+ * @access private
*/
function elgg_annotation_menu_setup($hook, $type, $return, $params) {
$annotation = $params['annotation'];
@@ -404,6 +408,7 @@ function elgg_annotation_menu_setup($hook, $type, $return, $params) {
/**
* Navigation initialization
+ * @access private
*/
function elgg_nav_init() {
elgg_register_plugin_hook_handler('prepare', 'menu:site', 'elgg_site_menu_setup');
diff --git a/engine/lib/notification.php b/engine/lib/notification.php
index 0754d683a..eb7e594c6 100644
--- a/engine/lib/notification.php
+++ b/engine/lib/notification.php
@@ -236,6 +236,7 @@ function set_user_notification_setting($user_guid, $method, $value) {
* @param array $params Optional parameters (none taken in this instance)
*
* @return bool
+ * @access private
*/
function email_notify_handler(ElggEntity $from, ElggUser $to, $subject, $message,
array $params = NULL) {
@@ -359,6 +360,7 @@ function elgg_send_email($from, $to, $subject, $body, array $params = NULL) {
* Correctly initialise notifications and register the email handler.
*
* @return void
+ * @access private
*/
function notification_init() {
// Register a notification handler for the default email method
@@ -375,6 +377,7 @@ function notification_init() {
*
* @return void
* @todo why can't this call action(...)?
+ * @access private
*/
function notification_user_settings_save() {
global $CONFIG;
@@ -447,6 +450,7 @@ function remove_notification_interest($user_guid, $author_guid) {
* @param mixed $object The object created
*
* @return void
+ * @access private
*/
function object_notifications($event, $object_type, $object) {
// We only want to trigger notification events for ElggEntities
diff --git a/engine/lib/objects.php b/engine/lib/objects.php
index b138d6888..63d0f5cef 100644
--- a/engine/lib/objects.php
+++ b/engine/lib/objects.php
@@ -13,6 +13,7 @@
* @param int $guid The guid to retreive
*
* @return bool
+ * @access private
*/
function get_object_entity_as_row($guid) {
global $CONFIG;
@@ -109,6 +110,7 @@ function get_object_sites($object_guid, $limit = 10, $offset = 0) {
* @param mixed $params Params
*
* @return array
+ * @access private
*/
function objects_test($hook, $type, $value, $params) {
global $CONFIG;
diff --git a/engine/lib/opendd.php b/engine/lib/opendd.php
index 69977d1d9..f00ea6aab 100644
--- a/engine/lib/opendd.php
+++ b/engine/lib/opendd.php
@@ -13,6 +13,7 @@
* @param XmlElement $element The element(s)
*
* @return mixed An ODD object if the element can be handled, or false.
+ * @access private
*/
function ODD_factory (XmlElement $element) {
$name = $element->name;
@@ -57,6 +58,7 @@ function ODD_factory (XmlElement $element) {
* @param string $xml The XML ODD.
*
* @return ODDDocument
+ * @access private
*/
function ODD_Import($xml) {
// Parse XML to an array
@@ -96,6 +98,7 @@ function ODD_Import($xml) {
* @param ODDDocument $document The Document.
*
* @return string
+ * @access private
*/
function ODD_Export(ODDDocument $document) {
return "$document";
diff --git a/engine/lib/output.php b/engine/lib/output.php
index 9479fee53..37ebbb4aa 100644
--- a/engine/lib/output.php
+++ b/engine/lib/output.php
@@ -198,6 +198,7 @@ function elgg_format_attributes(array $attrs) {
* @param array $vars The raw $vars array with all it's dirtiness (config, url, etc.)
*
* @return array The array, ready to be used in elgg_format_attributes().
+ * @access private
*/
function elgg_clean_vars(array $vars = array()) {
unset($vars['config']);
@@ -242,13 +243,32 @@ function elgg_clean_vars(array $vars = array()) {
* @return string The absolute url
*/
function elgg_normalize_url($url) {
- // 'http://example.com', 'https://example.com', '//example.com'
- // '#target', '?query=string'
- if (preg_match("#^(\#|\?|(https?:)?//)#i", $url)) {
+ // see https://bugs.php.net/bug.php?id=51192
+ // from the bookmarks save action.
+ $php_5_2_13_and_below = version_compare(PHP_VERSION, '5.2.14', '<');
+ $php_5_3_0_to_5_3_2 = version_compare(PHP_VERSION, '5.3.0', '>=') &&
+ version_compare(PHP_VERSION, '5.3.3', '<');
+
+ $validated = false;
+ if ($php_5_2_13_and_below || $php_5_3_0_to_5_3_2) {
+ $tmp_address = str_replace("-", "", $url);
+ $validated = filter_var($tmp_address, FILTER_VALIDATE_URL);
+ } else {
+ $validated = filter_var($url, FILTER_VALIDATE_URL);
+ }
+
+ if ($validated) {
+ // all normal URLs including mailto:
return $url;
+ } elseif (preg_match("#^(\#|\?|//)#i", $url)) {
+ // '//example.com' (Shortcut for protocol.)
+ // '?query=test', #target
+ return $url;
+
} elseif (stripos($url, 'javascript:') === 0) {
// 'javascript:'
+ // Not covered in FILTER_VALIDATE_URL
return $url;
} elseif (preg_match("#^[^/]*\.php(\?.*)?$#i", $url)) {
diff --git a/engine/lib/pagehandler.php b/engine/lib/pagehandler.php
index 31d73b18c..0d5e5f89b 100644
--- a/engine/lib/pagehandler.php
+++ b/engine/lib/pagehandler.php
@@ -15,6 +15,7 @@
* @param array $page The parameters to the page, as an array (exploded by '/' slashes)
*
* @return true|false Depending on whether a registered page handler was found
+ * @access private
*/
function page_handler($handler, $page) {
global $CONFIG;
@@ -127,6 +128,7 @@ function elgg_unregister_page_handler($handler) {
* @param string $handler The base handler
*
* @return true|false Depending on success
+ * @access private
*/
function default_page_handler($page, $handler) {
global $CONFIG;
diff --git a/engine/lib/pageowner.php b/engine/lib/pageowner.php
index 504d34a4e..d1010fda6 100644
--- a/engine/lib/pageowner.php
+++ b/engine/lib/pageowner.php
@@ -82,6 +82,7 @@ function elgg_set_page_owner_guid($guid) {
* @param array $params no parameters
*
* @return int GUID
+ * @access private
*/
function default_page_owner_handler($hook, $entity_type, $returnvalue, $params) {
@@ -259,6 +260,7 @@ function elgg_in_context($context) {
* @note This is on the 'boot, system' event so that the context is set up quickly.
*
* @return void
+ * @access private
*/
function page_owner_boot() {
global $CONFIG;
@@ -266,7 +268,10 @@ function page_owner_boot() {
elgg_register_plugin_hook_handler('page_owner', 'system', 'default_page_owner_handler');
$CONFIG->context = array();
- // @todo Ew... hacky
+
+ // Bootstrap the context stack by setting its first entry to the handler.
+ // This is the first segment of the URL and the handler is set by the rewrite rules.
+ // @todo this does not work for actions
$handler = get_input('handler', FALSE);
if ($handler) {
elgg_set_context($handler);
diff --git a/engine/lib/pam.php b/engine/lib/pam.php
index e335b7e52..4f9f44278 100644
--- a/engine/lib/pam.php
+++ b/engine/lib/pam.php
@@ -71,4 +71,3 @@ function unregister_pam_handler($handler, $policy = "user") {
unset($_PAM_HANDLERS[$policy][$handler]);
}
-
diff --git a/engine/lib/plugins.php b/engine/lib/plugins.php
index 365ef6fdf..a9e8b21bc 100644
--- a/engine/lib/plugins.php
+++ b/engine/lib/plugins.php
@@ -54,6 +54,8 @@ define('ELGG_PLUGIN_INTERNAL_PREFIX', 'elgg:internal:');
* @param string $dir A dir to scan for plugins. Defaults to config's plugins_path.
*
* @return array
+ * @since 1.8.0
+ * @access private
*/
function elgg_get_plugin_ids_in_dir($dir = null) {
if (!$dir) {
@@ -85,6 +87,8 @@ function elgg_get_plugin_ids_in_dir($dir = null) {
*
* @todo Crappy name?
* @return bool
+ * @since 1.8.0
+ * @access private
*/
function elgg_generate_plugin_entities() {
$site = get_config('site');
@@ -173,6 +177,7 @@ function elgg_generate_plugin_entities() {
*
* @param string $plugin_id The id (dir name) of the plugin. NOT the guid.
* @return mixed ElggPlugin or false.
+ * @since 1.8.0
*/
function elgg_get_plugin_from_id($plugin_id) {
$plugin_id = sanitize_string($plugin_id);
@@ -203,6 +208,7 @@ function elgg_get_plugin_from_id($plugin_id) {
* {@link elgg_generate_plugin_objects()} first.
*
* @param string $id The plugin ID.
+ * @since 1.8.0
* @return bool
*/
function elgg_plugin_exists($id) {
@@ -215,6 +221,8 @@ function elgg_plugin_exists($id) {
* Returns the highest priority of the plugins
*
* @return int
+ * @since 1.8.0
+ * @access private
*/
function elgg_get_max_plugin_priority() {
$db_prefix = get_config('dbprefix');
@@ -241,6 +249,7 @@ function elgg_get_max_plugin_priority() {
*
* @param string $plugin_id The plugin ID
* @param int $site_guid The site guid
+ * @since 1.8.0
* @return bool
*/
function elgg_is_active_plugin($plugin_id, $site_guid = null) {
@@ -271,6 +280,8 @@ function elgg_is_active_plugin($plugin_id, $site_guid = null) {
* that was too slow.
*
* @return bool
+ * @since 1.8.0
+ * @access private
*/
function elgg_load_plugins() {
global $CONFIG;
@@ -336,6 +347,8 @@ function elgg_load_plugins() {
* @param string $status The status of the plugins. active, inactive, or all.
* @param mixed $site_guid Optional site guid
* @return array
+ * @since 1.8.0
+ * @access private
*/
function elgg_get_plugins($status = 'active', $site_guid = null) {
$db_prefix = get_config('dbprefix');
@@ -393,6 +406,8 @@ function elgg_get_plugins($status = 'active', $site_guid = null) {
*
* @param array $order An array of plugin ids in the order to set them
* @return bool
+ * @since 1.8.0
+ * @access private
*/
function elgg_set_plugin_priorities(array $order) {
$name = elgg_namespace_plugin_private_setting('internal', 'priority');
@@ -446,6 +461,8 @@ function elgg_set_plugin_priorities(array $order) {
*
* @todo Can this be done in a single sql command?
* @return bool
+ * @since 1.8.0
+ * @access private
*/
function elgg_reindex_plugin_priorities() {
return elgg_set_plugin_priorities(array());
@@ -458,6 +475,8 @@ function elgg_reindex_plugin_priorities() {
* @param string $name The name to namespace.
* @param string $id The plugin's ID to namespace with. Required for user_setting.
* @return string
+ * @since 1.8.0
+ * @access private
*/
function elgg_namespace_plugin_private_setting($type, $name, $id = null) {
switch ($type) {
@@ -490,9 +509,9 @@ function elgg_namespace_plugin_private_setting($type, $name, $id = null) {
* context from the main script filename called by
* the browser. Default = false.
*
- * @since 1.8
- *
* @return string|false Plugin name, or false if no plugin name was called
+ * @since 1.8.0
+ * @access private
*/
function elgg_get_calling_plugin_id($mainfilename = false) {
if (!$mainfilename) {
@@ -538,7 +557,8 @@ function elgg_get_calling_plugin_id($mainfilename = false) {
* @param string $name A specific provided name to return. Requires $provide_type.
*
* @return array
- * @since 1.8
+ * @since 1.8.0
+ * @access private
*/
function elgg_get_plugins_provides($type = null, $name = null) {
static $provides = null;
@@ -594,7 +614,8 @@ function elgg_get_plugins_provides($type = null, $name = null) {
* 'status' => bool Does the provide exist?,
* 'value' => string The version provided
* )
- * @since 1.8
+ * @since 1.8.0
+ * @access private
*/
function elgg_check_plugins_provides($type, $name, $version = null, $comparison = 'ge') {
if (!$provided = elgg_get_plugins_provides($type, $name)) {
@@ -630,6 +651,8 @@ function elgg_check_plugins_provides($type, $name, $version = null, $comparison
*
* @param array $dep An ElggPluginPackage dependency array
* @return array
+ * @since 1.8.0
+ * @access private
*/
function elgg_get_plugin_dependency_strings($dep) {
$dep_system = elgg_extract('type', $dep);
@@ -739,7 +762,8 @@ function elgg_get_plugin_dependency_strings($dep) {
* Returns the ElggPlugin entity of the last plugin called.
*
* @return mixed ElggPlugin or false
- * @since 1.8
+ * @since 1.8.0
+ * @access private
*/
function elgg_get_calling_plugin_entity() {
$plugin_id = elgg_get_calling_plugin_id();
@@ -759,8 +783,7 @@ function elgg_get_calling_plugin_entity() {
* @param bool $return_obj Return settings as an object? This can be used to in reusable
* views where the settings are passed as $vars['entity'].
* @return array
- *
- * @since 1.8
+ * @since 1.8.0
*/
function elgg_get_all_plugin_user_settings($user_guid = null, $plugin_id = null, $return_obj = false) {
if ($plugin_id) {
@@ -798,6 +821,7 @@ function elgg_get_all_plugin_user_settings($user_guid = null, $plugin_id = null,
* is detected from where you are calling from.
*
* @return bool
+ * @since 1.8.0
*/
function elgg_set_plugin_user_setting($name, $value, $user_guid = null, $plugin_id = null) {
if ($plugin_id) {
@@ -820,7 +844,8 @@ function elgg_set_plugin_user_setting($name, $value, $user_guid = null, $plugin_
* @param int $user_guid Defaults to logged in user
* @param str $plugin_id Defaults to contextual plugin name
*
- * @return bool Success
+ * @return bool
+ * @since 1.8.0
*/
function elgg_unset_plugin_user_setting($name, $user_guid = null, $plugin_id = null) {
if ($plugin_id) {
@@ -845,6 +870,7 @@ function elgg_unset_plugin_user_setting($name, $user_guid = null, $plugin_id = n
* it is detected from where you are calling.
*
* @return mixed
+ * @since 1.8.0
*/
function elgg_get_plugin_user_setting($name, $user_guid = null, $plugin_id = null) {
if ($plugin_id) {
@@ -868,7 +894,8 @@ function elgg_get_plugin_user_setting($name, $user_guid = null, $plugin_id = nul
* @param string $plugin_id Optional plugin name, if not specified
* then it is detected from where you are calling from.
*
- * @return int|false
+ * @return bool
+ * @since 1.8.0
*/
function elgg_set_plugin_setting($name, $value, $plugin_id = null) {
if ($plugin_id) {
@@ -892,6 +919,7 @@ function elgg_set_plugin_setting($name, $value, $plugin_id = null) {
* then it is detected from where you are calling from.
*
* @return mixed
+ * @since 1.8.0
*/
function elgg_get_plugin_setting($name, $plugin_id = null) {
if ($plugin_id) {
@@ -915,6 +943,7 @@ function elgg_get_plugin_setting($name, $plugin_id = null) {
* then it is detected from where you are calling from.
*
* @return bool
+ * @since 1.8.0
*/
function elgg_unset_plugin_setting($name, $plugin_id = null) {
if ($plugin_id) {
@@ -937,7 +966,7 @@ function elgg_unset_plugin_setting($name, $plugin_id = null) {
* then it is detected from where you are calling from.
*
* @return bool
- * @since 1.8
+ * @since 1.8.0
*/
function elgg_unset_all_plugin_settings($plugin_id = null) {
if ($plugin_id) {
@@ -1026,7 +1055,8 @@ function elgg_get_entities_from_plugin_user_settings(array $options = array()) {
/**
* Register object, plugin entities as ElggPlugin classes
*
- * @return void
+ * @return void
+ * @access private
*/
function plugin_run_once() {
add_subtype("object", "plugin", "ElggPlugin");
@@ -1041,6 +1071,7 @@ function plugin_run_once() {
* @param mixed $params Params
*
* @return array
+ * @access private
*/
function plugins_test($hook, $type, $value, $params) {
global $CONFIG;
@@ -1053,6 +1084,7 @@ function plugins_test($hook, $type, $value, $params) {
* Listens to system boot and registers any appropriate file types and classes
*
* @return void
+ * @access private
*/
function plugin_init() {
run_function_once("plugin_run_once");
diff --git a/engine/lib/private_settings.php b/engine/lib/private_settings.php
index d7d819e1c..95b1afa57 100644
--- a/engine/lib/private_settings.php
+++ b/engine/lib/private_settings.php
@@ -95,6 +95,7 @@ function elgg_get_entities_from_private_settings(array $options = array()) {
* @param string $name_prefix A string to prefix all names with
* @return array
* @since 1.8.0
+ * @access private
*/
function elgg_get_entity_private_settings_where_sql($table, $names = NULL, $values = NULL,
$pairs = NULL, $pair_operator = 'AND', $name_prefix = '') {
@@ -334,7 +335,7 @@ function get_all_private_settings($entity_guid) {
* @param string $name The name of the setting
* @param string $value The value of the setting
*
- * @return mixed The setting ID, or false on failure
+ * @return bool
* @see get_private_setting()
* @see get_all_private_settings()
* @see remove_private_setting()
@@ -357,10 +358,8 @@ function set_private_setting($entity_guid, $name, $value) {
(entity_guid, name, value) VALUES
($entity_guid, '$name', '$value')
ON DUPLICATE KEY UPDATE value='$value'");
- if ($result === 0) {
- return true;
- }
- return $result;
+
+ return $result !== false;
}
/**
@@ -369,7 +368,7 @@ function set_private_setting($entity_guid, $name, $value) {
* @param int $entity_guid The Entity GUID
* @param string $name The name of the setting
*
- * @return true|false depending on success
+ * @return bool
* @see get_private_setting()
* @see get_all_private_settings()
* @see set_private_setting()
@@ -389,8 +388,8 @@ function remove_private_setting($entity_guid, $name) {
$name = sanitise_string($name);
return delete_data("DELETE from {$CONFIG->dbprefix}private_settings
- where name = '{$name}'
- and entity_guid = {$entity_guid}");
+ WHERE name = '{$name}'
+ AND entity_guid = {$entity_guid}");
}
/**
@@ -398,7 +397,7 @@ function remove_private_setting($entity_guid, $name) {
*
* @param int $entity_guid The Entity GUID
*
- * @return true|false depending on success
+ * @return bool
* @see get_private_setting()
* @see get_all_private_settings()
* @see set_private_setting()
@@ -416,5 +415,5 @@ function remove_all_private_settings($entity_guid) {
}
return delete_data("DELETE from {$CONFIG->dbprefix}private_settings
- where entity_guid = {$entity_guid}");
+ WHERE entity_guid = {$entity_guid}");
}
diff --git a/engine/lib/relationships.php b/engine/lib/relationships.php
index ede5ca1eb..1a5833732 100644
--- a/engine/lib/relationships.php
+++ b/engine/lib/relationships.php
@@ -13,6 +13,7 @@
* @param stdClass $row Database row from the relationship table
*
* @return stdClass or ElggMetadata
+ * @access private
*/
function row_to_elggrelationship($row) {
if (!($row instanceof stdClass)) {
@@ -310,6 +311,7 @@ function elgg_get_entities_from_relationship($options) {
*
* @return mixed
* @since 1.7.0
+ * @access private
*/
function elgg_get_entity_relationship_where_sql($column, $relationship = NULL,
$relationship_guid = NULL, $inverse_relationship = FALSE) {
@@ -472,7 +474,8 @@ function get_relationship_url($id) {
* @param int $guid_two This is the object trying to attach to $guid_one
*
* @return bool
- **/
+ * @access private
+ */
function already_attached($guid_one, $guid_two) {
if ($attached = check_entity_relationship($guid_one, "attached", $guid_two)) {
return true;
@@ -488,7 +491,8 @@ function already_attached($guid_one, $guid_two) {
* @param string $type The type of object to return e.g. 'file', 'friend_of' etc
*
* @return an array of objects
-**/
+ * @access private
+ */
function get_attachments($guid, $type = "") {
$options = array(
'relationship' => 'attached',
@@ -514,7 +518,8 @@ function get_attachments($guid, $type = "") {
* @param int $guid_two This is the object to remove from $guid_one
*
* @return void
-**/
+ * @access private
+ */
function remove_attachment($guid_one, $guid_two) {
if (already_attached($guid_one, $guid_two)) {
remove_entity_relationship($guid_one, "attached", $guid_two);
@@ -528,7 +533,8 @@ function remove_attachment($guid_one, $guid_two) {
* @param int $guid_two This is the object trying to attach to $guid_one
*
* @return true|void
-**/
+ * @access private
+ */
function make_attachment($guid_one, $guid_two) {
if (!(already_attached($guid_one, $guid_two))) {
if (add_entity_relationship($guid_one, "attached", $guid_two)) {
@@ -546,7 +552,7 @@ function make_attachment($guid_one, $guid_two) {
* @param mixed $params Array of params
*
* @return mixed
- *
+ * @access private
*/
function import_relationship_plugin_hook($hook, $entity_type, $returnvalue, $params) {
$element = $params['element'];
@@ -571,6 +577,7 @@ function import_relationship_plugin_hook($hook, $entity_type, $returnvalue, $par
*
* @elgg_event_handler export all
* @return mixed
+ * @access private
*/
function export_relationship_plugin_hook($hook, $entity_type, $returnvalue, $params) {
global $CONFIG;
@@ -605,6 +612,7 @@ function export_relationship_plugin_hook($hook, $entity_type, $returnvalue, $par
* @param mixed $object Object
*
* @return bool
+ * @access private
*/
function relationship_notification_hook($event, $type, $object) {
diff --git a/engine/lib/river.php b/engine/lib/river.php
index e283c0595..f430eb224 100644
--- a/engine/lib/river.php
+++ b/engine/lib/river.php
@@ -586,6 +586,7 @@ function update_river_access_by_object($object_guid, $access_id) {
* Page handler for activiy
*
* @param array $page
+ * @access private
*/
function elgg_river_page_handler($page) {
global $CONFIG;
@@ -609,6 +610,7 @@ function elgg_river_page_handler($page) {
/**
* Initialize river library
+ * @access private
*/
function elgg_river_init() {
elgg_register_page_handler('activity', 'elgg_river_page_handler');
diff --git a/engine/lib/sessions.php b/engine/lib/sessions.php
index ae42956a9..97a05e2e8 100644
--- a/engine/lib/sessions.php
+++ b/engine/lib/sessions.php
@@ -133,6 +133,7 @@ function elgg_is_admin_user($user_guid) {
* @param string $password The password
*
* @return true|string True or an error message on failure
+ * @access private
*/
function elgg_authenticate($username, $password) {
$pam = new ElggPAM('user');
@@ -154,6 +155,7 @@ function elgg_authenticate($username, $password) {
*
* @return bool
* @throws LoginException
+ * @access private
*/
function pam_auth_userpass(array $credentials = array()) {
@@ -183,7 +185,7 @@ function pam_auth_userpass(array $credentials = array()) {
*
* @param int $user_guid User GUID
*
- * @return bool on success
+ * @return bool
*/
function log_login_failure($user_guid) {
$user_guid = (int)$user_guid;
@@ -375,6 +377,7 @@ function logout() {
* @param mixed $object Object
*
* @return bool
+ * @access private
*/
function session_init($event, $object_type, $object) {
global $DB_PREFIX, $CONFIG;
@@ -499,6 +502,7 @@ function admin_gatekeeper() {
*
* @return true
* @todo Document
+ * @access private
*/
function _elgg_session_open($save_path, $session_name) {
global $sess_save_path;
@@ -514,6 +518,7 @@ function _elgg_session_open($save_path, $session_name) {
* @todo document
*
* @return true
+ * @access private
*/
function _elgg_session_close() {
return true;
@@ -525,6 +530,7 @@ function _elgg_session_close() {
* @param string $id The session ID
*
* @return string
+ * @access private
*/
function _elgg_session_read($id) {
global $DB_PREFIX;
@@ -558,6 +564,7 @@ function _elgg_session_read($id) {
* @param mixed $sess_data Session data
*
* @return bool
+ * @access private
*/
function _elgg_session_write($id, $sess_data) {
global $DB_PREFIX;
@@ -597,6 +604,7 @@ function _elgg_session_write($id, $sess_data) {
* @param string $id Session ID
*
* @return bool
+ * @access private
*/
function _elgg_session_destroy($id) {
global $DB_PREFIX;
@@ -623,6 +631,7 @@ function _elgg_session_destroy($id) {
* @param int $maxlifetime Max age of a session
*
* @return bool
+ * @access private
*/
function _elgg_session_gc($maxlifetime) {
global $DB_PREFIX;
diff --git a/engine/lib/sites.php b/engine/lib/sites.php
index 5fed29822..337b2d180 100644
--- a/engine/lib/sites.php
+++ b/engine/lib/sites.php
@@ -31,6 +31,7 @@ function elgg_get_site_entity($site_guid = 0) {
* @param int $guid The site GUID
*
* @return mixed
+ * @access private
*/
function get_site_entity_as_row($guid) {
global $CONFIG;
@@ -204,7 +205,7 @@ function get_site_by_url($url) {
$row = get_data_row("SELECT * from {$CONFIG->dbprefix}sites_entity where url='$url'");
if ($row) {
- return new ElggSite($row);
+ return get_entity($row->guid);
}
return false;
@@ -243,6 +244,7 @@ function get_site_domain($guid) {
* @param null $object Event API required parameter
*
* @return true
+ * @access private
*/
function sites_boot($event, $object_type, $object) {
global $CONFIG;
@@ -274,6 +276,7 @@ elgg_register_plugin_hook_handler('unit_test', 'system', 'sites_test');
* @param mixed $params Params
*
* @return array
+ * @access private
*/
function sites_test($hook, $type, $value, $params) {
global $CONFIG;
diff --git a/engine/lib/statistics.php b/engine/lib/statistics.php
index 1232c6128..7c170f3bb 100644
--- a/engine/lib/statistics.php
+++ b/engine/lib/statistics.php
@@ -112,6 +112,7 @@ function get_online_users() {
* Initialise the statistics admin page.
*
* @return void
+ * @access private
*/
function statistics_init() {
elgg_extend_view('core/settings/statistics', 'core/settings/statistics/online');
diff --git a/engine/lib/system_log.php b/engine/lib/system_log.php
index d6c746af1..fd5644135 100644
--- a/engine/lib/system_log.php
+++ b/engine/lib/system_log.php
@@ -270,6 +270,7 @@ function system_log_default_logger($event, $object_type, $object) {
* @param Loggable $object Object to log
*
* @return true
+ * @access private
*/
function system_log_listener($event, $object_type, $object) {
if (($object_type != 'systemlog') && ($event != 'log')) {
diff --git a/engine/lib/tags.php b/engine/lib/tags.php
index 64feed5b2..6275d653c 100644
--- a/engine/lib/tags.php
+++ b/engine/lib/tags.php
@@ -17,6 +17,7 @@
* @param int $buckets The number of buckets
*
* @return int
+ * @access private
*/
function calculate_tag_size($min, $max, $number_of_tags, $buckets = 6) {
$delta = (($max - $min) / $buckets);
@@ -48,6 +49,7 @@ function calculate_tag_size($min, $max, $number_of_tags, $buckets = 6) {
* @param int $buckets The number of buckets
*
* @return An associated array of tags with a weighting, this can then be mapped to a display class.
+ * @access private
*/
function generate_tag_cloud(array $tags, $buckets = 6) {
$cloud = array();
@@ -320,6 +322,7 @@ function elgg_get_registered_tag_metadata_names() {
* @param array $page Page array
*
* @return void
+ * @access private
*/
function elgg_tagcloud_page_handler($page) {
switch ($page[0]) {
@@ -339,6 +342,9 @@ function elgg_tagcloud_page_handler($page) {
}
}
+/**
+ * @access private
+ */
function elgg_tags_init() {
// register the standard tags metadata name
elgg_register_tag_metadata_name('tags');
diff --git a/engine/lib/upgrade.php b/engine/lib/upgrade.php
index dc1213187..f0874a483 100644
--- a/engine/lib/upgrade.php
+++ b/engine/lib/upgrade.php
@@ -14,6 +14,7 @@
* @param bool $quiet Suppress errors. Don't use this.
*
* @return bool
+ * @access private
*/
function upgrade_code($version, $quiet = FALSE) {
global $CONFIG;
@@ -89,6 +90,7 @@ function upgrade_code($version, $quiet = FALSE) {
* @param array $processed_upgrades An array of processed upgrade filenames
* (not the path, just the file)
* @return bool
+ * @access private
*/
function elgg_set_processed_upgrades(array $processed_upgrades) {
$processed_upgrades = array_unique($processed_upgrades);
@@ -99,6 +101,7 @@ function elgg_set_processed_upgrades(array $processed_upgrades) {
* Gets a list of processes upgrades
*
* @return mixed Array of processed upgrade filenames or false
+ * @access private
*/
function elgg_get_processed_upgrades() {
$upgrades = datalist_get('processed_upgrades');
@@ -111,7 +114,8 @@ function elgg_get_processed_upgrades() {
*
* @param string $filename The upgrade filename. No full path.
* @return int|false
- * @since 1.8
+ * @since 1.8.0
+ * @access private
*/
function elgg_get_upgrade_file_version($filename) {
preg_match('/^([0-9]{10})([\.a-z0-9-_]+)?\.(php)$/i', $filename, $matches);
@@ -128,6 +132,7 @@ function elgg_get_upgrade_file_version($filename) {
*
* @param string $upgrade_path The up
* @return array|false
+ * @access private
*/
function elgg_get_upgrade_files($upgrade_path = null) {
if (!$upgrade_path) {
@@ -189,7 +194,8 @@ function get_version($humanreadable = false) {
* @param null|array $upgrade_files Optional upgrade files
* @param null|array $processed_upgrades Optional processed upgrades
*
- * @return array()
+ * @return array
+ * @access private
*/
function elgg_get_unprocessed_upgrades($upgrade_files = null, $processed_upgrades = null) {
if ($upgrade_files === null) {
@@ -210,7 +216,8 @@ function elgg_get_unprocessed_upgrades($upgrade_files = null, $processed_upgrade
/**
* Determines whether or not the database needs to be upgraded.
*
- * @return true|false Depending on whether or not the db version matches the code version
+ * @return bool Depending on whether or not the db version matches the code version
+ * @access private
*/
function version_upgrade_check() {
$dbversion = (int) datalist_get('version');
@@ -227,7 +234,7 @@ function version_upgrade_check() {
* Upgrades Elgg Database and code
*
* @return bool
- *
+ * @access private
*/
function version_upgrade() {
// It's possible large upgrades could exceed the max execution time.
@@ -269,6 +276,7 @@ function version_upgrade() {
* 1.8 upgrades, regardless of filename convention.
*
* @return bool
+ * @access private
*/
function elgg_upgrade_bootstrap_17_to_18() {
$db_version = (int) datalist_get('version');
diff --git a/engine/lib/user_settings.php b/engine/lib/user_settings.php
index 29415f6ba..bb5d8d6c4 100644
--- a/engine/lib/user_settings.php
+++ b/engine/lib/user_settings.php
@@ -15,6 +15,7 @@
* @note This is a handler for the 'usersettings:save', 'user' plugin hook
*
* @return void
+ * @access private
*/
function users_settings_save() {
elgg_set_user_language();
@@ -29,20 +30,21 @@ function users_settings_save() {
*
* @return bool
* @since 1.8.0
+ * @access private
*/
function elgg_set_user_password() {
$current_password = get_input('current_password');
$password = get_input('password');
$password2 = get_input('password2');
- $user_id = get_input('guid');
+ $user_guid = get_input('guid');
- if (!$user_id) {
+ if (!$user_guid) {
$user = elgg_get_logged_in_user_entity();
} else {
- $user = get_entity($user_id);
+ $user = get_entity($user_guid);
}
- if (($user) && ($password != "")) {
+ if ($user && $password) {
// let admin user change anyone's password without knowing it except his own.
if (!elgg_is_admin_logged_in() || elgg_is_admin_logged_in() && $user->guid == elgg_get_logged_in_user_guid()) {
$credentials = array(
@@ -50,13 +52,22 @@ function elgg_set_user_password() {
'password' => $current_password
);
- if (!pam_auth_userpass($credentials)) {
- register_error(elgg_echo('user:password:fail:incorrect_current_password'));
+ try {
+ pam_auth_userpass($credentials);
+ } catch (LoginException $e) {
+ register_error(elgg_echo('LoginException:ChangePasswordFailure'));
return false;
}
}
- if (strlen($password) >= 4) {
+ try {
+ $result = validate_password($password);
+ } catch (RegistrationException $e) {
+ register_error($e->getMessage());
+ return false;
+ }
+
+ if ($result) {
if ($password == $password2) {
$user->salt = generate_random_cleartext_password(); // Reset the salt
$user->password = generate_user_password($user, $password);
@@ -76,6 +87,7 @@ function elgg_set_user_password() {
// no change
return null;
}
+
return false;
}
@@ -84,6 +96,7 @@ function elgg_set_user_password() {
*
* @return bool
* @since 1.8.0
+ * @access private
*/
function elgg_set_user_name() {
$name = strip_tags(get_input('name'));
@@ -124,6 +137,7 @@ function elgg_set_user_name() {
*
* @return bool
* @since 1.8.0
+ * @access private
*/
function elgg_set_user_language() {
$language = get_input('language');
@@ -159,6 +173,7 @@ function elgg_set_user_language() {
*
* @return bool
* @since 1.8.0
+ * @access private
*/
function elgg_set_user_email() {
$email = get_input('email');
@@ -206,6 +221,7 @@ function elgg_set_user_email() {
*
* @return bool
* @since 1.8.0
+ * @access private
*/
function elgg_set_user_default_access() {
@@ -246,6 +262,7 @@ function elgg_set_user_default_access() {
* Set up the menu for user settings
*
* @return void
+ * @access private
*/
function usersettings_pagesetup() {
if (elgg_get_context() == "settings" && elgg_get_logged_in_user_guid()) {
@@ -278,6 +295,7 @@ function usersettings_pagesetup() {
* @param array $page Pages array
*
* @return void
+ * @access private
*/
function usersettings_page_handler($page) {
global $CONFIG;
@@ -318,6 +336,7 @@ function usersettings_page_handler($page) {
* Initialize the user settings library
*
* @return void
+ * @access private
*/
function usersettings_init() {
elgg_register_page_handler('settings', 'usersettings_page_handler');
@@ -327,6 +346,5 @@ function usersettings_init() {
elgg_register_action("usersettings/save");
}
-/// Register init function
elgg_register_event_handler('init', 'system', 'usersettings_init');
elgg_register_event_handler('pagesetup', 'system', 'usersettings_pagesetup');
diff --git a/engine/lib/users.php b/engine/lib/users.php
index ce1b409f6..55ebddd3a 100644
--- a/engine/lib/users.php
+++ b/engine/lib/users.php
@@ -21,6 +21,7 @@ $CODE_TO_GUID_MAP_CACHE = array();
* @param int $guid The ElggUser guid
*
* @return mixed
+ * @access private
*/
function get_user_entity_as_row($guid) {
global $CONFIG;
@@ -1027,6 +1028,7 @@ function elgg_get_user_validation_status($user_guid) {
* Adds collection submenu items
*
* @return void
+ * @access private
*/
function collections_submenu_items() {
@@ -1045,6 +1047,7 @@ function collections_submenu_items() {
* @param array $page_elements Page elements
*
* @return void
+ * @access private
*/
function friends_page_handler($page_elements) {
if (isset($page_elements[0]) && $user = get_user_by_username($page_elements[0])) {
@@ -1062,6 +1065,7 @@ function friends_page_handler($page_elements) {
* @param array $page_elements Page elements
*
* @return void
+ * @access private
*/
function friends_of_page_handler($page_elements) {
elgg_set_context('friends');
@@ -1080,6 +1084,7 @@ function friends_of_page_handler($page_elements) {
* @param array $page_elements Page elements
*
* @return void
+ * @access private
*/
function collections_page_handler($page_elements) {
elgg_set_context('friends');
@@ -1109,6 +1114,7 @@ function collections_page_handler($page_elements) {
* @param string $handler The handler string
*
* @return void
+ * @access private
*/
function elgg_user_account_page_handler($page_elements, $handler) {
@@ -1134,6 +1140,7 @@ function elgg_user_account_page_handler($page_elements, $handler) {
*
* @return void
* @todo finish
+ * @access private
*/
function elgg_user_login_page_handler() {
$login_box = elgg_view('core/account/login_box');
@@ -1165,7 +1172,7 @@ function set_last_action($user_guid) {
*
* @param int $user_guid The user GUID
*
- * @return boid
+ * @return void
*/
function set_last_login($user_guid) {
$user_guid = (int) $user_guid;
@@ -1186,6 +1193,7 @@ function set_last_login($user_guid) {
* @param ElggUser $object User object
*
* @return bool
+ * @access private
*/
function user_create_hook_add_site_relationship($event, $object_type, $object) {
global $CONFIG;
@@ -1201,6 +1209,7 @@ function user_create_hook_add_site_relationship($event, $object_type, $object) {
* @param string $returnvalue
* @param array $params
* @return string
+ * @access private
*/
function user_avatar_hook($hook, $entity_type, $returnvalue, $params) {
$user = $params['entity'];
@@ -1215,6 +1224,7 @@ function user_avatar_hook($hook, $entity_type, $returnvalue, $params) {
/**
* Setup the default user hover menu
+ * @access private
*/
function elgg_user_hover_menu($hook, $type, $return, $params) {
$user = $params['entity'];
@@ -1286,6 +1296,12 @@ function elgg_user_hover_menu($hook, $type, $return, $params) {
return $return;
}
+/**
+ * Setup the menu shown with an entity
+ *
+ * @return array
+ * @access private
+ */
function elgg_users_setup_entity_menu($hook, $type, $return, $params) {
if (elgg_in_context('widgets')) {
return $return;
@@ -1327,6 +1343,7 @@ function elgg_users_setup_entity_menu($hook, $type, $return, $params) {
*
* Note: This is a secondary system:init call and is run at a super low priority to guarantee that it is called after all
* other plugins have initialised.
+ * @access private
*/
function elgg_profile_fields_setup() {
global $CONFIG;
@@ -1383,6 +1400,7 @@ function elgg_profile_fields_setup() {
* /avatar/view/<username>/<size>/<icontime>
*
* @param array $page
+ * @access private
*/
function elgg_avatar_page_handler($page) {
global $CONFIG;
@@ -1404,6 +1422,7 @@ function elgg_avatar_page_handler($page) {
* Profile page handler
*
* @param array $page
+ * @access private
*/
function elgg_profile_page_handler($page) {
global $CONFIG;
@@ -1420,6 +1439,7 @@ function elgg_profile_page_handler($page) {
* Sets up user-related menu items
*
* @return void
+ * @access private
*/
function users_pagesetup() {
@@ -1503,6 +1523,7 @@ function users_pagesetup() {
* Users initialisation function, which establishes the page handler
*
* @return void
+ * @access private
*/
function users_init() {
@@ -1561,6 +1582,7 @@ function users_init() {
* @param mixed $params Params
*
* @return array
+ * @access private
*/
function users_test($hook, $type, $value, $params) {
global $CONFIG;
diff --git a/engine/lib/views.php b/engine/lib/views.php
index a18118f32..89ed98bdc 100644
--- a/engine/lib/views.php
+++ b/engine/lib/views.php
@@ -140,6 +140,7 @@ function elgg_register_viewtype($view_type) {
*
* @return bool
* @since 1.7.2
+ * @access private
*/
function elgg_is_valid_view_type($view_type) {
global $CONFIG;
@@ -1328,6 +1329,26 @@ function elgg_view_icon($name, $class = '') {
}
/**
+ * Displays a user's access collections, using the core/friends/collections view
+ *
+ * @param int $owner_guid The GUID of the owning user
+ *
+ * @return string A formatted rendition of the collections
+ * @todo Move to the friends/collection.php page.
+ * @access private
+ */
+function elgg_view_access_collections($owner_guid) {
+ if ($collections = get_user_access_collections($owner_guid)) {
+ foreach ($collections as $key => $collection) {
+ $collections[$key]->members = get_members_of_access_collection($collection->id, true);
+ $collections[$key]->entities = get_user_friends($owner_guid, "", 9999);
+ }
+ }
+
+ return elgg_view('core/friends/collections', array('collections' => $collections));
+}
+
+/**
* Registers a function to handle templates.
*
* Alternative template handlers can be registered to handle
@@ -1369,6 +1390,7 @@ function set_template_handler($function_name) {
* @since 1.7.0
* @todo Why isn't this used anywhere else but in elgg_view_tree()?
* Seems like a useful function for autodiscovery.
+ * @access private
*/
function elgg_get_views($dir, $base) {
$return = array();
@@ -1404,6 +1426,7 @@ function elgg_get_views($dir, $base) {
*
* @return array A list of view names underneath that root view
* @todo This is used once in the deprecated get_activity_stream_data() function.
+ * @access private
*/
function elgg_view_tree($view_root, $viewtype = "") {
global $CONFIG;
@@ -1465,6 +1488,7 @@ function elgg_view_tree($view_root, $viewtype = "") {
* @since 1.7.0
* @see elgg_set_view_location()
* @todo This seems overly complicated.
+ * @access private
*/
function autoregister_views($view_base, $folder, $base_location_path, $viewtype) {
if (!isset($i)) {
@@ -1506,6 +1530,7 @@ function autoregister_views($view_base, $folder, $base_location_path, $viewtype)
* Add the rss link to the extras when if needed
*
* @return void
+ * @access private
*/
function elgg_views_add_rss_link() {
global $autofeed;
@@ -1531,7 +1556,7 @@ function elgg_views_add_rss_link() {
* Registers deprecated views to avoid making some pages from older plugins
* completely empty.
*
- * @private
+ * @access private
*/
function elgg_views_handle_deprecated_views() {
$location = elgg_get_view_location('page_elements/contentwrapper');
diff --git a/engine/lib/web_services.php b/engine/lib/web_services.php
index 8e312209b..1c77b757e 100644
--- a/engine/lib/web_services.php
+++ b/engine/lib/web_services.php
@@ -154,6 +154,7 @@ function unexpose_function($method) {
* @return true or throws an exception
* @throws APIException
* @since 1.7.0
+ * @access private
*/
function authenticate_method($method) {
global $API_METHODS;
@@ -192,6 +193,7 @@ function authenticate_method($method) {
*
* @return GenericResult The result of the execution.
* @throws APIException, CallException
+ * @access private
*/
function execute_method($method) {
global $API_METHODS, $CONFIG;
@@ -257,6 +259,7 @@ function execute_method($method) {
* Get the request method.
*
* @return string HTTP request method
+ * @access private
*/
function get_call_method() {
return $_SERVER['REQUEST_METHOD'];
@@ -271,6 +274,7 @@ function get_call_method() {
* @param string $method The method
*
* @return array containing parameters as key => value
+ * @access private
*/
function get_parameters_for_method($method) {
global $API_METHODS;
@@ -300,6 +304,7 @@ function get_parameters_for_method($method) {
* Since this is called through a handler, we need to manually get the post data
*
* @return POST data as string encoded as multipart/form-data
+ * @access private
*/
function get_post_data() {
@@ -317,6 +322,7 @@ function get_post_data() {
* @return true on success or exception
* @throws APIException
* @since 1.7.0
+ * @access private
*/
function verify_parameters($method, $parameters) {
global $API_METHODS;
@@ -354,6 +360,7 @@ function verify_parameters($method, $parameters) {
* @return string or exception
* @throws APIException
* @since 1.7.0
+ * @access private
*/
function serialise_parameters($method, $parameters) {
global $API_METHODS;
@@ -438,6 +445,7 @@ function serialise_parameters($method, $parameters) {
* @return mixed
* @throws APIException
* @since 1.7.0
+ * @access private
*/
function api_auth_key() {
global $CONFIG;
@@ -468,6 +476,7 @@ function api_auth_key() {
*
* @throws SecurityException
* @since 1.7.0
+ * @access private
*/
function api_auth_hmac() {
global $CONFIG;
@@ -532,6 +541,7 @@ function api_auth_hmac() {
*
* @return stdClass Containing all the values.
* @throws APIException Detailing any error.
+ * @access private
*/
function get_and_validate_api_headers() {
$result = new stdClass;
@@ -604,6 +614,7 @@ function get_and_validate_api_headers() {
*
* @return string The php algorithm
* @throws APIException if an algorithm is not supported.
+ * @access private
*/
function map_api_hash($algo) {
$algo = strtolower(sanitise_string($algo));
@@ -636,6 +647,7 @@ function map_api_hash($algo) {
* @param string $post_hash Optional sha1 hash of the post data.
*
* @return string The HMAC signature
+ * @access private
*/
function calculate_hmac($algo, $time, $nonce, $api_key, $secret_key,
$get_variables, $post_hash = "") {
@@ -666,6 +678,7 @@ $get_variables, $post_hash = "") {
* @param string $algo The algorithm used.
*
* @return string The hash.
+ * @access private
*/
function calculate_posthash($postdata, $algo) {
$ctx = hash_init(map_api_hash($algo));
@@ -682,6 +695,7 @@ function calculate_posthash($postdata, $algo) {
* @param string $hmac The hmac string.
*
* @return bool True if replay detected, false if not.
+ * @access private
*/
function cache_hmac_check_replay($hmac) {
// cache lifetime is 25 hours (this should be related to the time drift
@@ -779,6 +793,7 @@ function remove_api_user($site_guid, $api_key) {
* session code of Elgg, that user will be logged out of all other sessions.
*
* @return bool
+ * @access private
*/
function pam_auth_usertoken() {
global $CONFIG;
@@ -823,6 +838,7 @@ function pam_auth_usertoken() {
* See if the user has a valid login sesson
*
* @return bool
+ * @access private
*/
function pam_auth_session() {
return elgg_is_logged_in();
@@ -968,6 +984,7 @@ function remove_expired_user_tokens() {
* @param array $headers The array of headers "key" => "value"
*
* @return string
+ * @access private
*/
function serialise_api_headers(array $headers) {
$headers_str = "";
@@ -1123,6 +1140,7 @@ function get_standard_api_key_array($secret_key, $api_key) {
* Simple api to return a list of all api's installed on the system.
*
* @return array
+ * @access private
*/
function list_all_apis() {
global $API_METHODS;
@@ -1144,6 +1162,7 @@ function list_all_apis() {
*
* @return string Token string or exception
* @throws SecurityException
+ * @access private
*/
function auth_gettoken($username, $password) {
if (authenticate($username, $password)) {
@@ -1174,6 +1193,7 @@ $ERRORS = array();
* @param array $vars Vars
*
* @return void
+ * @access private
*/
function _php_api_error_handler($errno, $errmsg, $filename, $linenum, $vars) {
global $ERRORS;
@@ -1211,6 +1231,7 @@ function _php_api_error_handler($errno, $errmsg, $filename, $linenum, $vars) {
* @param Exception $exception Exception
*
* @return void
+ * @access private
*/
function _php_api_exception_handler($exception) {
@@ -1233,6 +1254,7 @@ function _php_api_exception_handler($exception) {
* @param array $request Request string
*
* @return void
+ * @access private
*/
function service_handler($handler, $request) {
global $CONFIG;
@@ -1310,6 +1332,7 @@ function unregister_service_handler($handler) {
* REST API handler
*
* @return void
+ * @access private
*/
function rest_handler() {
global $CONFIG;
@@ -1370,6 +1393,7 @@ function rest_handler() {
* @param mixed $params Params
*
* @return array
+ * @access private
*/
function api_unit_test($hook, $type, $value, $params) {
global $CONFIG;
@@ -1381,6 +1405,7 @@ function api_unit_test($hook, $type, $value, $params) {
* Initialise the API subsystem.
*
* @return void
+ * @access private
*/
function api_init() {
// Register a page handler, so we can have nice URLs
diff --git a/engine/lib/widgets.php b/engine/lib/widgets.php
index cc3cf20e4..5d18a16b0 100644
--- a/engine/lib/widgets.php
+++ b/engine/lib/widgets.php
@@ -257,6 +257,7 @@ function elgg_get_widget_types($context = "", $exact = false) {
* Regsiter entity of object, widget as ElggWidget objects
*
* @return void
+ * @access private
*/
function elgg_widget_run_once() {
add_subtype("object", "widget", "ElggWidget");
@@ -266,6 +267,7 @@ function elgg_widget_run_once() {
* Function to initialize widgets functionality
*
* @return void
+ * @access private
*/
function elgg_widgets_init() {
elgg_register_action('widgets/save');
@@ -281,7 +283,26 @@ function elgg_widgets_init() {
* Gets a list of events to create default widgets for and
* register menu items for default widgets with the admin section.
*
+ * A plugin that wants to register a new context for default widgets should
+ * register for the plugin hook 'get_list', 'default_widgets'. The handler
+ * can register the new type of default widgets by adding an associate array to
+ * the return value array like this:
+ * array(
+ * 'name' => elgg_echo('profile'),
+ * 'widget_context' => 'profile',
+ * 'widget_columns' => 3,
+ *
+ * 'event' => 'create',
+ * 'entity_type' => 'user',
+ * 'entity_subtype' => ELGG_ENTITIES_ANY_VALUE,
+ * );
+ *
+ * The first set of keys define information about the new type of default
+ * widgets and the second set determine what event triggers the creation of the
+ * new widgets.
+ *
* @return void
+ * @access private
*/
function elgg_default_widgets_init() {
global $CONFIG;
@@ -296,35 +317,42 @@ function elgg_default_widgets_init() {
elgg_register_plugin_hook_handler('container_permissions_check', 'object', 'elgg_default_widgets_permissions_override');
foreach ($default_widgets as $info) {
- elgg_register_event_handler($info['event'], $info['entity_type'], 'elgg_default_widgets_hook');
+ elgg_register_event_handler($info['event'], $info['entity_type'], 'elgg_create_default_widgets');
}
}
}
/**
- * Checks for plugins who have registered default widgets and
- * hooks into events to save.
+ * Creates default widgets
+ *
+ * This plugin hook handler is registered for events based on what kinds of
+ * default widgets have been registered. See elgg_default_widgets_init() for
+ * information on registering new default widget contexts.
*
* @param string $event The event
* @param string $type The type of object
- * @param object $object The object
+ * @param object $entity The entity being created
* @return null
+ * @access private
*/
-function elgg_default_widgets_hook($event, $type, $object) {
+function elgg_create_default_widgets($event, $type, $entity) {
$default_widget_info = elgg_get_config('default_widget_info');
- if (!$default_widget_info) {
+ if (!$default_widget_info || !$entity) {
return null;
}
- $subtype = $object->getSubtype();
+ $type = $entity->getType();
+ $subtype = $entity->getSubtype();
// event is already guaranteed by the hook registration.
// need to check subtype and type.
foreach ($default_widget_info as $temp) {
- if ($temp['entity_type'] == $type && $temp['entity_subtype'] == $subtype) {
- $info = $temp;
- break;
+ if ($temp['entity_type'] == $type) {
+ if ($temp['entity_subtype'] == ELGG_ENTITIES_ANY_VALUE || $temp['entity_subtype'] == $subtype) {
+ $info = $temp;
+ break;
+ }
}
}
@@ -339,7 +367,7 @@ function elgg_default_widgets_hook($event, $type, $object) {
'subtype' => 'widget',
'owner_guid' => elgg_get_site_entity()->guid,
'private_setting_name' => 'context',
- 'private_setting_value' => $info['context'],
+ 'private_setting_value' => $info['widget_context'],
'limit' => 0
);
@@ -348,8 +376,8 @@ function elgg_default_widgets_hook($event, $type, $object) {
foreach ($widgets as $widget) {
// change the container and owner
$new_widget = clone $widget;
- $new_widget->container_guid = $object->guid;
- $new_widget->owner_guid = $object->guid;
+ $new_widget->container_guid = $entity->guid;
+ $new_widget->owner_guid = $entity->guid;
// pull in settings
$settings = get_all_private_settings($widget->guid);
@@ -376,6 +404,7 @@ function elgg_default_widgets_hook($event, $type, $object) {
* @param string $return Value
* @param mixed $params Params
* @return true|null
+ * @access private
*/
function elgg_default_widgets_permissions_override($hook, $type, $return, $params) {
if ($type == 'object' && $params['subtype'] == 'widget') {
@@ -387,4 +416,4 @@ function elgg_default_widgets_permissions_override($hook, $type, $return, $param
elgg_register_event_handler('init', 'system', 'elgg_widgets_init');
// register default widget hooks from plugins
-elgg_register_event_handler('ready', 'system', 'elgg_default_widgets_init'); \ No newline at end of file
+elgg_register_event_handler('ready', 'system', 'elgg_default_widgets_init');
diff --git a/engine/lib/xml-rpc.php b/engine/lib/xml-rpc.php
index b63d626df..bfe1a8645 100644
--- a/engine/lib/xml-rpc.php
+++ b/engine/lib/xml-rpc.php
@@ -15,6 +15,7 @@
* @param array $parameters An array of params
*
* @return array
+ * @access private
*/
function xmlrpc_parse_params($parameters) {
$result = array();
@@ -32,6 +33,7 @@ function xmlrpc_parse_params($parameters) {
* @param XMLObject $object And object
*
* @return mixed
+ * @access private
*/
function xmlrpc_scalar_value($object) {
if ($object->name == 'param') {
@@ -110,6 +112,7 @@ function register_xmlrpc_handler($method, $handler) {
* @param XMLRPCCall $parameters The call and parameters.
*
* @return XMLRPCCall
+ * @access private
*/
function trigger_xmlrpc_handler(XMLRPCCall $parameters) {
global $XML_RPC_HANDLERS;
@@ -148,6 +151,7 @@ function trigger_xmlrpc_handler(XMLRPCCall $parameters) {
* @param array $vars Vars
*
* @return void
+ * @access private
*/
function _php_xmlrpc_error_handler($errno, $errmsg, $filename, $linenum, $vars) {
$error = date("Y-m-d H:i:s (T)") . ": \"" . $errmsg . "\" in file "
@@ -177,6 +181,7 @@ function _php_xmlrpc_error_handler($errno, $errmsg, $filename, $linenum, $vars)
* @param Exception $exception The exception
*
* @return void
+ * @access private
*/
function _php_xmlrpc_exception_handler($exception) {
diff --git a/engine/tests/api/access_collections.php b/engine/tests/api/access_collections.php
index 1e61c45bb..0c37fa779 100644
--- a/engine/tests/api/access_collections.php
+++ b/engine/tests/api/access_collections.php
@@ -194,7 +194,7 @@ class ElggCoreAccessCollectionsTest extends ElggCoreUnitTest {
return $value;
}
- register_plugin_hook('access:collections:write', 'all', 'test_acl_access_hook');
+ elgg_register_plugin_hook_handler('access:collections:write', 'all', 'test_acl_access_hook');
// enable security since we usually run as admin
$ia = elgg_set_ignore_access(false);
@@ -202,14 +202,16 @@ class ElggCoreAccessCollectionsTest extends ElggCoreUnitTest {
$this->assertTrue($result);
$ia = elgg_set_ignore_access($ia);
- unregister_plugin_hook('access:collections:write', 'all', 'test_acl_access_hook');
+ elgg_unregister_plugin_hook_handler('access:collections:write', 'all', 'test_acl_access_hook');
+
+ delete_access_collection($acl_id);
}
// groups interface
// only runs if the groups plugin is enabled because implementation is split between
// core and the plugin.
public function testCreateDeleteGroupACL() {
- if (!is_plugin_enabled('groups')) {
+ if (!elgg_is_active_plugin('groups')) {
return;
}
@@ -231,7 +233,7 @@ class ElggCoreAccessCollectionsTest extends ElggCoreUnitTest {
}
public function testJoinLeaveGroupACL() {
- if (!is_plugin_enabled('groups')) {
+ if (!elgg_is_active_plugin('groups')) {
return;
}
diff --git a/engine/tests/api/entity_getter_functions.php b/engine/tests/api/entity_getter_functions.php
index 59b48999c..e7906d3c8 100644
--- a/engine/tests/api/entity_getter_functions.php
+++ b/engine/tests/api/entity_getter_functions.php
@@ -855,7 +855,7 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest {
public function testElggApiGettersEntityNoSubtype() {
// create an entity we can later delete.
- // order by time created and limit by 1 should == this entity.
+ // order by guid and limit by 1 should == this entity.
$e = new ElggObject();
$e->save();
diff --git a/engine/tests/api/helpers.php b/engine/tests/api/helpers.php
index 36d680d54..f48f91faf 100644
--- a/engine/tests/api/helpers.php
+++ b/engine/tests/api/helpers.php
@@ -63,6 +63,8 @@ class ElggCoreHelpersTest extends ElggCoreUnitTest {
$this->assertFalse(elgg_instanceof($bad_entity));
$this->assertFalse(elgg_instanceof($bad_entity, 'object'));
$this->assertFalse(elgg_instanceof($bad_entity, 'object', 'test_subtype'));
+
+ remove_subtype('object', 'test_subtype');
}
/**
@@ -72,7 +74,13 @@ class ElggCoreHelpersTest extends ElggCoreUnitTest {
$conversions = array(
'http://example.com' => 'http://example.com',
'https://example.com' => 'https://example.com',
+ 'http://example-time.com' => 'http://example-time.com',
+
'//example.com' => '//example.com',
+ 'ftp://example.com/file' => 'ftp://example.com/file',
+ 'mailto:brett@elgg.org' => 'mailto:brett@elgg.org',
+ 'javascript:alert("test")' => 'javascript:alert("test")',
+ 'app://endpoint' => 'app://endpoint',
'example.com' => 'http://example.com',
'example.com/subpage' => 'http://example.com/subpage',
@@ -166,7 +174,9 @@ class ElggCoreHelpersTest extends ElggCoreUnitTest {
$this->assertFalse(isset($CONFIG->externals_map['js']['id1']));
foreach ($elements as $element) {
- $this->assertFalse($element->name == 'id1');
+ if (isset($element->name)) {
+ $this->assertFalse($element->name == 'id1');
+ }
}
$result = elgg_unregister_js('id1');
@@ -180,7 +190,9 @@ class ElggCoreHelpersTest extends ElggCoreUnitTest {
$this->assertFalse(isset($CONFIG->externals_map['js']['id2']));
foreach ($elements as $element) {
- $this->assertFalse($element->name == 'id2');
+ if (isset($element->name)) {
+ $this->assertFalse($element->name == 'id2');
+ }
}
$this->assertTrue(isset($CONFIG->externals_map['js']['id3']));
diff --git a/engine/tests/api/metadata.php b/engine/tests/api/metadata.php
index d9113b68a..7897b8d47 100644
--- a/engine/tests/api/metadata.php
+++ b/engine/tests/api/metadata.php
@@ -75,16 +75,9 @@ class ElggCoreMetadataAPITest extends ElggCoreUnitTest {
$this->assertIdentical($case_true, $case_false);
- // check deprecated get_entities_from_metadata() function
- $deprecated = get_entities_from_metadata('metaUnitTest', 'tested', '', '', 0, 10, 0, '', 0, FALSE, TRUE);
- $this->assertIdentical($deprecated, $case_true);
-
- // check entity list
- //$this->dump(list_entities_from_metadata('metaUnitTest', 'Tested', '', '', 0, 10, TRUE, TRUE, TRUE, FALSE));
-
// clean up
- $this->delete_metastrings();
$this->object->delete();
+ $this->delete_metastrings();
}
public function testElggGetMetadataCount() {
diff --git a/engine/tests/api/plugins.php b/engine/tests/api/plugins.php
index 72092b688..8f5f5dd1e 100644
--- a/engine/tests/api/plugins.php
+++ b/engine/tests/api/plugins.php
@@ -105,7 +105,6 @@ class ElggCorePluginsAPITest extends ElggCoreUnitTest {
array('type' => 'plugin', 'name' => 'facebook_connect', 'version' => 1.0),
),
- 'admin_interface' => 'simple',
'activate_on_install' => true
);
@@ -265,10 +264,6 @@ class ElggCorePluginsAPITest extends ElggCoreUnitTest {
$this->assertEqual($this->manifest17->getConflicts(), array());
}
- public function testElggPluginManifestGetAdminInterface() {
- $this->assertEqual($this->manifest18->getAdminInterface(), 'simple');
- }
-
public function testElggPluginManifestGetActivateOnInstall() {
$this->assertEqual($this->manifest18->getActivateOnInstall(), true);
}
diff --git a/engine/tests/objects/entities.php b/engine/tests/objects/entities.php
index c04bc60ff..c13b4c731 100644
--- a/engine/tests/objects/entities.php
+++ b/engine/tests/objects/entities.php
@@ -125,7 +125,7 @@ class ElggCoreEntityTest extends ElggCoreUnitTest {
$this->assertIdentical(FALSE, elgg_get_annotations(array('guid' => $this->entity->getGUID(), 'type' => 'site', 'subtype' => 'fail')));
// clear annotation
- $this->assertTrue($this->entity->clearAnnotations());
+ $this->assertTrue($this->entity->deleteAnnotations());
$this->assertEqual($this->entity->countAnnotations('non_existent'), 0);
$this->assertIdentical(array(), elgg_get_annotations(array('guid' => $this->entity->getGUID())));
@@ -134,6 +134,7 @@ class ElggCoreEntityTest extends ElggCoreUnitTest {
// clean up
$this->assertTrue($this->entity->delete());
+ remove_subtype('site', 'testing');
}
public function testElggEntityCache() {
@@ -226,8 +227,8 @@ class ElggCoreEntityTest extends ElggCoreUnitTest {
}
public function testElggEntityMetadata() {
- // let's delte a non-existent metadata
- $this->assertFalse($this->entity->clearMetaData('important'));
+ // let's delete a non-existent metadata
+ $this->assertFalse($this->entity->deleteMetadata('important'));
// let's add the meatadata
$this->assertTrue($this->entity->important = 'indeed!');
@@ -236,16 +237,16 @@ class ElggCoreEntityTest extends ElggCoreUnitTest {
// test deleting incorrectly
// @link http://trac.elgg.org/ticket/2273
- $this->assertFalse($this->entity->clearMetaData('impotent'));
+ $this->assertFalse($this->entity->deleteMetadata('impotent'));
$this->assertEqual($this->entity->important, 'indeed!');
// get rid of one metadata
$this->assertEqual($this->entity->important, 'indeed!');
- $this->assertTrue($this->entity->clearMetaData('important'));
+ $this->assertTrue($this->entity->deleteMetadata('important'));
$this->assertEqual($this->entity->important, '');
// get rid of all metadata
- $this->assertTrue($this->entity->clearMetaData());
+ $this->assertTrue($this->entity->deleteMetadata());
$this->assertEqual($this->entity->less_important, '');
// clean up database
@@ -278,6 +279,10 @@ class ElggCoreEntityTest extends ElggCoreUnitTest {
$this->entity->$name = $md;
$this->assertEqual($md, $this->entity->$name);
+
+ if ($save) {
+ $this->assertTrue($this->entity->delete());
+ }
}
}
@@ -292,6 +297,10 @@ class ElggCoreEntityTest extends ElggCoreUnitTest {
$this->entity->$name = $md;
$this->assertEqual($md[0], $this->entity->$name);
+
+ if ($save) {
+ $this->assertTrue($this->entity->delete());
+ }
}
}
@@ -307,6 +316,10 @@ class ElggCoreEntityTest extends ElggCoreUnitTest {
$this->entity->setMetaData($name, 'test2', '', true);
$this->assertEqual(array('test', 'test2'), $this->entity->$name);
+
+ if ($save) {
+ $this->assertTrue($this->entity->delete());
+ }
}
}
@@ -322,6 +335,10 @@ class ElggCoreEntityTest extends ElggCoreUnitTest {
$this->entity->setMetaData($name, array('test2'), '', true);
$this->assertEqual(array('test', 'test2'), $this->entity->$name);
+
+ if ($save) {
+ $this->assertTrue($this->entity->delete());
+ }
}
}
@@ -338,11 +355,14 @@ class ElggCoreEntityTest extends ElggCoreUnitTest {
$this->entity->setMetaData($name, $md2, '', true);
$this->assertEqual(array_merge($md, $md2), $this->entity->$name);
+
+ if ($save) {
+ $this->assertTrue($this->entity->delete());
+ }
}
}
- protected function save_entity($type='site')
- {
+ protected function save_entity($type='site') {
$this->entity->type = $type;
$this->assertNotEqual($this->entity->save(), 0);
}
diff --git a/engine/tests/objects/sites.php b/engine/tests/objects/sites.php
index d0d61dcab..e5acbb3f9 100644
--- a/engine/tests/objects/sites.php
+++ b/engine/tests/objects/sites.php
@@ -18,7 +18,7 @@ class ElggCoreSiteTest extends ElggCoreUnitTest {
* Called before each test method.
*/
public function setUp() {
- $this->site = new ElggSiteTest;
+ $this->site = new ElggSiteTest();
}
/**
diff --git a/engine/tests/objects/users.php b/engine/tests/objects/users.php
index ba93c2439..d1533c3d2 100644
--- a/engine/tests/objects/users.php
+++ b/engine/tests/objects/users.php
@@ -220,29 +220,6 @@ class ElggCoreUserTest extends ElggCoreUnitTest {
$this->user->delete();
}
- // remove in 1.9
- public function testElggUserIsAdminLegacy() {
- $this->user->save();
- $this->user->makeAdmin();
-
- $this->assertTrue($this->user->admin);
- $this->assertTrue($this->user->siteadmin);
-
- $this->user->removeAdmin();
- $this->user->delete();
- }
-
- public function testElggUserIsNotAdminLegacy() {
- $this->user->save();
- $this->user->removeAdmin();
-
- $this->assertFalse($this->user->admin);
- $this->assertFalse($this->user->siteadmin);
-
- $this->user->removeAdmin();
- $this->user->delete();
- }
-
protected function fetchUser($guid) {
global $CONFIG;
diff --git a/engine/tests/regression/trac_bugs.php b/engine/tests/regression/trac_bugs.php
index 23d6d1dc6..2bfc37558 100644
--- a/engine/tests/regression/trac_bugs.php
+++ b/engine/tests/regression/trac_bugs.php
@@ -146,9 +146,9 @@ class ElggCoreRegressionBugsTest extends ElggCoreUnitTest {
}
}
- register_plugin_hook('container_permissions_check', 'all', 'can_write_to_container_test_hook');
+ elgg_register_plugin_hook_handler('container_permissions_check', 'all', 'can_write_to_container_test_hook');
$this->assertTrue(can_write_to_container($user->guid, $object->guid));
- unregister_plugin_hook('container_permissions_check', 'all', 'can_write_to_container_test_hook');
+ elgg_unregister_plugin_hook_handler('container_permissions_check', 'all', 'can_write_to_container_test_hook');
$this->assertFalse(can_write_to_container($user->guid, $group->guid));
$group->join($user);
diff --git a/engine/tests/test_files/plugin_18/manifest.xml b/engine/tests/test_files/plugin_18/manifest.xml
index 23f0fa0bf..445a41c2e 100644
--- a/engine/tests/test_files/plugin_18/manifest.xml
+++ b/engine/tests/test_files/plugin_18/manifest.xml
@@ -34,7 +34,6 @@
<category>ServiceAPI</category>
- <admin_interface>simple</admin_interface>
<activate_on_install>true</activate_on_install>
<requires>
diff --git a/engine/tests/ui/submenu.php b/engine/tests/ui/submenu.php
deleted file mode 100644
index b401620f6..000000000
--- a/engine/tests/ui/submenu.php
+++ /dev/null
@@ -1,103 +0,0 @@
-<?php
-/**
- * 1.8 submenu test.
- *
- * Submenu needs to be able to support being added out of order.
- * Children can be added before parents.
- * Children of parents never defined are never shown.
- *
- * Test against:
- * different contexts
- * different groups
- * old add_submenu_item() wrapper.
- *
- */
-
-/*
- * Tests need to be ported to new menu system
- *
-
-require_once('../../start.php');
-
-$url = "engine/tests/ui/submenu.php";
-
-$items = array(
- array(
- 'text' => 'Upper level 1',
- 'href' => "$url?upper_level_1",
- 'id' => 'ul1'
- ),
- array(
- 'text' => 'CD (No link)',
- 'parent_id' => 'cup',
- 'id' => 'cd',
- ),
- array(
- 'text' => 'Sub CD',
- 'href' => "$url?sub_cd",
- 'parent_id' => 'cd'
- ),
- array(
- 'text' => 'Cup',
- 'href' => "$url?cup",
- 'id' => 'cup'
- ),
- array(
- 'text' => 'Phone',
- 'href' => "$url?phone",
- 'id' => 'phone',
- 'parent_id' => 'cup'
- ),
- array(
- 'text' => 'Wallet',
- 'href' => "$url?wallet",
- 'id' => 'wallet',
- 'parent_id' => 'phone'
- ),
- array(
- 'text' => 'Upper level',
- 'href' => "$url?upper_level",
- 'id' => 'ul'
- ),
- array(
- 'text' => 'Sub Upper level',
- 'href' => "$url?sub_upper_level",
- 'parent_id' => 'ul'
- ),
- array(
- 'text' => 'Root',
- 'href' => $url,
- ),
-
- array(
- 'text' => 'I am an orphan',
- 'href' => 'http://google.com',
- 'parent_id' => 'missing_parent'
- ),
-
- array(
- 'text' => 'JS Test',
- 'href' => 'http://elgg.org',
- 'vars' => array('js' => 'onclick="alert(\'Link to \' + $(this).attr(\'href\') + \'!\'); return false;"')
- )
-);
-
-foreach ($items as $item) {
- elgg_add_submenu_item($item, 'main');
-}
-
-add_submenu_item('Old Onclick Test', 'http://elgg.com', NULL, TRUE);
-add_submenu_item('Old Selected Test', 'http://elgg.com', NULL, '', TRUE);
-
-
-elgg_add_submenu_item(array('text' => 'Not Main Test', 'href' => "$url?not_main_test"), 'not_main', 'new_menu');
-elgg_add_submenu_item(array('text' => 'Not Main C Test', 'href' => "$url?not_main_c_test"), 'not_main', 'new_menu');
-
-elgg_add_submenu_item(array('text' => 'All test', 'href' => "$url?all"), 'all');
-
-//elgg_set_context('not_main');
-
-$body = elgg_view_layout('one_sidebar', array('content' => 'Look right.'));
-echo elgg_view_page('Submenu Test', $body);
-
-*/
diff --git a/js/lib/elgglib.js b/js/lib/elgglib.js
index 9a372738d..0f17eeced 100644
--- a/js/lib/elgglib.js
+++ b/js/lib/elgglib.js
@@ -353,6 +353,145 @@ elgg.forward = function(url) {
};
/**
+ * Parse a URL into its parts. Mimicks http://php.net/parse_url
+ *
+ * @param {String} url The URL to parse
+ * @param {Int} component A component to return
+ * @param {Bool} expand Expand the query into an object? Else it's a string.
+ *
+ * @return {Object} The parsed URL
+ */
+elgg.parse_url = function(url, component, expand) {
+ // Adapted from http://blog.stevenlevithan.com/archives/parseuri
+ // which was release under the MIT
+ // It was modified to fix mailto: and javascript: support.
+ var
+ expand = expand || false,
+ component = component || false,
+
+ re_str =
+ // scheme (and user@ testing)
+ '^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?'
+ // possibly a user[:password]@
+ + '((?:(([^:@]*)(?::([^:@]*))?)?@)?'
+ // host and port
+ + '([^:/?#]*)(?::(\\d*))?)'
+ // path
+ + '(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))'
+ // query string
+ + '(?:\\?([^#]*))?'
+ // fragment
+ + '(?:#(.*))?)',
+ keys = {
+ 'mailto': {
+ 4: "scheme",
+ 5: "user",
+ 6: "host",
+ 9: "path",
+ 12: "query",
+ 13: "fragment"
+ },
+
+ 'standard': {
+ 1: "scheme",
+ 4: "user",
+ 5: "pass",
+ 6: "host",
+ 7: "port",
+ 9: "path",
+ 12: "query",
+ 13: "fragment"
+ }
+ },
+ results = {},
+ match_keys,
+ is_mailto = false;
+
+ var re = new RegExp(re_str);
+ var matches = re.exec(url);
+
+ // if the scheme field is undefined it means we're using a protocol
+ // without :// and an @. Feel free to fix this in the re if you can >:O
+ if (matches[1] == undefined) {
+ match_keys = keys['mailto'];
+ is_mailto = true;
+ } else {
+ match_keys = keys['standard'];
+ }
+
+ for (var i in match_keys) {
+ if (matches[i]) {
+ results[match_keys[i]] = matches[i];
+ }
+ }
+
+ // merge everything to path if not standard
+ if (is_mailto) {
+ var path = '',
+ new_results = {};
+
+ if (typeof(results['user']) != 'undefined' && typeof(results['host']) != 'undefined') {
+ path = results['user'] + '@' + results['host'];
+ delete results['user'];
+ delete results['host'];
+ } else if (typeof(results['user'])) {
+ path = results['user'];
+ delete results['user'];
+ } else if (typeof(results['host'])) {
+ path = results['host'];
+ delete results['host'];
+ }
+
+ if (typeof(results['path']) != 'undefined') {
+ results['path'] = path + results['path'];
+ } else {
+ results['path'] = path;
+ }
+
+ for (var prop in results) {
+ new_results[prop] = results[prop];
+ }
+
+ results = new_results;
+ }
+
+ if (expand && typeof(results['query']) != 'undefined') {
+ results['query'] = elgg.parse_str(results['query']);
+ }
+
+ if (component) {
+ if (typeof(results[component]) != 'undefined') {
+ return results[component];
+ } else {
+ return false;
+ }
+ }
+ return results;
+}
+
+/**
+ * Returns an object with key/values of the parsed query string.
+ *
+ * @param {String} string The string to parse
+ * @return {Object} The parsed object string
+ */
+elgg.parse_str = function(string) {
+ var params = {};
+ var result,
+ key,
+ value,
+ re = /([^&=]+)=?([^&]*)/g;
+
+ while (result = re.exec(string)) {
+ key = decodeURIComponent(result[1])
+ value = decodeURIComponent(result[2])
+ params[key] = value;
+ }
+
+ return params;
+};
+
+/**
* Returns a jQuery selector from a URL's fragement. Defaults to expecting an ID.
*
* Examples:
@@ -382,6 +521,42 @@ elgg.getSelectorFromUrlFragment = function(url) {
};
/**
+ * Adds child to object[parent] array.
+ *
+ * @param {Object} object The object to add to
+ * @param {String} parent The parent array to add to.
+ * @param {Mixed} value The value
+ */
+elgg.push_to_object_array = function(object, parent, value) {
+ elgg.assertTypeOf('object', object);
+ elgg.assertTypeOf('string', parent);
+
+ if (!(object[parent] instanceof Array)) {
+ object[parent] = []
+ }
+
+ if (object[parent].indexOf(value) < 0) {
+ return object[parent].push(value);
+ }
+
+ return false;
+}
+
+/**
+ * Tests if object[parent] contains child
+ *
+ * @param {Object} object The object to add to
+ * @param {String} parent The parent array to add to.
+ * @param {Mixed} value The value
+ */
+elgg.is_in_object_array = function(object, parent, value) {
+ elgg.assertTypeOf('object', object);
+ elgg.assertTypeOf('string', parent);
+
+ return typeof(object[parent]) != 'undefined' && object[parent].indexOf(value) >= 0;
+}
+
+/**
* Triggers the init hook when the library is ready
*
* Current requirements:
diff --git a/js/lib/hooks.js b/js/lib/hooks.js
index ab3a8a224..edfd28f24 100644
--- a/js/lib/hooks.js
+++ b/js/lib/hooks.js
@@ -3,13 +3,18 @@
*/
elgg.provide('elgg.config.hooks');
+elgg.provide('elgg.config.instant_hooks');
+elgg.provide('elgg.config.triggered_hooks');
/**
- * Registers an hook handler with the event system.
+ * Registers a hook handler with the event system.
*
* The special keyword "all" can be used for either the name or the type or both
* and means to call that handler for all of those hooks.
*
+ * Note that handlers registering for instant hooks will be executed immediately if the instant
+ * hook has been previously triggered.
+ *
* @param {String} name Name of the plugin hook to register for
* @param {String} type Type of the event to register for
* @param {Function} handler Handle to call
@@ -33,6 +38,11 @@ elgg.register_hook_handler = function(name, type, handler, priority) {
priorities[name][type] = new elgg.ElggPriorityList();
}
+ // call if instant and already triggered.
+ if (elgg.is_instant_hook(name, type) && elgg.is_triggered_hook(name, type)) {
+ handler(name, type, null, null);
+ }
+
return priorities[name][type].insert(handler, priority);
};
@@ -43,7 +53,9 @@ elgg.register_hook_handler = function(name, type, handler, priority) {
* Every handler function will always be called, regardless of the return value.
*
* @warning Handlers take the same 4 arguments in the same order as when calling this function.
- * This is different to the PHP version!
+ * This is different from the PHP version!
+ *
+ * @note Instant hooks do not support params or values.
*
* Hooks are called in this order:
* specifically registered (event_name and event_type match)
@@ -62,6 +74,9 @@ elgg.trigger_hook = function(name, type, params, value) {
elgg.assertTypeOf('string', name);
elgg.assertTypeOf('string', type);
+ // mark as triggered
+ elgg.set_triggered_hook(name, type);
+
// default to true if unpassed
value = value || true;
@@ -101,4 +116,58 @@ elgg.trigger_hook = function(name, type, params, value) {
});
return (tempReturnValue !== null) ? tempReturnValue : returnValue;
-}; \ No newline at end of file
+};
+
+/**
+ * Registers a hook as an instant hook.
+ *
+ * After being trigger once, registration of a handler to an instant hook will cause the
+ * handle to be executed immediately.
+ *
+ * @note Instant hooks must be triggered without params or defaults. Any params or default
+ * passed will *not* be passed to handlers executed upon registration.
+ *
+ * @param {String} name The hook name.
+ * @param {String} type The hook type.
+ * @return {Int}
+ */
+elgg.register_instant_hook = function(name, type) {
+ elgg.assertTypeOf('string', name);
+ elgg.assertTypeOf('string', type);
+
+ return elgg.push_to_object_array(elgg.config.instant_hooks, name, type);
+}
+
+/**
+ * Is this hook registered as an instant hook?
+ *
+ * @param {String} name The hook name.
+ * @param {String} type The hook type.
+ */
+elgg.is_instant_hook = function(name, type) {
+ return elgg.is_in_object_array(elgg.config.instant_hooks, name, type);
+}
+
+/**
+ * Records that a hook has been triggered.
+ *
+ * @param {String} name The hook name.
+ * @param {String} type The hook type.
+ */
+elgg.set_triggered_hook = function(name, type) {
+ return elgg.push_to_object_array(elgg.config.triggered_hooks, name, type);
+}
+
+/**
+ * Has this hook been triggered yet?
+ *
+ * @param {String} name The hook name.
+ * @param {String} type The hook type.
+ */
+elgg.is_triggered_hook = function(name, type) {
+ return elgg.is_in_object_array(elgg.config.triggered_hooks, name, type);
+}
+
+elgg.register_instant_hook('init', 'system');
+elgg.register_instant_hook('ready', 'system');
+elgg.register_instant_hook('boot', 'system');
diff --git a/js/lib/security.js b/js/lib/security.js
index 486347b88..d14ddff95 100644
--- a/js/lib/security.js
+++ b/js/lib/security.js
@@ -70,14 +70,22 @@ elgg.security.addToken = function(data) {
// 'http://example.com?data=sofar'
if (elgg.isString(data)) {
- var args = [];
- if (data) {
- args.push(data);
+ var args = {},
+ base = '';
+
+ // check for query strings
+ if (data.indexOf('?') != -1) {
+ var split = data.split('?');
+ base = split[0];
+ args = elgg.parse_str(split[1]);
+ } else {
+ base = data;
}
- args.push("__elgg_ts=" + elgg.security.token.__elgg_ts);
- args.push("__elgg_token=" + elgg.security.token.__elgg_token);
+
+ args["__elgg_ts"] = elgg.security.token.__elgg_ts;
+ args["__elgg_token"] = elgg.security.token.__elgg_token;
- return args.join('&');
+ return base + '?' + jQuery.param(args);
}
// no input! acts like a getter
diff --git a/js/lib/ui.js b/js/lib/ui.js
index 7abf7626f..57378a4d6 100644
--- a/js/lib/ui.js
+++ b/js/lib/ui.js
@@ -19,6 +19,8 @@ elgg.ui.init = function () {
$('.elgg-requires-confirmation').live('click', elgg.ui.requiresConfirmation);
+ $('.elgg-autofocus').focus();
+
if ($('.elgg-input-date').length) {
elgg.ui.initDatePicker();
}
diff --git a/languages/en.php b/languages/en.php
index c739d554e..67e447901 100644
--- a/languages/en.php
+++ b/languages/en.php
@@ -225,6 +225,7 @@ $english = array(
'LoginException:UsernameFailure' => 'We could not log you in. Please check your username and password.',
'LoginException:PasswordFailure' => 'We could not log you in. Please check your username and password.',
'LoginException:AccountLocked' => 'Your account has been locked for too many log in failures.',
+ 'LoginException:ChangePasswordFailure' => 'Failed current password check.',
'memcache:notinstalled' => 'PHP memcache module not installed, you must install php5-memcache',
'memcache:noservers' => 'No memcache servers defined, please populate the $CONFIG->memcache_servers variable',
@@ -379,6 +380,14 @@ $english = array(
'profile:twitter' => "Twitter username",
'profile:saved' => "Your profile was successfully saved.",
+ 'profile:field:text' => 'Short text',
+ 'profile:field:longtext' => 'Large text area',
+ 'profile:field:tags' => 'Tags',
+ 'profile:field:url' => 'Web address',
+ 'profile:field:email' => 'Email address',
+ 'profile:field:location' => 'Location',
+ 'profile:field:date' => 'Date',
+
'admin:appearance:profile_fields' => 'Edit Profile Fields',
'profile:edit:default' => 'Edit profile fields',
'profile:label' => "Profile label",
@@ -428,6 +437,7 @@ $english = array(
*/
'notifications:usersettings' => "Notification settings",
'notifications:methods' => "Please specify which methods you want to permit.",
+ 'notification:method:email' => 'Email',
'notifications:usersettings:save:ok' => "Your notification settings were successfully saved.",
'notifications:usersettings:save:fail' => "There was a problem saving your notification settings.",
@@ -676,17 +686,12 @@ $english = array(
'admin:plugins:plugin_website' => 'Plugin website',
'admin:plugins:author' => '%s',
'admin:plugins:version' => 'Version %s',
- 'admin:plugins:simple' => 'Simple',
- 'admin:plugins:advanced' => 'Advanced',
'admin:plugin_settings' => 'Plugin Settings',
- 'admin:plugins:simple_simple_fail' => 'Could not save settings.',
- 'admin:plugins:simple_simple_success' => 'Settings saved.',
- 'admin:plugins:simple:cannot_activate' => 'Cannot activate this plugin. Check the advanced plugin admin area for more information.',
'admin:plugins:warning:unmet_dependencies_active' => 'This plugin is active but has unmet dependencies. You may encounter problems. See "more info" below for details.',
'admin:plugins:dependencies:type' => 'Type',
'admin:plugins:dependencies:name' => 'Name',
- 'admin:plugins:dependencies:expected_value' => 'Tested Value',
+ 'admin:plugins:dependencies:expected_value' => 'Expected Value',
'admin:plugins:dependencies:local_value' => 'Actual value',
'admin:plugins:dependencies:comment' => 'Comment',
diff --git a/mod/blog/lib/blog.php b/mod/blog/lib/blog.php
index f24e6f58d..41924f336 100644
--- a/mod/blog/lib/blog.php
+++ b/mod/blog/lib/blog.php
@@ -124,6 +124,9 @@ function blog_get_page_content_list($container_guid = NULL) {
function blog_get_page_content_friends($user_guid) {
$user = get_user($user_guid);
+ if (!$user) {
+ forward('blog/all');
+ }
$return = array();
diff --git a/mod/blog/manifest.xml b/mod/blog/manifest.xml
index 991462060..dfbd7a1a6 100644
--- a/mod/blog/manifest.xml
+++ b/mod/blog/manifest.xml
@@ -15,6 +15,5 @@
<type>elgg_version</type>
<version>2010030101</version>
</requires>
- <admin_interface>simple</admin_interface>
<activate_on_install>true</activate_on_install>
</plugin_manifest>
diff --git a/mod/blog/views/default/blog/group_module.php b/mod/blog/views/default/blog/group_module.php
index d769fbd59..028827178 100644
--- a/mod/blog/views/default/blog/group_module.php
+++ b/mod/blog/views/default/blog/group_module.php
@@ -12,6 +12,7 @@ if ($group->blog_enable == "no") {
$all_link = elgg_view('output/url', array(
'href' => "blog/group/$group->guid/all",
'text' => elgg_echo('link:view:all'),
+ 'is_trusted' => true,
));
elgg_push_context('widgets');
@@ -33,6 +34,7 @@ if (!$content) {
$new_link = elgg_view('output/url', array(
'href' => "blog/add/$group->guid",
'text' => elgg_echo('blog:write'),
+ 'is_trusted' => true,
));
echo elgg_view('groups/profile/module', array(
diff --git a/mod/blog/views/default/blog/sidebar/revisions.php b/mod/blog/views/default/blog/sidebar/revisions.php
index c23b3b052..cd2e7f3d8 100644
--- a/mod/blog/views/default/blog/sidebar/revisions.php
+++ b/mod/blog/views/default/blog/sidebar/revisions.php
@@ -39,7 +39,8 @@ if (elgg_instanceof($blog, 'object', 'blog') && $blog->canEdit()) {
if ($blog->status == 'published') {
$load = elgg_view('output/url', array(
'href' => $load_base_url,
- 'text' => elgg_echo('blog:status:published')
+ 'text' => elgg_echo('blog:status:published'),
+ 'is_trusted' => true,
));
$time = "<span class='elgg-subtext'>"
@@ -59,7 +60,8 @@ if (elgg_instanceof($blog, 'object', 'blog') && $blog->canEdit()) {
}
$load = elgg_view('output/url', array(
'href' => "$load_base_url/$revision->id",
- 'text' => $revision_lang
+ 'text' => $revision_lang,
+ 'is_trusted' => true,
));
$text = "$load: $time";
diff --git a/mod/blog/views/default/object/blog.php b/mod/blog/views/default/object/blog.php
index ba08180b1..ab75bd09b 100644
--- a/mod/blog/views/default/object/blog.php
+++ b/mod/blog/views/default/object/blog.php
@@ -21,6 +21,7 @@ $owner_icon = elgg_view_entity_icon($owner, 'tiny');
$owner_link = elgg_view('output/url', array(
'href' => "blog/owner/$owner->username",
'text' => $owner->name,
+ 'is_trusted' => true,
));
$author_text = elgg_echo('byline', array($owner_link));
$tags = elgg_view('output/tags', array('tags' => $blog->tags));
@@ -35,6 +36,7 @@ if ($blog->comments_on != 'Off') {
$comments_link = elgg_view('output/url', array(
'href' => $blog->getURL() . '#blog-comments',
'text' => $text,
+ 'is_trusted' => true,
));
} else {
$comments_link = '';
diff --git a/mod/blog/views/default/widgets/blog/content.php b/mod/blog/views/default/widgets/blog/content.php
index 7bbfc3c74..330171662 100644
--- a/mod/blog/views/default/widgets/blog/content.php
+++ b/mod/blog/views/default/widgets/blog/content.php
@@ -22,6 +22,7 @@ if ($content) {
$more_link = elgg_view('output/url', array(
'href' => $blog_url,
'text' => elgg_echo('blog:moreblogs'),
+ 'is_trusted' => true,
));
echo "<span class=\"elgg-widget-more\">$more_link</span>";
} else {
diff --git a/mod/bookmarks/manifest.xml b/mod/bookmarks/manifest.xml
index 72e9af9b0..24969b837 100644
--- a/mod/bookmarks/manifest.xml
+++ b/mod/bookmarks/manifest.xml
@@ -16,5 +16,4 @@
<version>2010030101</version>
</requires>
<activate_on_install>true</activate_on_install>
- <admin_interface>simple</admin_interface>
</plugin_manifest>
diff --git a/mod/bookmarks/pages/bookmarks/friends.php b/mod/bookmarks/pages/bookmarks/friends.php
index 3491090a5..be164fcec 100644
--- a/mod/bookmarks/pages/bookmarks/friends.php
+++ b/mod/bookmarks/pages/bookmarks/friends.php
@@ -6,6 +6,9 @@
*/
$owner = elgg_get_page_owner_entity();
+if (!$page_owner) {
+ forward('bookmarks/all');
+}
elgg_push_breadcrumb($owner->name, "bookmarks/owner/$owner->username");
elgg_push_breadcrumb(elgg_echo('friends'));
diff --git a/mod/bookmarks/pages/bookmarks/owner.php b/mod/bookmarks/pages/bookmarks/owner.php
index 679c986be..7f55e08de 100644
--- a/mod/bookmarks/pages/bookmarks/owner.php
+++ b/mod/bookmarks/pages/bookmarks/owner.php
@@ -6,6 +6,9 @@
*/
$page_owner = elgg_get_page_owner_entity();
+if (!$page_owner) {
+ forward('bookmarks/all');
+}
elgg_push_breadcrumb($page_owner->name);
diff --git a/mod/bookmarks/views/default/bookmarks/group_module.php b/mod/bookmarks/views/default/bookmarks/group_module.php
index 3797de010..60a727819 100644
--- a/mod/bookmarks/views/default/bookmarks/group_module.php
+++ b/mod/bookmarks/views/default/bookmarks/group_module.php
@@ -14,6 +14,7 @@ if ($group->bookmarks_enable == "no") {
$all_link = elgg_view('output/url', array(
'href' => "bookmarks/group/$group->guid/all",
'text' => elgg_echo('link:view:all'),
+ 'is_trusted' => true,
));
elgg_push_context('widgets');
@@ -35,6 +36,7 @@ if (!$content) {
$new_link = elgg_view('output/url', array(
'href' => "bookmarks/add/$group->guid",
'text' => elgg_echo('bookmarks:add'),
+ 'is_trusted' => true,
));
echo elgg_view('groups/profile/module', array(
diff --git a/mod/bookmarks/views/default/object/bookmarks.php b/mod/bookmarks/views/default/object/bookmarks.php
index ca1f5d312..784263232 100644
--- a/mod/bookmarks/views/default/object/bookmarks.php
+++ b/mod/bookmarks/views/default/object/bookmarks.php
@@ -17,12 +17,13 @@ $owner_icon = elgg_view_entity_icon($owner, 'tiny');
$container = $bookmark->getContainerEntity();
$categories = elgg_view('output/categories', $vars);
-$link = filter_tags(elgg_view('output/url', array('href' => $bookmark->address, 'rel' => 'nofollow')));
+$link = elgg_view('output/url', array('href' => $bookmark->address));
$description = elgg_view('output/longtext', array('value' => $bookmark->description, 'class' => 'pbl'));
$owner_link = elgg_view('output/url', array(
'href' => "bookmarks/owner/$owner->username",
'text' => $owner->name,
+ 'is_trusted' => true,
));
$author_text = elgg_echo('byline', array($owner_link));
@@ -36,6 +37,7 @@ if ($comments_count != 0) {
$comments_link = elgg_view('output/url', array(
'href' => $bookmark->getURL() . '#comments',
'text' => $text,
+ 'is_trusted' => true,
));
} else {
$comments_link = '';
@@ -104,11 +106,10 @@ HTML;
}
}
- $link = filter_tags(elgg_view('output/url', array(
+ $link = elgg_view('output/url', array(
'href' => $bookmark->address,
'text' => $display_text,
- 'rel' => 'nofollow',
- )));
+ ));
$content = elgg_view_icon('push-pin-alt') . "$link{$excerpt}";
diff --git a/mod/bookmarks/views/default/widgets/bookmarks/content.php b/mod/bookmarks/views/default/widgets/bookmarks/content.php
index ea7816345..0b85017fc 100644
--- a/mod/bookmarks/views/default/widgets/bookmarks/content.php
+++ b/mod/bookmarks/views/default/widgets/bookmarks/content.php
@@ -24,6 +24,7 @@ if ($content) {
$more_link = elgg_view('output/url', array(
'href' => $url,
'text' => elgg_echo('bookmarks:more'),
+ 'is_trusted' => true,
));
echo "<span class=\"elgg-widget-more\">$more_link</span>";
} else {
diff --git a/mod/bookmarks/views/default/widgets/bookmarks/edit.php b/mod/bookmarks/views/default/widgets/bookmarks/edit.php
index 99d65ac8f..ed9c7fd88 100644
--- a/mod/bookmarks/views/default/widgets/bookmarks/edit.php
+++ b/mod/bookmarks/views/default/widgets/bookmarks/edit.php
@@ -6,13 +6,13 @@
*/
// set default value
-if (!isset($vars['entity']->max_display)) {
- $vars['entity']->max_display = 4;
+if (!isset($vars['entity']->num_display)) {
+ $vars['entity']->num_display = 4;
}
$params = array(
- 'name' => 'params[max_display]',
- 'value' => $vars['entity']->max_display,
+ 'name' => 'params[num_display]',
+ 'value' => $vars['entity']->num_display,
'options' => array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10),
);
$dropdown = elgg_view('input/dropdown', $params);
diff --git a/mod/categories/manifest.xml b/mod/categories/manifest.xml
index 15d7192c1..db6f0324f 100644
--- a/mod/categories/manifest.xml
+++ b/mod/categories/manifest.xml
@@ -14,5 +14,4 @@
<type>elgg_version</type>
<version>2010030101</version>
</requires>
- <admin_interface>advanced</admin_interface>
</plugin_manifest>
diff --git a/mod/categories/listing.php b/mod/categories/pages/categories/listing.php
index abbcf6785..8924506e9 100644
--- a/mod/categories/listing.php
+++ b/mod/categories/pages/categories/listing.php
@@ -29,6 +29,11 @@ $title = elgg_echo('categories:results', array($category));
$content = elgg_view_title($title);
$content .= $objects;
-$body = elgg_view_layout('two_column_left_sidebar', '', $content);
+$body = elgg_view_layout('content', array(
+ 'content' => $content,
+ 'title' => $title,
+ 'filter' => '',
+ 'header' => '',
+));
echo elgg_view_page($title, $body);
diff --git a/mod/categories/start.php b/mod/categories/start.php
index 2ccea0d70..b6bc4a55c 100644
--- a/mod/categories/start.php
+++ b/mod/categories/start.php
@@ -31,7 +31,7 @@ function categories_init() {
*
*/
function categories_page_handler() {
- include(dirname(__FILE__) . "/listing.php");
+ include(dirname(__FILE__) . "/pages/categories/listing.php");
return TRUE;
}
diff --git a/mod/custom_index/manifest.xml b/mod/custom_index/manifest.xml
index 7bb2a2543..dd00f2c49 100644
--- a/mod/custom_index/manifest.xml
+++ b/mod/custom_index/manifest.xml
@@ -12,5 +12,4 @@
<type>elgg_version</type>
<version>2009030702</version>
</requires>
- <admin_interface>advanced</admin_interface>
</plugin_manifest>
diff --git a/mod/dashboard/manifest.xml b/mod/dashboard/manifest.xml
index b5e9cff2e..7096fc86a 100644
--- a/mod/dashboard/manifest.xml
+++ b/mod/dashboard/manifest.xml
@@ -12,5 +12,4 @@
<type>elgg_version</type>
<version>2010030101</version>
</requires>
- <admin_interface>advanced</admin_interface>
-</plugin_manifest> \ No newline at end of file
+</plugin_manifest>
diff --git a/mod/developers/manifest.xml b/mod/developers/manifest.xml
index 4a7ed82bd..25840e164 100644
--- a/mod/developers/manifest.xml
+++ b/mod/developers/manifest.xml
@@ -15,7 +15,4 @@
<type>elgg_version</type>
<version>2009030802</version>
</requires>
-
- <admin_interface>advanced</admin_interface>
-
</plugin_manifest>
diff --git a/mod/developers/views/default/theme_preview/general.php b/mod/developers/views/default/theme_preview/general.php
index 1a0b54c88..35d8ccbfd 100644
--- a/mod/developers/views/default/theme_preview/general.php
+++ b/mod/developers/views/default/theme_preview/general.php
@@ -17,6 +17,7 @@
'text' => elgg_echo('theme_preview:breakout'),
'href' => current_page_url(),
'target' => '_parent',
+ 'is_trusted' => true,
));
?>
</p>
diff --git a/mod/diagnostics/manifest.xml b/mod/diagnostics/manifest.xml
index e85b19aef..5ebd7cf55 100644
--- a/mod/diagnostics/manifest.xml
+++ b/mod/diagnostics/manifest.xml
@@ -14,5 +14,4 @@
<type>elgg_version</type>
<version>2010030101</version>
</requires>
- <admin_interface>advanced</admin_interface>
</plugin_manifest>
diff --git a/mod/diagnostics/views/default/admin/develop_utilities/diagnostics.php b/mod/diagnostics/views/default/admin/develop_utilities/diagnostics.php
index 76f12b0ae..b41907da2 100644
--- a/mod/diagnostics/views/default/admin/develop_utilities/diagnostics.php
+++ b/mod/diagnostics/views/default/admin/develop_utilities/diagnostics.php
@@ -18,6 +18,7 @@ if (elgg_get_config('debug')) {
'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 {
diff --git a/mod/embed/manifest.xml b/mod/embed/manifest.xml
index 02c012330..27e9b9ada 100644
--- a/mod/embed/manifest.xml
+++ b/mod/embed/manifest.xml
@@ -18,5 +18,4 @@
<name>file</name>
</requires>
<activate_on_install>true</activate_on_install>
- <admin_interface>advanced</admin_interface>
</plugin_manifest>
diff --git a/mod/externalpages/manifest.xml b/mod/externalpages/manifest.xml
index 32528585d..4064ea602 100644
--- a/mod/externalpages/manifest.xml
+++ b/mod/externalpages/manifest.xml
@@ -12,5 +12,4 @@
<type>elgg_version</type>
<version>2010030101</version>
</requires>
- <admin_interface>advanced</admin_interface>
</plugin_manifest>
diff --git a/mod/file/actions/file/upload.php b/mod/file/actions/file/upload.php
index ee2889b4c..3edc87952 100644
--- a/mod/file/actions/file/upload.php
+++ b/mod/file/actions/file/upload.php
@@ -19,6 +19,11 @@ if ($container_guid == 0) {
elgg_make_sticky_form('file');
+// check if upload failed
+if (!empty($_FILES['upload']['name']) && $_FILES['upload']['error'] != 0) {
+ register_error(elgg_echo('file:cannotload'));
+ forward(REFERER);
+}
// check whether this is a new file or an edit
$new_file = true;
@@ -29,7 +34,6 @@ if ($guid > 0) {
if ($new_file) {
// must have a file if a new file upload
if (empty($_FILES['upload']['name'])) {
-
$error = elgg_echo('file:nofile');
register_error($error);
forward(REFERER);
diff --git a/mod/file/languages/en.php b/mod/file/languages/en.php
index aa30084a9..96fbd1c48 100644
--- a/mod/file/languages/en.php
+++ b/mod/file/languages/en.php
@@ -100,7 +100,7 @@ $english = array(
'file:downloadfailed' => "Sorry; this file is not available at this time.",
'file:deletefailed' => "Your file could not be deleted at this time.",
'file:noaccess' => "You do not have permissions to change this file",
- 'file:cannotload' => "There was an error loading the file",
+ 'file:cannotload' => "There was an error uploading the file",
'file:nofile' => "You must select a file",
);
diff --git a/mod/file/manifest.xml b/mod/file/manifest.xml
index aac9c3f6b..8a80e38dc 100644
--- a/mod/file/manifest.xml
+++ b/mod/file/manifest.xml
@@ -14,6 +14,5 @@
<type>elgg_version</type>
<version>2010030101</version>
</requires>
- <admin_interface>simple</admin_interface>
<activate_on_install>true</activate_on_install>
</plugin_manifest>
diff --git a/mod/file/pages/file/friends.php b/mod/file/pages/file/friends.php
index 0b351efaf..f504bdc1f 100644
--- a/mod/file/pages/file/friends.php
+++ b/mod/file/pages/file/friends.php
@@ -6,6 +6,9 @@
*/
$owner = elgg_get_page_owner_entity();
+if (!$owner) {
+ forward('file/all');
+}
elgg_push_breadcrumb(elgg_echo('file'), "file/all");
elgg_push_breadcrumb($owner->name, "file/owner/$owner->username");
diff --git a/mod/file/pages/file/owner.php b/mod/file/pages/file/owner.php
index 4e2ec89d4..fb87af1b2 100644
--- a/mod/file/pages/file/owner.php
+++ b/mod/file/pages/file/owner.php
@@ -9,6 +9,9 @@
group_gatekeeper();
$owner = elgg_get_page_owner_entity();
+if (!$owner) {
+ forward('file/all');
+}
elgg_push_breadcrumb(elgg_echo('file'), "file/all");
elgg_push_breadcrumb($owner->name);
diff --git a/mod/file/views/default/file/group_module.php b/mod/file/views/default/file/group_module.php
index c37b13927..ad6c58dbb 100644
--- a/mod/file/views/default/file/group_module.php
+++ b/mod/file/views/default/file/group_module.php
@@ -12,6 +12,7 @@ if ($group->file_enable == "no") {
$all_link = elgg_view('output/url', array(
'href' => "file/group/$group->guid/all",
'text' => elgg_echo('link:view:all'),
+ 'is_trusted' => true,
));
elgg_push_context('widgets');
@@ -33,6 +34,7 @@ if (!$content) {
$new_link = elgg_view('output/url', array(
'href' => "file/add/$group->guid",
'text' => elgg_echo('file:add'),
+ 'is_trusted' => true,
));
echo elgg_view('groups/profile/module', array(
diff --git a/mod/file/views/default/icon/object/file.php b/mod/file/views/default/icon/object/file.php
index 7feba7af3..ff729da94 100644
--- a/mod/file/views/default/icon/object/file.php
+++ b/mod/file/views/default/icon/object/file.php
@@ -36,6 +36,7 @@ if ($url) {
$params = array(
'href' => $url,
'text' => $img,
+ 'is_trusted' => true,
);
if (isset($vars['link_class'])) {
$params['class'] = $vars['link_class'];
diff --git a/mod/file/views/default/object/file.php b/mod/file/views/default/object/file.php
index 95e190d35..fbd585b8a 100644
--- a/mod/file/views/default/object/file.php
+++ b/mod/file/views/default/object/file.php
@@ -24,6 +24,7 @@ $body = elgg_view('output/longtext', array('value' => $file->description));
$owner_link = elgg_view('output/url', array(
'href' => "file/owner/$owner->username",
'text' => $owner->name,
+ 'is_trusted' => true,
));
$author_text = elgg_echo('byline', array($owner_link));
@@ -39,6 +40,7 @@ if ($comments_count != 0) {
$comments_link = elgg_view('output/url', array(
'href' => $file->getURL() . '#file-comments',
'text' => $text,
+ 'is_trusted' => true,
));
} else {
$comments_link = '';
diff --git a/mod/file/views/default/widgets/filerepo/content.php b/mod/file/views/default/widgets/filerepo/content.php
index 4288b9e56..f3e152de3 100644
--- a/mod/file/views/default/widgets/filerepo/content.php
+++ b/mod/file/views/default/widgets/filerepo/content.php
@@ -25,6 +25,7 @@ if ($content) {
$more_link = elgg_view('output/url', array(
'href' => $url,
'text' => elgg_echo('file:more'),
+ 'is_trusted' => true,
));
echo "<span class=\"elgg-widget-more\">$more_link</span>";
} else {
diff --git a/mod/garbagecollector/manifest.xml b/mod/garbagecollector/manifest.xml
index 466e49d61..0da71cd6b 100644
--- a/mod/garbagecollector/manifest.xml
+++ b/mod/garbagecollector/manifest.xml
@@ -14,5 +14,4 @@
<version>2009030702</version>
</requires>
<activate_on_install>true</activate_on_install>
- <admin_interface>advanced</admin_interface>
</plugin_manifest>
diff --git a/mod/groups/manifest.xml b/mod/groups/manifest.xml
index 4188aa861..542e9de01 100644
--- a/mod/groups/manifest.xml
+++ b/mod/groups/manifest.xml
@@ -15,5 +15,4 @@
<version>2010030101</version>
</requires>
<activate_on_install>true</activate_on_install>
- <admin_interface>simple</admin_interface>
</plugin_manifest>
diff --git a/mod/groups/start.php b/mod/groups/start.php
index 0425bdea6..1b5b03ce7 100644
--- a/mod/groups/start.php
+++ b/mod/groups/start.php
@@ -562,8 +562,10 @@ function groups_user_join_event_listener($event, $object_type, $object) {
* Make sure users are added to the access collection
*/
function groups_access_collection_override($hook, $entity_type, $returnvalue, $params) {
- if (elgg_instanceof(get_entity($params['collection']->owner_guid), 'group')) {
- return true;
+ if (isset($params['collection'])) {
+ if (elgg_instanceof(get_entity($params['collection']->owner_guid), 'group')) {
+ return true;
+ }
}
}
diff --git a/mod/groups/views/default/discussion/group_module.php b/mod/groups/views/default/discussion/group_module.php
index 3a46e336e..3c9961f82 100644
--- a/mod/groups/views/default/discussion/group_module.php
+++ b/mod/groups/views/default/discussion/group_module.php
@@ -15,6 +15,7 @@ $group = $vars['entity'];
$all_link = elgg_view('output/url', array(
'href' => "discussion/owner/$group->guid",
'text' => elgg_echo('link:view:all'),
+ 'is_trusted' => true,
));
elgg_push_context('widgets');
@@ -36,6 +37,7 @@ if (!$content) {
$new_link = elgg_view('output/url', array(
'href' => "discussion/add/" . $group->getGUID(),
'text' => elgg_echo('groups:addtopic'),
+ 'is_trusted' => true,
));
echo elgg_view('groups/profile/module', array(
diff --git a/mod/groups/views/default/groups/invitationrequests.php b/mod/groups/views/default/groups/invitationrequests.php
index 9c2df8b9c..e644b6bdc 100644
--- a/mod/groups/views/default/groups/invitationrequests.php
+++ b/mod/groups/views/default/groups/invitationrequests.php
@@ -15,6 +15,7 @@ if (!empty($vars['invitations']) && is_array($vars['invitations'])) {
$group_title = elgg_view('output/url', array(
'href' => $group->getURL(),
'text' => $group->name,
+ 'is_trusted' => true,
));
$url = elgg_add_action_tokens_to_url(elgg_get_site_url()."action/groups/join?user_guid={$user->guid}&group_guid={$group->guid}");
@@ -22,6 +23,7 @@ if (!empty($vars['invitations']) && is_array($vars['invitations'])) {
'href' => $url,
'text' => elgg_echo('accept'),
'class' => 'elgg-button elgg-button-submit',
+ 'is_trusted' => true,
));
$url = "action/groups/killinvitation?user_guid={$user->getGUID()}&group_guid={$group->getGUID()}";
diff --git a/mod/groups/views/default/groups/membershiprequests.php b/mod/groups/views/default/groups/membershiprequests.php
index 7f33b83e0..489d6f5e3 100644
--- a/mod/groups/views/default/groups/membershiprequests.php
+++ b/mod/groups/views/default/groups/membershiprequests.php
@@ -16,6 +16,7 @@ if (!empty($vars['requests']) && is_array($vars['requests'])) {
$user_title = elgg_view('output/url', array(
'href' => $user->getURL(),
'text' => $user->name,
+ 'is_trusted' => true,
));
$url = "action/groups/addtogroup?user_guid={$user->guid}&group_guid={$vars['entity']->guid}";
@@ -24,6 +25,7 @@ if (!empty($vars['requests']) && is_array($vars['requests'])) {
'href' => $url,
'text' => elgg_echo('accept'),
'class' => 'elgg-button elgg-button-submit',
+ 'is_trusted' => true,
));
$url = 'action/groups/killrequest?user_guid=' . $user->guid . '&group_guid=' . $vars['entity']->guid;
diff --git a/mod/groups/views/default/groups/profile/activity_module.php b/mod/groups/views/default/groups/profile/activity_module.php
index 5e557b443..832ff4a4b 100644
--- a/mod/groups/views/default/groups/profile/activity_module.php
+++ b/mod/groups/views/default/groups/profile/activity_module.php
@@ -19,6 +19,7 @@ if (!$group) {
$all_link = elgg_view('output/url', array(
'href' => "groups/activity/$group->guid",
'text' => elgg_echo('link:view:all'),
+ 'is_trusted' => true,
));
diff --git a/mod/groups/views/default/groups/profile/summary.php b/mod/groups/views/default/groups/profile/summary.php
index b7ae51070..54abcb1e5 100644
--- a/mod/groups/views/default/groups/profile/summary.php
+++ b/mod/groups/views/default/groups/profile/summary.php
@@ -28,6 +28,7 @@ $owner = $group->getOwnerEntity();
echo elgg_view('output/url', array(
'text' => $owner->name,
'value' => $owner->getURL(),
+ 'is_trusted' => true,
));
?>
</p>
diff --git a/mod/groups/views/default/groups/sidebar/members.php b/mod/groups/views/default/groups/sidebar/members.php
index 7249ffbf4..49f14697c 100644
--- a/mod/groups/views/default/groups/sidebar/members.php
+++ b/mod/groups/views/default/groups/sidebar/members.php
@@ -13,6 +13,7 @@ $limit = elgg_extract('limit', $vars, 10);
$all_link = elgg_view('output/url', array(
'href' => 'groups/members/' . $vars['entity']->guid,
'text' => elgg_echo('groups:members:more'),
+ 'is_trusted' => true,
));
$body = elgg_list_entities_from_relationship(array(
diff --git a/mod/groups/views/default/object/groupforumtopic.php b/mod/groups/views/default/object/groupforumtopic.php
index 22589b84d..f3d5f96d5 100644
--- a/mod/groups/views/default/object/groupforumtopic.php
+++ b/mod/groups/views/default/object/groupforumtopic.php
@@ -20,6 +20,7 @@ $poster_icon = elgg_view_entity_icon($poster, 'tiny');
$poster_link = elgg_view('output/url', array(
'href' => $poster->getURL(),
'text' => $poster->name,
+ 'is_trusted' => true,
));
$poster_text = elgg_echo('groups:started', array($poster->name));
@@ -42,6 +43,7 @@ if ($num_replies != 0) {
$replies_link = elgg_view('output/url', array(
'href' => $topic->getURL() . '#group-replies',
'text' => elgg_echo('group:replies') . " ($num_replies)",
+ 'is_trusted' => true,
));
}
diff --git a/mod/groups/views/default/widgets/a_users_groups/content.php b/mod/groups/views/default/widgets/a_users_groups/content.php
index 114fd7565..fe1a46e39 100644
--- a/mod/groups/views/default/widgets/a_users_groups/content.php
+++ b/mod/groups/views/default/widgets/a_users_groups/content.php
@@ -25,6 +25,7 @@ if ($content) {
$more_link = elgg_view('output/url', array(
'href' => $url,
'text' => elgg_echo('groups:more'),
+ 'is_trusted' => true,
));
echo "<span class=\"elgg-widget-more\">$more_link</span>";
} else {
diff --git a/mod/htmlawed/manifest.xml b/mod/htmlawed/manifest.xml
index 0c48bbd28..b176834e5 100644
--- a/mod/htmlawed/manifest.xml
+++ b/mod/htmlawed/manifest.xml
@@ -14,5 +14,4 @@
<version>2009041701</version>
</requires>
<activate_on_install>true</activate_on_install>
- <admin_interface>advanced</admin_interface>
</plugin_manifest>
diff --git a/mod/invitefriends/manifest.xml b/mod/invitefriends/manifest.xml
index e02c19c36..75a2d17f2 100644
--- a/mod/invitefriends/manifest.xml
+++ b/mod/invitefriends/manifest.xml
@@ -13,6 +13,5 @@
<type>elgg_version</type>
<version>2010030101</version>
</requires>
- <admin_interface>advanced</admin_interface>
<activate_on_install>true</activate_on_install>
</plugin_manifest>
diff --git a/mod/likes/manifest.xml b/mod/likes/manifest.xml
index f63c643a6..946cfd86b 100644
--- a/mod/likes/manifest.xml
+++ b/mod/likes/manifest.xml
@@ -14,5 +14,4 @@
<version>2010030101</version>
</requires>
<activate_on_install>true</activate_on_install>
- <admin_interface>advanced</admin_interface>
-</plugin_manifest> \ No newline at end of file
+</plugin_manifest>
diff --git a/mod/likes/views/default/annotation/likes.php b/mod/likes/views/default/annotation/likes.php
index 2dd01b6cd..314d0790d 100644
--- a/mod/likes/views/default/annotation/likes.php
+++ b/mod/likes/views/default/annotation/likes.php
@@ -20,6 +20,7 @@ $user_icon = elgg_view_entity_icon($user, 'tiny');
$user_link = elgg_view('output/url', array(
'href' => $user->getURL(),
'text' => $user->name,
+ 'is_trusted' => true,
));
$likes_string = elgg_echo('likes:this');
diff --git a/mod/likes/views/default/likes/button.php b/mod/likes/views/default/likes/button.php
index 383e1bb63..3f2f073cc 100644
--- a/mod/likes/views/default/likes/button.php
+++ b/mod/likes/views/default/likes/button.php
@@ -20,6 +20,7 @@ if (elgg_is_logged_in() && $vars['entity']->canAnnotate(0, 'likes')) {
'text' => elgg_view_icon('thumbs-up'),
'title' => elgg_echo('likes:likethis'),
'is_action' => true,
+ 'is_trusted' => true,
);
$likes_button = elgg_view('output/url', $params);
} else {
@@ -34,6 +35,7 @@ if (elgg_is_logged_in() && $vars['entity']->canAnnotate(0, 'likes')) {
'text' => elgg_view_icon('thumbs-up-alt'),
'title' => elgg_echo('likes:remove'),
'is_action' => true,
+ 'is_trusted' => true,
);
$likes_button = elgg_view('output/url', $params);
}
diff --git a/mod/logbrowser/manifest.xml b/mod/logbrowser/manifest.xml
index 585288912..846ad155a 100644
--- a/mod/logbrowser/manifest.xml
+++ b/mod/logbrowser/manifest.xml
@@ -14,5 +14,4 @@
<version>2009030702</version>
</requires>
<activate_on_install>true</activate_on_install>
- <admin_interface>advanced</admin_interface>
</plugin_manifest>
diff --git a/mod/logbrowser/views/default/logbrowser/table.php b/mod/logbrowser/views/default/logbrowser/table.php
index 86c8a1423..b7f6a1f20 100644
--- a/mod/logbrowser/views/default/logbrowser/table.php
+++ b/mod/logbrowser/views/default/logbrowser/table.php
@@ -24,11 +24,13 @@ $log_entries = $vars['log_entries'];
if ($user) {
$user_link = elgg_view('output/url', array(
'href' => $user->getURL(),
- 'text' => $user->name
+ 'text' => $user->name,
+ 'is_trusted' => true,
));
$user_guid_link = elgg_view('output/url', array(
'href' => "admin/overview/logbrowser?user_guid=$user->guid",
- 'text' => $user->getGUID()
+ 'text' => $user->getGUID(),
+ 'is_trusted' => true,
));
} else {
$user_guid_link = $user_link = '&nbsp;';
@@ -38,7 +40,8 @@ $log_entries = $vars['log_entries'];
if (is_callable(array($object, 'getURL'))) {
$object_link = elgg_view('output/url', array(
'href' => $object->getURL(),
- 'text' => $entry->object_class
+ 'text' => $entry->object_class,
+ 'is_trusted' => true,
));
} else {
$object_link = $entry->object_class;
diff --git a/mod/logrotate/manifest.xml b/mod/logrotate/manifest.xml
index ab6250ac0..503bf6cd1 100644
--- a/mod/logrotate/manifest.xml
+++ b/mod/logrotate/manifest.xml
@@ -14,5 +14,4 @@
<version>2009030702</version>
</requires>
<activate_on_install>true</activate_on_install>
- <admin_interface>advanced</admin_interface>
</plugin_manifest>
diff --git a/mod/logrotate/views/default/plugins/logrotate/settings.php b/mod/logrotate/views/default/plugins/logrotate/settings.php
index d9c4032fe..bef8b308d 100644
--- a/mod/logrotate/views/default/plugins/logrotate/settings.php
+++ b/mod/logrotate/views/default/plugins/logrotate/settings.php
@@ -6,13 +6,13 @@
*/
$period = $vars['entity']->period;
-$time = $vars['entity']->time;
+$delete = $vars['entity']->delete;
if (!$period) {
$period = 'monthly';
}
-if (!$time) {
- $time = 'monthly';
+if (!$delete) {
+ $delete = 'monthly';
}
?>
<div>
@@ -26,7 +26,7 @@ if (!$time) {
'monthly' => elgg_echo('logrotate:monthly'),
'yearly' => elgg_echo('logrotate:yearly'),
),
- 'value' => $period
+ 'value' => $period,
));
?>
</div>
@@ -41,7 +41,7 @@ if (!$time) {
'monthly' => elgg_echo('logrotate:month'),
'yearly' => elgg_echo('logrotate:year'),
),
- 'value' => $time
+ 'value' => $delete,
));
?>
</div>
diff --git a/mod/members/manifest.xml b/mod/members/manifest.xml
index b96684198..f5e95eb41 100644
--- a/mod/members/manifest.xml
+++ b/mod/members/manifest.xml
@@ -13,5 +13,4 @@
<version>2010030101</version>
</requires>
<activate_on_install>true</activate_on_install>
- <admin_interface>advanced</admin_interface>
-</plugin_manifest> \ No newline at end of file
+</plugin_manifest>
diff --git a/mod/messageboard/manifest.xml b/mod/messageboard/manifest.xml
index 25c42ee93..5881c4e46 100644
--- a/mod/messageboard/manifest.xml
+++ b/mod/messageboard/manifest.xml
@@ -14,5 +14,4 @@
<version>2010030101</version>
</requires>
<activate_on_install>true</activate_on_install>
- <admin_interface>simple</admin_interface>
</plugin_manifest>
diff --git a/mod/messageboard/views/default/widgets/messageboard/content.php b/mod/messageboard/views/default/widgets/messageboard/content.php
index 63f389e6a..35954e7a3 100644
--- a/mod/messageboard/views/default/widgets/messageboard/content.php
+++ b/mod/messageboard/views/default/widgets/messageboard/content.php
@@ -31,4 +31,5 @@ if ($owner instanceof ElggGroup) {
echo elgg_view('output/url', array(
'href' => $url,
'text' => elgg_echo('messageboard:viewall'),
+ 'is_trusted' => true,
)); \ No newline at end of file
diff --git a/mod/messages/languages/en.php b/mod/messages/languages/en.php
index 2002905b7..308c3d519 100644
--- a/mod/messages/languages/en.php
+++ b/mod/messages/languages/en.php
@@ -39,7 +39,7 @@ $english = array(
'messages:new' => 'New message',
- 'notification:method:site' => 'Messages',
+ 'notification:method:site' => 'Site',
'messages:error' => 'There was a problem saving your message. Please try again.',
diff --git a/mod/messages/manifest.xml b/mod/messages/manifest.xml
index 66ca4b444..30acc240d 100644
--- a/mod/messages/manifest.xml
+++ b/mod/messages/manifest.xml
@@ -14,5 +14,4 @@
<version>2010030101</version>
</requires>
<activate_on_install>true</activate_on_install>
- <admin_interface>simple</admin_interface>
</plugin_manifest>
diff --git a/mod/messages/views/default/object/messages.php b/mod/messages/views/default/object/messages.php
index b6f9ed6d5..8c840dd57 100644
--- a/mod/messages/views/default/object/messages.php
+++ b/mod/messages/views/default/object/messages.php
@@ -24,6 +24,7 @@ if ($message->toId == elgg_get_page_owner_guid()) {
$user_link = elgg_view('output/url', array(
'href' => "messages/compose?send_to=$user->guid",
'text' => $user->name,
+ 'is_trusted' => true,
));
} else {
$icon = '';
@@ -45,6 +46,7 @@ if ($message->toId == elgg_get_page_owner_guid()) {
$user_link = elgg_view('output/url', array(
'href' => "messages/compose?send_to=$user->guid",
'text' => elgg_echo('messages:to_user', array($user->name)),
+ 'is_trusted' => true,
));
} else {
$icon = '';
@@ -63,6 +65,7 @@ if (!$full) {
$subject_info .= elgg_view('output/url', array(
'href' => $message->getURL(),
'text' => $message->title,
+ 'is_trusted' => true,
));
$delete_link = elgg_view("output/confirmlink", array(
diff --git a/mod/notifications/languages/en.php b/mod/notifications/languages/en.php
index 586d66892..b29c9df25 100644
--- a/mod/notifications/languages/en.php
+++ b/mod/notifications/languages/en.php
@@ -13,7 +13,6 @@ $english = array(
'notifications:subscriptions:changesettings' => 'Notifications',
'notifications:subscriptions:changesettings:groups' => 'Group notifications',
- 'notification:method:email' => 'Email',
'notifications:subscriptions:title' => 'Notifications per user',
'notifications:subscriptions:description' => 'To receive notifications from your friends (on an individual basis) when they create new content, find them below and select the notification method you would like to use.',
diff --git a/mod/notifications/manifest.xml b/mod/notifications/manifest.xml
index 16a67cb00..97b88fb75 100644
--- a/mod/notifications/manifest.xml
+++ b/mod/notifications/manifest.xml
@@ -12,6 +12,5 @@
<type>elgg_version</type>
<version>2010030101</version>
</requires>
- <admin_interface>advanced</admin_interface>
<activate_on_install>true</activate_on_install>
</plugin_manifest>
diff --git a/mod/pages/manifest.xml b/mod/pages/manifest.xml
index 4b5e5c747..a91881cab 100644
--- a/mod/pages/manifest.xml
+++ b/mod/pages/manifest.xml
@@ -14,6 +14,5 @@
<type>elgg_version</type>
<version>2010030101</version>
</requires>
- <admin_interface>simple</admin_interface>
<activate_on_install>true</activate_on_install>
</plugin_manifest>
diff --git a/mod/pages/pages/pages/friends.php b/mod/pages/pages/pages/friends.php
index c55b27466..87ac631c2 100644
--- a/mod/pages/pages/pages/friends.php
+++ b/mod/pages/pages/pages/friends.php
@@ -7,7 +7,7 @@
$owner = elgg_get_page_owner_entity();
if (!$owner) {
-
+ forward('pages/all');
}
elgg_push_breadcrumb($owner->name, "pages/owner/$owner->username");
diff --git a/mod/pages/pages/pages/owner.php b/mod/pages/pages/pages/owner.php
index 2ff310ac8..2ff45ae0c 100644
--- a/mod/pages/pages/pages/owner.php
+++ b/mod/pages/pages/pages/owner.php
@@ -7,7 +7,7 @@
$owner = elgg_get_page_owner_entity();
if (!$owner) {
-
+ forward('pages/all');
}
// access check for closed groups
diff --git a/mod/pages/views/default/annotation/page.php b/mod/pages/views/default/annotation/page.php
index f7a7a78a1..a621b9281 100644
--- a/mod/pages/views/default/annotation/page.php
+++ b/mod/pages/views/default/annotation/page.php
@@ -21,6 +21,7 @@ if (!$owner) {
$owner_link = elgg_view('output/url', array(
'href' => $owner->getURL(),
'text' => $owner->name,
+ 'is_trusted' => true,
));
$date = elgg_view_friendly_time($annotation->time_created);
@@ -28,6 +29,7 @@ $date = elgg_view_friendly_time($annotation->time_created);
$title_link = elgg_view('output/url', array(
'href' => $annotation->getURL(),
'text' => $page->title,
+ 'is_trusted' => true,
));
$subtitle = elgg_echo('pages:revision:subtitle', array($date, $owner_link));
diff --git a/mod/pages/views/default/object/page_top.php b/mod/pages/views/default/object/page_top.php
index 8ba9fc298..0f7b51a0e 100644
--- a/mod/pages/views/default/object/page_top.php
+++ b/mod/pages/views/default/object/page_top.php
@@ -40,6 +40,7 @@ $editor = get_entity($annotation->owner_guid);
$editor_link = elgg_view('output/url', array(
'href' => "pages/owner/$editor->username",
'text' => $editor->name,
+ 'is_trusted' => true,
));
$date = elgg_view_friendly_time($annotation->time_created);
@@ -53,6 +54,7 @@ if ($comments_count != 0 && !$revision) {
$comments_link = elgg_view('output/url', array(
'href' => $page->getURL() . '#page-comments',
'text' => $text,
+ 'is_trusted' => true,
));
} else {
$comments_link = '';
diff --git a/mod/pages/views/default/pages/group_module.php b/mod/pages/views/default/pages/group_module.php
index 7e2656ca3..0d7df96ac 100644
--- a/mod/pages/views/default/pages/group_module.php
+++ b/mod/pages/views/default/pages/group_module.php
@@ -15,6 +15,7 @@ if ($group->pages_enable == "no") {
$all_link = elgg_view('output/url', array(
'href' => "pages/group/$group->guid/all",
'text' => elgg_echo('link:view:all'),
+ 'is_trusted' => true,
));
@@ -37,6 +38,7 @@ if (!$content) {
$new_link = elgg_view('output/url', array(
'href' => "pages/add/$group->guid",
'text' => elgg_echo('pages:add'),
+ 'is_trusted' => true,
));
echo elgg_view('groups/profile/module', array(
diff --git a/mod/pages/views/default/widgets/pages/content.php b/mod/pages/views/default/widgets/pages/content.php
index 3ae0b8454..f63777c09 100644
--- a/mod/pages/views/default/widgets/pages/content.php
+++ b/mod/pages/views/default/widgets/pages/content.php
@@ -24,6 +24,7 @@ if ($content) {
$more_link = elgg_view('output/url', array(
'href' => $url,
'text' => elgg_echo('pages:more'),
+ 'is_trusted' => true,
));
echo "<span class=\"elgg-widget-more\">$more_link</span>";
} else {
diff --git a/mod/profile/manifest.xml b/mod/profile/manifest.xml
index d811e373b..a1cff4dc2 100644
--- a/mod/profile/manifest.xml
+++ b/mod/profile/manifest.xml
@@ -10,7 +10,6 @@
<copyright>See COPYRIGHT.txt</copyright>
<license>GNU Public License Version 2</license>
<activate_on_install>true</activate_on_install>
- <admin_interface>advanced</admin_interface>
<requires>
<type>elgg_version</type>
<version>2011010401</version>
diff --git a/mod/reportedcontent/manifest.xml b/mod/reportedcontent/manifest.xml
index c51134608..d65b55ca3 100644
--- a/mod/reportedcontent/manifest.xml
+++ b/mod/reportedcontent/manifest.xml
@@ -13,5 +13,4 @@
<version>2010030101</version>
</requires>
<activate_on_install>true</activate_on_install>
- <admin_interface>advanced</admin_interface>
</plugin_manifest>
diff --git a/mod/reportedcontent/views/default/object/reported_content.php b/mod/reportedcontent/views/default/object/reported_content.php
index 6bcbf6e5d..0e733e154 100644
--- a/mod/reportedcontent/views/default/object/reported_content.php
+++ b/mod/reportedcontent/views/default/object/reported_content.php
@@ -29,6 +29,7 @@ if ($report->state == 'archived') {
'href' => $archive_url,
'text' => elgg_echo('reportedcontent:archive'),
'is_action' => true,
+ 'is_trusted' => true,
'class' => 'elgg-button elgg-button-action',
);
echo elgg_view('output/url', $params);
@@ -37,6 +38,7 @@ if ($report->state == 'archived') {
'href' => $delete_url,
'text' => elgg_echo('reportedcontent:delete'),
'is_action' => true,
+ 'is_trusted' => true,
'class' => 'elgg-button elgg-button-action',
);
echo elgg_view('output/url', $params);
@@ -46,7 +48,8 @@ if ($report->state == 'archived') {
<b><?php echo elgg_echo('reportedcontent:by'); ?>:</b>
<?php echo elgg_view('output/url', array(
'href' => $reporter->getURL(),
- 'text' => $reporter->name
+ 'text' => $reporter->name,
+ 'is_trusted' => true,
));
?>,
<?php echo elgg_view_friendly_time($report->time_created); ?>
@@ -68,7 +71,8 @@ if ($report->state == 'archived') {
<b><?php echo elgg_echo('reportedcontent:objecturl'); ?>:</b>
<?php echo elgg_view('output/url', array(
'href' => $report->address,
- 'text' => elgg_echo('reportedcontent:visit')
+ 'text' => elgg_echo('reportedcontent:visit'),
+ 'is_trusted' => true,
));
?>
</p>
diff --git a/mod/search/manifest.xml b/mod/search/manifest.xml
index 053e22178..b13e127d0 100644
--- a/mod/search/manifest.xml
+++ b/mod/search/manifest.xml
@@ -13,5 +13,4 @@
<version>2009030702</version>
</requires>
<activate_on_install>true</activate_on_install>
- <admin_interface>advanced</admin_interface>
</plugin_manifest>
diff --git a/mod/tagcloud/manifest.xml b/mod/tagcloud/manifest.xml
index 6fcad14e2..7c64829fc 100644
--- a/mod/tagcloud/manifest.xml
+++ b/mod/tagcloud/manifest.xml
@@ -13,5 +13,4 @@
<type>elgg_version</type>
<version>2010030101</version>
</requires>
- <admin_interface>advanced</admin_interface>
</plugin_manifest>
diff --git a/mod/thewire/manifest.xml b/mod/thewire/manifest.xml
index 27dd5732d..74e811bed 100644
--- a/mod/thewire/manifest.xml
+++ b/mod/thewire/manifest.xml
@@ -13,6 +13,5 @@
<type>elgg_version</type>
<version>2010030101</version>
</requires>
- <admin_interface>simple</admin_interface>
<activate_on_install>true</activate_on_install>
</plugin_manifest>
diff --git a/mod/thewire/pages/thewire/friends.php b/mod/thewire/pages/thewire/friends.php
index 265b73eab..26ad03da6 100644
--- a/mod/thewire/pages/thewire/friends.php
+++ b/mod/thewire/pages/thewire/friends.php
@@ -4,6 +4,9 @@
*/
$owner = elgg_get_page_owner_entity();
+if (!$owner) {
+ forward('thewire/all');
+}
$title = elgg_echo('thewire:friends');
diff --git a/mod/thewire/pages/thewire/owner.php b/mod/thewire/pages/thewire/owner.php
index b6449b217..a95786b0a 100644
--- a/mod/thewire/pages/thewire/owner.php
+++ b/mod/thewire/pages/thewire/owner.php
@@ -5,6 +5,9 @@
*/
$owner = elgg_get_page_owner_entity();
+if (!$owner) {
+ forward('thewire/all');
+}
$title = elgg_echo('thewire:user', array($owner->name));
diff --git a/mod/thewire/views/default/object/thewire.php b/mod/thewire/views/default/object/thewire.php
index 2727df60d..134c87243 100644
--- a/mod/thewire/views/default/object/thewire.php
+++ b/mod/thewire/views/default/object/thewire.php
@@ -26,6 +26,7 @@ $owner_icon = elgg_view_entity_icon($owner, 'tiny');
$owner_link = elgg_view('output/url', array(
'href' => "thewire/owner/$owner->username",
'text' => $owner->name,
+ 'is_trusted' => true,
));
$author_text = elgg_echo('byline', array($owner_link));
$date = elgg_view_friendly_time($post->time_created);
diff --git a/mod/thewire/views/default/river/object/thewire/create.php b/mod/thewire/views/default/river/object/thewire/create.php
index c3c434858..fbf592664 100644
--- a/mod/thewire/views/default/river/object/thewire/create.php
+++ b/mod/thewire/views/default/river/object/thewire/create.php
@@ -12,12 +12,14 @@ $subject_link = elgg_view('output/url', array(
'href' => $subject->getURL(),
'text' => $subject->name,
'class' => 'elgg-river-subject',
+ 'is_trusted' => true,
));
$object_link = elgg_view('output/url', array(
'href' => "thewire/owner/$subject->username",
'text' => elgg_echo('thewire:wire'),
'class' => 'elgg-river-object',
+ 'is_trusted' => true,
));
$summary = elgg_echo("river:create:object:thewire", array($subject_link, $object_link));
diff --git a/mod/thewire/views/default/thewire/profile_status.php b/mod/thewire/views/default/thewire/profile_status.php
index 6ab47bccb..ab20b5341 100644
--- a/mod/thewire/views/default/thewire/profile_status.php
+++ b/mod/thewire/views/default/thewire/profile_status.php
@@ -28,6 +28,7 @@ if ($latest_wire && count($latest_wire) > 0) {
'text' => elgg_echo('thewire:update'),
'href' => $url_to_wire,
'class' => 'elgg-button elgg-button-action right',
+ 'is_trusted' => true,
));
}
diff --git a/mod/thewire/views/default/widgets/thewire/content.php b/mod/thewire/views/default/widgets/thewire/content.php
index 835a328b0..7212d4397 100644
--- a/mod/thewire/views/default/widgets/thewire/content.php
+++ b/mod/thewire/views/default/widgets/thewire/content.php
@@ -22,6 +22,7 @@ if ($content) {
$more_link = elgg_view('output/url', array(
'href' => $owner_url,
'text' => elgg_echo('thewire:moreposts'),
+ 'is_trusted' => true,
));
echo "<span class=\"elgg-widget-more\">$more_link</span>";
} else {
diff --git a/mod/tinymce/manifest.xml b/mod/tinymce/manifest.xml
index 5e69055d8..2d062d399 100644
--- a/mod/tinymce/manifest.xml
+++ b/mod/tinymce/manifest.xml
@@ -14,5 +14,4 @@
<version>2010030101</version>
</requires>
<activate_on_install>true</activate_on_install>
- <admin_interface>advanced</admin_interface>
</plugin_manifest>
diff --git a/mod/twitter/manifest.xml b/mod/twitter/manifest.xml
index bd7176620..ffb6ccc05 100644
--- a/mod/twitter/manifest.xml
+++ b/mod/twitter/manifest.xml
@@ -13,5 +13,4 @@
<type>elgg_version</type>
<version>2010030101</version>
</requires>
- <admin_interface>advanced</admin_interface>
</plugin_manifest>
diff --git a/mod/twitter_api/languages/en.php b/mod/twitter_api/languages/en.php
index 9d8554a9e..f4b3c7f94 100644
--- a/mod/twitter_api/languages/en.php
+++ b/mod/twitter_api/languages/en.php
@@ -21,6 +21,8 @@ $english = array(
'twitter_api:usersettings:authorized' => "You have authorized %s to access your Twitter account: @%s.",
'twitter_api:usersettings:revoke' => 'Click <a href="%s">here</a> to revoke access.',
+ 'twitter_api:usersettings:site_not_configured' => 'An administrator must first configure Twitter before it can be used.',
+
'twitter_api:revoke:success' => 'Twitter access has been revoked.',
'twitter_api:login' => 'Allow existing users who have connected their Twitter account to sign in with Twitter?',
diff --git a/mod/twitter_api/views/default/forms/twitter_api/interstitial_settings.php b/mod/twitter_api/views/default/forms/twitter_api/interstitial_settings.php
index fdeafd46d..2592013c6 100644
--- a/mod/twitter_api/views/default/forms/twitter_api/interstitial_settings.php
+++ b/mod/twitter_api/views/default/forms/twitter_api/interstitial_settings.php
@@ -58,4 +58,5 @@ echo elgg_view('output/url', array(
'class' => 'right',
'text' => elgg_echo('twitter_api:interstitial:no_thanks'),
'href' => '/',
+ 'is_trusted' => true,
)); \ No newline at end of file
diff --git a/mod/twitter_api/views/default/plugins/twitter_api/usersettings.php b/mod/twitter_api/views/default/plugins/twitter_api/usersettings.php
index 65d04b883..edcea2f0d 100644
--- a/mod/twitter_api/views/default/plugins/twitter_api/usersettings.php
+++ b/mod/twitter_api/views/default/plugins/twitter_api/usersettings.php
@@ -9,6 +9,14 @@ $twitter_name = elgg_get_plugin_user_setting('twitter_name', $user_guid, 'twitte
$access_key = elgg_get_plugin_user_setting('access_key', $user_guid, 'twitter_api');
$access_secret = elgg_get_plugin_user_setting('access_secret', $user_guid, 'twitter_api');
+$site_key = elgg_get_plugin_setting('consumer_key', 'twitter_api');
+$site_secret = elgg_get_plugin_setting('consumer_secret', 'twitter_api');
+
+if (!($site_key && $site_secret)) {
+ echo '<div>' . elgg_echo('twitter_api:usersettings:site_not_configured') . '</div>';
+ return true;
+}
+
$site_name = elgg_get_site_entity()->name;
echo '<div>' . elgg_echo('twitter_api:usersettings:description', array($site_name)) . '</div>';
diff --git a/mod/uservalidationbyemail/manifest.xml b/mod/uservalidationbyemail/manifest.xml
index df0a7cb58..3358e1119 100644
--- a/mod/uservalidationbyemail/manifest.xml
+++ b/mod/uservalidationbyemail/manifest.xml
@@ -14,5 +14,4 @@
<version>2009033101</version>
</requires>
<activate_on_install>true</activate_on_install>
- <admin_interface>advanced</admin_interface>
</plugin_manifest>
diff --git a/mod/uservalidationbyemail/views/default/forms/uservalidationbyemail/bulk_action.php b/mod/uservalidationbyemail/views/default/forms/uservalidationbyemail/bulk_action.php
index 2872b7a0c..0e1461058 100644
--- a/mod/uservalidationbyemail/views/default/forms/uservalidationbyemail/bulk_action.php
+++ b/mod/uservalidationbyemail/views/default/forms/uservalidationbyemail/bulk_action.php
@@ -52,27 +52,30 @@ $bulk_actions_checkbox = '<label><input type="checkbox" class="unvalidated-users
. elgg_echo('uservalidationbyemail:check_all') . '</label>';
$validate = elgg_view('output/url', array(
- 'is_action' => TRUE,
- 'js' => 'title="' . elgg_echo('uservalidationbyemail:confirm_validate_checked') . '"',
- 'href' => $vars['url'] . "action/uservalidationbyemail/validate/",
+ 'href' => 'action/uservalidationbyemail/validate/',
'text' => elgg_echo('uservalidationbyemail:admin:validate'),
+ 'title' => elgg_echo('uservalidationbyemail:confirm_validate_checked'),
'class' => 'unvalidated-users-bulk-post',
+ 'is_action' => true,
+ 'is_trusted' => true,
));
$resend_email = elgg_view('output/url', array(
- 'is_action' => TRUE,
- 'js' => 'title="' . elgg_echo('uservalidationbyemail:confirm_resend_validation_checked') . '"',
- 'href' => $vars['url'] . "action/uservalidationbyemail/resend_validation/",
+ 'href' => 'action/uservalidationbyemail/resend_validation/',
'text' => elgg_echo('uservalidationbyemail:admin:resend_validation'),
+ 'title' => elgg_echo('uservalidationbyemail:confirm_resend_validation_checked'),
'class' => 'unvalidated-users-bulk-post',
+ 'is_action' => true,
+ 'is_trusted' => true,
));
$delete = elgg_view('output/url', array(
- 'is_action' => TRUE,
- 'js' => 'title="' . elgg_echo('uservalidationbyemail:confirm_delete_checked') . '"',
- 'href' => $vars['url'] . "action/uservalidationbyemail/delete/",
+ 'href' => 'action/uservalidationbyemail/delete/',
'text' => elgg_echo('uservalidationbyemail:admin:delete'),
+ 'title' => elgg_echo('uservalidationbyemail:confirm_delete_checked'),
'class' => 'unvalidated-users-bulk-post',
+ 'is_action' => true,
+ 'is_trusted' => true,
));
$bulk_actions = <<<___END
diff --git a/mod/zaudio/manifest.xml b/mod/zaudio/manifest.xml
index ecbff85fe..423a7e863 100644
--- a/mod/zaudio/manifest.xml
+++ b/mod/zaudio/manifest.xml
@@ -15,5 +15,4 @@
<version>2010111501</version>
</requires>
<activate_on_install>true</activate_on_install>
- <admin_interface>advanced</admin_interface>
</plugin_manifest>
diff --git a/version.php b/version.php
index d49ce5eb0..5a59b7f83 100644
--- a/version.php
+++ b/version.php
@@ -14,4 +14,4 @@
$version = 2011092500;
// Human-friendly version name
-$release = '1.8.0.1';
+$release = '1.8.1b1';
diff --git a/views/default/admin/appearance/default_widgets.php b/views/default/admin/appearance/default_widgets.php
index 4416dc8f6..1bf5791ac 100644
--- a/views/default/admin/appearance/default_widgets.php
+++ b/views/default/admin/appearance/default_widgets.php
@@ -17,6 +17,7 @@ if ($object) {
'text' => elgg_echo('upgrade'),
'href' => 'action/widgets/upgrade',
'is_action' => true,
+ 'is_trusted' => true,
'class' => 'elgg_button elgg-button-submit',
'title' => 'Upgrade your default widgets to work on Elgg 1.8',
));
diff --git a/views/default/admin/appearance/profile_fields/list.php b/views/default/admin/appearance/profile_fields/list.php
index 542ab1b6f..f4ff1e986 100644
--- a/views/default/admin/appearance/profile_fields/list.php
+++ b/views/default/admin/appearance/profile_fields/list.php
@@ -9,15 +9,18 @@
$n = 0;
$loaded_defaults = array();
$items = array();
-if ($fieldlist = elgg_get_config('profile_custom_fields')) {
+$fieldlist = elgg_get_config('profile_custom_fields');
+if ($fieldlist) {
$fieldlistarray = explode(',', $fieldlist);
foreach ($fieldlistarray as $listitem) {
- if ($translation = elgg_get_config("admin_defined_profile_{$listitem}")) {
+ $translation = elgg_get_config("admin_defined_profile_$listitem");
+ $type = elgg_get_config("admin_defined_profile_type_$listitem");
+ if ($translation && $type) {
$item = new stdClass;
$item->translation = $translation;
$item->shortname = $listitem;
- $item->name = "admin_defined_profile_{$listitem}";
- $item->type = elgg_get_config("admin_defined_profile_type_{$listitem}");
+ $item->name = "admin_defined_profile_$listitem";
+ $item->type = elgg_echo("profile:field:$type");
$items[] = $item;
}
}
@@ -36,8 +39,9 @@ foreach ($items as $item) {
//$even_odd = ( 'odd' != $even_odd ) ? 'odd' : 'even';
$url = elgg_view('output/url', array(
'href' => "action/profile/fields/delete?id={$item->shortname}",
- 'is_action' => TRUE,
'text' => elgg_view_icon('delete-alt'),
+ 'is_action' => true,
+ 'is_trusted' => true,
));
$type = elgg_echo($item->type);
echo <<<HTML
diff --git a/views/default/admin/header.php b/views/default/admin/header.php
index 3919c017e..331190a88 100644
--- a/views/default/admin/header.php
+++ b/views/default/admin/header.php
@@ -7,10 +7,12 @@ $admin_title = elgg_get_site_entity()->name . ' ' . elgg_echo('admin');
$view_site = elgg_view('output/url', array(
'href' => elgg_get_site_url(),
'text' => elgg_echo('admin:view_site'),
+ 'is_trusted' => true,
));
$logout = elgg_view('output/url', array(
'href' => 'action/logout',
'text' => elgg_echo('logout'),
+ 'is_trusted' => true,
));
?>
<h1 class="elgg-heading-site">
diff --git a/views/default/core/account/login_box.php b/views/default/core/account/login_box.php
index 274172bdb..8c586d425 100644
--- a/views/default/core/account/login_box.php
+++ b/views/default/core/account/login_box.php
@@ -15,12 +15,3 @@ $title = elgg_echo('login');
$body = elgg_view_form('login', array('action' => "{$login_url}action/login"));
echo elgg_view_module('aside', $title, $body);
-
-?>
-
-
-<script type="text/javascript">
- elgg.register_hook_handler('init', 'system', function() {
- $('input[name=username]').focus();
- });
-</script>
diff --git a/views/default/core/settings/account/notifications.php b/views/default/core/settings/account/notifications.php
index ae5fe40bb..51292b2c9 100644
--- a/views/default/core/settings/account/notifications.php
+++ b/views/default/core/settings/account/notifications.php
@@ -24,7 +24,7 @@ $notification_settings = get_user_notification_settings(elgg_get_page_owner_guid
foreach ($NOTIFICATION_HANDLERS as $k => $v) {
?>
<tr>
- <td><?php echo elgg_echo($k); ?>: </td>
+ <td><?php echo elgg_echo("notification:method:$k"); ?>: </td>
<td>
<?php
diff --git a/views/default/css/admin.php b/views/default/css/admin.php
index 90d151bc6..72c3692e9 100644
--- a/views/default/css/admin.php
+++ b/views/default/css/admin.php
@@ -264,8 +264,13 @@ p {
-moz-border-radius: 4px;
border-radius: 4px;
}
-.elgg-admin-notices a {
+.elgg-admin-notices a.elgg-admin-notice {
float: right;
+ text-decoration: none;
+}
+
+.elgg-admin-notices a {
+ text-decoration: underline;
}
/* ***************************************
diff --git a/views/default/forms/login.php b/views/default/forms/login.php
index 91e9cda42..956b3a87f 100644
--- a/views/default/forms/login.php
+++ b/views/default/forms/login.php
@@ -9,7 +9,11 @@
<div>
<label><?php echo elgg_echo('loginusername'); ?></label>
- <?php echo elgg_view('input/text', array('name' => 'username')); ?>
+ <?php echo elgg_view('input/text', array(
+ 'name' => 'username',
+ 'class' => 'elgg-autofocus',
+ ));
+ ?>
</div>
<div>
<label><?php echo elgg_echo('password'); ?></label>
diff --git a/views/default/forms/profile/fields/add.php b/views/default/forms/profile/fields/add.php
index c1d07d2ce..bd58ae381 100644
--- a/views/default/forms/profile/fields/add.php
+++ b/views/default/forms/profile/fields/add.php
@@ -8,11 +8,13 @@ $type_text = elgg_echo('profile:type');
$label_control = elgg_view('input/text', array('name' => 'label'));
$type_control = elgg_view('input/dropdown', array('name' => 'type', 'options_values' => array(
- 'text' => elgg_echo('text'),
- 'longtext' => elgg_echo('longtext'),
- 'tags' => elgg_echo('tags'),
- 'url' => elgg_echo('url'),
- 'email' => elgg_echo('email')
+ 'text' => elgg_echo('profile:field:text'),
+ 'longtext' => elgg_echo('profile:field:longtext'),
+ 'tags' => elgg_echo('profile:field:tags'),
+ 'url' => elgg_echo('profile:field:url'),
+ 'email' => elgg_echo('profile:field:email'),
+ 'location' => elgg_echo('profile:field:location'),
+ 'date' => elgg_echo('profile:field:date'),
)));
$submit_control = elgg_view('input/submit', array('name' => elgg_echo('add'), 'value' => elgg_echo('add')));
diff --git a/views/default/forms/register.php b/views/default/forms/register.php
index 6e18cd53d..411152205 100644
--- a/views/default/forms/register.php
+++ b/views/default/forms/register.php
@@ -23,6 +23,7 @@ if (elgg_is_sticky_form('register')) {
echo elgg_view('input/text', array(
'name' => 'name',
'value' => $name,
+ 'class' => 'elgg-autofocus',
));
?>
</div>
@@ -75,9 +76,3 @@ echo elgg_view('input/hidden', array('name' => 'friend_guid', 'value' => $vars['
echo elgg_view('input/hidden', array('name' => 'invitecode', 'value' => $vars['invitecode']));
echo elgg_view('input/submit', array('name' => 'submit', 'value' => elgg_echo('register')));
echo '</div>';
-?>
-<script type="text/javascript">
- $(function() {
- $('input[name=name]').focus();
- });
-</script> \ No newline at end of file
diff --git a/views/default/forms/user/requestnewpassword.php b/views/default/forms/user/requestnewpassword.php
index 22357e728..8a5a18734 100644
--- a/views/default/forms/user/requestnewpassword.php
+++ b/views/default/forms/user/requestnewpassword.php
@@ -12,15 +12,13 @@
</div>
<div>
<label><?php echo elgg_echo('username'); ?></label><br />
- <?php echo elgg_view('input/text', array('name' => 'username')); ?>
+ <?php echo elgg_view('input/text', array(
+ 'name' => 'username',
+ 'class' => 'elgg-autofocus',
+ ));
+ ?>
</div>
<?php echo elgg_view('input/captcha'); ?>
<div class="elgg-foot">
<?php echo elgg_view('input/submit', array('value' => elgg_echo('request'))); ?>
</div>
-<?php //@todo JS 1.8: no ?>
-<script type="text/javascript">
- $(document).ready(function() {
- $('input[name=username]').focus();
- });
-</script> \ No newline at end of file
diff --git a/views/default/icon/default.php b/views/default/icon/default.php
index 3abd96b96..533b92c43 100644
--- a/views/default/icon/default.php
+++ b/views/default/icon/default.php
@@ -39,6 +39,7 @@ if ($url) {
echo elgg_view('output/url', array(
'href' => $url,
'text' => $img,
+ 'is_trusted' => true,
));
} else {
echo $img;
diff --git a/views/default/icon/user/default.php b/views/default/icon/user/default.php
index aca03521f..0eb3691bd 100644
--- a/views/default/icon/user/default.php
+++ b/views/default/icon/user/default.php
@@ -66,6 +66,7 @@ if ($show_menu) {
echo elgg_view('output/url', array(
'href' => $user->getURL(),
'text' => $icon,
+ 'is_trusted' => true,
));
?>
</div>
diff --git a/views/default/navigation/breadcrumbs.php b/views/default/navigation/breadcrumbs.php
index bad73c4b3..88577a8ff 100644
--- a/views/default/navigation/breadcrumbs.php
+++ b/views/default/navigation/breadcrumbs.php
@@ -30,6 +30,7 @@ if (is_array($breadcrumbs) && count($breadcrumbs) > 0) {
$crumb = elgg_view('output/url', array(
'href' => $breadcrumb['link'],
'text' => $breadcrumb['title'],
+ 'is_trusted' => true,
));
} else {
$crumb = $breadcrumb['title'];
diff --git a/views/default/navigation/menu/user_hover.php b/views/default/navigation/menu/user_hover.php
index e32e5ab57..5c89e585c 100644
--- a/views/default/navigation/menu/user_hover.php
+++ b/views/default/navigation/menu/user_hover.php
@@ -19,6 +19,7 @@ echo '<ul class="elgg-menu elgg-menu-hover">';
$name_link = elgg_view('output/url', array(
'href' => $user->getURL(),
'text' => "<span class=\"elgg-heading-basic\">$user->name</span>&#64;$user->username",
+ 'is_trusted' => true,
));
echo "<li>$name_link</li>";
diff --git a/views/default/navigation/pagination.php b/views/default/navigation/pagination.php
index c0cb801dd..4df5cf575 100644
--- a/views/default/navigation/pagination.php
+++ b/views/default/navigation/pagination.php
@@ -42,10 +42,12 @@ $pages = new stdClass();
$pages->prev = array(
'text' => '&laquo; ' . elgg_echo('previous'),
'href' => '',
+ 'is_trusted' => true,
);
$pages->next = array(
'text' => elgg_echo('next') . ' &raquo;',
'href' => '',
+ 'is_trusted' => true,
);
$pages->items = array();
diff --git a/views/default/navigation/tabs.php b/views/default/navigation/tabs.php
index 0108126ad..e8fde3579 100644
--- a/views/default/navigation/tabs.php
+++ b/views/default/navigation/tabs.php
@@ -47,7 +47,7 @@ if (isset($vars['tabs']) && is_array($vars['tabs']) && !empty($vars['tabs'])) {
$options = array(
'href' => $url,
'title' => $title,
- 'text' => $title
+ 'text' => $title,
);
if (isset($info['url_class'])) {
@@ -58,6 +58,10 @@ if (isset($vars['tabs']) && is_array($vars['tabs']) && !empty($vars['tabs'])) {
$options['id'] = $info['url_id'];
}
+ if (!isset($info['rel']) && !isset($info['is_trusted'])) {
+ $options['is_trusted'] = true;
+ }
+
$link = elgg_view('output/url', $options);
echo "<li $class_str $js>$link</li>";
diff --git a/views/default/object/admin_notice.php b/views/default/object/admin_notice.php
index 086eddb1f..11524567e 100644
--- a/views/default/object/admin_notice.php
+++ b/views/default/object/admin_notice.php
@@ -11,7 +11,8 @@ if (isset($vars['entity']) && elgg_instanceof($vars['entity'], 'object', 'admin_
'href' => "action/admin/delete_admin_notice?guid=$notice->guid",
'text' => '<span class="elgg-icon elgg-icon-delete"></span>',
'is_action' => true,
- 'class' => 'elgg-admin-notice'
+ 'class' => 'elgg-admin-notice',
+ 'is_trusted' => true,
));
echo "<p>$delete$message</p>";
diff --git a/views/default/object/default.php b/views/default/object/default.php
index 62c8197f9..110648304 100644
--- a/views/default/object/default.php
+++ b/views/default/object/default.php
@@ -28,6 +28,7 @@ if ($owner) {
$owner_link = elgg_view('output/url', array(
'href' => $owner->getURL(),
'text' => $owner->name,
+ 'is_trusted' => true,
));
}
diff --git a/views/default/object/elements/summary.php b/views/default/object/elements/summary.php
index 10cf0b148..3ca4de2be 100644
--- a/views/default/object/elements/summary.php
+++ b/views/default/object/elements/summary.php
@@ -29,6 +29,7 @@ if ($title_link === '') {
$params = array(
'text' => $text,
'href' => $entity->getURL(),
+ 'is_trusted' => true,
);
$title_link = elgg_view('output/url', $params);
}
diff --git a/views/default/object/plugin/advanced.php b/views/default/object/plugin/advanced.php
index 1fabaff04..db4e4dbcc 100644
--- a/views/default/object/plugin/advanced.php
+++ b/views/default/object/plugin/advanced.php
@@ -40,9 +40,10 @@ if ($reordering) {
));
$links .= "<li>" . elgg_view('output/url', array(
- 'href' => $top_url,
- 'text' => elgg_echo('top'),
- 'is_action' => true
+ 'href' => $top_url,
+ 'text' => elgg_echo('top'),
+ 'is_action' => true,
+ 'is_trusted' => true,
)) . "</li>";
$up_url = elgg_http_add_url_query_elements($actions_base . 'set_priority', array(
@@ -52,9 +53,10 @@ if ($reordering) {
));
$links .= "<li>" . elgg_view('output/url', array(
- 'href' => $up_url,
- 'text' => elgg_echo('up'),
- 'is_action' => true
+ 'href' => $up_url,
+ 'text' => elgg_echo('up'),
+ 'is_action' => true,
+ 'is_trusted' => true,
)) . "</li>";
}
@@ -67,9 +69,10 @@ if ($reordering) {
));
$links .= "<li>" . elgg_view('output/url', array(
- 'href' => $down_url,
- 'text' => elgg_echo('down'),
- 'is_action' => true
+ 'href' => $down_url,
+ 'text' => elgg_echo('down'),
+ 'is_action' => true,
+ 'is_trusted' => true,
)) . "</li>";
$bottom_url = elgg_http_add_url_query_elements($actions_base . 'set_priority', array(
@@ -81,7 +84,8 @@ if ($reordering) {
$links .= "<li>" . elgg_view('output/url', array(
'href' => $bottom_url,
'text' => elgg_echo('bottom'),
- 'is_action' => true
+ 'is_action' => true,
+ 'is_trusted' => true,
)) . "</li>";
}
} else {
@@ -93,7 +97,8 @@ if ($reordering) {
// always let them deactivate
$options = array(
- 'is_action' => true
+ 'is_action' => true,
+ 'is_trusted' => true,
);
if ($active) {
$active_class = 'elgg-state-active';
@@ -163,7 +168,8 @@ $author = '<span>' . elgg_echo('admin:plugins:label:author') . '</span>: '
$version = htmlspecialchars($plugin->getManifest()->getVersion());
$website = elgg_view('output/url', array(
'href' => $plugin->getManifest()->getWebsite(),
- 'text' => $plugin->getManifest()->getWebsite()
+ 'text' => $plugin->getManifest()->getWebsite(),
+ 'is_trusted' => true,
));
$copyright = elgg_view('output/text', array('value' => $plugin->getManifest()->getCopyright()));
@@ -179,7 +185,8 @@ if ($files) {
$url = 'admin_plugin_text_file/' . $plugin->getID() . "/$file";
$link = elgg_view('output/url', array(
'text' => $file,
- 'href' => $url
+ 'href' => $url,
+ 'is_trusted' => true,
));
$docs .= "<li>$link</li>";
diff --git a/views/default/object/plugin/simple.php b/views/default/object/plugin/simple.php
index f4cc944f4..4d392e71a 100644
--- a/views/default/object/plugin/simple.php
+++ b/views/default/object/plugin/simple.php
@@ -49,7 +49,8 @@ foreach ($files as $file => $path) {
$url = 'admin_plugin_text_file/' . $plugin->getID() . "/$file";
$link = elgg_view('output/url', array(
'text' => $file,
- 'href' => $url
+ 'href' => $url,
+ 'is_trusted' => true,
));
$plugin_footer .= "<li>$link</li>";
diff --git a/views/default/object/widget/elements/controls.php b/views/default/object/widget/elements/controls.php
index abf2154fc..6d06d28bc 100644
--- a/views/default/object/widget/elements/controls.php
+++ b/views/default/object/widget/elements/controls.php
@@ -24,6 +24,7 @@ if ($widget->canEdit()) {
'title' => elgg_echo('widget:delete', array($widget->getTitle())),
'href' => "action/widgets/delete?guid=$widget->guid",
'is_action' => true,
+ 'is_trusted' => true,
'class' => 'elgg-widget-delete-button',
'id' => "elgg-widget-delete-button-$widget->guid"
);
diff --git a/views/default/output/tag.php b/views/default/output/tag.php
index abae9c4b2..3c002a31b 100644
--- a/views/default/output/tag.php
+++ b/views/default/output/tag.php
@@ -26,5 +26,9 @@ if (isset($vars['value'])) {
$type = "";
}
$url = elgg_get_site_url() . 'search?q=' . urlencode($vars['value']) . "&search_type=tags{$type}{$subtype}{$object}";
- echo elgg_view('output/url', array('href' => $url, 'text' => $vars['value'], 'rel' => 'tag'));
+ echo elgg_view('output/url', array(
+ 'href' => $url,
+ 'text' => $vars['value'],
+ 'rel' => 'tag',
+ ));
}
diff --git a/views/default/output/url.php b/views/default/output/url.php
index 79ab52377..81b02087d 100644
--- a/views/default/output/url.php
+++ b/views/default/output/url.php
@@ -10,7 +10,7 @@
* @uses string $vars['href'] The unencoded url string
* @uses bool $vars['encode_text'] Run $vars['text'] through htmlspecialchars() (false)
* @uses bool $vars['is_action'] Is this a link to an action (false)
- *
+ * @uses bool $vars['is_trusted'] Is this link trusted (false)
*/
$url = elgg_extract('href', $vars, null);
@@ -37,11 +37,20 @@ if ($url) {
if (elgg_extract('is_action', $vars, false)) {
$url = elgg_add_action_tokens_to_url($url, false);
- unset($vars['is_action']);
+ }
+
+ if (!elgg_extract('is_trusted', $vars, false)) {
+ if (!isset($vars['rel'])) {
+ $vars['rel'] = 'nofollow';
+ $url = strip_tags($url);
+ }
}
$vars['href'] = $url;
}
+unset($vars['is_action']);
+unset($vars['is_trusted']);
+
$attributes = elgg_format_attributes($vars);
-echo "<a $attributes>$text</a>"; \ No newline at end of file
+echo "<a $attributes>$text</a>";
diff --git a/views/default/page/elements/footer.php b/views/default/page/elements/footer.php
index 06fdb84a5..596d17bd3 100644
--- a/views/default/page/elements/footer.php
+++ b/views/default/page/elements/footer.php
@@ -17,5 +17,6 @@ echo elgg_view('output/url', array(
'href' => 'http://elgg.org',
'text' => "<img src=\"$powered_url\" alt=\"Powered by Elgg\" width=\"106\" height=\"15\" />",
'class' => '',
+ 'is_trusted' => true,
));
echo '</div>';
diff --git a/views/default/page/elements/tagcloud_block.php b/views/default/page/elements/tagcloud_block.php
index 8b67c9e37..258951c41 100644
--- a/views/default/page/elements/tagcloud_block.php
+++ b/views/default/page/elements/tagcloud_block.php
@@ -50,6 +50,7 @@ $cloud .= elgg_view_icon('tag');
$cloud .= elgg_view('output/url', array(
'href' => 'tags',
'text' => elgg_echo('tagcloud:allsitetags'),
+ 'is_trusted' => true,
));
$cloud .= '</p>';
diff --git a/views/default/page/layouts/widgets/add_button.php b/views/default/page/layouts/widgets/add_button.php
index 89e83b096..c33a45f99 100644
--- a/views/default/page/layouts/widgets/add_button.php
+++ b/views/default/page/layouts/widgets/add_button.php
@@ -10,6 +10,7 @@
'text' => elgg_echo('widgets:add'),
'class' => 'elgg-button elgg-button-action',
'rel' => 'toggle',
+ 'is_trusted' => true,
));
?>
</div>
diff --git a/views/default/river/elements/body.php b/views/default/river/elements/body.php
index c5a525733..6894b81e2 100644
--- a/views/default/river/elements/body.php
+++ b/views/default/river/elements/body.php
@@ -27,6 +27,7 @@ if ($summary === false) {
'href' => $subject->getURL(),
'text' => $subject->name,
'class' => 'elgg-river-subject',
+ 'is_trusted' => true,
));
}
@@ -52,6 +53,7 @@ if ($container instanceof ElggGroup && $container->guid != elgg_get_page_owner_g
$group_link = elgg_view('output/url', array(
'href' => $container->getURL(),
'text' => $container->name,
+ 'is_trusted' => true,
));
$group_string = elgg_echo('river:ingroup', array($group_link));
}
diff --git a/views/default/river/elements/responses.php b/views/default/river/elements/responses.php
index 8c5be6316..f6c32e142 100644
--- a/views/default/river/elements/responses.php
+++ b/views/default/river/elements/responses.php
@@ -50,6 +50,7 @@ if ($comments) {
$params = array(
'href' => $url,
'text' => elgg_echo('river:comments:more', array($num_more_comments)),
+ 'is_trusted' => true,
);
$link = elgg_view('output/url', $params);
echo "<div class=\"elgg-river-more\">$link</div>";
diff --git a/views/default/river/elements/summary.php b/views/default/river/elements/summary.php
index 4d80c29a6..84941131f 100644
--- a/views/default/river/elements/summary.php
+++ b/views/default/river/elements/summary.php
@@ -15,12 +15,14 @@ $subject_link = elgg_view('output/url', array(
'href' => $subject->getURL(),
'text' => $subject->name,
'class' => 'elgg-river-subject',
+ 'is_trusted' => true,
));
$object_link = elgg_view('output/url', array(
'href' => $object->getURL(),
'text' => $object->title ? $object->title : $object->name,
'class' => 'elgg-river-object',
+ 'is_trusted' => true,
));
$action = $item->action_type;
@@ -32,6 +34,7 @@ if ($container instanceof ElggGroup) {
$params = array(
'href' => $container->getURL(),
'text' => $container->name,
+ 'is_trusted' => true,
);
$group_link = elgg_view('output/url', $params);
$group_string = elgg_echo('river:ingroup', array($group_link));
diff --git a/views/default/river/user/default/profileiconupdate.php b/views/default/river/user/default/profileiconupdate.php
index c7f691533..90daab1a7 100644
--- a/views/default/river/user/default/profileiconupdate.php
+++ b/views/default/river/user/default/profileiconupdate.php
@@ -10,6 +10,7 @@ $subject_link = elgg_view('output/url', array(
'href' => $subject->getURL(),
'text' => $subject->name,
'class' => 'elgg-river-subject',
+ 'is_trusted' => true,
));
$string = elgg_echo('river:update:user:avatar', array($subject_link));
@@ -17,5 +18,5 @@ $string = elgg_echo('river:update:user:avatar', array($subject_link));
echo elgg_view('river/item', array(
'item' => $vars['item'],
'summary' => $string,
- 'attachments' => elgg_view_entity_icon($subject, 'tiny'),
+ 'attachments' => elgg_view_entity_icon($subject, 'tiny', array('hover' => false)),
));
diff --git a/views/default/river/user/default/profileupdate.php b/views/default/river/user/default/profileupdate.php
index a344131d6..69b69b106 100644
--- a/views/default/river/user/default/profileupdate.php
+++ b/views/default/river/user/default/profileupdate.php
@@ -9,6 +9,7 @@ $subject_link = elgg_view('output/url', array(
'href' => $subject->getURL(),
'text' => $subject->name,
'class' => 'elgg-river-subject',
+ 'is_trusted' => true,
));
$string = elgg_echo('river:update:user:profile', array($subject_link));
diff --git a/views/default/widgets/content_stats/content.php b/views/default/widgets/content_stats/content.php
index 6a652166c..56772047d 100644
--- a/views/default/widgets/content_stats/content.php
+++ b/views/default/widgets/content_stats/content.php
@@ -23,5 +23,6 @@ echo '<div class="mtm">';
echo elgg_view('output/url', array(
'href' => 'admin/statistics/overview',
'text' => elgg_echo('more'),
+ 'is_trusted' => true,
));
echo '</div>';