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);
 }
예제 #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;
 }
예제 #3
0
 /**
  * @inheritDoc
  */
 public function __invoke(array $input)
 {
     $serverParams = $this->server->getServerParams();
     if (!self::hasAuthorization($serverParams, $this->payload)) {
         return self::getErrorStatus($this->payload);
     }
     $weekDate = date(Constants::DEFAULT_DATEFORMAT);
     if (isset($input[Constants::WEEK_DATE])) {
         $weekDate = $input[Constants::WEEK_DATE];
     }
     $token = Utilities::getInstance()->parseToken($serverParams);
     $data = Utilities::getInstance()->extractData($token);
     $employeeId = $data->user_id;
     $hours = array();
     if (!empty($employeeId)) {
         $hours = Utilities::getInstance()->findWeekHours($employeeId, $weekDate);
         // dummy function: Results from DB implementation
     }
     return $this->payload->withStatus(PayloadInterface::OK)->withOutput($hours);
 }
예제 #4
0
 /**
  * @inheritDoc
  */
 public function __invoke(array $input)
 {
     $status = PayloadInterface::INVALID;
     $serverParams = $this->server->getServerParams();
     $shiftId = 0;
     if (isset($input[Constants::SHIFT_ID])) {
         $shiftId = $input[Constants::SHIFT_ID];
     }
     if (!self::hasAuthorization($serverParams, $this->payload)) {
         return self::getErrorStatus($this->payload);
     }
     $data = Utilities::getInstance()->extractData($serverParams);
     $employeeId = $data->user_id;
     $buddies = array(self::setDefaultMessage(Constants::EMPLOYEE_ID . Constants::ERROR_REQUIRED));
     if (!empty($employeeId)) {
         $buddies = Utilities::getInstance()->findShiftBuddy($employeeId, $shiftId);
         // dummy function: Results from DB implementation
         $status = PayloadInterface::OK;
     }
     return $this->payload->withStatus($status)->withOutput($buddies);
 }
예제 #5
0
 /**
  * @inheritDoc
  */
 public function __invoke(array $input)
 {
     $status = PayloadInterface::INVALID;
     $serverParams = $this->server->getServerParams();
     if (!self::hasAuthorization($serverParams, $this->payload)) {
         return self::getErrorStatus($this->payload);
     }
     $data = Utilities::getInstance()->extractData($serverParams);
     $employeeId = $data->user_id;
     //defaults to own id
     if (isset($input[Constants::EMPLOYEE_ID]) && self::hasAuthorization($serverParams, $this->payload, Constants::MANAGER_ACCESS)) {
         $employeeId = $input[Constants::EMPLOYEE_ID];
         //only Managers can query employee IDs
     }
     $shifts = array(self::setDefaultMessage(Constants::EMPLOYEE_ID . Constants::ERROR_REQUIRED));
     if (!empty($employeeId)) {
         $shifts = Utilities::getInstance()->findShiftsByEmployeeId($employeeId);
         //Results from DB implementation, sample provided here with random generated data
         $status = PayloadInterface::OK;
     }
     return $this->payload->withStatus($status)->withOutput($shifts);
 }
예제 #6
0
 /**
  * @inheritDoc
  */
 public function __invoke(array $input)
 {
     $status = PayloadInterface::INVALID;
     $serverParams = $this->server->getServerParams();
     if (!self::hasAuthorization($serverParams, $this->payload)) {
         return self::getErrorStatus($this->payload);
     }
     $token = Utilities::getInstance()->parseToken($serverParams);
     $data = Utilities::getInstance()->extractData($token);
     $employeeId = $data->user_id;
     $shiftId = 0;
     if (isset($input[Constants::SHIFT_ID])) {
         $shiftId = $input[Constants::SHIFT_ID];
     }
     $shifts = array(self::setDefaultMessage(Constants::ERROR_SHIFTID_REQUIRED));
     if (!empty($shiftId)) {
         $shifts = Utilities::getInstance()->findEmployeeManager($shiftId);
         // Results from DB implementation, sample provided here with random generated data
         $status = PayloadInterface::OK;
     }
     return $this->payload->withStatus($status)->withOutput($shifts);
 }
예제 #7
0
 /**
  * @inheritDoc
  */
 public function __invoke(array $input)
 {
     $status = PayloadInterface::INVALID;
     $serverParams = $this->server->getServerParams();
     if (!self::hasAuthorization($serverParams, $this->payload, Constants::MANAGER_ACCESS)) {
         return self::getErrorStatus($this->payload);
     }
     $data = Utilities::getInstance()->extractData($serverParams);
     $managerId = $data->user_id;
     $insertStatus = array(self::setDefaultMessage(Constants::EMPLOYEE_ID . Constants::ANDSTR . Constants::BREAKS . Constants::ANDSTR . Constants::FROM_DATE . Constants::ANDSTR . Constants::TO_DATE . Constants::ANDSTR));
     if (self::hasRequiredParams($input)) {
         $employeeId = $input[Constants::EMPLOYEE_ID];
         $breaks = $input[Constants::BREAKS];
         $startTime = $input[Constants::FROM_DATE];
         $endTime = $input[Constants::TO_DATE];
         $now = date(Constants::DEFAULT_DATEFORMAT);
         $newShift = new Shift([Constants::MANAGER_ID => $managerId, Constants::EMPLOYEE_ID => $employeeId, Constants::BREAKS => $breaks, Constants::START_TIME => $startTime, Constants::END_TIME => $endTime, Constants::CREATED_AT => $now, Constants::UPDATED_AT => $now]);
         $insertStatus = Utilities::getInstance()->addShift($newShift);
         // dummy function: Results from DB implementation
         $status = PayloadInterface::OK;
     }
     return $this->payload->withStatus($status)->withOutput($insertStatus);
 }
 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);
 }
예제 #9
0
if (!isset($_GET['action']) || $_GET['action'] != 'edit_email') {
    ?>
 class="hidden"<?php 
}
?>
>
						<?php 
echo tr('cancel');
?>
					</a>
				</td>
			</tr>
			<tr>
				<?php 
// Texture
$userAvatarByteSequence = ServerInterface::getInstance()->getUserTexture($_SESSION['serverid'], $_SESSION['userid']);
$isTextureSet = count($userAvatarByteSequence) > 0;
?>
				<td class="formitemname">
					<?php 
echo tr('texture');
?>
:
				</td>
				<td>
					<?php 
if ($isTextureSet) {
    echo tr('texture_set');
    $texBytes = '';
    foreach ($userAvatarByteSequence as $val) {
        $texBytes .= chr($val);
예제 #10
0
 function removeRegistration($srvid, $uid)
 {
     ServerInterface::getInstance()->getServer(intval($srvid))->unregisterUser(intval($uid));
 }
예제 #11
0
<div id="topline">
<div id="menu">
	<ul>
		<?php 
function echoMenuEntry($link, $textIndex)
{
    echo '<li><a href="' . $link . '">' . tr($textIndex) . '</a></li>';
}
echoMenuEntry('./', 'home');
if (!SessionManager::getInstance()->isUser()) {
    echoMenuEntry('./?page=login', 'login');
    echoMenuEntry('./?page=register', 'register');
} else {
    echoMenuEntry('./?page=profile', 'profile');
    echoMenuEntry('./?page=logout', 'logout');
}
if (SettingsManager::getInstance()->isShowAdminLink()) {
    echoMenuEntry('../admin/', 'admin_area');
}
?>
	</ul>
</div>
<?php 
if (isset($_SESSION['userid'])) {
    printf(tr('welcome_user'), ServerInterface::getInstance()->getUserName($_SESSION['serverid'], $_SESSION['userid']));
} else {
    echo tr('welcome_guest');
}
?>
</div>
예제 #12
0
            ?>
</a></li>
<?php 
        }
    }
    ?>
		</ul>
<?php 
} else {
    $_GET['sid'] = intval($_GET['sid']);
    if (!PermissionManager::getInstance()->isAdminOfServer($_GET['sid'])) {
        echo tr('permission_denied');
        MessageManager::echoAllMessages();
        exit;
    }
    $server = ServerInterface::getInstance()->getServer($_GET['sid']);
    ?>
	<h1>Server Details: <?php 
    echo SettingsManager::getInstance()->getServerName($_GET['sid']);
    ?>
</h1>
	<ul>
<?php 
    echo sprintf('<li><a class="jqlink" onclick="jq_server_getOnlineUsers(%d); return false;">Online Users</a></li>', $server->id());
    if (PermissionManager::getInstance()->serverCanViewRegistrations($server->id())) {
        echo sprintf('<li><a class="jqlink" onclick="jq_server_getRegistrations(%d); return false;">Registrations</a></li>', $server->id());
    }
    echo sprintf('<li><a class="jqlink" onclick="jq_server_getBans(%d); return false;">Bans</a></li>', $server->id());
    echo sprintf('<li><a class="jqlink" onclick="jq_server_showTree(%d); return false;">Channel-Tree</a></li>', $server->id());
    if (PermissionManager::getInstance()->serverCanGenSuUsPW($server->id())) {
        echo sprintf('<li id="li_server_superuserpassword"><a class="jqlink" onclick="if(confirm(\'Are you sure you want to generate and set a new SuperUser password?\')){jq_server_setSuperuserPassword(%d); return false;}">Generate new SuperuserPassword</a><div class="ajax_info"></div></li>', $server->id());
예제 #13
0
<div id="content">
	<h1><?php 
    echo tr('register_title');
    ?>
</h1>
	<form action="./?page=register&amp;action=doregister" method="post" style="width:400px;">
		<table class="fullwidth">
			<tr>
				<td class="formitemname"><?php 
    echo tr('server');
    ?>
:</td>
				<td>
					<?php 
    $servers = ServerInterface::getInstance()->getServers();
    ?>
					<select name="serverid" style="width:100%">
						<?php 
    foreach ($servers as $server) {
        // Check that server allows registration and does exist
        $serverDB = SettingsManager::getInstance()->getServerInformation($server->id());
        if ($serverDB['allowregistration']) {
            echo '<option value="' . $server->id() . '">';
            echo $serverDB['name'];
            echo '</option>';
        }
    }
    ?>
					</select>
				</td>
예제 #14
0
 public static function server_user_updateAvatar()
 {
     $serverId = intval($_POST['sid']);
     $userId = intval($_POST['uid']);
     $newValue = $_POST['newValue'] == 'null' ? array() : $_POST['newValue'];
     if (PermissionManager::getInstance()->serverCanEditRegistrations($serverId)) {
         ServerInterface::getInstance()->updateUserTexture($serverId, $userId, $newValue);
     }
 }
예제 #15
0
 /**
  * Try to activate an account with the given activation key
  * @param $key
  */
 function activateAccount($key)
 {
     $acc = $this->getAwaitingAccount($key);
     if ($acc != null) {
         try {
             ServerInterface::getInstance()->addUser($acc['sid'], $acc['name'], $acc['pw'], $acc['email']);
             $this->removeAwaitingAccount($key);
         } catch (Exception $exc) {
         }
     } else {
         echo '<div class="error">unknown activation key</div>';
     }
 }
예제 #16
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';
예제 #17
0
<?php

/**
 * Ajax functionality
 * @author Kissaki
 */
require_once dirname(__FILE__) . '/ajax.ajax.php';
//TODO make it a class “Ajax_User”, like Ajax_Admin
// TODO getTexture does not work (yet). Remove or fix.
//		This seems to be a problem with decompressing the string, gzuncompress() does not work, gzdecode() is PHP 6
switch ($_GET['ajax']) {
    case 'getTexture':
        if (isset($_GET['sid']) && isset($_GET['uid'])) {
            $texCompressed = ServerInterface::getInstance()->getUserTexture($_GET['sid'], $_GET['uid']);
            $texCSize = count($texCompressed);
            $texStr = '';
            foreach ($texCompressed as $val) {
                $texStr = $texStr . $val;
            }
            //					for ($px=0; $px<$texCSize; $px++) {
            ////						$texStr = $texStr.pack( 'C*', $texCompressed );
            //						$texStr = $texStr.$texCompressed[$px];
            //					}
            echo strlen($texStr) . '<br/>';
            //					$texStr = substr($texStr, 0, strlen($texStr)-4);
            $texStr = gzuncompress($texStr);
            // gzuncompress gzdecode
            //					$file = tempnam('tmp', 'tmp');
            //					file_put_contents($file, $texStr);
            //					$tmpTex = gzfile($file);
            //					$texStr = '';
예제 #18
0
파일: Cache.php 프로젝트: stunti/zf2
 /**
  * Load server definition from a file
  *
  * Unserializes a stored server definition from $filename. Returns false if
  * it fails in any way, true on success.
  *
  * Useful to prevent needing to build the server definition on each
  * request. Sample usage:
  *
  * <code>
  * if (!Zend\Server\Cache::get($filename, $server)) {
  *     require_once 'Some/Service/ServiceClass.php';
  *     require_once 'Another/Service/ServiceClass.php';
  *
  *     // Attach Some\Service\ServiceClass with namespace 'some'
  *     $server->attach('Some\Service\ServiceClass', 'some');
  *
  *     // Attach Another\Service\ServiceClass with namespace 'another'
  *     $server->attach('Another\Service\ServiceClass', 'another');
  *
  *     Zend\Server\Cache::save($filename, $server);
  * }
  *
  * $response = $server->handle();
  * echo $response;
  * </code>
  *
  * @param  string $filename
  * @param  \Zend\Server\ServerInterface $server
  * @return bool
  */
 public static function get($filename, ServerInterface $server)
 {
     if (!is_string($filename) || !file_exists($filename) || !is_readable($filename)) {
         return false;
     }
     if (false === ($dispatch = @file_get_contents($filename))) {
         return false;
     }
     if (false === ($dispatchArray = @unserialize($dispatch))) {
         return false;
     }
     $server->loadFunctions($dispatchArray);
     return true;
 }
예제 #19
0
			<form action="./?page=login&amp;action=dologin" method="post" style="width:400px;">
				<table class="fullwidth">
					<tr>
						<td class="formitemname"><?php 
    echo tr('server');
    ?>
:</td>
						<td>
							<?php 
    $servers = SettingsManager::getInstance()->getServers();
    ?>
							<select name="serverid">
								<?php 
    foreach ($servers as $sid => $server) {
        // Check that server allows login and does exist
        if ($server['allowlogin'] && ServerInterface::getInstance()->getServer($sid) != null) {
            echo '<option value="' . $sid . '">';
            echo $server['name'];
            echo '</option>';
        }
    }
    ?>
							</select>
						</td>
						<td class="helpicon" title="<?php 
    echo tr('help_login_server');
    ?>
"></td>
					</tr>
					<tr>
						<td class="formitemname"><?php 
예제 #20
0
				$.get('./?ajax=getPage&page='+page, {},
						function(data){
							$('#content').html(data);
						}
					);
			}
			/*]]>*/
		</script>
		<div id="log_area">
		<?php 
    MessageManager::echoAll();
    ?>
		</div>
		<div id="footer">
			<?php 
    echo '<div class="">Server Version: ' . ServerInterface::getInstance()->getVersion() . '</div>';
    echo '<div class="">Script execution time: ' . sprintf('%6.3f', PHPStats::scriptExecTimeGet()) . 'ms | memory peak: ' . memory_get_peak_usage() / 1000 . ' kByte</div>';
    ?>
			<div class="updatecheck_result"></div>
		</div>
<?php 
    //if (!isset($_SESSION['mumpiVersionCheckLast'])) {
    //	$_SESSION['mumpiVersionCheckLast'] = 0;
    //}
    // only check every 60 minutes
    //TODO make this cache the result and display the cached one when not querying
    //if ($_SESSION['mumpiVersionCheckLast']+3600 < time()) {
    include_once MUMPHPI_MAINDIR . '/version.php';
    if (isset($mumpiVersion)) {
        $_SESSION['mumpiVersionCheckLast'] = time();
        ?>
예제 #21
0
파일: index.php 프로젝트: nicolasjoly/MumPI
require_once MUMPHPI_MAINDIR . '/classes/MessageManager.php';
require_once MUMPHPI_MAINDIR . '/classes/SettingsManager.php';
require_once MUMPHPI_MAINDIR . '/classes/DBManager.php';
require_once MUMPHPI_MAINDIR . '/classes/Logger.php';
require_once MUMPHPI_MAINDIR . '/classes/SessionManager.php';
SessionManager::startSession();
require_once MUMPHPI_MAINDIR . '/classes/TranslationManager.php';
require_once MUMPHPI_MAINDIR . '/classes/ServerInterface.php';
require_once MUMPHPI_MAINDIR . '/classes/HelperFunctions.php';
require_once MUMPHPI_MAINDIR . '/classes/TemplateManager.php';
if (SettingsManager::getInstance()->isDebugMode()) {
    error_reporting(E_ALL);
}
// Check for running Ice with Murmur
try {
    ServerInterface::getInstance();
} catch (Ice_UnknownLocalException $ex) {
    MessageManager::addError(tr('error_noIce'));
    MessageManager::echoAll();
    exit;
}
if (isset($_GET['ajax'])) {
    require_once MUMPHPI_MAINDIR . '/ajax/user.ajax.php';
    die;
}
?>
<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8" />
예제 #22
0
 public function __construct(\GIFTploy\Git\Repository $repository, ServerInterface $server)
 {
     $this->localAdapter = new \League\Flysystem\Adapter\Local($repository->getDir());
     $this->remoteAdapter = $server->getAdapter();
 }