Version 4.7.0
This commit is contained in:
1 parent
517a5e1f70
commit
8ba7d43898
1933 files changed
+65613
-11332
No files matched your search
@@ -44,11 +44,7 @@ class _messenger extends \IPS\Content\Controller
|
||||
\IPS\Output::i()->error( 'no_module_permission_guest', '2C137/1', 403, '' );
|
||||
}
|
||||
|
||||
if ( \IPS\Member::loggedIn()->members_disable_pm AND \IPS\Member::loggedIn()->members_disable_pm != 2 AND \IPS\Request::i()->do != 'enableMessenger' )
|
||||
{
|
||||
\IPS\Output::i()->error( \IPS\Member::loggedIn()->language()->addToStack('messenger_disabled_can_enable', FALSE, array( 'sprintf' => array( \IPS\Http\URL::internal( 'app=core&module=messaging&controller=messenger&do=enableMessenger', 'front', 'messaging' )->csrf() ) ) ), '2C137/A', 403, '' );
|
||||
}
|
||||
else if ( \IPS\Member::loggedIn()->members_disable_pm == 2 )
|
||||
if ( \IPS\Member::loggedIn()->members_disable_pm == 2 )
|
||||
{
|
||||
\IPS\Output::i()->error( 'messenger_disabled', '2C137/9', 403, '' );
|
||||
}
|
||||
@@ -79,7 +75,8 @@ class _messenger extends \IPS\Content\Controller
|
||||
protected function manage()
|
||||
{
|
||||
$baseUrl = \IPS\Http\Url::internal( "app=core&module=messaging&controller=messenger", 'front', 'messaging' );
|
||||
|
||||
$alert = NULL;
|
||||
|
||||
/* Get folders */
|
||||
$folders = array( 'myconvo' => \IPS\Member::loggedIn()->language()->addToStack('messenger_folder_inbox') );
|
||||
if ( \IPS\Member::loggedIn()->pconversation_filters )
|
||||
@@ -201,6 +198,20 @@ class _messenger extends \IPS\Content\Controller
|
||||
\IPS\Output::i()->redirect( $message->url() );
|
||||
}
|
||||
}
|
||||
|
||||
if( $conversation->alert )
|
||||
{
|
||||
try
|
||||
{
|
||||
$alert = \IPS\core\Alerts\Alert::load( $conversation->alert );
|
||||
}
|
||||
catch ( \OutOfRangeException $e ) {}
|
||||
|
||||
if( !$alert->forMember( \IPS\Member::loggedIn() ) )
|
||||
{
|
||||
$alert = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Default folder */
|
||||
@@ -259,14 +270,21 @@ class _messenger extends \IPS\Content\Controller
|
||||
|
||||
if ( isset( \IPS\Request::i()->search ) and $searchValues = \IPS\Request::i()->valueFromArray('search') )
|
||||
{
|
||||
if ( isset( $searchValues['topic'] ) )
|
||||
if ( isset( $searchValues['topic'] ) or isset( $searchValues['post'] ) )
|
||||
{
|
||||
$query[] = \IPS\Content\Search\Mysql\Query::matchClause( "core_message_topics.mt_title", \IPS\Request::i()->q, '+', FALSE );
|
||||
}
|
||||
if ( isset( $searchValues['post'] ) )
|
||||
{
|
||||
$query[] = \IPS\Content\Search\Mysql\Query::matchClause( "core_message_posts.msg_post", \IPS\Request::i()->q, '+', FALSE );
|
||||
$fulltext = [];
|
||||
if ( isset( $searchValues['topic'] ) )
|
||||
{
|
||||
$fulltext[] = \IPS\Content\Search\Mysql\Query::matchClause( "core_message_topics.mt_title", \IPS\Request::i()->q, '+', FALSE );
|
||||
}
|
||||
if ( isset( $searchValues['post'] ) )
|
||||
{
|
||||
$fulltext[] = \IPS\Content\Search\Mysql\Query::matchClause( "core_message_posts.msg_post", \IPS\Request::i()->q, '+', FALSE );
|
||||
}
|
||||
|
||||
$query[] = "core_message_posts.msg_id IN( SELECT msg_id FROM {$prefix}core_message_posts as core_message_posts LEFT JOIN {$prefix}core_message_topics as core_message_topics ON core_message_posts.msg_topic_id=core_message_topics.mt_id WHERE (" . implode( " OR ", $fulltext ) . ") )";
|
||||
}
|
||||
|
||||
if ( isset( $searchValues['recipient'] ) )
|
||||
{
|
||||
$query[] = "core_message_posts.msg_topic_id IN ( SELECT sender_map.map_topic_id FROM {$prefix}core_message_topic_user_map AS sender_map WHERE sender_map.map_is_starter=1 AND sender_map.map_user_id IN ( SELECT member_id FROM {$prefix}core_members AS sm WHERE name LIKE '" . \IPS\Db::i()->escape_string( \IPS\Request::i()->q ) . "%' ) )";
|
||||
@@ -421,7 +439,7 @@ class _messenger extends \IPS\Content\Controller
|
||||
{
|
||||
if( \IPS\Request::i()->id )
|
||||
{
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('messaging')->conversation( $conversation, $folders );
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('messaging')->conversation( $conversation, $folders, $alert );
|
||||
}
|
||||
elseif( \IPS\Request::i()->q )
|
||||
{
|
||||
@@ -453,7 +471,7 @@ class _messenger extends \IPS\Content\Controller
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('messaging')->template( $folder, $folders, $folderCounts, $conversations, $pagination, $conversation, $baseUrl, ( $conversation ? 'messenger_convo' : 'messenger' ), ( \IPS\Request::i()->sortBy ? htmlspecialchars( \IPS\Request::i()->sortBy, ENT_QUOTES | ENT_DISALLOWED, 'UTF-8', FALSE ): 'mt_last_post_time' ), ( \IPS\Request::i()->filter ? htmlspecialchars( \IPS\Request::i()->filter, ENT_QUOTES | ENT_DISALLOWED, 'UTF-8', FALSE ) : '' ) );
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('messaging')->template( $folder, $folders, $folderCounts, $conversations, $pagination, $conversation, $baseUrl, ( $conversation ? 'messenger_convo' : 'messenger' ), ( \IPS\Request::i()->sortBy ? htmlspecialchars( \IPS\Request::i()->sortBy, ENT_QUOTES | ENT_DISALLOWED, 'UTF-8', FALSE ): 'mt_last_post_time' ), ( \IPS\Request::i()->filter ? htmlspecialchars( \IPS\Request::i()->filter, ENT_QUOTES | ENT_DISALLOWED, 'UTF-8', FALSE ) : '' ), $alert );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -469,6 +487,20 @@ class _messenger extends \IPS\Content\Controller
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('compose_new');
|
||||
|
||||
if( \IPS\Request::i()->alert )
|
||||
{
|
||||
try
|
||||
{
|
||||
$alert = \IPS\core\Alerts\Alert::load( \IPS\Request::i()->alert );
|
||||
|
||||
if( $alert->forMember( \IPS\Member::loggedIn() ) )
|
||||
{
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('alert_modal_title', FALSE, array( 'sprintf' => array( $alert->title ) ) );
|
||||
}
|
||||
}
|
||||
catch ( \OutOfRangeException $e ) {}
|
||||
}
|
||||
|
||||
if( \IPS\Request::i()->isAjax() )
|
||||
{
|
||||
\IPS\Output::i()->output = $form->customTemplate( array( \IPS\Theme::i()->getTemplate( 'forms', 'core' ), 'popupTemplate' ) );
|
||||
@@ -779,7 +811,7 @@ class _messenger extends \IPS\Content\Controller
|
||||
throw new \InvalidArgumentException( \IPS\Member::loggedIn()->language()->addToStack('messenger_member_left', FALSE, array( 'sprintf' => array( $member->name ) ) ) );
|
||||
}
|
||||
|
||||
if ( !$conversation::memberCanReceiveNewMessage( $member, \IPS\Member::loggedIn() ) )
|
||||
if ( !$conversation::memberCanReceiveNewMessage( $member, \IPS\Member::loggedIn(), 'new' ) )
|
||||
{
|
||||
throw new \InvalidArgumentException( \IPS\Member::loggedIn()->language()->addToStack('meesnger_err_bad_recipient', FALSE, array( 'sprintf' => array( $member->name ) ) ) );
|
||||
}
|
||||
@@ -945,7 +977,7 @@ class _messenger extends \IPS\Content\Controller
|
||||
\IPS\Session::i()->csrfCheck();
|
||||
\IPS\Member::loggedIn()->members_disable_pm = 1;
|
||||
\IPS\Member::loggedIn()->save();
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( '' ), 'messenger_disabled' );
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=messaging&controller=messenger', 'front', 'messaging' ), 'messenger_disabled' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user