Пример #1
0
// $_GET['xhprof']['query'] is used throughout the code to filter data. NULL value will be ignored.
// This is a convenience method to prevent repetitious variable presence checking.
if (empty($_GET['xhprof']['query'])) {
    $_GET['xhprof']['query'] = NULL;
} else {
    foreach ($_GET['xhprof']['query'] as $e) {
        if (is_array($e)) {
            throw new \Exception('Defining a filter with a multidimensional array is not supported.');
        }
    }
    // ay_input() will look for the default input value in this globally accessible variable.
    $input = array('query' => $_GET['xhprof']['query']);
    if (!empty($_GET['xhprof']['query']['datetime_from']) && !validate_datetime($_GET['xhprof']['query']['datetime_from'])) {
        \ay\message('Invalid <mark>from</mark> date-time format.');
    }
    if (!empty($_GET['xhprof']['query']['datetime_to']) && !validate_datetime($_GET['xhprof']['query']['datetime_to'])) {
        \ay\message('Invalid <mark>to</mark> date-time format.');
    }
    if (isset($_GET['xhprof']['query']['host'], $_GET['xhprof']['query']['host_id'])) {
        \ay\message('<mark>host_id</mark> will overwrite <mark>host</mark>. Unset either to prevent unexpected results.');
    }
    if (isset($_GET['xhprof']['query']['uri'], $_GET['xhprof']['query']['uri_id'])) {
        \ay\message('<mark>uri_id</mark> will overwrite <mark>uri</mark>. Unset either to prevent unexpected results.');
    }
}
$xhprof_data_obj = new Data($config['pdo']);
ob_start();
require BASE_PATH . '/templates/' . $template['file'] . '.tpl.php';
$template['body'] = ob_get_clean();
require BASE_PATH . '/templates/frontend.layout.tpl.php';
unset($_SESSION['ay']['flash']);
Пример #2
0
<?php

namespace ay\xhprof;

if (!\ay\error_present()) {
    $data = $xhprof_data_obj->getUris($_GET['xhprof']['query']);
    if (empty($data)) {
        \ay\message('No results matching your search were found.', 'notice');
    }
}
require __DIR__ . '/form.inc.tpl.php';
if (empty($data['discrete'])) {
    return;
}
require __DIR__ . '/summary.inc.tpl.php';
?>
<div class="table-wrapper">
	<table class="uris ay-sort">
		<thead class="ay-sticky">
			<tr>
				<?php 
if (empty($_GET['ay']['query']['host_id'])) {
    ?>
				<th class="ay-sort ay-sort-asc host" rowspan="2">Host</th>
				<?php 
}
?>
				<th class="ay-sort uri" rowspan="2">URI</th>
				<th class="ay-sort regular" rowspan="2">Request Count</th>
				<th class="heading" colspan="4">Average</th>
			</tr>
Пример #3
0
// This class is likely already included by php.ini prepend/append settings
require_once BASE_PATH . '/classes/data.php';
require BASE_PATH . '/classes/api.php';
require BASE_PATH . '/classes/model.php';
require BASE_PATH . '/classes/callgraph.php';
if (\ay\DEBUG && !empty($_SESSION['ay']['profiling'])) {
    require BASE_PATH . '/includes/profiler.inc.php';
}
if (filter_has_var(INPUT_POST, 'ay')) {
    array_walk_recursive($_POST['ay'], function (&$e) {
        $e = trim($e);
    });
    // Flash variable keeps track of the $_POST data in case there is an error
    // validating the form input and user needs to be returned to the form.
    $_SESSION['ay']['flash']['input'] = $_POST['ay'];
}
if (empty($_SESSION['xhprof']['remote_version'])) {
    $ch = curl_init();
    curl_setopt_array($ch, array(CURLOPT_URL => 'https://raw.github.com/staabm/xhprof.io/master/version.json', CURLOPT_HEADER => FALSE, CURLOPT_RETURNTRANSFER => TRUE));
    $response = curl_exec($ch);
    curl_close($ch);
    $version = json_decode($response, TRUE);
    if (!empty($version['version'])) {
        $_SESSION['xhprof']['remote_version'] = $version['version'];
    }
    unset($version, $response);
}
if (!empty($_SESSION['xhprof']['remote_version']) && $_SESSION['xhprof']['remote_version'] != VERSION) {
    \ay\message('You are running an out-of-date version of XHProf.io (' . VERSION . '). The <a href="http://xhprof.io/" target="_blank">current version is ' . htmlspecialchars($_SESSION['xhprof']['remote_version']) . '</a>.', \ay\MESSAGE_NOTICE);
    unset($_SESSION['xhprof']['remote_version']);
}