mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-04-08 17:15:08 +02:00
Fix coding style
This commit is contained in:
parent
25584f51a2
commit
68357e9ca2
@ -4,7 +4,6 @@ namespace Icinga\Clicommands;
|
||||
|
||||
use Icinga\Cli\Command;
|
||||
use Icinga\Cli\Loader;
|
||||
use Icinga\Cli\Documentation;
|
||||
|
||||
/**
|
||||
* Autocomplete for modules, commands and actions
|
||||
@ -22,11 +21,11 @@ class AutocompleteCommand extends Command
|
||||
{
|
||||
if ($suggestions) {
|
||||
$key = array_search('autocomplete', $suggestions);
|
||||
if ($key !== false){
|
||||
if ($key !== false) {
|
||||
unset($suggestions[$key]);
|
||||
}
|
||||
echo implode("\n", $suggestions)
|
||||
// . serialize($GLOBALS['argv'])
|
||||
//. serialize($GLOBALS['argv'])
|
||||
. "\n";
|
||||
}
|
||||
}
|
||||
@ -41,7 +40,6 @@ class AutocompleteCommand extends Command
|
||||
*/
|
||||
public function completeAction()
|
||||
{
|
||||
// TODO:
|
||||
$module = null;
|
||||
$command = null;
|
||||
$action = null;
|
||||
@ -54,16 +52,11 @@ class AutocompleteCommand extends Command
|
||||
$search_word = $bare_params[$cword];
|
||||
if ($search_word === '--') {
|
||||
// TODO: Unfinished, completion missing
|
||||
return $this->suggest(array(
|
||||
'--verbose',
|
||||
'--help',
|
||||
'--debug'
|
||||
));
|
||||
return $this->suggest(array('--verbose', '--help', '--debug'));
|
||||
}
|
||||
|
||||
$search = $params->shift();
|
||||
// TODO:
|
||||
if (! $search) {
|
||||
if (!$search) {
|
||||
return $this->suggest(
|
||||
array_merge($loader->listCommands(), $loader->listModules())
|
||||
);
|
||||
|
@ -72,9 +72,7 @@ class ModuleCommand extends Command
|
||||
"%-14s %-9s %-9s %s\n",
|
||||
$module,
|
||||
$mod->getVersion(),
|
||||
($type === 'enabled' || $this->modules->hasEnabled($module))
|
||||
? 'enabled'
|
||||
: 'disabled',
|
||||
($type === 'enabled' || $this->modules->hasEnabled($module)) ? 'enabled' : 'disabled',
|
||||
$dir
|
||||
);
|
||||
}
|
||||
|
@ -184,8 +184,9 @@ class GeneralForm extends Form
|
||||
'label' => t('Default Language'),
|
||||
'required' => true,
|
||||
'multiOptions' => $languages,
|
||||
'helptext' => t('Select the language to use by default. Can be'
|
||||
. ' overwritten by a user in his preferences.'),
|
||||
'helptext' => t(
|
||||
'Select the language to use by default. Can be overwritten by a user in his preferences.'
|
||||
),
|
||||
'value' => $cfg->get('language', Translator::DEFAULT_LOCALE)
|
||||
)
|
||||
);
|
||||
|
@ -4,9 +4,10 @@ namespace Icinga\Module\Monitoring\Form\Config\Backend;
|
||||
|
||||
use Icinga\Module\Monitoring\Form\Config\Backend\EditResourceForm;
|
||||
|
||||
class CreateResourceForm extends EditResourceForm {
|
||||
class CreateResourceForm extends EditResourceForm
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,13 +29,10 @@
|
||||
|
||||
namespace Icinga\Form\Config\Resource;
|
||||
|
||||
use Icinga\Exception\ProgrammingError;
|
||||
use Icinga\Protocol\Ldap\Exception;
|
||||
use \Zend_Config;
|
||||
use \Icinga\Web\Form;
|
||||
use \Icinga\Web\Form\Decorator\HelpText;
|
||||
use \Icinga\Application\Logger;
|
||||
use \Icinga\Application\Icinga;
|
||||
use Icinga\Data\ResourceFactory;
|
||||
|
||||
/**
|
||||
@ -168,7 +165,7 @@ class EditResourceForm extends Form
|
||||
|
||||
private function addStatusdatForm()
|
||||
{
|
||||
$this->addElement(
|
||||
$this->addElement(
|
||||
'text',
|
||||
'resource_statusdat_status_file',
|
||||
array(
|
||||
@ -192,7 +189,7 @@ class EditResourceForm extends Form
|
||||
|
||||
private function addLivestatusForm()
|
||||
{
|
||||
$this->addElement(
|
||||
$this->addElement(
|
||||
'text',
|
||||
'resource_livestatus_socket',
|
||||
array(
|
||||
@ -386,10 +383,7 @@ class EditResourceForm extends Form
|
||||
$resource->getConnection()->getConnection();
|
||||
break;
|
||||
case 'statusdat':
|
||||
if (
|
||||
!file_exists($config->object_file) ||
|
||||
!file_exists($config->status_file)
|
||||
) {
|
||||
if (!file_exists($config->object_file) || !file_exists($config->status_file)) {
|
||||
$this->addErrorMessage(
|
||||
'Connectivity validation failed, the provided file or socket does not exist.'
|
||||
);
|
||||
@ -443,11 +437,7 @@ class EditResourceForm extends Form
|
||||
$type = $values['resource_type'];
|
||||
$result = array('type' => $type);
|
||||
foreach ($values as $key => $value) {
|
||||
if (
|
||||
$key !== 'resource_type' &&
|
||||
$key !== 'resource_all_name' &&
|
||||
$key !== 'resource_all_name_old'
|
||||
) {
|
||||
if ($key !== 'resource_type' && $key !== 'resource_all_name' && $key !== 'resource_all_name_old') {
|
||||
$configKey = explode('_', $key, 3);
|
||||
if (sizeof($configKey) < 3) {
|
||||
Logger::warn('EditResourceForm: invalid form key "' . $key . '" was ignored.');
|
||||
|
@ -1,4 +1,6 @@
|
||||
<?php
|
||||
// @codingStandardsIgnoreStart
|
||||
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/**
|
||||
* This file is part of Icinga Web 2.
|
||||
@ -30,7 +32,6 @@
|
||||
use \Zend_Controller_Front;
|
||||
use \Zend_View_Helper_Abstract;
|
||||
|
||||
|
||||
class Zend_View_Helper_RequestId extends Zend_View_Helper_Abstract
|
||||
{
|
||||
public function requestId()
|
||||
@ -38,3 +39,5 @@ class Zend_View_Helper_RequestId extends Zend_View_Helper_Abstract
|
||||
return Zend_Controller_Front::getInstance()->getRequest()->getId();
|
||||
}
|
||||
}
|
||||
|
||||
// @codingStandardsIgnoreStop
|
||||
|
@ -105,7 +105,7 @@ class Manager
|
||||
if (empty($availableDirs)) {
|
||||
$availableDirs = array(realpath(ICINGA_APPDIR . '/../modules'));
|
||||
} else {
|
||||
foreach($availableDirs as $key => $dir) {
|
||||
foreach ($availableDirs as $key => $dir) {
|
||||
$dir[$key] = realpath($dir);
|
||||
}
|
||||
}
|
||||
|
@ -324,7 +324,6 @@ class Module
|
||||
$key = lcfirst($key);
|
||||
|
||||
switch ($key) {
|
||||
|
||||
case 'depends':
|
||||
if (strpos($val, ' ') === false) {
|
||||
$metadata->depends[$val] = true;
|
||||
@ -341,11 +340,9 @@ class Module
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'description':
|
||||
$metadata->shortDescription = $val;
|
||||
// YES, no break here
|
||||
|
||||
default:
|
||||
$metadata->{$key} = $val;
|
||||
|
||||
@ -524,12 +521,7 @@ class Module
|
||||
{
|
||||
$moduleName = ucfirst($this->getName());
|
||||
$moduleLibraryDir = $this->getLibDir(). '/'. $moduleName;
|
||||
if (
|
||||
is_dir($this->getBaseDir()) &&
|
||||
is_dir($this->getLibDir()) &&
|
||||
is_dir($moduleLibraryDir)
|
||||
) {
|
||||
|
||||
if (is_dir($this->getBaseDir()) && is_dir($this->getLibDir()) && is_dir($moduleLibraryDir)) {
|
||||
$this->app->getLoader()->registerNamespace('Icinga\\Module\\' . $moduleName, $moduleLibraryDir);
|
||||
if (is_dir($this->getFormDir())) {
|
||||
$this->app->getLoader()->registerNamespace(
|
||||
|
@ -289,7 +289,8 @@ class DbUserBackend implements UserBackend
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function createPasswordHash($password, $salt) {
|
||||
protected function createPasswordHash($password, $salt)
|
||||
{
|
||||
return hash_hmac('sha256', $password, $salt);
|
||||
}
|
||||
|
||||
|
@ -136,7 +136,10 @@ class PieChart extends Chart
|
||||
*/
|
||||
protected function build()
|
||||
{
|
||||
$this->renderer = new SVGRenderer(($this->type === self::STACKED) ? $this->width : count($this->pies)*$this->width, $this->width);
|
||||
$this->renderer = new SVGRenderer(
|
||||
$this->type === self::STACKED ? $this->width : count($this->pies) * $this->width,
|
||||
$this->width
|
||||
);
|
||||
foreach ($this->pies as &$pie) {
|
||||
$this->normalizeDataSet($pie);
|
||||
}
|
||||
@ -292,7 +295,7 @@ class PieChart extends Chart
|
||||
$offset = isset($this->pies[$i+1]) ? $radius - $shrinkStep : 0;
|
||||
$labelPos = 0;
|
||||
$lastRadius = 0;
|
||||
foreach ($pie['data'] as $idx => $dataset) {
|
||||
foreach ($pie['data'] as $idx => $dataset) {
|
||||
$color = $this->getColorForPieSlice($pie, $idx);
|
||||
if ($dataset === 100) {
|
||||
$dataset = 99.9;
|
||||
|
@ -180,7 +180,7 @@ class PieSlice extends Animatable implements Drawable
|
||||
$path->append(array($midX, $midY))->toAbsolute();
|
||||
|
||||
$midX += intval($r/2 * sin(M_PI/9)) * ($midRadius > M_PI ? -1 : 1);
|
||||
$midY -= intval($r/2 * cos(M_PI/3) ) * ($midRadius < M_PI*1.4 && $midRadius > M_PI/3 ? -1 : 1);
|
||||
$midY -= intval($r/2 * cos(M_PI/3)) * ($midRadius < M_PI*1.4 && $midRadius > M_PI/3 ? -1 : 1);
|
||||
|
||||
if ($ctx->ytoRelative($midY) > 100) {
|
||||
$midY = $ctx->yToAbsolute(100);
|
||||
|
@ -140,5 +140,4 @@ class StaticAxis implements AxisUnit
|
||||
{
|
||||
return reset($this->items);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -126,4 +126,3 @@ abstract class Command
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,13 +35,14 @@ class Documentation
|
||||
$d = "USAGE: icingaweb [module] <command> [action] [options]\n\n"
|
||||
. "Available commands:\n\n";
|
||||
foreach ($this->loader->listCommands() as $command) {
|
||||
if ($command === 'autocomplete') continue;
|
||||
$obj = $this->loader->getCommandInstance($command);
|
||||
$d .= sprintf(
|
||||
" %-14s %s\n",
|
||||
$command,
|
||||
$this->getClassTitle($obj)
|
||||
);
|
||||
if ($command !== 'autocomplete') {
|
||||
$obj = $this->loader->getCommandInstance($command);
|
||||
$d .= sprintf(
|
||||
" %-14s %s\n",
|
||||
$command,
|
||||
$this->getClassTitle($obj)
|
||||
);
|
||||
}
|
||||
}
|
||||
$d .= "\nAvailable modules:\n\n";
|
||||
foreach ($this->loader->listModules() as $module) {
|
||||
|
@ -131,7 +131,7 @@ class Loader
|
||||
$command,
|
||||
null,
|
||||
false
|
||||
);
|
||||
);
|
||||
}
|
||||
return $this->commandInstances[$command];
|
||||
}
|
||||
@ -346,29 +346,31 @@ class Loader
|
||||
protected function formatTrace($trace)
|
||||
{
|
||||
$output = array();
|
||||
foreach($trace as $i => $step)
|
||||
{
|
||||
foreach ($trace as $i => $step) {
|
||||
$object = '';
|
||||
if (isset($step['object']) && is_object($step['object'])) {
|
||||
$object = sprintf('[%s]', get_class($step['object'])) . $step['type'];
|
||||
} elseif (! empty($step['object'])) {
|
||||
$object = (string) $step['object'] . $step['type'];
|
||||
}
|
||||
if (is_array($step['args']))
|
||||
{
|
||||
foreach ($step['args'] as & $arg)
|
||||
{
|
||||
if (is_object($arg))
|
||||
{
|
||||
if (is_array($step['args'])) {
|
||||
foreach ($step['args'] as & $arg) {
|
||||
if (is_object($arg)) {
|
||||
$arg = sprintf('[%s]', get_class($arg));
|
||||
}
|
||||
if (is_string($arg)) {
|
||||
$arg = preg_replace('~\n~', '\n', $arg);
|
||||
if (strlen($arg) > 50) $arg = substr($arg, 0, 47) . '...';
|
||||
if (strlen($arg) > 50) {
|
||||
$arg = substr($arg, 0, 47) . '...';
|
||||
}
|
||||
$arg = "'" . $arg . "'";
|
||||
}
|
||||
if ($arg === null) $arg = 'NULL';
|
||||
if (is_bool($arg)) $arg = $arg ? 'TRUE' : 'FALSE';
|
||||
if ($arg === null) {
|
||||
$arg = 'NULL';
|
||||
}
|
||||
if (is_bool($arg)) {
|
||||
$arg = $arg ? 'TRUE' : 'FALSE';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$step['args'] = array();
|
||||
|
@ -101,11 +101,11 @@ class AnsiScreen extends Screen
|
||||
$parts = preg_split('/;/', $current);
|
||||
$lc_parts = array();
|
||||
foreach ($parts as $part) {
|
||||
if (strpos($part, '=') === false) {
|
||||
continue;
|
||||
}
|
||||
list($key, $val) = preg_split('/=/', $part, 2);
|
||||
$lc_parts[$key] = $val;
|
||||
if (strpos($part, '=') === false) {
|
||||
continue;
|
||||
}
|
||||
list($key, $val) = preg_split('/=/', $part, 2);
|
||||
$lc_parts[$key] = $val;
|
||||
}
|
||||
|
||||
$this->isUtf8 = array_key_exists('LC_CTYPE', $lc_parts)
|
||||
|
@ -131,10 +131,10 @@ class Connection implements DatasourceInterface
|
||||
$adapter = 'Pdo_Mysql';
|
||||
/*
|
||||
* Set MySQL server SQL modes to behave as closely as possible to Oracle and PostgreSQL. Note that the
|
||||
* ONLY_FULL_GROUP_BY mode is left on purpose because MySQL requires you to specify all non-aggregate columns
|
||||
* in the group by list even if the query is grouped by the master table's primary key which is valid
|
||||
* ANSI SQL though. Further in that case the query plan would suffer if you add more columns to the group by
|
||||
* list.
|
||||
* ONLY_FULL_GROUP_BY mode is left on purpose because MySQL requires you to specify all non-aggregate
|
||||
* columns in the group by list even if the query is grouped by the master table's primary key which is
|
||||
* valid ANSI SQL though. Further in that case the query plan would suffer if you add more columns to
|
||||
* the group by list.
|
||||
*/
|
||||
$driverOptions[PDO::MYSQL_ATTR_INIT_COMMAND] =
|
||||
'SET SESSION SQL_MODE=\'STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,'
|
||||
@ -145,21 +145,17 @@ class Connection implements DatasourceInterface
|
||||
$adapter = 'Pdo_Pgsql';
|
||||
$adapterParamaters['port'] = $this->config->get('port', 5432);
|
||||
break;
|
||||
// case 'oracle':
|
||||
// if ($this->dbtype === 'oracle') {
|
||||
// $attributes['persistent'] = true;
|
||||
// }
|
||||
// $this->db = ZfDb::factory($adapter, $attributes);
|
||||
// if ($adapter === 'Oracle') {
|
||||
// $this->db->setLobAsString(false);
|
||||
// }
|
||||
// break;
|
||||
/*case 'oracle':
|
||||
if ($this->dbtype === 'oracle') {
|
||||
$attributes['persistent'] = true;
|
||||
}
|
||||
$this->db = ZfDb::factory($adapter, $attributes);
|
||||
if ($adapter === 'Oracle') {
|
||||
$this->db->setLobAsString(false);
|
||||
}
|
||||
break;*/
|
||||
default:
|
||||
throw new ConfigurationError(
|
||||
sprintf(
|
||||
'Backend "%s" is not supported', $this->dbType
|
||||
)
|
||||
);
|
||||
throw new ConfigurationError(sprintf('Backend "%s" is not supported', $this->dbType));
|
||||
}
|
||||
$this->conn = Zend_Db::factory($adapter, $adapterParamaters);
|
||||
$this->conn->setFetchMode(Zend_Db::FETCH_OBJ);
|
||||
|
@ -5,7 +5,6 @@ namespace Icinga\File;
|
||||
use \DOMPDF;
|
||||
use \DOMDocument;
|
||||
use \DOMXPath;
|
||||
use \DOMNode;
|
||||
|
||||
require_once 'vendor/dompdf/dompdf_config.inc.php';
|
||||
|
||||
@ -34,7 +33,8 @@ class Pdf extends DOMPDF
|
||||
*/
|
||||
public $paginateTable = true;
|
||||
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
$this->set_paper(DOMPDF_DEFAULT_PAPER_SIZE, "portrait");
|
||||
parent::__construct();
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ class Node
|
||||
} elseif (!is_array($right)) {
|
||||
$right = array($right);
|
||||
}
|
||||
foreach($right as &$value) {
|
||||
foreach ($right as &$value) {
|
||||
$value = trim($value);
|
||||
}
|
||||
$node->right = $right;
|
||||
|
@ -372,7 +372,7 @@ class Tree
|
||||
|
||||
if ($ctx->type == Node::TYPE_OPERATOR) {
|
||||
if ($ctx->left == $node->left && $ctx->operator == $node->operator) {
|
||||
if(empty($node->right) || $ctx->right == $node->right) {
|
||||
if (empty($node->right) || $ctx->right == $node->right) {
|
||||
return $ctx;
|
||||
}
|
||||
}
|
||||
|
@ -151,7 +151,9 @@ class CommandPipe
|
||||
foreach ($objects as $object) {
|
||||
$objectType = $this->getObjectType($object);
|
||||
if ($objectType === self::TYPE_SERVICE) {
|
||||
$this->transport->send($command->getServiceCommand($object->host_name, $object->service_description));
|
||||
$this->transport->send(
|
||||
$command->getServiceCommand($object->host_name, $object->service_description)
|
||||
);
|
||||
} else {
|
||||
$this->transport->send($command->getHostCommand($object->host_name));
|
||||
}
|
||||
|
@ -29,7 +29,6 @@
|
||||
|
||||
namespace Icinga\Protocol\Statusdat;
|
||||
|
||||
use Icinga\Application\Logger;
|
||||
use Icinga\Exception\ConfigurationError;
|
||||
use Icinga\Exception\ProgrammingError;
|
||||
use Icinga\Protocol\Statusdat\Exception\ParsingException as ParsingException;
|
||||
@ -320,7 +319,8 @@ class Parser
|
||||
$isContact = strpos($this->currentObjectType, "contact") !== false;
|
||||
$name = $this->getObjectIdentifier($object);
|
||||
|
||||
if ($isService === false && $isHost === false && $isContact === false) { // this would be error in the parser implementation
|
||||
if ($isService === false && $isHost === false && $isContact === false) {
|
||||
// this would be error in the parser implementation
|
||||
return null;
|
||||
}
|
||||
$property = $this->currentObjectType;
|
||||
|
@ -35,11 +35,11 @@ class PrintableObject
|
||||
{
|
||||
if (isset($this->contact_name)) {
|
||||
return $this->contact_name;
|
||||
} else if (isset($this->service_description)) {
|
||||
} elseif (isset($this->service_description)) {
|
||||
return $this->service_description;
|
||||
} else if (isset($this->host_name)) {
|
||||
} elseif (isset($this->host_name)) {
|
||||
return $this->host_name;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -31,8 +31,6 @@ namespace Icinga\Protocol\Statusdat;
|
||||
|
||||
use Exception;
|
||||
use Icinga\Exception\ProgrammingError;
|
||||
use Icinga\Filter\Query\Node;
|
||||
use Icinga\Protocol;
|
||||
use Icinga\Data\BaseQuery;
|
||||
use Icinga\Protocol\Statusdat\View\MonitoringObjectList;
|
||||
use Icinga\Protocol\Statusdat\Query\IQueryPart;
|
||||
@ -227,7 +225,7 @@ class Query extends BaseQuery
|
||||
if ($baseGroup) {
|
||||
$baseGroup->setQuery($this);
|
||||
$idx = array_keys($state[$target]);
|
||||
$indexes = $baseGroup->filter($state[$target], $idx );
|
||||
$indexes = $baseGroup->filter($state[$target], $idx);
|
||||
}
|
||||
if (!isset($result[$target])) {
|
||||
$result[$target] = $indexes;
|
||||
|
@ -29,8 +29,6 @@
|
||||
|
||||
namespace Icinga\Protocol\Statusdat\Query;
|
||||
|
||||
use Icinga\Protocol\Ldap\Exception;
|
||||
|
||||
class Expression implements IQueryPart
|
||||
{
|
||||
/**
|
||||
@ -285,7 +283,7 @@ class Expression implements IQueryPart
|
||||
if (!is_string($val) && !is_numeric($val) && is_object($val)) {
|
||||
if (isset($val->service_description)) {
|
||||
$val = $val->service_description;
|
||||
} elseif(isset($val->host_name)) {
|
||||
} elseif (isset($val->host_name)) {
|
||||
$val = $val->host_name;
|
||||
} else {
|
||||
return false;
|
||||
@ -433,6 +431,4 @@ class Expression implements IQueryPart
|
||||
{
|
||||
$this->query = $query;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -414,6 +414,4 @@ class Group implements IQueryPart
|
||||
{
|
||||
$this->query = $query;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -58,5 +58,4 @@ interface IQueryPart
|
||||
* @return mixed
|
||||
*/
|
||||
public function setQuery($query);
|
||||
|
||||
}
|
||||
|
@ -32,9 +32,6 @@ namespace Icinga\Protocol\Statusdat;
|
||||
use Icinga\Application\Logger;
|
||||
use Icinga\Data\DatasourceInterface;
|
||||
use Icinga\Exception\ConfigurationError;
|
||||
use Icinga\Exception;
|
||||
use Icinga\Benchmark;
|
||||
use Icinga\Protocol\Statusdat\View\MonitoringObjectList;
|
||||
|
||||
/**
|
||||
* Class Reader
|
||||
@ -163,9 +160,11 @@ class Reader implements IReader, DatasourceInterface
|
||||
// the object cache might exist for months and is still valid
|
||||
$this->objectCache = $this->initCache($this->config->object_file, $backendOptions, null, $cachingEnabled);
|
||||
$this->statusCache = $this->initCache(
|
||||
$this->config->status_file, $backendOptions, $maxCacheLifetime, $cachingEnabled
|
||||
$this->config->status_file,
|
||||
$backendOptions,
|
||||
$maxCacheLifetime,
|
||||
$cachingEnabled
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -94,5 +94,4 @@ class RuntimeStateContainer extends \stdClass
|
||||
|
||||
return $this->$attr;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -32,7 +32,6 @@ namespace Icinga\Session;
|
||||
use Icinga\Application\Logger;
|
||||
use \Icinga\Exception\ConfigurationError;
|
||||
|
||||
|
||||
/**
|
||||
* Session implementation in PHP
|
||||
*/
|
||||
|
@ -31,7 +31,6 @@ namespace Icinga\Session;
|
||||
|
||||
use \Exception;
|
||||
|
||||
|
||||
/**
|
||||
* Container for session values
|
||||
*/
|
||||
@ -50,7 +49,8 @@ class SessionNamespace
|
||||
* @param string $key The value's name
|
||||
* @param mixed $value The value
|
||||
*/
|
||||
public function __set($key, $value) {
|
||||
public function __set($key, $value)
|
||||
{
|
||||
$this->set($key, $value);
|
||||
}
|
||||
|
||||
@ -62,7 +62,8 @@ class SessionNamespace
|
||||
* @return mixed The value
|
||||
* @throws Exception When the given value-name is not found
|
||||
*/
|
||||
public function __get($key) {
|
||||
public function __get($key)
|
||||
{
|
||||
if (!array_key_exists($key, $this->values)) {
|
||||
throw new Exception('Cannot access non-existent session value "' + $key + '"');
|
||||
}
|
||||
@ -76,7 +77,8 @@ class SessionNamespace
|
||||
* @param string $key The value's name
|
||||
* @return bool
|
||||
*/
|
||||
public function __isset($key) {
|
||||
public function __isset($key)
|
||||
{
|
||||
return isset($this->values[$key]);
|
||||
}
|
||||
|
||||
@ -85,7 +87,8 @@ class SessionNamespace
|
||||
*
|
||||
* @param string $key The value's name
|
||||
*/
|
||||
public function __unset($key) {
|
||||
public function __unset($key)
|
||||
{
|
||||
unset($this->values[$key]);
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,6 @@
|
||||
namespace Icinga\User;
|
||||
|
||||
use \Zend_Log;
|
||||
use \DateTime;
|
||||
|
||||
/**
|
||||
* Class Message
|
||||
@ -12,8 +11,8 @@ use \DateTime;
|
||||
*
|
||||
* @package Icinga\User
|
||||
*/
|
||||
class Message {
|
||||
|
||||
class Message
|
||||
{
|
||||
/**
|
||||
* The content of this message
|
||||
*
|
||||
@ -34,7 +33,8 @@ class Message {
|
||||
* * Zend_Log::INFO
|
||||
* * Zend_Log::ERR
|
||||
*/
|
||||
public function __construct($message, $level = Zend_Log::INFO) {
|
||||
public function __construct($message, $level = Zend_Log::INFO)
|
||||
{
|
||||
$this->message = $message;
|
||||
$this->level = $level;
|
||||
}
|
||||
@ -54,4 +54,4 @@ class Message {
|
||||
{
|
||||
return $this->level;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -180,10 +180,12 @@ class ActionController extends Zend_Controller_Action
|
||||
{
|
||||
if ($this->getRequest()->isXmlHttpRequest()) {
|
||||
$this->_response->setHttpResponseCode(401);
|
||||
$this->_helper->json(array(
|
||||
'exception' => 'You are not logged in',
|
||||
'redirectTo' => Url::fromPath('/authentication/login')->getAbsoluteUrl()
|
||||
));
|
||||
$this->_helper->json(
|
||||
array(
|
||||
'exception' => 'You are not logged in',
|
||||
'redirectTo' => Url::fromPath('/authentication/login')->getAbsoluteUrl()
|
||||
)
|
||||
);
|
||||
}
|
||||
$url = Url::fromPath('/authentication/login');
|
||||
$url->setParam('redirect', $afterLogin);
|
||||
|
@ -31,8 +31,8 @@ namespace Icinga\Web\Form\Validator;
|
||||
|
||||
use \Zend_Validate_Abstract;
|
||||
|
||||
class TriStateValidator extends Zend_Validate_Abstract {
|
||||
|
||||
class TriStateValidator extends Zend_Validate_Abstract
|
||||
{
|
||||
/**
|
||||
* @var null
|
||||
*/
|
||||
@ -77,4 +77,4 @@ class TriStateValidator extends Zend_Validate_Abstract {
|
||||
{
|
||||
return $this->validPattern;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,8 @@ class Menu extends MenuItem
|
||||
*
|
||||
* @return Menu
|
||||
*/
|
||||
public static function fromConfig() {
|
||||
public static function fromConfig()
|
||||
{
|
||||
$menu = new static('menu');
|
||||
$manager = Icinga::app()->getModuleManager();
|
||||
$menuConfigs = array(Config::app('menu'));
|
||||
@ -81,5 +82,4 @@ class Menu extends MenuItem
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -34,7 +34,6 @@ use Icinga\Session\SessionNamespace;
|
||||
use Icinga\Session\Session as BaseSession;
|
||||
use Icinga\Exception\ProgrammingError;
|
||||
|
||||
|
||||
/**
|
||||
* Session container
|
||||
*/
|
||||
|
@ -17,8 +17,8 @@ use Icinga\Authentication\Manager as AuthenticationManager;
|
||||
* but this is done lazily when render() is called, to ensure that messages will
|
||||
* always be displayed before they are cleared.
|
||||
*/
|
||||
class AlertMessageBox implements \Icinga\Web\Widget\Widget {
|
||||
|
||||
class AlertMessageBox implements \Icinga\Web\Widget\Widget
|
||||
{
|
||||
/**
|
||||
* Remove all messages from the current user, return them and commit
|
||||
* changes to the underlying session.
|
||||
@ -74,10 +74,11 @@ class AlertMessageBox implements \Icinga\Web\Widget\Widget {
|
||||
/**
|
||||
* Create a new AlertBox
|
||||
*
|
||||
* @param boolean showUserMessages If the current user messages should be displayed
|
||||
* in this AlertMessageBox. Defaults to false
|
||||
* @param boolean showUserMessages If the current user messages should be displayed
|
||||
* in this AlertMessageBox. Defaults to false
|
||||
*/
|
||||
public function __construct($showUserMessages = false) {
|
||||
public function __construct($showUserMessages = false)
|
||||
{
|
||||
if ($showUserMessages) {
|
||||
$this->user = AuthenticationManager::getInstance()->getUser();
|
||||
}
|
||||
@ -108,10 +109,11 @@ class AlertMessageBox implements \Icinga\Web\Widget\Widget {
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function render(Zend_View_Abstract $view = null) {
|
||||
public function render(Zend_View_Abstract $view = null)
|
||||
{
|
||||
$html = '';
|
||||
if (isset($this->user)) {
|
||||
$this->messages = array_merge($this->messages, $this->getAndClearMessages());
|
||||
$this->messages = array_merge($this->messages, $this->getAndClearMessages());
|
||||
}
|
||||
foreach ($this->messages as $message) {
|
||||
$level = $message->getLevel();
|
||||
|
@ -34,8 +34,8 @@ use Icinga\Web\Url;
|
||||
|
||||
use \Zend_View_Abstract;
|
||||
|
||||
class PieChart implements Widget {
|
||||
|
||||
class PieChart implements Widget
|
||||
{
|
||||
/**
|
||||
* The template string used for rendering this widget
|
||||
*
|
||||
@ -123,4 +123,4 @@ EOD;
|
||||
$template = preg_replace('{{height}}', $this->height, $template);
|
||||
return $template;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -213,7 +213,7 @@ EOD;
|
||||
$html = str_replace('{FULL_URL}', $url->getUrlWithout('view')->getAbsoluteUrl(), $html);
|
||||
$html = str_replace('{REMOVE_BTN}', $this->getRemoveForm($view), $html);
|
||||
$html = str_replace('{DIMENSION}', $this->getBoxSizeAsCSS(), $html);
|
||||
$html = str_replace('{{IS_FULL}}', $this->fullsize ? 'row' : '' , $html);
|
||||
$html = str_replace('{{IS_FULL}}', $this->fullsize ? 'row' : '', $html);
|
||||
$html = str_replace('{TITLE}', htmlentities($this->getTitle()), $html);
|
||||
return $html;
|
||||
}
|
||||
@ -236,14 +236,16 @@ EOD;
|
||||
$form = new Form();
|
||||
$form->setMethod('POST');
|
||||
$form->setAction($removeUrl);
|
||||
$form->addElement(new Zend_Form_Element_Button(
|
||||
'remove_pane_btn',
|
||||
array(
|
||||
'class'=> 'btn btn-danger pull-right',
|
||||
'type' => 'submit',
|
||||
'label' => 'Remove'
|
||||
$form->addElement(
|
||||
new Zend_Form_Element_Button(
|
||||
'remove_pane_btn',
|
||||
array(
|
||||
'class'=> 'btn btn-danger pull-right',
|
||||
'type' => 'submit',
|
||||
'label' => 'Remove'
|
||||
)
|
||||
)
|
||||
));
|
||||
);
|
||||
return $form->render($view);
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ class FilterBadgeRenderer implements Widget
|
||||
|
||||
private $tpl =<<<'EOT'
|
||||
<div class="btn-group">
|
||||
<a title="Click To Remove" class="btn btn-default btn-xs dropdown-toggle" href="{{REMOVE_FILTER}}" data-icinga-target="self">
|
||||
<a title="Click To Remove" class="btn btn-default btn-xs dropdown-toggle" href="{{REMOVE_FILTER}}" data-icinga-target="self">
|
||||
{{FILTER_SUM}}
|
||||
</a>
|
||||
{{SUBLIST}}
|
||||
@ -89,7 +89,7 @@ EOT;
|
||||
$value = $node->right[0];
|
||||
} else {
|
||||
$value = join(',', $node->right);
|
||||
if(strlen($value) > 15) {
|
||||
if (strlen($value) > 15) {
|
||||
$value = substr($value, 0, 13) . '..';
|
||||
}
|
||||
}
|
||||
@ -110,7 +110,7 @@ EOT;
|
||||
$url = $basePath . (empty($allParams) ? '?' : '&') . $url;
|
||||
|
||||
$liItem = str_replace('{{REMOVE_FILTER}}', $url, $this->subItemTpl);
|
||||
$liItem = str_replace('{{FILTER_TEXT}}', ucfirst($node->left) . $node->operator . $value , $liItem);
|
||||
$liItem = str_replace('{{FILTER_TEXT}}', ucfirst($node->left) . $node->operator . $value, $liItem);
|
||||
$liItems .= $liItem;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user