From: Ben Klang Date: Wed, 19 May 2010 01:46:08 +0000 (-0400) Subject: Passwd: First pass at converting to H4 standards X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=1a37a6d9d1980ddcddb07fbe2dd1533f57842097;p=horde.git Passwd: First pass at converting to H4 standards --- diff --git a/passwd/lib/Application.php b/passwd/lib/Application.php new file mode 100644 index 000000000..a7dd42061 --- /dev/null +++ b/passwd/lib/Application.php @@ -0,0 +1,47 @@ + + * @author Ben Klang + * @package Passwd + */ + +if (!defined('PASSWD_BASE')) { + define('PASSWD_BASE', dirname(__FILE__). '/..'); +} + +if (!defined('HORDE_BASE')) { + /* If horde does not live directly under the app directory, the HORDE_BASE + * constant should be defined in config/horde.local.php. */ + if (file_exists(PASSWD_BASE. '/config/horde.local.php')) { + include PASSWD_BASE . '/config/horde.local.php'; + } else { + define('HORDE_BASE', PASSWD_BASE . '/..'); + } +} + +/* Load the Horde Framework core (needed to autoload + * Horde_Registry_Application::). */ +require_once HORDE_BASE . '/lib/core.php'; + +class Passwd_Application extends Horde_Registry_Application +{ + /** + * Initialization function. + * + * Global variables defined: + */ + protected function _init() + { + + } +} \ No newline at end of file diff --git a/passwd/lib/Exception.php b/passwd/lib/Exception.php new file mode 100644 index 000000000..56d2f50dc --- /dev/null +++ b/passwd/lib/Exception.php @@ -0,0 +1 @@ + - * @package Passwd - */ - -// Check for a prior definition of HORDE_BASE (perhaps by an -// auto_prepend_file definition for site customization). -if (!defined('HORDE_BASE')) { - @define('HORDE_BASE', dirname(__FILE__) . '/../..'); -} - -// Load the Horde Framework core, and set up inclusion paths. -require_once HORDE_BASE . '/lib/core.php'; - -// Registry. -$registry = &Registry::singleton(); -if (is_a(($pushed = $registry->pushApp('passwd', !defined('AUTH_HANDLER'))), 'PEAR_Error')) { - if ($pushed->getCode() == 'permission_denied') { - Horde::authenticationFailureRedirect(); - } - Horde::fatal($pushed, __FILE__, __LINE__, false); -} -$conf = &$GLOBALS['conf']; -@define('PASSWD_TEMPLATES', $registry->get('templates')); - -// Notification system. -$notification = &Notification::singleton(); -$notification->attach('status'); - -// Find the base file path of Passwd -@define('PASSWD_BASE', dirname(__FILE__) . '/..'); - -// Passwd base library. -require_once PASSWD_BASE . '/lib/Passwd.php'; - -// Start compression. -if (!Util::nonInputVar('no_compress')) { - Horde::compressOutput(); -} - -// Horde libraries. -require_once 'Horde/Help.php'; -require_once 'Horde/Secret.php'; diff --git a/passwd/main.php b/passwd/main.php index d58ee30be..6a84047b3 100644 --- a/passwd/main.php +++ b/passwd/main.php @@ -11,12 +11,11 @@ * @package Passwd */ -@define('PASSWD_BASE', dirname(__FILE__)); -require_once PASSWD_BASE . '/lib/base.php'; +require_once dirname(__FILE__) . '/lib/Application.php'; require PASSWD_BASE . '/config/backends.php'; // Get the backend details. -$backend_key = Util::getFormData('backend', false); +$backend_key = Horde_Util::getFormData('backend', false); if (!isset($backends[$backend_key])) { $backend_key = null; } @@ -28,7 +27,7 @@ do { } // Has the user submitted the form yet? - $submit = Util::getFormData('submit', false); + $submit = Horde_Util::getFormData('submit', false); if (!$submit) { // No so we don't need to do anything in this loop. break; @@ -42,7 +41,7 @@ do { // Get the username. if ($conf['user']['change'] === true) { - $userid = Util::getFormData('userid'); + $userid = Horde_Util::getFormData('userid'); } else { if ($conf['hooks']['default_username']) { $userid = Horde::callHook('_passwd_hook_default_username', @@ -63,7 +62,7 @@ do { } // We must be passed the old (current) password, or its an error. - $old_password = Util::getFormData('oldpassword', false); + $old_password = Horde_Util::getFormData('oldpassword', false); if (!$old_password) { $notification->push(_("You must give your current password"), 'horde.warning'); @@ -71,8 +70,8 @@ do { } // See if they entered the new password and verified it. - $new_password0 = Util::getFormData('newpassword0', false); - $new_password1 = Util::getFormData('newpassword1', false); + $new_password0 = Horde_Util::getFormData('newpassword0', false); + $new_password1 = Horde_Util::getFormData('newpassword1', false); if (!$new_password0) { $notification->push(_("You must give your new password"), 'horde.warning'); break; @@ -226,7 +225,7 @@ do { array($backend_userid, $old_password, $new_password0), 'passwd'); - $return_to = Util::getFormData('return_to'); + $return_to = Horde_Util::getFormData('return_to'); if (!empty($return_to)) { header('Location: ' . $return_to); exit;