/AWLUtilities.phpUtility functions of a general nature which are used by most AWL library classes.
require
("Translation.php")
(line 367)
awl_version (line 675)
Return the AWL version
check_by_regex (line 397)
Verify a value is OK by testing a regex against it. If it is an array apply it to each element in the array recursively. If it is an object we don't mess with it.
dbg_error_log (line 27)
Writes a debug message into the error log using printf syntax. If the first parameter is "ERROR" then the message will _always_ be logged.
Otherwise, the first parameter is a "component" name, and will only be logged if $c->dbg["component"] is set to some non-null value.
If you want to see every log message then $c->dbg["ALL"] can be set, to override the debugging status of the individual components.
dbg_log_array (line 151)
Function to dump an array to the error log, possibly recursively
define_byte_mappings (line 498)
deprecated (line 623)
fatal (line 58)
force_utf8 (line 550)
get_fields (line 477)
Get the names of the fields for a particular table
gzdecode (line 639)
olson_from_tzstring (line 584)
Try and extract something like "Pacific/Auckland" or "America/Indiana/Indianapolis" if possible.
param_to_global (line 431)
Convert a parameter to a global. We first look in _POST and then in _GET, and if they passed in a bunch of valid characters, we will make sure the incoming is cleaned to only match that set.
quoted_printable_encode (line 385)
Process a string to fit the requirements of RFC2045 section 6.7. Note that this works, but replaces more characters than the minimum set. For readability the spaces aren't encoded as =20 though.
replace_uri_params (line 296)
Given a URL (presumably the current one) and a parameter, replace the value of parameter, extending the URL as necessary if the parameter is not already there.
session_salted_md5 (line 194)
Make a salted MD5 string, given a string and (possibly) a salt.
If no salt is supplied we will generate a random one.
session_salted_sha1 (line 218)
Make a salted SHA1 string, given a string and (possibly) a salt. PHP5 only (although it could be made to work on PHP4 (@see http://www.openldap.org/faq/data/cache/347.html). The algorithm used here is compatible with OpenLDAP so passwords generated through this function should be able to be migrated to OpenLDAP by using the part following the second '*', i.e.
the '{SSHA}....' part.
If no salt is supplied we will generate a random one.
session_simple_md5 (line 175)
Make a plain MD5 hash of a string, identifying the type of hash it is
session_validate_password (line 234)
Checks what a user entered against the actual password on their account.
trace_bug (line 93)
Not as sever as a fatal() call, but we want to log and trace it
uuid (line 349)
Generates a Universally Unique IDentifier, version 4.
RFC 4122 (http://www.ietf.org/rfc/rfc4122.txt) defines a special type of Globally Unique IDentifiers (GUID), as well as several methods for producing them. One such method, described in section 4.4, is based on truly random or pseudo-random number generators, and is therefore implementable in a language like PHP.
We choose to produce pseudo-random numbers with the Mersenne Twister, and to always limit single generated numbers to 16 bits (ie. the decimal value 65535). That is because, even on 32-bit systems, PHP's RAND_MAX will often be the maximum *signed* value, with only the equivalent of 31 significant bits. Producing two 16-bit random numbers to make up a 32-bit one is less efficient, but guarantees that all 32 bits are random.
The algorithm for version 4 UUIDs (ie. those based on random number generators) states that all 128 bits separated into the various fields (32 bits, 16 bits, 16 bits, 8 bits and 8 bits, 48 bits) should be random, except : (a) the version number should be the last 4 bits in the 3rd field, and (b) bits 6 and 7 of the 4th field should be 01. We try to conform to that definition as efficiently as possible, generating smaller values where possible, and minimizing the number of base conversions.
Documentation generated on Fri, 13 Jan 2012 23:40:13 +1300 by phpDocumentor 1.4.3