コード例 #1
0
ファイル: game.php プロジェクト: aymericbouzy/cluedo-solver
<?php

before_action("check_entry", array("show", "skip", "turn", "daybook", "revert"), array("model_name" => "game"));
before_action("create_form", array("new", "create"), "new_game");
before_action("check_form", array("create"), "new_game");
before_action("create_form", array("show", "turn"), "turn");
before_action("check_form", array("turn"), "turn");
switch ($_GET["action"]) {
    case "index":
        break;
    case "new":
        break;
    case "create":
        define("game", create_game($_POST["identity"]));
        define("turn", -1);
        foreach ($_POST["cards_suspect"] as $suspect => $cards) {
            create_player($suspect, $cards);
        }
        foreach ($_POST["known_cards"] as $card) {
            add_card_owner_status($card, $_POST["identity"], owned);
        }
        foreach (select_suspects() as $player) {
            if (select_cards_player($player["id"]) == 0) {
                foreach (select_cards() as $card) {
                    add_card_owner_status($card["id"], $player["id"], not_owned);
                }
            }
        }
        $game["id"] = game;
        redirect_to_action("show");
        break;
コード例 #2
0
ファイル: Router.php プロジェクト: mrjovanovic/miniflux
function notfound(\Closure $callback)
{
    before('notfound');
    before_action('notfound');
    $callback();
}