this function returns URL, formatted by the following rules: if this is an URL - it is formatted like an url: http://www.dsite.ru, if this is e-mail - it is formatted like e-mail: mailto:info@webmedia.ru

the function uses specified table with format 'DESCR' 'NAME' 'VALUE' in order to do the following:
1) select from the specified database the values;
2) set defines [NAME] = [VALUE];
3) set global variables $fv_{NAME} = {VALUE} for forms post data;
4) if $update is set to true, update every record with values, stored in a forms variables with name $fv_{NAME}
5) close database

all menu buttons array in a form $gMenuButtons[$button_id][$button_part]['section'], where last parameter can be one of the following: section (section id), text (button name), url (button url), sectionname (section name)

set true if login is from administrative interface, otherwise and default false

Remarks:

On success sets global $guserDataBase, $guserDataHost to the name of the database

if glogout in GET is set, then user is logged out. glogout can be 1 or 2 value (1 - logout to a logout page (specified in config), 2 - logout, but stay in admin)

CheckLoginByDBAccess

(

)

This method of authentication is used from the display web-site system This method is more safe than CheckLogin, because user will not have access parameters for global users table.

Remarks:

When you install multi-site system, you must create one user for a global database (full access) and one user for each project (access to local web-site database). Specify in local web-site config file only the last one. Specify in amin config the first one. Secure the admin config for reading from user domain accounts.

As the part of DSite configuration there are a set of defines, that depend on database.
there are the following defines may be found in the database (dsite_config):

returns an active Section Button name (even when no button ID supplied)

Returns:

the currently selected Section Button Name

GetSectionId

(

)

Returns:

the selected section id or the page id when usepages flag is on

GetSectionName

(

)

returns an active Section name

Returns:

the currently selected Section Name

GetServerName

(

$

optionalname = false

)

returns string containing server name

Parameters:

$optionalname

string - the optional server name to be used instead of default

Remarks:

server name is the name of the server for which web script has been executed

Returns:

string in a form 'webmedia.ru' containing current server name

Remarks:

if this function is used on web output, provide DOMAIN macro to get valid server name

GetUpdateDefinesDBTbl

(

$

dbhost,

$

db,

$

dbuser,

$

dbpwd,

&$

vars,

$

update = false,

$

silent = false,

$

tablename = 'dsite_config',

$

link = false,

$

prohibited_vars = array()

)

the function uses specified table with format 'DESCR' 'NAME' 'VALUE' in order to do the following:
1) select from the specified database the values;
2) set defines [NAME] = [VALUE];
3) set global variables $fv_{NAME} = {VALUE} for forms post data;
4) if $update is set to true, update every record with values, stored in a forms variables with name $fv_{NAME}
5) close database

this function performes simple test for a folder name (to be viewed or created).

If the path is root-based (starts from '/' symbol), then it is checked for starting with SERVERROOT constant, which contains the root of web-site project on the server. If this paths not match, it will be corrected to a relative one. If the path is already relative, then it is not changed.

Parameters:

folderPath

string - the path to be checked

Returns:

the name that is safe for the client project

Remarks:

if the path has been corrected, function writes to log

MakeURL

(

$

url

)

this function returns URL, formatted by the following rules: if this is an URL - it is formatted like an url: http://www.dsite.ru, if this is e-mail - it is formatted like e-mail: mailto:info@webmedia.ru

Parameters:

url

string - the url to make href for

Returns:

full href string

MoveUploadedFileSafe

(

$

filename,

$

destination

)

the safe version of php function move_uploaded_file

Parameters:

filename

string - the name of uploaded file

destination

string - the destination file, where uploaded file has to be written to

string - the name of the function, specified somewhere in template the function must be in the following form: function PrintAButton($buttontext, $buttonurl, $active, $sectionid), where $buttontext string - the text of the button, $buttonurl string - url which button references, $active bool - true, if this button is active $sectionid int - id of the section for this button

Returns:

nothing

PrintButtonsEx

(

$

printfunc

)

goes through the buttons and calls function, specified as a parameter

Parameters:

printfunc

string - the name of the function, specified somewhere in template the function must be in the following form: function PrintAButtonEx($buttoninfo, $buttonid), where $buttoninfo array in with the following keys:
['url'] - url which button references, ['text'] - text of the button ['section'] - section id of the button ['sectionname'] - section title of the button

Returns:

nothing

PrintError500

(

$

moreinfo = ''

)

returns WWW server error
used internally and called on fatal errors only

Within DSite pages system you can use the following global variable $gSaveCookies in order to save all your cookies, because index.php uses the following syntax:
if (isset($gSaveCookies))
{
SaveCookiesVars($gSaveCookies,$id,$gSaveCookiesLife);
}

SetCookies

(

$

cookielife = false,

$

cookies = false,

$

busercookie = false

)

this function sets all cookies that are need to be set, during page loading in order to use from a form, use the followin syntax:

In several cases it can automatically fix an error.
In other cases it will terminate execution.

Parameters:

errno

int - the error number returned by mysql_errno() function

tablename

string - the table, for which to process an error, default news_cat

Returns:

true on success, or stops, false on error

SwapFields

(

$

table,

$

idfieldname,

$

id1,

$

id2,

$

additionalsql = ''

)

Swaps two `ID` fields.

Swaps two `ID` fields, without changing the contents.

Parameters:

$table

- the name of the table;

$idfieldname

- the name of the field that contains ID

$id1

- the first id to swap

$id2

- the id to swap with $id1

$additionalsql

- additional sql that can be "where FIRSTID=0"

Returns:

zero on success

trans

(

$

language_str

)

Parameters:

language_str

string - the constant string, that identifies language line translates text into current language, if no available value, prints not found symbol.

optional additional arguments can be used like in "printf" function.

Returns:

string tranlated

urlencoderepl

(

$

arg,

$

replacements = NULL,

$

qfrm = '?=&'

)

encodes url, replacing additional values

Parameters:

$arg

array - $_GET usually

$replacements

array - array of replacing values

$qfrm

string - optional delimiters for URL encoding, by default '?=&'

Returns:

the encoded url part

example

$href = $PHP_SELF.'?'.urlencoderepl( $_GET, array('myvar'=>'5') );

WriteLog

(

$

str

)

writes the line with time stamp into the log file

Parameters:

$str

the line to write

Returns:

true if write wass successfull

Remarks:

uses global variable $glog_file which specifies full path to the log file on server, if it is empty, no writing performed.
This variable usually filled the following way:

For frontend part of the site located in inc directory of SERVERROOT and can be viewed through DSite system - view log file Menus

For backend part located in inc directory where admin modules are stored and can be viewed by served administator (superuser) using Users Administration - View log file menus.

When error is specified, backtrace is done. It's also done when DEBUG constant is specified. The DEBUG constant can be defined in config.php file and can value from 0 to 4. It's not recommended to leave it defined on live web-sites, because there are too many log information can be generated.

global Log file, most of cases used internally, externally defined by DSITELOGFILE value

global $gMenuButtons

all menu buttons array in a form $gMenuButtons[$button_id][$button_part]['section'], where last parameter can be one of the following: section (section id), text (button name), url (button url), sectionname (section name)

global $gPartID

global selected Part ID

global $gsql

global SQL holder - array of SQL strings in a form of $gsql['SQLQUERYNAME']

global $gUserCookieLives

defines how long registration cookie lives (not used from version 3.90)