Zeile 6 | Zeile 6 |
---|
* Website: http://mybb.com * License: http://mybb.com/about/license *
|
* Website: http://mybb.com * License: http://mybb.com/about/license *
|
* $Id: event.php 5828 2012-05-08 16:06:16Z Tomm $
| * $Id$
|
*/
// Disallow direct access to this file for security reasons
| */
// Disallow direct access to this file for security reasons
|
Zeile 62 | Zeile 62 |
---|
function verify_name() { $name = &$this->data['name'];
|
function verify_name() { $name = &$this->data['name'];
|
| $name = utf8_handle_4byte_string($name);
|
$name = trim($name); if(!$name) {
| $name = trim($name); if(!$name) {
|
Zeile 79 | Zeile 80 |
---|
function verify_description() { $description = &$this->data['description'];
|
function verify_description() { $description = &$this->data['description'];
|
| $description = utf8_handle_4byte_string($description);
|
$description = trim($description); if(!$description) {
| $description = trim($description); if(!$description) {
|
Zeile 103 | Zeile 105 |
---|
$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']))) {
| if($event['start_date']['day'] > date("t", mktime(0, 0, 0, $event['start_date']['month'], 1, $event['start_date']['year']))) {
|
Zeile 128 | Zeile 134 |
---|
if($event['type'] == "ranged") { if(!$event['end_date']['day'] || !$event['end_date']['month'] || !$event['end_date']['year'])
|
if($event['type'] == "ranged") { if(!$event['end_date']['day'] || !$event['end_date']['month'] || !$event['end_date']['year'])
|
{ $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']))) { $this->set_error("invalid_end_date");
|
if($event['end_date']['day'] > date("t", mktime(0, 0, 0, $event['end_date']['month'], 1, $event['end_date']['year']))) { $this->set_error("invalid_end_date");
|
return false; }
| return false; }
|
// Calendar events can only be within the next 5 years if($event['end_date']['year'] > date("Y") + 5) { $this->set_error("invalid_end_year");
|
// Calendar events can only be within the next 5 years if($event['end_date']['year'] > date("Y") + 5) { $this->set_error("invalid_end_year");
|
return false; }
| return false; }
|
//Check to see if the month is within 1 and 12 if($event['end_date']['month'] > 12 || $event['end_date']['month'] < 1) {
| //Check to see if the month is within 1 and 12 if($event['end_date']['month'] > 12 || $event['end_date']['month'] < 1) {
|
Zeile 159 | Zeile 169 |
---|
if(($event['start_date']['time'] && !$event['end_date']['time']) || ($event['end_date']['time'] && !$event['start_date']['time'])) { $this->set_error("cant_specify_one_time");
|
if(($event['start_date']['time'] && !$event['end_date']['time']) || ($event['end_date']['time'] && !$event['start_date']['time'])) { $this->set_error("cant_specify_one_time");
|
return false;
| return false;
|
}
// Begin start time validation
| }
// Begin start time validation
|
Zeile 260 | Zeile 270 |
---|
{ 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 379 | Zeile 389 |
---|
$this->verify_name(); }
|
$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(); }
|
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" && $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("datahandler_event_validate", $this);
// We are done validating, return. $this->set_validated(true); if(count($this->get_errors()) > 0)
|
$plugins->run_hooks("datahandler_event_validate", $this);
// We are done validating, return. $this->set_validated(true); if(count($this->get_errors()) > 0)
|
{
| {
|
return false; } else
|
return false; } else
|
{
| {
|
return true; } }
| return true; } }
|
Zeile 423 | Zeile 433 |
---|
{ 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 449 | Zeile 459 |
---|
{ $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 465 | Zeile 475 |
---|
'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 478 | Zeile 488 |
---|
'visible' => $visible ); }
|
'visible' => $visible ); }
|
|
|
/** * Updates an event that is already in the database. *
| /** * Updates an event that is already in the database. *
|
Zeile 493 | Zeile 503 |
---|
{ 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 548 | Zeile 558 |
---|
{ $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'])) {
|