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
7225ec0a
Commit
7225ec0a
authored
Aug 16, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactoring classes.
parent
695a8848
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
14 deletions
+35
-14
request.php
system/request.php
+23
-11
response.php
system/response.php
+4
-1
session.php
system/session.php
+8
-2
No files found.
system/request.php
View file @
7225ec0a
...
...
@@ -27,6 +27,28 @@ class Request {
{
if
(
!
is_null
(
static
::
$uri
))
return
static
::
$uri
;
$uri
=
static
::
raw_uri
();
if
(
strpos
(
$uri
,
$base
=
parse_url
(
Config
::
get
(
'application.url'
),
PHP_URL_PATH
))
===
0
)
{
$uri
=
substr
(
$uri
,
strlen
(
$base
));
}
if
(
strpos
(
$uri
,
$index
=
'/index.php'
)
===
0
)
{
$uri
=
substr
(
$uri
,
strlen
(
$index
));
}
return
static
::
$uri
=
((
$uri
=
trim
(
$uri
,
'/'
))
==
''
)
?
'/'
:
$uri
;
}
/**
* Get the raw request URI from the $_SERVER array.
*
* @return string
*/
private
static
function
raw_uri
()
{
if
(
isset
(
$_SERVER
[
'PATH_INFO'
]))
{
$uri
=
$_SERVER
[
'PATH_INFO'
];
...
...
@@ -45,17 +67,7 @@ class Request {
throw
new
\Exception
(
"Malformed request URI. Request terminated."
);
}
if
(
strpos
(
$uri
,
$base
=
parse_url
(
Config
::
get
(
'application.url'
),
PHP_URL_PATH
))
===
0
)
{
$uri
=
substr
(
$uri
,
strlen
(
$base
));
}
if
(
strpos
(
$uri
,
$index
=
'/index.php'
)
===
0
)
{
$uri
=
substr
(
$uri
,
strlen
(
$index
));
}
return
static
::
$uri
=
((
$uri
=
trim
(
$uri
,
'/'
))
==
''
)
?
'/'
:
$uri
;
return
$uri
;
}
/**
...
...
system/response.php
View file @
7225ec0a
...
...
@@ -133,7 +133,10 @@ class Response {
*/
public
function
send
()
{
if
(
!
array_key_exists
(
'Content-Type'
,
$this
->
headers
))
$this
->
header
(
'Content-Type'
,
'text/html; charset=utf-8'
);
if
(
!
array_key_exists
(
'Content-Type'
,
$this
->
headers
))
{
$this
->
header
(
'Content-Type'
,
'text/html; charset=utf-8'
);
}
if
(
!
headers_sent
())
$this
->
send_headers
();
...
...
system/session.php
View file @
7225ec0a
...
...
@@ -60,9 +60,15 @@ class Session {
{
static
::
$session
=
(
!
is_null
(
$id
))
?
static
::
driver
()
->
load
(
$id
)
:
null
;
if
(
static
::
invalid
(
static
::
$session
))
static
::
$session
=
array
(
'id'
=>
Str
::
random
(
40
),
'data'
=>
array
());
if
(
static
::
invalid
(
static
::
$session
))
{
static
::
$session
=
array
(
'id'
=>
Str
::
random
(
40
),
'data'
=>
array
());
}
if
(
!
static
::
has
(
'csrf_token'
))
static
::
put
(
'csrf_token'
,
Str
::
random
(
16
));
if
(
!
static
::
has
(
'csrf_token'
))
{
static
::
put
(
'csrf_token'
,
Str
::
random
(
16
));
}
static
::
$session
[
'last_activity'
]
=
time
();
}
...
...
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