diff options
38 files changed, 248 insertions, 134 deletions
diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..5cc8f375a --- /dev/null +++ b/.travis.yml @@ -0,0 +1,10 @@ +language: php
+phps:
+ - 5.2
+ - 5.3
+
+script: phpunit --help
+
+branches:
+ only:
+ - master
\ No newline at end of file diff --git a/actions/login.php b/actions/login.php index 256e78acb..ea7fb3508 100644 --- a/actions/login.php +++ b/actions/login.php @@ -18,9 +18,9 @@ if (isset($_SESSION['last_forward_from']) && $_SESSION['last_forward_from']) { } $username = get_input('username'); -$password = get_input("password"); -$persistent = get_input("persistent", FALSE); -$result = FALSE; +$password = get_input('password', null, false); +$persistent = get_input("persistent", false); +$result = false; if (empty($username) || empty($password)) { register_error(elgg_echo('login:empty')); @@ -28,7 +28,7 @@ if (empty($username) || empty($password)) { } // check if logging in with email address -if (strpos($username, '@') !== FALSE && ($users = get_user_by_email($username))) { +if (strpos($username, '@') !== false && ($users = get_user_by_email($username))) { $username = $users[0]->username; } diff --git a/actions/register.php b/actions/register.php index 360b7cb4b..f23d5b381 100644 --- a/actions/register.php +++ b/actions/register.php @@ -10,8 +10,8 @@ elgg_make_sticky_form('register'); // Get variables $username = get_input('username'); -$password = get_input('password'); -$password2 = get_input('password2'); +$password = get_input('password', null, false); +$password2 = get_input('password2', null, false); $email = get_input('email'); $name = get_input('name'); $friend_guid = (int) get_input('friend_guid', 0); diff --git a/actions/useradd.php b/actions/useradd.php index fdcd7e438..17459021b 100644 --- a/actions/useradd.php +++ b/actions/useradd.php @@ -10,8 +10,8 @@ elgg_make_sticky_form('useradd'); // Get variables $username = get_input('username'); -$password = get_input('password'); -$password2 = get_input('password2'); +$password = get_input('password', null, false); +$password2 = get_input('password2', null, false); $email = get_input('email'); $name = get_input('name'); diff --git a/engine/classes/ElggPluginManifest.php b/engine/classes/ElggPluginManifest.php index 7592eb667..7aa702d47 100644 --- a/engine/classes/ElggPluginManifest.php +++ b/engine/classes/ElggPluginManifest.php @@ -592,4 +592,23 @@ class ElggPluginManifest { return $return; } + + /** + * Returns a category's friendly name. This can be localized by + * defining the string 'admin:plugins:category:<category>'. If no + * localization is found, returns the category with _ and - converted to ' ' + * and then ucwords()'d. + * + * @param str $category The category as defined in the manifest. + * @return str A human-readable category + */ + static public function getFriendlyCategory($category) { + $cat_raw_string = "admin:plugins:category:$category"; + $cat_display_string = elgg_echo($cat_raw_string); + if ($cat_display_string == $cat_raw_string) { + $category = str_replace(array('-', '_'), ' ', $category); + $cat_display_string = ucwords($category); + } + return $cat_display_string; + } } diff --git a/engine/classes/ElggSite.php b/engine/classes/ElggSite.php index bf3234a18..6d07778a9 100644 --- a/engine/classes/ElggSite.php +++ b/engine/classes/ElggSite.php @@ -439,6 +439,8 @@ class ElggSite extends ElggEntity { 'js/.*', 'cache/css/.*', 'cache/js/.*', + 'cron/.*', + 'services/.*', ); // include a hook for plugin authors to include public pages diff --git a/engine/lib/output.php b/engine/lib/output.php index b96cf354c..b1245a924 100644 --- a/engine/lib/output.php +++ b/engine/lib/output.php @@ -310,15 +310,19 @@ function elgg_get_friendly_title($title) { return $result; } + // @todo not using this because of locale concerns //$title = iconv('UTF-8', 'ASCII//TRANSLIT', $title); + // @todo this uses a utf8 character class. can use if + // we want to support utf8 in the url. + //$title = preg_replace('/[^\p{L}\- ]/u', '', $title); + // use A-Za-z0-9_ instead of \w because \w is locale sensitive - $title = preg_replace("/[^A-Za-z0-9_ ]/", "", $title); - $title = preg_replace("/[^\w ]/", "", $title); + $title = preg_replace("/[^A-Za-z0-9_\- ]/", "", $title); $title = str_replace(" ", "-", $title); $title = str_replace("--", "-", $title); $title = trim($title); - $title = strtolower($title); + $title = elgg_strtolower($title); return $title; } diff --git a/engine/lib/relationships.php b/engine/lib/relationships.php index fabe2d2d6..f50c4a485 100644 --- a/engine/lib/relationships.php +++ b/engine/lib/relationships.php @@ -290,7 +290,7 @@ function elgg_get_entities_from_relationship($options) { $options['selects'] = array(); } - $select = array('r.*'); + $select = array('r.id'); $options['selects'] = array_merge($options['selects'], $select); } diff --git a/engine/lib/upgrades/2012041800-1.8.3-dont_filter_passwords-c0ca4a18b38ae2bc.php b/engine/lib/upgrades/2012041800-1.8.3-dont_filter_passwords-c0ca4a18b38ae2bc.php new file mode 100644 index 000000000..b82ffbebf --- /dev/null +++ b/engine/lib/upgrades/2012041800-1.8.3-dont_filter_passwords-c0ca4a18b38ae2bc.php @@ -0,0 +1,11 @@ +<?php +/** + * Elgg 1.8.3 upgrade 2012041800 + * dont_filter_passwords + * + * Add admin notice that password handling has changed and if + * users can't login to have them reset their passwords. + */ +elgg_add_admin_notice('dont_filter_passwords', 'Password handling has been updated to be more secure and flexible. ' + . 'This change may prevent a small number of users from logging in with their existing passwords. ' + . 'If a user is unable to log in, please advise him or her to reset their password, or reset it as an admin user.'); diff --git a/engine/lib/upgrades/2012041801-1.8.3-multiple_user_tokens-852225f7fd89f6c5.php b/engine/lib/upgrades/2012041801-1.8.3-multiple_user_tokens-852225f7fd89f6c5.php new file mode 100644 index 000000000..07732f261 --- /dev/null +++ b/engine/lib/upgrades/2012041801-1.8.3-multiple_user_tokens-852225f7fd89f6c5.php @@ -0,0 +1,13 @@ +<?php +/** + * Elgg 1.8.3 upgrade 2012041801 + * multiple_user_tokens + * + * Fixes http://trac.elgg.org/ticket/4291 + * Removes the unique index on users_apisessions for user_guid and site_guid + */ + +$db_prefix = elgg_get_config('dbprefix'); +$q = "ALTER TABLE {$db_prefix}users_apisessions DROP INDEX user_guid, + ADD INDEX user_guid (user_guid, site_guid)"; +update_data($q);
\ No newline at end of file diff --git a/engine/lib/user_settings.php b/engine/lib/user_settings.php index af30d8f0d..e4069fb53 100644 --- a/engine/lib/user_settings.php +++ b/engine/lib/user_settings.php @@ -33,9 +33,9 @@ function users_settings_save() { * @access private */ function elgg_set_user_password() { - $current_password = get_input('current_password'); - $password = get_input('password'); - $password2 = get_input('password2'); + $current_password = get_input('current_password', null, false); + $password = get_input('password', null, false); + $password2 = get_input('password2', null, false); $user_guid = get_input('guid'); if (!$user_guid) { diff --git a/engine/lib/users.php b/engine/lib/users.php index f1d42e25e..6a881777e 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -969,8 +969,8 @@ $allow_multiple_emails = false, $friend_guid = 0, $invitecode = '') { $friend_user->addFriend($user->guid); // @todo Should this be in addFriend? - add_to_river('friends/river/create', 'friend', $user->getGUID(), $friend_guid); - add_to_river('friends/river/create', 'friend', $friend_guid, $user->getGUID()); + add_to_river('river/relationship/friend/create', 'friend', $user->getGUID(), $friend_guid); + add_to_river('river/relationship/friend/create', 'friend', $friend_guid, $user->getGUID()); } } } diff --git a/engine/tests/regression/trac_bugs.php b/engine/tests/regression/trac_bugs.php index 99cf81774..26a45ab6a 100644 --- a/engine/tests/regression/trac_bugs.php +++ b/engine/tests/regression/trac_bugs.php @@ -199,4 +199,22 @@ class ElggCoreRegressionBugsTest extends ElggCoreUnitTest { $this->assertFalse($result); $this->assertEqual(array(), $DB_DELAYED_QUERIES); } + + /** + * http://trac.elgg.org/ticket/3210 - Don't remove -s in friendly titles + * @todo: http://trac.elgg.org/ticket/2276 - improve char encoding + */ + public function test_friendly_title() { + $cases = array( + 'Simple Test' => 'simple-test', + 'Test top-level page' => 'test-top-level-page', +// 'éclair' => 'éclair', +// 'English, Español, and 日本語' => 'english-español-and-日本語' + ); + + foreach ($cases as $case => $expected) { + $friendly_title = elgg_get_friendly_title($case); + $this->assertIdentical($expected, $friendly_title); + } + } } diff --git a/mod/blog/languages/en.php b/mod/blog/languages/en.php index 42606bf8e..e1930b916 100644 --- a/mod/blog/languages/en.php +++ b/mod/blog/languages/en.php @@ -58,7 +58,16 @@ $english = array( // notifications 'blog:newpost' => 'A new blog post', - 'blog:via' => "published a 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/start.php b/mod/blog/start.php index eb4e11086..73056f1c9 100644 --- a/mod/blog/start.php +++ b/mod/blog/start.php @@ -240,16 +240,15 @@ function blog_notify_message($hook, $type, $message, $params) { $to_entity = $params['to_entity']; $method = $params['method']; if (elgg_instanceof($entity, 'object', 'blog')) { - $descr = $entity->description; + $descr = $entity->excerpt; $title = $entity->title; - if ($method == 'email') { - $owner = $entity->getOwnerEntity(); - return $owner->name . ' ' . elgg_echo('blog:via') . ': ' . $title . "\n\n" . $descr . "\n\n" . $entity->getURL(); - } - if ($method == 'web') { - $owner = $entity->getOwnerEntity(); - return $owner->name . ' ' . elgg_echo('blog:via') . ': ' . $title . "\n\n" . $descr . "\n\n" . $entity->getURL(); - } + $owner = $entity->getOwnerEntity(); + return elgg_echo('blog:notification', array( + $owner->name, + $title, + $descr, + $entity->getURL() + )); } return null; } 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/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/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/start.php b/mod/file/start.php index f8b512318..120129276 100644 --- a/mod/file/start.php +++ b/mod/file/start.php @@ -200,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; } diff --git a/mod/groups/languages/en.php b/mod/groups/languages/en.php index a4a9e2b2b..e51e51a14 100644 --- a/mod/groups/languages/en.php +++ b/mod/groups/languages/en.php @@ -64,6 +64,16 @@ $english = array( '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', 'groups:activity:none' => "There is no group activity yet", diff --git a/mod/groups/start.php b/mod/groups/start.php index 86a1da279..aeab0649a 100644 --- a/mod/groups/start.php +++ b/mod/groups/start.php @@ -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/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/pages/languages/en.php b/mod/pages/languages/en.php index 3620e7e8e..eb9d22708 100644 --- a/mod/pages/languages/en.php +++ b/mod/pages/languages/en.php @@ -28,7 +28,15 @@ $english = array( 'pages:navigation' => "Navigation", 'pages:new' => "A new page", - 'pages:via' => "via pages", + '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/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/search/pages/search/index.php b/mod/search/pages/search/index.php index 91817096b..fcd95c43e 100644 --- a/mod/search/pages/search/index.php +++ b/mod/search/pages/search/index.php @@ -257,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/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/start.php b/mod/thewire/start.php index ebfe29538..5d5786e2f 100644 --- a/mod/thewire/start.php +++ b/mod/thewire/start.php @@ -304,7 +304,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/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/version.php b/version.php index dc6897c18..689306412 100644 --- a/version.php +++ b/version.php @@ -11,7 +11,7 @@ // YYYYMMDD = Elgg Date // XX = Interim incrementer -$version = 2012012100; +$version = 2012041801; // Human-friendly version name $release = '1.8.3'; diff --git a/views/default/admin/plugins.php b/views/default/admin/plugins.php index b793175e0..42f153d0f 100644 --- a/views/default/admin/plugins.php +++ b/views/default/admin/plugins.php @@ -64,13 +64,7 @@ foreach ($installed_plugins as $id => $plugin) { if (isset($plugin_categories)) { foreach ($plugin_categories as $category) { if (!array_key_exists($category, $categories)) { - // if localization string not defined, fall back to original category string - $cat_raw_string = "admin:plugins:category:$category"; - $cat_display_string = elgg_echo($cat_raw_string); - if ($cat_display_string == $cat_raw_string) { - $cat_display_string = ucwords($category); - } - $categories[$category] = $cat_display_string; + $categories[$category] = ElggPluginManifest::getFriendlyCategory($category); } } } diff --git a/views/default/css/admin.php b/views/default/css/admin.php index 6deceb14e..e3205ca4e 100644 --- a/views/default/css/admin.php +++ b/views/default/css/admin.php @@ -109,6 +109,8 @@ pre, code { background-color: #EEE; border: 1px solid #DDD; color: #444; + font-family: Monaco, "Courier New", Courier, monospace; + font-size: 13px; overflow: auto; margin: 15px 0; padding: 5px; @@ -1260,6 +1262,13 @@ a.elgg-widget-collapsed:before { padding: 5px 10px; margin: 4px 0; } +ul.elgg-plugin-categories, ul.elgg-plugin-categories > li { + display: inline; +} +.elgg-plugin-category-bundled { + border-width: 2px; + border-color: #DAA520; +} /**************************************** MARKDOWN diff --git a/views/default/forms/login.php b/views/default/forms/login.php index 6f6cc9906..d2c6e6221 100644 --- a/views/default/forms/login.php +++ b/views/default/forms/login.php @@ -20,7 +20,7 @@ <?php echo elgg_view('input/password', array('name' => 'password')); ?> </div> -<?php echo elgg_view('login/extend'); ?> +<?php echo elgg_view('login/extend', $vars); ?> <div class="elgg-foot"> <label class="mtm float-alt"> diff --git a/views/default/forms/register.php b/views/default/forms/register.php index 411152205..75ecd3450 100644 --- a/views/default/forms/register.php +++ b/views/default/forms/register.php @@ -66,10 +66,10 @@ if (elgg_is_sticky_form('register')) { <?php // view to extend to add more fields to the registration form -echo elgg_view('register/extend'); +echo elgg_view('register/extend', $vars); // Add captcha hook -echo elgg_view('input/captcha'); +echo elgg_view('input/captcha', $vars); echo '<div class="elgg-foot">'; echo elgg_view('input/hidden', array('name' => 'friend_guid', 'value' => $vars['friend_guid'])); diff --git a/views/default/icon/default.php b/views/default/icon/default.php index 22c20b3a7..087c7eae9 100644 --- a/views/default/icon/default.php +++ b/views/default/icon/default.php @@ -34,10 +34,15 @@ if (isset($vars['href'])) { $url = $vars['href']; } +$icon_sizes = elgg_get_config('icon_sizes'); +$size = $vars['size']; + $img = elgg_view('output/img', array( 'src' => $entity->getIconURL($vars['size']), 'alt' => $title, 'class' => $class, + 'width' => $size != 'master' ? $icon_sizes[$size]['w'] : NULL, + 'height' => $size != 'master' ? $icon_sizes[$size]['h'] : NULL, )); if ($url) { diff --git a/views/default/object/plugin.php b/views/default/object/plugin.php index 2f64cfcc9..5c7138e96 100644 --- a/views/default/object/plugin.php +++ b/views/default/object/plugin.php @@ -7,6 +7,10 @@ * */ +if (!elgg_in_context('admin')) { + forward('/', 403); +} + $plugin = $vars['entity']; if (!$plugin->isValid()) { diff --git a/views/default/object/plugin/full.php b/views/default/object/plugin/full.php index 74bd31d1c..db0a52416 100644 --- a/views/default/object/plugin/full.php +++ b/views/default/object/plugin/full.php @@ -17,20 +17,17 @@ $reordering = elgg_extract('display_reordering', $vars, false); $priority = $plugin->getPriority(); $active = $plugin->isActive(); -$name = $plugin->getManifest()->getName(); $can_activate = $plugin->canActivate(); $max_priority = elgg_get_max_plugin_priority(); $actions_base = '/action/admin/plugins/'; $css_id = preg_replace('/[^a-z0-9-]/i', '-', $plugin->getID()); -$ts = time(); -$token = generate_action_token($ts); - // build reordering links $links = ''; +$classes = array('elgg-plugin'); if ($reordering) { - $draggable = 'elgg-state-draggable'; + $classes[] = 'elgg-state-draggable'; // top and up link only if not at top if ($priority > 1) { @@ -90,7 +87,7 @@ if ($reordering) { )) . "</li>"; } } else { - $draggable = 'elgg-state-undraggable'; + $classes[] = 'elgg-state-undraggable'; } @@ -102,22 +99,22 @@ $options = array( 'is_trusted' => true, ); if ($active) { - $active_class = 'elgg-state-active'; + $classes[] = 'elgg-state-active'; $action = 'deactivate'; $options['text'] = elgg_echo('admin:plugins:deactivate'); $options['class'] = "elgg-button elgg-button-cancel"; if (!$can_activate) { - $active_class = 'elgg-state-active'; + $classes[] = 'elgg-state-active'; $options['class'] = 'elgg-button elgg-state-warning'; } } else if ($can_activate) { - $active_class = 'elgg-state-inactive'; + $classes[] = 'elgg-state-inactive'; $action = 'activate'; $options['text'] = elgg_echo('admin:plugins:activate'); $options['class'] = "elgg-button elgg-button-submit"; } else { - $active_class = 'elgg-state-inactive'; + $classes[] = 'elgg-state-inactive'; $action = ''; $options['text'] = elgg_echo('admin:plugins:cannot_activate'); $options['class'] = "elgg-button elgg-button-disabled"; @@ -133,18 +130,20 @@ if ($action) { } $action_button = elgg_view('output/url', $options); -// Display categories +// Display categories and make category classes +$categories = $plugin->getManifest()->getCategories(); $categories_html = ''; if ($categories) { - $categories_arr = array(); $base_url = elgg_get_site_url() . "admin/plugins?category="; foreach ($categories as $category) { + $css_class = preg_replace('/[^a-z0-9-]/i', '-', $category); + $classes[] = "elgg-plugin-category-$css_class"; + $url = $base_url . urlencode($category); - $categories_arr[] = "<a href=\"$url\">" . htmlspecialchars($category) . '</a>'; + $friendly_category = htmlspecialchars(ElggPluginManifest::getFriendlyCategory($category)); + $categories_html .= "<li class=\"elgg-plugin-category prm\"><a href=\"$url\">$friendly_category</a></li>"; } - - $categories_html = implode(', ', $categories_arr); } $screenshots_html = ''; @@ -197,7 +196,7 @@ if ($files) { ?> -<div class="<?php echo $draggable; ?> elgg-plugin <?php echo $active_class ?>" id="<?php echo $css_id; ?>"> +<div class="<?php echo implode(' ', $classes); ?>" id="<?php echo $css_id; ?>"> <div class="elgg-image-block"> <div class="elgg-image-alt"> <?php if ($links) : ?> @@ -219,7 +218,7 @@ if (elgg_view_exists($settings_view_old) || elgg_view_exists($settings_view_new) } ?> <div class="elgg-head"> - <h3><?php echo $plugin->getManifest()->getName(). " $version $settings_link"; ?></h3> + <h3><?php echo $plugin->getManifest()->getName() . " $version $settings_link"; ?></h3> </div> <?php if ($plugin->getManifest()->getApiVersion() < 1.8) { @@ -267,7 +266,7 @@ if (elgg_view_exists($settings_view_old) || elgg_view_exists($settings_view_new) if ($categories_html) { ?> - <div><?php echo elgg_echo('admin:plugins:label:categories') . ": " . $categories_html; ?></div> + <div><?php echo elgg_echo('admin:plugins:label:categories') . ": <ul class=\"elgg-plugin-categories\">$categories_html</ul>"; ?></div> <?php } |