Exemplo n.º 1
0
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
**/
require_once dirname(__FILE__) . '/include/config.inc.php';
require_once dirname(__FILE__) . '/include/hosts.inc.php';
require_once dirname(__FILE__) . '/include/graphs.inc.php';
$page['title'] = _('Custom graphs');
$page['file'] = 'charts.php';
$page['hist_arg'] = array('hostid', 'groupid', 'graphid');
$page['scripts'] = array('class.calendar.js', 'gtlc.js', 'flickerfreescreen.js');
$page['type'] = detect_page_type(PAGE_TYPE_HTML);
define('ZBX_PAGE_DO_JS_REFRESH', 1);
ob_start();
require_once dirname(__FILE__) . '/include/page_header.php';
// VAR	TYPE	OPTIONAL	FLAGS	VALIDATION	EXCEPTION
$fields = array('groupid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null), 'hostid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null), 'graphid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null), 'period' => array(T_ZBX_INT, O_OPT, P_SYS, null, null), 'stime' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'fullscreen' => array(T_ZBX_INT, O_OPT, P_SYS, IN('0,1'), null), 'filterState' => array(T_ZBX_INT, O_OPT, P_ACT, null, null), 'favobj' => array(T_ZBX_STR, O_OPT, P_ACT, null, null), 'favid' => array(T_ZBX_INT, O_OPT, P_ACT, null, null), 'favaction' => array(T_ZBX_STR, O_OPT, P_ACT, IN('"add","remove"'), null));
check_fields($fields);
/*
 * Permissions
 */
if (getRequest('groupid') && !API::HostGroup()->isReadable(array($_REQUEST['groupid']))) {
    access_deny();
}
if (getRequest('hostid') && !API::Host()->isReadable(array($_REQUEST['hostid']))) {
    access_deny();
}
Exemplo n.º 2
0
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
**/
require_once dirname(__FILE__) . '/include/config.inc.php';
require_once dirname(__FILE__) . '/include/maps.inc.php';
$page['title'] = _('Logo');
$page['file'] = 'zbxe-customer-logo.php';
$page['type'] = detect_page_type(PAGE_TYPE_IMAGE);
require_once dirname(__FILE__) . '/include/page_header.php';
// VAR	TYPE	OPTIONAL	FLAGS	VALIDATION		EXCEPTION
$fields = array('sysmapid' => array(T_ZBX_INT, O_MAND, P_SYS, DB_ID, null), 'selements' => array(T_ZBX_STR, O_OPT, P_SYS, DB_ID, null), 'links' => array(T_ZBX_STR, O_OPT, P_SYS, DB_ID, null), 'noselements' => array(T_ZBX_INT, O_OPT, null, IN('0,1'), null), 'nolinks' => array(T_ZBX_INT, O_OPT, null, IN('0,1'), null), 'nocalculations' => array(T_ZBX_INT, O_OPT, null, IN('0,1'), null), 'expand_macros' => array(T_ZBX_INT, O_OPT, null, IN('0,1'), null), 'show_triggers' => array(T_ZBX_INT, O_OPT, P_SYS, IN('0,1,2,3'), null), 'severity_min' => array(T_ZBX_INT, O_OPT, null, IN('0,1,2,3,4,5'), null), 'grid' => array(T_ZBX_INT, O_OPT, null, BETWEEN(0, 500), null), 'base64image' => array(T_ZBX_INT, O_OPT, null, IN('0,1'), null));
check_fields($fields);
$maps = API::Map()->get(array('sysmapids' => $_REQUEST['sysmapid'], 'selectSelements' => API_OUTPUT_EXTEND, 'selectLinks' => API_OUTPUT_EXTEND, 'output' => API_OUTPUT_EXTEND, 'preservekeys' => true));
$map = reset($maps);
if (empty($map)) {
    access_deny();
}
$mapPainter = new CMapPainter($map, array('map' => array('drawAreas' => !isset($_REQUEST['selements']) && !isset($_REQUEST['noselements'])), 'grid' => array('size' => get_request('grid', 0))));
$im = $mapPainter->paint();
$colors['Red'] = imagecolorallocate($im, 255, 0, 0);
$colors['Dark Red'] = imagecolorallocate($im, 150, 0, 0);
$colors['Green'] = imagecolorallocate($im, 0, 255, 0);
$colors['Dark Green'] = imagecolorallocate($im, 0, 150, 0);
Exemplo n.º 3
0
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
**/
require_once dirname(__FILE__) . '/include/config.inc.php';
require_once dirname(__FILE__) . '/include/forms.inc.php';
require_once dirname(__FILE__) . '/include/regexp.inc.php';
$page['title'] = _('Configuration of regular expressions');
$page['file'] = 'adm.regexps.php';
$page['type'] = detect_page_type();
require_once dirname(__FILE__) . '/include/page_header.php';
// VAR	TYPE	OPTIONAL	FLAGS	VALIDATION	EXCEPTION
$fields = ['regexpids' => [T_ZBX_INT, O_OPT, P_SYS, DB_ID, null], 'regexpid' => [T_ZBX_INT, O_OPT, P_SYS, DB_ID, 'isset({form}) && {form} == "update"'], 'name' => [T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({add}) || isset({update})', _('Name')], 'test_string' => [T_ZBX_STR, O_OPT, P_NO_TRIM, null, 'isset({add}) || isset({update})', _('Test string')], 'expressions' => [T_ZBX_STR, O_OPT, P_NO_TRIM, null, 'isset({add}) || isset({update})'], 'action' => [T_ZBX_STR, O_OPT, P_SYS | P_ACT, IN('"regexp.massdelete"'), null], 'add' => [T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null], 'update' => [T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null], 'form' => [T_ZBX_STR, O_OPT, P_SYS, null, null], 'form_refresh' => [T_ZBX_INT, O_OPT, null, null, null], 'output' => [T_ZBX_STR, O_OPT, P_ACT, null, null], 'ajaxaction' => [T_ZBX_STR, O_OPT, P_ACT, null, null], 'ajaxdata' => [T_ZBX_STR, O_OPT, P_ACT | P_NO_TRIM, null, null]];
check_fields($fields);
/*
 * Ajax
 */
if (isset($_REQUEST['output']) && $_REQUEST['output'] == 'ajax') {
    $ajaxResponse = new CAjaxResponse();
    $ajaxData = getRequest('ajaxdata', []);
    if (isset($_REQUEST['ajaxaction']) && $_REQUEST['ajaxaction'] == 'test') {
        $result = ['expressions' => [], 'errors' => [], 'final' => true];
        $validator = new CRegexValidator(['messageInvalid' => _('Regular expression must be a string'), 'messageRegex' => _('Incorrect regular expression "%1$s": "%2$s"')]);
        foreach ($ajaxData['expressions'] as $id => $expression) {
            if (!in_array($expression['expression_type'], [EXPRESSION_TYPE_FALSE, EXPRESSION_TYPE_TRUE]) || $validator->validate($expression['expression'])) {
Exemplo n.º 4
0
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**/
require_once 'include/config.inc.php';
$page['title'] = "RPC";
$page['file'] = 'jsrpc.php';
$page['hist_arg'] = array();
$page['type'] = detect_page_type(PAGE_TYPE_JSON);
include_once 'include/page_header.php';
//		VAR				TYPE	OPTIONAL FLAGS	VALIDATION	EXCEPTION
$fields = array();
check_fields($fields);
// ACTION /////////////////////////////////////////////////////////////////////////////
$http_request = new CHTTP_request();
$data = $http_request->body();
$json = new CJSON();
$data = $json->decode($data, true);
if (!is_array($data)) {
    fatal_error('Wrong RPC call to JS RPC');
}
if (!isset($data['method']) || !isset($data['params'])) {
    fatal_error('Wrong RPC call to JS RPC');
}
Exemplo n.º 5
0
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
**/
require_once dirname(__FILE__) . '/include/config.inc.php';
$requestType = getRequest('type', PAGE_TYPE_JSON);
if ($requestType == PAGE_TYPE_JSON) {
    $http_request = new CHttpRequest();
    $json = new CJson();
    $data = $json->decode($http_request->body(), true);
} else {
    $data = $_REQUEST;
}
$page['title'] = 'RPC';
$page['file'] = 'jsrpc.php';
$page['hist_arg'] = array();
$page['type'] = detect_page_type($requestType);
require_once dirname(__FILE__) . '/include/page_header.php';
if (!is_array($data) || !isset($data['method']) || $requestType == PAGE_TYPE_JSON && (!isset($data['params']) || !is_array($data['params']))) {
    fatal_error('Wrong RPC call to JS RPC!');
}
$result = array();
switch ($data['method']) {
    case 'host.get':
        $result = API::Host()->get(array('startSearch' => true, 'search' => $data['params']['search'], 'output' => array('hostid', 'host', 'name'), 'sortfield' => 'name', 'limit' => 15));
        break;
    case 'message.mute':
        $msgsettings = getMessageSettings();
        $msgsettings['sounds.mute'] = 1;
        updateMessageSettings($msgsettings);
        break;
    case 'message.unmute':
Exemplo n.º 6
0
    $USER_DETAILS = array('alias' => ZBX_GUEST_USER, 'userid' => 0, 'lang' => 'en_gb', 'type' => '0', 'node' => array('name' => '- unknown -', 'nodeid' => 0));
}
include_once 'include/locales/en_gb.inc.php';
process_locales();
set_zbx_locales();
// INIT MB Strings if it's available
init_mbstrings();
/*
//Require MB strings, otherwise show warning page.
	if(!isset($show_setup) && !isset($show_warning) && !init_mbstrings()){
		$_REQUEST['warning_msg'] = S_ZABBIX.SPACE.ZABBIX_VERSION.SPACE.S_REQUIRE_MB_STRING_MODULE;
		$show_warning = true;
	}
//*/
// Ajax - do not need warnings or Errors
if ((isset($DENY_GUI) || isset($show_setup) || isset($show_warning)) && PAGE_TYPE_HTML != detect_page_type()) {
    header('Ajax-response: false');
    exit;
}
//---
if (isset($DENY_GUI)) {
    unset($show_warning);
    include_once 'warning.php';
}
if (isset($show_setup)) {
    unset($show_setup);
    include_once 'setup.php';
} else {
    if (isset($show_warning)) {
        unset($show_warning);
        include_once 'warning.php';