Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var tagCount;
var tagValue;
//var tagsArray = new Array();
var resultArray = new Array();
//console.log(req.body);
var string = req.body.searchQuery;
var searchType = req.body.searchType;
console.log(searchType);
string = string.toLowerCase();
var splitstring = string.split(' ');
console.log(splitstring);
var basex = require('basex');
var log = require("../node_modules/basex/debug");
// create session
var session = new basex.Session();
basex.debug_mode = false;
// create query instance
var inputquery = 'declare variable $stringList as xs:string external;' + 'declare variable $searchTag as xs:string external;' + 'for $node in doc("/home/kamikaze/Digital_Archive/Database/tags.xml")/images/image where $node/' + searchType + '=tokenize($stringList, " ") return $node/source/text()';
//var inputquery = 'declare variable $stringList as xs:string external;' + 'for $node in doc("/home/kamikaze/Digital_Archive/Database/tags.xml")/images/image where $node/tag=tokenize($stringList, " ") return $node/source/text()';
//var secondquery = 'for $img in (for $node in doc("/home/kamikaze/Digital_Archive/Database/colornew.xml")/images/item return $node)/image/item[type="str"] return ($img/image/item/text())';
//var inputquery = 'declare variable $stringList as xs:string external;' + ' return element { $stringList }';
var query = session.query(inputquery);
query.bind("stringList", string);
query.bind("searchTag", searchType);
//var result = query.results(log.print);
var resultArray = query.results(function(err, resultArray) {
if (err)
console.log("Error: " + err);
var tagValue;
//var tagsArray = new Array();
var resultArray = new Array();
//console.log(req.body);
var string = req.body.searchQuery;
var searchType = req.body.searchType;
console.log(searchType);
string = string.toLowerCase();
var splitstring = string.split(' ');
console.log(splitstring);
var basex = require('basex');
var log = require("../node_modules/basex/debug");
// create session
var session = new basex.Session();
basex.debug_mode = false;
// create query instance
var inputquery = 'declare variable $stringList as xs:string external;' + 'declare variable $searchTag as xs:string external;' + 'for $node in doc("/home/kamikaze/Digital_Archive/Database/tags.xml")/images/image where $node/' + searchType + '=tokenize($stringList, " ") return $node/source/text()';
//var inputquery = 'declare variable $stringList as xs:string external;' + 'for $node in doc("/home/kamikaze/Digital_Archive/Database/tags.xml")/images/image where $node/tag=tokenize($stringList, " ") return $node/source/text()';
//var secondquery = 'for $img in (for $node in doc("/home/kamikaze/Digital_Archive/Database/colornew.xml")/images/item return $node)/image/item[type="str"] return ($img/image/item/text())';
//var inputquery = 'declare variable $stringList as xs:string external;' + ' return element { $stringList }';
var query = session.query(inputquery);
query.bind("stringList", string);
query.bind("searchTag", searchType);
//var result = query.results(log.print);
var resultArray = query.results(function(err, resultArray) {
if (err)
console.log("Error: " + err);
else {
// see where collada2gltf is located
var openshift = process.env['OPENSHIFT_DATA_DIR'];
var collada2gltf = 'collada2gltf';
if (openshift)
collada2gltf = openshift + 'bin/collada2gltf-latest';
if (process.env.GLTF_BIN_PATH)
collada2gltf = process.env.GLTF_BIN_PATH+'/collada2gltf';
if (basex_port_server === undefined)
{
basex_port_server = basex_rest_server = 'localhost';
basex_rest = 8984;
}
console.log('baseX host='+basex_port_server+" TCP port="+basex_port+ " REST server="+basex_rest_server+" port="+basex_rest);
var session = new basex.Session(basex_port_server,basex_port);
var server = restify.createServer();
server.use(restify.acceptParser(server.acceptable));
//server.use(restify.authorizationParser());
server.use(restify.dateParser());
server.use(restify.queryParser());
//server.use(restify.bodyParser()); -> use formidable instead
restify.defaultResponseHeaders = false;
function unknownMethodHandler(req, res) {
console.log('unkownMethodHandler method='+req.method.toLowerCase());
if (req.method.toLowerCase() === 'options') {
var allowHeaders = ['Accept', 'Accept-Version', 'Content-Type', 'Api-Version'];
var basex_port = process.env.DOTCLOUD_DATABASE_SERVERPORT_PORT || 1984;
var basex_port_server = process.env.DOTCLOUD_DATABASE_SERVERPORT_HOST;
var basex_rest_server = process.env.DOTCLOUD_DATABASE_HTTP_HOST;
var basex_rest = 80;
var basex_rest_user = 'admin';
var basex_rest_pass = 'admin';
if (basex_port_server === undefined)
{
basex_port_server = basex_rest_server = 'localhost';
basex_rest = 8984;
}
console.log('baseX host='+basex_port_server+" TCP port="+basex_port+ " REST server="+basex_rest_server+" port="+basex_rest);
var session = exports.session = new basex.Session(basex_port_server,basex_port);
var basex_rest_url = 'http://'+basex_rest_server+':'+basex_rest;
var basex_client = restify.createClient({
url: basex_rest_url
});
basex_client.basicAuth(basex_rest_user, basex_rest_pass);
var check_basex = exports.init = function (callback) {
// start the rest session
basex_client.get('/rest', function(err, req) {
var didthiswork=true;
var test_count = 3;
var cb=callback;