Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Q
question2answer
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
outils
question2answer
Commits
1877d050
Commit
1877d050
authored
Oct 28, 2014
by
Scott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Shorten function name to qa_post_limit_exceeded
parent
389c8211
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
29 deletions
+29
-29
qa-base.php
qa-include/qa-base.php
+27
-27
qa-page-account.php
qa-include/qa-page-account.php
+1
-1
qa-page-admin-default.php
qa-include/qa-page-admin-default.php
+1
-1
No files found.
qa-include/qa-base.php
View file @
1877d050
...
...
@@ -997,6 +997,33 @@
}
function
qa_post_limit_exceeded
()
/*
Checks whether an HTTP request has exceeded the post_max_size PHP variable. This happens whenever an HTTP request
is too big to be properly processed by PHP, usually because there is an attachment in the HTTP request. A warning
is added to the server's log displaying the size of the file that triggered this situation. It is important to note
that whenever this happens the $_POST and $_FILES superglobals are empty.
*/
{
if
(
in_array
(
$_SERVER
[
'REQUEST_METHOD'
],
array
(
'POST'
,
'PUT'
))
&&
empty
(
$_POST
)
&&
empty
(
$_FILES
))
{
$postmaxsize
=
ini_get
(
'post_max_size'
);
// Gets the current post_max_size configuration
$unit
=
substr
(
$postmaxsize
,
-
1
);
if
(
!
is_numeric
(
$unit
))
{
$postmaxsize
=
substr
(
$postmaxsize
,
0
,
-
1
);
}
switch
(
strtoupper
(
$unit
))
{
// Gets an integer value that can be compared against the size of the HTTP request
case
'G'
:
$postmaxsize
*=
1024
;
case
'M'
:
$postmaxsize
*=
1024
;
case
'K'
:
$postmaxsize
*=
1024
;
}
return
$_SERVER
[
'CONTENT_LENGTH'
]
>
$postmaxsize
;
}
}
function
qa_is_http_post
()
/*
Return true if we are responding to an HTTP POST request
...
...
@@ -1038,33 +1065,6 @@
}
function
qa_is_post_max_size_limit_exceeded
()
/*
Checks whether an HTTP request has exceeded the post_max_size PHP variable. This happens whenever an HTTP request
is too big to be properly processed by PHP, usually because there is an attachment in the HTTP request. A warning
is added to the server's log displaying the size of the file that triggered this situation. It is important to note
that whenever this happens the $_POST and $_FILES superglobals are empty.
*/
{
if
(
in_array
(
$_SERVER
[
'REQUEST_METHOD'
],
array
(
'POST'
,
'PUT'
))
&&
empty
(
$_POST
)
&&
empty
(
$_FILES
))
{
$postmaxsize
=
ini_get
(
'post_max_size'
);
// Gets the current post_max_size configuration
$unit
=
substr
(
$postmaxsize
,
-
1
);
if
(
!
is_numeric
(
$unit
))
{
$postmaxsize
=
substr
(
$postmaxsize
,
0
,
-
1
);
}
switch
(
strtoupper
(
$unit
))
{
// Gets an integer value that can be compared against the size of the HTTP request
case
'G'
:
$postmaxsize
*=
1024
;
case
'M'
:
$postmaxsize
*=
1024
;
case
'K'
:
$postmaxsize
*=
1024
;
}
return
$_SERVER
[
'CONTENT_LENGTH'
]
>
$postmaxsize
;
}
}
function
qa_is_mobile_probably
()
/*
Return true if it appears that the page request is coming from a mobile client rather than a desktop/laptop web browser
...
...
qa-include/qa-page-account.php
View file @
1877d050
...
...
@@ -66,7 +66,7 @@
// Process profile if saved
// If the post_max_size is exceeded then the $_POST array is empty so no field processing can be done
if
(
qa_
is_post_max_size
_limit_exceeded
())
if
(
qa_
post
_limit_exceeded
())
$errors
[
'avatar'
]
=
qa_lang
(
'main/file_upload_limit_exceeded'
);
else
{
if
(
qa_clicked
(
'dosaveprofile'
)
&&
!
$isblocked
)
{
...
...
qa-include/qa-page-admin-default.php
View file @
1877d050
...
...
@@ -662,7 +662,7 @@
$formokhtml
=
null
;
// If the post_max_size is exceeded then the $_POST array is empty so no field processing can be done
if
(
qa_
is_post_max_size
_limit_exceeded
())
if
(
qa_
post
_limit_exceeded
())
$errors
[
'avatar_default_show'
]
=
qa_lang
(
'main/file_upload_limit_exceeded'
);
else
if
(
qa_clicked
(
'doresetoptions'
))
{
...
...
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