mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-23 22:04:25 +02:00
Merge branch 'master' of git.icinga.org:icingaweb2
This commit is contained in:
commit
fdb5dede50
@ -34,6 +34,7 @@ use Zend_Db_Expr;
|
|||||||
use Icinga\Authentication\UserBackend;
|
use Icinga\Authentication\UserBackend;
|
||||||
use Icinga\Data\Db\Connection;
|
use Icinga\Data\Db\Connection;
|
||||||
use Icinga\User;
|
use Icinga\User;
|
||||||
|
use \Zend_Db_Select;
|
||||||
|
|
||||||
class DbUserBackend extends UserBackend
|
class DbUserBackend extends UserBackend
|
||||||
{
|
{
|
||||||
@ -58,10 +59,12 @@ class DbUserBackend extends UserBackend
|
|||||||
*/
|
*/
|
||||||
public function hasUser(User $user)
|
public function hasUser(User $user)
|
||||||
{
|
{
|
||||||
$row = $this->conn->select()->from('account', array(new Zend_Db_Expr(1)))
|
$select = new Zend_Db_Select($this->conn->getConnection());
|
||||||
|
$row = $select->from('account', array(new Zend_Db_Expr(1)))
|
||||||
->where('username = ?', $user->getUsername())
|
->where('username = ?', $user->getUsername())
|
||||||
->fetch();
|
->query()->fetchObject();
|
||||||
return $row !== false ? true : false;
|
|
||||||
|
return ($row !== false) ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -71,6 +74,7 @@ class DbUserBackend extends UserBackend
|
|||||||
* @param string $password
|
* @param string $password
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
|
* @throws \Exception If we can not fetch the salt
|
||||||
*/
|
*/
|
||||||
public function authenticate(User $user, $password)
|
public function authenticate(User $user, $password)
|
||||||
{
|
{
|
||||||
@ -81,12 +85,15 @@ class DbUserBackend extends UserBackend
|
|||||||
if ($salt === '') {
|
if ($salt === '') {
|
||||||
throw new Exception();
|
throw new Exception();
|
||||||
}
|
}
|
||||||
$row = $this->conn->select()->from('account', array(new Zend_Db_Expr(1)))
|
|
||||||
|
$select = new Zend_Db_Select($this->conn->getConnection());
|
||||||
|
$row = $select->from('account', array(new Zend_Db_Expr(1)))
|
||||||
->where('username = ?', $user->getUsername())
|
->where('username = ?', $user->getUsername())
|
||||||
->where('active = ?', true)
|
->where('active = ?', true)
|
||||||
->where('password = ?', $this->hashPassword($password, $salt))
|
->where('password = ?', $this->hashPassword($password, $salt))
|
||||||
->fetchRow();
|
->query()->fetchObject();
|
||||||
return $row !== false ? true : false;
|
|
||||||
|
return ($row !== false) ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -98,8 +105,9 @@ class DbUserBackend extends UserBackend
|
|||||||
*/
|
*/
|
||||||
private function getSalt($username)
|
private function getSalt($username)
|
||||||
{
|
{
|
||||||
$row = $this->conn->select()->from('account', array('salt'))->where('username = ?', $username)->fetchRow();
|
$select = new Zend_Db_Select($this->conn->getConnection());
|
||||||
return $row !== false ? $row->salt : null;
|
$row = $select->from('account', array('salt'))->where('username = ?', $username)->query()->fetchObject();
|
||||||
|
return ($row !== false) ? $row->salt : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -121,6 +129,12 @@ class DbUserBackend extends UserBackend
|
|||||||
*/
|
*/
|
||||||
public function count()
|
public function count()
|
||||||
{
|
{
|
||||||
return $this->conn->select()->from('account', array('count' => 'COUNT(*)'))->fetch()->count();
|
$select = new Zend_Db_Select($this->conn->getConnection());
|
||||||
|
$row = $select->from(
|
||||||
|
'account',
|
||||||
|
array('count' => 'COUNT(*)')
|
||||||
|
)->query()->fetchObject();
|
||||||
|
|
||||||
|
return ($row !== false) ? $row->count : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,97 +0,0 @@
|
|||||||
<table class="action">
|
|
||||||
<tbody>
|
|
||||||
<?php
|
|
||||||
|
|
||||||
$helper = $this->getHelper('MonitoringState');
|
|
||||||
|
|
||||||
foreach ($services as $service):
|
|
||||||
|
|
||||||
$serviceLink = $this->href(
|
|
||||||
'monitoring/show/service',
|
|
||||||
array(
|
|
||||||
'host' => $service->host_name,
|
|
||||||
'service' => $service->service_description
|
|
||||||
)
|
|
||||||
);
|
|
||||||
$hostLink = $this->href(
|
|
||||||
'monitoring/show/host',
|
|
||||||
array('host' => $service->host_name)
|
|
||||||
);
|
|
||||||
$serviceStateName = strtolower($this->util()->getServiceStateName($service->service_state));
|
|
||||||
?>
|
|
||||||
<!-- <tr <?= ($this->activeRowHref === $serviceLink) ? 'class="active"' : ''; ?>>-->
|
|
||||||
<tr class="state <?= $serviceStateName ?><?= $service->service_handled ? ' handled' : '' ?>">
|
|
||||||
|
|
||||||
<!-- Color column -->
|
|
||||||
<!--
|
|
||||||
<td class="tacheader-status-<?= $serviceStateName; ?>">
|
|
||||||
<a style="visibility:hidden" href="<?= $serviceLink; ?>"></a>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<a style="visibility:hidden" href="<?= $serviceLink; ?>"></a>
|
|
||||||
<?php if (!$service->service_handled && $service->service_state > 0): ?>
|
|
||||||
<a href="#" title="Unhandled">
|
|
||||||
<i class="icon-table icinga-icon-unhandled"></i>
|
|
||||||
</a>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<?php if ($service->service_acknowledged && !$service->service_in_downtime): ?>
|
|
||||||
<a href="#" title="Acknowledged">
|
|
||||||
<i class="icon-table icinga-icon-acknowledgement"></i>
|
|
||||||
</a>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<?php if ($service->service_is_flapping): ?>
|
|
||||||
<a href="#" title="Flapping">
|
|
||||||
<i class="icon-table icinga-icon-flapping"></i>
|
|
||||||
</a>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<?php if (!$service->service_notifications_enabled): ?>
|
|
||||||
<a href="#" title="Notifications Disabled">
|
|
||||||
<i class="icon-table icinga-icon-notification-disabled"></i>
|
|
||||||
</a>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<?php if ($service->service_in_downtime): ?>
|
|
||||||
<a href="#" title="In Downtime">
|
|
||||||
<i class="icon-table icinga-icon-in-downtime"></i>
|
|
||||||
</a>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<?php if (!$service->service_active_checks_enabled): ?>
|
|
||||||
<?php if (!$service->service_passive_checks_enabled): ?>
|
|
||||||
<a href="#" title="Active And Passive Checks Disabled">
|
|
||||||
<i class="icon-table icinga-icon-active-passive-checks-disabled"></i>
|
|
||||||
</a>
|
|
||||||
<?php else: ?>
|
|
||||||
<a href="#" title="Active Checks Disabled">
|
|
||||||
<i class="icon-table icinga-icon-active-checks-disabled"></i>
|
|
||||||
</a>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<?php if (isset($service->service_last_comment) && $service->service_last_comment !== null): ?>
|
|
||||||
<a href="#" title="Comments">
|
|
||||||
<i class="icon-table icinga-icon-comment"></i>
|
|
||||||
</a>
|
|
||||||
<?php endif; ?>
|
|
||||||
</td>
|
|
||||||
-->
|
|
||||||
<td class="state" title="<?= $helper->getStateTitle($service, 'service'); ?>">
|
|
||||||
<?= $this->timeSince($service->service_last_state_change); ?>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<?= $this->perfdata($service->service_perfdata, true) ?>
|
|
||||||
<a href="<?= $serviceLink ?>"><?= $service->service_display_name ?></a> on <a href="<?= $hostLink ?>"><?= $service->host_name; ?></a><br />
|
|
||||||
<div class="pluginoutput">
|
|
||||||
<?= $this->escape(substr(strip_tags($service->service_output), 0, 10000)); ?>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
@ -54,35 +54,30 @@ foreach ($services as $service):
|
|||||||
<?php if (!$service->service_handled && $service->service_state > 0): ?>
|
<?php if (!$service->service_handled && $service->service_state > 0): ?>
|
||||||
<?= $this->img('img/icons/unhandled.png', array(
|
<?= $this->img('img/icons/unhandled.png', array(
|
||||||
'title' => 'Unhandled',
|
'title' => 'Unhandled',
|
||||||
'align' => 'right'
|
|
||||||
)) ?>
|
)) ?>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
||||||
<?php if ($service->service_acknowledged && !$service->service_in_downtime): ?>
|
<?php if ($service->service_acknowledged && !$service->service_in_downtime): ?>
|
||||||
<?= $this->img('img/icons/acknowledgement.png', array(
|
<?= $this->img('img/icons/acknowledgement.png', array(
|
||||||
'title' => 'Acknowledged',
|
'title' => 'Acknowledged',
|
||||||
'align' => 'right'
|
|
||||||
)) ?>
|
)) ?>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
||||||
<?php if ($service->service_is_flapping): ?>
|
<?php if ($service->service_is_flapping): ?>
|
||||||
<?= $this->img('img/icons/flapping.png', array(
|
<?= $this->img('img/icons/flapping.png', array(
|
||||||
'title' => 'Flapping',
|
'title' => 'Flapping',
|
||||||
'align' => 'right'
|
|
||||||
)) ?>
|
)) ?>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
||||||
<?php if (!$service->service_notifications_enabled): ?>
|
<?php if (!$service->service_notifications_enabled): ?>
|
||||||
<?= $this->img('img/icons/notification_disabled.png', array(
|
<?= $this->img('img/icons/notification_disabled.png', array(
|
||||||
'title' => 'Notifications Disabled',
|
'title' => 'Notifications Disabled',
|
||||||
'align' => 'right'
|
|
||||||
)) ?>
|
)) ?>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
||||||
<?php if ($service->service_in_downtime): ?>
|
<?php if ($service->service_in_downtime): ?>
|
||||||
<?= $this->img('img/icons/in_downtime.png', array(
|
<?= $this->img('img/icons/in_downtime.png', array(
|
||||||
'title' => 'In Downtime',
|
'title' => 'In Downtime',
|
||||||
'align' => 'right'
|
|
||||||
)) ?>
|
)) ?>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
||||||
@ -90,12 +85,10 @@ foreach ($services as $service):
|
|||||||
<?php if (!$service->service_passive_checks_enabled): ?>
|
<?php if (!$service->service_passive_checks_enabled): ?>
|
||||||
<?= $this->img('img/icons/active_passive_checks_disabled.png', array(
|
<?= $this->img('img/icons/active_passive_checks_disabled.png', array(
|
||||||
'title' => 'Active And Passive Checks Disabled',
|
'title' => 'Active And Passive Checks Disabled',
|
||||||
'align' => 'right'
|
|
||||||
)) ?>
|
)) ?>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<?= $this->img('img/icons/active_checks_disabled.png', array(
|
<?= $this->img('img/icons/active_checks_disabled.png', array(
|
||||||
'title' => 'Active Checks Disabled',
|
'title' => 'Active Checks Disabled',
|
||||||
'align' => 'right'
|
|
||||||
)) ?>
|
)) ?>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user