1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 01:39:24 +02:00

Offline player test

This commit is contained in:
DanieL 2022-07-11 15:14:02 -03:00
parent 53dfc89fd2
commit 7d7f568a6f
2 changed files with 583 additions and 582 deletions

View file

@ -1,385 +1,385 @@
<?php
$vars = [];
require_once '../videos/configuration.php';
require_once './functions.php';
if (!User::isAdmin()) {
header("Location: {$global['webSiteRootURL']}");
exit;
}
$isAdminPanel = 1;
class MenuAdmin
{
public $title;
public $icon;
public $href;
public $active = false;
public $show = false;
public $itens = [];
public $data_toggle;
public $data_target;
public function __construct($title, $icon, $href = "", $data_toggle = "", $data_target = "")
{
$this->title = $title;
$this->icon = $icon;
$this->href = $href;
$this->data_toggle = $data_toggle;
$this->data_target = $data_target;
if (!empty($href)) {
$fileName = basename($_SERVER["SCRIPT_NAME"]);
if ($href === $fileName) {
$this->active = true;
}
}
}
public function addItem(MenuAdmin $menu)
{
$this->itens[] = $menu;
if ($menu->active) {
$this->show = true;
}
}
}
$itens = [];
$menu = new MenuAdmin(__("Dashboard"), "fa fa-tachometer-alt", "dashboard");
$itens[] = $menu;
/*
$menu = new MenuAdmin(__("Premium Featrures"), "fas fa-star", "premium");
$itens[] = $menu;
*/
$menu = new MenuAdmin(__("Settings"), "fa fa-wrench");
$menu->addItem(new MenuAdmin(__("Remove Branding"), "far fa-edit", "customize_settings"));
$menu->addItem(new MenuAdmin(__("General Settings"), "fas fa-cog", "general_settings"));
$menu->addItem(new MenuAdmin(__("Site Settings"), "fas fa-sitemap", "site_settings"));
$menu->addItem(new MenuAdmin(__("Social Login Settings"), "fas fa-sign-in-alt", "socialLogin_settings"));
$menu->addItem(new MenuAdmin(__("S3, B2, FTP settings"), "fas fa-hdd", "storage_settings"));
$menu->addItem(new MenuAdmin(__("Payments Settings"), "far fa-money-bill-alt", "payments_settings"));
$itens[] = $menu;
$menu = new MenuAdmin(__("Contents"), "fas fa-list-ul");
$menu->addItem(new MenuAdmin(__("Videos"), "fas fa-play-circle", "videos"));
$menu->addItem(new MenuAdmin(__("Live Stuff"), "fas fa-broadcast-tower", "live"));
$menu->addItem(new MenuAdmin(__("Users"), "glyphicon glyphicon-user", "users"));
$menu->addItem(new MenuAdmin(__("Users Groups"), "fa fa-users", "usersGroups"));
$menu->addItem(new MenuAdmin(__("Categories"), "glyphicon glyphicon-list", "categories"));
$menu->addItem(new MenuAdmin(__("Backup"), "fas fa-undo-alt", "backup"));
$itens[] = $menu;
$menu = new MenuAdmin(__("Design"), "fas fa-pen-fancy");
$menu->addItem(new MenuAdmin(__("First Page Style"), "fas fa-columns", "design_first_page"));
$menu->addItem(new MenuAdmin(__("Player Skin"), "fas fa-play-circle", "design_player"));
$menu->addItem(new MenuAdmin(__("Themes"), "fas fa-palette", "design_themes"));
$menu->addItem(new MenuAdmin(__("Colors"), "fas fa-palette", "design_colors"));
//$menu->addItem(new MenuAdmin(__("Custom CSS"), "fab fa-css3-alt", "design_css"));
$itens[] = $menu;
$menu = new MenuAdmin(__("Monetize"), "fas fa-dollar-sign");
$menu->addItem(new MenuAdmin(__("Site Advertisement with VAST Video ads"), "fas fa-money-check-alt", "monetize_vast"));
$menu->addItem(new MenuAdmin(__("Pay User per Video View"), "far fa-money-bill-alt", "monetize_user"));
$menu->addItem(new MenuAdmin(__("Create Subscription Plans"), "fas fa-money-bill-alt", "monetize_subscription"));
//$menu->addItem(new MenuAdmin(__("Banner Script code"), "fas fa-money-check-alt", "advertisement_script"));
$itens[] = $menu;
/*
$menu = new MenuAdmin(__("Update Version"), "glyphicon glyphicon-refresh", "{$global['webSiteRootURL']}update/");
$itens[] = $menu;
*/
$menu = new MenuAdmin(__("Miscellaneous"), "fas fa-th");
$menu->addItem(new MenuAdmin(__("Plugins"), "fas fa-puzzle-piece", "plugins"));
$menu->addItem(new MenuAdmin(__("Email All Users"), "fas fa-mail-bulk", "mail_all_users"));
$itens[] = $menu;
$menu = new MenuAdmin(__("Health Check"), "fas fa-notes-medical", "health_check");
$itens[] = $menu;
$_GET['page'] = xss_esc(@$_GET['page']);
$includeHead = '';
$includeBody = '';
switch ($_GET['page']) {
case "backup":
$includeBody = $global['systemRootPath'] . 'admin/backup.php';
break;
case "premium":
$includeBody = $global['systemRootPath'] . 'admin/premium.php';
break;
case "design_first_page":
$includeBody = $global['systemRootPath'] . 'admin/design_first_page.php';
break;
case "design_themes":
$includeBody = $global['systemRootPath'] . 'admin/design_themes.php';
break;
case "design_colors":
$includeBody = $global['systemRootPath'] . 'admin/design_colors.php';
break;
case "design_player":
$includeBody = $global['systemRootPath'] . 'admin/design_player.php';
break;
case "customize_settings":
$includeBody = $global['systemRootPath'] . 'admin/customize_settings.php';
break;
case "storage_settings":
$includeBody = $global['systemRootPath'] . 'admin/storage_settings.php';
break;
case "general_settings":
$includeBody = $global['systemRootPath'] . 'admin/general_settings.php';
break;
case "payments_settings":
$includeBody = $global['systemRootPath'] . 'admin/payments_settings.php';
break;
case "socialLogin_settings":
$includeBody = $global['systemRootPath'] . 'admin/socialLogin_settings.php';
break;
case "site_settings":
$includeHead = $global['systemRootPath'] . 'view/configurations_head.php';
$includeBody = $global['systemRootPath'] . 'view/configurations_body.php';
break;
case "monetize_subscription":
$includeHead = $global['systemRootPath'] . 'plugin/Subscription/page/editor_head.php';
$includeBody = [];
$includeBody[] = $global['systemRootPath'] . 'plugin/Subscription/page/editor_body.php';
$includeBody[] = $global['systemRootPath'] . 'admin/monetize_subscription.php';
break;
case "monetize_vast":
$includeHead = $global['systemRootPath'] . 'plugin/AD_Server/index_head.php';
$includeBody = $global['systemRootPath'] . 'plugin/AD_Server/index_body.php';
break;
case "monetize_user":
$includeBody = $global['systemRootPath'] . 'admin/monetize_user.php';
break;
case "plugins":
$includeHead = $global['systemRootPath'] . 'view/managerPlugins_head.php';
$includeBody = $global['systemRootPath'] . 'view/managerPlugins_body.php';
break;
case "mail_all_users":
$includeBody = $global['systemRootPath'] . 'admin/mail_all_users.php';
break;
case "users":
$includeHead = $global['systemRootPath'] . 'view/managerUsers_head.php';
$includeBody = $global['systemRootPath'] . 'view/managerUsers_body.php';
break;
case "live":
$includeBody = $global['systemRootPath'] . 'admin/live.php';
break;
case "usersGroups":
$includeHead = $global['systemRootPath'] . 'view/managerUsersGroups_head.php';
$includeBody = $global['systemRootPath'] . 'view/managerUsersGroups_body.php';
break;
case "categories":
$includeHead = $global['systemRootPath'] . 'view/managerCategories_head.php';
$includeBody = $global['systemRootPath'] . 'view/managerCategories_body.php';
break;
case "videos":
$includeHead = $global['systemRootPath'] . 'view/managerVideos_head.php';
$includeBody = $global['systemRootPath'] . 'view/managerVideos_body.php';
break;
case "health_check":
$includeBody = $global['systemRootPath'] . 'admin/health_check.php';
break;
default:
$includeHead = $global['systemRootPath'] . 'view/charts_head.php';
$includeBody = $global['systemRootPath'] . 'view/charts_body.php';
break;
}
?>
<!DOCTYPE html>
<html lang="<?php echo $config->getLanguage(); ?>">
<head>
<?php
echo getHTMLTitle(__("Administration"));
?>
<?php
include $global['systemRootPath'] . 'view/include/head.php';
if (!empty($includeHead) && file_exists($includeHead)) {
echo "<!-- Include $includeHead -->";
include $includeHead;
echo "<!-- END Include $includeHead -->";
}
?>
<style>
@media (max-width: 767px) {
.affix {
position: static;
}
}
.leftMenu .panel-body {
padding: 0px;
}
.adminLeftMenu.panel-default i, .adminLeftMenu.panel-default{
-webkit-transition: opacity 0.5s ease-in-out;
-moz-transition: opacity 0.5s ease-in-out;
transition: opacity 0.5s ease-in-out;
}
.adminLeftMenu.panel-default i{
opacity: 0.2;
}
.adminLeftMenu:hover.panel-default i{
opacity: 1;
}
.adminLeftMenu.panel-default{
opacity: 0.6;
}
.adminLeftMenu:hover.panel-default{
opacity: 1;
}
</style>
</head>
<body class="<?php echo $global['bodyClass']; ?>">
<?php
include $global['systemRootPath'] . 'view/include/navbar.php';
?>
<div class="container-fluid">
<br>
<div class="row">
<div class=" col-lg-2 col-md-3 col-sm-3 fixed affix leftMenu">
<div class="panel-group" id="accordion">
<?php
$panel = 'panel-default';
if (empty($_REQUEST['page'])) {
$panel = 'panel-primary';
}
foreach ($itens as $key => $value) {
$uid = uniqid();
$href = 'data-toggle="collapse" data-parent="#accordion" href="#collapse' . $uid . '"';
if (!empty($value->href)) {
$href = 'href="' . $global['webSiteRootURL'] . 'admin/?page=' . $value->href . '"';
}
if (!empty($_REQUEST['page']) && $_REQUEST['page'] == $value->href) {
$panel = 'panel-primary';
} else {
foreach ($value->itens as $key2 => $value2) {
if (!empty($_REQUEST['page']) && $_REQUEST['page'] === $value2->href) {
$panel = 'panel-primary';
}
}
} ?>
<div class="panel <?php echo $panel; ?> adminLeftMenu <?php echo getCSSAnimationClassAndStyle('animate__bounceInLeft', 'menu'); ?>">
<div class="panel-heading">
<h4 class="panel-title">
<a <?php echo $href; ?> >
<i class="<?php echo $value->icon; ?> "></i> <?php echo $value->title; ?>
</a>
</h4>
</div>
<?php
if (!empty($value->itens)) {
$in = '';
if (!empty($_GET['page'])) {
foreach ($value->itens as $search) {
if ($_GET['page'] === $search->href) {
$in = "in";
break;
}
}
} ?>
<div id="collapse<?php echo $uid; ?>" class="panel-collapse collapse <?php echo $in; ?>">
<div class="panel-body">
<table class="table">
<?php
$active = '';
if (empty($_GET['page'])) {
$active = "active";
}
foreach ($value->itens as $key2 => $value2) {
if (!empty($_GET['page']) && $_GET['page'] === $value2->href) {
$active = "active";
} ?>
<tr>
<td class="<?php echo $active; ?>">
<a href="<?php echo "{$global['webSiteRootURL']}admin/?page=" . $value2->href; ?>"><i class="<?php echo $value2->icon; ?>"></i> <?php echo $value2->title; ?></a>
</td>
</tr>
<?php
$active = '';
} ?>
</table>
</div>
</div>
<?php
} ?>
</div>
<?php
$panel = 'panel-default';
}
?>
</div>
</div>
<div class=" col-lg-10 col-md-9 col-sm-9 col-sm-offset-3 col-md-offset-3 col-lg-offset-2 ">
<?php
if (!empty($includeBody)) {
if (is_array($includeBody)) {
foreach ($includeBody as $value) {
if (file_exists($value)) {
include $value;
} else {
?>
<div class="alert alert-danger">
<?php echo __('Please forgive us for bothering you, but unfortunately you do not have this plugin yet. But do not hesitate to purchase it in our online store'); ?>
<a class="btn btn-danger" href="https://youphp.tube/marketplace/"><?php echo __('Plugin Store'); ?></a>
</div>
<?php
}
}
} else {
if (file_exists($includeBody)) {
include $includeBody;
} else {
?>
<div class="alert alert-danger">
<?php echo __('Please forgive us for bothering you, but unfortunately you do not have this plugin yet. But do not hesitate to purchase it in our online store'); ?>
<a class="btn btn-danger" href="https://youphp.tube/marketplace/"><?php echo __('Plugin Store'); ?></a>
</div>
<?php
}
}
}
?>
</div>
</div>
</div>
<?php
include_once $global['systemRootPath'] . 'view/include/footer.php';
?>
<script>
$(document).ready(function () {
$('.adminOptionsForm').submit(function (e) {
e.preventDefault();
modal.showPleaseWait();
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>admin/save.json.php',
data: $(this).serialize(),
type: 'post',
success: function (response) {
modal.hidePleaseWait();
}
});
});
$('.pluginSwitch').change(function (e) {
modal.showPleaseWait();
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/pluginSwitch.json.php',
data: {"uuid": $(this).attr('uuid'), "name": $(this).attr('name'), "dir": $(this).attr('name'), "enable": $(this).is(":checked")},
type: 'post',
success: function (response) {
modal.hidePleaseWait();
}
});
});
});
</script>
</body>
</html>
<?php
$vars = [];
require_once '../videos/configuration.php';
require_once './functions.php';
if (!User::isAdmin()) {
header("Location: {$global['webSiteRootURL']}");
exit;
}
adminSecurityCheck(true);
$isAdminPanel = 1;
class MenuAdmin
{
public $title;
public $icon;
public $href;
public $active = false;
public $show = false;
public $itens = [];
public $data_toggle;
public $data_target;
public function __construct($title, $icon, $href = "", $data_toggle = "", $data_target = "")
{
$this->title = $title;
$this->icon = $icon;
$this->href = $href;
$this->data_toggle = $data_toggle;
$this->data_target = $data_target;
if (!empty($href)) {
$fileName = basename($_SERVER["SCRIPT_NAME"]);
if ($href === $fileName) {
$this->active = true;
}
}
}
public function addItem(MenuAdmin $menu)
{
$this->itens[] = $menu;
if ($menu->active) {
$this->show = true;
}
}
}
$itens = [];
$menu = new MenuAdmin(__("Dashboard"), "fa fa-tachometer-alt", "dashboard");
$itens[] = $menu;
/*
$menu = new MenuAdmin(__("Premium Featrures"), "fas fa-star", "premium");
$itens[] = $menu;
*/
$menu = new MenuAdmin(__("Settings"), "fa fa-wrench");
$menu->addItem(new MenuAdmin(__("Remove Branding"), "far fa-edit", "customize_settings"));
$menu->addItem(new MenuAdmin(__("General Settings"), "fas fa-cog", "general_settings"));
$menu->addItem(new MenuAdmin(__("Site Settings"), "fas fa-sitemap", "site_settings"));
$menu->addItem(new MenuAdmin(__("Social Login Settings"), "fas fa-sign-in-alt", "socialLogin_settings"));
$menu->addItem(new MenuAdmin(__("S3, B2, FTP settings"), "fas fa-hdd", "storage_settings"));
$menu->addItem(new MenuAdmin(__("Payments Settings"), "far fa-money-bill-alt", "payments_settings"));
$itens[] = $menu;
$menu = new MenuAdmin(__("Contents"), "fas fa-list-ul");
$menu->addItem(new MenuAdmin(__("Videos"), "fas fa-play-circle", "videos"));
$menu->addItem(new MenuAdmin(__("Live Stuff"), "fas fa-broadcast-tower", "live"));
$menu->addItem(new MenuAdmin(__("Users"), "glyphicon glyphicon-user", "users"));
$menu->addItem(new MenuAdmin(__("Users Groups"), "fa fa-users", "usersGroups"));
$menu->addItem(new MenuAdmin(__("Categories"), "glyphicon glyphicon-list", "categories"));
$menu->addItem(new MenuAdmin(__("Backup"), "fas fa-undo-alt", "backup"));
$itens[] = $menu;
$menu = new MenuAdmin(__("Design"), "fas fa-pen-fancy");
$menu->addItem(new MenuAdmin(__("First Page Style"), "fas fa-columns", "design_first_page"));
$menu->addItem(new MenuAdmin(__("Player Skin"), "fas fa-play-circle", "design_player"));
$menu->addItem(new MenuAdmin(__("Themes"), "fas fa-palette", "design_themes"));
$menu->addItem(new MenuAdmin(__("Colors"), "fas fa-palette", "design_colors"));
//$menu->addItem(new MenuAdmin(__("Custom CSS"), "fab fa-css3-alt", "design_css"));
$itens[] = $menu;
$menu = new MenuAdmin(__("Monetize"), "fas fa-dollar-sign");
$menu->addItem(new MenuAdmin(__("Site Advertisement with VAST Video ads"), "fas fa-money-check-alt", "monetize_vast"));
$menu->addItem(new MenuAdmin(__("Pay User per Video View"), "far fa-money-bill-alt", "monetize_user"));
$menu->addItem(new MenuAdmin(__("Create Subscription Plans"), "fas fa-money-bill-alt", "monetize_subscription"));
//$menu->addItem(new MenuAdmin(__("Banner Script code"), "fas fa-money-check-alt", "advertisement_script"));
$itens[] = $menu;
/*
$menu = new MenuAdmin(__("Update Version"), "glyphicon glyphicon-refresh", "{$global['webSiteRootURL']}update/");
$itens[] = $menu;
*/
$menu = new MenuAdmin(__("Miscellaneous"), "fas fa-th");
$menu->addItem(new MenuAdmin(__("Plugins"), "fas fa-puzzle-piece", "plugins"));
$menu->addItem(new MenuAdmin(__("Email All Users"), "fas fa-mail-bulk", "mail_all_users"));
$itens[] = $menu;
$menu = new MenuAdmin(__("Health Check"), "fas fa-notes-medical", "health_check");
$itens[] = $menu;
$_GET['page'] = xss_esc(@$_GET['page']);
$includeHead = '';
$includeBody = '';
switch ($_GET['page']) {
case "backup":
$includeBody = $global['systemRootPath'] . 'admin/backup.php';
break;
case "premium":
$includeBody = $global['systemRootPath'] . 'admin/premium.php';
break;
case "design_first_page":
$includeBody = $global['systemRootPath'] . 'admin/design_first_page.php';
break;
case "design_themes":
$includeBody = $global['systemRootPath'] . 'admin/design_themes.php';
break;
case "design_colors":
$includeBody = $global['systemRootPath'] . 'admin/design_colors.php';
break;
case "design_player":
$includeBody = $global['systemRootPath'] . 'admin/design_player.php';
break;
case "customize_settings":
$includeBody = $global['systemRootPath'] . 'admin/customize_settings.php';
break;
case "storage_settings":
$includeBody = $global['systemRootPath'] . 'admin/storage_settings.php';
break;
case "general_settings":
$includeBody = $global['systemRootPath'] . 'admin/general_settings.php';
break;
case "payments_settings":
$includeBody = $global['systemRootPath'] . 'admin/payments_settings.php';
break;
case "socialLogin_settings":
$includeBody = $global['systemRootPath'] . 'admin/socialLogin_settings.php';
break;
case "site_settings":
$includeHead = $global['systemRootPath'] . 'view/configurations_head.php';
$includeBody = $global['systemRootPath'] . 'view/configurations_body.php';
break;
case "monetize_subscription":
$includeHead = $global['systemRootPath'] . 'plugin/Subscription/page/editor_head.php';
$includeBody = [];
$includeBody[] = $global['systemRootPath'] . 'plugin/Subscription/page/editor_body.php';
$includeBody[] = $global['systemRootPath'] . 'admin/monetize_subscription.php';
break;
case "monetize_vast":
$includeHead = $global['systemRootPath'] . 'plugin/AD_Server/index_head.php';
$includeBody = $global['systemRootPath'] . 'plugin/AD_Server/index_body.php';
break;
case "monetize_user":
$includeBody = $global['systemRootPath'] . 'admin/monetize_user.php';
break;
case "plugins":
$includeHead = $global['systemRootPath'] . 'view/managerPlugins_head.php';
$includeBody = $global['systemRootPath'] . 'view/managerPlugins_body.php';
break;
case "mail_all_users":
$includeBody = $global['systemRootPath'] . 'admin/mail_all_users.php';
break;
case "users":
$includeHead = $global['systemRootPath'] . 'view/managerUsers_head.php';
$includeBody = $global['systemRootPath'] . 'view/managerUsers_body.php';
break;
case "live":
$includeBody = $global['systemRootPath'] . 'admin/live.php';
break;
case "usersGroups":
$includeHead = $global['systemRootPath'] . 'view/managerUsersGroups_head.php';
$includeBody = $global['systemRootPath'] . 'view/managerUsersGroups_body.php';
break;
case "categories":
$includeHead = $global['systemRootPath'] . 'view/managerCategories_head.php';
$includeBody = $global['systemRootPath'] . 'view/managerCategories_body.php';
break;
case "videos":
$includeHead = $global['systemRootPath'] . 'view/managerVideos_head.php';
$includeBody = $global['systemRootPath'] . 'view/managerVideos_body.php';
break;
case "health_check":
$includeBody = $global['systemRootPath'] . 'admin/health_check.php';
break;
default:
$includeHead = $global['systemRootPath'] . 'view/charts_head.php';
$includeBody = $global['systemRootPath'] . 'view/charts_body.php';
break;
}
?>
<!DOCTYPE html>
<html lang="<?php echo $config->getLanguage(); ?>">
<head>
<?php
echo getHTMLTitle(__("Administration"));
?>
<?php
include $global['systemRootPath'] . 'view/include/head.php';
if (!empty($includeHead) && file_exists($includeHead)) {
echo "<!-- Include $includeHead -->";
include $includeHead;
echo "<!-- END Include $includeHead -->";
}
?>
<style>
@media (max-width: 767px) {
.affix {
position: static;
}
}
.leftMenu .panel-body {
padding: 0px;
}
.adminLeftMenu.panel-default i, .adminLeftMenu.panel-default{
-webkit-transition: opacity 0.5s ease-in-out;
-moz-transition: opacity 0.5s ease-in-out;
transition: opacity 0.5s ease-in-out;
}
.adminLeftMenu.panel-default i{
opacity: 0.2;
}
.adminLeftMenu:hover.panel-default i{
opacity: 1;
}
.adminLeftMenu.panel-default{
opacity: 0.6;
}
.adminLeftMenu:hover.panel-default{
opacity: 1;
}
</style>
</head>
<body class="<?php echo $global['bodyClass']; ?>">
<?php
include $global['systemRootPath'] . 'view/include/navbar.php';
?>
<div class="container-fluid">
<br>
<div class="row">
<div class=" col-lg-2 col-md-3 col-sm-3 fixed affix leftMenu">
<div class="panel-group" id="accordion">
<?php
$panel = 'panel-default';
if (empty($_REQUEST['page'])) {
$panel = 'panel-primary';
}
foreach ($itens as $key => $value) {
$uid = uniqid();
$href = 'data-toggle="collapse" data-parent="#accordion" href="#collapse' . $uid . '"';
if (!empty($value->href)) {
$href = 'href="' . $global['webSiteRootURL'] . 'admin/?page=' . $value->href . '"';
}
if (!empty($_REQUEST['page']) && $_REQUEST['page'] == $value->href) {
$panel = 'panel-primary';
} else {
foreach ($value->itens as $key2 => $value2) {
if (!empty($_REQUEST['page']) && $_REQUEST['page'] === $value2->href) {
$panel = 'panel-primary';
}
}
} ?>
<div class="panel <?php echo $panel; ?> adminLeftMenu <?php echo getCSSAnimationClassAndStyle('animate__bounceInLeft', 'menu'); ?>">
<div class="panel-heading">
<h4 class="panel-title">
<a <?php echo $href; ?> >
<i class="<?php echo $value->icon; ?> "></i> <?php echo $value->title; ?>
</a>
</h4>
</div>
<?php
if (!empty($value->itens)) {
$in = '';
if (!empty($_GET['page'])) {
foreach ($value->itens as $search) {
if ($_GET['page'] === $search->href) {
$in = "in";
break;
}
}
} ?>
<div id="collapse<?php echo $uid; ?>" class="panel-collapse collapse <?php echo $in; ?>">
<div class="panel-body">
<table class="table">
<?php
$active = '';
if (empty($_GET['page'])) {
$active = "active";
}
foreach ($value->itens as $key2 => $value2) {
if (!empty($_GET['page']) && $_GET['page'] === $value2->href) {
$active = "active";
} ?>
<tr>
<td class="<?php echo $active; ?>">
<a href="<?php echo "{$global['webSiteRootURL']}admin/?page=" . $value2->href; ?>"><i class="<?php echo $value2->icon; ?>"></i> <?php echo $value2->title; ?></a>
</td>
</tr>
<?php
$active = '';
} ?>
</table>
</div>
</div>
<?php
} ?>
</div>
<?php
$panel = 'panel-default';
}
?>
</div>
</div>
<div class=" col-lg-10 col-md-9 col-sm-9 col-sm-offset-3 col-md-offset-3 col-lg-offset-2 ">
<?php
if (!empty($includeBody)) {
if (is_array($includeBody)) {
foreach ($includeBody as $value) {
if (file_exists($value)) {
include $value;
} else {
?>
<div class="alert alert-danger">
<?php echo __('Please forgive us for bothering you, but unfortunately you do not have this plugin yet. But do not hesitate to purchase it in our online store'); ?>
<a class="btn btn-danger" href="https://youphp.tube/marketplace/"><?php echo __('Plugin Store'); ?></a>
</div>
<?php
}
}
} else {
if (file_exists($includeBody)) {
include $includeBody;
} else {
?>
<div class="alert alert-danger">
<?php echo __('Please forgive us for bothering you, but unfortunately you do not have this plugin yet. But do not hesitate to purchase it in our online store'); ?>
<a class="btn btn-danger" href="https://youphp.tube/marketplace/"><?php echo __('Plugin Store'); ?></a>
</div>
<?php
}
}
}
?>
</div>
</div>
</div>
<?php
include_once $global['systemRootPath'] . 'view/include/footer.php';
?>
<script>
$(document).ready(function () {
$('.adminOptionsForm').submit(function (e) {
e.preventDefault();
modal.showPleaseWait();
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>admin/save.json.php',
data: $(this).serialize(),
type: 'post',
success: function (response) {
modal.hidePleaseWait();
}
});
});
$('.pluginSwitch').change(function (e) {
modal.showPleaseWait();
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/pluginSwitch.json.php',
data: {"uuid": $(this).attr('uuid'), "name": $(this).attr('name'), "dir": $(this).attr('name'), "enable": $(this).is(":checked")},
type: 'post',
success: function (response) {
modal.hidePleaseWait();
}
});
});
});
</script>
</body>
</html>

View file

@ -1,197 +1,198 @@
<?php
global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php';
}
_session_start();
unset($_SESSION['sessionCache']['thereIsAnyRemoteUpdate']);
unset($_SESSION['sessionCache']['thereIsAnyUpdate']);
session_write_close();
require_once $global['systemRootPath'] . 'objects/user.php';
//check if there is a update
if (!User::isAdmin()) {
forbiddenPage("");
exit;
}
// remove cache dir before the script starts to let the script recreate the javascript and css files
if (!empty($_POST['updateFile'])) {
$dir = Video::getStoragePath()."cache";
rrmdir($dir);
}
?>
<!DOCTYPE html>
<html lang="<?php echo $config->getLanguage(); ?>">
<head>
<title><?php echo __("Update AVideo System") . $config->getPageTitleSeparator() . $config->getWebSiteTitle(); ?></title>
<?php
include $global['systemRootPath'] . 'view/include/head.php';
?>
<style>
html{
height: unset;
}
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);
margin: 0px;
overflow: hidden;
height: 100%;
}
.alert{
text-align: center;
}
#updateInfo{
position: absolute;
top: 60px;
z-index: 1;
width: 500px;
left: 50%;
margin-left: -250px;
}
</style>
</head>
<body class="<?php echo $global['bodyClass']; ?>">
<?php
include $global['systemRootPath'] . 'view/include/navbar.php';
?>
<div class="container-fluid">
<div id="updateInfo">
<div style="">
<img style="max-height: 20vh;
display: block;
margin-left: auto;
margin-right: auto;" src="https://youphp.tube/marketplace/img/avideo_logo.png" class="img img-responsive"/>
</div>
<div class="alert alert-success">
<i class="fas fa-cog fa-spin"></i> <?php printf(__("You are running AVideo version %s!"), $config->getVersion()); ?>
</div>
<?php
if (empty($_POST['updateFile'])) {
$updateFiles = getUpdatesFilesArray();
if (!empty($updateFiles)) {
?>
<div class="alert alert-warning">
<form method="post" class="form-compact well form-horizontal" >
<fieldset>
<legend><?php echo __("Update AVideo System"); ?></legend>
<label for="updateFile" class="sr-only"><?php echo __("Select the update"); ?></label>
<select class="selectpicker" data-width="fit" name="updateFile" id="updateFile" required autofocus>
<?php
$disabled = '';
foreach ($updateFiles as $value) {
echo "<option value=\"{$value['filename']}\" {$disabled}>Version {$value['version']}</option>";
$disabled = "disabled";
} ?>
</select>
<?php printf(__("We detected a total of %s pending updates, if you want to do it now click (Update Now) button"), "<strong class='badge'>" . count($updateFiles) . "</strong>"); ?>
<hr>
<button type="submit" class="btn btn-warning btn-lg center-block " href="?update=1" > <span class="glyphicon glyphicon-refresh"></span> <?php echo __("Update Now"); ?> </button>
</fieldset>
</form>
</div>
<script>
$(document).ready(function () {
$('#updateFile').selectpicker();
});
</script>
<?php
} elseif ($version = thereIsAnyRemoteUpdate()) {
?>
<div class="alert alert-warning">
Our repository is now running at version <?php echo $version->version; ?>.
You can follow this <a target="_blank" href="https://github.com/WWBN/AVideo/wiki/How-to-Update-your-AVideo-Platform" class="btn btn-warning btn-xs" rel="noopener noreferrer">Update Tutorial</a>
to update your files and get the latest version.
</div>
<?php
} else {
?>
<div class="alert alert-success">
<h2><i class="fas fa-check"></i> <?php echo __("Your system is up to date"); ?></h2>
</div>
<?php
}
} else {
$obj = new stdClass();
$templine = '';
$logfile = Video::getStoragePath()."avideo.";
if (file_exists($logfile . "log")) {
unlink($logfile . "log");
_error_log("avideo.log deleted by update");
}
if (file_exists($logfile . "js.log")) {
unlink($logfile . "js.log");
_error_log("avideo.js.log deleted by update");
}
$lines = file("{$global['systemRootPath']}updatedb/{$_POST['updateFile']}");
$obj->error = '';
foreach ($lines as $line) {
if (substr($line, 0, 2) == '--' || $line == '') {
continue;
}
$templine .= $line;
if (substr(trim($line), -1, 1) == ';') {
if (!$global['mysqli']->query($templine)) {
$obj->error = ('Error performing query \'<strong>' . $templine . '\': ' . $global['mysqli']->error . '<br /><br />');
echo json_encode($obj);
//exit;
}
$templine = '';
}
}
// insert configuration if is version 1.0
if ($config->currentVersionLowerThen('1.0')) {
$sql = "DELETE FROM configurations WHERE id = 1 ";
if ($global['mysqli']->query($sql) !== true) {
$obj->error = "Error deleting configuration: " . $global['mysqli']->error;
echo json_encode($obj);
exit;
}
$sql = "INSERT INTO configurations (id, video_resolution, users_id, version, created, modified) VALUES (1, '426:240', " . User::getId() . ",'1.0', now(), now())";
if ($global['mysqli']->query($sql) !== true) {
$obj->error = "Error creating configuration: " . $global['mysqli']->error;
echo json_encode($obj);
exit;
}
}
if ($config->currentVersionEqual('1.0')) {
$sql = "UPDATE configurations SET users_id = " . User::getId() . ", version = '1.1', webSiteTitle = '{$global['webSiteTitle']}', language = '{$global['language']}', contactEmail = '{$global['contactEmail']}', modified = now() WHERE id = 1";
if ($global['mysqli']->query($sql) !== true) {
$obj->error = "Error creating configuration: " . $global['mysqli']->error;
echo json_encode($obj);
exit;
}
}
//$renamed = rename("{$global['systemRootPath']}updateDb.sql", "{$global['systemRootPath']}updateDb.sql.old");?>
<div class="alert alert-success">
<?php
printf(__("Your update from file %s is done, click continue"), $_POST['updateFile']); ?><hr>
<a class="btn btn-success" href="?done=1" > <span class="glyphicon glyphicon-ok"></span> <?php echo __("Continue"); ?> </a>
</div>
<?php
}
?>
</div>
</div>
<?php
include $global['systemRootPath'] . 'view/include/footer.php';
?>
<script src="<?php echo getCDN(); ?>js/three.js" type="text/javascript"></script>
</body>
</html>
<?php
exit;
?>
<?php
global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php';
}
_session_start();
unset($_SESSION['sessionCache']['thereIsAnyRemoteUpdate']);
unset($_SESSION['sessionCache']['thereIsAnyUpdate']);
session_write_close();
require_once $global['systemRootPath'] . 'objects/user.php';
//check if there is a update
if (!User::isAdmin()) {
forbiddenPage("");
exit;
}
adminSecurityCheck(true);
// remove cache dir before the script starts to let the script recreate the javascript and css files
if (!empty($_POST['updateFile'])) {
$dir = Video::getStoragePath()."cache";
rrmdir($dir);
}
?>
<!DOCTYPE html>
<html lang="<?php echo $config->getLanguage(); ?>">
<head>
<title><?php echo __("Update AVideo System") . $config->getPageTitleSeparator() . $config->getWebSiteTitle(); ?></title>
<?php
include $global['systemRootPath'] . 'view/include/head.php';
?>
<style>
html{
height: unset;
}
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);
margin: 0px;
overflow: hidden;
height: 100%;
}
.alert{
text-align: center;
}
#updateInfo{
position: absolute;
top: 60px;
z-index: 1;
width: 500px;
left: 50%;
margin-left: -250px;
}
</style>
</head>
<body class="<?php echo $global['bodyClass']; ?>">
<?php
include $global['systemRootPath'] . 'view/include/navbar.php';
?>
<div class="container-fluid">
<div id="updateInfo">
<div style="">
<img style="max-height: 20vh;
display: block;
margin-left: auto;
margin-right: auto;" src="https://youphp.tube/marketplace/img/avideo_logo.png" class="img img-responsive"/>
</div>
<div class="alert alert-success">
<i class="fas fa-cog fa-spin"></i> <?php printf(__("You are running AVideo version %s!"), $config->getVersion()); ?>
</div>
<?php
if (empty($_POST['updateFile'])) {
$updateFiles = getUpdatesFilesArray();
if (!empty($updateFiles)) {
?>
<div class="alert alert-warning">
<form method="post" class="form-compact well form-horizontal" >
<fieldset>
<legend><?php echo __("Update AVideo System"); ?></legend>
<label for="updateFile" class="sr-only"><?php echo __("Select the update"); ?></label>
<select class="selectpicker" data-width="fit" name="updateFile" id="updateFile" required autofocus>
<?php
$disabled = '';
foreach ($updateFiles as $value) {
echo "<option value=\"{$value['filename']}\" {$disabled}>Version {$value['version']}</option>";
$disabled = "disabled";
} ?>
</select>
<?php printf(__("We detected a total of %s pending updates, if you want to do it now click (Update Now) button"), "<strong class='badge'>" . count($updateFiles) . "</strong>"); ?>
<hr>
<button type="submit" class="btn btn-warning btn-lg center-block " href="?update=1" > <span class="glyphicon glyphicon-refresh"></span> <?php echo __("Update Now"); ?> </button>
</fieldset>
</form>
</div>
<script>
$(document).ready(function () {
$('#updateFile').selectpicker();
});
</script>
<?php
} elseif ($version = thereIsAnyRemoteUpdate()) {
?>
<div class="alert alert-warning">
Our repository is now running at version <?php echo $version->version; ?>.
You can follow this <a target="_blank" href="https://github.com/WWBN/AVideo/wiki/How-to-Update-your-AVideo-Platform" class="btn btn-warning btn-xs" rel="noopener noreferrer">Update Tutorial</a>
to update your files and get the latest version.
</div>
<?php
} else {
?>
<div class="alert alert-success">
<h2><i class="fas fa-check"></i> <?php echo __("Your system is up to date"); ?></h2>
</div>
<?php
}
} else {
$obj = new stdClass();
$templine = '';
$logfile = Video::getStoragePath()."avideo.";
if (file_exists($logfile . "log")) {
unlink($logfile . "log");
_error_log("avideo.log deleted by update");
}
if (file_exists($logfile . "js.log")) {
unlink($logfile . "js.log");
_error_log("avideo.js.log deleted by update");
}
$lines = file("{$global['systemRootPath']}updatedb/{$_POST['updateFile']}");
$obj->error = '';
foreach ($lines as $line) {
if (substr($line, 0, 2) == '--' || $line == '') {
continue;
}
$templine .= $line;
if (substr(trim($line), -1, 1) == ';') {
if (!$global['mysqli']->query($templine)) {
$obj->error = ('Error performing query \'<strong>' . $templine . '\': ' . $global['mysqli']->error . '<br /><br />');
echo json_encode($obj);
//exit;
}
$templine = '';
}
}
// insert configuration if is version 1.0
if ($config->currentVersionLowerThen('1.0')) {
$sql = "DELETE FROM configurations WHERE id = 1 ";
if ($global['mysqli']->query($sql) !== true) {
$obj->error = "Error deleting configuration: " . $global['mysqli']->error;
echo json_encode($obj);
exit;
}
$sql = "INSERT INTO configurations (id, video_resolution, users_id, version, created, modified) VALUES (1, '426:240', " . User::getId() . ",'1.0', now(), now())";
if ($global['mysqli']->query($sql) !== true) {
$obj->error = "Error creating configuration: " . $global['mysqli']->error;
echo json_encode($obj);
exit;
}
}
if ($config->currentVersionEqual('1.0')) {
$sql = "UPDATE configurations SET users_id = " . User::getId() . ", version = '1.1', webSiteTitle = '{$global['webSiteTitle']}', language = '{$global['language']}', contactEmail = '{$global['contactEmail']}', modified = now() WHERE id = 1";
if ($global['mysqli']->query($sql) !== true) {
$obj->error = "Error creating configuration: " . $global['mysqli']->error;
echo json_encode($obj);
exit;
}
}
//$renamed = rename("{$global['systemRootPath']}updateDb.sql", "{$global['systemRootPath']}updateDb.sql.old");?>
<div class="alert alert-success">
<?php
printf(__("Your update from file %s is done, click continue"), $_POST['updateFile']); ?><hr>
<a class="btn btn-success" href="?done=1" > <span class="glyphicon glyphicon-ok"></span> <?php echo __("Continue"); ?> </a>
</div>
<?php
}
?>
</div>
</div>
<?php
include $global['systemRootPath'] . 'view/include/footer.php';
?>
<script src="<?php echo getCDN(); ?>js/three.js" type="text/javascript"></script>
</body>
</html>
<?php
exit;
?>