Ejemplo n.º 1
0
 Autor: Raul Perusquia <*****@*****.**>
 Created: 24 September 2014 14:51:26 BST, Nottingham, UK
*/
require_once 'aes.php';
require_once 'common.php';
require_once 'ar_common.php';
include_once 'common_natural_language.php';
include_once 'common_checksum_functions.php';
include_once 'fork_functions.php';
if (!isset($_REQUEST['tipo'])) {
    $response = array('state' => 405, 'msg' => 'Non acceptable request (t)');
    echo json_encode($response);
    exit;
}
$tipo = $_REQUEST['tipo'];
switch ($tipo) {
    case 'log_request':
        $data = prepare_values($_REQUEST, array('url' => array('type' => 'string'), 'prev' => array('type' => 'string')));
        log_request($data);
        break;
    default:
        $response = array('state' => 404, 'msg' => 'Operation not found');
        echo json_encode($response);
}
function log_request($data)
{
    global $user;
    $user->log_request($data['url'], $data['prev']);
    $response = array('state' => 200);
    echo json_encode($response);
}
Ejemplo n.º 2
0
include_once 'common_natural_language.php';
include_once 'common_checksum_functions.php';
include_once 'fork_functions.php';
if (!isset($_REQUEST['tipo'])) {
    $response = array('state' => 405, 'msg' => 'Non acceptable request (t)');
    echo json_encode($response);
    exit;
}
$tipo = $_REQUEST['tipo'];
switch ($tipo) {
    case 'lookup_from_string':
        $data = prepare_values($_REQUEST, array('funders' => array('type' => 'json array'), 'journals' => array('type' => 'string')));
        lookup_from_string($data);
        break;
    case 'lookup_from_file':
        $data = prepare_values($_REQUEST, array('funders' => array('type' => 'json array'), 'upload_key' => array('type' => 'key')));
        lookup_from_file($data);
        break;
    default:
        $response = array('state' => 404, 'msg' => 'Operation not found');
        echo json_encode($response);
}
function lookup_from_file($data)
{
    global $mysqli;
    include 'libs/PHPExcel/Classes/PHPExcel/IOFactory.php';
    $upload_key = $data['upload_key'];
    $sql = sprintf("select `Upload Content` from `Upload Content Dimension` where `Upload Key`=%d", $upload_key);
    $res = $mysqli->query($sql);
    if ($row = $res->fetch_assoc()) {
        $content = $row['Upload Content'];
Ejemplo n.º 3
0
*/
require_once 'common.php';
require_once 'ar_common.php';
if (!isset($_REQUEST['tipo'])) {
    $response = array('state' => 405, 'msg' => 'Non acceptable request (t)');
    echo json_encode($response);
    exit;
}
$tipo = $_REQUEST['tipo'];
switch ($tipo) {
    case 'get_results':
        $data = prepare_values($_REQUEST, array('fork_key' => array('type' => 'key')));
        get_results($data);
        break;
    case 'list_results':
        $data = prepare_values($_REQUEST, array('fork_key' => array('type' => 'key'), 'callback' => array('type' => 'string')));
        list_results($data);
        break;
    default:
        $response = array('state' => 404, 'msg' => 'Operation not found');
        echo json_encode($response);
}
function list_results($data)
{
    global $mysqli;
    $fork_key = $data['fork_key'];
    $sql = sprintf("select * from `Result Dimension` where `Fork Key`=%d", $fork_key);
    $res = $mysqli->query($sql);
    $results = array();
    while ($row = $res->fetch_assoc()) {
        $journal = $row['Journal Name'];
Ejemplo n.º 4
0
<?php

//@author Raul Perusquia <*****@*****.**>
//Copyright (c) 2013 Inikoo
require_once 'common.php';
require_once 'ar_common.php';
if (!isset($_REQUEST['tipo'])) {
    $response = array('state' => 405, 'msg' => 'Non acceptable request (t)');
    echo json_encode($response);
    exit;
}
$tipo = $_REQUEST['tipo'];
switch ($tipo) {
    case 'get_wait_info':
        $data = prepare_values($_REQUEST, array('fork_key' => array('type' => 'key'), 'tag' => array('type' => 'string'), 'extra_key' => array('type' => 'key', 'optional' => true)));
        get_wait_info($data);
        break;
    default:
        $response = array('state' => 404, 'resp' => 'Operation not found');
        echo json_encode($response);
}
function get_wait_info($data)
{
    require_once 'common_natural_language.php';
    global $mysqli;
    $fork_key = $data['fork_key'];
    $sql = sprintf("select `Fork Key`,`Fork Result`,`Fork Scheduled Date`,`Fork Start Date`,`Fork State`,`Fork Type`,`Fork Operations Done`,`Fork Operations No Changed`,`Fork Operations Errors`,`Fork Operations Total Operations` from `Fork Dimension` where `Fork Key`=%d ", $fork_key);
    $res = $mysqli->query($sql);
    if ($row = $res->fetch_assoc()) {
        $result_extra_data = array();
        switch ($data['tag']) {