Version 4.1.2
This commit is contained in:
1 parent
3ba79295ee
commit
28bd025b35
1131 files changed
+63658
-20579
No files matched your search
@@ -87,11 +87,12 @@ class _settings extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
), NULL, NULL, NULL, 'ipschat_online' ) );
|
||||
|
||||
if ( $values = $form->values( TRUE ) )
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
\IPS\Lang::saveCustom( 'chat', "ipschat_rules", $values['ipschat_rules_text'] );
|
||||
unset( $values['ipschat_rules_text'] );
|
||||
$values['ipchat_hide_usermessage'] = !$values['ipchat_hide_usermessage'];
|
||||
$values['ipschat_online'] = implode( ',', $values['ipschat_online'] );
|
||||
$form->saveAsSettings( $values );
|
||||
|
||||
/* Clear guest page caches */
|
||||
|
||||
@@ -175,6 +175,12 @@ class _action extends \IPS\Content\Controller
|
||||
*/
|
||||
protected function ping()
|
||||
{
|
||||
/* Still online? */
|
||||
if ( $offlineMessage = \IPS\Application::load('chat')->offlineMessage() )
|
||||
{
|
||||
\IPS\Output::i()->json( array( 'message' => $offlineMessage ), 500 );
|
||||
}
|
||||
|
||||
/* Make sure there is an ID */
|
||||
if( !\IPS\Request::i()->id )
|
||||
{
|
||||
|
||||
@@ -74,48 +74,9 @@ class _view extends \IPS\Content\Controller
|
||||
}
|
||||
|
||||
/* Figure out if chat is online due to time restrictions */
|
||||
if( \IPS\Settings::i()->ipschat_online )
|
||||
if ( $offlineMessage = \IPS\Application::load('chat')->offlineMessage() )
|
||||
{
|
||||
$times = explode( ',', \IPS\Settings::i()->ipschat_online );
|
||||
|
||||
if( count( $times ) AND $times[0] )
|
||||
{
|
||||
/* Do we need to adjust the time zone? */
|
||||
if( isset( $times[2] ) AND $times[2] != \IPS\Member::loggedIn()->timezone )
|
||||
{
|
||||
$start = new \IPS\DateTime( '2015-01-01 ' . $times[0], new \DateTimeZone( $times[2] ) );
|
||||
$start->setTimezone( new \DateTimeZone( \IPS\Member::loggedIn()->timezone ) );
|
||||
$times[0] = $start->format( 'H:i' );
|
||||
|
||||
$end = new \IPS\DateTime( '2015-01-01 ' . $times[1], new \DateTimeZone( $times[2] ) );
|
||||
$end->setTimezone( new \DateTimeZone( \IPS\Member::loggedIn()->timezone ) );
|
||||
$times[1] = $end->format( 'H:i' );
|
||||
}
|
||||
|
||||
$currentTime = new \IPS\DateTime( NULL, new \DateTimeZone( ( isset( $times[2] ) ) ? $times[2] : \IPS\Member::loggedIn()->timezone ) );
|
||||
$currentTime->setTimezone( new \DateTimeZone( \IPS\Member::loggedIn()->timezone ) );
|
||||
$currentTime = $currentTime->format( 'H:i' );
|
||||
|
||||
/* Convert times to floats, as that is simple to compare */
|
||||
$start = str_replace( ':', '.', $times[0] );
|
||||
$end = str_replace( ':', '.', $times[1] );
|
||||
$currentTime = str_replace( ':', '.', $currentTime );
|
||||
|
||||
if( $end > $start )
|
||||
{
|
||||
if( !( $currentTime >= $start ) OR !( $currentTime < $end ) )
|
||||
{
|
||||
\IPS\Output::i()->error( \IPS\Member::loggedIn()->language()->addToStack( 'chat_currently_offline', FALSE, array( 'sprintf' => $start ) ), '1H269/I', 403, 'chat_offline_admin' );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( !( $currentTime >= $start ) AND $currentTime >= $end )
|
||||
{
|
||||
\IPS\Output::i()->error( \IPS\Member::loggedIn()->language()->addToStack( 'chat_currently_offline', FALSE, array( 'sprintf' => $start ) ), '1H269/J', 403, 'chat_offline_admin' );
|
||||
}
|
||||
}
|
||||
}
|
||||
\IPS\Output::i()->error( $offlineMessage, '1H269/H', 403, 'chat_offline_admin' );
|
||||
}
|
||||
|
||||
parent::execute();
|
||||
@@ -130,7 +91,7 @@ class _view extends \IPS\Content\Controller
|
||||
{
|
||||
/* Initiate output */
|
||||
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'jquery/jquery.rangyinputs.js', 'core', 'interface' ) );
|
||||
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'buzz/buzz.min.js', 'chat', 'interface' ) );
|
||||
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'buzz/buzz.min.js', 'core', 'interface' ) );
|
||||
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'esrever/esrever.js', 'chat', 'interface' ) );
|
||||
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'front_chat.js', 'chat', 'front' ) );
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'chat.css', 'chat', 'front' ) );
|
||||
@@ -345,7 +306,7 @@ class _view extends \IPS\Content\Controller
|
||||
|
||||
$chatters[ $username ] = array(
|
||||
'user_id' => $_thisRecord[0],
|
||||
'username' => htmlspecialchars( $username, ENT_QUOTES | \IPS\HTMLENTITIES, 'UTF-8', FALSE ),
|
||||
'username' => htmlspecialchars( $this->uncleanUsername( $username ), ENT_QUOTES | \IPS\HTMLENTITIES, 'UTF-8', FALSE ),
|
||||
'formattedUsername' => \IPS\Member\Group::load( $member->member_group_id )->formatName( $member->name ),
|
||||
'forumUserID' => $member->member_id,
|
||||
'canBeIgnored' => $member->member_id ? !$member->group['gbw_cannot_be_ignored'] : 1,
|
||||
@@ -403,7 +364,12 @@ class _view extends \IPS\Content\Controller
|
||||
$emoticons = array();
|
||||
foreach ( \IPS\Db::i()->select( '*', 'core_emoticons', NULL, 'emo_set,emo_position' ) as $row )
|
||||
{
|
||||
$emoticons[ $row['typed'] ] = (string) \IPS\File::get( 'core_Emoticons', $row['image'] )->url;
|
||||
$emoticons[ $row['typed'] ] = array( 'image' => (string) \IPS\File::get( 'core_Emoticons', $row['image'] )->url, 'width' => $row['width'], 'height' => $row['height'] );
|
||||
|
||||
if( $row['image_2x'] )
|
||||
{
|
||||
$emoticons[ $row['typed'] ]['image_2x'] = (string) \IPS\File::get( 'core_Emoticons', $row['image_2x'] )->url . ' 2x';
|
||||
}
|
||||
}
|
||||
|
||||
/* We store the chat options in our session in case we choose to leave the room */
|
||||
@@ -478,4 +444,22 @@ class _view extends \IPS\Content\Controller
|
||||
|
||||
return $username;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unclean username for chat
|
||||
*
|
||||
* @param string Username
|
||||
* @return string
|
||||
*/
|
||||
protected function uncleanUsername( $username )
|
||||
{
|
||||
$username = str_replace( "__PS__", "+", $username );
|
||||
$username = str_replace( "__E__", "=", $username );
|
||||
$username = str_replace( "__P__", "%", $username );
|
||||
$username = str_replace( "__A__", "&", $username );
|
||||
$username = str_replace( "__C__", ",", $username );
|
||||
$username = str_replace( "__N__", "\n", $username );
|
||||
|
||||
return $username;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user