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 /mod | |
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
Diffstat (limited to 'mod')
-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 |
9 files changed, 152 insertions, 147 deletions
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(); |