JobExpert v1.0 powered by Script Developers Group (SD-Group) email: info@sd-group.org.ua url: http://sd-group.org.ua/ Copyright 2010-2015 (c) SD-Group All rights reserved ========================================================= Главная страница модуля Hand ********************************************************/ /** * @package * @todo */ !defined('SDG') ? die('Triple protection!') : null; // создаем объект $hand = new hand(); // ответ пользователю if (isset($_GET['result']) && !empty($_POST)) { } else { // проверяем наличие в сессии необходимых параметров и установлена ли цена в тарифной сетке для выбранной услуги if (isset($_SESSION['payment']) && isset($_SESSION['payment']['service']) && $payments->checkPriceInTariff($_SESSION['payment']['service'], $arrTariffs) && !empty($_SESSION['payment']['id'])) { // Сохраняем запрос оплаты if (isset($_POST['pay'])) { if (validate::postDataNotEmpty()) { // заполняем обязательные поля $hand->arrBindFields = array('order_id' => $_POST['order_id'], 'action' => $_SESSION['payment']['service'], 'user_id' => $_SESSION['sd_user']['data']['id'], 'record_id' => $_SESSION['payment']['id'], 'amount' => $_POST['amount'], 'currency' => HAND_CONF_CURRENCY, 'payment_type' => $_POST['payment']); // заполняем дополнительные поля $hand->additionalFields = array('description' => $payments->generatePaymentDescription($_SESSION['payment']['service']), 'payment_type_desc' => $handPaymentTypes[$_POST['payment']]); if (!$hand->recRecord()) { $arrErrors[] = ERROR_UNABLE_PERFORM_OPERATION; } else {
function updatePoints($id, $user, $pointbonus) { $playerpoint = getPlayerColor($id, $user); if ($playerpoint == "red") { $playerpoint = "PointsR"; $playerpoint2 = "PointsB"; $opponent = "PlayerBlue"; } else { $playerpoint = "PointsB"; $playerpoint2 = "PointsR"; $opponent = "PlayerRed"; } $sql = "SELECT " . $playerpoint . " FROM field WHERE FieldID = '{$id}'"; $result = mysql_query($sql); if ($result) { while ($ar = mysql_fetch_array($result, MYSQL_ASSOC)) { $points = $ar[$playerpoint]; } } $points = $points + $pointbonus; $sql = "UPDATE field SET " . $playerpoint . "='{$points}' WHERE FieldID = '{$id}'"; mysql_query($sql); //Win-Condition $field = new hand(getField($id), true); $fieldcards = $field->countHand(); $status = getGameStatus($id); if (($points > 36 || $fieldcards == 36) && $status == 1) { $sql = "SELECT " . $playerpoint2 . " FROM field WHERE FieldID = '{$id}'"; $result = mysql_query($sql); if ($result) { while ($ar = mysql_fetch_array($result, MYSQL_ASSOC)) { $points2 = $ar[$playerpoint2]; } } $sql = "SELECT " . $opponent . " FROM field WHERE FieldID = '{$id}'"; $result = mysql_query($sql); if ($result) { while ($ar = mysql_fetch_array($result, MYSQL_ASSOC)) { $player = $ar[$playerpoint2]; } } if ($points == $points2) { drawgame($id, $user, $player); } elseif ($points > $points2) { $playercolor = getPlayerColor($id, $user); wingame($id, $user, $player, $playercolor); } else { $playercolor = getPlayerColor($id, $player); wingame($id, $player, $user, $playercolor); } } }
*/ if (isset($_POST['config'])) { $arrPayTypes = array_combine($_POST['arrPayTypes']['index'], $_POST['arrPayTypes']['value']); $data = "<?php\n\n" . "(!defined('SDG')) ? die ('Triple protection!') : null;\n\n" . '$handPaymentTypes = array(' . "\n"; foreach ($arrPayTypes as $key => $value) { !empty($key) && !empty($value) ? $arrData[] = "\t'" . $key . "'\t=> '" . $value . "'" : null; } $data .= implode(",\n", $arrData) . "\n);\n\n"; $data .= !empty($_POST['currency']) ? 'define("HAND_CONF_CURRENCY", "' . $_POST['currency'] . '");' : 'define("HAND_CONF_CURRENCY", "USD");'; if (!tools::saveConfig('core/mods/payments/hand/conf/hand.conf.php', $data, CONF_ADMIN_FILE . '?m=mods&s=payments&action=config&id=hand')) { $arrErrors[] = ERROR_FILES_MISSING_FILE; } } } elseif ($arrActions['payments']) { // создаем объект $hand = new hand(); $retFields = array('order_id' => false); // Filter if (isset($_GET['do']) && $_GET['do'] === 'filter' && !empty($_GET['order_id'])) { $_GET['order_id'] = urldecode($_GET['order_id']); if (is_int($_GET['order_id'])) { $strWhereOrderId = " AND order_id IN (" . secure::escQuoteData($_GET['order_id']) . ")"; } else { $orderId = str_replace(array('*', '?'), array('%', '_'), $_GET['order_id']); $strWhereOrderId = " AND order_id LIKE " . secure::escQuoteData($orderId); } $retFields['order_id'] = $_GET['order_id']; // строка для урла с отбором $filterString = '&order_id=' . $_GET['order_id']; } else { $strWhereOrderId = '';
$turn = getTurn($id); $yourturn = false; if ($turn % 2 == 0) { if (getRedPlayer($id) == getUserID($id)) { $yourturn = true; } } else { if (getBluePlayer($id) == getUserID($id)) { $yourturn = true; } } $field = new hand(getField($id), true); if (isset($_GET["position"]) && isset($_GET["card"]) && $_GET["card"] != 0 && $yourturn == true) { $attack = new attack($id, $_GET["position"], $_GET["card"], getUserID(), $field, $hand); $endturn = $attack->attack(); $field = new hand(getField($id), true); } /********************************************************************************************************************** * Show Blue Player Points **********************************************************************************************************************/ echo '<center><h2 style="color: #000077;">' . getBluePoints($id) . '</h2>'; /********************************************************************************************************************** * Configurate end turn (button) **********************************************************************************************************************/ if (isset($_POST["endturn"])) { $endturn = $_POST["endturn"]; } if ($turn != 0) { if ($turn % 2 == 0) { if (getRedPlayer($id) == getUserID($id)) { $buttonmsg = "Your turn, " . $players[1] . "!";