Frontend: Display private channels list if user has access to them
This commit is contained in:
parent
f1724d2f23
commit
bea89310ea
@ -89,24 +89,33 @@ sub handlePath {
|
||||
my $channelID = $row[0];
|
||||
my $channelName = $row[1];
|
||||
my $serverName = $row[2];
|
||||
$channelName =~ s/%23/#/;
|
||||
|
||||
$table.="<tr><td><a href=\"view_logs?channel=$channelID\">$channelName</a></td><td>$serverName</td></tr>";
|
||||
}
|
||||
|
||||
my $privateChannels = "";
|
||||
if($logged) {
|
||||
$query = $aConnection->prepare(qq(select id from users where name=?;));
|
||||
$query = $aConnection->prepare(qq(select id, privileges from users where name=?;));
|
||||
$query->execute($frontend_session::sessions{$aRequest->{"cookies"}{"session"}}{"username"});
|
||||
my @row = $query->fetchrow_array();
|
||||
my $id = $row[0];
|
||||
$query = $aConnection->prepare(qq(select channel_id from accessors where user_id=?;));
|
||||
$query->execute($id);
|
||||
my $privileges = $row[1];
|
||||
if($privileges>0) {
|
||||
$query = $aConnection->prepare(qq(select id from channels where public=0;));
|
||||
$query->execute();
|
||||
}
|
||||
else {
|
||||
$query = $aConnection->prepare(qq(select channel_id from accessors where user_id=?;));
|
||||
$query->execute($id);
|
||||
}
|
||||
while(@row = $query->fetchrow_array()) {
|
||||
my $channelID = $row[0];
|
||||
my $channelQuery = $aConnection->prepare(qq(select channels.name, servers.name from channels inner join servers on channels.server_id=servers.id where channels.id=$channelID;));
|
||||
$channelQuery->execute();
|
||||
@row = $channelQuery->fetchrow_array();
|
||||
my $channelName = $row[0];
|
||||
$channelName =~ s/%23/#/;
|
||||
my $serverName = $row[1];
|
||||
$privateChannels.="<tr><td><a href=\"view_logs?channel=$channelID\">$channelName</a></td><td>$serverName</td></tr>";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user