Example #1
0
<?php

include 'core/config.php';
include 'core/core.php';
include 'core/game.php';
include 'locales/' . $_SESSION[$shortTitle . 'User']['locale'] . '/gl.php';
$db->query('start transaction');
if (isset($_SESSION[$shortTitle . 'User']['id'], $_GET['action'], $_GET['nodeId'])) {
    $node = new node();
    if ($node->get('id', $_GET['nodeId']) == 'done') {
        $flags = flags::get('name');
        $node->checkAll(time());
        switch ($_GET['action']) {
            case 'add':
                if ($flags['combat']) {
                    if (isset($_POST['name'], $_POST['attackerGroupUnitIds'], $_POST['attackerGroups'])) {
                        foreach ($_POST as $key => $value) {
                            if (!in_array($key, array('name', 'attackerGroupUnitIds', 'attackerGroups', 'attackerFocus'))) {
                                $_POST[$key] = misc::clean($value, 'numeric');
                            } else {
                                if (!in_array($key, array('name', 'attackerFocus'))) {
                                    $nr = count($_POST[$key]);
                                    for ($i = 0; $i < $nr; $i++) {
                                        $_POST[$key][$i] = misc::clean($_POST[$key][$i], 'numeric');
                                    }
                                } else {
                                    $_POST[$key] = misc::clean($value);
                                }
                            }
                        }
                        $target = new node();