Version 4.5.0

This commit is contained in:
Neo committed 2025-12-19 05:51:58 -08:00
1 parent 1a0c7fd3c2
commit f79dcf067a
3791 files changed
+248032 -76372

No files matched your search

+18 -8
View File
@@ -11,7 +11,7 @@
namespace IPS;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
@@ -213,7 +213,7 @@ class _Poll extends \IPS\Patterns\ActiveRecord implements \SplSubject
{
$choices[ $k ] = array(
'question' => $questionData['title'],
'multi' => intval( isset( $questionData['multichoice'] ) ),
'multi' => \intval( isset( $questionData['multichoice'] ) ),
'choice' => array(),
'votes' => array(),
);
@@ -225,7 +225,8 @@ class _Poll extends \IPS\Patterns\ActiveRecord implements \SplSubject
} ), '<a><img>' );
/* AllowedElements strips <___base_url___> */
$answerData['value'] = preg_replace( '#(<img\s+?src=[\'"])___base_url___/#', '\1<___base_url___>/', $answerData['value'] );
$answerData['value'] = preg_replace( '#(\s+?src=[\'"])___base_url___/#', '\1<___base_url___>/', $answerData['value'] );
$answerData['value'] = preg_replace( '#(\s+?data-src=[\'"])___base_url___/#', '\1<___base_url___>/', $answerData['value'] );
$count = isset( $existing[ $k ]['votes'][ $answerId ] ) ? $existing[ $k ]['votes'][ $answerId ] : 0;
if ( trim( $answerData['value'] ) !== "" )
@@ -234,7 +235,7 @@ class _Poll extends \IPS\Patterns\ActiveRecord implements \SplSubject
if ( isset( $answerData['count'] ) and \IPS\Member::loggedIn()->modPermission('can_edit_poll_votes') )
{
$count = ( $answerData['count'] > 0 ? intval( $answerData['count'] ) : 0 );
$count = ( $answerData['count'] > 0 ? \intval( $answerData['count'] ) : 0 );
}
}
@@ -263,6 +264,13 @@ class _Poll extends \IPS\Patterns\ActiveRecord implements \SplSubject
}
$closeDate = new \IPS\DateTime( \IPS\Helpers\Form\Date::_convertDateFormat( $data['poll_close_date'] ) . $time, $timezone );
/* Moderator Log */
if( $this->poll_close_date instanceof \IPS\DateTime AND $closeDate != $this->poll_close_date )
{
\IPS\Session::i()->modLog( 'modlog__poll_autoclose', array( $this->pid => FALSE, $closeDate->rfc1123() => FALSE) );
}
$this->poll_close_date = $closeDate;
/* Close date is in the past, make sure the poll is closed */
@@ -343,7 +351,7 @@ class _Poll extends \IPS\Patterns\ActiveRecord implements \SplSubject
{
return FALSE;
}
return TRUE;
}
@@ -392,7 +400,7 @@ class _Poll extends \IPS\Patterns\ActiveRecord implements \SplSubject
$pollChoices = $this->choices;
foreach ( $vote->member_choices as $key => $value )
{
if ( is_array( $value ) )
if ( \is_array( $value ) )
{
foreach ( $value as $k => $v )
{
@@ -492,7 +500,7 @@ class _Poll extends \IPS\Patterns\ActiveRecord implements \SplSubject
try
{
/* Pre 4.x data can be bad */
if ( !is_array( $this->choices ) || !count( $this->choices ) )
if ( !\is_array( $this->choices ) || !\count( $this->choices ) )
{
return '';
}
@@ -510,7 +518,8 @@ class _Poll extends \IPS\Patterns\ActiveRecord implements \SplSubject
$this->displayTemplate = array( \IPS\Theme::i()->getTemplate( 'global', 'core', 'global' ), 'poll' );
}
$output = call_user_func( $this->displayTemplate, $this, ( $this->url ?: \IPS\Request::i()->url() ) );
$template = $this->displayTemplate;
$output = $template( $this, ( $this->url ?: \IPS\Request::i()->url() ) );
if( \IPS\Request::i()->isAjax() && \IPS\Request::i()->fetchPoll )
{
@@ -546,6 +555,7 @@ class _Poll extends \IPS\Patterns\ActiveRecord implements \SplSubject
{
if ( ! $this->getVote() )
{
\IPS\Session::i()->csrfCheck();
$this->addVote( \IPS\Poll\Vote::fromForm( NULL ) );
return TRUE;