/AWLUtilities.phpUtility functions of a general nature which are used by most AWL library classes.
require_once
("Translation.php")
(line 271)
apache_request_headers (line 63)
Forward compatibility so we can use the non-deprecated name in PHP4
clean_by_regex (line 301)
Clean a value by applying a regex to 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 79)
Function to dump an array to the error log, possibly recursively
define_byte_mappings (line 405)
force_utf8 (line 457)
get_fields (line 382)
Get the names of the fields for a particular table
param_to_global (line 335)
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 289)
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 200)
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 106)
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 129)
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_validate_password (line 144)
Checks what a user entered against the actual password on their account.
uuid (line 253)
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 Tue, 06 Oct 2009 09:31:43 -0700 by phpDocumentor 1.3.2