当前位置: 首页>>代码示例>>PHP>>正文


PHP Utils::post方法代码示例

本文整理汇总了PHP中Utils::post方法的典型用法代码示例。如果您正苦于以下问题:PHP Utils::post方法的具体用法?PHP Utils::post怎么用?PHP Utils::post使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Utils的用法示例。


在下文中一共展示了Utils::post方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getContent

 public function getContent()
 {
     if (LoggedUser::whoIsLogged()) {
         if (isset($_COOKIE['ref_url'])) {
             $url = $_COOKIE['ref_url'];
             $absolute = FALSE;
         } else {
             $page = PageActionMap::getPageByTypeAndLanguage('rooms');
             $url = PageActionMap::createUrl($page['alias']);
             $absolute = TRUE;
         }
         Utils::redirect($url, $absolute);
     }
     if (Utils::post('login')) {
         MySmarty::assign('username', Utils::post('username'));
         $validation = LoggedUser::userLogin();
         //var_Dump($validation);exit();
         if ($validation === TRUE) {
             Utils::redirect(Utils::getActualUrlWithoutGetParameters(), FALSE);
         } else {
             MySmarty::assign('errors', $validation);
         }
     }
     return MySmarty::fetch('login.tpl');
 }
开发者ID:Tomeno,项目名称:lulcobang,代码行数:25,代码来源:LoginAction.php

示例2: userLogin

 /**
  * log the user - if not exists register him/her and then log the user
  *
  * @return	void
  */
 public static function userLogin()
 {
     $errors = array();
     $hash = addslashes(Utils::get('hash'));
     if ($hash) {
         $userRepository = new UserRepository();
         $user = $userRepository->getOneByHash($hash);
     } else {
         if (Utils::post('username') != '') {
             $username = addslashes(Utils::post('username'));
             if (!ctype_alnum($username)) {
                 $errors['username'] = 'V používateľskom mene môžeš použiť len alfanumerické znaky';
                 // TODO localize
             }
         } else {
             $errors['username'] = 'Musíš vyplniť používateľské meno';
             // TODO localize
         }
         if (Utils::post('password') != '') {
             $password = md5(addslashes(Utils::post('password')));
         } else {
             $errors['password'] = 'Musíš vyplniť heslo';
             // TODO localize
         }
         if (empty($errors)) {
             $userRepository = new UserRepository();
             $userExist = $userRepository->getOneByUsername($username);
             if ($userExist === NULL) {
                 $colorRepository = new ColorRepository();
                 $count = $colorRepository->getCountAll();
                 $rand = rand(1, $count);
                 $params = array('username' => $username, 'password' => $password, 'color' => $rand);
                 $user = new User($params);
                 $user = $user->save(TRUE);
             } elseif ($userExist['password'] != $password) {
                 $errors['password'] = 'Nesprávne heslo';
             } else {
                 $user = $userExist;
             }
         }
     }
     if ($user && empty($errors)) {
         // TODO po prihlaseni treba nejako zmazat v memcachi query, ktora vybera usera podla cookie_value
         // lebo teraz to stale vracia vysledok z memcache -> ked sa prihlasim v dvoch browsroch, v obidvoch to funguje
         // neodhlasi ma z toho prveho
         $cookieValue = md5(time() . $user['id'] . $user['username']);
         DB::update(DB_PREFIX . 'user', array('cookie_value' => $cookieValue), 'id = ' . $user['id']);
         $expire = Utils::post('remember') == 1 ? strtotime('+1 year') : 0;
         setcookie(self::$cookieName, $cookieValue, $expire, '/');
         return TRUE;
     } else {
         return $errors;
     }
 }
开发者ID:Tomeno,项目名称:lulcobang,代码行数:59,代码来源:LoggedUser.php

示例3: setup

 protected function setup()
 {
     $loggedUser = LoggedUser::whoIsLogged();
     if (Utils::post('change_settings')) {
         // TODO check if password and confirm password match
         $loggedUser['password'] = md5(Utils::post('password'));
         $loggedUser['name'] = Utils::post('name');
         $loggedUser['surname'] = Utils::post('surname');
         $loggedUser['color'] = intval(Utils::post('color'));
         $loggedUser->save();
     }
     MySmarty::assign('loggedUser', $loggedUser);
     $colorRepository = new ColorRepository();
     $colors = $colorRepository->getAll();
     MySmarty::assign('colors', $colors);
 }
开发者ID:Tomeno,项目名称:lulcobang,代码行数:16,代码来源:SettingsBox.php

示例4: setup

 protected function setup()
 {
     $loggedUser = LoggedUser::whoIsLogged();
     if (Utils::post('create_room') && $loggedUser['admin']) {
         $params = array('title' => Utils::post('title'), 'alias' => Utils::createAlias(Utils::post('title'), 'room'), 'description' => Utils::post('description'));
         $room = new Room($params);
         $room->save();
     }
     $roomRepository = new RoomRepository();
     $rooms = $roomRepository->getAll();
     $gameRepository = new GameRepository();
     $games = $gameRepository->getGamesByRooms(array_keys($rooms));
     foreach ($games as $game) {
         $rooms[$game['room']]['game'] = TRUE;
         $rooms[$game['room']]['status'] = Localize::getMessage('room_status_' . $game['status']);
     }
     MySmarty::assign('loggedUser', $loggedUser);
     MySmarty::assign('rooms', $rooms);
 }
开发者ID:Tomeno,项目名称:lulcobang,代码行数:19,代码来源:RoomListingBox.php

示例5: main

 public function main()
 {
     $gameId = intval(Utils::post('game'));
     $roomId = intval(Utils::post('room'));
     $gameRepository = new GameRepository();
     // $gameRepository->addAdditionalWhere(array('column' => 'status', 'value' => Game::GAME_STATUS_ENDED, 'xxx' => '!='));
     $gameRepository->addOrderBy(array('id' => 'DESC'));
     $game = $gameRepository->getOneByRoom($roomId);
     //		if ($gameId) {
     //			$game = $gameRepository->getOneById($gameId);
     //		} else {
     //
     //		}
     $roomRepository = new RoomRepository();
     $room = $roomRepository->getOneById($roomId);
     $gameBox = new GameBox();
     $gameBox->setRoom($room);
     if ($game) {
         $gameBox->setGame($game);
     }
     echo $gameBox->render();
 }
开发者ID:Tomeno,项目名称:lulcobang,代码行数:22,代码来源:RefreshGame.php

示例6: catch

                $type = 'recette';
            }
            Utils::redirect('/admin/compta/operations/saisir.php?' . $type . '&ok=' . (int) $id);
        } catch (UserException $e) {
            $error = $e->getMessage();
        }
    }
}
$tpl->assign('error', $error);
$tpl->assign('type', $type);
if ($type === null) {
    $tpl->assign('comptes', $comptes->listTree());
} else {
    $tpl->assign('moyens_paiement', $cats->listMoyensPaiement());
    $tpl->assign('moyen_paiement', Utils::post('moyen_paiement') ?: 'ES');
    $tpl->assign('categories', $cats->getList($type === 'dette' ? Compta\Categories::DEPENSES : $type));
    $tpl->assign('comptes_bancaires', $banques->getList());
    $tpl->assign('banque', Utils::post('banque'));
}
if (!$membres->sessionGet('compta_date')) {
    $exercices = new Compta\Exercices();
    $exercice = $exercices->getCurrent();
    if ($exercice['debut'] > time() || $exercice['fin'] < time()) {
        $membres->sessionStore('compta_date', date('Y-m-d', $exercice['debut']));
    } else {
        $membres->sessionStore('compta_date', date('Y-m-d'));
    }
}
$tpl->assign('date', $membres->sessionGet('compta_date') ?: false);
$tpl->assign('ok', (int) Utils::get('ok'));
$tpl->display('admin/compta/operations/saisir.tpl');
开发者ID:kd2org,项目名称:garradin,代码行数:31,代码来源:saisir.php

示例7: main

 public function main()
 {
     $gameId = intval(Utils::post('game'));
     $gameRepository = new GameRepository();
     $game = $gameRepository->getOneById($gameId);
     $commandParams = array();
     $commandParams['command'] = addslashes(Utils::post('command'));
     $commandParams['useCharacter'] = intval(Utils::post('useCharacter'));
     $commandParams['playCardId'] = intval(Utils::post('playCard'));
     if ($commandParams['playCardId']) {
         $cardRepository = new CardRepository(TRUE);
         $card = $cardRepository->getOneById($commandParams['playCardId']);
         $commandParams['playCardName'] = str_replace('-', '', $card->getItemAlias());
     }
     // TODO mozno ich niekedy bude viac
     $commandParams['additionalCardsId'] = intval(Utils::post('additionalCard'));
     if ($commandParams['additionalCardsId']) {
         $cardRepository = new CardRepository(TRUE);
         $card = $cardRepository->getOneById($commandParams['additionalCardsId']);
         $commandParams['additionalCardsName'] = str_replace('-', '', $card->getItemAlias());
     }
     $commandParams['enemyPlayerId'] = intval(Utils::post('player'));
     if ($commandParams['enemyPlayerId']) {
         $playerRepository = new PlayerRepository();
         $player = $playerRepository->getOneById($commandParams['enemyPlayerId']);
         if ($player) {
             $user = $player->getUser();
             if ($user) {
                 $commandParams['enemyPlayerUsername'] = $user['username'];
             }
         }
     }
     if ($commandParams['command'] == 'fanning') {
         $commandParams['additionalEnemyPlayerId'] = intval(Utils::post('additionalPlayer'));
         if ($commandParams['additionalEnemyPlayerId']) {
             $playerRepository = new PlayerRepository();
             $player = $playerRepository->getOneById($commandParams['additionalEnemyPlayerId']);
             if ($player) {
                 $user = $player->getUser();
                 if ($user) {
                     $commandParams['additionalEnemyPlayerUsername'] = $user['username'];
                 }
             }
         }
     }
     // TODO brawl tu dava addslashes
     if ($commandParams['command'] == 'brawl') {
         $commandParams['enemyCardsId'] = addslashes(Utils::post('card'));
     } elseif ($commandParams['command'] == 'choose_cards') {
         $commandParams['selectedCards'] = addslashes(Utils::post('card'));
     } else {
         $commandParams['enemyCardsId'] = intval(Utils::post('card'));
         if ($commandParams['enemyCardsId']) {
             $cardRepository = new CardRepository(TRUE);
             $card = $cardRepository->getOneById($commandParams['enemyCardsId']);
             $commandParams['enemyCardsName'] = str_replace('-', '', $card->getItemAlias());
         }
     }
     $commandParams['place'] = addslashes(Utils::post('place'));
     if (Utils::post('peyoteColor')) {
         $commandParams['peyoteColor'] = addslashes(Utils::post('peyoteColor'));
     }
     if (Utils::post('text')) {
         $commandParams['text'] = addslashes(Utils::post('text'));
     }
     $params = array();
     foreach ($commandParams as $key => $value) {
         $params[] = $key . '=' . $value;
     }
     $commandString = implode('&', $params);
     Log::command($commandString);
     Command::setup($commandString, $game);
 }
开发者ID:Tomeno,项目名称:lulcobang,代码行数:73,代码来源:ExecuteCommand.php

示例8: catch

    if (!Utils::CSRF_check('config')) {
        $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
    } else {
        try {
            $config->set('nom_asso', Utils::post('nom_asso'));
            $config->set('email_asso', Utils::post('email_asso'));
            $config->set('adresse_asso', Utils::post('adresse_asso'));
            $config->set('site_asso', Utils::post('site_asso'));
            $config->set('email_envoi_automatique', Utils::post('email_envoi_automatique'));
            $config->set('accueil_wiki', Utils::post('accueil_wiki'));
            $config->set('accueil_connexion', Utils::post('accueil_connexion'));
            $config->set('categorie_membres', Utils::post('categorie_membres'));
            $config->set('champ_identite', Utils::post('champ_identite'));
            $config->set('champ_identifiant', Utils::post('champ_identifiant'));
            $config->set('pays', Utils::post('pays'));
            $config->set('monnaie', Utils::post('monnaie'));
            $config->save();
            Utils::redirect('/admin/config/?ok');
        } catch (UserException $e) {
            $error = $e->getMessage();
        }
    }
}
$tpl->assign('error', $error);
$tpl->assign('garradin_version', garradin_version() . ' [' . (garradin_manifest() ?: 'release') . ']');
$tpl->assign('php_version', phpversion());
$v = \SQLite3::version();
$tpl->assign('sqlite_version', $v['versionString']);
$tpl->assign('pays', Utils::getCountryList());
$cats = new Membres\Categories();
$tpl->assign('membres_cats', $cats->listSimple());
开发者ID:kd2org,项目名称:garradin,代码行数:31,代码来源:index.php

示例9: UserException

<?php

namespace Garradin;

require_once __DIR__ . '/../_inc.php';
if ($user['droits']['compta'] < Membres::DROIT_ADMIN) {
    throw new UserException("Vous n'avez pas le droit d'accéder à cette page.");
}
$banque = new Compta\Comptes_Bancaires();
$compte = $banque->get(Utils::get('id'));
if (!$compte) {
    throw new UserException('Le compte demandé n\'existe pas.');
}
$error = false;
if (!empty($_POST['save'])) {
    if (!Utils::CSRF_check('compta_edit_banque_' . $compte['id'])) {
        $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
    } else {
        try {
            $id = $banque->edit($compte['id'], ['libelle' => Utils::post('libelle'), 'banque' => Utils::post('banque'), 'iban' => Utils::post('iban'), 'bic' => Utils::post('bic')]);
            Utils::redirect('/admin/compta/banques/');
        } catch (UserException $e) {
            $error = $e->getMessage();
        }
    }
}
$tpl->assign('error', $error);
$tpl->assign('compte', $compte);
$tpl->display('admin/compta/banques/modifier.tpl');
开发者ID:kd2org,项目名称:garradin,代码行数:29,代码来源:modifier.php

示例10: UserException

$rappel = $rappels->get(Utils::get('id'));
if (!$rappel) {
    throw new UserException("Ce rappel n'existe pas.");
}
$cotisations = new Cotisations();
$error = false;
if (!empty($_POST['save'])) {
    if (!Utils::CSRF_check('edit_rappel_' . $rappel['id'])) {
        $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
    } else {
        try {
            if (Utils::post('delai_choix') == 0) {
                $delai = 0;
            } elseif (Utils::post('delai_choix') > 0) {
                $delai = (int) Utils::post('delai_post');
            } else {
                $delai = -(int) Utils::post('delai_pre');
            }
            $rappels->edit($rappel['id'], ['sujet' => Utils::post('sujet'), 'texte' => Utils::post('texte'), 'delai' => $delai, 'id_cotisation' => Utils::post('id_cotisation')]);
            Utils::redirect('/admin/membres/cotisations/gestion/rappels.php');
        } catch (UserException $e) {
            $error = $e->getMessage();
        }
    }
}
$tpl->assign('error', $error);
$rappel['delai_pre'] = $rappel['delai_post'] = abs($rappel['delai']) ?: 30;
$rappel['delai_choix'] = $rappel['delai'] == 0 ? 0 : ($rappel['delai'] > 0 ? 1 : -1);
$tpl->assign('rappel', $rappel);
$tpl->assign('cotisations', $cotisations->listCurrent());
$tpl->display('admin/membres/cotisations/gestion/rappel_modifier.tpl');
开发者ID:kd2org,项目名称:garradin,代码行数:31,代码来源:rappel_modifier.php

示例11: elseif

namespace Garradin;

const LOGIN_PROCESS = true;
require_once __DIR__ . '/_inc.php';
$error = false;
if (trim(Utils::get('c'))) {
    if ($membres->recoverPasswordConfirm(Utils::get('c'))) {
        Utils::redirect('/admin/password.php?new_sent');
    }
    $error = 'EXPIRED';
} elseif (!empty($_POST['recover'])) {
    if (!Utils::CSRF_check('recoverPassword')) {
        $error = 'OTHER';
    } else {
        if (trim(Utils::post('id')) && $membres->recoverPasswordCheck(Utils::post('id'))) {
            Utils::redirect('/admin/password.php?sent');
        }
        $error = 'MAIL';
    }
}
if (!$error && isset($_GET['sent'])) {
    $tpl->assign('sent', true);
} elseif (!$error && isset($_GET['new_sent'])) {
    $tpl->assign('new_sent', true);
}
$champs = $config->get('champs_membres');
$champ = $champs->get($config->get('champ_identifiant'));
$tpl->assign('champ', $champ);
$tpl->assign('error', $error);
$tpl->display('admin/password.tpl');
开发者ID:kd2org,项目名称:garradin,代码行数:30,代码来源:password.php

示例12: UserException

namespace Garradin;

require_once __DIR__ . '/../_inc.php';
if ($user['droits']['compta'] < Membres::DROIT_ADMIN) {
    throw new UserException("Vous n'avez pas le droit d'accéder à cette page.");
}
$cats = new Compta\Categories();
$error = false;
if (!empty($_POST['add'])) {
    if (!Utils::CSRF_check('compta_ajout_cat')) {
        $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
    } else {
        try {
            $id = $cats->add(['intitule' => Utils::post('intitule'), 'description' => Utils::post('description'), 'compte' => Utils::post('compte'), 'type' => Utils::post('type')]);
            if (Utils::post('type') == Compta\Categories::DEPENSES) {
                $type = 'depenses';
            } elseif (Utils::post('type') == Compta\Categories::AUTRES) {
                $type = 'autres';
            } else {
                $type = 'recettes';
            }
            Utils::redirect('/admin/compta/categories/?' . $type);
        } catch (UserException $e) {
            $error = $e->getMessage();
        }
    }
}
$tpl->assign('error', $error);
$tpl->assign('type', isset($_POST['type']) ? Utils::post('type') : Compta\Categories::RECETTES);
$tpl->assign('comptes', $comptes->listTree());
$tpl->display('admin/compta/categories/ajouter.tpl');
开发者ID:kd2org,项目名称:garradin,代码行数:31,代码来源:ajouter.php

示例13: setup

 protected function setup()
 {
     $roomAlias = Utils::get('identifier');
     $roomRepository = new RoomRepository();
     $room = $roomRepository->getOneByAlias($roomAlias);
     $loggedUser = LoggedUser::whoIsLogged();
     if ($room) {
         $gameRepository = new GameRepository();
         // $gameRepository->addAdditionalWhere(array('column' => 'status', 'value' => Game::GAME_STATUS_ENDED, 'xxx' => '!='));
         $gameRepository->addOrderBy(array('id' => 'DESC'));
         $game = $gameRepository->getOneByRoom($room['id']);
         if (Utils::post()) {
             $message = addslashes(trim(Utils::post('message')));
             if ($message != '') {
                 if (strpos($message, '.') === 0) {
                     $response = Command::setup('command=' . substr($message, 1), $game);
                 } else {
                     $response = Command::setup('command=say&text=' . $message . '&room=' . $room['id'] . '&game=' . $game['id'], $game);
                 }
                 Room::updateUserLastActivity($loggedUser['id'], $room['id']);
             } elseif (Utils::post('create')) {
                 $response = Command::setup('command=create', $game);
             } elseif (Utils::post('join')) {
                 $response = Command::setup('command=join', $game);
             } elseif (Utils::post('add_ai_player')) {
                 $response = Command::setup('command=add_ai_player', $game);
             } elseif (Utils::post('start')) {
                 $response = Command::setup('command=init', $game);
             } elseif (Utils::post('choose_character')) {
                 $response = Command::setup('command=choose_character&selectedCharacter=' . Utils::post('character'), $game);
             } elseif (Utils::post('choose_cards')) {
                 $commandParams = array();
                 $commandParams['command'] = 'choose_cards';
                 $commandParams['selectedCards'] = array();
                 if (Utils::post('card')) {
                     $commandParams['selectedCards'] = implode(',', Utils::post('card'));
                 }
                 $params = array();
                 foreach ($commandParams as $key => $value) {
                     $params[] = $key . '=' . $value;
                 }
                 $commandString = implode('&', $params);
                 $response = Command::setup($commandString, $game);
             }
             Utils::redirect(Utils::getActualUrl(), FALSE);
             // TODO tu by sa mohol spravit redirect asi lebo respons bude v db
             MySmarty::assign('response', $response);
         }
         $gameBox = new GameBox();
         $gameBox->setRoom($room);
         if ($game !== NULL) {
             $gameBox->setGame($game);
         }
         MySmarty::assign('gameBox', $gameBox->render());
         $chatBox = new ChatBox();
         $chatBox->setRoom($room);
         if ($game !== NULL) {
             $chatBox->setGame($game);
         }
         MySmarty::assign('chatBox', $chatBox->render());
     } else {
         // TODO 404 room not found
     }
 }
开发者ID:Tomeno,项目名称:lulcobang,代码行数:64,代码来源:RoomDetailBox.php

示例14: UserException

<?php

namespace Garradin;

require_once __DIR__ . '/../_inc.php';
if ($user['droits']['membres'] < Membres::DROIT_ADMIN) {
    throw new UserException("Vous n'avez pas le droit d'accéder à cette page.");
}
$membre = $membres->get(Utils::get('id'));
if (!$membre) {
    throw new UserException("Ce membre n'existe pas.");
}
$error = false;
if (Utils::post('delete')) {
    if (!Utils::CSRF_check('delete_membre_' . $membre['id'])) {
        $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
    } else {
        try {
            $membres->delete($membre['id']);
            Utils::redirect('/admin/membres/');
        } catch (UserException $e) {
            $error = $e->getMessage();
        }
    }
}
$tpl->assign('membre', $membre);
$tpl->assign('error', $error);
$tpl->display('admin/membres/supprimer.tpl');
开发者ID:kd2org,项目名称:garradin,代码行数:28,代码来源:supprimer.php

示例15: date

        }
    }
}
if (!$debut || !$fin) {
    $date = $exercice['fin'];
    $debut = date('Y-m-01', $date);
    $fin = date('Y-m-t', $date);
}
$journal = $rapprochement->getJournal($compte['id'], $debut, $fin, $solde_initial, $solde_final);
// Enregistrement des cases cochées
if (Utils::post('save')) {
    if (!Utils::CSRF_check('compta_rapprocher_' . $compte['id'])) {
        $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
    } else {
        try {
            $rapprochement->record($compte['id'], $journal, Utils::post('rapprocher'), $user['id']);
            Utils::redirect(Utils::getSelfURL());
        } catch (UserException $e) {
            $error = $e->getMessage();
        }
    }
}
if (substr($debut, 0, 7) == substr($fin, 0, 7)) {
    $tpl->assign('prev', Utils::modifyDate($debut, '-1 month', true));
    $tpl->assign('next', Utils::modifyDate($fin, '+1 month', true));
}
$tpl->assign('compte', $compte);
$tpl->assign('debut', $debut);
$tpl->assign('fin', $fin);
$tpl->assign('journal', $journal);
$tpl->assign('solde_initial', $solde_initial);
开发者ID:kd2org,项目名称:garradin,代码行数:31,代码来源:rapprocher.php


注:本文中的Utils::post方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。