strings.php
This code provides various string manipulation functions that are used by the rest of the SquirrelMail code.
There can be a circular issue with includes, where the $version string is referenced by the include of global.php, etc. before it's defined.
For that reason, bring in global.php AFTER we define the version strings.
Generates a random string from the caracter set you pass in
get_location
Determines the location to forward to, relative to your server. This is used in HTTP Location: redirects. If set, it uses $config_location_base as the first part of the URL, specifically, the protocol, hostname and port parts. The path is always autodetected.
Create compose link
Returns a link to the compose-page, taking in consideration the compose_in_new and javascript settings.
Creates encryption key
Creates an encryption key for encrypting the password stored in the cookie. The encryption key itself is stored in the session.
Decrypts a password from the cookie
Decrypts a password from the cookie, encrypted by OneTimePadEncrypt. This uses the encryption key that is stored in the session.
Encrypts password
These functions are used to encrypt the password before it is stored in a cookie. The encryption key is generated by OneTimePadCreate();
php_self
Creates an URL for the page calling this function, using either the PHP global REQUEST_URI, or the PHP global PHP_SELF with QUERY_STRING added.
Escapes special characters for use in IMAP commands.
If $haystack is a full mailbox name and $needle is the mailbox separator character, returns the last part of the mailbox name.
Removes slashes from every element in the array
Returns a string showing the size of the message/attachment.
Print variable
sm_print_r($some_variable, [$some_other_variable [, ...]]);
Debugging function - does the same as print_r, but makes sure special characters are converted to htmlentities first. This will allow values like <[email protected]> to be displayed. The output is wrapped in <pre> and </pre> tags.
Find out where squirrelmail lives and try to be smart about it.
The only problem would be when squirrelmail lives in directories called "src", "functions", or "plugins", but people who do that need to be beaten with a steel pipe anyway.
Wraps text at $wrap characters
Has a problem with special HTML characters, so call this before you do character translation.
Specifically, ' comes up as 5 characters instead of 1. This should not add newlines to the end of lines.
version of fwrite which checks for failure
Tests if string contains 8bit symbols.
If charset is not set, function defaults to default_charset. $default_charset global must be set correctly if $charset is not used.
Callback function used to lowercase array values.
Replacement of mb_list_encodings function
This function provides replacement for function that is available only in php 5.x. Function does not test all mbstring encodings. Only the ones that might be used in SM translations.
Supported strings are stored in session in order to reduce number of mb_internal_encoding function calls.
If mb_list_encodings() function is present, code uses it. Main difference from original function behaviour - array values are lowercased in order to simplify use of returned array in in_array() checks.
If you want to test all mbstring encodings - fill $list_of_encodings array.
Init random number generator
This function initializes the random number generator fairly well. It also only initializes it once, so you don't accidentally get the same 'random' numbers twice in one session.
Randomizes the mt_rand() function.
Toss this in strings or integers and it will seed the generator appropriately. With strings, it is better to get them long. Use md5() to lengthen smaller strings.
Function returns number of characters in string.
Returned number might be different from number of bytes in string, if $charset is multibyte charset. Detection depends on mbstring functions. If mbstring does not support tested multibyte charset, vanilla string length function is used.
Callback function to trim whitespace from a value, to be used in array_walk
Trims array
Trims every element in the array, ie. remove the first char of each element Obsolete: will probably removed soon
Truncates a string and take care of html encoded characters
Documentation generated on Sat, 07 Oct 2006 16:33:51 +0300 by phpDocumentor 1.3.0RC6