Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
syncEnrollments
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yeray Santana Hualde
syncEnrollments
Commits
77fe8b67
Commit
77fe8b67
authored
Mar 29, 2012
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
moved input over to httpfoundation.
parent
bcd3bd85
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
91 deletions
+34
-91
core.php
laravel/core.php
+1
-16
input.php
laravel/input.php
+26
-9
laravel.php
laravel/laravel.php
+6
-65
paginator.php
laravel/paginator.php
+1
-1
No files found.
laravel/core.php
View file @
77fe8b67
...
...
@@ -161,19 +161,4 @@ $bundles = require path('app').'bundles'.EXT;
foreach
(
$bundles
as
$bundle
=>
$config
)
{
Bundle
::
register
(
$bundle
,
$config
);
}
/*
|--------------------------------------------------------------------------
| Register The Laravel Bundles
|--------------------------------------------------------------------------
|
| Finally we will register all of the bundles that have been defined for
| the application. None of them will be started, yet but will be setup
| so that they may be started by the develop at any time.
|
*/
use
Symfony\Component\HttpFoundation\Request
as
FoundationRequest
;
Request
::
$foundation
=
FoundationRequest
::
createFromGlobals
();
\ No newline at end of file
}
\ No newline at end of file
laravel/input.php
View file @
77fe8b67
...
...
@@ -2,13 +2,6 @@
class
Input
{
/**
* The applicable input for the request.
*
* @var array
*/
public
static
$input
;
/**
* The key used to store old input in the session.
*
...
...
@@ -23,7 +16,11 @@ class Input {
*/
public
static
function
all
()
{
return
array_merge
(
static
::
get
(),
static
::
file
());
$input
=
array_merge
(
static
::
get
(),
static
::
query
(),
$_FILES
);
unset
(
$input
[
Request
::
spoofer
]);
return
$input
;
}
/**
...
...
@@ -58,7 +55,27 @@ class Input {
*/
public
static
function
get
(
$key
=
null
,
$default
=
null
)
{
return
array_get
(
static
::
$input
,
$key
,
$default
);
return
array_get
(
Request
::
foundation
()
->
request
->
all
(),
$key
,
$default
);
}
/**
* Get an item from the query string.
*
* <code>
* // Get the "email" item from the query string
* $email = Input::query('email');
*
* // Return a default value if the specified item doesn't exist
* $email = Input::query('name', 'Taylor');
* </code>
*
* @param string $key
* @param mixed $default
* @return mixed
*/
public
static
function
query
(
$key
=
null
,
$default
=
null
)
{
return
array_get
(
Request
::
foundation
()
->
query
->
all
(),
$key
,
$default
);
}
/**
...
...
laravel/laravel.php
View file @
77fe8b67
...
...
@@ -57,77 +57,18 @@ error_reporting(-1);
/*
|--------------------------------------------------------------------------
|
Magic Quotes Strip Slashes
|
Create The HttpFoundation Request
|--------------------------------------------------------------------------
|
|
Even though "Magic Quotes" are deprecated in PHP 5.3.x, they may still
|
be enabled on the server. To account for this, we will strip slashes
|
on all input arrays if magic quotes are enabled for the server
.
|
Laravel uses the HttpFoundation Symfony component to handle the request
|
and response functionality for the framework. This allows us to not
|
worry about that boilerplate code and focus on what matters
.
|
*/
if
(
magic_quotes
())
{
$magics
=
array
(
&
$_GET
,
&
$_POST
,
&
$_COOKIE
,
&
$_REQUEST
);
foreach
(
$magics
as
&
$magic
)
{
$magic
=
array_strip_slashes
(
$magic
);
}
}
/*
|--------------------------------------------------------------------------
| Sniff The Input For The Request
|--------------------------------------------------------------------------
|
| Next we'll gather the input to the application based on the global input
| variables for the current request. The input will be gathered based on
| the current request method and will be set on the Input manager class
| as a simple static $input property which can be easily accessed.
|
*/
$input
=
array
();
switch
(
Request
::
method
())
{
case
'GET'
:
$input
=
$_GET
;
break
;
case
'POST'
:
$input
=
$_POST
;
break
;
default
:
if
(
Request
::
spoofed
())
{
$input
=
$_POST
;
}
else
{
parse_str
(
file_get_contents
(
'php://input'
),
$input
);
if
(
magic_quotes
())
$input
=
array_strip_slashes
(
$input
);
}
}
/*
|--------------------------------------------------------------------------
| Remove The Spoofer Input
|--------------------------------------------------------------------------
|
| The spoofed request method is removed from the input so it is not in
| the Input::all() or Input::get() results. Leaving it in the array
| could cause unexpected results since the developer won't be
| expecting it to be present.
|
*/
unset
(
$input
[
Request
::
spoofer
]);
use
Symfony\Component\HttpFoundation\Request
as
FoundationRequest
;
Input
::
$input
=
$input
;
Request
::
$foundation
=
FoundationRequest
::
createFromGlobals
()
;
/*
|--------------------------------------------------------------------------
...
...
laravel/paginator.php
View file @
77fe8b67
...
...
@@ -112,7 +112,7 @@ class Paginator {
*/
public
static
function
page
(
$total
,
$per_page
)
{
$page
=
Input
::
get
(
'page'
,
1
);
$page
=
Input
::
query
(
'page'
,
1
);
// The page will be validated and adjusted if it is less than one or greater
// than the last page. For example, if the current page is not an integer or
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment