Merge branch 'master' into bugfix/rebuild-form-builder-5525

Conflicts:
	application/forms/Config/Authentication/BaseBackendForm.php
	application/forms/Config/Authentication/DbBackendForm.php
	application/forms/Config/Authentication/LdapBackendForm.php
	application/forms/Config/Authentication/ReorderForm.php
	application/forms/Config/LoggingForm.php
	application/forms/Config/ResourceForm.php
	application/forms/Preference/GeneralForm.php
	library/Icinga/Application/Config.php
	library/Icinga/Web/Form.php
	modules/monitoring/application/controllers/ConfigController.php
	modules/monitoring/application/forms/Config/Backend/CreateBackendForm.php
	modules/monitoring/application/forms/Config/Instance/CreateInstanceForm.php
	modules/monitoring/application/forms/Config/Instance/EditInstanceForm.php
	modules/monitoring/application/forms/Config/SecurityForm.php
This commit is contained in:
Johannes Meyer 2014-08-29 16:05:56 +02:00
commit fb5685bac3
174 changed files with 3237 additions and 2036 deletions

View File

@ -696,6 +696,13 @@ file { '/etc/icingaweb':
group => 'apache'
}
file { '/etc/icingaweb/preferences':
ensure => 'directory',
owner => 'apache',
group => 'apache',
require => File['/etc/icingaweb']
}
file { '/etc/icingaweb/authentication.ini':
source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icingaweb/authentication.ini',
owner => 'apache',
@ -709,13 +716,6 @@ file { '/etc/icingaweb/config.ini':
group => 'apache',
}
file { '/etc/icingaweb/menu.ini':
source => 'puppet:////vagrant/config/menu.ini',
owner => 'apache',
group => 'apache',
# replace => false,
}
file { '/etc/icingaweb/resources.ini':
source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icingaweb/resources.ini',
owner => 'apache',
@ -747,24 +747,6 @@ file { '/etc/icingaweb/modules/monitoring/instances.ini':
group => 'apache',
}
file { '/etc/icingaweb/modules/monitoring/menu.ini':
source => 'puppet:////vagrant/config/modules/monitoring/menu.ini',
owner => 'apache',
group => 'apache',
}
file { '/etc/icingaweb/dashboard':
ensure => 'directory',
owner => 'apache',
group => 'apache',
}
file { '/etc/icingaweb/dashboard/dashboard.ini':
source => 'puppet:////vagrant/config/dashboard/dashboard.ini',
owner => 'apache',
group => 'apache',
}
# pear::package { 'deepend/Mockery':
# channel => 'pear.survivethedeepend.com'
# }
@ -791,16 +773,3 @@ file { '/etc/bash_completion.d/icingacli':
mode => 755,
require => Exec['install bash-completion']
}
file { '/etc/icingaweb/modules/doc/':
ensure => 'directory',
owner => 'apache',
group => 'apache'
}
file { '/etc/icingaweb/modules/doc/menu.ini':
source => 'puppet:////vagrant/config/modules/doc/menu.ini',
owner => 'apache',
group => 'apache',
}

View File

@ -5,7 +5,7 @@
namespace Icinga\Clicommands;
use Icinga\Cli\Command;
use Exception;
use Icinga\Exception\IcingaException;
class WebCommand extends Command
{
@ -13,11 +13,11 @@ class WebCommand extends Command
{
$minVersion = '5.4.0';
if (version_compare(PHP_VERSION, $minVersion) < 0) {
throw new Exception(sprintf(
throw new IcingaException(
'You are running PHP %s, internal webserver requires %s.',
PHP_VERSION,
$minVersion
));
);
}
$fork = $this->params->get('daemonize');
@ -27,12 +27,12 @@ class WebCommand extends Command
// TODO: Sanity check!!
if ($socket === null) {
$socket = '0.0.0.0:80';
// throw new Exception('Socket is required');
// throw new IcingaException('Socket is required');
}
if ($basedir === null) {
$basedir = dirname(ICINGAWEB_APPDIR) . '/public';
if (! file_exists($basedir) || ! is_dir($basedir)) {
throw new Exception('Basedir is required');
throw new IcingaException('Basedir is required');
}
}
$basedir = realpath($basedir);
@ -68,7 +68,7 @@ class WebCommand extends Command
{
$pid = pcntl_fork();
if ($pid == -1) {
throw new Exception('Could not fork');
throw new IcingaException('Could not fork');
} else if ($pid) {
echo $this->screen->colorize('[OK]')
. " Icinga Web server forked successfully\n";

View File

@ -2,7 +2,6 @@
// {{{ICINGA_LICENSE_HEADER}}}
// {{{ICINGA_LICENSE_HEADER}}}
use \Zend_Config;
use Icinga\Web\Url;
use Icinga\Logger\Logger;
use Icinga\Config\PreservingIniWriter;
@ -12,6 +11,7 @@ use Icinga\Form\Dashboard\AddUrlForm;
use Icinga\Exception\NotReadableError;
use Icinga\Exception\ConfigurationError;
use Icinga\Web\Controller\ActionController;
use Icinga\Exception\IcingaException;
/**
* Handle creation, removal and displaying of dashboards, panes and components
@ -42,7 +42,7 @@ class DashboardController extends ActionController
}
$dashboard->readConfig($dashboardConfig);
} catch (NotReadableError $e) {
Logger::error(new Exception('Cannot load dashboard configuration. An exception was thrown:', 0, $e));
Logger::error(new IcingaException('Cannot load dashboard configuration. An exception was thrown:', $e));
return null;
}
return $dashboard;
@ -115,19 +115,23 @@ class DashboardController extends ActionController
*/
public function indexAction()
{
$dashboard = $this->getDashboard();
if ($this->_getParam('pane')) {
$pane = $this->_getParam('pane');
$dashboard->activate($pane);
}
$dashboard = Dashboard::load();
$this->view->configPath = IcingaConfig::resolvePath(self::DEFAULT_CONFIG);
if ($dashboard === null) {
if (! $dashboard->hasPanes()) {
$this->view->title = 'Dashboard';
} else {
$this->view->title = $dashboard->getActivePane()->getTitle() . ' :: Dashboard';
$this->view->tabs = $dashboard->getTabs();
if ($this->_getParam('pane')) {
$pane = $this->_getParam('pane');
$dashboard->activate($pane);
}
$this->view->configPath = IcingaConfig::resolvePath(self::DEFAULT_CONFIG);
if ($dashboard === null) {
$this->view->title = 'Dashboard';
} else {
$this->view->title = $dashboard->getActivePane()->getTitle() . ' :: Dashboard';
$this->view->tabs = $dashboard->getTabs();
/* Temporarily removed
$this->view->tabs->add(
@ -139,8 +143,8 @@ class DashboardController extends ActionController
);
*/
$this->view->dashboard = $dashboard;
$this->view->dashboard = $dashboard;
}
}
}

View File

@ -18,8 +18,9 @@ class LayoutController extends ActionController
*/
public function menuAction()
{
$this->_helper->layout()->disableLayout();
$this->view->menuRenderer = new MenuRenderer(
Menu::fromConfig()->order(), Url::fromRequest()->without('renderLayout')->getRelativeUrl()
Menu::load(), Url::fromRequest()->without('renderLayout')->getRelativeUrl()
);
}
@ -30,11 +31,11 @@ class LayoutController extends ActionController
{
$topbarHtmlParts = array();
/** @var Hook\Layout\TopBar $hook */
/** @var Hook\TopBarHook $hook */
$hook = null;
foreach (Hook::all('TopBar') as $hook) {
$topbarHtmlParts[] = $hook->getHtml($this->getRequest(), $this->view);
$topbarHtmlParts[] = $hook->getHtml($this->getRequest());
}
$this->view->topbarHtmlParts = $topbarHtmlParts;

View File

@ -45,8 +45,7 @@ class ListController extends Controller
file_exists($config_ini['logging']['target'])
)
) {
$config = ResourceFactory::getResourceConfig('logfile');
$resource = ResourceFactory::createResource($config);
$resource = ResourceFactory::create('logfile');
$this->view->logData = $resource->select()->order('DESC')->paginate();
} else {
$this->view->logData = null;

View File

@ -2,7 +2,7 @@
// {{{ICINGA_LICENSE_HEADER}}}
// {{{ICINGA_LICENSE_HEADER}}}
use \Zend_Controller_Action_Exception as ActionException;
use Zend_Controller_Action_Exception as ActionException;
use Icinga\Web\Controller\ActionController;
use Icinga\Application\Icinga;
use Icinga\Logger\Logger;
@ -30,8 +30,8 @@ class StaticController extends ActionController
public function gravatarAction()
{
header('Content-Type: image/jpg');
$img = file_get_contents('http://www.gravatar.com/avatar/' . md5(strtolower(trim($this->_request->getParam('email')))) . '?s=200&d=mm');
header('image/jpeg');
echo $img;
}

View File

@ -105,10 +105,7 @@ class DbBackendForm extends Form
$element = $form->getElement('resource');
try {
$testConnection = ResourceFactory::createResource(
ResourceFactory::getResourceConfig($element->getValue())
);
$dbUserBackend = new DbUserBackend($testConnection);
$dbUserBackend = new DbUserBackend(ResourceFactory::create($element->getValue()));
if ($dbUserBackend->count() < 1) {
$element->addError(t('No users found under the specified database backend'));
return false;

View File

@ -125,9 +125,7 @@ class LdapBackendForm extends Form
try {
$ldapUserBackend = new LdapUserBackend(
ResourceFactory::createResource(
ResourceFactory::getResourceConfig($element->getValue())
),
ResourceFactory::create($element->getValue()),
$form->getElement('user_class')->getValue(),
$form->getElement('user_name_attribute')->getValue()
);

View File

@ -9,7 +9,7 @@ use Icinga\Web\Request;
use Icinga\Form\ConfigForm;
use Icinga\Web\Notification;
use Icinga\Application\Config;
use Icinga\Data\ResourceFactory;
use Icinga\Application\Platform;
use Icinga\Exception\ConfigurationError;
use Icinga\Form\Config\Authentication\DbBackendForm;
use Icinga\Form\Config\Authentication\LdapBackendForm;
@ -283,7 +283,7 @@ class AuthenticationBackendConfigForm extends ConfigForm
if (isset($this->resources['db'])) {
$backendTypes['db'] = t('Database');
}
if (isset($this->resources['ldap']) && ($backendType === 'ldap' || ResourceFactory::ldapAvailable())) {
if (isset($this->resources['ldap']) && ($backendType === 'ldap' || Platform::extensionLoaded('ldap'))) {
$backendTypes['ldap'] = 'LDAP';
}

View File

@ -5,6 +5,7 @@
namespace Icinga\Form\Config;
use Exception;
use Icinga\Application\Platform;
use Zend_Config;
use Icinga\Web\Form;
use Icinga\Application\Icinga;
@ -118,14 +119,14 @@ class ResourceForm extends Form
* in case they aren't actually used. When the user tries to create a resource that depends on an
* uninstalled extension, an error should be displayed.
*/
if ($config['db'] === 'mysql' && false === ResourceFactory::mysqlAvailable()) {
if ($config['db'] === 'mysql' && false === Platform::extensionLoaded('mysql')) {
$this->addErrorMessage(
t('You need to install the php extension "mysql" and the ' .
'Zend_Pdo_Mysql classes to use MySQL database resources.')
);
return false;
}
if ($config['db'] === 'pgsql' && false === ResourceFactory::pgsqlAvailable()) {
if ($config['db'] === 'pgsql' && false === Platform::extensionLoaded('pgsql')) {
$this->addErrorMessage(
t('You need to install the php extension "pgsql" and the ' .
'Zend_Pdo_Pgsql classes to use PostgreSQL database resources.')

View File

@ -14,5 +14,5 @@ if (! $this->auth()->isAuthenticated()) {
<form action="<?= $this->href('search') ?>" method="get" role="search">
<input type="text" name="q" class="search autofocus" placeholder="<?= $this->translate('Search...') ?>" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />
</form>
<?= new MenuRenderer(Menu::fromConfig()->order(), Url::fromRequest()->without('renderLayout')->getRelativeUrl()); ?>
<?= new MenuRenderer(Menu::load(), Url::fromRequest()->without('renderLayout')->getRelativeUrl()); ?>
</div>

View File

@ -5,121 +5,191 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Icinga Web 2 (0.1)\n"
"Project-Id-Version: Icinga Web 2 (None)\n"
"Report-Msgid-Bugs-To: dev@icinga.org\n"
"POT-Creation-Date: 2014-05-29 11:12+0000\n"
"PO-Revision-Date: 2014-05-29 13:19+0100\n"
"POT-Creation-Date: 2014-08-22 17:30+0200\n"
"PO-Revision-Date: 2014-08-22 17:52+0100\n"
"Last-Translator: Thomas Gelf <thomas@gelf.net>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: /usr/local/src/bugfix.master/application/views/scripts/mixedPagination.phtml:15
#, php-format
msgid "%d to %d of %d"
msgstr "%d bis %d von %d"
#: /usr/local/src/bugfix.master/application/views/scripts/pivottablePagination.phtml:9
#, php-format
msgid "%s: %d to %d of %d"
msgstr "%s: %d bis %d von %d"
#: /usr/local/src/bugfix.master/application/forms/Config/LoggingForm.php:117
#: /usr/local/src/bugfix.master/application/forms/Authentication/LoginForm.php:36
msgid "...and your password"
msgstr "...und dein Kennwort ein"
#: /usr/local/src/bugfix.master/library/Icinga/Web/Widget/FilterEditor.php:132
msgid "Add"
msgstr "Hinzufügen"
#: /usr/local/src/bugfix.master/library/Icinga/Web/Widget/FilterWidget.php:81
msgid "Add filter..."
msgstr "Filter hinzufügen..."
#: /usr/local/src/bugfix.master/application/controllers/AuthenticationController.php:118
msgid "All configured authentication methods failed. Please check the system log or Icinga Web 2 log for more information."
msgstr "Alle konfigurierten Authentifizierungsmethoden sind fehlgeschlagen. Bitte überprüfe das Systemlog oder jenes von Icinga Web 2 für weitere Details."
#: /usr/local/src/bugfix.master/application/forms/Config/LoggingForm.php:91
msgid "Application Prefix"
msgstr "Anwendungspräfix"
#: /usr/local/src/bugfix.master/application/forms/Config/Authentication/DbBackendForm.php:78
#: /usr/local/src/bugfix.master/application/forms/Config/Authentication/LdapBackendForm.php:80
#: /usr/local/src/bugfix.master/library/Icinga/Web/Menu.php:197
msgid "ApplicationLog"
msgstr "Anwendungslog"
#: /usr/local/src/bugfix.master/library/Icinga/Web/Form/notyet_FormWizard.php:31
msgid "Back"
msgstr "Zurück"
#: /usr/local/src/bugfix.master/application/forms/Config/Authentication/DbBackendForm.php:53
#: /usr/local/src/bugfix.master/application/forms/Config/Authentication/LdapBackendForm.php:55
msgid "Backend Name"
msgstr "Backend-Name"
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:282
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:257
msgid "Bind DN"
msgstr "Bind DN"
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:294
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:269
msgid "Bind Password"
msgstr "Bind Kennwort"
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:358
#: /usr/local/src/bugfix.master/application/forms/Config/Authentication/BaseBackendForm.php:139
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:333
#: /usr/local/src/bugfix.master/application/forms/Config/Authentication/BaseBackendForm.php:114
msgid "Check this box to enforce changes without connectivity validation"
msgstr "Aktiviere dieses Häkchen um die Änderungen ohne Validierung der Verbindung zu speichern"
#: /usr/local/src/bugfix.master/application/forms/Config/LoggingForm.php:73
#: /usr/local/src/bugfix.master/application/forms/Config/LoggingForm.php:47
msgid "Check this to enable logging."
msgstr "Aktiviere dieses Häkchen um das Logging zu aktivieren."
#: /usr/local/src/bugfix.master/application/forms/Config/Authentication/LdapBackendForm.php:187
#: /usr/local/src/bugfix.master/library/Icinga/Web/Widget/FilterEditor.php:108
msgid "Click to add a filter expression to this operator"
msgstr "Hier klicken, um einen Filter-Ausdruck zu diesem Operator hinzuzufügen"
#: /usr/local/src/bugfix.master/library/Icinga/Web/Widget/FilterEditor.php:105
msgid "Click to add another operator below this one"
msgstr "Hier klicken, um unterhalb dieses Operators einen weiteren hinzuzufügen"
#: /usr/local/src/bugfix.master/library/Icinga/Web/Widget/FilterEditor.php:97
#: /usr/local/src/bugfix.master/library/Icinga/Web/Widget/FilterWidget.php:69
msgid "Click to remove this part of your filter"
msgstr "Klicken, um diesen Teil des Filters zu löschen"
#: /usr/local/src/bugfix.master/library/Icinga/Web/Menu.php:189
msgid "Configuration"
msgstr "Konfiguration"
#: /usr/local/src/bugfix.master/application/forms/Config/Authentication/LdapBackendForm.php:165
msgid "Connection Validation Failed: "
msgstr "Überprüfung der Verbindung fehlgeschlagen: "
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:477
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:452
msgid "Connectivity validation failed, connection to the given resource not possible."
msgstr "Überprüfung fehlgeschlagen, konnte keine Verbindung zu der angegebenen Ressource herstellen."
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:454
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:470
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:429
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:445
msgid "Connectivity validation failed, the provided file does not exist."
msgstr "Überprüfung fehlgeschlagen, die angegebene Datei existiert nicht."
#: /usr/local/src/bugfix.master/application/forms/Config/Authentication/DbBackendForm.php:90
#: /usr/local/src/bugfix.master/application/controllers/AuthenticationController.php:59
msgid "Could not read your authentiction.ini, no authentication methods are available."
msgstr "Deine authentication.ini konnte nicht gelesen werden, darum sind keine Authentifizierungsmethoden verfügbar."
#: /usr/local/src/bugfix.master/application/layouts/scripts/body.phtml:31
#: /usr/local/src/bugfix.master/library/Icinga/Web/Menu.php:175
msgid "Dashboard"
msgstr "Dashboard"
#: /usr/local/src/bugfix.master/application/forms/Config/Authentication/DbBackendForm.php:65
msgid "Database Connection"
msgstr "Datenbankverbindung"
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:183
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:158
msgid "Database Name"
msgstr "Datenbankname"
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:144
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:119
msgid "Database Type"
msgstr "Datenbanktyp"
#: /usr/local/src/bugfix.master/application/forms/Config/LoggingForm.php:89
#: /usr/local/src/bugfix.master/application/forms/Config/LoggingForm.php:63
msgid "Debug"
msgstr "Debug"
#: /usr/local/src/bugfix.master/application/forms/Config/GeneralForm.php:185
#: /usr/local/src/bugfix.master/application/forms/Config/GeneralForm.php:101
msgid "Default Language"
msgstr "Standardsprache"
#: /usr/local/src/bugfix.master/application/controllers/ErrorController.php:62
#: /usr/local/src/bugfix.master/application/controllers/ErrorController.php:36
#, php-format
msgid "Enabling the \"%s\" module might help!"
msgstr "Das Modul \"%s\" zu aktivieren könnte helfen!"
#: /usr/local/src/bugfix.master/application/forms/Config/LoggingForm.php:86
#: /usr/local/src/bugfix.master/application/forms/Config/LoggingForm.php:60
msgid "Error"
msgstr "Fehler"
#: /usr/local/src/bugfix.master/application/forms/Config/LoggingForm.php:139
#: /usr/local/src/bugfix.master/library/Icinga/Web/Widget/FilterEditor.php:109
msgid "Expression"
msgstr "Ausdruck"
#: /usr/local/src/bugfix.master/application/forms/Config/LoggingForm.php:113
msgid "Facility"
msgstr "Facility"
#: /usr/local/src/bugfix.master/application/forms/Config/LoggingForm.php:102
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:383
#: /usr/local/src/bugfix.master/application/controllers/PreferenceController.php:55
#, php-format
msgid "Failed to persist preferences. (%s)"
msgstr "Persistierung der Einstellungen fehlgeschlagen. (%s)"
#: /usr/local/src/bugfix.master/application/forms/Config/LoggingForm.php:76
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:358
msgid "File"
msgstr "Datei"
#: /usr/local/src/bugfix.master/application/forms/Config/LoggingForm.php:155
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:220
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:231
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:308
#: /usr/local/src/bugfix.master/application/forms/Config/LoggingForm.php:129
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:195
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:206
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:283
msgid "Filepath"
msgstr "Dateipfad"
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:357
#: /usr/local/src/bugfix.master/application/forms/Config/Authentication/BaseBackendForm.php:138
#: /usr/local/src/bugfix.master/library/Icinga/Web/Widget/FilterWidget.php:90
msgid "Filter this list"
msgstr "Diese Liste filtern"
#: /usr/local/src/bugfix.master/library/Icinga/Web/Widget/FilterWidget.php:94
msgid "Filtered"
msgstr "Gefiltert"
#: /usr/local/src/bugfix.master/library/Icinga/Web/Form/notyet_FormWizard.php:32
msgid "Finish"
msgstr "Fertigstellen"
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:332
#: /usr/local/src/bugfix.master/application/forms/Config/Authentication/BaseBackendForm.php:113
msgid "Force Changes"
msgstr "Änderungen erzwingen"
#: /usr/local/src/bugfix.master/library/Icinga/Web/Form/notyet_QuickForm.php:147
msgid "Form has successfully been sent"
msgstr "Das Formular wurde erfolgreich versendet"
#: /usr/local/src/bugfix.master/application/views/scripts/search/hint.phtml:7
msgid "Hint"
msgstr "Hinweis"
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:160
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:260
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:135
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:235
msgid "Host"
msgstr "Host"
@ -132,165 +202,183 @@ msgstr "Hosts"
msgid "I'm ready to search, waiting for your input"
msgstr "Ich bin bereit zur Suche, warte auf deine Eingabe"
#: /usr/local/src/bugfix.master/application/controllers/AuthenticationController.php:63
#: /usr/local/src/bugfix.master/application/controllers/AuthenticationController.php:40
#: /usr/local/src/bugfix.master/application/views/scripts/authentication/login.phtml:8
msgid "Icingaweb Login"
msgstr "Icingaweb Anmeldung"
#: /usr/local/src/bugfix.master/application/views/scripts/authentication/logout.phtml:17
#: /usr/local/src/bugfix.master/application/views/scripts/authentication/logout.phtml:14
msgid "If this message does not disappear, it might be necessary to quit the current session manually by clearing the cache, or by closing the current browser session."
msgstr "Wenn diese Nachricht nicht verschwindet könnte es nötig sein die aktuelle Sitzung manuell zu beenden indem der Cache gelöscht order die Browsersitzung geschlossen wird."
#: /usr/local/src/bugfix.master/application/controllers/AuthenticationController.php:118
#: /usr/local/src/bugfix.master/application/controllers/AuthenticationController.php:131
msgid "Incorrect username or password"
msgstr "Benutzername oder Kennwort ungültig"
#: /usr/local/src/bugfix.master/application/forms/Config/LoggingForm.php:88
#: /usr/local/src/bugfix.master/application/forms/Config/LoggingForm.php:62
msgid "Information"
msgstr "Information"
#: /usr/local/src/bugfix.master/library/Icinga/Web/Wizard/Wizard.php:337
#: /usr/local/src/bugfix.master/library/Icinga/Web/Wizard/Wizard.php:380
msgid "Install"
msgstr "Installieren"
#: /usr/local/src/bugfix.master/application/views/scripts/install/index.phtml:29
msgid "Installation"
msgstr "Installation"
#: /usr/local/src/bugfix.master/application/forms/Config/Authentication/LdapBackendForm.php:92
#: /usr/local/src/bugfix.master/application/forms/Config/Authentication/LdapBackendForm.php:67
msgid "LDAP Resource"
msgstr "LDAP Ressource"
#: /usr/local/src/bugfix.master/application/forms/Config/Authentication/LdapBackendForm.php:115
#: /usr/local/src/bugfix.master/application/forms/Config/Authentication/LdapBackendForm.php:90
msgid "LDAP User Name Attribute"
msgstr "LDAP-Attribut für Benutzername"
#: /usr/local/src/bugfix.master/application/forms/Config/Authentication/LdapBackendForm.php:104
#: /usr/local/src/bugfix.master/application/forms/Config/Authentication/LdapBackendForm.php:79
msgid "LDAP User Object Class"
msgstr "LDAP Objektklasse für Benutzer"
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:232
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:207
msgid "Location of your icinga objects.cache file"
msgstr "Pfad zur Datei objects.cache von Icinga"
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:221
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:196
msgid "Location of your icinga status.dat file"
msgstr "Pfad zur Datei status.dat von Icinga"
#: /usr/local/src/bugfix.master/application/controllers/InstallController.php:69
msgid "Logging"
msgstr "Logging"
#: /usr/local/src/bugfix.master/application/forms/Config/LoggingForm.php:72
#: /usr/local/src/bugfix.master/application/forms/Config/LoggingForm.php:46
msgid "Logging Enabled"
msgstr "Logging aktiv"
#: /usr/local/src/bugfix.master/application/forms/Config/LoggingForm.php:82
#: /usr/local/src/bugfix.master/application/forms/Config/LoggingForm.php:56
msgid "Logging Level"
msgstr "Log-Level"
#: /usr/local/src/bugfix.master/application/forms/Config/LoggingForm.php:98
#: /usr/local/src/bugfix.master/application/forms/Config/LoggingForm.php:72
msgid "Logging Type"
msgstr "Logging-Typ"
#: /usr/local/src/bugfix.master/application/views/scripts/authentication/logout.phtml:15
#: /usr/local/src/bugfix.master/application/views/scripts/authentication/logout.phtml:12
msgid "Logging out..."
msgstr "Abmelden..."
#: /usr/local/src/bugfix.master/application/views/scripts/authentication/logout.phtml:28
#: /usr/local/src/bugfix.master/application/views/scripts/authentication/logout.phtml:21
msgid "Login"
msgstr "Anmelden"
#: /usr/local/src/bugfix.master/application/layouts/scripts/body.phtml:39
#: /usr/local/src/bugfix.master/application/layouts/scripts/parts/topbar.phtml:35
#: /usr/local/src/bugfix.master/library/Icinga/Web/Menu.php:202
msgid "Logout"
msgstr "Abmelden"
#: /usr/local/src/bugfix.master/application/views/scripts/authentication/logout.phtml:64
msgid "Logout not possible, it may be necessary to quit the session manually by clearing the cache, or closing the current browser session. Error: "
msgstr ""
#: /usr/local/src/bugfix.master/application/views/scripts/authentication/logout.phtml:69
#: /usr/local/src/bugfix.master/application/views/scripts/authentication/logout.phtml:43
msgid "Logout successful!"
msgstr "Abmelden erfolgreich!"
#: /usr/local/src/bugfix.master/application/forms/Config/Authentication/ReorderForm.php:137
msgid "Move down in authentication order"
msgstr ""
#: /usr/local/src/bugfix.master/library/Icinga/Web/Widget/FilterEditor.php:235
#: /usr/local/src/bugfix.master/library/Icinga/Web/Widget/FilterWidget.php:95
msgid "Modify this filter"
msgstr "Diesen Filter bearbeiten"
#: /usr/local/src/bugfix.master/application/forms/Config/Authentication/ReorderForm.php:111
#: /usr/local/src/bugfix.master/library/Icinga/Web/Menu.php:193
msgid "Modules"
msgstr "Module"
#: /usr/local/src/bugfix.master/application/forms/Config/Authentication/ReorderForm.php:112
msgid "Move down in authentication order"
msgstr "In der Authentifizierungsreihenfolge nach unten schieben"
#: /usr/local/src/bugfix.master/application/forms/Config/Authentication/ReorderForm.php:86
msgid "Move up in authentication order"
msgstr ""
msgstr "In der Authentifizierungsreihenfolge nach oben schieben"
#: /usr/local/src/bugfix.master/application/views/scripts/pivottablePagination.phtml:16
msgid "Navigation"
msgstr "Navigation"
#: /usr/local/src/bugfix.master/application/views/scripts/mixedPagination.phtml:83
#: /usr/local/src/bugfix.master/application/views/scripts/mixedPagination.phtml:86
#: /usr/local/src/bugfix.master/library/Icinga/Web/Wizard/Wizard.php:337
#: /usr/local/src/bugfix.master/library/Icinga/Web/Wizard/Wizard.php:380
#: /usr/local/src/bugfix.master/application/views/scripts/mixedPagination.phtml:89
#: /usr/local/src/bugfix.master/library/Icinga/Web/Form/notyet_FormWizard.php:30
msgid "Next"
msgstr "Weiter"
#: /usr/local/src/bugfix.master/application/forms/Config/Authentication/DbBackendForm.php:144
msgid "No users found under the specified database backend"
msgstr ""
#: /usr/local/src/bugfix.master/application/controllers/AuthenticationController.php:110
msgid "No authentication methods available. Did you create authentication.ini when installing Icinga Web 2?"
msgstr "Keine Authentifizierungsmethode verfügbar. Hast du beim Installieren von Icinga Web 2 eine authentication.ini erstellt?"
#: /usr/local/src/bugfix.master/application/controllers/ErrorController.php:59
#: /usr/local/src/bugfix.master/application/forms/Config/Authentication/DbBackendForm.php:119
msgid "No users found under the specified database backend"
msgstr "Im konfigurierten Datenbankbackend wurden keine Benutzer gefunden"
#: /usr/local/src/bugfix.master/library/Icinga/Web/Widget/FilterEditor.php:106
msgid "Operator"
msgstr "Operator"
#: /usr/local/src/bugfix.master/application/views/scripts/mixedPagination.phtml:33
msgid "Page"
msgstr "Seite"
#: /usr/local/src/bugfix.master/application/controllers/ErrorController.php:33
msgid "Page not found."
msgstr "Seite nicht gefunden."
#: /usr/local/src/bugfix.master/application/forms/Authentication/LoginForm.php:65
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:206
#: /usr/local/src/bugfix.master/application/views/scripts/mixedPagination.phtml:12
msgid "Pagination"
msgstr "Seitennavigation"
#: /usr/local/src/bugfix.master/application/forms/Authentication/LoginForm.php:35
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:181
msgid "Password"
msgstr "Kennwort"
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:319
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:294
msgid "Pattern"
msgstr "Muster"
#: /usr/local/src/bugfix.master/library/Icinga/Web/Form/Element/Number.php:61
#: /usr/local/src/bugfix.master/library/Icinga/Web/Form/Element/Number.php:36
msgid "Please enter a number."
msgstr "Bitte eine Nummer eingeben."
#: /usr/local/src/bugfix.master/application/forms/Authentication/LoginForm.php:25
msgid "Please enter your username..."
msgstr "Bitte gib deinen Benutzernamen..."
#: /usr/local/src/bugfix.master/application/controllers/AuthenticationController.php:126
msgid "Please note that not all authentication methods where available. Check the system log or Icinga Web 2 log for more information."
msgstr "Beachte bitte dass nicht alle Authentifizierungsmethoden verfügbar waren. Überprüfe das Systemlog oder jenes von Icinga Web 2 für weitere Informationen."
#: /usr/local/src/bugfix.master/application/views/scripts/search/hint.phtml:8
msgid "Please use the asterisk (*) as a placeholder for wildcard searches. For convenience I'll always add a wildcard after the last character you typed."
msgstr "Bitte benutze das Sternchen (*) als Jokerzeichen für eine Suche mit Platzhaltern. Der Einfachheit halber hänge ich immer einen Platzhalter hinter das letzte von dir getippte Zeichen."
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:171
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:146
msgid "Port"
msgstr "Port"
#: /usr/local/src/bugfix.master/application/layouts/scripts/body.phtml:38
#: /usr/local/src/bugfix.master/application/layouts/scripts/parts/topbar.phtml:32
#: /usr/local/src/bugfix.master/library/Icinga/Web/Menu.php:185
msgid "Preferences"
msgstr "Einstellungen"
#: /usr/local/src/bugfix.master/application/views/scripts/mixedPagination.phtml:45
#: /usr/local/src/bugfix.master/application/controllers/PreferenceController.php:48
msgid "Preferences updated successfully"
msgstr "Einstellungen erfolgreich aktualisiert"
#: /usr/local/src/bugfix.master/application/views/scripts/mixedPagination.phtml:48
#: /usr/local/src/bugfix.master/application/views/scripts/mixedPagination.phtml:51
msgid "Prev"
msgstr "Zurück"
#: /usr/local/src/bugfix.master/library/Icinga/Web/Wizard/Wizard.php:326
#: /usr/local/src/bugfix.master/library/Icinga/Web/Wizard/Wizard.php:367
msgid "Previous"
msgstr "Vorheriges"
#: /usr/local/src/bugfix.master/library/Icinga/Web/Widget/FilterWidget.php:99
msgid "Remove this filter"
msgstr "Diesen Filter entfernen"
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:333
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:308
msgid "Resource Name"
msgstr ""
msgstr "Ressourcename"
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:375
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:350
msgid "Resource Type"
msgstr ""
msgstr "Ressourcetyp"
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:271
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:246
msgid "Root DN"
msgstr "Wurzel-DN"
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:379
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:354
msgid "SQL Database"
msgstr "SQL Datenbank"
@ -301,187 +389,241 @@ msgstr "SQL Datenbank"
msgid "Search"
msgstr "Suche"
#: /usr/local/src/bugfix.master/application/layouts/scripts/parts/navigation.phtml:17
#: /usr/local/src/bugfix.master/application/layouts/scripts/parts/navigation.phtml:15
msgid "Search..."
msgstr "Suche..."
#: /usr/local/src/bugfix.master/application/forms/Config/GeneralForm.php:189
#: /usr/local/src/bugfix.master/library/Icinga/Web/Form/Validator/notyet_CsrfTokenValidator.php:20
msgid "Security check failed, please submit your form again"
msgstr "Sicherheitscheck fehlgeschlagen, bitte sende das Formular erneut ab"
#: /usr/local/src/bugfix.master/application/forms/Config/GeneralForm.php:105
msgid "Select the language to use by default. Can be overwritten by a user in his preferences."
msgstr ""
msgstr "Die zu benutzende Standard-Sprache. Kann von Benutzern in deren Einstellungen überschrieben werden."
#: /usr/local/src/bugfix.master/application/controllers/SearchController.php:41
#: /usr/local/src/bugfix.master/application/views/scripts/pivottablePagination.phtml:34
msgid "Services"
msgstr "Services"
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:245
#: /usr/local/src/bugfix.master/library/Icinga/Web/Widget/Limiter.php:84
#, php-format
msgid "Show %s rows on one page"
msgstr "Zeige %s Zeilen pro Seite"
#: /usr/local/src/bugfix.master/application/views/scripts/mixedPagination.phtml:16
#, php-format
msgid "Show rows %d to %d of %d"
msgstr "Zeige die Zeilen %d bis %d von %d"
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:220
msgid "Socket"
msgstr ""
msgstr "Socket"
#: /usr/local/src/bugfix.master/application/forms/Config/LoggingForm.php:140
#: /usr/local/src/bugfix.master/application/views/scripts/config/module.phtml:22
msgid "State"
msgstr "Status"
#: /usr/local/src/bugfix.master/library/Icinga/Web/Menu.php:181
msgid "System"
msgstr "System"
#: /usr/local/src/bugfix.master/application/views/scripts/authentication/login.phtml:4
msgid "The Icinga logo"
msgstr "Das Icinga Logo"
#: /usr/local/src/bugfix.master/application/forms/Config/LoggingForm.php:114
msgid "The Syslog facility to utilize."
msgstr ""
msgstr "Die zu benutzende Syslog-Facility"
#: /usr/local/src/bugfix.master/application/forms/Config/Authentication/LdapBackendForm.php:116
#: /usr/local/src/bugfix.master/application/forms/Config/Authentication/LdapBackendForm.php:91
msgid "The attribute name used for storing the user name on the ldap server"
msgstr ""
msgstr "Der Attributname welcher benutzt wird, um Benutzernamen auf dem LDAP-Server abzulegen"
#: /usr/local/src/bugfix.master/application/forms/Config/Authentication/DbBackendForm.php:91
#: /usr/local/src/bugfix.master/application/forms/Config/Authentication/DbBackendForm.php:66
msgid "The database connection to use for authenticating with this provider"
msgstr ""
msgstr "Die Datenbankverbindung, welche zur Authentifizierung mit diesem Provider genutzt werden soll"
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:309
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:284
msgid "The filename to fetch information from"
msgstr ""
msgstr "Die Datei aus welcher Informationen gelesen werden sollen"
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:161
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:136
msgid "The hostname of the database."
msgstr ""
msgstr "Der Hostname der Datenbank."
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:261
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:236
msgid "The hostname or address of the LDAP server to use for authentication"
msgstr ""
msgstr "Der Hostname oder die IP-Adresse des LDAP-Servers der zur Authentifizierung genutzt werden soll"
#: /usr/local/src/bugfix.master/application/forms/Config/LoggingForm.php:156
#: /usr/local/src/bugfix.master/application/forms/Config/LoggingForm.php:130
msgid "The logfile to write messages to."
msgstr ""
msgstr "Das Logfile in welches Nachrichten geschrieben werden sollen."
#: /usr/local/src/bugfix.master/application/forms/Config/LoggingForm.php:83
#: /usr/local/src/bugfix.master/application/forms/Config/LoggingForm.php:57
msgid "The maximum loglevel to emit."
msgstr ""
msgstr "Loglevel bis zu welchem Nachrichten ausgegeben werden sollen."
#: /usr/local/src/bugfix.master/application/forms/Config/LoggingForm.php:118
#: /usr/local/src/bugfix.master/application/forms/Config/LoggingForm.php:92
msgid "The name of the application by which to prefix syslog messages."
msgstr ""
msgstr "Der Anwendungsname welcher Syslog-Nachrichten vorangestellt werden soll."
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:184
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:159
msgid "The name of the database to use"
msgstr ""
msgstr "Der Name der zu benutzenden Datenbank"
#: /usr/local/src/bugfix.master/application/forms/Config/Authentication/LdapBackendForm.php:81
#: /usr/local/src/bugfix.master/application/forms/Config/Authentication/LdapBackendForm.php:56
msgid "The name of this authentication backend"
msgstr ""
msgstr "Der Name dieses Authentifizierungsbackends"
#: /usr/local/src/bugfix.master/application/forms/Config/Authentication/DbBackendForm.php:79
#: /usr/local/src/bugfix.master/application/forms/Config/Authentication/DbBackendForm.php:54
msgid "The name of this authentication provider"
msgstr ""
msgstr "Der Name dieses Authentifizierungsproviders"
#: /usr/local/src/bugfix.master/application/forms/Config/Authentication/LdapBackendForm.php:105
#: /usr/local/src/bugfix.master/application/forms/Config/Authentication/LdapBackendForm.php:80
msgid "The object class used for storing users on the ldap server"
msgstr ""
msgstr "Die Objekt-Klasse welche benutzt wird, um Benutzer auf diesem LDAP-Server abzulegen"
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:207
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:182
msgid "The password to use for authentication"
msgstr ""
msgstr "Das Kennwort welche zur Authentifizierung benutzt werden soll"
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:270
msgid "The password to use for querying the ldap server"
msgstr "Das Kennwort welches zum Abfragen des LDAP-Servers benutzt werden soll"
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:221
msgid "The path to your livestatus socket used for querying monitoring data"
msgstr "Der Pfad zu deinem Live-Status Socket, über welchen Monitoring-Daten abgefragt werden sollen"
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:247
msgid "The path where users can be found on the ldap server"
msgstr "Der Pfad unter welchem Benutzer auf diesem LDAP-Server gefunden werden können."
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:147
msgid "The port to use."
msgstr "Der zu benutzende Port."
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:295
msgid "The password to use for querying the ldap server"
msgstr ""
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:246
msgid "The path to your livestatus socket used for querying monitoring data"
msgstr ""
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:272
msgid "The path where users can be found on the ldap server"
msgstr ""
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:172
msgid "The port to use."
msgstr ""
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:320
msgid "The regular expression by which to identify columns"
msgstr ""
msgstr "Der zu benutzende reguläre Ausdruck, mit welchem Spalten identifiziert werden können"
#: /usr/local/src/bugfix.master/application/forms/Config/Authentication/LdapBackendForm.php:93
#: /usr/local/src/bugfix.master/application/forms/Config/Authentication/LdapBackendForm.php:68
msgid "The resource to use for authenticating with this provider"
msgstr ""
msgstr "Die Resource die zum Authentifizieren mit diesem Provider genutzt werden soll"
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:145
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:120
msgid "The type of SQL database you want to create."
msgstr ""
msgstr "Der Typ der zu benutzenden SQL Datenbank."
#: /usr/local/src/bugfix.master/application/forms/Config/LoggingForm.php:99
#: /usr/local/src/bugfix.master/application/forms/Config/LoggingForm.php:73
msgid "The type of logging to utilize."
msgstr ""
msgstr "Der Typ des zu benutzenden Loggings."
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:376
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:351
msgid "The type of resource"
msgstr ""
msgstr "Der Typ der Ressource"
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:334
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:309
msgid "The unique name of this resource"
msgstr ""
msgstr "Der eindeutige Name dieser Resource"
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:283
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:258
msgid "The user dn to use for querying the ldap server"
msgstr ""
msgstr "Die DN des Benutzers mit welchem dieser LDAP-Server befragt werden soll"
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:195
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:170
msgid "The user name to use for authentication."
msgstr ""
msgstr "Der zur Authentifizierung zu benutzende Benutzername."
#: /usr/local/src/bugfix.master/application/views/scripts/config/module.phtml:6
msgid "There is no such module installed."
msgstr "Gegenwärtig ist kein solches Modul installiert."
#: /usr/local/src/bugfix.master/application/views/scripts/config/module.phtml:32
#: /usr/local/src/bugfix.master/application/views/scripts/config/module.phtml:46
msgid "This module has no dependencies"
msgstr "Dieses Modul hat keine Abhängigkeiten"
#: /usr/local/src/bugfix.master/library/Icinga/Application/Modules/Module.php:383
#: /usr/local/src/bugfix.master/library/Icinga/Application/Modules/Module.php:435
msgid "This module has no description"
msgstr "Dieses Modul hat keine Beschreibung"
#: /usr/local/src/bugfix.master/application/forms/Preference/GeneralForm.php:100
#: /usr/local/src/bugfix.master/application/views/scripts/config/devtools.phtml:5
msgid "UI Debug"
msgstr "UI Debug"
#: /usr/local/src/bugfix.master/application/forms/Preference/GeneralForm.php:43
msgid "Use Default Language"
msgstr "Standardsprache verwenden"
#: /usr/local/src/bugfix.master/application/forms/Preference/GeneralForm.php:109
#: /usr/local/src/bugfix.master/application/forms/Preference/GeneralForm.php:52
msgid "Use the following language to display texts and messages"
msgstr ""
msgstr "Die folgende Sprache benutzen, um Texte und Nachrichten anzuzeigen"
#: /usr/local/src/bugfix.master/application/forms/Authentication/LoginForm.php:57
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:194
#: /usr/local/src/bugfix.master/application/forms/Authentication/LoginForm.php:24
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:169
msgid "Username"
msgstr "Benutzername"
#: /usr/local/src/bugfix.master/application/forms/Config/Authentication/LdapBackendForm.php:169
#: /usr/local/src/bugfix.master/application/forms/Config/Authentication/LdapBackendForm.php:144
msgid "Using ldap is not possible, the php extension \"ldap\" is not installed."
msgstr ""
msgstr "Es ist nicht möglich, LDAP zu benutzen, da die PHP-Erweiterung \"LDAP\" nicht installiert ist."
#: /usr/local/src/bugfix.master/application/forms/Config/Authentication/DbBackendForm.php:148
#: /usr/local/src/bugfix.master/application/forms/Config/Authentication/DbBackendForm.php:123
#, php-format
msgid "Using the specified backend failed: %s"
msgstr ""
msgstr "Die angegebene Datenbank zu benutzen war nicht möglich: %s"
#: /usr/local/src/bugfix.master/application/forms/Config/LoggingForm.php:87
#: /usr/local/src/bugfix.master/application/forms/Config/LoggingForm.php:61
msgid "Warning"
msgstr "Warnung"
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:435
#: /usr/local/src/bugfix.master/application/views/scripts/dashboard/index.phtml:13
msgid "We tried to load a dashboard configuration with no success. Please have look that the configuration does exist:"
msgstr "Der Versuch die Dashboard-Konfiguration zu laden war nicht erfolgreich. Bitte stelle sicher, dass die folgende Konfigurationsdatei existiert:"
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:410
msgid "You need to install the php extension \"mysql\" and the Zend_Pdo_Mysql classes to use MySQL database resources."
msgstr ""
msgstr "Um MySQL Datenbank-Ressourcen nutzen zu können müssen die PHP-Erweiterung \"mysql\" sowie die Zend_Pdo_Mysql Klassen installiert sein."
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:442
#: /usr/local/src/bugfix.master/application/forms/Config/ResourceForm.php:417
msgid "You need to install the php extension \"pgsql\" and the Zend_Pdo_Pgsql classes to use PostgreSQL database resources."
msgstr ""
msgstr "Um PostgreSQL Datenbank-Ressourcen nutzen zu können müssen die PHP-Erweiterung \"pqsql\" sowie die Zend_Pdo_Pgsql Klassen installiert sein."
#: /usr/local/src/bugfix.master/application/forms/Preference/GeneralForm.php:106
#: /usr/local/src/bugfix.master/application/forms/Preference/GeneralForm.php:49
msgid "Your Current Language"
msgstr "Deine aktuelle Sprache"
#: /usr/local/src/bugfix.master/library/Icinga/Util/Format.php:108
#: /usr/local/src/bugfix.master/library/Icinga/Util/Format.php:114
#: /usr/local/src/bugfix.master/library/Icinga/Web/Widget/Limiter.php:58
msgid "all"
msgstr "alle"
#: /usr/local/src/bugfix.master/library/Icinga/Util/Format.php:83
#: /usr/local/src/bugfix.master/library/Icinga/Util/Format.php:89
msgid "for"
msgstr "für"
#: /usr/local/src/bugfix.master/library/Icinga/Util/Format.php:112
#: /usr/local/src/bugfix.master/library/Icinga/Util/Format.php:131
#: /usr/local/src/bugfix.master/library/Icinga/Util/Format.php:133
#: /usr/local/src/bugfix.master/library/Icinga/Util/Format.php:87
#: /usr/local/src/bugfix.master/library/Icinga/Util/Format.php:106
#: /usr/local/src/bugfix.master/library/Icinga/Util/Format.php:108
msgid "since"
msgstr "seit"
#: /usr/local/src/bugfix.master/application/views/scripts/config/devtools.phtml:5
msgid "toggle"
msgstr "umschalten"
#~ msgid "%d to %d of %d"
#~ msgstr "%d bis %d von %d"
#~ msgid "Installation"
#~ msgstr "Installation"
#~ msgid "Logging"
#~ msgstr "Logging"
#~ msgid "Previous"
#~ msgstr "Vorheriges"
#~ msgid "Icinga Users Login"
#~ msgstr "Icinga Benutzeranmeldung"

View File

@ -2,7 +2,7 @@
// {{{ICINGA_LICENSE_HEADER}}}
// {{{ICINGA_LICENSE_HEADER}}}
use \Zend_View_Helper_FormElement;
use Zend_View_Helper_FormElement;
/**
* Helper to generate a "datetime" element

View File

@ -2,7 +2,7 @@
// {{{ICINGA_LICENSE_HEADER}}}
// {{{ICINGA_LICENSE_HEADER}}}
use \Zend_View_Helper_FormElement;
use Zend_View_Helper_FormElement;
/**
* Helper to generate a "datetime" element

View File

@ -2,6 +2,11 @@
<?= $this->tabs ?>
</div>
<div class="content" >
<?= $this->form ?>
</div>
<div class="content">
<h1><?= $this->escape($this->translate('This feature is deactivated at the moment.')); ?></h1>
<p>
<?=
$this->escape($this->translate('Please have a little patience, we are hard working on it, take a look at icingaweb2 issues.'));
?>
</p>
</div>

View File

@ -7,16 +7,10 @@
</div>
<?php else: ?>
<div class="content">
<h1>No dashboard configuration found!</h1>
<p>
<?=
$this->translate('We tried to load a dashboard configuration with no success.'
. ' Please have look that the configuration does exist:');
?>
<code>
<?= $this->escape($this->configPath) ?>.ini
</code>
</p>
<h1><?= $this->escape($this->translate('Welcome to Icinga Web!')) ?></h1>
<p><?= sprintf(
$this->escape($this->translate('Currently there is no dashlet available. This might change once you enabled some of the available %s.')),
$this->qlink($this->translate('modules'), 'config/modules')
) ?></p>
</div>
<?php endif; ?>
<?php endif ?>

View File

@ -1,39 +0,0 @@
[Incidents]
title = "Current incidents"
[Incidents.Service Problems]
url = "monitoring/list/services"
service_problem = 1
limit = 10
sort = service_severity
[Incidents.Recently Recovered Services]
url = "monitoring/list/services"
sort = "service_last_state_change"
service_state = 0
limit = 10
dir = "desc"
[Incidents.Host Problems]
url = "monitoring/list/hosts"
host_problem = 1
sort = host_severity
[Landing]
title = "Landing page"
[Landing.Hostgroups]
url = "monitoring/chart/hostgroup"
[Landing.Servicegroups]
url = "monitoring/chart/servicegroup"
[Landing.Unhandled Problem Services]
url = "monitoring/list/services"
service_handled = 0
service_problem = 1
[Landing.Unhandled Problem Hosts]
url = "monitoring/list/hosts"
host_handled = 0
host_problem = 1

View File

@ -1,34 +0,0 @@
[Dashboard]
title = "Dashboard"
url = "dashboard"
icon = "img/icons/dashboard.png"
priority = 10
[System]
icon = img/icons/configuration.png
priority = 200
[System.Preferences]
title = "Preferences"
url = "preference"
priority = 200
[System.Configuration]
title = "Configuration"
url = "config"
priority = 300
[System.Modules]
title = "Modules"
url = "config/modules"
priority = 400
[System.ApplicationLog]
title = "Application log"
url = "list/applicationlog"
priority = 500
[Logout]
url = "authentication/logout"
icon = img/icons/logout.png
priority = 300

View File

@ -1,5 +0,0 @@
[Documentation]
title = "Documentation"
icon = "img/icons/comment.png"
url = "doc"
priority = 80

View File

@ -1,109 +0,0 @@
[Problems]
priority = 20
icon = "img/icons/error.png"
[Problems.Unhandled Hosts]
priority = 40
url = "monitoring/list/hosts?host_problem=1&host_handled=0"
[Problems.Unhandled Services]
priority = 40
url = "monitoring/list/services?service_problem=1&service_handled=0&sort=service_severity"
[Problems.Host Problems]
priority = 50
url = "monitoring/list/hosts?host_problem=1&sort=host_severity"
[Problems.Service Problems]
priority = 50
url = "monitoring/list/services?service_problem=1&sort=service_severity&dir=desc"
[Problems.Current Downtimes]
url = "monitoring/list/downtimes?downtime_is_in_effect=1"
[Overview]
priority = 30
icon = "img/icons/hostgroup.png"
[Overview.Tactical Overview]
title = "Tactical Overview"
url = "monitoring/tactical"
priority = 40
[Overview.Hosts]
title = "Hosts"
url = "monitoring/list/hosts"
priority = 50
[Overview.Services]
title = "Services"
url = "monitoring/list/services"
priority = 50
[Overview.Servicematrix]
title = "Servicematrix"
url = "monitoring/list/servicematrix?service_problem=1"
priority = 51
[Overview.Servicegroups]
title = "Servicegroups"
url = "monitoring/list/servicegroups"
priority = 60
[Overview.Hostgroups]
title = "Hostgroups"
url = "monitoring/list/hostgroups"
priority = 60
[Overview.Contactgroups]
title = "Contactgroups"
url = "monitoring/list/contactgroups"
priority = 61
[Overview.Downtimes]
title = "Downtimes"
url = "monitoring/list/downtimes"
priority = 70
[Overview.Comments]
title = "Comments"
url = "monitoring/list/comments?comment_type=(comment|ack)"
priority = 70
[Overview.Contacts]
title = "Contacts"
url = "monitoring/list/contacts"
priority = 70
[History]
icon = "img/icons/history.png"
[History.Critical Events]
title = "Critical Events"
url = "monitoring/list/statehistorysummary"
priority = 50
[History.Notifications]
title = "Notifications"
url = "monitoring/list/notifications"
[History.Events]
title = "All Events"
url = "monitoring/list/eventhistory?timestamp>=-7%20days"
[History.Timeline]
title = "Timeline"
url = "monitoring/timeline"
[System.Process Info]
title = "Process Info"
url = "monitoring/process/info"
priority = 120
[System.Performance Info]
title = "Performance Info"
url = "monitoring/process/performance"
priority = 130

View File

@ -14,30 +14,4 @@ the objects you're interested in and can add and remove elements.
* The dashboard itself is just the view containing the panes
## Configuration files
By default, the config/dashboard/dashboard.ini is used for storing dashboards in the following format:
[PaneName] ; Define a new Pane
title = "PaneTitle" ; The title of the pane as displayed in the tabls
[PaneName.Component1] ; Define a new component 'Component 1' underneat the pane
url = "/url/for/component1" ; the url that will be displayed, with view=compact as URL parameter appended
height = "500px" ; optional height setting
width = "400px" ; optional width setting
[test.My hosts] ; Another component, here with host
url = "monitoring/list/hosts" ; the url of the component
; Notice the missing height/width definition
[test.My services] ; And another pane
url = "monitoring/list/services" ; With service url
[test2] ; Define a second pane
title = "test2" ; with the title
[test2.test] ; Add a component to the second pane
url = "/monitoring/show/host/host1" ; ...and define it's url
[dashboards1]: res/Dashboard.png

View File

@ -83,7 +83,7 @@ BuildArch: noarch
AutoReqProv: Off
%endif
Source0: icingaweb2-%{version}.tar.gz
Source: icingaweb2-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
@ -181,15 +181,10 @@ install -D -m0644 packages/rpm/etc/httpd/conf.d/icingaweb.conf %{buildroot}/%{ap
%{__cp} -r application library modules public %{buildroot}/%{sharedir}/
## config
# use the default menu.ini for application and monitoring mobule
install -D -m0644 config/menu.ini %{buildroot}/%{_sysconfdir}/icingaweb/menu.ini
install -D -m0644 config/modules/monitoring/menu.ini %{buildroot}/%{_sysconfdir}/icingaweb/modules/monitoring/menu.ini
# authentication is db only
install -D -m0644 packages/rpm/etc/icingaweb/authentication.ini %{buildroot}/%{_sysconfdir}/icingaweb/authentication.ini
# custom resource paths
install -D -m0644 packages/rpm/etc/icingaweb/resources.ini %{buildroot}/%{_sysconfdir}/icingaweb/resources.ini
# dashboard
install -D -m0644 config/dashboard/dashboard.ini %{buildroot}/%{_sysconfdir}/icingaweb/dashboard/dashboard.ini
# monitoring module (icinga2)
install -D -m0644 packages/rpm/etc/icingaweb/modules/monitoring/backends.ini %{buildroot}/%{_sysconfdir}/icingaweb/modules/monitoring/backends.ini
install -D -m0644 packages/rpm/etc/icingaweb/modules/monitoring/instances.ini %{buildroot}/%{_sysconfdir}/icingaweb/modules/monitoring/instances.ini

View File

@ -14,6 +14,7 @@ use Icinga\Exception\NotReadableError;
use Icinga\Logger\Logger;
use Icinga\Util\DateTimeFactory;
use Icinga\Util\Translator;
use Icinga\Exception\IcingaException;
/**
* This class bootstraps a thin Icinga application layer
@ -332,7 +333,7 @@ abstract class ApplicationBootstrap
try {
$this->moduleManager->loadEnabledModules();
} catch (NotReadableError $e) {
Logger::error(new Exception('Cannot load enabled modules. An exception was thrown:', 0, $e));
Logger::error(new IcingaException('Cannot load enabled modules. An exception was thrown:', $e));
}
return $this;
}
@ -369,7 +370,7 @@ abstract class ApplicationBootstrap
try {
$this->config = Config::app();
} catch (NotReadableError $e) {
Logger::error(new Exception('Cannot load application configuration. An exception was thrown:', 0, $e));
Logger::error(new IcingaException('Cannot load application configuration. An exception was thrown:', $e));
$this->config = new Zend_Config(array());
}
return $this;
@ -417,7 +418,7 @@ abstract class ApplicationBootstrap
ResourceFactory::setConfig($config);
} catch (NotReadableError $e) {
Logger::error(
new Exception('Cannot load resource configuration. An exception was thrown:', 0, $e)
new IcingaException('Cannot load resource configuration. An exception was thrown:', $e)
);
}

View File

@ -142,6 +142,7 @@ class Benchmark
// TODO: Move formatting to CSS file
$html = '<table class="benchmark">' . "\n" . '<tr>';
foreach ($data->columns as & $col) {
if ($col->title === 'Time') continue;
$html .= sprintf(
'<td align="%s">%s</td>',
$col->align,
@ -153,6 +154,7 @@ class Benchmark
foreach ($data->rows as & $row) {
$html .= '<tr>';
foreach ($data->columns as $key => & $col) {
if ($col->title === 'Time') continue;
$html .= sprintf(
'<td align="%s">%s</td>',
$col->align,

View File

@ -59,7 +59,7 @@ class Config extends Zend_Config
$config->setConfigFile($filepath);
$config->merge(new Zend_Config_Ini($filepath));
} else {
throw new NotReadableError('Cannot read config file "' . $filepath . '". Permission denied');
throw new NotReadableError('Cannot read config file "%s". Permission denied', $filepath);
}
return $config;

View File

@ -39,11 +39,11 @@ class Loader
public function registerNamespace($namespace, $directory)
{
if (!is_dir($directory)) {
throw new ProgrammingError(sprintf(
'Namespace directory "%s" for "%s" does not exist',
$namespace,
$directory
));
throw new ProgrammingError(
'Directory "%s" for namespace "%s" does not exist',
$directory,
$namespace
);
}
$this->namespaces[$namespace] = $directory;

View File

@ -110,12 +110,14 @@ class Manager
}
if (!is_dir($this->enableDir)) {
throw new NotReadableError(
'Cannot read enabled modules. Module directory "' . $this->enableDir . '" is not a directory'
'Cannot read enabled modules. Module directory "%s" is not a directory',
$this->enableDir
);
}
if (!is_readable($this->enableDir)) {
throw new NotReadableError(
'Cannot read enabled modules. Module directory "' . $this->enableDir . '" is not readable'
'Cannot read enabled modules. Module directory "%s" is not readable',
$this->enableDir
);
}
if (($dh = opendir($canonical)) !== false) {
@ -206,10 +208,8 @@ class Manager
{
if (!$this->hasInstalled($name)) {
throw new ConfigurationError(
sprintf(
'Cannot enable module "%s". Module is not installed.',
$name
)
'Cannot enable module "%s". Module is not installed.',
$name
);
}
@ -219,8 +219,8 @@ class Manager
if (!is_writable($this->enableDir)) {
throw new SystemPermissionException(
'Can not enable module "' . $name . '". '
. 'Insufficient system permissions for enabling modules.'
'Can not enable module "%s". Insufficient system permissions for enabling modules.',
$name
);
}
@ -232,9 +232,11 @@ class Manager
$error = error_get_last();
if (strstr($error["message"], "File exists") === false) {
throw new SystemPermissionException(
'Could not enable module "' . $name . '" due to file system errors. '
'Could not enable module "%s" due to file system errors. '
. 'Please check path and mounting points because this is not a permission error. '
. 'Primary error was: ' . $error['message']
. 'Primary error was: %s',
$name,
$error['message']
);
}
}
@ -268,14 +270,18 @@ class Manager
}
$link = $this->enableDir . '/' . $name;
if (!file_exists($link)) {
throw new ConfigurationError('Could not disable module. The module ' . $name . ' was not found.');
throw new ConfigurationError(
'Could not disable module. The module %s was not found.',
$name
);
}
if (!is_link($link)) {
throw new ConfigurationError(
'Could not disable module. The module "' . $name . '" is not a symlink. '
'Could not disable module. The module "%s" is not a symlink. '
. 'It looks like you have installed this module manually and moved it to your module folder. '
. 'In order to dynamically enable and disable modules, you have to create a symlink to '
. 'the enabled_modules folder.'
. 'the enabled_modules folder.',
$name
);
}
@ -283,9 +289,11 @@ class Manager
if (!@unlink($link)) {
$error = error_get_last();
throw new SystemPermissionException(
'Could not disable module "' . $name . '" due to file system errors. '
'Could not disable module "%s" due to file system errors. '
. 'Please check path and mounting points because this is not a permission error. '
. 'Primary error was: ' . $error['message']
. 'Primary error was: %s',
$name,
$error['message']
);
}
}
@ -319,10 +327,8 @@ class Manager
}
throw new ProgrammingError(
sprintf(
'Trying to access uninstalled module dir: %s',
$name
)
'Trying to access uninstalled module dir: %s',
$name
);
}
@ -388,10 +394,8 @@ class Manager
{
if (!$this->hasLoaded($name)) {
throw new ProgrammingError(
sprintf(
'Cannot access module %s as it hasn\'t been loaded',
$name
)
'Cannot access module %s as it hasn\'t been loaded',
$name
);
}
return $this->loadedModules[$name];

View File

@ -5,6 +5,7 @@
namespace Icinga\Application\Modules;
use Exception;
use Zend_Config;
use Zend_Controller_Router_Route_Abstract;
use Zend_Controller_Router_Route as Route;
use Icinga\Application\ApplicationBootstrap;
@ -13,9 +14,12 @@ use Icinga\Application\Icinga;
use Icinga\Logger\Logger;
use Icinga\Util\Translator;
use Icinga\Web\Hook;
use Icinga\Web\Menu;
use Icinga\Web\Widget;
use Icinga\Web\Widget\Dashboard\Pane;
use Icinga\Util\File;
use Icinga\Exception\ProgrammingError;
use Icinga\Exception\IcingaException;
/**
* Module handling
@ -136,7 +140,6 @@ class Module
*/
private $app;
/**
* Routes to add to the route chain
*
@ -146,6 +149,75 @@ class Module
*/
protected $routes = array();
/**
* A set of menu elements
*
* @var array
*/
protected $menuItems = array();
/**
* A set of Pane elements
*
* @var array
*/
protected $paneItems = array();
/**
* Get all Menu Items
*
* @return array
*/
public function getPaneItems()
{
$this->launchConfigScript();
return $this->paneItems;
}
/**
* Add a pane to dashboard
*
* @param $id
* @param $name
* @return Pane
*/
protected function dashboard($name)
{
$this->paneItems[$name] = new Pane($name);
return $this->paneItems[$name];
}
/**
* Get all Menu Items
*
* @return array
*/
public function getMenuItems()
{
$this->launchConfigScript();
return $this->menuItems;
}
/**
* Add a menu Section to the Sidebar menu
*
* @param string $id
* @param string $name
* @param array $properties
* @return mixed
*/
protected function menuSection($id, $name, array $properties = array())
{
if (array_key_exists($id, $this->menuItems)) {
$this->menuItems[$id]->setProperties($properties);
} else {
$this->menuItems[$id] = new Menu($id, new Zend_Config($properties));
$this->menuItems[$id]->setTitle($name);
}
return $this->menuItems[$id];
}
/**
* Create a new module object
*
@ -559,8 +631,9 @@ class Module
protected function providePermission($name, $description)
{
if ($this->providesPermission($name)) {
throw new Exception(
sprintf('Cannot provide permission "%s" twice', $name)
throw new IcingaException(
'Cannot provide permission "%s" twice',
$name
);
}
$this->permissionList[$name] = (object) array(
@ -580,8 +653,9 @@ class Module
protected function provideRestriction($name, $description)
{
if ($this->providesRestriction($name)) {
throw new Exception(
sprintf('Cannot provide restriction "%s" twice', $name)
throw new IcingaException(
'Cannot provide restriction "%s" twice',
$name
);
}
$this->restrictionList[$name] = (object) array(
@ -781,4 +855,15 @@ class Module
$this->routes[$name] = $route;
return $this;
}
/**
* Translate a string with the global mt()
*
* @param $string
* @return mixed|string
*/
protected function translate($string)
{
return mt($this->name, $string);
}
}

View File

@ -4,22 +4,57 @@
namespace Icinga\Application;
/**
* Platform tests for icingaweb
*/
class Platform
{
/**
* Domain name
*
* @var string
*/
protected static $domain;
/**
* Host name
*
* @var string
*/
protected static $hostname;
/**
* Fully qualified domain name
*
* @var string
*/
protected static $fqdn;
/**
* Test of windows
*
* @return bool
*/
public static function isWindows()
{
return strtoupper(substr(PHP_OS, 0, 3)) === 'WIN';
}
/**
* Test of linux
*
* @return bool
*/
public static function isLinux()
{
return strtoupper(substr(PHP_OS, 0, 5)) === 'LINUX';
}
/**
* Test of CLI environment
*
* @return bool
*/
public static function isCli()
{
if (PHP_SAPI == 'cli') {
@ -31,6 +66,11 @@ class Platform
return false;
}
/**
* Get the hostname
*
* @return string
*/
public static function getHostname()
{
if (self::$hostname === null) {
@ -39,6 +79,11 @@ class Platform
return self::$hostname;
}
/**
* Get the domain name
*
* @return string
*/
public static function getDomain()
{
if (self::$domain === null) {
@ -47,6 +92,11 @@ class Platform
return self::$domain;
}
/**
* Get the fully qualified domain name
*
* @return string
*/
public static function getFqdn()
{
if (self::$fqdn === null) {
@ -55,6 +105,9 @@ class Platform
return self::$fqdn;
}
/**
* Initialize domain and host strings
*/
protected static function discoverHostname()
{
self::$hostname = gethostname();
@ -66,4 +119,16 @@ class Platform
self::$domain = array_shift(preg_split('~\.~', self::$hostname, 2));
}
}
/**
* Test for php extension
*
* @param string $extensionName E.g. mysql, ldap
*
* @return bool
*/
public static function extensionLoaded($extensionName)
{
return extension_loaded($extensionName);
}
}

View File

@ -2,7 +2,7 @@
// {{{ICINGA_LICENSE_HEADER}}}
// {{{ICINGA_LICENSE_HEADER}}}
use \Icinga\Util\Translator;
use Icinga\Util\Translator;
if (extension_loaded('gettext')) {
function t($messageId)

View File

@ -97,7 +97,9 @@ class AuthChain implements Iterator
} catch (ConfigurationError $e) {
Logger::error(
new ConfigurationError(
'Cannot create authentication backend "' . $name . '". An exception was thrown:', 0, $e
'Cannot create authentication backend "%s". An exception was thrown:',
$name,
$e
)
);
$this->next();

View File

@ -11,6 +11,7 @@ use Icinga\Exception\AuthenticationException;
use Exception;
use Zend_Db_Expr;
use Zend_Db_Select;
use Icinga\Exception\IcingaException;
class DbUserBackend extends UserBackend
{
@ -60,7 +61,10 @@ class DbUserBackend extends UserBackend
return false;
}
if ($salt === '') {
throw new Exception('Cannot find salt for user ' . $user->getUsername());
throw new IcingaException(
'Cannot find salt for user %s',
$user->getUsername()
);
}
$select = new Zend_Db_Select($this->conn->getConnection());
@ -73,12 +77,9 @@ class DbUserBackend extends UserBackend
return ($row !== false) ? true : false;
} catch (Exception $e) {
throw new AuthenticationException(
sprintf(
'Failed to authenticate user "%s" against backend "%s". An exception was thrown:',
$user->getUsername(),
$this->getName()
),
0,
'Failed to authenticate user "%s" against backend "%s". An exception was thrown:',
$user->getUsername(),
$this->getName(),
$e
);
}
@ -125,4 +126,4 @@ class DbUserBackend extends UserBackend
return ($row !== false) ? $row->count : 0;
}
}
}

View File

@ -68,21 +68,17 @@ class LdapUserBackend extends UserBackend
$result = $q->fetchRow();
if (! isset($result)) {
throw new AuthenticationException(
sprintf(
'No objects with objectClass="%s" in DN="%s" found.',
$this->userClass,
$this->conn->getDN()
)
'No objects with objectClass="%s" in DN="%s" found.',
$this->userClass,
$this->conn->getDN()
);
}
if (! isset($result->{$this->userNameAttribute})) {
throw new AuthenticationException(
sprintf(
'UserNameAttribute "%s" not existing in objectClass="%s"',
$this->userNameAttribute,
$this->userClass
)
'UserNameAttribute "%s" not existing in objectClass="%s"',
$this->userNameAttribute,
$this->userClass
);
}
}
@ -121,11 +117,8 @@ class LdapUserBackend extends UserBackend
} catch (AuthenticationException $e) {
// Authentication not possible
throw new AuthenticationException(
sprintf(
'Authentication against backend "%s" not possible: ',
$this->getName()
),
0,
'Authentication against backend "%s" not possible: ',
$this->getName(),
$e
);
}
@ -141,12 +134,9 @@ class LdapUserBackend extends UserBackend
} catch (LdapException $e) {
// Error during authentication of this specific user
throw new AuthenticationException(
sprintf(
'Failed to authenticate user "%s" against backend "%s". An exception was thrown:',
$user->getUsername(),
$this->getName()
),
0,
'Failed to authenticate user "%s" against backend "%s". An exception was thrown:',
$user->getUsername(),
$this->getName(),
$e
);
}

View File

@ -13,6 +13,7 @@ use Icinga\Exception\NotReadableError;
use Icinga\Application\Config as IcingaConfig;
use Icinga\User\Preferences;
use Icinga\User\Preferences\PreferencesStore;
use Icinga\Exception\IcingaException;
class Manager
{
@ -55,7 +56,11 @@ class Manager
$config = IcingaConfig::app();
} catch (NotReadableError $e) {
Logger::error(
new Exception('Cannot load preferences for user "' . $username . '". An exception was thrown', 0, $e)
new IcingaException(
'Cannot load preferences for user "%s". An exception was thrown',
$username,
$e
)
);
$config = new Zend_Config(array());
}
@ -68,8 +73,10 @@ class Manager
$preferences = new Preferences($preferencesStore->load());
} catch (NotReadableError $e) {
Logger::error(
new Exception(
'Cannot load preferences for user "' . $username . '". An exception was thrown', 0, $e
new IcingaException(
'Cannot load preferences for user "%s". An exception was thrown',
$username,
$e
)
);
$preferences = new Preferences();

View File

@ -54,16 +54,18 @@ abstract class UserBackend implements Countable
// Use a custom backend class, this is only useful for testing
if (!class_exists($backendConfig->class)) {
throw new ConfigurationError(
'Authentication configuration for backend "' . $name . '" defines an invalid backend'
. ' class. Backend class "' . $backendConfig->class. '" not found'
'Authentication configuration for backend "%s" defines an invalid backend class.'
. ' Backend class "%s" not found',
$name,
$backendConfig->class
);
}
return new $backendConfig->class($backendConfig);
}
if (($backendType = $backendConfig->backend) === null) {
throw new ConfigurationError(
'Authentication configuration for backend "' . $name
. '" is missing the backend directive'
'Authentication configuration for backend "%s" is missing the backend directive',
$name
);
}
$backendType = strtolower($backendType);
@ -74,8 +76,8 @@ abstract class UserBackend implements Countable
}
if ($backendConfig->resource === null) {
throw new ConfigurationError(
'Authentication configuration for backend "' . $name
. '" is missing the resource directive'
'Authentication configuration for backend "%s" is missing the resource directive',
$name
);
}
try {
@ -100,22 +102,24 @@ abstract class UserBackend implements Countable
case 'ldap':
if (($userClass = $backendConfig->user_class) === null) {
throw new ConfigurationError(
'Authentication configuration for backend "' . $name
. '" is missing the user_class directive'
'Authentication configuration for backend "%s" is missing the user_class directive',
$name
);
}
if (($userNameAttribute = $backendConfig->user_name_attribute) === null) {
throw new ConfigurationError(
'Authentication configuration for backend "' . $name
. '" is missing the user_name_attribute directive'
'Authentication configuration for backend "%s" is missing the user_name_attribute directive',
$name
);
}
$backend = new LdapUserBackend($resource, $userClass, $userNameAttribute);
break;
default:
throw new ConfigurationError(
'Authentication configuration for backend "' . $name. '" defines an invalid backend'
. ' type. Backend type "' . $backendType . '" is not supported'
'Authentication configuration for backend "%s" defines an invalid backend type.'
. ' Backend type "%s" is not supported',
$name,
$backendType
);
}
$backend->setName($name);

View File

@ -9,12 +9,15 @@ use Icinga\Chart\Legend;
use Icinga\Chart\Palette;
use Icinga\Chart\Primitive\Drawable;
use Icinga\Chart\SVGRenderer;
use Icinga\Exception\IcingaException;
/**
* Base class for charts, extended by all other Chart classes.
*/
abstract class Chart implements Drawable
{
protected $align = false;
/**
* SVG renderer that handles
*
@ -87,19 +90,33 @@ abstract class Chart implements Drawable
*
* Render this graph and return the created SVG
*
* @return string The SVG created by the SvgRenderer
* @return string The SVG created by the SvgRenderer
*
* @throws Exception Thrown wen the dataset is not valid for this graph
* @throws IcingaException Thrown wen the dataset is not valid for this graph
* @see SVGRenderer::render
*/
public function render()
{
if (!$this->isValidDataFormat()) {
throw new Exception('Dataset for graph doesn\'t have the proper structure');
throw new IcingaException('Dataset for graph doesn\'t have the proper structure');
}
$this->build();
if ($this->align) {
$this->renderer->preserveAspectRatio();
$this->renderer->setXAspectRatioAlignment(SVGRenderer::X_ASPECT_RATIO_MIN);
$this->renderer->setYAspectRatioAlignment(SVGRenderer::Y_ASPECT_RATIO_MIN);
}
$this->renderer->getCanvas()->addElement($this);
return $this->renderer->render();
}
/**
* Align the chart to the top left corner instead of centering it
*
* @param bool $align
*/
public function alignTopLeft ($align = true)
{
$this->align = $align;
}
}

View File

@ -7,6 +7,7 @@ namespace Icinga\Chart\Inline;
use Icinga\Chart\PieChart as PieChartRenderer;
use Imagick;
use Exception;
use Icinga\Exception\IcingaException;
/**
* Draw an inline pie-chart directly from the available request parameters.
@ -17,11 +18,11 @@ class PieChart extends Inline
public function render($output = true)
{
$pie = new PieChartRenderer();
$pie->alignTopLeft();
$pie->disableLegend();
$pie->drawPie(array(
'data' => $this->data, 'colors' => $this->colors, 'labels' => $this->labels
));
$pie->setWidth($this->width)->setHeight($this->height);
if ($output) {
echo $pie->render();
} else {
@ -33,7 +34,7 @@ class PieChart extends Inline
{
if (! class_exists('Imagick')) {
// TODO: This is quick & dirty. 404?
throw new Exception('Cannot render PNGs without Imagick');
throw new IcingaException('Cannot render PNGs without Imagick');
}
$image = new Imagick();
$image->readImageBlob($this->render(false));

View File

@ -16,7 +16,7 @@ use Icinga\Chart\Render\LayoutBox;
/**
* Graphing component for rendering Pie Charts.
*
* See the graphs.md documentation for futher information about how to use this component
* See the graphs.md documentation for further information about how to use this component
*/
class PieChart extends Chart
{
@ -51,46 +51,6 @@ class PieChart extends Chart
*/
private $noCaption = false;
/**
* Scaling level of the rendered svgs width in percent.
*
* @var float
*/
private $width = 100;
/**
* Scaling level of the rendered svgs height in percent.
*
* @var int
*/
private $height = 100;
/**
* Set the size of the rendered pie-chart svg.
*
* @param $width int The width in percent.
*
* @return self Fluent interface
*/
public function setWidth($width)
{
$this->width = $width;
return $this;
}
/**
* Set the size of the rendered pie-chart svg.
*
* @param $height int The height in percent.
*
* @return self Fluent interface
*/
public function setHeight($height)
{
$this->height = $height;
return $this;
}
/**
* Test if the given pies have the correct format
*
@ -111,10 +71,7 @@ class PieChart extends Chart
*/
protected function build()
{
$this->renderer = new SVGRenderer(
$this->type === self::STACKED ? $this->width : count($this->pies) * $this->width,
$this->width
);
$this->renderer = new SVGRenderer(($this->type === self::STACKED) ? 1 : count($this->pies), 1);
foreach ($this->pies as &$pie) {
$this->normalizeDataSet($pie);
}
@ -165,11 +122,16 @@ class PieChart extends Chart
*/
public function toSvg(RenderContext $ctx)
{
$outerBox = new Canvas('outerGraph', new LayoutBox(0, 0, 100, 100));
$innerBox = new Canvas('graph', new LayoutBox(0, 0, 100, 100));
$labelBox = $ctx->getDocument()->createElement('g');
if (!$this->noCaption) {
// Scale SVG to make room for captions
$outerBox = new Canvas('outerGraph', new LayoutBox(33, -5, 40, 40));
$innerBox = new Canvas('graph', new LayoutBox(0, 0, 100, 100));
$innerBox->getLayout()->setPadding(10, 10, 10, 10);
} else {
$outerBox = new Canvas('outerGraph', new LayoutBox(1.5, -10, 124, 124));
$innerBox = new Canvas('graph', new LayoutBox(0, 0, 100, 100));
$innerBox->getLayout()->setPadding(0, 0, 0, 0);
}
$this->createContentClipBox($innerBox);
$this->renderPies($innerBox, $labelBox);
@ -274,9 +236,6 @@ class PieChart extends Chart
$lastRadius = 0;
foreach ($pie['data'] as $idx => $dataset) {
$color = $this->getColorForPieSlice($pie, $idx);
if ($dataset === 100) {
$dataset = 99.9;
}
if ($dataset == 0) {
$labelPos++;
continue;
@ -340,3 +299,4 @@ class PieChart extends Chart
$clipBox->addElement($rect);
}
}

View File

@ -32,7 +32,7 @@ class PieSlice extends Animatable implements Drawable
*
* @var float
*/
private $endRadian= 0;
private $endRadian = 0;
/**
* The x position of the pie slice's center
@ -104,17 +104,21 @@ class PieSlice extends Animatable implements Drawable
*/
private function getPieSlicePath($x, $y, $r)
{
// start at the center of the pieslice
$pathString = 'M ' . $x . ' ' . $y . ' ';
// The coordinate system is mirrored on the Y axis, so we have to flip cos and sin
$xStart = $x + ($r * sin($this->startRadian));
$yStart = $y - ($r * cos($this->startRadian));
$xEnd = $x + ($r * sin($this->endRadian));
$yEnd = $y - ($r * cos($this->endRadian));
// Draw a straight line to the upper part of the arc
$pathString .= 'L ' . Format::formatSVGNumber($xStart) . ' ' . Format::formatSVGNumber($yStart);
if ($this->endRadian - $this->startRadian == 2*M_PI) {
// To draw a full circle, adjust arc endpoint by a small (unvisible) value
$this->endRadian -= 0.001;
$pathString = 'M ' . Format::formatSVGNumber($xStart) . ' ' . Format::formatSVGNumber($yStart);
} else {
// Start at the center of the pieslice
$pathString = 'M ' . $x . ' ' . $y;
// Draw a straight line to the upper part of the arc
$pathString .= ' L ' . Format::formatSVGNumber($xStart) . ' ' . Format::formatSVGNumber($yStart);
}
// Instead of directly connecting the upper part of the arc (leaving a triangle), draw a bow with the radius
$pathString .= ' A ' . Format::formatSVGNumber($r) . ' ' . Format::formatSVGNumber($r);
// These are the flags for the bow, see the SVG path documentation for details
@ -122,7 +126,10 @@ class PieSlice extends Animatable implements Drawable
$pathString .= ' 0 ' . (($this->endRadian - $this->startRadian > M_PI) ? '1' : '0 ') . ' 1';
// xEnd and yEnd are the lower point of the arc
$xEnd = $x + ($r * sin($this->endRadian));
$yEnd = $y - ($r * cos($this->endRadian));
$pathString .= ' ' . Format::formatSVGNumber($xEnd) . ' ' . Format::formatSVGNumber($yEnd);
return $pathString;
}
@ -152,7 +159,7 @@ class PieSlice extends Animatable implements Drawable
// Draw the handle
$path = new Path(array($midX, $midY));
$midX += ($addOffset + $r/1.8) * ($midRadius > M_PI ? -1 : 1);
$midX += ($addOffset + $r/3) * ($midRadius > M_PI ? -1 : 1);
$path->append(array($midX, $midY))->toAbsolute();
$midX += intval($r/2 * sin(M_PI/9)) * ($midRadius > M_PI ? -1 : 1);
@ -169,7 +176,7 @@ class PieSlice extends Animatable implements Drawable
// Draw the text box
$text = new Text($rel[0]+1.5, $rel[1], $this->caption);
$text->setFontSize('2.5em');
$text->setFontSize('5em');
$text->setAlignment(($midRadius > M_PI ? Text::ALIGN_END : Text::ALIGN_START));
$group->appendChild($path->toSvg($ctx));

View File

@ -4,8 +4,8 @@
namespace Icinga\Chart\Primitive;
use \DomElement;
use \Icinga\Chart\Render\RenderContext;
use DomElement;
use Icinga\Chart\Render\RenderContext;
use Icinga\Chart\Format;
/**

View File

@ -132,7 +132,7 @@ class RenderContext
* @param int $x The relative x coordinate
* @param int $y The relative y coordinate
*
* @return array An x,y tupel containing absolute coordinates
* @return array An x,y tuple containing absolute coordinates
* @see RenderContext::toRelative
*/
public function toAbsolute($x, $y)

View File

@ -1,10 +1,7 @@
<?php
/**
* Created by PhpStorm.
* User: mjentsch
* Date: 22.07.14
* Time: 10:17
*/
// {{{ICINGA_LICENSE_HEADER}}}
// {{{ICINGA_LICENSE_HEADER}}}
namespace Icinga\Chart\Render;

View File

@ -19,6 +19,22 @@ use Icinga\Chart\Primitive\Canvas;
*/
class SVGRenderer
{
const X_ASPECT_RATIO_MIN = 'xMin';
const X_ASPECT_RATIO_MID = 'xMid';
const X_ASPECT_RATIO_MAX = 'xMax';
const Y_ASPECT_RATIO_MIN = 'YMin';
const Y_ASPECT_RATIO_MID = 'YMid';
const Y_ASPECT_RATIO_MAX = 'YMax';
const ASPECT_RATIO_PAD = 'meet';
const ASPECT_RATIO_CUTOFF = 'slice';
/**
* The XML-document
*
@ -54,6 +70,35 @@ class SVGRenderer
*/
private $height = 100;
/**
* Whether the aspect ratio is preversed
*
* @var bool
*/
private $preserveAspectRatio = false;
/**
* Horizontal alignment of SVG element
*
* @var string
*/
private $xAspectRatio = self::X_ASPECT_RATIO_MID;
/**
* Vertical alignment of SVG element
*
* @var string
*/
private $yAspectRatio = self::Y_ASPECT_RATIO_MID;
/**
* Define whether aspect differences should be handled using padding (default) or cutoff
*
* @var string
*/
private $xFillMode = "meet";
/**
* Create the root document and the SVG root node
*/
@ -82,8 +127,8 @@ class SVGRenderer
$svg = $this->document->createElement('svg');
$svg->setAttribute('xmlns', 'http://www.w3.org/2000/svg');
$svg->setAttribute('xmlns:xlink', 'http://www.w3.org/1999/xlink');
$svg->setAttribute('width', $this->width . '%');
$svg->setAttribute('height', $this->height . '%');
$svg->setAttribute('width', '100%');
$svg->setAttribute('height', '100%');
$svg->setAttribute(
'viewBox',
sprintf(
@ -92,6 +137,17 @@ class SVGRenderer
$ctx->getNrOfUnitsY()
)
);
if ($this->preserveAspectRatio) {
$svg->setAttribute(
'preserveAspectRatio',
sprintf (
'%s%s %s',
$this->xAspectRatio,
$this->yAspectRatio,
$this->xFillMode
)
);
}
return $svg;
}
@ -141,4 +197,40 @@ class SVGRenderer
{
return $this->rootCanvas;
}
/**
* Preserve the aspect ratio of the rendered object
*
* Do not deform the content of the SVG when the aspect ratio of the viewBox
* differs from the aspect ratio of the SVG element, but add padding or cutoff
* instead
*
* @param bool $preserve Whether the aspect ratio should be preserved
*/
public function preserveAspectRatio($preserve = true)
{
$this->preserveAspectRatio = $preserve;
}
/**
* Change the horizontal alignment of the SVG element
*
* Change the horizontal alignment of the svg, when preserveAspectRatio is used and
* padding is present. Defaults to
*/
public function setXAspectRatioAlignment($alignment)
{
$this->xAspectRatio = $alignment;
}
/**
* Change the vertical alignment of the SVG element
*
* Change the vertical alignment of the svg, when preserveAspectRatio is used and
* padding is present.
*/
public function setYAspectRatioAlignment($alignment)
{
$this->yAspectRatio = $alignment;
}
}

View File

@ -5,6 +5,7 @@
namespace Icinga\Cli;
use Icinga\Cli\Screen;
use Icinga\Exception\IcingaException;
// @see http://en.wikipedia.org/wiki/ANSI_escape_code
@ -74,7 +75,10 @@ class AnsiScreen extends Screen
protected function fgColor($color)
{
if (! array_key_exists($color, $this->fgColors)) {
throw new \Exception(sprintf('There is no such foreground color: %s', $color));
throw new IcingaException(
'There is no such foreground color: %s',
$color
);
}
return $this->fgColors[$color];
}
@ -82,7 +86,10 @@ class AnsiScreen extends Screen
protected function bgColor($color)
{
if (! array_key_exists($color, $this->bgColors)) {
throw new \Exception(sprintf('There is no such background color: %s', $color));
throw new IcingaException(
'There is no such background color: %s',
$color
);
}
return $this->bgColors[$color];
}

View File

@ -10,6 +10,7 @@ use Icinga\Cli\Params;
use Icinga\Application\Config;
use Icinga\Application\ApplicationBootstrap as App;
use Exception;
use Icinga\Exception\IcingaException;
abstract class Command
{
@ -123,7 +124,7 @@ abstract class Command
public function fail($msg)
{
throw new Exception($msg);
throw new IcingaException('%s', $msg);
}
public function getDefaultActionName()

View File

@ -332,7 +332,8 @@ class Loader
{
if (! $this->hasModule($module)) {
throw new ProgrammingError(
sprintf('There is no such module: %s', $module)
'There is no such module: %s',
$module
);
}
}
@ -341,7 +342,8 @@ class Loader
{
if (! $this->hasCommand($command)) {
throw new ProgrammingError(
sprintf('There is no such command: %s', $command)
'There is no such command: %s',
$command
);
}
}
@ -351,7 +353,9 @@ class Loader
$this->assertModuleExists($module);
if (! $this->hasModuleCommand($module, $command)) {
throw new ProgrammingError(
sprintf("The module '%s' has no such command: %s", $module, $command)
'The module \'%s\' has no such command: %s',
$module,
$command
);
}
}

View File

@ -38,6 +38,45 @@ class PreservingIniWriter extends Zend_Config_Writer_FileAbstract
parent::__construct($options);
}
/**
* Find all keys containing dots and convert it to a nested configuration
*
* Ensure that configurations with the same ini representation the have
* similarly nested Zend_Config objects. The configuration may be altered
* during that process.
*
* @param Zend_Config $config The configuration to normalize
* @return Zend_Config The normalized config
*/
private function normalizeKeys(Zend_Config $config)
{
foreach ($config as $key => $value) {
if (preg_match('/\./', $key) > 0) {
// remove old key
unset ($config->$key);
// insert new key
$nests = explode('.', $key);
$current = $config;
$i = 0;
for (; $i < count($nests) - 1; $i++) {
if (! isset($current->{$nests[$i]})) {
// configuration key doesn't exist, create a new nesting level
$current->{$nests[$i]} = new Zend_Config (array(), true);
}
// move to next nesting level
$current = $current->{$nests[$i]};
}
// reached last nesting level, insert value
$current->{$nests[$i]} = $value;
}
if ($value instanceof Zend_Config) {
$config->$key = $this->normalizeKeys ($value);
}
}
return $config;
}
/**
* Render the Zend_Config into a config file string
*
@ -50,6 +89,17 @@ class PreservingIniWriter extends Zend_Config_Writer_FileAbstract
} else {
$oldconfig = new Zend_Config(array());
}
// create an internal copy of the given configuration, since the user of this class
// won't expect that a configuration will ever be altered during
// the rendering process.
$extends = $this->_config->getExtends();
$this->_config = new Zend_Config ($this->_config->toArray(), true);
foreach ($extends as $extending => $extended) {
$this->_config->setExtend($extending, $extended);
}
$this->_config = $this->normalizeKeys($this->_config);
$newconfig = $this->_config;
$editor = new IniEditor(file_get_contents($this->_filename), $this->options);
$this->diffConfigs($oldconfig, $newconfig, $editor);

View File

@ -142,7 +142,10 @@ class DbConnection implements Selectable
}
break;*/
default:
throw new ConfigurationError(sprintf('Backend "%s" is not supported', $this->dbType));
throw new ConfigurationError(
'Backend "%s" is not supported',
$this->dbType
);
}
$this->dbAdapter = Zend_Db::factory($adapter, $adapterParamaters);
$this->dbAdapter->setFetchMode(Zend_Db::FETCH_OBJ);

View File

@ -11,6 +11,7 @@ use Icinga\Data\Filter\FilterExpression;
use Icinga\Data\Filter\FilterOr;
use Icinga\Data\Filter\FilterAnd;
use Icinga\Data\Filter\FilterNot;
use Icinga\Exception\IcingaException;
use Zend_Db_Select;
/**
@ -124,7 +125,10 @@ class DbQuery extends SimpleQuery
$op = ' AND ';
$str .= ' NOT ';
} else {
throw new \Exception('Cannot render filter: ' . $filter);
throw new IcingaException(
'Cannot render filter: %s',
$filter
);
}
$parts = array();
if (! $filter->isEmpty()) {
@ -177,7 +181,7 @@ class DbQuery extends SimpleQuery
if (! $value) {
/*
NOTE: It's too late to throw exceptions, we might finish in __toString
throw new \Exception(sprintf(
throw new IcingaException(sprintf(
'"%s" is not a valid time expression',
$value
));

View File

@ -34,9 +34,12 @@ abstract class Filter
if ((string) $id === $this->getId()) {
return $this;
}
throw new ProgrammingError(sprintf(
'Trying to get invalid filter index "%s" from "%s" ("%s")', $id, $this, $this->id
));
throw new ProgrammingError(
'Trying to get invalid filter index "%s" from "%s" ("%s")',
$id,
$this,
$this->id
);
}
public function getId()
@ -136,7 +139,8 @@ abstract class Filter
case '<=': return new FilterEqualOrLessThan($col, $op, $expression);
case '!=': return new FilterNotEqual($col, $op, $expression);
default: throw new ProgrammingError(
sprintf('There is no such filter sign: %s', $op)
'There is no such filter sign: %s',
$op
);
}
}
@ -188,7 +192,7 @@ abstract class Filter
$args = $args[0];
}
}
if (count($args) > 1) {
if (count($args) > 1) {
return new FilterNot(array(new FilterAnd($args)));
} else {
return new FilterNot($args);
@ -203,7 +207,8 @@ abstract class Filter
case 'NOT': return self::not($filters);
}
throw new ProgrammingError(
sprintf('"%s" is not a valid filter chain operator', $operator)
'"%s" is not a valid filter chain operator',
$operator
);
}

View File

@ -4,11 +4,11 @@
namespace Icinga\Data\Filter;
use Exception;
use Icinga\Exception\IcingaException;
/**
* Filter Exception Class
*
* Filter Exceptions should be thrown on filter parse errors or similar
*/
class FilterException extends Exception {}
class FilterException extends IcingaException {}

View File

@ -4,8 +4,8 @@
namespace Icinga\Data\Filter;
use Exception;
use Icinga\Exception\IcingaException;
class FilterParseException extends Exception
class FilterParseException extends IcingaException
{
}

View File

@ -15,7 +15,7 @@ class FilterQueryString
protected $reportDebug = false;
protected $length;
protected function __construct()
{
}
@ -111,13 +111,13 @@ class FilterQueryString
$extra .= "\n" . implode("\n", $this->debug);
}
throw new FilterParseException(sprintf(
throw new FilterParseException(
'Invalid filter "%s", unexpected %s at pos %d%s',
$this->string,
$char,
$this->pos,
$extra
));
);
}
protected function readFilters($nestingLevel = 0, $op = null)

View File

@ -14,13 +14,23 @@ use Icinga\Protocol\Statusdat\Reader as StatusdatReader;
use Icinga\Protocol\Ldap\Connection as LdapConnection;
use Icinga\Protocol\File\Reader as FileReader;
/**
* Create resources from names or resource configuration
*/
class ResourceFactory implements ConfigAwareFactory
{
/**
* Resource configuration
*
* @var Zend_Config
*/
private static $resources;
/**
* Set resource configurations
*
* @param Zend_Config $config
*/
public static function setConfig($config)
{
self::$resources = $config;
@ -29,17 +39,19 @@ class ResourceFactory implements ConfigAwareFactory
/**
* Get the configuration for a specific resource
*
* @param $resourceName String The resource's name
* @param $resourceName String The resource's name
*
* @return Zend_Config The configuration of the resource
* @throws \Icinga\Exception\ConfigurationError
* @return Zend_Config The configuration of the resource
*
* @throws ConfigurationError
*/
public static function getResourceConfig($resourceName)
{
self::assertResourcesExist();
if (($resourceConfig = self::$resources->get($resourceName)) === null) {
throw new ConfigurationError(
'Cannot load resource config "' . $resourceName . '". Resource does not exist'
'Cannot load resource config "%s". Resource does not exist',
$resourceName
);
}
return $resourceConfig;
@ -71,13 +83,13 @@ class ResourceFactory implements ConfigAwareFactory
/**
* Check if the existing resources are set. If not, throw an error.
*
* @throws \Icinga\Exception\ProgrammingError
* @throws ProgrammingError
*/
private static function assertResourcesExist()
{
if (!isset(self::$resources)) {
throw new ProgrammingError(
"The ResourceFactory must be initialised by setting a config, before it can be used"
'The ResourceFactory must be initialised by setting a config, before it can be used'
);
}
}
@ -92,7 +104,7 @@ class ResourceFactory implements ConfigAwareFactory
*
* @return DbConnection|LdapConnection|LivestatusConnection|StatusdatReader An objects that can be used to access
* the given resource. The returned class depends on the configuration property 'type'.
* @throws \Icinga\Exception\ConfigurationError When an unsupported type is given
* @throws ConfigurationError When an unsupported type is given
*/
public static function createResource(Zend_Config $config)
{
@ -113,23 +125,22 @@ class ResourceFactory implements ConfigAwareFactory
$resource = new FileReader($config);
break;
default:
throw new ConfigurationError('Unsupported resource type "' . $config->type . '"');
throw new ConfigurationError(
'Unsupported resource type "%s"',
$config->type
);
}
return $resource;
}
public static function ldapAvailable()
/**
* Create a resource from name
*
* @param string $resourceName
* @return DbConnection|LdapConnection|LivestatusConnection|StatusdatReader
*/
public static function create($resourceName)
{
return extension_loaded('ldap');
}
public static function pgsqlAvailable()
{
return extension_loaded('pgsql');
}
public static function mysqlAvailable()
{
return extension_loaded('mysql');
return self::createResource(self::getResourceConfig($resourceName));
}
}

View File

@ -9,6 +9,7 @@ use Icinga\Data\Filter\Filter;
use Icinga\Web\Paginator\Adapter\QueryAdapter;
use Zend_Paginator;
use Exception;
use Icinga\Exception\IcingaException;
class SimpleQuery implements QueryInterface, Queryable
{
@ -158,7 +159,7 @@ class SimpleQuery implements QueryInterface, Queryable
public function setOrderColumns(array $orderColumns)
{
throw new Exception('This function does nothing and will be removed');
throw new IcingaException('This function does nothing and will be removed');
}
/**

View File

@ -4,11 +4,9 @@
namespace Icinga\Exception;
use RuntimeException;
/**
* Exception thrown if an error occurs during authentication
*/
class AuthenticationException extends RuntimeException
class AuthenticationException extends IcingaException
{
}

View File

@ -8,6 +8,6 @@ namespace Icinga\Exception;
* Class ConfigurationError
* @package Icinga\Exception
*/
class ConfigurationError extends \RuntimeException
class ConfigurationError extends IcingaException
{
}

View File

@ -0,0 +1,29 @@
<?php
// {{{ICINGA_LICENSE_HEADER}}}
// {{{ICINGA_LICENSE_HEADER}}}
namespace Icinga\Exception;
use Exception;
class IcingaException extends Exception
{
/**
* @param string $message format string for vsprintf()
* Any futher args: args for vsprintf()
* @see vsprintf
*
* If there is at least one exception, the last one will be also used for the exception chaining.
*/
public function __construct($message = '')
{
$args = array_slice(func_get_args(), 1);
$exc = null;
foreach ($args as &$arg) {
if ($arg instanceof Exception) {
$exc = $arg;
}
}
parent::__construct(vsprintf($message, $args), 0, $exc);
}
}

View File

@ -4,12 +4,10 @@
namespace Icinga\Exception;
use RuntimeException;
/**
* Class MissingParameterException
* @package Icinga\Exception
*/
class MissingParameterException extends RuntimeException
class MissingParameterException extends IcingaException
{
}

View File

@ -8,6 +8,6 @@ namespace Icinga\Exception;
* Class NotImplementedError
* @package Icinga\Exception
*/
class NotImplementedError extends \Exception
class NotImplementedError extends IcingaException
{
}

View File

@ -4,8 +4,6 @@
namespace Icinga\Exception;
use RuntimeException;
class NotReadableError extends RuntimeException
class NotReadableError extends IcingaException
{
}

View File

@ -4,8 +4,6 @@
namespace Icinga\Exception;
use RuntimeException;
class NotWritableError extends RuntimeException
class NotWritableError extends IcingaException
{
}

View File

@ -8,6 +8,6 @@ namespace Icinga\Exception;
* Class ProgrammingError
* @package Icinga\Exception
*/
class ProgrammingError extends \Exception
class ProgrammingError extends IcingaException
{
}

View File

@ -4,11 +4,9 @@
namespace Icinga\Exception;
use \Exception;
/**
* Handle problems according to file system permissions
*/
class SystemPermissionException extends Exception
class SystemPermissionException extends IcingaException
{
}

View File

@ -81,7 +81,10 @@ class Logger
{
$class = 'Icinga\\Logger\\Writer\\' . ucfirst(strtolower($config->type)) . 'Writer';
if (!class_exists($class)) {
throw new ConfigurationError('Cannot find log writer of type "' . $config->type . '"');
throw new ConfigurationError(
'Cannot find log writer of type "%s"',
$config->type
);
}
return new $class($config);

View File

@ -5,6 +5,7 @@
namespace Icinga\Logger\Writer;
use Exception;
use Icinga\Exception\IcingaException;
use Zend_Config;
use Icinga\Util\File;
use Icinga\Logger\Logger;
@ -33,13 +34,20 @@ class FileWriter extends LogWriter
$this->path = $config->target;
if (substr($this->path, 0, 6) !== 'php://' && false === file_exists(dirname($this->path))) {
throw new ConfigurationError('Log path "' . dirname($this->path) . '" does not exist');
throw new ConfigurationError(
'Log path "%s" does not exist',
dirname($this->path)
);
}
try {
$this->write(''); // Avoid to handle such errors on every write access
} catch (Exception $e) {
throw new ConfigurationError('Cannot write to log file "' . $this->path . '" (' . $e->getMessage() . ')');
throw new ConfigurationError(
'Cannot write to log file "%s" (%s)',
$this->path,
$e->getMessage()
);
}
}
@ -61,7 +69,7 @@ class FileWriter extends LogWriter
*
* @return string The string representation of the severity
*
* @throws Exception In case the given severity is unknown
* @throws IcingaException In case the given severity is unknown
*/
protected function getSeverityString($severity)
{
@ -75,7 +83,10 @@ class FileWriter extends LogWriter
case Logger::$DEBUG:
return '- DEBUG -';
default:
throw new Exception('Unknown severity "' . $severity . '"');
throw new IcingaException(
'Unknown severity "%s"',
$severity
);
}
}

View File

@ -9,6 +9,7 @@ use Zend_Config;
use Icinga\Logger\Logger;
use Icinga\Logger\LogWriter;
use Icinga\Exception\ConfigurationError;
use Icinga\Exception\IcingaException;
/**
* Class to write messages to syslog
@ -45,7 +46,8 @@ class SyslogWriter extends LogWriter
{
if (!array_key_exists($config->facility, $this->facilities)) {
throw new ConfigurationError(
'Cannot create syslog writer with unknown facility "' . $config->facility . '"'
'Cannot create syslog writer with unknown facility "%s"',
$config->facility
);
}
@ -71,7 +73,10 @@ class SyslogWriter extends LogWriter
);
if (!array_key_exists($severity, $priorities)) {
throw new Exception('Severity "' . $severity . '" cannot be mapped to a valid syslog priority');
throw new IcingaException(
'Severity "%s" cannot be mapped to a valid syslog priority',
$severity
);
}
$this->open();

View File

@ -138,7 +138,10 @@ abstract class Command
*/
public function getHostgroupCommand($hostgroup)
{
throw new ProgrammingError(get_class($this) . ' does not provide a hostgroup command');
throw new ProgrammingError(
'%s does not provide a hostgroup command',
get_class($this)
);
}
/**
@ -150,7 +153,10 @@ abstract class Command
*/
public function getServicegroupCommand($servicegroup)
{
throw new ProgrammingError(get_class($this) . ' does not provide a servicegroup command');
throw new ProgrammingError(
'%s does not provide a servicegroup command',
get_class($this)
);
}
/**
@ -163,6 +169,9 @@ abstract class Command
*/
public function getGlobalCommand($instance = null)
{
throw new ProgrammingError(getclass($this) . ' does not provide a global command');
throw new ProgrammingError(
'%s does not provide a global command',
getclass($this)
);
}
}

View File

@ -49,11 +49,9 @@ class LocalPipe implements Transport
$file->fflush();
} catch (Exception $e) {
throw new ConfigurationError(
sprintf(
'Could not open icinga command pipe at "%s" (%s)',
$this->path,
$e->getMessage()
)
'Could not open icinga command pipe at "%s" (%s)',
$this->path,
$e->getMessage()
);
}

View File

@ -4,7 +4,7 @@
namespace Icinga\Protocol\Commandpipe\Transport;
use \Zend_Config;
use Zend_Config;
/**
* Interface for Transport classes handling the concrete access to the command pipe

View File

@ -8,7 +8,7 @@ use Icinga\Protocol\Ldap\Exception as LdapException;
use Icinga\Application\Platform;
use Icinga\Application\Config;
use Icinga\Logger\Logger;
use \Zend_Config;
use Zend_Config;
/**
* Backend class managing all the LDAP stuff for you.

View File

@ -4,6 +4,8 @@
namespace Icinga\Protocol\Ldap;
use Icinga\Exception\IcingaException;
/**
* Search class
*
@ -82,12 +84,10 @@ class Query
public function limit($count = null, $offset = null)
{
if (! preg_match('~^\d+~', $count . $offset)) {
throw new Exception(
sprintf(
'Got invalid limit: %s, %s',
$count,
$offset
)
throw new IcingaException(
'Got invalid limit: %s, %s',
$count,
$offset
);
}
$this->limit_count = (int) $count;
@ -316,7 +316,7 @@ class Query
{
$parts = array();
if (! isset($this->filters['objectClass']) || $this->filters['objectClass'] === null) {
// throw new Exception('Object class is mandatory');
// throw new IcingaException('Object class is mandatory');
}
foreach ($this->filters as $key => $value) {
$parts[] = sprintf(

View File

@ -4,6 +4,8 @@
namespace Icinga\Protocol\Ldap;
use Icinga\Exception\IcingaException;
/**
* This class is a special node object, representing your connections root node
*
@ -95,16 +97,14 @@ class Root
/**
* @param $rdn
* @return mixed
* @throws Exception
* @throws IcingaException
*/
public function getChildByRDN($rdn)
{
if (!$this->hasChildRDN($rdn)) {
throw new Exception(
sprintf(
'The child RDN "%s" is not available',
$rdn
)
throw new IcingaException(
'The child RDN "%s" is not available',
$rdn
);
}
return $this->children[strtolower($rdn)];
@ -154,28 +154,24 @@ class Root
/**
* @param $dn
* @return $this
* @throws Exception
* @throws IcingaException
*/
protected function assertSubDN($dn)
{
$mydn = $this->getDN();
$end = substr($dn, -1 * strlen($mydn));
if (strtolower($end) !== strtolower($mydn)) {
throw new Exception(
sprintf(
'"%s" is not a child of "%s"',
$dn,
$mydn
)
throw new IcingaException(
'"%s" is not a child of "%s"',
$dn,
$mydn
);
}
if (strlen($dn) === strlen($mydn)) {
throw new Exception(
sprintf(
'"%s" is not a child of "%s", they are equal',
$dn,
$mydn
)
throw new IcingaException(
'"%s" is not a child of "%s", they are equal',
$dn,
$mydn
);
}
return $this;

View File

@ -6,6 +6,7 @@ namespace Icinga\Protocol\Livestatus;
use Icinga\Application\Benchmark;
use Exception;
use Icinga\Exception\IcingaException;
/**
* Backend class managing handling MKI Livestatus connections
@ -73,22 +74,18 @@ class Connection
$this->assertPhpExtensionLoaded('sockets');
if ($socket[0] === '/') {
if (! is_writable($socket)) {
throw new \Exception(
sprintf(
'Cannot write to livestatus socket "%s"',
$socket
)
throw new IcingaException(
'Cannot write to livestatus socket "%s"',
$socket
);
}
$this->socket_type = self::TYPE_UNIX;
$this->socket_path = $socket;
} else {
if (! preg_match('~^tcp://([^:]+):(\d+)~', $socket, $m)) {
throw new \Exception(
sprintf(
'Invalid TCP socket syntax: "%s"',
$socket
)
throw new IcingaException(
'Invalid TCP socket syntax: "%s"',
$socket
);
}
// TODO: Better syntax checks
@ -156,17 +153,15 @@ class Connection
$length = (int) trim(substr($header, 4));
$body = $this->readFromSocket($length);
if ($status !== 200) {
throw new Exception(
sprintf(
'Problem while reading %d bytes from livestatus: %s',
$length,
$body
)
throw new IcingaException(
'Problem while reading %d bytes from livestatus: %s',
$length,
$body
);
}
$result = json_decode($body);
if ($result === null) {
throw new Exception('Got invalid response body from livestatus');
throw new IcingaException('Got invalid response body from livestatus');
}
return $result;
@ -180,11 +175,9 @@ class Connection
while ($offset < $length) {
$data = socket_read($this->connection, $length - $offset);
if ($data === false) {
throw new Exception(
sprintf(
'Failed to read from livestatus socket: %s',
socket_strerror(socket_last_error($this->connection))
)
throw new IcingaException(
'Failed to read from livestatus socket: %s',
socket_strerror(socket_last_error($this->connection))
);
}
$size = strlen($data);
@ -196,12 +189,10 @@ class Connection
}
}
if ($offset !== $length) {
throw new \Exception(
sprintf(
'Got only %d instead of %d bytes from livestatus socket',
$offset,
$length
)
throw new IcingaException(
'Got only %d instead of %d bytes from livestatus socket',
$offset,
$length
);
}
@ -212,7 +203,7 @@ class Connection
{
$res = socket_write($this->connection, $data);
if ($res === false) {
throw new \Exception('Writing to livestatus socket failed');
throw new IcingaException('Writing to livestatus socket failed');
}
return true;
}
@ -220,11 +211,9 @@ class Connection
protected function assertPhpExtensionLoaded($name)
{
if (! extension_loaded($name)) {
throw new \Exception(
sprintf(
'The extension "%s" is not loaded',
$name
)
throw new IcingaException(
'The extension "%s" is not loaded',
$name
);
}
}
@ -250,13 +239,11 @@ class Connection
$this->connection = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if (! @socket_connect($this->connection, $this->socket_host, $this->socket_port)) {
throw new \Exception(
sprintf(
'Cannot connect to livestatus TCP socket "%s:%d": %s',
$this->socket_host,
$this->socket_port,
socket_strerror(socket_last_error($this->connection))
)
throw new IcingaException(
'Cannot connect to livestatus TCP socket "%s:%d": %s',
$this->socket_host,
$this->socket_port,
socket_strerror(socket_last_error($this->connection))
);
}
socket_set_option($this->connection, SOL_TCP, TCP_NODELAY, 1);
@ -266,11 +253,9 @@ class Connection
{
$this->connection = socket_create(AF_UNIX, SOCK_STREAM, 0);
if (! socket_connect($this->connection, $this->socket_path)) {
throw new \Exception(
sprintf(
'Cannot connect to livestatus local socket "%s"',
$this->socket_path
)
throw new IcingaException(
'Cannot connect to livestatus local socket "%s"',
$this->socket_path
);
}
}

View File

@ -5,6 +5,7 @@
namespace Icinga\Protocol\Livestatus;
use Icinga\Protocol\AbstractQuery;
use Icinga\Exception\IcingaException;
class Query extends AbstractQuery
{
@ -86,12 +87,10 @@ class Query extends AbstractQuery
public function limit($count = null, $offset = null)
{
if (! preg_match('~^\d+~', $count . $offset)) {
throw new Exception(
sprintf(
'Got invalid limit: %s, %s',
$count,
$offset
)
throw new IcingaException(
'Got invalid limit: %s, %s',
$count,
$offset
);
}
$this->limit_count = (int) $count;
@ -122,11 +121,9 @@ class Query extends AbstractQuery
public function from($table, $columns = null)
{
if (! $this->connection->hasTable($table)) {
throw new Exception(
sprintf(
'This livestatus connection does not provide "%s"',
$table
)
throw new IcingaException(
'This livestatus connection does not provide "%s"',
$table
);
}
$this->table = $table;
@ -169,7 +166,7 @@ class Query extends AbstractQuery
public function __toString()
{
if ($this->table === null) {
throw new Exception('Table is required');
throw new IcingaException('Table is required');
}
$default_headers = array(
'OutputFormat: json',

View File

@ -4,6 +4,8 @@
namespace Icinga\Protocol\Nrpe;
use Icinga\Exception\IcingaException;
class Connection
{
protected $host;
@ -47,11 +49,10 @@ class Connection
// TODO: Check result checksum!
$result = fread($conn, 8192);
if ($result === false) {
throw new \Exception('CHECK_NRPE: Error receiving data from daemon.');
throw new IcingaException('CHECK_NRPE: Error receiving data from daemon.');
} elseif (strlen($result) === 0) {
throw new \Exception(
'CHECK_NRPE: Received 0 bytes from daemon.'
. ' Check the remote server logs for error messages'
throw new IcingaException(
'CHECK_NRPE: Received 0 bytes from daemon. Check the remote server logs for error messages'
);
}
// TODO: CHECK_NRPE: Receive underflow - only %d bytes received (%d expected)
@ -80,7 +81,10 @@ class Connection
$ctx
);
if (! $this->connection) {
throw new \Exception(sprintf('NRPE Connection failed: ' . $errstr));
throw new IcingaException(
'NRPE Connection failed: %s',
$errstr
);
}
}

View File

@ -72,12 +72,12 @@ class Parser
*/
public function parseObjectsFile()
{
$DEFINE = strlen("define ");
$DEFINE = strlen('define ');
$this->icingaState = array();
foreach ($this->file as $line) {
$line = trim($line);
$this->lineCtr++;
if ($line === "" || $line[0] === "#") {
if ($line === '' || $line[0] === '#') {
continue;
}
$this->currentObjectType = trim(substr($line, $DEFINE, -1));
@ -103,13 +103,13 @@ class Parser
}
if (!$this->icingaState) {
throw new ProgrammingError("Tried to read runtime state without existing objects data");
throw new ProgrammingError('Tried to read runtime state without existing objects data');
}
$this->overwrites = array();
foreach ($file as $line) {
$line = trim($line);
$this->lineCtr++;
if ($line === "" || $line[0] === "#") {
if ($line === '' || $line[0] === '#') {
continue;
}
$this->currentStateType = trim(substr($line, 0, -1));
@ -133,16 +133,16 @@ class Parser
}
// End of object
if ($line[0] === "}") {
if ($line[0] === '}') {
$this->registerObject($monitoringObject);
return;
}
if (!isset($line[1])) {
$line[1] = "";
$line[1] = '';
}
$monitoringObject->{$line[0]} = trim($line[1]);
}
throw new ParsingException("Unexpected EOF in objects.cache, line " . $this->lineCtr);
throw new ParsingException('Unexpected EOF in objects.cache, line ' . $this->lineCtr);
}
/**
@ -156,7 +156,7 @@ class Parser
$objectType = $this->getObjectTypeForState();
if ($objectType != "host" && $objectType != "service") {
if ($objectType != 'host' && $objectType != 'service') {
$this->skipObject(); // ignore unknown objects
return;
}
@ -170,7 +170,7 @@ class Parser
if (!isset($base[$name])) {
throw new ParsingException(
"Unknown object $name " . $this->currentObjectType . " - "
"Unknown object $name " . $this->currentObjectType . ' - '
. print_r(
$statusdatObject,
true
@ -180,7 +180,7 @@ class Parser
}
$type = substr($this->currentStateType, strlen($objectType));
if ($type == "status") {
if ($type == 'status') {
// directly set the status to the status field of the given object
$base[$name]->status = & $statusdatObject;
} else {
@ -211,20 +211,20 @@ class Parser
*/
private function getObjectTypeForState()
{
$pos = strpos($this->currentStateType, "service");
$pos = strpos($this->currentStateType, 'service');
if ($pos === false) {
$pos = strpos($this->currentStateType, "host");
$pos = strpos($this->currentStateType, 'host');
} else {
$this->currentObjectType = "service";
return "service";
$this->currentObjectType = 'service';
return 'service';
}
if ($pos === false) {
return $this->currentStateType;
} else {
$this->currentObjectType = "host";
return "host";
$this->currentObjectType = 'host';
return 'host';
}
return $this->currentObjectType;
@ -239,12 +239,12 @@ class Parser
protected function skipObject($returnString = false)
{
if (!$returnString) {
while (trim($this->file->fgets()) !== "}") {
while (trim($this->file->fgets()) !== '}') {
}
return null;
} else {
$str = "";
while (($val = trim($this->file->fgets())) !== "}") {
$str = '';
while (($val = trim($this->file->fgets())) !== '}') {
$str .= $val . "\n";
}
return $str;
@ -280,9 +280,9 @@ class Parser
|| $this->currentObjectType == 'contact') {
return null;
}
$isService = strpos($this->currentObjectType, "service") !== false;
$isHost = strpos($this->currentObjectType, "host") !== false;
$isContact = strpos($this->currentObjectType, "contact") !== false;
$isService = strpos($this->currentObjectType, 'service') !== false;
$isHost = strpos($this->currentObjectType, 'host') !== false;
$isContact = strpos($this->currentObjectType, 'contact') !== false;
$name = $this->getObjectIdentifier($object);
if ($isService === false && $isHost === false && $isContact === false) {
@ -291,14 +291,14 @@ class Parser
}
$property = $this->currentObjectType;
if ($isService) {
$this->currentObjectType = "service";
$property = substr($property, strlen("service"));
$this->currentObjectType = 'service';
$property = substr($property, strlen('service'));
} elseif ($isHost) {
$this->currentObjectType = "host";
$property = substr($property, strlen("host"));
$this->currentObjectType = 'host';
$property = substr($property, strlen('host'));
} elseif ($isContact) {
$this->currentObjectType = "contact";
$property = substr($property, strlen("contact"));
$this->currentObjectType = 'contact';
$property = substr($property, strlen('contact'));
}
if (!isset($this->icingaState[$this->currentObjectType])) {
@ -306,7 +306,7 @@ class Parser
}
// @TODO: Clean up, this differates between 1:n and 1:1 references
if (strpos($property, "group") !== false) {
if (strpos($property, 'group') !== false) {
$sourceIdentifier = $this->getMembers($object);
foreach ($sourceIdentifier as $id) {
$source = $this->icingaState[$this->currentObjectType][$id];
@ -368,12 +368,12 @@ class Parser
return array();
}
$members = explode(",", $object->members);
$members = explode(',', $object->members);
if ($this->currentObjectType == "service") {
if ($this->currentObjectType == 'service') {
$res = array();
for ($i = 0; $i < count($members); $i += 2) {
$res[] = $members[$i] . ";" . $members[$i + 1];
$res[] = $members[$i] . ';' . $members[$i + 1];
}
return $res;
} else {
@ -394,15 +394,15 @@ class Parser
return $object->contact_name;
}
if ($this->currentObjectType == "service") {
return $object->host_name . ";" . $object->service_description;
if ($this->currentObjectType == 'service') {
return $object->host_name . ';' . $object->service_description;
}
$name = $this->currentObjectType . "_name";
$name = $this->currentObjectType . '_name';
if (isset($object->{$name})) {
return $object->{$name};
}
if (isset($object->service_description)) {
return $object->host_name . ";" . $object->service_description;
return $object->host_name . ';' . $object->service_description;
} elseif (isset($object->host_name)) {
return $object->host_name;
}

View File

@ -9,6 +9,7 @@ use Icinga\Exception\ProgrammingError;
use Icinga\Data\SimpleQuery;
use Icinga\Protocol\Statusdat\View\MonitoringObjectList;
use Icinga\Protocol\Statusdat\Query\IQueryPart;
use Icinga\Exception\IcingaException;
/**
* Base implementation for Statusdat queries.
@ -163,7 +164,7 @@ class Query extends SimpleQuery
* @param array $columns An array of attributes to use (required for fetchPairs())
*
* @return $this Fluent interface
* @throws \Exception If the target is unknonw
* @throws IcingaException If the target is unknonw
*/
public function from($table, array $attributes = null)
{
@ -173,7 +174,10 @@ class Query extends SimpleQuery
if (isset(self::$VALID_TARGETS[$table])) {
$this->source = $table;
} else {
throw new \Exception('Unknown from target for status.dat :' . $table);
throw new IcingaException(
'Unknown from target for status.dat :%s',
$table
);
}
return $this;
}
@ -397,16 +401,15 @@ class Query extends SimpleQuery
/**
* Fetch the result as an associative array using the first column as the key and the second as the value
*
* @return array An associative array with the result
* @throws \Exception If no attributes are defined
* @return array An associative array with the result
* @throws IcingaException If no attributes are defined
*/
public function fetchPairs()
{
$result = array();
if (count($this->getColumns()) < 2) {
throw new Exception(
'Status.dat "fetchPairs()" query expects at least' .
' columns to be set in the query expression'
throw new IcingaException(
'Status.dat "fetchPairs()" query expects at least columns to be set in the query expression'
);
}
$attributes = $this->getColumns();
@ -440,7 +443,7 @@ class Query extends SimpleQuery
*/
public function fetchOne()
{
throw new ProgrammingError('Statusdat/Query::fetchOne not yet implemented');
throw new ProgrammingError('Statusdat/Query::fetchOne() is not implemented yet');
}
/**

View File

@ -4,6 +4,8 @@
namespace Icinga\Protocol\Statusdat\Query;
use Icinga\Exception\IcingaException;
class Expression implements IQueryPart
{
/**
@ -70,7 +72,7 @@ class Expression implements IQueryPart
/**
* @param $token
* @throws \Exception
* @throws IcingaException
*/
private function getOperatorType($token)
{
@ -106,7 +108,11 @@ class Expression implements IQueryPart
$this->CB = "isNotIn";
break;
default:
throw new \Exception("Unknown operator $token in expression $this->expression !");
throw new IcingaException(
'Unknown operator %s in expression %s !',
$token,
$this->expression
);
}
}

View File

@ -4,6 +4,8 @@
namespace Icinga\Protocol\Statusdat\Query;
use Icinga\Exception\IcingaException;
/**
* Class Group
* @package Icinga\Protocol\Statusdat\Query
@ -130,7 +132,7 @@ class Group implements IQueryPart
}
/**
* @throws \Exception
* @throws IcingaException
*/
private function tokenize()
{
@ -154,7 +156,10 @@ class Group implements IQueryPart
}
if ($token === self::GROUP_END) {
if ($subgroupCount < 1) {
throw new \Exception("Invalid Query: unexpected ')' at pos " . $this->parsePos);
throw new IcingaException(
'Invalid Query: unexpected \')\' at pos %s',
$this->parsePos
);
}
$subgroupCount--;
/*
@ -192,7 +197,7 @@ class Group implements IQueryPart
$this->subExpressionLength = $this->parsePos - $this->subExpressionStart;
}
if ($subgroupCount > 0) {
throw new \Exception("Unexpected end of query, are you missing a parenthesis?");
throw new IcingaException('Unexpected end of query, are you missing a parenthesis?');
}
$this->startNewSubExpression();

View File

@ -246,7 +246,8 @@ class Reader implements IReader, Selectable
{
if (!is_readable($this->config->object_file)) {
throw new ConfigurationError(
'Can\'t read object-file "' . $this->config->object_file . '", check your configuration'
'Can\'t read object-file "%s", check your configuration',
$this->config->object_file
);
}
if (!$this->parser) {
@ -265,7 +266,8 @@ class Reader implements IReader, Selectable
{
if (!is_readable($this->config->status_file)) {
throw new ConfigurationError(
"Can't read status-file {$this->config->status_file}, check your configuration"
'Can\'t read status-file %s, check your configuration',
$this->config->status_file
);
}
if (!$this->parser) {

View File

@ -4,10 +4,11 @@
namespace Icinga\Protocol\Statusdat\View;
use \Iterator;
use \Countable;
use \ArrayAccess;
use \Exception;
use Iterator;
use Countable;
use ArrayAccess;
use Exception;
use Icinga\Exception\IcingaException;
/**
* Wrapper around an array of monitoring objects that can be enhanced with an optional
@ -115,7 +116,7 @@ class MonitoringObjectList implements Iterator, Countable, ArrayAccess
public function __set($name, $value)
{
throw new Exception("Setting is currently not available for objects");
throw new IcingaException('Setting is currently not available for objects');
}
public function offsetExists($offset)

View File

@ -4,7 +4,7 @@
namespace Icinga\User\Preferences;
use \Zend_Config;
use Zend_Config;
use Icinga\User;
use Icinga\User\Preferences;
use Icinga\Data\ResourceFactory;
@ -127,7 +127,8 @@ abstract class PreferencesStore
$storeClass = 'Icinga\\User\\Preferences\\Store\\' . $type . 'Store';
if (!class_exists($storeClass)) {
throw new ConfigurationError(
'Preferences configuration defines an invalid storage type. Storage type ' . $type . ' not found'
'Preferences configuration defines an invalid storage type. Storage type %s not found',
$type
);
}

View File

@ -78,7 +78,9 @@ class DbStore extends PreferencesStore
->fetchAll();
} catch (Exception $e) {
throw new NotReadableError(
'Cannot fetch preferences for user ' . $this->getUser()->getUsername() . ' from database', 0, $e
'Cannot fetch preferences for user %s from database',
$this->getUser()->getUsername(),
$e
);
}
@ -145,7 +147,9 @@ class DbStore extends PreferencesStore
}
} catch (Exception $e) {
throw new NotWritableError(
'Cannot insert preferences for user ' . $this->getUser()->getUsername() . ' into database', 0, $e
'Cannot insert preferences for user %s into database',
$this->getUser()->getUsername(),
$e
);
}
}
@ -174,7 +178,9 @@ class DbStore extends PreferencesStore
}
} catch (Exception $e) {
throw new NotWritableError(
'Cannot update preferences for user ' . $this->getUser()->getUsername() . ' in database', 0, $e
'Cannot update preferences for user %s in database',
$this->getUser()->getUsername(),
$e
);
}
}
@ -200,7 +206,9 @@ class DbStore extends PreferencesStore
);
} catch (Exception $e) {
throw new NotWritableError(
'Cannot delete preferences for user ' . $this->getUser()->getUsername() . ' from database', 0, $e
'Cannot delete preferences for user %s from database',
$this->getUser()->getUsername(),
$e
);
}
}

View File

@ -62,8 +62,9 @@ class IniStore extends PreferencesStore
if (file_exists($this->preferencesFile)) {
if (!is_readable($this->preferencesFile)) {
throw new NotReadableError(
'Preferences INI file ' . $this->preferencesFile . ' for user '
. $this->getUser()->getUsername() . ' is not readable'
'Preferences INI file %s for user %s is not readable',
$this->preferencesFile,
$this->getUser()->getUsername()
);
} else {
$this->preferences = parse_ini_file($this->preferencesFile);
@ -97,10 +98,8 @@ class IniStore extends PreferencesStore
if (!file_exists($this->preferencesFile)) {
if (!is_writable($this->getStoreConfig()->location)) {
throw new NotWritableError(
sprintf(
'Path to the preferences INI files %s is not writable',
$this->getStoreConfig()->location
)
'Path to the preferences INI files %s is not writable',
$this->getStoreConfig()->location
);
}
@ -109,8 +108,9 @@ class IniStore extends PreferencesStore
if (!is_writable($this->preferencesFile)) {
throw new NotWritableError(
'Preferences INI file ' . $this->preferencesFile . ' for user '
. $this->getUser()->getUsername() . ' is not writable'
'Preferences INI file %s for user %s is not writable',
$this->preferencesFile,
$this->getUser()->getUsername()
);
}

View File

@ -95,7 +95,10 @@ class Format
return '-';
}
if (! preg_match('~^\d+$~', $timestamp)) {
throw new ProgrammingError(sprintf('"%s" is not a number', $timestamp));
throw new ProgrammingError(
'"%s" is not a number',
$timestamp
);
}
$prefix = '';
if ($diff < 0) {

View File

@ -5,6 +5,7 @@
namespace Icinga\Util;
use Exception;
use Icinga\Exception\IcingaException;
/**
* Helper class to ease internationalization when using gettext
@ -53,12 +54,16 @@ class Translator
* @param string $name The name of the domain to register
* @param string $directory The directory where message catalogs can be found
*
* @throws Exception In case the domain was not successfully registered
* @throws IcingaException In case the domain was not successfully registered
*/
public static function registerDomain($name, $directory)
{
if (bindtextdomain($name, $directory) === false) {
throw new Exception("Cannot register domain '$name' with path '$directory'");
throw new IcingaException(
'Cannot register domain \'%s\' with path \'%s\'',
$name,
$directory
);
}
bind_textdomain_codeset($name, 'UTF-8');
self::$knownDomains[$name] = $directory;
@ -69,14 +74,17 @@ class Translator
*
* @param string $localeName The name of the locale to use
*
* @throws Exception In case the locale's name is invalid
* @throws IcingaException In case the locale's name is invalid
*/
public static function setupLocale($localeName)
{
if (setlocale(LC_ALL, $localeName . '.UTF-8') === false && setlocale(LC_ALL, $localeName) === false) {
setlocale(LC_ALL, 'C'); // C == "use whatever is hardcoded"
if ($localeName !== self::DEFAULT_LOCALE) {
throw new Exception("Cannot set locale '$localeName' for category 'LC_ALL'");
throw new IcingaException(
'Cannot set locale \'%s\' for category \'LC_ALL\'',
$localeName
);
}
} else {
$locale = setlocale(LC_ALL, 0);

View File

@ -8,6 +8,7 @@ use Exception;
use Icinga\Authentication\Manager as AuthManager;
use Icinga\Application\Benchmark;
use Icinga\Application\Config;
use Icinga\Exception\IcingaException;
use Icinga\Util\Translator;
use Icinga\Web\Widget\Tabs;
use Icinga\Web\Window;
@ -177,7 +178,10 @@ class ActionController extends Zend_Controller_Action
{
if (! $this->Auth()->hasPermission($name)) {
// TODO: Shall this be an Auth Exception? Or a 404?
throw new Exception(sprintf('Auth error, no permission for "%s"', $name));
throw new IcingaException(
'Auth error, no permission for "%s"',
$name
);
}
}
@ -381,7 +385,7 @@ class ActionController extends Zend_Controller_Action
if ($this->view->title) {
if (preg_match('~[\r\n]~', $this->view->title)) {
// TODO: Innocent exception and error log for hack attempts
throw new Exception('No way, guy');
throw new IcingaException('No way, guy');
}
$resp->setHeader(
'X-Icinga-Title',

View File

@ -4,7 +4,7 @@
namespace Icinga\Web\Form\Decorator;
use \Zend_Form_Decorator_Abstract;
use Zend_Form_Decorator_Abstract;
/**
* Decorator to hide elements using a &gt;noscript&lt; tag instead of

View File

@ -5,9 +5,9 @@
namespace Icinga\Web\Form\Element;
use Icinga\Web\Form\Validator\DateTimeValidator;
use \Zend_Form_Element_Text;
use \Zend_Form_Element;
use \Icinga\Util\DateTimeFactory;
use Zend_Form_Element_Text;
use Zend_Form_Element;
use Icinga\Util\DateTimeFactory;
/**
* Datetime form element which returns the input as Unix timestamp after the input has been proven valid. Utilizes

View File

@ -4,8 +4,8 @@
namespace Icinga\Web\Form\Element;
use \Icinga\Web\Form\Validator\TriStateValidator;
use \Zend_Form_Element_Xhtml;
use Icinga\Web\Form\Validator\TriStateValidator;
use Zend_Form_Element_Xhtml;
/**
* A checkbox that can display three different states:

View File

@ -4,7 +4,7 @@
namespace Icinga\Web\Form\Validator;
use \Zend_Validate_Abstract;
use Zend_Validate_Abstract;
/**
* Validator that checks if a textfield contains a correct date format

View File

@ -4,9 +4,9 @@
namespace Icinga\Web\Form\Validator;
use \Icinga\Util\DateTimeFactory;
use \Zend_Validate_Abstract;
use \Icinga\Exception\ProgrammingError;
use Icinga\Util\DateTimeFactory;
use Zend_Validate_Abstract;
use Icinga\Exception\ProgrammingError;
/**
* Validator that checks if a textfield contains a correct date format

View File

@ -4,7 +4,7 @@
namespace Icinga\Web\Form\Validator;
use \Zend_Validate_Abstract;
use Zend_Validate_Abstract;
/**
* Validator that checks if a textfield contains a correct time format

View File

@ -4,7 +4,7 @@
namespace Icinga\Web\Form\Validator;
use \Zend_Validate_Abstract;
use Zend_Validate_Abstract;
class TriStateValidator extends Zend_Validate_Abstract
{

View File

@ -4,8 +4,8 @@
namespace Icinga\Web\Form\Validator;
use \Zend_Validate_Abstract;
use \Icinga\Application\Config as IcingaConfig;
use Zend_Validate_Abstract;
use Icinga\Application\Config as IcingaConfig;
/**
* Validator that interprets the value as a path and checks if it's writable

View File

@ -41,6 +41,15 @@ class Hook
*/
public static $BASE_NS = 'Icinga\\Web\\Hook\\';
/**
* Append this string to base class
*
* All base classes renamed to *Hook
*
* @var string
*/
public static $classSuffix = 'Hook';
/**
* Reset object state
*/
@ -114,14 +123,12 @@ class Hook
*/
private static function assertValidHook($instance, $name)
{
$base_class = self::$BASE_NS . ucfirst($name);
$base_class = self::$BASE_NS . ucfirst($name) . self::$classSuffix;
if (!$instance instanceof $base_class) {
throw new ProgrammingError(
sprintf(
'%s is not an instance of %s',
get_class($instance),
$base_class
)
'%s is not an instance of %s',
get_class($instance),
$base_class
);
}
}
@ -185,7 +192,10 @@ class Hook
public static function registerClass($name, $key, $class)
{
if (!class_exists($class)) {
throw new ProgrammingError('"' . $class . '" is not an existing class');
throw new ProgrammingError(
'"%s" is not an existing class',
$class
);
}
if (!isset(self::$hooks[$name])) {
@ -207,7 +217,10 @@ class Hook
public static function registerObject($name, $key, $object)
{
if (!is_object($object)) {
throw new ProgrammingError('"' . $object . '" is not an instantiated class');
throw new ProgrammingError(
'"%s" is not an instantiated class',
$object
);
}
if (!isset(self::$instances[$name])) {

View File

@ -1,145 +0,0 @@
<?php
// {{{ICINGA_LICENSE_HEADER}}}
// {{{ICINGA_LICENSE_HEADER}}}
namespace Icinga\Web\Hook\Configuration;
use Icinga\Exception\ProgrammingError;
/**
* Class ConfigurationTab
*
* Hook to represent configuration tabs
*
* @package Icinga\Web\Hook\Configuration
*/
class ConfigurationTab implements ConfigurationTabInterface
{
/**
* Module name
* @var string
*/
private $moduleName;
/**
* Url segment to invoke controller
* @var string
*/
private $url;
/**
* Title of the tab
* @var string
*/
private $title;
/**
* Create a new instance
*
* @param string|null $name
* @param string|null $url
* @param string|null $title
*/
public function __construct($name = null, $url = null, $title = null)
{
if ($name !== null) {
$this->setModuleName($name);
if ($title === null) {
$this->setTitle($name);
}
}
if ($url !== null) {
$this->setUrl($url);
}
if ($title !== null) {
$this->setTitle($title);
}
}
/**
* Setter for title
* @param string $title
*/
public function setTitle($title)
{
$this->title = $title;
}
/**
* Getter for title
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* Setter for url
* @param string $url
*/
public function setUrl($url)
{
$this->url = $url;
}
/**
* Getter for url
* @return string
*/
public function getUrl()
{
return $this->url;
}
/**
* Setter for module name
* @param string $moduleName
*/
public function setModuleName($moduleName)
{
$this->moduleName = $moduleName;
}
private function assertConfiguration()
{
if (!$this->moduleName) {
throw new ProgrammingError('moduleName is missing');
}
if (!$this->getUrl()) {
throw new ProgrammingError('url is missing');
}
if (!$this->getTitle()) {
throw new ProgrammingError('title is missing');
}
}
/**
* Returns a tab configuration to build configuration links
* @return array
*/
public function getTab()
{
$this->assertConfiguration();
return array(
'title' => $this->getTitle(),
'url' => $this->getUrl()
);
}
/**
* Return the tab key
* @return string
*/
public function getModuleName()
{
$this->assertConfiguration();
return $this->moduleName;
}
}

View File

@ -1,107 +0,0 @@
<?php
// {{{ICINGA_LICENSE_HEADER}}}
// {{{ICINGA_LICENSE_HEADER}}}
namespace Icinga\Web\Hook\Configuration;
use Icinga\Exception\ProgrammingError;
use Icinga\Web\Hook;
use Icinga\Web\Widget\Tabs;
/**
* Class ConfigurationTabBuilder
*
* Glue config tabs together
*
* @package Icinga\Web\Hook\Configuration
*/
class ConfigurationTabBuilder
{
/**
* Namespace for configuration tabs
*/
const HOOK_NAMESPACE = 'Configuration/Tabs';
/**
* Tabs widget
* @var Tabs
*/
private $tabs;
/**
* Create a new instance
* @param Tabs $tabs
*/
public function __construct(Tabs $tabs)
{
$this->setTabs($tabs);
$this->initializeSystemConfigurationTabs();
}
/**
* Setter for tabs
* @param \Icinga\Web\Widget\Tabs $tabs
*/
public function setTabs($tabs)
{
$this->tabs = $tabs;
}
/**
* Getter for tabs
* @return \Icinga\Web\Widget\Tabs
*/
public function getTabs()
{
return $this->tabs;
}
/**
* Build the tabs
*
*/
public function build()
{
/** @var ConfigurationTab $configTab */
$configTab = null;
foreach (Hook::all(self::HOOK_NAMESPACE) as $configTab) {
if (!$configTab instanceof ConfigurationTabInterface) {
throw new ProgrammingError('tab not instance of ConfigTabInterface');
}
$this->getTabs()->add($configTab->getModuleName(), $configTab->getTab());
}
}
/**
* Initialize system configuration tabs
*/
public function initializeSystemConfigurationTabs()
{
$configurationTab = new ConfigurationTab(
'configuration',
'configuration/index',
'Configuration'
);
// Display something about us
Hook::registerObject(
ConfigurationTabBuilder::HOOK_NAMESPACE,
$configurationTab->getModuleName(),
$configurationTab
);
$modulesOverviewTab = new ConfigurationTab(
'modules',
'modules/overview',
'Modules'
);
Hook::registerObject(
ConfigurationTabBuilder::HOOK_NAMESPACE,
$modulesOverviewTab->getModuleName(),
$modulesOverviewTab
);
}
}

Some files were not shown because too many files have changed in this diff Show More