Version 3.4.9

This commit is contained in:
Neo committed 2025-12-19 00:44:43 -08:00
1 parent c603205a25
commit f9e857d255
920 files changed
+28189 -6840

No files matched your search

@@ -0,0 +1,10 @@
<html>
<head><title>IP.Board - Bulletin Board System</title></head>
<body>
<h1>403: IP.Board -&gt; Forbidden</h1>
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
</html>
@@ -0,0 +1,474 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.4.5
* IP.Board calendar attachments plugin
* Last Updated: $Date: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
* </pre>
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Calendar
* @link http://www.invisionpower.com
* @since 6/24/2008
* @version $Revision: 10721 $
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class plugin_event extends class_attach
{
/**
* Module type
*
* @access public
* @var string
*/
public $module = 'event';
/**
* Checks the attachment and checks for download / show perms
*
* @access public
* @param integer Attachment id
* @return mixed Attachment data, or false if no permission
*/
public function getAttachmentData( $attach_id )
{
//-----------------------------------------
// INIT
//-----------------------------------------
$_ok = 0;
//-----------------------------------------
// Grab 'em
//-----------------------------------------
$attach = $this->DB->buildAndFetch( array( 'select' => 'a.*',
'from' => array( 'attachments' => 'a' ),
'where' => "a.attach_rel_module='" . $this->module . "' AND a.attach_id=" . $attach_id,
'add_join' => array( 0 => array( 'select' => 'e.*',
'from' => array( 'cal_events' => 'e' ),
'where' => "e.event_id=a.attach_rel_id",
'type' => 'left' ),
1 => array( 'select' => 'c.*',
'from' => array( 'cal_calendars' => 'c' ),
'where' => "c.cal_id=e.event_calendar_id",
'type' => 'left' ),
)
) );
//-----------------------------------------
// Check..
//-----------------------------------------
if ( empty( $attach['event_id'] ) )
{
if( !$this->memberData['g_is_supmod'] AND $attach['attach_member_id'] != $this->memberData['member_id'] )
{
return FALSE;
}
}
//-----------------------------------------
// For previews
//-----------------------------------------
if ( $attach['attach_rel_id'] == 0 AND $attach['attach_member_id'] == $this->memberData['member_id'] )
{
return $attach;
}
else if( $attach['event_id'] )
{
return $attach;
}
return FALSE;
}
/**
* Check the attachment and make sure its OK to display
*
* @access public
* @param array Array of ids
* @param array Array of relationship ids
* @param string Post key
* @return array Attachment data
*/
public function renderAttachment( $attach_ids, $rel_ids=array(), $attach_post_key=0 )
{
//-----------------------------------------
// INIT
//-----------------------------------------
$rows = array();
$query_bits = array();
$query = '';
$match = 0;
//-----------------------------------------
// Check
//-----------------------------------------
if ( is_array( $attach_ids ) AND count( $attach_ids ) )
{
$query_bits[] = "attach_id IN (" . implode( ",", $attach_ids ) .")";
}
if ( is_array( $rel_ids ) and count( $rel_ids ) )
{
$rel_ids = array_map( 'intval', $rel_ids );
// We need to reset the array - this query bit will return everything we need, but
// if we "OR" join the above query bit with this one, it causes bigger mysql loads
$query_bits = array();
$query_bits[] = "attach_rel_id IN (" . implode( ",", $rel_ids ) . ")";
$match = 1;
}
if ( $attach_post_key )
{
$query_bits[] = "attach_post_key='" . $this->DB->addSlashes( $attach_post_key ) . "'";
$match = 2;
}
//-----------------------------------------
// Grab 'em
//-----------------------------------------
if( count($query_bits) )
{
$this->DB->build( array( 'select' => '*', 'from' => 'attachments', 'where' => "attach_rel_module='{$this->module}' AND ( " . implode( ' OR ', $query_bits ) . " )" ) );
$attach_sql = $this->DB->execute();
//-----------------------------------------
// Loop through and filter off naughty ids
//-----------------------------------------
while( $row = $this->DB->fetch( $attach_sql ) )
{
$_ok = 1;
if ( $match == 1 )
{
if ( ! in_array( $row['attach_rel_id'], $rel_ids ) )
{
$_ok = 0;
}
}
else if ( $match == 2 )
{
if ( $row['attach_post_key'] != $attach_post_key )
{
$_ok = 0;
}
}
//-----------------------------------------
// Ok?
//-----------------------------------------
if ( $_ok )
{
$rows[ $row['attach_id'] ] = $row;
}
}
}
//-----------------------------------------
// Return
//-----------------------------------------
return $rows;
}
/**
* Recounts number of attachments for the event
*
* @access public
* @param string Post key
* @param integer Related ID
* @param array Arguments for query
* @return array Returns count of items found
*/
public function postUploadProcess( $post_key, $rel_id, $args=array() )
{
//-----------------------------------------
// Check..
//-----------------------------------------
if ( ! $post_key )
{
return array( 'count' => 0 );
}
$cnt = $this->DB->buildAndFetch( array( "select" => 'COUNT(*) as cnt',
'from' => 'attachments',
'where' => "attach_post_key='{$post_key}'" ) );
$this->DB->update( 'cal_events', array( 'event_attachments' => $cnt['cnt'] ), 'event_id=' . intval( $rel_id ) );
return array( 'count' => $cnt['cnt'] );
}
/**
* Recounts number of attachments for the articles row
*
* @access public
* @param array Attachment data
* @return boolean
*/
public function attachmentRemovalCleanup( $attachment )
{
//-----------------------------------------
// Check
//-----------------------------------------
if ( ! $attachment['attach_id'] )
{
return FALSE;
}
//-----------------------------------------
// Update count
//-----------------------------------------
$this->DB->update( 'cal_events', 'event_attachments=event_attachments-1', 'event_id=' . intval( $attachment['attach_rel_id'] ), false, true );
return TRUE;
}
/**
* Determines if you have permission for bulk attachment removal
* Returns TRUE or FALSE
*
* @access public
* @param array Ids to check against
* @return boolean
*/
public function canBulkRemove( $attach_rel_ids=array() )
{
return $this->memberData['g_is_supmod'] ? true : false;
}
/**
* Determines if you can remove this attachment
* Returns TRUE or FALSE
* IT really does
*
* @access public
* @param array Attachment data
* @return boolean
*/
public function canRemove( $attachment )
{
//-----------------------------------------
// INIT
//-----------------------------------------
$ok_to_remove = FALSE;
//-----------------------------------------
// Check
//-----------------------------------------
if ( ! $attachment['attach_id'] )
{
return FALSE;
}
//-----------------------------------------
// Allowed to remove?
//-----------------------------------------
if ( $this->memberData['member_id'] == $attachment['attach_member_id'] )
{
$ok_to_remove = TRUE;
}
else if ( $this->memberData['g_is_supmod'] )
{
$ok_to_remove = TRUE;
}
else
{
$event = $this->DB->buildAndFetch( array( 'select' => '*',
'from' => 'cal_events',
'where' => 'event_id=' . intval( $attachment['attach_rel_id'] ) ) );
if ( $this->memberData['member_id'] == $event['event_member_id'] )
{
$ok_to_remove = TRUE;
}
}
return $ok_to_remove;
}
/**
* Returns an array of the allowed upload sizes in bytes.
* Return 'space_allowed' as -1 to not allow uploads.
* Return 'space_allowed' as 0 to allow unlimited uploads
* Return 'max_single_upload' as 0 to not set a limit
*
* @access public
* @param string MD5 post key
* @param id Member ID
* @return array [ 'space_used', 'space_left', 'space_allowed', 'max_single_upload' ]
*/
public function getSpaceAllowance( $post_key='', $member_id='' )
{
$max_php_size = IPSLib::getMaxPostSize();
$member_id = intval( $member_id ? $member_id : $this->memberData['member_id'] );
$space_left = 0;
$space_used = 0;
$space_allowed = 0;
$max_single_upload = 0;
$total_space_allowed = 0;
//-----------------------------------------
// Allowed to attach?
//-----------------------------------------
if ( ! $member_id )
{
$space_allowed = -1;
}
else
{
//-----------------------------------------
// Generate total space allowed
//-----------------------------------------
$total_space_allowed = ( $this->memberData['g_attach_per_post'] ? $this->memberData['g_attach_per_post'] : $this->memberData['g_attach_max'] ) * 1024;
//-----------------------------------------
// Generate space used figure
//-----------------------------------------
if ( $this->memberData['g_attach_per_post'] )
{
//-----------------------------------------
// Per post limit...
//-----------------------------------------
$_space_used = $this->DB->buildAndFetch( array( 'select' => 'SUM(attach_filesize) as figure', 'from' => 'attachments', 'where' => "attach_post_key='" . $post_key . "'" ) );
$space_used = $_space_used['figure'] ? $_space_used['figure'] : 0;
}
else
{
//-----------------------------------------
// Global limit...
//-----------------------------------------
$_space_used = $this->DB->buildAndFetch( array( 'select' => 'SUM(attach_filesize) as figure', 'from' => 'attachments', 'where' => 'attach_member_id=' . $member_id . " AND attach_rel_module IN( 'post', 'msg', 'event' )" ) );
$space_used = $_space_used['figure'] ? $_space_used['figure'] : 0;
}
//-----------------------------------------
// Generate space allowed figure
//-----------------------------------------
if ( $this->memberData['g_attach_max'] > 0 )
{
if ( $this->memberData['g_attach_per_post'] )
{
$_g_space_used = $this->DB->buildAndFetch( array( 'select' => 'SUM(attach_filesize) as figure', 'from' => 'attachments', 'where' => 'attach_member_id=' . $member_id . " AND attach_rel_module IN( 'post', 'msg', 'event' )" ) );
$g_space_used = $_g_space_used['figure'] ? $_g_space_used['figure'] : 0;
if( ( $this->memberData['g_attach_max'] * 1024 ) - $g_space_used < 0 )
{
$space_used = $g_space_used;
$total_space_allowed = $this->memberData['g_attach_max'] * 1024;
$space_allowed = ( $this->memberData['g_attach_max'] * 1024 ) - $space_used;
$space_allowed = $space_allowed < 0 ? -1 : $space_allowed;
}
else
{
$space_allowed = ( $this->memberData['g_attach_per_post'] * 1024 ) - $space_used;
$space_allowed = $space_allowed < 0 ? -1 : $space_allowed;
}
}
else
{
$space_allowed = ( $this->memberData['g_attach_max'] * 1024 ) - $space_used;
$space_allowed = $space_allowed < 0 ? -1 : $space_allowed;
}
}
else
{
if ( $this->memberData['g_attach_per_post'] )
{
$space_allowed = ( $this->memberData['g_attach_per_post'] * 1024 ) - $space_used;
$space_allowed = $space_allowed < 0 ? -1 : $space_allowed;
}
else
{
$space_allowed = 0;
}
}
//-----------------------------------------
// Generate space left figure
//-----------------------------------------
$space_left = $space_allowed ? $space_allowed : 0;
$space_left = ( $space_left < 0 ) ? -1 : $space_left;
//-----------------------------------------
// Generate max upload size
//-----------------------------------------
if ( ! $max_single_upload )
{
if ( $space_left > 0 AND $space_left < $max_php_size )
{
$max_single_upload = $space_left;
}
else if ( $max_php_size )
{
$max_single_upload = $max_php_size;
}
}
}
IPSDebug::fireBug( 'info', array( 'Space left: ' . $space_left ) );
IPSDebug::fireBug( 'info', array( 'Max PHP size: ' . $max_php_size ) );
IPSDebug::fireBug( 'info', array( 'Max single file size: ' . $max_single_upload ) );
$return = array( 'space_used' => $space_used, 'space_left' => $space_left, 'space_allowed' => $space_allowed, 'max_single_upload' => $max_single_upload, 'total_space_allowed' => $total_space_allowed );
return $return;
}
/**
* Returns an array of settings:
* 'siu_thumb' = Allow thumbnail creation?
* 'siu_height' = Height of the generated thumbnail in pixels
* 'siu_width' = Width of the generated thumbnail in pixels
* 'upload_dir' = Base upload directory (must be a full path)
*
* You can omit any of these settings and IPB will use the default
* settings (which are the ones entered into the ACP for post thumbnails)
*
* @access public
* @return boolean
*/
public function getSettings()
{
$this->mysettings = array();
return true;
}
}
@@ -0,0 +1,365 @@
<?php
/**
* Calendar comments class
*
* @author $author$
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Downloads
* @link http://www.invisionpower.com
* @version $Rev: 11541 $
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class comments_calendar_events extends classes_comments_renderer
{
/**
* Internal remap array
*
* @param array
*/
protected $_remap = array( 'comment_id' => 'comment_id',
'comment_author_id' => 'comment_mid',
'comment_author_name' => 'comment_author',
'comment_text' => 'comment_text',
'comment_ip_address' => 'ip_address',
'comment_edit_date' => 'comment_edit_time',
'comment_date' => 'comment_date',
'comment_approved' => 'comment_approved',
'comment_parent_id' => 'comment_eid' );
/**
* Internal parent remap array
*
* @param array
*/
protected $_parentRemap = array( 'parent_id' => 'event_id',
'parent_owner_id' => 'event_member_id',
'parent_parent_id' => 'event_calendar_id',
'parent_title' => 'event_title',
'parent_seo_title' => 'event_title_seo',
'parent_date' => 'event_saved' );
/**
* Parent SEO template
*
* @return string
*/
public function seoTemplate()
{
return 'cal_event';
}
/**
* Who am I?
*
* @return string
*/
public function whoAmI()
{
return 'calendar-events';
}
/**
* Comment table
*
* @return string
*/
public function table()
{
return 'cal_event_comments';
}
/**
* Fetch parent
*
* @return array
*/
public function fetchParent( $id )
{
static $cachedEvents = array();
if( !isset($cachedEvents[ $id ]) )
{
$_event = $this->DB->buildAndFetch( array(
'select' => 'e.*',
'from' => array( 'cal_events' => 'e' ),
'where' => 'e.event_id=' . intval($id),
'add_join' => array(
array(
'select' => 'c.*',
'from' => array( 'cal_calendars' => 'c' ),
'where' => 'c.cal_id=e.event_calendar_id',
'type' => 'left',
),
array(
'select' => 'p.*',
'from' => array( 'permission_index' => 'p' ),
'where' => "p.perm_type='calendar' AND p.perm_type_id=c.cal_id",
'type' => 'left',
),
),
) );
$cachedEvents[ $id ] = $_event;
}
return $cachedEvents[ $id ];
}
/**
* Fetch settings
*
* @return array
*/
public function settings()
{
return array( 'urls-showParent' => "app=calendar&module=calendar&section=view&do=showevent&event_id=%s",
'urls-report' => $this->getReportLibrary()->canReport( 'calendar' ) ? "app=core&amp;module=reports&amp;rcom=calendar&amp;comment_id=%s&amp;event_id=%s" : '' );
}
/**
* Number of items per page
*
* @return int
*/
public function perPage()
{
return 25;
}
/**
* Pre save
* Accepts an array of GENERIC data and allows manipulation before it's added to DB
*
* @param string Type of save (edit/add)
* @param array Array of GENERIC data (comment_xxxx)
* @param int Comment id (if available)
* @param int Parent id
* @return array Array of GENERIC data
*/
public function preSave( $type, array $array, $commentId=0, $parentId=0 )
{
if ( $type == 'add' )
{
$event = $this->fetchParent( $array['comment_parent_id'] );
/* Test approval */
if ( $array['comment_approved'] )
{
$array['comment_approved'] = $this->memberData['g_is_supmod'] ? 1 : ( $event['cal_comment_moderate'] ? 0 : 1 );
}
/* Data Hook Location */
IPSLib::doDataHooks( $array, 'calendarAddComment' );
}
else
{
/* Data Hook Location */
IPSLib::doDataHooks( $array, 'calendarEditComment' );
}
return $array;
}
/**
* Post save
* Accepts an array of GENERIC data and allows manipulation after it's added to DB
*
* @param string Type of action (edit/add)
* @param array Array of GENERIC data (comment_xxxx)
* @param int Comment id (if available)
* @param int Parent id
* @return array Array of GENERIC data
*/
public function postSave( $type, array $array, $commentId=0, $parentId=0 )
{
$this->_rebuildCommentCount( $parentId );
IPSLib::doDataHooks( $array, 'calendarComment' . ucfirst( $type ) . 'PostSave' );
return $array;
}
/**
* Post delete. Can do stuff and that
*
* @param array Array of comment IDs to be deleted
* @param int Parent ID
* @return void
*/
public function postDelete( $commentIds, $parentId )
{
$this->_rebuildCommentCount( $parentId );
$_dataHook = array( 'commentIds' => $commentIds,
'parentId' => $parentId );
/* Data Hook Location */
IPSLib::doDataHooks( $_dataHook, 'calendarCommentPostDelete' );
}
/**
* Toggles visibility
*
* @param string on/off
* @param array Array of comment IDs to be deleted
* @param int Parent ID
* @return void
*/
public function postVisibility( $toggle, $commentIds, $parentId )
{
$this->_rebuildCommentCount( $parentId );
$_dataHook = array( 'toggle' => $toggle,
'commentIds' => $commentIds,
'parentId' => $parentId );
/* Data Hook Location */
IPSLib::doDataHooks( $_dataHook, 'calendarCommentToggleVisibility' );
}
/**
* Rebuild comment counts for an event
*
* @param int Event ID
* @return @e void
*/
protected function _rebuildCommentCount( $parentId )
{
$approved = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) as total', 'from' => 'cal_event_comments', 'where' => 'comment_approved=1 AND comment_eid=' . $parentId ) );
$unapproved = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) as total', 'from' => 'cal_event_comments', 'where' => 'comment_approved=0 AND comment_eid=' . $parentId ) );
$this->DB->update( 'cal_events', array( 'event_comments' => $approved['total'], 'event_comments_pending' => $unapproved['total'] ), 'event_id=' . $parentId );
}
/**
* Fetch a total count of comments we can see
*
* @param mixed parent Id or parent array
* @return int
*/
public function count( $parent )
{
/* Get parent */
if ( is_numeric( $parent ) )
{
$parent = $this->fetchParent( $parent );
}
if( $this->memberData['g_is_supmod'] )
{
return ( intval($parent['event_comments']) + intval($parent['event_comments_pending']) );
}
return intval($parent['event_comments']);
}
/**
* Perform a permission check
*
* @param string Type of check (add/edit/delete/editall/deleteall/approve all)
* @param array Array of GENERIC data
* @return true or string to be used in exception
*/
public function can( $type, array $array )
{
/* Init */
$comment = array();
/* Got data? */
if ( empty( $array['comment_parent_id'] ) )
{
trigger_error( "No parent ID passed to " . __FILE__, E_USER_WARNING );
}
/* Get the file */
$event = $this->fetchParent( $array['comment_parent_id'] );
/* Fetch comment */
if ( $array['comment_id'] )
{
$comment = $this->fetchById( $array['comment_id'] );
}
/* Check permissions */
switch( $type )
{
case 'view':
if( !$this->registry->permissions->check( 'view', $event ) )
{
return 'NO_PERMISSION';
}
if( $event['event_private'] AND ( !$this->memberData['member_id'] OR $this->memberData['member_id'] != $event['event_member_id'] ) )
{
return 'NO_PERMISSION';
}
if( $event['event_perms'] != '*' )
{
$permissionGroups = explode( ',', IPSText::cleanPermString( $event['event_perms'] ) );
if( !IPSMember::isInGroup( $this->memberData, $permissionGroups ) )
{
return 'NO_PERMISSION';
}
}
return true;
break;
case 'edit':
if( !$this->registry->permissions->check( 'comment', $event ) )
{
return 'NO_PERMISSION';
}
if( !$this->memberData['g_is_supmod'] AND ( $this->memberData['member_id'] != $comment['comment_author_id'] OR !$comment['comment_author_id'] ) )
{
return 'NO_PERMISSION';
}
return true;
break;
case 'add':
if( !$this->registry->permissions->check( 'comment', $event ) )
{
return 'NO_PERMISSION';
}
return true;
break;
case 'delete':
return $this->memberData['g_is_supmod'] ? true : 'NO_PERMISSION';
break;
case 'visibility':
case 'moderate':
return $this->memberData['g_is_supmod'] ? true : 'NO_PERMISSION';
break;
case 'hide':
return IPSMember::canModerateContent( $this->memberData, IPSMember::CONTENT_HIDE, $comment['comment_author_id'] ) ? TRUE : 'NO_PERMISSION';
break;
case 'unhide':
return IPSMember::canModerateContent( $this->memberData, IPSMember::CONTENT_UNHIDE, $comment['comment_author_id'] ) ? TRUE : 'NO_PERMISSION';
break;
}
}
/**
* Returns remap keys (generic => local)
*
* @return array
*/
public function remapKeys( $type='comment' )
{
return ( $type == 'comment' ) ? $this->_remap : $this->_parentRemap;
}
}
@@ -0,0 +1,10 @@
<html>
<head><title>IP.Board - Bulletin Board System</title></head>
<body>
<h1>403: IP.Board -&gt; Forbidden</h1>
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
</html>
@@ -0,0 +1,692 @@
<?php
/**
* Calendar feed blocks
*
* @author $author$
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Content
* @link http://www.invisionpower.com
* @version $Rev: 10065 $
* @since 1st March 2009
*/
class feed_calendar implements feedBlockInterface
{
/**#@+
* Registry Object Shortcuts
*
* @access protected
* @var object
*/
protected $DB;
protected $settings;
protected $lang;
protected $member;
protected $memberData;
protected $cache;
protected $registry;
protected $caches;
protected $request;
/**#@-*/
/**
* Constructor
*
* @access public
* @param object Registry reference
* @return @e void
*/
public function __construct( ipsRegistry $registry )
{
//-----------------------------------------
// Make shortcuts
//-----------------------------------------
$this->registry = $registry;
$this->DB = $registry->DB();
$this->settings = $registry->fetchSettings();
$this->member = $registry->member();
$this->memberData =& $this->registry->member()->fetchMemberData();
$this->cache = $registry->cache();
$this->caches =& $registry->cache()->fetchCaches();
$this->request = $registry->fetchRequest();
$this->lang = $registry->class_localization;
}
/**
* Return the tag help for this block type
*
* @access public
* @param string Additional info (database id;type)
* @return array
*/
public function getTags( $info='' )
{
//-----------------------------------------
// Calendar columns
//-----------------------------------------
$_finalColumns = array(
'url' => array( "&#36;r['url']", $this->lang->words['block_feed__calurl'] ),
'date' => array( "&#36;r['date']", $this->lang->words['block_feed__caldate'] ),
'title' => array( "&#36;r['title']", $this->lang->words['block_feed__caltitle'] ),
'content' => array( "&#36;r['content']", $this->lang->words['block_feed__calcontent'] ),
);
$_noinfoColumns = array();
foreach( $this->DB->getFieldNames( 'cal_events' ) as $_column )
{
if( $this->lang->words['col__cal_events_' . $_column ] )
{
$_finalColumns[ $_column ] = array( "&#36;r['" . $_column . "']", $this->lang->words['col__cal_events_' . $_column ] );
}
else
{
$_noinfoColumns[ $_column ] = array( "&#36;r['" . $_column . "']", $this->lang->words['notaghelpinfoavailable'], true );
}
}
foreach( $this->DB->getFieldNames( 'cal_calendars' ) as $_column )
{
if( $this->lang->words['col__cal_calendars_' . $_column ] )
{
unset($_finalColumns[ $_column ]);
$_finalColumns[ $_column ] = array( "&#36;r['" . $_column . "']", $this->lang->words['col__cal_calendars_' . $_column ] );
}
else
{
$_noinfoColumns[ $_column ] = array( "&#36;r['" . $_column . "']", $this->lang->words['notaghelpinfoavailable'], true );
}
}
return array(
$this->lang->words['block_feed__generic'] => array(
array( '&#36;title', $this->lang->words['block_feed__title'] ) ,
),
$this->lang->words['block_feed_calendar'] => array(
array( '&#36;records', $this->lang->words['block_feed__cal'], IPSLib::mergeArrays( $_finalColumns, $_noinfoColumns ) ),
),
);
}
/**
* Provides the ability to modify the feed type or content type values
* before they are passed into the gallery template search query
*
* @access public
* @param string Current feed type
* @param string Current content type
* @return array Array with two keys: feed_type and content_type
*/
public function returnTemplateGalleryKeys( $feed_type, $content_type )
{
return array( 'feed_type' => $feed_type, 'content_type' => $content_type );
}
/**
* Return the plugin meta data
*
* @access public
* @return array Plugin data (key (folder name), associated app, name, description, hasFilters, templateBit)
*/
public function returnFeedInfo()
{
return array(
'key' => 'calendar',
'app' => 'calendar',
'name' => $this->lang->words['feed_name__calendar'],
'description' => $this->lang->words['feed_description__calendar'],
'hasFilters' => true,
'templateBit' => 'feed__generic',
'inactiveSteps' => array( ),
);
}
/**
* Get the feed's available content types. Returns form elements and data
*
* @param array Session data
* @param array true: Return an HTML radio list; false: return an array of types
* @return array Form data
*/
public function returnContentTypes( $session = array(), $asHTML = true )
{
$_types = array(
array( 'events', $this->lang->words['ct_events'] ),
);
$_html = array();
if( !$asHTML )
{
return $_types;
}
foreach( $_types as $_type )
{
$_html[] = "<input type='radio' name='content_type' id='content_type_{$_type[0]}' value='{$_type[0]}'" . ( $session['config_data']['content_type'] == $_type[0] ? " checked='checked'" : '' ) . " /> <label for='content_type_{$_type[0]}'>{$_type[1]}</label>";
}
return array(
array(
'label' => $this->lang->words['generic__select_contenttype'],
'description' => '',
'field' => '<ul style="line-height: 1.6"><li>' . implode( '</li><li>', $_html ) . '</ul>',
)
);
}
/**
* Check the feed content type selection
*
* @access public
* @param array Submitted data to check (usually $this->request)
* @return array Array( (bool) Ok or not, (array) Content type data to use )
*/
public function checkFeedContentTypes( $data )
{
if( !in_array( $data['content_type'], array( 'events' ) ) )
{
$data['content_type'] = 'events';
}
return array( true, $data['content_type'] );
}
/**
* Get the feed's available filter options. Returns form elements and data
*
* @access public
* @param array Session data
* @return array Form data
*/
public function returnFilters( $session )
{
$filters = array();
$calendars = array();
foreach( $this->cache->getCache('calendars') as $calendar )
{
$calendars[] = array( $calendar['cal_id'], $calendar['cal_title'] );
}
$filters[] = array(
'label' => $this->lang->words['feed_calendar__calendars'],
'description' => $this->lang->words['feed_calendar__calendars_desc'],
'field' => $this->registry->output->formMultiDropdown( 'filter_calendars[]', $calendars, explode( ',', $session['config_data']['filters']['filter_calendars'] ), 8 ),
);
$session['config_data']['filters']['filter_start'] = $session['config_data']['filters']['filter_start'] ? $session['config_data']['filters']['filter_start'] : 0;
$session['config_data']['filters']['filter_end'] = $session['config_data']['filters']['filter_end'] ? $session['config_data']['filters']['filter_end'] : 0;
$filters[] = array(
'label' => $this->lang->words['feed_calendar__start'],
'description' => $this->lang->words['feed_calendar__start_desc'],
'field' => $this->registry->output->formInput( 'filter_start', $session['config_data']['filters']['filter_start'] ),
);
$filters[] = array(
'label' => $this->lang->words['feed_calendar__end'],
'description' => $this->lang->words['feed_calendar__end_desc'],
'field' => $this->registry->output->formInput( 'filter_end', $session['config_data']['filters']['filter_end'] ),
);
return $filters;
}
/**
* Check the feed filters selection
*
* @access public
* @param array Session data
* @param array Submitted data to check (usually $this->request)
* @return array Array( (bool) Ok or not, (array) Content type data to use )
*/
public function checkFeedFilters( $session, $data )
{
$filters = array();
$return = true;
$filters['filter_calendars'] = is_array($data['filter_calendars']) ? implode( ',', $data['filter_calendars'] ) : '';
$filters['filter_start'] = $data['filter_start'];
$filters['filter_end'] = $data['filter_end'];
//-----------------------------------------
// Verify we can create a timestamp out of the dates
//-----------------------------------------
if( ( $filters['filter_start'] AND !@strtotime($filters['filter_start']) ) OR ($filters['filter_end'] AND !@strtotime($filters['filter_end']) ) )
{
$return = false;
}
return array( $return, $filters );
}
/**
* Get the feed's available ordering options. Returns form elements and data
*
* @access public
* @param array Session data
* @return array Form data
*/
public function returnOrdering( $session )
{
$session['config_data']['sortorder'] = $session['config_data']['sortorder'] ? $session['config_data']['sortorder'] : 'desc';
$session['config_data']['offset_start'] = $session['config_data']['offset_start'] ? $session['config_data']['offset_start'] : 0;
$session['config_data']['offset_end'] = $session['config_data']['offset_end'] ? $session['config_data']['offset_end'] : 10;
$session['config_data']['sortby'] = $session['config_data']['sortby'] ? $session['config_data']['sortby'] : 'start';
$filters = array();
$sortby = array(
array( 'title', $this->lang->words['sort_calendar__title'] ),
array( 'start', $this->lang->words['sort_calendar__start'] ),
array( 'end', $this->lang->words['sort_calendar__end'] ),
array( 'rand', $this->lang->words['sort_generic__rand'] )
);
$filters[] = array(
'label' => $this->lang->words['feed_sort_by'],
'description' => $this->lang->words['feed_sort_by_desc'],
'field' => $this->registry->output->formDropdown( 'sortby', $sortby, $session['config_data']['sortby'] ),
);
$filters[] = array(
'label' => $this->lang->words['feed_order_direction'],
'description' => $this->lang->words['feed_order_direction_desc'],
'field' => $this->registry->output->formDropdown( 'sortorder', array( array( 'desc', 'DESC' ), array( 'asc', 'ASC' ) ), $session['config_data']['sortorder'] ),
);
$filters[] = array(
'label' => $this->lang->words['feed_limit_offset_start'],
'description' => $this->lang->words['feed_limit_offset_start_desc'],
'field' => $this->registry->output->formInput( 'offset_start', $session['config_data']['offset_start'] ),
);
$filters[] = array(
'label' => $this->lang->words['feed_limit_offset_end'],
'description' => $this->lang->words['feed_limit_offset_end_desc'],
'field' => $this->registry->output->formInput( 'offset_end', $session['config_data']['offset_end'] ),
);
return $filters;
}
/**
* Check the feed ordering options
*
* @access public
* @param array Submitted data to check (usually $this->request)
* @return array Array( (bool) Ok or not, (array) Ordering data to use )
*/
public function checkFeedOrdering( $data, $session )
{
$limits = array();
$sortby = array( 'title', 'start', 'end', 'rand' );
$limits['sortby'] = in_array( $data['sortby'], $sortby ) ? $data['sortby'] : 'title';
$limits['sortorder'] = in_array( $data['sortorder'], array( 'desc', 'asc' ) ) ? $data['sortorder'] : 'desc';
$limits['offset_start'] = intval($data['offset_start']);
$limits['offset_end'] = intval($data['offset_end']);
return array( true, $limits );
}
/**
* Execute the feed and return the HTML to show on the page.
* Can be called from ACP or front end, so the plugin needs to setup any appropriate lang files, skin files, etc.
*
* @access public
* @param array Block data
* @param bool Preview mode
* @return string Block HTML to display or cache
* @link http://community.invisionpower.com/tracker/issue-37000-calendar-feed-block-start-date-today
*/
public function executeFeed( $block, $previewMode=false )
{
$this->lang->loadLanguageFile( array( 'public_lang' ), 'ccs' );
$config = unserialize( $block['block_config'] );
$where = array();
//-----------------------------------------
// Set up filtering clauses
//-----------------------------------------
$where = array(); // array( 'e.event_approved=1', 'e.event_private=0', "e.event_perms='*'" );
if( !$this->memberData['g_is_supmod'] )
{
$where[] = 'e.event_approved=1';
}
else
{
$where[] = 'e.event_approved IN (0,1)';
}
$where[] = "((e.event_private=1 AND e.event_member_id=" . $this->memberData['member_id'] . ") OR (e.event_private=0 AND " . $this->DB->buildRegexp( "e.event_perms", $this->member->perm_id_array ) . "))";
if( $config['filters']['filter_calendars'] )
{
$where[] = "e.event_calendar_id IN(" . $config['filters']['filter_calendars'] . ")";
}
else
{
//-----------------------------------------
// Get calendars
//-----------------------------------------
$this->DB->build( array( 'select' => 'perm_type_id as calendar_id', 'from' => 'permission_index', 'where' => "app='calendar' AND " . $this->DB->buildRegexp( "perm_view", $this->member->perm_id_array ) ) );
$this->DB->execute();
while( $r = $this->DB->fetch() )
{
$_calendars[] = $r['calendar_id'];
}
$where[] = "e.event_calendar_id IN(" . ( count($_calendars) ? implode( ',', $_calendars ) : 0 ) . ")";
}
if( $config['filters']['filter_start'] OR $config['filters']['filter_end'] )
{
$timenow = $config['filters']['filter_start'] ? @strtotime( $config['filters']['filter_start'], @time() + $this->registry->class_localization->getTimeOffset() ) : 0;
$timethen = $config['filters']['filter_end'] ? @strtotime( $config['filters']['filter_end'], @time() + $this->registry->class_localization->getTimeOffset() ) : 0;
if( $timenow )
{
if( $this->memberData['member_id'] AND $this->memberData['time_offset'] )
{
$timenow = $timenow - ( $this->memberData['time_offset'] * 3600 );
}
else if( !$this->memberData['member_id'] AND $this->settings['time_offset'] )
{
$timenow = $timenow - ( $this->settings['time_offset'] * 3600 );
}
}
if( $timethen )
{
if( $this->memberData['member_id'] AND $this->memberData['time_offset'] )
{
$timethen = $timethen - ( $this->memberData['time_offset'] * 3600 );
}
else if( !$this->memberData['member_id'] AND $this->settings['time_offset'] )
{
$timethen = $timethen - ( $this->settings['time_offset'] * 3600 );
}
}
$start_date = $timenow ? gmstrftime( "%Y-%m-%d %H:00:00", $timenow ) : 0;
$end_date = $timethen ? gmstrftime( "%Y-%m-%d %H:00:00", $timethen ) : 0;
if( $start_date AND $end_date )
{
$where[] = "( ( e.event_start_date <= '{$end_date}' AND e.event_end_date >= '{$start_date}' ) OR
( ( e.event_end_date " . $this->DB->buildIsNull(true) . " OR e.event_end_date='0000-00-00 00:00:00' ) AND e.event_start_date >= '{$start_date}' AND e.event_start_date <= '{$end_date}' ) OR
( e.event_recurring=3 AND e.event_end_date <= '{$end_date}' AND e.event_end_date >= '{$start_date}' ) )";
}
else if( $start_date )
{
$where[] = "( e.event_end_date >= '{$start_date}' OR
( ( e.event_end_date " . $this->DB->buildIsNull(true) . " OR e.event_end_date='0000-00-00 00:00:00' ) AND e.event_start_date >= '{$start_date}' ) OR
( e.event_recurring=3 AND e.event_end_date >= '{$start_date}' ) )";
}
else if( $end_date )
{
$where[] = "( e.event_end_date <= '{$end_date}' OR
( ( e.event_end_date " . $this->DB->buildIsNull(true) . " OR e.event_end_date='0000-00-00 00:00:00' ) AND e.event_start_date <= '{$end_date}' ) OR
( e.event_recurring=3 AND e.event_end_date <= '{$end_date}' ) )";
}
}
$order = '';
switch( $config['sortby'] )
{
case 'title':
$order .= "e.event_title ";
break;
default:
case 'start':
$order .= "e.event_start_date ";
break;
case 'end':
$order .= "e.event_end_date ";
break;
case 'rand':
$order .= $this->DB->buildRandomOrder() . ' ';
break;
}
$order .= $config['sortorder'];
$_key = '';
switch( $config['sortby'] )
{
case 'start':
$_key = "start";
break;
case 'end':
$_key = "end";
break;
}
//-----------------------------------------
// Attachment parser
//-----------------------------------------
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'core' ) . '/sources/classes/attach/class_attach.php', 'class_attach' );
$attachments = new $classToLoad( $this->registry );
$attachments->type = 'event';
$attachments->init();
//-----------------------------------------
// Run the query and get the results
//-----------------------------------------
$events = array();
$_eventHit = 0;
$this->DB->build( array(
'select' => 'e.*',
'from' => array( 'cal_events' => 'e' ),
'where' => implode( ' AND ', $where ),
'order' => $order,
'limit' => array( $config['offset_a'], $config['offset_b'] ),
'add_join' => array(
array(
'select' => 'c.*',
'from' => array( 'cal_calendars' => 'c' ),
'where' => 'c.cal_id=e.event_calendar_id',
'type' => 'left',
),
array(
'select' => 'm.member_group_id, m.mgroup_others',
'from' => array( 'members' => 'm' ),
'where' => 'e.event_member_id=m.member_id',
'type' => 'left',
)
)
) );
$outer = $this->DB->execute();
while( $r = $this->DB->fetch($outer) )
{
//-----------------------------------------
// Fix cal dates
//-----------------------------------------
$_startTime = strtotime( $r['event_start_date'] );
$_endTime = ( $r['event_end_date'] AND $r['event_end_date'] != '0000-00-00 00:00:00' ) ? strtotime( $r['event_end_date'] ) : 0;
list( $_year, $_month, $_day ) = explode( '-', preg_replace( "/(.+?)\s.+$/", "$1", $r['event_start_date'] ) );
if( !$r['event_all_day'] )
{
if( $this->memberData['member_id'] AND $this->memberData['time_offset'] )
{
$_startTime = $_startTime + ( $this->memberData['time_offset'] * 3600 );
}
else if( !$this->memberData['member_id'] AND $this->settings['time_offset'] )
{
$_startTime = $_startTime + ( $this->settings['time_offset'] * 3600 );
}
if( $this->memberData['member_id'] AND $this->memberData['time_offset'] )
{
$_endTime = $_endTime ? ( $_endTime + ( $this->memberData['time_offset'] * 3600 ) ) : 0;
}
else if( !$this->memberData['member_id'] AND $this->settings['time_offset'] )
{
$_endTime = $_endTime ? ( $_endTime + ( $this->settings['time_offset'] * 3600 ) ) : 0;
}
}
//-----------------------------------------
// Recurring events
//-----------------------------------------
if( $r['event_recurring'] )
{
$_incrementor = 0;
switch( $r['event_recurring'] )
{
case 1:
$_incrementor = 604800;
break;
case 2:
$_incrementor = 2592000;
break;
case 3:
$_incrementor = 31536000;
break;
}
if( $_startTime < gmmktime( 0 ) )
{
while( $_startTime < gmmktime( 0 ) )
{
$_startTime += $_incrementor;
}
}
}
//-----------------------------------------
// Ranged events
//-----------------------------------------
else if( $_endTime )
{
if( $_startTime < gmmktime( 0 ) AND $_endTime > gmmktime( 0 ) )
{
while( $_startTime < gmmktime( 0 ) )
{
$_startTime += 86400;
}
}
}
//-----------------------------------------
// Normalization
//-----------------------------------------
$r = IPSMember::buildDisplayData( $r );
$r['url'] = $this->registry->output->buildSEOUrl( $this->settings['board_url'] . '/index.php?app=calendar&amp;module=calendar&amp;section=view&amp;do=showevent&amp;event_id=' . $r['event_id'], 'none', $r['event_title_seo'], 'cal_event' );
$r['title'] = $r['event_title'];
$r['date'] = $_startTime;
$r['content'] = $r['event_content'];
IPSText::getTextClass( 'bbcode' )->parse_html = 0;
IPSText::getTextClass( 'bbcode' )->parse_smilies = intval( $r['event_smilies'] );
IPSText::getTextClass( 'bbcode' )->parse_bbcode = 1;
IPSText::getTextClass( 'bbcode' )->parsing_section = 'calendar';
IPSText::getTextClass( 'bbcode' )->parsing_mgroup = $r['member_group_id'];
IPSText::getTextClass( 'bbcode' )->parsing_mgroup_others = $r['mgroup_others'];
$r['content'] = IPSText::getTextClass( 'bbcode' )->preDisplayParse( $r['content'] );
if( $r['event_attachments'] )
{
$attachHTML = $attachments->renderAttachments( array( $r['event_id'] => $r['content'] ), array( $r['event_id'] ), 'topic', false );
if( is_array($attachHTML) )
{
$r['content'] = $attachHTML[ $r['event_id'] ]['html'];
$r['content'] .= $attachHTML[ $r['event_id'] ]['attachmentHtml'];
}
}
if( $_key )
{
$_thisKey = $_key == 'start' ? $_startTime : $_endTime;
$events[ $_thisKey . '.' . $_eventHit ] = $r;
$_eventHit++;
}
else
{
$events[] = $r;
}
}
if( $_key )
{
if( strtolower($config['sortorder']) == 'asc' )
{
ksort($events);
}
else
{
krsort($events);
}
}
//-----------------------------------------
// Return formatted content
//-----------------------------------------
$feedConfig = $this->returnFeedInfo();
// Using a gallery template, or custom?
if( ( $block['block_template'] && $block['tpb_name'] ) || $previewMode == true )
{
$templateBit = $block['tpb_name'];
}
else
{
$templateBit = $feedConfig['templateBit'] . '_' . $block['block_id'];
}
if( $config['hide_empty'] AND !count($events) )
{
return '';
}
$backup = $this->memberData['time_offset'];
$backup1 = $this->memberData['dst_in_use'];
$backup2 = $this->registry->class_localization->offset;
$this->memberData['time_offset'] = 0;
$this->memberData['dst_in_use'] = 0;
$this->registry->class_localization->offset = 0;
ob_start();
$return = $this->registry->output->getTemplate('ccs')->$templateBit( $block['block_name'], $events );
ob_end_clean();
$this->memberData['time_offset'] = $backup;
$this->memberData['dst_in_use'] = $backup1;
$this->registry->class_localization->offset = $backup2;
return $return;
}
}
@@ -0,0 +1,10 @@
<html>
<head><title>IP.Board - Bulletin Board System</title></head>
<body>
<h1>403: IP.Board -&gt; Forbidden</h1>
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
</html>
@@ -0,0 +1,10 @@
<html>
<head><title>IP.Board - Bulletin Board System</title></head>
<body>
<h1>403: IP.Board -&gt; Forbidden</h1>
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
</html>
@@ -0,0 +1,10 @@
<html>
<head><title>IP.Board - Bulletin Board System</title></head>
<body>
<h1>403: IP.Board -&gt; Forbidden</h1>
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
</html>
@@ -0,0 +1,10 @@
<html>
<head><title>IP.Board - Bulletin Board System</title></head>
<body>
<h1>403: IP.Board -&gt; Forbidden</h1>
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
</html>
@@ -0,0 +1,201 @@
<?php
/**
* Show a mini-calendar widget
*
* @author $author$
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Content
* @link http://www.invisionpower.com
* @version $Rev: 9957 $
* @since 1st March 2009
*/
class plugin_mini_calendar implements pluginBlockInterface
{
/**#@+
* Registry Object Shortcuts
*
* @access protected
* @var object
*/
protected $DB;
protected $settings;
protected $lang;
protected $member;
protected $memberData;
protected $cache;
protected $caches;
protected $registry;
protected $request;
/**#@-*/
/**
* Constructor
*
* @access public
* @param object Registry reference
* @return @e void
*/
public function __construct( ipsRegistry $registry )
{
//-----------------------------------------
// Make shortcuts
//-----------------------------------------
$this->registry = $registry;
$this->DB = $registry->DB();
$this->settings = $registry->fetchSettings();
$this->member = $registry->member();
$this->memberData =& $registry->member()->fetchMemberData();
$this->cache = $registry->cache();
$this->caches =& $registry->cache()->fetchCaches();
$this->request = $registry->fetchRequest();
$this->lang = $registry->class_localization;
}
/**
* Return the tag help for this block type
*
* @access public
* @return array
*/
public function getTags()
{
return array(
$this->lang->words['block_plugin__generic'] => array(
array( '&#36;content', $this->lang->words['block_plugin_mc_content'] ) ,
),
);
}
/**
* Return the plugin meta data
*
* @access public
* @return array Plugin data (name, description, hasConfig)
*/
public function returnPluginInfo()
{
return array(
'key' => 'mini_calendar',
'app' => 'calendar',
'name' => $this->lang->words['plugin_name__mini_calendar'],
'description' => $this->lang->words['plugin_description__mini_calendar'],
'hasConfig' => true,
'templateBit' => 'block__mini_calendar',
);
}
/**
* Get plugin configuration data. Returns form elements and data
*
* @access public
* @param array Session data
* @return array Form data
*/
public function returnPluginConfig( $session )
{
$options = array();
foreach( $this->cache->getCache('calendars') as $cal_id => $cal )
{
$options[] = array( $cal['cal_id'], $cal['cal_title'] );
}
return array(
array(
'label' => $this->lang->words['plugin__cal_label1'],
'description' => $this->lang->words['plugin__cal_desc1'],
'field' => $this->registry->output->formDropdown( 'plugin__cal_calendar', $options, $session['config_data']['custom_config']['calendar'] ),
)
);
}
/**
* Check the plugin config data
*
* @access public
* @param array Submitted plugin data to check (usually $this->request)
* @return array Array( (bool) Ok or not, (array) Plugin data to use )
*/
public function validatePluginConfig( $data )
{
$calId = 0;
$default = 0;
foreach( $this->cache->getCache('calendars') as $cal_id => $cal )
{
if( !$default )
{
$default = $cal_id;
}
if( $cal_id == $data['plugin__cal_calendar'] )
{
$calId = $cal_id;
}
}
return array( true, array( 'calendar' => $calId ? $calId : $default ) );
}
/**
* Execute the plugin and return the HTML to show on the page.
* Can be called from ACP or front end, so the plugin needs to setup any appropriate lang files, skin files, etc.
*
* @access public
* @param array Block data
* @return string Block HTML to display or cache
*/
public function executePlugin( $block )
{
if ( !IPSLib::appIsInstalled('calendar') OR !is_file( IPSLib::getAppDir( 'calendar' ) . '/modules_public/calendar/view.php' ) )
{
return '';
}
$config = unserialize($block['block_config']);
ipsRegistry::$request['cal_id'] = $config['custom']['calendar'];
//-----------------------------------------
// Grab calendar class
//-----------------------------------------
$classToLoad = IPSLib::loadActionOverloader( IPSLib::getAppDir( 'calendar' ) . '/modules_public/calendar/view.php', "public_calendar_calendar_view" );
$calendar = new $classToLoad( $this->registry );
$calendar->makeRegistryShortcuts( $this->registry );
if( !$calendar->initCalendar( true, false ) )
{
return '';
}
//-----------------------------------------
// What now?
//-----------------------------------------
$a = explode( ',', gmdate( 'Y,n,j,G,i,s', time() + ipsRegistry::getClass( 'class_localization')->getTimeOffset() ) );
$now_date = array(
'year' => $a[0],
'mon' => $a[1],
'mday' => $a[2],
'hours' => $a[3],
'minutes' => $a[4],
'seconds' => $a[5]
);
$content = $calendar->getMiniCalendar( $now_date['mon'], $now_date['year'] );
$pluginConfig = $this->returnPluginInfo();
$templateBit = $pluginConfig['templateBit'] . '_' . $block['block_id'];
ob_start();
$_return = $this->registry->getClass('output')->getTemplate('ccs')->$templateBit( $content );
ob_end_clean();
return $_return;
}
}
@@ -0,0 +1,384 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.4.5
* Calendar core extensions
* Last Updated: $LastChangedDate: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
* </pre>
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Calendar
* @link http://www.invisionpower.com
* @since 27th January 2004
* @version $Rev: 10721 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
$_PERM_CONFIG = array( 'Calendar' );
class calendarPermMappingCalendar
{
/**
* Mapping of keys to columns
*
* @access protected
* @var array
*/
protected $mapping = array(
'view' => 'perm_view',
'start' => 'perm_2',
'nomod' => 'perm_3',
'rate' => 'perm_4',
'comment' => 'perm_5',
'askrsvp' => 'perm_6',
'rsvp' => 'perm_7',
);
/**
* Mapping of keys to names
*
* @access protected
* @var array
*/
protected $perm_names = array(
'view' => 'Show Calendar',
'start' => 'Create Events',
'nomod' => 'Bypass Moderation',
'rate' => 'Rate Events',
'comment' => 'Comment Events',
'askrsvp' => 'Request RSVP',
'rsvp' => 'RSVP Event',
);
/**
* Mapping of keys to background colors for the form
*
* @access protected
* @var array
*/
protected $perm_colors = array(
'view' => '#fff0f2',
'start' => '#effff6',
'nomod' => '#edfaff',
'rate' => '#f0f1ff',
'comment' => '#fffaee',
'askrsvp' => '#ffeef9',
'rsvp' => '#fff5ec',
);
/**
* Method to pull the key/column mapping
*
* @access public
* @return array
*/
public function getMapping()
{
return $this->mapping;
}
/**
* Method to pull the key/name mapping
*
* @access public
* @return array
*/
public function getPermNames()
{
return $this->perm_names;
}
/**
* Method to pull the key/color mapping
*
* @access public
* @return array
*/
public function getPermColors()
{
return $this->perm_colors;
}
/**
* Retrieve the items that support permission mapping
*
* @access public
* @return array
*/
public function getPermItems()
{
//-----------------------------------------
// Init
//-----------------------------------------
$rows = array();
//-----------------------------------------
// Get calendars and loop
//-----------------------------------------
ipsRegistry::DB()->build( array(
'select' => 'c.*',
'from' => array( 'cal_calendars' => 'c' ),
'add_join' => array(
array(
'select' => 'p.*',
'from' => array( 'permission_index' => 'p' ),
'where' => "p.perm_type='calendar' AND perm_type_id=c.cal_id",
'type' => 'left'
)
)
) );
$outer = ipsRegistry::DB()->execute();
while( $row = ipsRegistry::DB()->fetch( $outer ) )
{
$rows[ $row['cal_id'] ] = array(
'title' => $row['cal_title'],
'perm_view' => $row['perm_view'],
'perm_2' => $row['perm_2'],
'perm_3' => $row['perm_3'],
'perm_4' => $row['perm_4'],
'perm_5' => $row['perm_5'],
'perm_6' => $row['perm_6'],
'perm_7' => $row['perm_7'],
);
}
return $rows;
}
}
/**
* <pre>
* Invision Power Services
* IP.Board v3.4.5
* Library: Handle public session data
* Last Updated: $Date: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
* </pre>
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Calendar
* @link http://www.invisionpower.com
* @since 12th March 2002
* @version $Revision: 10721 $
*
*/
class publicSessions__calendar
{
/**
* Return session variables for this application
*
* current_appcomponent, current_module and current_section are automatically
* stored. This function allows you to add specific variables in.
*
* @access public
* @author Matt Mecham
* @return array
*/
public function getSessionVariables()
{
$array = array( 'location_1_type' => '',
'location_1_id' => 0,
'location_2_type' => '',
'location_2_id' => 0 );
//-----------------------------------------
// Viewing event?
//-----------------------------------------
if ( ipsRegistry::$request['do'] == 'showevent' )
{
$array = array(
'location_1_type' => 'event',
'location_1_id' => intval(ipsRegistry::$request['event_id']),
);
}
else if( ipsRegistry::$request['cal_id'] )
{
$array = array(
'location_1_type' => 'calendar',
'location_1_id' => intval(ipsRegistry::$request['cal_id']),
);
}
return $array;
}
/**
* Parse/format the online list data for the records
*
* @access public
* @author Brandon Farber
* @param array Online list rows to check against
* @return array Online list rows parsed
*/
public function parseOnlineEntries( $rows )
{
if( !is_array($rows) OR !count($rows) )
{
return $rows;
}
ipsRegistry::getClass('class_localization')->loadLanguageFile( array( 'public_calendar' ), 'calendar' );
//-----------------------------------------
// Init
//-----------------------------------------
$cals_raw = array();
$cals = array();
$events_raw = array();
$events = array();
$final = array();
//-----------------------------------------
// Extract the data
//-----------------------------------------
foreach( $rows as $row )
{
if( $row['current_appcomponent'] != 'calendar' OR !$row['current_module'] )
{
continue;
}
if( $row['location_1_type'] == 'event' )
{
$events_raw[ $row['location_1_id'] ] = $row['location_1_id'];
}
else if( $row['location_1_type'] == 'calendar' )
{
$cals_raw[ $row['location_1_id'] ] = $row['location_1_id'];
}
}
//-----------------------------------------
// Get calendars
//-----------------------------------------
$calendars = ipsRegistry::cache()->getCache('calendars');
if( count($cals_raw) )
{
foreach( $calendars as $cid => $calendar )
{
if( isset($cals_raw[ $cid ]) )
{
if( ipsRegistry::getClass('permissions')->check( 'view', $calendar ) )
{
$cals[ $cid ] = $calendar;
}
}
}
}
//-----------------------------------------
// And events
//-----------------------------------------
if( count($events_raw) )
{
ipsRegistry::DB()->build( array( 'select' => 'event_id, event_title, event_title_seo, event_calendar_id, event_approved, event_private, event_perms', 'from' => 'cal_events', 'where' => 'event_id IN(' . implode( ',', $events_raw ) . ')' ) );
$tr = ipsRegistry::DB()->execute();
while( $r = ipsRegistry::DB()->fetch($tr) )
{
if( ipsRegistry::getClass('permissions')->check( 'view', $calendars[ $r['event_calendar_id'] ] ) )
{
if ( $r['event_private'] AND $this->memberData['member_id'] != $r['event_member_id'] )
{
continue;
}
if( !$this->memberData['g_is_supmod'] AND !$r['event_approved'] )
{
continue;
}
if( $r['event_perms'] != '*' )
{
$permissionGroups = explode( ',', IPSText::cleanPermString( $r['event_perms'] ) );
if( !IPSMember::isInGroup( $this->memberData, $permissionGroups ) )
{
continue;
}
}
$events[ $r['event_id'] ] = $r;
}
}
}
//-----------------------------------------
// Extract the topic/forum data
//-----------------------------------------
foreach( $rows as $row )
{
if( $row['current_appcomponent'] == 'calendar' )
{
if( $row['location_1_type'] == 'event' AND isset($events[ $row['location_1_id'] ]) )
{
$row['where_line'] = ipsRegistry::getClass( 'class_localization' )->words['cal_event_ol'];
$row['where_line_more'] = $events[ $row['location_1_id'] ]['event_title'];
$row['where_link'] = "app=calendar&amp;module=calendar&amp;section=view&amp;do=showevent&amp;event_id={$events[ $row['location_1_id'] ]['event_id']}";
$row['_whereLinkSeo'] = ipsRegistry::getClass('output')->buildSEOUrl( $row['where_link'], 'public', $events[ $row['location_1_id'] ]['event_title_seo'], 'cal_event' );
}
else if( $row['location_1_type'] == 'calendar' AND isset($cals[ $row['location_1_id'] ]) )
{
$row['where_line'] = ipsRegistry::getClass( 'class_localization' )->words['cal_calendar_ol'];
$row['where_line_more'] = $cals[ $row['location_1_id'] ]['cal_title'];
$row['where_link'] = "app=calendar&amp;module=calendar&amp;section=view&amp;cal_id={$cals[ $row['location_1_id'] ]['cal_id']}";
$row['_whereLinkSeo'] = ipsRegistry::getClass('output')->buildSEOUrl( $row['where_link'], 'public', $cals[ $row['location_1_id'] ]['cal_title_seo'], 'cal_calendar' );
}
else
{
$row['where_line'] = ipsRegistry::getClass( 'class_localization' )->words['WHERE_calendar'];
$row['where_link'] = 'app=calendar';
$row['_whereLinkSeo'] = ipsRegistry::getClass('output')->buildSEOUrl( 'app=calendar', 'public', 'false', 'app=calendar' );
}
}
$final[ $row['id'] ] = $row;
}
return $final;
}
}
/**
* Find ip address extension
*
*/
class calendar_findIpAddress
{
/**
* Return ip address lookup tables
*
* @access public
* @return array Table lookups
*/
public function getTables()
{
return array(
'cal_event_comments' => array( 'comment_mid', 'ip_address', 'comment_date' ),
'cal_event_ratings' => array( 'rating_member_id', 'rating_ip_address', '' ),
);
}
}
@@ -0,0 +1,72 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.4.5
* Core variables for calendar
* Last Updated: $Date: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
* </pre>
*
* @author $author$
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Calendar
* @link http://www.invisionpower.com
* @version $Rev: 10721 $
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
$_LOAD = array(
'calendars' => 1,
'reputation_levels' => 1,
'ranks' => 1,
'emoticons' => 1,
'bbcode' => 1,
'badwords' => 1,
'moderators' => 1,
'attachtypes' => 1,
'sharelinks' => 1,
);
$CACHE['calendars'] = array(
'array' => 1,
'allow_unload' => 0,
'default_load' => 1,
'recache_file' => IPSLib::getAppDir( 'calendar' ) . '/modules_admin/calendar/calendars.php',
'recache_class' => 'admin_calendar_calendar_calendars',
'recache_function' => 'calendarsRebuildCache'
);
$CACHE['birthdays'] = array(
'array' => 1,
'allow_unload' => 0,
'default_load' => 1,
'recache_file' => IPSLib::getAppDir( 'calendar' ) . '/sources/cache.php',
'recache_class' => 'calendar_cache',
'recache_function' => 'rebuildCalendarEventsCache'
);
$CACHE['calendar_events'] = array(
'array' => 1,
'allow_unload' => 0,
'default_load' => 1,
'recache_file' => IPSLib::getAppDir( 'calendar' ) . '/sources/cache.php',
'recache_class' => 'calendar_cache',
'recache_function' => 'rebuildCalendarEventsCache'
);
$CACHE['rss_calendar'] = array(
'array' => 1,
'allow_unload' => 0,
'default_load' => 1,
'recache_file' => IPSLib::getAppDir( 'calendar' ) . '/sources/cache.php',
'recache_class' => 'calendar_cache',
'recache_function' => 'rebuildCalendarRSSCache',
'skip_rebuild_when_upgrading' => 1,
);
@@ -0,0 +1,30 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.4.5
* Define data hook locations (Calendar)
* Last Updated: $Date: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
* </pre>
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Core
* @link http://www.invisionpower.com
* @version $Rev: 10721 $
*/
$dataHookLocations = array(
/* POSTING DATA LOCATIONS */
array( 'calendarAddEvent', 'Add Calendar Event' ),
array( 'calendarEditEvent', 'Edit Calendar Event' ),
array( 'calendarAddComment', 'Add Event Comment' ),
array( 'calendarEditComment', 'Edit Event Comment' ),
array( 'calendarCommentAddPostSave', 'Add Event Comment (Post Save)' ),
array( 'calendarCommentEditPostSave', 'Edit Event Comment (Post Save)' ),
array( 'calendarCommentPostDelete', 'Comment Deletion' ),
array( 'calendarCommentToggleVisibility', 'Comment Visibility Toggled' ),
);
@@ -0,0 +1,36 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.4.5
* BBCode Management : Determines if bbcode can be used in this section
* Last Updated: $LastChangedDate: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
* </pre>
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Calendar
* @link http://www.invisionpower.com
* @since 27th January 2004
* @version $Rev: 10721 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
/*
* An array of key => value pairs
* When going to parse, the key should be passed to the editor
* to determine which bbcodes should be parsed in the section
*
*/
$BBCODE = array(
'calendar' => ipsRegistry::getClass('class_localization')->words['ctype__calendar'],
);
@@ -0,0 +1,222 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.4.5
* Last Updated: $Date: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
* </pre>
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Downloads
* @link http://www.invisionpower.com
* @version $Rev: 10721 $
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class furlRedirect_calendar
{
/**
* Key type: Type of action
*
* @var string
*/
protected $_type = '';
/**
* Key ID
*
* @var int
*/
protected $_id = 0;
/**
* Calendar ID
*
* @var int
*/
protected $_calId = 0;
/**
* Constructor
*
* @param object registry
* @return @e void
*/
public function __construct( ipsRegistry $registry )
{
$this->registry = $registry;
$this->DB = $registry->DB();
$this->settings =& $registry->fetchSettings();
}
/**
* Set the key ID
* <code>furlRedirect_forums::setKey( 'topic', 12 );</code>
*
* @param string Type
* @param mixed Value
*/
public function setKey( $name, $value )
{
$this->_type = $name;
$this->_id = $value;
}
/**
* Set up the key by URI
*
* @param string URI (example: index.php?showtopic=5&view=getlastpost)
* @return @e void
*/
public function setKeyByUri( $uri )
{
if( IN_ACP )
{
return FALSE;
}
$uri = str_replace( '&amp;', '&', $uri );
if ( strstr( $uri, '?' ) )
{
list( $_chaff, $uri ) = explode( '?', $uri );
}
if( $uri == 'app=calendar' )
{
$this->setKey( 'app', 'calendar' );
return TRUE;
}
else
{
foreach( explode( '&', $uri ) as $bits )
{
list( $k, $v ) = explode( '=', $bits );
if ( $k )
{
if( $k == 'week' )
{
$this->setKey( 'week', $v );
$this->_calId = intval(ipsRegistry::$request['cal_id']);
return TRUE;
}
else if ( $k == 'event_id' )
{
$this->setKey( 'event', intval( $v ) );
return TRUE;
}
}
}
if( $this->request['cal_id'] )
{
$this->setKey( 'cal_id', intval( ipsRegistry::$request['cal_id'] ) );
return true;
}
}
return FALSE;
}
/**
* Return the SEO title
*
* @access public
* @return string The SEO friendly name
*/
public function fetchSeoTitle()
{
switch ( $this->_type )
{
default:
return FALSE;
break;
case 'app':
return $this->_fetchSeoTitle_app();
break;
case 'cal_id':
case 'week':
return $this->_fetchSeoTitle_calendar();
break;
case 'event':
return $this->_fetchSeoTitle_event();
break;
}
}
/**
* Return the base SEO title
*
* @access public
* @return string
*/
public function _fetchSeoTitle_app()
{
if ( ipsRegistry::$request['request_method'] != 'post' )
{
/* Try to figure out what is used in furlTemplates.php */
$_SEOTEMPLATES = array();
@include( IPSLib::getAppDir( 'calendar' ) . '/extensions/furlTemplates.php' );/*noLibHook*/
if( $_SEOTEMPLATES['app=calendar']['out'][1] )
{
return $_SEOTEMPLATES['app=calendar']['out'][1];
}
else
{
return 'calendar/';
}
}
}
/**
* Return the seo title for the calendar
*
* @access public
* @return string
*/
public function _fetchSeoTitle_calendar()
{
if ( ipsRegistry::$request['request_method'] != 'post' )
{
$calendars = ipsRegistry::cache()->getCache('calendars');
$calendar = $calendars[ $this->_calId ? $this->_calId : $this->_id ];
/* Make sure we have a title */
if( $calendar['cal_id'] )
{
return $calendar['cal_title_seo'] ? $calendar['cal_title_seo'] : IPSText::makeSeoTitle( $calendar['cal_title'] );
}
}
}
/**
* Return the seo title for event
*
* @access public
* @return string
*/
public function _fetchSeoTitle_event()
{
if ( ipsRegistry::$request['request_method'] != 'post' )
{
/* Query the event */
$event = $this->DB->buildAndFetch( array( 'select' => 'event_id, event_title, event_title_seo', 'from' => 'cal_events', 'where' => "event_id={$this->_id}" ) );
/* Make sure we have an event */
if( $event['event_id'] )
{
return $event['event_title_seo'] ? $event['event_title_seo'] : IPSText::makeSeoTitle( $event['event_title'] );
}
}
}
}
@@ -0,0 +1,117 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.4.5
* Sets up SEO templates
* Last Updated: $Date: 2013-02-08 20:52:39 -0500 (Fri, 08 Feb 2013) $
* </pre>
*
* @author $Author: AndyMillne $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @version $Rev: 11970 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
$_SEOTEMPLATES = array(
'cal_event' => array(
'app' => 'calendar',
'allowRedirect' => 1,
'out' => array( '#app=calendar(?:&|&amp;)module=calendar(?:&|&amp;)section=view(?:&|&amp;)do=showevent(?:&|&amp;)event_id=(\d+?)(&|$)#i', 'calendar/event/$1-#{__title__}/$2' ),
'in' => array(
'regex' => "#/calendar/event/(\d+?)-([^/]+?)(/|$)#i",
'matches' => array( array( 'app' , 'calendar' ),
array( 'module' , 'calendar' ),
array( 'section' , 'view' ),
array( 'do' , 'showevent' ),
array( 'event_id' , '$1' ) )
) ),
'cal_post' => array(
'app' => 'calendar',
'allowRedirect' => 1,
'out' => array( '#app=calendar(?:&|&amp;)module=calendar(?:&|&amp;)section=post(?:&|&amp;)cal_id=(.+?)(?:&|&amp;)do=newevent#i', 'calendar/$1-#{__title__}/add' ),
'in' => array(
'regex' => "#/calendar/(\d+?)-([^/]+?)/add(/|$|\?)#i",
'matches' => array( array( 'app' , 'calendar' ),
array( 'module' , 'calendar' ),
array( 'section' , 'post' ),
array( 'do' , 'newevent' ),
array( 'cal_id' , '$1' ) )
) ),
'cal_day' => array(
'app' => 'calendar',
'allowRedirect' => 1,
'out' => array( '#app=calendar(?:&|&amp;)module=calendar(?:&|&amp;)section=view(?:&|&amp;)cal_id=(.+?)(?:&|&amp;)do=showday(?:&|&amp;)y=(.+?)(?:&|&amp;)m=(.+?)(?:&|&amp;)d=(.+?)(&|$)#i', 'calendar/$1-#{__title__}/day-$2-$3-$4$5' ),
'in' => array(
'regex' => "#/calendar/(\d+?)-([^/]+?)/day-(\d+?)-(\d+?)-(\d+?)(/|$)#i",
'matches' => array( array( 'app' , 'calendar' ),
array( 'module' , 'calendar' ),
array( 'section' , 'view' ),
array( 'do' , 'showday' ),
array( 'cal_id' , '$1' ),
array( 'y' , '$3' ),
array( 'm' , '$4' ),
array( 'd' , '$5' ) )
) ),
'cal_week' => array(
'app' => 'calendar',
'allowRedirect' => 1,
'out' => array( '#app=calendar(?:&|&amp;)module=calendar(?:&|&amp;)section=view(?:&|&amp;)cal_id=(\d+?)(?:&|&amp;)do=showweek(?:&|&amp;)week=(.+?)(?:&|$)#i', 'calendar/$1-#{__title__}/week-$2' ),
'in' => array(
'regex' => "#/calendar/(\d+?)-([^/]+?)/week-(.+?)(/|$)#i",
'matches' => array( array( 'app' , 'calendar' ),
array( 'module' , 'calendar' ),
array( 'section' , 'view' ),
array( 'do' , 'showweek' ),
array( 'cal_id' , '$1' ),
array( 'week' , '$3' ) )
) ),
'cal_month' => array(
'app' => 'calendar',
'allowRedirect' => 1,
'out' => array( '#app=calendar(?:&|&amp;)module=calendar(?:&|&amp;)section=view(?:&|&amp;)cal_id=(.+?)(?:&|&amp;)m=(.+?)(?:&|&amp;)y=(.+?)(?:&|$)#i', 'calendar/$1-#{__title__}/$2-$3' ),
'in' => array(
'regex' => "#/calendar/(\d+?)-([^/]+?)/(\d+?)-(\d+?)(/|$)#i",
'matches' => array( array( 'app' , 'calendar' ),
array( 'module' , 'calendar' ),
array( 'section' , 'view' ),
array( 'cal_id' , '$1' ),
array( 'm' , '$3' ),
array( 'y' , '$4' ) )
) ),
'cal_calendar' => array(
'app' => 'calendar',
'allowRedirect' => 1,
'out' => array( '#app=calendar(?:&|&amp;)module=calendar(?:&|&amp;)section=view(?:&|&amp;)cal_id=(.+?)(&|$)#i', 'calendar/$1-#{__title__}' ),
'in' => array(
'regex' => "#/calendar/(\d+?)-([^/]+?)(/|$)#i",
'matches' => array( array( 'app' , 'calendar' ),
array( 'module' , 'calendar' ),
array( 'section' , 'view' ),
array( 'cal_id' , '$1' ) )
) ),
'app=calendar' => array(
'app' => 'calendar',
'allowRedirect' => 1,
'out' => array( '#app=calendar$#i', 'calendar/' ),
'in' => array(
'regex' => "#/calendar(/|$|\?)#i",
'matches' => array( array( 'app', 'calendar' ) )
) ),
);
@@ -0,0 +1,10 @@
<html>
<head><title>IP.Board - Bulletin Board System</title></head>
<body>
<h1>403: IP.Board -&gt; Forbidden</h1>
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
</html>
@@ -0,0 +1,189 @@
<?php
/**
* @file calendars.php Calendars like class (calendar application)
*~TERABYTE_DOC_READY~
* $Copyright: (c) 2001 - 2011 Invision Power Services, Inc.$
* $License: http://www.invisionpower.com/company/standards.php#license$
* $Author: ips_terabyte $
* $LastChangedDate: 2011-04-15 11:55:29 -0400 (Fri, 15 Apr 2011) $
* @version v3.4.5
* $Revision: 8355 $
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
/**
*
* @class like_calendar_calendars_composite
* @brief Calendars like class (calendar application)
*/
class like_calendar_calendars_composite extends classes_like_composite
{
/**
* Registry Object Shortcuts
*
* @var $registry
* @var $DB
* @var $settings
* @var $request
* @var $lang
* @var $member
* @var $memberData
* @var $cache
* @var $caches
*/
protected $registry;
protected $DB;
protected $settings;
protected $request;
protected $lang;
protected $member;
protected $memberData;
protected $cache;
protected $caches;
/**
* Constructor
*
* @return @e void
*/
public function __construct()
{
/* Make registry objects */
$this->registry = ipsRegistry::instance();
$this->DB = $this->registry->DB();
$this->settings =& $this->registry->fetchSettings();
$this->request =& $this->registry->fetchRequest();
$this->lang = $this->registry->getClass('class_localization');
$this->member = $this->registry->member();
$this->memberData =& $this->registry->member()->fetchMemberData();
$this->cache = $this->registry->cache();
$this->caches =& $this->registry->cache()->fetchCaches();
$this->lang->loadLanguageFile( array( 'public_calendar' ), 'calendar' );
}
/**
* Fetch the template group
*
* @return @e string
*/
public function skin()
{
return 'calendar';
}
/**
* Fetch the template prefix. This allows you to have two follow implementations in
* one skin file (i.e. skin_calendars -> eventLikeMoreDialog() and skin_calendars -> calendarLikeMoreDialog())
*
* @return @e string
*/
public function templatePrefix()
{
return 'calendar_';
}
/**
* Gets the vernacular (like or follow)
*
* @return @e string
*/
public function getVernacular()
{
return 'follow_c';
}
/**
* Return an array of acceptable frequencies
* Possible: immediate, offline, daily, weekly
*
* @return @e array
*/
public function allowedFrequencies()
{
return array( 'immediate', 'offline' );
}
/**
* Return types of notification available for this item
*
* @return @e array array( key, human readable )
*/
public function getNotifyType()
{
return array( 'events', ipsRegistry::getClass('class_localization')->words['like__events'] );
}
/**
* Returns the type of item
*
* @param mixed $relId Relationship ID or array of IDs
* @param array $selectType Array of meta to select (title, url, type, parentTitle, parentUrl, parentType) null fetches all
* @return @e array Meta data
*/
public function getMeta( $relId, $selectType=null )
{
$return = array();
$isNumeric = false;
if ( is_numeric( $relId ) )
{
$relId = array( intval($relId) );
$isNumeric = true;
}
$this->DB->build( array(
'select' => '*',
'from' => 'cal_calendars',
'where' => 'cal_id IN (' . implode( ',', $relId ) . ')',
) );
$this->DB->execute();
while( $row = $this->DB->fetch() )
{
/* Title */
if ( $selectType === null OR ( is_array( $selectType ) AND in_array( 'title', $selectType ) ) )
{
$return[ $row['cal_id'] ]['like.title'] = $row['cal_title'];
}
/* URL */
if ( $selectType === null OR ( is_array( $selectType ) AND in_array( 'url', $selectType ) ) )
{
$return[ $row['cal_id'] ]['like.url'] = $this->registry->output->buildSEOUrl( "app=calendar&amp;module=calendar&amp;section=view&amp;cal_id=" . $row['cal_id'], "public", $row['cal_title_seo'], "cal_calendar" );
}
/* Type */
if ( $selectType === null OR ( is_array( $selectType ) AND in_array( 'type', $selectType ) ) )
{
$return[ $row['file_id'] ]['like.type'] = $this->lang->words['like__calendar'];
}
/* Parent title */
if ( $selectType === null OR ( is_array( $selectType ) AND in_array( 'parentTitle', $selectType ) ) )
{
$return[ $row['file_id'] ]['like.parentTitle'] = $this->lang->words['like__index'];
}
/* Parent url */
if ( $selectType === null OR ( is_array( $selectType ) AND in_array( 'parentTitle', $selectType ) ) )
{
$return[ $row['file_id'] ]['like.parentUrl'] = $this->registry->output->buildSEOUrl( "app=calendar", "public", "false", "app=calendar" );
}
/* Parent Type */
if ( $selectType === null OR ( is_array( $selectType ) AND in_array( 'parentType', $selectType ) ) )
{
$return[ $row['file_id'] ]['like.parentType'] = $this->lang->words['like__index'];
}
}
return ( $isNumeric === true ) ? array_pop( $return ) : $return;
}
}
@@ -0,0 +1,191 @@
<?php
/**
* @file events.php Events like class (calendar application)
*~TERABYTE_DOC_READY~
* $Copyright: (c) 2001 - 2011 Invision Power Services, Inc.$
* $License: http://www.invisionpower.com/company/standards.php#license$
* $Author: ips_terabyte $
* $LastChangedDate: 2011-04-15 11:55:29 -0400 (Fri, 15 Apr 2011) $
* @version v3.4.5
* $Revision: 8355 $
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
/**
*
* @class like_calendar_events_composite
* @brief Events like class (calendar application)
*/
class like_calendar_events_composite extends classes_like_composite
{
/**
* Registry Object Shortcuts
*
* @var $registry
* @var $DB
* @var $settings
* @var $request
* @var $lang
* @var $member
* @var $memberData
* @var $cache
* @var $caches
*/
protected $registry;
protected $DB;
protected $settings;
protected $request;
protected $lang;
protected $member;
protected $memberData;
protected $cache;
protected $caches;
/**
* Constructor
*
* @return @e void
*/
public function __construct()
{
/* Make registry objects */
$this->registry = ipsRegistry::instance();
$this->DB = $this->registry->DB();
$this->settings =& $this->registry->fetchSettings();
$this->request =& $this->registry->fetchRequest();
$this->lang = $this->registry->getClass('class_localization');
$this->member = $this->registry->member();
$this->memberData =& $this->registry->member()->fetchMemberData();
$this->cache = $this->registry->cache();
$this->caches =& $this->registry->cache()->fetchCaches();
$this->lang->loadLanguageFile( array( 'public_calendar' ), 'calendar' );
}
/**
* Fetch the template group
*
* @return @e string
*/
public function skin()
{
return 'calendar';
}
/**
* Fetch the template prefix. This allows you to have two follow implementations in
* one skin file (i.e. skin_calendars -> eventLikeMoreDialog() and skin_calendars -> calendarLikeMoreDialog())
*
* @return @e string
*/
public function templatePrefix()
{
return 'event_';
}
/**
* Gets the vernacular (like or follow)
*
* @return @e string
*/
public function getVernacular()
{
return 'follow_e';
}
/**
* Return an array of acceptable frequencies
* Possible: immediate, offline, daily, weekly
*
* @return @e array
*/
public function allowedFrequencies()
{
return array( 'immediate', 'offline' );
}
/**
* Return types of notification available for this item
*
* @return @e array array( key, human readable )
*/
public function getNotifyType()
{
return array( 'comments', ipsRegistry::getClass('class_localization')->words['like__updatesandcomments'] );
}
/**
* Returns the type of item
*
* @param mixed $relId Relationship ID or array of IDs
* @param array $selectType Array of meta to select (title, url, type, parentTitle, parentUrl, parentType) null fetches all
* @return @e array Meta data
*/
public function getMeta( $relId, $selectType=null )
{
$return = array();
$isNumeric = false;
if ( is_numeric( $relId ) )
{
$relId = array( intval($relId) );
$isNumeric = true;
}
$this->DB->build( array( 'select' => 'e.*',
'from' => array( 'cal_events' => 'e' ),
'where' => 'e.event_id IN (' . implode( ',', $relId ) . ')',
'add_join' => array( array( 'select' => 'c.*',
'from' => array( 'cal_calendars' => 'c' ),
'where' => 'e.event_calendar_id=c.cal_id',
'type' => 'left' ) ) ) );
$this->DB->execute();
while( $row = $this->DB->fetch() )
{
/* Title */
if ( $selectType === null OR ( is_array( $selectType ) AND in_array( 'title', $selectType ) ) )
{
$return[ $row['event_id'] ]['like.title'] = $row['event_title'];
}
/* URL */
if ( $selectType === null OR ( is_array( $selectType ) AND in_array( 'url', $selectType ) ) )
{
$return[ $row['event_id'] ]['like.url'] = $this->registry->output->buildSEOUrl( "app=calendar&amp;module=calendar&amp;section=view&amp;do=showevent&amp;event_id=" . $row['event_id'], "public", $row['event_title_seo'], "cal_event" );
}
/* Type */
if ( $selectType === null OR ( is_array( $selectType ) AND in_array( 'type', $selectType ) ) )
{
$return[ $row['event_id'] ]['like.type'] = $this->lang->words['like__event'];
}
/* Parent title */
if ( $selectType === null OR ( is_array( $selectType ) AND in_array( 'parentTitle', $selectType ) ) )
{
$return[ $row['event_id'] ]['like.parentTitle'] = $row['cal_title'];
}
/* Parent url */
if ( $selectType === null OR ( is_array( $selectType ) AND in_array( 'parentTitle', $selectType ) ) )
{
$return[ $row['event_id'] ]['like.parentUrl'] = $this->registry->output->buildSEOUrl( "app=calendar&amp;module=calendar&amp;section=view&amp;cal_id=" . $row['cal_id'], "public", $row['cal_title_seo'], "cal_calendar" );
}
/* Parent Type */
if ( $selectType === null OR ( is_array( $selectType ) AND in_array( 'parentType', $selectType ) ) )
{
$return[ $row['event_id'] ]['like.parentType'] = $this->lang->words['like__calendar'];
}
}
return ( $isNumeric === true ) ? array_pop( $return ) : $return;
}
}
@@ -0,0 +1,10 @@
<html>
<head><title>IP.Board - Bulletin Board System</title></head>
<body>
<h1>403: IP.Board -&gt; Forbidden</h1>
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
</html>
@@ -0,0 +1,103 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.4.5
* Calendar core extensions
* Last Updated: $LastChangedDate: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
* </pre>
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Calendar
* @link http://www.invisionpower.com
* @since 27th January 2004
* @version $Rev: 10721 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
/**
* Member Synchronization extensions
*
* @author $author$
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Calendar
* @link http://www.invisionpower.com
* @version $Rev: 10721 $
*/
class calendarMemberSync
{
/**
* This method is called after a member account has been removed
*
* @access public
* @param string $ids SQL IN() clause
* @return @e void
*/
public function onDelete( $mids )
{
if( ipsRegistry::instance()->DB()->checkForTable( 'cal_events' ) )
{
ipsRegistry::instance()->DB()->delete( 'cal_events', 'event_member_id' . $mids );
ipsRegistry::instance()->DB()->delete( 'cal_event_comments', 'comment_mid' . $mids );
ipsRegistry::instance()->DB()->delete( 'cal_event_ratings', 'rating_member_id' . $mids );
ipsRegistry::instance()->DB()->delete( 'cal_event_rsvp', 'rsvp_member_id' . $mids );
ipsRegistry::instance()->DB()->update( 'cal_import_feeds', array( 'feed_member_id' => 0 ), "feed_member_id" . $mids );
}
}
/**
* This method is called after a member's account has been merged into another member's account
*
* @access public
* @param array $member Member account being kept
* @param array $member2 Member account being removed
* @return @e void
*/
public function onMerge( $member, $member2 )
{
if( ipsRegistry::instance()->DB()->checkForTable( 'cal_events' ) )
{
ipsRegistry::instance()->DB()->update( 'cal_events', array( 'event_member_id' => intval($member['member_id']) ), "event_member_id=" . $member2['member_id'] );
ipsRegistry::instance()->DB()->update( 'cal_event_comments', array( 'comment_mid' => intval($member['member_id']) ), "comment_mid=" . $member2['member_id'] );
ipsRegistry::instance()->DB()->delete( 'cal_event_ratings', 'rating_member_id=' . $member2['member_id'] );
ipsRegistry::instance()->DB()->update( 'cal_import_feeds', array( 'feed_member_id' => intval($member['member_id']) ), "feed_member_id=" . $member2['member_id'] );
//-----------------------------------------
// Only RSVP once per member per event
//-----------------------------------------
$_existsMemberOne = array();
ipsRegistry::instance()->DB()->build( array( 'select' => 'rsvp_event_id', 'from' => 'cal_event_rsvp', 'where' => 'rsvp_member_id=' . $member['member_id'] ) );
ipsRegistry::instance()->DB()->execute();
while( $r = ipsRegistry::instance()->DB()->fetch() )
{
$_existsMemberOne[] = $r['rsvp_event_id'];
}
if( count($_existsMemberOne) )
{
ipsRegistry::instance()->DB()->update( 'cal_event_rsvp', array( 'rsvp_member_id' => intval($member['member_id']) ), "rsvp_member_id=" . $member2['member_id'] . " AND rsvp_event_id NOT IN(" . implode( ',', $_existsMemberOne ) . ")" );
}
else
{
ipsRegistry::instance()->DB()->update( 'cal_event_rsvp', array( 'rsvp_member_id' => intval($member['member_id']) ), "rsvp_member_id=" . $member2['member_id'] );
}
ipsRegistry::instance()->DB()->delete( 'cal_event_rsvp', 'rsvp_member_id=' . $member2['member_id'] );
}
}
}
@@ -0,0 +1,10 @@
<html>
<head><title>IP.Board - Bulletin Board System</title></head>
<body>
<h1>403: IP.Board -&gt; Forbidden</h1>
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
</html>
@@ -0,0 +1,228 @@
<?php
/**
* @file plugin_unapprovedevents.php Moderator control panel plugin: show events pending approval
*~TERABYTE_DOC_READY~
* $Copyright: (c) 2001 - 2011 Invision Power Services, Inc.$
* $License: http://www.invisionpower.com/company/standards.php#license$
* $Author: ips_terabyte $
* @since 2/23/2011
* $LastChangedDate: 2012-03-21 12:54:20 -0400 (Wed, 21 Mar 2012) $
* @version v3.4.5
* $Revision: 10464 $
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
exit();
}
/**
*
* @class plugin_calendar_unapprovedevents
* @brief Moderator control panel plugin: show events pending approval
*/
class plugin_calendar_unapprovedevents
{
/**
* Registry Object Shortcuts
*
* @var $registry
* @var $DB
* @var $settings
* @var $request
* @var $lang
* @var $member
* @var $memberData
* @var $cache
* @var $caches
*/
protected $registry;
protected $DB;
protected $settings;
protected $request;
protected $lang;
protected $member;
protected $memberData;
protected $cache;
protected $caches;
/**
* Calendar functions
*
* @var object
*/
protected $functions;
/**
* Calendar view class
*
* @var object
*/
protected $view;
/**
* Constructor
*
* @param object $registry Registry object
* @return @e void
*/
public function __construct( ipsRegistry $registry )
{
//-----------------------------------------
// Make shortcuts
//-----------------------------------------
$this->registry = $registry;
$this->DB = $this->registry->DB();
$this->settings =& $this->registry->fetchSettings();
$this->request =& $this->registry->fetchRequest();
$this->member = $this->registry->member();
$this->memberData =& $this->registry->member()->fetchMemberData();
$this->cache = $this->registry->cache();
$this->caches =& $this->registry->cache()->fetchCaches();
$this->lang = $this->registry->class_localization;
/* Load language strings.. */
$this->lang->loadLanguageFile( array( 'public_calendar' ), 'calendar' );
}
/**
* Returns the primary tab key for the navigation bar
*
* @return @e string
*/
public function getPrimaryTab()
{
return 'unapproved_content';
}
/**
* Returns the secondary tab key for the navigation bar
*
* @return @e string
*/
public function getSecondaryTab()
{
return 'unapprovedevents';
}
/**
* Determine if we can view tab
*
* @param array $permissions Moderator permissions
* @return @e bool
*/
public function canView( $permissions )
{
if( $this->memberData['g_is_supmod'] )
{
return true;
}
return false;
}
/**
* Execute plugin
*
* @param array $permissions Moderator permissions
* @return @e string
*/
public function executePlugin( $permissions )
{
//-----------------------------------------
// Check permissions
//-----------------------------------------
if( !$this->canView( $permissions ) )
{
return '';
}
//-----------------------------------------
// Functions class
//-----------------------------------------
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'calendar' ) . "/sources/functions.php", 'app_calendar_classes_functions', 'calendar' );
$this->functions = new $classToLoad( $this->registry );
$classToLoad = IPSLib::loadActionOverloader( IPSLib::getAppDir( 'calendar' ) . "/modules_public/calendar/view.php", 'public_calendar_calendar_view' );
$this->view = new $classToLoad( $this->registry );
$this->view->makeRegistryShortcuts( $this->registry );
$this->view->initCalendar();
/* Add some CSS.. */
$this->registry->output->addToDocumentHead( 'importcss', "{$this->settings['css_base_url']}style_css/{$this->registry->output->skin['_csscacheid']}/ipb_calendar.css" );
//-----------------------------------------
// Get 10 events
//-----------------------------------------
$calendars = $this->functions->getCalendars();
$events = array();
$total = array( 'events' => 0 );
if( count($calendars) )
{
$_calIds = array_keys( $calendars );
$st = intval($this->request['st']);
$total = $this->DB->buildAndFetch( array( 'select' => 'count(*) as events', 'from' => 'cal_events', 'where' => "event_calendar_id IN(" . implode( ',', $_calIds ) . ') AND event_approved=0' ) );
//-----------------------------------------
// Page links
//-----------------------------------------
$pages = $this->registry->output->generatePagination( array( 'totalItems' => $total['events'],
'itemsPerPage' => 10,
'currentStartValue' => $st,
'baseUrl' => "app=core&amp;module=modcp&amp;fromapp=calendar&amp;tab=unapprovedevents",
) );
/* Got events to load? */
if ( $total['events'] )
{
$_joins = array(
array(
'select' => 'm.*',
'from' => array( 'members' => 'm' ),
'where' => 'm.member_id=e.event_member_id',
'type' => 'left',
),
array(
'select' => 'pp.*',
'from' => array( 'profile_portal' => 'pp' ),
'where' => 'm.member_id=pp.pp_member_id',
'type' => 'left',
),
);
if ( $this->settings['reputation_enabled'] )
{
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/class_reputation_cache.php', 'classReputationCache' );
$this->registry->setClass( 'repCache', new $classToLoad() );
$_joins[] = $this->registry->getClass('repCache')->getTotalRatingJoin( 'event_id', 'e.event_id', 'calendar' );
$_joins[] = $this->registry->getClass('repCache')->getUserHasRatedJoin( 'event_id', 'e.event_id', 'calendar' );
}
$this->DB->build( array(
'select' => 'e.*',
'from' => array( 'cal_events' => 'e' ),
'order' => 'e.event_start_date ASC',
'limit' => array( $st, 10 ),
'where' => "e.event_calendar_id IN(" . implode( ',', $_calIds ) . ') AND e.event_approved=0',
'add_join' => $_joins,
) );
$outer = $this->DB->execute();
while( $r = $this->DB->fetch($outer) )
{
$events[] = $this->view->calendarMakeEventHTML( IPSMember::buildDisplayData( $r ), true );
}
}
}
return $this->registry->output->getTemplate('calendar')->modEventsWrapper( $events, $pages );
}
}
@@ -0,0 +1,48 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.4.5
* Define the core notification types
* Last Updated: $Date: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
* </pre>
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Downloads
* @link http://www.invisionpower.com
* @since 20th February 2002
* @version $Rev: 10721 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
/**
* Notification types
*/
ipsRegistry::getClass('class_localization')->loadLanguageFile( array( 'public_calendar' ), 'calendar' );
class calendar_notifications
{
public function getConfiguration()
{
/**
* Notification types - Needs to be a method so when require_once is used, $_NOTIFY isn't empty
*/
$_NOTIFY = array(
array( 'key' => 'updated_event', 'default' => array( 'inline' ), 'disabled' => array(), 'icon' => 'notify_calendar' ),
array( 'key' => 'new_event', 'default' => array( 'inline' ), 'disabled' => array(), 'icon' => 'notify_calendar' ),
);/*noLibHook*/
return $_NOTIFY;
}
}
@@ -0,0 +1,57 @@
<?php
/**
* @file permissionsSync.php Update calendar caches when permissions are updated from central manager
* $Copyright: (c) 2001 - 2011 Invision Power Services, Inc.$
* $License: http://www.invisionpower.com/company/standards.php#license$
* $Author: ips_terabyte $
* @since 3/18/2011
* $LastChangedDate: 2011-03-31 06:17:44 -0400 (Thu, 31 Mar 2011) $
* @version v3.4.5
* $Revision: 8229 $
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
exit();
}
/**
*
* @class calendarPermissionsSync
* @brief Recaches calendars when permissions are updated
*/
class calendarPermissionsSync
{
/**
* Cache Shortcut
*
* @var $cache
*/
protected $cache;
/**
* Constructor
*
* @param object $registry Registry object
* @return @e void
*/
public function __construct( ipsRegistry $registry )
{
//-----------------------------------------
// Make shortcuts
//-----------------------------------------
$this->cache = $registry->cache();
}
/**
* Callback when permissions have been updated
*
* @return @e string
*/
public function updatePermissions()
{
$this->cache->rebuildCache( 'calendars', 'calendar' );
}
}
@@ -0,0 +1,442 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.4.5
* Report Center :: Calendar plugin
* Last Updated: $LastChangedDate: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
* </pre>
*
* @author $Author: bfarber $
* @author Based on original "Report Center" by Luke Scott
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Calendar
* @link http://www.invisionpower.com
* @version $Rev: 10721 $
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
exit();
}
class calendar_plugin
{
/**#@+
* Registry objects
*
* @access protected
* @var object
*/
protected $registry;
protected $DB;
protected $settings;
protected $request;
protected $lang;
protected $member;
protected $memberData;
protected $cache;
protected $caches;
/**#@-*/
/**
* Holds extra data for the plugin
*
* @access private
* @var array Data specific to the plugin
*/
public $_extra;
/**
* Constructor
*
* @access public
* @param object Registry object
* @return @e void
*/
public function __construct( ipsRegistry $registry )
{
//-----------------------------------------
// Make object
//-----------------------------------------
$this->registry = $registry;
$this->DB = $this->registry->DB();
$this->settings =& $this->registry->fetchSettings();
$this->request =& $this->registry->fetchRequest();
$this->member = $this->registry->member();
$this->memberData =& $this->registry->member()->fetchMemberData();
$this->cache = $this->registry->cache();
$this->caches =& $this->registry->cache()->fetchCaches();
$this->lang = $this->registry->class_localization;
}
/**
* Display the form for extra data in the ACP
*
* @access public
* @param array Plugin data
* @param object HTML object
* @return string HTML to add to the form
*/
public function displayAdminForm( $plugin_data, &$html )
{
return '';
}
/**
* Process the plugin's form fields for saving
*
* @access public
* @param array Plugin data for save
* @return string Error message
*/
public function processAdminForm( &$save_data_array )
{
return '';
}
/**
* Update timestamp for report
*
* @access public
* @param array New reports
* @param array New members cache
* @return boolean
*/
public function updateReportsTimestamp( $new_reports, &$new_members_cache )
{
return true;
}
/**
* Get report permissions (only supermods can moderate calendar)
*
* @access public
* @param string Type of perms to check
* @param array Permissions data
* @param array group ids
* @param string Special permissions
* @return boolean
*/
public function getReportPermissions( $check, $com_dat, $group_ids, &$to_return )
{
if( $this->_extra['report_bypass'] == 0 || $this->memberData['g_is_supmod'] == 1 )
{
return true;
}
else
{
return false;
}
}
/**
* Show the report form for this module
*
* @access public
* @param array Application data
* @return string HTML form information
*/
public function reportForm( $com_dat )
{
$this->registry->class_localization->loadLanguageFile( array( 'public_calendar' ), 'calendar' );
$eventid = intval($this->request['event_id']);
$comment = intval($this->request['comment_id']);
$st = intval($this->request['st']);
if( ! $eventid )
{
$this->registry->output->showError( 'reports_no_event', 10177 );
}
/**
* Load event
*/
$event = $this->DB->buildAndFetch( array(
'select' => 'e.*',
'from' => array( 'cal_events' => 'e' ),
'where' => 'e.event_id=' . $eventid,
'add_join' => array(
array(
'select' => 'c.*',
'from' => array( 'cal_calendars' => 'c' ),
'where' => 'c.cal_id=e.event_calendar_id',
'type' => 'left',
)
)
) );
/* Loop through the cache and build calendar jump */
if ( count( $this->caches['calendars'] ) AND is_array( $this->caches['calendars'] ) )
{
foreach( $this->caches['calendars'] as $cal_id => $cal )
{
if( $cal_id == $event['event_calendar_id'] )
{
/* Got a perm */
if( ! $this->registry->permissions->check( 'view', $cal ) )
{
$this->registry->output->showError( 'reports_no_event', 10178 );
}
}
}
}
$ex_form_data = array(
'event_id' => $eventid,
'ctyp' => 'calendar',
'title' => $comment ? sprintf( $this->lang->words['rc_comment_pre'], $event['event_title'] ) : $event['event_title'],
'comment' => $comment,
'st' => $st,
);
$this->registry->output->setTitle( $comment ? $this->lang->words['report_cal_pagec'] : $this->lang->words['report_cal_page'] );
$this->registry->output->addNavigation( $comment ? sprintf( $this->lang->words['rc_comment_pre'], $event['event_title'] ) : $event['event_title'], "app=calendar&amp;module=calendar&amp;section=view&amp;do=showevent&amp;event_id={$event['event_id']}" . ( $comment ? "&amp;st={$st}#comment_{$comment}" : '' ), $event['event_title_seo'], 'cal_event' );
$this->registry->output->addNavigation( $comment ? $this->lang->words['report_cal_pagec'] : $this->lang->words['report_cal_page'], '' );
$this->lang->words['report_basic_title'] = $this->lang->words['report_cal_title'];
$this->lang->words['report_basic_url_title'] = $this->lang->words['report_cal_title'];
$this->lang->words['report_basic_enter'] = $this->lang->words['report_cal_msg'];
$url = $this->registry->output->buildSEOUrl( "app=calendar&amp;module=calendar&amp;section=view&amp;do=showevent&amp;event_id={$event['event_id']}" . ( $comment ? "&amp;st={$st}#comment_{$comment}" : '' ), 'public', $event['event_title_seo'], 'cal_event' );
return $this->registry->getClass('reportLibrary')->showReportForm( $comment ? sprintf( $this->lang->words['rc_comment_pre'], $event['event_title'] ) : $event['event_title'], $url, $ex_form_data );
}
/**
* Get section and link
*
* @access public
* @param array Report data
* @return array Section/link
*/
public function giveSectionLinkTitle( $report_row )
{
$_event = $this->DB->buildAndFetch( array( 'select' => 'event_calendar_id', 'from' => 'cal_events', 'where' => 'event_id=' . intval($report_row['exdat1']) ) );
ipsRegistry::_loadAppCoreVariables( 'calendar' );
$calendarCache = $this->cache->getCache('calendars');
return array(
'title' => $calendarCache[ $_event['event_calendar_id'] ]['cal_title'],
'url' => "/index.php?app=calendar&amp;module=calendar&amp;section=view&amp;cal_id={$_event['event_calendar_id']}",
'seo_title' => $calendarCache[ $_event['event_calendar_id'] ]['cal_title_seo'],
'seo_template' => 'cal_calendar',
);
}
/**
* Process a report and save the data appropriate
*
* @access public
* @param array Report data
* @return array Data from saving the report
*/
public function processReport( $com_dat )
{
$eventid = intval($this->request['event_id']);
$comment = intval($this->request['comment']);
$st = intval($this->request['st']);
if( ! $eventid )
{
$this->registry->output->showError( 'reports_no_event', 10179 );
}
/**
* Load event
*/
$event = $this->DB->buildAndFetch( array(
'select' => 'e.*',
'from' => array( 'cal_events' => 'e' ),
'where' => 'e.event_id=' . $eventid,
'add_join' => array(
array(
'select' => 'c.*',
'from' => array( 'cal_calendars' => 'c' ),
'where' => 'c.cal_id=e.event_calendar_id',
'type' => 'left',
)
)
) );
/* Loop through the cache and build calendar jump */
if ( count( $this->caches['calendars'] ) AND is_array( $this->caches['calendars'] ) )
{
foreach( $this->caches['calendars'] as $cal_id => $cal )
{
if( $cal_id == $event['event_calendar_id'] )
{
/* Got a perm */
if( ! $this->registry->permissions->check( 'view', $cal ) )
{
$this->registry->output->showError( 'reports_no_event', 10180 );
}
}
}
}
$url = "app=calendar&module=calendar&section=view&do=showevent&event_id={$event['event_id']}";
if( $comment )
{
$url .= '&st=' . $st . '#comment_' . $comment;
}
$return_data = array();
$a_url = str_replace("&", "&amp;", $url);
$uid = md5( 'cal_' . $eventid . $comment . '_' . $com_dat['com_id'] );
$status = array();
$this->DB->build( array( 'select' => 'status, is_new, is_complete',
'from' => 'rc_status',
'where' => "is_new=1 OR is_complete=1",
) );
$this->DB->execute();
while( $row = $this->DB->fetch() )
{
if( $row['is_new'] == 1 )
{
$status['new'] = $row['status'];
}
elseif( $row['is_complete'] == 1 )
{
$status['complete'] = $row['status'];
}
}
$this->DB->build( array( 'select' => 'id', 'from' => 'rc_reports_index', 'where' => "uid='{$uid}'" ) );
$this->DB->execute();
if( $this->DB->getTotalRows() == 0 )
{
$built_report_main = array(
'uid' => $uid,
'title' => $this->request['title'],
'status' => $status['new'],
'url' => '/index.php?' . $a_url,
'seoname' => $event['event_title_seo'],
'seotemplate' => 'cal_event',
'rc_class' => $com_dat['com_id'],
'updated_by' => $this->memberData['member_id'],
'date_updated' => time(),
'date_created' => time(),
'exdat1' => $event['event_id'],
'exdat2' => $comment,
'exdat3' => $st
);
$this->DB->insert( 'rc_reports_index', $built_report_main );
$rid = $this->DB->getInsertId();
}
else
{
$the_report = $this->DB->fetch();
$rid = $the_report['id'];
$this->DB->update( 'rc_reports_index', array( 'date_updated' => time(), 'status' => $status['new'] ), "id='{$rid}'" );
}
IPSText::getTextClass('bbcode')->parse_bbcode = 1;
IPSText::getTextClass('bbcode')->parse_html = 0;
IPSText::getTextClass('bbcode')->parse_emoticons = 1;
IPSText::getTextClass('bbcode')->parse_nl2br = 1;
IPSText::getTextClass('bbcode')->parsing_section = 'reports';
$build_report = array(
'rid' => $rid,
'report' => IPSText::getTextClass('bbcode')->preDbParse( $this->request['message'] ),
'report_by' => $this->memberData['member_id'],
'date_reported' => time(),
);
$this->DB->insert( 'rc_reports', $build_report );
$reports = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) as total', 'from' => 'rc_reports', 'where' => "rid='{$rid}'" ) );
$this->DB->update( 'rc_reports_index', array( 'num_reports' => $reports['total'] ), "id='{$rid}'" );
$return_data = array(
'REDIRECT_URL' => $a_url,
'REPORT_INDEX' => $rid,
'SAVED_URL' => '/index.php?' . $url,
'REPORT' => $build_report['report'],
'SEOTITLE' => $event['event_title_seo'],
'TEMPLATE' => 'cal_event',
);
return $return_data;
}
/**
* Accepts an array of data from rc_reports_index and returns an array formatted nearly identical to processReport()
*
* @param array Report data
* @return array Formatted report data
*/
public function formatReportData( $report_data )
{
return array(
'REDIRECT_URL' => $report_data['url'],
'REPORT_INDEX' => $report_data['id'],
'SAVED_URL' => str_replace( '&amp;', '&', $report_data['url'] ),
'REPORT' => '',
'SEOTITLE' => $report_data['seoname'],
'TEMPLATE' => 'cal_event',
);
}
/**
* Where to send user after report is submitted
*
* @access public
* @param array Report data
* @return @e void
*/
public function reportRedirect( $report_data )
{
$this->registry->output->redirectScreen( $this->lang->words['report_sending'], $this->settings['base_url'] . $report_data['REDIRECT_URL'], $report_data['SEOTITLE'], $report_data['TEMPLATE'] );
}
/**
* Retrieve list of users to send notifications to
*
* @access public
* @param string Group ids
* @param array Report data
* @return array Array of users to PM/Email
*/
public function getNotificationList( $group_ids, $report_data )
{
$notify = array();
$this->DB->build( array(
'select' => 'mem.member_id, mem.members_display_name as name, mem.language, mem.members_disable_pm, mem.email, mem.member_group_id',
'from' => array( 'members' => 'mem' ),
'where' => 'mem.member_group_id IN(' . $group_ids . ')',
'add_join' => array(
array(
'select' => 'noti.*',
'from' => array( 'rc_modpref' => 'noti' ),
'where' => 'mem.member_id=noti.mem_id',
)
)
) );
$this->DB->execute();
if( $this->DB->getTotalRows() > 0 )
{
while( $row = $this->DB->fetch() )
{
$notify[] = $row;
}
}
return $notify;
}
}
@@ -0,0 +1,10 @@
<html>
<head><title>IP.Board - Bulletin Board System</title></head>
<body>
<h1>403: IP.Board -&gt; Forbidden</h1>
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
</html>
@@ -0,0 +1,239 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.4.5
* Reputation configuration for application
* Last Updated: $Date: 2012-09-27 11:58:26 -0400 (Thu, 27 Sep 2012) $
* </pre>
*
* @author $author$
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @version $Rev: 11387 $
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class reputation_calendar
{
/**
* Constructor
*/
public function __construct()
{
/* Init attachments */
$classname = IPSLib::loadLibrary( IPSLib::getAppDir( 'core' ) . '/sources/classes/attach/class_attach.php', 'class_attach' );
$this->class_attach = new $classname( ipsRegistry::instance() );
ipsRegistry::getClass('class_localization')->loadLanguageFile( array( 'public_topic' ), 'forums' );
$this->class_attach->type = 'event';
$this->class_attach->init();
$this->class_attach->getUploadFormSettings();
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/class_reputation_cache.php', 'classReputationCache' );
ipsRegistry::setClass( 'repCache', new $classToLoad() );
}
/**
* Database Query to get results
*
* @param string 'given' if we want to return items as user has liked
* 'received' if we want to fetch items a user has posted that others have liked
* NULL to get highest rated
* @param array Member this applies to
* NULL to get highest rated
*
* @return array Parameters to pass to ipsRegistry::DB()->build
* Must return at least the data from reputation_index
* limit and order will be applied automatically
*/
public function fetch( $type=NULL, $member=NULL )
{
//-----------------------------------------
// Get our allowed calendars
//-----------------------------------------
$allowedCalendarIds = array();
ipsRegistry::DB()->build( array( 'select' => 'perm_type_id as calendar_id', 'from' => 'permission_index', 'where' => "app='calendar' AND " . ipsRegistry::DB()->buildRegexp( "perm_view", ipsRegistry::member()->perm_id_array ) ) );
ipsRegistry::DB()->execute();
while( $r = ipsRegistry::DB()->fetch() )
{
$allowedCalendarIds[] = $r['calendar_id'];
}
//-----------------------------------------
// Return query
//-----------------------------------------
$userGiving = 'r';
$extraWhere = '';
$extraJoin = array();
if ( $type == 'most' )
{
return array( 'type' => 'event_id',
/* Used in first query to fetch type_ids */
'inner' => array( 'select' => 'e.event_id',
'from' => array( 'cal_events' => 'e' ),
'where' => ( empty( $allowedCalendarIds ) ? '1=0' : ipsRegistry::DB()->buildWherePermission( $allowedCalendarIds, 'e.event_calendar_id', FALSE ) ) ),
/* Used in second query to fetch actual data */
'joins' => array( array( 'select' => 'rc.*',
'from' => array( 'reputation_cache' => 'rc' ),
'where' => "rc.app='calendar' AND rc.type='event_id' AND rc.type_id=r.type_id" ),
array( 'select' => 'c.*',
'from' => array( 'cal_event_comments' => 'c' ),
'where' => 'r.type="comment_id" AND r.type_id=c.comment_id',
'type' => 'left' ),
array( 'select' => 'e.*',
'from' => array( 'cal_events' => 'e' ),
'where' => 'e.event_id = IFNULL(c.comment_eid, r.type_id)' ) ) );
}
else
{
if ( $type !== NULL )
{
$extraWhere = ( ( $type == 'given' ) ? "r.member_id={$member['member_id']}" : "( ( r.type='event_id' AND e.event_member_id={$member['member_id']} ) OR ( r.type='comment_id' AND c.comment_mid={$member['member_id']} ) )" ) . ' AND ';
}
else
{
$userGiving = 'r2';
$extraJoin = array( array(
'from' => array( 'reputation_index' => 'r2' ),
'where' => "r2.app=r.app AND r2.type=r.type AND r2.type_id=r.type_id AND r2.member_id=" . ipsRegistry::member()->getProperty('member_id')
) );
}
return array(
'select' => "r.*, rc.*, {$userGiving}.member_id as repUserGiving, e.*, c.*", // we have to do aliases on some of them due to duplicate column names
'from' => array( 'reputation_index' => 'r'),
'add_join' => array_merge( $extraJoin, array(
array(
'from' => array( 'reputation_cache' => 'rc' ),
'where' => "rc.app=r.app AND rc.type=r.type AND rc.type_id=r.type_id"
),
array(
'from' => array( 'cal_event_comments' => 'c' ),
'where' => 'r.type="comment_id" AND r.type_id=c.comment_id',
'type' => 'left'
),
array(
'from' => array( 'cal_events' => 'e' ),
'where' => 'e.event_id = IFNULL(c.comment_eid, r.type_id)',
'type' => 'left'
),
) ),
'where' => "r.app='calendar' AND " . // belongs to this app
$extraWhere . // is for this member
" e.event_id<>0 AND " . // is valid
( empty( $allowedCalendarIds ) ? '1=0' : ipsRegistry::DB()->buildWherePermission( $allowedCalendarIds, 'e.event_calendar_id', FALSE ) ), // we have permission to view
);
}
}
/**
* Process Results
*
* @param array Row from database using query specified in fetch()
* @return array Same data with any additional processing necessary
*/
public function process( $row )
{
if ( empty($row['comment_id']) )
{
$idField = 'event_id';
$authorField = 'event_member_id';
$contentField = 'event_content';
$parseSmilies = intval( $row['event_smilies'] );
}
else
{
$idField = 'comment_id';
$authorField = 'comment_mid';
$contentField = 'comment_text';
$parseSmilies = 1;
}
/* Build poster's display data */
$member = $row[ $authorField ] ? IPSMember::load( $row[ $authorField ], 'profile_portal,pfields_content,sessions,groups', 'id' ) : IPSMember::setUpGuest();
$row = array_merge( $row, IPSMember::buildDisplayData( $member, array( 'reputation' => 0, 'warn' => 0 ) ) );
/* Parse BBCode */
IPSText::getTextClass('bbcode')->parse_smilies = $parseSmilies;
IPSText::getTextClass('bbcode')->parse_html = 0;
IPSText::getTextClass('bbcode')->parse_nl2br = 1;
IPSText::getTextClass('bbcode')->parse_bbcode = 1;
IPSText::getTextClass('bbcode')->parsing_section = 'calendar';
IPSText::getTextClass('bbcode')->parsing_mgroup = $member['member_group_id'];
IPSText::getTextClass('bbcode')->parsing_mgroup_others = $member['mgroup_others'];
$row[ $contentField ] = IPSText::getTextClass('bbcode')->preDisplayParse( $row[ $contentField ] );
/* Parse attachments */
$messageHTML = array( $row[ $idField ] => $row[ $contentField ] );
$attachHTML = $this->class_attach->renderAttachments( $messageHTML, array( $row[ $idField ] ) );
if( is_array( $attachHTML ) AND count( $attachHTML ) )
{
/* Get rid of any lingering attachment tags */
if ( stristr( $attachHTML[ $row[ $idField ] ]['html'], "[attachment=" ) )
{
$attachHTML[ $row[ $idField ] ]['html'] = IPSText::stripAttachTag( $attachHTML[ $row[ $idField ] ]['html'] );
}
$row[ $contentField ] = $attachHTML[ $row[ $idField ] ]['html'] . $attachHTML[ $row[ $idField ] ]['attachmentHtml'];
}
/* Get rep buttons */
if ( $row['repUserGiving'] == ipsRegistry::member()->getProperty('member_id') )
{
$row['has_given_rep'] = $row['rep_rating'];
}
$row['repButtons'] = ipsRegistry::getClass('repCache')->getLikeFormatted( array( 'app' => 'calendar', 'type' => $idField, 'id' => $row[ $idField ], 'rep_like_cache' => $row['rep_like_cache'] ) );
/* Return */
return $row;
}
/**
* Display Results
*
* @param array Results after being processed
* @param string HTML
*/
public function display( $results )
{
ipsRegistry::getClass('class_localization')->loadLanguageFile( 'public_calendar', 'calendar' );
return ipsRegistry::getClass('output')->getTemplate('profile')->tabReputation_calendar( $results );
}
}
$rep_author_config = array(
'comment_id' => array( 'column' => 'comment_mid', 'table' => 'cal_event_comments' ),
'event_id' => array( 'column' => 'event_member_id', 'table' => 'cal_events' ),
);
$rep_log_joins = array(
array(
'from' => array( 'cal_event_comments' => 'c' ),
'where' => 'r.type="comment_id" AND r.type_id=c.comment_id AND r.app="calendar"',
'type' => 'left'
),
array(
'select' => 'e.event_title as repContentTitle, e.event_id as repContentID',
'from' => array( 'cal_events' => 'e' ),
'where' => 'e.event_id = IFNULL(c.comment_eid, r.type_id)',
'type' => 'left'
),
);
$rep_log_where = "r.member_id=%d";
$rep_log_link = 'app=calendar&amp;module=calendar&amp;section=view&amp;do=showevent&amp;event_id=%d#comment_%d';
@@ -0,0 +1,123 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.4.5
* RSS output plugin :: calendar
* Last Updated: $Date: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
* </pre>
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Calendar
* @link http://www.invisionpower.com
* @since 6/24/2008
* @version $Revision: 10721 $
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class rss_output_calendar
{
/**
* Expiration date
*
* @var integer Expiration timestamp
*/
protected $expires = 0;
/**
* Grab the RSS links
*
* @return string RSS document
*/
public function getRssLinks()
{
$return = array();
$_calendarCache = ipsRegistry::cache()->getCache('calendars');
if( is_array($_calendarCache) AND count($_calendarCache) )
{
foreach( $_calendarCache as $r )
{
if( ! ipsRegistry::getClass( 'permissions' )->check( 'view', $r ) || !$r['cal_rss_export'] )
{
continue;
}
$return[] = array( 'title' => $r['cal_title'], 'url' => ipsRegistry::getClass('output')->formatUrl( ipsRegistry::$settings['board_url'] . "/index.php?app=core&amp;module=global&amp;section=rss&amp;type=calendar&amp;id=" . $r['cal_id'], '%%' . $r['cal_title'] . '%%', 'section=rss2' ) );
}
}
return $return;
}
/**
* Grab the RSS document content and return it
*
* @return string RSS document
*/
public function returnRSSDocument()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$cal_id = intval( ipsRegistry::$request['id'] );
$rss_data = array();
$to_print = '';
$this->expires = time();
$_calendarCache = ipsRegistry::cache()->getCache('calendars');
//-----------------------------------------
// Get RSS export
//-----------------------------------------
$rss_data = $_calendarCache[ $cal_id ];
//-----------------------------------------
// Got one?
//-----------------------------------------
if ( $rss_data['cal_id'] AND $rss_data['cal_rss_export'] )
{
//-----------------------------------------
// Correct expires time
//-----------------------------------------
$this->expires = $rss_data['cal_rss_update_last'] + ( $rss_data['cal_rss_update'] * 60 );
//-----------------------------------------
// Need to recache?
//-----------------------------------------
if ( !$rss_data['cal_rss_cache'] OR ( time() - ( $rss_data['cal_rss_update'] * 60 ) ) > $rss_data['cal_rss_update_last'] )
{
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir('calendar') . '/sources/cache.php', 'calendar_cache', 'calendar' );
$rss_export = new $classToLoad( ipsRegistry::instance() );
return $rss_export->rebuildCalendarRSSCache( $rss_data['cal_id'] );
}
else
{
return $rss_data['cal_rss_cache'];
}
}
}
/**
* Grab the RSS document expiration timestamp
*
* @return integer Expiration timestamp
*/
public function grabExpiryDate()
{
return $this->expires ? $this->expires : time();
}
}
@@ -0,0 +1,37 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.4.5
* Config file
* Last Updated: $Date: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
* </pre>
*
* @author $author$
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Calendar
* @link http://www.invisionpower.com
* @version $Rev: 10721 $
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
/* Can search with this app */
$CONFIG['can_search'] = 1;
/* Can view new content with this app */
$CONFIG['can_viewNewContent'] = 1;
$CONFIG['can_vnc_unread_content'] = 0;
$CONFIG['can_vnc_filter_by_followed'] = 1;
/* Can fetch user generated content */
$CONFIG['can_userContent'] = 1;
/* Content types for 'follow', default one first */
$CONFIG['followContentTypes'] = array( 'events', 'calendars' );
@@ -0,0 +1,10 @@
<html>
<head><title>IP.Board - Bulletin Board System</title></head>
<body>
<h1>403: IP.Board -&gt; Forbidden</h1>
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
</html>
@@ -0,0 +1,400 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.4.5
* Basic Calendar Search
* Last Updated: $Date: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
* </pre>
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Calendar
* @link http://www.invisionpower.com
* @version $Rev: 10721 $
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class search_engine_calendar extends search_engine
{
/**
* Calendars we have access to
*
* @var array
*/
protected $calendars = array();
/**
* Constructor
*/
public function __construct( ipsRegistry $registry )
{
parent::__construct( $registry );
}
/**
* Perform a search.
* Returns an array of a total count (total number of matches)
* and an array of IDs ( 0 => 1203, 1 => 928, 2 => 2938 ).. matching the required number based on pagination. The ids returned would be based on the filters and type of search
*
* So if we had 1000 replies, and we are on page 2 of 25 per page, we'd return 25 items offset by 25
*
* @return array
*/
public function search()
{
//-----------------------------------------
// Init
//-----------------------------------------
$sort_by = IPSSearchRegistry::get('in.search_sort_by');
$sort_order = IPSSearchRegistry::get('in.search_sort_order');
$search_term = IPSSearchRegistry::get('in.clean_search_term');
$sortKey = '';
$rows = array();
switch( $sort_by )
{
default:
case 'date':
$sortKey = 'c.event_start_date';
break;
case 'title':
$sortKey = 'c.event_title';
break;
}
//-----------------------------------------
// Get calendars
//-----------------------------------------
if( !count($this->calendars) )
{
$this->DB->build( array( 'select' => 'perm_type_id as calendar_id', 'from' => 'permission_index', 'where' => "app='calendar' AND " . $this->DB->buildRegexp( "perm_view", $this->member->perm_id_array ) ) );
$this->DB->execute();
while( $r = $this->DB->fetch() )
{
$this->calendars[] = $r['calendar_id'];
}
}
//-----------------------------------------
// Get count
//-----------------------------------------
$where = $this->_buildWhereStatement( $search_term );
$count = $this->DB->buildAndFetch(
array(
'select' => 'COUNT(*) as total_results',
'from' => 'cal_events',
'where' => str_replace( 'c.', '', $where ),
) );
if( $count['total_results'] )
{
//-----------------------------------------
// Perform search
//-----------------------------------------
$this->DB->build( array(
'select' => "c.*",
'from' => array( 'cal_events' => 'c' ),
'where' => $where,
'order' => $sortKey . ' ' . $sort_order,
'limit' => array( IPSSearchRegistry::get('in.start'), IPSSearchRegistry::get('opt.search_per_page') ),
'add_join' => array(
array(
'select' => 'mem.members_display_name, mem.member_group_id, mem.mgroup_others',
'from' => array( 'members' => 'mem' ),
'where' => "mem.member_id=c.event_member_id",
'type' => 'left',
),
)
) );
$this->DB->execute();
while( $r = $this->DB->fetch() )
{
$rows[] = $r;
}
}
//-----------------------------------------
// Return results
//-----------------------------------------
return array( 'count' => $count['total_results'], 'resultSet' => $rows );
}
/**
* Perform the viewNewContent search
* Populates $this->_count and $this->_results
*
* @access public
* @return array
*/
public function viewNewContent()
{
//-----------------------------------------
// Init
//-----------------------------------------
IPSSearchRegistry::set('in.search_sort_by', 'date' );
IPSSearchRegistry::set('in.search_sort_order', 'desc' );
IPSSearchRegistry::set('opt.searchType', 'titles' );
IPSSearchRegistry::set('opt.noPostPreview', true );
//-----------------------------------------
// Set time limit
//-----------------------------------------
if ( IPSSearchRegistry::get('in.period_in_seconds') !== false )
{
$this->search_begin_timestamp = ( IPS_UNIX_TIME_NOW - IPSSearchRegistry::get('in.period_in_seconds') );
}
else
{
$this->search_begin_timestamp = intval( $this->memberData['last_visit'] ) ? intval( $this->memberData['last_visit'] ) : IPS_UNIX_TIME_NOW;
}
//-----------------------------------------
// Only content we are following?
//-----------------------------------------
if ( IPSSearchRegistry::get('in.vncFollowFilterOn' ) AND $this->memberData['member_id'] )
{
require_once( IPS_ROOT_PATH . 'sources/classes/like/composite.php' );/*noLibHook*/
$like = classes_like::bootstrap( 'calendar', 'events' );
$followedEvents = $like->getDataByMemberIdAndArea( $this->memberData['member_id'] );
$followedEvents = ( $followedEvents === null ) ? array() : array_keys( $followedEvents );
if( !count($followedEvents) )
{
return array( 'count' => 0, 'resultSet' => array() );
}
else
{
$this->whereConditions['AND'][] = "c.event_id IN(" . implode( ',', $followedEvents ) . ")";
}
}
//-----------------------------------------
// Only content we have participated in?
//-----------------------------------------
if( IPSSearchRegistry::get('in.userMode') )
{
switch( IPSSearchRegistry::get('in.userMode') )
{
default:
case 'all':
$_eventIds = $this->_getEventIdsFromComments();
if( count($_eventIds) )
{
$this->whereConditions['AND'][] = "(c.event_member_id=" . $this->memberData['member_id'] . " OR c.event_id IN(" . implode( ',', $_eventIds ) . "))";
}
else
{
$this->whereConditions['AND'][] = "c.event_member_id=" . $this->memberData['member_id'];
}
break;
case 'title':
$this->whereConditions['AND'][] = "c.event_member_id=" . $this->memberData['member_id'];
break;
}
}
return $this->search();
}
/**
* Find events we have commented on
*
* @return array
*/
protected function _getEventIdsFromComments()
{
$ids = array();
$this->DB->build( array(
'select' => $this->DB->buildDistinct('comment_eid'),
'from' => 'cal_event_comments',
'where' => 'comment_approved=1 AND comment_mid=' . $this->memberData['member_id'],
'limit' => array( 0, 200 )
) );
$this->DB->execute();
while( $r = $this->DB->fetch() )
{
$ids[] = $r['comment_eid'];
}
return $ids;
}
/**
* Perform the viewUserContent search
* Populates $this->_count and $this->_results
*
* @access public
* @return nothin'
*/
public function viewUserContent( $member )
{
//-----------------------------------------
// Set limits
//-----------------------------------------
$this->search_begin_timestamp = time() - ( 86400 * intval( $this->settings['search_ucontent_days'] ) );
$this->whereConditions['AND'][] = "c.event_member_id=" . intval( $member['member_id'] );
//-----------------------------------------
// Get count
//-----------------------------------------
return $this->search();
}
/**
* Builds the where portion of a search string
*
* @param string $search_term The string to use in the search
* @return string
*/
protected function _buildWhereStatement( $search_term )
{
//-----------------------------------------
// Init
//-----------------------------------------
$where_clause = array();
//-----------------------------------------
// Search term
//-----------------------------------------
if( $search_term )
{
$search_term = str_replace( '&quot;', '"', $search_term );
switch( IPSSearchRegistry::get('opt.searchType') )
{
case 'both':
default:
$where_clause[] = '(' . $this->DB->buildSearchStatement( 'c.event_title', $search_term, true, false, ipsRegistry::$settings['use_fulltext'] ) . ' OR ' . $this->DB->buildSearchStatement( 'c.event_content', $search_term, true, false, ipsRegistry::$settings['use_fulltext'] ) . ')';
break;
case 'titles':
$where_clause[] = $this->DB->buildSearchStatement( 'c.event_title', $search_term, true, false, ipsRegistry::$settings['use_fulltext'] );
break;
case 'content':
$where_clause[] = $this->DB->buildSearchStatement( 'c.event_content', $search_term, true, false, ipsRegistry::$settings['use_fulltext'] );
break;
}
}
//-----------------------------------------
// Date restriction
//-----------------------------------------
if( $this->search_begin_timestamp && $this->search_end_timestamp )
{
$where_clause[] = $this->DB->buildBetween( $this->DB->buildUnixTimestamp( "c.event_start_date" ), $this->search_begin_timestamp, $this->search_end_timestamp );
}
else
{
if( $this->search_begin_timestamp )
{
$where_clause[] = $this->DB->buildUnixTimestamp( "c.event_start_date" ) . " > {$this->search_begin_timestamp}";
}
if( $this->search_end_timestamp )
{
$where_clause[] = $this->DB->buildUnixTimestamp( "c.event_start_date" ) . " < {$this->search_end_timestamp}";
}
}
//-----------------------------------------
// Other conditions
//-----------------------------------------
if( isset( $this->whereConditions['AND'] ) && count( $this->whereConditions['AND'] ) )
{
$where_clause = array_merge( $where_clause, $this->whereConditions['AND'] );
}
if( isset( $this->whereConditions['OR'] ) && count( $this->whereConditions['OR'] ) )
{
$where_clause[] = '( ' . implode( ' OR ', $this->whereConditions['OR'] ) . ' )';
}
//-----------------------------------------
// Permissions
//-----------------------------------------
if( !$this->memberData['g_is_supmod'] )
{
$where_clause[] = 'c.event_approved=1';
}
else
{
$where_clause[] = 'c.event_approved IN (0,1)';
}
$where_clause[] = "c.event_calendar_id IN(" . ( count($this->calendars) ? implode( ',', $this->calendars ) : 0 ) . ")";
$where_clause[] = "((c.event_private=1 AND c.event_member_id=" . $this->memberData['member_id'] . ") OR (c.event_private=0 AND " . $this->DB->buildRegexp( "c.event_perms", $this->member->perm_id_array ) . "))";
//-----------------------------------------
// Return
//-----------------------------------------
return implode( " AND ", $where_clause );
}
/**
* Remap standard columns (Apps can override )
*
* @param string $column sql table column for this condition
* @return string column
*/
public function remapColumn( $column )
{
$column = $column == 'member_id' ? 'c.event_member_id' : $column;
return $column;
}
/**
* Returns an array used in the searchplugin's setCondition method
*
* @param array $data Array of forums to view
* @return array Array with column, operator, and value keys, for use in the setCondition call
*/
public function buildFilterSQL( $data )
{
return array();
}
/**
* Can handle boolean searching
*
* @access public
* @return boolean
*/
public function isBoolean()
{
return true;
}
}
@@ -0,0 +1,48 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.4.5
* Returns HTML for the form (optional class, not required)
* Last Updated: $Date: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
* </pre>
*
* @author $author$
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Calendar
* @link http://www.invisionpower.com
* @version $Rev: 10721 $
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class search_form_calendar
{
/**
* Constructor
*
* @return @e void
*/
public function __construct()
{
}
/**
* Return sort drop down
*
* @return array
*/
public function fetchSortDropDown()
{
$array = array( 'date' => ipsRegistry::instance()->getClass('class_localization')->words['s_search_type_0'],
'title' => ipsRegistry::instance()->getClass('class_localization')->words['forum_sort_title'] );
return $array;
}
}
@@ -0,0 +1,257 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.4.5
* Formats calendar search results
* Last Updated: $Date: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
* </pre>
*
* @author $author$
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Calendar
* @link http://www.invisionpower.com
* @version $Rev: 10721 $
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class search_format_calendar extends search_format
{
/**
* Constructor
*
* @param object ipsRegistry
* @return @e void
*/
public function __construct( ipsRegistry $registry )
{
$registry->class_localization->loadLanguageFile( array( 'public_calendar' ), 'calendar' );
parent::__construct( $registry );
}
/**
* Parse search results
*
* @access private
* @param array $r Search result
* @return array $html Blocks of HTML
*/
public function parseAndFetchHtmlBlocks( $rows )
{
return parent::parseAndFetchHtmlBlocks( $rows );
}
/**
* Formats the forum search result for display
*
* @access public
* @param array $event Array of data
* @return mixed Formatted content, ready for display, or array containing a $sub section flag, and content
*/
public function formatContent( $event )
{
//-----------------------------------------
// Times and dates
//-----------------------------------------
$event['_start_time'] = strtotime( $event['event_start_date'] );
$event['_end_time'] = ( $event['event_end_date'] AND $event['event_end_date'] != '0000-00-00 00:00:00' ) ? strtotime( $event['event_end_date'] ) : 0;
if( !$event['event_all_day'] )
{
if( $this->memberData['member_id'] AND $this->memberData['time_offset'] )
{
$event['_start_time'] = $event['_start_time'] + ( $this->memberData['time_offset'] * 3600 );
}
else if( !$this->memberData['member_id'] AND $this->settings['time_offset'] )
{
$event['_start_time'] = $event['_start_time'] + ( $this->settings['time_offset'] * 3600 );
}
}
if( !$event['event_all_day'] )
{
if( $this->memberData['member_id'] AND $this->memberData['time_offset'] )
{
$event['_end_time'] = $event['_end_time'] ? ( $event['_end_time'] + ( $this->memberData['time_offset'] * 3600 ) ) : 0;
}
else if( !$this->memberData['member_id'] AND $this->settings['time_offset'] )
{
$event['_end_time'] = $event['_end_time'] ? ( $event['_end_time'] + ( $this->settings['time_offset'] * 3600 ) ) : 0;
}
}
$event['_start_date'] = gmstrftime( $this->settings['clock_date'], $event['_start_time'] );
$event['_event_time'] = '';
$event['_event_etime'] = '';
if( !$event['event_all_day'] )
{
$event['_event_time'] = ltrim( gmstrftime( '%I:%M %p', $event['_start_time'] ), '0' );
$event['_event_etime'] = $event['_end_time'] ? ltrim( gmstrftime( '%I:%M %p', $event['_end_time'] ), '0' ) : ':00';
if( strpos( ':00', $event['_event_time'] ) === 0 OR gmstrftime( '%H:%M', $event['_start_time'] ) == '00:00' )
{
$event['_event_time'] = '';
}
if( strpos( ':00', $event['_event_etime'] ) === 0 OR gmstrftime( '%H:%M', $event['_end_time'] ) == '00:00' )
{
$event['_event_etime'] = '';
}
}
//-----------------------------------------
// Event type
//-----------------------------------------
$type = $this->lang->words['se_normal'];
$ends = '';
if( !$event['event_recurring'] AND $event['_end_time'] AND gmstrftime( $this->settings['clock_date'], $event['_end_time'] ) != $event['_start_date'] )
{
$type = $this->lang->words['se_range'];
$ends = sprintf( $this->lang->words['se_ends'], gmstrftime( $this->settings['clock_date'], $event['_end_time'] ) );
}
else if ( $event['event_recurring'] )
{
$type = $this->lang->words['se_recur'];
$ends = sprintf( $this->lang->words['se_ends'], gmstrftime( $this->settings['clock_date'], $event['_end_time'] ) );
}
//-----------------------------------------
// Output
//-----------------------------------------
return array( ipsRegistry::getClass( 'output' )->getTemplate( 'calendar' )->calEventSearchResult( $event, IPSSearchRegistry::get('opt.searchType') == 'titles' ? true : false, $type, $ends ), 0 );
}
/**
* Return the output for the followed content results
*
* @param array $results Array of results to show
* @param array $followData Meta data from follow/like system
* @return @e string
*/
public function parseFollowedContentOutput( $results, $followData )
{
/* Events? */
if( IPSSearchRegistry::get('in.followContentType') == 'events' )
{
if( count($results) )
{
$_results = array();
$this->DB->build( array(
'select' => "c.*",
'from' => array( 'cal_events' => 'c' ),
'where' => 'c.event_id IN(' . implode( ',', $results ) . ')',
'order' => 'c.event_start_date DESC',
'add_join' => array(
array(
'select' => 'i.*',
'from' => array( 'permission_index' => 'i' ),
'where' => "i.perm_type='calendar' AND i.perm_type_id=c.event_calendar_id",
'type' => 'left',
),
array(
'select' => 'mem.*',
'from' => array( 'members' => 'mem' ),
'where' => "mem.member_id=c.event_member_id",
'type' => 'left',
),
)
) );
$this->DB->execute();
while( $r = $this->DB->fetch() )
{
$_results[ $r['event_id'] ] = $this->genericizeResults( $r );
}
/* Merge in follow data */
foreach( $followData as $_follow )
{
$_results[ $_follow['like_rel_id'] ]['_followData'] = $_follow;
}
}
return $this->registry->output->getTemplate('calendar')->calEventFollowedWrapper( $this->parseAndFetchHtmlBlocks( $_results ) );
}
/* Or calendars? */
else
{
$calendars = array();
$member_ids = array();
if( count($results) )
{
/* Load calendars cache */
$_calCache = $this->cache->getCache( 'calendars' );
/* Get calendar data */
foreach( $results as $result )
{
$calendars[ $result ] = $_calCache[ $result ];
}
/* Merge in follow data */
foreach( $followData as $_follow )
{
$calendars[ $_follow['like_rel_id'] ]['_followData'] = $_follow;
}
}
return $this->registry->output->getTemplate('calendar')->followedContentCalendars( $calendars );
}
}
/**
* Formats / grabs extra data for results
* Takes an array of IDS (can be IDs from anything) and returns an array of expanded data.
*
* @param array $ids Ids
* @param array $followData Retrieve the follow meta data
* @return array
*/
public function processResults( $ids )
{
$rows = array();
foreach( $ids as $i => $d )
{
$rows[ $i ] = $this->genericizeResults( $d );
}
return $rows;
}
/**
* Reassigns fields in a generic way for results output
*
* @param array $r
* @return array
*/
public function genericizeResults( $r )
{
$r['app'] = 'calendar';
$r['content'] = $r['event_content'];
$r['content_title'] = $r['event_title'];
$r['updated'] = $r['event_lastupdated'];
$r['type_2'] = 'event';
$r['type_id_2'] = $r['event_id'];
$r['misc'] = null;
$r['member_id'] = $r['event_member_id'];
return $r;
}
}
@@ -0,0 +1,10 @@
<html>
<head><title>IP.Board - Bulletin Board System</title></head>
<body>
<h1>403: IP.Board -&gt; Forbidden</h1>
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
</html>
@@ -0,0 +1,10 @@
<html>
<head><title>IP.Board - Bulletin Board System</title></head>
<body>
<h1>403: IP.Board -&gt; Forbidden</h1>
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
</html>
@@ -0,0 +1,297 @@
<?php
/**
* @file plugin_events.php Shared media plugin: calendar events
* $Copyright: (c) 2001 - 2011 Invision Power Services, Inc.$
* $License: http://www.invisionpower.com/company/standards.php#license$
* $Author: bfarber $
* @since 3/8/2011
* $LastChangedDate: 2011-09-08 15:22:26 -0400 (Thu, 08 Sep 2011) $
* @version v3.4.5
* $Revision: 9469 $
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
exit();
}
/**
*
* @class plugin_calendar_events
* @brief Provide ability to share calendar events via editor
*/
class plugin_calendar_events
{
/**
* Registry Object Shortcuts
*
* @var $registry
* @var $DB
* @var $settings
* @var $request
* @var $lang
* @var $member
* @var $memberData
* @var $cache
* @var $caches
*/
protected $registry;
protected $DB;
protected $settings;
protected $request;
protected $lang;
protected $member;
protected $memberData;
protected $cache;
protected $caches;
/**
* Constructor
*
* @param object $registry Registry object
* @return @e void
*/
public function __construct( ipsRegistry $registry )
{
//-----------------------------------------
// Make shortcuts
//-----------------------------------------
$this->registry = $registry;
$this->DB = $this->registry->DB();
$this->settings =& $this->registry->fetchSettings();
$this->request =& $this->registry->fetchRequest();
$this->member = $this->registry->member();
$this->memberData =& $this->registry->member()->fetchMemberData();
$this->cache = $this->registry->cache();
$this->caches =& $this->registry->cache()->fetchCaches();
$this->lang = $this->registry->class_localization;
$this->lang->loadLanguageFile( array( 'public_calendar' ), 'calendar' );
}
/**
* Return the tab title
*
* @return @e string
*/
public function getTab()
{
if( $this->memberData['member_id'] )
{
return $this->lang->words['sharedmedia_events'];
}
}
/**
* Return the HTML to display the tab
*
* @return @e string
*/
public function showTab( $string )
{
//-----------------------------------------
// Are we a member?
//-----------------------------------------
if( !$this->memberData['member_id'] )
{
return '';
}
//-----------------------------------------
// How many approved events do we have?
//-----------------------------------------
$st = intval($this->request['st']);
$each = 30;
$where = '';
if( $string )
{
$where = " AND ( event_title LIKE '%{$string}%' OR event_content LIKE '%{$string}%' )";
}
$count = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) as total', 'from' => 'cal_events', 'where' => "event_approved=1 AND event_private=0 AND event_member_id={$this->memberData['member_id']}" . $where ) );
$rows = array();
$pages = $this->registry->output->generatePagination( array( 'totalItems' => $count['total'],
'itemsPerPage' => $each,
'currentStartValue' => $st,
'seoTitle' => '',
'method' => 'nextPrevious',
'noDropdown' => true,
'ajaxLoad' => 'mymedia_content',
'baseUrl' => "app=core&amp;module=ajax&amp;section=media&amp;do=loadtab&amp;tabapp=calendar&amp;tabplugin=events&amp;search=" . urlencode($string) ) );
$this->DB->build( array( 'select' => '*', 'from' => 'cal_events', 'where' => "event_approved=1 AND event_private=0 AND event_member_id={$this->memberData['member_id']}" . $where, 'order' => 'event_lastupdated DESC', 'limit' => array( $st, $each ) ) );
$outer = $this->DB->execute();
while( $r = $this->DB->fetch($outer) )
{
$rows[] = array(
'image' => $this->settings['img_url'] . '/sharedmedia/events.png',
'width' => 0,
'height' => 0,
'title' => IPSText::truncate( $r['event_title'], 25 ),
'desc' => IPSText::truncate( strip_tags( IPSText::stripAttachTag( IPSText::getTextClass('bbcode')->stripAllTags( $r['event_content'] ) ), '<br>' ), 100 ),
'insert' => "calendar:events:" . $r['event_id'],
);
}
return $this->registry->output->getTemplate('editors')->mediaGenericWrapper( $rows, $pages, 'calendar', 'events' );
}
/**
* Return the HTML output to display
*
* @param int $eventId Event ID to show
* @return @e string
*/
public function getOutput( $eventId=0 )
{
$eventId = intval($eventId);
if( !$eventId )
{
return '';
}
$event = $this->DB->buildAndFetch( array(
'select' => 'e.*',
'from' => array( 'cal_events' => 'e' ),
'where' => 'e.event_approved=1 AND e.event_private=0 AND e.event_id=' . $eventId,
'add_join' => array(
array(
'select' => 'c.*',
'from' => array( 'cal_calendars' => 'c' ),
'where' => 'c.cal_id=e.event_calendar_id',
'type' => 'left',
)
)
) );
//-----------------------------------------
// Times and dates
//-----------------------------------------
$event['_start_time'] = strtotime( $event['event_start_date'] );
$event['_end_time'] = ( $event['event_end_date'] AND $event['event_end_date'] != '0000-00-00 00:00:00' ) ? strtotime( $event['event_end_date'] ) : 0;
$event['_event_time'] = '';
$event['_event_etime'] = '';
if( !$event['event_all_day'] )
{
if( $this->memberData['member_id'] AND $this->memberData['time_offset'] )
{
$event['_start_time'] = $event['_start_time'] + ( $this->memberData['time_offset'] * 3600 );
}
else if( !$this->memberData['member_id'] AND $this->settings['time_offset'] )
{
$event['_start_time'] = $event['_start_time'] + ( $this->settings['time_offset'] * 3600 );
}
}
if( !$event['event_all_day'] )
{
if( $this->memberData['member_id'] AND $this->memberData['time_offset'] )
{
$event['_end_time'] = $event['_end_time'] ? ( $event['_end_time'] + ( $this->memberData['time_offset'] * 3600 ) ) : 0;
}
else if( !$this->memberData['member_id'] AND $this->settings['time_offset'] )
{
$event['_end_time'] = $event['_end_time'] ? ( $event['_end_time'] + ( $this->settings['time_offset'] * 3600 ) ) : 0;
}
}
$event['_start_date'] = gmstrftime( $this->settings['clock_date'], $event['_start_time'] );
$event['_event_time'] = '';
if( !$event['event_all_day'] )
{
if( $this->settings['cal_time_format'] == 'standard' )
{
$event['_event_time'] = ltrim( gmstrftime( '%I:%M %p', $event['_start_time'] ), '0' );
$event['_event_etime'] = $event['_end_time'] ? ltrim( gmstrftime( '%I:%M %p', $event['_end_time'] ), '0' ) : ':00';
}
else
{
$event['_event_time'] = ltrim( gmstrftime( '%H:%M', $event['_start_time'] ), '0' );
$event['_event_etime'] = $event['_end_time'] ? ltrim( gmstrftime( '%H:%M', $event['_end_time'] ), '0' ) : ':00';
}
if( strpos( ':00', $event['_event_time'] ) === 0 OR gmstrftime( '%H:%M', $event['_start_time'] ) == '00:00' )
{
$event['_event_time'] = '';
}
if( strpos( ':00', $event['_event_etime'] ) === 0 OR gmstrftime( '%H:%M', $event['_end_time'] ) == '00:00' )
{
$event['_event_etime'] = '';
}
}
//-----------------------------------------
// Event type
//-----------------------------------------
$type = $this->lang->words['se_normal'];
$ends = '';
if( !$event['event_recurring'] AND $event['_end_time'] AND gmstrftime( $this->settings['clock_date'], $event['_end_time'] ) != $event['_start_date'] )
{
$type = $this->lang->words['se_range'];
$ends = sprintf( $this->lang->words['se_ends'], gmstrftime( $this->settings['clock_date'], $event['_end_time'] ) );
}
else if ( $event['event_recurring'] )
{
$type = $this->lang->words['se_recur'];
$ends = sprintf( $this->lang->words['se_ends'], gmstrftime( $this->settings['clock_date'], $event['_end_time'] ) );
}
return $this->registry->output->getTemplate('calendar')->bbCodeEvent( $event, $type, $ends );
}
/**
* Verify current user has permission to post this
*
* @param int $eventId Event ID to show
* @return @e bool
*/
public function checkPostPermission( $eventId )
{
$eventId = intval($eventId);
if( !$eventId )
{
return '';
}
if( $this->memberData['g_is_supmod'] OR $this->memberData['is_mod'] )
{
return '';
}
$event = $this->DB->buildAndFetch( array(
'select' => 'e.*',
'from' => array( 'cal_events' => 'e' ),
'where' => 'e.event_approved=1 AND e.event_private=0 AND e.event_id=' . $eventId,
'add_join' => array(
array(
'select' => 'c.*',
'from' => array( 'cal_calendars' => 'c' ),
'where' => 'c.cal_id=e.event_calendar_id',
'type' => 'left',
)
)
) );
if( $this->memberData['member_id'] AND $event['event_member_id'] == $this->memberData['member_id'] )
{
return '';
}
return 'no_permission_shared';
}
}
@@ -0,0 +1,22 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.4.5
* Sphinx template file
* Last Updated: $Date: 2011-06-02 17:57:20 -0400 (Thu, 02 Jun 2011) $
* </pre>
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Calendar
* @link http://www.invisionpower.com
* @version $Rev: 8953 $
* @since 3.0.0
*
*/
/* This is just an empty sphinx template to ensure we overwrite outdated ones on upgrade */
$appSphinxTemplate = "";
@@ -0,0 +1,183 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.4.5
* Rebuild post content plugin
* Last Updated: $Date: 2011-05-05 07:03:47 -0400 (Thu, 05 May 2011) $
* </pre>
*
* @author $Author: ips_terabyte $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Downloads
* @link http://www.invisionpower.com
* @since 6/24/2008
* @version $Revision: 8644 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class postRebuild_calendar
{
/**
* New content parser
*
* @access public
* @var object
*/
public $parser;
/**#@+
* Registry Object Shortcuts
*
* @access protected
* @var object
*/
protected $registry;
protected $DB;
protected $settings;
protected $request;
protected $lang;
protected $member;
protected $memberData;
protected $cache;
protected $caches;
/**#@-*/
/**
* I'm a constructor, twisted constructor
*
* @access public
* @param object ipsRegistry reference
* @return @e void
*/
public function __construct( ipsRegistry $registry )
{
/* Make objects */
$this->registry = $registry;
$this->DB = $this->registry->DB();
$this->settings =& $this->registry->fetchSettings();
$this->request =& $this->registry->fetchRequest();
$this->lang = $this->registry->getClass('class_localization');
$this->member = $this->registry->member();
$this->memberData =& $this->registry->member()->fetchMemberData();
$this->cache = $this->registry->cache();
$this->caches =& $this->registry->cache()->fetchCaches();
}
/**
* Grab the dropdown options
*
* @access public
* @return array Multidimensional array of contents we can rebuild
*/
public function getDropdown()
{
return array( array( 'cal', $this->lang->words['remenu_events'] ) );
}
/**
* Find out if there are any more
*
* @access public
* @param string Content type we are rebuilding ( key 0 in arrays from getDropdown() )
* @param integer Start point
* @return integer
*/
public function getMax( $type, $dis )
{
switch( $type )
{
case 'cal':
$tmp = $this->DB->buildAndFetch( array( 'select' => 'event_id', 'from' => 'cal_events', 'limit' => array($dis,1) ) );
break;
}
return intval( $tmp['event_id'] );
}
/**
* Execute the database query to return the results
*
* @access public
* @param string Content type we are rebuilding ( key 0 in arrays from getDropdown() )
* @param integer Start point
* @param integer End point
* @return integer
*/
public function executeQuery( $type, $start, $end )
{
switch( $type )
{
case 'cal':
$this->DB->build( array( 'select' => 'e.*',
'from' => array( 'cal_events' => 'e' ),
'order' => 'e.event_id ASC',
'where' => 'e.event_id > ' . $start,
'limit' => array($end),
'add_join' => array( 1 => array( 'type' => 'left',
'select' => 'm.member_group_id, m.mgroup_others',
'from' => array( 'members' => 'm' ),
'where' => "m.member_id=e.event_member_id"
) )
) );
break;
}
}
/**
* Get preEditParse of the content
*
* @access public
* @param string Content type we are rebuilding ( key 0 in arrays from getDropdown() )
* @param array Database record from while loop
* @return string Content preEditParse
*/
public function getRawPost( $type, $r )
{
$this->parser->parse_smilies = $r['event_smilies'];
$this->parser->parse_html = 0;
$this->parser->parse_bbcode = 1;
$this->parser->parsing_section = 'calendar';
switch( $type )
{
case 'cal':
$rawpost = $this->parser->preEditParse( $r['event_content'] );
break;
}
return $rawpost;
}
/**
* Store the newly converted content
*
* @access public
* @param string Content type we are rebuilding ( key 0 in arrays from getDropdown() )
* @param array Database record from while loop
* @param string Newly parsed post
* @return string Content preEditParse
*/
public function storeNewPost( $type, $r, $newpost )
{
$lastId = 0;
switch( $type )
{
case 'cal':
$this->DB->update( 'cal_events', array( 'event_content' => $newpost ), 'event_id=' . $r['event_id'] );
$lastId = $r['event_id'];
break;
}
return $lastId;
}
}
@@ -0,0 +1,52 @@
<?php
/**
* @file warnings.php Warnings extension for calendar
*~TERABYTE_DOC_READY~
* $Copyright: (c) 2001 - 2011 Invision Power Services, Inc.$
* $License: http://www.invisionpower.com/company/standards.php#license$
* $Author: bfarber $ (Original: Mark)
* @since -
* $LastChangedDate: 2013-05-01 17:37:14 -0400 (Wed, 01 May 2013) $
* @version v3.4.5
* $Revision: 12212 $
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
/**
* @class warnings_calendar
* @brief Warnings Extension for calendar
*/
class warnings_calendar
{
/**
* Get Content URL
*
* @param array $warning Row from members_warn_logs
* @return @e array array( url => URL to the content the warning came from, title => Title )
*/
public function getContentUrl( $warning )
{
$exploded = explode( '-', $warning['wl_content_id2'] );
require_once( IPS_ROOT_PATH . 'sources/classes/comments/bootstrap.php' );/*noLibHook*/
$comments = classes_comments_bootstrap::controller( $warning['wl_content_id1'] );
$parent = $comments->fetchParent( $exploded[0] );
if ( is_null($parent) )
{
return NULL;
}
else
{
$parent = $comments->remapFromLocal( $parent, 'parent' );
return array( 'url' => ipsRegistry::getClass('output')->buildUrl( "app=core&module=global&section=comments&fromApp={$warning['wl_content_id1']}&do=findComment&parentId={$exploded[0]}&comment_id={$exploded[1]}" ), 'title' => $parent['parent_title'] );
}
}
}
@@ -0,0 +1,10 @@
<html>
<head><title>IP.Board - Bulletin Board System</title></head>
<body>
<h1>403: IP.Board -&gt; Forbidden</h1>
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
</html>
@@ -0,0 +1,567 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.4.5
* Calendar Management
* Last Updated: $LastChangedDate: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
* </pre>
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Calendar
* @link http://www.invisionpower.com
* @since 27th January 2004
* @version $Rev: 10721 $
*/
if ( ! defined( 'IN_ACP' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
exit();
}
class admin_calendar_calendar_calendars extends ipsCommand
{
/**
* Skin file
*
* @var object
*/
public $html;
/**
* Main execution method
*
* @param object ipsRegistry reference
* @return @e void
*/
public function doExecute( ipsRegistry $registry )
{
//-----------------------------------------
// Init
//-----------------------------------------
$this->html = $this->registry->output->loadTemplate( 'cp_skin_calendar' );
$this->html->form_code = 'module=calendar&amp;section=calendars';
$this->html->form_code_js = 'module=calendar&section=calendars';
$this->lang->loadLanguageFile( array( 'admin_calendar' ) );
//-----------------------------------------
// What are we doing
//-----------------------------------------
switch( $this->request['do'] )
{
case 'calendar_delete':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'calendar_delete' );
$this->calendarDelete();
break;
case 'calendar_add':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'calendar_manage' );
$this->calendarForm( 'new' );
break;
case 'calendar_add_do':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'calendar_manage' );
$this->calendarSave( 'new' );
break;
case 'calendar_edit':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'calendar_manage' );
$this->calendarForm( 'edit' );
break;
case 'calendar_edit_do':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'calendar_manage' );
$this->calendarSave( 'edit' );
break;
case 'calendar_move':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'calendar_manage' );
$this->calendarMove();
break;
case 'calendar_rebuildcache':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'calendar_manage' );
$this->cache->rebuildCache( 'calendar_events', 'calendar' );
$this->registry->output->global_message = $this->lang->words['c_recached'];
$this->calendarsList();
break;
case 'calendar_rss_cache':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'calendar_manage' );
$this->calendarRSSCache( intval( $this->request['cal_id'] ) );
$this->registry->output->global_message = $this->lang->words['c_rssrecached'];
$this->calendarsList();
break;
case 'calendars_list':
default:
$this->calendarsList();
break;
}
//-----------------------------------------
// Output
//-----------------------------------------
$this->registry->output->html_main .= $this->registry->output->global_template->global_frame_wrapper();
$this->registry->output->sendOutput();
}
/**
* Update the calendar position
*
* @return @e void
*/
public function calendarMove()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$classToLoad = IPSLib::loadLibrary( IPS_KERNEL_PATH . 'classAjax.php', 'classAjax' );
$ajax = new $classToLoad();
//-----------------------------------------
// Checks...
//-----------------------------------------
if( $this->registry->adminFunctions->checkSecurityKey( $this->request['md5check'], true ) === false )
{
$ajax->returnString( $this->lang->words['postform_badmd5'] );
exit();
}
//-----------------------------------------
// Save new position
//-----------------------------------------
$position = 1;
if( is_array($this->request['calendars']) AND count($this->request['calendars']) )
{
foreach( $this->request['calendars'] as $this_id )
{
$this->DB->update( 'cal_calendars', array( 'cal_position' => $position ), 'cal_id=' . $this_id );
$position++;
}
}
$this->calendarsRebuildCache();
$ajax->returnString( 'OK' );
exit();
}
/**
* Delete a calendar
*
* @return @e void
*/
public function calendarDelete()
{
//-----------------------------------------
// Init
//-----------------------------------------
$cal_id = intval( $this->request['cal_id'] );
if ( ! $cal_id )
{
$this->registry->output->global_message = $this->lang->words['c_noid'];
$this->calendarsList();
return;
}
//-----------------------------------------
// Delete
//-----------------------------------------
$this->DB->delete( 'cal_calendars', 'cal_id=' . $cal_id );
$this->DB->delete( 'permission_index', "app='calendar' AND perm_type='calendar' AND perm_type_id=" . $cal_id );
//-----------------------------------------
// Get feeds for removal
//-----------------------------------------
$_feedIds = array();
$this->DB->build( array( 'select' => 'feed_id', 'from' => 'cal_import_feeds', 'where' => 'feed_calendar_id=' . $cal_id ) );
$this->DB->execute();
while( $r = $this->DB->fetch() )
{
$_feedIds[] = $r['feed_id'];
}
$this->DB->delete( 'cal_import_feeds', 'feed_calendar_id=' . $cal_id );
if( count($_feedIds) )
{
$this->DB->delete( 'cal_import_map', 'import_feed_id IN(' . implode( ',', $_feedIds ) . ')' );
}
//-----------------------------------------
// Get event ids for comments/ratings
//-----------------------------------------
$_eventIds = array();
$this->DB->build( array( 'select' => 'event_id', 'from' => 'cal_events', 'where' => 'event_calendar_id=' . $cal_id ) );
$this->DB->execute();
while( $r = $this->DB->fetch() )
{
$_eventIds[] = $r['event_id'];
}
if( count($_eventIds) )
{
$this->DB->delete( 'cal_event_comments', 'comment_eid IN(' . implode( ',', $_eventIds ) . ')' );
$this->DB->delete( 'cal_event_ratings', 'rating_eid IN(' . implode( ',', $_eventIds ) . ')' );
$this->DB->delete( 'cal_event_rsvp', 'rsvp_event_id IN(' . implode( ',', $_eventIds ) . ')' );
//-----------------------------------------
// Delete attachments
//-----------------------------------------
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'core' ) . '/sources/classes/attach/class_attach.php', 'class_attach' );
$class_attach = new $classToLoad( $this->registry );
$class_attach->type = 'event';
$class_attach->init();
$class_attach->bulkRemoveAttachment( $_eventIds );
}
$this->DB->delete( 'cal_events', 'event_calendar_id=' . $cal_id );
//-----------------------------------------
// Remove likes
//-----------------------------------------
require_once( IPS_ROOT_PATH . 'sources/classes/like/composite.php' );/*noLibHook*/
$_like = classes_like::bootstrap( 'calendar', 'calendars' );
$_like->remove( $cal_id );
//-----------------------------------------
// Rebuild caches
//-----------------------------------------
$this->calendarsRebuildCache();
$this->cache->rebuildCache( 'calendar_events', 'calendar' );
$this->cache->rebuildCache( 'rss_calendar', 'calendar' );
//-----------------------------------------
// Redirect
//-----------------------------------------
$this->registry->output->global_message = $this->lang->words['c_removed'];
$this->calendarsList();
}
/**
* Handles the calednar new/edit form
*
* @param string $type Either new or edit
* @return @e void
*/
public function calendarSave( $type='new' )
{
//-----------------------------------------
// Init
//-----------------------------------------
$cal_id = intval( $this->request['cal_id'] );
$cal_title = trim( IPSText::stripslashes( IPSText::htmlspecialchars( $_POST['cal_title'] ) ) );
$cal_moderate = intval( $this->request['cal_moderate'] );
$cal_comment_moderate = intval( $this->request['cal_comment_moderate'] );
$cal_event_limit = intval( $this->request['cal_event_limit'] );
$cal_bday_limit = intval( $this->request['cal_bday_limit'] );
$cal_rss_export = intval( $this->request['cal_rss_export'] );
$cal_rss_export_days = intval( $this->request['cal_rss_export_days'] );
$cal_rss_export_max = intval( $this->request['cal_rss_export_max'] );
$cal_rss_update = intval( $this->request['cal_rss_update'] );
$cal_rsvp = intval( $this->request['cal_rsvp_owner'] );
//-----------------------------------------
// Error checking
//-----------------------------------------
if ( $type == 'edit' )
{
if ( ! $cal_id )
{
$this->registry->output->global_message = $this->lang->words['c_noid'];
$this->calendarsList();
return;
}
}
if ( ! $cal_title )
{
$this->registry->output->global_message = $this->lang->words['c_completeform'];
$this->calendarForm( $type );
return;
}
//-----------------------------------------
// Format for DB update
//-----------------------------------------
$array = array( 'cal_title' => $cal_title,
'cal_title_seo' => IPSText::makeSeoTitle( $cal_title ),
'cal_moderate' => $cal_moderate,
'cal_comment_moderate' => $cal_comment_moderate,
'cal_event_limit' => $cal_event_limit,
'cal_bday_limit' => $cal_bday_limit,
'cal_rss_export' => $cal_rss_export,
'cal_rss_export_days' => $cal_rss_export_days,
'cal_rss_export_max' => $cal_rss_export_max,
'cal_rss_update' => $cal_rss_update,
'cal_rsvp_owner' => $cal_rsvp,
);
//-----------------------------------------
// Insert or update
//-----------------------------------------
if ( $type == 'new' )
{
$this->DB->insert( 'cal_calendars', $array );
$cal_id = $this->DB->getInsertId();
$this->registry->output->global_message = $this->lang->words['c_added'];
}
else
{
$this->DB->update( 'cal_calendars', $array, 'cal_id=' . $cal_id );
$this->registry->output->global_message = $this->lang->words['c_edited'];
}
//-----------------------------------------
// Save permissions
//-----------------------------------------
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/class_public_permissions.php', 'classPublicPermissions' );
$permissions = new $classToLoad( $this->registry );
$permissions->savePermMatrix( $this->request['perms'], $cal_id, 'calendar' );
//-----------------------------------------
// Rebuild caches and redirect
//-----------------------------------------
$this->calendarsRebuildCache();
$this->cache->rebuildCache( 'calendar_events', 'calendar' );
$this->calendarRSSCache( $cal_id );
$this->cache->rebuildCache( 'rss_output_cache' );
$this->calendarsList();
}
/**
* Add/Edit Calendar Form
*
* @param string $type Either new or edit
* @return @e void
*/
public function calendarForm( $type='new' )
{
//-----------------------------------------
// Init
//-----------------------------------------
$cal_id = $this->request['cal_id'] ? intval( $this->request['cal_id'] ) : 0;
$form = array();
//-----------------------------------------
// Defaults
//-----------------------------------------
if ( $type == 'new' )
{
$formcode = 'calendar_add_do';
$title = $this->lang->words['c_addcal'];
$button = $this->lang->words['c_addcal'];
$calendar = array(
'cal_title' => '',
'cal_moderate' => 0,
'cal_comment_moderate' => 0,
'cal_rsvp_owner' => 0,
'cal_event_limit' => '',
'cal_bday_limit' => '',
'cal_rss_export' => '',
'cal_rss_update' => '',
'cal_rss_export_days' => '',
'cal_rss_export_max' => '',
'cal_id' => 0
);
}
else
{
$formcode = 'calendar_edit_do';
$title = $this->lang->words['c_editbutton'].$calendar['cal_title'];
$button = $this->lang->words['c_savebutton'];
$calendar = $this->DB->buildAndFetch( array(
'select' => 'c.*',
'from' => array( 'cal_calendars' => 'c' ),
'where' => 'c.cal_id=' . $cal_id,
'add_join' => array(
array(
'select' => 'p.*',
'from' => array( 'permission_index' => 'p' ),
'where' => "p.perm_type='calendar' AND perm_type_id=c.cal_id",
'type' => 'left',
)
)
) );
if ( ! $calendar['cal_id'] )
{
$this->registry->output->global_message = $this->lang->words['c_noid'];
$this->calendarsList();
return;
}
}
//-----------------------------------------
// Permissions
//-----------------------------------------
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/class_public_permissions.php', 'classPublicPermissions' );
$permissions = new $classToLoad( $this->registry );
//-----------------------------------------
// Form elements
//-----------------------------------------
$form['perm_matrix'] = $permissions->adminPermMatrix( 'calendar', $calendar, 'calendar', '', false );
$form['cal_title'] = $this->registry->output->formInput( 'cal_title' , !empty( $_POST['cal_title'] ) ? $_POST['cal_title'] : $calendar['cal_title'] );
$form['cal_moderate'] = $this->registry->output->formYesNo( 'cal_moderate' , !empty( $this->request['cal_moderate'] ) ? $this->request['cal_moderate'] : $calendar['cal_moderate'] );
$form['cal_moderatec'] = $this->registry->output->formYesNo( 'cal_comment_moderate' , !empty( $this->request['cal_comment_moderate'] ) ? $this->request['cal_comment_moderate'] : $calendar['cal_comment_moderate'] );
$form['cal_event_limit'] = $this->registry->output->formSimpleInput( 'cal_event_limit' , !empty( $this->request['cal_event_limit'] ) ? $this->request['cal_event_limit'] : $calendar['cal_event_limit'], 5 );
$form['cal_bday_limit'] = $this->registry->output->formSimpleInput( 'cal_bday_limit' , !empty( $this->request['cal_bday_limit'] ) ? $this->request['cal_bday_limit'] : $calendar['cal_bday_limit'], 5 );
$form['cal_rss_export'] = $this->registry->output->formYesNo( 'cal_rss_export' , !empty( $this->request['cal_rss_export'] ) ? $this->request['cal_rss_export'] : $calendar['cal_rss_export'] );
$form['cal_rss_update'] = $this->registry->output->formSimpleInput( 'cal_rss_update' , !empty( $this->request['cal_rss_update'] ) ? $this->request['cal_rss_update'] : $calendar['cal_rss_update'], 5 );
$form['cal_rss_export_days'] = $this->registry->output->formSimpleInput( 'cal_rss_export_days' , !empty( $this->request['cal_rss_export_days'] ) ? $this->request['cal_rss_export_days'] : $calendar['cal_rss_export_days'], 5 );
$form['cal_rss_export_max'] = $this->registry->output->formSimpleInput( 'cal_rss_export_max' , !empty( $this->request['cal_rss_export_max'] ) ? $this->request['cal_rss_export_max'] : $calendar['cal_rss_export_max'], 5 );
$form['cal_rsvp'] = $this->registry->output->formYesNo( 'cal_rsvp_owner' , !empty( $this->request['cal_rsvp_owner'] ) ? $this->request['cal_rsvp_owner'] : $calendar['cal_rsvp_owner'] );
//-----------------------------------------
// Output
//-----------------------------------------
$this->registry->output->html .= $this->html->calendarForm( $form, $title, $formcode, $button, $calendar );
}
/**
* List Calendars
*
* @return @e void
*/
public function calendarsList()
{
//-----------------------------------------
// Init
//-----------------------------------------
$rows = array();
//-----------------------------------------
// Get calendars
//-----------------------------------------
$this->DB->build( array( 'select' => '*', 'from' => 'cal_calendars', 'order' => 'cal_position ASC' ) );
$this->DB->execute();
while( $r = $this->DB->fetch() )
{
$rows[] = $r;
}
//-----------------------------------------
// Output
//-----------------------------------------
$this->registry->output->html .= $this->html->calendarOverviewScreen( $rows );
}
/**
* Rebuild the RSS Cache
*
* @param mixed $calendar_id Specify which calendar to rebuild, all is default
* @return @e void
*/
public function calendarRSSCache( $calendar_id='all' )
{
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir('calendar') . '/sources/cache.php', 'calendar_cache', 'calendar' );
$library = new $classToLoad( $this->registry );
$library->rebuildCalendarRSSCache( $calendar_id );
}
/**
* Builds a cache of the current calendars
*
* @return bool Returns true
*/
public function calendarsRebuildCache()
{
//-----------------------------------------
// Verify calendar is installed
//-----------------------------------------
if( !$this->DB->checkForTable('cal_calendars') )
{
return;
}
//-----------------------------------------
// Init
//-----------------------------------------
$cache = array();
//-----------------------------------------
// Get calendars
//-----------------------------------------
$this->DB->build( array(
'select' => 'c.*',
'from' => array( 'cal_calendars' => 'c' ),
'order' => 'c.cal_position ASC',
'add_join' => array(
array(
'select' => 'p.*',
'from' => array( 'permission_index' => 'p' ),
'where' => "p.perm_type='calendar' AND p.perm_type_id=c.cal_id",
'type' => 'left',
)
)
) );
$this->DB->execute();
while( $r = $this->DB->fetch() )
{
$cache[ $r['cal_id'] ] = $r;
}
//-----------------------------------------
// Save cache and return
//-----------------------------------------
$this->cache->setCache( 'calendars', $cache, array( 'array' => 1 ) );
return TRUE;
}
}
@@ -0,0 +1,13 @@
<?php
/**
* @file defaultSection.php Define the default section for the 'calendar' module
*~TERABYTE_DOC_READY~
* $Copyright: (c) 2001 - 2011 Invision Power Services, Inc.$
* $License: http://www.invisionpower.com/company/standards.php#license$
* $Author: ips_terabyte $
* $LastChangedDate: 2011-05-05 12:40:49 -0400 (Thu, 05 May 2011) $
* @version v3.4.5
* $Revision: 8655 $
*/
$DEFAULT_SECTION = 'calendars';
@@ -0,0 +1,10 @@
<html>
<head><title>IP.Board - Bulletin Board System</title></head>
<body>
<h1>403: IP.Board -&gt; Forbidden</h1>
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
</html>
@@ -0,0 +1,10 @@
<html>
<head><title>IP.Board - Bulletin Board System</title></head>
<body>
<h1>403: IP.Board -&gt; Forbidden</h1>
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
</html>
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<menu>
<tabitems>
<item>
<title>Calendar Management</title>
<subitems>
<subitem>
<subitemtitle>Calendar Management</subitemtitle>
<subitemlang>calendars</subitemlang>
<subsection>calendars</subsection>
<subitemurl>do=overview</subitemurl>
<subitemrolekey></subitemrolekey>
<subisredirect>0</subisredirect>
</subitem>
</subitems>
</item>
</tabitems>
</menu>
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<permissions>
<group>
<grouptitle>Calendar Management</grouptitle>
<grouplang>calendar_mt</grouplang>
<items>
<item>
<key>calendar_manage</key>
<string>Can add/edit calendars?</string>
</item>
<item>
<key>calendar_delete</key>
<string>Can delete calendars?</string>
</item>
</items>
</group>
</permissions>
@@ -0,0 +1,13 @@
<?php
/**
* @file defaultSection.php Define the default section for the 'icalendar' module
*~TERABYTE_DOC_READY~
* $Copyright: (c) 2001 - 2011 Invision Power Services, Inc.$
* $License: http://www.invisionpower.com/company/standards.php#license$
* $Author: ips_terabyte $
* $LastChangedDate: 2011-05-05 12:40:49 -0400 (Thu, 05 May 2011) $
* @version v3.4.5
* $Revision: 8655 $
*/
$DEFAULT_SECTION = 'ical';
@@ -0,0 +1,571 @@
<?php
/**
* @file ical.php Management of iCalendar feed imports
*~TERABYTE_DOC_READY~
* $Copyright: (c) 2001 - 2011 Invision Power Services, Inc.$
* $License: http://www.invisionpower.com/company/standards.php#license$
* $Author: ips_terabyte $
* @since Feb 8th 2011
* $LastChangedDate: 2012-01-06 06:20:45 -0500 (Fri, 06 Jan 2012) $
* @version v3.4.5
* $Revision: 10095 $
*/
if ( ! defined( 'IN_ACP' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
exit();
}
/**
*
* @class admin_calendar_icalendar_ical
* @brief Management of iCalendar feed imports
*
*/
class admin_calendar_icalendar_ical extends ipsCommand
{
/**
* Skin file
*
* @var $html
*/
public $html;
/**
* Calendar functions
*
* @var object
*/
protected $functions;
/**
* Main execution method
*
* @param object $registry ipsRegistry reference
* @return @e void
*/
public function doExecute( ipsRegistry $registry )
{
//-----------------------------------------
// Init
//-----------------------------------------
$this->html = $this->registry->output->loadTemplate( 'cp_skin_calendar' );
$this->html->form_code = 'module=icalendar&amp;section=ical';
$this->html->form_code_js = 'module=icalendar&section=ical';
$this->lang->loadLanguageFile( array( 'admin_calendar' ) );
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'calendar_ical' );
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'calendar' ) . "/sources/functions.php", 'app_calendar_classes_functions', 'calendar' );
$this->functions = new $classToLoad( $this->registry, true );
//-----------------------------------------
// What are we doing
//-----------------------------------------
switch( $this->request['do'] )
{
case 'delete':
$this->deleteFeed();
break;
case 'add':
$this->feedForm( 'add' );
break;
case 'doadd':
$this->feedSave( 'add' );
break;
case 'edit':
$this->feedForm( 'edit' );
break;
case 'doedit':
$this->feedSave( 'edit' );
break;
case 'import':
$this->importIcsFile();
break;
case 'recache':
$this->recacheFeed( intval($this->request['id']) );
break;
case 'list':
default:
$this->listFeeds();
break;
}
//-----------------------------------------
// Output
//-----------------------------------------
$this->registry->output->html_main .= $this->registry->output->global_template->global_frame_wrapper();
$this->registry->output->sendOutput();
}
/**
* Delete a feed import
*
* @return @e void
*/
public function deleteFeed()
{
//-----------------------------------------
// Init
//-----------------------------------------
$id = intval( $this->request['id'] );
if ( ! $id )
{
$this->registry->output->global_message = $this->lang->words['feed_noiddel'];
$this->listFeeds();
return;
}
$feed = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'cal_import_feeds', 'where' => 'feed_id=' . $id ) );
if ( ! $feed['feed_id'] )
{
$this->registry->output->global_message = $this->lang->words['feed_noiddel'];
$this->listFeeds();
return;
}
//-----------------------------------------
// Delete just the feed, or all events as well?
//-----------------------------------------
if( !$this->request['confirm'] )
{
$this->registry->output->html .= $this->html->deleteConfirm( $feed );
return;
}
//-----------------------------------------
// Deleting all events too?
//-----------------------------------------
if( $this->request['delete_events'] )
{
$_eventIds = array();
$this->DB->build( array( 'select' => 'import_event_id', 'from' => 'cal_import_map', 'where' => 'import_feed_id=' . $id ) );
$this->DB->execute();
while( $r = $this->DB->fetch() )
{
$_eventIds[] = $r['import_event_id'];
}
if( count($_eventIds) )
{
$this->DB->delete( 'cal_events', 'event_id IN(' . implode( ',', $_eventIds ) . ')' );
$this->DB->delete( 'cal_event_comments', 'comment_eid IN(' . implode( ',', $_eventIds ) . ')' );
$this->DB->delete( 'cal_event_ratings', 'rating_eid IN(' . implode( ',', $_eventIds ) . ')' );
$this->DB->delete( 'cal_event_rsvp', 'rsvp_event_id IN(' . implode( ',', $_eventIds ) . ')' );
}
}
//-----------------------------------------
// Delete
//-----------------------------------------
$this->DB->delete( 'cal_import_feeds', 'feed_id=' . $id );
$this->DB->delete( 'cal_import_map', 'import_feed_id=' . $id );
//-----------------------------------------
// Redirect
//-----------------------------------------
$this->registry->output->global_message = $this->lang->words['feed_importremoved'];
$this->listFeeds();
}
/**
* Save the added/edited feed
*
* @param string $type Either add or edit
* @return @e void
*/
public function feedSave( $type='add' )
{
//-----------------------------------------
// Init
//-----------------------------------------
$id = intval( $this->request['id'] );
//-----------------------------------------
// Error checking
//-----------------------------------------
if ( $type == 'edit' )
{
if ( ! $id )
{
$this->registry->output->global_message = $this->lang->words['feed_notfoundedit'];
$this->listFeeds();
return;
}
$feed = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'cal_import_feeds', 'where' => 'feed_id=' . $id ) );
if ( ! $feed['feed_id'] )
{
$this->registry->output->global_message = $this->lang->words['feed_notfoundedit'];
$this->listFeeds();
return;
}
}
//-----------------------------------------
// Check member
//-----------------------------------------
$memberName = trim($this->request['feed_member_id']);
$member = $this->DB->buildAndFetch( array( 'select' => 'member_id, name', 'from' => 'members', 'where' => "members_l_display_name='" . $this->DB->addSlashes( strtolower( $memberName ) ) . "'" ) );
if( !$member['member_id'] )
{
$this->registry->output->showError( $this->lang->words['feed_importicsmme'], 1149 );
}
//-----------------------------------------
// Format for DB update
//-----------------------------------------
$array = array( 'feed_title' => trim($this->request['feed_title']),
'feed_url' => trim($this->request['feed_url']),
'feed_recache_freq' => intval($this->request['feed_recache_freq']),
'feed_calendar_id' => intval($this->request['feed_calendar_id']),
'feed_member_id' => $member['member_id'],
);
if( $array['feed_recache_freq'] < 60 )
{
$array['feed_recache_freq'] = 60;
}
if( !in_array( substr( $array['feed_url'], 0, strpos( $array['feed_url'], '://' ) ), array( 'http', 'https', 'webcal' ) ) )
{
$this->registry->output->showError( $this->lang->words['invalid_feed_url'], 1141 );
}
if( !$array['feed_title'] )
{
$this->registry->output->showError( $this->lang->words['no_feed_title'], 1142 );
}
//-----------------------------------------
// Insert or update
//-----------------------------------------
if ( $type == 'add' )
{
$array['feed_added'] = time();
$this->DB->insert( 'cal_import_feeds', $array );
$id = $this->DB->getInsertId();
$this->registry->output->global_message = $this->lang->words['feed_added'];
}
else
{
$this->DB->update( 'cal_import_feeds', $array, 'feed_id=' . $id );
$this->registry->output->global_message = $this->lang->words['feed_updated'];
}
//-----------------------------------------
// Rebuild caches
//-----------------------------------------
$this->recacheFeed( $id, true );
$this->listFeeds();
}
/**
* Show form to add/edit a feed import
*
* @param string $type Either add or edit
* @return @e void
*/
public function feedForm( $type='add' )
{
//-----------------------------------------
// Init
//-----------------------------------------
$id = intval( $this->request['id'] );
$form = array();
//-----------------------------------------
// Defaults
//-----------------------------------------
if ( $type == 'add' )
{
$formcode = 'doadd';
$title = $this->lang->words['feed_addnewtext'];
$button = $this->lang->words['feed_addnewtext'];
$feed = array(
'feed_title' => '',
'feed_url' => '',
'feed_recache_freq' => 60,
'feed_id' => 0,
'feed_calendar_id' => 0,
'feed_member_id' => $this->memberData['member_id'],
);
}
else
{
if( !$id )
{
$this->registry->output->global_message = $this->lang->words['feed_notfoundedit'];
$this->listFeeds();
return;
}
$feed = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'cal_import_feeds', 'where' => 'feed_id=' . $id ) );
if ( ! $feed['feed_id'] )
{
$this->registry->output->global_message = $this->lang->words['feed_notfoundedit'];
$this->listFeeds();
return;
}
$formcode = 'doedit';
$title = $this->lang->words['feed_edit_title'] . ' ' . $feed['feed_title'];
$button = $this->lang->words['feed_editbutton'];
}
//-----------------------------------------
// Form elements
//-----------------------------------------
$_member = IPSMember::load( $feed['feed_member_id'] );
$form['feed_title'] = $this->registry->output->formInput( 'feed_title' , !empty( $_POST['feed_title'] ) ? $_POST['feed_title'] : $feed['feed_title'] );
$form['feed_url'] = $this->registry->output->formInput( 'feed_url' , !empty( $this->request['feed_url'] ) ? $this->request['feed_url'] : $feed['feed_url'] );
$form['feed_member_id'] = $this->registry->output->formInput( 'feed_member_id' , !empty( $this->request['feed_member_id'] ) ? $this->request['feed_member_id'] : $_member['members_display_name'] );
$form['feed_recache_freq'] = $this->registry->output->formSimpleInput( 'feed_recache_freq' , !empty( $this->request['feed_recache_freq'] ) ? $this->request['feed_recache_freq'] : $feed['feed_recache_freq'] );
$calendars = $this->functions->getCalendars();
$_calendars = array();
foreach( $calendars as $_cal )
{
$_calendars[] = array( $_cal['cal_id'], $_cal['cal_title'] );
}
$form['feed_calendar_id'] = $this->registry->output->formDropdown( 'feed_calendar_id' , $_calendars, !empty( $this->request['feed_calendar_id'] ) ? $this->request['feed_calendar_id'] : $feed['feed_calendar_id'] );
//-----------------------------------------
// Output
//-----------------------------------------
$this->registry->output->html .= $this->html->feedForm( $form, $title, $formcode, $button, $feed );
}
/**
* List feeds
*
* @return @e void
*/
public function listFeeds()
{
//-----------------------------------------
// Init
//-----------------------------------------
$feeds = array();
//-----------------------------------------
// Get feeds
//-----------------------------------------
$this->DB->build( array( 'select' => '*', 'from' => 'cal_import_feeds' ) );
$this->DB->execute();
while( $r = $this->DB->fetch() )
{
$feeds[] = $r;
}
//-----------------------------------------
// Output
//-----------------------------------------
$this->registry->output->html .= $this->html->feedsList( $feeds, $this->functions->getCalendars() );
}
/**
* Reimport a feed
*
* @param int $id Specify which feed to reimport
* @param bool $return Whether to return (false will result in a redirect back to feeds list)
* @return @e mixed
*/
public function recacheFeed( $id, $return=false )
{
//-----------------------------------------
// Init
//-----------------------------------------
if( !$id )
{
if( $return )
{
return false;
}
else
{
$this->registry->output->global_message = $this->lang->words['feed_notfoundrecache'];
$this->listFeeds();
return;
}
}
$feed = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'cal_import_feeds', 'where' => 'feed_id=' . $id ) );
if ( ! $feed['feed_id'] )
{
$this->registry->output->global_message = $this->lang->words['feed_notfoundrecache'];
$this->listFeeds();
return;
}
//-----------------------------------------
// Fetch the feed
//-----------------------------------------
$classToLoad = IPSLib::loadLibrary( IPS_KERNEL_PATH . 'classFileManagement.php', 'classFileManagement' );
$fetcher = new $classToLoad();
$content = $fetcher->getFileContents( str_replace( 'webcal://', 'http://', $feed['feed_url'] ) );
if( !$content )
{
$this->registry->output->global_message = $this->lang->words['feed_importwcalnone'];
$this->listFeeds();
return;
}
//-----------------------------------------
// Send content to be processed
//-----------------------------------------
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir('calendar') . '/sources/icalendar.php', 'app_calendar_classes_icalendarOutput', 'calendar' );
$ical = new $classToLoad( $this->registry, $feed['feed_calendar_id'] );
$result = $ical->import( $content, $feed['feed_member_id'], $feed['feed_id'] );
//-----------------------------------------
// Show error if any
//-----------------------------------------
if( $error = $ical->getError() )
{
if( $return )
{
return false;
}
else
{
$this->registry->output->showError( $error, 1144 );
}
}
//-----------------------------------------
// Update last update date and next run date
//-----------------------------------------
$this->DB->update( 'cal_import_feeds', array( 'feed_lastupdated' => time(), 'feed_next_run' => time() + ( $feed['feed_recache_freq'] * 60 ) ), 'feed_id=' . $id );
//-----------------------------------------
// Show success message/redirect
//-----------------------------------------
if( $return )
{
return true;
}
else
{
$this->registry->output->global_message = sprintf( $this->lang->words['feed_successwebcal'], $result['skipped'], $result['imported'] );
$this->registry->output->silentRedirectWithMessage( $this->settings['base_url'] . $this->html->form_code );
}
}
/**
* Import an .ics file
*
* @return @e void
*/
public function importIcsFile()
{
//-----------------------------------------
// Get upload content
//-----------------------------------------
$content = $this->registry->getClass('adminFunctions')->importXml();
if( !$content )
{
$this->registry->output->global_message = $this->lang->words['feed_importicsnone'];
$this->listFeeds();
return;
}
//-----------------------------------------
// Get member
//-----------------------------------------
$memberName = trim($this->request['member_name']);
$member = $this->DB->buildAndFetch( array( 'select' => 'member_id, name', 'from' => 'members', 'where' => "members_l_display_name='" . $this->DB->addSlashes( strtolower( $memberName ) ) . "'" ) );
if( !$member['member_id'] )
{
$this->registry->output->global_message = $this->lang->words['feed_importicsmme'];
$this->listFeeds();
return;
}
//-----------------------------------------
// Send content to be processed
//-----------------------------------------
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir('calendar') . '/sources/icalendar.php', 'app_calendar_classes_icalendarOutput', 'calendar' );
$ical = new $classToLoad( $this->registry, intval($this->request['calendar_id']) );
$result = $ical->import( $content, $member['member_id'] );
//-----------------------------------------
// Show error if any
//-----------------------------------------
if( $error = $ical->getError() )
{
$this->registry->output->showError( $error, 1143 );
}
//-----------------------------------------
// Show success message/redirect
//-----------------------------------------
$this->registry->output->global_message = sprintf( $this->lang->words['feed_successimport'], $result['skipped'], $result['imported'] );
$this->registry->output->silentRedirectWithMessage( $this->settings['base_url'] . $this->html->form_code );
}
}
@@ -0,0 +1,10 @@
<html>
<head><title>IP.Board - Bulletin Board System</title></head>
<body>
<h1>403: IP.Board -&gt; Forbidden</h1>
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
</html>
@@ -0,0 +1,10 @@
<html>
<head><title>IP.Board - Bulletin Board System</title></head>
<body>
<h1>403: IP.Board -&gt; Forbidden</h1>
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
</html>
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<menu>
<tabitems>
<item>
<title>Import iCalendar Feeds</title>
<subitems>
<subitem>
<subitemtitle>Import iCalendar Feeds</subitemtitle>
<subitemlang>icalendar</subitemlang>
<subsection>ical</subsection>
<subitemurl></subitemurl>
<subitemrolekey></subitemrolekey>
<subisredirect>0</subisredirect>
</subitem>
</subitems>
</item>
</tabitems>
</menu>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<permissions>
<group>
<grouptitle>Import iCalendar Feeds</grouptitle>
<grouplang>calendar_import</grouplang>
<items>
<item>
<key>calendar_ical</key>
<string>Can import ical and webcal feeds?</string>
</item>
</items>
</group>
</permissions>
@@ -0,0 +1,10 @@
<html>
<head><title>IP.Board - Bulletin Board System</title></head>
<body>
<h1>403: IP.Board -&gt; Forbidden</h1>
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
</html>
@@ -0,0 +1,13 @@
<?php
/**
* @file defaultSection.php Define the default section for the 'settings' module
*~TERABYTE_DOC_READY~
* $Copyright: (c) 2001 - 2011 Invision Power Services, Inc.$
* $License: http://www.invisionpower.com/company/standards.php#license$
* $Author: ips_terabyte $
* $LastChangedDate: 2011-05-05 12:40:49 -0400 (Thu, 05 May 2011) $
* @version v3.4.5
* $Revision: 8655 $
*/
$DEFAULT_SECTION = 'settings';
@@ -0,0 +1,10 @@
<html>
<head><title>IP.Board - Bulletin Board System</title></head>
<body>
<h1>403: IP.Board -&gt; Forbidden</h1>
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionpower.com/">IP.Board</a>
</body>
</html>
@@ -0,0 +1,85 @@
<?php
/**
* @file settings.php Control calendar settings
* $Copyright: (c) 2001 - 2011 Invision Power Services, Inc.$
* $License: http://www.invisionpower.com/company/standards.php#license$
* $Author: ips_terabyte $
* @since March 24 2011
* $LastChangedDate: 2012-01-06 06:20:45 -0500 (Fri, 06 Jan 2012) $
* @version v3.4.5
* $Revision: 10095 $
*/
if ( ! defined( 'IN_ACP' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
exit();
}
/**
*
* @class admin_calendar_settings_settings
* @brief Control calendar settings
*
*/
class admin_calendar_settings_settings extends ipsCommand
{
/**
* Shortcut for url
*
* @access protected
* @var string URL shortcut
*/
protected $form_code;
/**
* Shortcut for url (javascript)
*
* @access protected
* @var string JS URL shortcut
*/
protected $form_code_js;
/**
* Main class entry point
*
* @access public
* @param object ipsRegistry reference
* @return @e void [Outputs to screen]
*/
public function doExecute( ipsRegistry $registry )
{
//-----------------------------------------
// Set up stuff
//-----------------------------------------
$this->form_code = 'module=settings&amp;section=settings';
$this->form_code_js = 'module=settings&section=settings';
//-------------------------------
// Grab, init and load settings
//-------------------------------
$classToLoad = IPSLib::loadActionOverloader( IPSLib::getAppDir('core') . '/modules_admin/settings/settings.php', 'admin_core_settings_settings' );
$settings = new $classToLoad( $this->registry );
$settings->makeRegistryShortcuts( $this->registry );
ipsRegistry::getClass('class_localization')->loadLanguageFile( array( 'admin_tools' ), 'core' );
$settings->html = $this->registry->output->loadTemplate( 'cp_skin_settings', 'core' );
$settings->form_code = $settings->html->form_code = 'module=settings&amp;section=settings';
$settings->form_code_js = $settings->html->form_code_js = 'module=settings&section=settings';
$this->request['conf_title_keyword'] = 'calendar';
$settings->return_after_save = $this->settings['base_url'] . $this->form_code;
$settings->_viewSettings();
//-----------------------------------------
// Pass to CP output hander
//-----------------------------------------
$this->registry->getClass('output')->html_main .= $this->registry->getClass('output')->global_template->global_frame_wrapper();
$this->registry->getClass('output')->sendOutput();
}
}
@@ -0,0 +1,10 @@
<html>
<head><title>IP.Board - Bulletin Board System</title></head>
<body>
<h1>403: IP.Board -&gt; Forbidden</h1>
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
</html>
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<menu>
<tabitems>
<item>
<title>Calendar Settings</title>
<subitems>
<subitem>
<subitemtitle>Calendar Settings</subitemtitle>
<subitemlang>cal_settings</subitemlang>
<subsection>settings</subsection>
<subitemurl></subitemurl>
<subitemrolekey></subitemrolekey>
<subisredirect>0</subisredirect>
</subitem>
</subitems>
</item>
</tabitems>
</menu>
@@ -0,0 +1,13 @@
<?php
/**
* @file defaultSection.php Define the default section for the 'ajax' module
*~TERABYTE_DOC_READY~
* $Copyright: (c) 2001 - 2011 Invision Power Services, Inc.$
* $License: http://www.invisionpower.com/company/standards.php#license$
* $Author: ips_terabyte $
* $LastChangedDate: 2011-05-05 12:40:49 -0400 (Thu, 05 May 2011) $
* @version v3.4.5
* $Revision: 8655 $
*/
$DEFAULT_SECTION = 'rating';
@@ -0,0 +1,10 @@
<html>
<head><title>IP.Board - Bulletin Board System</title></head>
<body>
<h1>403: IP.Board -&gt; Forbidden</h1>
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
</html>
@@ -0,0 +1,196 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.4.5
* Add rating AJAX
* Last Updated: $Date: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
* </pre>
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Calendar
* @link http://www.invisionpower.com
* @since 25th January 2011
* @version $Revision: 10721 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class public_calendar_ajax_rating extends ipsAjaxCommand
{
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return @e void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry )
{
//-----------------------------------------
// INIT
//-----------------------------------------
$event_id = intval($this->request['event_id']);
$rating_id = intval($this->request['rating']);
$this->registry->class_localization->loadLanguageFile( array( 'public_calendar' ) );
//-----------------------------------------
// Functions class
//-----------------------------------------
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'calendar' ) . "/sources/functions.php", 'app_calendar_classes_functions', 'calendar' );
$functions = new $classToLoad( $this->registry );
//-----------------------------------------
// Get data
//-----------------------------------------
if ( ! $event_id )
{
$this->returnJsonArray( array( 'error_key' => 'topics_no_tid', 'error_code' => '104101.1' ) );
}
$event = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'cal_events', 'where' => 'event_id=' . $event_id ) );
if( !$event['event_id'] )
{
$this->returnJsonArray( array( 'error_key' => 'topics_no_tid', 'error_code' => '104102.1' ) );
}
//-----------------------------------------
// Check permissions
//-----------------------------------------
if( !$event['event_approved'] )
{
$this->returnJsonArray( array( 'error_key' => 'topics_no_tid', 'error_code' => '104103.1' ) );
}
if( $event['event_private'] )
{
if( ! $this->memberData['member_id'] OR $this->memberData['member_id'] != $event['event_member_id'] )
{
$this->returnJsonArray( array( 'error_key' => 'topics_no_tid', 'error_code' => '104104.1' ) );
}
}
if( $event['event_perms'] != '*' )
{
$permissionGroups = explode( ',', IPSText::cleanPermString( $event['event_perms'] ) );
if( !IPSMember::isInGroup( $this->memberData, $permissionGroups ) )
{
$this->returnJsonArray( array( 'error_key' => 'topics_no_tid', 'error_code' => '104105.1' ) );
}
}
//-----------------------------------------
// Get our calendar
//-----------------------------------------
$calendar = $functions->getCalendar( $event['event_calendar_id'] );
if( !$calendar['cal_id'] OR $calendar['cal_id'] != $event['event_calendar_id'] )
{
$this->returnJsonArray( array( 'error_key' => 'topics_no_tid', 'error_code' => '104106.1' ) );
}
//-----------------------------------------
// Can we rate?
//-----------------------------------------
$_can_rate = ( $this->memberData['member_id'] AND $this->registry->permissions->check( 'rate', $calendar ) ) ? intval( $this->memberData['g_topic_rate_setting'] ) : 0;
if ( ! $_can_rate )
{
$this->returnJsonArray( array( 'error_key' => 'topic_rate_no_perm', 'error_code' => '104107.1' ) );
}
//-----------------------------------------
// Sneaky members rating more than 5?
//-----------------------------------------
if( $rating_id > 5 )
{
$rating_id = 5;
}
if( $rating_id < 0 )
{
$rating_id = 0;
}
//-----------------------------------------
// Have we rated before?
//-----------------------------------------
$rating = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'cal_event_ratings', 'where' => "rating_eid={$event['event_id']} and rating_member_id=" . $this->memberData['member_id'] ) );
if ( $rating['rating_id'] )
{
//-----------------------------------------
// Do we allow re-ratings?
//-----------------------------------------
if ( $this->memberData['g_topic_rate_setting'] == 2 )
{
if ( $rating_id != $rating['rating_value'] )
{
$new_rating = $rating_id - $rating['rating_value'];
$this->DB->update( 'cal_event_ratings', array( 'rating_value' => $rating_id ), 'rating_id=' . $rating['rating_id'] );
$this->DB->update( 'topics', array(
'event_rating_total' => intval($event['event_rating_total']) + $new_rating,
'event_rating_avg' => round( ( intval($event['event_rating_total']) + $new_rating ) / $event['event_rating_hits'] )
), 'event_id=' . $event['event_id'] );
}
$this->returnJsonArray( array(
'rated' => 'update',
'message' => $this->lang->words['event_rating_changed'],
'topic_rating_total' => intval($event['event_rating_total']) + $new_rating,
'topic_rating_hits' => $event['event_rating_hits']
) );
}
else
{
$this->returnJsonArray( array( 'error_key' => 'topic_rated_already', 'error_code' => 0 ) );
}
}
else
{
$this->DB->insert( 'cal_event_ratings', array(
'rating_eid' => $event['event_id'],
'rating_member_id' => $this->memberData['member_id'],
'rating_value' => $rating_id,
'rating_ip_address' => $this->member->ip_address,
) );
$this->DB->update( 'cal_events', array(
'event_rating_total' => intval( $event['event_rating_total'] ) + $rating_id,
'event_rating_hits' => intval( $event['event_rating_hits'] ) + 1,
'event_rating_avg' => round( ( intval( $event['event_rating_total'] ) + $rating_id ) / ( intval( $event['event_rating_hits'] ) + 1 ) ),
), 'event_id=' . $event_id );
$this->returnJsonArray( array(
'rated' => 'new',
'message' => $this->lang->words['event_rating_done'],
'topic_rating_total' => intval( $event['event_rating_total'] ) + $rating_id,
'topic_rating_hits' => intval( $event['event_rating_hits'] ) + 1,
'_rate_int' => round( ( intval( $event['event_rating_total'] ) + $rating_id ) / ( intval( $event['event_rating_hits'] ) + 1 ) )
) );
}
}
}
@@ -0,0 +1,146 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.4.5
* RSVP for event
* Last Updated: $Date: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
* </pre>
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Calendar
* @link http://www.invisionpower.com
* @since 25th January 2011
* @version $Revision: 10721 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class public_calendar_ajax_rsvp extends ipsAjaxCommand
{
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return @e void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry )
{
//-----------------------------------------
// INIT
//-----------------------------------------
$event_id = intval($this->request['event_id']);
$this->registry->class_localization->loadLanguageFile( array( 'public_calendar' ) );
//-----------------------------------------
// Functions class
//-----------------------------------------
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'calendar' ) . "/sources/functions.php", 'app_calendar_classes_functions', 'calendar' );
$functions = new $classToLoad( $this->registry );
//-----------------------------------------
// Get data
//-----------------------------------------
if ( ! $event_id )
{
$this->returnJsonError( $this->lang->words['rsvp__no_event'] );
}
$event = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'cal_events', 'where' => 'event_id=' . $event_id ) );
if( !$event['event_id'] )
{
$this->returnJsonError( $this->lang->words['rsvp__no_event'] );
}
//-----------------------------------------
// Check permissions
//-----------------------------------------
if( !$event['event_approved'] )
{
$this->returnJsonError( $this->lang->words['rsvp__no_event'] );
}
if( $event['event_private'] )
{
if( ! $this->memberData['member_id'] OR $this->memberData['member_id'] != $event['event_member_id'] )
{
$this->returnJsonError( $this->lang->words['rsvp__no_event'] );
}
}
if( $event['event_perms'] != '*' )
{
$permissionGroups = explode( ',', IPSText::cleanPermString( $event['event_perms'] ) );
if( !IPSMember::isInGroup( $this->memberData, $permissionGroups ) )
{
$this->returnJsonError( $this->lang->words['rsvp__no_event'] );
}
}
//-----------------------------------------
// Get our calendar
//-----------------------------------------
$calendar = $functions->getCalendar( $event['event_calendar_id'] );
if( !$calendar['cal_id'] OR $calendar['cal_id'] != $event['event_calendar_id'] )
{
$this->returnJsonError( $this->lang->words['rsvp__no_event'] );
}
//-----------------------------------------
// Can we RSVP?
//-----------------------------------------
$_can_rsvp = ( $this->memberData['member_id'] AND $this->registry->permissions->check( 'rsvp', $calendar ) AND $event['event_rsvp'] ) ? 1 : 0;
if ( ! $_can_rsvp )
{
$this->returnJsonError( $this->lang->words['rsvp__no_perm'] );
}
//-----------------------------------------
// Have we already RSVP?
//-----------------------------------------
$_check = $this->DB->buildAndFetch( array( 'select' => 'rsvp_id', 'from' => 'cal_event_rsvp', 'where' => 'rsvp_event_id=' . $event['event_id'] . ' AND rsvp_member_id=' . $this->memberData['member_id'] ) );
if( $_check['rsvp_id'] )
{
$this->returnJsonError( $this->lang->words['rsvp__already_rsvp'] );
}
//-----------------------------------------
// Store RSVP
//-----------------------------------------
$_insert = array(
'rsvp_event_id' => $event['event_id'],
'rsvp_member_id' => $this->memberData['member_id'],
'rsvp_date' => time(),
);
$this->DB->insert( 'cal_event_rsvp', $_insert );
$rsvp_id = $this->DB->getInsertId();
$this->returnJsonArray( array( 'html' => $this->registry->output->getTemplate( 'calendar' )->eventAttendee( array_merge( array( 'rsvp_id' => $rsvp_id, 'rsvp_date' => time() ), $this->memberData ), $event ) ) );
}
}
@@ -0,0 +1,13 @@
<?php
/**
* @file defaultSection.php Define the default section for the 'calendar' module
*~TERABYTE_DOC_READY~
* $Copyright: (c) 2001 - 2011 Invision Power Services, Inc.$
* $License: http://www.invisionpower.com/company/standards.php#license$
* $Author: ips_terabyte $
* $LastChangedDate: 2011-05-05 12:40:49 -0400 (Thu, 05 May 2011) $
* @version v3.4.5
* $Revision: 8655 $
*/
$DEFAULT_SECTION = 'view';
@@ -0,0 +1,10 @@
<html>
<head><title>IP.Board - Bulletin Board System</title></head>
<body>
<h1>403: IP.Board -&gt; Forbidden</h1>
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
</html>
@@ -0,0 +1,322 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.4.5
* Calendar View
* Last Updated: $Date: 2013-02-08 20:52:39 -0500 (Fri, 08 Feb 2013) $
* </pre>
*
* @author $Author: AndyMillne $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Calendar
* @link http://www.invisionpower.com
* @version $Rev: 11970 $
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class public_calendar_calendar_moderate extends ipsCommand
{
/**
* Calendar data
*
* @var array
*/
protected $calendar = array();
/**
* Calendar functions
*
* @var object
*/
protected $functions;
/**
* Class entry point
*
* @param object Registry reference
* @return @e void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry )
{
//-----------------------------------------
// Init
//-----------------------------------------
$this->registry->class_localization->loadLanguageFile( array( 'public_calendar' ), 'calendar' );
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'calendar' ) . "/sources/functions.php", 'app_calendar_classes_functions', 'calendar' );
$this->functions = new $classToLoad( $this->registry );
$this->calendar = $this->functions->getCalendar();
//-----------------------------------------
// Switch
//-----------------------------------------
switch( $this->request['do'] )
{
case 'calendarEventApprove':
$this->calendarEventApprove();
break;
case 'delete':
$this->calendarEventDelete();
break;
case 'calendarRSVPRemove':
$this->removeRSVPAttendee();
break;
}
}
/**
* Deletes an attendee from RSVP list
*
* @return @e void
*/
public function removeRSVPAttendee()
{
//-----------------------------------------
// Init
//-----------------------------------------
$event_id = intval( $this->request['event_id'] );
$rsvp_id = intval( $this->request['attendee_id'] );
$md5check = trim( $this->request['md5check'] );
if ( !$event_id OR !$rsvp_id )
{
$this->registry->output->showError( 'attendee_bad_delete', 1043.1, null, null, 404 );
}
if ( $md5check != $this->member->form_hash )
{
$this->registry->output->showError( 'calendar_bad_key', 2040.1, null, null, 403 );
}
//-----------------------------------------
// Get event and check permissions
//-----------------------------------------
$event = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'cal_events', 'where' => "event_id=" . $event_id . " AND event_calendar_id=" . $this->calendar['cal_id'] ) );
$rsvp = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'cal_event_rsvp', 'where' => 'rsvp_id=' . $rsvp_id ) );
if ( ! $this->memberData['g_is_supmod'] )
{
if( !$this->calendar['cal_rsvp_owner'] OR !$this->memberData['member_id'] OR ( $this->memberData['member_id'] != $event['event_member_id'] AND $this->memberData['member_id'] != $rsvp['rsvp_member_id'] ) )
{
$this->registry->output->showError( 'calendar_delete_no_perm', 1042.1, null, null, 403 );
}
}
//-----------------------------------------
// Delete attendee
//-----------------------------------------
$this->DB->delete( 'cal_event_rsvp', 'rsvp_id=' . $rsvp_id );
//-----------------------------------------
// Redirect
//-----------------------------------------
$this->registry->output->redirectScreen( $this->lang->words['cal_event_rsvpdelete'] , $this->settings['base_url'] . "app=calendar&amp;module=calendar&amp;section=view&amp;do=showevent&amp;event_id=" . $event['event_id'], $event['event_title_seo'], 'cal_event' );
}
/**
* Deletes an event from the calendar
*
* @return @e void
*/
public function calendarEventDelete()
{
//-----------------------------------------
// Init
//-----------------------------------------
$event_id = intval( $this->request['event_id'] );
$md5check = trim( $this->request['md5check'] );
if ( !$event_id )
{
$this->registry->output->showError( 'calendar_bad_delete', 1041, null, null, 404 );
}
if ( $md5check != $this->member->form_hash )
{
$this->registry->output->showError( 'calendar_bad_key', 2040, null, null, 403 );
}
//-----------------------------------------
// Get event and check permissions
//-----------------------------------------
$event = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'cal_events', 'where' => "event_id=" . $event_id . " AND event_calendar_id=" . $this->calendar['cal_id'] ) );
if ( ! $this->memberData['g_is_supmod'] )
{
if( !$this->memberData['member_id'] OR $this->memberData['member_id'] != $event['event_member_id'] )
{
$this->registry->output->showError( 'calendar_delete_no_perm', 1042, null, null, 403 );
}
}
//-----------------------------------------
// Delete event
//-----------------------------------------
$this->DB->delete( 'cal_events', 'event_id=' . $event_id );
$this->DB->delete( 'cal_event_ratings', 'rating_eid=' . $event_id );
$this->DB->delete( 'cal_event_comments', 'comment_eid=' . $event_id );
$this->DB->delete( 'cal_event_rsvp', 'rsvp_event_id=' . $event_id );
$this->DB->delete( 'cal_import_map', 'import_event_id=' . $event_id );
//-----------------------------------------
// Delete attachments
//-----------------------------------------
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'core' ) . '/sources/classes/attach/class_attach.php', 'class_attach' );
$class_attach = new $classToLoad( $this->registry );
$class_attach->type = 'event';
$class_attach->init();
$class_attach->bulkRemoveAttachment( array( $event_id ) );
//-----------------------------------------
// Remove likes
//-----------------------------------------
require_once( IPS_ROOT_PATH . 'sources/classes/like/composite.php' );/*noLibHook*/
$_like = classes_like::bootstrap( 'calendar', 'events' );
$_like->remove( $event_id );
//-----------------------------------------
// Recache
//-----------------------------------------
$this->cache->rebuildCache( 'calendar_events', 'calendar' );
//-----------------------------------------
// Redirect
//-----------------------------------------
if ( $this->request['modcp'] == 'unapprovedevents' )
{
$this->registry->output->silentRedirect( $this->settings['base_url'] . 'app=core&module=modcp&fromapp=calendar&tab=unapprovedevents' );
}
else
{
$this->registry->output->redirectScreen( $this->lang->words['cal_event_delete'] , $this->settings['base_url'] . "app=calendar&amp;module=calendar&amp;section=view&amp;cal_id=" . $this->calendar['cal_id'], $this->calendar['cal_title_seo'], 'cal_calendar' );
}
}
/**
* Approves an event
*
* @return @e void
*/
public function calendarEventApprove()
{
//-----------------------------------------
// Init
//-----------------------------------------
$event_id = intval( $this->request['event_id'] );
$md5check = trim( $this->request['md5check'] );
if ( ! $this->memberData['g_is_supmod'] )
{
$this->registry->output->showError( 'calendar_bad_approve', 1043, null, null, 403 );
}
if ( $md5check != $this->member->form_hash )
{
$this->registry->output->showError( 'calendar_bad_key', 2041, null, null, 403 );
}
//-----------------------------------------
// Get event
//-----------------------------------------
$event = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'cal_events', 'where' => "event_id=" . $event_id . " AND event_calendar_id=" . $this->calendar['cal_id'] ) );
if( ! $event['event_id'] )
{
$this->registry->output->showError( 'calendar_event_not_found', 1045, null, null, 404 );
}
//-----------------------------------------
// Event approved?
//-----------------------------------------
$eventApproved = ( $event['event_approved'] ) ? 0 : 1;
//-----------------------------------------
// Update event
//-----------------------------------------
$this->DB->update( 'cal_events', array( 'event_approved' => $event['event_approved'] ? 0 : 1 ), 'event_id=' . $event_id );
//-----------------------------------------
// Hide likes
//-----------------------------------------
require_once( IPS_ROOT_PATH . 'sources/classes/like/composite.php' );/*noLibHook*/
$_like = classes_like::bootstrap( 'calendar', 'events' );
$_like->toggleVisibility( $event_id, $event['event_approved'] ? 0 : 1 );
//-----------------------------------------
// Send notifications if approved
//-----------------------------------------
if ( $eventApproved )
{
require_once( IPS_ROOT_PATH . 'sources/classes/like/composite.php' );/*noLibHook*/
$_like = classes_like::bootstrap( 'calendar', $type == 'edit' ? 'events' : 'calendars' );
$_url = $this->registry->output->buildSEOUrl( 'app=calendar&amp;module=calendar&amp;section=view&amp;do=showevent&amp;event_id=' . $event_id, 'public', $event['event_title_seo'], 'cal_event' );
$_author = IPSMember::load( $event['event_member_id'] );
$_like->sendNotifications( $event['event_calendar_id'], array( 'immediate', 'offline' ),
array(
'notification_key' => 'new_event',
'notification_url' => $_url,
'email_template' => 'add_event_follow',
'email_subject' => sprintf( $this->lang->words[ 'add_event_follow_subject'], $_url, $event['event_title'] ),
'build_message_array' => array(
'NAME' => '-member:members_display_name-',
'AUTHOR' => $_author['members_display_name'],
'TITLE' => $event['event_title'],
'URL' => $_url,
)
) );
}
//-----------------------------------------
// Recache
//-----------------------------------------
$this->cache->rebuildCache( 'calendar_events', 'calendar' );
//-----------------------------------------
// Redirect
//-----------------------------------------
$_dateData = explode( ' ', $event['event_start_date'] );
$_dateBits = explode( '-', $_dateData[0] );
if ( $this->request['modcp'] == 'unapprovedevents' )
{
$this->registry->output->silentRedirect( $this->settings['base_url'] . 'app=core&module=modcp&fromapp=calendar&tab=unapprovedevents' );
}
else
{
$this->registry->output->silentRedirect( $this->settings['base_url'] . "app=calendar&amp;module=calendar&amp;section=view&amp;cal_id={$this->calendar['cal_id']}&amp;do=showday&amp;y={$_dateBits[0]}&amp;m={$_dateBits[1]}&amp;d={$_dateBits[2]}&amp;modfilter={$this->request['modfilter']}", $this->calendar['cal_title_seo'], true, 'cal_day' );
}
}
}
@@ -0,0 +1,921 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.4.5
* Calendar View
* Last Updated: $Date: 2012-10-11 17:27:04 -0400 (Thu, 11 Oct 2012) $
* </pre>
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Calendar
* @link http://www.invisionpower.com
* @version $Rev: 11446 $
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class public_calendar_calendar_post extends ipsCommand
{
/**
* Calendar data
*
* @var array
*/
protected $calendar = array();
/**
* Calendar functions
*
* @var object
*/
protected $functions;
/**
* Class entry point
*
* @param object Registry reference
* @return @e void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry )
{
//-----------------------------------------
// Init
//-----------------------------------------
$this->registry->class_localization->loadLanguageFile( array( 'public_calendar' ), 'calendar' );
$this->registry->class_localization->loadLanguageFile( array( 'public_usercp' ), 'core' );
$this->registry->class_localization->loadLanguageFile( array( 'public_post' ), 'forums' );
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'calendar' ) . "/sources/functions.php", 'app_calendar_classes_functions', 'calendar' );
$this->functions = new $classToLoad( $this->registry );
$this->calendar = $this->functions->getCalendar();
$this->timezone = ( $this->memberData['time_offset'] OR $this->memberData['time_offset'] === '0' OR $this->memberData['time_offset'] === 0 ) ? $this->memberData['time_offset'] : $this->settings['time_offset'];
//-----------------------------------------
// Check permissions
//-----------------------------------------
if ( !$this->memberData['member_id'] )
{
$this->registry->output->showError( 'calendar_no_guests', 1046, null, null, 403 );
}
if ( !$this->registry->permissions->check( 'start', $this->calendar ) )
{
$this->registry->output->showError( 'calendar_no_post_perm', 1047, null, null, 403 );
}
//-----------------------------------------
// Start output stuff
//-----------------------------------------
$this->registry->output->addNavigation( $this->lang->words['cal_page_title'], 'app=calendar', 'false', 'app=calendar' );
$this->registry->output->addNavigation( $this->calendar['cal_title'], "app=calendar&amp;module=calendar&amp;section=view&amp;cal_id={$this->calendar['cal_id']}", $this->calendar['cal_title_seo'], 'cal_calendar' );
//-----------------------------------------
// What are we doing
//-----------------------------------------
switch( $this->request['do'] )
{
case 'newevent':
$this->calendarEventForm( 'add' );
break;
case 'addnewevent':
$this->calendarEventSave( 'add' );
break;
case 'edit':
$this->calendarEventForm( 'edit' );
break;
case 'doedit':
$this->calendarEventSave( 'edit' );
break;
}
//-----------------------------------------
// Output
//-----------------------------------------
$this->registry->output->setTitle( $this->lang->words['cal_page_title'] . ' - ' . $this->settings['board_name'] );
$this->registry->output->addContent( $this->output );
$this->registry->output->sendOutput();
}
/**
* Form for creating/modifying calendar events
*
* @param string $type Either add or edit
* @return @e void
*/
public function calendarEventForm( $type='add' )
{
//-----------------------------------------
// Init
//-----------------------------------------
$event_id = $this->request['event_id'] ? intval( $this->request['event_id'] ) : 0;
$calendar_jump = $this->functions->getCalendarJump( $this->calendar['cal_id'], array( 'start' ) );
$group_select = '';
$allDay = 1;
//-----------------------------------------
// Output stuff
//-----------------------------------------
$this->registry->output->addToDocumentHead( 'javascript', "{$this->settings['js_base_url']}js/3rd_party/calendar_date_select/calendar_date_select.js" );
if( $this->settings['calendar_date_select_locale'] AND $this->settings['calendar_date_select_locale'] != 'en' )
{
$this->registry->output->addToDocumentHead( 'javascript', "{$this->settings['js_base_url']}js/3rd_party/calendar_date_select/locale/{$this->settings['calendar_date_select_locale']}.js" );
}
$this->registry->output->addToDocumentHead( 'javascript', "{$this->settings['js_base_url']}js/3rd_party/calendar_date_select/format_{$this->settings['cal_date_format']}.js" );
$this->registry->output->addToDocumentHead( 'importcss', "{$this->settings['css_base_url']}style_css/{$this->registry->output->skin['_csscacheid']}/calendar_select.css" );
//-----------------------------------------
// Adding or editing?
//-----------------------------------------
if( $type == 'add' )
{
if( $this->timezone )
{
$_offset = ( $this->timezone * 3600 );
}
$nd = $this->request['d'] ? str_pad( $this->request['d'], 2, '0', STR_PAD_LEFT ) : gmstrftime( '%d', time() + $_offset );
$nm = $this->request['m'] ? str_pad( $this->request['m'], 2, '0', STR_PAD_LEFT ) : gmstrftime( '%m', time() + $_offset );
$ny = $this->request['y'] ? $this->request['y'] : gmstrftime( '%Y', time() + $_offset );
$nh = $this->settings['cal_time_format'] == 'standard' ? gmstrftime( '%I', time() + $_offset ) : gmstrftime( '%H', time() + $_offset );
$nmi = '00';
$nap = gmstrftime( '%p', time() + $_offset );
$_fauxEndTime = strtotime( "now + 2 hours" );
$fd = gmstrftime( '%d', $_fauxEndTime + $_offset );
$fm = gmstrftime( '%m', $_fauxEndTime + $_offset );
$fy = gmstrftime( '%Y', $_fauxEndTime + $_offset );
$fh = $this->settings['cal_time_format'] == 'standard' ? gmstrftime( '%I', $_fauxEndTime + $_offset ) : gmstrftime( '%H', $_fauxEndTime + $_offset );
$fmi = '00';
$fap = gmstrftime( '%p', $_fauxEndTime + $_offset );
$_setEndTime = false;
$event = array(
'event_smilies' => 1,
'event_content' => '',
'event_timeset' => '',
'event_recurring' => 0,
'event_id' => 0,
'event_post_key' => $this->request['post_key'] ? $this->request['post_key'] : md5( uniqid( microtime(), true ) ),
);
}
else
{
//-----------------------------------------
// Get event
//-----------------------------------------
if ( !$event_id )
{
$this->registry->output->showError( 'calendar_event_not_found', 1048, null, null, 404 );
}
$event = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'cal_events', 'where' => 'event_id=' . $event_id ) );
if ( !$event['event_id'] )
{
$this->registry->output->showError( 'calendar_event_not_found', 1049, null, null, 404 );
}
//-----------------------------------------
// Check permissions
//-----------------------------------------
if ( $event['event_perms'] != '*' )
{
$permissionGroups = explode( ',', IPSText::cleanPermString( $event['event_perms'] ) );
if( !IPSMember::isInGroup( $this->memberData, $permissionGroups ) )
{
$this->registry->output->showError( 'calendar_event_not_found', 10411, null, null, 404 );
}
}
if ( !$this->memberData['g_is_supmod'] AND $this->memberData['member_id'] != $event['event_member_id'] )
{
$this->registry->output->showError( 'calendar_no_edit_perm', 10410, null, null, 403 );
}
//-----------------------------------------
// Date stuff
//-----------------------------------------
$_eventStart = strtotime( $event['event_start_date'] );
$_eventEnd = ( $event['event_end_date'] AND $event['event_end_date'] != '0000-00-00 00:00:00' ) ? strtotime( $event['event_end_date'] ) : 0;
//-----------------------------------------
// Apply timezone offset for editing user
//-----------------------------------------
if( $this->timezone AND !$event['event_all_day'] )
{
$_eventStart += ( $this->timezone * 3600 );
$_eventEnd = $_eventEnd ? ( $_eventEnd + ( $this->timezone * 3600 ) ) : 0;
}
$_hour = $this->settings['cal_time_format'] == 'standard' ? '%I' : '%H';
list( $nd, $nm, $ny, $nh, $nmi, $nap, $_nh ) = explode( '-', gmstrftime( "%d-%m-%Y-{$_hour}-%M-%p-%H", $_eventStart ) );
if( $_eventEnd )
{
list( $fd, $fm, $fy, $fh, $fmi, $fap ) = explode( '-', gmstrftime( "%d-%m-%Y-{$_hour}-%M-%p", $_eventEnd ) );
$_setEndTime = true;
}
else
{
$fd = $fm = $fy = $fh = $fmi = $fap = 0;
$_setEndTime = false;
}
$allDay = $event['event_all_day'];
}
//-----------------------------------------
// If we are previewing, reset..
//-----------------------------------------
if( $this->request['preview'] )
{
$event['event_title'] = $this->request['event_title'];
$event['event_recurring'] = $this->request['set_recurfields'] ? $this->request['recur_unit'] : 0;
$event['event_private'] = $this->request['e_type'] == 'public' ? 0 : 1;
$event['event_smilies'] = $this->request['event_smilies'];
$event['event_content'] = $_POST['Post'];
$event['event_perms'] = count($this->request['e_groups']) ? implode( ",", $this->request['e_groups'] ) : '*';
$_ndate = $this->request['start_date'];
$_stTime = explode( ':', $this->request['start_time'] );
$nh = $_stTime[0];
$nmi = $_stTime[1];
$nap = $this->request['start_time_ampm'];
$_edate = $this->request['end_date'];
$_etTime = explode( ':', $this->request['end_time'] );
$fh = $_etTime[0];
$fmi = $_etTime[1];
$fap = $this->request['end_time_ampm'];
$allDay = $this->request['all_day'];
$_setEndTime = $this->request['set_enddate'];
$this->timezone = $this->request['event_timezone'];
}
//-----------------------------------------
// Time zone dropdown
//-----------------------------------------
$_timeZoneOptions = '';
foreach( $this->lang->words as $_key => $_word )
{
if( preg_match( "/^time_(-?[\d\.]+)$/", $_key, $match ) )
{
$_timeZoneOptions .= "<option value='{$match[1]}'" . ( $this->timezone == $match[1] ? " selected='selected'" : '' ) . ">{$_word}</option>\n";
}
}
//-----------------------------------------
// Get editor
//-----------------------------------------
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/editor/composite.php', 'classes_editor_composite' );
$editor = new $classToLoad();
//-----------------------------------------
// Build group select menu
//-----------------------------------------
if( $this->memberData['g_access_cp'] )
{
foreach( $this->caches['group_cache'] as $r )
{
$selected = IPSMember::isInGroup( array( 'member_group_id' => $r['g_id'], 'mgroup_others' => '' ), explode( ',', IPSText::cleanPermString( $event['event_perms'] ) ), false ) ? " selected='selected'" : '';
$group_select .= "<option value='" . $r['g_id'] . "'" . $selected . ">" . $r['g_title'] . "</option>\n";
}
}
//-----------------------------------------
// Unparse event content for editing
//-----------------------------------------
if ( $event['event_content'] )
{
$editor->setContent( $event['event_content'], 'calendar' );
}
//-----------------------------------------
// Get attachments class
//-----------------------------------------
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'core' ) . '/sources/classes/attach/class_attach.php', 'class_attach' );
$class_attach = new $classToLoad( $this->registry );
$class_attach->type = 'event';
$class_attach->attach_post_key = $event['event_post_key'];
$class_attach->init();
$class_attach->getUploadFormSettings();
//-----------------------------------------
// Date (formatted based on setting)
//-----------------------------------------
if( !$this->request['preview'] )
{
switch( $this->settings['cal_date_format'] )
{
case 'american':
default:
$_ndate = $nm . '/' . $nd . '/' . $ny;
$_edate = $fm ? $fm . '/' . $fd . '/' . $fy : '';
break;
case 'danish':
$_ndate = $ny . '/' . $nm . '/' . $nd;
$_edate = $fm ? $fy . '/' . $fm . '/' . $fd : '';
break;
case 'italian':
$_ndate = $nd . '/' . $nm . '/' . $ny;
$_edate = $fm ? $fd . '/' . $fm . '/' . $fy : '';
break;
case 'db':
$_ndate = $ny . '-' . $nm . '-' . $nd;
$_edate = $fm ? $fy . '-' . $fm . '-' . $fd : '';
break;
}
}
//-----------------------------------------
// Output
//-----------------------------------------
$this->output .= $this->registry->output->getTemplate( 'calendar' )->calendarEventForm(
array(
'event' => $event,
'calendar' => $this->calendar,
'code' => $type == 'edit' ? 'doedit' : 'addnewevent',
'jump' => $calendar_jump,
'timezone' => $this->timezone,
'_time_zones' => $_timeZoneOptions,
'_can_set_rsvp' => $this->registry->permissions->check( 'askrsvp', $this->calendar ),
'dates' => array(
'nd' => $nd,
'nm' => $nm,
'ny' => $ny,
'nh' => $nh,
'nmi' => $nmi,
'nap' => $nap,
'fd' => $fd,
'fm' => $fm,
'fy' => $fy,
'fh' => $fh,
'fmi' => $fmi,
'fap' => $fap,
'allday' => $allDay,
'enddate' => $_setEndTime,
'ndate' => $_ndate,
'edate' => $_edate,
),
'_groupSelect' => $group_select,
'editor' => $editor->show( 'Post' ),
'button' => $type == 'edit' ? $this->lang->words['calendar_edit_submit'] : $this->lang->words['calendar_submit'],
'uploadForm' => $this->memberData['g_attach_max'] != -1 ?
$this->registry->getClass('output')->getTemplate('post')->uploadForm( $event['event_post_key'], 'event', $class_attach->attach_stats, $event['event_id'], 0 ) :
"",
)
);
$this->registry->output->addNavigation( $this->lang->words['post_new_event'] );
}
/**
* Saves the add/edit calendar event form
*
* @param string $type Either add or edit
* @return @e void
*/
public function calendarEventSave( $type='add' )
{
//-----------------------------------------
// Check permissions
//-----------------------------------------
if ( $this->request['auth_key'] != $this->member->form_hash )
{
$this->registry->output->showError( 'no_permission', 10410, null, null, 403 );
}
if( $this->request['preview'] )
{
return $this->calendarEventForm( $type );
}
//-----------------------------------------
// Init
//-----------------------------------------
$event_id = intval( $this->request['event_id'] );
$calendar_id = intval( $this->request['event_calendar_id'] );
$_calendar = $this->functions->getCalendar( $calendar_id );
$event_title = IPSText::getTextClass( 'bbcode' )->stripBadWords( trim( $this->request['event_title'] ) );
$start_date = '';
$end_date = '';
$recurring = 0;
//-----------------------------------------
// Verify start date/time
//-----------------------------------------
switch( $this->settings['cal_date_format'] )
{
case 'american':
default:
$_startBits = explode( '/', $this->request['start_date'] );
if( $this->request['set_enddate'] )
{
$_endBits = $this->request['end_date'] ? explode( '/', $this->request['end_date'] ) : array();
}
break;
case 'danish':
$_inputStart = explode( '/', $this->request['start_date'] );
$_startBits = array(
0 => $_inputStart[1],
1 => $_inputStart[2],
2 => $_inputStart[0],
);
if( $this->request['set_enddate'] )
{
$_inputEnd = $this->request['end_date'] ? explode( '/', $this->request['end_date'] ) : array();
$_endBits = array(
0 => $_inputEnd[1],
1 => $_inputEnd[2],
2 => $_inputEnd[0],
);
}
break;
case 'italian':
$_inputStart = explode( '/', $this->request['start_date'] );
$_startBits = array(
0 => $_inputStart[1],
1 => $_inputStart[0],
2 => $_inputStart[2],
);
if( $this->request['set_enddate'] )
{
$_inputEnd = $this->request['end_date'] ? explode( '/', $this->request['end_date'] ) : array();
$_endBits = array(
0 => $_inputEnd[1],
1 => $_inputEnd[0],
2 => $_inputEnd[2],
);
}
break;
case 'db':
$_inputStart = explode( '-', $this->request['start_date'] );
$_startBits = array(
0 => $_inputStart[1],
1 => $_inputStart[2],
2 => $_inputStart[0],
);
if( $this->request['set_enddate'] )
{
$_inputEnd = $this->request['end_date'] ? explode( '-', $this->request['end_date'] ) : array();
$_endBits = array(
0 => $_inputEnd[1],
1 => $_inputEnd[2],
2 => $_inputEnd[0],
);
}
break;
}
if( !$this->request['start_date'] OR count($_startBits) != 3 )
{
$this->registry->output->showError( 'calendar_invalid_date', 10427.0 );
}
else if( !@checkdate( $_startBits[0], $_startBits[1], $_startBits[2] ) )
{
$this->registry->output->showError( 'calendar_invalid_date', 10427.1 );
}
if( $this->request['all_day'] )
{
$start_date = gmmktime( 0, 0, 0, $_startBits[0], $_startBits[1], $_startBits[2] );
}
else
{
$_time = explode( ':', $this->request['start_time'] );
if( $this->settings['cal_time_format'] == 'standard' )
{
if( count($_time) != 2 OR $_time[0] > 12 OR $_time[1] > 59 )
{
$this->registry->output->showError( 'calendar_invalid_time', 10427.2 );
}
if( $this->request['start_time_ampm'] == 'PM' AND $_time[0] < 12 )
{
$_time[0] += 12;
}
else if( $this->request['start_time_ampm'] == 'AM' AND $_time[0] == 12 )
{
$_time[0] = 0;
}
}
else
{
if( count($_time) != 2 OR $_time[0] > 23 OR $_time[1] > 59 )
{
$this->registry->output->showError( 'calendar_invalid_time', 10427.2 );
}
}
$start_date = gmmktime( $_time[0], $_time[1], 0, $_startBits[0], $_startBits[1], $_startBits[2] );
}
//-----------------------------------------
// Verify end date/time
//-----------------------------------------
if( $this->request['set_enddate'] )
{
if( count($_endBits) != 3 )
{
$this->registry->output->showError( 'calendar_invalid_date', 10427.3 );
}
else if( !@checkdate( $_endBits[0], $_endBits[1], $_endBits[2] ) )
{
$this->registry->output->showError( 'calendar_invalid_date', 10427.4 );
}
if( $this->request['all_day'] )
{
$end_date = gmmktime( 0, 0, 0, $_endBits[0], $_endBits[1], $_endBits[2] );
}
else
{
$_time = explode( ':', $this->request['end_time'] );
if( $this->settings['cal_time_format'] == 'standard' )
{
if( count($_time) != 2 OR $_time[0] > 12 OR $_time[1] > 59 )
{
$this->registry->output->showError( 'calendar_invalid_date', 10427.5 );
}
if( $this->request['end_time_ampm'] == 'PM' )
{
$_time[0] += 12;
}
}
else
{
if( count($_time) != 2 OR $_time[0] > 23 OR $_time[1] > 59 )
{
$this->registry->output->showError( 'calendar_invalid_date', 10427.5 );
}
}
$end_date = gmmktime( $_time[0], $_time[1], 0, $_endBits[0], $_endBits[1], $_endBits[2] );
}
}
if( $end_date AND $end_date < $start_date )
{
$this->registry->output->showError( 'calendar_range_wrong', 10421 );
}
else if( $this->request['end_date'] AND $this->request['set_enddate'] AND !$end_date )
{
$this->registry->output->showError( 'calendar_range_wrong', 10421.1 );
}
//-----------------------------------------
// Set recurring flag
//-----------------------------------------
if( $this->request['set_recurfields'] )
{
if( !$end_date )
{
$this->registry->output->showError( 'recurring_requires_enddate', 10427.6 );
}
$recurring = intval($this->request['recur_unit']);
}
//-----------------------------------------
// Adjust to GMT
//-----------------------------------------
if( $this->request['event_timezone'] AND !$this->request['all_day'] )
{
$start_date = $start_date - ( $this->request['event_timezone'] * 3600 );
if( $end_date )
{
$end_date = $end_date - ( $this->request['event_timezone'] * 3600 );
}
}
$start_date = gmstrftime( "%Y-%m-%d %H:%M:00", $start_date );
$end_date = $end_date ? gmstrftime( "%Y-%m-%d %H:%M:00", $end_date ) : 0;
//-----------------------------------------
// Check posted content for errors
//-----------------------------------------
if ( strlen( trim( IPSText::removeControlCharacters( IPSText::br2nl( $_POST['Post'] ) ) ) ) < 1 )
{
$this->registry->output->showError( 'calendar_post_too_short', 10417, null, null, 403 );
}
$this->settings['max_post_length'] = $this->settings['max_post_length'] ? $this->settings['max_post_length'] : 2140000;
if( IPSText::mbstrlen( $_POST['Post'] ) > ( $this->settings['max_post_length'] * 1024 ) )
{
$this->registry->output->showError( 'calendar_post_too_long', 10418, null, null, 403 );
}
if( !$event_title OR IPSText::mbstrlen( $event_title ) < 2 )
{
$this->registry->output->showError( 'calendar_no_title', 10419, null, null, 403 );
}
if( IPSText::mbstrlen( $event_title ) > 200 )
{
$this->registry->output->showError( 'calendar_title_too_long', 10420, null, null, 403 );
}
//-----------------------------------------
// Adding or editing?
//-----------------------------------------
if ( $type == 'edit' )
{
//-----------------------------------------
// Get event
//-----------------------------------------
if ( ! $event_id )
{
$this->registry->output->showError( 'calendar_event_not_found', 10414, null, null, 404 );
}
$event = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'cal_events', 'where' => 'event_id=' . $event_id ) );
if ( !$event['event_id'] )
{
$this->registry->output->showError( 'calendar_event_not_found', 10415, null, null, 404 );
}
//-----------------------------------------
// Do we have permission to edit?
//-----------------------------------------
if ( !$this->memberData['g_is_supmod'] AND $this->memberData['member_id'] != $event['event_member_id'] )
{
$this->registry->output->showError( 'calendar_no_edit_perm', 10416, null, null, 403 );
}
}
//-----------------------------------------
// Set event view permissions
//-----------------------------------------
if( $this->memberData['g_access_cp'] )
{
if( is_array( $this->request['e_groups'] ) )
{
foreach( $this->cache->getCache('group_cache') as $group )
{
if( $group['g_access_cp'] )
{
$this->request['e_groups'][] = $group['g_id'];
}
}
$read_perms = implode( ",", $this->request['e_groups'] );
}
}
$read_perms = $read_perms ? $read_perms : '*';
//-----------------------------------------
// Get editor and format post
//-----------------------------------------
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/editor/composite.php', 'classes_editor_composite' );
$editor = new $classToLoad();
$event_content = $editor->process( $_POST['Post'] );
IPSText::getTextClass( 'bbcode' )->parse_html = 0;
IPSText::getTextClass( 'bbcode' )->parse_smilies = intval($this->request['enableemo']);
IPSText::getTextClass( 'bbcode' )->parse_bbcode = 1;
IPSText::getTextClass( 'bbcode' )->parsing_section = 'calendar';
$event_content = IPSText::getTextClass( 'bbcode' )->preDbParse( $event_content );
//-----------------------------------------
// Event approved?
//-----------------------------------------
if( $this->request['e_type'] == 'private' )
{
$event_approved = 1;
}
else
{
$event_approved = $this->registry->permissions->check( 'nomod', $_calendar ) ? 1 : ( $_calendar['cal_moderate'] ? 0 : 1 );
}
//-----------------------------------------
// Store the event
//-----------------------------------------
if ( $type == 'add' )
{
//-----------------------------------------
// Format array for storage
//-----------------------------------------
$_eventData = array(
'event_calendar_id' => $calendar_id,
'event_member_id' => $this->memberData['member_id'],
'event_content' => $event_content,
'event_title' => $event_title,
'event_title_seo' => IPSText::makeSeoTitle( $event_title ),
'event_smilies' => intval($this->request['enableemo']),
'event_comments' => 0,
'event_perms' => $read_perms,
'event_private' => $this->request['e_type'] == 'private' ? 1 : 0,
'event_approved' => $event_approved,
'event_saved' => time(),
'event_lastupdated' => time(),
'event_recurring' => $recurring,
'event_start_date' => $start_date,
'event_end_date' => $end_date,
'event_post_key' => $this->request['post_key'],
'event_rsvp' => $this->registry->permissions->check( 'askrsvp', $_calendar ) ? intval($this->request['event_rsvp']) : 0,
'event_sequence' => 0,
'event_all_day' => intval($this->request['all_day']),
);
//-----------------------------------------
// Data hooks
//-----------------------------------------
IPSLib::doDataHooks( $_eventData, 'calendarAddEvent' );
//-----------------------------------------
// Insert
//-----------------------------------------
$this->DB->insert( 'cal_events', $_eventData );
$event_id = $this->DB->getInsertId();
//-----------------------------------------
// Set language strings
//-----------------------------------------
$_langString = $event_approved ? $this->lang->words['new_event_redirect'] : $this->lang->words['new_event_mod'];
}
else
{
//-----------------------------------------
// Format array for storage
//-----------------------------------------
$_eventData = array(
'event_calendar_id' => $calendar_id,
'event_content' => $event_content,
'event_title' => $event_title,
'event_title_seo' => IPSText::makeSeoTitle( $event_title ),
'event_smilies' => intval($this->request['enableemo']),
'event_perms' => $read_perms,
'event_private' => $this->request['e_type'] == 'private' ? 1 : 0,
'event_approved' => $event_approved,
'event_lastupdated' => time(),
'event_recurring' => $recurring,
'event_start_date' => $start_date,
'event_end_date' => $end_date,
'event_post_key' => $this->request['post_key'],
'event_rsvp' => $this->registry->permissions->check( 'askrsvp', $_calendar ) ? intval($this->request['event_rsvp']) : $event['event_rsvp'],
'event_sequence' => intval($event['event_rsvp']) + 1,
'event_all_day' => intval($this->request['all_day']),
);
//-----------------------------------------
// Data hooks
//-----------------------------------------
IPSLib::doDataHooks( $_eventData, 'calendarEditEvent' );
//-----------------------------------------
// Update database
//-----------------------------------------
$this->DB->update( 'cal_events', $_eventData, 'event_id=' . $event_id );
//-----------------------------------------
// Set language strings
//-----------------------------------------
$_langString = $event_approved ? $this->lang->words['edit_event_redirect'] : $this->lang->words['new_event_mod'];
}
//-----------------------------------------
// Upload attachments
//-----------------------------------------
if( $this->memberData['g_attach_max'] != -1 )
{
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'core' ) . '/sources/classes/attach/class_attach.php', 'class_attach' );
$class_attach = new $classToLoad( $this->registry );
$class_attach->type = 'event';
$class_attach->attach_post_key = $_eventData['event_post_key'];
$class_attach->attach_rel_id = $event_id;
$class_attach->init();
$class_attach->processMultipleUploads();
$class_attach->postProcessUpload( array() );
}
//-----------------------------------------
// Send notifications
//-----------------------------------------
if ( $event_approved )
{
require_once( IPS_ROOT_PATH . 'sources/classes/like/composite.php' );/*noLibHook*/
$_like = classes_like::bootstrap( 'calendar', $type == 'edit' ? 'events' : 'calendars' );
$_url = $this->registry->output->buildSEOUrl( 'app=calendar&amp;module=calendar&amp;section=view&amp;do=showevent&amp;event_id=' . $event_id, 'public', $_eventData['event_title_seo'], 'cal_event' );
$_like->sendNotifications( $type == 'edit' ? $event_id : $_eventData['event_calendar_id'], array( 'immediate', 'offline' ),
array(
'notification_key' => $type == 'edit' ? 'updated_event' : 'new_event',
'notification_url' => $_url,
'email_template' => $type. '_event_follow',
'email_subject' => sprintf( $this->lang->words[ $type . '_event_follow_subject'], $_url, $_eventData['event_title'] ),
'build_message_array' => array(
'NAME' => '-member:members_display_name-',
'AUTHOR' => $this->memberData['members_display_name'],
'TITLE' => $_eventData['event_title'],
'URL' => $_url,
)
) );
}
//-----------------------------------------
// Rebuild cache
//-----------------------------------------
$this->cache->rebuildCache( 'calendar_events', 'calendar' );
//-----------------------------------------
// Redirect
//-----------------------------------------
if ( $event_approved )
{
$this->registry->output->redirectScreen( $_langString, $this->settings['base_url'] . "app=calendar&amp;module=calendar&amp;section=view&amp;do=showevent&amp;event_id=" . $event_id, $_eventData['event_title_seo'], 'cal_event' );
}
else
{
$this->registry->output->redirectScreen( $_langString, $this->settings['base_url'] . "app=calendar&amp;module=calendar&amp;section=view&amp;cal_id=" . $calendar_id, $this->caches['calendars'][ $calendar_id ]['cal_title_seo'], 'cal_calendar' );
}
}
}
@@ -0,0 +1,194 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.4.5
* Add rating fallback
* Last Updated: $Date: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
* </pre>
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Calendar
* @link http://www.invisionpower.com
* @since 25th January 2011
* @version $Revision: 10721 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class public_calendar_calendar_rating extends ipsCommand
{
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return @e void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry )
{
//-----------------------------------------
// Check key
//-----------------------------------------
if ( $this->request['secure_key'] != $this->member->form_hash )
{
$this->registry->output->showError( 'usercp_forums_bad_key', 104100, null, null, 403 );
}
//-----------------------------------------
// INIT
//-----------------------------------------
$event_id = intval($this->request['event_id']);
$rating_id = intval($this->request['rating']);
$this->registry->class_localization->loadLanguageFile( array( 'public_calendar' ) );
//-----------------------------------------
// Functions class
//-----------------------------------------
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'calendar' ) . "/sources/functions.php", 'app_calendar_classes_functions', 'calendar' );
$functions = new $classToLoad( $this->registry );
//-----------------------------------------
// Get data
//-----------------------------------------
if ( ! $event_id )
{
$this->registry->output->showError( 'no_event_for_rate', 104101, null, null, 404 );
}
$event = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'cal_events', 'where' => 'event_id=' . $event_id ) );
if( !$event['event_id'] )
{
$this->registry->output->showError( 'no_event_for_rate', 104102, null, null, 404 );
}
//-----------------------------------------
// Check permissions
//-----------------------------------------
if( !$event['event_approved'] )
{
$this->registry->output->showError( 'no_event_for_rate', 104103, null, null, 404 );
}
if( $event['event_private'] )
{
if( ! $this->memberData['member_id'] OR $this->memberData['member_id'] != $event['event_member_id'] )
{
$this->registry->output->showError( 'no_event_for_rate', 104104, null, null, 404 );
}
}
if( $event['event_perms'] != '*' )
{
$permissionGroups = explode( ',', IPSText::cleanPermString( $event['event_perms'] ) );
if( !IPSMember::isInGroup( $this->memberData, $permissionGroups ) )
{
$this->registry->output->showError( 'no_event_for_rate', 104105, null, null, 404 );
}
}
//-----------------------------------------
// Get our calendar
//-----------------------------------------
$calendar = $functions->getCalendar( $event['event_calendar_id'] );
if( !$calendar['cal_id'] OR $calendar['cal_id'] != $event['event_calendar_id'] )
{
$this->registry->output->showError( 'no_event_for_rate', 104106, null, null, 404 );
}
//-----------------------------------------
// Can we rate?
//-----------------------------------------
$_can_rate = ( $this->memberData['member_id'] AND $this->registry->permissions->check( 'rate', $calendar ) ) ? intval( $this->memberData['g_topic_rate_setting'] ) : 0;
if ( ! $_can_rate )
{
$this->registry->output->showError( 'no_rate_permission', 104107, null, null, 403 );
}
//-----------------------------------------
// Sneaky members rating more than 5?
//-----------------------------------------
if( $rating_id > 5 )
{
$rating_id = 5;
}
if( $rating_id < 0 )
{
$rating_id = 0;
}
//-----------------------------------------
// Have we rated before?
//-----------------------------------------
$rating = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'cal_event_ratings', 'where' => "rating_eid={$event['event_id']} and rating_member_id=" . $this->memberData['member_id'] ) );
if ( $rating['rating_id'] )
{
//-----------------------------------------
// Do we allow re-ratings?
//-----------------------------------------
if ( $this->memberData['g_topic_rate_setting'] == 2 )
{
if ( $rating_id != $rating['rating_value'] )
{
$new_rating = $rating_id - $rating['rating_value'];
$this->DB->update( 'cal_event_ratings', array( 'rating_value' => $rating_id ), 'rating_id=' . $rating['rating_id'] );
$this->DB->update( 'cal_events', array(
'event_rating_total' => intval($event['event_rating_total']) + $new_rating,
'event_rating_avg' => round( ( intval($event['event_rating_total']) + $new_rating ) / $event['event_rating_hits'] )
), 'event_id=' . $event['event_id'] );
}
$this->registry->output->redirectScreen( $this->lang->words['event_rating_changed'] , $this->settings['base_url'] . "app=calendar&amp;module=calendar&amp;section=view&amp;do=showevent&amp;event_id={$event['event_id']}", $event['event_title_seo'], 'cal_event' );
}
else
{
$this->registry->output->redirectScreen( $this->lang->words['event_rated_already'] , $this->settings['base_url'] . "app=calendar&amp;module=calendar&amp;section=view&amp;do=showevent&amp;event_id={$event['event_id']}", $event['event_title_seo'], 'cal_event' );
}
}
else
{
$this->DB->insert( 'cal_event_ratings', array(
'rating_eid' => $event['event_id'],
'rating_member_id' => $this->memberData['member_id'],
'rating_value' => $rating_id,
'rating_ip_address' => $this->member->ip_address,
) );
$this->DB->update( 'cal_events', array(
'event_rating_total' => intval( $event['event_rating_total'] ) + $rating_id,
'event_rating_hits' => intval( $event['event_rating_hits'] ) + 1,
'event_rating_avg' => round( ( intval( $event['event_rating_total'] ) + $rating_id ) / ( intval( $event['event_rating_hits'] ) + 1 ) ),
), 'event_id=' . $event_id );
}
$this->registry->output->redirectScreen( $this->lang->words['event_rating_done'] , $this->settings['base_url'] . "app=calendar&amp;module=calendar&amp;section=view&amp;do=showevent&amp;event_id={$event['event_id']}", $event['event_title_seo'], 'cal_event' );
}
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,13 @@
<?php
/**
* @file defaultSection.php Define the default section for the 'feed' module
*~TERABYTE_DOC_READY~
* $Copyright: (c) 2001 - 2011 Invision Power Services, Inc.$
* $License: http://www.invisionpower.com/company/standards.php#license$
* $Author: ips_terabyte $
* $LastChangedDate: 2011-05-05 12:40:49 -0400 (Thu, 05 May 2011) $
* @version v3.4.5
* $Revision: 8655 $
*/
$DEFAULT_SECTION = 'output';
@@ -0,0 +1,10 @@
<html>
<head><title>IP.Board - Bulletin Board System</title></head>
<body>
<h1>403: IP.Board -&gt; Forbidden</h1>
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
</html>
@@ -0,0 +1,126 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.4.5
* Calendar iCalendar/webcal output
* Last Updated: $Date: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
* </pre>
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Calendar
* @link http://www.invisionpower.com
* @version $Rev: 10721 $
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class public_calendar_feed_output extends ipsCommand
{
/**
* Calendar data
*
* @var array
*/
protected $calendar = array();
/**
* Calendar functions
*
* @var object
*/
protected $functions;
/**
* Class entry point
*
* @param object Registry reference
* @return @e void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry )
{
//-----------------------------------------
// Init
//-----------------------------------------
$this->registry->class_localization->loadLanguageFile( array( 'public_calendar' ), 'calendar' );
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'calendar' ) . "/sources/functions.php", 'app_calendar_classes_functions', 'calendar' );
$this->functions = new $classToLoad( $this->registry );
$this->calendar = $this->functions->getCalendar();
//-----------------------------------------
// Switch
//-----------------------------------------
switch( $this->request['do'] )
{
default:
case 'download':
$this->downloadIcalFeed();
break;
}
}
/**
* Serve the iCalendar feed (valid for both download as .ics and webcal:// protocol)
*
* @return @e void
*/
public function downloadIcalFeed()
{
//-----------------------------------------
// Get main view class
//-----------------------------------------
$classToLoad = IPSLib::loadActionOverloader( IPSLib::getAppDir( 'calendar' ) . '/modules_public/calendar/view.php', 'public_calendar_calendar_view' );
$calendar = new $classToLoad( $this->registry );
$calendar->makeRegistryShortcuts( $this->registry );
$calendar->initCalendar();
//-----------------------------------------
// Load (all) events
//-----------------------------------------
$calendar->calendarGetEventsSQL( gmstrftime( '%m' ), gmstrftime( '%Y' ), array( 'timenow' => '1', 'timethen' => '2000000000', 'cal_id' => $this->calendar['cal_id'], 'honor_permissions' => true, 'no_date_convert' => true ) );
$events = $calendar->calendarGetAllEvents();
//-----------------------------------------
// Load iCalendar class
//-----------------------------------------
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'calendar' ) . "/sources/icalendar.php", 'app_calendar_classes_icalendarOutput', 'calendar' );
$iCalendar = new $classToLoad( $this->registry, $this->calendar['cal_id'] );
//-----------------------------------------
// Send data to iCalendar class and get output
//-----------------------------------------
foreach( $events as $event )
{
$event = $calendar->calendarMakeEventHTML( $event, true );
$iCalendar->addEvent( $event );
}
$feed = $iCalendar->buildICalendarFeed();
//-----------------------------------------
// Output
//-----------------------------------------
@header( "Content-type: text/calendar; charset=" . IPS_DOC_CHAR_SET );
@header( "Content-Disposition: inline; filename=calendarEvents.ics" );
print $feed;
exit;
}
}
@@ -0,0 +1,10 @@
<html>
<head><title>IP.Board - Bulletin Board System</title></head>
<body>
<h1>403: IP.Board -&gt; Forbidden</h1>
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
</html>
@@ -0,0 +1,10 @@
<html>
<head><title>IP.Board - Bulletin Board System</title></head>
<body>
<h1>403: IP.Board -&gt; Forbidden</h1>
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
</html>
@@ -0,0 +1,59 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Calendar - requirements checker
* Last Updated: $Date: 2012-05-21 09:09:36 -0400 (Mon, 21 May 2012) $
* </pre>
*
* @author $Author: ips_terabyte $ (Orginal: Mark)
* @copyright (c) 2010 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Calendar
* @link http://www.invisionpower.com
* @since 8th September 2010
* @version $Revision: 10771 $
*/
class calendar_upgradeCheck
{
/**
* Check we can upgrade
*
* @return mixed Boolean true or error message
*/
public function checkForProblems()
{
//-----------------------------------------
// Compatibility check
//-----------------------------------------
$requiredIpbVersion = 32003; // 3.2.0
$args = func_get_args();
if ( !empty( $args ) )
{
$numbers = IPSSetUp::fetchAppVersionNumbers( 'core' );
/* Are we upgrading core now? */
if ( isset( $args[0]['core'] ) )
{
$ourVersion = $numbers['latest'][0];
}
/* No - check installed version */
else
{
$ourVersion = $numbers['current'][0];
}
if ( $requiredIpbVersion > $ourVersion )
{
$allVersions = IPSSetUp::fetchXmlAppVersions( 'core' );
return "This version of IP.Calendar requires IP.Board {$allVersions[ $requiredIpbVersion ]} or higher.";
}
}
return TRUE;
}
}
@@ -0,0 +1,10 @@
<html>
<head><title>IP.Board - Bulletin Board System</title></head>
<body>
<h1>403: IP.Board -&gt; Forbidden</h1>
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
</html>
@@ -0,0 +1,10 @@
<html>
<head><title>IP.Board - Bulletin Board System</title></head>
<body>
<h1>403: IP.Board -&gt; Forbidden</h1>
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
</html>
@@ -0,0 +1,8 @@
<?php
/**
* Installation Schematic File
* Generated on Thu, 30 Apr 2009 19:03:38 +0000 GMT
*/
$INDEX[] = "ALTER TABLE cal_events ADD FULLTEXT (event_content);";
$INDEX[] = "ALTER TABLE cal_events ADD FULLTEXT (event_title);";
?>
@@ -0,0 +1,6 @@
<?php
# CALENDARS
$INSERT[] ="INSERT INTO cal_calendars (cal_id, cal_title, cal_moderate, cal_position, cal_event_limit, cal_bday_limit, cal_rss_export, cal_rss_export_days, cal_rss_export_max, cal_rss_update, cal_rss_update_last, cal_rss_cache, cal_title_seo, cal_comment_moderate, cal_rsvp_owner) VALUES (1, 'Community Calendar', 1, 0, 2, 1, 1, 14, 20, 1440, UNIX_TIMESTAMP(), '', 'community-calendar', 0, 1);";
$INSERT[] ="INSERT INTO permission_index VALUES(NULL, 'calendar', 'calendar', 1, ',4,2,3,6,', ',4,3,6,', ',4,6,', '', '', '', '', 0, 0, NULL)";
$INSERT[] = "INSERT INTO rc_classes (onoff, class_title, class_desc, author, author_url, pversion, my_class, group_can_report, mod_group_perm, extra_data, lockd, app) VALUES(1, 'Calendar Plugin', 'Allows calendar entries to be reported', 'Invision Power Services, Inc', 'http://invisionpower.com', 'v1.0', 'calendar', ',1,2,3,4,6,', ',4,6,', 'N;', 1, 'calendar');";
@@ -0,0 +1,120 @@
<?php
/**
* Installation Schematic File
* Generated on Thu, 19 Feb 2009 08:15:47 +0000 GMT
*/
$TABLE[] = "CREATE TABLE cal_calendars (
cal_id int(10) unsigned NOT NULL auto_increment,
cal_title varchar(255) NOT NULL default '0',
cal_moderate tinyint(1) NOT NULL default '0',
cal_position int(3) NOT NULL default '0',
cal_event_limit int(2) unsigned NOT NULL default '0',
cal_bday_limit int(2) unsigned NOT NULL default '0',
cal_rss_export tinyint(1) NOT NULL default '0',
cal_rss_export_days int(3) unsigned NOT NULL default '0',
cal_rss_export_max tinyint(1) NOT NULL default '0',
cal_rss_update int(3) unsigned NOT NULL default '0',
cal_rss_update_last int(10) unsigned NOT NULL default '0',
cal_rss_cache mediumtext,
cal_title_seo VARCHAR( 255 ) NULL DEFAULT NULL,
cal_comment_moderate TINYINT( 1 ) NOT NULL DEFAULT '0',
cal_rsvp_owner TINYINT( 1 ) NOT NULL DEFAULT '0',
PRIMARY KEY (cal_id),
KEY cal_rss_export (cal_rss_export)
);";
$TABLE[] = "CREATE TABLE cal_events (
event_id int(10) unsigned NOT NULL auto_increment,
event_calendar_id int(10) unsigned NOT NULL default '0',
event_member_id mediumint(8) unsigned NOT NULL default '0',
event_content mediumtext,
event_title varchar(255) NOT NULL default '',
event_smilies tinyint(1) NOT NULL default '0',
event_comments int NOT NULL default '0',
event_comments_pending INT NOT NULL DEFAULT '0',
event_rsvp tinyint(1) NOT NULL default '0',
event_perms text,
event_private tinyint(1) NOT NULL default '0',
event_approved tinyint(1) NOT NULL default '0',
event_saved int(10) unsigned NOT NULL default '0',
event_lastupdated int(10) unsigned NOT NULL default '0',
event_recurring int(2) unsigned NOT NULL default '0',
event_start_date datetime NOT NULL,
event_end_date datetime default NULL,
event_title_seo VARCHAR( 255 ) NULL DEFAULT NULL,
event_rating_total INT NOT NULL DEFAULT '0',
event_rating_hits INT NOT NULL DEFAULT '0',
event_rating_avg INT NOT NULL DEFAULT '0',
event_attachments INT NOT NULL DEFAULT '0',
event_post_key VARCHAR( 32 ) NULL DEFAULT NULL,
event_sequence INT NOT NULL DEFAULT '0',
event_all_day TINYINT NOT NULL DEFAULT '0',
PRIMARY KEY (event_id),
KEY approved ( event_calendar_id , event_approved , event_start_date , event_end_date ),
KEY event_member_id (event_member_id, event_approved, event_private, event_lastupdated)
);";
$TABLE[] = "CREATE TABLE cal_event_ratings (
rating_id int(10) NOT NULL auto_increment,
rating_eid int(10) NOT NULL default '0',
rating_member_id mediumint(8) NOT NULL default '0',
rating_value smallint(6) NOT NULL default '0',
rating_ip_address varchar(46) NOT NULL,
PRIMARY KEY (rating_id),
KEY rating_eid (rating_eid,rating_member_id),
KEY rating_ip_address (rating_ip_address)
);";
$TABLE[] = "CREATE TABLE cal_event_comments (
comment_id int(10) NOT NULL auto_increment,
comment_eid int(10) NOT NULL default '0',
comment_mid mediumint(8) NOT NULL default '0',
comment_date int(11) NOT NULL default '0',
comment_approved tinyint(1) NOT NULL default '0',
comment_text mediumtext,
comment_append_edit tinyint(1) NOT NULL default '0',
comment_edit_time int(11) NOT NULL default '0',
comment_edit_name varchar(255) default NULL,
ip_address varchar(46) default NULL,
comment_author varchar(255) default NULL,
PRIMARY KEY (comment_id),
KEY comment_eid (comment_eid),
KEY ip_address (ip_address)
);";
$TABLE[] = "CREATE TABLE cal_event_rsvp (
rsvp_id int(11) NOT NULL auto_increment,
rsvp_event_id int(11) NOT NULL default '0',
rsvp_member_id int(11) NOT NULL default '0',
rsvp_date int(11) NOT NULL default '0',
PRIMARY KEY (rsvp_id),
KEY rsvp_event_id (rsvp_event_id),
KEY rsvp_member_id (rsvp_member_id)
);";
$TABLE[] = "CREATE TABLE cal_import_feeds (
feed_id int(11) NOT NULL auto_increment,
feed_title varchar(255) default NULL,
feed_url text,
feed_added int(11) NOT NULL default '0',
feed_lastupdated int(11) NOT NULL default '0',
feed_recache_freq int(11) NOT NULL default '0',
feed_calendar_id int(11) NOT NULL default '0',
feed_member_id INT NOT NULL DEFAULT '0',
feed_next_run INT NOT NULL DEFAULT '0',
PRIMARY KEY (feed_id),
KEY feed_calendar_id (feed_calendar_id),
KEY feed_next_run (feed_next_run)
);";
$TABLE[] = "CREATE TABLE cal_import_map (
import_id int(11) NOT NULL auto_increment,
import_feed_id int(11) NOT NULL default '0',
import_event_id int(11) NOT NULL default '0',
import_guid varchar(255) NOT NULL default '0',
PRIMARY KEY (import_id),
KEY import_feed_id (import_feed_id),
KEY import_event_id (import_event_id),
KEY import_guid (import_guid)
);";
?>
@@ -0,0 +1,10 @@
<html>
<head><title>IP.Board - Bulletin Board System</title></head>
<body>
<h1>403: IP.Board -&gt; Forbidden</h1>
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
</html>
@@ -0,0 +1,10 @@
<html>
<head><title>IP.Board - Bulletin Board System</title></head>
<body>
<h1>403: IP.Board -&gt; Forbidden</h1>
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionpower.com/">IP.Board</a>
</body>
</html>
@@ -0,0 +1,142 @@
<?php
/*
+--------------------------------------------------------------------------
| IP.Board v3.4.5
| ========================================
| by Matthew Mecham
| (c) 2001 - 2009 Invision Power Services
| http://www.invisionpower.com
| ========================================
| Web: http://www.invisionboard.com
| Email: matt@invisionpower.com
| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
*/
$PRE = trim(ipsRegistry::dbFunctions()->getPrefix());
$DB = ipsRegistry::DB();
/* Fix app association for RC plugin */
$SQL[] = "UPDATE rc_classes SET app='calendar' WHERE my_class='calendar';";
/* Update cal_calendars table */
$SQL[] = "ALTER TABLE cal_calendars DROP cal_permissions,
ADD cal_title_seo VARCHAR( 255 ) NULL DEFAULT NULL,
ADD cal_comment_moderate TINYINT( 1 ) NOT NULL DEFAULT '0',
ADD cal_rsvp_owner TINYINT( 1 ) NOT NULL DEFAULT '0';";
/* New tables */
$SQL[] = "CREATE TABLE cal_event_ratings (
rating_id int(10) NOT NULL auto_increment,
rating_eid int(10) NOT NULL default '0',
rating_member_id mediumint(8) NOT NULL default '0',
rating_value smallint(6) NOT NULL default '0',
rating_ip_address varchar(46) NOT NULL,
PRIMARY KEY (rating_id),
KEY rating_eid (rating_eid,rating_member_id),
KEY rating_ip_address (rating_ip_address)
);";
$SQL[] = "CREATE TABLE cal_event_comments (
comment_id int(10) NOT NULL auto_increment,
comment_eid int(10) NOT NULL default '0',
comment_mid mediumint(8) NOT NULL default '0',
comment_date int(11) NOT NULL default '0',
comment_approved tinyint(1) NOT NULL default '0',
comment_text mediumtext,
comment_append_edit tinyint(1) NOT NULL default '0',
comment_edit_time int(11) NOT NULL default '0',
comment_edit_name varchar(255) default NULL,
ip_address varchar(46) default NULL,
comment_author varchar(255) default NULL,
PRIMARY KEY (comment_id),
KEY comment_eid (comment_eid),
KEY ip_address (ip_address)
);";
$SQL[] = "CREATE TABLE cal_event_rsvp (
rsvp_id int(11) NOT NULL auto_increment,
rsvp_event_id int(11) NOT NULL default '0',
rsvp_member_id int(11) NOT NULL default '0',
rsvp_date int(11) NOT NULL default '0',
PRIMARY KEY (rsvp_id),
KEY rsvp_event_id (rsvp_event_id),
KEY rsvp_member_id (rsvp_member_id)
);";
$SQL[] = "CREATE TABLE cal_import_feeds (
feed_id int(11) NOT NULL auto_increment,
feed_title varchar(255) default NULL,
feed_url text,
feed_added int(11) NOT NULL default '0',
feed_lastupdated int(11) NOT NULL default '0',
feed_recache_freq int(11) NOT NULL default '0',
feed_calendar_id int(11) NOT NULL default '0',
feed_member_id INT NOT NULL DEFAULT '0',
feed_next_run INT NOT NULL DEFAULT '0',
PRIMARY KEY (feed_id),
KEY feed_calendar_id (feed_calendar_id),
KEY feed_next_run (feed_next_run)
);";
$SQL[] = "CREATE TABLE cal_import_map (
import_id int(11) NOT NULL auto_increment,
import_feed_id int(11) NOT NULL default '0',
import_event_id int(11) NOT NULL default '0',
import_guid varchar(255) NOT NULL default '0',
PRIMARY KEY (import_id),
KEY import_feed_id (import_feed_id),
KEY import_event_id (import_event_id),
KEY import_guid (import_guid)
);";
/* Upgrade calendar events... */
$SQL[] = "RENAME TABLE cal_events TO cal_events_bak;";
$SQL[] = "CREATE TABLE cal_events (
event_id int(10) unsigned NOT NULL auto_increment,
event_calendar_id int(10) unsigned NOT NULL default '0',
event_member_id mediumint(8) unsigned NOT NULL default '0',
event_content mediumtext,
event_title varchar(255) NOT NULL default '',
event_smilies tinyint(1) NOT NULL default '0',
event_comments int NOT NULL default '0',
event_rsvp tinyint(1) NOT NULL default '0',
event_perms text,
event_private tinyint(1) NOT NULL default '0',
event_approved tinyint(1) NOT NULL default '0',
event_saved int(10) unsigned NOT NULL default '0',
event_lastupdated int(10) unsigned NOT NULL default '0',
event_recurring int(2) unsigned NOT NULL default '0',
event_start_date datetime NOT NULL,
event_end_date datetime default NULL,
event_title_seo VARCHAR( 255 ) NULL DEFAULT NULL,
event_rating_total INT NOT NULL DEFAULT '0',
event_rating_hits INT NOT NULL DEFAULT '0',
event_rating_avg INT NOT NULL DEFAULT '0',
event_attachments INT NOT NULL DEFAULT '0',
event_post_key VARCHAR( 32 ) NULL DEFAULT NULL,
event_comments_pending INT NOT NULL DEFAULT '0',
event_sequence INT NOT NULL DEFAULT '0',
PRIMARY KEY (event_id),
KEY approved (event_calendar_id , event_approved , event_start_date , event_end_date),
KEY event_member_id (event_member_id, event_approved, event_private, event_lastupdated)
);";
$SQL[] = "INSERT INTO cal_events SELECT event_id, event_calendar_id, event_member_id, event_content, event_title, event_smilies, 0, 0, event_perms, event_private, event_approved, event_unixstamp, event_unixstamp,
event_recurring, FROM_UNIXTIME(event_unix_from), CASE WHEN event_unix_to > 0 THEN FROM_UNIXTIME(event_unix_to) ELSE NULL END, '', 0, 0, 0, 0, MD5( CONCAT( event_id, event_title ) ), 0, 1 FROM {$PRE}cal_events_bak;";
$SQL[] = "DROP TABLE cal_events_bak;";
/* Add fulltext indexes, if appropriate */
if( $DB->checkFulltextSupport() )
{
$SQL[] = "ALTER TABLE cal_events ADD FULLTEXT (event_content);";
$SQL[] = "ALTER TABLE cal_events ADD FULLTEXT (event_title);";
}
@@ -0,0 +1,137 @@
<?php
/*
+--------------------------------------------------------------------------
| IP.Board v3.4.5
| ========================================
| by Matthew Mecham
| (c) 2001 - 2004 Invision Power Services
| http://www.invisionpower.com
| ========================================
| Web: http://www.invisionboard.com
| Email: matt@invisionpower.com
| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class version_upgrade
{
/**
* Custom HTML to show
*
* @var string
*/
protected $_output = '';
/**
* fetchs output
*
* @return string
*/
public function fetchOutput()
{
return $this->_output;
}
/**
* Execute selected method
*
* @param object Registry object
* @return @e void
*/
public function doExecute( ipsRegistry $registry )
{
/* Make object */
$this->registry = $registry;
$this->DB = $this->registry->DB();
$this->settings =& $this->registry->fetchSettings();
$this->request =& $this->registry->fetchRequest();
$this->cache = $this->registry->cache();
$this->caches =& $this->registry->cache()->fetchCaches();
//--------------------------------
// What are we doing?
//--------------------------------
switch( $this->request['workact'] )
{
default:
case 'fixtitles':
$this->fixSeoTitles();
break;
}
/* Workact is set in the function, so if it has not been set, then we're done. The last function should unset it. */
if ( $this->request['workact'] )
{
return false;
}
else
{
return true;
}
}
/**
* Set the SEO titles
*
* @param int
* @return @e void
*/
public function fixSeoTitles()
{
/* Init */
$st = intval($this->request['st']);
$did = 0;
$each = 200;
/* If this is the first pass, do the cal_calendars table too */
if( !$st )
{
$this->DB->build( array( 'select' => 'cal_id, cal_title', 'from' => 'cal_calendars' ) );
$outer = $this->DB->execute();
while( $r = $this->DB->fetch($outer) )
{
$this->DB->update( 'cal_calendars', array( 'cal_title_seo' => IPSText::makeSeoTitle( $r['cal_title'] ) ), 'cal_id=' . $r['cal_id'] );
}
$this->registry->output->addMessage( 'Calendar FURL titles rebuilt' );
}
/* Build event FURL titles */
$this->DB->build( array( 'select' => 'event_id, event_title', 'from' => 'cal_events', 'order' => 'event_id ASC', 'limit' => array( $st, $each ) ) );
$outer = $this->DB->execute();
while( $r = $this->DB->fetch($outer) )
{
$did++;
$this->DB->update( 'cal_events', array( 'event_title_seo' => IPSText::makeSeoTitle( $r['event_title'] ) ), 'event_id=' . $r['event_id'] );
}
/* Show message and redirect */
if( $did > 0 )
{
$this->request['st'] = $st + $did;
$this->request['workact'] = 'fixtitles';
$this->registry->output->addMessage( "Up to {$this->request['st']} event FURL titles rebuilt so far..." );
}
else
{
$this->request['st'] = 0;
$this->request['workact'] = '';
$this->registry->output->addMessage( "All event FURL titles rebuilt..." );
}
/* Next Page */
return;
}
}
@@ -0,0 +1,10 @@
<html>
<head><title>IP.Board - Bulletin Board System</title></head>
<body>
<h1>403: IP.Board -&gt; Forbidden</h1>
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionpower.com/">IP.Board</a>
</body>
</html>
@@ -0,0 +1,17 @@
<?php
/*
+--------------------------------------------------------------------------
| IP.Board v3.4.5
| ========================================
| by Matthew Mecham
| (c) 2001 - 2009 Invision Power Services
| http://www.invisionpower.com
| ========================================
| Web: http://www.invisionboard.com
| Email: matt@invisionpower.com
| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
*/
$SQL[] = "ALTER TABLE cal_events ADD event_all_day TINYINT NOT NULL DEFAULT '0';";
$SQL[] = "UPDATE cal_events SET event_all_day=1 WHERE TIME(event_start_date) = '00:00:00';";
@@ -0,0 +1,10 @@
<html>
<head><title>IP.Board - Bulletin Board System</title></head>
<body>
<h1>403: IP.Board -&gt; Forbidden</h1>
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionpower.com/">IP.Board</a>
</body>
</html>
@@ -0,0 +1,127 @@
<?php
/*
+--------------------------------------------------------------------------
| IP.Board v3.4.5
| ========================================
| by Matthew Mecham
| (c) 2001 - 2004 Invision Power Services
| http://www.invisionpower.com
| ========================================
| Web: http://www.invisionboard.com
| Email: matt@invisionpower.com
| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class version_upgrade
{
/**
* Custom HTML to show
*
* @var string
*/
protected $_output = '';
/**
* fetchs output
*
* @return string
*/
public function fetchOutput()
{
return $this->_output;
}
/**
* Execute selected method
*
* @param object Registry object
* @return @e void
*/
public function doExecute( ipsRegistry $registry )
{
/* Make object */
$this->registry = $registry;
$this->DB = $this->registry->DB();
$this->settings =& $this->registry->fetchSettings();
$this->request =& $this->registry->fetchRequest();
$this->cache = $this->registry->cache();
$this->caches =& $this->registry->cache()->fetchCaches();
//--------------------------------
// What are we doing?
//--------------------------------
switch( $this->request['workact'] )
{
default:
case 'minicaldel':
$this->removeMinicalCaches();
break;
}
/* Workact is set in the function, so if it has not been set, then we're done. The last function should unset it. */
if ( $this->request['workact'] )
{
return false;
}
else
{
return true;
}
}
/**
* Remove excessive minical caches from earlier versions
*
* @return @e void
*/
public function removeMinicalCaches()
{
/* Init */
$st = intval($this->request['st']);
$did = 0;
$each = 500;
/* Grab the minicals */
$this->DB->build( array( 'select' => '*', 'from' => 'cache_store', 'where' => "cs_key LIKE 'minical_%'", 'limit' => array( $st, $each ) ) );
$outer = $this->DB->execute();
while( $r = $this->DB->fetch($outer) )
{
$did++;
$caches[] = $r['cs_key'];
}
if( count($caches) )
{
$this->cache->deleteCache( $caches );
}
/* Show message and redirect */
if( $did > 0 )
{
$this->request['st'] = $st + $did;
$this->request['workact'] = 'minicaldel';
$this->registry->output->addMessage( "Up to {$this->request['st']} minical caches removed so far..." );
}
else
{
$this->request['st'] = 0;
$this->request['workact'] = '';
$this->registry->output->addMessage( "All minical caches removed..." );
}
/* Next Page */
return;
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 626 B

@@ -0,0 +1,511 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.4.5
* Calendar skin file
* Last Updated: $Date: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
* </pre>
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Calendar
* @link http://www.invisionpower.com
* @since Friday 19th May 2006 17:33
* @version $Revision: 10721 $
*/
class cp_skin_calendar
{
/**
* Registry Object Shortcuts
*
* @var $registry
* @var $DB
* @var $settings
* @var $request
* @var $lang
* @var $member
* @var $memberData
* @var $cache
* @var $caches
*/
protected $registry;
protected $DB;
protected $settings;
protected $request;
protected $lang;
protected $member;
protected $memberData;
protected $cache;
protected $caches;
/**
* Constructor
*
* @param object $registry Registry object
* @return @e void
*/
public function __construct( ipsRegistry $registry )
{
$this->registry = $registry;
$this->DB = $this->registry->DB();
$this->settings =& $this->registry->fetchSettings();
$this->request =& $this->registry->fetchRequest();
$this->member = $this->registry->member();
$this->memberData =& $this->registry->member()->fetchMemberData();
$this->cache = $this->registry->cache();
$this->caches =& $this->registry->cache()->fetchCaches();
$this->lang = $this->registry->class_localization;
}
/**
* Form to add/edit a calendar
*
* @access public
* @param array Form elements
* @param string Form title
* @param string Action code
* @param string Button text
* @param array Calendar data
* @return string HTML
*/
public function calendarForm($form, $title, $formcode, $button, $calendar) {
$IPBHTML = "";
//--starthtml--//
$IPBHTML .= <<<HTML
<div class='section_title'>
<h2>{$this->lang->words['c_title']}</h2>
</div>
<form id='adminform' action='{$this->settings['base_url']}&amp;{$this->form_code}&amp;do={$formcode}&amp;cal_id={$calendar['cal_id']}' method='post'>
<input type='hidden' name='_admin_auth_key' value='{$this->registry->getClass('adminFunctions')->_admin_auth_key}' />
<div class='acp-box alternate_rows'>
<h3>{$title}</h3>
<div id='tabstrip_calendar' class='ipsTabBar'>
<ul>
<li id='tab_options'>{$this->lang->words['a_options']}</li>
<li id='tab_perms'>{$this->lang->words['tab_permissions']}</li>
</ul>
</div>
<div id='tabContent' class='ipsTabBar_content'>
<div id='tab_options_content'>
<table class='ipsTable double_pad'>
<tr>
<td class='field_title'>
<strong class='title'>{$this->lang->words['c_block_title']}</strong>
</td>
<td class='field_field'>{$form['cal_title']}</td>
</tr>
<tr>
<td class='field_title'>
<strong class='title'>{$this->lang->words['c_block_mod']}</strong>
</td>
<td class='field_field'>{$form['cal_moderate']}<br /><span class='desctext'>{$this->lang->words['c_block_mod_info']}</span></td>
</tr>
<tr>
<td class='field_title'>
<strong class='title'>{$this->lang->words['c_block_modc']}</strong>
</td>
<td class='field_field'>{$form['cal_moderatec']}<br /><span class='desctext'>{$this->lang->words['c_block_modc_info']}</span></td>
</tr>
<tr>
<td class='field_title'>
<strong class='title'>{$this->lang->words['c_block_rsvp']}</strong>
</td>
<td class='field_field'>{$form['cal_rsvp']}<br /><span class='desctext'>{$this->lang->words['c_block_rsvp_info']}</span></td>
</tr>
<tr>
<td class='field_title'>
<strong class='title'>{$this->lang->words['c_block_limit']}</strong>
</td>
<td class='field_field'>{$form['cal_event_limit']}<br /><span class='desctext'>{$this->lang->words['c_block_limit_info']}</span></td>
</tr>
<tr>
<td class='field_title'>
<strong class='title'>{$this->lang->words['c_block_bday']}</strong>
</td>
<td class='field_field'>{$form['cal_bday_limit']}<br /><span class='desctext'>{$this->lang->words['c_block_bday_info']}</span></td>
</tr>
<tr>
<th colspan='2'>{$this->lang->words['c_block_rss']}</th>
</tr>
<tr>
<td class='field_title'>
<strong class='title'>{$this->lang->words['c_block_enable']}</strong>
</td>
<td class='field_field'>{$form['cal_rss_export']}<br /><span class='desctext'>{$this->lang->words['c_block_enabled_info']}</span></td>
</tr>
<tr>
<td class='field_title'>
<strong class='title'>{$this->lang->words['c_block_forthcoming']}</strong>
</td>
<td class='field_field'>{$form['cal_rss_export_days']}</td>
</tr>
<tr>
<td class='field_title'>
<strong class='title'>{$this->lang->words['c_block_max']}</strong>
</td>
<td class='field_field'>{$form['cal_rss_export_max']}<br /><span class='desctext'>{$this->lang->words['c_block_max_info']}</span></td>
</tr>
<tr>
<td class='field_title'>
<strong class='title'>{$this->lang->words['c_block_freq']}</strong>
</td>
<td class='field_field'>{$form['cal_rss_update']}<br /><span class='desctext'>{$this->lang->words['c_block_freq_info']}</span></td>
</tr>
</table>
</div>
<div id='tab_perms_content'>
{$form['perm_matrix']}
</div>
</div>
<div class='acp-actionbar'>
<input type='submit' class='realbutton' value='{$button}' />
</div>
</div>
</form>
<script type='text/javascript'>
jQ("#tabstrip_calendar").ipsTabBar({tabWrap: "#tabContent", defaultTab: 'tab_options'});
</script>
HTML;
//--endhtml--//
return $IPBHTML;
}
/**
* Calendar overview screen
*
* @access public
* @param array Calendars
* @return string HTML
*/
public function calendarOverviewScreen( $rows ) {
$IPBHTML = "";
//--starthtml--//
$IPBHTML .= <<<HTML
<div class='section_title'>
<h2>{$this->lang->words['c_title']}</h2>
<div class='ipsActionBar clearfix'>
<ul>
<li class='ipsActionButton'>
<a href='{$this->settings['base_url']}{$this->form_code}&amp;do=calendar_add' title='{$this->lang->words['c_addcal']}'>
<img src='{$this->settings['skin_acp_url']}/images/icons/add.png' alt='' />
{$this->lang->words['c_addcal']}
</a>
</li>
<li class='ipsActionButton'>
<a href='{$this->settings['base_url']}{$this->form_code}&amp;do=calendar_rebuildcache' title='{$this->lang->words['c_recachecal']}'>
<img src='{$this->settings['skin_acp_url']}/images/icons/arrow_refresh.png' alt='' />
{$this->lang->words['c_recachecal']}
</a>
</li>
</ul>
</div>
</div>
<div class='acp-box'>
<h3>{$this->lang->words['c_calendars']}</h3>
<ul class='ipsDragParent alternate_rows' id='sortable_handle'>
HTML;
foreach( $rows as $r )
{
$IPBHTML .= <<<HTML
<li class='isDraggable' id='calendar_{$r['cal_id']}'>
<table class='ipsTable double_pad'>
<tr class='ipsControlRow'>
<td class='col_drag'><div class='draghandle'>&nbsp;</div></td>
<td>
<strong class='title'><a href='{$this->settings['base_url']}{$this->form_code}&amp;do=calendar_edit&amp;cal_id={$r['cal_id']}'>{$r['cal_title']}</a></strong>
</td>
<td class='col_buttons' nowrap="true">
<ul class='ipsControlStrip'>
<li class='i_edit'><a href='{$this->settings['base_url']}{$this->form_code}&amp;do=calendar_edit&amp;cal_id={$r['cal_id']}'>{$this->lang->words['c_editcal']}</a></li>
<li class='i_refresh'><a href='{$this->settings['base_url']}{$this->form_code}&amp;do=calendar_rss_cache&amp;cal_id={$r['cal_id']}'>{$this->lang->words['c_rebuildcal']}</a></li>
<li class='i_delete'><a href='#' onclick='return acp.confirmDelete("{$this->settings['base_url']}{$this->form_code}&amp;do=calendar_delete&amp;cal_id={$r['cal_id']}");'>{$this->lang->words['c_deletecal']}</a></li>
</ul>
</td>
</tr>
</table>
</li>
HTML;
}
$IPBHTML .= <<<HTML
</ul>
</div>
<script type='text/javascript'>
dropItLikeItsHot = function( draggableObject, mouseObject )
{
var options = {
method : 'post',
parameters : Sortable.serialize( 'sortable_handle', { tag: 'li', name: 'calendars' } )
};
new Ajax.Request( "{$this->settings['base_url']}&{$this->form_code_js}&do=calendar_move&md5check={$this->registry->adminFunctions->getSecurityKey()}".replace( /&amp;/g, '&' ), options );
return false;
};
Sortable.create( 'sortable_handle', { revert: true, format: 'calendar_([0-9]+)', onUpdate: dropItLikeItsHot, handle: 'draghandle' } );
</script>
HTML;
//--endhtml--//
return $IPBHTML;
}
/**
* Confirm feed deletion and how to handle events
*
* @access public
* @param array Feed data
* @return string HTML
*/
public function deleteConfirm( $feed ) {
$IPBHTML = "";
//--starthtml--//
$IPBHTML .= <<<HTML
<div class='section_title'>
<h2>{$this->lang->words['feed_del_confirm_t']}</h2>
</div>
<form id='adminform' action='{$this->settings['base_url']}{$this->form_code}&amp;do=delete&amp;id={$feed['feed_id']}' method='post'>
<input type='hidden' name='_admin_auth_key' value='{$this->registry->getClass('adminFunctions')->_admin_auth_key}' />
<input type='hidden' name='confirm' value='1' />
<div class='acp-box'>
<table class='ipsTable double_pad'>
<tr>
<td class='field_title'>
<strong class='title'>{$this->lang->words['delete_events_too']}</strong>
</td>
<td class='field_field'>{$this->registry->output->formYesNo( 'delete_events' , 0 )}</td>
</tr>
</table>
<div class='acp-actionbar'>
<input type='submit' class='realbutton' value='{$this->lang->words['do_del_button']}' />
</div>
</div>
</form>
HTML;
//--endhtml--//
return $IPBHTML;
}
/**
* Form to add/edit an ical feed
*
* @access public
* @param array Form elements
* @param string Form title
* @param string Action code
* @param string Button text
* @param array Feed data
* @return string HTML
*/
public function feedForm($form, $title, $formcode, $button, $feed) {
$IPBHTML = "";
//--starthtml--//
$IPBHTML .= <<<HTML
<div class='section_title'>
<h2>{$this->lang->words['ical_manager']}</h2>
</div>
<form id='adminform' action='{$this->settings['base_url']}{$this->form_code}&amp;do={$formcode}&amp;id={$feed['feed_id']}' method='post'>
<input type='hidden' name='_admin_auth_key' value='{$this->registry->getClass('adminFunctions')->_admin_auth_key}' />
<div class='acp-box'>
<h3>{$title}</h3>
<table class='ipsTable double_pad'>
<tr>
<td class='field_title'>
<strong class='title'>{$this->lang->words['feed_formtitle']}</strong>
</td>
<td class='field_field'>{$form['feed_title']}</td>
</tr>
<tr>
<td class='field_title'>
<strong class='title'>{$this->lang->words['feed_formurl']}</strong>
</td>
<td class='field_field'>{$form['feed_url']}<br /><span class='desctext'>{$this->lang->words['feed_urlinfo']}</span></td>
</tr>
<tr>
<td class='field_title'>
<strong class='title'>{$this->lang->words['feed_calid']}</strong>
</td>
<td class='field_field'>{$form['feed_calendar_id']}<br /><span class='desctext'>{$this->lang->words['feed_calinfo']}</span></td>
</tr>
<tr>
<td class='field_title'>
<strong class='title'>{$this->lang->words['feed_formmem']}</strong>
</td>
<td class='field_field'>{$form['feed_member_id']}<br /><span class='desctext'>{$this->lang->words['feed_formmemi']}</span></td>
</tr>
<tr>
<td class='field_title'>
<strong class='title'>{$this->lang->words['feed_formfreq']}</strong>
</td>
<td class='field_field'>{$form['feed_recache_freq']}<br /><span class='desctext'>{$this->lang->words['feed_freqinfo']}</span></td>
</tr>
</table>
<div class='acp-actionbar'>
<input type='submit' class='realbutton' value='{$button}' />
</div>
</div>
</form>
<script type='text/javascript'>
document.observe("dom:loaded", function(){
var autocomplete = new ipb.Autocomplete( $('feed_member_id'), { multibox: false, url: acp.autocompleteUrl, templates: { wrap: acp.autocompleteWrap, item: acp.autocompleteItem } } );
});
</script>
HTML;
//--endhtml--//
return $IPBHTML;
}
/**
* List of feeds
*
* @access public
* @param array Feeds
* @param array Calendars
* @return string HTML
*/
public function feedsList( $feeds, $calendars ) {
$IPBHTML = "";
//--starthtml--//
$IPBHTML .= <<<HTML
<div class='section_title'>
<h2>{$this->lang->words['c_title']}</h2>
<div class='ipsActionBar clearfix'>
<ul>
<li class='ipsActionButton'>
<a href='{$this->settings['base_url']}{$this->form_code}&amp;do=add' title='{$this->lang->words['feed_addlink']}'>
<img src='{$this->settings['skin_acp_url']}/images/icons/add.png' alt='' />
{$this->lang->words['feed_addlink']}
</a>
</li>
</ul>
</div>
</div>
<div class='acp-box'>
<h3>{$this->lang->words['feeds_for_import']}</h3>
<table class="ipsTable">
HTML;
if( count($feeds) )
{
foreach( $feeds as $r )
{
$IPBHTML .= <<<HTML
<tr class='ipsControlRow'>
<td>
<span class='larger_text'><a href='{$this->settings['base_url']}{$this->form_code}&amp;do=edit&amp;id={$r['feed_id']}'>{$r['feed_title']}</a></span>
</td>
<td class='col_buttons' nowrap="true">
<ul class='ipsControlStrip'>
<li class='i_edit'><a href='{$this->settings['base_url']}{$this->form_code}&amp;do=edit&amp;id={$r['feed_id']}'>{$this->lang->words['feed_editlink']}</a></li>
<li class='i_refresh'><a href='{$this->settings['base_url']}{$this->form_code}&amp;do=recache&amp;id={$r['feed_id']}'>{$this->lang->words['feed_recachelink']}</a></li>
<li class='i_delete'><a href='#' onclick='return acp.confirmDelete("{$this->settings['base_url']}{$this->form_code}&amp;do=delete&amp;id={$r['feed_id']}");'>{$this->lang->words['feed_deletelink']}</a></li>
</ul>
</td>
</tr>
HTML;
}
}
else
{
$IPBHTML .= <<<HTML
<tr>
<td colspan='2' class='no_messages'>
{$this->lang->words['no_feeds_yet']} <a href='{$this->settings['base_url']}{$this->form_code}&amp;do=add' class='mini_button'>{$this->lang->words['addfirstfeed']}</a>
</td>
</tr>
HTML;
}
$IPBHTML .= <<<HTML
</table>
</div>
<br />
<form action='{$this->settings['base_url']}{$this->form_code}&amp;do=import' method='post' enctype='multipart/form-data'>
<div class="acp-box">
<h3>{$this->lang->words['feed_ics_import']}</h3>
<table class='ipsTable double_pad'>
<tr>
<td class='field_title'>
<strong class='title'>{$this->lang->words['upload_ics_feed']}</strong>
</td>
<td class='field_field'><input type='file' name='FILE_UPLOAD' /><br /><span class='desctext'>{$this->lang->words['upload_ics_info']}</span></td>
</tr>
<tr>
<td class='field_title'>
<strong class='title'>{$this->lang->words['upload_ics_cal']}</strong>
</td>
<td class='field_field'>
<select name='calendar_id' class='dropdown'>
HTML;
foreach( $calendars as $calendar )
{
$IPBHTML .= "<option value='{$calendar['cal_id']}'>{$calendar['cal_title']}</option>";
}
$IPBHTML .= <<<HTML
</select>
<br /><span class='desctext'>{$this->lang->words['upload_ics_calinfo']}</span>
</td>
</tr>
<tr>
<td class='field_title'>
<strong class='title'>{$this->lang->words['upload_ics_user']}</strong>
</td>
<td class='field_field'><input type='text' autocomplete='off' name='member_name' id='feed_member_name' class='textinput' size='30' value='{$this->memberData['members_display_name']}' /><br /><span class='desctext'>{$this->lang->words['upload_ics_useri']}</span></td>
</tr>
</table>
<div class="acp-actionbar">
<input type='submit' value='{$this->lang->words['feed_ics_upload']}' class="button primary" />
</div>
</div>
</form>
<script type='text/javascript'>
document.observe("dom:loaded", function(){
var autocomplete = new ipb.Autocomplete( $('feed_member_name'), { multibox: false, url: acp.autocompleteUrl, templates: { wrap: acp.autocompleteWrap, item: acp.autocompleteItem } } );
});
</script>
HTML;
//--endhtml--//
return $IPBHTML;
}
}
@@ -0,0 +1,10 @@
<html>
<head><title>IP.Board - Bulletin Board System</title></head>
<body>
<h1>403: IP.Board -&gt; Forbidden</h1>
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
</html>
@@ -0,0 +1,484 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.4.5
* Calendar cache functions
* Last Updated: $Date: 2013-01-03 17:27:27 -0500 (Thu, 03 Jan 2013) $
* </pre>
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Calendar
* @link http://www.invisionpower.com
* @since 5th January 2005
* @version $Revision: 11781 $
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly.";
exit();
}
class calendar_cache
{
/**#@+
* Registry objects
*
* @access protected
* @var object
*/
protected $registry;
protected $DB;
protected $settings;
protected $request;
protected $lang;
protected $member;
protected $memberData;
protected $cache;
protected $caches;
/**#@-*/
/**
* Constructor
*
* @param object $registry Registry object
* @return @e void
*/
public function __construct( ipsRegistry $registry )
{
/* Make object */
$this->registry = $registry;
$this->DB = $this->registry->DB();
$this->settings =& $this->registry->fetchSettings();
$this->request =& $this->registry->fetchRequest();
$this->lang = $this->registry->getClass('class_localization');
$this->member = $this->registry->member();
$this->memberData =& $this->registry->member()->fetchMemberData();
$this->cache = $this->registry->cache();
$this->caches =& $this->registry->cache()->fetchCaches();
}
/**
* Rebuild calendar RSS cache
*
* @param mixed [$calendar_id] "all", or a specific calendar ID
* @return string RSS document
*/
public function rebuildCalendarRSSCache( $calendar_id='all' )
{
//-----------------------------------------
// Ensure calendar is installed
//-----------------------------------------
if( !$this->DB->checkForTable('cal_calendars') )
{
return '';
}
if( ! IPSLib::appIsInstalled( 'calendar' ) )
{
$this->cache->setCache( 'rss_calendar', array(), array( 'donow' => 1, 'array' => 1 ) );
return '';
}
//-----------------------------------------
// Init
//-----------------------------------------
$seenids = array();
$cache = array();
//--------------------------------------------
// Get classes
//--------------------------------------------
$classToLoad = IPSLib::loadActionOverloader( IPSLib::getAppDir( 'calendar' ) . '/modules_public/calendar/view.php', 'public_calendar_calendar_view' );
$calendar = new $classToLoad( $this->registry );
$calendar->makeRegistryShortcuts( $this->registry );
if( !$calendar->initCalendar( true, true ) )
{
return '';
}
$classToLoad = IPSLib::loadLibrary( IPS_KERNEL_PATH . 'classRss.php', 'classRss' );
$class_rss = new $classToLoad();
$class_rss->doc_type = IPS_DOC_CHAR_SET;
//-----------------------------------------
// Get calendars that support RSS and loop
//-----------------------------------------
$this->DB->build( array(
'select' => 'c.*',
'from' => array( 'cal_calendars' => 'c' ),
'where' => 'c.cal_rss_export_days > 0 AND c.cal_rss_export_max > 0 AND c.cal_rss_export=1',
'add_join' => array(
array(
'select' => 'p.*',
'from' => array( 'permission_index' => 'p' ),
'where' => "p.perm_type='calendar' AND perm_type_id=c.cal_id",
'type' => 'left'
)
)
) );
$outer = $this->DB->execute();
while( $row = $this->DB->fetch( $outer ) )
{
$row['cal_rss_export_max'] = $row['cal_rss_export_max'] ? $row['cal_rss_export_max'] : 10;
if ( $row['cal_rss_export'] )
{
$cache[] = array( 'url' => $this->settings['board_url'] . '/index.php?app=core&amp;module=global&amp;section=rss&amp;type=calendar&amp;id=' . $row['cal_id'], 'title' => $row['cal_title'] );
}
//-----------------------------------------
// Are we including events from this calendar?
//-----------------------------------------
if( $calendar_id == $row['cal_id'] OR $calendar_id == 'all' )
{
//-----------------------------------------
// Start channel
//-----------------------------------------
$channel_id = $class_rss->createNewChannel( array(
'title' => $row['cal_title'],
'link' => $this->registry->output->buildSEOUrl( 'app=calendar&amp;module=calendar&amp;section=view&amp;cal_id=' . $row['cal_id'], 'publicNoSession', $row['cal_title_seo'], 'cal_calendar' ),
'pubDate' => $class_rss->formatDate( time() ),
'ttl' => $row['cal_rss_update'] * 60,
'description' => $row['cal_title']
) );
//-----------------------------------------
// Verify if guests can view
//-----------------------------------------
if( !$this->registry->permissions->check( 'view', $row, explode( ',', IPSText::cleanPermString( $this->caches['group_cache'][ $this->settings['guest_group'] ]['g_perm_id'] ) ) ) )
{
continue;
}
//-----------------------------------------
// Sort out date stuff
//-----------------------------------------
$row['cal_rss_export_days'] = intval($row['cal_rss_export_days']) + 1;
$startTime = gmmktime( 0,0,0, gmstrftime( '%m' ), 1 );
$endTime = gmmktime( 0,0,0, gmstrftime( '%m' ), gmstrftime( '%d' ) + $row['cal_rss_export_days'] );
$nowTime = gmmktime( 0,0,0, gmstrftime( '%m' ), gmstrftime( '%d' ) - 1 );
$items = 0;
list( $month, $day, $year ) = explode( '-', gmstrftime( '%m-%d-%Y' ) );
//-----------------------------------------
// Get the events
//-----------------------------------------
$calendar->calendarGetEventsSQL( $month, $year, array( 'timenow' => $startTime, 'timethen' => $endTime, 'cal_id' => $row['cal_id'] ) );
//--------------------------------------------
// Loop through events and cache
//--------------------------------------------
for( $i = 0 ; $i <= $row['cal_rss_export_days'] ; $i++ )
{
list( $_month, $_day, $_year ) = explode( '-', gmstrftime( '%m-%d-%Y', $nowTime ) );
$eventcache = $calendar->calendarGetDayEvents( $_month, $_day, $_year );
foreach( $eventcache as $event )
{
//-----------------------------------------
// Hit our max?
//-----------------------------------------
if ( $row['cal_rss_export_max'] <= $items )
{
break;
}
//-----------------------------------------
// Can guests access?
//-----------------------------------------
$permissionGroups = explode( ',', IPSText::cleanPermString( $event['event_perms'] ) );
if ( !$event['event_approved'] OR $event['event_private'] OR ( $event['event_perms'] != '*' AND !IPSMember::isInGroup( array( 'member_group_id' => $this->settings['guest_group'] ), $permissionGroups ) ) )
{
continue;
}
//-----------------------------------------
// Check the event and add it
//-----------------------------------------
if ( !in_array( $event['event_id'], $seenids ) )
{
if ( !$event['event_recurring'] OR $calendar->checkRecurring( $event, $_month, $_day, $_year ) )
{
$event = $calendar->calendarMakeEventHTML( $event, true );
if ( $event['event']['recurring'] )
{
$event['event']['event_content'] = $this->registry->output->getTemplate('calendar')->calendar_rss_recurring( $event['event'] );
}
else if ( $event['event']['single'] )
{
$event['event']['event_content'] = $this->registry->output->getTemplate('calendar')->calendar_rss_single( $event['event'] );
}
else
{
$event['event']['event_content'] = $this->registry->output->getTemplate('calendar')->calendar_rss_range( $event['event'] );
}
//-----------------------------------------
// Re-adjust the event time for the RSS feed
// to represent the next occurrence of recurring
// and ranged events
//-----------------------------------------
if( $event['event']['event_recurring'] )
{
$_incrementor = 0;
switch( $event['event']['event_recurring'] )
{
case 1:
$_incrementor = 604800;
break;
case 2:
$_incrementor = 2592000;
break;
case 3:
$_incrementor = 31536000;
break;
}
if( $event['event']['_start_time'] < gmmktime( 0 ) )
{
while( $event['event']['_start_time'] < gmmktime( 0 ) )
{
$event['event']['_start_time'] += $_incrementor;
}
}
}
//-----------------------------------------
// Ranged events
//-----------------------------------------
else if( $event['event']['_end_time'] )
{
if( $event['event']['_start_time'] < gmmktime( 0 ) AND $event['event']['_end_time'] > gmmktime( 0 ) )
{
while( $event['event']['_start_time'] < gmmktime( 0 ) )
{
$event['event']['_start_time'] += 86400;
}
}
}
//-----------------------------------------
// Add to the channel
//-----------------------------------------
$class_rss->addItemToChannel( $channel_id, array(
'title' => $event['event']['event_title'],
'link' => $this->registry->output->buildSEOUrl( 'app=calendar&amp;module=calendar&amp;section=view&amp;do=showevent&amp;event_id=' . $event['event']['event_id'], 'publicNoSession', $event['event']['event_title_seo'], 'cal_event' ),
'description' => $event['event']['event_content'],
'pubDate' => $class_rss->formatDate( $event['event']['_start_time'] ),
'guid' => $event['event']['event_id']
) );
}
//-----------------------------------------
// Increment counters and cache event
//-----------------------------------------
$seenids[ $event['event']['event_id'] ] = $event['event']['event_id'];
$items++;
}
}
$nowTime += 86400;
}
//-----------------------------------------
// Create RSS document
//-----------------------------------------
$class_rss->createRssDocument();
//-----------------------------------------
// Update calendar RSS cache
//-----------------------------------------
$this->DB->update( 'cal_calendars', array( 'cal_rss_update_last' => time(), 'cal_rss_cache' => $class_rss->rss_document ), 'cal_id=' . $row['cal_id'] );
}
}
//-----------------------------------------
// Update cache and return RSS document
//-----------------------------------------
$this->cache->setCache( 'rss_calendar', $cache, array( 'donow' => 1, 'array' => 1 ) );
return $class_rss->rss_document;
}
/**
* Rebuild upcoming events cache
*
* @return @e void
*/
public function rebuildCalendarEventsCache()
{
//-----------------------------------------
// Ensure calendar is installed
//-----------------------------------------
if( !$this->DB->checkForTable('cal_calendars') )
{
return;
}
if( ! IPSLib::appIsInstalled( 'calendar' ) )
{
$this->cache->setCache( 'calendar_events', array(), array( 'array' => 1 ) );
$this->cache->setCache( 'birthdays', array(), array( 'array' => 1 ) );
return;
}
//-----------------------------------------
// Init
//-----------------------------------------
$this->settings['calendar_limit'] = ( intval( $this->settings['calendar_limit'] ) < 2 ? 1 : intval( $this->settings['calendar_limit'] ) ) + 1;
$birthdays = array();
$events = array();
$calendars = $this->cache->getCache('calendars');
$seenids = array();
//--------------------------------------------
// Set time stuff
//--------------------------------------------
$startTime = gmmktime( 0,0,0, gmstrftime( '%m' ), 1 );
$endTime = gmmktime( 0,0,0, gmstrftime( '%m' ), gmstrftime( '%d' ) + $this->settings['calendar_limit'] );
$nowTime = gmmktime( 0,0,0, gmstrftime( '%m' ), gmstrftime( '%d' ) - 1 );
list( $month, $day, $year ) = explode( '-', gmstrftime( '%m-%d-%Y' ) );
list( $last_month, $last_day, $last_year ) = explode( '-', gmstrftime( '%m-%d-%Y', $nowTime ) );
list( $next_month, $next_day, $next_year ) = explode( '-', gmstrftime( '%m-%d-%Y', gmmktime( 0,0,0, gmstrftime( '%m' ), gmstrftime( '%d' ) + 1 ) ) );
//--------------------------------------------
// Get classes
//--------------------------------------------
$classToLoad = IPSLib::loadActionOverloader( IPSLib::getAppDir( 'calendar' ) . '/modules_public/calendar/view.php', 'public_calendar_calendar_view' );
$calendar = new $classToLoad( $this->registry );
$calendar->makeRegistryShortcuts( $this->registry );
if( !$calendar->initCalendar( true, true ) )
{
$this->cache->setCache( 'calendar_events' , array(), array( 'array' => 1 ) );
$this->cache->setCache( 'birthdays', array(), array( 'array' => 1 ) );
return;
}
//--------------------------------------------
// Load the events
//--------------------------------------------
$calendar->calendarGetEventsSQL( $month, $year, array( 'timenow' => $startTime, 'timethen' => $endTime, 'minimal' => true, 'no_date_convert' => true ) );
//--------------------------------------------
// Loop through events and cache
//--------------------------------------------
for( $i = 0 ; $i <= $this->settings['calendar_limit'] ; $i++ )
{
list( $_month, $_day, $_year ) = explode( '-', gmstrftime( '%m-%d-%Y', $nowTime ) );
$eventcache = $calendar->calendarGetDayEvents( $_month, $_day, $_year );
foreach( $eventcache as $event )
{
if ( $event['event_approved'] AND !in_array( $event['event_id'], $seenids ) )
{
if ( !$event['event_recurring'] OR $calendar->checkRecurring( $event, $_month, $_day, $_year ) )
{
unset( $event['event_content'], $event['event_smilies'] );
$event['perm_view'] = $calendars[ $event['event_calendar_id'] ]['perm_view'];
$events[ $event['event_id'] ] = $event;
}
$seenids[ $event['event_id'] ] = $event['event_id'];
}
}
$nowTime += 86400;
}
//-----------------------------------------
// Grab birthdays
//-----------------------------------------
$append_string = "";
if( !gmdate("L") )
{
if( $month == 2 AND $day > 26 )
{
$append_string = " OR ( bday_month=2 AND bday_day=29 )";
}
}
$_days = array();
$this->DB->build( array(
'select' => 'member_id, members_seo_name, members_display_name, member_group_id, bday_day, bday_month, bday_year',
'from' => 'members',
'where' => "member_banned=0 AND ( !" . IPSBWOptions::sql( 'bw_is_spammer', 'members_bitoptions', 'members', 'global', 'has' ) . ")
AND ( ( bday_day={$last_day} AND bday_month={$last_month} )
OR ( bday_day={$day} AND bday_month={$month} )
OR ( bday_day={$next_day} AND bday_month={$next_month} ) {$append_string} )"
) );
$this->DB->execute();
while( $r = $this->DB->fetch() )
{
/* Only allow 6 per day, then the "upcoming birthdays" can display 5 and know there are more to display */
$_days[ $r['bday_month'] . '.' . $r['bday_day'] ]++;
if( $_days[ $r['bday_month'] . '.' . $r['bday_day'] ] > 6 )
{
continue;
}
$birthdays[ $r['member_id'] ] = $r;
}
//--------------------------------------------
// Update calendar array
//--------------------------------------------
$this->cache->setCache( 'calendar_events' , $events, array( 'array' => 1 ) );
$this->cache->setCache( 'birthdays', $birthdays, array( 'array' => 1 ) );
}
}
@@ -0,0 +1,293 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.4.5
* Calendar functions
* Last Updated: $Date: 2013-03-20 17:00:11 -0400 (Wed, 20 Mar 2013) $
* </pre>
*
* @author $Author: AndyMillne $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Calendar
* @link http://www.invisionpower.com
* @since 5th January 2005
* @version $Revision: 12096 $
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly.";
exit();
}
class app_calendar_classes_functions
{
/**#@+
* Registry objects
*
* @access protected
* @var object
*/
protected $registry;
protected $DB;
protected $settings;
protected $request;
protected $lang;
protected $member;
protected $memberData;
protected $cache;
protected $caches;
/**#@-*/
/**
* Current calendar ID
*
* @var int
*/
protected $calendarId;
/**
* Calendar arrays (permissions checked)
*
* @var array
*/
protected $calendars = array();
/**
* Constructor
*
* @param object Registry object
* @param bool Ignore permission check
* @param bool Return instead of throwing an error
* @return @e bool Initiated successfully
*/
public function __construct( ipsRegistry $registry, $ignorePermissions=false, $return=false )
{
/* Make object */
$this->registry = $registry;
$this->DB = $this->registry->DB();
$this->settings =& $this->registry->fetchSettings();
$this->request =& $this->registry->fetchRequest();
$this->lang = $this->registry->getClass('class_localization');
$this->member = $this->registry->member();
$this->memberData =& $this->registry->member()->fetchMemberData();
$this->cache = $this->registry->cache();
$this->caches =& $this->registry->cache()->fetchCaches();
//-----------------------------------------
// Make sure calendar app is installed
// (this is primarily here for API methods)
//-----------------------------------------
if( ! IPSLib::appIsInstalled( 'calendar' ) AND ( !defined('IPS_IS_INSTALLER') OR !IPS_IS_INSTALLER ) AND ( !defined('IPS_IS_UPGRADER') OR !IPS_IS_UPGRADER ) )
{
if( $return )
{
return false;
}
$this->registry->output->showError( 'no_permission', 1076, null, null, 404 );
}
//-----------------------------------------
// Check cache
//-----------------------------------------
if( ! count( $this->caches['calendars'] ) )
{
$this->cache->rebuildCache( 'calendars', 'calendar' );
}
//-----------------------------------------
// Loop through, check perms, etc.
//-----------------------------------------
$_noPermission = array();
if ( count( $this->caches['calendars'] ) AND is_array( $this->caches['calendars'] ) )
{
foreach( $this->caches['calendars'] as $cal_id => $cal )
{
//-----------------------------------------
// Automatic FURL fix
//-----------------------------------------
if( !$cal['cal_title_seo'] )
{
$cal['cal_title_seo'] = IPSText::makeSeoTitle( $cal['cal_title'] );
$this->DB->update( 'cal_calendars', array( 'cal_title_seo' => $cal['cal_title_seo'] ), 'cal_id=' . $cal_id );
}
//-----------------------------------------
// Check permissions
//-----------------------------------------
if( !$this->registry->permissions->check( 'view', $cal ) AND !$ignorePermissions )
{
$_noPermission[] = $cal['cal_id'];
continue;
}
$this->calendars[ $cal['cal_id'] ] = $cal;
}
}
//-----------------------------------------
// What calendar are we requesting?
//-----------------------------------------
if( is_string( $this->request['cal_id'] ) AND !empty($this->request['cal_id']) AND isset( $this->calendars[ $this->request['cal_id'] ] ) )
{
$this->calendarId = intval($this->request['cal_id']);
}
else if( !empty($this->request['cal_id']) AND !IN_ACP )
{
//-----------------------------------------
// Calendar requested but it's not in $this->calendars
// Either the cal_id doesn't exist, or user does not have view permissions
//-----------------------------------------
if( $return )
{
return false;
}
$_header = ( !empty($this->request['cal_id']) AND in_array( $this->request['cal_id'], $_noPermission ) ) ? 403 : 404;
$this->registry->output->showError( 'cal_no_perm', 1040, null, null, $_header );
}
else
{
$this->calendarId = ( is_array( $this->calendars ) ) ? key( $this->calendars ) : 0;
}
return true;
}
/**
* Get calendar array
*
* @param integer [$calendar_id] Optional calendar ID to retrieve, otherwise defaults to calendar id in request, or default calendar set by admin
* @return array
*/
public function getCalendar( $calendar_id=0 )
{
return $this->calendars[ !empty($calendar_id) ? ( isset( $this->calendars[ $calendar_id ] ) ? $calendar_id : $this->calendarId ) : $this->calendarId ];
}
/**
* Get all calendars
*
* @return array
*/
public function getCalendars()
{
return $this->calendars;
}
/**
* Get calendar jump menu
*
* @param int [$cal_id] Default calendar ID to select
* @param array [$extra] Additional permission bits to check
* @return string
*/
public function getCalendarJump( $selected=0, $extra=array() )
{
$return = "";
foreach( $this->calendars as $calendar )
{
//-----------------------------------------
// Check any extra permissions
//-----------------------------------------
if( is_array($extra) AND count($extra) )
{
foreach( $extra as $_bit )
{
if( !$this->registry->permissions->check( $_bit, $calendar ) )
{
continue 2;
}
}
}
$return .= "<option value='{$calendar['cal_id']}'" . ( $selected == $calendar['cal_id'] ? " selected='selected'" : '' ) . ">{$calendar['cal_title']}</option>\n";
}
return $return;
}
/**
* Return an HTML options list of days
*
* @param integer $day Default selected day
* @return string HTML options
*/
public function returnDayDropdown( $day=0 )
{
$return = "";
$day = intval($day);
for( $x = 1 ; $x <= 31 ; $x++ )
{
$return .= "\t<option value='" . $x . "'" . ( $x == $day ? " selected='selected'" : "" ) . ">" . $x . "</option>\n";
}
return $return;
}
/**
* Returns an HTML options list of months
*
* @param integer $month Month to select by default
* @return string HTML options
*/
public function returnMonthDropdown( $month=0 )
{
$return = "";
$month = intval($month);
for( $x = 1 ; $x <= 12 ; $x++ )
{
$return .= "\t<option value='" . $x . "'" . ( $x == $month ? " selected='selected'" : "" ) . ">" . gmstrftime( '%B', gmmktime( 0, 0, 0, $x, 15 ) ) . "</option>\n";
}
return $return;
}
/**
* Builds a year dropdown
*
* @param integer $year Year to select by default
* @return string HTML dropdown
*/
public function returnYearDropdown( $year=0 )
{
$return = "";
$year = intval($year);
$this->settings['start_year'] = $this->settings['start_year'] ? ( $this->settings['start_year'] <= gmstrftime('%Y') ? $this->settings['start_year'] : gmstrftime('%Y') - 2 ) : gmstrftime('%Y') - 2;
$this->settings['year_limit'] = $this->settings['year_limit'] ? $this->settings['year_limit'] : 5;
if( $this->settings['start_year'] + $this->settings['year_limit'] < gmstrftime('%Y') )
{
$this->settings['year_limit'] = gmstrftime('%Y') - $this->settings['start_year'];
}
for( $x = $this->settings['start_year'], $xy = $this->settings['start_year'] + $this->settings['year_limit'] ; $x <= $xy ; $x++ )
{
$return .= "\t<option value='" . $x . "'" . ( $x == $year ? " selected='selected'" : "" ) . ">" . $x . "</option>\n";
}
return $return;
}
}
@@ -0,0 +1,384 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.4.5
* Calendar hook function gateway
* Last Updated: $Date: 2013-03-25 20:42:22 -0400 (Mon, 25 Mar 2013) $
* </pre>
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Calendar
* @link http://www.invisionpower.com
* @since 5th January 2005
* @version $Revision: 12119 $
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly.";
exit();
}
class app_calendar_classes_hooks
{
/**#@+
* Registry objects
*
* @access protected
* @var object
*/
protected $registry;
protected $DB;
protected $settings;
protected $request;
protected $lang;
protected $member;
protected $memberData;
protected $cache;
protected $caches;
/**#@-*/
/**
* Constructor
*
* @param object Registry object
* @param bool Ignore permission check
* @return @e void
*/
public function __construct( ipsRegistry $registry, $ignorePermissions=false )
{
/* Make object */
$this->registry = $registry;
$this->DB = $this->registry->DB();
$this->settings =& $this->registry->fetchSettings();
$this->request =& $this->registry->fetchRequest();
$this->lang = $this->registry->getClass('class_localization');
$this->member = $this->registry->member();
$this->memberData =& $this->registry->member()->fetchMemberData();
$this->cache = $this->registry->cache();
$this->caches =& $this->registry->cache()->fetchCaches();
$this->lang->loadLanguageFile( array( 'public_calendar' ), 'calendar' );
}
/**
* Retrieve upcoming birthdays
*
* @return @e string
* @note The recache function will recache up to 6 each day. That fulfills the 5 that are displayed + 1 more to know if we should show a link to view all.
*/
public function getUpcomingBirthdays()
{
if ( !$this->settings['show_birthdays'] OR !IPSLib::appIsInstalled( 'calendar' ) )
{
return '';
}
$a = explode( ',', gmdate( 'Y,n,j,G,i,s', time() + $this->registry->getClass('class_localization')->getTimeOffset() ) );
$day = $a[2];
$month = $a[1];
$year = $a[0];
$birthstring = "";
$count = 0;
$lang = '';
$users = array();
$fetch = 5;
if ( is_array($this->caches['birthdays']) AND count( $this->caches['birthdays'] ) )
{
$_users = IPSMember::load( array_keys( $this->caches['birthdays'] ) );
foreach( $this->caches['birthdays'] as $u )
{
/* Age */
$pyear = 0;
$u = array_merge( $_users[ $u['member_id'] ], $u );
$u = IPSMember::buildDisplayData( $u );
if( $u['bday_year'] && $u['bday_year'] > 0 )
{
$pyear = $year - $u['bday_year'];
}
$u['_pyear'] = $pyear;
if ( $u['bday_day'] == $day and $u['bday_month'] == $month )
{
if( $count < $fetch )
{
$users[] = $u;
}
$count++;
}
else if( $day == 28 && $month == 2 && !date("L") )
{
if ( $u['bday_day'] == "29" and $u['bday_month'] == $month )
{
if( $count < $fetch )
{
$users[] = $u;
}
$count++;
}
}
}
}
//-----------------------------------------
// Get calendar info, but only if we need it
//-----------------------------------------
$data = array();
if( $count >= count($users) )
{
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'calendar' ) . "/sources/functions.php", 'app_calendar_classes_functions', 'calendar' );
$functions = new $classToLoad( $this->registry );
$calendars = $functions->getCalendars();
foreach( $calendars as $calendar )
{
/* We need to grab first calendar that allows birthdays */
if( !$calendar['cal_bday_limit'] )
{
continue;
}
$data = array(
'id' => $calendar['cal_id'],
'title' => $calendar['cal_title_seo'],
'year' => $year,
'month' => $month,
'day' => $day,
'count' => $count,
);
break;
}
}
if( $count >= count($users) AND !count($data) )
{
return '';
}
//-----------------------------------------
// Spin and print...
//-----------------------------------------
return $this->registry->output->getTemplate('calendar')->boardIndexBirthdays( $users, $data );
}
/**
* Retrieve upcoming events
*
* @return string
*/
public function getUpcomingEvents()
{
//-----------------------------------------
// Make sure calendar app is installed
//-----------------------------------------
if( !$this->settings['show_calendar'] OR !IPSLib::appIsInstalled( 'calendar' ) )
{
return '';
}
//-----------------------------------------
// Get current date data
//-----------------------------------------
$a = explode( ',', gmdate( 'Y,n,j,G,i,s', time() + $this->registry->class_localization->getTimeOffset() ) );
$day = $a[2];
$month = $a[1];
$year = $a[0];
//-----------------------------------------
// Check calendar limit
//-----------------------------------------
$this->settings['calendar_limit'] = intval( $this->settings['calendar_limit'] ) < 2 ? 1 : intval( $this->settings['calendar_limit'] );
$our_unix = gmmktime( 0, 0, 0, $month, $day, $year);
$max_date = $our_unix + ($this->settings['calendar_limit'] * 86400);
$events = array();
$show_events = array();
//-----------------------------------------
// Loop over the cache
//-----------------------------------------
if( is_array( $this->caches['calendar_events'] ) AND count( $this->caches['calendar_events'] ) )
{
foreach( $this->caches['calendar_events'] as $u )
{
//-----------------------------------------
// Private?
//-----------------------------------------
if ( $u['event_private'] == 1 and $this->memberData['member_id'] != $u['event_member_id'] )
{
continue;
}
//-----------------------------------------
// Got perms?
//-----------------------------------------
if( $u['event_perms'] != '*' )
{
$permissionGroups = explode( ',', IPSText::cleanPermString( $u['event_perms'] ) );
if( !IPSMember::isInGroup( $this->memberData, $permissionGroups ) )
{
continue;
}
}
//-----------------------------------------
// Got calendar perms?
//-----------------------------------------
if( !$this->registry->permissions->check( 'view', $u ) )
{
continue;
}
//-----------------------------------------
// Times and dates
//-----------------------------------------
$u['isoDate'] = gmdate( 'c', strtotime( $u['event_start_date'] ) );
$u['_start_time'] = strtotime( $u['event_start_date'] );
$u['_end_time'] = ( $u['event_end_date'] AND $u['event_end_date'] != '0000-00-00 00:00:00' ) ? strtotime( $u['event_end_date'] ) : 0;
if( !$u['event_all_day'] )
{
if( $this->memberData['member_id'] AND $this->memberData['time_offset'] )
{
$u['_start_time'] = $u['_start_time'] + ( $this->memberData['time_offset'] * 3600 );
}
else if( !$this->memberData['member_id'] AND $this->settings['time_offset'] )
{
$u['_start_time'] = $u['_start_time'] + ( $this->settings['time_offset'] * 3600 );
}
if( $this->memberData['member_id'] AND $this->memberData['time_offset'] )
{
$u['_end_time'] = $u['_end_time'] ? ( $u['_end_time'] + ( $this->memberData['time_offset'] * 3600 ) ) : 0;
}
else if( !$this->memberData['member_id'] AND $this->settings['time_offset'] )
{
$u['_end_time'] = $u['_end_time'] ? ( $u['_end_time'] + ( $this->settings['time_offset'] * 3600 ) ) : 0;
}
}
//-----------------------------------------
// In range?
//-----------------------------------------
if ( !$u['event_recurring'] AND ( ( $u['_end_time'] >= $our_unix AND $u['_start_time'] <= $max_date )
OR ( !$u['_end_time'] AND $u['_start_time'] >= $our_unix AND $u['_start_time'] <= $max_date ) ) )
{
if( $u['_end_time'] )
{
if( $u['_start_time'] < gmmktime( 0 ) )
{
$u['_start_time'] = gmmktime( 0 );
}
}
$events[ str_pad( $u['_start_time'].$u['event_id'], 15, "0" ) ] = $u;
}
elseif( $u['event_recurring'] > 0 )
{
$cust_range_s = $u['_start_time'];
while( $cust_range_s <= $u['_end_time'] )
{
if( $cust_range_s >= $our_unix AND $cust_range_s <= $max_date )
{
//-----------------------------------------
// Special case for "monthly" to ensure it lands on the same day
//-----------------------------------------
if ( $u['event_recurring'] != 1 )
{
$u['_start_time'] = gmmktime( 1, 1, 1, gmdate( 'n', $cust_range_s ), gmdate( 'j', $u['_start_time'] ), gmdate( 'Y', $cust_range_s ) );
}
else
{
$u['_start_time'] = $cust_range_s;
}
$events[ str_pad( $u['_start_time'] . $u['event_id'], 15, "0" ) ] = $u;
}
if( $u['event_recurring'] == 1 )
{
$cust_range_s += 604800;
}
elseif ( $u['event_recurring'] == 2 )
{
$cust_range_s += 2628000;
}
else
{
$cust_range_s += 31536000;
}
}
}
}
}
//-----------------------------------------
// Sort and format
//-----------------------------------------
ksort($events);
foreach( $events as $event )
{
//-----------------------------------------
// Recurring?
//-----------------------------------------
$c_time = gmstrftime( '%x', $event['_start_time'] );
$url = $this->registry->output->buildSEOUrl( "app=calendar&amp;module=calendar&amp;section=view&amp;do=showevent&amp;event_id={$event['event_id']}", 'public', $event['event_title_seo'], 'cal_event' );
$show_events[] = array( 'url' => $url, 'isoDate' => $event['isoDate'], 'date' => $c_time, 'title' => $event['event_title'], 'calendar' => $this->caches['calendars'][ $event['event_calendar_id'] ] );
}
//-----------------------------------------
// Send output to template and return HTML
//-----------------------------------------
$this->lang->words['calender_f_title'] = sprintf( $this->lang->words['calender_f_title'], $this->settings['calendar_limit'] );
if ( count($show_events) > 0 )
{
$event_string = $show_events;
}
else
{
if ( ! $this->settings['autohide_calendar'] )
{
$event_string = $this->lang->words['no_calendar_events'];
}
}
return $this->registry->output->getTemplate('calendar')->boardIndexCalEvents( $event_string );
}
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,10 @@
<html>
<head><title>IP.Board - Bulletin Board System</title></head>
<body>
<h1>403: IP.Board -&gt; Forbidden</h1>
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
</html>
@@ -0,0 +1,100 @@
<?php
/**
* @file calendarevents.php Task to gather birthday and calendar events for a few days and cache them
*~TERABYTE_DOC_READY~
* $Copyright: (c) 2001 - 2011 Invision Power Services, Inc.$
* $License: http://www.invisionpower.com/company/standards.php#license$
* $Author: ips_terabyte $
* @since -
* $LastChangedDate: 2011-02-08 17:20:18 -0500 (Tue, 08 Feb 2011) $
* @version v3.4.5
* $Revision: 7750 $
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
/**
*
* @class task_item
* @brief Task to gather birthday and calendar events for a few days and cache them
*
*/
class task_item
{
/**
* Object that stores the parent task manager class
*
* @var $class
*/
protected $class;
/**
* Array that stores the task data
*
* @var $task
*/
protected $task = array();
/**
* Registry Object Shortcuts
*
* @var $registry
* @var $lang
*/
protected $registry;
protected $lang;
/**
* Constructor
*
* @param object $registry Registry object
* @param object $class Task manager class object
* @param array $task Array with the task data
* @return @e void
*/
public function __construct( ipsRegistry $registry, $class, $task )
{
/* Make registry objects */
$this->registry = $registry;
$this->lang = $this->registry->getClass('class_localization');
$this->class = $class;
$this->task = $task;
}
/**
* Run this task
*
* @return @e void
*/
public function runTask()
{
$this->registry->getClass('class_localization')->loadLanguageFile( array( 'public_global' ), 'core' );
//-----------------------------------------
// Load and recache info
//-----------------------------------------
define( 'IN_ACP', 1 );
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir('calendar') . '/sources/cache.php' , 'calendar_cache', 'calendar' );
$calendars = new $classToLoad( $this->registry );
$calendars->rebuildCalendarEventsCache();
//-----------------------------------------
// Log to log table - modify but dont delete
//-----------------------------------------
$this->class->appendTaskLog( $this->task, $this->lang->words['task_calendars'] );
//-----------------------------------------
// Unlock Task: DO NOT MODIFY!
//-----------------------------------------
$this->class->unlockTask( $this->task );
}
}
@@ -0,0 +1,146 @@
<?php
/**
* @file importfeeds.php Task to reimport ical/webcal feeds
*~TERABYTE_DOC_READY~
* $Copyright: (c) 2001 - 2011 Invision Power Services, Inc.$
* $License: http://www.invisionpower.com/company/standards.php#license$
* $Author: ips_terabyte $
* @since 9th Feb 2011
* $LastChangedDate: 2011-03-31 06:17:44 -0400 (Thu, 31 Mar 2011) $
* @version v3.4.5
* $Revision: 8229 $
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
/**
*
* @class task_item
* @brief Task to reimport ical/webcal feeds
*
*/
class task_item
{
/**
* Object that stores the parent task manager class
*
* @var $class
*/
protected $class;
/**
* Array that stores the task data
*
* @var $task
*/
protected $task = array();
/**
* Registry Object Shortcuts
*
* @var $registry
* @var $DB
* @var $lang
*/
protected $registry;
protected $DB;
protected $lang;
/**
* Constructor
*
* @param object $registry Registry object
* @param object $class Task manager class object
* @param array $task Array with the task data
* @return @e void
*/
public function __construct( ipsRegistry $registry, $class, $task )
{
/* Make registry objects */
$this->registry = $registry;
$this->DB = $registry->DB();
$this->lang = $this->registry->getClass('class_localization');
$this->class = $class;
$this->task = $task;
}
/**
* Run this task
*
* @return @e void
*/
public function runTask()
{
$this->registry->getClass('class_localization')->loadLanguageFile( array( 'admin_calendar' ), 'calendar' );
//-----------------------------------------
// Load and recache info
//-----------------------------------------
$feed = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'cal_import_feeds', 'where' => "feed_next_run < " . time(), 'order' => 'feed_next_run ASC', 'limit' => array( 0, 1 ) ) );
if( !$feed['feed_id'] )
{
$this->class->unlockTask( $this->task );
return;
}
//-----------------------------------------
// Fetch the feed
//-----------------------------------------
$classToLoad = IPSLib::loadLibrary( IPS_KERNEL_PATH . 'classFileManagement.php', 'classFileManagement' );
$fetcher = new $classToLoad();
$content = $fetcher->getFileContents( str_replace( 'webcal://', 'http://', $feed['feed_url'] ) );
if( !$content )
{
$this->class->unlockTask( $this->task );
return;
}
//-----------------------------------------
// Send content to be processed
//-----------------------------------------
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir('calendar') . '/sources/icalendar.php', 'app_calendar_classes_icalendarOutput', 'calendar' );
$ical = new $classToLoad( $this->registry, $feed['feed_calendar_id'] );
$result = $ical->import( $content, $feed['feed_member_id'], $feed['feed_id'] );
//-----------------------------------------
// Show error if any
//-----------------------------------------
if( $error = $ical->getError() )
{
$this->class->appendTaskLog( $this->task, $error );
$this->class->unlockTask( $this->task );
return;
}
//-----------------------------------------
// Update last update date and next run date
//-----------------------------------------
$this->DB->update( 'cal_import_feeds', array( 'feed_lastupdated' => time(), 'feed_next_run' => time() + ( $feed['feed_recache_freq'] * 60 ) ), 'feed_id=' . $feed['feed_id'] );
//-----------------------------------------
// Log to log table - modify but dont delete
//-----------------------------------------
$this->class->appendTaskLog( $this->task, sprintf( $this->lang->words['feed_successwebcal'], $result['skipped'], $result['imported'] ) );
//-----------------------------------------
// Unlock Task: DO NOT MODIFY!
//-----------------------------------------
$this->class->unlockTask( $this->task );
}
}
@@ -0,0 +1,10 @@
<html>
<head><title>IP.Board - Bulletin Board System</title></head>
<body>
<h1>403: IP.Board -&gt; Forbidden</h1>
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
</html>
@@ -0,0 +1,605 @@
<?xml version="1.0" encoding="utf-8"?>
<languageexport>
<languagegroup>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>icali_badcontent</word_key>
<word_default>The content being imported does not appear to be a valid iCalendar feed.</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>icali_nomember</word_key>
<word_default>The member to import the event data under could not be loaded.</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>icali_nocontent</word_key>
<word_default>There was no content to import.</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>c_block_enable</word_key>
<word_default>RSS: Enable</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>perm_calendar_rsvp</word_key>
<word_default>RSVP Event</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>perm_calendar_comment</word_key>
<word_default>Comment Events</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>perm_calendar_rate</word_key>
<word_default>Rate Events</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>perm_calendar_nomod</word_key>
<word_default>Bypass Moderation</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>perm_calendar_start</word_key>
<word_default>Create Events</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>perm_calendar_view</word_key>
<word_default>Show Calendar</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>c_recachecal</word_key>
<word_default>Recache Calendar Events</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>c_addcal</word_key>
<word_default>Add New Calendar</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>c_deletecal</word_key>
<word_default>Delete Calendar...</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>c_rebuildcal</word_key>
<word_default>Rebuild Calendar RSS Export...</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>c_options</word_key>
<word_default>Options</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>c_calendars</word_key>
<word_default>Calendars</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>c_editcal</word_key>
<word_default>Edit Calendar...</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>c_block_rsvp</word_key>
<word_default>Allow un-RSVP?</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>c_block_rsvp_info</word_key>
<word_default>Enabling this setting allows users to remove their own RSVP status, and allows the event poster to remove attendees from an event.</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>c_block_limit</word_key>
<word_default>Event Limit</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>c_block_limit_info</word_key>
<word_default><![CDATA[This is the number of events listed per day before they are replaced by a single link to the day's events]]></word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>c_block_bday</word_key>
<word_default>Birthday Limit</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>perm_calendar_askrsvp</word_key>
<word_default>Request RSVP</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>c_block_freq</word_key>
<word_default>RSS: Update Frequency</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>c_block_freq_info</word_key>
<word_default>The number of minutes between RSS cache rebuilding</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>c_block_max</word_key>
<word_default>RSS: Export Maximum Events</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>c_block_max_info</word_key>
<word_default>The maximum number of events exported</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>c_block_forthcoming</word_key>
<word_default>RSS: Forthcoming Days</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>c_block_enable_info</word_key>
<word_default><![CDATA[If enabled, all <em>n</em> forthcoming events (based on GMT time) that have guest read permission will be exported]]></word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>c_block_rss</word_key>
<word_default>RSS Options</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>c_block_bday_info</word_key>
<word_default><![CDATA[This is the number of birthdays listed per day before they are replaced by a single link<br />Enter 0 to not show birthdays at all]]></word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>c_savebutton</word_key>
<word_default>Save Changes</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>c_title</word_key>
<word_default>Calendar Manager</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>c_rssrecached</word_key>
<word_default>Calendar Events RSS Recached</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>c_recached</word_key>
<word_default>Calendar Events Recached</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>c_block_title</word_key>
<word_default>Calendar Title</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>c_block_mod</word_key>
<word_default>Enable Moderation</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>c_block_mod_info</word_key>
<word_default><![CDATA[If enabled, all groups which are not included in the 'Bypass Moderation' will have to have their events approved before they are visible.]]></word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>c_block_modc</word_key>
<word_default>Enable Comment Moderation</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>c_block_modc_info</word_key>
<word_default>If enabled, all comments will require moderator approval before being visible.</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>c_editbutton</word_key>
<word_default>Edit Calendar </word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>c_edited</word_key>
<word_default>Calendar Edited</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>c_removed</word_key>
<word_default>Calendar Removed</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>c_added</word_key>
<word_default>New Calendar Added</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>c_completeform</word_key>
<word_default>You must complete the entire form.</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>c_noid</word_key>
<word_default>No ID was passed. Please try again.</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>feed_notfoundedit</word_key>
<word_default>We could not determine which feed you were attempting to edit.</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>feed_added</word_key>
<word_default>The new feed has been saved successfully</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>feed_updated</word_key>
<word_default>The feed has been successfully updated</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>feed_importremoved</word_key>
<word_default>The iCalendar feed import has been removed</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>feed_noiddel</word_key>
<word_default>We could not determine which feed you were attempting to delete.</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>feed_ics_upload</word_key>
<word_default>Import</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>feed_successwebcal</word_key>
<word_default>The feed has been successfully imported (%s events skipped and %s events imported).</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>feed_successimport</word_key>
<word_default>The iCalendar file has been successfully imported (%s events skipped and %s events imported).</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>feed_importwcalnone</word_key>
<word_default>There was a problem processing the calendar event data.</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>feed_importicsnone</word_key>
<word_default>There was a problem processing the uploaded event data.</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>no_feed_title</word_key>
<word_default>No title was supplied for this feed.</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>invalid_feed_url</word_key>
<word_default><![CDATA[The URL supplied for the feed must begin with 'http://', 'https://', or 'webcal://']]></word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>upload_ics_info</word_key>
<word_default>Use this form to upload calendar event data (in iCalendar format). iCalendar exports will usually have a .ics extension.</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>upload_ics_calinfo</word_key>
<word_default>Select the calendar to import the events to.</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>upload_ics_feed</word_key>
<word_default>Upload File</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>upload_ics_cal</word_key>
<word_default>Save To Calendar</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>feed_ics_import</word_key>
<word_default>Import Event Data</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>upload_ics_useri</word_key>
<word_default>Supply the member name you wish to save the events under</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>upload_ics_user</word_key>
<word_default>Member Name</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>feed_formmem</word_key>
<word_default>Member Name</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>feed_formmemi</word_key>
<word_default>Supply the member name you wish to save the events under</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>addfirstfeed</word_key>
<word_default>Add a feed</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>no_feeds_yet</word_key>
<word_default>There are no feeds yet</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>feed_addlink</word_key>
<word_default>Add Feed</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>feeds_for_import</word_key>
<word_default>Imported Feeds</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>feed_deletelink</word_key>
<word_default>Delete Feed...</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>feed_recachelink</word_key>
<word_default>Check For Updates...</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>feed_editlink</word_key>
<word_default>Edit Feed...</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>feed_freqinfo</word_key>
<word_default>The number of minutes that should pass before the feed is checked for new events. Minimum of 60.</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>feed_formfreq</word_key>
<word_default>Update Frequency</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>feed_urlinfo</word_key>
<word_default><![CDATA[A feed URL should start with 'http://', 'https://', or 'webcal://']]></word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>feed_calid</word_key>
<word_default>Save To Calendar</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>feed_calinfo</word_key>
<word_default>Select the calendar to save events imported from this feed to.</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>feed_notfoundrecache</word_key>
<word_default>We could not determine which feed you were attempting to recache.</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>feed_formurl</word_key>
<word_default>Feed URL</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>feed_formtitle</word_key>
<word_default>Feed Title</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>do_del_button</word_key>
<word_default>Delete Feed</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>ical_manager</word_key>
<word_default>Feed Management</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>feed_importicsmme</word_key>
<word_default>We could not determine which member you were attempting to import the event data under.</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>feed_editbutton</word_key>
<word_default>Save Feed</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>delete_events_too</word_key>
<word_default>Delete imported events?</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>feed_del_confirm_t</word_key>
<word_default>Confirm Feed Deletion</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>feed_edit_title</word_key>
<word_default>Edit Feed:</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>feed_addnewtext</word_key>
<word_default>Add New Feed</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>tab_permissions</word_key>
<word_default>Permissions</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_calendar</word_pack>
<word_key>cal_clearedminicals</word_key>
<word_default>Cleared out %s minical caches</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_menulang</word_pack>
<word_key>r__calendar_ical</word_key>
<word_default>Can import ical and webcal feeds?</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_menulang</word_pack>
<word_key>r__calendar_import</word_key>
<word_default>Import iCalendar Feeds</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_menulang</word_pack>
<word_key>r__calendar_delete</word_key>
<word_default>Can delete calendars?</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_menulang</word_pack>
<word_key>r__calendar_manage</word_key>
<word_default>Can add/edit calendars?</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_menulang</word_pack>
<word_key>r__calendar_mt</word_key>
<word_default>Calendar Management</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_menulang</word_pack>
<word_key>menu__cal_settings</word_key>
<word_default>Calendar Settings</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_menulang</word_pack>
<word_key>menu__icalendar</word_key>
<word_default>Import iCalendar Feeds</word_default>
</lang>
<lang>
<word_app>calendar</word_app>
<word_pack>admin_menulang</word_pack>
<word_key>menu__calendars</word_key>
<word_default>Calendar Management</word_default>
</lang>
</languagegroup>
</languageexport>
Loaded 100 of 920 files, more files were not shown because too many files have changed in this diff. Show more