Example #1
0
 /**
  * Get admin object by (account-)name.
  * @param $username account name
  * @return array admin object or null
  */
 public function getAdminByName($username)
 {
     if (file_exists($this->filepath_admins)) {
         $fd = fopen($this->filepath_admins, 'r') or MessageManager::addError('could not open ' . self::$filename_admins . ' file');
         while ($line = fgets($fd)) {
             $admin = $this->createAdminFromString($line);
             if ($admin['name'] == $username) {
                 fclose($fd);
                 return $admin;
             }
         }
     }
     return null;
 }
Example #2
0
                break;
            case -1:
                MessageManager::addWarning(tr('login_wronglogininformation'));
                break;
            default:
                // login success
                $_SESSION['serverid'] = $_POST['serverid'];
                $_SESSION['userid'] = $tmpUid;
                $_SESSION['userLoggedIn'] = true;
                echo '<script type="text/javascript">location.replace("?page=profile")</script>';
                echo tr('login_success');
                break;
        }
    } else {
        // missing mandatory data
        MessageManager::addError(tr('login_missing_data'));
    }
} else {
    // no login-action, thus show login form
    ?>

		<div id="content">
			<h1><?php 
    echo tr('login_head');
    ?>
</h1>
			<form action="./?page=login&amp;action=dologin" method="post" style="width:400px;">
				<table class="fullwidth">
					<tr>
						<td class="formitemname"><?php 
    echo tr('server');
Example #3
0
 function updateUserTexture($srvid, $uid, $newTexture)
 {
     try {
         if (is_string($newTexture)) {
             // conversation string -> byte array (PHP5)
             $newTexture = str_split($newTexture);
         }
         $this->getServer($srvid)->setTexture($uid, $newTexture);
         return true;
     } catch (Murmur_InvalidTextureException $exc) {
         MessageManager::addError(tr('error_invalidTexture'));
         return false;
     }
 }
Example #4
0
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';
require_once MUMPHPI_MAINDIR . '/classes/ServerViewer.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/' . MUMPHPI_SECTION . '.ajax.php';
    if (is_callable('Ajax_' . MUMPHPI_SECTION . '::' . $_GET['ajax'])) {
        eval('Ajax_' . MUMPHPI_SECTION . '::' . $_GET['ajax'] . '();');
    }
    MessageManager::echoAll();
    exit;
}
$serverId = isset($_GET['serverId']) ? intval($_GET['serverId']) : 1;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
Example #5
0
 public static function meta_server_information_update()
 {
     $serverId = isset($_POST['serverid']) ? intval($_POST['serverid']) : null;
     // user has rights?
     if (PermissionManager::getInstance()->serverCanEditConf($serverId)) {
         if ($serverId != null && isset($_POST['name']) && isset($_POST['allowlogin']) && isset($_POST['allowregistration']) && isset($_POST['forcemail']) && isset($_POST['authbymail'])) {
             $serverId = intval($_POST['serverid']);
             $name = $_POST['name'];
             $allowLogin = $_POST['allowlogin'];
             $allowRegistration = $_POST['allowregistration'];
             $forcemail = $_POST['forcemail'];
             $authByMail = $_POST['authbymail'];
             SettingsManager::getInstance()->setServerInformation($serverId, $name, $allowLogin, $allowRegistration, $forcemail, $authByMail);
         } else {
             MessageManager::addError(TranslationManager::getInstance()->getText('error_missing_values'));
         }
     } else {
         MessageManager::addError('You don’t have permission to do this.');
     }
 }