Vergleich inc/datahandlers/warnings.php - 1.8.4 - 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 228Zeile 228
			}

$warning['points'] = $this->warning_type['points'];

			}

$warning['points'] = $this->warning_type['points'];


$warning['title'] = $warning['expires'] = '';


			$warning['title'] = '';
$warning['expires'] = 0;


			if($this->warning_type['expirationtime'])
{
$warning['expires'] = TIME_NOW+$this->warning_type['expirationtime'];
}

			if($this->warning_type['expirationtime'])
{
$warning['expires'] = TIME_NOW+$this->warning_type['expirationtime'];
}

		}

		}


return true;
}


return true;
}

Zeile 249Zeile 250
		global $plugins;

$warning = &$this->data;

		global $plugins;

$warning = &$this->data;





		// Verify all warning assets.
$this->validate_user();
$this->validate_maximum();
$this->validate_notes();

		// Verify all warning assets.
$this->validate_user();
$this->validate_maximum();
$this->validate_notes();





		if(array_key_exists('pid', $warning))
{
$this->validate_post();

		if(array_key_exists('pid', $warning))
{
$this->validate_post();

Zeile 270Zeile 271
		$this->set_validated(true);

if(count($this->get_errors()) > 0)

		$this->set_validated(true);

if(count($this->get_errors()) > 0)

		{
return false;

		{
return false;

		}

return true;

		}

return true;

Zeile 280Zeile 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 360Zeile 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(!is_array($groupscache))
{
$groupscache = $cache->read("usergroups");
}


$warning = &$this->data;



$warning = &$this->data;


Zeile 385Zeile 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']);

Zeile 402Zeile 414
						// Fetch any previous bans for this user
$query = $db->simple_select("banned", "*", "uid='{$user['uid']}' AND gid='{$action['usergroup']}' AND lifted>".TIME_NOW);
$existing_ban = $db->fetch_array($query);

						// Fetch any previous bans for this user
$query = $db->simple_select("banned", "*", "uid='{$user['uid']}' AND gid='{$action['usergroup']}' AND lifted>".TIME_NOW);
$existing_ban = $db->fetch_array($query);





						// Only perform if no previous ban or new ban expires later than existing ban
if(($expiration > $existing_ban['lifted'] && $existing_ban['lifted'] != 0) || $expiration == 0 || !$existing_ban['uid'])
{

						// Only perform if no previous ban or new ban expires later than existing ban
if(($expiration > $existing_ban['lifted'] && $existing_ban['lifted'] != 0) || $expiration == 0 || !$existing_ban['uid'])
{

Zeile 452Zeile 464
							}

$new_ban = array(

							}

$new_ban = array(

								"uid" => (int)$user['uid'],
"gid" => $db->escape_string($action['usergroup']),
"oldgroup" => $db->escape_string($user['usergroup']),

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

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

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

								"olddisplaygroup" => $db->escape_string($user['displaygroup']),

								"olddisplaygroup" => $user['displaygroup'],

								"admin" => $mybb->user['uid'],
"dateline" => TIME_NOW,
"bantime" => $db->escape_string($bantime),

								"admin" => $mybb->user['uid'],
"dateline" => TIME_NOW,
"bantime" => $db->escape_string($bantime),

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

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

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

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

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

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

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

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

							}

$period = $lang->expiration_never;

							}

$period = $lang->expiration_never;

Zeile 487Zeile 499

$db->insert_query("banned", $new_ban);
$this->updated_user['usergroup'] = $action['usergroup'];


$db->insert_query("banned", $new_ban);
$this->updated_user['usergroup'] = $action['usergroup'];

							$this->updated_user['additionalgroups'] = $this->updated_user['displaygroup'] = "";


							$this->updated_user['additionalgroups'] = '';
$this->updated_user['displaygroup'] = 0;

						}
break;
// Suspend posting privileges
case 2:
// Only perform if the expiration time is greater than the users current suspension period
if($expiration == 0 || $expiration > $user['suspensiontime'])

						}
break;
// Suspend posting privileges
case 2:
// Only perform if the expiration time is greater than the users current suspension period
if($expiration == 0 || $expiration > $user['suspensiontime'])

						{

						{

							if(($user['suspensiontime'] != 0 && $user['suspendposting']) || !$user['suspendposting'])
{
$period = $lang->expiration_never;

							if(($user['suspensiontime'] != 0 && $user['suspendposting']) || !$user['suspendposting'])
{
$period = $lang->expiration_never;

Zeile 579Zeile 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 671Zeile 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,

			"issuedby" => (int)$mybb->user['uid'],
"expires" => $db->escape_string($warning['expires']),

			"issuedby" => $mybb->user['uid'],
"expires" => (int)$warning['expires'],

			"expired" => 0,
"revokereason" => '',
"notes" => $db->escape_string($warning['notes'])

			"expired" => 0,
"revokereason" => '',
"notes" => $db->escape_string($warning['notes'])