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

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 83Zeile 83
		if($user['warningpoints'] >= $mybb->settings['maxwarningpoints'])
{
$this->set_error('error_user_reached_max_warning');

		if($user['warningpoints'] >= $mybb->settings['maxwarningpoints'])
{
$this->set_error('error_user_reached_max_warning');

			return false;
}

return true;
}

/**
* Validate a warning thread.
*
* @return boolean True when valid, false when invalid.
*/
function validate_thread()
{
$warning = &$this->data;

$thread = get_thread($warning['tid']);

if(!$thread['tid'])
{
$this->set_error('error_invalid_post');

 
			return false;
}


			return false;
}


Zeile 115Zeile 95
	* @return boolean True when valid, false when invalid.
*/
function validate_post()

	* @return boolean True when valid, false when invalid.
*/
function validate_post()

	{
$warning = &$this->data;

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

	{
$warning = &$this->data;

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


if(!$post['pid'])
{
$this->set_error('error_invalid_post');
return false;


if(!$post['pid'])
{
$this->set_error('error_invalid_post');
return false;

		}

if(!isset($warning['tid']))
{
$warning['tid'] = $post['tid'];

 
		}

return true;

		}

return true;

Zeile 146Zeile 121
		if(!trim($warning['notes']))
{
$this->set_error('error_no_note');

		if(!trim($warning['notes']))
{
$this->set_error('error_no_note');

			return false;
}


			return false;
}


		return true;
}


		return true;
}


Zeile 182Zeile 157
	* @return boolean True when valid, false when invalid.
*/
function validate_type()

	* @return boolean True when valid, false when invalid.
*/
function validate_type()

	{

	{

		global $mybb, $db;

		global $mybb, $db;





		$warning = &$this->data;

		$warning = &$this->data;





		// Issuing a custom warning
if($warning['type'] == 'custom')
{
if($mybb->settings['allowcustomwarnings'] == 0)
{
$this->set_error('error_cant_custom_warn');

		// Issuing a custom warning
if($warning['type'] == 'custom')
{
if($mybb->settings['allowcustomwarnings'] == 0)
{
$this->set_error('error_cant_custom_warn');

				return false;
}

				return false;
}


if(!$warning['custom_reason'])
{
$this->set_error('error_no_custom_reason');


if(!$warning['custom_reason'])
{
$this->set_error('error_no_custom_reason');

				return false;
}

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


				return false;
}

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


			if(!$warning['custom_points'] || $warning['custom_points'] > $mybb->settings['maxwarningpoints'] || $warning['custom_points'] < 0)
{
$this->set_error('error_invalid_custom_points', array(my_number_format($mybb->settings['maxwarningpoints'])));

			if(!$warning['custom_points'] || $warning['custom_points'] > $mybb->settings['maxwarningpoints'] || $warning['custom_points'] < 0)
{
$this->set_error('error_invalid_custom_points', array(my_number_format($mybb->settings['maxwarningpoints'])));

Zeile 216Zeile 191
			if($warning['expires_period'] == "hours")
{
$warning['expires'] = $warning['expires']*3600 + TIME_NOW;

			if($warning['expires_period'] == "hours")
{
$warning['expires'] = $warning['expires']*3600 + TIME_NOW;

			}

			}

			else if($warning['expires_period'] == "days")
{
$warning['expires'] = $warning['expires']*86400 + TIME_NOW;

			else if($warning['expires_period'] == "days")
{
$warning['expires'] = $warning['expires']*86400 + TIME_NOW;

			}

			}

			else if($warning['expires_period'] == "weeks")
{
$warning['expires'] = $warning['expires']*604800 + TIME_NOW;

			else if($warning['expires_period'] == "weeks")
{
$warning['expires'] = $warning['expires']*604800 + TIME_NOW;

			}

			}

			else if($warning['expires_period'] == "months")
{
$warning['expires'] = $warning['expires']*2592000 + TIME_NOW;

			else if($warning['expires_period'] == "months")
{
$warning['expires'] = $warning['expires']*2592000 + TIME_NOW;

			}

			}

			else if($warning['expires_period'] == "never")
{
$warning['expires'] = 0;

			else if($warning['expires_period'] == "never")
{
$warning['expires'] = 0;

			}

			}

			else
{
// unkown expires_period
$this->set_error('error_invalid_expires_period');

			else
{
// unkown expires_period
$this->set_error('error_invalid_expires_period');

				return false;

				return false;

			}
}
// Using a predefined warning type

			}
}
// Using a predefined warning type

Zeile 250Zeile 225
			{
$this->set_error('error_invalid_type');
return false;

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

			}


			}


			$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'];

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

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

			$this->validate_thread();

 
		}
if(array_key_exists('type', $warning))
{

		}
if(array_key_exists('type', $warning))
{

Zeile 387Zeile 362
	function update_user($method='insert')
{
global $db, $mybb, $lang;

	function update_user($method='insert')
{
global $db, $mybb, $lang;

 

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


$warning = &$this->data;



$warning = &$this->data;


Zeile 478Zeile 458
							}

$new_ban = array(

							}

$new_ban = array(

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

								"uid" => $user['uid'],
"gid" => $action['usergroup'],
"oldgroup" => $user['usergroup'],
"oldadditionalgroups" => $user['additionalgroups'],
"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 494Zeile 474
							{
$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['oldadditionalgroups'] = $db->escape_string($existing_ban['oldadditionalgroups']);
$new_ban['olddisplaygroup'] = $db->escape_string($existing_ban['olddisplaygroup']);

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

							}

$period = $lang->expiration_never;

							}

$period = $lang->expiration_never;

Zeile 513Zeile 493

$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

						}
break;
// Suspend posting privileges

Zeile 696Zeile 677

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


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

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

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

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

			"pid" => (int)$warning['pid'],
"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'])