Classes | ||||
| class | UserParams | |||
| current user security params defines user access level to some DSite actions More... | ||||
Enumerations | ||||
| enum | USER_ACCESS_DEFAULT | |||
| Access Levels for users Currently only two access levels. More... | ||||
| enum | USER_ACCESS_ADVANCED | |||
| < default and minimum 'the pot' level More... | ||||
| enum | USER_ACCESS_CONFIGURED | |||
| < minimum but with the preview mode on More... | ||||
| enum | USER_ACCESS_PHP | |||
| < acess level, configured by plugin More... | ||||
| enum | USER_SESSION_COOKIE | |||
| Имена кук Введено, так как имя gsession оказалось зарезервированным где-то. More... | ||||
| enum | USER_COOKIELIVES | |||
| enum | USER_SESSION_TIMEOUT | |||
| < the cookie that specifies the other cookies lives More... | ||||
| enum | LOGFILEPATH | |||
| < user session timeout More... | ||||
Functions | ||||
| GetAdminRoot () | ||||
| ||||
| GetLastUpdateVersion () | ||||
| returns last update version (stored in DB, table dsite_version) | ||||
| GetServerName ($optionalname=false) | ||||
| returns string containing server name | ||||
| GetRevision ($revstr) | ||||
| retrieves revision info from string created by CVS | ||||
| print_r_get ($arr) | ||||
| retrieves the array | ||||
| ConfirmMessage ($subj, $msg) | ||||
| sends message to the address specified in the configurational file | ||||
| 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: | ||||
| GetCookie ($cookiename, $busercookie=false) | ||||
| returns a cookie or variable passed as parameter value if everything is empty, returns empty string | ||||
| WriteLog ($str) | ||||
| writes the line with time stamp into the log file | ||||
| SQLProcessError ($errno, $tablename='news_cat') | ||||
| this function process MySQL error and reacts on it. | ||||
| DoSqlQuery ($sqlname) | ||||
| Runs an Sql Query, returns result link (for fetch array and other functions. | ||||
| AddDateTime ($srctime, $aY, $aM=0, $aD=0, $aHrs=0, $aMin=0, $aSec=0) | ||||
| Date/Time additing function. | ||||
| InsertBannerBlock ($blockid, $bannerType=0, $target='_blank') | ||||
| Banner block function. | ||||
| InsertContentBlock ($blockid) | ||||
| Inserts contents of the specified block into current place. | ||||
| InsertBlock ($blockid) | ||||
| Inserts specified block or an applicable banner if allowed. | ||||
| hasPHP ($htmlsource) | ||||
| determines whether the page containg a PHP code | ||||
| 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 | ||||
| IsProhibitedServerFile ($filename) | ||||
| ||||
| MakeSafeRootPath ($folderPath) | ||||
| this function performes simple test for a folder name (to be viewed or created). | ||||
| MoveUploadedFileSafe ($filename, $destination) | ||||
| the safe version of php function move_uploaded_file | ||||
| ImageUpload ($userfile, $filepath, $userfile_name, $bsilent=false, $boverwrite=false) | ||||
| Image upload helper. | ||||
| GetButtonMaxForPart ($partid) | ||||
| retrieves the maximal part button id | ||||
| SwapFields ($table, $idfieldname, $id1, $id2, $additionalsql= '') | ||||
| Swaps two `ID` fields. | ||||
| getAlignment ($ph, $aligndef) | ||||
| returns alignment checking first symbol in $ph: '<' - left; '>' - right; '=' - center; | ||||
| PrintError500 ($moreinfo='') | ||||
| returns WWW server error used internally and called on fatal errors only | ||||
| CheckSignatureFile ($filename= 'sig.tmp') | ||||
| checks signature file, that enables ConfirmMessage function to be executed | ||||
| AutoTable ($text, $alignc='center') | ||||
| Creates a table with 2 columns from a string. | ||||
| echo_trans ($language_str) | ||||
| translates text into current language and prints it to output if no available value, prints not found symbol. | ||||
| trans ($language_str) | ||||
| ||||
| CleanUpHtmlSource ($htmlsource, $xmlonly=false) | ||||
| clears php code (and other) from the html source. | ||||
| CleanLogin ($strlogin) | ||||
| cleans login from unexpected symbols, like ', preventing some hacking attempts | ||||
| ReplaceSRCAttr2Full ($htmlsource) | ||||
| replaces SRC attributes to make them absolute from DOMAIN constant | ||||
| ReplaceSRCAttr2Relative ($htmlsource) | ||||
| replaces SRC attributes to make them relative from DOMAIN constant | ||||
| IsButton ($nButtonID, $nPartID=false) | ||||
| checks whether button with the specified id exists or not | ||||
| GetSectionName () | ||||
| returns an active Section name | ||||
| GetSectionButtonName () | ||||
| returns an active Section Button name (even when no button ID supplied) | ||||
| IsActiveButton ($nButtonID, $nPartID=false) | ||||
| determines whether the button with specified id is active or not | ||||
| get_PageSelector ($url, &$pg, $totalrows, $rpp=MAXROWSPERPAGE, $additionalurl='') | ||||
| Interface function that return values for printing in header [1, 2 . | ||||
| urlencoderepl ($arg, $replacements=NULL, $qfrm='?=&') | ||||
| encodes url, replacing additional values | ||||
| create_PageSelector ($query, $printfunc, $rpp=MAXROWSPERPAGE, $additionalurl='') | ||||
| this function shows select query using pages printing performed by specialized function $printfunc | ||||
| ConnectDatabase ($dbhost, $db, $dbuser, $dbpass, $silent, $ntries=1) | ||||
| connects to the specified database. | ||||
| CheckLoginPrintForm ($bAdmin) | ||||
| Prints form for filling login data. | ||||
| SetGlobalCookie ($strCookieName, $strValue) | ||||
| sets global DSite admin system cookie | ||||
| ClearCookie ($strCookieName) | ||||
| clears cookie with the specified name | ||||
| CheckLogin ($bAdmin=false) | ||||
| Checks user login, asks for it, if needed. | ||||
| 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. | ||||
| 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 | ||||
| ConfigGlobalVarsUpdate () | ||||
| sets some global variables for compatibility reasons | ||||
| CheckReferer () | ||||
| checs referers with DOMAIN. | ||||
| RedirectMe ($urlto, $timed=false, $bnotdies=false) | ||||
| this function performs redirection from one page to another | ||||
| mysql_time ($atime, $gmt=false) | ||||
| returns the specified time in a mysql format as string | ||||
| SaveCookiesVars ($vars, $add='', $cookielife='') | ||||
| this function will save in cookies all variables | ||||
| GetSavedVars ($vars, $add='') | ||||
| retrieves variable value, saved by SaveCookiesVars | ||||
| GetSectionId () | ||||
| ||||
| GetSecFromButton ($nButtonID, $nPartID=false) | ||||
| ||||
| GetMeta () | ||||
| ||||
| GetWWWPath () | ||||
| get current document www path correctly $PHP_SELF зависит от documentroot, который, в случае если установлен неправильно, может портить ссылки, поэтому оптимальнее взять $REQUEST_URI | ||||
| PrintButtons ($printfunc) | ||||
| goes through the buttons and calls function, specified as a parameter | ||||
| PrintButtonsEx ($printfunc) | ||||
| goes through the buttons and calls function, specified as a parameter | ||||
| GetButton ($bstart=false) | ||||
| retrieves next button parameters (for current Part) | ||||
| InsertButtonURL ($buttonid=-1) | ||||
| obsolete, for backward compatibility only | ||||
| InsertButtonText ($buttonid=-1) | ||||
| obsolete, for backward compatibility only | ||||
| InsertButtonImage ($buttonid=-1) | ||||
| obsolete, for backward compatibility only | ||||
| GetExtension ($filename) | ||||
| ||||
| FinishSlash ($folder, $slash='/') | ||||
| appends the slash '/' at the end of the directory path string | ||||
| GetRequestString ($bRequestURI=true) | ||||
| tries to re-create full path of browser request | ||||
| GetPageByID ($id, $bcheckflag=false) | ||||
| returns page file name by the page ID | ||||
| DSiteError ($errortext, $bfatal=true) | ||||
| displays an error in a way, defined by the DSite system. | ||||
| GetDSiteDBVersion () | ||||
| get current DSite global DB version | ||||
| SetDSiteVersionToDB ($ver) | ||||
| store to DB current DSite global DB version | ||||
| CheckAndUpdateDSiteDBStruct () | ||||
| set check and update DSite global DB version | ||||
| GetHRFileSize ($size) | ||||
| convert size in bytes into Kb or Mb or Gb, depending on the value | ||||
| MailSafe ($strto, $strsubj, $strmessage, $strfrom=false, $content_type="text/html; charset=windows-1251") | ||||
| Sends an HTML coded e-mail message, preventing spam exploits. | ||||
| IsSafe2Include ($strPath) | ||||
| in several cases you cannot use RequireSafe function, then you can use simple require but checking the validity of the path | ||||
| RequireSafe ($require_module) | ||||
| when you use require_once with variable parameter, use this function to avoid vulnarabilities | ||||
| ParseStaticURI ($bMakeGlobal=false) | ||||
| parses url in a form /param/value/param/value and gets some parameters from it | ||||
| GetAliasFor ($alias_str) | ||||
| returns an alias for specified name | ||||
| ParseURIAlias ($bMakeGlobal=false) | ||||
| parses url using aliases table for which object in the system you can define an alias: section, page, news etc. | ||||
| IsAdminMode () | ||||
| returns whether calling script is in admin part of the system | ||||
| CreateDSiteUrl ($id, $part=false, $usepages=false, $params=array()) | ||||
| creates a valid url, using current web-site url-creation mode defined for the site | ||||
Variables | ||||
| global | $glog_file | |||
| global Log file, most of cases used internally, externally defined by DSITELOGFILE value | ||||
| global | $gsql | |||
| global SQL holder - array of SQL strings in a form of $gsql['SQLQUERYNAME'] | ||||
| global | $gDSiteVersion | |||
| global | $gUserCookieLives | |||
| defines how long registration cookie lives (not used from version 3.90) | ||||
| global | $id | |||
| global selected section id | ||||
| global | $theme | |||
| global selected theme name | ||||
| global | $gPartID | |||
| global selected Part ID | ||||
| global | $gEditMode | |||
| edit mode on, section visualizer, contains admin path | ||||
| global | $gActiveSection | |||
| active section parameters array. contains the following parameters: SectionName,ButtonName,Keywords,Description | ||||
| 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 | $gHTMLBodyFound | |||
| user internally for BODY found sign | ||||
| global | $gBlockData | |||
| specific block data | ||||
| global | $gFileVersion | |||
| contains file versions, array | ||||
| $gDSiteVersion | ||||
| set DSite version by functions.inc revision | ||||
| $gFileVersion [__FILE__] = $gDSiteVersion | ||||
| $gHTMLBodyFound = false | ||||
| $reggl = ini_get('register_globals') | ||||
| set the default registration cookie life time (depricated) $gUserCookieLives = GetCookie('USER_COOKIELIVES');; //!< minutes cookie lives if (empty($gUserCookieLives)) { $gUserCookieLives = 20; } | ||||
=========================================================== Module : functions.inc Project (part) : DSITE CopyRight : MPG Ltd, 2002 Function : Defines content management functions Author : Efimov Andrei Created : 1.03.2002 Comments : ===========================================================
| enum LOGFILEPATH |
< user session timeout
| enum USER_ACCESS_ADVANCED |
< default and minimum 'the pot' level
< minimum but with the preview mode on
| enum USER_ACCESS_DEFAULT |
Access Levels for users Currently only two access levels.
В дальнейшем, возможно, появится доступ по работе с блоками и прочая ... Все рассматриваемые уровни доступа идут на увеличение (т.е. доступ 3 включает в себя 3,2,1,0)
| enum USER_ACCESS_PHP |
< acess level, configured by plugin
| enum USER_COOKIELIVES |
| enum USER_SESSION_COOKIE |
Имена кук Введено, так как имя gsession оказалось зарезервированным где-то.
..
| enum USER_SESSION_TIMEOUT |
< the cookie that specifies the other cookies lives
| AddDateTime | ( | $ | srctime, | |
| $ | aY, | |||
| $ | aM = 0, |
|||
| $ | aD = 0, |
|||
| $ | aHrs = 0, |
|||
| $ | aMin = 0, |
|||
| $ | aSec = 0 | |||
| ) |
Date/Time additing function.
Adds day, month, hour etc. to a specified timestamp
| $srctime | - source time; | |
| $aY | - years to add; | |
| $aM | - months to add; | |
| $aD | - days to add; | |
| $aHrs | - hours to add; | |
| $aMin | - minutes to add; | |
| $aSec | - seconds to add; |
| AutoTable | ( | $ | text, | |
| $ | alignc = 'center' | |||
| ) |
Creates a table with 2 columns from a string.
Each \n is a next column. If one column is void, then left column is stretched.
| $text | - the source text | |
| $alignc | - default alignment of the column |
use first symbol of the line to determine alignment: '<' - left; '>' - right; '=' - center;
| CheckAndUpdateDSiteDBStruct | ( | ) |
set check and update DSite global DB version
| CheckLogin | ( | $ | bAdmin = false |
) |
Checks user login, asks for it, if needed.
| $bAdmin | set true if login is from administrative interface, otherwise and default false |
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.
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):
| CheckLoginPrintForm | ( | $ | bAdmin | ) |
Prints form for filling login data.
| bAdmin | - admin mode if true |
| CheckReferer | ( | ) |
checs referers with DOMAIN.
| CheckSignatureFile | ( | $ | filename = 'sig.tmp' |
) |
checks signature file, that enables ConfirmMessage function to be executed
| filename | string - the signature filename, 'sig.tmp' by default |
| CleanLogin | ( | $ | strlogin | ) |
cleans login from unexpected symbols, like ', preventing some hacking attempts
| $strlogin | string - login to be cleared |
| CleanUpHtmlSource | ( | $ | htmlsource, | |
| $ | xmlonly = false | |||
| ) |
clears php code (and other) from the html source.
| $htmlsource | - the source itself | |
| $xmlonly | - clean only xml entries |
| ClearCookie | ( | $ | strCookieName | ) |
clears cookie with the specified name
| strCookieName | string - the name of the cookie to be cleared |
| ConfigGlobalVarsUpdate | ( | ) |
sets some global variables for compatibility reasons
| ConfirmMessage | ( | $ | subj, | |
| $ | msg | |||
| ) |
sends message to the address specified in the configurational file
| subj | string - subject of the message (must contain only DSite information!) | |
| msg | string - message body (must contain only DSite information!) |
| ConnectDatabase | ( | $ | dbhost, | |
| $ | db, | |||
| $ | dbuser, | |||
| $ | dbpass, | |||
| $ | silent, | |||
| $ | ntries = 1 | |||
| ) |
connects to the specified database.
Prints error messages on the screen. $dbhost - the host $db - the database name $dbuser - database user $dbpass - database password $silent - if true - no messages on screen $ntries int - the number of retries
| create_PageSelector | ( | $ | query, | |
| $ | printfunc, | |||
| $ | rpp = MAXROWSPERPAGE, |
|||
| $ | additionalurl = '' | |||
| ) |
this function shows select query using pages printing performed by specialized function $printfunc
| $query | - the query to process | |
| $printfunc | - printing function, takes:
| |
| rpp | - rows per pages | |
| additionalurl | string - the addition to url appended to page url* |
Uses global constant MAXROWSPERPAGE
| CreateDSiteUrl | ( | $ | id, | |
| $ | part = false, |
|||
| $ | usepages = false, |
|||
| $ | params = array() | |||
| ) |
creates a valid url, using current web-site url-creation mode defined for the site
| id | int - the id of a section or page (when usepages is not false), use GetSectionId() to specify current section, if false - default section for part is used | |
| part | int - the id of a part, if false not specified | |
| usepages | int - the usepages flag, default false | |
| params | array - additional params to pass: array ( 'paramname' => paramvalue, ...), optional |
<img src="<?=CreateDSiteUrl(34, false, 1, array('obj_id'=>intval($_GET['obj_id']),'main'=>1)); ?>" border="0">
| DoSqlQuery | ( | $ | sqlname | ) |
Runs an Sql Query, returns result link (for fetch array and other functions.
..)
| $sqlname | the name of the sql query in global $gsql array or (if starts from `:` symbol the sql query itself). |
| DSiteError | ( | $ | errortext, | |
| $ | bfatal = true | |||
| ) |
displays an error in a way, defined by the DSite system.
Use only this function to display internal errors
| errortext | string - error text | |
| bfatal | bool - optional fatality of error, if true (default) stops executing. |
| echo_trans | ( | $ | language_str | ) |
translates text into current language and prints it to output if no available value, prints not found symbol.
optional additional arguments can be used like in "printf" function.
| language_str | string - the constant string, that identifies language line |
| FinishSlash | ( | $ | folder, | |
| $ | slash = '/' | |||
| ) |
appends the slash '/' at the end of the directory path string
| folder | string - usually the directory name to append a slash | |
| slash | string - the slash symbol, '/' by default (depends on OS, usually, and can be found in PHP constant PATH_SEPARATOR) |
| get_PageSelector | ( | $ | url, | |
| &$ | pg, | |||
| $ | totalrows, | |||
| $ | rpp = MAXROWSPERPAGE, |
|||
| $ | additionalurl = '' | |||
| ) |
Interface function that return values for printing in header [1, 2 .
..] for pages
| $url | - the url to make href to | |
| $pg | - the currently selected page number | |
| $totalrows | - the number of actually available rows | |
| additionalurl | string - the addition to url appended to page url, may contain macro command PG% that is replaced by current page id | |
| rpp | int - rows per pages |
url is called with parameter $pg
| GetAdminRoot | ( | ) |
DO not use ADMINROOT constant directly!
| GetAliasFor | ( | $ | alias_str | ) |
returns an alias for specified name
| $alias_str | string - the name |
| getAlignment | ( | $ | ph, | |
| $ | aligndef | |||
| ) |
returns alignment checking first symbol in $ph: '<' - left; '>' - right; '=' - center;
| $ph | - source line | |
| $aligndef | - default alignment string |
| GetButton | ( | $ | bstart = false |
) |
retrieves next button parameters (for current Part)
| bstart | bool - if true starts from the beginning |
| GetButtonMaxForPart | ( | $ | partid | ) |
retrieves the maximal part button id
| partid | int - the part ID |
| GetCookie | ( | $ | cookiename, | |
| $ | busercookie = false | |||
| ) |
returns a cookie or variable passed as parameter value if everything is empty, returns empty string
| $cookiename | - the name of variable or cookie | |
| busercookie | bool - if true uses current DSite user name to retrieve cookie for |
The priority of variables follows:
| GetDSiteDBVersion | ( | ) |
get current DSite global DB version
| GetExtension | ( | $ | filename | ) |
| filename | string - the name of the file |
| GetHRFileSize | ( | $ | size | ) |
convert size in bytes into Kb or Mb or Gb, depending on the value
| size | int - size in bytes |
| GetLastUpdateVersion | ( | ) |
returns last update version (stored in DB, table dsite_version)
| GetMeta | ( | ) |
| GetPageByID | ( | $ | id, | |
| $ | bcheckflag = false | |||
| ) |
returns page file name by the page ID
| id | int - page id | |
| bcheckflag | bool - check flag bUsePages for this page, if not set, does not return any pages |
| GetRequestString | ( | $ | bRequestURI = true |
) |
tries to re-create full path of browser request
| bRequestURI | bool - append request uri or not |
| GetRevision | ( | $ | revstr | ) |
retrieves revision info from string created by CVS
| revstr | string - string from CVS |
| GetSavedVars | ( | $ | vars, | |
| $ | add = '' | |||
| ) |
retrieves variable value, saved by SaveCookiesVars
| vars | string - must be 'var1,var2 ...' variable names ',' delimited | |
| add | string - the addition to the cookie name (usually section id) |
| GetSecFromButton | ( | $ | nButtonID, | |
| $ | nPartID = false | |||
| ) |
| nButtonID | int - button ID | |
| nPartID | int - part ID, if not specifed uses current Part ID |
| GetSectionButtonName | ( | ) |
returns an active Section Button name (even when no button ID supplied)
| GetSectionId | ( | ) |
| GetSectionName | ( | ) |
returns an active Section name
| GetServerName | ( | $ | optionalname = false |
) |
returns string containing server name
| $optionalname | string - the optional server name to be used instead of default |
| 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
| dbhost | string - host for the specified database | |
| db | string - database name | |
| dbuser | string -database user name | |
| dbpwd | string - database password | |
| vars | 2 dim array - the result variables : $vars[$i]['NAME'] - the name, $vars[$i]['VALUE] - the value $vars['DESCR'] contains the user-friendly description | |
| update | bool - update config table | |
| silent | bool - keep silence if true (no screen messages) | |
| tablename | string - the name of the table, by default dsite_config | |
| link | - a link to the database, if specified, ConnectDatabase is not called | |
| prohibited_vars | array - the array, contains the names of variables that are prohibited to update in this call |
| GetWWWPath | ( | ) |
get current document www path correctly $PHP_SELF зависит от documentroot, который, в случае если установлен неправильно, может портить ссылки, поэтому оптимальнее взять $REQUEST_URI
| hasPHP | ( | $ | htmlsource | ) |
| ImageUpload | ( | $ | userfile, | |
| $ | filepath, | |||
| $ | userfile_name, | |||
| $ | bsilent = false, |
|||
| $ | boverwrite = false | |||
| ) |
Image upload helper.
| userfile | string - variable (usually name of file-type input) that contains user file name | |
| filepath | string - the storage folder for the uploaded file | |
| userfile_name | string - the name of the uploaded file | |
| bsilent | bool - if true, does not write to output any information about file-upload (writes to log) | |
| boverwrite | bool - if true, exisiting file will be overwritten |
$userfile_name = $_FILES['userfile']['name']; $userfile = $_FILES['userfile']['tmp_name']; ImageUpload($userfile, $path, $userfile_name, false);
<FORM ACTION="#" enctype="multipart/form-data" METHOD="POST"> <input class=cutebox name='userfile' type='file'> ... </form>
| InsertBannerBlock | ( | $ | blockid, | |
| $ | bannerType = 0, |
|||
| $ | target = '_blank' | |||
| ) |
Banner block function.
| $blockid | - the id or the name of the block | |
| $bannerType | - the type of the banner to find | |
| target | string - the target, default '_blank' |
| InsertBlock | ( | $ | blockid | ) |
Inserts specified block or an applicable banner if allowed.
| $blockid | - the id or the name of the block |
| InsertButtonImage | ( | $ | buttonid = -1 |
) |
obsolete, for backward compatibility only
| InsertButtonText | ( | $ | buttonid = -1 |
) |
obsolete, for backward compatibility only
| InsertButtonURL | ( | $ | buttonid = -1 |
) |
obsolete, for backward compatibility only
| InsertContentBlock | ( | $ | blockid | ) |
Inserts contents of the specified block into current place.
| $blockid | int - the id or the name of the block |
| IsActiveButton | ( | $ | nButtonID, | |
| $ | nPartID = false | |||
| ) |
determines whether the button with specified id is active or not
| nButtonID | int - the id of the button | |
| nPartID | int - the part for which the button id is specified, when false used the currently active part |
| IsAdminMode | ( | ) |
returns whether calling script is in admin part of the system
| IsButton | ( | $ | nButtonID, | |
| $ | nPartID = false | |||
| ) |
checks whether button with the specified id exists or not
| nButtonID | int - the id of the button | |
| nPartID | int - the part for which the button id is specified, when false used the currently active part |
| IsProhibitedServerFile | ( | $ | filename | ) |
| filename | string - the file name to be checked |
| IsSafe2Include | ( | $ | strPath | ) |
in several cases you cannot use RequireSafe function, then you can use simple require but checking the validity of the path
| strPath | string - the path to be checked |
if (IsSafe2Include($module)) include($module);
| MailSafe | ( | $ | strto, | |
| $ | strsubj, | |||
| $ | strmessage, | |||
| $ | strfrom = false, |
|||
| $ | content_type = "text/html; charset=windows-1251" | |||
| ) |
Sends an HTML coded e-mail message, preventing spam exploits.
| strto | string - Receiver, or receivers of the mail (comma-separated) | |
| strsubj | string - message subject | |
| strmessage | string - message body | |
| strfrom | string - message sender, optional | |
| $content_type | string - optional parameter for setting content-type, by default text/html, charset Windows-1251 |
| MakeSafeRootPath | ( | $ | folderPath | ) |
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.
| folderPath | string - the path to be checked |
| 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
| url | string - the url to make href for |
| MoveUploadedFileSafe | ( | $ | filename, | |
| $ | destination | |||
| ) |
the safe version of php function move_uploaded_file
| filename | string - the name of uploaded file | |
| destination | string - the destination file, where uploaded file has to be written to |
| mysql_time | ( | $ | atime, | |
| $ | gmt = false | |||
| ) |
returns the specified time in a mysql format as string
| $atime | - date time stamp value | |
| $gmt | bool - default false, use GMT time |
| ParseStaticURI | ( | $ | bMakeGlobal = false |
) |
parses url in a form /param/value/param/value and gets some parameters from it
| bMakeGlobal | bool - if true makes variables global, otherwise only fills $_GET array, false by default |
| ParseURIAlias | ( | $ | bMakeGlobal = false |
) |
parses url using aliases table for which object in the system you can define an alias: section, page, news etc.
in order to make it work you have to define alias for that object using aliases plugin or imbuild DSite functionality
| bMakeGlobal | bool - if true makes variables global, otherwise only fills $_GET array, false by default |
| print_r_get | ( | $ | arr | ) |
retrieves the array
| $arr | array - source array |
| PrintButtons | ( | $ | printfunc | ) |
goes through the buttons and calls function, specified as a parameter
| printfunc | 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 |
| PrintButtonsEx | ( | $ | printfunc | ) |
goes through the buttons and calls function, specified as a parameter
| 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 |
| PrintError500 | ( | $ | moreinfo = '' |
) |
returns WWW server error
used internally and called on fatal errors only
| moreinfo | string - more information - hidden from user, but visible to techican |
| RedirectMe | ( | $ | urlto, | |
| $ | timed = false, |
|||
| $ | bnotdies = false | |||
| ) |
this function performs redirection from one page to another
| $urlto | string - the url to redirect user to | |
| timed | int - optional parameter, determines the number of milliseconds to wait, before redirection. if set Javascript/noscript only version is used | |
| bnotdies | bool - not dying after RedirectMe (since 26.04.07 ) |
| ReplaceSRCAttr2Full | ( | $ | htmlsource | ) |
replaces SRC attributes to make them absolute from DOMAIN constant
| $htmlsource | - the source html |
| ReplaceSRCAttr2Relative | ( | $ | htmlsource | ) |
replaces SRC attributes to make them relative from DOMAIN constant
| $htmlsource | - the source html |
| RequireSafe | ( | $ | require_module | ) |
when you use require_once with variable parameter, use this function to avoid vulnarabilities
| $require_module | string - path to be required |
| SaveCookiesVars | ( | $ | vars, | |
| $ | add = '', |
|||
| $ | cookielife = '' | |||
| ) |
this function will save in cookies all variables
| vars | string - must be 'var1,var2 ...' variable names ',' delimited | |
| cookielife | time - the life of these cookies, 1 day by default | |
| add | string - the addition to the cookie name (usually section id) |
| 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:
<input type=hidden name="gSetCookies" value="cookiename1=cookieval1;cookiename2=cookieval2...">
| cookielife | - the life of cookie as time(), by default - 1 day | |
| cookies | - if not empty, uses this variable instead of gSetCookies | |
| busercookie | bool - if true uses current DSite user name to store cookie for |
This function also sets all global variables with cookie names in order they can be used inside the program in real-time
| SetDSiteVersionToDB | ( | $ | ver | ) |
store to DB current DSite global DB version
| ver | float - version number of DB that sets |
| SetGlobalCookie | ( | $ | strCookieName, | |
| $ | strValue | |||
| ) |
sets global DSite admin system cookie
| SQLProcessError | ( | $ | errno, | |
| $ | tablename = 'news_cat' | |||
| ) |
this function process MySQL error and reacts on it.
In several cases it can automatically fix an error.
In other cases it will terminate execution.
| errno | int - the error number returned by mysql_errno() function | |
| tablename | string - the table, for which to process an error, default news_cat |
| SwapFields | ( | $ | table, | |
| $ | idfieldname, | |||
| $ | id1, | |||
| $ | id2, | |||
| $ | additionalsql = '' | |||
| ) |
Swaps two `ID` fields.
Swaps two `ID` fields, without changing the contents.
| $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" |
| trans | ( | $ | language_str | ) |
| 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.
| urlencoderepl | ( | $ | arg, | |
| $ | replacements = NULL, |
|||
| $ | qfrm = '?=&' | |||
| ) |
encodes url, replacing additional values
| $arg | array - $_GET usually | |
| $replacements | array - array of replacing values | |
| $qfrm | string - optional delimiters for URL encoding, by default '?=&' |
| WriteLog | ( | $ | str | ) |
writes the line with time stamp into the log file
| $str | the line to write |
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 $gActiveSection |
active section parameters array. contains the following parameters: SectionName,ButtonName,Keywords,Description
| global $gBlockData |
specific block data
| $gDSiteVersion |
| global $gDSiteVersion |
| global $gEditMode |
edit mode on, section visualizer, contains admin path
| $gFileVersion[__FILE__] = $gDSiteVersion |
| global $gFileVersion |
contains file versions, array
| $gHTMLBodyFound = false |
| global $gHTMLBodyFound |
user internally for BODY found sign
| global $glog_file |
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)
| global $id |
global selected section id
| $reggl = ini_get('register_globals') |
set the default registration cookie life time (depricated) $gUserCookieLives = GetCookie('USER_COOKIELIVES');; //!< minutes cookie lives if (empty($gUserCookieLives)) { $gUserCookieLives = 20; }
| global $theme |
global selected theme name