diff options
Diffstat (limited to 'mod')
-rw-r--r-- | mod/blog/lib/blog.php | 1 | ||||
-rw-r--r-- | mod/blog/views/default/js/blog/save_draft.php | 6 | ||||
-rw-r--r-- | mod/bookmarks/start.php | 5 | ||||
-rw-r--r-- | mod/externalpages/views/default/expages/wrapper.php | 2 | ||||
-rw-r--r-- | mod/groups/actions/groups/edit.php | 5 | ||||
-rw-r--r-- | mod/groups/languages/en.php | 1 | ||||
-rw-r--r-- | mod/groups/lib/discussion.php | 2 | ||||
-rw-r--r-- | mod/groups/lib/groups.php | 14 | ||||
-rw-r--r-- | mod/groups/start.php | 59 | ||||
-rw-r--r-- | mod/groups/views/default/forms/groups/edit.php | 14 | ||||
-rw-r--r-- | mod/htmlawed/start.php | 22 | ||||
-rw-r--r-- | mod/htmlawed/tests/tags.php | 45 | ||||
-rw-r--r-- | mod/pages/lib/pages.php | 22 | ||||
-rw-r--r-- | mod/pages/start.php | 1 | ||||
-rw-r--r-- | mod/profile/icondirect.php | 6 | ||||
-rw-r--r-- | mod/profile/start.php | 2 | ||||
-rw-r--r-- | mod/reportedcontent/views/default/widgets/reportedcontent/content.php | 1 | ||||
-rw-r--r-- | mod/thewire/actions/delete.php | 2 | ||||
-rw-r--r-- | mod/tinymce/README.txt | 10 | ||||
-rw-r--r-- | mod/tinymce/activate.php | 14 | ||||
-rw-r--r-- | mod/tinymce/languages/en.php | 3 | ||||
-rw-r--r-- | mod/tinymce/start.php | 12 | ||||
-rw-r--r-- | mod/tinymce/views/default/js/tinymce.php | 3 |
23 files changed, 200 insertions, 52 deletions
diff --git a/mod/blog/lib/blog.php b/mod/blog/lib/blog.php index 9a02a8cc3..4622a9e7e 100644 --- a/mod/blog/lib/blog.php +++ b/mod/blog/lib/blog.php @@ -272,7 +272,6 @@ function blog_get_page_content_edit($page, $guid = 0, $revision = NULL) { $vars = array(); $vars['id'] = 'blog-post-edit'; - $vars['name'] = 'blog_post'; $vars['class'] = 'elgg-form-alt'; if ($page == 'edit') { diff --git a/mod/blog/views/default/js/blog/save_draft.php b/mod/blog/views/default/js/blog/save_draft.php index 8a994ffb0..8cd07ff5d 100644 --- a/mod/blog/views/default/js/blog/save_draft.php +++ b/mod/blog/views/default/js/blog/save_draft.php @@ -12,7 +12,7 @@ elgg.provide('elgg.blog'); */ elgg.blog.saveDraftCallback = function(data, textStatus, XHR) { if (textStatus == 'success' && data.success == true) { - var form = $('form[name=blog_post]'); + var form = $('form[id=blog-post-edit]'); // update the guid input element for new posts that now have a guid form.find('input[name=guid]').val(data.guid); @@ -36,7 +36,7 @@ elgg.blog.saveDraft = function() { } // only save on changed content - var form = $('form[name=blog_post]'); + var form = $('form[id=blog-post-edit]'); var description = form.find('textarea[name=description]').val(); var title = form.find('input[name=title]').val(); @@ -59,7 +59,7 @@ elgg.blog.saveDraft = function() { elgg.blog.init = function() { // get a copy of the body to compare for auto save - oldDescription = $('form[name=blog_post]').find('textarea[name=description]').val(); + oldDescription = $('form[id=blog-post-edit]').find('textarea[name=description]').val(); setInterval(elgg.blog.saveDraft, 60000); }; diff --git a/mod/bookmarks/start.php b/mod/bookmarks/start.php index 56bac984a..66e22b565 100644 --- a/mod/bookmarks/start.php +++ b/mod/bookmarks/start.php @@ -86,8 +86,13 @@ function bookmarks_init() { * @return bool */ function bookmarks_page_handler($page) { + elgg_load_library('elgg:bookmarks'); + if (!isset($page[0])) { + $page[0] = 'all'; + } + elgg_push_breadcrumb(elgg_echo('bookmarks'), 'bookmarks/all'); // old group usernames diff --git a/mod/externalpages/views/default/expages/wrapper.php b/mod/externalpages/views/default/expages/wrapper.php index 8eb0b2f84..c579da1ba 100644 --- a/mod/externalpages/views/default/expages/wrapper.php +++ b/mod/externalpages/views/default/expages/wrapper.php @@ -9,7 +9,7 @@ echo $vars['content']; echo '<div class="mtm">'; echo elgg_view('output/url', array( - 'text' => 'Back', + 'text' => elgg_echo('back'), 'href' => $_SERVER['HTTP_REFERER'], 'class' => 'float-alt' )); diff --git a/mod/groups/actions/groups/edit.php b/mod/groups/actions/groups/edit.php index b513a6098..a3ad91622 100644 --- a/mod/groups/actions/groups/edit.php +++ b/mod/groups/actions/groups/edit.php @@ -15,6 +15,8 @@ function profile_array_decoder(&$v) { $v = html_entity_decode($v, ENT_COMPAT, 'UTF-8'); } +elgg_make_sticky_form('groups'); + // Get group fields $input = array(); foreach ($CONFIG->group as $shortname => $valuetype) { @@ -106,6 +108,9 @@ if (elgg_get_plugin_setting('hidden_groups', 'groups') == 'yes') { $group->save(); +// group saved so clear sticky form +elgg_clear_sticky_form('groups'); + // group creator needs to be member of new group and river entry created if ($new_group_flag) { elgg_set_page_owner_guid($group->guid); diff --git a/mod/groups/languages/en.php b/mod/groups/languages/en.php index 88aeccb54..4868aa334 100644 --- a/mod/groups/languages/en.php +++ b/mod/groups/languages/en.php @@ -12,6 +12,7 @@ $english = array( */ 'groups' => "Groups", 'groups:owned' => "Groups I own", + 'groups:owned:user' => 'Groups %s owns', 'groups:yours' => "My groups", 'groups:user' => "%s's groups", 'groups:all' => "All groups", diff --git a/mod/groups/lib/discussion.php b/mod/groups/lib/discussion.php index 02ab27fdc..ab2fe4849 100644 --- a/mod/groups/lib/discussion.php +++ b/mod/groups/lib/discussion.php @@ -15,7 +15,7 @@ function discussion_handle_all_page() { 'type' => 'object', 'subtype' => 'groupforumtopic', 'order_by' => 'e.last_action desc', - 'limit' => 40, + 'limit' => 20, 'full_view' => false, )); diff --git a/mod/groups/lib/groups.php b/mod/groups/lib/groups.php index 498766df0..51ae89a87 100644 --- a/mod/groups/lib/groups.php +++ b/mod/groups/lib/groups.php @@ -106,7 +106,11 @@ function groups_handle_owned_page() { $page_owner = elgg_get_page_owner_entity(); - $title = elgg_echo('groups:owned'); + if ($page_owner->guid == elgg_get_logged_in_user_guid()) { + $title = elgg_echo('groups:owned'); + } else { + $title = elgg_echo('groups:owned:user', array($page_owner->name)); + } elgg_push_breadcrumb($title); elgg_register_title_button(); @@ -137,7 +141,11 @@ function groups_handle_mine_page() { $page_owner = elgg_get_page_owner_entity(); - $title = elgg_echo('groups:yours'); + if ($page_owner->guid == elgg_get_logged_in_user_guid()) { + $title = elgg_echo('groups:yours'); + } else { + $title = elgg_echo('groups:user', array($page_owner->name)); + } elgg_push_breadcrumb($title); elgg_register_title_button(); @@ -238,6 +246,8 @@ function groups_handle_profile_page($guid) { global $autofeed; $autofeed = true; + elgg_push_context('group_profile'); + $group = get_entity($guid); if (!$group) { forward('groups/all'); diff --git a/mod/groups/start.php b/mod/groups/start.php index 193b72a4e..c591410c5 100644 --- a/mod/groups/start.php +++ b/mod/groups/start.php @@ -141,35 +141,34 @@ function groups_setup_sidebar_menus() { // Get the page owner entity $page_owner = elgg_get_page_owner_entity(); - if (elgg_get_context() == 'groups') { - if ($page_owner instanceof ElggGroup) { - if (elgg_is_logged_in() && $page_owner->canEdit() && !$page_owner->isPublicMembership()) { - $url = elgg_get_site_url() . "groups/requests/{$page_owner->getGUID()}"; - elgg_register_menu_item('page', array( - 'name' => 'membership_requests', - 'text' => elgg_echo('groups:membershiprequests'), - 'href' => $url, - )); - } - } else { + if (elgg_in_context('group_profile')) { + if (elgg_is_logged_in() && $page_owner->canEdit() && !$page_owner->isPublicMembership()) { + $url = elgg_get_site_url() . "groups/requests/{$page_owner->getGUID()}"; elgg_register_menu_item('page', array( - 'name' => 'groups:all', - 'text' => elgg_echo('groups:all'), - 'href' => 'groups/all', + 'name' => 'membership_requests', + 'text' => elgg_echo('groups:membershiprequests'), + 'href' => $url, )); + } + } + if (elgg_get_context() == 'groups' && !elgg_instanceof($page_owner, 'group')) { + elgg_register_menu_item('page', array( + 'name' => 'groups:all', + 'text' => elgg_echo('groups:all'), + 'href' => 'groups/all', + )); - $user = elgg_get_logged_in_user_entity(); - if ($user) { - $url = "groups/owner/$user->username"; - $item = new ElggMenuItem('groups:owned', elgg_echo('groups:owned'), $url); - elgg_register_menu_item('page', $item); - $url = "groups/member/$user->username"; - $item = new ElggMenuItem('groups:member', elgg_echo('groups:yours'), $url); - elgg_register_menu_item('page', $item); - $url = "groups/invitations/$user->username"; - $item = new ElggMenuItem('groups:user:invites', elgg_echo('groups:invitations'), $url); - elgg_register_menu_item('page', $item); - } + $user = elgg_get_logged_in_user_entity(); + if ($user) { + $url = "groups/owner/$user->username"; + $item = new ElggMenuItem('groups:owned', elgg_echo('groups:owned'), $url); + elgg_register_menu_item('page', $item); + $url = "groups/member/$user->username"; + $item = new ElggMenuItem('groups:member', elgg_echo('groups:yours'), $url); + elgg_register_menu_item('page', $item); + $url = "groups/invitations/$user->username"; + $item = new ElggMenuItem('groups:user:invites', elgg_echo('groups:invitations'), $url); + elgg_register_menu_item('page', $item); } } } @@ -197,6 +196,10 @@ function groups_page_handler($page) { elgg_load_library('elgg:groups'); + if (!isset($page[0])) { + $page[0] = 'all'; + } + elgg_push_breadcrumb(elgg_echo('groups'), "groups/all"); switch ($page[0]) { @@ -786,6 +789,10 @@ function discussion_page_handler($page) { elgg_load_library('elgg:discussion'); + if (!isset($page[0])) { + $page[0] = 'all'; + } + elgg_push_breadcrumb(elgg_echo('discussion'), 'discussion/all'); switch ($page[0]) { diff --git a/mod/groups/views/default/forms/groups/edit.php b/mod/groups/views/default/forms/groups/edit.php index 8055b6430..7540d1bf9 100644 --- a/mod/groups/views/default/forms/groups/edit.php +++ b/mod/groups/views/default/forms/groups/edit.php @@ -5,8 +5,16 @@ * @package ElggGroups */ +if (elgg_is_sticky_form('groups')) { + $sticky_values = elgg_get_sticky_values('groups'); + elgg_clear_sticky_form('groups'); +} + // new groups default to open membership -if (isset($vars['entity'])) { +if (isset($sticky_values)) { + $membership = $sticky_values['membership']; + $access = $sticky_values['access_id']; +} elseif (isset($vars['entity'])) { $membership = $vars['entity']->membership; $access = $vars['entity']->access_id; if ($access != ACCESS_PUBLIC && $access != ACCESS_LOGGED_IN) { @@ -27,7 +35,7 @@ if (isset($vars['entity'])) { <label><?php echo elgg_echo("groups:name"); ?></label><br /> <?php echo elgg_view("input/text", array( 'name' => 'name', - 'value' => $vars['entity']->name, + 'value' => isset($sticky_values['name']) ? $sticky_values['name'] : $vars['entity']->name, )); ?> </div> @@ -45,7 +53,7 @@ if ($group_profile_fields > 0) { echo "</label>$line_break"; echo elgg_view("input/{$valtype}", array( 'name' => $shortname, - 'value' => $vars['entity']->$shortname, + 'value' => isset($sticky_values[$shortname]) ? $sticky_values[$shortname] : $vars['entity']->$shortname, )); echo '</div>'; } diff --git a/mod/htmlawed/start.php b/mod/htmlawed/start.php index 10bea2a52..12b6470a3 100644 --- a/mod/htmlawed/start.php +++ b/mod/htmlawed/start.php @@ -18,6 +18,8 @@ function htmlawed_init() { $lib = elgg_get_plugins_path() . "htmlawed/vendors/htmLawed/htmLawed.php"; elgg_register_library('htmlawed', $lib); + + elgg_register_plugin_hook_handler('unit_test', 'system', 'htmlawed_test'); } /** @@ -90,7 +92,13 @@ function htmLawedArray(&$v, $k, $htmlawed_config) { * @param array $attributes An array of attributes * @return string */ -function htmlawed_tag_post_processor($element, $attributes) { +function htmlawed_tag_post_processor($element, $attributes = false) { + if ($attributes === false) { + // This is a closing tag. Prevent further processing to avoid inserting a duplicate tag + + return "</${element}>"; + } + // these are the default styles used by tinymce. $allowed_styles = array( 'color', 'cursor', 'text-align', 'vertical-align', 'font-size', @@ -143,3 +151,15 @@ function htmlawed_tag_post_processor($element, $attributes) { $r = "<$element$string>"; return $r; } + +/** + * Runs unit tests for htmlawed + * + * @return array + * */ +function htmlawed_test($hook, $type, $value, $params) { + global $CONFIG; + + $value[] = dirname(__FILE__) . '/tests/tags.php'; + return $value; +} diff --git a/mod/htmlawed/tests/tags.php b/mod/htmlawed/tests/tags.php new file mode 100644 index 000000000..b3914a9d6 --- /dev/null +++ b/mod/htmlawed/tests/tags.php @@ -0,0 +1,45 @@ +<?php +/** + * Dupplicated tags in htmlawed + */ +class HtmLawedDuplicateTagsTest extends ElggCoreUnitTest { + + /** + * Called before each test object. + */ + public function __construct() { + parent::__construct(); + } + + /** + * Called before each test method. + */ + public function setUp() { + } + + /** + * Called after each test method. + */ + public function tearDown() { + // do not allow SimpleTest to interpret Elgg notices as exceptions + $this->swallowErrors(); + } + + /** + * Called after each test object. + */ + public function __destruct() { + elgg_set_ignore_access($this->ia); + // all __destruct() code should go above here + parent::__destruct(); + } + + public function testNotDuplicateTags() { + $filter_html = '<ul><li>item</li></ul>'; + set_input('test', $filter_html); + + $expected = $filter_html; + $result = get_input('test'); + $this->assertEqual($result, $expected); + } +}
\ No newline at end of file diff --git a/mod/pages/lib/pages.php b/mod/pages/lib/pages.php index 3f27118a6..9a9ba12e9 100644 --- a/mod/pages/lib/pages.php +++ b/mod/pages/lib/pages.php @@ -103,16 +103,18 @@ function pages_register_navigation_tree($container) { 'metadata_value' => $parent->getGUID(), 'limit' => 0, )); - - foreach ($children as $child) { - elgg_register_menu_item('pages_nav', array( - 'name' => $child->getGUID(), - 'text' => $child->title, - 'href' => $child->getURL(), - 'parent_name' => $parent->getGUID(), - )); - array_push($stack, $child); + + if ($children) { + foreach ($children as $child) { + elgg_register_menu_item('pages_nav', array( + 'name' => $child->getGUID(), + 'text' => $child->title, + 'href' => $child->getURL(), + 'parent_name' => $parent->getGUID(), + )); + array_push($stack, $child); + } } } } -}
\ No newline at end of file +} diff --git a/mod/pages/start.php b/mod/pages/start.php index c385131bd..6b0ad38b0 100644 --- a/mod/pages/start.php +++ b/mod/pages/start.php @@ -30,7 +30,6 @@ function pages_init() { // Register some actions $action_base = elgg_get_plugins_path() . 'pages/actions/pages'; elgg_register_action("pages/edit", "$action_base/edit.php"); - elgg_register_action("pages/editwelcome", "$action_base/editwelcome.php"); elgg_register_action("pages/delete", "$action_base/delete.php"); // Extend the main css view diff --git a/mod/profile/icondirect.php b/mod/profile/icondirect.php index 6c3148f2b..c4439f78c 100644 --- a/mod/profile/icondirect.php +++ b/mod/profile/icondirect.php @@ -11,6 +11,12 @@ require_once(dirname(dirname(dirname(__FILE__))). '/engine/settings.php'); global $CONFIG; +// won't be able to serve anything if no joindate or guid +if (!isset($_GET['joindate']) || !isset($_GET['guid'])) { + header("HTTP/1.1 404 Not Found"); + exit; +} + $join_date = (int)$_GET['joindate']; $last_cache = (int)$_GET['lastcache']; // icontime $guid = (int)$_GET['guid']; diff --git a/mod/profile/start.php b/mod/profile/start.php index abe044632..ab596f235 100644 --- a/mod/profile/start.php +++ b/mod/profile/start.php @@ -56,6 +56,8 @@ function profile_page_handler($page) { $username = $page[0]; $user = get_user_by_username($username); elgg_set_page_owner_guid($user->guid); + } elseif (elgg_is_logged_in()) { + forward(elgg_get_logged_in_user_entity()->getURL()); } // short circuit if invalid or banned username diff --git a/mod/reportedcontent/views/default/widgets/reportedcontent/content.php b/mod/reportedcontent/views/default/widgets/reportedcontent/content.php index 4f8906ef2..4c6595653 100644 --- a/mod/reportedcontent/views/default/widgets/reportedcontent/content.php +++ b/mod/reportedcontent/views/default/widgets/reportedcontent/content.php @@ -7,6 +7,7 @@ $list = elgg_list_entities(array( 'types' => 'object', 'subtypes' => 'reported_content', 'limit' => $vars['entity']->num_display, + 'pagination' => false, )); if (!$list) { $list = '<p class="mtm">' . elgg_echo('reportedcontent:none') . '</p>'; diff --git a/mod/thewire/actions/delete.php b/mod/thewire/actions/delete.php index 58502a7e7..38355d25e 100644 --- a/mod/thewire/actions/delete.php +++ b/mod/thewire/actions/delete.php @@ -24,7 +24,7 @@ if ($thewire->getSubtype() == "thewire" && $thewire->canEdit()) { } // Get owning user - $owner = get_entity($thewire->getOwner()); + $owner = get_entity($thewire->getOwnerGUID()); // Delete it $rowsaffected = $thewire->delete(); diff --git a/mod/tinymce/README.txt b/mod/tinymce/README.txt new file mode 100644 index 000000000..2814e9390 --- /dev/null +++ b/mod/tinymce/README.txt @@ -0,0 +1,10 @@ +Adding a language +====================== +1. Download the language pack from [TinyMCE][1] +2. Extract the files from the zip file. +3. Copy the langs, plugins, and themes directories into mod/tinymce/vendor/tinymce/jscripts/tiny_mce/. +There are already directories with those names. You do not want to delete those directories. +Instead, copy the new directories on top of the old ones. +4. Flush the Elgg caches. + +[1]: http://www.tinymce.com/i18n/index.php?ctrl=lang&act=download "TinyMCE" diff --git a/mod/tinymce/activate.php b/mod/tinymce/activate.php new file mode 100644 index 000000000..6f5cc8d50 --- /dev/null +++ b/mod/tinymce/activate.php @@ -0,0 +1,14 @@ +<?php +/** + * Prompt the user to install a tinymce language after activating + */ + +if (elgg_get_config('language') != tinymce_get_site_language()) { + $message = elgg_echo('tinymce:lang_notice', array( + elgg_echo(elgg_get_config('language')), + "http://www.tinymce.com/i18n/index.php?ctrl=lang&act=download", + elgg_get_plugins_path() . "tinymce/vendor/tinymce/jscripts/tiny_mce/", + elgg_add_action_tokens_to_url(elgg_normalize_url('action/admin/site/flush_cache')), + )); + elgg_add_admin_notice('tinymce_admin_notice_no_lang', $message); +} diff --git a/mod/tinymce/languages/en.php b/mod/tinymce/languages/en.php index 811e93492..b2702549c 100644 --- a/mod/tinymce/languages/en.php +++ b/mod/tinymce/languages/en.php @@ -9,6 +9,7 @@ $english = array( 'tinymce:remove' => "Remove editor", 'tinymce:add' => "Add editor", 'tinymce:word_count' => 'Word count: ', + 'tinymce:lang_notice' => "Your site language is %s but it isn't installed for TinyMCE. Get it <a target=\"_blank\" href=\"%s\">here</a> and copy it to %s. Then, <a href=\"%s\">flush the caches</a>. See the TinyMCE README for more details.", ); -add_translation("en", $english);
\ No newline at end of file +add_translation("en", $english); diff --git a/mod/tinymce/start.php b/mod/tinymce/start.php index 48625f456..6aba837e0 100644 --- a/mod/tinymce/start.php +++ b/mod/tinymce/start.php @@ -33,3 +33,15 @@ function tinymce_longtext_menu($hook, $type, $items, $vars) { return $items; } + +function tinymce_get_site_language() { + + if ($site_language = elgg_get_config('language')) { + $path = elgg_get_plugins_path() . "tinymce/vendor/tinymce/jscripts/tiny_mce/langs"; + if (file_exists("$path/$site_language.js")) { + return $site_language; + } + } + + return 'en'; +} diff --git a/mod/tinymce/views/default/js/tinymce.php b/mod/tinymce/views/default/js/tinymce.php index e6e2865a5..51e99c223 100644 --- a/mod/tinymce/views/default/js/tinymce.php +++ b/mod/tinymce/views/default/js/tinymce.php @@ -38,6 +38,7 @@ elgg.tinymce.init = function() { mode : "specific_textareas", editor_selector : "elgg-input-longtext", theme : "advanced", + language : "<?php echo tinymce_get_site_language(); ?>", plugins : "lists,spellchecker,autosave,fullscreen,paste", relative_urls : false, remove_script_host : false, @@ -86,4 +87,4 @@ elgg.tinymce.init = function() { } } -elgg.register_hook_handler('init', 'system', elgg.tinymce.init);
\ No newline at end of file +elgg.register_hook_handler('init', 'system', elgg.tinymce.init); |