dolibarr 21.0.0-beta
website2.lib.php File Reference

Library for website module (rare functions not required for execution of website) More...

Go to the source code of this file.

Functions

 dolSaveMasterFile ($filemaster)
 Save content of a page on disk.
 
 dolSavePageAlias ($filealias, $object, $objectpage)
 Save an alias page on disk (A page that include the reference page).
 
 dolSavePageContent ($filetpl, Website $object, WebsitePage $objectpage, $backupold=0)
 Save content of a page on disk (page name is generally ID_of_page.php).
 
 dolSaveIndexPage ($pathofwebsite, $fileindex, $filetpl, $filewrapper, $object=null)
 Save content of the index.php and/or the wrapper.php page.
 
 dolSaveHtmlHeader ($filehtmlheader, $htmlheadercontent)
 Save content of a page on disk.
 
 dolSaveCssFile ($filecss, $csscontent)
 Save content of a page on disk.
 
 dolSaveJsFile ($filejs, $jscontent)
 Save content of a page on disk.
 
 dolSaveRobotFile ($filerobot, $robotcontent)
 Save content of a page on disk.
 
 dolSaveHtaccessFile ($filehtaccess, $htaccess)
 Save content of a page on disk.
 
 dolSaveManifestJson ($file, $content)
 Save content of a page on disk.
 
 dolSaveReadme ($file, $content)
 Save content of a page on disk.
 
 dolSaveLicense ($file, $content)
 Save content of a page on disk.
 
 showWebsiteTemplates (Website $website)
 Show list of themes.
 
 checkPHPCode (&$phpfullcodestringold, &$phpfullcodestring)
 Check a new string containing only php code (including <php tag)
 

Detailed Description

Library for website module (rare functions not required for execution of website)

Definition in file website2.lib.php.

Function Documentation

◆ checkPHPCode()

checkPHPCode ( & $phpfullcodestringold,
& $phpfullcodestring )

Check a new string containing only php code (including <php tag)

  • Block if bad code in the new string.
  • Block also if user has no permission to change PHP code.
Parameters
string$phpfullcodestringoldPHP old string (before the change). For example "<?php echo 'a' ?><php echo 'b' ?>"
string$phpfullcodestringPHP new string. For example "<?php echo 'a' ?><php echo 'c' ?>"
Returns
int Error or not
See also
dolKeepOnlyPhpCode(), dol_eval() to see sanitizing rules that should be very close.

Definition at line 705 of file website2.lib.php.

References dol_is_file(), getDolGlobalString(), and setEventMessages().

Referenced by run_sql().

◆ dolSaveCssFile()

dolSaveCssFile ( $filecss,
$csscontent )

Save content of a page on disk.

Parameters
string$filecssFull path of filename to generate
string$csscontentContent of file
Returns
boolean True if OK

Definition at line 434 of file website2.lib.php.

References dol_mkdir(), dol_syslog(), and dolChmod().

◆ dolSaveHtaccessFile()

dolSaveHtaccessFile ( $filehtaccess,
$htaccess )

Save content of a page on disk.

Parameters
string$filehtaccessFull path of filename to generate
string$htaccessContent of file
Returns
boolean True if OK

Definition at line 494 of file website2.lib.php.

References dol_mkdir(), dol_syslog(), and dolChmod().

◆ dolSaveHtmlHeader()

dolSaveHtmlHeader ( $filehtmlheader,
$htmlheadercontent )

Save content of a page on disk.

Parameters
string$filehtmlheaderFull path of filename to generate
string$htmlheadercontentContent of file
Returns
boolean True if OK

Definition at line 414 of file website2.lib.php.

References dol_mkdir(), dol_syslog(), and dolChmod().

◆ dolSaveIndexPage()

dolSaveIndexPage ( $pathofwebsite,
$fileindex,
$filetpl,
$filewrapper,
$object = null )

Save content of the index.php and/or the wrapper.php page.

Parameters
string$pathofwebsitePath of website root
string$fileindexFull path of file index.php
string$filetplFile tpl the index.php page redirect to (used only if $fileindex is provided)
string$filewrapperFull path of file wrapper.php
Website$objectObject website
Returns
boolean True if OK

Definition at line 325 of file website2.lib.php.

References $object, dol_delete_file(), dol_mkdir(), dol_syslog(), dolChmod(), and getDolGlobalString().

Referenced by Website\createFromClone(), and Website\rebuildWebSiteFiles().

◆ dolSaveJsFile()

dolSaveJsFile ( $filejs,
$jscontent )

Save content of a page on disk.

For example into documents/website/mywebsite/javascript.js.php file.

Parameters
string$filejsFull path of filename to generate
string$jscontentContent of file
Returns
boolean True if OK

Definition at line 454 of file website2.lib.php.

References dol_mkdir(), dol_syslog(), and dolChmod().

◆ dolSaveLicense()

dolSaveLicense ( $file,
$content )

Save content of a page on disk.

Parameters
string$fileFull path of filename to generate
string$contentContent of file
Returns
boolean True if OK

Definition at line 554 of file website2.lib.php.

References dol_mkdir(), dol_syslog(), and dolChmod().

◆ dolSaveManifestJson()

dolSaveManifestJson ( $file,
$content )

Save content of a page on disk.

Parameters
string$fileFull path of filename to generate
string$contentContent of file
Returns
boolean True if OK

Definition at line 514 of file website2.lib.php.

References dol_mkdir(), dol_syslog(), and dolChmod().

◆ dolSaveMasterFile()

dolSaveMasterFile ( $filemaster)

Save content of a page on disk.

Parameters
string$filemasterFull path of filename master.inc.php for website to generate
Returns
boolean True if OK

Definition at line 32 of file website2.lib.php.

References dol_delete_file(), dol_syslog(), and dolChmod().

◆ dolSavePageAlias()

dolSavePageAlias ( $filealias,
$object,
$objectpage )

Save an alias page on disk (A page that include the reference page).

It saves file into the root directory but also into language subdirectory.

Parameters
string$filealiasFull path of filename to generate
Website$objectObject website
WebsitePage$objectpageObject websitepage
Returns
boolean True if OK
See also
dolSavePageContent()

Definition at line 62 of file website2.lib.php.

References $object, dol_mkdir(), dol_syslog(), dolChmod(), and getDolGlobalString().

Referenced by Website\createFromClone(), and Website\rebuildWebSiteFiles().

◆ dolSavePageContent()

dolSavePageContent ( $filetpl,
Website $object,
WebsitePage $objectpage,
$backupold = 0 )

Save content of a page on disk (page name is generally ID_of_page.php).

Page contents are always saved into "root" directory. Only aliases pages saved with dolSavePageAlias() can be in root or language subdir.

Parameters
string$filetplFull path of filename to generate
Website$objectObject website
WebsitePage$objectpageObject websitepage
int$backupold1=Make a backup of old page
Returns
boolean True if OK
See also
dolSavePageAlias()

Definition at line 142 of file website2.lib.php.

References $object, archiveOrBackupFile(), dol_delete_file(), dol_is_file(), dol_print_error(), dol_syslog(), dolChmod(), and getDolGlobalString().

Referenced by Website\createFromClone(), and Website\rebuildWebSiteFiles().

◆ dolSaveReadme()

dolSaveReadme ( $file,
$content )

Save content of a page on disk.

Parameters
string$fileFull path of filename to generate
string$contentContent of file
Returns
boolean True if OK

Definition at line 534 of file website2.lib.php.

References dol_mkdir(), dol_syslog(), and dolChmod().

◆ dolSaveRobotFile()

dolSaveRobotFile ( $filerobot,
$robotcontent )

Save content of a page on disk.

Parameters
string$filerobotFull path of filename to generate
string$robotcontentContent of file
Returns
boolean True if OK

Definition at line 474 of file website2.lib.php.

References dol_mkdir(), dol_syslog(), and dolChmod().

◆ showWebsiteTemplates()

showWebsiteTemplates ( Website $website)

Show list of themes.

Show all thumbs of themes/skins

Parameters
Website$websiteObject website to load the template into
Returns
void

Definition at line 573 of file website2.lib.php.

References $conf, dol_buildpath(), dol_filemtime(), dol_filesize(), dol_print_date(), getAdvancedPreviewUrl(), getDolGlobalInt(), img_picto(), and newToken().