Skip to content

Commit

Permalink
Admins can see any livestream
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel authored and daniel committed Dec 24, 2018
1 parent 9629aa0 commit d585257
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions plugin/Live/Objects/LiveTransmition.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ static function getFromDbByUser($user_id) {
global $global;
$user_id = intval($user_id);
$sql = "SELECT * FROM " . static::getTableName() . " WHERE users_id = ? LIMIT 1";
$res = sqlDAL::readSql($sql,"i",array($user_id), true);
$res = sqlDAL::readSql($sql, "i", array($user_id), true);
$data = sqlDAL::fetchAssoc($res);
sqlDAL::close($res);
if ($res!=false) {
if ($res != false) {
$user = $data;
} else {
$user = false;
Expand Down Expand Up @@ -136,10 +136,10 @@ static function getFromDbByUserName($userName) {
global $global;
$userName = $global['mysqli']->real_escape_string($userName);
$sql = "SELECT * FROM users WHERE user = ? LIMIT 1";
$res = sqlDAL::readSql($sql,"s",array($userName), true);
$res = sqlDAL::readSql($sql, "s", array($userName), true);
$data = sqlDAL::fetchAssoc($res);
sqlDAL::close($res);
if ($res!=false) {
if ($res != false) {
$user = $data;
return static::getFromDbByUser($user['id']);
} else {
Expand All @@ -149,7 +149,7 @@ static function getFromDbByUserName($userName) {

static function keyExists($key) {
global $global;
if(!is_string($key)){
if (!is_string($key)) {
return false;
}
$sql = "SELECT u.*, lt.* FROM " . static::getTableName() . " lt "
Expand Down Expand Up @@ -177,13 +177,13 @@ function deleteGroupsTrasmition() {
}
global $global;
$sql = "DELETE FROM live_transmitions_has_users_groups WHERE live_transmitions_id = ?";
return sqlDAL::writeSql($sql,"i",array($this->id));
return sqlDAL::writeSql($sql, "i", array($this->id));
}

function insertGroup($users_groups_id) {
global $global;
$sql = "INSERT INTO live_transmitions_has_users_groups (live_transmitions_id, users_groups_id) VALUES (?,?)";
return sqlDAL::writeSql($sql,"ii",array($this->id,$users_groups_id));
return sqlDAL::writeSql($sql, "ii", array($this->id, $users_groups_id));
}

function getGroups() {
Expand All @@ -193,10 +193,10 @@ function getGroups() {
}
global $global;
$sql = "SELECT * FROM live_transmitions_has_users_groups WHERE live_transmitions_id = ?";
$res = sqlDAL::readSql($sql,"i",array($this->id));
$res = sqlDAL::readSql($sql, "i", array($this->id));
$fullData = sqlDAL::fetchAllAssoc($res);
sqlDAL::close($res);
if ($res!=false) {
if ($res != false) {
foreach ($fullData as $row) {
$rows[] = $row["users_groups_id"];
}
Expand All @@ -210,6 +210,9 @@ function userCanSeeTransmition() {
global $global;
require_once $global['systemRootPath'] . 'objects/userGroups.php';
require_once $global['systemRootPath'] . 'objects/user.php';
if (User::isAdmin()) {
return true;
}

$transmitionGroups = $this->getGroups();
if (!empty($transmitionGroups)) {
Expand All @@ -235,4 +238,5 @@ function userCanSeeTransmition() {
return true;
}
}

}

0 comments on commit d585257

Please sign in to comment.