1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 09:49:28 +02:00

Version 9.4

Getting ready for the meet
This commit is contained in:
DanielnetoDotCom 2020-08-12 22:16:17 -03:00
parent 66cfca15d0
commit d504190b7f
8 changed files with 52 additions and 15 deletions

View file

@ -4,7 +4,7 @@ if (file_exists("../videos/configuration.php")) {
exit;
}
$installationVersion = "9.2";
$installationVersion = "9.4";
header('Content-Type: application/json');

View file

@ -23,6 +23,7 @@ CREATE TABLE IF NOT EXISTS `users` (
`backgroundURL` VARCHAR(255) NULL,
`canStream` TINYINT(1) NULL,
`canUpload` TINYINT(1) NULL,
`canCreateMeet` TINYINT(1) NULL ;
`canViewChart` TINYINT(1) NOT NULL DEFAULT 0,
`about` TEXT NULL,
`channelName` VARCHAR(45) NULL,
@ -330,7 +331,7 @@ ENGINE = InnoDB;
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `users_groups` (
`id` INT NOT NULL AUTO_INCREMENT,
`group_name` VARCHAR(45) NULL,
`group_name` VARCHAR(255) NULL,
`created` DATETIME NULL,
`modified` DATETIME NULL,
PRIMARY KEY (`id`))

View file

@ -22,7 +22,7 @@ while (!filter_var($webSiteRootURL, FILTER_VALIDATE_URL)) {
$webSiteRootURL = trim(readline(""));
}
$webSiteRootURL = rtrim($webSiteRootURL, '/') . '/';
$_POST['systemRootPath'] = "/var/www/html/YouPHPTube/";
$_POST['databaseHost'] = "localhost";
$_POST['databaseUser'] = $databaseUser;

View file

@ -3777,7 +3777,7 @@ function ogSite() {
?>
<div class="input-group">
<span class="input-group-addon"><i class="fas fa-lock"></i></span>
<input id="<?php echo $id; ?>" type="password" placeholder="<?php echo $paceholder; ?>" <?php echo $attributes; ?> >
<input id="<?php echo $id; ?>" name="<?php echo $id; ?>" type="password" placeholder="<?php echo $paceholder; ?>" <?php echo $attributes; ?> >
<span class="input-group-addon" style="cursor: pointer;" id="toggle_<?php echo $id; ?>" data-toggle="tooltip" data-placement="left" title="<?php echo __('Show/Hide Password'); ?>"><i class="fas fa-eye-slash"></i></span>
</div>
<script>

View file

@ -16,6 +16,7 @@ class User {
private $isAdmin;
private $canStream;
private $canUpload;
private $canCreateMeet;
private $canViewChart;
private $status;
private $photoURL;
@ -89,6 +90,14 @@ class User {
$this->canViewChart = (empty($canViewChart) || strtolower($canViewChart) === 'false') ? 0 : 1;
}
function getCanCreateMeet() {
return $this->canCreateMeet;
}
function setCanCreateMeet($canCreateMeet) {
$this->canCreateMeet = (empty($canCreateMeet) || strtolower($canCreateMeet) === 'false') ? 0 : 1;;
}
function getCanUpload() {
return $this->canUpload;
}
@ -469,12 +478,9 @@ if (typeof gtag !== \"function\") {
return $mark;
}
function getPhotoDB($fullURL = false) {
function getPhotoDB() {
global $global;
$photo = self::getPhoto($this->id);
if($fullURL){
$photo = "{$global['webSiteRootURL']}{$photo}";
}
return $photo;
}
@ -555,11 +561,11 @@ if (typeof gtag !== \"function\") {
$this->donationLink = "";
}
if (!empty($this->id)) {
$formats = "ssssiii";
$values = array($this->user, $this->password, $this->email, $this->name, $this->isAdmin, $this->canStream, $this->canUpload);
$formats = "ssssiiii";
$values = array($this->user, $this->password, $this->email, $this->name, $this->isAdmin, $this->canStream, $this->canUpload, $this->canCreateMeet);
$sql = "UPDATE users SET user = ?, password = ?, "
. "email = ?, name = ?, isAdmin = ?,"
. "canStream = ?,canUpload = ?,";
. "canStream = ?,canUpload = ?,canCreateMeet = ?,";
if (isset($this->canViewChart)) {
$formats .= "i";
$values[] = $this->canViewChart;
@ -593,10 +599,10 @@ if (typeof gtag !== \"function\") {
. " modified = now() WHERE id = ?";
} else {
$formats = "ssssiiissssss";
$values = array($this->user, $this->password, $this->email, $this->name, $this->isAdmin, $this->canStream, $this->canUpload,
$values = array($this->user, $this->password, $this->email, $this->name, $this->isAdmin, $this->canStream, $this->canUpload,$this->canCreateMeet,
$this->status, $this->photoURL, $this->recoverPass, $this->channelName, $this->analyticsCode, $this->externalOptions);
$sql = "INSERT INTO users (user, password, email, name, isAdmin, canStream, canUpload, canViewChart, status,photoURL,recoverPass, created, modified, channelName, analyticsCode, externalOptions) "
. " VALUES (?,?,?,?,?,?,?, false, "
$sql = "INSERT INTO users (user, password, email, name, isAdmin, canStream, canUpload, canCreateMeet, canViewChart, status,photoURL,recoverPass, created, modified, channelName, analyticsCode, externalOptions) "
. " VALUES (?,?,?,?,?,?,?,?, false, "
. "?,?,?, now(), now(),?,?,?)";
}
$insert_row = sqlDAL::writeSql($sql, $formats, $values);
@ -1498,6 +1504,14 @@ if (typeof gtag !== \"function\") {
return self::isAdmin();
}
static function canCreateMeet() {
global $global, $config;
if (self::isLogged() && !empty($_SESSION['user']['canCreateMeet'])) {
return true;
}
return self::isAdmin();
}
static function canComment() {
global $global, $config, $advancedCustomUser;
if (self::isAdmin()) {
@ -1651,13 +1665,17 @@ if (typeof gtag !== \"function\") {
return intval($this->emailVerified);
}
static function validateChannelName($channelName){
return trim(preg_replace("/[^0-9A-Z_]/i", "", ucwords($channelName)));
}
/**
*
* @param type $channelName
* @return boolean return true is is unique
*/
function setChannelName($channelName) {
$channelName = trim(preg_replace("/[^0-9A-Z_ -]/i", "", $channelName));
$channelName = self::validateChannelName($channelName);
$user = static::getChannelOwner($channelName);
if (!empty($user)) { // if the channel name exists and it is not from this user, rename the channel name
if (empty($this->id) || $user['id'] != $this->id) {

View file

@ -29,6 +29,7 @@ $user->setIsAdmin($_POST['isAdmin']);
$user->setCanStream($_POST['canStream']);
$user->setCanUpload($_POST['canUpload']);
$user->setCanViewChart($_POST['canViewChart']);
$user->setCanCreateMeet($_POST['canCreateMeet']);
$user->setStatus($_POST['status']);
$user->setEmailVerified($_POST['isEmailVerified']);
$user->setAnalyticsCode($_POST['analyticsCode']);

View file

@ -0,0 +1,6 @@
-- Add Meet Support
ALTER TABLE `users`
ADD COLUMN `canCreateMeet` TINYINT(1) NULL DEFAULT NULL ;
UPDATE configurations SET version = '9.4', modified = now() WHERE id = 1;

View file

@ -113,6 +113,13 @@
<label for="canViewChart" class="label-success"></label>
</div>
</li>
<li class="list-group-item">
<?php echo __("Can create meet"); ?>
<div class="material-switch pull-right">
<input type="checkbox" value="canCreateMeet" id="canCreateMeet"/>
<label for="canCreateMeet" class="label-success"></label>
</div>
</li>
<li class="list-group-item">
<?php echo __("E-mail Verified"); ?>
<div class="material-switch pull-right">
@ -323,6 +330,7 @@
$('#canStream').prop('checked', (row.canStream == "1" ? true : false));
$('#canUpload').prop('checked', (row.canUpload == "1" ? true : false));
$('#canViewChart').prop('checked', (row.canViewChart == "1" ? true : false));
$('#canCreateMeet').prop('checked', (row.canCreateMeet == "1" ? true : false));
$('#status').prop('checked', (row.status === "a" ? true : false));
$('#isEmailVerified').prop('checked', (row.isEmailVerified == "1" ? true : false));
<?php
@ -412,6 +420,7 @@ print AVideoPlugin::loadUsersFormJS();
$('#canStream').prop('checked', (row.canStream == "1" ? true : false));
$('#canUpload').prop('checked', (row.canUpload == "1" ? true : false));
$('#canViewChart').prop('checked', (row.canViewChart == "1" ? true : false));
$('#canCreateMeet').prop('checked', (row.canCreateMeet == "1" ? true : false));
$('#status').prop('checked', (row.status === "a" ? true : false));
$('#isEmailVerified').prop('checked', (row.isEmailVerified == "1" ? true : false));
<?php
@ -452,6 +461,7 @@ print AVideoPlugin::loadUsersFormJS();
$('#canStream').prop('checked', false);
$('#canUpload').prop('checked', false);
$('#canViewChart').prop('checked', false);
$('#canCreateMeet').prop('checked', false);
$('.userGroups').prop('checked', false);
$('#status').prop('checked', true);
$('#isEmailVerified').prop('checked', false);
@ -495,6 +505,7 @@ print AVideoPlugin::updateUserFormJS();
"canStream": $('#canStream').is(':checked'),
"canUpload": $('#canUpload').is(':checked'),
"canViewChart": $('#canViewChart').is(':checked'),
"canCreateMeet": $('#canCreateMeet').is(':checked'),
"status": $('#status').is(':checked') ? 'a' : 'i',
"isEmailVerified": $('#isEmailVerified').is(':checked'),
"userGroups": selectedUserGroups