34 $str = str_replace(
'<?=',
'<?php', $str);
39 $parts = explode(
'<?php', $str);
42 foreach ($parts as $part) {
49 $partlings = explode(
'?>', $part);
50 if (!empty($partlings)) {
53 if (count($partlings) > 1) {
59 $newstr .=
'<span phptag>'.$replacewith.
'</span>'.implode(
'', $partlings);
76 $str = str_replace(
'<?=',
'<?php', $str);
81 $parts = explode(
'<?php', $str);
84 foreach ($parts as $part) {
91 $partlings = explode(
'?>', $part, 2);
92 if (!empty($partlings)) {
93 $newstr .= $partlings[0].
'?>';
95 $newstr .= $part.
'?>';
118 dol_syslog(
'dolWebsiteReplacementOfLinks start (contenttype='.$contenttype.
" containerid=".$containerid.
" USEDOLIBARREDITOR=".(defined(
'USEDOLIBARREDITOR') ?
'1' :
'').
" USEDOLIBARRSERVER=".(defined(
'USEDOLIBARRSERVER') ?
'1' :
'').
')', LOG_DEBUG);
122 $replacewith =
'...php...';
123 if ($removephppart) {
126 $content = preg_replace(
'/value="<\?php((?!\?>).)*\?>\n*/ims',
'value="'.$replacewith.
'"', $content);
128 $replacewith =
'"callto=#';
129 if ($removephppart) {
132 $content = preg_replace(
'/"callto:<\?php((?!\?>).)*\?>\n*/ims', $replacewith, $content);
134 $replacewith =
'"mailto=#';
135 if ($removephppart) {
138 $content = preg_replace(
'/"mailto:<\?php((?!\?>).)*\?>\n*/ims', $replacewith, $content);
140 $replacewith =
'src="php';
141 if ($removephppart) {
144 $content = preg_replace(
'/src="<\?php((?!\?>).)*\?>\n*/ims', $replacewith, $content);
146 $replacewith =
'href="php';
147 if ($removephppart) {
150 $content = preg_replace(
'/href="<\?php((?!\?>).)*\?>\n*/ims', $replacewith, $content);
153 $replacewith =
'...php...';
154 if ($removephppart) {
165 $content = str_replace(
'href="styles.css.php',
'href="!~!~!~styles.css.php', $content);
166 $content = str_replace(
'href="http',
'href="!~!~!~http', $content);
167 $content = str_replace(
'href="//',
'href="!~!~!~//', $content);
168 $content = str_replace(
'src="viewimage.php',
'src="!~!~!~/viewimage.php', $content);
169 $content = str_replace(
'src="/viewimage.php',
'src="!~!~!~/viewimage.php', $content);
170 $content = str_replace(
'src="'.DOL_URL_ROOT.
'/viewimage.php',
'src="!~!~!~'.DOL_URL_ROOT.
'/viewimage.php', $content);
171 $content = str_replace(
'href="document.php',
'href="!~!~!~/document.php', $content);
172 $content = str_replace(
'href="/document.php',
'href="!~!~!~/document.php', $content);
173 $content = str_replace(
'href="'.DOL_URL_ROOT.
'/document.php',
'href="!~!~!~'.DOL_URL_ROOT.
'/document.php', $content);
176 $content = preg_replace(
'/(href=")\/(#[^\"<>]*)?\"/',
'\1!~!~!~'.DOL_URL_ROOT.
'/website/index.php?website='.$website->ref.
'&pageid='.$website->fk_default_home.
'\2"', $content, -1, $nbrep);
178 $content = preg_replace(
'/(href=")\/?([^:\"\!]*)\.php(#[^\"<>]*)?\"/',
'\1!~!~!~'.DOL_URL_ROOT.
'/website/index.php?website='.$website->ref.
'&pageref=\2\3"', $content, -1, $nbrep);
180 $content = preg_replace(
'/(href=")\/?([^:\"\!]*)\.php\?([^#\"<>]*)(#[^\"<>]*)?\"/',
'\1!~!~!~'.DOL_URL_ROOT.
'/website/index.php?website='.$website->ref.
'&pageref=\2&\3\4"', $content, -1, $nbrep);
183 $content = preg_replace(
'/url\((["\']?)\/?medias\//',
'url(\1!~!~!~'.DOL_URL_ROOT.
'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
184 $content = preg_replace(
'/data-slide-bg=(["\']?)\/?medias\//',
'data-slide-bg=\1!~!~!~'.DOL_URL_ROOT.
'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
188 $content = preg_replace(
'/(<img[^>]*src=")\/?medias\//',
'\1!~!~!~'.DOL_URL_ROOT.
'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
190 $content = preg_replace(
'/(<img[^>]*src=")\/?([^:\"\!]+)\"/',
'\1!~!~!~'.DOL_URL_ROOT.
'/viewimage.php?modulepart=medias&file=\2"', $content, -1, $nbrep);
192 $content = preg_replace(
'/(<img[^>]*src=")(\/?viewimage\.php)/',
'\1!~!~!~'.DOL_URL_ROOT.
'/viewimage.php', $content, -1, $nbrep);
195 $content = preg_replace(
'/(action=")\/?([^:\"]*)(\.php\")/',
'\1!~!~!~'.DOL_URL_ROOT.
'/website/index.php?website='.$website->ref.
'&pageref=\2"', $content, -1, $nbrep);
198 $content = preg_replace(
'/(href=")(\/?document\.php\?[^\"]*modulepart=[^\"]*)(\")/',
'\1!~!~!~'.DOL_URL_ROOT.
'\2\3', $content, -1, $nbrep);
199 $content = preg_replace(
'/(src=")(\/?document\.php\?[^\"]*modulepart=[^\"]*)(\")/',
'\1!~!~!~'.DOL_URL_ROOT.
'\2\3', $content, -1, $nbrep);
202 $content = preg_replace(
'/(url\(")(\/?viewimage\.php\?[^\"]*modulepart=[^\"]*)(\")/',
'\1!~!~!~'.DOL_URL_ROOT.
'\2\3', $content, -1, $nbrep);
205 $content = str_replace(
'src="!~!~!~/viewimage.php',
'src="!~!~!~'.DOL_URL_ROOT.
'/viewimage.php', $content);
206 $content = str_replace(
'href="!~!~!~/document.php',
'href="!~!~!~'.DOL_URL_ROOT.
'/document.php', $content);
208 $content = str_replace(
'!~!~!~',
'', $content);
210 dol_syslog(
'dolWebsiteReplacementOfLinks end', LOG_DEBUG);
225 ":face_with_tears_of_joy:" =>
"\xF0\x9F\x98\x82",
226 ":grinning_face_with_smiling_eyes:" =>
"\xF0\x9F\x98\x81",
227 ":smiling_face_with_open_mouth:" =>
"\xF0\x9F\x98\x83",
228 ":smiling_face_with_open_mouth_and_cold_sweat:" =>
"\xF0\x9F\x98\x85",
229 ":smiling_face_with_open_mouth_and_tightly_closed_eyes:" =>
"\xF0\x9F\x98\x86",
230 ":winking_face:" =>
"\xF0\x9F\x98\x89",
231 ":smiling_face_with_smiling_eyes:" =>
"\xF0\x9F\x98\x8A",
232 ":face_savouring_delicious_food:" =>
"\xF0\x9F\x98\x8B",
233 ":relieved_face:" =>
"\xF0\x9F\x98\x8C",
234 ":smiling_face_with_heart_shaped_eyes:" =>
"\xF0\x9F\x98\x8D",
235 ":smiling_face_with_sunglasses:" =>
"\xF0\x9F\x98\x8E",
236 ":smirking_face:" =>
"\xF0\x9F\x98\x8F",
237 ":neutral_face:" =>
"\xF0\x9F\x98\x90",
238 ":expressionless_face:" =>
"\xF0\x9F\x98\x91",
239 ":unamused_face:" =>
"\xF0\x9F\x98\x92",
240 ":face_with_cold_sweat:" =>
"\xF0\x9F\x98\x93",
241 ":pensive_face:" =>
"\xF0\x9F\x98\x94",
242 ":confused_face:" =>
"\xF0\x9F\x98\x95",
243 ":confounded_face:" =>
"\xF0\x9F\x98\x96",
244 ":kissing_face:" =>
"\xF0\x9F\x98\x97",
245 ":face_throwing_a_kiss:" =>
"\xF0\x9F\x98\x98",
246 ":kissing_face_with_smiling_eyes:" =>
"\xF0\x9F\x98\x99",
247 ":kissing_face_with_closed_eyes:" =>
"\xF0\x9F\x98\x9A",
248 ":face_with_stuck_out_tongue:" =>
"\xF0\x9F\x98\x9B",
249 ":face_with_stuck_out_tongue_and_winking_eye:" =>
"\xF0\x9F\x98\x9C",
250 ":face_with_stuck_out_tongue_and_tightly_closed_eyes:" =>
"\xF0\x9F\x98\x9D",
251 ":disappointed_face:" =>
"\xF0\x9F\x98\x9E",
252 ":worried_face:" =>
"\xF0\x9F\x98\x9F",
253 ":angry_face:" =>
"\xF0\x9F\x98\xA0",
254 ":face_with_symbols_on_mouth:" =>
"\xF0\x9F\x98\xA1",
256 foreach ($map as $key => $value) {
257 $content = str_replace($key, $value, $content);
275 global $db, $langs, $conf, $user;
276 global $dolibarr_main_url_root, $dolibarr_main_data_root;
278 global $includehtmlcontentopened;
282 dol_syslog(
"dolWebsiteOutput start - contenttype=".$contenttype.
" containerid=".$containerid.
" USEDOLIBARREDITOR=".(defined(
'USEDOLIBARREDITOR') ?
'1' :
'').
" USEDOLIBARRSERVER=".(defined(
'USEDOLIBARRSERVER') ?
'1' :
'').
' includehtmlcontentopened='.$includehtmlcontentopened);
287 $urlwithouturlroot = preg_replace(
'/'.preg_quote(DOL_URL_ROOT,
'/').
'$/i',
'', trim($dolibarr_main_url_root));
288 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
291 if (defined(
'USEDOLIBARREDITOR')) {
293 if ($contenttype ==
'html') {
294 $content = preg_replace(
'/<head>.*<\/head>/ims',
'', $content);
295 $content = preg_replace(
'/^.*<body(\s[^>]*)*>/ims',
'', $content);
296 $content = preg_replace(
'/<\/body(\s[^>]*)*>.*$/ims',
'', $content);
298 } elseif (defined(
'USEDOLIBARRSERVER')) {
299 $content = str_replace(
'<link rel="stylesheet" href="/styles.css',
'<link rel="stylesheet" href="styles.css', $content);
302 $content = str_replace(
'href="styles.css.php',
'href="!~!~!~styles.css.php', $content);
303 $content = str_replace(
'href="http',
'href="!~!~!~http', $content);
304 $content = str_replace(
'href="//',
'href="!~!~!~//', $content);
305 $content = str_replace(array(
'src="viewimage.php',
'src="/viewimage.php'),
'src="!~!~!~/viewimage.php', $content);
306 $content = str_replace(
'src="'.DOL_URL_ROOT.
'/viewimage.php',
'src="!~!~!~'.DOL_URL_ROOT.
'/viewimage.php', $content);
307 $content = str_replace(array(
'href="document.php',
'href="/document.php'),
'href="!~!~!~/document.php', $content);
308 $content = str_replace(
'href="'.DOL_URL_ROOT.
'/document.php',
'href="!~!~!~'.DOL_URL_ROOT.
'/document.php', $content);
311 $content = preg_replace(
'/(href=")\/\"/',
'\1!~!~!~'.DOL_URL_ROOT.
'/public/website/index.php?website='.$website->ref.
'"', $content, -1, $nbrep);
313 $content = preg_replace(
'/(href=")\/?([^:\"\!]*)\.php(#[^\"<>]*)?\"/',
'\1!~!~!~'.DOL_URL_ROOT.
'/public/website/index.php?website='.$website->ref.
'&pageref=\2\3"', $content, -1, $nbrep);
317 $content = preg_replace(
'/(href=")\/?([^:\"\!]*)\.php\?([^#\"<>]*)(#[^\"<>]*)?\"/',
'\1!~!~!~'.DOL_URL_ROOT.
'/public/website/index.php?website='.$website->ref.
'&pageref=\2&\3\4"', $content, -1, $nbrep);
319 $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);
322 $content = preg_replace(
'/(href=")(\/?document\.php\?[^\"]*modulepart=[^\"]*)(\")/',
'\1!~!~!~'.DOL_URL_ROOT.
'\2\3', $content, -1, $nbrep);
323 $content = preg_replace(
'/(src=")(\/?document\.php\?[^\"]*modulepart=[^\"]*)(\")/',
'\1!~!~!~'.DOL_URL_ROOT.
'\2\3', $content, -1, $nbrep);
326 $content = preg_replace(
'/(href=")(\/?viewimage\.php\?[^\"]*modulepart=[^\"]*)(\")/',
'\1!~!~!~'.DOL_URL_ROOT.
'\2\3', $content, -1, $nbrep);
327 $content = preg_replace(
'/(src=")(\/?viewimage\.php\?[^\"]*modulepart=[^\"]*)(\")/',
'\1!~!~!~'.DOL_URL_ROOT.
'\2\3', $content, -1, $nbrep);
328 $content = preg_replace(
'/(url\(")(\/?viewimage\.php\?[^\"]*modulepart=[^\"]*)(\")/',
'\1!~!~!~'.DOL_URL_ROOT.
'\2\3', $content, -1, $nbrep);
331 $content = preg_replace(
'/url\((["\']?)\/?medias\//',
'url(\1!~!~!~'.DOL_URL_ROOT.
'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
332 $content = preg_replace(
'/data-slide-bg=(["\']?)\/?medias\//',
'data-slide-bg=\1!~!~!~'.DOL_URL_ROOT.
'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
336 $content = preg_replace(
'/(<img[^>]*src=")\/?medias\//',
'\1!~!~!~'.DOL_URL_ROOT.
'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
338 $content = preg_replace(
'/(<img[^>]*src=")\/?([^:\"\!]+)\"/',
'\1!~!~!~'.DOL_URL_ROOT.
'/viewimage.php?modulepart=medias&file=\2"', $content, -1, $nbrep);
340 $content = preg_replace(
'/(<img[^>]*src=")(\/?viewimage\.php)/',
'\1!~!~!~'.DOL_URL_ROOT.
'/viewimage.php', $content, -1, $nbrep);
343 $content = preg_replace(
'/(action=")\/?([^:\"]*)(\.php\")/',
'\1!~!~!~'.DOL_URL_ROOT.
'/public/website/index.php?website='.$website->ref.
'&pageref=\2"', $content, -1, $nbrep);
346 $content = str_replace(
'src="!~!~!~/viewimage.php',
'src="!~!~!~'.DOL_URL_ROOT.
'/viewimage.php', $content);
347 $content = str_replace(
'href="!~!~!~/document.php',
'href="!~!~!~'.DOL_URL_ROOT.
'/document.php', $content);
350 if (empty($includehtmlcontentopened)) {
351 $content = str_replace(
'!~!~!~',
'', $content);
355 $symlinktomediaexists = 1;
356 if ($website->virtualhost) {
357 $content = preg_replace(
'/^(<link[^>]*rel="canonical" href=")\//m',
'\1'.$website->virtualhost.
'/', $content, -1, $nbrep);
366 if (!$symlinktomediaexists) {
368 $content = preg_replace(
'/(<img[^>]*src=")\/?image\//',
'\1/wrapper.php?modulepart=medias&file=medias/image/', $content, -1, $nbrep);
369 $content = preg_replace(
'/(url\(["\']?)\/?image\//',
'\1/wrapper.php?modulepart=medias&file=medias/image/', $content, -1, $nbrep);
371 $content = preg_replace(
'/(<script[^>]*src=")[^\"]*document\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/',
'\1/wrapper.php\2modulepart=medias\3file=\4\5', $content, -1, $nbrep);
372 $content = preg_replace(
'/(<a[^>]*href=")[^\"]*document\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/',
'\1/wrapper.php\2modulepart=medias\3file=\4\5', $content, -1, $nbrep);
374 $content = preg_replace(
'/(<a[^>]*href=")[^\"]*viewimage\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/',
'\1/wrapper.php\2modulepart=medias\3file=\4\5', $content, -1, $nbrep);
375 $content = preg_replace(
'/(<img[^>]*src=")[^\"]*viewimage\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/',
'\1/wrapper.php\2modulepart=medias\3file=\4\5', $content, -1, $nbrep);
376 $content = preg_replace(
'/(url\(["\']?)[^\)]*viewimage\.php([^\)]*)modulepart=medias([^\)]*)file=([^\)]*)(["\']?\))/',
'\1/wrapper.php\2modulepart=medias\3file=\4\5', $content, -1, $nbrep);
378 $content = preg_replace(
'/(<a[^>]*href=")[^\"]*viewimage\.php([^\"]*)hashp=([^\"]*)("[^>]*>)/',
'\1/wrapper.php\2hashp=\3\4', $content, -1, $nbrep);
379 $content = preg_replace(
'/(<img[^>]*src=")[^\"]*viewimage\.php([^\"]*)hashp=([^\"]*)("[^>]*>)/',
'\1/wrapper.php\2hashp=\3\4', $content, -1, $nbrep);
380 $content = preg_replace(
'/(url\(["\']?)[^\)]*viewimage\.php([^\)]*)hashp=([^\)]*)(["\']?\))/',
'\1/wrapper.php\2hashp\3\4', $content, -1, $nbrep);
382 $content = preg_replace(
'/(<img[^>]*src=")[^\"]*viewimage\.php([^\"]*)modulepart=mycompany([^\"]*)file=([^\"]*)("[^>]*>)/',
'\1/wrapper.php\2modulepart=mycompany\3file=\4\5', $content, -1, $nbrep);
385 $content = preg_replace(
'/(<img[^>]*src=")\/?viewimage\.php/',
'\1/wrapper.php', $content, -1, $nbrep);
386 $content = preg_replace(
'/(<a[^>]*href=")\/?documents\.php/',
'\1/wrapper.php', $content, -1, $nbrep);
389 $content = preg_replace(
'/(<img[^>]*src=")\/?image\//',
'\1/medias/image/', $content, -1, $nbrep);
390 $content = preg_replace(
'/(url\(["\']?)\/?image\//',
'\1/medias/image/', $content, -1, $nbrep);
392 $content = preg_replace(
'/(<script[^>]*src=")[^\"]*document\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/',
'\1/medias/\4\5', $content, -1, $nbrep);
393 $content = preg_replace(
'/(<a[^>]*href=")[^\"]*document\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/',
'\1/medias/\4\5', $content, -1, $nbrep);
395 $content = preg_replace(
'/(<a[^>]*href=")[^\"]*viewimage\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/',
'\1/medias/\4\5', $content, -1, $nbrep);
396 $content = preg_replace(
'/(<img[^>]*src=")[^\"]*viewimage\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/',
'\1/medias/\4\5', $content, -1, $nbrep);
397 $content = preg_replace(
'/(url\(["\']?)[^\)]*viewimage\.php([^\)]*)modulepart=medias([^\)]*)file=([^\)]*)(["\']?\))/',
'\1/medias/\4\5', $content, -1, $nbrep);
399 $content = preg_replace(
'/(<a[^>]*href=")[^\"]*viewimage\.php([^\"]*)hashp=([^\"]*)("[^>]*>)/',
'\1/wrapper.php\2hashp=\3\4', $content, -1, $nbrep);
400 $content = preg_replace(
'/(<img[^>]*src=")[^\"]*viewimage\.php([^\"]*)hashp=([^\"]*)("[^>]*>)/',
'\1/wrapper.php\2hashp=\3\4', $content, -1, $nbrep);
401 $content = preg_replace(
'/(url\(["\']?)[^\)]*viewimage\.php([^\)]*)hashp=([^\)]*)(["\']?\))/',
'\1/wrapper.php\2hashp=\3\4', $content, -1, $nbrep);
403 $content = preg_replace(
'/(<img[^>]*src=")[^\"]*viewimage\.php([^\"]*)modulepart=mycompany([^\"]*)file=([^\"]*)("[^>]*>)/',
'\1/wrapper.php\2modulepart=mycompany\3file=\4\5', $content, -1, $nbrep);
406 $content = preg_replace(
'/(<img[^>]*src=")\/?viewimage\.php/',
'\1/wrapper.php', $content, -1, $nbrep);
407 $content = preg_replace(
'/(<a[^>]*href=")\/?document\.php/',
'\1/wrapper.php', $content, -1, $nbrep);
411 if (!defined(
'USEDOLIBARREDITOR')) {
412 $content = str_replace(
' contenteditable="true"',
' contenteditable="false"', $content);
415 if (!empty($conf->global->WEBSITE_ADD_CSS_TO_BODY)) {
416 $content = str_replace(
'<body id="bodywebsite" class="bodywebsite',
'<body id="bodywebsite" class="bodywebsite '.$conf->global->WEBSITE_ADD_CSS_TO_BODY, $content);
465 global $db, $website;
471 if ($containeraliasalt) {
472 include_once DOL_DOCUMENT_ROOT.
'/website/class/websitepage.class.php';
474 $result = $tmpwebsitepage->fetch(0, $website->id,
'', $containeraliasalt);
476 $containerref = $tmpwebsitepage->pageurl;
478 print
"Error, page contains a redirect to the alternative alias '".$containeraliasalt.
"' that does not exists in web site (".$website->id.
" / ".$website->ref.
")";
483 if (defined(
'USEDOLIBARREDITOR')) {
487 $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.";
488 setEventMessages($text,
null,
'warnings',
'WEBSITEREDIRECTDISABLED'.$containerref);
492 if (defined(
'USEDOLIBARRSERVER')) {
494 if (!$containeraliasalt) {
495 include_once DOL_DOCUMENT_ROOT.
'/website/class/websitepage.class.php';
497 $result = $tmpwebsitepage->fetch(0, $website->id, $containerref);
498 unset($tmpwebsitepage);
501 $currenturi = $_SERVER[
"REQUEST_URI"];
503 if (preg_match(
'/&pageref=([^&]+)/', $currenturi, $regtmp)) {
504 if ($regtmp[0] == $containerref) {
505 print
"Error, page with uri '.$currenturi.' try a redirect to the same alias page '".$containerref.
"' in web site '".$website->ref.
"'";
508 $newurl = preg_replace(
'/&pageref=([^&]+)/',
'&pageref='.$containerref, $currenturi);
511 $newurl = $currenturi.
'&pageref='.urlencode($containerref);
516 $newurl =
'/'.$containerref.
'.php';
521 header(
"Status: 301 Moved Permanently",
false, 301);
523 header(
"Location: ".$newurl.(empty($_SERVER[
"QUERY_STRING"]) ?
'' :
'?'.$_SERVER[
"QUERY_STRING"]));
526 print
"Error, page contains a redirect to the alias page '".$containerref.
"' that does not exists in web site (".$website->id.
" / ".$website->ref.
")";
541 global $conf, $db, $hookmanager, $langs, $mysoc, $user, $website, $websitepage, $weblangs;
542 global $includehtmlcontentopened;
543 global $websitekey, $websitepagefile;
547 if (!preg_match(
'/\.php$/i', $containerref)) {
548 $containerref .=
'.php';
551 $fullpathfile = DOL_DATA_ROOT.($conf->entity > 1 ?
'/'.$conf->entity :
'').
'/website/'.$websitekey.
'/'.$containerref;
553 if (empty($includehtmlcontentopened)) {
554 $includehtmlcontentopened = 0;
556 $includehtmlcontentopened++;
557 if ($includehtmlcontentopened > $MAXLEVEL) {
558 print
'ERROR: RECURSIVE CONTENT LEVEL. Depth of recursive call is more than the limit of '.((int) $MAXLEVEL).
".\n";
569 $res = include $fullpathfile;
570 $tmpoutput = ob_get_contents();
573 print
"\n".
'<!-- include '.$websitekey.
'/'.$containerref.(is_object($websitepage) ?
' parent id='.$websitepage->id :
'').
' level = '.$includehtmlcontentopened.
' -->'.
"\n";
574 print preg_replace(array(
'/^.*<body[^>]*>/ims',
'/<\/body>.*$/ims'), array(
'',
''), $tmpoutput);
577 print
'ERROR: FAILED TO INCLUDE PAGE '.$containerref.
".\n";
580 $includehtmlcontentopened--;
595 global $conf, $db, $hookmanager, $langs, $mysoc, $user, $website, $websitepage, $weblangs, $pagelangs;
597 $type = strtolower($type);
599 if ($type ==
'software') {
600 $ret =
'<!-- Add structured data for entry in a software annuary -->'.
"\n";
601 $ret .=
'<script type="application/ld+json">'.
"\n";
603 "@context": "https://schema.org",
604 "@type": "SoftwareApplication",
605 "name": "'.dol_escape_json($data[
'name']).
'",
607 "applicationCategory": "https://schema.org/'.
dol_escape_json($data[
'applicationCategory']).
'",';
608 if (!empty($data[
'ratingcount'])) {
611 "@type": "AggregateRating",
612 "ratingValue": "'.dol_escape_json($data[
'ratingvalue']).
'",
619 "price": "'.dol_escape_json($data[
'price']).
'",
620 "priceCurrency": "'.
dol_escape_json($data[
'currency'] ? $data[
'currency'] : $conf->currency).
'"
623 $ret .=
'</script>'.
"\n";
624 } elseif ($type ==
'organization') {
625 $companyname = $mysoc->name;
628 $ret =
'<!-- Add structured data for organization -->'.
"\n";
629 $ret .=
'<script type="application/ld+json">'.
"\n";
631 "@context": "https://schema.org",
632 "@type": "Organization",
633 "name": "'.dol_escape_json($data[
'name'] ? $data[
'name'] : $companyname).
'",
635 "logo": "'.($data[
'logo'] ?
dol_escape_json($data[
'logo']) :
'/wrapper.php?modulepart=mycompany&file=logos%2F'.urlencode($mysoc->logo)).
'",
637 "@type": "ContactPoint",
638 "contactType": "Contact",
639 "email": "'.
dol_escape_json($data[
'email'] ? $data[
'email'] : $mysoc->email).
'"
641 if (is_array($mysoc->socialnetworks) && count($mysoc->socialnetworks) > 0) {
643 $ret .=
'"sameAs": [';
645 foreach ($mysoc->socialnetworks as $key => $value) {
646 if ($key ==
'linkedin') {
647 $ret .=
'"https://www.'.$key.
'.com/company/'.
dol_escape_json($value).
'"';
648 } elseif ($key ==
'youtube') {
654 if ($i < count($mysoc->socialnetworks)) {
661 $ret .=
'</script>'.
"\n";
662 } elseif ($type ==
'blogpost') {
663 if (!empty($websitepage->author_alias)) {
668 $pageurl = $websitepage->pageurl;
669 $title = $websitepage->title;
670 $image = $websitepage->image;
671 $companyname = $mysoc->name;
672 $description = $websitepage->description;
674 $pageurl = str_replace(
'__WEBSITE_KEY__', $website->ref, $pageurl);
675 $title = str_replace(
'__WEBSITE_KEY__', $website->ref, $title);
676 $image =
'/medias'.(preg_match(
'/^\//', $image) ?
'' :
'/').str_replace(
'__WEBSITE_KEY__', $website->ref, $image);
677 $companyname = str_replace(
'__WEBSITE_KEY__', $website->ref, $companyname);
678 $description = str_replace(
'__WEBSITE_KEY__', $website->ref, $description);
680 $ret =
'<!-- Add structured data for blog post -->'.
"\n";
681 $ret .=
'<script type="application/ld+json">'.
"\n";
683 "@context": "https://schema.org",
684 "@type": "NewsArticle",
685 "mainEntityOfPage": {
687 "@id": "'.dol_escape_json($pageurl).
'"
693 "dateCreated": "'.
dol_print_date($websitepage->date_creation,
'dayhourrfc').
'",
694 "datePublished": "'.
dol_print_date($websitepage->date_creation,
'dayhourrfc').
'",
695 "dateModified": "'.
dol_print_date($websitepage->date_modification,
'dayhourrfc').
'",
701 "@type": "Organization",
704 "@type": "ImageObject",
705 "url": "/wrapper.php?modulepart=mycompany&file=logos%2F'.urlencode($mysoc->logo).
'"
708 if ($websitepage->keywords) {
709 $ret .=
'"keywords": [';
711 $arrayofkeywords = explode(
',', $websitepage->keywords);
712 foreach ($arrayofkeywords as $keyword) {
713 $ret .=
'"'.dol_escape_json($keyword).
'"';
715 if ($i < count($arrayofkeywords)) {
721 $ret .=
'"description": "'.dol_escape_json($description).
'"';
722 $ret .=
"\n".
'}'.
"\n";
723 $ret .=
'</script>'.
"\n";
725 $ret .=
'<!-- no structured data inserted inline inside blogpost because no author_alias defined -->'.
"\n";
727 } elseif ($type ==
'product') {
728 $ret =
'<!-- Add structured data for product -->'.
"\n";
729 $ret .=
'<script type="application/ld+json">'.
"\n";
731 "@context": "https://schema.org/",
733 "name": "'.dol_escape_json($data[
'label']).
'",
750 "url": "https://example.com/anvil",
751 "priceCurrency": "'.
dol_escape_json($data[
'currency'] ? $data[
'currency'] : $conf->currency).
'",
753 "itemCondition": "https://schema.org/UsedCondition",
754 "availability": "https://schema.org/InStock",
756 "@type": "Organization",
761 $ret .=
'</script>'.
"\n";
762 } elseif ($type ==
'qa') {
763 $ret =
'<!-- Add structured data for QA -->'.
"\n";
764 $ret .=
'<script type="application/ld+json">'.
"\n";
766 "@context": "https://schema.org/",
770 "name": "'.dol_escape_json($data[
'name']).
'",
787 $ret .=
'</script>'.
"\n";
800 global $conf, $db, $hookmanager, $langs, $mysoc, $user, $website, $websitepage, $weblangs;
804 if ($website->virtualhost) {
805 $pageurl = $websitepage->pageurl;
806 $title = $websitepage->title;
807 $image = $websitepage->image;
808 $companyname = $mysoc->name;
809 $description = $websitepage->description;
811 $pageurl = str_replace(
'__WEBSITE_KEY__', $website->ref, $pageurl);
812 $title = str_replace(
'__WEBSITE_KEY__', $website->ref, $title);
813 $image =
'/medias'.(preg_match(
'/^\//', $image) ?
'' :
'/').str_replace(
'__WEBSITE_KEY__', $website->ref, $image);
814 $companyname = str_replace(
'__WEBSITE_KEY__', $website->ref, $companyname);
815 $description = str_replace(
'__WEBSITE_KEY__', $website->ref, $description);
818 if ($websitepage->lang) {
819 $shortlangcode = substr($websitepage->lang, 0, 2);
821 if (empty($shortlangcode)) {
822 $shortlangcode = substr($website->lang, 0, 2);
825 $fullurl = $website->virtualhost.
'/'.$websitepage->pageurl.
'.php';
826 $canonicalurl = $website->virtualhost.(($websitepage->id == $website->fk_default_home) ?
'/' : (($shortlangcode != substr($website->lang, 0, 2) ?
'/'.$shortlangcode :
'').
'/'.$websitepage->pageurl.
'.php'));
827 $hashtags = trim(join(
' #', array_map(
'trim', explode(
',', $websitepage->keywords))));
830 $out .=
'<meta name="og:type" content="website">'.
"\n";
831 $out .=
'<meta name="og:title" content="'.$websitepage->title.
'">'.
"\n";
832 if ($websitepage->image) {
833 $out .=
'<meta name="og:image" content="'.$website->virtualhost.$image.
'">'.
"\n";
835 $out .=
'<meta name="og:url" content="'.$canonicalurl.
'">'.
"\n";
838 $out .=
'<meta name="twitter:card" content="summary">'.
"\n";
839 if (!empty($params) && !empty($params[
'twitter_account'])) {
840 $out .=
'<meta name="twitter:site" content="@'.$params[
'twitter_account'].
'">'.
"\n";
841 $out .=
'<meta name="twitter:creator" content="@'.$params[
'twitter_account'].
'">'.
"\n";
843 $out .=
'<meta name="twitter:title" content="'.$websitepage->title.
'">'.
"\n";
844 if ($websitepage->description) {
845 $out .=
'<meta name="twitter:description" content="'.$websitepage->description.
'">'.
"\n";
847 if ($websitepage->image) {
848 $out .=
'<meta name="twitter:image" content="'.$website->virtualhost.$image.
'">'.
"\n";
874 global $conf, $db, $hookmanager, $langs, $mysoc, $user, $website, $websitepage, $weblangs;
876 $out =
'<!-- section for social network sharing of page -->'.
"\n";
878 if ($website->virtualhost) {
879 $fullurl = $website->virtualhost.
'/'.$websitepage->pageurl.
'.php';
880 $hashtags = trim(join(
' #', array_map(
'trim', explode(
',', $websitepage->keywords))));
882 $out .=
'<div class="dol-social-share">'.
"\n";
885 $out .=
'<div class="dol-social-share-tw">'.
"\n";
886 $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>';
887 $out .=
'<script>!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>';
888 $out .=
'</div>'.
"\n";
891 $out .=
'<div class="dol-social-share-reddit">'.
"\n";
892 $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">';
893 $out .= '<span class="dol-social-share-reddit-span
">Reddit</span>';
895 $out .= '</div>'."\n
";
898 $out .= '<div class="dol-social-share-fbl
">'."\n
";
899 $out .= '<div id="fb-root
"></div>'."\n
";
900 $out .= '<script>(function(d, s, id) {
901 var js, fjs = d.getElementsByTagName(s)[0];
902 if (d.getElementById(id)) return;
903 js = d.createElement(s); js.id = id;
905 fjs.parentNode.insertBefore(js, fjs);
906 }(document, \
'script\', \'facebook-jssdk\'));</script>
909 layout="button_count"
914 action="like" ></fb:like>'.
"\n";
915 $out .=
'</div>'.
"\n";
917 $out .=
"\n</div>\n";
919 $out .=
'<!-- virtual host not defined in CMS. No way to add sharing buttons -->'.
"\n";
921 $out .=
'<!-- section end for social network sharing of page -->'.
"\n";
941 function getPagesFromSearchCriterias($type, $algo, $searchstring, $max = 25, $sortfield =
'date_creation', $sortorder =
'DESC', $langcode =
'', $otherfilters =
'null', $status = 1)
943 global $conf, $db, $hookmanager, $langs, $mysoc, $user, $website, $websitepage, $weblangs;
946 $arrayresult = array(
'code'=>
'',
'list'=>array());
948 if (!is_object($weblangs)) {
952 if (empty($searchstring) && empty($type) && empty($langcode) && empty($otherfilters)) {
954 $arrayresult[
'code'] =
'KO';
955 $arrayresult[
'message'] = $weblangs->trans(
"EmptySearchString");
956 } elseif ($searchstring &&
dol_strlen($searchstring) < 2) {
957 $weblangs->load(
"errors");
959 $arrayresult[
'code'] =
'KO';
960 $arrayresult[
'message'] = $weblangs->trans(
"ErrorSearchCriteriaTooSmall");
962 $tmparrayoftype = explode(
',', $type);
976 if (!$error && (empty($max) || ($found < $max)) && (preg_match(
'/meta/', $algo) || preg_match(
'/content/', $algo))) {
977 include_once DOL_DOCUMENT_ROOT.
'/website/class/websitepage.class.php';
979 $sql =
'SELECT wp.rowid FROM '.MAIN_DB_PREFIX.
'website_page as wp';
980 if (is_array($otherfilters) && !empty($otherfilters[
'category'])) {
981 $sql .=
', '.MAIN_DB_PREFIX.
'categorie_website_page as cwp';
983 $sql .=
" WHERE wp.fk_website = ".((int) $website->id);
985 $sql .=
" AND wp.status = ".((int) $status);
988 $sql .=
" AND wp.lang = '".$db->escape($langcode).
"'";
991 $tmparrayoftype = explode(
',', $type);
993 foreach ($tmparrayoftype as $tmptype) {
994 $typestring .= ($typestring ?
", " :
"").
"'".$db->escape(trim($tmptype)).
"'";
996 $sql .=
" AND wp.type_container IN (".$db->sanitize($typestring, 1).
")";
1000 if (preg_match(
'/meta/', $algo)) {
1001 $searchalgo .= ($searchalgo ?
' OR ' :
'').
"wp.title LIKE '%".$db->escape($db->escapeforlike($searchstring)).
"%' OR wp.description LIKE '%".$db->escape($db->escapeforlike($searchstring)).
"%'";
1002 $searchalgo .= ($searchalgo ?
' OR ' :
'').
"wp.keywords LIKE '".$db->escape($db->escapeforlike($searchstring)).
",%' OR wp.keywords LIKE '% ".$db->escape($db->escapeforlike($searchstring)).
"%'";
1004 if (preg_match(
'/content/', $algo)) {
1005 $searchalgo .= ($searchalgo ?
' OR ' :
'').
"wp.content LIKE '%".$db->escape($db->escapeforlike($searchstring)).
"%'";
1007 $sql .= $searchalgo;
1008 if (is_array($otherfilters) && !empty($otherfilters[
'category'])) {
1009 $sql .=
' AND cwp.fk_website_page = wp.rowid AND cwp.fk_categorie = '.((int) $otherfilters[
'category']);
1012 $sql .= $db->order($sortfield, $sortorder);
1013 $sql .= $db->plimit($max);
1016 $resql = $db->query($sql);
1020 while (($obj = $db->fetch_object(
$resql)) && ($i < $max || $max == 0)) {
1021 if ($obj->rowid > 0) {
1023 $tmpwebsitepage->fetch($obj->rowid);
1024 if ($tmpwebsitepage->id > 0) {
1025 $arrayresult[
'list'][$obj->rowid] = $tmpwebsitepage;
1033 $arrayresult[
'code'] = $db->lasterrno();
1034 $arrayresult[
'message'] = $db->lasterror();
1040 if (!$error && (empty($max) || ($found < $max)) && (preg_match(
'/sitefiles/', $algo))) {
1041 global $dolibarr_main_data_root;
1043 $pathofwebsite = $dolibarr_main_data_root.($conf->entity > 1 ?
'/'.$conf->entity :
'').
'/website/'.$website->ref;
1044 $filehtmlheader = $pathofwebsite.
'/htmlheader.html';
1045 $filecss = $pathofwebsite.
'/styles.css.php';
1046 $filejs = $pathofwebsite.
'/javascript.js.php';
1047 $filerobot = $pathofwebsite.
'/robots.txt';
1048 $filehtaccess = $pathofwebsite.
'/.htaccess';
1049 $filemanifestjson = $pathofwebsite.
'/manifest.json.php';
1050 $filereadme = $pathofwebsite.
'/README.md';
1052 $filecontent = file_get_contents($filehtmlheader);
1053 if ((empty($max) || ($found < $max)) && preg_match(
'/'.preg_quote($searchstring,
'/').
'/', $filecontent)) {
1054 $arrayresult[
'list'][] = array(
'type'=>
'website_htmlheadercontent');
1057 $filecontent = file_get_contents($filecss);
1058 if ((empty($max) || ($found < $max)) && preg_match(
'/'.preg_quote($searchstring,
'/').
'/', $filecontent)) {
1059 $arrayresult[
'list'][] = array(
'type'=>
'website_csscontent');
1062 $filecontent = file_get_contents($filejs);
1063 if ((empty($max) || ($found < $max)) && preg_match(
'/'.preg_quote($searchstring,
'/').
'/', $filecontent)) {
1064 $arrayresult[
'list'][] = array(
'type'=>
'website_jscontent');
1067 $filerobot = file_get_contents($filerobot);
1068 if ((empty($max) || ($found < $max)) && preg_match(
'/'.preg_quote($searchstring,
'/').
'/', $filecontent)) {
1069 $arrayresult[
'list'][] = array(
'type'=>
'website_robotcontent');
1077 $arrayresult[
'code'] =
'OK';
1078 if (empty($arrayresult[
'list'])) {
1079 $arrayresult[
'code'] =
'KO';
1080 $arrayresult[
'message'] = $weblangs->trans(
"NoRecordFound");
1084 $arrayresult[
'code'] =
'KO';
1085 $arrayresult[
'message'] =
'No supported algorithm found';
1089 return $arrayresult;
1106 function getAllImages($object, $objectpage, $urltograb, &$tmp, &$action, $modifylinks = 0, $grabimages = 1, $grabimagesinto =
'subpage')
1112 dol_syslog(
"Call getAllImages with grabimagesinto=".$grabimagesinto);
1114 $alreadygrabbed = array();
1116 if (preg_match(
'/\/$/', $urltograb)) {
1119 $urltograb = dirname($urltograb);
1123 preg_match_all(
'/<img([^\.\/]+)src="([^>"]+)"([^>]*)>/i', $tmp, $regs);
1125 foreach ($regs[0] as $key => $val) {
1126 if (preg_match(
'/^data:image/i', $regs[2][$key])) {
1130 if (preg_match(
'/^\//', $regs[2][$key])) {
1132 $urltograbbis = $urltograbdirrootwithoutslash.$regs[2][$key];
1134 $urltograbbis = $urltograb.
'/'.$regs[2][$key];
1137 $linkwithoutdomain = $regs[2][$key];
1138 $dirforimages =
'/'.$objectpage->pageurl;
1139 if ($grabimagesinto ==
'root') {
1144 $filetosave = $conf->medias->multidir_output[$conf->entity].
'/image/'.$object->ref.$dirforimages.(preg_match(
'/^\//', $regs[2][$key]) ?
'' :
'/').$regs[2][$key];
1145 if (preg_match(
'/^http/', $regs[2][$key])) {
1146 $urltograbbis = $regs[2][$key];
1147 $linkwithoutdomain = preg_replace(
'/^https?:\/\/[^\/]+\//i',
'', $regs[2][$key]);
1148 $filetosave = $conf->medias->multidir_output[$conf->entity].
'/image/'.$object->ref.$dirforimages.(preg_match(
'/^\//', $linkwithoutdomain) ?
'' :
'/').$linkwithoutdomain;
1150 $filename =
'image/'.$object->ref.$dirforimages.(preg_match(
'/^\//', $linkwithoutdomain) ?
'' :
'/').$linkwithoutdomain;
1153 $filetosave = preg_replace(
'/\/[^\/]+\/\.\./',
'', $filetosave);
1154 $filename = preg_replace(
'/\/[^\/]+\/\.\./',
'', $filename);
1160 if (empty($alreadygrabbed[$urltograbbis])) {
1162 $tmpgeturl =
getURLContent($urltograbbis,
'GET',
'', 1, array(), array(
'http',
'https'), 0);
1163 if ($tmpgeturl[
'curl_error_no']) {
1165 setEventMessages(
'Error getting '.$urltograbbis.
': '.$tmpgeturl[
'curl_error_msg'],
null,
'errors');
1167 } elseif ($tmpgeturl[
'http_code'] !=
'200') {
1169 setEventMessages(
'Error getting '.$urltograbbis.
': '.$tmpgeturl[
'http_code'],
null,
'errors');
1172 $alreadygrabbed[$urltograbbis] = 1;
1176 $fp = fopen($filetosave,
"w");
1177 fputs($fp, $tmpgeturl[
'content']);
1179 if (!empty($conf->global->MAIN_UMASK)) {
1180 @chmod($filetosave, octdec($conf->global->MAIN_UMASK));
1187 $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);
1192 preg_match_all(
'/background([^\.\/\(;]+)url\([\"\']?([^\)\"\']*)[\"\']?\)/i', $tmp, $regs);
1194 foreach ($regs[0] as $key => $val) {
1195 if (preg_match(
'/^data:image/i', $regs[2][$key])) {
1199 if (preg_match(
'/^\//', $regs[2][$key])) {
1201 $urltograbbis = $urltograbdirrootwithoutslash.$regs[2][$key];
1203 $urltograbbis = $urltograb.
'/'.$regs[2][$key];
1206 $linkwithoutdomain = $regs[2][$key];
1208 $dirforimages =
'/'.$objectpage->pageurl;
1209 if ($grabimagesinto ==
'root') {
1213 $filetosave = $conf->medias->multidir_output[$conf->entity].
'/image/'.$object->ref.$dirforimages.(preg_match(
'/^\//', $regs[2][$key]) ?
'' :
'/').$regs[2][$key];
1215 if (preg_match(
'/^http/', $regs[2][$key])) {
1216 $urltograbbis = $regs[2][$key];
1217 $linkwithoutdomain = preg_replace(
'/^https?:\/\/[^\/]+\//i',
'', $regs[2][$key]);
1218 $filetosave = $conf->medias->multidir_output[$conf->entity].
'/image/'.$object->ref.$dirforimages.(preg_match(
'/^\//', $linkwithoutdomain) ?
'' :
'/').$linkwithoutdomain;
1221 $filename =
'image/'.$object->ref.$dirforimages.(preg_match(
'/^\//', $linkwithoutdomain) ?
'' :
'/').$linkwithoutdomain;
1224 $filetosave = preg_replace(
'/\/[^\/]+\/\.\./',
'', $filetosave);
1225 $filename = preg_replace(
'/\/[^\/]+\/\.\./',
'', $filename);
1231 if (empty($alreadygrabbed[$urltograbbis])) {
1233 $tmpgeturl =
getURLContent($urltograbbis,
'GET',
'', 1, array(), array(
'http',
'https'), 0);
1234 if ($tmpgeturl[
'curl_error_no']) {
1236 setEventMessages(
'Error getting '.$urltograbbis.
': '.$tmpgeturl[
'curl_error_msg'],
null,
'errors');
1238 } elseif ($tmpgeturl[
'http_code'] !=
'200') {
1240 setEventMessages(
'Error getting '.$urltograbbis.
': '.$tmpgeturl[
'http_code'],
null,
'errors');
1243 $alreadygrabbed[$urltograbbis] = 1;
1247 $fp = fopen($filetosave,
"w");
1248 fputs($fp, $tmpgeturl[
'content']);
1250 if (!empty($conf->global->MAIN_UMASK)) {
1251 @chmod($filetosave, octdec($conf->global->MAIN_UMASK));
1258 $tmp = preg_replace(
'/'.preg_quote($regs[0][$key],
'/').
'/i',
'background'.$regs[1][$key].
'url("'.DOL_URL_ROOT.
'/viewimage.php?modulepart=medias&file='.$filename.
'")', $tmp);
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
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).
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_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
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).
if(!defined( 'CSRFCHECK_WITH_TOKEN'))
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.
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.