Add post flagging
parent
956edd63a9
commit
9410f6bd31
@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* projectname is more free software. It is licensed under the WTFPL, which
|
||||||
|
* allows you to do pretty much anything with it, without having to
|
||||||
|
* ask permission. Commercial use is allowed, and no attribution is
|
||||||
|
* required. We do politely request that you share your modifications
|
||||||
|
* to benefit other developers, but you are under no enforced
|
||||||
|
* obligation to do so :)
|
||||||
|
*
|
||||||
|
* Please read the accompanying LICENSE document for the full WTFPL
|
||||||
|
* licensing text.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if(!isset($_APP)) { die("Unauthorized."); }
|
||||||
|
|
||||||
|
class ForumFlag extends CPHPDatabaseRecordClass
|
||||||
|
{
|
||||||
|
public $table_name = "forum_flags";
|
||||||
|
public $fill_query = "SELECT * FROM forum_flags WHERE `Id` = :Id";
|
||||||
|
public $verify_query = "SELECT * FROM forum_flags WHERE `Id` = :Id";
|
||||||
|
|
||||||
|
public $prototype = array(
|
||||||
|
'string' => array(
|
||||||
|
'Reason' => "Reason"
|
||||||
|
),
|
||||||
|
'numeric' => array(
|
||||||
|
"UserId" => "UserId",
|
||||||
|
"PostId" => "PostId",
|
||||||
|
"ModeratorId" => "ModeratorId"
|
||||||
|
),
|
||||||
|
'boolean' => array(
|
||||||
|
"IsReviewed" => "Reviewed",
|
||||||
|
"IsValid" => "Valid"
|
||||||
|
),
|
||||||
|
'timestamp' => array(
|
||||||
|
"FlagDate" => "FlagDate",
|
||||||
|
"ReviewDate" => "ReviewDate"
|
||||||
|
),
|
||||||
|
'user' => array(
|
||||||
|
"User" => "UserId",
|
||||||
|
"Moderator" => "ModeratorId"
|
||||||
|
),
|
||||||
|
'forumpost' => array(
|
||||||
|
"Post" => "PostId"
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* Box is more free software. It is licensed under the WTFPL, which
|
||||||
|
* allows you to do pretty much anything with it, without having to
|
||||||
|
* ask permission. Commercial use is allowed, and no attribution is
|
||||||
|
* required. We do politely request that you share your modifications
|
||||||
|
* to benefit other developers, but you are under no enforced
|
||||||
|
* obligation to do so :)
|
||||||
|
*
|
||||||
|
* Please read the accompanying LICENSE document for the full WTFPL
|
||||||
|
* licensing text.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if(!isset($_APP)) { die("Unauthorized."); }
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$sForumPost = new ForumPost($router->uParameters[1]);
|
||||||
|
}
|
||||||
|
catch (NotFoundException $e)
|
||||||
|
{
|
||||||
|
die("No such post exists.");
|
||||||
|
}
|
||||||
|
|
||||||
|
$done = false;
|
||||||
|
|
||||||
|
if(strtolower($_SERVER['REQUEST_METHOD']) == "post")
|
||||||
|
{
|
||||||
|
$sForumPost->Flag($sCurrentUser->sId, $_POST['reason']);
|
||||||
|
$done = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
echo(NewTemplater::Render("forum/flag", $locale->strings, array(
|
||||||
|
"snippet" => purify_html(Markdown(cut_text($sForumPost->uBody, 500))),
|
||||||
|
"done" => $done
|
||||||
|
)));
|
@ -0,0 +1,120 @@
|
|||||||
|
body
|
||||||
|
{
|
||||||
|
background-color: #E6FFE6;
|
||||||
|
font-family: sans-serif;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1
|
||||||
|
{
|
||||||
|
background-color: #24431F;
|
||||||
|
color: white;
|
||||||
|
font-size: 19px;
|
||||||
|
padding: 7px 9px;
|
||||||
|
}
|
||||||
|
|
||||||
|
p
|
||||||
|
{
|
||||||
|
padding: 0px 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
blockquote
|
||||||
|
{
|
||||||
|
border: 1px solid #609657;
|
||||||
|
padding: 5px 6px;
|
||||||
|
margin: 5px 0px;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #585858;
|
||||||
|
max-height: 80px;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
blockquote p
|
||||||
|
{
|
||||||
|
margin: 6px 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
blockquote blockquote
|
||||||
|
{
|
||||||
|
border: 0px;
|
||||||
|
padding: 5px 0px 5px 5px;
|
||||||
|
margin: 5px 0px 5px 4px;
|
||||||
|
border-left: 3px solid #80B380;
|
||||||
|
}
|
||||||
|
|
||||||
|
blockquote blockquote p
|
||||||
|
{
|
||||||
|
margin: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
form .field
|
||||||
|
{
|
||||||
|
margin-bottom: 7px;
|
||||||
|
padding-left: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
label, input, textarea, button
|
||||||
|
{
|
||||||
|
display: block;
|
||||||
|
box-sizing: border-box;
|
||||||
|
-moz-box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
label, input, select
|
||||||
|
{
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
label
|
||||||
|
{
|
||||||
|
width: 15%;
|
||||||
|
font-size: 15px;
|
||||||
|
color: #397739;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-top: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
input, textarea, select
|
||||||
|
{
|
||||||
|
border: 1px solid #397739;
|
||||||
|
background-color: white;
|
||||||
|
border-radius: 1px;
|
||||||
|
margin-top: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
input, select
|
||||||
|
{
|
||||||
|
width: 66%;
|
||||||
|
font-size: 15px;
|
||||||
|
padding: 1px 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
button
|
||||||
|
{
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: bold;
|
||||||
|
background: #f5fff2; /* Old browsers */
|
||||||
|
background: -moz-linear-gradient(top, #f5fff2 34%, #e9f7d7 74%, #ddefc9 100%); /* FF3.6+ */
|
||||||
|
background: -webkit-gradient(linear, left top, left bottom, color-stop(34%,#f5fff2), color-stop(74%,#e9f7d7), color-stop(100%,#ddefc9)); /* Chrome,Safari4+ */
|
||||||
|
background: -webkit-linear-gradient(top, #f5fff2 34%,#e9f7d7 74%,#ddefc9 100%); /* Chrome10+,Safari5.1+ */
|
||||||
|
background: -o-linear-gradient(top, #f5fff2 34%,#e9f7d7 74%,#ddefc9 100%); /* Opera 11.10+ */
|
||||||
|
background: -ms-linear-gradient(top, #f5fff2 34%,#e9f7d7 74%,#ddefc9 100%); /* IE10+ */
|
||||||
|
background: linear-gradient(to bottom, #f5fff2 34%,#e9f7d7 74%,#ddefc9 100%); /* W3C */
|
||||||
|
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f5fff2', endColorstr='#ddefc9',GradientType=0 ); /* IE6-9 */
|
||||||
|
color: #2E4F2B;
|
||||||
|
border: 1px solid silver;
|
||||||
|
border-radius: 4px;
|
||||||
|
padding: 4px 6px;
|
||||||
|
box-shadow: 0px 0px 4px 0px #c0dbba;
|
||||||
|
-webkit-box-shadow: 0px 0px 4px 0px #c0dbba;
|
||||||
|
-moz-box-shadow: 0px 0px 4px 0px #c0dbba;
|
||||||
|
-o-box-shadow: 0px 0px 4px 0px #c0dbba;
|
||||||
|
-ms-box-shadow: 0px 0px 4px 0px #c0dbba;
|
||||||
|
text-shadow: 1px 1px 0px #bbe6a6;
|
||||||
|
-webkit-text-shadow: 1px 1px 0px #bbe6a6;
|
||||||
|
-moz-text-shadow: 1px 1px 0px #bbe6a6;
|
||||||
|
-o-text-shadow: 1px 1px 0px #bbe6a6;
|
||||||
|
-ms-text-shadow: 1px 1px 0px #bbe6a6;
|
||||||
|
width: 15%;
|
||||||
|
float: right;
|
||||||
|
}
|
@ -1,15 +1,41 @@
|
|||||||
<!doctype html>
|
<!doctype html>
|
||||||
<head>
|
<head>
|
||||||
<title>Flag post</title>
|
<title>Flag post</title>
|
||||||
<link rel="stylesheet" href="/static/style/flag.css">
|
<link rel="stylesheet" href="/static/css/flag.css?2">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>Flag abusive post</h1>
|
<h1>Flag abusive post</h1>
|
||||||
<p>
|
|
||||||
If you believe this post violates the community
|
{%if done == false}
|
||||||
rules or should otherwise be removed, please fill
|
<blockquote>
|
||||||
in a reason or explanation below and hit the Flag
|
{%?snippet}
|
||||||
button.
|
</blockquote>
|
||||||
</p>
|
|
||||||
|
<p>
|
||||||
|
If you believe this post violates the community
|
||||||
|
rules or should otherwise be removed, please fill
|
||||||
|
in a reason or explanation below and hit the Flag
|
||||||
|
button.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
We ask that you only flag posts that genuinely
|
||||||
|
break the community rules or are problematic
|
||||||
|
otherwise; we will not solve your personal conflicts,
|
||||||
|
and false reports will be ignored.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<form method="post">
|
||||||
|
<div class="field">
|
||||||
|
<label>Reason:</label>
|
||||||
|
<input name="reason">
|
||||||
|
<button type="submit">Flag</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
{%else}
|
||||||
|
<p>
|
||||||
|
Thanks for your report! A moderator will review it soon.
|
||||||
|
</p>
|
||||||
|
{%/if}
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
Loading…
Reference in New Issue