/** * @param string $backUrl * @param int $player_id * @return \Illuminate\Http\RedirectResponse */ public function add($backUrl = 'entree', $player_id = 0) { if ($player_id == 0) { return Redirect::route($backUrl); } $player = Player::find($player_id); // Cree Entree $entree = new Entree(); $entree->compet_id = MySession::getModel('compet')->id; $entree->statusentree_id = 1; $entree->teamname = ""; $entree->hcp = 0; $entree->save(); // Cree les EntreePlayers (en fonction du Compet->TypeCompet->nbplayers $nbPlayers = MySession::getModel('compet')->typecompet->nbplayers; for ($pl = 1; $pl <= $nbPlayers; $pl++) { $entreePlayer = new Entreeplayer(); $entreePlayer->entree_id = $entree->id; if ($pl == 1) { $entreePlayer->player_id = $player->id; $entreePlayer->hcp = $player->hcp; } $entreePlayer->num = $pl; $entreePlayer->save(); // get Categorie if ($pl == 1) { $entreePlayer->competcategorie_id = $entreePlayer->getCategorie(); $entreePlayer->save(); } } return Redirect::route($backUrl); }
public static function load() { if (!self::$fs->exists(self::fileName())) { return self::$data = array(); } $c = self::$fs->getContent(self::fileName()); self::$data = self::$j->decode($c); }
public function showTest() { /* Test mySession */ MySession::put('test', 'test me'); $this->dsp->content = 'test'; $this->dsp->addVar('var', 'Bonjour'); $this->dsp->addVar('nom', 'Jean-Paul'); return View::make('dispatch')->with(['dsp' => $this->dsp]); }
protected function __construct($controller) { parent::__construct($controller); if (Router::getDefaultModule() == 'Page') { if (Page_Handler::getPageID()) { $this->show->merge(Page_Handler::getPage(), true); $this->show->breadcrumbs = Page_Handler::getPage()->getParents(); } $oPage = new Page(); list($full, $current) = $oPage->getMenuList(); if (is_array($full) && count($full)) { foreach ($full as $menu) { if (isset($menu["Children0"])) { $this->show->{'MENU_' . $menu["StaticPath"]} = $menu["Children0"]; } } } } // i.kiz для интернет магазина // $trash = NULL; // $this->show->basketList = NULL; if ($this->show->itemID) { $this->show->staticPath = $this->show->itemID; } else { if (!empty($this->data[0])) { $this->show->staticPath = $this->data[0]; } else { $this->show->staticPath = 0; } } $this->oCatalogCategory = new Catalog_Category(); $this->oCatalogBrand = new Catalog_Brand(); $this->show->catalogBrand = $this->oCatalogBrand->getList(); // menu $i = 0; $this->show->catalogMenu = array(); foreach ($this->show->catalogBrand as $br) { $this->show->catalogMenu['Brand'][$i] = $br['Title']; $cats = $this->oCatalogCategory->getList($br['BrandID']); $j = 0; foreach ($cats as $cat) { $this->show->catalogMenu['Category'][$i][$j] = $cat['Title']; $this->show->catalogMenu['CategoryID'][$i][$j] = $cat['CategoryID']; $j++; } $i++; } // корзина $this->session = MySession::getInstance(); $trash = $this->session->get('trash'); if (isset($trash)) { $this->show->trash = $trash; } else { $this->show->trash = array(); } }
/** * @param string $backUrl * @param int $id * @return $this */ public function open($backUrl = 'home', $id = 0) { MySession::saveModel($this->prefix, $id); // Display $this->dsp->content = $this->dsp->open; if (method_exists($this, 'beforeOpen')) { $this->beforeOpen(); } return View::make('dispatch')->with(['dsp' => $this->dsp]); }
/** * Creates a singleton session of the given type. Some session types * (native, database) also support restarting a session by passing a * session id as the second parameter. * * @param string type of session (native, cookie, etc) * @param string session identifier * @return Session */ public static function getInstance($id = NULL) { if (self::$instance === false) { // Create a new session instance self::$instance = $session = new self($id); // Write the session at shutdown register_shutdown_function(array($session, 'write')); } return self::$instance; }
/** * @param string $backUrl * @param int $categorie_id * @return \Illuminate\Http\RedirectResponse */ public function add($backUrl = 'compet', $categorie_id = 0) { if ($categorie_id == 0) { return Redirect::route($backUrl); } $categorie = Categorie::find($categorie_id); $userclub = new Competcategorie(); $userclub->categorie_id = $categorie->id; $userclub->compet_id = MySession::getModel('compet')->id; $userclub->tee_id = $categorie->tee_id; $userclub->save(); return Redirect::route($backUrl); }
public static function shutdown_handler() { if (is_array($_SESSION) && count($_SESSION) > 0) { if (!self::$sessionStarted) { // the _SESSION superglobal gets overwritten by session_start // so we save the contents in a temp var $tmp = $_SESSION; session_start(); $_SESSION = $tmp; self::$sessionStarted = true; echo "starting new session ...<br>"; } else { echo "starting existing session ...<br>"; } session_commit(); echo '$_SESSION not empty, commit session (' . session_id() . ')<br>'; var_dump($_SESSION); } else { self::clearSession(); } }
<?php // listItem : nom de la procedure dans le model $listItem = 'newListItem'; // Datas $datas = MySession::getModel('compet')->competcategories; // Sub-titre $param['sub-titre'] = 'Les catégories'; // Add Route $param['addRoute'] = 'competcategorie.selectpage'; $param['addText'] = 'sélectionner une catégorie'; // Open Route $param['openRoute'] = ''; // Edit Route $param['editRoute'] = 'competcategorie.changetee'; $param['editText'] = ''; // Delete Route $param['deleteRoute'] = 'competcategorie.delete'; $param['deleteText'] = ''; // Select Route $param['selectRoute'] = ''; $param['selectText'] = ''; $param['afterRoute'] = ''; // Actions $param['actions'] = 'edit,delete'; // BackUrl $param['backUrl'] = 'compet'; ?> <div class="information white">
<?php // listItem : nom de la procedure dans le model $listItem = 'newListItem'; // Datas $datas = Categorie::whereNotIn('id', MySession::getModel('compet')->getListCategorieId())->get(); // Sub-titre $param['sub-titre'] = 'Sélectionner une catégorie'; // Add Route $param['addRoute'] = ''; $param['addText'] = ''; // Open Route $param['openRoute'] = ''; // Edit Route $param['editRoute'] = ''; $param['editText'] = ''; // Delete Route $param['deleteRoute'] = ''; $param['deleteText'] = ''; // Select Route $param['selectRoute'] = 'competcategorie.add'; $param['selectText'] = ''; $param['afterRoute'] = ''; // Actions $param['actions'] = 'select'; // BackUrl $param['backUrl'] = 'compet'; ?> <div class="information white">
static function curClass() { /*if(session_id() == '') { session_start(); } //return $_COOKIE["class"]; if (!isset($_SESSION['class'])) return null; return $_SESSION['class'];*/ if (!MySession::has("class")) { return null; } return MySession::get("class"); }
<div class="information white"> <div class="bloc-page-titre"> <table width="100%"> <tr> <td>{{ gl('Les configurations de départs') }}</td> <td class="right">{{ Xbutton::bttAdd('configdepart.create',['tour'],'Ajouter une Configuration') }}</td> </tr> </table> </div> <div> <?php $cat['datas'] = MySession::getModel('tour')->configdeparts; $cat['module'] = ''; $cat['actions'] = 'edit,delete'; $cat['backUrl'] = 'tour'; $catDatas = Dispatch::displayList($cat); ?> {{ $catDatas['code'] }} </div> </div>
$nbJoueurLibelle = gl("Nombre d'équipes dans un départ"); $nbJoueurDansFlightSelect = ['1' => 1]; } ?> {{ openContent($param['titre']) }} <?php // Open Form Xform::form('route', 'configdepart.create'); // Hidden Xform::startRow('hidden'); Xform::addText('_token', 'x', Session::getToken(), 2); Xform::addText('id', 'ID', $datas->id, 2); Xform::addText('backUrl', '', $param['backUrl']); Xform::addText('tour_id', 'TOUR_ID', MySession::getModel('tour')->id, 1); Xform::endRow(); // Get Fields Xform::startRow(); Xform::addSelect('parcour_id', Parcour::lists('nom', 'id'), 'Parcours', $datas->parcour_id, 4); Xform::addSelect('typeconfigdepart_id', ['1' => 'En ligne', '2' => 'Shotgun'], 'Type de départs', $datas->typeconfigdepart_id, 3); Xform::endRow(); Xform::startRow(); Xform::addText('nbjoueurs', $nbJoueurLibelle, $datas->nbjoueurs, 3); Xform::addSelect('starttee', ['1' => 1, '10' => 10], 'Au Trou', $datas->starttee, 2); Xform::addText('startheure', 'Commence à', $datas->startheure, 2); Xform::addSelect('interval', ['9' => '9 min', '10' => '10 min'], 'Toutes les', $datas->interval, 2); Xform::endRow(); Xform::startRow(); Xform::addSelect('slotbyflight', $nbJoueurDansFlightSelect, $nbJoueurDansFlight, $datas->slotbyflight, 4); Xform::addSelect('startergap', ['0' => 0, '1' => 1, '2' => 2, '3' => 3], 'Starter gap', $datas->startergap, 2);
/** * Competcategorie constructor. * @param array $attributes */ public function __construct(array $attributes = array()) { $this->setRawAttributes(array_merge($this->attributes, array('categorie_id' => 0, 'compet_id' => MySession::getModel('compet')->id)), true); parent::__construct($attributes); }
$datas = $dsp->var['param']['datas']; $param = $dsp->var['param']; ?> {{ openContent($param['titre']) }} <?php // Open Form Xform::form('route', 'tour.create'); // Hidden Xform::startRow('hidden'); Xform::addText('_token', 'x', Session::getToken(), 2); Xform::addText('id', 'ID', $datas->id, 2); Xform::addText('backUrl', '', $param['backUrl']); Xform::addText('compet_id', 'COMPET_ID', MySession::getModel('compet')->id, 1); Xform::endRow(); // Get Fields Xform::startRow(); Xform::addDate('datetour', 'Date', $datas->datetour, 2); Xform::addSelect('formulecompet_id', $datas->compet->typecompet->listFormules(), 'Formule de jeu', $datas->formulecompet_id, 3); Xform::endRow(); // Buttons Xform::addSubmit(); Xform::addCancel($param['backUrl']); // Message bottom //Xform::addMessage('Ceci est un message'); ?> <!-- Close Form --> {{ Xform::show($errors,'left') }}
/** * Log a user out. * * @param boolean $destroy completely destroy the session * @return boolean */ public function logout($destroy = FALSE) { if (!$this->loggedIn()) { return FALSE; } $user = $this->getUser(); if (intval($user->UserID) !== 0) { $token = new User_Token($this->config['cookie_key']); $token->delete($user->UserID); } if ($destroy === TRUE) { MySession::getInstance()->destroy(); } else { $this->session->delete($this->config['session_key']); $this->session->regenerate(); } Cookie::delete($this->config['cookie_key']); // Double check return !$this->loggedIn(); }
public function index() { $this->show['Title'] = 'Оформление заказа'; $this->session = MySession::getInstance(); $trash = $this->session->get('trash'); if (sizeof($trash) < 1) { $this->show['Title'] = 'Ваша корзина пуста...'; } else { $this->show->basketList = array(); $catalog = new Catalog(); foreach ($trash as $i => $item) { $str = $catalog->getById($item['id']); $str['col'] = $item['col']; $this->show->basketList[$i] = $str; $this->show->basketList[$i]['col'] = $item['col']; } } if (isset($_POST['mode']) && $_POST['mode'] == 'send') { $db = MySQL::getInstance(); $db->query('SELECT FieldName, FieldValue FROM `config` WHERE FieldName="Title"'); $str = $db->fetchRow(); $sitename = $str['FieldValue']; if (substr(PHP_OS, 0, 3) == "WIN") { $n = "\r\n"; } else { $n = "\n"; } $mail = htmlspecialchars(stripslashes(trim($_POST['mail']))); $name = htmlspecialchars(stripslashes(trim($_POST['name']))); $phone = htmlspecialchars(stripslashes(trim($_POST['phone']))); $description = htmlspecialchars(stripslashes(trim($_POST['description']))); $body = 'Заказ с сайта ' . $sitename . $n; $body .= 'тел:' . $phone . ' ' . $name . $n . $n; $w = array('n' => 4, 'cod' => 15, 'name' => 30, 'x' => 20); $row = 1; $total = 0; foreach ($this->show->basketList as $key => $val) { $body .= str_pad($row, $w['n'], " ", STR_PAD_RIGHT); $body .= str_pad($val['Code'], $w['cod'], " ", STR_PAD_RIGHT); $body .= str_pad($val['Title'], $w['name'], " ", STR_PAD_RIGHT) . $n . $n; $body .= str_pad(' ', $w['n'], " ", STR_PAD_RIGHT); $body .= str_pad('Цена ', $w['x'], " ", STR_PAD_RIGHT) . $val['Price'] . " руб." . $n; $body .= str_pad(' ', $w['n'], " ", STR_PAD_RIGHT); $body .= str_pad('Кол-во ', $w['x'], " ", STR_PAD_RIGHT) . $val['col'] . ' ' . $val['Ed'] . $n; $body .= str_pad(' ', $w['n'], " ", STR_PAD_RIGHT); $body .= str_pad('Сумма ', $w['x'], " ", STR_PAD_RIGHT) . $val['col'] * $val['Price'] . ' руб.' . $n; $total += $val['col'] * $val['Price']; $row++; $body .= $n . str_pad('_', 60, "_", STR_PAD_RIGHT) . $n; } $body .= $n . ' ИТОГО на сумму: ' . $total . ' руб.' . $n . $n . $n; $body .= $description; $to = [$this->show->Email]; $subject = 'Заказ с сайта ' . $sitename . '--' . $mail; $transport = Swift_SmtpTransport::newInstance($this->show->Smtp, $this->show->Port, "ssl")->setUsername($this->show->Login)->setPassword($this->show->Password); $mailer = Swift_Mailer::newInstance($transport); $message = Swift_Message::newInstance($subject)->setFrom(array($this->show->Email))->setTo($to)->setBody($body); $result = $mailer->send($message); if ($result == 1) { $trash = null; $this->session->delete('trash'); $this->show->basketList = null; exit('ok'); } exit('error'); } }
/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. */ protected function setUp() { $this->object = MySession::singleton(); $_SESSION = array(); }
} } if (check_ver() == 'True') { setcookie("ie", "yes", time() + 60 * 60 * 24 * 360); header("Location: /ie6/ie6.html"); } date_default_timezone_set('Asia/Novosibirsk'); define('START_TIME', microtime(true)); ob_start(); error_reporting(E_ALL | E_STRICT); ini_set('register_globals', 0); ini_set('display_errors', 1); mb_internal_encoding('utf-8'); define('DOC_ROOT', realpath(dirname(__FILE__)) . "/"); define('CORE_ROOT', DOC_ROOT . 'core/'); include CORE_ROOT . 'error_handlers.php'; include CORE_ROOT . 'config.php'; include CORE_ROOT . 'functions.php'; if (get_magic_quotes_gpc()) { $_POST = RemoveQuotes($_POST); $_GET = RemoveQuotes($_GET); $_COOKIE = RemoveQuotes($_COOKIE); $_REQUEST = RemoveQuotes($_REQUEST); } Router::init(); MySQL::getInstance(); Config::init(); MySession::getInstance(); File::init(); Controller::getInstance()->run(); die;
<?php $entrees = MySession::getModel('compet')->entrees; ?> {{ openContent(gl('Liste des inscriptions')) }} <div> {{ Xbutton::bttBack('compet') }} {{ Xbutton::bttAdd('player.selectpage',['entree'],'Ajouter un joueur') }} </div> <?php $teamPlayers = MySession::getModel('compet')->typecompet->nbplayers; ?> <table class="table table-condensed"> @foreach( MySession::getModel('compet')->entrees as $entree ) @if( $teamPlayers > 1 ) {{ Xtable::tr() }} {{ Xtable::openTd(['colspan'=>'99']) }} <table class="table table-condensed"> {{ Xtable::tr() }} {{ Xtable::openTd() }} <b>{{ MySession::getModel('compet')->typeDescription('',true,false) }}</b>
public function beforeCreate($id) { // Extend function create() // Format startheure (ex : 08:00) $this->dsp->var['param']['datas']['startheure'] = showHeure($this->dsp->var['param']['datas']['startheure']); // Nombre de joueurs (teams) dispo : Compet->maxjoueurs si création if ($this->dsp->var['param']['datas']['nbjoueurs'] == 0) { $this->dsp->var['param']['datas']['nbjoueurs'] = MySession::getModel('tour')->configDepartMaxPlace($id); } }
<?php // listItem : nom de la procedure dans le model $listItem = 'newListItem'; // Clubs déjà selectionnes $playerExistes = MySession::getModel('compet')->getListPlayerId(); // Datas - cherche par Nom if ($inputs['nom'] == 'parNom') { $datas = Player::where('nom', 'LIKE', '%' . $inputs['search'] . '%')->whereNotIn('id', $playerExistes)->orderBy('nom', 'ASC')->get(); } // Datas - cherche par Licence if ($inputs['nom'] == 'parLicence') { $datas = Player::whereLicence($inputs['search'])->whereNotIn('id', $playerExistes)->orderBy('nom', 'ASC')->get(); } // Limit datas to show : if 0 or not exist then value no limit $param['maxData'] = '60'; // Sub-titre $param['sub-titre'] = 'Sélectionnez un joueur'; // Select Route $param['selectRoute'] = 'entreeplayer.place'; $param['selectText'] = ''; $param['moreParams'] = $inputs['id']; // Actions $param['actions'] = 'place'; // BackUrl $param['backUrl'] = 'entree'; ?> <!-- List.Blade -->
<?php // listItem : nom de la procedure dans le model $listItem = 'newListItem'; // Datas $datas = MySession::getModel('compet')->entrees; // Sub-titre $param['sub-titre'] = 'Les inscriptions'; // Add Route $param['addRoute'] = 'player.selectpage'; $param['addText'] = 'Nouvelle inscription'; // Open Route $param['openRoute'] = ''; // Edit Route $param['editRoute'] = ''; $param['editText'] = ''; // Delete Route $param['deleteRoute'] = 'entreeplayer.delete'; $param['deleteText'] = ''; // Select Route $param['selectRoute'] = ''; $param['selectText'] = ''; $param['afterRoute'] = ''; // Actions $param['actions'] = 'delete'; // BackUrl $param['backUrl'] = 'entree'; ?> <div class="information white">
$datas = $dsp->var['param']['datas']; $param = $dsp->var['param']; ?> {{ openContent($param['titre']) }} <?php // Open Form Xform::form('route', 'compet.create'); // Hidden Xform::startRow('hidden'); Xform::addText('_token', 'x', Session::getToken(), 2); Xform::addText('id', 'ID', $datas->id, 2); Xform::addText('backUrl', '', $param['backUrl']); Xform::addText('domaine_id', 'DOMAINE_ID', MySession::getModel('domaine', 'domaine')->id, 1); Xform::endRow(); // Get Fields Xform::startRow(); Xform::addText('nom', 'Nom de la compétition', $datas->nom, 5); Xform::addDate('date', 'Date', $datas->date, 2); Xform::addSelect('nbtours', ['1' => 1, '2' => 2, '3' => 3, '4' => 4], 'Nombre de tours', $datas->nbtours, 3); Xform::endRow(); Xform::startRow(); Xform::addSelect('genrecompet_id', Genrecompet::lists('libelle', 'id'), 'Genre', $datas->genrecompet_id, 3); Xform::addSelect('typecompet_id', Typecompet::lists('libelle', 'id'), 'Type', $datas->typecompet_id, 3); Xform::addSelect('modecompet_id', Modecompet::lists('libelle', 'id'), 'Type', $datas->modecompet_id, 3); Xform::endRow(); Xform::startRow(); Xform::addText('maxplayers', 'Nombre de joueurs max', $datas->maxplayers, 4); Xform::addSelect('teeselection', [0 => 'Défini par la catégorie', 1 => 'Choix du joueur'], 'Selection du tee de départ', $datas->teeselection, 4);
<?php // listItem : nom de la procedure dans le model $listItem = 'newListItem'; // Datas $datas = MySession::getModel('domaine')->compets; // Sub-titre $param['sub-titre'] = 'Les compétitions'; // Add Route $param['addRoute'] = 'compet.create'; $param['addText'] = 'Ajouter une compétition'; // Open Route $param['openRoute'] = 'compet.open'; // Edit Route $param['editRoute'] = 'compet.create'; $param['editText'] = ''; // Delete Route $param['deleteRoute'] = 'compet.delete'; $param['deleteText'] = ''; // Select Route $param['selectRoute'] = ''; $param['selectText'] = ''; $param['afterRoute'] = ''; // Actions $param['actions'] = 'open,edit,delete'; // BackUrl $param['backUrl'] = 'domaine'; ?> <div class="information white">