34 $str = str_replace(
'<?=',
'<?php', $str);
40 $parts = preg_split(
'/'.preg_quote(
'<?php',
'/').
'/i', $str);
44 foreach ($parts as $part) {
51 $partlings = explode(
'?>', $part);
52 if (!empty($partlings)) {
55 if (count($partlings) > 1) {
61 $newstr .=
'<span phptag>'.$replacewith.
'</span>'.implode(
'', $partlings);
78 $str = str_replace(
'<?=',
'<?php', $str);
79 $str = str_replace(
'<?php',
'__LTINTPHP__', $str);
80 $str = str_replace(
'<?',
'<?php', $str);
81 $str = str_replace(
'__LTINTPHP__',
'<?php', $str);
87 $parts = preg_split(
'/'.preg_quote(
'<?php',
'/').
'/i', $str);
91 foreach ($parts as $part) {
98 $partlings = explode(
'?>', $part, 2);
99 if (!empty($partlings)) {
100 $newstr .= $partlings[0].
'?>';
102 $newstr .= $part.
'?>';
125 dol_syslog(
'dolWebsiteReplacementOfLinks start (contenttype='.$contenttype.
" containerid=".$containerid.
" USEDOLIBARREDITOR=".(defined(
'USEDOLIBARREDITOR') ?
'1' :
'').
" USEDOLIBARRSERVER=".(defined(
'USEDOLIBARRSERVER') ?
'1' :
'').
')', LOG_DEBUG);
129 $replacewith =
'...php...';
130 if ($removephppart) {
133 $content = preg_replace(
'/value="<\?php((?!\?>).)*\?>\n*/ims',
'value="'.$replacewith.
'"', $content);
135 $replacewith =
'"callto=#';
136 if ($removephppart) {
139 $content = preg_replace(
'/"callto:<\?php((?!\?>).)*\?>\n*/ims', $replacewith, $content);
141 $replacewith =
'"mailto=#';
142 if ($removephppart) {
145 $content = preg_replace(
'/"mailto:<\?php((?!\?>).)*\?>\n*/ims', $replacewith, $content);
147 $replacewith =
'src="php';
148 if ($removephppart) {
151 $content = preg_replace(
'/src="<\?php((?!\?>).)*\?>\n*/ims', $replacewith, $content);
153 $replacewith =
'href="php';
154 if ($removephppart) {
157 $content = preg_replace(
'/href="<\?php((?!\?>).)*\?>\n*/ims', $replacewith, $content);
160 $replacewith =
'...php...';
161 if ($removephppart) {
172 $content = str_replace(
'href="styles.css.php',
'href="!~!~!~styles.css.php', $content);
173 $content = str_replace(
'href="http',
'href="!~!~!~http', $content);
174 $content = str_replace(
'href="//',
'href="!~!~!~//', $content);
175 $content = str_replace(
'src="viewimage.php',
'src="!~!~!~/viewimage.php', $content);
176 $content = str_replace(
'src="/viewimage.php',
'src="!~!~!~/viewimage.php', $content);
177 $content = str_replace(
'src="'.DOL_URL_ROOT.
'/viewimage.php',
'src="!~!~!~'.DOL_URL_ROOT.
'/viewimage.php', $content);
178 $content = str_replace(
'href="document.php',
'href="!~!~!~/document.php', $content);
179 $content = str_replace(
'href="/document.php',
'href="!~!~!~/document.php', $content);
180 $content = str_replace(
'href="'.DOL_URL_ROOT.
'/document.php',
'href="!~!~!~'.DOL_URL_ROOT.
'/document.php', $content);
183 $content = preg_replace(
'/(href=")\/(#[^\"<>]*)?\"/',
'\1!~!~!~'.DOL_URL_ROOT.
'/website/index.php?website='.$website->ref.
'&pageid='.$website->fk_default_home.
'\2"', $content, -1, $nbrep);
185 $content = preg_replace(
'/(href=")\/?([^:\"\!]*)\.php(#[^\"<>]*)?\"/',
'\1!~!~!~'.DOL_URL_ROOT.
'/website/index.php?website='.$website->ref.
'&pageref=\2\3"', $content, -1, $nbrep);
187 $content = preg_replace(
'/(href=")\/?([^:\"\!]*)\.php\?([^#\"<>]*)(#[^\"<>]*)?\"/',
'\1!~!~!~'.DOL_URL_ROOT.
'/website/index.php?website='.$website->ref.
'&pageref=\2&\3\4"', $content, -1, $nbrep);
190 $content = preg_replace(
'/url\((["\']?)\/?medias\//',
'url(\1!~!~!~'.DOL_URL_ROOT.
'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
191 $content = preg_replace(
'/data-slide-bg=(["\']?)\/?medias\//',
'data-slide-bg=\1!~!~!~'.DOL_URL_ROOT.
'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
195 $content = preg_replace(
'/(<img[^>]*src=")\/?medias\//',
'\1!~!~!~'.DOL_URL_ROOT.
'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
197 $content = preg_replace(
'/(<img[^>]*src=")\/?([^:\"\!]+)\"/',
'\1!~!~!~'.DOL_URL_ROOT.
'/viewimage.php?modulepart=medias&file=\2"', $content, -1, $nbrep);
199 $content = preg_replace(
'/(<img[^>]*src=")(\/?viewimage\.php)/',
'\1!~!~!~'.DOL_URL_ROOT.
'/viewimage.php', $content, -1, $nbrep);
202 $content = preg_replace(
'/(action=")\/?([^:\"]*)(\.php\")/',
'\1!~!~!~'.DOL_URL_ROOT.
'/website/index.php?website='.$website->ref.
'&pageref=\2"', $content, -1, $nbrep);
205 $content = preg_replace(
'/(href=")(\/?document\.php\?[^\"]*modulepart=[^\"]*)(\")/',
'\1!~!~!~'.DOL_URL_ROOT.
'\2\3', $content, -1, $nbrep);
206 $content = preg_replace(
'/(src=")(\/?document\.php\?[^\"]*modulepart=[^\"]*)(\")/',
'\1!~!~!~'.DOL_URL_ROOT.
'\2\3', $content, -1, $nbrep);
209 $content = preg_replace(
'/(url\(")(\/?viewimage\.php\?[^\"]*modulepart=[^\"]*)(\")/',
'\1!~!~!~'.DOL_URL_ROOT.
'\2\3', $content, -1, $nbrep);
212 $content = str_replace(
'src="!~!~!~/viewimage.php',
'src="!~!~!~'.DOL_URL_ROOT.
'/viewimage.php', $content);
213 $content = str_replace(
'href="!~!~!~/document.php',
'href="!~!~!~'.DOL_URL_ROOT.
'/document.php', $content);
215 $content = str_replace(
'!~!~!~',
'', $content);
217 dol_syslog(
'dolWebsiteReplacementOfLinks end', LOG_DEBUG);
232 ":face_with_tears_of_joy:" =>
"\xF0\x9F\x98\x82",
233 ":grinning_face_with_smiling_eyes:" =>
"\xF0\x9F\x98\x81",
234 ":smiling_face_with_open_mouth:" =>
"\xF0\x9F\x98\x83",
235 ":smiling_face_with_open_mouth_and_cold_sweat:" =>
"\xF0\x9F\x98\x85",
236 ":smiling_face_with_open_mouth_and_tightly_closed_eyes:" =>
"\xF0\x9F\x98\x86",
237 ":winking_face:" =>
"\xF0\x9F\x98\x89",
238 ":smiling_face_with_smiling_eyes:" =>
"\xF0\x9F\x98\x8A",
239 ":face_savouring_delicious_food:" =>
"\xF0\x9F\x98\x8B",
240 ":relieved_face:" =>
"\xF0\x9F\x98\x8C",
241 ":smiling_face_with_heart_shaped_eyes:" =>
"\xF0\x9F\x98\x8D",
242 ":smiling_face_with_sunglasses:" =>
"\xF0\x9F\x98\x8E",
243 ":smirking_face:" =>
"\xF0\x9F\x98\x8F",
244 ":neutral_face:" =>
"\xF0\x9F\x98\x90",
245 ":expressionless_face:" =>
"\xF0\x9F\x98\x91",
246 ":unamused_face:" =>
"\xF0\x9F\x98\x92",
247 ":face_with_cold_sweat:" =>
"\xF0\x9F\x98\x93",
248 ":pensive_face:" =>
"\xF0\x9F\x98\x94",
249 ":confused_face:" =>
"\xF0\x9F\x98\x95",
250 ":confounded_face:" =>
"\xF0\x9F\x98\x96",
251 ":kissing_face:" =>
"\xF0\x9F\x98\x97",
252 ":face_throwing_a_kiss:" =>
"\xF0\x9F\x98\x98",
253 ":kissing_face_with_smiling_eyes:" =>
"\xF0\x9F\x98\x99",
254 ":kissing_face_with_closed_eyes:" =>
"\xF0\x9F\x98\x9A",
255 ":face_with_stuck_out_tongue:" =>
"\xF0\x9F\x98\x9B",
256 ":face_with_stuck_out_tongue_and_winking_eye:" =>
"\xF0\x9F\x98\x9C",
257 ":face_with_stuck_out_tongue_and_tightly_closed_eyes:" =>
"\xF0\x9F\x98\x9D",
258 ":disappointed_face:" =>
"\xF0\x9F\x98\x9E",
259 ":worried_face:" =>
"\xF0\x9F\x98\x9F",
260 ":angry_face:" =>
"\xF0\x9F\x98\xA0",
261 ":face_with_symbols_on_mouth:" =>
"\xF0\x9F\x98\xA1",
263 foreach ($map as $key => $value) {
264 $content = str_replace($key, $value, $content);
282 global $db, $langs, $conf, $user;
283 global $dolibarr_main_url_root, $dolibarr_main_data_root;
285 global $includehtmlcontentopened;
289 dol_syslog(
"dolWebsiteOutput start - contenttype=".$contenttype.
" containerid=".$containerid.
" USEDOLIBARREDITOR=".(defined(
'USEDOLIBARREDITOR') ?
'1' :
'').
" USEDOLIBARRSERVER=".(defined(
'USEDOLIBARRSERVER') ?
'1' :
'').
' includehtmlcontentopened='.$includehtmlcontentopened);
294 $urlwithouturlroot = preg_replace(
'/'.preg_quote(DOL_URL_ROOT,
'/').
'$/i',
'', trim($dolibarr_main_url_root));
295 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
298 if (defined(
'USEDOLIBARREDITOR')) {
300 if ($contenttype ==
'html') {
301 $content = preg_replace(
'/<head>.*<\/head>/ims',
'', $content);
302 $content = preg_replace(
'/^.*<body(\s[^>]*)*>/ims',
'', $content);
303 $content = preg_replace(
'/<\/body(\s[^>]*)*>.*$/ims',
'', $content);
305 } elseif (defined(
'USEDOLIBARRSERVER')) {
306 $content = str_replace(
'<link rel="stylesheet" href="/styles.css',
'<link rel="stylesheet" href="styles.css', $content);
309 $content = str_replace(
'href="styles.css.php',
'href="!~!~!~styles.css.php', $content);
310 $content = str_replace(
'href="http',
'href="!~!~!~http', $content);
311 $content = str_replace(
'href="//',
'href="!~!~!~//', $content);
312 $content = str_replace(array(
'src="viewimage.php',
'src="/viewimage.php'),
'src="!~!~!~/viewimage.php', $content);
313 $content = str_replace(
'src="'.DOL_URL_ROOT.
'/viewimage.php',
'src="!~!~!~'.DOL_URL_ROOT.
'/viewimage.php', $content);
314 $content = str_replace(array(
'href="document.php',
'href="/document.php'),
'href="!~!~!~/document.php', $content);
315 $content = str_replace(
'href="'.DOL_URL_ROOT.
'/document.php',
'href="!~!~!~'.DOL_URL_ROOT.
'/document.php', $content);
318 $content = preg_replace(
'/(href=")\/\"/',
'\1!~!~!~'.DOL_URL_ROOT.
'/public/website/index.php?website='.$website->ref.
'"', $content, -1, $nbrep);
320 $content = preg_replace(
'/(href=")\/?([^:\"\!]*)\.php(#[^\"<>]*)?\"/',
'\1!~!~!~'.DOL_URL_ROOT.
'/public/website/index.php?website='.$website->ref.
'&pageref=\2\3"', $content, -1, $nbrep);
324 $content = preg_replace(
'/(href=")\/?([^:\"\!]*)\.php\?([^#\"<>]*)(#[^\"<>]*)?\"/',
'\1!~!~!~'.DOL_URL_ROOT.
'/public/website/index.php?website='.$website->ref.
'&pageref=\2&\3\4"', $content, -1, $nbrep);
326 $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);
329 $content = preg_replace(
'/(href=")(\/?document\.php\?[^\"]*modulepart=[^\"]*)(\")/',
'\1!~!~!~'.DOL_URL_ROOT.
'\2\3', $content, -1, $nbrep);
330 $content = preg_replace(
'/(src=")(\/?document\.php\?[^\"]*modulepart=[^\"]*)(\")/',
'\1!~!~!~'.DOL_URL_ROOT.
'\2\3', $content, -1, $nbrep);
333 $content = preg_replace(
'/(href=")(\/?viewimage\.php\?[^\"]*modulepart=[^\"]*)(\")/',
'\1!~!~!~'.DOL_URL_ROOT.
'\2\3', $content, -1, $nbrep);
334 $content = preg_replace(
'/(src=")(\/?viewimage\.php\?[^\"]*modulepart=[^\"]*)(\")/',
'\1!~!~!~'.DOL_URL_ROOT.
'\2\3', $content, -1, $nbrep);
335 $content = preg_replace(
'/(url\(")(\/?viewimage\.php\?[^\"]*modulepart=[^\"]*)(\")/',
'\1!~!~!~'.DOL_URL_ROOT.
'\2\3', $content, -1, $nbrep);
338 $content = preg_replace(
'/url\((["\']?)\/?medias\//',
'url(\1!~!~!~'.DOL_URL_ROOT.
'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
339 $content = preg_replace(
'/data-slide-bg=(["\']?)\/?medias\//',
'data-slide-bg=\1!~!~!~'.DOL_URL_ROOT.
'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
343 $content = preg_replace(
'/(<img[^>]*src=")\/?medias\//',
'\1!~!~!~'.DOL_URL_ROOT.
'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
345 $content = preg_replace(
'/(<img[^>]*src=")\/?([^:\"\!]+)\"/',
'\1!~!~!~'.DOL_URL_ROOT.
'/viewimage.php?modulepart=medias&file=\2"', $content, -1, $nbrep);
347 $content = preg_replace(
'/(<img[^>]*src=")(\/?viewimage\.php)/',
'\1!~!~!~'.DOL_URL_ROOT.
'/viewimage.php', $content, -1, $nbrep);
350 $content = preg_replace(
'/(action=")\/?([^:\"]*)(\.php\")/',
'\1!~!~!~'.DOL_URL_ROOT.
'/public/website/index.php?website='.$website->ref.
'&pageref=\2"', $content, -1, $nbrep);
353 $content = str_replace(
'src="!~!~!~/viewimage.php',
'src="!~!~!~'.DOL_URL_ROOT.
'/viewimage.php', $content);
354 $content = str_replace(
'href="!~!~!~/document.php',
'href="!~!~!~'.DOL_URL_ROOT.
'/document.php', $content);
357 if (empty($includehtmlcontentopened)) {
358 $content = str_replace(
'!~!~!~',
'', $content);
362 $symlinktomediaexists = 1;
363 if ($website->virtualhost) {
364 $content = preg_replace(
'/^(<link[^>]*rel="canonical" href=")\//m',
'\1'.$website->virtualhost.
'/', $content, -1, $nbrep);
373 if (!$symlinktomediaexists) {
375 $content = preg_replace(
'/(<img[^>]*src=")\/?image\//',
'\1/wrapper.php?modulepart=medias&file=medias/image/', $content, -1, $nbrep);
376 $content = preg_replace(
'/(url\(["\']?)\/?image\//',
'\1/wrapper.php?modulepart=medias&file=medias/image/', $content, -1, $nbrep);
378 $content = preg_replace(
'/(<script[^>]*src=")[^\"]*document\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/',
'\1/wrapper.php\2modulepart=medias\3file=\4\5', $content, -1, $nbrep);
379 $content = preg_replace(
'/(<a[^>]*href=")[^\"]*document\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/',
'\1/wrapper.php\2modulepart=medias\3file=\4\5', $content, -1, $nbrep);
381 $content = preg_replace(
'/(<a[^>]*href=")[^\"]*viewimage\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/',
'\1/wrapper.php\2modulepart=medias\3file=\4\5', $content, -1, $nbrep);
382 $content = preg_replace(
'/(<img[^>]*src=")[^\"]*viewimage\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/',
'\1/wrapper.php\2modulepart=medias\3file=\4\5', $content, -1, $nbrep);
383 $content = preg_replace(
'/(url\(["\']?)[^\)]*viewimage\.php([^\)]*)modulepart=medias([^\)]*)file=([^\)]*)(["\']?\))/',
'\1/wrapper.php\2modulepart=medias\3file=\4\5', $content, -1, $nbrep);
385 $content = preg_replace(
'/(<a[^>]*href=")[^\"]*viewimage\.php([^\"]*)hashp=([^\"]*)("[^>]*>)/',
'\1/wrapper.php\2hashp=\3\4', $content, -1, $nbrep);
386 $content = preg_replace(
'/(<img[^>]*src=")[^\"]*viewimage\.php([^\"]*)hashp=([^\"]*)("[^>]*>)/',
'\1/wrapper.php\2hashp=\3\4', $content, -1, $nbrep);
387 $content = preg_replace(
'/(url\(["\']?)[^\)]*viewimage\.php([^\)]*)hashp=([^\)]*)(["\']?\))/',
'\1/wrapper.php\2hashp\3\4', $content, -1, $nbrep);
389 $content = preg_replace(
'/(<img[^>]*src=")[^\"]*viewimage\.php([^\"]*)modulepart=mycompany([^\"]*)file=([^\"]*)("[^>]*>)/',
'\1/wrapper.php\2modulepart=mycompany\3file=\4\5', $content, -1, $nbrep);
392 $content = preg_replace(
'/(<img[^>]*src=")\/?viewimage\.php/',
'\1/wrapper.php', $content, -1, $nbrep);
393 $content = preg_replace(
'/(<a[^>]*href=")\/?documents\.php/',
'\1/wrapper.php', $content, -1, $nbrep);
396 $content = preg_replace(
'/(<img[^>]*src=")\/?image\//',
'\1/medias/image/', $content, -1, $nbrep);
397 $content = preg_replace(
'/(url\(["\']?)\/?image\//',
'\1/medias/image/', $content, -1, $nbrep);
399 $content = preg_replace(
'/(<script[^>]*src=")[^\"]*document\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/',
'\1/medias/\4\5', $content, -1, $nbrep);
400 $content = preg_replace(
'/(<a[^>]*href=")[^\"]*document\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/',
'\1/medias/\4\5', $content, -1, $nbrep);
402 $content = preg_replace(
'/(<a[^>]*href=")[^\"]*viewimage\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/',
'\1/medias/\4\5', $content, -1, $nbrep);
403 $content = preg_replace(
'/(<img[^>]*src=")[^\"]*viewimage\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/',
'\1/medias/\4\5', $content, -1, $nbrep);
404 $content = preg_replace(
'/(url\(["\']?)[^\)]*viewimage\.php([^\)]*)modulepart=medias([^\)]*)file=([^\)]*)(["\']?\))/',
'\1/medias/\4\5', $content, -1, $nbrep);
406 $content = preg_replace(
'/(<a[^>]*href=")[^\"]*viewimage\.php([^\"]*)hashp=([^\"]*)("[^>]*>)/',
'\1/wrapper.php\2hashp=\3\4', $content, -1, $nbrep);
407 $content = preg_replace(
'/(<img[^>]*src=")[^\"]*viewimage\.php([^\"]*)hashp=([^\"]*)("[^>]*>)/',
'\1/wrapper.php\2hashp=\3\4', $content, -1, $nbrep);
408 $content = preg_replace(
'/(url\(["\']?)[^\)]*viewimage\.php([^\)]*)hashp=([^\)]*)(["\']?\))/',
'\1/wrapper.php\2hashp=\3\4', $content, -1, $nbrep);
410 $content = preg_replace(
'/(<img[^>]*src=")[^\"]*viewimage\.php([^\"]*)modulepart=mycompany([^\"]*)file=([^\"]*)("[^>]*>)/',
'\1/wrapper.php\2modulepart=mycompany\3file=\4\5', $content, -1, $nbrep);
413 $content = preg_replace(
'/(<img[^>]*src=")\/?viewimage\.php/',
'\1/wrapper.php', $content, -1, $nbrep);
414 $content = preg_replace(
'/(<a[^>]*href=")\/?document\.php/',
'\1/wrapper.php', $content, -1, $nbrep);
418 if (!defined(
'USEDOLIBARREDITOR')) {
419 $content = str_replace(
' contenteditable="true"',
' contenteditable="false"', $content);
422 if (!empty($conf->global->WEBSITE_ADD_CSS_TO_BODY)) {
423 $content = str_replace(
'<body id="bodywebsite" class="bodywebsite',
'<body id="bodywebsite" class="bodywebsite '.$conf->global->WEBSITE_ADD_CSS_TO_BODY, $content);
445 if (in_array($websitepagetype, array(
'blogpost',
'page'))) {
450 $sql =
"UPDATE ".$db->prefix().
"website SET ";
451 $sql .=
" pageviews_total = pageviews_total + 1,";
452 $sql .=
" pageviews_month = pageviews_month + 1,";
454 $sql .=
" pageviews_previous_month = ".$db->ifsql(
"lastaccess < '".$db->idate(
dol_mktime(0, 0, 0, $tmpnow[
'mon'], 1, $tmpnow[
'year'],
'gmt', 0),
'gmt').
"'",
'pageviews_month',
'pageviews_previous_month').
",";
455 $sql .=
" lastaccess = '".$db->idate(
dol_now(
'gmt'),
'gmt').
"'";
456 $sql .=
" WHERE rowid = ".((int) $websiteid);
457 $resql = $db->query($sql);
506 global $db, $website;
512 if ($containeraliasalt) {
513 include_once DOL_DOCUMENT_ROOT.
'/website/class/websitepage.class.php';
515 $result = $tmpwebsitepage->fetch(0, $website->id,
'', $containeraliasalt);
517 $containerref = $tmpwebsitepage->pageurl;
519 print
"Error, page contains a redirect to the alternative alias '".$containeraliasalt.
"' that does not exists in web site (".$website->id.
" / ".$website->ref.
")";
524 if (defined(
'USEDOLIBARREDITOR')) {
528 $text =
"This page contains dynamic code that make a redirect to '".$containerref.
"' in your current context. Redirect has been canceled as it is not supported in edition mode.";
529 setEventMessages($text,
null,
'warnings',
'WEBSITEREDIRECTDISABLED'.$containerref);
533 if (defined(
'USEDOLIBARRSERVER')) {
535 if (!$containeraliasalt) {
536 include_once DOL_DOCUMENT_ROOT.
'/website/class/websitepage.class.php';
538 $result = $tmpwebsitepage->fetch(0, $website->id, $containerref);
539 unset($tmpwebsitepage);
542 $currenturi = $_SERVER[
"REQUEST_URI"];
544 if (preg_match(
'/&pageref=([^&]+)/', $currenturi, $regtmp)) {
545 if ($regtmp[0] == $containerref) {
546 print
"Error, page with uri '.$currenturi.' try a redirect to the same alias page '".$containerref.
"' in web site '".$website->ref.
"'";
549 $newurl = preg_replace(
'/&pageref=([^&]+)/',
'&pageref='.$containerref, $currenturi);
552 $newurl = $currenturi.
'&pageref='.urlencode($containerref);
557 $newurl =
'/'.$containerref.
'.php';
562 header(
"Status: 301 Moved Permanently",
false, 301);
564 header(
"Location: ".$newurl.(empty($_SERVER[
"QUERY_STRING"]) ?
'' :
'?'.$_SERVER[
"QUERY_STRING"]));
567 print
"Error, page contains a redirect to the alias page '".$containerref.
"' that does not exists in web site (".$website->id.
" / ".$website->ref.
")";
582 global $conf, $db, $hookmanager, $langs, $mysoc, $user, $website, $websitepage, $weblangs;
583 global $includehtmlcontentopened;
584 global $websitekey, $websitepagefile;
588 if (!preg_match(
'/\.php$/i', $containerref)) {
589 $containerref .=
'.php';
592 $fullpathfile = DOL_DATA_ROOT.($conf->entity > 1 ?
'/'.$conf->entity :
'').
'/website/'.$websitekey.
'/'.$containerref;
594 if (empty($includehtmlcontentopened)) {
595 $includehtmlcontentopened = 0;
597 $includehtmlcontentopened++;
598 if ($includehtmlcontentopened > $MAXLEVEL) {
599 print
'ERROR: RECURSIVE CONTENT LEVEL. Depth of recursive call is more than the limit of '.((int) $MAXLEVEL).
".\n";
610 $res = include $fullpathfile;
611 $tmpoutput = ob_get_contents();
614 print
"\n".
'<!-- include '.$websitekey.
'/'.$containerref.(is_object($websitepage) ?
' parent id='.$websitepage->id :
'').
' level = '.$includehtmlcontentopened.
' -->'.
"\n";
615 print preg_replace(array(
'/^.*<body[^>]*>/ims',
'/<\/body>.*$/ims'), array(
'',
''), $tmpoutput);
618 print
'ERROR: FAILED TO INCLUDE PAGE '.$containerref.
".\n";
621 $includehtmlcontentopened--;
636 global $conf, $db, $hookmanager, $langs, $mysoc, $user, $website, $websitepage, $weblangs, $pagelangs;
638 $type = strtolower($type);
640 if ($type ==
'software') {
641 $ret =
'<!-- Add structured data for entry in a software annuary -->'.
"\n";
642 $ret .=
'<script nonce="'.getNonce().
'" type="application/ld+json">'.
"\n";
644 "@context": "https://schema.org",
645 "@type": "SoftwareApplication",
646 "name": "'.dol_escape_json($data[
'name']).
'",
648 "applicationCategory": "https://schema.org/'.
dol_escape_json($data[
'applicationCategory']).
'",';
649 if (!empty($data[
'ratingcount'])) {
652 "@type": "AggregateRating",
653 "ratingValue": "'.dol_escape_json($data[
'ratingvalue']).
'",
660 "price": "'.dol_escape_json($data[
'price']).
'",
661 "priceCurrency": "'.
dol_escape_json($data[
'currency'] ? $data[
'currency'] : $conf->currency).
'"
664 $ret .=
'</script>'.
"\n";
665 } elseif ($type ==
'organization') {
666 $companyname = $mysoc->name;
669 $ret =
'<!-- Add structured data for organization -->'.
"\n";
670 $ret .=
'<script nonce="'.getNonce().
'" type="application/ld+json">'.
"\n";
672 "@context": "https://schema.org",
673 "@type": "Organization",
674 "name": "'.dol_escape_json($data[
'name'] ? $data[
'name'] : $companyname).
'",
676 "logo": "'.($data[
'logo'] ?
dol_escape_json($data[
'logo']) :
'/wrapper.php?modulepart=mycompany&file=logos%2F'.urlencode($mysoc->logo)).
'",
678 "@type": "ContactPoint",
679 "contactType": "Contact",
680 "email": "'.
dol_escape_json($data[
'email'] ? $data[
'email'] : $mysoc->email).
'"
682 if (is_array($mysoc->socialnetworks) && count($mysoc->socialnetworks) > 0) {
684 $ret .=
'"sameAs": [';
686 foreach ($mysoc->socialnetworks as $key => $value) {
687 if ($key ==
'linkedin') {
688 $ret .=
'"https://www.'.$key.
'.com/company/'.
dol_escape_json($value).
'"';
689 } elseif ($key ==
'youtube') {
695 if ($i < count($mysoc->socialnetworks)) {
702 $ret .=
'</script>'.
"\n";
703 } elseif ($type ==
'blogpost') {
704 if (!empty($websitepage->author_alias)) {
709 $pageurl = $websitepage->pageurl;
710 $title = $websitepage->title;
711 $image = $websitepage->image;
712 $companyname = $mysoc->name;
713 $description = $websitepage->description;
715 $pageurl = str_replace(
'__WEBSITE_KEY__', $website->ref, $pageurl);
716 $title = str_replace(
'__WEBSITE_KEY__', $website->ref, $title);
717 $image =
'/medias'.(preg_match(
'/^\//', $image) ?
'' :
'/').str_replace(
'__WEBSITE_KEY__', $website->ref, $image);
718 $companyname = str_replace(
'__WEBSITE_KEY__', $website->ref, $companyname);
719 $description = str_replace(
'__WEBSITE_KEY__', $website->ref, $description);
721 $ret =
'<!-- Add structured data for blog post -->'.
"\n";
722 $ret .=
'<script nonce="'.getNonce().
'" type="application/ld+json">'.
"\n";
724 "@context": "https://schema.org",
725 "@type": "NewsArticle",
726 "mainEntityOfPage": {
728 "@id": "'.dol_escape_json($pageurl).
'"
734 "dateCreated": "'.
dol_print_date($websitepage->date_creation,
'dayhourrfc').
'",
735 "datePublished": "'.
dol_print_date($websitepage->date_creation,
'dayhourrfc').
'",
736 "dateModified": "'.
dol_print_date($websitepage->date_modification,
'dayhourrfc').
'",
742 "@type": "Organization",
745 "@type": "ImageObject",
746 "url": "/wrapper.php?modulepart=mycompany&file=logos%2F'.urlencode($mysoc->logo).
'"
749 if ($websitepage->keywords) {
750 $ret .=
'"keywords": [';
752 $arrayofkeywords = explode(
',', $websitepage->keywords);
753 foreach ($arrayofkeywords as $keyword) {
754 $ret .=
'"'.dol_escape_json($keyword).
'"';
756 if ($i < count($arrayofkeywords)) {
762 $ret .=
'"description": "'.dol_escape_json($description).
'"';
763 $ret .=
"\n".
'}'.
"\n";
764 $ret .=
'</script>'.
"\n";
766 $ret =
'<!-- no structured data inserted inline inside blogpost because no author_alias defined -->'.
"\n";
768 } elseif ($type ==
'product') {
769 $ret =
'<!-- Add structured data for product -->'.
"\n";
770 $ret .=
'<script nonce="'.getNonce().
'" type="application/ld+json">'.
"\n";
772 "@context": "https://schema.org/",
774 "name": "'.dol_escape_json($data[
'label']).
'",
791 "url": "https://example.com/anvil",
792 "priceCurrency": "'.
dol_escape_json($data[
'currency'] ? $data[
'currency'] : $conf->currency).
'",
794 "itemCondition": "https://schema.org/UsedCondition",
795 "availability": "https://schema.org/InStock",
797 "@type": "Organization",
802 $ret .=
'</script>'.
"\n";
803 } elseif ($type ==
'qa') {
804 $ret =
'<!-- Add structured data for QA -->'.
"\n";
805 $ret .=
'<script nonce="'.getNonce().
'" type="application/ld+json">'.
"\n";
807 "@context": "https://schema.org/",
811 "name": "'.dol_escape_json($data[
'name']).
'",
828 $ret .=
'</script>'.
"\n";
841 global $conf, $db, $hookmanager, $langs, $mysoc, $user, $website, $websitepage, $weblangs;
845 if ($website->virtualhost) {
846 $pageurl = $websitepage->pageurl;
847 $title = $websitepage->title;
848 $image = $websitepage->image;
849 $companyname = $mysoc->name;
850 $description = $websitepage->description;
852 $pageurl = str_replace(
'__WEBSITE_KEY__', $website->ref, $pageurl);
853 $title = str_replace(
'__WEBSITE_KEY__', $website->ref, $title);
854 $image =
'/medias'.(preg_match(
'/^\//', $image) ?
'' :
'/').str_replace(
'__WEBSITE_KEY__', $website->ref, $image);
855 $companyname = str_replace(
'__WEBSITE_KEY__', $website->ref, $companyname);
856 $description = str_replace(
'__WEBSITE_KEY__', $website->ref, $description);
859 if ($websitepage->lang) {
860 $shortlangcode = substr($websitepage->lang, 0, 2);
862 if (empty($shortlangcode)) {
863 $shortlangcode = substr($website->lang, 0, 2);
866 $fullurl = $website->virtualhost.
'/'.$websitepage->pageurl.
'.php';
867 $canonicalurl = $website->virtualhost.(($websitepage->id == $website->fk_default_home) ?
'/' : (($shortlangcode != substr($website->lang, 0, 2) ?
'/'.$shortlangcode :
'').
'/'.$websitepage->pageurl.
'.php'));
868 $hashtags = trim(join(
' #', array_map(
'trim', explode(
',', $websitepage->keywords))));
871 $out .=
'<meta name="og:type" content="website">'.
"\n";
872 $out .=
'<meta name="og:title" content="'.$websitepage->title.
'">'.
"\n";
873 if ($websitepage->image) {
874 $out .=
'<meta name="og:image" content="'.$website->virtualhost.$image.
'">'.
"\n";
876 $out .=
'<meta name="og:url" content="'.$canonicalurl.
'">'.
"\n";
879 $out .=
'<meta name="twitter:card" content="summary">'.
"\n";
880 if (!empty($params) && !empty($params[
'twitter_account'])) {
881 $out .=
'<meta name="twitter:site" content="@'.$params[
'twitter_account'].
'">'.
"\n";
882 $out .=
'<meta name="twitter:creator" content="@'.$params[
'twitter_account'].
'">'.
"\n";
884 $out .=
'<meta name="twitter:title" content="'.$websitepage->title.
'">'.
"\n";
885 if ($websitepage->description) {
886 $out .=
'<meta name="twitter:description" content="'.$websitepage->description.
'">'.
"\n";
888 if ($websitepage->image) {
889 $out .=
'<meta name="twitter:image" content="'.$website->virtualhost.$image.
'">'.
"\n";
915 global $conf, $db, $hookmanager, $langs, $mysoc, $user, $website, $websitepage, $weblangs;
917 $out =
'<!-- section for social network sharing of page -->'.
"\n";
919 if ($website->virtualhost) {
920 $fullurl = $website->virtualhost.
'/'.$websitepage->pageurl.
'.php';
921 $hashtags = trim(join(
' #', array_map(
'trim', explode(
',', $websitepage->keywords))));
923 $out .=
'<div class="dol-social-share">'.
"\n";
926 $out .=
'<div class="dol-social-share-tw">'.
"\n";
927 $out .=
'<a href="https://twitter.com/share" class="twitter-share-button" data-url="'.$fullurl.
'" data-text="'.
dol_escape_htmltag($websitepage->description).
'" data-lang="'.$websitepage->lang.
'" data-size="small" data-related="" data-hashtags="'.preg_replace(
'/^#/',
'', $hashtags).
'" data-count="horizontal">Tweet</a>';
928 $out .=
'<script nonce="'.getNonce().
'">!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?\'http\':\'https\';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+\'://platform.twitter.com/widgets.js\';fjs.parentNode.insertBefore(js,fjs);}}(document, \'script\', \'twitter-wjs\');</script>';
929 $out .=
'</div>'.
"\n";
932 $out .=
'<div class="dol-social-share-reddit">'.
"\n";
933 $out .=
'<a href="https://www.reddit.com/submit" target="_blank" rel="noopener noreferrer external" onclick="window.location = \'https://www.reddit.com/submit?url='.$fullurl.
'\';
return false">';
934 $out .= '<span class="dol-social-share-reddit-span
">Reddit</span>';
936 $out .= '</div>'."\n
";
939 $out .= '<div class="dol-social-share-fbl
">'."\n
";
940 $out .= '<div id="fb-root
"></div>'."\n
";
941 $out .= '<script nonce="'.getNonce().'">(function(d, s, id) {
942 var js, fjs = d.getElementsByTagName(s)[0];
943 if (d.getElementById(id)) return;
944 js = d.createElement(s); js.id = id;
946 fjs.parentNode.insertBefore(js, fjs);
947 }(document, \
'script\', \'facebook-jssdk\'));</script>
950 layout="button_count"
955 action="like" ></fb:like>'.
"\n";
956 $out .=
'</div>'.
"\n";
958 $out .=
"\n</div>\n";
960 $out .=
'<!-- virtual host not defined in CMS. No way to add sharing buttons -->'.
"\n";
962 $out .=
'<!-- section end for social network sharing of page -->'.
"\n";
982function getPagesFromSearchCriterias($type, $algo, $searchstring, $max = 25, $sortfield =
'date_creation', $sortorder =
'DESC', $langcode =
'', $otherfilters =
'null', $status = 1)
984 global $conf, $db, $hookmanager, $langs, $mysoc, $user, $website, $websitepage, $weblangs;
987 $arrayresult = array(
'code'=>
'',
'list'=>array());
989 if (!is_object($weblangs)) {
993 if (empty($searchstring) && empty($type) && empty($langcode) && empty($otherfilters)) {
995 $arrayresult[
'code'] =
'KO';
996 $arrayresult[
'message'] = $weblangs->trans(
"EmptySearchString");
997 } elseif ($searchstring &&
dol_strlen($searchstring) < 2) {
998 $weblangs->load(
"errors");
1000 $arrayresult[
'code'] =
'KO';
1001 $arrayresult[
'message'] = $weblangs->trans(
"ErrorSearchCriteriaTooSmall");
1003 $tmparrayoftype = explode(
',', $type);
1017 if (!$error && (empty($max) || ($found < $max)) && (preg_match(
'/meta/', $algo) || preg_match(
'/content/', $algo))) {
1018 include_once DOL_DOCUMENT_ROOT.
'/website/class/websitepage.class.php';
1020 $sql =
'SELECT wp.rowid FROM '.MAIN_DB_PREFIX.
'website_page as wp';
1021 if (is_array($otherfilters) && !empty($otherfilters[
'category'])) {
1022 $sql .=
', '.MAIN_DB_PREFIX.
'categorie_website_page as cwp';
1024 $sql .=
" WHERE wp.fk_website = ".((int) $website->id);
1026 $sql .=
" AND wp.status = ".((int) $status);
1029 $sql .=
" AND wp.lang = '".$db->escape($langcode).
"'";
1032 $tmparrayoftype = explode(
',', $type);
1034 foreach ($tmparrayoftype as $tmptype) {
1035 $typestring .= ($typestring ?
", " :
"").
"'".$db->escape(trim($tmptype)).
"'";
1037 $sql .=
" AND wp.type_container IN (".$db->sanitize($typestring, 1).
")";
1041 if (preg_match(
'/meta/', $algo)) {
1042 $searchalgo .= ($searchalgo ?
' OR ' :
'').
"wp.title LIKE '%".$db->escape($db->escapeforlike($searchstring)).
"%' OR wp.description LIKE '%".$db->escape($db->escapeforlike($searchstring)).
"%'";
1043 $searchalgo .= ($searchalgo ?
' OR ' :
'').
"wp.keywords LIKE '".$db->escape($db->escapeforlike($searchstring)).
",%' OR wp.keywords LIKE '% ".$db->escape($db->escapeforlike($searchstring)).
"%'";
1045 if (preg_match(
'/content/', $algo)) {
1046 $searchalgo .= ($searchalgo ?
' OR ' :
'').
"wp.content LIKE '%".$db->escape($db->escapeforlike($searchstring)).
"%'";
1048 $sql .= $searchalgo;
1049 if (is_array($otherfilters) && !empty($otherfilters[
'category'])) {
1050 $sql .=
' AND cwp.fk_website_page = wp.rowid AND cwp.fk_categorie = '.((int) $otherfilters[
'category']);
1053 $sql .= $db->order($sortfield, $sortorder);
1054 $sql .= $db->plimit($max);
1057 $resql = $db->query($sql);
1061 while (($obj = $db->fetch_object($resql)) && ($i < $max || $max == 0)) {
1062 if ($obj->rowid > 0) {
1064 $tmpwebsitepage->fetch($obj->rowid);
1065 if ($tmpwebsitepage->id > 0) {
1066 $arrayresult[
'list'][$obj->rowid] = $tmpwebsitepage;
1074 $arrayresult[
'code'] = $db->lasterrno();
1075 $arrayresult[
'message'] = $db->lasterror();
1081 if (!$error && (empty($max) || ($found < $max)) && (preg_match(
'/sitefiles/', $algo))) {
1082 global $dolibarr_main_data_root;
1084 $pathofwebsite = $dolibarr_main_data_root.($conf->entity > 1 ?
'/'.$conf->entity :
'').
'/website/'.$website->ref;
1085 $filehtmlheader = $pathofwebsite.
'/htmlheader.html';
1086 $filecss = $pathofwebsite.
'/styles.css.php';
1087 $filejs = $pathofwebsite.
'/javascript.js.php';
1088 $filerobot = $pathofwebsite.
'/robots.txt';
1089 $filehtaccess = $pathofwebsite.
'/.htaccess';
1090 $filemanifestjson = $pathofwebsite.
'/manifest.json.php';
1091 $filereadme = $pathofwebsite.
'/README.md';
1093 $filecontent = file_get_contents($filehtmlheader);
1094 if ((empty($max) || ($found < $max)) && preg_match(
'/'.preg_quote($searchstring,
'/').
'/', $filecontent)) {
1095 $arrayresult[
'list'][] = array(
'type'=>
'website_htmlheadercontent');
1098 $filecontent = file_get_contents($filecss);
1099 if ((empty($max) || ($found < $max)) && preg_match(
'/'.preg_quote($searchstring,
'/').
'/', $filecontent)) {
1100 $arrayresult[
'list'][] = array(
'type'=>
'website_csscontent');
1103 $filecontent = file_get_contents($filejs);
1104 if ((empty($max) || ($found < $max)) && preg_match(
'/'.preg_quote($searchstring,
'/').
'/', $filecontent)) {
1105 $arrayresult[
'list'][] = array(
'type'=>
'website_jscontent');
1108 $filerobot = file_get_contents($filerobot);
1109 if ((empty($max) || ($found < $max)) && preg_match(
'/'.preg_quote($searchstring,
'/').
'/', $filecontent)) {
1110 $arrayresult[
'list'][] = array(
'type'=>
'website_robotcontent');
1118 $arrayresult[
'code'] =
'OK';
1119 if (empty($arrayresult[
'list'])) {
1120 $arrayresult[
'code'] =
'KO';
1121 $arrayresult[
'message'] = $weblangs->trans(
"NoRecordFound");
1125 $arrayresult[
'code'] =
'KO';
1126 $arrayresult[
'message'] =
'No supported algorithm found';
1130 return $arrayresult;
1147function getAllImages($object, $objectpage, $urltograb, &$tmp, &$action, $modifylinks = 0, $grabimages = 1, $grabimagesinto =
'subpage')
1153 dol_syslog(
"Call getAllImages with grabimagesinto=".$grabimagesinto);
1155 $alreadygrabbed = array();
1157 if (preg_match(
'/\/$/', $urltograb)) {
1160 $urltograb = dirname($urltograb);
1164 preg_match_all(
'/<img([^\.\/]+)src="([^>"]+)"([^>]*)>/i', $tmp, $regs);
1166 foreach ($regs[0] as $key => $val) {
1167 if (preg_match(
'/^data:image/i', $regs[2][$key])) {
1171 if (preg_match(
'/^\//', $regs[2][$key])) {
1173 $urltograbbis = $urltograbdirrootwithoutslash.$regs[2][$key];
1175 $urltograbbis = $urltograb.
'/'.$regs[2][$key];
1178 $linkwithoutdomain = $regs[2][$key];
1179 $dirforimages =
'/'.$objectpage->pageurl;
1180 if ($grabimagesinto ==
'root') {
1185 $filetosave = $conf->medias->multidir_output[$conf->entity].
'/image/'.$object->ref.$dirforimages.(preg_match(
'/^\//', $regs[2][$key]) ?
'' :
'/').$regs[2][$key];
1186 if (preg_match(
'/^http/', $regs[2][$key])) {
1187 $urltograbbis = $regs[2][$key];
1188 $linkwithoutdomain = preg_replace(
'/^https?:\/\/[^\/]+\//i',
'', $regs[2][$key]);
1189 $filetosave = $conf->medias->multidir_output[$conf->entity].
'/image/'.$object->ref.$dirforimages.(preg_match(
'/^\//', $linkwithoutdomain) ?
'' :
'/').$linkwithoutdomain;
1191 $filename =
'image/'.$object->ref.$dirforimages.(preg_match(
'/^\//', $linkwithoutdomain) ?
'' :
'/').$linkwithoutdomain;
1194 $filetosave = preg_replace(
'/\/[^\/]+\/\.\./',
'', $filetosave);
1195 $filename = preg_replace(
'/\/[^\/]+\/\.\./',
'', $filename);
1201 if (empty($alreadygrabbed[$urltograbbis])) {
1203 $tmpgeturl =
getURLContent($urltograbbis,
'GET',
'', 1, array(), array(
'http',
'https'), 0);
1204 if ($tmpgeturl[
'curl_error_no']) {
1206 setEventMessages(
'Error getting '.$urltograbbis.
': '.$tmpgeturl[
'curl_error_msg'],
null,
'errors');
1208 } elseif ($tmpgeturl[
'http_code'] !=
'200') {
1210 setEventMessages(
'Error getting '.$urltograbbis.
': '.$tmpgeturl[
'http_code'],
null,
'errors');
1213 $alreadygrabbed[$urltograbbis] = 1;
1217 $fp = fopen($filetosave,
"w");
1218 fputs($fp, $tmpgeturl[
'content']);
1226 $tmp = preg_replace(
'/'.preg_quote($regs[0][$key],
'/').
'/i',
'<img'.$regs[1][$key].
'src="'.DOL_URL_ROOT.
'/viewimage.php?modulepart=medias&file='.$filename.
'"'.$regs[3][$key].
'>', $tmp);
1231 preg_match_all(
'/background([^\.\/\(;]+)url\([\"\']?([^\)\"\']*)[\"\']?\)/i', $tmp, $regs);
1233 foreach ($regs[0] as $key => $val) {
1234 if (preg_match(
'/^data:image/i', $regs[2][$key])) {
1238 if (preg_match(
'/^\//', $regs[2][$key])) {
1240 $urltograbbis = $urltograbdirrootwithoutslash.$regs[2][$key];
1242 $urltograbbis = $urltograb.
'/'.$regs[2][$key];
1245 $linkwithoutdomain = $regs[2][$key];
1247 $dirforimages =
'/'.$objectpage->pageurl;
1248 if ($grabimagesinto ==
'root') {
1252 $filetosave = $conf->medias->multidir_output[$conf->entity].
'/image/'.$object->ref.$dirforimages.(preg_match(
'/^\//', $regs[2][$key]) ?
'' :
'/').$regs[2][$key];
1254 if (preg_match(
'/^http/', $regs[2][$key])) {
1255 $urltograbbis = $regs[2][$key];
1256 $linkwithoutdomain = preg_replace(
'/^https?:\/\/[^\/]+\//i',
'', $regs[2][$key]);
1257 $filetosave = $conf->medias->multidir_output[$conf->entity].
'/image/'.$object->ref.$dirforimages.(preg_match(
'/^\//', $linkwithoutdomain) ?
'' :
'/').$linkwithoutdomain;
1260 $filename =
'image/'.$object->ref.$dirforimages.(preg_match(
'/^\//', $linkwithoutdomain) ?
'' :
'/').$linkwithoutdomain;
1263 $filetosave = preg_replace(
'/\/[^\/]+\/\.\./',
'', $filetosave);
1264 $filename = preg_replace(
'/\/[^\/]+\/\.\./',
'', $filename);
1270 if (empty($alreadygrabbed[$urltograbbis])) {
1272 $tmpgeturl =
getURLContent($urltograbbis,
'GET',
'', 1, array(), array(
'http',
'https'), 0);
1273 if ($tmpgeturl[
'curl_error_no']) {
1275 setEventMessages(
'Error getting '.$urltograbbis.
': '.$tmpgeturl[
'curl_error_msg'],
null,
'errors');
1277 } elseif ($tmpgeturl[
'http_code'] !=
'200') {
1279 setEventMessages(
'Error getting '.$urltograbbis.
': '.$tmpgeturl[
'http_code'],
null,
'errors');
1282 $alreadygrabbed[$urltograbbis] = 1;
1286 $fp = fopen($filetosave,
"w");
1287 fputs($fp, $tmpgeturl[
'content']);
1295 $tmp = preg_replace(
'/'.preg_quote($regs[0][$key],
'/').
'/i',
'background'.$regs[1][$key].
'url("'.DOL_URL_ROOT.
'/viewimage.php?modulepart=medias&file='.$filename.
'")', $tmp);
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dolChmod($filepath, $newmask='')
Change mod of a file.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_escape_json($stringtoescape)
Returns text escaped for inclusion into javascript code.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_getdate($timestamp, $fast=false, $forcetimezone='')
Return an array with locale date info.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
getRootURLFromURL($url)
Function root url from a long url For example: https://www.abc.mydomain.com/dir/page....
getURLContent($url, $postorget='GET', $param='', $followlocation=1, $addheaders=array(), $allowedschemes=array('http', 'https'), $localurl=0, $ssl_verifypeer=-1)
Function to get a content from an URL (use proxy if proxy defined).
getAllImages($object, $objectpage, $urltograb, &$tmp, &$action, $modifylinks=0, $grabimages=1, $grabimagesinto='subpage')
Download all images found into page content $tmp.
getPagesFromSearchCriterias($type, $algo, $searchstring, $max=25, $sortfield='date_creation', $sortorder='DESC', $langcode='', $otherfilters='null', $status=1)
Return list of containers object that match a criteria.
dolWebsiteReplacementOfLinks($website, $content, $removephppart=0, $contenttype='html', $containerid='')
Convert a page content to have correct links (based on DOL_URL_ROOT) into an html content.
dolStripPhpCode($str, $replacewith='')
Remove PHP code part from a string.
getStructuredData($type, $data=array())
Return HTML content to add structured data for an article, news or Blog Post.
dolWebsiteIncrementCounter($websiteid, $websitepagetype, $websitepageid)
Increase the website counter of page access.
dolReplaceSmileyCodeWithUTF8($content)
Converts smiley string into the utf8 sequence.
includeContainer($containerref)
Clean an HTML page to report only content, so we can include it into another page.
dolKeepOnlyPhpCode($str)
Keep only PHP code part from a HTML string page.
getSocialNetworkSharingLinks()
Return HTML content to add structured data for an article, news or Blog Post.
redirectToContainer($containerref, $containeraliasalt='', $containerid=0, $permanent=0)
Format img tags to introduce viewimage on img src.
dolWebsiteOutput($content, $contenttype='html', $containerid='')
Render a string of an HTML content and output it.
getSocialNetworkHeaderCards($params=null)
Return HTML content to add as header card for an article, news or Blog Post or home page.