diff options
author | Sem <sembrestels@riseup.net> | 2014-01-22 03:37:52 +0100 |
---|---|---|
committer | Sem <sembrestels@riseup.net> | 2014-01-22 03:37:52 +0100 |
commit | 4a2ed114bb18c5363f594a380676c5654f4165a4 (patch) | |
tree | 3a37094b249c40e3e6bf122691db53115f65f8f0 /mod/pages/start.php | |
parent | 673932bc46a3918293a28c2c2fc622b3e5ff6bde (diff) | |
parent | 0dd36c458d41e77521c36ae572fe73114ad4bc5a (diff) | |
download | elgg-4a2ed114bb18c5363f594a380676c5654f4165a4.tar.gz elgg-4a2ed114bb18c5363f594a380676c5654f4165a4.tar.bz2 |
Merge tag '1.8.18' of git://github.com/Elgg/Elgg into develop
1.8.18
Conflicts:
mod/tinymce/vendor/tinymce/jscripts/tiny_mce/langs/en.js
mod/tinymce/vendor/tinymce/jscripts/tiny_mce/themes/advanced/langs/en_dlg.js
Diffstat (limited to 'mod/pages/start.php')
-rw-r--r-- | mod/pages/start.php | 48 |
1 files changed, 33 insertions, 15 deletions
diff --git a/mod/pages/start.php b/mod/pages/start.php index 6d974f122..f9c34cd85 100644 --- a/mod/pages/start.php +++ b/mod/pages/start.php @@ -28,9 +28,10 @@ function pages_init() { elgg_register_annotation_url_handler('page', 'pages_revision_url'); // Register some actions - $action_base = elgg_get_plugins_path() . 'pages/actions/pages'; - elgg_register_action("pages/edit", "$action_base/edit.php"); - elgg_register_action("pages/delete", "$action_base/delete.php"); + $action_base = elgg_get_plugins_path() . 'pages/actions'; + elgg_register_action("pages/edit", "$action_base/pages/edit.php"); + elgg_register_action("pages/delete", "$action_base/pages/delete.php"); + elgg_register_action("annotations/page/delete", "$action_base/annotations/page/delete.php"); // Extend the main css view elgg_extend_view('css/elgg', 'pages/css'); @@ -80,8 +81,13 @@ function pages_init() { // entity menu elgg_register_plugin_hook_handler('register', 'menu:entity', 'pages_entity_menu_setup'); + // hook into annotation menu + elgg_register_plugin_hook_handler('register', 'menu:annotation', 'pages_annotation_menu_setup'); + // register ecml views to parse elgg_register_plugin_hook_handler('get_views', 'ecml', 'pages_ecml_views_hook'); + + elgg_register_event_handler('upgrade', 'system', 'pages_run_upgrades'); } /** @@ -281,25 +287,37 @@ function page_notify_message($hook, $entity_type, $returnvalue, $params) { /** * Extend permissions checking to extend can-edit for write users. * - * @param unknown_type $hook - * @param unknown_type $entity_type - * @param unknown_type $returnvalue - * @param unknown_type $params + * @param string $hook + * @param string $entity_type + * @param bool $returnvalue + * @param array $params */ -function pages_write_permission_check($hook, $entity_type, $returnvalue, $params) -{ +function pages_write_permission_check($hook, $entity_type, $returnvalue, $params) { if ($params['entity']->getSubtype() == 'page' || $params['entity']->getSubtype() == 'page_top') { $write_permission = $params['entity']->write_access_id; $user = $params['user']; - if (($write_permission) && ($user)) { - // $list = get_write_access_array($user->guid); - $list = get_access_array($user->guid); // get_access_list($user->guid); - - if (($write_permission!=0) && (in_array($write_permission,$list))) { - return true; + if ($write_permission && $user) { + switch ($write_permission) { + case ACCESS_PRIVATE: + // Elgg's default decision is what we want + return; + break; + case ACCESS_FRIENDS: + $owner = $params['entity']->getOwnerEntity(); + if ($owner && $owner->isFriendsWith($user->guid)) { + return true; + } + break; + default: + $list = get_access_array($user->guid); + if (in_array($write_permission, $list)) { + // user in the access collection + return true; + } + break; } } } |