public static function getSession()
 {
     self::startSessionIfNecessary();
     try {
         if (!isset($_SESSION['user_session'])) {
             self::$singleton = new SessionController();
         } else {
             self::$singleton = $_SESSION['user_session'];
             if (isset(self::$singleton->user)) {
                 self::updateUserData();
             }
         }
     } catch (Exception $e) {
         APIController::getError($e->getMessage());
     }
     return self::$singleton;
 }
Ejemplo n.º 2
0
<?php

set_include_path($_SERVER["DOCUMENT_ROOT"] . "/shalomshanti/");
require_once "Controller/APIController.php";
header("Content-type: text/json");
if ($_SERVER['REQUEST_METHOD'] === "GET") {
    echo APIController::runAction("getUser");
} else {
    echo APIController::getError("Unsupported HTTP Method: " . $_SERVER['REQUEST_METHOD']);
}