Example #1
0
        Flash::store('Admin Update FAILED !', true);
        // redirect kills form resubmission
    }
}
if (isset($_POST['game_action'])) {
    test_token();
    try {
        switch ($_POST['game_action']) {
            case 'pause':
                Game::pause($_POST['ids']);
                break;
            case 'unpause':
                Game::pause($_POST['ids'], false);
                break;
            case 'delete':
                Game::delete($_POST['ids']);
                break;
            default:
                break;
        }
        Flash::store('Admin Update Successfull', true);
        // redirect kills form resubmission
    } catch (MyException $e) {
        Flash::store('Admin Update FAILED !', true);
        // redirect kills form resubmission
    }
}
if (isset($_POST['submit'])) {
    test_token();
    try {
        // clear the submit and token fields
     $gameType = $_POST['gameType'];
     $year = $_POST['year'];
     $rating = $_POST['rating'];
     $company = $_POST['company'];
     try {
         $game = new Game(null, $gameType, $name, $rating, $year, $company);
         $game->save();
     } catch (PDOException $exception) {
         $return = false;
     }
     break;
 case ActionType::ACTION_DELETE:
     $id = $_POST['id'];
     try {
         $game = new Game($id, null, null, null, null, null);
         $game->delete();
     } catch (PDOException $exception) {
         $return = false;
     }
     break;
 case ActionType::ACTION_MODIFY:
     $name = $_POST['name'];
     $gameType = $_POST['gameType'];
     $year = $_POST['year'];
     $rating = $_POST['rating'];
     $company = $_POST['company'];
     $gameTable = new GameTable();
     $game = $gameTable->getById($_POST['id']);
     $game->modify($gameType, $name, $rating, $year, $company);
     $game->save();
     break;
Example #3
0
 * License: http://www.bluethrust.com/license.php
 *
 */
include_once "../../../../_setup.php";
include_once "../../../../classes/member.php";
include_once "../../../../classes/rank.php";
include_once "../../../../classes/consoleoption.php";
include_once "../../../../classes/game.php";
$member = new Member($mysqli);
$member->select($_SESSION['btUsername']);
$gameObj = new Game($mysqli);
$consoleObj = new ConsoleOption($mysqli);
$cID = $consoleObj->findConsoleIDByName("Manage Games Played");
$consoleObj->select($cID);
$_GET['cID'] = $cID;
if ($member->authorizeLogin($_SESSION['btPassword'])) {
    $memberInfo = $member->get_info_filtered();
    if ($member->hasAccess($consoleObj) && $gameObj->select($_POST['gID'])) {
        define("MEMBERRANK_ID", $memberInfo['rank_id']);
        if ($_POST['confirm'] == 1) {
            $gameObj->delete();
            //$gameObj->resortOrder();
            include "main.php";
        } else {
            $gameName = $gameObj->get_info_filtered("name");
            echo "<p align='center'>Are you sure you want to delete the game <b>" . $gameName . "</b>?</p>";
        }
    } elseif (!$gameObj->select($_POST['gID'])) {
        echo "<p align='center'>Unable find the selected game.  Please try again or contact the website administrator.</p>";
    }
}
 /**
  * test deleting a Player that does not exist
  *
  * @expectedException PDOException
  **/
 public function testDeleteInvalidPlayer()
 {
     // Create a player and try to delete it without actually inserting it
     $player = new Game(null, $this->player->getPlayerId());
     $player->delete($this->getPDO());
 }
Example #5
0
            $_SESSION['game_id'] = 0;
        }
        $Chat = new Chat((int) $_SESSION['player_id'], (int) $_SESSION['game_id']);
        $Chat->send_message($_POST['chat'], isset($_POST['private']), isset($_POST['lobby']));
        $return = $Chat->get_box_list(1);
        $return = $return[0];
    } catch (MyException $e) {
        $return['error'] = 'ERROR: ' . $e->outputMessage();
    }
    echo json_encode($return);
    exit;
}
// run the invites stuff
if (isset($_POST['action']) && 'delete' == $_POST['action']) {
    try {
        Game::delete($_POST['game_id']);
        echo 'Game Deleted';
    } catch (MyEception $e) {
        echo 'ERROR: Could not delete game';
    }
    exit;
}
// init our game
$Game = new Game((int) $_SESSION['game_id']);
// run the game refresh check
if (isset($_POST['refresh'])) {
    echo $Game->last_move;
    exit;
}
// do some more validity checking for the rest of the functions
if (empty($DEBUG) && empty($_POST['notoken'])) {