Ejemplo n.º 1
0
 static function LoadPage($PageName, $Wrapper = true)
 {
     if (KERNEL::IsValidPage($PageName) == false) {
         KERNEL::OnError("Attempt to load invalid page '" . $PageName . "'");
     }
     if (!is_null(KERNEL::$Pages[$PageName][2])) {
         $Result = call_user_func(KERNEL::$Pages[$PageName][2]);
         if ($Result !== true) {
             KERNEL::OnError("Access Denied - " . $Result);
             die("");
             // Force cancel just incase
         }
     }
     if ($Wrapper) {
         global $GMDConfig;
         $OpenID = new LightOpenID($GMDConfig["Domain"]);
         if ($OpenID->validate()) {
             $ID = $OpenID->identity;
             $URL_Parts = explode("/", $ID);
             // Get their SteamID
             $CommunityID = $URL_Parts[sizeof($URL_Parts) - 1];
             $SteamID = CommunityToSteam($CommunityID);
             // Try and authenticate them
             $User = User::GetByField("User", "SteamID", $SteamID);
             if ($User->IsReal()) {
                 $User->AuthToUser();
             } else {
                 User::RegisterUser($SteamID, $_SERVER['REMOTE_ADDR'])->AuthToUser();
             }
             KERNEL::HardNavigate("home");
         } elseif ($_GET["page"] == "login") {
             if (User::$ActiveUser != false) {
                 if (isset($_GET["logout"])) {
                     User::Logout();
                 }
                 KERNEL::HardNavigate("home");
             } else {
                 $OpenID->identity = 'http://steamcommunity.com/openid';
                 header('Location: ' . $OpenID->authUrl());
             }
         }
         LightOpenID::revalidate();
     }
     global $OutputData;
     $OutputData = "";
     if ($Wrapper) {
         require "includes/util/header.php";
     }
     require "pages/" . $PageName . "/_process.php";
     require "pages/" . $PageName . "/_display.php";
     echo $OutputData;
     if ($Wrapper) {
         require "includes/util/footer.php";
     }
 }
Ejemplo n.º 2
0
            $FileType = $File["type"];
            $FileSize = $File["size"];
            if (75000 < $FileSize) {
                // Too Big
            } elseif ($FileType != "image/png" && $FileType != "image/jpg" && $FileType != "image/jpeg") {
                // Bad Type
            } elseif ($FileExtension != "png" && $FileExtension != "jpg" && $FileExtension != "jpeg") {
                // Bad Extension
            } else {
                $ImageURLName = md5(rand());
                move_uploaded_file($File["tmp_name"], "includes/images/uploaded/" . $ImageURLName . "." . $FileExtension);
            }
        }
        Database::Insert("gmd_items", array("Category" => intval($_POST["catID"]), "Name" => $_POST["itemName"], "Description" => $_POST["itemDesc"], "Cost" => floatval($_POST["itemCost"]), "Image" => $ImageURLName, "ShowImage" => !empty($_POST["showImage"]) ? 1 : 0, "Status" => ItemStatus::ACTIVE));
        echo "<h4>You are being redirected..</h4>";
        KERNEL::HardNavigate("admin", "&area=items");
    } else {
        $CatObj = ItemCategory::GetByField("ItemCategory", "ID", $_GET["catid"]);
        ?>

<h4>Add Item</h4>

<form enctype="multipart/form-data" method="POST" action="?page=admin&area=items&newitem=1">
	<input type="hidden" name="addItem" value="1" />
	<input type="hidden" name="catID" value="<?php 
        echo $CatObj->GetValue("ID");
        ?>
" />
	<input type="hidden" id="itemDesc" name="itemDesc" value="No Description Available" />
	
	<div class="row">
Ejemplo n.º 3
0
    $ActionData = "";
    $ServerData = "";
    foreach ($ActionArr["Arguments"] as $ArgObject) {
        $ActionData .= $_POST["input_" . $ArgObject->SysName] . ItemAction::$SerialKey;
    }
    foreach (Servers::GetCachedResults("Servers") as $ServerObj) {
        if (isset($_POST["action_server_" . $ServerObj->GetValue("ID")])) {
            $ServerData .= $ServerObj->GetValue("ID") . ";";
        }
    }
    $ItemAction->ChangeValue("ActionData", $ActionData);
    $ItemAction->ChangeValue("Servers", $ServerData);
    KERNEL::HardNavigate("admin", "&area=items&edit=1&item=" . $ItemObj->GetValue("ID"));
} elseif (isset($_GET["del"])) {
    $ItemAction->Delete();
    KERNEL::HardNavigate("admin", "&area=items&edit=1&item=" . $ItemObj->GetValue("ID"));
}
?>

<h4>Edit Action</h4>

<form method="POST" action="?page=admin&area=items&editaction=<?php 
echo $ItemAction->GetValue("ID");
?>
">
	<input type="hidden" name="doEditAction" value="yes" />
	
	<div class="row">
		<div class="col-sm-6 col-md-4" style="text-align: right;line-height: 34px;">
			<b>Item Name</b>
		</div>
Ejemplo n.º 4
0
<?php

if (isset($_GET["dobuy"]) && intval($_GET["dobuy"]) && User::$ActiveUser->IsReal()) {
    $ItemObj = Item::GetByField("Item", "ID", intval($_GET["dobuy"]));
    if (isset($ItemObj) && $ItemObj->IsReal()) {
        if (User::$ActiveUser->GetValue("Credit") >= $ItemObj->GetValue("Cost")) {
            User::$ActiveUser->BuyItem($ItemObj);
        }
    }
    KERNEL::HardNavigate("store", "&cat=" . $ItemObj->GetValue("Category"));
}
Ejemplo n.º 5
0
<?php

global $GMDConfig;
$OpenID = new LightOpenID($GMDConfig["Domain"]);
if (User::$ActiveUser != false) {
    if (isset($_GET["logout"])) {
        User::Logout();
        KERNEL::HardNavigate("home");
    } else {
        // They are logged in, so just render the home screen
        KERNEL::LoadPage("home", false);
    }
} else {
    // See if they already signed in through OpenID
    /*
    if( false && $OpenID->validate() ) {
    	/*
    	$ID = $OpenID->identity;
    	$URL_Parts = explode( "/", $ID );
    	
    	// Get their SteamID
    	$CommunityID = $URL_Parts[ sizeof( $URL_Parts ) - 1];
    	$SteamID = CommunityToSteam( $CommunityID );
    	
    	// Try and authenticate them
    	$User = User::GetByField( "User", "SteamID", $SteamID );
    	
    	if( $User->IsReal() ) $User->AuthToUser();
    	else User::RegisterUser( $SteamID, $_SERVER[ 'REMOTE_ADDR' ] )->AuthToUser();
    	KERNEL::HardNavigate( "home" );