Version 4.3.6
This commit is contained in:
1 parent
fe1acf984a
commit
1a0c7fd3c2
609 files changed
+14707
-5726
No files matched your search
+95
-14
@@ -106,8 +106,8 @@ class _Member extends \IPS\Patterns\ActiveRecord
|
||||
'security_questions_opt_out' => 1024,
|
||||
'ignore_promotions' => 2048,// 1 means that the user will not be checked against group promotion rules. Set by Commerce to prevent "promoting" users incorrectly after a purchase.
|
||||
'profile_completed' => 4096,
|
||||
'profile_completion_dismissed' => 8192
|
||||
|
||||
'profile_completion_dismissed' => 8192,
|
||||
'created_externally' => 16384
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -153,6 +153,12 @@ class _Member extends \IPS\Patterns\ActiveRecord
|
||||
if ( isset( \IPS\Data\Store::i()->$key ) )
|
||||
{
|
||||
static::$loggedInMember = static::load( \IPS\Data\Store::i()->$key );
|
||||
|
||||
if ( !static::$loggedInMember->member_id )
|
||||
{
|
||||
unset( \IPS\Data\Store::i()->$key );
|
||||
unset( $_SESSION['logged_in_as_key'] );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -565,12 +571,14 @@ class _Member extends \IPS\Patterns\ActiveRecord
|
||||
{
|
||||
if ( isset( $class::$databaseColumnMap['author'] ) and ( $action == 'delete' or in_array( 'IPS\Content\Hideable', class_implements( $class ) ) ) )
|
||||
{
|
||||
\IPS\Task::queue( 'core', 'MemberContent', array_merge( array( 'initiated_by_member_id' => \IPS\Member::loggedIn()->member_id, 'member_id' => $this->member_id, 'name' => $this->name, 'class' => $class, 'action' => $action ), $extra ), 1 );
|
||||
/* Comments run first so rebuilding topic doesn't fail with incorrect author ID */
|
||||
$order = ( is_subclass_of( $class, '\IPS\Content\Comment' ) ) ? 1 : 2;
|
||||
\IPS\Task::queue( 'core', 'MemberContent', array_merge( array( 'initiated_by_member_id' => \IPS\Member::loggedIn()->member_id, 'member_id' => $this->member_id, 'name' => $this->name, 'class' => $class, 'action' => $action ), $extra ), $order );
|
||||
}
|
||||
}
|
||||
|
||||
/* And private messages */
|
||||
\IPS\Task::queue( 'core', 'MemberContent', array_merge( array( 'initiated_by_member_id' => \IPS\Member::loggedIn()->member_id, 'member_id' => $this->member_id, 'name' => $this->name, 'class' => 'IPS\\core\\Messenger\\Conversation', 'action' => $action ), $extra ), 1 );
|
||||
\IPS\Task::queue( 'core', 'MemberContent', array_merge( array( 'initiated_by_member_id' => \IPS\Member::loggedIn()->member_id, 'member_id' => $this->member_id, 'name' => $this->name, 'class' => 'IPS\\core\\Messenger\\Conversation', 'action' => $action ), $extra ), 2 );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1601,7 +1609,18 @@ class _Member extends \IPS\Patterns\ActiveRecord
|
||||
if ( isset( $memberData['member_id'] ) and $memberData['member_id'] )
|
||||
{
|
||||
/* Is Gravatar disabled for them? */
|
||||
$gravatarDisabled = isset( $memberData['members_bitoptions'] ) AND is_object( $memberData['members_bitoptions'] ) ? $memberData['members_bitoptions']['bw_disable_gravatar'] : $memberData['members_bitoptions'] & static::$bitOptions['members_bitoptions']['members_bitoptions']['bw_disable_gravatar'];
|
||||
$gravatarDisabled = FALSE;
|
||||
if ( isset( $memberData['members_bitoptions'] ) )
|
||||
{
|
||||
if ( is_object( $memberData['members_bitoptions'] ) )
|
||||
{
|
||||
$gravatarDisabled = $memberData['members_bitoptions']['bw_disable_gravatar'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$gravatarDisabled = $memberData['members_bitoptions'] & static::$bitOptions['members_bitoptions']['members_bitoptions']['bw_disable_gravatar'];
|
||||
}
|
||||
}
|
||||
|
||||
/* Either uploaded or synced from social media */
|
||||
if ( $memberData['pp_main_photo'] and ( mb_substr( $memberData['pp_photo_type'], 0, 5 ) === 'sync-' or $memberData['pp_photo_type'] === 'custom' or ( \IPS\Settings::i()->letter_photos == 'letters' AND $memberData['pp_photo_type'] == 'letter' and $useDefaultPhoto and ( $gravatarDisabled OR !\IPS\Settings::i()->allow_gravatars ) ) ) )
|
||||
@@ -1830,6 +1849,31 @@ class _Member extends \IPS\Patterns\ActiveRecord
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is Online Anonymously
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isOnlineAnonymously()
|
||||
{
|
||||
if ( !$this->member_id )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ( $this->sessionData === NULL )
|
||||
{
|
||||
$this->sessionData = \IPS\Session\Store::i()->getLatestMemberSession( $this->member_id );
|
||||
}
|
||||
|
||||
if ( $this->sessionData === FALSE )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return ( $this->sessionData['login_type'] == \IPS\Session\Front::LOGIN_TYPE_ANONYMOUS );
|
||||
}
|
||||
|
||||
/**
|
||||
* Is banned?
|
||||
* If is banned until a certain time, returns an \IPS\DateTime object
|
||||
@@ -2852,7 +2896,7 @@ class _Member extends \IPS\Patterns\ActiveRecord
|
||||
$reportCount = \IPS\Db::i()->select(
|
||||
'COUNT(*)',
|
||||
'core_rc_index',
|
||||
array( $where, \IPS\Db::i()->select( 'perm_id', 'core_permission_index', \IPS\Db::i()->findInSet( 'perm_view', array_merge( array( \IPS\Member::loggedIn()->member_group_id ), array_filter( explode( ',', \IPS\Member::loggedIn()->mgroup_others ) ) ) ) . " OR perm_view='*'" ) )
|
||||
array( $where, \IPS\Db::i()->select( 'perm_id', 'core_permission_index', \IPS\Db::i()->findInSet( 'perm_view', $this->permissionArray() ) . " OR perm_view='*'" ) )
|
||||
)->first();
|
||||
|
||||
if( $force === FALSE )
|
||||
@@ -3821,10 +3865,12 @@ class _Member extends \IPS\Patterns\ActiveRecord
|
||||
try
|
||||
{
|
||||
$group = \IPS\Member\Group::load( $action['primary_group'] );
|
||||
$this->member_group_id = $action['primary_group'];
|
||||
|
||||
|
||||
/* Need to store the history before we actually change the group, otherwise history shows "promoted from group X to X" */
|
||||
$this->logHistory( 'core', 'group', array( 'type' => 'primary', 'by' => 'promotion', 'id' => $ruleToUse->id, 'old' => $this->member_group_id, 'new' => $action['primary_group'] ) );
|
||||
|
||||
$this->member_group_id = $action['primary_group'];
|
||||
|
||||
/* Reset profile completion flag to see if there are any items to complete now permissions are elevated */
|
||||
$this->members_bitoptions['profile_completed'] = 0;
|
||||
}
|
||||
@@ -4106,7 +4152,7 @@ class _Member extends \IPS\Patterns\ActiveRecord
|
||||
/**
|
||||
* Email Validation Confirmed
|
||||
*
|
||||
* @param $record validating record
|
||||
* @param array $record validating record
|
||||
* @return void
|
||||
*/
|
||||
public function emailValidationConfirmed( $record )
|
||||
@@ -4139,7 +4185,6 @@ class _Member extends \IPS\Patterns\ActiveRecord
|
||||
* If email-only validation is enabled: this is called after the user has validated their email address or if the admin manually validates the account
|
||||
* If admin (including email and admin) validation is enabled: this is called after the admin has validated the account
|
||||
*
|
||||
* @param array $record Row from core_validating
|
||||
* @return void
|
||||
*/
|
||||
public function validationComplete()
|
||||
@@ -4265,7 +4310,7 @@ class _Member extends \IPS\Patterns\ActiveRecord
|
||||
{
|
||||
case 'email':
|
||||
$email = $method->userEmail( $this );
|
||||
if ( $email != $this->email )
|
||||
if ( $email and $email != $this->email )
|
||||
{
|
||||
if ( $error = \IPS\Login::emailIsInUse( $email, $this ) )
|
||||
{
|
||||
@@ -4347,7 +4392,7 @@ class _Member extends \IPS\Patterns\ActiveRecord
|
||||
$contents = $photoUrl->request()->get();
|
||||
$md5 = md5( $contents );
|
||||
|
||||
if ( !isset( $v['ref'] ) or $md5 != $v['ref'] )
|
||||
if ( $contents AND ( !isset( $v['ref'] ) or $md5 != $v['ref'] ) )
|
||||
{
|
||||
$photoVars = explode( ':', $this->group['g_photo_max_vars'] );
|
||||
|
||||
@@ -4413,7 +4458,7 @@ class _Member extends \IPS\Patterns\ActiveRecord
|
||||
throw new \DomainException('upload_too_big_unspecific');
|
||||
}
|
||||
|
||||
$newFile = \IPS\File::create( 'core_Profile', basename( $coverPhotoUrl->data[ \IPS\Http\Url::COMPONENT_PATH ] ), (string) $image );
|
||||
$newFile = \IPS\File::create( 'core_Profile', 'imported-cover-photo-' . $this->member_id . '.' . $image->type, (string) $image );
|
||||
|
||||
if ( $this->pp_cover_photo )
|
||||
{
|
||||
@@ -4424,7 +4469,7 @@ class _Member extends \IPS\Patterns\ActiveRecord
|
||||
catch ( \Exception $e ) { }
|
||||
}
|
||||
|
||||
$this->pp_cover_photo = $newFile;
|
||||
$this->pp_cover_photo = (string) $newFile;
|
||||
$this->logHistory( 'core', 'photo', array( 'action' => 'new', 'type' => 'profilesync', 'id' => $method->id, 'service' => $method::getTitle() ) );
|
||||
|
||||
$profileSync['cover']['ref'] = $md5;
|
||||
@@ -4737,6 +4782,10 @@ class _Member extends \IPS\Patterns\ActiveRecord
|
||||
{
|
||||
return new \IPS\Math\Number( '100' );
|
||||
}
|
||||
elseif( !$total )
|
||||
{
|
||||
return new \IPS\Math\Number( '100' );
|
||||
}
|
||||
else
|
||||
{
|
||||
return new \IPS\Math\Number( (string) round( 100 / $total * $done ) );
|
||||
@@ -4827,4 +4876,36 @@ class _Member extends \IPS\Patterns\ActiveRecord
|
||||
{
|
||||
return $this->staticCoverPhotoBackgroundColor( $this->name );
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the recent profile visitors
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function get_profileVisitors()
|
||||
{
|
||||
$visitors = array();
|
||||
$visitorData = array();
|
||||
$visitorInfo = json_decode( $this->pp_last_visitors, TRUE );
|
||||
if ( !is_array( $visitorInfo ) )
|
||||
{
|
||||
$visitorInfo = array();
|
||||
}
|
||||
|
||||
foreach( new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'core_members', array( \IPS\Db::i()->in( 'member_id', array_keys( array_reverse( $visitorInfo, TRUE ) ) ) ) ), 'IPS\Member' ) AS $row )
|
||||
{
|
||||
$visitorData[$row->member_id] = $row;
|
||||
}
|
||||
|
||||
foreach( array_reverse( $visitorInfo, TRUE ) as $id => $time )
|
||||
{
|
||||
if ( isset( $visitorData[$id] ) )
|
||||
{
|
||||
$visitors[$id]['member'] = $visitorData[$id];
|
||||
$visitors[$id]['visit_time'] = $time;
|
||||
}
|
||||
}
|
||||
|
||||
return $visitors;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user