Version 4.2.0

This commit is contained in:
Neo committed 2025-12-19 05:44:59 -08:00
1 parent 0dc2aee5ed
commit 96997ddd8e
2074 files changed
+125454 -55780

No files matched your search

@@ -1,12 +1,11 @@
<?php
/**
* @brief Advertisements Model
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 30 Sept 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core;
@@ -67,31 +66,12 @@ class _Advertisement extends \IPS\Patterns\ActiveRecord
if( static::$advertisements === NULL )
{
static::$advertisements = array();
if( !isset( \IPS\Data\Cache::i()->advertisements ) OR \IPS\Data\Cache::i()->advertisements === NULL )
{
$ads = array();
foreach( \IPS\Db::i()->select( '*' ,'core_advertisements', array( "ad_active=1 AND ad_start < ? AND ( ad_end=0 OR ad_end > ? )", time(), time() ) ) as $row )
{
foreach ( explode( ',', $row['ad_location'] ) as $_location )
{
$ads[ $_location ][ $row['ad_id'] ] = $row;
}
}
\IPS\Data\Cache::i()->advertisements = $ads;
}
else
foreach( \IPS\Db::i()->select( '*' ,'core_advertisements', array( "ad_active=1 AND ad_start < ? AND ( ad_end=0 OR ad_end > ? )", time(), time() ) ) as $row )
{
$ads = \IPS\Data\Cache::i()->advertisements;
}
foreach( $ads as $loc => $rows )
{
foreach ( $rows as $row )
foreach ( explode( ',', $row['ad_location'] ) as $_location )
{
static::$advertisements[ $loc ][] = static::constructFromData( $row );
static::$advertisements[ $_location ][] = static::constructFromData( $row );
}
}
}
@@ -103,7 +83,6 @@ class _Advertisement extends \IPS\Patterns\ActiveRecord
{
if ( $ad->exempt != '*' )
{
$groupsToHideFrom = array_diff( array_keys(\IPS\Member\Group::groups()), json_decode( $ad->exempt, TRUE ) );
if ( \IPS\Member::loggedIn()->inGroup( $groupsToHideFrom ) )
@@ -231,16 +210,20 @@ class _Advertisement extends \IPS\Patterns\ActiveRecord
}
/**
* Save Changed Columns
* Get additional settings
*
* @return void
* @return array
*/
public function save()
public function get__additional_settings()
{
parent::save();
unset( \IPS\Data\Cache::i()->advertisements );
if( !isset( $this->_data['_additional_settings'] ) )
{
$this->_data['_additional_settings'] = $this->_data['additional_settings'] ? json_decode( $this->_data['additional_settings'], TRUE ) : array();
}
return $this->_data['_additional_settings'];
}
/**
* Get the file system storage extension
*
@@ -284,8 +267,7 @@ class _Advertisement extends \IPS\Patterns\ActiveRecord
/* Delete */
parent::delete();
/* Empty the cache */
unset( \IPS\Data\Cache::i()->advertisements );
/* Make sure we still have active ads */
if ( !\IPS\Db::i()->select( 'COUNT(*)', 'core_advertisements', 'ad_active=1' )->first() )
{
\IPS\Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => 0 ), array( 'conf_key=?', 'ads_exist' ) );
@@ -303,7 +285,6 @@ class _Advertisement extends \IPS\Patterns\ActiveRecord
if( count( static::$advertisementIds ) )
{
\IPS\Db::i()->update( 'core_advertisements', "ad_impressions=ad_impressions+1", "ad_id IN(" . implode( ',', static::$advertisementIds ) . ")" );
unset( \IPS\Data\Cache::i()->advertisements );
}
}
}