diff options
author | Sem <sembrestels@riseup.net> | 2012-01-12 16:15:16 +0100 |
---|---|---|
committer | Sem <sembrestels@riseup.net> | 2012-01-12 16:15:16 +0100 |
commit | cc544cfa2086e418318a899ffd550adfb744c7ba (patch) | |
tree | 6c04fbe2e3df67513aa76803cb8d05c105ba219b /mod | |
parent | e7d64510ebd823f186282e2b80780295bcca1b79 (diff) | |
parent | 68e4829ac0959d86c651e7ed6dc255c39694c8af (diff) | |
download | elgg-cc544cfa2086e418318a899ffd550adfb744c7ba.tar.gz elgg-cc544cfa2086e418318a899ffd550adfb744c7ba.tar.bz2 |
Merge Elgg 1.8.3.
Diffstat (limited to 'mod')
47 files changed, 264 insertions, 183 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/lib/blog.php b/mod/blog/lib/blog.php index 590547a8c..286fe1832 100644 --- a/mod/blog/lib/blog.php +++ b/mod/blog/lib/blog.php @@ -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..a8553b4b8 100644 --- a/mod/blog/start.php +++ b/mod/blog/start.php @@ -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(); @@ -234,7 +239,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 +248,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..aa8074a69 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( diff --git a/mod/developers/languages/en.php b/mod/developers/languages/en.php index a2682363c..812f779fa 100644 --- a/mod/developers/languages/en.php +++ b/mod/developers/languages/en.php @@ -9,6 +9,7 @@ $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', @@ -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/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/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/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/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..5242cbda2 100644 --- a/mod/file/actions/file/upload.php +++ b/mod/file/actions/file/upload.php @@ -109,7 +109,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 +125,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 +135,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/start.php b/mod/file/start.php index 3e1ae169d..ad88469c8 100644 --- a/mod/file/start.php +++ b/mod/file/start.php @@ -349,7 +349,8 @@ 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( 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/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..104da4b41 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; @@ -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..a4a9e2b2b 100644 --- a/mod/groups/languages/en.php +++ b/mod/groups/languages/en.php @@ -61,6 +61,8 @@ $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: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 7798e5dc3..5d6083077 100644 --- a/mod/groups/lib/groups.php +++ b/mod/groups/lib/groups.php @@ -234,6 +234,8 @@ function groups_handle_invitations_page() { function groups_handle_profile_page($guid) { elgg_set_page_owner_guid($guid); + elgg_push_context('group_profile'); + // turn this into a core function global $autofeed; $autofeed = true; @@ -247,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..86a1da279 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; } 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/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/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/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/lib/pages.php b/mod/pages/lib/pages.php index 0a6f3a620..5c5323d6f 100644 --- a/mod/pages/lib/pages.php +++ b/mod/pages/lib/pages.php @@ -78,6 +78,7 @@ function pages_register_navigation_tree($container) { 'type' => 'object', 'subtype' => 'page_top', 'container_guid' => $container->getGUID(), + 'limit' => 0, )); foreach ($top_pages as $page) { @@ -96,6 +97,7 @@ function pages_register_navigation_tree($container) { 'subtype' => 'page', 'metadata_name' => 'parent_guid', 'metadata_value' => $parent->getGUID(), + 'limit' => 0, )); foreach ($children as $child) { 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/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..91817096b 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()); 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/start.php b/mod/thewire/start.php index 328e5d46c..202e3d1d6 100644 --- a/mod/thewire/start.php +++ b/mod/thewire/start.php @@ -30,6 +30,8 @@ function thewire_init() { 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); diff --git a/mod/tinymce/views/default/js/tinymce.php b/mod/tinymce/views/default/js/tinymce.php index 20236d657..e6e2865a5 100644 --- a/mod/tinymce/views/default/js/tinymce.php +++ b/mod/tinymce/views/default/js/tinymce.php @@ -38,7 +38,7 @@ elgg.tinymce.init = function() { mode : "specific_textareas", editor_selector : "elgg-input-longtext", theme : "advanced", - plugins : "spellchecker,autosave,fullscreen,paste", + plugins : "lists,spellchecker,autosave,fullscreen,paste", relative_urls : false, remove_script_host : false, document_base_url : elgg.config.wwwroot, |