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

You can now manually start/stop recording

This commit is contained in:
DanielnetoDotCom 2021-05-21 10:05:39 -03:00
parent 6a6288ab54
commit 786ea71eca
37 changed files with 723 additions and 234 deletions

View file

@ -4,7 +4,7 @@ if (file_exists("../videos/configuration.php")) {
exit;
}
$installationVersion = "11.0";
$installationVersion = "11.1";
error_log("Installation: ".__LINE__." ". json_encode($_POST));
header('Content-Type: application/json');

View file

@ -77,11 +77,13 @@ CREATE TABLE IF NOT EXISTS `categories` (
`private` TINYINT(1) NULL DEFAULT 0,
`allow_download` TINYINT(1) NULL DEFAULT 1,
`order` INT(11) NULL DEFAULT NULL,
`suggested` TINYINT(1) NULL DEFAULT NULL,
PRIMARY KEY (`id`),
INDEX `fk_categories_users1_idx` (`users_id` ASC),
INDEX `clean_name_INDEX2` (`clean_name` ASC),
INDEX `sortcategoryOrderIndex` (`order` ASC),
INDEX `category_name_idx` (`name` ASC),
INDEX `categoriesindex9suggested` (`suggested` ASC),
FULLTEXT INDEX `index7cname` (`name`),
FULLTEXT INDEX `index8cdescr` (`description`),
UNIQUE INDEX `clean_name_UNIQUE` (`clean_name` ASC),

View file

@ -75,7 +75,8 @@ if ($option == 1 || $option == 3) {
array('4b9142c0-f0c3-42be-8fe5-a4775111239c', 'VideoResolutionSwitcher', 'VideoResolutionSwitcher'),
array('28e74f9a-a2ef-4644-86f0-40234ae7c1b5', 'VideoThumbnails', 'VideoThumbnails'),
array('meet225-3807-4167-ba81-0509dd280e06', 'Meet', 'Meet'),
array('YPTSocket-5ee8405eaaa16', 'YPTSocket', 'YPTSocket')
array('YPTSocket-5ee8405eaaa16', 'YPTSocket', 'YPTSocket'),
array('Scheduler-5ee8405eaaa16', 'Scheduler', 'Scheduler')
);
foreach ($EnablePlugins as $value) {
if ($plugin = Plugin::getOrCreatePluginByName($value[2], 'active')) {

View file

@ -23,6 +23,15 @@ class Category {
private $private;
private $allow_download;
private $order;
private $suggested;
function getSuggested() {
return empty($this->suggested)?0:1;
}
function setSuggested($suggested) {
$this->suggested = empty($suggested)?0:1;
}
function getOrder() {
return intval($this->order);
@ -73,40 +82,6 @@ class Category {
$this->parentId = $parentId;
}
/*
function setType($type, $overwriteUserId = 0) {
global $global;
$internalId = $overwriteUserId;
if (empty($internalId)) {
$internalId = $this->id;
}
$exist = false;
// require this cause of Video::autosetCategoryType - but should be moveable easy here..
require_once dirname(__FILE__) . '/../objects/video.php';
$sql = "SELECT * FROM `category_type_cache` WHERE categoryId = ?";
$res = sqlDAL::readSql($sql, "i", array($internalId));
$catTypeCache = sqlDAL::fetchAssoc($res);
sqlDAL::close($res);
if ($catTypeCache != false) {
$exist = true;
}
if ($type == "3") {
// auto-cat-type
Video::autosetCategoryType($internalId);
} else {
if ($exist) {
$sql = "UPDATE `category_type_cache` SET `type` = ?, `manualSet` = '1' WHERE `category_type_cache`.`categoryId` = ?;";
sqlDAL::writeSql($sql, "si", array($type, $internalId));
} else {
$sql = "INSERT INTO `category_type_cache` (`categoryId`, `type`, `manualSet`) VALUES (?,?,'1')";
sqlDAL::writeSql($sql, "is", array($internalId, $type));
}
}
}
*
*/
function setDescription($description) {
$this->description = $description;
}
@ -170,9 +145,10 @@ class Category {
. "parentId = ?,"
. "iconClass = ?,"
. "users_id = ?,"
. "suggested = ?,"
. "`private` = ?, allow_download = ?, `order` = ?, modified = now() WHERE id = ?";
$format = "sssiisiiiii";
$values = array($this->name, $this->clean_name, $this->description, $this->nextVideoOrder, $this->parentId, $this->getIconClass(), $this->getUsers_id(), $this->getPrivate(), $this->getAllow_download(), $this->getOrder(), $this->id);
$format = "sssiisiiiiii";
$values = array($this->name, $this->clean_name, $this->description, intval($this->nextVideoOrder), $this->parentId, $this->getIconClass(), $this->getUsers_id(), $this->getSuggested(), $this->getPrivate(), $this->getAllow_download(), $this->getOrder(), $this->id);
} else {
$sql = "INSERT INTO categories ( "
. "name,"
@ -182,9 +158,10 @@ class Category {
. "parentId,"
. "iconClass, "
. "users_id, "
. "`private`, allow_download, `order`, created, modified) VALUES (?, ?,?,?,?,?,?,?,?,?,now(), now())";
$format = "sssiisiiii";
$values = array($this->name, $this->clean_name, $this->description, $this->nextVideoOrder, $this->parentId, $this->getIconClass(), $this->getUsers_id(), $this->getPrivate(), $this->getAllow_download(), $this->getOrder());
. "suggested, "
. "`private`, allow_download, `order`, created, modified) VALUES (?, ?,?,?,?,?,?,?,?,?,?,now(), now())";
$format = "sssiisiiiii";
$values = array($this->name, $this->clean_name, $this->description, intval($this->nextVideoOrder), $this->parentId, $this->getIconClass(), $this->getUsers_id(), $this->getSuggested(), $this->getPrivate(), $this->getAllow_download(), $this->getOrder());
}
$insert_row = sqlDAL::writeSql($sql, $format, $values);
@ -391,9 +368,9 @@ class Category {
$sortWhitelist = array('id', 'name', 'clean_name', 'description', 'iconClass', 'nextVideoOrder', 'parentId', 'type', 'users_id', 'private', 'allow_download', 'order');
if(!empty($_POST['sort']) && is_array($_POST['sort'])){
if (!empty($_POST['sort']) && is_array($_POST['sort'])) {
foreach ($_POST['sort'] as $key => $value) {
if(!in_array($key, $sortWhitelist)){
if (!in_array($key, $sortWhitelist)) {
unset($_POST['sort'][$key]);
}
}
@ -644,7 +621,6 @@ class Category {
return $result;
}
static function getLatestLiveFromCategory($categories_id) {
if (!AVideoPlugin::isEnabledByName("Live")) {
return array();
@ -849,10 +825,10 @@ class Category {
if (!file_exists($photo['path']) || !file_exists($background['path'])) {
return false;
}
if(filesize($photo['path']) <= 190){ // transparent image
if (filesize($photo['path']) <= 190) { // transparent image
return false;
}
if(filesize($background['path']) <= 980 || filesize($background['path']) == 4480){ // transparent image
if (filesize($background['path']) <= 980 || filesize($background['path']) == 4480) { // transparent image
return false;
}
return true;

View file

@ -24,7 +24,8 @@ $objCat->setName($_POST['name']);
$objCat->setClean_name($_POST['clean_name']);
$objCat->setDescription($_POST['description']);
$objCat->setIconClass($_POST['iconClass']);
$objCat->setNextVideoOrder($_POST['nextVideoOrder']);
//$objCat->setNextVideoOrder($_POST['nextVideoOrder']);
$objCat->setSuggested($_POST['suggested']);
$objCat->setParentId($_POST['parentId']);
$objCat->setPrivate($_POST['private']);
$objCat->setAllow_download($_POST['allow_download']);

View file

@ -999,7 +999,12 @@ if (typeof gtag !== \"function\") {
return !empty($_SESSION['user']['emailVerified']);
}
public static function isAdmin() {
public static function isAdmin($users_id=0) {
if(!empty($users_id)){
$user = new User($users_id);
return !empty($user->getIsAdmin());
}
self::recreateLoginFromCookie();
return !empty($_SESSION['user']['isAdmin']);
}

View file

@ -626,7 +626,7 @@ if (!class_exists('Video')) {
. " nv.clean_title as next_clean_title,"
. " nv.filename as next_filename,"
. " nv.id as next_id,"
. " c.id as category_id,c.iconClass,c.name as category,c.iconClass, c.clean_name as clean_category,c.description as category_description,c.nextVideoOrder as category_order, v.created as videoCreation, "
. " c.id as category_id,c.iconClass,c.name as category,c.iconClass, c.clean_name as clean_category,c.description as category_description, v.created as videoCreation, "
. " (SELECT count(id) FROM likes as l where l.videos_id = v.id AND `like` = 1 ) as likes, "
. " (SELECT count(id) FROM likes as l where l.videos_id = v.id AND `like` = -1 ) as dislikes ";
if (User::isLogged()) {
@ -2255,6 +2255,9 @@ if (!class_exists('Video')) {
case Video::$statusUnlisted:
$objTag->type = "info";
break;
case Video::$statusRecording:
$objTag->type = "danger isRecording isRecordingIcon";
break;
default:
$objTag->type = "danger";
break;

View file

@ -421,8 +421,6 @@ class LiveTransmitionHistory extends ObjectYPT {
$this->live_servers_id = 'NULL';
}
AVideoPlugin::onLiveStream($this->users_id, $this->live_servers_id);
return parent::save();
}

View file

@ -247,6 +247,7 @@ if (!empty($chat2) && !empty($chat2->useStaticLayout)) {
"categories_id": $('select[name="categories_id"]').val(),
"key": "<?php echo $trasnmition['key']; ?>",
"listed": $('#listed').is(":checked"),
"saveTransmition": $('#recordLive').is(":checked"),
"userGroups": selectedUserGroups
},
type: 'post',

View file

@ -21,6 +21,7 @@ $l->setDescription($_POST['description']);
$l->setKey($_POST['key']);
$l->setCategories_id($categories_id);
$l->setPublic((empty($_POST['listed'])|| $_POST['listed']==='false')?0:1);
$l->setSaveTransmition((empty($_POST['saveTransmition'])|| $_POST['saveTransmition']==='false')?0:1);
$l->setUsers_id(User::getId());
$id = $l->save();
$l = new LiveTransmition($id);

View file

@ -34,6 +34,19 @@
<label for="listed" class="label-success"></label>
</div>
</div>
<?php
if (AVideoPlugin::isEnabledByName('SendRecordedToEncoder') && SendRecordedToEncoder::canApprove(User::getId())) {
?>
<div class="form-group">
<span class="fa fa-globe"></span> <?php echo __("Auto record this live"); ?>
<div class="material-switch pull-right">
<input id="recordLive" type="checkbox" value="1" <?php echo SendRecordedToEncoder::userApproved(User::getId()) ? "checked" : ""; ?> onchange="saveStream();"/>
<label for="recordLive" class="label-success"></label>
</div>
</div>
<?php
}
?>
</div>
<div class="col-sm-6">

0
plugin/Live/view/live.js Normal file
View file

View file

@ -72,16 +72,6 @@ $poster = Live::getPosterImage($livet['users_id'], $_REQUEST['live_servers_id'])
id="mainVideo" style="width: 100%; height: 100%; position: absolute;">
<source src="<?php echo Live::getM3U8File($uuid); ?>" type='application/x-mpegURL'>
</video>
<?php
if (AVideoPlugin::isEnabled("0e225f8e-15e2-43d4-8ff7-0cb07c2a2b3b")) {
require_once $global['systemRootPath'] . 'plugin/VideoLogoOverlay/VideoLogoOverlay.php';
$style = VideoLogoOverlay::getStyle();
$url = VideoLogoOverlay::getLink();
?>
<div style="<?php echo $style; ?>">
<a href="<?php echo $url; ?>" target="_blank"> <img src="<?php echo $global['webSiteRootURL']; ?>videos/logoOverlay.png" alt="Logo" class="img-responsive col-lg-12 col-md-8 col-sm-7 col-xs-6"></a>
</div>
<?php } ?>
</div>
<div style="z-index: 999; position: absolute; top:5px; left: 5px; opacity: 0.8; filter: alpha(opacity=80);" class="liveEmbed">

View file

@ -100,16 +100,6 @@ $poster = Live::getPosterImage($livet['users_id'], $_REQUEST['live_servers_id'])
id="mainVideo" data-setup='{ "aspectRatio": "16:9", "techorder" : ["flash", "html5"] }'>
<source src="<?php echo Live::getM3U8File($uuid); ?>" type='application/x-mpegURL'>
</video>
<?php
if (AVideoPlugin::isEnabled("0e225f8e-15e2-43d4-8ff7-0cb07c2a2b3b")) {
require_once $global['systemRootPath'] . 'plugin/VideoLogoOverlay/VideoLogoOverlay.php';
$style = VideoLogoOverlay::getStyle();
$url = VideoLogoOverlay::getLink();
?>
<div style="<?php echo $style; ?>">
<a href="<?php echo $url; ?>" target="_blank"> <img src="<?php echo $global['webSiteRootURL']; ?>videos/logoOverlay.png" alt="Logo" class="img-responsive col-lg-12 col-md-8 col-sm-7 col-xs-6"></a>
</div>
<?php } ?>
<div style="z-index: 999; position: absolute; top:5px; left: 5px; opacity: 0.8; filter: alpha(opacity=80);" class="LiveEmbed2">
<?php

View file

@ -144,17 +144,6 @@ if (!empty($video['id'])) {
</video>
</div>
<?php
if (AVideoPlugin::isEnabled("0e225f8e-15e2-43d4-8ff7-0cb07c2a2b3b")) {
require_once $global['systemRootPath'] . 'plugin/VideoLogoOverlay/VideoLogoOverlay.php';
$style = VideoLogoOverlay::getStyle();
$url = VideoLogoOverlay::getLink();
?>
<div style="<?php echo $style; ?>" class="VideoLogoOverlay">
<a href="<?php echo $url; ?>" target="_blank"> <img src="<?php echo $global['webSiteRootURL']; ?>videos/logoOverlay.png" alt="Logo" class="img-responsive col-lg-12 col-md-8 col-sm-7 col-xs-6"></a>
</div>
<?php } ?>
<?php
showCloseButton();
?>

View file

@ -188,12 +188,6 @@ class PlayerSkins extends PluginAbstract {
</div>
<div id="main-video" class="embed-responsive embed-responsive-16by9">' . $htmlMediaTag . '</div>';
if (AVideoPlugin::isEnabledByName('VideoLogoOverlay')) {
$style = VideoLogoOverlay::getStyle();
$url = VideoLogoOverlay::getLink();
$html .= '<div style="' . $style . '" class="VideoLogoOverlay"><a href="' . $url . '" target="_blank"> <img src="' . $global['webSiteRootURL'] . 'videos/logoOverlay.png" alt="Logo" class="img-responsive col-lg-12 col-md-8 col-sm-7 col-xs-6"></a></div>';
}
$html .= showCloseButton() . '</div></div><div class="'.$col3Classes.'"></div></div>';
return $html;

View file

@ -0,0 +1,129 @@
<?php
require_once dirname(__FILE__) . '/../../../videos/configuration.php';
class Scheduler_commands extends ObjectYPT {
public static $statusActive = 'a';
public static $statusInactive = 'i';
public static $statusCanceled = 'c';
public static $statusExecuted = 'e';
protected $id,$callbackURL,$parameters,$date_to_execute,$executed_in,$status, $callbackResponse;
static function getSearchFieldsNames() {
return array('callbackURL','parameters');
}
static function getTableName() {
return 'scheduler_commands';
}
public static function getAllActiveAndReady() {
global $global;
if (!static::isTableInstalled()) {
return false;
}
$sql = "SELECT * FROM " . static::getTableName() . " WHERE status='a' AND date_to_execute <= now() ";
$sql .= self::getSqlFromPost();
//echo $sql;
$res = sqlDAL::readSql($sql);
$fullData = sqlDAL::fetchAllAssoc($res);
sqlDAL::close($res);
$rows = array();
if ($res != false) {
foreach ($fullData as $row) {
$rows[] = $row;
}
} else {
die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
}
return $rows;
}
function setId($id) {
$this->id = intval($id);
}
function setCallbackURL($callbackURL) {
$this->callbackURL = $callbackURL;
}
function setParameters($parameters) {
$this->parameters = $parameters;
}
function setDate_to_execute($date_to_execute) {
if(is_numeric($date_to_execute)){
$date_to_execute = date('Y-m-d H:i:s', $date_to_execute);
}
$this->date_to_execute = $date_to_execute;
}
function setExecuted_in($executed_in) {
$this->executed_in = $executed_in;
}
function setStatus($status) {
$this->status = $status;
}
function getId() {
return intval($this->id);
}
function getCallbackURL() {
return $this->callbackURL;
}
function getParameters() {
return $this->parameters;
}
function getDate_to_execute() {
return $this->date_to_execute;
}
function getExecuted_in() {
return $this->executed_in;
}
function getStatus() {
return $this->status;
}
function getCallbackResponse() {
return $this->callbackResponse;
}
function setCallbackResponse($callbackResponse) {
$this->callbackResponse = $callbackResponse;
}
function setExecuted($callbackResponse) {
if(!is_string($callbackResponse)){
$callbackResponse = json_encode($callbackResponse);
}
$this->setExecuted_in(date('Y-m-d H:i:s'));
$this->setCallbackResponse($callbackResponse);
$this->setStatus(self::$statusExecuted);
return $this->save();
}
public function save() {
if(empty($this->date_to_execute)){
_error_log("Scheduler_commands::save(): date_to_execute is empty ". json_encode(debug_backtrace()));
return false;
}
if(empty($this->status)){
$this->status = self::$statusActive;
}
if(empty($this->callbackURL)){
$this->callbackURL = '';
}
return parent::save();
}
}

View file

@ -0,0 +1,97 @@
<?php
global $global;
require_once $global['systemRootPath'] . 'plugin/Plugin.abstract.php';
require_once $global['systemRootPath'] . 'plugin/Scheduler/Objects/Scheduler_commands.php';
class Scheduler extends PluginAbstract {
public function getDescription() {
$desc = "Scheduler Plugin";
//$desc .= $this->isReadyLabel(array('YPTWallet'));
return $desc;
}
public function getName() {
return "Scheduler";
}
public function getUUID() {
return "Scheduler-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/Scheduler/View/editor.php" class="btn btn-primary btn-sm btn-xs btn-block"><i class="fa fa-edit"></i> Edit</a>';
}
static public function run($scheduler_commands_id){
global $_executeSchelude;
if(!isset($_executeSchelude)){
$_executeSchelude = array();
}
$e = new Scheduler_commands($scheduler_commands_id);
$callBackURL = $e->getCallbackURL();
if(!isValidURL($callBackURL)){
return false;
}
if(empty($_executeSchelude[$callBackURL])){
$_executeSchelude[$callBackURL] = url_get_contents($callBackURL);
}
if(!empty($_executeSchelude[$callBackURL])){
return $e->setExecuted($_executeSchelude[$callBackURL]);
}
return false;
}
static public function add($date_to_execute, $callbackURL){
if(empty($date_to_execute)){
return false;
}
if(empty($callbackURL)){
return false;
}
$e = new Scheduler_commands(0);
$e->setDate_to_execute($date_to_execute);
$e->setCallbackURL($callbackURL);
return $e->save();
}
}

View file

@ -0,0 +1,28 @@
<?php
header('Content-Type: application/json');
require_once '../../../../videos/configuration.php';
require_once $global['systemRootPath'] . 'plugin/Scheduler/Objects/Scheduler_commands.php';
$obj = new stdClass();
$obj->error = true;
$obj->msg = "";
$plugin = AVideoPlugin::loadPluginIfEnabled('Scheduler');
if(!User::isAdmin()){
$obj->msg = "You cant do this";
die(json_encode($obj));
}
$o = new Scheduler_commands(@$_POST['id']);
$o->setCallbackURL($_POST['callbackURL']);
$o->setParameters($_POST['parameters']);
$o->setDate_to_execute($_POST['date_to_execute']);
$o->setExecuted_in($_POST['executed_in']);
$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/Scheduler/Objects/Scheduler_commands.php';
header('Content-Type: application/json');
$obj = new stdClass();
$obj->error = true;
$plugin = AVideoPlugin::loadPluginIfEnabled('Scheduler');
if(!User::isAdmin()){
$obj->msg = "You cant do this";
die(json_encode($obj));
}
$id = intval($_POST['id']);
$row = new Scheduler_commands($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(); ?> :: Scheduler</title>
<?php
include $global['systemRootPath'] . 'view/include/head.php';
include $global['systemRootPath'] . 'plugin/Scheduler/View/{$classname}/index_head.php';
?>
</head>
<body class="<?php echo $global['bodyClass']; ?>">
<?php
include $global['systemRootPath'] . 'view/include/navbar.php';
include $global['systemRootPath'] . 'plugin/Scheduler/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,220 @@
<?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="panelScheduler_commandsForm">
<div class="row">
<input type="hidden" name="id" id="Scheduler_commandsid" value="" >
<div class="form-group col-sm-12">
<label for="Scheduler_commandscallbackURL"><?php echo __("CallbackURL"); ?>:</label>
<input type="text" id="Scheduler_commandscallbackURL" name="callbackURL" class="form-control input-sm" placeholder="<?php echo __("CallbackURL"); ?>" required="true">
</div>
<div class="form-group col-sm-12">
<label for="Scheduler_commandsparameters"><?php echo __("Parameters"); ?>:</label>
<textarea id="Scheduler_commandsparameters" name="parameters" class="form-control input-sm" placeholder="<?php echo __("Parameters"); ?>" required="true"></textarea>
</div>
<div class="form-group col-sm-12">
<label for="Scheduler_commandsdate_to_execute"><?php echo __("Date To Execute"); ?>:</label>
<input type="text" id="Scheduler_commandsdate_to_execute" name="date_to_execute" class="form-control input-sm" placeholder="<?php echo __("Date To Execute"); ?>" required="true" autocomplete="off">
</div>
<div class="form-group col-sm-12">
<label for="Scheduler_commandsexecuted_in"><?php echo __("Executed In"); ?>:</label>
<input type="text" id="Scheduler_commandsexecuted_in" name="executed_in" class="form-control input-sm" placeholder="<?php echo __("Executed In"); ?>" required="true" autocomplete="off">
</div>
<div class="form-group col-sm-12">
<label for="status"><?php echo __("Status"); ?>:</label>
<select class="form-control input-sm" name="status" id="Scheduler_commandsstatus">
<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="newScheduler_commandsLink" onclick="clearScheduler_commandsForm()"><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="Scheduler_commandsTable" class="display table table-bordered table-responsive table-striped table-hover table-condensed" width="100%" cellspacing="0">
<thead>
<tr>
<th>#</th>
<th><?php echo __("CallbackURL"); ?></th>
<th><?php echo __("Parameters"); ?></th>
<th><?php echo __("Date To Execute"); ?></th>
<th><?php echo __("Executed In"); ?></th>
<th><?php echo __("Status"); ?></th>
<th></th>
</tr>
</thead>
<tfoot>
<tr>
<th>#</th>
<th><?php echo __("CallbackURL"); ?></th>
<th><?php echo __("Parameters"); ?></th>
<th><?php echo __("Date To Execute"); ?></th>
<th><?php echo __("Executed In"); ?></th>
<th><?php echo __("Status"); ?></th>
<th></th>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="Scheduler_commandsbtnModelLinks" style="display: none;">
<div class="btn-group pull-right">
<button href="" class="edit_Scheduler_commands btn btn-default btn-xs">
<i class="fa fa-edit"></i>
</button>
<button href="" class="delete_Scheduler_commands btn btn-danger btn-xs">
<i class="fa fa-trash"></i>
</button>
</div>
</div>
<script type="text/javascript">
function clearScheduler_commandsForm() {
$('#Scheduler_commandsid').val('');
$('#Scheduler_commandscallbackURL').val('');
$('#Scheduler_commandsparameters').val('');
$('#Scheduler_commandsdate_to_execute').val('');
$('#Scheduler_commandsexecuted_in').val('');
$('#Scheduler_commandsstatus').val('');
}
$(document).ready(function () {
$('#addScheduler_commandsBtn').click(function () {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>plugin/Scheduler/View/addScheduler_commandsVideo.php',
data: $('#panelScheduler_commandsForm').serialize(),
type: 'post',
success: function (response) {
if (response.error) {
avideoAlertError(response.msg);
} else {
avideoToast("<?php echo __("Your register has been saved!"); ?>");
$("#panelScheduler_commandsForm").trigger("reset");
}
clearScheduler_commandsForm();
tableVideos.ajax.reload();
modal.hidePleaseWait();
}
});
});
var Scheduler_commandstableVar = $('#Scheduler_commandsTable').DataTable({
"ajax": "<?php echo $global['webSiteRootURL']; ?>plugin/Scheduler/View/Scheduler_commands/list.json.php",
"columns": [
{"data": "id"},
{"data": "callbackURL"},
{"data": "parameters"},
{"data": "date_to_execute"},
{"data": "executed_in"},
{"data": "status"},
{
sortable: false,
data: null,
defaultContent: $('#Scheduler_commandsbtnModelLinks').html()
}
],
select: true,
});
$('#newScheduler_commands').on('click', function (e) {
e.preventDefault();
$('#panelScheduler_commandsForm').trigger("reset");
$('#Scheduler_commandsid').val('');
});
$('#panelScheduler_commandsForm').on('submit', function (e) {
e.preventDefault();
modal.showPleaseWait();
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>plugin/Scheduler/View/Scheduler_commands/add.json.php',
data: $('#panelScheduler_commandsForm').serialize(),
type: 'post',
success: function (response) {
if (response.error) {
avideoAlertError(response.msg);
} else {
avideoToast("<?php echo __("Your register has been saved!"); ?>");
$("#panelScheduler_commandsForm").trigger("reset");
}
Scheduler_commandstableVar.ajax.reload();
$('#Scheduler_commandsid').val('');
modal.hidePleaseWait();
}
});
});
$('#Scheduler_commandsTable').on('click', 'button.delete_Scheduler_commands', function (e) {
e.preventDefault();
var tr = $(this).closest('tr')[0];
var data = Scheduler_commandstableVar.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(function (willDelete) {
if (willDelete) {
modal.showPleaseWait();
$.ajax({
type: "POST",
url: "<?php echo $global['webSiteRootURL']; ?>plugin/Scheduler/View/Scheduler_commands/delete.json.php",
data: data
}).done(function (resposta) {
if (resposta.error) {
avideoAlertError(resposta.msg);
}
Scheduler_commandstableVar.ajax.reload();
modal.hidePleaseWait();
});
} else {
}
});
});
$('#Scheduler_commandsTable').on('click', 'button.edit_Scheduler_commands', function (e) {
e.preventDefault();
var tr = $(this).closest('tr')[0];
var data = Scheduler_commandstableVar.row(tr).data();
$('#Scheduler_commandsid').val(data.id);
$('#Scheduler_commandscallbackURL').val(data.callbackURL);
$('#Scheduler_commandsparameters').val(data.parameters);
$('#Scheduler_commandsdate_to_execute').val(data.date_to_execute);
$('#Scheduler_commandsexecuted_in').val(data.executed_in);
$('#Scheduler_commandsstatus').val(data.status);
});
});
</script>
<script> $(document).ready(function () {$('#Scheduler_commandsdate_to_execute').datetimepicker({format: 'yyyy-mm-dd hh:ii',autoclose: true });});</script>
<script> $(document).ready(function () {$('#Scheduler_commandsexecuted_in').datetimepicker({format: 'yyyy-mm-dd hh:ii',autoclose: true });});</script>

View file

@ -0,0 +1,5 @@
<?php
$plugin = AVideoPlugin::loadPluginIfEnabled('Scheduler');
?>
<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/Scheduler/Objects/Scheduler_commands.php';
header('Content-Type: application/json');
$rows = Scheduler_commands::getAll();
?>
{"data": <?php echo json_encode($rows); ?>}

View file

@ -0,0 +1,46 @@
<?php
require_once '../../../videos/configuration.php';
AVideoPlugin::loadPlugin("Scheduler");
?>
<!DOCTYPE html>
<html lang="<?php echo $_SESSION['language']; ?>">
<head>
<title><?php echo $config->getWebSiteTitle(); ?> :: Scheduler</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 __('Scheduler') ?>
<div class="pull-right">
<?php echo AVideoPlugin::getSwitchButton("Scheduler"); ?>
</div>
</div>
<div class="panel-body">
<ul class="nav nav-tabs">
<li class="active"><a data-toggle="tab" href="#Scheduler_commands"><?php echo __("Scheduler Commands"); ?></a></li>
</ul>
<div class="tab-content">
<div id="Scheduler_commands" class="tab-pane fade in active" style="padding: 10px;">
<?php
include $global['systemRootPath'] . 'plugin/Scheduler/View/Scheduler_commands/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,12 @@
CREATE TABLE IF NOT EXISTS `scheduler_commands` (
`id` INT NOT NULL AUTO_INCREMENT,
`callbackURL` VARCHAR(255) NOT NULL,
`parameters` TEXT NULL,
`created` DATETIME NULL,
`modified` DATETIME NULL,
`date_to_execute` DATETIME NOT NULL,
`executed_in` DATETIME NULL,
`status` CHAR(1) NOT NULL DEFAULT 'a',
`callbackResponse` TEXT NULL,
PRIMARY KEY (`id`))
ENGINE = InnoDB;

22
plugin/Scheduler/run.php Normal file
View file

@ -0,0 +1,22 @@
<?php
//streamer config
require_once '../../videos/configuration.php';
if (!isCommandLineInterface()) {
return die('Command Line only');
}
if(!AVideoPlugin::isEnabledByName('Scheduler')){
return die('Scheduler is disabled');
}
$rows = Scheduler_commands::getAllActiveAndReady();
$time = getDatabaseTime();
//var_dump($time, date('Y-m-d H:i:s', $time), $rows);
foreach ($rows as $value) {
$id = Scheduler::run($value['id']);
if(empty($id)){
_error_log("Scheduler::run error [{$value['id']}] callbackURL={$value['callbackURL']}");
}
}

View file

@ -0,0 +1,13 @@
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';
ALTER TABLE `categories`
ADD COLUMN `suggested` TINYINT(1) NULL DEFAULT NULL,
ADD INDEX `categoriesindex9suggested` (`suggested` ASC);
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
UPDATE configurations SET version = '11.1', modified = now() WHERE id = 1;

View file

@ -33,6 +33,10 @@
#myNavbar .select2-selection{
height: 45px;
}
#rightLoginButton{
height: 45px;
padding: 10px 15px !important;
}
#rightProfileButton > img{
height: 45px !important;
width: 45px !important;
@ -46,3 +50,9 @@
width: 50px;
margin: 0 5px;
}
th a, .select2-container--default span{
color: #FFF !important;
}
th:hover, .select2-dropdown{
background-color: #111 !important;
}

File diff suppressed because one or more lines are too long

View file

@ -32,22 +32,6 @@ $sources = getVideosURLPDF($video['filename']);
</script>
</div>
<?php
if (AVideoPlugin::isEnabled("0e225f8e-15e2-43d4-8ff7-0cb07c2a2b3b")) {
require_once $global['systemRootPath'] . 'plugin/VideoLogoOverlay/VideoLogoOverlay.php';
$style = VideoLogoOverlay::getStyle();
$url = VideoLogoOverlay::getLink();
?>
<div style="<?php echo $style; ?>">
<a href="<?php echo $url; ?>" target="_blank">
<img src="<?php echo $global['webSiteRootURL']; ?>videos/logoOverlay.png" alt="Logo" class="img-responsive col-lg-12 col-md-8 col-sm-7 col-xs-6">
</a>
</div>
<?php
}
?>
<?php
showCloseButton();
?>

View file

@ -27,21 +27,6 @@ $sources = getVideosURLIMAGE($video['filename']);
</script>
</div>
<?php
if (AVideoPlugin::isEnabled("0e225f8e-15e2-43d4-8ff7-0cb07c2a2b3b")) {
require_once $global['systemRootPath'] . 'plugin/VideoLogoOverlay/VideoLogoOverlay.php';
$style = VideoLogoOverlay::getStyle();
$url = VideoLogoOverlay::getLink();
?>
<div style="<?php echo $style; ?>">
<a href="<?php echo $url; ?>" target="_blank">
<img src="<?php echo $global['webSiteRootURL']; ?>videos/logoOverlay.png" alt="Logo" class="img-responsive col-lg-12 col-md-8 col-sm-7 col-xs-6">
</a>
</div>
<?php
}
?>
</div>
</div>
<script>

View file

@ -27,21 +27,6 @@ $sources = getVideosURLPDF($video['filename']);
</script>
</div>
<?php
if (AVideoPlugin::isEnabled("0e225f8e-15e2-43d4-8ff7-0cb07c2a2b3b")) {
require_once $global['systemRootPath'] . 'plugin/VideoLogoOverlay/VideoLogoOverlay.php';
$style = VideoLogoOverlay::getStyle();
$url = VideoLogoOverlay::getLink();
?>
<div style="<?php echo $style; ?>">
<a href="<?php echo $url; ?>" target="_blank">
<img src="<?php echo $global['webSiteRootURL']; ?>videos/logoOverlay.png" alt="Logo" class="img-responsive col-lg-12 col-md-8 col-sm-7 col-xs-6">
</a>
</div>
<?php
}
?>
</div>
</div>
<script>

View file

@ -42,21 +42,6 @@ $sources = getVideosURLZIP($video['filename']);
</script>
</div>
<?php
if (AVideoPlugin::isEnabled("0e225f8e-15e2-43d4-8ff7-0cb07c2a2b3b")) {
require_once $global['systemRootPath'] . 'plugin/VideoLogoOverlay/VideoLogoOverlay.php';
$style = VideoLogoOverlay::getStyle();
$url = VideoLogoOverlay::getLink();
?>
<div style="<?php echo $style; ?>">
<a href="<?php echo $url; ?>" target="_blank">
<img src="<?php echo $global['webSiteRootURL']; ?>videos/logoOverlay.png" alt="Logo" class="img-responsive col-lg-12 col-md-8 col-sm-7 col-xs-6">
</a>
</div>
<?php
}
?>
</div>
</div>
<script>

View file

@ -18,7 +18,8 @@
<th data-column-id="fullTotal_videos" data-sortable="false"><?php echo __("Videos"); ?></th>
<th data-column-id="fullTotal_lives" data-sortable="false"><?php echo __("Lives"); ?></th>
<th data-column-id="fullTotal_livelinks" data-sortable="false"><?php echo __("Live Links"); ?></th>
<th data-column-id="allow_download" ><?php echo __("Download"); ?></th>
<th data-column-id="allow_download" data-formatter="download" ><?php echo __("Download"); ?></th>
<th data-column-id="suggested" data-formatter="suggested" ><?php echo __("Suggested"); ?></th>
<th data-column-id="order" ><?php echo __("Order"); ?></th>
<th data-column-id="commands" data-formatter="commands" data-sortable="false" data-width="130px"></th>
</tr>
@ -111,10 +112,10 @@
</div>
<div class="col-md-6">
<div class="form-group">
<label><?php echo __("Autoplay next-video-order"); ?></label>
<select class="form-control" id="inputNextVideoOrder">
<option value="0"><?php echo __("Random"); ?></option>
<option value="1"><?php echo __("By name"); ?></option>
<label><?php echo __("Suggested"); ?></label>
<select class="form-control" id="inputSuggested">
<option value="0"><?php echo __("No"); ?></option>
<option value="1"><?php echo __("Yes"); ?></option>
</select>
</div>
</div>
@ -217,11 +218,18 @@ echo $croppie2['getCroppieFunction'];
ajax: true,
url: "<?php echo $global['webSiteRootURL'] . "objects/categories.json.php"; ?>",
formatters: {
"nextVideoOrder": function (column, row) {
if (row.nextVideoOrder == 0) {
return "<?php echo __("Random"); ?>";
"download": function (column, row) {
if (row.allow_download == 1) {
return '<i class="far fa-check-square"></i>';
} else {
return "<?php echo __("By name"); ?>";
return '<i class="far fa-square"></i>';
}
},
"suggested": function (column, row) {
if (row.suggested == 1) {
return '<i class="far fa-check-square"></i>';
} else {
return '<i class="far fa-square"></i>';
}
},
"name": function (column, row) {
@ -274,7 +282,7 @@ echo $croppie2['getCroppieFunction'];
$('#inputName').val(row.name);
$('#inputCleanName').val(row.clean_name);
$('#inputDescription').val(row.description);
$('#inputNextVideoOrder').val(row.nextVideoOrder);
$('#inputSuggested').val(row.suggested);
$('#inputPrivate').val(row.private);
$('#allow_download').val(row.allow_download);
$('#order').val(row.order);
@ -379,7 +387,7 @@ echo $croppie1['getCroppieFunction'];
"name": $('#inputName').val(),
"clean_name": $('#inputCleanName').val(),
"description": $('#inputDescription').val(),
"nextVideoOrder": $('#inputNextVideoOrder').val(),
"suggested": $('#inputSuggested').val(),
"private": $('#inputPrivate').val(),
"allow_download": $('#allow_download').val(),
"order": $('#order').val(),

View file

@ -172,34 +172,6 @@ if (!empty($evideo)) {
} else {
$modeYouTubeTimeLog['Code part 1.3'] = microtime(true) - $modeYouTubeTime;
$modeYouTubeTime = microtime(true);
/*
if ($video['category_order'] == 1) {
$modeYouTubeTimeLog['Code part 1.4'] = microtime(true)-$modeYouTubeTime;
$modeYouTubeTime = microtime(true);
unset($_POST['sort']);
$category = Category::getAllCategories();
$_POST['sort']['title'] = "ASC";
$modeYouTubeTimeLog['Code part 1.4.1'] = microtime(true)-$modeYouTubeTime;
$modeYouTubeTime = microtime(true);
// maybe there's a more slim method?
$videos = Video::getAllVideos();
$videoFound = false;
$autoPlayVideo;
foreach ($videos as $value) {
if ($videoFound) {
$autoPlayVideo = $value;
break;
}
if ($value['id'] == $video['id']) {
// if the video is found, make another round to have the next video properly.
$videoFound = true;
}
}
} else {
*
*/
$modeYouTubeTimeLog['Code part 1.5'] = microtime(true) - $modeYouTubeTime;
$modeYouTubeTime = microtime(true);
if (!empty($video['id'])) {

View file

@ -451,20 +451,6 @@ if (User::hasBlockedUser($video['users_id'])) {
if($video['type'] == "liveLink"){
echo getLiveUsersLabelHTML();
}
// the live users plugin
if (empty($modestbranding) && AVideoPlugin::isEnabled("0e225f8e-15e2-43d4-8ff7-0cb07c2a2b3b")) {
require_once $global['systemRootPath'] . 'plugin/VideoLogoOverlay/VideoLogoOverlay.php';
$style = VideoLogoOverlay::getStyle();
$urlLO = VideoLogoOverlay::getLink();
?>
<div style="<?php echo $style; ?>" class="VideoLogoOverlay">
<a href="<?php echo $urlLO; ?>" target="_blank">
<img src="<?php echo $global['webSiteRootURL']; ?>videos/logoOverlay.png" alt="Logo" class="img-responsive col-lg-12 col-md-8 col-sm-7 col-xs-6">
</a>
</div>
<?php
}
?>
<script>
<?php
@ -482,24 +468,6 @@ if (User::hasBlockedUser($video['users_id'])) {
?>
<p><?php echo __("If you can't view this video, your browser does not support HTML5 videos"); ?></p>
</video>
<?php
// the live users plugin
if (empty($modestbranding) && AVideoPlugin::isEnabled("0e225f8e-15e2-43d4-8ff7-0cb07c2a2b3b")) {
require_once $global['systemRootPath'] . 'plugin/VideoLogoOverlay/VideoLogoOverlay.php';
$style = VideoLogoOverlay::getStyle();
$urlLO = VideoLogoOverlay::getLink();
?>
<div style="<?php echo $style; ?>" class="VideoLogoOverlay">
<a href="<?php echo $urlLO; ?>" target="_blank">
<img src="<?php echo $global['webSiteRootURL']; ?>videos/logoOverlay.png" alt="Logo" class="img-responsive col-lg-12 col-md-8 col-sm-7 col-xs-6">
</a>
</div>
<?php
}
?>
<script><?php
PlayerSkins::playerJSCodeOnLoad($video['id']);
?>