Procedural File: KT_functions.inc.php
Source Location: /common/KT_functions.inc.php
Page Details:
KT_addReplaceParam [line 311]
string KT_addReplaceParam(
string $qstring, string $paramName, [string $paramValue = null])
Adding or replacing a param/value in the string.
Tags:
Parameters
string
$qstring
the query string wich will be the subject (ex. ?myvar=1&myvar2=a or myvar=3&myvar2=v);
string
$paramName
the name of the variable wich will be strip from or will have a new value (ex. myvar or othervar);
string
$paramValue
if is not null this will be the value of the $paramName, if not the $paramName will be strip off (ex. myvalue or null);
KT_applyDate2rule [line 988]
array KT_applyDate2rule(
string $date, array $rule)
Splits a date into a chunked representation;
Tags:
Parameters
string
$date
The date to be precessed;
array
$rule
Associative array containing the date chunks order ('y'=> 1, 'm' => 3, etc);
KT_applyOutRule2date [line 1071]
string KT_applyOutRule2date(
array &$dateArr, array &$formatRule, string &$outStringRule)
Processes a date array in a usable format;
Tags:
Parameters
array
$dateArr
Associative array containing date chunks ('y'=>'2004', 'm'=>'5', etc.);
array
$formatRule
Associative array containing the output date formatting rules ('y'=> 2 chars, 'm' => 1 char, etc);
string
$outStringRule
Defines the output date format;
KT_CanonizeRelPath [line 118]
string KT_CanonizeRelPath(
string $relPath)
Try to canonize a path (replace ../ and ./ );
Tags:
Parameters
string
$relPath
the path to be canonize;
KT_compareDates [line 1246]
integer KT_compareDates(
array &$dateArr1, array &$dateArr2)
Compares 2 date arrays
Tags:
Parameters
array
$dateArr1
array
$dateArr2
KT_convertDate [line 881]
string KT_convertDate(
string $date, string $inFmt, string $outFmt)
Converts a date/time/datetime from one format to another
Tags:
Parameters
string
$date
The date
string
$inFmt
The input format (the format of the input date)
string
$outFmt
The output format (the format of the output date)
KT_convertDateCall [line 1328]
string KT_convertDateCall(
string $date, [string $toScreen = ''])
Wrapper for KT_convertDate
For internal use
Tags:
Parameters
string
$date
The date in input format
string
$toScreen
if $toScreen == 'toscreen' the date will be outputed in screen format; otherwise in database format
KT_DynamicData [line 582]
string KT_DynamicData(
string $expression, object or $tNG, [string $escapeMethod = ''], [booolean $useSavedData = false], [array $extraParams = array()], [mixed $errorIfNotFound = true])
Function KT_DynamicData replace all the dynamic data with their values;
Tags:
Parameters
string
$expression
The expression to be evaluated
string
$escapeMethod
The string escape method for the evaluated values (rawurlencode and SQL)
booolean
$useSavedData
Weather to use the current tNG data or the saved values
array
$extraParams
Extra expression parameters passed when for evaluation (of form $key => $value; any encounter of key will be replaced with its value)
object or
$tNG
null $tNG The tNG context in which the expression is evaluated
KT_escapeAttribute [line 414]
string KT_escapeAttribute(
string $val)
Escape the " > < from a string with the html entities;
Tags:
Parameters
string
$val
the value to be escaped;
KT_escapeExpression [line 1424]
string KT_escapeExpression(
string $expr)
Escape the expression for \ and ';
Tags:
Parameters
string
$expr
the expression to be escaped;
KT_escapeFieldName [line 1559]
string KT_escapeFieldName(
string $colName)
Escapes a value of a field name to be used in the transaction SQL
Ex: First Name gets translated into `First Name`
Tags:
Parameters
string
$colName
The DataBase field name
KT_escapeForSql [line 1492]
object unknown KT_escapeForSql(
object unknown $colValue, string $colType, [bool $forFakeRs = false])
Escapes a value against a specific type to be used in the transaction SQL
Ex: value=ab'b and type=STRING, result=ab\'b (escapes slashes)
Tags:
Parameters
object unknown
$colValue
The value to prepare
string
$colType
The type (STRING_TYPE, NUMERIC_TYPE, etc)
bool
$forFakeRs
if it should return values for an SQL query, or for an fake recordset
KT_escapeJS [line 424]
string KT_escapeJS(
string $val)
Apply addcslashes php function on the argument for the charlist: \t\r\n\'\\ ;
Tags:
Parameters
string
$val
the value to be escaped;
KT_expandTime [line 1294]
new KT_expandTime(
string $date)
Expands time expressions to full screen format
Tags:
Parameters
string
$date
- datetime expression
KT_format2newDF [line 912]
string KT_format2newDF(
string $dateformat)
Convert a date format from an old type date format %Y-%m-%d into new ones;
Tags:
Parameters
string
$dateformat
the string to be parsed (ex. %Y-%m-%d );
KT_format2outRule [line 1049]
string KT_format2outRule(
string $format)
Removes extra chars from a date format, in order to obtain a parsable definition;
Tags:
Parameters
string
$format
The format to be stripped (ex. yyyy-mm-dd);
KT_format2rule [line 927]
array KT_format2rule(
string $format)
Splits a date format into a chunked representation
Tags:
Parameters
string
$format
The format to be precessed
KT_formatDate [line 1415]
string KT_formatDate(
string $date)
Converts a date/time/datetime from database format to screen format
Used for date display
Tags:
Parameters
string
$date
The date in database format
KT_formatDate2DB [line 1405]
void KT_formatDate2DB(
string $date)
Converts a date/time/datetime from screen format to database format
For internal use
Parameters
string
$date
The date in screen format returns string the date in database format
KT_FormatForList [line 1440]
string KT_FormatForList(
string $value, int $maxChars)
Return a strip string (without html tags and no longer than $maxchars);
Tags:
Parameters
string
$value
the string wich will be parsed;
int
$maxChars
-1 or bigger then 0;
KT_getDaysOfMonth [line 1211]
string KT_getDaysOfMonth(
string $month, int $year)
Return the last day of the given month for the given year;
Tags:
Parameters
string
$month
the month in a numeric format (ex. 01 );
int
$year
the value of the year (ex. 2004)
KT_getFullUri [line 292]
Return the URL of the page in which the script is called and the query string if exists.
Tags:
KT_getInternalTimeFormat [line 1387]
nothing KT_getInternalTimeFormat(
)
Converts mm to ii in time formats and sets globals
For internal use maybe must be called from tng?
KT_getPHP_SELF [line 250]
Return the current page name and the query string if exists.
Tags:
KT_getRealValue [line 798]
object unknown KT_getRealValue(
string $method, string $reference)
Compiles a method and a reference into a value
Ex: method=GET and reference=test, return value=$_GET['test']
Tags:
Parameters
string
$method
The method (GET, POST, etc)
string
$reference
The reference (variable name)
KT_getReplacementsFromMessage [line 561]
array KT_getReplacementsFromMessage(
string &$string)
Parse the string for values like {...} and return an array with all the conted from {};
Parameters
string
$string
the string to be searched;
KT_getServerName [line 233]
string KT_getServerName(
)
Return the server name on which the page reside.
Tags:
KT_getSiteRoot [line 433]
Return the real path of the folder where includes folder resides ;
Tags:
KT_getUri [line 268]
Return the URL of the page in which the script is called.
Tags:
KT_getUriFolder [line 280]
string KT_getUriFolder(
)
Return the folder of the page in which the script is called.
Tags:
KT_isValidDate [line 1156]
boolean KT_isValidDate(
$dateArr &$dateArr, [mixed $fullDateTime = true])
Validates a date array
Tags:
Parameters
$dateArr
&$dateArr
the date array
KT_makeIncludedURL [line 399]
nothing KT_makeIncludedURL(
string $url)
Return $GLOBALS['KT_REL_PATH'] in front of the URL if the URL si not absolute and $GLOBALS['KT_REL_PATH'] is setted;
Tags:
Parameters
string
$url
the URL string (ex. admin/shop/);
KT_pathinfo [line 497]
array KT_pathinfo(
string $fileName)
Extracts parts of a file (dirname, basename, filename, extension)
Tags:
Parameters
string
$fileName
The file name
KT_realpath [line 522]
string KT_realpath(
string $pathName, [boolean $isFolder = true])
Transforms a path into its absolute value
Path separator is always "/" and for folders, always adds the trailing "/" If folder/file does not exist, the "pathName" will be added to the current folder path
Tags:
Parameters
string
$pathName
The path to be translated
boolean
$isFolder
Specifies if the path is a folder or a file
KT_redir [line 372]
nothing; KT_redir(
string $url)
Make the redirect on server side;
Parameters
string
$url
the URL to which is makeing the redirect;
KT_Rel2AbsUrl [line 92]
string KT_Rel2AbsUrl(
string $pageUrl, string $templateUrl, string $relUrl)
Try to transform a relative path in an absolut one;
Tags:
Parameters
string
$pageUrl
the url of the calling script;
string
$templateUrl
the url of the template url;
string
$relUrl
the url to transform in absolute if case;
KT_SessionKtBack [line 1592]
nothing; KT_SessionKtBack(
string $newUrl)
Add the URL to the $_SESSION['KT_backArr'] array if this array not exist; If the array $_SESSION['KT_backArr'] exist check if the last entry is identical with the argument; If this 2 url are identical the old one is replaced with the new one, if not the new one is append it.
Parameters
string
$newUrl
the url to be add to the array;
KT_session_start [line 444]
nothing; KT_session_start(
)
Start the session if it is not started and put in session the values from _SESSION[md5($siteroot)] ;
KT_setDbType [line 1469]
string KT_setDbType(
object $connection)
Set the database type and server model in $GLOBALS and return the database type;
Tags:
Parameters
object
$connection
the connection object;
KT_setFilePermissions [line 1627]
boolean KT_setFilePermissions(
mixed $fileName, [mixed $isFolder = false])
Set the the permissions for folder/file setted in GLOBALS['KT_folder_mode']/GLOBALS['KT_file_mode'];
Tags:
KT_setServerVariables [line 10]
nothing; KT_setServerVariables(
)
Try to set certain _SERVER vars if not setted from _ENV vars;
KT_setSessionVar [line 465]
nothing; KT_setSessionVar(
string $var)
Put in the $_SESSION[$siteroot][$var] key the $_SESSION[$var] value ;
Parameters
string
$var
the name of the variable to be setted from _SESSION[$var] to _SESSION[$siteroot][$var];
KT_stripslashes [line 785]
nothing; KT_stripslashes(
string $value, string $key)
Wrapper for stripslashes; it is used as callbackfunction;
Parameters
string
$value
the string to be searched;
string
$key
the string to be searched;
KT_stripTime [line 1264]
new KT_stripTime(
string $date)
Strips empty values from time expressions
Tags:
Parameters
string
$date
- datetime expression
KT_transformsPaths [line 153]
void KT_transformsPaths(
mixed $templateUrl, mixed $text)
Known bugs:
2. URL contains inside "simple quotes" or 'double quotes' will be removed
KT_unsetSessionVar [line 480]
nothing; KT_unsetSessionVar(
string $var)
Unset the $_SESSION[$siteroot][$var] and $_SESSION[$var] ;
Parameters
string
$var
the name of the variable to be unseted;