本文整理汇总了PHP中Input::param方法的典型用法代码示例。如果您正苦于以下问题:PHP Input::param方法的具体用法?PHP Input::param怎么用?PHP Input::param使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Input
的用法示例。
在下文中一共展示了Input::param方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_list
public function action_list()
{
$view = View::forge('admin/list');
if (Session::get('status')) {
$view->set_global('status', Session::get('status'));
Session::delete('status');
}
if (\Input::post()) {
if (Auth::delete_user(\Input::param('username'))) {
Session::set('status', array('css' => 'success', 'msg' => 'ユーザ削除に成功しました'));
Response::redirect('admin/list');
} else {
Session::set('status', array('css' => 'danger', 'msg' => 'ユーザ削除に失敗しました'));
Response::redirect('admin/list');
}
}
$list = DB::select('id', 'username', 'email', 'group')->from('users')->where('group', '!=', 100);
$total = $list->execute()->count();
$config = array('per_page' => 20, 'num_links' => 10, 'show_first' => true, 'show_last' => true, 'total_items' => $total, 'uri_segment' => 3);
$pagination = Pagination::forge('mypagination', $config);
$list->limit($pagination->per_page)->offset($pagination->offset);
$result = $list->execute()->as_array();
$view->set_global('list', $result);
$view->set_global('pagination', $pagination);
return $view;
}
示例2: before
public function before()
{
if (!\CMF\Auth::check(null, 'view', 'admin_site')) {
\Response::redirect("/admin/login?next=" . \Uri::string(), 'location');
}
\Lang::$autosave = false;
// Find the lang from the session, or from the user
if ($this->lang_enabled = \Config::get('cmf.languages.enabled', false)) {
$lang = \Session::get('cmf.admin.language');
if ($lang === null) {
$user = \CMF\Auth::current_user();
$lang = $user->default_language;
}
if (!empty($lang) && strlen($lang) !== 0 && $lang !== null) {
\CMF::setLang($lang);
}
}
// Allows us to set the interface template via an integer
$this->mode = \Input::param('_mode', 'default');
$this->interface_template = \Config::get('cmf.admin.interface_templates.' . $this->mode);
// A unique ID that can be passed through
$this->cid = \Input::param('_cid', 'none');
// Lang info
$this->current_lang = \Lang::get_lang();
$this->fallback_lang = \Lang::$fallback;
$this->lang_lines = \Lang::$lines;
}
示例3: action_login
public function action_login()
{
$url_redirect = \Uri::create('system/index/index');
if (\Auth::check()) {
\Response::redirect($url_redirect);
}
if (\Input::is_ajax()) {
$val = \Validation::forge('validate_login');
$val->add_field('email', 'Email', 'required|valid_email');
$val->add_field('password', 'Password', 'required');
if ($val->run(array())) {
if (\Auth::instance()->login(\Input::param('email'), \Input::param('password'))) {
if (\Input::param('remember', false)) {
\Auth::remember_me();
} else {
\Auth::dont_remember_me();
}
$response = array('status' => 'success', 'url' => $url_redirect);
} else {
$messages = \Auth::get_error();
$response = array('status' => 'error', 'msg' => $messages);
}
} else {
$messages = $val->error_message();
$response = array('status' => 'error', 'msg' => $messages);
}
return \Response::forge(json_encode($response));
}
$this->theme->set_template('login');
$this->theme->get_template()->set('content', \view::forge('default/login', $this->_arrParam));
}
示例4: action_update
public function action_update()
{
// If not logged in redirect to home
if (!\Auth::check()) {
\Messages::info(__('user.login.not-logged'));
\Response::redirect_back();
}
// was the login form posted?
if (\Input::method() == 'POST') {
// check the credentials.
if (\Auth::instance()->validate_user(\Auth::get_email(), \Input::param('password'))) {
if (\Input::param('new_password') === \Input::param('confirm_password')) {
\Auth::change_password(\Input::param('password'), \Input::param('new_password'));
// inform the user the password change was successful
\Messages::success(__('user.login.changed'));
\Response::redirect_back();
}
\Messages::warning(__('user.login.mismatch-password'));
} else {
// login failed, show an error message
\Messages::error(__('user.login.bad-password'));
}
\Response::redirect_back('/backend/account/index/password');
}
// display the password reset page
$this->template->content = View::forge('user/password/update');
}
示例5: action_usercp
public function action_usercp()
{
if (!$this->current_user->logged_in()) {
Session::set_flash('error', 'You need to be logged in to access is page');
Session::set_flash('login_redirect', Uri::current());
Response::redirect('login');
}
$this->title('UserCP');
$this->view = $this->theme->view('users/usercp');
if (Input::param() != array()) {
// Set name and email
$this->current_user->name = Input::param('name');
$this->current_user->email = Input::param('email');
// Set new password
if (Input::param('new_password')) {
$this->current_user->password = Input::param('new_password');
}
// Check if the current password is valid...
$auth = Model_User::authenticate_login($this->current_user->username, Input::param('current_password'));
if ($this->current_user->is_valid() and $auth) {
$this->current_user->save();
Session::set_flash('success', 'Details saved');
Response::redirect('usercp');
} else {
$errors = $this->current_user->errors();
if (!$auth) {
$errors = array('Current password is invalid.') + $errors;
}
}
$this->view->set('errors', isset($errors) ? $errors : array());
}
}
示例6: action_login
/**
* User login
*
* @access public
* @return void
*/
public function action_login()
{
if ($this->check_logged_type() == 'guest') {
\Sentry::logout();
}
if (!(\Sentry::check() && !\Sentry::user()->is_admin())) {
\View::set_global('title', 'Login');
if (\Input::post('login')) {
$val = \User\Controller_Validate::forge('login');
if ($val->run()) {
try {
if (\Sentry::user_exists(\Input::param('identity')) && !\Sentry::user(\Input::param('identity'))->is_admin()) {
// check the credentials.
$valid_login = \Sentry::login(\Input::param('identity'), \Input::param('password'), true);
if ($valid_login) {
if ($this->check_logged_type() == 'guest') {
\Messages::info('You cannot log on to with a guest account.');
\Response::redirect(\Uri::front_create('user/account/login'));
}
\Messages::success('You have logged in successfully');
// \Response::redirect(\Input::referrer(\Uri::front_create('user/account/dashboard')));
\Response::redirect(\Uri::front_create('user/account/dashboard'));
} else {
\Messages::error('Email and/or password is incorrect');
}
} else {
\Messages::error('Email and/or password is incorrect');
}
} catch (\Sentry\SentryAuthException $e) {
// show validation errors
//\Messages::error('<h4>There was an error while trying to login</h4>');
$errors = $e->getMessage();
\Messages::error($errors);
} catch (\Sentry\SentryException $e) {
// show validation errors
//\Messages::error('<h4>There was an error while trying to login</h4>');
$errors = $e->getMessage();
\Messages::error($errors);
}
} else {
if ($val->error() != array()) {
// show validation errors
foreach ($val->error() as $e) {
\Messages::error($e->get_message());
}
}
}
}
if (\Input::is_ajax()) {
echo \Theme::instance()->view($this->view_dir . 'login');
} else {
\Theme::instance()->set_partial('content', $this->view_dir . 'single_login');
}
} else {
//Keep existing messages
\Messages::instance()->shutdown();
\Response::redirect(\Uri::front_create('/'));
}
}
示例7: getImageParams
/**
* Get image params for this request
*/
protected function getImageParams($override)
{
$output = array('q' => \Config::get('image.quality', 80), 'bg' => \Input::param('bg', 'fff'));
if ($format = \Input::param('fm', \Input::param('format'))) {
$output['fm'] = $format;
}
$output = \Arr::merge($output, $override);
return \Arr::merge($output, \Input::get());
}
示例8: getData
public function getData()
{
$data = \Input::param();
$arrFile = $this->upload();
if (count($arrFile) > 0) {
$data = array_merge($data, $arrFile);
}
return $data;
}
示例9: update
/**
* Creates a new validation instance for customer update.
*
* @return Validation
*/
public static function update()
{
$validator = Validation::forge('customer');
$input = Input::param();
if (array_key_exists('balance', $input)) {
$validator->add('balance', 'Balance')->add_rule('trim');
}
return $validator;
}
示例10: view
/**
* view method
*
* @access public
* @return void
* @author ida
*/
public function view()
{
$this->fleamarket_id = \Input::param('fleamarket_id');
$this->prefectures = \Config::get('master.prefectures');
$this->entry_styles = \Config::get('master.entry_styles');
$this->event_statuses = \Model_Fleamarket::getEventStatuses();
$this->locations = \Model_Location::find('all');
$this->link_from_list = $this->getLinkFromList();
}
示例11: update
/**
* Creates a new validation instance for product option update.
*
* @return Validation
*/
public static function update()
{
$validator = Validation::forge('product_option');
$input = Input::param();
if (array_key_exists('name', $input)) {
$validator->add('name', 'Name')->add_rule('trim')->add_rule('required');
}
return $validator;
}
示例12: start
/**
* Runs on 'controller_started' event
*/
public static function start()
{
$controller = \Request::active()->controller_instance;
$nocache = \Input::param('nocache', \Session::get_flash('nocache', false, true));
$controller_nocache = !is_null($controller) && method_exists($controller, 'cache') && $controller->cache() === false;
// Don't run if it's already started, if we have a POST or if the controller says not to
if ($nocache !== false || strtolower(\Input::method()) == 'post' || $controller_nocache) {
if (static::$started === true) {
static::stop();
}
return false;
}
$config = \Config::get('cmf.cache');
if ($config['enabled'] !== true) {
return;
}
// Check for excluded URLS
$uri = '/' . str_replace(array('?debug', '&debug'), '', trim($_SERVER['REQUEST_URI'], '/'));
if ($uriPath = parse_url($uri, PHP_URL_PATH)) {
$uri = $uriPath;
}
$jq = \Input::get('_', null);
if ($jq !== null) {
$uri = str_replace(array("?_={$jq}", "&_={$jq}"), '', $uri);
}
$excluded_urls = $config['excluded_urls'];
foreach ($excluded_urls as $url) {
$url = \Uri::create($url);
if ($urlPath = parse_url($url, PHP_URL_PATH)) {
$url = $urlPath;
}
if (strpos($url, '*') !== false && strpos($uri . '/', str_replace('*', '', $url)) === 0) {
return;
}
if ($uri == $url) {
return;
}
}
// Create the driver and try to get cached content from it
$driver = static::driver();
static::$started = true;
// Add any extra files to check
$files = \Arr::get($config, 'check_files', array());
foreach ($files as $file) {
$driver->addFile($file);
}
// Try and get the cached content
$content = $driver->get($uri);
// Serve the cached content if found, or continue and add the finish listener
if (static::$active = $content !== false) {
$driver->serve($content, static::$modified);
} else {
\Event::register('request_finished', 'CMF\\Cache::finish');
}
}
示例13: update
/**
* Creates a new validation instance for product meta option update.
*
* @return Validation
*/
public static function update()
{
if (!($validator = Validation::instance('product_meta_option'))) {
$validator = Validation::forge('product_meta_option');
}
$input = Input::param();
if (array_key_exists('value', $input)) {
$validator->add('value', 'Value')->add_rule('trim')->add_rule('required');
}
return $validator;
}
示例14: __construct
/**
* Initialise the wrapper and it's query builder instance
*
* @param string $class The model class
*/
public function __construct($class, $root, $rootOutput, $params = array(), $field = null)
{
$this->class = $class;
$this->root = $root;
$this->rootOutput = $rootOutput;
$this->params = \Input::param();
$this->field = $field;
if (is_array($params)) {
$this->params = \Arr::merge($this->params, $params);
}
}
示例15: post_commands
public function post_commands()
{
$params = Input::param();
require_once 'AWSSDKforPHP/sdk.class.php';
$ddb = new AmazonDynamoDB();
$ddb->set_region('dynamodb.ap-northeast-1.amazonaws.com');
$body = $params['body'];
$ret = $ddb->put_item(array('TableName' => 'watasync2b', 'Item' => array('id' => array(AmazonDynamoDB::TYPE_STRING => (string) uniqid()), 'command' => array(AmazonDynamoDB::TYPE_STRING => (string) $body), 'created_at' => array(AmazonDynamoDB::TYPE_NUMBER => (string) time()), 'updated_at' => array(AmazonDynamoDB::TYPE_NUMBER => (string) time()))));
$responce = array("hoge" => "hoge");
$this->response($responce, 200);
}