diff options
author | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-05-14 20:01:59 +0000 |
---|---|---|
committer | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-05-14 20:01:59 +0000 |
commit | b6aaba915151dd07800761a01b67ffffaee1302b (patch) | |
tree | 53c30035411460270278943f2427405233b34fac | |
parent | ffbd7cd4179a0186dc674c2d24f578660cc75df0 (diff) | |
download | elgg-b6aaba915151dd07800761a01b67ffffaee1302b.tar.gz elgg-b6aaba915151dd07800761a01b67ffffaee1302b.tar.bz2 |
merge -r5898:5928 (not excluding riverdashboard, notifications, and messageboard) from 1.7 to trunk.
git-svn-id: http://code.elgg.org/elgg/trunk@6058 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r-- | actions/widgets/save.php | 8 | ||||
-rw-r--r-- | engine/lib/access.php | 2 | ||||
-rw-r--r-- | engine/lib/elgglib.php | 54 | ||||
-rw-r--r-- | engine/lib/entities.php | 4 | ||||
-rw-r--r-- | engine/lib/notification.php | 56 | ||||
-rw-r--r-- | engine/lib/river2.php | 1 | ||||
-rw-r--r-- | engine/lib/sessions.php | 12 | ||||
-rw-r--r-- | engine/lib/system_log.php | 2 | ||||
-rw-r--r-- | engine/lib/tags.php | 4 | ||||
-rw-r--r-- | engine/lib/users.php | 13 | ||||
-rw-r--r-- | mod/groups/forum.php | 10 | ||||
-rw-r--r-- | mod/groups/views/default/forum/topics.php | 2 | ||||
-rw-r--r-- | mod/invitefriends/actions/invite.php | 120 | ||||
-rw-r--r-- | mod/invitefriends/index.php | 39 | ||||
-rw-r--r-- | mod/invitefriends/languages/en.php | 48 | ||||
-rw-r--r-- | mod/invitefriends/start.php | 24 | ||||
-rw-r--r-- | mod/invitefriends/views/default/invitefriends/form.php | 31 | ||||
-rw-r--r-- | mod/invitefriends/views/default/invitefriends/formitems.php | 18 | ||||
-rw-r--r-- | mod/profile/icon.php | 7 | ||||
-rw-r--r-- | views/default/friends/river/create.php | 3 | ||||
-rw-r--r-- | views/rss/entities/entity_list.php | 10 |
21 files changed, 246 insertions, 222 deletions
diff --git a/actions/widgets/save.php b/actions/widgets/save.php index 7e9c91dcd..01459f660 100644 --- a/actions/widgets/save.php +++ b/actions/widgets/save.php @@ -19,12 +19,14 @@ if (!empty($guid)) { $result = save_widget_info($guid,$params); } +if ($noforward) { + exit; +} + if ($result) { system_message(elgg_echo('widgets:save:success')); } else { register_error(elgg_echo('widgets:save:failure')); } -if (!$noforward) { - forward($_SERVER['HTTP_REFERER']); -} +forward($_SERVER['HTTP_REFERER']);
\ No newline at end of file diff --git a/engine/lib/access.php b/engine/lib/access.php index fa9510d7a..fc5081ced 100644 --- a/engine/lib/access.php +++ b/engine/lib/access.php @@ -173,7 +173,7 @@ function get_default_access(ElggUser $user = null) { return $CONFIG->default_access; } - if (!($user) || (!$user = get_loggedin_user())) { + if (!($user) && (!$user = get_loggedin_user())) { return $CONFIG->default_access; } diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index f6aae2b97..fd99cee0b 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -24,6 +24,10 @@ function forward($location = "") { global $CONFIG; if (!headers_sent()) { + if ($location === REFERER) { + $location = $_SERVER['HTTP_REFERER']; + } + $current_page = current_page_url(); if ((substr_count($location, 'http://') == 0) && (substr_count($location, 'https://') == 0)) { $location = $CONFIG->url . $location; @@ -139,6 +143,45 @@ function elgg_get_viewtype() { } /** + * Register a viewtype to fall back to a default view if view does not exist in + * that viewtype. + * + * This is useful for alternate html viewtypes (such as for mobile devices) + * + * @param string $viewtype The viewtype to register + */ +function elgg_register_viewtype_fallback($viewtype) { + global $CONFIG; + + if (!isset($CONFIG->viewtype)) { + $CONFIG->viewtype = new stdClass; + } + + if (!isset($CONFIG->viewtype->fallback)) { + $CONFIG->viewtype->fallback = array(); + } + + $CONFIG->viewtype->fallback[] = $viewtype; +} + +/** + * Checks if this viewtype falls back to default + * + * @param string $viewtype + * @return boolean + */ +function elgg_does_viewtype_fallback($viewtype) { + global $CONFIG; + + if (isset($CONFIG->viewtype) && isset($CONFIG->viewtype->fallback)) { + return in_array($viewtype, $CONFIG->viewtype->fallback); + } + + return FALSE; +} + + +/** * Return the location of a given view. * * @param string $view The view. @@ -282,7 +325,7 @@ function elgg_view($view, $vars = array(), $bypass = false, $debug = false, $vie $error = "$viewtype/$view view does not exist."; // attempt to load default view - if ($viewtype != 'default') { + if ($viewtype != 'default' && elgg_does_viewtype_fallback($viewtype)) { if (file_exists($default_view_file) && include($default_view_file)) { // default view found $error .= " Using default/$view instead."; @@ -3326,9 +3369,18 @@ define('ACCESS_LOGGED_IN', 1); define('ACCESS_PUBLIC', 2); define('ACCESS_FRIENDS', -2); +/** + * @since 1.7 + */ define('ELGG_ENTITIES_ANY_VALUE', NULL); define('ELGG_ENTITIES_NO_VALUE', 0); +/** + * @since 1.7.2 + */ +define('REFERRER', -1); +define('REFERER', -1); + register_elgg_event_handler('init', 'system', 'elgg_init'); register_elgg_event_handler('boot', 'system', 'elgg_boot', 1000); register_plugin_hook('unit_test', 'system', 'elgg_api_test'); diff --git a/engine/lib/entities.php b/engine/lib/entities.php index 56d6b1749..481feac6b 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -1989,11 +1989,11 @@ $count = false, $site_guid = 0, $container_guid = null, $timelower = 0, $timeupp } if ($timeupper) { - $options['time_upper'] = $timeupper; + $options['created_time_upper'] = $timeupper; } if ($timelower) { - $options['time_lower'] = $timelower; + $options['created_time_lower'] = $timelower; } $r = elgg_get_entities($options); diff --git a/engine/lib/notification.php b/engine/lib/notification.php index 58e2a10f6..726f76993 100644 --- a/engine/lib/notification.php +++ b/engine/lib/notification.php @@ -243,9 +243,6 @@ function email_notify_handler(ElggEntity $from, ElggUser $to, $subject, $message throw new NotificationException(sprintf(elgg_echo('NotificationException:NoEmailAddress'), $to->guid)); } - // Sanitise subject - $subject = preg_replace("/(\r\n|\r|\n)/", " ", $subject); // Strip line endings - // To $to = $to->email; @@ -257,55 +254,12 @@ function email_notify_handler(ElggEntity $from, ElggUser $to, $subject, $message } else if (($site) && (isset($site->email))) { // Has the current site got a from email address? $from = $site->email; - } else if (isset($from->url)) { - // If we have a url then try and use that. - $breakdown = parse_url($from->url); - $from = 'noreply@' . $breakdown['host']; // Handle anything with a url } else { // If all else fails, use the domain of the site. $from = 'noreply@' . get_site_domain($CONFIG->site_guid); } - if (is_callable('mb_internal_encoding')) { - mb_internal_encoding('UTF-8'); - } - $site = get_entity($CONFIG->site_guid); - $sitename = $site->name; - if (is_callable('mb_encode_mimeheader')) { - $sitename = mb_encode_mimeheader($site->name,"UTF-8", "B"); - } - - $header_eol = "\r\n"; - if ( - (isset($CONFIG->broken_mta)) && - ($CONFIG->broken_mta) - ) { - // Allow non-RFC 2822 mail headers to support some broken MTAs - $header_eol = "\n"; - } - - $from_email = "\"$sitename\" <$from>"; - if (strtolower(substr(PHP_OS, 0 , 3)) == 'win') { - // Windows is somewhat broken, so we use a different format from header - $from_email = "$from"; - } - - $headers = "From: $from_email{$header_eol}" - . "Content-Type: text/plain; charset=UTF-8; format=flowed{$header_eol}" - . "MIME-Version: 1.0{$header_eol}" - . "Content-Transfer-Encoding: 8bit{$header_eol}"; - - if (is_callable('mb_encode_mimeheader')) { - $subject = mb_encode_mimeheader($subject,"UTF-8", "B"); - } - - // Format message - $message = html_entity_decode($message, ENT_COMPAT, 'UTF-8'); // Decode any html entities - $message = strip_tags($message); // Strip tags from message - $message = preg_replace("/(\r\n|\r)/", "\n", $message); // Convert to unix line endings in body - $message = preg_replace("/^From/", ">From", $message); // Change lines starting with From to >From - - return mail($to, $subject, wordwrap($message), $headers); + return elgg_send_email($from, $to, $subject, $message); } /** @@ -372,10 +326,10 @@ function elgg_send_email($from, $to, $subject, $body, array $params = NULL) { } // Format message - $message = html_entity_decode($body, ENT_COMPAT, 'UTF-8'); // Decode any html entities - $message = strip_tags($body); // Strip tags from message - $message = preg_replace("/(\r\n|\r)/", "\n", $body); // Convert to unix line endings in body - $message = preg_replace("/^From/", ">From", $body); // Change lines starting with From to >From + $body = html_entity_decode($body, ENT_COMPAT, 'UTF-8'); // Decode any html entities + $body = strip_tags($body); // Strip tags from message + $body = preg_replace("/(\r\n|\r)/", "\n", $body); // Convert to unix line endings in body + $body = preg_replace("/^From/", ">From", $body); // Change lines starting with From to >From return mail($to, $subject, wordwrap($body), $headers); } diff --git a/engine/lib/river2.php b/engine/lib/river2.php index 8fb20ac40..a4908167d 100644 --- a/engine/lib/river2.php +++ b/engine/lib/river2.php @@ -191,6 +191,7 @@ function get_river_items($subject_guid = 0, $object_guid = 0, $subject_relations // Construct 'where' clauses for the river $where = array(); + // river table does not have columns expected by get_access_sql_suffix so we modify its output $where[] = str_replace("and enabled='yes'",'',str_replace('owner_guid','subject_guid',get_access_sql_suffix())); if (empty($subject_relationship)) { diff --git a/engine/lib/sessions.php b/engine/lib/sessions.php index b5b68ebe0..ffea2dcc2 100644 --- a/engine/lib/sessions.php +++ b/engine/lib/sessions.php @@ -60,8 +60,8 @@ class ElggSession implements ArrayAccess { return ElggSession::$__localcache[$key]; } - $value = null; - $value = trigger_plugin_hook('session:get', $key, null, $value); + $value = NULL; + $value = trigger_plugin_hook('session:get', $key, NULL, $value); ElggSession::$__localcache[$key] = $value; @@ -110,10 +110,11 @@ class ElggSession implements ArrayAccess { /** - * Return the current logged in user, or null if no user is logged in. + * Return the current logged in user, or NULL if no user is logged in. * * If no user can be found in the current session, a plugin hook - 'session:get' 'user' to give plugin * authors another way to provide user details to the ACL system without touching the session. + * @return ElggUser|NULL */ function get_loggedin_user() { global $SESSION; @@ -122,7 +123,7 @@ function get_loggedin_user() { return $SESSION['user']; } - return false; + return NULL; } /** @@ -133,8 +134,9 @@ function get_loggedin_user() { */ function get_loggedin_userid() { $user = get_loggedin_user(); - if ($user) + if ($user) { return $user->guid; + } return 0; } diff --git a/engine/lib/system_log.php b/engine/lib/system_log.php index 75a7cc531..74597ed5d 100644 --- a/engine/lib/system_log.php +++ b/engine/lib/system_log.php @@ -203,7 +203,7 @@ function system_log($object, $event) { $object_subtype = $object->getSubtype(); $event = sanitise_string($event); $time = time(); - $performed_by = (int)$_SESSION['guid']; + $performed_by = get_loggedin_userid(); if (isset($object->access_id)) { $access_id = $object->access_id; diff --git a/engine/lib/tags.php b/engine/lib/tags.php index 84ea1b978..8d67a89bb 100644 --- a/engine/lib/tags.php +++ b/engine/lib/tags.php @@ -292,11 +292,11 @@ function get_tags($threshold = 1, $limit = 10, $metadata_name = "", $entity_type } if ($end_ts) { - $options['time_upper'] = $end_ts; + $options['created_time_upper'] = $end_ts; } if ($start_ts) { - $options['time_lower'] = $start_ts; + $options['created_time_lower'] = $start_ts; } $r = elgg_get_tags($options); diff --git a/engine/lib/users.php b/engine/lib/users.php index 9bb2a3f15..dae7341ac 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -1602,7 +1602,7 @@ function collections_submenu_items() { global $CONFIG; $user = get_loggedin_user(); add_submenu_item(elgg_echo('friends:collections'), $CONFIG->wwwroot . "pg/collections/" . $user->username); - add_submenu_item(elgg_echo('friends:collections:add'),$CONFIG->wwwroot."pg/collections/add"); + add_submenu_item(elgg_echo('friends:collections:add'), $CONFIG->wwwroot . "pg/collections/add"); } /** @@ -1613,10 +1613,9 @@ function friends_page_handler($page_elements) { if (isset($page_elements[0]) && $user = get_user_by_username($page_elements[0])) { set_page_owner($user->getGUID()); } - if ($_SESSION['guid'] == page_owner()) { + if (get_loggedin_userid() == page_owner()) { // collections_submenu_items(); disabled for now as we no longer use friends collections (replaced by shared access) } - require_once(dirname(dirname(dirname(__FILE__))) . "/friends/index.php"); } @@ -1628,26 +1627,26 @@ function friends_of_page_handler($page_elements) { if (isset($page_elements[0]) && $user = get_user_by_username($page_elements[0])) { set_page_owner($user->getGUID()); } - if ($_SESSION['guid'] == page_owner()) { + if (get_loggedin_userid() == page_owner()) { // collections_submenu_items(); disabled for now as we no longer use friends collections (replaced by shared access) } require_once(dirname(dirname(dirname(__FILE__))) . "/friends/of.php"); } /** - * Page handler for friends of + * Page handler for friends collections * */ function collections_page_handler($page_elements) { if (isset($page_elements[0])) { if ($page_elements[0] == "add") { - set_page_owner($_SESSION['guid']); + set_page_owner(get_loggedin_userid()); collections_submenu_items(); require_once(dirname(dirname(dirname(__FILE__))) . "/friends/add.php"); } else { if ($user = get_user_by_username($page_elements[0])) { set_page_owner($user->getGUID()); - if ($_SESSION['guid'] == page_owner()) { + if (get_loggedin_userid() == page_owner()) { collections_submenu_items(); } require_once(dirname(dirname(dirname(__FILE__))) . "/friends/collections.php"); diff --git a/mod/groups/forum.php b/mod/groups/forum.php index a19d86a0b..a8a4d391e 100644 --- a/mod/groups/forum.php +++ b/mod/groups/forum.php @@ -1,7 +1,7 @@ <?php /** * Elgg groups forum - * + * * @package ElggGroups * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 * @author Curverider @@ -11,8 +11,11 @@ require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); - set_page_owner((int)get_input('group_guid')); - if (!(page_owner_entity() instanceof ElggGroup)) forward(); + $group_guid = (int)get_input('group_guid'); + set_page_owner($group_guid); + if (!(page_owner_entity() instanceof ElggGroup)) { + forward(); + } group_gatekeeper(); @@ -21,7 +24,6 @@ set_context('search'); // set up breadcrumbs - $group_guid = get_input('group_guid'); $group = get_entity($group_guid); elgg_push_breadcrumb(elgg_echo('groups'), $CONFIG->wwwroot."pg/groups/world/"); elgg_push_breadcrumb($group->name, $group->getURL()); diff --git a/mod/groups/views/default/forum/topics.php b/mod/groups/views/default/forum/topics.php index 821e398e1..6280fe31a 100644 --- a/mod/groups/views/default/forum/topics.php +++ b/mod/groups/views/default/forum/topics.php @@ -18,7 +18,7 @@ if(page_owner_entity()->isMember($vars['user'])) { ?> <div class="content_header_options"> - <a class="action_button" href="<?php echo $vars['url']; ?>mod/groups/addtopic.php?group_guid=<?php echo get_input('group_guid'); ?>"><?php echo elgg_echo("groups:addtopic"); ?></a> + <a class="action_button" href="<?php echo $vars['url']; ?>mod/groups/addtopic.php?group_guid=<?php echo vars('group_guid'); ?>"><?php echo elgg_echo("groups:addtopic"); ?></a> </div> <?php } diff --git a/mod/invitefriends/actions/invite.php b/mod/invitefriends/actions/invite.php index 66902606a..abc212bea 100644 --- a/mod/invitefriends/actions/invite.php +++ b/mod/invitefriends/actions/invite.php @@ -1,73 +1,71 @@ <?php - /** - * Elgg invite action - * - * @package ElggFile - * @author Curverider Ltd - * @copyright Curverider Ltd 2008-2010 - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @link http://elgg.org/ - */ +/** + * Elgg invite friends action + * + * @package ElggInviteFriends + * @author Curverider Ltd + * @copyright Curverider Ltd 2008-2010 + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @link http://elgg.org/ + */ - global $CONFIG; - - gatekeeper(); - - $emails = get_input('emails'); - $emailmessage = get_input('emailmessage'); +$emails = get_input('emails'); +$emailmessage = get_input('emailmessage'); - $emails = trim($emails); - if (strlen($emails) > 0) { - $emails = preg_split('/\\s+/', $emails, -1, PREG_SPLIT_NO_EMPTY); +$emails = trim($emails); +if (strlen($emails) > 0) { + $emails = preg_split('/\\s+/', $emails, -1, PREG_SPLIT_NO_EMPTY); +} + +if (!is_array($emails) || count($emails) == 0) { + register_error(elgg_echo('invitefriends:failure')); + forward($_SERVER['HTTP_REFERER']); +} + +$current_user = get_loggedin_user(); + +$error = FALSE; +$bad_emails = array(); +foreach($emails as $email) { + + $email = trim($email); + if (empty($email)) { + continue; } - - if (!is_array($emails) || count($emails) == 0) { - register_error(elgg_echo('invitefriends:failure')); - forward($_SERVER['HTTP_REFERER']); + + // send out other email addresses + if (!is_email_address($email)) { + $error = TRUE; + $bad_emails[] = $email; + continue; } - - $error = FALSE; - $bad_emails = array(); - foreach($emails as $email) { - - $email = trim($email); - if (empty($email)) { - continue; - } - - // send out other email addresses - if (!is_email_address($email)) { - $error = TRUE; - $bad_emails[] = $email; - continue; - } - - $link = $CONFIG->wwwroot . 'pg/register?friend_guid=' . $_SESSION['guid'] . '&invitecode=' . generate_invite_code($_SESSION['user']->username); - $message = sprintf(elgg_echo('invitefriends:email'), - $CONFIG->site->name, - $_SESSION['user']->name, - $emailmessage, - $link - ); - $subject = sprintf(elgg_echo('invitefriends:subject'), $CONFIG->site->name); + $link = $CONFIG->wwwroot . 'pg/register?friend_guid=' . $current_user->guid . '&invitecode=' . generate_invite_code($current_user->username); + $message = sprintf(elgg_echo('invitefriends:email'), + $CONFIG->site->name, + $current_user->name, + $emailmessage, + $link + ); - // create the from address - $site = get_entity($CONFIG->site_guid); - if (($site) && (isset($site->email))) { - $from = $site->email; - } else { - $from = 'noreply@' . get_site_domain($CONFIG->site_guid); - } + $subject = sprintf(elgg_echo('invitefriends:subject'), $CONFIG->site->name); - elgg_send_email($from, $email, $subject, $message); + // create the from address + $site = get_entity($CONFIG->site_guid); + if (($site) && (isset($site->email))) { + $from = $site->email; + } else { + $from = 'noreply@' . get_site_domain($CONFIG->site_guid); } - if ($error) { - register_error(sprintf(elgg_echo('invitefriends:email_error'), implode(', ', $bad_emails))); - } else { - system_message(elgg_echo('invitefriends:success')); - } + elgg_send_email($from, $email, $subject, $message); +} - forward($_SERVER['HTTP_REFERER']); +if ($error) { + register_error(sprintf(elgg_echo('invitefriends:email_error'), implode(', ', $bad_emails))); +} else { + system_message(elgg_echo('invitefriends:success')); +} + +forward($_SERVER['HTTP_REFERER']); diff --git a/mod/invitefriends/index.php b/mod/invitefriends/index.php index 2a9aee790..1f27f07aa 100644 --- a/mod/invitefriends/index.php +++ b/mod/invitefriends/index.php @@ -1,24 +1,23 @@ <?php + /** - * Elgg invite page - * - * @package ElggFile - * @author Curverider Ltd - * @copyright Curverider Ltd 2008-2010 - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @link http://elgg.org/ - */ + * Elgg invite page + * + * @package ElggInviteFriends + * @author Curverider Ltd + * @copyright Curverider Ltd 2008-2010 + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @link http://elgg.org/ + */ + +require_once(dirname(dirname(dirname(__FILE__))) . '/engine/start.php'); + +gatekeeper(); + +set_context('friends'); +set_page_owner(get_loggedin_userid()); - require_once(dirname(dirname(dirname(__FILE__))) . '/engine/start.php'); - - gatekeeper(); - - set_context('friends'); - set_page_owner($_SESSION['guid']); - - $body = elgg_view('invitefriends/form'); - $body = elgg_view_layout('one_column_with_sidebar', $body); +$body = elgg_view('invitefriends/form'); +$body = elgg_view_layout('one_column_with_sidebar', $body); - page_draw(elgg_echo('friends:invite'),$body); - -?>
\ No newline at end of file +page_draw(elgg_echo('friends:invite'), $body); diff --git a/mod/invitefriends/languages/en.php b/mod/invitefriends/languages/en.php index 357ceeeea..fa6cb3fd9 100644 --- a/mod/invitefriends/languages/en.php +++ b/mod/invitefriends/languages/en.php @@ -1,31 +1,32 @@ <?php - /** - * Elgg invite page - * - * @package ElggFile - * @author Curverider Ltd - * @copyright Curverider Ltd 2008-2010 - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @link http://elgg.org/ - */ - - $english = array( - - 'friends:invite' => 'Invite friends', - 'invitefriends:introduction' => 'To invite friends to join you on this network, enter their email addresses below (one per line):', - 'invitefriends:message' => 'Enter a message they will receive with your invitation:', - 'invitefriends:subject' => 'Invitation to join %s', +/** + * Elgg invite language file + * + * @package ElggInviteFriends + * @author Curverider Ltd + * @copyright Curverider Ltd 2008-2010 + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @link http://elgg.org/ + */ + +$english = array( + + 'friends:invite' => 'Invite friends', + 'invitefriends:introduction' => 'To invite friends to join you on this network, enter their email addresses below (one per line):', + 'invitefriends:message' => 'Enter a message they will receive with your invitation:', + 'invitefriends:subject' => 'Invitation to join %s', + + 'invitefriends:success' => 'Your friends were invited.', + 'invitefriends:email_error' => 'Invitations were sent, but the following addresses are not valid: %s', + 'invitefriends:failure' => 'Your friends could not be invited.', - 'invitefriends:success' => 'Your friends were invited.', - 'invitefriends:email_error' => 'Invitations were sent, but the following addresses are not valid: %s', - 'invitefriends:failure' => 'Your friends could not be invited.', - - 'invitefriends:message:default' => ' + 'invitefriends:message:default' => ' Hi, I want to invite you to join my network here on %s.', - 'invitefriends:email' => ' + + 'invitefriends:email' => ' You have been invited to join %s by %s. They included the following message: %s @@ -38,5 +39,4 @@ You will automatically add them as a friend when you create your account.', ); - add_translation("en",$english); -?> +add_translation("en", $english); diff --git a/mod/invitefriends/start.php b/mod/invitefriends/start.php index f2b532253..6bdedcffa 100644 --- a/mod/invitefriends/start.php +++ b/mod/invitefriends/start.php @@ -1,25 +1,25 @@ <?php /** - * Elgg invite page - * - * @package ElggFile + * Elgg invite friends + * + * @package ElggInviteFriends * @author Curverider Ltd * @copyright Curverider Ltd 2008-2010 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 * @link http://elgg.org/ */ +/** + * Add menu item for invite friends + */ function invitefriends_pagesetup() { - - // Menu options global $CONFIG; - if (get_context() == "friends" || - get_context() == "friendsof") { + if (get_context() == "friends" || + get_context() == "friendsof" || + get_context() == "collections") { add_submenu_item(elgg_echo('friends:invite'),$CONFIG->wwwroot."mod/invitefriends/",'invite'); - } } +} - global $CONFIG; - register_action('invitefriends/invite', false, $CONFIG->pluginspath . 'invitefriends/actions/invite.php'); - register_elgg_event_handler('pagesetup','system','invitefriends_pagesetup',1000); -?>
\ No newline at end of file +register_action('invitefriends/invite', false, $CONFIG->pluginspath . 'invitefriends/actions/invite.php'); +register_elgg_event_handler('pagesetup', 'system', 'invitefriends_pagesetup'); diff --git a/mod/invitefriends/views/default/invitefriends/form.php b/mod/invitefriends/views/default/invitefriends/form.php index ef66c1e84..ed8fa2d15 100644 --- a/mod/invitefriends/views/default/invitefriends/form.php +++ b/mod/invitefriends/views/default/invitefriends/form.php @@ -1,18 +1,17 @@ <?php - /** - * Elgg invite page - * - * @package ElggFile - * @author Curverider Ltd - * @copyright Curverider Ltd 2008-2010 - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @link http://elgg.org/ - */ - echo elgg_view('input/form', array( - 'action' => $vars['url'] . 'action/invitefriends/invite', - 'body' => elgg_view('invitefriends/formitems'), - 'method' => 'post' - ) - ); +/** + * Elgg invite form wrapper + * + * @package ElggInviteFriends + * @author Curverider Ltd + * @copyright Curverider Ltd 2008-2010 + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @link http://elgg.org/ + */ -?> +echo elgg_view('input/form', array( + 'action' => $vars['url'] . 'action/invitefriends/invite', + 'body' => elgg_view('invitefriends/formitems'), + 'method' => 'post' + ) +); diff --git a/mod/invitefriends/views/default/invitefriends/formitems.php b/mod/invitefriends/views/default/invitefriends/formitems.php index 875287821..ce9a84073 100644 --- a/mod/invitefriends/views/default/invitefriends/formitems.php +++ b/mod/invitefriends/views/default/invitefriends/formitems.php @@ -1,14 +1,14 @@ <?php - /** - * Elgg invite page - * - * @package ElggFile - * @author Curverider Ltd - * @copyright Curverider Ltd 2008-2010 - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @link http://elgg.org/ - */ +/** + * Elgg invite form contents + * + * @package ElggInviteFriends + * @author Curverider Ltd + * @copyright Curverider Ltd 2008-2010 + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @link http://elgg.org/ + */ echo "<h2>".elgg_echo('friends:invite')."</h2>"; diff --git a/mod/profile/icon.php b/mod/profile/icon.php index 463eb3db5..da7667c8b 100644 --- a/mod/profile/icon.php +++ b/mod/profile/icon.php @@ -20,6 +20,13 @@ $size = strtolower(get_input('size')); if (!in_array($size,array('large','medium','small','tiny','master','topbar'))) $size = "medium"; +// If user doesn't exist, return default icon +if (!$user) { + $path = elgg_view("icon/user/default/$size"); + header("Location: $path"); + exit; +} + // Try and get the icon $filehandler = new ElggFile(); $filehandler->owner_guid = $user->getGUID(); diff --git a/views/default/friends/river/create.php b/views/default/friends/river/create.php index 3b0b7c309..178459304 100644 --- a/views/default/friends/river/create.php +++ b/views/default/friends/river/create.php @@ -1,6 +1,6 @@ <?php /** - * Elgg create river item + * Elgg create new friend river item * * @package Elgg * @author Curverider Ltd <info@elgg.com> @@ -10,7 +10,6 @@ */ $performed_by = get_entity($vars['item']->subject_guid); $performed_on = get_entity($vars['item']->object_guid); -$url = $performed_on->getURL(); $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>"; $string = sprintf(elgg_echo("friends:river:add"),$url) . " "; diff --git a/views/rss/entities/entity_list.php b/views/rss/entities/entity_list.php new file mode 100644 index 000000000..83b45b00f --- /dev/null +++ b/views/rss/entities/entity_list.php @@ -0,0 +1,10 @@ +<?php + +$entities = $vars['entities']; +$fullview = $vars['fullview']; + +if (is_array($entities) && sizeof($entities) > 0) { + foreach($entities as $entity) { + echo elgg_view_entity($entity, $fullview); + } +}
\ No newline at end of file |