Sponsorenverwaltung - Team StarCraft e.V.
 All Data Structures Files Functions Variables
functions.php File Reference

Bundle of functions widely used in several scripts. More...

Go to the source code of this file.

Functions

 displayTemplateWithErrorsAndSuccesses ($title, $fileName)
 
 exitWithErrorTemplate ($errorTextArray=null)
 
 exitWithErrorTemplateAndRedirect ($errorTextArray=null, $url, $delay=2)
 
 exitWithSuccessTemplateAndRedirect ($successTextArray=null, $url, $delay=2)
 
 kdsort (&$arr, $colIdx, $dir=SORT_ASC)
 
 isValidEmail ($email)
 
 isValidMobile ($mobile)
 
 isValidPhone ($phone)
 
 prepareFilename ($fileName)
 
 addSchemeToURL ($url, $schemeToAdd= 'http://')
 

Variables

const TPL_ERRORS 'error.tpl'
 
const TPL_SUCCESSES 'nocontent.tpl'
 

Detailed Description

Bundle of functions widely used in several scripts.

The file provides a bundle of functions widely used in several scripts. This include several abstractions of smarty template commands as well as some general purpose filters and the specially designed kdsort-algorithm.

This file requires the global $smarty.

Version
1.0.0
Author
Daniel Seichter
Alexander Vorndran
Date
02.07.2013

Definition in file functions.php.

Function Documentation

addSchemeToURL (   $url,
  $schemeToAdd = 'http://' 
)

Adds the string http-scheme to an url if not exists

Parameters
string$urlurl to check and to add scheme
string$schemeToAdd
  • scheme to add in front of the url if not exists
  • Default: 'http://'
Returns
string valid url with scheme
Author
Daniel Seichter

Definition at line 247 of file functions.php.

displayTemplateWithErrorsAndSuccesses (   $title,
  $fileName 
)

Displays a template with error and success messages

Parameters
string$titletitle of the page assigned by template engine
string$fileNamefilename of the template to load and display
Author
Daniel Seichter

Definition at line 30 of file functions.php.

References $errors, $scriptDurationStartValue, $smarty, and $successes.

Referenced by exitWithErrorTemplate(), exitWithErrorTemplateAndRedirect(), and exitWithSuccessTemplateAndRedirect().

+ Here is the caller graph for this function:

exitWithErrorTemplate (   $errorTextArray = null)

Displays the error template with error messages and stop the execution

Parameters
array$errorTextArray[optional]
  • array of additional error messages
  • Default: null
Author
Daniel Seichter

Definition at line 59 of file functions.php.

References $errors, $smarty, displayTemplateWithErrorsAndSuccesses(), and TPL_ERRORS.

Referenced by fetchContactPersonsWithMailAdresses(), fetchMailAdresses(), fetchMailAdressesNewsletter(), fetchSponsorAddresses(), and fetchSponsorMailNewsletter().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

exitWithErrorTemplateAndRedirect (   $errorTextArray = null,
  $url,
  $delay = 2 
)

Displays the error template with error messages, stop the execution and redirect to a url

Parameters
array$errorTextArray[optional]
  • array of additional error messages
  • Default: null
string$urlurl to redirect
integer$delay[optional]
  • redirection delay in seconds
  • Default: 2
Author
Daniel Seichter

Definition at line 83 of file functions.php.

References $errors, $smarty, displayTemplateWithErrorsAndSuccesses(), and TPL_ERRORS.

+ Here is the call graph for this function:

exitWithSuccessTemplateAndRedirect (   $successTextArray = null,
  $url,
  $delay = 2 
)

Displays the success template with success messages, stop the execution and redirect to a url

Parameters
array$successTextArray[optional]
  • array of additional success messages
  • Default: null
string$urlurl to redirect
integer$delay[optional]
  • redirection delay in seconds
  • Default: 2
Author
Daniel Seichter

Definition at line 113 of file functions.php.

References $smarty, $successes, displayTemplateWithErrorsAndSuccesses(), and TPL_SUCCESSES.

+ Here is the call graph for this function:

isValidEmail (   $email)

Checks if an email is valid

Parameters
string$emailemail to check
Returns
boolean TRUE if it is valid else FALSE
Author
Alexandern Vorndran

Definition at line 181 of file functions.php.

isValidMobile (   $mobile)

Checks if a mobil number is valid

Parameters
string$mobilemobile number to check
Returns
boolean TRUE if the number is valid else FALSE
Author
Alexandern Vorndran

Definition at line 195 of file functions.php.

isValidPhone (   $phone)

Checks if a telephone number is valid

Parameters
string$phonethe phone number to check
Returns
boolean TRUE if it's valid else FALSE
Author
Alexandern Vorndran

Definition at line 213 of file functions.php.

kdsort ( $arr,
  $colIdx,
  $dir = SORT_ASC 
)

Sorts an two-dimensional array by a key in the second dimension

Parameters
array&$arrarray to sort the array will be sorted in place
integer$colIdxindex of the column in the second dimension to sort by
integer$dir[optional]
  • SORT_ASC: ascending order
  • SORT_DESC descending order
  • Default: SORT_ASC
Author
Daniel Seichter
Alexandern Vorndran
Returns
booloean FALSE if an error occured

Definition at line 144 of file functions.php.

Referenced by LoggedInUser\storeResult().

+ Here is the caller graph for this function:

prepareFilename (   $fileName)

Gets a valid filename by replacing some special chars

Parameters
string$fileNamefilename to prepare
Returns
string valid filename
Author
Daniel Seichter

Definition at line 230 of file functions.php.

Variable Documentation

const TPL_ERRORS 'error.tpl'

Definition at line 21 of file functions.php.

Referenced by exitWithErrorTemplate(), and exitWithErrorTemplateAndRedirect().

const TPL_SUCCESSES 'nocontent.tpl'

Definition at line 22 of file functions.php.

Referenced by exitWithSuccessTemplateAndRedirect().