diff options
57 files changed, 308 insertions, 360 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index 22615012e..dcf33bce7 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -17,6 +17,32 @@ Version 1.8.0 (Jackie) elgg_clear_sticky_form(), elgg_is_sticky_form(), and elgg_get_sticky_value(). +Version 1.7.2 +(xxxxx from http://code.elgg.org/elgg/branches/1.7) + + UI Changes: + * Group "widgets" have been standardized with new blog and bookmark widgets. + * New group member listing page. + * Group forum topics can be edited including title and status. + * Added a group creation river entry. + + Bugfixes: + * Fixed preview and draft saving for blog plugin. + * Page titles are now editable. + * Fixed several bugs with the new elgg_get* and elgg_list* functions. + * Groups do not show up as personal friend collections anymore. + * Fixed an upgrade issue with utf8 usernames. + * Encoding of & in group forums is fixed. + + API changes: + * Added elgg_list_entities_from_metadata(). + * Added elgg_send_email(). + * Added remove_from_river_by_id(). + * Added remove_from_register() for removing menu items. + * Added elgg_get_excerpt(). + * Added elgg_get_friendly_title() and elgg_get_friendly_time(). + + Version 1.7.1 (April 21, 2010 from http://code.elgg.org/elgg/branches/1.7) diff --git a/actions/notifications/settings/usersettings/save.php b/actions/notifications/settings/usersettings/save.php index 159dd501b..7df0e7e5c 100644 --- a/actions/notifications/settings/usersettings/save.php +++ b/actions/notifications/settings/usersettings/save.php @@ -12,9 +12,16 @@ $method = get_input('method'); gatekeeper(); +$current_settings = get_user_notification_settings(); + $result = false; foreach ($method as $k => $v) { - $result = set_user_notification_setting($_SESSION['user']->guid, $k, ($v == 'yes') ? true : false); + // check if setting has changed and skip if not + if ($current_settings->$k == ($v == 'yes')) { + continue; + } + + $result = set_user_notification_setting(get_loggedin_userid(), $k, ($v == 'yes') ? true : false); if (!$result) { register_error(elgg_echo('notifications:usersettings:save:fail')); @@ -23,6 +30,4 @@ foreach ($method as $k => $v) { if ($result) { system_message(elgg_echo('notifications:usersettings:save:ok')); -} else { - register_error(elgg_echo('notifications:usersettings:save:fail')); -}
\ No newline at end of file +} diff --git a/actions/user/default_access.php b/actions/user/default_access.php index 0aacf209c..845e1fbfc 100644 --- a/actions/user/default_access.php +++ b/actions/user/default_access.php @@ -24,8 +24,8 @@ if ($CONFIG->allow_user_default_access) { if ($user) { $current_default_access = $user->getPrivateSetting('elgg_default_access'); - if ($default_access != $current_default_access) { - if ($user->setPrivateSetting('elgg_default_access',$default_access)) { + if ($default_access !== $current_default_access) { + if ($user->setPrivateSetting('elgg_default_access', $default_access)) { system_message(elgg_echo('user:default_access:success')); } else { register_error(elgg_echo('user:default_access:fail')); diff --git a/engine/lib/access.php b/engine/lib/access.php index b8d8820e1..39f7925c6 100644 --- a/engine/lib/access.php +++ b/engine/lib/access.php @@ -188,7 +188,7 @@ function get_default_access(ElggUser $user = null) { * Override the default behaviour and allow results to show hidden entities as well. * THIS IS A HACK. * - * TODO: Replace this with query object! + * @todo Replace this with query object! */ $ENTITY_SHOW_HIDDEN_OVERRIDE = false; @@ -216,13 +216,13 @@ function access_get_show_hidden_status() { * Returns an SQL fragment that is true (or optionally false) if the given user has * added an annotation with the given name to the given entity. * - * TODO: This is fairly generic so perhaps it could be moved to annotations.php + * @todo This is fairly generic so perhaps it could be moved to annotations.php * * @param string $annotation_name name of the annotation - * @param string $entity_guid SQL string that evaluates to the GUID of the entity the annotation should be attached to - * @param string $owner_guid SQL string that evaluates to the GUID of the owner of the annotation * - * @param boolean $exists If set to true, will return true if the annotation exists, otherwise returns false - * @return string An SQL fragment suitable for inserting into a WHERE clause + * @param string $entity_guid SQL string that evaluates to the GUID of the entity the annotation should be attached to + * @param string $owner_guid SQL string that evaluates to the GUID of the owner of the annotation * + * @param boolean $exists If set to true, will return true if the annotation exists, otherwise returns false + * @return string An SQL fragment suitable for inserting into a WHERE clause */ function get_annotation_sql($annotation_name, $entity_guid, $owner_guid, $exists) { global $CONFIG; @@ -246,7 +246,7 @@ END; /** * Add access restriction sql code to a given query. * Note that if this code is executed in privileged mode it will return blank. - * @TODO: DELETE once Query classes are fully integrated + * @todo DELETE once Query classes are fully integrated * * @param string $table_prefix Optional table. prefix for the access code. * @param int $owner @@ -734,7 +734,7 @@ function get_entities_from_access_id($collection_id, $entity_type = "", $entity_ * @param int $collection_id * @param array $options @see elgg_get_entities() * @return array - * @since 1.7 + * @since 1.7.0 */ function elgg_get_entities_from_access_id(array $options=array()) { // restrict the resultset to access collection provided @@ -785,7 +785,8 @@ function list_entities_from_access_id($collection_id, $entity_type = "", $entity * * @param $entity_accessid (int) The entity's access id * @return string e.g. Public, Private etc - **/ + * @since 1.7.0 + */ function get_readable_access_level($entity_accessid){ $access = (int) $entity_accessid; //get the access level for object in readable string @@ -804,6 +805,7 @@ function get_readable_access_level($entity_accessid){ * Set if entity access system should be ignored. * * @return bool Previous ignore_access setting. + * @since 1.7.0 */ function elgg_set_ignore_access($ignore = true) { $elgg_access = elgg_get_access_object(); @@ -814,6 +816,7 @@ function elgg_set_ignore_access($ignore = true) { * Get current ignore access setting. * * @return bool + * @since 1.7.0 */ function elgg_get_ignore_access() { return elgg_get_access_object()->get_ignore_access(); @@ -823,6 +826,7 @@ function elgg_get_ignore_access() { * Decides if the access system is being ignored. * * @return bool + * @since 1.7.0 */ function elgg_check_access_overrides($user_guid = null) { if (!$user_guid || $user_guid <= 0) { @@ -838,6 +842,7 @@ function elgg_check_access_overrides($user_guid = null) { * Returns the ElggAccess object. * * @return ElggAccess + * @since 1.7.0 */ function elgg_get_access_object() { static $elgg_access; @@ -865,6 +870,7 @@ function access_init() { * Override permissions system * * @return true|null + * @since 1.7.0 */ function elgg_override_permissions_hook($hook, $type, $returnval, $params) { $user_guid = get_loggedin_userid(); diff --git a/engine/lib/actions.php b/engine/lib/actions.php index 47c0bf7af..c7abd5f18 100644 --- a/engine/lib/actions.php +++ b/engine/lib/actions.php @@ -54,14 +54,15 @@ function action($action, $forwarder = "") { if ((isadminloggedin()) || (!$CONFIG->actions[$action]['admin'])) { if ($CONFIG->actions[$action]['public'] || get_loggedin_userid()) { - // Trigger action event TODO: This is only called before the primary action is called. We need to rethink actions for 1.5 + // Trigger action event + // @todo This is only called before the primary action is called. We need to rethink actions for 1.5 $event_result = true; $event_result = trigger_plugin_hook('action', $action, null, $event_result); // Include action // Event_result being false doesn't produce an error - // since i assume this will be handled in the hook itself. - // TODO make this better! + // @todo make this better! if ($event_result) { if (!include($CONFIG->actions[$action]['file'])) { register_error(sprintf(elgg_echo('actionundefined'),$action)); diff --git a/engine/lib/annotations.php b/engine/lib/annotations.php index c960da014..dcb29d0ab 100644 --- a/engine/lib/annotations.php +++ b/engine/lib/annotations.php @@ -450,6 +450,7 @@ $value = "", $owner_guid = 0, $limit = 10, $offset = 0, $order_by = "asc", $time * annotation_owner_guids => NULL|ARR guids for annotaiton owners * * @return array + * @since 1.7.0 */ function elgg_get_entities_from_annotations(array $options = array()) { $defaults = array( diff --git a/engine/lib/api.php b/engine/lib/api.php index a3869d262..823774108 100644 --- a/engine/lib/api.php +++ b/engine/lib/api.php @@ -389,6 +389,7 @@ function expose_function($method, $function, array $parameters = NULL, $descript /** * Unregister an API method * @param string $method The api name that was exposed + * @since 1.7.0 */ function unexpose_function($method) { global $API_METHODS; @@ -403,6 +404,7 @@ function unexpose_function($method) { * @param string $method The api name that was exposed * @return true or throws an exception * @throws APIException + * @since 1.7.0 */ function authenticate_method($method) { global $API_METHODS; @@ -557,6 +559,7 @@ function get_post_data() { /** * This fixes the post parameters that are munged due to page handler + * @since 1.7.0 */ function include_post_data() { @@ -578,6 +581,7 @@ function include_post_data() { * @param $parameters * @return true on success or exception * @throws APIException + * @since 1.7.0 */ function verify_parameters($method, $parameters) { global $API_METHODS; @@ -610,6 +614,7 @@ function verify_parameters($method, $parameters) { * @param array $parameters Array of parameters * @return string or exception * @throws APIException + * @since 1.7.0 */ function serialise_parameters($method, $parameters) { global $API_METHODS; @@ -688,6 +693,7 @@ function serialise_parameters($method, $parameters) { * PAM: Confirm that the call includes a valid API key * @return true if good API key - otherwise throws exception * @throws APIException + * @since 1.7.0 */ function api_auth_key() { global $CONFIG; @@ -715,6 +721,7 @@ function api_auth_key() { * PAM: Confirm the HMAC signature * @return true if success - otherwise throws exception * @throws SecurityException + * @since 1.7.0 */ function api_auth_hmac() { global $CONFIG; @@ -850,7 +857,7 @@ function get_and_validate_api_headers() { function map_api_hash($algo) { $algo = strtolower(sanitise_string($algo)); $supported_algos = array( - "md5" => "md5", // TODO: Consider phasing this out + "md5" => "md5", // @todo Consider phasing this out "sha" => "sha1", // alias for sha1 "sha1" => "sha1", "sha256" => "sha256" @@ -897,7 +904,7 @@ function calculate_hmac($algo, $time, $nonce, $api_key, $secret_key, $get_variab /** * Calculate a hash for some post data. * - * TODO: Work out how to handle really large bits of data. + * @todo Work out how to handle really large bits of data. * * @param string $postdata string The post data. * @param string $algo The algorithm used. @@ -1094,6 +1101,7 @@ function create_user_token($username, $expire = 60) { * @param int $site_guid The ID of the site (default is current site) * @return false if none available or array of stdClass objects * (see users_apisessions schema for available variables in objects) + * @since 1.7.0 */ function get_user_tokens($user_guid, $site_guid) { global $CONFIG; @@ -1149,6 +1157,7 @@ function validate_user_token($token, $site_guid) { * @param string $token * @param int $site_guid The ID of the site (default is current site) * @return bool + * @since 1.7.0 */ function remove_user_token($token, $site_guid) { global $CONFIG; @@ -1168,6 +1177,7 @@ function remove_user_token($token, $site_guid) { * Remove expired tokens * * @return bool + * @since 1.7.0 */ function remove_expired_user_tokens() { global $CONFIG; @@ -1474,6 +1484,7 @@ function service_handler($handler, $request) { * @param string $handler web services type * @param string $function Your function name * @return true|false Depending on success + * @since 1.7.0 */ function register_service_handler($handler, $function) { global $CONFIG; @@ -1494,6 +1505,7 @@ function register_service_handler($handler, $function) { * with register_service_handler(). * * @param string $handler web services type + * @return 1.7.0 */ function unregister_service_handler($handler) { global $CONFIG; diff --git a/engine/lib/cache.php b/engine/lib/cache.php index df7b1e525..e227ba770 100644 --- a/engine/lib/cache.php +++ b/engine/lib/cache.php @@ -332,7 +332,7 @@ class ElggFileCache extends ElggCache { * @param string $filename */ protected function sanitise_filename($filename) { - // TODO : Writeme + // @todo : Writeme return $filename; } @@ -397,11 +397,11 @@ class ElggFileCache extends ElggCache { } public function clear() { - // TODO : writeme + // @todo writeme } public function __destruct() { - // TODO: Check size and age, clean up accordingly + // @todo Check size and age, clean up accordingly $size = 0; $dir = $this->get_variable("cache_path"); @@ -430,7 +430,7 @@ class ElggFileCache extends ElggCache { unlink($dir.$f); } - // TODO: Size + // @todo Size } } } diff --git a/engine/lib/database.php b/engine/lib/database.php index c8945e2d1..798f3ef59 100644 --- a/engine/lib/database.php +++ b/engine/lib/database.php @@ -577,7 +577,7 @@ function db_upgrade($version, $fromdir = "", $quiet = FALSE) { * This function, called by validate_platform(), will check whether the installed version of * MySQL meets the minimum required. * - * TODO: If multiple dbs are supported check which db is supported and use the appropriate code to validate + * @todo If multiple dbs are supported check which db is supported and use the appropriate code to validate * the appropriate version. * * @return bool diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index 1d52c0534..9a09d4f72 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -85,8 +85,8 @@ function current_page_url() { /** * This is a factory function which produces an ElggCache object suitable for caching file load paths. * - * TODO: Can this be done in a cleaner way? - * TODO: Swap to memcache etc? + * @todo Can this be done in a cleaner way? + * @todo Swap to memcache etc? */ function elgg_get_filepath_cache() { global $CONFIG; @@ -654,6 +654,7 @@ function add_to_register($register_name, $subregister_name, $subregister_value, * @param string $register_name The name of the top-level register * @param string $subregister_name The name of the subregister * @return true|false Depending on success + * @since 1.7.0 */ function remove_from_register($register_name, $subregister_name) { global $CONFIG; @@ -963,6 +964,7 @@ function register_elgg_event_handler($event, $object_type, $function, $priority * @param string $event The event type * @param string $object_type The object type * @param string $function The function name + * @since 1.7.0 */ function unregister_elgg_event_handler($event, $object_type, $function) { global $CONFIG; @@ -1046,6 +1048,7 @@ function register_plugin_hook($hook, $type, $function, $priority = 500) { * @param string $hook The name of the hook * @param string $entity_type The name of the type of entity (eg "user", "object" etc) * @param string $function The name of a valid function to be run + * @since 1.7.0 */ function unregister_plugin_hook($hook, $entity_type, $function) { global $CONFIG; @@ -1130,7 +1133,7 @@ function __elgg_php_error_handler($errno, $errmsg, $filename, $linenum, $vars) { switch ($errno) { case E_USER_ERROR: - error_log("ERROR: $error"); + error_log("PHP ERROR: $error"); register_error("ERROR: $error"); // Since this is a fatal error, we want to stop any further execution but do so gracefully. @@ -1139,13 +1142,13 @@ function __elgg_php_error_handler($errno, $errmsg, $filename, $linenum, $vars) { case E_WARNING : case E_USER_WARNING : - error_log("WARNING: $error"); + error_log("PHP WARNING: $error"); break; default: global $CONFIG; if (isset($CONFIG->debug) && $CONFIG->debug === 'NOTICE') { - error_log("NOTICE: $error"); + error_log("PHP NOTICE: $error"); } } @@ -1164,6 +1167,7 @@ function __elgg_php_error_handler($errno, $errmsg, $filename, $linenum, $vars) { * @param str $message User message * @param str $level NOTICE | WARNING | ERROR | DEBUG * @return bool + * @since 1.7.0 */ function elgg_log($message, $level='NOTICE') { global $CONFIG; @@ -1211,6 +1215,7 @@ function elgg_log($message, $level='NOTICE') { * @param bool $to_screen * @param string $level * @return void + * @since 1.7.0 */ function elgg_dump($value, $to_screen = TRUE, $level = 'NOTICE') { global $CONFIG; @@ -1394,6 +1399,7 @@ function run_function_once($functionname, $timelastupdatedcheck = 0) { * @param str $version human-readable *release* version the function was deprecated. No bloody A, B, (R)C, or D. * * @return bool + * @since 1.7.0 */ function elgg_deprecated_notice($msg, $dep_version) { // if it's a major release behind, visual and logged @@ -1620,6 +1626,7 @@ function is_not_null($string) { * @param $options * @param $singulars * @return array + * @since 1.7.0 */ function elgg_normalise_plural_options_array($options, $singulars) { foreach ($singulars as $singular) { @@ -1659,7 +1666,7 @@ function full_url() { * Useful function found in the comments on the PHP man page for ip2long. * Returns 1 if an IP matches a given range. * - * TODO: Check licence... assuming this is PD since it was found several places on the interwebs.. + * @todo Check licence... assuming this is PD since it was found several places on the interwebs.. * please check or rewrite. * * Matches: @@ -1832,7 +1839,7 @@ interface Friendable { * @param array $parts Associative array of URL components like parse_url() returns * @param bool $htmlencode HTML Encode the url? * @return str Full URL - * @since 1.7 + * @since 1.7.0 */ function elgg_http_build_url(array $parts, $html_encode = TRUE) { // build only what's given to us. @@ -1858,7 +1865,7 @@ function elgg_http_build_url(array $parts, $html_encode = TRUE) { * @param str $link Full action URL * @param bool $htmlencode html encode the url? * @return str URL with action tokens - * @since 1.7 + * @since 1.7.0 */ function elgg_add_action_tokens_to_url($url, $html_encode = TRUE) { $components = parse_url($url); @@ -1897,6 +1904,7 @@ function elgg_validate_action_url($url) { * @param string $url * @param string $element * @return string + * @since 1.7.0 */ function elgg_http_remove_url_query_element($url, $element) { $url_array = parse_url($url); @@ -1924,6 +1932,7 @@ function elgg_http_remove_url_query_element($url, $element) { * @param str $url * @param array $elements k/v pairs. * @return str + * @since 1.7.0 */ function elgg_http_add_url_query_elements($url, array $elements) { $url_array = parse_url($url); @@ -2100,7 +2109,7 @@ function elgg_set_active_sticky_form($form_name) { * * @param str $setting * @return int - * @since 1.7 + * @since 1.7.0 * @link http://www.php.net/manual/en/function.ini-get.php */ function elgg_get_ini_setting_in_bytes($setting) { @@ -2416,7 +2425,7 @@ define('ACCESS_PUBLIC', 2); define('ACCESS_FRIENDS', -2); /** - * @since 1.7 + * @since 1.7.0 */ define('ELGG_ENTITIES_ANY_VALUE', NULL); define('ELGG_ENTITIES_NO_VALUE', 0); diff --git a/engine/lib/entities.php b/engine/lib/entities.php index e6c2baa8e..9b3895fd5 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -15,7 +15,8 @@ $ENTITY_CACHE = NULL; /// Cache subtype searches $SUBTYPE_CACHE = NULL; -/// Require the locatable interface TODO: Move this into start.php? +/// Require the locatable interface +// @todo Move this into start.php? require_once('location.php'); /** @@ -781,7 +782,8 @@ abstract class ElggEntity implements throw new IOException(elgg_echo('IOException:BaseEntitySaveFailed')); } - // Save any unsaved metadata TODO: How to capture extra information (access id etc) + // Save any unsaved metadata + // @todo How to capture extra information (access id etc) if (sizeof($this->temp_metadata) > 0) { foreach($this->temp_metadata as $name => $value) { $this->$name = $value; @@ -789,7 +791,8 @@ abstract class ElggEntity implements } } - // Save any unsaved annotations metadata. TODO: How to capture extra information (access id etc) + // Save any unsaved annotations metadata. + // @todo How to capture extra information (access id etc) if (sizeof($this->temp_annotations) > 0) { foreach($this->temp_annotations as $name => $value) { $this->annotate($name, $value); @@ -1233,7 +1236,7 @@ function initialise_entity_cache() { global $ENTITY_CACHE; if (!$ENTITY_CACHE) { - //select_default_memcache('entity_cache'); // TODO: Replace with memcache? + //select_default_memcache('entity_cache'); // @todo Replace with memcache? $ENTITY_CACHE = array(); } } @@ -1306,7 +1309,7 @@ function retrieve_cached_entity_row($guid) { /** * Return the integer ID for a given subtype, or false. * - * TODO: Move to a nicer place? + * @todo Move to a nicer place? * * @param string $type * @param string $subtype @@ -1342,7 +1345,7 @@ function get_subtype_id($type, $subtype) { /** * For a given subtype ID, return its identifier text. * - * TODO: Move to a nicer place? + * @todo Move to a nicer place? * * @param int $subtype_id */ @@ -1791,6 +1794,7 @@ function get_entity($guid) { * * @return if count, int * if not count, array or false if no entities + * @since 1.7.0 */ function elgg_get_entities(array $options = array()) { global $CONFIG; @@ -2026,6 +2030,7 @@ $count = false, $site_guid = 0, $container_guid = null, $timelower = 0, $timeupp * @param NULL|array $subtypes * @param NULL|array $pairs * @return FALSE|string + * @since 1.7.0 */ function elgg_get_entity_type_subtype_where_sql($table, $types, $subtypes, $pairs) { // subtype depends upon type. @@ -2179,6 +2184,7 @@ function elgg_get_entity_type_subtype_where_sql($table, $types, $subtypes, $pair * @param str $table * @param NULL|array $owner_guids * @return FALSE|str + * @since 1.7.0 */ function elgg_get_entity_owner_where_sql($table, $owner_guids) { // short circuit if nothing requested @@ -2216,6 +2222,7 @@ function elgg_get_entity_owner_where_sql($table, $owner_guids) { * @param string $table entity table prefix * @param NULL|array $container_guids * @return FALSE|string + * @since 1.7.0 */ function elgg_get_entity_container_where_sql($table, $container_guids) { // short circuit if nothing is requested. @@ -2257,6 +2264,7 @@ function elgg_get_entity_container_where_sql($table, $container_guids) { * @param NULL|int $time_updated_lower * * @return FALSE|str FALSE on fail, string on success. + * @since 1.7.0 */ function elgg_get_entity_time_where_sql($table, $time_created_upper = NULL, $time_created_lower = NULL, $time_updated_upper = NULL, $time_updated_lower = NULL) { @@ -2294,6 +2302,7 @@ function elgg_get_entity_time_where_sql($table, $time_created_upper = NULL, $tim * @param string $table entity table name * @param NULL|array $site_guids * @return FALSE|string + * @since 1.7.0 */ function elgg_get_entity_site_where_sql($table, $site_guids) { // short circuit if nothing requested @@ -2334,6 +2343,7 @@ function elgg_get_entity_site_where_sql($table, $site_guids) { * pagination => BOOL Display pagination links * * @return str + * @since 1.7.0 */ function elgg_list_entities($options) { $defaults = array( @@ -2526,7 +2536,8 @@ function disable_entity($guid, $reason = "", $recursive = true) { } if ($recursive) { - // Temporary token overriding access controls TODO: Do this better. + // Temporary token overriding access controls + // @todo Do this better. static $__RECURSIVE_DELETE_TOKEN; // Make it slightly harder to guess $__RECURSIVE_DELETE_TOKEN = md5(get_loggedin_userid()); @@ -2612,7 +2623,8 @@ function delete_entity($guid, $recursive = true) { // Delete contained owned and otherwise releated objects (depth first) if ($recursive) { - // Temporary token overriding access controls TODO: Do this better. + // Temporary token overriding access controls + // @todo Do this better. static $__RECURSIVE_DELETE_TOKEN; // Make it slightly harder to guess $__RECURSIVE_DELETE_TOKEN = md5(get_loggedin_userid()); @@ -3245,6 +3257,7 @@ function list_registered_entities($owner_guid = 0, $limit = 10, $fullview = true * pagination => BOOL Display pagination links * * @return string A viewable list of entities + * @since 1.7.0 */ function elgg_list_registered_entities($options) { $defaults = array( @@ -3778,7 +3791,7 @@ function entities_init() { register_plugin_hook('unit_test', 'system', 'entities_test'); // Allow a permission override for recursive entity deletion - // TODO: Can this be done better? + // @todo Can this be done better? register_plugin_hook('permissions_check','all','recursive_delete_permissions_check'); register_plugin_hook('permissions_check:metadata','all','recursive_delete_permissions_check'); diff --git a/engine/lib/extender.php b/engine/lib/extender.php index cbcdd6eb7..7b54a7842 100644 --- a/engine/lib/extender.php +++ b/engine/lib/extender.php @@ -87,6 +87,7 @@ abstract class ElggExtender implements * Return the owner entity * * @return mixed + * @since 1.7.0 */ public function getOwnerEntity() { return get_user($this->owner_guid); @@ -263,7 +264,7 @@ abstract class ElggExtender implements * Detect the value_type for a given value. * Currently this is very crude. * - * TODO: Make better! + * @todo Make better! * * @param mixed $value * @param string $value_type If specified, overrides the detection. diff --git a/engine/lib/filestore.php b/engine/lib/filestore.php index 0a30f5551..31fc9ab0d 100644 --- a/engine/lib/filestore.php +++ b/engine/lib/filestore.php @@ -471,7 +471,7 @@ class ElggFile extends ElggObject { return $this->mimetype; } - // TODO : Guess mimetype if not here + // @todo Guess mimetype if not here } /** @@ -648,7 +648,8 @@ class ElggFile extends ElggObject { return $this->filestore; } - // If filestore meta set then retrieve filestore TODO: Better way of doing this? + // If filestore meta set then retrieve filestore + // @todo Better way of doing this? $metas = get_metadata_for_entity($this->guid); $parameters = array(); if (is_array($metas)) { diff --git a/engine/lib/group.php b/engine/lib/group.php index 474baf609..ab6c9112d 100644 --- a/engine/lib/group.php +++ b/engine/lib/group.php @@ -857,8 +857,7 @@ function group_gatekeeper($forward = true) { * @param string $label Used for the group edit form * @param boolean $default_on True if this option should be active by default * - **/ - + */ function add_group_tool_option($name,$label,$default_on=true) { global $CONFIG; diff --git a/engine/lib/install.php b/engine/lib/install.php index e2b0c5251..42df3e17f 100644 --- a/engine/lib/install.php +++ b/engine/lib/install.php @@ -40,7 +40,7 @@ function validate_platform() { throw new ConfigurationException(elgg_echo('ConfigurationException:BadPHPVersion')); } - // TODO: Consider checking for installed modules etc + // @todo Consider checking for installed modules etc return true; } @@ -52,6 +52,7 @@ function validate_platform() { * @param string $dbname * @param string $host * @return bool + * @since 1.7.1 */ function db_check_settings($user, $password, $dbname, $host) { $mysql_dblink = mysql_connect($host, $user, $password, true); diff --git a/engine/lib/languages.php b/engine/lib/languages.php index 98283f141..d20fa6a44 100644 --- a/engine/lib/languages.php +++ b/engine/lib/languages.php @@ -147,7 +147,7 @@ function register_translations($path, $load_all = false) { * This is only called by functions which need to know all possible translations, namely the * statistic gathering ones. * - * TODO: Better on demand loading based on language_paths array + * @todo Better on demand loading based on language_paths array * * @return bool */ diff --git a/engine/lib/location.php b/engine/lib/location.php index 21ee7d5fa..7b96f4a91 100644 --- a/engine/lib/location.php +++ b/engine/lib/location.php @@ -277,6 +277,6 @@ function list_entities_in_area($lat, $long, $radius, $type= "", $subtype = "", $ define("MILE", 0.01515); define("KILOMETER", 0.00932); -// TODO: get objects within x miles by entities, metadata and relationship +// @todo get objects within x miles by entities, metadata and relationship -// TODO: List
\ No newline at end of file +// @todo List
\ No newline at end of file diff --git a/engine/lib/mb_wrapper.php b/engine/lib/mb_wrapper.php index 9aa4aac4c..ce70addc1 100644 --- a/engine/lib/mb_wrapper.php +++ b/engine/lib/mb_wrapper.php @@ -13,6 +13,7 @@ if (is_callable('mb_internal_encoding')) { * * @param str $str * @return array + * @since 1.7.0 */ function elgg_parse_str($str) { if (is_callable('mb_parse_str')) { @@ -64,4 +65,4 @@ foreach ($str_funcs as $func) { eval($eval_statement); -// TODO: Other wrapper functions
\ No newline at end of file +// @todo Other wrapper functions
\ No newline at end of file diff --git a/engine/lib/memcache.php b/engine/lib/memcache.php index ed93cacf0..1a428dac5 100644 --- a/engine/lib/memcache.php +++ b/engine/lib/memcache.php @@ -157,7 +157,7 @@ class ElggMemcache extends ElggSharedMemoryCache { // DISABLE clearing for now - you must use delete on a specific key. return true; - //TODO: Namespaces as in #532 + // @todo Namespaces as in #532 } } diff --git a/engine/lib/metadata.php b/engine/lib/metadata.php index a07b0958d..66fa78401 100644 --- a/engine/lib/metadata.php +++ b/engine/lib/metadata.php @@ -572,6 +572,7 @@ function find_metadata($meta_name = "", $meta_value = "", $entity_type = "", $en * metadata_owner_guids => NULL|ARR guids for metadata owners * * @return array + * @since 1.7.0 */ function elgg_get_entities_from_metadata(array $options = array()) { $defaults = array( @@ -605,6 +606,7 @@ function elgg_get_entities_from_metadata(array $options = array()) { * @param array $options Options * * @return array + * @since 1.7.0 */ function elgg_entities_get_metastrings_options($type, $options) { $valid_types = array('metadata', 'annotation'); @@ -672,6 +674,7 @@ function elgg_entities_get_metastrings_options($type, $options) { * @param BOOL $case_sensitive * @param ARR|NULL $order_by_metadata array of names / direction * @return FALSE|array False on fail, array('joins', 'wheres') + * @since 1.7.0 */ function elgg_get_entity_metadata_where_sql($e_table, $n_table, $names = NULL, $values = NULL, $pairs = NULL, $pair_operator = 'AND', $case_sensitive = TRUE, $order_by_metadata = NULL, $owner_guids = NULL) { global $CONFIG; @@ -1018,6 +1021,7 @@ function list_entities_from_metadata($meta_name, $meta_value = "", $entity_type * @see elgg_get_entities_from_metadata * * @param array $options + * @since 1.7.0 */ function elgg_list_entities_from_metadata($options) { $defaults = array( diff --git a/engine/lib/notification.php b/engine/lib/notification.php index 5ab9626c3..475a590ec 100644 --- a/engine/lib/notification.php +++ b/engine/lib/notification.php @@ -54,6 +54,7 @@ function register_notification_handler($method, $handler, $params = NULL) { * This function unregisters a handler for a given notification type (eg "email") * * @param string $method The method + * @since 1.7.1 */ function unregister_notification_handler($method) { global $NOTIFICATION_HANDLERS; @@ -271,6 +272,7 @@ function email_notify_handler(ElggEntity $from, ElggUser $to, $subject, $message * @param string $body The message body * @param array $params Optional parameters (none used in this function) * @return bool + * @since 1.7.2 */ function elgg_send_email($from, $to, $subject, $body, array $params = NULL) { global $CONFIG; diff --git a/engine/lib/objects.php b/engine/lib/objects.php index 6023a4805..63376c72d 100644 --- a/engine/lib/objects.php +++ b/engine/lib/objects.php @@ -272,7 +272,7 @@ function create_object_entity($guid, $title, $description) { * THIS FUNCTION IS DEPRECATED. * * Delete a object's extra data. - * + * @todo - this should be removed - was deprecated in 1.5 or earlier * @param int $guid */ function delete_object_entity($guid) { diff --git a/engine/lib/pam.php b/engine/lib/pam.php index 590ef9fde..5dbb0e1ab 100644 --- a/engine/lib/pam.php +++ b/engine/lib/pam.php @@ -57,6 +57,7 @@ function register_pam_handler($handler, $importance = "sufficient", $policy = "u * * @param string $handler The PAM handler function name * @param string $policy - the policy type, default is "user" + * @since 1.7.0 */ function unregister_pam_handler($handler, $policy = "user") { global $_PAM_HANDLERS; diff --git a/engine/lib/plugins.php b/engine/lib/plugins.php index 66b22a0aa..47a103dcd 100644 --- a/engine/lib/plugins.php +++ b/engine/lib/plugins.php @@ -622,6 +622,7 @@ function clear_plugin_setting($name, $plugin_name = "") { * Clear all plugin settings. * * @param string $plugin_name Optional plugin name, if not specified then it is detected from where you are calling from. + * @since 1.7.0 */ function clear_all_plugin_settings($plugin_name = "") { $plugin = find_plugin_settings($plugin_name); diff --git a/engine/lib/query.php b/engine/lib/query.php index 619a2d288..bdb28559f 100644 --- a/engine/lib/query.php +++ b/engine/lib/query.php @@ -183,7 +183,7 @@ // Note: currently get_access_sql_suffix is hardwired to use // $acl_field = "access_id", $object_owner_table = $acl_table, and // $object_owner_id_field = "owner_guid" - // TODO: recode get_access_sql_suffix to make it possible to specify alternate field names + // @todo recode get_access_sql_suffix to make it possible to specify alternate field names return "and ".get_access_sql_suffix($this->acl_table); // Add access controls //return "and ({$this->acl_table}.{$this->acl_field} in {$access} or ({$this->acl_table}.{$this->acl_field} = 0 and {$this->object_owner_table}.{$this->object_owner_id_field} = {$_SESSION['id']}))"; diff --git a/engine/lib/relationships.php b/engine/lib/relationships.php index bf55a8932..dd8a2b188 100644 --- a/engine/lib/relationships.php +++ b/engine/lib/relationships.php @@ -502,6 +502,7 @@ function get_entity_relationships($guid, $inverse_relationship = FALSE) { * inverse_relationship => BOOL Inverse the relationship * * @return array + * @since 1.7.0 */ function elgg_get_entities_from_relationship($options) { $defaults = array( @@ -547,6 +548,7 @@ function elgg_get_entities_from_relationship($options) { * @param $relationship relationship string * @param $entity_guid entity guid to check * @return mixed + * @since 1.7.0 */ function elgg_get_entity_relationship_where_sql($table, $relationship = NULL, $relationship_guid = NULL, $inverse_relationship = FALSE) { if ($relationship == NULL && $entity_guid == NULL) { diff --git a/engine/lib/river.php b/engine/lib/river.php index 74e7322e8..09799aa59 100644 --- a/engine/lib/river.php +++ b/engine/lib/river.php @@ -106,6 +106,7 @@ function remove_from_river_by_object($object_guid) { * * @param int annotation_id The ID of the annotation * @return true|false Depending on success + * @since 1.7.0 */ function remove_from_river_by_annotation($annotation_id) { // Sanitise diff --git a/engine/lib/sessions.php b/engine/lib/sessions.php index b74b2f524..428a521a2 100644 --- a/engine/lib/sessions.php +++ b/engine/lib/sessions.php @@ -186,6 +186,7 @@ function isadminloggedin() { * * @param $user_guid * @return bool + * @since 1.7.1 */ function elgg_is_admin_user($user_guid) { global $CONFIG; diff --git a/engine/lib/sites.php b/engine/lib/sites.php index d67a540cc..23a922757 100644 --- a/engine/lib/sites.php +++ b/engine/lib/sites.php @@ -375,7 +375,7 @@ function create_site_entity($guid, $name, $description, $url) { * THIS FUNCTION IS DEPRECATED. * * Delete a site's extra data. - * + * @todo remove * @param int $guid */ function delete_site_entity($guid) { diff --git a/engine/lib/tags.php b/engine/lib/tags.php index 1d2b552ad..e73444930 100644 --- a/engine/lib/tags.php +++ b/engine/lib/tags.php @@ -73,7 +73,6 @@ function generate_tag_cloud(array $tags, $buckets = 6) { * * Supports similar arguments as elgg_get_entities() * - * @since 1.7.1 * * @param array $options Array in format: * @@ -109,6 +108,7 @@ function generate_tag_cloud(array $tags, $buckets = 6) { * * @return false/array - if no tags or error, false * otherwise, array of objects with ->tag and ->total values + * @since 1.7.1 */ function elgg_get_tags(array $options = array()) { global $CONFIG; @@ -306,7 +306,6 @@ function get_tags($threshold = 1, $limit = 10, $metadata_name = "", $entity_type /** * Returns viewable tagcloud * - * @since 1.7.1 * * @see elgg_get_tags * @@ -317,7 +316,7 @@ function get_tags($threshold = 1, $limit = 10, $metadata_name = "", $entity_type * subtype => must be single entity subtype * * @return string - * + * @since 1.7.1 */ function elgg_view_tagcloud(array $options = array()) { @@ -370,10 +369,10 @@ function display_tagcloud($threshold = 1, $limit = 10, $metadata_name = "", $ent * This is required if you are using a non-standard metadata name * for your tags. * - * @since 1.7 * * @param string $name - * @return TRUE + * @return bool + * @since 1.7.0 */ function elgg_register_tag_metadata_name($name) { global $CONFIG; @@ -392,9 +391,8 @@ function elgg_register_tag_metadata_name($name) { /** * Returns an array of valid metadata names for tags. * - * @since 1.7 - * * @return array + * @since 1.7.0 */ function elgg_get_registered_tag_metadata_names() { global $CONFIG; diff --git a/engine/lib/users.php b/engine/lib/users.php index 99ef15246..3722c8ed1 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -682,7 +682,7 @@ function remove_user_admin($user_guid) { * THIS FUNCTION IS DEPRECATED. * * Delete a user's extra data. - * + * @todo remove * @param int $guid */ function delete_user_entity($guid) { @@ -1362,7 +1362,7 @@ function request_user_validation($user_guid) { * @return bool */ function is_email_address($address) { - // TODO: Make this better! + // @todo Make this better! if (strpos($address, '@')=== false) { return false; @@ -1434,7 +1434,8 @@ function validate_username($username) { throw new RegistrationException(elgg_echo('registration:invalidchars')); } - // Belts and braces TODO: Tidy into main unicode + // Belts and braces + // @todo Tidy into main unicode $blacklist2 = '\'/\\"*& ?#%^(){}[]~?<>;|¬`@-+='; for ($n=0; $n < strlen($blacklist2); $n++) { if (strpos($username, $blacklist2[$n])!==false) { @@ -1718,7 +1719,7 @@ function set_last_login($user_guid) { * A permissions plugin hook that grants access to users if they are newly created - allows * for email activation. * - * TODO: Do this in a better way! + * @todo Do this in a better way! * * @param unknown_type $hook * @param unknown_type $entity_type @@ -1839,7 +1840,7 @@ function users_init() { register_elgg_event_handler('create', 'user', 'user_create_hook_add_site_relationship'); // Handle a special case for newly created users when the user is not logged in - // TODO: handle this better! + // @todo handle this better! register_plugin_hook('permissions_check','all','new_user_enable_permissions_check'); } diff --git a/engine/lib/views.php b/engine/lib/views.php index 76d2a57da..ceaced80c 100644 --- a/engine/lib/views.php +++ b/engine/lib/views.php @@ -451,7 +451,7 @@ function elgg_view_disable_simplecache() { * @param string $dir * @param string $base * @return array - * @since 1.7 + * @since 1.7.0 */ function elgg_get_views($dir, $base) { $return = array(); @@ -886,6 +886,7 @@ function set_template_handler($function_name) { * @param string $view_extension 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 + * @since 1.7.0 */ function elgg_extend_view($view, $view_extension, $priority = 501, $viewtype = '') { global $CONFIG; @@ -990,6 +991,7 @@ function set_view_location($view, $location, $viewtype = '') { * @param string $folder The folder to begin looking in * @param string $base_location_path The base views directory to use with set_view_location * @param string $viewtype The type of view we're looking at (default, rss, etc) + * @since 1.7.0 */ function autoregister_views($view_base, $folder, $base_location_path, $viewtype) { if (!isset($i)) { @@ -1071,6 +1073,7 @@ function page_draw($title, $body, $page_shell = 'page_shells/default', $vars = a * * @param string $view_type * @return bool + * @since 1.7.2 */ function elgg_is_valid_view_type($view_type) { global $CONFIG; diff --git a/engine/lib/widgets.php b/engine/lib/widgets.php index 1862ef7e4..03524da62 100644 --- a/engine/lib/widgets.php +++ b/engine/lib/widgets.php @@ -284,6 +284,7 @@ function add_widget_type($handler, $name, $description, $context = "all", $multi * Remove a widget type * * @param string $handler The identifier for the widget handler + * @since 1.7.1 */ function remove_widget_type($handler) { global $CONFIG; @@ -378,7 +379,7 @@ function save_widget_info($widget_guid, $params) { 'guid','owner_guid','site_guid' ))) { if (is_array($value)) { - // TODO: Handle arrays securely + // @todo Handle arrays securely $widget->setMetaData($name, $value, "", true); } else { $widget->$name = $value; diff --git a/engine/lib/xml-rpc.php b/engine/lib/xml-rpc.php index 7c369edc1..110dd76dd 100644 --- a/engine/lib/xml-rpc.php +++ b/engine/lib/xml-rpc.php @@ -458,7 +458,7 @@ case 'value': return xmlrpc_scalar_value($object->children[0]); default: - // TODO unsupported, throw an error + // @todo unsupported, throw an error return false; } } diff --git a/languages/en.php b/languages/en.php index 743ac6eaf..f70a87074 100644 --- a/languages/en.php +++ b/languages/en.php @@ -285,10 +285,6 @@ To remove a widget drag it back to the <b>Widget gallery</b>.", 'friends:of:owned' => "People who have made %s a friend", - 'friends:num_display' => "Number of friends to display", - 'friends:icon_size' => "Icon size", - 'friends:tiny' => "tiny", - 'friends:small' => "small", 'friends:of' => "Friends of", 'friends:collections' => "Collections of friends", 'friends:collections:add' => "New friends collection", @@ -304,9 +300,6 @@ To remove a widget drag it back to the <b>Widget gallery</b>.", 'friends:collections:members' => "Collection members", 'friends:collections:edit' => "Edit collection", - 'friends:river:created' => "%s added the friends widget.", - 'friends:river:updated' => "%s updated their friends widget.", - 'friends:river:delete' => "%s removed their friends widget.", 'friends:river:add' => "%s is now a friend with", 'friendspicker:chararray' => 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', diff --git a/mod/friends/add.php b/mod/friends/add.php deleted file mode 100644 index aec720811..000000000 --- a/mod/friends/add.php +++ /dev/null @@ -1,29 +0,0 @@ -<?php - - /** - * Elgg add a collection of friends - * - * @package ElggFriends - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd <info@elgg.com> - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.org/ - */ - - // Start engine - require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); - - // You need to be logged in for this one - gatekeeper(); - - $area1 = elgg_view_title(elgg_echo('friends:new')); - - $area2 = elgg_view('friends/forms/edit', array('friends' => get_user_friends($_SESSION['user']->getGUID(),"",9999))); - - // Format page - $body = elgg_view_layout('two_column_left_sidebar',$area1, $area2); - - // Draw it - page_draw(elgg_echo('friends:add'),$body); - -?>
\ No newline at end of file diff --git a/mod/friends/collections.php b/mod/friends/collections.php deleted file mode 100644 index f80eea55c..000000000 --- a/mod/friends/collections.php +++ /dev/null @@ -1,29 +0,0 @@ -<?php - - /** - * Elgg collections of friends - * - * @package ElggFriends - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd <info@elgg.com> - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.org/ - */ - - // Start engine - require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); - - // You need to be logged in for this one - gatekeeper(); - - $area1 = elgg_view_title(elgg_echo('friends:new')); - - $area2 = elgg_view_access_collections($_SESSION['user']->getGUID()); - - // Format page - $body = elgg_view_layout('two_column_left_sidebar',$area1, $area2); - - // Draw it - page_draw(elgg_echo('friends:add'),$body); - -?>
\ No newline at end of file diff --git a/mod/friends/edit.php b/mod/friends/edit.php deleted file mode 100644 index 6be47f4d1..000000000 --- a/mod/friends/edit.php +++ /dev/null @@ -1,38 +0,0 @@ -<?php - - /** - * Elgg add a collection of friends - * - * @package ElggFriends - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd <info@elgg.com> - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.org/ - */ - - // Start engine - require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); - - // You need to be logged in for this one - gatekeeper(); - - //set the title - $area1 = elgg_view_title(elgg_echo('friends:collectionedit'), false); - - //grab the collection id passed to the edit form - $collection_id = get_input('collection'); - - //get the full collection - $collection = get_access_collection($collection_id); - //get all members of the collection - $collection_members = get_members_of_access_collection($collection_id); - - $area2 = elgg_view('friends/forms/edit', array('collection' => $collection, 'collection_members' => $collection_members)); - - // Format page - $body = elgg_view_layout('two_column_left_sidebar',$area1. $area2); - - // Draw it - page_draw(elgg_echo('friends:add'),$body); - -?>
\ No newline at end of file diff --git a/mod/friends/languages/en.php b/mod/friends/languages/en.php index aa0945656..1d09cfca6 100644 --- a/mod/friends/languages/en.php +++ b/mod/friends/languages/en.php @@ -1,15 +1,15 @@ <?php - $english = array( - - /** - * Friends widget - */ - 'friends:widget:description' => "Displays some of your friends.", - - - ); - - add_translation("en",$english); +$english = array( -?>
\ No newline at end of file + /** + * Friends widget + */ + 'friends:widget:description' => "Displays some of your friends.", + 'friends:num_display' => "Number of friends to display", + 'friends:icon_size' => "Icon size", + 'friends:tiny' => "tiny", + 'friends:small' => "small", +); + +add_translation("en", $english); diff --git a/mod/friends/start.php b/mod/friends/start.php index 631b54c1d..c0729ac90 100644 --- a/mod/friends/start.php +++ b/mod/friends/start.php @@ -1,26 +1,18 @@ <?php - /** - * Elgg Friends widget - * This plugin allows users to put a list of their friends, on their profile - * - * @package ElggFriends - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd <info@elgg.com> - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - */ - - function friends_init() { - - // Load system configuration - global $CONFIG; - - //add a widget - add_widget_type('friends',elgg_echo("friends"),elgg_echo('friends:widget:description')); - - } - - register_elgg_event_handler('init','system','friends_init'); - -?>
\ No newline at end of file +/** + * Elgg Friends widget + * This plugin allows users to put a list of their friends on their profile + * + * @package ElggFriends + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider Ltd <info@elgg.com> + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.com/ + */ + +function friends_init() { + add_widget_type('friends', elgg_echo("friends"), elgg_echo('friends:widget:description')); +} + +register_elgg_event_handler('init', 'system', 'friends_init'); diff --git a/mod/friends/views/default/widgets/friends/edit.php b/mod/friends/views/default/widgets/friends/edit.php index 0d9d44136..50c44af3c 100644 --- a/mod/friends/views/default/widgets/friends/edit.php +++ b/mod/friends/views/default/widgets/friends/edit.php @@ -1,44 +1,61 @@ <?php - /** - * Elgg Friends - * Friend widget options - * - * @package ElggFriends - * @subpackage Core - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.org/ - */ - +/** + * Elgg Friends + * Friend widget options + * + * @package ElggFriends + * @subpackage Core + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider Ltd + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.org/ + */ + +$selections = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 15, 20, 30, 50, 100); +$icon_sizes = array('small', 'tiny'); + +// set defaults +if (!isset($vars['entity']->num_display)) { + $vars['entity']->num_display = 12; + $vars['entity']->icon_size = 'small'; +} + +// handle upgrade to 1.7.2 from previous versions +if ($vars['entity']->icon_size == 1) { + $vars['entity']->icon_size = 'small'; +} elseif ($vars['entity']->icon_size == 2) { + $vars['entity']->icon_size = 'tiny'; +} ?> <p> - <?php echo elgg_echo("friends:num_display"); ?>: - <select name="params[num_display]"> - <option value="1" <?php if($vars['entity']->num_display == 1) echo "SELECTED"; ?>>1</option> - <option value="2" <?php if($vars['entity']->num_display == 2) echo "SELECTED"; ?>>2</option> - <option value="3" <?php if($vars['entity']->num_display == 3) echo "SELECTED"; ?>>3</option> - <option value="4" <?php if($vars['entity']->num_display == 4) echo "SELECTED"; ?>>4</option> - <option value="5" <?php if($vars['entity']->num_display == 5) echo "SELECTED"; ?>>5</option> - <option value="6" <?php if($vars['entity']->num_display == 6) echo "SELECTED"; ?>>6</option> - <option value="7" <?php if($vars['entity']->num_display == 7) echo "SELECTED"; ?>>7</option> - <option value="8" <?php if($vars['entity']->num_display == 8) echo "SELECTED"; ?>>8</option> - <option value="9" <?php if($vars['entity']->num_display == 9) echo "SELECTED"; ?>>9</option> - <option value="10" <?php if($vars['entity']->num_display == 10) echo "SELECTED"; ?>>10</option> - <option value="15" <?php if($vars['entity']->num_display == 15) echo "SELECTED"; ?>>15</option> - <option value="20" <?php if($vars['entity']->num_display == 20) echo "SELECTED"; ?>>20</option> - <option value="30" <?php if($vars['entity']->num_display == 30) echo "SELECTED"; ?>>30</option> - <option value="50" <?php if($vars['entity']->num_display == 50) echo "SELECTED"; ?>>50</option> - <option value="100" <?php if($vars['entity']->num_display == 100) echo "SELECTED"; ?>>100</option> - </select> + <?php echo elgg_echo("friends:num_display"); ?>: + <select name="params[num_display]"> +<?php +foreach ($selections as $selection) { + $selected = ''; + if ($vars['entity']->num_display == $selection) { + $selected = 'selected="selected"'; + } + echo "<option value=\"$selection\" $selected>$selection</option>"; +} +?> + </select> </p> <p> - <?php echo elgg_echo("friends:icon_size"); ?> - <select name="params[icon_size]"> - <option value="1" <?php if($vars['entity']->icon_size == 1) echo "SELECTED"; ?>><?php echo elgg_echo("friends:small"); ?></option> - <option value="2" <?php if($vars['entity']->icon_size == 2) echo "SELECTED"; ?>><?php echo elgg_echo("friends:tiny"); ?></option> - </select> -</p>
\ No newline at end of file + <?php echo elgg_echo("friends:icon_size"); ?> + <select name="params[icon_size]"> +<?php +foreach ($icon_sizes as $size) { + $selected = ''; + if ($vars['entity']->icon_size == $size) { + $selected = 'selected="selected"'; + } + $label = elgg_echo("friends:$size"); + echo "<option value=\"$size\" $selected>$label</option>"; +} +?> + </select> +</p> diff --git a/mod/friends/views/default/widgets/friends/view.php b/mod/friends/views/default/widgets/friends/view.php index ab702399a..4532e7ace 100644 --- a/mod/friends/views/default/widgets/friends/view.php +++ b/mod/friends/views/default/widgets/friends/view.php @@ -1,50 +1,40 @@ <?php - /** - * Elgg Friends - * Friend widget options - * - * @package ElggFriends - * @subpackage Core - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.org/ - */ - - - //the page owner - $owner = get_user($vars['entity']->owner_guid); - - //the number of files to display - $num = (int) $vars['entity']->num_display; - if (!$num) - $num = 8; - - //get the correct size - $size = (int) $vars['entity']->icon_size; - if (!$size || $size == 1){ - $size_value = "small"; - }else{ - $size_value = "tiny"; - } - - // Get the users friends - $friends = $owner->getFriends("", $num, $offset = 0); - - // If there are any $friend to view, view them - if (is_array($friends) && sizeof($friends) > 0) { +/** + * Elgg Friends + * Friend widget display view + * + * @package ElggFriends + * @subpackage Core + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider Ltd + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.org/ + */ + + +// owner of the profile page +$owner = get_user($vars['entity']->owner_guid); + +// the number of friends to display +$num = (int) $vars['entity']->num_display; - echo "<div id=\"widget_friends_list\">"; +// get the correct size +$size = $vars['entity']->icon_size; - foreach($friends as $friend) { - echo "<div class=\"widget_friends_singlefriend\" >"; - echo elgg_view("profile/icon",array('entity' => get_user($friend->guid), 'size' => $size_value)); - echo "</div>"; - } +// Get the user's friends +$friends = $owner->getFriends("", $num); +// If there are any friends to view, view them +if (is_array($friends) && sizeof($friends) > 0) { + + echo "<div id=\"widget_friends_list\">"; + + foreach($friends as $friend) { + echo "<div class=\"widget_friends_singlefriend\" >"; + echo elgg_view("profile/icon",array('entity' => get_user($friend->guid), 'size' => $size)); echo "</div>"; - - } - -?>
\ No newline at end of file + } + + echo "</div>"; +} diff --git a/mod/htmlawed/start.php b/mod/htmlawed/start.php index 419034f5a..523b4d264 100644 --- a/mod/htmlawed/start.php +++ b/mod/htmlawed/start.php @@ -13,7 +13,7 @@ * */ function htmlawed_init() { - /** For now declare allowed tags and protocols here, TODO: Make this configurable */ + /** For now declare allowed tags and protocols here, @todo Make this configurable */ global $CONFIG; $CONFIG->htmlawed_config = array( // seems to handle about everything we need. diff --git a/mod/messages/start.php b/mod/messages/start.php index 198494474..fbf9bc543 100644 --- a/mod/messages/start.php +++ b/mod/messages/start.php @@ -20,7 +20,6 @@ * @param unknown_type $object_type * @param unknown_type $object */ - function messages_init() { // Load system configuration @@ -28,7 +27,7 @@ function messages_init() { //add submenu options if (get_context() == "messages") { - add_submenu_item(elgg_echo('messages:inbox'), $CONFIG->wwwroot . "pg/messages/" . $_SESSION['user']->username); + add_submenu_item(elgg_echo('messages:inbox'), $CONFIG->wwwroot . "pg/messages/" . get_loggedin_user()->username); add_submenu_item(elgg_echo('messages:sentmessages'), $CONFIG->wwwroot . "mod/messages/sent.php"); } @@ -50,12 +49,8 @@ function messages_init() { // Register a notification handler for site messages register_notification_handler("site", "messages_site_notify_handler"); register_plugin_hook('notify:entity:message','object','messages_notification_msg'); - if (is_callable('register_notification_object')) - register_notification_object('object','messages',elgg_echo('messages:new')); - - // Shares widget - // add_widget_type('messages',elgg_echo("messages:recent"),elgg_echo("messages:widget:description")); - + register_notification_object('object','messages',elgg_echo('messages:new')); + // Override metadata permissions register_plugin_hook('permissions_check:metadata','object','messages_can_edit_metadata'); @@ -295,10 +290,10 @@ function count_unread_messages() { //get the users inbox messages //$num_messages = get_entities_from_metadata("toId", $_SESSION['user']->getGUID(), "object", "messages", 0, 10, 0, "", 0, false); $num_messages = elgg_get_entities_from_metadata(array('metadata_name_value_pairs' => array( - 'toId' => $_SESSION['user']->guid, + 'toId' => get_loggedin_userid(), 'readYet' => 0, 'msg' => 1 - ), 'owner_guid' => $_SESSION['user']->guid)); + ), 'owner_guid' => get_loggedin_userid())); if (is_array($num_messages)) $counter = sizeof($num_messages); diff --git a/mod/messages/views/default/widgets/messages/edit.php b/mod/messages/views/default/widgets/messages/edit.php deleted file mode 100644 index e69de29bb..000000000 --- a/mod/messages/views/default/widgets/messages/edit.php +++ /dev/null diff --git a/mod/messages/views/default/widgets/messages/view.php b/mod/messages/views/default/widgets/messages/view.php deleted file mode 100644 index e4d138562..000000000 --- a/mod/messages/views/default/widgets/messages/view.php +++ /dev/null @@ -1,13 +0,0 @@ - - <?php - - $num_messages = count_unread_messages(); - - if($num_messages == 0) - echo "<h3 class=\"new_messages_count\">You have no new messages.</h3>"; - else { - echo "<h3 class=\"new_messages_count\">" . $num_messages . " new message(s).</h3>"; - echo "<a href=\"" . $vars['url'] . "pg/messages/" . $_SESSION['user']->username ."\">check them out</a>"; - } - - ?> diff --git a/mod/pages/languages/en.php b/mod/pages/languages/en.php index 295c0ef09..1c20a4297 100644 --- a/mod/pages/languages/en.php +++ b/mod/pages/languages/en.php @@ -61,11 +61,11 @@ $english = array( * Status and error messages */ 'pages:noaccess' => 'No access to page', - 'pages:cantedit' => 'You can not edit this page', - 'pages:saved' => 'Pages saved', + 'pages:cantedit' => 'You cannot edit this page', + 'pages:saved' => 'Page saved', 'pages:notsaved' => 'Page could not be saved', 'pages:notitle' => 'You must specify a title for your page.', - 'pages:delete:success' => 'Your page was successfully deleted.', + 'pages:delete:success' => 'The page was successfully deleted.', 'pages:delete:failure' => 'The page could not be deleted.', /** diff --git a/mod/riverdashboard/languages/en.php b/mod/riverdashboard/languages/en.php index d317b8688..a07853680 100644 --- a/mod/riverdashboard/languages/en.php +++ b/mod/riverdashboard/languages/en.php @@ -25,8 +25,6 @@ $english = array( 'river:clustered' => 'Clustered', 'river:type' => 'Would you like the activity stream to be in classic format (chronological) or clustered?', 'river:widget:description' => "Show your latest activity.", - 'river:widget:title:friends' => "Friends' activity", - 'river:widget:description:friends' => "Show what your friends are up to.", 'river:widgets:friends' => "Friends", 'river:widgets:mine' => "Mine", 'river:friends' => "My friends' activity", diff --git a/services/export/handler.php b/services/export/handler.php index f68ecbfa9..dc1cb4015 100644 --- a/services/export/handler.php +++ b/services/export/handler.php @@ -45,7 +45,7 @@ else if (($guid!="") && ($type!="") && ($id_or_name!="")) { $uuid = guid_to_uuid($entity->getGUID()) . "$type/$id_or_name/"; switch ($type) { - case 'attr' : // TODO: Do this better? - This is a bit of a hack... + case 'attr' : // @todo: Do this better? - This is a bit of a hack... $v = $entity->get($id_or_name); if (!$v) { throw new InvalidParameterException(sprintf(elgg_echo('InvalidParameterException:IdNotExistForGUID'), $id_or_name, $guid)); diff --git a/views/default/account/forms/useradd.php b/views/default/account/forms/useradd.php index 11323ab14..7794e3b93 100644 --- a/views/default/account/forms/useradd.php +++ b/views/default/account/forms/useradd.php @@ -9,7 +9,7 @@ */ $admin_option = false; -if (($_SESSION['user']->isAdmin()) && ($vars['show_admin'])) { +if ((get_loggedin_user()->isAdmin()) && ($vars['show_admin'])) { $admin_option = true; } diff --git a/views/default/friends/collection.php b/views/default/friends/collection.php index deadb2f6a..ddd0a0ed0 100644 --- a/views/default/friends/collection.php +++ b/views/default/friends/collection.php @@ -24,7 +24,7 @@ if (is_array($vars['collection']->members)) { echo "<li><h2>"; //as collections are private, check that the logged in user is the owner -if($coll->owner_guid == $_SESSION['user']->getGUID()) { +if ($coll->owner_guid == get_loggedin_userid()) { echo "<div class=\"friends_collections_controls\">"; echo elgg_view('output/confirmlink', array( 'href' => $vars['url'] . 'action/friends/deletecollection?collection=' . $coll->id, @@ -36,8 +36,8 @@ echo $coll->name; echo " (<span id=\"friends_membership_count{$vars['friendspicker']}\">{$count}</span>) </h2>"; // individual collection panels -if($friends = $vars['collection']->entities) { - $content = elgg_view('friends/collectiontabs', array('owner' => $_SESSION['user'], 'collection' => $vars['collection'], 'friendspicker' => $vars['friendspicker'])); +if ($friends = $vars['collection']->entities) { + $content = elgg_view('friends/collectiontabs', array('owner' => get_loggedin_user(), 'collection' => $vars['collection'], 'friendspicker' => $vars['friendspicker'])); echo elgg_view('friends/picker',array('entities' => $friends, 'value' => $members, 'content' => $content, 'replacement' => '', 'friendspicker' => $vars['friendspicker'])); ?> @@ -45,7 +45,7 @@ if($friends = $vars['collection']->entities) { <script type="text/javascript"> $(document).ready(function () { - $('#friends_picker_placeholder<?php echo $vars['friendspicker']; ?>').load('<?php echo $vars['url']; ?>friends/pickercallback.php?username=<?php echo $_SESSION['user']->username; ?>&type=list&collection=<?php echo $vars['collection']->id; ?>'); + $('#friends_picker_placeholder<?php echo $vars['friendspicker']; ?>').load('<?php echo $vars['url']; ?>friends/pickercallback.php?username=<?php echo get_loggedin_user()->username; ?>&type=list&collection=<?php echo $vars['collection']->id; ?>'); }); </script> diff --git a/views/default/friends/collectiontabs.php b/views/default/friends/collectiontabs.php index 453cbb112..9a6577671 100644 --- a/views/default/friends/collectiontabs.php +++ b/views/default/friends/collectiontabs.php @@ -32,7 +32,7 @@ $(document).ready(function () { $('a.collectionmembers<?php echo $friendspicker; ?>').click(function () { // load collection members pane - $('#friends_picker_placeholder<?php echo $friendspicker; ?>').load('<?php echo $vars['url']; ?>friends/pickercallback.php?username=<?php echo $_SESSION['user']->username; ?>&type=list&collection=<?php echo $collectionid; ?>&friendspicker=<?php echo $friendspicker; ?>'); + $('#friends_picker_placeholder<?php echo $friendspicker; ?>').load('<?php echo $vars['url']; ?>friends/pickercallback.php?username=<?php echo get_loggedin_user()->username; ?>&type=list&collection=<?php echo $collectionid; ?>&friendspicker=<?php echo $friendspicker; ?>'); // remove selected state from previous tab $(this).parent().parent().find("li.selected").removeClass("selected"); @@ -44,7 +44,7 @@ $(document).ready(function () { $('a.editmembers<?php echo $friendspicker; ?>').click(function () { // load friends picker pane - $('#friends_picker_placeholder<?php echo $friendspicker; ?>').load('<?php echo $vars['url']; ?>friends/pickercallback.php?username=<?php echo $_SESSION['user']->username; ?>&type=picker&collection=<?php echo $collectionid; ?>&friendspicker=<?php echo $friendspicker; ?>'); + $('#friends_picker_placeholder<?php echo $friendspicker; ?>').load('<?php echo $vars['url']; ?>friends/pickercallback.php?username=<?php echo get_loggedin_user()->username; ?>&type=picker&collection=<?php echo $collectionid; ?>&friendspicker=<?php echo $friendspicker; ?>'); // remove selected state from previous tab $(this).parent().parent().find("li.selected").removeClass("selected"); diff --git a/views/default/input/autocomplete.php b/views/default/input/autocomplete.php index 7dc088d0e..b6044e55f 100644 --- a/views/default/input/autocomplete.php +++ b/views/default/input/autocomplete.php @@ -7,7 +7,7 @@ * @author Curverider Ltd * @link http://elgg.org/ * - * @TODO: This currently only works for ONE AUTOCOMPLETE TEXT FIELD on a page. + * @todo This currently only works for ONE AUTOCOMPLETE TEXT FIELD on a page. * * @uses $vars['value'] The current value, if any * @uses $vars['js'] Any Javascript to enter into the input tag diff --git a/views/default/page_elements/title.php b/views/default/page_elements/title.php index c89371013..a340e7a09 100644 --- a/views/default/page_elements/title.php +++ b/views/default/page_elements/title.php @@ -5,37 +5,18 @@ */ $page_owner = page_owner(); -$page_owner_user = get_entity($page_owner); +$page_owner_entity = get_entity($page_owner); -$submenu = get_submenu(); // elgg_view('canvas_header/submenu'); +$display = "<h2>" . $vars['title'] . "</h2>"; + +$submenu = get_submenu(); if (!empty($submenu)) { $submenu = "<ul class='submenu extended'>" . $submenu . "</ul>"; } -if (($_SESSION['guid']) && ($page_owner && $page_owner_user->guid != $_SESSION['user']->getGUID())) { - $info = "<h2>" . $vars['title'] . "</h2>"; - if($page_owner_user instanceOf ElggGroup) { - $display = $info; - } else { - $display = $info; - } - if (!empty($submenu) && $vars['submenu'] == true) { - // plugins can extend this to add menu options - $display .= $submenu; - } -} else { - $info = "<h2>" . $vars['title'] . "</h2>"; - if($page_owner_user instanceOf ElggGroup) { - $display = $info; - } else { - $display = $info; - } - if (!empty($submenu) && $vars['submenu'] == true) { - // plugins can extend this to add menu options - $display .= $submenu; - } +if (!empty($submenu) && $vars['submenu'] == true) { + // plugins can extend this to add menu options + $display .= $submenu; } - -//print to screen echo $display;
\ No newline at end of file diff --git a/views/default/usersettings/plugins_opt/plugin.php b/views/default/usersettings/plugins_opt/plugin.php index d32e44283..79286ec90 100644 --- a/views/default/usersettings/plugins_opt/plugin.php +++ b/views/default/usersettings/plugins_opt/plugin.php @@ -20,7 +20,7 @@ $manifest = $details['manifest']; $user_guid = $details['user_guid']; if ($user_guid) { - $user_guid = $_SESSION['user']->guid; + $user_guid = get_loggedin_userid(); } if (elgg_view("usersettings/{$plugin}/edit")) { diff --git a/views/default/usersettings/statistics_opt/numentities.php b/views/default/usersettings/statistics_opt/numentities.php index 1c4b127ec..ee38bdfee 100644 --- a/views/default/usersettings/statistics_opt/numentities.php +++ b/views/default/usersettings/statistics_opt/numentities.php @@ -9,7 +9,7 @@ */ // Get entity statistics -$entity_stats = get_entity_statistics($_SESSION['user']->guid); +$entity_stats = get_entity_statistics(get_loggedin_userid()); if ($entity_stats) { ?> diff --git a/views/default/usersettings/statistics_opt/online.php b/views/default/usersettings/statistics_opt/online.php index 817b18cde..e176aaf9f 100644 --- a/views/default/usersettings/statistics_opt/online.php +++ b/views/default/usersettings/statistics_opt/online.php @@ -8,13 +8,13 @@ * @link http://elgg.org/ */ -$user = $_SESSION['user']; +$user = get_loggedin_user(); $logged_in = 0; -$log = get_system_log($_SESSION['user']->guid, "login", "", 'user', '', 1); +$log = get_system_log($user->guid, "login", "", 'user', '', 1); if ($log) { - $logged_in=$log[0]->time_created; + $logged_in = $log[0]->time_created; } ?> |