1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 01:39:24 +02:00
DanieL 2023-01-19 23:30:14 -03:00
parent cd7e9d61e9
commit f00c60371c
8 changed files with 130 additions and 120 deletions

View file

@ -1,32 +1,32 @@
<?php
require_once dirname(__FILE__) . '/../../videos/configuration.php';
if (!isCommandLineInterface()) {
die('Command Line only');
}
$daysLimit = 3;
// delete object cache
$cacheDir = ObjectYPT::getCacheDir();
if (empty($cacheDir) || !preg_match('/YPTObjectCache/', $cacheDir)) {
die('Wrong dir: '.$cacheDir);
}
_error_log('crontab.php: '.json_encode(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS)));
echo "deleting {$cacheDir}".PHP_EOL;
// delete caches 3 days old
$cmd = "find {$cacheDir}* -mtime +{$daysLimit} -type f -name \"*.cache\" -exec rm {} \;".PHP_EOL;
echo "Command: {$cmd}";
exec($cmd);
//delete site cache
$cacheDir = getCacheDir();
if (empty($cacheDir) || !preg_match('/cache/', $cacheDir)) {
die('Wrong dir: '.$cacheDir);
}
echo "deleting {$cacheDir}".PHP_EOL;
// delete caches 3 days old
$cmd = "find {$cacheDir}* -mtime +{$daysLimit} -type f -name \"*.cache\" -exec rm {} \;".PHP_EOL;
echo "Command: {$cmd}";
exec($cmd);
<?php
require_once dirname(__FILE__) . '/../../videos/configuration.php';
if (!isCommandLineInterface()) {
die('Command Line only');
}
$daysLimit = 3;
// delete object cache
$cacheDir = ObjectYPT::getCacheDir();
if (empty($cacheDir) || !preg_match('/YPTObjectCache/', $cacheDir)) {
die('Wrong dir: '.$cacheDir);
}
_error_log('crontab.php: '.json_encode(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS)));
echo "deleting {$cacheDir}".PHP_EOL;
// delete caches 3 days old
$cmd = "find {$cacheDir}* -mtime +{$daysLimit} -type f -name \"*.cache\" -exec rm {} \;".PHP_EOL;
echo "Command: {$cmd}";
exec($cmd);
//delete site cache
$cacheDir = getCacheDir();
if (empty($cacheDir) || !preg_match('/cache/', $cacheDir)) {
die('Wrong dir: '.$cacheDir);
}
echo "deleting {$cacheDir}".PHP_EOL;
// delete caches 3 days old
$cmd = "find {$cacheDir}* -mtime +{$daysLimit} -type f -name \"*.cache\" -exec rm {} \;".PHP_EOL;
echo "Command: {$cmd}";
exec($cmd);

View file

@ -1,30 +1,30 @@
<?php
header('Content-Type: application/json');
require_once '../../videos/configuration.php';
$obj = new stdClass();
$obj->error = true;
$obj->msg = "";
$obj->result = "";
if (!User::isAdmin()) {
$obj->msg = "You can't do this";
die(json_encode($obj));
}
require_once $global['systemRootPath'] . 'objects/video_statistic.php';
$objC = AVideoPlugin::getDataObject('Cache');
$days = $objC->deleteStatisticsDaysOld;
if (empty($days)) {
$days = 180;
}
$obj->before = VideoStatistic::getTotalStatisticsRecords();
$obj->result = VideoStatistic::deleteOldStatistics($days);
$obj->after = VideoStatistic::getTotalStatisticsRecords();
$obj->error = empty($obj->result);
$obj->msg = "you had ". number_format($obj->before, 0)." statistics records and removed ". number_format($obj->before-$obj->after, 0)." now you have ". number_format($obj->after, 0);
echo json_encode($obj);
<?php
header('Content-Type: application/json');
require_once '../../videos/configuration.php';
$obj = new stdClass();
$obj->error = true;
$obj->msg = "";
$obj->result = "";
if (!User::isAdmin()) {
$obj->msg = "You can't do this";
die(json_encode($obj));
}
require_once $global['systemRootPath'] . 'objects/video_statistic.php';
$objC = AVideoPlugin::getDataObject('Cache');
$days = $objC->deleteStatisticsDaysOld;
if (empty($days)) {
$days = 180;
}
$obj->before = VideoStatistic::getTotalStatisticsRecords();
$obj->result = VideoStatistic::deleteOldStatistics($days);
$obj->after = VideoStatistic::getTotalStatisticsRecords();
$obj->error = empty($obj->result);
$obj->msg = "you had ". number_format($obj->before, 0)." statistics records and removed ". number_format($obj->before-$obj->after, 0)." now you have ". number_format($obj->after, 0);
echo json_encode($obj);

View file

@ -1,23 +1,23 @@
CREATE TABLE IF NOT EXISTS `CachesInDB` (
`id` INT NOT NULL AUTO_INCREMENT,
`created` DATETIME NULL,
`modified` DATETIME NULL,
`content` BLOB NULL,
`domain` VARCHAR(255) NULL,
`ishttps` TINYINT NULL,
`loggedType` ENUM('n', 'l', 'a') NULL DEFAULT 'n' COMMENT 'n=not logged\nl=logged\na=admin',
`user_location` VARCHAR(255) NULL,
`expires` DATETIME NULL,
`timezone` VARCHAR(255) NULL,
`name` VARCHAR(500) NULL,
PRIMARY KEY (`id`),
INDEX `cacheds1` (`domain` ASC),
INDEX `caches2` (`ishttps` ASC),
INDEX `caches3` (`loggedType` ASC),
INDEX `caches4` (`user_location` ASC),
INDEX `caches5` (`created` ASC),
INDEX `caches6` (`modified` ASC),
INDEX `caches7` (`expires` ASC),
INDEX `caches8` (`timezone` ASC),
INDEX `caches9` (`name` ASC))
CREATE TABLE IF NOT EXISTS `CachesInDB` (
`id` INT NOT NULL AUTO_INCREMENT,
`created` DATETIME NULL,
`modified` DATETIME NULL,
`content` BLOB NULL,
`domain` VARCHAR(255) NULL,
`ishttps` TINYINT NULL,
`loggedType` ENUM('n', 'l', 'a') NULL DEFAULT 'n' COMMENT 'n=not logged\nl=logged\na=admin',
`user_location` VARCHAR(255) NULL,
`expires` DATETIME NULL,
`timezone` VARCHAR(255) NULL,
`name` VARCHAR(500) NULL,
PRIMARY KEY (`id`),
INDEX `cacheds1` (`domain` ASC),
INDEX `caches2` (`ishttps` ASC),
INDEX `caches3` (`loggedType` ASC),
INDEX `caches4` (`user_location` ASC),
INDEX `caches5` (`created` ASC),
INDEX `caches6` (`modified` ASC),
INDEX `caches7` (`expires` ASC),
INDEX `caches8` (`timezone` ASC),
INDEX `caches9` (`name` ASC))
ENGINE = InnoDB;

View file

@ -1,10 +1,10 @@
function deleteOldStatistics() {
modal.showPleaseWait();
$.ajax({
url: webSiteRootURL + 'plugin/Cache/deleteStatistics.json.php',
success: function (response) {
avideoResponse(response);
modal.hidePleaseWait();
}
});
function deleteOldStatistics() {
modal.showPleaseWait();
$.ajax({
url: webSiteRootURL + 'plugin/Cache/deleteStatistics.json.php',
success: function (response) {
avideoResponse(response);
modal.hidePleaseWait();
}
});
}

View file

@ -18,7 +18,7 @@
* For more information please check this https://github.com/WWBN/AVideo/wiki/Live-Plugin#control
*/
$streamerURL = "http://192.168.1.4/YouPHPTube/"; // change it to your streamer URL
$streamerURL = "http://192.168.0.2/YouPHPTube/"; // change it to your streamer URL
$record_path = "/var/www/tmp/"; //update this URL
$controlServer = "http://localhost:8080/";

View file

@ -1,6 +1,6 @@
<?php
$obj = AVideoPlugin::getObjectDataIfEnabled('MobileYPT');
$url = 'http://192.168.1.4/youphptube.com/mobile/qrcode/';
$url = 'http://192.168.0.2/youphptube.com/mobile/qrcode/';
$url = 'https://youphp.tube/mobile/qrcode/';
$url = addQueryStringParameter($url, 'site', $global['webSiteRootURL']);
$url = addQueryStringParameter($url, 'user', User::getUserName());

View file

@ -3,7 +3,7 @@ global $advancedCustom;
$crc = uniqid();
?>
<?php if ((empty($_POST['disableAddTo'])) && (( ($advancedCustom != false) && ($advancedCustom->disableShareAndPlaylist == false)) || ($advancedCustom == false))) { ?>
<a href="#" class="<?php echo $btnClass; ?>" id="addBtn<?php echo $videos_id . $crc; ?>" onclick="loadPlayLists('<?php echo $videos_id; ?>', '<?php echo $crc; ?>');" data-toggle="tooltip" title="<?php echo __("Add to"); ?>">
<a href="#" class="<?php echo $btnClass; ?>" id="addBtn<?php echo $videos_id . $crc; ?>" onclick="loadPlayLists('<?php echo $videos_id; ?>', '<?php echo $crc; ?>');return false;" data-toggle="tooltip" title="<?php echo __("Add to"); ?>">
<span class="fa fa-plus"></span>
<span class="hidden-sm hidden-xs"><?php echo __("Add to"); ?></span>
</a>

View file

@ -5,6 +5,10 @@ if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php';
}
if(!empty($_GET['current']) && $_GET['current'] > 1){
$global['doNOTOrganizeHTML'] = 1;
}
if (!empty($_GET['type'])) {
if ($_GET['type'] == 'audio') {
$_SESSION['type'] = 'audio';
@ -57,16 +61,17 @@ $metaDescription = __("Trending");
<a class="galleryLink col-sm-4 col-md-4 col-lg-4" videos_id="<?php echo $value['id']; ?>" href="<?php echo Video::getLink($value['id'], $value['clean_title']); ?>" title="<?php echo $value['title']; ?>">
<?php
$images = Video::getImageFromFilename($value['filename'], $value['type']);
$imgGif = $images->thumbsGif;
$poster = $images->thumbsJpg; ?>
$imgGif = $images->thumbsGif;
$poster = $images->thumbsJpg;
?>
<div class="aspectRatio16_9">
<img src="<?php echo $images->thumbsJpgSmall; ?>" data-src="<?php echo $poster; ?>" alt="<?php echo $value['title']; ?>" class="thumbsJPG img img-responsive <?php echo @$img_portrait; ?> rotate<?php echo $value['rotation']; ?> <?php echo ($poster != $images->thumbsJpgSmall) ? "blur" : ""; ?>" id="thumbsJPG<?php echo $value['id']; ?>" />
<?php
if (!empty($imgGif)) {
?>
<img src="<?php echo getCDN(); ?>view/img/loading-gif.png" data-src="<?php echo $imgGif; ?>" style="position: absolute; top: 0; display: none;" alt="<?php echo $value['title']; ?>" id="thumbsGIF<?php echo $value['id']; ?>" class="thumbsGIF img-responsive" height="196" />
<?php
} ?>
<?php }
?>
<span class="duration"><?php echo Video::getCleanDuration($value['duration']); ?></span>
</div>
<div class="progress" style="height: 3px; margin-bottom: 2px;">
@ -100,7 +105,8 @@ $metaDescription = __("Trending");
?><span class="label label-<?php echo $value2->type; ?>"><?php echo $value2->text; ?></span><?php
}
}
} ?>
}
?>
</div>
<?php
@ -112,11 +118,11 @@ $metaDescription = __("Trending");
<?php echo number_format_short($value['views_count']); ?> <?php echo __("Views"); ?>
</span>
</div>
<?php
} ?>
<?php }
?>
<div>
<i class="far fa-clock"></i>
<?php echo humanTiming(strtotime($value['videoCreation']), 0, true,true); ?>
<?php echo humanTiming(strtotime($value['videoCreation']), 0, true, true); ?>
</div>
<div>
<a href="<?php echo User::getChannelLink($value['users_id']); ?>">
@ -135,7 +141,8 @@ $metaDescription = __("Trending");
</div>
<?php
}
AVideoPlugin::getgalleryActionButton($value['id']); ?>
AVideoPlugin::getgalleryActionButton($value['id']);
?>
</div>
<div class="mainAreaDescriptionContainer col-lg-12">
<h4 class="mainAreaDescription" itemprop="description" style="max-height: 7vw; padding: 0; margin: 5px 0;"><?php echo $value['description']; ?></h4>
@ -154,34 +161,37 @@ $metaDescription = __("Trending");
<li class="page-item <?php
if ($_REQUEST['current'] == 1) {
echo "disabled";
} ?>">
}
?>">
<a class="page-link" href="<?php echo "{$global['webSiteRootURL']}trending?current=" . ($_REQUEST['current'] - 1); ?>" tabindex="-1"><?php echo __('Previous') ?></a>
</li>
<?php
$size = 5;
$i = 1;
$end = $pages;
$i = 1;
$end = $pages;
if ($_REQUEST['current'] - $size > $i) {
$i = $_REQUEST['current'] - $size;
}
if ($_REQUEST['current'] - $size > $i) {
$i = $_REQUEST['current'] - $size;
}
if ($_REQUEST['current'] + $size < $end) {
$end = $_REQUEST['current'] + $size;
}
if ($_REQUEST['current'] + $size < $end) {
$end = $_REQUEST['current'] + $size;
}
for (; $i <= $end; $i++) {
?>
for (; $i <= $end; $i++) {
?>
<li class="page-item <?php
if ($_REQUEST['current'] == $i) {
echo "active";
} ?>"><a class="page-link" href="<?php echo "{$global['webSiteRootURL']}trending?current={$i}"; ?>"><?php echo $i; ?></a></li>
<?php
} ?>
}
?>"><a class="page-link" href="<?php echo "{$global['webSiteRootURL']}trending?current={$i}"; ?>"><?php echo $i; ?></a></li>
<?php }
?>
<li class="page-item <?php
if ($_REQUEST['current'] == $pages) {
echo "disabled";
} ?>">
}
?>">
<a class="page-link" href="<?php echo "{$global['webSiteRootURL']}trending?current=" . ($_REQUEST['current'] + 1); ?>"><?php echo __('Next') ?></a>
</li>
</ul>