Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
vtigercrm
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
Welcome to Vtiger Community. To gain access for account, please contact [ community @ vtiger.com ]
Show more breadcrumbs
Code80
vtigercrm
Commits
b0c7e10d
Commit
b0c7e10d
authored
4 years ago
by
Uma
Browse files
Options
Downloads
Patches
Plain Diff
Validate uploaded image for Vtiger Standards
parent
b18b104a
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
kcfinder/core/uploader.php
+12
-4
12 additions, 4 deletions
kcfinder/core/uploader.php
with
12 additions
and
4 deletions
kcfinder/core/uploader.php
+
12
−
4
View file @
b0c7e10d
...
...
@@ -59,7 +59,7 @@ class uploader {
foreach
(
$inputCookie
as
$key
=>
$value
)
{
$this
->
cookie
[
$key
]
=
vtlib_purify
(
$value
);
}
// LINKING UPLOADED FILE
if
(
count
(
$_FILES
))
$this
->
file
=
&
$_FILES
[
key
(
$_FILES
)];
...
...
@@ -97,7 +97,7 @@ class uploader {
$this
->
types
=
&
$this
->
config
[
'types'
];
$firstType
=
array_keys
(
$this
->
types
);
$firstType
=
$firstType
[
0
];
$this
->
get
[
'type'
]
=
"images"
;
// to allow images upload only
$this
->
get
[
'type'
]
=
"images"
;
// to allow images upload only
$this
->
type
=
(
isset
(
$this
->
get
[
'type'
])
&&
isset
(
$this
->
types
[
$this
->
get
[
'type'
]])
...
...
@@ -302,6 +302,14 @@ class uploader {
$gd
=
new
gd
(
$file
[
'tmp_name'
]);
if
(
!
$gd
->
init_error
&&
!
$this
->
imageResize
(
$gd
,
$file
[
'tmp_name'
]))
return
$this
->
label
(
"The image is too big and/or cannot be resized."
);
//sanitization as per Vtiger standard
$isValidImage
=
Vtiger_Functions
::
validateImage
(
$file
);
if
(
is_string
(
$isValidImage
))
$isValidImage
=
(
$isValidImage
==
'false'
)
?
false
:
true
;
if
(
!
$isValidImage
)
{
return
$this
->
label
(
"Denied file extension."
);
}
//sanitization as per Vtiger standard
$isValidImage
=
Vtiger_Functions
::
validateImage
(
$file
);
...
...
@@ -469,7 +477,7 @@ class uploader {
$CKfuncNum
=
isset
(
$this
->
opener
[
'CKEditor'
][
'funcNum'
])
?
$this
->
opener
[
'CKEditor'
][
'funcNum'
]
:
0
;
if
(
!
$CKfuncNum
)
$CKfuncNum
=
0
;
if
(
!
is_numeric
(
$CKfuncNum
)){
if
(
!
is_numeric
(
$CKfuncNum
)){
$CKfuncNum
=
0
;
// to prevent xss
}
$url
=
addcslashes
(
$url
,
"'"
);
...
...
@@ -520,4 +528,4 @@ if (!kc_CKEditor && !kc_FCKeditor && !kc_Custom)
}
}
?>
\ No newline at end of file
?>
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment