Overview

Packages

  • Auth
  • Core
  • Horde
    • Imsp
  • None
  • Notification

Classes

  • Horde
  • Horde_Config
  • Horde_Config_Form
  • Horde_Core_ActiveSync_Connector
  • Horde_Core_ActiveSync_Driver
  • Horde_Core_Ajax_Application
  • Horde_Core_Ajax_Imple
  • Horde_Core_Ajax_Imple_AutoCompleter
  • Horde_Core_Ajax_Imple_Geocoder_Geonames
  • Horde_Core_Ajax_Imple_SpellChecker
  • Horde_Core_Alarm_Handler_Notify
  • Horde_Core_Auth_Application
  • Horde_Core_Auth_Composite
  • Horde_Core_Auth_Ldap
  • Horde_Core_Auth_Msad
  • Horde_Core_Auth_Shibboleth
  • Horde_Core_Auth_Signup_Base
  • Horde_Core_Auth_Signup_Form
  • Horde_Core_Auth_Signup_Null
  • Horde_Core_Auth_Signup_Sql
  • Horde_Core_Auth_Signup_SqlObject
  • Horde_Core_Autoloader_Callback_Mime
  • Horde_Core_Autoloader_Callback_Nls
  • Horde_Core_Block
  • Horde_Core_Block_Collection
  • Horde_Core_Block_Layout
  • Horde_Core_Block_Layout_Manager
  • Horde_Core_Block_Layout_View
  • Horde_Core_Block_Upgrade
  • Horde_Core_Browser
  • Horde_Core_Bundle
  • Horde_Core_Cli
  • Horde_Core_Controller_NotFound
  • Horde_Core_Controller_RequestConfiguration
  • Horde_Core_Controller_RequestMapper
  • Horde_Core_Controller_SettingsFinder
  • Horde_Core_Db_Migration
  • Horde_Core_Factory_ActiveSyncBackend
  • Horde_Core_Factory_ActiveSyncServer
  • Horde_Core_Factory_ActiveSyncState
  • Horde_Core_Factory_Ajax
  • Horde_Core_Factory_Alarm
  • Horde_Core_Factory_Auth
  • Horde_Core_Factory_AuthSignup
  • Horde_Core_Factory_Base
  • Horde_Core_Factory_BlockCollection
  • Horde_Core_Factory_Browser
  • Horde_Core_Factory_Cache
  • Horde_Core_Factory_Crypt
  • Horde_Core_Factory_Data
  • Horde_Core_Factory_Db
  • Horde_Core_Factory_DbBase
  • Horde_Core_Factory_DbPear
  • Horde_Core_Factory_Dns
  • Horde_Core_Factory_Editor
  • Horde_Core_Factory_Facebook
  • Horde_Core_Factory_Group
  • Horde_Core_Factory_History
  • Horde_Core_Factory_HttpClient
  • Horde_Core_Factory_Identity
  • Horde_Core_Factory_Image
  • Horde_Core_Factory_Imple
  • Horde_Core_Factory_Imsp
  • Horde_Core_Factory_ImspAuth
  • Horde_Core_Factory_Injector
  • Horde_Core_Factory_KolabServer
  • Horde_Core_Factory_KolabSession
  • Horde_Core_Factory_KolabStorage
  • Horde_Core_Factory_Ldap
  • Horde_Core_Factory_Lock
  • Horde_Core_Factory_Logger
  • Horde_Core_Factory_LoginTasks
  • Horde_Core_Factory_Mail
  • Horde_Core_Factory_Mapper
  • Horde_Core_Factory_Matcher
  • Horde_Core_Factory_Memcache
  • Horde_Core_Factory_MimeViewer
  • Horde_Core_Factory_Notification
  • Horde_Core_Factory_Perms
  • Horde_Core_Factory_PermsCore
  • Horde_Core_Factory_Prefs
  • Horde_Core_Factory_Request
  • Horde_Core_Factory_Secret
  • Horde_Core_Factory_SessionHandler
  • Horde_Core_Factory_Share
  • Horde_Core_Factory_ShareBase
  • Horde_Core_Factory_Template
  • Horde_Core_Factory_TextFilter
  • Horde_Core_Factory_ThemesCache
  • Horde_Core_Factory_Token
  • Horde_Core_Factory_Tree
  • Horde_Core_Factory_Twitter
  • Horde_Core_Factory_UrlShortener
  • Horde_Core_Factory_Vfs
  • Horde_Core_Factory_View
  • Horde_Core_Factory_Weather
  • Horde_Core_Group_Ldap
  • Horde_Core_Log_Logger
  • Horde_Core_LoginTasks
  • Horde_Core_LoginTasks_Backend_Horde
  • Horde_Core_LoginTasks_SystemTask_Upgrade
  • Horde_Core_Mime_Viewer_Syntaxhighlighter
  • Horde_Core_Mime_Viewer_Vcard
  • Horde_Core_Notification_Event_Status
  • Horde_Core_Notification_Handler_Decorator_Hordelog
  • Horde_Core_Notification_Storage_Session
  • Horde_Core_Perms
  • Horde_Core_Perms_Ui
  • Horde_Core_Prefs_Cache_Session
  • Horde_Core_Prefs_Identity
  • Horde_Core_Prefs_Storage_Configuration
  • Horde_Core_Prefs_Storage_Hooks
  • Horde_Core_Prefs_Storage_Upgrade
  • Horde_Core_Prefs_Ui
  • Horde_Core_Prefs_Ui_Widgets
  • Horde_Core_Share_Driver
  • Horde_Core_Share_FactoryCallback
  • Horde_Core_Sidebar
  • Horde_Core_Text_Filter_Bbcode
  • Horde_Core_Text_Filter_Emails
  • Horde_Core_Text_Filter_Emoticons
  • Horde_Core_Text_Filter_Highlightquotes
  • Horde_Core_Translation
  • Horde_Core_Tree_Html
  • Horde_Core_Tree_Javascript
  • Horde_Core_Tree_Simplehtml
  • Horde_Core_Ui_FlagImage
  • Horde_Core_Ui_JsCalendar
  • Horde_Core_Ui_Language
  • Horde_Core_Ui_Layout
  • Horde_Core_Ui_ModalFormRenderer
  • Horde_Core_Ui_Pager
  • Horde_Core_Ui_Tabs
  • Horde_Core_Ui_TagCloud
  • Horde_Core_Ui_VarRenderer
  • Horde_Core_Ui_VarRenderer_Html
  • Horde_Core_Ui_VarRenderer_TablesetHtml
  • Horde_Core_Ui_Widget
  • Horde_ErrorHandler
  • Horde_Help
  • Horde_Menu
  • Horde_Registry
  • Horde_Registry_Api
  • Horde_Registry_Application
  • Horde_Registry_Caller
  • Horde_Registry_Nlsconfig
  • Horde_Script_Files
  • Horde_Session
  • Horde_Session_Null
  • Horde_Themes
  • Horde_Themes_Cache
  • Horde_Themes_Css
  • Horde_Themes_Element
  • Horde_Themes_Image
  • Horde_Themes_Sound

Exceptions

  • Horde_Exception_HookNotSet
  • Overview
  • Package
  • Class
  • Tree
  1: <?php
  2: /**
  3:  * This class defines the abstract driver implementation for
  4:  * Horde_Core_Auth_Signup.
  5:  *
  6:  * Copyright 2002-2012 Horde LLC (http://www.horde.org/)
  7:  *
  8:  * See the enclosed file COPYING for license information (LGPL). If you did
  9:  * not receive this file, see http://opensource.org/licenses/lgpl-2.1.php
 10:  *
 11:  * @author   Marko Djukic <marko@oblo.com>
 12:  * @author   Michael Slusarz <slusarz@horde.org>
 13:  * @category Horde
 14:  * @license  http://opensource.org/licenses/lgpl-2.1.php LGPL
 15:  * @package  Core
 16:  */
 17: abstract class Horde_Core_Auth_Signup_Base
 18: {
 19:     /**
 20:      * Adds a new user to the system and handles any extra fields that may have
 21:      * been compiled, relying on the hooks.php file.
 22:      *
 23:      * @param mixed $info  Reference to array of parameters to be passed
 24:      *                     to hook.
 25:      *
 26:      * @throws Horde_Exception
 27:      */
 28:     public function addSignup(&$info)
 29:     {
 30:         // Perform any preprocessing if requested.
 31:         $this->_preSignup($info);
 32: 
 33:         // Attempt to add the user to the system.
 34:         $GLOBALS['auth']->addUser($info['user_name'], array('password' => $info['password']));
 35: 
 36:         // Attempt to add/update any extra data handed in.
 37:         if (!empty($info['extra'])) {
 38:             try {
 39:                 Horde::callHook('signup_addextra', array($info['user_name'], $info['extra'], $info['password']));
 40:             } catch (Horde_Exception_HookNotSet $e) {
 41:             }
 42:         }
 43:     }
 44: 
 45:     /**
 46:      * Queues the user's submitted registration info for later admin approval.
 47:      *
 48:      * @param mixed $info  Reference to array of parameters to be passed
 49:      *                     to hook.
 50:      *
 51:      * @throws Horde_Exception
 52:      * @throws Horde_Mime_Exception
 53:      */
 54:     public function queueSignup(&$info)
 55:     {
 56:         global $conf;
 57: 
 58:         // Perform any preprocessing if requested.
 59:         $this->_preSignup($info);
 60: 
 61:         // If it's a unique username, go ahead and queue the request.
 62:         $signup = $this->newSignup($info['user_name']);
 63:         if (!empty($info['extra'])) {
 64:             $signup->setData($info['extra']);
 65:         }
 66:         $signup->setData(array_merge($signup->getData(), array(
 67:             'dateReceived' => time(),
 68:             'password' => $info['password'],
 69:         )));
 70: 
 71:         $this->_queueSignup($signup);
 72: 
 73:         try {
 74:             Horde::callHook('signup_queued', array($info['user_name'], $info));
 75:         } catch (Horde_Exception_HookNotSet $e) {
 76:         }
 77: 
 78:         if (!empty($conf['signup']['email'])) {
 79:             $link = Horde::url($GLOBALS['registry']->get('webroot', 'horde') . '/admin/signup_confirm.php', true, -1)->setRaw(true)->add(array(
 80:                 'u' => $signup->getName(),
 81:                 'h' => hash_hmac('sha1', $signup->getName(), $conf['secret_key'])
 82:             ));
 83:             $message = sprintf(Horde_Core_Translation::t("A new account for the user \"%s\" has been requested through the signup form."), $signup->getName())
 84:                 . "\n\n"
 85:                 . Horde_Core_Translation::t("Approve the account:")
 86:                 . "\n" . $link->copy()->add('a', 'approve') . "\n"
 87:                 . Horde_Core_Translation::t("Deny the account:")
 88:                 . "\n" . $link->copy()->add('a', 'deny');
 89:             $mail = new Horde_Mime_Mail(array(
 90:                 'body' => $message,
 91:                 'Subject' => sprintf(Horde_Core_Translation::t("Account signup request for \"%s\""), $signup->getName()),
 92:                 'To' => $conf['signup']['email'],
 93:                 'From' => $conf['signup']['email']));
 94:             $mail->send($GLOBALS['injector']->getInstance('Horde_Mail'));
 95:         }
 96:     }
 97: 
 98:     /**
 99:      * Perform common presignup actions.
100:      *
101:      * @param array $info  Reference to array of parameters.
102:      *
103:      * @throws Horde_Exception
104:      */
105:     protected function _preSignup(&$info)
106:     {
107:         try {
108:             $info = Horde::callHook('signup_preprocess', array($info));
109:         } catch (Horde_Exception_HookNotSet $e) {
110:         }
111: 
112:         // Check to see if the username already exists in the auth backend or
113:         // the signup queue.
114:         if ($GLOBALS['auth']->exists($info['user_name']) ||
115:             $this->exists($info['user_name'])) {
116:             throw new Horde_Exception(sprintf(Horde_Core_Translation::t("Username \"%s\" already exists."), $info['user_name']));
117:         }
118:     }
119: 
120:     /**
121:      * Queues the user's submitted registration info for later admin approval.
122:      *
123:      * @param object $signup  Signup data.
124:      *
125:      * @throws Horde_Exception
126:      */
127:     abstract protected function _queueSignup($signup);
128: 
129:     /**
130:      * Get a user's queued signup information.
131:      *
132:      * @param string $username  The username to retrieve the queued info for.
133:      *
134:      * @return object  The object for the requested signup.
135:      * @throws Horde_Exception
136:      */
137:     abstract public function getQueuedSignup($username);
138: 
139:     /**
140:      * Get the queued information for all pending signups.
141:      *
142:      * @return array  An array of objects, one for each signup in the queue.
143:      * @throws Horde_Exception
144:      */
145:     abstract public function getQueuedSignups();
146: 
147:     /**
148:      * Remove a queued signup.
149:      *
150:      * @param string $username  The user to remove from the signup queue.
151:      *
152:      * @throws Horde_Exception
153:      */
154:     abstract public function removeQueuedSignup($username);
155: 
156:     /**
157:      * Return a new signup object.
158:      *
159:      * @param string $name  The signups's name.
160:      *
161:      * @return object  A new signup object.
162:      * @throws Horde_Exception
163:      */
164:     abstract public function newSignup($name);
165: }
166: 
API documentation generated by ApiGen