Version 4.3.6
This commit is contained in:
1 parent
fe1acf984a
commit
1a0c7fd3c2
609 files changed
+14707
-5726
No files matched your search
@@ -700,6 +700,7 @@ abstract class _Content extends \IPS\Patterns\ActiveRecord
|
||||
{
|
||||
$this->container()->resetCommentCounts();
|
||||
$this->container()->setLastComment();
|
||||
$this->container()->setLastReview();
|
||||
$this->container()->save();
|
||||
}
|
||||
}
|
||||
@@ -756,13 +757,15 @@ abstract class _Content extends \IPS\Patterns\ActiveRecord
|
||||
/* Save the changes */
|
||||
$this->save();
|
||||
|
||||
/* Reindex the now hidden content */
|
||||
if ( $this instanceof \IPS\Content\Item and static::$firstCommentRequired )
|
||||
/* Reindex the now hidden content - if this is a content item with comments or reviews, then make sure to do those too. */
|
||||
if ( $this instanceof \IPS\Content\Item AND ( isset( static::$commentClass ) OR isset( static::$reviewClass ) ) )
|
||||
{
|
||||
\IPS\Content\Search\Index::i()->index( $this->firstComment() );
|
||||
\IPS\Content\Search\Index::i()->index( ( static::$firstCommentRequired ) ? $this->firstComment() : $this );
|
||||
\IPS\Content\Search\Index::i()->indexSingleItem( $this );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Either this is a comment / review, or the item doesn't support comments or reviews, so we can just reindex it now. */
|
||||
\IPS\Content\Search\Index::i()->index( $this );
|
||||
}
|
||||
|
||||
@@ -774,6 +777,7 @@ abstract class _Content extends \IPS\Patterns\ActiveRecord
|
||||
{
|
||||
$this->container()->resetCommentCounts();
|
||||
$this->container()->setLastComment();
|
||||
$this->container()->setLastReview();
|
||||
$this->container()->save();
|
||||
}
|
||||
}
|
||||
@@ -980,11 +984,11 @@ abstract class _Content extends \IPS\Patterns\ActiveRecord
|
||||
|
||||
if ( $log['sdl_obj_member_id'] )
|
||||
{
|
||||
$this->hiddenBlurb = \IPS\Member::loggedIn()->language()->addToStack('hidden_blurb', FALSE, array( 'sprintf' => array( \IPS\Member::load( $log['sdl_obj_member_id'] )->name, \IPS\DateTime::ts( $log['sdl_obj_date'] )->relative(), \IPS\Member::loggedIn()->language()->addToStack( $log['sdl_obj_reason'] ) ?: \IPS\Member::loggedIn()->language()->addToStack('hidden_no_reason') ) ) );
|
||||
$this->hiddenBlurb = \IPS\Member::loggedIn()->language()->addToStack('hidden_blurb', FALSE, array( 'sprintf' => array( \IPS\Member::load( $log['sdl_obj_member_id'] )->name, \IPS\DateTime::ts( $log['sdl_obj_date'] )->relative(), $log['sdl_obj_reason'] ?: \IPS\Member::loggedIn()->language()->addToStack('hidden_no_reason') ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->hiddenBlurb = \IPS\Member::loggedIn()->language()->addToStack('hidden_blurb_no_member', FALSE, array( 'sprintf' => array( \IPS\DateTime::ts( $log['sdl_obj_date'] )->relative(), \IPS\Member::loggedIn()->language()->addToStack( $log['sdl_obj_reason'] ) ?: \IPS\Member::loggedIn()->language()->addToStack('hidden_no_reason') ) ) );
|
||||
$this->hiddenBlurb = \IPS\Member::loggedIn()->language()->addToStack('hidden_blurb_no_member', FALSE, array( 'sprintf' => array( \IPS\DateTime::ts( $log['sdl_obj_date'] )->relative(), $log['sdl_obj_reason'] ?: \IPS\Member::loggedIn()->language()->addToStack('hidden_no_reason') ) ) );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1219,6 +1223,22 @@ abstract class _Content extends \IPS\Patterns\ActiveRecord
|
||||
return $index;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change IP Address
|
||||
* @param string $ip The new IP address
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function changeIpAddress( $ip )
|
||||
{
|
||||
if ( isset( static::$databaseColumnMap['ip_address'] ) )
|
||||
{
|
||||
$col = static::$databaseColumnMap['ip_address'];
|
||||
$this->$col = (string) $ip;
|
||||
$this->save();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Change Author
|
||||
*
|
||||
@@ -1229,7 +1249,9 @@ abstract class _Content extends \IPS\Patterns\ActiveRecord
|
||||
{
|
||||
$oldAuthor = $this->author();
|
||||
|
||||
if( $oldAuthor->member_id == $newAuthor->member_id )
|
||||
/* If we delete a member, then change author, the old author returns 0 as does the new author as the
|
||||
member row is deleted before the task is run */
|
||||
if( $newAuthor->member_id and ( $oldAuthor->member_id == $newAuthor->member_id ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -1503,6 +1525,21 @@ abstract class _Content extends \IPS\Patterns\ActiveRecord
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Prune IP addresses from content
|
||||
*
|
||||
* @param int $days Remove from content posted older than DAYS ago
|
||||
* @return void
|
||||
*/
|
||||
public static function pruneIpAddresses( $days=0 )
|
||||
{
|
||||
if ( $days and isset( static::$databaseColumnMap['ip_address'] ) and isset( static::$databaseColumnMap['date'] ) )
|
||||
{
|
||||
$time = time() - ( 86400 * $days );
|
||||
\IPS\Db::i()->update( static::$databaseTable, array( static::$databasePrefix . static::$databaseColumnMap['ip_address'] => '' ), array( static::$databasePrefix . static::$databaseColumnMap['date'] . ' <= ' . $time ) );
|
||||
}
|
||||
}
|
||||
|
||||
/* !Follow */
|
||||
|
||||
const FOLLOW_PUBLIC = 1;
|
||||
@@ -1813,7 +1850,7 @@ abstract class _Content extends \IPS\Patterns\ActiveRecord
|
||||
}
|
||||
|
||||
/* We have to send a limit even though we want all records because otherwise the Database store does not return all columns */
|
||||
foreach( \IPS\Session\Store::i()->getOnlineUsers( 0, 'desc', array( 0, 5000 ), NULL, TRUE, TRUE ) as $session )
|
||||
foreach( \IPS\Session\Store::i()->getOnlineUsers( 0, 'desc', array( 0, 5000 ), NULL, TRUE ) as $session )
|
||||
{
|
||||
if( mb_strpos( $session['location_url'], (string) $item->url() ) === 0 )
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user