diff options
author | Frug <frugen@gmail.com> | 2014-01-09 16:13:32 -0500 |
---|---|---|
committer | Frug <frugen@gmail.com> | 2014-01-09 16:13:32 -0500 |
commit | 05828446a39b80f631566bd737b6f16309cd026e (patch) | |
tree | 39e38e8280dd41a65f7ecbf1ad410cd0c2d36d7e | |
parent | 9a6365e355349d0bee6256bb4657a5cf28f65eca (diff) | |
download | AJAX-Chat-05828446a39b80f631566bd737b6f16309cd026e.zip AJAX-Chat-05828446a39b80f631566bd737b6f16309cd026e.tar.gz AJAX-Chat-05828446a39b80f631566bd737b6f16309cd026e.tar.bz2 |
merge errors
-rw-r--r-- | chat/lib/class/CustomAJAXChat.php | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/chat/lib/class/CustomAJAXChat.php b/chat/lib/class/CustomAJAXChat.php index 9fb6a67..8cc255a 100644 --- a/chat/lib/class/CustomAJAXChat.php +++ b/chat/lib/class/CustomAJAXChat.php @@ -3,7 +3,7 @@ * @package AJAX_Chat * @author Sebastian Tschan * @copyright (c) Sebastian Tschan - * @license Modified MIT License + * @license GNU Affero General Public License * @link https://blueimp.net/ajax/ * * SMF integration: @@ -147,15 +147,13 @@ class CustomAJAXChat extends AJAXChat { $defaultChannelFound = false; - if ($value == $this->getConfig('defaultChannelID')) { - $this->_channels[$key] = $value; - continue; - } + while($row = $result->fetch()) { // Check if we have to limit the available channels: if($this->getConfig('limitChannelList') && !in_array($row['ID_BOARD'], $this->getConfig('limitChannelList'))) { continue; } - if(in_array($value, $validChannels)) { + + $forumName = $this->trimChannelName($row['name']); $this->_channels[$forumName] = $row['ID_BOARD']; @@ -203,18 +201,19 @@ class CustomAJAXChat extends AJAXChat { $defaultChannelFound = false; - foreach($customChannels as $name=>$id) { - $this->_allChannels[$this->trimChannelName($name)] = $id; - if($id == $this->getConfig('defaultChannelID')) { + while($row = $result->fetch()) { + $forumName = $this->trimChannelName($row['name']); + + $this->_allChannels[$forumName] = $row['ID_BOARD']; + + if(!$defaultChannelFound && $row['ID_BOARD'] == $this->getConfig('defaultChannelID')) { $defaultChannelFound = true; } } $result->free(); if(!$defaultChannelFound) { - // Add the default channel as first array element to the channel list - // First remove it in case it appeard under a different ID - unset($this->_allChannels[$this->getConfig('defaultChannelName')]); + // Add the default channel as first array element to the channel list: $this->_allChannels = array_merge( array( $this->trimChannelName($this->getConfig('defaultChannelName'))=>$this->getConfig('defaultChannelID') @@ -251,13 +250,13 @@ class CustomAJAXChat extends AJAXChat { die(); } - function getCustomChannels() { + $row = $result->fetch(); $styleName = $row['value']; $result->free(); - // Channel array structure should be: - // ChannelName => ChannelID - return array_flip($channels); + + if(!in_array($styleName, $this->getConfig('styleAvailable'))) { + $styleName = $this->getConfig('styleDefault'); } setcookie( @@ -271,4 +270,4 @@ class CustomAJAXChat extends AJAXChat { return; } -}
\ No newline at end of file +} |