Version 3.4.9
This commit is contained in:
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 -> 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§ion=view&do=showevent&event_id=%s",
|
||||
'urls-report' => $this->getReportLibrary()->canReport( 'calendar' ) ? "app=core&module=reports&rcom=calendar&comment_id=%s&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 -> 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>
|
||||
+692
@@ -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( "$r['url']", $this->lang->words['block_feed__calurl'] ),
|
||||
'date' => array( "$r['date']", $this->lang->words['block_feed__caldate'] ),
|
||||
'title' => array( "$r['title']", $this->lang->words['block_feed__caltitle'] ),
|
||||
'content' => array( "$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( "$r['" . $_column . "']", $this->lang->words['col__cal_events_' . $_column ] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$_noinfoColumns[ $_column ] = array( "$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( "$r['" . $_column . "']", $this->lang->words['col__cal_calendars_' . $_column ] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$_noinfoColumns[ $_column ] = array( "$r['" . $_column . "']", $this->lang->words['notaghelpinfoavailable'], true );
|
||||
}
|
||||
}
|
||||
|
||||
return array(
|
||||
$this->lang->words['block_feed__generic'] => array(
|
||||
array( '$title', $this->lang->words['block_feed__title'] ) ,
|
||||
),
|
||||
|
||||
$this->lang->words['block_feed_calendar'] => array(
|
||||
array( '$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&module=calendar&section=view&do=showevent&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;
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
<html>
|
||||
<head><title>IP.Board - Bulletin Board System</title></head>
|
||||
<body>
|
||||
<h1>403: IP.Board -> 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 -> 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>
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
<html>
|
||||
<head><title>IP.Board - Bulletin Board System</title></head>
|
||||
<body>
|
||||
<h1>403: IP.Board -> 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>
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
<html>
|
||||
<head><title>IP.Board - Bulletin Board System</title></head>
|
||||
<body>
|
||||
<h1>403: IP.Board -> 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>
|
||||
+201
@@ -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( '$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&module=calendar&section=view&do=showevent&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&module=calendar&section=view&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( '&', '&', $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(?:&|&)module=calendar(?:&|&)section=view(?:&|&)do=showevent(?:&|&)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(?:&|&)module=calendar(?:&|&)section=post(?:&|&)cal_id=(.+?)(?:&|&)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(?:&|&)module=calendar(?:&|&)section=view(?:&|&)cal_id=(.+?)(?:&|&)do=showday(?:&|&)y=(.+?)(?:&|&)m=(.+?)(?:&|&)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(?:&|&)module=calendar(?:&|&)section=view(?:&|&)cal_id=(\d+?)(?:&|&)do=showweek(?:&|&)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(?:&|&)module=calendar(?:&|&)section=view(?:&|&)cal_id=(.+?)(?:&|&)m=(.+?)(?:&|&)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(?:&|&)module=calendar(?:&|&)section=view(?:&|&)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 -> 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&module=calendar&section=view&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&module=calendar&section=view&do=showevent&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&module=calendar&section=view&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 -> 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 -> 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>
|
||||
+228
@@ -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&module=modcp&fromapp=calendar&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&module=calendar&section=view&do=showevent&event_id={$event['event_id']}" . ( $comment ? "&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&module=calendar&section=view&do=showevent&event_id={$event['event_id']}" . ( $comment ? "&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&module=calendar&section=view&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§ion=view&do=showevent&event_id={$event['event_id']}";
|
||||
|
||||
if( $comment )
|
||||
{
|
||||
$url .= '&st=' . $st . '#comment_' . $comment;
|
||||
}
|
||||
|
||||
$return_data = array();
|
||||
$a_url = str_replace("&", "&", $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( '&', '&', $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 -> 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&module=calendar&section=view&do=showevent&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&module=global&section=rss&type=calendar&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 -> 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( '"', '"', $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 -> 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 -> 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>
|
||||
+297
@@ -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&module=ajax&section=media&do=loadtab&tabapp=calendar&tabplugin=events&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§ion=comments&fromApp={$warning['wl_content_id1']}&do=findComment&parentId={$exploded[0]}&comment_id={$exploded[1]}" ), 'title' => $parent['parent_title'] );
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user