|
@@ -79,7 +79,7 @@ discard block |
|
|
block discarded – undo |
|
79
|
79
|
{ |
|
80
|
80
|
$str = str_replace('<?=', '<?php', $str); |
|
81
|
81
|
$str = str_replace('<?php', '__LTINTPHP__', $str); |
|
82
|
|
- $str = str_replace('<?', '<?php', $str); // replace the short_open_tag. It is recommended to set this is Off in php.ini |
|
|
82
|
+ $str = str_replace('<?', '<?php', $str); // replace the short_open_tag. It is recommended to set this is Off in php.ini |
|
83
|
83
|
$str = str_replace('__LTINTPHP__', '<?php', $str); |
|
84
|
84
|
|
|
85
|
85
|
$newstr = ''; |
|
@@ -331,9 +331,9 @@ discard block |
|
|
block discarded – undo |
|
331
|
331
|
// at end we replace the '!~!~!~' only if we are in final parent page. |
|
332
|
332
|
$content = preg_replace('/(href=")\/?([^:\"\!]*)\.php\?([^#\"<>]*)(#[^\"<>]*)?\"/', '\1!~!~!~'.DOL_URL_ROOT.'/public/website/index.php?website='.$website->ref.'&pageref=\2&\3\4"', $content, -1, $nbrep); |
|
333
|
333
|
// Replace occurrence like _service_XXX.php with dolibarr URL |
|
334
|
|
- $content = preg_replace('/([\'"])_service_([^\'"]+)\.php\1/', '\1!~!~!~' . DOL_URL_ROOT . '/public/website/index.php?website=' . $website->ref . '&pageref=_service_\2\1', $content, -1, $nbrep); |
|
|
334
|
+ $content = preg_replace('/([\'"])_service_([^\'"]+)\.php\1/', '\1!~!~!~'.DOL_URL_ROOT.'/public/website/index.php?website='.$website->ref.'&pageref=_service_\2\1', $content, -1, $nbrep); |
|
335
|
335
|
// Replace occurrence like _library_XXX.php with dolibarr URL |
|
336
|
|
- $content = preg_replace('/([\'"])_library_([^\'"]+)\.php\1/', '\1!~!~!~' . DOL_URL_ROOT . '/public/website/index.php?website=' . $website->ref . '&pageref=_library_\2\1', $content, -1, $nbrep); |
|
|
336
|
+ $content = preg_replace('/([\'"])_library_([^\'"]+)\.php\1/', '\1!~!~!~'.DOL_URL_ROOT.'/public/website/index.php?website='.$website->ref.'&pageref=_library_\2\1', $content, -1, $nbrep); |
|
337
|
337
|
// Replace relative link without .php like /xxx#aaa or /xxx with dolibarr URL: ...href="....php" |
|
338
|
338
|
$content = preg_replace('/(href=")\/?([a-zA-Z0-9\-_#]+)(\"|\?)/', '\1!~!~!~'.DOL_URL_ROOT.'/public/website/index.php?website='.$website->ref.'&pageref=\2\3', $content, -1, $nbrep); |
|
339
|
339
|
|
|
@@ -431,7 +431,7 @@ discard block |
|
|
block discarded – undo |
|
431
|
431
|
} |
|
432
|
432
|
|
|
433
|
433
|
if (getDolGlobalString('WEBSITE_ADD_CSS_TO_BODY')) { |
|
434
|
|
- $content = str_replace('<body id="bodywebsite" class="bodywebsite', '<body id="bodywebsite" class="bodywebsite ' . getDolGlobalString('WEBSITE_ADD_CSS_TO_BODY'), $content); |
|
|
434
|
+ $content = str_replace('<body id="bodywebsite" class="bodywebsite', '<body id="bodywebsite" class="bodywebsite '.getDolGlobalString('WEBSITE_ADD_CSS_TO_BODY'), $content); |
|
435
|
435
|
} |
|
436
|
436
|
|
|
437
|
437
|
$content = dolReplaceSmileyCodeWithUTF8($content); |
|
@@ -468,7 +468,7 @@ discard block |
|
|
block discarded – undo |
|
468
|
468
|
$sql .= " WHERE rowid = ".((int) $websiteid); |
|
469
|
469
|
|
|
470
|
470
|
$resql = $db->query($sql); |
|
471
|
|
- if (! $resql) { |
|
|
471
|
+ if (!$resql) { |
|
472
|
472
|
return -1; |
|
473
|
473
|
} |
|
474
|
474
|
} |
|
@@ -555,7 +555,7 @@ discard block |
|
|
block discarded – undo |
|
555
|
555
|
unset($tmpwebsitepage); |
|
556
|
556
|
} |
|
557
|
557
|
if ($result > 0) { |
|
558
|
|
- $currenturi = $_SERVER["REQUEST_URI"]; // Example: /public/website/index.php?website=mywebsite.com&pageref=mywebsite-home&nocache=1708177483 |
|
|
558
|
+ $currenturi = $_SERVER["REQUEST_URI"]; // Example: /public/website/index.php?website=mywebsite.com&pageref=mywebsite-home&nocache=1708177483 |
|
559
|
559
|
$regtmp = array(); |
|
560
|
560
|
if (preg_match('/&pageref=([^&]+)/', $currenturi, $regtmp)) { |
|
561
|
561
|
if ($regtmp[0] == $containerref) { |
|
@@ -576,7 +576,7 @@ discard block |
|
|
block discarded – undo |
|
576
|
576
|
if ($newurl) { |
|
577
|
577
|
if (!empty($parameters)) { |
|
578
|
578
|
$separator = (parse_url($newurl, PHP_URL_QUERY) == null) ? '?' : '&'; |
|
579
|
|
- $newurl = $newurl . $separator . http_build_query($parameters); |
|
|
579
|
+ $newurl = $newurl.$separator.http_build_query($parameters); |
|
580
|
580
|
} |
|
581
|
581
|
if ($permanent) { |
|
582
|
582
|
header("Status: 301 Moved Permanently", false, 301); |
|
@@ -893,7 +893,7 @@ discard block |
|
|
block discarded – undo |
|
893
|
893
|
$hashtags = trim(implode(' #', array_map('trim', explode(',', $websitepage->keywords)))); |
|
894
|
894
|
|
|
895
|
895
|
// Open Graph |
|
896
|
|
- $out .= '<meta name="og:type" content="website">'."\n"; // TODO If blogpost, use type article |
|
|
896
|
+ $out .= '<meta name="og:type" content="website">'."\n"; // TODO If blogpost, use type article |
|
897
|
897
|
$out .= '<meta name="og:title" content="'.$websitepage->title.'">'."\n"; |
|
898
|
898
|
if ($websitepage->image) { |
|
899
|
899
|
$out .= '<meta name="og:image" content="'.$website->virtualhost.$image.'">'."\n"; |
|
@@ -1004,9 +1004,9 @@ discard block |
|
|
block discarded – undo |
|
1004
|
1004
|
$sql = "SELECT COUNT(rowid) as nb"; |
|
1005
|
1005
|
$sql .= " FROM ".MAIN_DB_PREFIX."ecm_files"; |
|
1006
|
1006
|
$sql .= " WHERE entity IN (".getEntity($object->element).")"; |
|
1007
|
|
- $sql .= " AND src_object_type = '".$db->escape($object->element)."' AND src_object_id = ".((int) $object->id); // Filter on object |
|
|
1007
|
+ $sql .= " AND src_object_type = '".$db->escape($object->element)."' AND src_object_id = ".((int) $object->id); // Filter on object |
|
1008
|
1008
|
$sql .= " AND ".$db->regexpsql('filename', $regexforimg, 1); |
|
1009
|
|
- $sql .= " AND share IS NOT NULL"; // Only image that are public |
|
|
1009
|
+ $sql .= " AND share IS NOT NULL"; // Only image that are public |
|
1010
|
1010
|
|
|
1011
|
1011
|
$resql = $db->query($sql); |
|
1012
|
1012
|
if ($resql) { |
|
@@ -1042,7 +1042,7 @@ discard block |
|
|
block discarded – undo |
|
1042
|
1042
|
$sql = "SELECT rowid, ref, share, filename, cover, position"; |
|
1043
|
1043
|
$sql .= " FROM ".MAIN_DB_PREFIX."ecm_files"; |
|
1044
|
1044
|
$sql .= " WHERE entity IN (".getEntity($object->element).")"; |
|
1045
|
|
- $sql .= " AND src_object_type = '".$db->escape($object->element)."' AND src_object_id = ".((int) $object->id); // Filter on object |
|
|
1045
|
+ $sql .= " AND src_object_type = '".$db->escape($object->element)."' AND src_object_id = ".((int) $object->id); // Filter on object |
|
1046
|
1046
|
$sql .= " AND ".$db->regexpsql('filename', $regexforimg, 1); |
|
1047
|
1047
|
$sql .= $db->order("cover,position,rowid", "ASC,ASC,ASC"); |
|
1048
|
1048
|
|
|
@@ -1332,7 +1332,7 @@ discard block |
|
|
block discarded – undo |
|
1332
|
1332
|
{ |
|
1333
|
1333
|
$dom = new DOMDocument(); |
|
1334
|
1334
|
|
|
1335
|
|
- libxml_use_internal_errors(false); // Avoid to fill memory with xml errors |
|
|
1335
|
+ libxml_use_internal_errors(false); // Avoid to fill memory with xml errors |
|
1336
|
1336
|
if (LIBXML_VERSION < 20900) { |
|
1337
|
1337
|
// Avoid load of external entities (security problem). |
|
1338
|
1338
|
// Required only if LIBXML_VERSION < 20900 |