summaryrefslogtreecommitdiff
path: root/manager/application
diff options
context:
space:
mode:
authorINOPIAE <inopiae@cacert.org>2015-08-09 19:12:51 +0200
committerBenny Baumann <BenBE@geshi.org>2015-08-09 22:23:21 +0200
commit4edd7b57c0057f9cfab0874a198256b87bd018b7 (patch)
tree2a623eade7fea29bda28e15692991821448c8fe1 /manager/application
parentce38587c8459587d7a03002ebcb4427ed95fb85c (diff)
downloadcacert-mgr-4edd7b57c0057f9cfab0874a198256b87bd018b7.tar.gz
cacert-mgr-4edd7b57c0057f9cfab0874a198256b87bd018b7.tar.xz
cacert-mgr-4edd7b57c0057f9cfab0874a198256b87bd018b7.zip
bug 1396: Codestyle cleanup
Diffstat (limited to 'manager/application')
-rw-r--r--manager/application/Bootstrap.php270
-rw-r--r--manager/application/configs/application.ini.ca-mgr148
-rw-r--r--manager/application/configs/application.ini.mawatest50
-rw-r--r--manager/application/controllers/ErrorController.php4
-rw-r--r--manager/application/controllers/IndexController.php8
-rw-r--r--manager/application/controllers/LoginController.php464
-rw-r--r--manager/application/controllers/LogoutController.php10
-rw-r--r--manager/application/controllers/MailController.php154
-rw-r--r--manager/application/controllers/ManageAccountController.php148
-rw-r--r--manager/application/layouts/scripts/layout.phtml36
-rw-r--r--manager/application/models/User.php16
-rw-r--r--manager/application/views/helpers/LeftNav.php14
-rw-r--r--manager/application/views/helpers/TopNav.php14
-rw-r--r--manager/application/views/helpers/UserInfo.php38
-rw-r--r--manager/application/views/scripts/mail/full.phtml38
-rw-r--r--manager/application/views/scripts/mail/index.phtml38
-rw-r--r--manager/application/views/scripts/manage-account/assurance.phtml16
-rw-r--r--manager/application/views/scripts/manage-account/batch-assurance-form.phtml22
-rw-r--r--manager/application/views/scripts/manage-account/batch-assurance.phtml32
19 files changed, 710 insertions, 710 deletions
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');
-
- $fc = Zend_Controller_Front::getInstance();
-
- $charset_header = new CharsetHeader();
- $fc->registerPlugin($charset_header);
-
- $force_auth = new ForceAuth();
- $fc->registerPlugin($force_auth);
-
- $buildmenu = new BuildMenu();
- $fc->registerPlugin($buildmenu);
-
- $loginlogout = new LoginLogout();
- $fc->registerPlugin($loginlogout);
- }
-
- 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');
- }
-
- /**
- * @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']);
-
- /**
- * 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'
- );
-
- //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);
-
- //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);
-
- 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);
-
- Zend_Registry::set('config', $config);
- Zend_Registry::set('config_dbc', $db);
-
- return $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']);
-
- 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');
-
- $I18n = I18n::getInstance(L10n::getInstance()->getLanguage());
- }
-
- /**
- * make singleton L10n (localization) object (set locale, convert date and
- * number formats)
- */
- public function _initL10n() {
- $this->bootstrap('Config');
-
- $L10n = L10n::getInstance();
- }
+ protected function _initPlugins() {
+ $this->bootstrap('session');
+
+ $fc = Zend_Controller_Front::getInstance();
+
+ $charset_header = new CharsetHeader();
+ $fc->registerPlugin($charset_header);
+
+ $force_auth = new ForceAuth();
+ $fc->registerPlugin($force_auth);
+
+ $buildmenu = new BuildMenu();
+ $fc->registerPlugin($buildmenu);
+
+ $loginlogout = new LoginLogout();
+ $fc->registerPlugin($loginlogout);
+ }
+
+ 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');
+ }
+
+ /**
+ * @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']);
+
+ /**
+ * 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'
+ );
+
+ //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);
+
+ //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);
+
+ 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);
+
+ Zend_Registry::set('config', $config);
+ Zend_Registry::set('config_dbc', $db);
+
+ return $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']);
+
+ 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');
+
+ $I18n = I18n::getInstance(L10n::getInstance()->getLanguage());
+ }
+
+ /**
+ * make singleton L10n (localization) object (set locale, convert date and
+ * number formats)
+ */
+ public function _initL10n() {
+ $this->bootstrap('Config');
+
+ $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('?');
-
- $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');
- }
-
- $this->getAuthDetailsIntoSession($auth, false);
-
- 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));
-
- /*
- $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
- $viewRenderer->setRender('loginresult');
- $this->view->request = $this->getRequest();
- */
- }
- else {
- $this->view->form = $form;
+ $auth->setIdentity( $this->getRequest()->getParam('login_name'))
+ ->setCredential( sha1(utf8_decode($this->getRequest()->getParam('login_password'))))
+ ->setCredentialTreatment('?');
+
+ $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');
+ }
+
+ $this->getAuthDetailsIntoSession($auth, false);
+
+ 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));
+
+ /*
+ $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');
-
- $config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini', APPLICATION_ENV);
-
- $db = Zend_Registry::get('auth_dbc');
- $db2 = Zend_Registry::get('auth2_dbc');
-
- $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->setIdentity( $ssl_client_s_dn . '//' . $ssl_client_i_dn)
- ->setCredential($ssl_client_s_dn . '//' . $ssl_client_i_dn)
- ->setCredentialTreatment('?');
-
- $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');
- }
-
- $this->getAuthDetailsIntoSession($auth, true);
-
- /*
- $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 . ')');
-
- #$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));
+ $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);
+
+ $db = Zend_Registry::get('auth_dbc');
+ $db2 = Zend_Registry::get('auth2_dbc');
+
+ $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->setIdentity( $ssl_client_s_dn . '//' . $ssl_client_i_dn)
+ ->setCredential($ssl_client_s_dn . '//' . $ssl_client_i_dn)
+ ->setCredentialTreatment('?');
+
+ $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');
+ }
+
+ $this->getAuthDetailsIntoSession($auth, true);
+
+ /*
+ $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 . ')');
+
+ #$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');
-
- $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();
-
- 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;
-
- $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);
-
- $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');
- */
-
- $this->view->session = $session;
- }
+ protected function getAuthDetailsIntoSession($auth, $crt) {
+ $session = Zend_Registry::get('session');
+
+ $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();
+
+ 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;
+
+ $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);
+
+ $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');
+ */
+
+ $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);
-
- return $form;
+ $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;
}
/**
@@ -239,46 +239,46 @@ class LoginController extends Zend_Controller_Action
* @param Zend_Db $db
*/
protected function makeAcl($db) {
- $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_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)');
-
- 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;
+ $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_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)');
+
+ 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;
}
}
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'];
-
- $action = $this->getRequest()->getActionName();
-
- $this->view->leftNav('<a href="' .
- $this->view->url(array('controller' => 'mail', 'action' => 'index'), 'default', true) .
- '"' . (($action == 'index')?' class="active"':'') . '>' . I18n::_('View own Mails') . '</a>', Zend_View_Helper_Placeholder_Container_Abstract::SET, 1);
- if ($session->authdata['authed_role'] == 'Admin') {
- $this->view->leftNav('<a href="' .
- $this->view->url(array('controller' => 'mail', 'action' => 'full'), 'default', true) .
- '"' . (($action == 'full')?' class="active"':'') . '>' . I18n::_('View all Mails') . '</a>', Zend_View_Helper_Placeholder_Container_Abstract::SET, 2);
- }
+ $session = Zend_Registry::get('session');
+ $auth = $session->authdata['authed_permissions'];
+
+ $action = $this->getRequest()->getActionName();
+
+ $this->view->leftNav('<a href="' .
+ $this->view->url(array('controller' => 'mail', 'action' => 'index'), 'default', true) .
+ '"' . (($action == 'index')?' class="active"':'') . '>' . I18n::_('View own Mails') . '</a>', Zend_View_Helper_Placeholder_Container_Abstract::SET, 1);
+ if ($session->authdata['authed_role'] == 'Admin') {
+ $this->view->leftNav('<a href="' .
+ $this->view->url(array('controller' => 'mail', 'action' => 'full'), 'default', true) .
+ '"' . (($action == 'full')?' class="active"':'') . '>' . I18n::_('View all Mails') . '</a>', 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'];
-
- 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);
-
- $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');
- }
- }
+ $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');
+
+ $header = $imap->imapFetchOverview($uid);
+
+ $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');
+ }
+ }
}
}
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 = '<a href="'.$this->view->url($url, 'default', true).'">'.
$label . '</a>';
$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(); ?>
<?php print $this->headScript()->appendFile('/js/positionUserInfo.js'); // ->appendFile('/js/center.js'); ?>
</head>
<body>
- <div id="center">
- <div id="header">
- <div id="header-logo">
- <img src="/img/cacert4.png" border="0" alt="CACert Logo" width="100px" height="30px">
- </div>
- <div id="header-navigation">
- <?php print $this->topNav(); ?>
- </div>
- </div>
+ <div id="center">
+ <div id="header">
+ <div id="header-logo">
+ <img src="/img/cacert4.png" border="0" alt="CACert Logo" width="100px" height="30px">
+ </div>
+ <div id="header-navigation">
+ <?php print $this->topNav(); ?>
+ </div>
+ </div>
- <div id="left-navigation">
- <?php print $this->leftNav(); ?>
- </div>
- <div id="content">
- <?php print $this->layout()->content; ?>
- </div>
- </div>
- <? print $this->userInfo(); ?>
+ <div id="left-navigation">
+ <?php print $this->leftNav(); ?>
+ </div>
+ <div id="content">
+ <?php print $this->layout()->content; ?>
+ </div>
+ </div>
+ <? print $this->userInfo(); ?>
</body>
-</html>
+</html> \ No newline at end of file
diff --git a/manager/application/models/User.php b/manager/application/models/User.php
index 7bbe090..d03ce75 100644
--- a/manager/application/models/User.php
+++ b/manager/application/models/User.php
@@ -133,7 +133,7 @@ class Default_Model_User {
* Get points of the user
*
* @return int
- * The amount of points the user has
+ * The amount of points the user has
*/
public function getPoints()
{
@@ -238,8 +238,8 @@ class Default_Model_User {
* @throws Exception
*
* @return int
- * The amount of points that have been issued (might be less than
- * $points)
+ * The amount of points that have been issued (might be less than
+ * $points)
*/
public function assure(Default_Model_User $assuree, $points, $location, $date) {
// Sanitize inputs
@@ -373,7 +373,7 @@ class Default_Model_User {
* Get the challenge types that are available in the database
*
* @param $db Zend_Db_Adapter_Abstract
- * The database connection to use
+ * The database connection to use
*
* @return array(int => string)
*/
@@ -388,7 +388,7 @@ class Default_Model_User {
* database
*
* @param $db Zend_Db_Adapter_Abstract
- * The database connection to use
+ * The database connection to use
* @param $type int
* The type of challenge you want to get the variants of
*
@@ -406,10 +406,10 @@ class Default_Model_User {
* Assign the challenge to the user
*
* @param $type int
- * The type of the challenge, has to be one of the keys returned by
+ * The type of the challenge, has to be one of the keys returned by
* getAvailableChallengeTypes()
* @param $variant int
- * The variant of the challenge, has to be one of the keys returned by
+ * The variant of the challenge, has to be one of the keys returned by
* getAvailableChallengeVariants()
* @param $date Zend_Date
* The date the challenge was passed, defaults to current time
@@ -467,7 +467,7 @@ class Default_Model_User {
* getFlags() first
*
* @param $flags array (string => boolean)
- * Currently unknown flags are silently ignored
+ * Currently unknown flags are silently ignored
*/
public function setFlags(array $flags) {
$newflags = array();
diff --git a/manager/application/views/helpers/LeftNav.php b/manager/application/views/helpers/LeftNav.php
index 8c1e220..9d8c2e2 100644
--- a/manager/application/views/helpers/LeftNav.php
+++ b/manager/application/views/helpers/LeftNav.php
@@ -54,13 +54,13 @@ class Zend_View_Helper_LeftNav extends Zend_View_Helper_Placeholder_Container_St
*/
public function leftNav($link = null, $setType = Zend_View_Helper_Placeholder_Container_Abstract::APPEND, $setPos = 0)
{
- $link = (string) $link;
+ $link = (string) $link;
if ($link !== '') {
if ($setType == Zend_View_Helper_Placeholder_Container_Abstract::SET) {
if ($setPos != 0)
- $this->items[$setPos] = $link;
+ $this->items[$setPos] = $link;
else
- $this->items[] = $link;
+ $this->items[] = $link;
} elseif ($setType == Zend_View_Helper_Placeholder_Container_Abstract::PREPEND) {
$this->items = array_merge(array($link), $this->items);
} else {
@@ -80,16 +80,16 @@ class Zend_View_Helper_LeftNav extends Zend_View_Helper_Placeholder_Container_St
*/
public function toString($indent = null, $locale = null)
{
- $output = '';
- $indent = (null !== $indent)
+ $output = '';
+ $indent = (null !== $indent)
? $this->getWhitespace($indent)
: $this->getIndent();
$output .= $indent . "<ul>\n";
foreach ($this->items as $item) {
$output .= $indent . "<li>" . $item . "</li>\n";
- }
- $output .= $indent . "</ul>\n";
+ }
+ $output .= $indent . "</ul>\n";
return $output;
}
diff --git a/manager/application/views/helpers/TopNav.php b/manager/application/views/helpers/TopNav.php
index 79da7dc..2cc2151 100644
--- a/manager/application/views/helpers/TopNav.php
+++ b/manager/application/views/helpers/TopNav.php
@@ -54,13 +54,13 @@ class Zend_View_Helper_TopNav extends Zend_View_Helper_Placeholder_Container_Sta
*/
public function topNav($link = null, $setType = Zend_View_Helper_Placeholder_Container_Abstract::APPEND, $setPos = 0)
{
- $link = (string) $link;
+ $link = (string) $link;
if ($link !== '') {
if ($setType == Zend_View_Helper_Placeholder_Container_Abstract::SET) {
if ($setPos != 0)
- $this->items[$setPos] = $link;
+ $this->items[$setPos] = $link;
else
- $this->items[] = $link;
+ $this->items[] = $link;
} elseif ($setType == Zend_View_Helper_Placeholder_Container_Abstract::PREPEND) {
$this->items = array_merge(array($link), $this->items);
} else {
@@ -80,8 +80,8 @@ class Zend_View_Helper_TopNav extends Zend_View_Helper_Placeholder_Container_Sta
*/
public function toString($indent = null, $locale = null)
{
- $output = '';
- $indent = (null !== $indent)
+ $output = '';
+ $indent = (null !== $indent)
? $this->getWhitespace($indent)
: $this->getIndent();
@@ -91,8 +91,8 @@ class Zend_View_Helper_TopNav extends Zend_View_Helper_Placeholder_Container_Sta
foreach ($this->items as $item) {
$output .= $indent . "<li>" . $item . "</li>\n";
- }
- $output .= $indent . "</ul>\n";
+ }
+ $output .= $indent . "</ul>\n";
return $output;
}
diff --git a/manager/application/views/helpers/UserInfo.php b/manager/application/views/helpers/UserInfo.php
index e203a55..bf98f1b 100644
--- a/manager/application/views/helpers/UserInfo.php
+++ b/manager/application/views/helpers/UserInfo.php
@@ -52,10 +52,10 @@ class Zend_View_Helper_UserInfo extends Zend_View_Helper_Placeholder_Container_S
*/
public function UserInfo($ar = null, $setType = Zend_View_Helper_Placeholder_Container_Abstract::APPEND, $setPos = 0)
{
- if ($ar !== null && is_array($ar)) {
- $this->items = $ar;
- }
- return $this;
+ if ($ar !== null && is_array($ar)) {
+ $this->items = $ar;
+ }
+ return $this;
}
/**
@@ -67,28 +67,28 @@ class Zend_View_Helper_UserInfo extends Zend_View_Helper_Placeholder_Container_S
*/
public function toString($indent = null, $locale = null)
{
- $session = Zend_Registry::get('session');
- $this->items = $session->authdata;
+ $session = Zend_Registry::get('session');
+ $this->items = $session->authdata;
- $output = '';
+ $output = '';
- if ($session->authdata['authed'] !== true)
- return $output;
+ if ($session->authdata['authed'] !== true)
+ return $output;
-# $indent = (null !== $indent)
+# $indent = (null !== $indent)
# ? $this->getWhitespace($indent)
# : $this->getIndent();
- $indent = '';
+ $indent = '';
$output .= $indent . "<div id=\"userinfo\">\n";
- $output .= $indent . "\tUser: " . $this->items['authed_username'] . "<br>\n";
- $output .= $indent . "\tName: " . $this->items['authed_fname'] . ' ' . $this->items['authed_lname'] . "<br>\n";
- $output .= $indent . "\tRole: " . $this->items['authed_role'] . "<br>\n";
- if ($this->items['authed_by_crt'] === true)
- $output .= $indent . "\tLoginmethod: CRT<br>\n";
- else
- $output .= $indent . "\tLoginmethod: PASSWD<br>\n";
- $output .= $indent . "</div>\n";
+ $output .= $indent . "\tUser: " . $this->items['authed_username'] . "<br>\n";
+ $output .= $indent . "\tName: " . $this->items['authed_fname'] . ' ' . $this->items['authed_lname'] . "<br>\n";
+ $output .= $indent . "\tRole: " . $this->items['authed_role'] . "<br>\n";
+ if ($this->items['authed_by_crt'] === true)
+ $output .= $indent . "\tLoginmethod: CRT<br>\n";
+ else
+ $output .= $indent . "\tLoginmethod: PASSWD<br>\n";
+ $output .= $indent . "</div>\n";
return $output;
}
diff --git a/manager/application/views/scripts/mail/full.phtml b/manager/application/views/scripts/mail/full.phtml
index 4e6d42f..1bfed87 100644
--- a/manager/application/views/scripts/mail/full.phtml
+++ b/manager/application/views/scripts/mail/full.phtml
@@ -8,30 +8,30 @@ $this->headLink()->appendStylesheet('/css/mail.css');
<H1><?php print I18n::_('View all Mail'); ?></H1>
<?php
if (count($this->headers) == 0) {
- print I18n::_('You currently have no mail.');
+ print I18n::_('You currently have no mail.');
}
else {
?>
<table>
- <tr>
- <th class="col1"><?php print I18n::_('From');?></th>
- <th class="col2"><?php print I18n::_('To');?></th>
- <th class="col3"><?php print I18n::_('Subject');?></th>
- <th class="col4"><?php print I18n::_('Date');?></th>
- <th class="col5"><?php print I18n::_('Size');?></th>
- <th class="col6"><?php print I18n::_('Del');?></th>
- </tr>
+ <tr>
+ <th class="col1"><?php print I18n::_('From');?></th>
+ <th class="col2"><?php print I18n::_('To');?></th>
+ <th class="col3"><?php print I18n::_('Subject');?></th>
+ <th class="col4"><?php print I18n::_('Date');?></th>
+ <th class="col5"><?php print I18n::_('Size');?></th>
+ <th class="col6"><?php print I18n::_('Del');?></th>
+ </tr>
<?php
- foreach ($this->headers as $header) {
- print " <tr>\n";
- print " <td><a href=\"" . $header->detailslink . "\">" . $header->fromaddress . "</a></td>";
- print " <td>" . $header->toaddress . "</td>";
- print " <td>" . $header->subject . "</td>";
- print " <td>" . $header->date . "</td>";
- print " <td>" . $header->Size . "</td>";
- print " <td><a class=\"delete\" href=\"" . $header->deletelink . "\"><img src=\"/img/delete_icon.jpg\"></a></td>";
- print " </tr>\n";
- }
+ foreach ($this->headers as $header) {
+ print " <tr>\n";
+ print " <td><a href=\"" . $header->detailslink . "\">" . $header->fromaddress . "</a></td>";
+ print " <td>" . $header->toaddress . "</td>";
+ print " <td>" . $header->subject . "</td>";
+ print " <td>" . $header->date . "</td>";
+ print " <td>" . $header->Size . "</td>";
+ print " <td><a class=\"delete\" href=\"" . $header->deletelink . "\"><img src=\"/img/delete_icon.jpg\"></a></td>";
+ print " </tr>\n";
+ }
}
?>
</table>
diff --git a/manager/application/views/scripts/mail/index.phtml b/manager/application/views/scripts/mail/index.phtml
index f63e4c4..427d0e9 100644
--- a/manager/application/views/scripts/mail/index.phtml
+++ b/manager/application/views/scripts/mail/index.phtml
@@ -8,30 +8,30 @@ $this->headLink()->appendStylesheet('/css/mail.css');
<H1><?php print I18n::_('View own Mail'); ?></H1>
<?php
if (count($this->headers) == 0) {
- print I18n::_('You currently have no mail.');
+ print I18n::_('You currently have no mail.');
}
else {
?>
<table>
- <tr>
- <th class="col1"><?php print I18n::_('From');?></th>
- <th class="col2"><?php print I18n::_('To');?></th>
- <th class="col3"><?php print I18n::_('Subject');?></th>
- <th class="col4"><?php print I18n::_('Date');?></th>
- <th class="col5"><?php print I18n::_('Size');?></th>
- <th class="col6"><?php print I18n::_('Del');?></th>
- </tr>
+ <tr>
+ <th class="col1"><?php print I18n::_('From');?></th>
+ <th class="col2"><?php print I18n::_('To');?></th>
+ <th class="col3"><?php print I18n::_('Subject');?></th>
+ <th class="col4"><?php print I18n::_('Date');?></th>
+ <th class="col5"><?php print I18n::_('Size');?></th>
+ <th class="col6"><?php print I18n::_('Del');?></th>
+ </tr>
<?php
- foreach ($this->headers as $header) {
- print " <tr>\n";
- print " <td><a href=\"" . $header->detailslink . "\">" . $header->fromaddress . "</a></td>";
- print " <td>" . $header->toaddress . "</td>";
- print " <td>" . $header->subject . "</td>";
- print " <td>" . $header->date . "</td>";
- print " <td>" . $header->Size . "</td>";
- print " <td><a class=\"delete\" href=\"" . $header->deletelink . "\"><img src=\"/img/delete_icon.jpg\"></a></td>";
- print " </tr>\n";
- }
+ foreach ($this->headers as $header) {
+ print " <tr>\n";
+ print " <td><a href=\"" . $header->detailslink . "\">" . $header->fromaddress . "</a></td>";
+ print " <td>" . $header->toaddress . "</td>";
+ print " <td>" . $header->subject . "</td>";
+ print " <td>" . $header->date . "</td>";
+ print " <td>" . $header->Size . "</td>";
+ print " <td><a class=\"delete\" href=\"" . $header->deletelink . "\"><img src=\"/img/delete_icon.jpg\"></a></td>";
+ print " </tr>\n";
+ }
}
?>
</table>
diff --git a/manager/application/views/scripts/manage-account/assurance.phtml b/manager/application/views/scripts/manage-account/assurance.phtml
index db45e0a..79e1b19 100644
--- a/manager/application/views/scripts/manage-account/assurance.phtml
+++ b/manager/application/views/scripts/manage-account/assurance.phtml
@@ -9,12 +9,12 @@
<p><?php print I18n::_('The following assurances were added to your account:')?></p>
<table>
- <thead>
- <tr><th>#</th><th><?php print I18n::_('Number of points')?></th></tr>
- </thead>
- <tbody>
- <?php foreach ($this->assurancesDone as $i => $points) {
- printf('<tr><td> %1$d </td><td> %2$d </td></tr>', $i, $points);
- }?>
- </tbody>
+ <thead>
+ <tr><th>#</th><th><?php print I18n::_('Number of points')?></th></tr>
+ </thead>
+ <tbody>
+ <?php foreach ($this->assurancesDone as $i => $points) {
+ printf('<tr><td> %1$d </td><td> %2$d </td></tr>', $i, $points);
+ }?>
+ </tbody>
</table>
diff --git a/manager/application/views/scripts/manage-account/batch-assurance-form.phtml b/manager/application/views/scripts/manage-account/batch-assurance-form.phtml
index 3a68691..0fc829f 100644
--- a/manager/application/views/scripts/manage-account/batch-assurance-form.phtml
+++ b/manager/application/views/scripts/manage-account/batch-assurance-form.phtml
@@ -7,22 +7,22 @@
<h1><?php print I18n::_('Do Multiple Assurances at Once') ?></h1>
<p><?php print I18n::_('Assure multiple dummy accounts in one step. '.
- 'The assurances look just like normal assurances and can be used to gain '.
+ 'The assurances look just like normal assurances and can be used to gain '.
'experience points without suffering from RSI (also known as mouse arm).')
?></p>
<p><?php print I18n::_('The amount of points given per Assurance can be '.
- 'specified in two ways:') ?></p>
+ 'specified in two ways:') ?></p>
<dl>
- <dt><?php print I18n::_('Percentage') ?></dt>
- <dd><?php print I18n::_('n percent of the maximal possible points are '.
- 'given per Assurance. If it\'s not an integer it is rounded down to '.
- 'the next integer') ?></dd>
- <dt><?php print I18n::_('Absolute') ?></dt>
- <dd><?php print I18n::_('Exactly n points are given. If n exceeds the '.
- 'current maximum of points that may be given, it is set to the '.
- 'maximum until due to the gained experience points more points may be '.
- 'given') ?></dd>
+ <dt><?php print I18n::_('Percentage') ?></dt>
+ <dd><?php print I18n::_('n percent of the maximal possible points are '.
+ 'given per Assurance. If it\'s not an integer it is rounded down to '.
+ 'the next integer') ?></dd>
+ <dt><?php print I18n::_('Absolute') ?></dt>
+ <dd><?php print I18n::_('Exactly n points are given. If n exceeds the '.
+ 'current maximum of points that may be given, it is set to the '.
+ 'maximum until due to the gained experience points more points may be '.
+ 'given') ?></dd>
</dl>
<?php print $this->batch_assurance_form ?>
diff --git a/manager/application/views/scripts/manage-account/batch-assurance.phtml b/manager/application/views/scripts/manage-account/batch-assurance.phtml
index b13d226..32af13e 100644
--- a/manager/application/views/scripts/manage-account/batch-assurance.phtml
+++ b/manager/application/views/scripts/manage-account/batch-assurance.phtml
@@ -9,20 +9,20 @@
<p><?php print I18n::_('The following assurances were executed:')?></p>
<table>
- <thead>
- <tr>
- <th>#</th>
- <th><?php print I18n::_('Assuree')?></th>
- <th><?php print I18n::_('Number of points')?></th>
- </tr>
- </thead>
- <tbody>
- <?php foreach ($this->assurances as $i => $assurance) {?>
- <tr>
- <td><?php print $i ?></td>
- <td><?php print $assurance['assuree'] ?></td>
- <td><?php print $assurance['points'] ?></td>
- </tr>
- <?php }?>
- </tbody>
+ <thead>
+ <tr>
+ <th>#</th>
+ <th><?php print I18n::_('Assuree')?></th>
+ <th><?php print I18n::_('Number of points')?></th>
+ </tr>
+ </thead>
+ <tbody>
+ <?php foreach ($this->assurances as $i => $assurance) {?>
+ <tr>
+ <td><?php print $i ?></td>
+ <td><?php print $assurance['assuree'] ?></td>
+ <td><?php print $assurance['points'] ?></td>
+ </tr>
+ <?php }?>
+ </tbody>
</table> \ No newline at end of file