Beispiel #1
0
 public static function GetByIDOrName($idOrName)
 {
     if (is_numeric($idOrName)) {
         return Place::GetByID($idOrName);
     }
     return Place::GetByName($idOrName);
 }
 public static function GetByAssoc($values)
 {
     $item = new PlaceClippingRegion();
     $item->ID = $values["region_ID"];
     $item->Place = Place::GetByID($values["region_PlaceID"]);
     $item->Comments = $values["region_Comments"];
     return $item;
 }
Beispiel #3
0
                     readfile("images/world/places/" . $CurrentPlace->ID . "/hotspot.png");
                     return true;
                 default:
                     return false;
             }
         } else {
             if ($CurrentPlace == null) {
                 System::Redirect("~/world");
                 return true;
             }
         }
     }
 } else {
     if ($path[0] == "") {
         // TODO: don't hardcode this!
         $CurrentPlace = Place::GetByID(11);
     } else {
         System::Redirect("~/world");
     }
 }
 $_SESSION["CurrentPlaceID"] = $CurrentPlace == null ? 0 : $CurrentPlace->ID;
 if ($CurrentUser == null) {
     $_SESSION["LoginRedirectURL"] = "~/world";
     System::Redirect("~/account/login.page");
     /*
     $page = new PsychaticaErrorPage();
     $page->Title = "Not Logged In";
     $page->Message = "You must be logged in to visit the World.  Please log in and then try visiting the World again.";
     */
     return true;
 } else {
use PhoenixSNS\Modules\World\Objects\PlaceClippingRegion;
use PhoenixSNS\Modules\World\Objects\PlaceClippingRegionPoint;
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $q = $_POST;
} else {
    $q = $_GET;
}
switch ($q["Action"]) {
    case "Retrieve":
        if (isset($q["PlaceID"])) {
            $id = $q["PlaceID"];
            if (!is_numeric($id)) {
                echo "{ \"Success\": false, \"ErrorMessage\": \"ID must be an integer\" }";
                return;
            }
            $place = Place::GetByID($id);
            if ($place == null) {
                echo "{ \"Success\": false, \"ErrorMessage\": \"Place with ID " . $id . " does not exist\" }";
                return;
            }
            $items = PlaceClippingRegion::GetByPlace($place);
            $count = count($items);
            echo "{ \"Success\": true, \"Items\": [ ";
            for ($i = 0; $i < $count; $i++) {
                echo $items[$i]->ToJSON();
                if ($i < $count - 1) {
                    echo ", ";
                }
            }
            echo " ] }";
        } else {