Empty commit

This commit is contained in:
Git 2014-04-19 08:00:50 +00:00
parent f355dd793e
commit 357b1ea2d6
7 changed files with 20 additions and 5 deletions

View File

@ -48,9 +48,10 @@ public static function post($Page, $PageID, $Body) {
* Edit a comment
* @param int $PostID
* @param string $NewBody
* @param bool $SendPM If true, send a PM to the author of the comment informing him about the edit
* @todo move permission check out of here/remove hardcoded error(404)
*/
public static function edit($PostID, $NewBody) {
public static function edit($PostID, $NewBody, $SendPM = false) {
$QueryID = G::$DB->get_query_id();
G::$DB->query("
@ -103,6 +104,15 @@ public static function edit($PostID, $NewBody) {
G::$DB->set_query_id($QueryID);
if ($SendPM && G::$LoggedUser['ID'] != $AuthorID) {
// Send a PM to the user to notify them of the edit
$PMSubject = "Your comment #$PostID has been edited";
$PMurl = site_url()."comments.php?action=jump&postid=$PostID";
$ProfLink = '[url='.site_url().'user.php?id='.G::$LoggedUser['ID'].']'.G::$LoggedUser['Username'].'[/url]';
$PMBody = "One of your comments has been edited by $ProfLink: [url]{$PMurl}[/url]";
Misc::send_pm($AuthorID, 0, $PMSubject, $PMBody);
}
return true; // TODO: this should reflect whether or not the update was actually successful, e.g. by checking G::$DB->affected_rows after the UPDATE query
}

View File

@ -464,6 +464,7 @@ public static function clear_blog($Blog) {
SELECT
b.ID,
um.Username,
b.UserID,
b.Title,
b.Body,
b.Time,

View File

@ -30,6 +30,7 @@
SELECT
b.ID,
um.Username,
b.UserID,
b.Title,
b.Body,
b.Time,
@ -43,7 +44,7 @@
}
$JsonBlog = array();
for ($i = 0; $i < 5; $i++) {
list($BlogID, $Author, $Title, $Body, $BlogTime, $ThreadID) = $Blog[$i];
list($BlogID, $Author, $AuthorID, $Title, $Body, $BlogTime, $ThreadID) = $Blog[$i];
$JsonBlog[] = array(
'blogId' => (int)$BlogID,
'author' => $Author,

View File

@ -27,7 +27,7 @@
$i++;
}
}
$Val->SetFields('description', '1', 'string', 'The description must be at least 10 characters', array('maxlength' => 65535, 'minlength' => 10));
$Val->SetFields('description', '1', 'string', 'The description must be between 10 and 65535 characters', array('maxlength' => 65535, 'minlength' => 10));
$Err = $Val->ValidateForm($_POST);

View File

@ -9,7 +9,8 @@
error('Your posting privileges have been removed.');
}
Comments::edit((int)$_POST['postid'], $_POST['body']);
$SendPM = isset($_POST['pm']) && $_POST['pm'];
Comments::edit((int)$_POST['postid'], $_POST['body'], $SendPM);
// This gets sent to the browser, which echoes it in place of the old body
echo Text::full_format($_POST['body']);

View File

@ -81,6 +81,7 @@
SELECT
b.ID,
um.Username,
b.UserID,
b.Title,
b.Body,
b.Time,
@ -93,7 +94,7 @@
$Cache->cache_value('Blog', $Blog, 1209600);
}
foreach ($Blog as $BlogItem) {
list($BlogID, $Author, $Title, $Body, $BlogTime, $ThreadID) = $BlogItem;
list($BlogID, $Author, $AuthorID, $Title, $Body, $BlogTime, $ThreadID) = $BlogItem;
if ($ThreadID) {
echo $Feed->item($Title, Text::strip_bbcode($Body), "forums.php?action=viewthread&amp;threadid=$ThreadID", SITE_NAME.' Staff', '', '', $BlogTime);
} else {

View File

@ -194,6 +194,7 @@ function Save_Edit(postid) {
$('#bar' + postid).raw().innerHTML = "";
$('#preview' + postid).raw().innerHTML = response;
$('#editbox' + postid).ghide();
$('#pmbox' + postid).ghide();
});
}
}