aboutsummaryrefslogtreecommitdiff
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rw-r--r--mod/categories/actions/save.php2
-rw-r--r--mod/categories/views/default/settings/categories/edit.php2
-rw-r--r--mod/file/start.php15
-rw-r--r--mod/groups/actions/addtogroup.php117
-rw-r--r--mod/groups/actions/delete.php31
-rw-r--r--mod/groups/actions/featured.php58
-rw-r--r--mod/groups/actions/groupskillinvitation.php36
-rw-r--r--mod/groups/actions/groupskillrequest.php42
-rw-r--r--mod/groups/actions/invite.php47
-rw-r--r--mod/groups/actions/join.php85
-rw-r--r--mod/groups/actions/joinrequest.php34
-rw-r--r--mod/groups/actions/leave.php61
-rw-r--r--mod/groups/icon.php77
-rw-r--r--mod/invitefriends/actions/invite.php10
-rw-r--r--mod/invitefriends/views/default/invitefriends/formitems.php5
-rw-r--r--mod/notifications/start.php13
-rw-r--r--mod/pages/start.php15
-rw-r--r--mod/profile/icon.php5
-rw-r--r--mod/profile/start.php1
-rw-r--r--mod/sitepages/sitepages_functions.php8
-rw-r--r--mod/twitterservice/start.php10
-rw-r--r--mod/twitterservice/twitterservice_lib.php6
-rw-r--r--mod/twitterservice/views/default/usersettings/twitterservice/edit.php2
-rw-r--r--mod/uservalidationbyemail/lib/functions.php5
24 files changed, 299 insertions, 388 deletions
diff --git a/mod/categories/actions/save.php b/mod/categories/actions/save.php
index dc2c7943b..3aa8b3261 100644
--- a/mod/categories/actions/save.php
+++ b/mod/categories/actions/save.php
@@ -8,7 +8,7 @@
$categories = get_input('categories');
$categories = string_to_tag_array($categories);
-$site = $CONFIG->site;
+$site = elgg_get_site_entity();
$site->categories = $categories;
system_message(elgg_echo("categories:save:success"));
diff --git a/mod/categories/views/default/settings/categories/edit.php b/mod/categories/views/default/settings/categories/edit.php
index de2b8ad62..9e0af0e48 100644
--- a/mod/categories/views/default/settings/categories/edit.php
+++ b/mod/categories/views/default/settings/categories/edit.php
@@ -6,7 +6,7 @@
*/
// Get site and categories
-$site = $CONFIG->site;
+$site = elgg_get_site_entity();
$categories = $site->categories;
if (empty($categories)) {
diff --git a/mod/file/start.php b/mod/file/start.php
index 88213fc5c..f60de52ec 100644
--- a/mod/file/start.php
+++ b/mod/file/start.php
@@ -136,20 +136,9 @@ function file_notify_message($hook, $entity_type, $returnvalue, $params) {
if (($entity instanceof ElggEntity) && ($entity->getSubtype() == 'file')) {
$descr = $entity->description;
$title = $entity->title;
- global $CONFIG;
$url = elgg_get_site_url() . "pg/view/" . $entity->guid;
- if ($method == 'sms') {
- $owner = $entity->getOwnerEntity();
- return $owner->name . ' ' . elgg_echo("file:via") . ': ' . $url . ' (' . $title . ')';
- }
- if ($method == 'email') {
- $owner = $entity->getOwnerEntity();
- return $owner->name . ' ' . elgg_echo("file:via") . ': ' . $entity->title . "\n\n" . $descr . "\n\n" . $entity->getURL();
- }
- if ($method == 'web') {
- $owner = $entity->getOwnerEntity();
- return $owner->name . ' ' . elgg_echo("file:via") . ': ' . $entity->title . "\n\n" . $descr . "\n\n" . $entity->getURL();
- }
+ $owner = $entity->getOwnerEntity();
+ return $owner->name . ' ' . elgg_echo("file:via") . ': ' . $entity->title . "\n\n" . $descr . "\n\n" . $entity->getURL();
}
return null;
}
diff --git a/mod/groups/actions/addtogroup.php b/mod/groups/actions/addtogroup.php
index 2da045fc6..651b90abb 100644
--- a/mod/groups/actions/addtogroup.php
+++ b/mod/groups/actions/addtogroup.php
@@ -1,92 +1,77 @@
<?php
+/**
+ * Add a user to a group
+ *
+ * @package ElggGroups
+ */
+$logged_in_user = get_loggedin_user();
- /**
- * Add a user to a group
- *
- * @package ElggGroups
- */
+$user_guid = get_input('user_guid');
+if (!is_array($user_guid))
+ $user_guid = array($user_guid);
+$group_guid = get_input('group_guid');
- // Load configuration
- global $CONFIG;
+if (sizeof($user_guid)) {
+ foreach ($user_guid as $u_id) {
+ $user = get_entity($u_id);
+ $group = get_entity($group_guid);
- $logged_in_user = get_loggedin_user();
+ set_page_owner($group->guid);
- $user_guid = get_input('user_guid');
- if (!is_array($user_guid))
- $user_guid = array($user_guid);
- $group_guid = get_input('group_guid');
+ if ($user && $group) {
- if (sizeof($user_guid))
- {
- foreach ($user_guid as $u_id)
- {
- $user = get_entity($u_id);
- $group = get_entity($group_guid);
+ //if (get_loggedin_userid() == $group->owner_guid)
+ if ($group->canEdit()) {
- set_page_owner($group->guid);
-
- if ( $user && $group) {
-
- //if (get_loggedin_userid() == $group->owner_guid)
- if ($group->canEdit())
- {
-
- // If the group is open or the user has requested membership
- if (
+ // If the group is open or the user has requested membership
+ if (
(check_entity_relationship($user->guid, 'membership_request', $group->guid)) ||
($group->isPublicMembership())
- )
- {
+ ) {
- if (!$group->isMember($user))
- {
- // Remove relationships
- remove_entity_relationship($group->guid, 'invited', $user->guid);
- remove_entity_relationship($user->guid, 'membership_request', $group->guid);
+ if (!$group->isMember($user)) {
+ // Remove relationships
+ remove_entity_relationship($group->guid, 'invited', $user->guid);
+ remove_entity_relationship($user->guid, 'membership_request', $group->guid);
- //add_entity_relationship($user->guid, 'member', $group->guid);
- $group->join($user);
+ //add_entity_relationship($user->guid, 'member', $group->guid);
+ $group->join($user);
- // send welcome email
- notify_user($user->getGUID(), $group->owner_guid,
+ // send welcome email
+ notify_user($user->getGUID(), $group->owner_guid,
elgg_echo('groups:welcome:subject', array($group->name)),
elgg_echo('groups:welcome:body', array($user->name, $group->name, $group->getURL())),
NULL);
- system_message(elgg_echo('groups:addedtogroup'));
- }
- else
- register_error(elgg_echo("groups:cantjoin"));
+ system_message(elgg_echo('groups:addedtogroup'));
}
else
- {
- if ($user->isFriend())
- {
-
- // Create relationship
- add_entity_relationship($group->guid, 'invited', $user->guid);
-
- // Send email
- $url = elgg_get_site_url()."pg/groups/invited?user_guid={$user->guid}&group_guid={$group->guid}";
- if (notify_user($user->getGUID(), $group->owner_guid,
- elgg_echo('groups:invite:subject', array($user->name, $group->name)),
- elgg_echo('groups:invite:body', array($user->name, $logged_in_user->name, $group->name, $url)),
- NULL))
- system_message(elgg_echo("groups:userinvited"));
- else
- register_error(elgg_echo("groups:usernotinvited"));
-
- }
+ register_error(elgg_echo("groups:cantjoin"));
+ }
+ else {
+ if ($user->isFriend()) {
+
+ // Create relationship
+ add_entity_relationship($group->guid, 'invited', $user->guid);
+
+ // Send email
+ $url = elgg_get_site_url() . "pg/groups/invited?user_guid={$user->guid}&group_guid={$group->guid}";
+ if (notify_user($user->getGUID(), $group->owner_guid,
+ elgg_echo('groups:invite:subject', array($user->name, $group->name)),
+ elgg_echo('groups:invite:body', array($user->name, $logged_in_user->name, $group->name, $url)),
+ NULL))
+ system_message(elgg_echo("groups:userinvited"));
else
register_error(elgg_echo("groups:usernotinvited"));
}
+ else
+ register_error(elgg_echo("groups:usernotinvited"));
}
- else
- register_error(elgg_echo("groups:notowner"));
}
+ else
+ register_error(elgg_echo("groups:notowner"));
}
}
+}
- forward(REFERER);
-
-?>
+forward(REFERER);
diff --git a/mod/groups/actions/delete.php b/mod/groups/actions/delete.php
index 2983bc2ce..5672e8c47 100644
--- a/mod/groups/actions/delete.php
+++ b/mod/groups/actions/delete.php
@@ -1,19 +1,20 @@
<?php
- global $CONFIG;
+/**
+ * Delete a group
+ */
- $guid = (int)get_input('group_guid');
- $entity = get_entity($guid);
-
- if (($entity) && ($entity instanceof ElggGroup))
- {
- if ($entity->delete())
- system_message(elgg_echo('group:deleted'));
- else
- register_error(elgg_echo('group:notdeleted'));
- }
+$guid = (int)get_input('group_guid');
+$entity = get_entity($guid);
+
+if (($entity) && ($entity instanceof ElggGroup))
+{
+ if ($entity->delete())
+ system_message(elgg_echo('group:deleted'));
else
register_error(elgg_echo('group:notdeleted'));
-
- $url_name = get_loggedin_user()->username;
- forward(elgg_get_site_url()."pg/groups/member/{$url_name}");
-?> \ No newline at end of file
+}
+else
+ register_error(elgg_echo('group:notdeleted'));
+
+$url_name = get_loggedin_user()->username;
+forward(elgg_get_site_url() . "pg/groups/member/{$url_name}");
diff --git a/mod/groups/actions/featured.php b/mod/groups/actions/featured.php
index a63b93c0d..72ca7eebd 100644
--- a/mod/groups/actions/featured.php
+++ b/mod/groups/actions/featured.php
@@ -1,35 +1,27 @@
-<?php
-
- /**
- * Join a group action.
- *
- * @package ElggGroups
- */
+<?php
+/**
+ * Feature a group
+ *
+ * @package ElggGroups
+ */
- global $CONFIG;
-
- $group_guid = get_input('group_guid');
- $action = get_input('action_type');
-
- $group = get_entity($group_guid);
-
- if($group){
-
- //get the action, is it to feature or unfeature
- if($action == "feature"){
-
- $group->featured_group = "yes";
- system_message(elgg_echo('groups:featuredon'));
-
- }
-
- if($action == "unfeature"){
-
- $group->featured_group = "no";
- system_message(elgg_echo('groups:unfeatured'));
-
- }
-
+
+$group_guid = get_input('group_guid');
+$action = get_input('action_type');
+
+$group = get_entity($group_guid);
+
+if ($group) {
+ //get the action, is it to feature or unfeature
+ if ($action == "feature") {
+ $group->featured_group = "yes";
+ system_message(elgg_echo('groups:featuredon'));
}
-
- forward(REFERER); \ No newline at end of file
+
+ if ($action == "unfeature") {
+ $group->featured_group = "no";
+ system_message(elgg_echo('groups:unfeatured'));
+ }
+}
+
+forward(REFERER);
diff --git a/mod/groups/actions/groupskillinvitation.php b/mod/groups/actions/groupskillinvitation.php
index c5f1d9bf5..503c41939 100644
--- a/mod/groups/actions/groupskillinvitation.php
+++ b/mod/groups/actions/groupskillinvitation.php
@@ -1,26 +1,20 @@
<?php
- /**
- * Delete an invitation to join a closed group.
- *
- * @package ElggGroups
- */
+/**
+ * Delete an invitation to join a closed group.
+ *
+ * @package ElggGroups
+ */
- // Load configuration
- global $CONFIG;
+$user_guid = get_input('user_guid', get_loggedin_userid());
+$group_guid = get_input('group_guid');
- $user_guid = get_input('user_guid', get_loggedin_userid());
- $group_guid = get_input('group_guid');
+$user = get_entity($user_guid);
+$group = get_entity($group_guid);
- $user = get_entity($user_guid);
- $group = get_entity($group_guid);
+// If join request made
+if (check_entity_relationship($group->guid, 'invited', $user->guid)) {
+ remove_entity_relationship($group->guid, 'invited', $user->guid);
+ system_message(elgg_echo("groups:invitekilled"));
+}
- // If join request made
- if (check_entity_relationship($group->guid, 'invited', $user->guid))
- {
- remove_entity_relationship($group->guid, 'invited', $user->guid);
- system_message(elgg_echo("groups:invitekilled"));
- }
-
- forward(REFERER);
-
-?> \ No newline at end of file
+forward(REFERER);
diff --git a/mod/groups/actions/groupskillrequest.php b/mod/groups/actions/groupskillrequest.php
index 7b53fe37b..f7f8a5157 100644
--- a/mod/groups/actions/groupskillrequest.php
+++ b/mod/groups/actions/groupskillrequest.php
@@ -1,26 +1,20 @@
<?php
- /**
- * Delete a user request to join a closed group.
- *
- * @package ElggGroups
- */
+/**
+ * Delete a user request to join a closed group.
+ *
+ * @package ElggGroups
+ */
- // Load configuration
- global $CONFIG;
-
- $user_guid = get_input('user_guid', get_loggedin_userid());
- $group_guid = get_input('group_guid');
-
- $user = get_entity($user_guid);
- $group = get_entity($group_guid);
-
- // If join request made
- if (check_entity_relationship($user->guid, 'membership_request', $group->guid))
- {
- remove_entity_relationship($user->guid, 'membership_request', $group->guid);
- system_message(elgg_echo("groups:joinrequestkilled"));
- }
-
- forward(REFERER);
-
-?> \ No newline at end of file
+$user_guid = get_input('user_guid', get_loggedin_userid());
+$group_guid = get_input('group_guid');
+
+$user = get_entity($user_guid);
+$group = get_entity($group_guid);
+
+// If join request made
+if (check_entity_relationship($user->guid, 'membership_request', $group->guid)) {
+ remove_entity_relationship($user->guid, 'membership_request', $group->guid);
+ system_message(elgg_echo("groups:joinrequestkilled"));
+}
+
+forward(REFERER);
diff --git a/mod/groups/actions/invite.php b/mod/groups/actions/invite.php
index eef8fb5ce..e8eeb3330 100644
--- a/mod/groups/actions/invite.php
+++ b/mod/groups/actions/invite.php
@@ -1,63 +1,54 @@
<?php
-
/**
* Invite a user to join a group
*
* @package ElggGroups
*/
-// Load configuration
-global $CONFIG;
-
$logged_in_user = get_loggedin_user();
$user_guid = get_input('user_guid');
-if (!is_array($user_guid))
+if (!is_array($user_guid)) {
$user_guid = array($user_guid);
+}
$group_guid = get_input('group_guid');
-if (sizeof($user_guid))
-{
- foreach ($user_guid as $u_id)
- {
+if (sizeof($user_guid)) {
+ foreach ($user_guid as $u_id) {
$user = get_entity($u_id);
$group = get_entity($group_guid);
if ( $user && $group) {
- if (($group instanceof ElggGroup) && ($group->canEdit()))
- {
- if (!check_entity_relationship($group->guid, 'invited', $user->guid))
- {
- if ($user->isFriend())
- {
+ if (($group instanceof ElggGroup) && ($group->canEdit())) {
+ if (!check_entity_relationship($group->guid, 'invited', $user->guid)) {
+ if ($user->isFriend()) {
// Create relationship
add_entity_relationship($group->guid, 'invited', $user->guid);
// Send email
- $url = "{$CONFIG->url}pg/groups/invitations/{$user->username}";
- if (notify_user($user->getGUID(), $group->owner_guid,
+ $url = elgg_normalize_url("pg/groups/invitations/$user->username");
+ $result = notify_user($user->getGUID(), $group->owner_guid,
elgg_echo('groups:invite:subject', array($user->name, $group->name)),
elgg_echo('groups:invite:body', array($user->name, $logged_in_user->name, $group->name, $url)),
- NULL))
+ NULL);
+ if ($result) {
system_message(elgg_echo("groups:userinvited"));
- else
+ } else {
register_error(elgg_echo("groups:usernotinvited"));
-
- }
- else
+ }
+ } else {
register_error(elgg_echo("groups:usernotinvited"));
- }
- else
+ }
+ } else {
register_error(elgg_echo("groups:useralreadyinvited"));
- }
- else
+ }
+ } else {
register_error(elgg_echo("groups:notowner"));
+ }
}
}
}
forward(REFERER);
-
-?>
diff --git a/mod/groups/actions/join.php b/mod/groups/actions/join.php
index 95c9660ff..e058cdc22 100644
--- a/mod/groups/actions/join.php
+++ b/mod/groups/actions/join.php
@@ -1,61 +1,50 @@
<?php
- /**
- * Join a group action.
- *
- * @package ElggGroups
- */
+/**
+ * Join a group action.
+ *
+ * @package ElggGroups
+ */
- // Load configuration
- global $CONFIG;
+$user_guid = get_input('user_guid', get_loggedin_userid());
+$group_guid = get_input('group_guid');
- $user_guid = get_input('user_guid', get_loggedin_userid());
- $group_guid = get_input('group_guid');
+// @todo fix for #287
+// disable access to get entity.
+$invitations = groups_get_invited_groups($user_guid, TRUE);
- // @todo fix for #287
- // disable access to get entity.
- $invitations = groups_get_invited_groups($user_guid, TRUE);
+if (in_array($group_guid, $invitations)) {
+ $ia = elgg_set_ignore_access(TRUE);
+}
- if (in_array($group_guid, $invitations)) {
- $ia = elgg_set_ignore_access(TRUE);
- }
-
- $user = get_entity($user_guid);
- $group = get_entity($group_guid);
+$user = get_entity($user_guid);
+$group = get_entity($group_guid);
- set_page_owner($group->guid);
+set_page_owner($group->guid);
- if (($user instanceof ElggUser) && ($group instanceof ElggGroup))
- {
- if ($group->isPublicMembership() || $group->canEdit($user->guid))
- {
- if ($group->join($user))
- {
- system_message(elgg_echo("groups:joined"));
+if (($user instanceof ElggUser) && ($group instanceof ElggGroup)) {
+ if ($group->isPublicMembership() || $group->canEdit($user->guid)) {
+ if ($group->join($user)) {
+ system_message(elgg_echo("groups:joined"));
- // Remove any invite or join request flags
- remove_entity_relationship($group->guid, 'invited', $user->guid);
- remove_entity_relationship($user->guid, 'membership_request', $group->guid);
+ // Remove any invite or join request flags
+ remove_entity_relationship($group->guid, 'invited', $user->guid);
+ remove_entity_relationship($user->guid, 'membership_request', $group->guid);
- // add to river
- add_to_river('river/relationship/member/create','join',$user->guid,$group->guid);
+ // add to river
+ add_to_river('river/relationship/member/create','join',$user->guid,$group->guid);
- forward($group->getURL());
- exit;
- }
- else
- register_error(elgg_echo("groups:cantjoin"));
- }
- else
- {
- // Closed group, request membership
- system_message(elgg_echo('groups:privategroup'));
- forward(elgg_add_action_tokens_to_url("action/groups/joinrequest?user_guid=$user_guid&group_guid=$group_guid", FALSE));
- exit;
+ forward($group->getURL());
+ } else {
+ register_error(elgg_echo("groups:cantjoin"));
}
+ } else {
+ // Closed group, request membership
+ system_message(elgg_echo('groups:privategroup'));
+ forward(elgg_add_action_tokens_to_url("action/groups/joinrequest?user_guid=$user_guid&group_guid=$group_guid", FALSE));
}
- else
- register_error(elgg_echo("groups:cantjoin"));
+} else {
+ register_error(elgg_echo("groups:cantjoin"));
+}
+
+forward(REFERER);
- forward(REFERER);
- exit;
-?>
diff --git a/mod/groups/actions/joinrequest.php b/mod/groups/actions/joinrequest.php
index b61afbed6..c1d41e8e8 100644
--- a/mod/groups/actions/joinrequest.php
+++ b/mod/groups/actions/joinrequest.php
@@ -5,9 +5,6 @@
* @package ElggGroups
*/
-// Load configuration
-global $CONFIG;
-
$user_guid = get_input('user_guid', get_loggedin_userid());
$group_guid = get_input('group_guid');
@@ -27,17 +24,14 @@ $group = get_entity($group_guid);
set_page_owner($group->guid);
// If not a member of this group
-if (($group) && ($user) && (!$group->isMember($user)))
-{
+if (($group) && ($user) && (!$group->isMember($user))) {
// If open group or invite exists
if (
($group->isPublicMembership()) ||
(check_entity_relationship($group->guid, 'invited', $user->guid))
- )
- {
+ ) {
//$ia = elgg_set_ignore_access(TRUE);
- if ($group->join($user))
- {
+ if ($group->join($user)) {
// Remove relationships
remove_entity_relationship($group->guid, 'invited', $user->guid);
remove_entity_relationship($user->guid, 'membership_request', $group->guid);
@@ -47,33 +41,29 @@ if (($group) && ($user) && (!$group->isMember($user)))
elgg_set_ignore_access($ia);
forward($group->getURL());
- exit;
- }
- else {
+ } else {
elgg_set_ignore_access($ia);
system_message(elgg_echo('groups:cantjoin'));
}
- }
- else
- {
+ } else {
// If join request not already made
- if (!check_entity_relationship($user->guid, 'membership_request', $group->guid))
- {
+ if (!check_entity_relationship($user->guid, 'membership_request', $group->guid)) {
// Add membership requested
add_entity_relationship($user->guid, 'membership_request', $group->guid);
// Send email
- $url = "{$CONFIG->url}mod/groups/membershipreq.php?group_guid={$group->guid}";
+ $url = elgg_normalize_url("mod/groups/membershipreq.php?group_guid={$group->guid}");
if (notify_user($group->owner_guid, $user->getGUID(),
elgg_echo('groups:request:subject', array($user->name, $group->name)),
elgg_echo('groups:request:body', array($group->getOwnerEntity()->name, $user->name, $group->name, $user->getURL(), $url)),
- NULL))
+ NULL)) {
system_message(elgg_echo("groups:joinrequestmade"));
- else
+ } else {
register_error(elgg_echo("groups:joinrequestnotmade"));
- }
- else
+ }
+ } else {
system_message(elgg_echo("groups:joinrequestmade"));
+ }
}
}
diff --git a/mod/groups/actions/leave.php b/mod/groups/actions/leave.php
index ebb473817..a9163a3d1 100644
--- a/mod/groups/actions/leave.php
+++ b/mod/groups/actions/leave.php
@@ -1,39 +1,36 @@
<?php
- /**
- * Leave a group action.
- *
- * @package ElggGroups
- */
+/**
+ * Leave a group action.
+ *
+ * @package ElggGroups
+ */
- // Load configuration
- global $CONFIG;
-
- $user_guid = get_input('user_guid');
- $group_guid = get_input('group_guid');
-
- $user = NULL;
- if (!$user_guid) $user = get_loggedin_user();
- else
- $user = get_entity($user_guid);
-
- $group = get_entity($group_guid);
+$user_guid = get_input('user_guid');
+$group_guid = get_input('group_guid');
- set_page_owner($group->guid);
-
- if (($user instanceof ElggUser) && ($group instanceof ElggGroup))
- {
- if ($group->getOwnerGUID() != get_loggedin_userid()) {
- if ($group->leave($user))
- system_message(elgg_echo("groups:left"));
- else
- register_error(elgg_echo("groups:cantleave"));
+$user = NULL;
+if (!$user_guid) {
+ $user = get_loggedin_user();
+} else {
+ $user = get_entity($user_guid);
+}
+
+$group = get_entity($group_guid);
+
+set_page_owner($group->guid);
+
+if (($user instanceof ElggUser) && ($group instanceof ElggGroup)) {
+ if ($group->getOwnerGUID() != get_loggedin_userid()) {
+ if ($group->leave($user)) {
+ system_message(elgg_echo("groups:left"));
} else {
register_error(elgg_echo("groups:cantleave"));
}
- }
- else
+ } else {
register_error(elgg_echo("groups:cantleave"));
-
- forward(REFERER);
- exit;
-?> \ No newline at end of file
+ }
+} else {
+ register_error(elgg_echo("groups:cantleave"));
+}
+
+forward(REFERER);
diff --git a/mod/groups/icon.php b/mod/groups/icon.php
index a6ceaf3b5..59247e9f8 100644
--- a/mod/groups/icon.php
+++ b/mod/groups/icon.php
@@ -1,41 +1,40 @@
<?php
- /**
- * Icon display
- *
- * @package ElggGroups
- */
-
- global $CONFIG;
- require_once(dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php");
-
- $group_guid = get_input('group_guid');
- $group = get_entity($group_guid);
-
- $size = strtolower(get_input('size'));
- if (!in_array($size,array('large','medium','small','tiny','master','topbar')))
- $size = "medium";
-
- $success = false;
-
- $filehandler = new ElggFile();
- $filehandler->owner_guid = $group->owner_guid;
- $filehandler->setFilename("groups/" . $group->guid . $size . ".jpg");
-
- $success = false;
- if ($filehandler->open("read")) {
- if ($contents = $filehandler->read($filehandler->size())) {
- $success = true;
- }
- }
-
- if (!$success) {
- $contents = @file_get_contents($CONFIG->pluginspath . "groups/graphics/default{$size}.jpg");
+/**
+ * Icon display
+ *
+ * @package ElggGroups
+ */
+
+require_once(dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php");
+
+$group_guid = get_input('group_guid');
+$group = get_entity($group_guid);
+
+$size = strtolower(get_input('size'));
+if (!in_array($size,array('large','medium','small','tiny','master','topbar')))
+ $size = "medium";
+
+$success = false;
+
+$filehandler = new ElggFile();
+$filehandler->owner_guid = $group->owner_guid;
+$filehandler->setFilename("groups/" . $group->guid . $size . ".jpg");
+
+$success = false;
+if ($filehandler->open("read")) {
+ if ($contents = $filehandler->read($filehandler->size())) {
+ $success = true;
}
-
- header("Content-type: image/jpeg");
- header('Expires: ' . date('r',time() + 864000));
- header("Pragma: public");
- header("Cache-Control: public");
- header("Content-Length: " . strlen($contents));
- echo $contents;
-?> \ No newline at end of file
+}
+
+if (!$success) {
+ $location = elgg_get_plugin_path() . "groups/graphics/default{$size}.jpg";
+ $contents = @file_get_contents($location);
+}
+
+header("Content-type: image/jpeg");
+header('Expires: ' . date('r',time() + 864000));
+header("Pragma: public");
+header("Cache-Control: public");
+header("Content-Length: " . strlen($contents));
+echo $contents;
diff --git a/mod/invitefriends/actions/invite.php b/mod/invitefriends/actions/invite.php
index a1a6241f0..75311071c 100644
--- a/mod/invitefriends/actions/invite.php
+++ b/mod/invitefriends/actions/invite.php
@@ -6,6 +6,8 @@
* @package ElggInviteFriends
*/
+$site = elgg_get_site_entity();
+
$emails = get_input('emails');
$emailmessage = get_input('emailmessage');
@@ -47,21 +49,21 @@ foreach ($emails as $email) {
$link = elgg_get_site_url() . 'pg/register?friend_guid=' . $current_user->guid . '&invitecode=' . generate_invite_code($current_user->username);
$message = elgg_echo('invitefriends:email', array(
- $CONFIG->site->name,
+ $site->name,
$current_user->name,
$emailmessage,
$link
)
);
- $subject = elgg_echo('invitefriends:subject', array($CONFIG->site->name));
+ $subject = elgg_echo('invitefriends:subject', array($site->name));
// create the from address
- $site = get_entity($CONFIG->site_guid);
+ $site = get_entity($site->guid);
if (($site) && (isset($site->email))) {
$from = $site->email;
} else {
- $from = 'noreply@' . get_site_domain($CONFIG->site_guid);
+ $from = 'noreply@' . get_site_domain($site->guid);
}
elgg_send_email($from, $email, $subject, $message);
diff --git a/mod/invitefriends/views/default/invitefriends/formitems.php b/mod/invitefriends/views/default/invitefriends/formitems.php
index c7af78981..555311dd0 100644
--- a/mod/invitefriends/views/default/invitefriends/formitems.php
+++ b/mod/invitefriends/views/default/invitefriends/formitems.php
@@ -6,10 +6,11 @@
* @package ElggInviteFriends
*/
-if ($CONFIG->allow_registration) {
+if (elgg_get_config('allow_registration')) {
+ $site = elgg_get_site_entity();
$introduction = elgg_echo('invitefriends:introduction');
$message = elgg_echo('invitefriends:message');
- $default = elgg_echo('invitefriends:message:default', array($CONFIG->site->name));
+ $default = elgg_echo('invitefriends:message:default', array($site->name));
echo <<< HTML
<p class="margin-top">
diff --git a/mod/notifications/start.php b/mod/notifications/start.php
index 624207e89..6f489f94d 100644
--- a/mod/notifications/start.php
+++ b/mod/notifications/start.php
@@ -8,7 +8,6 @@
function notifications_plugin_init() {
- global $CONFIG;
elgg_extend_view('css/screen','notifications/css');
@@ -28,8 +27,9 @@ function notifications_plugin_init() {
elgg_register_event_handler('create', 'friend', 'notifications_update_friend_notify');
elgg_register_plugin_hook_handler('access:collections:add-user', 'collection', 'notifications_update_collection_notify');
- elgg_register_action("notificationsettings/save", $CONFIG->pluginspath . "notifications/actions/save.php");
- elgg_register_action("notificationsettings/groupsave", $CONFIG->pluginspath . "notifications/actions/groupsave.php");
+ $actions_base = elgg_get_plugin_path() . 'notifications/actions';
+ elgg_register_action("notificationsettings/save", "$actions_base/save.php");
+ elgg_register_action("notificationsettings/groupsave", "$actions_base/groupsave.php");
}
/**
@@ -38,20 +38,21 @@ function notifications_plugin_init() {
* @param array $page Array of url parameters
*/
function notifications_page_handler($page) {
- global $CONFIG;
// default to personal notifications
if (!isset($page[0])) {
$page[0] = 'personal';
}
+ $base = elgg_get_plugin_path() . 'notifications';
+
switch ($page[0]) {
case 'group':
- require $CONFIG->pluginspath . "notifications/groups.php";
+ require "$base/groups.php";
break;
case 'personal':
default:
- require $CONFIG->pluginspath . "notifications/index.php";
+ require "$base/index.php";
break;
}
diff --git a/mod/pages/start.php b/mod/pages/start.php
index b4e082f20..afa6651e3 100644
--- a/mod/pages/start.php
+++ b/mod/pages/start.php
@@ -207,20 +207,9 @@ function page_notify_message($hook, $entity_type, $returnvalue, $params) {
if (($entity instanceof ElggEntity) && (($entity->getSubtype() == 'page_top') || ($entity->getSubtype() == 'page'))) {
$descr = $entity->description;
$title = $entity->title;
- global $CONFIG;
$url = elgg_get_site_url() . "pg/view/" . $entity->guid;
- if ($method == 'sms') {
- $owner = $entity->getOwnerEntity();
- return $owner->name . ' ' . elgg_echo("pages:via") . ': ' . $url . ' (' . $title . ')';
- }
- if ($method == 'email') {
- $owner = $entity->getOwnerEntity();
- return $owner->name . ' ' . elgg_echo("pages:via") . ': ' . $title . "\n\n" . $descr . "\n\n" . $entity->getURL();
- }
- if ($method == 'site') {
- $owner = $entity->getOwnerEntity();
- return $owner->name . ' ' . elgg_echo("pages:via") . ': ' . $title . "\n\n" . $descr . "\n\n" . $entity->getURL();
- }
+ $owner = $entity->getOwnerEntity();
+ return $owner->name . ' ' . elgg_echo("pages:via") . ': ' . $title . "\n\n" . $descr . "\n\n" . $entity->getURL();
}
return null;
}
diff --git a/mod/profile/icon.php b/mod/profile/icon.php
index 2848c3e4d..a624c0811 100644
--- a/mod/profile/icon.php
+++ b/mod/profile/icon.php
@@ -35,9 +35,8 @@ if ($filehandler->open("read")) {
}
if (!$success) {
- global $CONFIG;
- $path = elgg_view('icon/user/default/'.$size);
- header("Location: {$path}");
+ $path = elgg_view("icon/user/default/$size");
+ header("Location: $path");
exit;
}
diff --git a/mod/profile/start.php b/mod/profile/start.php
index 49f310882..06c5dfdc2 100644
--- a/mod/profile/start.php
+++ b/mod/profile/start.php
@@ -11,7 +11,6 @@ elgg_register_event_handler('init', 'system', 'profile_init', 1);
* Profile init function
*/
function profile_init() {
- global $CONFIG;
// Register a URL handler for users - this means that profile_url()
// will dictate the URL for all ElggUser objects
diff --git a/mod/sitepages/sitepages_functions.php b/mod/sitepages/sitepages_functions.php
index 4410bd7e7..5a2fcd8ee 100644
--- a/mod/sitepages/sitepages_functions.php
+++ b/mod/sitepages/sitepages_functions.php
@@ -16,9 +16,8 @@
* @return mixed ElggSitePage on success, FALSE on fail
*/
function sitepages_get_sitepage_object($page_type) {
- global $CONFIG;
- $page_guid = get_private_setting($CONFIG->site->getGUID(), "sitepages:$page_type");
+ $page_guid = get_private_setting(elgg_get_site_entity()->guid, "sitepages:$page_type");
$sitepage = get_entity($page_guid);
if ($sitepage instanceof ElggSitePage || $sitepage->page_type == $page_type) {
@@ -35,14 +34,15 @@ function sitepages_get_sitepage_object($page_type) {
* @return mixed ElggSitePage on success, FALSE on fail.
*/
function sitepages_create_sitepage_object($page_type) {
- global $CONFIG;
$sitepage = new ElggSitePage();
$sitepage->page_type = $page_type;
$sitepage->access_id = ACCESS_PUBLIC;
$sitepage->save();
- if ($sitepage->save() && set_private_setting($CONFIG->site->getGUID(), "sitepages:$page_type", $sitepage->getGUID())) {
+ $site = elgg_get_site_entity();
+
+ if ($sitepage->save() && set_private_setting($site->getGUID(), "sitepages:$page_type", $sitepage->getGUID())) {
return $sitepage;
}
diff --git a/mod/twitterservice/start.php b/mod/twitterservice/start.php
index 83e98d618..2b6e7895f 100644
--- a/mod/twitterservice/start.php
+++ b/mod/twitterservice/start.php
@@ -8,9 +8,10 @@
* @copyright Curverider Ltd 2008-2010
*/
-register_elgg_event_handler('init','system','twitterservice_init');
+register_elgg_event_handler('init', 'system', 'twitterservice_init');
+
function twitterservice_init() {
- global $CONFIG;
+
$notice_id = 'twitter_services_disable';
if (!is_plugin_enabled('oauth_lib')) {
@@ -26,8 +27,9 @@ function twitterservice_init() {
elgg_delete_admin_notice($notice_id);
// require libraries
- require_once "{$CONFIG->pluginspath}twitterservice/vendors/twitteroauth/twitterOAuth.php";
- require_once "{$CONFIG->pluginspath}twitterservice/twitterservice_lib.php";
+ $base = elgg_get_plugin_path() . 'twitterservice';
+ require_once "$base/vendors/twitteroauth/twitterOAuth.php";
+ require_once "$base/twitterservice_lib.php";
// extend site views
elgg_extend_view('metatags', 'twitterservice/metatags');
diff --git a/mod/twitterservice/twitterservice_lib.php b/mod/twitterservice/twitterservice_lib.php
index 5f8768949..0251a9208 100644
--- a/mod/twitterservice/twitterservice_lib.php
+++ b/mod/twitterservice/twitterservice_lib.php
@@ -26,21 +26,19 @@ function twitterservice_allow_sign_on_with_twitter() {
}
function twitterservice_forward() {
- global $CONFIG;
// sanity check
if (!twitterservice_allow_sign_on_with_twitter()) {
forward();
}
- $callback = "{$CONFIG->site->url}pg/twitterservice/login";
+ $callback = elgg_normalize_url("pg/twitterservice/login");
$request_link = twitterservice_get_authorize_url($callback);
forward($request_link);
}
function twitterservice_login() {
- global $CONFIG;
// sanity check
if (!twitterservice_allow_sign_on_with_twitter()) {
@@ -79,7 +77,7 @@ function twitterservice_login() {
// create new user
if (!$user) {
// check new registration allowed
- if (!$CONFIG->allow_registration) {
+ if (!elgg_get_config('allow_registration')) {
register_error(elgg_echo('registerdisabled'));
forward();
}
diff --git a/mod/twitterservice/views/default/usersettings/twitterservice/edit.php b/mod/twitterservice/views/default/usersettings/twitterservice/edit.php
index 95a2a2fd6..eb5a50969 100644
--- a/mod/twitterservice/views/default/usersettings/twitterservice/edit.php
+++ b/mod/twitterservice/views/default/usersettings/twitterservice/edit.php
@@ -15,7 +15,7 @@ if (!$access_key || !$access_secret) {
$request_link = twitterservice_get_authorize_url();
echo '<p>' . sprintf(elgg_echo('twitterservice:usersettings:request'), $request_link) . '</p>';
} else {
- $url = "{$CONFIG->site->url}pg/twitterservice/revoke";
+ $url = elgg_get_site_url() . "pg/twitterservice/revoke";
echo '<p class="twitter_anywhere">' . sprintf(elgg_echo('twitterservice:usersettings:authorized'), $twitter_name) . '</p>';
echo '<p>' . sprintf(elgg_echo('twitterservice:usersettings:revoke'), $url) . '</p>';
}
diff --git a/mod/uservalidationbyemail/lib/functions.php b/mod/uservalidationbyemail/lib/functions.php
index ab382c059..b28e4a127 100644
--- a/mod/uservalidationbyemail/lib/functions.php
+++ b/mod/uservalidationbyemail/lib/functions.php
@@ -29,7 +29,6 @@ function uservalidationbyemail_generate_code($user_guid, $email_address) {
* @return mixed
*/
function uservalidationbyemail_request_validation($user_guid) {
- global $CONFIG;
$site_url = elgg_get_site_url();
@@ -40,12 +39,12 @@ function uservalidationbyemail_request_validation($user_guid) {
// Work out validate link
$code = uservalidationbyemail_generate_code($user_guid, $user->email);
$link = "{$site_url}pg/uservalidationbyemail/confirm?u=$user_guid&c=$code";
- $site = $CONFIG->site;
+ $site = elgg_get_site_entity();
// Send validation email
$subject = elgg_echo('email:validate:subject', array($user->name, $site->name));
$body = elgg_echo('email:validate:body', array($user->name, $site->name, $link, $site->name, $site->url));
- $result = notify_user($user->guid, $CONFIG->site->guid, $subject, $body, NULL, 'email');
+ $result = notify_user($user->guid, $site->guid, $subject, $body, NULL, 'email');
if ($result) {
system_message(elgg_echo('uservalidationbyemail:registerok'));