|
|
|
@ -468,19 +468,16 @@ helper has_joined => sub { |
|
|
|
|
AND `p`.`participant`=?'); |
|
|
|
|
}; |
|
|
|
|
if ($@){ |
|
|
|
|
return {msg => $@}; |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
$sth->execute($data->{room},$data->{name}); |
|
|
|
|
if ($sth->err){ |
|
|
|
|
return {msg => "DB Error: " . $sth->errstr . " (code " . $sth->err . ")"}; |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
my $num; |
|
|
|
|
$sth->bind_columns(\$num); |
|
|
|
|
$sth->fetch; |
|
|
|
|
return { |
|
|
|
|
ok => 1, |
|
|
|
|
data => ($num == 1) ? 1 : 0 |
|
|
|
|
} |
|
|
|
|
return ($num == 1) ? 1 : 0 ; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
# Purge disconnected participants from the DB |
|
|
|
@ -1289,7 +1286,7 @@ post '/*action' => [action => [qw/action admin\/action/]] => sub { |
|
|
|
|
} |
|
|
|
|
# Refuse any action from non members of the room |
|
|
|
|
if ($prefix ne 'admin' && (!$self->session('name') || |
|
|
|
|
!$self->has_joined({name => $self->session('name'), room => $room})->{data} || |
|
|
|
|
!$self->has_joined({name => $self->session('name'), room => $room}) || |
|
|
|
|
!$self->session($room) || |
|
|
|
|
!$self->session($room)->{role})){ |
|
|
|
|
return $self->render( |
|
|
|
|