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

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
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']);

		$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
if($event['start_date']['month'] > 12 || $event['start_date']['month'] < 1)


//Check to see if the month is within 1 and 12
if($event['start_date']['month'] > 12 || $event['start_date']['month'] < 1)

		{

		{

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

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





		// For ranged events, we check the end date & times too
if($event['type'] == "ranged")
{

		// For ranged events, we check the end date & times too
if($event['type'] == "ranged")
{

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

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

Zeile 217Zeile 217
			{
$this->set_error("end_in_past");
return false;

			{
$this->set_error("end_in_past");
return false;

			}

			}

		}

		}





		// Save our time stamps for saving
$event['starttime'] = $start_timestamp;
$event['endtime'] = $end_timestamp;

		// Save our time stamps for saving
$event['starttime'] = $start_timestamp;
$event['endtime'] = $end_timestamp;





		return true;
}


		return true;
}


Zeile 237Zeile 237

// 24h time
if(count($matches) == 8)


// 24h time
if(count($matches) == 8)

		{

		{

			$hour = $matches[5];
$min = $matches[7];
}

			$hour = $matches[5];
$min = $matches[7];
}

Zeile 258Zeile 258
		}
return array("hour" => $hour, "min" => $min);
}

		}
return array("hour" => $hour, "min" => $min);
}





	function verify_repeats()
{
global $mybb;
$event = &$this->data;

if(!is_array($event['repeats']) || !$event['repeats']['repeats'])

	function verify_repeats()
{
global $mybb;
$event = &$this->data;

if(!is_array($event['repeats']) || !$event['repeats']['repeats'])

		{

		{

			return true;

			return true;

		}


		}


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

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

			return false;
}


			return false;
}


		switch($event['repeats']['repeats'])
{
case 1:

		switch($event['repeats']['repeats'])
{
case 1:

Zeile 385Zeile 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))
{
$this->verify_description();

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

Zeile 401Zeile 401
		{
$this->verify_repeats();
}

		{
$this->verify_repeats();
}

		



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

// We are done validating, return.

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

// We are done validating, return.

Zeile 409Zeile 409
		if(count($this->get_errors()) > 0)
{
return false;

		if(count($this->get_errors()) > 0)
{
return false;

		}

		}

		else
{
return true;

		else
{
return true;

Zeile 425Zeile 425
	function insert_event()
{
global $db, $mybb, $plugins;

	function insert_event()
{
global $db, $mybb, $plugins;





		// Yes, validating is required.
if(!$this->get_validated())
{
die("The event needs to be validated before inserting it into the DB.");
}

		// Yes, validating is required.
if(!$this->get_validated())
{
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 457Zeile 457
		{
$visible = 1;
}

		{
$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 473Zeile 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("datahandler_event_insert", $this);

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

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

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

Zeile 495Zeile 495
	function update_event()
{
global $db, $plugins;

	function update_event()
{
global $db, $plugins;





		// Yes, validating is required.
if(!$this->get_validated())
{
die("The event needs to be validated before inserting it into the DB.");
}

		// Yes, validating is required.
if(!$this->get_validated())
{
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 556Zeile 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']))
{