Class cphplib

Description

cphplib class

Located in /cphplib.inc (line 57)


	
			
Direct descendents
Class Description
cphplib_formular cphplib formular extention
Variable Summary
Method Summary
cphplib cphplib ([string $locale = "de_DE"])
int age_from_birthday (string $date, [string $thisdate = ""], [char $date_format = "S"], [bool $fixed = false])
array array_rsort (array $a, array $b)
array array_sort (array $a, array $b)
array array_unique (array &$thearray)
char browser_type ([bool $details = false])
bool checkBankId (string $bank_id)
bool checkBirthday (date $birthday, [char $date_format = "S"])
bool checkColor (string $str)
bool checkDomainName (string $domain, [string $tld = null])
bool checkEAN (string $ean, [string $type = null])
bool checkEmail (string $email, [bool $with_dns = false])
bool checkHtmlTag (string $str)
bool checkIP (string $addr)
bool checkMAC (string $addr)
bool checkNumber (string $number, [char $sep = "."], [bool $mode = true], [bool $with_null = true])
bool checkNumWildcard (string $number, [char $sep = ","])
bool checkPassword (string $password, [int $min_length = 5], int $strength)
bool checkPhone (string $phone, [bool $mode = false])
bool checkString (string $str, [bool $mode = false])
bool checkUserName (string $user_name, [int $min_length = 3], [bool $allow_upper_case = true])
bool checkZip (string $zip)
bool check_php_version (string $min_ver, [bool $with_pear = false], [bool $mode = false])
string convDate (string $date_str, string $src_format, string $dest_format, [array $customize = null])
string convDateTime (string $datetime, [char $date_format = ""], [char $time_format = ""], [bool $with_seconds = false], [bool $short_mode = true], [string $at = null])
string convFirstLetter (string $str, [bool $mode = false])
string convHtml (string $str, [bool $mode = false], [bool $with_trim = true], [bool $with_link = false])
string convnumSep (float $st, [char $sep_new = "."], int $precision, [string $group = null])
string convTime (string $time, [char $time_format = null], [bool $with_seconds = true])
float convToNum (string $value, [string $sep_old = ","])
string convToTimestamp ([string $time = ""], [char $format = ""])
string convUmlaute (string $str, [bool $mode = true])
string convUrl (string $url)
int countdown (date $enddate)
int cross_sum (int $number)
date currentDate ([char $date_format = null])
time currentTime ([char $time_format = null])
int date2days (date $start_date, date $end_date, [char $date_format = "S"])
string dbsessionsub_start (string $session_id, [string $session_subid = ""])
bool dbsession_delete (string $session_id, string $var_name)
bool dbsession_end ([string $session_id = ""])
string dbsession_read (string $session_id, string $var_name)
string dbsession_start ([string $session_id = ""], [bool $table_error = true])
string dbsession_write (string $session_id, string $var_name, mixed $var_value)
bool db_close ()
object PEAR db_connect (string $dsn, [bool $set_db = true])
int db_free_id (string $table, string $column, [string $where_key = ""], [string $where_value = ""])
int db_insert_id ()
int db_next_id (string $table, string $column, [string $where = null])
int db_seq_id (string $seq_name)
string db_version ([float $mav = "3.23"], [float $miv = "6"])
string end_tag ()
string fileExtension (string $filename)
bool file_exists (string $filename)
string generate_password ([array $options = null])
string get_base_url (mixed $urls)
string get_client_ip ()
string get_filename_from_text (string $name)
array get_fontsizes ([char $os_type = ""], [char $browser_type = ""])
string get_id_string ([bool $with_time = true])
int get_image_size (string $filename)
string get_mod_rewrite_url (string $prefix, int $id, [string $name = ""], [bool $invert_prefix = false], [string $extension = ".html"])
mixed get_user_var (string $var_name, string $var_type)
int hitcounter (string $id, [bool $r = false], [bool $db_open = false], [array $CONF = null])
string html_head (array $customize)
void html_header ([array $customize = null])
bool in_multi_array (string $needle, array $haystack)
string js_conv (string $string)
string killSpace (string $str)
mixed metatag_write (string $filename, [bool $mode = true])
bool net_access ([array $hosts = null], [array $ips = null], [bool $mode = "client"])
char os_type ([bool $mode = false])
string pager (string $url, [int $current_entry = null], [int $max_entries = null], [int $page_entries = null], [int $image_url = null])
string rand_value ([int $length = 1], [string $values = ""])
void remove_magic_quotes (array &$array)
array rgb2dec (string $rgbstr)
void set_format (char $date_format, char $time_format)
void set_locale ()
void set_strings ()
string show_dbdate (string $dbdate, [bool $short_mode = true])
string show_dbdatetime (string $dbdate, [bool $with_seconds = false], [bool $short_mode = true], [string $at = null])
void show_error (string $function, string $message, [mixed $rc = null])
string sql_value (string $str, [bool $conv_special_char = false], [int $active_null = 1])
string table_header (array $cols, int $default_col, string $sort, string $base_url, [array $customize = null])
string text_shorten (string $text, int $max_length, [string $dots = "..."])
string url (string $url, [string $name = ""], [int $mode = 1], [string $title = ""], [string $customize = ""])
bool url_on_scripthost (string $url)
timestamp validate_timestamp (mixed $timestamp, [bool $mode = false])
Variables
char $date_format (line 96)

Date format

I = International date identifier (MM/DD/YYYY) S = Science date identifier (YYYY-MM-DD) C = Date without seperators (YYYYMMDD) L = German date identifier (DD.MM.YYYY)

resource $db (line 142)

Database pear object (mysql or pgsql)

string $db_type (line 134)

Type of database

int $error_level = 2 (line 75)

Error level

0: show no error message 1: only print message 2: die, if error occurres 3: user defined function (callback) => error_user_function required

mixed $error_user_function (line 84)

User defined function

Required for error_level=3

string $image_url = "images" (line 177)

Image URL to all images

string $locale (line 113)

locale to use (see "man locale")

bool $mod_rewrite = false (line 201)

take special care for mod_rewrite

at the moment only url() is supported

bool $m_dbsession_cookies = false (line 192)

cookies can be used for dbsession

mixed $m_dbsession_detail_table = "dbsession_detail" (line 184)
mixed $m_dbsession_handler = false (line 180)
mixed $m_dbsession_id = "" (line 181)
mixed $m_dbsession_id_name = "SID" (line 182)
mixed $m_dbsession_table = "dbsession" (line 183)
mixed $m_dbsession_timeout = 60 (line 185)
char $m_sep_i = "/" (line 156)

International seperator

char $m_sep_l = "." (line 170)

German seperator

char $m_sep_s = "-" (line 163)

Science seperator

int $page_entries = 20 (line 127)

Max. entries on one page of a list

resource $sql_like (line 149)

like not case sensitive for SQL

char $time_format (line 106)

Time format

Y = 24 hours mode N = 12 hours mode

float $version = "0.50" (line 64)

cphplib version

bool $xhtml = true (line 120)

xhtml output

Methods
Constructor cphplib (line 209)

constructor

cphplib cphplib ([string $locale = "de_DE"])
  • string $locale: if no empty, locale and string will be initialised
age_from_birthday (line 3146)

computes the exact age (considering leap years!) of the person born on the specified birthday measured from today or a specified date

  • return: age of person, returns "" if the person is not born yet or the date is wrong! (returns "born"-string, if the age is exactly 0)
int age_from_birthday (string $date, [string $thisdate = ""], [char $date_format = "S"], [bool $fixed = false])
  • string $date: Date on which the person was born
  • string $thisdate: Date from which the age is measured (default: today)
  • char $date_format: Format of the date and thisdate strings (default: "S"cience format)
  • bool $fixed: if true, age of current year will be returned {default: false}
array_rsort (line 1231)

reverse sort array (subfunction for usort)

array array_rsort (array $a, array $b)
  • array $a: keys
  • array $b: values
array_sort (line 1207)

sort array (subfunction for usort)

array array_sort (array $a, array $b)
  • array $a: keys
  • array $b: values
array_unique (line 1180)

Removes duplicate values from an array (recursive) (this function is much slower than the internal php function)

array array_unique (array &$thearray)
  • array $thearray: array to unique
browser_type (line 2876)

Returns type of browser

  • return: array if details is true, or char: m = Mozilla (and all clones) i = Internet Explorer n = Netscape
    • = Opera
    k = Konqueror "" = unknown
char browser_type ([bool $details = false])
  • bool $details: true = return array with browser type and gecko engine version (only available for Mozilla based browsers) browser_type = browser type gecko_version = gecko version integer {default: 0} false = return letter for browser type {default: false}
checkBankId (line 2025)

validate German Bankleitzahl ( allowed seperators: "-", "." or " ")

bool checkBankId (string $bank_id)
  • string $bank_id: bank id (German BLZ) to validate
checkBirthday (line 2042)

Check birthday

bool checkBirthday (date $birthday, [char $date_format = "S"])
  • date $birthday
  • char $date_format
checkColor (line 2211)

check if string is a valid color value for HTML and CSS

bool checkColor (string $str)
  • string $str: string to validate
checkDomainName (line 2107)

validate domain name

bool checkDomainName (string $domain, [string $tld = null])
  • string $domain: domain name
  • string $tld: top level domain
checkEAN (line 3483)

Verify EAN

bool checkEAN (string $ean, [string $type = null])
  • string $ean
  • string $type: type of EAN: {default: EAN13} EAN8,EAN13,EAN14,UPC12,ILN,NVE18
checkEmail (line 2062)

validate email address format

bool checkEmail (string $email, [bool $with_dns = false])
  • string $email: email address
  • bool $with_dns: true for dns check {default: false} (only works on non-windows platforms)
checkHtmlTag (line 2197)

check if a string has HTML tags

  • return: true if string has html tags
bool checkHtmlTag (string $str)
  • string $str: string to validate
checkIP (line 2137)

validate IP address

  • return: true if valid
bool checkIP (string $addr)
  • string $addr: IP address to validate
checkMAC (line 2167)

validate MAC address

bool checkMAC (string $addr)
  • string $addr: MAC address to validate
checkNumber (line 2237)

is string a valid number?

bool checkNumber (string $number, [char $sep = "."], [bool $mode = true], [bool $with_null = true])
  • string $number: number to validate
  • char $sep: valid seperator {default: "."}
  • bool $mode: if true, with negative numbers {default: true}
  • bool $with_null: if true, number "0" is valid {default: true}
checkNumWildcard (line 1977)

validate number (positiv) with wildcards

bool checkNumWildcard (string $number, [char $sep = ","])
  • string $number: number to validate
  • char $sep: valid seperator {default: ","}
checkPassword (line 2370)

validate password format

  • return: true for qualified password
bool checkPassword (string $password, [int $min_length = 5], int $strength)
  • string $password: password string
  • int $min_length: minimal length of password {default: 5}
  • int $strength: 0: no special rules {default} 1: at least one number and one char 2: same as 1 and at least one lowercase and and uppercase letter 3: same as 2 and at least one special character
checkPhone (line 1993)

validate phone number

bool checkPhone (string $phone, [bool $mode = false])
  • string $phone: phone number to validate
  • bool $mode
checkString (line 2415)

validate string with letters only

bool checkString (string $str, [bool $mode = false])
  • string $str: tring to validate
  • bool $mode: true for German Umlaute include {default: false}
checkUserName (line 2283)

validate user name (only alpha-numeric, '_' and '-' (but not as first sign, because some systems has problems with this) are allowed)

bool checkUserName (string $user_name, [int $min_length = 3], [bool $allow_upper_case = true])
  • string $user_name: user to validate
  • int $min_length: minimal length of username {default: 3}
  • bool $allow_upper_case: true : case insensitive {default: true} false : upper letters are not allowed
checkZip (line 2010)

validate post zip code

bool checkZip (string $zip)
  • string $zip: zip to validate
check_php_version (line 2305)

checks version of php and if pear is installed

bool check_php_version (string $min_ver, [bool $with_pear = false], [bool $mode = false])
  • string $min_ver: oldest php version, which is allowed
  • bool $with_pear: true: if pear must installed {default: false}
  • bool $mode: true: die with message {default: false}
convDate (line 1744)

Convert date format

  • return: date or {if wrong input) empty
string convDate (string $date_str, string $src_format, string $dest_format, [array $customize = null])
  • string $date_str: date to convert
  • string $src_format: see member variables $this->date_format above
  • string $dest_format: see member variables $this->date_format above or 'short' or 'long'
  • array $customize: year_format string = long : e.g. 2002 {default} short: e.g. 02 void : e.g. leading_zeros bool = true : e.g. 01 {default} false: e.g. 1 with_weekday bool = true: with weekday false: without weekdays (only available if dest_format is short or long) locale string = see member variables m_locale above first_valid_year = first valid year, if specified date is before, it will be signed as invalid {default: 1850} short_mode = if today, yesterday or tomorrow show string for date {default: false}
convDateTime (line 1693)

convert datetime format

  • return: datetime in converted format
string convDateTime (string $datetime, [char $date_format = ""], [char $time_format = ""], [bool $with_seconds = false], [bool $short_mode = true], [string $at = null])
  • string $datetime: db datetime field format
  • char $date_format: see member variable m_date above
  • char $time_format: see member variable m_time above
  • bool $with_seconds: show seconds
  • bool $short_mode: if today, yesterday or tomorrow show string for date
  • string $at
convFirstLetter (line 2607)

convert first letter to upper or lower

string convFirstLetter (string $str, [bool $mode = false])
  • string $str: string to convert
  • bool $mode: true for upper, false for lower
convHtml (line 2511)

convert ascii string to HTML string (because of a bug, it is better to set magic_quotes_gpc=Off in your php.ini)

string convHtml (string $str, [bool $mode = false], [bool $with_trim = true], [bool $with_link = false])
  • string $str: string to convert
  • bool $mode: true : html->ascii false: ascii->html {default}
  • bool $with_trim: true : cut off whitespaces before and after the string {default} false: leave string with whitespaces
  • bool $with_link: true : allow HTML links (you have to use [url=http://mydomain.com/]thebest[/url] syntax or [mail=me@mydomain.com]Me[/mail] (at the moment it works only in ascii->html)) false: disallow HTML links {default}
convnumSep (line 1478)

convert seperator in number and fill number to specified length

  • return: converted string with number
string convnumSep (float $st, [char $sep_new = "."], int $precision, [string $group = null])
  • float $st: number to convert
  • char $sep_new: new seperator {default: "."}
  • int $precision: numbers behind seperator {default: 0 } (filling with 0; this function doesn't cut or round numbers)
  • string $group: if set, this group seperator will be used
convTime (line 1604)

validate time format and convert it into right format

  • return: converted time, if wrong input false
string convTime (string $time, [char $time_format = null], [bool $with_seconds = true])
  • string $time: time to convert
  • char $time_format: see member variable $this->time_format above
  • bool $with_seconds: if false, don't return seconds {default: true}
convToNum (line 1436)

convert string to number while converting old seperator with "."

float convToNum (string $value, [string $sep_old = ","])
  • string $value: string to convert {default: ","}
  • string $sep_old: old seperator
convToTimestamp (line 1556)

validate time format and convert it into right format

  • return: converted time, if wrong input false
string convToTimestamp ([string $time = ""], [char $format = ""])
  • string $time: time (or date) to convert, if empty NOW will be used
  • char $format: if empty or time, e.g. 19:45:59 datetime, e.g. 2002-07-20 21:02:55
convUmlaute (line 2440)

convert German Umlaute to HTML and vice versa

string convUmlaute (string $str, [bool $mode = true])
  • string $str: string to convert
  • bool $mode: true: convert to HTML false: from HTML
convUrl (line 3073)

checks for protocol, if missing http will be used

string convUrl (string $url)
  • string $url
countdown (line 3094)

counts days till specified day

  • return: days till specified date
int countdown (date $enddate)
  • date $enddate
cross_sum (line 3058)

Return cross sum of a number

int cross_sum (int $number)
  • int $number
currentDate (line 1254)

the current date

date currentDate ([char $date_format = null])
  • char $date_format: see member variables $this->date_format below
currentTime (line 1274)

the current time

time currentTime ([char $time_format = null])
  • char $time_format: see member variable $this->time_format below
date2days (line 1376)

calculates days to a given date

  • return: number of days, if date is out of range -1
int date2days (date $start_date, date $end_date, [char $date_format = "S"])
  • date $start_date: first date
  • date $end_date: last date
  • char $date_format: see member variables $this->date_format below
dbsessionsub_start (line 669)

starts sub session within a session. You can use it to group the session in different parts Required : read README file

  • return: session_subid
string dbsessionsub_start (string $session_id, [string $session_subid = ""])
  • string $session_id: session id to use (main session)
  • string $session_subid: session_subid. If empty new unique id will be generated if required
dbsession_delete (line 876)

unregister variable in dbsession Required : read README file

  • return: true if successfully removed variable
bool dbsession_delete (string $session_id, string $var_name)
  • string $session_id: session id which will be used for the variabel
  • string $var_name: variable to remove
dbsession_end (line 728)

ends dbsession or dbsessionsub (Read the README file for requirements)

  • return: true if successfully end dbsession
bool dbsession_end ([string $session_id = ""])
  • string $session_id: session id which should end ( and expired dbsession will automatically be removed)
dbsession_read (line 839)

register variable in dbsession

  • return: value of variable
string dbsession_read (string $session_id, string $var_name)
  • string $session_id: session id to use
  • string $var_name: name of variable
dbsession_start (line 543)

starts dbsession. Enables session fallback handling. This functions

will be required, if you want to handle the session_id with url or formstart Required : read README file

  • return: session_id
string dbsession_start ([string $session_id = ""], [bool $table_error = true])
  • string $session_id: session id to use, if empty new unique id will be generated
  • bool $table_error: show error message, if dbsession tables doesn't exist
dbsession_write (line 786)

register variable in dbsession Required : read README file

  • return: value of variable
string dbsession_write (string $session_id, string $var_name, mixed $var_value)
  • string $session_id: session id to use
  • string $var_name: variable to add
  • mixed $var_value: value of variable
db_close (line 340)

disconnect current database connection (change $this->db for select the right one, if you use more the one connection)

  • return: true if no errors occurred, otherwise false
bool db_close ()
db_connect (line 295)

Opens a connection to a database server and select database Furthermore it sets $this->db to the PEAR database object, which is required for dbsession

  • return: database object
object PEAR db_connect (string $dsn, [bool $set_db = true])
  • string $dsn: Data Source Name ( for more information see PEAR documentation) addon array key: persistent = true for persistent {default: false}
  • bool $set_db: if true, db object will be set to $this->db (and db_tyle and sql_like, too)
db_free_id (line 447)

Get number of lowest unused number in a column)

  • return: lowest unused number in a column
int db_free_id (string $table, string $column, [string $where_key = ""], [string $where_value = ""])
  • string $table: database table to use
  • string $column: database column to use
  • string $where_key: database column name for limitation {default: void}
  • string $where_value: limitation value {default: void}
db_insert_id (line 355)

Get the id generated from the previous INSERT operation

int db_insert_id ()
db_next_id (line 380)

Get next available number

  • return: highst number in column + 1
int db_next_id (string $table, string $column, [string $where = null])
  • string $table: database table to use
  • string $column: database column to use
  • string $where: SQL WHERE restriction, e.g. "thisvalue>0" (without "WHERE" in string!)
db_seq_id (line 412)

Get next available number

int db_seq_id (string $seq_name)
  • string $seq_name: name of sequence
db_version (line 494)

check right database version

  • return: active database version, if false empty
string db_version ([float $mav = "3.23"], [float $miv = "6"])
  • float $mav: major release number {default: 3.23}
  • float $miv: minor release number {default: 6}
end_tag (line 2621)

Return end tag for formular objects attending xhtml settings ($this->xhtml)

string end_tag ()
fileExtension (line 1408)

return file extension

string fileExtension (string $filename)
  • string $filename
file_exists (line 1943)

Checks whether a file or directory exists (also checks the include_path in php.ini)

bool file_exists (string $filename)
  • string $filename
generate_password (line 3223)

generate password with specified characteristics

  • return: generated password string (if an error occurred, false)
string generate_password ([array $options = null])
  • array $options: options array: min_length = min. length of password {default: 8} max_length = max. length of password {default: 8} exclude_signs = string with forbiddenen signs include_signs = string with signs, which have to been used exclude_pwd = this password is forbidden with_numbers = password has to use at least one number {true} with_lowers = password has to use at least one lower letter {true} with_uppers = password has to use at least one upper letter {true} with_signs = password has to use at least one special char {true}
get_base_url (line 3875)

Calculate active URL of an array for validation (can be used for multi URL sites (e.g. dyndns)

  • return: validated base url
string get_base_url (mixed $urls)
  • mixed $urls: an url or an array of urls
get_client_ip (line 3449)

get the ip address from the client, even if the client is befind a proxy (it doesn't work with transparent proxy!)

  • return: ip address of the client
string get_client_ip ()
get_filename_from_text (line 4028)

Cleanup text from invalid characters for filename

string get_filename_from_text (string $name)
  • string $name
get_fontsizes (line 2979)

calculates CSS font sizes. This is a small solution, that the appearance looks similar with different browser types and operating systems

  • return: array with css font sizes
array get_fontsizes ([char $os_type = ""], [char $browser_type = ""])
  • char $os_type: type of operating system {default: 'user agent os'}
  • char $browser_type: type of browser {default: 'user agent os'}
get_id_string (line 3429)

create unique identification string

  • return: unique identification string
string get_id_string ([bool $with_time = true])
  • bool $with_time: true : with timestamp {default} false: without considering time and date
get_image_size (line 3523)

Return size of image file

int get_image_size (string $filename)
  • string $filename
get_mod_rewrite_url (line 3964)

Get url for mod_rewrite

string get_mod_rewrite_url (string $prefix, int $id, [string $name = ""], [bool $invert_prefix = false], [string $extension = ".html"])
  • string $prefix: prefix of URL
  • int $id
  • string $name
  • bool $invert_prefix: if true, use prefix and id as suffix
  • string $extension: file extention
get_user_var (line 995)

returns value of special variable type from user input (If register_globals is Off (default since 4.2.0), this function can be used, to handle user variables (insecure variables).

You can use more than one type (seperated with ",") DBSESSION only works if dbsession_start has been called before.

  • return: value of variable or "", if invalid
mixed get_user_var (string $var_name, string $var_type)
  • string $var_name: name of variable
  • string $var_type: type of variable (POST, GET, COOKIE, SCRIPT, SESSION or DBSESSION) (note: SCRIPT means, declared variable above the function)
hitcounter (line 2710)

hit counter for web pages Required : every line in filename is a keyword, first line is the description (first line with quotes!!!)

int hitcounter (string $id, [bool $r = false], [bool $db_open = false], [array $CONF = null])
  • string $id: id string
  • bool $r: true: reload allowed false: reload disallowed {default}
  • bool $db_open: true: database connection aready open false: no database connection open, open one
  • array $CONF: CONF database array, if empty use counterconfig.php (have to be in same directory as cphplib.inc)
html_head (line 3796)

Write HTML head

string html_head (array $customize)
  • array $customize: title charset no_cache lang seo with_header print
html_header (line 3759)

Setup HTML header

void html_header ([array $customize = null])
  • array $customize: charset set charset no_cache if true, page will not be cachable gzip if true, gzip compression will be used
in_multi_array (line 1145)

search needle in multi array

bool in_multi_array (string $needle, array $haystack)
  • string $needle
  • array $haystack
js_conv (line 3912)

Convert string to javascript compatible output

string js_conv (string $string)
  • string $string
killSpace (line 1325)

Removes all whitespaces in a string

string killSpace (string $str)
  • string $str
metatag_write (line 2637)

prints a meta description and meta keywords line for xhtml Required : every line in filename is a keyword, first line is the description (first line with quotes!!!)

  • return: if mode is false, array with text and keywords
mixed metatag_write (string $filename, [bool $mode = true])
  • string $filename: filename with keywords
  • bool $mode: true: print it as meta tags {default} false: return array with text and keywords
net_access (line 3589)

check, if client IP or hostname is in access list

  • return: true : access false : no access
bool net_access ([array $hosts = null], [array $ips = null], [bool $mode = "client"])
  • array $hosts: array with hostnames, which have access
  • array $ips: array with ips, which have access
  • bool $mode: client, client ips (REMOTE_ADDR) {default} server, client ips (SERVER_ADDR) referrer (HTTP_REFERER)
os_type (line 2935)

returns type of operating system

  • return: w = Windows m = Mac l = Linux u = Unix
    • = OS/2
    "" = unknown
char os_type ([bool $mode = false])
  • bool $mode: true for server os, false for client os {default: false}
pager (line 3656)

pager (navigation) for list

  • return: html string for paper
string pager (string $url, [int $current_entry = null], [int $max_entries = null], [int $page_entries = null], [int $image_url = null])
  • string $url: link for urls
  • int $current_entry: current page number for navigation
  • int $max_entries: highest page number in navigation
  • int $page_entries: entries per page {default: $this->page_entries}
  • int $image_url: overwrite global image url
rand_value (line 3190)

generate rand string/number with specified length

  • return: generated rand string, on error ""
string rand_value ([int $length = 1], [string $values = ""])
  • int $length: length of chars/numbers for return
  • string $values: string with all allowed characters/numbers
remove_magic_quotes (line 972)

removes magic quotes

void remove_magic_quotes (array &$array)
  • array $array
rgb2dec (line 3564)

convert rgb to decimal color code

  • return: decimal color code
array rgb2dec (string $rgbstr)
  • string $rgbstr: rgb string
set_format (line 261)

Set date and time format to cphplib

void set_format (char $date_format, char $time_format)
  • char $date_format: see $this->date_format for valid values
  • char $time_format: see $this->time_format for valid values
set_locale (line 223)

Set locale

void set_locale ()
set_strings (line 271)

Set strings for pager and Date methods

void set_strings ()
show_dbdate (line 1292)

Get date from db-date format (short form of convDate)

string show_dbdate (string $dbdate, [bool $short_mode = true])
  • string $dbdate
  • bool $short_mode
show_dbdatetime (line 1314)

Get Datetime from db-date format (short form of convDate)

string show_dbdatetime (string $dbdate, [bool $with_seconds = false], [bool $short_mode = true], [string $at = null])
  • string $dbdate
  • bool $with_seconds
  • bool $short_mode
  • string $at
show_error (line 3929)

Show cphplib error

like error_level is defined

void show_error (string $function, string $message, [mixed $rc = null])
  • string $function: cphplib function name
  • string $message: error message
  • mixed $rc: return code
sql_value (line 2477)

Envelops a string with quotes (for db INSERT,UPDATES or SELECT)

  • return: converted string
string sql_value (string $str, [bool $conv_special_char = false], [int $active_null = 1])
  • string $str: string to convert
  • bool $conv_special_char: convert special charactar to html convention (great helper to secure SQL strings) {default: false} (conv_special_char is not recomended for an INSERT or UPDATE SQL string)
  • int $active_null: 0: deactive NULL value 1: active NULL value {default} 2: active NULL value, with 0 is invalid
table_header (line 4095)

table header for all tables with optional sort support

  • return: html output
string table_header (array $cols, int $default_col, string $sort, string $base_url, [array $customize = null])
  • array $cols: colomns array
  • int $default_col: default colomn
  • string $sort: sort order
  • string $base_url: base url for all links
  • array $customize: bool $static true: don't use sort header false: sort header {default} bool $use_th true: th for table vill be used {default} false: td for table will be used int $max_entries if > 0: static mode, if max_entries < 2 {default: 2} string $mask if exists, it will be added on the end of the URL, e.g #mask string $tr_class CSS class for TR string $th_class CSS class for TD/TH
text_shorten (line 3542)

shorten text to given length for display

string text_shorten (string $text, int $max_length, [string $dots = "..."])
  • string $text: text string
  • int $max_length: maximum lenght of text
  • string $dots: hars for dots {default: ...}
url (line 915)

prints url as html tag (this function can only handle the session_id, if dbsession_start has been called immediately after creating the class object)

  • return: created url
string url (string $url, [string $name = ""], [int $mode = 1], [string $title = ""], [string $customize = ""])
  • string $url: url
  • string $name: name of url {default: url}
  • int $mode: 0: no session_id 1: with session_id if required {default: 1} 2: just url with session_id (without TAG) 3: just url with session_id (without TAG), but with delimiter &amp; instead of & 4: with session_id (always)
  • string $title: url title (hover text)
  • string $customize: other parameters like target, style or class
url_on_scripthost (line 3040)

checks if specified url is on script server (on the host where your scripts are)

  • return: true if it is on host
bool url_on_scripthost (string $url)
  • string $url
validate_timestamp (line 1348)

validate given date

  • return: timestamp with valid date, if invalid input datas, return timestamp will be return the nearest valid date
timestamp validate_timestamp (mixed $timestamp, [bool $mode = false])
  • mixed $timestamp: array of date for validating or timestamp array keys: timestamp['year'] timestamp['month'] timestamp['day'] timestamp['hour'] timestamp['minute'] timestamp['second']
  • bool $mode: if true, input date is a timestamp {default: false}

Documentation generated on Fri, 11 Nov 2005 10:39:55 +0100 by phpDocumentor 1.3.0RC3