Utility functions of a general nature which are used by most AWL library classes.
Return the AWL version
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.
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.
Function to dump an array to the error log, possibly recursively
Get the names of the fields for a particular table
Try and extract something like "Pacific/Auckland" or "America/Indiana/Indianapolis" if possible.
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.
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.
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.
Make a salted MD5 string, given a string and (possibly) a salt.
If no salt is supplied we will generate a random one.
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.
Make a plain MD5 hash of a string, identifying the type of hash it is
Checks what a user entered against the actual password on their account.
Not as sever as a fatal() call, but we want to log and trace it
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 Wed, 04 Jul 2012 07:06:12 +0000 by phpDocumentor 1.4.3