Example #1
0
        }
        // subject
        $topic_q = @$dbs->query("SELECT t.topic, bt.level, t.topic_type, t.auth_list FROM biblio_topic AS bt\n            LEFT JOIN mst_topic AS t ON bt.topic_id=t.topic_id\n            WHERE bt.biblio_id={$id} ORDER BY level ASC");
        while ($topic_d = $topic_q->fetch_row()) {
            $data[$id]['subjects'][] = array('name' => $topic_d[0], 'level' => $topic_d[1], 'type' => $topic_d[2], 'auth_list' => $topic_d[3]);
        }
    }
    // encode array to json format
    if ($data) {
        $to_sent['node_info'] = $node;
        $to_sent['node_data'] = $data;
        // create HTTP request
        $http_request = new http_request();
        // send HTTP POST request
        $server_addr = isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : (isset($_SERVER['LOCAL_ADDR']) ? $_SERVER['LOCAL_ADDR'] : gethostbyname($_SERVER['SERVER_NAME']));
        $http_request->send_http_request($ucs['serveraddr'] . '/ucpoll.php', $server_addr, $to_sent, 'POST', 'text/json');
        // below is for debugging purpose only
        // die(json_encode(array('status' => 'RAW', 'message' => $http_request->body())));
        // check for http request error
        if ($req_error = $http_request->error()) {
            die(json_encode(array('status' => 'HTTP_REQUEST_ERROR', 'message' => $req_error['message'])));
        }
        // print out body of request result
        echo $http_request->body();
        exit;
    } else {
        die(json_encode(array('status' => 'NO_DATA', 'message' => 'No Data to be uploaded to Union Catalog Server')));
    }
} else {
    die(json_encode(array('status' => 'NO_BIBLIO_SELECTED', 'message' => 'Please select bibliographic data to upload!')));
}
    while ($author_d = $author_q->fetch_row()) {
        $data[$id]['authors'][] = array('name' => $author_d[0], 'level' => $author_d[1], 'type' => $author_d[2], 'auth_list' => $author_d[3]);
    }
    // subject
    $topic_q = @$dbs->query("SELECT t.topic, bt.level, t.topic_type, t.auth_list FROM biblio_topic AS bt\r\n        LEFT JOIN mst_topic AS t ON bt.topic_id=t.topic_id\r\n        WHERE bt.biblio_id={$id} ORDER BY level ASC");
    while ($topic_d = $topic_q->fetch_row()) {
        $data[$id]['subjects'][] = array('name' => $topic_d[0], 'level' => $topic_d[1], 'type' => $topic_d[2], 'auth_list' => $topic_d[3]);
    }
}
// encode array to json format
if ($data) {
    $to_sent['node_info'] = $node;
    $to_sent['node_data'] = $data;
    // create HTTP request
    $http_request = new http_request();
    // send HTTP POST request
    $http_request->send_http_request($ucs['serveraddr'] . '/ucpoll.php', @gethostbyaddr(), $to_sent, 'POST', 'text/json');
    // below is for debugging purpose only
    // die($http_request->body());
    // check for http request error
    if ($req_error = $http_request->error()) {
        echo $req_error['message'] . "\n";
        exit(6);
    }
    // print out body of request result
    $response = json_decode($http_request->body(), true);
    echo $response['message'] . "\n";
    exit(0);
} else {
    exit(0);
}
Example #3
0
            $biblioID = (int) $itemID;
            $biblioIDS .= $biblioID . ',';
        }
        // remove last comma
        $biblioIDS = substr_replace($biblioIDS, '', -1);
    } else {
        $biblioIDS = (int) $_POST['itemID'];
    }
    // node data
    if ($_POST['nodeOperation'] == 'delete') {
        $data = array('operation' => 'delete', 'biblio' => $biblioIDS);
    }
    // encode array to json format
    $to_sent['node_info'] = $node;
    $to_sent['node_data'] = $data;
    // create HTTP request
    $http_request = new http_request();
    // send HTTP POST request
    $http_request->send_http_request($ucs['serveraddr'] . '/uc-ops.php', $_SERVER['SERVER_ADDR'], $to_sent, 'POST', 'text/json');
    // below is for debugging purpose only
    // die(json_encode(array('status' => 'RAW', 'message' => $http_request->body())));
    // check for http request error
    if ($req_error = $http_request->error()) {
        die(json_encode(array('status' => 'HTTP_REQUEST_ERROR', 'message' => $req_error['message'])));
    }
    // print out body of request result
    echo $http_request->body();
    exit;
} else {
    die(json_encode(array('status' => 'NO_BIBLIO_SELECTED', 'message' => 'Please select bibliographic data to update!')));
}
Example #4
0
            $biblioIDS .= $biblioID . ',';
        }
        // remove last comma
        $biblioIDS = substr_replace($biblioIDS, '', -1);
    } else {
        $biblioIDS = (int) $_POST['itemID'];
    }
    // node data
    if ($_POST['nodeOperation'] == 'delete') {
        $data = array('operation' => 'delete', 'biblio' => $biblioIDS);
    }
    // encode array to json format
    $to_sent['node_info'] = $sysconf['ucs'];
    $to_sent['node_data'] = $data;
    // create HTTP request
    $http_request = new http_request();
    // send HTTP POST request
    $server_addr = isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : (isset($_SERVER['LOCAL_ADDR']) ? $_SERVER['LOCAL_ADDR'] : gethostbyname($_SERVER['SERVER_NAME']));
    $http_request->send_http_request($sysconf['ucs']['serveraddr'] . '/uc-ops.php', $server_addr, $to_sent, 'POST', 'text/json');
    // below is for debugging purpose only
    // die(json_encode(array('status' => 'RAW', 'message' => $http_request->body())));
    // check for http request error
    if ($req_error = $http_request->error()) {
        die(json_encode(array('status' => 'HTTP_REQUEST_ERROR', 'message' => $req_error['message'])));
    }
    // print out body of request result
    echo $http_request->body();
    exit;
} else {
    die(json_encode(array('status' => 'NO_BIBLIO_SELECTED', 'message' => 'Please select bibliographic data to update!')));
}