Skip to content
Snippets Groups Projects
Commit 9ced2b59 authored by root's avatar root
Browse files

Fixes: Unrestricted(.htaccess) file upload in company logo issue is fixed

parent 2972f7e0
No related branches found
No related tags found
No related merge requests found
......@@ -41,4 +41,25 @@ if (defined('VTIGER_UPGRADE')) {
$db->pquery('ALTER TABLE vtiger_purchaseorder MODIFY s_h_percent DECIMAL(25,3)', array());
$db->pquery('ALTER TABLE vtiger_quotes MODIFY s_h_percent DECIMAL(25,3)', array());
}
// START - Adding htaccess to upload_badext array in config file.
// Updating the config file
$fileName = 'config.inc.php';
if (file_exists($fileName)) {
// Read the contents of the file
$completeData = file_get_contents('config.inc.php');
$pattern = "/upload_badext\s*=+\s*array\(?...+\);/i";
if (preg_match($pattern, $completeData, $matches)) {
$arrayString = $matches[0];
$content = '/htaccess/i';
if (!preg_match($content, $arrayString)) {
$updateStringPattern = "/upload_badext\s*=+\s*array\(?...+'/i";
preg_match($updateStringPattern,$completeData,$matches);
$updatedContent = preg_replace($updateStringPattern, "$matches[0],'htaccess'", $completeData);
// Put the new contents into the file
file_put_contents($fileName, $updatedContent);
}
}
}
//END
}
\ No newline at end of file
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