1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 17:59:55 +02:00

Add a permission plugin that allow selected user accounts can become moderators, but without being named admin and thus giving them full control over all functions

some layouts improvements
This commit is contained in:
DanielnetoDotCom 2020-10-28 13:45:31 -03:00
parent 73adc55b08
commit a9925e44bc
69 changed files with 4149 additions and 1753 deletions

View file

@ -161,7 +161,7 @@ class Comment {
$sql .= " AND videos_id = ? "; $sql .= " AND videos_id = ? ";
$format .= "i"; $format .= "i";
$values[] = $videoId; $values[] = $videoId;
}else if(!User::isAdmin() && empty ($comments_id_pai)){ }else if(!Permissions::canAdminComment() && empty ($comments_id_pai)){
if(!User::isLogged()){ if(!User::isLogged()){
die("can not see comments"); die("can not see comments");
} }
@ -217,7 +217,7 @@ class Comment {
$sql .= " AND videos_id = ? "; $sql .= " AND videos_id = ? ";
$format .= "i"; $format .= "i";
$values[] = $videoId; $values[] = $videoId;
}else if(!User::isAdmin() && empty ($comments_id_pai)){ }else if(!Permissions::canAdminComment() && empty ($comments_id_pai)){
if(!User::isLogged()){ if(!User::isLogged()){
die("can not see comments"); die("can not see comments");
} }
@ -262,7 +262,7 @@ class Comment {
if(!User::isLogged()){ if(!User::isLogged()){
return false; return false;
} }
if(User::isAdmin()){ if(Permissions::canAdminComment()){
return true; return true;
} }
$obj = new Comment("", 0, $comments_id); $obj = new Comment("", 0, $comments_id);
@ -280,7 +280,7 @@ class Comment {
if(!User::isLogged()){ if(!User::isLogged()){
return false; return false;
} }
if(User::isAdmin()){ if(Permissions::canAdminComment()){
return true; return true;
} }
$obj = new Comment("", 0, $comments_id); $obj = new Comment("", 0, $comments_id);

View file

@ -10,7 +10,7 @@ $obj = new stdClass();
$obj->error = true; $obj->error = true;
$obj->msg = ""; $obj->msg = "";
if (!User::isAdmin()) { if (!Permissions::canClearCache()) {
$obj->msg = __("Permission denied"); $obj->msg = __("Permission denied");
die(json_encode($obj)); die(json_encode($obj));
} }

View file

@ -13,7 +13,7 @@ $obj = new stdClass();
$obj->error = true; $obj->error = true;
$obj->msg = ""; $obj->msg = "";
if (!User::isAdmin()) { if (!Permissions::canGenerateSiteMap()) {
$obj->msg = __("Permission denied"); $obj->msg = __("Permission denied");
die(json_encode($obj)); die(json_encode($obj));
} }

View file

@ -0,0 +1,29 @@
<?php
$getDiskUsage = getDiskUsage();
?>
<div class="clearfix" style="margin: 10px 12px;">
<div class="progress" style="margin: 2px;">
<div class="progress-bar progress-bar-success" role="progressbar" style="width:<?php echo $getDiskUsage->videos_dir_used_percentage; ?>%">
<?php echo $getDiskUsage->videos_dir_used_percentage; ?>%
</div>
<div class="progress-bar progress-bar-warning" role="progressbar" style="width:<?php echo $getDiskUsage->disk_used_percentage - $getDiskUsage->videos_dir_used_percentage; ?>%">
<?php echo $getDiskUsage->disk_used_percentage - $getDiskUsage->videos_dir_used_percentage; ?>%
</div>
<div class="progress-bar progress-bar-default" role="progressbar" style="width:<?php echo $getDiskUsage->disk_free_space_percentage; ?>%">
<?php echo $getDiskUsage->disk_free_space_percentage; ?>%
</div>
</div>
<div class="label label-success">
<?php echo __("Videos Directory"); ?>: <?php echo $getDiskUsage->videos_dir_human; ?> (<?php echo $getDiskUsage->videos_dir_used_percentage; ?>%)
</div>
<div class="label label-warning">
<?php echo __("Other Files"); ?>: <?php echo $getDiskUsage->disk_used_human; ?> (<?php echo $getDiskUsage->disk_used_percentage - $getDiskUsage->videos_dir_used_percentage; ?>%)
</div>
<div class="label label-primary">
<?php echo __("Free Space"); ?>: <?php echo $getDiskUsage->disk_free_space_human; ?> (<?php echo $getDiskUsage->disk_free_space_percentage; ?>%)
</div>
</div>
<?php
if ($getDiskUsage->disk_free_space_percentage < 15) {
echo "<script>$(document).ready(function () {avideoAlertHTMLText('Danger','Your Disk is almost Full, you have only <strong>{$getDiskUsage->disk_free_space_percentage}%</strong> free <br> ({$getDiskUsage->disk_free_space_human})', 'error');});</script>";
}

View file

@ -0,0 +1,106 @@
<?php
echo "<!-- OpenGraph -->";
if (empty($videos_id)) {
echo "<!-- OpenGraph no video id -->";
if (!empty($_GET['videoName'])) {
echo "<!-- OpenGraph videoName {$_GET['videoName']} -->";
$video = Video::getVideoFromCleanTitle($_GET['videoName']);
}
} else {
echo "<!-- OpenGraph videos_id {$videos_id} -->";
$video = Video::getVideoLight($videos_id);
}
if (empty($video)) {
echo "<!-- OpenGraph no video -->";
return false;
}
$videos_id = $video['id'];
$source = Video::getSourceFile($video['filename']);
$imgw = 1024;
$imgh = 768;
if (($video['type'] !== "audio") && ($video['type'] !== "linkAudio") && !empty($source['url'])) {
$img = $source['url'];
$data = getimgsize($source['path']);
$imgw = $data[0];
$imgh = $data[1];
} else if ($video['type'] == "audio") {
$img = "{$global['webSiteRootURL']}view/img/audio_wave.jpg";
}
$type = 'video';
if ($video['type'] === 'pdf') {
$type = 'pdf';
}
if ($video['type'] === 'article') {
$type = 'article';
}
$images = Video::getImageFromFilename($video['filename'], $type);
if (!empty($images->posterPortrait) && basename($images->posterPortrait) !== 'notfound_portrait.jpg' && basename($images->posterPortrait) !== 'pdf_portrait.png' && basename($images->posterPortrait) !== 'article_portrait.png') {
$img = $images->posterPortrait;
$data = getimgsize($images->posterPortraitPath);
$imgw = $data[0];
$imgh = $data[1];
} else {
$img = $images->poster;
}
$twitter_site = $advancedCustom->twitter_site;
?>
<link rel="image_src" href="<?php echo $img; ?>" />
<meta property="og:image" content="<?php echo $img; ?>" />
<meta property="og:image:secure_url" content="<?php echo $img; ?>" />
<meta property="og:image:type" content="image/jpeg" />
<meta property="og:image:width" content="<?php echo $imgw; ?>" />
<meta property="og:image:height" content="<?php echo $imgh; ?>" />
<meta property="fb:app_id" content="774958212660408" />
<meta property="og:title" content="<?php echo html2plainText($video['title']); ?>" />
<meta property="og:description" content="<?php echo html2plainText($video['description']); ?>" />
<meta property="og:url" content="<?php echo Video::getLinkToVideo($videos_id); ?>" />
<meta property="og:type" content="video.other" />
<?php
$sourceMP4 = Video::getSourceFile($video['filename'], ".mp4");
if (!AVideoPlugin::isEnabledByName("SecureVideosDirectory") && !empty($sourceMP4['url'])) {
?>
<meta property="og:video" content="<?php echo $sourceMP4['url']; ?>" />
<meta property="og:video:secure_url" content="<?php echo $sourceMP4['url']; ?>" />
<meta property="og:video:type" content="video/mp4" />
<meta property="og:video:width" content="<?php echo $imgw; ?>" />
<meta property="og:video:height" content="<?php echo $imgh; ?>" />
<?php
} else {
?>
<meta property="og:video" content="<?php echo Video::getLinkToVideo($videos_id); ?>" />
<meta property="og:video:secure_url" content="<?php echo Video::getLinkToVideo($videos_id); ?>" />
<?php
}
?>
<meta property="video:duration" content="<?php echo Video::getItemDurationSeconds($video['duration']); ?>" />
<meta property="duration" content="<?php echo Video::getItemDurationSeconds($video['duration']); ?>" />
<!-- Twitter cards -->
<?php
if (!empty($advancedCustom->twitter_player)) {
?>
<meta name="twitter:card" content="player" />
<meta name="twitter:player" content="<?php echo Video::getLinkToVideo($videos_id, $video['clean_title'], true); ?>" />
<meta name="twitter:player:width" content="480" />
<meta name="twitter:player:height" content="480" />
<?php
} else {
if (!empty($advancedCustom->twitter_summary_large_image)) {
?>
<meta name="twitter:card" content="summary_large_image" />
<?php
} else {
?>
<meta name="twitter:card" content="summary" />
<?php
}
}
?>
<meta name="twitter:site" content="<?php echo $twitter_site; ?>" />
<meta name="twitter:url" content="<?php echo Video::getLinkToVideo($videos_id); ?>"/>
<meta name="twitter:title" content="<?php echo html2plainText($video['title']); ?>"/>
<meta name="twitter:description" content="<?php echo html2plainText($video['description']); ?>"/>
<meta name="twitter:image" content="<?php echo $img; ?>"/>
<?php

View file

@ -0,0 +1,184 @@
<?php
$objSecure = AVideoPlugin::getObjectDataIfEnabled('SecureVideosDirectory');
?>
<div class="<?php echo $class; ?>" id="shareDiv">
<div class="tabbable-panel">
<div class="tabbable-line text-muted">
<ul class="nav nav-tabs">
<li class="nav-item">
<a class="nav-link " href="#tabShare" data-toggle="tab">
<span class="fa fa-share"></span>
<?php echo __("Share"); ?>
</a>
</li>
<?php
if (empty($objSecure->disableEmbedMode)) {
?>
<li class="nav-item">
<a class="nav-link " href="#tabEmbed" data-toggle="tab">
<span class="fa fa-code"></span>
<?php echo __("Embed"); ?>
</a>
</li>
<?php
}
if (empty($advancedCustom->disableEmailSharing)) {
?>
<li class="nav-item">
<a class="nav-link" href="#tabEmail" data-toggle="tab">
<span class="fa fa-envelope"></span>
<?php echo __("E-mail"); ?>
</a>
</li>
<?php
}
if (!empty($permaLink) && $permaLink !== $URLFriendly) {
?>
<li class="nav-item">
<a class="nav-link" href="#tabPermaLink" data-toggle="tab">
<span class="fa fa-link"></span>
<?php echo __("Permanent Link"); ?>
</a>
</li>
<?php
}
?>
</ul>
<div class="tab-content clearfix">
<div class="tab-pane active" id="tabShare">
<?php
$url = $permaLink;
$title = urlencode($title);
include $global['systemRootPath'] . 'view/include/social.php';
?>
</div>
<div class="tab-pane" id="tabEmbed">
<h4><span class="glyphicon glyphicon-share"></span> <?php echo __("Share Video"); ?> (Iframe): <?php echo getButtontCopyToClipboard('textAreaEmbed'); ?></h4>
<textarea class="form-control" style="min-width: 100%" rows="5" id="textAreaEmbed" readonly="readonly"><?php
$code = str_replace("{embedURL}", $embedURL, $advancedCustom->embedCodeTemplate);
echo htmlentities($code);
?>
</textarea>
<h4><span class="glyphicon glyphicon-share"></span> <?php echo __("Share Video"); ?> (Object): <?php echo getButtontCopyToClipboard('textAreaEmbedObject'); ?></h4>
<textarea class="form-control" style="min-width: 100%" rows="5" id="textAreaEmbedObject" readonly="readonly"><?php
$code = str_replace("{embedURL}", $embedURL, $advancedCustom->embedCodeTemplateObject);
echo htmlentities($code);
?>
</textarea>
</div>
<?php
if (empty($advancedCustom->disableEmailSharing)) {
?>
<div class="tab-pane" id="tabEmail">
<?php if (!User::isLogged()) { ?>
<strong>
<a href="<?php echo $global['webSiteRootURL']; ?>user"><?php echo __("Sign in now!"); ?></a>
</strong>
<?php } else { ?>
<form class="well form-horizontal" action="<?php echo $global['webSiteRootURL']; ?>sendEmail" method="post" id="contact_form">
<fieldset>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label"><?php echo __("E-mail"); ?></label>
<div class="col-md-8 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-envelope"></i></span>
<input name="email" placeholder="<?php echo __("E-mail Address"); ?>" class="form-control" type="text">
</div>
</div>
</div>
<!-- Text area -->
<div class="form-group">
<label class="col-md-4 control-label"><?php echo __("Message"); ?></label>
<div class="col-md-8 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-pencil"></i></span>
<textarea class="form-control" name="comment" placeholder="<?php echo __("Message"); ?>"><?php echo __("I would like to share this video with you:"); ?> <?php echo $URLFriendly; ?></textarea>
</div>
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label"><?php echo __("Type the code"); ?></label>
<div class="col-md-8 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><img src="<?php echo $global['webSiteRootURL']; ?>captcha?<?php echo time(); ?>" id="captcha"></span>
<span class="input-group-addon"><span class="btn btn-xs btn-success" id="btnReloadCapcha"><span class="glyphicon glyphicon-refresh"></span></span></span>
<input name="captcha" placeholder="<?php echo __("Type the code"); ?>" class="form-control" type="text" style="height: 60px;" maxlength="5" id="captchaText">
</div>
</div>
</div>
<!-- Button -->
<div class="form-group">
<label class="col-md-4 control-label"></label>
<div class="col-md-8">
<button type="submit" class="btn btn-primary" ><?php echo __("Send"); ?> <span class="glyphicon glyphicon-send"></span></button>
</div>
</div>
</fieldset>
</form>
<script>
$(document).ready(function () {
$('#btnReloadCapcha').click(function () {
$('#captcha').attr('src', '<?php echo $global['webSiteRootURL']; ?>captcha?' + Math.random());
$('#captchaText').val('');
});
$('#contact_form').submit(function (evt) {
evt.preventDefault();
modal.showPleaseWait();
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/sendEmail.json.php',
data: $('#contact_form').serializeArray(),
type: 'post',
success: function (response) {
modal.hidePleaseWait();
if (!response.error) {
avideoAlert("<?php echo __("Congratulations!"); ?>", "<?php echo __("Your message has been sent!"); ?>", "success");
} else {
avideoAlert("<?php echo __("Your message could not be sent!"); ?>", response.error, "error");
}
$('#btnReloadCapcha').trigger('click');
}
});
return false;
});
});
</script>
<?php } ?>
</div>
<?php
}
if (!empty($permaLink) && $permaLink !== $URLFriendly) {
?>
<div class="tab-pane" id="tabPermaLink">
<div class="form-group">
<label class="control-label"><?php echo __("Permanent Link") ?></label>
<?php
getInputCopyToClipboard('linkPermanent', $permaLink);
?>
</div>
<div class="form-group">
<label class="control-label"><?php echo __("URL Friendly") ?> (SEO)</label>
<?php
getInputCopyToClipboard('linkFriendly', $URLFriendly);
?>
</div>
<div class="form-group">
<label class="control-label"><?php echo __("Current Time") ?> (SEO)</label>
<?php
getInputCopyToClipboard('linkCurrentTime', $URLFriendly);
?>
</div>
</div>
<?php
}
?>
</div>
</div>
</div>
</div>

View file

@ -0,0 +1,54 @@
<?php
echo "<!-- OpenGraph for the Site -->";
if ($users_id = isChannel()) {
$imgw = 200;
$imgh = 200;
$img = User::getOGImage($users_id);
$title = User::getNameIdentificationById($users_id);
$url = User::getChannelLink($users_id);
?>
<meta property="og:type" content="profile" />
<meta property="profile:username" content="<?php echo $title; ?>" />
<?php
} else if (!isVideo()) {
$imgw = 200;
$imgh = 200;
$img = Configuration::getOGImage();
$title = html2plainText($config->getWebSiteTitle());
$url = $global['webSiteRootURL'];
?>
<meta property="og:type" content="website" />
<meta property="og:site_name" content="<?php echo $title; ?>">
<?php
} else {
return false;
}
?>
<link rel="image_src" href="<?php echo $img; ?>" />
<meta property="og:image" content="<?php echo $img; ?>" />
<meta property="og:image:url" content="<?php echo $img; ?>" />
<meta property="og:image:secure_url" content="<?php echo $img; ?>" />
<meta property="og:image:type" content="image/jpeg" />
<meta property="og:image:width" content="<?php echo $imgw; ?>" />
<meta property="og:image:height" content="<?php echo $imgh; ?>" />
<meta property="fb:app_id" content="774958212660408" />
<meta property="og:title" content="<?php echo $title; ?>" />
<meta property="og:description" content="<?php echo $title; ?>" />
<meta property="og:url" content="<?php echo $url; ?>" />
<?php
if (!empty($advancedCustom->twitter_summary_large_image)) {
?>
<meta name="twitter:card" content="summary_large_image" />
<?php
} else {
?>
<meta name="twitter:card" content="summary" />
<?php
}
?>
<meta name="twitter:url" content="<?php echo $global['webSiteRootURL']; ?>"/>
<meta name="twitter:title" content="<?php echo $title; ?>"/>
<meta name="twitter:description" content="<?php echo $title; ?>"/>
<meta name="twitter:image" content="<?php echo $img; ?>"/>

File diff suppressed because it is too large Load diff

View file

@ -168,7 +168,7 @@ class Plugin extends ObjectYPT {
static function isEnabledByName($name) { static function isEnabledByName($name) {
$row = static::getPluginByName($name); $row = static::getPluginByName($name);
if ($row) { if ($row) {
return $row['status'] == 'active'; return $row['status'] == 'active' && AVideoPlugin::isPluginTablesInstalled($name, true);
} }
return false; return false;
} }
@ -176,7 +176,7 @@ class Plugin extends ObjectYPT {
static function isEnabledByUUID($uuid) { static function isEnabledByUUID($uuid) {
$row = static::getPluginByUUID($uuid); $row = static::getPluginByUUID($uuid);
if ($row) { if ($row) {
return $row['status'] == 'active'; return $row['status'] == 'active' && AVideoPlugin::isPluginTablesInstalled($row['name'], true);
} }
return false; return false;
} }
@ -220,6 +220,7 @@ class Plugin extends ObjectYPT {
$obj->pluginversion = $p->getPluginVersion(); $obj->pluginversion = $p->getPluginVersion();
$obj->pluginversionMarketPlace = (!empty($pluginsMarketplace->plugins->{$obj->uuid}) ? $pluginsMarketplace->plugins->{$obj->uuid}->pluginversion : 0); $obj->pluginversionMarketPlace = (!empty($pluginsMarketplace->plugins->{$obj->uuid}) ? $pluginsMarketplace->plugins->{$obj->uuid}->pluginversion : 0);
$obj->pluginversionCompare = (!empty($obj->pluginversionMarketPlace) ? version_compare($obj->pluginversion, $obj->pluginversionMarketPlace) : 0); $obj->pluginversionCompare = (!empty($obj->pluginversionMarketPlace) ? version_compare($obj->pluginversion, $obj->pluginversionMarketPlace) : 0);
$obj->permissions = $obj->enabled?Permissions::getPluginPermissions($obj->id):array();
if ($obj->pluginversionCompare < 0) { if ($obj->pluginversionCompare < 0) {
$obj->tags[] = "update"; $obj->tags[] = "update";
} }

View file

@ -282,7 +282,7 @@ if (typeof gtag !== \"function\") {
$name = $parts[0]; $name = $parts[0];
// do not exceed 36 chars to leave some room for the unique id; // do not exceed 36 chars to leave some room for the unique id;
$name = substr($name, 0, 36); $name = substr($name, 0, 36);
if (!User::isAdmin()) { if (!Permissions::canAdminUsers()) {
$user = self::getUserFromChannelName($name); $user = self::getUserFromChannelName($name);
if ($user && $user['id'] !== User::getId()) { if ($user && $user['id'] !== User::getId()) {
return self::_recommendChannelName($name . "_" . uniqid(), $try + 1); return self::_recommendChannelName($name . "_" . uniqid(), $try + 1);
@ -695,7 +695,11 @@ if (typeof gtag !== \"function\") {
if (empty($rows)) { if (empty($rows)) {
// check if any plugin restrict access to this video // check if any plugin restrict access to this video
if (!AVideoPlugin::userCanWatchVideo(User::getId(), $videos_id)) { if (!AVideoPlugin::userCanWatchVideo(User::getId(), $videos_id)) {
if(User::isLogged()){
_error_log("User::canWatchVideo there is no usergorup set for this video but A plugin said user [" . User::getId() . "] can not see ({$videos_id})"); _error_log("User::canWatchVideo there is no usergorup set for this video but A plugin said user [" . User::getId() . "] can not see ({$videos_id})");
}else{
_error_log("User::canWatchVideo there is no usergorup set for this video but A plugin said user [not logged] can not see ({$videos_id})");
}
return false; return false;
} else { } else {
return true; // the video is public return true; // the video is public
@ -1185,7 +1189,7 @@ if (typeof gtag !== \"function\") {
} }
unset($user['password']); unset($user['password']);
unset($user['recoverPass']); unset($user['recoverPass']);
if (!User::isAdmin() && $user['id'] !== User::getId()) { if (!Permissions::canAdminUsers() && $user['id'] !== User::getId()) {
unset($user['first_name']); unset($user['first_name']);
unset($user['last_name']); unset($user['last_name']);
unset($user['address']); unset($user['address']);
@ -1273,7 +1277,7 @@ if (typeof gtag !== \"function\") {
} }
static function getAllUsers($ignoreAdmin = false, $searchFields = array('name', 'email', 'user', 'channelName', 'about'), $status = "") { static function getAllUsers($ignoreAdmin = false, $searchFields = array('name', 'email', 'user', 'channelName', 'about'), $status = "") {
if (!self::isAdmin() && !$ignoreAdmin) { if (!Permissions::canAdminUsers() && !$ignoreAdmin) {
return false; return false;
} }
//will receive //will receive
@ -1318,7 +1322,7 @@ if (typeof gtag !== \"function\") {
} }
unset($row['password']); unset($row['password']);
unset($row['recoverPass']); unset($row['recoverPass']);
if (!User::isAdmin() && $row['id'] !== User::getId()) { if (!Permissions::canAdminUsers() && $row['id'] !== User::getId()) {
unset($row['first_name']); unset($row['first_name']);
unset($row['last_name']); unset($row['last_name']);
unset($row['address']); unset($row['address']);
@ -1362,7 +1366,7 @@ if (typeof gtag !== \"function\") {
} }
static function getTotalUsers($ignoreAdmin = false, $status = "") { static function getTotalUsers($ignoreAdmin = false, $status = "") {
if (!self::isAdmin() && !$ignoreAdmin) { if (!Permissions::canAdminUsers() && !$ignoreAdmin) {
return false; return false;
} }
//will receive //will receive
@ -1465,8 +1469,11 @@ if (typeof gtag !== \"function\") {
static function canUpload($doNotCheckPlugins = false) { static function canUpload($doNotCheckPlugins = false) {
global $global, $config, $advancedCustomUser; global $global, $config, $advancedCustomUser;
if(Permissions::canModerateVideos()){
return true;
}
if (User::isAdmin()) { if (User::isAdmin()) {
//return true; return true;
} }
if (empty($doNotCheckPlugins) && !AVideoPlugin::userCanUpload(User::getId())) { if (empty($doNotCheckPlugins) && !AVideoPlugin::userCanUpload(User::getId())) {
return false; return false;
@ -1506,6 +1513,11 @@ if (typeof gtag !== \"function\") {
if (self::isAdmin()) { if (self::isAdmin()) {
return true; return true;
} }
if(Permissions::canAdminComment()){
return true;
}
if ($config->getAuthCanComment()) { if ($config->getAuthCanComment()) {
if (empty($advancedCustomUser->unverifiedEmailsCanNOTComment)) { if (empty($advancedCustomUser->unverifiedEmailsCanNOTComment)) {
return self::isLogged(); return self::isLogged();

View file

@ -6,7 +6,7 @@ if (empty($global['systemRootPath'])) {
$_REQUEST["do_not_login"]=1; $_REQUEST["do_not_login"]=1;
require_once $global['systemRootPath'] . 'videos/configuration.php'; require_once $global['systemRootPath'] . 'videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/user.php'; require_once $global['systemRootPath'] . 'objects/user.php';
if (!User::isAdmin()) { if (!Permissions::canAdminUsers()) {
die('{"error":"'.__("Permission denied").'"}'); die('{"error":"'.__("Permission denied").'"}');
} }
session_write_close(); session_write_close();

View file

@ -63,7 +63,16 @@ class UserGroups {
$formats = "s"; $formats = "s";
$values = array($this->group_name); $values = array($this->group_name);
} }
return sqlDAL::writeSql($sql,$formats,$values); if(sqlDAL::writeSql($sql,$formats,$values)){
if (empty($this->id)) {
$id = $global['mysqli']->insert_id;
} else {
$id = $this->id;
}
return $id;
} else {
return false;
}
} }
function delete() { function delete() {
@ -191,7 +200,7 @@ class UserGroups {
// for users // for users
static function updateUserGroups($users_id, $array_groups_id, $byPassAdmin=false){ static function updateUserGroups($users_id, $array_groups_id, $byPassAdmin=false){
if (!$byPassAdmin && !User::isAdmin()) { if (!$byPassAdmin && !Permissions::canAdminUsers()) {
return false; return false;
} }
if (!is_array($array_groups_id)) { if (!is_array($array_groups_id)) {

View file

@ -1,15 +1,33 @@
<?php <?php
header('Content-Type: application/json'); header('Content-Type: application/json');
global $global, $config; global $global, $config;
if(!isset($global['systemRootPath'])){ if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php'; require_once '../videos/configuration.php';
} }
require_once $global['systemRootPath'] . 'objects/user.php'; require_once $global['systemRootPath'] . 'objects/user.php';
if (!User::isAdmin()) { if (!Permissions::canAdminUserGroups()) {
die('{"error":"'.__("Permission denied").'"}'); die('{"error":"' . __("Permission denied") . '"}');
} }
require_once 'userGroups.php'; require_once 'userGroups.php';
$obj = new UserGroups(@$_POST['id']); $obj = new UserGroups(@$_POST['id']);
$obj->setGroup_name($_POST['group_name']); $obj->setGroup_name($_POST['group_name']);
echo '{"status":"'.$obj->save().'"}';
if ($groups_id = $obj->save()) {
if(User::isAdmin()){
Users_groups_permissions::deleteAllFromGroup($groups_id);
if (!empty($_REQUEST['permissions']) && is_array($_REQUEST['permissions'])) {
foreach ($_REQUEST['permissions'] as $key=>$value) {
if(!is_array($value)){
continue;
}
foreach ($value as $value2) {
Users_groups_permissions::add($key, $groups_id, $value2);
}
}
}
}
}
echo '{"status":"' . $groups_id . '"}';

View file

@ -284,7 +284,7 @@ if (!class_exists('Video')) {
} }
if (!empty($this->id)) { if (!empty($this->id)) {
if (!$this->userCanManageVideo() && !$allowOfflineUser) { if (!$this->userCanManageVideo() && !$allowOfflineUser && !Permissions::canModerateVideos()) {
header('Content-Type: application/json'); header('Content-Type: application/json');
die('{"error":"3 ' . __("Permission denied") . '"}'); die('{"error":"3 ' . __("Permission denied") . '"}');
} }
@ -610,7 +610,7 @@ if (!class_exists('Video')) {
static function getUserGroupsCanSeeSQL() { static function getUserGroupsCanSeeSQL() {
global $global; global $global;
if (User::isAdmin()) { if (Permissions::canModerateVideos()) {
return ""; return "";
} }
$sql = " (SELECT count(id) FROM videos_group_view as gv WHERE gv.videos_id = v.id ) = 0 "; $sql = " (SELECT count(id) FROM videos_group_view as gv WHERE gv.videos_id = v.id ) = 0 ";
@ -940,7 +940,7 @@ if (!class_exists('Video')) {
$sql .= " AND v.users_id NOT IN ('" . implode("','", $blockedUsers) . "') "; $sql .= " AND v.users_id NOT IN ('" . implode("','", $blockedUsers) . "') ";
} }
if ($showOnlyLoggedUserVideos === true && !User::isAdmin()) { if ($showOnlyLoggedUserVideos === true && !Permissions::canModerateVideos()) {
$uid = intval(User::getId()); $uid = intval(User::getId());
$sql .= " AND v.users_id = '{$uid}'"; $sql .= " AND v.users_id = '{$uid}'";
} elseif (!empty($showOnlyLoggedUserVideos)) { } elseif (!empty($showOnlyLoggedUserVideos)) {
@ -1273,7 +1273,7 @@ if (!class_exists('Video')) {
if (!empty($blockedUsers)) { if (!empty($blockedUsers)) {
$sql .= " AND v.users_id NOT IN ('" . implode("','", $blockedUsers) . "') "; $sql .= " AND v.users_id NOT IN ('" . implode("','", $blockedUsers) . "') ";
} }
if ($showOnlyLoggedUserVideos === true && !User::isAdmin()) { if ($showOnlyLoggedUserVideos === true && !Permissions::canModerateVideos()) {
$sql .= " AND v.users_id = '" . User::getId() . "'"; $sql .= " AND v.users_id = '" . User::getId() . "'";
} elseif (!empty($showOnlyLoggedUserVideos)) { } elseif (!empty($showOnlyLoggedUserVideos)) {
$sql .= " AND v.users_id = '{$showOnlyLoggedUserVideos}'"; $sql .= " AND v.users_id = '{$showOnlyLoggedUserVideos}'";
@ -1388,7 +1388,7 @@ if (!class_exists('Video')) {
$sql .= " AND v.status = '{$status}'"; $sql .= " AND v.status = '{$status}'";
} }
if ($showOnlyLoggedUserVideos === true && !User::isAdmin()) { if ($showOnlyLoggedUserVideos === true && !Permissions::canModerateVideos()) {
$sql .= " AND v.users_id = '" . User::getId() . "'"; $sql .= " AND v.users_id = '" . User::getId() . "'";
} elseif (is_int($showOnlyLoggedUserVideos)) { } elseif (is_int($showOnlyLoggedUserVideos)) {
$sql .= " AND v.users_id = '{$showOnlyLoggedUserVideos}'"; $sql .= " AND v.users_id = '{$showOnlyLoggedUserVideos}'";
@ -1515,7 +1515,7 @@ if (!class_exists('Video')) {
$viewable[] = "u"; $viewable[] = "u";
} else if (!empty($_GET['videoName'])) { } else if (!empty($_GET['videoName'])) {
$post = $_POST; $post = $_POST;
if (self::isOwnerFromCleanTitle($_GET['videoName']) || User::isAdmin()) { if (self::isOwnerFromCleanTitle($_GET['videoName']) || Permissions::canModerateVideos()) {
$viewable[] = "u"; $viewable[] = "u";
} }
$_POST = $post; $_POST = $post;
@ -1854,6 +1854,18 @@ if (!class_exists('Video')) {
return static::getCleanDuration(@$ThisFileInfo['playtime_string']); return static::getCleanDuration(@$ThisFileInfo['playtime_string']);
} }
static function getResolution($file) {
global $global;
require_once($global['systemRootPath'] . 'objects/getid3/getid3.php');
if (!file_exists($file)) {
_error_log('{"status":"error", "msg":"getResolution ERROR, File (' . $file . ') Not Found"}');
return 0;
}
$getID3 = new getID3;
$ThisFileInfo = $getID3->analyze($file);
return intval(@$ThisFileInfo['video']['resolution_y']);
}
static function getHLSDurationFromFile($file) { static function getHLSDurationFromFile($file) {
$plugin = AVideoPlugin::loadPluginIfEnabled("VideoHLS"); $plugin = AVideoPlugin::loadPluginIfEnabled("VideoHLS");
if (empty($plugin)) { if (empty($plugin)) {
@ -1956,7 +1968,7 @@ if (!class_exists('Video')) {
function userCanManageVideo() { function userCanManageVideo() {
global $advancedCustomUser; global $advancedCustomUser;
if (User::isAdmin()) { if (Permissions::canAdminVideos()) {
return true; return true;
} }
if (empty($this->users_id) || !User::canUpload()) { if (empty($this->users_id) || !User::canUpload()) {
@ -2377,6 +2389,10 @@ if (!class_exists('Video')) {
return true; return true;
} }
if(Permissions::canAdminVideos()){
return true;
}
return self::isOwner($videos_id, $users_id); return self::isOwner($videos_id, $users_id);
} }
@ -2724,6 +2740,34 @@ if (!class_exists('Video')) {
} }
} }
static function getHigestResolution($filename) {
$cacheName = "getHigestResolution($filename)";
$return = ObjectYPT::getCache($cacheName, 0);
if(!empty($return)){
return object_to_array($return);
}
$sources = getVideosURL_V2($filename);
$return = array();
foreach ($sources as $key => $value) {
if($value['type']==='video'){
$parts = explode("_", $key);
$resolution = intval(@$parts[1]);
if(empty($resolution)){
$resolution = self::getResolution($value["path"]);
}
if(!isset($return['resolution']) || $resolution > $return['resolution']){
$return = $value;
$return['resolution'] = $resolution;
$return['resolution_text'] = getResolutionText($return['resolution']);
$return['resolution_label'] = getResolutionLabel($return['resolution']);
$return['resolution_string'] = trim($resolution."p {$return['resolution_label']}");
}
}
}
ObjectYPT::setCache($cacheName, $return);
return $return;
}
static function getHigestResolutionVideoMP4Source($filename, $includeS3 = false) { static function getHigestResolutionVideoMP4Source($filename, $includeS3 = false) {
$types = array('', '_HD', '_SD', '_Low'); $types = array('', '_HD', '_SD', '_Low');
foreach ($types as $value) { foreach ($types as $value) {

View file

@ -16,7 +16,7 @@ $info = $infoObj = "";
require_once 'video.php'; require_once 'video.php';
if (!empty($_POST['id'])) { if (!empty($_POST['id'])) {
if (!Video::canEdit($_POST['id'])) { if (!Video::canEdit($_POST['id']) && !Permissions::canModerateVideos()) {
die('{"error":"2 ' . __("Permission denied") . '"}'); die('{"error":"2 ' . __("Permission denied") . '"}');
} }
} }
@ -96,14 +96,14 @@ $obj->setNext_videos_id($_POST['next_videos_id']);
if (!empty($_POST['description'])) { if (!empty($_POST['description'])) {
$obj->setDescription($_POST['description']); $obj->setDescription($_POST['description']);
} }
if (empty($advancedCustomUser->userCanNotChangeCategory) || User::isAdmin()) { if (empty($advancedCustomUser->userCanNotChangeCategory) || Permissions::canModerateVideos()) {
$obj->setCategories_id($_POST['categories_id']); $obj->setCategories_id($_POST['categories_id']);
} }
if (empty($advancedCustomUser->userCanNotChangeUserGroup) || User::isAdmin()) { if (empty($advancedCustomUser->userCanNotChangeUserGroup) || Permissions::canModerateVideos()) {
$obj->setVideoGroups(empty($_POST['videoGroups']) ? array() : $_POST['videoGroups']); $obj->setVideoGroups(empty($_POST['videoGroups']) ? array() : $_POST['videoGroups']);
} }
if ($advancedCustomUser->userCanChangeVideoOwner || User::isAdmin()) { if ($advancedCustomUser->userCanChangeVideoOwner || Permissions::canModerateVideos()) {
$obj->setUsers_id($_POST['users_id']); $obj->setUsers_id($_POST['users_id']);
} }

View file

@ -8,7 +8,7 @@ require_once $global['systemRootPath'] . 'objects/user.php';
if(!empty($_GET['id'])){ if(!empty($_GET['id'])){
$_POST['id'] = $_GET['id']; $_POST['id'] = $_GET['id'];
} }
if (!User::isAdmin() || empty($_POST['id'])) { if (!Permissions::canModerateVideos() || empty($_POST['id'])) {
die('{"error":"'.__("Permission denied").'"}'); die('{"error":"'.__("Permission denied").'"}');
} }

View file

@ -21,7 +21,7 @@ foreach ($_POST['id'] as $value) {
if (empty($obj)) { if (empty($obj)) {
die("Object not found"); die("Object not found");
} }
if (!$obj->userCanManageVideo()) { if (!$obj->userCanManageVideo() && !Permissions::canModerateVideos()) {
$obj->msg = __("You can not Manage This Video"); $obj->msg = __("You can not Manage This Video");
die(json_encode($obj)); die(json_encode($obj));
} }

View file

@ -5,7 +5,7 @@ if(!isset($global['systemRootPath'])){
require_once '../videos/configuration.php'; require_once '../videos/configuration.php';
} }
require_once $global['systemRootPath'] . 'objects/user.php'; require_once $global['systemRootPath'] . 'objects/user.php';
if (!User::isAdmin()) { if (!Permissions::canModerateVideos()) {
die('{"error":"'.__("Permission denied").'"}'); die('{"error":"'.__("Permission denied").'"}');
} }
require_once $global['systemRootPath'] . 'objects/video.php'; require_once $global['systemRootPath'] . 'objects/video.php';

View file

@ -10,7 +10,7 @@ $obj = new stdClass();
$obj->msg = ""; $obj->msg = "";
$obj->error = true; $obj->error = true;
if (($advancedCustom->disableVideoSwap) || ($advancedCustom->makeSwapVideosOnlyForAdmin && !User::isAdmin())) { if (($advancedCustom->disableVideoSwap) || ($advancedCustom->makeSwapVideosOnlyForAdmin && !Permissions::canModerateVideos())) {
$obj->msg = __("Swap Disabled"); $obj->msg = __("Swap Disabled");
die(json_encode($obj)); die(json_encode($obj));
} }

View file

@ -12,7 +12,7 @@ $obj->msg = "";
$obj->error = true; $obj->error = true;
if (!User::isAdmin()) { if (!Permissions::canModerateVideos()) {
$obj->msg = __("Permission denied"); $obj->msg = __("Permission denied");
die(json_encode($obj)); die(json_encode($obj));
} }

View file

@ -314,7 +314,7 @@ class VideoStatistic extends ObjectYPT {
. " LEFT JOIN videos v ON v.id = videos_id " . " LEFT JOIN videos v ON v.id = videos_id "
. " WHERE DATE(s.created) >= DATE_SUB(DATE(NOW()), INTERVAL {$daysLimit} DAY) "; . " WHERE DATE(s.created) >= DATE_SUB(DATE(NOW()), INTERVAL {$daysLimit} DAY) ";
if ($showOnlyLoggedUserVideos === true && !User::isAdmin()) { if ($showOnlyLoggedUserVideos === true && !Permissions::canModerateVideos()) {
$sql .= " AND v.users_id = '" . User::getId() . "'"; $sql .= " AND v.users_id = '" . User::getId() . "'";
} elseif (!empty($showOnlyLoggedUserVideos)) { } elseif (!empty($showOnlyLoggedUserVideos)) {
$sql .= " AND v.users_id = '{$showOnlyLoggedUserVideos}'"; $sql .= " AND v.users_id = '{$showOnlyLoggedUserVideos}'";

View file

@ -8,14 +8,14 @@ require_once $global['systemRootPath'] . 'objects/video.php';
require_once $global['systemRootPath'] . 'objects/functions.php'; require_once $global['systemRootPath'] . 'objects/functions.php';
header('Content-Type: application/json'); header('Content-Type: application/json');
$showOnlyLoggedUserVideos = true; $showOnlyLoggedUserVideos = true;
if (User::isAdmin()) { if (Permissions::canModerateVideos()) {
$showOnlyLoggedUserVideos = false; $showOnlyLoggedUserVideos = false;
} }
$showUnlisted = false; $showUnlisted = false;
$activeUsersOnly = true; $activeUsersOnly = true;
if(!empty($_REQUEST['showAll'])){ if(!empty($_REQUEST['showAll'])){
$showUnlisted = true; $showUnlisted = true;
if(User::isAdmin()){ if(Permissions::canModerateVideos()){
$activeUsersOnly = false; $activeUsersOnly = false;
} }
} }
@ -37,6 +37,7 @@ foreach ($videos as $key => $value) {
$videos[$key]['title'] = preg_replace('/[\x00-\x1F\x7F]/u', '', $videos[$key]['title']); $videos[$key]['title'] = preg_replace('/[\x00-\x1F\x7F]/u', '', $videos[$key]['title']);
$videos[$key]['clean_title'] = preg_replace('/[\x00-\x1F\x7F]/u', '', $videos[$key]['clean_title']); $videos[$key]['clean_title'] = preg_replace('/[\x00-\x1F\x7F]/u', '', $videos[$key]['clean_title']);
$videos[$key]['typeLabels'] = Video::getVideoTypeLabels($videos[$key]['filename']); $videos[$key]['typeLabels'] = Video::getVideoTypeLabels($videos[$key]['filename']);
$videos[$key]['maxResolution'] = Video::getHigestResolution($videos[$key]['filename']);
if(!empty($videos[$key]['next_videos_id'])){ if(!empty($videos[$key]['next_videos_id'])){
unset($_POST['searchPhrase']); unset($_POST['searchPhrase']);
$videos[$key]['next_video'] = Video::getVideo($videos[$key]['next_videos_id']); $videos[$key]['next_video'] = Video::getVideo($videos[$key]['next_videos_id']);

View file

@ -8,7 +8,7 @@ require_once $global['systemRootPath'] . 'objects/video.php';
require_once $global['systemRootPath'] . 'objects/functions.php'; require_once $global['systemRootPath'] . 'objects/functions.php';
header('Content-type: text/plain'); header('Content-type: text/plain');
$showOnlyLoggedUserVideos = true; $showOnlyLoggedUserVideos = true;
if (User::isAdmin()) { if (Permissions::canModerateVideos()) {
$showOnlyLoggedUserVideos = false; $showOnlyLoggedUserVideos = false;
} }
$videos = Video::getAllVideosLight('', $showOnlyLoggedUserVideos, false); $videos = Video::getAllVideosLight('', $showOnlyLoggedUserVideos, false);

File diff suppressed because it is too large Load diff

View file

@ -227,7 +227,7 @@ function createGallerySection($videos, $crc = "", $get = array(), $ignoreAds = f
</a> </a>
<div class="text-muted galeryDetails" style="overflow: hidden;"> <div class="text-muted galeryDetails" style="overflow: hidden;">
<div> <div class="galleryTags">
<?php if (empty($_GET['catName'])) { ?> <?php if (empty($_GET['catName'])) { ?>
<a class="label label-default" href="<?php echo $global['webSiteRootURL']; ?>cat/<?php echo $value['clean_category']; ?>"> <a class="label label-default" href="<?php echo $global['webSiteRootURL']; ?>cat/<?php echo $value['clean_category']; ?>">
<?php <?php

View file

@ -201,3 +201,9 @@ a.h6{
display:-webkit-box; display:-webkit-box;
font-weight: bold; font-weight: bold;
} }
.galleryTags .label{
display: table-cell;
}
.galleryTags{
margin: 1px;
}

View file

@ -0,0 +1,271 @@
<?php
require_once dirname(__FILE__) . '/../../../videos/configuration.php';
class Users_groups_permissions extends ObjectYPT {
protected $id, $name, $users_groups_id, $plugins_id, $type, $status;
static function getSearchFieldsNames() {
return array('name');
}
static function getTableName() {
return 'users_groups_permissions';
}
static function getAllUsers_groups() {
global $global;
$table = "users_groups";
$sql = "SELECT * FROM {$table} WHERE 1=1 ";
$sql .= self::getSqlFromPost();
$res = sqlDAL::readSql($sql);
$fullData = sqlDAL::fetchAllAssoc($res);
sqlDAL::close($res);
$rows = array();
if ($res != false) {
foreach ($fullData as $row) {
$rows[] = $row;
}
} else {
_error_log($sql . ' Error : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
}
return $rows;
}
static function getAllPlugins() {
global $global;
$table = "plugins";
$sql = "SELECT * FROM {$table} WHERE 1=1 ";
$sql .= self::getSqlFromPost();
$res = sqlDAL::readSql($sql);
$fullData = sqlDAL::fetchAllAssoc($res);
sqlDAL::close($res);
$rows = array();
if ($res != false) {
foreach ($fullData as $row) {
$rows[] = $row;
}
} else {
_error_log($sql . ' Error : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
}
return $rows;
}
function setId($id) {
$this->id = intval($id);
}
function setName($name) {
$this->name = $name;
}
function setusers_groups_id($users_groups_id) {
$this->users_groups_id = intval($users_groups_id);
}
function setPlugins_id($plugins_id) {
$this->plugins_id = intval($plugins_id);
}
function setType($type) {
$this->type = intval($type);
}
function setStatus($status) {
$this->status = $status;
}
function getId() {
return intval($this->id);
}
function getName() {
return $this->name;
}
function getusers_groups_id() {
return intval($this->users_groups_id);
}
function getPlugins_id() {
return intval($this->plugins_id);
}
function getType() {
return $this->type;
}
function getStatus() {
return $this->status;
}
static function deleteAllFromGroup($groups_id){
global $global;
$groups_id = intval($groups_id);
if (!empty($groups_id)) {
$sql = "DELETE FROM " . static::getTableName() . " ";
$sql .= " WHERE users_groups_id = ?";
$global['lastQuery'] = $sql;
//_error_log("Delete Query: ".$sql);
return sqlDAL::writeSql($sql, "i", array($groups_id));
}
_error_log("Id for table " . static::getTableName() . " not defined for deletion", AVideoLog::$ERROR);
return false;
}
static function add($pluginName, $users_groups_id, $type){
$row = Plugin::getPluginByName($pluginName);
if(!empty($row['id'])){
$o = new Users_groups_permissions(0);
$o->setusers_groups_id($users_groups_id);
$o->setPlugins_id($row['id']);
$o->setType($type);
return $o->save();
}
return false;
}
static function getAllFromUserGorup($users_groups_id, $activeOnly = true) {
global $global, $getAllPermissionsFromUserGorup;
$users_groups_id = intval($users_groups_id);
if(empty($users_groups_id)){
return array();
}
if(empty($getAllPermissionsFromUserGorup)){
$getAllPermissionsFromUserGorup = array();
}
if(isset($getAllPermissionsFromUserGorup[$users_groups_id])){
return $getAllPermissionsFromUserGorup[$users_groups_id];
}
$sql = "SELECT * FROM " . static::getTableName() . " ";
$sql .= " WHERE users_groups_id = ?";
if($activeOnly){
$sql .= " and status = 'a' ";
}
$res = sqlDAL::readSql($sql, "i", array($users_groups_id));
$fullData = sqlDAL::fetchAllAssoc($res);
sqlDAL::close($res);
$rows = array();
if ($res != false) {
foreach ($fullData as $row) {
$plugin = new Plugin($row['plugins_id']);
if(empty($rows[$plugin->getName()])){
$rows[$plugin->getName()] = array();
}
$rows[$plugin->getName()][] = $row['type'];
}
} else {
_error_log($sql . ' Error : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
}
$getAllPermissionsFromUserGorup[$users_groups_id] = $rows;
return $rows;
}
static function getAllFromPluginAndType($plugins_id, $type, $activeOnly = true) {
global $global, $getAllPermissionsFromPlugin;
$plugins_id = intval($plugins_id);
if(empty($plugins_id)){
return array();
}
if(empty($getAllPermissionsFromUserGorup)){
$getAllPermissionsFromUserGorup = array();
}
if(isset($getAllPermissionsFromUserGorup[$plugins_id])){
return $getAllPermissionsFromUserGorup[$plugins_id];
}
$sql = "SELECT * FROM " . static::getTableName() . " ";
$sql .= " WHERE plugins_id = ? AND `type` = ?";
if($activeOnly){
$sql .= " and status = 'a' ";
}
$res = sqlDAL::readSql($sql, "ii", array($plugins_id, $type));
$fullData = sqlDAL::fetchAllAssoc($res);
sqlDAL::close($res);
$rows = array();
if ($res != false) {
foreach ($fullData as $row) {
$rows[] = $row;
}
} else {
_error_log($sql . ' Error : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
}
$getAllPermissionsFromUserGorup[$plugins_id] = $rows;
return $rows;
}
static function getAllFromPlugin($plugins_id, $activeOnly = true) {
global $global, $getAllPermissionsFromPlugin;
$plugins_id = intval($plugins_id);
if(empty($plugins_id)){
return array();
}
if(empty($getAllPermissionsFromUserGorup)){
$getAllPermissionsFromUserGorup = array();
}
if(isset($getAllPermissionsFromUserGorup[$plugins_id])){
return $getAllPermissionsFromUserGorup[$plugins_id];
}
$sql = "SELECT * FROM " . static::getTableName() . " ";
$sql .= " WHERE plugins_id = ?";
if($activeOnly){
$sql .= " and status = 'a' ";
}
$res = sqlDAL::readSql($sql, "i", array($plugins_id));
$fullData = sqlDAL::fetchAllAssoc($res);
sqlDAL::close($res);
$rows = array();
if ($res != false) {
foreach ($fullData as $row) {
$rows[] = $row;
}
} else {
_error_log($sql . ' Error : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
}
$getAllPermissionsFromUserGorup[$plugins_id] = $rows;
return $rows;
}
static function getFromUserGroupAndPluginAndType($users_groups_id, $plugins_id, $type, $activeOnly = true) {
global $global, $getFromUserGroupAndPluginAndType;
$plugins_id = intval($plugins_id);
if(empty($plugins_id)){
return array();
}
$name = "$users_groups_id, $plugins_id, $type";
if(empty($getFromUserGroupAndPluginAndType)){
$getAllPermissionsFromUserGorup = array();
}
if(isset($getFromUserGroupAndPluginAndType[$name])){
return $getFromUserGroupAndPluginAndType[$name];
}
$sql = "SELECT * FROM " . static::getTableName() . " ";
$sql .= " WHERE users_groups_id = ? AND plugins_id = ? AND `type` = ? LIMIT 1";
if($activeOnly){
$sql .= " and status = 'a' ";
}
//echo $sql;var_dump($users_groups_id, $plugins_id, $type);
$res = sqlDAL::readSql($sql, "iii", array($users_groups_id, $plugins_id, $type), true);
$data = sqlDAL::fetchAssoc($res);
sqlDAL::close($res);
if ($res) {
$row = $data;
} else {
$row = false;
}
$getFromUserGroupAndPluginAndType[$name] = $row;
return $row;
}
public function save() {
if(empty($this->status)){
$this->status = 'a';
}
return parent::save();
}
}

View file

@ -0,0 +1,248 @@
<?php
global $global;
require_once $global['systemRootPath'] . 'plugin/Plugin.abstract.php';
require_once $global['systemRootPath'] . 'plugin/Permissions/Objects/Users_groups_permissions.php';
class Permissions extends PluginAbstract {
const PERMISSION_COMMENTS = 1;
const PERMISSION_FULLACCESSVIDEOS = 10;
const PERMISSION_INACTIVATEVIDEOS = 11;
const PERMISSION_USERS = 20;
const PERMISSION_USERGROUPS = 30;
const PERMISSION_CACHE = 40;
const PERMISSION_SITEMAP = 50;
const PERMISSION_LOG = 60;
public function getDescription() {
$desc = "Permissions will allow you to add intermediate permisson to usergroups without need to make them Admin, "
. " each plugin will have his own permission rules";
//$desc .= $this->isReadyLabel(array('YPTWallet'));
return $desc;
}
public function getName() {
return "Permissions";
}
public function getUUID() {
return "Permissions-5ee8405eaaa16";
}
public function getPluginVersion() {
return "1.0";
}
public function updateScript() {
global $global;
/*
if (AVideoPlugin::compareVersion($this->getName(), "2.0") < 0) {
sqlDal::executeFile($global['systemRootPath'] . 'plugin/PayPerView/install/updateV2.0.sql');
}
*
*/
return true;
}
public function getEmptyDataObject() {
$obj = new stdClass();
/*
$obj->textSample = "text";
$obj->checkboxSample = true;
$obj->numberSample = 5;
$o = new stdClass();
$o->type = array(0=>__("Default"))+array(1,2,3);
$o->value = 0;
$obj->selectBoxSample = $o;
$o = new stdClass();
$o->type = "textarea";
$o->value = "";
$obj->textareaSample = $o;
*/
return $obj;
}
public function getPluginMenu() {
global $global;
return '<a href="plugin/Permissions/View/editor.php" class="btn btn-primary btn-sm btn-xs btn-block"><i class="fa fa-edit"></i> Edit</a>';
}
static function getForm() {
global $global;
$plugins = Plugin::getAllEnabled();
foreach ($plugins as $value) {
$row = Plugin::getPluginByName($value['dirName']);
$p = AVideoPlugin::loadPlugin($value['dirName']);
if (is_object($p) && method_exists($p, 'getPermissionsOptions')) {
$array = $p->getPermissionsOptions();
foreach ($array as $value) {
if (!is_object($value)) {
continue;
}
echo "<div class=\"checkbox\">"
. "<label data-toggle=\"tooltip\" title=\"" . addcslashes($value->getDescription(), '"') . "\">"
. "<input type=\"checkbox\" name=\"permissions[" . $value->getClassName() . "][]\" value=\"" . $value->getType() . "\" class=\"permissions " . $value->getClassName() . "\">" . $value->getName() . " "
. "</label>"
. " <button type='button' class='btn btn-xs pull-right' data-toggle=\"tooltip\" title=\"" . $value->getClassName() . " Plugin\" onclick=\"pluginPermissionsBtn({$row['id']})\">(" . $value->getClassName() . ")</button>"
. "</div>";
}
}
}
return false;
}
static function hasPermission($type, $pluginName) {
global $hasPermission;
if (!User::isLogged()) {
return false;
}
if (User::isAdmin()) {
return true;
}
if (empty($hasPermission)) {
$hasPermission = array();
}
if (empty($hasPermission[$pluginName])) {
$hasPermission[$pluginName] = array();
}
if (isset($hasPermission[$pluginName][$type])) {
return $hasPermission[$pluginName][$type];
}
$hasPermission[$pluginName][$type] = false;
$groups = UserGroups::getUserGroups(User::getId());
foreach ($groups as $value) {
$permissions = Users_groups_permissions::getAllFromUserGorup($value['id']);
if (!empty($permissions[$pluginName]) && in_array($type, $permissions[$pluginName])) {
$hasPermission[$pluginName][$type] = true;
return $hasPermission[$pluginName][$type];
}
}
return $hasPermission[$pluginName][$type];
}
static function canAdminComment() {
return self::hasPermission(Permissions::PERMISSION_COMMENTS, 'Permissions');
}
static function canAdminVideos() {
return self::hasPermission(Permissions::PERMISSION_FULLACCESSVIDEOS, 'Permissions');
}
static function canModerateVideos() {
return self::hasPermission(Permissions::PERMISSION_INACTIVATEVIDEOS, 'Permissions') || self::canAdminVideos();
}
static function canAdminUsers() {
return self::hasPermission(Permissions::PERMISSION_USERS, 'Permissions');
}
static function canAdminUserGroups() {
return self::hasPermission(Permissions::PERMISSION_USERGROUPS, 'Permissions');
}
static function canClearCache() {
return self::hasPermission(Permissions::PERMISSION_CACHE, 'Permissions');
}
static function canGenerateSiteMap() {
return self::hasPermission(Permissions::PERMISSION_SITEMAP, 'Permissions');
}
static function canSeeLogs() {
return self::hasPermission(Permissions::PERMISSION_LOG, 'Permissions');
}
/**
*
const COMMENTS = 1;
const FULLACCESSVIDEOS = 10;
const INACTIVATEVIDEOS = 11;
const USERS = 20;
const USERGROUPS = 30;
const CACHE = 40;
const SITEMAP = 50;
const LOG = 60;
*/
function getPermissionsOptions() {
$permissions = array();
$permissions[] = new PluginPermissionOption(Permissions::PERMISSION_COMMENTS, __("Comments Admin"), __("Can edit and delete comments"), 'Permissions');
$permissions[] = new PluginPermissionOption(Permissions::PERMISSION_FULLACCESSVIDEOS, __("Videos Admin"), __("Can edit and delete videos"), 'Permissions');
$permissions[] = new PluginPermissionOption(Permissions::PERMISSION_INACTIVATEVIDEOS, __("Videos Moderator"), __("Can Change the video publicity"), 'Permissions');
$permissions[] = new PluginPermissionOption(Permissions::PERMISSION_USERS, __("Users Admin"), __("Can edit users, but cannot make them admins"), 'Permissions');
$permissions[] = new PluginPermissionOption(Permissions::PERMISSION_USERGROUPS, __("Users Groups Admin"), __("Can edit and delete user groups"), 'Permissions');
$permissions[] = new PluginPermissionOption(Permissions::PERMISSION_CACHE, __("Cache Manager"), __("Can clear cache"), 'Permissions');
$permissions[] = new PluginPermissionOption(Permissions::PERMISSION_SITEMAP, __("Sitemap"), __("Can generate SiteMap"), 'Permissions');
$permissions[] = new PluginPermissionOption(Permissions::PERMISSION_LOG, __("Log"), __("Can see the log file menu"), 'Permissions');
return $permissions;
}
static function getPluginPermissions($plugins_id) {
global $getPluginPermissions;
if(empty($getPluginPermissions)){
$getPluginPermissions = array();
}
if(isset($getPluginPermissions[$plugins_id])){
return $getPluginPermissions[$plugins_id];
}
$plugin = new Plugin($plugins_id);
if(empty($plugin)){
$getPluginPermissions[$plugins_id] = array();
return $getPluginPermissions[$plugins_id];
}
$p = AVideoPlugin::loadPlugin($plugin->getName());
if(empty($p)){
$getPluginPermissions[$plugins_id] = array();
return $getPluginPermissions[$plugins_id];
}
$options = $p->getPermissionsOptions();
if(empty($options)){
$getPluginPermissions[$plugins_id] = array();
return $getPluginPermissions[$plugins_id];
}
$permissions = array();
foreach ($options as $key => $value) {
$obj = new stdClass();
$obj->name = $options[$key]->getName();
$obj->type = $options[$key]->getType();
$obj->description = $options[$key]->getDescription();
$obj->className = $options[$key]->getClassName();
$obj->groups = Users_groups_permissions::getAllFromPluginAndType($plugins_id, $value->getType());
$permissions[] = $obj;
}
$getPluginPermissions[$plugins_id] = $permissions;
return $getPluginPermissions[$plugins_id];
}
static function getPluginPermissionsFromName($pluginName) {
$row = Plugin::getPluginByName($pluginName);
if(empty($row['id'])){
return array();
}
$plugins_id = $row['id'];
return self::getPluginPermissions($plugins_id);
}
static function setPermission($users_groups_id, $plugins_id, $type, $isEnabled) {
//var_dump($users_groups_id, $plugins_id, $type, $isEnabled, $_POST);
$row = Users_groups_permissions::getFromUserGroupAndPluginAndType($users_groups_id, $plugins_id, $type, false);
//var_dump($users_groups_id, $plugins_id, $type, $isEnabled, $row);
if(!empty($row['id'])){
$ugp = new Users_groups_permissions($row['id']);
}else{
$ugp = new Users_groups_permissions();
$ugp->setusers_groups_id($users_groups_id);
$ugp->setPlugins_id($plugins_id);
$ugp->setType($type);
}
$ugp->setStatus($isEnabled?'a':'i');
return $ugp->save();
}
}

View file

@ -0,0 +1,28 @@
<?php
header('Content-Type: application/json');
require_once '../../../../videos/configuration.php';
require_once $global['systemRootPath'] . 'plugin/Permissions/Objects/Users_groups_permissions.php';
$obj = new stdClass();
$obj->error = true;
$obj->msg = "";
$plugin = AVideoPlugin::loadPluginIfEnabled('Permissions');
if(!User::isAdmin()){
$obj->msg = "You cant do this";
die(json_encode($obj));
}
$o = new Users_groups_permissions(@$_POST['id']);
$o->setName($_POST['name']);
$o->setusers_groups_id($_POST['users_groups_id']);
$o->setPlugins_id($_POST['plugins_id']);
$o->setType($_POST['type']);
$o->setStatus($_POST['status']);
if($id = $o->save()){
$obj->error = false;
}
echo json_encode($obj);

View file

@ -0,0 +1,20 @@
<?php
require_once '../../../../videos/configuration.php';
require_once $global['systemRootPath'] . 'plugin/Permissions/Objects/Users_groups_permissions.php';
header('Content-Type: application/json');
$obj = new stdClass();
$obj->error = true;
$plugin = AVideoPlugin::loadPluginIfEnabled('Permissions');
if(!User::isAdmin()){
$obj->msg = "You cant do this";
die(json_encode($obj));
}
$id = intval($_POST['id']);
$row = new Users_groups_permissions($id);
$obj->error = !$row->delete();
die(json_encode($obj));
?>

View file

@ -0,0 +1,29 @@
<?php
global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../../videos/configuration.php';
}
if (!User::isAdmin()) {
header("Location: {$global['webSiteRootURL']}?error=" . __("You can not do this"));
exit;
}
?>
<!DOCTYPE html>
<html lang="<?php echo $_SESSION['language']; ?>">
<head>
<title><?php echo $config->getWebSiteTitle(); ?> :: Permissions</title>
<?php
include $global['systemRootPath'] . 'view/include/head.php';
include $global['systemRootPath'] . 'plugin/Permissions/View/{$classname}/index_head.php';
?>
</head>
<body class="<?php echo $global['bodyClass']; ?>">
<?php
include $global['systemRootPath'] . 'view/include/navbar.php';
include $global['systemRootPath'] . 'plugin/Permissions/View/{$classname}/index_body.php';
include $global['systemRootPath'] . 'view/include/footer.php';
?>
<script type="text/javascript" src="<?php echo $global['webSiteRootURL']; ?>view/css/DataTables/datatables.min.js"></script>
</body>
</html>

View file

@ -0,0 +1,226 @@
<?php
global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../../videos/configuration.php';
}
if (!User::isAdmin()) {
header("Location: {$global['webSiteRootURL']}?error=" . __("You can not do this"));
exit;
}
?>
<div class="panel panel-default">
<div class="panel-heading">
<i class="fas fa-cog"></i> <?php echo __("Configurations"); ?>
</div>
<div class="panel-body">
<div class="row">
<div class="col-sm-4">
<div class="panel panel-default ">
<div class="panel-heading"><i class="far fa-plus-square"></i> <?php echo __("Create"); ?></div>
<div class="panel-body">
<form id="panelUsers_groups_permissionsForm">
<div class="row">
<input type="hidden" name="id" id="Users_groups_permissionsid" value="" >
<div class="form-group col-sm-12">
<label for="Users_groups_permissionsname"><?php echo __("Name"); ?>:</label>
<input type="text" id="Users_groups_permissionsname" name="name" class="form-control input-sm" placeholder="<?php echo __("Name"); ?>" required="true">
</div>
<div class="form-group col-sm-12">
<label for="Users_groups_permissionsusers_groups_id"><?php echo __("Users Groups Id1"); ?>:</label>
<select class="form-control input-sm" name="users_groups_id" id="Users_groups_permissionsusers_groups_id">
<?php
$options = Users_groups_permissions::getAllUsers_groups();
foreach ($options as $value) {
echo '<option value="' . $value['id'] . '">' . $value['id'] . '</option>';
}
?>
</select>
</div>
<div class="form-group col-sm-12">
<label for="Users_groups_permissionsplugins_id"><?php echo __("Plugins Id"); ?>:</label>
<select class="form-control input-sm" name="plugins_id" id="Users_groups_permissionsplugins_id">
<?php
$options = Users_groups_permissions::getAllPlugins();
foreach ($options as $value) {
echo '<option value="' . $value['id'] . '">' . $value['id'] . '</option>';
}
?>
</select>
</div>
<div class="form-group col-sm-12">
<label for="Users_groups_permissionstype"><?php echo __("Type"); ?>:</label>
<input type="number" step="1" id="Users_groups_permissionstype" name="type" class="form-control input-sm" placeholder="<?php echo __("Type"); ?>" required="true">
</div>
<div class="form-group col-sm-12">
<label for="status"><?php echo __("Status"); ?>:</label>
<select class="form-control input-sm" name="status" id="Users_groups_permissionsstatus">
<option value="a"><?php echo __("Active"); ?></option>
<option value="i"><?php echo __("Inactive"); ?></option>
</select>
</div>
<div class="form-group col-sm-12">
<div class="btn-group pull-right">
<span class="btn btn-success" id="newUsers_groups_permissionsLink" onclick="clearUsers_groups_permissionsForm()"><i class="fas fa-plus"></i> <?php echo __("New"); ?></span>
<button class="btn btn-primary" type="submit"><i class="fas fa-save"></i> <?php echo __("Save"); ?></button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
<div class="col-sm-8">
<div class="panel panel-default ">
<div class="panel-heading"><i class="fas fa-edit"></i> <?php echo __("Edit"); ?></div>
<div class="panel-body">
<table id="Users_groups_permissionsTable" class="display table table-bordered table-responsive table-striped table-hover table-condensed" width="100%" cellspacing="0">
<thead>
<tr>
<th>#</th>
<th><?php echo __("Name"); ?></th>
<th><?php echo __("Type"); ?></th>
<th><?php echo __("Status"); ?></th>
<th></th>
</tr>
</thead>
<tfoot>
<tr>
<th>#</th>
<th><?php echo __("Name"); ?></th>
<th><?php echo __("Type"); ?></th>
<th><?php echo __("Status"); ?></th>
<th></th>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="Users_groups_permissionsbtnModelLinks" style="display: none;">
<div class="btn-group pull-right">
<button href="" class="edit_Users_groups_permissions btn btn-default btn-xs">
<i class="fa fa-edit"></i>
</button>
<button href="" class="delete_Users_groups_permissions btn btn-danger btn-xs">
<i class="fa fa-trash"></i>
</button>
</div>
</div>
<script type="text/javascript">
function clearUsers_groups_permissionsForm() {
$('#Users_groups_permissionsid').val('');
$('#Users_groups_permissionsname').val('');
$('#Users_groups_permissionsusers_groups_id').val('');
$('#Users_groups_permissionsplugins_id').val('');
$('#Users_groups_permissionstype').val('');
$('#Users_groups_permissionsstatus').val('');
}
$(document).ready(function () {
$('#addUsers_groups_permissionsBtn').click(function () {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>plugin/Permissions/View/addUsers_groups_permissionsVideo.php',
data: $('#panelUsers_groups_permissionsForm').serialize(),
type: 'post',
success: function (response) {
if (response.error) {
swal("<?php echo __("Sorry!"); ?>", response.msg, "error");
} else {
swal("<?php echo __("Congratulations!"); ?>", "<?php echo __("Your register has been saved!"); ?>", "success");
$("#panelUsers_groups_permissionsForm").trigger("reset");
}
clearUsers_groups_permissionsForm();
tableVideos.ajax.reload();
modal.hidePleaseWait();
}
});
});
var Users_groups_permissionstableVar = $('#Users_groups_permissionsTable').DataTable({
"ajax": "<?php echo $global['webSiteRootURL']; ?>plugin/Permissions/View/Users_groups_permissions/list.json.php",
"columns": [
{"data": "id"},
{"data": "name"},
{"data": "type"},
{"data": "status"},
{
sortable: false,
data: null,
defaultContent: $('#Users_groups_permissionsbtnModelLinks').html()
}
],
select: true,
});
$('#newUsers_groups_permissions').on('click', function (e) {
e.preventDefault();
$('#panelUsers_groups_permissionsForm').trigger("reset");
$('#Users_groups_permissionsid').val('');
});
$('#panelUsers_groups_permissionsForm').on('submit', function (e) {
e.preventDefault();
modal.showPleaseWait();
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>plugin/Permissions/View/Users_groups_permissions/add.json.php',
data: $('#panelUsers_groups_permissionsForm').serialize(),
type: 'post',
success: function (response) {
if (response.error) {
swal("<?php echo __("Sorry!"); ?>", response.msg, "error");
} else {
swal("<?php echo __("Congratulations!"); ?>", "<?php echo __("Your register has been saved!"); ?>", "success");
$("#panelUsers_groups_permissionsForm").trigger("reset");
}
Users_groups_permissionstableVar.ajax.reload();
$('#Users_groups_permissionsid').val('');
modal.hidePleaseWait();
}
});
});
$('#Users_groups_permissionsTable').on('click', 'button.delete_Users_groups_permissions', function (e) {
e.preventDefault();
var tr = $(this).closest('tr')[0];
var data = Users_groups_permissionstableVar.row(tr).data();
swal({
title: "<?php echo __("Are you sure?"); ?>",
text: "<?php echo __("You will not be able to recover this action!"); ?>",
icon: "warning",
buttons: true,
dangerMode: true,
})
.then((willDelete) => {
if (willDelete) {
modal.showPleaseWait();
$.ajax({
type: "POST",
url: "<?php echo $global['webSiteRootURL']; ?>plugin/Permissions/View/Users_groups_permissions/delete.json.php",
data: data
}).done(function (resposta) {
if (resposta.error) {
swal("<?php echo __("Sorry!"); ?>", resposta.msg, "error");
}
Users_groups_permissionstableVar.ajax.reload();
modal.hidePleaseWait();
});
} else {
}
});
});
$('#Users_groups_permissionsTable').on('click', 'button.edit_Users_groups_permissions', function (e) {
e.preventDefault();
var tr = $(this).closest('tr')[0];
var data = Users_groups_permissionstableVar.row(tr).data();
$('#Users_groups_permissionsid').val(data.id);
$('#Users_groups_permissionsname').val(data.name);
$('#Users_groups_permissionsusers_groups_id').val(data.users_groups_id);
$('#Users_groups_permissionsplugins_id').val(data.plugins_id);
$('#Users_groups_permissionstype').val(data.type);
$('#Users_groups_permissionsstatus').val(data.status);
});
});
</script>

View file

@ -0,0 +1,5 @@
<?php
$plugin = AVideoPlugin::loadPluginIfEnabled('Permissions');
?>
<link rel="stylesheet" type="text/css" href="<?php echo $global['webSiteRootURL']; ?>view/css/DataTables/datatables.min.css"/>
<link href="<?php echo $global['webSiteRootURL']; ?>view/js/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css" rel="stylesheet" type="text/css"/>

View file

@ -0,0 +1,8 @@
<?php
require_once '../../../../videos/configuration.php';
require_once $global['systemRootPath'] . 'plugin/Permissions/Objects/Users_groups_permissions.php';
header('Content-Type: application/json');
$rows = Users_groups_permissions::getAll();
?>
{"data": <?php echo json_encode($rows); ?>}

View file

@ -0,0 +1,46 @@
<?php
require_once '../../../videos/configuration.php';
AVideoPlugin::loadPlugin("Permissions");
?>
<!DOCTYPE html>
<html lang="<?php echo $_SESSION['language']; ?>">
<head>
<title><?php echo $config->getWebSiteTitle(); ?> :: Permissions</title>
<?php
include $global['systemRootPath'] . 'view/include/head.php';
?>
<link rel="stylesheet" type="text/css" href="<?php echo $global['webSiteRootURL']; ?>view/css/DataTables/datatables.min.css"/>
<link href="<?php echo $global['webSiteRootURL']; ?>view/js/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css" rel="stylesheet" type="text/css"/>
</head>
<body class="<?php echo $global['bodyClass']; ?>">
<?php
include $global['systemRootPath'] . 'view/include/navbar.php';
?>
<div class="container-fluid">
<div class="panel panel-default">
<div class="panel-heading"><?php echo __('Permissions') ?>
<div class="pull-right">
<?php echo AVideoPlugin::getSwitchButton("Permissions"); ?>
</div>
</div>
<div class="panel-body">
<ul class="nav nav-tabs">
<li class="active"><a data-toggle="tab" href="#Users_groups_permissions"><?php echo __("Users Groups Permissions"); ?></a></li>
</ul>
<div class="tab-content">
<div id="Users_groups_permissions" class="tab-pane fade in active" style="padding: 10px;">
<?php
include $global['systemRootPath'] . 'plugin/Permissions/View/Users_groups_permissions/index_body.php';
?>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="<?php echo $global['webSiteRootURL']; ?>view/css/DataTables/datatables.min.js"></script>
<script src="<?php echo $global['webSiteRootURL']; ?>js/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js" type="text/javascript"></script>
<?php
include $global['systemRootPath'] . 'view/include/footer.php';
?>
</body>
</html>

View file

@ -0,0 +1,18 @@
<?php
header('Content-Type: application/json');
if (!isset($global['systemRootPath'])) {
$configFile = '../../videos/configuration.php';
if (file_exists($configFile)) {
require_once $configFile;
}
}
$permissions = array();
if(!User::isAdmin()){
die(json_encode($permissions));
}
if($_REQUEST['users_groups_id']){
$obj = AVideoPlugin::getObjectDataIfEnabled("Permissions");
$permissions = Users_groups_permissions::getAllFromUserGorup($_REQUEST['users_groups_id']);
}
die(json_encode($permissions));

View file

@ -0,0 +1,94 @@
<?php
if (!isset($global['systemRootPath'])) {
$configFile = '../../videos/configuration.php';
if (file_exists($configFile)) {
require_once $configFile;
}
}
if (!User::isAdmin()) {
forbiddenPage("Not admin");
}
$permissions = array();
if (empty($_REQUEST['plugins_id'])) {
die("empty plugins_id");
}
$obj = AVideoPlugin::getObjectDataIfEnabled("Permissions");
$permissions = Permissions::getPluginPermissions($_REQUEST['plugins_id']);
$userGroups = UserGroups::getAllUsersGroupsArray();
$uid = uniqid();
?>
<div class="panel panel-default">
<div class="panel-heading tabbable-line">
<ul class="nav nav-tabs">
<?php
$count = 0;
foreach ($permissions as $key => $value) {
$active = "";
if (empty($count)) {
$active = "active";
}
$count++;
echo "<li class=\"{$active}\"><a data-toggle=\"tab\" href=\"#ptab{$key}{$uid}\">{$value->name}</a></li>";
}
?>
</ul>
</div>
<div class="panel-body" style="padding: 15px; max-height: 80vh; overflow-y: auto;">
<div class="tab-content">
<?php
$count = 0;
foreach ($permissions as $key => $value) {
$active = "";
if (empty($count)) {
$active = " in active";
}
$count++;
?>
<div id="ptab<?php echo $key, $uid; ?>" class="tab-pane fade<?php echo $active; ?>">
<div class="alert alert-info"><strong><?php echo $value->name; ?>: </strong><?php echo $value->description; ?></div>
<?php
foreach ($userGroups as $key2 => $group) {
$checked = "";
foreach ($value->groups as $authorizedGroup) {
if ($key2 == $authorizedGroup["users_groups_id"]) {
$checked = "checked";
break;
}
}
?>
<div class="material-small material-switch pull-left">
<input name="pluginPermission<?php echo $key2; ?>"
id="pluginPermission<?php echo $key2, $uid; ?>_<?php echo $value->type; ?>"
type="checkbox" value="0" <?php echo $checked; ?>
onchange="updatePluginPermission<?php echo $uid; ?>(<?php echo $key2; ?>, <?php echo $_REQUEST['plugins_id']; ?>, <?php echo $value->type; ?>)"
/>
<label for="pluginPermission<?php echo $key2, $uid; ?>_<?php echo $value->type; ?>" class="label-success"> </label>
</div> <?php echo $group; ?><br>
<?php
}
?>
</div>
<?php
}
?>
</div>
</div>
</div>
<script>
function updatePluginPermission<?php echo $uid; ?>(users_groups_id, plugins_id, type) {
console.log(users_groups_id, plugins_id, type);
modal.showPleaseWait();
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>plugin/Permissions/setPermission.json.php',
data: {"users_groups_id": users_groups_id, "plugins_id": plugins_id, "type": type, "isEnabled": $('#pluginPermission'+users_groups_id+'<?php echo $uid; ?>_'+type).is(":checked")},
type: 'post',
success: function (response) {
console.log(response);
modal.hidePleaseWait();
}
});
}
</script>

View file

@ -0,0 +1,18 @@
<?php
header('Content-Type: application/json');
if (!isset($global['systemRootPath'])) {
$configFile = '../../videos/configuration.php';
if (file_exists($configFile)) {
require_once $configFile;
}
}
if(!User::isAdmin()){
forbiddenPage("Not admin");
}
$permissions = array();
if($_REQUEST['plugins_id']){
$obj = AVideoPlugin::getObjectDataIfEnabled("Permissions");
$permissions = Users_groups_permissions::getAllFromPlugin($_REQUEST['plugins_id']);
}
die(json_encode($permissions));

View file

@ -0,0 +1,23 @@
CREATE TABLE IF NOT EXISTS `users_groups_permissions` (
`id` INT NOT NULL AUTO_INCREMENT,
`name` VARCHAR(45) NULL,
`users_groups_id` INT(11) NOT NULL,
`plugins_id` INT(11) NOT NULL,
`type` INT(11) NULL,
`status` CHAR(1) NULL,
`created` DATETIME NULL,
`modified` DATETIME NULL,
PRIMARY KEY (`id`),
INDEX `fk_permissions_users_groups2_idx` (`users_groups_id` ASC),
INDEX `fk_permissions_plugins1_idx` (`plugins_id` ASC),
CONSTRAINT `fk_permissions_users_groups2`
FOREIGN KEY (`users_groups_id`)
REFERENCES `users_groups` (`id`)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT `fk_permissions_plugins1`
FOREIGN KEY (`plugins_id`)
REFERENCES `plugins` (`id`)
ON DELETE CASCADE
ON UPDATE CASCADE)
ENGINE = InnoDB;

View file

@ -0,0 +1,30 @@
<?php
header('Content-Type: application/json');
if (!isset($global['systemRootPath'])) {
$configFile = '../../videos/configuration.php';
if (file_exists($configFile)) {
require_once $configFile;
}
}
if(!User::isAdmin()){
forbiddenPage("Not admin");
}
$intvalList = array('users_groups_id','plugins_id','type','isEnabled');
foreach ($intvalList as $value) {
if($_REQUEST[$value]==='true'){
$_REQUEST[$value] = 1;
}else{
$_REQUEST[$value] = intval($_REQUEST[$value]);
}
}
$obj = new stdClass();
$obj->id = Permissions::setPermission($_REQUEST['users_groups_id'], $_REQUEST['plugins_id'], $_REQUEST['type'], $_REQUEST['isEnabled']);
die(json_encode($obj));

View file

@ -323,4 +323,27 @@ class PlayerSkins extends PluginAbstract {
return $config->getAutoplay(); return $config->getAutoplay();
} }
public static function getVideoTags($videos_id) {
if (empty($videos_id)) {
return array();
}
$name = "PlayeSkins_getVideoTags{$videos_id}";
$tags = ObjectYPT::getCache($name,0);
if (empty($tags)) {
$video = new Video("", "", $videos_id);
$fileName = $video->getFilename();
$resolution = Video::getHigestResolution($fileName);
if (empty($resolution) || empty($resolution['resolution_text'])) {
return array();
}
$obj = new stdClass();
$obj->label = 'Plugin';
$obj->type = "danger";
$obj->text = $resolution['resolution_text']; // closed caption
$tags = $obj;
ObjectYPT::setCache($name,$tags);
}
return array($tags);
}
} }

View file

@ -493,4 +493,37 @@ abstract class PluginAbstract {
return ""; return "";
} }
function getPermissionsOptions(){
return array();
}
}
class PluginPermissionOption{
private $type, $name, $description, $className;
function __construct($type, $name, $description, $className) {
$this->type = $type;
$this->name = $name;
$this->description = $description;
$this->className = $className;
}
function getType() {
return $this->type;
}
function getName() {
return $this->name;
}
function getDescription() {
return $this->description;
}
function getClassName() {
return $this->className;
}
} }

View file

@ -8,6 +8,7 @@ class ShareSocialButtonsOnEmbed extends PluginAbstract {
public function getTags() { public function getTags() {
return array( return array(
PluginTags::$FREE, PluginTags::$FREE,
PluginTags::$DEPRECATED,
); );
} }

View file

@ -7,6 +7,7 @@ use Pecee\SimpleRouter\SimpleRouter; //required if we want to define routes on o
class TopMenu extends PluginAbstract { class TopMenu extends PluginAbstract {
const PERMISSION_CAN_EDIT = 0;
public function getTags() { public function getTags() {
@ -85,4 +86,14 @@ class TopMenu extends PluginAbstract {
return false; return false;
return $menuId['id']; return $menuId['id'];
} }
function getPermissionsOptions(){
$permissions = array();
$permissions[] = new PluginPermissionOption(TopMenu::PERMISSION_CAN_EDIT, __("TopMenu"), __("Can edit TopMenu plugin"), 'TopMenu');
return $permissions;
}
static function canAdminTopMenu(){
return Permissions::hasPermission(TopMenu::PERMISSION_CAN_EDIT,'TopMenu');
}
} }

View file

@ -1,6 +1,6 @@
<?php <?php
global $global, $config; global $global, $config;
if(!isset($global['systemRootPath'])){ if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php'; require_once '../videos/configuration.php';
} }
$metaDescription = "About Page"; $metaDescription = "About Page";
@ -8,7 +8,7 @@ $metaDescription = "About Page";
<!DOCTYPE html> <!DOCTYPE html>
<html lang="<?php echo $config->getLanguage(); ?>"> <html lang="<?php echo $config->getLanguage(); ?>">
<head> <head>
<title><?php echo $config->getWebSiteTitle(); ?> :: <?php echo __("About").getSEOComplement(); ?></title> <title><?php echo $config->getWebSiteTitle(); ?> :: <?php echo __("About") . getSEOComplement(); ?></title>
<?php <?php
include $global['systemRootPath'] . 'view/include/head.php'; include $global['systemRootPath'] . 'view/include/head.php';
?> ?>
@ -19,8 +19,9 @@ $metaDescription = "About Page";
include $global['systemRootPath'] . 'view/include/navbar.php'; include $global['systemRootPath'] . 'view/include/navbar.php';
?> ?>
<div class="container"> <div class="container-fluid">
<div class="bgWhite"> <div class="panel panel-default">
<div class="panel-body">
<?php <?php
$custom = ""; $custom = "";
if (AVideoPlugin::isEnabled("c4fe1b83-8f5a-4d1b-b912-172c608bf9e3")) { if (AVideoPlugin::isEnabled("c4fe1b83-8f5a-4d1b-b912-172c608bf9e3")) {
@ -28,7 +29,7 @@ $metaDescription = "About Page";
$ec = new ExtraConfig(); $ec = new ExtraConfig();
$custom = $ec->getAbout(); $custom = $ec->getAbout();
} }
if(empty($custom)){ if (empty($custom)) {
?> ?>
<h1><?php echo __("I would humbly like to thank God for giving me the necessary knowledge, motivation, resources and idea to be able to execute this project. Without God's permission this would never be possible."); ?></h1> <h1><?php echo __("I would humbly like to thank God for giving me the necessary knowledge, motivation, resources and idea to be able to execute this project. Without God's permission this would never be possible."); ?></h1>
<blockquote class="blockquote"> <blockquote class="blockquote">
@ -53,11 +54,11 @@ $metaDescription = "About Page";
<?php printf(__("You have %s minutes of videos!"), number_format(getSecondsTotalVideosLength() / 6, 2)); ?> <?php printf(__("You have %s minutes of videos!"), number_format(getSecondsTotalVideosLength() / 6, 2)); ?>
</span> </span>
<?php <?php
}else{ } else {
echo $custom; echo $custom;
} }
?> ?>
</div>
</div> </div>
</div><!--/.container--> </div><!--/.container-->

View file

@ -38,7 +38,10 @@ $palyListsObj = AVideoPlugin::getObjectDataIfEnabled('PlayLists');
TimeLogEnd($timeLog, __LINE__); TimeLogEnd($timeLog, __LINE__);
?> ?>
<!-- <?php var_dump($uploadedTotalVideos, $user_id, !isToHidePrivateVideos()); ?> --> <!-- <?php var_dump($uploadedTotalVideos, $user_id, !isToHidePrivateVideos()); ?> -->
<div class="bgWhite list-group-item gallery clear clearfix" > <div class="clearfix"></div>
<div class="panel panel-default">
<div class="panel-body">
<div class="gallery" >
<div class="row"> <div class="row">
<div class="col-lg-12 col-sm-12 col-xs-12"> <div class="col-lg-12 col-sm-12 col-xs-12">
<center style="margin:5px;"> <center style="margin:5px;">
@ -229,6 +232,8 @@ TimeLogEnd($timeLog, __LINE__);
<?php <?php
} }
?> ?>
</div>
</div>
</div> </div>
<script src="<?php echo $global['webSiteRootURL']; ?>plugin/Gallery/script.js" type="text/javascript"></script> <script src="<?php echo $global['webSiteRootURL']; ?>plugin/Gallery/script.js" type="text/javascript"></script>
<script src="<?php echo $global['webSiteRootURL']; ?>view/js/infinite-scroll.pkgd.min.js" type="text/javascript"></script> <script src="<?php echo $global['webSiteRootURL']; ?>view/js/infinite-scroll.pkgd.min.js" type="text/javascript"></script>

View file

@ -25,7 +25,7 @@ $users_id_array = VideoStatistic::getUsersIDFromChannelsWithMoreViews();
$current = $_POST['current']; $current = $_POST['current'];
$_REQUEST['rowCount'] = 10; $_REQUEST['rowCount'] = 10;
$channels = Channel::getChannels(true, "u.id, '". implode(",", $users_id_array)."'"); $channels = Channel::getChannels(true, "u.id, '" . implode(",", $users_id_array) . "'");
$totalPages = ceil($totalChannels / $_REQUEST['rowCount']); $totalPages = ceil($totalChannels / $_REQUEST['rowCount']);
$metaDescription = __("Channels"); $metaDescription = __("Channels");
@ -33,7 +33,7 @@ $metaDescription = __("Channels");
<!DOCTYPE html> <!DOCTYPE html>
<html lang="<?php echo $_SESSION['language']; ?>"> <html lang="<?php echo $_SESSION['language']; ?>">
<head> <head>
<title><?php echo $config->getWebSiteTitle(); ?> :: <?php echo __("Channels").getSEOComplement(); ?></title> <title><?php echo $config->getWebSiteTitle(); ?> :: <?php echo __("Channels") . getSEOComplement(); ?></title>
<?php <?php
include $global['systemRootPath'] . 'view/include/head.php'; include $global['systemRootPath'] . 'view/include/head.php';
?> ?>
@ -77,13 +77,16 @@ $metaDescription = __("Channels");
include $global['systemRootPath'] . 'view/include/navbar.php'; include $global['systemRootPath'] . 'view/include/navbar.php';
?> ?>
<div class="container"> <div class="container-fluid">
<div class="panel" > <div class="panel panel-default" >
<div class="panel-heading"> <div class="panel-heading">
<form id="search-form" name="search-form" action="<?php echo $global['webSiteRootURL']; ?>channels" method="get"> <form id="search-form" name="search-form" action="<?php echo $global['webSiteRootURL']; ?>channels" method="get">
<div id="custom-search-input"> <div id="custom-search-input">
<div class="input-group col-md-12"> <div class="input-group col-md-12">
<input type="search" name="searchPhrase" class="form-control input-lg" placeholder="<?php echo __("Search Channels"); ?>" value="<?php echo @$_GET['searchPhrase']; unsetSearch(); ?>" /> <input type="search" name="searchPhrase" class="form-control input-lg" placeholder="<?php echo __("Search Channels"); ?>" value="<?php
echo @$_GET['searchPhrase'];
unsetSearch();
?>" />
<span class="input-group-btn"> <span class="input-group-btn">
<button class="btn btn-info btn-lg" type="submit"> <button class="btn btn-info btn-lg" type="submit">
<i class="glyphicon glyphicon-search"></i> <i class="glyphicon glyphicon-search"></i>
@ -100,8 +103,8 @@ $metaDescription = __("Channels");
foreach ($channels as $value) { foreach ($channels as $value) {
$get = array('channelName' => $value['channelName']); $get = array('channelName' => $value['channelName']);
?> ?>
<div class=" bgWhite clear clearfix" style="margin: 10px 0;"> <div class="panel panel-default">
<div class="clear clearfix"> <div class="panel-heading" style="position: relative;">
<img src="<?php echo User::getPhoto($value['id']); ?>" <img src="<?php echo User::getPhoto($value['id']); ?>"
class="img img-thumbnail img-responsive pull-left" style="max-height: 100px; margin: 0 10px;" alt="User Photo" /> class="img img-thumbnail img-responsive pull-left" style="max-height: 100px; margin: 0 10px;" alt="User Photo" />
<a href="<?php echo User::getChannelLink($value['id']); ?>" class="btn btn-default"> <a href="<?php echo User::getChannelLink($value['id']); ?>" class="btn btn-default">
@ -110,18 +113,20 @@ $metaDescription = __("Channels");
echo User::getNameIdentificationById($value['id']); echo User::getNameIdentificationById($value['id']);
?> ?>
</a> </a>
<span class="pull-right"> <div style="position: absolute; right: 10px; top: 10px;">
<?php <?php
echo User::getBlockUserButton($value['id']); echo User::getBlockUserButton($value['id']);
?> ?>
<?php echo Subscribe::getButton($value['id']); ?> <?php echo Subscribe::getButton($value['id']); ?>
</span> </div>
</div>
<div class="panel-body">
<div> <div>
<?php echo stripslashes(str_replace('\\\\\\\n', '<br/>', $value['about'])); ?> <?php echo stripslashes(str_replace('\\\\\\\n', '<br/>', $value['about'])); ?>
</div> </div>
</div>
<div class="clear clearfix"> <div class="clearfix" style="margin-bottom: 10px;"></div>
<h2><?php echo __("Preview"); ?></h2> <div class="row">
<?php <?php
$_POST['current'] = 1; $_POST['current'] = 1;
$_REQUEST['rowCount'] = 6; $_REQUEST['rowCount'] = 6;
@ -142,15 +147,17 @@ $metaDescription = __("Channels");
} }
?> ?>
</div> </div>
<div class="text-muted pull-right" style="font-size: 0.8em"> </div>
<?php echo VideoStatistic::getChannelsTotalViews($value['id'])," ",__("Views in the last 30 days"); ?> <div class="panel-footer " style="font-size: 0.8em">
<div class=" text-muted align-right">
<?php echo VideoStatistic::getChannelsTotalViews($value['id']), " ", __("Views in the last 30 days"); ?>
</div>
</div> </div>
</div> </div>
<?php <?php
} }
echo getPagination($totalPages, $current, "{$global['webSiteRootURL']}channels?page={page}"); echo getPagination($totalPages, $current, "{$global['webSiteRootURL']}channels?page={page}");
?> ?>
</div> </div>
</div> </div>

View file

@ -1,6 +1,6 @@
<?php <?php
global $global, $config; global $global, $config;
if(!isset($global['systemRootPath'])){ if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php'; require_once '../videos/configuration.php';
} }
require_once $global['systemRootPath'] . 'objects/user.php'; require_once $global['systemRootPath'] . 'objects/user.php';
@ -23,8 +23,9 @@ $metaDescription = " Contact Form";
<?php <?php
include $global['systemRootPath'] . 'view/include/navbar.php'; include $global['systemRootPath'] . 'view/include/navbar.php';
?> ?>
<div class="container-fluid">
<div class="container list-group-item"> <div class="panel panel-default">
<div class="panel-body">
<div style="display: none;" id="messageSuccess"> <div style="display: none;" id="messageSuccess">
<div class="alert alert-success clear clearfix"> <div class="alert alert-success clear clearfix">
<div class="col-md-3"> <div class="col-md-3">
@ -113,6 +114,8 @@ $metaDescription = " Contact Form";
</fieldset> </fieldset>
</form> </form>
</div> </div>
</div>
</div>
</div><!--/.container--> </div><!--/.container-->

View file

@ -32,10 +32,6 @@ time.duration{
color: rgba(255, 255, 255, 0.3)!important; color: rgba(255, 255, 255, 0.3)!important;
font-size: 50px; font-size: 50px;
} }
.videoLink div {
transition: all 0.3s ease-in-out;
font-size: 1em;
}
.videoLink div.details, .videoLink div.details,
.videoLink div.details div { .videoLink div.details div {
font-size: 0.9em; font-size: 0.9em;
@ -115,7 +111,7 @@ footer ul.list-inline li {
background-color: #000; background-color: #000;
margin-bottom: 10px; margin-bottom: 10px;
} }
.rightBar, .main-video{ .main-video{
-webkit-transition: ease 1s; /* Safari */ -webkit-transition: ease 1s; /* Safari */
transition: ease 1s; transition: ease 1s;
} }
@ -180,7 +176,6 @@ footer ul.list-inline li {
} }
.commentDetails { .commentDetails {
margin: 0 0 0 60px; margin: 0 0 0 60px;
min-height: 50px;
} }
/* End Comments */ /* End Comments */
@ -358,23 +353,6 @@ footer ul.list-inline li {
/* fancy checkbox end */ /* fancy checkbox end */
.label.fix-width {
min-width: 130px !important;
display: inline-block !important;
text-align: left;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
.label.fix-width.label-primary {
min-width: 70px !important;
text-align: right;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
border-top-left-radius: 0.25em;
;
border-bottom-left-radius: 0.25em;
;
}
.videosDetails .label{ .videosDetails .label{
border-radius: 0; border-radius: 0;
} }
@ -674,10 +652,7 @@ nav ul.items-container li ul.right-menus li li {
.navbar-collapse.in { .navbar-collapse.in {
overflow-y: visible; /* Bootstrap default is "auto" */ overflow-y: visible; /* Bootstrap default is "auto" */
} }
#videosList{
-webkit-transition: ease 1s; /* Safari */
transition: ease 1s;
}
.transparent{ .transparent{
opacity: 0.3; opacity: 0.3;
filter: alpha(opacity=30); /* For IE8 and earlier */ filter: alpha(opacity=30); /* For IE8 and earlier */
@ -856,3 +831,10 @@ img.blur{
#navBarFlag li{ #navBarFlag li{
cursor: pointer; cursor: pointer;
} }
.videoListItem{
overflow: hidden;
}
.extraVideos:empty{
display: none;
}

View file

@ -1,6 +1,6 @@
<?php <?php
global $global, $config; global $global, $config;
if(!isset($global['systemRootPath'])){ if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php'; require_once '../videos/configuration.php';
} }
require_once $global['systemRootPath'] . 'plugin/AVideoPlugin.php'; require_once $global['systemRootPath'] . 'plugin/AVideoPlugin.php';
@ -19,15 +19,19 @@ require_once $global['systemRootPath'] . 'plugin/AVideoPlugin.php';
include $global['systemRootPath'] . 'view/include/navbar.php'; include $global['systemRootPath'] . 'view/include/navbar.php';
?> ?>
<div class="container"> <div class="container-fluid">
<h1><?php echo __("User-manual of"); echo " "; echo $config->getWebSiteTitle(); ?></h1> <div class="panel panel-default">
<div class="panel-body">
<h1><?php echo __("User-manual of");
echo " ";
echo $config->getWebSiteTitle(); ?></h1>
<p><?php echo AVideoPlugin::getHelpToc(); ?> <p><?php echo AVideoPlugin::getHelpToc(); ?>
<ul> <ul>
<li><a href="#Videos help"><?php echo __('Videos'); ?></a></li> <li><a href="#Videos help"><?php echo __('Videos'); ?></a></li>
</ul> </ul>
</p> </p>
<p><?php echo __('Here you can find help, how this plattform works.'); ?></p> <p><?php echo __('Here you can find help, how this plattform works.'); ?></p>
<?php if(User::isAdmin()){ ?> <?php if (User::isAdmin()) { ?>
<h2><?php echo __('Admin\'s manual'); ?></h2> <h2><?php echo __('Admin\'s manual'); ?></h2>
<p><?php echo __('Only you can see this, because you are a admin.'); ?></p> <p><?php echo __('Only you can see this, because you are a admin.'); ?></p>
<h3><?php echo __('Settings and plugins'); ?></h3> <h3><?php echo __('Settings and plugins'); ?></h3>
@ -90,6 +94,9 @@ require_once $global['systemRootPath'] . 'plugin/AVideoPlugin.php';
echo AVideoPlugin::getHelp(); echo AVideoPlugin::getHelp();
?> ?>
</div>
</div>
</div><!--/.container--> </div><!--/.container-->
<?php <?php
include $global['systemRootPath'] . 'view/include/footer.php'; include $global['systemRootPath'] . 'view/include/footer.php';

View file

@ -40,10 +40,11 @@ if(isAVideoEncoderOnSameDomain() || $tokenIsValid || !empty($advancedCustom->vid
$newContent = str_replace('/index.m3u8', "/index.m3u8?globalToken={$_GET['globalToken']}", $newContent); $newContent = str_replace('/index.m3u8', "/index.m3u8?globalToken={$_GET['globalToken']}", $newContent);
} }
}else{ }else{
$newContent = "Can not see video [{$video['id']}] ({$_GET['videoDirectory']}) "; $newContent = "HLS.php Can not see video [{$video['id']}] ({$_GET['videoDirectory']}) ";
$newContent .= $tokenIsValid?"":" tokenInvalid"; $newContent .= $tokenIsValid?"":" tokenInvalid";
$newContent .= User::canWatchVideo($video['id'])?"":" cannot watch"; $newContent .= User::canWatchVideo($video['id'])?"":" cannot watch";
$newContent .= " ".date("Y-m-d H:i:s"); $newContent .= " ".date("Y-m-d H:i:s");
} }
header("Content-Type: text/plain"); header("Content-Type: text/plain");
echo $newContent; echo $newContent;

View file

@ -996,6 +996,77 @@ if (!User::isLogged() && !empty($advancedCustomUser->userMustBeLoggedIn) && !emp
</ul> </ul>
</li> </li>
<?php <?php
} else {
$menus = array();
if (Permissions::canAdminUsers()) {
$menus[] = '
?>
<li>
<a href="<?php echo $global[\'webSiteRootURL\']; ?>users">
<span class="glyphicon glyphicon-user"></span>
<?php echo __("Users"); ?>
</a>
</li>
<?php
';
}
if (Permissions::canAdminUserGroups()) {
$menus[] = '?>
<li>
<a href="<?php echo $global[\'webSiteRootURL\']; ?>usersGroups">
<span class="fa fa-users"></span>
<?php echo __("Users Groups"); ?>
</a>
</li>
<?php
';
}
if (Permissions::canClearCache()) {
$menus[] = '?>
<li>
<a href="#" class="clearCacheFirstPageButton">
<i class="fa fa-trash"></i> <?php echo __("Clear First Page Cache"); ?>
</a>
</li>
<li>
<a href="#" class="clearCacheButton">
<i class="fa fa-trash"></i> <?php echo __("Clear Cache Directory"); ?>
</a>
</li>
<?php
';
}
if (Permissions::canSeeLogs()) {
$menus[] = ' ?>
<li>
<a href="<?php echo $global[\'webSiteRootURL\']; ?>i/log" class="">
<i class="fas fa-clipboard-list"></i> <?php echo __("Log file"); ?>
</a>
</li>
<?php
';
}
if (Permissions::canGenerateSiteMap()) {
$menus[] = '?>
<li>
<a href="#" class="generateSiteMapButton">
<i class="fa fa-sitemap"></i> <?php echo __("Generate Sitemap"); ?>
</a>
</li>
<?php
';
}
if (count($menus)) {
?>
<hr>
<h2 class="text-danger"><?php echo __("Extra Permissions"); ?></h2>
<ul class="nav navbar" style="margin-bottom: 10px;">
<?php
eval(implode(" ", $menus));
?>
</ul>
<?php
}
} }
?> ?>

View file

@ -1229,8 +1229,8 @@
dropDownMenu: "dropdown btn-group", // must be a unique class name or constellation of class names within the actionDropDown dropDownMenu: "dropdown btn-group", // must be a unique class name or constellation of class names within the actionDropDown
dropDownMenuItems: "dropdown-menu pull-right", // must be a unique class name or constellation of class names within the actionDropDown dropDownMenuItems: "dropdown-menu pull-right", // must be a unique class name or constellation of class names within the actionDropDown
dropDownMenuText: "dropdown-text", // must be a unique class name or constellation of class names within the actionDropDown dropDownMenuText: "dropdown-text", // must be a unique class name or constellation of class names within the actionDropDown
footer: "bootgrid-footer container-fluid", footer: "bootgrid-footer",
header: "bootgrid-header container-fluid", header: "bootgrid-header",
icon: "icon glyphicon", icon: "icon glyphicon",
iconColumns: "glyphicon-th-list", iconColumns: "glyphicon-th-list",
iconDown: "glyphicon-chevron-down", iconDown: "glyphicon-chevron-down",

864
view/js/three.js Normal file

File diff suppressed because one or more lines are too long

View file

@ -4,7 +4,7 @@ if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php'; require_once '../videos/configuration.php';
} }
if (!User::isAdmin()) { if (!Permissions::canSeeLogs()) {
forbiddenPage("You cannot see the logs"); forbiddenPage("You cannot see the logs");
} }

View file

@ -1,4 +1,4 @@
<div class="container"> <div class="container-fluid">
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
@ -161,9 +161,9 @@
}, },
"commands": function (column, row) "commands": function (column, row)
{ {
var editBtn = '<button type="button" class="btn btn-xs btn-default command-edit" data-row-id="' + row.id + '" data-toggle="tooltip" data-placement="left" title="<?php echo __("Edit"); ?>"><span class="glyphicon glyphicon-edit" aria-hidden="true"></span></button>' var editBtn = '<button type="button" class="btn btn-xs btn-default command-edit" data-row-id="' + row.id + '" data-toggle="tooltip" title="<?php echo __("Edit"); ?>"><span class="glyphicon glyphicon-edit" aria-hidden="true"></span></button>'
var deleteBtn = '<button type="button" class="btn btn-default btn-xs command-delete" data-row-id="' + row.id + '" data-toggle="tooltip" data-placement="left" title="<?php echo __("Delete"); ?>"><span class="glyphicon glyphicon-erase" aria-hidden="true"></span></button>'; var deleteBtn = '<button type="button" class="btn btn-default btn-xs command-delete" data-row-id="' + row.id + '" data-toggle="tooltip" title="<?php echo __("Delete"); ?>"><i class="fa fa-trash" aria-hidden="true"></i></button>';
var rssBtn = '<a class="btn btn-info btn-xs" target="_blank" href="<?php echo $global['webSiteRootURL']; ?>feed/?catName=' + row.clean_name + '" ><i class="fas fa-rss-square"></i></a>'; var rssBtn = '<a class="btn btn-info btn-xs" data-toggle="tooltip" title="<?php echo __("RSS Feed"); ?>" target="_blank" href="<?php echo $global['webSiteRootURL']; ?>feed/?catName=' + row.clean_name + '" ><i class="fas fa-rss-square"></i></a>';
if (!row.canEdit) { if (!row.canEdit) {
editBtn = ""; editBtn = "";
@ -224,6 +224,7 @@
} }
}); });
}); });
setTimeout(function(){$('[data-toggle="tooltip"]').tooltip();},1000);
}); });

View file

@ -27,11 +27,14 @@ require_once $global['systemRootPath'] . 'objects/comment.php';
include $global['systemRootPath'] . 'view/include/navbar.php'; include $global['systemRootPath'] . 'view/include/navbar.php';
?> ?>
<div class="container"> <div class="container-fluid">
<div class="panel panel-default">
<div class="panel-body">
<?php <?php
include $global['systemRootPath'] . 'view/videoComments.php'; include $global['systemRootPath'] . 'view/videoComments.php';
?> ?>
</div>
</div>
</div><!--/.container--> </div><!--/.container-->
<?php <?php
include $global['systemRootPath'] . 'view/include/footer.php'; include $global['systemRootPath'] . 'view/include/footer.php';

View file

@ -29,7 +29,7 @@ $uuidJSCondition = implode(" && ", $rowId);
} }
</style> </style>
<div class="container-fluid"> <div class="container-fluid">
<div class="panel"> <div class="panel panel-default">
<div class="panel-heading tabbable-line"> <div class="panel-heading tabbable-line">
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li class="active"><a data-toggle="tab" href="#menu0"><i class="fa fa-plug"></i> <?php echo __('Installed Plugins'); ?></a></li> <li class="active"><a data-toggle="tab" href="#menu0"><i class="fa fa-plug"></i> <?php echo __('Installed Plugins'); ?></a></li>
@ -37,7 +37,6 @@ $uuidJSCondition = implode(" && ", $rowId);
</ul> </ul>
</div> </div>
<div class="panel-body"> <div class="panel-body">
<div class="tab-content"> <div class="tab-content">
<div id="menu0" class="tab-pane fade in active"> <div id="menu0" class="tab-pane fade in active">
<div class="list-group-item"> <div class="list-group-item">
@ -197,6 +196,13 @@ $uuidJSCondition = implode(" && ", $rowId);
</div> </div>
</div><!--/.container--> </div><!--/.container-->
<div id="pluginsPermissionModal" class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div id="pluginsPermissionModalContent">
</div>
</div>
</div>
<script> <script>
function jsonToForm(json) { function jsonToForm(json) {
$('#jsonElements').empty(); $('#jsonElements').empty();
@ -339,7 +345,7 @@ $uuidJSCondition = implode(" && ", $rowId);
return true; return true;
} }
function processShowHideIfActive(tr){ function processShowHideIfActive(tr) {
if ($(tr).find(".pluginSwitch").is(":checked")) { if ($(tr).find(".pluginSwitch").is(":checked")) {
if ($("#PluginTagsInstalled").hasClass('checked')) { if ($("#PluginTagsInstalled").hasClass('checked')) {
$(tr).show(); $(tr).show();
@ -460,7 +466,23 @@ $uuidJSCondition = implode(" && ", $rowId);
} }
} }
function pluginPermissionsBtn(plugins_id) {
modal.showPleaseWait();
$("#pluginsPermissionModalContent").html('');
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>plugin/Permissions/getPermissionsFromPlugin.html.php?plugins_id=' + plugins_id,
success: function (response) {
modal.hidePleaseWait();
$("#pluginsPermissionModalContent").html(response);
$('#pluginsPermissionModal').modal();
}
});
}
$(document).ready(function () { $(document).ready(function () {
var myTextarea = document.getElementById("inputData"); var myTextarea = document.getElementById("inputData");
var grid = $("#grid").bootgrid({ var grid = $("#grid").bootgrid({
labels: { labels: {
@ -523,6 +545,7 @@ $uuidJSCondition = implode(" && ", $rowId);
} }
var switchBtn = ''; var switchBtn = '';
} }
//var txt = '<span id="plugin' + row.uuid + '" style="margin-top: -60px; position: absolute;"></span><a href="#plugin' + row.uuid + '">' + row.name + "</a> (" + row.dir + ")<br><small class='text-muted'>UUID: " + row.uuid + "</small>"; //var txt = '<span id="plugin' + row.uuid + '" style="margin-top: -60px; position: absolute;"></span><a href="#plugin' + row.uuid + '">' + row.name + "</a> (" + row.dir + ")<br><small class='text-muted'>UUID: " + row.uuid + "</small>";
var txt = '<span id="plugin' + row.uuid + '" style="margin-top: -60px; position: absolute;"></span><a href="#plugin' + row.uuid + '">' + row.name + "</a> <small class='text-muted'>(" + row.dir + ")</small>"; var txt = '<span id="plugin' + row.uuid + '" style="margin-top: -60px; position: absolute;"></span><a href="#plugin' + row.uuid + '">' + row.name + "</a> <small class='text-muted'>(" + row.dir + ")</small>";
@ -539,6 +562,12 @@ $uuidJSCondition = implode(" && ", $rowId);
txt += "<small class='text-success'>Version: @" + row.pluginversion + "</small>"; txt += "<small class='text-success'>Version: @" + row.pluginversion + "</small>";
} }
} }
if (row.hasOwnProperty("permissions") && row.permissions.length) {
for (var i = 0; i < row.permissions.length; i++) {
console.log(row.permissions[i]);
}
txt += '<button type="button" class="btn btn-xs btn-default btn-block" onclick="pluginPermissionsBtn(' + row.id + ')" data-toggle="tooltip" title="<?php echo __('User Groups Permissions'); ?>"><span class="fa fa-users" aria-hidden="true"></span> <?php echo __('User Groups Permissions'); ?></button>';
}
return txt; return txt;
}, },

View file

@ -1,6 +1,6 @@
<?php <?php
global $global, $config; global $global, $config;
if(!isset($global['systemRootPath'])){ if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php'; require_once '../videos/configuration.php';
} }
require_once $global['systemRootPath'] . 'objects/user.php'; require_once $global['systemRootPath'] . 'objects/user.php';
@ -24,15 +24,19 @@ if (!User::canUpload()) {
include $global['systemRootPath'] . 'view/include/navbar.php'; include $global['systemRootPath'] . 'view/include/navbar.php';
?> ?>
<div class="container"> <div class="container-fluid">
<div class="col-lg-9"> <div class="panel panel-default">
<textarea id="emailMessage" placeholder="<?php echo __("Enter text"); ?> ..." style="width: 100%;"></textarea> <div class="panel-heading">
<?php echo __("Subscribes"); ?>
</div> </div>
<div class="col-lg-3"> <div class="panel-body">
<button type="button" class="btn btn-success" id="sendSubscribeBtn"> <button type="button" class="btn btn-success pull-right" id="sendSubscribeBtn">
<i class="fas fa-envelope-square"></i> <?php echo __("Notify Subscribers"); ?> <i class="fas fa-envelope-square"></i> <?php echo __("Notify Subscribers"); ?>
</button> </button>
<div class="clearfix hidden-sm hidden-md hidden-lg"></div>
<textarea id="emailMessage" placeholder="<?php echo __("Enter text"); ?> ..." style="width: 100%;"></textarea>
</div> </div>
<div class="panel-footer">
<table id="grid" class="table table-condensed table-hover table-striped"> <table id="grid" class="table table-condensed table-hover table-striped">
<thead> <thead>
<tr> <tr>
@ -43,6 +47,8 @@ if (!User::canUpload()) {
</tr> </tr>
</thead> </thead>
</table> </table>
</div>
</div>
</div><!--/.container--> </div><!--/.container-->
<?php <?php
@ -50,13 +56,13 @@ if (!User::canUpload()) {
?> ?>
<script src="<?php echo $global['webSiteRootURL']; ?>view/js/bootstrap3-wysiwyg/bootstrap3-wysihtml5.all.min.js" type="text/javascript"></script> <script src="<?php echo $global['webSiteRootURL']; ?>view/js/bootstrap3-wysiwyg/bootstrap3-wysihtml5.all.min.js" type="text/javascript"></script>
<script> <script>
function _subscribe(email,user_id, id) { function _subscribe(email, user_id, id) {
$('#subscribe' + id + ' span').addClass("fa-spinner"); $('#subscribe' + id + ' span').addClass("fa-spinner");
$('#subscribe' + id + ' span').addClass("fa-spin"); $('#subscribe' + id + ' span').addClass("fa-spin");
$.ajax({ $.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/subscribe.json.php', url: '<?php echo $global['webSiteRootURL']; ?>objects/subscribe.json.php',
method: 'POST', method: 'POST',
data: {'email': email, 'user_id':user_id}, data: {'email': email, 'user_id': user_id},
success: function (response) { success: function (response) {
console.log(response); console.log(response);
$('#subscribe' + id + ' span').removeClass("fa-spinner"); $('#subscribe' + id + ' span').removeClass("fa-spinner");
@ -76,7 +82,7 @@ if (!User::canUpload()) {
}); });
} }
function notify(){ function notify() {
modal.showPleaseWait(); modal.showPleaseWait();
$.ajax({ $.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/notifySubscribers.json.php', url: '<?php echo $global['webSiteRootURL']; ?>objects/notifySubscribers.json.php',
@ -121,10 +127,10 @@ if (!User::canUpload()) {
var row_index = $(this).closest('tr').index(); var row_index = $(this).closest('tr').index();
var row = $("#grid").bootgrid("getCurrentRows")[row_index]; var row = $("#grid").bootgrid("getCurrentRows")[row_index];
console.log(row); console.log(row);
_subscribe(row.email,row.users_id, row.id); _subscribe(row.email, row.users_id, row.id);
}); });
}); });
$("#sendSubscribeBtn").click(function (){ $("#sendSubscribeBtn").click(function () {
notify(); notify();
}); });

View file

@ -4,7 +4,7 @@ if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php'; require_once '../videos/configuration.php';
} }
require_once $global['systemRootPath'] . 'objects/user.php'; require_once $global['systemRootPath'] . 'objects/user.php';
if (!User::isAdmin()) { if (!Permissions::canAdminUsers()) {
header("Location: {$global['webSiteRootURL']}?error=" . __("You can not manage users")); header("Location: {$global['webSiteRootURL']}?error=" . __("You can not manage users"));
exit; exit;
} }
@ -22,7 +22,7 @@ if (!User::isAdmin()) {
<?php <?php
include $global['systemRootPath'] . 'view/include/navbar.php'; include $global['systemRootPath'] . 'view/include/navbar.php';
?> ?>
<div class="container"> <div class="container-fluid">
<?php <?php
include $global['systemRootPath'] . 'view/managerUsers_body.php'; include $global['systemRootPath'] . 'view/managerUsers_body.php';
?> ?>

View file

@ -4,9 +4,8 @@ if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php'; require_once '../videos/configuration.php';
} }
require_once $global['systemRootPath'] . 'objects/user.php'; require_once $global['systemRootPath'] . 'objects/user.php';
if (!User::isAdmin()) { if (!Permissions::canAdminUserGroups()) {
header("Location: {$global['webSiteRootURL']}?error=" . __("You can not manage categories")); forbiddenPage( __("You can not manage do this"));
exit;
} }
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
@ -24,7 +23,7 @@ if (!User::isAdmin()) {
<?php <?php
include $global['systemRootPath'] . 'view/include/navbar.php'; include $global['systemRootPath'] . 'view/include/navbar.php';
?> ?>
<div class="container"> <div class="container-fluid">
<?php <?php
include $global['systemRootPath'] . 'view/managerUsersGroups_body.php'; include $global['systemRootPath'] . 'view/managerUsersGroups_body.php';
?> ?>

View file

@ -36,9 +36,28 @@
</div> </div>
<div class="modal-body"> <div class="modal-body">
<form class="form-compact" id="updateUserGroupsForm" onsubmit=""> <form class="form-compact" id="updateUserGroupsForm" onsubmit="">
<input type="hidden" id="inputUserGroupsId" > <input type="hidden" id="inputUserGroupsId" name="id" >
<label for="inputName" class="sr-only"><?php echo __("Name"); ?></label> <label for="inputName" class="sr-only"><?php echo __("Name"); ?></label>
<input type="text" id="inputName" class="form-control first" placeholder="<?php echo __("Name"); ?>" required autofocus> <input type="text" id="inputName" name="group_name" class="form-control" placeholder="<?php echo __("Name"); ?>" required autofocus>
<?php
if(User::isAdmin()){
?>
<hr>
<div class="panel panel-default">
<div class="panel-heading">
<?php echo __("Group Permissions"); ?>
</div>
<div class="panel-body">
<?php
echo Permissions::getForm();
?>
</div>
</div>
<?php
}
?>
</form> </form>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
@ -49,7 +68,28 @@
</div><!-- /.modal-dialog --> </div><!-- /.modal-dialog -->
</div><!-- /.modal --> </div><!-- /.modal -->
</div><!--/.container--> </div><!--/.container-->
<div id="pluginsPermissionModal" class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div id="pluginsPermissionModalContent">
</div>
</div>
</div>
<script> <script>
function pluginPermissionsBtn(plugins_id) {
modal.showPleaseWait();
$('#groupFormModal').modal('hide');
$("#pluginsPermissionModalContent").html('');
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>plugin/Permissions/getPermissionsFromPlugin.html.php?plugins_id=' + plugins_id,
success: function (response) {
modal.hidePleaseWait();
$("#pluginsPermissionModalContent").html(response);
$('#pluginsPermissionModal').modal();
}
});
}
$(document).ready(function () { $(document).ready(function () {
var grid = $("#grid").bootgrid({ var grid = $("#grid").bootgrid({
labels: { labels: {
@ -66,7 +106,7 @@
"commands": function (column, row) "commands": function (column, row)
{ {
var editBtn = '<button type="button" class="btn btn-xs btn-default command-edit" data-row-id="' + row.id + '" data-toggle="tooltip" data-placement="left" title="<?php echo __('Edit'); ?>"><span class="glyphicon glyphicon-edit" aria-hidden="true"></span></button>' var editBtn = '<button type="button" class="btn btn-xs btn-default command-edit" data-row-id="' + row.id + '" data-toggle="tooltip" data-placement="left" title="<?php echo __('Edit'); ?>"><span class="glyphicon glyphicon-edit" aria-hidden="true"></span></button>'
var deleteBtn = '<button type="button" class="btn btn-default btn-xs command-delete" data-row-id="' + row.id + ' data-toggle="tooltip" data-placement="left" title="<?php echo __('Delete'); ?>""><span class="glyphicon glyphicon-erase" aria-hidden="true"></span></button>'; var deleteBtn = '<button type="button" class="btn btn-default btn-xs command-delete" data-row-id="' + row.id + ' data-toggle="tooltip" data-placement="left" title="<?php echo __('Delete'); ?>""><i class="fa fa-trash"></i></button>';
return editBtn + deleteBtn; return editBtn + deleteBtn;
} }
} }
@ -80,7 +120,32 @@
$('#inputUserGroupsId').val(row.id); $('#inputUserGroupsId').val(row.id);
$('#inputName').val(row.group_name); $('#inputName').val(row.group_name);
modal.showPleaseWait();
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>plugin/Permissions/getPermissions.json.php?users_groups_id=' + row.id,
success: function (response) {
console.log(response);
$(".permissions").prop("checked", false);
for (var key in response) {
if(typeof key !== 'string'){
continue;
}
for (var subkey in response[key]) {
if(typeof subkey !== 'string' || isNaN(subkey)){
continue;
}
var selector = "."+key+"[value=\""+response[key][subkey]+"\"]";
console.log(selector, $(selector));
$(selector).prop("checked", true);
}
}
$('#groupFormModal').modal(); $('#groupFormModal').modal();
modal.hidePleaseWait();
}
});
}).end().find(".command-delete").on("click", function (e) { }).end().find(".command-delete").on("click", function (e) {
var row_index = $(this).closest('tr').index(); var row_index = $(this).closest('tr').index();
var row = $("#grid").bootgrid("getCurrentRows")[row_index]; var row = $("#grid").bootgrid("getCurrentRows")[row_index];
@ -119,8 +184,10 @@
$('#inputUserGroupsId').val(''); $('#inputUserGroupsId').val('');
$('#inputName').val(''); $('#inputName').val('');
$('#inputCleanName').val(''); $('#inputCleanName').val('');
$("#updateUserGroupsForm").trigger("reset");
$(".permissions").prop("checked", false);
$('#groupFormModal').modal(); $('#groupFormModal').modal();
}); });
$('#saveUserGroupsBtn').click(function (evt) { $('#saveUserGroupsBtn').click(function (evt) {
@ -132,10 +199,10 @@
modal.showPleaseWait(); modal.showPleaseWait();
$.ajax({ $.ajax({
url: '<?php echo $global['webSiteRootURL'] . "objects/userGroupsAddNew.json.php"; ?>', url: '<?php echo $global['webSiteRootURL'] . "objects/userGroupsAddNew.json.php"; ?>',
data: {"id": $('#inputUserGroupsId').val(), "group_name": $('#inputName').val()}, data: $(this).serialize(),
type: 'post', type: 'post',
success: function (response) { success: function (response) {
if (response.status === "1") { if (response.status) {
$('#groupFormModal').modal('hide'); $('#groupFormModal').modal('hide');
$("#grid").bootgrid("reload"); $("#grid").bootgrid("reload");
avideoAlert("<?php echo __("Congratulations!"); ?>", "<?php echo __("Your group has been saved!"); ?>", "success"); avideoAlert("<?php echo __("Congratulations!"); ?>", "<?php echo __("Your group has been saved!"); ?>", "success");
@ -147,6 +214,7 @@
}); });
return false; return false;
}); });
$('[data-toggle="tooltip"]').tooltip();
}); });
</script> </script>

View file

@ -1,6 +1,6 @@
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading tabbable-line">
<div class="btn-group" > <div class="btn-group pull-right" >
<button type="button" class="btn btn-default" id="addUserBtn"> <button type="button" class="btn btn-default" id="addUserBtn">
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span> <?php echo __("New User"); ?> <span class="glyphicon glyphicon-plus" aria-hidden="true"></span> <?php echo __("New User"); ?>
</button> </button>
@ -14,12 +14,13 @@
<i class="fas fa-file-csv"></i> <?php echo __("CSV File"); ?> <i class="fas fa-file-csv"></i> <?php echo __("CSV File"); ?>
</a> </a>
</div> </div>
</div>
<div class="panel-body">
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li class="active"><a data-toggle="tab" href="#usersTab"><?php echo __('Users'); ?></a></li> <li class="active"><a data-toggle="tab" href="#usersTab"><?php echo __('Users'); ?></a></li>
<li><a data-toggle="tab" href="#inactiveUsersTab"><?php echo __('Inactive Users'); ?></a></li> <li><a data-toggle="tab" href="#inactiveUsersTab"><?php echo __('Inactive Users'); ?></a></li>
</ul> </ul>
</div>
<div class="panel-body">
<div class="tab-content"> <div class="tab-content">
<div id="usersTab" class="tab-pane fade in active"> <div id="usersTab" class="tab-pane fade in active">
<table id="grid" class="table table-condensed table-hover table-striped"> <table id="grid" class="table table-condensed table-hover table-striped">
@ -81,7 +82,7 @@
<input type="text" id="inputAnalyticsCode" class="form-control last" placeholder="Google Analytics Code: UA-123456789-1" > <input type="text" id="inputAnalyticsCode" class="form-control last" placeholder="Google Analytics Code: UA-123456789-1" >
<small>Do not paste the full javascript code, paste only the gtag id</small> <small>Do not paste the full javascript code, paste only the gtag id</small>
<ul class="list-group"> <ul class="list-group">
<li class="list-group-item"> <li class="list-group-item <?php echo User::isAdmin()?"":"hidden"; ?>">
<?php echo __("is Admin"); ?> <?php echo __("is Admin"); ?>
<div class="material-switch pull-right"> <div class="material-switch pull-right">
<input type="checkbox" value="isAdmin" id="isAdmin"/> <input type="checkbox" value="isAdmin" id="isAdmin"/>

View file

@ -34,6 +34,27 @@
#actionButtonsVideoManager button{ #actionButtonsVideoManager button{
font-size: 12px; font-size: 12px;
} }
.controls .btn{
margin: 5px 0;
}
#grid .tagsInfo span.label:not(.tagTitle){
display: inline-block;
width: 60%;
text-align: left;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
#grid .tagsInfo span.label.tagTitle{
display: inline-grid;
width: 30%;
overflow: hidden;
text-align: right;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
border-top-left-radius: 0.25em;
border-bottom-left-radius: 0.25em;
}
</style> </style>
<div class="container-fluid"> <div class="container-fluid">
<?php <?php
@ -253,11 +274,12 @@
<tr> <tr>
<th data-formatter="checkbox" data-width="25px" ></th> <th data-formatter="checkbox" data-width="25px" ></th>
<th data-column-id="title" data-formatter="titleTag" ><?php echo __("Title"); ?></th> <th data-column-id="title" data-formatter="titleTag" ><?php echo __("Title"); ?></th>
<th data-column-id="tags" data-formatter="tags" data-sortable="false" data-width="210px" data-header-css-class='hidden-xs' data-css-class='hidden-xs'><?php echo __("Tags"); ?></th> <th data-column-id="tags" data-formatter="tags" data-sortable="false" data-width="300px" data-header-css-class='hidden-xs' data-css-class='hidden-xs tagsInfo'><?php echo __("Tags"); ?></th>
<th data-column-id="duration" data-width="80px" data-header-css-class='hidden-md hidden-sm hidden-xs' data-css-class='hidden-md hidden-sm hidden-xs'><?php echo __("Duration"); ?></th> <th data-column-id="duration" data-width="80px" data-header-css-class='hidden-md hidden-sm hidden-xs' data-css-class='hidden-md hidden-sm hidden-xs'><?php echo __("Duration"); ?></th>
<th data-column-id="views_count" data-width="80px" data-header-css-class='hidden-md hidden-sm hidden-xs' data-css-class='hidden-md hidden-sm hidden-xs'><?php echo __("Views"); ?></th>
<th data-column-id="filesize" data-formatter="filesize" data-width="100px" data-header-css-class='hidden-sm hidden-xs' data-css-class='hidden-sm hidden-xs'><?php echo __("Size"); ?></th> <th data-column-id="filesize" data-formatter="filesize" data-width="100px" data-header-css-class='hidden-sm hidden-xs' data-css-class='hidden-sm hidden-xs'><?php echo __("Size"); ?></th>
<th data-column-id="created" data-order="desc" data-width="100px" data-header-css-class='hidden-sm hidden-xs' data-css-class='hidden-sm hidden-xs'><?php echo __("Created"); ?></th> <th data-column-id="created" data-order="desc" data-width="100px" data-header-css-class='hidden-sm hidden-xs' data-css-class='hidden-sm hidden-xs'><?php echo __("Created"); ?></th>
<th data-column-id="commands" data-formatter="commands" data-sortable="false" data-width="200px"></th> <th data-column-id="commands" data-formatter="commands" data-sortable="false" data-css-class='controls' data-width="200px"></th>
</tr> </tr>
</thead> </thead>
</table> </table>
@ -797,14 +819,14 @@ if (empty($advancedCustomUser->userCanNotChangeUserGroup) || User::isAdmin()) {
?> ?>
function checkProgress(encoderURL) { function checkProgress(encoderURL) {
$.ajax({ $.ajax({
url: encoderURL+'status', url: encoderURL + 'status',
success: function (response) { success: function (response) {
if (response.queue_list.length) { if (response.queue_list.length) {
for (i = 0; i < response.queue_list.length; i++) { for (i = 0; i < response.queue_list.length; i++) {
if (webSiteRootURL !== response.queue_list[i].streamer_site) { if (webSiteRootURL !== response.queue_list[i].streamer_site) {
continue; continue;
} }
if(response.queue_list[i].return_vars && response.queue_list[i].return_vars.videos_id){ if (response.queue_list[i].return_vars && response.queue_list[i].return_vars.videos_id) {
createQueueItem(response.queue_list[i], i); createQueueItem(response.queue_list[i], i);
} }
} }
@ -817,15 +839,15 @@ if (empty($advancedCustomUser->userCanNotChangeUserGroup) || User::isAdmin()) {
if (response.download_status && !response.encoding_status.progress) { if (response.download_status && !response.encoding_status.progress) {
$("#encodingProgress" + id).find('.progress-completed').html("<strong>" + response.encoding.name + " [Downloading ...] </strong> " + response.download_status.progress + '%'); $("#encodingProgress" + id).find('.progress-completed').html("<strong>" + response.encoding.name + " [Downloading ...] </strong> " + response.download_status.progress + '%');
} else { } else {
var encodingProgressCounter = $("#encodingProgressCounter"+id).text(); var encodingProgressCounter = $("#encodingProgressCounter" + id).text();
if(isNaN(encodingProgressCounter)){ if (isNaN(encodingProgressCounter)) {
encodingProgressCounter = 0; encodingProgressCounter = 0;
}else{ } else {
encodingProgressCounter = parseInt(encodingProgressCounter); encodingProgressCounter = parseInt(encodingProgressCounter);
} }
$("#encodingProgress" + id).find('.progress-completed').html("<strong>" + response.encoding.name + "[" + response.encoding_status.from + " to " + response.encoding_status.to + "] </strong> <span id='encodingProgressCounter" + id +"'>"+encodingProgressCounter+"</span>%"); $("#encodingProgress" + id).find('.progress-completed').html("<strong>" + response.encoding.name + "[" + response.encoding_status.from + " to " + response.encoding_status.to + "] </strong> <span id='encodingProgressCounter" + id + "'>" + encodingProgressCounter + "</span>%");
$("#encodingProgress" + id).find('.progress-bar').css({'width': response.encoding_status.progress + '%'}); $("#encodingProgress" + id).find('.progress-bar').css({'width': response.encoding_status.progress + '%'});
//$("#encodingProgressComplete" + id).text(response.encoding_status.progress + '%'); //$("#encodingProgressComplete" + id).text(response.encoding_status.progress + '%');
countTo("#encodingProgressComplete" + id, response.encoding_status.progress); countTo("#encodingProgressComplete" + id, response.encoding_status.progress);
@ -834,7 +856,7 @@ if (empty($advancedCustomUser->userCanNotChangeUserGroup) || User::isAdmin()) {
if (response.download_status) { if (response.download_status) {
$("#downloadProgress" + id).find('.progress-bar').css({'width': response.download_status.progress + '%'}); $("#downloadProgress" + id).find('.progress-bar').css({'width': response.download_status.progress + '%'});
} }
if (response.encoding_status.progress >= 100) { if (response.encoding_status.progress >= 100 && $("#encodingProgress" + id).length) {
$("#encodingProgress" + id).find('.progress-bar').css({'width': '100%'}); $("#encodingProgress" + id).find('.progress-bar').css({'width': '100%'});
$("#encodingProgressComplete" + id).text('100%'); $("#encodingProgressComplete" + id).text('100%');
clearTimeout(timeOut); clearTimeout(timeOut);
@ -1592,7 +1614,7 @@ echo AVideoPlugin::getManagerVideosReset();
buttons: true, buttons: true,
dangerMode: true, dangerMode: true,
}) })
.then(function(willDelete) { .then(function (willDelete) {
if (willDelete) { if (willDelete) {
avideoAlert("Deleted!", "", "success"); avideoAlert("Deleted!", "", "success");
modal.showPleaseWait(); modal.showPleaseWait();
@ -1697,27 +1719,27 @@ if (User::isAdmin()) {
<?php <?php
if (empty($advancedCustom->disableCopyEmbed)) { if (empty($advancedCustom->disableCopyEmbed)) {
?> ?>
embedBtn += '<button type="button" class="btn btn-xs btn-default command-embed" id="embedBtn' + row.id + '" onclick="getEmbedCode(' + row.id + ')" data-toggle="tooltip" data-placement="left" title="<?php echo str_replace("'", "\\'", __("Copy embed code")); ?>"><span class="fa fa-copy" aria-hidden="true"></span> <span id="copied' + row.id + '" style="display:none;"><?php echo str_replace("'", "\\'", __("Copied")); ?></span></button>' embedBtn += '<button type="button" class="btn btn-xs btn-default command-embed" id="embedBtn' + row.id + '" onclick="getEmbedCode(' + row.id + ')" data-toggle="tooltip" title="<?php echo str_replace("'", "\\'", __("Copy embed code")); ?>"><span class="fa fa-copy" aria-hidden="true"></span> <span id="copied' + row.id + '" style="display:none;"><?php echo str_replace("'", "\\'", __("Copied")); ?></span></button>'
embedBtn += '<input type="hidden" id="embedInput' + row.id + '" value=\'<?php echo str_replace("{embedURL}", "{$global['webSiteRootURL']}vEmbed/' + row.id + '", str_replace("'", "\"", $advancedCustom->embedCodeTemplate)); ?>\'/>'; embedBtn += '<input type="hidden" id="embedInput' + row.id + '" value=\'<?php echo str_replace("{embedURL}", "{$global['webSiteRootURL']}vEmbed/' + row.id + '", str_replace("'", "\"", $advancedCustom->embedCodeTemplate)); ?>\'/>';
<?php <?php
} }
?> ?>
var editBtn = '<button type="button" class="btn btn-xs btn-default command-edit" data-row-id="' + row.id + '" data-toggle="tooltip" data-placement="left" title="<?php echo str_replace("'", "\\'", __("Edit")); ?>"><span class="glyphicon glyphicon-edit" aria-hidden="true"></span></button>' var editBtn = '<button type="button" class="btn btn-xs btn-default command-edit" data-row-id="' + row.id + '" data-toggle="tooltip" title="<?php echo str_replace("'", "\\'", __("Edit")); ?>"><span class="glyphicon glyphicon-edit" aria-hidden="true"></span></button>'
var deleteBtn = '<button type="button" class="btn btn-default btn-xs command-delete" data-row-id="' + row.id + '" data-toggle="tooltip" data-placement="left" title="<?php echo str_replace("'", "\\'", __("Delete")); ?>"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></button>'; var deleteBtn = '<button type="button" class="btn btn-default btn-xs command-delete" data-row-id="' + row.id + '" data-toggle="tooltip" title="<?php echo str_replace("'", "\\'", __("Delete")); ?>"><i class="fa fa-trash"></i></button>';
var activeBtn = '<button style="color: #090" type="button" class="btn btn-default btn-xs command-active" data-row-id="' + row.id + '" data-toggle="tooltip" data-placement="left" title="<?php echo str_replace("'", "\\'", __("Inactivate")); ?>"><span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span></button>'; var activeBtn = '<button style="color: #090" type="button" class="btn btn-default btn-xs command-active" data-row-id="' + row.id + '" data-toggle="tooltip" title="<?php echo str_replace("'", "\\'", __("Unlist this video")); ?>"><span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span></button>';
var inactiveBtn = '<button style="color: #A00" type="button" class="btn btn-default btn-xs command-inactive" data-row-id="' + row.id + '" data-toggle="tooltip" data-placement="left" title="<?php echo str_replace("'", "\\'", __("Activate")); ?>"><span class="glyphicon glyphicon-eye-close" aria-hidden="true"></span></button>'; var inactiveBtn = '<button style="color: #A00" type="button" class="btn btn-default btn-xs command-inactive" data-row-id="' + row.id + '" data-toggle="tooltip" title="<?php echo str_replace("'", "\\'", __("Activate this video")); ?>"><span class="glyphicon glyphicon-eye-close" aria-hidden="true"></span></button>';
var unlistedBtn = '<button style="color: #BBB" type="button" class="btn btn-default btn-xs command-unlisted" data-row-id="' + row.id + '" data-toggle="tooltip" data-placement="left" title="<?php echo str_replace("'", "\\'", __("Unlisted")); ?>"><span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span></button>'; var unlistedBtn = '<button style="color: #BBB" type="button" class="btn btn-default btn-xs command-unlisted" data-row-id="' + row.id + '" data-toggle="tooltip" title="<?php echo str_replace("'", "\\'", __("Inactivate this video")); ?>"><span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span></button>';
var rotateLeft = '<button type="button" class="btn btn-default btn-xs command-rotate" data-row-id="left" data-toggle="tooltip" data-placement="left" title="<?php echo str_replace("'", "\\'", __("Rotate LEFT")); ?>"><span class="fa fa-undo" aria-hidden="true"></span></button>'; var rotateLeft = '<button type="button" class="btn btn-default btn-xs command-rotate" data-row-id="left" data-toggle="tooltip" title="<?php echo str_replace("'", "\\'", __("Rotate LEFT")); ?>"><span class="fa fa-undo" aria-hidden="true"></span></button>';
var rotateRight = '<button type="button" class="btn btn-default btn-xs command-rotate" data-row-id="right" data-toggle="tooltip" data-placement="left" title="<?php echo str_replace("'", "\\'", __("Rotate RIGHT")); ?>"><span class="fas fa-redo " aria-hidden="true"></span></button>'; var rotateRight = '<button type="button" class="btn btn-default btn-xs command-rotate" data-row-id="right" data-toggle="tooltip" title="<?php echo str_replace("'", "\\'", __("Rotate RIGHT")); ?>"><span class="fas fa-redo " aria-hidden="true"></span></button>';
//var rotateBtn = "<br>" + rotateLeft + rotateRight; //var rotateBtn = "<br>" + rotateLeft + rotateRight;
var rotateBtn = "<br>"; var rotateBtn = "<br>";
var suggestBtn = ""; var suggestBtn = "";
<?php <?php
if (User::isAdmin()) { if (User::isAdmin()) {
?> ?>
var suggest = '<button style="color: #C60" type="button" class="btn btn-default btn-xs command-suggest" data-toggle="tooltip" data-placement="left" title="<?php echo str_replace("'", "\\'", __("Unsuggest")); ?>"><i class="fas fa-star" aria-hidden="true"></i></button>'; var suggest = '<button style="color: #C60" type="button" class="btn btn-default btn-xs command-suggest" data-toggle="tooltip" title="<?php echo str_replace("'", "\\'", __("Unsuggest")); ?>"><i class="fas fa-star" aria-hidden="true"></i></button>';
var unsuggest = '<button style="" type="button" class="btn btn-default btn-xs command-suggest unsuggest" data-toggle="tooltip" data-placement="left" title="<?php echo str_replace("'", "\\'", __("Suggest")); ?>"><i class="far fa-star" aria-hidden="true"></i></button>'; var unsuggest = '<button style="" type="button" class="btn btn-default btn-xs command-suggest unsuggest" data-toggle="tooltip" title="<?php echo str_replace("'", "\\'", __("Suggest")); ?>"><i class="far fa-star" aria-hidden="true"></i></button>';
suggestBtn = unsuggest; suggestBtn = unsuggest;
if (row.isSuggested == "1") { if (row.isSuggested == "1") {
suggestBtn = suggest; suggestBtn = suggest;
@ -1778,24 +1800,26 @@ if (User::isAdmin()) {
}, },
"tags": function (column, row) { "tags": function (column, row) {
var tags = ""; var tags = "";
if (row.maxResolution && row.maxResolution.resolution_string) {
tags += "<span class='label label-primary tagTitle'><?php echo __("Resolution") . ":"; ?> </span><span class=\"label label-default \">" + row.maxResolution.resolution_string + "</span><br>";
}
for (var i in row.tags) { for (var i in row.tags) {
if (typeof row.tags[i].type == "undefined") { if (typeof row.tags[i].type == "undefined") {
continue; continue;
} }
tags += "<span class='label label-primary fix-width'>" + row.tags[i].label + ": </span><span class=\"label label-" + row.tags[i].type + " fix-width\">" + row.tags[i].text + "</span><br>"; tags += "<span class='label label-primary tagTitle'>" + row.tags[i].label + ": </span><span class=\"label label-" + row.tags[i].type + " \">" + row.tags[i].text + "</span><br>";
} }
tags += "<span class='label label-primary fix-width'><?php echo __("Type") . ":"; ?> </span><span class=\"label label-default fix-width\">" + row.type + "</span><br>"; tags += "<span class='label label-primary tagTitle'><?php echo __("Type") . ":"; ?> </span><span class=\"label label-default \">" + row.type + "</span><br>";
tags += "<span class='label label-primary fix-width'><?php echo __("Views") . ":"; ?> </span><span class=\"label label-default fix-width\">" + row.views_count + " <a href='#' class='viewsDetails' onclick='viewsDetails(" + row.views_count + ", " + row.views_count_25 + "," + row.views_count_50 + "," + row.views_count_75 + "," + row.views_count_100 + ");'>[<i class='fas fa-info-circle'></i> Details]</a></span><br>"; tags += "<span class='label label-primary tagTitle'><?php echo __("Views") . ":"; ?> </span><span class=\"label label-default \">" + row.views_count + " <a href='#' class='viewsDetails' onclick='viewsDetails(" + row.views_count + ", " + row.views_count_25 + "," + row.views_count_50 + "," + row.views_count_75 + "," + row.views_count_100 + ");'>[<i class='fas fa-info-circle'></i> Details]</a></span><br>";
tags += "<span class='label label-primary fix-width'><?php echo __("Format") . ":"; ?> </span>" + row.typeLabels; tags += "<span class='label label-primary tagTitle'><?php echo __("Format") . ":"; ?> </span>" + row.typeLabels + "<br>";
if (row.encoderURL) { if (row.encoderURL) {
tags += "<br><span class='label label-primary fix-width'><?php echo __("Encoder") . ":"; ?> </span><span class=\"label label-default fix-width\">" + row.encoderURL + "</span><br>"; tags += "<span class='label label-primary tagTitle'><?php echo __("Encoder") . ":"; ?> </span><span class=\"label label-default \">" + row.encoderURL + "</span><br>";
clearTimeout(checkProgressTimeout[row.encoderURL]); clearTimeout(checkProgressTimeout[row.encoderURL]);
checkProgressTimeout[row.encoderURL] = setTimeout(function(){ checkProgressTimeout[row.encoderURL] = setTimeout(function () {
checkProgress(row.encoderURL); checkProgress(row.encoderURL);
},1000); }, 1000);
} }
return tags; return tags;
}, },
"filesize": function (column, row) { "filesize": function (column, row) {
@ -1809,9 +1833,9 @@ if (User::isAdmin()) {
var tags = ""; var tags = "";
var youTubeLink = "", youTubeUpload = ""; var youTubeLink = "", youTubeUpload = "";
<?php if (!$config->getDisable_youtubeupload()) { ?> <?php if (!$config->getDisable_youtubeupload()) { ?>
youTubeUpload = '<button type="button" class="btn btn-danger btn-xs command-uploadYoutube" data-toggle="tooltip" data-placement="left" title="<?php echo str_replace("'", "\\'", __("Upload to YouTube")); ?>"><span class="fa fa-upload " aria-hidden="true"></span></button>'; youTubeUpload = '<button type="button" class="btn btn-danger btn-xs command-uploadYoutube" data-toggle="tooltip" title="<?php echo str_replace("'", "\\'", __("Upload to YouTube")); ?>"><span class="fa fa-upload " aria-hidden="true"></span></button>';
if (row.youtubeId) { if (row.youtubeId) {
//youTubeLink += '<a href=\'https://youtu.be/' + row.youtubeId + '\' target=\'_blank\' class="btn btn-primary" data-toggle="tooltip" data-placement="left" title="<?php echo str_replace("'", "\\'", __("Watch on YouTube")); ?>"><span class="fas fa-external-link-alt " aria-hidden="true"></span></a>'; //youTubeLink += '<a href=\'https://youtu.be/' + row.youtubeId + '\' target=\'_blank\' class="btn btn-primary" data-toggle="tooltip" title="<?php echo str_replace("'", "\\'", __("Watch on YouTube")); ?>"><span class="fas fa-external-link-alt " aria-hidden="true"></span></a>';
} }
var yt = '<br><div class="btn-group" role="group" ><a class="btn btn-default btn-xs" disabled><span class="fas fa-play-circle" aria-hidden="true"></span> YouTube</a> ' + youTubeUpload + youTubeLink + ' </div>'; var yt = '<br><div class="btn-group" role="group" ><a class="btn btn-default btn-xs" disabled><span class="fas fa-play-circle" aria-hidden="true"></span> YouTube</a> ' + youTubeUpload + youTubeLink + ' </div>';
if (row.status == "d" || row.status == "e") { if (row.status == "d" || row.status == "e") {
@ -1881,6 +1905,9 @@ if (AVideoPlugin::isEnabledByName('PlayLists')) {
page = 1; page = 1;
} }
var ret = {current: page}; var ret = {current: page};
setTimeout(function () {
$('[data-toggle="tooltip"]').tooltip();
}, 1000);
return ret; return ret;
}, },
}).on("loaded.rs.jquery.bootgrid", function () { }).on("loaded.rs.jquery.bootgrid", function () {
@ -1923,7 +1950,7 @@ if (AVideoPlugin::isEnabledByName('PlayLists')) {
buttons: true, buttons: true,
dangerMode: true, dangerMode: true,
}) })
.then(function(willDelete) { .then(function (willDelete) {
if (willDelete) { if (willDelete) {
deleteVideo(row.id); deleteVideo(row.id);
} }

View file

@ -17,36 +17,36 @@ if (!empty($playlist_id)) {
</script> </script>
<?php } else if (empty($autoPlayVideo)) { <?php } else if (empty($autoPlayVideo)) {
?> ?>
<div class="col-lg-12 col-sm-12 col-xs-12 autoplay text-muted" > <div class="col-lg-12 col-sm-12 col-xs-12 autoplay text-muted" style="margin: 10px 0;" >
<strong><?php echo __("Autoplay ended"); ?></strong> <strong><?php echo __("Autoplay ended"); ?></strong>
<span class="pull-right"> <span class="pull-right">
<span><?php echo __("Autoplay"); ?></span> <span><?php echo __("Autoplay"); ?></span>
<span> <span>
<i class="fa fa-info-circle" data-toggle="tooltip" data-placement="bottom" title="<?php echo __("When autoplay is enabled, a suggested video will automatically play next."); ?>"></i> <i class="fa fa-info-circle" data-toggle="tooltip" data-placement="bottom" title="<?php echo __("When autoplay is enabled, a suggested video will automatically play next."); ?>"></i>
</span> </span>
<div class="material-switch pull-right"> <div class="material-switch pull-right" style="margin-left: 10px;">
<input type="checkbox" class="saveCookie" name="autoplay" id="autoplay"> <input type="checkbox" class="saveCookie" name="autoplay" id="autoplay" <?php echo PlayerSkins::isAutoplayEnabled() ? "checked" : ""; ?>>
<label for="autoplay" class="label-primary"></label> <label for="autoplay" class="label-primary"></label>
</div> </div>
</span> </span>
</div> </div>
<?php } else if (!empty($autoPlayVideo)) { ?> <?php } else if (!empty($autoPlayVideo)) { ?>
<div class="row"> <div class="row">
<div class="col-lg-12 col-sm-12 col-xs-12 autoplay text-muted"> <div class="col-lg-12 col-sm-12 col-xs-12 autoplay text-muted" style="margin: 10px 0;" >
<strong><?php echo __("Up Next"); ?></strong> <strong><?php echo __("Up Next"); ?></strong>
<span class="pull-right"> <span class="pull-right">
<span><?php echo __("Autoplay"); ?></span> <span><?php echo __("Autoplay"); ?></span>
<span> <span>
<i class="fa fa-info-circle" data-toggle="tooltip" data-placement="bottom" title="<?php echo __("When autoplay is enabled, a suggested video will automatically play next."); ?>"></i> <i class="fa fa-info-circle" data-toggle="tooltip" data-placement="top" title="<?php echo __("When autoplay is enabled, a suggested video will automatically play next."); ?>"></i>
</span> </span>
<div class="material-switch pull-right"> <div class="material-switch pull-right" style="margin-left: 10px;">
<input type="checkbox" class="saveCookie" name="autoplay" id="autoplay"> <input type="checkbox" class="saveCookie" name="autoplay" id="autoplay" <?php echo PlayerSkins::isAutoplayEnabled() ? "checked" : ""; ?>>
<label for="autoplay" class="label-primary"></label> <label for="autoplay" class="label-primary"></label>
</div> </div>
</span> </span>
</div> </div>
</div> </div>
<div class="col-lg-12 col-sm-12 col-xs-12 bottom-border autoPlayVideo" id="autoPlayVideoDiv" > <div class="col-lg-12 col-sm-12 col-xs-12 bottom-border autoPlayVideo" id="autoPlayVideoDiv" style="margin: 10px 0; padding: 15px 5px; <?php echo PlayerSkins::isAutoplayEnabled() ? "" : "display: none;"; ?>" >
<a href="<?php echo Video::getLink($autoPlayVideo['id'], $autoPlayVideo['clean_title'], "", $get); ?>" title="<?php echo str_replace('"', '', $autoPlayVideo['title']); ?>" class="videoLink h6"> <a href="<?php echo Video::getLink($autoPlayVideo['id'], $autoPlayVideo['clean_title'], "", $get); ?>" title="<?php echo str_replace('"', '', $autoPlayVideo['title']); ?>" class="videoLink h6">
<div class="col-lg-5 col-sm-5 col-xs-5 nopadding thumbsImage"> <div class="col-lg-5 col-sm-5 col-xs-5 nopadding thumbsImage">
<?php <?php
@ -119,9 +119,7 @@ $modeYouTubeTimeLog['After autoplay and playlist '] = microtime(true) - $modeYou
$modeYouTubeTime = microtime(true); $modeYouTubeTime = microtime(true);
?> ?>
<div class="clearfix"></div> <div class="clearfix"></div>
<div class="row" style="margin: 15px 0;"> <div class="extraVideos nopadding" style="margin: 15px 0;"></div>
<div class="col-lg-12 col-sm-12 col-xs-12 extraVideos nopadding"></div>
</div>
<div class="clearfix"></div> <div class="clearfix"></div>
<!-- videos List --> <!-- videos List -->
<!--googleoff: all--> <!--googleoff: all-->

View file

@ -35,7 +35,7 @@ if (!$isCompressed) {
$modeYouTubeTime = microtime(true); $modeYouTubeTime = microtime(true);
?> ?>
</div> </div>
<div class="col-sm-5 col-md-5 col-lg-4 rightBar" id="yptRightBar"> <div class="col-sm-5 col-md-5 col-lg-4 rightBar" id="yptRightBar" >
<div class="list-group-item "> <div class="list-group-item ">
<?php <?php
require "{$global['systemRootPath']}view/modeYoutubeBottomRight.php"; require "{$global['systemRootPath']}view/modeYoutubeBottomRight.php";

View file

@ -10,7 +10,7 @@ session_write_close();
require_once $global['systemRootPath'] . 'objects/user.php'; require_once $global['systemRootPath'] . 'objects/user.php';
//check if there is a update //check if there is a update
if (!User::isAdmin()) { if (!User::isAdmin()) {
header("location: {$global['webSiteRootURL']}user"); forbiddenPage("");
exit; exit;
} }
// remove cache dir before the script starts to let the script recreate the javascript and css files // remove cache dir before the script starts to let the script recreate the javascript and css files
@ -26,15 +26,31 @@ if (!empty($_POST['updateFile'])) {
<?php <?php
include $global['systemRootPath'] . 'view/include/head.php'; include $global['systemRootPath'] . 'view/include/head.php';
?> ?>
<style>
body {
background-color: #193c6d;
filter: progid: DXImageTransform.Microsoft.gradient(gradientType=1, startColorstr='#003073', endColorstr='#029797');
background-image: url(//img.alicdn.com/tps/TB1d.u8MXXXXXXuXFXXXXXXXXXX-1900-790.jpg);
background-size: 100%;
background-image: -webkit-gradient(linear, 0 0, 100% 100%, color-stop(0, #003073), color-stop(100%, #029797));
background-image: -webkit-linear-gradient(135deg, #003073, #029797);
background-image: -moz-linear-gradient(45deg, #003073, #029797);
background-image: -ms-linear-gradient(45deg, #003073 0, #029797 100%);
background-image: -o-linear-gradient(45deg, #003073, #029797);
background-image: linear-gradient(135deg, #003073, #029797);
text-align: center;
margin: 0px;
overflow: hidden;
}
</style>
</head> </head>
<body class="<?php echo $global['bodyClass']; ?>"> <body class="<?php echo $global['bodyClass']; ?>">
<?php <?php
include $global['systemRootPath'] . 'view/include/navbar.php'; include $global['systemRootPath'] . 'view/include/navbar.php';
?> ?>
<div class="container"> <div class="container">
<div class="panel panel-default"> <br>
<div class="panel-body"> <br>
<div class="alert alert-success"><?php printf(__("You are running AVideo version %s!"), $config->getVersion()); ?></div> <div class="alert alert-success"><?php printf(__("You are running AVideo version %s!"), $config->getVersion()); ?></div>
<?php <?php
if (empty($_POST['updateFile'])) { if (empty($_POST['updateFile'])) {
@ -150,11 +166,10 @@ if (!empty($_POST['updateFile'])) {
} }
?> ?>
</div> </div>
</div>
</div>
<?php <?php
include $global['systemRootPath'] . 'view/include/footer.php'; include $global['systemRootPath'] . 'view/include/footer.php';
?> ?>
<script src="<?php echo $global['webSiteRootURL']; ?>js/three.js" type="text/javascript"></script>
</body> </body>
</html> </html>
<?php <?php

View file

@ -41,12 +41,11 @@ foreach ($tags as $value) {
<div class="row"> <div class="row">
<div> <div>
<form class="form-compact well form-horizontal" id="updateUserForm" onsubmit=""> <form class="form-compact well form-horizontal" id="updateUserForm" onsubmit="">
<div class="panel panel-default">
<div class="panel-heading tabbable-line">
<div class="pull-right">
<?php echo $tagsStr; ?> <?php echo $tagsStr; ?>
<fieldset> </div>
<legend>
<?php echo __("Update your user") ?>
</legend>
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li class="active"><a data-toggle="tab" href="#basicInfo" id="aBasicInfo"><?php echo __("Basic Info") ?></a></li> <li class="active"><a data-toggle="tab" href="#basicInfo" id="aBasicInfo"><?php echo __("Basic Info") ?></a></li>
@ -55,7 +54,8 @@ foreach ($tags as $value) {
<?php } ?> <?php } ?>
<?php echo AVideoPlugin::profileTabName($user->getId()); ?> <?php echo AVideoPlugin::profileTabName($user->getId()); ?>
</ul> </ul>
</div>
<div class="panel-body">
<div class="tab-content"> <div class="tab-content">
<div id="basicInfo" class="tab-pane fade in active" style="padding: 10px 0;"> <div id="basicInfo" class="tab-pane fade in active" style="padding: 10px 0;">
<?php <?php
@ -82,7 +82,8 @@ foreach ($tags as $value) {
</center> </center>
</div> </div>
</div> </div>
</fieldset> </div>
</div>
</form> </form>
</div> </div>
@ -90,7 +91,7 @@ foreach ($tags as $value) {
<?php <?php
} else { } else {
include $global['systemRootPath'] .'./view/userLogin.php'; include $global['systemRootPath'] . './view/userLogin.php';
} }
?> ?>

View file

@ -71,7 +71,7 @@ if (!empty($_GET['channelName']) && empty($advancedCustomUser->hideRemoveChannel
$user = User::getChannelOwner($_GET['channelName']); $user = User::getChannelOwner($_GET['channelName']);
//var_dump($user);exit; //var_dump($user);exit;
?> ?>
<div class="col-md-12" > <div class="col-md-12" style="padding: 15px; margin: 5px 0; background-image: url(<?php echo $global['webSiteRootURL'], User::getBackgroundURLFromUserID($user['id']); ?>); background-size: cover;" >
<img src="<?php echo User::getPhoto($user['id']); ?>" class="img img-responsive img-circle" style="max-width: 60px;" alt="User Photo"/> <img src="<?php echo User::getPhoto($user['id']); ?>" class="img img-responsive img-circle" style="max-width: 60px;" alt="User Photo"/>
<div style="position: absolute; right: 5px; top: 5px;"> <div style="position: absolute; right: 5px; top: 5px;">
<button class="btn btn-default btn-xs btn-sm" onclick="loadPage(<?php echo $_GET['page']; ?>, true);"><?php echo User::getNameIdentificationById($user['id']); ?> <i class="fa fa-times"></i></button> <button class="btn btn-default btn-xs btn-sm" onclick="loadPage(<?php echo $_GET['page']; ?>, true);"><?php echo User::getNameIdentificationById($user['id']); ?> <i class="fa fa-times"></i></button>
@ -127,9 +127,9 @@ foreach ($videos as $key => $value) {
$name = User::getNameIdentificationById($value['users_id']) . ' ' . User::getEmailVerifiedIcon($value['users_id']); $name = User::getNameIdentificationById($value['users_id']) . ' ' . User::getEmailVerifiedIcon($value['users_id']);
$value['creator'] = '<div class="pull-left">' $value['creator'] = '<div class="pull-left">'
. '<a href="' . User::getChannelLink($value['users_id']) . '"><img src="' . User::getPhoto($value['users_id']) . '" alt="User Photo" class="img img-responsive img-circle zoom" style="max-width: 20px;"/></div><div class="commentDetails" style="margin-left:25px;"><div class="commenterName text-muted"><strong>' . $name . '</strong> <small>' . '<a href="' . User::getChannelLink($value['users_id']) . '"><img src="' . User::getPhoto($value['users_id']) . '" alt="User Photo" class="img img-responsive img-circle zoom" style="max-width: 20px;"/></div><div class="commentDetails" style="margin-left:25px;"><div class="commenterName text-muted"><strong>' . $name . '</strong> <small>'
. '</a>' . humanTiming(strtotime($value['videoCreation'])) . '</small></div></div>'; . '</a>' . humanTimingAgo(strtotime($value['videoCreation'])) . '</small></div></div>';
?> ?>
<div class="col-lg-12 col-sm-12 col-xs-12 bottom-border" id="divVideo-<?php echo $value['id']; ?>" > <div class="col-lg-12 col-sm-12 col-xs-12 bottom-border videoListItem" id="divVideo-<?php echo $value['id']; ?>" >
<?php <?php
$link = Video::getLink($value['id'], $value['clean_title'], "", $get); $link = Video::getLink($value['id'], $value['clean_title'], "", $get);
$connection = "?"; $connection = "?";
@ -225,7 +225,7 @@ foreach ($videos as $key => $value) {
<div class="text-uppercase row"><strong class="title"><?php echo $value['title']; ?></strong></div> <div class="text-uppercase row"><strong class="title"><?php echo $value['title']; ?></strong></div>
</a> </a>
<div class="details row"> <div class="details row">
<div class="col-sm-6 nopadding"> <div class="pull-left" style="display: inline-table;">
<a class="label label-default" href="<?php echo $global['webSiteRootURL']; ?>cat/<?php echo $value['clean_category']; ?>"> <a class="label label-default" href="<?php echo $global['webSiteRootURL']; ?>cat/<?php echo $value['clean_category']; ?>">
<span class="<?php echo $value['iconClass']; ?>"></span> <span class="<?php echo $value['iconClass']; ?>"></span>
<span class="hidden-sm"><?php echo $value['category']; ?></span> <span class="hidden-sm"><?php echo $value['category']; ?></span>
@ -251,11 +251,12 @@ foreach ($videos as $key => $value) {
<?php <?php
if (empty($advancedCustom->doNotDisplayViews)) { if (empty($advancedCustom->doNotDisplayViews)) {
?> ?>
<div class="col-sm-6 nopadding text-muted"> <div class="text-muted pull-right">
<strong class="view-count<?php echo $value['id']; ?>"> <i class="fas fa-eye"></i> <?php echo number_format($value['views_count'], 0); ?></strong> <strong class="view-count<?php echo $value['id']; ?>"> <i class="fas fa-eye"></i> <?php echo number_format($value['views_count'], 0); ?></strong>
</div> </div>
<?php } ?> <?php } ?>
<div class="col-sm-12 nopadding" style="margin-top: 5px !important;"><?php echo $value['creator']; ?></div> <div class="clearfix"></div>
<div class="nopadding" style="margin-top: 5px !important;"><?php echo $value['creator']; ?></div>
</div> </div>