Version 4.1.2
This commit is contained in:
1 parent
3ba79295ee
commit
28bd025b35
1131 files changed
+63658
-20579
No files matched your search
@@ -41,4 +41,56 @@ class _Application extends \IPS\Application
|
||||
{
|
||||
return 'comment';
|
||||
}
|
||||
|
||||
/**
|
||||
* Is chat online? Returns error message if not
|
||||
*
|
||||
* @return string|TRUE
|
||||
*/
|
||||
public function offlineMessage()
|
||||
{
|
||||
if( \IPS\Settings::i()->ipschat_online )
|
||||
{
|
||||
$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 ) )
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'chat_currently_offline', FALSE, array( 'sprintf' => $start ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( !( $currentTime >= $start ) AND $currentTime >= $end )
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'chat_currently_offline', FALSE, array( 'sprintf' => $start ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,16 @@
|
||||
{
|
||||
"chat": {
|
||||
"logs": {
|
||||
"tab": "community",
|
||||
"controller": "logs",
|
||||
"do": "",
|
||||
"restriction": "logs_manage"
|
||||
},
|
||||
"settings": {
|
||||
"tab": "community",
|
||||
"controller": "settings",
|
||||
"do": "",
|
||||
"restriction": "settings_manage"
|
||||
},
|
||||
"logs": {
|
||||
"tab": "community",
|
||||
"controller": "logs",
|
||||
"do": "",
|
||||
"restriction": "logs_manage"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<javascript app="chat">
|
||||
<file javascript_app="chat" javascript_location="front" javascript_path="controllers/chat" javascript_name="ips.chat.main.js" javascript_type="controller" javascript_version="100045" javascript_position="1000050"><![CDATA[/**
|
||||
<file javascript_app="chat" javascript_location="front" javascript_path="controllers/chat" javascript_name="ips.chat.main.js" javascript_type="controller" javascript_version="101012" javascript_position="1000050"><![CDATA[/**
|
||||
* IPS Social Suite 4
|
||||
* (c) 2013 Invision Power Services - http://www.invisionpower.com
|
||||
*
|
||||
@@ -52,12 +52,29 @@
|
||||
},
|
||||
|
||||
/**
|
||||
* Setup method
|
||||
* Setup wrapper method
|
||||
*
|
||||
* @returns {void}
|
||||
*/
|
||||
setup: function () {
|
||||
//return;
|
||||
var self = this;
|
||||
|
||||
if( window.btoa && window.atob ){
|
||||
this._doSetup();
|
||||
} else {
|
||||
// If bas64 isn't supported in the browser (< IE10), then load a polyfill before continuing
|
||||
ips.loader.get( ['chat/interface/base64/base64.js'] ).then( function () {
|
||||
self._doSetup();
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Performs setup tasks
|
||||
*
|
||||
* @returns {void}
|
||||
*/
|
||||
_doSetup: function () {
|
||||
var self = this;
|
||||
|
||||
this._setUpMainPanel();
|
||||
@@ -331,7 +348,8 @@
|
||||
* @returns {void}
|
||||
*/
|
||||
_createBadge: function () {
|
||||
$('.elNavigation_app_chat_Chat').append( $('<span/>').addClass('ipsNotificationCount').text('0') );
|
||||
// This is now added with a hook and doesn't need to be done here
|
||||
//$('.elNavigation_app_chat_Chat').append( $('<span/>').addClass('ipsNotificationCount').text('0') );
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -457,7 +475,8 @@
|
||||
*/
|
||||
_ping: function () {
|
||||
var url = '?app=chat&module=chat&controller=action&do=ping';
|
||||
|
||||
var self = this;
|
||||
|
||||
// Load the mini profile to show in the sidebar
|
||||
ips.getAjax()( url, {
|
||||
data: {
|
||||
@@ -466,6 +485,17 @@
|
||||
})
|
||||
.done( function (response) {
|
||||
// We don't need to do anything
|
||||
})
|
||||
.fail(function(response){
|
||||
if ( response.responseJSON.message ) {
|
||||
var containers = self._getAllStorageContainers();
|
||||
containers.append( ips.templates.render('chat.system', {
|
||||
text: response.responseJSON.message,
|
||||
date: self._getChatTime( self._getCurrentTime() )
|
||||
}));
|
||||
self._kicked = true;
|
||||
self._scrollToBottom( self._activeTab );
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
@@ -809,8 +839,8 @@
|
||||
this._checkInactivity( curtime );
|
||||
|
||||
if( this._kicked ){
|
||||
clearTimeout( this._poller );
|
||||
clearTimeout( this._updater );
|
||||
clearInterval( this._poller );
|
||||
clearInterval( this._updater );
|
||||
}
|
||||
|
||||
// If current time - last polled time is less than the polling timeperiod,
|
||||
@@ -1319,7 +1349,7 @@
|
||||
this.scope.find('[data-role="onlineChatters"]').html( ips.pluralize( ips.getString('usersChatting'), total ) );
|
||||
|
||||
// Update global chat tab
|
||||
$('.elNavigation_app_chat_Chat .ipsNotificationCount').text( total );
|
||||
$('.ipsNavBar_primary [data-navapp="chat"] .ipsNotificationCount').text( total );
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -1348,9 +1378,9 @@
|
||||
_unCleanMessage: function (message) {
|
||||
return message
|
||||
.replace( /__PS__/g, "+" )
|
||||
.replace( /__E__/g, "=" )
|
||||
.replace( /__P__/g, "%" )
|
||||
.replace( /__A__/g, "&" )
|
||||
.replace( /__E__/g, "=" )
|
||||
.replace( /__C__/g, "," )
|
||||
.replace( /__N__/g, "<br />" );
|
||||
},
|
||||
@@ -1374,10 +1404,20 @@
|
||||
// @todo this line still needed?
|
||||
message = message.replace( '!', '!' );
|
||||
|
||||
_.each( ips.getSetting('chatEmoticons'), function (url, emoticon) {
|
||||
var img = "$1<img src='" + url + "'>$2";
|
||||
_.each( ips.getSetting('chatEmoticons'), function (url, emoticon) {
|
||||
var img = $('<img/>').attr({ 'src': url['image'], 'data-emoticon': 'true' });
|
||||
if ( url['width'] ) {
|
||||
img.attr( 'width', url['width'] );
|
||||
}
|
||||
if ( url['height'] ) {
|
||||
img.attr( 'height', url['width'] );
|
||||
}
|
||||
if ( url['image_2x'] ) {
|
||||
img.attr( 'srcset', url['image_2x'] );
|
||||
}
|
||||
img = "$1" + $('<div/>').append( img ).html() + "$2";
|
||||
|
||||
var regexp = new RegExp( "(^|\\s)" + self._escapeRegex( emoticon ) + "(\\s|$)", "gi" );
|
||||
|
||||
while( message.match( regexp ) ){
|
||||
message = message.replace( regexp, img );
|
||||
}
|
||||
@@ -1657,7 +1697,7 @@
|
||||
var indexOfURL = text.indexOf( url, lastPos );
|
||||
var returnURL = url;
|
||||
|
||||
if( text.substring( indexOfURL, indexOfURL - 5) !== "src='" ){
|
||||
if( text.substring( indexOfURL, indexOfURL - 5) !== 'src="' && text.substring( indexOfURL, indexOfURL - 8) !== 'srcset="' ){
|
||||
returnURL = '<a href="' + url + '" target="_blank">' + url + '</a>';
|
||||
}
|
||||
|
||||
@@ -1744,7 +1784,9 @@
|
||||
msgDetails[2] = _details.prefix.replace( /__DBQ__/g, '"' ) + msgDetails[2] + _details.suffix.replace( /__DBQ__/g, '"' );
|
||||
}
|
||||
|
||||
var tab = this.scope.find('#elChatTabs [data-user="' + msgDetails[2] + '"]')
|
||||
// https://community.invisionpower.com/4bugtrack/active-reports/chat-tabs-with-html-in-group-name-r8351/
|
||||
// This line isn't actually used and was causing the error.
|
||||
//var tab = this.scope.find('#elChatTabs [data-user="' + msgDetails[2] + '"]')
|
||||
|
||||
state.alsoTo = details[1];
|
||||
|
||||
@@ -1837,7 +1879,7 @@
|
||||
}
|
||||
});
|
||||
}(jQuery, _));]]></file>
|
||||
<file javascript_app="chat" javascript_location="front" javascript_path="templates" javascript_name="ips.templates.chat.js" javascript_type="template" javascript_version="100045" javascript_position="1000100"><![CDATA[ips.templates.set('chat.tabs.tab', " \
|
||||
<file javascript_app="chat" javascript_location="front" javascript_path="templates" javascript_name="ips.templates.chat.js" javascript_type="template" javascript_version="101012" javascript_position="1000100"><![CDATA[ips.templates.set('chat.tabs.tab', " \
|
||||
<li role='presentation' data-roomID='{{roomID}}'>\
|
||||
<a href='#' role='tab' id='{{roomID}}' class='ipsFaded_withHover ipsTabs_item ipsType_blendLinks {{#active}}ipsTabs_activeItem{{/active}}' aria-selected='false'>\
|
||||
{{roomTitle}} {{#close}} <span class='ipsFaded ipsFaded_more' data-action='closeTab' data-ipsTooltip title='{{#lang}}closeThisTab{{/lang}}'><i class='fa fa-times'></i></span>{{/close}}\
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<language>
|
||||
<app key="chat" version="100045">
|
||||
<app key="chat" version="101012">
|
||||
<word key="__app_chat" js="0">Chat</word>
|
||||
<word key="frontnavigation_chat" js="0">Chat</word>
|
||||
<word key="chat_title" js="0">Chat</word>
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
</li>
|
||||
<li>
|
||||
{{$leave = \IPS\Request::i()->_popup ? '&_popup=' . \IPS\Request::i()->_popup : '';}}
|
||||
<a href='{url="app=chat&module=chat&controller=view&do=leave{$leave}" seoTemplate="chat" csrf="true"}' class='ipsPos_right ipsButton ipsButton_verySmall ipsButton_overlaid' data-action='leaveChat' data-ipsTooltip title='{lang="chat_leave_room"}'>{lang="chat_leave_room"}</a>
|
||||
<a href='{url="app=chat&module=chat&controller=view&do=leave{$leave}" seoTemplate="chat" csrf="true"}' class='ipsPos_right ipsButton ipsButton_verySmall ipsButton_overlaid' data-action='leaveChat'>{lang="chat_leave_room"}</a>
|
||||
</li>
|
||||
</ul>
|
||||
<a href="#elChatTabs" data-action="expandTabs"><i class="fa fa-caret-down"></i></a>
|
||||
@@ -74,7 +74,7 @@
|
||||
</li>
|
||||
<li>
|
||||
{{$leave = \IPS\Request::i()->_popup ? '&_popup=' . \IPS\Request::i()->_popup : '';}}
|
||||
<a href='{url="app=chat&module=chat&controller=view&do=leave{$leave}" seoTemplate="chat" csrf="true"}' class='ipsPos_right ipsButton ipsButton_verySmall ipsButton_light' data-action='leaveChat' data-ipsTooltip title='{lang="chat_leave_room"}'>{lang="chat_leave_room"}</a>
|
||||
<a href='{url="app=chat&module=chat&controller=view&do=leave{$leave}" seoTemplate="chat" csrf="true"}' class='ipsPos_right ipsButton ipsButton_verySmall ipsButton_light' data-action='leaveChat'>{lang="chat_leave_room"}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -169,7 +169,9 @@
|
||||
<a href='#'>{lang="ipchat_ban"}</a>
|
||||
</li>
|
||||
{{endif}}
|
||||
<li class='ipsMenu_sep'><hr></li>
|
||||
{{if $data['forumUserID']}}
|
||||
<li class='ipsMenu_sep'><hr></li>
|
||||
{{endif}}
|
||||
{{endif}}
|
||||
{{if $data['forumUserID']}}
|
||||
<li class='ipsMenu_item'>
|
||||
|
||||
@@ -85,5 +85,18 @@
|
||||
"100042": "4.0.12",
|
||||
"100043": "4.0.12.1",
|
||||
"100044": "4.0.13",
|
||||
"100045": "4.0.13.1"
|
||||
"100045": "4.0.13.1",
|
||||
"101000": "4.1.0 Beta 1",
|
||||
"101001": "4.1.0 Beta 2",
|
||||
"101002": "4.1.0 Beta 3",
|
||||
"101003": "4.1.0 Beta 4",
|
||||
"101004": "4.1.0 Beta 5",
|
||||
"101005": "4.1.0 Beta 6",
|
||||
"101006": "4.1.0 Beta 7",
|
||||
"101007": "4.1.0 Beta 8",
|
||||
"101008": "4.1.0 Beta 9",
|
||||
"101009": "4.1.0 Beta 10",
|
||||
"101010": "4.1.0",
|
||||
"101011": "4.1.1",
|
||||
"101012": "4.1.2"
|
||||
}
|
||||
@@ -22,8 +22,18 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
/**
|
||||
* Front Navigation Extension: Chat
|
||||
*/
|
||||
class _Chat
|
||||
class _Chat extends \IPS\core\FrontNavigation\FrontNavigationAbstract
|
||||
{
|
||||
/**
|
||||
* Get Type Title which will display in the AdminCP Menu Manager
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function typeTitle()
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->addToStack('frontnavigation_chat');
|
||||
}
|
||||
|
||||
/**
|
||||
* Can access?
|
||||
*
|
||||
@@ -31,7 +41,7 @@ class _Chat
|
||||
*/
|
||||
public function canView()
|
||||
{
|
||||
return !\IPS\Application::load('chat')->hide_tab and \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'chat', 'chat' ) );
|
||||
return parent::canView() and \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'chat', 'chat' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -63,14 +73,4 @@ class _Chat
|
||||
{
|
||||
return \IPS\Dispatcher::i()->application->directory === 'chat';
|
||||
}
|
||||
|
||||
/**
|
||||
* Children
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function children()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,7 @@ class _ChatAccess
|
||||
/**
|
||||
* Process Form
|
||||
*
|
||||
* @param \IPS\Form\Tabbed $form The form
|
||||
* @param \IPS\Helpers\Form $form The form
|
||||
* @param \IPS\Member\Group $group Existing Group
|
||||
* @return void
|
||||
*/
|
||||
|
||||
@@ -27,7 +27,7 @@ class _ChatBanned
|
||||
/**
|
||||
* Process Form
|
||||
*
|
||||
* @param \IPS\Form\Tabbed $form The form
|
||||
* @param \IPS\Helpers\Form $form The form
|
||||
* @param \IPS\Member $member Existing Member
|
||||
* @return void
|
||||
*/
|
||||
|
||||
@@ -49,7 +49,7 @@ class chat_hook_tabCount extends _HOOK_CLASS_
|
||||
|
||||
\IPS\Output::i()->endBodyCode .= <<<HTML
|
||||
<script type='text/javascript'>
|
||||
$('.elNavigation_app_chat_Chat').append( $('<span/>').addClass('ipsNotificationCount').text('{$count}') );
|
||||
$('[data-role="navBarItem"][data-navApp="chat"][data-navExt="Chat"]').append( $('<span/>').addClass('ipsNotificationCount').text('{$count}') );
|
||||
</script>
|
||||
HTML;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,10 @@ class chat_hook_tabCountLoad extends _HOOK_CLASS_
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->initLoad[] = 'chatters';
|
||||
if ( \IPS\CACHE_METHOD === 'None' )
|
||||
{
|
||||
$this->initLoad[] = 'chatters';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
!function(){function t(t){this.message=t}var r="undefined"!=typeof exports?exports:this,e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";t.prototype=new Error,t.prototype.name="InvalidCharacterError",r.btoa||(r.btoa=function(r){for(var o,n,a=String(r),i=0,c=e,d="";a.charAt(0|i)||(c="=",i%1);d+=c.charAt(63&o>>8-i%1*8)){if(n=a.charCodeAt(i+=.75),n>255)throw new t("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");o=o<<8|n}return d}),r.atob||(r.atob=function(r){var o=String(r).replace(/=+$/,"");if(o.length%4==1)throw new t("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,a,i=0,c=0,d="";a=o.charAt(c++);~a&&(n=i%4?64*n+a:a,i++%4)?d+=String.fromCharCode(255&n>>(-2*i&6)):0)a=e.indexOf(a);return d})}();
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// Buzz, a Javascript HTML5 Audio library
|
||||
// v1.1.8 - Built 2015-01-12 11:08
|
||||
// Licensed under the MIT license.
|
||||
// http://buzz.jaysalvat.com/
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright (C) 2010-2015 Jay Salvat
|
||||
// http://jaysalvat.com/
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
(function(t,e){"use strict";"undefined"!=typeof module&&module.exports?module.exports=e():"function"==typeof define&&define.amd?define([],e):t.buzz=e()})(this,function(){"use strict";var t=window.AudioContext||window.webkitAudioContext,e={audioCtx:window.AudioContext?new t:null,defaults:{autoplay:!1,duration:5e3,formats:[],loop:!1,placeholder:"--",preload:"metadata",volume:80,webAudioApi:!1,document:window.document},types:{mp3:"audio/mpeg",ogg:"audio/ogg",wav:"audio/wav",aac:"audio/aac",m4a:"audio/x-m4a"},sounds:[],el:document.createElement("audio"),sound:function(t,n){function i(t){for(var e=[],n=t.length-1,i=0;n>=i;i++)e.push({start:t.start(i),end:t.end(i)});return e}function u(t){return t.split(".").pop()}n=n||{};var s=n.document||e.defaults.document,r=0,o=[],a={},h=e.isSupported();if(this.load=function(){return h?(this.sound.load(),this):this},this.play=function(){return h?(this.sound.play(),this):this},this.togglePlay=function(){return h?(this.sound.paused?this.sound.play():this.sound.pause(),this):this},this.pause=function(){return h?(this.sound.pause(),this):this},this.isPaused=function(){return h?this.sound.paused:null},this.stop=function(){return h?(this.setTime(0),this.sound.pause(),this):this},this.isEnded=function(){return h?this.sound.ended:null},this.loop=function(){return h?(this.sound.loop="loop",this.bind("ended.buzzloop",function(){this.currentTime=0,this.play()}),this):this},this.unloop=function(){return h?(this.sound.removeAttribute("loop"),this.unbind("ended.buzzloop"),this):this},this.mute=function(){return h?(this.sound.muted=!0,this):this},this.unmute=function(){return h?(this.sound.muted=!1,this):this},this.toggleMute=function(){return h?(this.sound.muted=!this.sound.muted,this):this},this.isMuted=function(){return h?this.sound.muted:null},this.setVolume=function(t){return h?(0>t&&(t=0),t>100&&(t=100),this.volume=t,this.sound.volume=t/100,this):this},this.getVolume=function(){return h?this.volume:this},this.increaseVolume=function(t){return this.setVolume(this.volume+(t||1))},this.decreaseVolume=function(t){return this.setVolume(this.volume-(t||1))},this.setTime=function(t){if(!h)return this;var e=!0;return this.whenReady(function(){e===!0&&(e=!1,this.sound.currentTime=t)}),this},this.getTime=function(){if(!h)return null;var t=Math.round(100*this.sound.currentTime)/100;return isNaN(t)?e.defaults.placeholder:t},this.setPercent=function(t){return h?this.setTime(e.fromPercent(t,this.sound.duration)):this},this.getPercent=function(){if(!h)return null;var t=Math.round(e.toPercent(this.sound.currentTime,this.sound.duration));return isNaN(t)?e.defaults.placeholder:t},this.setSpeed=function(t){return h?(this.sound.playbackRate=t,this):this},this.getSpeed=function(){return h?this.sound.playbackRate:null},this.getDuration=function(){if(!h)return null;var t=Math.round(100*this.sound.duration)/100;return isNaN(t)?e.defaults.placeholder:t},this.getPlayed=function(){return h?i(this.sound.played):null},this.getBuffered=function(){return h?i(this.sound.buffered):null},this.getSeekable=function(){return h?i(this.sound.seekable):null},this.getErrorCode=function(){return h&&this.sound.error?this.sound.error.code:0},this.getErrorMessage=function(){if(!h)return null;switch(this.getErrorCode()){case 1:return"MEDIA_ERR_ABORTED";case 2:return"MEDIA_ERR_NETWORK";case 3:return"MEDIA_ERR_DECODE";case 4:return"MEDIA_ERR_SRC_NOT_SUPPORTED";default:return null}},this.getStateCode=function(){return h?this.sound.readyState:null},this.getStateMessage=function(){if(!h)return null;switch(this.getStateCode()){case 0:return"HAVE_NOTHING";case 1:return"HAVE_METADATA";case 2:return"HAVE_CURRENT_DATA";case 3:return"HAVE_FUTURE_DATA";case 4:return"HAVE_ENOUGH_DATA";default:return null}},this.getNetworkStateCode=function(){return h?this.sound.networkState:null},this.getNetworkStateMessage=function(){if(!h)return null;switch(this.getNetworkStateCode()){case 0:return"NETWORK_EMPTY";case 1:return"NETWORK_IDLE";case 2:return"NETWORK_LOADING";case 3:return"NETWORK_NO_SOURCE";default:return null}},this.set=function(t,e){return h?(this.sound[t]=e,this):this},this.get=function(t){return h?t?this.sound[t]:this.sound:null},this.bind=function(t,e){if(!h)return this;t=t.split(" ");for(var n=this,i=function(t){e.call(n,t)},u=0;t.length>u;u++){var s=t[u],r=s;s=r.split(".")[0],o.push({idx:r,func:i}),this.sound.addEventListener(s,i,!0)}return this},this.unbind=function(t){if(!h)return this;t=t.split(" ");for(var e=0;t.length>e;e++)for(var n=t[e],i=n.split(".")[0],u=0;o.length>u;u++){var s=o[u].idx.split(".");(o[u].idx===n||s[1]&&s[1]===n.replace(".",""))&&(this.sound.removeEventListener(i,o[u].func,!0),o.splice(u,1))}return this},this.bindOnce=function(t,e){if(!h)return this;var n=this;return a[r++]=!1,this.bind(t+"."+r,function(){a[r]||(a[r]=!0,e.call(n)),n.unbind(t+"."+r)}),this},this.trigger=function(t,e){if(!h)return this;t=t.split(" ");for(var n=0;t.length>n;n++)for(var i=t[n],u=0;o.length>u;u++){var r=o[u].idx.split(".");if(o[u].idxLine truncated
|
||||
Whitespace-only changes.
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -52,7 +52,7 @@ class _Upgrade
|
||||
}
|
||||
|
||||
/* Add rules text */
|
||||
\IPS\Lang::saveCustom( 'core', "ipschat_rules", html_entity_decode( \IPS\Settings::i()->ipschat_rules, ENT_QUOTES, 'UTF-8' ) );
|
||||
\IPS\Lang::saveCustom( 'core', "ipschat_rules", \IPS\Text\Parser::utf8mb4SafeDecode( \IPS\Settings::i()->ipschat_rules ) );
|
||||
|
||||
/* Add online/offline start value */
|
||||
\IPS\Db::i()->replace( 'core_sys_conf_settings', array(
|
||||
|
||||
Reference in new issue
Block a user