本文整理汇总了PHP中HTTPRequest::postExists方法的典型用法代码示例。如果您正苦于以下问题:PHP HTTPRequest::postExists方法的具体用法?PHP HTTPRequest::postExists怎么用?PHP HTTPRequest::postExists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTTPRequest
的用法示例。
在下文中一共展示了HTTPRequest::postExists方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeLeave
public function executeLeave(HTTPRequest $request)
{
$this->authenticationRedirection();
if (!$request->getExists('feedbackRequestId')) {
$this->app->httpResponse()->redirect404();
exit;
}
$feedbackRequestId = htmlspecialchars($request->getData('feedbackRequestId'));
$feedbackRequest = $this->_feedbackRequestsManager->get($feedbackRequestId);
if (is_null($feedbackRequest)) {
$this->app->httpResponse()->redirect404();
exit;
}
if ($request->postExists('submit-form')) {
$feedback = new Feedback();
$feedback->setAnnounceId($feedbackRequest->getAnnounceId());
$feedback->setUserAuthorId($feedbackRequest->getUserAuthorId());
$feedback->setUserOwnerId($feedbackRequest->getUserOwnerId());
$feedback->setUserSubscriberId($feedbackRequest->getUserSubscriberId());
$feedback->setReservationId($feedbackRequest->getReservationId());
$mark = htmlspecialchars($request->postData('mark'));
$comment = htmlspecialchars($request->postData('comment'));
$feedback->setMark($mark);
$feedback->setComment($comment);
$this->_feedbacksManager->save($feedback);
$this->_feedbackRequestsManager->delete($feedbackRequest->id());
$this->app->user()->setFlash('feedback-saved');
$this->app->httpResponse()->redirect('/feedback');
exit;
}
$this->page->smarty()->assign('feedbackRequest', $feedbackRequest);
}
示例2: executeIndex
public function executeIndex(HTTPRequest $request)
{
$announceFilter = new AnnounceFilter();
if ($request->postExists('search')) {
$this->parseSearch($request, $announceFilter);
$url = '/search/page=' . '0' . '/region=' . $announceFilter->getRegionId() . '/department=' . $announceFilter->getDepartmentId() . '/category=' . $announceFilter->getCategoryId() . '/subcategory=' . $announceFilter->getSubCategoryId() . '/zipcode=' . $announceFilter->getZipCode() . '/community=' . $announceFilter->getInCommunity() . '/filter=' . $announceFilter->getFilterText();
$this->app->httpResponse()->redirect($url);
exit;
}
$categories = $this->_categoriesManager->getListOf();
$regions = $this->_regionsManager->getListOf();
$departments = $this->_departmentsManager->getListOf();
$this->assignFilter($request, $announceFilter);
$announcements = $this->_filterManager->getAnnouncement($announceFilter);
$announcementsPro = $this->_filterManager->getAnnouncementPro($announceFilter);
$this->page->smarty()->assign('announcements', $announcements);
$this->page->smarty()->assign('announcementsPro', $announcementsPro);
$this->page->smarty()->assign('profilesManager', $this->_profilesManager);
$this->page->smarty()->assign('profilesProManager', $this->_profilesProManager);
$this->page->smarty()->assign('usersManager', $this->_usersManager);
$this->page->smarty()->assign('categoriesManager', $this->_categoriesManager);
$this->page->smarty()->assign('regionsManager', $this->_regionsManager);
$this->page->smarty()->assign('departmentsManager', $this->_departmentsManager);
$this->page->smarty()->assign('categories', $categories);
$this->page->smarty()->assign('regions', $regions);
$this->page->smarty()->assign('departments', $departments);
}
示例3: parseForm
private function parseForm(HTTPRequest $request, Category $category)
{
$name = htmlspecialchars($request->postData('name'));
$description = htmlspecialchars($request->postData('description'));
$isRoot = !$request->postExists('parent-category');
$category->setName($name);
$category->setIsRoot($isRoot);
$category->setDescription($description);
if (!$isRoot) {
$parentCategoryId = $request->postData('parent-category');
$category->setParentCategoryId($parentCategoryId);
}
}
示例4: executeRefuse
public function executeRefuse(HTTPRequest $request)
{
$announce = $this->_announcementsManager->get($request->getData('announceId'));
$this->page->smarty()->assign('announce', $announce);
if ($request->postExists('confirm')) {
$announce->setStateId(AnnouncementStates::STATE_REFUSED);
$announce->setAdminComment(htmlspecialchars($request->postData('admin-comment')));
$this->_announcementsManager->save($announce);
$this->app->user()->setFlash('announce-refused');
//TODO : Envoyer un mail à l'utilistateur
$this->app->httpResponse()->redirect('/admin/announcements');
exit;
}
}
示例5: executePublish
public function executePublish(HTTPRequest $request)
{
$opinionId = $request->getData('opinionId');
$opinion = $this->_opinionsManager->get($opinionId);
if ($request->postExists('submit-form')) {
$opinion->setIsPublished(true);
$this->_opinionsManager->save($opinion);
$this->app->user()->setFlash('opinion-published');
$this->app->httpResponse()->redirect('/admin/opinion');
exit;
}
$this->page->smarty()->assign('opinion', $opinion);
$this->page->smarty()->assign('opinionsManager', $this->_opinionsManager);
$this->page->smarty()->assign('usersManager', $this->_usersManager);
}
示例6: executeDeleteFeedback
public function executeDeleteFeedback(HTTPRequest $request)
{
$feedbackId = htmlspecialchars($request->getData('feedbackId'));
$feedback = $this->_feedbacksManager->get($feedbackId);
if ($request->postExists('submit-form')) {
$this->_moderatesManager->deleteByFeedbackId($feedbackId);
$this->_feedbacksManager->delete($feedbackId);
$this->app->user()->setFlash('feedback-deleted');
$this->app->httpResponse()->redirect('/admin/moderate');
exit;
}
$this->page->smarty()->assign('feedback', $feedback);
$this->page->smarty()->assign('feedbacksManager', $this->_feedbacksManager);
$this->page->smarty()->assign('profilesManager', $this->_profilesManager);
$this->page->smarty()->assign('usersManager', $this->_usersManager);
}
示例7: executeIndex
public function executeIndex(HTTPRequest $request)
{
$this->init();
if ($request->postExists('connect')) {
$login = htmlspecialchars($request->postData('login'));
$password = htmlspecialchars($request->postData('password'));
$this->_user = $this->_userManager->authenticate($login, $password);
if (!is_null($this->_user) && $this->_user->getRoleId() >= Role::ROLE_ADMINISTRATEUR && $this->_user->getIsActive()) {
$this->app->user()->setAdminAuthenticated(true);
$this->app->user()->setAttribute('admin-id', $this->_user->id());
$this->authenticationRedirection();
} else {
$message = MessageBox::Error('L\'authentification a échoué !');
$this->page->smarty()->assign('connexionMessage', $message);
}
}
}
示例8: executeFeedback
public function executeFeedback(HTTPRequest $request)
{
$feedback = $this->_feedbacksManager->get(htmlspecialchars($request->getData('feedbackId')));
if ($request->postExists('submit-form')) {
$moderate = new Moderate();
$moderate->setType(Moderate::TYPE_FEEDBACK);
$moderate->setTypeId(htmlspecialchars($request->postData('feedback-id')));
$moderate->setUserAuthorId(htmlspecialchars($request->postData('user-id')));
$moderate->setMessage(htmlspecialchars($request->postData('message')));
$this->_moderatesManager->save($moderate);
//Envoyer un mail ici
$messageMail = new Mail();
$messageMail->sendModerationRequest();
$this->page->smarty()->assign('messageSent', true);
$this->app->user()->setFlash('message-sent');
$this->displayInfoMessage();
}
$this->page->smarty()->assign('feedback', $feedback);
$this->page->smarty()->assign('profilesManager', $this->_profilesManager);
$this->page->smarty()->assign('usersManager', $this->_usersManager);
}
示例9: executeEdit
public function executeEdit(HTTPRequest $request)
{
$address = new Address();
if ($this->app->httpRequest()->getExists('addressId')) {
$addressId = htmlspecialchars($this->app->httpRequest()->getData('addressId'));
$address = $this->_addressManager->get($addressId);
if (is_null($address)) {
$this->app->httpResponse()->redirect('/addresses');
exit;
}
} else {
$this->app->httpResponse()->redirect('/addresses');
exit;
}
$this->page->smarty()->assign('address', $address);
if ($request->postExists('save-address')) {
$this->parseForm($request, $address);
$this->_addressManager->save($address);
$this->app->httpResponse()->redirect('/addresses');
exit;
}
}
示例10: executeContact
public function executeContact(HTTPRequest $request)
{
if ($request->postExists('email')) {
if ($this->isContactMessageValid($request)) {
$subject = htmlspecialchars($request->postData('subject'));
$email = htmlspecialchars($request->postData('email'));
$message = htmlspecialchars($request->postData('message'));
$messageMail = new Mail();
$messageMail->to = 'contact@tipkin.fr,postmaster@beta.tipkin.fr';
$messageMail->from = $email;
$messageMail->subject = date('d-m-y h:i:s') . '[CONTACTEZ-NOUS] ' . $subject;
$messageMail->content = $message;
$messageMail->send();
if ($request->postExists('send-copy')) {
$messageMail->to = $email;
$messageMail->from = null;
$messageMail->subject = '[TIPKIN] Copie de votre message : ' . $subject;
$messageMail->send();
}
$this->page->smarty()->assign('isMessageSent', true);
}
}
}
示例11: parsePrices
private function parsePrices(HTTPRequest $request, $announcementPriceList)
{
$announcementPriceListReturn = array();
foreach ($this->_listOfGroupsEndField as $contactGroup => $endField) {
$currentAnnouncementPrice = new AnnouncementPrice();
$currentAnnouncementPrice->setContactGroupId($contactGroup);
foreach ($announcementPriceList as $announcementPrice) {
if ($announcementPrice->getContactGroupId() == $contactGroup) {
$currentAnnouncementPrice = $announcementPrice;
}
}
if ($request->postExists('price-default-for-' . $endField) && $contactGroup != ContactGroups::USERS) {
$currentAnnouncementPrice->setIsActive(false);
} else {
$currentAnnouncementPrice->setIsActive(true);
}
foreach ($this->_listOfPriceFields as $classAttribute => $formField) {
$setMethod = 'set' . $classAttribute;
$value = htmlspecialchars($request->postData($formField . '-' . $endField));
$currentAnnouncementPrice->{$setMethod}($this->str2num($value));
}
$announcementPriceListReturn[] = $currentAnnouncementPrice;
}
return $announcementPriceListReturn;
}
示例12: executeReservationLanding
public function executeReservationLanding(HTTPRequest $request)
{
if (!$request->postExists('user-subscriber-id')) {
$this->app->httpResponse()->redirect404();
exit;
}
$reservation = new AnnouncementReservation();
$this->parsePostReservation($request, $reservation);
if ($this->_announcementReservationManager->isReservationExists($reservation)) {
$this->app->httpResponse()->redirect('/activities/reservation-exists');
exit;
}
$reservation->setStateId(PaiementStates::WAITING_PAIEMENT);
$reservation->setKeyCheck(mt_rand() . mt_rand() . mt_rand() . mt_rand() . mt_rand());
$reservation->setTransactionRef($reservation->id());
$this->_announcementReservationManager->save($reservation);
$platformFee = $reservation->getPrice() * Tipkin\Config::get('platform-fee-ratio');
if ($platformFee == 0 || $request->postData('currency-id') != 'default') {
$reservation->setStateId(PaiementStates::WAITING_VALIDATION);
$reservation->setTransactionRef('FREE');
$this->_announcementReservationManager->save($reservation);
$messageMail = new Mail();
$messageMail->sendReservationOwnerValidation($this->_usersManager->get($reservation->getUserOwnerId()), $this->_usersManager->get($reservation->getUserSubscriberId()), $this->_announcementManager->get($reservation->getAnnouncementId()), $reservation);
$messageMail->sendReservationSubscriberRecap($this->_usersManager->get($reservation->getUserOwnerId()), $this->_usersManager->get($reservation->getUserSubscriberId()), $this->_announcementManager->get($reservation->getAnnouncementId()));
$this->app->httpResponse()->redirect('/activities/reservations');
exit;
} else {
$this->app->httpResponse()->redirect('/paiement/' . $reservation->id());
exit;
}
}
示例13: executeDelete
public function executeDelete(HTTPRequest $request)
{
if ($request->postExists('confirm')) {
$messageMail = new Mail();
$messageMail->sendDisableAccount($this->_user, Tipkin\Config::get('admin-mail'));
$this->app->user()->setFlash('disable-account');
$this->app->httpResponse()->redirect('/profile-pro');
}
}
示例14: parseForm
private function parseForm(HTTPRequest $request)
{
$username = htmlspecialchars($request->postData('username'));
$mail = htmlspecialchars($request->postData('mail'));
$mailConfirmation = htmlspecialchars($request->postData('mail-confirmation'));
if ($request->postExists('generate-password')) {
$password = $passwordConfirmation = Users::CreateNewPassword();
} else {
$password = htmlspecialchars($request->postData('password'));
$passwordConfirmation = htmlspecialchars($request->postData('password-confirmation'));
}
$role = htmlspecialchars($request->postData('role'));
if ($mail == $mailConfirmation && $password == $passwordConfirmation && strlen($username) >= 6 && strlen($password) >= 6) {
$user = new Users();
$user->setUsername($username);
$user->setMail($mail);
$user->setPassword($password, Tipkin\Config::get('secret-key'));
$user->setRoleId($role);
if (!$this->_userManager->isUsernameOrMailExist($username, $mail)) {
$this->_userManager->save($user);
$messageMail = new Mail();
$messageMail->sendRegistrationInfo($user, $password);
$this->app->user()->setFlash('new-user-added');
$this->app->httpResponse()->redirect('/admin/users');
exit;
} else {
$this->app->user()->setFlash('username-or-mail-exist');
$this->app->httpResponse()->redirect('/admin/users');
exit;
}
} else {
$this->app->user()->setFlash('form-invalid');
$this->app->httpResponse()->redirect('/admin/users');
exit;
}
}
示例15: parseForm
private function parseForm(HTTPRequest $request, AnnouncementPro $announce)
{
$title = htmlspecialchars($request->postData('title'));
$isPublished = $request->postExists('is-published');
$description = htmlspecialchars($request->postData('description'));
$pricePublic = htmlspecialchars($request->postData('price-public'));
if ($request->postExists('has-tips')) {
$tips = htmlspecialchars($request->postData('tips'));
} else {
$tips = '';
}
$rawMaterial = htmlspecialchars($request->postData('raw-material'));
$address1 = htmlspecialchars($request->postData('address1'));
$address2 = htmlspecialchars($request->postData('address2'));
$zipCode = htmlspecialchars($request->postData('zip-code'));
$city = htmlspecialchars($request->postData('city'));
$country = 'FRANCE';
$departmentId = htmlspecialchars($request->postData('department'));
$regionId = $this->_departmentsManager->get($departmentId)->getRegionId();
$categoryId = htmlspecialchars($request->postData('category'));
$subCategoryId = htmlspecialchars($request->postData('sub-category'));
$userId = $this->_user->id();
//Parsing
$announce->setTitle($title);
$announce->setIsPublished($isPublished);
$announce->setDescription($description);
$announce->setPricePublic($this->str2num($pricePublic));
$announce->setTips($tips);
$announce->setRawMaterial($rawMaterial);
$announce->setAddress1($address1);
$announce->setAddress2($address2);
$announce->setZipCode($zipCode);
$announce->setCity($city);
$announce->setCountry($country);
$announce->setDepartmentId($departmentId);
$announce->setRegionId($regionId);
$announce->setCategoryId($categoryId);
$announce->setSubCategoryId($subCategoryId);
$announce->setUserId($userId);
$announce->setAdminComment('');
// Demande de suppression de photo
if ($request->postExists('delete-photo-main')) {
unlink($_SERVER['DOCUMENT_ROOT'] . AnnouncementPro::ANNOUNCEMENT_PRO_DIRECTORY . $announce->id() . '/' . $announce->getPhotoMain());
unlink($_SERVER['DOCUMENT_ROOT'] . AnnouncementPro::ANNOUNCEMENT_PRO_DIRECTORY . $announce->id() . '/' . AnnouncementPro::THUMBNAILS_PREFIX . $announce->getPhotoMain());
$announce->setPhotoMain('');
}
if ($request->postExists('delete-photo-option-1')) {
unlink($_SERVER['DOCUMENT_ROOT'] . AnnouncementPro::ANNOUNCEMENT_PRO_DIRECTORY . $announce->id() . '/' . $announce->getPhotoOption1());
unlink($_SERVER['DOCUMENT_ROOT'] . AnnouncementPro::ANNOUNCEMENT_PRO_DIRECTORY . $announce->id() . '/' . AnnouncementPro::THUMBNAILS_PREFIX . $announce->getPhotoOption1());
$announce->setPhotoOption1('');
}
if ($request->postExists('delete-photo-option-2')) {
unlink($_SERVER['DOCUMENT_ROOT'] . AnnouncementPro::ANNOUNCEMENT_PRO_DIRECTORY . $announce->id() . '/' . $announce->getPhotoOption2());
unlink($_SERVER['DOCUMENT_ROOT'] . AnnouncementPro::ANNOUNCEMENT_PRO_DIRECTORY . $announce->id() . '/' . AnnouncementPro::THUMBNAILS_PREFIX . $announce->getPhotoOption2());
$announce->setPhotoOption2('');
}
}