Esempio n. 1
0
 function stage5()
 {
     $dbType = $this->getConfig('DB_TYPE');
     $frontendSetup = new FrontendSetup();
     $databases = $frontendSetup->getSupportedDatabases();
     $table = new CTable(null, 'requirements');
     $table->setAlign('center');
     $table->addRow(array(new CCol(_('Database type'), 'header'), $databases[$dbType]));
     switch ($dbType) {
         case ZBX_DB_SQLITE3:
             $table->addRow(array(new CCol(_('Database file'), 'header'), $this->getConfig('DB_DATABASE')));
             break;
         default:
             $table->addRow(array(new CCol(_('Database server'), 'header'), $this->getConfig('DB_SERVER')));
             $dbPort = $this->getConfig('DB_PORT');
             $table->addRow(array(new CCol(_('Database port'), 'header'), $dbPort == 0 ? _('default') : $dbPort));
             $table->addRow(array(new CCol(_('Database name'), 'header'), $this->getConfig('DB_DATABASE')));
             $table->addRow(array(new CCol(_('Database user'), 'header'), $this->getConfig('DB_USER')));
             $table->addRow(array(new CCol(_('Database password'), 'header'), preg_replace('/./', '*', $this->getConfig('DB_PASSWORD'))));
             if ($dbType == ZBX_DB_DB2) {
                 $table->addRow(array(new CCol(_('Database schema'), 'header'), $this->getConfig('DB_SCHEMA')));
             }
             break;
     }
     $table->addRow(BR());
     $table->addRow(array(new CCol(_('Zabbix server'), 'header'), $this->getConfig('ZBX_SERVER')));
     $table->addRow(array(new CCol(_('Zabbix server port'), 'header'), $this->getConfig('ZBX_SERVER_PORT')));
     $table->addRow(array(new CCol(_('Zabbix server name'), 'header'), $this->getConfig('ZBX_SERVER_NAME')));
     return array('Please check configuration parameters.', BR(), 'If all is correct, press "Next" button, or "Previous" button to change configuration parameters.', BR(), BR(), $table);
 }
Esempio n. 2
0
 function stage6()
 {
     global $ZBX_CONFIGURATION_FILE;
     show_messages();
     /* Write the new contents */
     if ($f = @fopen($ZBX_CONFIGURATION_FILE, 'w')) {
         if (fwrite($f, $this->getNewConfigurationFileContent())) {
             if (fclose($f)) {
                 if ($this->setConfig('ZBX_CONFIG_FILE_CORRECT', $this->CheckConfigurationFile())) {
                     $this->DISABLE_NEXT_BUTTON = false;
                 }
             }
         }
     }
     clear_messages();
     /* don't show errors */
     $table = new CTable(null, 'requirements');
     $table->setAlign('center');
     $table->addRow(array('Configuration file:', $this->getConfig('ZBX_CONFIG_FILE_CORRECT', false) ? new CSpan(S_OK, 'ok') : new CSpan(S_FAIL, 'fail')));
     /*
     $table->addRow(array('Table creation:',  $this->getConfig('ZBX_TABLES_CREATED', false) ? 
     						new CSpan(S_OK,'ok') :
     						new CSpan(S_FAIL,'fail')
     							));
     
     $table->addRow(array('Data loading:',  $this->getConfig('ZBX_DATA_LOADED', false) ? 
     						new CSpan(S_OK,'ok') :
     						new CSpan(S_FAIL,'fail')
     							));
     */
     return array($table, BR(), $this->DISABLE_NEXT_BUTTON ? array(new CButton('retry', S_RETRY), BR(), BR()) : null, !$this->getConfig('ZBX_CONFIG_FILE_CORRECT', false) ? array('Please install configuration file manualy.', BR(), BR(), 'By pressing "Save configuration file" button download configuration file ', 'and place them into the ', BR(), '"' . $ZBX_CONFIGURATION_FILE . '"', BR(), BR(), new CButton('save_config', "Save configuration file"), BR(), BR()) : null, 'Press the ' . ($this->DISABLE_NEXT_BUTTON ? '"Retry"' : '"Next"') . ' button');
 }
Esempio n. 3
0
 public function bodyToString()
 {
     $res = parent::bodyToString();
     $tbl = new CTable(null, $this->tableclass);
     $tbl->setCellSpacing(0);
     $tbl->setCellPadding(1);
     $tbl->setAlign($this->align);
     // add first row
     if (!is_null($this->title)) {
         $col = new CCol(null, 'form_row_first');
         $col->setColSpan(2);
         if (isset($this->help)) {
             $col->addItem($this->help);
         }
         if (isset($this->title)) {
             $col->addItem($this->title);
         }
         $tbl->setHeader($col);
     }
     // add last row
     $tbl->setFooter($this->bottom_items);
     // add center rows
     foreach ($this->center_items as $item) {
         $tbl->addRow($item);
     }
     return $res . $tbl->toString();
 }
Esempio n. 4
0
    }
}
ob_end_flush();
/*
 * Display
 */
show_table_header(array(_('ALARM ACKNOWLEDGES') . NAME_DELIMITER, $bulk ? ' BULK ACKNOWLEDGE ' : $eventTriggerName));
echo SBR;
if ($bulk) {
    $title = _('Acknowledge alarm by');
    $saveAndReturnLabel = _('Acknowledge and return');
} else {
    $acknowledges = DBselect('SELECT a.*,u.alias,u.name,u.surname' . ' FROM acknowledges a' . ' LEFT JOIN users u ON u.userid=a.userid' . ' WHERE a.eventid=' . zbx_dbstr($_REQUEST['eventid']));
    if ($acknowledges) {
        $acknowledgesTable = new CTable(null, 'ack_msgs');
        $acknowledgesTable->setAlign('center');
        while ($acknowledge = DBfetch($acknowledges)) {
            $acknowledgesTable->addRow(array(new CCol(getUserFullname($acknowledge), 'user'), new CCol(zbx_date2str(_('d M Y H:i:s'), $acknowledge['clock']), 'time')), 'title');
            $acknowledgesTable->addRow(new CCol(zbx_nl2br($acknowledge['message']), null, 2), 'msg');
        }
        $acknowledgesTable->show();
    }
    if ($eventAcknowledged) {
        $title = _('Add comment by');
        $saveLabel = _('Save');
        $saveAndReturnLabel = _('Save and return');
    } else {
        $title = _('Acknowledge alarm by');
        $saveLabel = _('Acknowledge');
        $saveAndReturnLabel = _('Acknowledge and return');
    }
Esempio n. 5
0
 public function bodyToString()
 {
     parent::bodyToString();
     $tbl = new CTable(NULL, $this->tableclass);
     $tbl->setOddRowClass('form_odd_row');
     $tbl->setEvenRowClass('form_even_row');
     $tbl->setCellSpacing(0);
     $tbl->setCellPadding(1);
     $tbl->setAlign($this->align);
     // add first row
     $col = new CCol(NULL, 'form_row_first');
     $col->setColSpan(2);
     if (isset($this->help)) {
         $col->addItem($this->help);
     }
     if (isset($this->title)) {
         $col->addItem($this->title);
     }
     foreach ($this->top_items as $item) {
         $col->addItem($item);
     }
     $tbl->setHeader($col);
     // add last row
     $tbl->setFooter($this->bottom_items);
     // add center rows
     foreach ($this->center_items as $item) {
         $tbl->addRow($item);
     }
     return $tbl->toString();
 }
Esempio n. 6
0
 function stage6()
 {
     global $ZBX_CONFIGURATION_FILE;
     $this->setConfig('ZBX_CONFIG_FILE_CORRECT', true);
     $config = new CConfigFile($ZBX_CONFIGURATION_FILE);
     $config->config = array('DB' => array('TYPE' => $this->getConfig('DB_TYPE'), 'SERVER' => $this->getConfig('DB_SERVER'), 'PORT' => $this->getConfig('DB_PORT'), 'DATABASE' => $this->getConfig('DB_DATABASE'), 'USER' => $this->getConfig('DB_USER'), 'PASSWORD' => $this->getConfig('DB_PASSWORD'), 'SCHEMA' => $this->getConfig('DB_SCHEMA')), 'ZBX_SERVER' => $this->getConfig('ZBX_SERVER'), 'ZBX_SERVER_PORT' => $this->getConfig('ZBX_SERVER_PORT'), 'ZBX_SERVER_NAME' => $this->getConfig('ZBX_SERVER_NAME'));
     $config->save();
     if ($config->load()) {
         $error = '';
         if ($config->config['DB']['TYPE'] != $this->getConfig('DB_TYPE')) {
             $error = 'Config file DB type is not equal to wizard input.';
         } else {
             if ($config->config['DB']['SERVER'] != $this->getConfig('DB_SERVER')) {
                 $error = 'Config file DB server is not equal to wizard input.';
             } else {
                 if ($config->config['DB']['PORT'] != $this->getConfig('DB_PORT')) {
                     $error = 'Config file DB port is not equal to wizard input.';
                 } else {
                     if ($config->config['DB']['DATABASE'] != $this->getConfig('DB_DATABASE')) {
                         $error = 'Config file DB database is not equal to wizard input.';
                     } else {
                         if ($config->config['DB']['USER'] != $this->getConfig('DB_USER')) {
                             $error = 'Config file DB user is not equal to wizard input.';
                         } else {
                             if ($config->config['DB']['PASSWORD'] != $this->getConfig('DB_PASSWORD')) {
                                 $error = 'Config file DB password is not equal to wizard input.';
                             } else {
                                 if ($this->getConfig('DB_TYPE') == 'IBM_DB2' && $config->config['DB']['SCHEMA'] != $this->getConfig('DB_SCHEMA')) {
                                     $error = 'Config file DB schema is not equal to wizard input.';
                                 } else {
                                     if ($config->config['ZBX_SERVER'] != $this->getConfig('ZBX_SERVER')) {
                                         $error = 'Config file Zabbix server is not equal to wizard input.';
                                     } else {
                                         if ($config->config['ZBX_SERVER_PORT'] != $this->getConfig('ZBX_SERVER_PORT')) {
                                             $error = 'Config file Zabbix server port is not equal to wizard input.';
                                         } else {
                                             if ($config->config['ZBX_SERVER_NAME'] != $this->getConfig('ZBX_SERVER_NAME')) {
                                                 $error = 'Config file Zabbix server name is not equal to wizard input.';
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     } else {
         $error = $config->error;
     }
     clear_messages();
     if (!empty($error)) {
         error($error);
         show_messages();
         $this->setConfig('ZBX_CONFIG_FILE_CORRECT', false);
     }
     $this->DISABLE_NEXT_BUTTON = !$this->getConfig('ZBX_CONFIG_FILE_CORRECT', false);
     $table = new CTable(null, 'requirements');
     $table->setAlign('center');
     $table->addRow(array('Configuration file: ', $this->getConfig('ZBX_CONFIG_FILE_CORRECT', false) ? new CSpan(S_OK, 'ok') : new CSpan(S_FAIL, 'fail')));
     return array($table, BR(), $this->DISABLE_NEXT_BUTTON ? array(new CButton('retry', S_RETRY), BR(), BR()) : null, !$this->getConfig('ZBX_CONFIG_FILE_CORRECT', false) ? array('Please install configuration file manually, or fix permissions on conf directory.', BR(), BR(), 'Press "Save configuration file" button, download configuration file ', 'and save it as ', BR(), '"' . $ZBX_CONFIGURATION_FILE . '"', BR(), BR(), new CButton('save_config', "Save configuration file"), BR(), BR()) : null, 'When done, press the ' . ($this->DISABLE_NEXT_BUTTON ? '"Retry"' : '"Next"') . ' button');
 }
Esempio n. 7
0
function access_deny()
{
    global $USER_DETAILS;
    include_once 'include/page_header.php';
    if ($USER_DETAILS['alias'] != ZBX_GUEST_USER) {
        show_error_message(S_NO_PERMISSIONS);
    } else {
        $req = new Curl($_SERVER['REQUEST_URI']);
        $req->setArgument('sid', null);
        $table = new CTable(null, 'warning');
        $table->setAlign('center');
        $table->setHeader(new CCol(S_CONFIG_ERROR_YOU_ARE_NOT_LOGGED_IN_HEAD, 'left'), 'header');
        $table->addRow(new CCol(array(S_CONFIG_NOT_LOGGED_IN_ACCESS_DENIED, SPACE, bold(ZBX_GUEST_USER), '. ', S_CONFIG_ERROR_YOU_MUST_LOGIN, BR(), S_CONFIG_NOT_LOGGED_IN_NOTE), 'center'));
        $url = urlencode($req->toString());
        $footer = new CCol(array(new CButton('login', S_LOGIN, "javascript: document.location = 'index.php?request={$url}';"), new CButton('back', S_CANCEL, 'javascript: window.history.back();')), 'left');
        $table->setFooter($footer, 'footer');
        $table->show();
    }
    include_once 'include/page_footer.php';
}
Esempio n. 8
0
    define('ZBX_PAGE_NO_MENU', 1);
}
$refresh_rate = 30;
//seconds
$fields = array('warning_msg' => array(T_ZBX_STR, O_OPT, NULL, NULL, NULL), 'message' => array(T_ZBX_STR, O_OPT, NULL, NULL, NULL), 'retry' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, NULL, NULL), 'cancel' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, NULL, NULL));
check_fields($fields, false);
if (isset($_REQUEST['cancel'])) {
    zbx_unsetcookie('ZBX_CONFIG');
    redirect('index.php');
}
//	clear_messages();
$USER_DETAILS['refresh'] = $refresh_rate;
include_once 'include/page_header.php';
unset($USER_DETAILS);
$table = new CTable(null, 'warning');
$table->setAlign('center');
$table->setAttribute('style', 'width: 480px; margin-top: 100px;');
$table->setHeader(array(new CCol(S_ZABBIX . SPACE . ZABBIX_VERSION, 'left')), 'header');
$table->addRow(SPACE);
$warning_msg = isset($_REQUEST['warning_msg']) ? $_REQUEST['warning_msg'] : S_ZABBIX_IS_UNAVAILABLE . '!';
$img = new CImg('./images/general/warning16r.gif', 'warning', 16, 16, 'img');
$img->setAttribute('style', 'border-width: 0px; vertical-align: bottom;');
$msg = new CSpan(bold(SPACE . $warning_msg));
$msg->setAttribute('style', 'line-height: 20px; vertical-align: top;');
$table->addRow(new CCol(array($img, $msg), 'center'));
$table->addRow(SPACE);
$table->setFooter(new CCol(new CButton('retry', S_RETRY, 'javascript: document.location.reload();'), 'left'), 'footer');
$table->show();
zbx_add_post_js('setTimeout("document.location.reload();",' . $refresh_rate * 1000 . ');');
echo SBR;
include_once 'include/page_footer.php';
 function stage5()
 {
     $allowed_db = $this->getConfig('allowed_db', array());
     $DB['TYPE'] = $this->getConfig('DB_TYPE');
     $table = new CTable(null, 'requirements');
     $table->setAlign('center');
     $table->addRow(array(new CCol(_('Database type'), 'header'), $allowed_db[$this->getConfig('DB_TYPE')]));
     switch ($DB['TYPE']) {
         case ZBX_DB_SQLITE3:
             $table->addRow(array(new CCol(_('Database file'), 'header'), $this->getConfig('DB_DATABASE')));
             break;
         default:
             $table->addRow(array(new CCol(_('Database server'), 'header'), $this->getConfig('DB_SERVER')));
             if ($this->getConfig('DB_PORT') == 0) {
                 $table->addRow(array(new CCol(_('Database port'), 'header'), _('default')));
             } else {
                 $table->addRow(array(new CCol(_('Database port'), 'header'), $this->getConfig('DB_PORT')));
             }
             $table->addRow(array(new CCol(_('Database name'), 'header'), $this->getConfig('DB_DATABASE')));
             $table->addRow(array(new CCol(_('Database user'), 'header'), $this->getConfig('DB_USER')));
             $table->addRow(array(new CCol(_('Database password'), 'header'), preg_replace('/./', '*', $this->getConfig('DB_PASSWORD'))));
             if ($this->getConfig('DB_TYPE', '') == ZBX_DB_DB2) {
                 $table->addRow(array(new CCol(_('Database schema'), 'header'), $this->getConfig('DB_SCHEMA')));
             }
             break;
     }
     $table->addRow(BR());
     $table->addRow(array(new CCol(_('Zabbix server'), 'header'), $this->getConfig('ZBX_SERVER')));
     $table->addRow(array(new CCol(_('Zabbix server port'), 'header'), $this->getConfig('ZBX_SERVER_PORT')));
     $table->addRow(array(new CCol(_('Zabbix server name'), 'header'), $this->getConfig('ZBX_SERVER_NAME')));
     return array('Please check configuration parameters.', BR(), 'If all is correct, press "Next" button, or "Previous" button to change configuration parameters.', BR(), BR(), $table);
 }
Esempio n. 10
0
function access_deny()
{
    global $USER_DETAILS;
    include_once 'include/page_header.php';
    if ($USER_DETAILS['alias'] != ZBX_GUEST_USER) {
        show_error_message(S_NO_PERMISSIONS);
    } else {
        $req = new Curl($_SERVER['REQUEST_URI']);
        $req->setArgument('sid', null);
        $warning_msg = array('You cannot view this URL as a ', bold(ZBX_GUEST_USER), '. ', 'You must login to view this page.', BR(), 'If you think this message is wrong, ', ' please consult your administrators about getting the necessary permissions.');
        $table = new CTable(null, 'warning');
        $table->setAlign('center');
        $table->setHeader(new CCol('You are not logged in', 'left'), 'header');
        $table->addRow(new CCol($warning_msg));
        $url = urlencode($req->toString());
        $footer = new CCol(array(new CButton('login', S_LOGIN, "javascript: document.location = 'index.php?request={$url}';"), new CButton('back', S_CANCEL, 'javascript: window.history.back();')), 'left');
        $table->setFooter($footer, 'footer');
        $table->show();
    }
    include_once 'include/page_footer.php';
}