diff --git a/chat/changelog.txt b/chat/changelog.txt index 733eb99..fe3b028 100644 --- a/chat/changelog.txt +++ b/chat/changelog.txt @@ -843,4 +843,30 @@ Bugfixes: - Fix potential conflict between php and mysql timezones by using mysql's FROM_UNIXTIME(). - thanks to ManOnDaMoon. - Normalized sound volumes a bit. - Fixed mybb integration database connection. Connection details should be pulled automatically now. -- Fidex mybb integration guest logins to accept guests that don't enter a username (assign numbers like other versions). \ No newline at end of file +- Fidex mybb integration guest logins to accept guests that don't enter a username (assign numbers like other versions). + +Version 0.8.8 (?.?.2014) +------------------------------- +Notice: +- Templates, especially loggedIn.html have changed a lot to add mobile support. Javascript in the templates files has also changed. +- CSS for themes has slightly changed and you may need to update your custom stylesheets. +- The themes subSilver and subblack2 were removed. +- If you are using the javascript override handleCustomInfoMessage in custom.js, you should make it return true if you capture an event. + +New Features: +- Private messages now have their own sound - thanks to marquisite. +- Private messages have their own background color. +- Added two new sounds - one is extra for your customization pleasure. +- Added a custom user group and banned user group for customization and integration - thanks to marquisite. +- Added a debug mode to chat.js - thanks to Sophist-UK. +- New theme "Pine" added - thanks to Rosina Ramirez. + +Bugfixes: +- HTML is now stripped from [IMG] tag URLs, and tag parsing errors will no longer crash chat. - thanks to gWorldz. +- Nesting an [IMG] inside a [URL] tag will now only open the URL instead of also opening the image - thanks to James Almer. +- Users can now be kicked for 0 minutes, which is effectively a kick and not a ban - thanks to micheal-swiggs. +- User list sorting is now case insensitive (lists should be properly alphabetical) - thanks to marquisite. +- MyBB forums were not showing up correctly in the room list. + +Misc: +- Removed unneeded call to mt_srand() - thanks to Joshua Embrey. diff --git a/chat/css/Cobalt.css b/chat/css/Cobalt.css index 08c4e36..d4e89e6 100644 --- a/chat/css/Cobalt.css +++ b/chat/css/Cobalt.css @@ -2,121 +2,114 @@ * @package AJAX_Chat * @author Sebastian Tschan * @author Philip Nicolcev - * @copyright (c) Sebastian Tschan - * @license Modified MIT License - * @link https://blueimp.net/ajax/ * * Color palette inspired by PunBB style "Cobalt": * http://punbb.org/ */ - @import url('global.css'); @import url('fonts.css'); @import url('print.css'); +@import url('custom.css'); + +/* Buttons */ +#content #bbCodeContainer input, #content #logoutButton, #content #submitButton, #loginForm #loginButton { + background-color:#1a1a1a; + color:#ababab; + border: 0; +} +#content #bbCodeContainer input:hover, #content #logoutButton:hover, #content #submitButton:hover, #loginForm #loginButton:hover { + background-color:#1D68E0; + color:#000; +} +#content select, #loginForm select, #loginForm input, #content textarea { + background-color:#383838; + color:#ababab; + border: 1px solid #565656; +} -@media screen,projection,handheld { +/* Status Icon */ +#content #statusIconContainer { + background: url('../img/loading-sprite.png') no-repeat 0px 0px; +} +#content #statusIconContainer.waiting { + background-position: 0px -22px; +} +#content #statusIconContainer.retrying { + background-position: 0px -44px; +} - /* Buttons */ - #content #bbCodeContainer input, #content #logoutButton, #content #submitButton, #loginForm #loginButton { - background-color:#1a1a1a; - color:#ababab; - border: 0; - } - #content select, #loginForm select, #loginForm input, #content textarea { - background-color:#383838; - color:#ababab; - border: 1px solid #565656; - } - - /* Status Icon */ - #content #statusIconContainer { - background-image: url('../img/loading-sprite.png'); - } - #content .statusContainerOff { - background-position: 0px 0px; - } - #content .statusContainerOn { - background-position: 0px -22px; - } - #content .statusContainerAlert { - background-position: 0px -44px; - } - - /* Other Theme Elements */ - #loginContent { - background-color:#2A2A2A; - color:#D4D4D4; - } - #loginContent h1 { - color:#D4D4D4; - } - #loginContent a { - color:#60A0DC; - } - #loginContent #loginFormContainer #loginButton { - background-color:#424242; - color:#D4D4D4; - } - #loginContent #errorContainer { - color:red; - } - - #content { - background-color:#2A2A2A; - color:#D4D4D4; - } - #content h1 { - color:#D4D4D4; - } - #content a { - color:#60A0DC; - } - #content #chatList, #content #onlineListContainer, #content #helpContainer, #content #settingsContainer, #content #colorCodesContainer { - border: 1px solid #565656; - background-color:#383838; - } - #content #bbCodeContainer, #content #emoticonsContainer { - background-color:#383838; - padding: 5px; - } - #content #colorCodesContainer a { - border-color:black; - } - #content #optionsContainer input { - background-color:transparent; - } - #content .rowEven { - background-color:#565656; - } - #content .rowOdd { - background-color:#484848; - } - #content .guest { - color:gray; - } - #content .user { - color:#D4D4D4; - } - #content .moderator { - color:#00AA00; - } - #content .admin { - color:red; - } - #content .chatBot { - color:#60A0DC; - } - #content #chatList .chatBotErrorMessage { - color:red; - } - #content #chatList a { - color:#60A0DC; - } - #content #chatList .deleteSelected { - border-color:red; - } - #content #onlineListContainer h3, #content #helpContainer h3, #content #settingsContainer h3 { - background-color:#383838; - color:#D4D4D4; - } +/* Other Theme Elements */ +.ajax-chat { + background-color:#2A2A2A; + color:#D4D4D4; +} +.ajax-chat h1 { + color:#D4D4D4; +} +.ajax-chat a { + color:#60A0DC; +} +#loginContent #loginButton { + background-color:#424242; + color:#D4D4D4; +} +#loginContent #errorContainer { + color:red; +} +#content #chatList, #content #onlineListContainer, #content #helpContainer, #content #settingsContainer, #content #colorCodesContainer { + border: 1px solid #565656; + background-color:#383838; +} +.ajax-chat .popup { + background-color:#383838; + padding:5px; +} +#content #colorCodesContainer a { + border-color:black; +} +#content #optionsContainer input { + background-color:transparent; +} +#content .rowEven, #helpList dl:nth-child(even), #settingsList dl:nth-child(even) { + background-color:#565656; +} +#content .rowOdd, #helpList dl:nth-child(odd), #settingsList dl:nth-child(odd) { + background-color:#484848; +} +#content #chatList .rowOdd.private { + background-color:#B83C1D; +} +#content #chatList .rowEven.private { + background-color:#C84A24; +} +#content .guest { + color:gray; +} +#content .user { + color:#D4D4D4; +} +#content .customUser { + color:#acc2d7; +} +#content .moderator { + color:#00AA00; +} +#content .admin { + color:red; +} +#content .chatBot { + color:#60A0DC; +} +#content #chatList .chatBotErrorMessage { + color:red; +} +#content #chatList a { + color:#60A0DC; +} +#content #chatList .deleteSelected { + border-color:red; +} +#content #onlineListContainer h3, #content #helpContainer h3, #content #settingsContainer h3 { + background-color:#383838; + color:#D4D4D4; } \ No newline at end of file diff --git a/chat/css/Core.css b/chat/css/Core.css index 104fb1b..06de2ac 100644 --- a/chat/css/Core.css +++ b/chat/css/Core.css @@ -2,114 +2,116 @@ * @package AJAX_Chat * @author Sebastian Tschan * @author Philip Nicolcev - * @copyright (c) Sebastian Tschan - * @license Modified MIT License - * @link https://blueimp.net/ajax/ * * Color palette inspired by Simple Machines Forum style "SMF Default Theme - Core": * http://www.simplemachines.org/ */ - @import url('global.css'); @import url('fonts.css'); @import url('print.css'); +@import url('custom.css'); -@media screen,projection,handheld { +/* Buttons */ +#content #bbCodeContainer input, #content #logoutButton, #content #submitButton, #loginForm #loginButton { + background-color:#CDE7FF; + color:#333333; + border: 1px solid #787878; +} +#content select, #loginForm select, #loginForm input, #content textarea { + color:#333333; + border: 1px solid #787878; +} - /* Buttons */ - #content #bbCodeContainer input, #content #logoutButton, #content #submitButton, #loginForm #loginButton { - background-color:#CDE7FF; - color:#333333; - border: 1px solid #787878; - } - #content select, #loginForm select, #loginForm input, #content textarea { - color:#333333; - border: 1px solid #787878; - } +/* Status Icon */ +#content #statusIconContainer { + background: url('../img/loading-sprite.png') no-repeat 0px 0px; +} +#content #statusIconContainer.waiting { + background-position: 0px -22px; +} +#content #statusIconContainer.retrying { + background-position: 0px -44px; +} - /* Status Icon */ - #content #statusIconContainer { - background-image: url('../img/loading-sprite.png'); - } - #content .statusContainerOff { - background-position: 0px 0px; - } - #content .statusContainerOn { - background-position: 0px -22px; - } - #content .statusContainerAlert { - background-position: 0px -44px; - } - - #loginContent { - background-color:#E5E5E8; - color:#000; - } - #loginContent h1 { - color:#000; - } - #loginContent a { - color:#000; - } - #loginContent #errorContainer { - color:red; - } - #content { - background-color:#E5E5E8; - color:#000; - } - #content h1 { - color:#000; - } - #content a { - color:#000; - } - #content input, #content select, #content textarea { - background-color:#FFF; - color:#000; - } - #content #chatList, #content #onlineListContainer, #content #helpContainer, #content #settingsContainer, #content #colorCodesContainer, #content #emoticonsContainer { - border-color:#ADADAD; +/* Other Theme Elements */ +.ajax-chat { + background-color:#E5E5E8; + color:#000; +} +.ajax-chat h1 { + color:#000; +} +.ajax-chat a { + color:#000; +} +#loginContent #errorContainer { + color:red; +} +#content input, #content select, #content textarea { + background-color:#FFF; + color:#000; +} +#content #chatList, #content #onlineListContainer, #content #helpContainer, #content #settingsContainer { + border-color:#ADADAD; + background-color:#FFF; +} +.ajax-chat .popup { + background-color:#ADADAD; + border:1px solid gray; +} +#content #colorCodesContainer a { + border-color:black; +} +#content #optionsContainer input { + background-color:transparent; +} +#content .rowEven, #helpList dl:nth-child(even), #settingsList dl:nth-child(even) { + background-color:#ECEDF3; +} +#content .rowOdd, #helpList dl:nth-child(odd), #settingsList dl:nth-child(odd) { + background-color:#F6F6F6; +} +#content #chatList .rowOdd.private { + background-color:#F8D0D0; +} +#content #chatList .rowEven.private { + background-color:#F8D9D0; +} +#content .guest { + color:gray; +} +#content .user { + color:#000; +} +#content .customUser { + color:#003d8e; +} +#content .moderator { + color:#0000FF; +} +#content .admin { + color:#FF0000; +} +#content .chatBot { + color:#476C8E; +} +#content #chatList .chatBotErrorMessage { + color:red; +} +#content #chatList a { + color:#476C8E; +} +#content #chatList .deleteSelected { + border-color:red; +} +#content #onlineListContainer h3, #content #helpContainer h3, #content #settingsContainer h3 { + background-color:#88A6C0; + color:#FFF; +} + +@media (max-width: 700px) { + #content #emoticonsContainer { background-color:#FFF; - } - #content #colorCodesContainer a { - border-color:black; - } - #content #optionsContainer input { - background-color:transparent; - } - #content .rowEven { - background-color:#ECEDF3; - } - #content .rowOdd { - background-color:#F6F6F6; - } - #content .guest { - color:gray; - } - #content .user { - color:#000; - } - #content .moderator { - color:#0000FF; - } - #content .admin { - color:#FF0000; - } - #content .chatBot { - color:#476C8E; - } - #content #chatList .chatBotErrorMessage { - color:red; - } - #content #chatList a { - color:#476C8E; - } - #content #chatList .deleteSelected { - border-color:red; - } - #content #onlineListContainer h3, #content #helpContainer h3, #content #settingsContainer h3 { - background-color:#88A6C0; - color:#FFF; + border: 1px solid #ADADAD; } } \ No newline at end of file diff --git a/chat/css/Lithium.css b/chat/css/Lithium.css index 8776158..07cf534 100644 --- a/chat/css/Lithium.css +++ b/chat/css/Lithium.css @@ -2,115 +2,112 @@ * @package AJAX_Chat * @author Sebastian Tschan * @author Philip Nicolcev - * @copyright (c) Sebastian Tschan - * @license Modified MIT License - * @link https://blueimp.net/ajax/ * * Color palette inspired by PunBB style "Lithium": * http://punbb.org/ */ - @import url('global.css'); @import url('fonts.css'); @import url('print.css'); +@import url('custom.css'); + +/* Buttons */ +#content #bbCodeContainer input, #content #logoutButton, #content #submitButton, #loginForm #loginButton { + background-color:#6C8A3F; + color: #fff; + border:1px solid #6C8A3F; +} +#content #bbCodeContainer input:hover, #content #logoutButton:hover, #content #submitButton:hover, #loginForm #loginButton:hover { + background-color:#5E7D2E; +} +#content select, #loginForm select, #loginForm input, #content textarea { + color:#333333; + border: 1px solid #6C8A3F; +} -@media screen,projection,handheld { +/* Status Icon */ +#content #statusIconContainer { + background: url('../img/loading-sprite.png') no-repeat 0px 0px; +} +#content #statusIconContainer.waiting { + background-position: 0px -22px; +} +#content #statusIconContainer.retrying { + background-position: 0px -44px; +} - /* Buttons */ - #content #bbCodeContainer input, #content #logoutButton, #content #submitButton, #loginForm #loginButton { - background-color:#6C8A3F; - color: #fff; - border: 1px solid #6C8A3F; - } - #content select, #loginForm select, #loginForm input, #content textarea { - color:#333333; - border: 1px solid #6C8A3F; - } - - /* Status Icon */ - #content #statusIconContainer { - background-image: url('../img/loading-sprite.png'); - } - #content .statusContainerOff { - background-position: 0px 0px; - } - #content .statusContainerOn { - background-position: 0px -22px; - } - #content .statusContainerAlert { - background-position: 0px -44px; - } - - /* Other Theme Elements */ - #loginContent { - background-color:#F1F1F1; - color:#333333; - } - #loginContent h1 { - color:#333333; - } - #loginContent a { - color:#638137; - } - #loginContent input, #loginContent select { - background-color:#FFF; - color:#333333; - } - #loginContent #errorContainer { - color:red; - } - #content { - background-color:#F1F1F1; - color:#333333; - } - #content h1 { - color:#333333; - } - #content a { - color:#638137; - } - #content #chatList, #content #onlineListContainer, #content #helpContainer, #content #settingsContainer, #content #colorCodesContainer, #content textarea { - border-color:#6C8A3F; - background-color:#FFF; - } - #content #colorCodesContainer a { - border-color:black; - } - #content #optionsContainer input { - background-color:transparent; - } - #content .rowEven { - background-color:#F1F1F1; - } - #content .rowOdd { - background-color:#DEDFDF; - } - #content .guest { - color:gray; - } - #content .user { - color:#000; - } - #content .moderator { - color:#00AA00; - } - #content .admin { - color:red; - } - #content .chatBot { - color:#638137; - } - #content #chatList .chatBotErrorMessage { - color:red; - } - #content #chatList a { - color:#638137; - } - #content #chatList .deleteSelected { - border-color:red; - } - #content #onlineListContainer h3, #content #helpContainer h3, #content #settingsContainer h3 { - background-color:#6C8A3F; - color:#FFF; - } +/* Other Theme Elements */ +.ajax-chat { + background-color:#F1F1F1; + color:#333; +} +.ajax-chat h1 { + color:#333333; +} +.ajax-chat a { + color:#638137; +} +#loginContent input, #loginContent select { + background-color:#FFF; + color:#333333; +} +#loginContent #errorContainer { + color:red; +} +#content #chatList, #content #onlineListContainer, #content #helpContainer, #content #settingsContainer, #content textarea { + border-color:#6C8A3F; + background-color:#FFF; +} +.ajax-chat .popup { + background-color:#FFF; + border:1px solid #6C8A3F; +} +#content #colorCodesContainer a { + border-color:black; +} +#content #optionsContainer input { + background-color:transparent; +} +#content .rowEven, #helpList dl:nth-child(even), #settingsList dl:nth-child(even) { + background-color:#F1F1F1; +} +#content .rowOdd, #helpList dl:nth-child(odd), #settingsList dl:nth-child(odd) { + background-color:#DEDFDF; +} +#content #chatList .rowOdd.private { + background-color:#84CF86; +} +#content #chatList .rowEven.private { + background-color:#9FD598; +} +#content .guest { + color:gray; +} +#content .user { + color:#000; +} +#content .customUser { + color:#406021; +} +#content .moderator { + color:#00AA00; +} +#content .admin { + color:red; +} +#content .chatBot { + color:#638137; +} +#content #chatList .chatBotErrorMessage { + color:red; +} +#content #chatList a { + color:#638137; +} +#content #chatList .deleteSelected { + border-color:red; +} +#content #onlineListContainer h3, #content #helpContainer h3, #content #settingsContainer h3 { + background-color:#6C8A3F; + color:#FFF; } \ No newline at end of file diff --git a/chat/css/Mercury.css b/chat/css/Mercury.css index f7e12d5..1fe0530 100644 --- a/chat/css/Mercury.css +++ b/chat/css/Mercury.css @@ -2,153 +2,147 @@ * @package AJAX_Chat * @author Sebastian Tschan * @author Philip Nicolcev - * @copyright (c) Sebastian Tschan - * @license Modified MIT License - * @link https://blueimp.net/ajax/ * * Color palette inspired by PunBB style "Mercury": * http://punbb.org/ */ - @import url('global.css'); @import url('fonts.css'); @import url('print.css'); +@import url('custom.css'); -@media screen,projection,handheld { +/* Buttons */ +#content input, #content select, #content textarea { + border: 0; +} +#content textarea { + border-color: #383838; +} +#content input { + border-radius: 5px; +} - /* Status Icon */ - #content #statusIconContainer { - background-image: url('../img/loading-sprite.png'); - } - #content .statusContainerOff { - background-position: 0px 0px; - } - #content .statusContainerOn { - background-position: 0px -22px; - } - #content .statusContainerAlert { - background-position: 0px -44px; - } +/* Status Icon */ +#content #statusIconContainer { + background: url('../img/loading-sprite.png') no-repeat 0px 0px; +} +#content #statusIconContainer.waiting { + background-position: 0px -22px; +} +#content #statusIconContainer.retrying { + background-position: 0px -44px; +} - #content input, #content select, #content textarea { - border: 1px solid #565656; - } - #content textarea { - border-color: #383838; - } - #content input { - border-radius: 3px; - } - #loginContent { - background-color:#2A2A2A; - color:#D4D4D4; - } - #loginContent h1 { - color:#D4D4D4; - } - #loginContent a { - color:#F6B620; - } - #loginContent input, #loginContent select { - background-color:#424242; - border-color:#565656; - color:#D4D4D4; - } - #loginContent #loginFormContainer #loginButton { - background-color:#424242; - color:#D4D4D4; - border-radius: 3px; - } - #loginContent #errorContainer { - color:red; - } - - #content { - background-color:#2A2A2A; - color:#D4D4D4; - } - #content h1 { - color:#D4D4D4; - } - #content a { - color:#F6B620; - } - #content input, #content select, #content textarea { - background-color:#383838; - color:#D4D4D4; - } - #content #chatList, #content #onlineListContainer, #content #helpContainer, #content #settingsContainer, #content #colorCodesContainer, #content #emoticonsContainer { - border: 0; - background-color:#383838; - } - #content #colorCodesContainer { - padding: 5px; - box-shadow: 2px 2px 4px #000; - border-radius: 3px; - } - #content #onlineListContainer { - background: #383838; - } - #content #onlineListContainer #onlineList div { - margin: 0 1px 1px 1px; - border-radius: 5px; - background: #404040; - } - #content #onlineListContainer #onlineList ul { - margin-top: 1px; - list-style: none; - } - #content #emoticonsContainer { - border-radius: 3px; - } - #content #bbCodeContainer { - border: 0; padding-left: 0; - } - #content #bbCodeContainer input, #content #logoutButton, #content #submitButton { - background-color:#383838; - color:#D4D4D4; - } - #content #bbCodeContainer input:hover, #content #logoutButton:hover, #content #submitButton:hover { - background-color:#565656; - } - #content #optionsContainer input.button { - border: 0; - } - #content #optionsContainer input { - background-color:transparent; - } - #content .rowEven { - background-color:#505050; - } - #content .rowOdd { - background-color:#484848; - } - #content .guest { - color:gray; - } - #content .user { - color:#D4D4D4; - } - #content .moderator { - color:#00AA00; - } - #content .admin { - color:red; - } - #content .chatBot { - color:#F6B620; - } - #content #chatList .chatBotErrorMessage { - color:red; - } - #content #chatList a { - color:#F6B620; - } - #content #chatList .deleteSelected { - border-color:red; - } - #content #onlineListContainer h3, #content #helpContainer h3, #content #settingsContainer h3 { - color:#D4D4D4; - height: 15px; - } -} \ No newline at end of file +/* Other Theme Elements */ +.ajax-chat { + background-color:#2A2A2A; + color:#D4D4D4; +} +.ajax-chat h1 { + color:#D4D4D4; +} +.ajax-chat a { + color:#F6B620; +} +#loginContent input, #loginContent select { + background-color:#424242; + border-color:#565656; + color:#D4D4D4; +} +#loginContent #loginButton { + background-color:#424242; + color:#D4D4D4; + border-radius: 3px; +} +#loginContent #errorContainer { + color:red; +} +#content input, #content select, #content textarea { + background-color:#383838; + color:#D4D4D4; +} +#content #chatList, #content #onlineListContainer, #content #helpContainer, #content #settingsContainer { + border:0; + background-color:#383838; +} +.ajax-chat .popup { + padding:5px; + box-shadow:2px 2px 4px #000; + border-radius:3px; + background-color:#424242; + border:1px solid #333; +} +#content #colorCodesContainer a { + border-color:black; +} +#content #onlineListContainer { + background: #383838; +} +#content #onlineListContainer #onlineList div { + margin: 0 1px 1px 1px; + border-radius: 5px; + background: #404040; +} +#content #onlineListContainer #onlineList ul { + margin-top: 1px; + list-style: none; +} +#content #bbCodeContainer { + border: 0; padding-left: 0; +} +#content #bbCodeContainer input, #content #logoutButton, #content #submitButton { + background-color:#383838; + color:#D4D4D4; +} +#content #bbCodeContainer input:hover, #content #logoutButton:hover, #content #submitButton:hover { + background-color:#565656; +} +#content #optionsContainer input.button { + border: 0; +} +#content #optionsContainer input { + background-color:transparent; +} +#content .rowEven, #helpList dl:nth-child(even), #settingsList dl:nth-child(even) { + background-color:#505050; +} +#content .rowOdd, #helpList dl:nth-child(odd), #settingsList dl:nth-child(odd) { + background-color:#484848; +} +#content #chatList .rowOdd.private { + background-color:#101010; +} +#content #chatList .rowEven.private { + background-color:#1f1f1f; +} +#content .guest { + color:gray; +} +#content .user { + color:#D4D4D4; +} +#content .customUser { + color:#e0ca95; +} +#content .moderator { + color:#00AA00; +} +#content .admin { + color:red; +} +#content .chatBot { + color:#F6B620; +} +#content #chatList .chatBotErrorMessage { + color:red; +} +#content #chatList a { + color:#F6B620; +} +#content #chatList .deleteSelected { + border-color:red; +} +#content #onlineListContainer h3, #content #helpContainer h3, #content #settingsContainer h3 { + color:#D4D4D4; + height: 15px; +} diff --git a/chat/css/MyBB.css b/chat/css/MyBB.css index 9daa19d..e71f624 100644 --- a/chat/css/MyBB.css +++ b/chat/css/MyBB.css @@ -2,114 +2,108 @@ * @package AJAX_Chat * @author Sebastian Tschan * @author Philip Nicolcev - * @copyright (c) Sebastian Tschan - * @license Modified MIT License - * @link https://blueimp.net/ajax/ * * Color palette inspired by MyBB style "MyBB Default": - * http://www.mybboard.net/ + * http://www.mybb.com/ */ - @import url('global.css'); @import url('fonts.css'); @import url('print.css'); +@import url('custom.css'); + +/* Buttons */ +#content #bbCodeContainer input, #content #logoutButton, #content #submitButton, #loginForm #loginButton { + background-color:#02619f; + color:#fff; + font-weight: bold; + border: 0px solid #02619f; + border-radius: 5px; +} +#content select, #loginForm select, #loginForm input, #content textarea { + color:#333333; + border: 1px solid #02619f; + border-radius: 5px; +} -@media screen,projection,handheld { - - /* Buttons */ - #content #bbCodeContainer input, #content #logoutButton, #content #submitButton, #loginForm #loginButton { - background-color:#02619f; - color:#fff; - font-weight: bold; - border: 0px solid #02619f; - border-radius: 5px; - } - #content select, #loginForm select, #loginForm input, #content textarea { - color:#333333; - border: 1px solid #02619f; - border-radius: 5px; - } +/* Status Icon */ +#content #statusIconContainer { + background: url('../img/loading-sprite.png') no-repeat 0px 0px; +} +#content #statusIconContainer.waiting { + background-position: 0px -22px; +} +#content #statusIconContainer.retrying { + background-position: 0px -44px; +} - /* Status Icon */ - #content #statusIconContainer { - background-image: url('../img/loading-sprite.png'); - } - #content .statusContainerOff { - background-position: 0px 0px; - } - #content .statusContainerOn { - background-position: 0px -22px; - } - #content .statusContainerAlert { - background-position: 0px -44px; - } - #loginContent { - background-color:#FFF; - color:#000; - } - #loginContent h1 { - color:#000; - } - #loginContent a { - color:#000; - } - #loginContent #errorContainer { - color:red; - } - #content { - background-color:#FFF; - color:#000; - } - #content h1 { - color:#000; - } - #content a { - color:#000; - } - #content input, #content select, #content textarea { - background-color:#FFF; - color:#000; - } - #content #chatList, #content #onlineListContainer, #content #helpContainer, #content #settingsContainer, #content #colorCodesContainer, #content #emoticonsContainer { - border-color:#ADADAD; - background-color:#E5E5E8; - } - #content #colorCodesContainer a { - border-color:black; - } - #content #optionsContainer input { - background-color:transparent; - } - #content .rowEven, #content .rowOdd { - background-color:#EFEFEF; - border-bottom: 1px solid #bdccf7; - } - #content .guest { - color:gray; - } - #content .user { - color:#000; - } - #content .moderator { - color:#0000FF; - } - #content .admin { - color:#FF0000; - } - #content .chatBot { - color:#476C8E; - } - #content #chatList .chatBotErrorMessage { - color:red; - } - #content #chatList a { - color:#476C8E; - } - #content #chatList .deleteSelected { - border-color:red; - } - #content #onlineListContainer h3, #content #helpContainer h3, #content #settingsContainer h3 { - background-color:#02619f; - color:#FFF; - } +/* Other Theme Elements */ +.ajax-chat { + background-color:#FFF; + color:#000; +} +.ajax-chat h1 { + color:#000; +} +.ajax-chat a { + color:#000; +} +#loginContent #errorContainer { + color:red; +} +#content input, #content select, #content textarea { + background-color:#FFF; + color:#000; +} +#content #chatList, #content #onlineListContainer, #content #helpContainer, #content #settingsContainer, #content #colorCodesContainer { + border-color:#ADADAD; + background-color:#E5E5E8; +} +.ajax-chat .popup { + border:1px solid #ADADAD; + background-color:#E5E5E8; +} +#content #colorCodesContainer a { + border-color:black; +} +#content #optionsContainer input { + background-color:transparent; +} +#content .rowEven, #content .rowOdd { + background-color:#EFEFEF; + border-bottom: 1px solid #bdccf7; +} +#content #chatList .private { + background-color:#F8D0D0; + border-bottom:1px solid #ED3950; +} +#content .guest { + color:gray; +} +#content .user { + color:#000; +} +#content .customUser { + color:#02619f; +} +#content .moderator { + color:#0000FF; +} +#content .admin { + color:#FF0000; +} +#content .chatBot { + color:#476C8E; +} +#content #chatList .chatBotErrorMessage { + color:red; +} +#content #chatList a { + color:#476C8E; +} +#content #chatList .deleteSelected { + border-color:red; +} +#content #onlineListContainer h3, #content #helpContainer h3, #content #settingsContainer h3 { + background-color:#02619f; + color:#FFF; } \ No newline at end of file diff --git a/chat/css/Oxygen.css b/chat/css/Oxygen.css index 9163174..0009723 100644 --- a/chat/css/Oxygen.css +++ b/chat/css/Oxygen.css @@ -2,115 +2,114 @@ * @package AJAX_Chat * @author Sebastian Tschan * @author Philip Nicolcev - * @copyright (c) Sebastian Tschan - * @license Modified MIT License - * @link https://blueimp.net/ajax/ * * Color palette inspired by PunBB style "Oxygen": * http://punbb.org/ */ - @import url('global.css'); @import url('fonts.css'); @import url('print.css'); +@import url('custom.css'); + +/* Buttons */ +#content #bbCodeContainer input, #content #logoutButton, #content #submitButton, #loginForm #loginButton { + background-color:#0066B9; + background-image: linear-gradient(to bottom, #4795CC 0px, #2A6AB8 100%); + color: #fff; + border: 1px solid #0066B9; +} +#content #bbCodeContainer input:hover, #content #logoutButton:hover, #content #submitButton:hover, #loginForm #loginButton:hover { + background-image:linear-gradient(to top, #4795CC 0px, #2A6AB8 100%); +} +#content select, #loginForm select, #loginForm input, #content textarea { + color:#333333; + border: 1px solid #0066B9; +} -@media screen,projection,handheld { +/* Status Icon */ +#content #statusIconContainer { + background: url('../img/loading-sprite.png') no-repeat 0px 0px; +} +#content #statusIconContainer.waiting { + background-position: 0px -22px; +} +#content #statusIconContainer.retrying { + background-position: 0px -44px; +} - /* Buttons */ - #content #bbCodeContainer input, #content #logoutButton, #content #submitButton, #loginForm #loginButton { - background-color:#0066B9; - color: #fff; - border: 1px solid #0066B9; - } - #content select, #loginForm select, #loginForm input, #content textarea { - color:#333333; - border: 1px solid #0066B9; - } - - /* Status Icon */ - #content #statusIconContainer { - background-image: url('../img/loading-sprite.png'); - } - #content .statusContainerOff { - background-position: 0px 0px; - } - #content .statusContainerOn { - background-position: 0px -22px; - } - #content .statusContainerAlert { - background-position: 0px -44px; - } - - /* Other Theme Elements */ - #loginContent { - background-color:#F1F1F1; - color:#333333; - } - #loginContent h1 { - color:#333333; - } - #loginContent a { - color:#0066B9; - } - #loginContent input, #loginContent select { - background-color:#FFF; - color:#333333; - } - #loginContent #errorContainer { - color:red; - } - #content { - background-color:#F1F1F1; - color:#333333; - } - #content h1 { - color:#333333; - } - #content a { - color:#0066B9; - } - #content #chatList, #content #onlineListContainer, #content #helpContainer, #content #settingsContainer, #content #colorCodesContainer, #content textarea { - border-color:#0066B9; - background-color:#FFF; - } - #content #colorCodesContainer a { - border-color:black; - } - #content #optionsContainer input { - background-color:transparent; - } - #content .rowEven { - background-color:#F1F1F1; - } - #content .rowOdd { - background-color:#DEDFDF; - } - #content .guest { - color:gray; - } - #content .user { - color:#000; - } - #content .moderator { - color:#00AA00; - } - #content .admin { - color:red; - } - #content .chatBot { - color:#0066B9; - } - #content #chatList .chatBotErrorMessage { - color:red; - } - #content #chatList a { - color:#0066B9; - } - #content #chatList .deleteSelected { - border-color:red; - } - #content #onlineListContainer h3, #content #helpContainer h3, #content #settingsContainer h3 { - background-color:#0066B9; - color:#FFF; - } +/* Other Theme Elements */ +.ajax-chat { + background-color:#F1F1F1; + color:#333; +} +.ajax-chat h1 { + color:#333333; +} +.ajax-chat a { + color:#0066B9; +} +#loginContent input, #loginContent select { + background-color:#FFF; + color:#333333; +} +#loginContent #errorContainer { + color:red; +} +#content #chatList, #content #onlineListContainer, #content #helpContainer, #content #settingsContainer, #content textarea { + border-color:#0066B9; + background-color:#FFF; +} +.ajax-chat .popup { + background-color:#FFF; + border:1px solid #0066B9; +} +#content #colorCodesContainer a { + border-color:black; +} +#content #optionsContainer input { + background-color:transparent; +} +#content .rowEven, #helpList dl:nth-child(even), #settingsList dl:nth-child(even) { + background-color:#F1F1F1; +} +#content .rowOdd, #helpList dl:nth-child(odd), #settingsList dl:nth-child(odd) { + background-color:#E6E7E7; +} +#content #chatList .rowOdd.private { + background-color:#BCC5FF; +} +#content #chatList .rowEven.private { + background-color:#C7D1FC; +} +#content .guest { + color:gray; +} +#content .user { + color:#000; +} +#content .customUser { + color:#003366; +} +#content .moderator { + color:#00AA00; +} +#content .admin { + color:red; +} +#content .chatBot { + color:#0066B9; +} +#content #chatList .chatBotErrorMessage { + color:red; +} +#content #chatList a { + color:#0066B9; +} +#content #chatList .deleteSelected { + border-color:red; +} +#content #onlineListContainer h3, #content #helpContainer h3, #content #settingsContainer h3 { + background-color:#0066B9; + background-image: linear-gradient(to bottom, #2A6AB8 0px, #4795CC 100%); + color:#FFF; } \ No newline at end of file diff --git a/chat/css/Pine.css b/chat/css/Pine.css new file mode 100644 index 0000000..8d831f3 --- /dev/null +++ b/chat/css/Pine.css @@ -0,0 +1,142 @@ +/* + * @package AJAX_Chat + * @author Rosina Ramirez + */ +@import url('global.css'); +@import url('fonts.css'); +@import url('print.css'); +@import url('custom.css'); + +#content input, select, #content textarea, #loginButton { + border: 0; +} +#loginButton{ + box-shadow:0px 1px 4px 0px rgba(0,0,0,0.5); +} +#content textarea { + border-color: #383838; +} +.ajax-chat { + background-color:#0f2314; + color:#f0f0f0; +} +.ajax-chat a, .ajax-chat a:visited, .ajax-chat h1{ + color:#C5EBB7; +} +input, select { + background:#0A140C; + border: 1px solid rgba(0,0,0,1); + color:#C5EBB7; +} +#loginContent #errorContainer { + color:#FF6262; +} + +#content textarea { + background:rgba(0,0,0,0.5); + color:#C5EBB7; +} +#content #chatList{ + background: url('pine_images/chatlist.jpg') no-repeat bottom right #0a180d; +} +#content #chatList, #content #onlineListContainer, #content #helpContainer, #content #settingsContainer{ + box-shadow: inset 1px 1px 10px rgba(0,0,0,0.6); + border:0 +} +#content #colorCodesContainer a:first-child{ + border-left: 1px solid #000; +} +#content #colorCodesContainer a { + border-color: #000; + border-left: 0; +} +#content #colorCodesContainer { + background: #000; + background: rgba(0,0,0,0.4); + border: 0; +} +#content #onlineListContainer, #content #helpContainer, #content #settingsContainer { + background: rgba(0,0,0,0.3) +} +#content #onlineListContainer #onlineList ul { + list-style: none; +} +#content #emoticonsContainer { + border-radius: 3px; +} +#content #bbCodeContainer { + border: 0; + padding-left: 0; +} + +/* Status Icon */ +#content #statusIconContainer { + background: url('../img/loading-sprite.png') no-repeat 0px 0px; +} +#content #statusIconContainer.waiting { + background-position: 0px -22px; +} +#content #statusIconContainer.retrying { + background-position: 0px -44px; +} + +#content #bbCodeContainer input, #content #logoutButton, #content #submitButton, #loginButton { + background-color:#4C9C1F; + color:#fff; + padding:6px 12px +} +#content #bbCodeContainer input:hover, #content #logoutButton:hover, #content #submitButton:hover, #loginButton:hover { + background-color:#57B324; +} +#content #optionsContainer input.button { + border: 0; +} +#content #optionsContainer input { + background-color:transparent; +} +.ajax-chat .popup { + background-color:#F7F5DC; + border: 1px solid #808080; +} +#content .rowEven, #helpList dl:nth-child(even), #settingsList dl:nth-child(even) { + background:#2C4E3D; + background:rgba(44, 78, 61, 0.6) +} +#content .rowOdd, #helpList dl:nth-child(odd), #settingsList dl:nth-child(odd) { + background:#416453; + background:rgba(65, 100, 83, 0.6) +} +#content #chatList .rowOdd.private { + background-color:#00701C; +} +#content #chatList .rowEven.private { + background-color:#007B07; +} +#content .guest { + color:#B8B8B8; +} +#content .user { + color:#C8E4CF; +} +#content .customUser { + color:#4c9c1f; +} +#content .moderator { + color:#71E271; +} +#content .admin { + color:#FF6262; +} +#content .chatBot { + color:#E7B98E; +} +#content #chatList .chatBotErrorMessage { + color:#FF6262; +} +#content #chatList .deleteSelected { + border-color:#FF6262; +} +#content #onlineListContainer h3, #content #helpContainer h3, #content #settingsContainer h3 { + color:#C5EBB7; + height: 15px; +} \ No newline at end of file diff --git a/chat/css/Plum.css b/chat/css/Plum.css index a1aec9f..f79d446 100644 --- a/chat/css/Plum.css +++ b/chat/css/Plum.css @@ -1,112 +1,134 @@ /* * @package AJAX_Chat * @author Rosina Ramirez - * @copyright (c) Rosina Ramirez - * @license Modified MIT License - * @link https://blueimp.net/ajax/ */ - @import url('global.css'); @import url('fonts.css'); @import url('print.css'); +@import url('custom.css'); -@media screen,projection,handheld { +.ajax-chat { + background-color:#2A112F; + color:#9765A0; +} +.ajax-chat a { + color:#DA83A1; +} +.ajax-chat h1 { + color:#CDA6D2; +} +#content input, select, #content textarea, #loginButton { + border: 0; box-shadow:1px 1px 4px 0px rgba(0,0,0,0.5); +} +#content textarea { + border-color:#383838; +} +#content input, #loginButton { + border-radius:8px; +} +#content input, #loginContent input, #content select, #loginContent select { + background:#17081a; + border:1px solid rgba(0,0,0,1); + color:#9765A0; +} +#loginContent #errorContainer { + color:red; +} +#content textarea { + background:rgba(0,0,0,0.3); + color:#9765A0; +} +#content #chatList{ + background: url('plum_images/plum.png') no-repeat bottom right rgba(0,0,0,0.3); +} +.ajax-chat #content .popup { + padding: 5px; + box-shadow: 2px 2px 4px #000; + border-radius: 3px; + background:rgba(225,225,225,0.2); + border-color:#9765A0; +} +#content #onlineListContainer, #content #helpContainer, #content #settingsContainer { + background: url('plum_images/plum2.png') no-repeat bottom left rgba(0,0,0,0.3); +} +#content #onlineListContainer #onlineList ul { + list-style: none; +} +#content #emoticonsContainer { + border-radius:3px; +} +#content #bbCodeContainer { + border:0; + padding-left:0; +} - #content input, select, #content textarea, #loginButton { - border: 0; box-shadow:1px 1px 4px 0px rgba(0,0,0,0.5); - } - #content textarea { border-color: #383838; } - #content input, #loginButton { border-radius: 8px; } - #loginContent, #content { - background-color:#2A112F; - color:#9765A0; - } - a { - color:#DA83A1; - } - input, select { - background:#17081a; - border: 1px solid rgba(0,0,0,1); - color:#9765A0; - } - #loginContent #errorContainer { - color:red; - } - h1 { - color:#CDA6D2; - } - - #content textarea { - background:rgba(0,0,0,0.3); - color:#9765A0; - } - #content #chatList{ - background: url('plum_images/plum.png') no-repeat bottom right rgba(0,0,0,0.3); - } - #content #colorCodesContainer { - padding: 5px; - box-shadow: 2px 2px 4px #000; - border-radius: 3px; - background:rgba(225,225,225,0.2) - } +/* Status Icon */ +#content #statusIconContainer { + background: url('../img/loading-sprite.png') no-repeat 0px 0px; +} +#content #statusIconContainer.waiting { + background-position: 0px -22px; +} +#content #statusIconContainer.retrying { + background-position: 0px -44px; +} + +#content #bbCodeContainer input, #content #logoutButton, #content #submitButton, #loginButton { + background-color:#461124; + color:#DAABBC; +} +#content #bbCodeContainer input:hover, #content #logoutButton:hover, #content #submitButton:hover, #loginButton:hover { + background-color:#591E33; +} +#content #optionsContainer input.button { + border: 0; +} +#content #optionsContainer input { + background-color:transparent; +} +#content .rowEven, #helpList dl:nth-child(even), #settingsList dl:nth-child(even) { + background:rgba(0,0,0,0.2); +} +#content .rowOdd, #helpList dl:nth-child(odd), #settingsList dl:nth-child(odd) { + background:rgba(0,0,0,0.3); +} +#content #chatList .rowOdd.private { + background-color:#700030; +} +#content #chatList .rowEven.private { + background-color:#7B0039; +} +#content .guest { + color:#CD9595; +} +#content .user { + color:#CDA6D2; +} +#content .customUser { + color:#da83a1; +} +#content .moderator { + color:#00AA00; +} +#content .admin { + color:red; +} +#content .chatBot { + color:#CDA6D2; +} +#content #chatList .chatBotErrorMessage { + color:red; +} +#content #chatList .deleteSelected { + border-color:red; +} +#content #onlineListContainer h3, #content #helpContainer h3, #content #settingsContainer h3 { + color:#CDA6D2; + height: 15px; +} + +@media (max-width: 480px) { #content #onlineListContainer, #content #helpContainer, #content #settingsContainer { - background: url('plum_images/plum2.png') no-repeat bottom left rgba(0,0,0,0.3); - } - #content #onlineListContainer #onlineList ul { - list-style: none; - } - #content #emoticonsContainer { border-radius: 3px; } - #content #bbCodeContainer { border: 0; padding-left: 0; } - #content #statusIconContainer { background-image: url('../img/loading-sprite.png'); } - #content .statusContainerOff { - background-position: 0px 0px; - } - #content .statusContainerOn { - background-position: 0px -22px; - } - #content .statusContainerAlert { - background-position: 0px -44px; - } - #content #bbCodeContainer input, #content #logoutButton, #content #submitButton, #loginButton { - background-color:#461124; - color:#DAABBC; - } - #content #bbCodeContainer input:hover, #content #logoutButton:hover, #content #submitButton:hover, #loginButton:hover { - background-color:#591E33; - } - #content #optionsContainer input.button { border: 0; } - #content #optionsContainer input { - background-color:transparent; - } - #content .rowEven { - background:rgba(0,0,0,0.2); - } - #content .rowOdd { - background:rgba(0,0,0,0.3); - } - #content .guest { - color:gray; - } - #content .user { - color:#CDA6D2; - } - #content .moderator { - color:#00AA00; - } - #content .admin { - color:red; - } - #content .chatBot { - color:#CDA6D2; - } - #content #chatList .chatBotErrorMessage { - color:red; - } - #content #chatList .deleteSelected { - border-color:red; - } - #content #onlineListContainer h3, #content #helpContainer h3, #content #settingsContainer h3 { - color:#CDA6D2; - height: 15px; + background:#2A112F; } } \ No newline at end of file diff --git a/chat/css/Sulfur.css b/chat/css/Sulfur.css index f7d721c..d0ed944 100644 --- a/chat/css/Sulfur.css +++ b/chat/css/Sulfur.css @@ -2,115 +2,112 @@ * @package AJAX_Chat * @author Sebastian Tschan * @author Philip Nicolcev - * @copyright (c) Sebastian Tschan - * @license Modified MIT License - * @link https://blueimp.net/ajax/ * * Color palette inspired by PunBB style "Sulfur": * http://punbb.org/ */ - @import url('global.css'); @import url('fonts.css'); @import url('print.css'); +@import url('custom.css'); + +/* Buttons */ +#content #bbCodeContainer input, #content #logoutButton, #content #submitButton, #loginForm #loginButton { + background-color:#B84623; + color: #fff; + border: 1px solid #B84623; +} +#content #bbCodeContainer input:hover, #content #logoutButton:hover, #content #submitButton:hover, #loginForm #loginButton:hover { + background-color:#9A2806; +} +#content select, #loginForm select, #loginForm input, #content textarea { + color:#333333; + border: 1px solid #B84623; +} -@media screen,projection,handheld { +/* Status Icon */ +#content #statusIconContainer { + background: url('../img/loading-sprite.png') no-repeat 0px 0px; +} +#content #statusIconContainer.waiting { + background-position: 0px -22px; +} +#content #statusIconContainer.retrying { + background-position: 0px -44px; +} - /* Buttons */ - #content #bbCodeContainer input, #content #logoutButton, #content #submitButton, #loginForm #loginButton { - background-color:#B84623; - color: #fff; - border: 1px solid #B84623; - } - #content select, #loginForm select, #loginForm input, #content textarea { - color:#333333; - border: 1px solid #B84623; - } - - /* Status Icon */ - #content #statusIconContainer { - background-image: url('../img/loading-sprite.png'); - } - #content .statusContainerOff { - background-position: 0px 0px; - } - #content .statusContainerOn { - background-position: 0px -22px; - } - #content .statusContainerAlert { - background-position: 0px -44px; - } - - /* Other Theme Elements */ - #loginContent { - background-color:#F1F1F1; - color:#333333; - } - #loginContent h1 { - color:#333333; - } - #loginContent a { - color:#B84623; - } - #loginContent input, #loginContent select { - background-color:#FFF; - color:#333333; - } - #loginContent #errorContainer { - color:red; - } - #content { - background-color:#F1F1F1; - color:#333333; - } - #content h1 { - color:#333333; - } - #content a { - color:#B84623; - } - #content #chatList, #content #onlineListContainer, #content #helpContainer, #content #settingsContainer, #content #colorCodesContainer, #content textarea { - border-color:#B84623; - background-color:#FFF; - } - #content #colorCodesContainer a { - border-color:black; - } - #content #optionsContainer input { - background-color:transparent; - } - #content .rowEven { - background-color:#F1F1F1; - } - #content .rowOdd { - background-color:#DEDFDF; - } - #content .guest { - color:gray; - } - #content .user { - color:#000; - } - #content .moderator { - color:#00AA00; - } - #content .admin { - color:red; - } - #content .chatBot { - color:#B84623; - } - #content #chatList .chatBotErrorMessage { - color:red; - } - #content #chatList a { - color:#B84623; - } - #content #chatList .deleteSelected { - border-color:red; - } - #content #onlineListContainer h3, #content #helpContainer h3, #content #settingsContainer h3 { - background-color:#B84623; - color:#FFF; - } +/* Other Theme Elements */ +.ajax-chat { + background-color:#F1F1F1; + color:#333333; +} +.ajax-chat h1 { + color:#333; +} +.ajax-chat a { + color:#B84623; +} +#loginContent input, #loginContent select { + background-color:#FFF; + color:#333; +} +#loginContent #errorContainer { + color:red; +} +#content #chatList, #content #onlineListContainer, #content #helpContainer, #content #settingsContainer, #content textarea { + border-color:#B84623; + background-color:#FFF; +} +.ajax-chat .popup { + background-color:#FFF; + border:1px solid #B84623; +} +#content #colorCodesContainer a { + border-color:black; +} +#content #optionsContainer input { + background-color:transparent; +} +#content .rowEven, #helpList dl:nth-child(even), #settingsList dl:nth-child(even) { + background-color:#F1F1F1; +} +#content .rowOdd, #helpList dl:nth-child(odd), #settingsList dl:nth-child(odd) { + background-color:#DEDFDF; +} +#content #chatList .rowOdd.private { + background-color:#F8D0D0; +} +#content #chatList .rowEven.private { + background-color:#F8D9D0; +} +#content .guest { + color:gray; +} +#content .user { + color:#000; +} +#content .customUser { + color:#602010; +} +#content .moderator { + color:#00AA00; +} +#content .admin { + color:red; +} +#content .chatBot { + color:#B84623; +} +#content #chatList .chatBotErrorMessage { + color:red; +} +#content #chatList a { + color:#B84623; +} +#content #chatList .deleteSelected { + border-color:red; +} +#content #onlineListContainer h3, #content #helpContainer h3, #content #settingsContainer h3 { + background-color:#B84623; + color:#FFF; } \ No newline at end of file diff --git a/chat/css/Uranium.css b/chat/css/Uranium.css index 7ff9b64..b8ac92f 100644 --- a/chat/css/Uranium.css +++ b/chat/css/Uranium.css @@ -1,178 +1,219 @@ /* * @package AJAX_Chat * @author Rosina Ramirez - * @copyright (c) Rosina Ramirez - * @license Modified MIT License - * @link https://blueimp.net/ajax/ - * */ - @import url('global.css'); @import url('fonts.css'); @import url('print.css'); +@import url('custom.css'); +html { + height: 100%; +} +input, select, textarea, #content #chatList, #content #onlineListContainer, #content #helpContainer, #content #settingsContainer, +#content #onlineListContainer h3, #content #helpContainer h3, #content #settingsContainer h3, #content #inputFieldContainer, #loginContent input { + border-radius:5px; + -webkit-border-radius:5px; + border:0; +} +#content #inputFieldContainer{ + background:#0E0E0E; + padding:0; +} +#content #inputFieldContainer #inputField{ + box-shadow: inset 1px 1px 5px 1px #000; + border:0; + padding:3px 0.5%; + width: 99%; +} +#content #inputFieldContainer #inputField:focus{ + outline:none; + box-shadow:0px 0px 8px 1px #376e34; +} +#loginContent #loginButton { + background-color:#424242; + color:#b0b8a8; + border-radius: 3px; +} +#loginContent #errorContainer { + color:red; +} -@media screen,projection,handheld { - - input, select, textarea, #content #chatList, #content #onlineListContainer, #content #helpContainer, #content #settingsContainer, #content .rowEven, - #content #onlineListContainer h3, #content #helpContainer h3, #content #settingsContainer h3, #content #inputFieldContainer, #loginContent input - { border-radius: 5px; -webkit-border-radius:5px;border:0;} - #loginContent a { - color:#4c9546; - } - #content #inputFieldContainer{height:46px; background:#0E0E0E;padding:0;} - #content #inputFieldContainer #inputField{box-shadow: inset 1px 1px 5px 1px #000; border:0;height: 40px;padding: 3px 0.5%;width: 99%;} - #content #inputFieldContainer #inputField:focus{outline:none;box-shadow:0px 0px 8px 1px #376e34;} - #loginContent #loginFormContainer #loginButton { - background-color:#424242; - color:#b0b8a8; - border-radius: 3px; - } - #loginContent #errorContainer { - color:red; - } - - #content, #loginContent { +.ajax-chat { + height: 100%; background-color: #464646; - background-image: -webkit-gradient(linear, left top, left bottom, from(#464646), to(#181818)); background-image: -webkit-linear-gradient(top, #464646, #181818); background-image: -moz-linear-gradient(top, #464646, #181818); background-image: -o-linear-gradient(top, #464646, #181818); background-image: linear-gradient(to bottom, #464646, #181818); color:#b0b8a8; - } - h1, h3 { - color:#e2e9db; - text-shadow: 1px 1px 2px #191919; - } - #content a { - color:#4c9546; - } - #loginContent input, #loginContent select{background:#171717; color:#b0b8a8;} - input, select{padding: 3px;} - #content input,#content select,#content textarea { - background-color:#0e0e0e; - color:#b0b8a8; - } - #content #colorCodesContainer,#content #chatList, #content #onlineListContainer, #content #helpContainer, #content #settingsContainer, #content #inputFieldContainer, - #loginContent input[type=text], #loginContent input[type=password]{ - box-shadow: 0px 0px 8px 1px #495a49; -webkit-box-shadow: 0px 0px 8px 1px #495a49; - } - #content #chatList, #content #onlineListContainer, #content #helpContainer, #content #settingsContainer { - background-color:#171717; - border:0; - } - #content #chatList:after, #content #chatList:before{ - content:''; - display:block; - position:absolute; - border-radius: 5px; - } - #content #chatList:before{top:17px;left:0px;width:0px;height:98%;box-shadow: 1px 0px 8px 1px #000;} - #content #chatList:after{top:0px;left:17px;width:98%;height:0px;box-shadow: 0px 1px 8px 1px #000;} - - #content #onlineListContainer #onlineList div { - margin: 0 1px 1px 1px; - background: none; - } - #content #onlineListContainer #onlineList ul { - margin-top: 1px; - list-style: none; - } - - #content #helplist table, #content #settingsList table{border-spacing:0;} - #content #emoticonsContainer { border-radius: 3px; } - #content #bbCodeContainer { border: 0; padding-left: 0; } - #content #statusIconContainer { background-image: url('../img/loading-sprite.png'); } - #content .statusContainerOff { - background-position: 0px 0px; - } - #content .statusContainerOn { - background-position: 0px -22px; - } - #content .statusContainerAlert { - background-position: 0px -44px; - } - #content #bbCodeContainer input { - background-color: #d8ffd6; - background-image: -webkit-gradient(linear, left top, left bottom, from(#d8ffd6), to(#467a44)); - background-image: -webkit-linear-gradient(top, #d8ffd6, #467a44); - background-image: -moz-linear-gradient(top, #d8ffd6, #467a44); - background-image: -o-linear-gradient(top, #d8ffd6, #467a44); - background-image: linear-gradient(to bottom, #d8ffd6, #467a44); - color:#1d1d1d; - } - #content #bbCodeContainer input:hover{ - background-color: #ffffff; - background-image: -webkit-gradient(linear, left top, left bottom, from(#ffffff), to(#08ff35)); - background-image: -webkit-linear-gradient(top, #ffffff, #08ff35); - background-image: -moz-linear-gradient(top, #ffffff, #08ff35); - background-image: -o-linear-gradient(top, #ffffff, #08ff35); - background-image: linear-gradient(to bottom, #ffffff, #08ff35); - } - #content #bbCodeContainer input:active, #content #logoutButton:active, #content #submitButton:active, #loginContent #loginButton:active{box-shadow:0px 0px 8px 1px #38ff56;} - #content #logoutButton, #content #submitButton,#loginContent #loginButton{ - background-color: #4fff58; - background-image: -webkit-gradient(linear, left top, left bottom, from(#4fff58), to(#194221)); - background-image: -webkit-linear-gradient(top, #4fff58, #194221); - background-image: -moz-linear-gradient(top, #4fff58, #194221); - background-image: -o-linear-gradient(top, #4fff58, #194221); - background-image: linear-gradient(to bottom, #4fff58, #194221); - font-weight:bold; color:#fff; - text-shadow:0px 0px 5px #000; - } - #content #logoutButton:hover, #content #submitButton:hover, #loginContent #loginButton:hover{ - background-color: #99ffa8; - background-image: -webkit-gradient(linear, left top, left bottom, from(#99ffa8), to(#002405)); - background-image: -webkit-linear-gradient(top, #99ffa8, #002405); - background-image: -moz-linear-gradient(top, #99ffa8, #002405); - background-image: -o-linear-gradient(top, #99ffa8, #002405); - background-image: linear-gradient(to bottom, #99ffa8, #002405); - } +} +.ajax-chat h1, .ajax-chat h3 { + color:#e2e9db; + text-shadow: 1px 1px 2px #191919; +} +.ajax-chat a { + color:#4c9546; +} +.ajax-chat input, .ajax-chat select{ + padding: 3px; +} +#loginContent input, #loginContent select { + background:#171717; + color:#b0b8a8; +} +#content input,#content select,#content textarea { + background-color:#0e0e0e; + color:#b0b8a8; +} +.ajax-chat .popup, #content #chatList, #content #onlineListContainer, #content #helpContainer, #content #settingsContainer, +#content #inputFieldContainer, #loginContent input[type=text], #loginContent input[type=password] { + box-shadow: 0px 0px 8px 1px #495a49; + -webkit-box-shadow: 0px 0px 8px 1px #495a49; +} +#content #chatList, #content #onlineListContainer, #content #helpContainer, #content #settingsContainer { + background-color:#171717; + border:0; +} +#content #chatList:after, #content #chatList:before{ + content:''; + display:block; + position:absolute; + border-radius: 5px; +} +#content #chatList:before{ + top:17px; + left:0px; + width:0px; + height:98%; + box-shadow: 1px 0px 8px 1px #000; +} +#content #chatList:after{ + top:0px; + left:17px; + width:98%; + height:0px; + box-shadow: 0px 1px 8px 1px #000; +} + +#content #onlineListContainer #onlineList div { + margin: 0 1px 1px 1px; + background: none; +} +#content #onlineListContainer #onlineList ul { + margin-top: 1px; + list-style: none; +} - #content #colorCodesContainer{ - border:0; - background:rgba(0,0,0,0.7); - padding:7px; - } - #content #colorCodesContainer a{border-radius:10px; box-shadow:0px 0px 3px 1px rgba(255,255,255,0.3); margin:0 5px;border:0;} - #content #optionsContainer input.button { border: 0; padding: 0; margin-right: 5px;} - #content #optionsContainer input { - background-color:transparent; - } - #content .rowEven { - background-color:#131413; - } - #content .guest { - color:gray; - } - #content .user { - color:#b0b8a8; - } - #content .moderator { - color:#00AA00; - } - #content .admin { - color:red; - } - #content .chatBot { - color:#4c9546; - } - #content #chatList .chatBotErrorMessage { - color:red; - } - #content #chatList a { - color:#4c9546; - } - #content #chatList .deleteSelected { - border-color:red; - } - #content #onlineListContainer h3, #content #helpContainer h3, #content #settingsContainer h3 { +#content #helplist table, #content #settingsList table { + border-spacing:0; +} +#content #emoticonsContainer { + border-radius: 3px; +} +#content #bbCodeContainer { + border: 0; + padding-left: 0; +} + +/* Status Icon */ +#content #statusIconContainer { + background: url('../img/loading-sprite.png') no-repeat 0px 0px; +} +#content #statusIconContainer.waiting { + background-position: 0px -22px; +} +#content #statusIconContainer.retrying { + background-position: 0px -44px; +} + +#content #bbCodeContainer input { + background-color: #d8ffd6; + background-image: -webkit-linear-gradient(top, #d8ffd6, #467a44); + background-image: -moz-linear-gradient(top, #d8ffd6, #467a44); + background-image: -o-linear-gradient(top, #d8ffd6, #467a44); + background-image: linear-gradient(to bottom, #d8ffd6, #467a44); + color:#1d1d1d; +} +#content #bbCodeContainer input:hover{ + background-color: #ffffff; + background-image: -webkit-linear-gradient(top, #ffffff, #08ff35); + background-image: -moz-linear-gradient(top, #ffffff, #08ff35); + background-image: -o-linear-gradient(top, #ffffff, #08ff35); + background-image: linear-gradient(to bottom, #ffffff, #08ff35); +} +#content #bbCodeContainer input:active, #content #logoutButton:active, #content #submitButton:active, #loginContent #loginButton:active{ + box-shadow:0px 0px 8px 1px #38ff56; +} +#content #logoutButton, #content #submitButton,#loginContent #loginButton{ + background-color: #4fff58; + background-image: -webkit-linear-gradient(top, #4fff58, #194221); + background-image: -moz-linear-gradient(top, #4fff58, #194221); + background-image: -o-linear-gradient(top, #4fff58, #194221); + background-image: linear-gradient(to bottom, #4fff58, #194221); + font-weight:bold; color:#fff; + text-shadow:0px 0px 5px #000; +} +#content #logoutButton:hover, #content #submitButton:hover, #loginContent #loginButton:hover{ + background-color: #99ffa8; + background-image: -webkit-linear-gradient(top, #99ffa8, #002405); + background-image: -moz-linear-gradient(top, #99ffa8, #002405); + background-image: -o-linear-gradient(top, #99ffa8, #002405); + background-image: linear-gradient(to bottom, #99ffa8, #002405); +} + +.ajax-chat .popup, .ajax-chat #content .popup#colorCodesContainer { + border:0; + background:rgba(0,0,0,0.7); + padding:5px; +} +#content #colorCodesContainer a{ + border-radius:10px; + box-shadow:0px 0px 3px 1px rgba(255,255,255,0.3); + margin:5px; + border:0; +} +#content #optionsContainer input.button { border: 0; padding: 0; margin-right: 5px;} +#content #optionsContainer input { + background-color:transparent; +} +#content .rowEven, #helpList dl:nth-child(even), #settingsList dl:nth-child(even) { + background-color:#131413; +} +#content #chatList .rowOdd.private, #content #chatList .rowEven.private { + background-color: #0C3A00; + background-image: linear-gradient(to bottom, #1C5417, #05410E); +} +#content .guest { + color:gray; +} +#content .user { + color:#b0b8a8; +} +#content .customUser { + color:#4efb57; +} +#content .moderator { + color:#00AA00; +} +#content .admin { + color:red; +} +#content .chatBot { + color:#4c9546; +} +#content #chatList .chatBotErrorMessage { + color:red; +} +#content #chatList a { + color:#4c9546; +} +#content #chatList .deleteSelected { + border-color:red; +} +#content #onlineListContainer h3, #content #helpContainer h3, #content #settingsContainer h3 { background-color: #171717; - background-image: -webkit-gradient(linear, left top, left bottom, from(#3b6c37), to(#171717)); background-image: -webkit-linear-gradient(top, #3b6c37, #223220, #171717); - background-image: -moz-linear-gradient(top, #3b6c37, #223220, #171717); - background-image: -o-linear-gradient(top, #3b6c37, #223220, #171717); - background-image: linear-gradient(to bottom, #3b6c37, #223220, #171717); - } - + background-image: -moz-linear-gradient(top, #3b6c37, #223220, #171717); + background-image: -o-linear-gradient(top, #3b6c37, #223220, #171717); + background-image: linear-gradient(to bottom, #3b6c37, #223220, #171717); } \ No newline at end of file diff --git a/chat/css/XenForo.css b/chat/css/XenForo.css new file mode 100644 index 0000000..db1a3d0 --- /dev/null +++ b/chat/css/XenForo.css @@ -0,0 +1,238 @@ +/* + * @package AJAX_Chat + * @author ManOnDaMoon + */ +@import url('global.css'); +@import url('fonts.css'); +@import url('print.css'); +@import url('custom.css'); + +/* Main Buttons */ +#content #logoutButton,#content #submitButton,#loginForm #loginButton { + font: 12pt Calibri, 'Trebuchet MS', Verdana, Geneva, Arial, Helvetica, sans-serif; + color: white; + font-weight: bold; + background: #e68c17 url('../../styles/default/xenforo/gradients/form-button-white-25px.png') repeat-x center -7px; + border: 3px solid White; + border-radius: 8px; + -webkit-border-radius: 8px; + -moz-border-radius: 8px; + -khtml-border-radius: 8px; + text-align: center; + box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.2); + -webkit-box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.2); + -moz-box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.2); + -khtml-box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.2); + display: inline-block; + cursor: pointer; + height: 33px; + background-color: #e68c17; + padding: 0 10px 0 10px; +} +#content #logoutButton:hover,#content #submitButton:hover,#loginForm #loginButton:hover { + box-shadow: 0 0 3px rgba(0, 0, 0, 0.2); + -webkit-box-shadow: 0 0 3px rgba(0, 0, 0, 0.2); + -moz-box-shadow: 0 0 3px rgba(0, 0, 0, 0.2); + -khtml-box-shadow: 0 0 3px rgba(0, 0, 0, 0.2); + position: relative; + top: 2px; +} + +/* BBCode Buttons */ +#content #bbCodeContainer input { + font-style: normal; + font-size: 12px; + font-family: Calibri, 'Trebuchet MS', Verdana, Geneva, Arial, Helvetica, sans-serif; + color: rgb(0, 0, 0); + background: rgb(220, 220, 235) url('../../styles/default/xenforo/gradients/form-button-white-25px.png') repeat-x top; + padding: 0px 6px; + border: 1px solid rgb(221, 221, 235); + border-top-color: rgb(255, 255, 255); + border-bottom-color: rgb(179, 179, 189); + border-radius: 7px; + -webkit-border-radius: 7px; + -moz-border-radius: 7px; + -khtml-border-radius: 7px; + text-align: center; + box-shadow: 0px 1px 4px 0px rgb(200, 200, 210); + -webkit-box-shadow: 0px 1px 4px 0px rgb(200, 200, 210); + -moz-box-shadow: 0px 1px 4px 0px rgb(200, 200, 210); + -khtml-box-shadow: 0px 1px 4px 0px rgb(200, 200, 210); + text-shadow: 0 0 0 transparent, 0px -1px 2px white; + outline: none; + line-height: 23px; + display: inline-block; + cursor: pointer; + box-sizing: border-box; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + -ms-box-sizing: border-box; + height: 23px; +} +#content #bbCodeContainer input:hover { + color: black; + text-decoration: none; + background-color: rgb(255, 255, 200); + border-color: rgb(255, 255, 200); + border-top-color: white; + border-bottom-color: rgb(190, 190, 170); +} +#content textarea { + font-size: 13px; + font-family: Calibri, 'Trebuchet MS', Verdana, Geneva, Arial, Helvetica, sans-serif; + color: #000000; + background-color: rgb(240, 247, 252); + border-width: 1px; + border-style: solid; + border-top-color: rgb(192, 192, 192); + border-right-color: rgb(233, 233, 233); + border-bottom-color: rgb(233, 233, 233); + border-left-color: rgb(192, 192, 192); + border-radius: 4px; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + -khtml-border-radius: 4px; + outline: 0; +} +#content textarea:focus { + background: rgb(255, 255, 240) url('../../styles/default/xenforo/gradients/form-element-focus-25.png') repeat-x; + border-top-color: rgb(150, 150, 150); + border-bottom-color: rgb(230, 230, 230); +} +#content select,#loginForm select,#loginForm input { + background-color: #F7F7FF; + color: #60A0DC; + border: 1px solid #a5cae4; +} +#content select:focus,#loginForm select:focus,#loginForm input:focus { + background: rgb(255, 255, 240) url('../../styles/default/xenforo/gradients/form-element-focus-25.png') repeat-x; + border-top-color: rgb(150, 150, 150); + border-bottom-color: rgb(230, 230, 230); +} + +/* Status Icon */ +#content #statusIconContainer { + background: url('../img/loading-sprite.png') no-repeat 0px 0px; +} +#content #statusIconContainer.waiting { + background-position: 0px -22px; +} +#content #statusIconContainer.retrying { + background-position: 0px -44px; +} + +/* Other Theme Elements */ +.ajax-chat { + background-color: #176093; + color: #F7F7FF; +} +.ajax-chat h1, .ajax-chat a { + color: #60A0DC; +} +#loginContent #errorContainer { + color: red; +} +#content { + background-color: #F7F7FF; + color: #176093; + font-size: 12px; +} +#content #headline { + color:#F7F7FF; + background:#176093; +} +#content #copyright { + color: #F7F7FF; +} +#content #copyright { + font-style: italic; + font-size: 0.8em; +} +#content #chatList,#content #colorCodesContainer { + background-color: rgb(240, 247, 252); + border: 1px solid #a5cae4; + border-radius: 10px; + -webkit-border-radius: 10px; + -moz-border-radius: 10px; + -khtml-border-radius: 10px; +} +#content #onlineListContainer,#content #helpContainer,#content #settingsContainer, #content #reportContainer { + background-color: rgb(240, 247, 252); + border: 1px solid #a5cae4; + border-radius: 10px; + -webkit-border-radius: 10px; + -moz-border-radius: 10px; + -khtml-border-radius: 10px; +} +.ajax-chat .popup { + background-color:#FFF; + border: 1px solid #ababab; + box-shadow: 2px 2px 2px #777; +} +#content #chatList .rowOdd.private { + background-color:#F8D0D0; +} +#content #chatList .rowEven.private { + background-color:#F8D9D0; +} +#content #onlineListContainer #onlineList, #content #helpContainer #helpList, #content #settingsContainer #settingsList, #content #reportContainer #reportList { + padding-top: 5px; +} +#content #bbCodeContainer,#content #emoticonsContainer { + background-color: rgb(240, 247, 252); + padding: 5px; +} +#content #colorCodesContainer a { + border-color: #a5cae4; +} +#content #optionsContainer input { + background-color: transparent; +} +#content .rowEven { + background: #d7edfc url('../../styles/default/xenforo/gradients/category-23px-light.png') repeat-x top; +} +#content .rowOdd { + background-color: #F7F7FF; +} +#content .guest { + color: gray; +} +#content .user { + color: #176093; +} +#content .customUser { + color: #e68c17; +} +#content .moderator { + color: #00AA00; +} +#content .admin, #content .chatBotErrorMessage { + color: red; +} +#content .chatBot { + color: #60A0DC; +} +#content #chatList a { + color: #60A0DC; +} +#content #chatList .deleteSelected { + border-color: red; +} +#content #onlineListContainer h3,#content #helpContainer h3,#content #settingsContainer h3,#content #reportContainer h3 { + font-size: 11px; + background: #f9d9b0 url('../../styles/default/xenforo/gradients/category-23px-light.png') repeat-x top; + color: #6d3f03; + border-bottom: 1px solid #f9bc6d; +} +#content #chatList .report { + display:block; + float:right; + width:10px; + height:10px; + margin-top:2px; + margin-left:5px; + background:url('../img/report.gif') 0 0 no-repeat; +} +#content #chatList .report:hover { + background-position:0 -10px;; +} diff --git a/chat/css/beige.css b/chat/css/beige.css index 7c30bbe..ca99df3 100644 --- a/chat/css/beige.css +++ b/chat/css/beige.css @@ -2,113 +2,110 @@ * @package AJAX_Chat * @author Sebastian Tschan * @author Philip Nicolcev - * @copyright (c) Sebastian Tschan - * @license Modified MIT License - * @link https://blueimp.net/ajax/ */ - @import url('global.css'); @import url('fonts.css'); @import url('print.css'); +@import url('custom.css'); + +/* Buttons */ +#content #bbCodeContainer input, #content #logoutButton, #content #submitButton, #loginForm #loginButton { + background-color:#d9ce72; + color:#333333; + border:1px solid #c8b360; + background-image:linear-gradient(to bottom, #d9ce72, #e1d995); +} +#content #bbCodeContainer input:hover, #content #logoutButton:hover, #content #submitButton:hover, #loginForm #loginButton:hover { + background-image:linear-gradient(to bottom, #C1B022, #C8BD66); +} +#content select, #loginForm select, #loginForm input, #content textarea { + color:#333333; + border:1px solid #c8b360; +} -@media screen,projection,handheld { +/* Status Icon */ +#content #statusIconContainer { + background:url('../img/loading-sprite.png') no-repeat 0px 0px; +} +#content #statusIconContainer.waiting { + background-position: 0px -22px; +} +#content #statusIconContainer.retrying { + background-position: 0px -44px; +} - /* Buttons */ - #content #bbCodeContainer input, #content #logoutButton, #content #submitButton, #loginForm #loginButton { - background-color:#d9ce72; - color:#333333; - border: 1px solid #c8b360; - background-image: linear-gradient(to bottom, #d9ce72, #e1d995); - } - #content select, #loginForm select, #loginForm input, #content textarea { - color:#333333; - border: 1px solid #c8b360; - } - - /* Status Icon */ - #content #statusIconContainer { - background-image: url('../img/loading-sprite.png'); - } - #content .statusContainerOff { - background-position: 0px 0px; - } - #content .statusContainerOn { - background-position: 0px -22px; - } - #content .statusContainerAlert { - background-position: 0px -44px; - } - - /* Other Theme Elements */ - #loginContent { - background-color:#F7F5DC; - color:#000; - } - #loginContent h1 { - color:#000; - } - #loginContent a { - color:#000; - } - #loginContent input, #loginContent select { - background-color:#FFF; - color:#000; - } - #loginContent #errorContainer { - color:red; - } - #content { - background-color:#eee9be; - color:#000; - } - #content h1 { - color:#000; - } - #content a { - color:#000; - } - #content #chatList, #content #onlineListContainer, #content #helpContainer, #content #settingsContainer, #content #colorCodesContainer, #content textarea { - border-color:gray; - background-color:#FFF; - } - #content #colorCodesContainer a { - border-color:black; - } - #content #optionsContainer input { - background-color:transparent; - } - #content .rowEven { - background-color:#FFFFF0; - } - #content .rowOdd { - background-color:#F7F5DC; - } - #content .guest { - color:gray; - } - #content .user { - color:#000; - } - #content .moderator { - color:#00AA00; - } - #content .admin { - color:red; - } - #content .chatBot { - color:#FF6600; - } - #content #chatList .chatBotErrorMessage { - color:red; - } - #content #chatList a { - color:#1E90FF; - } - #content #chatList .deleteSelected { - border-color:red; - } - #content #onlineListContainer h3, #content #helpContainer h3, #content #settingsContainer h3 { - background-color:#FFFFF0; - color:#000; - } +/* Other Theme Elements */ +.ajax-chat { + background-color:#F7F5DC; + color:#000; +} +.ajax-chat a { + color:#000; +} +.ajax-chat h1 { + color:#000; +} +#loginContent input, #loginContent select { + background-color:#FFF; + color:#000; +} +#loginContent #errorContainer { + color:red; +} +#content #chatList, #content #onlineListContainer, #content #helpContainer, #content #settingsContainer, #content textarea { + border-color:gray; + background-color:#FFF; +} +.ajax-chat .popup { + background-color:#F7F5DC; + border: 1px solid #808080; +} +#content #colorCodesContainer a { + border-color:black; +} +#content #optionsContainer input { + background-color:transparent; +} +#content .rowEven, #helpList dl:nth-child(even), #settingsList dl:nth-child(even) { + background-color:#FFFFF0; +} +#content .rowOdd, #helpList dl:nth-child(odd), #settingsList dl:nth-child(odd) { + background-color:#F7F5DC; +} +#content #chatList .rowOdd.private { + background-color:#F8D0D0; +} +#content #chatList .rowEven.private { + background-color:#F8D9D0; +} +#content .guest { + color:gray; +} +#content .user { + color:#000; +} +#content .customUser { + color:#645a30; +} +#content .moderator { + color:#00AA00; +} +#content .admin { + color:red; +} +#content .chatBot { + color:#FF6600; +} +#content #chatList .chatBotErrorMessage { + color:red; +} +#content #chatList a { + color:#1E90FF; +} +#content #chatList .deleteSelected { + border-color:red; +} +#content #onlineListContainer h3, #content #helpContainer h3, #content #settingsContainer h3 { + background-color:#FFFFF0; + color:#000; } \ No newline at end of file diff --git a/chat/css/black.css b/chat/css/black.css index 292b5d1..2420ec9 100644 --- a/chat/css/black.css +++ b/chat/css/black.css @@ -2,114 +2,115 @@ * @package AJAX_Chat * @author Sebastian Tschan * @author Philip Nicolcev - * @copyright (c) Sebastian Tschan - * @license Modified MIT License - * @link https://blueimp.net/ajax/ + * + * Color palette inspired by PunBB style "Cobalt": + * http://punbb.org/ */ - @import url('global.css'); @import url('fonts.css'); @import url('print.css'); +@import url('custom.css'); + +/* Buttons */ +#content #bbCodeContainer input, #content #logoutButton, #content #submitButton, #loginForm #loginButton { + background-color:#000; + color:#f0f0f0; + border: 1px solid #808080; + background-image: linear-gradient(to bottom, #222, #000); +} +#content #bbCodeContainer input:hover, #content #logoutButton:hover, #content #submitButton:hover, #loginForm #loginButton:hover { + background-color:#222; + background-image: linear-gradient(to top, #222, #000); +} +#content select, #loginForm select, #loginForm input, #content textarea { + background-color:#000; + color:#fafafa; + border: 1px solid #808080; +} -@media screen,projection,handheld { +/* Status Icon */ +#content #statusIconContainer { + background: url('../img/loading-sprite.png') no-repeat 0px 0px; +} +#content #statusIconContainer.waiting { + background-position: 0px -22px; +} +#content #statusIconContainer.retrying { + background-position: 0px -44px; +} - /* Buttons */ - #content #bbCodeContainer input, #content #logoutButton, #content #submitButton, #loginForm #loginButton { - background-color:#000; - color:#f0f0f0; - border: 1px solid #808080; - background-image: linear-gradient(to bottom, #222, #000); - } - #content select, #loginForm select, #loginForm input, #content textarea { - background-color:#000; - color:#fafafa; - border: 1px solid #808080; - } - - /* Status Icon */ - #content #statusIconContainer { - background-image: url('../img/loading-sprite.png'); - } - #content .statusContainerOff { - background-position: 0px 0px; - } - #content .statusContainerOn { - background-position: 0px -22px; - } - #content .statusContainerAlert { - background-position: 0px -44px; - } - - /* Other Theme Elements */ - #loginContent { - background-color:#000; - color:#FFF; - } - #loginContent h1 { - color:#FFF; - } - #loginContent a { - color:#FFF; - } - #loginContent input, #loginContent select { - background-color:#212121; - color:#FFF; - } - #loginContent #errorContainer { - color:red; - } - #content { - background-color:#000; - color:#FFF; - } - #content h1 { - color:#FFF; - } - #content a { - color:#FFF; - } - #content #chatList, #content #onlineListContainer, #content #helpContainer, #content #settingsContainer, #content #colorCodesContainer, #content textarea { - border-color:gray; - background-color:#000; - } - #content #colorCodesContainer a { - border-color:black; - } - #content #optionsContainer input { - background-color:transparent; - } - #content .rowEven { - background-color:#212121; - } - #content .rowOdd { - background-color:#000; - } - #content .guest { - color:gray; - } - #content .user { - color:#FFF; - } - #content .moderator { - color:#00AA00; - } - #content .admin { - color:red; - } - #content .chatBot { - color:#FF6600; - } - #content #chatList .chatBotErrorMessage { - color:red; - } - #content #chatList a { - color:#1E90FF; - } - #content #chatList .deleteSelected { - border-color:red; - } - #content #onlineListContainer h3, #content #helpContainer h3, #content #settingsContainer h3 { - background-color:#212121; - color:#FFF; - } +/* Other Theme Elements */ +.ajax-chat { + background-color:#000; + color:#FFF; +} +.ajax-chat a { + color:#FFF; +} +.ajax-chat h1 { + color:#FFF; +} +#loginContent input, #loginContent select { + background-color:#212121; + color:#FFF; +} +#loginContent #errorContainer { + color:red; +} +#content #chatList, #content #onlineListContainer, #content #helpContainer, #content #settingsContainer, #content textarea { + border-color:gray; + background-color:#000; +} +.ajax-chat .popup { + background-color:#000; + border: 1px solid gray; +} +#content #colorCodesContainer a { + border-color:black; +} +#content #optionsContainer input { + background-color:transparent; +} +#content .rowEven, #helpList dl:nth-child(even), #settingsList dl:nth-child(even) { + background-color:#212121; +} +#content .rowOdd, #helpList dl:nth-child(odd), #settingsList dl:nth-child(odd) { + background-color:#000; +} +#content #chatList .rowOdd.private { + background-color:#B83C1D; +} +#content #chatList .rowEven.private { + background-color:#C84A24; +} +#content .guest { + color:gray; +} +#content .user { + color:#FFF; +} +#content .customUser { + color:#ffcc33; +} +#content .moderator { + color:#00AA00; +} +#content .admin { + color:red; +} +#content .chatBot { + color:#FF6600; +} +#content #chatList .chatBotErrorMessage { + color:red; +} +#content #chatList a { + color:#1E90FF; +} +#content #chatList .deleteSelected { + border-color:red; +} +#content #onlineListContainer h3, #content #helpContainer h3, #content #settingsContainer h3 { + background-color:#212121; + color:#FFF; } \ No newline at end of file diff --git a/chat/css/custom.css b/chat/css/custom.css new file mode 100644 index 0000000..63fdec0 --- /dev/null +++ b/chat/css/custom.css @@ -0,0 +1,17 @@ +/* Custom CSS - enter css overrides for all styles below */ + +/* e.g. to hide the logout button and the channel, style and language selectors, uncomment the following: + +#content #logoutChannelContainer { + display:none; +} +#content #mainPanelContainer { + top: 45px; +} +#content #copyright { + right: 60px; +} +#content #statusIconContainer { + top: 10px; +} +*/ \ No newline at end of file diff --git a/chat/css/fonts.css b/chat/css/fonts.css index e12f628..be935ca 100644 --- a/chat/css/fonts.css +++ b/chat/css/fonts.css @@ -1,12 +1,3 @@ -/* - * @package AJAX_Chat - * @author Sebastian Tschan - * @copyright (c) Sebastian Tschan - * @license Modified MIT License - * @link https://blueimp.net/ajax/ - */ - -/* Fonts */ #loginContent { font-family:Verdana, Arial, Helvetica, sans-serif; font-size:0.8em; @@ -58,6 +49,9 @@ #content #chatList span.user { font-weight:bold; } +#content #chatList span.customUser { + font-weight:bold; +} #content #chatList span.moderator { font-weight:bold; } @@ -89,12 +83,9 @@ #content #onlineListContainer #onlineList div { font-size:0.9em; } -#content #helpContainer #helpList td { +#content #helpContainer #helpList, #content #settingsContainer #settingsList { font-size:0.9em; } -#content #helpContainer #helpList td.code { +#content #helpContainer #helpList dd { font-style:italic; -} -#content #settingsContainer #settingsList td { - font-size:0.9em; } \ No newline at end of file diff --git a/chat/css/global.css b/chat/css/global.css index eff916f..0495fad 100644 --- a/chat/css/global.css +++ b/chat/css/global.css @@ -8,25 +8,28 @@ */ /* Positioning */ -#loginContent { - position:absolute; - width:100%; - height:100%; +body.ajax-chat { + padding:0; + margin:0; } -#loginContent #loginHeadlineContainer { - margin: 100px 100px 0 100px; +#loginContent { + margin: 0 auto 0; + padding-top: 20px; + width:250px; } -#loginContent #loginFormContainer, #loginContent #errorContainer { - margin: 0 100px; +#loginContent #loginHeadline { + margin:0; + line-height:35px; } -#loginContent #loginFormContainer div { - margin-bottom:7px; +#loginContent #loginForm div { + margin:5px 0; } #loginContent #loginRegisteredUsers { padding-top:5px; } #loginContent #copyright { - margin: 20px 100px 0 100px; + margin:20px 0 0 0; + text-align:right; } #content { position:absolute; @@ -38,96 +41,135 @@ right:20px; top:20px; } -#content #headlineContainer { +#content #headline { position:absolute; - left:20px; - top:5px; + left:0px; + right:0px; + top:0px; + padding:0 0 0 20px; + line-height:45px; + margin:0; } #content #logoutChannelContainer { position:absolute; + z-index:2; left:20px; top:50px; + right:50px; } #content #logoutChannelContainer select{ - width: 105px; - height: 22px; + width:105px; + height:22px; } #content #statusIconContainer { position:absolute; right:20px; top:50px; - width: 22px; - height: 22px; + width:22px; + height:22px; } #content #chatList { + height:100%; + overflow:auto; +} +#content #mainPanelContainer { position:absolute; left:20px; - right:230px; + right:20px; top:85px; bottom:150px; +} +#content #onlineListContainer, #content #helpContainer, #content #settingsContainer { + float:right; + height:100%; overflow:auto; + margin-left:10px; + position:relative; +} +#content #onlineListContainer h3, #content #helpContainer h3, #content #settingsContainer h3 { + line-height:25px; + padding: 0 10px; + margin:0; + text-align:center; +} +#content #onlineListContainer { + width:200px; +} +#content #helpContainer, #content #settingsContainer { + width:360px; +} +#content #onlineListContainer #onlineList, #content #helpContainer #helpList, #content #settingsContainer #settingsList { + position:absolute; + left:0px; + right:0px; + top:25px; + bottom:0px; + overflow:auto; +} +#content #helpContainer #helpList dl, #content #settingsContainer #settingsList dl { + overflow:hidden; + padding:5px; + margin:0; +} +#content #helpContainer #helpList dt, #content #settingsContainer #settingsList dt { + float:left; + width:55%; + padding:0 2% 0 0; + margin:0; + clear:left; +} +#content #helpContainer #helpList dd, #content #settingsContainer #settingsList dd { + width:43%; + float:left; + margin:0; + padding:0; } #content #inputFieldContainer { position:absolute; left:20px; right:20px; bottom:95px; - padding-right:4px; + padding-right:2px; +} +#content #inputFieldContainer #inputField { + width:100%; + height:40px; + padding:0; } #content #submitButtonContainer { position:absolute; right:20px; bottom:60px; } -#content #onlineListContainer { - position:absolute; - right:20px; - top:85px; - width:200px; - bottom:150px; -} -#content #helpContainer { - position:absolute; - right:20px; - top:85px; - width:360px; - bottom:150px; -} -#content #settingsContainer { - position:absolute; - right:20px; - top:85px; - width:360px; - bottom:150px; -} #content #bbCodeContainer { position:absolute; left:20px; bottom:20px; padding:3px; } -#content #colorCodesContainer { +#content #bbCodeContainer input { + display:block; + float:left; + margin-right:2px; +} +#content #bbCodeContainer #bbCodeEmoticon { + display:none; +} +#content #colorCodesContainer, #content #emoticonsContainer { position:absolute; left:20px; bottom:55px; padding:3px; z-index:1; } -#content #emoticonsContainer { - position:absolute; - left:20px; - bottom:57px; - padding:3px; -} -#content #optionsContainer { - position:absolute; - right:20px; - bottom:20px; - padding:3px; - padding-right:0px; +#content #emoticonsContainer a { + margin-left:1px; + margin-right:1px; + z-index:1; } -#content #bbCodeContainer input, #content #logoutButton, #content #submitButton, #loginContent #loginButton { - padding: 4px 10px; +#content #emoticonsContainer img { + vertical-align:middle; + margin-bottom:2px; } #content #colorCodesContainer a { display:block; @@ -135,24 +177,22 @@ width:20px; height:20px; } +#content #optionsContainer { + position:absolute; + right:20px; + bottom:20px; + padding:3px 0 3px 3px; +} #content #optionsContainer input { vertical-align:middle; } -#content #optionsContainer input.button { - width:22px; - height:22px; -} -#content #emoticonsContainer a { - margin-left:1px; - margin-right:1px; -} -#content #emoticonsContainer img { - vertical-align:middle; - margin-bottom:2px; +#content #bbCodeContainer input, #content #logoutButton, #content #submitButton, #loginContent #loginButton { + padding: 4px 10px; } -#content #headlineContainer h1 { - margin-left:auto; - margin-top:12px; +#content #logoutButton { + display:block; + float:left; + margin: 0 5px 5px 0; } #content #chatList div { padding: 2px 10px; @@ -178,24 +218,6 @@ padding-left:5px; background:url('../img/delete.png') no-repeat right; } -#content #inputFieldContainer #inputField { - width:100%; - height:40px; -} -#content #onlineListContainer h3, #content #helpContainer h3, #content #settingsContainer h3 { - height:30px; - padding: 4px 10px; - margin:0px; - text-align:center; -} -#content #onlineListContainer #onlineList, #content #helpContainer #helpList, #content #settingsContainer #settingsList { - position:absolute; - left:0px; - right:0px; - top:25px; - bottom:0px; - overflow:auto; -} #content #onlineListContainer #onlineList div { padding: 2px 10px; } @@ -206,61 +228,56 @@ margin: 5px 0; padding-left:20px; } -#content #helpContainer #helpList td, #content #settingsContainer #settingsList td { - padding: 4px 10px; - vertical-align:top; -} -#content #settingsContainer #settingsList td { - vertical-align:middle; -} -#content #settingsContainer #settingsList td.setting { - width:115px; -} -#content #settingsContainer #settingsList input.text { - width:100px; -} #content #settingsContainer #settingsList select.left { text-align:right; } -#content #settingsContainer #settingsList input.button { - width:22px; - height:22px; - vertical-align:middle; - margin-bottom:2px; -} /* Buttons */ +#content #optionsContainer input, #content #settingsContainer #settingsList input.button, #content #showChannelsButton { + background: url('../img/buttons-sprite.png') no-repeat; + vertical-align:middle; + width:22px; + height:22px; + padding:0; +} #content #optionsContainer #helpButton { - background:url('../img/help.png') no-repeat; + background-position: -69px -22px; } #content #optionsContainer #settingsButton { - background:url('../img/settings.png') no-repeat; + background-position: -92px 0px; } #content #optionsContainer #onlineListButton { - background:url('../img/users.png') no-repeat; + background-position: -69px 0px; } #content #optionsContainer #audioButton { - background:url('../img/audio.png') no-repeat 0px 0px; + background-position: 0px 0px; } #content #optionsContainer #audioButton.off { - background-position: 0px 100%; + background-position: 0px -22px; } #content #optionsContainer #autoScrollButton { - background:url('../img/autoscroll.png') no-repeat 0px 0px; + background-position: -23px 0px; } #content #optionsContainer #autoScrollButton.off { - background-position: 0px 100%; + background-position: -23px -22px; } #content #settingsContainer #settingsList input.playback { - background:url('../img/playback.png') no-repeat; + background-position: -92px -22px; + margin-bottom:3px; +} +#content #logoutChannelContainer #showChannelsButton { + background-position: -46px 0px; + display:none; +} +#content #logoutChannelContainer #showChannelsButton.off { + background-position: -46px -22px; } /* Borders */ #content img { border:none; } -#content #chatList, #content #onlineListContainer, #content #helpContainer, #content #settingsContainer, #content #colorCodesContainer, -#content #colorCodesContainer a, #content textarea { +#content #chatList, #content #onlineListContainer, #content #helpContainer, #content #settingsContainer, #content #colorCodesContainer a, #content textarea { border-width:1px; border-style:solid; } @@ -268,11 +285,46 @@ border-width:1px; border-style:dotted; } -#content #helpContainer #helpList table, #content #settingsContainer #settingsList table { - border-collapse:collapse; -} /* Misc */ #content #bbCodeContainer input, #content #optionsContainer input.button, #content #settingsContainer #settingsList input.button, #content #logoutButton, #content #submitButton, #loginContent #loginButton { cursor:pointer; +} + +@media (max-width: 700px) { + #content #mainPanelContainer { top:65px; left:5px; right:5px; bottom:105px; } + #content #headline { margin:0; padding:0 0 0 5px; line-height:25px; } + #content #statusIconContainer { top:2px; right:2px; } + #content #copyright { top:0px; right:30px; line-height: 25px;} + #content #logoutChannelContainer { top:30px; left:5px; right:0px; } + #content #logoutChannelContainer label { display:none; } + #content #emoticonsContainer, #content #submitButtonContainer { display:none; } + #content #bbCodeContainer { bottom:45px; left:5px; padding:0; } + #content #bbCodeContainer #bbCodeEmoticon { display:block; } + #content #bbCodeContainer #bbCodeQuote, #content #bbCodeContainer #bbCodeCode { display:none; } + #content #optionsContainer { bottom:10px; right:5px; } + #content #chatList { left:5px; right:150px; bottom:115px; font-size:12px; } + #content #inputFieldContainer #inputField { height:20px; } + #content #inputFieldContainer { left:5px; right:5px; bottom:75px; } + #content #colorCodesContainer, #content #emoticonsContainer { bottom:85px; left:5px; } + #content #onlineListContainer, #content #helpContainer, #content #settingsContainer { margin-left:0; border-left-width:0; } +} + +@media (max-width: 480px) { + #content #mainPanelContainer { top:65px; left:0px; right:0px; bottom:105px; } + #content #onlineListContainer, #content #helpContainer, #content #settingsContainer { border-right-width:0; position:absolute; width:auto; top:0px; right:0px; bottom:0px; left:0px; } + #content #chatList { border-left-width: 0; border-right-width: 0; } + #content #bbCodeContainer #bbCodeIMG, #content #bbCodeContainer #bbCodeURL { display:none; } + #content #bbCodeContainer { padding:0; } + #content #emoticonsContainer { bottom:80px; left:5px; } + #content #logoutChannelInner { display:none; clear:left; padding:5px; text-align:right; } + #content #logoutChannelContainer #showChannelsButton { display:block; position:absolute; right:5px; top:5px; } +} + +@media (max-height: 300px) { + #content #inputFieldContainer #inputField { height:20px; } + #content #bbCodeContainer, #content #optionsContainer, #content #emoticonsContainer, #content #submitButtonContainer, + #content #statusIconContainer, #content #logoutChannelContainer { display:none; } + #content #inputFieldContainer { bottom: 5px; } + #content #mainPanelContainer { bottom:40px; top:35px; } } \ No newline at end of file diff --git a/chat/css/grey.css b/chat/css/grey.css index 36d55d6..64b70c4 100644 --- a/chat/css/grey.css +++ b/chat/css/grey.css @@ -2,114 +2,110 @@ * @package AJAX_Chat * @author Sebastian Tschan * @author Philip Nicolcev - * @author Philip Nicolcev - * @copyright (c) Sebastian Tschan - * @license Modified MIT License - * @link https://blueimp.net/ajax/ */ - @import url('global.css'); @import url('fonts.css'); @import url('print.css'); +@import url('custom.css'); + +/* Buttons */ +#content #bbCodeContainer input, #content #logoutButton, #content #submitButton, #loginForm #loginButton { + background-color:#8a8a8a; + color:#fff; + border:1px solid #808080; + background-image:linear-gradient(to bottom, #8a8a8a, #444); +} +#content #bbCodeContainer input:hover, #content #logoutButton:hover, #content #submitButton:hover, #loginForm #loginButton:hover { + background-image:linear-gradient(to top, #8a8a8a, #444); +} +#content select, #loginForm select, #loginForm input, #content textarea { + color:#333333; + border: 1px solid #808080; +} -@media screen,projection,handheld { +/* Status Icon */ +#content #statusIconContainer { + background: url('../img/loading-sprite.png') no-repeat 0px 0px; +} +#content #statusIconContainer.waiting { + background-position: 0px -22px; +} +#content #statusIconContainer.retrying { + background-position: 0px -44px; +} - /* Buttons */ - #content #bbCodeContainer input, #content #logoutButton, #content #submitButton, #loginForm #loginButton { - background-color:#8a8a8a; - color:#fff; - border: 1px solid #808080; - background-image: linear-gradient(to bottom, #8a8a8a, #444); - } - #content select, #loginForm select, #loginForm input, #content textarea { - color:#333333; - border: 1px solid #808080; - } - - /* Status Icon */ - #content #statusIconContainer { - background-image: url('../img/loading-sprite.png'); - } - #content .statusContainerOff { - background-position: 0px 0px; - } - #content .statusContainerOn { - background-position: 0px -22px; - } - #content .statusContainerAlert { - background-position: 0px -44px; - } - - /* Other Theme Elements */ - #loginContent { - background-color:#F6F6F6; - color:#000; - } - #loginContent h1 { - color:#000; - } - #loginContent a { - color:#000; - } - #loginContent input, #loginContent select { - background-color:#FFF; - color:#000; - } - #loginContent #errorContainer { - color:red; - } - #content { - background-color:#d0d0d0; - color:#000; - } - #content h1 { - color:#000; - } - #content a { - color:#000; - } - #content #chatList, #content #onlineListContainer, #content #helpContainer, #content #settingsContainer, #content #colorCodesContainer, #content textarea { - border-color:gray; - background-color:#FFF; - } - #content #colorCodesContainer a { - border-color:black; - } - #content #optionsContainer input { - background-color:transparent; - } - #content .rowEven { - background-color:#FFF; - } - #content .rowOdd { - background-color:#F6F6F6; - } - #content .guest { - color:gray; - } - #content .user { - color:#000; - } - #content .moderator { - color:#00AA00; - } - #content .admin { - color:red; - } - #content .chatBot { - color:#FF6600; - } - #content #chatList .chatBotErrorMessage { - color:red; - } - #content #chatList a { - color:#1E90FF; - } - #content #chatList .deleteSelected { - border-color:red; - } - #content #onlineListContainer h3, #content #helpContainer h3, #content #settingsContainer h3 { - background-color:#FFF; - color:#000; - } +/* Other Theme Elements */ +.ajax-chat { + background-color:#d0d0d0; + color:#000; +} +.ajax-chat h1 { + color:#000; +} +.ajax-chat a { + color:#000; +} +#loginContent input, #loginContent select { + background-color:#FFF; + color:#000; +} +#loginContent #errorContainer { + color:red; +} +#content #chatList, #content #onlineListContainer, #content #helpContainer, #content #settingsContainer, #content textarea { + border-color:gray; + background-color:#FFF; +} +.ajax-chat .popup { + background-color:#FFF; + border:1px solid gray; +} +#content #colorCodesContainer a { + border-color:black; +} +#content #optionsContainer input { + background-color:transparent; +} +#content .rowEven, #helpList dl:nth-child(even), #settingsList dl:nth-child(even) { + background-color:#FFF; +} +#content .rowOdd, #helpList dl:nth-child(odd), #settingsList dl:nth-child(odd) { + background-color:#F6F6F6; +} +#content #chatList .rowOdd.private { + background-color:#F8D0D0; +} +#content #chatList .rowEven.private { + background-color:#F8D9D0; +} +#content .guest { + color:gray; +} +#content .user { + color:#000; +} +#content .customUser { + color:#606060; +} +#content .moderator { + color:#00AA00; +} +#content .admin { + color:red; +} +#content .chatBot { + color:#FF6600; +} +#content #chatList .chatBotErrorMessage { + color:red; +} +#content #chatList a { + color:#1E90FF; +} +#content #chatList .deleteSelected { + border-color:red; +} +#content #onlineListContainer h3, #content #helpContainer h3, #content #settingsContainer h3 { + background-color:#FFF; + color:#000; } \ No newline at end of file diff --git a/chat/css/ie5-6.css b/chat/css/ie5-6.css deleted file mode 100644 index c6ddda3..0000000 --- a/chat/css/ie5-6.css +++ /dev/null @@ -1,70 +0,0 @@ -/* - * @package AJAX_Chat - * @author Sebastian Tschan - * @copyright (c) Sebastian Tschan - * @license Modified MIT License - * @link https://blueimp.net/ajax/ - */ - - -/* - * Positioning adjustments for IE versions < 7 - */ - -body { - width:100%; - height:100%; -} -#content #chatList { - position:static; - margin-right:230px; - margin-left:20px; - margin-top:85px; - height:360px; -} -#content #onlineListContainer { - height:360px; -} -#content #helpContainer { - height:360px; -} -#content #settingsContainer { - height:360px; -} -#content #inputFieldContainer { - top:460px; - padding:0px; -} -#content #submitButtonContainer { - top:517px; -} -#content #bbCodeContainer { - top:550px; -} -#content #colorCodesContainer { - top:516px; -} -#content #emoticonsContainer { - top:517px; -} -#content #optionsContainer { - top:555px; -} -#content #inputFieldContainer #inputField { - width:94%; -} -#content #onlineListContainer #onlineList { - width:100%; - height:335px; - overflow:auto; -} -#content #helpContainer #helpList { - width:100%; - height:335px; - overflow:auto; -} -#content #settingsContainer #settingsList { - width:100%; - height:335px; - overflow:auto; -} \ No newline at end of file diff --git a/chat/css/pine_images/chatlist.jpg b/chat/css/pine_images/chatlist.jpg new file mode 100644 index 0000000..e7366df Binary files /dev/null and b/chat/css/pine_images/chatlist.jpg differ diff --git a/chat/css/print.css b/chat/css/print.css index a37857d..5a5516e 100644 --- a/chat/css/print.css +++ b/chat/css/print.css @@ -1,25 +1,11 @@ -/* - * @package AJAX_Chat - * @author Sebastian Tschan - * @copyright (c) Sebastian Tschan - * @license Modified MIT License - * @link https://blueimp.net/ajax/ - */ - - -/* - * Print layout - */ - @media print { - #content { position:static; } #content #copyright { display:none; } - #content #headlineContainer { + #content #headline { display:none; } #content #logoutChannelContainer { @@ -72,11 +58,9 @@ #content #chatList .delete { display:none; } - #content #chatList { border:none; } - #content { font-family:'times new roman', times, serif; font-size:1.0em; @@ -85,7 +69,6 @@ #content #chatList code { font-size:0.8em; } - #content { color:#000; } @@ -95,6 +78,9 @@ #content .user { color:#000; } + #content .customUser { + color:#0044CC; + } #content .moderator { color:#00AA00; } @@ -110,5 +96,4 @@ #content #chatList a { color:#1E90FF; } - } \ No newline at end of file diff --git a/chat/css/prosilver.css b/chat/css/prosilver.css index 867c30d..f0a0c32 100644 --- a/chat/css/prosilver.css +++ b/chat/css/prosilver.css @@ -2,153 +2,150 @@ * @package AJAX_Chat * @author Sebastian Tschan * @author Philip Nicolcev - * @copyright (c) Sebastian Tschan - * @license Modified MIT License - * @link https://blueimp.net/ajax/ * * Color palette inspired by phpBB style "prosilver": * http://www.phpbb.com/ */ - @import url('global.css'); @import url('fonts.css'); @import url('print.css'); +@import url('custom.css'); + +/* Firefox button padding fix */ +#content #bbCodeContainer input::-moz-focus-inner, #content #logoutButton::-moz-focus-inner, #content #submitButton::-moz-focus-inner { + border:0; + padding:0; +} + +/* Buttons */ +#content #bbCodeContainer input, #content #logoutButton, #content #submitButton, #loginForm #loginButton { + background-color:#F7F5F1; + color:#333333; + border: 1px solid #8a8a8a; + background-image: linear-gradient(to bottom, #fafafa, #cdcdcd); + background-image: -webkit-linear-gradient(top, #fafafa, #cdcdcd); +} +#content select, #loginForm select, #loginForm input, #content textarea { + background-color:#FFF; + color:#333333; + border: 1px solid #ababab; +} + +/* Status Icon */ +#content #statusIconContainer { + background: url('../img/loading-sprite.png') no-repeat 0px 0px; +} +#content #statusIconContainer.waiting { + background-position: 0px -22px; +} +#content #statusIconContainer.retrying { + background-position: 0px -44px; +} -@media screen,projection,handheld { +/* Headers */ +#loginContent h1 { + color:#333333; +} +#content #headline { + left: 0px; + right: 0px; + background: #0c95d9; + color: white; +} +#content #onlineListContainer h3, #content #helpContainer h3, #content #settingsContainer h3 { + background-color:#0c95d9; + color:#fff; + height: 25px; +} - /* Firefox button padding fix */ - #content #bbCodeContainer input::-moz-focus-inner, #content #logoutButton::-moz-focus-inner, #content #submitButton::-moz-focus-inner { - border:0; - padding:0; - } - - /* Buttons */ - #content #bbCodeContainer input, #content #logoutButton, #content #submitButton, #loginForm #loginButton { - background-color:#F7F5F1; - color:#333333; - border: 1px solid #8a8a8a; - background-image: linear-gradient(to bottom, #fafafa, #cdcdcd); - background-image: -webkit-linear-gradient(top, #fafafa, #cdcdcd); - } - #content select, #loginForm select, #loginForm input, #content textarea { - background-color:#FFF; - color:#333333; - border: 1px solid #ababab; - } - - /* Status Icon */ - #content #statusIconContainer { - background-image: url('../img/loading-sprite.png'); - } - #content .statusContainerOff { - background-position: 0px 0px; - } - #content .statusContainerOn { - background-position: 0px -22px; - } - #content .statusContainerAlert { - background-position: 0px -44px; - } - - /* Headers */ - #loginContent h1 { - color:#333333; - } - #content #headlineContainer h1 { - color: white; - margin-left: 20px; - } - #content #onlineListContainer h3, #content #helpContainer h3, #content #settingsContainer h3 { - background-color:#0c95d9; - color:#fff; - height: 25px; - } - - /* Other Theme Elements */ - #content #chatList, #content #onlineListContainer, #content #helpContainer, #content #settingsContainer, #content #colorCodesContainer { - border-color: #ababab; - } - #content #chatList .deleteSelected { - border-width:1px; - border-style:dotted; - } - #content #helpContainer #helpList table, #content #settingsContainer #settingsList table { - border-collapse:collapse; - } - #loginContent { - background-color:#F9F9F9; - color:#28313F; - } - #loginContent a { - color:#333333; - } - #loginContent input, #loginContent select { - background-color:#FFF; - color:#333333; - } - #loginContent #loginFormContainer #loginButton { - background-color:#F7F5F1; - color:#333333; - } - #loginContent #errorContainer { - color:red; - } - #content #headlineContainer { - top: 0; - left: 0; - width: 100%; - background: #0c95d9; - } - #content #copyright, #content #copyright a { - color: white; - } - #content { - background-color:#F9F9F9; - color:#28313F; - } - #content a { - color:#333333; - } - #content #chatList, #content #onlineListContainer, #content #helpContainer, #content #settingsContainer, #content #colorCodesContainer, #content #emoticonsContainer { - background-color:#FFF; - } - #content #colorCodesContainer { - box-shadow: 2px 2px 2px #777; - } - #content #colorCodesContainer a { - border-color:black; - } - #content #optionsContainer input { - background-color:transparent; - } - #content .rowEven { - background-color:#eaf1f6; - } - #content .rowOdd { - background-color:#e1eaf2; - } - #content .guest { - color:gray; - } - #content .user { - color:#333333; - } - #content .moderator { - color:#00AA00; - } - #content .admin { - color:#AA0000; - } - #content .chatBot { - color:#D31141; - } - #content #chatList .chatBotErrorMessage { - color:red; - } - #content #chatList a { - color:#D31141; - } - #content #chatList .deleteSelected { - border-color:red; - } +/* Other Theme Elements */ +.ajax-chat { + background-color:#F9F9F9; + color:#28313F; +} +#content #chatList, #content #onlineListContainer, #content #helpContainer, #content #settingsContainer { + border-color: #ababab; +} +.ajax-chat .popup { + background-color:#FFF; + border: 1px solid #ababab; + box-shadow: 2px 2px 2px #777; +} +#content #chatList .deleteSelected { + border-width:1px; + border-style:dotted; +} +#content #helpContainer #helpList table, #content #settingsContainer #settingsList table { + border-collapse:collapse; +} +#loginContent a { + color:#333333; +} +#loginContent input, #loginContent select { + background-color:#FFF; + color:#333333; +} +#loginContent #loginButton { + background-color:#F7F5F1; + color:#333333; +} +#loginContent #errorContainer { + color:red; +} +#content #copyright, #content #copyright a { + color: white; +} +#content a { + color:#333333; +} +#content #chatList, #content #onlineListContainer, #content #helpContainer, #content #settingsContainer, #content #colorCodesContainer, #content #emoticonsContainer { + background-color:#FFF; +} +#content #colorCodesContainer { + box-shadow: 2px 2px 2px #777; +} +#content #colorCodesContainer a { + border-color:black; +} +#content #optionsContainer input { + background-color:transparent; +} +#content .rowEven, #helpList dl:nth-child(even), #settingsList dl:nth-child(even) { + background-color:#eaf1f6; +} +#content .rowOdd, #helpList dl:nth-child(odd), #settingsList dl:nth-child(odd) { + background-color:#e1eaf2; +} +#content #chatList .rowOdd.private { + background-color:#F8D0D0; +} +#content #chatList .rowEven.private { + background-color:#F8D9D0; +} +#content .guest { + color:gray; +} +#content .user { + color:#333333; +} +#content .customUser { + color:#0c95d9; +} +#content .moderator { + color:#00AA00; +} +#content .admin { + color:#AA0000; +} +#content .chatBot { + color:#D31141; +} +#content #chatList .chatBotErrorMessage { + color:red; +} +#content #chatList a { + color:#D31141; +} +#content #chatList .deleteSelected { + border-color:red; } \ No newline at end of file diff --git a/chat/css/shoutbox.css b/chat/css/shoutbox.css index d22a92a..1b7a634 100644 --- a/chat/css/shoutbox.css +++ b/chat/css/shoutbox.css @@ -90,6 +90,10 @@ font-size:0.9em; font-weight:bold; } +#ajaxChatContent #ajaxChatChatList span.customUser { + font-size:0.9em; + font-weight:bold; +} #ajaxChatContent #ajaxChatChatList span.moderator { font-size:0.9em; font-weight:bold; diff --git a/chat/css/subSilver.css b/chat/css/subSilver.css deleted file mode 100644 index 80f8b75..0000000 --- a/chat/css/subSilver.css +++ /dev/null @@ -1,117 +0,0 @@ -/* - * @package AJAX_Chat - * @author Sebastian Tschan - * @author Philip Nicolcev - * @copyright (c) Sebastian Tschan - * @license Modified MIT License - * @link https://blueimp.net/ajax/ - * - * Color palette inspired by phpBB style "subSilver": - * http://www.phpbb.com/ - */ - -@import url('global.css'); -@import url('fonts.css'); -@import url('print.css'); - -@media screen,projection,handheld { - - /* Status Icon */ - #content #statusIconContainer { - background-image: url('../img/loading-sprite.png'); - } - #content .statusContainerOff { - background-position: 0px 0px; - } - #content .statusContainerOn { - background-position: 0px -22px; - } - #content .statusContainerAlert { - background-position: 0px -44px; - } - - #loginContent { - background-color:#E5E5E5; - color:#000; - } - #loginContent h1 { - color:#006699; - } - #loginContent a { - color:#000; - } - #loginContent input, #loginContent select { - background-color:#FFF; - color:#000; - } - #loginContent #loginFormContainer #loginButton { - background-color:#F7F5F1; - color:#000; - } - #loginContent #errorContainer { - color:red; - } - - #content { - background-color:#E5E5E5; - color:#000; - } - #content h1 { - color:#006699; - } - #content a { - color:#000; - } - #content input, #content select, #content textarea { - background-color:#FFF; - color:#000; - } - #content #chatList, #content #onlineListContainer, #content #helpContainer, #content #settingsContainer, #content #colorCodesContainer, #content textarea{ - border-color:#006699; - background-color:#FFF; - } - #content #bbCodeContainer input, #content #logoutButton, #content #submitButton { - background-color:#F7F5F1; - color:#000; - } - #content #colorCodesContainer a { - border-color:black; - } - #content #optionsContainer input { - background-color:transparent; - } - #content .rowEven { - background-color:#DEE3E7; - } - #content .rowOdd { - background-color:#EFEFEF; - } - #content .guest { - color:gray; - } - #content .user { - color:#000; - } - #content .moderator { - color:#006600; - } - #content .admin { - color:#FFA34F; - } - #content .chatBot { - color:#DD6900; - } - #content #chatList .chatBotErrorMessage { - color:red; - } - #content #chatList a { - color:#006699; - } - #content #chatList .deleteSelected { - border-color:red; - } - #content #onlineListContainer h3, #content #helpContainer h3, #content #settingsContainer h3 { - background-color:#DEE3E7; - color:#006699; - } -} \ No newline at end of file diff --git a/chat/css/subblack2.css b/chat/css/subblack2.css deleted file mode 100644 index 3043754..0000000 --- a/chat/css/subblack2.css +++ /dev/null @@ -1,117 +0,0 @@ -/* - * @package AJAX_Chat - * @author Sebastian Tschan - * @author Philip Nicolcev - * @copyright (c) Sebastian Tschan - * @license Modified MIT License - * @link https://blueimp.net/ajax/ - * - * Color palette inspired by phpBB style "subblack2": - * http://www.phpbb.com/ - */ - -@import url('global.css'); -@import url('fonts.css'); -@import url('print.css'); - -@media screen,projection,handheld { - - /* Status Icon */ - #content #statusIconContainer { - background-image: url('../img/loading-sprite.png'); - } - #content .statusContainerOff { - background-position: 0px 0px; - } - #content .statusContainerOn { - background-position: 0px -22px; - } - #content .statusContainerAlert { - background-position: 0px -44px; - } - - #loginContent { - background-color:#000; - color:#FFFFCC; - } - #loginContent h1 { - color:#FFFFCC; - } - #loginContent a { - color:#FFFFCC; - } - #loginContent input, #loginContent select { - background-color:#212121; - color:#FFFFCC; - } - #loginContent #loginFormContainer #loginButton { - background-color:#212121; - color:#FFFFCC; - } - #loginContent #errorContainer { - color:red; - } - - #content { - background-color:#000; - color:#FFFFCC; - } - #content h1 { - color:#CC9900; - } - #content a { - color:#FFFFCC; - } - #content input, #content select, #content textarea { - background-color:#212121; - color:#FFFFCC; - } - #content #chatList, #content #onlineListContainer, #content #helpContainer, #content #settingsContainer, #content #bbCodeContainer, #content #colorCodesContainer, #content #emoticonsContainer { - border-color:gray; - background-color:#212121; - } - #content #bbCodeContainer input, #content #logoutButton, #content #submitButton { - background-color:#212121; - color:#FFFFCC; - } - #content #colorCodesContainer a { - border-color:black; - } - #content #optionsContainer input { - background-color:transparent; - } - #content .rowEven { - background-color:#212121; - } - #content .rowOdd { - background-color:#000; - } - #content .guest { - color:gray; - } - #content .user { - color:#FFFFCC; - } - #content .moderator { - color:#00AA00; - } - #content .admin { - color:red; - } - #content .chatBot { - color:#CC9900; - } - #content #chatList .chatBotErrorMessage { - color:red; - } - #content #chatList a { - color:#FFCC00; - } - #content #chatList .deleteSelected { - border-color:red; - } - #content #onlineListContainer h3, #content #helpContainer h3, #content #settingsContainer h3 { - background-color:#212121; - color:#FFCC00; - } -} \ No newline at end of file diff --git a/chat/css/vBulletin.css b/chat/css/vBulletin.css index 91a7e1a..43998a4 100644 --- a/chat/css/vBulletin.css +++ b/chat/css/vBulletin.css @@ -2,126 +2,130 @@ * @package AJAX_Chat * @author Sebastian Tschan * @author Philip Nicolcev - * @copyright (c) Sebastian Tschan - * @license Modified MIT License - * @link https://blueimp.net/ajax/ * * Color palette inspired by vBulletin style "Standard-Style": * http://www.vbulletin.com/ */ - @import url('global.css'); @import url('fonts.css'); @import url('print.css'); +@import url('custom.css'); -@media screen,projection,handheld { +/* Buttons */ +#content #bbCodeContainer input, #content #logoutButton, #content #submitButton, #loginForm #loginButton { + background-color:#7192A8; + color:#fff; + border: 0; +} +#content select, #loginForm select, #loginForm input, #content textarea { + background-color:#7192A8; + color:#fff; + border: 1px solid #2F4456; +} - /* Buttons */ - #content #bbCodeContainer input, #content #logoutButton, #content #submitButton, #loginForm #loginButton { - background-color:#7192A8; - color:#fff; - border: 0; - } - #content select, #loginForm select, #loginForm input, #content textarea { - background-color:#7192A8; - color:#fff; - border: 1px solid #2F4456; - } +/* Status Icon */ +#content #statusIconContainer { + background: url('../img/loading-sprite.png') no-repeat 0px 0px; +} +#content #statusIconContainer.waiting { + background-position: 0px -22px; +} +#content #statusIconContainer.retrying { + background-position: 0px -44px; +} - /* Status Icon */ - #content #statusIconContainer { - background-image: url('../img/loading-sprite.png'); - } - #content .statusContainerOff { - background-position: 0px 0px; - } - #content .statusContainerOn { - background-position: 0px -22px; - } - #content .statusContainerAlert { - background-position: 0px -44px; - } - - #loginContent { - background-color:#E1E1E2; - color:#000; - } - #loginContent h1 { - color:#3B5485; - } - #loginContent a { - color:#3B5485; - } - #loginContent #errorContainer { - color:red; - } - #content { - background-color:#E1E1E2; - color:#000; - } - #content #headlineContainer h1 { - color:#fff; - margin-left: 20px; - } - #content #headlineContainer { - top: 0; - left: 10px; - right: 10px; - background: #2F4456; - border-radius: 0px 0px 5px 5px; - } - #content #copyright, #content #copyright a { - color: white; - } - #content a { - color:#3B5485; - } - #content input, #content select, #content textarea { - background-color:#FFF; - color:#000; - } - #content #chatList, #content #onlineListContainer, #content #helpContainer, #content #settingsContainer, #content #colorCodesContainer { - border-color:#0B198C; - background-color:#FFF; - } - #content #colorCodesContainer a { - border-color:black; - } - #content #optionsContainer input { - background-color:transparent; - } - #content .rowEven { - background-color:#E1E4F2; - } - #content .rowOdd { - background-color:#F5F5FF; - } - #content .guest { - color:gray; - } - #content .user { - color:#000; - } - #content .moderator { - color:#00AA00; - } - #content .admin { - color:red; - } - #content .chatBot { - color:#3B5485; - } - #content #chatList .chatBotErrorMessage { - color:red; - } - #content #chatList a { - color:#3B5485; - } - #content #chatList .deleteSelected { - border-color:red; - } - #content #onlineListContainer h3, #content #helpContainer h3, #content #settingsContainer h3 { - background-color:#7192A8; - color:#FFF; +/* Other Theme Elements */ +.ajax-chat { + background-color:#E1E1E2; + color:#000; +} +.ajax-chat h1 { + color:#3B5485; +} +.ajax-chat a { + color:#3B5485; +} +#loginContent #errorContainer { + color:red; +} +#content #headline { + color:#fff; + padding-left: 20px; + top:0; + left:10px; + right:10px; + background:#2F4456; + border-radius: 0px 0px 5px 5px; +} +#content #copyright, #content #copyright a { + color:white; +} +#content input, #content select, #content textarea { + background-color:#FFF; + color:#000; +} +#content #chatList, #content #onlineListContainer, #content #helpContainer, #content #settingsContainer { + border-color:#0B198C; + background-color:#FFF; +} +.ajax-chat .popup { + background-color:#FFF; + border:1px solid #0B198C; +} +#content #colorCodesContainer a { + border-color:black; +} +#content #optionsContainer input { + background-color:transparent; +} +#content .rowEven, #helpList dl:nth-child(even), #settingsList dl:nth-child(even) { + background-color:#E1E4F2; +} +#content .rowOdd, #helpList dl:nth-child(odd), #settingsList dl:nth-child(odd) { + background-color:#F5F5FF; +} +#content #chatList .rowOdd.private { + background-color:#F8D0D0; +} +#content #chatList .rowEven.private { + background-color:#F8D9D0; +} +#content .guest { + color:gray; +} +#content .user { + color:#000; +} +#content .customUser { + color:#0b198c; +} +#content .moderator { + color:#00AA00; +} +#content .admin { + color:red; +} +#content .chatBot { + color:#3B5485; +} +#content #chatList .chatBotErrorMessage { + color:red; +} +#content #chatList a { + color:#3B5485; +} +#content #chatList .deleteSelected { + border-color:red; +} +#content #onlineListContainer h3, #content #helpContainer h3, #content #settingsContainer h3 { + background-color:#7192A8; + color:#FFF; +} + +@media (max-width: 700px) { + #content #headline { + left:5px; + right:5px; + padding-left:10px; } } \ No newline at end of file diff --git a/chat/img/audio.png b/chat/img/audio.png deleted file mode 100644 index fb37053..0000000 Binary files a/chat/img/audio.png and /dev/null differ diff --git a/chat/img/autoscroll.png b/chat/img/autoscroll.png deleted file mode 100644 index 7c313e5..0000000 Binary files a/chat/img/autoscroll.png and /dev/null differ diff --git a/chat/img/broken-image.png b/chat/img/broken-image.png new file mode 100644 index 0000000..2f2c184 Binary files /dev/null and b/chat/img/broken-image.png differ diff --git a/chat/img/buttons-sprite.png b/chat/img/buttons-sprite.png new file mode 100644 index 0000000..c7b3cb5 Binary files /dev/null and b/chat/img/buttons-sprite.png differ diff --git a/chat/img/help.png b/chat/img/help.png deleted file mode 100644 index c67c7a6..0000000 Binary files a/chat/img/help.png and /dev/null differ diff --git a/chat/img/playback.png b/chat/img/playback.png deleted file mode 100644 index 10102d8..0000000 Binary files a/chat/img/playback.png and /dev/null differ diff --git a/chat/img/settings.png b/chat/img/settings.png deleted file mode 100644 index cc91d65..0000000 Binary files a/chat/img/settings.png and /dev/null differ diff --git a/chat/img/users.png b/chat/img/users.png deleted file mode 100644 index bced28c..0000000 Binary files a/chat/img/users.png and /dev/null differ diff --git a/chat/index.php b/chat/index.php index a7e2fd0..d411a86 100644 --- a/chat/index.php +++ b/chat/index.php @@ -2,13 +2,14 @@ /* * @package AJAX_Chat * @author Sebastian Tschan + * @author Philip Nicolcev * @copyright (c) Sebastian Tschan * @license Modified MIT License * @link https://blueimp.net/ajax/ */ -// Suppress errors. -error_reporting(0); +// Suppress errors: +error_reporting(E_ALL); // Path to the chat directory: define('AJAX_CHAT_PATH', dirname($_SERVER['SCRIPT_FILENAME']).'/'); @@ -21,4 +22,3 @@ // Initialize the chat: $ajaxChat = new CustomAJAXChat(); -?> \ No newline at end of file diff --git a/chat/js/FABridge.js b/chat/js/FABridge.js index 5942457..e89180e 100644 --- a/chat/js/FABridge.js +++ b/chat/js/FABridge.js @@ -1,591 +1,591 @@ -/* -/* -Copyright 2006 Adobe Systems Incorporated - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), -to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, -and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE -OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -*/ - - -/* - * The Bridge class, responsible for navigating AS instances - */ -function FABridge(target,bridgeName) -{ - this.target = target; - this.remoteTypeCache = {}; - this.remoteInstanceCache = {}; - this.remoteFunctionCache = {}; - this.localFunctionCache = {}; - this.bridgeID = FABridge.nextBridgeID++; - this.name = bridgeName; - this.nextLocalFuncID = 0; - FABridge.instances[this.name] = this; - FABridge.idMap[this.bridgeID] = this; - - return this; -} - -// type codes for packed values -FABridge.TYPE_ASINSTANCE = 1; -FABridge.TYPE_ASFUNCTION = 2; - -FABridge.TYPE_JSFUNCTION = 3; -FABridge.TYPE_ANONYMOUS = 4; - -FABridge.initCallbacks = {} - -FABridge.argsToArray = function(args) -{ - var result = []; - for (var i = 0; i < args.length; i++) - { - result[i] = args[i]; - } - return result; -} - -function instanceFactory(objID) -{ - this.fb_instance_id = objID; - return this; -} - -function FABridge__invokeJSFunction(args) -{ - var funcID = args[0]; - var throughArgs = args.concat();//FABridge.argsToArray(arguments); - throughArgs.shift(); - - var bridge = FABridge.extractBridgeFromID(funcID); - return bridge.invokeLocalFunction(funcID, throughArgs); -} - -FABridge.addInitializationCallback = function(bridgeName, callback) -{ - var inst = FABridge.instances[bridgeName]; - if (inst != undefined) - { - callback.call(inst); - return; - } - - var callbackList = FABridge.initCallbacks[bridgeName]; - if(callbackList == null) - { - FABridge.initCallbacks[bridgeName] = callbackList = []; - } - - callbackList.push(callback); -} - -function FABridge__bridgeInitialized(bridgeName) { - var objects = document.getElementsByTagName("object"); - var ol = objects.length; - var activeObjects = []; - if (ol > 0) { - for (var i = 0; i < ol; i++) { - if (typeof objects[i].SetVariable != "undefined") { - activeObjects[activeObjects.length] = objects[i]; - } - } - } - var embeds = document.getElementsByTagName("embed"); - var el = embeds.length; - var activeEmbeds = []; - if (el > 0) { - for (var j = 0; j < el; j++) { - if (typeof embeds[j].SetVariable != "undefined") { - activeEmbeds[activeEmbeds.length] = embeds[j]; - } - } - } - var aol = activeObjects.length; - var ael = activeEmbeds.length; - var searchStr = "bridgeName="+ bridgeName; - if ((aol == 1 && !ael) || (aol == 1 && ael == 1)) { - FABridge.attachBridge(activeObjects[0], bridgeName); - } - else if (ael == 1 && !aol) { - FABridge.attachBridge(activeEmbeds[0], bridgeName); - } - else { - var flash_found = false; - if (aol > 1) { - for (var k = 0; k < aol; k++) { - var params = activeObjects[k].childNodes; - for (var l = 0; l < params.length; l++) { - var param = params[l]; - if (param.nodeType == 1 && param.tagName.toLowerCase() == "param" && param["name"].toLowerCase() == "flashvars" && param["value"].indexOf(searchStr) >= 0) { - FABridge.attachBridge(activeObjects[k], bridgeName); - flash_found = true; - break; - } - } - if (flash_found) { - break; - } - } - } - if (!flash_found && ael > 1) { - for (var m = 0; m < ael; m++) { - var flashVars = activeEmbeds[m].attributes.getNamedItem("flashVars").nodeValue; - if (flashVars.indexOf(searchStr) >= 0) { - FABridge.attachBridge(activeEmbeds[m], bridgeName); - break; - } - } - } - } - return true; -} - -// used to track multiple bridge instances, since callbacks from AS are global across the page. - -FABridge.nextBridgeID = 0; -FABridge.instances = {}; -FABridge.idMap = {}; -FABridge.refCount = 0; - -FABridge.extractBridgeFromID = function(id) -{ - var bridgeID = (id >> 16); - return FABridge.idMap[bridgeID]; -} - -FABridge.attachBridge = function(instance, bridgeName) -{ - var newBridgeInstance = new FABridge(instance, bridgeName); - - FABridge[bridgeName] = newBridgeInstance; - -/* FABridge[bridgeName] = function() { - return newBridgeInstance.root(); - } -*/ - var callbacks = FABridge.initCallbacks[bridgeName]; - if (callbacks == null) - { - return; - } - for (var i = 0; i < callbacks.length; i++) - { - callbacks[i].call(newBridgeInstance); - } - delete FABridge.initCallbacks[bridgeName] -} - -// some methods can't be proxied. You can use the explicit get,set, and call methods if necessary. - -FABridge.blockedMethods = -{ - toString: true, - get: true, - set: true, - call: true -}; - -FABridge.prototype = -{ - - -// bootstrapping - - root: function() - { - return this.deserialize(this.target.getRoot()); - }, -//clears all of the AS objects in the cache maps - releaseASObjects: function() - { - return this.target.releaseASObjects(); - }, -//clears a specific object in AS from the type maps - releaseNamedASObject: function(value) - { - if(typeof(value) != "object") - { - return false; - } - else - { - var ret = this.target.releaseNamedASObject(value.fb_instance_id); - return ret; - } - }, -//create a new AS Object - create: function(className) - { - return this.deserialize(this.target.create(className)); - }, - - - // utilities - - makeID: function(token) - { - return (this.bridgeID << 16) + token; - }, - - - // low level access to the flash object - -//get a named property from an AS object - getPropertyFromAS: function(objRef, propName) - { - if (FABridge.refCount > 0) - { - throw new Error("You are trying to call recursively into the Flash Player which is not allowed. In most cases the JavaScript setTimeout function, can be used as a workaround."); - } - else - { - FABridge.refCount++; - retVal = this.target.getPropFromAS(objRef, propName); - retVal = this.handleError(retVal); - FABridge.refCount--; - return retVal; - } - }, -//set a named property on an AS object - setPropertyInAS: function(objRef,propName, value) - { - if (FABridge.refCount > 0) - { - throw new Error("You are trying to call recursively into the Flash Player which is not allowed. In most cases the JavaScript setTimeout function, can be used as a workaround."); - } - else - { - FABridge.refCount++; - retVal = this.target.setPropInAS(objRef,propName, this.serialize(value)); - retVal = this.handleError(retVal); - FABridge.refCount--; - return retVal; - } - }, - -//call an AS function - callASFunction: function(funcID, args) - { - if (FABridge.refCount > 0) - { - throw new Error("You are trying to call recursively into the Flash Player which is not allowed. In most cases the JavaScript setTimeout function, can be used as a workaround."); - } - else - { - FABridge.refCount++; - retVal = this.target.invokeASFunction(funcID, this.serialize(args)); - retVal = this.handleError(retVal); - FABridge.refCount--; - return retVal; - } - }, -//call a method on an AS object - callASMethod: function(objID, funcName, args) - { - if (FABridge.refCount > 0) - { - throw new Error("You are trying to call recursively into the Flash Player which is not allowed. In most cases the JavaScript setTimeout function, can be used as a workaround."); - } - else - { - FABridge.refCount++; - args = this.serialize(args); - retVal = this.target.invokeASMethod(objID, funcName, args); - retVal = this.handleError(retVal); - FABridge.refCount--; - return retVal; - } - }, - - // responders to remote calls from flash - - //callback from flash that executes a local JS function - //used mostly when setting js functions as callbacks on events - invokeLocalFunction: function(funcID, args) - { - var result; - var func = this.localFunctionCache[funcID]; - - if(func != undefined) - { - result = this.serialize(func.apply(null, this.deserialize(args))); - } - - return result; - }, - - // Object Types and Proxies - - // accepts an object reference, returns a type object matching the obj reference. - getTypeFromName: function(objTypeName) - { - return this.remoteTypeCache[objTypeName]; - }, - //create an AS proxy for the given object ID and type - createProxy: function(objID, typeName) - { - var objType = this.getTypeFromName(typeName); - instanceFactory.prototype = objType; - var instance = new instanceFactory(objID); - this.remoteInstanceCache[objID] = instance; - return instance; - }, - //return the proxy associated with the given object ID - getProxy: function(objID) - { - return this.remoteInstanceCache[objID]; - }, - - // accepts a type structure, returns a constructed type - addTypeDataToCache: function(typeData) - { - newType = new ASProxy(this, typeData.name); - var accessors = typeData.accessors; - for (var i = 0; i < accessors.length; i++) - { - this.addPropertyToType(newType, accessors[i]); - } - - var methods = typeData.methods; - for (var i = 0; i < methods.length; i++) - { - if (FABridge.blockedMethods[methods[i]] == undefined) - { - this.addMethodToType(newType, methods[i]); - } - } - - - this.remoteTypeCache[newType.typeName] = newType; - return newType; - }, - - //add a property to a typename; used to define the properties that can be called on an AS proxied object - addPropertyToType: function(ty, propName) - { - var c = propName.charAt(0); - var setterName; - var getterName; - if(c >= "a" && c <= "z") - { - getterName = "get" + c.toUpperCase() + propName.substr(1); - setterName = "set" + c.toUpperCase() + propName.substr(1); - } - else - { - getterName = "get" + propName; - setterName = "set" + propName; - } - ty[setterName] = function(val) - { - this.bridge.setPropertyInAS(this.fb_instance_id, propName, val); - } - ty[getterName] = function() - { - return this.bridge.deserialize(this.bridge.getPropertyFromAS(this.fb_instance_id, propName)); - } - }, - - //add a method to a typename; used to define the methods that can be callefd on an AS proxied object - addMethodToType: function(ty, methodName) - { - ty[methodName] = function() - { - return this.bridge.deserialize(this.bridge.callASMethod(this.fb_instance_id, methodName, FABridge.argsToArray(arguments))); - } - }, - - // Function Proxies - - //returns the AS proxy for the specified function ID - getFunctionProxy: function(funcID) - { - var bridge = this; - if (this.remoteFunctionCache[funcID] == null) - { - this.remoteFunctionCache[funcID] = function() - { - bridge.callASFunction(funcID, FABridge.argsToArray(arguments)); - } - } - return this.remoteFunctionCache[funcID]; - }, - - //reutrns the ID of the given function; if it doesnt exist it is created and added to the local cache - getFunctionID: function(func) - { - if (func.__bridge_id__ == undefined) - { - func.__bridge_id__ = this.makeID(this.nextLocalFuncID++); - this.localFunctionCache[func.__bridge_id__] = func; - } - return func.__bridge_id__; - }, - - // serialization / deserialization - - serialize: function(value) - { - var result = {}; - - var t = typeof(value); - //primitives are kept as such - if (t == "number" || t == "string" || t == "boolean" || t == null || t == undefined) - { - result = value; - } - else if (value instanceof Array) - { - //arrays are serializesd recursively - result = []; - for (var i = 0; i < value.length; i++) - { - result[i] = this.serialize(value[i]); - } - } - else if (t == "function") - { - //js functions are assigned an ID and stored in the local cache - result.type = FABridge.TYPE_JSFUNCTION; - result.value = this.getFunctionID(value); - } - else if (value instanceof ASProxy) - { - result.type = FABridge.TYPE_ASINSTANCE; - result.value = value.fb_instance_id; - } - else - { - result.type = FABridge.TYPE_ANONYMOUS; - result.value = value; - } - - return result; - }, - - //on deserialization we always check the return for the specific error code that is used to marshall NPE's into JS errors - // the unpacking is done by returning the value on each pachet for objects/arrays - deserialize: function(packedValue) - { - - var result; - - var t = typeof(packedValue); - if (t == "number" || t == "string" || t == "boolean" || packedValue == null || packedValue == undefined) - { - result = this.handleError(packedValue); - } - else if (packedValue instanceof Array) - { - result = []; - for (var i = 0; i < packedValue.length; i++) - { - result[i] = this.deserialize(packedValue[i]); - } - } - else if (t == "object") - { - for(var i = 0; i < packedValue.newTypes.length; i++) - { - this.addTypeDataToCache(packedValue.newTypes[i]); - } - for (var aRefID in packedValue.newRefs) - { - this.createProxy(aRefID, packedValue.newRefs[aRefID]); - } - if (packedValue.type == FABridge.TYPE_PRIMITIVE) - { - result = packedValue.value; - } - else if (packedValue.type == FABridge.TYPE_ASFUNCTION) - { - result = this.getFunctionProxy(packedValue.value); - } - else if (packedValue.type == FABridge.TYPE_ASINSTANCE) - { - result = this.getProxy(packedValue.value); - } - else if (packedValue.type == FABridge.TYPE_ANONYMOUS) - { - result = packedValue.value; - } - } - return result; - }, - //increases the reference count for the given object - addRef: function(obj) - { - this.target.incRef(obj.fb_instance_id); - }, - //decrease the reference count for the given object and release it if needed - release:function(obj) - { - this.target.releaseRef(obj.fb_instance_id); - }, - - // check the given value for the components of the hard-coded error code : __FLASHERROR - // used to marshall NPE's into flash - - handleError: function(value) - { - if (typeof(value)=="string" && value.indexOf("__FLASHERROR")==0) - { - var myErrorMessage = value.split("||"); - if(FABridge.refCount > 0 ) - { - FABridge.refCount--; - } - throw new Error(myErrorMessage[1]); - return value; - } - else - { - return value; - } - } -}; - -// The root ASProxy class that facades a flash object - -ASProxy = function(bridge, typeName) -{ - this.bridge = bridge; - this.typeName = typeName; - return this; -}; -//methods available on each ASProxy object -ASProxy.prototype = -{ - get: function(propName) - { - return this.bridge.deserialize(this.bridge.getPropertyFromAS(this.fb_instance_id, propName)); - }, - - set: function(propName, value) - { - this.bridge.setPropertyInAS(this.fb_instance_id, propName, value); - }, - - call: function(funcName, args) - { - this.bridge.callASMethod(this.fb_instance_id, funcName, args); - }, - - addRef: function() { - this.bridge.addRef(this); - }, - - release: function() { - this.bridge.release(this); - } -}; +/* +/* +Copyright 2006 Adobe Systems Incorporated + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE +OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*/ + + +/* + * The Bridge class, responsible for navigating AS instances + */ +function FABridge(target,bridgeName) +{ + this.target = target; + this.remoteTypeCache = {}; + this.remoteInstanceCache = {}; + this.remoteFunctionCache = {}; + this.localFunctionCache = {}; + this.bridgeID = FABridge.nextBridgeID++; + this.name = bridgeName; + this.nextLocalFuncID = 0; + FABridge.instances[this.name] = this; + FABridge.idMap[this.bridgeID] = this; + + return this; +} + +// type codes for packed values +FABridge.TYPE_ASINSTANCE = 1; +FABridge.TYPE_ASFUNCTION = 2; + +FABridge.TYPE_JSFUNCTION = 3; +FABridge.TYPE_ANONYMOUS = 4; + +FABridge.initCallbacks = {} + +FABridge.argsToArray = function(args) +{ + var result = []; + for (var i = 0; i < args.length; i++) + { + result[i] = args[i]; + } + return result; +} + +function instanceFactory(objID) +{ + this.fb_instance_id = objID; + return this; +} + +function FABridge__invokeJSFunction(args) +{ + var funcID = args[0]; + var throughArgs = args.concat();//FABridge.argsToArray(arguments); + throughArgs.shift(); + + var bridge = FABridge.extractBridgeFromID(funcID); + return bridge.invokeLocalFunction(funcID, throughArgs); +} + +FABridge.addInitializationCallback = function(bridgeName, callback) +{ + var inst = FABridge.instances[bridgeName]; + if (inst != undefined) + { + callback.call(inst); + return; + } + + var callbackList = FABridge.initCallbacks[bridgeName]; + if(callbackList == null) + { + FABridge.initCallbacks[bridgeName] = callbackList = []; + } + + callbackList.push(callback); +} + +function FABridge__bridgeInitialized(bridgeName) { + var objects = document.getElementsByTagName("object"); + var ol = objects.length; + var activeObjects = []; + if (ol > 0) { + for (var i = 0; i < ol; i++) { + if (typeof objects[i].SetVariable != "undefined") { + activeObjects[activeObjects.length] = objects[i]; + } + } + } + var embeds = document.getElementsByTagName("embed"); + var el = embeds.length; + var activeEmbeds = []; + if (el > 0) { + for (var j = 0; j < el; j++) { + if (typeof embeds[j].SetVariable != "undefined") { + activeEmbeds[activeEmbeds.length] = embeds[j]; + } + } + } + var aol = activeObjects.length; + var ael = activeEmbeds.length; + var searchStr = "bridgeName="+ bridgeName; + if ((aol == 1 && !ael) || (aol == 1 && ael == 1)) { + FABridge.attachBridge(activeObjects[0], bridgeName); + } + else if (ael == 1 && !aol) { + FABridge.attachBridge(activeEmbeds[0], bridgeName); + } + else { + var flash_found = false; + if (aol > 1) { + for (var k = 0; k < aol; k++) { + var params = activeObjects[k].childNodes; + for (var l = 0; l < params.length; l++) { + var param = params[l]; + if (param.nodeType == 1 && param.tagName.toLowerCase() == "param" && param["name"].toLowerCase() == "flashvars" && param["value"].indexOf(searchStr) >= 0) { + FABridge.attachBridge(activeObjects[k], bridgeName); + flash_found = true; + break; + } + } + if (flash_found) { + break; + } + } + } + if (!flash_found && ael > 1) { + for (var m = 0; m < ael; m++) { + var flashVars = activeEmbeds[m].attributes.getNamedItem("flashVars").nodeValue; + if (flashVars.indexOf(searchStr) >= 0) { + FABridge.attachBridge(activeEmbeds[m], bridgeName); + break; + } + } + } + } + return true; +} + +// used to track multiple bridge instances, since callbacks from AS are global across the page. + +FABridge.nextBridgeID = 0; +FABridge.instances = {}; +FABridge.idMap = {}; +FABridge.refCount = 0; + +FABridge.extractBridgeFromID = function(id) +{ + var bridgeID = (id >> 16); + return FABridge.idMap[bridgeID]; +} + +FABridge.attachBridge = function(instance, bridgeName) +{ + var newBridgeInstance = new FABridge(instance, bridgeName); + + FABridge[bridgeName] = newBridgeInstance; + +/* FABridge[bridgeName] = function() { + return newBridgeInstance.root(); + } +*/ + var callbacks = FABridge.initCallbacks[bridgeName]; + if (callbacks == null) + { + return; + } + for (var i = 0; i < callbacks.length; i++) + { + callbacks[i].call(newBridgeInstance); + } + delete FABridge.initCallbacks[bridgeName] +} + +// some methods can't be proxied. You can use the explicit get,set, and call methods if necessary. + +FABridge.blockedMethods = +{ + toString: true, + get: true, + set: true, + call: true +}; + +FABridge.prototype = +{ + + +// bootstrapping + + root: function() + { + return this.deserialize(this.target.getRoot()); + }, +//clears all of the AS objects in the cache maps + releaseASObjects: function() + { + return this.target.releaseASObjects(); + }, +//clears a specific object in AS from the type maps + releaseNamedASObject: function(value) + { + if(typeof(value) != "object") + { + return false; + } + else + { + var ret = this.target.releaseNamedASObject(value.fb_instance_id); + return ret; + } + }, +//create a new AS Object + create: function(className) + { + return this.deserialize(this.target.create(className)); + }, + + + // utilities + + makeID: function(token) + { + return (this.bridgeID << 16) + token; + }, + + + // low level access to the flash object + +//get a named property from an AS object + getPropertyFromAS: function(objRef, propName) + { + if (FABridge.refCount > 0) + { + throw new Error("You are trying to call recursively into the Flash Player which is not allowed. In most cases the JavaScript setTimeout function, can be used as a workaround."); + } + else + { + FABridge.refCount++; + retVal = this.target.getPropFromAS(objRef, propName); + retVal = this.handleError(retVal); + FABridge.refCount--; + return retVal; + } + }, +//set a named property on an AS object + setPropertyInAS: function(objRef,propName, value) + { + if (FABridge.refCount > 0) + { + throw new Error("You are trying to call recursively into the Flash Player which is not allowed. In most cases the JavaScript setTimeout function, can be used as a workaround."); + } + else + { + FABridge.refCount++; + retVal = this.target.setPropInAS(objRef,propName, this.serialize(value)); + retVal = this.handleError(retVal); + FABridge.refCount--; + return retVal; + } + }, + +//call an AS function + callASFunction: function(funcID, args) + { + if (FABridge.refCount > 0) + { + throw new Error("You are trying to call recursively into the Flash Player which is not allowed. In most cases the JavaScript setTimeout function, can be used as a workaround."); + } + else + { + FABridge.refCount++; + retVal = this.target.invokeASFunction(funcID, this.serialize(args)); + retVal = this.handleError(retVal); + FABridge.refCount--; + return retVal; + } + }, +//call a method on an AS object + callASMethod: function(objID, funcName, args) + { + if (FABridge.refCount > 0) + { + throw new Error("You are trying to call recursively into the Flash Player which is not allowed. In most cases the JavaScript setTimeout function, can be used as a workaround."); + } + else + { + FABridge.refCount++; + args = this.serialize(args); + retVal = this.target.invokeASMethod(objID, funcName, args); + retVal = this.handleError(retVal); + FABridge.refCount--; + return retVal; + } + }, + + // responders to remote calls from flash + + //callback from flash that executes a local JS function + //used mostly when setting js functions as callbacks on events + invokeLocalFunction: function(funcID, args) + { + var result; + var func = this.localFunctionCache[funcID]; + + if(func != undefined) + { + result = this.serialize(func.apply(null, this.deserialize(args))); + } + + return result; + }, + + // Object Types and Proxies + + // accepts an object reference, returns a type object matching the obj reference. + getTypeFromName: function(objTypeName) + { + return this.remoteTypeCache[objTypeName]; + }, + //create an AS proxy for the given object ID and type + createProxy: function(objID, typeName) + { + var objType = this.getTypeFromName(typeName); + instanceFactory.prototype = objType; + var instance = new instanceFactory(objID); + this.remoteInstanceCache[objID] = instance; + return instance; + }, + //return the proxy associated with the given object ID + getProxy: function(objID) + { + return this.remoteInstanceCache[objID]; + }, + + // accepts a type structure, returns a constructed type + addTypeDataToCache: function(typeData) + { + newType = new ASProxy(this, typeData.name); + var accessors = typeData.accessors; + for (var i = 0; i < accessors.length; i++) + { + this.addPropertyToType(newType, accessors[i]); + } + + var methods = typeData.methods; + for (var i = 0; i < methods.length; i++) + { + if (FABridge.blockedMethods[methods[i]] == undefined) + { + this.addMethodToType(newType, methods[i]); + } + } + + + this.remoteTypeCache[newType.typeName] = newType; + return newType; + }, + + //add a property to a typename; used to define the properties that can be called on an AS proxied object + addPropertyToType: function(ty, propName) + { + var c = propName.charAt(0); + var setterName; + var getterName; + if(c >= "a" && c <= "z") + { + getterName = "get" + c.toUpperCase() + propName.substr(1); + setterName = "set" + c.toUpperCase() + propName.substr(1); + } + else + { + getterName = "get" + propName; + setterName = "set" + propName; + } + ty[setterName] = function(val) + { + this.bridge.setPropertyInAS(this.fb_instance_id, propName, val); + } + ty[getterName] = function() + { + return this.bridge.deserialize(this.bridge.getPropertyFromAS(this.fb_instance_id, propName)); + } + }, + + //add a method to a typename; used to define the methods that can be callefd on an AS proxied object + addMethodToType: function(ty, methodName) + { + ty[methodName] = function() + { + return this.bridge.deserialize(this.bridge.callASMethod(this.fb_instance_id, methodName, FABridge.argsToArray(arguments))); + } + }, + + // Function Proxies + + //returns the AS proxy for the specified function ID + getFunctionProxy: function(funcID) + { + var bridge = this; + if (this.remoteFunctionCache[funcID] == null) + { + this.remoteFunctionCache[funcID] = function() + { + bridge.callASFunction(funcID, FABridge.argsToArray(arguments)); + } + } + return this.remoteFunctionCache[funcID]; + }, + + //reutrns the ID of the given function; if it doesnt exist it is created and added to the local cache + getFunctionID: function(func) + { + if (func.__bridge_id__ == undefined) + { + func.__bridge_id__ = this.makeID(this.nextLocalFuncID++); + this.localFunctionCache[func.__bridge_id__] = func; + } + return func.__bridge_id__; + }, + + // serialization / deserialization + + serialize: function(value) + { + var result = {}; + + var t = typeof(value); + //primitives are kept as such + if (t == "number" || t == "string" || t == "boolean" || t == null || t == undefined) + { + result = value; + } + else if (value instanceof Array) + { + //arrays are serializesd recursively + result = []; + for (var i = 0; i < value.length; i++) + { + result[i] = this.serialize(value[i]); + } + } + else if (t == "function") + { + //js functions are assigned an ID and stored in the local cache + result.type = FABridge.TYPE_JSFUNCTION; + result.value = this.getFunctionID(value); + } + else if (value instanceof ASProxy) + { + result.type = FABridge.TYPE_ASINSTANCE; + result.value = value.fb_instance_id; + } + else + { + result.type = FABridge.TYPE_ANONYMOUS; + result.value = value; + } + + return result; + }, + + //on deserialization we always check the return for the specific error code that is used to marshall NPE's into JS errors + // the unpacking is done by returning the value on each pachet for objects/arrays + deserialize: function(packedValue) + { + + var result; + + var t = typeof(packedValue); + if (t == "number" || t == "string" || t == "boolean" || packedValue == null || packedValue == undefined) + { + result = this.handleError(packedValue); + } + else if (packedValue instanceof Array) + { + result = []; + for (var i = 0; i < packedValue.length; i++) + { + result[i] = this.deserialize(packedValue[i]); + } + } + else if (t == "object") + { + for(var i = 0; i < packedValue.newTypes.length; i++) + { + this.addTypeDataToCache(packedValue.newTypes[i]); + } + for (var aRefID in packedValue.newRefs) + { + this.createProxy(aRefID, packedValue.newRefs[aRefID]); + } + if (packedValue.type == FABridge.TYPE_PRIMITIVE) + { + result = packedValue.value; + } + else if (packedValue.type == FABridge.TYPE_ASFUNCTION) + { + result = this.getFunctionProxy(packedValue.value); + } + else if (packedValue.type == FABridge.TYPE_ASINSTANCE) + { + result = this.getProxy(packedValue.value); + } + else if (packedValue.type == FABridge.TYPE_ANONYMOUS) + { + result = packedValue.value; + } + } + return result; + }, + //increases the reference count for the given object + addRef: function(obj) + { + this.target.incRef(obj.fb_instance_id); + }, + //decrease the reference count for the given object and release it if needed + release:function(obj) + { + this.target.releaseRef(obj.fb_instance_id); + }, + + // check the given value for the components of the hard-coded error code : __FLASHERROR + // used to marshall NPE's into flash + + handleError: function(value) + { + if (typeof(value)=="string" && value.indexOf("__FLASHERROR")==0) + { + var myErrorMessage = value.split("||"); + if(FABridge.refCount > 0 ) + { + FABridge.refCount--; + } + throw new Error(myErrorMessage[1]); + return value; + } + else + { + return value; + } + } +}; + +// The root ASProxy class that facades a flash object + +ASProxy = function(bridge, typeName) +{ + this.bridge = bridge; + this.typeName = typeName; + return this; +}; +//methods available on each ASProxy object +ASProxy.prototype = +{ + get: function(propName) + { + return this.bridge.deserialize(this.bridge.getPropertyFromAS(this.fb_instance_id, propName)); + }, + + set: function(propName, value) + { + this.bridge.setPropertyInAS(this.fb_instance_id, propName, value); + }, + + call: function(funcName, args) + { + this.bridge.callASMethod(this.fb_instance_id, funcName, args); + }, + + addRef: function() { + this.bridge.addRef(this); + }, + + release: function() { + this.bridge.release(this); + } +}; diff --git a/chat/js/chat.js b/chat/js/chat.js index 9a93f5e..7b79f14 100644 --- a/chat/js/chat.js +++ b/chat/js/chat.js @@ -4,10 +4,10 @@ * @copyright (c) Sebastian Tschan * @license Modified MIT License * @link https://blueimp.net/ajax/ - * + * * The SELFHTML documentation has been used throughout this project: * http://selfhtml.org - * + * * Stylesheet and cookie methods have been inspired by Paul Sowden (A List Apart): * http://www.alistapart.com/stories/alternate/ */ @@ -85,21 +85,26 @@ var ajaxChat = { httpRequest: null, retryTimer: null, retryTimerDelay: null, - requestStatus: 'ok', + requestStatus: null, DOMbuffering: null, DOMbuffer: null, - DOMbufferRowClass: 'rowOdd', - - init: function(config, lang, initSettings, initStyle, initialize, initializeFunction, finalizeFunction) { + DOMbufferRowClass: null, + inUrlBBCode: null, + debug: null, + + init: function(config, lang, initSettings, initStyle, initialize, initializeFunction, finalizeFunction) { this.httpRequest = {}; this.usersList = []; this.userNamesList = []; this.userMenuCounter = 0; this.lastID = 0; this.localID = 0; - this.lang = lang; + this.lang = lang; + this.requestStatus = 'ok'; + this.DOMbufferRowClass = 'rowOdd'; + this.inUrlBBCode = false; this.initConfig(config); - this.initDirectories(); + this.initDirectories(); if(initSettings) { this.initSettings(); } @@ -112,7 +117,7 @@ var ajaxChat = { this.setLoadHandler(); } }, - + initConfig: function(config) { this.loginChannelID = config['loginChannelID']; this.loginChannelName = config['loginChannelName']; @@ -137,7 +142,7 @@ var ajaxChat = { this.chatBotName = config['chatBotName']; this.chatBotID = config['chatBotID']; this.allowUserMessageDelete = config['allowUserMessageDelete']; - this.inactiveTimeout = config['inactiveTimeout']; + this.inactiveTimeout = Math.max(config['inactiveTimeout'],2); this.privateChannelDiff = config['privateChannelDiff']; this.privateMessageDiff = config['privateMessageDiff']; this.showChannelMessages = config['showChannelMessages']; @@ -146,6 +151,7 @@ var ajaxChat = { this.socketServerHost = config['socketServerHost']; this.socketServerPort = config['socketServerPort']; this.socketServerChatID = config['socketServerChatID']; + this.debug = config['debug']; this.DOMbuffering = false; this.DOMbuffer = ""; this.retryTimerDelay = (this.inactiveTimeout*6000 - this.timerRate)/4 + this.timerRate; @@ -157,7 +163,7 @@ var ajaxChat = { this.dirs['sounds'] = this.baseURL+'sounds/'; this.dirs['flash'] = this.baseURL+'flash/'; }, - + initSettings: function() { var cookie = this.readCookie(this.sessionName + '_settings'), i, settingsArray, setting, key, value, number; @@ -209,21 +215,21 @@ var ajaxChat = { if(this.inArray(this.nonPersistentSettings, property)) { if(this.unusedSettings && this.unusedSettings[property]) { // Store the unusedSetting previously stored: - this.settings[property] = this.unusedSettings[property]; + this.settings[property] = this.unusedSettings[property]; } else { continue; } } settingsArray.push(property + '=' + this.encodeText(this.settings[property])); } - this.createCookie(this.sessionName + '_settings', settingsArray.join('&'), this.cookieExpiration); + this.createCookie(this.sessionName + '_settings', settingsArray.join('&'), this.cookieExpiration); } }, - + getSettings: function() { return this.settings; }, - + getSetting: function(key) { // Only return null if setting is null or undefined, not if it is false: for(var property in this.settings) { @@ -233,11 +239,11 @@ var ajaxChat = { } return null; }, - + setSetting: function(key, value) { this.settings[key] = value; }, - + initializeSettings: function() { if(this.settings['persistFontColor'] && this.settings['fontColor']) { // Set the inputField font color to the font color: @@ -246,17 +252,17 @@ var ajaxChat = { } } }, - - initialize: function() { + + initialize: function() { this.setUnloadHandler(); this.initializeDocumentNodes(); this.loadPageAttributes(); this.initEmoticons(); this.initColorCodes(); - this.initializeSettings(); + this.initializeSettings(); this.setSelectedStyle(); this.customInitialize(); - //preload the Alert icon (it can't display if there's no connection unless it's cached!) + // preload the Alert icon (it can't display if there's no connection unless it's cached!) this.setStatus('retrying'); if(typeof this.initializeFunction === 'function') { this.initializeFunction(); @@ -283,17 +289,17 @@ var ajaxChat = { } this.updateChat(params); }, - + setStartChatHandler: function() { if(this.dom['inputField']) { this.dom['inputField'].onfocus = function() { ajaxChat.startChat(); // Reset the onfocus event on first call: ajaxChat.dom['inputField'].onfocus = ''; - }; + }; } }, - + startChat: function() { this.chatStarted = true; if(this.dom['inputField'] && this.settings['autoFocus']) { @@ -306,24 +312,17 @@ var ajaxChat = { loadPageAttributes: function() { var htmlTag = document.getElementsByTagName('html')[0]; this.langCode = htmlTag.getAttribute('lang') ? htmlTag.getAttribute('lang') : 'en'; - this.baseDirection = htmlTag.getAttribute('dir') ? htmlTag.getAttribute('dir') : 'ltr'; + this.baseDirection = htmlTag.getAttribute('dir') ? htmlTag.getAttribute('dir') : 'ltr'; }, setLoadHandler: function() { + var self = this; // Make sure initialize() is called on page load: - var onload = window.onload; - if(typeof onload !== 'function') { - window.onload = function() { - ajaxChat.initialize(); - }; - } else { - window.onload = function() { - onload(); - ajaxChat.initialize(); - }; - } + this.addEvent(window,'load', function() { + self.initialize(); + }); }, - + setUnloadHandler: function() { // Make sure finalize() is called on page unload: var onunload = window.onunload; @@ -355,11 +354,12 @@ var ajaxChat = { domNode.innerHTML += str; } } catch(e) { + this.DOMbuffer = ''; this.addChatBotMessageToChatList('/error DOMSyntax '+id); this.updateChatlistView(); } }, - + initializeDocumentNodes: function() { this.dom = {}; for(var key in this.domIDs) { @@ -389,7 +389,7 @@ var ajaxChat = { } this.DOMbuffer = ""; }, - + initColorCodes: function() { if(this.dom['colorCodesContainer']) { this.DOMbuffer = ""; @@ -424,7 +424,7 @@ var ajaxChat = { } this.updateChat(params); }, - + updateChat: function(paramString) { var requestUrl = this.ajaxURL + '&lastID=' @@ -434,7 +434,7 @@ var ajaxChat = { } this.makeRequest(requestUrl,'GET',null); }, - + loadFlashInterface: function() { if(this.dom['flashInterfaceContainer']) { this.updateDOM( @@ -456,7 +456,7 @@ var ajaxChat = { FABridge.addInitializationCallback('ajaxChat', this.flashInterfaceLoadCompleteHandler); } }, - + flashInterfaceLoadCompleteHandler: function() { ajaxChat.initializeFlashInterface(); }, @@ -483,13 +483,13 @@ var ajaxChat = { } this.socket.connect(this.socketServerHost, this.socketServerPort); } catch(e) { - //alert(e); + this.debugMessage('socketConnect', e); } } clearTimeout(this.socketReconnectTimer); this.socketReconnectTimer = null; }, - + socketConnectHandler: function(event) { ajaxChat.socketIsConnected = true; // setTimeout is needed to avoid calling the flash interface recursively: @@ -503,7 +503,7 @@ var ajaxChat = { ajaxChat.updateChat(null); } }, - + socketDataHandler: function(event) { ajaxChat.socketUpdate(event.getData()); }, @@ -533,11 +533,11 @@ var ajaxChat = { +'"/>' ); } catch(e) { - //alert(e); + this.debugMessage('socketRegister', e); } } }, - + loadXML: function(str) { if(!arguments.callee.parser) { try { @@ -552,7 +552,7 @@ var ajaxChat = { arguments.callee.XMLDOM = new ActiveXObject('Microsoft.XMLDOM'); } arguments.callee.XMLDOM.loadXML(str); - return arguments.callee.XMLDOM; + return arguments.callee.XMLDOM; }; } else { // Safari, Konqueror: @@ -574,7 +574,7 @@ var ajaxChat = { } return arguments.callee.parser.parseFromString(str, 'text/xml'); }, - + socketUpdate: function(data) { var xmlDoc = this.loadXML(data); if(xmlDoc) { @@ -602,15 +602,15 @@ var ajaxChat = { this.settings['audioVolume'] = volume; try { if(!this.soundTransform) { - this.soundTransform = FABridge.ajaxChat.create('flash.media.SoundTransform'); + this.soundTransform = FABridge.ajaxChat.create('flash.media.SoundTransform'); } this.soundTransform.setVolume(volume); } catch(e) { - //alert(e); + this.debugMessage('setAudioVolume', e); } } }, - + loadSounds: function() { try { this.setAudioVolume(this.settings['audioVolume']); @@ -625,10 +625,10 @@ var ajaxChat = { sound.load(urlRequest); } } catch(e) { - alert(e); + this.debugMessage('loadSounds', e); } }, - + soundLoadCompleteHandler: function(event) { var sound = event.getTarget(); for(var key in ajaxChat.soundFiles) { @@ -645,7 +645,7 @@ var ajaxChat = { setTimeout(function() { ajaxChat.addChatBotMessageToChatList('/error SoundIO'); }, 0); setTimeout(ajaxChat.updateChatlistView, 1); }, - + soundPlayCompleteHandler: function(event) { // soundChannel event 'soundComplete' }, @@ -659,17 +659,21 @@ var ajaxChat = { // sndTransform:SoundTransform (default = null) return this.sounds[soundID].play(0, 0, this.soundTransform); } catch(e) { - //alert(e); + this.debugMessage('playSound', e); } } return null; }, - + playSoundOnNewMessage: function(dateObject, userID, userName, userRole, messageID, messageText, channelID, ip) { + var messageParts; if(this.settings['audio'] && this.sounds && this.lastID && !this.channelSwitch) { + if(this.customSoundOnNewMessage(dateObject, userID, userName, userRole, messageID, messageText, channelID, ip) === false) { + return; + } + messageParts = messageText.split(' ', 1); switch(userID) { case this.chatBotID: - var messageParts = messageText.split(' ', 1); switch(messageParts[0]) { case '/login': case '/channelEnter': @@ -688,10 +692,22 @@ var ajaxChat = { } break; case this.userID: - this.playSound(this.settings['soundSend']); + switch(messageParts[0]) { + case '/privmsgto': + this.playSound(this.settings['soundPrivate']); + break; + default: + this.playSound(this.settings['soundSend']); + } break; default: - this.playSound(this.settings['soundReceive']); + switch(messageParts[0]) { + case '/privmsg': + this.playSound(this.settings['soundPrivate']); + break; + default: + this.playSound(this.settings['soundReceive']); + } break; } } @@ -712,32 +728,20 @@ var ajaxChat = { setStatus: function(newStatus) { // status options are: ok, retrying, waiting - if (this.requestStatus !== 'retrying' || newStatus === 'ok') { + if (!(newStatus === 'waiting' && this.requestStatus === 'retrying')) { this.requestStatus = newStatus; } - - var statusIcon = document.getElementById('statusIconContainer'); - if (statusIcon) { - switch (this.requestStatus) { - case 'ok': - this.setClass(statusIcon, 'statusContainerOff'); - break; - case 'waiting': - this.setClass(statusIcon, 'statusContainerOn'); - break; - case 'retrying': - this.setClass(statusIcon, 'statusContainerAlert'); - break; - } + if(this.dom['statusIcon']) { + this.dom['statusIcon'].className = this.requestStatus; } }, - + forceNewRequest: function() { - ajaxChat.updateChat(null); + ajaxChat.updateChat(null); ajaxChat.setStatus('retrying'); }, - + getHttpRequest: function(identifier) { if(!this.httpRequest[identifier]) { if (window.XMLHttpRequest) { @@ -760,9 +764,10 @@ var ajaxChat = { }, makeRequest: function(url, method, data) { - var identifier; - this.setStatus('waiting'); - + var self = this, + identifier; + self.setStatus('waiting'); + try { if(data) { // Create up to 50 HTTPRequest objects: @@ -776,17 +781,17 @@ var ajaxChat = { identifier = 0; } //if the response takes longer than retryTimerDelay to give an OK status, abort the connection and start again. - this.retryTimer = setTimeout(ajaxChat.forceNewRequest, ajaxChat.retryTimerDelay); - - this.getHttpRequest(identifier).open(method, url, true); - this.getHttpRequest(identifier).onreadystatechange = function() { + self.retryTimer = setTimeout(ajaxChat.forceNewRequest, ajaxChat.retryTimerDelay); + + self.getHttpRequest(identifier).open(method, url, true); + self.getHttpRequest(identifier).onreadystatechange = function() { try { ajaxChat.handleResponse(identifier); } catch(e) { try { clearTimeout(ajaxChat.timer); } catch(e) { - //alert(e); + self.debugMessage('makeRequest::clearTimeout', e); } try { if(data) { @@ -795,30 +800,30 @@ var ajaxChat = { ajaxChat.updateChatlistView(); } } catch(e) { - //alert(e); + self.debugMessage('makeRequest::logRetry', e); } - try { + try { ajaxChat.timer = setTimeout(function() { ajaxChat.updateChat(null); }, ajaxChat.timerRate); } catch(e) { - //alert(e); + self.debugMessage('makeRequest::setTimeout', e); } } }; if(method === 'POST') { - this.getHttpRequest(identifier).setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); + self.getHttpRequest(identifier).setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); } - this.getHttpRequest(identifier).send(data); + self.getHttpRequest(identifier).send(data); } catch(e) { clearTimeout(this.timer); if(data) { - this.addChatBotMessageToChatList('/error ConnectionTimeout'); + self.addChatBotMessageToChatList('/error ConnectionTimeout'); ajaxChat.setStatus('retrying'); - this.updateChatlistView(); + self.updateChatlistView(); } - this.timer = setTimeout(function() { ajaxChat.updateChat(null); }, this.timerRate); + self.timer = setTimeout(function() { ajaxChat.updateChat(null); }, self.timerRate); } }, - + handleResponse: function(identifier) { var xmlDoc; if (this.getHttpRequest(identifier).readyState === 4) { @@ -835,7 +840,7 @@ var ajaxChat = { } else { this.addChatBotMessageToChatList('/error ConnectionStatus '+this.getHttpRequest(identifier).status); this.setStatus('retrying'); - this.updateChatlistView(); + this.updateChatlistView(); return false; } } @@ -846,7 +851,7 @@ var ajaxChat = { this.handleXML(xmlDoc); return true; }, - + handleXML: function(xmlDoc) { this.handleInfoMessages(xmlDoc.getElementsByTagName('info')); this.handleOnlineUsers(xmlDoc.getElementsByTagName('user')); @@ -868,10 +873,10 @@ var ajaxChat = { this.socketReconnectTimer = setTimeout(ajaxChat.socketConnect, 60000); } } - this.timer = setTimeout(function() {ajaxChat.updateChat(null);}, timeout); + this.timer = setTimeout(function() {ajaxChat.updateChat(null);}, timeout); } }, - + handleInfoMessages: function(infoNodes) { var infoType, infoData; for(var i=0; i= 0 ) { isInline = true; @@ -1078,12 +1086,12 @@ var ajaxChat = { ), false, true - ) + ); } this.showHide(menuID); this.dom['chatList'].scrollTop = this.dom['chatList'].scrollHeight; }, - + getUserNodeStringItems: function(encodedUserName, userID, isInline) { var menu; if(encodedUserName !== this.encodedUserName) { @@ -1175,19 +1183,19 @@ var ajaxChat = { menu += this.getCustomUserMenuItems(encodedUserName, userID); return menu; }, - + setOnlineListRowClasses: function() { if(this.dom['onlineList']) { - var node = this.dom['onlineList'].firstChild; + var node = this.dom['onlineList'].firstChild; var rowEven = false; while(node) { - this.setClass(node, (rowEven ? 'rowEven' : 'rowOdd')); + node.className = (rowEven ? 'rowEven' : 'rowOdd'); node = node.nextSibling; rowEven = !rowEven; } } }, - + clearChatList: function() { while(this.dom['chatList'].hasChildNodes()) { this.dom['chatList'].removeChild(this.dom['chatList'].firstChild); @@ -1210,7 +1218,7 @@ var ajaxChat = { } return arguments.callee.encodedChatBotName; }, - + addChatBotMessageToChatList: function(messageText) { this.addMessageToChatList( new Date(), @@ -1222,17 +1230,17 @@ var ajaxChat = { null ); }, - + addMessageToChatList: function(dateObject, userID, userName, userRole, messageID, messageText, channelID, ip) { // Prevent adding the same message twice: if(this.getMessageNode(messageID)) { return; - } + } if(!this.onNewMessage(dateObject, userID, userName, userRole, messageID, messageText, channelID, ip)) { return; } this.DOMbufferRowClass = this.DOMbufferRowClass === 'rowEven' ? 'rowOdd' : 'rowEven'; - this.DOMbuffer = this.DOMbuffer + + this.DOMbuffer = this.DOMbuffer + this.getChatListMessageString( dateObject, userID, userName, userRole, messageID, messageText, channelID, ip ); @@ -1243,15 +1251,17 @@ var ajaxChat = { }, getChatListMessageString: function(dateObject, userID, userName, userRole, messageID, messageText, channelID, ip) { - var rowClass = this.DOMbufferRowClass; - var userClass = this.getRoleClass(userRole); - var colon; + var rowClass = this.DOMbufferRowClass, + userClass = this.getRoleClass(userRole), + colon = ': '; if(messageText.indexOf('/action') === 0 || messageText.indexOf('/me') === 0 || messageText.indexOf('/privaction') === 0) { userClass += ' action'; colon = ' '; - } else { - colon = ': '; } + if (messageText.indexOf('/privmsg') === 0 || messageText.indexOf('/privmsgto') === 0 || messageText.indexOf('/privaction') === 0) { + rowClass += ' private'; + } + var dateTime = this.settings['dateFormat'] ? '' + this.formatDate(this.settings['dateFormat'], dateObject) + ' ' : ''; return '
this.settings['maxMessages']) { this.dom['chatList'].removeChild(this.dom['chatList'].firstChild); } } - + if(this.settings['autoScroll']) { - this.dom['chatList'].scrollTop = this.dom['chatList'].scrollHeight; + var self = this; + setTimeout(function() { self.scrollChatList(); }, 50); } }, - + + scrollChatList: function() { + this.dom['chatList'].scrollTop = this.dom['chatList'].scrollHeight; + }, + encodeText: function(text) { return encodeURIComponent(text); }, @@ -1459,7 +1477,7 @@ var ajaxChat = { this.encodeSpecialCharsCallback ); }, - + encodeSpecialCharsCallback: function(str) { switch(str) { case '&': @@ -1480,13 +1498,13 @@ var ajaxChat = { decodeSpecialChars: function(text) { var regExp = new RegExp('(&)|(<)|(>)|(')|(")', 'g'); - + return text.replace( regExp, this.decodeSpecialCharsCallback ); }, - + decodeSpecialCharsCallback: function(str) { switch(str) { case '&': @@ -1503,7 +1521,7 @@ var ajaxChat = { return str; } }, - + inArray: function(haystack, needle) { var i = haystack.length; while(i--) { @@ -1515,20 +1533,24 @@ var ajaxChat = { }, arraySearch: function(needle, haystack) { - var i = haystack.length; - while(i--) { - if(haystack[i] === needle) { - return i; + if (!Array.prototype.indexOf) { // IE<9 + var i = haystack.length; + while(i--) { + if(haystack[i] === needle) { + return i; + } } + return -1; + } else { + return haystack.indexOf(needle); } - return false; }, stripTags: function(str) { if (!arguments.callee.regExp) { arguments.callee.regExp = new RegExp('<\\/?[^>]+?>', 'g'); } - + return str.replace(arguments.callee.regExp, ''); }, @@ -1536,9 +1558,9 @@ var ajaxChat = { if (!arguments.callee.regExp) { arguments.callee.regExp = new RegExp('\\[\\/?[^\\]]+?\\]', 'g'); } - + return str.replace(arguments.callee.regExp, ''); - }, + }, escapeRegExp: function(text) { if (!arguments.callee.regExp) { @@ -1552,7 +1574,7 @@ var ajaxChat = { } return text.replace(arguments.callee.regExp, '\\$1'); }, - + addSlashes: function(text) { // Adding slashes in front of apostrophs and backslashes to ensure a valid JavaScript expression: return text.replace(/\\/g, '\\\\').replace(/\'/g, '\\\''); @@ -1564,8 +1586,8 @@ var ajaxChat = { }, formatDate: function(format, date) { - date = (date == null) ? new date() : date; - + date = (date === null) ? new date() : date; + return format .replace(/%Y/g, date.getFullYear()) .replace(/%m/g, this.addLeadingZero(date.getMonth()+1)) @@ -1574,7 +1596,7 @@ var ajaxChat = { .replace(/%i/g, this.addLeadingZero(date.getMinutes())) .replace(/%s/g, this.addLeadingZero(date.getSeconds())); }, - + addLeadingZero: function(number) { number = number.toString(); if(number.length < 2) { @@ -1585,7 +1607,7 @@ var ajaxChat = { getUserIDFromUserName: function(userName) { var index = this.arraySearch(userName, this.userNamesList); - if(index !== false) { + if(index !== -1) { return this.usersList[index]; } return null; @@ -1593,7 +1615,7 @@ var ajaxChat = { getUserNameFromUserID: function(userID) { var index = this.arraySearch(userID, this.usersList); - if(index !== false) { + if(index !== -1) { return this.userNamesList[index]; } return null; @@ -1611,14 +1633,41 @@ var ajaxChat = { return 'admin'; case 4: return 'chatBot'; + case 5: + return 'customUser'; default: return 'default'; } }, - - handleInputFieldKeyPress: function(event) { + + handleInputFieldKeyDown: function(event) { + var text, lastWord, i; + + // Enter key without shift should send messages if(event.keyCode === 13 && !event.shiftKey) { this.sendMessage(); + try { + event.preventDefault(); + } catch(e) { + event.returnValue = false; // IE<9 + } + return false; + } + // Tab should complete usernames + else if(event.keyCode === 9 && !event.shiftKey) { + text = this.dom['inputField'].value; + if(text) { + lastWord = text.match(/\w+/g).slice(-1)[0]; + + if (lastWord.length > 2) { + for (i = 0; i < this.userNamesList.length; i++) { + if(this.userNamesList[i].replace("(","").toLowerCase().indexOf(lastWord.toLowerCase()) === 0) { + this.dom['inputField'].value = text.replace(new RegExp(lastWord + '$'), this.userNamesList[i]); + break; + } + } + } + } try { event.preventDefault(); } catch(e) { @@ -1632,7 +1681,7 @@ var ajaxChat = { handleInputFieldKeyUp: function(event) { this.updateMessageLengthCounter(); }, - + updateMessageLengthCounter: function() { if(this.dom['messageLengthCounter']) { this.updateDOM( @@ -1643,7 +1692,7 @@ var ajaxChat = { ); } }, - + sendMessage: function(text) { text = text ? text : this.dom['inputField'].value; if(!text) { @@ -1655,14 +1704,14 @@ var ajaxChat = { var message = 'lastID=' + this.lastID + '&text=' - + this.encodeText(text); + + this.encodeText(text); this.makeRequest(this.ajaxURL,'POST',message); } this.dom['inputField'].value = ''; this.dom['inputField'].focus(); this.updateMessageLengthCounter(); }, - + parseInputMessage: function(text) { var textParts; if(text.charAt(0) === '/') { @@ -1689,7 +1738,7 @@ var ajaxChat = { } return text; }, - + assignFontColorToMessage: function(text) { return '[color='+this.settings['fontColor']+']'+text+'[/color]'; }, @@ -1717,7 +1766,7 @@ var ajaxChat = { } return text; }, - + parseIgnoreInputCommand: function(text, textParts) { var userName, ignoredUserNames = this.getIgnoredUserNames(), i; if(textParts.length > 1) { @@ -1765,12 +1814,12 @@ var ajaxChat = { } return this.ignoredUserNames; }, - + setIgnoredUserNames: function(ignoredUserNames) { this.ignoredUserNames = ignoredUserNames; this.setSetting('ignoredUserNames', ignoredUserNames.join(' ')); }, - + ignoreMessage: function(dateObject, userID, userName, userRole, messageID, messageText, channelID, ip) { var textParts; if(userID === this.chatBotID && messageText.charAt(0) === '/') { @@ -1782,7 +1831,7 @@ var ajaxChat = { case '/roll': userName = textParts[1]; break; - } + } } } if(this.inArray(this.getIgnoredUserNames(), userName)) { @@ -1794,8 +1843,8 @@ var ajaxChat = { deleteMessage: function(messageID) { var messageNode = this.getMessageNode(messageID), originalClass, nextSibling; if(messageNode) { - originalClass = this.getClass(messageNode); - this.setClass(messageNode, originalClass+' deleteSelected'); + originalClass = messageNode.className; + this.addClass(messageNode, 'deleteSelected'); if(confirm(this.lang['deleteMessageConfirm'])) { nextSibling = messageNode.nextSibling; try { @@ -1805,10 +1854,10 @@ var ajaxChat = { } this.updateChat('&delete='+messageID); } catch(e) { - this.setClass(messageNode, originalClass); + messageNode.className = originalClass; } } else { - this.setClass(messageNode, originalClass); + messageNode.className = originalClass; } } }, @@ -1820,35 +1869,45 @@ var ajaxChat = { } if(node) { previousNode = node.previousSibling; - rowEven = (previousNode && this.getClass(previousNode) === 'rowOdd') ? true : false; + rowEven = (previousNode && previousNode.className === 'rowOdd') ? true : false; while(node) { - this.setClass(node, (rowEven ? 'rowEven' : 'rowOdd')); + node.className = (rowEven ? 'rowEven' : 'rowOdd'); node = node.nextSibling; rowEven = !rowEven; } } }, - - getClass: function(node) { - if(typeof node.className !== 'undefined') { - return node.className; // IE + + addEvent: function(elem, type, eventHandle) { + if (!elem) + return; + if ( elem.addEventListener ) { + elem.addEventListener( type, eventHandle, false ); + } else if ( elem.attachEvent ) { + elem.attachEvent( "on" + type, eventHandle ); } else { - return node.getAttribute('class'); + elem["on"+type]=eventHandle; } }, - - setClass: function(node, className) { - if(typeof node.className !== 'undefined') { - node.className = className; // IE - } else { - node.setAttribute('class', className); + + addClass: function(node, theClass) { + if (!this.hasClass(node, theClass)) { + node.className += ' ' + theClass; } }, + removeClass: function(node, theClass) { + node.className = node.className.replace( new RegExp('(?:^|\\s)' + theClass + '(?!\\S)', 'g') , '' ); + }, + + hasClass: function(node, theClass) { + return node.className.match(new RegExp('\\b' + theClass + '\\b')); + }, + scriptLinkEncode: function(text) { return this.encodeText(this.addSlashes(this.decodeSpecialChars(text))); }, - + scriptLinkDecode: function(text) { return this.encodeSpecialChars(this.removeSlashes(this.decodeText(text))); }, @@ -1865,9 +1924,9 @@ var ajaxChat = { default: arguments.callee.utf8Decode = false; return value; - } + } } else if(arguments.callee.utf8Decode) { - return this.utf8Decode(value); + return this.utf8Decode(value); } else { return value; } @@ -1880,7 +1939,7 @@ var ajaxChat = { insertMessageWrapper: function(text) { this.insertText(this.getScriptLinkValue(text), true); }, - + switchChannel: function(channel) { if(!this.chatStarted) { this.clearChatList(); @@ -1890,11 +1949,11 @@ var ajaxChat = { this.requestTeaserContent(); return; } - clearTimeout(this.timer); + clearTimeout(this.timer); var message = 'lastID=' + this.lastID + '&channelName=' - + this.encodeText(channel); + + this.encodeText(channel); this.makeRequest(this.ajaxURL,'POST',message); if(this.dom['inputField'] && this.settings['autoFocus']) { this.dom['inputField'].focus(); @@ -1906,7 +1965,7 @@ var ajaxChat = { var message = 'logout=true'; this.makeRequest(this.ajaxURL,'POST',message); }, - + handleLogout: function(url) { window.location.href = url; }, @@ -1921,10 +1980,10 @@ var ajaxChat = { updateButton: function(setting, buttonID) { var node = document.getElementById(buttonID); if(node) { - this.setClass(node, (this.getSetting(setting) ? 'button' : 'button off')); + node.className = (this.getSetting(setting) ? 'button' : 'button off'); } }, - + showHide: function(id, styleDisplay, displayInline) { var node = document.getElementById(id); if(node) { @@ -1932,16 +1991,16 @@ var ajaxChat = { node.style.display = styleDisplay; } else { if(node.style.display === 'none') { - node.style.display = (displayInline ? 'inline' : 'block'); + node.style.display = (displayInline ? 'inline' : 'block'); } else { node.style.display = 'none'; } - } + } } }, setPersistFontColor: function(bool) { - this.settings['persistFontColor'] = bool; + this.settings['persistFontColor'] = bool; if(!this.settings['persistFontColor']) { this.settings['fontColor'] = null; if(this.dom['inputField']) { @@ -1966,16 +2025,16 @@ var ajaxChat = { this.insert('[color=' + color + ']', '[/color]'); } }, - + insertText: function(text, clearInputField) { if(clearInputField) { this.dom['inputField'].value = ''; } this.insert(text, ''); }, - + insertBBCode: function(bbCode) { - switch(bbCode) { + switch(bbCode) { case 'url': var url = prompt(this.lang['urlDialog'], 'http://'); if(url) @@ -1984,7 +2043,7 @@ var ajaxChat = { this.dom['inputField'].focus(); break; default: - this.insert('[' + bbCode + ']', '[/' + bbCode + ']'); + this.insert('[' + bbCode + ']', '[/' + bbCode + ']'); } }, @@ -2001,7 +2060,7 @@ var ajaxChat = { if (insText.length === 0) { range.move('character', -endTag.length); } else { - range.moveStart('character', startTag.length + insText.length + endTag.length); + range.moveStart('character', startTag.length + insText.length + endTag.length); } range.select(); } @@ -2035,7 +2094,7 @@ var ajaxChat = { + this.dom['inputField'].value.substr(pos); } }, - + replaceText: function(text) { try{ text = this.replaceLineBreaks(text); @@ -2046,20 +2105,20 @@ var ajaxChat = { text = this.replaceHyperLinks(text); text = this.replaceEmoticons(text); } - text = this.breakLongWords(text); + text = this.breakLongWords(text); text = this.replaceCustomText(text); } catch(e){ - //alert(e); + this.debugMessage('replaceText', e); } return text; }, - + replaceCommands: function(text) { try { if(text.charAt(0) !== '/') { return text; } - var textParts = text.split(' '); + var textParts = text.split(' '); switch(textParts[0]) { case '/login': return this.replaceCommandLogin(textParts); @@ -2130,7 +2189,7 @@ var ajaxChat = { return this.replaceCustomCommands(text, textParts); } } catch(e) { - //alert(e); + this.debugMessage('replaceCommands', e); } return text; }, @@ -2138,7 +2197,7 @@ var ajaxChat = { replaceCommandLogin: function(textParts) { return '' + this.lang['login'].replace(/%s/, textParts[1]) - + ''; + + ''; }, replaceCommandLogout: function(textParts) { @@ -2147,21 +2206,21 @@ var ajaxChat = { type = textParts[2]; return '' + this.lang['logout' + type].replace(/%s/, textParts[1]) - + ''; + + ''; }, - + replaceCommandChannelEnter: function(textParts) { return '' + this.lang['channelEnter'].replace(/%s/, textParts[1]) - + ''; + + ''; }, - + replaceCommandChannelLeave: function(textParts) { return '' + this.lang['channelLeave'].replace(/%s/, textParts[1]) - + ''; + + ''; }, - + replaceCommandPrivMsg: function(textParts) { var privMsgText = textParts.slice(1).join(' '); privMsgText = this.replaceBBCode(privMsgText); @@ -2172,7 +2231,7 @@ var ajaxChat = { + ' ' + privMsgText; }, - + replaceCommandPrivMsgTo: function(textParts) { var privMsgText = textParts.slice(2).join(' '); privMsgText = this.replaceBBCode(privMsgText); @@ -2183,7 +2242,7 @@ var ajaxChat = { + ' ' + privMsgText; }, - + replaceCommandPrivAction: function(textParts) { var privActionText = textParts.slice(1).join(' '); privActionText = this.replaceBBCode(privActionText); @@ -2195,7 +2254,7 @@ var ajaxChat = { + this.lang['privmsg'] + ' '; }, - + replaceCommandPrivActionTo: function(textParts) { var privActionText = textParts.slice(2).join(' '); privActionText = this.replaceBBCode(privActionText); @@ -2205,9 +2264,9 @@ var ajaxChat = { + privActionText + ' ' + this.lang['privmsgto'].replace(/%s/, textParts[1]) - + ' '; + + ' '; }, - + replaceCommandAction: function(textParts) { var actionText = textParts.slice(1).join(' '); actionText = this.replaceBBCode(actionText); @@ -2215,9 +2274,9 @@ var ajaxChat = { actionText = this.replaceEmoticons(actionText); return '' + actionText - + ''; + + ''; }, - + replaceCommandInvite: function(textParts) { var inviteText = this.lang['invite'] .replace(/%s/, textParts[1]) @@ -2233,99 +2292,99 @@ var ajaxChat = { ); return '' + inviteText - + ''; + + ''; }, - + replaceCommandInviteTo: function(textParts) { var inviteText = this.lang['inviteto'] .replace(/%s/, textParts[1]) .replace(/%s/, textParts[2]); return '' + inviteText - + ''; + + ''; }, - + replaceCommandUninvite: function(textParts) { var uninviteText = this.lang['uninvite'] .replace(/%s/, textParts[1]) .replace(/%s/, textParts[2]); return '' + uninviteText - + ''; + + ''; }, - + replaceCommandUninviteTo: function(textParts) { var uninviteText = this.lang['uninviteto'] .replace(/%s/, textParts[1]) .replace(/%s/, textParts[2]); return '' + uninviteText - + ''; + + ''; }, - + replaceCommandQueryOpen: function(textParts) { return '' + this.lang['queryOpen'].replace(/%s/, textParts[1]) - + ''; + + ''; }, - + replaceCommandQueryClose: function(textParts) { return '' + this.lang['queryClose'].replace(/%s/, textParts[1]) - + ''; + + ''; }, - + replaceCommandIgnoreAdded: function(textParts) { return '' + this.lang['ignoreAdded'].replace(/%s/, textParts[1]) - + ''; + + ''; }, - + replaceCommandIgnoreRemoved: function(textParts) { return '' + this.lang['ignoreRemoved'].replace(/%s/, textParts[1]) - + ''; + + ''; }, - + replaceCommandIgnoreList: function(textParts) { return '' + this.lang['ignoreList'] + ' ' + this.getInlineUserMenu(textParts.slice(1)) - + ''; + + ''; }, - + replaceCommandIgnoreListEmpty: function(textParts) { return '' + this.lang['ignoreListEmpty'] - + ''; + + ''; }, - + replaceCommandKick: function(textParts) { return '' + this.lang['logoutKicked'].replace(/%s/, textParts[1]) - + ''; + + ''; }, - + replaceCommandWho: function(textParts) { return '' + this.lang['who'] + ' ' + this.getInlineUserMenu(textParts.slice(1)) - + ''; + + ''; }, replaceCommandWhoChannel: function(textParts) { return '' + this.lang['whoChannel'].replace(/%s/, textParts[1]) + ' ' + this.getInlineUserMenu(textParts.slice(2)) - + ''; + + ''; }, - + replaceCommandWhoEmpty: function(textParts) { return '' + this.lang['whoEmpty'] - + ''; + + ''; }, - + replaceCommandList: function(textParts) { var channels = textParts.slice(1); var listChannels = []; @@ -2345,9 +2404,9 @@ var ajaxChat = { return '' + this.lang['list'] + ' ' + listChannels.join(', ') - + ''; + + ''; }, - + replaceCommandBans: function(textParts) { var users = textParts.slice(1); var listUsers = []; @@ -2365,26 +2424,26 @@ var ajaxChat = { return '' + this.lang['bans'] + ' ' + listUsers.join(', ') - + ''; + + ''; }, - + replaceCommandBansEmpty: function(textParts) { return '' + this.lang['bansEmpty'] - + ''; + + ''; }, - + replaceCommandUnban: function(textParts) { return '' + this.lang['unban'].replace(/%s/, textParts[1]) - + ''; + + ''; }, - + replaceCommandWhois: function(textParts) { return '' + this.lang['whois'].replace(/%s/, textParts[1]) + ' ' + textParts[2] - + ''; + + ''; }, replaceCommandWhereis: function(textParts) { @@ -2399,24 +2458,24 @@ var ajaxChat = { + textParts[2] + '' ) - + ''; + + ''; }, - + replaceCommandRoll: function(textParts) { var rollText = this.lang['roll'].replace(/%s/, textParts[1]); rollText = rollText.replace(/%s/, textParts[2]); rollText = rollText.replace(/%s/, textParts[3]); return '' + rollText - + ''; + + ''; }, - + replaceCommandNick: function(textParts) { return '' + this.lang['nick'].replace(/%s/, textParts[1]).replace(/%s/, textParts[2]) - + ''; + + ''; }, - + replaceCommandError: function(textParts) { var errorMessage = this.lang['error'+textParts[1]]; if(!errorMessage) { @@ -2426,7 +2485,7 @@ var ajaxChat = { } return '' + errorMessage - + ''; + + ''; }, getInlineUserMenu: function(users) { @@ -2459,7 +2518,7 @@ var ajaxChat = { var openTags, closeTags, regExpOpenTags = /<[^>\/]+?>/gm, regExpCloseTags = /<\/[^>]+?>/gm; - + openTags = str.match(regExpOpenTags); closeTags = str.match(regExpCloseTags); // Return true if the number of tags doesn't match: @@ -2470,32 +2529,32 @@ var ajaxChat = { } return false; }, - + breakLongWords: function(text) { var newText, charCounter, currentChar, withinTag, withinEntity, i; - + if(!this.settings['wordWrap']) return text; - + newText = ''; charCounter = 0; - + for(i=0; i): if(i>5 && text.substr(i-5,4) === '
0 && text.charAt(i-1) === '>') { withinTag = false; // Reset the charCounter after newline tags (
): if(i>4 && text.substr(i-5,4) === '
0 && text.charAt(i-1) === ';') { @@ -2503,7 +2562,7 @@ var ajaxChat = { // We only increase the charCounter once for the whole entiy: charCounter++; } - + if(!withinTag && !withinEntity) { // Reset the charCounter if we encounter a word boundary: if(currentChar === ' ' || currentChar === '\n' || currentChar === '\t') { @@ -2517,14 +2576,14 @@ var ajaxChat = { newText += '​'; charCounter = 0; } - } + } // Add the current char to the text: newText += currentChar; } - + return newText; }, - + replaceBBCode: function(text) { if(!this.settings['bbCode']) { // If BBCode is disabled, just strip the text from BBCode tags: @@ -2532,11 +2591,11 @@ var ajaxChat = { } // Remove the BBCode tags: return text.replace( - /\[(\w+)(?:=([^<>]*?))?\](.+?)\[\/\1\]/gm, + /\[(\w+)(?:=([^<>]*?))?\](.+?)\[\/\1\]/gm, this.replaceBBCodeCallback ); }, - + replaceBBCodeCallback: function(str, p1, p2, p3) { // Only replace predefined BBCode tags: if(!ajaxChat.inArray(ajaxChat.bbCodeTags, p1)) { @@ -2545,7 +2604,7 @@ var ajaxChat = { // Avoid invalid XHTML (unclosed tags): if(ajaxChat.containsUnclosedTags(p3)) { return str; - } + } switch(p1) { case 'color': return ajaxChat.replaceBBCodeColor(p3, p2); @@ -2568,7 +2627,7 @@ var ajaxChat = { if(this.settings['bbCodeColors']) { // Only allow predefined color codes: if(!attribute || !this.inArray(ajaxChat.colorCodes, attribute)) - return content; + return content; return '' + this.replaceBBCode(content) @@ -2576,9 +2635,9 @@ var ajaxChat = { } return content; }, - + replaceBBCodeUrl: function(content, attribute) { - var url, regExpUrl; + var url, regExpUrl, link; if(attribute) url = attribute.replace(/\s/gm, this.encodeText(' ')); else @@ -2589,15 +2648,19 @@ var ajaxChat = { ); if(!url || !url.match(regExpUrl)) return content; - return '' + this.replaceBBCode(content) + ''; + this.inUrlBBCode = false; + return link; }, - + replaceBBCodeImage: function(url) { - var regExpUrl, maxWidth, maxHeight; + var regExpUrl, maxWidth, maxHeight, link; if(this.settings['bbCodeImages']) { regExpUrl = new RegExp( this.regExpMediaUrl, @@ -2605,19 +2668,24 @@ var ajaxChat = { ); if(!url || !url.match(regExpUrl)) return url; - url = url.replace(/\s/gm, this.encodeText(' ')); + url = this.stripTags(url.replace(/\s/gm, this.encodeText(' '))); maxWidth = this.dom['chatList'].offsetWidth-50; maxHeight = this.dom['chatList'].offsetHeight-50; - return '' - +''; + link = ''; + if(!this.inUrlBBCode) { + link = '' + + link + + ''; + } + return link; } return url; }, @@ -2640,13 +2708,13 @@ var ajaxChat = { + this.replaceBBCode(content.replace(/\t|(?: )/gm, '  ')) + ''; }, - + replaceBBCodeUnderline: function(content) { return '' + this.replaceBBCode(content) + ''; }, - + replaceHyperLinks: function(text) { var regExp; if(!this.settings['hyperLinks']) { @@ -2699,11 +2767,11 @@ var ajaxChat = { arguments.callee.regExp = new RegExp(regExpStr, 'gm'); } return text.replace( - arguments.callee.regExp, + arguments.callee.regExp, this.replaceEmoticonsCallback ); }, - + replaceEmoticonsCallback: function(str, p1, p2, p3) { if (!arguments.callee.regExp) { arguments.callee.regExp = new RegExp('(="[^"]*$)|(&[^;]*$)', ''); @@ -2711,9 +2779,9 @@ var ajaxChat = { // Avoid replacing emoticons in tag attributes or XHTML entities: if(p1.match(arguments.callee.regExp)) { return str; - } + } if(p2) { - var index = ajaxChat.arraySearch(p2, ajaxChat.emoticonCodes); + var index = ajaxChat.arraySearch(p2, ajaxChat.emoticonCodes); return ajaxChat.replaceEmoticons(p1) + '_config = &$config; - - // Initialize custom configuration settings: - $this->initCustomConfig(); - } - - function initRequestVars() { - $this->_requestVars = array(); - $this->_requestVars['ajax'] = isset($_REQUEST['ajax']) ? true : false; - $this->_requestVars['userID'] = isset($_REQUEST['userID']) ? (int)$_REQUEST['userID'] : null; - $this->_requestVars['userName'] = isset($_REQUEST['userName']) ? $_REQUEST['userName'] : null; - $this->_requestVars['channelID'] = isset($_REQUEST['channelID']) ? (int)$_REQUEST['channelID'] : null; - $this->_requestVars['channelName'] = isset($_REQUEST['channelName']) ? $_REQUEST['channelName'] : null; - $this->_requestVars['text'] = isset($_POST['text']) ? $_POST['text'] : null; - $this->_requestVars['lastID'] = isset($_REQUEST['lastID']) ? (int)$_REQUEST['lastID'] : 0; - $this->_requestVars['login'] = isset($_REQUEST['login']) ? true : false; - $this->_requestVars['logout'] = isset($_REQUEST['logout']) ? true : false; - $this->_requestVars['password'] = isset($_REQUEST['password']) ? $_REQUEST['password'] : null; - $this->_requestVars['view'] = isset($_REQUEST['view']) ? $_REQUEST['view'] : null; - $this->_requestVars['year'] = isset($_REQUEST['year']) ? (int)$_REQUEST['year'] : null; - $this->_requestVars['month'] = isset($_REQUEST['month']) ? (int)$_REQUEST['month'] : null; - $this->_requestVars['day'] = isset($_REQUEST['day']) ? (int)$_REQUEST['day'] : null; - $this->_requestVars['hour'] = isset($_REQUEST['hour']) ? (int)$_REQUEST['hour'] : null; - $this->_requestVars['search'] = isset($_REQUEST['search']) ? $_REQUEST['search'] : null; - $this->_requestVars['shoutbox'] = isset($_REQUEST['shoutbox']) ? true : false; - $this->_requestVars['getInfos'] = isset($_REQUEST['getInfos']) ? $_REQUEST['getInfos'] : null; - $this->_requestVars['lang'] = isset($_REQUEST['lang']) ? $_REQUEST['lang'] : null; - $this->_requestVars['delete'] = isset($_REQUEST['delete']) ? (int)$_REQUEST['delete'] : null; - - // Initialize custom request variables: - $this->initCustomRequestVars(); - - // Remove slashes which have been added to user input strings if magic_quotes_gpc is On: - if(get_magic_quotes_gpc()) { - // It is safe to remove the slashes as we escape user data ourself - array_walk( - $this->_requestVars, - create_function( - '&$value, $key', - 'if(is_string($value)) $value = stripslashes($value);' - ) - ); - } - } - - function initDataBaseConnection() { - // Create a new database object: - $this->db = new AJAXChatDataBase( - $this->_config['dbConnection'] - ); - // Use a new database connection if no existing is given: - if(!$this->_config['dbConnection']['link']) { - // Connect to the database server: - $this->db->connect($this->_config['dbConnection']); - if($this->db->error()) { - echo $this->db->getError(); - die(); - } - // Select the database: - $this->db->select($this->_config['dbConnection']['name']); - if($this->db->error()) { - echo $this->db->getError(); - die(); - } - } - // Unset the dbConnection array for safety purposes: - unset($this->_config['dbConnection']); - } - - function getDataBaseTable($table) { - return ($this->db->getName() ? '`'.$this->db->getName().'`.'.$this->getConfig('dbTableNames',$table) : $this->getConfig('dbTableNames',$table)); - } - - function initSession() { - // Start the PHP session (if not already started): - $this->startSession(); - - if($this->isLoggedIn()) { - // Logout if we receive a logout request, the chat has been closed or the userID could not be revalidated: - if($this->getRequestVar('logout') || !$this->isChatOpen() || !$this->revalidateUserID()) { - $this->logout(); - return; - } - // Logout if the Session IP is not the same when logged in and ipCheck is enabled: - if($this->getConfig('ipCheck') && ($this->getSessionIP() === null || $this->getSessionIP() != $_SERVER['REMOTE_ADDR'])) { - $this->logout('IP'); - return; - } - } else if( - // Login if auto-login enabled or a login, userName or shoutbox parameter is given: - $this->getConfig('forceAutoLogin') || - $this->getRequestVar('login') || - $this->getRequestVar('userName') || - $this->getRequestVar('shoutbox') - ) { - $this->login(); - } - - // Initialize the view: - $this->initView(); - - if($this->getView() == 'chat') { - $this->initChatViewSession(); - } else if($this->getView() == 'logs') { - $this->initLogsViewSession(); - } - - if(!$this->getRequestVar('ajax') && !headers_sent()) { - // Set style cookie: - $this->setStyle(); - // Set langCode cookie: - $this->setLangCodeCookie(); - } - - $this->initCustomSession(); - } - - function initLogsViewSession() { - if($this->getConfig('socketServerEnabled')) { - if(!$this->getSessionVar('logsViewSocketAuthenticated')) { - $this->updateLogsViewSocketAuthentication(); - $this->setSessionVar('logsViewSocketAuthenticated', true); - } - } - } - - function updateLogsViewSocketAuthentication() { - if($this->getUserRole() != AJAX_CHAT_ADMIN) { - $channels = array(); - foreach($this->getChannels() as $channel) { - if($this->getConfig('logsUserAccessChannelList') && !in_array($channel, $this->getConfig('logsUserAccessChannelList'))) { - continue; - } - array_push($channels, $channel); - } - array_push($channels, $this->getPrivateMessageID()); - array_push($channels, $this->getPrivateChannelID()); - } else { - // The channelID "ALL" authenticates for all channels: - $channels = array('ALL'); - } - $this->updateSocketAuthentication( - $this->getUserID(), - $this->getSocketRegistrationID(), - $channels - ); - } - - function initChatViewSession() { - // If channel is not null we are logged in to the chat view: - if($this->getChannel() !== null) { - // Check if the current user has been logged out due to inactivity: - if(!$this->isUserOnline()) { - $this->logout(); - return; - } - if($this->getRequestVar('ajax')) { - $this->initChannel(); - $this->updateOnlineStatus(); - $this->checkAndRemoveInactive(); - } - } else { - if($this->getRequestVar('ajax')) { - // Set channel, insert login messages and add to online list on first ajax request in chat view: - $this->chatViewLogin(); - } - } - } - - function isChatOpen() { - if($this->getUserRole() == AJAX_CHAT_ADMIN) - return true; - if($this->getConfig('chatClosed')) - return false; - $time = time(); - if($this->getConfig('timeZoneOffset') !== null) { - // Subtract the server timezone offset and add the config timezone offset: - $time -= date('Z', $time); - $time += $this->getConfig('timeZoneOffset'); - } - // Check the opening hours: - if($this->getConfig('openingHour') < $this->getConfig('closingHour')) - { - if(($this->getConfig('openingHour') > date('G', $time)) || ($this->getConfig('closingHour') <= date('G', $time))) - return false; - } - else - { - if(($this->getConfig('openingHour') > date('G', $time)) && ($this->getConfig('closingHour') <= date('G', $time))) - return false; - } - // Check the opening weekdays: - if(!in_array(date('w', $time), $this->getConfig('openingWeekDays'))) - return false; - return true; - } - - function handleRequest() { - if($this->getRequestVar('ajax')) { - if($this->isLoggedIn()) { - // Parse info requests (for current userName, etc.): - $this->parseInfoRequests(); - - // Parse command requests (e.g. message deletion): - $this->parseCommandRequests(); - - // Parse message requests: - $this->initMessageHandling(); - } - // Send chat messages and online user list in XML format: - $this->sendXMLMessages(); - } else { - // Display XHTML content for non-ajax requests: - $this->sendXHTMLContent(); - } - } - - function parseCommandRequests() { - if($this->getRequestVar('delete') !== null) { - $this->deleteMessage($this->getRequestVar('delete')); - } - } - - function parseInfoRequests() { - if($this->getRequestVar('getInfos')) { - $infoRequests = explode(',', $this->getRequestVar('getInfos')); - foreach($infoRequests as $infoRequest) { - $this->parseInfoRequest($infoRequest); - } - } - } - - function parseInfoRequest($infoRequest) { - switch($infoRequest) { - case 'userID': - $this->addInfoMessage($this->getUserID(), 'userID'); - break; - case 'userName': - $this->addInfoMessage($this->getUserName(), 'userName'); - break; - case 'userRole': - $this->addInfoMessage($this->getUserRole(), 'userRole'); - break; - case 'channelID': - $this->addInfoMessage($this->getChannel(), 'channelID'); - break; - case 'channelName': - $this->addInfoMessage($this->getChannelName(), 'channelName'); - break; - case 'socketRegistrationID': - $this->addInfoMessage($this->getSocketRegistrationID(), 'socketRegistrationID'); - break; - default: - $this->parseCustomInfoRequest($infoRequest); - } - } - - function sendXHTMLContent() { - $httpHeader = new AJAXChatHTTPHeader($this->getConfig('contentEncoding'), $this->getConfig('contentType')); - - $template = new AJAXChatTemplate($this, $this->getTemplateFileName(), $httpHeader->getContentType()); - - // Send HTTP header: - $httpHeader->send(); - - // Send parsed template content: - echo $template->getParsedContent(); - } - - function getTemplateFileName() { - switch($this->getView()) { - case 'chat': - return AJAX_CHAT_PATH.'lib/template/loggedIn.html'; - case 'logs': - return AJAX_CHAT_PATH.'lib/template/logs.html'; - default: - return AJAX_CHAT_PATH.'lib/template/loggedOut.html'; - } - } - - function initView() { - $this->_view = null; - // "chat" is the default view: - $view = ($this->getRequestVar('view') === null) ? 'chat' : $this->getRequestVar('view'); - if($this->hasAccessTo($view)) { - $this->_view = $view; - } - } - - function getView() { - return $this->_view; - } - - function hasAccessTo($view) { - switch($view) { - case 'chat': - case 'teaser': - if($this->isLoggedIn()) { - return true; - } - return false; - case 'logs': - if($this->isLoggedIn() && ($this->getUserRole() == AJAX_CHAT_ADMIN || - ($this->getConfig('logsUserAccess') && - ($this->getUserRole() == AJAX_CHAT_MODERATOR || $this->getUserRole() == AJAX_CHAT_USER)) - )) { - return true; - } - return false; - default: - return false; - } - } - - function login() { - // Retrieve valid login user data (from request variables or session data): - $userData = $this->getValidLoginUserData(); - - if(!$userData) { - $this->addInfoMessage('errorInvalidUser'); - return false; - } - - // If the chat is closed, only the admin may login: - if(!$this->isChatOpen() && $userData['userRole'] != AJAX_CHAT_ADMIN) { - $this->addInfoMessage('errorChatClosed'); - return false; - } - - if(!$this->getConfig('allowGuestLogins') && $userData['userRole'] == AJAX_CHAT_GUEST) { - return false; - } - - // Check if userID or userName are already listed online: - if($this->isUserOnline($userData['userID']) || $this->isUserNameInUse($userData['userName'])) { - if($userData['userRole'] == AJAX_CHAT_USER || $userData['userRole'] == AJAX_CHAT_MODERATOR || $userData['userRole'] == AJAX_CHAT_ADMIN) { - // Set the registered user inactive and remove the inactive users so the user can be logged in again: - $this->setInactive($userData['userID'], $userData['userName']); - $this->removeInactive(); - } else { - $this->addInfoMessage('errorUserInUse'); - return false; - } - } - - // Check if user is banned: - if($userData['userRole'] != AJAX_CHAT_ADMIN && $this->isUserBanned($userData['userName'], $userData['userID'], $_SERVER['REMOTE_ADDR'])) { - $this->addInfoMessage('errorBanned'); - return false; - } - - // Check if the max number of users is logged in (not affecting moderators or admins): - if(!($userData['userRole'] == AJAX_CHAT_MODERATOR || $userData['userRole'] == AJAX_CHAT_ADMIN) && $this->isMaxUsersLoggedIn()) { - $this->addInfoMessage('errorMaxUsersLoggedIn'); - return false; - } - - // Use a new session id (if session has been started by the chat): - $this->regenerateSessionID(); - - // Log in: - $this->setUserID($userData['userID']); - $this->setUserName($userData['userName']); - $this->setLoginUserName($userData['userName']); - $this->setUserRole($userData['userRole']); - $this->setLoggedIn(true); - $this->setLoginTimeStamp(time()); - - // IP Security check variable: - $this->setSessionIP($_SERVER['REMOTE_ADDR']); - - // The client authenticates to the socket server using a socketRegistrationID: - if($this->getConfig('socketServerEnabled')) { - $this->setSocketRegistrationID( - md5(uniqid(rand(), true)) - ); - } - - // Add userID, userName and userRole to info messages: - $this->addInfoMessage($this->getUserID(), 'userID'); - $this->addInfoMessage($this->getUserName(), 'userName'); - $this->addInfoMessage($this->getUserRole(), 'userRole'); - - // Purge logs: - if($this->getConfig('logsPurgeLogs')) { - $this->purgeLogs(); - } - - return true; - } - - function chatViewLogin() { - $this->setChannel($this->getValidRequestChannelID()); - $this->addToOnlineList(); - - // Add channelID and channelName to info messages: - $this->addInfoMessage($this->getChannel(), 'channelID'); - $this->addInfoMessage($this->getChannelName(), 'channelName'); - - // Login message: - $text = '/login '.$this->getUserName(); - $this->insertChatBotMessage( - $this->getChannel(), - $text, - null, - 1 - ); - } - - function getValidRequestChannelID() { - $channelID = $this->getRequestVar('channelID'); - $channelName = $this->getRequestVar('channelName'); - // Check the given channelID, or get channelID from channelName: - if($channelID === null) { - if($channelName !== null) { - $channelID = $this->getChannelIDFromChannelName($channelName); - // channelName might need encoding conversion: - if($channelID === null) { - $channelID = $this->getChannelIDFromChannelName( - $this->trimChannelName($channelName, $this->getConfig('contentEncoding')) - ); - } - } - } - // Validate the resulting channelID: - if(!$this->validateChannel($channelID)) { - if($this->getChannel() !== null) { - return $this->getChannel(); - } - return $this->getConfig('defaultChannelID'); - } - return $channelID; - } - - function initChannel() { - $channelID = $this->getRequestVar('channelID'); - $channelName = $this->getRequestVar('channelName'); - if($channelID !== null) { - $this->switchChannel($this->getChannelNameFromChannelID($channelID)); - } else if($channelName !== null) { - if($this->getChannelIDFromChannelName($channelName) === null) { - // channelName might need encoding conversion: - $channelName = $this->trimChannelName($channelName, $this->getConfig('contentEncoding')); - } - $this->switchChannel($channelName); - } - } - - function logout($type=null) { - // Update the socket server authentication for the user: - if($this->getConfig('socketServerEnabled')) { - $this->updateSocketAuthentication($this->getUserID()); - } - if($this->isUserOnline()) { - $this->chatViewLogout($type); - } - $this->setLoggedIn(false); - $this->destroySession(); - - // Re-initialize the view: - $this->initView(); - } - - function chatViewLogout($type) { - $this->removeFromOnlineList(); - if($type !== null) { - $type = ' '.$type; - } - // Logout message - $text = '/logout '.$this->getUserName().$type; - $this->insertChatBotMessage( - $this->getChannel(), - $text, - null, - 1 - ); - } - - function switchChannel($channelName) { - $channelID = $this->getChannelIDFromChannelName($channelName); - - if($channelID !== null && $this->getChannel() == $channelID) { - // User is already in the given channel, return: - return; - } - - // Check if we have a valid channel: - if(!$this->validateChannel($channelID)) { - // Invalid channel: - $text = '/error InvalidChannelName '.$channelName; - $this->insertChatBotMessage( - $this->getPrivateMessageID(), - $text - ); - return; - } - - $oldChannel = $this->getChannel(); - - $this->setChannel($channelID); - $this->updateOnlineList(); - - // Channel leave message - $text = '/channelLeave '.$this->getUserName(); - $this->insertChatBotMessage( - $oldChannel, - $text, - null, - 1 - ); - - // Channel enter message - $text = '/channelEnter '.$this->getUserName(); - $this->insertChatBotMessage( - $this->getChannel(), - $text, - null, - 1 - ); - - $this->addInfoMessage($channelName, 'channelSwitch'); - $this->addInfoMessage($channelID, 'channelID'); - $this->_requestVars['lastID'] = 0; - } - - function addToOnlineList() { - $sql = 'INSERT INTO '.$this->getDataBaseTable('online').'( - userID, - userName, - userRole, - channel, - dateTime, - ip - ) - VALUES ( - '.$this->db->makeSafe($this->getUserID()).', - '.$this->db->makeSafe($this->getUserName()).', - '.$this->db->makeSafe($this->getUserRole()).', - '.$this->db->makeSafe($this->getChannel()).', - NOW(), - '.$this->db->makeSafe($this->ipToStorageFormat($_SERVER['REMOTE_ADDR'])).' - );'; - - // Create a new SQL query: - $result = $this->db->sqlQuery($sql); - - // Stop if an error occurs: - if($result->error()) { - echo $result->getError(); - die(); - } - - $this->resetOnlineUsersData(); - } - - function removeFromOnlineList() { - $sql = 'DELETE FROM - '.$this->getDataBaseTable('online').' - WHERE - userID = '.$this->db->makeSafe($this->getUserID()).';'; - - // Create a new SQL query: - $result = $this->db->sqlQuery($sql); - - // Stop if an error occurs: - if($result->error()) { - echo $result->getError(); - die(); - } - - $this->removeUserFromOnlineUsersData(); - } - - function updateOnlineList() { - $sql = 'UPDATE - '.$this->getDataBaseTable('online').' - SET - userName = '.$this->db->makeSafe($this->getUserName()).', - channel = '.$this->db->makeSafe($this->getChannel()).', - dateTime = NOW(), - ip = '.$this->db->makeSafe($this->ipToStorageFormat($_SERVER['REMOTE_ADDR'])).' - WHERE - userID = '.$this->db->makeSafe($this->getUserID()).';'; - - // Create a new SQL query: - $result = $this->db->sqlQuery($sql); - - // Stop if an error occurs: - if($result->error()) { - echo $result->getError(); - die(); - } - - $this->resetOnlineUsersData(); - } - - function initMessageHandling() { - // Don't handle messages if we are not in chat view: - if($this->getView() != 'chat') { - return; - } - - // Check if we have been uninvited from a private or restricted channel: - if(!$this->validateChannel($this->getChannel())) { - // Switch to the default channel: - $this->switchChannel($this->getChannelNameFromChannelID($this->getConfig('defaultChannelID'))); - return; - } - - if($this->getRequestVar('text') !== null) { - $this->insertMessage($this->getRequestVar('text')); - } - } - - function insertParsedMessage($text) { - - // If a queryUserName is set, sent all messages as private messages to this userName: - if($this->getQueryUserName() !== null && strpos($text, '/') !== 0) { - $text = '/msg '.$this->getQueryUserName().' '.$text; - } - - // Parse IRC-style commands: - if(strpos($text, '/') === 0) { - $textParts = explode(' ', $text); - - switch($textParts[0]) { - - // Channel switch: - case '/join': - $this->insertParsedMessageJoin($textParts); - break; - - // Logout: - case '/quit': - $this->logout(); - break; - - // Private message: - case '/msg': - case '/describe': - $this->insertParsedMessagePrivMsg($textParts); - break; - - // Invitation: - case '/invite': - $this->insertParsedMessageInvite($textParts); - break; - - // Uninvitation: - case '/uninvite': - $this->insertParsedMessageUninvite($textParts); - break; - - // Private messaging: - case '/query': - $this->insertParsedMessageQuery($textParts); - break; - - // Kicking offending users from the chat: - case '/kick': - $this->insertParsedMessageKick($textParts); - break; - - // Listing banned users: - case '/bans': - $this->insertParsedMessageBans($textParts); - break; - - // Unban user (remove from ban list): - case '/unban': - $this->insertParsedMessageUnban($textParts); - break; - - // Describing actions: - case '/me': - case '/action': - $this->insertParsedMessageAction($textParts); - break; - - - // Listing online Users: - case '/who': - $this->insertParsedMessageWho($textParts); - break; - - // Listing available channels: - case '/list': - $this->insertParsedMessageList($textParts); - break; - - // Retrieving the channel of a User: - case '/whereis': - $this->insertParsedMessageWhereis($textParts); - break; - - // Listing information about a User: - case '/whois': - $this->insertParsedMessageWhois($textParts); - break; - - // Rolling dice: - case '/roll': - $this->insertParsedMessageRoll($textParts); - break; - - // Switching userName: - case '/nick': - $this->insertParsedMessageNick($textParts); - break; - - // Custom or unknown command: - default: - if(!$this->parseCustomCommands($text, $textParts)) { - $this->insertChatBotMessage( - $this->getPrivateMessageID(), - '/error UnknownCommand '.$textParts[0] - ); - } - } - - } else { - // No command found, just insert the plain message: - $this->insertCustomMessage( - $this->getUserID(), - $this->getUserName(), - $this->getUserRole(), - $this->getChannel(), - $text - ); - } - } - - function insertParsedMessageJoin($textParts) { - if(count($textParts) == 1) { - // join with no arguments is the own private channel, if allowed: - if($this->isAllowedToCreatePrivateChannel()) { - // Private channels are identified by square brackets: - $this->switchChannel($this->getChannelNameFromChannelID($this->getPrivateChannelID())); - } else { - $this->insertChatBotMessage( - $this->getPrivateMessageID(), - '/error MissingChannelName' - ); - } - } else { - $this->switchChannel($textParts[1]); - } - } - - function insertParsedMessagePrivMsg($textParts) { - if($this->isAllowedToSendPrivateMessage()) { - if(count($textParts) < 3) { - if(count($textParts) == 2) { - $this->insertChatBotMessage( - $this->getPrivateMessageID(), - '/error MissingText' - ); - } else { - $this->insertChatBotMessage( - $this->getPrivateMessageID(), - '/error MissingUserName' - ); - } - } else { - // Get UserID from UserName: - $toUserID = $this->getIDFromName($textParts[1]); - if($toUserID === null) { - if($this->getQueryUserName() !== null) { - // Close the current query: - $this->insertMessage('/query'); - } else { - $this->insertChatBotMessage( - $this->getPrivateMessageID(), - '/error UserNameNotFound '.$textParts[1] - ); - } - } else { - // Insert /privaction command if /describe is used: - $command = ($textParts[0] == '/describe') ? '/privaction' : '/privmsg'; - // Copy of private message to current User: - $this->insertCustomMessage( - $this->getUserID(), - $this->getUserName(), - $this->getUserRole(), - $this->getPrivateMessageID(), - $command.'to '.$textParts[1].' '.implode(' ', array_slice($textParts, 2)) - ); - // Private message to requested User: - $this->insertCustomMessage( - $this->getUserID(), - $this->getUserName(), - $this->getUserRole(), - $this->getPrivateMessageID($toUserID), - $command.' '.implode(' ', array_slice($textParts, 2)) - ); - } - } - } else { - $this->insertChatBotMessage( - $this->getPrivateMessageID(), - '/error PrivateMessageNotAllowed' - ); - } - } - - function insertParsedMessageInvite($textParts) { - if($this->getChannel() == $this->getPrivateChannelID() || in_array($this->getChannel(), $this->getChannels())) { - if(count($textParts) == 1) { - $this->insertChatBotMessage( - $this->getPrivateMessageID(), - '/error MissingUserName' - ); - } else { - $toUserID = $this->getIDFromName($textParts[1]); - if($toUserID === null) { - $this->insertChatBotMessage( - $this->getPrivateMessageID(), - '/error UserNameNotFound '.$textParts[1] - ); - } else { - // Add the invitation to the database: - $this->addInvitation($toUserID); - $invitationChannelName = $this->getChannelNameFromChannelID($this->getChannel()); - // Copy of invitation to current User: - $this->insertChatBotMessage( - $this->getPrivateMessageID(), - '/inviteto '.$textParts[1].' '.$invitationChannelName - ); - // Invitation to requested User: - $this->insertChatBotMessage( - $this->getPrivateMessageID($toUserID), - '/invite '.$this->getUserName().' '.$invitationChannelName - ); - } - } - } else { - $this->insertChatBotMessage( - $this->getPrivateMessageID(), - '/error InviteNotAllowed' - ); - } - } - - function insertParsedMessageUninvite($textParts) { - if($this->getChannel() == $this->getPrivateChannelID() || in_array($this->getChannel(), $this->getChannels())) { - if(count($textParts) == 1) { - $this->insertChatBotMessage( - $this->getPrivateMessageID(), - '/error MissingUserName' - ); - } else { - $toUserID = $this->getIDFromName($textParts[1]); - if($toUserID === null) { - $this->insertChatBotMessage( - $this->getPrivateMessageID(), - '/error UserNameNotFound '.$textParts[1] - ); - } else { - // Remove the invitation from the database: - $this->removeInvitation($toUserID); - $invitationChannelName = $this->getChannelNameFromChannelID($this->getChannel()); - // Copy of uninvitation to current User: - $this->insertChatBotMessage( - $this->getPrivateMessageID(), - '/uninviteto '.$textParts[1].' '.$invitationChannelName - ); - // Uninvitation to requested User: - $this->insertChatBotMessage( - $this->getPrivateMessageID($toUserID), - '/uninvite '.$this->getUserName().' '.$invitationChannelName - ); - } - } - } else { - $this->insertChatBotMessage( - $this->getPrivateMessageID(), - '/error UninviteNotAllowed' - ); - } - } - - function insertParsedMessageQuery($textParts) { - if($this->isAllowedToSendPrivateMessage()) { - if(count($textParts) == 1) { - if($this->getQueryUserName() !== null) { - $this->insertChatBotMessage( - $this->getPrivateMessageID(), - '/queryClose '.$this->getQueryUserName() - ); - // Close the current query: - $this->setQueryUserName(null); - } else { - $this->insertChatBotMessage( - $this->getPrivateMessageID(), - '/error NoOpenQuery' - ); - } - } else { - if($this->getIDFromName($textParts[1]) === null) { - $this->insertChatBotMessage( - $this->getPrivateMessageID(), - '/error UserNameNotFound '.$textParts[1] - ); - } else { - if($this->getQueryUserName() !== null) { - // Close the current query: - $this->insertMessage('/query'); - } - // Open a query to the requested user: - $this->setQueryUserName($textParts[1]); - $this->insertChatBotMessage( - $this->getPrivateMessageID(), - '/queryOpen '.$textParts[1] - ); - } - } - } else { - $this->insertChatBotMessage( - $this->getPrivateMessageID(), - '/error PrivateMessageNotAllowed' - ); - } - } - - function insertParsedMessageKick($textParts) { - // Only moderators/admins may kick users: - if($this->getUserRole() == AJAX_CHAT_ADMIN || $this->getUserRole() == AJAX_CHAT_MODERATOR) { - if(count($textParts) == 1) { - $this->insertChatBotMessage( - $this->getPrivateMessageID(), - '/error MissingUserName' - ); - } else { - // Get UserID from UserName: - $kickUserID = $this->getIDFromName($textParts[1]); - if($kickUserID === null) { - $this->insertChatBotMessage( - $this->getPrivateMessageID(), - '/error UserNameNotFound '.$textParts[1] - ); - } else { - // Check the role of the user to kick: - $kickUserRole = $this->getRoleFromID($kickUserID); - if($kickUserRole == AJAX_CHAT_ADMIN || ($kickUserRole == AJAX_CHAT_MODERATOR && $this->getUserRole() != AJAX_CHAT_ADMIN)) { - // Admins and moderators may not be kicked: - $this->insertChatBotMessage( - $this->getPrivateMessageID(), - '/error KickNotAllowed '.$textParts[1] - ); - } else { - // Kick user and insert message: - $channel = $this->getChannelFromID($kickUserID); - $banMinutes = (count($textParts) > 2) ? $textParts[2] : null; - $this->kickUser($textParts[1], $banMinutes, $kickUserID); - // If no channel found, user logged out before he could be kicked - if($channel !== null) { - $this->insertChatBotMessage( - $channel, - '/kick '.$textParts[1], - null, - 1 - ); - // Send a copy of the message to the current user, if not in the channel: - if($channel != $this->getChannel()) { - $this->insertChatBotMessage( - $this->getPrivateMessageID(), - '/kick '.$textParts[1], - null, - 1 - ); - } - } - } - } - } - } else { - $this->insertChatBotMessage( - $this->getPrivateMessageID(), - '/error CommandNotAllowed '.$textParts[0] - ); - } - } - - function insertParsedMessageBans($textParts) { - // Only moderators/admins may see the list of banned users: - if($this->getUserRole() == AJAX_CHAT_ADMIN || $this->getUserRole() == AJAX_CHAT_MODERATOR) { - $this->removeExpiredBans(); - $bannedUsers = $this->getBannedUsers(); - if(count($bannedUsers) > 0) { - $this->insertChatBotMessage( - $this->getPrivateMessageID(), - '/bans '.implode(' ', $bannedUsers) - ); - } else { - $this->insertChatBotMessage( - $this->getPrivateMessageID(), - '/bansEmpty -' - ); - } - } else { - $this->insertChatBotMessage( - $this->getPrivateMessageID(), - '/error CommandNotAllowed '.$textParts[0] - ); - } - } - - function insertParsedMessageUnban($textParts) { - // Only moderators/admins may unban users: - if($this->getUserRole() == AJAX_CHAT_ADMIN || $this->getUserRole() == AJAX_CHAT_MODERATOR) { - $this->removeExpiredBans(); - if(count($textParts) == 1) { - $this->insertChatBotMessage( - $this->getPrivateMessageID(), - '/error MissingUserName' - ); - } else { - if(!in_array($textParts[1], $this->getBannedUsers())) { - $this->insertChatBotMessage( - $this->getPrivateMessageID(), - '/error UserNameNotFound '.$textParts[1] - ); - } else { - // Unban user and insert message: - $this->unbanUser($textParts[1]); - $this->insertChatBotMessage( - $this->getPrivateMessageID(), - '/unban '.$textParts[1] - ); - } - } - } else { - $this->insertChatBotMessage( - $this->getPrivateMessageID(), - '/error CommandNotAllowed '.$textParts[0] - ); - } - } - - function insertParsedMessageAction($textParts) { - if(count($textParts) == 1) { - $this->insertChatBotMessage( - $this->getPrivateMessageID(), - '/error MissingText' - ); - } else { - if($this->getQueryUserName() !== null) { - // If we are in query mode, sent the action to the query user: - $this->insertMessage('/describe '.$this->getQueryUserName().' '.implode(' ', array_slice($textParts, 1))); - } else { - $this->insertCustomMessage( - $this->getUserID(), - $this->getUserName(), - $this->getUserRole(), - $this->getChannel(), - implode(' ', $textParts) - ); - } - } - } - - function insertParsedMessageWho($textParts) { - if(count($textParts) == 1) { - if($this->isAllowedToListHiddenUsers()) { - // List online users from any channel: - $this->insertChatBotMessage( - $this->getPrivateMessageID(), - '/who '.implode(' ', $this->getOnlineUsers()) - ); - } else { - // Get online users for all accessible channels: - $channels = $this->getChannels(); - // Add the own private channel if allowed: - if($this->isAllowedToCreatePrivateChannel()) { - array_push($channels, $this->getPrivateChannelID()); - } - // Add the invitation channels: - foreach($this->getInvitations() as $channelID) { - if(!in_array($channelID, $channels)) { - array_push($channels, $channelID); - } - } - $this->insertChatBotMessage( - $this->getPrivateMessageID(), - '/who '.implode(' ', $this->getOnlineUsers($channels)) - ); - } - } else { - $channelName = $textParts[1]; - $channelID = $this->getChannelIDFromChannelName($channelName); - if(!$this->validateChannel($channelID)) { - // Invalid channel: - $this->insertChatBotMessage( - $this->getPrivateMessageID(), - '/error InvalidChannelName '.$channelName - ); - } else { - // Get online users for the given channel: - $onlineUsers = $this->getOnlineUsers(array($channelID)); - if(count($onlineUsers) > 0) { - $this->insertChatBotMessage( - $this->getPrivateMessageID(), - '/whoChannel '.$channelName.' '.implode(' ', $onlineUsers) - ); - } else { - $this->insertChatBotMessage( - $this->getPrivateMessageID(), - '/whoEmpty -' - ); - } - } - } - } - - function insertParsedMessageList($textParts) { - // Get the names of all accessible channels: - $channelNames = $this->getChannelNames(); - // Add the own private channel, if allowed: - if($this->isAllowedToCreatePrivateChannel()) { - array_push($channelNames, $this->getPrivateChannelName()); - } - // Add the invitation channels: - foreach($this->getInvitations() as $channelID) { - $channelName = $this->getChannelNameFromChannelID($channelID); - if($channelName !== null && !in_array($channelName, $channelNames)) { - array_push($channelNames, $channelName); - } - } - $this->insertChatBotMessage( - $this->getPrivateMessageID(), - '/list '.implode(' ', $channelNames) - ); - } - - function insertParsedMessageWhereis($textParts) { - if(count($textParts) == 1) { - $this->insertChatBotMessage( - $this->getPrivateMessageID(), - '/error MissingUserName' - ); - } else { - // Get UserID from UserName: - $whereisUserID = $this->getIDFromName($textParts[1]); - if($whereisUserID === null) { - $this->insertChatBotMessage( - $this->getPrivateMessageID(), - '/error UserNameNotFound '.$textParts[1] - ); - } else { - $channelID = $this->getChannelFromID($whereisUserID); - if($this->validateChannel($channelID)) { - $channelName = $this->getChannelNameFromChannelID($channelID); - } else { - $channelName = null; - } - if($channelName === null) { - $this->insertChatBotMessage( - $this->getPrivateMessageID(), - '/error UserNameNotFound '.$textParts[1] - ); - } else { - // List user information: - $this->insertChatBotMessage( - $this->getPrivateMessageID(), - '/whereis '.$textParts[1].' '.$channelName - ); - } - } - } - } - - function insertParsedMessageWhois($textParts) { - // Only moderators/admins: - if($this->getUserRole() == AJAX_CHAT_ADMIN || $this->getUserRole() == AJAX_CHAT_MODERATOR) { - if(count($textParts) == 1) { - $this->insertChatBotMessage( - $this->getPrivateMessageID(), - '/error MissingUserName' - ); - } else { - // Get UserID from UserName: - $whoisUserID = $this->getIDFromName($textParts[1]); - if($whoisUserID === null) { - $this->insertChatBotMessage( - $this->getPrivateMessageID(), - '/error UserNameNotFound '.$textParts[1] - ); - } else { - // List user information: - $this->insertChatBotMessage( - $this->getPrivateMessageID(), - '/whois '.$textParts[1].' '.$this->getIPFromID($whoisUserID) - ); - } - } - } else { - $this->insertChatBotMessage( - $this->getPrivateMessageID(), - '/error CommandNotAllowed '.$textParts[0] - ); - } - } - - function insertParsedMessageRoll($textParts) { - if(count($textParts) == 1) { - // default is one d6: - $text = '/roll '.$this->getUserName().' 1d6 '.$this->rollDice(6); - } else { - $diceParts = explode('d', $textParts[1]); - if(count($diceParts) == 2) { - $number = (int)$diceParts[0]; - $sides = (int)$diceParts[1]; - - // Dice number must be an integer between 1 and 100, else roll only one: - $number = ($number > 0 && $number <= 100) ? $number : 1; - - // Sides must be an integer between 1 and 100, else take 6: - $sides = ($sides > 0 && $sides <= 100) ? $sides : 6; - - $text = '/roll '.$this->getUserName().' '.$number.'d'.$sides.' '; - for($i=0; $i<$number; $i++) { - if($i != 0) - $text .= ','; - $text .= $this->rollDice($sides); - } - } else { - // if dice syntax is invalid, roll one d6: - $text = '/roll '.$this->getUserName().' 1d6 '.$this->rollDice(6); - } - } - $this->insertChatBotMessage( - $this->getChannel(), - $text - ); - } - - function insertParsedMessageNick($textParts) { - if(!$this->getConfig('allowNickChange') || - (!$this->getConfig('allowGuestUserName') && $this->getUserRole() == AJAX_CHAT_GUEST)) { - $this->insertChatBotMessage( - $this->getPrivateMessageID(), - '/error CommandNotAllowed '.$textParts[0] - ); - } else if(count($textParts) == 1) { - $this->insertChatBotMessage( - $this->getPrivateMessageID(), - '/error MissingUserName' - ); - } else { - $newUserName = implode(' ', array_slice($textParts, 1)); - if($newUserName == $this->getLoginUserName()) { - // Allow the user to regain the original login userName: - $prefix = ''; - $suffix = ''; - } else if($this->getUserRole() == AJAX_CHAT_GUEST) { - $prefix = $this->getConfig('guestUserPrefix'); - $suffix = $this->getConfig('guestUserSuffix'); - } else { - $prefix = $this->getConfig('changedNickPrefix'); - $suffix = $this->getConfig('changedNickSuffix'); - } - $maxLength = $this->getConfig('userNameMaxLength') - - $this->stringLength($prefix) - - $this->stringLength($suffix); - $newUserName = $this->trimString($newUserName, 'UTF-8', $maxLength, true); - if(!$newUserName) { - $this->insertChatBotMessage( - $this->getPrivateMessageID(), - '/error InvalidUserName' - ); - } else { - $newUserName = $prefix.$newUserName.$suffix; - if($this->isUserNameInUse($newUserName)) { - $this->insertChatBotMessage( - $this->getPrivateMessageID(), - '/error UserNameInUse' - ); - } else { - $oldUserName = $this->getUserName(); - $this->setUserName($newUserName); - $this->updateOnlineList(); - // Add info message to update the client-side stored userName: - $this->addInfoMessage($this->getUserName(), 'userName'); - $this->insertChatBotMessage( - $this->getChannel(), - '/nick '.$oldUserName.' '.$newUserName, - null, - 2 - ); - } - } - } - } - - function insertMessage($text) { - if(!$this->isAllowedToWriteMessage()) - return; - - if(!$this->floodControl()) - return; - - $text = $this->trimMessageText($text); - if($text == '') - return; - - if(!$this->onNewMessage($text)) - return; - - $text = $this->replaceCustomText($text); - - $this->insertParsedMessage($text); - } - - function deleteMessage($messageID) { - // Retrieve the channel of the given message: - $sql = 'SELECT - channel - FROM - '.$this->getDataBaseTable('messages').' - WHERE - id='.$this->db->makeSafe($messageID).';'; - - // Create a new SQL query: - $result = $this->db->sqlQuery($sql); - - // Stop if an error occurs: - if($result->error()) { - echo $result->getError(); - die(); - } - - $row = $result->fetch(); - - if($row['channel'] !== null) { - $channel = $row['channel']; - - if($this->getUserRole() == AJAX_CHAT_ADMIN) { - $condition = ''; - } else if($this->getUserRole() == AJAX_CHAT_MODERATOR) { - $condition = ' AND - NOT (userRole='.$this->db->makeSafe(AJAX_CHAT_ADMIN).') - AND - NOT (userRole='.$this->db->makeSafe(AJAX_CHAT_CHATBOT).')'; - } else if($this->getUserRole() == AJAX_CHAT_USER && $this->getConfig('allowUserMessageDelete')) { - $condition = 'AND - ( - userID='.$this->db->makeSafe($this->getUserID()).' - OR - ( - channel = '.$this->db->makeSafe($this->getPrivateMessageID()).' - OR - channel = '.$this->db->makeSafe($this->getPrivateChannelID()).' - ) - AND - NOT (userRole='.$this->db->makeSafe(AJAX_CHAT_ADMIN).') - AND - NOT (userRole='.$this->db->makeSafe(AJAX_CHAT_CHATBOT).') - )'; - } else { - return false; - } - - // Remove given message from the database: - $sql = 'DELETE FROM - '.$this->getDataBaseTable('messages').' - WHERE - id='.$this->db->makeSafe($messageID).' - '.$condition.';'; - - // Create a new SQL query: - $result = $this->db->sqlQuery($sql); - - // Stop if an error occurs: - if($result->error()) { - echo $result->getError(); - die(); - } - - if($result->affectedRows() == 1) { - // Insert a deletion command to remove the message from the clients chatlists: - $this->insertChatBotMessage($channel, '/delete '.$messageID); - return true; - } - } - return false; - } - - function floodControl() { - // Moderators and Admins need no flood control: - if($this->getUserRole() == AJAX_CHAT_MODERATOR || $this->getUserRole() == AJAX_CHAT_ADMIN) { - return true; - } - $time = time(); - // Check the time of the last inserted message: - if($this->getInsertedMessagesRateTimeStamp()+60 < $time) { - $this->setInsertedMessagesRateTimeStamp($time); - $this->setInsertedMessagesRate(1); - } else { - // Increase the inserted messages rate: - $rate = $this->getInsertedMessagesRate()+1; - $this->setInsertedMessagesRate($rate); - // Check if message rate is too high: - if($rate > $this->getConfig('maxMessageRate')) { - $this->insertChatBotMessage( - $this->getPrivateMessageID(), - '/error MaxMessageRate' - ); - // Return false so the message is not inserted: - return false; - } - } - return true; - } - - function isAllowedToWriteMessage() { - if($this->getUserRole() != AJAX_CHAT_GUEST) - return true; - if($this->getConfig('allowGuestWrite')) - return true; - return false; - } - - function insertChatBotMessage($channelID, $messageText, $ip=null, $mode=0) { - $this->insertCustomMessage( - $this->getConfig('chatBotID'), - $this->getConfig('chatBotName'), - AJAX_CHAT_CHATBOT, - $channelID, - $messageText, - $ip, - $mode - ); - } - - function insertCustomMessage($userID, $userName, $userRole, $channelID, $text, $ip=null, $mode=0) { - // The $mode parameter is used for socket updates: - // 0 = normal messages - // 1 = channel messages (e.g. login/logout, channel enter/leave, kick) - // 2 = messages with online user updates (nick) - - $ip = $ip ? $ip : $_SERVER['REMOTE_ADDR']; - - $sql = 'INSERT INTO '.$this->getDataBaseTable('messages').'( - userID, - userName, - userRole, - channel, - dateTime, - ip, - text - ) - VALUES ( - '.$this->db->makeSafe($userID).', - '.$this->db->makeSafe($userName).', - '.$this->db->makeSafe($userRole).', - '.$this->db->makeSafe($channelID).', - NOW(), - '.$this->db->makeSafe($this->ipToStorageFormat($ip)).', - '.$this->db->makeSafe($text).' - );'; - - // Create a new SQL query: - $result = $this->db->sqlQuery($sql); - - // Stop if an error occurs: - if($result->error()) { - echo $result->getError(); - die(); - } - - if($this->getConfig('socketServerEnabled')) { - $this->sendSocketMessage( - $this->getSocketBroadcastMessage( - $this->db->getLastInsertedID(), - time(), - $userID, - $userName, - $userRole, - $channelID, - $text, - $mode - ) - ); - } - } - - function getSocketBroadcastMessage( - $messageID, - $timeStamp, - $userID, - $userName, - $userRole, - $channelID, - $text, - $mode - ) { - // The $mode parameter: - // 0 = normal messages - // 1 = channel messages (e.g. login/logout, channel enter/leave, kick) - // 2 = messages with online user updates (nick) - - // Get the message XML content: - $xml = ''; - if($mode) { - // Add the list of online users if the user list has been updated ($mode > 0): - $xml .= $this->getChatViewOnlineUsersXML(array($channelID)); - } - if($mode != 1 || $this->getConfig('showChannelMessages')) { - $xml .= ''; - $xml .= $this->getChatViewMessageXML( - $messageID, - $timeStamp, - $userID, - $userName, - $userRole, - $channelID, - $text - ); - $xml .= ''; - } - $xml .= ''; - return $xml; - } - - function sendSocketMessage($message) { - // Open a TCP socket connection to the socket server: - if($socket = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP)) { - if(@socket_connect($socket, $this->getConfig('socketServerIP'), $this->getConfig('socketServerPort'))) { - // Append a null-byte to the string as EOL (End Of Line) character - // which is required by Flash XML socket communication: - $message .= "\0"; - @socket_write( - $socket, - $message, - strlen($message) // Using strlen to count the bytes instead of the number of UTF-8 characters - ); - } - @socket_close($socket); - } - } - - function updateSocketAuthentication($userID, $socketRegistrationID=null, $channels=null) { - // If no $socketRegistrationID or no $channels are given the authentication is removed for the given user: - $authentication = ''; - if($channels) { - foreach($channels as $channelID) { - $authentication .= ''; - } - } - $authentication .= ''; - $this->sendSocketMessage($authentication); - } - - function setSocketRegistrationID($value) { - $this->setSessionVar('SocketRegistrationID', $value); - } - - function getSocketRegistrationID() { - return $this->getSessionVar('SocketRegistrationID'); - } - - function rollDice($sides) { - // seed with microseconds since last "whole" second: - mt_srand((double)microtime()*1000000); - - return mt_rand(1, $sides); - } - - function kickUser($userName, $banMinutes=null, $userID=null) { - if($userID === null) { - $userID = $this->getIDFromName($userName); - } - if($userID === null) { - return; - } - - $banMinutes = $banMinutes ? $banMinutes : $this->getConfig('defaultBanTime'); - - if($banMinutes) { - // Ban User for the given time in minutes: - $this->banUser($userName, $banMinutes, $userID); - } - - // Remove given User from online list: - $sql = 'DELETE FROM - '.$this->getDataBaseTable('online').' - WHERE - userID = '.$this->db->makeSafe($userID).';'; - - // Create a new SQL query: - $result = $this->db->sqlQuery($sql); - - // Stop if an error occurs: - if($result->error()) { - echo $result->getError(); - die(); - } - - // Update the socket server authentication for the kicked user: - if($this->getConfig('socketServerEnabled')) { - $this->updateSocketAuthentication($userID); - } - - $this->removeUserFromOnlineUsersData($userID); - } - - function getBannedUsersData($key=null, $value=null) { - if($this->_bannedUsersData === null) { - $this->_bannedUsersData = array(); - - $sql = 'SELECT - userID, - userName, - ip - FROM - '.$this->getDataBaseTable('bans').' - WHERE - NOW() < dateTime;'; - - // Create a new SQL query: - $result = $this->db->sqlQuery($sql); - - // Stop if an error occurs: - if($result->error()) { - echo $result->getError(); - die(); - } - - while($row = $result->fetch()) { - $row['ip'] = $this->ipFromStorageFormat($row['ip']); - array_push($this->_bannedUsersData, $row); - } - - $result->free(); - } - - if($key) { - $bannedUsersData = array(); - foreach($this->_bannedUsersData as $bannedUserData) { - if(!isset($bannedUserData[$key])) { - return $bannedUsersData; - } - if($value) { - if($bannedUserData[$key] == $value) { - array_push($bannedUsersData, $bannedUserData); - } else { - continue; - } - } else { - array_push($bannedUsersData, $bannedUserData[$key]); - } - } - return $bannedUsersData; - } - - return $this->_bannedUsersData; - } - - function getBannedUsers() { - return $this->getBannedUsersData('userName'); - } - - function banUser($userName, $banMinutes=null, $userID=null) { - if($userID === null) { - $userID = $this->getIDFromName($userName); - } - $ip = $this->getIPFromID($userID); - if(!$ip || $userID === null) { - return; - } - - // Remove expired bans: - $this->removeExpiredBans(); - - $banMinutes = (int)$banMinutes; - if(!$banMinutes) { - // If banMinutes is not a valid integer, use the defaultBanTime: - $banMinutes = $this->getConfig('defaultBanTime'); - } - - $sql = 'INSERT INTO '.$this->getDataBaseTable('bans').'( - userID, - userName, - dateTime, - ip - ) - VALUES ( - '.$this->db->makeSafe($userID).', - '.$this->db->makeSafe($userName).', - DATE_ADD(NOW(), interval '.$this->db->makeSafe($banMinutes).' MINUTE), - '.$this->db->makeSafe($this->ipToStorageFormat($ip)).' - );'; - - // Create a new SQL query: - $result = $this->db->sqlQuery($sql); - - // Stop if an error occurs: - if($result->error()) { - echo $result->getError(); - die(); - } - } - - function unbanUser($userName) { - $sql = 'DELETE FROM - '.$this->getDataBaseTable('bans').' - WHERE - userName = '.$this->db->makeSafe($userName).';'; - - // Create a new SQL query: - $result = $this->db->sqlQuery($sql); - - // Stop if an error occurs: - if($result->error()) { - echo $result->getError(); - die(); - } - } - - function removeExpiredBans() { - $sql = 'DELETE FROM - '.$this->getDataBaseTable('bans').' - WHERE - dateTime < NOW();'; - - // Create a new SQL query: - $result = $this->db->sqlQuery($sql); - - // Stop if an error occurs: - if($result->error()) { - echo $result->getError(); - die(); - } - } - - function setInactive($userID, $userName=null) { - $condition = 'userID='.$this->db->makeSafe($userID); - if($userName !== null) { - $condition .= ' OR userName='.$this->db->makeSafe($userName); - } - $sql = 'UPDATE - '.$this->getDataBaseTable('online').' - SET - dateTime = DATE_SUB(NOW(), interval '.(intval($this->getConfig('inactiveTimeout'))+1).' MINUTE) - WHERE - '.$condition.';'; - - // Create a new SQL query: - $result = $this->db->sqlQuery($sql); - - // Stop if an error occurs: - if($result->error()) { - echo $result->getError(); - die(); - } - - $this->resetOnlineUsersData(); - } - - function removeInactive() { - $sql = 'SELECT - userID, - userName, - channel - FROM - '.$this->getDataBaseTable('online').' - WHERE - NOW() > DATE_ADD(dateTime, interval '.$this->getConfig('inactiveTimeout').' MINUTE);'; - - // Create a new SQL query: - $result = $this->db->sqlQuery($sql); - - // Stop if an error occurs: - if($result->error()) { - echo $result->getError(); - die(); - } - - if($result->numRows() > 0) { - $condition = ''; - while($row = $result->fetch()) { - if(!empty($condition)) - $condition .= ' OR '; - // Add userID to condition for removal: - $condition .= 'userID='.$this->db->makeSafe($row['userID']); - - // Update the socket server authentication for the kicked user: - if($this->getConfig('socketServerEnabled')) { - $this->updateSocketAuthentication($row['userID']); - } - - $this->removeUserFromOnlineUsersData($row['userID']); - - // Insert logout timeout message: - $text = '/logout '.$row['userName'].' Timeout'; - $this->insertChatBotMessage( - $row['channel'], - $text, - null, - 1 - ); - } - - $result->free(); - - $sql = 'DELETE FROM - '.$this->getDataBaseTable('online').' - WHERE - '.$condition.';'; - - // Create a new SQL query: - $result = $this->db->sqlQuery($sql); - - // Stop if an error occurs: - if($result->error()) { - echo $result->getError(); - die(); - } - } - } - - function updateOnlineStatus() { - // Update online status every 50 seconds (this allows update requests to be in time): - if(!$this->getStatusUpdateTimeStamp() || ((time() - $this->getStatusUpdateTimeStamp()) > 50)) { - $this->updateOnlineList(); - $this->setStatusUpdateTimeStamp(time()); - } - } - - function checkAndRemoveInactive() { - // Remove inactive users every inactiveCheckInterval: - if(!$this->getInactiveCheckTimeStamp() || ((time() - $this->getInactiveCheckTimeStamp()) > $this->getConfig('inactiveCheckInterval')*60)) { - $this->removeInactive(); - $this->setInactiveCheckTimeStamp(time()); - } - } - - function sendXMLMessages() { - $httpHeader = new AJAXChatHTTPHeader('UTF-8', 'text/xml'); - - // Send HTTP header: - $httpHeader->send(); - - // Output XML messages: - echo $this->getXMLMessages(); - } - - function getXMLMessages() { - switch($this->getView()) { - case 'chat': - return $this->getChatViewXMLMessages(); - case 'teaser': - return $this->getTeaserViewXMLMessages(); - case 'logs': - return $this->getLogsViewXMLMessages(); - default: - return $this->getLogoutXMLMessage(); - } - } - - function getMessageCondition() { - $condition = 'id > '.$this->db->makeSafe($this->getRequestVar('lastID')).' - AND ( - channel = '.$this->db->makeSafe($this->getChannel()).' - OR - channel = '.$this->db->makeSafe($this->getPrivateMessageID()).' - ) - AND - '; - if($this->getConfig('requestMessagesPriorChannelEnter') || - ($this->getConfig('requestMessagesPriorChannelEnterList') && in_array($this->getChannel(), $this->getConfig('requestMessagesPriorChannelEnterList')))) { - $condition .= 'NOW() < DATE_ADD(dateTime, interval '.$this->getConfig('requestMessagesTimeDiff').' HOUR)'; - } else { - $condition .= 'dateTime >= FROM_UNIXTIME(' . $this->getChannelEnterTimeStamp() . ')'; - } - return $condition; - } - - function getMessageFilter() { - $filterChannelMessages = ''; - if(!$this->getConfig('showChannelMessages') || $this->getRequestVar('shoutbox')) { - $filterChannelMessages = ' AND NOT ( - text LIKE (\'/login%\') - OR - text LIKE (\'/logout%\') - OR - text LIKE (\'/channelEnter%\') - OR - text LIKE (\'/channelLeave%\') - OR - text LIKE (\'/kick%\') - )'; - } - return $filterChannelMessages; - } - - function getInfoMessagesXML() { - $xml = ''; - // Go through the info messages: - foreach($this->getInfoMessages() as $type=>$infoArray) { - foreach($infoArray as $info) { - $xml .= ''; - $xml .= 'encodeSpecialChars($info).']]>'; - $xml .= ''; - } - } - $xml .= ''; - return $xml; - } - - function getChatViewOnlineUsersXML($channelIDs) { - // Get the online users for the given channels: - $onlineUsersData = $this->getOnlineUsersData($channelIDs); - $xml = ''; - foreach($onlineUsersData as $onlineUserData) { - $xml .= 'encodeSpecialChars($onlineUserData['userName']).']]>'; - $xml .= ''; - } - $xml .= ''; - return $xml; - } - - function getLogoutXMLMessage() { - $xml = ''; - $xml .= ''; - $xml .= ''; - $xml .= ''; - $xml .= 'encodeSpecialChars($this->getConfig('logoutData')).']]>'; - $xml .= ''; - $xml .= ''; - $xml .= ''; - return $xml; - } - - function getChatViewMessageXML( - $messageID, - $timeStamp, - $userID, - $userName, - $userRole, - $channelID, - $text - ) { - $message = 'encodeSpecialChars($userName).']]>'; - $message .= 'encodeSpecialChars($text).']]>'; - $message .= ''; - return $message; - } - - function getChatViewMessagesXML() { - // Get the last messages in descending order (this optimises the LIMIT usage): - $sql = 'SELECT - id, - userID, - userName, - userRole, - channel AS channelID, - UNIX_TIMESTAMP(dateTime) AS timeStamp, - text - FROM - '.$this->getDataBaseTable('messages').' - WHERE - '.$this->getMessageCondition().' - '.$this->getMessageFilter().' - ORDER BY - id - DESC - LIMIT '.$this->getConfig('requestMessagesLimit').';'; - - // Create a new SQL query: - $result = $this->db->sqlQuery($sql); - - // Stop if an error occurs: - if($result->error()) { - echo $result->getError(); - die(); - } - - $messages = ''; - - // Add the messages in reverse order so it is ascending again: - while($row = $result->fetch()) { - $message = $this->getChatViewMessageXML( - $row['id'], - $row['timeStamp'], - $row['userID'], - $row['userName'], - $row['userRole'], - $row['channelID'], - $row['text'] - ); - $messages = $message.$messages; - } - $result->free(); - - $messages = ''.$messages.''; - return $messages; - } - - function getChatViewXMLMessages() { - $xml = ''; - $xml .= ''; - $xml .= $this->getInfoMessagesXML(); - $xml .= $this->getChatViewOnlineUsersXML(array($this->getChannel())); - $xml .= $this->getChatViewMessagesXML(); - $xml .= ''; - return $xml; - } - - function getTeaserMessageCondition() { - $channelID = $this->getValidRequestChannelID(); - $condition = 'channel = '.$this->db->makeSafe($channelID).' - AND - '; - if($this->getConfig('requestMessagesPriorChannelEnter') || - ($this->getConfig('requestMessagesPriorChannelEnterList') && in_array($channelID, $this->getConfig('requestMessagesPriorChannelEnterList')))) { - $condition .= 'NOW() < DATE_ADD(dateTime, interval '.$this->getConfig('requestMessagesTimeDiff').' HOUR)'; - } else { - // Teaser content may not be shown for this channel: - $condition .= '0 = 1'; - } - return $condition; - } - - function getTeaserViewMessagesXML() { - // Get the last messages in descending order (this optimises the LIMIT usage): - $sql = 'SELECT - id, - userID, - userName, - userRole, - channel AS channelID, - UNIX_TIMESTAMP(dateTime) AS timeStamp, - text - FROM - '.$this->getDataBaseTable('messages').' - WHERE - '.$this->getTeaserMessageCondition().' - '.$this->getMessageFilter().' - ORDER BY - id - DESC - LIMIT '.$this->getConfig('requestMessagesLimit').';'; - - // Create a new SQL query: - $result = $this->db->sqlQuery($sql); - - // Stop if an error occurs: - if($result->error()) { - echo $result->getError(); - die(); - } - - $messages = ''; - - // Add the messages in reverse order so it is ascending again: - while($row = $result->fetch()) { - $message = ''; - $message .= 'encodeSpecialChars($row['userName']).']]>'; - $message .= 'encodeSpecialChars($row['text']).']]>'; - $message .= ''; - $messages = $message.$messages; - } - $result->free(); - - $messages = ''.$messages.''; - return $messages; - } - - function getTeaserViewXMLMessages() { - $xml = ''; - $xml .= ''; - $xml .= $this->getInfoMessagesXML(); - $xml .= $this->getTeaserViewMessagesXML(); - $xml .= ''; - return $xml; - } - - function getLogsViewCondition() { - $condition = 'id > '.$this->db->makeSafe($this->getRequestVar('lastID')); - - // Check the channel condition: - switch($this->getRequestVar('channelID')) { - case '-3': - // Just display messages from all accessible channels - if($this->getUserRole() != AJAX_CHAT_ADMIN) { - $condition .= ' AND (channel = '.$this->db->makeSafe($this->getPrivateMessageID()); - $condition .= ' OR channel = '.$this->db->makeSafe($this->getPrivateChannelID()); - foreach($this->getChannels() as $channel) { - if($this->getConfig('logsUserAccessChannelList') && !in_array($channel, $this->getConfig('logsUserAccessChannelList'))) { - continue; - } - $condition .= ' OR channel = '.$this->db->makeSafe($channel); - } - $condition .= ')'; - } - break; - case '-2': - if($this->getUserRole() != AJAX_CHAT_ADMIN) { - $condition .= ' AND channel = '.($this->getPrivateMessageID()); - } else { - $condition .= ' AND channel > '.($this->getConfig('privateMessageDiff')-1); - } - break; - case '-1': - if($this->getUserRole() != AJAX_CHAT_ADMIN) { - $condition .= ' AND channel = '.($this->getPrivateChannelID()); - } else { - $condition .= ' AND (channel > '.($this->getConfig('privateChannelDiff')-1).' AND channel < '.($this->getConfig('privateMessageDiff')).')'; - } - break; - default: - if(($this->getUserRole() == AJAX_CHAT_ADMIN || !$this->getConfig('logsUserAccessChannelList') || in_array($this->getRequestVar('channelID'), $this->getConfig('logsUserAccessChannelList'))) - && $this->validateChannel($this->getRequestVar('channelID'))) { - $condition .= ' AND channel = '.$this->db->makeSafe($this->getRequestVar('channelID')); - } else { - // No valid channel: - $condition .= ' AND 0 = 1'; - } - } - - // Check the period condition: - $hour = ($this->getRequestVar('hour') === null || $this->getRequestVar('hour') > 23 || $this->getRequestVar('hour') < 0) ? null : $this->getRequestVar('hour'); - $day = ($this->getRequestVar('day') === null || $this->getRequestVar('day') > 31 || $this->getRequestVar('day') < 1) ? null : $this->getRequestVar('day'); - $month = ($this->getRequestVar('month') === null || $this->getRequestVar('month') > 12 || $this->getRequestVar('month') < 1) ? null : $this->getRequestVar('month'); - $year = ($this->getRequestVar('year') === null || $this->getRequestVar('year') > date('Y') || $this->getRequestVar('year') < $this->getConfig('logsFirstYear')) ? null : $this->getRequestVar('year'); - - // If a time (hour) is given but no date (year, month, day), use the current date: - if($hour !== null) { - if($day === null) - $day = date('j'); - if($month === null) - $month = date('n'); - if($year === null) - $year = date('Y'); - } - - if($year === null) { - // No year given, so no period condition - } else if($month === null) { - // Define the given year as period: - $periodStart = mktime(0, 0, 0, 1, 1, $year); - // The last day in a month can be expressed by using 0 for the day of the next month: - $periodEnd = mktime(23, 59, 59, 13, 0, $year); - } else if($day === null) { - // Define the given month as period: - $periodStart = mktime(0, 0, 0, $month, 1, $year); - // The last day in a month can be expressed by using 0 for the day of the next month: - $periodEnd = mktime(23, 59, 59, $month+1, 0, $year); - } else if($hour === null){ - // Define the given day as period: - $periodStart = mktime(0, 0, 0, $month, $day, $year); - $periodEnd = mktime(23, 59, 59, $month, $day, $year); - } else { - // Define the given hour as period: - $periodStart = mktime($hour, 0, 0, $month, $day, $year); - $periodEnd = mktime($hour, 59, 59, $month, $day, $year); - } - - if(isset($periodStart)) - $condition .= ' AND dateTime > \''.date('Y-m-d H:i:s', $periodStart).'\' AND dateTime <= \''.date('Y-m-d H:i:s', $periodEnd).'\''; - - // Check the search condition: - if($this->getRequestVar('search')) { - if(($this->getUserRole() == AJAX_CHAT_ADMIN || $this->getUserRole() == AJAX_CHAT_MODERATOR) && strpos($this->getRequestVar('search'), 'ip=') === 0) { - // Search for messages with the given IP: - $ip = substr($this->getRequestVar('search'), 3); - $condition .= ' AND (ip = '.$this->db->makeSafe($this->ipToStorageFormat($ip)).')'; - } else if(strpos($this->getRequestVar('search'), 'userID=') === 0) { - // Search for messages with the given userID: - $userID = substr($this->getRequestVar('search'), 7); - $condition .= ' AND (userID = '.$this->db->makeSafe($userID).')'; - } else { - // Use the search value as regular expression on message text and username: - $condition .= ' AND (userName REGEXP '.$this->db->makeSafe($this->getRequestVar('search')).' OR text REGEXP '.$this->db->makeSafe($this->getRequestVar('search')).')'; - } - } - - // If no period or search condition is given, just monitor the last messages on the given channel: - if(!isset($periodStart) && !$this->getRequestVar('search')) { - $condition .= ' AND NOW() < DATE_ADD(dateTime, interval '.$this->getConfig('logsRequestMessagesTimeDiff').' HOUR)'; - } - - return $condition; - } - - function getLogsViewMessagesXML() { - $sql = 'SELECT - id, - userID, - userName, - userRole, - channel AS channelID, - UNIX_TIMESTAMP(dateTime) AS timeStamp, - ip, - text - FROM - '.$this->getDataBaseTable('messages').' - WHERE - '.$this->getLogsViewCondition().' - ORDER BY - id - LIMIT '.$this->getConfig('logsRequestMessagesLimit').';'; - - // Create a new SQL query: - $result = $this->db->sqlQuery($sql); - - // Stop if an error occurs: - if($result->error()) { - echo $result->getError(); - die(); - } - - $xml = ''; - while($row = $result->fetch()) { - $xml .= 'getUserRole() == AJAX_CHAT_ADMIN || $this->getUserRole() == AJAX_CHAT_MODERATOR) { - $xml .= ' ip="'.$this->ipFromStorageFormat($row['ip']).'"'; - } - $xml .= '>'; - $xml .= 'encodeSpecialChars($row['userName']).']]>'; - $xml .= 'encodeSpecialChars($row['text']).']]>'; - $xml .= ''; - } - $result->free(); - - $xml .= ''; - - return $xml; - } - - function getLogsViewXMLMessages() { - $xml = ''; - $xml .= ''; - $xml .= $this->getInfoMessagesXML(); - $xml .= $this->getLogsViewMessagesXML(); - $xml .= ''; - return $xml; - } - - function purgeLogs() { - $sql = 'DELETE FROM - '.$this->getDataBaseTable('messages').' - WHERE - dateTime < DATE_SUB(NOW(), interval '.$this->getConfig('logsPurgeTimeDiff').' DAY);'; - - // Create a new SQL query: - $result = $this->db->sqlQuery($sql); - - // Stop if an error occurs: - if($result->error()) { - echo $result->getError(); - die(); - } - } - - function getInfoMessages($type=null) { - if(!isset($this->_infoMessages)) { - $this->_infoMessages = array(); - } - if($type) { - if(!isset($this->_infoMessages[$type])) { - $this->_infoMessages[$type] = array(); - } - return $this->_infoMessages[$type]; - } else { - return $this->_infoMessages; - } - } - - function addInfoMessage($info, $type='error') { - if(!isset($this->_infoMessages)) { - $this->_infoMessages = array(); - } - if(!isset($this->_infoMessages[$type])) { - $this->_infoMessages[$type] = array(); - } - if(!in_array($info, $this->_infoMessages[$type])) { - array_push($this->_infoMessages[$type], $info); - } - } - - function getRequestVars() { - return $this->_requestVars; - } - - function getRequestVar($key) { - if($this->_requestVars && isset($this->_requestVars[$key])) { - return $this->_requestVars[$key]; - } - return null; - } - - function setRequestVar($key, $value) { - if(!$this->_requestVars) { - $this->_requestVars = array(); - } - $this->_requestVars[$key] = $value; - } - - function getOnlineUsersData($channelIDs=null, $key=null, $value=null) { - if($this->_onlineUsersData === null) { - $this->_onlineUsersData = array(); - - $sql = 'SELECT - userID, - userName, - userRole, - channel, - UNIX_TIMESTAMP(dateTime) AS timeStamp, - ip - FROM - '.$this->getDataBaseTable('online').' - ORDER BY - userName;'; - - // Create a new SQL query: - $result = $this->db->sqlQuery($sql); - - // Stop if an error occurs: - if($result->error()) { - echo $result->getError(); - die(); - } - - while($row = $result->fetch()) { - $row['ip'] = $this->ipFromStorageFormat($row['ip']); - array_push($this->_onlineUsersData, $row); - } - - $result->free(); - } - - if($channelIDs || $key) { - $onlineUsersData = array(); - foreach($this->_onlineUsersData as $userData) { - if($channelIDs && !in_array($userData['channel'], $channelIDs)) { - continue; - } - if($key) { - if(!isset($userData[$key])) { - return $onlineUsersData; - } - if($value !== null) { - if($userData[$key] == $value) { - array_push($onlineUsersData, $userData); - } else { - continue; - } - } else { - array_push($onlineUsersData, $userData[$key]); - } - } else { - array_push($onlineUsersData, $userData); - } - } - return $onlineUsersData; - } - - return $this->_onlineUsersData; - } - - function removeUserFromOnlineUsersData($userID=null) { - if(!$this->_onlineUsersData) { - return; - } - $userID = ($userID === null) ? $this->getUserID() : $userID; - for($i=0; $i_onlineUsersData); $i++) { - if($this->_onlineUsersData[$i]['userID'] == $userID) { - array_splice($this->_onlineUsersData, $i, 1); - break; - } - } - } - - function resetOnlineUsersData() { - $this->_onlineUsersData = null; - } - - function getOnlineUsers($channelIDs=null) { - return $this->getOnlineUsersData($channelIDs, 'userName'); - } - - function getOnlineUserIDs($channelIDs=null) { - return $this->getOnlineUsersData($channelIDs, 'userID'); - } - - function startSession() { - if(!session_id()) { - // Set the session name: - session_name($this->getConfig('sessionName')); - - // Set session cookie parameters: - session_set_cookie_params( - 0, // The session is destroyed on logout anyway, so no use to set this - $this->getConfig('sessionCookiePath'), - $this->getConfig('sessionCookieDomain'), - $this->getConfig('sessionCookieSecure') - ); - - // Start the session: - session_start(); - - // We started a new session: - $this->_sessionNew = true; - } - } - - function destroySession() { - if($this->_sessionNew) { - // Delete all session variables: - $_SESSION = array(); - - // Delete the session cookie: - if (isset($_COOKIE[session_name()])) { - setcookie( - session_name(), - '', - time()-42000, - $this->getConfig('sessionCookiePath'), - $this->getConfig('sessionCookieDomain'), - $this->getConfig('sessionCookieSecure') - ); - } - - // Destroy the session: - session_destroy(); - } else { - // Unset all session variables starting with the sessionKeyPrefix: - foreach($_SESSION as $key=>$value) { - if(strpos($key, $this->getConfig('sessionKeyPrefix')) === 0) { - unset($_SESSION[$key]); - } - } - } - } - - function regenerateSessionID() { - if($this->_sessionNew) { - // Regenerate session id: - @session_regenerate_id(true); - } - } - - function getSessionVar($key, $prefix=null) { - if($prefix === null) - $prefix = $this->getConfig('sessionKeyPrefix'); - - // Return the session value if existing: - if(isset($_SESSION[$prefix.$key])) - return $_SESSION[$prefix.$key]; - else - return null; - } - - function setSessionVar($key, $value, $prefix=null) { - if($prefix === null) - $prefix = $this->getConfig('sessionKeyPrefix'); - - // Set the session value: - $_SESSION[$prefix.$key] = $value; - } - - function getSessionIP() { - return $this->getSessionVar('IP'); - } - - function setSessionIP($ip) { - $this->setSessionVar('IP', $ip); - } - - function getQueryUserName() { - return $this->getSessionVar('QueryUserName'); - } - - function setQueryUserName($userName) { - $this->setSessionVar('QueryUserName', $userName); - } - - function getInvitations() { - if($this->_invitations === null) { - $this->_invitations = array(); - - $sql = 'SELECT - channel - FROM - '.$this->getDataBaseTable('invitations').' - WHERE - userID='.$this->db->makeSafe($this->getUserID()).' - AND - DATE_SUB(NOW(), interval 1 DAY) < dateTime;'; - - // Create a new SQL query: - $result = $this->db->sqlQuery($sql); - - // Stop if an error occurs: - if($result->error()) { - echo $result->getError(); - die(); - } - - while($row = $result->fetch()) { - array_push($this->_invitations, $row['channel']); - } - - $result->free(); - } - return $this->_invitations; - } - - function removeExpiredInvitations() { - $sql = 'DELETE FROM - '.$this->getDataBaseTable('invitations').' - WHERE - DATE_SUB(NOW(), interval 1 DAY) > dateTime;'; - - // Create a new SQL query: - $result = $this->db->sqlQuery($sql); - - // Stop if an error occurs: - if($result->error()) { - echo $result->getError(); - die(); - } - } - - function addInvitation($userID, $channelID=null) { - $this->removeExpiredInvitations(); - - $channelID = ($channelID === null) ? $this->getChannel() : $channelID; - - $sql = 'INSERT INTO '.$this->getDataBaseTable('invitations').'( - userID, - channel, - dateTime - ) - VALUES ( - '.$this->db->makeSafe($userID).', - '.$this->db->makeSafe($channelID).', - NOW() - );'; - - // Create a new SQL query: - $result = $this->db->sqlQuery($sql); - - // Stop if an error occurs: - if($result->error()) { - echo $result->getError(); - die(); - } - } - - function removeInvitation($userID, $channelID=null) { - $channelID = ($channelID === null) ? $this->getChannel() : $channelID; - - $sql = 'DELETE FROM - '.$this->getDataBaseTable('invitations').' - WHERE - userID='.$this->db->makeSafe($userID).' - AND - channel='.$this->db->makeSafe($channelID).';'; - - // Create a new SQL query: - $result = $this->db->sqlQuery($sql); - - // Stop if an error occurs: - if($result->error()) { - echo $result->getError(); - die(); - } - } - - function getUserID() { - return $this->getSessionVar('UserID'); - } - - function setUserID($id) { - $this->setSessionVar('UserID', $id); - } - - function getUserName() { - return $this->getSessionVar('UserName'); - } - - function setUserName($name) { - $this->setSessionVar('UserName', $name); - } - - function getLoginUserName() { - return $this->getSessionVar('LoginUserName'); - } - - function setLoginUserName($name) { - $this->setSessionVar('LoginUserName', $name); - } - - function getUserRole() { - $userRole = $this->getSessionVar('UserRole'); - if($userRole === null) - return AJAX_CHAT_GUEST; - return $userRole; - } - - function setUserRole($role) { - $this->setSessionVar('UserRole', $role); - } - - function getChannel() { - return $this->getSessionVar('Channel'); - } - - function setChannel($channel) { - $this->setSessionVar('Channel', $channel); - - // Save the channel enter timestamp: - $this->setChannelEnterTimeStamp(time()); - - // Update the channel authentication for the socket server: - if($this->getConfig('socketServerEnabled')) { - $this->updateSocketAuthentication( - $this->getUserID(), - $this->getSocketRegistrationID(), - array($channel,$this->getPrivateMessageID()) - ); - } - - // Reset the logs view socket authentication session var: - if($this->getSessionVar('logsViewSocketAuthenticated')) { - $this->setSessionVar('logsViewSocketAuthenticated', false); - } - } - - function isLoggedIn() { - return (bool)$this->getSessionVar('LoggedIn'); - } - - function setLoggedIn($bool) { - $this->setSessionVar('LoggedIn', $bool); - } - - function getLoginTimeStamp() { - return $this->getSessionVar('LoginTimeStamp'); - } - - function setLoginTimeStamp($time) { - $this->setSessionVar('LoginTimeStamp', $time); - } - - function getChannelEnterTimeStamp() { - return $this->getSessionVar('ChannelEnterTimeStamp'); - } - - function setChannelEnterTimeStamp($time) { - $this->setSessionVar('ChannelEnterTimeStamp', $time); - } - - function getStatusUpdateTimeStamp() { - return $this->getSessionVar('StatusUpdateTimeStamp'); - } - - function setStatusUpdateTimeStamp($time) { - $this->setSessionVar('StatusUpdateTimeStamp', $time); - } - - function getInactiveCheckTimeStamp() { - return $this->getSessionVar('InactiveCheckTimeStamp'); - } - - function setInactiveCheckTimeStamp($time) { - $this->setSessionVar('InactiveCheckTimeStamp', $time); - } - - function getInsertedMessagesRate() { - return $this->getSessionVar('InsertedMessagesRate'); - } - - function setInsertedMessagesRate($rate) { - $this->setSessionVar('InsertedMessagesRate', $rate); - } - - function getInsertedMessagesRateTimeStamp() { - return $this->getSessionVar('InsertedMessagesRateTimeStamp'); - } - - function setInsertedMessagesRateTimeStamp($time) { - $this->setSessionVar('InsertedMessagesRateTimeStamp', $time); - } - - function getLangCode() { - // Get the langCode from request or cookie: - $langCodeCookie = isset($_COOKIE[$this->getConfig('sessionName').'_lang']) ? $_COOKIE[$this->getConfig('sessionName').'_lang'] : null; - $langCode = $this->getRequestVar('lang') ? $this->getRequestVar('lang') : $langCodeCookie; - // Check if the langCode is valid: - if(!in_array($langCode, $this->getConfig('langAvailable'))) { - // Determine the user language: - $language = new AJAXChatLanguage($this->getConfig('langAvailable'), $this->getConfig('langDefault')); - $langCode = $language->getLangCode(); - } - return $langCode; - } - - function setLangCodeCookie() { - setcookie( - $this->getConfig('sessionName').'_lang', - $this->getLangCode(), - time()+60*60*24*$this->getConfig('sessionCookieLifeTime'), - $this->getConfig('sessionCookiePath'), - $this->getConfig('sessionCookieDomain'), - $this->getConfig('sessionCookieSecure') - ); - } - - function removeUnsafeCharacters($str) { - // Remove NO-WS-CTL, non-whitespace control characters (RFC 2822), decimal 1–8, 11–12, 14–31, and 127: - return AJAXChatEncoding::removeUnsafeCharacters($str); - } - - function subString($str, $start=0, $length=null, $encoding='UTF-8') { - return AJAXChatString::subString($str, $start, $length, $encoding); - } - - function stringLength($str, $encoding='UTF-8') { - return AJAXChatString::stringLength($str, $encoding); - } - - function trimMessageText($text) { - return $this->trimString($text, 'UTF-8', $this->getConfig('messageTextMaxLength')); - } - - function trimUserName($userName) { - return $this->trimString($userName, null, $this->getConfig('userNameMaxLength'), true, true); - } - - function trimChannelName($channelName) { - return $this->trimString($channelName, null, null, true, true); - } - - function trimString($str, $sourceEncoding=null, $maxLength=null, $replaceWhitespace=false, $decodeEntities=false, $htmlEntitiesMap=null) { - // Make sure the string contains valid unicode: - $str = $this->convertToUnicode($str, $sourceEncoding); - - // Make sure the string contains no unsafe characters: - $str = $this->removeUnsafeCharacters($str); - - // Strip whitespace from the beginning and end of the string: - $str = trim($str); - - if($replaceWhitespace) { - // Replace any whitespace in the userName with the underscore "_": - $str = preg_replace('/\s/u', '_', $str); - } - - if($decodeEntities) { - // Decode entities: - $str = $this->decodeEntities($str, 'UTF-8', $htmlEntitiesMap); - } - - if($maxLength) { - // Cut the string to the allowed length: - $str = $this->subString($str, 0, $maxLength); - } - - return $str; - } - - function convertToUnicode($str, $sourceEncoding=null) { - if($sourceEncoding === null) { - $sourceEncoding = $this->getConfig('sourceEncoding'); - } - return $this->convertEncoding($str, $sourceEncoding, 'UTF-8'); - } - - function convertFromUnicode($str, $contentEncoding=null) { - if($contentEncoding === null) { - $contentEncoding = $this->getConfig('contentEncoding'); - } - return $this->convertEncoding($str, 'UTF-8', $contentEncoding); - } - - function convertEncoding($str, $charsetFrom, $charsetTo) { - return AJAXChatEncoding::convertEncoding($str, $charsetFrom, $charsetTo); - } - - function encodeEntities($str, $encoding='UTF-8', $convmap=null) { - return AJAXChatEncoding::encodeEntities($str, $encoding, $convmap); - } - - function decodeEntities($str, $encoding='UTF-8', $htmlEntitiesMap=null) { - return AJAXChatEncoding::decodeEntities($str, $encoding, $htmlEntitiesMap); - } - - function htmlEncode($str) { - return AJAXChatEncoding::htmlEncode($str, $this->getConfig('contentEncoding')); - } - - function encodeSpecialChars($str) { - return AJAXChatEncoding::encodeSpecialChars($str); - } - - function decodeSpecialChars($str) { - return AJAXChatEncoding::decodeSpecialChars($str); - } - - function ipToStorageFormat($ip) { - if(function_exists('inet_pton')) { - // ipv4 & ipv6: - return @inet_pton($ip); - } - // Only ipv4: - return @pack('N',@ip2long($ip)); - } - - function ipFromStorageFormat($ip) { - if(function_exists('inet_ntop')) { - // ipv4 & ipv6: - return @inet_ntop($ip); - } - // Only ipv4: - $unpacked = @unpack('Nlong',$ip); - if(isset($unpacked['long'])) { - return @long2ip($unpacked['long']); - } - return null; - } - - function getConfig($key, $subkey=null) { - if($subkey) - return $this->_config[$key][$subkey]; - else - return $this->_config[$key]; - } - - function setConfig($key, $subkey, $value) { - if($subkey) { - if(!isset($this->_config[$key])) { - $this->_config[$key] = array(); - } - $this->_config[$key][$subkey] = $value; - } else { - $this->_config[$key] = $value; - } - } - - function getLang($key=null) { - if(!$this->_lang) { - // Include the language file: - $lang = null; - require(AJAX_CHAT_PATH.'lib/lang/'.$this->getLangCode().'.php'); - $this->_lang = &$lang; - } - if($key === null) - return $this->_lang; - if(isset($this->_lang[$key])) - return $this->_lang[$key]; - return null; - } - - function getChatURL() { - if(defined('AJAX_CHAT_URL')) { - return AJAX_CHAT_URL; - } - - return - (isset($_SERVER['HTTPS']) ? 'https://' : 'http://'). - (isset($_SERVER['REMOTE_USER']) ? $_SERVER['REMOTE_USER'].'@' : ''). - (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : ($_SERVER['SERVER_NAME']. - (isset($_SERVER['HTTPS']) && $_SERVER['SERVER_PORT'] == 443 || $_SERVER['SERVER_PORT'] == 80 ? '' : ':'.$_SERVER['SERVER_PORT']))). - substr($_SERVER['SCRIPT_NAME'],0, strrpos($_SERVER['SCRIPT_NAME'], '/')+1); - } - - function getIDFromName($userName) { - $userDataArray = $this->getOnlineUsersData(null,'userName',$userName); - if($userDataArray && isset($userDataArray[0])) { - return $userDataArray[0]['userID']; - } - return null; - } - - function getNameFromID($userID) { - $userDataArray = $this->getOnlineUsersData(null,'userID',$userID); - if($userDataArray && isset($userDataArray[0])) { - return $userDataArray[0]['userName']; - } - return null; - } - - function getChannelFromID($userID) { - $userDataArray = $this->getOnlineUsersData(null,'userID',$userID); - if($userDataArray && isset($userDataArray[0])) { - return $userDataArray[0]['channel']; - } - return null; - } - - function getIPFromID($userID) { - $userDataArray = $this->getOnlineUsersData(null,'userID',$userID); - if($userDataArray && isset($userDataArray[0])) { - return $userDataArray[0]['ip']; - } - return null; - } - - function getRoleFromID($userID) { - $userDataArray = $this->getOnlineUsersData(null,'userID',$userID); - if($userDataArray && isset($userDataArray[0])) { - return $userDataArray[0]['userRole']; - } - return null; - } - - function getChannelNames() { - return array_flip($this->getChannels()); - } - - function getChannelIDFromChannelName($channelName) { - if(!$channelName) - return null; - $channels = $this->getAllChannels(); - if(array_key_exists($channelName,$channels)) { - return $channels[$channelName]; - } - $channelID = null; - // Check if the requested channel is the own private channel: - if($channelName == $this->getPrivateChannelName()) { - return $this->getPrivateChannelID(); - } - // Try to retrieve a private room ID: - $strlenChannelName = $this->stringLength($channelName); - $strlenPrefix = $this->stringLength($this->getConfig('privateChannelPrefix')); - $strlenSuffix = $this->stringLength($this->getConfig('privateChannelSuffix')); - if($this->subString($channelName,0,$strlenPrefix) == $this->getConfig('privateChannelPrefix') - && $this->subString($channelName,$strlenChannelName-$strlenSuffix) == $this->getConfig('privateChannelSuffix')) { - $userName = $this->subString( - $channelName, - $strlenPrefix, - $strlenChannelName-($strlenPrefix+$strlenSuffix) - ); - $userID = $this->getIDFromName($userName); - if($userID !== null) { - $channelID = $this->getPrivateChannelID($userID); - } - } - return $channelID; - } - - function getChannelNameFromChannelID($channelID) { - foreach($this->getAllChannels() as $key=>$value) { - if($value == $channelID) { - return $key; - } - } - // Try to retrieve a private room name: - if($channelID == $this->getPrivateChannelID()) { - return $this->getPrivateChannelName(); - } - $userName = $this->getNameFromID($channelID-$this->getConfig('privateChannelDiff')); - if($userName === null) { - return null; - } - return $this->getPrivateChannelName($userName); - } - - function getChannelName() { - return $this->getChannelNameFromChannelID($this->getChannel()); - } - - function getPrivateChannelName($userName=null) { - if($userName === null) { - $userName = $this->getUserName(); - } - return $this->getConfig('privateChannelPrefix').$userName.$this->getConfig('privateChannelSuffix'); - } - - function getPrivateChannelID($userID=null) { - if($userID === null) { - $userID = $this->getUserID(); - } - return $userID + $this->getConfig('privateChannelDiff'); - } - - function getPrivateMessageID($userID=null) { - if($userID === null) { - $userID = $this->getUserID(); - } - return $userID + $this->getConfig('privateMessageDiff'); - } - - function isAllowedToSendPrivateMessage() { - if($this->getConfig('allowPrivateMessages') || $this->getUserRole() == AJAX_CHAT_ADMIN) { - return true; - } - return false; - } - - function isAllowedToCreatePrivateChannel() { - if($this->getConfig('allowPrivateChannels')) { - switch($this->getUserRole()) { - case AJAX_CHAT_USER: - return true; - case AJAX_CHAT_MODERATOR: - return true; - case AJAX_CHAT_ADMIN: - return true; - default: - return false; - } - } - return false; - } - - function isAllowedToListHiddenUsers() { - // Hidden users are users within private or restricted channels: - switch($this->getUserRole()) { - case AJAX_CHAT_MODERATOR: - return true; - case AJAX_CHAT_ADMIN: - return true; - default: - return false; - } - } - - function isUserOnline($userID=null) { - $userID = ($userID === null) ? $this->getUserID() : $userID; - $userDataArray = $this->getOnlineUsersData(null,'userID',$userID); - if($userDataArray && count($userDataArray) > 0) { - return true; - } - return false; - } - - function isUserNameInUse($userName=null) { - $userName = ($userName === null) ? $this->getUserName() : $userName; - $userDataArray = $this->getOnlineUsersData(null,'userName',$userName); - if($userDataArray && count($userDataArray) > 0) { - return true; - } - return false; - } - - function isUserBanned($userName, $userID=null, $ip=null) { - if($userID !== null) { - $bannedUserDataArray = $this->getBannedUsersData('userID',$userID); - if($bannedUserDataArray && isset($bannedUserDataArray[0])) { - return true; - } - } - if($ip !== null) { - $bannedUserDataArray = $this->getBannedUsersData('ip',$ip); - if($bannedUserDataArray && isset($bannedUserDataArray[0])) { - return true; - } - } - $bannedUserDataArray = $this->getBannedUsersData('userName',$userName); - if($bannedUserDataArray && isset($bannedUserDataArray[0])) { - return true; - } - return false; - } - - function isMaxUsersLoggedIn() { - if(count($this->getOnlineUsersData()) >= $this->getConfig('maxUsersLoggedIn')) { - return true; - } - return false; - } - - function validateChannel($channelID) { - if($channelID === null) { - return false; - } - // Return true for normal channels the user has acces to: - if(in_array($channelID, $this->getChannels())) { - return true; - } - // Return true if the user is allowed to join his own private channel: - if($channelID == $this->getPrivateChannelID() && $this->isAllowedToCreatePrivateChannel()) { - return true; - } - // Return true if the user has been invited to a restricted or private channel: - if(in_array($channelID, $this->getInvitations())) { - return true; - } - // No valid channel, return false: - return false; - } - - function createGuestUserName() { - $maxLength = $this->getConfig('userNameMaxLength') - - $this->stringLength($this->getConfig('guestUserPrefix')) - - $this->stringLength($this->getConfig('guestUserSuffix')); - - // seed with microseconds since last "whole" second: - mt_srand((double)microtime()*1000000); - - // Create a random userName using numbers between 100000 and 999999: - $userName = substr(mt_rand(100000, 999999), 0, $maxLength); - - return $this->getConfig('guestUserPrefix').$userName.$this->getConfig('guestUserSuffix'); - } - - // Guest userIDs must not interfere with existing userIDs and must be lower than privateChannelDiff: - function createGuestUserID() { - // seed with microseconds since last "whole" second: - mt_srand((double)microtime()*1000000); - - return mt_rand($this->getConfig('minGuestUserID'), $this->getConfig('privateChannelDiff')-1); - } - - function getGuestUser() { - if(!$this->getConfig('allowGuestLogins')) - return null; - - if($this->getConfig('allowGuestUserName')) { - $maxLength = $this->getConfig('userNameMaxLength') - - $this->stringLength($this->getConfig('guestUserPrefix')) - - $this->stringLength($this->getConfig('guestUserSuffix')); - - // Trim guest userName: - $userName = $this->trimString($this->getRequestVar('userName'), null, $maxLength, true, true); - - // If given userName is invalid, create one: - if(!$userName) { - $userName = $this->createGuestUserName(); - } else { - // Add the guest users prefix and suffix to the given userName: - $userName = $this->getConfig('guestUserPrefix').$userName.$this->getConfig('guestUserSuffix'); - } - } else { - $userName = $this->createGuestUserName(); - } - - $userData = array(); - $userData['userID'] = $this->createGuestUserID(); - $userData['userName'] = $userName; - $userData['userRole'] = AJAX_CHAT_GUEST; - return $userData; - } - - function getCustomVar($key) { - if(!isset($this->_customVars)) - $this->_customVars = array(); - if(!isset($this->_customVars[$key])) - return null; - return $this->_customVars[$key]; - } - - function setCustomVar($key, $value) { - if(!isset($this->_customVars)) - $this->_customVars = array(); - $this->_customVars[$key] = $value; - } - - // Override to replace custom template tags: - // Return the replacement for the given tag (and given tagContent) - function replaceCustomTemplateTags($tag, $tagContent) { - return null; - } - - // Override to initialize custom configuration settings: - function initCustomConfig() { - } - - // Override to add custom request variables: - // Add values to the request variables array: $this->_requestVars['customVariable'] = null; - function initCustomRequestVars() { - } - - // Override to add custom session code right after the session has been started: - function initCustomSession() { - } - - // Override, to parse custom info requests: - // $infoRequest contains the current info request - // Add info responses using the method addInfoMessage($info, $type) - function parseCustomInfoRequest($infoRequest) { - } - - // Override to replace custom text: - // Return replaced text - // $text contains the whole message - function replaceCustomText(&$text) { - return $text; - } - - // Override to add custom commands: - // Return true if a custom command has been successfully parsed, else false - // $text contains the whole message, $textParts the message split up as words array - function parseCustomCommands($text, $textParts) { - return false; - } - - // Override to perform custom actions on new messages: - // Return true if message may be inserted, else false - // $text contains the whole message - function onNewMessage($text) { - return true; - } - - // Override to perform custom actions on new messages: - // Method to set the style cookie depending on user data - function setStyle() { - } - - // Override: - // Returns true if the userID of the logged in user is identical to the userID of the authentication system - // or the user is authenticated as guest in the chat and the authentication system - function revalidateUserID() { - return true; - } - - // Override: - // Returns an associative array containing userName, userID and userRole - // Returns null if login is invalid - function getValidLoginUserData() { - // Check if we have a valid registered user: - if(false) { - // Here is the place to check user authentication - } else { - // Guest users: - return $this->getGuestUser(); - } - } - - // Override: - // Store the channels the current user has access to - // Make sure channel names don't contain any whitespace - function &getChannels() { - if($this->_channels === null) { - $this->_channels = $this->getAllChannels(); - } - return $this->_channels; - } - - // Override: - // Store all existing channels - // Make sure channel names don't contain any whitespace - function &getAllChannels() { - if($this->_allChannels === null) { - $this->_allChannels = array(); - - // Default channel, public to everyone: - $this->_allChannels[$this->trimChannelName($this->getConfig('defaultChannelName'))] = $this->getConfig('defaultChannelID'); - } - return $this->_allChannels; - } - -} -?> \ No newline at end of file +initialize(); + } + + function initialize() { + // Initialize configuration settings: + $this->initConfig(); + + // Initialize the DataBase connection: + $this->initDataBaseConnection(); + + // Initialize request variables: + $this->initRequestVars(); + + // Initialize the chat session: + $this->initSession(); + + // Handle the browser request and send the response content: + $this->handleRequest(); + } + + function initConfig() { + $config = null; + if (!include(AJAX_CHAT_PATH.'lib/config.php')) { + echo('Error: Could not find a config.php file in "'.AJAX_CHAT_PATH.'"lib/". Check to make sure the file exists.'); + die(); + } + $this->_config = &$config; + + // Initialize custom configuration settings: + $this->initCustomConfig(); + } + + function initRequestVars() { + $this->_requestVars = array(); + $this->_requestVars['ajax'] = isset($_REQUEST['ajax']) ? true : false; + $this->_requestVars['userID'] = isset($_REQUEST['userID']) ? (int)$_REQUEST['userID'] : null; + $this->_requestVars['userName'] = isset($_REQUEST['userName']) ? $_REQUEST['userName'] : null; + $this->_requestVars['channelID'] = isset($_REQUEST['channelID']) ? (int)$_REQUEST['channelID'] : null; + $this->_requestVars['channelName'] = isset($_REQUEST['channelName']) ? $_REQUEST['channelName'] : null; + $this->_requestVars['text'] = isset($_POST['text']) ? $_POST['text'] : null; + $this->_requestVars['lastID'] = isset($_REQUEST['lastID']) ? (int)$_REQUEST['lastID'] : 0; + $this->_requestVars['login'] = isset($_REQUEST['login']) ? true : false; + $this->_requestVars['logout'] = isset($_REQUEST['logout']) ? true : false; + $this->_requestVars['password'] = isset($_REQUEST['password']) ? $_REQUEST['password'] : null; + $this->_requestVars['view'] = isset($_REQUEST['view']) ? $_REQUEST['view'] : null; + $this->_requestVars['year'] = isset($_REQUEST['year']) ? (int)$_REQUEST['year'] : null; + $this->_requestVars['month'] = isset($_REQUEST['month']) ? (int)$_REQUEST['month'] : null; + $this->_requestVars['day'] = isset($_REQUEST['day']) ? (int)$_REQUEST['day'] : null; + $this->_requestVars['hour'] = isset($_REQUEST['hour']) ? (int)$_REQUEST['hour'] : null; + $this->_requestVars['search'] = isset($_REQUEST['search']) ? $_REQUEST['search'] : null; + $this->_requestVars['shoutbox'] = isset($_REQUEST['shoutbox']) ? true : false; + $this->_requestVars['getInfos'] = isset($_REQUEST['getInfos']) ? $_REQUEST['getInfos'] : null; + $this->_requestVars['lang'] = isset($_REQUEST['lang']) ? $_REQUEST['lang'] : null; + $this->_requestVars['delete'] = isset($_REQUEST['delete']) ? (int)$_REQUEST['delete'] : null; + + // Initialize custom request variables: + $this->initCustomRequestVars(); + + // Remove slashes which have been added to user input strings if magic_quotes_gpc is On: + if(get_magic_quotes_gpc()) { + // It is safe to remove the slashes as we escape user data ourself + array_walk( + $this->_requestVars, + create_function( + '&$value, $key', + 'if(is_string($value)) $value = stripslashes($value);' + ) + ); + } + } + + function initDataBaseConnection() { + // Create a new database object: + $this->db = new AJAXChatDataBase( + $this->_config['dbConnection'] + ); + // Use a new database connection if no existing is given: + if(!$this->_config['dbConnection']['link']) { + // Connect to the database server: + $this->db->connect($this->_config['dbConnection']); + if($this->db->error()) { + echo $this->db->getError(); + die(); + } + // Select the database: + $this->db->select($this->_config['dbConnection']['name']); + if($this->db->error()) { + echo $this->db->getError(); + die(); + } + } + // Unset the dbConnection array for safety purposes: + unset($this->_config['dbConnection']); + } + + function getDataBaseTable($table) { + return ($this->db->getName() ? '`'.$this->db->getName().'`.'.$this->getConfig('dbTableNames',$table) : $this->getConfig('dbTableNames',$table)); + } + + function initSession() { + // Start the PHP session (if not already started): + $this->startSession(); + + if($this->isLoggedIn()) { + // Logout if we receive a logout request, the chat has been closed or the userID could not be revalidated: + if($this->getRequestVar('logout') || !$this->isChatOpen() || !$this->revalidateUserID()) { + $this->logout(); + return; + } + // Logout if the Session IP is not the same when logged in and ipCheck is enabled: + if($this->getConfig('ipCheck') && ($this->getSessionIP() === null || $this->getSessionIP() != $_SERVER['REMOTE_ADDR'])) { + $this->logout('IP'); + return; + } + } else if( + // Login if auto-login enabled or a login, userName or shoutbox parameter is given: + $this->getConfig('forceAutoLogin') || + $this->getRequestVar('login') || + $this->getRequestVar('userName') || + $this->getRequestVar('shoutbox') + ) { + $this->login(); + } + + // Initialize the view: + $this->initView(); + + if($this->getView() == 'chat') { + $this->initChatViewSession(); + } else if($this->getView() == 'logs') { + $this->initLogsViewSession(); + } + + if(!$this->getRequestVar('ajax') && !headers_sent()) { + // Set style cookie: + $this->setStyle(); + // Set langCode cookie: + $this->setLangCodeCookie(); + } + + $this->initCustomSession(); + } + + function initLogsViewSession() { + if($this->getConfig('socketServerEnabled')) { + if(!$this->getSessionVar('logsViewSocketAuthenticated')) { + $this->updateLogsViewSocketAuthentication(); + $this->setSessionVar('logsViewSocketAuthenticated', true); + } + } + } + + function updateLogsViewSocketAuthentication() { + if($this->getUserRole() != AJAX_CHAT_ADMIN) { + $channels = array(); + foreach($this->getChannels() as $channel) { + if($this->getConfig('logsUserAccessChannelList') && !in_array($channel, $this->getConfig('logsUserAccessChannelList'))) { + continue; + } + array_push($channels, $channel); + } + array_push($channels, $this->getPrivateMessageID()); + array_push($channels, $this->getPrivateChannelID()); + } else { + // The channelID "ALL" authenticates for all channels: + $channels = array('ALL'); + } + $this->updateSocketAuthentication( + $this->getUserID(), + $this->getSocketRegistrationID(), + $channels + ); + } + + function initChatViewSession() { + // If channel is not null we are logged in to the chat view: + if($this->getChannel() !== null) { + // Check if the current user has been logged out due to inactivity: + if(!$this->isUserOnline()) { + $this->logout(); + return; + } + if($this->getRequestVar('ajax')) { + $this->initChannel(); + $this->updateOnlineStatus(); + $this->checkAndRemoveInactive(); + } + } else { + if($this->getRequestVar('ajax')) { + // Set channel, insert login messages and add to online list on first ajax request in chat view: + $this->chatViewLogin(); + } + } + } + + function isChatOpen() { + if($this->getUserRole() == AJAX_CHAT_ADMIN) + return true; + if($this->getConfig('chatClosed')) + return false; + $time = time(); + if($this->getConfig('timeZoneOffset') !== null) { + // Subtract the server timezone offset and add the config timezone offset: + $time -= date('Z', $time); + $time += $this->getConfig('timeZoneOffset'); + } + // Check the opening hours: + if($this->getConfig('openingHour') < $this->getConfig('closingHour')) + { + if(($this->getConfig('openingHour') > date('G', $time)) || ($this->getConfig('closingHour') <= date('G', $time))) + return false; + } + else + { + if(($this->getConfig('openingHour') > date('G', $time)) && ($this->getConfig('closingHour') <= date('G', $time))) + return false; + } + // Check the opening weekdays: + if(!in_array(date('w', $time), $this->getConfig('openingWeekDays'))) + return false; + return true; + } + + function handleRequest() { + if($this->getRequestVar('ajax')) { + if($this->isLoggedIn()) { + // Parse info requests (for current userName, etc.): + $this->parseInfoRequests(); + + // Parse command requests (e.g. message deletion): + $this->parseCommandRequests(); + + // Parse message requests: + $this->initMessageHandling(); + } + // Send chat messages and online user list in XML format: + $this->sendXMLMessages(); + } else { + // Display XHTML content for non-ajax requests: + $this->sendXHTMLContent(); + } + } + + function parseCommandRequests() { + if($this->getRequestVar('delete') !== null) { + $this->deleteMessage($this->getRequestVar('delete')); + } + } + + function parseInfoRequests() { + if($this->getRequestVar('getInfos')) { + $infoRequests = explode(',', $this->getRequestVar('getInfos')); + foreach($infoRequests as $infoRequest) { + $this->parseInfoRequest($infoRequest); + } + } + } + + function parseInfoRequest($infoRequest) { + switch($infoRequest) { + case 'userID': + $this->addInfoMessage($this->getUserID(), 'userID'); + break; + case 'userName': + $this->addInfoMessage($this->getUserName(), 'userName'); + break; + case 'userRole': + $this->addInfoMessage($this->getUserRole(), 'userRole'); + break; + case 'channelID': + $this->addInfoMessage($this->getChannel(), 'channelID'); + break; + case 'channelName': + $this->addInfoMessage($this->getChannelName(), 'channelName'); + break; + case 'socketRegistrationID': + $this->addInfoMessage($this->getSocketRegistrationID(), 'socketRegistrationID'); + break; + default: + $this->parseCustomInfoRequest($infoRequest); + } + } + + function sendXHTMLContent() { + $httpHeader = new AJAXChatHTTPHeader($this->getConfig('contentEncoding'), $this->getConfig('contentType')); + + $template = new AJAXChatTemplate($this, $this->getTemplateFileName(), $httpHeader->getContentType()); + + // Send HTTP header: + $httpHeader->send(); + + // Send parsed template content: + echo $template->getParsedContent(); + } + + function getTemplateFileName() { + switch($this->getView()) { + case 'chat': + return AJAX_CHAT_PATH.'lib/template/loggedIn.html'; + case 'logs': + return AJAX_CHAT_PATH.'lib/template/logs.html'; + default: + return AJAX_CHAT_PATH.'lib/template/loggedOut.html'; + } + } + + function initView() { + $this->_view = null; + // "chat" is the default view: + $view = ($this->getRequestVar('view') === null) ? 'chat' : $this->getRequestVar('view'); + if($this->hasAccessTo($view)) { + $this->_view = $view; + } + } + + function getView() { + return $this->_view; + } + + function hasAccessTo($view) { + switch($view) { + case 'chat': + case 'teaser': + if($this->isLoggedIn()) { + return true; + } + return false; + case 'logs': + if($this->isLoggedIn() && ($this->getUserRole() == AJAX_CHAT_ADMIN || + ($this->getConfig('logsUserAccess') && + ($this->getUserRole() == AJAX_CHAT_MODERATOR || $this->getUserRole() == AJAX_CHAT_USER)) + )) { + return true; + } + return false; + default: + return false; + } + } + + function login() { + // Retrieve valid login user data (from request variables or session data): + $userData = $this->getValidLoginUserData(); + + if(!$userData) { + $this->addInfoMessage('errorInvalidUser'); + return false; + } + + // If the chat is closed, only the admin may login: + if(!$this->isChatOpen() && $userData['userRole'] != AJAX_CHAT_ADMIN) { + $this->addInfoMessage('errorChatClosed'); + return false; + } + + if(!$this->getConfig('allowGuestLogins') && $userData['userRole'] == AJAX_CHAT_GUEST) { + return false; + } + + // Check if userID or userName are already listed online: + if($this->isUserOnline($userData['userID']) || $this->isUserNameInUse($userData['userName'])) { + if($userData['userRole'] == AJAX_CHAT_USER || $userData['userRole'] == AJAX_CHAT_MODERATOR || $userData['userRole'] == AJAX_CHAT_ADMIN) { + // Set the registered user inactive and remove the inactive users so the user can be logged in again: + $this->setInactive($userData['userID'], $userData['userName']); + $this->removeInactive(); + } else { + $this->addInfoMessage('errorUserInUse'); + return false; + } + } + + // Check if user is banned: + if($userData['userRole'] != AJAX_CHAT_ADMIN && $this->isUserBanned($userData['userName'], $userData['userID'], $_SERVER['REMOTE_ADDR'])) { + $this->addInfoMessage('errorBanned'); + return false; + } + + // Check if the max number of users is logged in (not affecting moderators or admins): + if(!($userData['userRole'] == AJAX_CHAT_MODERATOR || $userData['userRole'] == AJAX_CHAT_ADMIN) && $this->isMaxUsersLoggedIn()) { + $this->addInfoMessage('errorMaxUsersLoggedIn'); + return false; + } + + // Use a new session id (if session has been started by the chat): + $this->regenerateSessionID(); + + // Log in: + $this->setUserID($userData['userID']); + $this->setUserName($userData['userName']); + $this->setLoginUserName($userData['userName']); + $this->setUserRole($userData['userRole']); + $this->setLoggedIn(true); + $this->setLoginTimeStamp(time()); + + // IP Security check variable: + $this->setSessionIP($_SERVER['REMOTE_ADDR']); + + // The client authenticates to the socket server using a socketRegistrationID: + if($this->getConfig('socketServerEnabled')) { + $this->setSocketRegistrationID( + md5(uniqid(rand(), true)) + ); + } + + // Add userID, userName and userRole to info messages: + $this->addInfoMessage($this->getUserID(), 'userID'); + $this->addInfoMessage($this->getUserName(), 'userName'); + $this->addInfoMessage($this->getUserRole(), 'userRole'); + + // Purge logs: + if($this->getConfig('logsPurgeLogs')) { + $this->purgeLogs(); + } + + return true; + } + + function chatViewLogin() { + $this->setChannel($this->getValidRequestChannelID()); + $this->addToOnlineList(); + + // Add channelID and channelName to info messages: + $this->addInfoMessage($this->getChannel(), 'channelID'); + $this->addInfoMessage($this->getChannelName(), 'channelName'); + + // Login message: + $text = '/login '.$this->getUserName(); + $this->insertChatBotMessage( + $this->getChannel(), + $text, + null, + 1 + ); + } + + function getValidRequestChannelID() { + $channelID = $this->getRequestVar('channelID'); + $channelName = $this->getRequestVar('channelName'); + // Check the given channelID, or get channelID from channelName: + if($channelID === null) { + if($channelName !== null) { + $channelID = $this->getChannelIDFromChannelName($channelName); + // channelName might need encoding conversion: + if($channelID === null) { + $channelID = $this->getChannelIDFromChannelName( + $this->trimChannelName($channelName, $this->getConfig('contentEncoding')) + ); + } + } + } + // Validate the resulting channelID: + if(!$this->validateChannel($channelID)) { + if($this->getChannel() !== null) { + return $this->getChannel(); + } + return $this->getConfig('defaultChannelID'); + } + return $channelID; + } + + function initChannel() { + $channelID = $this->getRequestVar('channelID'); + $channelName = $this->getRequestVar('channelName'); + if($channelID !== null) { + $this->switchChannel($this->getChannelNameFromChannelID($channelID)); + } else if($channelName !== null) { + if($this->getChannelIDFromChannelName($channelName) === null) { + // channelName might need encoding conversion: + $channelName = $this->trimChannelName($channelName, $this->getConfig('contentEncoding')); + } + $this->switchChannel($channelName); + } + } + + function logout($type=null) { + // Update the socket server authentication for the user: + if($this->getConfig('socketServerEnabled')) { + $this->updateSocketAuthentication($this->getUserID()); + } + if($this->isUserOnline()) { + $this->chatViewLogout($type); + } + $this->setLoggedIn(false); + $this->destroySession(); + + // Re-initialize the view: + $this->initView(); + } + + function chatViewLogout($type) { + $this->removeFromOnlineList(); + if($type !== null) { + $type = ' '.$type; + } + // Logout message + $text = '/logout '.$this->getUserName().$type; + $this->insertChatBotMessage( + $this->getChannel(), + $text, + null, + 1 + ); + } + + function switchChannel($channelName) { + $channelID = $this->getChannelIDFromChannelName($channelName); + + if($channelID !== null && $this->getChannel() == $channelID) { + // User is already in the given channel, return: + return; + } + + // Check if we have a valid channel: + if(!$this->validateChannel($channelID)) { + // Invalid channel: + $text = '/error InvalidChannelName '.$channelName; + $this->insertChatBotMessage( + $this->getPrivateMessageID(), + $text + ); + return; + } + + $oldChannel = $this->getChannel(); + + $this->setChannel($channelID); + $this->updateOnlineList(); + + // Channel leave message + $text = '/channelLeave '.$this->getUserName(); + $this->insertChatBotMessage( + $oldChannel, + $text, + null, + 1 + ); + + // Channel enter message + $text = '/channelEnter '.$this->getUserName(); + $this->insertChatBotMessage( + $this->getChannel(), + $text, + null, + 1 + ); + + $this->addInfoMessage($channelName, 'channelSwitch'); + $this->addInfoMessage($channelID, 'channelID'); + $this->_requestVars['lastID'] = 0; + } + + function addToOnlineList() { + $sql = 'INSERT INTO '.$this->getDataBaseTable('online').'( + userID, + userName, + userRole, + channel, + dateTime, + ip + ) + VALUES ( + '.$this->db->makeSafe($this->getUserID()).', + '.$this->db->makeSafe($this->getUserName()).', + '.$this->db->makeSafe($this->getUserRole()).', + '.$this->db->makeSafe($this->getChannel()).', + NOW(), + '.$this->db->makeSafe($this->ipToStorageFormat($_SERVER['REMOTE_ADDR'])).' + );'; + + // Create a new SQL query: + $result = $this->db->sqlQuery($sql); + + // Stop if an error occurs: + if($result->error()) { + echo $result->getError(); + die(); + } + + $this->resetOnlineUsersData(); + } + + function removeFromOnlineList() { + $sql = 'DELETE FROM + '.$this->getDataBaseTable('online').' + WHERE + userID = '.$this->db->makeSafe($this->getUserID()).';'; + + // Create a new SQL query: + $result = $this->db->sqlQuery($sql); + + // Stop if an error occurs: + if($result->error()) { + echo $result->getError(); + die(); + } + + $this->removeUserFromOnlineUsersData(); + } + + function updateOnlineList() { + $sql = 'UPDATE + '.$this->getDataBaseTable('online').' + SET + userName = '.$this->db->makeSafe($this->getUserName()).', + channel = '.$this->db->makeSafe($this->getChannel()).', + dateTime = NOW(), + ip = '.$this->db->makeSafe($this->ipToStorageFormat($_SERVER['REMOTE_ADDR'])).' + WHERE + userID = '.$this->db->makeSafe($this->getUserID()).';'; + + // Create a new SQL query: + $result = $this->db->sqlQuery($sql); + + // Stop if an error occurs: + if($result->error()) { + echo $result->getError(); + die(); + } + + $this->resetOnlineUsersData(); + } + + function initMessageHandling() { + // Don't handle messages if we are not in chat view: + if($this->getView() != 'chat') { + return; + } + + // Check if we have been uninvited from a private or restricted channel: + if(!$this->validateChannel($this->getChannel())) { + // Switch to the default channel: + $this->switchChannel($this->getChannelNameFromChannelID($this->getConfig('defaultChannelID'))); + return; + } + + if($this->getRequestVar('text') !== null) { + $this->insertMessage($this->getRequestVar('text')); + } + } + + function insertParsedMessage($text) { + + // If a queryUserName is set, sent all messages as private messages to this userName: + if($this->getQueryUserName() !== null && strpos($text, '/') !== 0) { + $text = '/msg '.$this->getQueryUserName().' '.$text; + } + + // Parse IRC-style commands: + if(strpos($text, '/') === 0) { + $textParts = explode(' ', $text); + + switch($textParts[0]) { + + // Channel switch: + case '/join': + $this->insertParsedMessageJoin($textParts); + break; + + // Logout: + case '/quit': + $this->logout(); + break; + + // Private message: + case '/msg': + case '/describe': + $this->insertParsedMessagePrivMsg($textParts); + break; + + // Invitation: + case '/invite': + $this->insertParsedMessageInvite($textParts); + break; + + // Uninvitation: + case '/uninvite': + $this->insertParsedMessageUninvite($textParts); + break; + + // Private messaging: + case '/query': + $this->insertParsedMessageQuery($textParts); + break; + + // Kicking offending users from the chat: + case '/kick': + $this->insertParsedMessageKick($textParts); + break; + + // Listing banned users: + case '/bans': + $this->insertParsedMessageBans($textParts); + break; + + // Unban user (remove from ban list): + case '/unban': + $this->insertParsedMessageUnban($textParts); + break; + + // Describing actions: + case '/me': + case '/action': + $this->insertParsedMessageAction($textParts); + break; + + + // Listing online Users: + case '/who': + $this->insertParsedMessageWho($textParts); + break; + + // Listing available channels: + case '/list': + $this->insertParsedMessageList($textParts); + break; + + // Retrieving the channel of a User: + case '/whereis': + $this->insertParsedMessageWhereis($textParts); + break; + + // Listing information about a User: + case '/whois': + $this->insertParsedMessageWhois($textParts); + break; + + // Rolling dice: + case '/roll': + $this->insertParsedMessageRoll($textParts); + break; + + // Switching userName: + case '/nick': + $this->insertParsedMessageNick($textParts); + break; + + // Custom or unknown command: + default: + if(!$this->parseCustomCommands($text, $textParts)) { + $this->insertChatBotMessage( + $this->getPrivateMessageID(), + '/error UnknownCommand '.$textParts[0] + ); + } + } + + } else { + // No command found, just insert the plain message: + $this->insertCustomMessage( + $this->getUserID(), + $this->getUserName(), + $this->getUserRole(), + $this->getChannel(), + $text + ); + } + } + + function insertParsedMessageJoin($textParts) { + if(count($textParts) == 1) { + // join with no arguments is the own private channel, if allowed: + if($this->isAllowedToCreatePrivateChannel()) { + // Private channels are identified by square brackets: + $this->switchChannel($this->getChannelNameFromChannelID($this->getPrivateChannelID())); + } else { + $this->insertChatBotMessage( + $this->getPrivateMessageID(), + '/error MissingChannelName' + ); + } + } else { + $this->switchChannel($textParts[1]); + } + } + + function insertParsedMessagePrivMsg($textParts) { + if($this->isAllowedToSendPrivateMessage()) { + if(count($textParts) < 3) { + if(count($textParts) == 2) { + $this->insertChatBotMessage( + $this->getPrivateMessageID(), + '/error MissingText' + ); + } else { + $this->insertChatBotMessage( + $this->getPrivateMessageID(), + '/error MissingUserName' + ); + } + } else { + // Get UserID from UserName: + $toUserID = $this->getIDFromName($textParts[1]); + if($toUserID === null) { + if($this->getQueryUserName() !== null) { + // Close the current query: + $this->insertMessage('/query'); + } else { + $this->insertChatBotMessage( + $this->getPrivateMessageID(), + '/error UserNameNotFound '.$textParts[1] + ); + } + } else { + // Insert /privaction command if /describe is used: + $command = ($textParts[0] == '/describe') ? '/privaction' : '/privmsg'; + // Copy of private message to current User: + $this->insertCustomMessage( + $this->getUserID(), + $this->getUserName(), + $this->getUserRole(), + $this->getPrivateMessageID(), + $command.'to '.$textParts[1].' '.implode(' ', array_slice($textParts, 2)) + ); + // Private message to requested User: + $this->insertCustomMessage( + $this->getUserID(), + $this->getUserName(), + $this->getUserRole(), + $this->getPrivateMessageID($toUserID), + $command.' '.implode(' ', array_slice($textParts, 2)) + ); + } + } + } else { + $this->insertChatBotMessage( + $this->getPrivateMessageID(), + '/error PrivateMessageNotAllowed' + ); + } + } + + function insertParsedMessageInvite($textParts) { + if($this->getChannel() == $this->getPrivateChannelID() || in_array($this->getChannel(), $this->getChannels())) { + if(count($textParts) == 1) { + $this->insertChatBotMessage( + $this->getPrivateMessageID(), + '/error MissingUserName' + ); + } else { + $toUserID = $this->getIDFromName($textParts[1]); + if($toUserID === null) { + $this->insertChatBotMessage( + $this->getPrivateMessageID(), + '/error UserNameNotFound '.$textParts[1] + ); + } else { + // Add the invitation to the database: + $this->addInvitation($toUserID); + $invitationChannelName = $this->getChannelNameFromChannelID($this->getChannel()); + // Copy of invitation to current User: + $this->insertChatBotMessage( + $this->getPrivateMessageID(), + '/inviteto '.$textParts[1].' '.$invitationChannelName + ); + // Invitation to requested User: + $this->insertChatBotMessage( + $this->getPrivateMessageID($toUserID), + '/invite '.$this->getUserName().' '.$invitationChannelName + ); + } + } + } else { + $this->insertChatBotMessage( + $this->getPrivateMessageID(), + '/error InviteNotAllowed' + ); + } + } + + function insertParsedMessageUninvite($textParts) { + if($this->getChannel() == $this->getPrivateChannelID() || in_array($this->getChannel(), $this->getChannels())) { + if(count($textParts) == 1) { + $this->insertChatBotMessage( + $this->getPrivateMessageID(), + '/error MissingUserName' + ); + } else { + $toUserID = $this->getIDFromName($textParts[1]); + if($toUserID === null) { + $this->insertChatBotMessage( + $this->getPrivateMessageID(), + '/error UserNameNotFound '.$textParts[1] + ); + } else { + // Remove the invitation from the database: + $this->removeInvitation($toUserID); + $invitationChannelName = $this->getChannelNameFromChannelID($this->getChannel()); + // Copy of uninvitation to current User: + $this->insertChatBotMessage( + $this->getPrivateMessageID(), + '/uninviteto '.$textParts[1].' '.$invitationChannelName + ); + // Uninvitation to requested User: + $this->insertChatBotMessage( + $this->getPrivateMessageID($toUserID), + '/uninvite '.$this->getUserName().' '.$invitationChannelName + ); + } + } + } else { + $this->insertChatBotMessage( + $this->getPrivateMessageID(), + '/error UninviteNotAllowed' + ); + } + } + + function insertParsedMessageQuery($textParts) { + if($this->isAllowedToSendPrivateMessage()) { + if(count($textParts) == 1) { + if($this->getQueryUserName() !== null) { + $this->insertChatBotMessage( + $this->getPrivateMessageID(), + '/queryClose '.$this->getQueryUserName() + ); + // Close the current query: + $this->setQueryUserName(null); + } else { + $this->insertChatBotMessage( + $this->getPrivateMessageID(), + '/error NoOpenQuery' + ); + } + } else { + if($this->getIDFromName($textParts[1]) === null) { + $this->insertChatBotMessage( + $this->getPrivateMessageID(), + '/error UserNameNotFound '.$textParts[1] + ); + } else { + if($this->getQueryUserName() !== null) { + // Close the current query: + $this->insertMessage('/query'); + } + // Open a query to the requested user: + $this->setQueryUserName($textParts[1]); + $this->insertChatBotMessage( + $this->getPrivateMessageID(), + '/queryOpen '.$textParts[1] + ); + } + } + } else { + $this->insertChatBotMessage( + $this->getPrivateMessageID(), + '/error PrivateMessageNotAllowed' + ); + } + } + + function insertParsedMessageKick($textParts) { + // Only moderators/admins may kick users: + if($this->getUserRole() == AJAX_CHAT_ADMIN || $this->getUserRole() == AJAX_CHAT_MODERATOR) { + if(count($textParts) == 1) { + $this->insertChatBotMessage( + $this->getPrivateMessageID(), + '/error MissingUserName' + ); + } else { + // Get UserID from UserName: + $kickUserID = $this->getIDFromName($textParts[1]); + if($kickUserID === null) { + $this->insertChatBotMessage( + $this->getPrivateMessageID(), + '/error UserNameNotFound '.$textParts[1] + ); + } else { + // Check the role of the user to kick: + $kickUserRole = $this->getRoleFromID($kickUserID); + if($kickUserRole == AJAX_CHAT_ADMIN || ($kickUserRole == AJAX_CHAT_MODERATOR && $this->getUserRole() != AJAX_CHAT_ADMIN)) { + // Admins and moderators may not be kicked: + $this->insertChatBotMessage( + $this->getPrivateMessageID(), + '/error KickNotAllowed '.$textParts[1] + ); + } else { + // Kick user and insert message: + $channel = $this->getChannelFromID($kickUserID); + $banMinutes = (count($textParts) > 2) ? $textParts[2] : null; + $this->kickUser($textParts[1], $banMinutes, $kickUserID); + // If no channel found, user logged out before he could be kicked + if($channel !== null) { + $this->insertChatBotMessage( + $channel, + '/kick '.$textParts[1], + null, + 1 + ); + // Send a copy of the message to the current user, if not in the channel: + if($channel != $this->getChannel()) { + $this->insertChatBotMessage( + $this->getPrivateMessageID(), + '/kick '.$textParts[1], + null, + 1 + ); + } + } + } + } + } + } else { + $this->insertChatBotMessage( + $this->getPrivateMessageID(), + '/error CommandNotAllowed '.$textParts[0] + ); + } + } + + function insertParsedMessageBans($textParts) { + // Only moderators/admins may see the list of banned users: + if($this->getUserRole() == AJAX_CHAT_ADMIN || $this->getUserRole() == AJAX_CHAT_MODERATOR) { + $this->removeExpiredBans(); + $bannedUsers = $this->getBannedUsers(); + if(count($bannedUsers) > 0) { + $this->insertChatBotMessage( + $this->getPrivateMessageID(), + '/bans '.implode(' ', $bannedUsers) + ); + } else { + $this->insertChatBotMessage( + $this->getPrivateMessageID(), + '/bansEmpty -' + ); + } + } else { + $this->insertChatBotMessage( + $this->getPrivateMessageID(), + '/error CommandNotAllowed '.$textParts[0] + ); + } + } + + function insertParsedMessageUnban($textParts) { + // Only moderators/admins may unban users: + if($this->getUserRole() == AJAX_CHAT_ADMIN || $this->getUserRole() == AJAX_CHAT_MODERATOR) { + $this->removeExpiredBans(); + if(count($textParts) == 1) { + $this->insertChatBotMessage( + $this->getPrivateMessageID(), + '/error MissingUserName' + ); + } else { + if(!in_array($textParts[1], $this->getBannedUsers())) { + $this->insertChatBotMessage( + $this->getPrivateMessageID(), + '/error UserNameNotFound '.$textParts[1] + ); + } else { + // Unban user and insert message: + $this->unbanUser($textParts[1]); + $this->insertChatBotMessage( + $this->getPrivateMessageID(), + '/unban '.$textParts[1] + ); + } + } + } else { + $this->insertChatBotMessage( + $this->getPrivateMessageID(), + '/error CommandNotAllowed '.$textParts[0] + ); + } + } + + function insertParsedMessageAction($textParts) { + if(count($textParts) == 1) { + $this->insertChatBotMessage( + $this->getPrivateMessageID(), + '/error MissingText' + ); + } else { + if($this->getQueryUserName() !== null) { + // If we are in query mode, sent the action to the query user: + $this->insertMessage('/describe '.$this->getQueryUserName().' '.implode(' ', array_slice($textParts, 1))); + } else { + $this->insertCustomMessage( + $this->getUserID(), + $this->getUserName(), + $this->getUserRole(), + $this->getChannel(), + implode(' ', $textParts) + ); + } + } + } + + function insertParsedMessageWho($textParts) { + if(count($textParts) == 1) { + if($this->isAllowedToListHiddenUsers()) { + // List online users from any channel: + $this->insertChatBotMessage( + $this->getPrivateMessageID(), + '/who '.implode(' ', $this->getOnlineUsers()) + ); + } else { + // Get online users for all accessible channels: + $channels = $this->getChannels(); + // Add the own private channel if allowed: + if($this->isAllowedToCreatePrivateChannel()) { + array_push($channels, $this->getPrivateChannelID()); + } + // Add the invitation channels: + foreach($this->getInvitations() as $channelID) { + if(!in_array($channelID, $channels)) { + array_push($channels, $channelID); + } + } + $this->insertChatBotMessage( + $this->getPrivateMessageID(), + '/who '.implode(' ', $this->getOnlineUsers($channels)) + ); + } + } else { + $channelName = $textParts[1]; + $channelID = $this->getChannelIDFromChannelName($channelName); + if(!$this->validateChannel($channelID)) { + // Invalid channel: + $this->insertChatBotMessage( + $this->getPrivateMessageID(), + '/error InvalidChannelName '.$channelName + ); + } else { + // Get online users for the given channel: + $onlineUsers = $this->getOnlineUsers(array($channelID)); + if(count($onlineUsers) > 0) { + $this->insertChatBotMessage( + $this->getPrivateMessageID(), + '/whoChannel '.$channelName.' '.implode(' ', $onlineUsers) + ); + } else { + $this->insertChatBotMessage( + $this->getPrivateMessageID(), + '/whoEmpty -' + ); + } + } + } + } + + function insertParsedMessageList($textParts) { + // Get the names of all accessible channels: + $channelNames = $this->getChannelNames(); + // Add the own private channel, if allowed: + if($this->isAllowedToCreatePrivateChannel()) { + array_push($channelNames, $this->getPrivateChannelName()); + } + // Add the invitation channels: + foreach($this->getInvitations() as $channelID) { + $channelName = $this->getChannelNameFromChannelID($channelID); + if($channelName !== null && !in_array($channelName, $channelNames)) { + array_push($channelNames, $channelName); + } + } + $this->insertChatBotMessage( + $this->getPrivateMessageID(), + '/list '.implode(' ', $channelNames) + ); + } + + function insertParsedMessageWhereis($textParts) { + if(count($textParts) == 1) { + $this->insertChatBotMessage( + $this->getPrivateMessageID(), + '/error MissingUserName' + ); + } else { + // Get UserID from UserName: + $whereisUserID = $this->getIDFromName($textParts[1]); + if($whereisUserID === null) { + $this->insertChatBotMessage( + $this->getPrivateMessageID(), + '/error UserNameNotFound '.$textParts[1] + ); + } else { + $channelID = $this->getChannelFromID($whereisUserID); + if($this->validateChannel($channelID)) { + $channelName = $this->getChannelNameFromChannelID($channelID); + } else { + $channelName = null; + } + if($channelName === null) { + $this->insertChatBotMessage( + $this->getPrivateMessageID(), + '/error UserNameNotFound '.$textParts[1] + ); + } else { + // List user information: + $this->insertChatBotMessage( + $this->getPrivateMessageID(), + '/whereis '.$textParts[1].' '.$channelName + ); + } + } + } + } + + function insertParsedMessageWhois($textParts) { + // Only moderators/admins: + if($this->getUserRole() == AJAX_CHAT_ADMIN || $this->getUserRole() == AJAX_CHAT_MODERATOR) { + if(count($textParts) == 1) { + $this->insertChatBotMessage( + $this->getPrivateMessageID(), + '/error MissingUserName' + ); + } else { + // Get UserID from UserName: + $whoisUserID = $this->getIDFromName($textParts[1]); + if($whoisUserID === null) { + $this->insertChatBotMessage( + $this->getPrivateMessageID(), + '/error UserNameNotFound '.$textParts[1] + ); + } else { + // List user information: + $this->insertChatBotMessage( + $this->getPrivateMessageID(), + '/whois '.$textParts[1].' '.$this->getIPFromID($whoisUserID) + ); + } + } + } else { + $this->insertChatBotMessage( + $this->getPrivateMessageID(), + '/error CommandNotAllowed '.$textParts[0] + ); + } + } + + function insertParsedMessageRoll($textParts) { + if(count($textParts) == 1) { + // default is one d6: + $text = '/roll '.$this->getUserName().' 1d6 '.$this->rollDice(6); + } else { + $diceParts = explode('d', $textParts[1]); + if(count($diceParts) == 2) { + $number = (int)$diceParts[0]; + $sides = (int)$diceParts[1]; + + // Dice number must be an integer between 1 and 100, else roll only one: + $number = ($number > 0 && $number <= 100) ? $number : 1; + + // Sides must be an integer between 1 and 100, else take 6: + $sides = ($sides > 0 && $sides <= 100) ? $sides : 6; + + $text = '/roll '.$this->getUserName().' '.$number.'d'.$sides.' '; + for($i=0; $i<$number; $i++) { + if($i != 0) + $text .= ','; + $text .= $this->rollDice($sides); + } + } else { + // if dice syntax is invalid, roll one d6: + $text = '/roll '.$this->getUserName().' 1d6 '.$this->rollDice(6); + } + } + $this->insertChatBotMessage( + $this->getChannel(), + $text + ); + } + + function insertParsedMessageNick($textParts) { + if(!$this->getConfig('allowNickChange') || + (!$this->getConfig('allowGuestUserName') && $this->getUserRole() == AJAX_CHAT_GUEST)) { + $this->insertChatBotMessage( + $this->getPrivateMessageID(), + '/error CommandNotAllowed '.$textParts[0] + ); + } else if(count($textParts) == 1) { + $this->insertChatBotMessage( + $this->getPrivateMessageID(), + '/error MissingUserName' + ); + } else { + $newUserName = implode(' ', array_slice($textParts, 1)); + if($newUserName == $this->getLoginUserName()) { + // Allow the user to regain the original login userName: + $prefix = ''; + $suffix = ''; + } else if($this->getUserRole() == AJAX_CHAT_GUEST) { + $prefix = $this->getConfig('guestUserPrefix'); + $suffix = $this->getConfig('guestUserSuffix'); + } else { + $prefix = $this->getConfig('changedNickPrefix'); + $suffix = $this->getConfig('changedNickSuffix'); + } + $maxLength = $this->getConfig('userNameMaxLength') + - $this->stringLength($prefix) + - $this->stringLength($suffix); + $newUserName = $this->trimString($newUserName, 'UTF-8', $maxLength, true); + if(!$newUserName) { + $this->insertChatBotMessage( + $this->getPrivateMessageID(), + '/error InvalidUserName' + ); + } else { + $newUserName = $prefix.$newUserName.$suffix; + if($this->isUserNameInUse($newUserName)) { + $this->insertChatBotMessage( + $this->getPrivateMessageID(), + '/error UserNameInUse' + ); + } else { + $oldUserName = $this->getUserName(); + $this->setUserName($newUserName); + $this->updateOnlineList(); + // Add info message to update the client-side stored userName: + $this->addInfoMessage($this->getUserName(), 'userName'); + $this->insertChatBotMessage( + $this->getChannel(), + '/nick '.$oldUserName.' '.$newUserName, + null, + 2 + ); + } + } + } + } + + function insertMessage($text) { + if(!$this->isAllowedToWriteMessage()) + return; + + if(!$this->floodControl()) + return; + + $text = $this->trimMessageText($text); + if($text == '') + return; + + if(!$this->onNewMessage($text)) + return; + + $text = $this->replaceCustomText($text); + + $this->insertParsedMessage($text); + } + + function deleteMessage($messageID) { + // Retrieve the channel of the given message: + $sql = 'SELECT + channel + FROM + '.$this->getDataBaseTable('messages').' + WHERE + id='.$this->db->makeSafe($messageID).';'; + + // Create a new SQL query: + $result = $this->db->sqlQuery($sql); + + // Stop if an error occurs: + if($result->error()) { + echo $result->getError(); + die(); + } + + $row = $result->fetch(); + + if($row['channel'] !== null) { + $channel = $row['channel']; + + if($this->getUserRole() == AJAX_CHAT_ADMIN) { + $condition = ''; + } else if($this->getUserRole() == AJAX_CHAT_MODERATOR) { + $condition = ' AND + NOT (userRole='.$this->db->makeSafe(AJAX_CHAT_ADMIN).') + AND + NOT (userRole='.$this->db->makeSafe(AJAX_CHAT_CHATBOT).')'; + } else if($this->getUserRole() == AJAX_CHAT_USER && $this->getConfig('allowUserMessageDelete')) { + $condition = 'AND + ( + userID='.$this->db->makeSafe($this->getUserID()).' + OR + ( + channel = '.$this->db->makeSafe($this->getPrivateMessageID()).' + OR + channel = '.$this->db->makeSafe($this->getPrivateChannelID()).' + ) + AND + NOT (userRole='.$this->db->makeSafe(AJAX_CHAT_ADMIN).') + AND + NOT (userRole='.$this->db->makeSafe(AJAX_CHAT_CHATBOT).') + )'; + } else { + return false; + } + + // Remove given message from the database: + $sql = 'DELETE FROM + '.$this->getDataBaseTable('messages').' + WHERE + id='.$this->db->makeSafe($messageID).' + '.$condition.';'; + + // Create a new SQL query: + $result = $this->db->sqlQuery($sql); + + // Stop if an error occurs: + if($result->error()) { + echo $result->getError(); + die(); + } + + if($result->affectedRows() == 1) { + // Insert a deletion command to remove the message from the clients chatlists: + $this->insertChatBotMessage($channel, '/delete '.$messageID); + return true; + } + } + return false; + } + + function floodControl() { + // Moderators and Admins need no flood control: + if($this->getUserRole() == AJAX_CHAT_MODERATOR || $this->getUserRole() == AJAX_CHAT_ADMIN) { + return true; + } + $time = time(); + // Check the time of the last inserted message: + if($this->getInsertedMessagesRateTimeStamp()+60 < $time) { + $this->setInsertedMessagesRateTimeStamp($time); + $this->setInsertedMessagesRate(1); + } else { + // Increase the inserted messages rate: + $rate = $this->getInsertedMessagesRate()+1; + $this->setInsertedMessagesRate($rate); + // Check if message rate is too high: + if($rate > $this->getConfig('maxMessageRate')) { + $this->insertChatBotMessage( + $this->getPrivateMessageID(), + '/error MaxMessageRate' + ); + // Return false so the message is not inserted: + return false; + } + } + return true; + } + + function isAllowedToWriteMessage() { + if($this->getUserRole() != AJAX_CHAT_GUEST) + return true; + if($this->getConfig('allowGuestWrite')) + return true; + return false; + } + + function insertChatBotMessage($channelID, $messageText, $ip=null, $mode=0) { + $this->insertCustomMessage( + $this->getConfig('chatBotID'), + $this->getConfig('chatBotName'), + AJAX_CHAT_CHATBOT, + $channelID, + $messageText, + $ip, + $mode + ); + } + + function insertCustomMessage($userID, $userName, $userRole, $channelID, $text, $ip=null, $mode=0) { + // The $mode parameter is used for socket updates: + // 0 = normal messages + // 1 = channel messages (e.g. login/logout, channel enter/leave, kick) + // 2 = messages with online user updates (nick) + + $ip = $ip ? $ip : $_SERVER['REMOTE_ADDR']; + + $sql = 'INSERT INTO '.$this->getDataBaseTable('messages').'( + userID, + userName, + userRole, + channel, + dateTime, + ip, + text + ) + VALUES ( + '.$this->db->makeSafe($userID).', + '.$this->db->makeSafe($userName).', + '.$this->db->makeSafe($userRole).', + '.$this->db->makeSafe($channelID).', + NOW(), + '.$this->db->makeSafe($this->ipToStorageFormat($ip)).', + '.$this->db->makeSafe($text).' + );'; + + // Create a new SQL query: + $result = $this->db->sqlQuery($sql); + + // Stop if an error occurs: + if($result->error()) { + echo $result->getError(); + die(); + } + + if($this->getConfig('socketServerEnabled')) { + $this->sendSocketMessage( + $this->getSocketBroadcastMessage( + $this->db->getLastInsertedID(), + time(), + $userID, + $userName, + $userRole, + $channelID, + $text, + $mode + ) + ); + } + } + + function getSocketBroadcastMessage( + $messageID, + $timeStamp, + $userID, + $userName, + $userRole, + $channelID, + $text, + $mode + ) { + // The $mode parameter: + // 0 = normal messages + // 1 = channel messages (e.g. login/logout, channel enter/leave, kick) + // 2 = messages with online user updates (nick) + + // Get the message XML content: + $xml = ''; + if($mode) { + // Add the list of online users if the user list has been updated ($mode > 0): + $xml .= $this->getChatViewOnlineUsersXML(array($channelID)); + } + if($mode != 1 || $this->getConfig('showChannelMessages')) { + $xml .= ''; + $xml .= $this->getChatViewMessageXML( + $messageID, + $timeStamp, + $userID, + $userName, + $userRole, + $channelID, + $text + ); + $xml .= ''; + } + $xml .= ''; + return $xml; + } + + function sendSocketMessage($message) { + // Open a TCP socket connection to the socket server: + if($socket = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP)) { + if(@socket_connect($socket, $this->getConfig('socketServerIP'), $this->getConfig('socketServerPort'))) { + // Append a null-byte to the string as EOL (End Of Line) character + // which is required by Flash XML socket communication: + $message .= "\0"; + @socket_write( + $socket, + $message, + strlen($message) // Using strlen to count the bytes instead of the number of UTF-8 characters + ); + } + @socket_close($socket); + } + } + + function updateSocketAuthentication($userID, $socketRegistrationID=null, $channels=null) { + // If no $socketRegistrationID or no $channels are given the authentication is removed for the given user: + $authentication = ''; + if($channels) { + foreach($channels as $channelID) { + $authentication .= ''; + } + } + $authentication .= ''; + $this->sendSocketMessage($authentication); + } + + function setSocketRegistrationID($value) { + $this->setSessionVar('SocketRegistrationID', $value); + } + + function getSocketRegistrationID() { + return $this->getSessionVar('SocketRegistrationID'); + } + + function rollDice($sides) { + return mt_rand(1, $sides); + } + + function kickUser($userName, $banMinutes=null, $userID=null) { + if($userID === null) { + $userID = $this->getIDFromName($userName); + } + if($userID === null) { + return; + } + + $banMinutes = ($banMinutes !== null) ? $banMinutes : $this->getConfig('defaultBanTime'); + + if($banMinutes) { + // Ban User for the given time in minutes: + $this->banUser($userName, $banMinutes, $userID); + } + + // Remove given User from online list: + $sql = 'DELETE FROM + '.$this->getDataBaseTable('online').' + WHERE + userID = '.$this->db->makeSafe($userID).';'; + + // Create a new SQL query: + $result = $this->db->sqlQuery($sql); + + // Stop if an error occurs: + if($result->error()) { + echo $result->getError(); + die(); + } + + // Update the socket server authentication for the kicked user: + if($this->getConfig('socketServerEnabled')) { + $this->updateSocketAuthentication($userID); + } + + $this->removeUserFromOnlineUsersData($userID); + } + + function getBannedUsersData($key=null, $value=null) { + if($this->_bannedUsersData === null) { + $this->_bannedUsersData = array(); + + $sql = 'SELECT + userID, + userName, + ip + FROM + '.$this->getDataBaseTable('bans').' + WHERE + NOW() < dateTime;'; + + // Create a new SQL query: + $result = $this->db->sqlQuery($sql); + + // Stop if an error occurs: + if($result->error()) { + echo $result->getError(); + die(); + } + + while($row = $result->fetch()) { + $row['ip'] = $this->ipFromStorageFormat($row['ip']); + array_push($this->_bannedUsersData, $row); + } + + $result->free(); + } + + if($key) { + $bannedUsersData = array(); + foreach($this->_bannedUsersData as $bannedUserData) { + if(!isset($bannedUserData[$key])) { + return $bannedUsersData; + } + if($value) { + if($bannedUserData[$key] == $value) { + array_push($bannedUsersData, $bannedUserData); + } else { + continue; + } + } else { + array_push($bannedUsersData, $bannedUserData[$key]); + } + } + return $bannedUsersData; + } + + return $this->_bannedUsersData; + } + + function getBannedUsers() { + return $this->getBannedUsersData('userName'); + } + + function banUser($userName, $banMinutes=null, $userID=null) { + if($userID === null) { + $userID = $this->getIDFromName($userName); + } + $ip = $this->getIPFromID($userID); + if(!$ip || $userID === null) { + return; + } + + // Remove expired bans: + $this->removeExpiredBans(); + + $banMinutes = (int)$banMinutes; + if(!$banMinutes) { + // If banMinutes is not a valid integer, use the defaultBanTime: + $banMinutes = $this->getConfig('defaultBanTime'); + } + + $sql = 'INSERT INTO '.$this->getDataBaseTable('bans').'( + userID, + userName, + dateTime, + ip + ) + VALUES ( + '.$this->db->makeSafe($userID).', + '.$this->db->makeSafe($userName).', + DATE_ADD(NOW(), interval '.$this->db->makeSafe($banMinutes).' MINUTE), + '.$this->db->makeSafe($this->ipToStorageFormat($ip)).' + );'; + + // Create a new SQL query: + $result = $this->db->sqlQuery($sql); + + // Stop if an error occurs: + if($result->error()) { + echo $result->getError(); + die(); + } + } + + function unbanUser($userName) { + $sql = 'DELETE FROM + '.$this->getDataBaseTable('bans').' + WHERE + userName = '.$this->db->makeSafe($userName).';'; + + // Create a new SQL query: + $result = $this->db->sqlQuery($sql); + + // Stop if an error occurs: + if($result->error()) { + echo $result->getError(); + die(); + } + } + + function removeExpiredBans() { + $sql = 'DELETE FROM + '.$this->getDataBaseTable('bans').' + WHERE + dateTime < NOW();'; + + // Create a new SQL query: + $result = $this->db->sqlQuery($sql); + + // Stop if an error occurs: + if($result->error()) { + echo $result->getError(); + die(); + } + } + + function setInactive($userID, $userName=null) { + $condition = 'userID='.$this->db->makeSafe($userID); + if($userName !== null) { + $condition .= ' OR userName='.$this->db->makeSafe($userName); + } + $sql = 'UPDATE + '.$this->getDataBaseTable('online').' + SET + dateTime = DATE_SUB(NOW(), interval '.(intval($this->getConfig('inactiveTimeout'))+1).' MINUTE) + WHERE + '.$condition.';'; + + // Create a new SQL query: + $result = $this->db->sqlQuery($sql); + + // Stop if an error occurs: + if($result->error()) { + echo $result->getError(); + die(); + } + + $this->resetOnlineUsersData(); + } + + function removeInactive() { + $sql = 'SELECT + userID, + userName, + channel + FROM + '.$this->getDataBaseTable('online').' + WHERE + NOW() > DATE_ADD(dateTime, interval '.$this->getConfig('inactiveTimeout').' MINUTE);'; + + // Create a new SQL query: + $result = $this->db->sqlQuery($sql); + + // Stop if an error occurs: + if($result->error()) { + echo $result->getError(); + die(); + } + + if($result->numRows() > 0) { + $condition = ''; + while($row = $result->fetch()) { + if(!empty($condition)) + $condition .= ' OR '; + // Add userID to condition for removal: + $condition .= 'userID='.$this->db->makeSafe($row['userID']); + + // Update the socket server authentication for the kicked user: + if($this->getConfig('socketServerEnabled')) { + $this->updateSocketAuthentication($row['userID']); + } + + $this->removeUserFromOnlineUsersData($row['userID']); + + // Insert logout timeout message: + $text = '/logout '.$row['userName'].' Timeout'; + $this->insertChatBotMessage( + $row['channel'], + $text, + null, + 1 + ); + } + + $result->free(); + + $sql = 'DELETE FROM + '.$this->getDataBaseTable('online').' + WHERE + '.$condition.';'; + + // Create a new SQL query: + $result = $this->db->sqlQuery($sql); + + // Stop if an error occurs: + if($result->error()) { + echo $result->getError(); + die(); + } + } + } + + function updateOnlineStatus() { + // Update online status every 50 seconds (this allows update requests to be in time): + if(!$this->getStatusUpdateTimeStamp() || ((time() - $this->getStatusUpdateTimeStamp()) > 50)) { + $this->updateOnlineList(); + $this->setStatusUpdateTimeStamp(time()); + } + } + + function checkAndRemoveInactive() { + // Remove inactive users every inactiveCheckInterval: + if(!$this->getInactiveCheckTimeStamp() || ((time() - $this->getInactiveCheckTimeStamp()) > $this->getConfig('inactiveCheckInterval')*60)) { + $this->removeInactive(); + $this->setInactiveCheckTimeStamp(time()); + } + } + + function sendXMLMessages() { + $httpHeader = new AJAXChatHTTPHeader('UTF-8', 'text/xml'); + + // Send HTTP header: + $httpHeader->send(); + + // Output XML messages: + echo $this->getXMLMessages(); + } + + function getXMLMessages() { + switch($this->getView()) { + case 'chat': + return $this->getChatViewXMLMessages(); + case 'teaser': + return $this->getTeaserViewXMLMessages(); + case 'logs': + return $this->getLogsViewXMLMessages(); + default: + return $this->getLogoutXMLMessage(); + } + } + + function getMessageCondition() { + $condition = 'id > '.$this->db->makeSafe($this->getRequestVar('lastID')).' + AND ( + channel = '.$this->db->makeSafe($this->getChannel()).' + OR + channel = '.$this->db->makeSafe($this->getPrivateMessageID()).' + ) + AND + '; + if($this->getConfig('requestMessagesPriorChannelEnter') || + ($this->getConfig('requestMessagesPriorChannelEnterList') && in_array($this->getChannel(), $this->getConfig('requestMessagesPriorChannelEnterList')))) { + $condition .= 'NOW() < DATE_ADD(dateTime, interval '.$this->getConfig('requestMessagesTimeDiff').' HOUR)'; + } else { + $condition .= 'dateTime >= FROM_UNIXTIME(' . $this->getChannelEnterTimeStamp() . ')'; + } + return $condition; + } + + function getMessageFilter() { + $filterChannelMessages = ''; + if(!$this->getConfig('showChannelMessages') || $this->getRequestVar('shoutbox')) { + $filterChannelMessages = ' AND NOT ( + text LIKE (\'/login%\') + OR + text LIKE (\'/logout%\') + OR + text LIKE (\'/channelEnter%\') + OR + text LIKE (\'/channelLeave%\') + OR + text LIKE (\'/kick%\') + )'; + } + return $filterChannelMessages; + } + + function getInfoMessagesXML() { + $xml = ''; + // Go through the info messages: + foreach($this->getInfoMessages() as $type=>$infoArray) { + foreach($infoArray as $info) { + $xml .= ''; + $xml .= 'encodeSpecialChars($info).']]>'; + $xml .= ''; + } + } + $xml .= ''; + return $xml; + } + + function getChatViewOnlineUsersXML($channelIDs) { + // Get the online users for the given channels: + $onlineUsersData = $this->getOnlineUsersData($channelIDs); + $xml = ''; + foreach($onlineUsersData as $onlineUserData) { + $xml .= 'encodeSpecialChars($onlineUserData['userName']).']]>'; + $xml .= ''; + } + $xml .= ''; + return $xml; + } + + function getLogoutXMLMessage() { + $xml = ''; + $xml .= ''; + $xml .= ''; + $xml .= ''; + $xml .= 'encodeSpecialChars($this->getConfig('logoutData')).']]>'; + $xml .= ''; + $xml .= ''; + $xml .= ''; + return $xml; + } + + function getChatViewMessageXML( + $messageID, + $timeStamp, + $userID, + $userName, + $userRole, + $channelID, + $text + ) { + $message = 'encodeSpecialChars($userName).']]>'; + $message .= 'encodeSpecialChars($text).']]>'; + $message .= ''; + return $message; + } + + function getChatViewMessagesXML() { + // Get the last messages in descending order (this optimises the LIMIT usage): + $sql = 'SELECT + id, + userID, + userName, + userRole, + channel AS channelID, + UNIX_TIMESTAMP(dateTime) AS timeStamp, + text + FROM + '.$this->getDataBaseTable('messages').' + WHERE + '.$this->getMessageCondition().' + '.$this->getMessageFilter().' + ORDER BY + id + DESC + LIMIT '.$this->getConfig('requestMessagesLimit').';'; + + // Create a new SQL query: + $result = $this->db->sqlQuery($sql); + + // Stop if an error occurs: + if($result->error()) { + echo $result->getError(); + die(); + } + + $messages = ''; + + // Add the messages in reverse order so it is ascending again: + while($row = $result->fetch()) { + $message = $this->getChatViewMessageXML( + $row['id'], + $row['timeStamp'], + $row['userID'], + $row['userName'], + $row['userRole'], + $row['channelID'], + $row['text'] + ); + $messages = $message.$messages; + } + $result->free(); + + $messages = ''.$messages.''; + return $messages; + } + + function getChatViewXMLMessages() { + $xml = ''; + $xml .= ''; + $xml .= $this->getInfoMessagesXML(); + $xml .= $this->getChatViewOnlineUsersXML(array($this->getChannel())); + $xml .= $this->getChatViewMessagesXML(); + $xml .= ''; + return $xml; + } + + function getTeaserMessageCondition() { + $channelID = $this->getValidRequestChannelID(); + $condition = 'channel = '.$this->db->makeSafe($channelID).' + AND + '; + if($this->getConfig('requestMessagesPriorChannelEnter') || + ($this->getConfig('requestMessagesPriorChannelEnterList') && in_array($channelID, $this->getConfig('requestMessagesPriorChannelEnterList')))) { + $condition .= 'NOW() < DATE_ADD(dateTime, interval '.$this->getConfig('requestMessagesTimeDiff').' HOUR)'; + } else { + // Teaser content may not be shown for this channel: + $condition .= '0 = 1'; + } + return $condition; + } + + function getTeaserViewMessagesXML() { + // Get the last messages in descending order (this optimises the LIMIT usage): + $sql = 'SELECT + id, + userID, + userName, + userRole, + channel AS channelID, + UNIX_TIMESTAMP(dateTime) AS timeStamp, + text + FROM + '.$this->getDataBaseTable('messages').' + WHERE + '.$this->getTeaserMessageCondition().' + '.$this->getMessageFilter().' + ORDER BY + id + DESC + LIMIT '.$this->getConfig('requestMessagesLimit').';'; + + // Create a new SQL query: + $result = $this->db->sqlQuery($sql); + + // Stop if an error occurs: + if($result->error()) { + echo $result->getError(); + die(); + } + + $messages = ''; + + // Add the messages in reverse order so it is ascending again: + while($row = $result->fetch()) { + $message = ''; + $message .= 'encodeSpecialChars($row['userName']).']]>'; + $message .= 'encodeSpecialChars($row['text']).']]>'; + $message .= ''; + $messages = $message.$messages; + } + $result->free(); + + $messages = ''.$messages.''; + return $messages; + } + + function getTeaserViewXMLMessages() { + $xml = ''; + $xml .= ''; + $xml .= $this->getInfoMessagesXML(); + $xml .= $this->getTeaserViewMessagesXML(); + $xml .= ''; + return $xml; + } + + function getLogsViewCondition() { + $condition = 'id > '.$this->db->makeSafe($this->getRequestVar('lastID')); + + // Check the channel condition: + switch($this->getRequestVar('channelID')) { + case '-3': + // Just display messages from all accessible channels + if($this->getUserRole() != AJAX_CHAT_ADMIN) { + $condition .= ' AND (channel = '.$this->db->makeSafe($this->getPrivateMessageID()); + $condition .= ' OR channel = '.$this->db->makeSafe($this->getPrivateChannelID()); + foreach($this->getChannels() as $channel) { + if($this->getConfig('logsUserAccessChannelList') && !in_array($channel, $this->getConfig('logsUserAccessChannelList'))) { + continue; + } + $condition .= ' OR channel = '.$this->db->makeSafe($channel); + } + $condition .= ')'; + } + break; + case '-2': + if($this->getUserRole() != AJAX_CHAT_ADMIN) { + $condition .= ' AND channel = '.($this->getPrivateMessageID()); + } else { + $condition .= ' AND channel > '.($this->getConfig('privateMessageDiff')-1); + } + break; + case '-1': + if($this->getUserRole() != AJAX_CHAT_ADMIN) { + $condition .= ' AND channel = '.($this->getPrivateChannelID()); + } else { + $condition .= ' AND (channel > '.($this->getConfig('privateChannelDiff')-1).' AND channel < '.($this->getConfig('privateMessageDiff')).')'; + } + break; + default: + if(($this->getUserRole() == AJAX_CHAT_ADMIN || !$this->getConfig('logsUserAccessChannelList') || in_array($this->getRequestVar('channelID'), $this->getConfig('logsUserAccessChannelList'))) + && $this->validateChannel($this->getRequestVar('channelID'))) { + $condition .= ' AND channel = '.$this->db->makeSafe($this->getRequestVar('channelID')); + } else { + // No valid channel: + $condition .= ' AND 0 = 1'; + } + } + + // Check the period condition: + $hour = ($this->getRequestVar('hour') === null || $this->getRequestVar('hour') > 23 || $this->getRequestVar('hour') < 0) ? null : $this->getRequestVar('hour'); + $day = ($this->getRequestVar('day') === null || $this->getRequestVar('day') > 31 || $this->getRequestVar('day') < 1) ? null : $this->getRequestVar('day'); + $month = ($this->getRequestVar('month') === null || $this->getRequestVar('month') > 12 || $this->getRequestVar('month') < 1) ? null : $this->getRequestVar('month'); + $year = ($this->getRequestVar('year') === null || $this->getRequestVar('year') > date('Y') || $this->getRequestVar('year') < $this->getConfig('logsFirstYear')) ? null : $this->getRequestVar('year'); + + // If a time (hour) is given but no date (year, month, day), use the current date: + if($hour !== null) { + if($day === null) + $day = date('j'); + if($month === null) + $month = date('n'); + if($year === null) + $year = date('Y'); + } + + if($year === null) { + // No year given, so no period condition + } else if($month === null) { + // Define the given year as period: + $periodStart = mktime(0, 0, 0, 1, 1, $year); + // The last day in a month can be expressed by using 0 for the day of the next month: + $periodEnd = mktime(23, 59, 59, 13, 0, $year); + } else if($day === null) { + // Define the given month as period: + $periodStart = mktime(0, 0, 0, $month, 1, $year); + // The last day in a month can be expressed by using 0 for the day of the next month: + $periodEnd = mktime(23, 59, 59, $month+1, 0, $year); + } else if($hour === null){ + // Define the given day as period: + $periodStart = mktime(0, 0, 0, $month, $day, $year); + $periodEnd = mktime(23, 59, 59, $month, $day, $year); + } else { + // Define the given hour as period: + $periodStart = mktime($hour, 0, 0, $month, $day, $year); + $periodEnd = mktime($hour, 59, 59, $month, $day, $year); + } + + if(isset($periodStart)) + $condition .= ' AND dateTime > \''.date('Y-m-d H:i:s', $periodStart).'\' AND dateTime <= \''.date('Y-m-d H:i:s', $periodEnd).'\''; + + // Check the search condition: + if($this->getRequestVar('search')) { + if(($this->getUserRole() == AJAX_CHAT_ADMIN || $this->getUserRole() == AJAX_CHAT_MODERATOR) && strpos($this->getRequestVar('search'), 'ip=') === 0) { + // Search for messages with the given IP: + $ip = substr($this->getRequestVar('search'), 3); + $condition .= ' AND (ip = '.$this->db->makeSafe($this->ipToStorageFormat($ip)).')'; + } else if(strpos($this->getRequestVar('search'), 'userID=') === 0) { + // Search for messages with the given userID: + $userID = substr($this->getRequestVar('search'), 7); + $condition .= ' AND (userID = '.$this->db->makeSafe($userID).')'; + } else { + // Use the search value as regular expression on message text and username: + $condition .= ' AND (userName REGEXP '.$this->db->makeSafe($this->getRequestVar('search')).' OR text REGEXP '.$this->db->makeSafe($this->getRequestVar('search')).')'; + } + } + + // If no period or search condition is given, just monitor the last messages on the given channel: + if(!isset($periodStart) && !$this->getRequestVar('search')) { + $condition .= ' AND NOW() < DATE_ADD(dateTime, interval '.$this->getConfig('logsRequestMessagesTimeDiff').' HOUR)'; + } + + return $condition; + } + + function getLogsViewMessagesXML() { + $sql = 'SELECT + id, + userID, + userName, + userRole, + channel AS channelID, + UNIX_TIMESTAMP(dateTime) AS timeStamp, + ip, + text + FROM + '.$this->getDataBaseTable('messages').' + WHERE + '.$this->getLogsViewCondition().' + ORDER BY + id + LIMIT '.$this->getConfig('logsRequestMessagesLimit').';'; + + // Create a new SQL query: + $result = $this->db->sqlQuery($sql); + + // Stop if an error occurs: + if($result->error()) { + echo $result->getError(); + die(); + } + + $xml = ''; + while($row = $result->fetch()) { + $xml .= 'getUserRole() == AJAX_CHAT_ADMIN || $this->getUserRole() == AJAX_CHAT_MODERATOR) { + $xml .= ' ip="'.$this->ipFromStorageFormat($row['ip']).'"'; + } + $xml .= '>'; + $xml .= 'encodeSpecialChars($row['userName']).']]>'; + $xml .= 'encodeSpecialChars($row['text']).']]>'; + $xml .= ''; + } + $result->free(); + + $xml .= ''; + + return $xml; + } + + function getLogsViewXMLMessages() { + $xml = ''; + $xml .= ''; + $xml .= $this->getInfoMessagesXML(); + $xml .= $this->getLogsViewMessagesXML(); + $xml .= ''; + return $xml; + } + + function purgeLogs() { + $sql = 'DELETE FROM + '.$this->getDataBaseTable('messages').' + WHERE + dateTime < DATE_SUB(NOW(), interval '.$this->getConfig('logsPurgeTimeDiff').' DAY);'; + + // Create a new SQL query: + $result = $this->db->sqlQuery($sql); + + // Stop if an error occurs: + if($result->error()) { + echo $result->getError(); + die(); + } + } + + function getInfoMessages($type=null) { + if(!isset($this->_infoMessages)) { + $this->_infoMessages = array(); + } + if($type) { + if(!isset($this->_infoMessages[$type])) { + $this->_infoMessages[$type] = array(); + } + return $this->_infoMessages[$type]; + } else { + return $this->_infoMessages; + } + } + + function addInfoMessage($info, $type='error') { + if(!isset($this->_infoMessages)) { + $this->_infoMessages = array(); + } + if(!isset($this->_infoMessages[$type])) { + $this->_infoMessages[$type] = array(); + } + if(!in_array($info, $this->_infoMessages[$type])) { + array_push($this->_infoMessages[$type], $info); + } + } + + function getRequestVars() { + return $this->_requestVars; + } + + function getRequestVar($key) { + if($this->_requestVars && isset($this->_requestVars[$key])) { + return $this->_requestVars[$key]; + } + return null; + } + + function setRequestVar($key, $value) { + if(!$this->_requestVars) { + $this->_requestVars = array(); + } + $this->_requestVars[$key] = $value; + } + + function getOnlineUsersData($channelIDs=null, $key=null, $value=null) { + if($this->_onlineUsersData === null) { + $this->_onlineUsersData = array(); + + $sql = 'SELECT + userID, + userName, + userRole, + channel, + UNIX_TIMESTAMP(dateTime) AS timeStamp, + ip + FROM + '.$this->getDataBaseTable('online').' + ORDER BY + LOWER(userName);'; + + // Create a new SQL query: + $result = $this->db->sqlQuery($sql); + + // Stop if an error occurs: + if($result->error()) { + echo $result->getError(); + die(); + } + + while($row = $result->fetch()) { + $row['ip'] = $this->ipFromStorageFormat($row['ip']); + array_push($this->_onlineUsersData, $row); + } + + $result->free(); + } + + if($channelIDs || $key) { + $onlineUsersData = array(); + foreach($this->_onlineUsersData as $userData) { + if($channelIDs && !in_array($userData['channel'], $channelIDs)) { + continue; + } + if($key) { + if(!isset($userData[$key])) { + return $onlineUsersData; + } + if($value !== null) { + if($userData[$key] == $value) { + array_push($onlineUsersData, $userData); + } else { + continue; + } + } else { + array_push($onlineUsersData, $userData[$key]); + } + } else { + array_push($onlineUsersData, $userData); + } + } + return $onlineUsersData; + } + + return $this->_onlineUsersData; + } + + function removeUserFromOnlineUsersData($userID=null) { + if(!$this->_onlineUsersData) { + return; + } + $userID = ($userID === null) ? $this->getUserID() : $userID; + for($i=0; $i_onlineUsersData); $i++) { + if($this->_onlineUsersData[$i]['userID'] == $userID) { + array_splice($this->_onlineUsersData, $i, 1); + break; + } + } + } + + function resetOnlineUsersData() { + $this->_onlineUsersData = null; + } + + function getOnlineUsers($channelIDs=null) { + return $this->getOnlineUsersData($channelIDs, 'userName'); + } + + function getOnlineUserIDs($channelIDs=null) { + return $this->getOnlineUsersData($channelIDs, 'userID'); + } + + function startSession() { + if(!session_id()) { + // Set the session name: + session_name($this->getConfig('sessionName')); + + // Set session cookie parameters: + session_set_cookie_params( + 0, // The session is destroyed on logout anyway, so no use to set this + $this->getConfig('sessionCookiePath'), + $this->getConfig('sessionCookieDomain'), + $this->getConfig('sessionCookieSecure') + ); + + // Start the session: + session_start(); + + // We started a new session: + $this->_sessionNew = true; + } + } + + function destroySession() { + if($this->_sessionNew) { + // Delete all session variables: + $_SESSION = array(); + + // Delete the session cookie: + if (isset($_COOKIE[session_name()])) { + setcookie( + session_name(), + '', + time()-42000, + $this->getConfig('sessionCookiePath'), + $this->getConfig('sessionCookieDomain'), + $this->getConfig('sessionCookieSecure') + ); + } + + // Destroy the session: + session_destroy(); + } else { + // Unset all session variables starting with the sessionKeyPrefix: + foreach($_SESSION as $key=>$value) { + if(strpos($key, $this->getConfig('sessionKeyPrefix')) === 0) { + unset($_SESSION[$key]); + } + } + } + } + + function regenerateSessionID() { + if($this->_sessionNew) { + // Regenerate session id: + @session_regenerate_id(true); + } + } + + function getSessionVar($key, $prefix=null) { + if($prefix === null) + $prefix = $this->getConfig('sessionKeyPrefix'); + + // Return the session value if existing: + if(isset($_SESSION[$prefix.$key])) + return $_SESSION[$prefix.$key]; + else + return null; + } + + function setSessionVar($key, $value, $prefix=null) { + if($prefix === null) + $prefix = $this->getConfig('sessionKeyPrefix'); + + // Set the session value: + $_SESSION[$prefix.$key] = $value; + } + + function getSessionIP() { + return $this->getSessionVar('IP'); + } + + function setSessionIP($ip) { + $this->setSessionVar('IP', $ip); + } + + function getQueryUserName() { + return $this->getSessionVar('QueryUserName'); + } + + function setQueryUserName($userName) { + $this->setSessionVar('QueryUserName', $userName); + } + + function getInvitations() { + if($this->_invitations === null) { + $this->_invitations = array(); + + $sql = 'SELECT + channel + FROM + '.$this->getDataBaseTable('invitations').' + WHERE + userID='.$this->db->makeSafe($this->getUserID()).' + AND + DATE_SUB(NOW(), interval 1 DAY) < dateTime;'; + + // Create a new SQL query: + $result = $this->db->sqlQuery($sql); + + // Stop if an error occurs: + if($result->error()) { + echo $result->getError(); + die(); + } + + while($row = $result->fetch()) { + array_push($this->_invitations, $row['channel']); + } + + $result->free(); + } + return $this->_invitations; + } + + function removeExpiredInvitations() { + $sql = 'DELETE FROM + '.$this->getDataBaseTable('invitations').' + WHERE + DATE_SUB(NOW(), interval 1 DAY) > dateTime;'; + + // Create a new SQL query: + $result = $this->db->sqlQuery($sql); + + // Stop if an error occurs: + if($result->error()) { + echo $result->getError(); + die(); + } + } + + function addInvitation($userID, $channelID=null) { + $this->removeExpiredInvitations(); + + $channelID = ($channelID === null) ? $this->getChannel() : $channelID; + + $sql = 'INSERT INTO '.$this->getDataBaseTable('invitations').'( + userID, + channel, + dateTime + ) + VALUES ( + '.$this->db->makeSafe($userID).', + '.$this->db->makeSafe($channelID).', + NOW() + );'; + + // Create a new SQL query: + $result = $this->db->sqlQuery($sql); + + // Stop if an error occurs: + if($result->error()) { + echo $result->getError(); + die(); + } + } + + function removeInvitation($userID, $channelID=null) { + $channelID = ($channelID === null) ? $this->getChannel() : $channelID; + + $sql = 'DELETE FROM + '.$this->getDataBaseTable('invitations').' + WHERE + userID='.$this->db->makeSafe($userID).' + AND + channel='.$this->db->makeSafe($channelID).';'; + + // Create a new SQL query: + $result = $this->db->sqlQuery($sql); + + // Stop if an error occurs: + if($result->error()) { + echo $result->getError(); + die(); + } + } + + function getUserID() { + return $this->getSessionVar('UserID'); + } + + function setUserID($id) { + $this->setSessionVar('UserID', $id); + } + + function getUserName() { + return $this->getSessionVar('UserName'); + } + + function setUserName($name) { + $this->setSessionVar('UserName', $name); + } + + function getLoginUserName() { + return $this->getSessionVar('LoginUserName'); + } + + function setLoginUserName($name) { + $this->setSessionVar('LoginUserName', $name); + } + + function getUserRole() { + $userRole = $this->getSessionVar('UserRole'); + if($userRole === null) + return AJAX_CHAT_GUEST; + return $userRole; + } + + function setUserRole($role) { + $this->setSessionVar('UserRole', $role); + } + + function getChannel() { + return $this->getSessionVar('Channel'); + } + + function setChannel($channel) { + $this->setSessionVar('Channel', $channel); + + // Save the channel enter timestamp: + $this->setChannelEnterTimeStamp(time()); + + // Update the channel authentication for the socket server: + if($this->getConfig('socketServerEnabled')) { + $this->updateSocketAuthentication( + $this->getUserID(), + $this->getSocketRegistrationID(), + array($channel,$this->getPrivateMessageID()) + ); + } + + // Reset the logs view socket authentication session var: + if($this->getSessionVar('logsViewSocketAuthenticated')) { + $this->setSessionVar('logsViewSocketAuthenticated', false); + } + } + + function isLoggedIn() { + return (bool)$this->getSessionVar('LoggedIn'); + } + + function setLoggedIn($bool) { + $this->setSessionVar('LoggedIn', $bool); + } + + function getLoginTimeStamp() { + return $this->getSessionVar('LoginTimeStamp'); + } + + function setLoginTimeStamp($time) { + $this->setSessionVar('LoginTimeStamp', $time); + } + + function getChannelEnterTimeStamp() { + return $this->getSessionVar('ChannelEnterTimeStamp'); + } + + function setChannelEnterTimeStamp($time) { + $this->setSessionVar('ChannelEnterTimeStamp', $time); + } + + function getStatusUpdateTimeStamp() { + return $this->getSessionVar('StatusUpdateTimeStamp'); + } + + function setStatusUpdateTimeStamp($time) { + $this->setSessionVar('StatusUpdateTimeStamp', $time); + } + + function getInactiveCheckTimeStamp() { + return $this->getSessionVar('InactiveCheckTimeStamp'); + } + + function setInactiveCheckTimeStamp($time) { + $this->setSessionVar('InactiveCheckTimeStamp', $time); + } + + function getInsertedMessagesRate() { + return $this->getSessionVar('InsertedMessagesRate'); + } + + function setInsertedMessagesRate($rate) { + $this->setSessionVar('InsertedMessagesRate', $rate); + } + + function getInsertedMessagesRateTimeStamp() { + return $this->getSessionVar('InsertedMessagesRateTimeStamp'); + } + + function setInsertedMessagesRateTimeStamp($time) { + $this->setSessionVar('InsertedMessagesRateTimeStamp', $time); + } + + function getLangCode() { + // Get the langCode from request or cookie: + $langCodeCookie = isset($_COOKIE[$this->getConfig('sessionName').'_lang']) ? $_COOKIE[$this->getConfig('sessionName').'_lang'] : null; + $langCode = $this->getRequestVar('lang') ? $this->getRequestVar('lang') : $langCodeCookie; + // Check if the langCode is valid: + if(!in_array($langCode, $this->getConfig('langAvailable'))) { + // Determine the user language: + $language = new AJAXChatLanguage($this->getConfig('langAvailable'), $this->getConfig('langDefault')); + $langCode = $language->getLangCode(); + } + return $langCode; + } + + function setLangCodeCookie() { + setcookie( + $this->getConfig('sessionName').'_lang', + $this->getLangCode(), + time()+60*60*24*$this->getConfig('sessionCookieLifeTime'), + $this->getConfig('sessionCookiePath'), + $this->getConfig('sessionCookieDomain'), + $this->getConfig('sessionCookieSecure') + ); + } + + function removeUnsafeCharacters($str) { + // Remove NO-WS-CTL, non-whitespace control characters (RFC 2822), decimal 1–8, 11–12, 14–31, and 127: + return AJAXChatEncoding::removeUnsafeCharacters($str); + } + + function subString($str, $start=0, $length=null, $encoding='UTF-8') { + return AJAXChatString::subString($str, $start, $length, $encoding); + } + + function stringLength($str, $encoding='UTF-8') { + return AJAXChatString::stringLength($str, $encoding); + } + + function trimMessageText($text) { + return $this->trimString($text, 'UTF-8', $this->getConfig('messageTextMaxLength')); + } + + function trimUserName($userName) { + return $this->trimString($userName, null, $this->getConfig('userNameMaxLength'), true, true); + } + + function trimChannelName($channelName) { + return $this->trimString($channelName, null, null, true, true); + } + + function trimString($str, $sourceEncoding=null, $maxLength=null, $replaceWhitespace=false, $decodeEntities=false, $htmlEntitiesMap=null) { + // Make sure the string contains valid unicode: + $str = $this->convertToUnicode($str, $sourceEncoding); + + // Make sure the string contains no unsafe characters: + $str = $this->removeUnsafeCharacters($str); + + // Strip whitespace from the beginning and end of the string: + $str = trim($str); + + if($replaceWhitespace) { + // Replace any whitespace in the userName with the underscore "_": + $str = preg_replace('/\s/u', '_', $str); + } + + if($decodeEntities) { + // Decode entities: + $str = $this->decodeEntities($str, 'UTF-8', $htmlEntitiesMap); + } + + if($maxLength) { + // Cut the string to the allowed length: + $str = $this->subString($str, 0, $maxLength); + } + + return $str; + } + + function convertToUnicode($str, $sourceEncoding=null) { + if($sourceEncoding === null) { + $sourceEncoding = $this->getConfig('sourceEncoding'); + } + return $this->convertEncoding($str, $sourceEncoding, 'UTF-8'); + } + + function convertFromUnicode($str, $contentEncoding=null) { + if($contentEncoding === null) { + $contentEncoding = $this->getConfig('contentEncoding'); + } + return $this->convertEncoding($str, 'UTF-8', $contentEncoding); + } + + function convertEncoding($str, $charsetFrom, $charsetTo) { + return AJAXChatEncoding::convertEncoding($str, $charsetFrom, $charsetTo); + } + + function encodeEntities($str, $encoding='UTF-8', $convmap=null) { + return AJAXChatEncoding::encodeEntities($str, $encoding, $convmap); + } + + function decodeEntities($str, $encoding='UTF-8', $htmlEntitiesMap=null) { + return AJAXChatEncoding::decodeEntities($str, $encoding, $htmlEntitiesMap); + } + + function htmlEncode($str) { + return AJAXChatEncoding::htmlEncode($str, $this->getConfig('contentEncoding')); + } + + function encodeSpecialChars($str) { + return AJAXChatEncoding::encodeSpecialChars($str); + } + + function decodeSpecialChars($str) { + return AJAXChatEncoding::decodeSpecialChars($str); + } + + function ipToStorageFormat($ip) { + if(function_exists('inet_pton')) { + // ipv4 & ipv6: + return @inet_pton($ip); + } + // Only ipv4: + return @pack('N',@ip2long($ip)); + } + + function ipFromStorageFormat($ip) { + if(function_exists('inet_ntop')) { + // ipv4 & ipv6: + return @inet_ntop($ip); + } + // Only ipv4: + $unpacked = @unpack('Nlong',$ip); + if(isset($unpacked['long'])) { + return @long2ip($unpacked['long']); + } + return null; + } + + function getConfig($key, $subkey=null) { + if($subkey) + return $this->_config[$key][$subkey]; + else + return $this->_config[$key]; + } + + function setConfig($key, $subkey, $value) { + if($subkey) { + if(!isset($this->_config[$key])) { + $this->_config[$key] = array(); + } + $this->_config[$key][$subkey] = $value; + } else { + $this->_config[$key] = $value; + } + } + + function getLang($key=null) { + if(!$this->_lang) { + // Include the language file: + $lang = null; + require(AJAX_CHAT_PATH.'lib/lang/'.$this->getLangCode().'.php'); + $this->_lang = &$lang; + } + if($key === null) + return $this->_lang; + if(isset($this->_lang[$key])) + return $this->_lang[$key]; + return null; + } + + function getChatURL() { + if(defined('AJAX_CHAT_URL')) { + return AJAX_CHAT_URL; + } + + return + (isset($_SERVER['HTTPS']) ? 'https://' : 'http://'). + (isset($_SERVER['REMOTE_USER']) ? $_SERVER['REMOTE_USER'].'@' : ''). + (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : ($_SERVER['SERVER_NAME']. + (isset($_SERVER['HTTPS']) && $_SERVER['SERVER_PORT'] == 443 || $_SERVER['SERVER_PORT'] == 80 ? '' : ':'.$_SERVER['SERVER_PORT']))). + substr($_SERVER['SCRIPT_NAME'],0, strrpos($_SERVER['SCRIPT_NAME'], '/')+1); + } + + function getIDFromName($userName) { + $userDataArray = $this->getOnlineUsersData(null,'userName',$userName); + if($userDataArray && isset($userDataArray[0])) { + return $userDataArray[0]['userID']; + } + return null; + } + + function getNameFromID($userID) { + $userDataArray = $this->getOnlineUsersData(null,'userID',$userID); + if($userDataArray && isset($userDataArray[0])) { + return $userDataArray[0]['userName']; + } + return null; + } + + function getChannelFromID($userID) { + $userDataArray = $this->getOnlineUsersData(null,'userID',$userID); + if($userDataArray && isset($userDataArray[0])) { + return $userDataArray[0]['channel']; + } + return null; + } + + function getIPFromID($userID) { + $userDataArray = $this->getOnlineUsersData(null,'userID',$userID); + if($userDataArray && isset($userDataArray[0])) { + return $userDataArray[0]['ip']; + } + return null; + } + + function getRoleFromID($userID) { + $userDataArray = $this->getOnlineUsersData(null,'userID',$userID); + if($userDataArray && isset($userDataArray[0])) { + return $userDataArray[0]['userRole']; + } + return null; + } + + function getChannelNames() { + return array_flip($this->getChannels()); + } + + function getChannelIDFromChannelName($channelName) { + if(!$channelName) + return null; + $channels = $this->getAllChannels(); + if(array_key_exists($channelName,$channels)) { + return $channels[$channelName]; + } + $channelID = null; + // Check if the requested channel is the own private channel: + if($channelName == $this->getPrivateChannelName()) { + return $this->getPrivateChannelID(); + } + // Try to retrieve a private room ID: + $strlenChannelName = $this->stringLength($channelName); + $strlenPrefix = $this->stringLength($this->getConfig('privateChannelPrefix')); + $strlenSuffix = $this->stringLength($this->getConfig('privateChannelSuffix')); + if($this->subString($channelName,0,$strlenPrefix) == $this->getConfig('privateChannelPrefix') + && $this->subString($channelName,$strlenChannelName-$strlenSuffix) == $this->getConfig('privateChannelSuffix')) { + $userName = $this->subString( + $channelName, + $strlenPrefix, + $strlenChannelName-($strlenPrefix+$strlenSuffix) + ); + $userID = $this->getIDFromName($userName); + if($userID !== null) { + $channelID = $this->getPrivateChannelID($userID); + } + } + return $channelID; + } + + function getChannelNameFromChannelID($channelID) { + foreach($this->getAllChannels() as $key=>$value) { + if($value == $channelID) { + return $key; + } + } + // Try to retrieve a private room name: + if($channelID == $this->getPrivateChannelID()) { + return $this->getPrivateChannelName(); + } + $userName = $this->getNameFromID($channelID-$this->getConfig('privateChannelDiff')); + if($userName === null) { + return null; + } + return $this->getPrivateChannelName($userName); + } + + function getChannelName() { + return $this->getChannelNameFromChannelID($this->getChannel()); + } + + function getPrivateChannelName($userName=null) { + if($userName === null) { + $userName = $this->getUserName(); + } + return $this->getConfig('privateChannelPrefix').$userName.$this->getConfig('privateChannelSuffix'); + } + + function getPrivateChannelID($userID=null) { + if($userID === null) { + $userID = $this->getUserID(); + } + return $userID + $this->getConfig('privateChannelDiff'); + } + + function getPrivateMessageID($userID=null) { + if($userID === null) { + $userID = $this->getUserID(); + } + return $userID + $this->getConfig('privateMessageDiff'); + } + + function isAllowedToSendPrivateMessage() { + if($this->getConfig('allowPrivateMessages') || $this->getUserRole() == AJAX_CHAT_ADMIN) { + return true; + } + return false; + } + + function isAllowedToCreatePrivateChannel() { + if($this->getConfig('allowPrivateChannels')) { + switch($this->getUserRole()) { + case AJAX_CHAT_USER: + return true; + case AJAX_CHAT_MODERATOR: + return true; + case AJAX_CHAT_ADMIN: + return true; + default: + return false; + } + } + return false; + } + + function isAllowedToListHiddenUsers() { + // Hidden users are users within private or restricted channels: + switch($this->getUserRole()) { + case AJAX_CHAT_MODERATOR: + return true; + case AJAX_CHAT_ADMIN: + return true; + default: + return false; + } + } + + function isUserOnline($userID=null) { + $userID = ($userID === null) ? $this->getUserID() : $userID; + $userDataArray = $this->getOnlineUsersData(null,'userID',$userID); + if($userDataArray && count($userDataArray) > 0) { + return true; + } + return false; + } + + function isUserNameInUse($userName=null) { + $userName = ($userName === null) ? $this->getUserName() : $userName; + $userDataArray = $this->getOnlineUsersData(null,'userName',$userName); + if($userDataArray && count($userDataArray) > 0) { + return true; + } + return false; + } + + function isUserBanned($userName, $userID=null, $ip=null) { + if($userID !== null) { + $bannedUserDataArray = $this->getBannedUsersData('userID',$userID); + if($bannedUserDataArray && isset($bannedUserDataArray[0])) { + return true; + } + } + if($ip !== null) { + $bannedUserDataArray = $this->getBannedUsersData('ip',$ip); + if($bannedUserDataArray && isset($bannedUserDataArray[0])) { + return true; + } + } + $bannedUserDataArray = $this->getBannedUsersData('userName',$userName); + if($bannedUserDataArray && isset($bannedUserDataArray[0])) { + return true; + } + return false; + } + + function isMaxUsersLoggedIn() { + if(count($this->getOnlineUsersData()) >= $this->getConfig('maxUsersLoggedIn')) { + return true; + } + return false; + } + + function validateChannel($channelID) { + if($channelID === null) { + return false; + } + // Return true for normal channels the user has acces to: + if(in_array($channelID, $this->getChannels())) { + return true; + } + // Return true if the user is allowed to join his own private channel: + if($channelID == $this->getPrivateChannelID() && $this->isAllowedToCreatePrivateChannel()) { + return true; + } + // Return true if the user has been invited to a restricted or private channel: + if(in_array($channelID, $this->getInvitations())) { + return true; + } + // No valid channel, return false: + return false; + } + + function createGuestUserName() { + $maxLength = $this->getConfig('userNameMaxLength') + - $this->stringLength($this->getConfig('guestUserPrefix')) + - $this->stringLength($this->getConfig('guestUserSuffix')); + + // seed with microseconds since last "whole" second: + mt_srand((double)microtime()*1000000); + + // Create a random userName using numbers between 100000 and 999999: + $userName = substr(mt_rand(100000, 999999), 0, $maxLength); + + return $this->getConfig('guestUserPrefix').$userName.$this->getConfig('guestUserSuffix'); + } + + // Guest userIDs must not interfere with existing userIDs and must be lower than privateChannelDiff: + function createGuestUserID() { + // seed with microseconds since last "whole" second: + mt_srand((double)microtime()*1000000); + + return mt_rand($this->getConfig('minGuestUserID'), $this->getConfig('privateChannelDiff')-1); + } + + function getGuestUser() { + if(!$this->getConfig('allowGuestLogins')) + return null; + + if($this->getConfig('allowGuestUserName')) { + $maxLength = $this->getConfig('userNameMaxLength') + - $this->stringLength($this->getConfig('guestUserPrefix')) + - $this->stringLength($this->getConfig('guestUserSuffix')); + + // Trim guest userName: + $userName = $this->trimString($this->getRequestVar('userName'), null, $maxLength, true, true); + + // If given userName is invalid, create one: + if(!$userName) { + $userName = $this->createGuestUserName(); + } else { + // Add the guest users prefix and suffix to the given userName: + $userName = $this->getConfig('guestUserPrefix').$userName.$this->getConfig('guestUserSuffix'); + } + } else { + $userName = $this->createGuestUserName(); + } + + $userData = array(); + $userData['userID'] = $this->createGuestUserID(); + $userData['userName'] = $userName; + $userData['userRole'] = AJAX_CHAT_GUEST; + return $userData; + } + + function getCustomVar($key) { + if(!isset($this->_customVars)) + $this->_customVars = array(); + if(!isset($this->_customVars[$key])) + return null; + return $this->_customVars[$key]; + } + + function setCustomVar($key, $value) { + if(!isset($this->_customVars)) + $this->_customVars = array(); + $this->_customVars[$key] = $value; + } + + // Override to replace custom template tags: + // Return the replacement for the given tag (and given tagContent) + function replaceCustomTemplateTags($tag, $tagContent) { + return null; + } + + // Override to initialize custom configuration settings: + function initCustomConfig() { + } + + // Override to add custom request variables: + // Add values to the request variables array: $this->_requestVars['customVariable'] = null; + function initCustomRequestVars() { + } + + // Override to add custom session code right after the session has been started: + function initCustomSession() { + } + + // Override, to parse custom info requests: + // $infoRequest contains the current info request + // Add info responses using the method addInfoMessage($info, $type) + function parseCustomInfoRequest($infoRequest) { + } + + // Override to replace custom text: + // Return replaced text + // $text contains the whole message + function replaceCustomText(&$text) { + return $text; + } + + // Override to add custom commands: + // Return true if a custom command has been successfully parsed, else false + // $text contains the whole message, $textParts the message split up as words array + function parseCustomCommands($text, $textParts) { + return false; + } + + // Override to perform custom actions on new messages: + // Return true if message may be inserted, else false + // $text contains the whole message + function onNewMessage($text) { + return true; + } + + // Override to perform custom actions on new messages: + // Method to set the style cookie depending on user data + function setStyle() { + } + + // Override: + // Returns true if the userID of the logged in user is identical to the userID of the authentication system + // or the user is authenticated as guest in the chat and the authentication system + function revalidateUserID() { + return true; + } + + // Override: + // Returns an associative array containing userName, userID and userRole + // Returns null if login is invalid + function getValidLoginUserData() { + // Check if we have a valid registered user: + if(false) { + // Here is the place to check user authentication + } else { + // Guest users: + return $this->getGuestUser(); + } + } + + // Override: + // Store the channels the current user has access to + // Make sure channel names don't contain any whitespace + function &getChannels() { + if($this->_channels === null) { + $this->_channels = $this->getAllChannels(); + } + return $this->_channels; + } + + // Override: + // Store all existing channels + // Make sure channel names don't contain any whitespace + function &getAllChannels() { + if($this->_allChannels === null) { + $this->_allChannels = array(); + + // Default channel, public to everyone: + $this->_allChannels[$this->trimChannelName($this->getConfig('defaultChannelName'))] = $this->getConfig('defaultChannelID'); + } + return $this->_allChannels; + } + +} +?> diff --git a/chat/lib/class/AJAXChatDataBase.php b/chat/lib/class/AJAXChatDataBase.php index 2cfe621..2143c5a 100644 --- a/chat/lib/class/AJAXChatDataBase.php +++ b/chat/lib/class/AJAXChatDataBase.php @@ -12,7 +12,7 @@ class AJAXChatDataBase { var $_db; - function AJAXChatDataBase(&$dbConnectionConfig) { + function __construct(&$dbConnectionConfig) { switch($dbConnectionConfig['type']) { case 'mysqli': $this->_db = new AJAXChatDatabaseMySQLi($dbConnectionConfig); diff --git a/chat/lib/class/AJAXChatHTTPHeader.php b/chat/lib/class/AJAXChatHTTPHeader.php index f7cff10..7340bfc 100644 --- a/chat/lib/class/AJAXChatHTTPHeader.php +++ b/chat/lib/class/AJAXChatHTTPHeader.php @@ -14,7 +14,7 @@ class AJAXChatHTTPHeader { var $_constant; var $_noCache; - function AJAXChatHTTPHeader($encoding='UTF-8', $contentType=null, $noCache=true) { + function __construct($encoding='UTF-8', $contentType=null, $noCache=true) { if($contentType) { $this->_contentType = $contentType.'; charset='.$encoding; $this->_constant = true; diff --git a/chat/lib/class/AJAXChatLanguage.php b/chat/lib/class/AJAXChatLanguage.php index ce29450..b197247 100644 --- a/chat/lib/class/AJAXChatLanguage.php +++ b/chat/lib/class/AJAXChatLanguage.php @@ -15,7 +15,7 @@ class AJAXChatLanguage { var $_strictMode; var $_langCode; - function AJAXChatLanguage($availableLangCodes, $defaultLangCode, $langCode=null, $strictMode=false) { + function __construct($availableLangCodes, $defaultLangCode, $langCode=null, $strictMode=false) { $this->_regExpAcceptLangCode = '/^([a-z]{1,8}(?:-[a-z]{1,8})*)(?:;\s*q=(0(?:\.[0-9]{1,3})?|1(?:\.0{1,3})?))?$/i'; $this->_availableLangCodes = $availableLangCodes; $this->_defaultLangCode = $defaultLangCode; diff --git a/chat/lib/class/AJAXChatMySQLDataBase.php b/chat/lib/class/AJAXChatMySQLDataBase.php index 4ed6020..6dca348 100644 --- a/chat/lib/class/AJAXChatMySQLDataBase.php +++ b/chat/lib/class/AJAXChatMySQLDataBase.php @@ -15,7 +15,7 @@ class AJAXChatDataBaseMySQL { var $_error = ''; var $_dbName; - function AJAXChatDataBaseMySQL(&$dbConnectionConfig) { + function __construct(&$dbConnectionConfig) { $this->_connectionID = $dbConnectionConfig['link']; $this->_dbName = $dbConnectionConfig['name']; } diff --git a/chat/lib/class/AJAXChatMySQLQuery.php b/chat/lib/class/AJAXChatMySQLQuery.php index 188a1f5..f2f3fd4 100644 --- a/chat/lib/class/AJAXChatMySQLQuery.php +++ b/chat/lib/class/AJAXChatMySQLQuery.php @@ -17,7 +17,7 @@ class AJAXChatMySQLQuery { var $_error = ''; // Constructor: - function AJAXChatMySQLQuery($sql, $connectionID = null) { + function __construct($sql, $connectionID = null) { $this->_sql = trim($sql); $this->_connectionID = $connectionID; if($this->_connectionID) { diff --git a/chat/lib/class/AJAXChatMySQLiDataBase.php b/chat/lib/class/AJAXChatMySQLiDataBase.php index 9c64a37..9bc611e 100644 --- a/chat/lib/class/AJAXChatMySQLiDataBase.php +++ b/chat/lib/class/AJAXChatMySQLiDataBase.php @@ -15,7 +15,7 @@ class AJAXChatDataBaseMySQLi { var $_error = ''; var $_dbName; - function AJAXChatDataBaseMySQLi(&$dbConnectionConfig) { + function __construct(&$dbConnectionConfig) { $this->_connectionID = $dbConnectionConfig['link']; $this->_dbName = $dbConnectionConfig['name']; } diff --git a/chat/lib/class/AJAXChatMySQLiQuery.php b/chat/lib/class/AJAXChatMySQLiQuery.php index a55d5f8..f81afd8 100644 --- a/chat/lib/class/AJAXChatMySQLiQuery.php +++ b/chat/lib/class/AJAXChatMySQLiQuery.php @@ -17,7 +17,7 @@ class AJAXChatMySQLiQuery { var $_error = ''; // Constructor: - function AJAXChatMySQLiQuery($sql, $connectionID) { + function __construct($sql, $connectionID) { $this->_sql = trim($sql); $this->_connectionID = $connectionID; $this->_result = $this->_connectionID->query($this->_sql); diff --git a/chat/lib/class/AJAXChatTemplate.php b/chat/lib/class/AJAXChatTemplate.php index e4d22d8..16e53a7 100644 --- a/chat/lib/class/AJAXChatTemplate.php +++ b/chat/lib/class/AJAXChatTemplate.php @@ -18,7 +18,7 @@ class AJAXChatTemplate { var $_parsedContent; // Constructor: - function AJAXChatTemplate(&$ajaxChat, $templateFile, $contentType=null) { + function __construct(&$ajaxChat, $templateFile, $contentType=null) { $this->ajaxChat = $ajaxChat; $this->_regExpTemplateTags = '/\[(\w+?)(?:(?:\/)|(?:\](.+?)\[\/\1))\]/s'; $this->_templateFile = $templateFile; diff --git a/chat/lib/class/CustomAJAXChat.php b/chat/lib/class/CustomAJAXChat.php index d61022b..5fad81f 100644 --- a/chat/lib/class/CustomAJAXChat.php +++ b/chat/lib/class/CustomAJAXChat.php @@ -116,7 +116,7 @@ function &getChannels() { } // Add the valid channels to the channel list (the defaultChannelID is always valid): - if($forumPermissions[$value]['canview'] == 'yes' || $value == $this->getConfig('defaultChannelID')) { + if($forumPermissions[$value]['canview'] == '1' || $value == $this->getConfig('defaultChannelID')) { $this->_channels[$key] = $value; } } @@ -193,4 +193,4 @@ function setStyle() { return; } -} \ No newline at end of file +} diff --git a/chat/lib/config.php b/chat/lib/config.php index 13562da..06fa63f 100644 --- a/chat/lib/config.php +++ b/chat/lib/config.php @@ -8,6 +8,8 @@ */ // Define AJAX Chat user roles: +define('AJAX_CHAT_BANNED', 6); +define('AJAX_CHAT_CUSTOM', 5); define('AJAX_CHAT_CHATBOT', 4); define('AJAX_CHAT_ADMIN', 3); define('AJAX_CHAT_MODERATOR', 2); @@ -55,7 +57,7 @@ ); // Available styles: -$config['styleAvailable'] = array('beige','black','grey','Oxygen','Lithium','Sulfur','Cobalt','Mercury','Uranium','Plum','prosilver','subblack2','subSilver','Core','MyBB','vBulletin'); +$config['styleAvailable'] = array('beige','black','grey','Oxygen','Lithium','Sulfur','Cobalt','Mercury','Uranium','Pine','Plum','prosilver','Core','MyBB','vBulletin','XenForo'); // Default style: $config['styleDefault'] = 'MyBB'; @@ -206,4 +208,4 @@ $config['socketServerPort'] = 1935; // This ID can be used to distinguish between different chat installations using the same socket server: $config['socketServerChatID'] = 0; -?> \ No newline at end of file +?> diff --git a/chat/lib/custom.php b/chat/lib/custom.php index 2305b5b..8e73d4d 100644 --- a/chat/lib/custom.php +++ b/chat/lib/custom.php @@ -12,6 +12,5 @@ // MyBB initialization: define('IN_MYBB', 1); -chdir(AJAX_CHAT_PATH.'../'); -require(AJAX_CHAT_PATH.'../global.php'); -?> \ No newline at end of file + +require(dirname(AJAX_CHAT_PATH).'/global.php'); diff --git a/chat/lib/lang/ar.php b/chat/lib/lang/ar.php index af9c830..b04e55c 100644 --- a/chat/lib/lang/ar.php +++ b/chat/lib/lang/ar.php @@ -1,124 +1,127 @@ - \ No newline at end of file + +$lang = array(); +$lang['title'] = 'AJAX Chat'; +$lang['userName'] = 'اسم المستخدم'; +$lang['password'] = 'كلمة المرور'; +$lang['login'] = 'دخول'; +$lang['logout'] = 'خروج'; +$lang['channel'] = 'الغرÙØ©'; +$lang['style'] = 'الشكل'; +$lang['language'] = 'اللغة'; +$lang['inputLineBreak'] = 'Press SHIFT+ENTER to input a line break'; +$lang['messageSubmit'] = 'ارسل'; +$lang['registeredUsers'] = 'الأعضاء المسجلين'; +$lang['onlineUsers'] = 'الأعضاء المتواجدين'; +$lang['toggleAutoScroll'] = 'Autoscroll on/off'; +$lang['toggleAudio'] = 'Sound on/off'; +$lang['toggleHelp'] = 'Show/hide help'; +$lang['toggleSettings'] = 'Show/hide settings'; +$lang['toggleOnlineList'] = 'Show/hide online list'; +$lang['bbCodeLabelBold'] = 'b'; +$lang['bbCodeLabelItalic'] = 'i'; +$lang['bbCodeLabelUnderline'] = 'u'; +$lang['bbCodeLabelQuote'] = 'اقتباس'; +$lang['bbCodeLabelCode'] = 'كود'; +$lang['bbCodeLabelURL'] = 'رابط'; +$lang['bbCodeLabelImg'] = 'Image'; +$lang['bbCodeLabelColor'] = 'لون الخط'; +$lang['bbCodeLabelEmoticon'] = 'Emoticons'; +$lang['bbCodeTitleBold'] = 'نص عريض: [b]نص[/b]'; +$lang['bbCodeTitleItalic'] = 'نص مائل: [i]نص[/i]'; +$lang['bbCodeTitleUnderline'] = 'نص تحته خط: [u]نص[/u]'; +$lang['bbCodeTitleQuote'] = 'نص مقتبس: [quote]نص[/quote] او [quote=الكاتب]نص[/quote]'; +$lang['bbCodeTitleCode'] = 'عرض الكود: [code]كود[/code]'; +$lang['bbCodeTitleURL'] = 'ادحال رابط: [url]http://example.org[/url] او [url=http://example.org]نص[/url]'; +$lang['bbCodeTitleImg'] = 'Insert image: [img]http://example.org/image.jpg[/img]'; +$lang['bbCodeTitleColor'] = 'لون النص: [color=red]نص[/color]'; +$lang['bbCodeTitleEmoticon'] = 'Emoticons list'; +$lang['help'] = 'مساعدة'; +$lang['helpItemDescJoin'] = 'دخول الغرÙØ©:'; +$lang['helpItemCodeJoin'] = '/join اسم الغرÙØ©'; +$lang['helpItemDescJoinCreate'] = 'انشاء غرÙØ© خاصة (للمسجلين Ùقط):'; +$lang['helpItemCodeJoinCreate'] = '/join'; +$lang['helpItemDescInvite'] = 'دعوة احد (لغرÙØ© خاصة مثلا):'; +$lang['helpItemCodeInvite'] = '/invite username'; +$lang['helpItemDescUninvite'] = 'الغاء الدعوة:'; +$lang['helpItemCodeUninvite'] = '/uninvite Username'; +$lang['helpItemDescLogout'] = 'خروج:'; +$lang['helpItemCodeLogout'] = '/quit'; +$lang['helpItemDescPrivateMessage'] = 'رسالة خاصة:'; +$lang['helpItemCodePrivateMessage'] = '/msg Username نص'; +$lang['helpItemDescQueryOpen'] = 'Ùتح ناÙذة خاصة:'; +$lang['helpItemCodeQueryOpen'] = '/query Username'; +$lang['helpItemDescQueryClose'] = 'غلق الناÙذة الخاصة:'; +$lang['helpItemCodeQueryClose'] = '/query'; +$lang['helpItemDescAction'] = 'وص٠الحدث:'; +$lang['helpItemCodeAction'] = '/action نص'; +$lang['helpItemDescDescribe'] = 'وص٠حدث برسالة خاصة:'; +$lang['helpItemCodeDescribe'] = '/describe Username نص'; +$lang['helpItemDescIgnore'] = 'تجاهل/قبول رسائل خاصة من:'; +$lang['helpItemCodeIgnore'] = '/ignore Username'; +$lang['helpItemDescIgnoreList'] = 'الأعضاء المتجاهلين:'; +$lang['helpItemCodeIgnoreList'] = '/ignore'; +$lang['helpItemDescWhereis'] = 'Display user channel:'; +$lang['helpItemCodeWhereis'] = '/whereis Username'; +$lang['helpItemDescKick'] = 'حظر مستخدمين (للمديرين Ùقط):'; +$lang['helpItemCodeKick'] = '/kick Username [دقائق الحظر]'; +$lang['helpItemDescUnban'] = 'الغاء حظر عضو (للمديرين Ùقط):'; +$lang['helpItemCodeUnban'] = '/unban Username'; +$lang['helpItemDescBans'] = 'الأعضاء المحظورين (للمديرين Ùقط):'; +$lang['helpItemCodeBans'] = '/bans'; +$lang['helpItemDescWhois'] = 'عرض الأى بى للمستخدم (المديرين Ùقط):'; +$lang['helpItemCodeWhois'] = '/whois Username'; +$lang['helpItemDescWho'] = 'الأعضاء المتواجدين:'; +$lang['helpItemCodeWho'] = '/who [Channelname]'; +$lang['helpItemDescList'] = 'القنوات المتواÙرة:'; +$lang['helpItemCodeList'] = '/list'; +$lang['helpItemDescRoll'] = 'Roll dice:'; +$lang['helpItemCodeRoll'] = '/roll [number]d[sides]'; +$lang['helpItemDescNick'] = 'Change username:'; +$lang['helpItemCodeNick'] = '/nick Username'; +$lang['settings'] = 'Settings'; +$lang['settingsBBCode'] = 'Enable BBCode:'; +$lang['settingsBBCodeImages'] = 'Enable image BBCode:'; +$lang['settingsBBCodeColors'] = 'Enable font color BBCode:'; +$lang['settingsHyperLinks'] = 'Enable hyperlinks:'; +$lang['settingsLineBreaks'] = 'Enable line breaks:'; +$lang['settingsEmoticons'] = 'Enable emoticons:'; +$lang['settingsAutoFocus'] = 'Automatically set the focus on the input field:'; +$lang['settingsMaxMessages'] = 'Maximum number of messages in the chatlist:'; +$lang['settingsWordWrap'] = 'Enable wrapping of long words:'; +$lang['settingsMaxWordLength'] = 'Maximum length of a word before it gets wrapped:'; +$lang['settingsDateFormat'] = 'Format of date and time display:'; +$lang['settingsPersistFontColor'] = 'Persist font color:'; +$lang['settingsAudioVolume'] = 'Sound Volume:'; +$lang['settingsSoundReceive'] = 'Sound for incoming messages:'; +$lang['settingsSoundSend'] = 'Sound for outgoing messages:'; +$lang['settingsSoundEnter'] = 'Sound for login and channel enter messages:'; +$lang['settingsSoundLeave'] = 'Sound for logout and channel leave messages:'; +$lang['settingsSoundChatBot'] = 'Sound for chatbot messages:'; +$lang['settingsSoundError'] = 'Sound for error messages:'; +$lang['settingsSoundPrivate'] = 'Sound for private messages:'; +$lang['settingsBlink'] = 'Blink window title on new messages:'; +$lang['settingsBlinkInterval'] = 'Blink interval in milliseconds:'; +$lang['settingsBlinkIntervalNumber'] = 'Number of blink intervals:'; +$lang['playSelectedSound'] = 'Play selected sound'; +$lang['requiresJavaScript'] = 'يجب دعم الجاÙØ© سكريبت لهذا الشات.'; +$lang['errorInvalidUser'] = 'اسم مستخدم خطأ.'; +$lang['errorUserInUse'] = 'اسم المستخدم مستخدم.'; +$lang['errorBanned'] = 'المستخدم او عنوان الأى بى محظور.'; +$lang['errorMaxUsersLoggedIn'] = 'الشات به الحد الأقصى من الأعضاء المسجلين.'; +$lang['errorChatClosed'] = 'الشات مغلق حاليا.'; +$lang['logsTitle'] = 'سحل الشات'; +$lang['logsDate'] = 'التاريخ'; +$lang['logsTime'] = 'الوقت'; +$lang['logsSearch'] = 'بحث'; +$lang['logsPrivateChannels'] = 'القنوات الخاصة'; +$lang['logsPrivateMessages'] = 'الرسائل الخاصة'; +?> diff --git a/chat/lib/lang/bg.php b/chat/lib/lang/bg.php index 46d6af1..1a5e43d 100644 --- a/chat/lib/lang/bg.php +++ b/chat/lib/lang/bg.php @@ -34,6 +34,7 @@ $lang['bbCodeLabelURL'] = 'URL'; $lang['bbCodeLabelImg'] = 'Картинка'; $lang['bbCodeLabelColor'] = 'ЦвÑÑ‚ на шрифта'; +$lang['bbCodeLabelEmoticon'] = 'УÑмивките'; $lang['bbCodeTitleBold'] = 'Получер текÑÑ‚: [b]текÑÑ‚[/b]'; $lang['bbCodeTitleItalic'] = 'КурÑивен текÑÑ‚: [i]текÑÑ‚[/i]'; $lang['bbCodeTitleUnderline'] = 'Подчертан текÑÑ‚: [u]текÑÑ‚[/u]'; @@ -42,6 +43,7 @@ $lang['bbCodeTitleURL'] = 'URL: [url]http://example.org[/url] или [url=http://example.org]текÑÑ‚[/url]'; $lang['bbCodeTitleImg'] = 'Вмъкване на картинка: [img]http://primer.org/kartinka.jpg[/img]'; $lang['bbCodeTitleColor'] = 'ЦвÑÑ‚ на шрифта: [color=red]текÑÑ‚[/color]'; +$lang['bbCodeTitleEmoticon'] = 'ÑпиÑък УÑмивките'; $lang['help'] = 'Помощ'; $lang['helpItemDescJoin'] = 'ПриÑъединÑване към канал:'; $lang['helpItemCodeJoin'] = '/join име_на_канал'; @@ -105,6 +107,7 @@ $lang['settingsSoundLeave'] = 'Звук за ÑъобщениÑта за излизане от чата или от канала:'; $lang['settingsSoundChatBot'] = 'Звук за ÑъобщениÑта на чатбота:'; $lang['settingsSoundError'] = 'Звук за ÑъобщениÑта за грешки:'; +$lang['settingsSoundPrivate'] = 'Звук за лични за ÑъобщениÑта:'; $lang['settingsBlink'] = 'Примигване на прозоречното заглавие при нови ÑъобщениÑ:'; $lang['settingsBlinkInterval'] = 'Интервал на примигване в милиÑекунди:'; $lang['settingsBlinkIntervalNumber'] = 'Брой пъти на примигване:'; @@ -121,4 +124,4 @@ $lang['logsSearch'] = 'ТърÑене'; $lang['logsPrivateChannels'] = 'Лични канали'; $lang['logsPrivateMessages'] = 'Лични ÑъобщениÑ'; -?> \ No newline at end of file +?> diff --git a/chat/lib/lang/ca.php b/chat/lib/lang/ca.php index e45c376..d059a3b 100644 --- a/chat/lib/lang/ca.php +++ b/chat/lib/lang/ca.php @@ -1,125 +1,128 @@ - \ No newline at end of file + diff --git a/chat/lib/lang/cy.php b/chat/lib/lang/cy.php index dea446d..9e47e45 100644 --- a/chat/lib/lang/cy.php +++ b/chat/lib/lang/cy.php @@ -1,124 +1,127 @@ - \ No newline at end of file + diff --git a/chat/lib/lang/cz.php b/chat/lib/lang/cz.php index cc6868c..4eb3ca2 100644 --- a/chat/lib/lang/cz.php +++ b/chat/lib/lang/cz.php @@ -33,6 +33,7 @@ $lang['bbCodeLabelURL'] = 'URL'; $lang['bbCodeLabelImg'] = 'Obrázek'; $lang['bbCodeLabelColor'] = 'Barva písma'; +$lang['bbCodeLabelEmoticon'] = 'Smajlíky'; $lang['bbCodeTitleBold'] = 'TuÄnÄ›: [b]text[/b]'; $lang['bbCodeTitleItalic'] = 'Kurzívou: [i]text[/i]'; $lang['bbCodeTitleUnderline'] = 'Podtržené: [u]text[/u]'; @@ -41,6 +42,7 @@ $lang['bbCodeTitleURL'] = 'Vložit URL: [url]http://example.org[/url] nebo [url=http://example.org]text[/url]'; $lang['bbCodeTitleImg'] = 'Vložit obrázek: [img]http://example.org/image.jpg[/img]'; $lang['bbCodeTitleColor'] = 'Barva písma: [color=red]text[/color]'; +$lang['bbCodeTitleEmoticon'] = 'Smajlíky list'; $lang['help'] = 'NápovÄ›da'; $lang['helpItemDescJoin'] = 'Vstup do místnosti:'; $lang['helpItemCodeJoin'] = '/join Místnost'; @@ -104,6 +106,7 @@ $lang['settingsSoundLeave'] = 'Zvuk pÅ™i odhlášení nebo odchodu z místnosti:'; $lang['settingsSoundChatBot'] = 'Zvuk pÅ™i zprávÄ› chatbota:'; $lang['settingsSoundError'] = 'Zvuk pÅ™i chybové zprávÄ›:'; +$lang['settingsSoundPrivate'] = 'Zvuk soukromých zpráv:'; $lang['settingsBlink'] = 'Blikání titulku okna pÅ™i příchozí zprávÄ›:'; $lang['settingsBlinkInterval'] = 'Interval blikání v milisekundách:'; $lang['settingsBlinkIntervalNumber'] = 'PoÄet bliknutí:'; @@ -120,4 +123,4 @@ $lang['logsSearch'] = 'Hledej'; $lang['logsPrivateChannels'] = 'Soukromé místnosti'; $lang['logsPrivateMessages'] = 'Soukromé zprávy'; -?> \ No newline at end of file +?> diff --git a/chat/lib/lang/da.php b/chat/lib/lang/da.php index 55e7eff..d710eb6 100644 --- a/chat/lib/lang/da.php +++ b/chat/lib/lang/da.php @@ -33,6 +33,7 @@ $lang['bbCodeLabelURL'] = 'URL'; $lang['bbCodeLabelImg'] = 'Billede'; $lang['bbCodeLabelColor'] = 'Font Farve'; +$lang['bbCodeLabelEmoticon'] = 'Smileys'; $lang['bbCodeTitleBold'] = 'Fed tekst: [b]tekstt[/b]'; $lang['bbCodeTitleItalic'] = 'Kursiv tekst: [i]tekst[/i]'; $lang['bbCodeTitleUnderline'] = 'Understreget tekst: [u]tekst[/u]'; @@ -41,6 +42,7 @@ $lang['bbCodeTitleURL'] = 'Indsæt URL: [url]http://example.org[/url] eller [url=http://example.org]text[/url]'; $lang['bbCodeTitleImg'] = 'Indsæt image: [img]http://example.org/image.jpg[/img]'; $lang['bbCodeTitleColor'] = 'Font Farve: [color=red]tekst[/color]'; +$lang['bbCodeTitleEmoticon'] = 'Smileys list'; $lang['help'] = 'Hjælp'; $lang['helpItemDescJoin'] = 'Deltag i en kanal:'; $lang['helpItemCodeJoin'] = '/join Kanalnavn'; @@ -104,6 +106,7 @@ $lang['settingsSoundLeave'] = 'Lyd ved login og forlad kanal beskeder:'; $lang['settingsSoundChatBot'] = 'Lyd ved ChatBot beskeder:'; $lang['settingsSoundError'] = 'Lyd ved fejlmeddelse:'; +$lang['settingsSoundPrivate'] = 'Lyd ved privat beskeder:'; $lang['settingsBlink'] = 'Blink vindue titel ved nye beskeder:'; $lang['settingsBlinkInterval'] = 'Blink interval i millisekonder:'; $lang['settingsBlinkIntervalNumber'] = 'Antal blink intervaler:'; diff --git a/chat/lib/lang/de.php b/chat/lib/lang/de.php index f345d10..9522648 100644 --- a/chat/lib/lang/de.php +++ b/chat/lib/lang/de.php @@ -33,6 +33,7 @@ $lang['bbCodeLabelURL'] = 'URL'; $lang['bbCodeLabelImg'] = 'Bild'; $lang['bbCodeLabelColor'] = 'Schriftfarbe'; +$lang['bbCodeLabelEmoticon'] = 'Smileys'; $lang['bbCodeTitleBold'] = 'Fett: [b]Text[/b]'; $lang['bbCodeTitleItalic'] = 'Kursiv: [i]Text[/i]'; $lang['bbCodeTitleUnderline'] = 'Unterstrichen: [u]Text[/u]'; @@ -41,6 +42,7 @@ $lang['bbCodeTitleURL'] = 'Link einfügen: [url]http://example.org[/url] oder [url=http://example.org]Text[/url]'; $lang['bbCodeTitleImg'] = 'Bild einfügen: [img]http://example.org/image.jpg[/img]'; $lang['bbCodeTitleColor'] = 'Schriftfarbe: [color=red]Text[/color]'; +$lang['bbCodeTitleEmoticon'] = 'Smileys list'; $lang['help'] = 'Hilfe'; $lang['helpItemDescJoin'] = 'Raum betreten:'; $lang['helpItemCodeJoin'] = '/join Raumname'; @@ -104,6 +106,7 @@ $lang['settingsSoundLeave'] = 'Klang für Logouts und das Verlassen von Räumen:'; $lang['settingsSoundChatBot'] = 'Klang für Chatbot Nachrichten:'; $lang['settingsSoundError'] = 'Klang für Fehlermeldungen:'; +$lang['settingsSoundPrivate'] = 'Klang für private Nachrichten:'; $lang['settingsBlink'] = 'Blinkender Fenstertitel bei neuen Nachrichten:'; $lang['settingsBlinkInterval'] = 'Blink-Intervall in Millisekunden:'; $lang['settingsBlinkIntervalNumber'] = 'Anzahl der Blink-Intervalle:'; @@ -120,4 +123,4 @@ $lang['logsSearch'] = 'Suche'; $lang['logsPrivateChannels'] = 'Private Räume'; $lang['logsPrivateMessages'] = 'Private Nachrichten'; -?> \ No newline at end of file +?> diff --git a/chat/lib/lang/el.php b/chat/lib/lang/el.php index 526c31b..a906ca8 100644 --- a/chat/lib/lang/el.php +++ b/chat/lib/lang/el.php @@ -34,6 +34,7 @@ $lang['bbCodeLabelURL'] = 'URL'; $lang['bbCodeLabelImg'] = 'Image'; $lang['bbCodeLabelColor'] = 'ΧÏώμα γÏαμματοσειÏάς'; +$lang['bbCodeLabelEmoticon'] = 'Smilies list'; $lang['bbCodeTitleBold'] = 'Έντονο κείμενο: [b]κείμενο[/b]'; $lang['bbCodeTitleItalic'] = 'Πλάγια γÏαφή: [i]κείμενο[/i]'; $lang['bbCodeTitleUnderline'] = 'ΥπογÏαμμισμένο κείμενο: [u]κείμενο[/u]'; @@ -42,6 +43,7 @@ $lang['bbCodeTitleURL'] = 'Εισαγωγή URL: [url]http://example.org[/url] ή [url=http://example.org]κείμενο[/url]'; $lang['bbCodeTitleImg'] = 'Insert image: [img]http://example.org/image.jpg[/img]'; $lang['bbCodeTitleColor'] = 'ΧÏώμα γÏαμματοσειÏάς: [color=red]κείμενο[/color]'; +$lang['bbCodeTitleEmoticon'] = 'Smilies list'; $lang['help'] = 'Βοήθεια'; $lang['helpItemDescJoin'] = 'Είσοδος σε ένα κανάλι:'; $lang['helpItemCodeJoin'] = '/join όνομα_καναλιοÏ'; @@ -105,6 +107,7 @@ $lang['settingsSoundLeave'] = 'Ήχος για μηνÏματα αποχώÏισης και αποσÏνδεσης:'; $lang['settingsSoundChatBot'] = 'Ήχος για μηνÏματα του chatbot:'; $lang['settingsSoundError'] = 'Ήχος για μηνÏματα λάθους:'; +$lang['settingsSoundPrivate'] = 'Ήχος για Ï€Ïοσωπικά μηνÏματα:'; $lang['settingsBlink'] = 'Αναβόσβημα τίτλου σε νέα μηνÏματα:'; $lang['settingsBlinkInterval'] = 'Ρυθμός αναβοσβήματος σε χιλιοστά του δευτεÏόλεπτου:'; $lang['settingsBlinkIntervalNumber'] = 'ΑÏιθμός αναβοσβήματος οθόνης:'; @@ -121,4 +124,4 @@ $lang['logsSearch'] = 'Αναζήτηση'; $lang['logsPrivateChannels'] = 'ΠÏιβέ κανάλια'; $lang['logsPrivateMessages'] = 'Ï€Ïοσωπικά μηνÏματα'; -?> \ No newline at end of file +?> diff --git a/chat/lib/lang/en.php b/chat/lib/lang/en.php index cb9492b..97e18cf 100644 --- a/chat/lib/lang/en.php +++ b/chat/lib/lang/en.php @@ -33,6 +33,7 @@ $lang['bbCodeLabelURL'] = 'URL'; $lang['bbCodeLabelImg'] = 'Image'; $lang['bbCodeLabelColor'] = 'Font Color'; +$lang['bbCodeLabelEmoticon'] = 'Emoticons'; $lang['bbCodeTitleBold'] = 'Bold text: [b]text[/b]'; $lang['bbCodeTitleItalic'] = 'Italic text: [i]text[/i]'; $lang['bbCodeTitleUnderline'] = 'Underline text: [u]text[/u]'; @@ -41,6 +42,7 @@ $lang['bbCodeTitleURL'] = 'Insert URL: [url]http://example.org[/url] or [url=http://example.org]text[/url]'; $lang['bbCodeTitleImg'] = 'Insert image: [img]http://example.org/image.jpg[/img]'; $lang['bbCodeTitleColor'] = 'Font Color: [color=red]text[/color]'; +$lang['bbCodeTitleEmoticon'] = 'Emoticons list'; $lang['help'] = 'Help'; $lang['helpItemDescJoin'] = 'Join a channel:'; $lang['helpItemCodeJoin'] = '/join Channelname'; @@ -104,6 +106,7 @@ $lang['settingsSoundLeave'] = 'Sound for logout and channel leave messages:'; $lang['settingsSoundChatBot'] = 'Sound for chatbot messages:'; $lang['settingsSoundError'] = 'Sound for error messages:'; +$lang['settingsSoundPrivate'] = 'Sound for private messages:'; $lang['settingsBlink'] = 'Blink window title on new messages:'; $lang['settingsBlinkInterval'] = 'Blink interval in milliseconds:'; $lang['settingsBlinkIntervalNumber'] = 'Number of blink intervals:'; @@ -120,4 +123,4 @@ $lang['logsSearch'] = 'Search'; $lang['logsPrivateChannels'] = 'Private Channels'; $lang['logsPrivateMessages'] = 'Private Messages'; -?> \ No newline at end of file +?> diff --git a/chat/lib/lang/es.php b/chat/lib/lang/es.php index 27b9b72..afc91c8 100644 --- a/chat/lib/lang/es.php +++ b/chat/lib/lang/es.php @@ -1,124 +1,127 @@ - \ No newline at end of file + +$lang = array(); +$lang['title'] = 'AJAX Chat'; +$lang['userName'] = 'Usuario'; +$lang['password'] = 'Contraseña'; +$lang['login'] = 'Conectar'; +$lang['logout'] = 'Desconectar'; +$lang['channel'] = 'Canal'; +$lang['style'] = 'Estilo'; +$lang['language'] = 'Idioma'; +$lang['inputLineBreak'] = 'Pulse SHIFT+ENTER para insertar un salto de línea'; +$lang['messageSubmit'] = 'Enviar'; +$lang['registeredUsers'] = 'Usuarios Registrados'; +$lang['onlineUsers'] = 'Usuarios Conectados'; +$lang['toggleAutoScroll'] = 'Autoscroll on/off'; +$lang['toggleAudio'] = 'Sonido on/off'; +$lang['toggleHelp'] = 'Mostrar/ocultar ayuda'; +$lang['toggleSettings'] = 'Mostrar/ocultar configuración'; +$lang['toggleOnlineList'] = 'Mostrar/ocultar lista conectados'; +$lang['bbCodeLabelBold'] = 'b'; +$lang['bbCodeLabelItalic'] = 'i'; +$lang['bbCodeLabelUnderline'] = 'u'; +$lang['bbCodeLabelQuote'] = 'Citar'; +$lang['bbCodeLabelCode'] = 'Código'; +$lang['bbCodeLabelURL'] = 'URL'; +$lang['bbCodeLabelImg'] = 'Imagen'; +$lang['bbCodeLabelColor'] = 'Color de Fuente'; +$lang['bbCodeLabelEmoticon'] = 'Emoticonos listo'; +$lang['bbCodeTitleBold'] = 'Texto Negrita: [b]texto[/b]'; +$lang['bbCodeTitleItalic'] = 'Texto Cursiva: [i]texto[/i]'; +$lang['bbCodeTitleUnderline'] = 'Texto Subrayado: [u]texto[/u]'; +$lang['bbCodeTitleQuote'] = 'Texto Citado: [quote]texto[/quote] o [quote=author]text[/quote]'; +$lang['bbCodeTitleCode'] = 'Mostrar código: [code]código[/code]'; +$lang['bbCodeTitleURL'] = 'Insertar URL: [url]http://example.org[/url] or [url=http://example.org]texto[/url]'; +$lang['bbCodeTitleImg'] = 'Insertar imagen: [img]http://example.org/imagen.jpg[/img]'; +$lang['bbCodeTitleColor'] = 'Color de Fuente: [color=red]texto[/color]'; +$lang['bbCodeTitleEmoticon'] = 'Emoticonos list'; +$lang['help'] = 'Ayuda'; +$lang['helpItemDescJoin'] = 'Entrar en canal:'; +$lang['helpItemCodeJoin'] = '/join nombre del canal'; +$lang['helpItemDescJoinCreate'] = 'Crear un canal privado (Solo usuarios registrados):'; +$lang['helpItemCodeJoinCreate'] = '/join'; +$lang['helpItemDescInvite'] = 'Invitar a alguien (por ejemplo a un canal privado):'; +$lang['helpItemCodeInvite'] = '/invite Usuario'; +$lang['helpItemDescUninvite'] = 'Anular invitación:'; +$lang['helpItemCodeUninvite'] = '/uninvite Usuario'; +$lang['helpItemDescLogout'] = 'Cerrar sesión:'; +$lang['helpItemCodeLogout'] = '/quit'; +$lang['helpItemDescPrivateMessage'] = 'Mensaje Privado:'; +$lang['helpItemCodePrivateMessage'] = '/msg Usuario Texto'; +$lang['helpItemDescQueryOpen'] = 'Abrir un privado:'; +$lang['helpItemCodeQueryOpen'] = '/query Usuario'; +$lang['helpItemDescQueryClose'] = 'Cerrar privado:'; +$lang['helpItemCodeQueryClose'] = '/query'; +$lang['helpItemDescAction'] = 'Describir acción:'; +$lang['helpItemCodeAction'] = '/action Texto'; +$lang['helpItemDescDescribe'] = 'Describir acción en mensaje privado:'; +$lang['helpItemCodeDescribe'] = '/describe Usuario Texto'; +$lang['helpItemDescIgnore'] = 'Ignorar/Aceptar mensajes de usuarios:'; +$lang['helpItemCodeIgnore'] = '/ignore Usuario'; +$lang['helpItemDescIgnoreList'] = 'Mostrar usuarios ignorados:'; +$lang['helpItemCodeIgnoreList'] = '/ignore'; +$lang['helpItemDescWhereis'] = 'Mostrar canal del usuario:'; +$lang['helpItemCodeWhereis'] = '/whereis Usuario'; +$lang['helpItemDescKick'] = 'Patear usuario (Solo moderadores):'; +$lang['helpItemCodeKick'] = '/kick Usuario [Minutos baneado]'; +$lang['helpItemDescUnban'] = 'Quitar ban usuario (Solo moderadores):'; +$lang['helpItemCodeUnban'] = '/unban Usuario'; +$lang['helpItemDescBans'] = 'Listar usuarios baneados (Solo moderadores):'; +$lang['helpItemCodeBans'] = '/bans'; +$lang['helpItemDescWhois'] = 'Mostrar ips de usuarios (Solo moderadores):'; +$lang['helpItemCodeWhois'] = '/whois Usuario'; +$lang['helpItemDescWho'] = 'Mostrar usuarios conectados:'; +$lang['helpItemCodeWho'] = '/who [Channelname]'; +$lang['helpItemDescList'] = 'Lista de canales disponibles:'; +$lang['helpItemCodeList'] = '/list'; +$lang['helpItemDescRoll'] = 'Tirar dado:'; +$lang['helpItemCodeRoll'] = '/roll [numero]de[lados]'; +$lang['helpItemDescNick'] = 'Cambiar nombre de usuario:'; +$lang['helpItemCodeNick'] = '/nick Usuario'; +$lang['settings'] = 'Configuración'; +$lang['settingsBBCode'] = 'Permitir BBCode:'; +$lang['settingsBBCodeImages'] = 'Permitir BBCode de imagen:'; +$lang['settingsBBCodeColors'] = 'Permitir BBCode de color de fuente:'; +$lang['settingsHyperLinks'] = 'Permitir enlaces:'; +$lang['settingsLineBreaks'] = 'Permitir saltos de línea:'; +$lang['settingsEmoticons'] = 'Permitir emoticonos:'; +$lang['settingsAutoFocus'] = 'Seleccionar el cuadro de ingreso automáticamente:'; +$lang['settingsMaxMessages'] = 'Máximo número de mensajes en la lista del chat:'; +$lang['settingsWordWrap'] = 'Permitir la separación del las palabras largas:'; +$lang['settingsMaxWordLength'] = 'Máximo tamaño de una palabara antes de que se separe:'; +$lang['settingsDateFormat'] = 'Formato de la fecha y hora a mostrar:'; +$lang['settingsPersistFontColor'] = 'Mantener el color de la fuente:'; +$lang['settingsAudioVolume'] = 'Volumen Sonido:'; +$lang['settingsSoundReceive'] = 'Sonido para mensajes entrantes:'; +$lang['settingsSoundSend'] = 'Sonido para mensajes salientes:'; +$lang['settingsSoundEnter'] = 'Sonido para mensajes de conexión y entradas al canal:'; +$lang['settingsSoundLeave'] = 'Sonido para mensajes de desconexión y salidas del canal:'; +$lang['settingsSoundChatBot'] = 'Sonido para mensajes del Chatbot:'; +$lang['settingsSoundError'] = 'Sonido para mensajes de error:'; +$lang['settingsSoundPrivate'] = 'Sonido para mensajes privados:'; +$lang['settingsBlink'] = 'Parpadeo del título de la ventana con nuevos mensajes:'; +$lang['settingsBlinkInterval'] = 'Intervalo de parpadeo en milisegundos:'; +$lang['settingsBlinkIntervalNumber'] = 'Número de intervalos de parpadeo:'; +$lang['playSelectedSound'] = 'Reproducir sonido seleccionado'; +$lang['requiresJavaScript'] = 'Necesita tener activado el Javascript en su navegador..'; +$lang['errorInvalidUser'] = 'Usuario Invalido.'; +$lang['errorUserInUse'] = 'Este nombre de usuario esta siendo utilizado en este momento.'; +$lang['errorBanned'] = 'El Usuario o la IP esta baneada..'; +$lang['errorMaxUsersLoggedIn'] = 'El Chat ha alcanzado el número máximo de usuarios conectados.'; +$lang['errorChatClosed'] = 'El Chat está cerrado en estos momentos.'; +$lang['logsTitle'] = 'AJAX Chat - Logs'; +$lang['logsDate'] = 'Fecha'; +$lang['logsTime'] = 'Hora'; +$lang['logsSearch'] = 'Buscar'; +$lang['logsPrivateChannels'] = 'Canales Privados'; +$lang['logsPrivateMessages'] = 'Mensajes Privados'; +?> diff --git a/chat/lib/lang/et.php b/chat/lib/lang/et.php index f1169fe..bd438db 100644 --- a/chat/lib/lang/et.php +++ b/chat/lib/lang/et.php @@ -33,6 +33,7 @@ $lang['bbCodeLabelURL'] = 'URL'; $lang['bbCodeLabelImg'] = 'Pilt'; $lang['bbCodeLabelColor'] = 'Fondi värv'; +$lang['bbCodeLabelEmoticon'] = 'Emotikonid'; $lang['bbCodeTitleBold'] = 'Rasvases kirjas tekst: [b]tekst[/b]'; $lang['bbCodeTitleItalic'] = 'Kaldkirjas tekst: [i]tekst[/i]'; $lang['bbCodeTitleUnderline'] = 'Underline text: [u]tekst[/u]'; @@ -41,6 +42,7 @@ $lang['bbCodeTitleURL'] = 'Lisa URL: [url]http://näide.org[/url] või [url=http://näide.org]tekst[/url]'; $lang['bbCodeTitleImg'] = 'Lisa pilt: [img]http://näide.org/pilt.jpg[/img]'; $lang['bbCodeTitleColor'] = 'Fondi värv: [color=red]tekst[/color]'; +$lang['bbCodeTitleEmoticon'] = 'Emotikonid nimekiri'; $lang['help'] = 'Abi'; $lang['helpItemDescJoin'] = 'Liitu kanaliga:'; $lang['helpItemCodeJoin'] = '/join Kanalinimi'; @@ -104,6 +106,7 @@ $lang['settingsSoundLeave'] = 'Heli väljumise ja kanalitest lahkumise sõnumitel:'; $lang['settingsSoundChatBot'] = 'Chatboti sõnumite heli:'; $lang['settingsSoundError'] = 'Veateate heli:'; +$lang['settingsSoundPrivate'] = 'Privaatsõnum sõnumite heli:'; $lang['settingsBlink'] = 'Vilguta akna tiitlit uute sõnumite saabumisel:'; $lang['settingsBlinkInterval'] = 'Vilgutamise intervall millisekundites:'; $lang['settingsBlinkIntervalNumber'] = 'Vilksatuste arv intervallis:'; @@ -120,4 +123,4 @@ $lang['logsSearch'] = 'Otsi'; $lang['logsPrivateChannels'] = 'Privaat-kanalid'; $lang['logsPrivateMessages'] = 'Privaat-sõnumid'; -?> \ No newline at end of file +?> diff --git a/chat/lib/lang/fa.php b/chat/lib/lang/fa.php index 0dc3cb1..0c64586 100644 --- a/chat/lib/lang/fa.php +++ b/chat/lib/lang/fa.php @@ -34,6 +34,7 @@ $lang['bbCodeLabelURL'] = 'URL'; $lang['bbCodeLabelImg'] = 'تصویر'; $lang['bbCodeLabelColor'] = 'رنگ خط'; +$lang['bbCodeLabelEmoticon'] = 'Smilies'; $lang['bbCodeTitleBold'] = 'متن درشت: [b]متن[/b]'; $lang['bbCodeTitleItalic'] = 'متن کج: [i]متن[/i]'; $lang['bbCodeTitleUnderline'] = 'زیر خط دار: [u]متن[/u]'; @@ -42,6 +43,7 @@ $lang['bbCodeTitleURL'] = 'وارد کردن آدرس: [url]http://example.org[/url] یا [url=http://example.org]متن[/url]'; $lang['bbCodeTitleImg'] = 'وارد کردن تصویر: [img]http://example.org/image.jpg[/img]'; $lang['bbCodeTitleColor'] = 'رنگ متن: [color=red]متن[/color]'; +$lang['bbCodeTitleEmoticon'] = 'Smilies list'; $lang['help'] = 'Ú©Ù…Ú©'; $lang['helpItemDescJoin'] = 'ورود به اطاق:'; $lang['helpItemCodeJoin'] = '/join نام اطاق'; @@ -105,6 +107,7 @@ $lang['settingsSoundLeave'] = 'Sound for logout and channel leave messages:'; $lang['settingsSoundChatBot'] = 'Sound for chatbot messages:'; $lang['settingsSoundError'] = 'Sound for error messages:'; +$lang['settingsSoundPrivate'] = 'Sound for private messages:'; $lang['settingsBlink'] = 'Blink window title on new messages:'; $lang['settingsBlinkInterval'] = 'Blink interval in milliseconds:'; $lang['settingsBlinkIntervalNumber'] = 'Number of blink intervals:'; diff --git a/chat/lib/lang/fi.php b/chat/lib/lang/fi.php index 73466b4..e30782b 100644 --- a/chat/lib/lang/fi.php +++ b/chat/lib/lang/fi.php @@ -35,6 +35,7 @@ $lang['bbCodeLabelURL'] = 'URL'; $lang['bbCodeLabelImg'] = 'Kuva'; $lang['bbCodeLabelColor'] = 'Fontin väri'; +$lang['bbCodeLabelEmoticon'] = 'Hymiöt'; $lang['bbCodeTitleBold'] = 'Lihavoitu teksti: [b]teksti[/b]'; $lang['bbCodeTitleItalic'] = 'Kursivoitu teksti: [i]teksti[/i]'; $lang['bbCodeTitleUnderline'] = 'Alleviivattu teksti: [u]teksti[/u]'; @@ -43,6 +44,7 @@ $lang['bbCodeTitleURL'] = 'Lisää linkki: [url]http://example.org[/url] tai [url=http://example.org]teksti[/url]'; $lang['bbCodeTitleImg'] = 'Lisää kuva: [img]http://example.org/image.jpg[/img]'; $lang['bbCodeTitleColor'] = 'Kirjaisimen väri: [color=red]teksti[/color]'; +$lang['bbCodeTitleEmoticon'] = 'Hymiöt lista'; $lang['help'] = 'Ohje'; $lang['helpItemDescJoin'] = 'Liity kanavalle:'; $lang['helpItemCodeJoin'] = '/join KanavanNimi'; @@ -106,6 +108,7 @@ $lang['settingsSoundLeave'] = 'Ääni poistumiseen keskustelusta ja kanavalta:'; $lang['settingsSoundChatBot'] = 'Ääni chatbotin viesteille:'; $lang['settingsSoundError'] = 'Ääni virheilmoituksille:'; +$lang['settingsSoundPrivate'] = 'Ääni varten yksityiset viesteille:'; $lang['settingsBlink'] = 'Vilkuta ikkunan nimeä uusista viesteistä:'; $lang['settingsBlinkInterval'] = 'Vilkuttamisen aika millisekunneissa:'; $lang['settingsBlinkIntervalNumber'] = 'Vilkutuksen viive:'; diff --git a/chat/lib/lang/fr.php b/chat/lib/lang/fr.php index 52ffaf1..ac14e15 100644 --- a/chat/lib/lang/fr.php +++ b/chat/lib/lang/fr.php @@ -1,125 +1,128 @@ - \ No newline at end of file + diff --git a/chat/lib/lang/gl.php b/chat/lib/lang/gl.php index 54b8a8e..7491cb9 100644 --- a/chat/lib/lang/gl.php +++ b/chat/lib/lang/gl.php @@ -34,6 +34,7 @@ $lang['bbCodeLabelURL'] = 'URL'; $lang['bbCodeLabelImg'] = 'Imagen'; $lang['bbCodeLabelColor'] = 'Color fonte'; +$lang['bbCodeLabelEmoticon'] = 'Emoticonos'; $lang['bbCodeTitleBold'] = 'Texto negriña: [b]text[/b]'; $lang['bbCodeTitleItalic'] = 'Texto cursiva: [i]text[/i]'; $lang['bbCodeTitleUnderline'] = 'Texto subraiado: [u]text[/u]'; @@ -42,6 +43,7 @@ $lang['bbCodeTitleURL'] = 'Insertar URL: [url]http://example.org[/url] or [url=http://example.org]text[/url]'; $lang['bbCodeTitleImg'] = 'Insertar imaxe: [img]http://example.org/image.jpg[/img]'; $lang['bbCodeTitleColor'] = 'Cor fonte: [color=red]text[/color]'; +$lang['bbCodeTitleEmoticon'] = 'Emoticonos lista'; $lang['help'] = 'Axuda'; $lang['helpItemDescJoin'] = 'Entrar na canle:'; $lang['helpItemCodeJoin'] = '/join nome da canle'; @@ -105,6 +107,7 @@ $lang['settingsSoundLeave'] = 'Son para logout :'; $lang['settingsSoundChatBot'] = 'Son para mensaxes chat:'; $lang['settingsSoundError'] = 'Son para errores:'; +$lang['settingsSoundPrivate'] = 'Son para mensaxes privadas:'; $lang['settingsBlink'] = 'Parpadeo en ventá con novas mensaxes:'; $lang['settingsBlinkInterval'] = 'Intervalo parpadeos (milisegundos):'; $lang['settingsBlinkIntervalNumber'] = 'Número de parpadeos:'; @@ -121,4 +124,4 @@ $lang['logsSearch'] = 'Buscar'; $lang['logsPrivateChannels'] = 'Canles privadas'; $lang['logsPrivateMessages'] = 'mensaxes privadas'; -?> \ No newline at end of file +?> diff --git a/chat/lib/lang/he.php b/chat/lib/lang/he.php index 39fa799..80f3ba0 100644 --- a/chat/lib/lang/he.php +++ b/chat/lib/lang/he.php @@ -34,6 +34,7 @@ $lang['bbCodeLabelURL'] = 'כתובת ×ינטרנט'; $lang['bbCodeLabelImg'] = 'Image'; $lang['bbCodeLabelColor'] = 'צבע גופן'; +$lang['bbCodeLabelEmoticon'] = 'Emoticons'; $lang['bbCodeTitleBold'] = 'טקסט מודגש: [b]טקסט[/b]'; $lang['bbCodeTitleItalic'] = 'טקסט נטוי: [i]טקסט[/i]'; $lang['bbCodeTitleUnderline'] = 'טקסט מודגש קו: [u]טקסט[/u]'; @@ -42,6 +43,7 @@ $lang['bbCodeTitleURL'] = 'הכנס כתובת: [url]http://www.example.org[/url] ×ו[url=http://www.example.org]טקסט[/url]'; $lang['bbCodeTitleImg'] = 'Insert image: [img]http://example.org/image.jpg[/img]'; $lang['bbCodeTitleColor'] = 'צבע גופן: [color=צבע]טקסט[/color]'; +$lang['bbCodeTitleEmoticon'] = 'Emoticons list'; $lang['help'] = 'עזרה'; $lang['helpItemDescJoin'] = 'הצטרף לערוץ:'; $lang['helpItemCodeJoin'] = '/join ×©× ×¢×¨×•×¥'; @@ -105,6 +107,7 @@ $lang['settingsSoundLeave'] = 'Sound for logout and channel leave messages:'; $lang['settingsSoundChatBot'] = 'Sound for chatbot messages:'; $lang['settingsSoundError'] = 'Sound for error messages:'; +$lang['settingsSoundPrivate'] = 'Sound for private messages:'; $lang['settingsBlink'] = 'Blink window title on new messages:'; $lang['settingsBlinkInterval'] = 'Blink interval in milliseconds:'; $lang['settingsBlinkIntervalNumber'] = 'Number of blink intervals:'; @@ -121,4 +124,4 @@ $lang['logsSearch'] = 'חיפוש'; $lang['logsPrivateChannels'] = '×¢×¨×•×¦×™× ×¤×¨×˜×™×™×'; $lang['logsPrivateMessages'] = 'הודעות פרטיות'; -?> \ No newline at end of file +?> diff --git a/chat/lib/lang/hr.php b/chat/lib/lang/hr.php index ed04510..49bb6e8 100644 --- a/chat/lib/lang/hr.php +++ b/chat/lib/lang/hr.php @@ -33,6 +33,7 @@ $lang['bbCodeLabelURL'] = 'URL'; $lang['bbCodeLabelImg'] = 'Slika'; $lang['bbCodeLabelColor'] = 'Boja'; +$lang['bbCodeLabelEmoticon'] = 'Emotikone'; $lang['bbCodeTitleBold'] = 'Snažan tekst: [b]tekst[/b]'; $lang['bbCodeTitleItalic'] = 'Kurziv: [i]tekst[/i]'; $lang['bbCodeTitleUnderline'] = 'PodvuÄeni tekst: [u]tekst[/u]'; @@ -41,6 +42,7 @@ $lang['bbCodeTitleURL'] = 'Umetanje URL: [url]http://primjer.org[/url] ili [url=http://primjer.org]tekst[/url]'; $lang['bbCodeTitleImg'] = 'Umetanje slike: [img]http://primjer.org/slika.jpg[/img]'; $lang['bbCodeTitleColor'] = 'Boja fonta: [color=red]tekst[/color]'; +$lang['bbCodeTitleEmoticon'] = 'Emotikone popis'; $lang['help'] = 'Pomoć'; $lang['helpItemDescJoin'] = 'Pridruživanje kanalu:'; $lang['helpItemCodeJoin'] = '/join kanal'; @@ -104,6 +106,7 @@ $lang['settingsSoundLeave'] = 'Zvuk za odjavljivanje i poruke napuÅ¡tanja kanala:'; $lang['settingsSoundChatBot'] = 'Zvuk za poruke brbljobota:'; $lang['settingsSoundError'] = 'Zvuk za poruke pogreÅ¡ke:'; +$lang['settingsSoundPrivate'] = 'Zvuk za poruke privatni:'; $lang['settingsBlink'] = 'Treptanje naslova prozora kod novih poruka:'; $lang['settingsBlinkInterval'] = 'Trajanje treptanja (u milisekundama):'; $lang['settingsBlinkIntervalNumber'] = 'Broj treptanja:'; diff --git a/chat/lib/lang/hu.php b/chat/lib/lang/hu.php index 5f21741..146b381 100644 --- a/chat/lib/lang/hu.php +++ b/chat/lib/lang/hu.php @@ -33,6 +33,7 @@ $lang['bbCodeLabelURL'] = 'URL'; $lang['bbCodeLabelImg'] = 'Kép'; $lang['bbCodeLabelColor'] = 'Szöveg szín'; +$lang['bbCodeLabelEmoticon'] = 'Hangulatjelek'; $lang['bbCodeTitleBold'] = 'Félkövér szöveg: [b]szöveg[/b]'; $lang['bbCodeTitleItalic'] = 'DÅ‘lt szöveg: [i]szöveg[/i]'; $lang['bbCodeTitleUnderline'] = 'Aláhúzott szöveg: [u]szöveg[/u]'; @@ -41,6 +42,7 @@ $lang['bbCodeTitleURL'] = 'URL beszúrása: [url]http://example.org[/url] vagy [url=http://example.org]szöveg[/url]'; $lang['bbCodeTitleImg'] = 'Kép beszúrása: [img]http://example.org/image.jpg[/img]'; $lang['bbCodeTitleColor'] = 'Szöveg szín: [color=red]szöveg[/color]'; +$lang['bbCodeTitleEmoticon'] = 'Hangulatjelek lista'; $lang['help'] = 'Segítség'; $lang['helpItemDescJoin'] = 'Belépés a szobába:'; $lang['helpItemCodeJoin'] = '/join Szobanév'; @@ -104,6 +106,7 @@ $lang['settingsSoundLeave'] = 'Kilépés szobaüzenetek hangja:'; $lang['settingsSoundChatBot'] = 'ChatBot üzenetek hangja:'; $lang['settingsSoundError'] = 'Hibaüzenetek hangja:'; +$lang['settingsSoundPrivate'] = 'Privát üzenetek hangja:'; $lang['settingsBlink'] = 'Ablak fejléce villogjon új üzenet esetén:'; $lang['settingsBlinkInterval'] = 'A villogás intervallumának hossza századmásodpercekben:'; $lang['settingsBlinkIntervalNumber'] = 'Villogási intervallumok száma:'; @@ -120,4 +123,4 @@ $lang['logsSearch'] = 'Keresés'; $lang['logsPrivateChannels'] = 'Privát szobák'; $lang['logsPrivateMessages'] = 'Privát üzenetek'; -?> \ No newline at end of file +?> diff --git a/chat/lib/lang/in.php b/chat/lib/lang/in.php index 175cc90..8940d1d 100644 --- a/chat/lib/lang/in.php +++ b/chat/lib/lang/in.php @@ -33,6 +33,7 @@ $lang['bbCodeLabelURL'] = 'URL'; $lang['bbCodeLabelImg'] = 'Gambar'; $lang['bbCodeLabelColor'] = 'Warna Huruf'; +$lang['bbCodeLabelEmoticon'] = 'Emoticons'; $lang['bbCodeTitleBold'] = 'Huruf Tebal: [b]kata[/b]'; $lang['bbCodeTitleItalic'] = 'Huruf Miring: [i]kata[/i]'; $lang['bbCodeTitleUnderline'] = 'Garis Bawah: [u]kata[/u]'; @@ -41,6 +42,7 @@ $lang['bbCodeTitleURL'] = 'Sisip URL: [url]http://example.org[/url] or [url=http://example.org]text[/url]'; $lang['bbCodeTitleImg'] = 'Sisip gambar: [img]http://example.org/image.jpg[/img]'; $lang['bbCodeTitleColor'] = 'Warna Huruf: [color=red]text[/color]'; +$lang['bbCodeTitleEmoticon'] = 'Emoticons list'; $lang['help'] = 'Help'; $lang['helpItemDescJoin'] = 'Gabung Channel:'; $lang['helpItemCodeJoin'] = '/join NamaChannel'; @@ -104,6 +106,7 @@ $lang['settingsSoundLeave'] = 'Suara pada saat keluar Channel:'; $lang['settingsSoundChatBot'] = 'Suara pada saat ChatBot:'; $lang['settingsSoundError'] = 'Suara pada saat terdapat kesalahan:'; +$lang['settingsSoundPrivate'] = 'Suara pada saat privasi:'; $lang['settingsBlink'] = 'Kedipkan Judul Jendela pada saat ada pesan baru:'; $lang['settingsBlinkInterval'] = 'Blink interval in milliseconds:'; $lang['settingsBlinkIntervalNumber'] = 'Jumlah interval kedipan:'; @@ -120,4 +123,4 @@ $lang['logsSearch'] = 'Cari'; $lang['logsPrivateChannels'] = 'Saluran-saluran privasi'; $lang['logsPrivateMessages'] = 'Pesan Pribadi'; -?> \ No newline at end of file +?> diff --git a/chat/lib/lang/it.php b/chat/lib/lang/it.php index abcd4f9..6901053 100644 --- a/chat/lib/lang/it.php +++ b/chat/lib/lang/it.php @@ -35,6 +35,7 @@ $lang['bbCodeLabelURL'] = 'URL'; $lang['bbCodeLabelImg'] = 'Image'; $lang['bbCodeLabelColor'] = 'Colore Testo'; +$lang['bbCodeLabelEmoticon'] = 'Emoticons'; $lang['bbCodeTitleBold'] = 'Grassetto: [b]testo[/b]'; $lang['bbCodeTitleItalic'] = 'Corsivo: [i]testo[/i]'; $lang['bbCodeTitleUnderline'] = 'Sottolineato: [u]testo[/u]'; @@ -43,6 +44,7 @@ $lang['bbCodeTitleURL'] = 'Inserire URL: [url]http://example.org/[/url] oppure [url=http://example.org/]testo[/url]'; $lang['bbCodeTitleImg'] = 'Insert image: [img]http://example.org/image.jpg[/img]'; $lang['bbCodeTitleColor'] = 'Colore Testo: [color=red]testo[/color]'; +$lang['bbCodeTitleEmoticon'] = 'Emoticons list'; $lang['help'] = 'Aiuto'; $lang['helpItemDescJoin'] = 'Entra nel canale:'; $lang['helpItemCodeJoin'] = '/join NomeCanale'; @@ -106,6 +108,7 @@ $lang['settingsSoundLeave'] = 'Suono per uscita:'; $lang['settingsSoundChatBot'] = 'Suono per messaggi robot:'; $lang['settingsSoundError'] = 'Suono per messaggi errore:'; +$lang['settingsSoundPrivate'] = 'Suono per messaggi privati:'; $lang['settingsBlink'] = 'Lampeggio nuovi messaggi:'; $lang['settingsBlinkInterval'] = 'Intervallo lampeggio:'; $lang['settingsBlinkIntervalNumber'] = 'Numero massimo lampeggi:'; @@ -122,4 +125,4 @@ $lang['logsSearch'] = 'Cerca'; $lang['logsPrivateChannels'] = 'Canali Privati'; $lang['logsPrivateMessages'] = 'Messaggi privati'; -?> \ No newline at end of file +?> diff --git a/chat/lib/lang/ja.php b/chat/lib/lang/ja.php index 075fc4f..efe3080 100644 --- a/chat/lib/lang/ja.php +++ b/chat/lib/lang/ja.php @@ -33,6 +33,7 @@ $lang['bbCodeLabelURL'] = 'URL'; $lang['bbCodeLabelImg'] = 'Image'; $lang['bbCodeLabelColor'] = 'フォントカラー'; +$lang['bbCodeLabelEmoticon'] = 'Smilies'; $lang['bbCodeTitleBold'] = 'ボールド(太字): [b]text[/b]'; $lang['bbCodeTitleItalic'] = 'イタリック(斜体): [i]text[/i]'; $lang['bbCodeTitleUnderline'] = 'アンダーライン: [u]text[/u]'; @@ -41,6 +42,7 @@ $lang['bbCodeTitleURL'] = 'URLリンク: [url]http://example.org[/url] or [url=http://example.org]text[/url]'; $lang['bbCodeTitleImg'] = 'ç”»åƒ: [img]http://example.org/image.jpg[/img]'; $lang['bbCodeTitleColor'] = 'フォントカラー: [color=red]text[/color]'; +$lang['bbCodeTitleEmoticon'] = 'Smilies list'; $lang['help'] = 'ヘルプ'; $lang['helpItemDescJoin'] = 'ãƒãƒ£ãƒ³ãƒãƒ«ã®å¤‰æ›´ :'; $lang['helpItemCodeJoin'] = '/join ãƒãƒ£ãƒ³ãƒãƒ«å'; @@ -104,6 +106,7 @@ $lang['settingsSoundLeave'] = 'サウンド - ログアウトã€ãƒãƒ£ãƒ³ãƒãƒ«é€€å®¤ :'; $lang['settingsSoundChatBot'] = 'サウンド - ãƒãƒ£ãƒƒãƒˆãƒœãƒƒãƒˆãƒ¡ãƒƒã‚»ãƒ¼ã‚¸ :'; $lang['settingsSoundError'] = 'サウンド - エラーメッセージ :'; +$lang['settingsSoundPrivate'] = 'Sound for private messages:'; $lang['settingsBlink'] = 'æ–°ç€ãƒ¡ãƒƒã‚»ãƒ¼ã‚¸ã®åˆ°ç€æ™‚ã«ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã‚¿ã‚¤ãƒˆãƒ«ã‚’点滅ã•ã›ã‚‹ :'; $lang['settingsBlinkInterval'] = '点滅ã®é–“隔(ミリ秒) :'; $lang['settingsBlinkIntervalNumber'] = '点滅ã®å›žæ•° :'; @@ -120,4 +123,4 @@ $lang['logsSearch'] = '検索'; $lang['logsPrivateChannels'] = '二人ãりモード'; $lang['logsPrivateMessages'] = 'プライベートメッセージ'; -?> \ No newline at end of file +?> diff --git a/chat/lib/lang/ka.php b/chat/lib/lang/ka.php index d92d508..96cb954 100644 --- a/chat/lib/lang/ka.php +++ b/chat/lib/lang/ka.php @@ -1,4 +1,4 @@ - \ No newline at end of file +?> diff --git a/chat/lib/lang/kr.php b/chat/lib/lang/kr.php index 687dd6e..1dc4c1e 100644 --- a/chat/lib/lang/kr.php +++ b/chat/lib/lang/kr.php @@ -1,4 +1,4 @@ - \ No newline at end of file +?> diff --git a/chat/lib/lang/mk.php b/chat/lib/lang/mk.php index f43bcfb..d713ad3 100644 --- a/chat/lib/lang/mk.php +++ b/chat/lib/lang/mk.php @@ -34,6 +34,7 @@ $lang['bbCodeLabelURL'] = 'URL'; $lang['bbCodeLabelImg'] = 'Image'; $lang['bbCodeLabelColor'] = 'Боја на фонт'; +$lang['bbCodeLabelEmoticon'] = 'емоции'; $lang['bbCodeTitleBold'] = 'Задебелен текÑÑ‚: [b]текÑÑ‚[/b]'; $lang['bbCodeTitleItalic'] = 'ЗакоÑен текÑÑ‚: [i]текÑÑ‚[/i]'; $lang['bbCodeTitleUnderline'] = 'Подцртан текÑÑ‚: [u]текÑÑ‚[/u]'; @@ -42,6 +43,7 @@ $lang['bbCodeTitleURL'] = 'URL: [url]http://example.org[/url] или [url=http://example.org]текÑÑ‚[/url]'; $lang['bbCodeTitleImg'] = 'Insert image: [img]http://example.org/image.jpg[/img]'; $lang['bbCodeTitleColor'] = 'Боја на заглавие: [color=red]текÑÑ‚[/color]'; +$lang['bbCodeTitleEmoticon'] = 'емоции лиÑта'; $lang['help'] = 'Помош'; $lang['helpItemDescJoin'] = 'ПриÑоединување кон канал:'; $lang['helpItemCodeJoin'] = '/join име_на_канал'; @@ -105,6 +107,7 @@ $lang['settingsSoundLeave'] = 'Звук за пораки за излез од четот или од каналот:'; $lang['settingsSoundChatBot'] = 'Звук за пораки на чатботот:'; $lang['settingsSoundError'] = 'Звук за пораки за грешки:'; +$lang['settingsSoundPrivate'] = 'Звук за пораки за приватни:'; $lang['settingsBlink'] = 'Жмигање на заглавието на прозорецот при нови пораки:'; $lang['settingsBlinkInterval'] = 'Интервал на жмигање во милиÑекунди:'; $lang['settingsBlinkIntervalNumber'] = 'Број пати на жмигање:'; @@ -121,4 +124,4 @@ $lang['logsSearch'] = 'Пребарување'; $lang['logsPrivateChannels'] = 'Приватни канали'; $lang['logsPrivateMessages'] = 'Приватни пораки'; -?> \ No newline at end of file +?> diff --git a/chat/lib/lang/nl-be.php b/chat/lib/lang/nl-be.php index db01b98..8449aeb 100644 --- a/chat/lib/lang/nl-be.php +++ b/chat/lib/lang/nl-be.php @@ -1,124 +1,127 @@ - \ No newline at end of file + diff --git a/chat/lib/lang/nl.php b/chat/lib/lang/nl.php index c7dcc4b..f984db5 100644 --- a/chat/lib/lang/nl.php +++ b/chat/lib/lang/nl.php @@ -1,124 +1,127 @@ - \ No newline at end of file + diff --git a/chat/lib/lang/no.php b/chat/lib/lang/no.php index 52fe4af..855efd5 100644 --- a/chat/lib/lang/no.php +++ b/chat/lib/lang/no.php @@ -1,124 +1,127 @@ - \ No newline at end of file + diff --git a/chat/lib/lang/pl.php b/chat/lib/lang/pl.php index 92a1716..dd041f1 100644 --- a/chat/lib/lang/pl.php +++ b/chat/lib/lang/pl.php @@ -1,124 +1,127 @@ - \ No newline at end of file + diff --git a/chat/lib/lang/pt-br.php b/chat/lib/lang/pt-br.php index 034a5fb..8837a1e 100644 --- a/chat/lib/lang/pt-br.php +++ b/chat/lib/lang/pt-br.php @@ -34,6 +34,7 @@ $lang['bbCodeLabelURL'] = 'URL'; $lang['bbCodeLabelImg'] = 'Imagem'; $lang['bbCodeLabelColor'] = 'Cor da fonte'; +$lang['bbCodeLabelEmoticon'] = 'Emoticons'; $lang['bbCodeTitleBold'] = 'Texto negrito: [b]texto[/b]'; $lang['bbCodeTitleItalic'] = 'Texto itálico: [i]texto[/i]'; $lang['bbCodeTitleUnderline'] = 'Texto sublinhado: [u]texto[/u]'; @@ -42,6 +43,7 @@ $lang['bbCodeTitleURL'] = 'Inserir URL: [url]http://example.org[/url] or [url=http://example.org]texto[/url]'; $lang['bbCodeTitleImg'] = 'Inserir imagem: [img]http://example.org/image.jpg[/img]'; $lang['bbCodeTitleColor'] = 'Cor da fonte: [color=red]texto[/color]'; +$lang['bbCodeTitleEmoticon'] = 'Emoticons list'; $lang['help'] = 'Ajuda'; $lang['helpItemDescJoin'] = 'Entrar em um canal:'; $lang['helpItemCodeJoin'] = '/join Nome do Canal'; @@ -105,6 +107,7 @@ $lang['settingsSoundLeave'] = 'Som para logout e avisos de saida em canais:'; $lang['settingsSoundChatBot'] = 'Som para mensagens do chatbot:'; $lang['settingsSoundError'] = 'Som para mensagens de erro:'; +$lang['settingsSoundPrivate'] = 'Som para mensagens do privado:'; $lang['settingsBlink'] = 'Título da janela do piscamento em mensagens novas:'; $lang['settingsBlinkInterval'] = 'Intervalo do piscamento nos milissegundos:'; $lang['settingsBlinkIntervalNumber'] = 'Número de intervalos do piscamento:'; @@ -121,4 +124,4 @@ $lang['logsSearch'] = 'Pesquisar'; $lang['logsPrivateChannels'] = 'Canais privados'; $lang['logsPrivateMessages'] = 'Mensagens privadas'; -?> \ No newline at end of file +?> diff --git a/chat/lib/lang/pt-pt.php b/chat/lib/lang/pt-pt.php index e3399eb..0576b30 100644 --- a/chat/lib/lang/pt-pt.php +++ b/chat/lib/lang/pt-pt.php @@ -34,6 +34,7 @@ $lang['bbCodeLabelURL'] = 'URL'; $lang['bbCodeLabelImg'] = 'Imagem'; $lang['bbCodeLabelColor'] = 'Cor da fonte'; +$lang['bbCodeLabelEmoticon'] = 'Smileys'; $lang['bbCodeTitleBold'] = 'Texto a negrito: [b]texto[/b]'; $lang['bbCodeTitleItalic'] = 'Texto itálico: [i]texto[/i]'; $lang['bbCodeTitleUnderline'] = 'Texto sublinhado: [u]texto[/u]'; @@ -42,6 +43,7 @@ $lang['bbCodeTitleURL'] = 'Inserir URL: [url]http://example.org[/url] ou [url=http://example.org]texto[/url]'; $lang['bbCodeTitleImg'] = 'Inserir imagem: [img]http://example.org/imagem.jpg[/img]'; $lang['bbCodeTitleColor'] = 'Cor da fonte: [color=red]texto[/color]'; +$lang['bbCodeTitleEmoticon'] = 'Smileys list'; $lang['help'] = 'Ajuda'; $lang['helpItemDescJoin'] = 'Entrar numa sala:'; $lang['helpItemCodeJoin'] = '/join [Nome da sala]'; @@ -105,6 +107,7 @@ $lang['settingsSoundLeave'] = 'Som de logout:'; $lang['settingsSoundChatBot'] = 'Som para mensagens do chatbot:'; $lang['settingsSoundError'] = 'Som para mensagens de erro:'; +$lang['settingsSoundPrivate'] = 'Som para mensagens de privadas:'; $lang['settingsBlink'] = 'Título da janela do "piscamento" em mensagens novas:'; $lang['settingsBlinkInterval'] = 'Intervalo do "piscamento" em milissegundos:'; $lang['settingsBlinkIntervalNumber'] = 'Número de intervalos do "piscamento":'; @@ -121,4 +124,4 @@ $lang['logsSearch'] = 'Procurar'; $lang['logsPrivateChannels'] = 'Salas privadas'; $lang['logsPrivateMessages'] = 'Mensagens privadas'; -?> \ No newline at end of file +?> diff --git a/chat/lib/lang/ro.php b/chat/lib/lang/ro.php index 8e6d641..db62fb5 100644 --- a/chat/lib/lang/ro.php +++ b/chat/lib/lang/ro.php @@ -34,6 +34,7 @@ $lang['bbCodeLabelURL'] = 'URL'; $lang['bbCodeLabelImg'] = 'Image'; $lang['bbCodeLabelColor'] = 'Culoare fontului'; +$lang['bbCodeLabelEmoticon'] = 'Emoticons'; $lang['bbCodeTitleBold'] = 'Text îngroÅŸat: [b]text[/b]'; $lang['bbCodeTitleItalic'] = 'Text înclinat: [i]text[/i]'; $lang['bbCodeTitleUnderline'] = 'Text subliniat: [u]text[/u]'; @@ -42,6 +43,7 @@ $lang['bbCodeTitleURL'] = 'Introdu URL: [url]http://example.org[/url] or [url=http://example.org]text[/url]'; $lang['bbCodeTitleImg'] = 'Insert image: [img]http://example.org/image.jpg[/img]'; $lang['bbCodeTitleColor'] = 'Culoarea fontului: [color=red]text[/color]'; +$lang['bbCodeTitleEmoticon'] = 'Emoticons list'; $lang['help'] = 'Ajutor'; $lang['helpItemDescJoin'] = 'Alăturăte canalului:'; $lang['helpItemCodeJoin'] = '/join Channelname'; @@ -105,6 +107,7 @@ $lang['settingsSoundLeave'] = 'Sound for logout and channel leave messages:'; $lang['settingsSoundChatBot'] = 'Sound for chatbot messages:'; $lang['settingsSoundError'] = 'Sound for error messages:'; +$lang['settingsSoundPrivate'] = 'Sound for private messages:'; $lang['settingsBlink'] = 'Blink window title on new messages:'; $lang['settingsBlinkInterval'] = 'Blink interval in milliseconds:'; $lang['settingsBlinkIntervalNumber'] = 'Number of blink intervals:'; @@ -121,4 +124,4 @@ $lang['logsSearch'] = 'Caută'; $lang['logsPrivateChannels'] = 'Canale private'; $lang['logsPrivateMessages'] = 'Mesaje private'; -?> \ No newline at end of file +?> diff --git a/chat/lib/lang/ru.php b/chat/lib/lang/ru.php index ac86531..5fb6d91 100644 --- a/chat/lib/lang/ru.php +++ b/chat/lib/lang/ru.php @@ -35,6 +35,7 @@ $lang['bbCodeLabelURL'] = 'URL'; $lang['bbCodeLabelImg'] = 'Image'; $lang['bbCodeLabelColor'] = 'Цвет шрифта'; +$lang['bbCodeLabelEmoticon'] = 'Смайли'; $lang['bbCodeTitleBold'] = 'Жирный текÑÑ‚: [b]текÑÑ‚[/b]'; $lang['bbCodeTitleItalic'] = 'КурÑив: [i]текÑÑ‚[/i]'; $lang['bbCodeTitleUnderline'] = 'Подчеркнутый текÑÑ‚: [u]текÑÑ‚[/u]'; @@ -43,6 +44,7 @@ $lang['bbCodeTitleURL'] = 'Ð’Ñтавить ÑÑылку: [url]http://example.org[/url] или [url=http://example.org]текÑÑ‚[/url]'; $lang['bbCodeTitleImg'] = 'Insert image: [img]http://example.org/image.jpg[/img]'; $lang['bbCodeTitleColor'] = 'Цвет шрифта: [color=red]текÑÑ‚[/color]'; +$lang['bbCodeTitleEmoticon'] = 'ÑпиÑок Смайли'; $lang['help'] = 'Помощь'; $lang['helpItemDescJoin'] = 'ПриÑоеденитьÑÑ Ðº каналу:'; $lang['helpItemCodeJoin'] = '/join имÑ_канала'; @@ -106,6 +108,7 @@ $lang['settingsSoundLeave'] = 'Звук Ð´Ð»Ñ Ð¾Ð¿Ð¾Ð²ÐµÑ‰ÐµÐ½Ð¸Ñ Ð¾Ð± уходе учаÑтника из чата:'; $lang['settingsSoundChatBot'] = 'Звук Ð´Ð»Ñ Ñообщений бота:'; $lang['settingsSoundError'] = 'Звук Ð´Ð»Ñ Ð¾Ð¿Ð¾Ð²ÐµÑ‰ÐµÐ½Ð¸Ð¹ об ошибках:'; +$lang['settingsSoundPrivate'] = 'Звук Ð´Ð»Ñ Ð»Ð¸Ñ‡Ð½Ñ‹Ñ… Ñообщений:'; $lang['settingsBlink'] = '"Моргать" заголовком окна при новом Ñообщении:'; $lang['settingsBlinkInterval'] = 'Интервал "морганиÑ" (в миллиÑекундах):'; $lang['settingsBlinkIntervalNumber'] = 'КоличеÑтво "морганий":'; @@ -122,4 +125,4 @@ $lang['logsSearch'] = 'ПоиÑк'; $lang['logsPrivateChannels'] = 'Приватные каналы'; $lang['logsPrivateMessages'] = 'Приватные ÑообщениÑ'; -?> \ No newline at end of file +?> diff --git a/chat/lib/lang/sk.php b/chat/lib/lang/sk.php index fae99a7..752190d 100644 --- a/chat/lib/lang/sk.php +++ b/chat/lib/lang/sk.php @@ -34,6 +34,7 @@ $lang['bbCodeLabelURL'] = 'URL'; $lang['bbCodeLabelImg'] = 'Image'; $lang['bbCodeLabelColor'] = 'Farba písma'; +$lang['bbCodeLabelEmoticon'] = 'Emoticons'; $lang['bbCodeTitleBold'] = 'TuÄné: [b]text[/b]'; $lang['bbCodeTitleItalic'] = 'Kurzívou: [i]text[/i]'; $lang['bbCodeTitleUnderline'] = 'PodÄiarknuté: [u]text[/u]'; @@ -42,6 +43,7 @@ $lang['bbCodeTitleURL'] = 'VložiÅ¥ URL: [url]http://www.example.org/[/url] alebo [url=http://www.example.org/]text[/url]'; $lang['bbCodeTitleImg'] = 'Insert image: [img]http://example.org/image.jpg[/img]'; $lang['bbCodeTitleColor'] = 'Farba písma: [color=red]text[/color]'; +$lang['bbCodeTitleEmoticon'] = 'Emoticons list'; $lang['help'] = 'Nápoveda'; $lang['helpItemDescJoin'] = 'Prihlásenie do kanálu:'; $lang['helpItemCodeJoin'] = '/join Názov_kanálu'; @@ -105,6 +107,7 @@ $lang['settingsSoundLeave'] = 'Sound for logout and channel leave messages:'; $lang['settingsSoundChatBot'] = 'Sound for chatbot messages:'; $lang['settingsSoundError'] = 'Sound for error messages:'; +$lang['settingsSoundPrivate'] = 'Sound for private messages:'; $lang['settingsBlink'] = 'Blink window title on new messages:'; $lang['settingsBlinkInterval'] = 'Blink interval in milliseconds:'; $lang['settingsBlinkIntervalNumber'] = 'Number of blink intervals:'; @@ -121,4 +124,4 @@ $lang['logsSearch'] = 'Vyhľadávanie'; $lang['logsPrivateChannels'] = 'Súkromný kanál'; $lang['logsPrivateMessages'] = 'Súkromná správa'; -?> \ No newline at end of file +?> diff --git a/chat/lib/lang/sl.php b/chat/lib/lang/sl.php index 6e49415..4a5a7b6 100644 --- a/chat/lib/lang/sl.php +++ b/chat/lib/lang/sl.php @@ -1,124 +1,127 @@ - \ No newline at end of file + diff --git a/chat/lib/lang/sr.php b/chat/lib/lang/sr.php index a14ba55..1a99a3e 100644 --- a/chat/lib/lang/sr.php +++ b/chat/lib/lang/sr.php @@ -34,6 +34,7 @@ $lang['bbCodeLabelURL'] = 'URL'; $lang['bbCodeLabelImg'] = 'Image'; $lang['bbCodeLabelColor'] = 'Boja fonta'; +$lang['bbCodeLabelEmoticon'] = 'Emocije'; $lang['bbCodeTitleBold'] = 'Podebljan tekst: [b]text[/b]'; $lang['bbCodeTitleItalic'] = 'Iskrivljen tekst: [i]text[/i]'; $lang['bbCodeTitleUnderline'] = 'PodvuÄen tekst: [u]text[/u]'; @@ -42,6 +43,7 @@ $lang['bbCodeTitleURL'] = 'Unesi URL: [url]http://www.example.org/[/url] ili [url=http://www.example.org/]text[/url]'; $lang['bbCodeTitleImg'] = 'Insert image: [img]http://example.org/image.jpg[/img]'; $lang['bbCodeTitleColor'] = 'Boja fonta: [color=red]text[/color]'; +$lang['bbCodeTitleEmoticon'] = 'Emocije list'; $lang['help'] = 'Pomoć'; $lang['helpItemDescJoin'] = 'PrikljuÄi se sobi:'; $lang['helpItemCodeJoin'] = '/join Naziv sobe'; @@ -105,6 +107,7 @@ $lang['settingsSoundLeave'] = 'Zvuk za odjavljivanje i izlazak iz sobe:'; $lang['settingsSoundChatBot'] = 'Zvuk za chatbot poruke:'; $lang['settingsSoundError'] = 'Zvuk za poruke o greÅ¡ci:'; +$lang['settingsSoundPrivate'] = 'Zvuk za privatne poruke:'; $lang['settingsBlink'] = 'Treptanje naziva prozora za nove poruke:'; $lang['settingsBlinkInterval'] = 'Interval treptanja u milisekundama:'; $lang['settingsBlinkIntervalNumber'] = 'Broj intervala treptanja:'; @@ -121,4 +124,4 @@ $lang['logsSearch'] = 'Pretraga'; $lang['logsPrivateChannels'] = 'Privatne sobe'; $lang['logsPrivateMessages'] = 'Privatne poruke'; -?> \ No newline at end of file +?> diff --git a/chat/lib/lang/sv.php b/chat/lib/lang/sv.php index 87f03a0..4bf8403 100644 --- a/chat/lib/lang/sv.php +++ b/chat/lib/lang/sv.php @@ -34,6 +34,7 @@ $lang['bbCodeLabelURL'] = 'URL'; $lang['bbCodeLabelImg'] = 'Image'; $lang['bbCodeLabelColor'] = 'Textfärg'; +$lang['bbCodeLabelEmoticon'] = 'Smileys'; $lang['bbCodeTitleBold'] = 'Fet text: [b]text[/b]'; $lang['bbCodeTitleItalic'] = 'Kursiv text: [i]text[/i]'; $lang['bbCodeTitleUnderline'] = 'Understruken text: [u]text[/u]'; @@ -42,6 +43,7 @@ $lang['bbCodeTitleURL'] = 'Lägg till URL: [url]http://www.example.org/[/url] or [url=http://www.example.org/]text[/url]'; $lang['bbCodeTitleImg'] = 'Infoga bild: [img]http://example.org/image.jpg[/img]'; $lang['bbCodeTitleColor'] = 'Textfärg: [color=red]text[/color]'; +$lang['bbCodeTitleEmoticon'] = 'Smileys list'; $lang['help'] = 'Hjälp'; $lang['helpItemDescJoin'] = 'Anslut till kanal:'; $lang['helpItemCodeJoin'] = '/join Kanalens namn'; @@ -105,6 +107,7 @@ $lang['settingsSoundLeave'] = 'Ljud för Logga ut/lämna Kanal meddelanden:'; $lang['settingsSoundChatBot'] = 'Ljud för Chatbot meddelanden:'; $lang['settingsSoundError'] = 'Ljud för felmeddelanden:'; +$lang['settingsSoundPrivate'] = 'Ljud för privata meddelanden:'; $lang['settingsBlink'] = 'Blinka fönstrets titel vid nya meddelanden:'; $lang['settingsBlinkInterval'] = 'Blinkintervall i millisekunder:'; $lang['settingsBlinkIntervalNumber'] = 'Antal blinkintervaller:'; @@ -121,4 +124,4 @@ $lang['logsSearch'] = 'Sök'; $lang['logsPrivateChannels'] = 'Privata Kanaler'; $lang['logsPrivateMessages'] = 'Privata Meddelanden'; -?> \ No newline at end of file +?> diff --git a/chat/lib/lang/th.php b/chat/lib/lang/th.php index 7ed3b1e..1b0149d 100644 --- a/chat/lib/lang/th.php +++ b/chat/lib/lang/th.php @@ -34,6 +34,7 @@ $lang['bbCodeLabelURL'] = 'ลิงค์'; $lang['bbCodeLabelImg'] = 'ภาพ'; $lang['bbCodeLabelColor'] = 'สีอัà¸à¸©à¸£'; +$lang['bbCodeLabelEmoticon'] = 'Smilies'; $lang['bbCodeTitleBold'] = 'อัà¸à¸©à¸£à¸•à¸±à¸§à¸«à¸™à¹‰à¸²: [b]ข้อความ[/b]'; $lang['bbCodeTitleItalic'] = 'อัà¸à¸©à¸£à¸•à¸±à¸§à¹€à¸­à¸µà¸¢à¸‡: [i]ข้อความ[/i]'; $lang['bbCodeTitleUnderline'] = 'อัà¸à¸©à¸£à¸‚ีดเส้นใต้: [u]ข้อความ[/u]'; @@ -42,6 +43,7 @@ $lang['bbCodeTitleURL'] = 'à¹à¸—รà¸à¸¥à¸´à¸‡à¸„์: [url]http://example.org[/url] or [url=http://example.org]ข้อความ[/url]'; $lang['bbCodeTitleImg'] = 'à¹à¸—รà¸à¸ à¸²à¸ž: [img]http://example.org/image.jpg[/img]'; $lang['bbCodeTitleColor'] = 'ตัวอัà¸à¸©à¸£à¸ªà¸µ: [color=red]ข้อความ[/color]'; +$lang['bbCodeTitleEmoticon'] = 'Smilies list'; $lang['help'] = 'ช่วยเหลือ'; $lang['helpItemDescJoin'] = 'ร่วมห้องà¹à¸Šà¸—:'; $lang['helpItemCodeJoin'] = '/join ชื่อห้องà¹à¸Šà¸—'; @@ -105,6 +107,7 @@ $lang['settingsSoundLeave'] = 'เสียงสำหรับออà¸à¸ˆà¸²à¸à¸£à¸°à¸šà¸šà¹à¸¥à¸°à¸­à¸­à¸à¸ˆà¸²à¸à¸«à¹‰à¸­à¸‡:'; $lang['settingsSoundChatBot'] = 'เสียงสำหรับข้อความจาำà¸à¸£à¸°à¸šà¸š:'; $lang['settingsSoundError'] = 'เสียงสำหรับข้อความผิดพลาด:'; +$lang['settingsSoundPrivate'] = 'Sound for private messages:'; $lang['settingsBlink'] = 'มีสัà¸à¸à¸²à¸“ à¸à¸£à¸°à¸žà¸£à¸´à¸šà¸šà¸™ Title Bar เมื่อมีข้อความใหม่:'; $lang['settingsBlinkInterval'] = 'Blink interval in milliseconds:'; $lang['settingsBlinkIntervalNumber'] = 'Number of blink intervals:'; @@ -121,4 +124,4 @@ $lang['logsSearch'] = 'ค้นหา'; $lang['logsPrivateChannels'] = 'ห้องส่วนตัว'; $lang['logsPrivateMessages'] = 'ข้อความส่วนตัว'; -?> \ No newline at end of file +?> diff --git a/chat/lib/lang/tr.php b/chat/lib/lang/tr.php index 00f7dfa..07709bb 100644 --- a/chat/lib/lang/tr.php +++ b/chat/lib/lang/tr.php @@ -34,6 +34,7 @@ $lang['bbCodeLabelURL'] = 'URL'; $lang['bbCodeLabelImg'] = 'Resim'; $lang['bbCodeLabelColor'] = 'Renkli Yazı'; +$lang['bbCodeLabelEmoticon'] = 'Emoticons'; $lang['bbCodeTitleBold'] = 'Kalın text: [b]text[/b]'; $lang['bbCodeTitleItalic'] = 'EÄŸik text: [i]text[/i]'; $lang['bbCodeTitleUnderline'] = 'Altçizgili text: [u]text[/u]'; @@ -42,6 +43,7 @@ $lang['bbCodeTitleURL'] = 'URL gir: [url]http://example.org[/url] veya [url=http://example.org]text[/url]'; $lang['bbCodeTitleImg'] = 'Resim gir: [img]http://example.org/image.jpg[/img]'; $lang['bbCodeTitleColor'] = 'Font Rengi: [color=red]text[/color]'; +$lang['bbCodeTitleEmoticon'] = 'Emoticons list'; $lang['help'] = 'Yardım'; $lang['helpItemDescJoin'] = 'Bir kanala girin:'; $lang['helpItemCodeJoin'] = '/join kanalismi'; @@ -105,6 +107,7 @@ $lang['settingsSoundLeave'] = 'Çıkış ve kanaldan çıkış sesi:'; $lang['settingsSoundChatBot'] = 'Chatbot mesajları sesi:'; $lang['settingsSoundError'] = 'Hata mesajları sesi:'; +$lang['settingsSoundPrivate'] = 'Özel mesajlar sesi:'; $lang['settingsBlink'] = 'Yeni mesaj geldiÄŸinde pencere baÅŸlığını kırp:'; $lang['settingsBlinkInterval'] = 'Milisaniye olarak kırpma aralığı:'; $lang['settingsBlinkIntervalNumber'] = 'Kırpma sayısı aralığı:'; @@ -121,4 +124,4 @@ $lang['logsSearch'] = 'Ara'; $lang['logsPrivateChannels'] = 'Özel Kanallar'; $lang['logsPrivateMessages'] = 'Özel Mesajlar'; -?> \ No newline at end of file +?> diff --git a/chat/lib/lang/uk.php b/chat/lib/lang/uk.php index a7d80c1..d8bb72e 100644 --- a/chat/lib/lang/uk.php +++ b/chat/lib/lang/uk.php @@ -34,6 +34,7 @@ $lang['bbCodeLabelURL'] = 'URL'; $lang['bbCodeLabelImg'] = 'Image'; $lang['bbCodeLabelColor'] = 'Колір шрифту'; +$lang['bbCodeLabelEmoticon'] = 'Smilies'; $lang['bbCodeTitleBold'] = 'Жирний текÑÑ‚: [b]текÑÑ‚[/b]'; $lang['bbCodeTitleItalic'] = 'ТекÑÑ‚ курÑивом: [i]текÑÑ‚[/i]'; $lang['bbCodeTitleUnderline'] = 'ПідкреÑлений текÑÑ‚: [u]текÑÑ‚[/u]'; @@ -42,6 +43,7 @@ $lang['bbCodeTitleURL'] = 'Показати URL: [url]http://example.org[/url] or [url=http://example.org]текÑÑ‚[/url]'; $lang['bbCodeTitleImg'] = 'Insert image: [img]http://example.org/image.jpg[/img]'; $lang['bbCodeTitleColor'] = 'Колір шрифту: [color=red]текÑÑ‚[/color]'; +$lang['bbCodeTitleEmoticon'] = 'Smilies list'; $lang['help'] = 'Допомога'; $lang['helpItemDescJoin'] = 'Зайти в кімнату:'; $lang['helpItemCodeJoin'] = '/join Ðазва_Кімнати'; @@ -105,6 +107,7 @@ $lang['settingsSoundLeave'] = 'Звук Ð´Ð»Ñ Ð¿Ð¾Ð´Ñ–Ñ— виходу з Чату чи кімнати:'; $lang['settingsSoundChatBot'] = 'Звук Ð´Ð»Ñ ÑиÑтемних повідомлень:'; $lang['settingsSoundError'] = 'Звук Ð´Ð»Ñ Ð¿Ð¾Ð¼Ð¸Ð»Ð¾Ðº:'; +$lang['settingsSoundPrivate'] = 'Звук Ð´Ð»Ñ Ð¾ÑобиÑтих повідомлень:'; $lang['settingsBlink'] = 'Сигналізувати при поÑві нових повідомлень (Ð±Ð»Ð¸Ð¼Ð°Ð½Ð½Ñ Ð·Ð°Ð³Ð¾Ð»Ð¾Ð²ÐºÑƒ вікна):'; $lang['settingsBlinkInterval'] = 'ТриваліÑÑ‚ÑŒ Ð±Ð»Ð¸Ð¼Ð°Ð½Ð½Ñ Ð·Ð°Ð³Ð¾Ð»Ð¾Ð²ÐºÑƒ вікна:'; $lang['settingsBlinkIntervalNumber'] = 'КількіÑÑ‚ÑŒ блимань:'; @@ -121,4 +124,4 @@ $lang['logsSearch'] = 'Пошук'; $lang['logsPrivateChannels'] = 'Приватні кімнати'; $lang['logsPrivateMessages'] = 'Приватні повідомленнÑ'; -?> \ No newline at end of file +?> diff --git a/chat/lib/lang/zh-tw.php b/chat/lib/lang/zh-tw.php index d39fe6b..1224004 100644 --- a/chat/lib/lang/zh-tw.php +++ b/chat/lib/lang/zh-tw.php @@ -33,6 +33,7 @@ $lang['bbCodeLabelURL'] = '連çµ'; $lang['bbCodeLabelImg'] = '圖片'; $lang['bbCodeLabelColor'] = 'å­—é«”é¡è‰²'; +$lang['bbCodeLabelEmoticon'] = 'Smilies'; $lang['bbCodeTitleBold'] = '粗體字: [b]文字[/b]'; $lang['bbCodeTitleItalic'] = '斜體字: [i]文字[/i]'; $lang['bbCodeTitleUnderline'] = '底線: [u]文字[/u]'; @@ -41,6 +42,7 @@ $lang['bbCodeTitleURL'] = 'æ’å…¥URL: [url]http://example.org[/url] 或 [url=http://example.org]文字[/url]'; $lang['bbCodeTitleImg'] = 'æ’入圖片: [img]http://example.org/image.png[/img]'; $lang['bbCodeTitleColor'] = 'å­—é«”é¡è‰²ï¼š [color=red]文字[/color]'; +$lang['bbCodeTitleEmoticon'] = 'Smilies list'; $lang['help'] = '使用說明'; $lang['helpItemDescJoin'] = '進入一個房間:'; $lang['helpItemCodeJoin'] = '/join 房間å'; @@ -104,6 +106,7 @@ $lang['settingsSoundLeave'] = '登出和離開房間的音效:'; $lang['settingsSoundChatBot'] = '系統訊æ¯çš„音效:'; $lang['settingsSoundError'] = '錯誤訊æ¯çš„音效:'; +$lang['settingsSoundPrivate'] = 'Sound for private messages:'; $lang['settingsBlink'] = '當有新訊æ¯æ™‚閃動標題:'; $lang['settingsBlinkInterval'] = '閃動的間隔時間(毫秒):'; $lang['settingsBlinkIntervalNumber'] = '閃動次數:'; diff --git a/chat/lib/lang/zh.php b/chat/lib/lang/zh.php index 1d18f0b..18677e6 100644 --- a/chat/lib/lang/zh.php +++ b/chat/lib/lang/zh.php @@ -34,6 +34,7 @@ $lang['bbCodeLabelURL'] = 'URL'; $lang['bbCodeLabelImg'] = 'Image'; $lang['bbCodeLabelColor'] = '文字颜色'; +$lang['bbCodeLabelEmoticon'] = 'Smilies'; $lang['bbCodeTitleBold'] = '粗体:[b]文字[/b]'; $lang['bbCodeTitleItalic'] = '斜体:[i]文字[/i]'; $lang['bbCodeTitleUnderline'] = '下划线:[u]文字[/u]'; @@ -42,6 +43,7 @@ $lang['bbCodeTitleURL'] = 'æ’å…¥ URL:[url]http://example.org[/url] 或者 [url=http://example.org]文字[/url]'; $lang['bbCodeTitleImg'] = 'Insert image: [img]http://example.org/image.jpg[/img]'; $lang['bbCodeTitleColor'] = '文字颜色:[color=red]文字[/color]'; +$lang['bbCodeTitleEmoticon'] = 'Smilies list'; $lang['help'] = '帮助'; $lang['helpItemDescJoin'] = '加入频é“'; $lang['helpItemCodeJoin'] = '/join 频é“å'; @@ -104,6 +106,7 @@ $lang['settingsSoundEnter'] = '声音æ示登录或进入频é“ä¿¡æ¯ï¼š'; $lang['settingsSoundLeave'] = '声音æ示退出或离开频é“ä¿¡æ¯ï¼š'; $lang['settingsSoundChatBot'] = '声音æ示机器人信æ¯ï¼š'; +$lang['settingsSoundPrivate'] = 'Sound for private messages:'; $lang['settingsSoundError'] = '声音æ示错误信æ¯ï¼š'; $lang['settingsBlink'] = '有新消æ¯æ—¶é—ªçƒçª—å£æ ‡é¢˜ï¼š'; $lang['settingsBlinkInterval'] = '空闲间隔毫秒数:'; @@ -121,4 +124,4 @@ $lang['logsSearch'] = 'æœç´¢'; $lang['logsPrivateChannels'] = 'ç§äººé¢‘é“'; $lang['logsPrivateMessages'] = 'ç§äººæ¶ˆæ¯'; -?> \ No newline at end of file +?> diff --git a/chat/lib/template/loggedIn.html b/chat/lib/template/loggedIn.html index 16a75eb..b7118ce 100644 --- a/chat/lib/template/loggedIn.html +++ b/chat/lib/template/loggedIn.html @@ -3,21 +3,11 @@ + [LANG]title[/LANG] - [STYLE_SHEETS/] - + @@ -25,29 +15,126 @@ - +
-
-

[LANG]title[/LANG]

-
+

[LANG]title[/LANG]

- - - - - - - -
-
- -
-
- -
-
- 0/[MESSAGE_TEXT_MAX_LENGTH/] - -
-
-
- - - - - - - - + +
+ + + + + + +
+
- -
- - - - - -
-
-

[LANG]onlineUsers[/LANG]

-
-
- + +
+ +
+
+ 0/[MESSAGE_TEXT_MAX_LENGTH/] + +
+
+
+ + + + + + + + + +
+ +
+ + + + + +
+ @@ -383,5 +455,4 @@

[LANG]settings[/LANG]

- - \ No newline at end of file + diff --git a/chat/lib/template/loggedOut.html b/chat/lib/template/loggedOut.html index 2f7a8ea..2d08193 100644 --- a/chat/lib/template/loggedOut.html +++ b/chat/lib/template/loggedOut.html @@ -3,54 +3,20 @@ + [LANG]title[/LANG] - [STYLE_SHEETS/] - - - +
-
-

[LANG]title[/LANG]

-
-
-
- - - -

-
-

-
-

-
-

-
-
-
* [LANG]registeredUsers[/LANG]
-
-
+

[LANG]title[/LANG]

[ERROR_MESSAGES/]
+
+ + + +

+
+

+
+

+
+

+
+
+
* [LANG]registeredUsers[/LANG]
+
- - \ No newline at end of file + diff --git a/chat/lib/template/logs.html b/chat/lib/template/logs.html index d0b9162..4aa98d0 100644 --- a/chat/lib/template/logs.html +++ b/chat/lib/template/logs.html @@ -5,46 +5,27 @@ [LANG]logsTitle[/LANG] - [STYLE_SHEETS/] - - +
-
-

[LANG]logsTitle[/LANG]

-
+

[LANG]logsTitle[/LANG]

@@ -246,14 +226,22 @@

[LANG]settings[/LANG]

+ + + + + + - + + - + + @@ -272,5 +260,4 @@

[LANG]settings[/LANG]

- \ No newline at end of file diff --git a/chat/readme.html b/chat/readme.html index 8b98602..467610e 100644 --- a/chat/readme.html +++ b/chat/readme.html @@ -1,384 +1,404 @@ - - - - - AJAX Chat Readme - - - - - -
- -

AJAX Chat for MyBB - - v 0.8.7 MyBB ( blueimp.net/ajax/ ) - -

- - - -

This is the version of Blueimp's AJAX Chat desinged to be run with MyBB.
-If you want to integrate AJAX Chat with one of the other forums we support, go back and choose the right version.

- -

- AJAX stands for "Asynchronous JavaScript and XML".
- The AJAX Chat client (your browser) uses JavaScript to query the web server for updates.
- Instead of delivering a complete HTML page only updated data is sent in XML format.
- By using JavaScript the chat page can be updated without having to reload the whole page.
- PHP is used to communicate with the database and authenticate users. -

- -

Requirements

-
- - - - - - - - - -
Server-SideClient-Side
- PHP >= 5
- MySQL >= 4
- Ruby >= 1.8 (optional) -
- Enabled JavaScript
- Enabled Cookies
- Flash Plugin >= 9 (optional) -
-
- -

Installation

-
-

Download your preferred version of AJAX Chat and unzip the file on your computer.

-

Before You Begin

-
-

- In order to edit PHP files you will need a good text editor. You should not use Windows notepad, wordpad, or Microsoft Word to edit PHP files. These programs will add something called a byte-order-mark (BOM) to the files and this may prevent chat from functioning properly. - We recommend using Notepad ++ ( http://notepad-plus-plus.org ) for editing all files. It also has the benefit of color-coding your files so you can edit them more easily.
- If you get an error message like "Cannot modify header information - headers already sent" it is likely because you have used one of the above programs to edit files. -

-
- -

Upload to Server

-
-

- Upload the chat folder to your server into your mybb forum directory:
- e.g. http://example.org/mybb/chat/

-
- -

Create the Database Tables

-
-

There are two options available to you to create the database. The first, and usually the easiest option, is to run the installation script included with AJAX Chat. Alternatively, you may use a database tool like PHPMyAdmin to manually create the tables.

-
    -
  1. To use the installation script, visit the following URL in your browser:
    - http://example.org/mybb/chat/install.php
    - Where - "http://example.org/mybb/chat/" is the real URL to your chat directory.
  2. -
  3. To install it manually using PHPMyAdmin or a similar tool, copy the contents of the chat.sql file and run it as a query.
  4. -
-

Either of these methods will create the tables your database needs to store chat messages and other information.

-
- -

Delete the Installation Script

-
-

Delete the file install.php from the chat directory on your server. You may also delete the file chat.sql.

-
- -

Congradulation! You Are Winner!

-
-

Yay! You're done! To test your chat, navigate to your chat URL in a browser: http://example.org/path/to/chat/index.php
-
You are now free to customize chat to further suit your needs.

-
-
- -

Configuring and Customizing

-
-

Configuration Files

-
-

AJAX Chat is fully customizable and contains two configuration files:

-
    -
  1. lib/config.php: This file contains the core configuration options for chat. Essential options for configuring the database, security, available languages, etc, are found here.
  2. -
  3. js/config.js: This file contains client side settings that change your users' default options in chat. Many of these settings can be changed by users in their options but some (like the refresh rate) cannot.
  4. -
-

Both of these files are well commented with information on what the settings mean.

-
- -

Customizing the Layout

-
-

The layout of AJAX Chat is fully customizable by using CSS (Cascaded Style Sheets).
- AJAX Chat comes with a predefined set of styles. To add your own style, do the following:

-
    -
  1. Add a new CSS file (e.g. mystyle.css) by copying one of the existing styles from the CSS directory.
  2. -
  3. Edit your file (css/mystyle.css) and adjust the CSS settings to your liking.
  4. -
  5. Add the name of your style without file extension to the available styles in lib/config.php:
    - // Available styles:
    - $config['styleAvailable'] = array('mystyle','beige','black','grey');
    - // Default style:
    - $config['styleDefault'] = 'mystyle';
  6. -
-

To further customize the layout you can adjust the template files in lib/template/.

-

Make sure you are creating valid XHTML, else you will produce errors in modern browsers.
- This is due to the page content-type served as "application/xhtml+xml".
- Using this content-type improves performance when manipulating the Document Object Model (DOM).

-

If for some reason you cannot create valid XHTML you can force a HTML content-type.
- Just edit lib/config.php and set the following option:

-

$config['contentType'] = 'text/html';

-
- -

Adjusting the Language Settings

-
-

AJAX Chat comes with two language file directories:

-
    -
  1. js/lang/: This directory contains the language files used for the chat messages localization. These are JavaScript files with the extension ".js".
  2. -
  3. lib/lang/: This directory contains the language files used for the template output. These are PHP files with the extension ".php".
  4. -
-

Many languages are already included with the download and you can customize them by editing these files.
- For each language, you need a file in both of these directories, with the language code as file name (such as en.js and en.php)..
- The language code is used following the ISO 639 standards.

-

The files for the english (language code "en") localization are js/lang/en.js and lib/lang/en.php.

-

If you create your own localization, you must put the files in the correct folders and then make two changes to config.php:

-
    -
  1. Add the language code (this must match the filename you chose for the language. Remember to use commas correctly to separate multiple language codes):
    - $config['langAvailable'] = array('en');
  2. -
  3. Add the language name (this is what users see in the dropdown menu to choose the language):
    - $config['langNames'] = array('en'=>'English');
  4. -
-

To avoid errors, you should follow these rules:

-
    -
  1. Make sure you encode your localization files in UTF-8 (without Byte-order mark).
  2. -
  3. Don't use HTML entities in your localization files.
  4. -
  5. Don't remove any "%s" inside the JavaScript language files - these are filled with dynamic data.
  6. -
-
- -

Adding Features

-
-

AJAX Chat is designed with numerous hooks and overrides available to improve core functionality without requiring you to edit the core files. - With an intermediate understading of PHP and javascript you can modify your chat to suit your needs.

-

Have a look through a few examples available on the wiki: - https://github.com/Frug/AJAX-Chat/wiki/General-modifications -

-
- -
- -

Logs

-
-

Accessing the Logs

-
-

By default, AJAX Chat stores all chat messages in the database.
- To access the logs you have to add the GET parameter view=logs to your chat url (add ?view=logs to the end of the url):

-

e.g. http://example.org/path/to/chat/?view=logs

-

If you are not already logged in, you have to login as administrator to access the logs.

-

The log view enables you to monitor the latest chat messages on all channels.
- It is also possible to view the logs of private rooms and private messages.
- You have the option to filter the logs by date, time and search strings.

-

The search filter accepts MySQL style regular expressions as described here: http://dev.mysql.com/doc/refman/5.1/en/regexp.html
- You can search for IPs, using the following syntax: ip=127.0.0.1

-
-
- -

Shoutbox

-
-

AJAX Chat is also usable as shoutbox - this is a short guide on how to set it up:

- -

Shoutbox Stylesheet

-
-

Add the following line to the stylesheet (CSS) of all pages displaying the shoutbox:

-

@import url("http://example.org/path/to/chat/css/shoutbox.css");

-

Replace http://example.org/path/to/chat/ with the URL to the chat.
- Modify css/shoutbox.css to your liking.

-
- -

Shoutbox Function

-
-

Add the following function to your PHP code:

- -
-<?php
-function getShoutBoxContent() {
-// URL to the chat directory:
-if(!defined('AJAX_CHAT_URL')) {
-	define('AJAX_CHAT_URL', './chat/');
-}
-
-// Path to the chat directory:
-if(!defined('AJAX_CHAT_PATH')) {
-	define('AJAX_CHAT_PATH', realpath(dirname($_SERVER['SCRIPT_FILENAME']).'/chat').'/');
-}
-
-// Validate the path to the chat:
-if(@is_file(AJAX_CHAT_PATH.'lib/classes.php')) {
-	
-	// Include Class libraries:
-	require_once(AJAX_CHAT_PATH.'lib/classes.php');
-	
-	// Initialize the shoutbox:
-	$ajaxChat = new CustomAJAXChatShoutBox();
-	
-	// Parse and return the shoutbox template content:
-	return $ajaxChat->getShoutBoxContent();
-}
-
-return null;
-}
-?>
-
- -

Make sure AJAX_CHAT_URL and AJAX_CHAT_PATH point to the chat directory.

-
- -

Shoutbox Output

-
-

Display the shoutbox content using the shoutbox function:

-

<div style="width:200px;"><?php echo getShoutBoxContent(); ?></div>

-
-
- -

Socket Server

-
-

Using the AJAX technology alone the chat clients have to permanently pull updates from the server.
- This is due to AJAX being a web technology and HTTP being a stateless protocol.
- Events pushed from server-side need a permanent or long-lasting socket connection between clients and server.
- This requires either a custom HTTP server (called "comet") or another custom socket server.

-

AJAX Chat uses a JavaScript-to-Flash bridge to establish a permanent socket connection from client side.
- The JavaScript-to-Flash bridge requires a Flash plugin >= 9 installed on the user browser.
- Clients without this requirement will fall back to pull the server for updates.

-

This part of the setup is OPTIONAL and meant for experienced users only.

-

Installation

-
-

The socket server coming with AJAX Chat is implemented in Ruby.
- You need to be able to run a Ruby script as a service to run the socket server.
- To be able to start the service, the script files in the socket/ directory have to be executable:

-

$ chmod +x server
- $ chmod +x server.rb

-

"server" is a simple bash script to start and stop a service.
- "server.rb" is the ruby socket server script.
- "server.conf" is a configuration file - each setting is explained with a comment.

-

To start the service, execute the "server" script with the parameter "start":

-

$ ./server start

-

This will create two additional files:

-

"server.pid" contains the process id of the service.
- "server.log" is filled with the socket server log.

-

To monitor the socket server logs, you can use the "tail" command included in most GNU/Linux distributions:

-

$ tail -f server.log

-

By default only errors and start/stop of the server are logged.
- To get more detailed logs configure the log level by editing the configuration file.

-

To stop the service, execute the "server" script with the parameter "stop":

-

$ ./server stop

-

If the socket server is running, you have to enable the following option in lib/config.php:

-

$config['socketServerEnabled'] = true;
-
- This tells the server-side chat script to broadcast chat messages via the socket server.
- Chat clients will establish a permanent connection to the socket server to listen for chat messages.

-

By default only local clients (127.0.0.1,::1) may broadcast messages.
- Clients allowed to broadcast messages may also handle the channel authentication.
- If your socket server is running on another host you should set the broadcast_clients option to the chat server IP.

-

Using the socket server increases response time while improving server performance at the same time.

-
- -

Flash Permissions

-
-

- Since Flash 9.0.115.0 and all Flash 10 versions, permissions for creating sockets using Flash have changed.
- Now an explicit permission (using xml-syntax) is required for creating socket connections.
- In the current state, socket server won't work with the newest Flash versions.
- You will get a "Flash security error" in the browser. -

-

- A solution is to use a policy-files server which will listen to connections in port 843 in the server.
- Each time a client tries to connect to the chat, the Flash client will request the policy authorization to the server.
- The policy-files server is downloadable from http://ammonlauritzen.com/FlashPolicyService-09b.zip
- It works with FF3 and IE7 (not yet tested in other browsers). -

-

A more detailed explanation can be found here:

-

* http://ammonlauritzen.com/blog/2007/12/13/new-flash-security-policies/
- * http://ammonlauritzen.com/blog/2008/04/22/flash-policy-service-daemon/
-

-

Official Adobe documentation:

-

* http://www.adobe.com/devnet/flashplayer/articles/fplayer9_security.html
- * http://www.adobe.com/devnet/flashplayer/articles/fplayer9_security_04.html

-
-

 

-
- -

Support

-
-

- Please do not email the devs with support questions.
- For further documentation and some examples, check out our github wiki.
- For general support questions use our google group.
- For specific bug reports and a list of pending issues view our github project.
-

-
- - -
-

- Your donations contribute to the growth and development of this project and are always appreciated.
-

- - - - -
- I'm on gittip at https://www.gittip.com/Frug -

-
- -

License

-
-

Bluimp's AJAX Chat is released under a Modified MIT License.

-

You should also find this license included with your download of this project.

-
- -

back to top

- -
- - + + + + + AJAX Chat Readme + + + + + +
+
+

+ AJAX Chat for MyBB + + v 0.8.8 mybb ( blueimp.net/ajax/ ) + +

+
+
+ +
+ + + +
+

Version Information

+
+ This is the version of Blueimp's AJAX Chat desinged to be run with MyBB.
+ If you want to integrate AJAX Chat with one of the other forums we support, go back and choose the right version. + +

+ AJAX stands for "Asynchronous JavaScript and XML".
+ The AJAX Chat client (your browser) uses JavaScript to query the web server for updates.
+ Instead of delivering a complete HTML page only updated data is sent in XML format.
+ By using JavaScript the chat page can be updated without having to reload the whole page.
+ PHP is used to communicate with the database and authenticate users. +

+
+
+ +

1. Requirements

+
+ + + + + + + + + +
Server-SideClient-Side
+ PHP >= 5
+ MySQL >= 4
+ Ruby >= 1.8 (optional) +
+ Enabled JavaScript
+ Enabled Cookies
+ Flash Plugin >= 9 (optional) +
+
+ +

2. Installation

+
+

Download your preferred version of AJAX Chat and unzip the file on your computer.

+ +
+

Use a Proper Text Editor!

+ In order to edit PHP files you will need a good text editor. You should not use Windows notepad, wordpad, or Microsoft Word to edit PHP files. These programs will add something called a byte-order-mark (BOM) to the files and this may prevent chat from functioning properly. + We recommend using Notepad ++ ( http://notepad-plus-plus.org ) for editing all files. It also has the benefit of color-coding your files so you can edit them more easily.
+ If you get an error message like "Cannot modify header information - headers already sent" it is likely because you have used one of the above programs to edit files. +
+ +

Upload to Server

+
+

+ Upload the chat folder to your server into your mybb forum directory:
+ e.g. http://example.org/mybb/chat/

+

+
+ +

Create the Database Tables

+
+

There are two options available to you to create the database. The first, and usually the easiest option, is to run the installation script included with AJAX Chat. Alternatively, you may use a database tool like PHPMyAdmin to manually create the tables.

+
    +
  1. + http://example.org/mybb/chat/install.php
    + Where "http://example.org/mybb/chat/" is the real URL to your chat directory.
    + Be sure to delete the install.php file after you have completed this step! +
  2. +
  3. To install it manually using PHPMyAdmin or a similar tool, copy the contents of the chat.sql file and run it as a query.
  4. +
+

Either of these methods will create the tables your database needs to store chat messages and other information.

+
+ +

Delete the Installation Script

+
+

Delete the file install.php from the chat directory on your server. You may also delete the file chat.sql.

+
+ +

Congradulation! You Are Winner!

+
+

Yay! You're done! To test your chat, navigate to your chat URL in a browser: http://example.org/path/to/chat/index.php
+
You are now free to customize chat to further suit your needs.

+
+
+ +

3. Configuring and Customizing

+
+

Configuration Files

+
+

AJAX Chat is fully customizable and contains two configuration files:

+
    +
  1. lib/config.php: This file contains the core configuration options for chat. Essential options for configuring the database, security, available languages, etc, are found here.
  2. +
  3. js/config.js: This file contains client side settings that change your users' default options in chat. Many of these settings can be changed by users in their options but some (like the refresh rate) cannot.
  4. +
+

Both of these files are well commented with information on what the settings mean.

+
+ +

Customizing the Layout

+
+

The layout of AJAX Chat is fully customizable by using CSS (Cascaded Style Sheets).
+ AJAX Chat comes with a predefined set of styles. To add your own style, do the following:

+
    +
  1. Add a new CSS file (e.g. mystyle.css) by copying one of the existing styles from the CSS directory.
  2. +
  3. Edit your file (css/mystyle.css) and adjust the CSS settings to your liking.
  4. +
  5. Add the name of your style without file extension to the available styles in lib/config.php:
    + // Available styles:
    + $config['styleAvailable'] = array('mystyle','beige','black','grey');
    + // Default style:
    + $config['styleDefault'] = 'mystyle';
  6. +
+

To further customize the layout you can adjust the template files in lib/template/.

+

Make sure you are creating valid XHTML, else you will produce errors in modern browsers.
+ This is due to the page content-type served as "application/xhtml+xml".
+ Using this content-type improves performance when manipulating the Document Object Model (DOM).

+

If for some reason you cannot create valid XHTML you can force a HTML content-type.
+ Just edit lib/config.php and set the following option:

+

$config['contentType'] = 'text/html';

+
+ +

Adjusting the Language Settings

+
+

AJAX Chat comes with two language file directories:

+
    +
  1. js/lang/: This directory contains the language files used for the chat messages localization. These are JavaScript files with the extension ".js".
  2. +
  3. lib/lang/: This directory contains the language files used for the template output. These are PHP files with the extension ".php".
  4. +
+

Many languages are already included with the download and you can customize them by editing these files.
+ For each language, you need a file in both of these directories, with the language code as file name (such as en.js and en.php)..
+ The language code is used following the ISO 639 standards.

+

The files for the english (language code "en") localization are js/lang/en.js and lib/lang/en.php.

+

If you create your own localization, you must put the files in the correct folders and then make two changes to config.php:

+
    +
  1. Add the language code (this must match the filename you chose for the language. Remember to use commas correctly to separate multiple language codes):
    + $config['langAvailable'] = array('en');
  2. +
  3. Add the language name (this is what users see in the dropdown menu to choose the language):
    + $config['langNames'] = array('en'=>'English');
  4. +
+

To avoid errors, you should follow these rules:

+
    +
  1. Make sure you encode your localization files in UTF-8 (without Byte-order mark).
  2. +
  3. Don't use HTML entities in your localization files.
  4. +
  5. Don't remove any "%s" inside the JavaScript language files - these are filled with dynamic data.
  6. +
+
+ +

Adding Features

+
+

AJAX Chat is designed with numerous hooks and overrides available to improve core functionality without requiring you to edit the core files. + With an intermediate understading of PHP and javascript you can modify your chat to suit your needs.

+

Have a look through a few examples available on the wiki: + https://github.com/Frug/AJAX-Chat/wiki/General-modifications +

+
+ +
+ +

4. Logs

+
+

Accessing the Logs

+
+

By default, AJAX Chat stores all chat messages in the database.
+ To access the logs you have to add the GET parameter view=logs to your chat url (add ?view=logs to the end of the url):

+

e.g. http://example.org/path/to/chat/?view=logs

+

If you are not already logged in, you have to login as administrator to access the logs.

+

The log view enables you to monitor the latest chat messages on all channels.
+ It is also possible to view the logs of private rooms and private messages.
+ You have the option to filter the logs by date, time and search strings.

+

The search filter accepts MySQL style regular expressions as described here: http://dev.mysql.com/doc/refman/5.1/en/regexp.html
+ You can search for IPs, using the following syntax: ip=127.0.0.1

+
+
+ +

5. Shoutbox

+
+

AJAX Chat is also usable as shoutbox - this is a short guide on how to set it up:

+ +

Shoutbox Stylesheet

+
+

Add the following line to the stylesheet (CSS) of all pages displaying the shoutbox:

+

@import url("http://example.org/path/to/chat/css/shoutbox.css");

+

Replace http://example.org/path/to/chat/ with the URL to the chat.
+ Modify css/shoutbox.css to your liking.

+
+ +

Shoutbox Function

+
+

Add the following function to your PHP code:

+ +
+<?php
+function getShoutBoxContent() {
+// URL to the chat directory:
+if(!defined('AJAX_CHAT_URL')) {
+	define('AJAX_CHAT_URL', './chat/');
+}
+
+// Path to the chat directory:
+if(!defined('AJAX_CHAT_PATH')) {
+	define('AJAX_CHAT_PATH', realpath(dirname($_SERVER['SCRIPT_FILENAME']).'/chat').'/');
+}
+
+// Validate the path to the chat:
+if(@is_file(AJAX_CHAT_PATH.'lib/classes.php')) {
+	
+	// Include Class libraries:
+	require_once(AJAX_CHAT_PATH.'lib/classes.php');
+	
+	// Initialize the shoutbox:
+	$ajaxChat = new CustomAJAXChatShoutBox();
+	
+	// Parse and return the shoutbox template content:
+	return $ajaxChat->getShoutBoxContent();
+}
+
+return null;
+}
+?>
+
+ +

Make sure AJAX_CHAT_URL and AJAX_CHAT_PATH point to the chat directory.

+
+ +

Shoutbox Output

+
+

Display the shoutbox content using the shoutbox function:

+

<div style="width:200px;"><?php echo getShoutBoxContent(); ?></div>

+
+
+ +

6. Socket Server

+
+

+ This part of the setup is OPTIONAL and meant for experienced users only.
+ The Socket Server is no longer actively supported and may not function correctly out of the box. + Later versions of AJAX Chat may have this socket server implementation replaced with something else.
+ Please do not report bugs regarding the socket server - you're on your own with this one! +

+ +

Using the AJAX technology alone the chat clients have to permanently pull updates from the server.
+ This is due to AJAX being a web technology and HTTP being a stateless protocol.
+ Events pushed from server-side need a permanent or long-lasting socket connection between clients and server.
+ This requires either a custom HTTP server (called "comet") or another custom socket server.

+

AJAX Chat uses a JavaScript-to-Flash bridge to establish a permanent socket connection from client side.
+ The JavaScript-to-Flash bridge requires a Flash plugin >= 9 installed on the user browser.
+ Clients without this requirement will fall back to pull the server for updates.

+

Installation

+
+

The socket server coming with AJAX Chat is implemented in Ruby.
+ You need to be able to run a Ruby script as a service to run the socket server.
+ To be able to start the service, the script files in the socket/ directory have to be executable:

+

$ chmod +x server
+ $ chmod +x server.rb

+

"server" is a simple bash script to start and stop a service.
+ "server.rb" is the ruby socket server script.
+ "server.conf" is a configuration file - each setting is explained with a comment.

+

To start the service, execute the "server" script with the parameter "start":

+

$ ./server start

+

This will create two additional files:

+

"server.pid" contains the process id of the service.
+ "server.log" is filled with the socket server log.

+

To monitor the socket server logs, you can use the "tail" command included in most GNU/Linux distributions:

+

$ tail -f server.log

+

By default only errors and start/stop of the server are logged.
+ To get more detailed logs configure the log level by editing the configuration file.

+

To stop the service, execute the "server" script with the parameter "stop":

+

$ ./server stop

+

If the socket server is running, you have to enable the following option in lib/config.php:

+

$config['socketServerEnabled'] = true;
+
+ This tells the server-side chat script to broadcast chat messages via the socket server.
+ Chat clients will establish a permanent connection to the socket server to listen for chat messages.

+

By default only local clients (127.0.0.1,::1) may broadcast messages.
+ Clients allowed to broadcast messages may also handle the channel authentication.
+ If your socket server is running on another host you should set the broadcast_clients option to the chat server IP.

+

Using the socket server increases response time while improving server performance at the same time.

+
+ +

Flash Permissions

+
+

+ Since Flash 9.0.115.0 and all Flash 10 versions, permissions for creating sockets using Flash have changed.
+ Now an explicit permission (using xml-syntax) is required for creating socket connections.
+ In the current state, socket server won't work with the newest Flash versions.
+ You will get a "Flash security error" in the browser. +

+

+ A solution is to use a policy-files server which will listen to connections in port 843 in the server.
+ Each time a client tries to connect to the chat, the Flash client will request the policy authorization to the server.
+ The policy-files server is downloadable from http://ammonlauritzen.com/FlashPolicyService-09b.zip
+ It works with FF3 and IE7 (not yet tested in other browsers). +

+

A more detailed explanation can be found here:

+

* http://ammonlauritzen.com/blog/2007/12/13/new-flash-security-policies/
+ * http://ammonlauritzen.com/blog/2008/04/22/flash-policy-service-daemon/
+

+

Official Adobe documentation:

+

* http://www.adobe.com/devnet/flashplayer/articles/fplayer9_security.html
+ * http://www.adobe.com/devnet/flashplayer/articles/fplayer9_security_04.html

+
+

 

+
+ +

7. Support

+
+

+ Please do not email the devs with support questions.
+ For further documentation and some examples, check out our github wiki.
+ For general support questions use our google group.
+ For specific bug reports and a list of pending issues view our github project.
+

+
+ + +
+

+ Your donations contribute to the growth and development of this project and are always appreciated.
+

+ + + + +
+ I'm on gittip at https://www.gittip.com/Frug +

+
+ +

9. License

+
+

Bluimp's AJAX Chat is released under a Modified MIT License.

+

You should also find this license included with your download of this project.

+
+ +

back to top

+ +
+ + diff --git a/chat/sounds/sound_7.mp3 b/chat/sounds/sound_7.mp3 new file mode 100644 index 0000000..7ee9273 Binary files /dev/null and b/chat/sounds/sound_7.mp3 differ diff --git a/chat/sounds/sound_8.mp3 b/chat/sounds/sound_8.mp3 new file mode 100644 index 0000000..010e8a6 Binary files /dev/null and b/chat/sounds/sound_8.mp3 differ diff --git a/readme.md b/readme.md index f34ad6d..fbbb0a8 100644 --- a/readme.md +++ b/readme.md @@ -1,5 +1,5 @@ AJAX Chat MyBB -========= +==================== This is the MyBB integration version of Blueimp's AJAX Chat. @@ -10,21 +10,19 @@ Instead of delivering a complete HTML page only updated data is sent in XML form By using JavaScript the chat page can be updated without having to reload the whole page. Requirements -============ +------------ -###Server-Side: -- PHP >= 5 -- MySQL >= 4 -- Ruby >= 1.8 (optional) -###Client-Side: -- Enabled JavaScript -- Enabled Cookies -- Flash Plugin >= 9 (optional) + +| *Server-Side* | *Client-Side* | +| ---------------------- | ---------------------------- | +| PHP >= 5 | Enabled JavaScript | +| MySQL >= 4 | Enabled Cookies | +| Ruby >= 1.8 (optional) | Flash Plugin >= 9 (optional) | Features -======== +-------- - Easy installation - Usable as shoutbox - Multiple channels @@ -60,20 +58,20 @@ Features - Optional support to push updates over a Flash based socket connection (increased performance and responsiveness) - Survives connection timeouts - Easy integration into existing authentication systems -- Sample phpBB2, phpBB3, MyBB, PunBB, SMF and vBulletin integrations provided +- Sample phpBB3, MyBB, PunBB, SMF and vBulletin integrations available - Separation of layout and code - Well commented Source Code - Developed with Security as integral part - built to prevent Code injections, SQL injections, Cross-site scripting (XSS), Session stealing and other attacks -- Tested successfully with Microsoft Internet Explorer, Mozilla Firefox, Opera, Safari and Konqueror - built to work with all modern browsers :) +- Tested successfully with Microsoft Internet Explorer, Mozilla Firefox, Opera and Safari - built to work with all modern browsers :) Help -==== +---- Essential documentation is contained in the attached readme files For more documentation consult the github wiki: https://github.com/Frug/AJAX-Chat/wiki For support questions use google groups: https://groups.google.com/forum/#!forum/ajax-chat -To report bugs use github issues: https://github.com/Frug/AJAX-Chat \ No newline at end of file +To report bugs use github issues: https://github.com/Frug/AJAX-Chat