Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
UserAdminV2
Overview
Overview
Details
Activity
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
庄欣
UserAdminV2
Commits
77fe8b67
Commit
77fe8b67
authored
Mar 28, 2012
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
moved input over to httpfoundation.
parent
bcd3bd85
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
92 deletions
+35
-92
laravel/core.php
+2
-17
laravel/input.php
+26
-9
laravel/laravel.php
+6
-65
laravel/paginator.php
+1
-1
No files found.
laravel/core.php
View file @
77fe8b67
...
@@ -161,19 +161,4 @@ $bundles = require path('app').'bundles'.EXT;
...
@@ -161,19 +161,4 @@ $bundles = require path('app').'bundles'.EXT;
foreach
(
$bundles
as
$bundle
=>
$config
)
foreach
(
$bundles
as
$bundle
=>
$config
)
{
{
Bundle
::
register
(
$bundle
,
$config
);
Bundle
::
register
(
$bundle
,
$config
);
}
}
\ No newline at end of file
/*
|--------------------------------------------------------------------------
| 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
laravel/input.php
View file @
77fe8b67
...
@@ -3,13 +3,6 @@
...
@@ -3,13 +3,6 @@
class
Input
{
class
Input
{
/**
/**
* The applicable input for the request.
*
* @var array
*/
public
static
$input
;
/**
* The key used to store old input in the session.
* The key used to store old input in the session.
*
*
* @var string
* @var string
...
@@ -23,7 +16,11 @@ class Input {
...
@@ -23,7 +16,11 @@ class Input {
*/
*/
public
static
function
all
()
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 {
...
@@ -58,7 +55,27 @@ class Input {
*/
*/
public
static
function
get
(
$key
=
null
,
$default
=
null
)
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);
...
@@ -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
|
Laravel uses the HttpFoundation Symfony component to handle the request
|
be enabled on the server. To account for this, we will strip slashes
|
and response functionality for the framework. This allows us to not
|
on all input arrays if magic quotes are enabled for the server
.
|
worry about that boilerplate code and focus on what matters
.
|
|
*/
*/
if
(
magic_quotes
())
use
Symfony\Component\HttpFoundation\Request
as
FoundationRequest
;
{
$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
]);
Input
::
$input
=
$input
;
Request
::
$foundation
=
FoundationRequest
::
createFromGlobals
()
;
/*
/*
|--------------------------------------------------------------------------
|--------------------------------------------------------------------------
...
...
laravel/paginator.php
View file @
77fe8b67
...
@@ -112,7 +112,7 @@ class Paginator {
...
@@ -112,7 +112,7 @@ class Paginator {
*/
*/
public
static
function
page
(
$total
,
$per_page
)
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
// 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
// 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