Version 4.1.2
This commit is contained in:
1 parent
3ba79295ee
commit
28bd025b35
1131 files changed
+63658
-20579
No files matched your search
@@ -51,12 +51,12 @@ class _profile extends \IPS\Helpers\CoverPhoto\Controller
|
||||
if( !\IPS\Request::i()->isAjax() )
|
||||
{
|
||||
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'front_profile.js', 'core' ) );
|
||||
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'front_statuses.js', 'core' ) );
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'styles/profiles.css' ) );
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'styles/statuses.css' ) );
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'styles/streams.css' ) );
|
||||
|
||||
if ( \IPS\Theme::i()->settings['responsive'] )
|
||||
{
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'styles/statuses_responsive.css' ) );
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'styles/profiles_responsive.css' ) );
|
||||
}
|
||||
}
|
||||
@@ -100,23 +100,14 @@ class _profile extends \IPS\Helpers\CoverPhoto\Controller
|
||||
protected function manage()
|
||||
{
|
||||
/* Can we access this member's statuses */
|
||||
$canAccessStatuses = ( \IPS\Settings::i()->profile_comments
|
||||
and \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'core', 'status' ) )
|
||||
and ( $this->member->pp_setting_count_comments or \IPS\Member::loggedIn()->member_id == $this->member->member_id ) );
|
||||
$canAccessSingleStatuses = ( \IPS\Settings::i()->profile_comments and \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'core', 'status' ) ) );
|
||||
$canAccessStatuses = $canAccessSingleStatuses and ( $this->member->pp_setting_count_comments or \IPS\Member::loggedIn()->member_id == $this->member->member_id );
|
||||
|
||||
/* Are we loading a different page of comments? */
|
||||
if ( \IPS\Request::i()->status && \IPS\Request::i()->isAjax() && !\IPS\Request::i()->submitting && !\IPS\Request::i()->getUploader && $canAccessStatuses )
|
||||
{
|
||||
try
|
||||
{
|
||||
$status = \IPS\core\Statuses\Status::loadAndCheckPerms( \IPS\Request::i()->status );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
{
|
||||
\IPS\Output::i()->output = \IPS\Output::i()->error( 'node_error', '2C138/D', 404, '' );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'profile' )->statusReplies( $status );
|
||||
$status = \IPS\core\Statuses\Status::loadAndCheckPerms( \IPS\Request::i()->status );
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'statuses' )->statusReplies( $status );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -157,24 +148,21 @@ class _profile extends \IPS\Helpers\CoverPhoto\Controller
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Work out the main content to display */
|
||||
if ( $canAccessStatuses and \IPS\Request::i()->status and \IPS\Request::i()->type == 'status' )
|
||||
if ( $canAccessSingleStatuses and \IPS\Request::i()->status and \IPS\Request::i()->type == 'status' )
|
||||
{
|
||||
$statuses = $this->_getStatuses();
|
||||
$mainContent = \IPS\Theme::i()->getTemplate( 'profile' )->statusFeed( $this->member, $statuses['statuses'], $statuses['count'], $statuses['form'], TRUE );
|
||||
$status = \IPS\core\Statuses\Status::loadAndCheckPerms( \IPS\Request::i()->status );
|
||||
$mainContent = \IPS\Theme::i()->getTemplate( 'profile' )->singleStatus( $this->member, $status );
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->get( 'viewing_single_status' );
|
||||
\IPS\Output::i()->breadcrumb[] = array( NULL, \IPS\Member::loggedIn()->language()->get( 'viewing_single_status' ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
/* What tabs are available? */
|
||||
$tabs = array( 'activity' => 'users_activity_feed' );
|
||||
if ( $canAccessStatuses )
|
||||
{
|
||||
$tabs['statuses'] = 'status_feed';
|
||||
}
|
||||
foreach( $mainFields as $group => $fields )
|
||||
{
|
||||
foreach( $fields as $field => $value )
|
||||
@@ -196,7 +184,7 @@ class _profile extends \IPS\Helpers\CoverPhoto\Controller
|
||||
$tabs[ "node_{$matches[1]}_{$matches[2]}" ] = "profile_{$matches[1]}_{$matches[2]}";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* What tab are we on? */
|
||||
if ( !isset( \IPS\Request::i()->tab ) or !array_key_exists( \IPS\Request::i()->tab, $tabs ) )
|
||||
{
|
||||
@@ -206,19 +194,65 @@ class _profile extends \IPS\Helpers\CoverPhoto\Controller
|
||||
{
|
||||
$tab = \IPS\Request::i()->tab;
|
||||
}
|
||||
|
||||
|
||||
/* Work out the content */
|
||||
$tabContents = '';
|
||||
if ( $tab == 'activity' )
|
||||
{
|
||||
$latestActivity = \IPS\Content\Search\Query::init()->filterByAuthor( $this->member )->excludeFirstPostContentItems()->excludeDisabledApps()->setLimit( 15 )->setOrder( \IPS\Content\Search\Query::ORDER_NEWEST_CREATED )->search();
|
||||
$latestActivity = \IPS\Content\Search\Query::init()->filterForProfile( $this->member )->setLimit( 15 )->setOrder( \IPS\Content\Search\Query::ORDER_NEWEST_CREATED )->search();
|
||||
$latestActivity->init( TRUE );
|
||||
$tabContents = \IPS\Theme::i()->getTemplate( 'profile' )->profileActivity( $this->member, $latestActivity );
|
||||
}
|
||||
elseif ( $tab == 'statuses' )
|
||||
{
|
||||
$statuses = $this->_getStatuses();
|
||||
$tabContents = \IPS\Theme::i()->getTemplate( 'profile' )->statusFeed( $this->member, $statuses['statuses'], $statuses['count'], $statuses['form'] );
|
||||
|
||||
$extra = array();
|
||||
foreach ( array( 'register', 'follow_member', 'follow_content', 'photo', 'like', 'rep_neg' ) as $k )
|
||||
{
|
||||
$key = "all_activity_{$k}";
|
||||
if ( \IPS\Settings::i()->$key )
|
||||
{
|
||||
$extra[] = $k;
|
||||
}
|
||||
}
|
||||
if ( !empty( $extra ) )
|
||||
{
|
||||
$latestActivity = $latestActivity->addExtraItems( $extra, $this->member );
|
||||
}
|
||||
|
||||
$statusForm = NULL;
|
||||
if ( \IPS\core\Statuses\Status::canCreate( \IPS\Member::loggedIn() ) )
|
||||
{
|
||||
if ( isset( \IPS\Request::i()->status_content_ajax ) )
|
||||
{
|
||||
\IPS\Request::i()->status_content = \IPS\Request::i()->status_content_ajax;
|
||||
}
|
||||
|
||||
$form = new \IPS\Helpers\Form( 'new_status', 'status_new' );
|
||||
foreach( \IPS\core\Statuses\Status::formElements() AS $k => $element )
|
||||
{
|
||||
$form->add( $element );
|
||||
}
|
||||
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
$status = \IPS\core\Statuses\Status::createFromForm( $values );
|
||||
|
||||
if ( \IPS\Request::i()->isAjax() )
|
||||
{
|
||||
\IPS\Output::i()->sendOutput( \IPS\Theme::i()->getTemplate( 'statuses', 'core', 'front' )->statusContainer( $status ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Output::i()->redirect( $status->url() );
|
||||
}
|
||||
}
|
||||
|
||||
$statusForm = $form->customTemplate( array( \IPS\Theme::i()->getTemplate( 'forms', 'core' ), 'statusTemplate' ) );
|
||||
|
||||
if ( \IPS\core\Statuses\Status::moderateNewItems( \IPS\Member::loggedIn() ) )
|
||||
{
|
||||
$statusForm = \IPS\Theme::i()->getTemplate( 'forms', 'core' )->modQueueMessage( \IPS\Member::loggedIn()->warnings( 5, NULL, 'mq' ), \IPS\Member::loggedIn()->mod_posts ) . $statusForm;
|
||||
}
|
||||
}
|
||||
|
||||
$tabContents = \IPS\Theme::i()->getTemplate( 'profile' )->profileActivity( $this->member, $latestActivity, $statusForm );
|
||||
}
|
||||
elseif ( mb_substr( $tab, 0, 6 ) == 'field_' )
|
||||
{
|
||||
@@ -230,16 +264,16 @@ class _profile extends \IPS\Helpers\CoverPhoto\Controller
|
||||
$type = mb_substr( $tab, 5 );
|
||||
$tabContents = (string) $nodes[ $type ]->render();
|
||||
}
|
||||
|
||||
|
||||
/* If this is AJAX request to change the tab, just display that */
|
||||
if ( \IPS\Request::i()->isAjax() and isset( \IPS\Request::i()->tab ) )
|
||||
{
|
||||
\IPS\Output::i()->sendOutput( $tabContents );
|
||||
\IPS\Output::i()->sendOutput( \IPS\Theme::i()->getTemplate( 'global', 'core' )->blankTemplate( $tabContents ) );
|
||||
}
|
||||
|
||||
|
||||
/* Otherwise wrap it in the tabs */
|
||||
$mainContent = \IPS\Theme::i()->getTemplate( 'profile' )->profileTabs( $this->member, $tabs, $tab, $tabContents );
|
||||
|
||||
|
||||
\IPS\Output::i()->title = $this->member->name;
|
||||
}
|
||||
|
||||
@@ -329,22 +363,19 @@ class _profile extends \IPS\Helpers\CoverPhoto\Controller
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( $class == 'IPS\core\Statuses\Status' AND ( !\IPS\Settings::i()->profile_comments OR !\IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'core', 'status' ) ) ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Add CSS for this app */
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'profile.css', $class::$application ) );
|
||||
|
||||
$types[ $class::$application . '_' . $class::$module ][ mb_strtolower( str_replace( '\\', '_', mb_substr( $class, 4 ) ) ) ] = $class;
|
||||
|
||||
if ( isset( $class::$commentClass ) )
|
||||
|
||||
$supportsComments = ( in_array( 'IPS\Content\Item', class_parents( $class ) ) and $class::supportsComments( \IPS\Member::loggedIn() ) );
|
||||
if ( $supportsComments )
|
||||
{
|
||||
$types[ $class::$application . '_' . $class::$module ][ mb_strtolower( str_replace( '\\', '_', mb_substr( $class::$commentClass, 4 ) ) ) ] = $class::$commentClass;
|
||||
}
|
||||
|
||||
if ( isset( $class::$reviewClass ) )
|
||||
$supportsReviews = ( in_array( 'IPS\Content\Item', class_parents( $class ) ) and $class::supportsReviews( \IPS\Member::loggedIn() ) );
|
||||
if ( $supportsReviews )
|
||||
{
|
||||
$types[ $class::$application . '_' . $class::$module ][ mb_strtolower( str_replace( '\\', '_', mb_substr( $class::$reviewClass, 4 ) ) ) ] = $class::$reviewClass;
|
||||
}
|
||||
@@ -353,12 +384,12 @@ class _profile extends \IPS\Helpers\CoverPhoto\Controller
|
||||
{
|
||||
$hasCallback[ mb_strtolower( str_replace( '\\', '_', mb_substr( $class, 4 ) ) ) ] = $router;
|
||||
|
||||
if ( isset( $class::$commentClass ) )
|
||||
if ( $supportsComments )
|
||||
{
|
||||
$hasCallback[ mb_strtolower( str_replace( '\\', '_', mb_substr( $class::$commentClass, 4 ) ) ) ] = $router;
|
||||
}
|
||||
|
||||
if ( isset( $class::$reviewClass ) )
|
||||
if ( $supportsReviews )
|
||||
{
|
||||
$hasCallback[ mb_strtolower( str_replace( '\\', '_', mb_substr( $class::$reviewClass, 4 ) ) ) ] = $router;
|
||||
}
|
||||
@@ -392,7 +423,7 @@ class _profile extends \IPS\Helpers\CoverPhoto\Controller
|
||||
/* Build Output */
|
||||
if ( !$currentType )
|
||||
{
|
||||
$query = \IPS\Content\Search\Query::init()->filterByAuthor( $this->member )->excludeFirstPostContentItems()->excludeDisabledApps()->setOrder( \IPS\Content\Search\Query::ORDER_NEWEST_UPDATED )->setPage( $page );
|
||||
$query = \IPS\Content\Search\Query::init()->filterByAuthor( $this->member )->setOrder( \IPS\Content\Search\Query::ORDER_NEWEST_UPDATED )->setPage( $page );
|
||||
$results = $query->search();
|
||||
$pagination = trim( \IPS\Theme::i()->getTemplate( 'global', 'core', 'global' )->pagination( $this->member->url()->setQueryString( array( 'do' => 'content' ) ), ceil( $results->count( TRUE ) / $query->resultsToGet ), $page, $query->resultsToGet ) );
|
||||
$output = \IPS\Theme::i()->getTemplate('profile')->userContentStream( $this->member, $results, $pagination );
|
||||
@@ -423,8 +454,13 @@ class _profile extends \IPS\Helpers\CoverPhoto\Controller
|
||||
$output = new \IPS\Helpers\Table\Content( $currentClass, $this->member->url()->setQueryString( array( 'do' => 'content', 'type' => $currentType ) ), $where, NULL, NULL, 'read', FALSE );
|
||||
}
|
||||
|
||||
$output->showFilters = FALSE;
|
||||
$output->classes[] = 'cProfileContent';
|
||||
if ( $currentType == 'core_statuses_status' )
|
||||
{
|
||||
$output->noModerate = TRUE;
|
||||
}
|
||||
|
||||
$output->showFilters = FALSE;
|
||||
$output->classes[] = 'cProfileContent';
|
||||
}
|
||||
|
||||
/* If we've clicked from the tab section */
|
||||
@@ -673,44 +709,6 @@ class _profile extends \IPS\Helpers\CoverPhoto\Controller
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggle Statuses
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function statuses()
|
||||
{
|
||||
if ( !\IPS\Member::loggedIn()->modPermission('can_modify_profiles') AND ( \IPS\Member::loggedIn()->member_id !== $this->member->member_id OR !$this->member->group['g_edit_profile'] ) )
|
||||
{
|
||||
\IPS\Output::i()->error( 'no_permission_edit_profile', '2C138/4', 403, '' );
|
||||
}
|
||||
|
||||
\IPS\Session::i()->csrfCheck();
|
||||
|
||||
$statuses = array( 'statuses' => array(), 'form' => NULL );
|
||||
if ( \IPS\Request::i()->state == 0 )
|
||||
{
|
||||
$this->member->pp_setting_count_comments = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->member->pp_setting_count_comments = TRUE;
|
||||
}
|
||||
|
||||
$this->member->save();
|
||||
|
||||
if ( \IPS\Request::i()->isAjax() )
|
||||
{
|
||||
$statuses = $this->_getStatuses();
|
||||
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'profile', 'core' )->statuses( $statuses['statuses'], $statuses['count'], $statuses['form'], $this->member );
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Output::i()->redirect( $this->member->url(), 'saved' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit Status
|
||||
*
|
||||
@@ -766,7 +764,7 @@ class _profile extends \IPS\Helpers\CoverPhoto\Controller
|
||||
$form = new \IPS\Helpers\Form;
|
||||
|
||||
/* The basics */
|
||||
$form->addtab( 'profile_edit_basic_tab', 'user');
|
||||
$form->addTab( 'profile_edit_basic_tab', 'user');
|
||||
$form->addHeader( 'profile_edit_basic_header' );
|
||||
if( \IPS\Settings::i()->post_titlechange != -1 and ( isset( \IPS\Settings::i()->post_titlechange ) and $this->member->member_posts >= \IPS\Settings::i()->post_titlechange ) )
|
||||
{
|
||||
@@ -782,6 +780,10 @@ class _profile extends \IPS\Helpers\CoverPhoto\Controller
|
||||
'yyyy' => \IPS\Theme::i()->getTemplate( 'members', 'core', 'global' )->bdayForm_year( $element->name, $element->value, $element->error ),
|
||||
) );
|
||||
} ) ) );
|
||||
if ( \IPS\Settings::i()->profile_comments and $this->member->canAccessModule( \IPS\Application\Module::get( 'core', 'status' ) ) )
|
||||
{
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'enable_status_updates', $this->member->pp_setting_count_comments ) );
|
||||
}
|
||||
|
||||
/* Profile fields */
|
||||
try
|
||||
@@ -833,6 +835,13 @@ class _profile extends \IPS\Helpers\CoverPhoto\Controller
|
||||
$this->member->member_title = $values['member_title'];
|
||||
}
|
||||
|
||||
if( $values['bday'] and ( ( $values['bday']['day'] and !$values['bday']['month'] ) or ( $values['bday']['month'] and !$values['bday']['day'] ) ) )
|
||||
{
|
||||
$form->error = \IPS\Member::loggedIn()->language()->addToStack( 'bday_month_and_day_required' );
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'forms', 'core' )->editContentForm( \IPS\Member::loggedIn()->language()->addToStack( 'profile_edit' ), $form );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( $values['bday'] and $values['bday']['day'] and $values['bday']['month'] )
|
||||
{
|
||||
$this->member->bday_day = $values['bday']['day'];
|
||||
@@ -846,6 +855,20 @@ class _profile extends \IPS\Helpers\CoverPhoto\Controller
|
||||
$this->member->bday_year = NULL;
|
||||
}
|
||||
|
||||
if ( isset( $values['enable_status_updates'] ) )
|
||||
{
|
||||
$this->member->pp_setting_count_comments = $values['enable_status_updates'];
|
||||
|
||||
if ( $values['enable_status_updates'] )
|
||||
{
|
||||
\IPS\Content\Search\Index::i()->massUpdate( 'IPS\core\Statuses\Status', NULL, NULL, '*', NULL, NULL, $this->member->member_id );
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Content\Search\Index::i()->massUpdate( 'IPS\core\Statuses\Status', NULL, NULL, '', NULL, NULL, $this->member->member_id );
|
||||
}
|
||||
}
|
||||
|
||||
/* Profile Fields */
|
||||
try
|
||||
{
|
||||
@@ -870,11 +893,13 @@ class _profile extends \IPS\Helpers\CoverPhoto\Controller
|
||||
{
|
||||
$profileFields[ "field_{$id}" ] = $field::stringValue( $values[ $field->name ] );
|
||||
|
||||
if ( $fields instanceof \IPS\Helpers\Form\Editor )
|
||||
if ( $field instanceof \IPS\Helpers\Form\Editor )
|
||||
{
|
||||
$field->claimAttachments( $this->id );
|
||||
\IPS\core\ProfileFields\Field::load( $id )->claimAttachments( $this->member->member_id );
|
||||
}
|
||||
}
|
||||
|
||||
$this->member->changedCustomFields = $profileFields;
|
||||
}
|
||||
|
||||
/* Moderator stuff */
|
||||
@@ -902,8 +927,8 @@ class _profile extends \IPS\Helpers\CoverPhoto\Controller
|
||||
}
|
||||
|
||||
/* Save */
|
||||
$this->member->save();
|
||||
\IPS\Db::i()->replace( 'core_pfields_content', $profileFields );
|
||||
$this->member->save();
|
||||
|
||||
\IPS\Output::i()->redirect( $this->member->url() );
|
||||
}
|
||||
@@ -911,7 +936,14 @@ class _profile extends \IPS\Helpers\CoverPhoto\Controller
|
||||
/* Set Session Location */
|
||||
\IPS\Session::i()->setLocation( $this->member->url(), array(), 'loc_editing_profile', array( $this->member->name => FALSE ) );
|
||||
|
||||
\IPS\Output::i()->output = $form->customTemplate( array( call_user_func_array( array( \IPS\Theme::i(), 'getTemplate' ), array( 'forms', 'core' ) ), 'popupTemplate' ) );
|
||||
if ( \IPS\Request::i()->isAjax() )
|
||||
{
|
||||
\IPS\Output::i()->output = $form->customTemplate( array( call_user_func_array( array( \IPS\Theme::i(), 'getTemplate' ), array( 'forms', 'core' ) ), 'popupTemplate' ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'forms', 'core' )->editContentForm( \IPS\Member::loggedIn()->language()->addToStack( 'profile_edit' ), $form );
|
||||
}
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack( 'editing_profile', FALSE, array( 'sprintf' => array( $this->member->name ) ) );
|
||||
\IPS\Output::i()->breadcrumb[] = array( NULL, \IPS\Member::loggedIn()->language()->addToStack( 'editing_profile', FALSE, array( 'sprintf' => array( $this->member->name ) ) ) );
|
||||
}
|
||||
@@ -1011,6 +1043,8 @@ class _profile extends \IPS\Helpers\CoverPhoto\Controller
|
||||
|
||||
$thumbnail = $values['member_photo_upload']->thumbnail( 'core_Profile', \IPS\PHOTO_THUMBNAIL_SIZE, \IPS\PHOTO_THUMBNAIL_SIZE, TRUE );
|
||||
$this->member->pp_thumb_photo = (string) $thumbnail;
|
||||
|
||||
$this->member->photo_last_update = time();
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1024,12 +1058,15 @@ class _profile extends \IPS\Helpers\CoverPhoto\Controller
|
||||
|
||||
$thumbnail = $values['member_photo_url']->thumbnail( 'core_Profile', \IPS\PHOTO_THUMBNAIL_SIZE, \IPS\PHOTO_THUMBNAIL_SIZE, TRUE );
|
||||
$this->member->pp_thumb_photo = (string) $thumbnail;
|
||||
|
||||
$this->member->photo_last_update = time();
|
||||
}
|
||||
break;
|
||||
|
||||
case 'none':
|
||||
$this->member->pp_main_photo = NULL;
|
||||
$this->member->members_bitoptions['bw_disable_gravatar'] = 1;
|
||||
$this->member->photo_last_update = NULL;
|
||||
break;
|
||||
|
||||
case 'gravatar':
|
||||
@@ -1174,7 +1211,7 @@ class _profile extends \IPS\Helpers\CoverPhoto\Controller
|
||||
|
||||
try
|
||||
{
|
||||
$item = ( \IPS\Request::i()->type == 'status' ) ? \IPS\core\Statuses\Status::load( \IPS\Request::i()->status ) : \IPS\core\Statuses\Reply::load( \IPS\Request::i()->status );
|
||||
$item = ( \IPS\Request::i()->type == 'status' ) ? \IPS\core\Statuses\Status::load( \IPS\Request::i()->status ) : \IPS\core\Statuses\Reply::load( \IPS\Request::i()->reply );
|
||||
|
||||
$item->modAction( \IPS\Request::i()->action, \IPS\Member::loggedIn() );
|
||||
|
||||
@@ -1186,7 +1223,7 @@ class _profile extends \IPS\Helpers\CoverPhoto\Controller
|
||||
{
|
||||
if( \IPS\Request::i()->action == 'delete' )
|
||||
{
|
||||
\IPS\Output::i()->redirect( ( $item instanceof \IPS\core\Statuses\Status ) ? \IPS\Member::load( $item->member_id )->url() : \IPS\core\Statuses\Status::load( $item->status_id )->url());
|
||||
\IPS\Output::i()->redirect( ( $item instanceof \IPS\core\Statuses\Status ) ? \IPS\Member::load( $item->member_id )->url()->setQueryString( array( 'do' => 'content', 'type' => 'core_statuses_status' ) ) : \IPS\core\Statuses\Status::load( $item->status_id )->url());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1218,14 +1255,14 @@ class _profile extends \IPS\Helpers\CoverPhoto\Controller
|
||||
|
||||
try
|
||||
{
|
||||
$item = ( \IPS\Request::i()->type == 'status' ) ? \IPS\core\Statuses\Status::load( \IPS\Request::i()->status ) : \IPS\core\Statuses\Reply::load( \IPS\Request::i()->status );
|
||||
$item = ( \IPS\Request::i()->type == 'status' ) ? \IPS\core\Statuses\Status::load( \IPS\Request::i()->status ) : \IPS\core\Statuses\Reply::load( \IPS\Request::i()->reply );
|
||||
|
||||
$type = intval( \IPS\Request::i()->rep ) === 1 ? 1 : -1;
|
||||
$item->giveReputation( $type );
|
||||
|
||||
if ( \IPS\Request::i()->isAjax() )
|
||||
{
|
||||
\IPS\Output::i()->sendOutput( \IPS\Theme::i()->getTemplate( 'global', 'core' )->reputationMini( $item ) );
|
||||
\IPS\Output::i()->sendOutput( \IPS\Theme::i()->getTemplate( 'global', 'core' )->reputationMini( $item->reputation(), $item->canGiveReputation( 1 ), $item->canGiveReputation( -1 ), $item->url('showRep'), $item->url('rep') ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1275,7 +1312,7 @@ class _profile extends \IPS\Helpers\CoverPhoto\Controller
|
||||
{
|
||||
$itemClass = '\IPS\core\Statuses\Status';
|
||||
$commentClass = '\IPS\core\Statuses\Reply';
|
||||
$item = ( \IPS\Request::i()->type == 'status' ) ? $itemClass::load( \IPS\Request::i()->status ) : $commentClass::load( \IPS\Request::i()->status );
|
||||
$item = ( \IPS\Request::i()->type == 'status' ) ? $itemClass::load( \IPS\Request::i()->status ) : $commentClass::load( \IPS\Request::i()->reply );
|
||||
$canReport = $item->canReport();
|
||||
|
||||
if ( $canReport !== TRUE )
|
||||
@@ -1288,6 +1325,10 @@ class _profile extends \IPS\Helpers\CoverPhoto\Controller
|
||||
$idColumn = ( \IPS\Request::i()->type == 'status' ) ? $itemClass::$databaseColumnId : $commentClass::$databaseColumnId;
|
||||
$autoSaveKey = ( \IPS\Request::i()->type == 'status' ) ? "report-{$itemClass::$application}-{$itemClass::$module}-{$item->$idColumn}" : "report-{$itemClass::$application}-{$itemClass::$module}-{$item->status_id}-{$item->$idColumn}";
|
||||
$form->add( new \IPS\Helpers\Form\Editor( 'report_message', NULL, FALSE, array( 'app' => 'core', 'key' => 'Reports', 'autoSaveKey' => $autoSaveKey, 'minimize' => 'report_message_placeholder' ) ) );
|
||||
if( !\IPS\Member::loggedIn()->member_id )
|
||||
{
|
||||
$form->add( new \IPS\Helpers\Form\Captcha );
|
||||
}
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
$report = $item->report( $values['report_message'] );
|
||||
@@ -1332,98 +1373,6 @@ class _profile extends \IPS\Helpers\CoverPhoto\Controller
|
||||
\IPS\Output::i()->breadcrumb[] = array( NULL, \IPS\Member::loggedIn()->language()->addToStack('members_followers', FALSE, array( 'sprintf' => array( $this->member->name ) ) ) );
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'profile' )->allFollowers( $this->member, $followers );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns status list and form
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function _getStatuses()
|
||||
{
|
||||
$statuses = array();
|
||||
$count = 0;
|
||||
|
||||
if ( !\IPS\Settings::i()->profile_comments OR !\IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'core', 'status' ) ) )
|
||||
{
|
||||
return array( 'statuses' => $statuses, 'form' => '', 'count' => $count );
|
||||
}
|
||||
|
||||
if ( \IPS\Request::i()->status )
|
||||
{
|
||||
try
|
||||
{
|
||||
$statuses = array( \IPS\core\Statuses\Status::loadAndCheckPerms( \IPS\Request::i()->status ) );
|
||||
$count = 1;
|
||||
}
|
||||
catch ( \OutOfRangeException $e ) { }
|
||||
}
|
||||
|
||||
if ( !count( $statuses ) )
|
||||
{
|
||||
$_where = !\IPS\core\Statuses\Status::modPermission( 'unhide' ) ? "status_approved=1 AND " : '';
|
||||
$count = \IPS\Db::i()->select( 'count(*)', 'core_member_status_updates', array( "{$_where} (status_member_id=? or status_author_id=?)", $this->member->member_id, $this->member->member_id ) )->first();
|
||||
|
||||
$start = ( intval( \IPS\Request::i()->statusPage ?: 1 ) - 1 ) * 25;
|
||||
|
||||
if( $start > $count )
|
||||
{
|
||||
$start = 0;
|
||||
\IPS\Request::i()->statusPage = 1;
|
||||
}
|
||||
|
||||
$statuses = new \IPS\Patterns\ActiveRecordIterator(
|
||||
\IPS\Db::i()->select(
|
||||
'*',
|
||||
'core_member_status_updates',
|
||||
array( "{$_where} (status_member_id=? or status_author_id=?)", $this->member->member_id, $this->member->member_id ),
|
||||
'status_date DESC',
|
||||
array( $start, 25 )
|
||||
),
|
||||
'\IPS\core\Statuses\Status'
|
||||
);
|
||||
}
|
||||
|
||||
if ( \IPS\core\Statuses\Status::canCreate( \IPS\Member::loggedIn() ) AND !isset( \IPS\Request::i()->status ) )
|
||||
{
|
||||
if ( isset( \IPS\Request::i()->status_content_ajax ) )
|
||||
{
|
||||
\IPS\Request::i()->status_content = \IPS\Request::i()->status_content_ajax;
|
||||
}
|
||||
|
||||
$form = new \IPS\Helpers\Form( 'new_status', 'status_new' );
|
||||
foreach( \IPS\core\Statuses\Status::formElements() AS $k => $element )
|
||||
{
|
||||
$form->add( $element );
|
||||
}
|
||||
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
$status = \IPS\core\Statuses\Status::createFromForm( $values );
|
||||
|
||||
if ( \IPS\Request::i()->isAjax() )
|
||||
{
|
||||
\IPS\Output::i()->sendOutput( \IPS\Theme::i()->getTemplate( 'profile', 'core', 'front' )->statusContainer( $status ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Output::i()->redirect( $status->url() );
|
||||
}
|
||||
}
|
||||
|
||||
$formTpl = $form->customTemplate( array( \IPS\Theme::i()->getTemplate( 'forms', 'core' ), 'statusTemplate' ) );
|
||||
|
||||
if ( \IPS\core\Statuses\Status::moderateNewItems( \IPS\Member::loggedIn() ) )
|
||||
{
|
||||
$formTpl = \IPS\Theme::i()->getTemplate( 'forms', 'core' )->modQueueMessage( \IPS\Member::loggedIn()->warnings( 5, NULL, 'mq' ), \IPS\Member::loggedIn()->mod_posts ) . $formTpl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$formTpl = NULL;
|
||||
}
|
||||
|
||||
return array( 'statuses' => $statuses, 'form' => $formTpl, 'count' => $count );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Cover Photo Storage Extension
|
||||
|
||||
Reference in new issue
Block a user