本文整理汇总了PHP中input::post方法的典型用法代码示例。如果您正苦于以下问题:PHP input::post方法的具体用法?PHP input::post怎么用?PHP input::post使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类input
的用法示例。
在下文中一共展示了input::post方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _savePackage
protected function _savePackage($packageID)
{
// Check if demo mode is enabled
if (input::demo()) {
return false;
}
// Create rules
$rules = array('credits' => array('label' => __('credits', 'billing_credits'), 'rules' => array('trim', 'required', 'is_natural_no_zero')), 'price' => array('label' => __('price', 'billing'), 'rules' => array('trim', 'required', 'numeric')), 'active' => array('label' => __('active', 'system'), 'rules' => array('trim', 'required', 'intval')));
// Assign rules
validate::setRules($rules);
// Validate fields
if (!validate::run()) {
return false;
}
// Get post data
$package = input::post(array('credits', 'price', 'active'));
// Save banner group
if (!($packageID = $this->credits_model->savePackage($packageID, $package))) {
view::setError(__('save_error', 'system'));
return false;
}
// Success
view::setInfo(__('package_saved', 'billing_credits'));
router::redirect('cp/billing/credits/edit/' . $packageID);
}
示例2: _sendFeedback
protected function _sendFeedback()
{
// Check if demo mode is enabled
if (input::demo()) {
return false;
}
// Extra rules
$rules = array('name' => array('rules' => array('required', 'is_string', 'trim', 'min_length' => 2, 'max_length' => 255)), 'email' => array('rules' => array('required', 'is_string', 'trim', 'valid_email', 'min_length' => 4, 'max_length' => 255)), 'subject' => array('rules' => array('required', 'is_string', 'trim', 'min_length' => 5, 'max_length' => 255)), 'message' => array('rules' => array('required', 'is_string', 'trim', 'min_length' => 10, 'max_length' => 10000)));
if (config::item('feedback_captcha', 'feedback') == 1 || config::item('feedback_captcha', 'feedback') == 2 && !users_helper::isLoggedin()) {
$rules['captcha'] = array('rules' => array('is_captcha'));
}
validate::setRules($rules);
// Validate form values
if (!validate::run($rules)) {
return false;
}
// Get values
$email = input::post('email');
$subject = input::post('subject');
$message = input::post('message') . "\n\n--\n" . input::post('name') . ' <' . input::post('email') . '>' . "\n" . input::ipaddress();
// Send feedback
if (!$this->feedback_model->sendFeedback($email, $subject, $message)) {
if (!validate::getTotalErrors()) {
view::setError(__('send_error', 'system'));
}
return false;
}
// Success
view::setInfo(__('message_sent', 'feedback'));
router::redirect('feedback');
}
示例3: action_SearchResults
public function action_SearchResults()
{
//ドロップダウンの値呼び出し
$this->action_categorize();
//もし入力されたら
if (Input::post()) {
//バリデーション
$val = Validation::forge();
$val->add_field('username', 'ユーザID', 'max_length[255]');
$val->add_field('Title', 'タイトル', 'max_length[255]');
$val->add_field('Pcontent', '内容', 'max_length[255]');
$val->add_field('category', 'カテゴリ', 'required');
$val->add_field('Syear', '開始年', 'required');
$val->add_field('Smonth', '開始月', 'required');
$val->add_field('Sday', '開始日', 'required');
$val->add_field('Eyear', '終了年', 'required');
$val->add_field('Emonth', '終了月', 'required');
$val->add_field('Eday', '終了日', 'required');
//バリデーション起動
if ($val->run()) {
//バリデーションOK
//入力内容の取得
$username = Input::post('username');
$title = Input::post('Title');
$Pcontent = Input::post('Pcontent');
$category = Input::post('category');
$Syear = Input::post('Syear');
$Smonth = Input::post('Smonth');
$Sday = input::post('Sday');
$Eyear = Input::post('Eyear');
$Emonth = Input::post('Emonth');
$Eday = input::post('Eday');
//セッションにセット
Session::set('user', $username);
Session::set('Title', $title);
Session::set('Pcontent', $Pcontent);
Session::set('category', $category);
Session::set('Syear', $Syear);
Session::set('Smonth', $Smonth);
Session::set('Sday', $Sday);
Session::set('Eyear', $Eyear);
Session::set('Emonth', $Emonth);
Session::set('Eday', $Eday);
//検索処理呼び出し
// $kensaku = $this->action_kensaku();
//ビューにセット
$view = View::forge('search/SearchResults', $this->action_kensaku($username, $title, $Pcontent, $category, $Syear, $Smonth, $Sday, $Eyear, $Emonth, $Eday));
} else {
//バリデーションエラー
$this->message = $val->error();
$view = View::forge('search/Search', $this->action_categorize());
$view->set_global('message', $this->message, false);
}
} else {
$view = View::forge('search/Search', $this->action_categorize());
$view->set_global('message', $this->message, false);
}
return $view;
}
示例4: login
public function login()
{
if (input::post('username') && input::post('password') && auth::login(input::post('username'), input::post('password'), self::AUTH_REALM)) {
$this->index();
} else {
return $this->access_denied();
}
}
示例5: action_myform
public function action_myform()
{
$fieldset = \fieldset::forge('form');
$fieldset->add('title', 'title', array('maxlength' => 50), array(array('required')));
if (\input::post()) {
echo \input::post('title');
}
return \Response::forge($fieldset);
}
示例6: _savePluginSettings
protected function _savePluginSettings($keyword, $value)
{
// Toggle classifieds
if ($keyword == 'classifieds_active') {
loader::model('system/lists');
$this->lists_model->toggleItemStatus('classifieds', 'site_user_nav', 'user/classifieds', $value);
} elseif ($keyword == 'ads_gallery') {
loader::model('system/lists');
$this->lists_model->toggleItemStatus('classifieds', 'site_top_nav', 'site/classifieds', input::post('classifieds_active') && $value ? 1 : 0);
}
}
示例7: cities
public function cities()
{
$stateID = uri::segment(3);
$data = array();
if (input::post('title') == 'any') {
$data[''] = __('any', 'system', array(), array(), false);
} else {
$data[''] = __('select', 'system', array(), array(), false);
}
foreach (geo_helper::getCities($stateID) as $id => $name) {
$data[$id . ' '] = $name;
}
view::ajaxResponse($data);
}
示例8: validatePayment
public function validatePayment($gatewayID)
{
// Verify payment status
if (strtolower(input::post('payment_status')) != 'completed' || strtolower(input::post('txn_type')) != 'web_accept') {
$this->setError('Invalid payment status.');
return false;
}
// Verify receiver's email
if (strcasecmp($this->config['email'], input::post('business')) || strcasecmp($this->config['email'], input::post('receiver_email'))) {
$this->setError('Invalid receiver email.');
return false;
}
// Load http library
loader::library('http');
// Set parameters
$params = $_POST;
$params['cmd'] = '_notify-validate';
// Run paypal request
$response = $this->http->run($this->config['test'] ? 'https://www.sandbox.paypal.com/cgi-bin/webscr' : 'https://www.paypal.com/cgi-bin/webscr', 'POST', $params);
// Verify reponse
if (strcasecmp(trim($response), 'verified')) {
$this->setError('Invalid response: ' . $response);
return false;
}
// Get parameters
$receiptID = input::post('txn_id');
$invoiceID = input::post('item_number');
$amount = input::post('mc_gross');
$currency = input::post('mc_currency');
// Verify duplicates
if (!$this->transactions_model->isUniqueTransaction($gatewayID, $receiptID)) {
$this->setError('Duplicate transaction: ' . $receiptID);
return false;
}
// Get invoice
if (!($invoice = $this->transactions_model->getInvoice($invoiceID))) {
$this->setError('Invalid invoice ID: ' . $invoiceID);
return false;
}
// Verify amount
if (strcmp($invoice['amount'], $amount)) {
$this->setError('Invalid payment amount: ' . money_helper::symbol(config::item('currency', 'billing')) . $amount);
return false;
}
$invoice['receipt_id'] = $receiptID;
return $invoice;
}
示例9: browse
public function browse()
{
// Parameters
$params = array('join_columns' => array("`u`.`picture_id`!=0"), 'join_items' => array());
// Process filters
$params = $this->parseCounters($params, 0);
// Process query string
$qstring = $this->parseQuerystring($params['total']);
// Actions
$actions = array(0 => __('select', 'system'), 'approve' => __('approve', 'system'), 'decline' => __('decline', 'system'), 'delete' => __('delete', 'system'));
// Check form action
if (input::post('do_action')) {
// Delete selected albums
if (input::post('action') && isset($actions[input::post('action')]) && input::post('user_id') && is_array(input::post('user_id'))) {
foreach (input::post('user_id') as $userID) {
$userID = (int) $userID;
if ($userID && $userID > 0) {
$this->action(input::post('action'), $userID);
}
}
}
// Success
view::setInfo(__('action_applied', 'system'));
router::redirect('cp/users/pictures/browse?' . $qstring['url'] . 'page=' . $qstring['page']);
}
// Get pictures
$users = array();
if ($params['total']) {
$users = $this->users_model->getUsers('in_list', isset($params['values']['type']) ? $params['values']['type'] : 0, $params['join_columns'], $params['join_items'], $qstring['order'], $qstring['limit']);
}
// Set pagination
$config = array('base_url' => config::siteURL('cp/users/pictures/browse?' . $qstring['url']), 'total_items' => $params['total'], 'items_per_page' => $this->picturesPerPage, 'current_page' => $qstring['page'], 'uri_segment' => 'page');
$pagination = loader::library('pagination', $config, null);
// Assign vars
view::assign(array('users' => $users, 'pagination' => $pagination, 'actions' => $actions));
// Set title
view::setTitle(__('users_pictures_manage', 'system_navigation'));
// Set trail
if ($qstring['search_id']) {
view::setTrail('cp/users/pictures/browse?' . $qstring['url'] . 'page=' . $qstring['page'], __('search_results', 'system'));
}
// Assign actions
view::setAction('#', __('search', 'system'), array('class' => 'icon-text icon-system-search', 'onclick' => '$(\'#pictures-search\').toggle();return false;'));
// Load view
view::load('cp/users/pictures/browse');
}
示例10: _submitReport
protected function _submitReport($resource, $resourceID, $userID, $itemID, $subjects)
{
// Extra rules
$rules = array('subject' => array('rules' => $subjects ? array('required', 'callback__is_valid_subject' => array($subjects)) : array('callback__is_valid_subject' => array($subjects))), 'message' => array('rules' => array('is_string', 'trim', 'max_length' => 255)));
validate::setRules($rules);
// Validate form values
if (!validate::run($rules)) {
return false;
}
// Get values
$subject = $subjects ? (int) input::post('subject') : 0;
$message = input::post('message');
// Send feedback
if (!$this->reports_model->saveReport($resourceID, $userID, $itemID, $subject, $message)) {
if (!validate::getTotalErrors()) {
view::setError(__('save_error', 'system'));
}
return false;
}
// Success
router::redirect('report/sent' . (input::get('modal') ? '?modal=1' : ''));
}
示例11: _saveComment
protected function _saveComment($resource, $itemID)
{
// Is user logged in?
if (!users_helper::isLoggedin()) {
return false;
}
// Create rules
$rules = array('comment' => array('label' => __('comment_body', 'comments'), 'rules' => array('trim', 'required', 'min_length' => config::item('min_length', 'comments'), 'max_length' => config::item('max_length', 'comments'), 'callback__is_comments_delay')));
// Assign rules
validate::setRules($rules);
// Validate fields
if (!validate::run()) {
return false;
}
// Get comment
$comment = array('comment' => input::post('comment'));
// Get table and column names
$table = config::item('resources', 'core', $resource, 'table');
$column = config::item('resources', 'core', $resource, 'column');
$user = config::item('resources', 'core', $resource, 'user');
// Get resource item
$item = $this->db->query("SELECT `" . $column . "` " . ($user ? ', `' . $user . '` AS `user_id`' : '') . "\n\t\t\tFROM `:prefix:" . $table . "`\n\t\t\tWHERE `" . $column . "`=? LIMIT 1", array($itemID))->row();
// Does resource exist?
if (!$item) {
return false;
}
// Save comment
if (!$this->comments_model->saveComment(0, $comment, $resource, isset($item['user_id']) ? $item['user_id'] : 0, $itemID)) {
if (!validate::getTotalErrors()) {
view::setError(__('save_error', 'system'));
}
return false;
}
// Reset post values
$_POST['comment'] = '';
validate::resetRules();
return true;
}
示例12: _savePage
protected function _savePage($pageID, $parentID, $page, $fields, $options, $trail)
{
// Check if demo mode is enabled
if (input::demo()) {
return false;
}
// Extra rules
$rules = array();
foreach ($options as $option) {
if (isset($option['rules'])) {
$rules[$option['keyword']] = array('label' => $option['name'], 'rules' => $option['rules']);
}
}
$rules['keyword'] = array('label' => __('keyword', 'system'), 'rules' => array('trim', 'required', 'max_length' => 128, 'callback__is_valid_keyword' => array($parentID, $pageID)));
// Validate form values
if (!$this->fields_model->validateValues($fields, $rules)) {
return false;
}
// Did keyword change?
if ($pageID && $page['system'] && strcmp($page['keyword'], input::post('keyword'))) {
validate::setFieldError('keyword', __('page_system_rename', 'pages'));
return false;
}
// Extras
$extra = array();
$extra['parent_id'] = $parentID;
$extra['location'] = ($trail ? implode('/', $trail) . '/' : '') . input::post('keyword');
$extra['keyword'] = input::post('keyword');
$extra['file_name'] = input::post('file_name');
$extra['comments'] = config::item('page_comments', 'pages') ? (int) input::post('comments') : 1;
$extra['likes'] = config::item('page_rating', 'pages') == 'likes' ? (int) input::post('likes') : 1;
$extra['votes'] = config::item('page_rating', 'pages') == 'stars' ? (int) input::post('votes') : 1;
$extra['trail'] = (int) input::post('trail');
$extra['active'] = (int) input::post('active');
// Save page
if (!($pageID = $this->pages_model->savePageData($pageID, $parentID, $page, $fields, $extra))) {
if (!validate::getTotalErrors()) {
view::setError(__('save_error', 'system'));
}
return false;
}
// Success
view::setInfo(__('page_saved', 'pages'));
router::redirect('cp/content/pages/edit/' . $parentID . '/' . $pageID);
}
示例13: recipients
public function recipients()
{
// Get URI vars
$newsletterID = (int) uri::segment(5);
// Get newsletter
if (!$newsletterID || !($newsletter = $this->newsletters_model->getNewsletter($newsletterID, false))) {
view::setError(__('no_newsletter', 'newsletters'));
router::redirect('cp/content/newsletters');
}
// Do we need to display recipients?
if (uri::segment(6) == 'view' && isset($newsletter['params']['conditions'])) {
// Search users
$searchID = $this->search_model->searchData('profile', array(), $newsletter['params']['conditions'], $newsletter['params']['values'], array('type_id' => isset($newsletter['params']['values']['type_id']) ? $newsletter['params']['values']['type_id'] : 0));
// Do we have any search terms?
if ($searchID != 'no_terms' && $searchID != 'no_results' && ($search = $this->search_model->getSearch($searchID))) {
// Did total user count change?
if ($search['results'] != $newsletter['total_users']) {
$newsletter = array('total_users' => $search['results']);
$this->newsletters_model->saveNewsletter($newsletterID, $newsletter);
}
router::redirect('cp/users?search_id=' . $searchID);
}
}
// Set filters
$filters = array(array('name' => __('user', 'system'), 'type' => 'text', 'keyword' => 'user'), array('name' => __('user_group', 'users'), 'type' => 'checkbox', 'keyword' => 'groups', 'items' => config::item('usergroups', 'core')), array('name' => __('user_type', 'users'), 'type' => 'select', 'keyword' => 'type_id', 'items' => config::item('usertypes', 'core', 'names')));
foreach (config::item('usertypes', 'core', 'keywords') as $id => $type) {
$filters['types'][$id] = $this->fields_model->getFields('users', $id, 'edit');
}
$filters[] = array('name' => __('verified', 'users'), 'type' => 'boolean', 'keyword' => 'verified');
$filters[] = array('name' => __('active', 'system'), 'type' => 'boolean', 'keyword' => 'active');
// Assign vars
view::assign(array('filters' => $filters, 'values' => array()));
// Assign vars
view::assign(array('newsletterID' => $newsletterID, 'newsletter' => $newsletter));
// Process form values
if (input::post('do_search')) {
$this->_saveRecipients($newsletterID, $filters);
} elseif (isset($newsletter['params']['values'])) {
// Assign vars
view::assign(array('values' => $newsletter['params']['values']));
}
// Set title
view::setTitle(__('newsletter_recipients', 'newsletters'));
// Set trail
view::setTrail('cp/content/newsletters/edit/' . $newsletterID, __('newsletter_edit', 'newsletters') . ' - ' . text_helper::entities($newsletter['subject']));
view::setTrail('cp/content/newsletters/recipients/' . $newsletterID, __('newsletter_recipients', 'newsletters'));
// Load view
view::load('cp/content/newsletters/recipients');
}
示例14: populate
function populate($values = null)
{
if ($this->method == 'post') {
$values = pick($values, input::post());
} elseif ($this->method == 'get') {
$values = pick($values, input::get());
}
foreach ($this->schema as $field) {
$input_id = $this->model_name . '_' . $field->name;
if (array_key_exists($input_id, $values)) {
$this->values[$input_id] = $values[$input_id];
} else {
$this->values[$input_id] = null;
}
}
return $this->values;
}
示例15: _saveSubject
protected function _saveSubject($subjectID)
{
// Check if demo mode is enabled
if (input::demo()) {
return false;
}
// Create rules
$rules = $input = array();
// Get subject data
$subjectData = array();
foreach (config::item('languages', 'core', 'keywords') as $languageID => $language) {
$rules['name_' . $language] = array('label' => __('name', 'system') . (count(config::item('languages', 'core', 'keywords')) > 1 ? ' [' . config::item('languages', 'core', 'names', $languageID) . ']' : ''), 'rules' => array('trim', 'required', 'max_length' => 255));
$input[] = 'name_' . $language;
}
// Assign rules
validate::setRules($rules);
// Validate fields
if (!validate::run()) {
return false;
}
// Get subject data
$subject = input::post($input);
$subject['active'] = input::post('active') ? 1 : 0;
// Save subject
if (!($subjectID = $this->reports_subjects_model->saveSubject($subjectID, $subject))) {
view::setError(__('save_error', 'system'));
return false;
}
// Success
view::setInfo(__('subject_saved', 'reports_subjects'));
router::redirect('cp/content/reports/subjects/edit/' . $subjectID);
}