Version 5.0.0 beta 1
This commit is contained in:
1 parent
25ddeb65d6
commit
15c7beabc5
6736 files changed
+627902
-497943
No files matched your search
@@ -12,9 +12,32 @@
|
||||
namespace IPS\convert\Library;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use ErrorException;
|
||||
use Exception;
|
||||
use IPS\calendar\Calendar as CalendarClass;
|
||||
use IPS\calendar\Date;
|
||||
use IPS\calendar\Icalendar\ICSParser;
|
||||
use IPS\convert\App;
|
||||
use IPS\DateTime;
|
||||
use IPS\Db;
|
||||
use IPS\File;
|
||||
use IPS\GeoLocation;
|
||||
use IPS\Http\Url;
|
||||
use IPS\Lang;
|
||||
use IPS\Member;
|
||||
use IPS\Member\Club;
|
||||
use OutOfRangeException;
|
||||
use function count;
|
||||
use function defined;
|
||||
use function get_class;
|
||||
use function in_array;
|
||||
use function is_array;
|
||||
use function is_null;
|
||||
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -22,7 +45,7 @@ if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
* Invision Calendar Converter
|
||||
* @note We must extend the Core Library here so we can access methods like convertAttachment, convertFollow, etc
|
||||
*/
|
||||
class _Calendar extends Core
|
||||
class Calendar extends Core
|
||||
{
|
||||
/**
|
||||
* @brief Application
|
||||
@@ -48,7 +71,7 @@ class _Calendar extends Core
|
||||
$return[ $k ] = array(
|
||||
'step_title' => 'convert_calendar_calendars',
|
||||
'step_method' => 'convertCalendarCalendars',
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'calendar_calendars' ),
|
||||
'ips_rows' => Db::i()->select( 'COUNT(*)', 'calendar_calendars' ),
|
||||
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
|
||||
'per_cycle' => 200,
|
||||
'dependencies' => array(),
|
||||
@@ -60,7 +83,7 @@ class _Calendar extends Core
|
||||
$return[ $k ] = array(
|
||||
'step_title' => 'convert_calendar_venues',
|
||||
'step_method' => 'convertCalendarVenues',
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'calendar_venues' ),
|
||||
'ips_rows' => Db::i()->select( 'COUNT(*)', 'calendar_venues' ),
|
||||
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
|
||||
'per_cycle' => 200,
|
||||
'dependencies' => array( 'convertCalendarCalendars' ),
|
||||
@@ -72,7 +95,7 @@ class _Calendar extends Core
|
||||
$return[ $k ] = array(
|
||||
'step_title' => 'convert_calendar_events',
|
||||
'step_method' => 'convertCalendarEvents',
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'calendar_events' ),
|
||||
'ips_rows' => Db::i()->select( 'COUNT(*)', 'calendar_events' ),
|
||||
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
|
||||
'per_cycle' => 200,
|
||||
'dependencies' => array( 'convertCalendarCalendars' ),
|
||||
@@ -85,7 +108,7 @@ class _Calendar extends Core
|
||||
$return[ $k ] = array(
|
||||
'step_title' => 'convert_calendar_comments',
|
||||
'step_method' => 'convertCalendarComments',
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'calendar_event_comments' ),
|
||||
'ips_rows' => Db::i()->select( 'COUNT(*)', 'calendar_event_comments' ),
|
||||
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
|
||||
'per_cycle' => 200,
|
||||
'dependencies' => array( 'convertCalendarEvents' ),
|
||||
@@ -98,7 +121,7 @@ class _Calendar extends Core
|
||||
$return[ $k ] = array(
|
||||
'step_title' => 'convert_calendar_reviews',
|
||||
'step_method' => 'convertCalendarReviews',
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'calendar_event_reviews' ),
|
||||
'ips_rows' => Db::i()->select( 'COUNT(*)', 'calendar_event_reviews' ),
|
||||
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
|
||||
'per_cycle' => 200,
|
||||
'dependencies' => array( 'convertCalendarEvents' ),
|
||||
@@ -111,7 +134,7 @@ class _Calendar extends Core
|
||||
$return[ $k ] = array(
|
||||
'step_title' => 'convert_calendar_rsvps',
|
||||
'step_method' => 'convertCalendarRsvps',
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'calendar_event_rsvp' ),
|
||||
'ips_rows' => Db::i()->select( 'COUNT(*)', 'calendar_event_rsvp' ),
|
||||
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
|
||||
'per_cycle' => 200,
|
||||
'dependencies' => array( 'convertCalendarEvents' ),
|
||||
@@ -123,7 +146,7 @@ class _Calendar extends Core
|
||||
$return[ $k ] = array(
|
||||
'step_title' => 'convert_calendar_feeds',
|
||||
'step_method' => 'convertCalendarFeeds',
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'calendar_import_feeds' ),
|
||||
'ips_rows' => Db::i()->select( 'COUNT(*)', 'calendar_import_feeds' ),
|
||||
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
|
||||
'per_cycle' => 200,
|
||||
'dependencies' => array( 'convertCalendarCalendars' ),
|
||||
@@ -135,7 +158,7 @@ class _Calendar extends Core
|
||||
$return[ $k ] = array(
|
||||
'step_title' => 'convert_calendar_reminders',
|
||||
'step_method' => 'convertCalendarReminders',
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'calendar_event_reminders' ),
|
||||
'ips_rows' => Db::i()->select( 'COUNT(*)', 'calendar_event_reminders' ),
|
||||
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
|
||||
'per_cycle' => 200,
|
||||
'dependencies' => array( 'convertCalendarEvents' ),
|
||||
@@ -147,7 +170,7 @@ class _Calendar extends Core
|
||||
$return[ $k ] = array(
|
||||
'step_title' => 'convert_attachments',
|
||||
'step_method' => 'convertAttachments',
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_attachments_map', array( "location_key=?", 'calendar_Calendar' ) ),
|
||||
'ips_rows' => Db::i()->select( 'COUNT(*)', 'core_attachments_map', array( "location_key=?", 'calendar_Calendar' ) ),
|
||||
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
|
||||
'per_cycle' => 10,
|
||||
'dependencies' => array( 'convertCalendarEvents' ),
|
||||
@@ -184,7 +207,7 @@ class _Calendar extends Core
|
||||
protected function truncate( $method )
|
||||
{
|
||||
$return = array();
|
||||
$classname = \get_class( $this->software );
|
||||
$classname = get_class( $this->software );
|
||||
|
||||
if( $classname::canConvert() === NULL )
|
||||
{
|
||||
@@ -232,11 +255,11 @@ class _Calendar extends Core
|
||||
break;
|
||||
case 'convertAttachments':
|
||||
$attachIds = array();
|
||||
foreach( \IPS\Db::i()->select( 'attachment_id', 'core_attachments_map', array( 'location_key=?', 'calendar_Calendar' ) ) AS $attachment )
|
||||
foreach( Db::i()->select( 'attachment_id', 'core_attachments_map', array( 'location_key=?', 'calendar_Calendar' ) ) AS $attachment )
|
||||
{
|
||||
$attachIds[] = $attachment;
|
||||
}
|
||||
$return['convertAttachments'] = array( 'core_attachments' => \IPS\Db::i()->in( 'attach_id', $attachIds ), 'core_attachments_map' => array( "location_key=?", 'calendar_Calendar' ) );
|
||||
$return['convertAttachments'] = array( 'core_attachments' => Db::i()->in( 'attach_id', $attachIds ), 'core_attachments_map' => array( "location_key=?", 'calendar_Calendar' ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -268,14 +291,14 @@ class _Calendar extends Core
|
||||
{
|
||||
if ( !isset( $info['cal_id'] ) )
|
||||
{
|
||||
$this->software->app->log( 'calendar_missing_ids', __METHOD__, \IPS\convert\App::LOG_WARNING );
|
||||
$this->software->app->log( 'calendar_missing_ids', __METHOD__, App::LOG_WARNING );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ( !isset( $info['cal_title'] ) )
|
||||
{
|
||||
$name = "Calendar {$info['cal_id']}";
|
||||
$this->software->app->log( 'calendar_missing_title', __METHOD__, \IPS\convert\App::LOG_WARNING, $info['cal_id'] );
|
||||
$this->software->app->log( 'calendar_missing_title', __METHOD__, App::LOG_WARNING, $info['cal_id'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -293,7 +316,7 @@ class _Calendar extends Core
|
||||
unset( $info['cal_description'] );
|
||||
}
|
||||
|
||||
$info['cal_title_seo'] = \IPS\Http\Url::seoTitle( $name );
|
||||
$info['cal_title_seo'] = Url::seoTitle( $name );
|
||||
|
||||
/* Zero Defaults */
|
||||
foreach( array( 'cal_moderate', 'cal_comment_moderate', 'cal_allow_reviews', 'cal_review_moderate' ) AS $zeroDefault )
|
||||
@@ -311,13 +334,13 @@ class _Calendar extends Core
|
||||
|
||||
if ( !isset( $info['cal_position'] ) )
|
||||
{
|
||||
$position = \IPS\Db::i()->select( 'MAX(cal_position)', 'calendar_calendars' )->first();
|
||||
$position = Db::i()->select( 'MAX(cal_position)', 'calendar_calendars' )->first();
|
||||
$info['cal_position'] = $position + 1;
|
||||
}
|
||||
|
||||
if ( !isset( $info['cal_color'] ) )
|
||||
{
|
||||
$genericCalendar = new \IPS\calendar\Calendar;
|
||||
$genericCalendar = new Calendar;
|
||||
$info['cal_color'] = $genericCalendar->_generateColor();
|
||||
}
|
||||
|
||||
@@ -327,7 +350,7 @@ class _Calendar extends Core
|
||||
{
|
||||
$info['cal_club_id'] = $this->software->app->getLink( $info['cal_club_id'], 'core_clubs', TRUE );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
catch( OutOfRangeException $e )
|
||||
{
|
||||
$info['cal_club_id'] = NULL;
|
||||
}
|
||||
@@ -340,24 +363,24 @@ class _Calendar extends Core
|
||||
$id = $info['cal_id'];
|
||||
unset( $info['cal_id'] );
|
||||
|
||||
$inserted_id = \IPS\Db::i()->insert( 'calendar_calendars', $info );
|
||||
$inserted_id = Db::i()->insert( 'calendar_calendars', $info );
|
||||
$this->software->app->addLink( $inserted_id, $id, 'calendar_calendars' );
|
||||
|
||||
\IPS\Lang::saveCustom( 'calendar', "calendar_calendar_{$inserted_id}", $name );
|
||||
\IPS\Lang::saveCustom( 'calendar', "calendar_calendar_{$inserted_id}_desc", $desc );
|
||||
Lang::saveCustom( 'calendar', "calendar_calendar_{$inserted_id}", $name );
|
||||
Lang::saveCustom( 'calendar', "calendar_calendar_{$inserted_id}_desc", $desc );
|
||||
|
||||
\IPS\Db::i()->insert( 'core_permission_index', array( 'app' => 'calendar', 'perm_type' => 'calendar', 'perm_type_id' => $inserted_id, 'perm_view' => '' ) );
|
||||
Db::i()->insert( 'core_permission_index', array( 'app' => 'calendar', 'perm_type' => 'calendar', 'perm_type_id' => $inserted_id, 'perm_view' => '' ) );
|
||||
|
||||
if ( $info['cal_club_id'] )
|
||||
{
|
||||
\IPS\Db::i()->insert( 'core_clubs_node_map', array(
|
||||
Db::i()->insert( 'core_clubs_node_map', array(
|
||||
'node_id' => $inserted_id,
|
||||
'node_class' => "IPS\\calendar\\Calendar",
|
||||
'club_id' => $info['cal_club_id'],
|
||||
'name' => $name,
|
||||
) );
|
||||
|
||||
\IPS\calendar\Calendar::load( $inserted_id )->setPermissionsToClub( \IPS\Member\Club::load( $info['cal_club_id'] ) );
|
||||
|
||||
CalendarClass::load( $inserted_id )->setPermissionsToClub( Club::load( $info['cal_club_id'] ) );
|
||||
}
|
||||
|
||||
return $inserted_id;
|
||||
@@ -375,7 +398,7 @@ class _Calendar extends Core
|
||||
{
|
||||
if ( !isset( $info['event_id'] ) )
|
||||
{
|
||||
$this->software->app->log( 'calendar_event_missing_ids', __METHOD__, \IPS\convert\App::LOG_WARNING );
|
||||
$this->software->app->log( 'calendar_event_missing_ids', __METHOD__, App::LOG_WARNING );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -385,15 +408,15 @@ class _Calendar extends Core
|
||||
{
|
||||
$info['event_calendar_id'] = $this->software->app->getLink( $info['event_calendar_id'], 'calendar_calendars' );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
catch( OutOfRangeException $e )
|
||||
{
|
||||
$this->software->app->log( 'calendar_event_missing_calendar', __METHOD__, \IPS\convert\App::LOG_WARNING, $info['event_id'] );
|
||||
$this->software->app->log( 'calendar_event_missing_calendar', __METHOD__, App::LOG_WARNING, $info['event_id'] );
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->software->app->log( 'calendar_event_missing_calendar', __METHOD__, \IPS\convert\App::LOG_WARNING, $info['event_id'] );
|
||||
$this->software->app->log( 'calendar_event_missing_calendar', __METHOD__, App::LOG_WARNING, $info['event_id'] );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -403,7 +426,7 @@ class _Calendar extends Core
|
||||
{
|
||||
$info['event_member_id'] = $this->software->app->getLink( $info['event_member_id'], 'core_members', TRUE );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
catch( OutOfRangeException $e )
|
||||
{
|
||||
$info['event_member_id'] = 0;
|
||||
}
|
||||
@@ -419,7 +442,7 @@ class _Calendar extends Core
|
||||
{
|
||||
$info['event_venue'] = $this->software->app->getLink( $info['event_venue'], 'calendar_venues', TRUE );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
catch( OutOfRangeException $e )
|
||||
{
|
||||
$info['event_venue'] = NULL;
|
||||
}
|
||||
@@ -432,14 +455,14 @@ class _Calendar extends Core
|
||||
if ( !isset( $info['event_title'] ) )
|
||||
{
|
||||
$event['event_title'] = "Untitled Event {$info['event_id']}";
|
||||
$this->software->app->log( 'calendar_event_missing_title', __METHOD__, \IPS\convert\App::LOG_NOTICE, $info['event_id'] );
|
||||
$this->software->app->log( 'calendar_event_missing_title', __METHOD__, App::LOG_NOTICE, $info['event_id'] );
|
||||
}
|
||||
|
||||
/* Maye we can do this for other apps too? I have seen some complaints where content can be intentionally left blank in some softwares */
|
||||
if ( empty( $info['event_content'] ) )
|
||||
{
|
||||
$event['event_content'] = "<p>{$info['event_title']}</p>";
|
||||
$this->software->app->log( 'calendar_event_missing_content', __METHOD__, \IPS\convert\App::LOG_NOTICE, $info['event_id'] );
|
||||
$this->software->app->log( 'calendar_event_missing_content', __METHOD__, App::LOG_NOTICE, $info['event_id'] );
|
||||
}
|
||||
|
||||
/* Zero Defaults! */
|
||||
@@ -453,7 +476,7 @@ class _Calendar extends Core
|
||||
|
||||
if ( isset( $info['event_saved'] ) )
|
||||
{
|
||||
if ( $info['event_saved'] instanceof \IPS\DateTime )
|
||||
if ( $info['event_saved'] instanceof DateTime )
|
||||
{
|
||||
$info['event_saved'] = $info['event_saved']->getTimestamp();
|
||||
}
|
||||
@@ -465,7 +488,7 @@ class _Calendar extends Core
|
||||
|
||||
if ( isset( $info['event_lastupdated'] ) )
|
||||
{
|
||||
if ( $info['event_lastupdated'] instanceof \IPS\DateTime )
|
||||
if ( $info['event_lastupdated'] instanceof DateTime )
|
||||
{
|
||||
$info['event_lastupdated'] = $info['event_lastupdated']->getTimestamp();
|
||||
}
|
||||
@@ -478,20 +501,20 @@ class _Calendar extends Core
|
||||
if ( isset( $info['event_recurring'] ) )
|
||||
{
|
||||
/* If we have an array, pass off to ICSParser so we can build it */
|
||||
if ( \is_array( $info['event_recurring'] ) )
|
||||
if ( is_array( $info['event_recurring'] ) )
|
||||
{
|
||||
$info['event_recurring'] = \IPS\calendar\Icalendar\ICSParser::buildRrule( $info['event_recurring'] );
|
||||
$info['event_recurring'] = ICSParser::buildRrule( $info['event_recurring'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* If we didn't, make sure it's valid */
|
||||
try
|
||||
{
|
||||
\IPS\calendar\Icalendar\ICSParser::parseRrule( $info['event_recurring'] );
|
||||
ICSParser::parseRrule( $info['event_recurring'] );
|
||||
}
|
||||
catch( \Exception $e )
|
||||
catch( Exception $e )
|
||||
{
|
||||
$this->software->app->log( 'calendar_event_recurring_invalid', __METHOD__, \IPS\convert\App::LOG_NOTICE, $info['event_id'] );
|
||||
$this->software->app->log( 'calendar_event_recurring_invalid', __METHOD__, App::LOG_NOTICE, $info['event_id'] );
|
||||
$info['event_recurring'] = NULL;
|
||||
}
|
||||
}
|
||||
@@ -503,30 +526,30 @@ class _Calendar extends Core
|
||||
|
||||
if ( isset( $info['event_start_date'] ) )
|
||||
{
|
||||
if ( $info['event_start_date'] instanceof \IPS\calendar\Date )
|
||||
if ( $info['event_start_date'] instanceof Date )
|
||||
{
|
||||
$info['event_start_date'] = $info['event_start_date']->mysqlDatetime();
|
||||
}
|
||||
else if ( $info['event_start_date'] instanceof \IPS\DateTime )
|
||||
else if ( $info['event_start_date'] instanceof DateTime )
|
||||
{
|
||||
$info['event_start_date'] = \IPS\calendar\Date::create( (string) $info['event_start_date'] )->mysqlDatetime();
|
||||
$info['event_start_date'] = Date::create( (string) $info['event_start_date'] )->mysqlDatetime();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->software->app->log( 'calendar_event_missing_start_date', __METHOD__, \IPS\convert\App::LOG_WARNING );
|
||||
$this->software->app->log( 'calendar_event_missing_start_date', __METHOD__, App::LOG_WARNING );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ( isset( $info['event_end_date'] ) )
|
||||
{
|
||||
if ( $info['event_end_date'] instanceof \IPS\calendar\Date )
|
||||
if ( $info['event_end_date'] instanceof Date )
|
||||
{
|
||||
$info['event_end_date'] = $info['event_end_date']->mysqlDatetime();
|
||||
}
|
||||
else if ( $info['event_end_date'] instanceof \IPS\DateTime )
|
||||
else if ( $info['event_end_date'] instanceof DateTime )
|
||||
{
|
||||
$info['event_end_date'] = \IPS\calendar\Date::create( (string) $info['event_end_date'] )->mysqlDatetime();
|
||||
$info['event_end_date'] = Date::create( (string) $info['event_end_date'] )->mysqlDatetime();
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -534,7 +557,7 @@ class _Calendar extends Core
|
||||
$info['event_end_date'] = NULL;
|
||||
}
|
||||
|
||||
$info['event_title_seo'] = \IPS\Http\Url::seoTitle( $info['event_title'] );
|
||||
$info['event_title_seo'] = Url::seoTitle( $info['event_title'] );
|
||||
$info['event_post_key'] = md5( microtime() );
|
||||
|
||||
if ( !isset( $info['event_ip_address'] ) OR filter_var( $info['event_ip_address'], FILTER_VALIDATE_IP ) === FALSE )
|
||||
@@ -544,7 +567,7 @@ class _Calendar extends Core
|
||||
|
||||
if ( isset( $info['event_last_comment'] ) )
|
||||
{
|
||||
if ( $info['event_last_comment'] instanceof \IPS\DateTime )
|
||||
if ( $info['event_last_comment'] instanceof DateTime )
|
||||
{
|
||||
$info['event_last_comment'] = $info['event_last_comment']->getTimestamp();
|
||||
}
|
||||
@@ -556,7 +579,7 @@ class _Calendar extends Core
|
||||
|
||||
if ( isset( $info['event_last_review'] ) )
|
||||
{
|
||||
if ( $info['event_last_review'] instanceof \IPS\DateTime )
|
||||
if ( $info['event_last_review'] instanceof DateTime )
|
||||
{
|
||||
$info['event_last_review'] = $info['event_last_review']->getTimestamp();
|
||||
}
|
||||
@@ -577,7 +600,7 @@ class _Calendar extends Core
|
||||
{
|
||||
$info['event_approved_by'] = $this->software->app->getLink( $info['event_approved_by'], 'core_members', TRUE );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
catch( OutOfRangeException $e )
|
||||
{
|
||||
$info['event_approved_by'] = NULL;
|
||||
}
|
||||
@@ -589,7 +612,7 @@ class _Calendar extends Core
|
||||
|
||||
if ( isset( $info['event_approved_on'] ) )
|
||||
{
|
||||
if ( $info['event_approved_on'] instanceof \IPS\DateTime )
|
||||
if ( $info['event_approved_on'] instanceof DateTime )
|
||||
{
|
||||
$info['event_approved_on'] = $info['event_approved_on']->getTimestamp();
|
||||
}
|
||||
@@ -601,11 +624,11 @@ class _Calendar extends Core
|
||||
|
||||
if ( isset( $info['event_location'] ) )
|
||||
{
|
||||
if ( \is_array( $info['event_location'] ) AND isset( $info['event_location']['lat'] ) AND isset( $info['event_location']['long'] ) )
|
||||
if ( is_array( $info['event_location'] ) AND isset( $info['event_location']['lat'] ) AND isset( $info['event_location']['long'] ) )
|
||||
{
|
||||
$info['event_location'] = (string) \IPS\GeoLocation::getFromLatLong( $info['event_location']['lat'], $info['event_location']['long'] );
|
||||
$info['event_location'] = (string) GeoLocation::getFromLatLong( $info['event_location']['lat'], $info['event_location']['long'] );
|
||||
}
|
||||
else if ( $info['event_location'] instanceof \IPS\GeoLocation )
|
||||
else if ( $info['event_location'] instanceof GeoLocation )
|
||||
{
|
||||
$info['event_location'] = (string) $info['event_location'];
|
||||
}
|
||||
@@ -626,7 +649,7 @@ class _Calendar extends Core
|
||||
{
|
||||
$info['event_album'] = $this->software->app->getSiblingLink( $info['event_album'], 'gallery_albums', 'gallery' );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
catch( OutOfRangeException $e )
|
||||
{
|
||||
$info['event_album'] = NULL;
|
||||
}
|
||||
@@ -636,23 +659,23 @@ class _Calendar extends Core
|
||||
$info['event_album'] = NULL;
|
||||
}
|
||||
|
||||
if ( isset( $info['event_cover_photo'] ) AND ( !\is_null( $filepath ) OR !\is_null( $filedata ) ) )
|
||||
if ( isset( $info['event_cover_photo'] ) AND ( !is_null( $filepath ) OR !is_null( $filedata ) ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
if ( \is_null( $filedata ) AND !\is_null( $filepath ) )
|
||||
if ( is_null( $filedata ) AND !is_null( $filepath ) )
|
||||
{
|
||||
$filedata = file_get_contents( $filepath );
|
||||
}
|
||||
|
||||
$file = \IPS\File::create( 'calendar_Events', $info['event_cover_photo'], $filedata );
|
||||
$file = File::create( 'calendar_Events', $info['event_cover_photo'], $filedata );
|
||||
$info['event_cover_photo'] = (string) $file;
|
||||
}
|
||||
catch( \Exception $e )
|
||||
catch( Exception $e )
|
||||
{
|
||||
$info['event_cover_photo'] = NULL;
|
||||
}
|
||||
catch( \ErrorException $e )
|
||||
catch( ErrorException $e )
|
||||
{
|
||||
$info['event_cover_photo'] = NULL;
|
||||
}
|
||||
@@ -664,7 +687,7 @@ class _Calendar extends Core
|
||||
|
||||
if ( isset( $info['event_edit_time'] ) )
|
||||
{
|
||||
if ( $info['event_edit_time'] instanceof \IPS\DateTime )
|
||||
if ( $info['event_edit_time'] instanceof DateTime )
|
||||
{
|
||||
$info['event_edit_time'] = $info['event_edit_time']->getTimestamp();
|
||||
}
|
||||
@@ -692,7 +715,7 @@ class _Calendar extends Core
|
||||
$id = $info['event_id'];
|
||||
unset( $info['event_id'] );
|
||||
|
||||
$inserted_id = \IPS\Db::i()->insert( 'calendar_events', $info );
|
||||
$inserted_id = Db::i()->insert( 'calendar_events', $info );
|
||||
$this->software->app->addLink( $inserted_id, $id, 'calendar_events' );
|
||||
|
||||
return $inserted_id;
|
||||
@@ -708,7 +731,7 @@ class _Calendar extends Core
|
||||
{
|
||||
if ( !isset( $info['comment_id'] ) )
|
||||
{
|
||||
$this->software->app->log( 'calendar_event_comment_missing_ids', __METHOD__, \IPS\convert\App::LOG_WARNING );
|
||||
$this->software->app->log( 'calendar_event_comment_missing_ids', __METHOD__, App::LOG_WARNING );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -718,21 +741,21 @@ class _Calendar extends Core
|
||||
{
|
||||
$info['comment_eid'] = $this->software->app->getLink( $info['comment_eid'], 'calendar_events' );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
catch( OutOfRangeException $e )
|
||||
{
|
||||
$this->software->app->log( 'calendar_event_comment_missing_event', __METHOD__, \IPS\convert\App::LOG_WARNING, $info['comment_id'] );
|
||||
$this->software->app->log( 'calendar_event_comment_missing_event', __METHOD__, App::LOG_WARNING, $info['comment_id'] );
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->software->app->log( 'calendar_event_comment_missing_event', __METHOD__, \IPS\convert\App::LOG_WARNING, $info['comment_id'] );
|
||||
$this->software->app->log( 'calendar_event_comment_missing_event', __METHOD__, App::LOG_WARNING, $info['comment_id'] );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ( empty( $info['comment_text'] ) )
|
||||
{
|
||||
$this->software->app->log( 'calendar_event_comment_empty', __METHOD__, \IPS\convert\App::LOG_WARNING, $info['comment_id'] );
|
||||
$this->software->app->log( 'calendar_event_comment_empty', __METHOD__, App::LOG_WARNING, $info['comment_id'] );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -742,7 +765,7 @@ class _Calendar extends Core
|
||||
{
|
||||
$info['comment_mid'] = $this->software->app->getLink( $info['comment_mid'], 'core_members', TRUE );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
catch( OutOfRangeException $e )
|
||||
{
|
||||
$info['comment_mid'] = 0;
|
||||
}
|
||||
@@ -754,7 +777,7 @@ class _Calendar extends Core
|
||||
|
||||
if ( isset( $info['comment_date'] ) )
|
||||
{
|
||||
if ( $info['comment_date'] instanceof \IPS\DateTime )
|
||||
if ( $info['comment_date'] instanceof DateTime )
|
||||
{
|
||||
$info['comment_date'] = $info['comment_date']->getTimestamp();
|
||||
}
|
||||
@@ -776,7 +799,7 @@ class _Calendar extends Core
|
||||
|
||||
if ( isset( $info['comment_edit_time'] ) )
|
||||
{
|
||||
if ( $info['comment_edit_time'] instanceof \IPS\DateTime )
|
||||
if ( $info['comment_edit_time'] instanceof DateTime )
|
||||
{
|
||||
$info['comment_edit_time'] = $info['comment_edit_time']->getTimestamp();
|
||||
}
|
||||
@@ -798,7 +821,7 @@ class _Calendar extends Core
|
||||
|
||||
if ( !isset( $info['comment_author'] ) )
|
||||
{
|
||||
$author = \IPS\Member::load( $info['comment_mid'] );
|
||||
$author = Member::load( $info['comment_mid'] );
|
||||
|
||||
if ( $author->member_id )
|
||||
{
|
||||
@@ -813,7 +836,7 @@ class _Calendar extends Core
|
||||
$id = $info['comment_id'];
|
||||
unset( $info['comment_id'] );
|
||||
|
||||
$inserted_id = \IPS\Db::i()->insert( 'calendar_event_comments', $info );
|
||||
$inserted_id = Db::i()->insert( 'calendar_event_comments', $info );
|
||||
$this->software->app->addLink( $inserted_id, $id, 'calendar_event_comments' );
|
||||
|
||||
return $inserted_id;
|
||||
@@ -829,7 +852,7 @@ class _Calendar extends Core
|
||||
{
|
||||
if ( !isset( $info['review_id'] ) )
|
||||
{
|
||||
$this->software->app->log( 'calendar_event_review_missing_ids', __METHOD__, \IPS\convert\App::LOG_WARNING );
|
||||
$this->software->app->log( 'calendar_event_review_missing_ids', __METHOD__, App::LOG_WARNING );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -839,15 +862,15 @@ class _Calendar extends Core
|
||||
{
|
||||
$info['review_eid'] = $this->software->app->getLink( $info['review_eid'], 'calendar_events' );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
catch( OutOfRangeException $e )
|
||||
{
|
||||
$this->software->app->log( 'calendar_event_review_missing_event', __METHOD__, \IPS\convert\App::LOG_WARNING, $info['review_id'] );
|
||||
$this->software->app->log( 'calendar_event_review_missing_event', __METHOD__, App::LOG_WARNING, $info['review_id'] );
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->software->app->log( 'calendar_event_review_missing_event', __METHOD__, \IPS\convert\App::LOG_WARNING, $info['review_id'] );
|
||||
$this->software->app->log( 'calendar_event_review_missing_event', __METHOD__, App::LOG_WARNING, $info['review_id'] );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -858,28 +881,28 @@ class _Calendar extends Core
|
||||
{
|
||||
$info['review_mid'] = $this->software->app->getLink( $info['review_mid'], 'core_members', TRUE );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
catch( OutOfRangeException $e )
|
||||
{
|
||||
$this->software->app->log( 'calendar_event_review_missing_member', __METHOD__, \IPS\convert\App::LOG_WARNING, $info['review_id'] );
|
||||
$this->software->app->log( 'calendar_event_review_missing_member', __METHOD__, App::LOG_WARNING, $info['review_id'] );
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->software->app->log( 'calendar_event_review_missing_member', __METHOD__, \IPS\convert\App::LOG_WARNING, $info['review_id'] );
|
||||
$this->software->app->log( 'calendar_event_review_missing_member', __METHOD__, App::LOG_WARNING, $info['review_id'] );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ( empty( $info['review_text'] ) )
|
||||
{
|
||||
$this->software->app->log( 'calendar_event_review_empty', __METHOD__, \IPS\convert\App::LOG_WARNING, $info['review_id'] );
|
||||
$this->software->app->log( 'calendar_event_review_empty', __METHOD__, App::LOG_WARNING, $info['review_id'] );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* This seems silly, but we really do need a rating */
|
||||
if ( !isset( $info['review_rating'] ) OR $info['review_rating'] < 1 )
|
||||
{
|
||||
$this->software->app->log( 'calendar_event_review_invalid_rating', __METHOD__, \IPS\convert\App::LOG_WARNING, $info['review_id'] );
|
||||
$this->software->app->log( 'calendar_event_review_invalid_rating', __METHOD__, App::LOG_WARNING, $info['review_id'] );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -890,7 +913,7 @@ class _Calendar extends Core
|
||||
|
||||
if ( isset( $info['review_edit_time'] ) )
|
||||
{
|
||||
if ( $info['review_edit_time'] instanceof \IPS\DateTime )
|
||||
if ( $info['review_edit_time'] instanceof DateTime )
|
||||
{
|
||||
$info['review_edit_time'] = $info['review_edit_time']->getTimestamp();
|
||||
}
|
||||
@@ -907,7 +930,7 @@ class _Calendar extends Core
|
||||
|
||||
if ( isset( $info['review_date'] ) )
|
||||
{
|
||||
if ( $info['review_date'] instanceof \IPS\DateTime )
|
||||
if ( $info['review_date'] instanceof DateTime )
|
||||
{
|
||||
$info['review_date'] = $info['review_date']->getTimestamp();
|
||||
}
|
||||
@@ -924,7 +947,7 @@ class _Calendar extends Core
|
||||
|
||||
if ( !isset( $info['review_author_name'] ) )
|
||||
{
|
||||
$author = \IPS\Member::load( $info['review_mid'] );
|
||||
$author = Member::load( $info['review_mid'] );
|
||||
|
||||
if ( $author->member_id )
|
||||
{
|
||||
@@ -938,13 +961,13 @@ class _Calendar extends Core
|
||||
|
||||
if ( isset( $info['review_votes_data'] ) )
|
||||
{
|
||||
if ( !\is_array( $info['review_votes_data'] ) )
|
||||
if ( !is_array( $info['review_votes_data'] ) )
|
||||
{
|
||||
$info['review_votes_data'] = json_decode( $info['review_votes_data'], TRUE );
|
||||
}
|
||||
|
||||
$newVoters = array();
|
||||
if ( !\is_null( $info['review_votes_data'] ) AND \count( $info['review_votes_data'] ) )
|
||||
if ( !is_null( $info['review_votes_data'] ) AND count( $info['review_votes_data'] ) )
|
||||
{
|
||||
foreach( $info['review_votes_data'] as $member => $vote )
|
||||
{
|
||||
@@ -952,7 +975,7 @@ class _Calendar extends Core
|
||||
{
|
||||
$memberId = $this->software->app->getLink( $member, 'core_members', TRUE );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
catch( OutOfRangeException $e )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -961,7 +984,7 @@ class _Calendar extends Core
|
||||
}
|
||||
}
|
||||
|
||||
if ( \count( $newVoters ) )
|
||||
if ( count( $newVoters ) )
|
||||
{
|
||||
$info['review_votes_data'] = json_encode( $newVoters );
|
||||
}
|
||||
@@ -977,19 +1000,19 @@ class _Calendar extends Core
|
||||
|
||||
if ( !isset( $info['review_votes'] ) )
|
||||
{
|
||||
if ( \is_null( $info['review_votes_data'] ) )
|
||||
if ( is_null( $info['review_votes_data'] ) )
|
||||
{
|
||||
$info['review_votes'] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$info['review_votes'] = \count( json_decode( $info['review_votes_data'], TRUE ) );
|
||||
$info['review_votes'] = count( json_decode( $info['review_votes_data'], TRUE ) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( !isset( $info['review_votes_helpful'] ) )
|
||||
{
|
||||
if ( \is_null( $info['review_votes_data'] ) )
|
||||
if ( is_null( $info['review_votes_data'] ) )
|
||||
{
|
||||
$info['review_votes_helpful'] = 0;
|
||||
}
|
||||
@@ -1016,7 +1039,7 @@ class _Calendar extends Core
|
||||
$id = $info['review_id'];
|
||||
unset( $info['review_id'] );
|
||||
|
||||
$inserted_id = \IPS\Db::i()->insert( 'calendar_event_reviews', $info );
|
||||
$inserted_id = Db::i()->insert( 'calendar_event_reviews', $info );
|
||||
$this->software->app->addLink( $inserted_id, $id, 'calendar_event_reviews' );
|
||||
|
||||
return $inserted_id;
|
||||
@@ -1042,15 +1065,15 @@ class _Calendar extends Core
|
||||
{
|
||||
$info['rsvp_event_id'] = $this->software->app->getLink( $info['rsvp_event_id'], 'calendar_events' );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
catch( OutOfRangeException $e )
|
||||
{
|
||||
$this->software->app->log( 'calendar_rsvp_missing_event', __METHOD__, \IPS\convert\App::LOG_WARNING, ( $hasId ) ? $info['rsvp_id'] : NULL );
|
||||
$this->software->app->log( 'calendar_rsvp_missing_event', __METHOD__, App::LOG_WARNING, ( $hasId ) ? $info['rsvp_id'] : NULL );
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->software->app->log( 'calendar_rsvp_missing_event', __METHOD__, \IPS\convert\App::LOG_WARNING, ( $hasId ) ? $info['rsvp_id'] : NULL );
|
||||
$this->software->app->log( 'calendar_rsvp_missing_event', __METHOD__, App::LOG_WARNING, ( $hasId ) ? $info['rsvp_id'] : NULL );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -1060,21 +1083,21 @@ class _Calendar extends Core
|
||||
{
|
||||
$info['rsvp_member_id'] = $this->software->app->getLink( $info['rsvp_member_id'], 'core_members', TRUE );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
catch( OutOfRangeException $e )
|
||||
{
|
||||
$this->software->app->log( 'calendar_rsvp_missing_member', __METHOD__, \IPS\convert\App::LOG_WARNING, ( $hasId ) ? $info['rsvp_id'] : NULL );
|
||||
$this->software->app->log( 'calendar_rsvp_missing_member', __METHOD__, App::LOG_WARNING, ( $hasId ) ? $info['rsvp_id'] : NULL );
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->software->app->log( 'calendar_rsvp_missing_member', __METHOD__, \IPS\convert\App::LOG_WARNING, ( $hasId ) ? $info['rsvp_id'] : NULL );
|
||||
$this->software->app->log( 'calendar_rsvp_missing_member', __METHOD__, App::LOG_WARNING, ( $hasId ) ? $info['rsvp_id'] : NULL );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ( isset( $info['rsvp_date'] ) )
|
||||
{
|
||||
if ( $info['rsvp_date'] instanceof \IPS\DateTime )
|
||||
if ( $info['rsvp_date'] instanceof DateTime )
|
||||
{
|
||||
$info['rsvp_date'] = $info['rsvp_date']->getTimestamp();
|
||||
}
|
||||
@@ -1084,9 +1107,9 @@ class _Calendar extends Core
|
||||
$info['rsvp_date'] = time();
|
||||
}
|
||||
|
||||
if ( !isset( $info['rsvp_response'] ) OR !\in_array( $info['rsvp_response'], array( 0, 1, 2 ) ) )
|
||||
if ( !isset( $info['rsvp_response'] ) OR !in_array( $info['rsvp_response'], array( 0, 1, 2 ) ) )
|
||||
{
|
||||
$this->software->app->log( 'calendar_rsvp_invalid_response', __METHOD__, \IPS\convert\App::LOG_WARNING, ( $hasId ) ? $info['rsvp_id'] : NULL );
|
||||
$this->software->app->log( 'calendar_rsvp_invalid_response', __METHOD__, App::LOG_WARNING, ( $hasId ) ? $info['rsvp_id'] : NULL );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -1096,7 +1119,7 @@ class _Calendar extends Core
|
||||
unset( $info['rsvp_id'] );
|
||||
}
|
||||
|
||||
$inserted_id = \IPS\Db::i()->insert( 'calendar_event_rsvp', $info );
|
||||
$inserted_id = Db::i()->insert( 'calendar_event_rsvp', $info );
|
||||
|
||||
if ( $hasId )
|
||||
{
|
||||
@@ -1116,25 +1139,25 @@ class _Calendar extends Core
|
||||
{
|
||||
if ( !isset( $info['feed_id'] ) )
|
||||
{
|
||||
$this->software->app->log( 'calendar_feed_missing_ids', __METHOD__, \IPS\convert\App::LOG_WARNING );
|
||||
$this->software->app->log( 'calendar_feed_missing_ids', __METHOD__, App::LOG_WARNING );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ( !isset( $info['feed_title'] ) )
|
||||
{
|
||||
$info['feed_title'] = "Untitled Feed {$info['feed_id']}";
|
||||
$this->software->app->log( 'calendar_feed_missing_title', __METHOD__, \IPS\convert\App::LOG_WARNING, $info['feed_id'] );
|
||||
$this->software->app->log( 'calendar_feed_missing_title', __METHOD__, App::LOG_WARNING, $info['feed_id'] );
|
||||
}
|
||||
|
||||
if ( !isset( $info['feed_url'] ) OR filter_var( $info['feed_url'], FILTER_VALIDATE_URL ) === FALSE )
|
||||
{
|
||||
$this->software->app->log( 'calendar_feed_invalid_url', __METHOD__, \IPS\convert\App::LOG_WARNING, $info['feed_id'] );
|
||||
$this->software->app->log( 'calendar_feed_invalid_url', __METHOD__, App::LOG_WARNING, $info['feed_id'] );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ( isset( $info['feed_added'] ) )
|
||||
{
|
||||
if ( $info['feed_added'] instanceof \IPS\DateTime )
|
||||
if ( $info['feed_added'] instanceof DateTime )
|
||||
{
|
||||
$info['feed_added'] = $info['feed_added']->getTimestamp();
|
||||
}
|
||||
@@ -1146,7 +1169,7 @@ class _Calendar extends Core
|
||||
|
||||
if ( isset( $info['feed_lastupdated'] ) )
|
||||
{
|
||||
if ( $info['feed_lastupdated'] instanceof \IPS\DateTime )
|
||||
if ( $info['feed_lastupdated'] instanceof DateTime )
|
||||
{
|
||||
$info['feed_lastupdated'] = $info['feed_lastupdated']->getTimestamp();
|
||||
}
|
||||
@@ -1162,15 +1185,15 @@ class _Calendar extends Core
|
||||
{
|
||||
$info['feed_calendar_id'] = $this->software->app->getLink( $info['feed_calendar_id'], 'calendar_calendars' );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
catch( OutOfRangeException $e )
|
||||
{
|
||||
$this->software->app->log( 'calendar_feed_missing_calendar', __METHOD__, \IPS\convert\App::LOG_WARNING, $info['feed_id'] );
|
||||
$this->software->app->log( 'calendar_feed_missing_calendar', __METHOD__, App::LOG_WARNING, $info['feed_id'] );
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->software->app->log( 'calendar_feed_missing_calendar', __METHOD__, \IPS\convert\App::LOG_WARNING, $info['feed_id'] );
|
||||
$this->software->app->log( 'calendar_feed_missing_calendar', __METHOD__, App::LOG_WARNING, $info['feed_id'] );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -1180,21 +1203,21 @@ class _Calendar extends Core
|
||||
{
|
||||
$info['feed_member_id'] = $this->software->app->getLink( $info['feed_member_id'], 'core_members', TRUE );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
catch( OutOfRangeException $e )
|
||||
{
|
||||
$this->software->app->log( 'calendar_feed_missing_member', __METHOD__, \IPS\convert\App::LOG_WARNING, $info['feed_id'] );
|
||||
$this->software->app->log( 'calendar_feed_missing_member', __METHOD__, App::LOG_WARNING, $info['feed_id'] );
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->software->app->log( 'calendar_feed_missing_member', __METHOD__, \IPS\convert\App::LOG_WARNING, $info['feed_id'] );
|
||||
$this->software->app->log( 'calendar_feed_missing_member', __METHOD__, App::LOG_WARNING, $info['feed_id'] );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ( isset( $info['feed_last_run'] ) )
|
||||
{
|
||||
if ( $info['feed_last_run'] instanceof \IPS\DateTime )
|
||||
if ( $info['feed_last_run'] instanceof DateTime )
|
||||
{
|
||||
$info['feed_last_run'] = $info['feed_last_run']->getTimestamp();
|
||||
}
|
||||
@@ -1212,7 +1235,7 @@ class _Calendar extends Core
|
||||
$id = $info['feed_id'];
|
||||
unset( $info['feed_id'] );
|
||||
|
||||
$inserted_id = \IPS\Db::i()->insert( 'calendar_import_feeds', $info );
|
||||
$inserted_id = Db::i()->insert( 'calendar_import_feeds', $info );
|
||||
$this->software->app->addLink( $inserted_id, $id, 'calendar_import_feeds' );
|
||||
|
||||
return $inserted_id;
|
||||
@@ -1228,14 +1251,14 @@ class _Calendar extends Core
|
||||
{
|
||||
if ( !isset( $info['venue_id'] ) )
|
||||
{
|
||||
$this->software->app->log( 'calendar_venue_missing_ids', __METHOD__, \IPS\convert\App::LOG_WARNING );
|
||||
$this->software->app->log( 'calendar_venue_missing_ids', __METHOD__, App::LOG_WARNING );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ( !isset( $info['venue_title'] ) )
|
||||
{
|
||||
$info['venue_title'] = "Untitled Venue {$info['venue_id']}";
|
||||
$this->software->app->log( 'calendar_venue_missing_title', __METHOD__, \IPS\convert\App::LOG_WARNING, $info['venue_id'] );
|
||||
$this->software->app->log( 'calendar_venue_missing_title', __METHOD__, App::LOG_WARNING, $info['venue_id'] );
|
||||
}
|
||||
|
||||
if ( isset( $info['venue_enabled'] ) )
|
||||
@@ -1245,36 +1268,36 @@ class _Calendar extends Core
|
||||
|
||||
if ( isset( $info['venue_address'] ) )
|
||||
{
|
||||
if ( \is_array( $info['venue_address'] ) AND isset( $info['venue_address']['lat'] ) AND isset( $info['venue_address']['long'] ) )
|
||||
if ( is_array( $info['venue_address'] ) AND isset( $info['venue_address']['lat'] ) AND isset( $info['venue_address']['long'] ) )
|
||||
{
|
||||
$info['venue_address'] = (string) \IPS\GeoLocation::getFromLatLong( $info['venue_address']['lat'], $info['venue_address']['long'] );
|
||||
$info['venue_address'] = (string) GeoLocation::getFromLatLong( $info['venue_address']['lat'], $info['venue_address']['long'] );
|
||||
}
|
||||
else if ( $info['venue_address'] instanceof \IPS\GeoLocation )
|
||||
else if ( $info['venue_address'] instanceof GeoLocation )
|
||||
{
|
||||
$info['venue_address'] = (string) $info['venue_address'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->software->app->log( 'calendar_venue_missing_address', __METHOD__, \IPS\convert\App::LOG_WARNING );
|
||||
$this->software->app->log( 'calendar_venue_missing_address', __METHOD__, App::LOG_WARNING );
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->software->app->log( 'calendar_venue_missing_address', __METHOD__, \IPS\convert\App::LOG_WARNING );
|
||||
$this->software->app->log( 'calendar_venue_missing_address', __METHOD__, App::LOG_WARNING );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ( !isset( $info['venue_position'] ) )
|
||||
{
|
||||
$position = \IPS\Db::i()->select( 'MAX(venue_position)', 'calendar_venues' )->first();
|
||||
$position = Db::i()->select( 'MAX(venue_position)', 'calendar_venues' )->first();
|
||||
$info['venue_position'] = $position + 1;
|
||||
}
|
||||
|
||||
$id = $info['venue_id'];
|
||||
unset( $info['venue_id'] );
|
||||
|
||||
$inserted_id = \IPS\Db::i()->insert( 'calendar_venues', $info );
|
||||
$inserted_id = Db::i()->insert( 'calendar_venues', $info );
|
||||
$this->software->app->addLink( $inserted_id, $id, 'calendar_venues' );
|
||||
|
||||
return $inserted_id;
|
||||
@@ -1290,7 +1313,7 @@ class _Calendar extends Core
|
||||
{
|
||||
if ( !isset( $info['reminder_id'] ) )
|
||||
{
|
||||
$this->software->app->log( 'calendar_reminder_missing_ids', __METHOD__, \IPS\convert\App::LOG_WARNING );
|
||||
$this->software->app->log( 'calendar_reminder_missing_ids', __METHOD__, App::LOG_WARNING );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -1305,15 +1328,15 @@ class _Calendar extends Core
|
||||
{
|
||||
$info['reminder_event_id'] = $this->software->app->getLink( $info['reminder_event_id'], 'calendar_events' );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
catch( OutOfRangeException $e )
|
||||
{
|
||||
$this->software->app->log( 'calendar_reminder_missing_event', __METHOD__, \IPS\convert\App::LOG_WARNING, $info['reminder_id'] );
|
||||
$this->software->app->log( 'calendar_reminder_missing_event', __METHOD__, App::LOG_WARNING, $info['reminder_id'] );
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->software->app->log( 'calendar_reminder_missing_event', __METHOD__, \IPS\convert\App::LOG_WARNING, $info['reminder_id'] );
|
||||
$this->software->app->log( 'calendar_reminder_missing_event', __METHOD__, App::LOG_WARNING, $info['reminder_id'] );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -1323,21 +1346,21 @@ class _Calendar extends Core
|
||||
{
|
||||
$info['reminder_member_id'] = $this->software->app->getLink( $info['reminder_member_id'], 'core_members', TRUE );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
catch( OutOfRangeException $e )
|
||||
{
|
||||
$this->software->app->log( 'calendar_reminder_missing_member', __METHOD__, \IPS\convert\App::LOG_WARNING, $info['reminder_id'] );
|
||||
$this->software->app->log( 'calendar_reminder_missing_member', __METHOD__, App::LOG_WARNING, $info['reminder_id'] );
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->software->app->log( 'calendar_reminder_missing_member', __METHOD__, \IPS\convert\App::LOG_WARNING, $info['reminder_id'] );
|
||||
$this->software->app->log( 'calendar_reminder_missing_member', __METHOD__, App::LOG_WARNING, $info['reminder_id'] );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ( isset( $info['reminder_date'] ) )
|
||||
{
|
||||
if ( $info['reminder_date'] instanceof \IPS\DateTime )
|
||||
if ( $info['reminder_date'] instanceof DateTime )
|
||||
{
|
||||
$info['reminder_date'] = $info['reminder_date']->getTimestamp();
|
||||
}
|
||||
@@ -1350,7 +1373,7 @@ class _Calendar extends Core
|
||||
$id = $info['reminder_id'];
|
||||
unset( $info['reminder_id'] );
|
||||
|
||||
$inserted_id = \IPS\Db::i()->insert( 'calendar_event_reminders', $info );
|
||||
$inserted_id = Db::i()->insert( 'calendar_event_reminders', $info );
|
||||
$this->software->app->addLink( $inserted_id, $id, 'calendar_event_reminders' );
|
||||
|
||||
return $inserted_id;
|
||||
@@ -1382,8 +1405,8 @@ class _Calendar extends Core
|
||||
{
|
||||
$map['id3_skip_link'] = TRUE;
|
||||
}
|
||||
|
||||
if ( \is_null( $map['id3'] ) OR $map['id3'] != 'review' )
|
||||
|
||||
if ( is_null( $map['id3'] ) OR $map['id3'] != 'review' )
|
||||
{
|
||||
$map['id2_type'] = 'calendar_event_comments';
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user