本文整理汇总了PHP中Zend_Controller_Request_Abstract::getPost方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Controller_Request_Abstract::getPost方法的具体用法?PHP Zend_Controller_Request_Abstract::getPost怎么用?PHP Zend_Controller_Request_Abstract::getPost使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Controller_Request_Abstract
的用法示例。
在下文中一共展示了Zend_Controller_Request_Abstract::getPost方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPanel
/**
* Gets content panel for the Debugbar
*
* @return string
*/
public function getPanel()
{
$this->_request = Zend_Controller_Front::getInstance()->getRequest();
$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
if ($viewRenderer->view && method_exists($viewRenderer->view, 'getVars')) {
$viewVars = $this->_cleanData($viewRenderer->view->getVars());
} else {
$viewVars = "No 'getVars()' method in view class";
}
$vars = '<div style="width:50%;float:left;">';
$vars .= '<h4>View variables</h4>' . '<div id="ZFDebug_vars" style="margin-left:-22px">' . $viewVars . '</div>' . '<h4>Request parameters</h4>' . '<div id="ZFDebug_requests" style="margin-left:-22px">' . $this->_cleanData($this->_request->getParams()) . '</div>';
$vars .= '</div><div style="width:45%;float:left;">';
if ($this->_request->isPost()) {
$vars .= '<h4>Post variables</h4>' . '<div id="ZFDebug_post" style="margin-left:-22px">' . $this->_cleanData($this->_request->getPost()) . '</div>';
}
$vars .= '<h4>Constants</h4>';
$constants = get_defined_constants(true);
ksort($constants['user']);
$vars .= '<div id="ZFDebug_constants" style="margin-left:-22px">' . $this->_cleanData($constants['user']) . '</div>';
$registry = Zend_Registry::getInstance();
$vars .= '<h4>Zend Registry</h4>';
$registry->ksort();
$vars .= '<div id="ZFDebug_registry" style="margin-left:-22px">' . $this->_cleanData($registry) . '</div>';
$cookies = $this->_request->getCookie();
$vars .= '<h4>Cookies</h4>' . '<div id="ZFDebug_cookie" style="margin-left:-22px">' . $this->_cleanData($cookies) . '</div>';
$vars .= '</div><div style="clear:both"> </div>';
return $vars;
}
示例2: authenticate
/**
* Authenticate a user.
* @param Zend_Controller_Request_Abstract $request The current request
* @param Zend_Controller_Response_Abstract $response The current response
* @return Array|Boolean User data, or FALSE
*/
public function authenticate(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response)
{
$authVars = new Garp_Util_Configuration($this->_getAuthVars()->toArray());
$authVars->obligate('model')->obligate('identityColumn')->obligate('credentialColumn')->setDefault('hashMethod', 'MD5')->setDefault('salt', '');
if (!$request->getPost($authVars['identityColumn']) || !$request->getPost($authVars['credentialColumn'])) {
$this->_addError('Insufficient data received');
return false;
}
$identityValue = $request->getPost($authVars['identityColumn']);
$credentialValue = $request->getPost($authVars['credentialColumn']);
$ini = Zend_Registry::get('config');
$sessionColumns = null;
if (!empty($ini->auth->login->sessionColumns)) {
$sessionColumns = $ini->auth->login->sessionColumns;
$sessionColumns = explode(',', $sessionColumns);
}
$model = new Model_AuthLocal();
try {
$result = $model->tryLogin($identityValue, $credentialValue, $authVars, $sessionColumns);
return $result->toArray();
} catch (Garp_Auth_Adapter_Db_UserNotFoundException $e) {
$this->_addError('The email address is not found');
} catch (Garp_Auth_Adapter_Db_InvalidPasswordException $e) {
$this->_addError('The password is invalid');
}
return false;
}
示例3: process
public function process(Zend_Controller_Request_Abstract $request)
{
//echo "<br/>here at process.";
$this->name = $this->sanitize($request->getPost('name'));
$this->name = substr($this->name, 0, 255);
if (strlen($this->name) == 0) {
$this->addError('name', 'Please enter a name for this general membership due');
//this is a giving FormProcessor.php function.
}
$this->price = $this->sanitize(trim($request->getPost('price')));
//echo "<br/>your ticket_price is: ".$this->ticket_price;
if ($this->price == 'FREE') {
//echo "<br/>after ticket_price";
$this->price = (int) 0;
//echo "<br/>after ticket_price is: ".$this->ticket_price;
}
if (!is_numeric($this->price)) {
$this->addError('price', 'Please enter a valid product price');
}
$this->content = FormProcessor_BlogPost::cleanHtml($request->getPost('content'));
//echo "<br/>you are at after clean HTML";
if (!$this->hasError()) {
echo "<br/>you are at no error";
$this->objects->profile->name = $this->name;
$this->objects->profile->price = $this->price;
$this->objects->profile->content = $this->content;
//echo "<br/>you are at before save()";
$this->objects->Save();
}
//echo "<br/>you are at before return";
return !$this->hasError();
}
示例4: process
public function process(Zend_Controller_Request_Abstract $request)
{
//validate the user's name
$this->product_types_id = $this->sanitize($request->getPost('id'));
//sanitize uses FormProcessor's zend_filter funciton to clean strings.
if (strlen($this->product_types_id) == 0) {
echo 'length is: ' . strlen($this->product_types_id);
//echo 'request measurmrent-name is: '.$request->getPost('size_name');
$this->addError('product_types_id', 'Please enter the beginning size');
echo 'here at size_name errorasdfasdf';
} else {
$this->colors->product_types_id = $this->product_types_id;
}
$this->name_of_color = $this->sanitize($request->getPost('name_of_color'));
//sanitize uses FormProcessor's zend_filter funciton to clean strings.
if (strlen($this->name_of_color) == 0) {
echo 'length is: ' . strlen($this->name_of_color);
//echo 'request measurmrent-name is: '.$request->getPost('size_name');
$this->addError('name_of_color', 'Please enter the beginning size');
echo 'here at size_name errorasdfasdf';
} else {
$this->colors->name_of_color = $this->name_of_color;
}
$this->price_of_product = $this->sanitize($request->getPost('price_of_product'));
//sanitize uses FormProcessor's zend_filter funciton to clean strings.
if (strlen($this->price_of_product) == 0) {
echo 'length is: ' . strlen($this->price_of_product);
//echo 'request measurmrent-name is: '.$request->getPost('size_name');
$this->addError('price_of_product', 'Please enter the beginning size');
echo 'here at size_name errorasdfasdf';
} else {
$this->colors->price_of_product = $this->price_of_product;
}
$this->discount_price = $this->sanitize($request->getPost('discount_price'));
//sanitize uses FormProcessor's zend_filter funciton to clean strings.
if (strlen($this->discount_price) == 0) {
echo 'length is: ' . strlen($this->discount_price);
//echo 'request measurmrent-name is: '.$request->getPost('size_name');
$this->addError('discount_price', 'Please enter the beginning size');
echo 'here at size_name errorasdfasdf';
} else {
$this->colors->discount_price = $this->discount_price;
}
$this->multiple_price = $this->sanitize($request->getPost('multiple_price'));
//sanitize uses FormProcessor's zend_filter funciton to clean strings.
if (strlen($this->multiple_price) == 0) {
echo 'length is: ' . strlen($this->multiple_price);
//echo 'request measurmrent-name is: '.$request->getPost('size_name');
$this->addError('multiple_price', 'Please enter the beginning size');
echo 'here at size_name errorasdfasdf';
} else {
$this->colors->multiple_price = $this->multiple_price;
}
if (!$this->_validateOnly && !$this->hasError()) {
$this->productType->save();
}
//return true if no errors have occurred
return !$this->hasError();
}
示例5: preDispatch
/**
* Enter description here...
*
* @param Zend_Controller_Request_Abstract $request
*/
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
// ziskame instanci redirector helperu, ktery ma starosti presmerovani
$redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('Redirector');
$auth = Zend_Auth::getInstance();
// Stav o autentifikaci uzivatele (prihlaseni) se musi nekde udrzovat, vychozi zpusob je session
// u session lze nastavit namespace, vychozi je Zend_Auth
//$auth->setStorage(new Zend_Auth_Storage_Session('My_Auth'));
if ($request->getParam('logout')) {
// detekovano odhlaseni
$auth->clearIdentity();
// kvuli bezpecnosti provedeme presmerovani
$redirector->gotoSimpleAndExit($this->failedAction, $this->failedController);
}
if ($request->getPost('login')) {
$db = Zend_Db_Table::getDefaultAdapter();
// Vytvarime instance adapteru pro autentifikaci
// nastavime parametry podle naseho nazvu tabulky a sloupcu
// treatment obsahuje pripadne pouzitou hashovaci funkci pro heslo, napr. SHA1
$adapter = new Zend_Auth_Adapter_DbTable($db, $this->tableName, $this->identityColumn, $this->credentialColumn, $this->treatment);
$form = new LoginForm();
// validace se nezdari, napr. prazdny formular
if (!$form->isValid($request->getPost())) {
// FlashMessenger slouzi k uchovani zprav v session
$flash = Zend_Controller_Action_HelperBroker::getStaticHelper('FlashMessenger');
$flash->clearMessages();
$flash->addMessage('Please fill the login form');
$redirector->gotoSimpleAndExit($this->failedAction, $this->failedController, null, array('login-failed' => 1));
}
$username = $form->getValue($this->loginField);
$password = $form->getValue($this->passwordField);
// přidáme salt
$password = "interview" . $password;
// jmeno a heslo predame adapteru
$adapter->setIdentity($username);
$adapter->setCredential($password);
// obecny proces autentifikace s libovolnym adapterem
$result = $auth->authenticate($adapter);
if ($auth->hasIdentity()) {
// Uzivatel byl uspesne overen a je prihlasen
// identity obsahuje v nasem pripade ID uzivatele z databaze
$identity = $auth->getIdentity();
// presmerujeme
$redirector->gotoSimpleAndExit($this->successAction, $this->successController);
} else {
// autentifikace byla neuspesna
// FlashMessenger slouzi k uchovani zprav v session
$flash = Zend_Controller_Action_HelperBroker::getStaticHelper('FlashMessenger');
// vlozime do session rovnou chybove hlasky, ktere pak predame do view
foreach ($result->getMessages() as $msg) {
$flash->addMessage($msg);
}
$redirector->gotoSimpleAndExit($this->failedAction, $this->failedController, null, array('login-failed' => 1));
}
}
}
示例6: getPostData
/**
* Get post data in a form of array ...
*/
public function getPostData()
{
$data = array();
foreach ($_POST as $key => $value) {
if (!in_array($key, $this->_skipFields)) {
$data[$key] = $this->_request->getPost($key);
}
}
return $data;
}
示例7: process
public function process(Zend_Controller_Request_Abstract $request)
{
// validate the username
$this->username = trim($request->getPost('username'));
if (strlen($this->username) == 0) {
$this->addError('username', 'Please enter a username');
} else {
if (!DatabaseObject_User::IsValidUsername($this->username)) {
$this->addError('username', 'Please enter a valid username');
} else {
if ($this->user->usernameExists($this->username)) {
$this->addError('username', 'The selected username already exists');
} else {
$this->user->username = $this->username;
}
}
}
// validate first and last name
$this->first_name = $this->sanitize($request->getPost('first_name'));
if (strlen($this->first_name) == 0) {
$this->addError('first_name', 'Please enter your first name');
} else {
$this->user->profile->first_name = $this->first_name;
}
$this->last_name = $this->sanitize($request->getPost('last_name'));
if (strlen($this->last_name) == 0) {
$this->addError('last_name', 'Please enter your last name');
} else {
$this->user->profile->last_name = $this->last_name;
}
// validate the e-mail address
$this->email = $this->sanitize($request->getPost('email'));
$validator = new Zend_Validate_EmailAddress();
if (strlen($this->email) == 0) {
$this->addError('email', 'Please enter your e-mail address');
} else {
if (!$validator->isValid($this->email)) {
$this->addError('email', 'Please enter a valid e-mail address');
} else {
$this->user->profile->email = $this->email;
}
}
// validate CAPTCHA phrase
$session = new Zend_Session_Namespace('captcha');
$this->captcha = $this->sanitize($request->getPost('captcha'));
if ($this->captcha != $session->phrase) {
$this->addError('captcha', 'Please enter the correct phrase');
}
if (!$this->_validateOnly && !$this->hasError()) {
$this->user->save();
unset($session->phrase);
}
return !$this->hasError();
}
示例8: getPanel
/**
* Gets content panel for the Debugbar
*
* @return string
*/
public function getPanel()
{
$this->_request = Zend_Controller_Front::getInstance()->getRequest();
$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
$viewVars = $viewRenderer->view->getVars();
$vars = '';
if ($this->_request->isPost()) {
$vars .= '<h4>$_POST</h4>' . '<div id="Centurion_ZFDebug_post">' . $this->_cleanData($this->_request->getPost()) . '</div>';
}
$vars .= '<h4>$_COOKIE</h4>' . '<div id="Centurion_ZFDebug_cookie">' . $this->_cleanData($this->_request->getCookie()) . '</div>' . '<h4>Request</h4>' . '<div id="Centurion_ZFDebug_requests">' . $this->_cleanData($this->_request->getParams()) . '</div>' . '<h4>View vars</h4>' . '<div id="Centurion_ZFDebug_vars">' . $this->_cleanData($viewVars) . '</div>';
return $vars;
}
示例9: routeStartup
/**
* Called before Zend_Controller_Front begins evaluating the
* request against its routes.
*
* @param AbstractRequest $request
* @return void
*/
public function routeStartup(AbstractRequest $request)
{
if (!$request instanceof HttpRequest) {
return;
}
if ($request->getQuery('monitor') === 'x' && $request->isXmlHttpRequest()) {
$message = "A javascript error was detected.\n" . "================================\n" . 'Message: ' . $request->getPost('message', '') . "\n" . 'URI: ' . $request->getPost('errorUrl', 'unknown') . "\n" . 'Line: ' . $request->getPost('errorLine', 'unknown') . "\n";
Zend_Registry::get('monitor')->writeLog($message, Zend_Log::WARN, 'javascript-error');
// Immediately return empty response
$this->getResponse()->setBody('')->sendResponse();
exit;
}
}
示例10: process
public function process(Zend_Controller_Request_Abstract $request)
{
$this->description = $this->sanitize($request->getPost('description'));
$this->longitude = $request->getPost('longitude');
$this->latitude = $request->getPost('latitude');
if (!$this->hasError()) {
$this->location->description = $this->description;
$this->location->longitude = $this->longitude;
$this->location->latitude = $this->latitude;
$this->location->save();
}
return !$this->hasError();
}
示例11: process
public function process(Zend_Controller_Request_Abstract $request)
{
//echo "<br/>here at process.";
$this->title = $this->sanitize($request->getPost('username'));
$this->title = substr($this->title, 0, 255);
if (strlen($this->title) == 0) {
$this->addError('title', 'Please enter a title for this post');
//this is a giving FormProcessor.php function.
}
$this->title_link = $this->sanitize($request->getPost('title_link'));
//echo "the current year is: ".$request->getPost('ts_createdYear');
//echo "the current month is: ".$request->getPost('ts_createdMonth');
$date = array('y' => (int) $request->getPost('ts_createdYear'), 'm' => (int) $request->getPost('ts_createdMonth'), 'd' => (int) $request->getPost('ts_createdDay'));
$time = array('h' => (int) $request->getPost('ts_createdHour'), 'm' => (int) $request->getPost('ts_createdMinute'));
$time['h'] = max(1, min(12, $time['h']));
$time['m'] = max(0, min(59, $time['m']));
$meridian = strtolower($request->getPost('ts_createdMeridian'));
if ($meridian != 'pm') {
$meridian = 'am';
}
//conver the hour into 23 hour time
if ($time['h'] < 12 && $meridian == 'pm') {
$time['h'] += 12;
} else {
if ($time['h'] == 12 && $meridian == 'am') {
$time['h'] = 0;
}
}
if (!checkDate($date['m'], $date['d'], $date['y'])) {
$this->addError('ts_created', 'Please select a valid date');
}
$this->ts_created = mktime($time['h'], $time['m'], 0, $date['m'], $date['d'], $date['y']);
//echo "the time that is created is: ".date('Y-m-d', $this->ts_created);
$this->content = self::cleanHtml($request->getPost('content'));
//echo "<br/>here before there is error().";
if (!$this->hasError()) {
$this->post->profile->title = $this->title;
$this->post->ts_created = $this->ts_created;
$this->post->profile->content = $this->content;
$this->post->profile->title_link = $this->title_link;
$preview = !is_null($request->getPost('preview'));
if (!$preview) {
$this->post->sendLive();
}
$this->post->save();
}
return !$this->hasError();
}
示例12: authenticate
/**
* Authenticate a user.
* @param Zend_Controller_Request_Abstract $request The current request
* @param Zend_Controller_Response_Abstract $response The current response
* @return Array|Boolean User data, or FALSE
*/
public function authenticate(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response)
{
if ($request->getPost('openid_identifier') || $request->getParam('openid_mode')) {
$sreg = $this->getSreg();
$openIdAdapter = new Zend_Auth_Adapter_OpenId($request->getPost('openid_identifier'), null, null, null, $sreg);
$result = $openIdAdapter->authenticate();
if ($result->isValid()) {
return $this->_getUserData($result->getIdentity(), $sreg->getProperties());
} else {
$errors = $result->getMessages();
array_walk($errors, array($this, '_addError'));
}
}
$this->_addError('Insufficient data received');
return false;
}
示例13: getPanel
/**
* Gets content panel for the Debugbar
*
* @return string
*/
public function getPanel()
{
$this->_request = Zend_Controller_Front::getInstance()->getRequest();
$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
if ($viewRenderer->view && method_exists($viewRenderer->view, 'getVars')) {
$viewVars = $this->_cleanData($viewRenderer->view->getVars());
} else {
$viewVars = "Pas de méthode 'getVars()' dans l\\'objet vue";
}
$vars = '';
if ($this->_request->isPost()) {
$vars .= '<h4>Superglobale $_POST</h4>' . '<div id="ZFDebug_post">' . $this->_cleanData($this->_request->getPost()) . '</div>';
}
$vars .= '<h4>Superglobale $_COOKIE</h4>' . '<div id="ZFDebug_cookie">' . $this->_cleanData($this->_request->getCookie()) . '</div>' . '<h4>Paramètres de l\'objet Request</h4>' . '<div id="ZFDebug_requests">' . $this->_cleanData($this->_request->getParams()) . '</div>' . '<h4>Variables de vue (Zend_View)</h4>' . '<div id="ZFDebug_vars">' . $viewVars . '</div>';
return $vars;
}
示例14: editAction
/**
* editAction
* @author Cornelius Hansjakob <cha@massiveart.com>
* @version 1.0
*/
public function editAction()
{
$this->core->logger->debug('propterties->controllers->CategoryController->editAction()');
$this->getForm($this->core->sysConfig->generic->actions->edit);
/**
* get form title
*/
$this->view->formtitle = $this->objForm->Setup()->getFormTitle();
$this->view->languageOptions = HtmlOutput::getOptionsOfSQL($this->core, 'SELECT id AS VALUE, languageCode AS DISPLAY FROM languages', $this->objForm->Setup()->getLanguageId());
if ($this->objRequest->isPost() && $this->objRequest->isXmlHttpRequest()) {
$arrFormData = $this->objRequest->getPost();
$this->objForm->Setup()->setFieldValues($arrFormData);
/**
* set action
*/
$this->objForm->setAction('/zoolu/properties/category/edit');
/**
* prepare form (add fields and region to the Zend_Form)
*/
$this->objForm->prepareForm();
if ($this->objForm->isValid($arrFormData)) {
$this->objForm->saveFormData();
$this->view->blnShowFormAlert = true;
}
}
$this->view->form = $this->objForm;
$this->renderScript('category/form.phtml');
}
示例15: routeStartup
/**
* Called before Zend_Controller_Front calls on the router to evaluate the
* request against the registered routes
*
* @param Zend_Controller_Request_Abstract $request
*/
public function routeStartup(Zend_Controller_Request_Abstract $request)
{
if ($request instanceof Zend_Controller_Request_Http) {
if ($request->isPost() || $request->isPut()) {
$post = $request->getPost();
if (empty($post) && empty($_FILES)) {
// Get maximum size and meassurement unit
$max = ini_get('post_max_size');
$unit = substr($max, -1);
if (!is_numeric($unit)) {
$max = substr($max, 0, -1);
}
// Convert to bytes
switch (strtoupper($unit)) {
case 'G':
$max *= 1024;
case 'M':
$max *= 1024;
case 'K':
$max *= 1024;
}
$length = $request->getServer('CONTENT_LENGTH');
if ($max < $length) {
if (!empty($this->_callback)) {
call_user_func($this->_callback, $request);
} else {
$e = new Zend_Controller_Exception('Maximum content length size (' . $max . ') exceeded', 1000);
$this->getResponse()->setException($e);
}
}
}
}
}
}