SWATFunctions Class Reference

An abstract class containing a number of commonly used web app functions. More...

List of all members.

Public Member Functions

 formatTimestamp ($timestamp)
 Format a UNIX timestamp into English.
 getURI ()
 Get the URI of the current script.
 getURINoArgs ()
 Get the URI for the current script, without arguments.
 redirect ($url)
 Redirect to a new URL.
 redirectHTTPS ($req="")
 Redirect to a HTTPS version of a URL, or of the current page.
 removeSpace ($a)
 Remove the spaces from a string.
 safeSql ($a)
 Make input safe to be submitted to an SQL server (new version).
 safeSqlOld ($a, $ignoreBackslash=false)
 Make input safe to be submitted to an SQL server (old version).
 stripArgs ($uri)
 Strip the arguments from a URL.


Detailed Description

An abstract class containing a number of commonly used web app functions.

Author:
Jonathan (jwsm@shodor.org)

Joel (jfeiner@shodor.org)

Date:
'06-'07

Member Function Documentation

SWATFunctions::formatTimestamp ( timestamp  ) 

Format a UNIX timestamp into English.

Parameters:
$timestamp [string]: The timestamp to format
Returns:
[string]: An english version of the time, described as "Today" or "days/months ago"

SWATFunctions::getURI (  ) 

Get the URI of the current script.

Returns:
[string]: The current URI

SWATFunctions::getURINoArgs (  ) 

Get the URI for the current script, without arguments.

Returns:
[string]: The current URI without arguments

SWATFunctions::redirect ( url  ) 

Redirect to a new URL.

Parameters:
$url [string]: The destination URL
Make sure that all data is synched to the session, then write out a location header that redirects the page to the destination URL.

SWATFunctions::redirectHTTPS ( req = ""  ) 

Redirect to a HTTPS version of a URL, or of the current page.

Parameters:
$req [string]: (optional) Destination URL. If none is set, the current URI is used
Generate a version of the URL with a leading https://server, and redirect to that URL. This is generally used when a site needs to bounce a user to a secure login page.

SWATFunctions::removeSpace ( a  ) 

Remove the spaces from a string.

Parameters:
$a [string]: Input text
Returns:
[string]: The string without spaces

SWATFunctions::safeSql ( a  ) 

Make input safe to be submitted to an SQL server (new version).

Parameters:
$a [string]: Input text
Returns:
[string]: The processed string
Peform limited SQL injection detection, remove/escape offending characters. Does much less than safeSqlOld(), so as not to remove relevant characters.

SWATFunctions::safeSqlOld ( a,
ignoreBackslash = false 
)

Make input safe to be submitted to an SQL server (old version).

Parameters:
$a [string]: Input text
$ignoreBackslash [bool]:
Returns:
[string]: The processed string
Peform limited SQL injection detection, remove/escape offending characters.

SWATFunctions::stripArgs ( uri  ) 

Strip the arguments from a URL.

Parameters:
$uri [string]: Input URL/URI
Returns:
[string]: The URL to the left of the "?", if one exists


The documentation for this class was generated from the following file:

Generated on Wed Nov 24 02:04:00 2010 for Common by  doxygen 1.5.6