本文整理汇总了PHP中Request::post方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::post方法的具体用法?PHP Request::post怎么用?PHP Request::post使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Request
的用法示例。
在下文中一共展示了Request::post方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct(Request $request)
{
$this->name = $request->post('name');
$this->email = $request->post('email');
$this->message = $request->post('message');
$this->date = $request->post('date');
}
示例2: __construct
public function __construct(Request $_request)
{
$this->login = $_request->post('login');
$this->email = $_request->post('email');
$this->password = $_request->post('password');
$this->password_confirm = $_request->post('password_confirm');
}
示例3: addRSSStreamAction
public function addRSSStreamAction(Request $request)
{
$categoryTitle = $request->post('category');
$firstUpdate = $request->post('firstUpdate');
$url = $request->post('url_flux');
var_dump($categoryTitle);
var_dump($firstUpdate);
var_dump($url);
$this->loadModel('CategoryModel');
$this->loadModel('RssModel');
$url = $this->rssmodel->resolveFile($url);
$userId = $request->getSession()->get('id');
$rssEntity = $this->rssmodel->createStream($url, $firstUpdate);
if ($rssEntity) {
$categoryEntity = $this->categorymodel->createCategory($userId, $categoryTitle);
$streamCategoryEntity = new StreamCategoryEntity();
$streamCategoryEntity->setCategory($categoryEntity->getId());
$streamCategoryEntity->setStream($rssEntity->getId());
$streamCategoryEntity->setStreamType(ArticleModel::RSS);
$streamCategoryEntity->persist();
$this->rssmodel->streamCron($rssEntity);
$this->redirectToRoute('index');
} else {
$this->render('layouts/addStream', array('errors' => array('Une erreur est survenue dans la connexion au flux rss. Veuillez réssayer ! ')));
}
}
示例4: addTwitterStreamAction
function addTwitterStreamAction(Request $request)
{
$categoryTitle = $request->post('category');
$firstUpdate = $request->post('firstUpdate');
$channel = $request->post('channel');
$userId = $request->getSession()->get('id');
$channel = str_replace('@', '', $channel);
$this->loadModel('CategoryModel');
$this->loadModel('TwitterModel');
if (!$this->twittermodel->isValidChannel($channel)) {
$data = array('errors' => array('La chaine n\'existe pas, veuillez spécifier une chaine existante'));
$this->render('layouts/addStream', $data);
return;
}
$twitterEntity = $this->twittermodel->createStream($channel, $firstUpdate);
if ($twitterEntity) {
$categoryEntity = $this->categorymodel->createCategory($userId, $categoryTitle);
$streamCategoryEntity = new StreamCategoryEntity();
$streamCategoryEntity->setCategory($categoryEntity->getId());
$streamCategoryEntity->setStream($twitterEntity->getId());
$streamCategoryEntity->setStreamType(ArticleModel::TWITTER);
$streamCategoryEntity->persist();
$this->twittermodel->streamCron($twitterEntity);
$this->redirectToRoute('index');
} else {
$this->render('layouts/addStream', array('errors' => array('Une erreur est survenue dans la connexion au flux twitter. Veuillez réssayer ! ')));
}
}
示例5: validateRequest
public function validateRequest(Request $request, Response $response)
{
$this->request = $request;
$this->response = $response;
if (!$request->post('code')) {
throw Oauth2_Exception::factory(400, 'invalid_request', 'Missing parameter: "code" is required');
return false;
}
$code = $request->post('code');
if (!($authCode = $this->getAuthorizationCode($code))) {
throw Oauth2_Exception::factory(400, 'invalid_grant', 'Authorization code doesn\'t exist or is invalid for the client');
return false;
}
/*
* 4.1.3 - ensure that the "redirect_uri" parameter is present if the "redirect_uri" parameter was included in the initial authorization request
* @uri - http://tools.ietf.org/html/rfc6749#section-4.1.3
*/
if (isset($authCode['redirect_uri']) && $authCode['redirect_uri']) {
if (!$request->post('redirect_uri') || urldecode($request->post('redirect_uri')) != $authCode['redirect_uri']) {
throw Oauth2_Exception::factory(400, 'redirect_uri_mismatch', "The redirect URI is missing or do not match");
return false;
}
}
if ($authCode["expires"] < time()) {
throw Oauth2_Exception::factory(400, 'invalid_grant', "The authorization code has expired");
//throw new Oauth2_Exception(400, 'invalid_grant', "The authorization code has expired");
return false;
}
if (!isset($authCode['code'])) {
$authCode['code'] = $code;
// used to expire the code after the access token is granted
}
$this->authCode = $authCode;
return true;
}
示例6: __construct
public function __construct(Request $request)
{
$this->email = $request->post('email');
$this->username = $request->post('username');
$this->password = $request->post('password');
$this->passwordConfirm = $request->post('passwordConfirm');
}
示例7: __construct
public function __construct(Request $request)
{
$this->name = Session::has('user') ? Session::get('user')['user'] : $request->post('name');
$this->email = Session::has('user') ? $this->regUserData()['email'] : $request->post('email');
$this->message_subject = $request->get('message_subject');
$this->message = $request->post('message');
$this->date = $request->post('date');
$this->id_reg_user = Session::has('user') ? Session::get('user')['id'] : null;
}
示例8: updateStaticTranslation
public function updateStaticTranslation(Request $request)
{
$dbc = Connect::getConnection();
$text_en = str_replace("'", " ", $request->post('text_en'));
$text_uk = str_replace("'", " ", $request->post('text_uk'));
$text_en = $request->post('text_en');
$text_uk = $request->post('text_uk');
$placeholders = array('key' => $request->post('key'), 'text_en' => $text_en, 'text_uk' => $text_uk);
Debugger::PrintR($placeholders);
$sql = "UPDATE `static_translation` SET `text_en`= :text_en,`text_uk`= :text_uk WHERE `key`= :key";
$sth = $dbc->getPDO()->prepare($sql);
$sth->execute($placeholders);
}
示例9: __construct
public function __construct(Request $request)
{
for ($i = 1; $i <= Config::get('basic_page_in_block'); $i++) {
$id = $request->post("id_{$i}");
if ($id) {
$this->id_array[$i] = $id;
}
$delete = $request->post("delete_{$i}");
if (isset($delete)) {
$this->delete_array[$i] = $delete;
}
}
}
示例10: __construct
public function __construct(Request $request, $material_type)
{
$this->title = $request->post('title');
$this->menu_name = $request->post('menu_name');
$this->menu_data = $request->post('menu');
$this->without_menu = $request->post('without_menu');
$this->publication = $request->post('publication');
$this->title_or_menu_name = $this->menu_name ? $this->menu_name : $this->title;
$alias_data = $this->createAlias($this->title_or_menu_name, $this->menu_data);
$this->new_alias = $alias_data['new_alias'];
$this->date = $request->post('date');
$this->translit = $alias_data['translit'];
$this->id_parent = $alias_data['id_parent'];
$this->material_type = $material_type;
$img_name_local = $request->files('name');
$this->img_name_local = isset($img_name_local) ? $img_name_local : '';
$img_name_server = $request->post('file_server');
$this->img_name_server = isset($img_name_server) ? $img_name_server : '';
if ($this->img_name_server && $this->img_name_local) {
$this->img_name = $this->img_name_local;
}
if ($this->img_name_server) {
$this->img_name = $this->img_name_server;
}
if ($this->img_name_local) {
$this->img_name = $this->img_name_local;
}
if (!$this->img_name_server && !$this->img_name_local) {
$this->img_name = Config::get('default_img');
}
// $name = $request->files('name');
$this->img = isset($this->img_name) ? "Webroot/uploads/images/{$this->img_name}" : "Webroot/uploads/images/" . Config::get('default_img');
$fields_model = new FieldsModel($material_type);
$fields = $fields_model->getFields();
$additional_fields_list = array();
$additional_fields_value = '';
$additional_fields_key_value = '';
$additional_fields_value_arr = array();
foreach ($fields as $v) {
if ($v != 'id' && $v != 'alias' && $v != 'id_' . $material_type . '' && $v != 'title') {
$additional_fields_list[] = $v;
$additional_fields_value .= ", '" . $request->post($v) . "'";
$additional_fields_value_arr[$v] = $request->post($v);
$additional_fields_key_value .= ", `" . $v . "` = '" . $request->post($v) . "'";
}
}
$this->additional_fields_arr = $additional_fields_list;
$this->additional_fields_value = $additional_fields_value;
$this->additional_fields_value_arr = $additional_fields_value_arr;
$this->additional_fields_key_value = $additional_fields_key_value;
}
示例11: table_num_setup
/**
* @function
* @public
* @static
* @returns NONE
* @desc
* @param {string} foo Use the 'foo' param for bar.
* @example NONE
*/
public static function table_num_setup()
{
$tbl_no = Request::post('input_text_field');
// if all of the characters are not numbers, return false
if (!ctype_digit($tbl_no)) {
return false;
}
$database = DatabaseFactory::getFactory()->getConnection();
$query = $database->prepare("SELECT * FROM qscDeviceTables.tblDevices WHERE number = :table_number_input");
$query->execute(array(':table_number_input' => $tbl_no));
if ($query->rowCount() == 0) {
$n = intval($tbl_no);
if ($n < 0) {
return false;
}
Session::set('table_number', $n);
// apc_store('table_number', $n);
/**
$m = session_id();
$database->query("INSERT INTO qscDeviceTables.tblDevices (id, number) VALUES (".$m.", ".$n.")";
*/
$database->query("INSERT INTO qscDeviceTables.tblDevices (number) VALUES (" . $n . ")");
return true;
} else {
// failure, table number exists!
// $exists_already = apc_fetch('table_number');
// if ($exists_already) {
// Session::set('table_number');
// return true;
// }
return false;
}
}
示例12: IndexAction
public function IndexAction()
{
if (!Request::isPosted('email')) {
$this->Render();
} else {
$email = Request::post('email', '', 'mail');
$pass1 = Request::post('pass1', '', 'safe');
$pass2 = Request::post('pass2', '', 'safe');
if ($email == '') {
Site::Message('Вы не указали Ваш e-mail, или такого адреса не существует');
$this->Render();
} elseif (UserModel::isExists($email, 'login')) {
Site::Message('Похоже пользователь с таким почтовым ящиком уже существует.<br>Возможно Вы регистрировались раньше, если вы забыли пароль, Вы можете восстановить его.');
$this->Render();
} elseif ($pass1 == '') {
Site::Message('Вы забыли придумать пароль');
$this->Render();
} elseif (strlen($pass1) < 6) {
Site::Message('Пароль короче 6-ти символов =(');
$this->Render();
} elseif ($pass1 != $pass2) {
Site::Message('Введенные Вами пароли не совпадают, где-то ошиблись, попробуйте ещё раз');
$this->Render();
} else {
UserModel::Registration($email, $pass1);
User::LoginByPass($email, $pass1);
Site::Message('Ваш профиль успешно создан!');
$this->Route('newcompany');
}
}
}
示例13: init
public function init()
{
$this->session = new Session();
$this->get = Request::get();
$this->post = Request::post();
$this->views = new Views(new Template("admin"));
}
示例14: listAction
/**
* Get object history
*/
public function listAction()
{
$object = Request::post('object', 'string', false);
if (!$object) {
Response::jsonSuccess(array());
}
$pager = Request::post('pager', 'array', array());
$filter = Request::post('filter', 'array', array());
if (!isset($filter['record_id']) || empty($filter['record_id'])) {
Response::jsonSuccess(array());
}
try {
$o = new Db_Object($object);
} catch (Exception $e) {
Response::jsonSuccess(array());
}
$filter['table_name'] = $o->getTable();
$history = Model::factory('Historylog');
$data = $history->getListVc($pager, $filter, false, array('date', 'type', 'id'), 'user_name');
if (!empty($data)) {
foreach ($data as $k => &$v) {
if (isset(Model_Historylog::$actions[$v['type']])) {
$v['type'] = Model_Historylog::$actions[$v['type']];
}
}
unset($v);
}
Response::jsonSuccess($data, array('count' => $history->getCount($filter)));
}
示例15: CreateNewAccount
public static function CreateNewAccount()
{
// validate input
if (!self::validateUserName(Request::post('new_account_name'))) {
return false;
}
if (!self::validateUserPassword(Request::post('new_account_password'), Request::post('new_account_password_repeat'))) {
return false;
}
// connect to database
$db = Database::getFactory()->getConnection();
if (!$db) {
Session::add('feedback_negative', 'Critical error. Can\'t connect to database.');
return false;
}
// get a password hash
$passwordHash = password_hash(Request::post('new_account_password'), PASSWORD_DEFAULT);
// write new users data into database
$sql = "INSERT INTO users ( user_id, user_name, user_password, user_registration_time)\n VALUES (:user_id, :user_name, :user_password, :user_registration_time)";
$query = $db->prepare($sql);
$query->execute(array(':user_id' => null, ':user_name' => Request::post('new_account_name'), ':user_password' => $passwordHash, ':user_registration_time' => time('c')));
$count = $query->rowCount();
if ($count == 1) {
Session::add('feedback_positive', 'New account created successfully.');
return true;
}
// if it gets to this point, something went wrong
Session::add('feedback_negative', 'Something went wrong.');
return false;
}