Example #1
0
 function addUser($srvid, $name, $password, $email = null)
 {
     try {
         $tmpServer = ServerInterface::getInstance()->getServer(intval($srvid));
         if (empty($tmpServer)) {
             echo 'Server could not be found.<br/>';
             die;
         }
         $reg = new MurmurRegistration($srvid, null, $name, $email, null, null, $password);
         $tmpUid = $tmpServer->registerUser($reg->toArray());
         echo TranslationManager::getInstance()->getText('doregister_success') . '<br/>';
     } catch (Murmur_InvalidServerException $exc) {
         // This is depreciated (murmur.ice)
         echo 'Invalid server. Please check your server selection.<br/><a onclick="history.go(-1); return false;" href="?page=register">go back</a><br/>If the problem persists, please contact a server admin or webmaster.<br/>';
     } catch (Murmur_ServerBootedException $exc) {
         echo 'Server is currently not running, but it has to to be able to register.<br/>Please contact a server admin';
     } catch (Murmur_InvalidUserException $exc) {
         echo 'The username you specified is probably already in use or invalid. Please try another one.<br/><a onclick="history.go(-1); return false;" href="?page=register">go back</a>';
     } catch (Ice_UnknownUserException $exc) {
         // This should not happen
         echo $exc->unknown . '<br/>';
         //			echo '<pre>'; var_dump($exc); echo '</pre>';
     }
 }
Example #2
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.');
     }
 }