Swag: Fix swag (aka a whole bunch of code style issues..)
This commit is contained in:
parent
91a315764c
commit
181e2ef05c
|
@ -26,7 +26,7 @@ class WebCommand extends Command
|
||||||
|
|
||||||
// TODO: Sanity check!!
|
// TODO: Sanity check!!
|
||||||
if ($socket === null) {
|
if ($socket === null) {
|
||||||
$socket = $this->Config()->get('standalone','listen','0.0.0.0:80');
|
$socket = $this->Config()->get('standalone', 'listen', '0.0.0.0:80');
|
||||||
}
|
}
|
||||||
if ($documentRoot === null) {
|
if ($documentRoot === null) {
|
||||||
$documentRoot = Icinga::app()->getBaseDir('public');
|
$documentRoot = Icinga::app()->getBaseDir('public');
|
||||||
|
@ -68,7 +68,7 @@ class WebCommand extends Command
|
||||||
$pid = pcntl_fork();
|
$pid = pcntl_fork();
|
||||||
if ($pid == -1) {
|
if ($pid == -1) {
|
||||||
throw new IcingaException('Could not fork');
|
throw new IcingaException('Could not fork');
|
||||||
} else if ($pid) {
|
} elseif ($pid) {
|
||||||
echo $this->screen->colorize('[OK]')
|
echo $this->screen->colorize('[OK]')
|
||||||
. " Icinga Web server forked successfully\n";
|
. " Icinga Web server forked successfully\n";
|
||||||
fclose(STDIN);
|
fclose(STDIN);
|
||||||
|
|
|
@ -181,7 +181,7 @@ class DashboardController extends ActionController
|
||||||
try {
|
try {
|
||||||
$dashboardConfig->saveIni();
|
$dashboardConfig->saveIni();
|
||||||
Notification::success(t('Dashlet has been removed from') . ' ' . $pane->getTitle());
|
Notification::success(t('Dashlet has been removed from') . ' ' . $pane->getTitle());
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$action->view->error = $e;
|
$action->view->error = $e;
|
||||||
$action->view->config = $dashboardConfig;
|
$action->view->config = $dashboardConfig;
|
||||||
$action->render('error');
|
$action->render('error');
|
||||||
|
@ -217,7 +217,7 @@ class DashboardController extends ActionController
|
||||||
try {
|
try {
|
||||||
$dashboardConfig->saveIni();
|
$dashboardConfig->saveIni();
|
||||||
Notification::success(t('Dashboard has been removed') . ': ' . $pane->getTitle());
|
Notification::success(t('Dashboard has been removed') . ': ' . $pane->getTitle());
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$action->view->error = $e;
|
$action->view->error = $e;
|
||||||
$action->view->config = $dashboardConfig;
|
$action->view->config = $dashboardConfig;
|
||||||
$action->render('error');
|
$action->render('error');
|
||||||
|
|
|
@ -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();
|
||||||
|
|
|
@ -62,7 +62,7 @@ class NavigationItemForm extends Form
|
||||||
'Callback',
|
'Callback',
|
||||||
false,
|
false,
|
||||||
array(
|
array(
|
||||||
'callback' => function($url) {
|
'callback' => function ($url) {
|
||||||
// Matches if the given url contains obviously
|
// Matches if the given url contains obviously
|
||||||
// a username but not any protocol identifier
|
// a username but not any protocol identifier
|
||||||
return !preg_match('#^((?=[^/@]).)+@.*$#', $url);
|
return !preg_match('#^((?=[^/@]).)+@.*$#', $url);
|
||||||
|
|
|
@ -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)) {
|
||||||
|
|
|
@ -483,7 +483,7 @@ abstract class ApplicationBootstrap
|
||||||
// Error was suppressed with the @-operator
|
// Error was suppressed with the @-operator
|
||||||
return false; // Continue with the normal error handler
|
return false; // Continue with the normal error handler
|
||||||
}
|
}
|
||||||
switch($errno) {
|
switch ($errno) {
|
||||||
case E_NOTICE:
|
case E_NOTICE:
|
||||||
case E_WARNING:
|
case E_WARNING:
|
||||||
case E_STRICT:
|
case E_STRICT:
|
||||||
|
@ -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\\'
|
||||||
|
|
|
@ -93,7 +93,7 @@ abstract class TicketHook
|
||||||
|
|
||||||
// Remove preg_offset from match for the ticket pattern
|
// Remove preg_offset from match for the ticket pattern
|
||||||
$carry = array();
|
$carry = array();
|
||||||
array_walk($match, function ($value, $key) use (&$carry) {
|
array_walk($match, function ($value, $key) use (&$carry) {
|
||||||
$carry[$key] = $value[0];
|
$carry[$key] = $value[0];
|
||||||
}, $carry);
|
}, $carry);
|
||||||
$ticketPattern->setMatch($carry);
|
$ticketPattern->setMatch($carry);
|
||||||
|
|
|
@ -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);
|
||||||
|
@ -280,7 +279,7 @@ class Axis implements Drawable
|
||||||
if ($this->yLabel || $this->xLabel) {
|
if ($this->yLabel || $this->xLabel) {
|
||||||
if ($this->yLabel && $this->xLabel) {
|
if ($this->yLabel && $this->xLabel) {
|
||||||
$txt = $this->yLabel . ' / ' . $this->xLabel;
|
$txt = $this->yLabel . ' / ' . $this->xLabel;
|
||||||
} else if ($this->xLabel) {
|
} elseif ($this->xLabel) {
|
||||||
$txt = $this->xLabel;
|
$txt = $this->xLabel;
|
||||||
} else {
|
} else {
|
||||||
$txt = $this->yLabel;
|
$txt = $this->yLabel;
|
||||||
|
|
|
@ -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(
|
||||||
|
|
|
@ -162,40 +162,39 @@ class LineGraph extends Styleable implements Drawable
|
||||||
$path->setId($this->id);
|
$path->setId($this->id);
|
||||||
$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);
|
$group->appendChild($dot->toSvg($ctx));
|
||||||
$group->appendChild($dot->toSvg($ctx));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Draw invisible circle for tooltip hovering
|
|
||||||
$invisible = new Circle($point[0], $point[1], 20);
|
|
||||||
$invisible->setFill($this->strokeColor);
|
|
||||||
$invisible->setAdditionalStyle('opacity: 0.0;');
|
|
||||||
$invisible->setAttribute('class', 'chart-data');
|
|
||||||
if (isset($this->tooltips[$x])) {
|
|
||||||
$data = array(
|
|
||||||
'label' => isset($this->graphs[$this->order]['label']) ?
|
|
||||||
strtolower($this->graphs[$this->order]['label']) : '',
|
|
||||||
'color' => isset($this->graphs[$this->order]['color']) ?
|
|
||||||
strtolower($this->graphs[$this->order]['color']) : '#fff'
|
|
||||||
);
|
|
||||||
$format = isset($this->graphs[$this->order]['tooltip'])
|
|
||||||
? $this->graphs[$this->order]['tooltip'] : null;
|
|
||||||
$invisible->setAttribute(
|
|
||||||
'title',
|
|
||||||
$this->tooltips[$x]->renderNoHtml($this->order, $data, $format)
|
|
||||||
);
|
|
||||||
$invisible->setAttribute(
|
|
||||||
'data-title-rich',
|
|
||||||
$this->tooltips[$x]->render($this->order, $data, $format)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
$group->appendChild($invisible->toSvg($ctx));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Draw invisible circle for tooltip hovering
|
||||||
|
$invisible = new Circle($point[0], $point[1], 20);
|
||||||
|
$invisible->setFill($this->strokeColor);
|
||||||
|
$invisible->setAdditionalStyle('opacity: 0.0;');
|
||||||
|
$invisible->setAttribute('class', 'chart-data');
|
||||||
|
if (isset($this->tooltips[$x])) {
|
||||||
|
$data = array(
|
||||||
|
'label' => isset($this->graphs[$this->order]['label']) ?
|
||||||
|
strtolower($this->graphs[$this->order]['label']) : '',
|
||||||
|
'color' => isset($this->graphs[$this->order]['color']) ?
|
||||||
|
strtolower($this->graphs[$this->order]['color']) : '#fff'
|
||||||
|
);
|
||||||
|
$format = isset($this->graphs[$this->order]['tooltip'])
|
||||||
|
? $this->graphs[$this->order]['tooltip'] : null;
|
||||||
|
$invisible->setAttribute(
|
||||||
|
'title',
|
||||||
|
$this->tooltips[$x]->renderNoHtml($this->order, $data, $format)
|
||||||
|
);
|
||||||
|
$invisible->setAttribute(
|
||||||
|
'data-title-rich',
|
||||||
|
$this->tooltips[$x]->render($this->order, $data, $format)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
$group->appendChild($invisible->toSvg($ctx));
|
||||||
|
}
|
||||||
|
|
||||||
return $group;
|
return $group;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ class Tooltip
|
||||||
* @param array $data Map of global properties
|
* @param array $data Map of global properties
|
||||||
* @param string $format The default format string
|
* @param string $format The default format string
|
||||||
*/
|
*/
|
||||||
public function __construct (
|
public function __construct(
|
||||||
$data = array(),
|
$data = array(),
|
||||||
$format = '<b>{title}</b>: {value} {label}'
|
$format = '<b>{title}</b>: {value} {label}'
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -193,14 +193,13 @@ class GridChart extends Chart
|
||||||
private function initTooltips($data)
|
private function initTooltips($data)
|
||||||
{
|
{
|
||||||
foreach ($data as &$graph) {
|
foreach ($data as &$graph) {
|
||||||
foreach ($graph['data'] as $x => $point) {
|
foreach ($graph['data'] as $x => $point) {
|
||||||
if (!array_key_exists($x, $this->tooltips)) {
|
if (!array_key_exists($x, $this->tooltips)) {
|
||||||
$this->tooltips[$x] = new Tooltip(
|
$this->tooltips[$x] = new Tooltip(
|
||||||
array(
|
array(
|
||||||
'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;
|
||||||
|
|
|
@ -161,7 +161,7 @@ class SVGRenderer
|
||||||
if ($this->preserveAspectRatio) {
|
if ($this->preserveAspectRatio) {
|
||||||
$svg->setAttribute(
|
$svg->setAttribute(
|
||||||
'preserveAspectRatio',
|
'preserveAspectRatio',
|
||||||
sprintf (
|
sprintf(
|
||||||
'%s%s %s',
|
'%s%s %s',
|
||||||
$this->xAspectRatio,
|
$this->xAspectRatio,
|
||||||
$this->yAspectRatio,
|
$this->yAspectRatio,
|
||||||
|
@ -182,12 +182,12 @@ class SVGRenderer
|
||||||
* @param $title The title text
|
* @param $title The title text
|
||||||
* @param $description The description text
|
* @param $description The description text
|
||||||
*/
|
*/
|
||||||
private function addAriaDescription (DOMNode $svg, $titleText, $descriptionText)
|
private function addAriaDescription(DOMNode $svg, $titleText, $descriptionText)
|
||||||
{
|
{
|
||||||
$doc = $svg->ownerDocument;
|
$doc = $svg->ownerDocument;
|
||||||
|
|
||||||
$titleId = $descId = '';
|
$titleId = $descId = '';
|
||||||
if (isset ($this->ariaTitle)) {
|
if (isset($this->ariaTitle)) {
|
||||||
$titleId = 'aria-title-' . $this->stripNonAlphanumeric($titleText);
|
$titleId = 'aria-title-' . $this->stripNonAlphanumeric($titleText);
|
||||||
$title = $doc->createElement('title');
|
$title = $doc->createElement('title');
|
||||||
$title->setAttribute('id', $titleId);
|
$title->setAttribute('id', $titleId);
|
||||||
|
@ -196,7 +196,7 @@ class SVGRenderer
|
||||||
$svg->appendChild($title);
|
$svg->appendChild($title);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset ($this->ariaDescription)) {
|
if (isset($this->ariaDescription)) {
|
||||||
$descId = 'aria-desc-' . $this->stripNonAlphanumeric($descriptionText);
|
$descId = 'aria-desc-' . $this->stripNonAlphanumeric($descriptionText);
|
||||||
$desc = $doc->createElement('desc');
|
$desc = $doc->createElement('desc');
|
||||||
$desc->setAttribute('id', $descId);
|
$desc->setAttribute('id', $descId);
|
||||||
|
|
|
@ -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,16 +143,23 @@ 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 '>=':
|
||||||
'There is no such filter sign: %s',
|
return new FilterEqualOrGreaterThan($col, $op, $expression);
|
||||||
$op
|
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',
|
||||||
|
$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();
|
||||||
|
@ -370,13 +369,13 @@ class PivotTable implements Sortable
|
||||||
if (! empty($xAxis) && ! empty($yAxis)) {
|
if (! empty($xAxis) && ! empty($yAxis)) {
|
||||||
$this->baseQuery
|
$this->baseQuery
|
||||||
->where($this->xAxisColumn, array_map(
|
->where($this->xAxisColumn, array_map(
|
||||||
function($key) {
|
function ($key) {
|
||||||
return (string) $key;
|
return (string) $key;
|
||||||
},
|
},
|
||||||
$xAxisKeys
|
$xAxisKeys
|
||||||
))
|
))
|
||||||
->where($this->yAxisColumn, array_map(
|
->where($this->yAxisColumn, array_map(
|
||||||
function($key) {
|
function ($key) {
|
||||||
return (string) $key;
|
return (string) $key;
|
||||||
},
|
},
|
||||||
$yAxisKeys
|
$yAxisKeys
|
||||||
|
|
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
|
@ -119,7 +119,7 @@ class Directive
|
||||||
public function render()
|
public function render()
|
||||||
{
|
{
|
||||||
$str = '';
|
$str = '';
|
||||||
if (! empty ($this->commentsPre)) {
|
if (! empty($this->commentsPre)) {
|
||||||
$comments = array();
|
$comments = array();
|
||||||
foreach ($this->commentsPre as $comment) {
|
foreach ($this->commentsPre as $comment) {
|
||||||
$comments[] = $comment->render();
|
$comments[] = $comment->render();
|
||||||
|
@ -127,7 +127,7 @@ class Directive
|
||||||
$str = implode(PHP_EOL, $comments) . PHP_EOL;
|
$str = implode(PHP_EOL, $comments) . PHP_EOL;
|
||||||
}
|
}
|
||||||
$str .= sprintf('%s = "%s"', $this->sanitizeKey($this->key), $this->sanitizeValue($this->value));
|
$str .= sprintf('%s = "%s"', $this->sanitizeKey($this->key), $this->sanitizeValue($this->value));
|
||||||
if (isset ($this->commentPost)) {
|
if (isset($this->commentPost)) {
|
||||||
$str .= ' ' . $this->commentPost->render();
|
$str .= ' ' . $this->commentPost->render();
|
||||||
}
|
}
|
||||||
return $str;
|
return $str;
|
||||||
|
|
|
@ -73,7 +73,7 @@ class Document
|
||||||
*/
|
*/
|
||||||
public function removeSection($name)
|
public function removeSection($name)
|
||||||
{
|
{
|
||||||
unset ($this->sections[trim($name)]);
|
unset($this->sections[trim($name)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -68,7 +68,7 @@ class Section
|
||||||
*/
|
*/
|
||||||
public function removeDirective($key)
|
public function removeDirective($key)
|
||||||
{
|
{
|
||||||
unset ($this->directives[$key]);
|
unset($this->directives[$key]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ class FileIterator extends EnumeratingFilterIterator
|
||||||
|
|
||||||
if ($matched === false) {
|
if ($matched === false) {
|
||||||
throw new FileReaderException('Failed parsing regular expression!');
|
throw new FileReaderException('Failed parsing regular expression!');
|
||||||
} else if ($matched === 1) {
|
} elseif ($matched === 1) {
|
||||||
foreach ($data as $key => $value) {
|
foreach ($data as $key => $value) {
|
||||||
if (is_int($key)) {
|
if (is_int($key)) {
|
||||||
unset($data[$key]);
|
unset($data[$key]);
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -132,7 +132,7 @@ class FileReader implements Selectable, Countable
|
||||||
$count = $this->count($query);
|
$count = $this->count($query);
|
||||||
if ($count <= $skip) {
|
if ($count <= $skip) {
|
||||||
return $lines;
|
return $lines;
|
||||||
} else if ($count < ($skip + $read)) {
|
} elseif ($count < ($skip + $read)) {
|
||||||
$read = $count - $skip;
|
$read = $count - $skip;
|
||||||
$skip = 0;
|
$skip = 0;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -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()');
|
||||||
}
|
}
|
||||||
|
@ -120,7 +121,7 @@ class LogFileIterator implements Iterator
|
||||||
if ($res === 1) {
|
if ($res === 1) {
|
||||||
$message[] = $current;
|
$message[] = $current;
|
||||||
}
|
}
|
||||||
} else if ($res === 1) {
|
} elseif ($res === 1) {
|
||||||
$this->next = $current;
|
$this->next = $current;
|
||||||
$this->valid = true;
|
$this->valid = true;
|
||||||
break;
|
break;
|
||||||
|
@ -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');
|
||||||
|
@ -1249,7 +1245,7 @@ class LdapConnection implements Selectable, Inspectable
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
switch($scope) {
|
switch ($scope) {
|
||||||
case LdapQuery::SCOPE_SUB:
|
case LdapQuery::SCOPE_SUB:
|
||||||
$function = 'ldap_search';
|
$function = 'ldap_search';
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,7 +125,7 @@ class Connection
|
||||||
*/
|
*/
|
||||||
public function count(Query $query)
|
public function count(Query $query)
|
||||||
{
|
{
|
||||||
return 100;
|
return 100;
|
||||||
$count = clone($query);
|
$count = clone($query);
|
||||||
// WTF? $count->count();
|
// WTF? $count->count();
|
||||||
Benchmark::measure('Sending Livestatus Count Query');
|
Benchmark::measure('Sending Livestatus Count Query');
|
||||||
|
@ -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');
|
||||||
|
|
|
@ -303,19 +303,19 @@ class Query extends SimpleQuery
|
||||||
}
|
}
|
||||||
foreach ($usedColumns as $col) {
|
foreach ($usedColumns as $col) {
|
||||||
// TODO: No alias if filter???
|
// TODO: No alias if filter???
|
||||||
if (array_key_exists($col, $this->available_columns)) {
|
if (array_key_exists($col, $this->available_columns)) {
|
||||||
// Alias if such
|
// Alias if such
|
||||||
$col = $this->available_columns[$col];
|
$col = $this->available_columns[$col];
|
||||||
}
|
}
|
||||||
if ($col[0] === '_') {
|
if ($col[0] === '_') {
|
||||||
$columns['custom_variables'] = true;
|
$columns['custom_variables'] = true;
|
||||||
} elseif (is_array($col)) {
|
} elseif (is_array($col)) {
|
||||||
foreach ($col as $k) {
|
foreach ($col as $k) {
|
||||||
$columns[$k] = true;
|
$columns[$k] = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$columns[$col] = true;
|
$columns[$col] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->preparedHeaders = array_keys($columns);
|
$this->preparedHeaders = array_keys($columns);
|
||||||
|
|
|
@ -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)
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -403,7 +403,7 @@ abstract class IniRepository extends Repository implements Extensible, Updatable
|
||||||
*
|
*
|
||||||
* @throws ProgrammingError In case no valid section name is available
|
* @throws ProgrammingError In case no valid section name is available
|
||||||
*/
|
*/
|
||||||
protected function extractSectionName( & $config, $keyColumn)
|
protected function extractSectionName(& $config, $keyColumn)
|
||||||
{
|
{
|
||||||
if (! is_array($config) && !$config instanceof ConfigObject) {
|
if (! is_array($config) && !$config instanceof ConfigObject) {
|
||||||
throw new ProgrammingError('$config is neither an array nor a ConfigObject');
|
throw new ProgrammingError('$config is neither an array nor a ConfigObject');
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -59,10 +59,10 @@ class ClassLoader
|
||||||
foreach ($this->namespaces as $namespace => $dir) {
|
foreach ($this->namespaces as $namespace => $dir) {
|
||||||
if ($class === strstr($class, $namespace)) {
|
if ($class === strstr($class, $namespace)) {
|
||||||
$classPath = str_replace(
|
$classPath = str_replace(
|
||||||
self::NAMESPACE_SEPARATOR,
|
self::NAMESPACE_SEPARATOR,
|
||||||
DIRECTORY_SEPARATOR,
|
DIRECTORY_SEPARATOR,
|
||||||
substr($class, strlen($namespace))
|
substr($class, strlen($namespace))
|
||||||
) . '.php';
|
) . '.php';
|
||||||
if (file_exists($file = $dir . $classPath)) {
|
if (file_exists($file = $dir . $classPath)) {
|
||||||
return $file;
|
return $file;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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,4 +45,4 @@ class Spinner extends Zend_Form_Decorator_Abstract
|
||||||
return $spinner . $content;
|
return $spinner . $content;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,7 +80,7 @@ class DashboardPane extends NavigationItem
|
||||||
*
|
*
|
||||||
* @param bool $disabled
|
* @param bool $disabled
|
||||||
*/
|
*/
|
||||||
public function setDisabled($disabled=true)
|
public function setDisabled($disabled = true)
|
||||||
{
|
{
|
||||||
$this->disabled = (bool) $disabled;
|
$this->disabled = (bool) $disabled;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -39,7 +39,7 @@ class Icinga_Web_Paginator_ScrollingStyle_SlidingWithBorder implements Zend_Pagi
|
||||||
foreach (array(1, 2) as $i) {
|
foreach (array(1, 2) as $i) {
|
||||||
$range[$i] = $i;
|
$range[$i] = $i;
|
||||||
}
|
}
|
||||||
if ($pageNumber < 6 ) {
|
if ($pageNumber < 6) {
|
||||||
// We are on page 1-5 from
|
// We are on page 1-5 from
|
||||||
for ($i = 1; $i <= 7; $i++) {
|
for ($i = 1; $i <= 7; $i++) {
|
||||||
$range[$i] = $i;
|
$range[$i] = $i;
|
||||||
|
@ -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);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -10,5 +10,5 @@ $this->addHelperFunction('ellipsis', function ($string, $maxLength, $ellipsis =
|
||||||
});
|
});
|
||||||
|
|
||||||
$this->addHelperFunction('nl2br', function ($string) {
|
$this->addHelperFunction('nl2br', function ($string) {
|
||||||
return nl2br(str_replace(array('\r\n', '\r', '\n'), '<br>', $string), false);
|
return nl2br(str_replace(array('\r\n', '\r', '\n'), '<br>', $string), false);
|
||||||
});
|
});
|
||||||
|
|
|
@ -32,31 +32,34 @@ $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(
|
||||||
$icon = '';
|
'qlink',
|
||||||
if ($properties) {
|
function ($title, $url, $params = null, $properties = null, $escape = true) use ($view) {
|
||||||
if (array_key_exists('title', $properties) && !array_key_exists('aria-label', $properties)) {
|
$icon = '';
|
||||||
$properties['aria-label'] = $properties['title'];
|
if ($properties) {
|
||||||
|
if (array_key_exists('title', $properties) && !array_key_exists('aria-label', $properties)) {
|
||||||
|
$properties['aria-label'] = $properties['title'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (array_key_exists('icon', $properties)) {
|
||||||
|
$icon = $view->icon($properties['icon']);
|
||||||
|
unset($properties['icon']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (array_key_exists('img', $properties)) {
|
||||||
|
$icon = $view->img($properties['img']);
|
||||||
|
unset($properties['img']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (array_key_exists('icon', $properties)) {
|
return sprintf(
|
||||||
$icon = $view->icon($properties['icon']);
|
'<a href="%s"%s>%s</a>',
|
||||||
unset($properties['icon']);
|
$view->url($url, $params),
|
||||||
}
|
$view->propertiesToString($properties),
|
||||||
|
$icon . ($escape ? $view->escape($title) : $title)
|
||||||
if (array_key_exists('img', $properties)) {
|
);
|
||||||
$icon = $view->img($properties['img']);
|
|
||||||
unset($properties['img']);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
);
|
||||||
return sprintf(
|
|
||||||
'<a href="%s"%s>%s</a>',
|
|
||||||
$view->url($url, $params),
|
|
||||||
$view->propertiesToString($properties),
|
|
||||||
$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;
|
||||||
|
@ -375,7 +374,7 @@ class Dashboard extends AbstractWidget
|
||||||
{
|
{
|
||||||
$active = null;
|
$active = null;
|
||||||
|
|
||||||
foreach ($this->panes as $key=>$pane) {
|
foreach ($this->panes as $key => $pane) {
|
||||||
if ($pane->getDisabled() === false) {
|
if ($pane->getDisabled() === false) {
|
||||||
$active = $key;
|
$active = $key;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -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)
|
||||||
;
|
;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -689,7 +688,7 @@ class FilterEditor extends AbstractWidget
|
||||||
$parent = $filter->getById($addTo);
|
$parent = $filter->getById($addTo);
|
||||||
$f = Filter::expression($add['column'], $add['sign'], $add['value']);
|
$f = Filter::expression($add['column'], $add['sign'], $add['value']);
|
||||||
if (isset($add['operator'])) {
|
if (isset($add['operator'])) {
|
||||||
switch($add['operator']) {
|
switch ($add['operator']) {
|
||||||
case 'AND':
|
case 'AND':
|
||||||
if ($parent->isExpression()) {
|
if ($parent->isExpression()) {
|
||||||
if ($parent->isRootNode()) {
|
if ($parent->isRootNode()) {
|
||||||
|
@ -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()
|
||||||
|
|
|
@ -42,9 +42,9 @@ class FilterWidget extends AbstractWidget
|
||||||
$url = Url::fromRequest();
|
$url = Url::fromRequest();
|
||||||
if ($filter instanceof FilterChain) {
|
if ($filter instanceof FilterChain) {
|
||||||
if ($level === 0) {
|
if ($level === 0) {
|
||||||
$op = '</li><li>)' . $filter->getOperatorName() . ' (';
|
$op = '</li><li>)' . $filter->getOperatorName() . ' (';
|
||||||
} else {
|
} else {
|
||||||
$op = '</li><li>) ' . $filter->getOperatorName() . ' ( ';
|
$op = '</li><li>) ' . $filter->getOperatorName() . ' ( ';
|
||||||
}
|
}
|
||||||
$parts = array();
|
$parts = array();
|
||||||
foreach ($filter->filters() as $f) {
|
foreach ($filter->filters() as $f) {
|
||||||
|
@ -85,7 +85,7 @@ class FilterWidget extends AbstractWidget
|
||||||
|
|
||||||
$editorUrl = clone $url;
|
$editorUrl = clone $url;
|
||||||
$editorUrl->setParam('modifyFilter', true);
|
$editorUrl->setParam('modifyFilter', true);
|
||||||
if ($this->filter->isEmpty()) {
|
if ($this->filter->isEmpty()) {
|
||||||
$title = t('Filter this list');
|
$title = t('Filter this list');
|
||||||
$txt = $view->icon('plus');
|
$txt = $view->icon('plus');
|
||||||
$remove = '';
|
$remove = '';
|
||||||
|
|
|
@ -124,7 +124,7 @@ class Paginator extends AbstractWidget
|
||||||
$range[$i] = $i;
|
$range[$i] = $i;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($currentPage < 6 ) {
|
if ($currentPage < 6) {
|
||||||
// We are on page 1-5 from
|
// We are on page 1-5 from
|
||||||
for ($i = 1; $i <= 7; $i++) {
|
for ($i = 1; $i <= 7; $i++) {
|
||||||
$range[$i] = $i;
|
$range[$i] = $i;
|
||||||
|
@ -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()
|
||||||
));
|
));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue