Skip to content
Snippets Groups Projects
Commit 8a9ca56f authored by root's avatar root
Browse files

#Fixes::156999305::Chaitanya N::Vtiger image layout path is exposed issue is fixed

parent 0c4c8699
No related branches found
No related tags found
No related merge requests found
...@@ -341,7 +341,7 @@ class Reports_ScheduleReports_Model extends Vtiger_Base_Model { ...@@ -341,7 +341,7 @@ class Reports_ScheduleReports_Model extends Vtiger_Base_Model {
$site_URL = vglobal('site_URL'); $site_URL = vglobal('site_URL');
$currentModule = vglobal('currentModule'); $currentModule = vglobal('currentModule');
$companydetails = getCompanyDetails(); $companydetails = getCompanyDetails();
$logo = $site_URL.'/test/logo/'.$companydetails['logoname']; $logo = Vtiger_Functions::getLogoPublicURL($companydetails['logoname']);
$body = '<table width="700" cellspacing="0" cellpadding="0" border="0" align="center" style="font-family: Arial,Helvetica,sans-serif; font-size: 12px; font-weight: normal; text-decoration: none; "> $body = '<table width="700" cellspacing="0" cellpadding="0" border="0" align="center" style="font-family: Arial,Helvetica,sans-serif; font-size: 12px; font-weight: normal; text-decoration: none; ">
<tr> <tr>
......
...@@ -93,11 +93,12 @@ class Settings_Vtiger_CompanyDetails_Model extends Settings_Vtiger_Module_Model ...@@ -93,11 +93,12 @@ class Settings_Vtiger_CompanyDetails_Model extends Settings_Vtiger_Module_Model
$logoPath = $this->logoPath; $logoPath = $this->logoPath;
$handler = @opendir($logoPath); $handler = @opendir($logoPath);
$logoName = decode_html($this->get('logoname')); $logoName = decode_html($this->get('logoname'));
$logoPath = Vtiger_Functions::getLogoPublicURL($logoName);
if ($logoName && $handler) { if ($logoName && $handler) {
while ($file = readdir($handler)) { while ($file = readdir($handler)) {
if($logoName === $file && in_array(str_replace('.', '', strtolower(substr($file, -4))), self::$logoSupportedFormats) && $file != "." && $file!= "..") { if($logoName === $file && in_array(str_replace('.', '', strtolower(substr($file, -4))), self::$logoSupportedFormats) && $file != "." && $file!= "..") {
closedir($handler); closedir($handler);
return $logoPath.$logoName; return $logoPath;
} }
} }
} }
......
...@@ -22,7 +22,7 @@ class Vtiger_CompanyDetails_Model extends Vtiger_Base_Model { ...@@ -22,7 +22,7 @@ class Vtiger_CompanyDetails_Model extends Vtiger_Base_Model {
$logoModel = new Vtiger_Image_Model(); $logoModel = new Vtiger_Image_Model();
if(!empty($logoName)) { if(!empty($logoName)) {
$companyLogo = array(); $companyLogo = array();
$companyLogo['imagepath'] = "test/logo/$logoName"; $companyLogo['imagepath'] = Vtiger_Functions::getLogoPublicURL($logoName);
$companyLogo['alt'] = $companyLogo['title'] = $companyLogo['imagename'] = $logoName; $companyLogo['alt'] = $companyLogo['title'] = $companyLogo['imagename'] = $logoName;
$logoModel->setData($companyLogo); $logoModel->setData($companyLogo);
} }
......
...@@ -12,4 +12,18 @@ include_once 'vendor/autoload.php'; ...@@ -12,4 +12,18 @@ include_once 'vendor/autoload.php';
include_once 'vtlib/Vtiger/Module.php'; include_once 'vtlib/Vtiger/Module.php';
vimport('includes.runtime.EntryPoint'); vimport('includes.runtime.EntryPoint');
if(isset($_REQUEST['type']) && isset($_REQUEST['key']) && $_REQUEST['type'] == 'logo'){
$logoPath = 'test/logo/';
$allowedLogoImageFormats = Settings_Vtiger_CompanyDetails_Model::$logoSupportedFormats;
$fileName = vtlib_purify($_REQUEST['key']);
$finalFilePath = $logoPath.$fileName;
$extension = explode('.', $fileName);
$imageFormat = strtolower($extension[1]);
if (in_array($imageFormat, $allowedLogoImageFormats)) {
checkFileAccess($finalFilePath);
Vtiger_ShowFile_Helper::show($finalFilePath, $imageFormat);
}
return;
}
Vtiger_ShowFile_Helper::handle(vtlib_purify($_REQUEST['fid']), vtlib_purify($_REQUEST['key'])); Vtiger_ShowFile_Helper::handle(vtlib_purify($_REQUEST['fid']), vtlib_purify($_REQUEST['key']));
...@@ -1613,7 +1613,17 @@ class Vtiger_Functions { ...@@ -1613,7 +1613,17 @@ class Vtiger_Functions {
} }
return $publicUrl; return $publicUrl;
} }
/**
* Function to get logo public url
* @param <String> $logoName
* @return <String> $sourceUrl
*/
public static function getLogoPublicURL($logoName) {
$publicUrl = "public.php?type=logo&key=$logoName";
return $publicUrl;
}
/** /**
* Function to get the attachmentsid to given crmid * Function to get the attachmentsid to given crmid
* @param type $crmid * @param type $crmid
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment