com-tecnick-tcexam-shared

# Procedural File: tce_functions_general.php Source Location: /shared/code/tce_functions_general.php ## Page Details: General functions. #### Tags:
author: | Nicola Asuni
copyright: | Copyright © 2004-2010, Nicola Asuni - Tecnick.com S.r.l. - ITALY - www.tecnick.com - info@tecnick.com
link: | www.tecnick.com
since: | 2001-09-08
license: | GNU Affero General Public License
### F_check_unique [line 120]
`bool F_check_unique( string $table, string $where, [mixed $fieldname = FALSE], [mixed $fieldid = FALSE])`
Check if specified fields are unique on table. #### Tags:
return: | true if unique, false otherwise
#### Parameters
string | $table | table name
string | $where | SQL where clause
mixed | $fieldname | name of table column to check
mixed | $fieldid | ID of table row to check
[ Top ] ### F_compact_string [line 173]
`converted F_compact_string( string $string)`
Remove the following characters: "\t" (ASCII 9 (0x09)), a tab. "\n" (ASCII 10 (0x0A)), a new line (line feed) "\r" (ASCII 13 (0x0D)), a carriage return "\0" (ASCII 0 (0x00)), the NUL-byte "\x0B" (ASCII 11 (0x0B)), a vertical tab #### Tags:
return: | string
#### Parameters
string | $string | input string to convert
[ Top ] ### F_count_rows [line 58]
`number F_count_rows( string $dbtable, [string $where = ''])`
Count rows of the given table. #### Tags:
return: | of rows
#### Parameters
string | $dbtable | database table name
string | $where | optional where SQL clause (including the WHERE keyword).
[ Top ] ### F_db_getUTCoffset [line 385]
`string F_db_getUTCoffset( string $timezone)`
Returns the UTC time offset yo be used with CONVERT_TZ function #### Tags:
return: | UTC time offset (+HH:mm)
#### Parameters
string | $timezone | current user timezone
[ Top ] ### F_empty_to_null [line 79]
`string F_empty_to_null( string $str)`
Prepare field value for SQL query. Returns the quoted string if not empty, NULL otherwise. #### Tags:
return: | quoted if not empty, NULL otherwise
#### Parameters
string | $str | string to check.
[ Top ] ### F_formatPdfPercentage [line 355]
`string F_formatPdfPercentage( float $num)`
format a percentage number #### Parameters
float | $num | number to be formatted
[ Top ] ### F_formatPercentage [line 346]
`formatted F_formatPercentage( float $num)`
Format a percentage number. #### Tags:
return: | string
#### Parameters
float | $num | number to be formatted
[ Top ] ### F_formatXMLPercentage [line 365]
`string F_formatXMLPercentage( float $num)`
format a percentage number for XML #### Parameters
float | $num | number to be formatted
[ Top ] ### F_getBoolean [line 105]
`boolean F_getBoolean( string $str)`
Returns boolean value from string. This function is needed to get the right boolean value from boolean field returned by PostgreSQL query. #### Tags:
return: | value.
#### Parameters
string | $str | string to check.
[ Top ] ### F_getUTCoffset [line 374]
`int F_getUTCoffset( string $timezone)`
Returns the UTC time offset in seconds #### Tags:
return: | UTC time offset in seconds
#### Parameters
string | $timezone | current user timezone
[ Top ] ### F_replace_angulars [line 183]
`converted F_replace_angulars( string $str)`
Replace angular parenthesis with html equivalents (html entities). #### Tags:
return: | string
#### Parameters
string | $str | input string to convert
[ Top ] ### F_substr_utf8 [line 195]
`substring F_substr_utf8( string $str, [int $start = 0], int $length)`
Return part of a string removing remaining non-ASCII characters. #### Parameters
string | $str | input string
int | $start | substring start index
int | $length | substring max lenght
[ Top ] ### F_text_to_xml [line 212]
`converted F_text_to_xml( string $str)`
Escape some special characters (&lt; &gt; &amp;). #### Tags:
return: | string
#### Parameters
string | $str | input string to convert
[ Top ] ### F_xml_to_text [line 222]
`converted F_xml_to_text( string $str)`
Unescape some special characters (&lt; &gt; &amp;). #### Tags:
return: | string
#### Parameters
string | $str | input string to convert
[ Top ] ### F_zero_to_null [line 92]
`string F_zero_to_null( string $num)`
Prepare field value for SQL query. Returns the num if different from zero, NULL otherwise. #### Tags:
return: | if != 0, NULL otherwise
#### Parameters
string | $num | string to check.
[ Top ] ### getIpAsInt [line 324]
`int getIpAsInt( string $ip)`
Converts a string containing an IP address into its integer value. #### Tags:
return: | IP address as integer number.
since: | 7.1.000 (2009-02-13)
#### Parameters
string | $ip | IP address to convert.
[ Top ] ### getIpAsString [line 336]
`int getIpAsString( string $ip)`
Converts a string containing an IP address into its integer value and return string representation. #### Tags:
return: | IP address as string.
since: | 9.0.033 (2009-11-03)
#### Parameters
string | $ip | IP address to convert.
[ Top ] ### getNormalizedIP [line 262]
`string getNormalizedIP( string $ip)`
Convert all IP addresses to IPv6 expanded notation. #### Tags:
return: | IPv6 address in expanded notation or false in case of invalid input.
since: | 7.1.000 (2009-02-13)
#### Parameters
string | $ip | IP address to normalize.
[ Top ] ### showRequiredField [line 232]
`html showRequiredField( [int $mode = 1])`
Return a string containing an HTML acronym for required/not required fields. #### Tags:
return: | string
#### Parameters
int | $mode | field mode: 1=not required; 2=required.
[ Top ] ### unhtmlentities [line 149]
`converted unhtmlentities( string $text_to_convert, [boolean $preserve_tagsign = FALSE])`
Reverse function for htmlentities. #### Tags:
return: | string
#### Parameters
string | $text_to_convert | input string to convert
boolean | $preserve_tagsign | if true preserve <> symbols, default=FALSE
[ Top ] ### utrim [line 249]
`string utrim( string $txt)`
Strip whitespace (or other characters) from the beginning and end of an UTF-8 string and replace the \xA0 with normal space. #### Tags:
return: | The trimmed string.
#### Parameters
string | $txt | The string that will be trimmed.
[ Top ] Documentation generated on Mon, 06 Dec 2010 12:03:05 +0100 by phpDocumentor 1.4.3