Example #1
0
function get_litecoin($address)
{
    $return = array();
    $data = get_request('http://explorer.litecoin.net/address/' . $address);
    if (!empty($data) && strstr($data, 'Transactions in: ') && strstr($data, 'Received: ')) {
        $return += array('count' => (int) parse($data, 'Transactions in: ', '<br />'), 'amount' => (double) parse($data, 'Received: ', '<br />'));
        return $return;
    }
}
Example #2
0
 protected function checkPostRequestParams($arParams)
 {
     foreach ($arParams['post'] as $strKey => $strValue) {
         if (get_request($strKey, 'POST') !== $strValue) {
             return false;
         }
     }
     return true;
 }
 public function __construct($title = null, $action = null, $method = null, $enctype = null, $form_variable = null)
 {
     $method = is_null($method) ? 'post' : $method;
     parent::__construct($method, $action, $enctype);
     $this->setTitle($title);
     $form_variable = is_null($form_variable) ? 'form' : $form_variable;
     $this->addVar($form_variable, get_request($form_variable, 1));
     $this->bottom_items = new CCol(SPACE, 'form_row_last');
     $this->bottom_items->setColSpan(2);
 }
Example #4
0
 public function __construct($action = NULL, $method = 'post', $enctype = NULL)
 {
     parent::__construct('form', 'yes');
     $this->setMethod($method);
     $this->setAction($action);
     $this->setEnctype($enctype);
     $this->setAttribute('accept-charset', 'utf-8');
     if (isset($_COOKIE['zbx_sessionid'])) {
         $this->addVar('sid', substr($_COOKIE['zbx_sessionid'], 16, 16));
     }
     $this->addVar('form_refresh', get_request('form_refresh', 0) + 1);
 }
Example #5
0
function get_dogecoin($address)
{
    $return = array();
    $recieved_data = get_request('https://chain.so/api/v2/get_address_received/DOGE/' . $address);
    $tx_data = get_request('https://chain.so/api/v2/get_tx_received/DOGE/' . $address);
    if (!empty($recieved_data) && !empty($tx_data)) {
        $recieved_data = json_decode($recieved_data);
        $tx_data = json_decode($tx_data);
        $return += array('count' => (int) count($tx_data->data->txs), 'amount' => (double) $recieved_data->data->confirmed_received_value);
        return $return;
    }
}
Example #6
0
function input($type, $name = '', $placeholder = '')
{
    if (strlen($name) == 0) {
        $name = $type;
    }
    if (strlen($placeholder) == 0) {
        $placeholder = $name;
    }
    $value = get_request($name);
    $input = "<input type=\"{$type}\" name=\"{$name}\" placeholder=\"{$placeholder}\" value=\"{$value}\"/>";
    return $input;
}
Example #7
0
/**
 * returns new MW_Variables with prefilled global values
 */
function new_global_wiki_variables()
{
    $req =& get_request("MW_ActionRequest");
    $auth =& get_auth();
    $vars = new MW_Variables(null);
    $vars->set('wiki_name', config('wiki_name'));
    $vars->set('user', $auth->is_logged ? $auth->user : '');
    $vars->set('main_page', MW_PAGE_NAME_MAIN);
    $action = $req->get_action();
    $vars->set('req_action', $action->get_name());
    return $vars;
}
Example #8
0
function get_request_arg($search, $type = 'INT')
{
    $arg = NULL;
    $query = get_request();
    foreach ($query as $key => $value) {
        if ($value == $search) {
            if (isset($query[$key + 1])) {
                $arg = $query[$key + 1];
            }
        }
    }
    return $type == 'INT' ? intval($arg) : $arg;
}
Example #9
0
 public function __construct($title = null, $action = null, $method = null, $enctype = null, $form_variable = null)
 {
     $this->top_items = array();
     $this->center_items = array();
     $this->bottom_items = array();
     $this->tableclass = 'formtable';
     if (null == $method) {
         $method = 'post';
     }
     if (null == $form_variable) {
         $form_variable = 'form';
     }
     parent::__construct($action, $method, $enctype);
     $this->setTitle($title);
     $this->setAlign('center');
     $this->setHelp();
     $this->addVar($form_variable, get_request($form_variable, 1));
     $this->addVar('form_refresh', get_request('form_refresh', 0) + 1);
     $this->bottom_items = new CCol(SPACE, 'form_row_last');
     $this->bottom_items->setColSpan(2);
 }
function login($name, $password, $permanent)
{
    $_SESSION['name'] = $name;
    $_SESSION['password'] = $password;
    error_log($_SESSION['name'] . ' ' . $_SESSION['password']);
    $response = get_request(get_serverurl() . '/users/' . $name, true);
    if ($response["status"] == 200) {
        $response = json_decode($response["response"], true);
        $_SESSION['mail'] = $response['mail'];
        if ($permanent == true) {
            //ToDo: generate a place and remember me cookie
        }
        return true;
    } else {
        if (isset($_SESSION)) {
            session_destroy();
        }
        $_SESSION['name'] = null;
        $_SESSION['password'] = null;
        return false;
    }
}
function get_resource($url)
{
    $resource = '';
    if (!empty($url)) {
        $response = get_request($url);
        if (!function_exists('str_get_html')) {
            require_once dirname(__FILE__) . '/../vendor/simple-html-dom/simple-html-dom.php';
        }
        if (!function_exists('url_to_absolute')) {
            require_once dirname(__FILE__) . '/../vendor/url-to-absolute/url-to-absolute.php';
        }
        $url_parts = parse_url($url);
        //$body = wp_remote_retrieve_body($response);
        $body = $response;
        $html = str_get_html($body);
        foreach ($html->find('a, link') as $element) {
            if (isset($element->href) && $element->href[0] != "#") {
                $element->href = url_to_absolute($url, $element->href);
            }
        }
        foreach ($html->find('img, script') as $element) {
            if (isset($element->src)) {
                $element->src = url_to_absolute($url, $element->src);
            }
        }
        foreach ($html->find('form') as $element) {
            if (isset($element->action)) {
                $element->action = url_to_absolute($url, $element->action);
            } else {
                $element->action = $url;
            }
        }
        $resource = $html->save();
    }
    return $resource;
}
    $_REQUEST['action'] = -1;
    $_REQUEST['resourcetype'] = -1;
}
$_REQUEST['alias'] = get_request('alias', CProfile::get('web.auditlogs.filter.alias', ''));
$_REQUEST['action'] = get_request('action', CProfile::get('web.auditlogs.filter.action', -1));
$_REQUEST['resourcetype'] = get_request('resourcetype', CProfile::get('web.auditlogs.filter.resourcetype', -1));
if (isset($_REQUEST['filter_set']) || isset($_REQUEST['filter_rst'])) {
    CProfile::update('web.auditlogs.filter.alias', $_REQUEST['alias'], PROFILE_TYPE_STR);
    CProfile::update('web.auditlogs.filter.action', $_REQUEST['action'], PROFILE_TYPE_INT);
    CProfile::update('web.auditlogs.filter.resourcetype', $_REQUEST['resourcetype'], PROFILE_TYPE_INT);
}
/*
 * Display
 */
$effectivePeriod = navigation_bar_calc('web.auditlogs.timeline', 0, true);
$data = array('stime' => get_request('stime'), 'actions' => array(), 'action' => get_request('action'), 'resourcetype' => get_request('resourcetype'), 'alias' => get_request('alias'));
$from = zbxDateToTime($data['stime']);
$till = $from + $effectivePeriod;
// get audit
$sqlWhere = array();
if (!empty($data['alias'])) {
    $sqlWhere['alias'] = ' AND u.alias=' . zbx_dbstr($data['alias']);
}
if ($data['action'] > -1) {
    $sqlWhere['action'] = ' AND a.action=' . $data['action'] . ' ';
}
if ($data['resourcetype'] > -1) {
    $sqlWhere['resourcetype'] = ' AND a.resourcetype=' . $data['resourcetype'] . ' ';
}
$sqlWhere['from'] = ' AND a.clock>' . $from;
$sqlWhere['till'] = ' AND a.clock<' . $till;
Example #13
0
include_once "include/page_header.php";
$fields = array("mediatypeid" => array(T_ZBX_INT, O_NO, P_SYS, DB_ID, '(isset({form})&&({form}=="update"))'), "type" => array(T_ZBX_INT, O_OPT, NULL, IN(implode(',', array(MEDIA_TYPE_EMAIL, MEDIA_TYPE_EXEC, MEDIA_TYPE_SMS, MEDIA_TYPE_JABBER))), '(isset({save}))'), "description" => array(T_ZBX_STR, O_OPT, NULL, NOT_EMPTY, '(isset({save}))'), "smtp_server" => array(T_ZBX_STR, O_OPT, NULL, NOT_EMPTY, 'isset({type})&&({type}==' . MEDIA_TYPE_EMAIL . ')&&isset({save})'), "smtp_helo" => array(T_ZBX_STR, O_OPT, NULL, NOT_EMPTY, 'isset({type})&&({type}==' . MEDIA_TYPE_EMAIL . ')&&isset({save})'), "smtp_email" => array(T_ZBX_STR, O_OPT, NULL, NOT_EMPTY, 'isset({type})&&({type}==' . MEDIA_TYPE_EMAIL . ')&&isset({save})'), "exec_path" => array(T_ZBX_STR, O_OPT, NULL, NOT_EMPTY, 'isset({type})&&({type}==' . MEDIA_TYPE_EXEC . ')&&isset({save})'), "gsm_modem" => array(T_ZBX_STR, O_OPT, NULL, NOT_EMPTY, 'isset({type})&&({type}==' . MEDIA_TYPE_SMS . ')&&isset({save})'), "username" => array(T_ZBX_STR, O_OPT, NULL, NOT_EMPTY, '(isset({type})&&{type}==' . MEDIA_TYPE_JABBER . ')&&isset({save})'), "password" => array(T_ZBX_STR, O_OPT, NULL, NOT_EMPTY, 'isset({type})&&({type}==' . MEDIA_TYPE_JABBER . ')&&isset({save})'), "save" => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, NULL, NULL), "delete" => 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), "form" => array(T_ZBX_STR, O_OPT, P_SYS, NULL, NULL), "form_refresh" => array(T_ZBX_INT, O_OPT, NULL, NULL, NULL));
check_fields($fields);
validate_sort_and_sortorder('mt.description', ZBX_SORT_UP);
/* MEDIATYPE ACTIONS */
$result = 0;
if (isset($_REQUEST["save"])) {
    if (isset($_REQUEST["mediatypeid"])) {
        /* UPDATE */
        /*			$action = AUDIT_ACTION_UPDATE;*/
        $result = update_mediatype($_REQUEST["mediatypeid"], $_REQUEST["type"], $_REQUEST["description"], get_request("smtp_server"), get_request("smtp_helo"), get_request("smtp_email"), get_request("exec_path"), get_request("gsm_modem"), get_request('username'), get_request('password'));
        show_messages($result, S_MEDIA_TYPE_UPDATED, S_MEDIA_TYPE_WAS_NOT_UPDATED);
    } else {
        /* ADD */
        /*			$action = AUDIT_ACTION_ADD;*/
        $result = add_mediatype($_REQUEST["type"], $_REQUEST["description"], get_request("smtp_server"), get_request("smtp_helo"), get_request("smtp_email"), get_request("exec_path"), get_request("gsm_modem"), get_request('username'), get_request('password'));
        show_messages($result, S_ADDED_NEW_MEDIA_TYPE, S_NEW_MEDIA_TYPE_WAS_NOT_ADDED);
    }
    if ($result) {
        /*			add_audit($action,AUDIT_RESOURCE_MEDIA_TYPE,
        				"Media type [".$_REQUEST["description"]."]");
        */
        unset($_REQUEST["form"]);
    }
} elseif (isset($_REQUEST["delete"]) && isset($_REQUEST["mediatypeid"])) {
    /* DELETE */
    /*		$mediatype=get_mediatype_by_mediatypeid($_REQUEST["mediatypeid"]);*/
    $result = delete_mediatype($_REQUEST["mediatypeid"]);
    show_messages($result, S_MEDIA_TYPE_DELETED, S_MEDIA_TYPE_WAS_NOT_DELETED);
    if ($result) {
        /*			add_audit(AUDIT_ACTION_DELETE,AUDIT_RESOURCE_MEDIA_TYPE,
Example #14
0
$dashboard_wdgt->setClass('header');
$dashboard_wdgt->addPageHeader(S_DASHBOARD_CONFIGURATION_BIG, SPACE);
//-------------
// GROUPS
$dashForm = new CFormTable(S_FILTER);
$dashForm->addVar('form_refresh', 1);
$dashForm->setName('dashconf');
$dashForm->setAttribute('id', 'dashform');
if (isset($_REQUEST['form_refresh'])) {
    $filterEnable = get_request('filterEnable', 0);
    $groupids = get_request('groupids', array());
    $groupids = zbx_toHash($groupids);
    $grpswitch = get_request('grpswitch', 0);
    $maintenance = get_request('maintenance', 0);
    $extAck = get_request('extAck', 0);
    $severity = get_request('trgSeverity', array());
    $severity = array_keys($severity);
} else {
    $filterEnable = CProfile::get('web.dashconf.filter.enable', 0);
    $groupids = get_favorites('web.dashconf.groups.groupids');
    $groupids = zbx_objectValues($groupids, 'value');
    $groupids = zbx_toHash($groupids);
    $grpswitch = CProfile::get('web.dashconf.groups.grpswitch', 0);
    $maintenance = CProfile::get('web.dashconf.hosts.maintenance', 1);
    $extAck = CProfile::get('web.dashconf.events.extAck', 0);
    $severity = CProfile::get('web.dashconf.triggers.severity', '0;1;2;3;4;5');
    $severity = zbx_empty($severity) ? array() : explode(';', $severity);
}
$dashForm->addVar('filterEnable', $filterEnable);
if ($filterEnable) {
    $cbFilter = new CSpan(S_ENABLED, 'green underline pointer');
Example #15
0
**/
require_once "include/config.inc.php";
require_once "include/items.inc.php";
$page["title"] = "S_QUEUE_BIG";
$page["file"] = "queue.php";
$page['hist_arg'] = array('show');
define('ZBX_PAGE_DO_REFRESH', 1);
include_once "include/page_header.php";
//		VAR			TYPE	OPTIONAL FLAGS	VALIDATION	EXCEPTION
$fields = array("show" => array(T_ZBX_INT, O_OPT, P_SYS, IN("0,1,2"), NULL));
check_fields($fields);
$available_hosts = get_accessible_hosts_by_user($USER_DETAILS, PERM_READ_ONLY, PERM_RES_IDS_ARRAY);
?>

<?php 
$_REQUEST["show"] = get_request("show", 0);
$form = new CForm();
$form->SetMethod('get');
$cmbMode = new CComboBox("show", $_REQUEST["show"], "submit();");
$cmbMode->AddItem(0, S_OVERVIEW);
$cmbMode->AddItem(1, S_OVERVIEW_BY_PROXY);
$cmbMode->AddItem(2, S_DETAILS);
$form->AddItem($cmbMode);
show_table_header(S_QUEUE_OF_ITEMS_TO_BE_UPDATED_BIG, $form);
?>

<?php 
$now = time();
$item_types = array(ITEM_TYPE_ZABBIX, ITEM_TYPE_ZABBIX_ACTIVE, ITEM_TYPE_SNMPV1, ITEM_TYPE_SNMPV2C, ITEM_TYPE_SNMPV3, ITEM_TYPE_SIMPLE, ITEM_TYPE_INTERNAL, ITEM_TYPE_AGGREGATE, ITEM_TYPE_EXTERNAL);
$result = DBselect('SELECT i.itemid,i.nextcheck,i.description,i.key_,i.type,h.host,h.hostid,h.proxy_hostid ' . ' FROM items i,hosts h ' . ' WHERE i.status=' . ITEM_STATUS_ACTIVE . ' AND i.type in (' . implode(',', $item_types) . ') ' . ' AND ((h.status=' . HOST_STATUS_MONITORED . ' AND h.available != ' . HOST_AVAILABLE_FALSE . ') ' . ' OR (h.status=' . HOST_STATUS_MONITORED . ' AND h.available=' . HOST_AVAILABLE_FALSE . ' AND h.disable_until<=' . $now . ')) ' . ' AND i.hostid=h.hostid ' . ' AND i.nextcheck + 5 <' . $now . ' AND i.key_ NOT IN (' . zbx_dbstr('status') . ',' . zbx_dbstr('icmpping') . ',' . zbx_dbstr('icmppingsec') . ',' . zbx_dbstr('zabbix[log]') . ') ' . ' AND i.value_type not in (' . ITEM_VALUE_TYPE_LOG . ') ' . ' AND ' . DBcondition('h.hostid', $available_hosts) . ' AND ' . DBin_node('h.hostid', get_current_nodeid()) . ' ORDER BY i.nextcheck,h.host,i.description,i.key_');
$table = new CTableInfo(S_THE_QUEUE_IS_EMPTY);
Example #16
0
define('ZBX_PAGE_DO_REFRESH', 1);
require_once dirname(__FILE__) . '/include/page_header.php';
//		VAR				TYPE		OPTIONAL	FLAGS	VALIDATION	EXCEPTION
$fields = array('fullscreen' => array(T_ZBX_INT, O_OPT, P_SYS, IN('0,1'), null), 'groupid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null), 'hostid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null));
check_fields($fields);
/*
 * Permissions
 */
if (get_request('groupid') && !API::HostGroup()->isReadable(array($_REQUEST['groupid']))) {
    access_deny();
}
if (get_request('hostid') && !API::Host()->isReadable(array($_REQUEST['hostid']))) {
    access_deny();
}
validate_sort_and_sortorder('name', ZBX_SORT_DOWN);
$options = array('groups' => array('real_hosts' => true, 'with_httptests' => true), 'hosts' => array('with_monitored_items' => true, 'with_httptests' => true), 'hostid' => get_request('hostid', null), 'groupid' => get_request('groupid', null));
$pageFilter = new CPageFilter($options);
$_REQUEST['groupid'] = $pageFilter->groupid;
$_REQUEST['hostid'] = $pageFilter->hostid;
$displayNodes = is_array(get_current_nodeid()) && $pageFilter->groupid == 0 && $pageFilter->hostid == 0;
$r_form = new CForm('get');
$r_form->addVar('fullscreen', $_REQUEST['fullscreen']);
$r_form->addItem(array(_('Group') . SPACE, $pageFilter->getGroupsCB(true)));
$r_form->addItem(array(SPACE . _('Host') . SPACE, $pageFilter->getHostsCB(true)));
$httpmon_wdgt = new CWidget();
$httpmon_wdgt->addPageHeader(_('STATUS OF WEB MONITORING'), get_icon('fullscreen', array('fullscreen' => $_REQUEST['fullscreen'])));
$httpmon_wdgt->addHeader(_('Web scenarios'), $r_form);
$httpmon_wdgt->addHeaderRowNumber();
// TABLE
$table = new CTableInfo(_('No web scenarios found.'));
$table->SetHeader(array($displayNodes ? _('Node') : null, $_REQUEST['hostid'] == 0 ? make_sorting_header(_('Host'), 'hostname') : null, make_sorting_header(_('Name'), 'name'), _('Number of steps'), _('Last check'), _('Status')));
Example #17
0
	* Present the only template, if there is only one.

Creating and editing entries use two objects:
* A template object which describes how the template should be rendered (and what values should asked for, etc)
* A page object, which is responsible for actually sending out the HTML to the browser.

So:
* we init a new TemplateRender object
* we init a new Template object
* set the DN or container on the template object
	* If setting the DN, this in turn should read the "old values" from the LDAP server
* If we are not on the first page (ie: 2nd, 3rd, 4th step, etc), we should accept the post values that we have obtained thus far

* Finally submit the update to "update_confirm", or the create to "create", when complete.
*/
require './common.php';
$request = array();
$request['dn'] = get_request('dn', 'REQUEST');
$request['page'] = new TemplateRender($app['server']->getIndex(), get_request('template', 'REQUEST', false, null));
# If we have a DN, then this is to edit the entry.
if ($request['dn']) {
    $app['server']->dnExists($request['dn']) or error(sprintf('%s (%s)', _('No such entry'), pretty_print_dn($request['dn'])), 'error', 'index.php');
    $request['page']->setDN($request['dn']);
    $request['page']->accept();
} else {
    if ($app['server']->isReadOnly()) {
        error(_('You cannot perform updates while server is in read-only mode'), 'error', 'index.php');
    }
    $request['page']->setContainer(get_request('container', 'REQUEST'));
    $request['page']->accept();
}
    $mapInfo = getSelementsInfo($map, array('severity_min' => get_request('severity_min')));
    processAreasCoordinates($map, $areas, $mapInfo);
    $allLinks = false;
}
/*
 * Draw map
 */
drawMapConnectors($im, $map, $mapInfo, $allLinks);
if (!isset($_REQUEST['noselements'])) {
    drawMapHighligts($im, $map, $mapInfo);
    drawMapSelements($im, $map, $mapInfo);
}
$expandMacros = get_request('expand_macros', true);
drawMapLabels($im, $map, $mapInfo, $expandMacros);
drawMapLinkLabels($im, $map, $mapInfo, $expandMacros);
if (!isset($_REQUEST['noselements']) && $map['markelements'] == 1) {
    drawMapSelementsMarks($im, $map, $mapInfo);
}
show_messages();
if (get_request('base64image')) {
    ob_start();
    imagepng($im);
    $imageSource = ob_get_contents();
    ob_end_clean();
    $json = new CJSON();
    echo $json->encode(array('result' => base64_encode($imageSource)));
    imagedestroy($im);
} else {
    imageOut($im);
}
require_once dirname(__FILE__) . '/include/page_footer.php';
Example #19
0
} else {
	app_session_start();
	$_SESSION[APPCONFIG] = $config;
}

if ($uri = get_request('URI','GET'))
	header(sprintf('Location: cmd.php?%s',base64_decode($uri)));

if (! preg_match('/^([0-9]+\.?)+/',app_version())) {
	system_message(array(
		'title'=>_('This is a development version of phpLDAPadmin'),
		'body'=>'This is a development version of phpLDAPadmin! You should <b>NOT</b> use it in a production environment (although we dont think it should do any damage).',
		'type'=>'info','special'=>true));

	if (count($_SESSION[APPCONFIG]->untested()))
		system_message(array(
			'title'=>'Untested configuration paramaters',
			'body'=>sprintf('The following parameters have not been tested. If you have configured these parameters, and they are working as expected, please let the developers know, so that they can be removed from this message.<br/><small>%s</small>',implode(', ',$_SESSION[APPCONFIG]->untested())),
			'type'=>'info','special'=>true));

	$server = $_SESSION[APPCONFIG]->getServer(get_request('server_id','REQUEST'));
	if (count($server->untested()))
		system_message(array(
			'title'=>'Untested server configuration paramaters',
			'body'=>sprintf('The following parameters have not been tested. If you have configured these parameters, and they are working as expected, please let the developers know, so that they can be removed from this message.<br/><small>%s</small>',implode(', ',$server->untested())),
			'type'=>'info','special'=>true));
}

include './cmd.php';
?>
Example #20
0
    clearCookies($goResult, $_REQUEST['hostid']);
}
/*
 * Display
 */
if (isset($_REQUEST['form'])) {
    $data = getItemFormData(array('is_discovery_rule' => true));
    $data['page_header'] = _('CONFIGURATION OF DISCOVERY RULES');
    // render view
    $itemView = new CView('configuration.item.edit', $data);
    $itemView->render();
    $itemView->show();
} else {
    $data = array('hostid' => get_request('hostid', 0), 'host' => $host, 'showErrorColumn' => $host['status'] != HOST_STATUS_TEMPLATE);
    $sortfield = getPageSortField('name');
    // discoveries
    $data['discoveries'] = API::DiscoveryRule()->get(array('hostids' => $data['hostid'], 'output' => API_OUTPUT_EXTEND, 'editable' => true, 'selectItems' => API_OUTPUT_COUNT, 'selectGraphs' => API_OUTPUT_COUNT, 'selectTriggers' => API_OUTPUT_COUNT, 'selectHostPrototypes' => API_OUTPUT_COUNT, 'sortfield' => $sortfield, 'limit' => $config['search_limit'] + 1));
    $data['discoveries'] = CMacrosResolverHelper::resolveItemNames($data['discoveries']);
    if ($sortfield === 'status') {
        orderItemsByStatus($data['discoveries'], getPageSortOrder());
    } else {
        order_result($data['discoveries'], $sortfield, getPageSortOrder());
    }
    // paging
    $data['paging'] = getPagingLine($data['discoveries'], array('itemid'), array('hostid' => get_request('hostid')));
    // render view
    $discoveryView = new CView('configuration.host.discovery.list', $data);
    $discoveryView->render();
    $discoveryView->show();
}
require_once dirname(__FILE__) . '/include/page_footer.php';
Example #21
0
}
$graph = new CPie(get_request('graphtype', GRAPH_TYPE_NORMAL));
$graph->setHeader($host['host'] . ':' . get_request('name', ''));
$graph3d = get_request('graph3d', 0);
$legend = get_request('legend', 0);
if ($graph3d == 1) {
    $graph->switchPie3D();
}
$graph->switchLegend($legend);
unset($host);
if (isset($_REQUEST['period'])) {
    $graph->SetPeriod($_REQUEST['period']);
}
if (isset($_REQUEST['from'])) {
    $graph->SetFrom($_REQUEST['from']);
}
if (isset($_REQUEST['stime'])) {
    $graph->SetSTime($_REQUEST['stime']);
}
if (isset($_REQUEST['border'])) {
    $graph->SetBorder(0);
}
$graph->SetWidth(get_request('width', 400));
$graph->SetHeight(get_request('height', 300));
foreach ($items as $id => $gitem) {
    //		SDI($gitem);
    $graph->addItem($gitem['itemid'], $gitem['calc_fnc'], $gitem['color'], $gitem['type'], $gitem['periods_cnt']);
    //		unset($items[$id]);
}
$graph->Draw();
include_once 'include/page_footer.php';
$cnf_wdgt = new CWidget();
$cnf_wdgt->addPageHeader(_('CONFIGURATION OF ZABBIX'), $form);
$data = array();
$data['form_refresh'] = get_request('form_refresh', 0);
// form has been submitted
if ($data['form_refresh']) {
    $data['ok_period'] = get_request('ok_period');
    $data['blink_period'] = get_request('blink_period');
    $data['problem_unack_color'] = get_request('problem_unack_color');
    $data['problem_ack_color'] = get_request('problem_ack_color');
    $data['ok_unack_color'] = get_request('ok_unack_color');
    $data['ok_ack_color'] = get_request('ok_ack_color');
    $data['problem_unack_style'] = get_request('problem_unack_style');
    $data['problem_ack_style'] = get_request('problem_ack_style');
    $data['ok_unack_style'] = get_request('ok_unack_style');
    $data['ok_ack_style'] = get_request('ok_ack_style');
} else {
    $config = select_config(false);
    $data['ok_period'] = $config['ok_period'];
    $data['blink_period'] = $config['blink_period'];
    $data['problem_unack_color'] = $config['problem_unack_color'];
    $data['problem_ack_color'] = $config['problem_ack_color'];
    $data['ok_unack_color'] = $config['ok_unack_color'];
    $data['ok_ack_color'] = $config['ok_ack_color'];
    $data['problem_unack_style'] = $config['problem_unack_style'];
    $data['problem_ack_style'] = $config['problem_ack_style'];
    $data['ok_unack_style'] = $config['ok_unack_style'];
    $data['ok_ack_style'] = $config['ok_ack_style'];
}
$triggerDisplayingForm = new CView('administration.general.triggerDisplayOptions.edit', $data);
$cnf_wdgt->addItem($triggerDisplayingForm->render());
Example #23
0
// sort out image source
$src = get_request("src", "");
if ($src == '' || strlen($src) <= 3) {
    displayError('no image specified');
}
// clean params before use
$src = cleanSource($src);
// last modified time (for caching)
$lastModified = filemtime($src);
// get properties
$new_width = preg_replace("/[^0-9]+/", '', get_request('w', 0));
$new_height = preg_replace("/[^0-9]+/", '', get_request('h', 0));
$zoom_crop = preg_replace("/[^0-9]+/", '', get_request('zc', 1));
$quality = preg_replace("/[^0-9]+/", '', get_request('q', 80));
$filters = get_request('f', '');
$sharpen = get_request('s', 0);
if ($new_width == 0 && $new_height == 0) {
    $new_width = 100;
    $new_height = 100;
}
// get mime type of src
$mime_type = mime_type($src);
// check to see if this image is in the cache already
check_cache($mime_type);
// if not in cache then clear some space and generate a new file
cleanCache();
ini_set('memory_limit', '50M');
// make sure that the src is gif/jpg/png
if (!valid_src_mime_type($mime_type)) {
    displayError('Invalid src mime type: ' . $mime_type);
}
if (!check_fields($fields)) {
    $test = false;
}
//------------------------ <ACTIONS> ---------------------------
if (isset($_REQUEST['test_expression'])) {
    show_messages();
    $test = true;
} else {
    $test = false;
}
//------------------------ </ACTIONS> --------------------------
//------------------------ <FORM> ---------------------------
$frm_test = new CFormTable(_('Test'), 'tr_testexpr.php');
$frm_test->setHelp('web.testexpr.service.php');
$frm_test->setTableClass('formlongtable formtable');
$frm_test->addVar('form_refresh', get_request('form_refresh', 1));
$frm_test->addVar('expression', $expression);
/* test data */
$frm_test->addRow(_('Test data'), $data_table);
/* result */
$res_table = new CTable(null, 'tableinfo');
$res_table->setAttribute('id', 'result_list');
$res_table->setOddRowClass('even_row');
$res_table->setEvenRowClass('even_row');
$res_table->setHeader(array(_('Expression'), _('Result')));
ksort($rplcts, SORT_NUMERIC);
foreach ($eHTMLTree as $e) {
    $result = '-';
    if ($allowedTesting && $test && isset($e['expression'])) {
        $result = evalExpressionData($e['expression']['value'], $macrosData, $octet);
    }
    $name = get_request('name', '');
}
/*
 * Display
 */
if ($isDataValid) {
    $graph = new CChart(get_request('graphtype', GRAPH_TYPE_NORMAL));
    $graph->setHeader($name);
    navigation_bar_calc();
    $graph->setPeriod($_REQUEST['period']);
    $graph->setSTime($_REQUEST['stime']);
    $graph->setWidth(get_request('width', 900));
    $graph->setHeight(get_request('height', 200));
    $graph->showLegend(get_request('legend', 1));
    $graph->showWorkPeriod(get_request('showworkperiod', 1));
    $graph->showTriggers(get_request('showtriggers', 1));
    $graph->setYMinAxisType(get_request('ymin_type', GRAPH_YAXIS_TYPE_CALCULATED));
    $graph->setYMaxAxisType(get_request('ymax_type', GRAPH_YAXIS_TYPE_CALCULATED));
    $graph->setYAxisMin(get_request('yaxismin', 0.0));
    $graph->setYAxisMax(get_request('yaxismax', 100.0));
    $graph->setYMinItemId(get_request('ymin_itemid', 0));
    $graph->setYMaxItemId(get_request('ymax_itemid', 0));
    $graph->setLeftPercentage(get_request('percent_left', 0));
    $graph->setRightPercentage(get_request('percent_right', 0));
    foreach ($items as $inum => $item) {
        $graph->addItem($item['itemid'], isset($item['yaxisside']) ? $item['yaxisside'] : null, isset($item['calc_fnc']) ? $item['calc_fnc'] : null, isset($item['color']) ? $item['color'] : null, isset($item['drawtype']) ? $item['drawtype'] : null, isset($item['type']) ? $item['type'] : null);
        unset($items[$inum]);
    }
    $graph->draw();
}
require_once dirname(__FILE__) . '/include/page_footer.php';
$fields = array('itemid' => array(T_ZBX_INT, O_MAND, P_SYS, DB_ID, null), 'screenid' => array(T_ZBX_STR, O_OPT, null, null, null), 'period' => array(T_ZBX_INT, O_OPT, P_NZERO, BETWEEN(ZBX_MIN_PERIOD, ZBX_MAX_PERIOD), null), 'stime' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'profileIdx' => array(T_ZBX_STR, O_OPT, null, null, null), 'profileIdx2' => array(T_ZBX_STR, O_OPT, null, null, null), 'updateProfile' => array(T_ZBX_STR, O_OPT, null, null, null), 'from' => array(T_ZBX_INT, O_OPT, null, '{}>=0', null), 'width' => array(T_ZBX_INT, O_OPT, null, '{}>0', null), 'height' => array(T_ZBX_INT, O_OPT, null, '{}>0', null), 'border' => array(T_ZBX_INT, O_OPT, null, IN('0,1'), null));
check_fields($fields);
/*
 * Permissions
 */
if (!DBfetch(DBselect('SELECT i.itemid FROM items i WHERE i.itemid=' . $_REQUEST['itemid']))) {
    show_error_message(_('No items defined.'));
}
$dbItems = API::Item()->get(array('itemids' => $_REQUEST['itemid'], 'webitems' => true, 'nodeids' => get_current_nodeid(true), 'filter' => array('flags' => null)));
if (empty($dbItems)) {
    access_deny();
}
/*
 * Display
 */
$timeline = CScreenBase::calculateTime(array('profileIdx' => get_request('profileIdx', 'web.screens'), 'profileIdx2' => get_request('profileIdx2'), 'updateProfile' => get_request('updateProfile', true), 'period' => get_request('period'), 'stime' => get_request('stime')));
$graph = new CChart();
$graph->setPeriod($timeline['period']);
$graph->setSTime($timeline['stime']);
if (isset($_REQUEST['from'])) {
    $graph->setFrom($_REQUEST['from']);
}
if (isset($_REQUEST['width'])) {
    $graph->setWidth($_REQUEST['width']);
}
if (isset($_REQUEST['height'])) {
    $graph->setHeight($_REQUEST['height']);
}
if (isset($_REQUEST['border'])) {
    $graph->setBorder(0);
}
Example #27
0
} else {
    echo SBR;
    $graphid = get_request("graphid", null);
    $graphtype = get_request("graphtype", GRAPH_TYPE_NORMAL);
    $gid = get_request("gid", null);
    $list_name = get_request("list_name", null);
    $itemid = get_request("itemid", 0);
    $color = get_request("color", '009900');
    $drawtype = get_request("drawtype", 0);
    $sortorder = get_request("sortorder", 0);
    $yaxisside = get_request("yaxisside", 1);
    $calc_fnc = get_request("calc_fnc", 2);
    $type = get_request("type", 0);
    $periods_cnt = get_request("periods_cnt", 5);
    $only_hostid = get_request("only_hostid", null);
    $monitored_hosts = get_request('monitored_hosts', null);
    $caption = $itemid ? S_UPD_ITEM_FOR_THE_GRAPH : S_NEW_ITEM_FOR_THE_GRAPH;
    $frmGItem = new CFormTable($caption);
    $frmGItem->setName('graph_item');
    $frmGItem->setHelp("web.graph.item.php");
    $frmGItem->addVar('dstfrm', $_REQUEST['dstfrm']);
    $description = '';
    if ($itemid > 0) {
        $description = get_item_by_itemid($itemid);
        $description = item_description($description);
    }
    $frmGItem->addVar('graphid', $graphid);
    $frmGItem->addVar('gid', $gid);
    $frmGItem->addVar('list_name', $list_name);
    $frmGItem->addVar('itemid', $itemid);
    $frmGItem->addVar('graphtype', $graphtype);
Example #28
0
    header('Location: index.php');
    die;
}
$request = array();
$request['redirect'] = get_request('redirect', 'POST', false, false);
$request['page'] = new PageRender($app['server']->getIndex(), get_request('template', 'REQUEST', false, 'none'));
$request['page']->setContainer(get_request('container', 'REQUEST', true));
$request['page']->accept();
$request['template'] = $request['page']->getTemplate();
if ((!$request['template']->getContainer() || !$app['server']->dnExists($request['template']->getContainer())) && !get_request('create_base')) {
    error(sprintf(_('The container you specified (%s) does not exist. Please try again.'), $request['template']->getContainer()), 'error', 'index.php');
}
# Check if the container is a leaf - we shouldnt really return a hit here, the template engine shouldnt have allowed a user to attempt to create an entry...
$tree = get_cached_item($app['server']->getIndex(), 'tree');
$request['container'] = $tree->getEntry($request['template']->getContainer());
if (!$request['container'] && !get_request('create_base')) {
    $tree->addEntry($request['template']->getContainer());
    $request['container'] = $tree->getEntry($request['template']->getContainer());
}
# Check our RDN
if (!count($request['template']->getRDNAttrs())) {
    error(_('The were no attributes marked as an RDN attribute.'), 'error', 'index.php');
}
if (!$request['template']->getRDN()) {
    error(_('The RDN field is empty?'), 'error', 'index.php');
}
# Some other attribute checking...
foreach ($request['template']->getAttributes() as $attribute) {
    # Check that our Required Attributes have a value - we shouldnt really return a hit here, the template engine shouldnt have allowed this to slip through.
    # @todo this isIgnoredAttr() function is missing?
    if ($attribute->isRequired() && !count($attribute->getValues()) && !$app['server']->isIgnoredAttr($attr->getName())) {
Example #29
0
** 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';
require_once 'include/perm.inc.php';
global $USER_DETAILS;
global $ZBX_LOCALNODEID, $ZBX_LOCMASTERID, $ZBX_VIEWED_NODES, $ZBX_AVAILABLE_NODES;
global $ZBX_CURMASTERID;
global $page;
if (!isset($page['type'])) {
    $page['type'] = PAGE_TYPE_HTML;
}
if (!isset($page['file'])) {
    $page['file'] = basename($_SERVER['PHP_SELF']);
}
if ($_REQUEST['fullscreen'] = get_request('fullscreen', 0)) {
    define('ZBX_PAGE_NO_MENU', 1);
}
include_once 'include/locales/en_gb.inc.php';
process_locales();
set_zbx_locales();
require_once 'include/menu.inc.php';
zbx_define_menu_restrictions();
/* Init CURRENT NODE ID */
init_nodes();
/* switch($page["type"]) */
switch ($page['type']) {
    case PAGE_TYPE_IMAGE:
        set_image_header();
        define('ZBX_PAGE_NO_MENU', 1);
        break;
Example #30
0
<?php

/**
 * Recursively deletes the specified DN and all of its children
 *
 * @package phpLDAPadmin
 * @subpackage Page
 */
/**
 */
require './common.php';
$request = array();
$request['dn'] = get_request('dn', 'REQUEST', true);
if (!is_array($request['dn'])) {
    $request['dn'] = array($request['dn']);
}
$request['parent'] = array();
foreach ($request['dn'] as $dn) {
    if (!$app['server']->dnExists($dn)) {
        system_message(array('title' => _('Entry does not exist'), 'body' => sprintf('%s (%s)', _('Unable to delete entry, it does not exist'), $dn), 'type' => 'error'));
    } else {
        array_push($request['parent'], $dn);
    }
}
printf('<h3 class="title">%s</h3>', _('Delete LDAP entries'));
printf('<h3 class="subtitle">%s</h3>', _('Recursive delete progress'));
# Prevent script from bailing early on a long delete
@set_time_limit(0);
foreach ($request['parent'] as $dn) {
    echo '<br /><br />';
    echo '<small>';