Documentation

Horde_Registry
in package
implements Horde_Shutdown_Task

The registry provides a set of methods for communication between Horde applications and keeping track of application configuration information.

Tags
author

Chuck Hagenbuch chuck@horde.org

author

Jon Parise jon@horde.org

author

Anil Madhavapeddy anil@recoil.org

author

Michael Slusarz slusarz@horde.org

category

Horde

copyright

1999-2017 Horde LLC

license

http://www.horde.org/licenses/lgpl21 LGPL 2.1

Table of Contents

Interfaces

Horde_Shutdown_Task
Interface to enable a class to implement a shutdown task.

Constants

AUTH_FAILURE  = 1
HOOK_FATAL  = 4
INITCALLBACK_FATAL  = 5
NOT_ACTIVE  = 2
PERMISSION_DENIED  = 3
REGISTRY_CACHE  = 'registry_cache'
SESSION_NONE  = 1
SESSION_READONLY  = 2
VIEW_BASIC  = 1
VIEW_DYNAMIC  = 2
VIEW_MINIMAL  = 3
VIEW_SMARTMOBILE  = 4

Properties

$applications  : array<string|int, mixed>
Hash storing information on each registry-aware application.
$authException  : Exception
Original authentication exception. Set if 'fallback' auth is used, and authentication fails.
$hordeInit  : bool
A flag that is set once the basic horde application has been minimally configured.
$initialApp  : string
The application that called appInit().
$nlsconfig  : Horde_Registry_Nlsconfig
NLS configuration.
$vhost  : string
The current virtual host configuration file.
$_apiList  : array<string|int, mixed>
The list of APIs.
$_appsInit  : array<string|int, mixed>
The list of applications initialized during this access.
$_appStack  : array<string|int, mixed>
Stack of in-use applications.
$_args  : array<string|int, mixed>
The arguments that have been passed when instantiating the registry.
$_cache  : array<string|int, mixed>
Internal cached data.
$_interfaces  : array<string|int, mixed>
Interfaces list.
$_regmtime  : int
The last modified time of the newest modified registry file.

Methods

__clone()  : mixed
Clone should never be called on this object. If it is, die.
__construct()  : mixed
Create a new Horde_Registry instance.
__get()  : mixed
A property call to the registry object will return a Caller object.
__sleep()  : mixed
serialize() should never be called on this object. If it is, die.
appInit()  : Horde_Registry_Application
Application bootstrap initialization.
applicationFilePath()  : string
Replace any %application% strings with the filesystem path to the application.
applicationWebPath()  : string
Replace any %application% strings with the web path to the application.
call()  : mixed
Return the hook corresponding to the default package that provides the functionality requested by the $method parameter.
callAppMethod()  : mixed
Call a private Horde application method.
callByPackage()  : mixed
Output the hook corresponding to the specific package named.
checkExistingAuth()  : bool
Check existing auth for triggers that might invalidate it.
clearAuth()  : mixed
Clears any authentication tokens in the current session.
clearAuthApp()  : bool
Clears authentication tokens for a given application in the current session.
convertUsername()  : string
Converts an authentication username to a unique Horde username.
currentProcessAuth()  : bool
Checks whether this process required authentication.
downloadUrl()  : Horde_Url
Returns a URL to be used for downloading data.
get()  : string
Return the requested configuration parameter for the specified application. If no application is specified, the value of the current application is used. However, if the parameter is not present for that application, the Horde-wide value is used instead.
getApiInstance()  : Horde_Registry_Api|Horde_Registry_Application
Retrieve an API object.
getApp()  : string
Return the current application - the app at the top of the application stack.
getAppDrivers()  : array<string|int, mixed>
Returns a list of available drivers for a library that are available in an application.
getAuth()  : mixed
Returns the currently logged in user, if there is one.
getAuthApps()  : array<string|int, mixed>
Returns the list of applications currently authenticated to.
getAuthCredential()  : mixed
Returns the requested credential for the currently logged in user, if present.
getAuthInfo()  : array<string|int, mixed>
Returns authentication metadata information.
getEmailCharset()  : string
Returns the charset to use for outgoing emails.
getInitialPage()  : string
Query the initial page for an application - the webroot, if there is no initial_page set, and the initial_page, if it is set.
getLanguageCharset()  : string
Returns the charset for the current language.
getLogoutUrl()  : Horde_Url
Returns a URL to the login screen, adding the necessary logout parameters.
getServiceLink()  : Horde_Url
Returns the URL to access a Horde service.
getVersion()  : string
Return the version string for a given application.
getView()  : int
Get current view.
hasFeature()  : bool
Does the application have the queried feature?
hasInterface()  : mixed
Determine if an interface is implemented by an active application.
hasLink()  : mixed
Determine if a link has been registered with the registry.
hasMethod()  : mixed
Determine if a method has been registered with the registry.
hasPermission()  : bool
Check permissions on an application.
hasView()  : bool
Does the given application have the queried view?
importConfig()  : mixed
Reads the configuration values for the given application and imports them into the global $conf variable.
isAdmin()  : bool
Is a user an administrator?
isAuthenticated()  : bool
Checks if there is a session with valid auth information. If there isn't, but the configured Auth driver supports transparent authentication, then we try that.
isInactive()  : bool
Is the given application inactive?
isTest()  : bool
Is the registry in 'test' mode?
link()  : string
Returns the link corresponding to the default package that provides the functionality requested by the $method parameter.
linkByPackage()  : string
Returns the link corresponding to the specific package named.
listAllApps()  : array<string|int, mixed>
Return a list of all applications, ignoring permissions.
listAPIs()  : array<string|int, mixed>
Returns all available registry APIs.
listApps()  : array<string|int, mixed>
Return a list of the installed and registered applications.
listMethods()  : array<string|int, mixed>
Returns all of the available registry methods, or alternately only those for a specified API.
loadConfigFile()  : Horde_Registry_Loadconfig
Load a configuration file from a Horde application's config directory.
loadPrefs()  : mixed
Loads the preferences for the current user for the current application and imports them into the global $prefs variable.
passwordChangeRequested()  : bool
Return whether the authentication backend requested a password change.
popApp()  : string
Remove the current app from the application stack, setting the current app to whichever app was current before this one took over.
preferredLang()  : string
Selects the most preferred language for the current client session.
pushApp()  : bool
Set the current application, adding it to the top of the Horde application stack. If this is the first application to be pushed, retrieve session information as well.
rebuild()  : mixed
Rebuild the registry configuration.
remoteHost()  : object
Returns information about the remote host.
removeUser()  : mixed
Removes a user from the authentication backend and calls all applications' removeUserData API methods.
removeUserData()  : mixed
Removes user's application data.
setAuth()  : mixed
Sets data in the session saying that authorization has succeeded, note which userId was authorized, and note when the login took place.
setAuthCredential()  : mixed
Sets the requested credential for the currently logged in user.
setAuthenticationSetting()  : mixed
(Re)set the authentication parameter. Useful for requests, such as Rpc requests where we actually don't perform authentication until later in the request, but still need Horde bootstrapped early in the request. Also clears the local app/api cache since applications will probably already have been initialized during Notification polling.
setLanguage()  : string
Sets the language.
setLanguageEnvironment()  : mixed
Sets the language and reloads the whole NLS environment.
setTextdomain()  : mixed
Sets the gettext domain.
setTimeZone()  : mixed
Sets the current timezone, if available.
setView()  : mixed
Set current view.
showService()  : bool
TODO
shutdown()  : mixed
Events to do on shutdown.
_cacheId()  : mixed
Get the cache ID for the registry information.
_doHasSearch()  : mixed
Do the has*() search.
_getAuthCredentials()  : mixed
Get the list of credentials for a given app.
_loadApi()  : Horde_Registry_Api
Load an application's API object.
_loadApplications()  : mixed
Load application information from registry config files.
_mapLang()  : string
Maps languages with common two-letter codes (such as nl) to the full locale code (in this case, nl_NL). Returns the language unmodified if it isn't an alias.
_methodLookup()  : mixed
Do a lookup of method name -> app call.
_pushAppError()  : mixed
Process Exceptions thrown when pushing app on stack.

Constants

AUTH_FAILURE

public mixed AUTH_FAILURE = 1

INITCALLBACK_FATAL

public mixed INITCALLBACK_FATAL = 5

PERMISSION_DENIED

public mixed PERMISSION_DENIED = 3

REGISTRY_CACHE

public mixed REGISTRY_CACHE = 'registry_cache'

SESSION_NONE

public mixed SESSION_NONE = 1

SESSION_READONLY

public mixed SESSION_READONLY = 2

VIEW_DYNAMIC

public mixed VIEW_DYNAMIC = 2

VIEW_MINIMAL

public mixed VIEW_MINIMAL = 3

VIEW_SMARTMOBILE

public mixed VIEW_SMARTMOBILE = 4

Properties

$applications

Hash storing information on each registry-aware application.

public array<string|int, mixed> $applications = array()

$authException

Original authentication exception. Set if 'fallback' auth is used, and authentication fails.

public Exception $authException
Tags
since
2.11.0
todo

Fix this up for H6 (framework needs to do better job of supporting bootstrapping before authentication).

$hordeInit

A flag that is set once the basic horde application has been minimally configured.

public bool $hordeInit = \false

$initialApp

The application that called appInit().

public string $initialApp

$vhost

The current virtual host configuration file.

public string $vhost = \null
Tags
since
2.12.0

$_apiList

The list of APIs.

protected array<string|int, mixed> $_apiList = array()

$_appsInit

The list of applications initialized during this access.

protected array<string|int, mixed> $_appsInit = array()

$_appStack

Stack of in-use applications.

protected array<string|int, mixed> $_appStack = array()

$_args

The arguments that have been passed when instantiating the registry.

protected array<string|int, mixed> $_args = array()

$_cache

Internal cached data.

protected array<string|int, mixed> $_cache = array('auth' => \null, 'cfile' => array(), 'conf' => array(), 'existing' => array(), 'ob' => array())

$_interfaces

Interfaces list.

protected array<string|int, mixed> $_interfaces = array()

$_regmtime

The last modified time of the newest modified registry file.

protected int $_regmtime

Methods

__clone()

Clone should never be called on this object. If it is, die.

public __clone() : mixed
Tags
throws
Horde_Exception

__construct()

Create a new Horde_Registry instance.

public __construct([int $session_flags = 0 ][, array<string|int, mixed> $args = array() ]) : mixed
Parameters
$session_flags : int = 0

Any session flags.

$args : array<string|int, mixed> = array()

See appInit().

Tags
throws
Horde_Exception

__get()

A property call to the registry object will return a Caller object.

public __get(mixed $api) : mixed
Parameters
$api : mixed

__sleep()

serialize() should never be called on this object. If it is, die.

public __sleep() : mixed
Tags
throws
Horde_Exception

appInit()

Application bootstrap initialization.

public static appInit(string $app[, array<string|int, mixed> $args = array() ]) : Horde_Registry_Application

Solves chicken-and-egg problem - need a way to init Horde environment from application without an active Horde_Registry object.

Page compression will be started (if configured).

Global variables defined:

  - $browser: Horde_Browser object
  - $cli: Horde_Cli object (if 'cli' is true)
  - $conf: Configuration array
  - $injector: Horde_Injector object
  - $language: Language
  - $notification: Horde_Notification object
  - $page_output: Horde_PageOutput object
  - $prefs: Horde_Prefs object
  - $registry: Horde_Registry object
  - $session: Horde_Session object
Parameters
$app : string

The application to initialize.

$args : array<string|int, mixed> = array()

Optional arguments:

  - admin: (boolean) Require authenticated user to be an admin?
           DEFAULT: false
  - authentication: (string) The type of authentication to use:
    - none: Do not authenticate
    - fallback: Attempt to authenticate; if failure, then don't auth
                (@since 2.11.0).
    - [DEFAULT]: Authenticate; on no auth redirect to login screen
  - cli: (boolean) Initialize a CLI interface. Setting this to true
         implicitly sets 'authentication' to 'none' and 'admin' and
         'nocompress' to true.
         DEFAULT: false
  - nocompress: (boolean) If set, the page will not be compressed.
                DEFAULT: false
  - nologintasks: (boolean) If set, don't perform logintasks (never
                  performed if authentication is 'none').
                  DEFAULT: false
  - nonotificationinit: (boolean) If set, don't initialize the
                        application handlers for the notification
                        system (@since 2.12.0).
  - permission: (array) The permission required by the user to access
                the page. The first element (REQUIRED) is the permission
                name. The second element (OPTION; defaults to SHOW) is
                the permission level.
  - session_cache_limiter: (string) Use this value for the session
                           cache limiter.
                           DEFAULT: Uses the value in the config.
  - session_control: (string) Special session control limitations:
    - netscape: TODO; start read/write session
    - none: Do not start a session
    - readonly: Start session readonly
    - [DEFAULT] - Start read/write session
  - test: (boolean) Is this the test script? If so, we relax several
          sanity checks and don't load things from the cache.
          DEFAULT: false
  - timezone: (boolean) Set the time zone?
              DEFAULT: false
  - user_admin: (boolean) Set authentication to an admin user?
                DEFAULT: false
Tags
throws
Horde_Exception
Return values
Horde_Registry_Application

The application object.

applicationFilePath()

Replace any %application% strings with the filesystem path to the application.

public applicationFilePath(string $path[, string $app = null ]) : string
Parameters
$path : string

The application string.

$app : string = null

The application being called.

Tags
throws
Horde_Exception
Return values
string

The application file path.

applicationWebPath()

Replace any %application% strings with the web path to the application.

public applicationWebPath(string $path[, string $app = null ]) : string
Parameters
$path : string

The application string.

$app : string = null

The application being called.

Return values
string

The application web path.

call()

Return the hook corresponding to the default package that provides the functionality requested by the $method parameter.

public call(string $method[, array<string|int, mixed> $args = array() ]) : mixed

$method is a string consisting of "packagetype/methodname".

Parameters
$method : string

The method to call.

$args : array<string|int, mixed> = array()

Arguments to the method.

Tags
throws
Horde_Exception
Return values
mixed

Return from method call.

callAppMethod()

Call a private Horde application method.

public callAppMethod(string $app, string $call[, array<string|int, mixed> $options = array() ]) : mixed
Parameters
$app : string

The application name.

$call : string

The method to call.

$options : array<string|int, mixed> = array()

Additional options:

  • args: (array) Additional parameters to pass to the method.
  • check_missing: (boolean) If true, throws an Exception if method does not exist. Otherwise, will return null.
  • noperms: (boolean) If true, don't check the perms.
Tags
throws
Horde_Exception

Application methods should throw this if there is a fatal error.

throws
Horde_Exception_PushApp
Return values
mixed

Various.

callByPackage()

Output the hook corresponding to the specific package named.

public callByPackage(string $app, string $call[, array<string|int, mixed> $args = array() ][, array<string|int, mixed> $options = array() ]) : mixed
Parameters
$app : string

The application being called.

$call : string

The method to call.

$args : array<string|int, mixed> = array()

Arguments to the method.

$options : array<string|int, mixed> = array()

Additional options:

  • noperms: (boolean) If true, don't check the perms.
Tags
throws
Horde_Exception_PushApp
Return values
mixed

Return from application call.

checkExistingAuth()

Check existing auth for triggers that might invalidate it.

public checkExistingAuth([string $app = 'horde' ]) : bool
Parameters
$app : string = 'horde'

Check authentication for this app too.

Return values
bool

Is existing auth valid?

clearAuth()

Clears any authentication tokens in the current session.

public clearAuth([bool $destroy = true ]) : mixed
Parameters
$destroy : bool = true

Destroy the session?

clearAuthApp()

Clears authentication tokens for a given application in the current session.

public clearAuthApp(mixed $app) : bool
Parameters
$app : mixed
Return values
bool

If false, did not remove authentication token because the application is in control of Horde's auth.

convertUsername()

Converts an authentication username to a unique Horde username.

public convertUsername(string $userId, bool $toHorde) : string
Parameters
$userId : string

The username to convert.

$toHorde : bool

If true, convert to a Horde username. If false, convert to the auth username.

Tags
throws
Horde_Exception
Return values
string

The converted username.

currentProcessAuth()

Checks whether this process required authentication.

public currentProcessAuth() : bool
Tags
since
2.11.0
Return values
bool

True if the current process required authentication.

downloadUrl()

Returns a URL to be used for downloading data.

public downloadUrl(string $filename[, array<string|int, mixed> $params = array() ]) : Horde_Url
Parameters
$filename : string

The filename of the download data.

$params : array<string|int, mixed> = array()

Additional URL parameters needed.

Return values
Horde_Url

The download URL. This URL should be used as-is, since the filename MUST be the last parameter added to the URL.

get()

Return the requested configuration parameter for the specified application. If no application is specified, the value of the current application is used. However, if the parameter is not present for that application, the Horde-wide value is used instead.

public get(string $parameter[, string $app = null ]) : string

If that is not present, we return null.

Parameters
$parameter : string

The configuration value to retrieve.

$app : string = null

The application to get the value for.

Return values
string

The requested parameter, or null if it is not set.

getApp()

Return the current application - the app at the top of the application stack.

public getApp() : string
Return values
string

The current application.

getAppDrivers()

Returns a list of available drivers for a library that are available in an application.

public getAppDrivers(string $app, string $prefix) : array<string|int, mixed>
Parameters
$app : string

The application name.

$prefix : string

The library prefix.

Tags
todo

support namespaced prefixes with multiple levels

Return values
array<string|int, mixed>

The list of available class names.

getAuth()

Returns the currently logged in user, if there is one.

public getAuth([string $format = null ]) : mixed
Parameters
$format : string = null

The return format, defaults to the unique Horde ID. Alternative formats:

  • bare: (string) Horde ID without any domain information. EXAMPLE: foo@example.com would be returned as 'foo'.
  • domain: (string) Domain of the Horde ID. EXAMPLE: foo@example.com would be returned as 'example.com'.
  • original: (string) The username used to originally login to Horde.
Return values
mixed

The user ID or false if no user is logged in.

getAuthApps()

Returns the list of applications currently authenticated to.

public getAuthApps() : array<string|int, mixed>
Tags
since
2.12.0
Return values
array<string|int, mixed>

List of authenticated applications.

getAuthCredential()

Returns the requested credential for the currently logged in user, if present.

public getAuthCredential([string $credential = null ][, string $app = null ]) : mixed
Parameters
$credential : string = null

The credential to retrieve.

$app : string = null

The app to query. Defaults to Horde.

Return values
mixed

The requested credential, all credentials if $credential is null, or false if no user is logged in.

getAuthInfo()

Returns authentication metadata information.

public getAuthInfo() : array<string|int, mixed>
Tags
since
2.12.0
Return values
array<string|int, mixed>

Authentication metadata:

  • authId: (string) The username used during the original auth.
  • browser: (string) The remote browser string.
  • change: (boolean) Is a password change requested?
  • credentials: (string) The 'auth_app' entry that contains the Horde credentials.
  • remoteAddr: (string) The remote IP address of the user.
  • timestamp: (integer) The login time.
  • userId: (string) The unique Horde username.

getEmailCharset()

Returns the charset to use for outgoing emails.

public getEmailCharset() : string
Return values
string

The preferred charset for outgoing mails based on the user's preferences and the current language.

getInitialPage()

Query the initial page for an application - the webroot, if there is no initial_page set, and the initial_page, if it is set.

public getInitialPage([string $app = null ]) : string
Parameters
$app : string = null

The name of the application.

Tags
throws
Horde_Exception
Return values
string

URL pointing to the initial page of the application.

getLanguageCharset()

Returns the charset for the current language.

public getLanguageCharset() : string
Return values
string

The character set that should be used with the current locale settings.

getLogoutUrl()

Returns a URL to the login screen, adding the necessary logout parameters.

public getLogoutUrl([array<string|int, mixed> $options = array() ]) : Horde_Url

If no reason/msg is passed in, uses the current global authentication error message.

Parameters
$options : array<string|int, mixed> = array()

Additional options:

  • app: (string) Authenticate to this application DEFAULT: Horde
  • msg: (string) If reason is Horde_Auth::REASON_MESSAGE, the message to display to the user. DEFAULT: None
  • params: (array) Additional params to add to the URL (not allowed: 'app', 'horde_logout_token', 'msg', 'reason', 'url'). DEFAULT: None
  • reason: (integer) The reason for logout DEFAULT: None
Return values
Horde_Url

The formatted URL.

Returns the URL to access a Horde service.

public getServiceLink(string $type[, string $app = null ][, bool $full = false ]) : Horde_Url
Parameters
$type : string

The service to display:

  • ajax: AJAX endpoint.
  • cache: Cached data output.
  • download: Download link.
  • emailconfirm: E-mail confirmation page.
  • go: URL redirection utility.
  • help: Help page.
  • imple: Imple endpoint.
  • login: Login page.
  • logintasks: Logintasks page.
  • logout: Logout page.
  • pixel: Pixel generation page.
  • portal: Main portal page.
  • prefs: Preferences UI.
  • problem: Problem reporting page.
$app : string = null

The name of the current Horde application.

$full : bool = false

Return a full url? @since 2.4.0

Tags
throws
Horde_Exception
Return values
Horde_Url

The link.

getVersion()

Return the version string for a given application.

public getVersion([string $app = null ][, bool $number = false ]) : string
Parameters
$app : string = null

The application to get the value for.

$number : bool = false

Return the raw version number, suitable for comparison purposes.

Return values
string

The version string for the application.

getView()

Get current view.

public getView() : int
Return values
int

The view type.

hasFeature()

Does the application have the queried feature?

public hasFeature(string $id[, string $app = null ]) : bool
Parameters
$id : string

Feature ID.

$app : string = null

The application to check (defaults to current app).

Return values
bool

True if the application has the feature.

hasInterface()

Determine if an interface is implemented by an active application.

public hasInterface(string $interface) : mixed
Parameters
$interface : string

The interface to check for.

Return values
mixed

The application implementing $interface if we have it, false if the interface is not implemented.

Determine if a link has been registered with the registry.

public hasLink(string $method[, string $app = null ]) : mixed
Parameters
$method : string

The full name of the link method to check for.

$app : string = null

Only check this application.

Tags
since
2.12.0
Return values
mixed

The application implementing $method if we have it, false if the link method doesn't exist.

hasMethod()

Determine if a method has been registered with the registry.

public hasMethod(string $method[, string $app = null ]) : mixed
Parameters
$method : string

The full name of the method to check for.

$app : string = null

Only check this application.

Return values
mixed

The application implementing $method if we have it, false if the method doesn't exist.

hasPermission()

Check permissions on an application.

public hasPermission(string $app[, int $perms = Horde_Perms::READ ][, array<string|int, mixed> $params = array() ]) : bool
Parameters
$app : string

The name of the application

$perms : int = Horde_Perms::READ

The permission level to check for.

$params : array<string|int, mixed> = array()

Additional options:

  • notransparent: (boolean) Do not attempt transparent authentication. DEFAULT: false
Return values
bool

Whether access is allowed.

hasView()

Does the given application have the queried view?

public hasView(int $view[, string $app = null ]) : bool
Parameters
$view : int

The view type (VIEW_* constant).

$app : string = null

The application to check (defaults to current app).

Return values
bool

True if the view is available in the application.

importConfig()

Reads the configuration values for the given application and imports them into the global $conf variable.

public importConfig(string $app) : mixed
Parameters
$app : string

The application name.

isAdmin()

Is a user an administrator?

public isAdmin([array<string|int, mixed> $options = array() ]) : bool
Parameters
$options : array<string|int, mixed> = array()

Options:

  • permission: (string) Allow users with this permission admin access in the current context.
  • permlevel: (integer) The level of permissions to check for. Defaults to Horde_Perms::EDIT.
  • user: (string) The user to check. Defaults to self::getAuth().
Return values
bool

Whether or not this is an admin user.

isAuthenticated()

Checks if there is a session with valid auth information. If there isn't, but the configured Auth driver supports transparent authentication, then we try that.

public isAuthenticated([array<string|int, mixed> $opts = array() ]) : bool
Parameters
$opts : array<string|int, mixed> = array()

Additional options:

  • app: (string) Check authentication for this app. DEFAULT: Checks horde-wide authentication.
  • notransparent: (boolean) Do not attempt transparent authentication. DEFAULT: false
Return values
bool

Whether or not the user is authenticated.

isInactive()

Is the given application inactive?

public isInactive(string $app) : bool
Parameters
$app : string

The application to check.

Return values
bool

True if inactive.

isTest()

Is the registry in 'test' mode?

public isTest() : bool
Tags
since
2.12.0
Return values
bool

True if in testing mode.

Returns the link corresponding to the default package that provides the functionality requested by the $method parameter.

public link(string $method[, array<string|int, mixed> $args = array() ][, mixed $extra = '' ]) : string
Parameters
$method : string

The method to link to, consisting of "packagetype/methodname".

$args : array<string|int, mixed> = array()

Arguments to the method.

$extra : mixed = ''

Extra, non-standard arguments to the method.

Tags
throws
Horde_Exception
Return values
string

The link for that method.

linkByPackage()

Returns the link corresponding to the specific package named.

public linkByPackage(string $app, string $call[, array<string|int, mixed> $args = array() ][, mixed $extra = '' ]) : string
Parameters
$app : string

The application being called.

$call : string

The method to link to.

$args : array<string|int, mixed> = array()

Arguments to the method.

$extra : mixed = ''

Extra, non-standard arguments to the method.

Tags
throws
Horde_Exception
Return values
string

The link for that method.

listAllApps()

Return a list of all applications, ignoring permissions.

public listAllApps() : array<string|int, mixed>
Return values
array<string|int, mixed>

List of all apps registered with Horde.

listAPIs()

Returns all available registry APIs.

public listAPIs() : array<string|int, mixed>
Return values
array<string|int, mixed>

The API list.

listApps()

Return a list of the installed and registered applications.

public listApps([array<string|int, mixed> $filter = null ][, bool $assoc = false ][, int|null $perms = Horde_Perms::SHOW ]) : array<string|int, mixed>
Parameters
$filter : array<string|int, mixed> = null

An array of the statuses that should be returned. Defaults to non-hidden.

$assoc : bool = false

Return hash with app names as keys and config parameters as values?

$perms : int|null = Horde_Perms::SHOW

The permission level to check for in the list. If null, skips permission check.

Return values
array<string|int, mixed>

List of apps registered with Horde. If no applications are defined returns an empty array.

listMethods()

Returns all of the available registry methods, or alternately only those for a specified API.

public listMethods([string $api = null ]) : array<string|int, mixed>
Parameters
$api : string = null

Defines the API for which the methods shall be returned. If null, returns all methods.

Return values
array<string|int, mixed>

The method list.

loadConfigFile()

Load a configuration file from a Horde application's config directory.

public loadConfigFile(string $conf_file[, mixed $vars = null ][, string $app = null ]) : Horde_Registry_Loadconfig

This call is cached (a config file is only loaded once, regardless of the $vars value).

Parameters
$conf_file : string

Configuration file name.

$vars : mixed = null

List of config variables to load.

$app : string = null

Application.

Tags
since
2.12.0
throws
Horde_Exception
Return values
Horde_Registry_Loadconfig

The config object.

loadPrefs()

Loads the preferences for the current user for the current application and imports them into the global $prefs variable.

public loadPrefs([string $app = null ]) : mixed

$app will be the active application after calling this function.

Parameters
$app : string = null

The name of the application.

Tags
throws
Horde_Exception

passwordChangeRequested()

Return whether the authentication backend requested a password change.

public passwordChangeRequested() : bool
Return values
bool

Whether the backend requested a password change.

popApp()

Remove the current app from the application stack, setting the current app to whichever app was current before this one took over.

public popApp() : string
Tags
throws
Horde_Exception
Return values
string

The name of the application that was popped.

preferredLang()

Selects the most preferred language for the current client session.

public preferredLang([string $lang = null ]) : string
Parameters
$lang : string = null

Force to use this language.

Return values
string

The selected language abbreviation.

pushApp()

Set the current application, adding it to the top of the Horde application stack. If this is the first application to be pushed, retrieve session information as well.

public pushApp(string $app[, array<string|int, mixed> $options = array() ]) : bool

pushApp() also reads the application's configuration file and sets up its global $conf hash.

Parameters
$app : string

The name of the application to push.

$options : array<string|int, mixed> = array()

Additional options:

  • check_perms: (boolean) Make sure that the current user has permissions to the application being loaded. Should ONLY be disabled by system scripts (cron jobs, etc.) and scripts that handle login. DEFAULT: true
  • logintasks: (boolean) Perform login tasks? Only performed if 'check_perms' is also true. System tasks are always peformed if the user is authorized. DEFAULT: false
  • notransparent: (boolean) Do not attempt transparent authentication. DEFAULT: false
Tags
throws
Horde_Exception_PushApp
Return values
bool

Whether or not the _appStack was modified.

rebuild()

Rebuild the registry configuration.

public rebuild() : mixed

remoteHost()

Returns information about the remote host.

public remoteHost() : object
Tags
since
2.17.0
Return values
object

An object with the following properties:

  - addr: (string) Remote IP address.
  - host: (string) Remote hostname (if resolvable; otherwise, this value
          is identical to 'addr').
  - proxy: (boolean) True if this user is connecting through a proxy.

removeUser()

Removes a user from the authentication backend and calls all applications' removeUserData API methods.

public removeUser(string $userId) : mixed
Parameters
$userId : string

The userId to delete.

Tags
throws
Horde_Exception

removeUserData()

Removes user's application data.

public removeUserData(string $user[, string $app = null ]) : mixed
Parameters
$user : string

The user ID to delete.

$app : string = null

If set, only removes data from this application. By default, removes data from all apps.

Tags
throws
Horde_Exception

setAuth()

Sets data in the session saying that authorization has succeeded, note which userId was authorized, and note when the login took place.

public setAuth(string $authId, array<string|int, mixed> $credentials[, array<string|int, mixed> $options = array() ]) : mixed

If a user name hook was defined in the configuration, it gets applied to the $userId at this point.

Parameters
$authId : string

The userId that has been authorized.

$credentials : array<string|int, mixed>

The credentials of the user.

$options : array<string|int, mixed> = array()

Additional options:

  • app: (string) The app to set authentication credentials for. DEFAULT: 'horde'
  • change: (boolean) Whether to request that the user change their password. DEFAULT: No
  • language: (string) The preferred language. DEFAULT: null
  • no_convert: (boolean) Don't convert the user name with the authusername hook. DEFAULT: false

setAuthCredential()

Sets the requested credential for the currently logged in user.

public setAuthCredential(mixed $credential[, string $value = null ][, string $app = null ]) : mixed
Parameters
$credential : mixed

The credential to set. If an array, overwrites the current credentials array.

$value : string = null

The value to set the credential to. If $credential is an array, this value is ignored.

$app : string = null

The app to update. Defaults to Horde.

setAuthenticationSetting()

(Re)set the authentication parameter. Useful for requests, such as Rpc requests where we actually don't perform authentication until later in the request, but still need Horde bootstrapped early in the request. Also clears the local app/api cache since applications will probably already have been initialized during Notification polling.

public setAuthenticationSetting(string $authentication) : mixed
Parameters
$authentication : string

The authentication setting.

Tags
see
appInit()

setLanguage()

Sets the language.

public setLanguage([string $lang = null ]) : string
Parameters
$lang : string = null

The language abbreviation.

Tags
throws
Horde_Exception
Return values
string

The current language (since 2.5.0).

setLanguageEnvironment()

Sets the language and reloads the whole NLS environment.

public setLanguageEnvironment([string $lang = null ][, string $app = null ]) : mixed

When setting the language, the gettext catalogs have to be reloaded too, charsets have to be updated etc. This method takes care of all this.

Parameters
$lang : string = null

The new language.

$app : string = null

The application for reloading the gettext catalog. Uses current application if null.

setTextdomain()

Sets the gettext domain.

public setTextdomain(string $app, string $directory) : mixed
Parameters
$app : string

The application name.

$directory : string

The directory where the application's LC_MESSAGES directory resides.

setTimeZone()

Sets the current timezone, if available.

public setTimeZone() : mixed

setView()

Set current view.

public setView([int $view = self::VIEW_BASIC ]) : mixed
Parameters
$view : int = self::VIEW_BASIC

The view type.

showService()

TODO

public showService(string $type) : bool
Parameters
$type : string

The type of link.

The following must be defined in Horde's menu config, or else they
won't be displayed in the menu:
'help', 'problem', 'logout', 'login', 'prefs'
Return values
bool

True if the link is to be shown.

shutdown()

Events to do on shutdown.

public shutdown() : mixed

_cacheId()

Get the cache ID for the registry information.

protected _cacheId([string $hash = null ]) : mixed
Parameters
$hash : string = null

If set, hash this value and use as the hash of the registry. If false, uses session stored value.

_doHasSearch()

Do the has*() search.

protected _doHasSearch(mixed $method, mixed $app, string $func) : mixed
Parameters
$method : mixed
$app : mixed
$func : string

The API function to call to get the list of elements to search. Either 'methods' or 'links'.

Tags
see
hasMethod
see
hasLink
Return values
mixed

The application implementing $method, false if it doesn't exist;

_getAuthCredentials()

Get the list of credentials for a given app.

protected _getAuthCredentials(string $app) : mixed
Parameters
$app : string

The application name.

Return values
mixed

True, false, or the credential list.

_loadApi()

Load an application's API object.

protected _loadApi(string $app) : Horde_Registry_Api
Parameters
$app : string

The application to load.

Return values
Horde_Registry_Api

The API object, or null if not available.

_loadApplications()

Load application information from registry config files.

protected _loadApplications() : mixed

_mapLang()

Maps languages with common two-letter codes (such as nl) to the full locale code (in this case, nl_NL). Returns the language unmodified if it isn't an alias.

protected _mapLang(string $language) : string
Parameters
$language : string

The language code to map.

Return values
string

The mapped language code.

_methodLookup()

Do a lookup of method name -> app call.

protected _methodLookup(string $method) : mixed
Parameters
$method : string

The method name.

Return values
mixed

An array containing the app and method call, or false if not found.

_pushAppError()

Process Exceptions thrown when pushing app on stack.

protected _pushAppError(Exception $e, int $error) : mixed
Parameters
$e : Exception

The thrown Exception.

$error : int

The pushApp() error type.

Tags
throws
Horde_Exception_PushApp

        
On this page

Search results