$requestObject = json_decode(utf8_encode($requestData), 0);
                }
            }
        } catch (Exception $e) {
            throwerror("There was an exception");
        }
        if (!$requestObject) {
            file_put_contents(dirname(__FILE__) . "/error.txt", var_export($requestData, true));
            throwerror("There was an error - no request object ");
        } else {
            if ($requestObject->error) {
                throwerror("There was an error - Request object error " . $requestObject->error);
            } else {
                try {
                    @ob_start();
                    $data = ProcessRequest($requestObject, $data);
                    // Must suppress any error messages
                    @ob_end_clean();
                } catch (Exception $e) {
                    throwerror("There was an exception " . $e->getMessage());
                }
            }
        }
    } else {
        throwerror("Invalid Input");
    }
}
header("Content-Type: application/x-javascript; charset=utf-8");
list($usec, $sec) = explode(" ", microtime());
$time_end = (double) $usec + (double) $sec;
$data->timing = round($time_end - _SC_START, 4);
Example #2
0
#
# Copyright 2013 Zynga Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
#    you may not use this file except in compliance with the License.
#    You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#      distributed under the License is distributed on an "AS IS" BASIS,
#      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#    See the License for the specific language governing permissions and
#    limitations under the License.
#
header("Content-Type: text/json");
include_once "setup_page.php";
$game_name = $game_cfg["name"];
include_once 'XhProfModel.php';
include_once 'XhProfJSONView.php';
function ProcessRequest($server_cfg, $game_cfg)
{
    $xhprofModelObject = new XhProfModel($server_cfg, $game_cfg);
    date_default_timezone_set('UTC');
    $end_time = (int) $_GET["end_time"];
    $start_time = (int) $_GET["start_time"];
    $result = $xhprofModelObject->generic_execute_get_query("get_last_profile_slots", array('table' => $game_cfg["xhprof_blob_table"], 'end_time' => $end_time, 'start_time' => $start_time, 'extra_params' => ""));
    echo json_encode($result);
}
ProcessRequest($server_cfg, $game_cfg);
Example #3
0
] items. PHP will truncate the number of items to its limit with no warning. To prevent you from receiving less data than you are expecting, this page will not process your download request. Please go back to the search page and download less than [<?php 
echo $maxnumvars;
?>
] data items.</div>
		<?
		exit(0);
	}
	
	/* ----- determine which action to take ----- */
	switch ($action) {
		case 'searchform': DisplaySearchForm($searchvars, $action); break;
		case 'search':
			DisplaySearchForm($searchvars, $action);
			Search($searchvars);
			break;
		case 'submit': ProcessRequest($requestvars, $username); break;
		case 'anonymize': Anonymize($requestvars, $username); break;
		default:
			DisplaySearchForm($searchvars, $action);
	}

	
	/* -------------------------------------------- */
	/* ------- DisplaySearchForm ------------------ */
	/* -------------------------------------------- */
	function DisplaySearchForm($searchvars, $action) {
	
		$urllist['New Search'] = "search.php";
		NavigationBar("Search", $urllist);
		
	?>
<?php

header("Content-type: application/json");
error_reporting(E_ALL);
ini_set('display_errors', 1);
ini_set('memory_limit', '512M');
set_time_limit(60);
ProcessRequest();
function ApiFindAuthorNames()
{
    $snippet = GetRequiredQueryParameter('snippet');
    $action = "query";
    $collection = "MPerson";
    $limit = 5;
    $filter = array('_id' => true, 'NameRaw' => true);
    $personRegex = array('$regex' => ".*{$snippet}.*", '$options' => 'i');
    $query = array('NameRaw' => $personRegex);
    $result = doQuery($action, $collection, $query, $limit, $filter);
    $response = array('people' => $result['result']);
    Respond($response);
}
function ApiGetLocations()
{
    $locations = array();
    $dots = array();
    $action = "query";
    $collection = "MPlace";
    $limit = null;
    $filter = array('_id' => true, 'lon' => true, 'lat' => true, 'FullName' => true);
    $existsQuery = array('$exists' => true);
    $query = array('Coords' => $existsQuery);
Example #5
0
    }
    if (isset($_GET['hostgroup'])) {
        $hostgroup = $_GET['hostgroup'];
    }
    return array('game' => $game, 'array_id' => $array_id, "hostgroup" => $hostgroup);
}
function ProcessRequest($server_cfg, $game_cfg, $params)
{
    $query = $_GET["query"];
    if (!$query) {
        $query = 'eu_web_chart_range';
    }
    if (!$query) {
        return json_encode("Illegal query.");
    }
    $xhprofModelObject = new XhProfModel($server_cfg, $game_cfg);
    date_default_timezone_set('UTC');
    $end_time = time();
    $start_time = time() - 12 * 7 * 24 * 60 * 60;
    # 12 weeks ago
    $chart_result = $xhprofModelObject->generic_execute_get_query_detail($query, array('table' => "vertica_stats_30min", 'end_time' => $end_time, 'start_time' => $start_time, 'prefix' => str_replace("-", "_", $params['hostgroup'])));
    $tags = $xhprofModelObject->generic_execute_get_query("get_tag_range", array('table' => "events", 'end_time' => $end_time, 'start_time' => $start_time, 'extra_params' => ""));
    $chart_result["tags"] = $tags;
    echo json_encode($chart_result);
}
$params = safe_get_params();
$game_cfg = load_game_config($params['game'], $params['array_id']);
ProcessRequest($server_cfg, $game_cfg, $params);
?>

Example #6
0
    ?>
] data items.</div>
		<?php 
    exit(0);
}
/* ----- determine which action to take ----- */
switch ($action) {
    case 'searchform':
        DisplaySearchForm($searchvars, $action);
        break;
    case 'search':
        DisplaySearchForm($searchvars, $action);
        Search($searchvars);
        break;
    case 'submit':
        ProcessRequest($requestvars, $username);
        break;
    case 'anonymize':
        Anonymize($requestvars, $username);
        break;
    default:
        DisplaySearchForm($searchvars, $action);
}
/* -------------------------------------------- */
/* ------- DisplaySearchForm ------------------ */
/* -------------------------------------------- */
function DisplaySearchForm($searchvars, $action)
{
    $urllist['New Search'] = "search.php";
    NavigationBar("Search", $urllist);
    ?>