dolibarr  19.0.0-dev
website.lib.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
32 function dolStripPhpCode($str, $replacewith = '')
33 {
34  $str = str_replace('<?=', '<?php', $str);
35 
36  $newstr = '';
37 
38  // Split on each opening tag
39  //$parts = explode('<?php', $str);
40  $parts = preg_split('/'.preg_quote('<?php', '/').'/i', $str);
41 
42  if (!empty($parts)) {
43  $i = 0;
44  foreach ($parts as $part) {
45  if ($i == 0) { // The first part is never php code
46  $i++;
47  $newstr .= $part;
48  continue;
49  }
50  // The second part is the php code. We split on closing tag
51  $partlings = explode('?>', $part);
52  if (!empty($partlings)) {
53  //$phppart = $partlings[0];
54  //remove content before closing tag
55  if (count($partlings) > 1) {
56  $partlings[0] = ''; // Todo why a count > 1 and not >= 1 ?
57  }
58  //append to out string
59  //$newstr .= '<span class="phptag" class="tooltip" title="'.dol_escape_htmltag(dolGetFirstLineOfText($phppart).'...').'">'.$replacewith.'<!-- '.$phppart.' --></span>'.implode('', $partlings);
60  //$newstr .= '<span>'.$replacewith.'<!-- '.$phppart.' --></span>'.implode('', $partlings);
61  $newstr .= '<span phptag>'.$replacewith.'</span>'.implode('', $partlings);
62  //$newstr .= $replacewith.implode('', $partlings);
63  }
64  }
65  }
66  return $newstr;
67 }
68 
76 function dolKeepOnlyPhpCode($str)
77 {
78  $str = str_replace('<?=', '<?php', $str);
79 
80  $newstr = '';
81 
82  // Split on each opening tag
83  //$parts = explode('<?php', $str);
84  $parts = preg_split('/'.preg_quote('<?php', '/').'/i', $str);
85 
86  if (!empty($parts)) {
87  $i = 0;
88  foreach ($parts as $part) {
89  if ($i == 0) { // The first part is never php code
90  $i++;
91  continue;
92  }
93  $newstr .= '<?php';
94  //split on closing tag
95  $partlings = explode('?>', $part, 2);
96  if (!empty($partlings)) {
97  $newstr .= $partlings[0].'?>';
98  } else {
99  $newstr .= $part.'?>';
100  }
101  }
102  }
103  return $newstr;
104 }
105 
118 function dolWebsiteReplacementOfLinks($website, $content, $removephppart = 0, $contenttype = 'html', $containerid = '')
119 {
120  $nbrep = 0;
121 
122  dol_syslog('dolWebsiteReplacementOfLinks start (contenttype='.$contenttype." containerid=".$containerid." USEDOLIBARREDITOR=".(defined('USEDOLIBARREDITOR') ? '1' : '')." USEDOLIBARRSERVER=".(defined('USEDOLIBARRSERVER') ? '1' : '').')', LOG_DEBUG);
123  //if ($contenttype == 'html') { print $content;exit; }
124 
125  // Replace php code. Note $content may come from database and does not contain body tags.
126  $replacewith = '...php...';
127  if ($removephppart) {
128  $replacewith = '';
129  }
130  $content = preg_replace('/value="<\?php((?!\?>).)*\?>\n*/ims', 'value="'.$replacewith.'"', $content);
131 
132  $replacewith = '"callto=#';
133  if ($removephppart) {
134  $replacewith = '';
135  }
136  $content = preg_replace('/"callto:<\?php((?!\?>).)*\?>\n*/ims', $replacewith, $content);
137 
138  $replacewith = '"mailto=#';
139  if ($removephppart) {
140  $replacewith = '';
141  }
142  $content = preg_replace('/"mailto:<\?php((?!\?>).)*\?>\n*/ims', $replacewith, $content);
143 
144  $replacewith = 'src="php';
145  if ($removephppart) {
146  $replacewith = '';
147  }
148  $content = preg_replace('/src="<\?php((?!\?>).)*\?>\n*/ims', $replacewith, $content);
149 
150  $replacewith = 'href="php';
151  if ($removephppart) {
152  $replacewith = '';
153  }
154  $content = preg_replace('/href="<\?php((?!\?>).)*\?>\n*/ims', $replacewith, $content);
155 
156  //$replacewith='<span class="phptag">...php...</span>';
157  $replacewith = '...php...';
158  if ($removephppart) {
159  $replacewith = '';
160  }
161  //$content = preg_replace('/<\?php((?!\?toremove>).)*\?toremove>\n*/ims', $replacewith, $content);
162  /*if ($content === null) {
163  if (preg_last_error() == PREG_JIT_STACKLIMIT_ERROR) $content = 'preg_replace error (when removing php tags) PREG_JIT_STACKLIMIT_ERROR';
164  }*/
165  $content = dolStripPhpCode($content, $replacewith);
166  //var_dump($content);
167 
168  // Protect the link styles.css.php to any replacement that we make after.
169  $content = str_replace('href="styles.css.php', 'href="!~!~!~styles.css.php', $content);
170  $content = str_replace('href="http', 'href="!~!~!~http', $content);
171  $content = str_replace('href="//', 'href="!~!~!~//', $content);
172  $content = str_replace('src="viewimage.php', 'src="!~!~!~/viewimage.php', $content);
173  $content = str_replace('src="/viewimage.php', 'src="!~!~!~/viewimage.php', $content);
174  $content = str_replace('src="'.DOL_URL_ROOT.'/viewimage.php', 'src="!~!~!~'.DOL_URL_ROOT.'/viewimage.php', $content);
175  $content = str_replace('href="document.php', 'href="!~!~!~/document.php', $content);
176  $content = str_replace('href="/document.php', 'href="!~!~!~/document.php', $content);
177  $content = str_replace('href="'.DOL_URL_ROOT.'/document.php', 'href="!~!~!~'.DOL_URL_ROOT.'/document.php', $content);
178 
179  // Replace relative link '/' with dolibarr URL
180  $content = preg_replace('/(href=")\/(#[^\"<>]*)?\"/', '\1!~!~!~'.DOL_URL_ROOT.'/website/index.php?website='.$website->ref.'&pageid='.$website->fk_default_home.'\2"', $content, -1, $nbrep);
181  // Replace relative link /xxx.php#aaa or /xxx.php with dolibarr URL (we discard param ?...)
182  $content = preg_replace('/(href=")\/?([^:\"\!]*)\.php(#[^\"<>]*)?\"/', '\1!~!~!~'.DOL_URL_ROOT.'/website/index.php?website='.$website->ref.'&pageref=\2\3"', $content, -1, $nbrep);
183  // Replace relative link /xxx.php?a=b&c=d#aaa or /xxx.php?a=b&c=d with dolibarr URL
184  $content = preg_replace('/(href=")\/?([^:\"\!]*)\.php\?([^#\"<>]*)(#[^\"<>]*)?\"/', '\1!~!~!~'.DOL_URL_ROOT.'/website/index.php?website='.$website->ref.'&pageref=\2&\3\4"', $content, -1, $nbrep);
185 
186  // Fix relative link into medias with correct URL after the DOL_URL_ROOT: ../url("medias/
187  $content = preg_replace('/url\((["\']?)\/?medias\//', 'url(\1!~!~!~'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
188  $content = preg_replace('/data-slide-bg=(["\']?)\/?medias\//', 'data-slide-bg=\1!~!~!~'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
189 
190  // <img src="medias/...image.png... => <img src="dolibarr/viewimage.php/modulepart=medias&file=image.png...
191  // <img src="...image.png... => <img src="dolibarr/viewimage.php/modulepart=medias&file=image.png...
192  $content = preg_replace('/(<img[^>]*src=")\/?medias\//', '\1!~!~!~'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
193  // <img src="image.png... => <img src="dolibarr/viewimage.php/modulepart=medias&file=image.png...
194  $content = preg_replace('/(<img[^>]*src=")\/?([^:\"\!]+)\"/', '\1!~!~!~'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file=\2"', $content, -1, $nbrep);
195  // <img src="viewimage.php/modulepart=medias&file=image.png" => <img src="dolibarr/viewimage.php/modulepart=medias&file=image.png"
196  $content = preg_replace('/(<img[^>]*src=")(\/?viewimage\.php)/', '\1!~!~!~'.DOL_URL_ROOT.'/viewimage.php', $content, -1, $nbrep);
197 
198  // action="newpage.php" => action="dolibarr/website/index.php?website=...&pageref=newpage
199  $content = preg_replace('/(action=")\/?([^:\"]*)(\.php\")/', '\1!~!~!~'.DOL_URL_ROOT.'/website/index.php?website='.$website->ref.'&pageref=\2"', $content, -1, $nbrep);
200 
201  // Fix relative link /document.php with correct URL after the DOL_URL_ROOT: ...href="/document.php?modulepart="
202  $content = preg_replace('/(href=")(\/?document\.php\?[^\"]*modulepart=[^\"]*)(\")/', '\1!~!~!~'.DOL_URL_ROOT.'\2\3', $content, -1, $nbrep);
203  $content = preg_replace('/(src=")(\/?document\.php\?[^\"]*modulepart=[^\"]*)(\")/', '\1!~!~!~'.DOL_URL_ROOT.'\2\3', $content, -1, $nbrep);
204 
205  // Fix relative link /viewimage.php with correct URL after the DOL_URL_ROOT: ...href="/viewimage.php?modulepart="
206  $content = preg_replace('/(url\(")(\/?viewimage\.php\?[^\"]*modulepart=[^\"]*)(\")/', '\1!~!~!~'.DOL_URL_ROOT.'\2\3', $content, -1, $nbrep);
207 
208  // Fix relative URL
209  $content = str_replace('src="!~!~!~/viewimage.php', 'src="!~!~!~'.DOL_URL_ROOT.'/viewimage.php', $content);
210  $content = str_replace('href="!~!~!~/document.php', 'href="!~!~!~'.DOL_URL_ROOT.'/document.php', $content);
211  // Remove the protection tag !~!~!~
212  $content = str_replace('!~!~!~', '', $content);
213 
214  dol_syslog('dolWebsiteReplacementOfLinks end', LOG_DEBUG);
215  //if ($contenttype == 'html') { print $content;exit; }
216 
217  return $content;
218 }
219 
227 {
228  $map = array(
229  ":face_with_tears_of_joy:" => "\xF0\x9F\x98\x82",
230  ":grinning_face_with_smiling_eyes:" => "\xF0\x9F\x98\x81",
231  ":smiling_face_with_open_mouth:" => "\xF0\x9F\x98\x83",
232  ":smiling_face_with_open_mouth_and_cold_sweat:" => "\xF0\x9F\x98\x85",
233  ":smiling_face_with_open_mouth_and_tightly_closed_eyes:" => "\xF0\x9F\x98\x86",
234  ":winking_face:" => "\xF0\x9F\x98\x89",
235  ":smiling_face_with_smiling_eyes:" => "\xF0\x9F\x98\x8A",
236  ":face_savouring_delicious_food:" => "\xF0\x9F\x98\x8B",
237  ":relieved_face:" => "\xF0\x9F\x98\x8C",
238  ":smiling_face_with_heart_shaped_eyes:" => "\xF0\x9F\x98\x8D",
239  ":smiling_face_with_sunglasses:" => "\xF0\x9F\x98\x8E",
240  ":smirking_face:" => "\xF0\x9F\x98\x8F",
241  ":neutral_face:" => "\xF0\x9F\x98\x90",
242  ":expressionless_face:" => "\xF0\x9F\x98\x91",
243  ":unamused_face:" => "\xF0\x9F\x98\x92",
244  ":face_with_cold_sweat:" => "\xF0\x9F\x98\x93",
245  ":pensive_face:" => "\xF0\x9F\x98\x94",
246  ":confused_face:" => "\xF0\x9F\x98\x95",
247  ":confounded_face:" => "\xF0\x9F\x98\x96",
248  ":kissing_face:" => "\xF0\x9F\x98\x97",
249  ":face_throwing_a_kiss:" => "\xF0\x9F\x98\x98",
250  ":kissing_face_with_smiling_eyes:" => "\xF0\x9F\x98\x99",
251  ":kissing_face_with_closed_eyes:" => "\xF0\x9F\x98\x9A",
252  ":face_with_stuck_out_tongue:" => "\xF0\x9F\x98\x9B",
253  ":face_with_stuck_out_tongue_and_winking_eye:" => "\xF0\x9F\x98\x9C",
254  ":face_with_stuck_out_tongue_and_tightly_closed_eyes:" => "\xF0\x9F\x98\x9D",
255  ":disappointed_face:" => "\xF0\x9F\x98\x9E",
256  ":worried_face:" => "\xF0\x9F\x98\x9F",
257  ":angry_face:" => "\xF0\x9F\x98\xA0",
258  ":face_with_symbols_on_mouth:" => "\xF0\x9F\x98\xA1",
259  );
260  foreach ($map as $key => $value) {
261  $content = str_replace($key, $value, $content);
262  }
263  return $content;
264 }
265 
266 
277 function dolWebsiteOutput($content, $contenttype = 'html', $containerid = '')
278 {
279  global $db, $langs, $conf, $user;
280  global $dolibarr_main_url_root, $dolibarr_main_data_root;
281  global $website;
282  global $includehtmlcontentopened;
283 
284  $nbrep = 0;
285 
286  dol_syslog("dolWebsiteOutput start - contenttype=".$contenttype." containerid=".$containerid." USEDOLIBARREDITOR=".(defined('USEDOLIBARREDITOR') ? '1' : '')." USEDOLIBARRSERVER=".(defined('USEDOLIBARRSERVER') ? '1' : '').' includehtmlcontentopened='.$includehtmlcontentopened);
287 
288  //print $containerid.' '.$content;
289 
290  // Define $urlwithroot
291  $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
292  $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
293  //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
294 
295  if (defined('USEDOLIBARREDITOR')) { // REPLACEMENT OF LINKS When page called from Dolibarr editor
296  // We remove the <head> part of content
297  if ($contenttype == 'html') {
298  $content = preg_replace('/<head>.*<\/head>/ims', '', $content);
299  $content = preg_replace('/^.*<body(\s[^>]*)*>/ims', '', $content);
300  $content = preg_replace('/<\/body(\s[^>]*)*>.*$/ims', '', $content);
301  }
302  } elseif (defined('USEDOLIBARRSERVER')) { // REPLACEMENT OF LINKS When page called from Dolibarr server
303  $content = str_replace('<link rel="stylesheet" href="/styles.css', '<link rel="stylesheet" href="styles.css', $content);
304 
305  // Protect the link styles.css.php to any replacement that we make after.
306  $content = str_replace('href="styles.css.php', 'href="!~!~!~styles.css.php', $content);
307  $content = str_replace('href="http', 'href="!~!~!~http', $content);
308  $content = str_replace('href="//', 'href="!~!~!~//', $content);
309  $content = str_replace(array('src="viewimage.php', 'src="/viewimage.php'), 'src="!~!~!~/viewimage.php', $content);
310  $content = str_replace('src="'.DOL_URL_ROOT.'/viewimage.php', 'src="!~!~!~'.DOL_URL_ROOT.'/viewimage.php', $content);
311  $content = str_replace(array('href="document.php', 'href="/document.php'), 'href="!~!~!~/document.php', $content);
312  $content = str_replace('href="'.DOL_URL_ROOT.'/document.php', 'href="!~!~!~'.DOL_URL_ROOT.'/document.php', $content);
313 
314  // Replace relative link / with dolibarr URL: ...href="/"...
315  $content = preg_replace('/(href=")\/\"/', '\1!~!~!~'.DOL_URL_ROOT.'/public/website/index.php?website='.$website->ref.'"', $content, -1, $nbrep);
316  // Replace relative link /xxx.php#aaa or /xxx.php with dolibarr URL: ...href="....php" (we discard param ?...)
317  $content = preg_replace('/(href=")\/?([^:\"\!]*)\.php(#[^\"<>]*)?\"/', '\1!~!~!~'.DOL_URL_ROOT.'/public/website/index.php?website='.$website->ref.'&pageref=\2\3"', $content, -1, $nbrep);
318  // Replace relative link /xxx.php?a=b&c=d#aaa or /xxx.php?a=b&c=d with dolibarr URL
319  // Warning: we may replace twice if href="..." was inside an include (dolWebsiteOutput called by include and the by final page), that's why
320  // at end we replace the '!~!~!~' only if we are in final parent page.
321  $content = preg_replace('/(href=")\/?([^:\"\!]*)\.php\?([^#\"<>]*)(#[^\"<>]*)?\"/', '\1!~!~!~'.DOL_URL_ROOT.'/public/website/index.php?website='.$website->ref.'&pageref=\2&\3\4"', $content, -1, $nbrep);
322  // Replace relative link without .php like /xxx#aaa or /xxx with dolibarr URL: ...href="....php"
323  $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);
324 
325  // Fix relative link /document.php with correct URL after the DOL_URL_ROOT: href="/document.php?modulepart=" => href="/dolibarr/document.php?modulepart="
326  $content = preg_replace('/(href=")(\/?document\.php\?[^\"]*modulepart=[^\"]*)(\")/', '\1!~!~!~'.DOL_URL_ROOT.'\2\3', $content, -1, $nbrep);
327  $content = preg_replace('/(src=")(\/?document\.php\?[^\"]*modulepart=[^\"]*)(\")/', '\1!~!~!~'.DOL_URL_ROOT.'\2\3', $content, -1, $nbrep);
328 
329  // Fix relative link /viewimage.php with correct URL after the DOL_URL_ROOT: href="/viewimage.php?modulepart=" => href="/dolibarr/viewimage.php?modulepart="
330  $content = preg_replace('/(href=")(\/?viewimage\.php\?[^\"]*modulepart=[^\"]*)(\")/', '\1!~!~!~'.DOL_URL_ROOT.'\2\3', $content, -1, $nbrep);
331  $content = preg_replace('/(src=")(\/?viewimage\.php\?[^\"]*modulepart=[^\"]*)(\")/', '\1!~!~!~'.DOL_URL_ROOT.'\2\3', $content, -1, $nbrep);
332  $content = preg_replace('/(url\(")(\/?viewimage\.php\?[^\"]*modulepart=[^\"]*)(\")/', '\1!~!~!~'.DOL_URL_ROOT.'\2\3', $content, -1, $nbrep);
333 
334  // Fix relative link into medias with correct URL after the DOL_URL_ROOT: ../url("medias/
335  $content = preg_replace('/url\((["\']?)\/?medias\//', 'url(\1!~!~!~'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
336  $content = preg_replace('/data-slide-bg=(["\']?)\/?medias\//', 'data-slide-bg=\1!~!~!~'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
337 
338  // <img src="medias/...image.png... => <img src="dolibarr/viewimage.php/modulepart=medias&file=image.png...
339  // <img src="...image.png... => <img src="dolibarr/viewimage.php/modulepart=medias&file=image.png...
340  $content = preg_replace('/(<img[^>]*src=")\/?medias\//', '\1!~!~!~'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
341  // <img src="image.png... => <img src="dolibarr/viewimage.php/modulepart=medias&file=image.png...
342  $content = preg_replace('/(<img[^>]*src=")\/?([^:\"\!]+)\"/', '\1!~!~!~'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file=\2"', $content, -1, $nbrep);
343  // <img src="viewimage.php/modulepart=medias&file=image.png" => <img src="dolibarr/viewimage.php/modulepart=medias&file=image.png"
344  $content = preg_replace('/(<img[^>]*src=")(\/?viewimage\.php)/', '\1!~!~!~'.DOL_URL_ROOT.'/viewimage.php', $content, -1, $nbrep);
345 
346  // action="newpage.php" => action="dolibarr/website/index.php?website=...&pageref=newpage
347  $content = preg_replace('/(action=")\/?([^:\"]*)(\.php\")/', '\1!~!~!~'.DOL_URL_ROOT.'/public/website/index.php?website='.$website->ref.'&pageref=\2"', $content, -1, $nbrep);
348 
349  // Fix relative URL
350  $content = str_replace('src="!~!~!~/viewimage.php', 'src="!~!~!~'.DOL_URL_ROOT.'/viewimage.php', $content);
351  $content = str_replace('href="!~!~!~/document.php', 'href="!~!~!~'.DOL_URL_ROOT.'/document.php', $content);
352 
353  // Remove the protection tag !~!~!~, but only if this is the parent page and not an include
354  if (empty($includehtmlcontentopened)) {
355  $content = str_replace('!~!~!~', '', $content);
356  }
357  } else // REPLACEMENT OF LINKS When page called from virtual host web server
358  {
359  $symlinktomediaexists = 1;
360  if ($website->virtualhost) {
361  $content = preg_replace('/^(<link[^>]*rel="canonical" href=")\//m', '\1'.$website->virtualhost.'/', $content, -1, $nbrep);
362  }
363  //print 'rrrrrrrrr'.$website->virtualhost.$content;
364 
365 
366  // Make a change into HTML code to allow to include images from medias directory correct with direct link for virtual server
367  // <img alt="" src="/dolibarr_dev/htdocs/viewimage.php?modulepart=medias&amp;entity=1&amp;file=image/ldestailleur_166x166.jpg" style="height:166px; width:166px" />
368  // become
369  // <img alt="" src="'.$urlwithroot.'/medias/image/ldestailleur_166x166.jpg" style="height:166px; width:166px" />
370  if (!$symlinktomediaexists) {
371  // <img src="image.png... => <img src="medias/image.png...
372  $content = preg_replace('/(<img[^>]*src=")\/?image\//', '\1/wrapper.php?modulepart=medias&file=medias/image/', $content, -1, $nbrep);
373  $content = preg_replace('/(url\(["\']?)\/?image\//', '\1/wrapper.php?modulepart=medias&file=medias/image/', $content, -1, $nbrep);
374 
375  $content = preg_replace('/(<script[^>]*src=")[^\"]*document\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/', '\1/wrapper.php\2modulepart=medias\3file=\4\5', $content, -1, $nbrep);
376  $content = preg_replace('/(<a[^>]*href=")[^\"]*document\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/', '\1/wrapper.php\2modulepart=medias\3file=\4\5', $content, -1, $nbrep);
377 
378  $content = preg_replace('/(<a[^>]*href=")[^\"]*viewimage\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/', '\1/wrapper.php\2modulepart=medias\3file=\4\5', $content, -1, $nbrep);
379  $content = preg_replace('/(<img[^>]*src=")[^\"]*viewimage\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/', '\1/wrapper.php\2modulepart=medias\3file=\4\5', $content, -1, $nbrep);
380  $content = preg_replace('/(url\(["\']?)[^\)]*viewimage\.php([^\)]*)modulepart=medias([^\)]*)file=([^\)]*)(["\']?\))/', '\1/wrapper.php\2modulepart=medias\3file=\4\5', $content, -1, $nbrep);
381 
382  $content = preg_replace('/(<a[^>]*href=")[^\"]*viewimage\.php([^\"]*)hashp=([^\"]*)("[^>]*>)/', '\1/wrapper.php\2hashp=\3\4', $content, -1, $nbrep);
383  $content = preg_replace('/(<img[^>]*src=")[^\"]*viewimage\.php([^\"]*)hashp=([^\"]*)("[^>]*>)/', '\1/wrapper.php\2hashp=\3\4', $content, -1, $nbrep);
384  $content = preg_replace('/(url\(["\']?)[^\)]*viewimage\.php([^\)]*)hashp=([^\)]*)(["\']?\))/', '\1/wrapper.php\2hashp\3\4', $content, -1, $nbrep);
385 
386  $content = preg_replace('/(<img[^>]*src=")[^\"]*viewimage\.php([^\"]*)modulepart=mycompany([^\"]*)file=([^\"]*)("[^>]*>)/', '\1/wrapper.php\2modulepart=mycompany\3file=\4\5', $content, -1, $nbrep);
387 
388  // If some links to documents or viewimage remains, we replace with wrapper
389  $content = preg_replace('/(<img[^>]*src=")\/?viewimage\.php/', '\1/wrapper.php', $content, -1, $nbrep);
390  $content = preg_replace('/(<a[^>]*href=")\/?documents\.php/', '\1/wrapper.php', $content, -1, $nbrep);
391  } else {
392  // <img src="image.png... => <img src="medias/image.png...
393  $content = preg_replace('/(<img[^>]*src=")\/?image\//', '\1/medias/image/', $content, -1, $nbrep);
394  $content = preg_replace('/(url\(["\']?)\/?image\//', '\1/medias/image/', $content, -1, $nbrep);
395 
396  $content = preg_replace('/(<script[^>]*src=")[^\"]*document\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/', '\1/medias/\4\5', $content, -1, $nbrep);
397  $content = preg_replace('/(<a[^>]*href=")[^\"]*document\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/', '\1/medias/\4\5', $content, -1, $nbrep);
398 
399  $content = preg_replace('/(<a[^>]*href=")[^\"]*viewimage\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/', '\1/medias/\4\5', $content, -1, $nbrep);
400  $content = preg_replace('/(<img[^>]*src=")[^\"]*viewimage\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/', '\1/medias/\4\5', $content, -1, $nbrep);
401  $content = preg_replace('/(url\(["\']?)[^\)]*viewimage\.php([^\)]*)modulepart=medias([^\)]*)file=([^\)]*)(["\']?\))/', '\1/medias/\4\5', $content, -1, $nbrep);
402 
403  $content = preg_replace('/(<a[^>]*href=")[^\"]*viewimage\.php([^\"]*)hashp=([^\"]*)("[^>]*>)/', '\1/wrapper.php\2hashp=\3\4', $content, -1, $nbrep);
404  $content = preg_replace('/(<img[^>]*src=")[^\"]*viewimage\.php([^\"]*)hashp=([^\"]*)("[^>]*>)/', '\1/wrapper.php\2hashp=\3\4', $content, -1, $nbrep);
405  $content = preg_replace('/(url\(["\']?)[^\)]*viewimage\.php([^\)]*)hashp=([^\)]*)(["\']?\))/', '\1/wrapper.php\2hashp=\3\4', $content, -1, $nbrep);
406 
407  $content = preg_replace('/(<img[^>]*src=")[^\"]*viewimage\.php([^\"]*)modulepart=mycompany([^\"]*)file=([^\"]*)("[^>]*>)/', '\1/wrapper.php\2modulepart=mycompany\3file=\4\5', $content, -1, $nbrep);
408 
409  // If some links to documents or viewimage remains, we replace with wrapper
410  $content = preg_replace('/(<img[^>]*src=")\/?viewimage\.php/', '\1/wrapper.php', $content, -1, $nbrep);
411  $content = preg_replace('/(<a[^>]*href=")\/?document\.php/', '\1/wrapper.php', $content, -1, $nbrep);
412  }
413  }
414 
415  if (!defined('USEDOLIBARREDITOR')) {
416  $content = str_replace(' contenteditable="true"', ' contenteditable="false"', $content);
417  }
418 
419  if (!empty($conf->global->WEBSITE_ADD_CSS_TO_BODY)) {
420  $content = str_replace('<body id="bodywebsite" class="bodywebsite', '<body id="bodywebsite" class="bodywebsite '.$conf->global->WEBSITE_ADD_CSS_TO_BODY, $content);
421  }
422 
423  $content = dolReplaceSmileyCodeWithUTF8($content);
424 
425  dol_syslog("dolWebsiteOutput end");
426 
427  print $content;
428 }
429 
438 function dolWebsiteIncrementCounter($websiteid, $websitepagetype, $websitepageid)
439 {
440  if (!getDolGlobalInt('WEBSITE_PERF_DISABLE_COUNTERS')) {
441  //dol_syslog("dolWebsiteIncrementCounter websiteid=".$websiteid." websitepagetype=".$websitepagetype." websitepageid=".$websitepageid);
442  if (in_array($websitepagetype, array('blogpost', 'page'))) {
443  global $db;
444 
445  $tmpnow = dol_getdate(dol_now('gmt'), true, 'gmt');
446 
447  $sql = "UPDATE ".$db->prefix()."website SET ";
448  $sql .= " pageviews_total = pageviews_total + 1,";
449  $sql .= " pageviews_month = pageviews_month + 1,";
450  // if last access was done during previous month, we save pageview_month into pageviews_previous_month
451  $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').",";
452  $sql .= " lastaccess = '".$db->idate(dol_now('gmt'), 'gmt')."'";
453  $sql .= " WHERE rowid = ".((int) $websiteid);
454  $resql = $db->query($sql);
455  if (! $resql) {
456  return -1;
457  }
458  }
459  }
460 
461  return 1;
462 }
463 
464 
472 /*
473 function dolWebsiteSaveContent($content)
474 {
475  global $db, $langs, $conf, $user;
476  global $dolibarr_main_url_root, $dolibarr_main_data_root;
477 
478  //dol_syslog("dolWebsiteSaveContent start (mode=".(defined('USEDOLIBARRSERVER')?'USEDOLIBARRSERVER':'').')');
479 
480  // Define $urlwithroot
481  $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
482  $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
483  //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
484 
485  //$content = preg_replace('/(<img.*src=")(?!(http|'.preg_quote(DOL_URL_ROOT,'/').'\/viewimage))/', '\1'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
486 
487  return $content;
488 }
489 */
490 
491 
501 function redirectToContainer($containerref, $containeraliasalt = '', $containerid = 0, $permanent = 0)
502 {
503  global $db, $website;
504 
505  $newurl = '';
506  $result = 0;
507 
508  // We make redirect using the alternative alias, we must find the real $containerref
509  if ($containeraliasalt) {
510  include_once DOL_DOCUMENT_ROOT.'/website/class/websitepage.class.php';
511  $tmpwebsitepage = new WebsitePage($db);
512  $result = $tmpwebsitepage->fetch(0, $website->id, '', $containeraliasalt);
513  if ($result > 0) {
514  $containerref = $tmpwebsitepage->pageurl;
515  } else {
516  print "Error, page contains a redirect to the alternative alias '".$containeraliasalt."' that does not exists in web site (".$website->id." / ".$website->ref.")";
517  exit;
518  }
519  }
520 
521  if (defined('USEDOLIBARREDITOR')) {
522  /*print '<div class="margintoponly marginleftonly">';
523  print "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.";
524  print '</div>';*/
525  $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.";
526  setEventMessages($text, null, 'warnings', 'WEBSITEREDIRECTDISABLED'.$containerref);
527  return;
528  }
529 
530  if (defined('USEDOLIBARRSERVER')) { // When page called from Dolibarr server
531  // Check new container exists
532  if (!$containeraliasalt) { // If containeraliasalt set, we already did the test
533  include_once DOL_DOCUMENT_ROOT.'/website/class/websitepage.class.php';
534  $tmpwebsitepage = new WebsitePage($db);
535  $result = $tmpwebsitepage->fetch(0, $website->id, $containerref);
536  unset($tmpwebsitepage);
537  }
538  if ($result > 0) {
539  $currenturi = $_SERVER["REQUEST_URI"];
540  $regtmp = array();
541  if (preg_match('/&pageref=([^&]+)/', $currenturi, $regtmp)) {
542  if ($regtmp[0] == $containerref) {
543  print "Error, page with uri '.$currenturi.' try a redirect to the same alias page '".$containerref."' in web site '".$website->ref."'";
544  exit;
545  } else {
546  $newurl = preg_replace('/&pageref=([^&]+)/', '&pageref='.$containerref, $currenturi);
547  }
548  } else {
549  $newurl = $currenturi.'&pageref='.urlencode($containerref);
550  }
551  }
552  } else // When page called from virtual host server
553  {
554  $newurl = '/'.$containerref.'.php';
555  }
556 
557  if ($newurl) {
558  if ($permanent) {
559  header("Status: 301 Moved Permanently", false, 301);
560  }
561  header("Location: ".$newurl.(empty($_SERVER["QUERY_STRING"]) ? '' : '?'.$_SERVER["QUERY_STRING"]));
562  exit;
563  } else {
564  print "Error, page contains a redirect to the alias page '".$containerref."' that does not exists in web site (".$website->id." / ".$website->ref.")";
565  exit;
566  }
567 }
568 
569 
577 function includeContainer($containerref)
578 {
579  global $conf, $db, $hookmanager, $langs, $mysoc, $user, $website, $websitepage, $weblangs; // Very important. Required to have var available when running included containers.
580  global $includehtmlcontentopened;
581  global $websitekey, $websitepagefile;
582 
583  $MAXLEVEL = 20;
584 
585  if (!preg_match('/\.php$/i', $containerref)) {
586  $containerref .= '.php';
587  }
588 
589  $fullpathfile = DOL_DATA_ROOT.($conf->entity > 1 ? '/'.$conf->entity : '').'/website/'.$websitekey.'/'.$containerref;
590 
591  if (empty($includehtmlcontentopened)) {
592  $includehtmlcontentopened = 0;
593  }
594  $includehtmlcontentopened++;
595  if ($includehtmlcontentopened > $MAXLEVEL) {
596  print 'ERROR: RECURSIVE CONTENT LEVEL. Depth of recursive call is more than the limit of '.((int) $MAXLEVEL).".\n";
597  return;
598  }
599 
600  //dol_syslog("Include container ".$containerref.' includehtmlcontentopened='.$includehtmlcontentopened);
601 
602  // file_get_contents is not possible. We must execute code with include
603  //$content = file_get_contents($fullpathfile);
604  //print preg_replace(array('/^.*<body[^>]*>/ims','/<\/body>.*$/ims'), array('', ''), $content);*/
605 
606  ob_start();
607  $res = include $fullpathfile; // Include because we want to execute code content
608  $tmpoutput = ob_get_contents();
609  ob_end_clean();
610 
611  print "\n".'<!-- include '.$websitekey.'/'.$containerref.(is_object($websitepage) ? ' parent id='.$websitepage->id : '').' level = '.$includehtmlcontentopened.' -->'."\n";
612  print preg_replace(array('/^.*<body[^>]*>/ims', '/<\/body>.*$/ims'), array('', ''), $tmpoutput);
613 
614  if (!$res) {
615  print 'ERROR: FAILED TO INCLUDE PAGE '.$containerref.".\n";
616  }
617 
618  $includehtmlcontentopened--;
619 }
620 
631 function getStructuredData($type, $data = array())
632 {
633  global $conf, $db, $hookmanager, $langs, $mysoc, $user, $website, $websitepage, $weblangs, $pagelangs; // Very important. Required to have var available when running inluded containers.
634 
635  $type = strtolower($type);
636 
637  if ($type == 'software') {
638  $ret = '<!-- Add structured data for entry in a software annuary -->'."\n";
639  $ret .= '<script nonce="'.getNonce().'" type="application/ld+json">'."\n";
640  $ret .= '{
641  "@context": "https://schema.org",
642  "@type": "SoftwareApplication",
643  "name": "'.dol_escape_json($data['name']).'",
644  "operatingSystem": "'.dol_escape_json($data['os']).'",
645  "applicationCategory": "https://schema.org/'.dol_escape_json($data['applicationCategory']).'",';
646  if (!empty($data['ratingcount'])) {
647  $ret .= '
648  "aggregateRating": {
649  "@type": "AggregateRating",
650  "ratingValue": "'.dol_escape_json($data['ratingvalue']).'",
651  "ratingCount": "'.dol_escape_json($data['ratingcount']).'"
652  },';
653  }
654  $ret .= '
655  "offers": {
656  "@type": "Offer",
657  "price": "'.dol_escape_json($data['price']).'",
658  "priceCurrency": "'.dol_escape_json($data['currency'] ? $data['currency'] : $conf->currency).'"
659  }
660  }'."\n";
661  $ret .= '</script>'."\n";
662  } elseif ($type == 'organization') {
663  $companyname = $mysoc->name;
664  $url = $mysoc->url;
665 
666  $ret = '<!-- Add structured data for organization -->'."\n";
667  $ret .= '<script nonce="'.getNonce().'" type="application/ld+json">'."\n";
668  $ret .= '{
669  "@context": "https://schema.org",
670  "@type": "Organization",
671  "name": "'.dol_escape_json($data['name'] ? $data['name'] : $companyname).'",
672  "url": "'.dol_escape_json($data['url'] ? $data['url'] : $url).'",
673  "logo": "'.($data['logo'] ? dol_escape_json($data['logo']) : '/wrapper.php?modulepart=mycompany&file=logos%2F'.urlencode($mysoc->logo)).'",
674  "contactPoint": {
675  "@type": "ContactPoint",
676  "contactType": "Contact",
677  "email": "'.dol_escape_json($data['email'] ? $data['email'] : $mysoc->email).'"
678  }'."\n";
679  if (is_array($mysoc->socialnetworks) && count($mysoc->socialnetworks) > 0) {
680  $ret .= ",\n";
681  $ret .= '"sameAs": [';
682  $i = 0;
683  foreach ($mysoc->socialnetworks as $key => $value) {
684  if ($key == 'linkedin') {
685  $ret .= '"https://www.'.$key.'.com/company/'.dol_escape_json($value).'"';
686  } elseif ($key == 'youtube') {
687  $ret .= '"https://www.'.$key.'.com/user/'.dol_escape_json($value).'"';
688  } else {
689  $ret .= '"https://www.'.$key.'.com/'.dol_escape_json($value).'"';
690  }
691  $i++;
692  if ($i < count($mysoc->socialnetworks)) {
693  $ret .= ', ';
694  }
695  }
696  $ret .= ']'."\n";
697  }
698  $ret .= '}'."\n";
699  $ret .= '</script>'."\n";
700  } elseif ($type == 'blogpost') {
701  if (!empty($websitepage->author_alias)) {
702  //include_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
703  //$tmpuser = new User($db);
704  //$restmpuser = $tmpuser->fetch($websitepage->fk_user_creat);
705 
706  $pageurl = $websitepage->pageurl;
707  $title = $websitepage->title;
708  $image = $websitepage->image;
709  $companyname = $mysoc->name;
710  $description = $websitepage->description;
711 
712  $pageurl = str_replace('__WEBSITE_KEY__', $website->ref, $pageurl);
713  $title = str_replace('__WEBSITE_KEY__', $website->ref, $title);
714  $image = '/medias'.(preg_match('/^\//', $image) ? '' : '/').str_replace('__WEBSITE_KEY__', $website->ref, $image);
715  $companyname = str_replace('__WEBSITE_KEY__', $website->ref, $companyname);
716  $description = str_replace('__WEBSITE_KEY__', $website->ref, $description);
717 
718  $ret = '<!-- Add structured data for blog post -->'."\n";
719  $ret .= '<script nonce="'.getNonce().'" type="application/ld+json">'."\n";
720  $ret .= '{
721  "@context": "https://schema.org",
722  "@type": "NewsArticle",
723  "mainEntityOfPage": {
724  "@type": "WebPage",
725  "@id": "'.dol_escape_json($pageurl).'"
726  },
727  "headline": "'.dol_escape_json($title).'",
728  "image": [
729  "'.dol_escape_json($image).'"
730  ],
731  "dateCreated": "'.dol_print_date($websitepage->date_creation, 'dayhourrfc').'",
732  "datePublished": "'.dol_print_date($websitepage->date_creation, 'dayhourrfc').'",
733  "dateModified": "'.dol_print_date($websitepage->date_modification, 'dayhourrfc').'",
734  "author": {
735  "@type": "Person",
736  "name": "'.dol_escape_json($websitepage->author_alias).'"
737  },
738  "publisher": {
739  "@type": "Organization",
740  "name": "'.dol_escape_json($companyname).'",
741  "logo": {
742  "@type": "ImageObject",
743  "url": "/wrapper.php?modulepart=mycompany&file=logos%2F'.urlencode($mysoc->logo).'"
744  }
745  },'."\n";
746  if ($websitepage->keywords) {
747  $ret .= '"keywords": [';
748  $i = 0;
749  $arrayofkeywords = explode(',', $websitepage->keywords);
750  foreach ($arrayofkeywords as $keyword) {
751  $ret .= '"'.dol_escape_json($keyword).'"';
752  $i++;
753  if ($i < count($arrayofkeywords)) {
754  $ret .= ', ';
755  }
756  }
757  $ret .= '],'."\n";
758  }
759  $ret .= '"description": "'.dol_escape_json($description).'"';
760  $ret .= "\n".'}'."\n";
761  $ret .= '</script>'."\n";
762  } else {
763  $ret = '<!-- no structured data inserted inline inside blogpost because no author_alias defined -->'."\n";
764  }
765  } elseif ($type == 'product') {
766  $ret = '<!-- Add structured data for product -->'."\n";
767  $ret .= '<script nonce="'.getNonce().'" type="application/ld+json">'."\n";
768  $ret .= '{
769  "@context": "https://schema.org/",
770  "@type": "Product",
771  "name": "'.dol_escape_json($data['label']).'",
772  "image": [
773  "'.dol_escape_json($data['image']).'",
774  ],
775  "description": "'.dol_escape_json($data['description']).'",
776  "sku": "'.dol_escape_json($data['ref']).'",
777  "brand": {
778  "@type": "Thing",
779  "name": "'.dol_escape_json($data['brand']).'"
780  },
781  "author": {
782  "@type": "Person",
783  "name": "'.dol_escape_json($data['author']).'"
784  }
785  },
786  "offers": {
787  "@type": "Offer",
788  "url": "https://example.com/anvil",
789  "priceCurrency": "'.dol_escape_json($data['currency'] ? $data['currency'] : $conf->currency).'",
790  "price": "'.dol_escape_json($data['price']).'",
791  "itemCondition": "https://schema.org/UsedCondition",
792  "availability": "https://schema.org/InStock",
793  "seller": {
794  "@type": "Organization",
795  "name": "'.dol_escape_json($mysoc->name).'"
796  }
797  }
798  }'."\n";
799  $ret .= '</script>'."\n";
800  } elseif ($type == 'qa') {
801  $ret = '<!-- Add structured data for QA -->'."\n";
802  $ret .= '<script nonce="'.getNonce().'" type="application/ld+json">'."\n";
803  $ret .= '{
804  "@context": "https://schema.org/",
805  "@type": "QAPage",
806  "mainEntity": {
807  "@type": "Question",
808  "name": "'.dol_escape_json($data['name']).'",
809  "text": "'.dol_escape_json($data['name']).'",
810  "answerCount": 1,
811  "author": {
812  "@type": "Person",
813  "name": "'.dol_escape_json($data['author']).'"
814  }
815  "acceptedAnswer": {
816  "@type": "Answer",
817  "text": "'.dol_escape_json(dol_string_nohtmltag(dolStripPhpCode($data['description']))).'",
818  "author": {
819  "@type": "Person",
820  "name": "'.dol_escape_json($data['author']).'"
821  }
822  }
823  }
824  }'."\n";
825  $ret .= '</script>'."\n";
826  }
827  return $ret;
828 }
829 
836 function getSocialNetworkHeaderCards($params = null)
837 {
838  global $conf, $db, $hookmanager, $langs, $mysoc, $user, $website, $websitepage, $weblangs; // Very important. Required to have var available when running inluded containers.
839 
840  $out = '';
841 
842  if ($website->virtualhost) {
843  $pageurl = $websitepage->pageurl;
844  $title = $websitepage->title;
845  $image = $websitepage->image;
846  $companyname = $mysoc->name;
847  $description = $websitepage->description;
848 
849  $pageurl = str_replace('__WEBSITE_KEY__', $website->ref, $pageurl);
850  $title = str_replace('__WEBSITE_KEY__', $website->ref, $title);
851  $image = '/medias'.(preg_match('/^\//', $image) ? '' : '/').str_replace('__WEBSITE_KEY__', $website->ref, $image);
852  $companyname = str_replace('__WEBSITE_KEY__', $website->ref, $companyname);
853  $description = str_replace('__WEBSITE_KEY__', $website->ref, $description);
854 
855  $shortlangcode = '';
856  if ($websitepage->lang) {
857  $shortlangcode = substr($websitepage->lang, 0, 2); // en_US or en-US -> en
858  }
859  if (empty($shortlangcode)) {
860  $shortlangcode = substr($website->lang, 0, 2); // en_US or en-US -> en
861  }
862 
863  $fullurl = $website->virtualhost.'/'.$websitepage->pageurl.'.php';
864  $canonicalurl = $website->virtualhost.(($websitepage->id == $website->fk_default_home) ? '/' : (($shortlangcode != substr($website->lang, 0, 2) ? '/'.$shortlangcode : '').'/'.$websitepage->pageurl.'.php'));
865  $hashtags = trim(join(' #', array_map('trim', explode(',', $websitepage->keywords))));
866 
867  // Open Graph
868  $out .= '<meta name="og:type" content="website">'."\n"; // TODO If blogpost, use type article
869  $out .= '<meta name="og:title" content="'.$websitepage->title.'">'."\n";
870  if ($websitepage->image) {
871  $out .= '<meta name="og:image" content="'.$website->virtualhost.$image.'">'."\n";
872  }
873  $out .= '<meta name="og:url" content="'.$canonicalurl.'">'."\n";
874 
875  // Twitter
876  $out .= '<meta name="twitter:card" content="summary">'."\n";
877  if (!empty($params) && !empty($params['twitter_account'])) {
878  $out .= '<meta name="twitter:site" content="@'.$params['twitter_account'].'">'."\n";
879  $out .= '<meta name="twitter:creator" content="@'.$params['twitter_account'].'">'."\n";
880  }
881  $out .= '<meta name="twitter:title" content="'.$websitepage->title.'">'."\n";
882  if ($websitepage->description) {
883  $out .= '<meta name="twitter:description" content="'.$websitepage->description.'">'."\n";
884  }
885  if ($websitepage->image) {
886  $out .= '<meta name="twitter:image" content="'.$website->virtualhost.$image.'">'."\n";
887  }
888  //$out .= '<meta name="twitter:domain" content="'.getDomainFromURL($website->virtualhost, 1).'">';
889  /*
890  $out .= '<meta name="twitter:app:name:iphone" content="">';
891  $out .= '<meta name="twitter:app:name:ipad" content="">';
892  $out .= '<meta name="twitter:app:name:googleplay" content="">';
893  $out .= '<meta name="twitter:app:url:iphone" content="">';
894  $out .= '<meta name="twitter:app:url:ipad" content="">';
895  $out .= '<meta name="twitter:app:url:googleplay" content="">';
896  $out .= '<meta name="twitter:app:id:iphone" content="">';
897  $out .= '<meta name="twitter:app:id:ipad" content="">';
898  $out .= '<meta name="twitter:app:id:googleplay" content="">';
899  */
900  }
901 
902  return $out;
903 }
904 
911 {
912  global $conf, $db, $hookmanager, $langs, $mysoc, $user, $website, $websitepage, $weblangs; // Very important. Required to have var available when running inluded containers.
913 
914  $out = '<!-- section for social network sharing of page -->'."\n";
915 
916  if ($website->virtualhost) {
917  $fullurl = $website->virtualhost.'/'.$websitepage->pageurl.'.php';
918  $hashtags = trim(join(' #', array_map('trim', explode(',', $websitepage->keywords))));
919 
920  $out .= '<div class="dol-social-share">'."\n";
921 
922  // Twitter
923  $out .= '<div class="dol-social-share-tw">'."\n";
924  $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>';
925  $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>';
926  $out .= '</div>'."\n";
927 
928  // Reddit
929  $out .= '<div class="dol-social-share-reddit">'."\n";
930  $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">';
931  $out .= '<span class="dol-social-share-reddit-span">Reddit</span>';
932  $out .= '</a>';
933  $out .= '</div>'."\n";
934 
935  // Facebook
936  $out .= '<div class="dol-social-share-fbl">'."\n";
937  $out .= '<div id="fb-root"></div>'."\n";
938  $out .= '<script nonce="'.getNonce().'">(function(d, s, id) {
939  var js, fjs = d.getElementsByTagName(s)[0];
940  if (d.getElementById(id)) return;
941  js = d.createElement(s); js.id = id;
942  js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.0&amp;appId=dolibarr.org";
943  fjs.parentNode.insertBefore(js, fjs);
944  }(document, \'script\', \'facebook-jssdk\'));</script>
945  <fb:like
946  href="'.$fullurl.'"
947  layout="button_count"
948  show_faces="false"
949  width="90"
950  colorscheme="light"
951  share="1"
952  action="like" ></fb:like>'."\n";
953  $out .= '</div>'."\n";
954 
955  $out .= "\n</div>\n";
956  } else {
957  $out .= '<!-- virtual host not defined in CMS. No way to add sharing buttons -->'."\n";
958  }
959  $out .= '<!-- section end for social network sharing of page -->'."\n";
960 
961  return $out;
962 }
963 
979 function getPagesFromSearchCriterias($type, $algo, $searchstring, $max = 25, $sortfield = 'date_creation', $sortorder = 'DESC', $langcode = '', $otherfilters = 'null', $status = 1)
980 {
981  global $conf, $db, $hookmanager, $langs, $mysoc, $user, $website, $websitepage, $weblangs; // Very important. Required to have var available when running inluded containers.
982 
983  $error = 0;
984  $arrayresult = array('code'=>'', 'list'=>array());
985 
986  if (!is_object($weblangs)) {
987  $weblangs = $langs;
988  }
989 
990  if (empty($searchstring) && empty($type) && empty($langcode) && empty($otherfilters)) {
991  $error++;
992  $arrayresult['code'] = 'KO';
993  $arrayresult['message'] = $weblangs->trans("EmptySearchString");
994  } elseif ($searchstring && dol_strlen($searchstring) < 2) {
995  $weblangs->load("errors");
996  $error++;
997  $arrayresult['code'] = 'KO';
998  $arrayresult['message'] = $weblangs->trans("ErrorSearchCriteriaTooSmall");
999  } else {
1000  $tmparrayoftype = explode(',', $type);
1001  /*foreach ($tmparrayoftype as $tmptype) {
1002  if (!in_array($tmptype, array('', 'page', 'blogpost'))) {
1003  $error++;
1004  $arrayresult['code'] = 'KO';
1005  $arrayresult['message'] = 'Bad value for parameter type';
1006  break;
1007  }
1008  }*/
1009  }
1010 
1011  $searchdone = 0;
1012  $found = 0;
1013 
1014  if (!$error && (empty($max) || ($found < $max)) && (preg_match('/meta/', $algo) || preg_match('/content/', $algo))) {
1015  include_once DOL_DOCUMENT_ROOT.'/website/class/websitepage.class.php';
1016 
1017  $sql = 'SELECT wp.rowid FROM '.MAIN_DB_PREFIX.'website_page as wp';
1018  if (is_array($otherfilters) && !empty($otherfilters['category'])) {
1019  $sql .= ', '.MAIN_DB_PREFIX.'categorie_website_page as cwp';
1020  }
1021  $sql .= " WHERE wp.fk_website = ".((int) $website->id);
1022  if ($status >= 0) {
1023  $sql .= " AND wp.status = ".((int) $status);
1024  }
1025  if ($langcode) {
1026  $sql .= " AND wp.lang = '".$db->escape($langcode)."'";
1027  }
1028  if ($type) {
1029  $tmparrayoftype = explode(',', $type);
1030  $typestring = '';
1031  foreach ($tmparrayoftype as $tmptype) {
1032  $typestring .= ($typestring ? ", " : "")."'".$db->escape(trim($tmptype))."'";
1033  }
1034  $sql .= " AND wp.type_container IN (".$db->sanitize($typestring, 1).")";
1035  }
1036  $sql .= " AND (";
1037  $searchalgo = '';
1038  if (preg_match('/meta/', $algo)) {
1039  $searchalgo .= ($searchalgo ? ' OR ' : '')."wp.title LIKE '%".$db->escape($db->escapeforlike($searchstring))."%' OR wp.description LIKE '%".$db->escape($db->escapeforlike($searchstring))."%'";
1040  $searchalgo .= ($searchalgo ? ' OR ' : '')."wp.keywords LIKE '".$db->escape($db->escapeforlike($searchstring)).",%' OR wp.keywords LIKE '% ".$db->escape($db->escapeforlike($searchstring))."%'"; // TODO Use a better way to scan keywords
1041  }
1042  if (preg_match('/content/', $algo)) {
1043  $searchalgo .= ($searchalgo ? ' OR ' : '')."wp.content LIKE '%".$db->escape($db->escapeforlike($searchstring))."%'";
1044  }
1045  $sql .= $searchalgo;
1046  if (is_array($otherfilters) && !empty($otherfilters['category'])) {
1047  $sql .= ' AND cwp.fk_website_page = wp.rowid AND cwp.fk_categorie = '.((int) $otherfilters['category']);
1048  }
1049  $sql .= ")";
1050  $sql .= $db->order($sortfield, $sortorder);
1051  $sql .= $db->plimit($max);
1052  //print $sql;
1053 
1054  $resql = $db->query($sql);
1055 
1056  if ($resql) {
1057  $i = 0;
1058  while (($obj = $db->fetch_object($resql)) && ($i < $max || $max == 0)) {
1059  if ($obj->rowid > 0) {
1060  $tmpwebsitepage = new WebsitePage($db);
1061  $tmpwebsitepage->fetch($obj->rowid);
1062  if ($tmpwebsitepage->id > 0) {
1063  $arrayresult['list'][$obj->rowid] = $tmpwebsitepage;
1064  }
1065  $found++;
1066  }
1067  $i++;
1068  }
1069  } else {
1070  $error++;
1071  $arrayresult['code'] = $db->lasterrno();
1072  $arrayresult['message'] = $db->lasterror();
1073  }
1074 
1075  $searchdone = 1;
1076  }
1077 
1078  if (!$error && (empty($max) || ($found < $max)) && (preg_match('/sitefiles/', $algo))) {
1079  global $dolibarr_main_data_root;
1080 
1081  $pathofwebsite = $dolibarr_main_data_root.($conf->entity > 1 ? '/'.$conf->entity : '').'/website/'.$website->ref;
1082  $filehtmlheader = $pathofwebsite.'/htmlheader.html';
1083  $filecss = $pathofwebsite.'/styles.css.php';
1084  $filejs = $pathofwebsite.'/javascript.js.php';
1085  $filerobot = $pathofwebsite.'/robots.txt';
1086  $filehtaccess = $pathofwebsite.'/.htaccess';
1087  $filemanifestjson = $pathofwebsite.'/manifest.json.php';
1088  $filereadme = $pathofwebsite.'/README.md';
1089 
1090  $filecontent = file_get_contents($filehtmlheader);
1091  if ((empty($max) || ($found < $max)) && preg_match('/'.preg_quote($searchstring, '/').'/', $filecontent)) {
1092  $arrayresult['list'][] = array('type'=>'website_htmlheadercontent');
1093  }
1094 
1095  $filecontent = file_get_contents($filecss);
1096  if ((empty($max) || ($found < $max)) && preg_match('/'.preg_quote($searchstring, '/').'/', $filecontent)) {
1097  $arrayresult['list'][] = array('type'=>'website_csscontent');
1098  }
1099 
1100  $filecontent = file_get_contents($filejs);
1101  if ((empty($max) || ($found < $max)) && preg_match('/'.preg_quote($searchstring, '/').'/', $filecontent)) {
1102  $arrayresult['list'][] = array('type'=>'website_jscontent');
1103  }
1104 
1105  $filerobot = file_get_contents($filerobot);
1106  if ((empty($max) || ($found < $max)) && preg_match('/'.preg_quote($searchstring, '/').'/', $filecontent)) {
1107  $arrayresult['list'][] = array('type'=>'website_robotcontent');
1108  }
1109 
1110  $searchdone = 1;
1111  }
1112 
1113  if (!$error) {
1114  if ($searchdone) {
1115  $arrayresult['code'] = 'OK';
1116  if (empty($arrayresult['list'])) {
1117  $arrayresult['code'] = 'KO';
1118  $arrayresult['message'] = $weblangs->trans("NoRecordFound");
1119  }
1120  } else {
1121  $error++;
1122  $arrayresult['code'] = 'KO';
1123  $arrayresult['message'] = 'No supported algorithm found';
1124  }
1125  }
1126 
1127  return $arrayresult;
1128 }
1129 
1144 function getAllImages($object, $objectpage, $urltograb, &$tmp, &$action, $modifylinks = 0, $grabimages = 1, $grabimagesinto = 'subpage')
1145 {
1146  global $conf;
1147 
1148  $error = 0;
1149 
1150  dol_syslog("Call getAllImages with grabimagesinto=".$grabimagesinto);
1151 
1152  $alreadygrabbed = array();
1153 
1154  if (preg_match('/\/$/', $urltograb)) {
1155  $urltograb .= '.';
1156  }
1157  $urltograb = dirname($urltograb); // So urltograb is now http://www.nltechno.com or http://www.nltechno.com/dir1
1158 
1159  // Search X in "img...src=X"
1160  $regs = array();
1161  preg_match_all('/<img([^\.\/]+)src="([^>"]+)"([^>]*)>/i', $tmp, $regs);
1162 
1163  foreach ($regs[0] as $key => $val) {
1164  if (preg_match('/^data:image/i', $regs[2][$key])) {
1165  continue; // We do nothing for such images
1166  }
1167 
1168  if (preg_match('/^\//', $regs[2][$key])) {
1169  $urltograbdirrootwithoutslash = getRootURLFromURL($urltograb);
1170  $urltograbbis = $urltograbdirrootwithoutslash.$regs[2][$key]; // We use dirroot
1171  } else {
1172  $urltograbbis = $urltograb.'/'.$regs[2][$key]; // We use dir of grabbed file
1173  }
1174 
1175  $linkwithoutdomain = $regs[2][$key];
1176  $dirforimages = '/'.$objectpage->pageurl;
1177  if ($grabimagesinto == 'root') {
1178  $dirforimages = '';
1179  }
1180 
1181  // Define $filetosave and $filename
1182  $filetosave = $conf->medias->multidir_output[$conf->entity].'/image/'.$object->ref.$dirforimages.(preg_match('/^\//', $regs[2][$key]) ? '' : '/').$regs[2][$key];
1183  if (preg_match('/^http/', $regs[2][$key])) {
1184  $urltograbbis = $regs[2][$key];
1185  $linkwithoutdomain = preg_replace('/^https?:\/\/[^\/]+\//i', '', $regs[2][$key]);
1186  $filetosave = $conf->medias->multidir_output[$conf->entity].'/image/'.$object->ref.$dirforimages.(preg_match('/^\//', $linkwithoutdomain) ? '' : '/').$linkwithoutdomain;
1187  }
1188  $filename = 'image/'.$object->ref.$dirforimages.(preg_match('/^\//', $linkwithoutdomain) ? '' : '/').$linkwithoutdomain;
1189 
1190  // Clean the aa/bb/../cc into aa/cc
1191  $filetosave = preg_replace('/\/[^\/]+\/\.\./', '', $filetosave);
1192  $filename = preg_replace('/\/[^\/]+\/\.\./', '', $filename);
1193 
1194  //var_dump($filetosave);
1195  //var_dump($filename);
1196  //exit;
1197 
1198  if (empty($alreadygrabbed[$urltograbbis])) {
1199  if ($grabimages) {
1200  $tmpgeturl = getURLContent($urltograbbis, 'GET', '', 1, array(), array('http', 'https'), 0);
1201  if ($tmpgeturl['curl_error_no']) {
1202  $error++;
1203  setEventMessages('Error getting '.$urltograbbis.': '.$tmpgeturl['curl_error_msg'], null, 'errors');
1204  $action = 'create';
1205  } elseif ($tmpgeturl['http_code'] != '200') {
1206  $error++;
1207  setEventMessages('Error getting '.$urltograbbis.': '.$tmpgeturl['http_code'], null, 'errors');
1208  $action = 'create';
1209  } else {
1210  $alreadygrabbed[$urltograbbis] = 1; // Track that file was alreay grabbed.
1211 
1212  dol_mkdir(dirname($filetosave));
1213 
1214  $fp = fopen($filetosave, "w");
1215  fputs($fp, $tmpgeturl['content']);
1216  fclose($fp);
1217  dolChmod($filetosave);
1218  }
1219  }
1220  }
1221 
1222  if ($modifylinks) {
1223  $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);
1224  }
1225  }
1226 
1227  // Search X in "background...url(X)"
1228  preg_match_all('/background([^\.\/\(;]+)url\([\"\']?([^\)\"\']*)[\"\']?\)/i', $tmp, $regs);
1229 
1230  foreach ($regs[0] as $key => $val) {
1231  if (preg_match('/^data:image/i', $regs[2][$key])) {
1232  continue; // We do nothing for such images
1233  }
1234 
1235  if (preg_match('/^\//', $regs[2][$key])) {
1236  $urltograbdirrootwithoutslash = getRootURLFromURL($urltograb);
1237  $urltograbbis = $urltograbdirrootwithoutslash.$regs[2][$key]; // We use dirroot
1238  } else {
1239  $urltograbbis = $urltograb.'/'.$regs[2][$key]; // We use dir of grabbed file
1240  }
1241 
1242  $linkwithoutdomain = $regs[2][$key];
1243 
1244  $dirforimages = '/'.$objectpage->pageurl;
1245  if ($grabimagesinto == 'root') {
1246  $dirforimages = '';
1247  }
1248 
1249  $filetosave = $conf->medias->multidir_output[$conf->entity].'/image/'.$object->ref.$dirforimages.(preg_match('/^\//', $regs[2][$key]) ? '' : '/').$regs[2][$key];
1250 
1251  if (preg_match('/^http/', $regs[2][$key])) {
1252  $urltograbbis = $regs[2][$key];
1253  $linkwithoutdomain = preg_replace('/^https?:\/\/[^\/]+\//i', '', $regs[2][$key]);
1254  $filetosave = $conf->medias->multidir_output[$conf->entity].'/image/'.$object->ref.$dirforimages.(preg_match('/^\//', $linkwithoutdomain) ? '' : '/').$linkwithoutdomain;
1255  }
1256 
1257  $filename = 'image/'.$object->ref.$dirforimages.(preg_match('/^\//', $linkwithoutdomain) ? '' : '/').$linkwithoutdomain;
1258 
1259  // Clean the aa/bb/../cc into aa/cc
1260  $filetosave = preg_replace('/\/[^\/]+\/\.\./', '', $filetosave);
1261  $filename = preg_replace('/\/[^\/]+\/\.\./', '', $filename);
1262 
1263  //var_dump($filetosave);
1264  //var_dump($filename);
1265  //exit;
1266 
1267  if (empty($alreadygrabbed[$urltograbbis])) {
1268  if ($grabimages) {
1269  $tmpgeturl = getURLContent($urltograbbis, 'GET', '', 1, array(), array('http', 'https'), 0);
1270  if ($tmpgeturl['curl_error_no']) {
1271  $error++;
1272  setEventMessages('Error getting '.$urltograbbis.': '.$tmpgeturl['curl_error_msg'], null, 'errors');
1273  $action = 'create';
1274  } elseif ($tmpgeturl['http_code'] != '200') {
1275  $error++;
1276  setEventMessages('Error getting '.$urltograbbis.': '.$tmpgeturl['http_code'], null, 'errors');
1277  $action = 'create';
1278  } else {
1279  $alreadygrabbed[$urltograbbis] = 1; // Track that file was alreay grabbed.
1280 
1281  dol_mkdir(dirname($filetosave));
1282 
1283  $fp = fopen($filetosave, "w");
1284  fputs($fp, $tmpgeturl['content']);
1285  fclose($fp);
1286  dolChmod($filetosave);
1287  }
1288  }
1289  }
1290 
1291  if ($modifylinks) {
1292  $tmp = preg_replace('/'.preg_quote($regs[0][$key], '/').'/i', 'background'.$regs[1][$key].'url("'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file='.$filename.'")', $tmp);
1293  }
1294  }
1295 }
dol_getdate
dol_getdate($timestamp, $fast=false, $forcetimezone='')
Return an array with locale date info.
Definition: functions.lib.php:2925
getSocialNetworkSharingLinks
getSocialNetworkSharingLinks()
Return HTML content to add structured data for an article, news or Blog Post.
Definition: website.lib.php:910
dolStripPhpCode
dolStripPhpCode($str, $replacewith='')
Remove PHP code part from a string.
Definition: website.lib.php:32
WebsitePage
Class Websitepage.
Definition: websitepage.class.php:36
includeContainer
includeContainer($containerref)
Clean an HTML page to report only content, so we can include it into another page.
Definition: website.lib.php:577
dol_escape_htmltag
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...
Definition: functions.lib.php:1600
dolKeepOnlyPhpCode
dolKeepOnlyPhpCode($str)
Keep only PHP code part from a HTML string page.
Definition: website.lib.php:76
getStructuredData
getStructuredData($type, $data=array())
Return HTML content to add structured data for an article, news or Blog Post.
Definition: website.lib.php:631
getRootURLFromURL
getRootURLFromURL($url)
Function root url from a long url For example: https://www.abc.mydomain.com/dir/page....
Definition: geturl.lib.php:369
dolWebsiteIncrementCounter
dolWebsiteIncrementCounter($websiteid, $websitepagetype, $websitepageid)
Increase the website counter of page access.
Definition: website.lib.php:438
getURLContent
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).
Definition: geturl.lib.php:41
dol_print_date
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
Definition: functions.lib.php:2675
dolChmod
dolChmod($filepath, $newmask='')
Change mod of a file.
Definition: functions.lib.php:7007
getSocialNetworkHeaderCards
getSocialNetworkHeaderCards($params=null)
Return HTML content to add as header card for an article, news or Blog Post or home page.
Definition: website.lib.php:836
dolWebsiteReplacementOfLinks
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.
Definition: website.lib.php:118
redirectToContainer
redirectToContainer($containerref, $containeraliasalt='', $containerid=0, $permanent=0)
Format img tags to introduce viewimage on img src.
Definition: website.lib.php:501
getAllImages
getAllImages($object, $objectpage, $urltograb, &$tmp, &$action, $modifylinks=0, $grabimages=1, $grabimagesinto='subpage')
Download all images found into page content $tmp.
Definition: website.lib.php:1144
dol_string_nohtmltag
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
Definition: functions.lib.php:7046
dol_syslog
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
Definition: functions.lib.php:1741
dolReplaceSmileyCodeWithUTF8
dolReplaceSmileyCodeWithUTF8($content)
Converts smiley string into the utf8 sequence.
Definition: website.lib.php:226
setEventMessages
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
Definition: functions.lib.php:8673
getPagesFromSearchCriterias
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.
Definition: website.lib.php:979
$sql
if(isModEnabled('facture') && $user->hasRight('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') && $user->hasRight('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)) $sql
Social contributions to pay.
Definition: index.php:746
dol_strlen
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
Definition: functions.lib.php:3997
dol_now
dol_now($mode='auto')
Return date for now.
Definition: functions.lib.php:3056
dol_mkdir
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
Definition: functions.lib.php:6936
dol_mktime
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...
Definition: functions.lib.php:2968
getDolGlobalInt
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
Definition: functions.lib.php:156
dolWebsiteOutput
dolWebsiteOutput($content, $contenttype='html', $containerid='')
Render a string of an HTML content and output it.
Definition: website.lib.php:277
dol_escape_json
dol_escape_json($stringtoescape)
Returns text escaped for inclusion into javascript code.
Definition: functions.lib.php:1579
if
if(!defined( 'CSRFCHECK_WITH_TOKEN'))
Definition: journals_list.php:25