Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
vtigercrm
Manage
Activity
Members
Labels
Plan
Issues
518
Issue boards
Milestones
Wiki
Code
Merge requests
80
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
vtiger
vtigercrm
Commits
ec9f5e57
Commit
ec9f5e57
authored
5 years ago
by
Greeshma
Browse files
Options
Downloads
Patches
Plain Diff
reverting changes
parent
2e327879
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!413
Sqlinjections
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/Vtiger/helpers/ShowFile.php
+30
-30
30 additions, 30 deletions
modules/Vtiger/helpers/ShowFile.php
with
30 additions
and
30 deletions
modules/Vtiger/helpers/ShowFile.php
+
30
−
30
View file @
ec9f5e57
<?php
/*
+***********************************************************************************
/*+***********************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
*
***********************************************************************************
*/
*************************************************************************************/
class
Vtiger_ShowFile_Helper
{
...
...
@@ -16,20 +16,20 @@ class Vtiger_ShowFile_Helper {
* @param type $encFileName - md5(filename)
*/
static
function
handle
(
$fid
,
$encFileName
)
{
global
$upload_badext
;
global
$upload_badext
;
$db
=
PearDatabase
::
getInstance
();
$query
=
"SELECT vtiger_attachments.* FROM vtiger_attachments
INNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = vtiger_attachments.attachmentsid
WHERE vtiger_attachments.attachmentsid=? AND vtiger_attachments.name=? LIMIT 1"
;
INNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = vtiger_attachments.attachmentsid
WHERE vtiger_attachments.attachmentsid=? AND vtiger_attachments.name=? LIMIT 1"
;
$result
=
$db
->
pquery
(
$query
,
array
(
$fid
,
$encFileName
));
if
(
$result
&&
$db
->
num_rows
(
$result
))
{
$resultData
=
$db
->
fetch_array
(
$result
);
$fileId
=
$resultData
[
'attachmentsid'
];
$filePath
=
$resultData
[
'path'
];
$fileName
=
$resultData
[
'name'
];
$storedFileName
=
$resultData
[
'storedname'
];
$fileType
=
$resultData
[
'type'
];
$resultData
=
$db
->
fetch_array
(
$result
);
$fileId
=
$resultData
[
'attachmentsid'
];
$filePath
=
$resultData
[
'path'
];
$fileName
=
$resultData
[
'name'
];
$storedFileName
=
$resultData
[
'storedname'
];
$fileType
=
$resultData
[
'type'
];
$sanitizedFileName
=
sanitizeUploadFileName
(
$fileName
,
$upload_badext
);
/**
...
...
@@ -37,24 +37,24 @@ WHERE vtiger_attachments.attachmentsid=? AND vtiger_attachments.name=? LIMIT 1";
* This save happens from mailroom, inbox, record save, document save etc..
*/
if
(
!
empty
(
$encFileName
))
{
if
(
!
empty
(
$storedFileName
))
{
$finalFilePath
=
$filePath
.
$fileId
.
'_'
.
$storedFileName
;
}
else
if
(
is_null
(
$storedFileName
))
{
$finalFilePath
=
$filePath
.
$fileId
.
'_'
.
$encFileName
;
}
$isFileExist
=
false
;
if
(
file_exists
(
$finalFilePath
))
{
$isFileExist
=
true
;
}
else
{
$finalFilePath
=
$filePath
.
$fileId
.
'_'
.
$sanitizedFileName
;
if
(
file_exists
(
$finalFilePath
))
{
$isFileExist
=
true
;
}
}
if
(
$isFileExist
)
{
Vtiger_ShowFile_Helper
::
show
(
$finalFilePath
,
$fileType
);
}
}
if
(
!
empty
(
$storedFileName
)){
$finalFilePath
=
$filePath
.
$fileId
.
'_'
.
$storedFileName
;
}
else
if
(
is_null
(
$storedFileName
)){
$finalFilePath
=
$filePath
.
$fileId
.
'_'
.
$encFileName
;
}
$isFileExist
=
false
;
if
(
file_exists
(
$finalFilePath
))
{
$isFileExist
=
true
;
}
else
{
$finalFilePath
=
$filePath
.
$fileId
.
'_'
.
$sanitizedFileName
;
if
(
file_exists
(
$finalFilePath
))
{
$isFileExist
=
true
;
}
}
if
(
$isFileExist
)
{
Vtiger_ShowFile_Helper
::
show
(
$finalFilePath
,
$fileType
);
}
}
}
}
...
...
@@ -71,4 +71,4 @@ WHERE vtiger_attachments.attachmentsid=? AND vtiger_attachments.name=? LIMIT 1";
header
(
"Content-Type:
$fileType
;charset=UTF-8"
);
echo
$contents
;
}
}
}
\ 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