Methods summary
public static
Horde_Registry_Application
|
#
appInit( string $app, array $args = array() )
Application bootstrap initialization.
Solves chicken-and-egg problem - need a way to init Horde environment
from application without an active Horde_Registry object.
Application bootstrap initialization.
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).
init() will be called after the initialization is completed.
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 $prefs - Horde_Prefs object $registry - Horde_Registry object $session - Horde_Session object
Parameters
- $app
- The application to initialize.
- $args
- Optional arguments:
<pre><span class="php-quote">'admin'</span> - (boolean) <span class="php-keyword1">Require</span> authenticated user to be an admin?
<span class="php-keyword1">DEFAULT</span>: <span class="php-keyword1">false</span>
<span class="php-quote">'authentication'</span> - (string) The type of authentication to <span class="php-keyword1">use</span>:
<span class="php-quote">'none'</span> - <span class="php-keyword1">Do</span> not authenticate
<span class="php-quote">'throw'</span> - Authenticate; on no auth, <span class="php-keyword1">throw</span> a Horde_Exception
[<span class="php-keyword1">DEFAULT</span>] - Authenticate; on no auth redirect to login screen
<span class="php-quote">'cli'</span> - (boolean) Initialize a CLI <span class="php-keyword1">interface</span>. Setting this to <span class="php-keyword1">true</span>
implicits setting <span class="php-quote">'authentication'</span> to <span class="php-quote">'none'</span> <span class="php-keyword1">and</span> <span class="php-quote">'admin'</span> <span class="php-keyword1">and</span>
<span class="php-quote">'nocompress'</span> to <span class="php-keyword1">true</span>.
<span class="php-keyword1">DEFAULT</span>: <span class="php-keyword1">false</span>
<span class="php-quote">'nocompress'</span> - (boolean) <span class="php-keyword1">If</span> set, the page will not be compressed.
<span class="php-keyword1">DEFAULT</span>: <span class="php-keyword1">false</span>
<span class="php-quote">'nologintasks'</span> - (boolean) <span class="php-keyword1">If</span> set, don<span class="php-quote">'t perform logintasks (never
performed if authentication is '</span>none<span class="php-quote">').
DEFAULT: false
'</span><span class="php-keyword2">session_cache_limiter</span><span class="php-quote">' - (string) Use this value for the session cache
limiter.
DEFAULT: Uses the value in the configuration.
'</span>session_control<span class="php-quote">' - (string) Sets special session control limitations:
'</span>netscape<span class="php-quote">' - TODO; start read/write session
'</span>none<span class="php-quote">' - Do not start a session
'</span>readonly<span class="php-quote">' - Start session readonly
[DEFAULT] - Start read/write session
'</span>test<span class="php-quote">' - (boolean) Is this the test script? If so, we relax several
sanity checks and don'</span>t load things from the cache.
<span class="php-keyword1">DEFAULT</span>: <span class="php-keyword1">false</span>
<span class="php-quote">'timezone'</span> - (boolean) Set the <span class="php-keyword2">time</span> zone?
<span class="php-keyword1">DEFAULT</span>: <span class="php-keyword1">false</span>
<span class="php-quote">'user_admin'</span> - (boolean) Set authentication to an admin user?
<span class="php-keyword1">DEFAULT</span>: <span class="php-keyword1">false</span></pre>
Returns
Throws
Horde_Exception
|
public
|
#
__construct( integer $session_flags = 0, array $args = array() )
Create a new Horde_Registry instance.
Create a new Horde_Registry instance.
Parameters
- $session_flags
- Any session flags.
- $args
- See appInit().
Throws
Horde_Exception
|
public
|
#
shutdown( )
Events to do on shutdown.
Events to do on shutdown.
|
public
|
|
public
|
#
__clone( )
Clone should never be called on this object. If it is, die.
Clone should never be called on this object. If it is, die.
Throws
Horde_Exception
|
public
|
#
__sleep( )
serialize() should never be called on this object. If it is, die.
serialize() should never be called on this object. If it is, die.
Throws
Horde_Exception
|
public
|
#
rebuild( )
Rebuild the registry configuration.
Rebuild the registry configuration.
|
public
Horde_Registry_Api |Horde_Registry_Application
|
#
getApiInstance( string $app, string $type )
Retrieve an API object.
Parameters
- $app
- The application to load.
- $type
- Either 'application' or 'api'.
Returns
Throws
Horde_Exception
|
public
array
|
#
listApps( array $filter = null, boolean $assoc = false, integer $perms = Horde_Perms::SHOW )
Return a list of the installed and registered applications.
Return a list of the installed and registered applications.
Parameters
- $filter
- <p>An array of the statuses that should be
returned. Defaults to non-hidden.</p>
- $assoc
- <p>Return hash with app names as keys and config
parameters as values?</p>
- $perms
- <p>The permission level to check for in the list.
If null, skips permission check.</p>
Returns
array List of apps registered with Horde. If no
applications are defined returns an empty array.
|
public
array
|
#
listAllApps( mixed $filter = null )
Return a list of all applications, ignoring permissions.
Return a list of all applications, ignoring permissions.
Returns
array List of all apps registered with Horde.
|
public
boolean
|
#
isInactive( string $app )
Is the given application inactive?
Is the given application inactive?
Parameters
- $app
- The application to check.
Returns
boolean True if inactive.
|
public
array
|
#
listAPIs( )
Returns all available registry APIs.
Returns all available registry APIs.
Returns
array The API list.
|
public
array
|
#
listMethods( string $api = null )
Returns all of the available registry methods, or alternately
only those for a specified API.
Returns all of the available registry methods, or alternately
only those for a specified API.
Parameters
- $api
- <p>Defines the API for which the methods shall be
returned.</p>
Returns
array The method list.
|
public
mixed
|
#
hasInterface( string $interface )
Determine if an interface is implemented by an active application.
Determine if an interface is implemented by an active application.
Parameters
- $interface
- The interface to check for.
Returns
mixed The application implementing $interface if we have it,
false if the interface is not implemented.
|
public
mixed
|
#
hasMethod( string $method, string $app = null )
Determine if a method has been registered with the registry.
Determine if a method has been registered with the registry.
Parameters
- $method
- The full name of the method to check for.
- $app
- Only check this application.
Returns
mixed The application implementing $method if we have it,
false if the method doesn't exist.
|
public
mixed
|
#
call( string $method, array $args = array() )
Return the hook corresponding to the default package that provides the
functionality requested by the $method parameter.
$method is a string consisting of "packagetype/methodname".
Return the hook corresponding to the default package that provides the
functionality requested by the $method parameter.
$method is a string consisting of "packagetype/methodname".
Parameters
- $method
- The method to call.
- $args
- Arguments to the method.
Returns
mixed Return from method call.
Throws
Horde_Exception
|
public
mixed
|
#
callByPackage( string $app, string $call, array $args = array(), array $options = array() )
Output the hook corresponding to the specific package named.
Output the hook corresponding to the specific package named.
Parameters
- $app
- The application being called.
- $call
- The method to call.
- $args
- Arguments to the method.
- $options
- Additional options:
<span class="php-quote">'noperms'</span> - (boolean) <span class="php-keyword1">If</span> <span class="php-keyword1">true</span>, don<span class="php-quote">'t check the perms.</span>
Returns
mixed Return from application call.
Throws
Horde_Exception
|
public
mixed
|
#
callAppMethod( string $app, string $call, array $options = array() )
Call a private Horde application method.
Call a private Horde application method.
Parameters
- $app
- The application name.
- $call
- The method to call.
- $options
- Additional options:
<pre>args - (<span class="php-keyword1">array</span>) Additional parameters to pass to the method.
check_missing - (boolean) <span class="php-keyword1">If</span> <span class="php-keyword1">true</span>, throws an Exception <span class="php-keyword1">if</span> method does
not exist. Otherwise, will <span class="php-keyword1">return</span> <span class="php-keyword1">null</span>.
noperms - (boolean) <span class="php-keyword1">If</span> <span class="php-keyword1">true</span>, don<span class="php-quote">'t check the perms.</span></pre>
Returns
mixed Various.
Throws
Horde_Exception Application methods should throw this if there
is a fatal error.
|
public
string
|
#
link( string $method, array $args = array(), mixed $extra = '' )
Returns the link corresponding to the default package that provides the
functionality requested by the $method parameter.
Returns the link corresponding to the default package that provides the
functionality requested by the $method parameter.
Parameters
- $method
- <p>The method to link to, consisting of
"packagetype/methodname".</p>
- $args
- Arguments to the method.
- $extra
- Extra, non-standard arguments to the method.
Returns
string The link for that method.
Throws
Horde_Exception
|
public
string
|
#
linkByPackage( string $app, string $call, array $args = array(), mixed $extra = '' )
Returns the link corresponding to the specific package named.
Returns the link corresponding to the specific package named.
Parameters
- $app
- The application being called.
- $call
- The method to link to.
- $args
- Arguments to the method.
- $extra
- Extra, non-standard arguments to the method.
Returns
string The link for that method.
Throws
Horde_Exception
|
public
string
|
#
applicationFilePath( string $path, string $app = null )
Replace any %application% strings with the filesystem path to the
application.
Replace any %application% strings with the filesystem path to the
application.
Parameters
- $path
- The application string.
- $app
- The application being called.
Returns
string The application file path.
Throws
Horde_Exception
|
public
string
|
#
applicationWebPath( string $path, string $app = null )
Replace any %application% strings with the web path to the application.
Replace any %application% strings with the web path to the application.
Parameters
- $path
- The application string.
- $app
- The application being called.
Returns
string The application web path.
|
public
boolean
|
#
pushApp( string $app, array $options = array() )
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.
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.
pushApp() also reads the application's configuration file and
sets up its global $conf hash.
Parameters
- $app
- The name of the application to push.
- $options
- Additional options:
<pre><span class="php-quote">'check_perms'</span> - (boolean) Make sure that the <span class="php-keyword2">current</span> user has
permissions to the application being loaded. Should
ONLY be disabled by <span class="php-keyword2">system</span> scripts (cron jobs, etc.)
<span class="php-keyword1">and</span> scripts that handle login.
<span class="php-keyword1">DEFAULT</span>: <span class="php-keyword1">true</span>
<span class="php-quote">'noinit'</span> - (boolean) <span class="php-keyword1">Do</span> not init the application.
<span class="php-keyword1">DEFAULT</span>: <span class="php-keyword1">false</span>
<span class="php-quote">'logintasks'</span> - (boolean) Perform login tasks? Only performed <span class="php-keyword1">if</span>
<span class="php-quote">'check_perms'</span> is also <span class="php-keyword1">true</span>. <span class="php-keyword2">System</span> tasks are always
peformed <span class="php-keyword1">if</span> the user is authorized.
<span class="php-keyword1">DEFAULT</span>: <span class="php-keyword1">false</span></pre>
Returns
boolean Whether or not the _appStack was modified.
Throws
Horde_Exception Code can be one of the following:
Horde_Registry::AUTH_FAILURE
Horde_Registry::NOT_ACTIVE
Horde_Registry::PERMISSION_DENIED
Horde_Registry::HOOK_FATAL
|
public
string
|
#
popApp( )
Remove the current app from the application stack, setting the current
app to whichever app was current before this one took over.
Remove the current app from the application stack, setting the current
app to whichever app was current before this one took over.
Returns
string The name of the application that was popped.
Throws
Horde_Exception
|
public
string
|
#
getApp( )
Return the current application - the app at the top of the application
stack.
Return the current application - the app at the top of the application
stack.
Returns
string The current application.
|
public
boolean
|
#
hasPermission( string $app, integer $perms = Horde_Perms::READ, array $params = array() )
Check permissions on an application.
Check permissions on an application.
Parameters
- $app
- The name of the application
- $perms
- The permission level to check for.
- $params
- $options Additional options:
<pre><span class="php-quote">'notransparent'</span> - (boolean) <span class="php-keyword1">Do</span> not attempt transparent authentication.
<span class="php-keyword1">DEFAULT</span>: <span class="php-keyword1">false</span></pre>
Returns
boolean Whether access is allowed.
|
public
|
#
importConfig( string $app )
Reads the configuration values for the given application and imports
them into the global $conf variable.
Reads the configuration values for the given application and imports
them into the global $conf variable.
Parameters
- $app
- The application name.
|
public
|
#
loadPrefs( string $app = null )
Loads the preferences for the current user for the current application
and imports them into the global $prefs variable.
$app will be the active application after calling this function.
Loads the preferences for the current user for the current application
and imports them into the global $prefs variable.
$app will be the active application after calling this function.
Parameters
- $app
- The name of the application.
Throws
Horde_Exception
|
public
string
|
#
get( string $parameter, string $app = null )
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.
If that is not present, we return null.
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.
If that is not present, we return null.
Parameters
- $parameter
- The configuration value to retrieve.
- $app
- The application to get the value for.
Returns
string The requested parameter, or null if it is not set.
|
public
string
|
#
getVersion( string $app = null, boolean $number = false )
Return the version string for a given application.
Return the version string for a given application.
Parameters
- $app
- The application to get the value for.
- $number
- <p>Return the raw version number, suitable for
comparison purposes.</p>
Returns
string The version string for the application.
|
public
boolean
|
#
hasMobileView( string $app = null )
Does the given application have a mobile view?
Does the given application have a mobile view?
Parameters
- $app
- The application to check.
Returns
boolean Whether app has mobile view.
|
public
boolean
|
#
hasAjaxView( string $app = null )
Does the given application have an ajax view?
Does the given application have an ajax view?
Parameters
- $app
- The application to check.
Returns
boolean Whether app has an ajax view.
|
public
array
|
#
getAppDrivers( string $app, string $prefix )
Returns a list of available drivers for a library that are available
in an application.
Returns a list of available drivers for a library that are available
in an application.
Parameters
- $app
- The application name.
- $prefix
- The library prefix.
Returns
array The list of available class names.
|
public
string
|
#
getInitialPage( string $app = null )
Query the initial page for an application - the webroot, if there is no
initial_page set, and the initial_page, if it is set.
Query the initial page for an application - the webroot, if there is no
initial_page set, and the initial_page, if it is set.
Parameters
- $app
- The name of the application.
Returns
string URL pointing to the initial page of the application.
Throws
Horde_Exception
|
public
|
#
getCleanSession( )
Destroys any existing session on login and make sure to use a new
session ID, to avoid session fixation issues. Should be called before
checking a login.
Destroys any existing session on login and make sure to use a new
session ID, to avoid session fixation issues. Should be called before
checking a login.
|
public
|
#
clearAuth( boolean $destroy = true )
Clears any authentication tokens in the current session.
Clears any authentication tokens in the current session.
Parameters
- $destroy
- Destroy the session?
|
public
boolean
|
#
isAdmin( array $options = array() )
Is a user an administrator?
Is a user an administrator?
Parameters
- $options
- Options:
<pre><span class="php-quote">'permission'</span> - (string) Allow users with this permission admin access
in the <span class="php-keyword2">current</span> context.
<span class="php-quote">'permlevel'</span> - (integer) The level of permissions to check <span class="php-keyword1">for</span>.
Defaults to Horde_Perms::EDIT.
<span class="php-quote">'user'</span> - (string) The user to check.
Defaults to self::getAuth().</pre>
Returns
boolean Whether or not this is an admin user.
|
public
boolean
|
#
isAuthenticated( array $options = array() )
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.
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.
Parameters
- $options
- Additional options:
<pre><span class="php-quote">'app'</span> - (string) Check authentication <span class="php-keyword1">for</span> this app.
<span class="php-keyword1">DEFAULT</span>: Checks horde-wide authentication.
<span class="php-quote">'notransparent'</span> - (boolean) <span class="php-keyword1">Do</span> not attempt transparent authentication.
<span class="php-keyword1">DEFAULT</span>: <span class="php-keyword1">false</span></pre>
Returns
boolean Whether or not the user is authenticated.
|
public
|
#
authenticateFailure( string $app = 'horde', Horde_Exception $e = null )
Handle authentication failures, redirecting to the login page
when appropriate.
Handle authentication failures, redirecting to the login page
when appropriate.
Parameters
- $app
- The app which failed authentication.
- $e
- An exception thrown by pushApp().
Throws
Horde_Exception
|
public
Horde_Url
|
#
getLogoutUrl( array $options = array() )
Returns a URL to the login screen, adding the necessary logout
parameters.
Returns a URL to the login screen, adding the necessary logout
parameters.
If no reason/msg is passed in, uses the current global authentication
error message.
Parameters
- $options
- <p>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</p>
Returns
Horde_Url The formatted URL.
|
public
string
|
#
convertUsername( string $userId, boolean $toHorde )
Converts an authentication username to a unique Horde username.
Converts an authentication username to a unique Horde username.
Parameters
- $userId
- $username The username to convert.
- $toHorde
- <p>If true, convert to a Horde username. If
false, convert to the auth username.</p>
Returns
string The converted username.
Throws
Horde_Exception
|
public
mixed
|
#
getAuth( string $format = null )
Returns the currently logged in user, if there is one.
Returns the currently logged in user, if there is one.
Parameters
- $format
- <p>The return format, defaults to the unique Horde
ID. Alternative formats:</p>
<pre>bare - Horde ID without any domain information.
EXAMPLE: foo@example.com would be returned <span class="php-keyword1">as</span> <span class="php-quote">'foo'</span>.
domain: Domain of the Horde ID.
EXAMPLE: foo@example.com would be returned <span class="php-keyword1">as</span> <span class="php-quote">'example.com'</span>.
original: The username used to originally login to Horde.</pre>
Returns
mixed The user ID or false if no user is logged in.
|
public
boolean
|
#
passwordChangeRequested( )
Return whether the authentication backend requested a password change.
Return whether the authentication backend requested a password change.
Returns
boolean Whether the backend requested a password change.
|
public
mixed
|
#
getAuthCredential( string $credential = null, string $app = null )
Returns the requested credential for the currently logged in user, if
present.
Returns the requested credential for the currently logged in user, if
present.
Parameters
- $credential
- The credential to retrieve.
- $app
- The app to query. Defaults to Horde.
Returns
mixed The requested credential, all credentials if $credential
is null, or false if no user is logged in.
|
public
|
#
setAuthCredential( mixed $credential, string $value = null, string $app = null )
Sets the requested credential for the currently logged in user.
Sets the requested credential for the currently logged in user.
Parameters
- $credential
- <p>The credential to set. If an array,
overwrites the current credentials array.</p>
- $value
- <p>The value to set the credential to. If
$credential is an array, this value is
ignored.</p>
- $app
- The app to update. Defaults to Horde.
|
public
|
#
setAuth( string $authId, array $credentials, array $options = array() )
Sets data in the session saying that authorization has succeeded,
note which userId was authorized, and note when the login took place.
Sets data in the session saying that authorization has succeeded,
note which userId was authorized, and note when the login took place.
If a user name hook was defined in the configuration, it gets applied
to the $userId at this point.
Horde authentication data is stored in the session in the 'auth' and
'auth_app' array keys. The 'auth' key has the following members:
'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.
The auth_app key contains application-specific authentication.
Session subkeys are the app names, values are an array containing
credentials. If the value is true, application does not require any
specific credentials.
Parameters
- $authId
- The userId that has been authorized.
- $credentials
- The credentials of the user.
- $options
- Additional options:
<pre><span class="php-quote">'app'</span> - (string) The app to set authentication credentials <span class="php-keyword1">for</span>.
<span class="php-keyword1">DEFAULT</span>: <span class="php-quote">'horde'</span>
<span class="php-quote">'change'</span> - (boolean) Whether to request that the user change their
password.
<span class="php-keyword1">DEFAULT</span>: No
<span class="php-quote">'language'</span> - (string) The preferred language.
<span class="php-keyword1">DEFAULT</span>: <span class="php-keyword1">null</span></pre>
|
public
boolean
|
#
checkExistingAuth( string $app = 'horde' )
Check existing auth for triggers that might invalidate it.
Check existing auth for triggers that might invalidate it.
Parameters
- $app
- Check authentication for this app too.
Returns
boolean Is existing auth valid?
Since
Horde_Core 1.4.0.
|
public
|
#
removeUser( string $userId )
Removes a user from the authentication backend and calls all
applications' removeUserData API methods.
Removes a user from the authentication backend and calls all
applications' removeUserData API methods.
Parameters
- $userId
- The userId to delete.
Throws
Horde_Exception
|
public
|
#
removeUserData( string $user, string $app = null )
Removes user's application data.
Removes user's application data.
Parameters
- $user
- The user ID to delete.
- $app
- <p>If set, only removes data from this application.
By default, removes data from all apps.</p>
Throws
Horde_Exception
|
public
string
|
#
getLanguageCharset( )
Returns the charset for the current language.
Returns the charset for the current language.
Returns
string The character set that should be used with the current
locale settings.
|
public
string
|
#
getEmailCharset( )
Returns the charset to use for outgoing emails.
Returns the charset to use for outgoing emails.
Returns
string The preferred charset for outgoing mails based on
the user's preferences and the current language.
|
public
string
|
#
preferredLang( string $lang = null )
Selects the most preferred language for the current client session.
Selects the most preferred language for the current client session.
Parameters
- $lang
- Force to use this language.
Returns
string The selected language abbreviation.
|
public
|
#
setLanguage( string $lang = null )
Sets the language.
Parameters
- $lang
- The language abbreviation.
Throws
Horde_Exception
|
public
|
#
setLanguageEnvironment( string $lang = null, string $app = null )
Sets the language and reloads the whole NLS environment.
Sets the language and reloads the whole NLS environment.
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
- $language The new language.
- $app
- <p>The application for reloading the gettext
catalog. The current application if empty.</p>
|
public
|
#
setTextdomain( string $app, string $directory )
Sets the gettext domain.
Parameters
- $app
- The application name.
- $directory
- <p>The directory where the application's
LC_MESSAGES directory resides.</p>
|
public
|
#
setTimeZone( )
Sets the current timezone, if available.
Sets the current timezone, if available.
|