public function generateJson($serverId)
 {
     $server = MurmurServer::fromIceObject(ServerInterface::getInstance()->getServer($serverId));
     $tree = $server->getTree();
     $array = array('id' => $server->getId(), 'name' => SettingsManager::getInstance()->getServerName($server->getId()), 'root' => $this->treeToJsonArray($tree));
     return json_encode($array);
 }
Beispiel #2
0
 public static function getHtmlCode4ViewServer($serverId)
 {
     $server = ServerInterface::getInstance()->getServer($serverId);
     if ($server !== null) {
         $server = MurmurServer::fromIceObject($server);
         $tree = $server->getTree();
         return '<div class="server">' . $tree->toHtml() . '</div>';
     }
     return null;
 }
 public function generateJson($serverId)
 {
     $serverIce = ServerInterface::getInstance()->getServer($serverId);
     if ($serverIce == null) {
         return json_encode(array());
     }
     $server = MurmurServer::fromIceObject(ServerInterface::getInstance()->getServer($serverId));
     $serverConnectAddress = SettingsManager::getInstance()->getServerAddress($server->getId());
     $path = urlencode($serverConnectAddress);
     $connecturlTemplate = $serverConnectAddress != null ? 'mumble://%s?version=1.2.0' : null;
     $tree = $server->getTree();
     $array = array('id' => $server->getId(), 'name' => SettingsManager::getInstance()->getServerName($server->getId()), 'x_connecturl' => sprintf($connecturlTemplate, $path), 'root' => $this->treeToJsonArray($tree, $connecturlTemplate, $path));
     return json_encode($array);
 }
Beispiel #4
0
?>
';
		if (mumpiSetting_viewerServerIp == '') {
		  mumpiSetting_viewerServerIp = null;
		}
		var mumpiSetting_viewerServerVersion = '<?php 
$a = explode(' ', ServerInterface::getInstance()->getVersion(), 2);
echo $a[0];
?>
';

		var mumpiViewerRefreshTreeRunning = false;
		var mumpiViewerRefreshTreeObject;
		var mumpiViewerRefreshTreeRate;
		<?php 
$rootName = MurmurServer::fromIceObject(ServerInterface::getInstance()->getServer($serverId))->getConf('registername');
?>
		var mumpiViewerRootName = '<?php 
echo !empty($rootName) ? htmlspecialchars($rootName) : 'Root';
?>
';

		// create chan and user images as dom objects (for faster draw, especially SVG)
	  <?php 
$chanImgUrl = SettingsManager::getInstance()->getMainUrl() . '/img/mumble/channel_12.png';
$chanImgHtmlObj = '<img src="' . $chanImgUrl . '" alt=""/>';
if (SettingsManager::getInstance()->isViewerSVGImagesEnabled()) {
    $chanImgUrl = SettingsManager::getInstance()->getMainUrl() . '/img/mumble/channel.svg';
    $chanImgHtmlObj = '<object data="' . $chanImgUrl . '" type="image/svg+xml" width="12" height="12">' . $chanImgHtmlObj . '</object>';
}
$userImgUrl = SettingsManager::getInstance()->getMainUrl() . '/img/mumble/talking_off_12.png';
Beispiel #5
0
 function kickUser($srvid, $sessid, $reason = '')
 {
     $srv = $this->getServer(intval($srvid));
     if (!empty($this->contextVars)) {
         $srv = $srv->ice_context($this->contextVars);
     }
     MurmurServer::fromIceObject($srv)->kickUser(intval($sessid), $reason);
 }
Beispiel #6
0
 /**
  * Get the mumble:// join url
  * @return string
  */
 public function getJoinUrl()
 {
     //TODO this probably also requires the parent chan, right?
     return $this->server->getJoinUrl() . '/' . $this->getName();
 }
Beispiel #7
0
    public static function server_config_show()
    {
        if (!isset($_POST['sid'])) {
            return;
        }
        $_POST['sid'] = intval($_POST['sid']);
        $conf = ServerInterface::getInstance()->getServerConfig($_POST['sid']);
        //TODO i18n
        ?>
		<h1>Server Config</h1>
		<p>For documentation, see your murmur.ini file (or <a href="http://mumble.git.sourceforge.net/git/gitweb.cgi?p=mumble/mumble;a=blob;f=scripts/murmur.ini;hb=HEAD" rel="external">this</a> one in the repository, which may be newer than yours though)</p>
		<br/>
		<br/>
		<?php 
        $canEdit = PermissionManager::getInstance()->serverCanEditConf($_POST['sid']);
        if ($canEdit) {
            ?>
			<p style="font-size:x-small;">(Double-click entries to edit them)</p>
		<?php 
        }
        ?>
		<table>
			<tbody>
				<tr class="table_headline">
					<td colspan="2">General</td>
				</tr>
				<tr>
					<td>Password</td>
					<td class="jq_editable" id="jq_editable_server_conf_password"><?php 
        echo $conf['password'];
        ?>
</td>
					<?php 
        unset($conf['password']);
        ?>
				</tr>
				<tr>
					<td>Users</td>
					<td class="jq_editable" id="jq_editable_server_conf_users"><?php 
        echo $conf['users'];
        ?>
</td>
					<?php 
        unset($conf['users']);
        ?>
				</tr>
				<tr>
					<td>Timeout</td>
					<td class="jq_editable" id="jq_editable_server_conf_timeout"><?php 
        echo $conf['timeout'];
        ?>
</td>
					<?php 
        unset($conf['timeout']);
        ?>
				</tr>
				<tr>
					<td>Host</td>
					<td class="jq_editable" id="jq_editable_server_conf_host"><?php 
        echo $conf['host'];
        ?>
</td>
					<?php 
        unset($conf['host']);
        ?>
				</tr>
				<tr>
					<td>Port</td>
					<td class="jq_editable" id="jq_editable_server_conf_port"><?php 
        echo $conf['port'];
        ?>
</td>
					<?php 
        unset($conf['port']);
        ?>
				</tr>
				<?php 
        if (isset($conf['defaultchannel'])) {
            ?>
				<tr>
					<td>Default Channel</td>
					<td id="jq_editable_server_conf_defaultchannel">
						<?php 
            $defaultChannelId = $conf['defaultchannel'];
            $server = MurmurServer::fromIceObject(ServerInterface::getInstance()->getServer($_POST['sid']));
            $defaultChannel = $server->getChannel($defaultChannelId);
            echo $defaultChannel->getName();
            // change default chan functionality
            $chanTree = $server->getTree();
            function treePrint(MurmurTree $tree, $first = true)
            {
                $subs = $tree->getSubChannels();
                if ($first) {
                    echo '<div id="jq_editable_server_conf_defaultchannel_form">';
                    //TODO i18n
                    echo '<p>Select the channel unregistered and new users are to join when joining the server.</p>';
                }
                ?>
									<ul>
										<li class="form_clickable_submit jslink" id="channel_<?php 
                echo $tree->getRootChannel()->getId();
                ?>
"><?php 
                echo $tree->getRootChannel()->getName();
                ?>
</li>
										<?php 
                if (!empty($subs)) {
                    foreach ($subs as $subTree) {
                        treePrint($subTree, false);
                    }
                }
                ?>
									</ul>
								<?php 
                if ($first) {
                    echo '</div>';
                }
            }
            treePrint($chanTree);
            unset($conf['defaultchannel']);
            ?>
					</td>
				</tr>
				<?php 
        }
        ?>
				<tr>
					<td>Welcometext</td>
					<td class="jq_editable" id="jq_editable_server_conf_welcometext"><?php 
        echo $conf['welcometext'];
        ?>
</td>
					<?php 
        unset($conf['welcometext']);
        ?>
				</tr>

				<tr class="table_headline">	<td colspan="2"></td></tr>
				<tr>
					<td>Bandwidth</td>
					<td class="jq_editable" id="jq_editable_server_conf_bandwidth"><?php 
        echo $conf['bandwidth'];
        ?>
</td>
					<?php 
        unset($conf['bandwidth']);
        ?>
				</tr>
				<?php 
        if (isset($conf['obfuscate'])) {
            ?>
				<tr>
					<td>Obfuscate IPs</td>
					<td id="jq_editable_server_conf_obfuscate">
						<input type="checkbox"<?php 
            if ($conf['obfuscate'] == true) {
                echo ' checked="checked"';
            }
            ?>
/>
						<?php 
            unset($conf['obfuscate']);
            ?>
					</td>
				</tr>
				<?php 
        }
        ?>
				<tr>
					<td>Allowed Channelname <a href="http://en.wikipedia.org/wiki/Regular_expression#POSIX" rel="external">Regexp</a></td>
					<td class="jq_editable" id="jq_editable_server_conf_channelname"><?php 
        echo $conf['channelname'];
        ?>
</td>
					<?php 
        unset($conf['channelname']);
        ?>
				</tr>
				<tr>
					<td>Allowed Username <a href="http://en.wikipedia.org/wiki/Regular_expression#POSIX" rel="external">Regexp</a></td>
					<td class="jq_editable" id="jq_editable_server_conf_username"><?php 
        echo $conf['username'];
        ?>
</td>
					<?php 
        unset($conf['username']);
        ?>
				</tr>
				<?php 
        if (isset($conf['certrequired'])) {
            ?>
				<tr>
					<td>UserCert Required</td>
					<td id="jq_editable_server_conf_certrequired">
						<input type="checkbox"<?php 
            if ($conf['certrequired'] == true) {
                echo ' checked="checked"';
            }
            ?>
/>
						<?php 
            unset($conf['certrequired']);
            ?>
					</td>
				</tr>
				<?php 
        }
        if (isset($conf['textmessagelength'])) {
            ?>
				<tr>
					<td>Textmessagelength</td>
					<td class="jq_editable" id="jq_editable_server_conf_textmessagelength"><?php 
            echo $conf['textmessagelength'];
            ?>
</td>
					<?php 
            unset($conf['textmessagelength']);
            ?>
				</tr>
				<?php 
        }
        if (isset($conf['allowhtml'])) {
            ?>
				<tr>
					<td>Allow HTML</td>
					<td id="jq_editable_server_conf_allowhtml">
						<input type="checkbox"<?php 
            if ($conf['allowhtml'] == true) {
                echo ' checked="checked"';
            }
            ?>
/>
						<?php 
            unset($conf['allowhtml']);
            ?>
					</td>
				</tr>
				<?php 
        }
        if (isset($conf['rememberchannel'])) {
            ?>
				<tr>
					<td><abbr title="Remember last channel for registered users; Users will be moved to this channel on connection.">Remember Channel</abbr></td>
					<td id="jq_editable_server_conf_rememberchannel">
						<input type="checkbox"<?php 
            if ($conf['rememberchannel'] == true) {
                echo ' checked="checked"';
            }
            ?>
/>
						<?php 
            unset($conf['rememberchannel']);
            ?>
					</td>
				</tr>
				<?php 
        }
        if (isset($conf['bonjour'])) {
            ?>
				<tr>
					<td><abbr title="(service for server discovery on LAN)">Bonjour</abbr></td>
					<td id="jq_editable_server_conf_bonjour">
						<input type="checkbox"<?php 
            if ($conf['bonjour'] == true) {
                echo ' checked="checked"';
            }
            ?>
/>
						<?php 
            unset($conf['bonjour']);
            ?>
					</td>
				</tr>
				<?php 
        }
        ?>

				<tr class="table_headline">
					<td colspan="2">Server Registration</td>
				</tr>
				<tr>
					<td>registerhostname</td>
					<td class="jq_editable" id="jq_editable_server_conf_registerhostname"><?php 
        echo $conf['registerhostname'];
        unset($conf['registerhostname']);
        ?>
</td>
				</tr>
				<tr>
					<td>registername</td>
					<td class="jq_editable" id="jq_editable_server_conf_registername"><?php 
        echo $conf['registername'];
        unset($conf['registername']);
        ?>
</td>
				</tr>
				<tr>
					<td>registerpassword</td>
					<td class="jq_editable" id="jq_editable_server_conf_registerpassword"><?php 
        echo $conf['registerpassword'];
        unset($conf['registerpassword']);
        ?>
</td>
				</tr>
				<tr>
					<td>registerurl</td>
					<td class="jq_editable" id="jq_editable_server_conf_registerurl"><?php 
        echo $conf['registerurl'];
        unset($conf['registerurl']);
        ?>
</td>
				</tr>
				<?php 
        if (!empty($conf)) {
            ?>
							<tr class="table_headline">	 <td colspan="2">Misc</td></tr>
						<?php 
        }
        foreach ($conf as $key => $val) {
            ?>
									<tr>
										<td><?php 
            echo $key;
            ?>
</td>
										<td class="jq_editable" id="jq_editable_server_conf_<?php 
            echo $key;
            ?>
"><?php 
            echo $val;
            ?>
</td>
									</tr>
						<?php 
        }
        ?>
			</tbody>
		</table>
<?php 
        if ($canEdit) {
            ?>
			<script type="text/javascript">/*<![CDATA[*/
				var currentServerId = <?php 
            echo $_POST['sid'];
            ?>
;
				function jq_server_conf_update(key, newValue)
				{
				  $.post('./?ajax=server_config_update',
							{ 'sid': currentServerId, 'key': key, 'value': newValue.toString() },
							function(data) {
								if (data.length > 0) {
									alert('Error: ' + data);
								}
								jq_server_config_show(currentServerId);
							}
						);
				}
				jQuery('#jq_editable_server_conf_allowhtml input:checkbox')
					.click(
						function(ev) {
							jq_server_conf_update('allowhtml', jQuery(this).attr('checked'));
						}
					);
				jQuery('#jq_editable_server_conf_obfuscate input:checkbox')
					.click(
						function(ev) {
							jq_server_conf_update('obfuscate', jQuery(this).attr('checked'));
						}
					);
				jQuery('#jq_editable_server_conf_rememberchannel input:checkbox')
					.click(
						function(ev) {
							jq_server_conf_update('rememberchannel', jQuery(this).attr('checked'));
						}
					);
				jQuery('#jq_editable_server_conf_bonjour input:checkbox')
					.click(
						function(ev) {
							jq_server_conf_update('bonjour', jQuery(this).attr('checked'));
						}
					);
				jQuery('#jq_editable_server_conf_certrequired input:checkbox')
					.click(
						function(ev) {
							jq_server_conf_update('certrequired', jQuery(this).attr('checked'));
						}
					);
				function jq_editable_server_conf_onSubmit(obj, content)
				{
					var id = obj.attr('id');
					var subId = id.substring(id.lastIndexOf('_')+1, id.length);
					jq_server_conf_update(subId, content.current);
				}
				function jq_editable_server_conf_text2textarea(key)
				{
				  jQuery('#jq_editable_server_conf_'+key).editable('destroy').editable({
						'type': 'textarea',
						'submit': 'save',
						'cancel':'cancel',
						'editBy': 'dblclick',
						'onSubmit': function(content){ jq_editable_server_conf_onSubmit($(this), content); }
					});
				}
				jQuery('.jq_editable')
					.editable({
						'type': 'text',
						'submit': 'save',
						'cancel':'cancel',
						'editBy': 'dblclick',
						'onSubmit': function(content){ jq_editable_server_conf_onSubmit($(this), content); }
					});
				jq_editable_server_conf_text2textarea('welcometext');
				jq_editable_server_conf_text2textarea('certificate');
				jq_editable_server_conf_text2textarea('key');

				// default channel editable:
		jQuery('#jq_editable_server_conf_defaultchannel_form').ready(function(){
			jQuery("#jq_editable_server_conf_defaultchannel_form").dialog({
				title: 'Select default channel',
				autoOpen: false,
				height: 'auto',
				width: 'auto',
				modal: true,
				buttons: {
					Cancel: function() {
						$(this).dialog('close');
					}
				}
			});
			jQuery('#jq_editable_server_conf_defaultchannel_form .form_clickable_submit').click(function(event){
					var id = jQuery(this).attr('id');
					var channelId = id.substr(id.indexOf('_')+1);
					$.post(
						'./?ajax=server_config_update',
						{ 'sid': currentServerId, 'key': 'defaultchannel', 'value': channelId },
						function(data) {
							jq_server_config_show(currentServerId);
							jQuery('#jq_editable_server_conf_defaultchannel_form').dialog('close').remove();
						}
					);
				});
			jQuery('#jq_editable_server_conf_defaultchannel')
				.dblclick(function(){
					jQuery('#jq_editable_server_conf_defaultchannel_form').dialog('open');
				});
		});
				/*]]>*/
			</script>
<?php 
        }
    }