Zeile 185 | Zeile 185 |
---|
$lang->load("global"); $lang->load("xmlhttp");
|
$lang->load("global"); $lang->load("xmlhttp");
|
| $closed_bypass = array("refresh_captcha", "validate_captcha");
$mybb->input['action'] = $mybb->get_input('action');
|
$plugins->run_hooks("xmlhttp");
|
$plugins->run_hooks("xmlhttp");
|
$mybb->input['action'] = $mybb->get_input('action');
| // If the board is closed, the user is not an administrator and they're not trying to login, show the board closed message if($mybb->settings['boardclosed'] == 1 && $mybb->usergroup['canviewboardclosed'] != 1 && !in_array($mybb->input['action'], $closed_bypass)) { // Show error if(!$mybb->settings['boardclosed_reason']) { $mybb->settings['boardclosed_reason'] = $lang->boardclosed_reason; }
$lang->error_boardclosed .= "<br /><em>{$mybb->settings['boardclosed_reason']}</em>";
xmlhttp_error($lang->error_boardclosed); }
|
// Fetch a list of usernames beginning with a certain string (used for auto completion) if($mybb->input['action'] == "get_users")
| // Fetch a list of usernames beginning with a certain string (used for auto completion) if($mybb->input['action'] == "get_users")
|
Zeile 275 | Zeile 291 |
---|
else { exit;
|
else { exit;
|
}
| }
|
// Fetch the specific forum this thread/post is in. $forum = get_forum($thread['fid']);
| // Fetch the specific forum this thread/post is in. $forum = get_forum($thread['fid']);
|
Zeile 285 | Zeile 301 |
---|
{ xmlhttp_error($lang->thread_doesnt_exist); }
|
{ xmlhttp_error($lang->thread_doesnt_exist); }
|
|
|
// Fetch forum permissions. $forumpermissions = forum_permissions($forum['fid']);
|
// Fetch forum permissions. $forumpermissions = forum_permissions($forum['fid']);
|
|
|
$plugins->run_hooks("xmlhttp_edit_subject_start");
// If this user is not a moderator with "caneditposts" permissions.
| $plugins->run_hooks("xmlhttp_edit_subject_start");
// If this user is not a moderator with "caneditposts" permissions.
|
Zeile 303 | Zeile 319 |
---|
else if($forum['open'] == 0 || $forumpermissions['caneditposts'] == 0 || $mybb->user['uid'] != $post['uid'] || $mybb->user['uid'] == 0) { xmlhttp_error($lang->no_permission_edit_subject);
|
else if($forum['open'] == 0 || $forumpermissions['caneditposts'] == 0 || $mybb->user['uid'] != $post['uid'] || $mybb->user['uid'] == 0) { xmlhttp_error($lang->no_permission_edit_subject);
|
} // If we're past the edit time limit - don't allow editing. else if($mybb->usergroup['edittimelimit'] != 0 && $post['dateline'] < (TIME_NOW-($mybb->usergroup['edittimelimit']*60))) {
| } // If we're past the edit time limit - don't allow editing. else if($mybb->usergroup['edittimelimit'] != 0 && $post['dateline'] < (TIME_NOW-($mybb->usergroup['edittimelimit']*60))) {
|
$lang->edit_time_limit = $lang->sprintf($lang->edit_time_limit, $mybb->usergroup['edittimelimit']); xmlhttp_error($lang->edit_time_limit);
|
$lang->edit_time_limit = $lang->sprintf($lang->edit_time_limit, $mybb->usergroup['edittimelimit']); xmlhttp_error($lang->edit_time_limit);
|
}
| }
|
$ismod = false; } else
|
$ismod = false; } else
|
{
| {
|
$ismod = true; } $subject = $mybb->get_input('value');
| $ismod = true; } $subject = $mybb->get_input('value');
|
Zeile 326 | Zeile 342 |
---|
else if(function_exists("mb_convert_encoding")) { $subject = @mb_convert_encoding($subject, $charset, "UTF-8");
|
else if(function_exists("mb_convert_encoding")) { $subject = @mb_convert_encoding($subject, $charset, "UTF-8");
|
}
| }
|
else if(my_strtolower($charset) == "iso-8859-1") { $subject = utf8_decode($subject);
|
else if(my_strtolower($charset) == "iso-8859-1") { $subject = utf8_decode($subject);
|
} }
// Set up posthandler. require_once MYBB_ROOT."inc/datahandlers/post.php"; $posthandler = new PostDataHandler("update"); $posthandler->action = "post";
// Set the post data that came from the input to the $post array. $updatepost = array( "pid" => $post['pid'], "tid" => $thread['tid'], "subject" => $subject, "edit_uid" => $mybb->user['uid'] ); $posthandler->set_data($updatepost);
// Now let the post handler do all the hard work. if(!$posthandler->validate_post()) { $post_errors = $posthandler->get_friendly_errors(); xmlhttp_error($post_errors);
| }
|
}
|
}
|
// No errors were found, we can call the update method. else
| // Only edit subject if subject has actually been changed if($thread['subject'] != $subject)
|
{
|
{
|
$posthandler->update_post(); if($ismod == true)
| // Set up posthandler. require_once MYBB_ROOT."inc/datahandlers/post.php"; $posthandler = new PostDataHandler("update"); $posthandler->action = "post";
// Set the post data that came from the input to the $post array. $updatepost = array( "pid" => $post['pid'], "tid" => $thread['tid'], "subject" => $subject, "edit_uid" => $mybb->user['uid'] ); $posthandler->set_data($updatepost);
// Now let the post handler do all the hard work. if(!$posthandler->validate_post()) { $post_errors = $posthandler->get_friendly_errors(); xmlhttp_error($post_errors); } // No errors were found, we can call the update method. else
|
{
|
{
|
$modlogdata = array( "tid" => $thread['tid'], "fid" => $forum['fid'] ); log_moderator_action($modlogdata, $lang->edited_post);
| $posthandler->update_post(); if($ismod == true) { $modlogdata = array( "tid" => $thread['tid'], "fid" => $forum['fid'] ); log_moderator_action($modlogdata, $lang->edited_post); }
|
} }
| } }
|
Zeile 417 | Zeile 437 |
---|
{ // Thread is closed - no editing allowed. if($thread['closed'] == 1)
|
{ // Thread is closed - no editing allowed. if($thread['closed'] == 1)
|
{ xmlhttp_error($lang->thread_closed_edit_message); }
| { xmlhttp_error($lang->thread_closed_edit_message); }
|
// Forum is not open, user doesn't have permission to edit, or author doesn't match this user - don't allow editing. else if($forum['open'] == 0 || $forumpermissions['caneditposts'] == 0 || $mybb->user['uid'] != $post['uid'] || $mybb->user['uid'] == 0 || $mybb->user['suspendposting'] == 1)
|
// Forum is not open, user doesn't have permission to edit, or author doesn't match this user - don't allow editing. else if($forum['open'] == 0 || $forumpermissions['caneditposts'] == 0 || $mybb->user['uid'] != $post['uid'] || $mybb->user['uid'] == 0 || $mybb->user['suspendposting'] == 1)
|
{ xmlhttp_error($lang->no_permission_edit_post);
| { xmlhttp_error($lang->no_permission_edit_post);
|
} // If we're past the edit time limit - don't allow editing. else if($mybb->usergroup['edittimelimit'] != 0 && $post['dateline'] < (TIME_NOW-($mybb->usergroup['edittimelimit']*60)))
|
} // If we're past the edit time limit - don't allow editing. else if($mybb->usergroup['edittimelimit'] != 0 && $post['dateline'] < (TIME_NOW-($mybb->usergroup['edittimelimit']*60)))
|
{
| {
|
$lang->edit_time_limit = $lang->sprintf($lang->edit_time_limit, $mybb->usergroup['edittimelimit']); xmlhttp_error($lang->edit_time_limit); }
| $lang->edit_time_limit = $lang->sprintf($lang->edit_time_limit, $mybb->usergroup['edittimelimit']); xmlhttp_error($lang->edit_time_limit); }
|
Zeile 449 | Zeile 469 |
---|
if($mybb->get_input('do') == "get_post") { // Send our headers.
|
if($mybb->get_input('do') == "get_post") { // Send our headers.
|
//header("Content-type: text/xml; charset={$charset}"); header("Content-type: text/html; charset={$charset}");
//$post['message'] = htmlspecialchars_uni($post['message']);
| header("Content-type: application/json; charset={$charset}");
|
// Send the contents of the post.
|
// Send the contents of the post.
|
echo $post['message'];
| echo json_encode($post['message']);
|
exit; } else if($mybb->get_input('do') == "update_post")
| exit; } else if($mybb->get_input('do') == "update_post")
|
Zeile 870 | Zeile 887 |
---|
$username = $mybb->get_input('username');
// Fix bad characters
|
$username = $mybb->get_input('username');
// Fix bad characters
|
$username = trim($username);
| $username = trim_blank_chrs($username);
|
$username = str_replace(array(unichr(160), unichr(173), unichr(0xCA), dec_to_utf8(8238), dec_to_utf8(8237), dec_to_utf8(8203)), array(" ", "-", "", "", "", ""), $username);
// Remove multiple spaces from the username
| $username = str_replace(array(unichr(160), unichr(173), unichr(0xCA), dec_to_utf8(8238), dec_to_utf8(8237), dec_to_utf8(8203)), array(" ", "-", "", "", "", ""), $username);
// Remove multiple spaces from the username
|
Zeile 893 | Zeile 910 |
---|
}
// Check for certain characters in username (<, >, &, and slashes)
|
}
// Check for certain characters in username (<, >, &, and slashes)
|
if(strpos($username, "<") !== false || strpos($username, ">") !== false || strpos($username, "&") !== false || my_strpos($username, "\\") !== false || strpos($username, ";") !== false || !validate_utf8_string($username, false, false))
| if(strpos($username, "<") !== false || strpos($username, ">") !== false || strpos($username, "&") !== false || my_strpos($username, "\\") !== false || strpos($username, ";") !== false || strpos($username, ",") !== false || !validate_utf8_string($username, false, false))
|
{ echo json_encode($lang->banned_characters_username); exit;
| { echo json_encode($lang->banned_characters_username); exit;
|