diff options
Diffstat (limited to 'mod')
-rw-r--r-- | mod/embed/start.php | 5 | ||||
-rw-r--r-- | mod/externalpages/start.php | 8 | ||||
-rw-r--r-- | mod/groups/actions/groups/membership/invite.php | 73 | ||||
-rw-r--r-- | mod/htmlawed/start.php | 4 | ||||
-rw-r--r-- | mod/htmlawed/tests/tags.php | 78 | ||||
-rw-r--r-- | mod/pages/actions/annotations/page/delete.php | 20 | ||||
-rw-r--r-- | mod/pages/languages/en.php | 5 | ||||
-rw-r--r-- | mod/pages/lib/pages.php | 7 | ||||
-rw-r--r-- | mod/pages/pages/pages/edit.php | 13 | ||||
-rw-r--r-- | mod/pages/start.php | 21 | ||||
-rw-r--r-- | mod/pages/views/default/annotation/page.php | 18 | ||||
-rw-r--r-- | mod/pages/views/default/object/page_top.php | 26 | ||||
-rw-r--r-- | mod/pages/views/default/pages/sidebar/history.php | 1 | ||||
-rw-r--r-- | mod/reportedcontent/views/default/object/reported_content.php | 20 | ||||
-rw-r--r-- | mod/twitter_api/languages/en.php | 2 | ||||
-rw-r--r-- | mod/twitter_api/lib/twitter_api.php | 2 | ||||
-rw-r--r-- | mod/twitter_api/start.php | 6 | ||||
-rw-r--r-- | mod/twitter_api/views/default/plugins/twitter_api/settings.php | 15 |
18 files changed, 206 insertions, 118 deletions
diff --git a/mod/embed/start.php b/mod/embed/start.php index 2ece9d2c4..e14e0efd4 100644 --- a/mod/embed/start.php +++ b/mod/embed/start.php @@ -13,6 +13,7 @@ elgg_register_event_handler('init', 'system', 'embed_init'); */ function embed_init() { elgg_extend_view('css/elgg', 'embed/css'); + elgg_extend_view('css/admin', 'embed/css'); elgg_register_plugin_hook_handler('register', 'menu:longtext', 'embed_longtext_menu'); elgg_register_plugin_hook_handler('register', 'menu:embed', 'embed_select_tab', 1000); @@ -20,7 +21,9 @@ function embed_init() { // Page handler for the modal media embed elgg_register_page_handler('embed', 'embed_page_handler'); - elgg_register_js('elgg.embed', 'js/embed/embed.js', 'footer'); + $embed_js = elgg_get_simplecache_url('js', 'embed/embed'); + elgg_register_simplecache_view('js/embed/embed'); + elgg_register_js('elgg.embed', $embed_js, 'footer'); } /** diff --git a/mod/externalpages/start.php b/mod/externalpages/start.php index 74da7f828..f0ffa6b9d 100644 --- a/mod/externalpages/start.php +++ b/mod/externalpages/start.php @@ -12,7 +12,7 @@ function expages_init() { elgg_register_page_handler('terms', 'expages_page_handler'); elgg_register_page_handler('privacy', 'expages_page_handler'); elgg_register_page_handler('expages', 'expages_page_handler'); - + // Register public external pages elgg_register_plugin_hook_handler('public_pages', 'walled_garden', 'expages_public'); @@ -65,7 +65,7 @@ function expages_page_handler($page, $handler) { $type = strtolower($handler); $title = elgg_echo("expages:$type"); - $content = elgg_view_title($title); + $header = elgg_view_title($title); $object = elgg_get_entities(array( 'type' => 'object', @@ -80,11 +80,11 @@ function expages_page_handler($page, $handler) { $content = elgg_view('expages/wrapper', array('content' => $content)); if (elgg_is_logged_in() || !elgg_get_config('walled_garden')) { - $body = elgg_view_layout('one_sidebar', array('content' => $content)); + $body = elgg_view_layout('one_sidebar', array('title' => $title, 'content' => $content)); echo elgg_view_page($title, $body); } else { elgg_load_css('elgg.walled_garden'); - $body = elgg_view_layout('walled_garden', array('content' => $content)); + $body = elgg_view_layout('walled_garden', array('content' => $header . $content)); echo elgg_view_page($title, $body, 'walled_garden'); } return true; diff --git a/mod/groups/actions/groups/membership/invite.php b/mod/groups/actions/groups/membership/invite.php index db90ecf3a..a96165b0e 100644 --- a/mod/groups/actions/groups/membership/invite.php +++ b/mod/groups/actions/groups/membership/invite.php @@ -7,43 +7,48 @@ $logged_in_user = elgg_get_logged_in_user_entity(); -$user_guid = get_input('user_guid'); -if (!is_array($user_guid)) { - $user_guid = array($user_guid); +$user_guids = get_input('user_guid'); +if (!is_array($user_guids)) { + $user_guids = array($user_guids); } $group_guid = get_input('group_guid'); +$group = get_entity($group_guid); -if (sizeof($user_guid)) { - foreach ($user_guid as $u_id) { - $user = get_entity($u_id); - $group = get_entity($group_guid); - - if ($user && $group && ($group instanceof ElggGroup) && $group->canEdit()) { - - if (!check_entity_relationship($group->guid, 'invited', $user->guid)) { - - // Create relationship - add_entity_relationship($group->guid, 'invited', $user->guid); - - // Send email - $url = elgg_normalize_url("groups/invitations/$user->username"); - $result = notify_user($user->getGUID(), $group->owner_guid, - elgg_echo('groups:invite:subject', array($user->name, $group->name)), - elgg_echo('groups:invite:body', array( - $user->name, - $logged_in_user->name, - $group->name, - $url, - )), - NULL); - if ($result) { - system_message(elgg_echo("groups:userinvited")); - } else { - register_error(elgg_echo("groups:usernotinvited")); - } - } else { - register_error(elgg_echo("groups:useralreadyinvited")); - } +if (count($user_guids) > 0 && elgg_instanceof($group, 'group') && $group->canEdit()) { + foreach ($user_guids as $guid) { + $user = get_user($guid); + if (!$user) { + continue; + } + + if (check_entity_relationship($group->guid, 'invited', $user->guid)) { + register_error(elgg_echo("groups:useralreadyinvited")); + continue; + } + + if (check_entity_relationship($user->guid, 'member', $group->guid)) { + // @todo add error message + continue; + } + + // Create relationship + add_entity_relationship($group->guid, 'invited', $user->guid); + + // Send notification + $url = elgg_normalize_url("groups/invitations/$user->username"); + $result = notify_user($user->getGUID(), $group->owner_guid, + elgg_echo('groups:invite:subject', array($user->name, $group->name)), + elgg_echo('groups:invite:body', array( + $user->name, + $logged_in_user->name, + $group->name, + $url, + )), + NULL); + if ($result) { + system_message(elgg_echo("groups:userinvited")); + } else { + register_error(elgg_echo("groups:usernotinvited")); } } } diff --git a/mod/htmlawed/start.php b/mod/htmlawed/start.php index 12b6470a3..25a70a4aa 100644 --- a/mod/htmlawed/start.php +++ b/mod/htmlawed/start.php @@ -156,10 +156,8 @@ function htmlawed_tag_post_processor($element, $attributes = false) { * Runs unit tests for htmlawed * * @return array - * */ + */ function htmlawed_test($hook, $type, $value, $params) { - global $CONFIG; - $value[] = dirname(__FILE__) . '/tests/tags.php'; return $value; } diff --git a/mod/htmlawed/tests/tags.php b/mod/htmlawed/tests/tags.php index b3914a9d6..05fe829f4 100644 --- a/mod/htmlawed/tests/tags.php +++ b/mod/htmlawed/tests/tags.php @@ -1,45 +1,47 @@ <?php + /** * Dupplicated tags in htmlawed */ class HtmLawedDuplicateTagsTest extends ElggCoreUnitTest { - /** - * Called before each test object. - */ - public function __construct() { - parent::__construct(); - } - - /** - * Called before each test method. - */ - public function setUp() { - } - - /** - * Called after each test method. - */ - public function tearDown() { - // do not allow SimpleTest to interpret Elgg notices as exceptions - $this->swallowErrors(); - } - - /** - * Called after each test object. - */ - public function __destruct() { - elgg_set_ignore_access($this->ia); - // all __destruct() code should go above here - parent::__destruct(); - } - - public function testNotDuplicateTags() { - $filter_html = '<ul><li>item</li></ul>'; - set_input('test', $filter_html); - - $expected = $filter_html; - $result = get_input('test'); - $this->assertEqual($result, $expected); - } + /** + * Called before each test object. + */ + public function __construct() { + parent::__construct(); + } + + /** + * Called before each test method. + */ + public function setUp() { + + } + + /** + * Called after each test method. + */ + public function tearDown() { + // do not allow SimpleTest to interpret Elgg notices as exceptions + $this->swallowErrors(); + } + + /** + * Called after each test object. + */ + public function __destruct() { + // all __destruct() code should go above here + parent::__destruct(); + } + + public function testNotDuplicateTags() { + $filter_html = '<ul><li>item</li></ul>'; + set_input('test', $filter_html); + + $expected = $filter_html; + $result = get_input('test'); + $this->assertEqual($result, $expected); + } + }
\ No newline at end of file diff --git a/mod/pages/actions/annotations/page/delete.php b/mod/pages/actions/annotations/page/delete.php new file mode 100644 index 000000000..156b516d2 --- /dev/null +++ b/mod/pages/actions/annotations/page/delete.php @@ -0,0 +1,20 @@ +<?php +/** + * Remove a page (revision) annotation + * + * @package ElggPages + */ + +// Make sure we can get the annotations and entity in question +$annotation_id = (int) get_input('annotation_id'); +$annotation = elgg_get_annotation_from_id($annotation_id); +$entity = get_entity($annotation->entity_guid); + +if ($annotation && $entity->canEdit() && $annotation->canEdit()) { + $annotation->delete(); + system_message(elgg_echo("pages:revision:delete:success")); +} else { + register_error(elgg_echo("pages:revision:delete:failure")); +} + +forward("pages/history/{$annotation->entity_guid}");
\ No newline at end of file diff --git a/mod/pages/languages/en.php b/mod/pages/languages/en.php index 930676b3e..13b6ece2a 100644 --- a/mod/pages/languages/en.php +++ b/mod/pages/languages/en.php @@ -25,6 +25,8 @@ $english = array( 'pages:history' => "History", 'pages:view' => "View page", 'pages:revision' => "Revision", + 'pages:current_revision' => "Current Revision", + 'pages:revert' => "Revert", 'pages:navigation' => "Navigation", 'pages:new' => "A new page", @@ -75,6 +77,9 @@ View and comment on the new page: 'pages:error:no_title' => 'You must specify a title for this page.', 'pages:delete:success' => 'The page was successfully deleted.', 'pages:delete:failure' => 'The page could not be deleted.', + 'pages:revision:delete:success' => 'The page revision was successfully deleted.', + 'pages:revision:delete:failure' => 'The page revision could not be deleted.', + 'pages:revision:not_found' => 'Cannot find this revision.', /** * Page diff --git a/mod/pages/lib/pages.php b/mod/pages/lib/pages.php index afe42b68f..7f90d53d8 100644 --- a/mod/pages/lib/pages.php +++ b/mod/pages/lib/pages.php @@ -9,7 +9,7 @@ * @param ElggObject $page * @return array */ -function pages_prepare_form_vars($page = null, $parent_guid = 0) { +function pages_prepare_form_vars($page = null, $parent_guid = 0, $revision = null) { // input names => defaults $values = array( @@ -41,6 +41,11 @@ function pages_prepare_form_vars($page = null, $parent_guid = 0) { elgg_clear_sticky_form('page'); + // load the revision annotation if requested + if ($revision instanceof ElggAnnotation && $revision->entity_guid == $page->getGUID()) { + $values['description'] = $revision->value; + } + return $values; } diff --git a/mod/pages/pages/pages/edit.php b/mod/pages/pages/pages/edit.php index 1f411b94d..a925cdc55 100644 --- a/mod/pages/pages/pages/edit.php +++ b/mod/pages/pages/pages/edit.php @@ -8,6 +8,7 @@ gatekeeper(); $page_guid = (int)get_input('guid'); +$revision = (int)get_input('annotation_id'); $page = get_entity($page_guid); if (!$page) { register_error(elgg_echo('noaccess')); @@ -28,7 +29,17 @@ elgg_push_breadcrumb(elgg_echo('edit')); $title = elgg_echo("pages:edit"); if ($page->canEdit()) { - $vars = pages_prepare_form_vars($page); + + if ($revision) { + $revision = elgg_get_annotation_from_id($revision); + if (!$revision || !($revision->entity_guid == $page_guid)) { + register_error(elgg_echo('pages:revision:not_found')); + forward(REFERER); + } + } + + $vars = pages_prepare_form_vars($page, $page->parent_guid, $revision); + $content = elgg_view_form('pages/edit', array(), $vars); } else { $content = elgg_echo("pages:noaccess"); diff --git a/mod/pages/start.php b/mod/pages/start.php index c1183c9bf..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,6 +81,9 @@ 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'); @@ -364,14 +368,3 @@ function pages_ecml_views_hook($hook, $entity_type, $return_value, $params) { return $return_value; } - -/** - * Process upgrades for the pages plugin - */ -function pages_run_upgrades() { - $path = elgg_get_plugins_path() . 'pages/upgrades/'; - $files = elgg_get_upgrade_files($path); - foreach ($files as $file) { - include "$path{$file}"; - } -} diff --git a/mod/pages/views/default/annotation/page.php b/mod/pages/views/default/annotation/page.php index a621b9281..ecb289092 100644 --- a/mod/pages/views/default/annotation/page.php +++ b/mod/pages/views/default/annotation/page.php @@ -39,4 +39,22 @@ $body = <<< HTML <p class="elgg-subtext">$subtitle</p> HTML; +if (!elgg_in_context('widgets')) { + $menu = elgg_view_menu('annotation', array( + 'annotation' => $annotation, + 'sort_by' => 'priority', + 'class' => 'elgg-menu-hz float-alt', + )); +} + +$body = <<<HTML +<div class="mbn"> + $menu + <h3>$title_link</h3> + <span class="elgg-subtext"> + $subtitle + </span> +</div> +HTML; + echo elgg_view_image_block($icon, $body);
\ No newline at end of file diff --git a/mod/pages/views/default/object/page_top.php b/mod/pages/views/default/object/page_top.php index 945a22eed..f35202993 100644 --- a/mod/pages/views/default/object/page_top.php +++ b/mod/pages/views/default/object/page_top.php @@ -60,18 +60,26 @@ if ($comments_count != 0 && !$revision) { $comments_link = ''; } -$metadata = elgg_view_menu('entity', array( - 'entity' => $vars['entity'], - 'handler' => 'pages', - 'sort_by' => 'priority', - 'class' => 'elgg-menu-hz', -)); - $subtitle = "$editor_text $comments_link $categories"; // do not show the metadata and controls in widget view -if (elgg_in_context('widgets') || $revision) { - $metadata = ''; +if (!elgg_in_context('widgets')) { + // If we're looking at a revision, display annotation menu + if ($revision) { + $metadata = elgg_view_menu('annotation', array( + 'annotation' => $annotation, + 'sort_by' => 'priority', + 'class' => 'elgg-menu-hz float-alt', + )); + } else { + // Regular entity menu + $metadata = elgg_view_menu('entity', array( + 'entity' => $vars['entity'], + 'handler' => 'pages', + 'sort_by' => 'priority', + 'class' => 'elgg-menu-hz', + )); + } } if ($full) { diff --git a/mod/pages/views/default/pages/sidebar/history.php b/mod/pages/views/default/pages/sidebar/history.php index 7077edb9a..e0e8ed11a 100644 --- a/mod/pages/views/default/pages/sidebar/history.php +++ b/mod/pages/views/default/pages/sidebar/history.php @@ -14,6 +14,7 @@ if ($vars['page']) { 'limit' => 20, 'reverse_order_by' => true ); + elgg_push_context('widgets'); $content = elgg_list_annotations($options); } diff --git a/mod/reportedcontent/views/default/object/reported_content.php b/mod/reportedcontent/views/default/object/reported_content.php index 0e733e154..cc33f54fb 100644 --- a/mod/reportedcontent/views/default/object/reported_content.php +++ b/mod/reportedcontent/views/default/object/reported_content.php @@ -57,16 +57,6 @@ if ($report->state == 'archived') { <p> <b><?php echo elgg_echo('reportedcontent:objecttitle'); ?>:</b> <?php echo $report->title; ?> - <br /> - <?php echo elgg_view('output/url', array( - 'href' => "#report-$report->guid", - 'text' => elgg_echo('reportedcontent:moreinfo'), - 'rel' => "toggle", - )); - ?> - </p> - </div> - <div class="report-details hidden" id="report-<?php echo $report->getGUID();?>"> <p> <b><?php echo elgg_echo('reportedcontent:objecturl'); ?>:</b> <?php echo elgg_view('output/url', array( @@ -77,6 +67,16 @@ if ($report->state == 'archived') { ?> </p> <p> + <?php echo elgg_view('output/url', array( + 'href' => "#report-$report->guid", + 'text' => elgg_echo('reportedcontent:moreinfo'), + 'rel' => "toggle", + )); + ?> + </p> + </div> + <div class="report-details hidden" id="report-<?php echo $report->getGUID();?>"> + <p> <b><?php echo elgg_echo('reportedcontent:reason'); ?>:</b> <?php echo $report->description; ?> </p> diff --git a/mod/twitter_api/languages/en.php b/mod/twitter_api/languages/en.php index c19a058aa..a6f4b40a5 100644 --- a/mod/twitter_api/languages/en.php +++ b/mod/twitter_api/languages/en.php @@ -25,6 +25,8 @@ $english = array( 'twitter_api:revoke:success' => 'Twitter access has been revoked.', + 'twitter_api:post_to_twitter' => "Send users' wire posts to Twitter?", + 'twitter_api:login' => 'Allow users to sign in with Twitter?', 'twitter_api:new_users' => 'Allow new users to sign up using their Twitter account even if user registration is disabled?', 'twitter_api:login:success' => 'You have been logged in.', diff --git a/mod/twitter_api/lib/twitter_api.php b/mod/twitter_api/lib/twitter_api.php index 8cb1b885e..a6d005287 100644 --- a/mod/twitter_api/lib/twitter_api.php +++ b/mod/twitter_api/lib/twitter_api.php @@ -274,7 +274,7 @@ function twitter_api_update_user_avatar($user, $file_location) { * to establish session request tokens. */ function twitter_api_authorize() { - $token = twitter_api_get_access_token(); + $token = twitter_api_get_access_token(get_input('oauth_verifier')); if (!isset($token['oauth_token']) || !isset($token['oauth_token_secret'])) { register_error(elgg_echo('twitter_api:authorize:error')); forward('settings/plugins', 'twitter_api'); diff --git a/mod/twitter_api/start.php b/mod/twitter_api/start.php index e3e866c1f..7318ac55d 100644 --- a/mod/twitter_api/start.php +++ b/mod/twitter_api/start.php @@ -35,8 +35,10 @@ function twitter_api_init() { // register Walled Garden public pages elgg_register_plugin_hook_handler('public_pages', 'walled_garden', 'twitter_api_public_pages'); - // push status messages to twitter - elgg_register_plugin_hook_handler('status', 'user', 'twitter_api_tweet'); + // push wire post messages to twitter + if (elgg_get_plugin_setting('wire_posts', 'twitter_api') == 'yes') { + elgg_register_plugin_hook_handler('status', 'user', 'twitter_api_tweet'); + } $actions = dirname(__FILE__) . '/actions/twitter_api'; elgg_register_action('twitter_api/interstitial_settings', "$actions/interstitial_settings.php", 'logged_in'); diff --git a/mod/twitter_api/views/default/plugins/twitter_api/settings.php b/mod/twitter_api/views/default/plugins/twitter_api/settings.php index 0b9afd4cf..3a3ec93a2 100644 --- a/mod/twitter_api/views/default/plugins/twitter_api/settings.php +++ b/mod/twitter_api/views/default/plugins/twitter_api/settings.php @@ -39,12 +39,27 @@ $new_users_with_twitter_view = elgg_view('input/dropdown', array( 'value' => $vars['entity']->new_users ? $vars['entity']->new_users : 'no', )); +$post_to_twitter = ''; +if (elgg_is_active_plugin('thewire')) { + $post_to_twitter_string = elgg_echo('twitter_api:post_to_twitter'); + $post_to_twitter_view = elgg_view('input/dropdown', array( + 'name' => 'params[wire_posts]', + 'options_values' => array( + 'yes' => elgg_echo('option:yes'), + 'no' => elgg_echo('option:no'), + ), + 'value' => $vars['entity']->wire_posts ? $vars['entity']->wire_posts : 'no', + )); + $post_to_twitter = "<div>$post_to_twitter_string $post_to_twitter_view</div>"; +} + $settings = <<<__HTML <div class="elgg-content-thin mtm"><p>$instructions</p></div> <div><label>$consumer_key_string</label><br /> $consumer_key_view</div> <div><label>$consumer_secret_string</label><br /> $consumer_secret_view</div> <div>$sign_on_with_twitter_string $sign_on_with_twitter_view</div> <div>$new_users_with_twitter $new_users_with_twitter_view</div> +$post_to_twitter __HTML; echo $settings; |