diff options
| -rw-r--r-- | engine/lib/deprecated-1.7.php | 191 | ||||
| -rw-r--r-- | engine/lib/deprecated-1.8.php | 442 | ||||
| -rw-r--r-- | engine/lib/sessions.php | 22 | ||||
| -rw-r--r-- | engine/lib/sites.php | 176 | ||||
| -rw-r--r-- | engine/lib/tags.php | 105 | ||||
| -rw-r--r-- | engine/lib/users.php | 246 | ||||
| -rw-r--r-- | engine/lib/usersettings.php | 29 | ||||
| -rw-r--r-- | engine/lib/views.php | 59 | 
8 files changed, 633 insertions, 637 deletions
diff --git a/engine/lib/deprecated-1.7.php b/engine/lib/deprecated-1.7.php index b143cf9a0..13a960d0b 100644 --- a/engine/lib/deprecated-1.7.php +++ b/engine/lib/deprecated-1.7.php @@ -911,3 +911,194 @@ $order_by = "", $limit = 10, $offset = 0, $count = false, $site_guid = 0) {  	return elgg_get_entities_from_relationship($options);  } +/** + * Searches for a site based on a complete or partial name + * or description or url using full text searching. + * + * IMPORTANT NOTE: With MySQL's default setup: + * 1) $criteria must be 4 or more characters long + * 2) If $criteria matches greater than 50% of results NO RESULTS ARE RETURNED! + * + * @param string  $criteria The partial or full name or username. + * @param int     $limit    Limit of the search. + * @param int     $offset   Offset. + * @param string  $order_by The order. + * @param boolean $count    Whether to return the count of results or just the results. + * + * @return mixed + * @deprecated 1.7 + */ +function search_for_site($criteria, $limit = 10, $offset = 0, $order_by = "", $count = false) { +	elgg_deprecated_notice('search_for_site() was deprecated by new search plugin.', 1.7); +	global $CONFIG; + +	$criteria = sanitise_string($criteria); +	$limit = (int)$limit; +	$offset = (int)$offset; +	$order_by = sanitise_string($order_by); + +	$access = get_access_sql_suffix("e"); + +	if ($order_by == "") { +		$order_by = "e.time_created desc"; +	} + +	if ($count) { +		$query = "SELECT count(e.guid) as total "; +	} else { +		$query = "SELECT e.* "; +	} +	$query .= "from {$CONFIG->dbprefix}entities e +		join {$CONFIG->dbprefix}sites_entity s on e.guid=s.guid +		where match(s.name, s.description, s.url) against ('$criteria') and $access"; + +	if (!$count) { +		$query .= " order by $order_by limit $offset, $limit"; // Add order and limit +		return get_data($query, "entity_row_to_elggstar"); +	} else { +		if ($count = get_data_row($query)) { +			return $count->total; +		} +	} +	return false; +} + +/** + * Searches for a user based on a complete or partial name or username. + * + * @param string  $criteria The partial or full name or username. + * @param int     $limit    Limit of the search. + * @param int     $offset   Offset. + * @param string  $order_by The order. + * @param boolean $count    Whether to return the count of results or just the results. + * + * @return mixed + * @deprecated 1.7 + */ +function search_for_user($criteria, $limit = 10, $offset = 0, $order_by = "", $count = false) { +	elgg_deprecated_notice('search_for_user() was deprecated by new search.', 1.7); +	global $CONFIG; + +	$criteria = sanitise_string($criteria); +	$limit = (int)$limit; +	$offset = (int)$offset; +	$order_by = sanitise_string($order_by); + +	$access = get_access_sql_suffix("e"); + +	if ($order_by == "") { +		$order_by = "e.time_created desc"; +	} + +	if ($count) { +		$query = "SELECT count(e.guid) as total "; +	} else { +		$query = "SELECT e.* "; +	} +	$query .= "from {$CONFIG->dbprefix}entities e +		join {$CONFIG->dbprefix}users_entity u on e.guid=u.guid where "; + +	$query .= "(u.name like \"%{$criteria}%\" or u.username like \"%{$criteria}%\")"; +	$query .= " and $access"; + +	if (!$count) { +		$query .= " order by $order_by limit $offset, $limit"; +		return get_data($query, "entity_row_to_elggstar"); +	} else { +		if ($count = get_data_row($query)) { +			return $count->total; +		} +	} +	return false; +} + +/** + * Displays a list of user objects that have been searched for. + * + * @see elgg_view_entity_list + * + * @param string $tag   Search criteria + * @param int    $limit The number of entities to display on a page + * + * @return string The list in a form suitable to display + * + * @deprecated 1.7 + */ +function list_user_search($tag, $limit = 10) { +	elgg_deprecated_notice('list_user_search() deprecated by new search', 1.7); +	$offset = (int) get_input('offset'); +	$limit = (int) $limit; +	$count = (int) search_for_user($tag, 10, 0, '', true); +	$entities = search_for_user($tag, $limit, $offset); + +	return elgg_view_entity_list($entities, $count, $offset, $limit, $fullview, false); +} + +/** + * Returns a formatted list of users suitable for injecting into search. + * + * @deprecated 1.7 + * + * @param string $hook        Hook name + * @param string $user        User? + * @param mixed  $returnvalue Previous hook's return value + * @param mixed  $tag         Tag to search against + * + * @return void + */ +function search_list_users_by_name($hook, $user, $returnvalue, $tag) { +	elgg_deprecated_notice('search_list_users_by_name() was deprecated by new search', 1.7); +	// Change this to set the number of users that display on the search page +	$threshold = 4; + +	$object = get_input('object'); + +	if (!get_input('offset') && (empty($object) || $object == 'user')) { +		if ($users = search_for_user($tag, $threshold)) { +			$countusers = search_for_user($tag, 0, 0, "", true); + +			$return = elgg_view('user/search/startblurb', array('count' => $countusers, 'tag' => $tag)); +			foreach ($users as $user) { +				$return .= elgg_view_entity($user); +			} + +			$vars = array('count' => $countusers, 'threshold' => $threshold, 'tag' => $tag); +			$return .= elgg_view('user/search/finishblurb', $vars); +			return $return; + +		} +	} +} + +/** + * Extend a view + * + * @deprecated 1.7.  Use elgg_extend_view(). + * + * @param string $view      The view to extend. + * @param string $view_name This view is added to $view + * @param int    $priority  The priority, from 0 to 1000, + *                          to add at (lowest numbers displayed first) + * @param string $viewtype  Not used + * + * @return void + */ +function extend_view($view, $view_name, $priority = 501, $viewtype = '') { +	elgg_deprecated_notice('extend_view() was deprecated by elgg_extend_view()!', 1.7); +	elgg_extend_view($view, $view_name, $priority, $viewtype); +} + +/** + * Get views in a dir + * + * @deprecated 1.7.  Use elgg_get_views(). + * + * @param string $dir  Dir + * @param string $base Base view + * + * @return array + */ +function get_views($dir, $base) { +	elgg_deprecated_notice('get_views() was deprecated by elgg_get_views()!', 1.7); +	elgg_get_views($dir, $base); +} diff --git a/engine/lib/deprecated-1.8.php b/engine/lib/deprecated-1.8.php index f58477cf1..10b7c0a81 100644 --- a/engine/lib/deprecated-1.8.php +++ b/engine/lib/deprecated-1.8.php @@ -2385,3 +2385,445 @@ $owner_guid = "", $owner_relationship = "") {  		ORDER BY sl.time_created desc limit $offset, $limit";  	return get_data($query);  } + +/** + * Perform standard authentication with a given username and password. + * Returns an ElggUser object for use with login. + * + * @see login + * + * @param string $username The username, optionally (for standard logins) + * @param string $password The password, optionally (for standard logins) + * + * @return ElggUser|false The authenticated user object, or false on failure. + *  + * @deprecated 1.8 Use elgg_authenticate + */ +function authenticate($username, $password) { +	elgg_deprecated_notice('authenticate() has been deprecated for elgg_authenticate()', 1.8); +	$pam = new ElggPAM('user'); +	$credentials = array('username' => $username, 'password' => $password); +	$result = $pam->authenticate($credentials); +	if ($result) { +		return get_user_by_username($username); +	} +	return false; +} + + +/** + * Get the members of a site. + * + * @param int $site_guid Site GUID + * @param int $limit     User GUID + * @param int $offset    Offset + * + * @return mixed + * @deprecated 1.8 Use ElggSite::getMembers() + */ +function get_site_members($site_guid, $limit = 10, $offset = 0) { +	elgg_deprecated_notice("get_site_members() deprecated. +		Use ElggSite::getMembers()", 1.8); + +	$site = get_entity($site_guid); +	if ($site) { +		return $site->getMembers($limit, $offset); +	} + +	return false; +} + +/** + * Display a list of site members + * + * @param int  $site_guid The GUID of the site + * @param int  $limit     The number of members to display on a page + * @param bool $fullview  Whether or not to display the full view (default: true) + * + * @return string A displayable list of members + * @deprecated 1.8 Use ElggSite::listMembers() + */ +function list_site_members($site_guid, $limit = 10, $fullview = true) { +	elgg_deprecated_notice("list_site_members() deprecated. +		Use ElggSite::listMembers()", 1.8); + +	$options = array( +		'limit' => $limit, +		'full_view' => $full_view, +	); + +	$site = get_entity($site_guid); +	if ($site) { +		return $site->listMembers($options); +	} + +	return ''; +} + + +/** + * Add a collection to a site. + * + * @param int $site_guid       Site GUID + * @param int $collection_guid Collection GUID + * + * @return mixed + * @deprecated 1.8  + */ +function add_site_collection($site_guid, $collection_guid) { +	elgg_deprecated_notice("add_site_collection has been deprecated", 1.8); +	global $CONFIG; + +	$site_guid = (int)$site_guid; +	$collection_guid = (int)$collection_guid; + +	return add_entity_relationship($collection_guid, "member_of_site", $site_guid); +} + +/** + * Remove a collection from a site. + * + * @param int $site_guid       Site GUID + * @param int $collection_guid Collection GUID + * + * @return mixed + * @deprecated 1.8 + */ +function remove_site_collection($site_guid, $collection_guid) { +	elgg_deprecated_notice("remove_site_collection has been deprecated", 1.8); +	$site_guid = (int)$site_guid; +	$collection_guid = (int)$collection_guid; + +	return remove_entity_relationship($collection_guid, "member_of_site", $site_guid); +} + +/** + * Get the collections belonging to a site. + * + * @param int    $site_guid Site GUID + * @param string $subtype   Subtype + * @param int    $limit     Limit + * @param int    $offset    Offset + * + * @return mixed + * @deprecated 1.8 + */ +function get_site_collections($site_guid, $subtype = "", $limit = 10, $offset = 0) { +	elgg_deprecated_notice("get_site_collections has been deprecated", 1.8); +	$site_guid = (int)$site_guid; +	$subtype = sanitise_string($subtype); +	$limit = (int)$limit; +	$offset = (int)$offset; + +	// collection isn't a valid type.  This won't work. +	return elgg_get_entities_from_relationship(array( +		'relationship' => 'member_of_site', +		'relationship_guid' => $site_guid, +		'inverse_relationship' => TRUE, +		'types' => 'collection', +		'subtypes' => $subtype, +		'limit' => $limit, +		'offset' => $offset +	)); +} + +/** + * Get an array of tags with weights for use with the output/tagcloud view. + * + * @deprecated 1.8  Use elgg_get_tags(). + * + * @param int    $threshold      Get the threshold of minimum number of each tags to + *                               bother with (ie only show tags where there are more + *                               than $threshold occurances) + * @param int    $limit          Number of tags to return + * @param string $metadata_name  Optionally, the name of the field you want to grab for + * @param string $entity_type    Optionally, the entity type ('object' etc) + * @param string $entity_subtype The entity subtype, optionally + * @param int    $owner_guid     The GUID of the tags owner, optionally + * @param int    $site_guid      Optionally, the site to restrict to (default is the current site) + * @param int    $start_ts       Optionally specify a start timestamp for tags used to + *                               generate cloud. + * @param int    $end_ts         Optionally specify an end timestamp for tags used to generate cloud + * + * @return array|false Array of objects with ->tag and ->total values, or false on failure + */ +function get_tags($threshold = 1, $limit = 10, $metadata_name = "", $entity_type = "object", +$entity_subtype = "", $owner_guid = "", $site_guid = -1, $start_ts = "", $end_ts = "") { + +	elgg_deprecated_notice('get_tags() has been replaced by elgg_get_tags()', 1.8); + +	if (is_array($metadata_name)) { +		return false; +	} + +	$options = array(); +	if ($metadata_name === '') { +		$options['tag_names'] = array(); +	} else { +		$options['tag_names'] = array($metadata_name); +	} + +	$options['threshold'] = $threshold; +	$options['limit'] = $limit; + +	// rewrite owner_guid to container_guid to emulate old functionality +	$container_guid = $owner_guid; +	if ($container_guid) { +		$options['container_guids'] = $container_guid; +	} + +	if ($entity_type) { +		$options['type'] = $entity_type; +	} + +	if ($entity_subtype) { +		$options['subtype'] = $entity_subtype; +	} + +	if ($site_guid != -1) { +		$options['site_guids'] = $site_guid; +	} + +	if ($end_ts) { +		$options['created_time_upper'] = $end_ts; +	} + +	if ($start_ts) { +		$options['created_time_lower'] = $start_ts; +	} + +	$r = elgg_get_tags($options); +	return $r; +} + +/** + * Loads and displays a tagcloud given particular criteria. + * + * @deprecated 1.8 use elgg_view_tagcloud() + * + * @param int    $threshold      Get the threshold of minimum number of each tags + *                               to bother with (ie only show tags where there are + *                               more than $threshold occurances) + * @param int    $limit          Number of tags to return + * @param string $metadata_name  Optionally, the name of the field you want to grab for + * @param string $entity_type    Optionally, the entity type ('object' etc) + * @param string $entity_subtype The entity subtype, optionally + * @param int    $owner_guid     The GUID of the tags owner, optionally + * @param int    $site_guid      Optionally, the site to restrict to (default is the current site) + * @param int    $start_ts       Optionally specify a start timestamp for tags used to + *                               generate cloud. + * @param int    $end_ts         Optionally specify an end timestamp for tags used to generate + *                               cloud. + * + * @return string The HTML (or other, depending on view type) of the tagcloud. + */ +function display_tagcloud($threshold = 1, $limit = 10, $metadata_name = "", $entity_type = "object", +$entity_subtype = "", $owner_guid = "", $site_guid = -1, $start_ts = "", $end_ts = "") { + +	elgg_deprecated_notice('display_tagcloud() was deprecated by elgg_view_tagcloud()!', 1.8); + +	$tags = get_tags($threshold, $limit, $metadata_name, $entity_type, +		$entity_subtype, $owner_guid, $site_guid, $start_ts, $end_ts); + +	return elgg_view('output/tagcloud', array( +		'value' => $tags, +		'type' => $entity_type, +		'subtype' => $entity_subtype, +	)); +} + + +/** + * Obtains a list of objects owned by a user + * + * @param int    $user_guid The GUID of the owning user + * @param string $subtype   Optionally, the subtype of objects + * @param int    $limit     The number of results to return (default 10) + * @param int    $offset    Indexing offset, if any + * @param int    $timelower The earliest time the entity can have been created. Default: all + * @param int    $timeupper The latest time the entity can have been created. Default: all + * + * @return false|array An array of ElggObjects or false, depending on success + * @deprecated 1.8 Use elgg_get_entities() instead + */ +function get_user_objects($user_guid, $subtype = ELGG_ENTITIES_ANY_VALUE, $limit = 10, +$offset = 0, $timelower = 0, $timeupper = 0) { +	elgg_deprecated_notice("get_user_objects() was deprecated in favor of elgg_get_entities()", 1.8); +	$ntt = elgg_get_entities(array( +		'type' => 'object', +		'subtype' => $subtype, +		'owner_guid' => $user_guid, +		'limit' => $limit, +		'offset' => $offset, +		'container_guid' => $user_guid, +		'created_time_lower' => $timelower, +		'created_time_upper' => $timeupper +	)); +	return $ntt; +} + +/** + * Counts the objects (optionally of a particular subtype) owned by a user + * + * @param int    $user_guid The GUID of the owning user + * @param string $subtype   Optionally, the subtype of objects + * @param int    $timelower The earliest time the entity can have been created. Default: all + * @param int    $timeupper The latest time the entity can have been created. Default: all + * + * @return int The number of objects the user owns (of this subtype) + * @deprecated 1.8 Use elgg_get_entities() instead + */ +function count_user_objects($user_guid, $subtype = ELGG_ENTITIES_ANY_VALUE, $timelower = 0, +$timeupper = 0) { +	elgg_deprecated_notice("count_user_objects() was deprecated in favor of elgg_get_entities()", 1.8); +	$total = elgg_get_entities(array( +		'type' => 'object', +		'subtype' => $subtype, +		'owner_guid' => $user_guid, +		'count' => TRUE, +		'container_guid' => $user_guid, +		'created_time_lower' => $timelower, +		'created_time_upper' => $timeupper +	)); +	return $total; +} + +/** + * Displays a list of user objects of a particular subtype, with navigation. + * + * @see elgg_view_entity_list + * + * @param int    $user_guid      The GUID of the user + * @param string $subtype        The object subtype + * @param int    $limit          The number of entities to display on a page + * @param bool   $fullview       Whether or not to display the full view (default: true) + * @param bool   $listtypetoggle Whether or not to allow gallery view (default: true) + * @param bool   $pagination     Whether to display pagination (default: true) + * @param int    $timelower      The earliest time the entity can have been created. Default: all + * @param int    $timeupper      The latest time the entity can have been created. Default: all + * + * @return string The list in a form suitable to display + * @deprecated 1.8 Use elgg_list_entities() instead + */ +function list_user_objects($user_guid, $subtype = ELGG_ENTITIES_ANY_VALUE, $limit = 10, +$fullview = true, $listtypetoggle = true, $pagination = true, $timelower = 0, $timeupper = 0) { +	elgg_deprecated_notice("list_user_objects() was deprecated in favor of elgg_list_entities()", 1.8); + +	$offset = (int) get_input('offset'); +	$limit = (int) $limit; +	$count = (int) count_user_objects($user_guid, $subtype, $timelower, $timeupper); +	$entities = get_user_objects($user_guid, $subtype, $limit, $offset, $timelower, $timeupper); + +	return elgg_view_entity_list($entities, $count, $offset, $limit, $fullview, $listtypetoggle, +		$pagination); +} + + +/** + * Get user objects by an array of metadata + * + * @param int    $user_guid The GUID of the owning user + * @param string $subtype   Optionally, the subtype of objects + * @param array  $metadata  An array of metadata + * @param int    $limit     The number of results to return (default 10) + * @param int    $offset    Indexing offset, if any + * + * @return false|array An array of ElggObjects or false, depending on success + * @deprecated 1.8 Use elgg_get_entities_from_metadata() instead + */ +function get_user_objects_by_metadata($user_guid, $subtype = "", $metadata = array(), +$limit = 0, $offset = 0) { +	elgg_deprecated_notice("get_user_objects_by_metadata() was deprecated in favor of elgg_get_entities_from_metadata()", 1.8); +	return get_entities_from_metadata_multi($metadata, "object", $subtype, $user_guid, +		$limit, $offset); +} + +/** + * Set the validation status for a user. + * + * @param bool   $status Validated (true) or false + * @param string $method Optional method to say how a user was validated + * @return bool + * @deprecated 1.8 + */ +function set_user_validation_status($user_guid, $status, $method = '') { +	elgg_deprecated_notice("set_user_validation_status() is deprecated", 1.8); +	return elgg_set_user_validation_status($user_guid, $status, $method); +} + +/** + * Trigger an event requesting that a user guid be validated somehow - either by email address or some other way. + * + * This function invalidates any existing validation value. + * + * @param int $user_guid User's GUID + * @deprecated 1.8 + */ +function request_user_validation($user_guid) { +	elgg_deprecated_notice("request_user_validation() is deprecated. +		Plugins should register for the 'register, user' plugin hook", 1.8); +	$user = get_entity($user_guid); + +	if (($user) && ($user instanceof ElggUser)) { +		// invalidate any existing validations +		set_user_validation_status($user_guid, false); + +		// request validation +		trigger_elgg_event('validate', 'user', $user); +	} +} + +/** + * Register a user settings page with the admin panel. + * This function extends the view "usersettings/main" with the provided view. + * This view should provide a description and either a control or a link to. + * + * Usage: + * 	- To add a control to the main admin panel then extend usersettings/main + *  - To add a control to a new page create a page which renders a view + *    usersettings/subpage (where subpage is your new page - + *    nb. some pages already exist that you can extend), extend the main view + *    to point to it, and add controls to your new view. + * + * At the moment this is essentially a wrapper around elgg_extend_view(). + * + * @param string $new_settings_view The view associated with the control you're adding + * @param string $view              The view to extend, by default this is 'usersettings/main'. + * @param int    $priority          Optional priority to govern the appearance in the list. + * + * @return bool + * @deprecated 1.8 Extend one of the views in core/settings + */ +function extend_elgg_settings_page($new_settings_view, $view = 'usersettings/main', +$priority = 500) { +	// see views: /core/settings +	elgg_deprecated_notice("extend_elgg_settings_page has been deprecated. Extend one of the settings views instead", 1.8); + +	return elgg_extend_view($view, $new_settings_view, $priority); +} + +/** + * @deprecated 1.8 Use elgg_view_page() + */ +function page_draw($title, $body, $sidebar = "") { +	elgg_deprecated_notice("page_draw() was deprecated in favor of elgg_view_page() in 1.8.", 1.8); + +	$vars = array( +		'sidebar' => $sidebar +	); +	echo elgg_view_page($title, $body, 'default', $vars); +} + +/** + * Wrapper function to display search listings. + * + * @param string $icon The icon for the listing + * @param string $info Any information that needs to be displayed. + * + * @return string The HTML (etc) representing the listing + * @deprecated 1.8 use elgg_view_image_block() + */ +function elgg_view_listing($icon, $info) { +	elgg_deprecated_notice('elgg_view_listing deprecated by elgg_view_image_block', 1.8); +	return elgg_view('layout/objects/image_block', array('image' => $icon, 'body' => $info)); +} diff --git a/engine/lib/sessions.php b/engine/lib/sessions.php index eb47f4eb5..46912a152 100644 --- a/engine/lib/sessions.php +++ b/engine/lib/sessions.php @@ -148,28 +148,6 @@ function elgg_authenticate($username, $password) {  }  /** - * Perform standard authentication with a given username and password. - * Returns an ElggUser object for use with login. - * - * @see login - * - * @param string $username The username, optionally (for standard logins) - * @param string $password The password, optionally (for standard logins) - * - * @return ElggUser|false The authenticated user object, or false on failure. - */ -function authenticate($username, $password) { -	elgg_deprecated_notice('authenticate() has been deprecated for elgg_authenticate()', 1.8); -	$pam = new ElggPAM('user'); -	$credentials = array('username' => $username, 'password' => $password); -	$result = $pam->authenticate($credentials); -	if ($result) { -		return get_user_by_username($username); -	} -	return false; -} - -/**   * Hook into the PAM system which accepts a username and password and attempts to authenticate   * it against a known user.   * diff --git a/engine/lib/sites.php b/engine/lib/sites.php index 97398d7f2..1df20a5ce 100644 --- a/engine/lib/sites.php +++ b/engine/lib/sites.php @@ -100,15 +100,6 @@ function create_site_entity($guid, $name, $description, $url) {  }  /** - * @deprecated 1.6 - * @return 1 - */ -function delete_site_entity($guid) { -	elgg_deprecated_notice("delete_site_entity has been deprecated", 1.6); -	return 1; // Always return that we have deleted one row in order to not break existing code. -} - -/**   * Add a user to a site.   *   * @param int $site_guid Site guid @@ -141,55 +132,6 @@ function remove_site_user($site_guid, $user_guid) {  }  /** - * Get the members of a site. - * - * @param int $site_guid Site GUID - * @param int $limit     User GUID - * @param int $offset    Offset - * - * @return mixed - * @deprecated 1.8 Use ElggSite::getMembers() - */ -function get_site_members($site_guid, $limit = 10, $offset = 0) { -	elgg_deprecated_notice("get_site_members() deprecated. -		Use ElggSite::getMembers()", 1.8); - -	$site = get_entity($site_guid); -	if ($site) { -		return $site->getMembers($limit, $offset); -	} - -	return false; -} - -/** - * Display a list of site members - * - * @param int  $site_guid The GUID of the site - * @param int  $limit     The number of members to display on a page - * @param bool $fullview  Whether or not to display the full view (default: true) - * - * @return string A displayable list of members - * @deprecated 1.8 Use ElggSite::listMembers() - */ -function list_site_members($site_guid, $limit = 10, $fullview = true) { -	elgg_deprecated_notice("list_site_members() deprecated. -		Use ElggSite::listMembers()", 1.8); - -	$options = array( -		'limit' => $limit, -		'full_view' => $full_view, -	); - -	$site = get_entity($site_guid); -	if ($site) { -		return $site->listMembers($options); -	} - -	return ''; -} - -/**   * Add an object to a site.   *   * @param int $site_guid   Site GUID @@ -248,72 +190,6 @@ function get_site_objects($site_guid, $subtype = "", $limit = 10, $offset = 0) {  }  /** - * Add a collection to a site. - * - * @param int $site_guid       Site GUID - * @param int $collection_guid Collection GUID - * - * @return mixed - * @deprecated 1.8  - */ -function add_site_collection($site_guid, $collection_guid) { -	elgg_deprecated_notice("add_site_collection has been deprecated", 1.8); -	global $CONFIG; - -	$site_guid = (int)$site_guid; -	$collection_guid = (int)$collection_guid; - -	return add_entity_relationship($collection_guid, "member_of_site", $site_guid); -} - -/** - * Remove a collection from a site. - * - * @param int $site_guid       Site GUID - * @param int $collection_guid Collection GUID - * - * @return mixed - * @deprecated 1.8 - */ -function remove_site_collection($site_guid, $collection_guid) { -	elgg_deprecated_notice("remove_site_collection has been deprecated", 1.8); -	$site_guid = (int)$site_guid; -	$collection_guid = (int)$collection_guid; - -	return remove_entity_relationship($collection_guid, "member_of_site", $site_guid); -} - -/** - * Get the collections belonging to a site. - * - * @param int    $site_guid Site GUID - * @param string $subtype   Subtype - * @param int    $limit     Limit - * @param int    $offset    Offset - * - * @return mixed - * @deprecated 1.8 - */ -function get_site_collections($site_guid, $subtype = "", $limit = 10, $offset = 0) { -	elgg_deprecated_notice("get_site_collections has been deprecated", 1.8); -	$site_guid = (int)$site_guid; -	$subtype = sanitise_string($subtype); -	$limit = (int)$limit; -	$offset = (int)$offset; - -	// collection isn't a valid type.  This won't work. -	return elgg_get_entities_from_relationship(array( -		'relationship' => 'member_of_site', -		'relationship_guid' => $site_guid, -		'inverse_relationship' => TRUE, -		'types' => 'collection', -		'subtypes' => $subtype, -		'limit' => $limit, -		'offset' => $offset -	)); -} - -/**   * Return the site via a url.   *   * @param string $url The URL of a site @@ -335,58 +211,6 @@ function get_site_by_url($url) {  }  /** - * Searches for a site based on a complete or partial name - * or description or url using full text searching. - * - * IMPORTANT NOTE: With MySQL's default setup: - * 1) $criteria must be 4 or more characters long - * 2) If $criteria matches greater than 50% of results NO RESULTS ARE RETURNED! - * - * @param string  $criteria The partial or full name or username. - * @param int     $limit    Limit of the search. - * @param int     $offset   Offset. - * @param string  $order_by The order. - * @param boolean $count    Whether to return the count of results or just the results. - * - * @return mixed - * @deprecated 1.7 - */ -function search_for_site($criteria, $limit = 10, $offset = 0, $order_by = "", $count = false) { -	elgg_deprecated_notice('search_for_site() was deprecated by new search plugin.', 1.7); -	global $CONFIG; - -	$criteria = sanitise_string($criteria); -	$limit = (int)$limit; -	$offset = (int)$offset; -	$order_by = sanitise_string($order_by); - -	$access = get_access_sql_suffix("e"); - -	if ($order_by == "") { -		$order_by = "e.time_created desc"; -	} - -	if ($count) { -		$query = "SELECT count(e.guid) as total "; -	} else { -		$query = "SELECT e.* "; -	} -	$query .= "from {$CONFIG->dbprefix}entities e -		join {$CONFIG->dbprefix}sites_entity s on e.guid=s.guid -		where match(s.name, s.description, s.url) against ('$criteria') and $access"; - -	if (!$count) { -		$query .= " order by $order_by limit $offset, $limit"; // Add order and limit -		return get_data($query, "entity_row_to_elggstar"); -	} else { -		if ($count = get_data_row($query)) { -			return $count->total; -		} -	} -	return false; -} - -/**   * Retrieve a site and return the domain portion of its url.   *   * @param int $guid ElggSite GUID diff --git a/engine/lib/tags.php b/engine/lib/tags.php index ca46a698b..924843a29 100644 --- a/engine/lib/tags.php +++ b/engine/lib/tags.php @@ -245,75 +245,6 @@ function elgg_get_tags(array $options = array()) {  }  /** - * Get an array of tags with weights for use with the output/tagcloud view. - * - * @deprecated 1.8  Use elgg_get_tags(). - * - * @param int    $threshold      Get the threshold of minimum number of each tags to - *                               bother with (ie only show tags where there are more - *                               than $threshold occurances) - * @param int    $limit          Number of tags to return - * @param string $metadata_name  Optionally, the name of the field you want to grab for - * @param string $entity_type    Optionally, the entity type ('object' etc) - * @param string $entity_subtype The entity subtype, optionally - * @param int    $owner_guid     The GUID of the tags owner, optionally - * @param int    $site_guid      Optionally, the site to restrict to (default is the current site) - * @param int    $start_ts       Optionally specify a start timestamp for tags used to - *                               generate cloud. - * @param int    $end_ts         Optionally specify an end timestamp for tags used to generate cloud - * - * @return array|false Array of objects with ->tag and ->total values, or false on failure - */ -function get_tags($threshold = 1, $limit = 10, $metadata_name = "", $entity_type = "object", -$entity_subtype = "", $owner_guid = "", $site_guid = -1, $start_ts = "", $end_ts = "") { - -	elgg_deprecated_notice('get_tags() has been replaced by elgg_get_tags()', 1.8); - -	if (is_array($metadata_name)) { -		return false; -	} - -	$options = array(); -	if ($metadata_name === '') { -		$options['tag_names'] = array(); -	} else { -		$options['tag_names'] = array($metadata_name); -	} - -	$options['threshold'] = $threshold; -	$options['limit'] = $limit; - -	// rewrite owner_guid to container_guid to emulate old functionality -	$container_guid = $owner_guid; -	if ($container_guid) { -		$options['container_guids'] = $container_guid; -	} - -	if ($entity_type) { -		$options['type'] = $entity_type; -	} - -	if ($entity_subtype) { -		$options['subtype'] = $entity_subtype; -	} - -	if ($site_guid != -1) { -		$options['site_guids'] = $site_guid; -	} - -	if ($end_ts) { -		$options['created_time_upper'] = $end_ts; -	} - -	if ($start_ts) { -		$options['created_time_lower'] = $start_ts; -	} - -	$r = elgg_get_tags($options); -	return $r; -} - -/**   * Returns viewable tagcloud   *   * @see elgg_get_tags @@ -345,42 +276,6 @@ function elgg_view_tagcloud(array $options = array()) {  }  /** - * Loads and displays a tagcloud given particular criteria. - * - * @deprecated 1.8 use elgg_view_tagcloud() - * - * @param int    $threshold      Get the threshold of minimum number of each tags - *                               to bother with (ie only show tags where there are - *                               more than $threshold occurances) - * @param int    $limit          Number of tags to return - * @param string $metadata_name  Optionally, the name of the field you want to grab for - * @param string $entity_type    Optionally, the entity type ('object' etc) - * @param string $entity_subtype The entity subtype, optionally - * @param int    $owner_guid     The GUID of the tags owner, optionally - * @param int    $site_guid      Optionally, the site to restrict to (default is the current site) - * @param int    $start_ts       Optionally specify a start timestamp for tags used to - *                               generate cloud. - * @param int    $end_ts         Optionally specify an end timestamp for tags used to generate - *                               cloud. - * - * @return string The HTML (or other, depending on view type) of the tagcloud. - */ -function display_tagcloud($threshold = 1, $limit = 10, $metadata_name = "", $entity_type = "object", -$entity_subtype = "", $owner_guid = "", $site_guid = -1, $start_ts = "", $end_ts = "") { - -	elgg_deprecated_notice('display_tagcloud() was deprecated by elgg_view_tagcloud()!', 1.8); - -	$tags = get_tags($threshold, $limit, $metadata_name, $entity_type, -		$entity_subtype, $owner_guid, $site_guid, $start_ts, $end_ts); - -	return elgg_view('output/tagcloud', array( -		'value' => $tags, -		'type' => $entity_type, -		'subtype' => $entity_subtype, -	)); -} - -/**   * Registers a metadata name as containing tags for an entity.   * This is required if you are using a non-standard metadata name   * for your tags. diff --git a/engine/lib/users.php b/engine/lib/users.php index ab83da699..84e5fcc7b 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -435,91 +435,6 @@ $offset = 0) {  }  /** - * Obtains a list of objects owned by a user - * - * @param int    $user_guid The GUID of the owning user - * @param string $subtype   Optionally, the subtype of objects - * @param int    $limit     The number of results to return (default 10) - * @param int    $offset    Indexing offset, if any - * @param int    $timelower The earliest time the entity can have been created. Default: all - * @param int    $timeupper The latest time the entity can have been created. Default: all - * - * @return false|array An array of ElggObjects or false, depending on success - * @deprecated 1.8 Use elgg_get_entities() instead - */ -function get_user_objects($user_guid, $subtype = ELGG_ENTITIES_ANY_VALUE, $limit = 10, -$offset = 0, $timelower = 0, $timeupper = 0) { -	elgg_deprecated_notice("get_user_objects() was deprecated in favor of elgg_get_entities()", 1.8); -	$ntt = elgg_get_entities(array( -		'type' => 'object', -		'subtype' => $subtype, -		'owner_guid' => $user_guid, -		'limit' => $limit, -		'offset' => $offset, -		'container_guid' => $user_guid, -		'created_time_lower' => $timelower, -		'created_time_upper' => $timeupper -	)); -	return $ntt; -} - -/** - * Counts the objects (optionally of a particular subtype) owned by a user - * - * @param int    $user_guid The GUID of the owning user - * @param string $subtype   Optionally, the subtype of objects - * @param int    $timelower The earliest time the entity can have been created. Default: all - * @param int    $timeupper The latest time the entity can have been created. Default: all - * - * @return int The number of objects the user owns (of this subtype) - * @deprecated 1.8 Use elgg_get_entities() instead - */ -function count_user_objects($user_guid, $subtype = ELGG_ENTITIES_ANY_VALUE, $timelower = 0, -$timeupper = 0) { -	elgg_deprecated_notice("count_user_objects() was deprecated in favor of elgg_get_entities()", 1.8); -	$total = elgg_get_entities(array( -		'type' => 'object', -		'subtype' => $subtype, -		'owner_guid' => $user_guid, -		'count' => TRUE, -		'container_guid' => $user_guid, -		'created_time_lower' => $timelower, -		'created_time_upper' => $timeupper -	)); -	return $total; -} - -/** - * Displays a list of user objects of a particular subtype, with navigation. - * - * @see elgg_view_entity_list - * - * @param int    $user_guid      The GUID of the user - * @param string $subtype        The object subtype - * @param int    $limit          The number of entities to display on a page - * @param bool   $fullview       Whether or not to display the full view (default: true) - * @param bool   $listtypetoggle Whether or not to allow gallery view (default: true) - * @param bool   $pagination     Whether to display pagination (default: true) - * @param int    $timelower      The earliest time the entity can have been created. Default: all - * @param int    $timeupper      The latest time the entity can have been created. Default: all - * - * @return string The list in a form suitable to display - * @deprecated 1.8 Use elgg_list_entities() instead - */ -function list_user_objects($user_guid, $subtype = ELGG_ENTITIES_ANY_VALUE, $limit = 10, -$fullview = true, $listtypetoggle = true, $pagination = true, $timelower = 0, $timeupper = 0) { -	elgg_deprecated_notice("list_user_objects() was deprecated in favor of elgg_list_entities()", 1.8); - -	$offset = (int) get_input('offset'); -	$limit = (int) $limit; -	$count = (int) count_user_objects($user_guid, $subtype, $timelower, $timeupper); -	$entities = get_user_objects($user_guid, $subtype, $limit, $offset, $timelower, $timeupper); - -	return elgg_view_entity_list($entities, $count, $offset, $limit, $fullview, $listtypetoggle, -		$pagination); -} - -/**   * Obtains a list of objects owned by a user's friends   *   * @param int    $user_guid The GUID of the user to get the friends of @@ -615,25 +530,6 @@ $listtypetoggle = true, $pagination = true, $timelower = 0, $timeupper = 0) {  }  /** - * Get user objects by an array of metadata - * - * @param int    $user_guid The GUID of the owning user - * @param string $subtype   Optionally, the subtype of objects - * @param array  $metadata  An array of metadata - * @param int    $limit     The number of results to return (default 10) - * @param int    $offset    Indexing offset, if any - * - * @return false|array An array of ElggObjects or false, depending on success - * @deprecated 1.8 Use elgg_get_entities_from_metadata() instead - */ -function get_user_objects_by_metadata($user_guid, $subtype = "", $metadata = array(), -$limit = 0, $offset = 0) { -	elgg_deprecated_notice("get_user_objects_by_metadata() was deprecated in favor of elgg_get_entities_from_metadata()", 1.8); -	return get_entities_from_metadata_multi($metadata, "object", $subtype, $user_guid, -		$limit, $offset); -} - -/**   * Get a user object from a GUID.   *   * This function returns an ElggUser from a given GUID. @@ -745,77 +641,6 @@ function get_user_by_email($email) {  }  /** - * Searches for a user based on a complete or partial name or username. - * - * @param string  $criteria The partial or full name or username. - * @param int     $limit    Limit of the search. - * @param int     $offset   Offset. - * @param string  $order_by The order. - * @param boolean $count    Whether to return the count of results or just the results. - * - * @return mixed - * @deprecated 1.7 - */ -function search_for_user($criteria, $limit = 10, $offset = 0, $order_by = "", $count = false) { -	elgg_deprecated_notice('search_for_user() was deprecated by new search.', 1.7); -	global $CONFIG; - -	$criteria = sanitise_string($criteria); -	$limit = (int)$limit; -	$offset = (int)$offset; -	$order_by = sanitise_string($order_by); - -	$access = get_access_sql_suffix("e"); - -	if ($order_by == "") { -		$order_by = "e.time_created desc"; -	} - -	if ($count) { -		$query = "SELECT count(e.guid) as total "; -	} else { -		$query = "SELECT e.* "; -	} -	$query .= "from {$CONFIG->dbprefix}entities e -		join {$CONFIG->dbprefix}users_entity u on e.guid=u.guid where "; - -	$query .= "(u.name like \"%{$criteria}%\" or u.username like \"%{$criteria}%\")"; -	$query .= " and $access"; - -	if (!$count) { -		$query .= " order by $order_by limit $offset, $limit"; -		return get_data($query, "entity_row_to_elggstar"); -	} else { -		if ($count = get_data_row($query)) { -			return $count->total; -		} -	} -	return false; -} - -/** - * Displays a list of user objects that have been searched for. - * - * @see elgg_view_entity_list - * - * @param string $tag   Search criteria - * @param int    $limit The number of entities to display on a page - * - * @return string The list in a form suitable to display - * - * @deprecated 1.7 - */ -function list_user_search($tag, $limit = 10) { -	elgg_deprecated_notice('list_user_search() deprecated by new search', 1.7); -	$offset = (int) get_input('offset'); -	$limit = (int) $limit; -	$count = (int) search_for_user($tag, 10, 0, '', true); -	$entities = search_for_user($tag, $limit, $offset); - -	return elgg_view_entity_list($entities, $count, $offset, $limit, $fullview, false); -} - -/**   * A function that returns a maximum of $limit users who have done something within the last   * $seconds seconds.   * @@ -1267,41 +1092,6 @@ function elgg_get_user_validation_status($user_guid) {  }  /** - * Set the validation status for a user. - * - * @param bool   $status Validated (true) or false - * @param string $method Optional method to say how a user was validated - * @return bool - * @deprecated 1.8 - */ -function set_user_validation_status($user_guid, $status, $method = '') { -	elgg_deprecated_notice("set_user_validation_status() is deprecated", 1.8); -	return elgg_set_user_validation_status($user_guid, $status, $method); -} - -/** - * Trigger an event requesting that a user guid be validated somehow - either by email address or some other way. - * - * This function invalidates any existing validation value. - * - * @param int $user_guid User's GUID - * @deprecated 1.8 - */ -function request_user_validation($user_guid) { -	elgg_deprecated_notice("request_user_validation() is deprecated. -		Plugins should register for the 'register, user' plugin hook", 1.8); -	$user = get_entity($user_guid); - -	if (($user) && ($user instanceof ElggUser)) { -		// invalidate any existing validations -		set_user_validation_status($user_guid, false); - -		// request validation -		trigger_elgg_event('validate', 'user', $user); -	} -} - -/**   * Adds collection submenu items   *   * @return void @@ -1778,42 +1568,6 @@ function users_init() {  }  /** - * Returns a formatted list of users suitable for injecting into search. - * - * @deprecated 1.7 - * - * @param string $hook        Hook name - * @param string $user        User? - * @param mixed  $returnvalue Previous hook's return value - * @param mixed  $tag         Tag to search against - * - * @return void - */ -function search_list_users_by_name($hook, $user, $returnvalue, $tag) { -	elgg_deprecated_notice('search_list_users_by_name() was deprecated by new search', 1.7); -	// Change this to set the number of users that display on the search page -	$threshold = 4; - -	$object = get_input('object'); - -	if (!get_input('offset') && (empty($object) || $object == 'user')) { -		if ($users = search_for_user($tag, $threshold)) { -			$countusers = search_for_user($tag, 0, 0, "", true); - -			$return = elgg_view('user/search/startblurb', array('count' => $countusers, 'tag' => $tag)); -			foreach ($users as $user) { -				$return .= elgg_view_entity($user); -			} - -			$vars = array('count' => $countusers, 'threshold' => $threshold, 'tag' => $tag); -			$return .= elgg_view('user/search/finishblurb', $vars); -			return $return; - -		} -	} -} - -/**   * Saves user settings by directly including actions.   *   * @todo this is dirty. diff --git a/engine/lib/usersettings.php b/engine/lib/usersettings.php index f6bbaea06..a7181626d 100644 --- a/engine/lib/usersettings.php +++ b/engine/lib/usersettings.php @@ -8,35 +8,6 @@   */  /** - * Register a user settings page with the admin panel. - * This function extends the view "usersettings/main" with the provided view. - * This view should provide a description and either a control or a link to. - * - * Usage: - * 	- To add a control to the main admin panel then extend usersettings/main - *  - To add a control to a new page create a page which renders a view - *    usersettings/subpage (where subpage is your new page - - *    nb. some pages already exist that you can extend), extend the main view - *    to point to it, and add controls to your new view. - * - * At the moment this is essentially a wrapper around elgg_extend_view(). - * - * @param string $new_settings_view The view associated with the control you're adding - * @param string $view              The view to extend, by default this is 'usersettings/main'. - * @param int    $priority          Optional priority to govern the appearance in the list. - * - * @return bool - * @deprecated 1.8 Extend oone of the views in core/settings - */ -function extend_elgg_settings_page($new_settings_view, $view = 'usersettings/main', -$priority = 500) { -	// see views: /core/settings -	elgg_deprecated_notice("extend_elgg_settings_page has been deprecated. Extend on of the settings views instead", 1.8); - -	return elgg_extend_view($view, $new_settings_view, $priority); -} - -/**   * Set up the page for user settings   *   * @return void diff --git a/engine/lib/views.php b/engine/lib/views.php index 6256d3a8d..b29a2f35a 100644 --- a/engine/lib/views.php +++ b/engine/lib/views.php @@ -546,24 +546,6 @@ function elgg_unextend_view($view, $view_extension) {  }  /** - * Extend a view - * - * @deprecated 1.7.  Use elgg_extend_view(). - * - * @param string $view      The view to extend. - * @param string $view_name This view is added to $view - * @param int    $priority  The priority, from 0 to 1000, - *                          to add at (lowest numbers displayed first) - * @param string $viewtype  Not used - * - * @return void - */ -function extend_view($view, $view_name, $priority = 501, $viewtype = '') { -	elgg_deprecated_notice('extend_view() was deprecated by elgg_extend_view()!', 1.7); -	elgg_extend_view($view, $view_name, $priority, $viewtype); -} - -/**   * Assembles and outputs a full page.   *   * A "page" in Elgg is determined by the current view type and @@ -608,18 +590,6 @@ function elgg_view_page($title, $body, $page_shell = 'default', $vars = array())  }  /** - * @deprecated 1.8 Use elgg_view_page() - */ -function page_draw($title, $body, $sidebar = "") { -	elgg_deprecated_notice("page_draw() was deprecated in favor of elgg_view_page() in 1.8.", 1.8); - -	$vars = array( -		'sidebar' => $sidebar -	); -	echo elgg_view_page($title, $body, 'default', $vars); -} - -/**   * Displays a layout with optional parameters.   *   * Layouts provide consistent organization of pages and other blocks of content. @@ -1132,20 +1102,6 @@ function elgg_view_river_item($item) {  }  /** - * Wrapper function to display search listings. - * - * @param string $icon The icon for the listing - * @param string $info Any information that needs to be displayed. - * - * @return string The HTML (etc) representing the listing - * @deprecated 1.8 use elgg_view_image_block() - */ -function elgg_view_listing($icon, $info) { -	elgg_deprecated_notice('elgg_view_listing deprecated by elgg_view_image_block', 1.8); -	return elgg_view('layout/objects/image_block', array('image' => $icon, 'body' => $info)); -} - -/**   * Convenience function for generating a form from a view in a standard location.   *   * This function assumes that the body of the form is located at "forms/$action" and @@ -1283,21 +1239,6 @@ function elgg_get_views($dir, $base) {  }  /** - * Get views in a dir - * - * @deprecated 1.7.  Use elgg_get_views(). - * - * @param string $dir  Dir - * @param string $base Base view - * - * @return array - */ -function get_views($dir, $base) { -	elgg_deprecated_notice('get_views() was deprecated by elgg_get_views()!', 1.7); -	elgg_get_views($dir, $base); -} - -/**   * Returns all views below a partial view.   *   * Settings $view_root = 'profile' will show all available views under  | 
