From 423dbd13ee345ef3fb5da5778b5d75718ec13b6d Mon Sep 17 00:00:00 2001 From: root Date: Wed, 18 Aug 2010 15:13:32 +0200 Subject: [PATCH] even more fixes, seems to work now => validate more email addresses per account --- .../configs/application.ini.ca-mgr1 | 57 +++++++++++++++++++ .../controllers/MailController.php | 8 +-- manager/library/CAcert/User/Emails.php | 11 ++-- 3 files changed, 66 insertions(+), 10 deletions(-) create mode 100644 manager/application/configs/application.ini.ca-mgr1 diff --git a/manager/application/configs/application.ini.ca-mgr1 b/manager/application/configs/application.ini.ca-mgr1 new file mode 100644 index 0000000..4db026b --- /dev/null +++ b/manager/application/configs/application.ini.ca-mgr1 @@ -0,0 +1,57 @@ +[production] +phpSettings.display_startup_errors = 1 +phpSettings.display_errors = 1 +includePaths.library = LIBRARY_PATH +bootstrap.path = APPLICATION_PATH "/Bootstrap.php" +bootstrap.class = "Bootstrap" +resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers" +resources.frontController.noViewRenderer = 0 +resources.frontController.noErrorHandler = 0 +resources.frontController.useDefaultControllerAlways = 0 +resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts" +resources.view[] = +autoloadernamespaces.0 = "CAcert_" + +; Database settings for Session DB +ca_mgr.db.session.pdo = "Pdo_Mysql" +ca_mgr.db.session.autocleanup = 1 +ca_mgr.db.session.host = "localhost" +ca_mgr.db.session.username = "ca_mgr" +ca_mgr.db.session.password = "jsdfhsd47534hsdf7" +ca_mgr.db.session.dbname = "ca_mgr" + +; Database settings for Auth DB (CACert User Table) +ca_mgr.db.auth.pdo = "Pdo_Mysql" +ca_mgr.db.auth.host = "cacert1.it-sls.de" +ca_mgr.db.auth.username = "ca_mgr" +ca_mgr.db.auth.password = "6348Jhfge(3457H5Kse" +ca_mgr.db.auth.dbname = "cacert" +ca_mgr.db.auth.tablename = "users" + +; Database settings for Auth DB (Manager User Table) +ca_mgr.db.auth2.pdo = "Pdo_Mysql" +ca_mgr.db.auth2.host = "localhost" +ca_mgr.db.auth2.username = "ca_mgr" +ca_mgr.db.auth2.password = "jsdfhsd47534hsdf7" +ca_mgr.db.auth2.dbname = "ca_mgr" +ca_mgr.db.auth2.tablename = "system_user" + +; Database settings for Config DB (access to system_config and dnssecme data tables) +ca_mgr.db.config.pdo = "Pdo_Mysql" +ca_mgr.db.config.host = "localhost" +ca_mgr.db.config.username = "ca_mgr" +ca_mgr.db.config.password = "jsdfhsd47534hsdf7" +ca_mgr.db.config.dbname = "ca_mgr" + +; Application name for logger +log.application = "web" + +[staging : production] + +[testing : production] +phpSettings.display_startup_errors = 1 +phpSettings.display_errors = 1 + +[development : production] +phpSettings.display_startup_errors = 1 +phpSettings.display_errors = 1 diff --git a/manager/application/controllers/MailController.php b/manager/application/controllers/MailController.php index fb58194..b48faad 100644 --- a/manager/application/controllers/MailController.php +++ b/manager/application/controllers/MailController.php @@ -17,10 +17,6 @@ class MailController extends Zend_Controller_Action public function init() { /* Initialize action controller here */ - $config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini', APPLICATION_ENV); - $db2 = Zend_Db::factory($config->ca_mgr->db->auth2->pdo, $config->ca_mgr->db->auth2); - Zend_Registry::set('auth2_dbc', $db2); - $session = Zend_Registry::get('session'); $auth = $session->authdata['authed_permissions']; @@ -35,7 +31,9 @@ class MailController extends Zend_Controller_Action '"' . (($action == 'full')?' class="active"':'') . '>' . I18n::_('View all Mails') . '', Zend_View_Helper_Placeholder_Container_Abstract::SET, 2); } - $emails = new CAcert_User_Emails(); + $config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini', APPLICATION_ENV); + $db = Zend_Db::factory($config->ca_mgr->db->auth->pdo, $config->ca_mgr->db->auth); + $emails = new CAcert_User_Emails($db); $this->addresses = $emails->getEmailAddressesByLogin($session->authdata['authed_username']); diff --git a/manager/library/CAcert/User/Emails.php b/manager/library/CAcert/User/Emails.php index d345ce8..44b1310 100644 --- a/manager/library/CAcert/User/Emails.php +++ b/manager/library/CAcert/User/Emails.php @@ -1,8 +1,10 @@ debug(__METHOD__); + private $db = null; + + public function __construct($db) { + $this->db = $db; } /** @@ -11,7 +13,7 @@ class CAcert_User_Emails { * @return array */ public function getEmailAddressesByLogin($addr) { - $db = Zend_Registry::get('auth2_dbc'); + $db = $this->db; /** * find out user id by email address @@ -51,7 +53,6 @@ class CAcert_User_Emails { } } - Log::Log()->debug(__METHOD__ . ' mail addresses ' . var_export($emails, true)); return $emails; } -} \ No newline at end of file +}