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
|
* @param string $str String to clean
|
||||||
* @return string Result string with php code only
|
* @return string Result string with php code only
|
||||||
* @see dolStripPhpCode()
|
* @see dolStripPhpCode(), checkPHPCode()
|
||||||
*/
|
*/
|
||||||
function dolKeepOnlyPhpCode($str)
|
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 $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' ?>"
|
* @param string $phpfullcodestring PHP new string. For exemple "<?php echo 'a' ?><php echo 'c' ?>"
|
||||||
* @return int Error or not
|
* @return int Error or not
|
||||||
|
* @see dolKeepOnlyPhpCode()
|
||||||
*/
|
*/
|
||||||
function checkPHPCode($phpfullcodestringold, $phpfullcodestring)
|
function checkPHPCode($phpfullcodestringold, $phpfullcodestring)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -806,6 +806,16 @@ if ($action == 'addcontainer' && $usercanedit) {
|
|||||||
// Remove comments
|
// Remove comments
|
||||||
$tmp['content'] = removeHtmlComment($tmp['content']);
|
$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();
|
$regs = array();
|
||||||
|
|
||||||
preg_match('/<head>(.*)<\/head>/ims', $tmp['content'], $regs);
|
preg_match('/<head>(.*)<\/head>/ims', $tmp['content'], $regs);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user