From 4edd7b57c0057f9cfab0874a198256b87bd018b7 Mon Sep 17 00:00:00 2001 From: INOPIAE Date: Sun, 9 Aug 2015 19:12:51 +0200 Subject: [PATCH] bug 1396: Codestyle cleanup --- manager/.project | 52 +- manager/application/Bootstrap.php | 218 ++--- .../configs/application.ini.ca-mgr1 | 48 +- .../configs/application.ini.mawatest | 50 +- .../controllers/ErrorController.php | 4 +- .../controllers/IndexController.php | 8 +- .../controllers/LoginController.php | 400 ++++----- .../controllers/LogoutController.php | 10 +- .../controllers/MailController.php | 142 ++-- .../controllers/ManageAccountController.php | 148 ++-- .../application/layouts/scripts/layout.phtml | 36 +- manager/application/models/User.php | 16 +- manager/application/views/helpers/LeftNav.php | 14 +- manager/application/views/helpers/TopNav.php | 14 +- .../application/views/helpers/UserInfo.php | 38 +- .../application/views/scripts/mail/full.phtml | 38 +- .../views/scripts/mail/index.phtml | 38 +- .../scripts/manage-account/assurance.phtml | 16 +- .../manage-account/batch-assurance-form.phtml | 22 +- .../manage-account/batch-assurance.phtml | 32 +- manager/library/CAcert/User/Emails.php | 80 +- manager/library/actions/ActionIndex.php | 84 +- manager/library/actions/ActionLogin.php | 84 +- manager/library/actions/ActionMail.php | 84 +- manager/library/config/Config.php | 166 ++-- manager/library/config/Config_Db.php | 44 +- manager/library/config/Config_Writer_Db.php | 102 +-- manager/library/date/HumanReadableTime.php | 238 +++--- .../exception.HumanReadableTimeException.php | 4 +- manager/library/exception/exception.Base.php | 100 +-- manager/library/i18n/I18n.php | 146 ++-- .../library/imap/exception.IMAPException.php | 4 +- manager/library/imap/imapConnection.php | 800 +++++++++--------- manager/library/l10n/L10n.php | 68 +- manager/library/log/Log.php | 168 ++-- manager/library/plugins/plugin.buildmenu.php | 108 +-- .../library/plugins/plugin.charsetheader.php | 14 +- manager/library/plugins/plugin.forceauth.php | 34 +- .../library/plugins/plugin.loginlogout.php | 40 +- manager/public/css/form_dl.css | 20 +- manager/public/css/form_dl_wide.css | 22 +- manager/public/css/global.css | 132 +-- manager/public/css/login.css | 10 +- manager/public/css/mail.css | 34 +- manager/public/index.php | 40 +- manager/public/js/center.js | 8 +- manager/public/js/positionUserInfo.js | 22 +- 47 files changed, 2000 insertions(+), 2000 deletions(-) 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; ?> -
-
- userInfo(); ?> +
+ leftNav(); ?> +
+
+ layout()->content; ?> +
+
+ userInfo(); ?> - + \ 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 . "\n"; + } + $output .= $indent . "\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 . "
  • " . $item . "
  • \n"; - } - $output .= $indent . "\n"; + } + $output .= $indent . "\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 . "
    \n"; - $output .= $indent . "\tUser: " . $this->items['authed_username'] . "
    \n"; - $output .= $indent . "\tName: " . $this->items['authed_fname'] . ' ' . $this->items['authed_lname'] . "
    \n"; - $output .= $indent . "\tRole: " . $this->items['authed_role'] . "
    \n"; - if ($this->items['authed_by_crt'] === true) - $output .= $indent . "\tLoginmethod: CRT
    \n"; - else - $output .= $indent . "\tLoginmethod: PASSWD
    \n"; - $output .= $indent . "
    \n"; + $output .= $indent . "\tUser: " . $this->items['authed_username'] . "
    \n"; + $output .= $indent . "\tName: " . $this->items['authed_fname'] . ' ' . $this->items['authed_lname'] . "
    \n"; + $output .= $indent . "\tRole: " . $this->items['authed_role'] . "
    \n"; + if ($this->items['authed_by_crt'] === true) + $output .= $indent . "\tLoginmethod: CRT
    \n"; + else + $output .= $indent . "\tLoginmethod: PASSWD
    \n"; + $output .= $indent . "\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');

    headers) == 0) { - print I18n::_('You currently have no mail.'); + print I18n::_('You currently have no mail.'); } else { ?> - - - - - - - - + + + + + + + + headers as $header) { - print " \n"; - print " "; - print " "; - print " "; - print " "; - print " "; - print " "; - print " \n"; - } + foreach ($this->headers as $header) { + print " \n"; + print " "; + print " "; + print " "; + print " "; + print " "; + print " "; + print " \n"; + } } ?>
    detailslink . "\">" . $header->fromaddress . "" . $header->toaddress . "" . $header->subject . "" . $header->date . "" . $header->Size . "deletelink . "\">
    detailslink . "\">" . $header->fromaddress . "" . $header->toaddress . "" . $header->subject . "" . $header->date . "" . $header->Size . "deletelink . "\">
    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');

    headers) == 0) { - print I18n::_('You currently have no mail.'); + print I18n::_('You currently have no mail.'); } else { ?> - - - - - - - - + + + + + + + + headers as $header) { - print " \n"; - print " "; - print " "; - print " "; - print " "; - print " "; - print " "; - print " \n"; - } + foreach ($this->headers as $header) { + print " \n"; + print " "; + print " "; + print " "; + print " "; + print " "; + print " "; + print " \n"; + } } ?>
    detailslink . "\">" . $header->fromaddress . "" . $header->toaddress . "" . $header->subject . "" . $header->date . "" . $header->Size . "deletelink . "\">
    detailslink . "\">" . $header->fromaddress . "" . $header->toaddress . "" . $header->subject . "" . $header->date . "" . $header->Size . "deletelink . "\">
    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 @@

    - - - - - assurancesDone as $i => $points) { - printf('', $i, $points); - }?> - + + + + + assurancesDone as $i => $points) { + printf('', $i, $points); + }?> +
    #
    %1$d %2$d
    #
    %1$d %2$d
    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 @@

    + 'specified in two ways:') ?>

    -
    -
    -
    -
    +
    +
    +
    +
    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 @@

    - - - - - - - - - assurances as $i => $assurance) {?> - - - - - - - + + + + + + + + + assurances as $i => $assurance) {?> + + + + + + +
    #
    #
    \ No newline at end of file diff --git a/manager/library/CAcert/User/Emails.php b/manager/library/CAcert/User/Emails.php index 099d09c..a341cc3 100644 --- a/manager/library/CAcert/User/Emails.php +++ b/manager/library/CAcert/User/Emails.php @@ -3,58 +3,58 @@ class CAcert_User_Emails { private $db = null; - public function __construct($db) { + public function __construct($db) { $this->db = $db; - } + } - /** - * get list of email addresses by login, needed to be able to filter emails - * @param string $addr - * @return array - */ - public function getEmailAddressesByLogin($addr) { - $db = $this->db; + /** + * get list of email addresses by login, needed to be able to filter emails + * @param string $addr + * @return array + */ + public function getEmailAddressesByLogin($addr) { + $db = $this->db; - /** - * find out user id by email address - */ - $sql = 'select users.id from users where email=?'; + /** + * find out user id by email address + */ + $sql = 'select users.id from users where email=?'; - $id = $db->fetchOne($sql, array($addr)); + $id = $db->fetchOne($sql, array($addr)); - /** - * get secondary email addresses - */ - $sql = 'select email.email from email where memid=?'; + /** + * get secondary email addresses + */ + $sql = 'select email.email from email where memid=?'; - $res = $db->query($sql, array($id)); + $res = $db->query($sql, array($id)); - $emails = array(); + $emails = array(); - $num = $res->rowCount(); - for ($i = 0; $i < $num; $i++) { - $row = $res->fetch(PDO::FETCH_ASSOC); - $emails[] = $row['email']; - } + $num = $res->rowCount(); + for ($i = 0; $i < $num; $i++) { + $row = $res->fetch(PDO::FETCH_ASSOC); + $emails[] = $row['email']; + } - /** - * get additional addresses by domains - */ - $sql = 'select domains.domain from domains where memid=?'; + /** + * get additional addresses by domains + */ + $sql = 'select domains.domain from domains where memid=?'; - $res = $db->query($sql, array($id)); - $num = $res->rowCount(); - $variants = array('root','hostmaster','postmaster','admin','webmaster'); - for ($i = 0; $i < $num; $i++) { - $row = $res->fetch(PDO::FETCH_ASSOC); + $res = $db->query($sql, array($id)); + $num = $res->rowCount(); + $variants = array('root','hostmaster','postmaster','admin','webmaster'); + for ($i = 0; $i < $num; $i++) { + $row = $res->fetch(PDO::FETCH_ASSOC); - foreach ($variants as $variant) { - $emails[] = $variant . '@' . $row['domain']; - } - } + foreach ($variants as $variant) { + $emails[] = $variant . '@' . $row['domain']; + } + } // Log::Log()->debug(__METHOD__ . ' addresses ' . implode(',', $emails)); - return $emails; - } + return $emails; + } } diff --git a/manager/library/actions/ActionIndex.php b/manager/library/actions/ActionIndex.php index 1b12d3c..5657870 100644 --- a/manager/library/actions/ActionIndex.php +++ b/manager/library/actions/ActionIndex.php @@ -3,51 +3,51 @@ require_once (FWACTIONS_PATH . '/FWAction.php'); class Index extends FWAction { - /** - * get a list of required permissions that are needed to access this action - * @return array - */ - public static function getRequiredPermissions() { - return array(); - } + /** + * get a list of required permissions that are needed to access this action + * @return array + */ + public static function getRequiredPermissions() { + return array(); + } - /** - * get a role that is required for accessing that action - * @return string - */ - public static function getRequiredRole() { - return 'User'; - } + /** + * get a role that is required for accessing that action + * @return string + */ + public static function getRequiredRole() { + return 'User'; + } - /** - * sort order for top navigation - * @return integer - */ - public static function getTopNavPrio() { - return 1; - } + /** + * sort order for top navigation + * @return integer + */ + public static function getTopNavPrio() { + return 1; + } - /** - * controller to invoke - * @return string - */ - public static function getController() { - return 'index'; - } + /** + * controller to invoke + * @return string + */ + public static function getController() { + return 'index'; + } - /** - * action to invoke - * @return string - */ - public static function getAction() { - return 'index'; - } + /** + * action to invoke + * @return string + */ + public static function getAction() { + return 'index'; + } - /** - * get text for menu, caller is responsible for translating - * @return string - */ - public static function getMenuText() { - return 'Dashboard'; - } + /** + * get text for menu, caller is responsible for translating + * @return string + */ + public static function getMenuText() { + return 'Dashboard'; + } } diff --git a/manager/library/actions/ActionLogin.php b/manager/library/actions/ActionLogin.php index d363ee8..509f83c 100644 --- a/manager/library/actions/ActionLogin.php +++ b/manager/library/actions/ActionLogin.php @@ -3,51 +3,51 @@ require_once (FWACTIONS_PATH . '/FWAction.php'); class Login extends FWAction { - /** - * get a list of required permissions that are needed to access this action - * @return array - */ - public static function getRequiredPermissions() { - return array(); - } + /** + * get a list of required permissions that are needed to access this action + * @return array + */ + public static function getRequiredPermissions() { + return array(); + } - /** - * get a role that is required for accessing that action - * @return string - */ - public static function getRequiredRole() { - return 'User'; - } + /** + * get a role that is required for accessing that action + * @return string + */ + public static function getRequiredRole() { + return 'User'; + } - /** - * sort order for top navigation - * @return integer - */ - public static function getTopNavPrio() { - return 1000; - } + /** + * sort order for top navigation + * @return integer + */ + public static function getTopNavPrio() { + return 1000; + } - /** - * controller to invoke - * @return string - */ - public static function getController() { - return 'login'; - } + /** + * controller to invoke + * @return string + */ + public static function getController() { + return 'login'; + } - /** - * action to invoke - * @return string - */ - public static function getAction() { - return 'index'; - } + /** + * action to invoke + * @return string + */ + public static function getAction() { + return 'index'; + } - /** - * get text for menu, caller is responsible for translating - * @return string - */ - public static function getMenuText() { - return 'Login'; - } + /** + * get text for menu, caller is responsible for translating + * @return string + */ + public static function getMenuText() { + return 'Login'; + } } diff --git a/manager/library/actions/ActionMail.php b/manager/library/actions/ActionMail.php index fc4f172..65f55d6 100644 --- a/manager/library/actions/ActionMail.php +++ b/manager/library/actions/ActionMail.php @@ -3,51 +3,51 @@ require_once (FWACTIONS_PATH . '/FWAction.php'); class Mail extends FWAction { - /** - * get a list of required permissions that are needed to access this action - * @return array - */ - public static function getRequiredPermissions() { - return array(); - } + /** + * get a list of required permissions that are needed to access this action + * @return array + */ + public static function getRequiredPermissions() { + return array(); + } - /** - * get a role that is required for accessing that action - * @return string - */ - public static function getRequiredRole() { - return 'User'; - } + /** + * get a role that is required for accessing that action + * @return string + */ + public static function getRequiredRole() { + return 'User'; + } - /** - * sort order for top navigation - * @return integer - */ - public static function getTopNavPrio() { - return 100; - } + /** + * sort order for top navigation + * @return integer + */ + public static function getTopNavPrio() { + return 100; + } - /** - * controller to invoke - * @return string - */ - public static function getController() { - return 'mail'; - } + /** + * controller to invoke + * @return string + */ + public static function getController() { + return 'mail'; + } - /** - * action to invoke - * @return string - */ - public static function getAction() { - return 'index'; - } + /** + * action to invoke + * @return string + */ + public static function getAction() { + return 'index'; + } - /** - * get text for menu, caller is responsible for translating - * @return string - */ - public static function getMenuText() { - return 'Mail'; - } + /** + * get text for menu, caller is responsible for translating + * @return string + */ + public static function getMenuText() { + return 'Mail'; + } } diff --git a/manager/library/config/Config.php b/manager/library/config/Config.php index fe47ae6..2c315a6 100644 --- a/manager/library/config/Config.php +++ b/manager/library/config/Config.php @@ -3,101 +3,101 @@ require_once('config/Config_Db.php'); class Config { - /** - * static pointer to instances - * @var array(Config) - */ - private static $instances = array(); + /** + * static pointer to instances + * @var array(Config) + */ + private static $instances = array(); - /** - * can handle several instances, distinct by instance name string - * @var string - */ - private $instanceName = ''; + /** + * can handle several instances, distinct by instance name string + * @var string + */ + private $instanceName = ''; - /** - * config object - * @var Config_Db - */ - private $config = null; + /** + * config object + * @var Config_Db + */ + private $config = null; - /** - * make a new Config_Db - * - * by using the $where statement you can limit the data that is fetched from db, i.e. only get config for zone $id - * - * @param string $instanceName - * @param Zend_Db_Adapter $db - * @param string $where - */ - protected function __construct($instanceName = null, $db = null, $where = null) { - if ($instanceName === null) - throw new Exception(__METHOD__ . ': expected an instance name, got none'); + /** + * make a new Config_Db + * + * by using the $where statement you can limit the data that is fetched from db, i.e. only get config for zone $id + * + * @param string $instanceName + * @param Zend_Db_Adapter $db + * @param string $where + */ + protected function __construct($instanceName = null, $db = null, $where = null) { + if ($instanceName === null) + throw new Exception(__METHOD__ . ': expected an instance name, got none'); - $config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini', APPLICATION_ENV); - $this->instanceName = $instanceName; + $config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini', APPLICATION_ENV); + $this->instanceName = $instanceName; - if ($db === null) - $db = Zend_Db::factory($config->dnssecme->db->config->pdo, $config->dnssecme->db->config); + if ($db === null) + $db = Zend_Db::factory($config->dnssecme->db->config->pdo, $config->dnssecme->db->config); - $this->config = new Config_Db($db, $instanceName, $where, true); - } + $this->config = new Config_Db($db, $instanceName, $where, true); + } - /** - * get already existing instance, make new instance or throw an exception - * @param string $instanceName - * @param Zend_Db_Adapter $db - * @param string $where - */ - public static function getInstance($instanceName, $db = null, $where = null) { - if ($instanceName === null) - throw new Exception(__METHOD__ . ': expected an instance name, got none'); + /** + * get already existing instance, make new instance or throw an exception + * @param string $instanceName + * @param Zend_Db_Adapter $db + * @param string $where + */ + public static function getInstance($instanceName, $db = null, $where = null) { + if ($instanceName === null) + throw new Exception(__METHOD__ . ': expected an instance name, got none'); - // no caching if presumeably volatile data is requested - if ($db !== null && $where !== null) { - return new Config($instanceName, $db, $where); - } + // no caching if presumeably volatile data is requested + if ($db !== null && $where !== null) { + return new Config($instanceName, $db, $where); + } - if (!array_key_exists($instanceName, self::$instances)) { - self::$instances[$instanceName] = new Config($instanceName, $db, $where); - } + if (!array_key_exists($instanceName, self::$instances)) { + self::$instances[$instanceName] = new Config($instanceName, $db, $where); + } - return self::$instances[$instanceName]; - } + return self::$instances[$instanceName]; + } - /** - * magic method that dispatches all unrecognized method calls to the config object - * - * @param string $param - */ - public function __get($param) { - return $this->config->$param; - } + /** + * magic method that dispatches all unrecognized method calls to the config object + * + * @param string $param + */ + public function __get($param) { + return $this->config->$param; + } - /** - * magic method that handles isset inquiries to attributes - * - * @param string $param - */ - public function __isset($param) { - return isset($this->config->$param); - } + /** + * magic method that handles isset inquiries to attributes + * + * @param string $param + */ + public function __isset($param) { + return isset($this->config->$param); + } - /** - * magic method that dispatches all unrecognized method calls to the config object - * - * @param string $param - * @param string $value - */ - public function __set($param, $value) { - $this->config->$param = $value; - } + /** + * magic method that dispatches all unrecognized method calls to the config object + * + * @param string $param + * @param string $value + */ + public function __set($param, $value) { + $this->config->$param = $value; + } - /** - * get the config object - * @return Zend_Config_* - */ - public function getConfig() { - return $this->config; - } + /** + * get the config object + * @return Zend_Config_* + */ + public function getConfig() { + return $this->config; + } } diff --git a/manager/library/config/Config_Db.php b/manager/library/config/Config_Db.php index 83af68b..6bf0e9c 100644 --- a/manager/library/config/Config_Db.php +++ b/manager/library/config/Config_Db.php @@ -36,7 +36,7 @@ require_once 'Zend/Config.php'; */ class Config_Db extends Zend_Config { - /** + /** * String that separates nesting levels of configuration data identifiers * * @var string @@ -94,7 +94,7 @@ class Config_Db extends Zend_Config * ); * * @param Zend_Db $dbc - * @param string $db_table + * @param string $db_table * @param string|null $section * @param boolean|array $options * @throws Zend_Config_Exception @@ -134,7 +134,7 @@ class Config_Db extends Zend_Config } $iniArray = $this->_loadIniFile($dbc, $db_table, $section); - $section = null; + $section = null; if (null === $section) { // Load entire file @@ -233,28 +233,28 @@ class Config_Db extends Zend_Config * @return array */ protected function _parse_ini_db($dbc, $db_table, $section) { - $sql = 'select * from ' . $db_table; - if ($section !== null) { - $sql .= ' where ' . $section; - } + $sql = 'select * from ' . $db_table; + if ($section !== null) { + $sql .= ' where ' . $section; + } - $db_config = $dbc->query($sql); + $db_config = $dbc->query($sql); - $config = array(); + $config = array(); - while (($row = $db_config->fetch()) !== false) { - $key = explode('.', $row['config_key']); - $depth = count($key); - $ci = &$config; - for ($cnt = 0; $cnt < $depth; $cnt++) { - if ($cnt == ($depth - 1)) - $ci[$key[$cnt]] = $row['config_value']; - elseif (!isset($ci[$key[$cnt]])) - $ci[$key[$cnt]] = array(); - $ci = &$ci[$key[$cnt]]; - } - } - return $config; + while (($row = $db_config->fetch()) !== false) { + $key = explode('.', $row['config_key']); + $depth = count($key); + $ci = &$config; + for ($cnt = 0; $cnt < $depth; $cnt++) { + if ($cnt == ($depth - 1)) + $ci[$key[$cnt]] = $row['config_value']; + elseif (!isset($ci[$key[$cnt]])) + $ci[$key[$cnt]] = array(); + $ci = &$ci[$key[$cnt]]; + } + } + return $config; } /** diff --git a/manager/library/config/Config_Writer_Db.php b/manager/library/config/Config_Writer_Db.php index 132c456..126437f 100644 --- a/manager/library/config/Config_Writer_Db.php +++ b/manager/library/config/Config_Writer_Db.php @@ -86,14 +86,14 @@ class Config_Writer_Db extends Zend_Config_Writer * @return void */ public function write($db = null, $config = null, $set = null) { - $this->_set = $set; + $this->_set = $set; - // this method is specialized for writing back Config objects (which hold config_db objects) + // this method is specialized for writing back Config objects (which hold config_db objects) if ($config !== null) { - if ($config instanceof Config) - $this->setConfig($config->getConfig()); + if ($config instanceof Config) + $this->setConfig($config->getConfig()); else { - $this->setConfig($config); + $this->setConfig($config); } } @@ -111,66 +111,66 @@ class Config_Writer_Db extends Zend_Config_Writer $string = 'delete from ' . $this->_tableName; if ($this->_set !== null) { - $string .= ' where ' . $this->_set; + $string .= ' where ' . $this->_set; } - $sql[] = $string; + $sql[] = $string; $iniString = ''; $extends = $this->_config->getExtends(); $sectionName = $this->_config->getSectionName(); foreach ($this->_config as $key => $data) { - $sql= array_merge($sql, $this->addEntry($sectionName, $key, $data)); - } + $sql= array_merge($sql, $this->addEntry($sectionName, $key, $data)); + } - try { - $db->beginTransaction(); - foreach ($sql as $command) { - #Log::Log()->debug($command); - $db->query($command); - } - $db->commit(); - } catch (Exception $e) { - $db->rollBack(); - Log::Log()->err($e); - throw $e; - } - } + try { + $db->beginTransaction(); + foreach ($sql as $command) { + #Log::Log()->debug($command); + $db->query($command); + } + $db->commit(); + } catch (Exception $e) { + $db->rollBack(); + Log::Log()->err($e); + throw $e; + } + } - /** - * build key value pairs, key is created by recursively adding section names, delimited by "." - * @param string $prefix - * @param string $key - * @param mixed $data - */ + /** + * build key value pairs, key is created by recursively adding section names, delimited by "." + * @param string $prefix + * @param string $key + * @param mixed $data + */ protected function addEntry($prefix, $key, $data) { - $sql = array(); + $sql = array(); - if ($data instanceof Zend_Config) { - if ($prefix != '') - $prefix .= '.'; - $prefix .= $key; - foreach ($data as $k => $v) { - $sql = array_merge($sql, $this->addEntry($prefix, $k, $v)); - } - } - else { - $string = 'insert into ' . $this->_tableName . ' set '; - $pkey = $prefix; - if ($pkey != '') - $pkey .= '.'; - $pkey .= $key; - $string .= 'config_key=' . $this->_prepareValue($pkey) . ', '; - $string .= 'config_value=' . $this->_prepareValue($data); - if ($this->_set !== null) - $string .= ', ' . $this->_set; + if ($data instanceof Zend_Config) { + if ($prefix != '') + $prefix .= '.'; + $prefix .= $key; + foreach ($data as $k => $v) { + $sql = array_merge($sql, $this->addEntry($prefix, $k, $v)); + } + } + else { + $string = 'insert into ' . $this->_tableName . ' set '; + $pkey = $prefix; + if ($pkey != '') + $pkey .= '.'; + $pkey .= $key; + $string .= 'config_key=' . $this->_prepareValue($pkey) . ', '; + $string .= 'config_value=' . $this->_prepareValue($data); + if ($this->_set !== null) + $string .= ', ' . $this->_set; - $sql[] = $string; - } + $sql[] = $string; + } - return $sql; - } + return $sql; + } /** * Add a branch to an INI string recursively diff --git a/manager/library/date/HumanReadableTime.php b/manager/library/date/HumanReadableTime.php index 3d33f9a..7c2a7c8 100644 --- a/manager/library/date/HumanReadableTime.php +++ b/manager/library/date/HumanReadableTime.php @@ -11,130 +11,130 @@ require_once(LIBRARY_PATH . '/date/exception.HumanReadableTimeException.php'); class HumanReadableTime { - /** - * normalize an HRT string, convert from HRT to seconds and then convert back to - * HRT - * @param string $hrt - * @param string $maxunit - * @return string - */ - public static function NormalizeHRT($hrt, $maxunit = 'w') { - return self::Seconds2HR(self::HR2Seconds($hrt), $maxunit); - } + /** + * normalize an HRT string, convert from HRT to seconds and then convert back to + * HRT + * @param string $hrt + * @param string $maxunit + * @return string + */ + public static function NormalizeHRT($hrt, $maxunit = 'w') { + return self::Seconds2HR(self::HR2Seconds($hrt), $maxunit); + } - /** - * convert string / interger which contains an interval length to - * human readable format (1w2d7h) - * - * if $maxunit is set, it defines the biggest unit in output (i.e. $maxunit = 'h' will - * allow only hms) - * - * @param string|integer $seconds - * @param string $maxunit - * @return string - */ - public static function Seconds2HR($seconds, $maxunit = 'w') { - $maxunit = trim(strtolower($maxunit)); - $allowed = array('w' => 0, 'd' => 0, 'h' => 0, 'm' => 0, 's' => 0); - if (!in_array($maxunit, array_keys($allowed), true)) - throw new HumanReadableTimeException('illegal value for maxunit: "' . $maxunit . '"'); - foreach ($allowed as $key => $value) { - if ($maxunit == $key) - break; - unset($allowed[$key]); - } + /** + * convert string / interger which contains an interval length to + * human readable format (1w2d7h) + * + * if $maxunit is set, it defines the biggest unit in output (i.e. $maxunit = 'h' will + * allow only hms) + * + * @param string|integer $seconds + * @param string $maxunit + * @return string + */ + public static function Seconds2HR($seconds, $maxunit = 'w') { + $maxunit = trim(strtolower($maxunit)); + $allowed = array('w' => 0, 'd' => 0, 'h' => 0, 'm' => 0, 's' => 0); + if (!in_array($maxunit, array_keys($allowed), true)) + throw new HumanReadableTimeException('illegal value for maxunit: "' . $maxunit . '"'); + foreach ($allowed as $key => $value) { + if ($maxunit == $key) + break; + unset($allowed[$key]); + } - $seconds = intval($seconds); - $hrt = ''; - foreach ($allowed as $key => $value) { - switch ($key) { - case 'w': - $tmp = intval($seconds / (7*86400)); - if ($tmp > 0) - $seconds %= (7*86400); - $allowed[$key] += $tmp; - break; - case 'd': - $tmp = intval($seconds / (86400)); - if ($tmp > 0) - $seconds %= (86400); - $allowed[$key] += $tmp; - break; - case 'h': - $tmp = intval($seconds / (3600)); - if ($tmp > 0) - $seconds %= (3600); - $allowed[$key] += $tmp; - break; - case 'm': - $tmp = intval($seconds / (60)); - if ($tmp > 0) - $seconds %= (60); - $allowed[$key] += $tmp; - break; - case 's': - $allowed[$key] += $seconds; - break; - } - } + $seconds = intval($seconds); + $hrt = ''; + foreach ($allowed as $key => $value) { + switch ($key) { + case 'w': + $tmp = intval($seconds / (7*86400)); + if ($tmp > 0) + $seconds %= (7*86400); + $allowed[$key] += $tmp; + break; + case 'd': + $tmp = intval($seconds / (86400)); + if ($tmp > 0) + $seconds %= (86400); + $allowed[$key] += $tmp; + break; + case 'h': + $tmp = intval($seconds / (3600)); + if ($tmp > 0) + $seconds %= (3600); + $allowed[$key] += $tmp; + break; + case 'm': + $tmp = intval($seconds / (60)); + if ($tmp > 0) + $seconds %= (60); + $allowed[$key] += $tmp; + break; + case 's': + $allowed[$key] += $seconds; + break; + } + } - $hrt = ''; - foreach ($allowed as $key => $value) { - if ($value > 0) - $hrt .= sprintf('%d%s', $value, $key); - } - return $hrt; - } + $hrt = ''; + foreach ($allowed as $key => $value) { + if ($value > 0) + $hrt .= sprintf('%d%s', $value, $key); + } + return $hrt; + } - /** - * parse a string of 3h2m7s and return the number of seconds as integer - * add "s" to the end of the number if $addsecond is set to true - * @param string $hr - * @param boolean $addsecond - * @return integer|string - */ - public static function HR2Seconds($hr, $addsecond = false) { - $hr = trim($hr); - if ($hr == '') { - if ($addsecond === true) - return '0s'; - else - return 0; - } + /** + * parse a string of 3h2m7s and return the number of seconds as integer + * add "s" to the end of the number if $addsecond is set to true + * @param string $hr + * @param boolean $addsecond + * @return integer|string + */ + public static function HR2Seconds($hr, $addsecond = false) { + $hr = trim($hr); + if ($hr == '') { + if ($addsecond === true) + return '0s'; + else + return 0; + } - $hr = strtolower($hr); + $hr = strtolower($hr); - $matches = array(); - if (preg_match_all('/([0-9]*)([wdhms])/', $hr, $matches, PREG_SET_ORDER) > 0) { - $interval = 0; - for ($i = 0; $i < count($matches); $i++) { - switch ($matches[$i][2]) { - case 'w': - $interval += $matches[$i][1] * 7 * 86400; - break; - case 'd': - $interval += $matches[$i][1] * 86400; - break; - case 'h': - $interval += $matches[$i][1] * 3600; - break; - case 'm': - $interval += $matches[$i][1] * 60; - break; - case 's': - $interval += $matches[$i][1]; - break; - } - } - if ($addsecond === true) - return sprintf('%ds', $interval); - else - return $interval; - } + $matches = array(); + if (preg_match_all('/([0-9]*)([wdhms])/', $hr, $matches, PREG_SET_ORDER) > 0) { + $interval = 0; + for ($i = 0; $i < count($matches); $i++) { + switch ($matches[$i][2]) { + case 'w': + $interval += $matches[$i][1] * 7 * 86400; + break; + case 'd': + $interval += $matches[$i][1] * 86400; + break; + case 'h': + $interval += $matches[$i][1] * 3600; + break; + case 'm': + $interval += $matches[$i][1] * 60; + break; + case 's': + $interval += $matches[$i][1]; + break; + } + } + if ($addsecond === true) + return sprintf('%ds', $interval); + else + return $interval; + } - if ($addsecond === true) - return '0s'; - else - return 0; - } + if ($addsecond === true) + return '0s'; + else + return 0; + } } diff --git a/manager/library/date/exception.HumanReadableTimeException.php b/manager/library/date/exception.HumanReadableTimeException.php index 67d38e8..c354c3d 100644 --- a/manager/library/date/exception.HumanReadableTimeException.php +++ b/manager/library/date/exception.HumanReadableTimeException.php @@ -23,12 +23,12 @@ class HumanReadableTimeException extends BaseException { /** * make new object * - * @access public + * @access public * @param string $message * @param int $code * @param string $extra */ - /* + /* public function __construct($message,$code = 0,$extra = '') { parent::__construct($message,$code, $extra); } diff --git a/manager/library/exception/exception.Base.php b/manager/library/exception/exception.Base.php index d7f2a2c..7120c37 100644 --- a/manager/library/exception/exception.Base.php +++ b/manager/library/exception/exception.Base.php @@ -14,84 +14,84 @@ * @version $Id: exception.Base.php 90 2010-03-09 09:48:27Z markus $ */ class BaseException extends Exception { - /** - * additional data / string - * @var string - */ - protected $extra = ''; + /** + * additional data / string + * @var string + */ + protected $extra = ''; - /** - * location of thrower - * @var string - */ - protected $exception_location = ''; + /** + * location of thrower + * @var string + */ + protected $exception_location = ''; /** * make new object * - * @access public + * @access public * @param string $message * @param int $code */ public function __construct($message, $code = 0, $extra = '') { $bt = debug_backtrace(); - $remove_exception = 0; - while( $remove_exception < count($bt) && isset($bt[$remove_exception]['class']) && eregi('exception', $bt[$remove_exception]['class']) ) { - $remove_exception++; - } + $remove_exception = 0; + while( $remove_exception < count($bt) && isset($bt[$remove_exception]['class']) && eregi('exception', $bt[$remove_exception]['class']) ) { + $remove_exception++; + } - if ($remove_exception > 0) - $remove_exception--; + if ($remove_exception > 0) + $remove_exception--; - if ($remove_exception < count($bt)) { - $this->exception_location = $bt[$remove_exception]['file'].':'.$bt[$remove_exception]['line']; - } + if ($remove_exception < count($bt)) { + $this->exception_location = $bt[$remove_exception]['file'].':'.$bt[$remove_exception]['line']; + } - $this->extra = $extra; + $this->extra = $extra; parent::__construct($message,$code); } /** * Make a string out of this exception - * - * @access public - * @return string + * + * @access public + * @return string */ - public function __toString() { - $out = __CLASS__ . '['.$this->code.']:'; + public function __toString() { + $out = __CLASS__ . '['.$this->code.']:'; - if ($this->exception_location != '') - $out.= $this->exception_location; - $out .= ':'; + if ($this->exception_location != '') + $out.= $this->exception_location; + $out .= ':'; - $out .= " {$this->message}"; + $out .= " {$this->message}"; - if (isset($this->extra) && strlen($this->extra) > 0) - $out .= " ({$this->extra})\n"; + if (isset($this->extra) && strlen($this->extra) > 0) + $out .= " ({$this->extra})\n"; return $out; } - /** - * get the extra info string - * - * @access public - * @return string - */ - public function getExtraInfo() { - return $this->extra; - } + /** + * get the extra info string + * + * @access public + * @return string + */ + public function getExtraInfo() { + return $this->extra; + } - /** - * get the exception location string - * - * @access public - * @return string - */ - public function getExceptionLocation() { - return $this->exception_location; - } + /** + * get the exception location string + * + * @access public + * @return string + */ + public function getExceptionLocation() { + return $this->exception_location; + } } diff --git a/manager/library/i18n/I18n.php b/manager/library/i18n/I18n.php index 961ae6c..64e8a93 100644 --- a/manager/library/i18n/I18n.php +++ b/manager/library/i18n/I18n.php @@ -8,88 +8,88 @@ require_once('l10n/L10n.php'); class I18n { - /** - * static pointer to instance - * @var array(I18n) - */ - private static $instance = null; + /** + * static pointer to instance + * @var array(I18n) + */ + private static $instance = null; - /** - * config object - * @var Zend_Translate - */ - private $translate = null; + /** + * config object + * @var Zend_Translate + */ + private $translate = null; - /** - * make new translate - */ - protected function __construct() { - $options = array( - 'log' => Log::Log(), - 'logUntranslated' => false - ); + /** + * make new translate + */ + protected function __construct() { + $options = array( + 'log' => Log::Log(), + 'logUntranslated' => false + ); - $locale = L10n::getInstance(); - $supported = $locale->getBrowser(); - arsort($supported, SORT_NUMERIC); + $locale = L10n::getInstance(); + $supported = $locale->getBrowser(); + arsort($supported, SORT_NUMERIC); - $file = ''; - foreach ($supported as $loc => $val) { - if (file_exists(LOCALE_PATH . '/' . $loc . '/locale.php')) { - $file = LOCALE_PATH . '/' . $loc . '/locale.php'; - $locale->setLocale($loc); - break; - } - } + $file = ''; + foreach ($supported as $loc => $val) { + if (file_exists(LOCALE_PATH . '/' . $loc . '/locale.php')) { + $file = LOCALE_PATH . '/' . $loc . '/locale.php'; + $locale->setLocale($loc); + break; + } + } - if ($file == '' && file_exists(LOCALE_PATH . '/en_US/locale.php')) { - $file = LOCALE_PATH . '/en_US/locale.php'; - $locale->setLocale('en_US'); - } + if ($file == '' && file_exists(LOCALE_PATH . '/en_US/locale.php')) { + $file = LOCALE_PATH . '/en_US/locale.php'; + $locale->setLocale('en_US'); + } - if ($file != '') { - $this->translate = new Zend_Translate(Zend_Translate::AN_ARRAY, $file, $locale->getLanguage(), $options); - #Log::Log()->debug('locale ' . $locale->getLanguage() . '_' .$locale->getRegion() . ' loaded'); - } - else - throw new Exception(__METHOD__ . ': no translation files available'); - } + if ($file != '') { + $this->translate = new Zend_Translate(Zend_Translate::AN_ARRAY, $file, $locale->getLanguage(), $options); + #Log::Log()->debug('locale ' . $locale->getLanguage() . '_' .$locale->getRegion() . ' loaded'); + } + else + throw new Exception(__METHOD__ . ': no translation files available'); + } - /** - * get already existing instance, make new instance or throw an exception - * @return I18n - */ - public static function getInstance() { - if (self::$instance === null) { - self::$instance = new I18n(); - } + /** + * get already existing instance, make new instance or throw an exception + * @return I18n + */ + public static function getInstance() { + if (self::$instance === null) { + self::$instance = new I18n(); + } - return self::$instance; - } + return self::$instance; + } - /** - * return the Zend_Translate object - * @return Zend_Translate - */ - public static function getTranslate() { - return self::getInstance()->translate; - } + /** + * return the Zend_Translate object + * @return Zend_Translate + */ + public static function getTranslate() { + return self::getInstance()->translate; + } - /** - * map _ to translate - * @param unknown_type $text - * @param unknown_type $locale - */ - public function _($text, $locale = null) { - return self::getInstance()->translate->_($text, $locale); - } + /** + * map _ to translate + * @param unknown_type $text + * @param unknown_type $locale + */ + public function _($text, $locale = null) { + return self::getInstance()->translate->_($text, $locale); + } - /** - * magic __call dispatches all unknown methods to Zend_Translate - * @param unknown_type $method - * @param unknown_type $arguments - */ - public function __call($method, $arguments) { - return call_user_func_array(array($this->translate, $method), $arguments); - } + /** + * magic __call dispatches all unknown methods to Zend_Translate + * @param unknown_type $method + * @param unknown_type $arguments + */ + public function __call($method, $arguments) { + return call_user_func_array(array($this->translate, $method), $arguments); + } } diff --git a/manager/library/imap/exception.IMAPException.php b/manager/library/imap/exception.IMAPException.php index 23780ed..7a3889a 100644 --- a/manager/library/imap/exception.IMAPException.php +++ b/manager/library/imap/exception.IMAPException.php @@ -21,12 +21,12 @@ class IMAPException extends BaseException { /** * make new object * - * @access public + * @access public * @param string $message * @param int $code * @param string $extra */ - /* + /* public function __construct($message,$code = 0,$extra = '') { parent::__construct($message,$code, $extra); } diff --git a/manager/library/imap/imapConnection.php b/manager/library/imap/imapConnection.php index 1528a76..deed5d2 100644 --- a/manager/library/imap/imapConnection.php +++ b/manager/library/imap/imapConnection.php @@ -20,36 +20,36 @@ define('IMAP_RETRIES', 5); */ class imapConnection { - /** - * Array mit den bereits vorhandenen Instanzen - * @var array - */ - private static $instances = array(); + /** + * Array mit den bereits vorhandenen Instanzen + * @var array + */ + private static $instances = array(); - /** - * Instanzname, die unterschiedlichen Entitäten werden über den Namen - * auseinandergehalten. - * @var string - */ - private $instanceName = ''; + /** + * Instanzname, die unterschiedlichen Entitäten werden über den Namen + * auseinandergehalten. + * @var string + */ + private $instanceName = ''; - /** - * Configsection - * @var Config - */ - private $config = null; + /** + * Configsection + * @var Config + */ + private $config = null; - /** - * IMAP Resource - * @var imap_stream - */ - private $imap = null; + /** + * IMAP Resource + * @var imap_stream + */ + private $imap = null; - /** - * Servername, Port, Flags - * @var string - */ - private $server = ''; + /** + * Servername, Port, Flags + * @var string + */ + private $server = ''; /** * Name der zuletzt geöffneten Mailbox @@ -57,222 +57,222 @@ class imapConnection { */ private $mbox = ''; - /** - * wird auf true gesetzt, wenn imapPing die Connection neu aufbaut - * @var boolean - */ - private $reopenedConnection = false; + /** + * wird auf true gesetzt, wenn imapPing die Connection neu aufbaut + * @var boolean + */ + private $reopenedConnection = false; - /** - * liefert eine Liste der verfügbaren Folder - * @param string $pattern - * @return array - */ - public function imapList($pattern = '*') { - if ($this->imap === null) { - throw new IMAPException(__METHOD__ . ' not connected'); - } + /** + * liefert eine Liste der verfügbaren Folder + * @param string $pattern + * @return array + */ + public function imapList($pattern = '*') { + if ($this->imap === null) { + throw new IMAPException(__METHOD__ . ' not connected'); + } $this->imapPing(true); - return imap_list($this->imap, $this->server, $pattern); - } + return imap_list($this->imap, $this->server, $pattern); + } - /** - * Checkt die Anzahl Messages in einer Mailbox - * return array - */ - public function imapCheck() { - if ($this->imap === null) { - throw new IMAPException(__METHOD__ . ' not connected'); - } + /** + * Checkt die Anzahl Messages in einer Mailbox + * return array + */ + public function imapCheck() { + if ($this->imap === null) { + throw new IMAPException(__METHOD__ . ' not connected'); + } $this->imapPing(true); - return imap_check($this->imap); - } + return imap_check($this->imap); + } - /** - * per imap_reopen die aktuelle Connection auf eine andere mbox umstellen - * @param string $mbox - * @return boolean - */ - public function imapSwitchMbox($mbox) { - if ($this->imap === null) { - throw new IMAPException(__METHOD__ . ' not connected'); - } + /** + * per imap_reopen die aktuelle Connection auf eine andere mbox umstellen + * @param string $mbox + * @return boolean + */ + public function imapSwitchMbox($mbox) { + if ($this->imap === null) { + throw new IMAPException(__METHOD__ . ' not connected'); + } $this->imapPing(true); - if (imap_reopen($this->imap, $this->server.$mbox) === false) { - throw new IMAPException(__METHOD__ . ' reopen failed'); - } + if (imap_reopen($this->imap, $this->server.$mbox) === false) { + throw new IMAPException(__METHOD__ . ' reopen failed'); + } $this->mbox = $mbox; - return true; - } + return true; + } - /** - * setzt ein Flag bei allen in $sequence aufgeführten Messages - * @param string $sequence - * @param string $flag - * @param integer $options - * @return boolean - */ - public function imapSetflagFull($sequence, $flag, $options = 0) { - if ($this->imap === null) { - throw new IMAPException(__METHOD__ . ' not connected'); - } + /** + * setzt ein Flag bei allen in $sequence aufgeführten Messages + * @param string $sequence + * @param string $flag + * @param integer $options + * @return boolean + */ + public function imapSetflagFull($sequence, $flag, $options = 0) { + if ($this->imap === null) { + throw new IMAPException(__METHOD__ . ' not connected'); + } $this->imapPing(true); - return imap_setflag_full($this->imap, $sequence, $flag, $options); - } + return imap_setflag_full($this->imap, $sequence, $flag, $options); + } - /** - * liefert die Mailheader - * @return array - */ - public function imapHeaders() { - if ($this->imap === null) { - throw new IMAPException(__METHOD__ . ' not connected'); - } + /** + * liefert die Mailheader + * @return array + */ + public function imapHeaders() { + if ($this->imap === null) { + throw new IMAPException(__METHOD__ . ' not connected'); + } $this->imapPing(true); - return imap_headers($this->imap); - } + return imap_headers($this->imap); + } - /** - * liefert die Header zu genau einer Mail mit der gegebenen ID - * @param integer $number - * @return array - */ - public function imapHeader($number) { - if ($this->imap === null) { - throw new IMAPException(__METHOD__ . ' not connected'); - } + /** + * liefert die Header zu genau einer Mail mit der gegebenen ID + * @param integer $number + * @return array + */ + public function imapHeader($number) { + if ($this->imap === null) { + throw new IMAPException(__METHOD__ . ' not connected'); + } $this->imapPing(true); - return imap_headerinfo($this->imap, $number); - } + return imap_headerinfo($this->imap, $number); + } - /** - * liefert die Header zu genau einer Mail mit der gegebenen UID - * @param integer $uid - * @return array - */ - public function imapFetchHeader($uid) { - if ($this->imap === null) { - throw new IMAPException(__METHOD__ . ' not connected'); - } + /** + * liefert die Header zu genau einer Mail mit der gegebenen UID + * @param integer $uid + * @return array + */ + public function imapFetchHeader($uid) { + if ($this->imap === null) { + throw new IMAPException(__METHOD__ . ' not connected'); + } - $ret = imap_fetchheader($this->imap, $uid, FT_UID); + $ret = imap_fetchheader($this->imap, $uid, FT_UID); return $ret; - } + } - /** - * liefert die Header zu genau einer Mail mit der gegebenen UID - * @param integer $uid - * @return array - */ - public function imapFetchOverview($uid) { - if ($this->imap === null) { - throw new IMAPException(__METHOD__ . ' not connected'); - } + /** + * liefert die Header zu genau einer Mail mit der gegebenen UID + * @param integer $uid + * @return array + */ + public function imapFetchOverview($uid) { + if ($this->imap === null) { + throw new IMAPException(__METHOD__ . ' not connected'); + } - $ret = imap_fetch_overview($this->imap, $uid, FT_UID); + $ret = imap_fetch_overview($this->imap, $uid, FT_UID); return $ret[0]; - } + } - /** - * liefert den Body zu genau einer Mail mit der gegebenen ID - * @param integer $number - * @return string - */ - public function imapBody($number) { - if ($this->imap === null) { - throw new IMAPException(__METHOD__ . ' not connected'); - } + /** + * liefert den Body zu genau einer Mail mit der gegebenen ID + * @param integer $number + * @return string + */ + public function imapBody($number) { + if ($this->imap === null) { + throw new IMAPException(__METHOD__ . ' not connected'); + } $this->imapPing(true); - return imap_body($this->imap, $number); - } + return imap_body($this->imap, $number); + } - /** - * liefert den Body zu genau einer Mail mit der gegebenen UID - * @param integer $uid - * @return string - */ - public function imapBodyByUID($uid) { - if ($this->imap === null) { - throw new IMAPException(__METHOD__ . ' not connected'); - } + /** + * liefert den Body zu genau einer Mail mit der gegebenen UID + * @param integer $uid + * @return string + */ + public function imapBodyByUID($uid) { + if ($this->imap === null) { + throw new IMAPException(__METHOD__ . ' not connected'); + } $this->imapPing(true); - return imap_body($this->imap, $uid, FT_UID ); - } + return imap_body($this->imap, $uid, FT_UID ); + } - /** - * markiert die Nachricht mit der unique ID zum löschen - * @param integer $uid - * return boolean - */ - public function imapDelete($uid) { - if ($this->imap === null) { - throw new IMAPException(__METHOD__ . ' not connected'); - } + /** + * markiert die Nachricht mit der unique ID zum löschen + * @param integer $uid + * return boolean + */ + public function imapDelete($uid) { + if ($this->imap === null) { + throw new IMAPException(__METHOD__ . ' not connected'); + } $this->imapPing(true); - $ret = imap_delete($this->imap, $uid, FT_UID); + $ret = imap_delete($this->imap, $uid, FT_UID); - if ($ret !== true) { - print "imap delete returned false for ".$uid."\n"; - } + if ($ret !== true) { + print "imap delete returned false for ".$uid."\n"; + } - return $ret; - } + return $ret; + } - /** - * löscht alle zum löschen markierten Nachrichten - * @return boolean - */ - public function imapExpunge() { - if ($this->imap === null) { - throw new IMAPException(__METHOD__ . ' not connected'); - } + /** + * löscht alle zum löschen markierten Nachrichten + * @return boolean + */ + public function imapExpunge() { + if ($this->imap === null) { + throw new IMAPException(__METHOD__ . ' not connected'); + } $this->imapPing(true); - return imap_expunge($this->imap); - } + return imap_expunge($this->imap); + } - /** - * kopiert die Nachricht mit der gegebenen uid in die gegebene Mailbox *auf dem selben Server* - * @param integer $uid - * @param string $dest_mbox - * @return boolean - */ - public function imapMailCopy($uid, $dest_mbox) { - if ($this->imap === null) { - throw new IMAPException(__METHOD__ . ' not connected'); - } + /** + * kopiert die Nachricht mit der gegebenen uid in die gegebene Mailbox *auf dem selben Server* + * @param integer $uid + * @param string $dest_mbox + * @return boolean + */ + public function imapMailCopy($uid, $dest_mbox) { + if ($this->imap === null) { + throw new IMAPException(__METHOD__ . ' not connected'); + } $this->imapPing(true); - return imap_mail_copy($this->imap, $uid, $dest_mbox, CP_UID); - } + return imap_mail_copy($this->imap, $uid, $dest_mbox, CP_UID); + } - /** - * verschiebt die Nachricht mit der gegebenen uid in die gegebene Mailbox *auf dem selben Server* - * @param integer $uid - * @param string $dest_mbox - * @return boolean - */ - public function imapMailMove($uid, $dest_mbox) { - if ($this->imap === null) { - throw new IMAPException(__METHOD__ . ' not connected'); - } + /** + * verschiebt die Nachricht mit der gegebenen uid in die gegebene Mailbox *auf dem selben Server* + * @param integer $uid + * @param string $dest_mbox + * @return boolean + */ + public function imapMailMove($uid, $dest_mbox) { + if ($this->imap === null) { + throw new IMAPException(__METHOD__ . ' not connected'); + } $this->imapPing(true); /* * dont't add the server part, @@ -280,136 +280,136 @@ class imapConnection { * * $dest_mbox = $this->server.$dest_mbox; */ - return imap_mail_move( $this->imap, $uid, $dest_mbox, CP_UID); - } + return imap_mail_move( $this->imap, $uid, $dest_mbox, CP_UID); + } - /** - * legt eine neue Mailbox *auf dem selben Server* an - * @param string $mbox - * @return boolean - */ - public function imapCreateMailbox($mbox) { - if ($this->imap === null) { - throw new IMAPException(__METHOD__ . ' not connected'); - } + /** + * legt eine neue Mailbox *auf dem selben Server* an + * @param string $mbox + * @return boolean + */ + public function imapCreateMailbox($mbox) { + if ($this->imap === null) { + throw new IMAPException(__METHOD__ . ' not connected'); + } $this->imapPing(true); - return imap_createmailbox($this->imap, $this->server.$mbox); - } + return imap_createmailbox($this->imap, $this->server.$mbox); + } - /** - * fragt ab, ob eine mbox unterhalb von mbox_root existiert und liefert true zurück, falls ja - * Funktion existiert nicht direkt als IMAP Kommando, aus einzelnen Kommando's zusammengebaut - * - * @param string $mbox_root - * @param string $mbox - * @return boolean - */ - public function imapMailboxExists($mbox_root, $mbox) { - if ($this->imap === null) { - throw new IMAPException(__METHOD__ . ' not connected'); - } + /** + * fragt ab, ob eine mbox unterhalb von mbox_root existiert und liefert true zurück, falls ja + * Funktion existiert nicht direkt als IMAP Kommando, aus einzelnen Kommando's zusammengebaut + * + * @param string $mbox_root + * @param string $mbox + * @return boolean + */ + public function imapMailboxExists($mbox_root, $mbox) { + if ($this->imap === null) { + throw new IMAPException(__METHOD__ . ' not connected'); + } $this->imapPing(true); - $folderlist = $this->imapList($mbox_root); - $foundFolder = false; - foreach ($folderlist as $folder) { - if (strpos($folder, $mbox) !== false) { - return true; - } - } + $folderlist = $this->imapList($mbox_root); + $foundFolder = false; + foreach ($folderlist as $folder) { + if (strpos($folder, $mbox) !== false) { + return true; + } + } - return false; - } + return false; + } - const AR_YYYY = 'Y'; - const AR_YYYYMM = 'Ym'; - const AR_YYYYMMDD = 'Ymd'; + const AR_YYYY = 'Y'; + const AR_YYYYMM = 'Ym'; + const AR_YYYYMMDD = 'Ymd'; - /** - * erzeugt eine Archivmailbox zur Mailbox $mbox, dabei wird das Archiv unterhalb von $mbox - * auf dem selben Server angelegt, der Name der Mailbox enthält je nach $mode noch einen Datumsstamp - * Wenn der Input ($mbox) bereits mehrere Ebenen enthält (NOC3.domain.incoming z.B.), dann - * wird automatisch nur der am weitesten rechts stehende Teil extrahiert und benutzt. - * NOC3.domain.incoming => NOC3.domain.incoming.incoming-200705 - * @param string $mbox - * @param string $mode - * @param integer $timestamp - * @param string $delimiter - * @return string - */ - public static function imapMakeArchiveName($mbox, $mode, $timestamp = null, $delimiter = '-') { - if ($timestamp === null) - $timestamp = time(); + /** + * erzeugt eine Archivmailbox zur Mailbox $mbox, dabei wird das Archiv unterhalb von $mbox + * auf dem selben Server angelegt, der Name der Mailbox enthält je nach $mode noch einen Datumsstamp + * Wenn der Input ($mbox) bereits mehrere Ebenen enthält (NOC3.domain.incoming z.B.), dann + * wird automatisch nur der am weitesten rechts stehende Teil extrahiert und benutzt. + * NOC3.domain.incoming => NOC3.domain.incoming.incoming-200705 + * @param string $mbox + * @param string $mode + * @param integer $timestamp + * @param string $delimiter + * @return string + */ + public static function imapMakeArchiveName($mbox, $mode, $timestamp = null, $delimiter = '-') { + if ($timestamp === null) + $timestamp = time(); - $ar = explode('.', $mbox); + $ar = explode('.', $mbox); - $sub_mbox = $ar[count($ar) - 1]; + $sub_mbox = $ar[count($ar) - 1]; - return $mbox.'.'.$sub_mbox.$delimiter.date($mode,$timestamp); - } + return $mbox.'.'.$sub_mbox.$delimiter.date($mode,$timestamp); + } - public static function imapMakePrefixedArchiveName($mbox, $mode, $prefix = '', $timestamp = null, $delimiter = '-') { - if ($timestamp === null) - $timestamp = time(); + public static function imapMakePrefixedArchiveName($mbox, $mode, $prefix = '', $timestamp = null, $delimiter = '-') { + if ($timestamp === null) + $timestamp = time(); - $ar = explode('.', $mbox); + $ar = explode('.', $mbox); - $sub_mbox = $ar[count($ar) - 1]; + $sub_mbox = $ar[count($ar) - 1]; - return $mbox.'.'.$prefix.$delimiter.$sub_mbox.$delimiter.date($mode,$timestamp); - } + return $mbox.'.'.$prefix.$delimiter.$sub_mbox.$delimiter.date($mode,$timestamp); + } - /** - * liefert die unique ID der Nachricht mit der laufenden msg_number - * @param integer $msg_number - * @return integer - */ - public function imapUID($msg_number) { - if ($this->imap === null) { - throw new IMAPException(__METHOD__ . ' not connected'); - } + /** + * liefert die unique ID der Nachricht mit der laufenden msg_number + * @param integer $msg_number + * @return integer + */ + public function imapUID($msg_number) { + if ($this->imap === null) { + throw new IMAPException(__METHOD__ . ' not connected'); + } $this->imapPing(true); - return imap_uid($this->imap, $msg_number); - } + return imap_uid($this->imap, $msg_number); + } - /** - * liefert die laufende msg_number der Nachricht, die die unique ID uid hat - * @param integer $uid - * @return integer - */ - public function imapMsgNo($uid) { - if ($this->imap === null) { - throw new IMAPException(__METHOD__ . ' not connected'); - } + /** + * liefert die laufende msg_number der Nachricht, die die unique ID uid hat + * @param integer $uid + * @return integer + */ + public function imapMsgNo($uid) { + if ($this->imap === null) { + throw new IMAPException(__METHOD__ . ' not connected'); + } $this->imapPing(true); - return imap_msgno($this->imap, $uid); - } + return imap_msgno($this->imap, $uid); + } - /** - * prüft, ob die Connection noch aktiv ist, Exception falls keine Connection definiert ist, + /** + * prüft, ob die Connection noch aktiv ist, Exception falls keine Connection definiert ist, * oder die Connection geschlossen wurde * wenn reconnect = true, dann wird bei einer geschlossenen Connection die Connection neu aufgebaut * @param boolean $reconnect - * @return boolean - */ - public function imapPing($reconnect = false) { - if ($this->imap === null) { - throw new IMAPException(__METHOD__ . ' not connected'); - } + * @return boolean + */ + public function imapPing($reconnect = false) { + if ($this->imap === null) { + throw new IMAPException(__METHOD__ . ' not connected'); + } - $ret = imap_ping($this->imap); + $ret = imap_ping($this->imap); if ($ret === false) { if ($reconnect === true) { - $this->imap = $this->imapOpen($this->server.$this->mbox, - $this->config->username, - $this->config->password, - OP_HALFOPEN); + $this->imap = $this->imapOpen($this->server.$this->mbox, + $this->config->username, + $this->config->password, + OP_HALFOPEN); $ret = imap_ping($this->imap); @@ -424,138 +424,138 @@ class imapConnection { } } - return true; - } - - - public function __destruct() { - if ($this->imap !== null) { - imap_close($this->imap); - $this->imap = null; - } - } - - - /** - * true, wenn imapPing die Connection neu aufgemacht hat - * Variable wird auf false gesetzt wenn $flush true ist - * @param boolean $flush - * @return boolean - */ - public function connectionReopened($flush = true) { - $ret = $this->reopenedConnection; - if ($flush === true) { - $this->reopenedConnection = false; - } - return $ret; - } - - - /** - * interne IMAP Open Methode - * - * @param string $servername - * @param string $username - * @param string password - * @param integer $flags - * @return resource - */ - protected function imapOpen($server, $username, $password, $flags) { - return imap_open($server, $username, $password, $flags); + return true; } - /** - * privater Konstruktor, wird exklusiv von getInstance aufgerufen - * - * @param $instanceName - * @param $config - */ - protected function __construct($instanceName, $config) { - $this->instanceName = $instanceName; - $this->config = $config; + public function __destruct() { + if ($this->imap !== null) { + imap_close($this->imap); + $this->imap = null; + } + } - if (!isset($this->config->mailhost)) { - throw new IMAPException(__METHOD__ . ' config attribute missing: "mailhost"'); - } - if (!isset($this->config->username)) { - throw new IMAPException(__METHOD__ . ' config attribute missing: "username"'); - } - if (!isset($this->config->password)) { - throw new IMAPException(__METHOD__ . ' config attribute missing: "password"'); - } - if (!isset($this->config->port)) { - throw new IMAPException(__METHOD__ . ' config attribute missing: "port"'); - } - $this->server = '{'.$this->config->mailhost.':'.$this->config->port.'/imap'; - if( isset($this->config->use_tls) && - $this->config->use_tls != 0 ) { - $this->server .= '/tls'; - } - $this->server .= '/novalidate-cert}'; + /** + * true, wenn imapPing die Connection neu aufgemacht hat + * Variable wird auf false gesetzt wenn $flush true ist + * @param boolean $flush + * @return boolean + */ + public function connectionReopened($flush = true) { + $ret = $this->reopenedConnection; + if ($flush === true) { + $this->reopenedConnection = false; + } + return $ret; + } - $mbox = ''; + + /** + * interne IMAP Open Methode + * + * @param string $servername + * @param string $username + * @param string password + * @param integer $flags + * @return resource + */ + protected function imapOpen($server, $username, $password, $flags) { + return imap_open($server, $username, $password, $flags); + } + + + /** + * privater Konstruktor, wird exklusiv von getInstance aufgerufen + * + * @param $instanceName + * @param $config + */ + protected function __construct($instanceName, $config) { + $this->instanceName = $instanceName; + $this->config = $config; + + if (!isset($this->config->mailhost)) { + throw new IMAPException(__METHOD__ . ' config attribute missing: "mailhost"'); + } + if (!isset($this->config->username)) { + throw new IMAPException(__METHOD__ . ' config attribute missing: "username"'); + } + if (!isset($this->config->password)) { + throw new IMAPException(__METHOD__ . ' config attribute missing: "password"'); + } + if (!isset($this->config->port)) { + throw new IMAPException(__METHOD__ . ' config attribute missing: "port"'); + } + + $this->server = '{'.$this->config->mailhost.':'.$this->config->port.'/imap'; + if( isset($this->config->use_tls) && + $this->config->use_tls != 0 ) { + $this->server .= '/tls'; + } + $this->server .= '/novalidate-cert}'; + + $mbox = ''; $this->mbox = $mbox; - $this->imap = null; + $this->imap = null; - $this->imap = $this->imapOpen($this->server.$mbox, - $this->config->username, - $this->config->password, - OP_HALFOPEN); + $this->imap = $this->imapOpen($this->server.$mbox, + $this->config->username, + $this->config->password, + OP_HALFOPEN); - if ($this->imap === false) { - $this->imap = null; - throw new IMAPException(__METHOD__ . ' not connected'); - } + if ($this->imap === false) { + $this->imap = null; + throw new IMAPException(__METHOD__ . ' not connected'); + } - $this->reopenedConnection = false; - } + $this->reopenedConnection = false; + } - /** - * sucht nach einer bereits vorhandenen Instanz, wird keine gefunden, - * dann wird eine neue Instanz angelegt. - * Man kann die Config-Variable weglassen, wenn man sicher ist, dass - * bereits eine Instanz mit dem gewünschten instanceName existiert, - * existiert aber keiner, dann liefert getInstance eine Exception. - * - * @param $instance - * @param $config - * @return imapConnection - */ - public static function getInstance($instanceName,$config = null) { - if (!self::$instances) - self::$instances = array(); + /** + * sucht nach einer bereits vorhandenen Instanz, wird keine gefunden, + * dann wird eine neue Instanz angelegt. + * Man kann die Config-Variable weglassen, wenn man sicher ist, dass + * bereits eine Instanz mit dem gewünschten instanceName existiert, + * existiert aber keiner, dann liefert getInstance eine Exception. + * + * @param $instance + * @param $config + * @return imapConnection + */ + public static function getInstance($instanceName,$config = null) { + if (!self::$instances) + self::$instances = array(); - foreach (self::$instances as $instance) { - if ($instance->getInstanceName() == $instanceName) - return $instance; - } + foreach (self::$instances as $instance) { + if ($instance->getInstanceName() == $instanceName) + return $instance; + } - /* - if (!$config instanceof Config) { - throw new IMAPException(__METHOD__ . ' no config'); - } - */ + /* + if (!$config instanceof Config) { + throw new IMAPException(__METHOD__ . ' no config'); + } + */ - $object = new imapConnection($instanceName, $config); + $object = new imapConnection($instanceName, $config); - self::$instances[] = $object; + self::$instances[] = $object; - return $object; - } + return $object; + } - /** - * Liefert den Namen der aktuellen Instanz - * @return string - */ - public function getInstanceName() { - return $this->instanceName; - } + /** + * Liefert den Namen der aktuellen Instanz + * @return string + */ + public function getInstanceName() { + return $this->instanceName; + } } diff --git a/manager/library/l10n/L10n.php b/manager/library/l10n/L10n.php index 01a8d1b..6bcea2f 100644 --- a/manager/library/l10n/L10n.php +++ b/manager/library/l10n/L10n.php @@ -5,43 +5,43 @@ * $Id: L10n.php 13 2009-11-24 14:52:56Z markus $ */ class L10n { - /** - * static pointer to instance - * @var L10n - */ - private static $instance = null; + /** + * static pointer to instance + * @var L10n + */ + private static $instance = null; - /** - * config object - * @var Zend_Locale - */ - private $locale = null; + /** + * config object + * @var Zend_Locale + */ + private $locale = null; - /** - * make new translate - */ - protected function __construct() { - $this->locale = new Zend_Locale(); - } + /** + * make new translate + */ + protected function __construct() { + $this->locale = new Zend_Locale(); + } - /** - * get already existing instance, make new instance or throw an exception - * @return L10n - */ - public static function getInstance() { - if (self::$instance === null) { - self::$instance = new L10n(); - } + /** + * get already existing instance, make new instance or throw an exception + * @return L10n + */ + public static function getInstance() { + if (self::$instance === null) { + self::$instance = new L10n(); + } - return self::$instance; - } + return self::$instance; + } - /** - * magic __call dispatches all unknown methods to Zend_Locale - * @param unknown_type $method - * @param unknown_type $arguments - */ - public function __call($method, $arguments) { - return call_user_func_array(array($this->locale, $method), $arguments); - } + /** + * magic __call dispatches all unknown methods to Zend_Locale + * @param unknown_type $method + * @param unknown_type $arguments + */ + public function __call($method, $arguments) { + return call_user_func_array(array($this->locale, $method), $arguments); + } } diff --git a/manager/library/log/Log.php b/manager/library/log/Log.php index af97c9d..ce5a1e2 100644 --- a/manager/library/log/Log.php +++ b/manager/library/log/Log.php @@ -5,101 +5,101 @@ * $Id: Log.php 77 2010-02-26 11:58:34Z markus $ */ class Log { - /** - * static pointer to instances - * @var array(Config) - */ - private static $instances = array(); + /** + * static pointer to instances + * @var array(Config) + */ + private static $instances = array(); - /** - * can handle several instances, distinct by instance name string - * @var string - */ - private $instanceName = ''; + /** + * can handle several instances, distinct by instance name string + * @var string + */ + private $instanceName = ''; - /** - * config object - * @var Zend_Log - */ - private $log = null; + /** + * config object + * @var Zend_Log + */ + private $log = null; - /** - * make new logger, configuration is taken from system_config, section $instanceName - * @param string $instanceName - * @param string $application - */ - protected function __construct($instanceName, $application = null) { - if ($instanceName === null) - throw new Exception(__METHOD__ . ': expected an instance name, got none'); + /** + * make new logger, configuration is taken from system_config, section $instanceName + * @param string $instanceName + * @param string $application + */ + protected function __construct($instanceName, $application = null) { + if ($instanceName === null) + throw new Exception(__METHOD__ . ': expected an instance name, got none'); - $config = Config::getInstance(SYSTEM_CONFIG); - $log_config = $config->$instanceName; + $config = Config::getInstance(SYSTEM_CONFIG); + $log_config = $config->$instanceName; - $this->log = new Zend_Log(); - if (isset($log_config->file) && intval($log_config->file->enabled) !== 0) { - $file_logger = new Zend_Log_Writer_Stream($log_config->file->name); + $this->log = new Zend_Log(); + if (isset($log_config->file) && intval($log_config->file->enabled) !== 0) { + $file_logger = new Zend_Log_Writer_Stream($log_config->file->name); - /** - * - $format = Zend_Log_Formatter_Simple::DEFAULT_FORMAT; - $formatter = new Zend_Log_Formatter_Simple($format); - $file_logger->setFormatter($formatter); - */ - if (isset($application) && $application != '') - $this->log->setEventItem('application', $application); - $formatter = new Zend_Log_Formatter_Simple('%syslog_time% %application%[%pid%]: %priorityName%: %message%' . PHP_EOL); - $file_logger->setFormatter($formatter); - $this->log->addWriter($file_logger); - } - if (isset($log_config->syslog) && intval($log_config->syslog->enabled) !== 0) { - $param = array('facility' => $log_config->syslog->facility); - if (isset($application) && $application != '') - $param['application'] = $application; + /** + * + $format = Zend_Log_Formatter_Simple::DEFAULT_FORMAT; + $formatter = new Zend_Log_Formatter_Simple($format); + $file_logger->setFormatter($formatter); + */ + if (isset($application) && $application != '') + $this->log->setEventItem('application', $application); + $formatter = new Zend_Log_Formatter_Simple('%syslog_time% %application%[%pid%]: %priorityName%: %message%' . PHP_EOL); + $file_logger->setFormatter($formatter); + $this->log->addWriter($file_logger); + } + if (isset($log_config->syslog) && intval($log_config->syslog->enabled) !== 0) { + $param = array('facility' => $log_config->syslog->facility); + if (isset($application) && $application != '') + $param['application'] = $application; - $sys_logger = new Zend_Log_Writer_Syslog($param); - $formatter = new Zend_Log_Formatter_Simple('%priorityName%: %message%' . PHP_EOL); - $sys_logger->setFormatter($formatter); - $this->log->addWriter($sys_logger); - } + $sys_logger = new Zend_Log_Writer_Syslog($param); + $formatter = new Zend_Log_Formatter_Simple('%priorityName%: %message%' . PHP_EOL); + $sys_logger->setFormatter($formatter); + $this->log->addWriter($sys_logger); + } - $filter = new Zend_Log_Filter_Priority(intval($log_config->priority)); - $this->log->addFilter($filter); - } + $filter = new Zend_Log_Filter_Priority(intval($log_config->priority)); + $this->log->addFilter($filter); + } - /** - * get already existing instance, make new instance or throw an exception - * @param string $instanceName - * @param string $application - */ - public static function getInstance($instanceName = null, $application = null) { - if ($instanceName === null) { - if (count(self::$instances) == 0) - throw new Exception(__METHOD__ . ': expected an instance name, got none'); - return self::$instances[0]; - } + /** + * get already existing instance, make new instance or throw an exception + * @param string $instanceName + * @param string $application + */ + public static function getInstance($instanceName = null, $application = null) { + if ($instanceName === null) { + if (count(self::$instances) == 0) + throw new Exception(__METHOD__ . ': expected an instance name, got none'); + return self::$instances[0]; + } - if (!array_key_exists($instanceName, self::$instances)) { - self::$instances[$instanceName] = new Log($instanceName, $application); - } + if (!array_key_exists($instanceName, self::$instances)) { + self::$instances[$instanceName] = new Log($instanceName, $application); + } - return self::$instances[$instanceName]; - } + return self::$instances[$instanceName]; + } - /** - * return SYSTEM_LOG for convenience - * @return Zend_Log - */ - public static function Log() { - return self::$instances[SYSTEM_LOG]->getLog(); - } + /** + * return SYSTEM_LOG for convenience + * @return Zend_Log + */ + public static function Log() { + return self::$instances[SYSTEM_LOG]->getLog(); + } - /** - * get the Zend_Log object - * @return Zend_Log - */ - public function getLog() { - $this->log->setEventItem('pid', posix_getpid()); - $this->log->setEventItem('syslog_time', date('Y-m-d H:i:s')); - return $this->log; - } + /** + * get the Zend_Log object + * @return Zend_Log + */ + public function getLog() { + $this->log->setEventItem('pid', posix_getpid()); + $this->log->setEventItem('syslog_time', date('Y-m-d H:i:s')); + return $this->log; + } } diff --git a/manager/library/plugins/plugin.buildmenu.php b/manager/library/plugins/plugin.buildmenu.php index f3cb261..58eb090 100644 --- a/manager/library/plugins/plugin.buildmenu.php +++ b/manager/library/plugins/plugin.buildmenu.php @@ -8,67 +8,67 @@ * $Id: plugin.buildmenu.php 95 2010-03-19 14:14:39Z markus $ */ class BuildMenu extends Zend_Controller_Plugin_Abstract { - public function preDispatch(Zend_Controller_Request_Abstract $request) { - $session = Zend_Registry::get('session'); - if (!isset($session->authdata) || !isset($session->authdata['authed']) || $session->authdata['authed'] === false) - return; + public function preDispatch(Zend_Controller_Request_Abstract $request) { + $session = Zend_Registry::get('session'); + if (!isset($session->authdata) || !isset($session->authdata['authed']) || $session->authdata['authed'] === false) + return; - $cur_ctrl = $request->getControllerName(); - $cur_action = $request->getActionName(); + $cur_ctrl = $request->getControllerName(); + $cur_action = $request->getActionName(); - $view = Zend_Registry::get('view'); + $view = Zend_Registry::get('view'); - if (is_dir(FWACTIONS_PATH)) { - $dir = opendir(FWACTIONS_PATH); + if (is_dir(FWACTIONS_PATH)) { + $dir = opendir(FWACTIONS_PATH); - while (($file = readdir($dir)) !== false) { - if ($file == '.' || $file == '..') - continue; - if (preg_match('/^Action([a-zA-Z0-9_]*)\.php/', $file, $match)) { - $path = FWACTIONS_PATH . '/' . $file; - require_once($path); + while (($file = readdir($dir)) !== false) { + if ($file == '.' || $file == '..') + continue; + if (preg_match('/^Action([a-zA-Z0-9_]*)\.php/', $file, $match)) { + $path = FWACTIONS_PATH . '/' . $file; + require_once($path); - $r = new ReflectionClass($match[1]); + $r = new ReflectionClass($match[1]); - if ($r->isSubclassOf('FWAction')) { - /** - * match Actions permission with the permissions of the currently logged in user, - * add to menu if user has access to that action - */ + if ($r->isSubclassOf('FWAction')) { + /** + * match Actions permission with the permissions of the currently logged in user, + * add to menu if user has access to that action + */ - $required = $r->getMethod('getRequiredPermissions')->invoke(null); - $menuprio = $r->getMethod('getTopNavPrio')->invoke(null); - $ctrl = $r->getMethod('getController')->invoke(null); - $action = $r->getMethod('getAction')->invoke(null); - $text = $r->getMethod('getMenutext')->invoke(null); - $role = $session->authdata['authed_role']; + $required = $r->getMethod('getRequiredPermissions')->invoke(null); + $menuprio = $r->getMethod('getTopNavPrio')->invoke(null); + $ctrl = $r->getMethod('getController')->invoke(null); + $action = $r->getMethod('getAction')->invoke(null); + $text = $r->getMethod('getMenutext')->invoke(null); + $role = $session->authdata['authed_role']; - if ($cur_ctrl == $ctrl) # && $cur_action == $action) - $aclass = ' class="active"'; - else - $aclass = ''; + if ($cur_ctrl == $ctrl) # && $cur_action == $action) + $aclass = ' class="active"'; + else + $aclass = ''; - $acl = $session->authdata['authed_permissions']; - if (is_array($required) && count($required) == 0) { - $view->topNav('' . I18n::_($text) . '', Zend_View_Helper_Placeholder_Container_Abstract::SET, $menuprio); - } - else { - foreach ($required as $rperm) { - if ($acl->has($rperm) && $acl->isAllowed($role, $rperm, 'view')) { - $view->topNav('' . I18n::_($text) . '', Zend_View_Helper_Placeholder_Container_Abstract::SET, $menuprio); - break; // exit on first match - } - } - } - } - } - } + $acl = $session->authdata['authed_permissions']; + if (is_array($required) && count($required) == 0) { + $view->topNav('' . I18n::_($text) . '', Zend_View_Helper_Placeholder_Container_Abstract::SET, $menuprio); + } + else { + foreach ($required as $rperm) { + if ($acl->has($rperm) && $acl->isAllowed($role, $rperm, 'view')) { + $view->topNav('' . I18n::_($text) . '', Zend_View_Helper_Placeholder_Container_Abstract::SET, $menuprio); + break; // exit on first match + } + } + } + } + } + } - closedir($dir); - } - } -} + closedir($dir); + } + } +} \ No newline at end of file diff --git a/manager/library/plugins/plugin.charsetheader.php b/manager/library/plugins/plugin.charsetheader.php index b5c3357..cb3044b 100644 --- a/manager/library/plugins/plugin.charsetheader.php +++ b/manager/library/plugins/plugin.charsetheader.php @@ -4,10 +4,10 @@ * $Id: plugin.charsetheader.php 13 2009-11-24 14:52:56Z markus $ */ class CharsetHeader extends Zend_Controller_Plugin_Abstract { - public function preDispatch(Zend_Controller_Request_Abstract $request) { - $response = $this->getResponse(); - if ($response->canSendHeaders() === true) { - $response->setHeader('Content-Type', 'text/html; charset=utf-8'); - } - } -} + public function preDispatch(Zend_Controller_Request_Abstract $request) { + $response = $this->getResponse(); + if ($response->canSendHeaders() === true) { + $response->setHeader('Content-Type', 'text/html; charset=utf-8'); + } + } +} \ No newline at end of file diff --git a/manager/library/plugins/plugin.forceauth.php b/manager/library/plugins/plugin.forceauth.php index 004e500..e971056 100644 --- a/manager/library/plugins/plugin.forceauth.php +++ b/manager/library/plugins/plugin.forceauth.php @@ -4,26 +4,26 @@ * $Id: plugin.forceauth.php 40 2009-12-21 09:40:43Z markus $ */ class ForceAuth extends Zend_Controller_Plugin_Abstract { - public function dispatchLoopStartup(Zend_Controller_Request_Abstract $request) { - $session = Zend_Registry::get('session'); + public function dispatchLoopStartup(Zend_Controller_Request_Abstract $request) { + $session = Zend_Registry::get('session'); - if (in_array($request->getControllerName(), array('login', 'error', 'js', 'img', 'css'))) - return; + if (in_array($request->getControllerName(), array('login', 'error', 'js', 'img', 'css'))) + return; - if (!isset($session->authdata) || !isset($session->authdata['authed']) || $session->authdata['authed'] === false) { - $fc = Zend_Controller_Front::getInstance(); + if (!isset($session->authdata) || !isset($session->authdata['authed']) || $session->authdata['authed'] === false) { + $fc = Zend_Controller_Front::getInstance(); - $response = $fc->getResponse(); - $response->canSendHeaders(true); + $response = $fc->getResponse(); + $response->canSendHeaders(true); - $response->setHeader('Location', 'login', true); - $response->setHeader('Status', '301', true); - Log::Log()->debug('redirected to login'); + $response->setHeader('Location', 'login', true); + $response->setHeader('Status', '301', true); + Log::Log()->debug('redirected to login'); - $request->setModuleName('default') - ->setControllerName('login') - ->setActionName('index') - ->setDispatched(false); - } - } + $request->setModuleName('default') + ->setControllerName('login') + ->setActionName('index') + ->setDispatched(false); + } + } } diff --git a/manager/library/plugins/plugin.loginlogout.php b/manager/library/plugins/plugin.loginlogout.php index 75885d6..1077ef2 100644 --- a/manager/library/plugins/plugin.loginlogout.php +++ b/manager/library/plugins/plugin.loginlogout.php @@ -7,25 +7,25 @@ * $Id: plugin.loginlogout.php 95 2010-03-19 14:14:39Z markus $ */ class LoginLogout extends Zend_Controller_Plugin_Abstract { - public function postDispatch(Zend_Controller_Request_Abstract $request) { - $session = Zend_Registry::get('session'); - if (!isset($session->authdata) || !isset($session->authdata['authed']) || $session->authdata['authed'] === false) { - $controller = 'login'; - $text = 'Login'; - } - else { - $controller = 'logout'; - $text = 'Logout'; - } - $cur_ctrl = $request->getControllerName(); - if ($cur_ctrl == 'login') - $aclass=' class="active"'; - else - $aclass=''; + public function postDispatch(Zend_Controller_Request_Abstract $request) { + $session = Zend_Registry::get('session'); + if (!isset($session->authdata) || !isset($session->authdata['authed']) || $session->authdata['authed'] === false) { + $controller = 'login'; + $text = 'Login'; + } + else { + $controller = 'logout'; + $text = 'Logout'; + } + $cur_ctrl = $request->getControllerName(); + if ($cur_ctrl == 'login') + $aclass=' class="active"'; + else + $aclass=''; - $view = Zend_Registry::get('view'); - $view->topNav('' . I18n::_($text) . '', Zend_View_Helper_Placeholder_Container_Abstract::SET, 1000); - } + $view = Zend_Registry::get('view'); + $view->topNav('' . I18n::_($text) . '', Zend_View_Helper_Placeholder_Container_Abstract::SET, 1000); + } } diff --git a/manager/public/css/form_dl.css b/manager/public/css/form_dl.css index c3dc8c0..f677c34 100644 --- a/manager/public/css/form_dl.css +++ b/manager/public/css/form_dl.css @@ -1,23 +1,23 @@ @CHARSET "UTF-8"; #content dl.zend_form label.required { - color: #000000; - font-weight: bold; + color: #000000; + font-weight: bold; } #content dl.zend_form { - display: block; + display: block; } #content dl.zend_form dt { - display: block; - float: left; - width: 125px; - margin: 10px; + display: block; + float: left; + width: 125px; + margin: 10px; } #content dl.zend_form dd { - display: block; - clear: right; - padding: 10px; + display: block; + clear: right; + padding: 10px; } diff --git a/manager/public/css/form_dl_wide.css b/manager/public/css/form_dl_wide.css index 6f8ed41..181c6ca 100644 --- a/manager/public/css/form_dl_wide.css +++ b/manager/public/css/form_dl_wide.css @@ -1,24 +1,24 @@ @CHARSET "UTF-8"; #content dl.zend_form label.required { - color: #000000; - font-weight: bold; + color: #000000; + font-weight: bold; } #content dl.zend_form { - display: block; - font-size: 0.8em; + display: block; + font-size: 0.8em; } #content dl.zend_form dt { - display: block; - float: left; - width: 350px; - margin: 10px; + display: block; + float: left; + width: 350px; + margin: 10px; } #content dl.zend_form dd { - display: block; - clear: right; - padding: 10px; + display: block; + clear: right; + padding: 10px; } diff --git a/manager/public/css/global.css b/manager/public/css/global.css index ab111bf..d67ce22 100644 --- a/manager/public/css/global.css +++ b/manager/public/css/global.css @@ -1,123 +1,123 @@ @CHARSET "UTF-8"; html { - font-family: sans-serif; - background-color: #cccccc; - color: #333333; - overflow: scroll; + font-family: sans-serif; + background-color: #cccccc; + color: #333333; + overflow: scroll; } #center { - position: absolute; - width: 1000px; - left: 50%; - margin-left: -500px; + position: absolute; + width: 1000px; + left: 50%; + margin-left: -500px; } #header { - background-color: #F5F7F7; - width: 99%; - height: 30px; - top: 0px; - left: 0px; - position: absolute; - padding: 3px; - margin: 3px; + background-color: #F5F7F7; + width: 99%; + height: 30px; + top: 0px; + left: 0px; + position: absolute; + padding: 3px; + margin: 3px; } #header-logo { - float: left; - color: #FFFFFF; + float: left; + color: #FFFFFF; } #header-navigation { - float: right; + float: right; } #header-navigation ul { - list-style-type: none; - padding: 0px; - margin: 0px; - font-size: 1.2em; + list-style-type: none; + padding: 0px; + margin: 0px; + font-size: 1.2em; } #header-navigation ul li { - padding-left: 5px; - margin-left: 5px; - display: inline; + padding-left: 5px; + margin-left: 5px; + display: inline; } #header-navigation ul li a { - text-decoration: none; - color: #000000; + text-decoration: none; + color: #000000; } #header-navigation ul li a:hover { - color: #777777; + color: #777777; } #header-navigation ul li a.active { - color: #505090; + color: #505090; } #left-navigation { - background-color: #F5F7F7; - width: 180px; - height: 600px; - left: 0px; - top: 36px; - position: absolute; - padding: 3px; - margin: 3px; + background-color: #F5F7F7; + width: 180px; + height: 600px; + left: 0px; + top: 36px; + position: absolute; + padding: 3px; + margin: 3px; } #left-navigation ul { - list-style-type: none; - padding: 0px; - margin: 0px; - font-size: 1.2em; + list-style-type: none; + padding: 0px; + margin: 0px; + font-size: 1.2em; } #left-navigation ul li { - padding-left: 5px; - margin-left: 5px; - display: block; + padding-left: 5px; + margin-left: 5px; + display: block; } #left-navigation ul li a { - text-decoration: none; - color: #000000; + text-decoration: none; + color: #000000; } #left-navigation ul li a:hover { - color: #777777; + color: #777777; } #left-navigation ul li a.active { - color: #770000; + color: #770000; } #content { - left: 186px; - top: 36px; - width: 800px; - position: absolute; - padding: 5px; - margin: 3px; - background-color: #FFFFFF; + left: 186px; + top: 36px; + width: 800px; + position: absolute; + padding: 5px; + margin: 3px; + background-color: #FFFFFF; } #userinfo { - right: 5px; - bottom: 5px; - position: absolute; - padding: 3px; - margin: 3px; - background-color: #DDDDAA; - font-size: 0.8em; + right: 5px; + bottom: 5px; + position: absolute; + padding: 3px; + margin: 3px; + background-color: #DDDDAA; + font-size: 0.8em; } #content .error { - color: #F80808; - font-weight: bold; -} + color: #F80808; + font-weight: bold; +} \ No newline at end of file diff --git a/manager/public/css/login.css b/manager/public/css/login.css index 809f4fc..7fcc8aa 100644 --- a/manager/public/css/login.css +++ b/manager/public/css/login.css @@ -1,11 +1,11 @@ @CHARSET "UTF-8"; #content a { - text-decoration: none; - color: #000000; - font-size: 1.2em; + text-decoration: none; + color: #000000; + font-size: 1.2em; } #content a:hover { - color: #777777; -} + color: #777777; +} \ No newline at end of file diff --git a/manager/public/css/mail.css b/manager/public/css/mail.css index 13b12ea..4fbcde3 100644 --- a/manager/public/css/mail.css +++ b/manager/public/css/mail.css @@ -1,49 +1,49 @@ @CHARSET "UTF-8"; #content table { - border: 1px solid black; - border-collapse: collapse; + border: 1px solid black; + border-collapse: collapse; } #content th { - border: 1px solid black; - padding: 3px; + border: 1px solid black; + padding: 3px; } #content td { - border: 1px solid black; - padding: 3px; + border: 1px solid black; + padding: 3px; } #content .col1 { - width: 170px; + width: 170px; } #content .col2 { - width: 170px; + width: 170px; } #content .col3 { - width: 165px; + width: 165px; } #content .col4 { - width: 170px; + width: 170px; } #content .col5 { - width: 50px; + width: 50px; } #content .col6 { - width: 30px; + width: 30px; } #content a { - text-decoration: none; - color: #000000; + text-decoration: none; + color: #000000; } #content a:hover { - color: #777777; + color: #777777; } #content a.delete { - background-color: #ffffff; - color: white; + background-color: #ffffff; + color: white; } diff --git a/manager/public/index.php b/manager/public/index.php index 54a0e72..f214332 100644 --- a/manager/public/index.php +++ b/manager/public/index.php @@ -24,28 +24,28 @@ require_once('../library/global/defines.php'); try { - /** Zend Autoloader */ - require_once 'Zend/Loader/Autoloader.php'; - Zend_Loader_Autoloader::getInstance(); + /** Zend Autoloader */ + require_once 'Zend/Loader/Autoloader.php'; + Zend_Loader_Autoloader::getInstance(); - // Create application, bootstrap, and run - $application = new Zend_Application( - APPLICATION_ENV, - APPLICATION_PATH . '/configs/application.ini' - ); + // Create application, bootstrap, and run + $application = new Zend_Application( + APPLICATION_ENV, + APPLICATION_PATH . '/configs/application.ini' + ); - /** override settings from application.ini, if necessary - $fc = Zend_Controller_Front::getInstance(); - $fc->setControllerDirectory(realpath(APPLICATION_PATH . '/controllers')); - $fc->setParam('noViewRenderer', false); - $fc->throwExceptions(true); - $fc->setParam('noErrorHandler', false); - */ + /** override settings from application.ini, if necessary + $fc = Zend_Controller_Front::getInstance(); + $fc->setControllerDirectory(realpath(APPLICATION_PATH . '/controllers')); + $fc->setParam('noViewRenderer', false); + $fc->throwExceptions(true); + $fc->setParam('noErrorHandler', false); + */ - $application->bootstrap() - ->run(); + $application->bootstrap() + ->run(); } catch (Exception $e) { - print "Exception: " . $e->getMessage() . "\n"; - print $e->getTraceAsString() . "\n"; - Log::Log()->emerg($e); + print "Exception: " . $e->getMessage() . "\n"; + print $e->getTraceAsString() . "\n"; + Log::Log()->emerg($e); } diff --git a/manager/public/js/center.js b/manager/public/js/center.js index ea3a568..9313315 100644 --- a/manager/public/js/center.js +++ b/manager/public/js/center.js @@ -1,9 +1,9 @@ function setCSS() { - var x = window.innerWidth; + var x = window.innerWidth; - x = x - 18; // maybe scroll bar - document.getElementById('center').style.width = x + "px"; - document.getElementById('center').style.marginLeft = "-" + x/2 + "px"; + x = x - 18; // maybe scroll bar + document.getElementById('center').style.width = x + "px"; + document.getElementById('center').style.marginLeft = "-" + x/2 + "px"; } window.onload = setCSS; diff --git a/manager/public/js/positionUserInfo.js b/manager/public/js/positionUserInfo.js index b912b46..f6344eb 100644 --- a/manager/public/js/positionUserInfo.js +++ b/manager/public/js/positionUserInfo.js @@ -1,15 +1,15 @@ function setUserInfoPos() { - var x = window.innerWidth; - var ui; - - x = x - 18; // maybe scroll bar - - ui = document.getElementById('userinfo'); - if (ui != null) { - ui.style.right = "3px"; -// document.getElementById('userinfo').style.bottom = "3px"; - ui.style.bottom = 3 - window.pageYOffset + "px"; - } + var x = window.innerWidth; + var ui; + + x = x - 18; // maybe scroll bar + + ui = document.getElementById('userinfo'); + if (ui != null) { + ui.style.right = "3px"; +// document.getElementById('userinfo').style.bottom = "3px"; + ui.style.bottom = 3 - window.pageYOffset + "px"; + } } window.onload = setUserInfoPos;