mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Fix #huntr88841fe0-e332-49ce-a46b-36d4f091fd89
This commit is contained in:
parent
61c734a6e3
commit
cccd7494df
|
|
@ -69,7 +69,7 @@ function dolStripPhpCode($str, $replacewith = '')
|
|||
*
|
||||
* @param string $str String to clean
|
||||
* @return string Result string with php code only
|
||||
* @see dolStripPhpCode()
|
||||
* @see dolStripPhpCode(), checkPHPCode()
|
||||
*/
|
||||
function dolKeepOnlyPhpCode($str)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -680,6 +680,7 @@ function showWebsiteTemplates(Website $website)
|
|||
* @param string $phpfullcodestringold PHP old string. For exemple "<?php echo 'a' ?><php echo 'b' ?>"
|
||||
* @param string $phpfullcodestring PHP new string. For exemple "<?php echo 'a' ?><php echo 'c' ?>"
|
||||
* @return int Error or not
|
||||
* @see dolKeepOnlyPhpCode()
|
||||
*/
|
||||
function checkPHPCode($phpfullcodestringold, $phpfullcodestring)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -806,6 +806,16 @@ if ($action == 'addcontainer' && $usercanedit) {
|
|||
// Remove comments
|
||||
$tmp['content'] = removeHtmlComment($tmp['content']);
|
||||
|
||||
// Check there is no PHP content into the imported file (must be only HTML + JS)
|
||||
$phpcontent = dolKeepOnlyPhpCode('', $tmp['content']);
|
||||
if ($phpcontent) {
|
||||
$error++;
|
||||
setEventMessages('Error getting '.$urltograb.': file that include PHP content is not allowed', null, 'errors');
|
||||
$action = 'createcontainer';
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$regs = array();
|
||||
|
||||
preg_match('/<head>(.*)<\/head>/ims', $tmp['content'], $regs);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user