Public Method Details |
Utils |
public void Utils( )
|
|
Constructor. Loads class DB and launches ip_start().
|
Returns |
void |
|
ip |
public string ip( [ integer $i ] )
|
|
Return IP of the $HTTP_SERVER_VARS['REMOTE_ADDR'] or
$HTTP_SERVER_VARS['HTTP_X_FORWARDED']_FOR if it exists
|
Parameter |
|
integer |
$i |
= >>0<< |
|
if 0, converts the decimal IP into hexadecimal one |
|
Returns |
string the IP in decimal. |
|
convertip |
public string convertip( int $ip )
|
|
Convert hexadecimal IP into decimal IP
|
Parameter |
|
int |
$ip |
|
|
IP in hexadecimal |
|
Returns |
string IP in decimal type (XXX.XXX.XXX.XXX) |
|
stamp2array |
public array stamp2array( string $t )
|
|
Converts a SQL timestamp into an array (YYYY, MM, DD)
Input: timestamp(14)
Output: array( YYYY, MM, DD)
|
Parameter |
|
string |
$t |
|
|
the SQL timestamp(14) |
|
Returns |
array (Year, Month, Day) |
|
stamp2datetime |
public string stamp2datetime( string $t )
|
|
Converts a SQL timestamp into YYYY-MM-DD hh:mm:ss
Input: timestamp(14)
Output: YYYY-MM-DD hh:mm:ss
|
Parameter |
|
string |
$t |
|
|
the SQL timestamp(14) |
|
Returns |
string the formatted date YYYY-MM-DD hh:mm:ss |
|
stamp2date |
public string stamp2date( string $t, string $mode, [ integer $type ] )
|
|
Function which takes a timestamp as input and returns the date
Thanks to mose mose@mose.com
type=0 $t timestamp 14
type=1 $t UNIX timestamp
type=2 $t unused
|
Parameter |
|
|
|
string |
$mode |
|
|
the output format. |
|
|
integer |
$type |
= >>0<< |
|
the type of the timestamp |
|
Returns |
string the formated date. |
|
stamp2time |
public string stamp2time( string $t, string $mode )
|
|
Function which takes a timestamp(14) as input and returns the time
Thanks to mose mose@mose.com
|
Parameter |
|
|
|
string |
$mode |
|
|
the format of the output |
|
Returns |
string the formated time |
|
interval |
public string interval( string $t1, string $t2 )
|
|
This returns the time elapsed between two SGBD timestamps.
"1, 10:20" means one day, ten hours, twenty minutes.
|
Parameter |
|
string |
$t1 |
|
|
the first SQL timestamp |
|
|
string |
$t2 |
|
|
the second SQL timestamp |
|
Returns |
string the time difference. |
|
makerand |
public string makerand( [ integer $nb ] )
|
|
Returns random caracters
|
Parameter |
|
integer |
$nb |
= >>8<< |
|
the number of caracters to return |
|
Returns |
string a random string of $nb characters |
|
spec_chars |
public string spec_chars( string $text )
|
|
Change accent to visible thing for WAP
FIXME: unused
|
Parameter |
|
string |
$text |
|
|
the text to escape |
|
Returns |
string the escaped text. |
|
createdir |
public bool createdir( [ string $dir, integer (octal) $mode ] )
|
|
Create directories recursively
|
Parameter |
|
string |
$dir |
= >>""<< |
|
the directory hierarchy to create |
|
|
integer (octal) |
$mode |
= >>493 (0755)<< |
|
the mode of the created dirs |
|
Returns |
bool 1 if success, 0 otherwise |
|
getcwd |
public string getcwd( )
|
|
Define the getcwd function, for compatibility with PHP 3
|
Returns |
string the current working directory |
|
realpath |
public string realpath( string $path )
|
|
Define the realpath function, for compatibility with PHP 3
|
Parameter |
|
string |
$path |
|
|
path to convert |
|
Returns |
string "Canonicalized absolute pathname" |
|
write_file |
public void write_file( string $file, [ string $text ] )
|
|
Write text to a file using a temporary file to avoid
concurrent writings.
|
Parameter |
|
string |
$file |
|
|
the filename |
|
|
string |
$text |
= >>""<< |
|
the text to write |
|
Returns |
void |
|
gettimestampnews |
public array gettimestampnews( integer $news_id )
|
|
Returns the timestamp of the news
FIXME: MIGHT BE MOVED INTO THE NEWS CLASS
|
Parameter |
|
integer |
$news_id |
|
|
of the news |
|
Returns |
array year , month, day, id |
|
loadishigh |
public bool loadishigh( )
|
|
Checks if server load is not too high
Returns 1 if actual load is higher than a level which is configured in
config.php3
else returns 0
|
Returns |
bool 1 if too high, 0 otherwise |
|
loadis |
public string loadis( )
|
|
Returns the actual load of the server
|
Returns |
string the server load |
|
cmp_array |
public bool cmp_array( array $table1, array $table2 )
|
|
Compare two arrays and return true if they are equal.
PHP3 does not handle compar. of objects.
|
Parameter |
|
|
|
|
Returns |
bool 1 if identical, 0 otherwise |
|
make_topics_button |
public string make_topics_button( )
|
|
Returns the html <select> with the list of a topics
|
Returns |
string the HTML list of topics |
|
make_sections_button |
public string make_sections_button( )
|
|
Returns the html <select> with the list of a sections
|
Returns |
string the HTML list |
|
htmlspecial_board |
public string htmlspecial_board( string $text )
|
|
Escape unauthorized tags for the board
|
Parameter |
|
string |
$text |
|
|
the text to escape |
|
Returns |
string the escaped text |
|
htmlspecial |
public string htmlspecial( string $text, [ string $url_conv ] )
|
|
Escape unauthaurized tags
|
Parameter |
|
string |
$text |
|
|
the text to escape |
|
|
string |
$url_conv |
= >>"0"<< |
|
1 to convert URLS into link |
|
Returns |
string the escaped text |
|
url_conv |
public string url_conv( string $text )
|
|
Function to replace URL by link and reduce the length of the link.
will fail on URL containing )
|
Parameter |
|
|
Returns |
string |
|
crypt_dacode |
public mixed crypt_dacode( string $passwd, [ string $encrypted_password ] )
|
|
Function to encrypt password
so we can change the encrypt method if we need to.
Returns encrypted password if one argument,
Returns 1 if 2 arguments and they match,
Returns 0 if 2 arguments and they don't match.
|
Parameter |
|
|
|
string |
$encrypted_password |
= >>""<< |
|
|
|
Returns |
mixed |
|
send_email |
public bool send_email( [ string $to, string $subject, string $message, string $from ] )
|
|
Function to send a mail.
|
Parameter |
|
|
|
|
|
|
|
|
Returns |
bool 1 if the mail has been sent, 0 otherwise |
|
html_safe |
public bool html_safe( mixed $var )
|
|
Make sure there is no '<' sign in text
|
Parameter |
|
mixed |
$var |
|
|
(string) the text to check. May be an array of strings to check |
|
Returns |
bool 1 if no <, 0 otherwise |
|
quote_text |
public string quote_text( string $text, [ integer $quote, integer $buff_size, string $end_quote, string $begin_quote ] )
|
|
Wraps the text:
|
Parameter |
|
string |
$text |
|
|
Text to quote [necessary] |
|
|
integer |
$quote |
= >>1<< |
|
When set, $begin_quote is user. Set by default. |
|
|
integer |
$buff_size |
= >>70<< |
|
Size of the line in chars. 70 by default. |
|
|
string |
$end_quote |
= >>"\n"<< |
|
Chars to add at the end of the line. \n by default |
|
|
string |
$begin_quote |
= >>'> '<< |
|
Chars to add at the beginning of the line. '> ' by default. |
|
Returns |
string the wrapped text |
|
warn_referer |
public string warn_referer( )
|
|
Warns the user about the HTTP_REFERER http header.
|
Returns |
string the formated warning. |
|
debug |
public void debug( string $debugMsg )
|
|
Function to direct debugging output.
The output may be directed to stdout, a file or socket
depending on Config::debug and Config::debugFile
|
Parameter |
|
string |
$debugMsg |
|
|
the message to print |
|
Returns |
void |
|
debug_dump |
public string debug_dump( mixed $var, [ integer $level ] )
|
|
Traps a var_dump call and directs it to the selected debug output.
Warning: don't try it with recursive structures ($GLOBALS)
|
Parameter |
|
mixed |
$var |
|
|
the variable to dump |
|
|
integer |
$level |
= >>0<< |
|
used to dump in php3 |
|
Returns |
string $level if != 0 |
|
no_access_msg |
public string no_access_msg( )
|
|
Generates the No Access message
|
Returns |
string the no access string, to be printed out by the caller |
|