Classes | Functions
comdef_utilityclasses.inc.php File Reference

Some basic utility classes and functions to be used throughout the CoMDEF system. More...

Classes

class  bdfProfiler
 Execution time/memory profiling class. More...

Functions

 SplitIntoMetaphone ($in_string, $in_lang_enum=null, $in_literal=false)
 Converts a string into an array of metaphone entities.
 FullCrypt ($in_string, $in_salt=null, &$crypt_method=null)
 Encrypts a string, using the most effective encryption.
 json_prepare ($data, $escapeSpecialChars=false)
 This function accepts an array of data (or a single element), and "cleans it up" in preparation for use as a JSON string.
 call_curl ($in_uri, $in_post=true, &$http_status=null)
 This is a function that returns the results of an HTTP call to a URI. It is a lot more secure than file_get_contents, but does the same thing.
 c_comdef_admin_bar ($in_http_vars)
 Returns the HTML for an "Admin Bar" along the top of the page.
 c_comdef_htmlspecialchars ($in_string)
 This function creates a displayable string.
 c_comdef_vet_email_address ($in_address)
 This function vets the email address for proper form.
 c_comdef_LogoutUser ()
 This function can be called to terminate the session.

Detailed Description

Some basic utility classes and functions to be used throughout the CoMDEF system.

These classes and functions describe some basic functionality that is used throughout the system.


Function Documentation

c_comdef_admin_bar ( in_http_vars)

Returns the HTML for an "Admin Bar" along the top of the page.

Returns:
the HTML for the bar.
Parameters:
in_http_varsThe aggregation of the $_GET and $_POST superglobals, as an associative array.
c_comdef_htmlspecialchars ( in_string)
c_comdef_LogoutUser ( )

This function can be called to terminate the session.

c_comdef_vet_email_address ( in_address)

This function vets the email address for proper form.

Returns:
true if the email address has a valid format.
call_curl ( in_uri,
in_post = true,
&$  http_status = null 
)

This is a function that returns the results of an HTTP call to a URI. It is a lot more secure than file_get_contents, but does the same thing.

Returns:
a string, containing the response. Null if the call fails to get any data.
Exceptions:
anexception if the call fails.
Parameters:
in_uriA string. The URI to call.
in_postIf false, the transaction is a GET, not a POST. Default is true.
http_statusOptional reference to a string. Returns the HTTP call status.

Referenced by GetGeocodeFromString().

FullCrypt ( in_string,
in_salt = null,
&$  crypt_method = null 
)

Encrypts a string, using the most effective encryption.

This function will encrypt a string, using the standard PHP crypt() function, and, if asked, will use the most secure algorithm available on the server. This is a one-way encryption.

NOTE: If you use this in "secure" mode (other than CRYPT_DES), it may deliver passwords in a format that cannot be ported to other servers.

Returns:
a string, which is the given string, encrypted. Use this to compare with other strings, or as a salt for future encryptions.
Parameters:
in_stringThe string to be encrypted
in_saltThis is the original password, in encrypted form (used as a salt). If this is provided, the $crypt_method parameter is ignored..
crypt_methodOptional. If provided, the encryption constant will be returned. If the crypt method is requested, this should be set to true. The value will be replaced by the constant for the method used.

Values:

  • 'CRYPT_BLOWFISH' Use CRYPT_BLOWFISH (If available)
  • 'CRYPT_MD5' Use CRYPT_MD5 (If available)
  • 'CRYPT_EXT_DES' Use CRYPT_EXT_DES (If available)
  • 'CRYPT_DES' Use the default DES algorithm
  • true Use the maximum possible algorithm.
  • null (or not provided) Use CRYPT_DES, or the provided salt.

NOTE: If you provide a specific value, and the server cannot provide it, CRYPT_DES will be used.

Referenced by c_comdef_server::AddNewUser(), c_comdef_users::GetEncryptedPW(), c_comdef_user::IsUser(), c_comdef_user::SetNewPassword(), and SetPageFive().

json_prepare ( data,
escapeSpecialChars = false 
)

This function accepts an array of data (or a single element), and "cleans it up" in preparation for use as a JSON string.

Returns:
a string, containing the "cleaned" array

Referenced by ApplyDataItem(), DeleteMeetings(), DuplicateMeetings(), and UnpublishMeetings().

SplitIntoMetaphone ( in_string,
in_lang_enum = null,
in_literal = false 
)

Converts a string into an array of metaphone entities.

This breaks up the given string into metaphone keys, and returns them in an array, so they can be easily compared.

http://us2.php.net/manual/en/function.metaphone.php

Returns:
An associative array of metaphone keys. Null if none given. The value will be the metaphone key, and the key will be the original string, converted to lowercase.

If no language is given, we use the server's native language.

We use the metaphone as the array value. The string is the key. This also makes it a bit more efficient if a repeated string is provided.

We also have a Spanish version of metaphone() available.

Parameters:
in_stringThe string to split up.
in_lang_enumThis is the code for the desired language. If not given, the server localization will be used.
in_literalIf this is set to true (default is false), then metaphone will not be used.

Referenced by c_comdef_formats::GetFormatsByString(), c_comdef_meetings::GetMeetingsByKeyValue(), and c_comdef_meetings::GetMeetingsByString().

 All Classes Files Functions Variables Enumerations