aboutsummaryrefslogtreecommitdiff
path: root/mod
diff options
context:
space:
mode:
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-01-09 14:21:48 +0000
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-01-09 14:21:48 +0000
commite90692bc720cf4c520ee36c603395cf1e1b80b45 (patch)
tree63cb37887110ff6c782b65da036b7e74b6b08884 /mod
parent6588ff3eb201cb9d9834323e670771daa87696c0 (diff)
downloadelgg-e90692bc720cf4c520ee36c603395cf1e1b80b45.tar.gz
elgg-e90692bc720cf4c520ee36c603395cf1e1b80b45.tar.bz2
Closes #668: Banning now works through a flag in the users_entity table. Database upgrade required.
* Added ElggUser::isBanned(); * Added 'banned' column to users_entity * Modified ban() and unban() * Modified pam functions to check $user->isBanned() * Modified login() to check $user->isBanned() * Modified sessions_init() to check isBanned() and destroy session accordingly * Modified profile views to highlight banned users and prevent menus for non-admin users. git-svn-id: https://code.elgg.org/elgg/trunk@2554 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod')
-rw-r--r--mod/profile/views/default/profile/css.php7
-rw-r--r--mod/profile/views/default/profile/gallery.php12
-rw-r--r--mod/profile/views/default/profile/icon.php7
-rw-r--r--mod/profile/views/default/profile/listing.php31
-rw-r--r--mod/profile/views/default/profile/menu/adminlinks.php2
-rw-r--r--mod/profile/views/default/profile/profilelinks.php48
-rw-r--r--mod/profile/views/default/profile/userdetails.php11
7 files changed, 85 insertions, 33 deletions
diff --git a/mod/profile/views/default/profile/css.php b/mod/profile/views/default/profile/css.php
index 6162170e5..f4704b32a 100644
--- a/mod/profile/views/default/profile/css.php
+++ b/mod/profile/views/default/profile/css.php
@@ -90,4 +90,11 @@ div.usericon a.icon img {
}
.user_menu_admin a {
color:#cc0033;
+}
+
+/* Banned user */
+#profile_banned {
+ background-color:#FF8888;
+ border:3px solid #FF0000;
+ padding:2px;
} \ No newline at end of file
diff --git a/mod/profile/views/default/profile/gallery.php b/mod/profile/views/default/profile/gallery.php
index 4db26c8bd..80f614754 100644
--- a/mod/profile/views/default/profile/gallery.php
+++ b/mod/profile/views/default/profile/gallery.php
@@ -21,21 +21,25 @@
} */
-
$icon = elgg_view(
"profile/icon", array(
'entity' => $vars['entity'],
'size' => 'medium',
)
- );
+ );
+
+ $banned = $vars['entity']->isBanned();
$rel = "";
if (page_owner() == $vars['entity']->guid)
$rel = 'me';
else if (check_entity_relationship(page_owner(), 'friend', $vars['entity']->guid))
$rel = 'friend';
-
- $info .= "<p><b><a href=\"" . $vars['entity']->getUrl() . "\" rel=\"$rel\">" . $vars['entity']->name . "</a></b></p>";
+
+ if (!$banned)
+ $info .= "<p><b><a href=\"" . $vars['entity']->getUrl() . "\" rel=\"$rel\">" . $vars['entity']->name . "</a></b></p>";
+ else
+ $info .= "<p><b><strike>" . $vars['entity']->name . "</b></strike><br />".elgg_echo('profile:banned')."</p>";
// echo elgg_view_listing($icon, $info);
echo elgg_view('search/gallery_listing',array('icon' => $icon, 'info' => $info));
diff --git a/mod/profile/views/default/profile/icon.php b/mod/profile/views/default/profile/icon.php
index fcdbfa70c..0710cf6c5 100644
--- a/mod/profile/views/default/profile/icon.php
+++ b/mod/profile/views/default/profile/icon.php
@@ -68,11 +68,12 @@
} else {
echo elgg_view('profile/menu/links',$vars);
}
-
?>
-
</div>
- <a href="<?php echo $vars['entity']->getURL(); ?>" class="icon" ><?php
+ <?php
+ if ((isadminloggedin()) || (!$vars['entity']->isBanned())) {
+ ?><a href="<?php echo $vars['entity']->getURL(); ?>" class="icon" ><?php
+ }
}
diff --git a/mod/profile/views/default/profile/listing.php b/mod/profile/views/default/profile/listing.php
index eb991be07..b9c6a0959 100644
--- a/mod/profile/views/default/profile/listing.php
+++ b/mod/profile/views/default/profile/listing.php
@@ -28,7 +28,9 @@
'entity' => $vars['entity'],
'size' => 'small',
)
- );
+ );
+
+ $banned = $vars['entity']->isBanned();
// Simple XFN
$rel = "";
@@ -36,13 +38,28 @@
$rel = 'me';
else if (check_entity_relationship(page_owner(), 'friend', $vars['entity']->guid))
$rel = 'friend';
+
+ if (!$banned) {
+ $info .= "<p><b><a href=\"" . $vars['entity']->getUrl() . "\" rel=\"$rel\">" . $vars['entity']->name . "</a></b></p>";
- $info .= "<p><b><a href=\"" . $vars['entity']->getUrl() . "\" rel=\"$rel\">" . $vars['entity']->name . "</a></b></p>";
-
- $location = $vars['entity']->location;
- if (!empty($location)) {
- $info .= "<p class=\"owner_timestamp\">" . elgg_echo("profile:location") . ": " . elgg_view("output/tags",array('value' => $vars['entity']->location)) . "</p>";
- }
+ $location = $vars['entity']->location;
+ if (!empty($location)) {
+ $info .= "<p class=\"owner_timestamp\">" . elgg_echo("profile:location") . ": " . elgg_view("output/tags",array('value' => $vars['entity']->location)) . "</p>";
+ }
+ }
+ else
+ {
+ $info .= "<p><b><strike>";
+ if (isadminloggedin())
+ $info .= "<a href=\"" . $vars['entity']->getUrl() . "\">";
+ $info .= $vars['entity']->name;
+ if (isadminloggedin())
+ $info .= "</a>";
+ $info .= "</strike></b></p>";
+
+ $info .= "<p class=\"owner_timestamp\">" . elgg_echo('profile:banned') . "</p>";
+
+ }
echo elgg_view_listing($icon, $info);
diff --git a/mod/profile/views/default/profile/menu/adminlinks.php b/mod/profile/views/default/profile/menu/adminlinks.php
index 59aca6902..efd6201ed 100644
--- a/mod/profile/views/default/profile/menu/adminlinks.php
+++ b/mod/profile/views/default/profile/menu/adminlinks.php
@@ -21,7 +21,7 @@
?>
<a href="<?php echo $vars['url']; ?>pg/settings/user/<?php echo $vars['entity']->username; ?>/"><?php echo elgg_echo('profile:editdetails'); ?></a>
<?php
- if ($vars['entity']->isEnabled()) {
+ if (!$vars['entity']->isBanned()) {
?><a href="<?php echo $vars['url']; ?>actions/admin/user/ban?guid=<?php echo $vars['entity']->guid; ?>&__elgg_token=<?php echo $token; ?>&__elgg_ts=<?php echo $ts; ?>"><?php echo elgg_echo("ban"); ?></a><?php
} else {
?><a href="<?php echo $vars['url']; ?>actions/admin/user/unban?guid=<?php echo $vars['entity']->guid; ?>&__elgg_token=<?php echo $token; ?>&__elgg_ts=<?php echo $ts; ?>"><?php echo elgg_echo("unban"); ?></a><?php
diff --git a/mod/profile/views/default/profile/profilelinks.php b/mod/profile/views/default/profile/profilelinks.php
index 5873fe210..ff4a97e68 100644
--- a/mod/profile/views/default/profile/profilelinks.php
+++ b/mod/profile/views/default/profile/profilelinks.php
@@ -17,22 +17,34 @@
?>
<?php
-
- //check to see if the user is looking at their own profile
- if($_SESSION['user']->guid == page_owner()){
-
- echo "<div id=\"profile_menu_wrapper\">"; //start the wrapper div
- echo elgg_view("profile/menu/actions",$vars);//grab action links such as make friend
- echo elgg_view("profile/menu/linksownpage",$vars); // an different view for user's own profile
- echo "</div>"; //close wrapper div
-
- } else {
-
- echo "<div id=\"profile_menu_wrapper\">"; //start the wrapper div
- echo elgg_view("profile/menu/actions",$vars); //grab action links such as make friend
- echo elgg_view("profile/menu/links",$vars); //passive links to items such as user blog etc
- echo "</div>"; //close wrapper div
-
- }
-
+
+ $banned = false;
+ $owner = page_owner_entity();
+ if ($owner) $banned = $owner->isBanned();
+
+ // Allow menus if not banned or admin logged in
+ if ((!$banned) || (isadminloggedin()))
+ {
+ //check to see if the user is looking at their own profile
+ if ($_SESSION['user']->guid == page_owner()){
+
+ echo "<div id=\"profile_menu_wrapper\">"; //start the wrapper div
+ echo elgg_view("profile/menu/actions",$vars);//grab action links such as make friend
+ echo elgg_view("profile/menu/linksownpage",$vars); // an different view for user's own profile
+ echo "</div>"; //close wrapper div
+
+ } else {
+
+ echo "<div id=\"profile_menu_wrapper\">"; //start the wrapper div
+ echo elgg_view("profile/menu/actions",$vars); //grab action links such as make friend
+ echo elgg_view("profile/menu/links",$vars); //passive links to items such as user blog etc
+ echo "</div>"; //close wrapper div
+
+ }
+ }
+ else
+ { // Some nice spacing
+ echo "<div id=\"profile_menu_wrapper\">"; //start the wrapper div
+ echo "</div>"; //close wrapper div
+ }
?> \ No newline at end of file
diff --git a/mod/profile/views/default/profile/userdetails.php b/mod/profile/views/default/profile/userdetails.php
index 48b49426f..8463ee9f2 100644
--- a/mod/profile/views/default/profile/userdetails.php
+++ b/mod/profile/views/default/profile/userdetails.php
@@ -134,9 +134,20 @@
<div id="profile_info_column_right">
<p class="profile_aboutme_title"><b><?php echo elgg_echo("profile:aboutme"); ?></b></p>
<?php echo autop($vars['entity']->description); ?>
+
+ <?php if ($vars['entity']->isBanned()) { ?>
+ <div id="profile_banned">
+ <?php echo elgg_echo('profile:banned'); ?>
+ </div><!-- /#profile_info_column_right -->
+
+ <?php } ?>
+
</div><!-- /#profile_info_column_right -->
</td>
+
+
+
</tr>
<?php } ?>