Version 3.4.9

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

No files matched your search

@@ -0,0 +1,37 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.4.5
* Config file
* Last Updated: $Date: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
* </pre>
*
* @author $author$
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Calendar
* @link http://www.invisionpower.com
* @version $Rev: 10721 $
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
/* Can search with this app */
$CONFIG['can_search'] = 1;
/* Can view new content with this app */
$CONFIG['can_viewNewContent'] = 1;
$CONFIG['can_vnc_unread_content'] = 0;
$CONFIG['can_vnc_filter_by_followed'] = 1;
/* Can fetch user generated content */
$CONFIG['can_userContent'] = 1;
/* Content types for 'follow', default one first */
$CONFIG['followContentTypes'] = array( 'events', 'calendars' );
@@ -0,0 +1,10 @@
<html>
<head><title>IP.Board - Bulletin Board System</title></head>
<body>
<h1>403: IP.Board -&gt; Forbidden</h1>
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
</html>
@@ -0,0 +1,400 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.4.5
* Basic Calendar Search
* Last Updated: $Date: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
* </pre>
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Calendar
* @link http://www.invisionpower.com
* @version $Rev: 10721 $
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class search_engine_calendar extends search_engine
{
/**
* Calendars we have access to
*
* @var array
*/
protected $calendars = array();
/**
* Constructor
*/
public function __construct( ipsRegistry $registry )
{
parent::__construct( $registry );
}
/**
* Perform a search.
* Returns an array of a total count (total number of matches)
* and an array of IDs ( 0 => 1203, 1 => 928, 2 => 2938 ).. matching the required number based on pagination. The ids returned would be based on the filters and type of search
*
* So if we had 1000 replies, and we are on page 2 of 25 per page, we'd return 25 items offset by 25
*
* @return array
*/
public function search()
{
//-----------------------------------------
// Init
//-----------------------------------------
$sort_by = IPSSearchRegistry::get('in.search_sort_by');
$sort_order = IPSSearchRegistry::get('in.search_sort_order');
$search_term = IPSSearchRegistry::get('in.clean_search_term');
$sortKey = '';
$rows = array();
switch( $sort_by )
{
default:
case 'date':
$sortKey = 'c.event_start_date';
break;
case 'title':
$sortKey = 'c.event_title';
break;
}
//-----------------------------------------
// Get calendars
//-----------------------------------------
if( !count($this->calendars) )
{
$this->DB->build( array( 'select' => 'perm_type_id as calendar_id', 'from' => 'permission_index', 'where' => "app='calendar' AND " . $this->DB->buildRegexp( "perm_view", $this->member->perm_id_array ) ) );
$this->DB->execute();
while( $r = $this->DB->fetch() )
{
$this->calendars[] = $r['calendar_id'];
}
}
//-----------------------------------------
// Get count
//-----------------------------------------
$where = $this->_buildWhereStatement( $search_term );
$count = $this->DB->buildAndFetch(
array(
'select' => 'COUNT(*) as total_results',
'from' => 'cal_events',
'where' => str_replace( 'c.', '', $where ),
) );
if( $count['total_results'] )
{
//-----------------------------------------
// Perform search
//-----------------------------------------
$this->DB->build( array(
'select' => "c.*",
'from' => array( 'cal_events' => 'c' ),
'where' => $where,
'order' => $sortKey . ' ' . $sort_order,
'limit' => array( IPSSearchRegistry::get('in.start'), IPSSearchRegistry::get('opt.search_per_page') ),
'add_join' => array(
array(
'select' => 'mem.members_display_name, mem.member_group_id, mem.mgroup_others',
'from' => array( 'members' => 'mem' ),
'where' => "mem.member_id=c.event_member_id",
'type' => 'left',
),
)
) );
$this->DB->execute();
while( $r = $this->DB->fetch() )
{
$rows[] = $r;
}
}
//-----------------------------------------
// Return results
//-----------------------------------------
return array( 'count' => $count['total_results'], 'resultSet' => $rows );
}
/**
* Perform the viewNewContent search
* Populates $this->_count and $this->_results
*
* @access public
* @return array
*/
public function viewNewContent()
{
//-----------------------------------------
// Init
//-----------------------------------------
IPSSearchRegistry::set('in.search_sort_by', 'date' );
IPSSearchRegistry::set('in.search_sort_order', 'desc' );
IPSSearchRegistry::set('opt.searchType', 'titles' );
IPSSearchRegistry::set('opt.noPostPreview', true );
//-----------------------------------------
// Set time limit
//-----------------------------------------
if ( IPSSearchRegistry::get('in.period_in_seconds') !== false )
{
$this->search_begin_timestamp = ( IPS_UNIX_TIME_NOW - IPSSearchRegistry::get('in.period_in_seconds') );
}
else
{
$this->search_begin_timestamp = intval( $this->memberData['last_visit'] ) ? intval( $this->memberData['last_visit'] ) : IPS_UNIX_TIME_NOW;
}
//-----------------------------------------
// Only content we are following?
//-----------------------------------------
if ( IPSSearchRegistry::get('in.vncFollowFilterOn' ) AND $this->memberData['member_id'] )
{
require_once( IPS_ROOT_PATH . 'sources/classes/like/composite.php' );/*noLibHook*/
$like = classes_like::bootstrap( 'calendar', 'events' );
$followedEvents = $like->getDataByMemberIdAndArea( $this->memberData['member_id'] );
$followedEvents = ( $followedEvents === null ) ? array() : array_keys( $followedEvents );
if( !count($followedEvents) )
{
return array( 'count' => 0, 'resultSet' => array() );
}
else
{
$this->whereConditions['AND'][] = "c.event_id IN(" . implode( ',', $followedEvents ) . ")";
}
}
//-----------------------------------------
// Only content we have participated in?
//-----------------------------------------
if( IPSSearchRegistry::get('in.userMode') )
{
switch( IPSSearchRegistry::get('in.userMode') )
{
default:
case 'all':
$_eventIds = $this->_getEventIdsFromComments();
if( count($_eventIds) )
{
$this->whereConditions['AND'][] = "(c.event_member_id=" . $this->memberData['member_id'] . " OR c.event_id IN(" . implode( ',', $_eventIds ) . "))";
}
else
{
$this->whereConditions['AND'][] = "c.event_member_id=" . $this->memberData['member_id'];
}
break;
case 'title':
$this->whereConditions['AND'][] = "c.event_member_id=" . $this->memberData['member_id'];
break;
}
}
return $this->search();
}
/**
* Find events we have commented on
*
* @return array
*/
protected function _getEventIdsFromComments()
{
$ids = array();
$this->DB->build( array(
'select' => $this->DB->buildDistinct('comment_eid'),
'from' => 'cal_event_comments',
'where' => 'comment_approved=1 AND comment_mid=' . $this->memberData['member_id'],
'limit' => array( 0, 200 )
) );
$this->DB->execute();
while( $r = $this->DB->fetch() )
{
$ids[] = $r['comment_eid'];
}
return $ids;
}
/**
* Perform the viewUserContent search
* Populates $this->_count and $this->_results
*
* @access public
* @return nothin'
*/
public function viewUserContent( $member )
{
//-----------------------------------------
// Set limits
//-----------------------------------------
$this->search_begin_timestamp = time() - ( 86400 * intval( $this->settings['search_ucontent_days'] ) );
$this->whereConditions['AND'][] = "c.event_member_id=" . intval( $member['member_id'] );
//-----------------------------------------
// Get count
//-----------------------------------------
return $this->search();
}
/**
* Builds the where portion of a search string
*
* @param string $search_term The string to use in the search
* @return string
*/
protected function _buildWhereStatement( $search_term )
{
//-----------------------------------------
// Init
//-----------------------------------------
$where_clause = array();
//-----------------------------------------
// Search term
//-----------------------------------------
if( $search_term )
{
$search_term = str_replace( '&quot;', '"', $search_term );
switch( IPSSearchRegistry::get('opt.searchType') )
{
case 'both':
default:
$where_clause[] = '(' . $this->DB->buildSearchStatement( 'c.event_title', $search_term, true, false, ipsRegistry::$settings['use_fulltext'] ) . ' OR ' . $this->DB->buildSearchStatement( 'c.event_content', $search_term, true, false, ipsRegistry::$settings['use_fulltext'] ) . ')';
break;
case 'titles':
$where_clause[] = $this->DB->buildSearchStatement( 'c.event_title', $search_term, true, false, ipsRegistry::$settings['use_fulltext'] );
break;
case 'content':
$where_clause[] = $this->DB->buildSearchStatement( 'c.event_content', $search_term, true, false, ipsRegistry::$settings['use_fulltext'] );
break;
}
}
//-----------------------------------------
// Date restriction
//-----------------------------------------
if( $this->search_begin_timestamp && $this->search_end_timestamp )
{
$where_clause[] = $this->DB->buildBetween( $this->DB->buildUnixTimestamp( "c.event_start_date" ), $this->search_begin_timestamp, $this->search_end_timestamp );
}
else
{
if( $this->search_begin_timestamp )
{
$where_clause[] = $this->DB->buildUnixTimestamp( "c.event_start_date" ) . " > {$this->search_begin_timestamp}";
}
if( $this->search_end_timestamp )
{
$where_clause[] = $this->DB->buildUnixTimestamp( "c.event_start_date" ) . " < {$this->search_end_timestamp}";
}
}
//-----------------------------------------
// Other conditions
//-----------------------------------------
if( isset( $this->whereConditions['AND'] ) && count( $this->whereConditions['AND'] ) )
{
$where_clause = array_merge( $where_clause, $this->whereConditions['AND'] );
}
if( isset( $this->whereConditions['OR'] ) && count( $this->whereConditions['OR'] ) )
{
$where_clause[] = '( ' . implode( ' OR ', $this->whereConditions['OR'] ) . ' )';
}
//-----------------------------------------
// Permissions
//-----------------------------------------
if( !$this->memberData['g_is_supmod'] )
{
$where_clause[] = 'c.event_approved=1';
}
else
{
$where_clause[] = 'c.event_approved IN (0,1)';
}
$where_clause[] = "c.event_calendar_id IN(" . ( count($this->calendars) ? implode( ',', $this->calendars ) : 0 ) . ")";
$where_clause[] = "((c.event_private=1 AND c.event_member_id=" . $this->memberData['member_id'] . ") OR (c.event_private=0 AND " . $this->DB->buildRegexp( "c.event_perms", $this->member->perm_id_array ) . "))";
//-----------------------------------------
// Return
//-----------------------------------------
return implode( " AND ", $where_clause );
}
/**
* Remap standard columns (Apps can override )
*
* @param string $column sql table column for this condition
* @return string column
*/
public function remapColumn( $column )
{
$column = $column == 'member_id' ? 'c.event_member_id' : $column;
return $column;
}
/**
* Returns an array used in the searchplugin's setCondition method
*
* @param array $data Array of forums to view
* @return array Array with column, operator, and value keys, for use in the setCondition call
*/
public function buildFilterSQL( $data )
{
return array();
}
/**
* Can handle boolean searching
*
* @access public
* @return boolean
*/
public function isBoolean()
{
return true;
}
}
@@ -0,0 +1,48 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.4.5
* Returns HTML for the form (optional class, not required)
* Last Updated: $Date: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
* </pre>
*
* @author $author$
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Calendar
* @link http://www.invisionpower.com
* @version $Rev: 10721 $
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class search_form_calendar
{
/**
* Constructor
*
* @return @e void
*/
public function __construct()
{
}
/**
* Return sort drop down
*
* @return array
*/
public function fetchSortDropDown()
{
$array = array( 'date' => ipsRegistry::instance()->getClass('class_localization')->words['s_search_type_0'],
'title' => ipsRegistry::instance()->getClass('class_localization')->words['forum_sort_title'] );
return $array;
}
}
@@ -0,0 +1,257 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.4.5
* Formats calendar search results
* Last Updated: $Date: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
* </pre>
*
* @author $author$
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Calendar
* @link http://www.invisionpower.com
* @version $Rev: 10721 $
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class search_format_calendar extends search_format
{
/**
* Constructor
*
* @param object ipsRegistry
* @return @e void
*/
public function __construct( ipsRegistry $registry )
{
$registry->class_localization->loadLanguageFile( array( 'public_calendar' ), 'calendar' );
parent::__construct( $registry );
}
/**
* Parse search results
*
* @access private
* @param array $r Search result
* @return array $html Blocks of HTML
*/
public function parseAndFetchHtmlBlocks( $rows )
{
return parent::parseAndFetchHtmlBlocks( $rows );
}
/**
* Formats the forum search result for display
*
* @access public
* @param array $event Array of data
* @return mixed Formatted content, ready for display, or array containing a $sub section flag, and content
*/
public function formatContent( $event )
{
//-----------------------------------------
// Times and dates
//-----------------------------------------
$event['_start_time'] = strtotime( $event['event_start_date'] );
$event['_end_time'] = ( $event['event_end_date'] AND $event['event_end_date'] != '0000-00-00 00:00:00' ) ? strtotime( $event['event_end_date'] ) : 0;
if( !$event['event_all_day'] )
{
if( $this->memberData['member_id'] AND $this->memberData['time_offset'] )
{
$event['_start_time'] = $event['_start_time'] + ( $this->memberData['time_offset'] * 3600 );
}
else if( !$this->memberData['member_id'] AND $this->settings['time_offset'] )
{
$event['_start_time'] = $event['_start_time'] + ( $this->settings['time_offset'] * 3600 );
}
}
if( !$event['event_all_day'] )
{
if( $this->memberData['member_id'] AND $this->memberData['time_offset'] )
{
$event['_end_time'] = $event['_end_time'] ? ( $event['_end_time'] + ( $this->memberData['time_offset'] * 3600 ) ) : 0;
}
else if( !$this->memberData['member_id'] AND $this->settings['time_offset'] )
{
$event['_end_time'] = $event['_end_time'] ? ( $event['_end_time'] + ( $this->settings['time_offset'] * 3600 ) ) : 0;
}
}
$event['_start_date'] = gmstrftime( $this->settings['clock_date'], $event['_start_time'] );
$event['_event_time'] = '';
$event['_event_etime'] = '';
if( !$event['event_all_day'] )
{
$event['_event_time'] = ltrim( gmstrftime( '%I:%M %p', $event['_start_time'] ), '0' );
$event['_event_etime'] = $event['_end_time'] ? ltrim( gmstrftime( '%I:%M %p', $event['_end_time'] ), '0' ) : ':00';
if( strpos( ':00', $event['_event_time'] ) === 0 OR gmstrftime( '%H:%M', $event['_start_time'] ) == '00:00' )
{
$event['_event_time'] = '';
}
if( strpos( ':00', $event['_event_etime'] ) === 0 OR gmstrftime( '%H:%M', $event['_end_time'] ) == '00:00' )
{
$event['_event_etime'] = '';
}
}
//-----------------------------------------
// Event type
//-----------------------------------------
$type = $this->lang->words['se_normal'];
$ends = '';
if( !$event['event_recurring'] AND $event['_end_time'] AND gmstrftime( $this->settings['clock_date'], $event['_end_time'] ) != $event['_start_date'] )
{
$type = $this->lang->words['se_range'];
$ends = sprintf( $this->lang->words['se_ends'], gmstrftime( $this->settings['clock_date'], $event['_end_time'] ) );
}
else if ( $event['event_recurring'] )
{
$type = $this->lang->words['se_recur'];
$ends = sprintf( $this->lang->words['se_ends'], gmstrftime( $this->settings['clock_date'], $event['_end_time'] ) );
}
//-----------------------------------------
// Output
//-----------------------------------------
return array( ipsRegistry::getClass( 'output' )->getTemplate( 'calendar' )->calEventSearchResult( $event, IPSSearchRegistry::get('opt.searchType') == 'titles' ? true : false, $type, $ends ), 0 );
}
/**
* Return the output for the followed content results
*
* @param array $results Array of results to show
* @param array $followData Meta data from follow/like system
* @return @e string
*/
public function parseFollowedContentOutput( $results, $followData )
{
/* Events? */
if( IPSSearchRegistry::get('in.followContentType') == 'events' )
{
if( count($results) )
{
$_results = array();
$this->DB->build( array(
'select' => "c.*",
'from' => array( 'cal_events' => 'c' ),
'where' => 'c.event_id IN(' . implode( ',', $results ) . ')',
'order' => 'c.event_start_date DESC',
'add_join' => array(
array(
'select' => 'i.*',
'from' => array( 'permission_index' => 'i' ),
'where' => "i.perm_type='calendar' AND i.perm_type_id=c.event_calendar_id",
'type' => 'left',
),
array(
'select' => 'mem.*',
'from' => array( 'members' => 'mem' ),
'where' => "mem.member_id=c.event_member_id",
'type' => 'left',
),
)
) );
$this->DB->execute();
while( $r = $this->DB->fetch() )
{
$_results[ $r['event_id'] ] = $this->genericizeResults( $r );
}
/* Merge in follow data */
foreach( $followData as $_follow )
{
$_results[ $_follow['like_rel_id'] ]['_followData'] = $_follow;
}
}
return $this->registry->output->getTemplate('calendar')->calEventFollowedWrapper( $this->parseAndFetchHtmlBlocks( $_results ) );
}
/* Or calendars? */
else
{
$calendars = array();
$member_ids = array();
if( count($results) )
{
/* Load calendars cache */
$_calCache = $this->cache->getCache( 'calendars' );
/* Get calendar data */
foreach( $results as $result )
{
$calendars[ $result ] = $_calCache[ $result ];
}
/* Merge in follow data */
foreach( $followData as $_follow )
{
$calendars[ $_follow['like_rel_id'] ]['_followData'] = $_follow;
}
}
return $this->registry->output->getTemplate('calendar')->followedContentCalendars( $calendars );
}
}
/**
* Formats / grabs extra data for results
* Takes an array of IDS (can be IDs from anything) and returns an array of expanded data.
*
* @param array $ids Ids
* @param array $followData Retrieve the follow meta data
* @return array
*/
public function processResults( $ids )
{
$rows = array();
foreach( $ids as $i => $d )
{
$rows[ $i ] = $this->genericizeResults( $d );
}
return $rows;
}
/**
* Reassigns fields in a generic way for results output
*
* @param array $r
* @return array
*/
public function genericizeResults( $r )
{
$r['app'] = 'calendar';
$r['content'] = $r['event_content'];
$r['content_title'] = $r['event_title'];
$r['updated'] = $r['event_lastupdated'];
$r['type_2'] = 'event';
$r['type_id_2'] = $r['event_id'];
$r['misc'] = null;
$r['member_id'] = $r['event_member_id'];
return $r;
}
}
@@ -0,0 +1,10 @@
<html>
<head><title>IP.Board - Bulletin Board System</title></head>
<body>
<h1>403: IP.Board -&gt; Forbidden</h1>
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
</html>