Kernel variables and functions
File kernel.php is the most important file in F3Site. It connects to database, loads settings, starts user session and sets active language and skin's scheme. It has also basic security code.
URL
Contains full site address with domain and directory. You may use it e.g. while sending Location header to browser.
TODAY
Current time according to format set in settings.
JS
Contains logical value 1 if request is sent with AJAX.
LANG_DIR
Directory of active language preceded by / character.
SKIN_DIR i VIEW_DIR
Paths to skin folders in style (1) and cache (2) directories.
PRE
Prefix of tables, e.g. f3_.
LOGD
Contains logical value 1 (logged in) or 0 (not logged in).
UID
ID of user (0 = not logged in).
LEVEL
User's level:
0 = guest (not logged in)
1 = user
2 = editor
3 = administrator
4 = owner
$content
Object of class Content - template system.
$db
Object of class PDO - database support
$id
Variable 'id' from site URL (contains 0 when does NOT exist).
$nlang
Active language, e.g. en, pl.
$cfg
All settings. Options that have boolean value (on, off), do not exist in configuration files and you should use isset() in order to detect them.
$lang
Associative array with texts, e.g. $lang['title']. It's always available in templates, e.g. {lang.preview}.
$user
Associative array with data of current user.
Returns TRUE if user has the privilege or else FALSE. If $type is empty, function tests global privileges, e.g. comments moderation if $id = CM. When $type = CAT, Admit() informs whether user may edit items in $id category.
Displays $id category's hierarchy.
Returns directory ($type=1) or file ($typ=2) list as <option> of <select>.
Returns pagination HTML code, where:
• type - if exists: options of select
• current - current page number
• total - number of all items
• url - address followed by parameter &page=X
Returns random code that belongs to $gid generator.
Replaces text emoticons :) into graphical.
Formats universal GMT date - YYYY-MM-DD HH:DD:SS or unix timestamp (seconds since 1970) into format set in settings. The returned date has local time for used language. If $time = 1, it contains also hour and minutes.
Returns user's login as link leading to his profile.
Use this function for POST, GET and COOKIES data to replace HTML code into entities by htmlspecialchars(). If $max != 0, text is clipped to length $max using substr(). If $censor exists, text is replaced according to settings.
Count number of rows in $table. Variable $table may contain additional SQL syntax, e.g. conditions.
URL
Contains full site address with domain and directory. You may use it e.g. while sending Location header to browser.
TODAY
Current time according to format set in settings.
JS
Contains logical value 1 if request is sent with AJAX.
LANG_DIR
Directory of active language preceded by / character.
SKIN_DIR i VIEW_DIR
Paths to skin folders in style (1) and cache (2) directories.
PRE
Prefix of tables, e.g. f3_.
LOGD
Contains logical value 1 (logged in) or 0 (not logged in).
UID
ID of user (0 = not logged in).
LEVEL
User's level:
0 = guest (not logged in)
1 = user
2 = editor
3 = administrator
4 = owner
$content
Object of class Content - template system.
$db
Object of class PDO - database support
$id
Variable 'id' from site URL (contains 0 when does NOT exist).
$nlang
Active language, e.g. en, pl.
$cfg
All settings. Options that have boolean value (on, off), do not exist in configuration files and you should use isset() in order to detect them.
if(isset($cfg['bbcode'])) echo 'BBCode is enabled';Option have logical only if it's presented as checkbox field on settings page. You can check or uncheck it.
$lang
Associative array with texts, e.g. $lang['title']. It's always available in templates, e.g. {lang.preview}.
$user
Associative array with data of current user.
bool Admit($id, $type)Returns TRUE if user has the privilege or else FALSE. If $type is empty, function tests global privileges, e.g. comments moderation if $id = CM. When $type = CAT, Admit() informs whether user may edit items in $id category.
if(Admit('CM')) echo 'You can edit/delete comments';string CatPath($id)Displays $id category's hierarchy.
string ListBox($folder, $type, $selected)Returns directory ($type=1) or file ($typ=2) list as <option> of <select>.
$list = ListBox('lang', 1, $nlang);string Pages($current, $total, $perPage, $url, $type=0)Returns pagination HTML code, where:
• type - if exists: options of select
• current - current page number
• total - number of all items
• url - address followed by parameter &page=X
string Banner($gid)Returns random code that belongs to $gid generator.
string Emots($text)Replaces text emoticons :) into graphical.
string genDate($date, $time = false)Formats universal GMT date - YYYY-MM-DD HH:DD:SS or unix timestamp (seconds since 1970) into format set in settings. The returned date has local time for used language. If $time = 1, it contains also hour and minutes.
string Autor($id)Returns user's login as link leading to his profile.
string Clean($text, $max=0, $censor=0)Use this function for POST, GET and COOKIES data to replace HTML code into entities by htmlspecialchars(). If $max != 0, text is clipped to length $max using substr(). If $censor exists, text is replaced according to settings.
int db_count($table)Count number of rows in $table. Variable $table may contain additional SQL syntax, e.g. conditions.
Mark:
Wrote: WebCM - 13.10.2009 o 08:24
Add comment


