Vergleich inc/datahandlers/event.php - 1.6.0 - 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 5016 2010-06-12 00:24:02Z RyanGordon $

 * $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 387Zeile 395
		if($this->method == "insert" || array_key_exists('start_date', $event) || array_key_exists('end_date', $event))
{
$this->verify_date();

		if($this->method == "insert" || array_key_exists('start_date', $event) || array_key_exists('end_date', $event))
{
$this->verify_date();

		}

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

		}

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

			$this->verify_repeats();
}

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


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

Zeile 407Zeile 415
			return true;
}
}

			return true;
}
}





	/**
* Insert an event into the database.
*

	/**
* Insert an event into the database.
*

Zeile 417Zeile 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 449Zeile 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 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 487Zeile 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 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'])."'");