removed unneccesary code

This commit is contained in:
jkhsjdhjs 2016-08-17 18:33:56 +02:00
parent 9cb37a014e
commit ce7249da35

View File

@ -219,7 +219,7 @@ http.createServer((req, res) => {
});
}
else if(Number.isInteger(parseInt(url))) { // itempage
sql.query("select * from `f0ck`.`items` where `id` = ? limit 1; select `id` from `f0ck`.`items` where `id` = (select min(`id`) from `f0ck`.`items` where `id` > ?); select `id` from `f0ck`.`items` where `id` = (select max(`id`) from `f0ck`.`items` where `id` < ?);", [url, url, url], (err, rows, fields) => {
sql.query("select * from `f0ck`.`items` where `id` = ? limit 1; select `id` from `f0ck`.`items` where `id` = (select min(`id`) from `f0ck`.`items` where `id` > ?); select `id` from `f0ck`.`items` where `id` = (select max(`id`) from `f0ck`.`items` where `id` < ?)", [url, url, url], (err, rows, fields) => {
var tpl = swig.compile(templates.item);
var data = {
id: '',
@ -234,7 +234,7 @@ http.createServer((req, res) => {
next: null,
prev: null
};
if(rows.length && rows[0].length && rows[0][0].id == parseInt(url)) {
if(rows[0].length) {
var e = rows[0][0];
switch(e.mime) {
case "image/png":
@ -259,18 +259,11 @@ http.createServer((req, res) => {
data.size = formatSize(e.size);
data.userchannel = e.userchannel;
data.usernetwork = e.usernetwork;
if(rows.length >= 2 && rows[1].length) {
if(rows[1][0].id > parseInt(url))
data.next = rows[1][0].id;
else
data.prev = rows[1][0].id;
}
if(rows.length >= 3 && rows[2].length) {
if(rows[2][0].id > parseInt(url))
data.next = rows[2][0].id;
else
data.prev = rows[2][0].id;
}
if(rows[1].length)
data.next = rows[1].id;
if(rows[2].length)
data.prev = rows[2].id;
}
res.writeHead(200, { 'Content-Type': 'text/html' });
res.end(tpl(data), 'utf-8');