Vergleich inc/datahandlers/warnings.php - 1.8.5 - 1.8.37

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 68Zeile 68

$user = get_user($warning['uid']);



$user = get_user($warning['uid']);


		if(!$user['uid'])

		if(!$user)

		{
$this->set_error('error_invalid_user');
return false;

		{
$this->set_error('error_invalid_user');
return false;

Zeile 100Zeile 100

$post = get_post($warning['pid']);



$post = get_post($warning['pid']);


		if(!$post['pid'])

		if(!$post)

		{
$this->set_error('error_invalid_post');
return false;

		{
$this->set_error('error_invalid_post');
return false;

Zeile 281Zeile 281
	/**
* Gets a valid warning from the DB engine.
*

	/**
* Gets a valid warning from the DB engine.
*

	* @return mixed array when valid, boolean false when invalid.


	* @param int $wid
* @return array|bool array when valid, boolean false when invalid.

	*/
function get($wid)
{

	*/
function get($wid)
{

Zeile 361Zeile 362
	*/
function update_user($method='insert')
{

	*/
function update_user($method='insert')
{

		global $db, $mybb, $lang;

		global $db, $mybb, $lang, $cache, $groupscache;


if($mybb->settings['maxwarningpoints'] < 1)
{
$mybb->settings['maxwarningpoints'] = 10;


if($mybb->settings['maxwarningpoints'] < 1)
{
$mybb->settings['maxwarningpoints'] = 10;

 
		}

if(!is_array($groupscache))
{
$groupscache = $cache->read("usergroups");

		}

$warning = &$this->data;

$user = get_user($warning['uid']);

		}

$warning = &$this->data;

$user = get_user($warning['uid']);





		if($method == 'insert')
{
// Build warning level & ensure it doesn't go over 100.
$current_level = round($user['warningpoints']/$mybb->settings['maxwarningpoints']*100);
$this->new_warning_level = round(($user['warningpoints']+$warning['points'])/$mybb->settings['maxwarningpoints']*100);
if($this->new_warning_level > 100)

		if($method == 'insert')
{
// Build warning level & ensure it doesn't go over 100.
$current_level = round($user['warningpoints']/$mybb->settings['maxwarningpoints']*100);
$this->new_warning_level = round(($user['warningpoints']+$warning['points'])/$mybb->settings['maxwarningpoints']*100);
if($this->new_warning_level > 100)

			{

			{

				$this->new_warning_level = 100;
}

				$this->new_warning_level = 100;
}





			// Update user
$this->updated_user = array(
"warningpoints" => $user['warningpoints']+$warning['points']

			// Update user
$this->updated_user = array(
"warningpoints" => $user['warningpoints']+$warning['points']

Zeile 391Zeile 397
			$query = $db->simple_select("warninglevels", "*", "percentage<={$this->new_warning_level}", array("order_by" => "percentage", "order_dir" => "desc"));
$new_level = $db->fetch_array($query);


			$query = $db->simple_select("warninglevels", "*", "percentage<={$this->new_warning_level}", array("order_by" => "percentage", "order_dir" => "desc"));
$new_level = $db->fetch_array($query);


			if($new_level['lid'])

			if(!empty($new_level) && $new_level['lid'])

			{
$expiration = 0;
$action = my_unserialize($new_level['action']);

			{
$expiration = 0;
$action = my_unserialize($new_level['action']);





				if($action['length'] > 0)
{
$expiration = TIME_NOW+$action['length'];

				if($action['length'] > 0)
{
$expiration = TIME_NOW+$action['length'];

Zeile 461Zeile 467
								"uid" => $user['uid'],
"gid" => $action['usergroup'],
"oldgroup" => $user['usergroup'],

								"uid" => $user['uid'],
"gid" => $action['usergroup'],
"oldgroup" => $user['usergroup'],

								"oldadditionalgroups" => $user['additionalgroups'],

								"oldadditionalgroups" => $db->escape_string($user['additionalgroups']),

								"olddisplaygroup" => $user['displaygroup'],
"admin" => $mybb->user['uid'],
"dateline" => TIME_NOW,

								"olddisplaygroup" => $user['displaygroup'],
"admin" => $mybb->user['uid'],
"dateline" => TIME_NOW,

Zeile 475Zeile 481
								$db->delete_query("banned", "uid='{$user['uid']}' AND gid='{$action['usergroup']}'");
// Override new ban details with old group info
$new_ban['oldgroup'] = $existing_ban['oldgroup'];

								$db->delete_query("banned", "uid='{$user['uid']}' AND gid='{$action['usergroup']}'");
// Override new ban details with old group info
$new_ban['oldgroup'] = $existing_ban['oldgroup'];

								$new_ban['oldadditionalgroups'] = $existing_ban['oldadditionalgroups'];

								$new_ban['oldadditionalgroups'] = $db->escape_string($existing_ban['oldadditionalgroups']);

								$new_ban['olddisplaygroup'] = $existing_ban['olddisplaygroup'];

								$new_ban['olddisplaygroup'] = $existing_ban['olddisplaygroup'];

							}


							}


							$period = $lang->expiration_never;
$ban_length = fetch_friendly_expiration($action['length']);

if($ban_length['time'])

							$period = $lang->expiration_never;
$ban_length = fetch_friendly_expiration($action['length']);

if($ban_length['time'])

							{

							{

								$lang_str = "expiration_".$ban_length['period'];
$period = $lang->sprintf($lang->result_period, $ban_length['time'], $lang->$lang_str);
}

								$lang_str = "expiration_".$ban_length['period'];
$period = $lang->sprintf($lang->result_period, $ban_length['time'], $lang->$lang_str);
}

Zeile 503Zeile 509
						if($expiration == 0 || $expiration > $user['suspensiontime'])
{
if(($user['suspensiontime'] != 0 && $user['suspendposting']) || !$user['suspendposting'])

						if($expiration == 0 || $expiration > $user['suspensiontime'])
{
if(($user['suspensiontime'] != 0 && $user['suspendposting']) || !$user['suspendposting'])

							{
$period = $lang->expiration_never;
$ban_length = fetch_friendly_expiration($action['length']);

							{
$period = $lang->expiration_never;
$ban_length = fetch_friendly_expiration($action['length']);


if($ban_length['time'])
{


if($ban_length['time'])
{

Zeile 586Zeile 592
							{
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...

							{
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;

									continue 2;

								case 2: // Revoke posting
$current_expiry_field = 'suspensiontime';
$current_inforce_field = 'suspendposting';

								case 2: // Revoke posting
$current_expiry_field = 'suspensiontime';
$current_inforce_field = 'suspendposting';

Zeile 678Zeile 684
		$this->write_warning_data = array(
"uid" => (int)$warning['uid'],
"tid" => (int)$warning['type'],

		$this->write_warning_data = array(
"uid" => (int)$warning['uid'],
"tid" => (int)$warning['type'],

			"pid" => (int)$warning['pid'],

			"pid" => isset($warning['pid']) ? (int)$warning['pid'] : 0,

			"title" => $db->escape_string($warning['title']),
"points" => (int)$warning['points'],
"dateline" => TIME_NOW,

			"title" => $db->escape_string($warning['title']),
"points" => (int)$warning['points'],
"dateline" => TIME_NOW,