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,13 @@
<?php
/**
* @file defaultSection.php Define the default section for the 'ajax' module
*~TERABYTE_DOC_READY~
* $Copyright: (c) 2001 - 2011 Invision Power Services, Inc.$
* $License: http://www.invisionpower.com/company/standards.php#license$
* $Author: ips_terabyte $
* $LastChangedDate: 2011-05-05 12:40:49 -0400 (Thu, 05 May 2011) $
* @version v3.4.5
* $Revision: 8655 $
*/
$DEFAULT_SECTION = 'rating';
@@ -0,0 +1,10 @@
<html>
<head><title>IP.Board - Bulletin Board System</title></head>
<body>
<h1>403: IP.Board -&gt; Forbidden</h1>
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
</html>
@@ -0,0 +1,196 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.4.5
* Add rating AJAX
* Last Updated: $Date: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
* </pre>
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Calendar
* @link http://www.invisionpower.com
* @since 25th January 2011
* @version $Revision: 10721 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class public_calendar_ajax_rating extends ipsAjaxCommand
{
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return @e void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry )
{
//-----------------------------------------
// INIT
//-----------------------------------------
$event_id = intval($this->request['event_id']);
$rating_id = intval($this->request['rating']);
$this->registry->class_localization->loadLanguageFile( array( 'public_calendar' ) );
//-----------------------------------------
// Functions class
//-----------------------------------------
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'calendar' ) . "/sources/functions.php", 'app_calendar_classes_functions', 'calendar' );
$functions = new $classToLoad( $this->registry );
//-----------------------------------------
// Get data
//-----------------------------------------
if ( ! $event_id )
{
$this->returnJsonArray( array( 'error_key' => 'topics_no_tid', 'error_code' => '104101.1' ) );
}
$event = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'cal_events', 'where' => 'event_id=' . $event_id ) );
if( !$event['event_id'] )
{
$this->returnJsonArray( array( 'error_key' => 'topics_no_tid', 'error_code' => '104102.1' ) );
}
//-----------------------------------------
// Check permissions
//-----------------------------------------
if( !$event['event_approved'] )
{
$this->returnJsonArray( array( 'error_key' => 'topics_no_tid', 'error_code' => '104103.1' ) );
}
if( $event['event_private'] )
{
if( ! $this->memberData['member_id'] OR $this->memberData['member_id'] != $event['event_member_id'] )
{
$this->returnJsonArray( array( 'error_key' => 'topics_no_tid', 'error_code' => '104104.1' ) );
}
}
if( $event['event_perms'] != '*' )
{
$permissionGroups = explode( ',', IPSText::cleanPermString( $event['event_perms'] ) );
if( !IPSMember::isInGroup( $this->memberData, $permissionGroups ) )
{
$this->returnJsonArray( array( 'error_key' => 'topics_no_tid', 'error_code' => '104105.1' ) );
}
}
//-----------------------------------------
// Get our calendar
//-----------------------------------------
$calendar = $functions->getCalendar( $event['event_calendar_id'] );
if( !$calendar['cal_id'] OR $calendar['cal_id'] != $event['event_calendar_id'] )
{
$this->returnJsonArray( array( 'error_key' => 'topics_no_tid', 'error_code' => '104106.1' ) );
}
//-----------------------------------------
// Can we rate?
//-----------------------------------------
$_can_rate = ( $this->memberData['member_id'] AND $this->registry->permissions->check( 'rate', $calendar ) ) ? intval( $this->memberData['g_topic_rate_setting'] ) : 0;
if ( ! $_can_rate )
{
$this->returnJsonArray( array( 'error_key' => 'topic_rate_no_perm', 'error_code' => '104107.1' ) );
}
//-----------------------------------------
// Sneaky members rating more than 5?
//-----------------------------------------
if( $rating_id > 5 )
{
$rating_id = 5;
}
if( $rating_id < 0 )
{
$rating_id = 0;
}
//-----------------------------------------
// Have we rated before?
//-----------------------------------------
$rating = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'cal_event_ratings', 'where' => "rating_eid={$event['event_id']} and rating_member_id=" . $this->memberData['member_id'] ) );
if ( $rating['rating_id'] )
{
//-----------------------------------------
// Do we allow re-ratings?
//-----------------------------------------
if ( $this->memberData['g_topic_rate_setting'] == 2 )
{
if ( $rating_id != $rating['rating_value'] )
{
$new_rating = $rating_id - $rating['rating_value'];
$this->DB->update( 'cal_event_ratings', array( 'rating_value' => $rating_id ), 'rating_id=' . $rating['rating_id'] );
$this->DB->update( 'topics', array(
'event_rating_total' => intval($event['event_rating_total']) + $new_rating,
'event_rating_avg' => round( ( intval($event['event_rating_total']) + $new_rating ) / $event['event_rating_hits'] )
), 'event_id=' . $event['event_id'] );
}
$this->returnJsonArray( array(
'rated' => 'update',
'message' => $this->lang->words['event_rating_changed'],
'topic_rating_total' => intval($event['event_rating_total']) + $new_rating,
'topic_rating_hits' => $event['event_rating_hits']
) );
}
else
{
$this->returnJsonArray( array( 'error_key' => 'topic_rated_already', 'error_code' => 0 ) );
}
}
else
{
$this->DB->insert( 'cal_event_ratings', array(
'rating_eid' => $event['event_id'],
'rating_member_id' => $this->memberData['member_id'],
'rating_value' => $rating_id,
'rating_ip_address' => $this->member->ip_address,
) );
$this->DB->update( 'cal_events', array(
'event_rating_total' => intval( $event['event_rating_total'] ) + $rating_id,
'event_rating_hits' => intval( $event['event_rating_hits'] ) + 1,
'event_rating_avg' => round( ( intval( $event['event_rating_total'] ) + $rating_id ) / ( intval( $event['event_rating_hits'] ) + 1 ) ),
), 'event_id=' . $event_id );
$this->returnJsonArray( array(
'rated' => 'new',
'message' => $this->lang->words['event_rating_done'],
'topic_rating_total' => intval( $event['event_rating_total'] ) + $rating_id,
'topic_rating_hits' => intval( $event['event_rating_hits'] ) + 1,
'_rate_int' => round( ( intval( $event['event_rating_total'] ) + $rating_id ) / ( intval( $event['event_rating_hits'] ) + 1 ) )
) );
}
}
}
@@ -0,0 +1,146 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.4.5
* RSVP for event
* Last Updated: $Date: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
* </pre>
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Calendar
* @link http://www.invisionpower.com
* @since 25th January 2011
* @version $Revision: 10721 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class public_calendar_ajax_rsvp extends ipsAjaxCommand
{
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return @e void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry )
{
//-----------------------------------------
// INIT
//-----------------------------------------
$event_id = intval($this->request['event_id']);
$this->registry->class_localization->loadLanguageFile( array( 'public_calendar' ) );
//-----------------------------------------
// Functions class
//-----------------------------------------
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'calendar' ) . "/sources/functions.php", 'app_calendar_classes_functions', 'calendar' );
$functions = new $classToLoad( $this->registry );
//-----------------------------------------
// Get data
//-----------------------------------------
if ( ! $event_id )
{
$this->returnJsonError( $this->lang->words['rsvp__no_event'] );
}
$event = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'cal_events', 'where' => 'event_id=' . $event_id ) );
if( !$event['event_id'] )
{
$this->returnJsonError( $this->lang->words['rsvp__no_event'] );
}
//-----------------------------------------
// Check permissions
//-----------------------------------------
if( !$event['event_approved'] )
{
$this->returnJsonError( $this->lang->words['rsvp__no_event'] );
}
if( $event['event_private'] )
{
if( ! $this->memberData['member_id'] OR $this->memberData['member_id'] != $event['event_member_id'] )
{
$this->returnJsonError( $this->lang->words['rsvp__no_event'] );
}
}
if( $event['event_perms'] != '*' )
{
$permissionGroups = explode( ',', IPSText::cleanPermString( $event['event_perms'] ) );
if( !IPSMember::isInGroup( $this->memberData, $permissionGroups ) )
{
$this->returnJsonError( $this->lang->words['rsvp__no_event'] );
}
}
//-----------------------------------------
// Get our calendar
//-----------------------------------------
$calendar = $functions->getCalendar( $event['event_calendar_id'] );
if( !$calendar['cal_id'] OR $calendar['cal_id'] != $event['event_calendar_id'] )
{
$this->returnJsonError( $this->lang->words['rsvp__no_event'] );
}
//-----------------------------------------
// Can we RSVP?
//-----------------------------------------
$_can_rsvp = ( $this->memberData['member_id'] AND $this->registry->permissions->check( 'rsvp', $calendar ) AND $event['event_rsvp'] ) ? 1 : 0;
if ( ! $_can_rsvp )
{
$this->returnJsonError( $this->lang->words['rsvp__no_perm'] );
}
//-----------------------------------------
// Have we already RSVP?
//-----------------------------------------
$_check = $this->DB->buildAndFetch( array( 'select' => 'rsvp_id', 'from' => 'cal_event_rsvp', 'where' => 'rsvp_event_id=' . $event['event_id'] . ' AND rsvp_member_id=' . $this->memberData['member_id'] ) );
if( $_check['rsvp_id'] )
{
$this->returnJsonError( $this->lang->words['rsvp__already_rsvp'] );
}
//-----------------------------------------
// Store RSVP
//-----------------------------------------
$_insert = array(
'rsvp_event_id' => $event['event_id'],
'rsvp_member_id' => $this->memberData['member_id'],
'rsvp_date' => time(),
);
$this->DB->insert( 'cal_event_rsvp', $_insert );
$rsvp_id = $this->DB->getInsertId();
$this->returnJsonArray( array( 'html' => $this->registry->output->getTemplate( 'calendar' )->eventAttendee( array_merge( array( 'rsvp_id' => $rsvp_id, 'rsvp_date' => time() ), $this->memberData ), $event ) ) );
}
}