예제 #1
0
 /**
  * Vrací hash vypočítaný z aktuální konfigurace hosta
  */
 function getConfigHash()
 {
     $configuration = array();
     $service = new IEService();
     $servicesAssigned = $service->myDbLink->queryToArray('SELECT `' . $service->getmyKeyColumn() . '` FROM ' . $service->myTable . ' WHERE host_name LIKE \'%"' . $this->getName() . '"%\'', $service->myKeyColumn);
     foreach ($servicesAssigned as $serviceAssigned) {
         $service->loadFromSQL((int) $serviceAssigned[$service->myKeyColumn]);
         $service->unsetDataValue('display_name');
         //Položky které se mohou měnit bez nutnosti aktualizovat senzor
         $service->unsetDataValue('service_description');
         $service->unsetDataValue('host_name');
         $service->unsetDataValue('hostgroup_name');
         $service->unsetDataValue('notes');
         $service->unsetDataValue('notes_url');
         $service->unsetDataValue('action_url');
         $service->unsetDataValue('icon_image');
         $service->unsetDataValue('icon_image_alt');
         $service->unsetDataValue('public');
         $service->unsetDataValue('user_id');
         $service->unsetDataValue($service->myLastModifiedColumn);
         $configuration[] = $service->getEffectiveCfg();
     }
     return hash('md5', $this->getName() . serialize($configuration));
 }
예제 #2
0
/**
 * Icinga Editor služby
 *
 * @package    IcingaEditor
 * @subpackage WebUI
 * @author     Vitex <*****@*****.**>
 * @copyright  2012 Vitex@hippy.cz (G)
 */
require_once 'includes/IEInit.php';
$oPage->onlyForLogged();
$service = new IEService($oPage->getRequestValue('service_id', 'int'));
$host = new IEHost($oPage->getRequestValue('host_id', 'int'));
switch ($oPage->getRequestValue('action')) {
    case 'clone':
        $service->setDataValue('parent_id', $service->getId());
        $service->unsetDataValue($service->getmyKeyColumn());
        $service->addMember('host_name', $host->getId(), $host->getName());
        $service->setDataValue('hostgroup_name', array());
        $service->setDataValue('user_id', $oUser->getID());
        $service->setDataValue($service->nameColumn, _('Klon') . ' ' . $service->getName());
        if ($service->saveToMySQL()) {
            $oUser->addStatusMessage(_('Služba byla naklonována'), 'success');
            $oPage->redirect('servicetweak.php?service_id=' . $service->getId() . '&host_id=' . $host->getId());
        } else {
            $oUser->addStatusMessage(_('Sužba nebyla naklonována'), 'warning');
        }
        break;
    case 'rename':
        $newname = $oPage->getRequestValue('newname');
        if (strlen($newname)) {
            if ($service->rename($newname)) {