add 'hellbanned' user class, with support from the comments extension
This commit is contained in:
parent
7c95981319
commit
1b73dd4ddc
@ -36,7 +36,7 @@ _d("WH_SPLITS", 1); // int how many levels of subfolders to put in
|
||||
_d("VERSION", 'trunk'); // string shimmie version
|
||||
_d("TIMEZONE", null); // string timezone
|
||||
_d("MIN_FREE_SPACE",100*1024*1024); // int disable uploading if there's less than MIN_FREE_SPACE bytes free space
|
||||
_d("CORE_EXTS", "bbcode,user,mail,upload,image,view,handle_pixel,ext_manager,setup,upgrade,handle_404,comment,tag_list,index,tag_edit,alias_editor"); // extensions to always enable
|
||||
_d("CORE_EXTS", "bbcode,user,mail,upload,image,view,handle_pixel,ext_manager,setup,upgrade,handle_404,comment,tag_list,index,tag_edit,alias_editor,hellban"); // extensions to always enable
|
||||
_d("EXTRA_EXTS", ""); // optional extra extensions
|
||||
|
||||
|
||||
|
@ -99,6 +99,9 @@ new UserClass("base", null, array(
|
||||
"edit_other_vote" => False,
|
||||
"view_sysinfo" => False,
|
||||
|
||||
"hellbanned" => False,
|
||||
"view_hellbanned" => False,
|
||||
|
||||
"protected" => False, # only admins can modify protected users (stops a moderator changing an admin's password)
|
||||
));
|
||||
|
||||
@ -152,8 +155,13 @@ new UserClass("admin", "base", array(
|
||||
"bulk_edit_vote" => True,
|
||||
"edit_other_vote" => True,
|
||||
"view_sysinfo" => True,
|
||||
"view_hellbanned" => True,
|
||||
"protected" => True,
|
||||
));
|
||||
|
||||
new UserClass("hellbanned", "user", array(
|
||||
"hellbanned" => True,
|
||||
));
|
||||
|
||||
@include_once "data/config/user-classes.conf.php";
|
||||
?>
|
||||
|
@ -42,6 +42,7 @@ class Comment {
|
||||
$this->owner_id = $row['user_id'];
|
||||
$this->owner_name = $row['user_name'];
|
||||
$this->owner_email = $row['user_email']; // deprecated
|
||||
$this->owner_class = $row['user_class'];
|
||||
$this->comment = $row['comment'];
|
||||
$this->comment_id = $row['comment_id'];
|
||||
$this->image_id = $row['image_id'];
|
||||
@ -335,7 +336,7 @@ class CommentList extends Extension {
|
||||
global $database;
|
||||
$rows = $database->get_all("
|
||||
SELECT
|
||||
users.id as user_id, users.name as user_name, users.email as user_email,
|
||||
users.id as user_id, users.name as user_name, users.email as user_email, users.class as user_class,
|
||||
comments.comment as comment, comments.id as comment_id,
|
||||
comments.image_id as image_id, comments.owner_ip as poster_ip,
|
||||
comments.posted as posted
|
||||
@ -356,7 +357,7 @@ class CommentList extends Extension {
|
||||
global $database;
|
||||
$rows = $database->get_all("
|
||||
SELECT
|
||||
users.id as user_id, users.name as user_name, users.email as user_email,
|
||||
users.id as user_id, users.name as user_name, users.email as user_email, users.class as user_class,
|
||||
comments.comment as comment, comments.id as comment_id,
|
||||
comments.image_id as image_id, comments.owner_ip as poster_ip,
|
||||
comments.posted as posted
|
||||
@ -379,7 +380,7 @@ class CommentList extends Extension {
|
||||
$i_image_id = int_escape($image_id);
|
||||
$rows = $database->get_all("
|
||||
SELECT
|
||||
users.id as user_id, users.name as user_name, users.email as user_email,
|
||||
users.id as user_id, users.name as user_name, users.email as user_email, users.class as user_class,
|
||||
comments.comment as comment, comments.id as comment_id,
|
||||
comments.image_id as image_id, comments.owner_ip as poster_ip,
|
||||
comments.posted as posted
|
||||
|
@ -242,13 +242,14 @@ class CommentListTheme extends Themelet {
|
||||
$stripped_nonl = str_replace("\n", "\\n", substr($tfe->stripped, 0, 50));
|
||||
$stripped_nonl = str_replace("\r", "\\r", $stripped_nonl);
|
||||
|
||||
$hb = ($comment->owner_class == "hellbanned" ? "hb" : "");
|
||||
if($trim) {
|
||||
return '
|
||||
<div class="comment">
|
||||
'.$h_userlink.': '.$h_comment.'
|
||||
<a href="'.make_link('post/view/'.$i_image_id.'#c'.$i_comment_id).'">>>></a>
|
||||
return "
|
||||
<div class=\"comment $hb\">
|
||||
$h_userlink: $h_comment
|
||||
<a href=\"".make_link("post/view/$i_image_id#c$i_comment_id")."\">>>></a>
|
||||
</div>
|
||||
';
|
||||
";
|
||||
}
|
||||
else {
|
||||
$h_avatar = "";
|
||||
@ -262,15 +263,15 @@ class CommentListTheme extends Themelet {
|
||||
$h_del = $user->can("delete_comment") ?
|
||||
' - <a onclick="return confirm(\'Delete comment by '.$h_name.':\\n'.$stripped_nonl.'\');" '.
|
||||
'href="'.make_link('comment/delete/'.$i_comment_id.'/'.$i_image_id).'">Del</a>' : '';
|
||||
return '
|
||||
<div class="comment" id="c'.$i_comment_id.'">
|
||||
<div class="info">
|
||||
'.$h_avatar.'
|
||||
'.$h_timestamp.$h_reply.$h_ip.$h_del.'
|
||||
return "
|
||||
<div class=\"comment $hb\" id=\"c$i_comment_id\">
|
||||
<div class=\"info\">
|
||||
$h_avatar
|
||||
$h_timestamp$h_reply$h_ip$h_del
|
||||
</div>
|
||||
'.$h_userlink.': '.$h_comment.'
|
||||
$h_userlink: $h_comment
|
||||
</div>
|
||||
';
|
||||
";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
21
ext/hellban/main.php
Normal file
21
ext/hellban/main.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
class HellBan extends Extension {
|
||||
public function onPageRequest(PageRequestEvent $event) {
|
||||
global $page, $user;
|
||||
|
||||
if($user->can("hellbanned")) {
|
||||
$s = "";
|
||||
}
|
||||
else if($user->can("view_hellbanned")) {
|
||||
$s = "border: 1px solid red !important;";
|
||||
}
|
||||
else {
|
||||
$s = "display: none !important;";
|
||||
}
|
||||
|
||||
if($s) {
|
||||
$page->add_html_header("<style>.hb { $s }</style>");
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
@ -212,8 +212,15 @@ class UserPage extends Extension {
|
||||
global $page, $user, $config;
|
||||
|
||||
$h_join_date = autodate($event->display_user->join_date);
|
||||
if($event->display_user->can("hellbanned")) {
|
||||
$h_class = $event->display_user->class->parent->name;
|
||||
}
|
||||
else {
|
||||
$h_class = $event->display_user->class->name;
|
||||
}
|
||||
|
||||
$event->add_stats("Joined: $h_join_date", 10);
|
||||
$event->add_stats("Class: {$event->display_user->class->name}", 90);
|
||||
$event->add_stats("Class: $h_class", 90);
|
||||
|
||||
$av = $event->display_user->get_avatar_html();
|
||||
if($av) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user