Constants

SSL_NEVER

SSL_NEVER

SSL_ALWAYS

SSL_ALWAYS

SSL_AUTO

SSL_AUTO

SSL_ONLY_LOGIN

SSL_ONLY_LOGIN

Properties

$_bufferLevel

$_bufferLevel : integer

The current buffer level.

Type

integer

$_contentSent

$_contentSent : boolean

Has content been sent at the base buffer level?

Type

boolean

$_labels

$_labels : array

The labels already used in this page.

Type

array

$_noAccessKey

$_noAccessKey : boolean

Are accesskeys supported on this system.

Type

boolean

$_used

$_used : array

The access keys already used in this page.

Type

array

Methods

log()

log(  $event,   $priority = null, array  $options = array()) 

Shortcut to logging method.

Parameters

$event
$priority
array $options

logMessage()

logMessage(  $event,   $priority = null, array  $options = array()) 

Shortcut to logging method.

Parameters

$event
$priority
array $options

debug()

debug(mixed  $event = null, string  $fname = null, boolean  $backtrace = true) 

Debug method. Allows quick shortcut to produce debug output into a temporary file.

Parameters

mixed $event

Item to log.

string $fname

Filename to log to. If empty, logs to 'horde_debug.txt' in the PHP temporary directory.

boolean $backtrace

Include backtrace information?

signUrl()

signUrl(string|\Horde_Url  $url, integer  $now = null) : string|\Horde_Url

Adds a signature + timestamp to a URL and returns the signed URL.

Parameters

string|\Horde_Url $url

The URL to sign.

integer $now

The timestamp at which to sign. Leave blank for generating signatures; specify when testing.

Returns

string|\Horde_Url —

The signed URL.

verifySignedUrl()

verifySignedUrl(string  $data, integer  $now = null) : string|boolean

Verifies a signature and timestamp on a URL.

Parameters

string $data

The signed URL.

integer $now

The current time (can override for testing).

Returns

string|boolean —

The URL stripped off the signature, of false if not verified.

signQueryString()

signQueryString(mixed  $queryString, integer  $now = null) : mixed

Adds a signature + timestamp to a query string and returns the signed query string.

Parameters

mixed $queryString

The query string (or Horde_Url object) to sign.

integer $now

The timestamp at which to sign. Leave blank for generating signatures; specify when testing.

Returns

mixed —

The signed query string (or Horde_Url object).

verifySignedQueryString()

verifySignedQueryString(string  $data, integer  $now = null) : boolean

Verifies a signature and timestamp on a query string.

Parameters

string $data

The signed query string.

integer $now

The current time (can override for testing).

Returns

boolean —

Whether or not the string was valid.

escapeJson()

escapeJson(mixed  $data, array  $options = array()) : string

Do necessary escaping to output JSON.

Parameters

mixed $data

The data to JSON-ify.

array $options

Additional options:

  • nodelimit: (boolean) Don't add security delimiters? DEFAULT: false
  • urlencode: (boolean) URL encode the json string DEFAULT: false

Returns

string —

The escaped string.

isConnectionSecure()

isConnectionSecure() : boolean

Is the current HTTP connection considered secure?

Returns

boolean

requireSecureConnection()

requireSecureConnection() 

Throws an exception if not using a secure connection.

Throws

\Horde_Exception

getDriverConfig()

getDriverConfig(mixed  $backend, string  $type = 'sql') : array

Returns the driver parameters for the specified backend.

Parameters

mixed $backend

The backend system (e.g. 'prefs', 'categories', 'contacts') being used. The used configuration array will be $conf[$backend]. If an array gets passed, it will be $conf[$key1][$key2].

string $type

The type of driver. If null, will not merge with base config.

Returns

array —

The connection parameters.

assertDriverConfig()

assertDriverConfig(array  $params, string  $driver, array  $fields, string  $name = null, string  $file = 'conf.php', string  $variable = '$conf') 

Checks if all necessary parameters for a driver configuration are set and throws a fatal error with a detailed explanation how to fix this, if something is missing.

Parameters

array $params

The configuration array with all parameters.

string $driver

The key name (in the configuration array) of the driver.

array $fields

An array with mandatory parameter names for this driver.

string $name

The clear text name of the driver. If not specified, the application name will be used.

string $file

The configuration file that should contain these settings.

string $variable

The name of the configuration variable.

Throws

\Horde_Exception

url()

url(mixed  $uri, boolean  $full = false, mixed  $opts = array()) : \Horde_Url

Returns a session-id-ified version of $uri.

If a full URL is requested, all parameter separators get converted to "&", otherwise to "&".

Parameters

mixed $uri

The URI to be modified (either a string or any object with a __toString() function).

boolean $full

Generate a full (http://server/path/) URL.

mixed $opts

Additional options. If a string/integer, it is taken to be the 'append_session' option. If an array, one of the following:

  • app: (string) Use this app for the webroot. DEFAULT: current application
  • append_session: (integer) 0 = only if needed [DEFAULT], 1 = always, -1 = never.
  • force_ssl: (boolean) Ignore $conf['use_ssl'] and force creation of a SSL URL? DEFAULT: false

Returns

\Horde_Url —

The URL with the session id appended (if needed).

externalUrl()

externalUrl(string  $url, boolean  $tag = false) : string

Returns an external link passed through the dereferrer to strip session IDs from the referrer.

Parameters

string $url

The external URL to link to.

boolean $tag

If true, a complete tag is returned, only the url otherwise.

Returns

string —

The link to the dereferrer script.

link()

link(\Horde_Url|string  $url = '', string  $title = '', string  $class = '', string  $target = '', string  $onclick = '', string  $title2 = '', string  $accesskey = '', array  $attributes = array(), boolean  $escape = true) : string

Returns an anchor tag with the relevant parameters

Parameters

\Horde_Url|string $url

The full URL to be linked to.

string $title

The link title/description.

string $class

The CSS class of the link.

string $target

The window target to point to.

string $onclick

JavaScript action for the 'onclick' event.

string $title2

The link title (tooltip) (deprecated - just use $title).

string $accesskey

The access key to use.

array $attributes

Any other name/value pairs to add to the tag.

boolean $escape

Whether to escape special characters in the title attribute.

Returns

string —

The full tag.

linkTooltip()

linkTooltip(string  $url, string  $status = '', string  $class = '', string  $target = '', string  $onclick = '', string  $title = '', string  $accesskey = '', array  $attributes = array()) : string

Uses DOM Tooltips to display the 'title' attribute for link() calls.

Parameters

string $url

The full URL to be linked to

string $status

The JavaScript mouse-over string

string $class

The CSS class of the link

string $target

The window target to point to.

string $onclick

JavaScript action for the 'onclick' event.

string $title

The link title (tooltip). Most not contain HTML data other than <br>, which will be converted to a linebreak.

string $accesskey

The access key to use.

array $attributes

Any other name/value pairs to add to the <a> tag.

Returns

string —

The full tag.

widget()

widget(array  $params) : string

Returns an anchor sequence with the relevant parameters for a widget with accesskey and text.

Parameters

array $params

A hash with widget options (other options will be passed as attributes to the link tag):

  • url: (string) The full URL to be linked to.
  • title: (string) The link title/description.
  • nocheck: (boolean, optional) Don't check if the accesskey already already has been used. Defaults to false (= check).

Returns

string —

The full Title sequence.

selfUrl()

selfUrl(boolean  $script_params = false, boolean  $nocache = true, boolean  $full = false, boolean  $force_ssl = false) : \Horde_Url

Returns a session-id-ified version of $SCRIPT_NAME resp. $PHP_SELF.

Parameters

boolean $script_params

Include script parameters like QUERY_STRING and PATH_INFO? (Deprecated: use Horde::selfUrlParams() instead.)

boolean $nocache

Include a cache-buster parameter in the URL?

boolean $full

Return a full URL?

boolean $force_ssl

Ignore $conf['use_ssl'] and force creation of a SSL URL?

Returns

\Horde_Url —

The requested URL.

selfUrlParams()

selfUrlParams(array  $opts = array()) : \Horde_Url

Create a self URL of the current page, building the parameter list from the current Horde_Variables object (or via another Variables object passed as an optional argument) rather than the original request data.

Parameters

array $opts

Additional options:

  • force_ssl: (boolean) Force creation of an SSL URL? DEFAULT: false
  • full: (boolean) Return a full URL? DEFAULT: false
  • nocache: (boolean) Include a cache-buster parameter in the URL? DEFAULT: true
  • vars: (Horde_Variables) Use this Horde_Variables object instead of the Horde global object. DEFAULT: Use the Horde global object.

Returns

\Horde_Url —

The self URL.

getTempDir()

getTempDir() : string

Determines the location of the system temporary directory. If a specific configuration cannot be found, it defaults to /tmp.

Returns

string —

A directory name that can be used for temp files. Returns false if one could not be found.

getTempFile()

getTempFile(string  $prefix = 'Horde', boolean  $delete = true, string  $dir = '', boolean  $secure = false, boolean  $session_remove = false) : string

Creates a temporary filename for the lifetime of the script, and (optionally) registers it to be deleted at request shutdown.

Parameters

string $prefix

Prefix to make the temporary name more recognizable.

boolean $delete

Delete the file at the end of the request?

string $dir

Directory to create the temporary file in.

boolean $secure

If deleting file, should we securely delete the file?

boolean $session_remove

Delete this file when session is destroyed?

Returns

string —

Returns the full path-name to the temporary file or false if a temporary file could not be created.

webServerID()

webServerID() : string

Returns the Web server being used.

PHP string list built from the PHP 'configure' script.

Returns

string —

A web server identification string.

getAccessKey()

getAccessKey(string  $label, boolean  $nocheck = false, boolean  $shutdown = false) : string

Returns an un-used access key from the label given.

Parameters

string $label

The label to choose an access key from.

boolean $nocheck

Don't check if the access key already has been used?

boolean $shutdown

Is this called as a shutdown function?

Returns

string —

A single lower case character access key, or an empty string if no key can be found.

stripAccessKey()

stripAccessKey(string  $label) : string

Strips an access key from a label.

For multibyte charset strings the access key gets removed completely, otherwise only the underscore gets removed.

Parameters

string $label

The label containing an access key.

Returns

string —

The label with the access key being stripped.

highlightAccessKey()

highlightAccessKey(string  $label, string  $accessKey) : string

Highlights an access key in a label.

Parameters

string $label

The label to highlight the access key in.

string $accessKey

The access key to highlight.

Returns

string —

The HTML version of the label with the access key highlighted.

getAccessKeyAndTitle()

getAccessKeyAndTitle(string  $label, boolean  $nocheck = false, boolean  $return_array = false) : string

Returns the appropriate "accesskey" and "title" attributes for an HTML tag and the given label.

Parameters

string $label

The title of an HTML element

boolean $nocheck

Don't check if the access key already has been used?

boolean $return_array

Return attributes as a hash?

Returns

string —

The title, and if appropriate, the accesskey attributes for the element.

label()

label(string  $for, string  $label, string  $ak = null) : string

Returns a label element including an access key for usage in conjuction with a form field. User preferences regarding access keys are respected.

Parameters

string $for

The form field's id attribute.

string $label

The label text.

string $ak

The access key to use. If null a new access key will be generated.

Returns

string —

The html code for the label element.

wrapInlineScript()

wrapInlineScript(array  $script) : string

Print inline javascript to output buffer after wrapping with necessary javascript tags.

Parameters

array $script

The script to output.

Returns

string —

The script with the necessary HTML javascript tags appended.

getCacheUrl()

getCacheUrl(string  $type, array  $params = array()) : \Horde_Url

Creates a URL for cached data.

Parameters

string $type

The cache type ('app', 'css', 'js').

array $params

Optional parameters:

  • app: REQUIRED for $type == 'app'. Identifies the application to call the 'cacheOutput' API call, which is passed in the value of the entire $params array (which may include parameters other than those listed here). The return from cacheOutput should be a 2-element array: 'data' (the cached data) and 'type' (the content-type of the data).
  • cid: REQUIRED for $type == 'css' || 'js'. The cacheid of the data (stored in Horde_Cache).
  • nocache: If true, sets the cache limiter to 'nocache' instead of the default 'public'.

Returns

\Horde_Url —

The URL to the cache page.

popupJs()

popupJs(string|\Horde_Url  $url, array  $options = array()) : string

Output the javascript needed to call the popup JS function.

Parameters

string|\Horde_Url $url

The page to load.

array $options

Additional options:

  • height: (integer) The height of the popup window. DEFAULT: 650px
  • menu: (boolean) Show the browser menu in the popup window? DEFAULT: false
  • onload: (string) A JS function to call after the popup window is fully loaded. DEFAULT: None
  • params: (array) Additional parameters to pass to the URL. DEFAULT: None
  • urlencode: (boolean) URL encode the json string? DEFAULT: false
  • width: (integer) The width of the popup window. DEFAULT: 700 px

Returns

string —

The javascript needed to call the popup code.

startBuffer()

startBuffer() 

Start buffering output.

endBuffer()

endBuffer() : string

End buffering output.

Returns

string —

The buffered output.

contentSent()

contentSent() : boolean

Has any content been sent to the browser?

Returns

boolean —

True if content has been sent.

sidebar()

sidebar(string  $app = null) : \Horve_View_Sidebar

Returns the sidebar for the current application.

Parameters

string $app

The application to generate the menu for. Defaults to the current app.

Returns

\Horve_View_Sidebar —

The sidebar.

permissionDeniedError()

permissionDeniedError(string  $app, string  $perm, string  $error = null) 

Process a permission denied error, running a user-defined hook if necessary.

Parameters

string $app

Application name.

string $perm

Permission name.

string $error

An error message to output via the notification system.

__callStatic()

__callStatic(  $name,   $arguments) 

Handle deprecated methods (located in Horde_Deprecated).

Parameters

$name
$arguments