Fixed variable error

This commit is contained in:
Kasper Rynning-Tønnesen
2015-05-14 14:26:41 +02:00
parent e6bf94908a
commit a84fe0577d

View File

@@ -48,14 +48,14 @@ io.on('connection', function(socket){
}); });
socket.on('chat', function (data) { socket.on('chat', function (data) {
check_inlist(coll, guid, socket); check_inlist(coll, guid, socket, name);
if(data != "" && data !== undefined && data !== null && data.length < 151 && data.replace(/\s/g, '').length) if(data != "" && data !== undefined && data !== null && data.length < 151 && data.replace(/\s/g, '').length)
io.sockets.emit('chat,'+coll, name + ": " + data); io.sockets.emit('chat,'+coll, name + ": " + data);
}); });
socket.on("all,chat", function(data) socket.on("all,chat", function(data)
{ {
check_inlist(coll, guid, socket); check_inlist(coll, guid, socket, name);
if(data != "" && data !== undefined && data !== null && data.length < 151 && data.replace(/\s/g, '').length) if(data != "" && data !== undefined && data !== null && data.length < 151 && data.replace(/\s/g, '').length)
io.sockets.emit('chat.all', [name + ": " + data, coll]); io.sockets.emit('chat.all', [name + ": " + data, coll]);
}); });
@@ -114,7 +114,7 @@ io.on('connection', function(socket){
console.log(name + " joined list " + coll); console.log(name + " joined list " + coll);
check_inlist(coll, guid, socket); check_inlist(coll, guid, socket, name);
io.sockets.emit(coll+",viewers", lists[coll].length); io.sockets.emit(coll+",viewers", lists[coll].length);
@@ -144,7 +144,7 @@ io.on('connection', function(socket){
{ {
if(id !== undefined && id !== null && id != "") if(id !== undefined && id !== null && id != "")
{ {
check_inlist(coll, guid, socket); check_inlist(coll, guid, socket, name);
db.collection(coll).find({now_playing:true}, function(err, np){ db.collection(coll).find({now_playing:true}, function(err, np){
//console.log(docs); //console.log(docs);
@@ -209,7 +209,7 @@ io.on('connection', function(socket){
{ {
if(arr !== undefined && arr !== null && arr != "") if(arr !== undefined && arr !== null && arr != "")
{ {
check_inlist(coll, guid, socket); check_inlist(coll, guid, socket, name);
var id = arr[0]; var id = arr[0];
var title = arr[1]; var title = arr[1];
@@ -250,7 +250,7 @@ io.on('connection', function(socket){
{ {
if(msg !== undefined && msg !== null) if(msg !== undefined && msg !== null)
{ {
check_inlist(coll, guid, socket); check_inlist(coll, guid, socket, name);
if(msg[2] == "del") if(msg[2] == "del")
del(msg, socket); del(msg, socket);
@@ -280,7 +280,7 @@ io.on('connection', function(socket){
pw = inp[0]; pw = inp[0];
coll = inp[1]; coll = inp[1];
//guid = inp[2]; //guid = inp[2];
check_inlist(coll, guid, socket); check_inlist(coll, guid, socket, name);
//console.log(coll); //console.log(coll);
db.collection(coll).find({views:{$exists:true}}, function(err, docs){ db.collection(coll).find({views:{$exists:true}}, function(err, docs){
@@ -305,7 +305,7 @@ io.on('connection', function(socket){
{ {
if(list !== undefined && list !== null && list != "") if(list !== undefined && list !== null && list != "")
{ {
check_inlist(coll, guid, socket); check_inlist(coll, guid, socket, name);
adminpass = ""; adminpass = "";
@@ -360,7 +360,7 @@ io.on('connection', function(socket){
{ {
if(params !== undefined && params !== null && params != "") if(params !== undefined && params !== null && params != "")
{ {
check_inlist(coll, guid, socket); check_inlist(coll, guid, socket,name);
var voting = params[0]; var voting = params[0];
var addsongs = params[1]; var addsongs = params[1];
@@ -410,7 +410,7 @@ io.on('connection', function(socket){
{ {
if(pass !== undefined && pass !== null && pass != "") if(pass !== undefined && pass !== null && pass != "")
{ {
check_inlist(coll, guid, socket); check_inlist(coll, guid, socket, name);
var hash = hash_pass(pass); var hash = hash_pass(pass);
db.collection(coll).find({views:{$exists:true}}, function(err, docs){ db.collection(coll).find({views:{$exists:true}}, function(err, docs){
@@ -460,7 +460,7 @@ io.on('connection', function(socket){
socket.on('pos', function() socket.on('pos', function()
{ {
check_inlist(coll, guid, socket); check_inlist(coll, guid, socket, name);
send_play(coll, socket); send_play(coll, socket);
}); });
}); });
@@ -479,7 +479,7 @@ function del(params, socket)
}); });
} }
function check_inlist(coll, guid, socket) function check_inlist(coll, guid, socket, name)
{ {
if(lists[coll] == undefined) if(lists[coll] == undefined)
{ {