diff options
Diffstat (limited to 'mod')
129 files changed, 670 insertions, 355 deletions
diff --git a/mod/blog/actions/blog/save.php b/mod/blog/actions/blog/save.php index 8ca8ce846..8923cd0d2 100644 --- a/mod/blog/actions/blog/save.php +++ b/mod/blog/actions/blog/save.php @@ -78,11 +78,8 @@ foreach ($values as $name => $default) { case 'excerpt': if ($value) { - $value = elgg_get_excerpt($value); - } else { - $value = elgg_get_excerpt($values['description']); + $values[$name] = elgg_get_excerpt($value); } - $values[$name] = $value; break; case 'container_guid': @@ -144,7 +141,6 @@ if (!$error) { system_message(elgg_echo('blog:message:saved')); $status = $blog->status; - $db_prefix = elgg_get_config('dbprefix'); // add to river if changing status or published, regardless of new post // because we remove it for drafts. diff --git a/mod/blog/classes/ElggBlog.php b/mod/blog/classes/ElggBlog.php index ee2ec73ef..8d4401c57 100644 --- a/mod/blog/classes/ElggBlog.php +++ b/mod/blog/classes/ElggBlog.php @@ -1,6 +1,10 @@ <?php /** * Extended class to override the time_created + * + * @property string $status The published status of the blog post (published, draft) + * @property string $comments_on Whether commenting is allowed (Off, On) + * @property string $excerpt An excerpt of the blog post used when displaying the post */ class ElggBlog extends ElggObject { diff --git a/mod/blog/languages/en.php b/mod/blog/languages/en.php index 8a21c1f8d..5248a6f51 100644 --- a/mod/blog/languages/en.php +++ b/mod/blog/languages/en.php @@ -41,7 +41,6 @@ $english = array( 'blog:message:saved' => 'Blog post saved.', 'blog:error:cannot_save' => 'Cannot save blog post.', 'blog:error:cannot_write_to_container' => 'Insufficient access to save blog to group.', - 'blog:error:post_not_found' => 'This post has been removed, is invalid, or you do not have permission to view it.', 'blog:messages:warning:draft' => 'There is an unsaved draft of this post!', 'blog:edit_revision_notice' => '(Old version)', 'blog:message:deleted_post' => 'Blog post deleted.', @@ -58,6 +57,16 @@ $english = array( // notifications 'blog:newpost' => 'A new blog post', + 'blog:notification' => +' +%s made a new blog post. + +%s +%s + +View and comment on the new blog post: +%s +', // widget 'blog:widget:description' => 'Display your latest blog posts', diff --git a/mod/blog/lib/blog.php b/mod/blog/lib/blog.php index 590547a8c..43de7a646 100644 --- a/mod/blog/lib/blog.php +++ b/mod/blog/lib/blog.php @@ -22,11 +22,11 @@ function blog_get_page_content_read($guid = NULL) { $return['filter'] = ''; if (!elgg_instanceof($blog, 'object', 'blog')) { - $return['content'] = elgg_echo('blog:error:post_not_found'); + $return['content'] = elgg_echo('noaccess'); return $return; } - $return['title'] = htmlspecialchars($blog->title); + $return['title'] = $blog->title; $container = $blog->getContainerEntity(); $crumbs_title = $container->name; @@ -187,11 +187,16 @@ function blog_get_page_content_archive($owner_guid, $lower = 0, $upper = 0) { $now = time(); - $user = get_user($owner_guid); + $owner = get_entity($owner_guid); elgg_set_page_owner_guid($owner_guid); - $crumbs_title = $user->name; - elgg_push_breadcrumb($crumbs_title, "blog/owner/{$user->username}"); + $crumbs_title = $owner->name; + if (elgg_instanceof($owner, 'user')) { + $url = "blog/owner/{$owner->username}"; + } else { + $url = "blog/group/$owner->guid/all"; + } + elgg_push_breadcrumb($crumbs_title, $url); elgg_push_breadcrumb(elgg_echo('blog:archives')); if ($lower) { @@ -209,7 +214,7 @@ function blog_get_page_content_archive($owner_guid, $lower = 0, $upper = 0) { ); if ($owner_guid) { - $options['owner_guid'] = $owner_guid; + $options['container_guid'] = $owner_guid; } // admin / owners can see any posts diff --git a/mod/blog/start.php b/mod/blog/start.php index fa57e7b96..9faf1794e 100644 --- a/mod/blog/start.php +++ b/mod/blog/start.php @@ -60,7 +60,7 @@ function blog_init() { elgg_extend_view('groups/tool_latest', 'blog/group_module'); // add a blog widget - elgg_register_widget_type('blog', elgg_echo('blog'), elgg_echo('blog:widget:description'), 'profile'); + elgg_register_widget_type('blog', elgg_echo('blog'), elgg_echo('blog:widget:description')); // register actions $action_path = elgg_get_plugins_path() . 'blog/actions/blog'; @@ -125,6 +125,7 @@ function blog_page_handler($page) { $params = blog_get_page_content_archive($user->guid, $page[2], $page[3]); break; case 'view': + case 'read': // Elgg 1.7 compatibility $params = blog_get_page_content_read($page[1]); break; case 'add': @@ -136,7 +137,11 @@ function blog_page_handler($page) { $params = blog_get_page_content_edit($page_type, $page[1], $page[2]); break; case 'group': - $params = blog_get_page_content_list($page[1]); + if ($page[2] == 'all') { + $params = blog_get_page_content_list($page[1]); + } else { + $params = blog_get_page_content_archive($page[1], $page[3], $page[4]); + } break; case 'all': $params = blog_get_page_content_list(); @@ -222,6 +227,33 @@ function blog_entity_menu_setup($hook, $type, $return, $params) { } /** + * Set the notification message body + * + * @param string $hook Hook name + * @param string $type Hook type + * @param string $message The current message body + * @param array $params Parameters about the blog posted + * @return string + */ +function blog_notify_message($hook, $type, $message, $params) { + $entity = $params['entity']; + $to_entity = $params['to_entity']; + $method = $params['method']; + if (elgg_instanceof($entity, 'object', 'blog')) { + $descr = $entity->excerpt; + $title = $entity->title; + $owner = $entity->getOwnerEntity(); + return elgg_echo('blog:notification', array( + $owner->name, + $title, + $descr, + $entity->getURL() + )); + } + return null; +} + +/** * Register blogs with ECML. */ function blog_ecml_views_hook($hook, $entity_type, $return_value, $params) { @@ -234,7 +266,7 @@ function blog_ecml_views_hook($hook, $entity_type, $return_value, $params) { * Upgrade from 1.7 to 1.8. */ function blog_run_upgrades($event, $type, $details) { - $blog_upgrade_version = get_plugin_setting('upgrade_version', 'blogs'); + $blog_upgrade_version = elgg_get_plugin_setting('upgrade_version', 'blogs'); if (!$blog_upgrade_version) { // When upgrading, check if the ElggBlog class has been registered as this @@ -243,23 +275,6 @@ function blog_run_upgrades($event, $type, $details) { add_subtype('object', 'blog', 'ElggBlog'); } - // only run this on the first migration to 1.8 - // add excerpt to all blogs that don't have it. - $ia = elgg_set_ignore_access(true); - $options = array( - 'type' => 'object', - 'subtype' => 'blog' - ); - - $blogs = new ElggBatch('elgg_get_entities', $options); - foreach ($blogs as $blog) { - if (!$blog->excerpt) { - $blog->excerpt = elgg_get_excerpt($blog->description); - } - } - - elgg_set_ignore_access($ia); - elgg_set_plugin_setting('upgrade_version', 1, 'blogs'); } } diff --git a/mod/blog/views/default/blog/group_module.php b/mod/blog/views/default/blog/group_module.php index 028827178..6082cdafd 100644 --- a/mod/blog/views/default/blog/group_module.php +++ b/mod/blog/views/default/blog/group_module.php @@ -20,11 +20,12 @@ $options = array( 'type' => 'object', 'subtype' => 'blog', 'container_guid' => elgg_get_page_owner_guid(), + 'metadata_name_value_pairs' => array('name' => 'status', 'value' => 'published'), 'limit' => 6, 'full_view' => false, 'pagination' => false, ); -$content = elgg_list_entities($options); +$content = elgg_list_entities_from_metadata($options); elgg_pop_context(); if (!$content) { diff --git a/mod/blog/views/default/blog/sidebar.php b/mod/blog/views/default/blog/sidebar.php index 97a23c17e..0ae2b431c 100644 --- a/mod/blog/views/default/blog/sidebar.php +++ b/mod/blog/views/default/blog/sidebar.php @@ -18,7 +18,7 @@ if ($vars['page'] == 'all') { } // only users can have archives at present -if (elgg_instanceof(elgg_get_page_owner_entity(), 'user')) { +if ($vars['page'] == 'owner' || $vars['page'] == 'group') { echo elgg_view('blog/sidebar/archives', $vars); } diff --git a/mod/blog/views/default/blog/sidebar/archives.php b/mod/blog/views/default/blog/sidebar/archives.php index 3aa3db44f..3d8f28ca4 100644 --- a/mod/blog/views/default/blog/sidebar/archives.php +++ b/mod/blog/views/default/blog/sidebar/archives.php @@ -6,6 +6,12 @@ $loggedin_user = elgg_get_logged_in_user_entity(); $page_owner = elgg_get_page_owner_entity(); +if (elgg_instanceof($page_owner, 'user')) { + $url_segment = 'blog/archive/' . $page_owner->username; +} else { + $url_segment = 'blog/group/' . $page_owner->getGUID() . '/archive'; +} + // This is a limitation of the URL schema. if ($page_owner && $vars['page'] != 'friends') { $dates = get_entity_dates('object', 'blog', $page_owner->getGUID()); @@ -13,11 +19,11 @@ if ($page_owner && $vars['page'] != 'friends') { if ($dates) { $title = elgg_echo('blog:archives'); $content = '<ul class="blog-archives">'; - foreach($dates as $date) { + foreach ($dates as $date) { $timestamplow = mktime(0, 0, 0, substr($date,4,2) , 1, substr($date, 0, 4)); $timestamphigh = mktime(0, 0, 0, ((int) substr($date, 4, 2)) + 1, 1, substr($date, 0, 4)); - $link = elgg_get_site_url() . 'blog/archive/' . $page_owner->username . '/' . $timestamplow . '/' . $timestamphigh; + $link = elgg_get_site_url() . $url_segment . '/' . $timestamplow . '/' . $timestamphigh; $month = elgg_echo('date:month:' . substr($date, 4, 2), array(substr($date, 0, 4))); $content .= "<li><a href=\"$link\" title=\"$month\">$month</a></li>"; } diff --git a/mod/blog/views/default/object/blog.php b/mod/blog/views/default/object/blog.php index 3525b3d48..4403a6006 100644 --- a/mod/blog/views/default/object/blog.php +++ b/mod/blog/views/default/object/blog.php @@ -16,6 +16,9 @@ $owner = $blog->getOwnerEntity(); $container = $blog->getContainerEntity(); $categories = elgg_view('output/categories', $vars); $excerpt = $blog->excerpt; +if (!$excerpt) { + $excerpt = elgg_get_excerpt($blog->description); +} $owner_icon = elgg_view_entity_icon($owner, 'tiny'); $owner_link = elgg_view('output/url', array( @@ -24,7 +27,6 @@ $owner_link = elgg_view('output/url', array( 'is_trusted' => true, )); $author_text = elgg_echo('byline', array($owner_link)); -$tags = elgg_view('output/tags', array('tags' => $blog->tags)); $date = elgg_view_friendly_time($blog->time_created); // The "on" status changes for comments, so best to check for !Off @@ -71,7 +73,6 @@ if ($full) { 'title' => false, 'metadata' => $metadata, 'subtitle' => $subtitle, - 'tags' => $tags, ); $params = $params + $vars; $summary = elgg_view('object/elements/summary', $params); @@ -89,7 +90,6 @@ if ($full) { 'entity' => $blog, 'metadata' => $metadata, 'subtitle' => $subtitle, - 'tags' => $tags, 'content' => $excerpt, ); $params = $params + $vars; diff --git a/mod/bookmarks/actions/bookmarks/save.php b/mod/bookmarks/actions/bookmarks/save.php index f240c4b26..3ca6bef32 100644 --- a/mod/bookmarks/actions/bookmarks/save.php +++ b/mod/bookmarks/actions/bookmarks/save.php @@ -5,8 +5,6 @@ * @package Bookmarks */ -gatekeeper(); - $title = strip_tags(get_input('title')); $description = get_input('description'); $address = get_input('address'); diff --git a/mod/bookmarks/languages/en.php b/mod/bookmarks/languages/en.php index 2c589c207..d4980280d 100644 --- a/mod/bookmarks/languages/en.php +++ b/mod/bookmarks/languages/en.php @@ -23,10 +23,19 @@ $english = array( 'bookmarks:more' => "More", 'bookmarks:with' => "Share with", 'bookmarks:new' => "A new bookmark", - 'bookmarks:via' => "via bookmarks", 'bookmarks:address' => "Address of the bookmark", 'bookmarks:none' => 'No bookmarks', + 'bookmarks:notification' => +'%s added a new bookmark: + +%s - %s +%s + +View and comment on the new bookmark: +%s +', + 'bookmarks:delete:confirm' => "Are you sure you want to delete this resource?", 'bookmarks:numbertodisplay' => 'Number of bookmarks to display', diff --git a/mod/bookmarks/pages/bookmarks/all.php b/mod/bookmarks/pages/bookmarks/all.php index f57776752..bdb8fc793 100644 --- a/mod/bookmarks/pages/bookmarks/all.php +++ b/mod/bookmarks/pages/bookmarks/all.php @@ -10,12 +10,10 @@ elgg_push_breadcrumb(elgg_echo('bookmarks')); elgg_register_title_button(); -$offset = (int)get_input('offset', 0); $content = elgg_list_entities(array( 'type' => 'object', 'subtype' => 'bookmarks', 'limit' => 10, - 'offset' => $offset, 'full_view' => false, 'view_toggle_type' => false )); diff --git a/mod/bookmarks/pages/bookmarks/owner.php b/mod/bookmarks/pages/bookmarks/owner.php index 7f55e08de..a024ff352 100644 --- a/mod/bookmarks/pages/bookmarks/owner.php +++ b/mod/bookmarks/pages/bookmarks/owner.php @@ -14,13 +14,11 @@ elgg_push_breadcrumb($page_owner->name); elgg_register_title_button(); -$offset = (int)get_input('offset', 0); $content .= elgg_list_entities(array( 'type' => 'object', 'subtype' => 'bookmarks', 'container_guid' => $page_owner->guid, 'limit' => 10, - 'offset' => $offset, 'full_view' => false, 'view_toggle_type' => false )); diff --git a/mod/bookmarks/pages/bookmarks/view.php b/mod/bookmarks/pages/bookmarks/view.php index 2439d2ee8..c819b8b41 100644 --- a/mod/bookmarks/pages/bookmarks/view.php +++ b/mod/bookmarks/pages/bookmarks/view.php @@ -6,6 +6,10 @@ */ $bookmark = get_entity(get_input('guid')); +if (!$bookmark) { + register_error(elgg_echo('noaccess')); + forward(''); +} $page_owner = elgg_get_page_owner_entity(); diff --git a/mod/bookmarks/start.php b/mod/bookmarks/start.php index 21a2d8940..56bac984a 100644 --- a/mod/bookmarks/start.php +++ b/mod/bookmarks/start.php @@ -245,21 +245,15 @@ function bookmarks_notify_message($hook, $entity_type, $returnvalue, $params) { if (($entity instanceof ElggEntity) && ($entity->getSubtype() == 'bookmarks')) { $descr = $entity->description; $title = $entity->title; - global $CONFIG; - $url = elgg_get_site_url() . "view/" . $entity->guid; - if ($method == 'sms') { - $owner = $entity->getOwnerEntity(); - return $owner->name . ' ' . elgg_echo("bookmarks:via") . ': ' . $url . ' (' . $title . ')'; - } - if ($method == 'email') { - $owner = $entity->getOwnerEntity(); - return $owner->name . ' ' . elgg_echo("bookmarks:via") . ': ' . $title . "\n\n" . $descr . "\n\n" . $entity->getURL(); - } - if ($method == 'web') { - $owner = $entity->getOwnerEntity(); - return $owner->name . ' ' . elgg_echo("bookmarks:via") . ': ' . $title . "\n\n" . $descr . "\n\n" . $entity->getURL(); - } - + $owner = $entity->getOwnerEntity(); + + return elgg_echo('bookmarks:notification', array( + $owner->name, + $title, + $entity->address, + $descr, + $entity->getURL() + )); } return null; } diff --git a/mod/bookmarks/views/default/object/bookmarks.php b/mod/bookmarks/views/default/object/bookmarks.php index 89a0d03e0..83bae2b13 100644 --- a/mod/bookmarks/views/default/object/bookmarks.php +++ b/mod/bookmarks/views/default/object/bookmarks.php @@ -27,7 +27,6 @@ $owner_link = elgg_view('output/url', array( )); $author_text = elgg_echo('byline', array($owner_link)); -$tags = elgg_view('output/tags', array('tags' => $bookmark->tags)); $date = elgg_view_friendly_time($bookmark->time_created); $comments_count = $bookmark->countComments(); @@ -64,7 +63,6 @@ if ($full && !elgg_in_context('gallery')) { 'title' => false, 'metadata' => $metadata, 'subtitle' => $subtitle, - 'tags' => $tags, ); $params = $params + $vars; $summary = elgg_view('object/elements/summary', $params); @@ -120,7 +118,6 @@ HTML; 'entity' => $bookmark, 'metadata' => $metadata, 'subtitle' => $subtitle, - 'tags' => $tags, 'content' => $content, ); $params = $params + $vars; diff --git a/mod/categories/languages/en.php b/mod/categories/languages/en.php index eaa65b13e..422fe81a4 100644 --- a/mod/categories/languages/en.php +++ b/mod/categories/languages/en.php @@ -9,7 +9,7 @@ $english = array( 'categories:explanation' => 'To set some predefined site-wide categories that will be used throughout your system, enter them below, separated with commas. Compatible tools will then display them when the user creates or edits content.', 'categories:save:success' => 'Site categories were successfully saved.', 'categories:results' => "Results for the site category: %s", - 'categories:on_activate_reminder' => "Site-wide Cateogires won't work until you add categories. <a href=\"%s\">Add categories now.</a>", + 'categories:on_activate_reminder' => "Site-wide Categories won't work until you add categories. <a href=\"%s\">Add categories now.</a>", ); add_translation("en", $english);
\ No newline at end of file diff --git a/mod/developers/actions/developers/settings.php b/mod/developers/actions/developers/settings.php index 811fd22c0..7c91e2f5f 100644 --- a/mod/developers/actions/developers/settings.php +++ b/mod/developers/actions/developers/settings.php @@ -11,10 +11,10 @@ if (get_input('simple_cache')) { elgg_disable_simplecache(); } -if (get_input('view_path_cache')) { - elgg_enable_filepath_cache(); +if (get_input('system_cache')) { + elgg_enable_system_cache(); } else { - elgg_disable_filepath_cache(); + elgg_disable_system_cache(); } $debug = get_input('debug_level'); diff --git a/mod/developers/languages/en.php b/mod/developers/languages/en.php index a2682363c..262759e23 100644 --- a/mod/developers/languages/en.php +++ b/mod/developers/languages/en.php @@ -9,15 +9,16 @@ $english = array( 'admin:develop_tools' => 'Tools', 'admin:develop_tools:preview' => 'Theming Sandbox', 'admin:develop_tools:inspect' => 'Inspect', + 'admin:develop_tools:unit_tests' => 'Unit Tests', 'admin:developers' => 'Developers', 'admin:developers:settings' => 'Settings', // settings 'elgg_dev_tools:settings:explanation' => 'Control your development and debugging settings below. Some of these settings are also available on other admin pages.', 'developers:label:simple_cache' => 'Use simple cache', - 'developers:help:simple_cache' => 'Turn off the file cache when developing. Otherwise, changes to your views (including css) will be ignored.', - 'developers:label:view_path_cache' => 'Use view path cache', - 'developers:help:view_path_cache' => 'Turn this off when developing. Otherwise, new views in your plugins will not be registered.', + 'developers:help:simple_cache' => 'Turn off this cache when developing. Otherwise, changes to your CSS and JavaScript will be ignored.', + 'developers:label:system_cache' => 'Use system cache', + 'developers:help:system_cache' => 'Turn this off when developing. Otherwise, changes in your plugins will not be registered.', 'developers:label:debug_level' => "Trace level", 'developers:help:debug_level' => "This controls the amount of information logged. See elgg_log() for more information.", 'developers:label:display_errors' => 'Display fatal PHP errors', @@ -54,6 +55,11 @@ $english = array( 'theme_preview:navigation' => 'Navigation', 'theme_preview:typography' => 'Typography', + // unit tests + 'developers:unit_tests:description' => 'Elgg has unit and integration tests for detecting bugs in its core classes and functions.', + 'developers:unit_tests:warning' => 'Warning: Do Not Run These Tests on a Production Site. They can corrupt your database.', + 'developers:unit_tests:run' => 'Run', + // status messages 'developers:settings:success' => 'Settings saved', ); diff --git a/mod/developers/start.php b/mod/developers/start.php index 79ec0655a..d77a96b36 100644 --- a/mod/developers/start.php +++ b/mod/developers/start.php @@ -63,6 +63,7 @@ function developers_setup_menu() { if (elgg_in_context('admin')) { elgg_register_admin_menu_item('develop', 'inspect', 'develop_tools'); elgg_register_admin_menu_item('develop', 'preview', 'develop_tools'); + elgg_register_admin_menu_item('develop', 'unit_tests', 'develop_tools'); elgg_register_menu_item('page', array( 'name' => 'dev_settings', @@ -76,8 +77,8 @@ function developers_setup_menu() { } /** -* Clear all the strings so the raw descriptor strings are displayed -*/ + * Clear all the strings so the raw descriptor strings are displayed + */ function developers_clear_strings() { global $CONFIG; @@ -121,8 +122,8 @@ function developers_wrap_views($hook, $type, $result, $params) { } /** -* Log the events and plugin hooks -*/ + * Log the events and plugin hooks + */ function developers_log_events($name, $type) { // filter out some very common events diff --git a/mod/developers/views/default/admin/develop_tools/unit_tests.php b/mod/developers/views/default/admin/develop_tools/unit_tests.php new file mode 100644 index 000000000..81658e88b --- /dev/null +++ b/mod/developers/views/default/admin/develop_tools/unit_tests.php @@ -0,0 +1,17 @@ +<?php +/** + * Elgg unit and integration tests + * + */ + +echo '<p>' . elgg_echo('developers:unit_tests:description') . '</p>'; +echo '<p><strong>' . elgg_echo('developers:unit_tests:warning') . '</strong></p>'; + +// create a button to run tests +$params = array( + 'text' => elgg_echo('developers:unit_tests:run'), + 'href' => 'engine/tests/suite.php', + 'class' => 'elgg-button elgg-button-submit', + 'is_trusted' => true, +); +echo '<p>' . elgg_view('output/url', $params) . '</p>'; diff --git a/mod/developers/views/default/admin/developers/settings.php b/mod/developers/views/default/admin/developers/settings.php index dcc0a3e4f..459cbabad 100644 --- a/mod/developers/views/default/admin/developers/settings.php +++ b/mod/developers/views/default/admin/developers/settings.php @@ -10,10 +10,10 @@ $data = array( 'checked' => elgg_get_config('simplecache_enabled') == 1, ), - 'view_path_cache' => array( + 'system_cache' => array( 'type' => 'checkbox', 'value' => 1, - 'checked' => elgg_get_config('viewpath_cache_enabled') == 1, + 'checked' => elgg_get_config('system_cache_enabled') == 1, ), 'display_errors' => array( diff --git a/mod/developers/views/default/theme_preview/components.php b/mod/developers/views/default/theme_preview/components.php index ab5a6e941..45f520f2c 100644 --- a/mod/developers/views/default/theme_preview/components.php +++ b/mod/developers/views/default/theme_preview/components.php @@ -3,10 +3,17 @@ * CSS Objects: list, module, image_block, table, messages */ -echo elgg_view_module('info', 'Image Block (.elgg-image-block)', elgg_view('theme_preview/components/image_block')); +$body = elgg_view('theme_preview/components/image_block'); +echo elgg_view_module('info', 'Image Block (.elgg-image-block)', $body); -echo elgg_view_module('info', 'List (.elgg-list)', elgg_view('theme_preview/components/list')); +$body = elgg_view('theme_preview/components/list'); +echo elgg_view_module('info', 'List (.elgg-list)', $body); -echo elgg_view_module('info', 'Table (.elgg-table)', elgg_view('theme_preview/components/table')); +$body = elgg_view('theme_preview/components/table', array('class' => 'elgg-table')); +echo elgg_view_module('info', 'Table (.elgg-table)', $body); -echo elgg_view_module('info', 'Messages (.elgg-message)', elgg_view('theme_preview/components/messages')); +$body = elgg_view('theme_preview/components/table', array('class' => 'elgg-table-alt')); +echo elgg_view_module('info', 'Table Alternate (.elgg-table-alt)', $body); + +$body = elgg_view('theme_preview/components/messages'); +echo elgg_view_module('info', 'Messages (.elgg-message)', $body); diff --git a/mod/developers/views/default/theme_preview/components/table.php b/mod/developers/views/default/theme_preview/components/table.php index e9ef32143..8b8b13e76 100644 --- a/mod/developers/views/default/theme_preview/components/table.php +++ b/mod/developers/views/default/theme_preview/components/table.php @@ -1,4 +1,4 @@ -<table class="elgg-table">
+<table class="<?php echo $vars['class']; ?>">
<?php
echo "<thead><tr><th>column 1</th><th>column 2</th></tr></thead>";
for ($i = 1; $i < 5; $i++) {
diff --git a/mod/diagnostics/languages/en.php b/mod/diagnostics/languages/en.php index c4e337b50..54859941d 100644 --- a/mod/diagnostics/languages/en.php +++ b/mod/diagnostics/languages/en.php @@ -1,71 +1,45 @@ <?php - /** - * Elgg diagnostics language pack. - * - * @package ElggDiagnostics - */ - - $english = array( - - 'admin:develop_utilities:diagnostics' => 'System Diagnostics', - 'diagnostics' => 'System diagnostics', - 'diagnostics:report' => 'Diagnostics Report', - 'diagnostics:unittester' => 'Unit Tests', - - 'diagnostics:description' => 'The following diagnostic report is useful for diagnosing any problems with Elgg, and should be attached to any bug reports you file.', - 'diagnostics:unittester:description' => 'The following are diagnostic tests which are registered by plugins and may be performed in order to debug parts of the Elgg framework.', - - 'diagnostics:unittester:description' => 'Unit tests check Elgg Core for broken or buggy APIs.', - 'diagnostics:unittester:debug' => 'The site must be in debug mode to run unit tests.', - 'diagnostics:unittester:warning' => 'WARNING: These tests can leave behind debugging objects in your database.<br />DO NOT USE ON A PRODUCTION SITE!', - - 'diagnostics:test:executetest' => 'Execute test', - 'diagnostics:test:executeall' => 'Execute All', - 'diagnostics:unittester:notests' => 'Sorry, there are no unit test modules currently installed.', - 'diagnostics:unittester:testnotfound' => 'Sorry, the report could not be generated because that test was not found', - - 'diagnostics:unittester:testresult:nottestclass' => 'FAIL - Result not a test class', - 'diagnostics:unittester:testresult:fail' => 'FAIL', - 'diagnostics:unittester:testresult:success' => 'SUCCESS', - - 'diagnostics:unittest:example' => 'Example unit test, only available in debug mode.', - - 'diagnostics:unittester:report' => 'Test report for %s', - - 'diagnostics:download' => 'Download', - - - 'diagnostics:header' => '======================================================================== +/** + * Elgg diagnostics language pack. + * + * @package ElggDiagnostics + */ + +$english = array( + 'admin:administer_utilities:diagnostics' => 'System Diagnostics', + 'diagnostics' => 'System diagnostics', + 'diagnostics:report' => 'Diagnostics Report', + 'diagnostics:description' => 'The following diagnostic report can be useful for diagnosing problems with Elgg. The developers of Elgg may request that you attach it to a bug report.', + 'diagnostics:download' => 'Download', + 'diagnostics:header' => '======================================================================== Elgg Diagnostic Report Generated %s by %s ======================================================================== ', - 'diagnostics:report:basic' => ' + 'diagnostics:report:basic' => ' Elgg Release %s, version %s ------------------------------------------------------------------------', - 'diagnostics:report:php' => ' + 'diagnostics:report:php' => ' PHP info: %s ------------------------------------------------------------------------', - 'diagnostics:report:plugins' => ' + 'diagnostics:report:plugins' => ' Installed plugins and details: %s ------------------------------------------------------------------------', - 'diagnostics:report:md5' => ' + 'diagnostics:report:md5' => ' Installed files and checksums: %s ------------------------------------------------------------------------', - 'diagnostics:report:globals' => ' + 'diagnostics:report:globals' => ' Global variables: %s ------------------------------------------------------------------------', +); - ); - - add_translation("en",$english); -?>
\ No newline at end of file +add_translation("en", $english); diff --git a/mod/diagnostics/start.php b/mod/diagnostics/start.php index 0bcc08bd9..55842800a 100644 --- a/mod/diagnostics/start.php +++ b/mod/diagnostics/start.php @@ -13,7 +13,7 @@ elgg_register_event_handler('init', 'system', 'diagnostics_init'); function diagnostics_init() { // Add admin menu item - elgg_register_admin_menu_item('develop', 'diagnostics', 'develop_utilities'); + elgg_register_admin_menu_item('administer', 'diagnostics', 'administer_utilities'); // Register some actions $file = elgg_get_plugins_path() . "diagnostics/actions/download.php"; diff --git a/mod/diagnostics/views/default/admin/administer_utilities/diagnostics.php b/mod/diagnostics/views/default/admin/administer_utilities/diagnostics.php new file mode 100644 index 000000000..c7ff3d5fc --- /dev/null +++ b/mod/diagnostics/views/default/admin/administer_utilities/diagnostics.php @@ -0,0 +1,17 @@ +<?php +/** + * Diagnostics admin page + */ + +$diagnostics_title = elgg_echo('diagnostics:report'); +$diagnostics = '<p>' . elgg_echo('diagnostics:description') .'</p>'; +$params = array( + 'text' => elgg_echo('diagnostics:download'), + 'href' => 'action/diagnostics/download', + 'class' => 'elgg-button elgg-button-submit', + 'is_action' => true, + 'is_trusted' => true, +); +$diagnostics .= '<p>' . elgg_view('output/url', $params) . '</p>'; + +echo elgg_view_module('inline', $diagnostics_title, $diagnostics, array('class' => 'elgg-form-settings')); diff --git a/mod/diagnostics/views/default/admin/develop_utilities/diagnostics.php b/mod/diagnostics/views/default/admin/develop_utilities/diagnostics.php deleted file mode 100644 index 89e235279..000000000 --- a/mod/diagnostics/views/default/admin/develop_utilities/diagnostics.php +++ /dev/null @@ -1,38 +0,0 @@ -<?php -/** - * Diagnostics admin page - */ - -$diagnostics_title = elgg_echo('diagnostics:report'); -$diagnostics = '<p>' . elgg_echo('diagnostics:description') .'</p>'; -$params = array( - 'text' => elgg_echo('diagnostics:download'), - 'href' => 'action/diagnostics/download', - 'class' => 'elgg-button elgg-button-submit', - 'is_action' => true, - 'is_trusted' => true, -); -$diagnostics .= '<p>' . elgg_view('output/url', $params) . '</p>'; - -// unit tests -$unit_tests_title = elgg_echo('diagnostics:unittester'); -$unit_tests .= '<p>' . elgg_echo('diagnostics:unittester:description') . '</p>'; -$unit_tests .= '<p>' . elgg_echo('diagnostics:unittester:warning') . '</p>'; - -if (elgg_get_config('debug')) { - // create a button to run tests - $params = array( - 'text' => elgg_echo('diagnostics:test:executeall'), - 'href' => 'engine/tests/suite.php', - 'class' => 'elgg-button elgg-button-submit', - 'is_trusted' => true, - ); - $unit_tests .= '<p>' . elgg_view('output/url', $params) . '</p>'; -} else { - // no tests when not in debug mode - $unit_tests .= elgg_echo('diagnostics:unittester:debug'); -} - -// display admin body -echo elgg_view_module('inline', $diagnostics_title, $diagnostics, array('class' => 'elgg-form-settings')); -echo elgg_view_module('inline', $unit_tests_title, $unit_tests, array('class' => 'elgg-form-settings')); diff --git a/mod/embed/manifest.xml b/mod/embed/manifest.xml index 46ab2df9e..81ca9194e 100644 --- a/mod/embed/manifest.xml +++ b/mod/embed/manifest.xml @@ -13,10 +13,10 @@ <type>elgg_release</type> <version>1.8</version> </requires> - <suggests> + <requires> <type>plugin</type> <name>file</name> <version>1.8.1</version> - </suggests> + </requires> <activate_on_install>true</activate_on_install> </plugin_manifest> diff --git a/mod/embed/views/default/embed/layout.php b/mod/embed/views/default/embed/layout.php index e906160b1..1ca263037 100644 --- a/mod/embed/views/default/embed/layout.php +++ b/mod/embed/views/default/embed/layout.php @@ -21,6 +21,9 @@ if ($selected->getData('view')) { } } +$tab .= elgg_view('graphics/ajax_loader', array( + 'class' => 'embed-throbber mtl', +)); $container_info = elgg_view('input/hidden', array( 'name' => 'embed_container_guid', diff --git a/mod/embed/views/default/js/embed/embed.php b/mod/embed/views/default/js/embed/embed.php index 5fd534a09..0c8442292 100644 --- a/mod/embed/views/default/js/embed/embed.php +++ b/mod/embed/views/default/js/embed/embed.php @@ -85,11 +85,14 @@ elgg.embed.submit = function(event) { } } }, - error: function(xhr, status) { - // nothing for now + error : function(xhr, status) { + // @todo nothing for now } }); + $('.elgg-form-file-upload').hide(); + $('.embed-throbber').show(); + // this was bubbling up the DOM causing a submission event.preventDefault(); event.stopPropagation(); diff --git a/mod/embed/views/default/navigation/menu/embed.php b/mod/embed/views/default/navigation/menu/embed.php index 1a6a18f05..bca673f59 100644 --- a/mod/embed/views/default/navigation/menu/embed.php +++ b/mod/embed/views/default/navigation/menu/embed.php @@ -10,7 +10,7 @@ foreach ($vars['menu']['default'] as $menu_item) { $tabs[] = array( 'title' => $menu_item->getText(), 'url' => 'embed/tab/' . $menu_item->getName(), - 'url_class' => 'embed-section', + 'link_class' => 'embed-section', 'selected' => $menu_item->getSelected(), ); } diff --git a/mod/externalpages/actions/edit.php b/mod/externalpages/actions/edit.php index edfffe168..184aa3d82 100644 --- a/mod/externalpages/actions/edit.php +++ b/mod/externalpages/actions/edit.php @@ -1,18 +1,28 @@ <?php /** - * Elgg external pages: add/edit + * Elgg external pages: create or update * */ -// Get input data +// Get input data and don't filter the content $contents = get_input('expagescontent', '', false); $type = get_input('content_type'); -$previous_guid = get_input('expage_guid'); +$guid = get_input('guid'); -// create object to hold the page details -$expages = new ElggObject(); -$expages->subtype = $type; -$expages->owner_guid = get_loggedin_userid(); +if ($guid) { + // update + $expages = get_entity($guid); + if (!$expages) { + register_error(elgg_echo("expages:error")); + forward(REFERER); + } +} else { + // create + $expages = new ElggObject(); + $expages->subtype = $type; +} + +$expages->owner_guid = elgg_get_logged_in_user_guid(); $expages->access_id = ACCESS_PUBLIC; $expages->title = $type; $expages->description = $contents; diff --git a/mod/externalpages/start.php b/mod/externalpages/start.php index 152a8b4d9..74da7f828 100644 --- a/mod/externalpages/start.php +++ b/mod/externalpages/start.php @@ -77,9 +77,16 @@ function expages_page_handler($page, $handler) { } else { $content .= elgg_echo("expages:notset"); } + $content = elgg_view('expages/wrapper', array('content' => $content)); - $body = elgg_view_layout("one_sidebar", array('content' => $content)); - echo elgg_view_page($title, $body); + if (elgg_is_logged_in() || !elgg_get_config('walled_garden')) { + $body = elgg_view_layout('one_sidebar', array('content' => $content)); + echo elgg_view_page($title, $body); + } else { + elgg_load_css('elgg.walled_garden'); + $body = elgg_view_layout('walled_garden', array('content' => $content)); + echo elgg_view_page($title, $body, 'walled_garden'); + } return true; } diff --git a/mod/externalpages/views/default/expages/menu.php b/mod/externalpages/views/default/expages/menu.php index 6ed521629..831be9125 100644 --- a/mod/externalpages/views/default/expages/menu.php +++ b/mod/externalpages/views/default/expages/menu.php @@ -7,8 +7,8 @@ $type = $vars['type']; - //set the url - $url = $vars['url'] . "admin/site/expages?type="; +//set the url +$url = $vars['url'] . "admin/site/expages?type="; $pages = array('about', 'terms', 'privacy'); $tabs = array(); diff --git a/mod/externalpages/views/default/expages/wrapper.php b/mod/externalpages/views/default/expages/wrapper.php new file mode 100644 index 000000000..8eb0b2f84 --- /dev/null +++ b/mod/externalpages/views/default/expages/wrapper.php @@ -0,0 +1,16 @@ +<?php +/** + * Wrapper for site pages content area + * + * @uses $vars['content'] + */ + +echo $vars['content']; + +echo '<div class="mtm">'; +echo elgg_view('output/url', array( + 'text' => 'Back', + 'href' => $_SERVER['HTTP_REFERER'], + 'class' => 'float-alt' +)); +echo '</div>'; diff --git a/mod/externalpages/views/default/forms/expages/edit.php b/mod/externalpages/views/default/forms/expages/edit.php index ca83ea7df..a15f2a7aa 100644 --- a/mod/externalpages/views/default/forms/expages/edit.php +++ b/mod/externalpages/views/default/forms/expages/edit.php @@ -50,9 +50,9 @@ echo <<<EOT $input_area </div> <div class="elgg-foot"> -$hidden_value +$hidden_guid $hidden_type $submit_input -<div> +</div> EOT; diff --git a/mod/file/actions/file/upload.php b/mod/file/actions/file/upload.php index 3edc87952..d72d04eb7 100644 --- a/mod/file/actions/file/upload.php +++ b/mod/file/actions/file/upload.php @@ -94,8 +94,31 @@ if (isset($_FILES['upload']['name']) && !empty($_FILES['upload']['name'])) { $filestorename = elgg_strtolower(time().$_FILES['upload']['name']); } - $mime_type = $file->detectMimeType($_FILES['upload']['tmp_name'], $_FILES['upload']['type']); $file->setFilename($prefix . $filestorename); + $mime_type = ElggFile::detectMimeType($_FILES['upload']['tmp_name'], $_FILES['upload']['type']); + + // hack for Microsoft zipped formats + $info = pathinfo($_FILES['upload']['name']); + $office_formats = array('docx', 'xlsx', 'pptx'); + if ($mime_type == "application/zip" && in_array($info['extension'], $office_formats)) { + switch ($info['extension']) { + case 'docx': + $mime_type = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; + break; + case 'xlsx': + $mime_type = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; + break; + case 'pptx': + $mime_type = "application/vnd.openxmlformats-officedocument.presentationml.presentation"; + break; + } + } + + // check for bad ppt detection + if ($mime_type == "application/vnd.ms-office" && $info['extension'] == "ppt") { + $mime_type = "application/vnd.ms-powerpoint"; + } + $file->setMimeType($mime_type); $file->originalfilename = $_FILES['upload']['name']; $file->simpletype = file_get_simple_type($mime_type); @@ -109,7 +132,9 @@ if (isset($_FILES['upload']['name']) && !empty($_FILES['upload']['name'])) { // if image, we need to create thumbnails (this should be moved into a function) if ($guid && $file->simpletype == "image") { - $thumbnail = get_resized_image_from_existing_file($file->getFilenameOnFilestore(),60,60, true); + $file->icontime = time(); + + $thumbnail = get_resized_image_from_existing_file($file->getFilenameOnFilestore(), 60, 60, true); if ($thumbnail) { $thumb = new ElggFile(); $thumb->setMimeType($_FILES['upload']['type']); @@ -123,7 +148,7 @@ if (isset($_FILES['upload']['name']) && !empty($_FILES['upload']['name'])) { unset($thumbnail); } - $thumbsmall = get_resized_image_from_existing_file($file->getFilenameOnFilestore(),153,153, true); + $thumbsmall = get_resized_image_from_existing_file($file->getFilenameOnFilestore(), 153, 153, true); if ($thumbsmall) { $thumb->setFilename($prefix."smallthumb".$filestorename); $thumb->open("write"); @@ -133,7 +158,7 @@ if (isset($_FILES['upload']['name']) && !empty($_FILES['upload']['name'])) { unset($thumbsmall); } - $thumblarge = get_resized_image_from_existing_file($file->getFilenameOnFilestore(),600,600, false); + $thumblarge = get_resized_image_from_existing_file($file->getFilenameOnFilestore(), 600, 600, false); if ($thumblarge) { $thumb->setFilename($prefix."largethumb".$filestorename); $thumb->open("write"); diff --git a/mod/file/graphics/icons/application.gif b/mod/file/graphics/icons/application.gif Binary files differindex f78903c0a..bfba76a97 100644 --- a/mod/file/graphics/icons/application.gif +++ b/mod/file/graphics/icons/application.gif diff --git a/mod/file/graphics/icons/application_lrg.gif b/mod/file/graphics/icons/application_lrg.gif Binary files differindex c6955f749..65f8eadb4 100644 --- a/mod/file/graphics/icons/application_lrg.gif +++ b/mod/file/graphics/icons/application_lrg.gif diff --git a/mod/file/graphics/icons/archive.gif b/mod/file/graphics/icons/archive.gif Binary files differindex 044cd042a..2213cdadd 100644 --- a/mod/file/graphics/icons/archive.gif +++ b/mod/file/graphics/icons/archive.gif diff --git a/mod/file/graphics/icons/archive_lrg.gif b/mod/file/graphics/icons/archive_lrg.gif Binary files differindex 0d0856cdd..6e3df3fd4 100644 --- a/mod/file/graphics/icons/archive_lrg.gif +++ b/mod/file/graphics/icons/archive_lrg.gif diff --git a/mod/file/graphics/icons/excel.gif b/mod/file/graphics/icons/excel.gif Binary files differindex f74f74fd7..ecd1d57d2 100644 --- a/mod/file/graphics/icons/excel.gif +++ b/mod/file/graphics/icons/excel.gif diff --git a/mod/file/graphics/icons/excel_lrg.gif b/mod/file/graphics/icons/excel_lrg.gif Binary files differindex 9b53d6dc7..84d1375d5 100644 --- a/mod/file/graphics/icons/excel_lrg.gif +++ b/mod/file/graphics/icons/excel_lrg.gif diff --git a/mod/file/graphics/icons/general.gif b/mod/file/graphics/icons/general.gif Binary files differindex cd5cf467a..20958b9a4 100644 --- a/mod/file/graphics/icons/general.gif +++ b/mod/file/graphics/icons/general.gif diff --git a/mod/file/graphics/icons/general_lrg.gif b/mod/file/graphics/icons/general_lrg.gif Binary files differindex 7c7a3c80a..3458915e5 100644 --- a/mod/file/graphics/icons/general_lrg.gif +++ b/mod/file/graphics/icons/general_lrg.gif diff --git a/mod/file/graphics/icons/music.gif b/mod/file/graphics/icons/music.gif Binary files differindex c44d7c987..5e9df08bc 100644 --- a/mod/file/graphics/icons/music.gif +++ b/mod/file/graphics/icons/music.gif diff --git a/mod/file/graphics/icons/music_lrg.gif b/mod/file/graphics/icons/music_lrg.gif Binary files differindex 780a252d6..1c0792cc3 100644 --- a/mod/file/graphics/icons/music_lrg.gif +++ b/mod/file/graphics/icons/music_lrg.gif diff --git a/mod/file/graphics/icons/openoffice.gif b/mod/file/graphics/icons/openoffice.gif Binary files differindex 3cfdc7196..053ad5bb5 100644 --- a/mod/file/graphics/icons/openoffice.gif +++ b/mod/file/graphics/icons/openoffice.gif diff --git a/mod/file/graphics/icons/openoffice_lrg.gif b/mod/file/graphics/icons/openoffice_lrg.gif Binary files differindex 5cdb13353..da28607fa 100644 --- a/mod/file/graphics/icons/openoffice_lrg.gif +++ b/mod/file/graphics/icons/openoffice_lrg.gif diff --git a/mod/file/graphics/icons/pages.gif b/mod/file/graphics/icons/pages.gif Binary files differindex 2e4ee761a..7efcb7278 100644 --- a/mod/file/graphics/icons/pages.gif +++ b/mod/file/graphics/icons/pages.gif diff --git a/mod/file/graphics/icons/pages_lrg.gif b/mod/file/graphics/icons/pages_lrg.gif Binary files differindex 2e41e4739..234a52672 100644 --- a/mod/file/graphics/icons/pages_lrg.gif +++ b/mod/file/graphics/icons/pages_lrg.gif diff --git a/mod/file/graphics/icons/pdf.gif b/mod/file/graphics/icons/pdf.gif Binary files differindex e7854b1e0..94362a4f0 100644 --- a/mod/file/graphics/icons/pdf.gif +++ b/mod/file/graphics/icons/pdf.gif diff --git a/mod/file/graphics/icons/pdf_lrg.gif b/mod/file/graphics/icons/pdf_lrg.gif Binary files differindex 5cd62b69c..aff869d04 100644 --- a/mod/file/graphics/icons/pdf_lrg.gif +++ b/mod/file/graphics/icons/pdf_lrg.gif diff --git a/mod/file/graphics/icons/ppt.gif b/mod/file/graphics/icons/ppt.gif Binary files differindex 44aef679b..88ab26d5c 100644 --- a/mod/file/graphics/icons/ppt.gif +++ b/mod/file/graphics/icons/ppt.gif diff --git a/mod/file/graphics/icons/ppt_lrg.gif b/mod/file/graphics/icons/ppt_lrg.gif Binary files differindex 71965711d..075590fd8 100644 --- a/mod/file/graphics/icons/ppt_lrg.gif +++ b/mod/file/graphics/icons/ppt_lrg.gif diff --git a/mod/file/graphics/icons/text.gif b/mod/file/graphics/icons/text.gif Binary files differindex 107e7ca37..897aa77f9 100644 --- a/mod/file/graphics/icons/text.gif +++ b/mod/file/graphics/icons/text.gif diff --git a/mod/file/graphics/icons/text_lrg.gif b/mod/file/graphics/icons/text_lrg.gif Binary files differindex 5f7c95519..d42ea4de1 100644 --- a/mod/file/graphics/icons/text_lrg.gif +++ b/mod/file/graphics/icons/text_lrg.gif diff --git a/mod/file/graphics/icons/vcard.gif b/mod/file/graphics/icons/vcard.gif Binary files differindex f7fdda9c0..202df68dd 100644 --- a/mod/file/graphics/icons/vcard.gif +++ b/mod/file/graphics/icons/vcard.gif diff --git a/mod/file/graphics/icons/vcard_lrg.gif b/mod/file/graphics/icons/vcard_lrg.gif Binary files differindex 6cd4c45e0..68ced88d2 100644 --- a/mod/file/graphics/icons/vcard_lrg.gif +++ b/mod/file/graphics/icons/vcard_lrg.gif diff --git a/mod/file/graphics/icons/video.gif b/mod/file/graphics/icons/video.gif Binary files differindex 09abfad3b..56aca7589 100644 --- a/mod/file/graphics/icons/video.gif +++ b/mod/file/graphics/icons/video.gif diff --git a/mod/file/graphics/icons/video_lrg.gif b/mod/file/graphics/icons/video_lrg.gif Binary files differindex b23dbad91..69cc706d9 100644 --- a/mod/file/graphics/icons/video_lrg.gif +++ b/mod/file/graphics/icons/video_lrg.gif diff --git a/mod/file/graphics/icons/word.gif b/mod/file/graphics/icons/word.gif Binary files differindex f906c75bd..6f7dff340 100644 --- a/mod/file/graphics/icons/word.gif +++ b/mod/file/graphics/icons/word.gif diff --git a/mod/file/graphics/icons/word_lrg.gif b/mod/file/graphics/icons/word_lrg.gif Binary files differindex 018c8e334..4c39108de 100644 --- a/mod/file/graphics/icons/word_lrg.gif +++ b/mod/file/graphics/icons/word_lrg.gif diff --git a/mod/file/languages/en.php b/mod/file/languages/en.php index 278076927..b3344cb43 100644 --- a/mod/file/languages/en.php +++ b/mod/file/languages/en.php @@ -22,7 +22,6 @@ $english = array( 'file:gallery_list' => "Gallery or list view", 'file:num_files' => "Number of files to display", 'file:user:gallery'=>'View %s gallery', - 'file:via' => 'via files', 'file:upload' => "Upload a file", 'file:replace' => 'Replace file content (leave blank to not change file)', 'file:list:title' => "%s's %s %s", @@ -79,6 +78,15 @@ $english = array( 'item:object:file' => 'Files', 'file:newupload' => 'A new file has been uploaded', + 'file:notification' => +'%s uploaded a new file: + +%s +%s + +View and comment on the new file: +%s +', /** * Embed media diff --git a/mod/file/pages/file/download.php b/mod/file/pages/file/download.php index 00e6d500e..76c1f1272 100644 --- a/mod/file/pages/file/download.php +++ b/mod/file/pages/file/download.php @@ -26,7 +26,7 @@ $filename = $file->originalfilename; header("Pragma: public"); header("Content-type: $mime"); -if (strpos($mime, "image/") !== false) { +if (strpos($mime, "image/") !== false || $mime == "application/pdf") { header("Content-Disposition: inline; filename=\"$filename\""); } else { header("Content-Disposition: attachment; filename=\"$filename\""); diff --git a/mod/file/pages/file/view.php b/mod/file/pages/file/view.php index a571c9d68..ec51b30e6 100644 --- a/mod/file/pages/file/view.php +++ b/mod/file/pages/file/view.php @@ -6,6 +6,10 @@ */ $file = get_entity(get_input('guid')); +if (!$file) { + register_error(elgg_echo('noaccess')); + forward(''); +} $owner = elgg_get_page_owner_entity(); diff --git a/mod/file/start.php b/mod/file/start.php index e15a9ad61..172042332 100644 --- a/mod/file/start.php +++ b/mod/file/start.php @@ -122,6 +122,7 @@ function file_page_handler($page) { include "$file_dir/friends.php"; break; case 'view': + case 'read': // Elgg 1.7 compatibility set_input('guid', $page[1]); include "$file_dir/view.php"; break; @@ -199,9 +200,13 @@ function file_notify_message($hook, $entity_type, $returnvalue, $params) { if (($entity instanceof ElggEntity) && ($entity->getSubtype() == 'file')) { $descr = $entity->description; $title = $entity->title; - $url = elgg_get_site_url() . "view/" . $entity->guid; $owner = $entity->getOwnerEntity(); - return $owner->name . ' ' . elgg_echo("file:via") . ': ' . $entity->title . "\n\n" . $descr . "\n\n" . $entity->getURL(); + return elgg_echo('file:notification', array( + $owner->name, + $title, + $descr, + $entity->getURL() + )); } return null; } @@ -235,11 +240,15 @@ function file_get_simple_type($mimetype) { switch ($mimetype) { case "application/msword": + case "application/vnd.openxmlformats-officedocument.wordprocessingml.document": return "document"; break; case "application/pdf": return "document"; break; + case "application/ogg": + return "audio"; + break; } if (substr_count($mimetype, 'text/')) { @@ -345,17 +354,22 @@ function file_icon_url_override($hook, $type, $returnvalue, $params) { // thumbnails get first priority if ($file->thumbnail) { - return "mod/file/thumbnail.php?file_guid=$file->guid&size=$size"; + $ts = (int)$file->icontime; + return "mod/file/thumbnail.php?file_guid=$file->guid&size=$size&icontime=$ts"; } $mapping = array( 'application/excel' => 'excel', 'application/msword' => 'word', + 'application/ogg' => 'music', 'application/pdf' => 'pdf', 'application/powerpoint' => 'ppt', 'application/vnd.ms-excel' => 'excel', 'application/vnd.ms-powerpoint' => 'ppt', 'application/vnd.oasis.opendocument.text' => 'openoffice', + 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' => 'word', + 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' => 'excel', + 'application/vnd.openxmlformats-officedocument.presentationml.presentation' => 'ppt', 'application/x-gzip' => 'archive', 'application/x-rar-compressed' => 'archive', 'application/x-stuffit' => 'archive', diff --git a/mod/file/views/default/file/specialcontent/image/default.php b/mod/file/views/default/file/specialcontent/image/default.php index fbd994a0b..431ac9f4f 100644 --- a/mod/file/views/default/file/specialcontent/image/default.php +++ b/mod/file/views/default/file/specialcontent/image/default.php @@ -1,13 +1,17 @@ <?php /** * Display an image + * + * @uses $vars['entity'] */ -$image_url = elgg_get_site_url() . "mod/file/thumbnail.php?file_guid={$vars['entity']->getGUID()}&size=large"; +$file = $vars['entity']; + +$image_url = $file->getIconURL('large'); $image_url = elgg_format_url($image_url); -$download_url = elgg_get_site_url() . "mod/file/download.php?file_guid={$vars['entity']->getGUID()}"; +$download_url = elgg_get_site_url() . "file/download/{$file->getGUID()}"; -if ($vars['full_view'] && $smallthumb = $vars['entity']->smallthumb) { +if ($vars['full_view']) { echo <<<HTML <div class="file-photo"> <a href="$download_url"><img class="elgg-photo" src="$image_url" /></a> diff --git a/mod/file/views/default/object/file.php b/mod/file/views/default/object/file.php index 1db9863c9..b3f530183 100644 --- a/mod/file/views/default/object/file.php +++ b/mod/file/views/default/object/file.php @@ -28,7 +28,6 @@ $author_text = elgg_echo('byline', array($owner_link)); $file_icon = elgg_view_entity_icon($file, 'small'); -$tags = elgg_view('output/tags', array('tags' => $file->tags)); $date = elgg_view_friendly_time($file->time_created); $comments_count = $file->countComments(); @@ -71,7 +70,6 @@ if ($full && !elgg_in_context('gallery')) { 'entity' => $file, 'metadata' => $metadata, 'subtitle' => $subtitle, - 'tags' => $tags, ); $params = $params + $vars; $summary = elgg_view('object/elements/summary', $params); @@ -100,7 +98,6 @@ if ($full && !elgg_in_context('gallery')) { 'entity' => $file, 'metadata' => $metadata, 'subtitle' => $subtitle, - 'tags' => $tags, 'content' => $excerpt, ); $params = $params + $vars; diff --git a/mod/groups/actions/discussion/reply/save.php b/mod/groups/actions/discussion/reply/save.php index a1ed036b6..f8be8aa2c 100644 --- a/mod/groups/actions/discussion/reply/save.php +++ b/mod/groups/actions/discussion/reply/save.php @@ -4,8 +4,6 @@ * */ -gatekeeper(); - // Get input $entity_guid = (int) get_input('entity_guid'); $text = get_input('group_topic_post'); @@ -23,10 +21,10 @@ if (!$topic) { forward(REFERER); } -$user = get_loggedin_user(); +$user = elgg_get_logged_in_user_entity(); $group = $topic->getContainerEntity(); -if (!$group->canWriteToContainer($user)) { +if (!$group->canWriteToContainer()) { register_error(elgg_echo('groups:notmember')); forward(REFERER); } diff --git a/mod/groups/actions/discussion/save.php b/mod/groups/actions/discussion/save.php index a51775cd6..de4afadfb 100644 --- a/mod/groups/actions/discussion/save.php +++ b/mod/groups/actions/discussion/save.php @@ -21,7 +21,7 @@ if (!$title || !$desc) { } $container = get_entity($container_guid); -if (!$container || !$container->canWriteToContainer()) { +if (!$container || !$container->canWriteToContainer(0, 'object', 'groupforumtopic')) { register_error(elgg_echo('discussion:error:permissions')); forward(REFERER); } diff --git a/mod/groups/actions/groups/edit.php b/mod/groups/actions/groups/edit.php index c4cf6667e..b513a6098 100644 --- a/mod/groups/actions/groups/edit.php +++ b/mod/groups/actions/groups/edit.php @@ -89,14 +89,10 @@ if ($new_group_flag) { $group->save(); -// group creator needs to be member of new group and river entry created -if ($new_group_flag) { - elgg_set_page_owner_guid($group->guid); - $group->join($user); - add_to_river('river/group/create', 'create', $user->guid, $group->guid); -} - // Invisible group support +// @todo this requires save to be called to create the acl for the group. This +// is an odd requirement and should be removed. Either the acl creation happens +// in the action or the visibility moves to a plugin hook if (elgg_get_plugin_setting('hidden_groups', 'groups') == 'yes') { $visibility = (int)get_input('vis', '', false); if ($visibility != ACCESS_PUBLIC && $visibility != ACCESS_LOGGED_IN) { @@ -105,10 +101,18 @@ if (elgg_get_plugin_setting('hidden_groups', 'groups') == 'yes') { if ($group->access_id != $visibility) { $group->access_id = $visibility; - $group->save(); } } +$group->save(); + +// group creator needs to be member of new group and river entry created +if ($new_group_flag) { + elgg_set_page_owner_guid($group->guid); + $group->join($user); + add_to_river('river/group/create', 'create', $user->guid, $group->guid, $group->access_id); +} + // Now see if we have a file icon if ((isset($_FILES['icon'])) && (substr_count($_FILES['icon']['type'],'image/'))) { diff --git a/mod/groups/actions/groups/membership/delete_invite.php b/mod/groups/actions/groups/membership/delete_invite.php index 4b654f0b6..d21aa0309 100644 --- a/mod/groups/actions/groups/membership/delete_invite.php +++ b/mod/groups/actions/groups/membership/delete_invite.php @@ -9,7 +9,11 @@ $user_guid = get_input('user_guid', elgg_get_logged_in_user_guid()); $group_guid = get_input('group_guid'); $user = get_entity($user_guid); + +// invisible groups require overriding access to delete invite +$old_access = elgg_set_ignore_access(true); $group = get_entity($group_guid); +elgg_set_ignore_access($old_access); // If join request made if (check_entity_relationship($group->guid, 'invited', $user->guid)) { diff --git a/mod/groups/icon.php b/mod/groups/icon.php index f4c0f8010..f86f84fa5 100644 --- a/mod/groups/icon.php +++ b/mod/groups/icon.php @@ -10,8 +10,15 @@ require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); $group_guid = get_input('group_guid'); $group = get_entity($group_guid); +// If is the same ETag, content didn't changed. +$etag = $group->icontime . $group_guid; +if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && trim($_SERVER['HTTP_IF_NONE_MATCH']) == $etag) { + header("HTTP/1.1 304 Not Modified"); + exit; +} + $size = strtolower(get_input('size')); -if (!in_array($size,array('large','medium','small','tiny','master','topbar'))) +if (!in_array($size, array('large', 'medium', 'small', 'tiny', 'master', 'topbar'))) $size = "medium"; $success = false; @@ -28,7 +35,7 @@ if ($filehandler->open("read")) { } if (!$success) { - $location = elgg_get_plugins_path() . "groups/graphics/default{$size}.jpg"; + $location = elgg_get_plugins_path() . "groups/graphics/default{$size}.gif"; $contents = @file_get_contents($location); } @@ -37,4 +44,5 @@ header('Expires: ' . date('r',time() + 864000)); header("Pragma: public"); header("Cache-Control: public"); header("Content-Length: " . strlen($contents)); +header("ETag: $etag"); echo $contents; diff --git a/mod/groups/languages/en.php b/mod/groups/languages/en.php index 09feaf8d1..e51e51a14 100644 --- a/mod/groups/languages/en.php +++ b/mod/groups/languages/en.php @@ -61,6 +61,18 @@ $english = array( 'groups:search:tags' => "tag", 'groups:search:title' => "Search for groups tagged with '%s'", 'groups:search:none' => "No matching groups were found", + 'groups:search_in_group' => "Search in this group", + 'groups:acl' => "Group: %s", + + 'groups:notification' => +'%s added a new discussion topic to %s: + +%s +%s + +View and reply to the discussion: +%s +', 'groups:activity' => "Group activity", 'groups:enableactivity' => 'Enable group activity', diff --git a/mod/groups/lib/discussion.php b/mod/groups/lib/discussion.php index 2bda4678e..55642644d 100644 --- a/mod/groups/lib/discussion.php +++ b/mod/groups/lib/discussion.php @@ -92,8 +92,8 @@ function discussion_handle_edit_page($type, $guid) { forward(); } - // make sure user has permissions to write to container - if (!$group->canWriteToContainer()) { + // make sure user has permissions to add a topic to container + if (!$group->canWriteToContainer(0, 'object', 'groupforumtopic')) { register_error(elgg_echo('groups:permissions:error')); forward($group->getURL()); } @@ -173,7 +173,7 @@ function discussion_handle_view_page($guid) { 'show_add_form' => false, )); $content .= elgg_view('discussion/closed'); - } elseif ($group->canWriteToContainer() || elgg_is_admin_logged_in()) { + } elseif ($group->canWriteToContainer(0, 'object', 'groupforumtopic') || elgg_is_admin_logged_in()) { $content .= elgg_view('discussion/replies', array( 'entity' => $topic, 'show_add_form' => true, diff --git a/mod/groups/lib/groups.php b/mod/groups/lib/groups.php index f8ff2d74b..498766df0 100644 --- a/mod/groups/lib/groups.php +++ b/mod/groups/lib/groups.php @@ -249,7 +249,11 @@ function groups_handle_profile_page($guid) { $content = elgg_view('groups/profile/layout', array('entity' => $group)); if (group_gatekeeper(false)) { - $sidebar = elgg_view('groups/sidebar/members', array('entity' => $group)); + $sidebar = ''; + if (elgg_is_active_plugin('search')) { + $sidebar .= elgg_view('groups/sidebar/search', array('entity' => $group)); + } + $sidebar .= elgg_view('groups/sidebar/members', array('entity' => $group)); } else { $sidebar = ''; } diff --git a/mod/groups/start.php b/mod/groups/start.php index 09362cbbc..aeab0649a 100644 --- a/mod/groups/start.php +++ b/mod/groups/start.php @@ -663,7 +663,7 @@ function group_access_options($group) { ACCESS_PRIVATE => 'private', ACCESS_LOGGED_IN => 'logged in users', ACCESS_PUBLIC => 'public', - $group->group_acl => 'Group: ' . $group->name, + $group->group_acl => elgg_echo('groups:acl', array($group->name)), ); return $access_array; } @@ -741,7 +741,6 @@ function discussion_init() { // notifications register_notification_object('object', 'groupforumtopic', elgg_echo('groupforumtopic:new')); - elgg_register_plugin_hook_handler('object:notifications', 'object', 'group_object_notifications_intercept'); elgg_register_plugin_hook_handler('notify:entity:message', 'object', 'groupforumtopic_notify_message'); } @@ -855,41 +854,19 @@ function discussion_add_to_river_menu($hook, $type, $return, $params) { function group_object_notifications($event, $object_type, $object) { static $flag; - if (!isset($flag)) + if (!isset($flag)) { $flag = 0; + } if (is_callable('object_notifications')) if ($object instanceof ElggObject) { if ($object->getSubtype() == 'groupforumtopic') { - //if ($object->countAnnotations('group_topic_post') > 0) { if ($flag == 0) { $flag = 1; object_notifications($event, $object_type, $object); } - //} - } - } -} - -/** - * Intercepts the notification on group topic creation and prevents a notification from going out - * (because one will be sent on the annotation) - * - * @param unknown_type $hook - * @param unknown_type $entity_type - * @param unknown_type $returnvalue - * @param unknown_type $params - * @return unknown - */ -function group_object_notifications_intercept($hook, $entity_type, $returnvalue, $params) { - if (isset($params)) { - if ($params['event'] == 'create' && $params['object'] instanceof ElggObject) { - if ($params['object']->getSubtype() == 'groupforumtopic') { - return true; } } - } - return null; } /** @@ -904,26 +881,23 @@ function groupforumtopic_notify_message($hook, $entity_type, $returnvalue, $para $entity = $params['entity']; $to_entity = $params['to_entity']; $method = $params['method']; - if (($entity instanceof ElggEntity) && ($entity->getSubtype() == 'groupforumtopic')) { + if (($entity instanceof ElggEntity) && ($entity->getSubtype() == 'groupforumtopic')) { $descr = $entity->description; $title = $entity->title; $url = $entity->getURL(); - - $msg = get_input('topicmessage'); - if (empty($msg)) - $msg = get_input('topic_post'); - if (!empty($msg)) - $msg = $msg . "\n\n"; else - $msg = ''; - - $owner = get_entity($entity->container_guid); - if ($method == 'sms') { - return elgg_echo("groupforumtopic:new") . ': ' . $url . " ({$owner->name}: {$title})"; - } else { - return elgg_get_logged_in_user_entity()->name . ' ' . elgg_echo("groups:viagroups") . ': ' . $title . "\n\n" . $msg . "\n\n" . $entity->getURL(); - } + $owner = $entity->getOwnerEntity(); + $group = $entity->getContainerEntity(); + + return elgg_echo('groups:notification', array( + $owner->name, + $group->name, + $entity->title, + $entity->description, + $entity->getURL() + )); } + return null; } diff --git a/mod/groups/upgrades/2011030101.php b/mod/groups/upgrades/2011030101.php index c2a80c08c..55edb1a16 100644 --- a/mod/groups/upgrades/2011030101.php +++ b/mod/groups/upgrades/2011030101.php @@ -9,6 +9,7 @@ $topics = elgg_get_entities(array( 'type' => 'object', 'subtype' => 'groupforumtopic', 'limit' => 5, + 'order_by' => 'e.time_created asc', )); // if not topics, no upgrade required @@ -25,12 +26,17 @@ foreach ($topics as $topic) { /** - * Condense annotation into object + * Condense first annotation into object * * @param ElggObject $topic */ function groups_2011030101($topic) { + // do not upgrade topics that have already been upgraded + if ($topic->description) { + return true; + } + $annotation = $topic->getAnnotations('group_topic_post', 1); if (!$annotation) { // no text for this forum post so we delete (probably caused by #2624) @@ -43,8 +49,14 @@ function groups_2011030101($topic) { return $annotation[0]->delete(); } -$options = array('type' => 'object', 'subtype' => 'groupforumtopic'); +$previous_access = elgg_set_ignore_access(true); +$options = array( + 'type' => 'object', + 'subtype' => 'groupforumtopic', + 'limit' => 0, +); $batch = new ElggBatch('elgg_get_entities', $options, 'groups_2011030101', 100); +elgg_set_ignore_access($previous_access); if ($batch->callbackResult) { error_log("Elgg Groups upgrade (2011030101) succeeded"); diff --git a/mod/groups/views/default/forms/groups/find.php b/mod/groups/views/default/forms/groups/find.php new file mode 100644 index 000000000..ddf639b74 --- /dev/null +++ b/mod/groups/views/default/forms/groups/find.php @@ -0,0 +1,16 @@ +<?php +/** + * Group tag-based search form body + */ + +$tag_string = elgg_echo('groups:search:tags'); + +$params = array( + 'name' => 'tag', + 'class' => 'elgg-input-search mbm', + 'value' => $tag_string, + 'onclick' => "if (this.value=='$tag_string') { this.value='' }", +); +echo elgg_view('input/text', $params); + +echo elgg_view('input/submit', array('value' => elgg_echo('search:go'))); diff --git a/mod/groups/views/default/forms/groups/search.php b/mod/groups/views/default/forms/groups/search.php index ddf639b74..850b6088e 100644 --- a/mod/groups/views/default/forms/groups/search.php +++ b/mod/groups/views/default/forms/groups/search.php @@ -1,16 +1,20 @@ <?php /** - * Group tag-based search form body + * Group search form + * + * @uses $vars['entity'] ElggGroup */ -$tag_string = elgg_echo('groups:search:tags'); - $params = array( - 'name' => 'tag', + 'name' => 'q', 'class' => 'elgg-input-search mbm', 'value' => $tag_string, - 'onclick' => "if (this.value=='$tag_string') { this.value='' }", ); echo elgg_view('input/text', $params); +echo elgg_view('input/hidden', array( + 'name' => 'container_guid', + 'value' => $vars['entity']->getGUID(), +)); + echo elgg_view('input/submit', array('value' => elgg_echo('search:go'))); diff --git a/mod/groups/views/default/group/default.php b/mod/groups/views/default/group/default.php index 6eae467c6..d9460dff4 100644 --- a/mod/groups/views/default/group/default.php +++ b/mod/groups/views/default/group/default.php @@ -22,10 +22,9 @@ if (elgg_in_context('owner_block') || elgg_in_context('widgets')) { if ($vars['full_view']) { - echo elgg_view("groups/profile/profile_block", $vars); + echo elgg_view('groups/profile/summary', $vars); } else { // brief view - $params = array( 'entity' => $group, 'metadata' => $metadata, diff --git a/mod/groups/views/default/groups/group_sort_menu.php b/mod/groups/views/default/groups/group_sort_menu.php index c53b49c8e..f5631a31f 100644 --- a/mod/groups/views/default/groups/group_sort_menu.php +++ b/mod/groups/views/default/groups/group_sort_menu.php @@ -2,6 +2,7 @@ /** * All groups listing page navigation * + * @uses $vars['selected'] Name of the tab that has been selected */ $tabs = array( @@ -22,14 +23,13 @@ $tabs = array( ), ); -// sets default selected item -if (strpos(full_url(), 'filter') === false) { - $tabs['newest']['selected'] = true; -} - foreach ($tabs as $name => $tab) { $tab['name'] = $name; + if ($vars['selected'] == $name) { + $tab['selected'] = true; + } + elgg_register_menu_item('filter', $tab); } diff --git a/mod/groups/views/default/groups/js.php b/mod/groups/views/default/groups/js.php index ad742445b..1b4d33f32 100644 --- a/mod/groups/views/default/groups/js.php +++ b/mod/groups/views/default/groups/js.php @@ -1,5 +1,6 @@ -$(function() { +// this adds a class to support IE8 and older +elgg.register_hook_handler('init', 'system', function() { // jQuery uses 0-based indexing $('#groups-tools').children('li:even').addClass('odd'); }); diff --git a/mod/groups/views/default/groups/sidebar/find.php b/mod/groups/views/default/groups/sidebar/find.php index c5c986759..c1a8da3c2 100644 --- a/mod/groups/views/default/groups/sidebar/find.php +++ b/mod/groups/views/default/groups/sidebar/find.php @@ -5,7 +5,7 @@ * @package ElggGroups */ $url = elgg_get_site_url() . 'groups/search'; -$body = elgg_view_form('groups/search', array( +$body = elgg_view_form('groups/find', array( 'action' => $url, 'method' => 'get', 'disable_security' => true, diff --git a/mod/groups/views/default/groups/sidebar/members.php b/mod/groups/views/default/groups/sidebar/members.php index 49f14697c..11273d0e6 100644 --- a/mod/groups/views/default/groups/sidebar/members.php +++ b/mod/groups/views/default/groups/sidebar/members.php @@ -8,7 +8,7 @@ * @uses $vars['limit'] The number of members to display */ -$limit = elgg_extract('limit', $vars, 10); +$limit = elgg_extract('limit', $vars, 14); $all_link = elgg_view('output/url', array( 'href' => 'groups/members/' . $vars['entity']->guid, @@ -24,6 +24,7 @@ $body = elgg_list_entities_from_relationship(array( 'limit' => $limit, 'list_type' => 'gallery', 'gallery_class' => 'elgg-gallery-users', + 'pagination' => false )); $body .= "<div class='center mts'>$all_link</div>"; diff --git a/mod/groups/views/default/groups/sidebar/search.php b/mod/groups/views/default/groups/sidebar/search.php new file mode 100644 index 000000000..226835715 --- /dev/null +++ b/mod/groups/views/default/groups/sidebar/search.php @@ -0,0 +1,15 @@ +<?php +/** + * Search for content in this group + * + * @uses vars['entity'] ElggGroup + */ + +$url = elgg_get_site_url() . 'search'; +$body = elgg_view_form('groups/search', array( + 'action' => $url, + 'method' => 'get', + 'disable_security' => true, +), $vars); + +echo elgg_view_module('aside', elgg_echo('groups:search_in_group'), $body);
\ No newline at end of file diff --git a/mod/htmlawed/manifest.xml b/mod/htmlawed/manifest.xml index 5c1f14cb5..074f98fb3 100644 --- a/mod/htmlawed/manifest.xml +++ b/mod/htmlawed/manifest.xml @@ -8,7 +8,7 @@ <description>Provides security filtering. Disabling this plugin is extremely insecure. DO NOT DISABLE.</description> <website>http://www.elgg.org/</website> <copyright>See COPYRIGHT.txt</copyright> - <license>GNU General Public License version 3</license> + <license>GNU General Public License version 2</license> <requires> <type>elgg_release</type> <version>1.8</version> diff --git a/mod/likes/views/default/likes/button.php b/mod/likes/views/default/likes/button.php index 3f2f073cc..bc7c8fd8a 100644 --- a/mod/likes/views/default/likes/button.php +++ b/mod/likes/views/default/likes/button.php @@ -24,11 +24,6 @@ if (elgg_is_logged_in() && $vars['entity']->canAnnotate(0, 'likes')) { ); $likes_button = elgg_view('output/url', $params); } else { - $options = array( - 'guid' => $guid, - 'annotation_name' => 'likes', - 'owner_guid' => elgg_get_logged_in_user_guid() - ); $url = elgg_get_site_url() . "action/likes/delete?guid={$guid}"; $params = array( 'href' => $url, diff --git a/mod/logbrowser/languages/en.php b/mod/logbrowser/languages/en.php index 3b6ead272..b1d2681dd 100644 --- a/mod/logbrowser/languages/en.php +++ b/mod/logbrowser/languages/en.php @@ -17,11 +17,14 @@ $english = array( 'logbrowser:explore' => 'Explore log', 'logbrowser:date' => 'Date and time', + 'logbrowser:ip_address' => 'IP address', 'logbrowser:user:name' => 'User', 'logbrowser:user:guid' => 'User GUID', 'logbrowser:object' => 'Object type', 'logbrowser:object:guid' => 'Object GUID', 'logbrowser:action' => 'Action', + + 'logbrowser:no_result' => 'No results', ); add_translation("en", $english);
\ No newline at end of file diff --git a/mod/logbrowser/views/default/admin/administer_utilities/logbrowser.php b/mod/logbrowser/views/default/admin/administer_utilities/logbrowser.php index a04ef686a..9506c9d9f 100644 --- a/mod/logbrowser/views/default/admin/administer_utilities/logbrowser.php +++ b/mod/logbrowser/views/default/admin/administer_utilities/logbrowser.php @@ -12,13 +12,20 @@ $offset = get_input('offset'); $search_username = get_input('search_username'); if ($search_username) { - if ($user = get_user_by_username($search_username)) { + $user = get_user_by_username($search_username); + if ($user) { $user_guid = $user->guid; + } else { + $user_guid = null; } } else { - $user_guid = get_input('user_guid',0); + $user_guid = get_input('user_guid', null); if ($user_guid) { $user_guid = (int) $user_guid; + $user = get_entity($user_guid); + if ($user) { + $search_username = $user->username; + } } else { $user_guid = null; } @@ -34,15 +41,26 @@ if ($timeupper) { $timeupper = strtotime($timeupper); } +$ip_address = get_input('ip_address'); + $refine = elgg_view('logbrowser/refine', array( - 'user_guid' => $user_guid, 'timeupper' => $timeupper, 'timelower' => $timelower, + 'ip_address' => $ip_address, + 'username' => $search_username, )); // Get log entries -$log = get_system_log($user_guid, "", "", "","", $limit, $offset, false, $timeupper, $timelower); -$count = get_system_log($user_guid, "", "", "","", $limit, $offset, true, $timeupper, $timelower); +$log = get_system_log($user_guid, "", "", "","", $limit, $offset, false, $timeupper, $timelower, + 0, $ip_address); +$count = get_system_log($user_guid, "", "", "","", $limit, $offset, true, $timeupper, $timelower, + 0, $ip_address); + +// if user does not exist, we have no results +if ($search_username && is_null($user_guid)) { + $log = false; + $count = 0; +} $table = elgg_view('logbrowser/table', array('log_entries' => $log)); diff --git a/mod/logbrowser/views/default/forms/logbrowser/refine.php b/mod/logbrowser/views/default/forms/logbrowser/refine.php index ff3f48b03..ebf7f10ed 100644 --- a/mod/logbrowser/views/default/forms/logbrowser/refine.php +++ b/mod/logbrowser/views/default/forms/logbrowser/refine.php @@ -3,34 +3,35 @@ * Form body for refining the log browser search. * Look for a particular person or in a time window. * - * @uses $vars['user_guid'] + * @uses $vars['username'] + * @uses $vars['ip_address'] * @uses $vars['timelower'] * @uses $vars['timeupper'] */ if (isset($vars['timelower'])) { - $lowerval = date('r',$vars['timelower']); + $lowerval = date('r', $vars['timelower']); } else { $lowerval = ""; } if (isset($vars['timeupper'])) { - $upperval = date('r',$vars['timeupper']); + $upperval = date('r', $vars['timeupper']); } else { $upperval = ""; } -if (isset($vars['user_guid'])) { - if ($user = get_entity($vars['user_guid'])) { - $userval = $user->username; - } -} else { - $userval = ""; -} - +$ip_address = elgg_extract('ip_address', $vars); +$username = elgg_extract('username', $vars); $form = "<div>" . elgg_echo('logbrowser:user'); $form .= elgg_view('input/text', array( 'name' => 'search_username', - 'value' => $userval, + 'value' => $username, +)) . "</div>"; + +$form .= "<div>" . elgg_echo('logbrowser:ip_address'); +$form .= elgg_view('input/text', array( + 'name' => 'ip_address', + 'value' => $ip_address, )) . "</div>"; $form .= "<div>" . elgg_echo('logbrowser:starttime'); diff --git a/mod/logbrowser/views/default/logbrowser/table.php b/mod/logbrowser/views/default/logbrowser/table.php index b7f6a1f20..1223c1456 100644 --- a/mod/logbrowser/views/default/logbrowser/table.php +++ b/mod/logbrowser/views/default/logbrowser/table.php @@ -11,6 +11,7 @@ $log_entries = $vars['log_entries']; <table class="elgg-table"> <tr> <th><?php echo elgg_echo('logbrowser:date'); ?></th> + <th><?php echo elgg_echo('logbrowser:ip_address'); ?></th> <th><?php echo elgg_echo('logbrowser:user:name'); ?></th> <th><?php echo elgg_echo('logbrowser:user:guid'); ?></th> <th><?php echo elgg_echo('logbrowser:object'); ?></th> @@ -20,6 +21,12 @@ $log_entries = $vars['log_entries']; <?php $alt = ''; foreach ($log_entries as $entry) { + if ($entry->ip_address) { + $ip_address = $entry->ip_address; + } else { + $ip_address = ' '; + } + $user = get_entity($entry->performed_by_guid); if ($user) { $user_link = elgg_view('output/url', array( @@ -51,6 +58,9 @@ $log_entries = $vars['log_entries']; <td class="log-entry-time"> <?php echo date('r', $entry->time_created); ?> </td> + <td class="log-entry-ip-address"> + <?php echo $ip_address; ?> + </td> <td class="log-entry-user"> <?php echo $user_link; ?> </td> @@ -72,4 +82,9 @@ $log_entries = $vars['log_entries']; $alt = $alt ? '' : 'class="alt"'; } ?> -</table>
\ No newline at end of file +</table> +<?php +if (!$log_entries) { + echo elgg_echo('logbrowser:no_result'); + return true; +} diff --git a/mod/members/pages/members/search.php b/mod/members/pages/members/search.php index 94127768a..1f0444d67 100644 --- a/mod/members/pages/members/search.php +++ b/mod/members/pages/members/search.php @@ -17,7 +17,14 @@ if ($vars['search_type'] == 'tag') { $results = elgg_trigger_plugin_hook('search', 'tags', $options, array()); $count = $results['count']; $users = $results['entities']; - $content = elgg_view_entity_list($users, $count, $offset, $limit, false, false, true); + $content = elgg_view_entity_list($users, array( + 'count' => $count, + 'offset' => $offset, + 'limit' => $limit, + 'full_view' => false, + 'list_type_toggle' => false, + 'pagination' => true, + )); } else { $name = sanitize_string(get_input('name')); diff --git a/mod/messageboard/actions/delete.php b/mod/messageboard/actions/delete.php index a40329cb5..a1f62278c 100644 --- a/mod/messageboard/actions/delete.php +++ b/mod/messageboard/actions/delete.php @@ -9,7 +9,6 @@ $annotation_id = (int) get_input('annotation_id'); $message = elgg_get_annotation_from_id($annotation_id); if ($message && $message->canEdit() && $message->delete()) { - remove_from_river_by_annotation($annotation_id); system_message(elgg_echo("messageboard:deleted")); } else { system_message(elgg_echo("messageboard:notdeleted")); diff --git a/mod/messageboard/views/default/messageboard/js.php b/mod/messageboard/views/default/messageboard/js.php index 3295c68de..79472069d 100644 --- a/mod/messageboard/views/default/messageboard/js.php +++ b/mod/messageboard/views/default/messageboard/js.php @@ -44,7 +44,8 @@ elgg.messageboard.deletePost = function(e) { if (confirm(confirmText)) { elgg.action($(this).attr('href'), { success: function() { - $(link).closest('li').remove(); + var item = $(link).closest('.elgg-item'); + item.remove(); } }); } diff --git a/mod/messages/views/default/forms/messages/process.php b/mod/messages/views/default/forms/messages/process.php index f86c3217a..cb30792e9 100644 --- a/mod/messages/views/default/forms/messages/process.php +++ b/mod/messages/views/default/forms/messages/process.php @@ -19,10 +19,12 @@ echo $messages; echo '</div>'; echo '<div class="elgg-foot messages-buttonbank">'; + echo elgg_view('input/submit', array( 'value' => elgg_echo('delete'), 'name' => 'delete', - 'class' => 'elgg-button-delete', + 'class' => 'elgg-button-delete elgg-requires-confirmation', + 'title' => elgg_echo('deleteconfirm:plural'), )); if ($vars['folder'] == "inbox") { diff --git a/mod/messages/views/default/messages/js.php b/mod/messages/views/default/messages/js.php index 39f93e645..60cf36b92 100644 --- a/mod/messages/views/default/messages/js.php +++ b/mod/messages/views/default/messages/js.php @@ -1,5 +1,6 @@ -$(function() { +// messages plugin toggle +elgg.register_hook_handler('init', 'system', function() { $("#messages-toggle").click(function() { $('input[type=checkbox]').click(); }); diff --git a/mod/pages/actions/pages/delete.php b/mod/pages/actions/pages/delete.php index dfa0de98d..7a314a280 100644 --- a/mod/pages/actions/pages/delete.php +++ b/mod/pages/actions/pages/delete.php @@ -9,8 +9,9 @@ $guid = get_input('guid'); $page = get_entity($guid); -if ($page) { - if ($page->canEdit()) { +if (elgg_instanceof($page, 'object', 'page') || elgg_instanceof($page, 'object', 'page_top')) { + // only allow owners and admin to delete + if (elgg_is_admin_logged_in() || elgg_get_logged_in_user_guid() == $page->getOwnerGuid()) { $container = get_entity($page->container_guid); // Bring all child elements forward diff --git a/mod/pages/actions/pages/edit.php b/mod/pages/actions/pages/edit.php index 6950d4b2f..a32e4a4ba 100644 --- a/mod/pages/actions/pages/edit.php +++ b/mod/pages/actions/pages/edit.php @@ -47,7 +47,19 @@ if ($page_guid) { } if (sizeof($input) > 0) { + // don't change access if not an owner/admin + $user = elgg_get_logged_in_user_entity(); + $can_change_access = true; + + if ($user && $page) { + $can_change_access = $user->isAdmin() || $user->getGUID() == $page->owner_guid; + } + foreach ($input as $name => $value) { + if (($name == 'access_id' || $name == 'write_access_id') && !$can_change_access) { + continue; + } + $page->$name = $value; } } @@ -74,6 +86,6 @@ if ($page->save()) { forward($page->getURL()); } else { - register_error(elgg_echo('pages:error:no_save')); + register_error(elgg_echo('pages:error:notsaved')); forward(REFERER); } diff --git a/mod/pages/images/pages.gif b/mod/pages/images/pages.gif Binary files differindex 2e4ee761a..7efcb7278 100644 --- a/mod/pages/images/pages.gif +++ b/mod/pages/images/pages.gif diff --git a/mod/pages/images/pages_lrg.gif b/mod/pages/images/pages_lrg.gif Binary files differindex 2e41e4739..234a52672 100644 --- a/mod/pages/images/pages_lrg.gif +++ b/mod/pages/images/pages_lrg.gif diff --git a/mod/pages/languages/en.php b/mod/pages/languages/en.php index 1c6d0318c..eb9d22708 100644 --- a/mod/pages/languages/en.php +++ b/mod/pages/languages/en.php @@ -27,7 +27,16 @@ $english = array( 'pages:revision' => "Revision", 'pages:navigation' => "Navigation", - 'pages:via' => "via pages", + 'pages:new' => "A new page", + 'pages:notification' => +'%s added a new page: + +%s +%s + +View and comment on the new page: +%s +', 'item:object:page_top' => 'Top-level pages', 'item:object:page' => 'Pages', 'pages:nogroup' => 'This group does not have any pages yet', diff --git a/mod/pages/lib/pages.php b/mod/pages/lib/pages.php index 0a6f3a620..3f27118a6 100644 --- a/mod/pages/lib/pages.php +++ b/mod/pages/lib/pages.php @@ -78,8 +78,13 @@ function pages_register_navigation_tree($container) { 'type' => 'object', 'subtype' => 'page_top', 'container_guid' => $container->getGUID(), + 'limit' => 0, )); + if (!$top_pages) { + return; + } + foreach ($top_pages as $page) { elgg_register_menu_item('pages_nav', array( 'name' => $page->getGUID(), @@ -96,6 +101,7 @@ function pages_register_navigation_tree($container) { 'subtype' => 'page', 'metadata_name' => 'parent_guid', 'metadata_value' => $parent->getGUID(), + 'limit' => 0, )); foreach ($children as $child) { @@ -109,4 +115,4 @@ function pages_register_navigation_tree($container) { } } } -} +}
\ No newline at end of file diff --git a/mod/pages/manifest.xml b/mod/pages/manifest.xml index 6990bd6b0..4cf999f45 100644 --- a/mod/pages/manifest.xml +++ b/mod/pages/manifest.xml @@ -6,7 +6,7 @@ <category>bundled</category> <category>content</category> <category>widget</category> - <description>Elgg Pages</description> + <description>Collaborative editing tool. Enables users to create pages similar to a wiki without having to know wiki syntax.</description> <website>http://www.elgg.org</website> <copyright>See COPYRIGHT.txt</copyright> <license>GNU General Public License version 2</license> diff --git a/mod/pages/pages/pages/history.php b/mod/pages/pages/pages/history.php index a63b37a7a..872596179 100644 --- a/mod/pages/pages/pages/history.php +++ b/mod/pages/pages/pages/history.php @@ -30,7 +30,12 @@ elgg_push_breadcrumb(elgg_echo('pages:history')); $title = $page->title . ": " . elgg_echo('pages:history'); -$content = list_annotations($page_guid, 'page', 20, false); +$content = elgg_list_annotations(array( + 'guid' => $page_guid, + 'annotation_name' => 'page', + 'limit' => 20, + 'order_by' => "n_table.time_created desc" +)); $body = elgg_view_layout('content', array( 'filter' => '', diff --git a/mod/pages/pages/pages/owner.php b/mod/pages/pages/pages/owner.php index 2ff45ae0c..b29332ee1 100644 --- a/mod/pages/pages/pages/owner.php +++ b/mod/pages/pages/pages/owner.php @@ -23,7 +23,6 @@ $content = elgg_list_entities(array( 'types' => 'object', 'subtypes' => 'page_top', 'container_guid' => elgg_get_page_owner_guid(), - 'limit' => $limit, 'full_view' => false, )); if (!$content) { diff --git a/mod/pages/pages/pages/view.php b/mod/pages/pages/pages/view.php index 5dfb76b55..6b9d03f49 100644 --- a/mod/pages/pages/pages/view.php +++ b/mod/pages/pages/pages/view.php @@ -8,6 +8,7 @@ $page_guid = get_input('guid'); $page = get_entity($page_guid); if (!$page) { + register_error(elgg_echo('noaccess')); forward(); } @@ -32,7 +33,8 @@ elgg_push_breadcrumb($title); $content = elgg_view_entity($page, array('full_view' => true)); $content .= elgg_view_comments($page); -if (elgg_get_logged_in_user_guid() == $page->getOwnerGuid()) { +// can add subpage if can edit this page and write to container (such as a group) +if ($page->canEdit() && $container->canWriteToContainer(0, 'object', 'page')) { $url = "pages/add/$page->guid"; elgg_register_menu_item('title', array( 'name' => 'subpage', diff --git a/mod/pages/start.php b/mod/pages/start.php index b2f26c719..834e98870 100644 --- a/mod/pages/start.php +++ b/mod/pages/start.php @@ -189,10 +189,12 @@ function pages_icon_url_override($hook, $type, $returnvalue, $params) { if (elgg_instanceof($entity, 'object', 'page_top') || elgg_instanceof($entity, 'object', 'page')) { switch ($params['size']) { + case 'topbar': + case 'tiny': case 'small': return 'mod/pages/images/pages.gif'; break; - case 'medium': + default: return 'mod/pages/images/pages_lrg.gif'; break; } @@ -264,13 +266,18 @@ function page_notify_message($hook, $entity_type, $returnvalue, $params) { $entity = $params['entity']; $to_entity = $params['to_entity']; $method = $params['method']; - if (($entity instanceof ElggEntity) && (($entity->getSubtype() == 'page_top') || ($entity->getSubtype() == 'page'))) { + + if (elgg_instanceof($entity, 'object', 'page') || elgg_instanceof($entity, 'object', 'page_top')) { $descr = $entity->description; $title = $entity->title; - //@todo why? - $url = elgg_get_site_url() . "view/" . $entity->guid; $owner = $entity->getOwnerEntity(); - return $owner->name . ' ' . elgg_echo("pages:via") . ': ' . $title . "\n\n" . $descr . "\n\n" . $entity->getURL(); + + return elgg_echo('pages:notification', array( + $owner->name, + $title, + $descr, + $entity->getURL() + )); } return null; } diff --git a/mod/pages/views/default/forms/pages/edit.php b/mod/pages/views/default/forms/pages/edit.php index 20737a121..9469f5eb9 100644 --- a/mod/pages/views/default/forms/pages/edit.php +++ b/mod/pages/views/default/forms/pages/edit.php @@ -6,7 +6,18 @@ */ $variables = elgg_get_config('pages'); +$user = elgg_get_logged_in_user_entity(); +$entity = elgg_extract('entity', $vars); +$can_change_access = true; +if ($user && $entity) { + $can_change_access = ($user->isAdmin() || $user->getGUID() == $entity->owner_guid); +} + foreach ($variables as $name => $type) { + // don't show read / write access inputs for non-owners or admin when editing + if (($type == 'access' || $type == 'write_access') && !$can_change_access) { + continue; + } ?> <div> <label><?php echo elgg_echo("pages:$name") ?></label> @@ -14,8 +25,8 @@ foreach ($variables as $name => $type) { if ($type != 'longtext') { echo '<br />'; } - ?> - <?php echo elgg_view("input/$type", array( + + echo elgg_view("input/$type", array( 'name' => $name, 'value' => $vars[$name], )); diff --git a/mod/pages/views/default/object/page_top.php b/mod/pages/views/default/object/page_top.php index e78289f28..945a22eed 100644 --- a/mod/pages/views/default/object/page_top.php +++ b/mod/pages/views/default/object/page_top.php @@ -45,7 +45,6 @@ $editor_link = elgg_view('output/url', array( $date = elgg_view_friendly_time($annotation->time_created); $editor_text = elgg_echo('pages:strapline', array($date, $editor_link)); -$tags = elgg_view('output/tags', array('tags' => $page->tags)); $categories = elgg_view('output/categories', $vars); $comments_count = $page->countComments(); @@ -82,7 +81,6 @@ if ($full) { 'entity' => $page, 'metadata' => $metadata, 'subtitle' => $subtitle, - 'tags' => $tags, ); $params = $params + $vars; $summary = elgg_view('object/elements/summary', $params); @@ -104,7 +102,6 @@ if ($full) { 'entity' => $page, 'metadata' => $metadata, 'subtitle' => $subtitle, - 'tags' => $tags, 'content' => $excerpt, ); $params = $params + $vars; diff --git a/mod/profile/icondirect.php b/mod/profile/icondirect.php index f7188455e..6c3148f2b 100644 --- a/mod/profile/icondirect.php +++ b/mod/profile/icondirect.php @@ -12,8 +12,16 @@ require_once(dirname(dirname(dirname(__FILE__))). '/engine/settings.php'); global $CONFIG; $join_date = (int)$_GET['joindate']; +$last_cache = (int)$_GET['lastcache']; // icontime $guid = (int)$_GET['guid']; +// If is the same ETag, content didn't changed. +$etag = $last_cache . $guid; +if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && trim($_SERVER['HTTP_IF_NONE_MATCH']) == $etag) { + header("HTTP/1.1 304 Not Modified"); + exit; +} + $size = strtolower($_GET['size']); if (!in_array($size, array('large', 'medium', 'small', 'tiny', 'master', 'topbar'))) { $size = "medium"; @@ -48,6 +56,7 @@ if ($mysql_dblink) { header("Pragma: public"); header("Cache-Control: public"); header("Content-Length: " . strlen($contents)); + header("ETag: $etag"); // this chunking is done for supposedly better performance $split_string = str_split($contents, 1024); foreach ($split_string as $chunk) { diff --git a/mod/profile/views/default/profile/js.php b/mod/profile/views/default/profile/js.php index 16dec59df..5a08a90bd 100644 --- a/mod/profile/views/default/profile/js.php +++ b/mod/profile/views/default/profile/js.php @@ -1,6 +1,9 @@ + +// force the first column to at least be as large as the profile box in cols 2 and 3 +// we also want to run before the widget init happens so priority is < 500 elgg.register_hook_handler('init', 'system', function() { // only do this on the profile page's widget canvas. if ($('.profile').length) { $('#elgg-widget-col-1').css('min-height', $('.profile').outerHeight(true) + 1); } -});
\ No newline at end of file +}, 400); diff --git a/mod/search/pages/search/index.php b/mod/search/pages/search/index.php index efa3ec037..fcd95c43e 100644 --- a/mod/search/pages/search/index.php +++ b/mod/search/pages/search/index.php @@ -145,11 +145,7 @@ foreach ($custom_types as $type) { $data = htmlspecialchars(http_build_query(array( 'q' => $query, - 'entity_subtype' => $entity_subtype, - 'entity_type' => $entity_type, - 'owner_guid' => $owner_guid, 'search_type' => $type, - 'friends' => $friends ))); $url = elgg_get_site_url()."search?$data"; @@ -240,8 +236,6 @@ if ($search_type != 'entities' || $search_type == 'all') { $current_params = $params; $current_params['search_type'] = $type; - // custom search types have no subtype. - unset($current_params['subtype']); $results = elgg_trigger_plugin_hook('search', $type, $current_params, array()); @@ -263,7 +257,11 @@ if ($search_type != 'entities' || $search_type == 'all') { } // highlight search terms -$searched_words = search_remove_ignored_words($display_query, 'array'); +if ($search_type == 'tags') { + $searched_words = array($display_query); +} else { + $searched_words = search_remove_ignored_words($display_query, 'array'); +} $highlighted_query = search_highlight_words($searched_words, $display_query); $body = elgg_view_title(elgg_echo('search:results', array("\"$highlighted_query\""))); diff --git a/mod/search/search_hooks.php b/mod/search/search_hooks.php index ab000f6f6..2143a0d24 100644 --- a/mod/search/search_hooks.php +++ b/mod/search/search_hooks.php @@ -284,7 +284,7 @@ function search_tags_hook($hook, $type, $value, $params) { } $tags_str = implode('. ', $matched_tags_strs); - $tags_str = search_get_highlighted_relevant_substrings($tags_str, $params['query']); + $tags_str = search_get_highlighted_relevant_substrings($tags_str, $params['query'], 30, 300, true); $entity->setVolatileData('search_matched_title', $title_str); $entity->setVolatileData('search_matched_description', $desc_str); diff --git a/mod/search/start.php b/mod/search/start.php index bb8531e9c..d2d7ed3c2 100644 --- a/mod/search/start.php +++ b/mod/search/start.php @@ -83,15 +83,18 @@ function search_page_handler($page) { * @param string $query * @param int $min_match_context = 30 * @param int $max_length = 300 + * @param bool $tag_match Search is for tags. Don't ignore words. * @return string */ -function search_get_highlighted_relevant_substrings($haystack, $query, $min_match_context = 30, $max_length = 300) { +function search_get_highlighted_relevant_substrings($haystack, $query, $min_match_context = 30, $max_length = 300, $tag_match = false) { $haystack = strip_tags($haystack); $haystack_length = elgg_strlen($haystack); $haystack_lc = elgg_strtolower($haystack); - $words = search_remove_ignored_words($query, 'array'); + if (!$tag_match) { + $words = search_remove_ignored_words($query, 'array'); + } // if haystack < $max_length return the entire haystack w/formatting immediately if ($haystack_length <= $max_length) { diff --git a/mod/search/views/default/search/list.php b/mod/search/views/default/search/list.php index c5249fe77..1ed40be1b 100644 --- a/mod/search/views/default/search/list.php +++ b/mod/search/views/default/search/list.php @@ -39,7 +39,7 @@ $url = elgg_get_site_url() . "search?$query"; // get pagination if (array_key_exists('pagination', $vars['params']) && $vars['params']['pagination']) { $nav = elgg_view('navigation/pagination',array( - 'baseurl' => $url, + 'base_url' => $url, 'offset' => $vars['params']['offset'], 'count' => $vars['results']['count'], 'limit' => $vars['params']['limit'], diff --git a/mod/search/views/default/search/search_box.php b/mod/search/views/default/search/search_box.php index 87d59519c..ff12ae4f0 100644 --- a/mod/search/views/default/search/search_box.php +++ b/mod/search/views/default/search/search_box.php @@ -38,6 +38,7 @@ $display_query = htmlspecialchars($display_query, ENT_QUOTES, 'UTF-8', false); <form class="<?php echo $class; ?>" action="<?php echo elgg_get_site_url(); ?>search" method="get"> <fieldset> <input type="text" class="search-input" size="21" name="q" value="<?php echo elgg_echo('search'); ?>" onblur="if (this.value=='') { this.value='<?php echo elgg_echo('search'); ?>' }" onfocus="if (this.value=='<?php echo elgg_echo('search'); ?>') { this.value='' };" /> + <input type="hidden" name="search_type" value="all" /> <input type="submit" value="<?php echo elgg_echo('search:go'); ?>" class="search-submit-button" /> </fieldset> -</form>
\ No newline at end of file +</form> diff --git a/mod/thewire/actions/add.php b/mod/thewire/actions/add.php index 97b630678..6b3d8d5ba 100644 --- a/mod/thewire/actions/add.php +++ b/mod/thewire/actions/add.php @@ -17,7 +17,7 @@ if (empty($body)) { forward(REFERER); } -$guid = thewire_save_post($body, get_loggedin_userid(), $access_id, $parent_guid, $method); +$guid = thewire_save_post($body, elgg_get_logged_in_user_guid(), $access_id, $parent_guid, $method); if (!$guid) { register_error(elgg_echo("thewire:error")); forward(REFERER); diff --git a/mod/thewire/classes/ElggWire.php b/mod/thewire/classes/ElggWire.php index 3242dd5cb..9c92dd8f2 100644 --- a/mod/thewire/classes/ElggWire.php +++ b/mod/thewire/classes/ElggWire.php @@ -1,6 +1,10 @@ <?php /** * ElggWire Class + * + * @property string $method The method used to create the wire post (site, sms, api) + * @property bool $reply Whether this wire post was a reply to another post + * @property int $wire_thread The identifier of the thread for this wire post */ class ElggWire extends ElggObject { diff --git a/mod/thewire/pages/thewire/owner.php b/mod/thewire/pages/thewire/owner.php index f544aa655..6246c1770 100644 --- a/mod/thewire/pages/thewire/owner.php +++ b/mod/thewire/pages/thewire/owner.php @@ -14,10 +14,12 @@ $title = elgg_echo('thewire:user', array($owner->name)); elgg_push_breadcrumb(elgg_echo('thewire'), "thewire/all"); elgg_push_breadcrumb($owner->name); +$context = ''; if (elgg_get_logged_in_user_guid() == $owner->guid) { $form_vars = array('class' => 'thewire-form'); $content = elgg_view_form('thewire/add', $form_vars); $content .= elgg_view('input/urlshortener'); + $context = 'mine'; } $content .= elgg_list_entities(array( @@ -28,7 +30,7 @@ $content .= elgg_list_entities(array( )); $body = elgg_view_layout('content', array( - 'filter_context' => 'mine', + 'filter_context' => $context, 'content' => $content, 'title' => $title, 'sidebar' => elgg_view('thewire/sidebar'), diff --git a/mod/thewire/pages/thewire/view.php b/mod/thewire/pages/thewire/view.php new file mode 100644 index 000000000..1818e725a --- /dev/null +++ b/mod/thewire/pages/thewire/view.php @@ -0,0 +1,30 @@ +<?php +/** + * View individual wire post + */ + +$post = get_entity(get_input('guid')); +if (!$post) { + register_error(elgg_echo('noaccess')); + forward(''); +} +$owner = $post->getOwnerEntity(); +if (!$owner) { + forward(); +} + +$title = elgg_echo('thewire:by', array($owner->name)); + +elgg_push_breadcrumb(elgg_echo('thewire'), 'thewire/all'); +elgg_push_breadcrumb($owner->name, 'thewire/owner/' . $owner->username); +elgg_push_breadcrumb($title); + +$content = elgg_view_entity($post); + +$body = elgg_view_layout('content', array( + 'filter' => false, + 'content' => $content, + 'title' => $title, +)); + +echo elgg_view_page($title, $body); diff --git a/mod/thewire/start.php b/mod/thewire/start.php index 328e5d46c..8e3b5224a 100644 --- a/mod/thewire/start.php +++ b/mod/thewire/start.php @@ -18,18 +18,14 @@ elgg_register_event_handler('init', 'system', 'thewire_init'); * The Wire initialization */ function thewire_init() { - global $CONFIG; - - // this can be removed in favor of activate/deactivate scripts - if (!update_subtype('object', 'thewire', 'ElggWire')) { - add_subtype('object', 'thewire', 'ElggWire'); - } // register the wire's JavaScript $thewire_js = elgg_get_simplecache_url('js', 'thewire'); elgg_register_simplecache_view('js/thewire'); elgg_register_js('elgg.thewire', $thewire_js, 'footer'); + elgg_register_ajax_view('thewire/previous'); + // add a site navigation item $item = new ElggMenuItem('thewire', elgg_echo('thewire'), 'thewire/all'); elgg_register_menu_item('site', $item); @@ -66,7 +62,7 @@ function thewire_init() { elgg_register_plugin_hook_handler('notify:entity:message', 'object', 'thewire_notify_message'); // Register actions - $action_base = $CONFIG->pluginspath . 'thewire/actions'; + $action_base = elgg_get_plugins_path() . 'thewire/actions'; elgg_register_action("thewire/add", "$action_base/add.php"); elgg_register_action("thewire/delete", "$action_base/delete.php"); @@ -81,7 +77,8 @@ function thewire_init() { * thewire/owner/<username> View this user's wire posts * thewire/following/<username> View the posts of those this user follows * thewire/reply/<guid> Reply to a post - * thewire/view/<guid> View a conversation thread + * thewire/view/<guid> View a post + * thewire/thread/<id> View a conversation thread * thewire/tag/<tag> View wire posts tagged with <tag> * * @param array $page From the page_handler function @@ -108,6 +105,12 @@ function thewire_page_handler($page) { include "$base_dir/owner.php"; break; + case "view": + if (isset($page[1])) { + set_input('guid', $page[1]); + } + include "$base_dir/view.php"; + case "thread": if (isset($page[1])) { set_input('thread_id', $page[1]); @@ -217,7 +220,7 @@ function thewire_filter($text) { // usernames $text = preg_replace( - '/(^|[^\w])@([\w.]+)/', + '/(^|[^\w])@([\p{L}\p{Nd}._]+)/u', '$1<a href="' . $CONFIG->wwwroot . 'thewire/owner/$2">@$2</a>', $text); @@ -308,7 +311,7 @@ function thewire_save_post($text, $userid, $access_id, $parent_guid = 0, $method */ function thewire_send_response_notification($guid, $parent_guid, $user) { $parent_owner = get_entity($parent_guid)->getOwnerEntity(); - $user = get_loggedin_user(); + $user = elgg_get_logged_in_user_entity(); // check to make sure user is not responding to self if ($parent_owner->guid != $user->guid) { diff --git a/mod/thewire/tests/regex.php b/mod/thewire/tests/regex.php index f5487a422..c73e06bdc 100644 --- a/mod/thewire/tests/regex.php +++ b/mod/thewire/tests/regex.php @@ -127,6 +127,12 @@ class TheWireRegexTest extends ElggCoreUnitTest { $expected = "test (" . $this->getUserWireLink('user') . ") test"; $result = thewire_filter($text); $this->assertEqual($result, $expected); + + // utf8 characters + $text = "@tyúkanyó"; + $expected = $this->getUserWireLink('tyúkanyó'); + $result = thewire_filter($text); + $this->assertEqual($result, $expected); } /** diff --git a/mod/twitter_api/actions/twitter_api/interstitial_settings.php b/mod/twitter_api/actions/twitter_api/interstitial_settings.php index 5f742efd8..880623973 100644 --- a/mod/twitter_api/actions/twitter_api/interstitial_settings.php +++ b/mod/twitter_api/actions/twitter_api/interstitial_settings.php @@ -6,8 +6,8 @@ elgg_make_sticky_form('twitter_api_interstitial'); $display_name = get_input('display_name'); $email = get_input('email'); -$password_1 = get_input('password_1'); -$password_2 = get_input('password_2'); +$password_1 = get_input('password_1', null, false); +$password_2 = get_input('password_2', null, false); if (!$display_name) { register_error(elgg_echo('twitter_api:interstitial:no_display_name')); diff --git a/mod/twitter_api/lib/twitter_api.php b/mod/twitter_api/lib/twitter_api.php index 355123992..fbce00d34 100644 --- a/mod/twitter_api/lib/twitter_api.php +++ b/mod/twitter_api/lib/twitter_api.php @@ -109,7 +109,7 @@ function twitter_api_login() { $user = twitter_api_create_user($twitter); $site_name = elgg_get_site_entity()->name; system_message(elgg_echo('twitter_api:login:email', array($site_name))); - $forward = "twitter_api/intersitial"; + $forward = "twitter_api/interstitial"; } // set twitter services tokens diff --git a/mod/uservalidationbyemail/start.php b/mod/uservalidationbyemail/start.php index ea59a2e7b..f98f57faf 100644 --- a/mod/uservalidationbyemail/start.php +++ b/mod/uservalidationbyemail/start.php @@ -184,7 +184,11 @@ function uservalidationbyemail_page_handler($page) { $user->enable(); elgg_pop_context(); - login($user); + try { + login($user); + } catch(LoginException $e){ + register_error($e->getMessage()); + } } else { register_error(elgg_echo('email:confirm:fail')); } diff --git a/mod/uservalidationbyemail/views/default/forms/uservalidationbyemail/bulk_action.php b/mod/uservalidationbyemail/views/default/forms/uservalidationbyemail/bulk_action.php index 2afd6022d..cbd13a709 100644 --- a/mod/uservalidationbyemail/views/default/forms/uservalidationbyemail/bulk_action.php +++ b/mod/uservalidationbyemail/views/default/forms/uservalidationbyemail/bulk_action.php @@ -40,7 +40,7 @@ elgg_set_ignore_access($ia); // setup pagination $pagination = elgg_view('navigation/pagination',array( - 'baseurl' => 'admin/users/unvalidated', + 'base_url' => 'admin/users/unvalidated', 'offset' => $offset, 'count' => $count, 'limit' => $limit, |