diff options
68 files changed, 317 insertions, 238 deletions
diff --git a/actions/admin/site/update_basic.php b/actions/admin/site/update_basic.php index c809dc671..45f00a20d 100644 --- a/actions/admin/site/update_basic.php +++ b/actions/admin/site/update_basic.php @@ -24,4 +24,5 @@ if (datalist_get('default_site')) { set_config('language', get_input('language'), $site->getGUID()); } +system_message(elgg_echo('admin:configuration:success')); forward(REFERER);
\ No newline at end of file diff --git a/actions/login.php b/actions/login.php index 5934d1423..c717faadd 100644 --- a/actions/login.php +++ b/actions/login.php @@ -28,7 +28,6 @@ if (empty($username) || empty($password)) { } // check if logging in with email address -// @todo Are usernames with @ not allowed? if (strpos($username, '@') !== FALSE && ($users = get_user_by_email($username))) { $username = $users[0]->username; } diff --git a/actions/profile/edit.php b/actions/profile/edit.php index e86053b07..8ca60f246 100644 --- a/actions/profile/edit.php +++ b/actions/profile/edit.php @@ -62,12 +62,7 @@ if ($name) { register_error(elgg_echo('user:name:fail')); } elseif ($owner->name != $name) { $owner->name = $name; - // @todo this is weird...giving two notifications? - if ($owner->save()) { - system_message(elgg_echo('user:name:success')); - } else { - register_error(elgg_echo('user:name:fail')); - } + $owner->save(); } } diff --git a/actions/user/requestnewpassword.php b/actions/user/requestnewpassword.php index 5dfa24952..f1d4fa43c 100644 --- a/actions/user/requestnewpassword.php +++ b/actions/user/requestnewpassword.php @@ -8,6 +8,11 @@ $username = get_input('username'); +// allow email addresses +if (strpos($username, '@') !== false && ($users = get_user_by_email($username))) { + $username = $users[0]->username; +} + $user = get_user_by_username($username); if ($user) { if (send_new_password_request($user->guid)) { diff --git a/actions/useradd.php b/actions/useradd.php index 3df41af79..fdcd7e438 100644 --- a/actions/useradd.php +++ b/actions/useradd.php @@ -37,7 +37,7 @@ try { if ($guid) { $new_user = get_entity($guid); - if ($uew_user && $admin && elgg_is_admin_logged_in()) { + if ($new_user && $admin && elgg_is_admin_logged_in()) { $new_user->makeAdmin(); } diff --git a/engine/classes/ElggEntity.php b/engine/classes/ElggEntity.php index fdf2a80ea..df87082fe 100644 --- a/engine/classes/ElggEntity.php +++ b/engine/classes/ElggEntity.php @@ -1335,6 +1335,9 @@ abstract class ElggEntity extends ElggData implements $this->attributes['tables_loaded']++; } + // guid needs to be an int http://trac.elgg.org/ticket/4111 + $this->attributes['guid'] = (int)$this->attributes['guid']; + // Cache object handle if ($this->attributes['guid']) { cache_entity($this); diff --git a/engine/classes/ElggGroup.php b/engine/classes/ElggGroup.php index 49ba27204..0190e5eac 100644 --- a/engine/classes/ElggGroup.php +++ b/engine/classes/ElggGroup.php @@ -309,7 +309,7 @@ class ElggGroup extends ElggEntity * * @param ElggUser $user User * - * @return void + * @return bool */ public function leave(ElggUser $user) { return leave_group($this->getGUID(), $user->getGUID()); @@ -322,7 +322,7 @@ class ElggGroup extends ElggEntity * * @param int $guid GUID of an ElggGroup entity * - * @return true + * @return bool */ protected function load($guid) { // Test to see if we have the generic stuff @@ -340,7 +340,7 @@ class ElggGroup extends ElggEntity $row = get_group_entity_as_row($guid); if (($row) && (!$this->isFullyLoaded())) { // If $row isn't a cached copy then increment the counter - $this->attributes['tables_loaded'] ++; + $this->attributes['tables_loaded']++; } // Now put these into the attributes array as core values @@ -349,6 +349,9 @@ class ElggGroup extends ElggEntity $this->attributes[$key] = $value; } + // guid needs to be an int http://trac.elgg.org/ticket/4111 + $this->attributes['guid'] = (int)$this->attributes['guid']; + return true; } diff --git a/engine/classes/ElggObject.php b/engine/classes/ElggObject.php index caccfb038..0b8340697 100644 --- a/engine/classes/ElggObject.php +++ b/engine/classes/ElggObject.php @@ -110,7 +110,7 @@ class ElggObject extends ElggEntity { $row = get_object_entity_as_row($guid); if (($row) && (!$this->isFullyLoaded())) { // If $row isn't a cached copy then increment the counter - $this->attributes['tables_loaded'] ++; + $this->attributes['tables_loaded']++; } // Now put these into the attributes array as core values @@ -119,6 +119,9 @@ class ElggObject extends ElggEntity { $this->attributes[$key] = $value; } + // guid needs to be an int http://trac.elgg.org/ticket/4111 + $this->attributes['guid'] = (int)$this->attributes['guid']; + return true; } diff --git a/engine/classes/ElggPluginManifest.php b/engine/classes/ElggPluginManifest.php index eacc16455..7592eb667 100644 --- a/engine/classes/ElggPluginManifest.php +++ b/engine/classes/ElggPluginManifest.php @@ -553,7 +553,7 @@ class ElggPluginManifest { } /** - * Returns the admin interface to use. + * Should this plugin be activated when Elgg is installed * * @return bool */ diff --git a/engine/classes/ElggSite.php b/engine/classes/ElggSite.php index 16b80b9d3..5c44d4076 100644 --- a/engine/classes/ElggSite.php +++ b/engine/classes/ElggSite.php @@ -128,7 +128,7 @@ class ElggSite extends ElggEntity { $row = get_site_entity_as_row($guid); if (($row) && (!$this->isFullyLoaded())) { // If $row isn't a cached copy then increment the counter - $this->attributes['tables_loaded'] ++; + $this->attributes['tables_loaded']++; } // Now put these into the attributes array as core values @@ -137,6 +137,9 @@ class ElggSite extends ElggEntity { $this->attributes[$key] = $value; } + // guid needs to be an int http://trac.elgg.org/ticket/4111 + $this->attributes['guid'] = (int)$this->attributes['guid']; + return true; } diff --git a/engine/classes/ElggUser.php b/engine/classes/ElggUser.php index 75ac008f6..a1c7147a5 100644 --- a/engine/classes/ElggUser.php +++ b/engine/classes/ElggUser.php @@ -114,7 +114,7 @@ class ElggUser extends ElggEntity $row = get_user_entity_as_row($guid); if (($row) && (!$this->isFullyLoaded())) { // If $row isn't a cached copy then increment the counter - $this->attributes['tables_loaded'] ++; + $this->attributes['tables_loaded']++; } // Now put these into the attributes array as core values @@ -123,6 +123,9 @@ class ElggUser extends ElggEntity $this->attributes[$key] = $value; } + // guid needs to be an int http://trac.elgg.org/ticket/4111 + $this->attributes['guid'] = (int)$this->attributes['guid']; + return true; } diff --git a/engine/lib/access.php b/engine/lib/access.php index 97f744fb9..08b9283cd 100644 --- a/engine/lib/access.php +++ b/engine/lib/access.php @@ -610,8 +610,7 @@ function delete_access_collection($collection_id) { WHERE id = {$collection_id}"; $result = delete_data($q); - - return $result; + return (bool)$result; } /** @@ -718,7 +717,7 @@ function remove_user_from_access_collection($user_guid, $collection_id) { WHERE access_collection_id = {$collection_id} AND user_guid = {$user_guid}"; - return delete_data($q); + return (bool)delete_data($q); } /** diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index 08b346960..57d602450 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -107,7 +107,10 @@ function elgg_load_library($name) { } if (!include_once($CONFIG->libraries[$name])) { - $error = elgg_echo('InvalidParameterException:LibraryNotRegistered', array($name)); + $error = elgg_echo('InvalidParameterException:LibraryNotFound', array( + $name, + $CONFIG->libraries[$name]) + ); throw new InvalidParameterException($error); } } diff --git a/engine/lib/entities.php b/engine/lib/entities.php index fd2b0e9f9..f7ae108ed 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -124,8 +124,6 @@ function retrieve_cached_entity_row($guid) { * @internal Subtypes are stored in the entity_subtypes table. There is a foreign * key in the entities table. * - * @todo Move to a nicer place? - * * @param string $type Type * @param string $subtype Subtype * @@ -144,7 +142,7 @@ function get_subtype_id($type, $subtype) { return FALSE; } - // Todo: cache here? Or is looping less efficient that going to the db each time? + // @todo use the cache before hitting database $result = get_data_row("SELECT * from {$CONFIG->dbprefix}entity_subtypes where type='$type' and subtype='$subtype'"); @@ -163,8 +161,6 @@ function get_subtype_id($type, $subtype) { /** * Return string name for a given subtype ID. * - * @todo Move to a nicer place? - * * @param int $subtype_id Subtype ID * * @return string Subtype name @@ -199,11 +195,11 @@ function get_subtype_from_id($subtype_id) { } /** - * Return a classname for a registered type and subtype. + * Return the class name for a registered type and subtype. * * Entities can be registered to always be loaded as a certain class - * with {@link register_entity_subtype()}. This function returns - * the class name if found, and NULL if not. + * with add_subtype() or update_subtype(). This function returns the class + * name if found and NULL if not. * * @param string $type The type * @param string $subtype The subtype @@ -219,7 +215,7 @@ function get_subtype_class($type, $subtype) { $type = sanitise_string($type); $subtype = sanitise_string($subtype); - // Todo: cache here? Or is looping less efficient that going to the db each time? + // @todo use the cache before going to the database $result = get_data_row("SELECT * from {$CONFIG->dbprefix}entity_subtypes where type='$type' and subtype='$subtype'"); @@ -236,7 +232,7 @@ function get_subtype_class($type, $subtype) { } /** - * Returns the classname for a subtype id. + * Returns the class name for a subtype id. * * @param int $subtype_id The subtype id * @@ -279,6 +275,9 @@ function get_subtype_class_from_id($subtype_id) { * it will be loaded as that class automatically when retrieved from the database with * {@link get_entity()}. * + * @warning This function cannot be used to change the class for a type-subtype pair. + * Use update_subtype() for that. + * * @param string $type The type you're subtyping (site, user, object, or group) * @param string $subtype The subtype * @param string $class Optional class name for the object @@ -1563,7 +1562,7 @@ function delete_entity($guid, $recursive = true) { } } - return $res; + return (bool)$res; } } } diff --git a/engine/lib/metastrings.php b/engine/lib/metastrings.php index 9dccec700..9fe9b4bff 100644 --- a/engine/lib/metastrings.php +++ b/engine/lib/metastrings.php @@ -810,7 +810,7 @@ function elgg_delete_metastring_based_object_by_id($id, $type) { } if (($obj->canEdit()) && (elgg_trigger_event('delete', $type, $obj))) { - return delete_data("DELETE from $table where id=$id"); + return (bool)delete_data("DELETE from $table where id=$id"); } } diff --git a/engine/lib/relationships.php b/engine/lib/relationships.php index 3578f0cb8..5b7080b56 100644 --- a/engine/lib/relationships.php +++ b/engine/lib/relationships.php @@ -158,7 +158,7 @@ function remove_entity_relationship($guid_one, $relationship, $guid_two) { and relationship='$relationship' and guid_two=$guid_two"; - return delete_data($query); + return (bool)delete_data($query); } else { return false; } diff --git a/engine/lib/river.php b/engine/lib/river.php index 466eca253..02d52dea1 100644 --- a/engine/lib/river.php +++ b/engine/lib/river.php @@ -447,7 +447,8 @@ function elgg_get_river_type_subtype_where_sql($table, $types, $subtypes, $pairs return ''; } - $wheres = array(); + $types_wheres = array(); + $subtypes_wheres = array(); // if no pairs, use types and subtypes if (!is_array($pairs)) { @@ -457,7 +458,7 @@ function elgg_get_river_type_subtype_where_sql($table, $types, $subtypes, $pairs } foreach ($types as $type) { $type = sanitise_string($type); - $wheres[] = "({$table}.type = '$type')"; + $types_wheres[] = "({$table}.type = '$type')"; } } @@ -467,13 +468,20 @@ function elgg_get_river_type_subtype_where_sql($table, $types, $subtypes, $pairs } foreach ($subtypes as $subtype) { $subtype = sanitise_string($subtype); - $wheres[] = "({$table}.subtype = '$subtype')"; + $subtypes_wheres[] = "({$table}.subtype = '$subtype')"; } } - if (is_array($wheres) && count($wheres)) { - $wheres = array(implode(' OR ', $wheres)); + if (is_array($types_wheres) && count($types_wheres)) { + $types_wheres = array(implode(' OR ', $types_wheres)); } + + if (is_array($subtypes_wheres) && count($subtypes_wheres)) { + $subtypes_wheres = array(implode(' OR ', $subtypes_wheres)); + } + + $wheres = array(implode(' AND ', array_merge($types_wheres, $subtypes_wheres))); + } else { // using type/subtype pairs foreach ($pairs as $paired_type => $paired_subtypes) { @@ -611,6 +619,16 @@ function elgg_river_page_handler($page) { } /** + * Register river unit tests + * @access private + */ +function elgg_river_test($hook, $type, $value) { + global $CONFIG; + $value[] = $CONFIG->path . 'engine/tests/api/river.php'; + return $value; +} + +/** * Initialize river library * @access private */ @@ -620,6 +638,8 @@ function elgg_river_init() { elgg_register_menu_item('site', $item); elgg_register_widget_type('river_widget', elgg_echo('river:widget:title'), elgg_echo('river:widget:description')); + + elgg_register_plugin_hook_handler('unit_test', 'system', 'elgg_river_test'); } elgg_register_event_handler('init', 'system', 'elgg_river_init'); diff --git a/engine/lib/user_settings.php b/engine/lib/user_settings.php index 1e2d6db10..c71670357 100644 --- a/engine/lib/user_settings.php +++ b/engine/lib/user_settings.php @@ -265,8 +265,8 @@ function elgg_set_user_default_access() { * @access private */ function usersettings_pagesetup() { - if (elgg_get_context() == "settings" && elgg_get_logged_in_user_guid()) { - $user = elgg_get_logged_in_user_entity(); + if (elgg_get_context() == "settings") { + $user = elgg_get_page_owner_entity(); $params = array( 'name' => '1_account', diff --git a/engine/lib/users.php b/engine/lib/users.php index 9cb8ddfa7..3a86c1faa 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -565,6 +565,8 @@ function get_user_by_username($username) { $entity = get_data_row($query, 'entity_row_to_elggstar'); if ($entity) { $USERNAME_TO_GUID_MAP_CACHE[$username] = $entity->guid; + } else { + $entity = false; } return $entity; @@ -1281,6 +1283,11 @@ function elgg_user_hover_menu($hook, $type, $return, $params) { $item = new ElggMenuItem('profile:edit', elgg_echo('profile:edit'), $url); $item->setSection('admin'); $return[] = $item; + + $url = "settings/user/$user->username"; + $item = new ElggMenuItem('settings:edit', elgg_echo('settings:edit'), $url); + $item->setSection('admin'); + $return[] = $item; } return $return; diff --git a/engine/lib/views.php b/engine/lib/views.php index 0f806b8be..d3c9ff551 100644 --- a/engine/lib/views.php +++ b/engine/lib/views.php @@ -1602,6 +1602,7 @@ function elgg_views_boot() { elgg_load_js('elgg'); elgg_register_simplecache_view('js/lightbox'); + elgg_register_simplecache_view('css/lightbox'); $lightbox_js_url = elgg_get_simplecache_url('js', 'lightbox'); elgg_register_js('lightbox', $lightbox_js_url); $lightbox_css_url = elgg_get_simplecache_url('css', 'lightbox'); diff --git a/engine/tests/api/access_collections.php b/engine/tests/api/access_collections.php index 0c37fa779..bea995a6e 100644 --- a/engine/tests/api/access_collections.php +++ b/engine/tests/api/access_collections.php @@ -76,7 +76,7 @@ class ElggCoreAccessCollectionsTest extends ElggCoreUnitTest { $q = "SELECT * FROM {$this->dbPrefix}access_collections WHERE id = $acl_id"; $data = get_data($q); - $this->assertFalse($data); + $this->assertIdentical(array(), $data); } } @@ -88,7 +88,7 @@ class ElggCoreAccessCollectionsTest extends ElggCoreUnitTest { if ($result) { $result = remove_user_from_access_collection($this->user->guid, $acl_id); - $this->assertTrue($result); + $this->assertIdentical(true, $result); } delete_access_collection($acl_id); diff --git a/engine/tests/api/entity_getter_functions.php b/engine/tests/api/entity_getter_functions.php index e7906d3c8..9db248de9 100644 --- a/engine/tests/api/entity_getter_functions.php +++ b/engine/tests/api/entity_getter_functions.php @@ -175,9 +175,10 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { } /** + * Get a mix of valid and invalid types * - * @param unknown_type $num - * @return unknown_type + * @param int $num + * @return array */ public function getRandomMixedTypes($num = 2) { $have_valid = $have_invalid = false; @@ -196,8 +197,8 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { * Get random mix of valid and invalid subtypes for types given. * * @param array $types - * @param unknown_type $num - * @return unknown_type + * @param int $num + * @return array */ public function getRandomMixedSubtypes(array $types, $num = 2) { $types_c = count($types); @@ -230,8 +231,8 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { /** * Creates random annotations on $entity * - * @param unknown_type $entity - * @param unknown_type $max + * @param ElggEntity $entity + * @param int $max */ public function createRandomAnnotations($entity, $max = 1) { $annotations = array(); @@ -563,7 +564,9 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { * TYPE_SUBTYPE_PAIRS ***************************/ - + /** + * Valid type, valid subtype pairs + */ public function testElggAPIGettersTSPValidTypeValidSubtype() { $type_num = 1; $subtype_num = 1; @@ -586,6 +589,9 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { } } + /** + * Valid type, multiple valid subtypes + */ public function testElggAPIGettersTSPValidTypeValidPluralSubtype() { $type_num = 1; $subtype_num = 3; @@ -608,6 +614,9 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { } } + /** + * Valid type, both valid and invalid subtypes + */ public function testElggAPIGettersTSPValidTypeMixedPluralSubtype() { $type_num = 1; $valid_subtype_num = 2; @@ -635,9 +644,6 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { } - - - /**************************** * FALSE-RETURNING TESTS **************************** @@ -652,8 +658,8 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { */ - /* - * Test invalid types. + /** + * Test invalid types with singular 'type'. */ public function testElggApiGettersInvalidTypeUsingType() { $type_arr = $this->getRandomInvalids(); @@ -667,7 +673,9 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { $this->assertFalse($es); } - + /** + * Test invalid types with plural 'types'. + */ public function testElggApiGettersInvalidTypeUsingTypesAsString() { $type_arr = $this->getRandomInvalids(); $type = $type_arr[0]; @@ -680,8 +688,11 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { $this->assertFalse($es); } + /** + * Test invalid types with plural 'types' and an array of a single type + */ public function testElggApiGettersInvalidTypeUsingTypesAsArray() { - $type_arr = $this->getRandomInvalids(); + $type_arr = $this->getRandomInvalids(1); $options = array( 'types' => $type_arr @@ -691,6 +702,9 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { $this->assertFalse($es); } + /** + * Test invalid types with plural 'types' and an array of a two types + */ public function testElggApiGettersInvalidTypes() { $type_arr = $this->getRandomInvalids(2); @@ -1053,7 +1067,7 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { $entities = elgg_get_entities_from_metadata($options); - $this->assertFalse($entities); + $this->assertIdentical(array(), $entities); $e->delete(); } @@ -1081,7 +1095,7 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { $entities = elgg_get_entities_from_metadata($options); - $this->assertFalse($entities); + $this->assertIdentical(array(), $entities); $e->delete(); } @@ -1214,7 +1228,7 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { } } - function testElggApiGettersEntityMetadatavalueInvalidSingle() { + function testElggApiGettersEntityMetadataValueInvalidSingle() { $subtypes = $this->getRandomValidSubtypes(array('object'), 1); $subtype = $subtypes[0]; $md_name = 'test_metadata_name_' . rand(); @@ -1235,7 +1249,7 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { $entities = elgg_get_entities_from_metadata($options); - $this->assertFalse($entities); + $this->assertIdentical(array(), $entities); $e->delete(); } @@ -1263,7 +1277,7 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { $entities = elgg_get_entities_from_metadata($options); - $this->assertFalse($entities); + $this->assertIdentical(array(), $entities); $e->delete(); } @@ -1641,6 +1655,9 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { } } + /** + * Name value pair with valid name and invalid value + */ function testElggApiGettersEntityMetadataNVPValidNInvalidV() { $subtypes = $this->getRandomValidSubtypes(array('object'), 1); $subtype = $subtypes[0]; @@ -1676,7 +1693,7 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { $entities = elgg_get_entities_from_metadata($options); - $this->assertFalse($entities); + $this->assertIdentical(array(), $entities); foreach ($guids as $guid) { if ($e = get_entity($guid)) { @@ -1685,7 +1702,9 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { } } - + /** + * Name value pair with invalid name and valid value + */ function testElggApiGettersEntityMetadataNVPInvalidNValidV() { $subtypes = $this->getRandomValidSubtypes(array('object'), 1); $subtype = $subtypes[0]; @@ -1721,7 +1740,7 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { $entities = elgg_get_entities_from_metadata($options); - $this->assertFalse($entities); + $this->assertIdentical(array(), $entities); foreach ($guids as $guid) { if ($e = get_entity($guid)) { @@ -2083,7 +2102,7 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { $es = elgg_get_entities_from_relationship($options); $this->assertTrue(is_array($es)); - $this->assertTrue(count($es), 1); + $this->assertIdentical(count($es), 1); foreach ($es as $e) { $this->assertEqual($guids[1], $e->guid); @@ -2115,7 +2134,7 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { $es = elgg_get_entities_from_relationship($options); $this->assertTrue(is_array($es)); - $this->assertTrue(count($es), 1); + $this->assertIdentical(count($es), 1); foreach ($es as $e) { $this->assertEqual($guids[1], $e->guid); @@ -2151,7 +2170,7 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { $es = elgg_get_entities_from_relationship($options); $this->assertTrue(is_array($es)); - $this->assertTrue(count($es), 1); + $this->assertIdentical(count($es), 1); foreach ($es as $e) { $this->assertEqual($guids[1], $e->guid); @@ -2578,7 +2597,7 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { foreach ($fan_entities as $fan_entity) { $this->assertTrue(in_array($fan_entity->guid, $relationships[$e->guid])); - $this->assertTrue(check_entity_relationship($fan_entity->guid, $relationship_name, $e->guid)); + $this->assertNotIdentical(false, check_entity_relationship($fan_entity->guid, $relationship_name, $e->guid)); } } } diff --git a/engine/tests/api/helpers.php b/engine/tests/api/helpers.php index f48f91faf..77205138d 100644 --- a/engine/tests/api/helpers.php +++ b/engine/tests/api/helpers.php @@ -127,7 +127,7 @@ class ElggCoreHelpersTest extends ElggCoreUnitTest { $this->assertIdentical('http://test1.com', $item->url); // send a bad url - $result = @elgg_register_js('bad'); + $result = elgg_register_js('bad', null); $this->assertFalse($result); } @@ -351,7 +351,7 @@ class ElggCoreHelpersTest extends ElggCoreUnitTest { $test_elements = $pl->getElements(); // make sure it's gone. - $this->assertTrue(2, count($test_elements)); + $this->assertEqual(2, count($test_elements)); $this->assertIdentical($elements[0], $test_elements[0]); $this->assertIdentical($elements[2], $test_elements[2]); } @@ -369,7 +369,7 @@ class ElggCoreHelpersTest extends ElggCoreUnitTest { $pl->add($element, $priority); } - $this->assertTrue($pl->move($elements[-5], 10)); + $this->assertEqual($pl->move($elements[-5], 10), 10); // check it's at the new place $this->assertIdentical($elements[-5], $pl->getElement(10)); diff --git a/engine/tests/api/metadata.php b/engine/tests/api/metadata.php index 7897b8d47..f5b615ca8 100644 --- a/engine/tests/api/metadata.php +++ b/engine/tests/api/metadata.php @@ -58,11 +58,11 @@ class ElggCoreMetadataAPITest extends ElggCoreUnitTest { $this->create_metastring('tested'); // create_metadata returns id of metadata on success - $this->assertTrue(create_metadata($this->object->guid, 'metaUnitTest', 'tested')); + $this->assertNotEqual(false, create_metadata($this->object->guid, 'metaUnitTest', 'tested')); // check value with improper case $options = array('metadata_names' => 'metaUnitTest', 'metadata_values' => 'Tested', 'limit' => 10, 'metadata_case_sensitive' => TRUE); - $this->assertFalse(elgg_get_entities_from_metadata($options)); + $this->assertIdentical(array(), elgg_get_entities_from_metadata($options)); // compare forced case with ignored case $options = array('metadata_names' => 'metaUnitTest', 'metadata_values' => 'tested', 'limit' => 10, 'metadata_case_sensitive' => TRUE); diff --git a/engine/tests/api/metastrings.php b/engine/tests/api/metastrings.php index 9b5d7ee4e..a96388217 100644 --- a/engine/tests/api/metastrings.php +++ b/engine/tests/api/metastrings.php @@ -68,9 +68,6 @@ class ElggCoreMetastringsTest extends ElggCoreUnitTest { parent::__destruct(); } - /** - * A basic test that will be called and fail. - */ public function testDeleteByID() { $db_prefix = elgg_get_config('dbprefix'); $annotations = $this->createAnnotations(1); @@ -83,8 +80,8 @@ class ElggCoreMetastringsTest extends ElggCoreUnitTest { $test = get_data($q); $this->assertEqual($test[0]->id, $id); - $this->assertTrue(elgg_delete_metastring_based_object_by_id($id, $type)); - $this->assertFalse(get_data($q)); + $this->assertIdentical(true, elgg_delete_metastring_based_object_by_id($id, $type)); + $this->assertIdentical(array(), get_data($q)); } } @@ -101,9 +98,6 @@ class ElggCoreMetastringsTest extends ElggCoreUnitTest { } } - /** - * A basic test that will be called and fail. - */ public function testEnableDisableByID() { $db_prefix = elgg_get_config('dbprefix'); $annotations = $this->createAnnotations(1); diff --git a/engine/tests/api/plugins.php b/engine/tests/api/plugins.php index a0faaff0e..8ecb0a46c 100644 --- a/engine/tests/api/plugins.php +++ b/engine/tests/api/plugins.php @@ -93,22 +93,23 @@ class ElggCorePluginsAPITest extends ElggCoreUnitTest { ), 'conflicts' => array( - array('type' => 'plugin', 'name' => 'profile_api', 'version' => 1.0) + array('type' => 'plugin', 'name' => 'profile_api', 'version' => '1.0') ), 'provides' => array( - array('type' => 'plugin', 'name' => 'profile_api', 'version' => 1.3), - array('type' => 'php_extension', 'name' => 'big_math', 'version' => 1.0) + array('type' => 'plugin', 'name' => 'profile_api', 'version' => '1.3'), + array('type' => 'php_extension', 'name' => 'big_math', 'version' => '1.0') ), 'suggests' => array( - array('type' => 'plugin', 'name' => 'facebook_connect', 'version' => 1.0), + array('type' => 'plugin', 'name' => 'facebook_connect', 'version' => '1.0'), ), - 'activate_on_install' => true + // string because we are reading from a file + 'activate_on_install' => 'true', ); - $this->assertEqual($this->manifest18->getManifest(), $manifest_array); + $this->assertIdentical($this->manifest18->getManifest(), $manifest_array); } public function testElggPluginManifest17() { @@ -123,7 +124,7 @@ class ElggCorePluginsAPITest extends ElggCoreUnitTest { 'name' => 'Plugin Test 17', ); - $this->assertEqual($this->manifest17->getManifest(), $manifest_array); + $this->assertIdentical($this->manifest17->getManifest(), $manifest_array); } @@ -180,7 +181,7 @@ class ElggCorePluginsAPITest extends ElggCoreUnitTest { array('type' => 'elgg_version', 'version' => '3009030802', 'comparison' => 'lt'), array('type' => 'elgg_release', 'version' => '1.8-svn', 'comparison' => 'ge'), array('type' => 'php_extension', 'name' => 'gd', 'version' => '', 'comparison' => '='), - array('type' => 'php_ini', 'name' => 'short_open_tag', 'value' => 'off', 'comparison' => '='), + array('type' => 'php_ini', 'name' => 'short_open_tag', 'value' => 0, 'comparison' => '='), array('type' => 'php_extension', 'name' => 'made_up', 'version' => '1.0', 'comparison' => '='), array('type' => 'plugin', 'name' => 'fake_plugin', 'version' => '1.0', 'comparison' => 'ge'), array('type' => 'plugin', 'name' => 'profile', 'version' => '1.0', 'comparison' => 'ge'), @@ -188,13 +189,13 @@ class ElggCorePluginsAPITest extends ElggCoreUnitTest { array('type' => 'priority', 'priority' => 'after', 'plugin' => 'profile'), ); - $this->assertEqual($this->package18->getManifest()->getRequires(), $requires); + $this->assertIdentical($this->package18->getManifest()->getRequires(), $requires); $requires = array( array('type' => 'elgg_version', 'version' => '2009030702', 'comparison' => 'ge') ); - $this->assertEqual($this->package17->getManifest()->getRequires(), $requires); + $this->assertIdentical($this->package17->getManifest()->getRequires(), $requires); } public function testElggPluginManifestGetSuggests() { @@ -202,11 +203,11 @@ class ElggCorePluginsAPITest extends ElggCoreUnitTest { array('type' => 'plugin', 'name' => 'facebook_connect', 'version' => '1.0', 'comparison' => 'ge'), ); - $this->assertEqual($this->package18->getManifest()->getSuggests(), $suggests); + $this->assertIdentical($this->package18->getManifest()->getSuggests(), $suggests); $suggests = array(); - $this->assertEqual($this->package17->getManifest()->getSuggests(), $suggests); + $this->assertIdentical($this->package17->getManifest()->getSuggests(), $suggests); } public function testElggPluginManifestGetDescription() { @@ -219,8 +220,8 @@ class ElggCorePluginsAPITest extends ElggCoreUnitTest { 'Admin', 'ServiceAPI' ); - $this->assertEqual($this->package18->getManifest()->getCategories(), $categories); - $this->assertEqual($this->package17->getManifest()->getCategories(), array()); + $this->assertIdentical($this->package18->getManifest()->getCategories(), $categories); + $this->assertIdentical($this->package17->getManifest()->getCategories(), array()); } public function testElggPluginManifestGetScreenshots() { @@ -229,25 +230,25 @@ class ElggCorePluginsAPITest extends ElggCoreUnitTest { array('description' => 'Fun things to do 2', 'path' => 'graphics/plugin_ss2.png'), ); - $this->assertEqual($this->package18->getManifest()->getScreenshots(), $screenshots); - $this->assertEqual($this->package17->getManifest()->getScreenshots(), array()); + $this->assertIdentical($this->package18->getManifest()->getScreenshots(), $screenshots); + $this->assertIdentical($this->package17->getManifest()->getScreenshots(), array()); } public function testElggPluginManifestGetProvides() { $provides = array( - array('type' => 'plugin', 'name' => 'profile_api', 'version' => 1.3), - array('type' => 'php_extension', 'name' => 'big_math', 'version' => 1.0), - array('type' => 'plugin', 'name' => 'plugin_18', 'version' => 1.0) + array('type' => 'plugin', 'name' => 'profile_api', 'version' => '1.3'), + array('type' => 'php_extension', 'name' => 'big_math', 'version' => '1.0'), + array('type' => 'plugin', 'name' => 'plugin_18', 'version' => '1.0') ); - $this->assertEqual($this->package18->getManifest()->getProvides(), $provides); + $this->assertIdentical($this->package18->getManifest()->getProvides(), $provides); $provides = array( array('type' => 'plugin', 'name' => 'plugin_17', 'version' => '1.0') ); - $this->assertEqual($this->package17->getManifest()->getProvides(), $provides); + $this->assertIdentical($this->package17->getManifest()->getProvides(), $provides); } public function testElggPluginManifestGetConflicts() { @@ -260,12 +261,12 @@ class ElggCorePluginsAPITest extends ElggCoreUnitTest { ) ); - $this->assertEqual($this->manifest18->getConflicts(), $conflicts); - $this->assertEqual($this->manifest17->getConflicts(), array()); + $this->assertIdentical($this->manifest18->getConflicts(), $conflicts); + $this->assertIdentical($this->manifest17->getConflicts(), array()); } public function testElggPluginManifestGetActivateOnInstall() { - $this->assertEqual($this->manifest18->getActivateOnInstall(), true); + $this->assertIdentical($this->manifest18->getActivateOnInstall(), true); } // ElggPluginPackage diff --git a/engine/tests/objects/entities.php b/engine/tests/objects/entities.php index c13b4c731..1772f7c1a 100644 --- a/engine/tests/objects/entities.php +++ b/engine/tests/objects/entities.php @@ -89,21 +89,21 @@ class ElggCoreEntityTest extends ElggCoreUnitTest { $this->assertFalse(isset($this->entity->non_existent)); // create metadata - $this->assertTrue($this->entity->non_existent = 'testing'); + $this->entity->existent = 'testing'; + $this->assertIdentical($this->entity->existent, 'testing'); // check metadata set - $this->assertTrue(isset($this->entity->non_existent)); - $this->assertIdentical($this->entity->non_existent, 'testing'); - $this->assertIdentical($this->entity->getMetaData('non_existent'), 'testing'); + $this->assertTrue(isset($this->entity->existent)); + $this->assertIdentical($this->entity->getMetaData('existent'), 'testing'); // check internal metadata array $metadata = $this->entity->expose_metadata(); - $this->assertIdentical($metadata['non_existent'], 'testing'); + $this->assertIdentical($metadata['existent'], 'testing'); } public function testElggEnityGetAndSetAnnotations() { $this->assertFalse(array_key_exists('non_existent', $this->entity->expose_annotations())); - $this->assertFalse($this->entity->getAnnotations('non_existent')); + $this->assertIdentical($this->entity->getAnnotations('non_existent'), array()); // set and check temp annotation $this->assertTrue($this->entity->annotate('non_existent', 'testing')); @@ -178,7 +178,7 @@ class ElggCoreEntityTest extends ElggCoreUnitTest { $this->AssertEqual($this->entity->get('non_existent'), 'testing'); // clean up with delete - $this->assertTrue($this->entity->delete()); + $this->assertIdentical(true, $this->entity->delete()); } public function testElggEntityDisableAndEnable() { @@ -230,24 +230,26 @@ class ElggCoreEntityTest extends ElggCoreUnitTest { // let's delete a non-existent metadata $this->assertFalse($this->entity->deleteMetadata('important')); - // let's add the meatadata - $this->assertTrue($this->entity->important = 'indeed!'); - $this->assertTrue($this->entity->less_important = 'true, too!'); + // let's add the metadata + $this->entity->important = 'indeed!'; + $this->assertIdentical('indeed!', $this->entity->important); + $this->entity->less_important = 'true, too!'; + $this->assertIdentical('true, too!', $this->entity->less_important); $this->save_entity(); // test deleting incorrectly // @link http://trac.elgg.org/ticket/2273 - $this->assertFalse($this->entity->deleteMetadata('impotent')); + $this->assertNull($this->entity->deleteMetadata('impotent')); $this->assertEqual($this->entity->important, 'indeed!'); // get rid of one metadata $this->assertEqual($this->entity->important, 'indeed!'); $this->assertTrue($this->entity->deleteMetadata('important')); - $this->assertEqual($this->entity->important, ''); + $this->assertNull($this->entity->important); // get rid of all metadata $this->assertTrue($this->entity->deleteMetadata()); - $this->assertEqual($this->entity->less_important, ''); + $this->assertNull($this->entity->less_important); // clean up database $this->assertTrue($this->entity->delete()); diff --git a/engine/tests/objects/sites.php b/engine/tests/objects/sites.php index e5acbb3f9..a01a661e3 100644 --- a/engine/tests/objects/sites.php +++ b/engine/tests/objects/sites.php @@ -36,9 +36,6 @@ class ElggCoreSiteTest extends ElggCoreUnitTest { parent::__destruct(); } - /** - * A basic test that will be called and fail. - */ public function testElggSiteConstructor() { $attributes = array(); $attributes['guid'] = NULL; @@ -66,8 +63,10 @@ class ElggCoreSiteTest extends ElggCoreUnitTest { } public function testElggSiteSaveAndDelete() { - $this->assertTrue($this->site->save()); - $this->assertTrue($this->site->delete()); + $guid = $this->site->save(); + $this->assertIsA($guid, 'int'); + $this->assertTrue($guid > 0); + $this->assertIdentical(true, $this->site->delete()); } } diff --git a/engine/tests/objects/users.php b/engine/tests/objects/users.php index d1533c3d2..a3573acb6 100644 --- a/engine/tests/objects/users.php +++ b/engine/tests/objects/users.php @@ -41,9 +41,6 @@ class ElggCoreUserTest extends ElggCoreUnitTest { parent::__destruct(); } - /** - * A basic test that will be called and fail. - */ public function testElggUserConstructor() { $attributes = array(); $attributes['guid'] = NULL; @@ -138,7 +135,7 @@ class ElggCoreUserTest extends ElggCoreUnitTest { $guid = $this->user->save(); // delete object - $this->assertTrue($this->user->delete()); + $this->assertIdentical(true, $this->user->delete()); // check GUID not in database $this->assertFalse($this->fetchUser($guid)); diff --git a/engine/tests/test_files/plugin_18/manifest.xml b/engine/tests/test_files/plugin_18/manifest.xml index e0776ffc1..9654b6422 100644 --- a/engine/tests/test_files/plugin_18/manifest.xml +++ b/engine/tests/test_files/plugin_18/manifest.xml @@ -34,8 +34,6 @@ <category>ServiceAPI</category> - <activate_on_install>true</activate_on_install> - <requires> <type>php_extension</type> <name>gd</name> @@ -102,4 +100,6 @@ <version>1.0</version> </suggests> + <activate_on_install>true</activate_on_install> + </plugin_manifest> diff --git a/engine/tests/test_skeleton.php b/engine/tests/test_skeleton.php index e5ff557e5..5a5de89bb 100644 --- a/engine/tests/test_skeleton.php +++ b/engine/tests/test_skeleton.php @@ -49,9 +49,6 @@ class ElggCoreSkeletonTest extends ElggCoreUnitTest { parent::__destruct(); } - /** - * A basic test that will be called and fail. - */ public function testFailure() { $this->assertTrue(FALSE); } diff --git a/install/languages/en.php b/install/languages/en.php index 3e2569669..bbcd72d20 100644 --- a/install/languages/en.php +++ b/install/languages/en.php @@ -64,7 +64,7 @@ If you are ready to proceed, click the Next button.", 'install:database:label:dbhost' => 'Database Host', 'install:database:label:dbprefix' => 'Database Table Prefix', - 'install:database:help:dbuser' => 'User that has full priviledges to the MySQL database that you created for Elgg', + 'install:database:help:dbuser' => 'User that has full privileges to the MySQL database that you created for Elgg', 'install:database:help:dbpassword' => 'Password for the above database user account', 'install:database:help:dbname' => 'Name of the Elgg database', 'install:database:help:dbhost' => 'Hostname of the MySQL server (usually localhost)', diff --git a/js/lib/pageowner.js b/js/lib/pageowner.js index 825898416..c695c41c3 100644 --- a/js/lib/pageowner.js +++ b/js/lib/pageowner.js @@ -6,9 +6,13 @@ */ /** - * @return {number} The GUID of the logged in user + * @return {number} The GUID of the page owner entity or 0 for no owner */ elgg.get_page_owner_guid = function() { - return elgg.page_owner.guid || 0; + if (elgg.page_owner !== undefined) { + return elgg.page_owner.guid; + } else { + return 0; + } }; diff --git a/languages/en.php b/languages/en.php index 62effb334..036ca8883 100644 --- a/languages/en.php +++ b/languages/en.php @@ -20,7 +20,7 @@ $english = array( 'login' => "Log in", 'loginok' => "You have been logged in.", 'loginerror' => "We couldn't log you in. Please check your credentials and try again.", - 'login:empty' => "Username and password are required.", + 'login:empty' => "Username/email and password are required.", 'login:baduser' => "Unable to load your user account.", 'auth:nopams' => "Internal error. No user authentication method installed.", @@ -167,6 +167,7 @@ $english = array( 'InvalidParameterException:DoesNotBelongOrRefer' => "Does not belong to entity or refer to entity.", 'InvalidParameterException:MissingParameter' => "Missing parameter, you need to provide a GUID.", 'InvalidParameterException:LibraryNotRegistered' => '%s is not a registered library', + 'InvalidParameterException:LibraryNotFound' => 'Could not load the %s library from %s', 'APIException:ApiResultUnknown' => "API Result is of an unknown type, this should never happen.", 'ConfigurationException:NoSiteID' => "No site ID has been specified.", @@ -222,8 +223,8 @@ $english = array( 'RegistrationException:EmptyPassword' => 'The password fields cannot be empty', 'RegistrationException:PasswordMismatch' => 'Passwords must match', 'LoginException:BannedUser' => 'You have been banned from this site and cannot log in', - 'LoginException:UsernameFailure' => 'We could not log you in. Please check your username and password.', - 'LoginException:PasswordFailure' => 'We could not log you in. Please check your username and password.', + 'LoginException:UsernameFailure' => 'We could not log you in. Please check your username/email and password.', + 'LoginException:PasswordFailure' => 'We could not log you in. Please check your username/email and password.', 'LoginException:AccountLocked' => 'Your account has been locked for too many log in failures.', 'LoginException:ChangePasswordFailure' => 'Failed current password check.', @@ -481,6 +482,7 @@ $english = array( 'account' => "Account", 'settings' => "Settings", 'tools' => "Tools", + 'settings:edit' => 'Edit settings', 'register' => "Register", 'registerok' => "You have successfully registered for %s.", @@ -530,7 +532,7 @@ $english = array( 'user:password:resetreq:success' => 'Successfully requested a new password, email sent', 'user:password:resetreq:fail' => 'Could not request a new password.', - 'user:password:text' => 'To request a new password, enter your username below and click the Request button.', + 'user:password:text' => 'To request a new password, enter your username or email address below and click the Request button.', 'user:persistent' => 'Remember me', @@ -1038,7 +1040,7 @@ Once you have logged in, we highly recommend that you change your password. 'email:settings' => "Email settings", 'email:address:label' => "Your email address", - 'email:save:success' => "New email address saved, verification requested.", + 'email:save:success' => "New email address saved. Verification is requested.", 'email:save:fail' => "Your new email address could not be saved.", 'friend:newfriend:subject' => "%s has made you a friend!", @@ -1063,7 +1065,7 @@ Your password has been reset to: %s", Somebody (from the IP address %s) has requested a new password for their account. -If you requested this click on the link below, otherwise ignore this email. +If you requested this, click on the link below. Otherwise ignore this email. %s ", diff --git a/mod/externalpages/start.php b/mod/externalpages/start.php index 13235af53..152a8b4d9 100644 --- a/mod/externalpages/start.php +++ b/mod/externalpages/start.php @@ -43,8 +43,11 @@ function expages_setup_footer_menu() { $pages = array('about', 'terms', 'privacy'); foreach ($pages as $page) { $url = "$page"; - $item = new ElggMenuItem($page, elgg_echo("expages:$page"), $url); - elgg_register_menu_item('walled_garden', $item); + $wg_item = new ElggMenuItem($page, elgg_echo("expages:$page"), $url); + elgg_register_menu_item('walled_garden', $wg_item); + + $footer_item = clone $wg_item; + elgg_register_menu_item('footer', $footer_item); } } diff --git a/mod/groups/start.php b/mod/groups/start.php index 7dcf6b7c4..09362cbbc 100644 --- a/mod/groups/start.php +++ b/mod/groups/start.php @@ -830,7 +830,7 @@ function discussion_add_to_river_menu($hook, $type, $return, $params) { if (elgg_instanceof($object, 'object', 'groupforumtopic')) { if ($item->annotation_id == 0) { $group = $object->getContainerEntity(); - if ($group->canWriteToContainer() || elgg_is_admin_logged_in()) { + if ($group && ($group->canWriteToContainer() || elgg_is_admin_logged_in())) { $options = array( 'name' => 'reply', 'href' => "#groups-reply-$object->guid", diff --git a/mod/groups/views/default/groups/membershiprequests.php b/mod/groups/views/default/groups/membershiprequests.php index 9cd28262f..2bac0e32b 100644 --- a/mod/groups/views/default/groups/membershiprequests.php +++ b/mod/groups/views/default/groups/membershiprequests.php @@ -7,7 +7,6 @@ */ if (!empty($vars['requests']) && is_array($vars['requests'])) { - $user = elgg_get_logged_in_user_entity(); echo '<ul class="elgg-list">'; foreach ($vars['requests'] as $user) { $icon = elgg_view_entity_icon($user, 'tiny', array('use_hover' => 'true')); @@ -44,5 +43,5 @@ if (!empty($vars['requests']) && is_array($vars['requests'])) { } echo '</ul>'; } else { - echo '<p class="mtm">' . elgg_echo('groups:requests:none') . "</p>"; + echo '<p class="mtm">' . elgg_echo('groups:requests:none') . '</p>'; } diff --git a/mod/likes/start.php b/mod/likes/start.php index 690d7c052..0f8e12159 100644 --- a/mod/likes/start.php +++ b/mod/likes/start.php @@ -65,6 +65,11 @@ function likes_river_menu_setup($hook, $type, $return, $params) { if ($item->type == "group" && $item->view != "river/group/create") { return $return; } + + // don't like users #4116 + if ($item->type == "user") { + return $return; + } $object = $item->getObjectEntity(); if (!elgg_in_context('widgets') && $item->annotation_id == 0) { diff --git a/mod/logbrowser/start.php b/mod/logbrowser/start.php index 3bffe800a..22659877b 100644 --- a/mod/logbrowser/start.php +++ b/mod/logbrowser/start.php @@ -23,7 +23,7 @@ function logbrowser_init() { function logbrowser_user_hover_menu($hook, $type, $return, $params) { $user = $params['entity']; - $url = "admin/utilities/logbrowser?user_guid={$user->guid}"; + $url = "admin/administer_utilities/logbrowser?user_guid={$user->guid}"; $item = new ElggMenuItem('logbrowser', elgg_echo('logbrowser:explore'), $url); $item->setSection('admin'); $return[] = $item; diff --git a/mod/logbrowser/views/default/admin/administer_utilities/logbrowser.php b/mod/logbrowser/views/default/admin/administer_utilities/logbrowser.php index 2be1f33dc..a04ef686a 100644 --- a/mod/logbrowser/views/default/admin/administer_utilities/logbrowser.php +++ b/mod/logbrowser/views/default/admin/administer_utilities/logbrowser.php @@ -13,14 +13,14 @@ $offset = get_input('offset'); $search_username = get_input('search_username'); if ($search_username) { if ($user = get_user_by_username($search_username)) { - $user = $user->guid; + $user_guid = $user->guid; } } else { $user_guid = get_input('user_guid',0); if ($user_guid) { - $user = (int) $user_guid; + $user_guid = (int) $user_guid; } else { - $user = ""; + $user_guid = null; } } @@ -35,14 +35,14 @@ if ($timeupper) { } $refine = elgg_view('logbrowser/refine', array( - 'user_guid' => $user, + 'user_guid' => $user_guid, 'timeupper' => $timeupper, 'timelower' => $timelower, )); // Get log entries -$log = get_system_log($user, "", "", "","", $limit, $offset, false, $timeupper, $timelower); -$count = get_system_log($user, "", "", "","", $limit, $offset, true, $timeupper, $timelower); +$log = get_system_log($user_guid, "", "", "","", $limit, $offset, false, $timeupper, $timelower); +$count = get_system_log($user_guid, "", "", "","", $limit, $offset, true, $timeupper, $timelower); $table = elgg_view('logbrowser/table', array('log_entries' => $log)); diff --git a/mod/logbrowser/views/default/logbrowser/refine.php b/mod/logbrowser/views/default/logbrowser/refine.php index 27cb6042f..86460c79e 100644 --- a/mod/logbrowser/views/default/logbrowser/refine.php +++ b/mod/logbrowser/views/default/logbrowser/refine.php @@ -18,13 +18,18 @@ $toggle_link = elgg_view('output/url', array( 'rel' => 'toggle', )); +$form_class = 'elgg-module elgg-module-inline'; +if (!isset($vars['user_guid'])) { + $form_class .= ' hidden'; +} + ?> <div id="logbrowser-search-area" class="mbm"> <div> <?php echo $toggle_link; ?> </div> - <div id="log-browser-search-form" class="elgg-module elgg-module-inline hidden"> + <div id="log-browser-search-form" class="<?php echo $form_class; ?>"> <div class="elgg-head"> <h3><?php echo elgg_echo('logbrowser:search'); ?></h3> </div> diff --git a/mod/messages/views/default/forms/messages/process.php b/mod/messages/views/default/forms/messages/process.php index 7e182b8f0..f86c3217a 100644 --- a/mod/messages/views/default/forms/messages/process.php +++ b/mod/messages/views/default/forms/messages/process.php @@ -10,7 +10,8 @@ $messages = $vars['list']; if (!$messages) { - $messages = elgg_echo('messages:nomessages'); + echo elgg_echo('messages:nomessages'); + return true; } echo '<div class="messages-container">'; diff --git a/mod/profile/views/default/profile/owner_block.php b/mod/profile/views/default/profile/owner_block.php index 35199726a..63cb5391a 100644 --- a/mod/profile/views/default/profile/owner_block.php +++ b/mod/profile/views/default/profile/owner_block.php @@ -11,7 +11,10 @@ if (!$user) { return TRUE; } -$icon = elgg_view_entity_icon($user, 'large', array('use_hover' => 'true')); +$icon = elgg_view_entity_icon($user, 'large', array( + 'use_hover' => false, + 'use_link' => false, +)); // grab the actions and admin menu items from user hover $menu = elgg_trigger_plugin_hook('register', "menu:user_hover", array('entity' => $user), array()); diff --git a/mod/search/pages/search/index.php b/mod/search/pages/search/index.php index c4e8d2219..efa3ec037 100644 --- a/mod/search/pages/search/index.php +++ b/mod/search/pages/search/index.php @@ -19,7 +19,12 @@ $query = stripslashes(get_input('q', get_input('tag', ''))); // @todo - create function for sanitization of strings for display in 1.8 // encode <,>,&, quotes and characters above 127 -$display_query = mb_convert_encoding($query, 'HTML-ENTITIES', 'UTF-8'); +if (function_exists('mb_convert_encoding')) { + $display_query = mb_convert_encoding($query, 'HTML-ENTITIES', 'UTF-8'); +} else { + // if no mbstring extension, we just strip characters + $display_query = preg_replace("/[^\x01-\x7F]/", "", $query); +} $display_query = htmlspecialchars($display_query, ENT_QUOTES, 'UTF-8', false); // check that we have an actual query diff --git a/mod/search/views/default/search/search_box.php b/mod/search/views/default/search/search_box.php index 9440dd1de..87d59519c 100644 --- a/mod/search/views/default/search/search_box.php +++ b/mod/search/views/default/search/search_box.php @@ -24,7 +24,12 @@ $value = stripslashes($value); // @todo - create function for sanitization of strings for display in 1.8 // encode <,>,&, quotes and characters above 127 -$display_query = mb_convert_encoding($value, 'HTML-ENTITIES', 'UTF-8'); +if (function_exists('mb_convert_encoding')) { + $display_query = mb_convert_encoding($value, 'HTML-ENTITIES', 'UTF-8'); +} else { + // if no mbstring extension, we just strip characters + $display_query = preg_replace("/[^\x01-\x7F]/", "", $value); +} $display_query = htmlspecialchars($display_query, ENT_QUOTES, 'UTF-8', false); diff --git a/mod/thewire/pages/thewire/everyone.php b/mod/thewire/pages/thewire/everyone.php index 4e88d17af..909f0caf2 100644 --- a/mod/thewire/pages/thewire/everyone.php +++ b/mod/thewire/pages/thewire/everyone.php @@ -8,13 +8,14 @@ elgg_push_breadcrumb(elgg_echo('thewire')); $title = elgg_echo('thewire:everyone'); +$content = ''; if (elgg_is_logged_in()) { $form_vars = array('class' => 'thewire-form'); $content .= elgg_view_form('thewire/add', $form_vars); $content .= elgg_view('input/urlshortener'); } -$content = elgg_list_entities(array( +$content .= elgg_list_entities(array( 'type' => 'object', 'subtype' => 'thewire', 'limit' => 15, diff --git a/mod/thewire/pages/thewire/friends.php b/mod/thewire/pages/thewire/friends.php index 26ad03da6..e7f5eed59 100644 --- a/mod/thewire/pages/thewire/friends.php +++ b/mod/thewire/pages/thewire/friends.php @@ -14,7 +14,7 @@ elgg_push_breadcrumb(elgg_echo('thewire'), "thewire/all"); elgg_push_breadcrumb($owner->name, "thewire/owner/$owner->username"); elgg_push_breadcrumb(elgg_echo('friends')); -if (get_loggedin_userid() == $owner->guid) { +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'); diff --git a/mod/thewire/pages/thewire/owner.php b/mod/thewire/pages/thewire/owner.php index a95786b0a..f544aa655 100644 --- a/mod/thewire/pages/thewire/owner.php +++ b/mod/thewire/pages/thewire/owner.php @@ -14,7 +14,7 @@ $title = elgg_echo('thewire:user', array($owner->name)); elgg_push_breadcrumb(elgg_echo('thewire'), "thewire/all"); elgg_push_breadcrumb($owner->name); -if (get_loggedin_userid() == $owner->guid) { +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'); diff --git a/mod/thewire/start.php b/mod/thewire/start.php index c0890344f..328e5d46c 100644 --- a/mod/thewire/start.php +++ b/mod/thewire/start.php @@ -217,7 +217,7 @@ function thewire_filter($text) { // usernames $text = preg_replace( - '/(^|[^\w])@([\w]+)/', + '/(^|[^\w])@([\w.]+)/', '$1<a href="' . $CONFIG->wwwroot . 'thewire/owner/$2">@$2</a>', $text); diff --git a/pages/river.php b/pages/river.php index 5770084ab..601faf16f 100644 --- a/pages/river.php +++ b/pages/river.php @@ -7,7 +7,6 @@ $options = array(); $page_type = preg_replace('[\W]', '', get_input('page_type', 'all')); $type = preg_replace('[\W]', '', get_input('type', 'all')); -$active_section = $subtype = preg_replace('[\W]', '', get_input('subtype', '')); if ($subtype) { $selector = "type=$type&subtype=$subtype"; diff --git a/views/default/admin/plugins.php b/views/default/admin/plugins.php index c3e7e3ab0..b793175e0 100644 --- a/views/default/admin/plugins.php +++ b/views/default/admin/plugins.php @@ -8,6 +8,9 @@ * @subpackage Admin.Plugins */ +elgg_load_js('lightbox'); +elgg_load_css('lightbox'); + elgg_generate_plugin_entities(); $installed_plugins = elgg_get_plugins('any'); $show_category = get_input('category', 'all'); diff --git a/views/default/core/settings/account/name.php b/views/default/core/settings/account/name.php index 69ffcecaf..f719a84de 100644 --- a/views/default/core/settings/account/name.php +++ b/views/default/core/settings/account/name.php @@ -4,12 +4,23 @@ * * @package Elgg * @subpackage Core - - */ $user = elgg_get_page_owner_entity(); - -// all hidden, but necessary for properly updating user details -echo elgg_view('input/hidden', array('name' => 'name', 'value' => $user->name)); +?> +<div class="elgg-module elgg-module-info"> + <div class="elgg-head"> + <h3><?php echo elgg_echo('user:name:label'); ?></h3> + </div> + <div class="elgg-body"> + <p> + <?php echo elgg_echo('name'); ?>: + <?php + echo elgg_view('input/text', array('name' => 'name', 'value' => $user->name)); + ?> + </p> + </div> +</div> +<?php +// need the user's guid to make sure the correct user gets updated echo elgg_view('input/hidden', array('name' => 'guid', 'value' => $user->guid)); diff --git a/views/default/css/admin.php b/views/default/css/admin.php index c02d43512..dc1b503cb 100644 --- a/views/default/css/admin.php +++ b/views/default/css/admin.php @@ -138,6 +138,7 @@ p { visibility: hidden; height: 0 !important; line-height: 0; + overflow: hidden; font-size: xx-large; content: " x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x "; } diff --git a/views/default/css/elements/components.php b/views/default/css/elements/components.php index f675ab7cb..77313fa1a 100644 --- a/views/default/css/elements/components.php +++ b/views/default/css/elements/components.php @@ -7,17 +7,6 @@ * @package Elgg.Core * @subpackage UI */ -/** - * elgg-body fills the space available to it. - * It uses hidden text to expand itself. The combination of auto width, overflow - * hidden, and the hidden text creates this effect. - * - * This allows us to float fixed width divs to either side of an .elgg-body div - * without having to specify the body div's width. - * - * @todo check what happens with long <pre> tags or large images - * @todo Move this to its own file -- it is very complicated and should not have to be overridden. - */ ?> /* *************************************** diff --git a/views/default/css/elements/core.php b/views/default/css/elements/core.php index ace6048bb..74f21ee59 100644 --- a/views/default/css/elements/core.php +++ b/views/default/css/elements/core.php @@ -46,13 +46,28 @@ *overflow:visible; } -<?php //@todo isn't this only needed if we use display:table-cell? ?> +<?php +/** + * elgg-body fills the space available to it. + * It uses hidden text to expand itself. The combination of auto width, overflow + * hidden, and the hidden text creates this effect. + * + * This allows us to float fixed width divs to either side of an .elgg-body div + * without having to specify the body div's width. + * + * @todo check what happens with long <pre> tags or large images + * @todo Move this to its own file -- it is very complicated and should not have to be overridden. + */ + +//@todo isn't this only needed if we use display:table-cell? +?> .elgg-body:after, .elgg-col-last:after { display: block; visibility: hidden; height: 0 !important; line-height: 0; + overflow: hidden; /* Stretch to fill up available space */ font-size: xx-large; diff --git a/views/default/css/elements/forms.php b/views/default/css/elements/forms.php index e358c86e7..81db81747 100644 --- a/views/default/css/elements/forms.php +++ b/views/default/css/elements/forms.php @@ -41,7 +41,7 @@ input, textarea { box-sizing: border-box; } -input:focus, textarea:focus { +input[type=text]:focus, textarea:focus { border: solid 1px #4690d6; background: #e4ecf5; color:#333; diff --git a/views/default/css/elements/navigation.php b/views/default/css/elements/navigation.php index bf1046dda..d5b20896a 100644 --- a/views/default/css/elements/navigation.php +++ b/views/default/css/elements/navigation.php @@ -130,9 +130,9 @@ } .elgg-menu-topbar > li > a { - padding: 2px 15px 0; + padding-top: 2px; color: #eee; - margin-top: 1px; + margin: 1px 15px 0; } .elgg-menu-topbar > li > a:hover { @@ -372,7 +372,10 @@ position: absolute; z-index: 10000; - width: 165px; + overflow: hidden; + + min-width: 165px; + max-width: 250px; border: solid 1px; border-color: #E5E5E5 #999 #999 #E5E5E5; background-color: #FFF; diff --git a/views/default/css/elements/typography.php b/views/default/css/elements/typography.php index f080a29b2..d93b28d2c 100644 --- a/views/default/css/elements/typography.php +++ b/views/default/css/elements/typography.php @@ -139,7 +139,7 @@ h6 { font-size: 0.8em; } .elgg-output dt { font-weight: bold } .elgg-output dd { margin: 0 0 1em 1em } -.elgg-output ul, ol { +.elgg-output ul, .elgg-output ol { margin: 0 1.5em 1.5em 0; padding-left: 1.5em; } diff --git a/views/default/forms/admin/site/update_advanced.php b/views/default/forms/admin/site/update_advanced.php index e12764092..5155fc415 100644 --- a/views/default/forms/admin/site/update_advanced.php +++ b/views/default/forms/admin/site/update_advanced.php @@ -91,7 +91,7 @@ $form_body .= "</div>"; $form_body .= elgg_view('input/hidden', array('name' => 'settings', 'value' => 'go')); -$form_body .= '<div class="elgg-divide-top">'; +$form_body .= '<div class="elgg-foot">'; $form_body .= elgg_view('input/submit', array('value' => elgg_echo("save"))); $form_body .= '</div>'; diff --git a/views/default/forms/admin/site/update_basic.php b/views/default/forms/admin/site/update_basic.php index 66722aef2..88870bc60 100644 --- a/views/default/forms/admin/site/update_basic.php +++ b/views/default/forms/admin/site/update_basic.php @@ -24,7 +24,7 @@ $form_body .= elgg_view("input/dropdown", array( 'options_values' => $languages, )) . "</div>"; -$form_body .= '<div class="elgg-divide-top">'; +$form_body .= '<div class="elgg-foot">'; $form_body .= elgg_view('input/submit', array('value' => elgg_echo("save"))); $form_body .= '</div>'; diff --git a/views/default/forms/user/requestnewpassword.php b/views/default/forms/user/requestnewpassword.php index 8a5a18734..c90971eaf 100644 --- a/views/default/forms/user/requestnewpassword.php +++ b/views/default/forms/user/requestnewpassword.php @@ -11,7 +11,7 @@ <?php echo elgg_echo('user:password:text'); ?> </div> <div> - <label><?php echo elgg_echo('username'); ?></label><br /> + <label><?php echo elgg_echo('loginusername'); ?></label><br /> <?php echo elgg_view('input/text', array( 'name' => 'username', 'class' => 'elgg-autofocus', diff --git a/views/default/js/admin.php b/views/default/js/admin.php index d4dd06822..5cefba512 100644 --- a/views/default/js/admin.php +++ b/views/default/js/admin.php @@ -17,9 +17,6 @@ elgg.admin.init = function () { $(this).stop().slideUp('medium'); }); - // plugin screenshot modal - $('.elgg-plugin-screenshot a').click(elgg.admin.displayPluginScreenshot); - // draggable plugin reordering $('#elgg-plugin-list > ul').sortable({ items: 'li:has(> .elgg-state-draggable)', @@ -74,48 +71,6 @@ elgg.admin.movePlugin = function(e, ui) { }; /** - * Display a plugin screenshot. - * - * @param {Object} e The event object. - * @return void - */ -elgg.admin.displayPluginScreenshot = function(e) { - e.preventDefault(); - var lb = $('.elgg-plugin-screenshot-lightbox'); - - if (lb.length < 1) { - $('body').append('<div class="elgg-plugin-screenshot-lightbox"></div>'); - lb = $('.elgg-plugin-screenshot-lightbox'); - - lb.click(function() { - lb.hide(); - }); - - $(document).click(function(e) { - var target = $(e.target); - if (target.is('a') && target.hasClass('elgg-plugin-screenshot-lightbox')) { - lb.hide(); - e.preventDefault(); - } - }); - } - - var html = '<img class="pas" src="' + $(this).attr('href') + '">'; - var desc = $(this).find('img').attr('alt'); - - if (desc) { - html = '<h2 class="pam">' + desc + '</h2>' + html; - } - - lb.html(html); - - top_pos = $(window).scrollTop() + 10 + 'px'; - left_pos = $(window).scrollLeft() + 5 + 'px'; - - lb.css('top', top_pos).css('left', left_pos).show(); -}; - -/** * In-line editing for custom profile fields * * @param string value The new value diff --git a/views/default/js/lightbox.php b/views/default/js/lightbox.php index 5f3764756..c45d46098 100644 --- a/views/default/js/lightbox.php +++ b/views/default/js/lightbox.php @@ -5,6 +5,10 @@ * Usage * Apply the class elgg-lightbox to links. * + * Advanced Usage + * Elgg is distributed with the Fancybox jQuery library. Please go to + * http://fancybox.net for more information on the options of this lightbox. + * * Overriding * In a plugin, override this view and override the registration for the * lightbox JavaScript and CSS (@see elgg_views_boot()). diff --git a/views/default/navigation/menu/site.php b/views/default/navigation/menu/site.php index 38b42bda9..24c21dd57 100644 --- a/views/default/navigation/menu/site.php +++ b/views/default/navigation/menu/site.php @@ -6,12 +6,15 @@ * @uses $vars['menu']['more'] */ +$default_items = elgg_extract('default', $vars['menu'], array()); +$more_items = elgg_extract('more', $vars['menu'], array()); + echo '<ul class="elgg-menu elgg-menu-site elgg-menu-site-default clearfix">'; -foreach ($vars['menu']['default'] as $menu_item) { +foreach ($default_items as $menu_item) { echo elgg_view('navigation/menu/elements/item', array('item' => $menu_item)); } -if (isset($vars['menu']['more']) && !empty($vars['menu']['more'])) { +if ($more_items) { echo '<li class="elgg-more">'; $more = elgg_echo('more'); @@ -19,7 +22,7 @@ if (isset($vars['menu']['more']) && !empty($vars['menu']['more'])) { echo elgg_view('navigation/menu/elements/section', array( 'class' => 'elgg-menu elgg-menu-site elgg-menu-site-more', - 'items' => $vars['menu']['more'], + 'items' => $more_items, )); echo '</li>'; diff --git a/views/default/object/elements/summary.php b/views/default/object/elements/summary.php index 8d82bc52a..22db03f51 100644 --- a/views/default/object/elements/summary.php +++ b/views/default/object/elements/summary.php @@ -46,7 +46,9 @@ if ($tags !== false) { if ($metadata) { echo $metadata; } -echo "<h3>$title_link</h3>"; +if ($title_link) { + echo "<h3>$title_link</h3>"; +} echo "<div class=\"elgg-subtext\">$subtitle</div>"; echo $tags; diff --git a/views/default/object/plugin/full.php b/views/default/object/plugin/full.php index db4e4dbcc..8955178a6 100644 --- a/views/default/object/plugin/full.php +++ b/views/default/object/plugin/full.php @@ -156,7 +156,7 @@ if ($screenshots) { $screenshot_full = "{$vars['url']}admin_plugin_screenshot/{$plugin->getID()}/full/{$screenshot['path']}"; $screenshot_src = "{$vars['url']}admin_plugin_screenshot/{$plugin->getID()}/thumbnail/{$screenshot['path']}"; - $screenshots_html .= "<li class=\"elgg-plugin-screenshot prm ptm\"><a href=\"$screenshot_full\">" + $screenshots_html .= "<li class=\"elgg-plugin-screenshot prm ptm\"><a class=\"elgg-lightbox\" href=\"$screenshot_full\">" . "<img src=\"$screenshot_src\" alt=\"$alt\"></a></li>"; } } diff --git a/views/default/page/components/gallery.php b/views/default/page/components/gallery.php index 149ceeaf8..e8b3f477e 100644 --- a/views/default/page/components/gallery.php +++ b/views/default/page/components/gallery.php @@ -16,7 +16,7 @@ */ $items = $vars['items']; -if (!is_array($items) && sizeof($items) == 0) { +if (!is_array($items) || sizeof($items) == 0) { return true; } diff --git a/views/rss/page/components/gallery.php b/views/rss/page/components/gallery.php new file mode 100644 index 000000000..690416e5b --- /dev/null +++ b/views/rss/page/components/gallery.php @@ -0,0 +1,8 @@ +<?php +/* + * RSS gallery view + * + * @uses $vars['items'] + */ + +echo elgg_view('page/components/list', $vars); |