Vergleich inc/datahandlers/event.php - 1.6.6 - 1.6.17

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 6Zeile 6
 * Website: http://mybb.com
* License: http://mybb.com/about/license
*

 * Website: http://mybb.com
* License: http://mybb.com/about/license
*

 * $Id: event.php 5625 2011-10-02 19:16:35Z ralgith $

 * $Id$

 */

// Disallow direct access to this file for security reasons

 */

// Disallow direct access to this file for security reasons

Zeile 103Zeile 103
			$this->set_error("invalid_start_date");
return false;
}

			$this->set_error("invalid_start_date");
return false;
}

 

$event['start_date']['day'] = intval($event['start_date']['day']);
$event['start_date']['month'] = intval($event['start_date']['month']);
$event['start_date']['year'] = intval($event['start_date']['year']);


if($event['start_date']['day'] > date("t", mktime(0, 0, 0, $event['start_date']['month'], 1, $event['start_date']['year'])))
{
$this->set_error("invalid_start_date");


if($event['start_date']['day'] > date("t", mktime(0, 0, 0, $event['start_date']['month'], 1, $event['start_date']['year'])))
{
$this->set_error("invalid_start_date");

			return false;

			return false;

		}

// Calendar events can only be within the next 5 years
if($event['start_date']['year'] > date("Y") + 5)
{
$this->set_error("invalid_start_year");

		}

// Calendar events can only be within the next 5 years
if($event['start_date']['year'] > date("Y") + 5)
{
$this->set_error("invalid_start_year");

			return false;

			return false;

		}

//Check to see if the month is within 1 and 12

		}

//Check to see if the month is within 1 and 12

Zeile 132Zeile 136
				$this->set_error("invalid_end_date");
return false;
}

				$this->set_error("invalid_end_date");
return false;
}

 

$event['end_date']['day'] = intval($event['end_date']['day']);
$event['end_date']['month'] = intval($event['end_date']['month']);
$event['end_date']['year'] = intval($event['end_date']['year']);


if($event['end_date']['day'] > date("t", mktime(0, 0, 0, $event['end_date']['month'], 1, $event['end_date']['year'])))
{


if($event['end_date']['day'] > date("t", mktime(0, 0, 0, $event['end_date']['month'], 1, $event['end_date']['year'])))
{

Zeile 260Zeile 268
		{
return true;
}

		{
return true;
}

		



		if(!$event['endtime'])
{
$this->set_error("only_ranged_events_repeat");

		if(!$event['endtime'])
{
$this->set_error("only_ranged_events_repeat");

Zeile 324Zeile 332
					if($event['repeats']['day'] <= 0 || $event['repeats']['day'] > 31)
{
$this->set_error("invalid_repeat_day_interval");

					if($event['repeats']['day'] <= 0 || $event['repeats']['day'] > 31)
{
$this->set_error("invalid_repeat_day_interval");

						return false;

						return false;

					}
}
else

					}
}
else

Zeile 337Zeile 345
				}
$event['repeats']['month'] = intval($event['repeats']['month']);
if($event['repeats']['month'] <= 0 || $event['repeats']['month'] > 12)

				}
$event['repeats']['month'] = intval($event['repeats']['month']);
if($event['repeats']['month'] <= 0 || $event['repeats']['month'] > 12)

				{

				{

					$this->set_error("invalid_repeat_month_interval");
return false;
}

					$this->set_error("invalid_repeat_month_interval");
return false;
}

Zeile 350Zeile 358
				break;
default:
$event['repeats'] = array();

				break;
default:
$event['repeats'] = array();

		}

		}

		require_once MYBB_ROOT."inc/functions_calendar.php";
$event['starttime_user'] = $event['starttime'];
$event['endtime_user'] = $event['endtime'];

		require_once MYBB_ROOT."inc/functions_calendar.php";
$event['starttime_user'] = $event['starttime'];
$event['endtime_user'] = $event['endtime'];

Zeile 377Zeile 385
		if($this->method == "insert" || array_key_exists('name', $event))
{
$this->verify_name();

		if($this->method == "insert" || array_key_exists('name', $event))
{
$this->verify_name();

		}

if($this->method == "insert" || array_key_exists('description', $event))

		}

if($this->method == "insert" || array_key_exists('description', $event))

		{
$this->verify_description();
}

		{
$this->verify_description();
}

Zeile 392Zeile 400
		if(($this->method == "insert" && $event['endtime']) || array_key_exists('repeats', $event))
{
$this->verify_repeats();

		if(($this->method == "insert" && $event['endtime']) || array_key_exists('repeats', $event))
{
$this->verify_repeats();

		}

$plugins->run_hooks_by_ref("datahandler_event_validate", $this);


		}

$plugins->run_hooks("datahandler_event_validate", $this);


		// We are done validating, return.
$this->set_validated(true);
if(count($this->get_errors()) > 0)

		// We are done validating, return.
$this->set_validated(true);
if(count($this->get_errors()) > 0)

Zeile 423Zeile 431
		{
die("The event needs to be validated before inserting it into the DB.");
}

		{
die("The event needs to be validated before inserting it into the DB.");
}

		



		if(count($this->get_errors()) > 0)
{
die("The event is not valid.");

		if(count($this->get_errors()) > 0)
{
die("The event is not valid.");

Zeile 437Zeile 445
		{
$visible = 0;
if($event['uid'] == $mybb->user['uid'])

		{
$visible = 0;
if($event['uid'] == $mybb->user['uid'])

			{

			{

				$calendar_permissions = get_calendar_permissions($event['cid']);
if($calendar_permissions['canbypasseventmod'] == 1)
{
$visible = 1;
}
}

				$calendar_permissions = get_calendar_permissions($event['cid']);
if($calendar_permissions['canbypasseventmod'] == 1)
{
$visible = 1;
}
}

		}

		}

		else
{
$visible = 1;
}

		else
{
$visible = 1;
}

			



		// Prepare an array for insertion into the database.
$this->event_insert_data = array(
'cid' => intval($event['cid']),

		// Prepare an array for insertion into the database.
$this->event_insert_data = array(
'cid' => intval($event['cid']),

Zeile 465Zeile 473
			'ignoretimezone' => intval($event['ignoretimezone']),
'usingtime' => intval($event['usingtime']),
'repeats' => $db->escape_string(serialize($event['repeats']))

			'ignoretimezone' => intval($event['ignoretimezone']),
'usingtime' => intval($event['usingtime']),
'repeats' => $db->escape_string(serialize($event['repeats']))

		);

$plugins->run_hooks_by_ref("datahandler_event_insert", $this);

		);

$plugins->run_hooks("datahandler_event_insert", $this);


$this->eid = $db->insert_query("events", $this->event_insert_data);



$this->eid = $db->insert_query("events", $this->event_insert_data);


Zeile 493Zeile 501
		{
die("The event needs to be validated before inserting it into the DB.");
}

		{
die("The event needs to be validated before inserting it into the DB.");
}

		



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

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

		{

		{

			die("The event is not valid.");
}

			die("The event is not valid.");
}





		$event = &$this->data;

$this->eid = $event['eid'];

		$event = &$this->data;

$this->eid = $event['eid'];





		if(isset($event['cid']))
{
$this->event_update_data['cid'] = $db->escape_string($event['cid']);
}

if(isset($event['name']))

		if(isset($event['cid']))
{
$this->event_update_data['cid'] = $db->escape_string($event['cid']);
}

if(isset($event['name']))

		{

		{

			$this->event_update_data['name'] = $db->escape_string($event['name']);
}

if(isset($event['description']))
{
$this->event_update_data['description'] = $db->escape_string($event['description']);

			$this->event_update_data['name'] = $db->escape_string($event['name']);
}

if(isset($event['description']))
{
$this->event_update_data['description'] = $db->escape_string($event['description']);

		}


		}


		if(isset($event['starttime']))
{
$this->event_update_data['starttime'] = intval($event['starttime']);

		if(isset($event['starttime']))
{
$this->event_update_data['starttime'] = intval($event['starttime']);

			$this->event_update_data['usingtime'] = intval($event['usingtime']);
}


			$this->event_update_data['usingtime'] = intval($event['usingtime']);
}


		if(isset($event['endtime']))
{
$this->event_update_data['endtime'] = intval($event['endtime']);
$this->event_update_data['usingtime'] = intval($event['usingtime']);
}
else

		if(isset($event['endtime']))
{
$this->event_update_data['endtime'] = intval($event['endtime']);
$this->event_update_data['usingtime'] = intval($event['usingtime']);
}
else

		{

		{

			$this->event_update_data['endtime'] = 0;
$this->event_update_data['usingtime'] = 0;
}

			$this->event_update_data['endtime'] = 0;
$this->event_update_data['usingtime'] = 0;
}

Zeile 548Zeile 556
		{
$this->event_update_data['timezone'] = $db->escape_string(floatval($event['timezone']));
}

		{
$this->event_update_data['timezone'] = $db->escape_string(floatval($event['timezone']));
}

		



		if(isset($event['ignoretimezone']))
{
$this->event_update_data['ignoretimezone'] = intval($event['ignoretimezone']);

		if(isset($event['ignoretimezone']))
{
$this->event_update_data['ignoretimezone'] = intval($event['ignoretimezone']);

		}		

		}


if(isset($event['private']))
{


if(isset($event['private']))
{

Zeile 569Zeile 577
			$this->event_update_data['uid'] = intval($event['uid']);
}


			$this->event_update_data['uid'] = intval($event['uid']);
}


		$plugins->run_hooks_by_ref("datahandler_event_update", $this);

		$plugins->run_hooks("datahandler_event_update", $this);


$db->update_query("events", $this->event_update_data, "eid='".intval($event['eid'])."'");



$db->update_query("events", $this->event_update_data, "eid='".intval($event['eid'])."'");