Exemple #1
0
                DML::saveLayerProperties($_REQUEST["layerName"], $layerProperties);
            }
            GUI::printMessage("%s", GUI::createLayerScreen($_REQUEST["layerName"]));
            break;
        case "poi":
            $poi = DML::getPOI($_REQUEST["layerName"], $_REQUEST["poiID"]);
            if (empty($poi)) {
                throw new Exception(sprintf("POI not found: %s:%s", $_REQUEST["layerName"], $_REQUEST["poiID"]));
            }
            GUI::printMessage("%s", GUI::createPOIScreen($_REQUEST["layerName"], $poi));
            break;
        case "newPOI":
            GUI::printMessage("%s", GUI::createNewPOIScreen($_REQUEST["layerName"]));
            break;
        case "migrate":
            GUI::printMessage("%s", GUI::createMigrationScreen());
            break;
        default:
            throw new Exception(sprintf("Invalid action: %s", $_action));
    }
} catch (Exception $e) {
    GUI::printError("%s", $e->getMessage());
    GUI::printMessage("%s", GUI::createMainScreen());
}
exit;
$pois = DML::getPOIs("example");
printf("<table>\n");
foreach ($pois as $poi) {
    printf("<tr><td>%s</td><td>%s,%s</td></tr>\n", $poi->title, $poi->lat, $poi->lon);
}
printf("</table>");
Exemple #2
0
 * Copyright 2009 SURFnet BV
 * Released under a permissive license (see LICENSE)
 */
/**
 * PorPOISe Dashboard authorization check
 *
 * @package PorPOISe
 * @subpackage Dashboard
 */
/* start session */
session_start();
/* generate session key */
$_sessionKey = md5(__FILE__);
/* check for login attempt */
if (!empty($_REQUEST["username"])) {
    if (DML::validCredentials($_REQUEST["username"], $_REQUEST["password"])) {
        $_SESSION[$_sessionKey]["loggedIn"] = TRUE;
    } else {
        $_SESSION[$_sessionKey]["loggedIn"] = FALSE;
        GUI::printError("Invalid username or password");
    }
}
/* check for logout attempt */
if (!empty($_REQUEST["logout"]) && $_REQUEST["logout"]) {
    $_SESSION[$_sessionKey]["loggedIn"] = FALSE;
}
/* check for logged in status */
if (empty($_SESSION[$_sessionKey]["loggedIn"]) || !$_SESSION[$_sessionKey]["loggedIn"]) {
    /* not logged in */
    GUI::printMessage("%s", GUI::createLoginScreen());
    exit;
Exemple #3
0
 /**
  * Handle POST
  *
  * Checks whether there is something in the POST to handle and calls
  * appropriate methods if there is.
  *
  * @throws Exception When invalid data is passed in POST
  */
 public static function handlePOST()
 {
     $post = $_POST;
     /* not interested in login attempts */
     unset($post["username"]);
     unset($post["password"]);
     if (empty($post)) {
         /* nothing interesting in POST */
         return;
     }
     $action = $_REQUEST["action"];
     switch ($action) {
         case "poi":
             $poi = self::makePOIFromRequest($post);
             DML::savePOI($_REQUEST["layerName"], $poi);
             break;
         case "newPOI":
             $poi = self::makePOIFromRequest($post);
             DML::savePOI($_REQUEST["layerName"], $poi);
             self::redirect("layer", array("layerName" => $_REQUEST["layerName"]));
             break;
         case "deletePOI":
             DML::deletePOI($_REQUEST["layerName"], $_REQUEST["poiID"]);
             self::redirect("layer", array("layerName" => $_REQUEST["layerName"]));
             break;
         case "migrate":
             DML::migrateLayers($_REQUEST["from"], $_REQUEST["to"]);
             break;
         case "layer":
             $layerProperties = self::makeLayerPropertiesFromRequest($post);
             $layerProperties->layer = $_REQUEST["layerName"];
             DML::saveLayerProperties($_REQUEST["layerName"], $layerProperties);
             break;
         default:
             throw new Exception(sprintf("No POST handler defined for action %s\n", $action));
     }
 }