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

Definition at line 9 of file SWATFunctions.php5.


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"

Definition at line 156 of file SWATFunctions.php5.

SWATFunctions::getURI (  ) 

Get the URI of the current script.

Returns:
[string]: The current URI

Definition at line 125 of file SWATFunctions.php5.

SWATFunctions::getURINoArgs (  ) 

Get the URI for the current script, without arguments.

Returns:
[string]: The current URI without arguments

Definition at line 133 of file SWATFunctions.php5.

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.

Definition at line 76 of file SWATFunctions.php5.

References STimer::enable().

Referenced by TKSnapEditor::__construct(), and PageRender2::flashAndRedirect().

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.

Definition at line 97 of file SWATFunctions.php5.

References STimer::enable().

SWATFunctions::removeSpace ( a  ) 

Remove the spaces from a string.

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

Definition at line 146 of file SWATFunctions.php5.

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.

Definition at line 58 of file SWATFunctions.php5.

Referenced by SSucceedAuthModule::authenticate(), SSigmaxiAuthModule::authenticate(), SNcsiAuthModule::authenticate(), SCserdAuthModule::authenticate(), SModel::commit(), and SModel::commitForeign().

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.

Definition at line 23 of file SWATFunctions.php5.

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

Definition at line 116 of file SWATFunctions.php5.

Referenced by STransNSDLSearchXML::addHeaderFooter(), and STransNSDLSearchXML::buildCWISURL().


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

Generated on Wed Nov 24 02:06:49 2010 for Common by  doxygen 1.5.6