function loadItems()
 {
     $membersFound = array('' => '---');
     $query = 'SELECT  `hostgroup_id`, `hostgroup_name` FROM `' . 'hostgroup` WHERE (user_id=' . $this->user->getUserID() . ')  ORDER BY  hostgroup_name ';
     $membersFoundArray = EaseShared::myDbLink()->queryToArray($query);
     if (count($membersFoundArray)) {
         foreach ($membersFoundArray as $request) {
             $membersFound[$request['hostgroup_id']] = $request['hostgroup_name'];
         }
     }
     return $membersFound;
 }
 /**
  * Editor k přidávání členů skupiny
  *
  * @param string $fieldName    název políčka formuláře
  * @param string $fieldCaption popisek políčka
  * @param IEcfg  $dataSource   editovaný objekt
  */
 public function __construct($fieldName, $fieldCaption, $dataSource, $members)
 {
     $iDColumn = $dataSource->keywordsInfo[$fieldName]['refdata']['idcolumn'];
     $nameColumn = $dataSource->keywordsInfo[$fieldName]['refdata']['captioncolumn'];
     $sTable = $dataSource->keywordsInfo[$fieldName]['refdata']['table'];
     if (isset($dataSource->keywordsInfo[$fieldName]['refdata']['condition'])) {
         $conditions = $dataSource->keywordsInfo[$fieldName]['refdata']['condition'];
     } else {
         $conditions = array();
     }
     if (isset($dataSource->keywordsInfo[$fieldName]['refdata']['public']) && intval($dataSource->keywordsInfo[$fieldName]['refdata']['public'])) {
         $sqlConds = " ( " . $dataSource->myDbLink->prepSelect(array_merge($conditions, array($dataSource->userColumn => EaseShared::user()->getUserID()))) . " ) OR ( " . $dataSource->myDbLink->prepSelect(array_merge($conditions, array('public' => 1))) . ")  ";
     } else {
         $sqlConds = $dataSource->myDbLink->prepSelect(array_merge($conditions, array($dataSource->userColumn => EaseShared::user()->getUserID())));
     }
     $initialContent = new EaseTWBPanel($fieldCaption);
     $initialContent->setTagCss(array('width' => '100%'));
     if (is_null($dataSource->getMyKey())) {
         $initialContent->addItem(_('Nejprve je potřeba uložit záznam'));
     } else {
         if ($sTable == $dataSource->myTable) {
             $tmpKey = $dataSource->getMyKey();
             if ($tmpKey) {
                 $members[$tmpKey] = true;
             }
         }
         if ($members && count($members)) {
             $aviavbleCond = 'AND ' . $iDColumn . ' NOT IN (' . join(',', array_keys($members)) . ') ';
         } else {
             $aviavbleCond = '';
         }
         $membersAviableArray = EaseShared::myDbLink()->queryToArray('SELECT ' . $nameColumn . ', ' . $iDColumn . ' ' . 'FROM `' . $sTable . '` ' . 'WHERE (' . $sqlConds . ') ' . $aviavbleCond . 'ORDER BY ' . $nameColumn, $iDColumn);
         if ($sTable == $dataSource->myTable) {
             unset($members[$dataSource->getMyKey()]);
         }
         $addText = _('Přiřadit');
         $delText = _('Odebrat');
         if (count($membersAviableArray)) {
             foreach ($membersAviableArray as $memberID => $memberName) {
                 $reftable = $dataSource->keywordsInfo[$fieldName]['refdata']['table'];
                 $initialContent->addItem(new EaseTWBButtonDropdown($memberName[$nameColumn], 'inverse', 'xs', array(new EaseHtmlATag($reftable . '.php?' . $reftable . '_id=' . $memberID, EaseTWBPart::GlyphIcon('wrench') . ' ' . _('Editace')), new EaseHtmlATag(null, EaseTWBPart::GlyphIcon('plus-sign') . ' ' . $addText, array('onClick' => "addGroupMember('" . get_class($dataSource) . "','" . $dataSource->getId() . "','" . $fieldName . "','" . $memberName[$nameColumn] . "','" . $memberID . "')", 'class' => 'handle', 'data-addtext' => $addText, 'data-deltext' => $delText))), array('id' => get_class($dataSource) . '_' . $fieldName . '_' . $memberID, 'style' => 'margin: 1px;')));
             }
         }
         if ($members && count($members)) {
             $initialContent->addItem('</br>');
             foreach ($members as $memberID => $memberName) {
                 $reftable = $dataSource->keywordsInfo[$fieldName]['refdata']['table'];
                 $initialContent->addItem(new EaseTWBButtonDropdown($memberName, 'success', 'xs', array(new EaseHtmlATag($reftable . '.php?' . $reftable . '_id=' . $memberID, EaseTWBPart::GlyphIcon('wrench') . ' ' . _('Editace')), new EaseHtmlATag(null, EaseTWBPart::GlyphIcon('remove') . ' ' . _('Odebrat'), array('onClick' => "delGroupMember('" . get_class($dataSource) . "','" . $dataSource->getId() . "','" . $fieldName . "','" . $memberName . "','" . $memberID . "')", 'class' => 'handle', 'data-addtext' => $addText, 'data-deltext' => $delText))), array('id' => get_class($dataSource) . '_' . $fieldName . '_' . $memberID, 'style' => 'margin: 1px;')));
             }
         }
     }
     parent::__construct($initialContent);
 }
예제 #3
0
 /**
  * Přejmenuje hosta
  *
  * @param string $oldname
  * @param string $newname
  */
 public function renameHost($oldname, $newname)
 {
     $memberOf = EaseShared::myDbLink()->queryToArray('SELECT ' . $this->getmyKeyColumn() . ',' . $this->nameColumn . ' FROM ' . $this->myTable . ' WHERE members LIKE \'%"' . $oldname . '"%\' ', $this->getmyKeyColumn());
     foreach ($memberOf as $groupID => $group) {
         $found = false;
         $this->loadFromMySQL($groupID);
         foreach ($this->data['members'] as $id => $member) {
             if ($member == $oldname) {
                 $found = true;
                 $this->data['members'][$id] = $newname;
                 $this->addStatusMessage(sprintf(_(' %s byl přejmenován na %s ve skupině %s '), $oldname, $newname, $group[$this->nameColumn]));
             }
         }
         if ($found) {
             $this->saveToMySQL();
         }
     }
 }
예제 #4
0
    /**
     * Hlavní menu aplikace
     *
     * @param string $name
     * @param mixed  $content
     * @param array  $properties
     */
    public function __construct($name = null, $content = null, $properties = null)
    {
        parent::__construct("Menu", new \Ease\Html\ImgTag('images/LinkQuickTwitterLogo.png', 'NetspotAdmin', 20, 20, ['class' => 'img-rounded']), ['class' => 'navbar-fixed-top']);
        $user = \Ease\Shared::user();
        \Ease\TWB\Part::twBootstrapize();
        if (!$user->getUserID()) {
            //            $this->addMenuItem('<a href="createaccount.php">' . \Ease\TWB\Part::GlyphIcon('leaf') . ' ' . _('Register') . '</a>', 'right');
            $this->addMenuItem('
<li class="divider-vertical"></li>
<li class="dropdown">
<a class="dropdown-toggle" href="login.php" data-toggle="dropdown"><i class="icon-circle-arrow-left"></i> ' . _('Logon') . '<strong class="caret"></strong></a>
<div class="dropdown-menu" style="padding: 15px; padding-bottom: 0px; left: -120px;">
<form method="post" class="navbar-form navbar-left" action="login.php" accept-charset="UTF-8">
<input class="form-control" style="margin-bottom: 15px;" type="text" placeholder="' . _('Username') . '" id="username" name="login">
<input class="form-control" style="margin-bottom: 15px;" type="password" placeholder="' . _('Password') . '" id="password" name="password">
<!-- input style="float: left; margin-right: 10px;" type="checkbox" name="remember-me" id="remember-me" value="1">
<label class="string optional" for="remember-me"> ' . _('zapamatuj si mne') . '</label -->
<input class="btn btn-primary btn-block" type="submit" id="sign-in" value="' . _('Log in') . '">
</form>
</div>', 'right');
        } else {
            $userID = EaseShared::user()->getUserID();
            if ($userID) {
                $myLinksCount = EaseShared::myDbLink()->queryToValue('SELECT COUNT(*) FROM entry WHERE owner=' . $userID);
            } else {
                $myLinksCount = EaseShared::myDbLink()->queryToValue('SELECT COUNT(*) FROM entry');
            }
            $brand = new \Ease\HtmlDivTag('sitelogo', $myLinksCount, ['class' => 'brand']);
            $this->addMenuItem($brand);
            $userMenu = '<li class="dropdown" style="width: 120px; text-align: right; background-image: url( ' . $user->getIcon() . ' ) ;  background-repeat: no-repeat; background-position: left center; background-size: 40px 40px;"><a href="#" class="dropdown-toggle" data-toggle="dropdown">' . $user->getLogin() . ' <b class="caret"></b></a>
<ul class="dropdown-menu" style="text-align: left; left: -60px;">
<li><a href="settings.php">' . \Ease\TWB\Part::GlyphIcon('wrench') . '<i class="icon-cog"></i> ' . _('Settings') . '</a></li>
';
            $this->addMenuItem($userMenu . '
<li><a href="http://v.s.cz/ease.php">' . \Ease\TWB\Part::GlyphIcon('envelope') . ' ' . _('Developer support') . '</a></li>
<li class="divider"></li>
<li><a href="logout.php">' . \Ease\TWB\Part::GlyphIcon('off') . ' ' . _('Logout') . '</a></li>
</ul>
</li>
', 'right');
        }
    }
예제 #5
0
 /**
  * Editor k přidávání členů skupiny
  *
  * @param IEHost $host
  */
 public function __construct($host)
 {
     parent::__construct();
     $fieldName = $host->getmyKeyColumn();
     $initialContent = new EaseTWBPanel(_('rodiče hostu'));
     $addparentForm = $initialContent->addItem(new EaseTWBForm('addparent'));
     $addparentForm->addItem(new EaseTWBFormGroup(_('IP nebo Hostname'), new EaseHtmlInputTextTag('newparent')));
     $addparentForm->addItem(new EaseHtmlInputHiddenTag($fieldName, $host->getId()));
     $addparentForm->addItem(new EaseTWSubmitButton(_('Přidat rodiče'), 'success'));
     $initialContent->setTagCss(array('width' => '100%'));
     if (is_null($host->getMyKey())) {
         $initialContent->addItem(_('Nejprve je potřeba uložit záznam'));
     } else {
         $allParents = $host->getListing();
         unset($allParents[$host->getID()]);
         //Nenabízet sám sebe jako rodiče
         foreach ($allParents as $parentID => $parentInfo) {
             if ($parentInfo['register'] != 1) {
                 unset($allParents[$parentID]);
             }
         }
         $parentsAssigned = array();
         foreach ($host->getDataValue('parents') as $parentAssigned) {
             $parentID = EaseShared::myDbLink()->queryToValue('SELECT `' . $host->myKeyColumn . '` FROM ' . $host->myTable . ' WHERE `' . $host->nameColumn . '` = \'' . addSlashes($parentAssigned) . '\'');
             $parentsAssigned[$parentID][$host->nameColumn] = $parentAssigned;
             $parentsAssigned[$parentID][$host->myKeyColumn] = $parentID;
             unset($allParents[$parentID]);
         }
         if (count($allParents)) {
             foreach ($allParents as $parentID => $parentInfo) {
                 $initialContent->addItem($this->parentButton($parentInfo, 'plus', $host));
             }
         }
         if (count($parentsAssigned)) {
             $initialContent->addItem('</br>');
             foreach ($parentsAssigned as $parentID => $parentInfo) {
                 $initialContent->addItem($this->parentButton($parentInfo, 'remove', $host));
             }
         }
     }
     $this->addItem($initialContent);
 }
예제 #6
0
 function loadItems()
 {
     $membersFound = array('' => '---');
     $query = 'SELECT  `service_id`, `icon_image`,`platform`,`service_description` FROM `' . 'service` WHERE (user_id=' . $this->user->getUserID() . ' OR public=1) AND register=1 ORDER BY  service_description ';
     $membersFoundArray = EaseShared::myDbLink()->queryToArray($query);
     if (count($membersFoundArray)) {
         foreach ($membersFoundArray as $request) {
             $membersFound[$request['service_id']] = $request['service_description'];
             if (isset($request['icon_image'])) {
                 $icon = $request['icon_image'];
             } else {
                 if (isset($request['platform']) && isset($this->platforms[$request['platform']])) {
                     $icon = $this->platforms[$request['platform']]['image'];
                 } else {
                     $icon = 'logos/unknown.gif';
                 }
             }
             $this->services[$request['service_id']] = array('image' => $icon);
         }
     }
     return $membersFound;
 }
예제 #7
0
 /**
  * Vloží do stránky widget pro editaci hodnoty
  *
  * @param EaseHtmlDivTag $fieldBlock
  * @param string         $fieldName
  * @param mixed          $value
  */
 public function insertWidget($fieldBlock, $fieldName, $value)
 {
     $disabled = false;
     $hint = '';
     $keywordInfo = $this->objectEdited->keywordsInfo[$fieldName];
     $fieldType = $this->objectEdited->useKeywords[$fieldName];
     $fType = preg_replace('/\\(.*\\)/', '', $fieldType);
     $required = isset($keywordInfo['requeired']) && $keywordInfo['requeired'] === true;
     if ($this->objectEdited->allowTemplating) {
         $effective = $this->objectEdited->getCfg($fieldName, true);
         $templateName = key($effective);
         $templateValue = current($effective);
         if ($fType == 'BOOL') {
             EaseShared::webPage()->addJavaScript("\$(\"#useTpl{$fieldName}\").change(function(){\n    if( this.checked ){\n        \$(\"[name='{$fieldName}']\").prop('disabled', true);\n        \$(\"input[name='{$fieldName}']\").bootstrapSwitch('toggleDisabled', true);\n\n    } else {\n        \$(\"[name='{$fieldName}']\").prop('disabled', false);\n        \$(\"input[name='{$fieldName}']\").bootstrapSwitch('toggleDisabled', false);\n    }\n\n});", null, true);
         } else {
             EaseShared::webPage()->addJavaScript("\$(\"#useTpl{$fieldName}\").change(function(){\n    if( this.checked ){\n        \$(\"[name='{$fieldName}']\").prop('disabled', true);\n    } else {\n        \$(\"[name='{$fieldName}']\").prop('disabled', false);\n    }\n\n});", null, true);
         }
         if ($templateName && !is_null($templateValue)) {
             $fieldBlock->addItem(new EaseHtmlCheckboxTag(null, true, 1, array('id' => 'useTpl' . $fieldName)));
             $hint = current($effective);
             $disabled = true;
         } else {
             $fieldBlock->addItem(new EaseHtmlCheckboxTag(null, false, 1, array('id' => 'useTpl' . $fieldName)));
             $hint = $value;
         }
         $fieldBlock->addItem(' ' . _('Hodnota z předlohy') . ':');
         $fieldBlock->addItem(new EaseHtmlATag('search.php?search=' . key($effective), key($effective)));
         $fieldBlock->addItem(': ' . current($effective));
     }
     if ($disabled) {
         EaseShared::webPage()->addJavaScript("\$(\"[name='{$fieldName}']\").prop('disabled', true);", null, true);
     }
     switch ($fType) {
         case 'INT':
         case 'STRING':
         case 'VARCHAR':
             //$fieldBlock->addItem($this->optionEnabler($fieldName));
             if ($required) {
                 $fieldBlock->addItem(new EaseTWBFormGroup($fieldName, new EaseHtmlInputTextTag($fieldName, $value, array('class' => 'required form-control', 'title' => $fieldName)), $hint, $keywordInfo['title']));
                 //                    $fieldBlock->addItem(new EaseHtmlDivTag(null, new EaseLabeledTextInput($fieldName, $value, $keywordInfo['title'], array('class' => 'required form-control', 'title' => $fieldName))));
             } else {
                 $fieldBlock->addItem(new EaseTWBFormGroup($fieldName, new EaseHtmlInputTextTag($fieldName, $value, array('title' => $fieldName, 'class' => 'form-control')), $hint, $keywordInfo['title']));
                 //                    $fieldBlock->addItem(new EaseLabeledTextInput($fieldName, $value, $keywordInfo['title'], array('title' => $fieldName, 'class' => 'form-control')));
             }
             break;
         case 'TINYINT':
         case 'BOOL':
             $fieldBlock->addItem(new EaseTWBFormGroup($keywordInfo['title'], new IEYesNoSwitch($fieldName, $value, 'on', array('id' => $keywordInfo['title'] . 'sw'))));
             break;
         case 'FLAGS':
             $values = array();
             $checkboxes = array();
             $flags = explode(',', str_replace(array($fType, "'", '(', ')'), '', $fieldType));
             foreach ($flags as $flag) {
                 if (isset($keywordInfo[$flag])) {
                     $checkboxes[$flag] = $keywordInfo[$flag];
                 } else {
                     $this->addStatusMessage(_('Chybi definice') . ' ' . $fieldName . ' ' . $flag, 'error');
                 }
             }
             foreach ($checkboxes as $chKey => $chTopic) {
                 $checkboxes[$chKey] = '&nbsp;' . $chTopic . '</br>';
                 if (strchr($value, $chKey)) {
                     $values[$chKey] = true;
                 } else {
                     $values[$chKey] = false;
                 }
             }
             $sliderField = $fieldBlock->addItem(new EaseTWBPanel($keywordInfo['title'], 'default', new EaseHtmlCheckboxGroup($fieldName, $checkboxes, $values)));
             $sliderField->setTagCss(array('width' => '100%'));
             break;
         case 'IDLIST':
             if (!is_array($value)) {
                 $values = array();
             }
             $fieldBlock->addItem(new IEGroupMembersEditor($fieldName, $keywordInfo['title'], $this->objectEdited, $value));
             break;
         case 'SLIDER':
             $sliderField = $fieldBlock->addItem(new EaseTWBPanel($keywordInfo['title'], 'default', new EaseTWBSlider($fieldName, (int) $value, array('data-slider-min' => 0))));
             $sliderField->setTagCss(array('width' => '100%'));
             break;
         case 'TEXT':
             $fieldBlock->addItem(new EaseTWBFormGroup($keywordInfo['title'], new EaseTWBTextarea($fieldName, $value, array('style' => 'width:100%'))));
             break;
         case 'ENUM':
             $flags = explode(',', str_replace(array($fType, "'", '(', ')'), '', $fieldType));
             $selector = $fieldBlock->addItem(new EaseLabeledSelect($fieldName, $value, $keywordInfo['title']));
             $selector->addItems(array_combine($flags, $flags));
             $selector->enclosedElement->setTagCss(array('width' => '100%'));
             $selector->enclosedElement->setTagClass('form-control');
             break;
         case 'PLATFORM':
             $fieldBlock->addItem(new EaseTWBFormGroup($keywordInfo['title'], new IEPlatformSelector($fieldName, null, $value)));
             break;
         case 'RADIO':
             $flags = explode(',', str_replace(array($fType, "'", '(', ')'), '', $fieldType));
             if (is_array($flags)) {
                 foreach (array_values($flags) as $flag) {
                     $infoFlags[$flag] = '&nbsp;' . $keywordInfo[$flag];
                 }
                 $buttons = new EaseHtmlRadiobuttonGroup($fieldName, $infoFlags);
                 $buttons->setValue($value);
                 $FB = $fieldBlock->addItem(new EaseTWBPanel($keywordInfo['title'], 'default', new EaseTWRadioButtonGroup($fieldName, $infoFlags, $value)));
                 $FB->setTagCss(array('width' => '100%'));
             }
             break;
         case 'SELECT':
             $IDColumn = $keywordInfo['refdata']['idcolumn'];
             $nameColumn = $keywordInfo['refdata']['captioncolumn'];
             $sTable = $keywordInfo['refdata']['table'];
             if (isset($keywordInfo['refdata']['condition'])) {
                 $conditions = $keywordInfo['refdata']['condition'];
             } else {
                 $conditions = array();
             }
             $sqlConds = " ( " . $this->objectEdited->myDbLink->prepSelect(array_merge($conditions, array($this->objectEdited->userColumn => EaseShared::user()->getUserID()))) . " ) OR ( " . $this->objectEdited->myDbLink->prepSelect(array_merge($conditions, array('public' => 1))) . ")  ";
             $membersAviableArray = EaseShared::myDbLink()->queryTo2DArray('SELECT ' . $nameColumn . ' ' . 'FROM `' . $sTable . '` ' . 'WHERE ' . $sqlConds . ' ' . 'ORDER BY ' . $nameColumn, $IDColumn);
             $selector = $fieldBlock->addItem(new EaseLabeledSelect($fieldName, $value, $keywordInfo['title']));
             $selector->enclosedElement->setTagClass('form-control');
             if (!$required) {
                 $selector->addItems(array('NULL' => _('Výchozí')));
             }
             if (count($membersAviableArray)) {
                 $selector->addItems(array_combine($membersAviableArray, $membersAviableArray));
             }
             break;
         case 'SELECTID':
             $IDColumn = $keywordInfo['refdata']['idcolumn'];
             $nameColumn = $keywordInfo['refdata']['captioncolumn'];
             $sTable = $keywordInfo['refdata']['table'];
             if (isset($keywordInfo['refdata']['condition'])) {
                 $conditions = $keywordInfo['refdata']['condition'];
             } else {
                 $conditions = array();
             }
             $sqlConds = " ( " . $this->objectEdited->myDbLink->prepSelect(array_merge($conditions, array($this->objectEdited->userColumn => EaseShared::user()->getUserID()))) . " ) OR ( " . $this->objectEdited->myDbLink->prepSelect(array_merge($conditions, array('public' => 1))) . ")  ";
             $membersAviableArray = EaseShared::myDbLink()->queryToArray('SELECT ' . $nameColumn . ',' . $IDColumn . ' ' . 'FROM `' . $sTable . '` ' . 'WHERE ' . $sqlConds . ' ' . 'ORDER BY ' . $nameColumn, $IDColumn);
             $selector = $fieldBlock->addItem(new EaseLabeledSelect($fieldName, $value, $keywordInfo['title']));
             $selector->enclosedElement->setTagClass('form-control');
             if (!$required) {
                 $selector->addItems(array('NULL' => _('Výchozí')));
             }
             if (count($membersAviableArray)) {
                 foreach ($membersAviableArray as $option) {
                     $options[$option[$IDColumn]] = $option[$nameColumn];
                 }
                 $selector->addItems($options);
             }
             break;
         case 'SELECT+PARAMS':
             $IDColumn = $keywordInfo['refdata']['idcolumn'];
             $nameColumn = $keywordInfo['refdata']['captioncolumn'];
             $sTable = $keywordInfo['refdata']['table'];
             if (isset($keywordInfo['refdata']['condition'])) {
                 $conditions = $keywordInfo['refdata']['condition'];
             } else {
                 $conditions = array();
             }
             $conditions['command_type'] = 'check';
             $sqlConds = " ( " . $this->objectEdited->myDbLink->prepSelect(array_merge($conditions, array('command_local' => true, $this->objectEdited->userColumn => EaseShared::user()->getUserID()))) . " ) OR ( " . $this->objectEdited->myDbLink->prepSelect($conditions) . " AND public=1 )  ";
             //                    $SqlConds = $this->ObjectEdited->myDbLink->prepSelect(array_merge($Conditions, array($this->ObjectEdited->userColumn => EaseShared::user()->getUserID())));
             if (isset($this->objectEdited->keywordsInfo['platform'])) {
                 $platform = $this->objectEdited->getDataValue('platform');
                 $sqlConds .= " AND ((`platform` =  '" . $platform . "') OR (`platform` = 'generic') OR (`platform` IS NULL) OR (`platform`='') ) ";
             }
             $membersAviableArray = EaseShared::myDbLink()->queryTo2DArray('SELECT ' . $nameColumn . ' ' . 'FROM `' . $sTable . '` ' . 'WHERE ' . $sqlConds . ' ' . 'ORDER BY ' . $nameColumn, $IDColumn);
             $selector = $fieldBlock->addItem(new EaseLabeledSelect($fieldName, $value, $keywordInfo['title']));
             $selector->enclosedElement->setTagClass('form-control');
             if (!$required) {
                 $selector->addItems(array('' => ''));
             }
             if (count($membersAviableArray)) {
                 $selector->addItems(array_combine($membersAviableArray, $membersAviableArray));
             }
             $sqlConds = " ( " . $this->objectEdited->myDbLink->prepSelect(array_merge($conditions, array('command_remote' => true, $this->objectEdited->userColumn => EaseShared::user()->getUserID()))) . " ) OR ( " . $this->objectEdited->myDbLink->prepSelect($conditions) . " AND public=1 )  ";
             //                    $SqlConds = $this->ObjectEdited->myDbLink->prepSelect(array_merge($Conditions, array($this->ObjectEdited->userColumn => EaseShared::user()->getUserID())));
             $membersAviableArray = EaseShared::myDbLink()->queryTo2DArray('SELECT ' . $nameColumn . ' ' . 'FROM `' . $sTable . '` ' . 'WHERE ' . $sqlConds . ' ' . 'ORDER BY ' . $nameColumn, $IDColumn);
             $addNewItem = $fieldBlock->addItem(new EaseHtmlInputSearchTag($fieldName . '-remote', $this->objectEdited->getDataValue($fieldName . '-remote'), array('class' => 'search-input', 'title' => _('vzdálený test'))));
             $addNewItem->setDataSource('jsoncommand.php?maxRows=10');
             $fieldBlock->addItem(new EaseLabeledTextInput($fieldName . '-params', $this->objectEdited->getDataValue($fieldName . '-params'), _('Parametry'), array('style' => 'width: 100%')));
             break;
         case 'USER':
             $fieldBlock->addItem(new IEUserSelect($fieldName, null, $this->objectEdited->getDataValue($fieldName), null, array('style' => 'width: 100%')));
             break;
         default:
             $fieldBlock->addItem(new EaseLabeledTextInput($fieldName, $value, $keywordInfo['title'], array('title' => $fieldName)));
             $this->addStatusMessage(sprintf(_('Neznámý typ %s pro sloupec %s'), $fType, $fieldName), 'warning');
             break;
     }
 }
예제 #8
0
     }
     break;
 case 'rename':
     $newname = $oPage->getRequestValue('newname');
     if (strlen($newname)) {
         if ($host->rename($newname)) {
             $oUser->addStatusMessage(_('Host byl přejmenován'), 'success');
         } else {
             $oUser->addStatusMessage(_('Host nebyl přejmenován'), 'warning');
         }
     }
     break;
 case 'parent':
     $np = $oPage->getRequestValue('newparent');
     if ($np) {
         $newParent = EaseShared::myDbLink()->queryToValue('SELECT `' . $host->nameColumn . '` FROM ' . $host->myTable . ' ' . 'WHERE `' . $host->nameColumn . '` = \'' . addSlashes($np) . '\' ' . 'OR `alias` = \'' . addSlashes($np) . '\' ' . 'OR `address` = \'' . addSlashes($np) . '\' ' . 'OR `address6` = \'' . addSlashes($np) . '\' ');
         if (!$newParent) {
             $oUser->addStatusMessage(_('Rodič nebyl nalezen'), 'warning');
             $oPage->redirect('watchroute.php?action=parent&host_id=' . $host->getId() . '&ip=' . $np);
             exit;
         } else {
             $currentParents = $host->getDataValue('parents');
             $currentParents[] = $newParent;
             $host->setDataValue('parents', $currentParents);
             $hostID = $host->saveToMySQL();
             if (is_null($hostID)) {
                 $oUser->addStatusMessage(_('Rodič nebyl přidán'), 'warning');
             } else {
                 $oUser->addStatusMessage(_('Rodič byl přidán'), 'success');
             }
         }
예제 #9
0
if (!$oUser->GetUserID()) {
    die(_('nejprve se prosím přihlaš'));
}
header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Content-type: application/json');
$request = $oPage->getRequestValue('term');
$platform = $oPage->getRequestValue('platform');
$source = $oPage->getRequestValue('source', 'array');
$limit = $oPage->getRequestValue('maxRows', 'int');
if ($limit) {
    $limit = 'LIMIT ' . $limit;
} else {
    $limit = '';
}
$membersFound = array();
if ($request) {
    if ($platform) {
        $sqlConds = " AND ((`platform` =  '" . $platform . "') OR (`platform` = 'generic') OR (`platform` IS NULL) OR (`platform`='') ) ";
    } else {
        $sqlConds = '';
    }
    $query = 'SELECT `command_name` FROM `command` WHERE command_type=\'check\' AND (user_id=' . $oUser->getUserID() . ' OR public=1) AND command_name LIKE \'%' . EaseShared::myDbLink()->AddSlashes($request) . '%\' ' . $sqlConds . ' ORDER BY command_name ' . $limit;
    $membersFoundArray = EaseShared::myDbLink()->queryToArray($query);
    if (count($membersFoundArray)) {
        foreach ($membersFoundArray as $request) {
            $membersFound[] = $request['command_name'];
        }
    }
}
echo json_encode($membersFound);
예제 #10
0
/**
 * Vrací jSon
 * @package IcingaEditor
 */
require_once 'includes/IEInit.php';
$oPage->onlyForLogged();
if (!$oUser->GetUserID()) {
    die(_('nejprve se prosím přihlaš'));
}
header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Content-type: application/json');
$request = $oPage->getRequestValue('term');
$source = $oPage->getRequestValue('source', 'array');
$limit = $oPage->getRequestValue('maxRows', 'int');
if ($limit) {
    $limit = 'LIMIT ' . $limit;
} else {
    $limit = '';
}
$membersFound = array();
if ($request) {
    $membersFoundArray = EaseShared::myDbLink()->queryToArray('SELECT ' . current($source) . ' FROM `' . key($source) . '` WHERE user_id=' . $oUser->getUserID() . ' AND ' . current($source) . ' LIKE \'%' . EaseShared::myDbLink()->AddSlashes($request) . '%\' ORDER BY contact_name ' . $limit);
    if (count($membersFoundArray)) {
        foreach ($membersFoundArray as $request) {
            $membersFound[] = $request[current($source)];
        }
    }
}
echo json_encode($membersFound);
예제 #11
0
     } else {
         $check_email = EaseShared::myDbLink()->queryToValue("SELECT COUNT(*) AS total FROM user WHERE email = '" . $oPage->EaseAddSlashes($emailAddress) . "'");
         if ($check_email > 0) {
             $error = true;
             $oUser->addStatusMessage(sprintf(_('Mailová adresa %s je již zaregistrována'), $emailAddress), 'warning');
         }
     }
 }
 if (strlen($password) < 5) {
     $error = true;
     $oUser->addStatusMessage(_('heslo je příliš krátké'), 'warning');
 } elseif ($password != $confirmation) {
     $error = true;
     $oUser->addStatusMessage(_('kontrola hesla nesouhlasí'), 'warning');
 }
 $usedLogin = EaseShared::myDbLink()->QueryToValue('SELECT id FROM user WHERE login=\'' . $oPage->EaseAddSlashes($login) . '\'');
 if ($usedLogin) {
     $error = true;
     $oUser->addStatusMessage(sprintf(_('Zadané uživatelské jméno %s je již v databázi použito. Zvolte prosím jiné.'), $login), 'warning');
 }
 if ($error == false) {
     $newOUser = new IEUser();
     //TODO zde by se měly doplnit defaultní hodnoty z konfiguráku registry.php
     $newOUser->setData(array('email' => $emailAddress, 'parent' => (int) $customerParent, 'login' => $login, 'firstname' => $firstname, 'lastname' => $lastname));
     $userID = $newOUser->insertToMySQL();
     if (!is_null($userID)) {
         $newOUser->setMyKey($userID);
         $newOUser->passwordChange($password);
         if ($userID == 0) {
             $newOUser->setSettingValue('admin', TRUE);
             $oUser->addStatusMessage(_('Administrátirský účet byl vytvořen'), 'success');