dolibarr  9.0.0
Functions
main.inc.php File Reference

File that defines environment for Dolibarr GUI pages only (file not required by scripts) More...

Go to the source code of this file.

Functions

if(! empty($_SERVER['MAIN_SHOW_TUNING_INFO'])) if(function_exists('get_magic_quotes_gpc')) test_sql_and_script_inject ($val, $type)
 Security: SQL Injection and XSS Injection (scripts) protection (Filters on GET, POST, PHP_SELF). More...
 
 testSqlAndScriptInject ($val, $type)
 Security: SQL Injection and XSS Injection (scripts) protection (Filters on GET, POST, PHP_SELF). More...
 
 analyseVarsForSqlAndScriptsInjection (&$var, $type)
 Return true if security check on parameters are OK, false otherwise. More...
 
if(! defined('NOREQUIREMENU')) if(! function_exists("llxHeader")) top_httphead ($contenttype='text/html', $forcenocache=0)
 Show HTTP header. More...
 
 top_htmlhead ($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $disablejmobile=0, $disablenofollow=0)
 Ouput html header of a page. More...
 
 top_menu ($head, $title='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $helppagename='')
 Show an HTML header + a BODY + The top menu bar. More...
 
 left_menu ($menu_array_before, $helppagename='', $notused='', $menu_array_after='', $leftmenuwithoutmainarea=0, $title='', $acceptdelayedhtml=0)
 Show left menu bar. More...
 
 main_area ($title='')
 Begin main area. More...
 
 getHelpParamFor ($helppagename, $langs)
 Return helpbaseurl, helppage and mode. More...
 
 printSearchForm ($urlaction, $urlobject, $title, $htmlmorecss, $htmlinputname, $accesskey='', $prefhtmlinputname='', $img='', $showtitlebefore=0, $autofocus=0)
 Show a search area. More...
 

Detailed Description

File that defines environment for Dolibarr GUI pages only (file not required by scripts)

Definition in file main.inc.php.

Function Documentation

◆ analyseVarsForSqlAndScriptsInjection()

analyseVarsForSqlAndScriptsInjection ( $var,
  $type 
)

Return true if security check on parameters are OK, false otherwise.

Parameters
string$varVariable name
string$type1=GET, 0=POST, 2=PHP_SELF
Returns
boolean|null true if there is no injection. Stop code if injection found.

Show HTML header HTML + BODY + Top menu + left menu + DIV

Parameters
string$headOptionnal head lines
string$titleHTML title
string$help_urlUrl links to help page Syntax is: For a wiki page: EN:EnglishPage|FR:FrenchPage|ES:SpanishPage For other external page: http://server/url
string$targetTarget to use on links
int$disablejsMore content into html header
int$disableheadMore content into html header
array$arrayofjsArray of complementary js files
array$arrayofcssArray of complementary css files
string$morequerystringQuery string to add to the link "print" to get same parameters (use only if autodetect fails)
string$morecssonbodyMore CSS on body tag.
string$replacemainareabyReplace call to main_area() by a print of this string
Returns
void

Definition at line 157 of file main.inc.php.

◆ getHelpParamFor()

getHelpParamFor (   $helppagename,
  $langs 
)

Return helpbaseurl, helppage and mode.

Parameters
string$helppagenamePage name ('EN:xxx,ES:eee,FR:fff...' or 'http://localpage')
Translate$langsLanguage
Returns
array Array of help urls

Definition at line 1888 of file main.inc.php.

◆ left_menu()

left_menu (   $menu_array_before,
  $helppagename = '',
  $notused = '',
  $menu_array_after = '',
  $leftmenuwithoutmainarea = 0,
  $title = '',
  $acceptdelayedhtml = 0 
)

Show left menu bar.

Parameters
array$menu_array_beforeTable of menu entries to show before entries of menu handler. This param is deprectaed and must be provided to ''.
string$helppagenameName of wiki page for help ('' by default). Syntax is: For a wiki page: EN:EnglishPage|FR:FrenchPage|ES:SpanishPage For other external page: http://server/url
string$notusedDeprecated. Used in past to add content into left menu. Hooks can be used now.
array$menu_array_afterTable of menu entries to show after entries of menu handler
int$leftmenuwithoutmainareaMust be set to 1. 0 by default for backward compatibility with old modules.
string$titleTitle of web page
string$acceptdelayedhtml1 if caller request to have html delayed content not returned but saved into global $delayedhtmlcontent (so caller can show it at end of page to avoid flash FOUC effect)
Returns
void

Definition at line 1690 of file main.inc.php.

◆ main_area()

main_area (   $title = '')

Begin main area.

Parameters
string$titleTitle
Returns
void

Definition at line 1867 of file main.inc.php.

◆ printSearchForm()

printSearchForm (   $urlaction,
  $urlobject,
  $title,
  $htmlmorecss,
  $htmlinputname,
  $accesskey = '',
  $prefhtmlinputname = '',
  $img = '',
  $showtitlebefore = 0,
  $autofocus = 0 
)

Show a search area.

Used when the javascript quick search is not used.

Parameters
string$urlactionUrl post
string$urlobjectUrl of the link under the search box
string$titleTitle search area
string$htmlmorecssAdd more css
string$htmlinputnameField Name input form
string$accesskeyAccesskey
string$prefhtmlinputnameComplement for id to avoid multiple same id in the page
string$imgImage to use
string$showtitlebeforeShow title before input text instead of into placeholder. This can be set when output is dedicated for text browsers.
string$autofocusSet autofocus on field
Returns
string

Show HTML footer Close div /DIV class=fiche + /DIV id-right + /DIV id-container + /BODY + /HTML. If global var $delayedhtmlcontent was filled, we output it just before closing the body.

Parameters
string$commentA text to add as HTML comment into HTML generated page
string$zone'private' (for private pages) or 'public' (for public pages)
int$disabledoutputofmessagesClear all messages stored into session without diplaying them
Returns
void

Definition at line 1941 of file main.inc.php.

◆ test_sql_and_script_inject()

if (! empty( $_SERVER[ 'MAIN_SHOW_TUNING_INFO'])) if (function_exists( 'get_magic_quotes_gpc')) test_sql_and_script_inject (   $val,
  $type 
)

Security: SQL Injection and XSS Injection (scripts) protection (Filters on GET, POST, PHP_SELF).

Parameters
string$valValue
string$type1=GET, 0=POST, 2=PHP_SELF, 3=GET without sql reserved keywords (the less tolerant test)
Returns
int >0 if there is an injection, 0 if none
Deprecated:
use testSqlAndScriptInject
See also
testSqlAndScriptInject($val, $type)

Definition at line 81 of file main.inc.php.

◆ testSqlAndScriptInject()

testSqlAndScriptInject (   $val,
  $type 
)

Security: SQL Injection and XSS Injection (scripts) protection (Filters on GET, POST, PHP_SELF).

Parameters
string$valValue
string$type1=GET, 0=POST, 2=PHP_SELF, 3=GET without sql reserved keywords (the less tolerant test)
Returns
int >0 if there is an injection, 0 if none

Definition at line 94 of file main.inc.php.

◆ top_htmlhead()

top_htmlhead (   $head,
  $title = '',
  $disablejs = 0,
  $disablehead = 0,
  $arrayofjs = '',
  $arrayofcss = '',
  $disablejmobile = 0,
  $disablenofollow = 0 
)

Ouput html header of a page.

This code is also duplicated into security2.lib.php::dol_loginfunction

Parameters
string$headOptionnal head lines
string$titleHTML title
int$disablejsDisable js output
int$disableheadDisable head output
array$arrayofjsArray of complementary js files
array$arrayofcssArray of complementary css files
int$disablejmobileDisable jmobile (No more used)
int$disablenofollowDisable no follow tag
Returns
void

Definition at line 1172 of file main.inc.php.

◆ top_httphead()

if (! defined( 'NOREQUIREMENU')) if (! function_exists("llxHeader")) top_httphead (   $contenttype = 'text/html',
  $forcenocache = 0 
)

Show HTTP header.

Parameters
string$contenttypeContent type. For example, 'text/html'
int$forcenocacheForce disabling of cache for the page
Returns
void

Definition at line 1107 of file main.inc.php.

◆ top_menu()

top_menu (   $head,
  $title = '',
  $target = '',
  $disablejs = 0,
  $disablehead = 0,
  $arrayofjs = '',
  $arrayofcss = '',
  $morequerystring = '',
  $helppagename = '' 
)

Show an HTML header + a BODY + The top menu bar.

Parameters
string$headLines in the HEAD
string$titleTitle of web page
string$targetTarget to use in menu links (Example: '' or '_top')
int$disablejsDo not output links to js (Ex: qd fonction utilisee par sous formulaire Ajax)
int$disableheadDo not output head section
array$arrayofjsArray of js files to add in header
array$arrayofcssArray of css files to add in header
string$morequerystringQuery string to add to the link "print" to get same parameters (use only if autodetect fails)
string$helppagenameName of wiki page for help ('' by default). Syntax is: For a wiki page: EN:EnglishPage|FR:FrenchPage|ES:SpanishPage For other external page: http://server/url
Returns
void

Definition at line 1485 of file main.inc.php.