Zeile 6 | Zeile 6 |
---|
* Website: http://www.mybboard.net * License: http://www.mybboard.net/about/license *
|
* Website: http://www.mybboard.net * License: http://www.mybboard.net/about/license *
|
* $Id: warnings.php 4031 2008-07-20 20:56:39Z Tikitiki $
| * $Id: warnings.php 5379 2011-02-21 11:06:42Z Tomm $
|
*/
define("IN_MYBB", 1);
|
*/
define("IN_MYBB", 1);
|
| define('THIS_SCRIPT', 'warnings.php');
|
$templatelist = ''; require_once "./global.php";
| $templatelist = ''; require_once "./global.php";
|
Zeile 233 | Zeile 234 |
---|
$new_warning = array( "uid" => $user['uid'],
|
$new_warning = array( "uid" => $user['uid'],
|
"tid" => $warning_type['tid'], "pid" => $post['pid'],
| "tid" => intval($warning_type['tid']), "pid" => intval($post['pid']),
|
"title" => $db->escape_string($warning_title), "points" => intval($points), "dateline" => TIME_NOW, "issuedby" => $mybb->user['uid'], "expires" => $warning_expires, "expired" => 0,
|
"title" => $db->escape_string($warning_title), "points" => intval($points), "dateline" => TIME_NOW, "issuedby" => $mybb->user['uid'], "expires" => $warning_expires, "expired" => 0,
|
| "revokereason" => '',
|
"notes" => $db->escape_string($mybb->input['notes']) ); $db->insert_query("warnings", $new_warning);
| "notes" => $db->escape_string($mybb->input['notes']) ); $db->insert_query("warnings", $new_warning);
|
Zeile 306 | Zeile 308 |
---|
if($year > 0) {
|
if($year > 0) {
|
$time += 60*60*24*265*$year;
| $time += 60*60*24*365*$year;
|
} if($time == $action['length'])
| } if($time == $action['length'])
|
Zeile 565 | Zeile 567 |
---|
$notes = htmlspecialchars_uni($mybb->input['notes']); $type_checked[$mybb->input['type']] = "checked=\"checked\""; $pm_subject = htmlspecialchars_uni($mybb->input['pm_subject']);
|
$notes = htmlspecialchars_uni($mybb->input['notes']); $type_checked[$mybb->input['type']] = "checked=\"checked\""; $pm_subject = htmlspecialchars_uni($mybb->input['pm_subject']);
|
$pm_message = htmlspecialchars_uni($mybb->input['pm_message']);
| $message = htmlspecialchars_uni($mybb->input['pm_message']);
|
if($mybb->input['send_pm']) { $send_pm_checked = "checked=\"checked\"";
| if($mybb->input['send_pm']) { $send_pm_checked = "checked=\"checked\"";
|
Zeile 581 | Zeile 583 |
---|
$expires = 1; $custom_points = 2; $pm_subject = $lang->warning_pm_subject;
|
$expires = 1; $custom_points = 2; $pm_subject = $lang->warning_pm_subject;
|
$pm_message = $lang->warning_pm_message;
| $message = $lang->sprintf($lang->warning_pm_message, $user['username'], $mybb->settings['bbname']);
|
}
$lang->nav_profile = $lang->sprintf($lang->nav_profile, $user['username']);
| }
$lang->nav_profile = $lang->sprintf($lang->nav_profile, $user['username']);
|
Zeile 745 | Zeile 747 |
---|
$new_warning_points = 0; }
|
$new_warning_points = 0; }
|
// Update user
| |
$updated_user = array( "warningpoints" => $new_warning_points );
|
$updated_user = array( "warningpoints" => $new_warning_points );
|
| // check if we need to revoke any consequences with this warning $current_level = round($user['warningpoints']/$mybb->settings['maxwarningpoints']*100); $new_warning_level = round($new_warning_points/$mybb->settings['maxwarningpoints']*100); $query = $db->simple_select("warninglevels", "action", "percentage>$new_warning_level AND percentage<=$current_level"); if($db->num_rows($query)) { // we have some warning levels we need to revoke $max_expiration_times = $check_levels = array(); find_warnlevels_to_check($query, $max_expiration_times, $check_levels); // now check warning levels already applied to this user to see if we need to lower any expiration times $query = $db->simple_select("warninglevels", "action", "percentage<=$new_warning_level"); $lower_expiration_times = $lower_levels = array(); find_warnlevels_to_check($query, $lower_expiration_times, $lower_levels); // now that we've got all the info, do necessary stuff for($i = 1; $i <= 3; ++$i) { if($check_levels[$i]) { switch($i) { case 1: // Ban // we'll have to resort to letting the admin/mod remove the ban manually, since there's an issue if stacked bans are in force... continue; case 2: // Revoke posting $current_expiry_field = 'suspensiontime'; $current_inforce_field = 'suspendposting'; break; case 3: $current_expiry_field = 'moderationtime'; $current_inforce_field = 'moderateposts'; break; } // if the thing isn't in force, don't bother with trying to update anything if(!$user[$current_inforce_field]) { continue; } if($lower_levels[$i]) { // lessen the expiration time if necessary if(!$lower_expiration_times[$i]) { // doesn't expire - enforce this $updated_user[$current_expiry_field] = 0; continue; } if($max_expiration_times[$i]) { // if the old level did have an expiry time... if($max_expiration_times[$i] <= $lower_expiration_times[$i]) { // if the lower expiration time is actually higher than the upper expiration time -> skip continue; } // both new and old max expiry times aren't infinite, so we can take a difference $expire_offset = ($lower_expiration_times[$i] - $max_expiration_times[$i]); } else { // the old level never expired, not much we can do but try to estimate a new expiry time... which will just happen to be starting from today... $expire_offset = TIME_NOW + $lower_expiration_times[$i]; // if the user's expiry time is already less than what we're going to set it to, skip if($user[$current_expiry_field] <= $expire_offset) { continue; } } $updated_user[$current_expiry_field] = $user[$current_expiry_field] + $expire_offset; // double-check if it's expired already if($updated_user[$current_expiry_field] < TIME_NOW) { $updated_user[$current_expiry_field] = 0; $updated_user[$current_inforce_field] = 0; } } else { // there's no lower level for this type - remove the consequence entirely $updated_user[$current_expiry_field] = 0; $updated_user[$current_inforce_field] = 0; } } } } // Update user
|
$db->update_query("users", $updated_user, "uid='{$warning['uid']}'"); }
| $db->update_query("users", $updated_user, "uid='{$warning['uid']}'"); }
|
Zeile 822 | Zeile 919 |
---|
{ $warning['post_subject'] = $parser->parse_badwords($warning['post_subject']); $warning['post_subject'] = htmlspecialchars_uni($warning['post_subject']);
|
{ $warning['post_subject'] = $parser->parse_badwords($warning['post_subject']); $warning['post_subject'] = htmlspecialchars_uni($warning['post_subject']);
|
$post_link = get_post_link($warning['pid']);
| $post_link = get_post_link($warning['pid'])."#pid{$warning['pid']}";
|
eval("\$warning_info = \"".$templates->get("warnings_view_post")."\";"); } else
| eval("\$warning_info = \"".$templates->get("warnings_view_post")."\";"); } else
|
Zeile 939 | Zeile 1036 |
---|
$page = 1; } if($page)
|
$page = 1; } if($page)
|
{
| {
|
$start = ($page-1) * $perpage; } else
| $start = ($page-1) * $perpage; } else
|
Zeile 1055 | Zeile 1152 |
---|
eval("\$warnings = \"".$templates->get("warnings")."\";"); $plugins->run_hooks("warnings_end"); output_page($warnings);
|
eval("\$warnings = \"".$templates->get("warnings")."\";"); $plugins->run_hooks("warnings_end"); output_page($warnings);
|
| }
function find_warnlevels_to_check(&$query, &$max_expiration_times, &$check_levels) { global $db; // we have some warning levels we need to revoke $max_expiration_times = array( 1 => -1, // Ban 2 => -1, // Revoke posting 3 => -1 // Moderate posting ); $check_levels = array( 1 => false, // Ban 2 => false, // Revoke posting 3 => false // Moderate posting ); while($warn_level = $db->fetch_array($query)) { // revoke actions taken at this warning level $action = unserialize($warn_level['action']); if($action['type'] < 1 || $action['type'] > 3) // prevent any freak-ish cases { continue; } $check_levels[$action['type']] = true; $max_exp_time = &$max_expiration_times[$action['type']]; if($action['length'] && $max_exp_time != 0) { $expiration = $action['length']; if($expiration > $max_exp_time) { $max_exp_time = $expiration; } } else { $max_exp_time = 0; } }
|
}
?>
| }
?>
|