summaryrefslogtreecommitdiff
path: root/manager/library
diff options
context:
space:
mode:
authorINOPIAE <inopiae@cacert.org>2015-08-09 19:12:51 +0200
committerBenny Baumann <BenBE@geshi.org>2015-08-09 22:23:21 +0200
commit4edd7b57c0057f9cfab0874a198256b87bd018b7 (patch)
tree2a623eade7fea29bda28e15692991821448c8fe1 /manager/library
parentce38587c8459587d7a03002ebcb4427ed95fb85c (diff)
downloadcacert-mgr-4edd7b57c0057f9cfab0874a198256b87bd018b7.tar.gz
cacert-mgr-4edd7b57c0057f9cfab0874a198256b87bd018b7.tar.xz
cacert-mgr-4edd7b57c0057f9cfab0874a198256b87bd018b7.zip
bug 1396: Codestyle cleanup
Diffstat (limited to 'manager/library')
-rw-r--r--manager/library/CAcert/User/Emails.php100
-rw-r--r--manager/library/actions/ActionIndex.php84
-rw-r--r--manager/library/actions/ActionLogin.php84
-rw-r--r--manager/library/actions/ActionMail.php84
-rw-r--r--manager/library/config/Config.php194
-rw-r--r--manager/library/config/Config_Db.php44
-rw-r--r--manager/library/config/Config_Writer_Db.php112
-rw-r--r--manager/library/date/HumanReadableTime.php238
-rw-r--r--manager/library/date/exception.HumanReadableTimeException.php4
-rw-r--r--manager/library/exception/exception.Base.php104
-rw-r--r--manager/library/i18n/I18n.php146
-rw-r--r--manager/library/imap/exception.IMAPException.php4
-rw-r--r--manager/library/imap/imapConnection.php862
-rw-r--r--manager/library/l10n/L10n.php68
-rw-r--r--manager/library/log/Log.php168
-rw-r--r--manager/library/plugins/plugin.buildmenu.php108
-rw-r--r--manager/library/plugins/plugin.charsetheader.php14
-rw-r--r--manager/library/plugins/plugin.forceauth.php34
-rw-r--r--manager/library/plugins/plugin.loginlogout.php40
19 files changed, 1246 insertions, 1246 deletions
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;
-
- /**
- * find out user id by email address
- */
- $sql = 'select users.id from users where email=?';
-
- $id = $db->fetchOne($sql, array($addr));
-
- /**
- * get secondary email addresses
- */
- $sql = 'select email.email from email where memid=?';
-
- $res = $db->query($sql, array($id));
-
- $emails = array();
-
- $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=?';
-
- $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'];
- }
- }
+ }
+
+ /**
+ * 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=?';
+
+ $id = $db->fetchOne($sql, array($addr));
+
+ /**
+ * get secondary email addresses
+ */
+ $sql = 'select email.email from email where memid=?';
+
+ $res = $db->query($sql, array($id));
+
+ $emails = array();
+
+ $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=?';
+
+ $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'];
+ }
+ }
// 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();
-
- /**
- * can handle several instances, distinct by instance name string
- * @var string
- */
- private $instanceName = '';
-
- /**
- * 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');
-
- $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);
-
- $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');
-
- // 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);
- }
-
- 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 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;
- }
-
- /**
- * get the config object
- * @return Zend_Config_*
- */
- public function getConfig() {
- return $this->config;
- }
+ /**
+ * static pointer to instances
+ * @var array(Config)
+ */
+ private static $instances = array();
+
+ /**
+ * can handle several instances, distinct by instance name string
+ * @var string
+ */
+ private $instanceName = '';
+
+ /**
+ * 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');
+
+ $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);
+
+ $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');
+
+ // 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);
+ }
+
+ 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 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;
+ }
+
+ /**
+ * 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));
- }
-
- 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
- */
+ $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;
+ }
+ }
+
+ /**
+ * 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();
-
- 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;
- }
-
- return $sql;
- }
+ $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;
+
+ $sql[] = $string;
+ }
+
+ 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 = '';
-
- /**
- * location of thrower
- * @var string
- */
- protected $exception_location = '';
+ /**
+ * additional data / string
+ * @var string
+ */
+ protected $extra = '';
+
+ /**
+ * 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 exception location string
- *
- * @access public
- * @return string
- */
- public function getExceptionLocation() {
- return $this->exception_location;
- }
+ /**
+ * 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;
+ }
}
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();
-
- /**
- * Instanzname, die unterschiedlichen Entitäten werden über den Namen
- * auseinandergehalten.
- * @var string
- */
- private $instanceName = '';
-
- /**
- * Configsection
- * @var Config
- */
- private $config = null;
-
- /**
- * IMAP Resource
- * @var imap_stream
- */
- private $imap = null;
-
- /**
- * Servername, Port, Flags
- * @var string
- */
- private $server = '';
+ /**
+ * 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 = '';
+
+ /**
+ * Configsection
+ * @var Config
+ */
+ private $config = null;
+
+ /**
+ * IMAP Resource
+ * @var imap_stream
+ */
+ private $imap = null;
+
+ /**
+ * 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;
-
- /**
- * 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');
- }
+ /**
+ * 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');
+ }
$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;
- }
-
-
- /**
- * 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');
- }
+ 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');
+ }
$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);
- }
-
- /**
- * 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');
- }
+ 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');
+ }
$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);
- }
-
- /**
- * 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');
- }
+ 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');
+ }
$this->imapPing(true);
- 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');
- }
+ 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');
+ }
$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);
- }
-
- /**
- * 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');
- }
+ 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');
+ }
$this->imapPing(true);
- 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');
- }
+ 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');
+ }
$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);
- }
-
- /**
- * 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');
- }
+ 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');
+ }
$this->imapPing(true);
- 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');
- }
+ 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');
+ }
$this->imapPing(true);
- $folderlist = $this->imapList($mbox_root);
- $foundFolder = false;
- foreach ($folderlist as $folder) {
- if (strpos($folder, $mbox) !== false) {
- return true;
- }
- }
-
- return false;
- }
-
- 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();
-
- $ar = explode('.', $mbox);
-
- $sub_mbox = $ar[count($ar) - 1];
-
- return $mbox.'.'.$sub_mbox.$delimiter.date($mode,$timestamp);
- }
-
- public static function imapMakePrefixedArchiveName($mbox, $mode, $prefix = '', $timestamp = null, $delimiter = '-') {
- if ($timestamp === null)
- $timestamp = time();
-
- $ar = explode('.', $mbox);
-
- $sub_mbox = $ar[count($ar) - 1];
-
- 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');
- }
+ $folderlist = $this->imapList($mbox_root);
+ $foundFolder = false;
+ foreach ($folderlist as $folder) {
+ if (strpos($folder, $mbox) !== false) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ 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();
+
+ $ar = explode('.', $mbox);
+
+ $sub_mbox = $ar[count($ar) - 1];
+
+ return $mbox.'.'.$sub_mbox.$delimiter.date($mode,$timestamp);
+ }
+
+ public static function imapMakePrefixedArchiveName($mbox, $mode, $prefix = '', $timestamp = null, $delimiter = '-') {
+ if ($timestamp === null)
+ $timestamp = time();
+
+ $ar = explode('.', $mbox);
+
+ $sub_mbox = $ar[count($ar) - 1];
+
+ 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');
+ }
$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;
- }
+ return true;
+ }
- public function __destruct() {
- if ($this->imap !== null) {
- imap_close($this->imap);
- $this->imap = null;
- }
- }
+ 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;
- }
+ /**
+ * 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
+ /**
+ * interne IMAP Open Methode
+ *
+ * @param string $servername
* @param string $username
* @param string password
* @param integer $flags
- * @return resource
- */
+ * @return resource
+ */
protected function imapOpen($server, $username, $password, $flags) {
- return imap_open($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 = '';
+ /**
+ * 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 = $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');
- }
-
- $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();
-
- foreach (self::$instances as $instance) {
- if ($instance->getInstanceName() == $instanceName)
- return $instance;
- }
-
- /*
- if (!$config instanceof Config) {
- throw new IMAPException(__METHOD__ . ' no config');
- }
- */
-
- $object = new imapConnection($instanceName, $config);
-
- self::$instances[] = $object;
-
- return $object;
- }
-
-
- /**
- * Liefert den Namen der aktuellen Instanz
- * @return string
- */
- public function getInstanceName() {
- return $this->instanceName;
- }
+ $this->imap = null;
+
+ $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');
+ }
+
+ $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();
+
+ foreach (self::$instances as $instance) {
+ if ($instance->getInstanceName() == $instanceName)
+ return $instance;
+ }
+
+ /*
+ if (!$config instanceof Config) {
+ throw new IMAPException(__METHOD__ . ' no config');
+ }
+ */
+
+ $object = new imapConnection($instanceName, $config);
+
+ self::$instances[] = $object;
+
+ return $object;
+ }
+
+
+ /**
+ * 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('<a href="' .
- $view->url(array('controller' => $ctrl, 'action' => $action), 'default', true) .
- '"' . $aclass . '>' . I18n::_($text) . '</a>', Zend_View_Helper_Placeholder_Container_Abstract::SET, $menuprio);
- }
- else {
- foreach ($required as $rperm) {
- if ($acl->has($rperm) && $acl->isAllowed($role, $rperm, 'view')) {
- $view->topNav('<a href="' .
- $view->url(array('controller' => $ctrl, 'action' => $action), 'default', true) .
- '"' . $aclass . '>' . I18n::_($text) . '</a>', 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('<a href="' .
+ $view->url(array('controller' => $ctrl, 'action' => $action), 'default', true) .
+ '"' . $aclass . '>' . I18n::_($text) . '</a>', Zend_View_Helper_Placeholder_Container_Abstract::SET, $menuprio);
+ }
+ else {
+ foreach ($required as $rperm) {
+ if ($acl->has($rperm) && $acl->isAllowed($role, $rperm, 'view')) {
+ $view->topNav('<a href="' .
+ $view->url(array('controller' => $ctrl, 'action' => $action), 'default', true) .
+ '"' . $aclass . '>' . I18n::_($text) . '</a>', 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('<a href="' .
- $view->url(array('controller' => $controller), 'default', true) .
- '"' . $aclass . '>' . I18n::_($text) . '</a>', Zend_View_Helper_Placeholder_Container_Abstract::SET, 1000);
- }
+ $view = Zend_Registry::get('view');
+ $view->topNav('<a href="' .
+ $view->url(array('controller' => $controller), 'default', true) .
+ '"' . $aclass . '>' . I18n::_($text) . '</a>', Zend_View_Helper_Placeholder_Container_Abstract::SET, 1000);
+ }
}