예제 #1
0
 /**
  * Zpracování formuláře
  *
  * @return boolean
  */
 public function reconfigureService()
 {
     $config = array();
     $page = EaseShared::webPage();
     foreach ($page->getRequestValues() as $key => $value) {
         switch ($key) {
             case 'ShowAll':
                 if ($value) {
                     $config[] = 'ShowAll';
                 }
                 break;
             case 'MaxWarn':
             case 'MaxCrit':
             case 'MinWarn':
             case 'MinCrit':
             case 'warn':
             case 'crit':
             case 'type':
                 if ($value) {
                     $config[] = $key . '=' . $value;
                 }
                 break;
             default:
                 break;
         }
     }
     if (count($config)) {
         $this->tweaker->service->setDataValue('check_command-params', implode(' ', $config));
         return parent::reconfigureService();
     }
     return FALSE;
 }
예제 #2
0
 /**
  * Zpracování formuláře
  * 
  * @return boolean
  */
 public function reconfigureService()
 {
     $page = EaseShared::webPage();
     $wt = $page->getRequestValue('wt', 'float');
     $ct = $page->getRequestValue('ct', 'float');
     $wp = str_replace('%', '', $page->getRequestValue('wp'));
     $cp = str_replace('%', '', $page->getRequestValue('cp'));
     if ($wt && $ct && $wp && $cp) {
         $command = $wt . ',' . $wp . '%!' . $ct . ',' . $cp . '%';
         $this->tweaker->service->setDataValue('check_command-params', $command);
         return parent::reconfigureService();
     }
     return FALSE;
 }
예제 #3
0
 /**
  * Zpracování formuláře
  * 
  * @return boolean
  */
 public function reconfigureService()
 {
     $page = EaseShared::webPage();
     $testUrl = $page->getRequestValue('testUrl');
     $reqText = $page->getRequestValue('reqText');
     $errText = $page->getRequestValue('errText');
     if ($testUrl && $reqText) {
         if (substr($testUrl, 0, 4) != 'http') {
             $testUrl = 'http://' . $testUrl;
         }
         $regex = "((https?|ftp)\\:\\/\\/)?";
         // SCHEME
         $regex .= "([a-z0-9+!*(),;?&=\$_.-]+(\\:[a-z0-9+!*(),;?&=\$_.-]+)?@)?";
         // User and Pass
         $regex .= "([a-z0-9-.]*)\\.([a-z]{2,3})";
         // Host or IP
         $regex .= "(\\:[0-9]{2,5})?";
         // Port
         $regex .= "(\\/([a-z0-9+\$_-]\\.?)+)*\\/?";
         // Path
         $regex .= "(\\?[a-z+&\$_.-][a-z0-9;:@&%=+\\/\$_.-]*)?";
         // GET Query
         $regex .= "(#[a-z_.-][a-z0-9+\$_.-]*)?";
         // Anchor
         if (!preg_match("/^{$regex}\$/", $testUrl)) {
             $page->addStatusMessage(_('Neplatné url'), 'error');
             return false;
         }
         $command = $testUrl . '!' . $reqText;
         $command .= '!' . $errText;
         $command .= '!10';
         //Timeout
         $this->tweaker->service->setDataValue('check_command-params', $command);
         return parent::reconfigureService();
     }
     return FALSE;
 }
 /**
  * Zpracování formuláře
  *
  * @return boolean
  */
 public function reconfigureService()
 {
     $config = array();
     $page = EaseShared::webPage();
     foreach ($page->getRequestValues() as $key => $value) {
         switch ($key) {
             case 'NetDrive':
             case 'Drive':
                 if ($value == 'CheckAll') {
                     $config['Drive'] = 'CheckAll';
                     $this->tweaker->service->setDataValue($this->tweaker->service->nameColumn, _('Všechny jednotky'));
                 } else {
                     if (strlen(trim($value)) && $value != '\\\\') {
                         if (strstr($value, '\\\\')) {
                             $config['Drive'] = 'Drive=' . $value;
                             $this->tweaker->service->setDataValue($this->tweaker->service->nameColumn, IENSCPConfigGenerator::stripServiceName(_('NetDisk') . ' ' . $value));
                             $this->tweaker->service->setDataValue('display_name', sprintf(_('Volné místo síťové jednotky %s: '), $value));
                         } else {
                             $config['Drive'] = 'Drive=' . $value . ':';
                             $this->tweaker->service->setDataValue($this->tweaker->service->nameColumn, _('Disk') . ' ' . strtoupper($value) . ':');
                             $this->tweaker->service->setDataValue('display_name', sprintf(_('Volné místo disku %s: '), strtoupper($value)));
                         }
                     }
                 }
                 break;
             case 'ShowAll':
                 if ($value) {
                     $config[] = 'ShowAll';
                 }
                 break;
             case 'MaxWarn':
             case 'MaxCrit':
             case 'MinWarn':
             case 'MinCrit':
             case 'MaxWarnFree':
             case 'MaxCritFree':
             case 'MinWarnFree':
             case 'MinCritFree':
             case 'MaxWarnUsed':
             case 'MaxCritUsed':
             case 'MinWarnUsed':
             case 'MinCritUsed':
                 if ($value) {
                     $config[] = $key . '=' . $value;
                 }
                 break;
             default:
                 break;
         }
     }
     if (count($config)) {
         $this->tweaker->service->setDataValue('check_command-params', implode(' ', $config));
         return parent::reconfigureService();
     }
     return FALSE;
 }