*/ require 'ucsysconfig.inc.php'; require 'ucserver.inc.php'; require LIB_DIR . 'http_request.inc.php'; require INC_DIR . 'ucs_nodes_poll.inc.php'; // check total node poll $total_conn = ucs_nodes_poll::check_poll($dbs); if ($total_conn >= $sysconf['server']['max_node_all']) { die(json_encode(array('status' => 'POLL_MAX', 'message' => 'Sorry for inconvinience, server connection poll is busy right now. Please try again later'))); } // create http request object $http_request = new http_request(); $http_request->get_http_request(); // get http content $referer = trim($http_request->headers('REFERER')); $body = trim($http_request->body()); // sent HTTP header header('Content-type: text/json'); // check content if ($body) { // encode to PHP array $biblio = json_decode($body, true); if (function_exists('json_last_error')) { // Define the errors. $json_errors = array(JSON_ERROR_DEPTH => 'JSON error: The maximum stack depth has been exceeded', JSON_ERROR_CTRL_CHAR => 'JSON error: Control character error, possibly incorrectly encoded', JSON_ERROR_SYNTAX => 'JSON error: Syntax error'); // get json error $json_error = json_last_error(); if ($json_error) { die(json_encode(array('status' => 'JSON_ERROR', 'message' => $json_errors[$json_error]))); } }
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); }
} // 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!'))); }
@rename("./junk/$tmp","./junk/$filename"); } */ } echo '"success":true}'; exit(0); } // for debug purposes... if (!empty($_REQUEST['viewraw'])) { require dirname(__FILE__) . '/http_request.php'; header('Content-Type:text/plain'); $hr = new http_request(); echo $hr->raw(); echo "\r\n\r\n"; echo "\n" . $_REQUEST['end']; echo "Body length: " . strlen($hr->body()); exit(0); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>Ext.ux.Uploader Samples</title> <style type="text/css"> .progress{ width: 200px; border: 1px solid #ccc; } .progress-fill{ background-color: blue; height: 10px;