* @author Eric Rostetter * @author Jan Schneider * @author Michael Slusarz * @category Horde * @copyright 2000-2017 Horde LLC * @license http://www.horde.org/licenses/gpl GPL * @package Passwd */ class Passwd_Basic { /** * @var array */ private $_backends; /** * @var string */ private $_output; /** * User ID. * * @var string */ private $_userid; /** * @var Horde_Variables */ private $_vars; /** */ public function __construct(Horde_Variables $vars) { global $conf, $injector, $registry; $this->_userid = $registry->getAuth(); if ($conf['user']['change'] === true) { $this->_userid = $vars->get('userid', $this->_userid); } else { try { $this->_userid = Horde::callHook('default_username', array(), 'passwd'); } catch (Horde_Exception_HookNotSet $e) {} } $this->_backends = $injector->getInstance('Passwd_Factory_Driver')->backends; $this->_vars = $vars; $this->_init(); } /** */ public function render() { echo $this->_output; } /** */ public function status() { Horde::startBuffer(); $GLOBALS['notification']->notify(array('listeners' => array('status'))); return Horde::endBuffer(); } /** */ private function _init() { global $conf, $page_output; // Get the backend details. $backend_key = $this->_vars->backend; if (!isset($this->_backends[$backend_key])) { $backend_key = null; } if ($backend_key && $this->_vars->submit) { $this->_changePassword($backend_key); } // Choose the prefered backend from config/backends.php. foreach ($this->_backends as $k => $v) { if (!isset($backend_key) && (substr($k, 0, 1) != '_')) { $backend_key = $k; } if ($this->_isPreferredBackend($v)) { $backend_key = $k; break; } } $view = new Horde_View(array( 'templatePath' => PASSWD_TEMPLATES )); $view->addHelper('FormTag'); $view->addHelper('Horde_Core_View_Helper_Help'); $view->addHelper('Horde_Core_View_Helper_Label'); $view->addHelper('Tag'); $view->formInput = Horde_Util::formInput(); $view->url = $this->_vars->return_to; $view->userid = $this->_userid; $view->userChange = $conf['user']['change']; $view->showlist = ($conf['backend']['backend_list'] == 'shown'); $view->backend = $backend_key; // Build the