mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-30 09:14:08 +02:00
Swag: Fix swag (aka a whole bunch of code style issues..)
This commit is contained in:
parent
91a315764c
commit
181e2ef05c
@ -27,7 +27,9 @@ class GroupController extends AuthBackendController
|
|||||||
$this->assertPermission('config/authentication/groups/show');
|
$this->assertPermission('config/authentication/groups/show');
|
||||||
$this->createListTabs()->activate('group/list');
|
$this->createListTabs()->activate('group/list');
|
||||||
$backendNames = array_map(
|
$backendNames = array_map(
|
||||||
function ($b) { return $b->getName(); },
|
function ($b) {
|
||||||
|
return $b->getName();
|
||||||
|
},
|
||||||
$this->loadUserGroupBackends('Icinga\Data\Selectable')
|
$this->loadUserGroupBackends('Icinga\Data\Selectable')
|
||||||
);
|
);
|
||||||
if (empty($backendNames)) {
|
if (empty($backendNames)) {
|
||||||
|
@ -27,10 +27,7 @@ class ListController extends Controller
|
|||||||
{
|
{
|
||||||
$this->getTabs()->add($action, array(
|
$this->getTabs()->add($action, array(
|
||||||
'label' => ucfirst($action),
|
'label' => ucfirst($action),
|
||||||
'url' => Url::fromPath(
|
'url' => Url::fromPath('list/' . str_replace(' ', '', $action))
|
||||||
'list/'
|
|
||||||
. str_replace(' ', '', $action)
|
|
||||||
)
|
|
||||||
))->extend(new OutputFormat())->extend(new DashboardAction())->extend(new MenuAction())->activate($action);
|
))->extend(new OutputFormat())->extend(new DashboardAction())->extend(new MenuAction())->activate($action);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,9 @@ class UserController extends AuthBackendController
|
|||||||
$this->assertPermission('config/authentication/users/show');
|
$this->assertPermission('config/authentication/users/show');
|
||||||
$this->createListTabs()->activate('user/list');
|
$this->createListTabs()->activate('user/list');
|
||||||
$backendNames = array_map(
|
$backendNames = array_map(
|
||||||
function ($b) { return $b->getName(); },
|
function ($b) {
|
||||||
|
return $b->getName();
|
||||||
|
},
|
||||||
$this->loadUserBackends('Icinga\Data\Selectable')
|
$this->loadUserBackends('Icinga\Data\Selectable')
|
||||||
);
|
);
|
||||||
if (empty($backendNames)) {
|
if (empty($backendNames)) {
|
||||||
|
@ -51,7 +51,6 @@ class SshResourceForm extends Form
|
|||||||
);
|
);
|
||||||
|
|
||||||
if ($this->getRequest()->getActionName() != 'editresource') {
|
if ($this->getRequest()->getActionName() != 'editresource') {
|
||||||
|
|
||||||
$callbackValidator = new Zend_Validate_Callback(function ($value) {
|
$callbackValidator = new Zend_Validate_Callback(function ($value) {
|
||||||
if (openssl_pkey_get_private($value) === false) {
|
if (openssl_pkey_get_private($value) === false) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -100,8 +100,7 @@ class UserBackendConfigForm extends ConfigForm
|
|||||||
*/
|
*/
|
||||||
public function getBackendForm($type)
|
public function getBackendForm($type)
|
||||||
{
|
{
|
||||||
switch ($type)
|
switch ($type) {
|
||||||
{
|
|
||||||
case 'db':
|
case 'db':
|
||||||
$form = new DbBackendForm();
|
$form = new DbBackendForm();
|
||||||
$form->setResources(isset($this->resources['db']) ? $this->resources['db'] : array());
|
$form->setResources(isset($this->resources['db']) ? $this->resources['db'] : array());
|
||||||
|
@ -346,8 +346,7 @@ class LdapUserGroupBackendForm extends Form
|
|||||||
foreach (UserBackend::getBackendConfigs() as $name => $config) {
|
foreach (UserBackend::getBackendConfigs() as $name => $config) {
|
||||||
if (in_array(strtolower($config->backend), array('ldap', 'msldap'))) {
|
if (in_array(strtolower($config->backend), array('ldap', 'msldap'))) {
|
||||||
$backendResource = ResourceFactory::create($config->resource);
|
$backendResource = ResourceFactory::create($config->resource);
|
||||||
if (
|
if ($backendResource->getHostname() === $resource->getHostname()
|
||||||
$backendResource->getHostname() === $resource->getHostname()
|
|
||||||
&& $backendResource->getPort() === $resource->getPort()
|
&& $backendResource->getPort() === $resource->getPort()
|
||||||
) {
|
) {
|
||||||
$names[] = $name;
|
$names[] = $name;
|
||||||
|
@ -40,8 +40,7 @@ class UserGroupBackendForm extends ConfigForm
|
|||||||
*/
|
*/
|
||||||
public function getBackendForm($type)
|
public function getBackendForm($type)
|
||||||
{
|
{
|
||||||
switch ($type)
|
switch ($type) {
|
||||||
{
|
|
||||||
case 'db':
|
case 'db':
|
||||||
return new DbUserGroupBackendForm();
|
return new DbUserGroupBackendForm();
|
||||||
case 'ldap':
|
case 'ldap':
|
||||||
|
@ -137,6 +137,8 @@ class ConfigForm extends Form
|
|||||||
*/
|
*/
|
||||||
public static function transformEmptyValuesToNull(array $values)
|
public static function transformEmptyValuesToNull(array $values)
|
||||||
{
|
{
|
||||||
return array_map(function ($v) { return empty($v) ? null : $v; }, $values);
|
return array_map(function ($v) {
|
||||||
|
return empty($v) ? null : $v;
|
||||||
|
}, $values);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -213,8 +213,7 @@ class NavigationConfigForm extends ConfigForm
|
|||||||
|
|
||||||
$names = array();
|
$names = array();
|
||||||
foreach ($this->getShareConfig($type) as $sectionName => $sectionConfig) {
|
foreach ($this->getShareConfig($type) as $sectionName => $sectionConfig) {
|
||||||
if (
|
if ($sectionName !== $this->itemToLoad
|
||||||
$sectionName !== $this->itemToLoad
|
|
||||||
&& $sectionConfig->owner === ($owner ?: $this->getUser()->getUsername())
|
&& $sectionConfig->owner === ($owner ?: $this->getUser()->getUsername())
|
||||||
&& !in_array($sectionName, $children, true)
|
&& !in_array($sectionName, $children, true)
|
||||||
) {
|
) {
|
||||||
@ -223,8 +222,7 @@ class NavigationConfigForm extends ConfigForm
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach ($this->getUserConfig($type) as $sectionName => $sectionConfig) {
|
foreach ($this->getUserConfig($type) as $sectionName => $sectionConfig) {
|
||||||
if (
|
if ($sectionName !== $this->itemToLoad
|
||||||
$sectionName !== $this->itemToLoad
|
|
||||||
&& !in_array($sectionName, $children, true)
|
&& !in_array($sectionName, $children, true)
|
||||||
) {
|
) {
|
||||||
$names[] = $sectionName;
|
$names[] = $sectionName;
|
||||||
@ -581,8 +579,7 @@ class NavigationConfigForm extends ConfigForm
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (
|
if ((! $itemForm->requiresParentSelection() || !isset($formData['parent']) || !$formData['parent'])
|
||||||
(! $itemForm->requiresParentSelection() || !isset($formData['parent']) || !$formData['parent'])
|
|
||||||
&& $this->getUser()->can('application/share/navigation')
|
&& $this->getUser()->can('application/share/navigation')
|
||||||
) {
|
) {
|
||||||
$checked = isset($formData['shared']) ? null : (isset($formData['users']) || isset($formData['groups']));
|
$checked = isset($formData['shared']) ? null : (isset($formData['users']) || isset($formData['groups']));
|
||||||
@ -781,8 +778,7 @@ class NavigationConfigForm extends ConfigForm
|
|||||||
if ($this->getUserConfig()->hasSection($name)) {
|
if ($this->getUserConfig()->hasSection($name)) {
|
||||||
return $this->getUserConfig();
|
return $this->getUserConfig();
|
||||||
} elseif ($this->getShareConfig()->hasSection($name)) {
|
} elseif ($this->getShareConfig()->hasSection($name)) {
|
||||||
if (
|
if ($this->getShareConfig()->get($name, 'owner') === $this->getUser()->getUsername()
|
||||||
$this->getShareConfig()->get($name, 'owner') === $this->getUser()->getUsername()
|
|
||||||
|| $this->getUser()->can('config/application/navigation')
|
|| $this->getUser()->can('config/application/navigation')
|
||||||
) {
|
) {
|
||||||
return $this->getShareConfig();
|
return $this->getShareConfig();
|
||||||
|
@ -180,7 +180,9 @@ class PreferenceForm extends Form
|
|||||||
'label' => $this->translate('Theme', 'Form element label'),
|
'label' => $this->translate('Theme', 'Form element label'),
|
||||||
'multiOptions' => $themes,
|
'multiOptions' => $themes,
|
||||||
'value' => $this->preferences->getValue(
|
'value' => $this->preferences->getValue(
|
||||||
'icingaweb', 'theme', $defaultTheme
|
'icingaweb',
|
||||||
|
'theme',
|
||||||
|
$defaultTheme
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -194,7 +196,10 @@ class PreferenceForm extends Form
|
|||||||
}
|
}
|
||||||
|
|
||||||
$tzList = array();
|
$tzList = array();
|
||||||
$tzList['autodetect'] = sprintf($this->translate('Browser (%s)', 'preferences.form'), $this->getDefaultTimezone());
|
$tzList['autodetect'] = sprintf(
|
||||||
|
$this->translate('Browser (%s)', 'preferences.form'),
|
||||||
|
$this->getDefaultTimezone()
|
||||||
|
);
|
||||||
foreach (DateTimeZone::listIdentifiers() as $tz) {
|
foreach (DateTimeZone::listIdentifiers() as $tz) {
|
||||||
$tzList[$tz] = $tz;
|
$tzList[$tz] = $tz;
|
||||||
}
|
}
|
||||||
@ -251,7 +256,9 @@ class PreferenceForm extends Form
|
|||||||
array(
|
array(
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'label' => $this->translate('Enable auto refresh'),
|
'label' => $this->translate('Enable auto refresh'),
|
||||||
'description' => $this->translate('This option allows you to enable or to disable the global page content auto refresh'),
|
'description' => $this->translate(
|
||||||
|
'This option allows you to enable or to disable the global page content auto refresh'
|
||||||
|
),
|
||||||
'value' => 1
|
'value' => 1
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -6,7 +6,8 @@
|
|||||||
*/
|
*/
|
||||||
class Zend_View_Helper_ProtectId extends Zend_View_Helper_Abstract
|
class Zend_View_Helper_ProtectId extends Zend_View_Helper_Abstract
|
||||||
{
|
{
|
||||||
public function protectId($id) {
|
public function protectId($id)
|
||||||
|
{
|
||||||
return Zend_Controller_Front::getInstance()->getRequest()->protectId($id);
|
return Zend_Controller_Front::getInstance()->getRequest()->protectId($id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,13 +6,16 @@
|
|||||||
*/
|
*/
|
||||||
class Zend_View_Helper_Util extends Zend_View_Helper_Abstract
|
class Zend_View_Helper_Util extends Zend_View_Helper_Abstract
|
||||||
{
|
{
|
||||||
public function util() {
|
public function util()
|
||||||
|
{
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function showTimeSince($timestamp)
|
public static function showTimeSince($timestamp)
|
||||||
{
|
{
|
||||||
if (! $timestamp) return 'unknown';
|
if (! $timestamp) {
|
||||||
|
return 'unknown';
|
||||||
|
}
|
||||||
$duration = time() - $timestamp;
|
$duration = time() - $timestamp;
|
||||||
if ($duration > 3600 * 24 * 3) {
|
if ($duration > 3600 * 24 * 3) {
|
||||||
if (date('Y') === date('Y', $timestamp)) {
|
if (date('Y') === date('Y', $timestamp)) {
|
||||||
|
@ -554,7 +554,7 @@ abstract class ApplicationBootstrap
|
|||||||
*
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
protected final function setupTimezone()
|
final protected function setupTimezone()
|
||||||
{
|
{
|
||||||
$timezone = $this->detectTimeZone();
|
$timezone = $this->detectTimeZone();
|
||||||
if ($timezone === null || @date_default_timezone_set($timezone) === false) {
|
if ($timezone === null || @date_default_timezone_set($timezone) === false) {
|
||||||
@ -582,7 +582,7 @@ abstract class ApplicationBootstrap
|
|||||||
*
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
protected final function setupInternationalization()
|
final protected function setupInternationalization()
|
||||||
{
|
{
|
||||||
if ($this->hasLocales()) {
|
if ($this->hasLocales()) {
|
||||||
Translator::registerDomain(Translator::DEFAULT_DOMAIN, $this->getLocaleDir());
|
Translator::registerDomain(Translator::DEFAULT_DOMAIN, $this->getLocaleDir());
|
||||||
|
@ -141,7 +141,9 @@ class Benchmark
|
|||||||
// TODO: Move formatting to CSS file
|
// TODO: Move formatting to CSS file
|
||||||
$html = '<table class="benchmark">' . "\n" . '<tr>';
|
$html = '<table class="benchmark">' . "\n" . '<tr>';
|
||||||
foreach ($data->columns as & $col) {
|
foreach ($data->columns as & $col) {
|
||||||
if ($col->title === 'Time') continue;
|
if ($col->title === 'Time') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
$html .= sprintf(
|
$html .= sprintf(
|
||||||
'<td align="%s">%s</td>',
|
'<td align="%s">%s</td>',
|
||||||
$col->align,
|
$col->align,
|
||||||
@ -153,7 +155,9 @@ class Benchmark
|
|||||||
foreach ($data->rows as & $row) {
|
foreach ($data->rows as & $row) {
|
||||||
$html .= '<tr>';
|
$html .= '<tr>';
|
||||||
foreach ($data->columns as $key => & $col) {
|
foreach ($data->columns as $key => & $col) {
|
||||||
if ($col->title === 'Time') continue;
|
if ($col->title === 'Time') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
$html .= sprintf(
|
$html .= sprintf(
|
||||||
'<td align="%s">%s</td>',
|
'<td align="%s">%s</td>',
|
||||||
$col->align,
|
$col->align,
|
||||||
|
@ -137,11 +137,8 @@ class ClassLoader
|
|||||||
$namespace = $this->extractModuleNamespace($class);
|
$namespace = $this->extractModuleNamespace($class);
|
||||||
|
|
||||||
if ($this->hasNamespace($namespace)) {
|
if ($this->hasNamespace($namespace)) {
|
||||||
|
|
||||||
return $this->buildClassFilename($class, $namespace);
|
return $this->buildClassFilename($class, $namespace);
|
||||||
|
|
||||||
} elseif (! $modules->loadedAllEnabledModules()) {
|
} elseif (! $modules->loadedAllEnabledModules()) {
|
||||||
|
|
||||||
$moduleName = $this->extractModuleName($class);
|
$moduleName = $this->extractModuleName($class);
|
||||||
|
|
||||||
if ($modules->hasEnabled($moduleName)) {
|
if ($modules->hasEnabled($moduleName)) {
|
||||||
|
@ -140,7 +140,6 @@ class Cli extends ApplicationBootstrap
|
|||||||
} else {
|
} else {
|
||||||
$this->dispatchEndless();
|
$this->dispatchEndless();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function dispatchOnce()
|
protected function dispatchOnce()
|
||||||
|
@ -226,7 +226,6 @@ class Hook
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!$instance instanceof $base_class) {
|
if (!$instance instanceof $base_class) {
|
||||||
|
|
||||||
// This is a compatibility check. Should be removed one far day:
|
// This is a compatibility check. Should be removed one far day:
|
||||||
if ($module !== null) {
|
if ($module !== null) {
|
||||||
$compat_class = 'Icinga\\Module\\'
|
$compat_class = 'Icinga\\Module\\'
|
||||||
|
@ -143,7 +143,6 @@ class Manager
|
|||||||
if (($dh = opendir($this->enableDir)) !== false) {
|
if (($dh = opendir($this->enableDir)) !== false) {
|
||||||
$this->enabledDirs = array();
|
$this->enabledDirs = array();
|
||||||
while (($file = readdir($dh)) !== false) {
|
while (($file = readdir($dh)) !== false) {
|
||||||
|
|
||||||
if ($file[0] === '.' || $file === 'README') {
|
if ($file[0] === '.' || $file === 'README') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -660,7 +660,6 @@ class Module
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (file_exists($this->metadataFile)) {
|
if (file_exists($this->metadataFile)) {
|
||||||
|
|
||||||
$key = null;
|
$key = null;
|
||||||
$file = new File($this->metadataFile, 'r');
|
$file = new File($this->metadataFile, 'r');
|
||||||
foreach ($file as $line) {
|
foreach ($file as $line) {
|
||||||
@ -682,7 +681,6 @@ class Module
|
|||||||
$key = lcfirst($key);
|
$key = lcfirst($key);
|
||||||
|
|
||||||
switch ($key) {
|
switch ($key) {
|
||||||
|
|
||||||
case 'depends':
|
case 'depends':
|
||||||
if (strpos($val, ' ') === false) {
|
if (strpos($val, ' ') === false) {
|
||||||
$metadata->depends[$val] = true;
|
$metadata->depends[$val] = true;
|
||||||
@ -710,7 +708,6 @@ class Module
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
$metadata->{$key} = $val;
|
$metadata->{$key} = $val;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,8 @@ class Platform
|
|||||||
|
|
||||||
foreach (array('/etc/os-release', '/usr/lib/os-release') as $osReleaseFile) {
|
foreach (array('/etc/os-release', '/usr/lib/os-release') as $osReleaseFile) {
|
||||||
if (false === ($osRelease = @file(
|
if (false === ($osRelease = @file(
|
||||||
$osReleaseFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES
|
$osReleaseFile,
|
||||||
|
FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES
|
||||||
))) {
|
))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -51,12 +51,10 @@ $special = array(
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (in_array($path, $special)) {
|
if (in_array($path, $special)) {
|
||||||
|
|
||||||
include_once __DIR__ . '/EmbeddedWeb.php';
|
include_once __DIR__ . '/EmbeddedWeb.php';
|
||||||
EmbeddedWeb::start();
|
EmbeddedWeb::start();
|
||||||
|
|
||||||
switch ($path) {
|
switch ($path) {
|
||||||
|
|
||||||
case 'css/icinga.css':
|
case 'css/icinga.css':
|
||||||
Stylesheet::send();
|
Stylesheet::send();
|
||||||
exit;
|
exit;
|
||||||
@ -79,7 +77,6 @@ if (in_array($path, $special)) {
|
|||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
} elseif ($path === 'svg/chart.php') {
|
} elseif ($path === 'svg/chart.php') {
|
||||||
if (!array_key_exists('data', $_GET)) {
|
if (!array_key_exists('data', $_GET)) {
|
||||||
return false;
|
return false;
|
||||||
@ -90,7 +87,6 @@ if (in_array($path, $special)) {
|
|||||||
$pie = new PieChart();
|
$pie = new PieChart();
|
||||||
$pie->initFromRequest();
|
$pie->initFromRequest();
|
||||||
$pie->toSvg();
|
$pie->toSvg();
|
||||||
|
|
||||||
} elseif ($path === 'png/chart.php') {
|
} elseif ($path === 'png/chart.php') {
|
||||||
if (!array_key_exists('data', $_GET)) {
|
if (!array_key_exists('data', $_GET)) {
|
||||||
return false;
|
return false;
|
||||||
@ -101,11 +97,9 @@ if (in_array($path, $special)) {
|
|||||||
$pie = new PieChart();
|
$pie = new PieChart();
|
||||||
$pie->initFromRequest();
|
$pie->initFromRequest();
|
||||||
$pie->toPng();
|
$pie->toPng();
|
||||||
|
|
||||||
} elseif (file_exists($baseDir . '/' . $path) && is_file($baseDir . '/' . $path)) {
|
} elseif (file_exists($baseDir . '/' . $path) && is_file($baseDir . '/' . $path)) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
include __DIR__ . '/Web.php';
|
include __DIR__ . '/Web.php';
|
||||||
Web::start()->dispatch();
|
Web::start()->dispatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,7 +242,9 @@ class AuthChain implements Authenticatable, Iterator
|
|||||||
} catch (ConfigurationError $e) {
|
} catch (ConfigurationError $e) {
|
||||||
Logger::error(
|
Logger::error(
|
||||||
new ConfigurationError(
|
new ConfigurationError(
|
||||||
'Can\'t create authentication backend "%s". An exception was thrown:', $name, $e
|
'Can\'t create authentication backend "%s". An exception was thrown:',
|
||||||
|
$name,
|
||||||
|
$e
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$this->next();
|
$this->next();
|
||||||
|
@ -713,8 +713,7 @@ class LdapUserGroupBackend extends LdapRepository implements UserGroupBackendInt
|
|||||||
throw new ConfigurationError('User backend "%s" is not of type LDAP', $config->user_backend);
|
throw new ConfigurationError('User backend "%s" is not of type LDAP', $config->user_backend);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if ($this->ds->getHostname() !== $userBackend->getDataSource()->getHostname()
|
||||||
$this->ds->getHostname() !== $userBackend->getDataSource()->getHostname()
|
|
||||||
|| $this->ds->getPort() !== $userBackend->getDataSource()->getPort()
|
|| $this->ds->getPort() !== $userBackend->getDataSource()->getPort()
|
||||||
) {
|
) {
|
||||||
// TODO(jom): Elaborate whether it makes sense to link directories on different hosts
|
// TODO(jom): Elaborate whether it makes sense to link directories on different hosts
|
||||||
|
@ -184,7 +184,6 @@ class Axis implements Drawable
|
|||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
foreach ($this->xUnit as $label => $pos) {
|
foreach ($this->xUnit as $label => $pos) {
|
||||||
|
|
||||||
if ($i % $ticks === 0) {
|
if ($i % $ticks === 0) {
|
||||||
/*
|
/*
|
||||||
$tick = new Line($pos, 100, $pos, 101);
|
$tick = new Line($pos, 100, $pos, 101);
|
||||||
|
@ -95,13 +95,13 @@ class BarGraph extends Styleable implements Drawable
|
|||||||
* Draw a single rectangle
|
* Draw a single rectangle
|
||||||
*
|
*
|
||||||
* @param array $point The
|
* @param array $point The
|
||||||
* @param null $index
|
|
||||||
* @param string $fill The fill color to use
|
* @param string $fill The fill color to use
|
||||||
* @param $strokeWidth
|
* @param $strokeWidth
|
||||||
|
* @param null $index
|
||||||
*
|
*
|
||||||
* @return Rect
|
* @return Rect
|
||||||
*/
|
*/
|
||||||
private function drawSingleBar($point, $index = null, $fill, $strokeWidth)
|
private function drawSingleBar($point, $fill, $strokeWidth, $index = null)
|
||||||
{
|
{
|
||||||
$rect = new Rect($point[0] - ($this->barWidth / 2), $point[1], $this->barWidth, 100 - $point[1]);
|
$rect = new Rect($point[0] - ($this->barWidth / 2), $point[1], $this->barWidth, 100 - $point[1]);
|
||||||
$rect->setFill($fill);
|
$rect->setFill($fill);
|
||||||
@ -137,11 +137,11 @@ class BarGraph extends Styleable implements Drawable
|
|||||||
|
|
||||||
foreach ($this->dataSet as $x => $point) {
|
foreach ($this->dataSet as $x => $point) {
|
||||||
// add white background bar, to prevent other bars from altering transparency effects
|
// add white background bar, to prevent other bars from altering transparency effects
|
||||||
$bar = $this->drawSingleBar($point, $idx++, 'white', $this->strokeWidth, $idx)->toSvg($ctx);
|
$bar = $this->drawSingleBar($point, 'white', $this->strokeWidth, $idx++)->toSvg($ctx);
|
||||||
$group->appendChild($bar);
|
$group->appendChild($bar);
|
||||||
|
|
||||||
// draw actual bar
|
// draw actual bar
|
||||||
$bar = $this->drawSingleBar($point, null, $this->fill, $this->strokeWidth, $idx)->toSvg($ctx);
|
$bar = $this->drawSingleBar($point, $this->fill, $this->strokeWidth)->toSvg($ctx);
|
||||||
$bar->setAttribute('class', 'chart-data');
|
$bar->setAttribute('class', 'chart-data');
|
||||||
if (isset($this->tooltips[$x])) {
|
if (isset($this->tooltips[$x])) {
|
||||||
$data = array(
|
$data = array(
|
||||||
|
@ -163,7 +163,6 @@ class LineGraph extends Styleable implements Drawable
|
|||||||
$group = $path->toSvg($ctx);
|
$group = $path->toSvg($ctx);
|
||||||
|
|
||||||
foreach ($this->dataset as $x => $point) {
|
foreach ($this->dataset as $x => $point) {
|
||||||
|
|
||||||
if ($this->showDataPoints === true) {
|
if ($this->showDataPoints === true) {
|
||||||
$dot = new Circle($point[0], $point[1], $this->dotWith);
|
$dot = new Circle($point[0], $point[1], $this->dotWith);
|
||||||
$dot->setFill($this->strokeColor);
|
$dot->setFill($this->strokeColor);
|
||||||
|
@ -200,7 +200,6 @@ class GridChart extends Chart
|
|||||||
'color' => $graph['color'],
|
'color' => $graph['color'],
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$this->tooltips[$x]->addDataPoint($point);
|
$this->tooltips[$x]->addDataPoint($point);
|
||||||
|
@ -92,6 +92,5 @@ class Inline
|
|||||||
if (array_key_exists('height', $_GET)) {
|
if (array_key_exists('height', $_GET)) {
|
||||||
$this->height = (int)$_GET['height'];
|
$this->height = (int)$_GET['height'];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -208,7 +208,6 @@ class PieChart extends Chart
|
|||||||
if (!$this->noCaption && isset($pie['labels'])) {
|
if (!$this->noCaption && isset($pie['labels'])) {
|
||||||
$slice->setCaption($pie['labels'][$labelPos++])
|
$slice->setCaption($pie['labels'][$labelPos++])
|
||||||
->setLabelGroup($labelBox);
|
->setLabelGroup($labelBox);
|
||||||
|
|
||||||
}
|
}
|
||||||
$lastRadius += $dataset;
|
$lastRadius += $dataset;
|
||||||
}
|
}
|
||||||
@ -305,4 +304,3 @@ class PieChart extends Chart
|
|||||||
$clipBox->addElement($rect);
|
$clipBox->addElement($rect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
namespace Icinga\Chart\Primitive;
|
namespace Icinga\Chart\Primitive;
|
||||||
|
|
||||||
|
|
||||||
use DOMElement;
|
use DOMElement;
|
||||||
use Icinga\Chart\Render\RenderContext;
|
use Icinga\Chart\Render\RenderContext;
|
||||||
use Icinga\Chart\Format;
|
use Icinga\Chart\Format;
|
||||||
|
@ -53,7 +53,7 @@ class LogarithmicUnit implements AxisUnit
|
|||||||
* @param int $nrOfTicks The number of ticks to use
|
* @param int $nrOfTicks The number of ticks to use
|
||||||
*/
|
*/
|
||||||
public function __construct($base = 10)
|
public function __construct($base = 10)
|
||||||
{;
|
{
|
||||||
$this->base = $base;
|
$this->base = $base;
|
||||||
$this->minExp = PHP_INT_MAX;
|
$this->minExp = PHP_INT_MAX;
|
||||||
$this->maxExp = ~PHP_INT_MAX;
|
$this->maxExp = ~PHP_INT_MAX;
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
namespace Icinga\Chart\Unit;
|
namespace Icinga\Chart\Unit;
|
||||||
|
|
||||||
|
|
||||||
class StaticAxis implements AxisUnit
|
class StaticAxis implements AxisUnit
|
||||||
{
|
{
|
||||||
private $items = array();
|
private $items = array();
|
||||||
|
@ -34,7 +34,6 @@ class CommentParser
|
|||||||
$plain = preg_replace('~\n\s*\*/\s*~s', "\n", $plain);
|
$plain = preg_replace('~\n\s*\*/\s*~s', "\n", $plain);
|
||||||
$p = null;
|
$p = null;
|
||||||
foreach (preg_split('~\n~', $plain) as $line) {
|
foreach (preg_split('~\n~', $plain) as $line) {
|
||||||
|
|
||||||
// Strip * at line start
|
// Strip * at line start
|
||||||
$line = preg_replace('~^\s*\*\s?~', '', $line);
|
$line = preg_replace('~^\s*\*\s?~', '', $line);
|
||||||
$line = rtrim($line);
|
$line = rtrim($line);
|
||||||
|
@ -49,7 +49,9 @@ class Params
|
|||||||
$key = substr($argv[$i], 2);
|
$key = substr($argv[$i], 2);
|
||||||
$matches = array();
|
$matches = array();
|
||||||
if (1 === preg_match(
|
if (1 === preg_match(
|
||||||
'/(?<!.)([^=]+)=(.*)(?!.)/ms', $key, $matches
|
'/(?<!.)([^=]+)=(.*)(?!.)/ms',
|
||||||
|
$key,
|
||||||
|
$matches
|
||||||
)) {
|
)) {
|
||||||
$this->params[$matches[1]] = $matches[2];
|
$this->params[$matches[1]] = $matches[2];
|
||||||
} elseif (! isset($argv[$i + 1]) || substr($argv[$i + 1], 0, 2) === '--') {
|
} elseif (! isset($argv[$i + 1]) || substr($argv[$i + 1], 0, 2) === '--') {
|
||||||
|
@ -3,4 +3,6 @@
|
|||||||
|
|
||||||
namespace Icinga\Data;
|
namespace Icinga\Data;
|
||||||
|
|
||||||
interface ConnectionInterface extends Selectable, Queryable {};
|
interface ConnectionInterface extends Selectable, Queryable
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@ -143,13 +143,20 @@ abstract class Filter
|
|||||||
public static function expression($col, $op, $expression)
|
public static function expression($col, $op, $expression)
|
||||||
{
|
{
|
||||||
switch ($op) {
|
switch ($op) {
|
||||||
case '=': return new FilterMatch($col, $op, $expression);
|
case '=':
|
||||||
case '<': return new FilterLessThan($col, $op, $expression);
|
return new FilterMatch($col, $op, $expression);
|
||||||
case '>': return new FilterGreaterThan($col, $op, $expression);
|
case '<':
|
||||||
case '>=': return new FilterEqualOrGreaterThan($col, $op, $expression);
|
return new FilterLessThan($col, $op, $expression);
|
||||||
case '<=': return new FilterEqualOrLessThan($col, $op, $expression);
|
case '>':
|
||||||
case '!=': return new FilterMatchNot($col, $op, $expression);
|
return new FilterGreaterThan($col, $op, $expression);
|
||||||
default: throw new ProgrammingError(
|
case '>=':
|
||||||
|
return new FilterEqualOrGreaterThan($col, $op, $expression);
|
||||||
|
case '<=':
|
||||||
|
return new FilterEqualOrLessThan($col, $op, $expression);
|
||||||
|
case '!=':
|
||||||
|
return new FilterMatchNot($col, $op, $expression);
|
||||||
|
default:
|
||||||
|
throw new ProgrammingError(
|
||||||
'There is no such filter sign: %s',
|
'There is no such filter sign: %s',
|
||||||
$op
|
$op
|
||||||
);
|
);
|
||||||
@ -213,9 +220,12 @@ abstract class Filter
|
|||||||
public static function chain($operator, $filters = array())
|
public static function chain($operator, $filters = array())
|
||||||
{
|
{
|
||||||
switch ($operator) {
|
switch ($operator) {
|
||||||
case 'AND': return self::matchAll($filters);
|
case 'AND':
|
||||||
case 'OR' : return self::matchAny($filters);
|
return self::matchAll($filters);
|
||||||
case 'NOT': return self::not($filters);
|
case 'OR':
|
||||||
|
return self::matchAny($filters);
|
||||||
|
case 'NOT':
|
||||||
|
return self::not($filters);
|
||||||
}
|
}
|
||||||
throw new ProgrammingError(
|
throw new ProgrammingError(
|
||||||
'"%s" is not a valid filter chain operator',
|
'"%s" is not a valid filter chain operator',
|
||||||
|
@ -10,4 +10,6 @@ use Icinga\Exception\IcingaException;
|
|||||||
*
|
*
|
||||||
* Filter Exceptions should be thrown on filter parse errors or similar
|
* Filter Exceptions should be thrown on filter parse errors or similar
|
||||||
*/
|
*/
|
||||||
class FilterException extends IcingaException {}
|
class FilterException extends IcingaException
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@ -5,7 +5,8 @@ namespace Icinga\Data\Filter;
|
|||||||
|
|
||||||
class FilterMatchCaseInsensitive extends FilterMatch
|
class FilterMatchCaseInsensitive extends FilterMatch
|
||||||
{
|
{
|
||||||
public function __construct($column, $sign, $expression) {
|
public function __construct($column, $sign, $expression)
|
||||||
|
{
|
||||||
parent::__construct($column, $sign, $expression);
|
parent::__construct($column, $sign, $expression);
|
||||||
$this->caseSensitive = false;
|
$this->caseSensitive = false;
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,8 @@ namespace Icinga\Data\Filter;
|
|||||||
|
|
||||||
class FilterMatchNotCaseInsensitive extends FilterMatchNot
|
class FilterMatchNotCaseInsensitive extends FilterMatchNot
|
||||||
{
|
{
|
||||||
public function __construct($column, $sign, $expression) {
|
public function __construct($column, $sign, $expression)
|
||||||
|
{
|
||||||
parent::__construct($column, $sign, $expression);
|
parent::__construct($column, $sign, $expression);
|
||||||
$this->caseSensitive = false;
|
$this->caseSensitive = false;
|
||||||
}
|
}
|
||||||
|
@ -21,8 +21,17 @@ class FilterQueryString
|
|||||||
|
|
||||||
protected function debug($msg, $level = 0, $op = null)
|
protected function debug($msg, $level = 0, $op = null)
|
||||||
{
|
{
|
||||||
if ($op === null) $op = 'NULL';
|
if ($op === null) {
|
||||||
$this->debug[] = sprintf('%s[%d=%s] (%s): %s', str_repeat('* ', $level), $this->pos, $this->string[$this->pos - 1], $op, $msg);
|
$op = 'NULL';
|
||||||
|
}
|
||||||
|
$this->debug[] = sprintf(
|
||||||
|
'%s[%d=%s] (%s): %s',
|
||||||
|
str_repeat('* ', $level),
|
||||||
|
$this->pos,
|
||||||
|
$this->string[$this->pos - 1],
|
||||||
|
$op,
|
||||||
|
$msg
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function parse($string)
|
public static function parse($string)
|
||||||
@ -63,7 +72,9 @@ class FilterQueryString
|
|||||||
|
|
||||||
foreach (array('<', '>') as $sign) {
|
foreach (array('<', '>') as $sign) {
|
||||||
if (false !== ($pos = strpos($key, $sign))) {
|
if (false !== ($pos = strpos($key, $sign))) {
|
||||||
if ($this->nextChar() === '=') break;
|
if ($this->nextChar() === '=') {
|
||||||
|
break;
|
||||||
|
}
|
||||||
$var = substr($key, $pos + 1);
|
$var = substr($key, $pos + 1);
|
||||||
$key = substr($key, 0, $pos);
|
$key = substr($key, 0, $pos);
|
||||||
return Filter::expression($key, $sign, $var);
|
return Filter::expression($key, $sign, $var);
|
||||||
@ -123,7 +134,6 @@ class FilterQueryString
|
|||||||
{
|
{
|
||||||
$filters = array();
|
$filters = array();
|
||||||
while ($this->pos < $this->length) {
|
while ($this->pos < $this->length) {
|
||||||
|
|
||||||
if ($op === '!' && count($filters) === 1) {
|
if ($op === '!' && count($filters) === 1) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -132,7 +142,6 @@ class FilterQueryString
|
|||||||
|
|
||||||
|
|
||||||
if ($filter === false) {
|
if ($filter === false) {
|
||||||
|
|
||||||
$this->debug('Got no next expression, next is ' . $next, $nestingLevel, $op);
|
$this->debug('Got no next expression, next is ' . $next, $nestingLevel, $op);
|
||||||
if ($next === '!') {
|
if ($next === '!') {
|
||||||
$not = $this->readFilters($nestingLevel + 1, '!');
|
$not = $this->readFilters($nestingLevel + 1, '!');
|
||||||
@ -171,7 +180,6 @@ class FilterQueryString
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$this->parseError($next, "$op level $nestingLevel");
|
$this->parseError($next, "$op level $nestingLevel");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$this->debug('Got new expression: ' . $filter, $nestingLevel, $op);
|
$this->debug('Got new expression: ' . $filter, $nestingLevel, $op);
|
||||||
|
|
||||||
@ -225,11 +233,16 @@ class FilterQueryString
|
|||||||
$this->debug(sprintf('Got %d filters, returning', count($filters)), $nestingLevel, $op);
|
$this->debug(sprintf('Got %d filters, returning', count($filters)), $nestingLevel, $op);
|
||||||
|
|
||||||
switch ($op) {
|
switch ($op) {
|
||||||
case '&': return Filter::matchAll($filters);
|
case '&':
|
||||||
case '|': return Filter::matchAny($filters);
|
return Filter::matchAll($filters);
|
||||||
case '!': return Filter::not($filters);
|
case '|':
|
||||||
case null: return Filter::matchAll();
|
return Filter::matchAny($filters);
|
||||||
default: $this->parseError($op);
|
case '!':
|
||||||
|
return Filter::not($filters);
|
||||||
|
case null:
|
||||||
|
return Filter::matchAll();
|
||||||
|
default:
|
||||||
|
$this->parseError($op);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,5 +5,6 @@ namespace Icinga\Data;
|
|||||||
|
|
||||||
use Countable;
|
use Countable;
|
||||||
|
|
||||||
interface Paginatable extends Limitable, Countable {};
|
interface Paginatable extends Limitable, Countable
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@ -341,8 +341,7 @@ class PivotTable implements Sortable
|
|||||||
*/
|
*/
|
||||||
public function toArray()
|
public function toArray()
|
||||||
{
|
{
|
||||||
if (
|
if (($this->xAxisFilter === null && $this->yAxisFilter === null)
|
||||||
($this->xAxisFilter === null && $this->yAxisFilter === null)
|
|
||||||
|| ($this->xAxisFilter !== null && $this->yAxisFilter !== null)
|
|| ($this->xAxisFilter !== null && $this->yAxisFilter !== null)
|
||||||
) {
|
) {
|
||||||
$xAxis = $this->queryXAxis()->fetchPairs();
|
$xAxis = $this->queryXAxis()->fetchPairs();
|
||||||
|
@ -3,4 +3,6 @@
|
|||||||
|
|
||||||
namespace Icinga\Data;
|
namespace Icinga\Data;
|
||||||
|
|
||||||
interface QueryInterface extends Fetchable, Filterable, Paginatable, Sortable {};
|
interface QueryInterface extends Fetchable, Filterable, Paginatable, Sortable
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@ -131,7 +131,9 @@ class SimpleQuery implements QueryInterface, Queryable, Iterator
|
|||||||
* Overwrite this instead of __construct (it's called at the end of the construct) to
|
* Overwrite this instead of __construct (it's called at the end of the construct) to
|
||||||
* implement custom initialization logic on construction time
|
* implement custom initialization logic on construction time
|
||||||
*/
|
*/
|
||||||
protected function init() {}
|
protected function init()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the data source
|
* Get the data source
|
||||||
|
@ -6,4 +6,6 @@ namespace Icinga\Exception;
|
|||||||
/**
|
/**
|
||||||
* Exception thrown if a property does not exist
|
* Exception thrown if a property does not exist
|
||||||
*/
|
*/
|
||||||
class InvalidPropertyException extends IcingaException {}
|
class InvalidPropertyException extends IcingaException
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@ -9,7 +9,9 @@ class Csv
|
|||||||
{
|
{
|
||||||
protected $query;
|
protected $query;
|
||||||
|
|
||||||
protected function __construct() {}
|
protected function __construct()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public static function fromQuery(Traversable $query)
|
public static function fromQuery(Traversable $query)
|
||||||
{
|
{
|
||||||
|
@ -37,7 +37,11 @@ class Pdf
|
|||||||
$layout->content = $controller->getResponse();
|
$layout->content = $controller->getResponse();
|
||||||
$html = $layout->render();
|
$html = $layout->render();
|
||||||
$imgDir = Url::fromPath('img');
|
$imgDir = Url::fromPath('img');
|
||||||
$html = preg_replace('~src="' . $imgDir . '/~', 'src="' . Icinga::app()->getBootstrapDirectory() . '/img/', $html);
|
$html = preg_replace(
|
||||||
|
'~src="' . $imgDir . '/~',
|
||||||
|
'src="' . Icinga::app()->getBootstrapDirectory() . '/img/',
|
||||||
|
$html
|
||||||
|
);
|
||||||
$options = new Options();
|
$options = new Options();
|
||||||
$options->set('defaultPaperSize', 'A4');
|
$options->set('defaultPaperSize', 'A4');
|
||||||
$dompdf = new Dompdf($options);
|
$dompdf = new Dompdf($options);
|
||||||
|
@ -7,4 +7,6 @@ use Icinga\Exception\IcingaException;
|
|||||||
/**
|
/**
|
||||||
* Exception thrown if a file reader specific error occurs
|
* Exception thrown if a file reader specific error occurs
|
||||||
*/
|
*/
|
||||||
class FileReaderException extends IcingaException {}
|
class FileReaderException extends IcingaException
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@ -33,7 +33,8 @@ class FileQuery extends SimpleQuery
|
|||||||
* Nothing to do here
|
* Nothing to do here
|
||||||
*/
|
*/
|
||||||
public function applyFilter(Filter $filter)
|
public function applyFilter(Filter $filter)
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sort query result chronological
|
* Sort query result chronological
|
||||||
|
@ -112,7 +112,8 @@ class LogFileIterator implements Iterator
|
|||||||
$this->valid = null;
|
$this->valid = null;
|
||||||
while ($this->file->valid()) {
|
while ($this->file->valid()) {
|
||||||
if (false === ($res = preg_match(
|
if (false === ($res = preg_match(
|
||||||
$this->fields, $current = $this->file->current()
|
$this->fields,
|
||||||
|
$current = $this->file->current()
|
||||||
))) {
|
))) {
|
||||||
throw new IcingaException('Failed at preg_match()');
|
throw new IcingaException('Failed at preg_match()');
|
||||||
}
|
}
|
||||||
@ -139,7 +140,9 @@ class LogFileIterator implements Iterator
|
|||||||
while (! empty($message)) {
|
while (! empty($message)) {
|
||||||
$matches = array();
|
$matches = array();
|
||||||
if (false === ($res = preg_match(
|
if (false === ($res = preg_match(
|
||||||
$this->fields, implode(PHP_EOL, $message), $matches
|
$this->fields,
|
||||||
|
implode(PHP_EOL, $message),
|
||||||
|
$matches
|
||||||
))) {
|
))) {
|
||||||
throw new IcingaException('Failed at preg_match()');
|
throw new IcingaException('Failed at preg_match()');
|
||||||
}
|
}
|
||||||
|
@ -6,8 +6,8 @@ namespace Icinga\Protocol\Ldap;
|
|||||||
use Icinga\Data\ConfigObject;
|
use Icinga\Data\ConfigObject;
|
||||||
use Icinga\Protocol\Dns;
|
use Icinga\Protocol\Dns;
|
||||||
|
|
||||||
class Discovery {
|
class Discovery
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* @var LdapConnection
|
* @var LdapConnection
|
||||||
*/
|
*/
|
||||||
|
@ -944,8 +944,7 @@ class LdapConnection implements Selectable, Inspectable
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (
|
} while ((! $serverSorting || $limit === 0 || $limit !== count($entries))
|
||||||
(! $serverSorting || $limit === 0 || $limit !== count($entries))
|
|
||||||
&& ($entry = ldap_next_entry($ds, $entry))
|
&& ($entry = ldap_next_entry($ds, $entry))
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -1053,8 +1052,7 @@ class LdapConnection implements Selectable, Inspectable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if ($unfoldAttribute !== null
|
||||||
$unfoldAttribute !== null
|
|
||||||
&& isset($cleanedAttributes[$unfoldAttribute])
|
&& isset($cleanedAttributes[$unfoldAttribute])
|
||||||
&& is_array($cleanedAttributes[$unfoldAttribute])
|
&& is_array($cleanedAttributes[$unfoldAttribute])
|
||||||
) {
|
) {
|
||||||
@ -1110,7 +1108,6 @@ class LdapConnection implements Selectable, Inspectable
|
|||||||
if ($attributeOctets >= 127) {
|
if ($attributeOctets >= 127) {
|
||||||
// Use the indefinite form of the length octets (the long form would be another option)
|
// Use the indefinite form of the length octets (the long form would be another option)
|
||||||
$attributeType = '0440' . $attributeType . '0000';
|
$attributeType = '0440' . $attributeType . '0000';
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$attributeType = '04' . str_pad(dechex($attributeOctets), 2, '0', STR_PAD_LEFT) . $attributeType;
|
$attributeType = '04' . str_pad(dechex($attributeOctets), 2, '0', STR_PAD_LEFT) . $attributeType;
|
||||||
}
|
}
|
||||||
@ -1177,7 +1174,6 @@ class LdapConnection implements Selectable, Inspectable
|
|||||||
if (! ldap_start_tls($ds)) {
|
if (! ldap_start_tls($ds)) {
|
||||||
throw new LdapException('LDAP STARTTLS failed: %s', ldap_error($ds));
|
throw new LdapException('LDAP STARTTLS failed: %s', ldap_error($ds));
|
||||||
}
|
}
|
||||||
|
|
||||||
} elseif ($this->encryption !== static::LDAPS) {
|
} elseif ($this->encryption !== static::LDAPS) {
|
||||||
$this->encrypted = false;
|
$this->encrypted = false;
|
||||||
$info->write('Connect without encryption');
|
$info->write('Connect without encryption');
|
||||||
|
@ -284,11 +284,11 @@ class LdapQuery extends SimpleQuery
|
|||||||
if (! in_array($scope, static::$scopes)) {
|
if (! in_array($scope, static::$scopes)) {
|
||||||
throw new LogicException(
|
throw new LogicException(
|
||||||
'Can\'t set scope %d, it is is invalid. Use one of %s or LdapQuery\'s constants.',
|
'Can\'t set scope %d, it is is invalid. Use one of %s or LdapQuery\'s constants.',
|
||||||
$scope, implode(', ', static::$scopes)
|
$scope,
|
||||||
|
implode(', ', static::$scopes)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$this->scope = $scope;
|
$this->scope = $scope;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -197,7 +197,9 @@ class Connection
|
|||||||
while ($row = $this->fetchRowFromSocket()) {
|
while ($row = $this->fetchRowFromSocket()) {
|
||||||
$r = new ResponseRow($row, $query);
|
$r = new ResponseRow($row, $query);
|
||||||
$res = $query->resultRow($row);
|
$res = $query->resultRow($row);
|
||||||
if ($filter !== null && ! $filter->matches($res)) continue;
|
if ($filter !== null && ! $filter->matches($res)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
$result[] = $res;
|
$result[] = $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -282,13 +284,17 @@ class Connection
|
|||||||
$col = 0;
|
$col = 0;
|
||||||
while (false !== ($pos = strpos($line, self::FIELD_SEPARATOR, $start))) {
|
while (false !== ($pos = strpos($line, self::FIELD_SEPARATOR, $start))) {
|
||||||
// TODO: safety measure for not killing the SPL. To be removed once code is clean
|
// TODO: safety measure for not killing the SPL. To be removed once code is clean
|
||||||
if ($col > $size -1 ) return $res; // ???
|
if ($col > $size -1) {
|
||||||
|
return $res; // ???
|
||||||
|
}
|
||||||
$res[$col] = substr($line, $start, $pos - $start);
|
$res[$col] = substr($line, $start, $pos - $start);
|
||||||
$start = $pos + 1;
|
$start = $pos + 1;
|
||||||
$col++;
|
$col++;
|
||||||
}
|
}
|
||||||
// TODO: safety measure for not killing the SPL. To be removed once code is clean
|
// TODO: safety measure for not killing the SPL. To be removed once code is clean
|
||||||
if ($col > $size - 1) return $res;
|
if ($col > $size - 1) {
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
$res[$col] = rtrim(substr($line, $start), "\r\n");
|
$res[$col] = rtrim(substr($line, $start), "\r\n");
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
@ -421,8 +427,7 @@ if ($col > $size - 1) return $res;
|
|||||||
public function disconnect()
|
public function disconnect()
|
||||||
{
|
{
|
||||||
if (is_resource($this->connection)
|
if (is_resource($this->connection)
|
||||||
&& get_resource_type($this->connection) === 'Socket')
|
&& get_resource_type($this->connection) === 'Socket') {
|
||||||
{
|
|
||||||
Benchmark::measure('Disconnecting livestatus...');
|
Benchmark::measure('Disconnecting livestatus...');
|
||||||
socket_close($this->connection);
|
socket_close($this->connection);
|
||||||
Benchmark::measure('...socket closed');
|
Benchmark::measure('...socket closed');
|
||||||
|
@ -544,8 +544,7 @@ abstract class DbRepository extends Repository implements Extensible, Updatable,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (! ($query !== null && $this->validateQueryColumnAssociation($table, $name))
|
||||||
! ($query !== null && $this->validateQueryColumnAssociation($table, $name))
|
|
||||||
&& !($query === null && $this->validateStatementColumnAssociation($table, $name))
|
&& !($query === null && $this->validateStatementColumnAssociation($table, $name))
|
||||||
) {
|
) {
|
||||||
$table = $this->findTableName($name);
|
$table = $this->findTableName($name);
|
||||||
@ -620,8 +619,7 @@ abstract class DbRepository extends Repository implements Extensible, Updatable,
|
|||||||
public function reassembleQueryColumnAlias($table, $column)
|
public function reassembleQueryColumnAlias($table, $column)
|
||||||
{
|
{
|
||||||
$alias = parent::reassembleQueryColumnAlias($table, $column);
|
$alias = parent::reassembleQueryColumnAlias($table, $column);
|
||||||
if (
|
if ($alias === null
|
||||||
$alias === null
|
|
||||||
&& !$this->validateQueryColumnAssociation($table, $column)
|
&& !$this->validateQueryColumnAssociation($table, $column)
|
||||||
&& ($tableName = $this->findTableName($column))
|
&& ($tableName = $this->findTableName($column))
|
||||||
) {
|
) {
|
||||||
@ -836,8 +834,7 @@ abstract class DbRepository extends Repository implements Extensible, Updatable,
|
|||||||
*/
|
*/
|
||||||
public function hasStatementColumn($table, $name)
|
public function hasStatementColumn($table, $name)
|
||||||
{
|
{
|
||||||
if (
|
if (($this->resolveStatementColumnAlias($table, $name) === null
|
||||||
($this->resolveStatementColumnAlias($table, $name) === null
|
|
||||||
&& $this->reassembleStatementColumnAlias($table, $name) === null)
|
&& $this->reassembleStatementColumnAlias($table, $name) === null)
|
||||||
|| !$this->validateStatementColumnAssociation($table, $name)
|
|| !$this->validateStatementColumnAssociation($table, $name)
|
||||||
) {
|
) {
|
||||||
|
@ -235,7 +235,6 @@ abstract class Repository implements Selectable
|
|||||||
*/
|
*/
|
||||||
protected function init()
|
protected function init()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -937,8 +936,7 @@ abstract class Repository implements Selectable
|
|||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (($dateTime = DateTime::createFromFormat('YmdHis.uO', $value)) !== false
|
||||||
($dateTime = DateTime::createFromFormat('YmdHis.uO', $value)) !== false
|
|
||||||
|| ($dateTime = DateTime::createFromFormat('YmdHis.uZ', $value)) !== false
|
|| ($dateTime = DateTime::createFromFormat('YmdHis.uZ', $value)) !== false
|
||||||
|| ($dateTime = DateTime::createFromFormat('YmdHis.u', $value)) !== false
|
|| ($dateTime = DateTime::createFromFormat('YmdHis.u', $value)) !== false
|
||||||
|| ($dateTime = DateTime::createFromFormat('YmdHis', $value)) !== false
|
|| ($dateTime = DateTime::createFromFormat('YmdHis', $value)) !== false
|
||||||
|
@ -603,8 +603,7 @@ class RepositoryQuery implements QueryInterface, SortRules, FilterColumns, Itera
|
|||||||
$aliases[1] !== 1 ? $this->getNativeAlias($aliases[1]) : $columns[1]
|
$aliases[1] !== 1 ? $this->getNativeAlias($aliases[1]) : $columns[1]
|
||||||
);
|
);
|
||||||
|
|
||||||
if (
|
if ($this->repository->providesValueConversion($this->target, $colOne)
|
||||||
$this->repository->providesValueConversion($this->target, $colOne)
|
|
||||||
|| $this->repository->providesValueConversion($this->target, $colTwo)
|
|| $this->repository->providesValueConversion($this->target, $colTwo)
|
||||||
) {
|
) {
|
||||||
$newResults = array();
|
$newResults = array();
|
||||||
|
@ -152,7 +152,9 @@ namespace Icinga\Test {
|
|||||||
->shouldReceive('getBaseUrl')->andReturn('/')->byDefault()
|
->shouldReceive('getBaseUrl')->andReturn('/')->byDefault()
|
||||||
->shouldReceive('getQuery')->andReturn(array())->byDefault()
|
->shouldReceive('getQuery')->andReturn(array())->byDefault()
|
||||||
->shouldReceive('getParam')->with(Mockery::type('string'), Mockery::type('string'))
|
->shouldReceive('getParam')->with(Mockery::type('string'), Mockery::type('string'))
|
||||||
->andReturnUsing(function ($name, $default) { return $default; })->byDefault();
|
->andReturnUsing(function ($name, $default) {
|
||||||
|
return $default;
|
||||||
|
})->byDefault();
|
||||||
|
|
||||||
$responseMock = Mockery::mock('Icinga\Web\Response')->shouldDeferMissing();
|
$responseMock = Mockery::mock('Icinga\Web\Response')->shouldDeferMissing();
|
||||||
// Can't express this as demeter chains. See: https://github.com/padraic/mockery/issues/59
|
// Can't express this as demeter chains. See: https://github.com/padraic/mockery/issues/59
|
||||||
|
@ -74,7 +74,6 @@ class DbStore extends PreferencesStore
|
|||||||
*/
|
*/
|
||||||
protected function init()
|
protected function init()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -322,7 +322,13 @@ class ActionController extends Zend_Controller_Action
|
|||||||
*/
|
*/
|
||||||
public function translatePlural($textSingular, $textPlural, $number, $context = null)
|
public function translatePlural($textSingular, $textPlural, $number, $context = null)
|
||||||
{
|
{
|
||||||
return Translator::translatePlural($textSingular, $textPlural, $number, $this->view->translationDomain, $context);
|
return Translator::translatePlural(
|
||||||
|
$textSingular,
|
||||||
|
$textPlural,
|
||||||
|
$number,
|
||||||
|
$this->view->translationDomain,
|
||||||
|
$context
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function ignoreXhrBody()
|
protected function ignoreXhrBody()
|
||||||
|
@ -69,7 +69,6 @@ class FileCache
|
|||||||
public function store($file, $content)
|
public function store($file, $content)
|
||||||
{
|
{
|
||||||
if (! $this->enabled) {
|
if (! $this->enabled) {
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,26 +86,22 @@ class FileCache
|
|||||||
public function has($file, $newerThan = null)
|
public function has($file, $newerThan = null)
|
||||||
{
|
{
|
||||||
if (! $this->enabled) {
|
if (! $this->enabled) {
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$filename = $this->filename($file);
|
$filename = $this->filename($file);
|
||||||
|
|
||||||
if (! file_exists($filename) || ! is_readable($filename)) {
|
if (! file_exists($filename) || ! is_readable($filename)) {
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($newerThan === null) {
|
if ($newerThan === null) {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$info = stat($file);
|
$info = stat($file);
|
||||||
|
|
||||||
if ($info === false) {
|
if ($info === false) {
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -805,7 +805,6 @@ class Form extends Zend_Form
|
|||||||
*/
|
*/
|
||||||
public function createElements(array $formData)
|
public function createElements(array $formData)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -827,7 +826,6 @@ class Form extends Zend_Form
|
|||||||
*/
|
*/
|
||||||
public function onRequest()
|
public function onRequest()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1108,8 +1106,7 @@ class Form extends Zend_Form
|
|||||||
protected function preserveDefaults(Zend_Form $form, array & $defaults)
|
protected function preserveDefaults(Zend_Form $form, array & $defaults)
|
||||||
{
|
{
|
||||||
foreach ($form->getElements() as $name => $_) {
|
foreach ($form->getElements() as $name => $_) {
|
||||||
if (
|
if (array_key_exists($name, $defaults)
|
||||||
array_key_exists($name, $defaults)
|
|
||||||
&& array_key_exists($name . static::DEFAULT_SUFFIX, $defaults)
|
&& array_key_exists($name . static::DEFAULT_SUFFIX, $defaults)
|
||||||
&& $defaults[$name] === $defaults[$name . static::DEFAULT_SUFFIX]
|
&& $defaults[$name] === $defaults[$name . static::DEFAULT_SUFFIX]
|
||||||
) {
|
) {
|
||||||
@ -1243,8 +1240,7 @@ class Form extends Zend_Form
|
|||||||
// Ensure that disabled elements are not overwritten
|
// Ensure that disabled elements are not overwritten
|
||||||
// (http://www.zendframework.com/issues/browse/ZF-6909)
|
// (http://www.zendframework.com/issues/browse/ZF-6909)
|
||||||
$formData[$name] = $element->getValue();
|
$formData[$name] = $element->getValue();
|
||||||
} elseif (
|
} elseif (array_key_exists($name . static::DEFAULT_SUFFIX, $formData)
|
||||||
array_key_exists($name . static::DEFAULT_SUFFIX, $formData)
|
|
||||||
&& $formData[$name] === $formData[$name . static::DEFAULT_SUFFIX]
|
&& $formData[$name] === $formData[$name . static::DEFAULT_SUFFIX]
|
||||||
) {
|
) {
|
||||||
unset($formData[$name]);
|
unset($formData[$name]);
|
||||||
|
@ -103,7 +103,12 @@ class Autosubmit extends Zend_Form_Decorator_Abstract
|
|||||||
'class' => 'spinner autosubmit-info'
|
'class' => 'spinner autosubmit-info'
|
||||||
));
|
));
|
||||||
if (! $isForm && $this->getAccessible()) {
|
if (! $isForm && $this->getAccessible()) {
|
||||||
$content = '<span id="' . $this->getWarningId() . '" class="sr-only">' . $warning . '</span>' . $content;
|
$content = '<span id="'
|
||||||
|
. $this->getWarningId()
|
||||||
|
. '" class="sr-only">'
|
||||||
|
. $warning
|
||||||
|
. '</span>'
|
||||||
|
. $content;
|
||||||
}
|
}
|
||||||
|
|
||||||
$content .= sprintf(
|
$content .= sprintf(
|
||||||
|
@ -45,7 +45,8 @@ class DateTimePicker extends FormElement
|
|||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
$this->addValidator(
|
$this->addValidator(
|
||||||
new DateTimeValidator($this->local), true // true for breaking the validator chain on failure
|
new DateTimeValidator($this->local),
|
||||||
|
true // true for breaking the validator chain on failure
|
||||||
);
|
);
|
||||||
if ($this->min !== null) {
|
if ($this->min !== null) {
|
||||||
$this->addValidator('GreaterThan', true, array('min' => $this->min));
|
$this->addValidator('GreaterThan', true, array('min' => $this->min));
|
||||||
|
@ -10,4 +10,6 @@ use Icinga\Application\Hook\GrapherHook as BaseHook;
|
|||||||
*
|
*
|
||||||
* Please implement hooks in Icinga\Application\Hook
|
* Please implement hooks in Icinga\Application\Hook
|
||||||
*/
|
*/
|
||||||
abstract class GrapherHook extends BaseHook {}
|
abstract class GrapherHook extends BaseHook
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@ -10,4 +10,6 @@ use Icinga\Application\Hook\TicketHook as BaseHook;
|
|||||||
*
|
*
|
||||||
* Please implement hooks in Icinga\Application\Hook
|
* Please implement hooks in Icinga\Application\Hook
|
||||||
*/
|
*/
|
||||||
abstract class TicketHook extends BaseHook {}
|
abstract class TicketHook extends BaseHook
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@ -80,7 +80,9 @@ class MenuItemRenderer
|
|||||||
'<a href="%s"%s>%s%s<span></span></a>',
|
'<a href="%s"%s>%s%s<span></span></a>',
|
||||||
$menu->getUrl() ? : '#',
|
$menu->getUrl() ? : '#',
|
||||||
$attributes,
|
$attributes,
|
||||||
$menu->getIcon() ? '<img aria-hidden="true" src="' . Url::fromPath($menu->getIcon()) . '" class="icon" /> ' : '',
|
$menu->getIcon()
|
||||||
|
? '<img aria-hidden="true" src="' . Url::fromPath($menu->getIcon()) . '" class="icon" /> '
|
||||||
|
: '',
|
||||||
$this->getView()->escape($menu->getTitle())
|
$this->getView()->escape($menu->getTitle())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -182,8 +182,12 @@ class MenuRenderer extends RecursiveIteratorIterator
|
|||||||
*/
|
*/
|
||||||
protected function isActive(Menu $child)
|
protected function isActive(Menu $child)
|
||||||
{
|
{
|
||||||
if (! $this->url) return false;
|
if (! $this->url) {
|
||||||
if (! ($childUrl = $child->getUrl())) return false;
|
return false;
|
||||||
|
}
|
||||||
|
if (! ($childUrl = $child->getUrl())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return $this->url && $this->url->matches($childUrl);
|
return $this->url && $this->url->matches($childUrl);
|
||||||
}
|
}
|
||||||
|
@ -18,4 +18,3 @@ class DropdownItem extends NavigationItem
|
|||||||
$this->children->setLayout(Navigation::LAYOUT_DROPDOWN);
|
$this->children->setLayout(Navigation::LAYOUT_DROPDOWN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,7 +153,6 @@ class NavigationItem implements IteratorAggregate
|
|||||||
*/
|
*/
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -63,7 +63,6 @@ class NavigationItemRenderer
|
|||||||
*/
|
*/
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -69,7 +69,6 @@ class Icinga_Web_Paginator_ScrollingStyle_SlidingWithBorder implements Zend_Pagi
|
|||||||
foreach (array($pageCount - 1, $pageCount) as $i) {
|
foreach (array($pageCount - 1, $pageCount) as $i) {
|
||||||
$range[$i] = $i;
|
$range[$i] = $i;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (empty($range)) {
|
if (empty($range)) {
|
||||||
$range[] = 1;
|
$range[] = 1;
|
||||||
|
@ -32,7 +32,8 @@ abstract class Session extends SessionNamespace
|
|||||||
/**
|
/**
|
||||||
* Persists changes to the underlying session implementation
|
* Persists changes to the underlying session implementation
|
||||||
*/
|
*/
|
||||||
public function write() {
|
public function write()
|
||||||
|
{
|
||||||
throw new NotImplementedError('You are required to implement write() in your session implementation');
|
throw new NotImplementedError('You are required to implement write() in your session implementation');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,4 +13,3 @@ $this->addHelperFunction('auth', function () {
|
|||||||
$this->addHelperFunction('widget', function ($name, $options = null) {
|
$this->addHelperFunction('widget', function ($name, $options = null) {
|
||||||
return Widget::create($name, $options);
|
return Widget::create($name, $options);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -32,7 +32,9 @@ $this->addHelperFunction('url', function ($path = null, $params = null) {
|
|||||||
return $url;
|
return $url;
|
||||||
});
|
});
|
||||||
|
|
||||||
$this->addHelperFunction('qlink', function ($title, $url, $params = null, $properties = null, $escape = true) use ($view) {
|
$this->addHelperFunction(
|
||||||
|
'qlink',
|
||||||
|
function ($title, $url, $params = null, $properties = null, $escape = true) use ($view) {
|
||||||
$icon = '';
|
$icon = '';
|
||||||
if ($properties) {
|
if ($properties) {
|
||||||
if (array_key_exists('title', $properties) && !array_key_exists('aria-label', $properties)) {
|
if (array_key_exists('title', $properties) && !array_key_exists('aria-label', $properties)) {
|
||||||
@ -56,7 +58,8 @@ $this->addHelperFunction('qlink', function ($title, $url, $params = null, $prope
|
|||||||
$view->propertiesToString($properties),
|
$view->propertiesToString($properties),
|
||||||
$icon . ($escape ? $view->escape($title) : $title)
|
$icon . ($escape ? $view->escape($title) : $title)
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
$this->addHelperFunction('img', function ($url, $params = null, array $properties = array()) use ($view) {
|
$this->addHelperFunction('img', function ($url, $params = null, array $properties = array()) use ($view) {
|
||||||
if (! array_key_exists('alt', $properties)) {
|
if (! array_key_exists('alt', $properties)) {
|
||||||
@ -153,4 +156,3 @@ $this->addHelperFunction('attributeToString', function ($key, $value) use ($view
|
|||||||
$view->escape($value)
|
$view->escape($value)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -12,8 +12,8 @@ use Icinga\Web\Widget\AbstractWidget;
|
|||||||
* Display a colored grid that visualizes a set of values for each day
|
* Display a colored grid that visualizes a set of values for each day
|
||||||
* on a given time-frame.
|
* on a given time-frame.
|
||||||
*/
|
*/
|
||||||
class HistoryColorGrid extends AbstractWidget {
|
class HistoryColorGrid extends AbstractWidget
|
||||||
|
{
|
||||||
const CAL_GROW_INTO_PAST = 'past';
|
const CAL_GROW_INTO_PAST = 'past';
|
||||||
const CAL_GROW_INTO_PRESENT = 'present';
|
const CAL_GROW_INTO_PRESENT = 'present';
|
||||||
|
|
||||||
@ -32,7 +32,8 @@ class HistoryColorGrid extends AbstractWidget {
|
|||||||
private $color;
|
private $color;
|
||||||
public $opacity = 1.0;
|
public $opacity = 1.0;
|
||||||
|
|
||||||
public function __construct($color = '#51e551', $start = null, $end = null) {
|
public function __construct($color = '#51e551', $start = null, $end = null)
|
||||||
|
{
|
||||||
$this->setColor($color);
|
$this->setColor($color);
|
||||||
if (isset($start)) {
|
if (isset($start)) {
|
||||||
$this->start = $this->tsToDateStr($start);
|
$this->start = $this->tsToDateStr($start);
|
||||||
|
@ -153,7 +153,6 @@ class Dashboard extends AbstractWidget
|
|||||||
if ((bool) $part->get('disabled', false) === true) {
|
if ((bool) $part->get('disabled', false) === true) {
|
||||||
$panes[$key]->setDisabled();
|
$panes[$key]->setDisabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
list($paneName, $dashletName) = explode('.', $key, 2);
|
list($paneName, $dashletName) = explode('.', $key, 2);
|
||||||
$part->pane = $paneName;
|
$part->pane = $paneName;
|
||||||
|
@ -323,6 +323,4 @@ class Pane extends UserWidget
|
|||||||
{
|
{
|
||||||
return $this->disabled;
|
return $this->disabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -509,7 +509,6 @@ class FilterEditor extends AbstractWidget
|
|||||||
. $this->removeLink($filter)
|
. $this->removeLink($filter)
|
||||||
. $this->addLink($filter)
|
. $this->addLink($filter)
|
||||||
;
|
;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -770,7 +769,10 @@ class FilterEditor extends AbstractWidget
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
if (! $this->preservedUrl()->getParam('modifyFilter')) {
|
if (! $this->preservedUrl()->getParam('modifyFilter')) {
|
||||||
return '<div class="filter">' . $this->renderSearch() . $this->view()->escape($this->shorten($this->filter, 50)) . '</div>';
|
return '<div class="filter">'
|
||||||
|
. $this->renderSearch()
|
||||||
|
. $this->view()->escape($this->shorten($this->filter, 50))
|
||||||
|
. '</div>';
|
||||||
}
|
}
|
||||||
return '<div class="filter">'
|
return '<div class="filter">'
|
||||||
. $this->renderSearch()
|
. $this->renderSearch()
|
||||||
|
@ -156,7 +156,6 @@ class Paginator extends AbstractWidget
|
|||||||
foreach (array($pageCount - 1, $pageCount) as $i) {
|
foreach (array($pageCount - 1, $pageCount) as $i) {
|
||||||
$range[$i] = $i;
|
$range[$i] = $i;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($range)) {
|
if (empty($range)) {
|
||||||
|
@ -79,7 +79,6 @@ class Wizard
|
|||||||
*/
|
*/
|
||||||
protected function init()
|
protected function init()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -245,7 +244,6 @@ class Wizard
|
|||||||
*/
|
*/
|
||||||
public function setupPage(Form $page, Request $request)
|
public function setupPage(Form $page, Request $request)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -430,8 +428,7 @@ class Wizard
|
|||||||
if (! $this->hasPageData($requestedPage) && ($index = array_search($page, $pages, true)) > 0) {
|
if (! $this->hasPageData($requestedPage) && ($index = array_search($page, $pages, true)) > 0) {
|
||||||
$previousPage = $pages[$index - 1];
|
$previousPage = $pages[$index - 1];
|
||||||
if ($originPage === null || ($previousPage->getName() !== $originPage->getName()
|
if ($originPage === null || ($previousPage->getName() !== $originPage->getName()
|
||||||
&& array_search($originPage, $pages, true) < $index))
|
&& array_search($originPage, $pages, true) < $index)) {
|
||||||
{
|
|
||||||
$permitted = $this->hasPageData($previousPage->getName());
|
$permitted = $this->hasPageData($previousPage->getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,6 @@ class ModuleController extends DocController
|
|||||||
'title' => $this->translate('Module Documentation', 'Tab title'),
|
'title' => $this->translate('Module Documentation', 'Tab title'),
|
||||||
'url' => Url::fromRequest()
|
'url' => Url::fromRequest()
|
||||||
));
|
));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -90,8 +90,7 @@ class DocParser
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
$headerStyle = static::HEADER_ATX;
|
$headerStyle = static::HEADER_ATX;
|
||||||
} elseif (
|
} elseif ($nextLine
|
||||||
$nextLine
|
|
||||||
&& ($nextLine[0] === '=' || $nextLine[0] === '-')
|
&& ($nextLine[0] === '=' || $nextLine[0] === '-')
|
||||||
&& preg_match('/^[=-]+\s*$/', $nextLine, $match) === 1
|
&& preg_match('/^[=-]+\s*$/', $nextLine, $match) === 1
|
||||||
) {
|
) {
|
||||||
|
@ -65,7 +65,8 @@ class DocSectionRenderer extends DocRenderer
|
|||||||
$filter = new DocSectionFilterIterator($tree->getIterator(), $chapter);
|
$filter = new DocSectionFilterIterator($tree->getIterator(), $chapter);
|
||||||
if ($filter->isEmpty()) {
|
if ($filter->isEmpty()) {
|
||||||
throw new ChapterNotFoundException(
|
throw new ChapterNotFoundException(
|
||||||
mt('doc', 'Chapter %s not found'), $chapter
|
mt('doc', 'Chapter %s not found'),
|
||||||
|
$chapter
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
parent::__construct(
|
parent::__construct(
|
||||||
|
@ -336,6 +336,4 @@ class ListCommand extends Command
|
|||||||
$last = $circle;
|
$last = $circle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,4 +56,3 @@ class NrpeCommand extends Command
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Icinga Web 2 | (c) 2015 Icinga Development Team | GPLv2+ */
|
/* Icinga Web 2 | (c) 2015 Icinga Development Team | GPLv2+ */
|
||||||
|
|
||||||
|
namespace Icinga\Module\Monitoring\Controllers;
|
||||||
|
|
||||||
use Icinga\Data\Filter\Filter;
|
use Icinga\Data\Filter\Filter;
|
||||||
use Icinga\Module\Monitoring\Controller;
|
use Icinga\Module\Monitoring\Controller;
|
||||||
use Icinga\Module\Monitoring\Forms\Command\Object\DeleteDowntimesCommandForm;
|
use Icinga\Module\Monitoring\Forms\Command\Object\DeleteDowntimesCommandForm;
|
||||||
@ -12,7 +14,7 @@ use Icinga\Module\Monitoring\Object\ServiceList;
|
|||||||
/**
|
/**
|
||||||
* Monitoring API
|
* Monitoring API
|
||||||
*/
|
*/
|
||||||
class Monitoring_ActionsController extends Controller
|
class ActionsController extends Controller
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get the filter from URL parameters or exit immediately if the filter is empty
|
* Get the filter from URL parameters or exit immediately if the filter is empty
|
||||||
|
@ -638,7 +638,7 @@ class AlertsummaryController extends Controller
|
|||||||
case '1d':
|
case '1d':
|
||||||
return $this->translate('Hour');
|
return $this->translate('Hour');
|
||||||
break;
|
break;
|
||||||
case '1w';
|
case '1w':
|
||||||
return $this->translate('Day');
|
return $this->translate('Day');
|
||||||
break;
|
break;
|
||||||
case '1m':
|
case '1m':
|
||||||
|
@ -149,7 +149,8 @@ class HostsController extends Controller
|
|||||||
->toQueryString()
|
->toQueryString()
|
||||||
);
|
);
|
||||||
$this->view->commentsLink = Url::fromRequest()->setPath('monitoring/list/comments');
|
$this->view->commentsLink = Url::fromRequest()->setPath('monitoring/list/comments');
|
||||||
$this->view->sendCustomNotificationLink = Url::fromRequest()->setPath('monitoring/hosts/send-custom-notification');
|
$this->view->sendCustomNotificationLink = Url::fromRequest()
|
||||||
|
->setPath('monitoring/hosts/send-custom-notification');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -27,7 +27,9 @@ class ServiceController extends MonitoredObjectController
|
|||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
$service = new Service(
|
$service = new Service(
|
||||||
$this->backend, $this->params->getRequired('host'), $this->params->getRequired('service')
|
$this->backend,
|
||||||
|
$this->params->getRequired('host'),
|
||||||
|
$this->params->getRequired('service')
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->applyRestriction('monitoring/filter/objects', $service);
|
$this->applyRestriction('monitoring/filter/objects', $service);
|
||||||
|
@ -37,7 +37,8 @@ class TimelineController extends Controller
|
|||||||
$timeline = new TimeLine(
|
$timeline = new TimeLine(
|
||||||
$this->applyRestriction(
|
$this->applyRestriction(
|
||||||
'monitoring/filter/objects',
|
'monitoring/filter/objects',
|
||||||
$this->backend->select()->from('eventhistory',
|
$this->backend->select()->from(
|
||||||
|
'eventhistory',
|
||||||
array(
|
array(
|
||||||
'name' => 'type',
|
'name' => 'type',
|
||||||
'time' => 'timestamp'
|
'time' => 'timestamp'
|
||||||
@ -119,8 +120,7 @@ class TimelineController extends Controller
|
|||||||
*/
|
*/
|
||||||
private function getTimelineInterval()
|
private function getTimelineInterval()
|
||||||
{
|
{
|
||||||
switch ($this->view->intervalBox->getInterval())
|
switch ($this->view->intervalBox->getInterval()) {
|
||||||
{
|
|
||||||
case '1d':
|
case '1d':
|
||||||
return new DateInterval('P1D');
|
return new DateInterval('P1D');
|
||||||
case '1w':
|
case '1w':
|
||||||
@ -141,8 +141,7 @@ class TimelineController extends Controller
|
|||||||
*/
|
*/
|
||||||
private function getIntervalFormat()
|
private function getIntervalFormat()
|
||||||
{
|
{
|
||||||
switch ($this->view->intervalBox->getInterval())
|
switch ($this->view->intervalBox->getInterval()) {
|
||||||
{
|
|
||||||
case '1d':
|
case '1d':
|
||||||
return $this->getDateFormat();
|
return $this->getDateFormat();
|
||||||
case '1w':
|
case '1w':
|
||||||
@ -165,8 +164,7 @@ class TimelineController extends Controller
|
|||||||
*/
|
*/
|
||||||
private function getPreloadInterval(DateTime $dateTime)
|
private function getPreloadInterval(DateTime $dateTime)
|
||||||
{
|
{
|
||||||
switch ($this->view->intervalBox->getInterval())
|
switch ($this->view->intervalBox->getInterval()) {
|
||||||
{
|
|
||||||
case '1d':
|
case '1d':
|
||||||
return DateInterval::createFromDateString('1 week -1 second');
|
return DateInterval::createFromDateString('1 week -1 second');
|
||||||
case '1w':
|
case '1w':
|
||||||
@ -195,8 +193,7 @@ class TimelineController extends Controller
|
|||||||
*/
|
*/
|
||||||
private function extrapolateDateTime(DateTime &$dateTime)
|
private function extrapolateDateTime(DateTime &$dateTime)
|
||||||
{
|
{
|
||||||
switch ($this->view->intervalBox->getInterval())
|
switch ($this->view->intervalBox->getInterval()) {
|
||||||
{
|
|
||||||
case '1d':
|
case '1d':
|
||||||
$dateTime->setTimestamp(strtotime('tomorrow', $dateTime->getTimestamp()) - 1);
|
$dateTime->setTimestamp(strtotime('tomorrow', $dateTime->getTimestamp()) - 1);
|
||||||
break;
|
break;
|
||||||
|
@ -65,7 +65,8 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm
|
|||||||
if ((bool) $this->status->notifications_enabled) {
|
if ((bool) $this->status->notifications_enabled) {
|
||||||
if ($this->hasPermission('monitoring/command/feature/instance')) {
|
if ($this->hasPermission('monitoring/command/feature/instance')) {
|
||||||
$notificationDescription = sprintf(
|
$notificationDescription = sprintf(
|
||||||
'<a aria-label="%1$s" class="action-link" title="%1$s" href="%2$s" data-base-target="_next">%3$s</a>',
|
'<a aria-label="%1$s" class="action-link" title="%1$s"'
|
||||||
|
. ' href="%2$s" data-base-target="_next">%3$s</a>',
|
||||||
$this->translate('Disable notifications for a specific time on a program-wide basis'),
|
$this->translate('Disable notifications for a specific time on a program-wide basis'),
|
||||||
$this->getView()->href('monitoring/health/disable-notifications'),
|
$this->getView()->href('monitoring/health/disable-notifications'),
|
||||||
$this->translate('Disable temporarily')
|
$this->translate('Disable temporarily')
|
||||||
|
@ -28,7 +28,9 @@ class ProcessCheckResultCommandForm extends ObjectsCommandForm
|
|||||||
public function getSubmitLabel()
|
public function getSubmitLabel()
|
||||||
{
|
{
|
||||||
return $this->translatePlural(
|
return $this->translatePlural(
|
||||||
'Submit Passive Check Result', 'Submit Passive Check Results', count($this->objects)
|
'Submit Passive Check Result',
|
||||||
|
'Submit Passive Check Results',
|
||||||
|
count($this->objects)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,7 +94,6 @@ class RemoteTransportForm extends Form
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($useResource) {
|
if ($useResource) {
|
||||||
|
|
||||||
$this->loadResources();
|
$this->loadResources();
|
||||||
|
|
||||||
$decorators = static::$defaultElementDecorators;
|
$decorators = static::$defaultElementDecorators;
|
||||||
|
@ -79,7 +79,7 @@ class TransportConfigForm extends ConfigForm
|
|||||||
switch (strtolower($type)) {
|
switch (strtolower($type)) {
|
||||||
case LocalCommandFile::TRANSPORT:
|
case LocalCommandFile::TRANSPORT:
|
||||||
return new LocalTransportForm();
|
return new LocalTransportForm();
|
||||||
case RemoteCommandFile::TRANSPORT;
|
case RemoteCommandFile::TRANSPORT:
|
||||||
return new RemoteTransportForm();
|
return new RemoteTransportForm();
|
||||||
case ApiCommandTransport::TRANSPORT:
|
case ApiCommandTransport::TRANSPORT:
|
||||||
return new ApiTransportForm();
|
return new ApiTransportForm();
|
||||||
|
@ -148,8 +148,7 @@ class IdoResourcePage extends Form
|
|||||||
}
|
}
|
||||||
|
|
||||||
$configObject = new ConfigObject($this->getValues());
|
$configObject = new ConfigObject($this->getValues());
|
||||||
if (
|
if (! BackendConfigForm::isValidIdoSchema($this, $configObject)
|
||||||
! BackendConfigForm::isValidIdoSchema($this, $configObject)
|
|
||||||
|| !BackendConfigForm::isValidIdoInstance($this, $configObject)
|
|| !BackendConfigForm::isValidIdoInstance($this, $configObject)
|
||||||
) {
|
) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -18,7 +18,9 @@ class WelcomePage extends Form
|
|||||||
'note',
|
'note',
|
||||||
'welcome',
|
'welcome',
|
||||||
array(
|
array(
|
||||||
'value' => $this->translate('Welcome to the configuration of the monitoring module for Icinga Web 2!'),
|
'value' => $this->translate(
|
||||||
|
'Welcome to the configuration of the monitoring module for Icinga Web 2!'
|
||||||
|
),
|
||||||
'decorators' => array(
|
'decorators' => array(
|
||||||
'ViewHelper',
|
'ViewHelper',
|
||||||
array('HtmlTag', array('tag' => 'h2'))
|
array('HtmlTag', array('tag' => 'h2'))
|
||||||
|
@ -3,13 +3,15 @@
|
|||||||
|
|
||||||
class Zend_View_Helper_ContactFlags extends Zend_View_Helper_Abstract
|
class Zend_View_Helper_ContactFlags extends Zend_View_Helper_Abstract
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the human readable flag name for the given contact notification option
|
* Get the human readable flag name for the given contact notification option
|
||||||
*
|
*
|
||||||
* @param string $tableName the name of the option table
|
* @param string $tableName The name of the option table
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getNotificationOptionName($tableName) {
|
public function getNotificationOptionName($tableName)
|
||||||
|
{
|
||||||
$exploded = explode('_', $tableName);
|
$exploded = explode('_', $tableName);
|
||||||
$name = end($exploded);
|
$name = end($exploded);
|
||||||
return ucfirst($name);
|
return ucfirst($name);
|
||||||
@ -26,14 +28,13 @@ class Zend_View_Helper_ContactFlags extends Zend_View_Helper_Abstract
|
|||||||
*/
|
*/
|
||||||
public function contactFlags($contact, $type, $glue = ', ')
|
public function contactFlags($contact, $type, $glue = ', ')
|
||||||
{
|
{
|
||||||
|
|
||||||
$optionName = 'contact_' . $type . '_notification_options';
|
$optionName = 'contact_' . $type . '_notification_options';
|
||||||
if (isset($contact->$optionName)) {
|
if (isset($contact->$optionName)) {
|
||||||
return $contact->$optionName;
|
return $contact->$optionName;
|
||||||
}
|
}
|
||||||
$out = array();
|
$out = array();
|
||||||
foreach ($contact as $key => $value) {
|
foreach ($contact as $key => $value) {
|
||||||
if (preg_match('/^contact_notify_' . $type . '_.*/', $key) && $value == True) {
|
if (preg_match('/^contact_notify_' . $type . '_.*/', $key) && $value == true) {
|
||||||
$option = $this->getNotificationOptionName($key);
|
$option = $this->getNotificationOptionName($key);
|
||||||
if (strtolower($option) != 'timeperiod') {
|
if (strtolower($option) != 'timeperiod') {
|
||||||
array_push($out, $option);
|
array_push($out, $option);
|
||||||
@ -43,4 +44,3 @@ class Zend_View_Helper_ContactFlags extends Zend_View_Helper_Abstract
|
|||||||
return implode($glue, $out);
|
return implode($glue, $out);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,6 +55,4 @@ class Zend_View_Helper_Customvar extends Zend_View_Helper_Abstract
|
|||||||
}
|
}
|
||||||
return $out . "</ul>}";
|
return $out . "</ul>}";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,8 +206,7 @@ class HostnotificationQuery extends IdoQuery
|
|||||||
{
|
{
|
||||||
$group = array();
|
$group = array();
|
||||||
|
|
||||||
if (
|
if ($this->hasJoinedVirtualTable('history')
|
||||||
$this->hasJoinedVirtualTable('history')
|
|
||||||
|| $this->hasJoinedVirtualTable('services')
|
|| $this->hasJoinedVirtualTable('services')
|
||||||
|| $this->hasJoinedVirtualTable('hostgroups')
|
|| $this->hasJoinedVirtualTable('hostgroups')
|
||||||
) {
|
) {
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user