本文整理汇总了PHP中Input::post方法的典型用法代码示例。如果您正苦于以下问题:PHP Input::post方法的具体用法?PHP Input::post怎么用?PHP Input::post使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Input
的用法示例。
在下文中一共展示了Input::post方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle
/**
* {@inheritdoc}
*/
public function handle(\Input $input)
{
$removeNames = $input->post('packages') ? explode(',', $input->post('packages')) : array($input->post('remove'));
// filter undeletable packages
$removeNames = array_filter($removeNames, function ($removeName) {
return !in_array($removeName, InstalledController::$UNDELETABLE_PACKAGES);
});
// skip empty
if (empty($removeNames)) {
$this->redirect('contao/main.php?do=composer');
}
// make a backup
copy(TL_ROOT . '/' . $this->configPathname, TL_ROOT . '/' . $this->configPathname . '~');
// update requires
$json = new JsonFile(TL_ROOT . '/' . $this->configPathname);
$config = $json->read();
if (!array_key_exists('require', $config)) {
$config['require'] = array();
}
foreach ($removeNames as $removeName) {
unset($config['require'][$removeName]);
}
$json->write($config);
$_SESSION['TL_INFO'][] = sprintf($GLOBALS['TL_LANG']['composer_client']['removeCandidate'], implode(', ', $removeNames));
$_SESSION['COMPOSER_OUTPUT'] .= $this->io->getOutput();
$this->redirect('contao/main.php?do=composer');
}
示例2: handle
/**
* {@inheritdoc}
*/
public function handle(\Input $input)
{
$this->handleRunOnce();
// PATCH
if ($input->post('FORM_SUBMIT') == 'database-update') {
$count = 0;
$sql = deserialize($input->post('sql'));
if (is_array($sql)) {
foreach ($sql as $key) {
if (isset($_SESSION['sql_commands'][$key])) {
$this->Database->query(str_replace('DEFAULT CHARSET=utf8;', 'DEFAULT CHARSET=utf8 COLLATE ' . $GLOBALS['TL_CONFIG']['dbCollation'] . ';', $_SESSION['sql_commands'][$key]));
$count++;
}
}
}
$_SESSION['sql_commands'] = array();
Messages::addConfirmation(sprintf($GLOBALS['TL_LANG']['composer_client']['databaseUpdated'], $count));
$this->reload();
}
/** @var \Contao\Database\Installer $installer */
$installer = \System::importStatic('Database\\Installer');
$form = $installer->generateSqlForm();
if (empty($form)) {
Messages::addInfo($GLOBALS['TL_LANG']['composer_client']['databaseUptodate']);
$this->redirect('contao/main.php?do=composer');
}
$form = preg_replace('#(<label for="sql_\\d+")>(CREATE TABLE)#', '$1 class="create_table">$2', $form);
$form = preg_replace('#(<label for="sql_\\d+")>(ALTER TABLE `[^`]+` ADD)#', '$1 class="alter_add">$2', $form);
$form = preg_replace('#(<label for="sql_\\d+")>(ALTER TABLE `[^`]+` DROP)#', '$1 class="alter_drop">$2', $form);
$form = preg_replace('#(<label for="sql_\\d+")>(DROP TABLE)#', '$1 class="drop_table">$2', $form);
$template = new \BackendTemplate('be_composer_client_update');
$template->composer = $this->composer;
$template->form = $form;
return $template->parse();
}
示例3: handle
/**
* {@inheritdoc}
*
* @SuppressWarnings(PHPMD.LongVariable)
*/
public function handle(\Input $input)
{
$packageName = $input->get('install');
if ($packageName == 'contao/core') {
$this->redirect('contao/main.php?do=composer');
}
if ($input->post('version')) {
$version = base64_decode(rawurldecode($input->post('version')));
// make a backup
copy(TL_ROOT . '/' . $this->configPathname, TL_ROOT . '/' . $this->configPathname . '~');
// update requires
$json = new JsonFile(TL_ROOT . '/' . $this->configPathname);
$config = $json->read();
if (!array_key_exists('require', $config)) {
$config['require'] = array();
}
$config['require'][$packageName] = $version;
ksort($config['require']);
$json->write($config);
Messages::addInfo(sprintf($GLOBALS['TL_LANG']['composer_client']['added_candidate'], $packageName, $version));
$_SESSION['COMPOSER_OUTPUT'] .= $this->io->getOutput();
$this->redirect('contao/main.php?do=composer');
}
$installationCandidates = $this->searchPackage($packageName);
if (empty($installationCandidates)) {
Messages::addError(sprintf($GLOBALS['TL_LANG']['composer_client']['noInstallationCandidates'], $packageName));
$_SESSION['COMPOSER_OUTPUT'] .= $this->io->getOutput();
$this->redirect('contao/main.php?do=composer');
}
$template = new \BackendTemplate('be_composer_client_install');
$template->composer = $this->composer;
$template->packageName = $packageName;
$template->candidates = $installationCandidates;
return $template->parse();
}
示例4: run
/**
* Generate the module
*
* @return string
*/
public function run()
{
/** @var BackendTemplate|object $objTemplate */
$objTemplate = new \BackendTemplate('be_maintenance_mode');
$objTemplate->action = ampersand(\Environment::get('request'));
$objTemplate->headline = $GLOBALS['TL_LANG']['tl_maintenance']['maintenanceMode'];
$objTemplate->isActive = $this->isActive();
try {
$driver = \System::getContainer()->get('lexik_maintenance.driver.factory')->getDriver();
$isLocked = $driver->isExists();
} catch (\Exception $e) {
return '';
}
// Toggle the maintenance mode
if (\Input::post('FORM_SUBMIT') == 'tl_maintenance_mode') {
if ($isLocked) {
$driver->unlock();
} else {
$driver->lock();
}
$this->reload();
}
if ($isLocked) {
$objTemplate->class = 'tl_confirm';
$objTemplate->explain = $GLOBALS['TL_LANG']['MSC']['maintenanceEnabled'];
$objTemplate->submit = $GLOBALS['TL_LANG']['tl_maintenance']['maintenanceDisable'];
} else {
$objTemplate->class = 'tl_info';
$objTemplate->explain = $GLOBALS['TL_LANG']['MSC']['maintenanceDisabled'];
$objTemplate->submit = $GLOBALS['TL_LANG']['tl_maintenance']['maintenanceEnable'];
}
return $objTemplate->parse();
}
示例5: run
/**
* Run the controller and parse the template
*/
public function run()
{
$this->Template = new BackendTemplate('be_picker');
$this->Template->main = '';
// Ajax request
if ($_POST && Environment::get('isAjaxRequest')) {
$this->objAjax = new Ajax(Input::post('action'));
$this->objAjax->executePreActions();
}
$strTable = Input::get('table');
$strField = Input::get('field');
$this->loadDataContainer($strTable);
$objDca = new DC_Table($strTable);
// AJAX request
if ($_POST && Environment::get('isAjaxRequest')) {
$this->objAjax->executePostActions($objDca);
}
$objFileTree = new $GLOBALS['BE_FFL']['fileSelector'](array('strId' => $strField, 'strTable' => $strTable, 'strField' => $strField, 'strName' => $strField, 'varValue' => explode(',', Input::get('value'))), $objDca);
$this->Template->main = $objFileTree->generate();
$this->Template->theme = $this->getTheme();
$this->Template->base = Environment::get('base');
$this->Template->language = $GLOBALS['TL_LANGUAGE'];
$this->Template->title = specialchars($GLOBALS['TL_LANG']['MSC']['filepicker']);
$this->Template->headline = $GLOBALS['TL_LANG']['MSC']['ppHeadline'];
$this->Template->charset = $GLOBALS['TL_CONFIG']['characterSet'];
$this->Template->options = $this->createPageList();
$this->Template->expandNode = $GLOBALS['TL_LANG']['MSC']['expandNode'];
$this->Template->collapseNode = $GLOBALS['TL_LANG']['MSC']['collapseNode'];
$this->Template->loadingData = $GLOBALS['TL_LANG']['MSC']['loadingData'];
$this->Template->search = $GLOBALS['TL_LANG']['MSC']['search'];
$this->Template->action = ampersand(Environment::get('request'));
$this->Template->value = $this->Session->get('file_selector_search');
$GLOBALS['TL_CONFIG']['debugMode'] = false;
$this->Template->output();
}
示例6: login
function login($req, $res, $args)
{
if ($req->isPost()) {
$form_username = Input::post('req_username');
$form_password = Input::post('req_password');
$save_pass = (bool) Input::post('save_pass');
// If form was correctly filled
if ($form_username && $form_password) {
$user = AuthModel::get_user_from_name($form_username);
// Compare user pass with form data
$form_password_hash = Random::hash($form_password);
// Will result in a SHA-1 hash
if ($user->password == $form_password_hash) {
$expire = $save_pass ? time() + 1209600 : time() + 1800;
$jwt = AuthModel::generate_jwt($user);
AuthModel::feather_setcookie('Bearer ' . $jwt, $expire);
return Router::redirect(Router::pathFor('home'), 'Welcome ' . $user->username . '!');
} else {
throw new \Exception('Wrong user/pass', 403);
}
} else {
throw new \Exception("Username and password are required fields.", 1);
}
} elseif ($req->isGet()) {
return View::setPageInfo(['title' => 'Login', 'active_nav' => 'login'])->addTemplate('login.php')->display();
}
}
示例7: action_edit
public function action_edit($id = null)
{
$student = Model_Student::find('first', ['where' => ['user_id' => $id]]);
if (!$student) {
$student = Model_Student::forge(['user_id' => $id]);
}
$val = Model_Student::validate('edit');
if ($val->run()) {
$student->user_id = Input::post('user_id');
$student->year_level = Input::post('year_level');
$student->course_id = Input::post('course_id');
if ($student->save()) {
Session::set_flash('success', e('Updated student #' . $id));
Response::redirect('site/student');
} else {
Session::set_flash('error', e('Could not update student #' . $id));
}
} else {
if (Input::method() == 'POST') {
$student->user_id = $val->validated('user_id');
$student->year_level = $val->validated('year_level');
$student->course_id = $val->validated('course_id');
Session::set_flash('error', $val->error());
}
$this->template->set_global('student', $student, false);
}
$this->template->title = "Students";
$this->template->content = View::forge('site/student/edit');
}
示例8: action_search
public function action_search()
{
//main.jsから投げられたpostdataを取得
$category = Input::post('category');
$refine = Input::post('refine');
$text = Input::post('text');
//検索条件の生成
$query = ['limit' => '', 'order' => 'year', 'column' => 'category', 'value' => $category, 'column2' => '', 'value2' => ''];
if ($category == 'all') {
$query['column'] = '';
$query['value'] = '';
}
//テキストボックスに何も入力されていなかったら
if ($text) {
if ($refine == 'all') {
$query['value2'] = '%' . $text . '%';
//生成した検索条件をModel(paperadministration/papsersearch/papersearch)に渡す
$contents['papers'] = Model_Paperadministration_Papersearch::find_all($query);
} else {
$query['column2'] = $refine;
$query['value2'] = '%' . $text . '%';
//生成した検索条件をModel(paperadministration/papsersearch/papersearch)に渡す
$contents['papers'] = Model_Paperadministration_Papersearch::find_paper($query);
}
} else {
//生成した検索条件をModel(paperadministration/papsersearch/papersearch)に渡す
$contents['papers'] = Model_Paperadministration_Papersearch::find_paper($query);
}
$contents['pagetitle'] = '';
//検索してきた論文たちをViewのコンテンツ部分(paperadministration/parts/newpaper)に渡す
$data['content'] = View::forge('paperadministration/parts/content', $contents);
//main.jsに検索結果を挿入済みのコンテンツ部分を渡す
return $data['content'];
}
示例9: action_edit
public function action_edit($id = null)
{
is_null($id) and Response::redirect('userstationlog');
if (!($userstationlog = Model_Userstationlog::find($id))) {
Session::set_flash('error', 'Could not find userstationlog #' . $id);
Response::redirect('userstationlog');
}
$val = Model_Userstationlog::validate('edit');
if ($val->run()) {
$userstationlog->id = Input::post('id');
$userstationlog->base_line = Input::post('base_line');
$userstationlog->station_id = Input::post('station_id');
$userstationlog->station_id_index = Input::post('station_id_index');
if ($userstationlog->save()) {
Session::set_flash('success', 'Updated userstationlog #' . $id);
Response::redirect('userstationlog');
} else {
Session::set_flash('error', 'Could not update userstationlog #' . $id);
}
} else {
if (Input::method() == 'POST') {
$userstationlog->id = $val->validated('id');
$userstationlog->base_line = $val->validated('base_line');
$userstationlog->station_id = $val->validated('station_id');
$userstationlog->station_id_index = $val->validated('station_id_index');
Session::set_flash('error', $val->error());
}
$this->template->set_global('userstationlog', $userstationlog, false);
}
$this->template->title = "Userstationlogs";
$this->template->content = View::forge('userstationlog/edit');
}
示例10: action_edit
public function action_edit($id = null)
{
$usermyroute = $this->_get_user_my_rouet_data_by_id($id);
// $val = Model_Form::validate('edit');
$val = true;
// if ($val->run())
if ($val == true) {
$usermyroute->departure = Input::post('departure');
$usermyroute->arrival = Input::post('arrival');
$usermyroute->fare = Input::post('fare');
$usermyroute->via = Input::post('via');
$usermyroute->vehicle = Input::post('vehicle');
if ($usermyroute->save()) {
Session::set_flash('success', e('Updated form #' . $id));
Response::redirect('admin/myroute');
} else {
Session::set_flash('error', e('Could not update form #' . $id));
}
} else {
if (Input::method() == 'POST') {
$form->name = $val->validated('name');
$form->email = $val->validated('email');
$form->comment = $val->validated('comment');
$form->ip_address = $val->validated('ip_address');
$form->user_agent = $val->validated('user_agent');
Session::set_flash('error', $val->error());
}
$this->template->set_global('form', $form, false);
}
$this->template->title = "Forms";
$this->template->content = View::forge('admin/myroute/edit');
}
示例11: action_edit
public function action_edit($id = null)
{
is_null($id) and Response::redirect('News');
$news = Model_News::find($id);
$val = Model_News::validate('edit');
if ($val->run()) {
$news->title = Input::post('title');
$news->article = Input::post('article');
$news->call_center_id = Input::post('call_center_id');
$news->user_id = Input::post('user_id');
if ($news->save()) {
Session::set_flash('success', 'Updated news #' . $id);
Response::redirect('news');
} else {
Session::set_flash('error', 'Could not update news #' . $id);
}
} else {
if (Input::method() == 'POST') {
$news->title = $val->validated('title');
$news->article = $val->validated('article');
$news->call_center_id = $val->validated('call_center_id');
$news->user_id = $val->validated('user_id');
Session::set_flash('error', $val->error());
}
$this->template->set_global('news', $news, false);
}
$this->template->title = "News";
$this->template->content = View::forge('news/edit');
}
示例12: action_edit
public function action_edit($id = null)
{
is_null($id) and Response::redirect('point');
if (!($point = Model_Point::find($id))) {
Session::set_flash('error', 'Could not find point #' . $id);
Response::redirect('point');
}
$val = Model_Point::validate('edit');
if ($val->run()) {
$point->user_id = Input::post('user_id');
$point->point = Input::post('point');
if ($point->save()) {
Session::set_flash('success', 'Updated point #' . $id);
Response::redirect('point');
} else {
Session::set_flash('error', 'Could not update point #' . $id);
}
} else {
if (Input::method() == 'POST') {
$point->user_id = $val->validated('user_id');
$point->point = $val->validated('point');
Session::set_flash('error', $val->error());
}
$this->template->set_global('point', $point, false);
}
$this->template->title = "Points";
$this->template->content = View::forge('point/edit');
}
示例13: action_edit
public function action_edit($id = null)
{
$form = Model_Form::find($id);
$val = Model_Form::validate('edit');
if ($val->run()) {
$form->name = Input::post('name');
$form->email = Input::post('email');
$form->comment = Input::post('comment');
$form->ip_address = Input::post('ip_address');
$form->user_agent = Input::post('user_agent');
if ($form->save()) {
Session::set_flash('success', e('Updated form #' . $id));
Response::redirect('admin/form');
} else {
Session::set_flash('error', e('Could not update form #' . $id));
}
} else {
if (Input::method() == 'POST') {
$form->name = $val->validated('name');
$form->email = $val->validated('email');
$form->comment = $val->validated('comment');
$form->ip_address = $val->validated('ip_address');
$form->user_agent = $val->validated('user_agent');
Session::set_flash('error', $val->error());
}
$this->template->set_global('form', $form, false);
}
$this->template->title = "Forms";
$this->template->content = View::forge('admin/form/edit');
}
示例14: action_login
public function action_login()
{
$data["subnav"] = array('login' => 'active');
$auth = Auth::instance();
if (Auth::instance()->check()) {
Session::set_flash('success', 'You are already logged in, ' . $auth->get_screen_name());
Response::redirect('/admin');
}
$view = View::forge('admin/users/login', $data);
$form = Form::forge('login');
$form->add('username', 'Username:', array('class' => 'form-control'));
$form->add('password', 'Password:', array('type' => 'password', 'class' => 'form-control'));
$form->add('submit', ' ', array('type' => 'submit', 'value' => 'Login', 'class' => 'btn btn-primary'));
if (Input::post()) {
if ($auth->login(Input::post('username'), Input::post('password'))) {
Session::set_flash('success', 'Successfully logged in! Welcome ' . $auth->get_screen_name());
Response::redirect('/');
} else {
Session::set_flash('error', 'Username or password incorrect.');
}
}
$view->set('form', $form, false);
$this->template->title = 'User » Login';
$this->template->content = $view;
}
示例15: action_edit
public function action_edit($id = null)
{
$currency = Model_Currency::find($id);
$val = Model_Currency::validate('edit');
if ($val->run()) {
$currency->name = Input::post('name');
$currency->symbol = Input::post('symbol');
$currency->country = Input::post('country');
$currency->is_default = Input::post('is_default');
$currency->exchange_rate = Input::post('exchange_rate');
if ($currency->save()) {
Session::set_flash('success', e('Updated currency #' . $id));
Response::redirect('admin/currencies');
} else {
Session::set_flash('error', e('Could not update currency #' . $id));
}
} else {
if (Input::method() == 'POST') {
$currency->name = $val->validated('name');
$currency->symbol = $val->validated('symbol');
$currency->country = $val->validated('country');
$currency->is_default = $val->validated('is_default');
$currency->exchange_rate = $val->validated('exchange_rate');
Session::set_flash('error', $val->error());
}
$this->template->set_global('currency', $currency, false);
}
$countries = Model_Country::find('all', array('order_by' => array(array('name', 'asc'))));
$this->template->set_global('countries', $countries);
$this->template->set_global('yes_no', array('0' => 'No', '1' => 'Yes'));
$this->template->title = "Currencies";
$this->template->content = View::forge('admin/currencies/edit');
}