diff --git a/manager/.project b/manager/.project
index 5d2c2c0..e218398 100644
--- a/manager/.project
+++ b/manager/.project
@@ -1,29 +1,29 @@
- ca-mgr (mawaunix)
-
-
-
-
-
- org.eclipse.wst.jsdt.core.javascriptValidator
-
-
-
-
- org.eclipse.wst.validation.validationbuilder
-
-
-
-
- org.eclipse.dltk.core.scriptbuilder
-
-
-
-
-
- org.zend.php.framework.ZendFrameworkNature
- org.eclipse.php.core.PHPNature
- org.eclipse.wst.jsdt.core.jsNature
-
+ ca-mgr (mawaunix)
+
+
+
+
+
+ org.eclipse.wst.jsdt.core.javascriptValidator
+
+
+
+
+ org.eclipse.wst.validation.validationbuilder
+
+
+
+
+ org.eclipse.dltk.core.scriptbuilder
+
+
+
+
+
+ org.zend.php.framework.ZendFrameworkNature
+ org.eclipse.php.core.PHPNature
+ org.eclipse.wst.jsdt.core.jsNature
+
diff --git a/manager/application/Bootstrap.php b/manager/application/Bootstrap.php
index 89b7d18..e1e3991 100644
--- a/manager/application/Bootstrap.php
+++ b/manager/application/Bootstrap.php
@@ -9,7 +9,7 @@ require_once('l10n/L10n.php');
require_once('i18n/I18n.php');
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap {
- protected function _initAutoload() {
+ protected function _initAutoload() {
$autoloader = new Zend_Application_Module_Autoloader(array(
'namespace' => 'Default_',
'basePath' => dirname(__FILE__)
@@ -17,138 +17,138 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap {
return $autoloader;
}
- protected function _initPlugins() {
- $this->bootstrap('session');
+ protected function _initPlugins() {
+ $this->bootstrap('session');
- $fc = Zend_Controller_Front::getInstance();
+ $fc = Zend_Controller_Front::getInstance();
- $charset_header = new CharsetHeader();
- $fc->registerPlugin($charset_header);
+ $charset_header = new CharsetHeader();
+ $fc->registerPlugin($charset_header);
- $force_auth = new ForceAuth();
- $fc->registerPlugin($force_auth);
+ $force_auth = new ForceAuth();
+ $fc->registerPlugin($force_auth);
- $buildmenu = new BuildMenu();
- $fc->registerPlugin($buildmenu);
+ $buildmenu = new BuildMenu();
+ $fc->registerPlugin($buildmenu);
- $loginlogout = new LoginLogout();
- $fc->registerPlugin($loginlogout);
- }
+ $loginlogout = new LoginLogout();
+ $fc->registerPlugin($loginlogout);
+ }
- protected function _initDoctype() {
- $this->bootstrap('view');
- $this->bootstrap('log');
- $this->bootstrap('I18n');
- $this->bootstrap('session');
+ protected function _initDoctype() {
+ $this->bootstrap('view');
+ $this->bootstrap('log');
+ $this->bootstrap('I18n');
+ $this->bootstrap('session');
- $view = $this->getResource('view');
- Zend_Registry::set('view', $view);
- $view->doctype('XHTML1_STRICT');
- $view->addHelperPath(APPLICATION_PATH . '/views/helpers/');
- $view->headTitle = I18n::_('CAcert Test Manager');
- }
+ $view = $this->getResource('view');
+ Zend_Registry::set('view', $view);
+ $view->doctype('XHTML1_STRICT');
+ $view->addHelperPath(APPLICATION_PATH . '/views/helpers/');
+ $view->headTitle = I18n::_('CAcert Test Manager');
+ }
- /**
- * @todo expireSessionCookie()
- * @todo rememberMe(xx)
- * @todo forgetMe()
- * @see Zend_Registry::get('session');
- * @return Zend_Session_Namespace
- */
- protected function _initSession() {
- $options = $this->getOption('ca_mgr');
+ /**
+ * @todo expireSessionCookie()
+ * @todo rememberMe(xx)
+ * @todo forgetMe()
+ * @see Zend_Registry::get('session');
+ * @return Zend_Session_Namespace
+ */
+ protected function _initSession() {
+ $options = $this->getOption('ca_mgr');
- $db = Zend_Db::factory($options['db']['session']['pdo'], $options['db']['session']);
+ $db = Zend_Db::factory($options['db']['session']['pdo'], $options['db']['session']);
- /**
- * automatically clean up expired session entries from session cache
- * use the modified and lifetime stamps to calculate expire time
- */
- if ($options['db']['session']['autocleanup'] == '1') {
- $stmt = $db->query('delete from front_session where (modified + lifetime * 2) < unix_timestamp()');
- # $stmt->execute();
- }
+ /**
+ * automatically clean up expired session entries from session cache
+ * use the modified and lifetime stamps to calculate expire time
+ */
+ if ($options['db']['session']['autocleanup'] == '1') {
+ $stmt = $db->query('delete from front_session where (modified + lifetime * 2) < unix_timestamp()');
+ # $stmt->execute();
+ }
- //you can either set the Zend_Db_Table default adapter
- //or you can pass the db connection straight to the save handler $config
- // @see lifetimeColumn / lifetime / overrideLifetime, lifetime defaults to php.ini: session.gc_maxlifetime
- Zend_Db_Table_Abstract::setDefaultAdapter($db);
- $config = array(
- 'name' => 'front_session',
- 'primary' => 'id',
- 'modifiedColumn' => 'modified',
- 'dataColumn' => 'data',
- 'lifetimeColumn' => 'lifetime'
- );
+ //you can either set the Zend_Db_Table default adapter
+ //or you can pass the db connection straight to the save handler $config
+ // @see lifetimeColumn / lifetime / overrideLifetime, lifetime defaults to php.ini: session.gc_maxlifetime
+ Zend_Db_Table_Abstract::setDefaultAdapter($db);
+ $config = array(
+ 'name' => 'front_session',
+ 'primary' => 'id',
+ 'modifiedColumn' => 'modified',
+ 'dataColumn' => 'data',
+ 'lifetimeColumn' => 'lifetime'
+ );
- //create your Zend_Session_SaveHandler_DbTable and
- //set the save handler for Zend_Session
- Zend_Session::setSaveHandler(new Zend_Session_SaveHandler_DbTable($config));
+ //create your Zend_Session_SaveHandler_DbTable and
+ //set the save handler for Zend_Session
+ Zend_Session::setSaveHandler(new Zend_Session_SaveHandler_DbTable($config));
- // Zend_Session::rememberMe(7200);
+ // Zend_Session::rememberMe(7200);
- //start your session!
- Zend_Session::start();
+ //start your session!
+ Zend_Session::start();
- $session = new Zend_Session_Namespace();
- if (!isset($session->started))
- $session->started = time();
- if (!isset($session->authdata))
- $session->authdata = array('authed' => false);
+ $session = new Zend_Session_Namespace();
+ if (!isset($session->started))
+ $session->started = time();
+ if (!isset($session->authdata))
+ $session->authdata = array('authed' => false);
- Zend_Registry::set('session', $session);
- return $session;
- }
+ Zend_Registry::set('session', $session);
+ return $session;
+ }
- /**
- * get the basic system config from database, store the config object in the bootstrap registry
- * @see Zend_Registry::get('config');
- * @return Config
- */
- protected function _initConfig() {
- $options = $this->getOption('ca_mgr');
- $db = Zend_Db::factory($options['db']['config']['pdo'], $options['db']['config']);
- $config = Config::getInstance(SYSTEM_CONFIG, $db);
+ /**
+ * get the basic system config from database, store the config object in the bootstrap registry
+ * @see Zend_Registry::get('config');
+ * @return Config
+ */
+ protected function _initConfig() {
+ $options = $this->getOption('ca_mgr');
+ $db = Zend_Db::factory($options['db']['config']['pdo'], $options['db']['config']);
+ $config = Config::getInstance(SYSTEM_CONFIG, $db);
- Zend_Registry::set('config', $config);
- Zend_Registry::set('config_dbc', $db);
+ Zend_Registry::set('config', $config);
+ Zend_Registry::set('config_dbc', $db);
- return $config;
- }
+ return $config;
+ }
- /**
- * make singleton system logger
- * @see Zend_Registry::get('log');
- * @return Log
- */
- public function _initLog() {
- $this->bootstrap('Config');
+ /**
+ * make singleton system logger
+ * @see Zend_Registry::get('log');
+ * @return Log
+ */
+ public function _initLog() {
+ $this->bootstrap('Config');
- $op = $this->getOption('log');
- $log = Log::getInstance(SYSTEM_LOG, $op['application']);
+ $op = $this->getOption('log');
+ $log = Log::getInstance(SYSTEM_LOG, $op['application']);
- Zend_Registry::set('log', $log);
- return $log;
- }
+ Zend_Registry::set('log', $log);
+ return $log;
+ }
- /**
- * make singleton I18n (internationalization) object (translation)
- */
- public function _initI18n() {
- $this->bootstrap('Config');
- // need existing L10n object for initialization
- $this->bootstrap('L10n');
+ /**
+ * make singleton I18n (internationalization) object (translation)
+ */
+ public function _initI18n() {
+ $this->bootstrap('Config');
+ // need existing L10n object for initialization
+ $this->bootstrap('L10n');
- $I18n = I18n::getInstance(L10n::getInstance()->getLanguage());
- }
+ $I18n = I18n::getInstance(L10n::getInstance()->getLanguage());
+ }
- /**
- * make singleton L10n (localization) object (set locale, convert date and
- * number formats)
- */
- public function _initL10n() {
- $this->bootstrap('Config');
+ /**
+ * make singleton L10n (localization) object (set locale, convert date and
+ * number formats)
+ */
+ public function _initL10n() {
+ $this->bootstrap('Config');
- $L10n = L10n::getInstance();
- }
+ $L10n = L10n::getInstance();
+ }
}
diff --git a/manager/application/configs/application.ini.ca-mgr1 b/manager/application/configs/application.ini.ca-mgr1
index e003b47..8b22a64 100644
--- a/manager/application/configs/application.ini.ca-mgr1
+++ b/manager/application/configs/application.ini.ca-mgr1
@@ -13,38 +13,38 @@ 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"
+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"
+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"
+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"
+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"
+log.application = "web"
[staging : production]
diff --git a/manager/application/configs/application.ini.mawatest b/manager/application/configs/application.ini.mawatest
index 07517ae..a2ebdb1 100644
--- a/manager/application/configs/application.ini.mawatest
+++ b/manager/application/configs/application.ini.mawatest
@@ -13,38 +13,38 @@ 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 = "front_session"
-ca_mgr.db.session.password = "laskdsfzrwethv45"
-ca_mgr.db.session.dbname = "ca_mgr"
+ca_mgr.db.session.pdo = "Pdo_Mysql"
+ca_mgr.db.session.autocleanup = 1
+ca_mgr.db.session.host = "localhost"
+ca_mgr.db.session.username = "front_session"
+ca_mgr.db.session.password = "laskdsfzrwethv45"
+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 = "localhost"
-ca_mgr.db.auth.username = "ca_mgr"
-ca_mgr.db.auth.password = "jsdfhsd47534hsdf7"
-ca_mgr.db.auth.dbname = "cacert"
-ca_mgr.db.auth.tablename = "users"
+ca_mgr.db.auth.pdo = "Pdo_Mysql"
+ca_mgr.db.auth.host = "localhost"
+ca_mgr.db.auth.username = "ca_mgr"
+ca_mgr.db.auth.password = "jsdfhsd47534hsdf7"
+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"
+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"
+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"
+log.application = "web"
[staging : production]
@@ -54,4 +54,4 @@ phpSettings.display_errors = 1
[development : production]
phpSettings.display_startup_errors = 1
-phpSettings.display_errors = 1
+phpSettings.display_errors = 1
\ No newline at end of file
diff --git a/manager/application/controllers/ErrorController.php b/manager/application/controllers/ErrorController.php
index 98de1d9..d69e3a3 100644
--- a/manager/application/controllers/ErrorController.php
+++ b/manager/application/controllers/ErrorController.php
@@ -28,7 +28,7 @@ class ErrorController extends Zend_Controller_Action
Log::Log()->emerg($errors->exception);
}
- public function permissiondeniedAction() {
+ public function permissiondeniedAction() {
- }
+ }
}
diff --git a/manager/application/controllers/IndexController.php b/manager/application/controllers/IndexController.php
index 8b185e2..7bfe07e 100644
--- a/manager/application/controllers/IndexController.php
+++ b/manager/application/controllers/IndexController.php
@@ -10,10 +10,10 @@ class IndexController extends Zend_Controller_Action
public function init()
{
/* Initialize action controller here */
- /**
- * get bootstrap, get resource from bootstrap
- * resources are created when an bootstrap _init method returns an object
- $bootstrap = $this->getInvokeArg('bootstrap');
+ /**
+ * get bootstrap, get resource from bootstrap
+ * resources are created when an bootstrap _init method returns an object
+ $bootstrap = $this->getInvokeArg('bootstrap');
$view = $bootstrap->getResource('view');
*/
}
diff --git a/manager/application/controllers/LoginController.php b/manager/application/controllers/LoginController.php
index 96a3821..e2f39e8 100644
--- a/manager/application/controllers/LoginController.php
+++ b/manager/application/controllers/LoginController.php
@@ -12,226 +12,226 @@ class LoginController extends Zend_Controller_Action
public function init() {
/* Initialize action controller here */
- $config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini', APPLICATION_ENV);
+ $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);
- Zend_Registry::set('auth_dbc', $db);
- $db2 = Zend_Db::factory($config->ca_mgr->db->auth2->pdo, $config->ca_mgr->db->auth2);
- Zend_Registry::set('auth2_dbc', $db2);
+ $db = Zend_Db::factory($config->ca_mgr->db->auth->pdo, $config->ca_mgr->db->auth);
+ Zend_Registry::set('auth_dbc', $db);
+ $db2 = Zend_Db::factory($config->ca_mgr->db->auth2->pdo, $config->ca_mgr->db->auth2);
+ Zend_Registry::set('auth2_dbc', $db2);
}
public function indexAction() {
- $this->view->form = $this->getForm();
- $this->render('index');
+ $this->view->form = $this->getForm();
+ $this->render('index');
}
public function loginAction() {
- $form = $this->getForm();
- if ($form->isValid($_POST)) {
- $config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini', APPLICATION_ENV);
+ $form = $this->getForm();
+ if ($form->isValid($_POST)) {
+ $config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini', APPLICATION_ENV);
- $db = Zend_Registry::get('auth_dbc');
- $db2 = Zend_Registry::get('auth2_dbc');
+ $db = Zend_Registry::get('auth_dbc');
+ $db2 = Zend_Registry::get('auth2_dbc');
- $auth = new Zend_Auth_Adapter_DbTable($db);
+ $auth = new Zend_Auth_Adapter_DbTable($db);
- $auth->setTableName($config->ca_mgr->db->auth->tablename)
- ->setIdentityColumn('email')
- ->setCredentialColumn('password');
+ $auth->setTableName($config->ca_mgr->db->auth->tablename)
+ ->setIdentityColumn('email')
+ ->setCredentialColumn('password');
Log::Log()->info(__METHOD__ . ' authenticate ' . $this->getRequest()->getParam('login_name') . ' ' . sha1(utf8_decode($this->getRequest()->getParam('login_password'))));
- $auth->setIdentity( $this->getRequest()->getParam('login_name'))
- ->setCredential( sha1(utf8_decode($this->getRequest()->getParam('login_password'))))
- ->setCredentialTreatment('?');
+ $auth->setIdentity( $this->getRequest()->getParam('login_name'))
+ ->setCredential( sha1(utf8_decode($this->getRequest()->getParam('login_password'))))
+ ->setCredentialTreatment('?');
- $result = $auth->authenticate();
+ $result = $auth->authenticate();
- $code = $result->getCode();
- switch ($code) {
- case Zend_Auth_Result::FAILURE:
- Log::Log()->info(__METHOD__ . ' user failed (Zend_Auth_Result::FAILURE) to log in ' . $this->getRequest()->getParam('login_name'));
- throw new Exception(__METHOD__ . ': unknown error');
- case Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND:
- Log::Log()->info(__METHOD__ . ' user failed (Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND) to log in ' . $this->getRequest()->getParam('login_name'));
- throw new Exception(__METHOD__ . ': ID unknown');
- case Zend_Auth_Result::FAILURE_IDENTITY_AMBIGUOUS:
- Log::Log()->info(__METHOD__ . ' user failed (Zend_Auth_Result::FAILURE_IDENTITY_AMBIGUOUS) to log in ' . $this->getRequest()->getParam('login_name'));
- throw new Exception(__METHOD__ . ': ID not unique');
- case Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID:
- Log::Log()->info(__METHOD__ . ' user failed (Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID) to log in ' . $this->getRequest()->getParam('login_name'));
- throw new Exception(__METHOD__ . ': ID unknown'); // to prevent brute force password attachs
- case Zend_Auth_Result::FAILURE_UNCATEGORIZED:
- Log::Log()->info(__METHOD__ . ' user failed (Zend_Auth_Result::FAILURE_UNCATEGORIZED) to log in ' . $this->getRequest()->getParam('login_name'));
- throw new Exception(__METHOD__ . ': unknown error');
- }
+ $code = $result->getCode();
+ switch ($code) {
+ case Zend_Auth_Result::FAILURE:
+ Log::Log()->info(__METHOD__ . ' user failed (Zend_Auth_Result::FAILURE) to log in ' . $this->getRequest()->getParam('login_name'));
+ throw new Exception(__METHOD__ . ': unknown error');
+ case Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND:
+ Log::Log()->info(__METHOD__ . ' user failed (Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND) to log in ' . $this->getRequest()->getParam('login_name'));
+ throw new Exception(__METHOD__ . ': ID unknown');
+ case Zend_Auth_Result::FAILURE_IDENTITY_AMBIGUOUS:
+ Log::Log()->info(__METHOD__ . ' user failed (Zend_Auth_Result::FAILURE_IDENTITY_AMBIGUOUS) to log in ' . $this->getRequest()->getParam('login_name'));
+ throw new Exception(__METHOD__ . ': ID not unique');
+ case Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID:
+ Log::Log()->info(__METHOD__ . ' user failed (Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID) to log in ' . $this->getRequest()->getParam('login_name'));
+ throw new Exception(__METHOD__ . ': ID unknown'); // to prevent brute force password attachs
+ case Zend_Auth_Result::FAILURE_UNCATEGORIZED:
+ Log::Log()->info(__METHOD__ . ' user failed (Zend_Auth_Result::FAILURE_UNCATEGORIZED) to log in ' . $this->getRequest()->getParam('login_name'));
+ throw new Exception(__METHOD__ . ': unknown error');
+ }
- $this->getAuthDetailsIntoSession($auth, false);
+ $this->getAuthDetailsIntoSession($auth, false);
- Log::Log()->info(__METHOD__ . ' user logged in ' . $this->view->session->authdata['authed_username'] .
- ' (' . $this->getRequest()->getParam('login_name') . ')');
+ Log::Log()->info(__METHOD__ . ' user logged in ' . $this->view->session->authdata['authed_username'] .
+ ' (' . $this->getRequest()->getParam('login_name') . ')');
- #$this->_forward('index', 'index'); // only "soft" forward, we need to change the url in browser
- $this->_redirect($this->view->url(array('controller' => 'index', 'action' => 'index'), 'default', true));
+ #$this->_forward('index', 'index'); // only "soft" forward, we need to change the url in browser
+ $this->_redirect($this->view->url(array('controller' => 'index', 'action' => 'index'), 'default', true));
- /*
- $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
- $viewRenderer->setRender('loginresult');
- $this->view->request = $this->getRequest();
- */
- }
- else {
- $this->view->form = $form;
+ /*
+ $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
+ $viewRenderer->setRender('loginresult');
+ $this->view->request = $this->getRequest();
+ */
+ }
+ else {
+ $this->view->form = $form;
return $this->render('index');
- }
+ }
}
public function crtAction() {
- $ssl_client_s_dn = GetEnv::getEnvVar('SSL_CLIENT_S_DN');
- $ssl_client_i_dn = GetEnv::getEnvVar('SSL_CLIENT_I_DN');
+ $ssl_client_s_dn = GetEnv::getEnvVar('SSL_CLIENT_S_DN');
+ $ssl_client_i_dn = GetEnv::getEnvVar('SSL_CLIENT_I_DN');
- $config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini', APPLICATION_ENV);
+ $config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini', APPLICATION_ENV);
- $db = Zend_Registry::get('auth_dbc');
- $db2 = Zend_Registry::get('auth2_dbc');
+ $db = Zend_Registry::get('auth_dbc');
+ $db2 = Zend_Registry::get('auth2_dbc');
- $auth = new Zend_Auth_Adapter_DbTable($db2);
+ $auth = new Zend_Auth_Adapter_DbTable($db2);
- $auth->setTableName($config->ca_mgr->db->auth2->tablename)
- ->setIdentityColumn('user_client_crt_s_dn_i_dn')
- ->setCredentialColumn('user_client_crt_s_dn_i_dn');
+ $auth->setTableName($config->ca_mgr->db->auth2->tablename)
+ ->setIdentityColumn('user_client_crt_s_dn_i_dn')
+ ->setCredentialColumn('user_client_crt_s_dn_i_dn');
- $auth->setIdentity( $ssl_client_s_dn . '//' . $ssl_client_i_dn)
- ->setCredential($ssl_client_s_dn . '//' . $ssl_client_i_dn)
- ->setCredentialTreatment('?');
+ $auth->setIdentity( $ssl_client_s_dn . '//' . $ssl_client_i_dn)
+ ->setCredential($ssl_client_s_dn . '//' . $ssl_client_i_dn)
+ ->setCredentialTreatment('?');
- $result = $auth->authenticate();
+ $result = $auth->authenticate();
- $code = $result->getCode();
- switch ($code) {
- case Zend_Auth_Result::FAILURE:
- Log::Log()->info(__METHOD__ . ' user failed (Zend_Auth_Result::FAILURE) to log in ' . $ssl_client_s_dn . '//' . $ssl_client_i_dn);
- throw new Exception(__METHOD__ . ': unknown error');
- case Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND:
- Log::Log()->info(__METHOD__ . ' user failed (Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND) to log in ' . $ssl_client_s_dn . '//' . $ssl_client_i_dn);
- throw new Exception(__METHOD__ . ': ID unknown');
- case Zend_Auth_Result::FAILURE_IDENTITY_AMBIGUOUS:
- Log::Log()->info(__METHOD__ . ' user failed (Zend_Auth_Result::FAILURE_IDENTITY_AMBIGUOUS) to log in ' . $ssl_client_s_dn . '//' . $ssl_client_i_dn);
- throw new Exception(__METHOD__ . ': ID not unique');
- case Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID:
- Log::Log()->info(__METHOD__ . ' user failed (Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID) to log in ' . $ssl_client_s_dn . '//' . $ssl_client_i_dn);
- throw new Exception(__METHOD__ . ': ID unknown'); // to prevent brute force password attachs
- case Zend_Auth_Result::FAILURE_UNCATEGORIZED:
- Log::Log()->info(__METHOD__ . ' user failed (Zend_Auth_Result::FAILURE_UNCATEGORIZED) to log in ' . $ssl_client_s_dn . '//' . $ssl_client_i_dn);
- throw new Exception(__METHOD__ . ': unknown error');
- }
+ $code = $result->getCode();
+ switch ($code) {
+ case Zend_Auth_Result::FAILURE:
+ Log::Log()->info(__METHOD__ . ' user failed (Zend_Auth_Result::FAILURE) to log in ' . $ssl_client_s_dn . '//' . $ssl_client_i_dn);
+ throw new Exception(__METHOD__ . ': unknown error');
+ case Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND:
+ Log::Log()->info(__METHOD__ . ' user failed (Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND) to log in ' . $ssl_client_s_dn . '//' . $ssl_client_i_dn);
+ throw new Exception(__METHOD__ . ': ID unknown');
+ case Zend_Auth_Result::FAILURE_IDENTITY_AMBIGUOUS:
+ Log::Log()->info(__METHOD__ . ' user failed (Zend_Auth_Result::FAILURE_IDENTITY_AMBIGUOUS) to log in ' . $ssl_client_s_dn . '//' . $ssl_client_i_dn);
+ throw new Exception(__METHOD__ . ': ID not unique');
+ case Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID:
+ Log::Log()->info(__METHOD__ . ' user failed (Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID) to log in ' . $ssl_client_s_dn . '//' . $ssl_client_i_dn);
+ throw new Exception(__METHOD__ . ': ID unknown'); // to prevent brute force password attachs
+ case Zend_Auth_Result::FAILURE_UNCATEGORIZED:
+ Log::Log()->info(__METHOD__ . ' user failed (Zend_Auth_Result::FAILURE_UNCATEGORIZED) to log in ' . $ssl_client_s_dn . '//' . $ssl_client_i_dn);
+ throw new Exception(__METHOD__ . ': unknown error');
+ }
- $this->getAuthDetailsIntoSession($auth, true);
+ $this->getAuthDetailsIntoSession($auth, true);
- /*
- $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
- $viewRenderer->setRender('loginresult');
- */
+ /*
+ $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
+ $viewRenderer->setRender('loginresult');
+ */
- Log::Log()->info(__METHOD__ . ' user logged in ' . $this->view->session->authdata['authed_username'] .
- ' (' . $ssl_client_s_dn . '//' . $ssl_client_i_dn . ')');
+ Log::Log()->info(__METHOD__ . ' user logged in ' . $this->view->session->authdata['authed_username'] .
+ ' (' . $ssl_client_s_dn . '//' . $ssl_client_i_dn . ')');
- #$this->_forward('index', 'index'); // only "soft" forward, we need to change the url in browser
- $this->_redirect($this->view->url(array('controller' => 'index', 'action' => 'index'), 'default', true));
+ #$this->_forward('index', 'index'); // only "soft" forward, we need to change the url in browser
+ $this->_redirect($this->view->url(array('controller' => 'index', 'action' => 'index'), 'default', true));
}
/**
* get user data from Zend_Auth result and store data in session
* @param Zend_Auth_Result $auth
*/
- protected function getAuthDetailsIntoSession($auth, $crt) {
- $session = Zend_Registry::get('session');
+ protected function getAuthDetailsIntoSession($auth, $crt) {
+ $session = Zend_Registry::get('session');
- $db = Zend_Registry::get('auth_dbc');
- $db2 = Zend_Registry::get('auth2_dbc');
+ $db = Zend_Registry::get('auth_dbc');
+ $db2 = Zend_Registry::get('auth2_dbc');
- /**
- * non existent in our case, look up a 2nd table (ca_mgr.system_user by login name (email)) and
- * get id from there, defaulting to User (1) when no db entry exists
- */
- $auth_res = $auth->getResultRowObject();
+ /**
+ * non existent in our case, look up a 2nd table (ca_mgr.system_user by login name (email)) and
+ * get id from there, defaulting to User (1) when no db entry exists
+ */
+ $auth_res = $auth->getResultRowObject();
- if (!isset($auth_res->system_role_id) || $auth_res->system_role_id == 0) {
- $res = $db2->query('select * from system_user where login=?', array($auth_res->email));
- if ($res->rowCount() > 0) {
- $res_ar = $res->fetch();
- $system_roles_id = $res_ar['system_role_id'];
- }
- else {
- // no extra user info in manager database, assume standard user
- $system_roles_id = 1;
- }
- }
- else
- $system_roles_id = $auth_res->system_role_id;
+ if (!isset($auth_res->system_role_id) || $auth_res->system_role_id == 0) {
+ $res = $db2->query('select * from system_user where login=?', array($auth_res->email));
+ if ($res->rowCount() > 0) {
+ $res_ar = $res->fetch();
+ $system_roles_id = $res_ar['system_role_id'];
+ }
+ else {
+ // no extra user info in manager database, assume standard user
+ $system_roles_id = 1;
+ }
+ }
+ else
+ $system_roles_id = $auth_res->system_role_id;
- $session->authdata['authed'] = true;
- $session->authdata['authed_id'] = $auth_res->id;
- if (!isset($auth_res->fname) || !isset($auth_res->lname)) {
- $res = $db->query('select * from users where email=?', array($auth_res->login));
- $res_ar = $res->fetch();
- $session->authdata['authed_username'] = 'crt' . $res_ar['login'];
- $session->authdata['authed_fname'] = $res_ar['fname'];
- $session->authdata['authed_lname'] = $res_ar['lname'];
- }
- else {
- $session->authdata['authed_username'] = $auth_res->email;
- $session->authdata['authed_fname'] = $auth_res->fname;
- $session->authdata['authed_lname'] = $auth_res->lname;
- }
- $session->authdata['authed_by_crt'] = $crt;
- $session->authdata['authed_by_cli'] = true;
+ $session->authdata['authed'] = true;
+ $session->authdata['authed_id'] = $auth_res->id;
+ if (!isset($auth_res->fname) || !isset($auth_res->lname)) {
+ $res = $db->query('select * from users where email=?', array($auth_res->login));
+ $res_ar = $res->fetch();
+ $session->authdata['authed_username'] = 'crt' . $res_ar['login'];
+ $session->authdata['authed_fname'] = $res_ar['fname'];
+ $session->authdata['authed_lname'] = $res_ar['lname'];
+ }
+ else {
+ $session->authdata['authed_username'] = $auth_res->email;
+ $session->authdata['authed_fname'] = $auth_res->fname;
+ $session->authdata['authed_lname'] = $auth_res->lname;
+ }
+ $session->authdata['authed_by_crt'] = $crt;
+ $session->authdata['authed_by_cli'] = true;
- $res = $db2->query('select * from system_role where id=?', array($system_roles_id));
- $res_ar = $res->fetch();
- $session->authdata['authed_role'] = $res_ar['role'];
+ $res = $db2->query('select * from system_role where id=?', array($system_roles_id));
+ $res_ar = $res->fetch();
+ $session->authdata['authed_role'] = $res_ar['role'];
- $acl = $this->makeAcl($db2);
+ $acl = $this->makeAcl($db2);
- $session->authdata['authed_permissions'] = $acl;
+ $session->authdata['authed_permissions'] = $acl;
- /* test cases
- Log::Log()->debug(($acl->isAllowed('User', 'Administration', 'view') == true)?'true':'false');
- Log::Log()->debug(($acl->isAllowed('User', 'Administration', 'edit') == true)?'true':'false');
- Log::Log()->debug(($acl->isAllowed('User', 'Account', 'view') == true)?'true':'false');
- Log::Log()->debug(($acl->isAllowed('User', 'Account', 'edit') == true)?'true':'false');
- Log::Log()->debug(($acl->isAllowed('Admin', 'Administration', 'view') == true)?'true':'false');
- Log::Log()->debug(($acl->isAllowed('Admin', 'Account', 'view') == true)?'true':'false');
- */
+ /* test cases
+ Log::Log()->debug(($acl->isAllowed('User', 'Administration', 'view') == true)?'true':'false');
+ Log::Log()->debug(($acl->isAllowed('User', 'Administration', 'edit') == true)?'true':'false');
+ Log::Log()->debug(($acl->isAllowed('User', 'Account', 'view') == true)?'true':'false');
+ Log::Log()->debug(($acl->isAllowed('User', 'Account', 'edit') == true)?'true':'false');
+ Log::Log()->debug(($acl->isAllowed('Admin', 'Administration', 'view') == true)?'true':'false');
+ Log::Log()->debug(($acl->isAllowed('Admin', 'Account', 'view') == true)?'true':'false');
+ */
- $this->view->session = $session;
- }
+ $this->view->session = $session;
+ }
/**
* build login form and return to requesting method
* @return Zend_Form
*/
protected function getForm() {
- $form = new Zend_Form();
- $form->setAction('/login/login')
- ->setMethod('post');
- #$form->setAttrib('id', 'loginform');
- $username = new Zend_Form_Element_Text('login_name');
- $username->setRequired(true)
- ->setLabel(I18n::_('User Name'))
- ->addFilter(new Zend_Filter_StringTrim())
- ->addFilter(new Zend_Filter_StripTags());
- $password = new Zend_Form_Element_Password('login_password');
- $password->setRequired(true)
- ->setLabel(I18n::_('Password'))
- ->addFilter(new Zend_Filter_StringTrim());
- $submit = new Zend_Form_Element_Submit('submit');
- $submit->setLabel(I18n::_('Login'));
- $form->addElement($username)
- ->addElement($password)
- ->addElement($submit);
+ $form = new Zend_Form();
+ $form->setAction('/login/login')
+ ->setMethod('post');
+ #$form->setAttrib('id', 'loginform');
+ $username = new Zend_Form_Element_Text('login_name');
+ $username->setRequired(true)
+ ->setLabel(I18n::_('User Name'))
+ ->addFilter(new Zend_Filter_StringTrim())
+ ->addFilter(new Zend_Filter_StripTags());
+ $password = new Zend_Form_Element_Password('login_password');
+ $password->setRequired(true)
+ ->setLabel(I18n::_('Password'))
+ ->addFilter(new Zend_Filter_StringTrim());
+ $submit = new Zend_Form_Element_Submit('submit');
+ $submit->setLabel(I18n::_('Login'));
+ $form->addElement($username)
+ ->addElement($password)
+ ->addElement($submit);
- return $form;
+ return $form;
}
/**
@@ -239,46 +239,46 @@ class LoginController extends Zend_Controller_Action
* @param Zend_Db $db
*/
protected function makeAcl($db) {
- $acl = new Zend_Acl();
+ $acl = new Zend_Acl();
- $res = $db->fetchAll('select * from system_role');
- foreach ($res as $obj) {
- if ($obj['inherit_role'] != '') {
- if ($acl->hasRole($obj['inherit_role'])) {
- $acl->addRole(new Zend_Acl_Role($obj['role']), $obj['inherit_role']);
- }
- else {
- /**
- * @todo very simply system to order roles, add role before inherited role
- */
- $res[] = $obj;
- continue;
- }
- }
- else {
- $acl->addRole(new Zend_Acl_Role($obj['role']));
- }
- }
+ $res = $db->fetchAll('select * from system_role');
+ foreach ($res as $obj) {
+ if ($obj['inherit_role'] != '') {
+ if ($acl->hasRole($obj['inherit_role'])) {
+ $acl->addRole(new Zend_Acl_Role($obj['role']), $obj['inherit_role']);
+ }
+ else {
+ /**
+ * @todo very simply system to order roles, add role before inherited role
+ */
+ $res[] = $obj;
+ continue;
+ }
+ }
+ else {
+ $acl->addRole(new Zend_Acl_Role($obj['role']));
+ }
+ }
- $res = $db->fetchAll('select * from system_resource');
- foreach ($res as $obj) {
- $acl->addResource(new Zend_Acl_Resource($obj['resource']));
- }
+ $res = $db->fetchAll('select * from system_resource');
+ foreach ($res as $obj) {
+ $acl->addResource(new Zend_Acl_Resource($obj['resource']));
+ }
- $res = $db->fetchAll('select r.role as role, rs.resource as resource, permission, privilege '.
- 'from system_role as r join system_role_has_system_resource as m on ' .
- '(r.id = m.system_role_id) join system_resource as rs on (m.system_resource_id = rs.id)');
+ $res = $db->fetchAll('select r.role as role, rs.resource as resource, permission, privilege '.
+ 'from system_role as r join system_role_has_system_resource as m on ' .
+ '(r.id = m.system_role_id) join system_resource as rs on (m.system_resource_id = rs.id)');
- foreach ($res as $obj) {
- $privilege = explode(',', $obj['privilege']);
- if ($obj['permission'] == 'allow') {
- $acl->allow($obj['role'], $obj['resource'], $privilege);
- }
- else {
- $acl->deny($obj['role'], $obj['resource'], $privilege);
- }
- }
+ foreach ($res as $obj) {
+ $privilege = explode(',', $obj['privilege']);
+ if ($obj['permission'] == 'allow') {
+ $acl->allow($obj['role'], $obj['resource'], $privilege);
+ }
+ else {
+ $acl->deny($obj['role'], $obj['resource'], $privilege);
+ }
+ }
- return $acl;
+ return $acl;
}
}
diff --git a/manager/application/controllers/LogoutController.php b/manager/application/controllers/LogoutController.php
index 6225b21..960ebed 100644
--- a/manager/application/controllers/LogoutController.php
+++ b/manager/application/controllers/LogoutController.php
@@ -15,13 +15,13 @@ class LogoutController extends Zend_Controller_Action
}
public function indexAction() {
- $session = Zend_Registry::get('session');
+ $session = Zend_Registry::get('session');
- Log::Log()->info(__METHOD__ . ' user logged out ' . $this->view->session->authdata['authed_username']);
+ Log::Log()->info(__METHOD__ . ' user logged out ' . $this->view->session->authdata['authed_username']);
- unset($session->authdata);
- $session->authdata['authed'] = false;
+ unset($session->authdata);
+ $session->authdata['authed'] = false;
- Zend_Session::destroy();
+ Zend_Session::destroy();
}
}
diff --git a/manager/application/controllers/MailController.php b/manager/application/controllers/MailController.php
index b48faad..af2fe27 100644
--- a/manager/application/controllers/MailController.php
+++ b/manager/application/controllers/MailController.php
@@ -8,60 +8,60 @@ require_once(LIBRARY_PATH . '/imap/imapConnection.php');
class MailController extends Zend_Controller_Action
{
- /**
- * list of email addresses associated with that account
- * @var array
- */
- private $addresses = array();
+ /**
+ * list of email addresses associated with that account
+ * @var array
+ */
+ private $addresses = array();
public function init()
{
/* Initialize action controller here */
- $session = Zend_Registry::get('session');
- $auth = $session->authdata['authed_permissions'];
+ $session = Zend_Registry::get('session');
+ $auth = $session->authdata['authed_permissions'];
- $action = $this->getRequest()->getActionName();
+ $action = $this->getRequest()->getActionName();
- $this->view->leftNav('' . I18n::_('View own Mails') . '', Zend_View_Helper_Placeholder_Container_Abstract::SET, 1);
- if ($session->authdata['authed_role'] == 'Admin') {
- $this->view->leftNav('' . I18n::_('View all Mails') . '', Zend_View_Helper_Placeholder_Container_Abstract::SET, 2);
- }
+ $this->view->leftNav('' . I18n::_('View own Mails') . '', Zend_View_Helper_Placeholder_Container_Abstract::SET, 1);
+ if ($session->authdata['authed_role'] == 'Admin') {
+ $this->view->leftNav('' . I18n::_('View all Mails') . '', Zend_View_Helper_Placeholder_Container_Abstract::SET, 2);
+ }
- $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);
+ $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']);
+ $this->addresses = $emails->getEmailAddressesByLogin($session->authdata['authed_username']);
}
public function indexAction()
{
- $config = Zend_Registry::get('config');
- $session = Zend_Registry::get('session');
+ $config = Zend_Registry::get('config');
+ $session = Zend_Registry::get('session');
- $imap_config = $config->imap;
+ $imap_config = $config->imap;
$imap = imapConnection::getInstance('cacert', $imap_config);
- $imap->imapSwitchMbox('INBOX');
+ $imap->imapSwitchMbox('INBOX');
$ck = $imap->imapCheck();
$headers = array();
for ($i=0; $i < $ck->Nmsgs; $i++) {
- $header = $imap->imapHeader($i+1);
+ $header = $imap->imapHeader($i+1);
- // skip all emails that do not belong to the user
- if (!in_array($header->toaddress, $this->addresses))
- continue;
+ // skip all emails that do not belong to the user
+ if (!in_array($header->toaddress, $this->addresses))
+ continue;
- $header->uid = $imap->imapUID($i+1);
- $header->detailslink = $this->view->url(array('controller' => 'mail', 'action' => 'read', 'uid' => $header->uid), 'default', true);
- $header->deletelink = $this->view->url(array('controller' => 'mail', 'action' => 'delete', 'uid' => $header->uid), 'default', true);
- $headers[] = $header;
+ $header->uid = $imap->imapUID($i+1);
+ $header->detailslink = $this->view->url(array('controller' => 'mail', 'action' => 'read', 'uid' => $header->uid), 'default', true);
+ $header->deletelink = $this->view->url(array('controller' => 'mail', 'action' => 'delete', 'uid' => $header->uid), 'default', true);
+ $headers[] = $header;
}
$this->view->headers = $headers;
@@ -69,21 +69,21 @@ class MailController extends Zend_Controller_Action
public function fullAction()
{
- $config = Zend_Registry::get('config');
+ $config = Zend_Registry::get('config');
- $imap_config = $config->imap;
+ $imap_config = $config->imap;
$imap = imapConnection::getInstance('cacert', $imap_config);
- $imap->imapSwitchMbox('INBOX');
+ $imap->imapSwitchMbox('INBOX');
$ck = $imap->imapCheck();
$headers = array();
for ($i=0; $i < $ck->Nmsgs; $i++) {
- $header = $imap->imapHeader($i+1);
- $header->uid = $imap->imapUID($i+1);
- $header->detailslink = $this->view->url(array('controller' => 'mail', 'action' => 'read', 'uid' => $header->uid), 'default', true);
- $header->deletelink = $this->view->url(array('controller' => 'mail', 'action' => 'delete', 'uid' => $header->uid), 'default', true);
- $headers[] = $header;
+ $header = $imap->imapHeader($i+1);
+ $header->uid = $imap->imapUID($i+1);
+ $header->detailslink = $this->view->url(array('controller' => 'mail', 'action' => 'read', 'uid' => $header->uid), 'default', true);
+ $header->deletelink = $this->view->url(array('controller' => 'mail', 'action' => 'delete', 'uid' => $header->uid), 'default', true);
+ $headers[] = $header;
}
$this->view->headers = $headers;
@@ -91,50 +91,50 @@ class MailController extends Zend_Controller_Action
public function readAction()
{
- $config = Zend_Registry::get('config');
- $imap_config = $config->imap;
+ $config = Zend_Registry::get('config');
+ $imap_config = $config->imap;
$imap = imapConnection::getInstance('cacert', $imap_config);
- $imap->imapSwitchMbox('INBOX');
+ $imap->imapSwitchMbox('INBOX');
- $uid = $this->getRequest()->getParam('uid');
+ $uid = $this->getRequest()->getParam('uid');
- $body = $imap->imapBodyByUID($uid);
+ $body = $imap->imapBodyByUID($uid);
- $this->view->mail_body = $body;
+ $this->view->mail_body = $body;
}
/**
* delete message with unique id
*/
- public function deleteAction()
+ public function deleteAction()
{
- $config = Zend_Registry::get('config');
- $uid = $this->getRequest()->getParam('uid', -1);
- $this->view->returnto = $_SERVER['HTTP_REFERER'];
+ $config = Zend_Registry::get('config');
+ $uid = $this->getRequest()->getParam('uid', -1);
+ $this->view->returnto = $_SERVER['HTTP_REFERER'];
- if ($uid == -1) {
- $this->view->message = I18n::_('You did not select an email for deletion');
- }
- elseif ($this->view->returnto == '') {
- $this->view->message = I18n::_('Please use the delete icons in the mail inventory to delete mails');
- }
- else {
- $imap_config = $config->imap;
- $imap = imapConnection::getInstance('cacert', $imap_config);
- $imap->imapSwitchMbox('INBOX');
+ if ($uid == -1) {
+ $this->view->message = I18n::_('You did not select an email for deletion');
+ }
+ elseif ($this->view->returnto == '') {
+ $this->view->message = I18n::_('Please use the delete icons in the mail inventory to delete mails');
+ }
+ else {
+ $imap_config = $config->imap;
+ $imap = imapConnection::getInstance('cacert', $imap_config);
+ $imap->imapSwitchMbox('INBOX');
- $header = $imap->imapFetchOverview($uid);
+ $header = $imap->imapFetchOverview($uid);
- $session = Zend_Registry::get('session');
+ $session = Zend_Registry::get('session');
- if ($session->authdata['authed_role'] != 'Admin' && !in_array($header->to, $this->addresses)) {
- $this->view->message = I18n::_('This message does not belong to you');
- }
- else {
- $imap->imapDelete($uid);
- $imap->imapExpunge();
- $this->view->message = I18n::_('Message deleted');
- }
- }
+ if ($session->authdata['authed_role'] != 'Admin' && !in_array($header->to, $this->addresses)) {
+ $this->view->message = I18n::_('This message does not belong to you');
+ }
+ else {
+ $imap->imapDelete($uid);
+ $imap->imapExpunge();
+ $this->view->message = I18n::_('Message deleted');
+ }
+ }
}
}
diff --git a/manager/application/controllers/ManageAccountController.php b/manager/application/controllers/ManageAccountController.php
index 1bf9700..e2e4a5a 100644
--- a/manager/application/controllers/ManageAccountController.php
+++ b/manager/application/controllers/ManageAccountController.php
@@ -8,12 +8,12 @@ class ManageAccountController extends Zend_Controller_Action
const MAX_POINTS_PER_ASSURANCE = 35;
const MAX_POINTS_TOTAL = 150;
const ADMIN_INCREASE_FRAGMENT_SIZE = 2;
-
+
// Value used in the database to identify a admin increase
const ADMIN_INCREASE_METHOD = 'Administrative Increase';
-
+
protected $db;
-
+
public function init()
{
$config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini',
@@ -21,7 +21,7 @@ class ManageAccountController extends Zend_Controller_Action
$this->db = Zend_Db::factory($config->ca_mgr->db->auth->pdo,
$config->ca_mgr->db->auth);
-
+
// Build the left navigation
$actions = array();
$actions['assurance'] = I18n::_('Automated Assurance');
@@ -35,16 +35,16 @@ class ManageAccountController extends Zend_Controller_Action
$link = ''.
$label . '';
$this->view->leftNav($link);
- }
-
+ }
+
}
-
+
public function indexAction()
{
// Just render the view
return;
}
-
+
public function assuranceAction()
{
// Validate form
@@ -53,13 +53,13 @@ class ManageAccountController extends Zend_Controller_Action
$this->view->assurance_form = $form;
return $this->render('assuranceform');
}
-
+
// Form is valid -> get values for processing
$values = $form->getValues();
-
+
// Get the current user
$user = Default_Model_User::findCurrentUser();
-
+
$this->view->assurancesDone = array();
$quantity = $values['quantity'];
do {
@@ -71,56 +71,56 @@ class ManageAccountController extends Zend_Controller_Action
$points = $quantity;
$quantity = 0;
}
-
+
// Get the assurer for this assurance
$issued = $user->findNewAssurer()
->assure($user, $points, $values['location'], $values['date']);
-
+
$this->view->assurancesDone[] = $issued;
} while ($quantity > 0);
-
+
return;
}
-
+
public function batchAssuranceAction() {
- // Validate form
+ // Validate form
$form = $this->getBatchAssuranceForm();
if (!$this->getRequest()->isPost() || !$form->isValid($_POST)) {
$this->view->batch_assurance_form = $form;
return $this->render('batch-assurance-form');
}
-
+
// Form is valid -> get values for processing
$values = $form->getValues();
-
+
$user = Default_Model_User::findCurrentUser();
-
+
$location = $values['location'];
$date = $values['date'];
-
+
$this->view->assurances = array();
-
+
for ($i = 0; $i < intval($values['quantity']); $i++) {
$assuree = $user->findNewAssuree();
-
+
if ($values['percentage'] === 'percentage') {
$points = ($user->maxpoints() * intval($values['points'])) /100;
}elseif ($values['percentage'] === 'absolute') {
$points = intval($values['points']);
}
-
+
$user->assure($assuree, $points, $location, $date);
-
+
$this->view->assurances[] = array(
'assuree'=>$assuree->getPrimEmail(),
'points'=>$points,
'location'=>$location,
'date'=>$date);
}
-
+
return;
}
-
+
public function adminIncreaseAction()
{
// Validate form
@@ -129,16 +129,16 @@ class ManageAccountController extends Zend_Controller_Action
$this->view->admin_increase_form = $form;
return $this->render('admin-increase-form');
}
-
+
// Form is valid -> get values for processing
$values = $form->getValues();
-
+
// Get current user
$user = Default_Model_User::findCurrentUser();
-
+
$this->view->adminIncreasesDone = array();
$points = $values['points'];
-
+
// Only assign points within the limit if unlimited flag is not set
if ($values['unlimited'] != '1') {
if ($user->getPoints() >= self::MAX_POINTS_TOTAL) {
@@ -148,14 +148,14 @@ class ManageAccountController extends Zend_Controller_Action
$points = self::MAX_POINTS_TOTAL - $user->getPoints();
}
}
-
+
$user->adminIncrease($points, $values['location'], $values['date']);
$this->view->adminIncreasesDone[] = $points;
-
+
return;
}
-
-
+
+
public function assurerChallengeAction()
{
// Validate form
@@ -164,27 +164,27 @@ class ManageAccountController extends Zend_Controller_Action
$this->view->assurer_challenge_form = $form;
return $this->render('assurer-challenge-form');
}
-
+
// Form is valid -> get values for processing
$values = $form->getValues();
-
+
// Get user data
$user = Default_Model_User::findCurrentUser();
-
+
$user->assignChallenge(1, $values['variant']);
}
-
+
public function flagsAction()
{
$user = Default_Model_User::findCurrentUser();
-
+
// Validate form
$form = $this->getFlagsForm($user);
$this->view->flags_form = $form;
if (!$this->getRequest()->isPost() || !$form->isValid($_POST)) {
return;
}
-
+
$flags = $user->getFlags();
foreach ($flags as $flag => $value) {
$element = $form->getElement($flag);
@@ -192,48 +192,48 @@ class ManageAccountController extends Zend_Controller_Action
$flags[$flag] = $element->isChecked();
}
}
-
+
$user->setFlags($flags);
return;
}
-
+
protected function getAssuranceForm()
{
$form = new Zend_Form();
$form->setAction('/manage-account/assurance')->setMethod('post');
-
+
$quantity = new Zend_Form_Element_Text('quantity');
$quantity->setRequired(true)
->setLabel(I18n::_('Number of Points'))
->addFilter(new Zend_Filter_Int())
->addValidator(new Zend_Validate_Between(0, 100));
$form->addElement($quantity);
-
+
$location = new Zend_Form_Element_Text('location');
$location->setRequired(true)
->setLabel(I18n::_('Location'))
->setValue(I18n::_('CAcert Test Manager'))
->addValidator(new Zend_Validate_StringLength(1,255));
$form->addElement($location);
-
+
$date = new Zend_Form_Element_Text('date');
$date->setRequired(true)
->setLabel(I18n::_('Date of Assurance'))
->setValue(date('Y-m-d H:i:s'))
->addValidator(new Zend_Validate_StringLength(1,255));
$form->addElement($date);
-
+
$submit = new Zend_Form_Element_Submit('submit');
$submit->setLabel(I18n::_('Assure Me'));
$form->addElement($submit);
-
+
return $form;
}
-
+
protected function getBatchAssuranceForm() {
- $form = new Zend_Form();
+ $form = new Zend_Form();
$form->setAction('/manage-account/batch-assurance')->setMethod('post');
-
+
$quantity = new Zend_Form_Element_Text('quantity');
$quantity->setRequired(true)
->setLabel(I18n::_('Number of Assurances'))
@@ -241,17 +241,17 @@ class ManageAccountController extends Zend_Controller_Action
->addFilter(new Zend_Filter_Int())
->addValidator(new Zend_Validate_Between(0, 100));
$form->addElement($quantity);
-
+
$percentage = new Zend_Form_Element_Select('percentage');
$percentage->setRequired(true)
->setLabel(I18n::_('Are the points specified absolute?'))
->setValue('percentage')
->setMultiOptions(array(
- 'percentage' => I18n::_('Percentage'),
+ 'percentage' => I18n::_('Percentage'),
'absolute' => I18n::_('Absolute'),
));
$form->addElement($percentage);
-
+
$points = new Zend_Form_Element_Text('points');
$points->setRequired(true)
->setLabel(I18n::_('Points per Assurance'))
@@ -259,73 +259,73 @@ class ManageAccountController extends Zend_Controller_Action
->addFilter(new Zend_Filter_Int())
->addValidator(new Zend_Validate_Between(0, 100));
$form->addElement($points);
-
+
$location = new Zend_Form_Element_Text('location');
$location->setRequired(true)
->setLabel(I18n::_('Location'))
->setValue(I18n::_('CAcert Test Manager Batch Assurance'))
->addValidator(new Zend_Validate_StringLength(1,255));
$form->addElement($location);
-
+
$date = new Zend_Form_Element_Text('date');
$date->setRequired(true)
->setLabel(I18n::_('Date of Assurance'))
->setValue(date('Y-m-d H:i:s'))
->addValidator(new Zend_Validate_StringLength(1,255));
$form->addElement($date);
-
+
$submit = new Zend_Form_Element_Submit('submit');
$submit->setLabel(I18n::_('Make Batch Assurance'));
$form->addElement($submit);
-
+
return $form;
}
-
+
protected function getAdminIncreaseForm()
{
$form = new Zend_Form();
$form->setAction('/manage-account/admin-increase')->setMethod('post');
-
+
$points = new Zend_Form_Element_Text('points');
$points->setRequired(true)
->setLabel(I18n::_('Number of Points'))
->addFilter(new Zend_Filter_Int())
->addValidator(new Zend_Validate_GreaterThan(0));
$form->addElement($points);
-
+
$unlimited = new Zend_Form_Element_Checkbox('unlimited');
$unlimited->setLabel(I18n::_('Assign Points even if the Limit of 150 '.
'is exceeded'))
->setChecked(false);
$form->addElement($unlimited);
-
+
$location = new Zend_Form_Element_Text('location');
$location->setRequired(true)
->setLabel(I18n::_('Location'))
->setValue(I18n::_('CAcert Test Manager'))
->addValidator(new Zend_Validate_StringLength(1,255));
$form->addElement($location);
-
+
$date = new Zend_Form_Element_Text('date');
$date->setRequired(true)
->setLabel(I18n::_('Date of Increase'))
->setValue(date('Y-m-d H:i:s'))
->addValidator(new Zend_Validate_StringLength(1,255));
$form->addElement($date);
-
+
$submit = new Zend_Form_Element_Submit('submit');
$submit->setLabel(I18n::_('Give Me Points'));
$form->addElement($submit);
-
+
return $form;
}
-
+
protected function getAssurerChallengeForm()
{
$form = new Zend_Form();
$form->setAction('/manage-account/assurer-challenge')
->setMethod('post');
-
+
$variant = new Zend_Form_Element_Select('variant');
$variant->setLabel(I18n::_('Variant'));
$options =
@@ -333,22 +333,22 @@ class ManageAccountController extends Zend_Controller_Action
$variant->setMultiOptions($options)
->setRequired(true);
$form->addElement($variant);
-
+
$submit = new Zend_Form_Element_Submit('submit');
$submit->setLabel(I18n::_('Challenge Me'));
$form->addElement($submit);
-
+
return $form;
}
-
+
protected function getFlagsForm(Default_Model_User $user)
{
$form = new Zend_Form();
$form->setAction('/manage-account/flags')
->setMethod('post');
-
+
$flags = $user->getFlags();
-
+
// Add a checkbox for each flag
$labels = array();
$labels['admin'] = I18n::_('Support Engineer');
@@ -360,18 +360,18 @@ class ManageAccountController extends Zend_Controller_Action
$labels['tverify'] = I18n::_('TVerify');
$labels['locked'] = I18n::_('Lock Account');
$labels['assurer_blocked'] = I18n::_('Block Assurer');
-
+
foreach ($labels as $flag => $label) {
$checkbox = new Zend_Form_Element_Checkbox($flag);
$checkbox->setLabel($label)
->setChecked($flags[$flag]);
$form->addElement($checkbox);
}
-
+
$submit = new Zend_Form_Element_Submit('submit');
$submit->setLabel(I18n::_('Save Flags'));
$form->addElement($submit);
-
+
return $form;
}
}
diff --git a/manager/application/layouts/scripts/layout.phtml b/manager/application/layouts/scripts/layout.phtml
index ffb5763..817815a 100644
--- a/manager/application/layouts/scripts/layout.phtml
+++ b/manager/application/layouts/scripts/layout.phtml
@@ -10,23 +10,23 @@ print $this->doctype(); ?>
headScript()->appendFile('/js/positionUserInfo.js'); // ->appendFile('/js/center.js'); ?>
-
-
+
+
-
- leftNav(); ?>
-
-
- layout()->content; ?>
-
-
- print $this->userInfo(); ?>
+
+ leftNav(); ?>
+
+
+ layout()->content; ?>
+
+
+ print $this->userInfo(); ?>
-