コード例 #1
0
ファイル: Highscore.php プロジェクト: roderm/mkn151
 /**
  * Return Data-Model for the View
  */
 private function getModel()
 {
     require_once 'classes/SQL.php';
     $model = new stdClass();
     $model->template = 'admin/HighscoreTable';
     $model->isAdmin = person::getPermissionName() == 'admin' ? 'true' : 'false';
     $model->gameID = $this->getGameId();
     $sql = new SQL();
     $sql->connect();
     $model->data = $sql->get("SELECT * FROM ViewHighscore ORDER BY GamerMainScore DESC");
     return $model;
 }
コード例 #2
0
ファイル: Admin.php プロジェクト: roderm/mkn151
 /**
  * Returns Main-Page from the Admin-Section as HTML-View
  * @return string
  */
 public function getMain()
 {
     include_once 'classes/person.php';
     if (person::getPermissionName() != 'admin') {
         $login = Uri::getAction('Login');
         header("Location: {$login}");
     } else {
         require 'classes/view.php';
         require './models/admin.php';
         $view = new view();
         return $view->loadTemplate(new admin_model());
     }
 }
コード例 #3
0
ファイル: Gamer.php プロジェクト: roderm/mkn151
 /**
  * Return Gamer-Main-Page as HTML-View
  */
 public function getMain()
 {
     if (person::getPermissionName() != 'admin' && person::getPermissionName() != 'gameuser') {
         $login = Uri::getAction('Login');
         header("Location: {$login}");
     } else {
         require 'classes/view.php';
         $model = new stdClass();
         $model->template = 'game/main';
         $model->hasFrage = isset($_SESSION['tmpFrage']['id']);
         $model->user = $_SESSION['username'];
         $model->points = 0;
         $model->message = $model->hasFrage ? 'Welcome back' : 'Welcome';
         $view = new view();
         return $view->loadTemplate($model);
     }
 }
コード例 #4
0
ファイル: Login.php プロジェクト: roderm/mkn151
 /**
  * Checks user-Data for Login and Logg In
  */
 public function loggin()
 {
     include_once 'classes/person.php';
     $success = false;
     $uri = '';
     if (isset($_POST['username']) && isset($_POST['passwd'])) {
         $username = (string) htmlspecialchars($_POST['username']);
         $password = (string) htmlspecialchars($_POST['passwd']);
         if (person::logIn($username, $password)) {
             $success = true;
             switch (person::getPermissionName()) {
                 case 'admin':
                     $uri = Uri::getAction('Admin', 'getMain');
                     break;
                 case 'gameuser':
                     $uri = Uri::getAction('Gamer', 'getMain');
                     break;
             }
         }
     }
     return json_encode(array("success" => $success, "uri" => $uri));
 }