Ejemplo n.º 1
0
    } else {
        $id = $_GET["id"];
    }
    $shotgun = new Desc();
    $shotgun->select($id);
    if (!in_array('all', $shotgun->public_cible) && (!empty($user) && !in_array($user->promo, $shotgun->public_cible))) {
        $app->flash("info", "Vous ne faites pas partie du public cible de ce shotgun.");
        $app->redirect("index");
    }
    $app->render('header.php', array());
    $app->render('shotgun.php', array("desc" => $shotgun, "username" => isset($_SESSION['username']) ? $_SESSION['username'] : null, "user" => $user, "payutcClient" => getPayutcClient("WEBSALE")));
    $app->render('footer.php', array('isAdminFondation' => $isAdminFondation));
});
// Show a specific shotgun page
$app->get('/makeshotgun', function () use($app) {
    $gingerClient = new GingerClient(Config::get('ginger_key'), Config::get('ginger_server'));
    $payutcClient = getPayutcClient("WEBSALE");
    if (!isset($_GET["id"]) || !isset($_GET["choice_id"])) {
        $app->redirect("index");
    } else {
        $id = $_GET["id"];
        $choice_id = $_GET["choice_id"];
    }
    $choice = new Choice();
    $choice->select($choice_id);
    if ($choice->descId != $id) {
        $app->flash("info", "A quoi tu joues ?");
        $app->redirect("index");
    }
    try {
        $app->response->redirect($choice->shotgun($gingerClient->getUser($_SESSION["username"]), $payutcClient), 303);
Ejemplo n.º 2
0
<?php

require 'vendor/autoload.php';
use Ginger\Client\GingerClient;
use Payutc\Client\AutoJsonClient;
use Payutc\Client\JsonException;
// Load configuration
require "config.inc.php";
require "cas.php";
// Settings for cookies
$sessionPath = parse_url($_CONFIG["self_url"], PHP_URL_PATH);
session_set_cookie_params(0, $sessionPath);
session_start();
$app = new \Slim\Slim();
$payutcClient = new AutoJsonClient($_CONFIG["payutc_server"], "WEBSALE");
$gingerClient = new GingerClient($_CONFIG["ginger_apikey"], $_CONFIG["ginger_server"]);
$app->get('/', function () use($app, $gingerClient, $_CONFIG) {
    if (isset($_SESSION['username'])) {
        $userInfo = $gingerClient->getUser($_SESSION["username"]);
        $app->render('template.php', array("title" => $_CONFIG["title"], "loggedin" => true, "logoutUrl" => $_CONFIG["self_url"] . "logout", "userInfo" => $userInfo, "cotiseUrl" => $_CONFIG["self_url"] . "cotiser"));
    } else {
        $app->render('template.php', array("title" => $_CONFIG["title"], "loggedin" => false, "loginUrl" => $_CONFIG["self_url"] . "logincas"));
    }
});
$app->get('/logincas', function () use($app, $payutcClient, $_CONFIG) {
    if (empty($_GET["ticket"])) {
        $casUrl = $payutcClient->getCasUrl() . "login?service=" . $_CONFIG["self_url"] . 'logincas';
        $app->response->redirect($casUrl, 303);
    } else {
        $cas = new Cas($payutcClient->getCasUrl());
        $user = $cas->authenticate($_GET["ticket"], $_CONFIG["self_url"] . 'logincas');