mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-06 03:50:04 +02:00
Disk Usage info
touch to activate the sound Filter plugins on plugins menu
This commit is contained in:
parent
79a3ef4c69
commit
a945aab467
6 changed files with 191 additions and 84 deletions
|
@ -251,7 +251,9 @@ Options All -Indexes
|
|||
|
||||
RewriteRule ^vast.xml/?([0-9]+)?$ plugin/AD_Server/VAST.php?campaign_has_videos_id=$1 [NC,L]
|
||||
|
||||
RewriteRule ^videos/([^!#$&'()*+,\/:;=?@[\]]+(\.(mp4|webm|m3u8|mp3|ogg)))$ view/xsendfile.php?file=$1 [QSA]
|
||||
<IfModule mod_xsendfile.c>
|
||||
RewriteRule ^videos/([^!#$&'()*+,\/:;=?@[\]]+(\.(mp4|webm|m3u8|mp3|ogg)))$ view/xsendfile.php?file=$1 [QSA]
|
||||
</IfModule>
|
||||
|
||||
# if image do not exists
|
||||
RewriteCond %{REQUEST_URI} \.(jpg|jpeg|gif|png|ico)$ [NC]
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
$AVideoMobileAPP_UA = "AVideoMobileApp";
|
||||
|
||||
function forbiddenWords($text) {
|
||||
global $global;
|
||||
if (empty($global['forbiddenWords'])) {
|
||||
|
@ -2191,7 +2192,7 @@ function isAVideoMobileApp() {
|
|||
if (empty($_SERVER["HTTP_USER_AGENT"])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return $AVideoMobileAPP_UA === $_SERVER["HTTP_USER_AGENT"];
|
||||
}
|
||||
|
||||
|
@ -3299,25 +3300,74 @@ function ogSite() {
|
|||
|
||||
function getDirSize($dir) {
|
||||
_error_log("getDirSize: start {$dir}");
|
||||
$command = "du -sb {$dir}";
|
||||
exec($command . " < /dev/null 2>&1", $output, $return_val);
|
||||
if ($return_val !== 0) {
|
||||
_error_log("getDirSize: ERROR ON Command {$command}");
|
||||
return 0;
|
||||
} else {
|
||||
if (!empty($output[0])) {
|
||||
preg_match("/^([0-9]+).*/", $output[0], $matches);
|
||||
}
|
||||
if (!empty($matches[1])) {
|
||||
_error_log("getDirSize: found {$matches[1]} from - {$output[0]}");
|
||||
return intval($matches[1]);
|
||||
}
|
||||
|
||||
_error_log("getDirSize: ERROR on pregmatch {$output[0]}");
|
||||
return 0;
|
||||
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
|
||||
return foldersize($dir);
|
||||
} else {
|
||||
|
||||
$command = "du -sb {$dir}";
|
||||
exec($command . " < /dev/null 2>&1", $output, $return_val);
|
||||
if ($return_val !== 0) {
|
||||
_error_log("getDirSize: ERROR ON Command {$command}");
|
||||
return 0;
|
||||
} else {
|
||||
if (!empty($output[0])) {
|
||||
preg_match("/^([0-9]+).*/", $output[0], $matches);
|
||||
}
|
||||
if (!empty($matches[1])) {
|
||||
_error_log("getDirSize: found {$matches[1]} from - {$output[0]}");
|
||||
return intval($matches[1]);
|
||||
}
|
||||
|
||||
_error_log("getDirSize: ERROR on pregmatch {$output[0]}");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function foldersize($path) {
|
||||
$total_size = 0;
|
||||
$files = scandir($path);
|
||||
$cleanPath = rtrim($path, '/') . '/';
|
||||
|
||||
foreach ($files as $t) {
|
||||
if ($t <> "." && $t <> "..") {
|
||||
$currentFile = $cleanPath . $t;
|
||||
if (is_dir($currentFile)) {
|
||||
$size = foldersize($currentFile);
|
||||
$total_size += $size;
|
||||
} else {
|
||||
$size = filesize($currentFile);
|
||||
$total_size += $size;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $total_size;
|
||||
}
|
||||
|
||||
function getDiskUsage() {
|
||||
global $global;
|
||||
$dir = "{$global['systemRootPath']}videos/";
|
||||
$obj = new stdClass();
|
||||
$obj->disk_free_space = disk_free_space($dir);
|
||||
$obj->disk_total_space = disk_total_space($dir);
|
||||
$obj->videos_dir = getDirSize($dir);
|
||||
$obj->disk_used = $obj->disk_total_space - $obj->disk_free_space;
|
||||
$obj->disk_used_by_other = $obj->disk_used - $obj->videos_dir;
|
||||
$obj->disk_free_space_human = humanFileSize($obj->disk_free_space);
|
||||
$obj->disk_total_space_human = humanFileSize($obj->disk_total_space);
|
||||
$obj->videos_dir_human = humanFileSize($obj->videos_dir);
|
||||
$obj->disk_used_human = humanFileSize($obj->disk_used);
|
||||
$obj->disk_used_by_other_human = humanFileSize($obj->disk_used_by_other);
|
||||
// percentage of disk used
|
||||
$obj->disk_used_percentage = sprintf('%.2f', ($obj->disk_used / $obj->disk_total_space) * 100);
|
||||
$obj->videos_dir_used_percentage = sprintf('%.2f', ($obj->videos_dir / $obj->disk_total_space) * 100);
|
||||
$obj->disk_free_space_percentage = sprintf('%.2f', ($obj->disk_free_space / $obj->disk_total_space) * 100);
|
||||
|
||||
return $obj;
|
||||
}
|
||||
|
||||
function unsetSearch() {
|
||||
unset($_GET['searchPhrase']);
|
||||
unset($_POST['searchPhrase']);
|
||||
|
@ -3600,8 +3650,8 @@ function ogSite() {
|
|||
} else if (isset($_GET['start']) && isset($_GET['length'])) { // for the bootgrid
|
||||
$start = intval($_GET['start']);
|
||||
$length = intval($_GET['length']);
|
||||
if(!empty($start) && !empty($length)){
|
||||
return floor($start/$length)+1;
|
||||
if (!empty($start) && !empty($length)) {
|
||||
return floor($start / $length) + 1;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
|
@ -4103,7 +4153,7 @@ function ogSite() {
|
|||
$end -= $rest;
|
||||
}
|
||||
}
|
||||
if($start<=0){
|
||||
if ($start <= 0) {
|
||||
$start = 1;
|
||||
}
|
||||
if ($page > 1) {
|
||||
|
@ -4130,7 +4180,7 @@ function ogSite() {
|
|||
return $pag;
|
||||
}
|
||||
|
||||
function getShareMenu($title, $permaLink, $URLFriendly, $embedURL, $class="row bgWhite list-group-item menusDiv") {
|
||||
function getShareMenu($title, $permaLink, $URLFriendly, $embedURL, $class = "row bgWhite list-group-item menusDiv") {
|
||||
global $global, $advancedCustom;
|
||||
$objSecure = AVideoPlugin::getObjectDataIfEnabled('SecureVideosDirectory');
|
||||
?>
|
||||
|
@ -4317,21 +4367,58 @@ function ogSite() {
|
|||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
function forbiddenPage($message, $logMessage=false){
|
||||
|
||||
function forbiddenPage($message, $logMessage = false) {
|
||||
global $global;
|
||||
$_REQUEST['403ErrorMsg'] = $message;
|
||||
if($logMessage){
|
||||
if ($logMessage) {
|
||||
_error_log($message);
|
||||
}
|
||||
include $global['systemRootPath'] . 'view/forbiddenPage.php';
|
||||
exit;
|
||||
}
|
||||
|
||||
function isForbidden(){
|
||||
|
||||
function isForbidden() {
|
||||
global $global;
|
||||
if(!empty($global['isForbidden'])){
|
||||
if (!empty($global['isForbidden'])) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function diskUsageBars() {
|
||||
ob_start();
|
||||
$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>";
|
||||
}
|
||||
|
||||
$contents = ob_get_contents();
|
||||
ob_end_clean();
|
||||
return $contents;
|
||||
}
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
<div class="list-group-item clear clearfix">
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="active"><a data-toggle="tab" href="#dashboard"><i class="fas fa-tachometer-alt"></i> <?php echo __("Dashboard"); ?></a></li>
|
||||
|
@ -10,6 +11,7 @@
|
|||
<div class="tab-content">
|
||||
<div id="dashboard" class="tab-pane fade in active" style="padding: 10px;">
|
||||
<?php
|
||||
echo diskUsageBars();
|
||||
include $global['systemRootPath'] . 'view/report0.php';
|
||||
?>
|
||||
</div>
|
||||
|
|
|
@ -571,8 +571,19 @@ function playerPlay(currentTime) {
|
|||
}
|
||||
});
|
||||
}
|
||||
$("#mainVideo .vjs-volume-panel").attr("data-toggle","tooltip");
|
||||
$("#mainVideo .vjs-volume-panel").attr("title","Click to activate the sound");
|
||||
$('#mainVideo .vjs-volume-panel[data-toggle="tooltip"]').tooltip('show');
|
||||
player.userActive(true);
|
||||
setTimeout(function () {
|
||||
player.userActive(true);
|
||||
}, 1000);
|
||||
setTimeout(function () {
|
||||
player.userActive(true);
|
||||
}, 1500);
|
||||
setTimeout(function () {
|
||||
$("#allowAutoplay").load(webSiteRootURL + "plugin/PlayerSkins/allowAutoplay/");
|
||||
player.userActive(true);
|
||||
}, 500);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -127,6 +127,9 @@
|
|||
?>
|
||||
</small>
|
||||
<?php
|
||||
if (User::isAdmin()) {
|
||||
echo diskUsageBars();
|
||||
}
|
||||
if (!empty($global['videoStorageLimitMinutes'])) {
|
||||
$secondsLimit = $global['videoStorageLimitMinutes'] * 60;
|
||||
if ($secondsLimit > $secondsTotal) {
|
||||
|
@ -657,45 +660,45 @@ if (empty($advancedCustom->disableHTMLDescription)) {
|
|||
?>
|
||||
<script type="text/javascript" src="<?php echo $global['webSiteRootURL']; ?>view/js/tinymce/tinymce.min.js"></script>
|
||||
<script>
|
||||
tinymce.init({
|
||||
selector: '#inputDescription', // change this value according to your HTML
|
||||
plugins: 'code print preview fullpage searchreplace autolink directionality visualblocks visualchars fullscreen image link media codesample table charmap hr pagebreak nonbreaking anchor toc insertdatetime advlist lists wordcount imagetools textpattern help ',
|
||||
//toolbar: 'fullscreen | formatselect | bold italic strikethrough forecolor backcolor permanentpen formatpainter | link image media pageembed | alignleft aligncenter alignright alignjustify | numlist bullist outdent indent | removeformat | addcomment',
|
||||
toolbar: 'fullscreen | formatselect | bold italic strikethrough | link image media pageembed | numlist bullist | removeformat | addcomment',
|
||||
height: 400,
|
||||
convert_urls: false,
|
||||
images_upload_handler: function (blobInfo, success, failure) {
|
||||
var xhr, formData;
|
||||
if (!videos_id) {
|
||||
$('#inputTitle').val("Article automatically booked");
|
||||
saveVideo(false);
|
||||
}
|
||||
xhr = new XMLHttpRequest();
|
||||
xhr.withCredentials = false;
|
||||
xhr.open('POST', '<?php echo $global['webSiteRootURL']; ?>objects/uploadArticleImage.php?video_id=' + videos_id);
|
||||
xhr.onload = function () {
|
||||
var json;
|
||||
if (xhr.status != 200) {
|
||||
failure('HTTP Error: ' + xhr.status);
|
||||
return;
|
||||
}
|
||||
|
||||
json = xhr.responseText;
|
||||
json = JSON.parse(json);
|
||||
if (json.error === false && json.url) {
|
||||
success(json.url);
|
||||
} else if (json.msg) {
|
||||
avideoAlert("<?php echo __("Sorry!"); ?>",json.msg, "error");
|
||||
} else {
|
||||
avideoAlert("<?php echo __("Error!"); ?>", "<?php echo __("Unknown Error!"); ?>", "error");
|
||||
}
|
||||
|
||||
};
|
||||
formData = new FormData();
|
||||
formData.append('file_data', blobInfo.blob(), blobInfo.filename());
|
||||
xhr.send(formData);
|
||||
tinymce.init({
|
||||
selector: '#inputDescription', // change this value according to your HTML
|
||||
plugins: 'code print preview fullpage searchreplace autolink directionality visualblocks visualchars fullscreen image link media codesample table charmap hr pagebreak nonbreaking anchor toc insertdatetime advlist lists wordcount imagetools textpattern help ',
|
||||
//toolbar: 'fullscreen | formatselect | bold italic strikethrough forecolor backcolor permanentpen formatpainter | link image media pageembed | alignleft aligncenter alignright alignjustify | numlist bullist outdent indent | removeformat | addcomment',
|
||||
toolbar: 'fullscreen | formatselect | bold italic strikethrough | link image media pageembed | numlist bullist | removeformat | addcomment',
|
||||
height: 400,
|
||||
convert_urls: false,
|
||||
images_upload_handler: function (blobInfo, success, failure) {
|
||||
var xhr, formData;
|
||||
if (!videos_id) {
|
||||
$('#inputTitle').val("Article automatically booked");
|
||||
saveVideo(false);
|
||||
}
|
||||
});
|
||||
xhr = new XMLHttpRequest();
|
||||
xhr.withCredentials = false;
|
||||
xhr.open('POST', '<?php echo $global['webSiteRootURL']; ?>objects/uploadArticleImage.php?video_id=' + videos_id);
|
||||
xhr.onload = function () {
|
||||
var json;
|
||||
if (xhr.status != 200) {
|
||||
failure('HTTP Error: ' + xhr.status);
|
||||
return;
|
||||
}
|
||||
|
||||
json = xhr.responseText;
|
||||
json = JSON.parse(json);
|
||||
if (json.error === false && json.url) {
|
||||
success(json.url);
|
||||
} else if (json.msg) {
|
||||
avideoAlert("<?php echo __("Sorry!"); ?>", json.msg, "error");
|
||||
} else {
|
||||
avideoAlert("<?php echo __("Error!"); ?>", "<?php echo __("Unknown Error!"); ?>", "error");
|
||||
}
|
||||
|
||||
};
|
||||
formData = new FormData();
|
||||
formData.append('file_data', blobInfo.blob(), blobInfo.filename());
|
||||
xhr.send(formData);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
@ -744,7 +747,7 @@ if (empty($advancedCustom->disableHTMLDescription)) {
|
|||
success: function (response) {
|
||||
modal.hidePleaseWait();
|
||||
if (!response.status) {
|
||||
avideoAlert("<?php echo __("Sorry!"); ?>",response.msg, "error");
|
||||
avideoAlert("<?php echo __("Sorry!"); ?>", response.msg, "error");
|
||||
} else {
|
||||
$("#grid").bootgrid('reload');
|
||||
}
|
||||
|
@ -761,7 +764,7 @@ if (empty($advancedCustom->disableHTMLDescription)) {
|
|||
success: function (response) {
|
||||
modal.hidePleaseWait();
|
||||
if (!response.status) {
|
||||
avideoAlert("<?php echo __("Sorry!"); ?>",response.msg, "error");
|
||||
avideoAlert("<?php echo __("Sorry!"); ?>", response.msg, "error");
|
||||
} else {
|
||||
$("#grid").bootgrid('reload');
|
||||
}
|
||||
|
@ -782,7 +785,7 @@ if (empty($advancedCustomUser->userCanNotChangeUserGroup) || User::isAdmin()) {
|
|||
success: function (response) {
|
||||
modal.hidePleaseWait();
|
||||
if (!response.status) {
|
||||
avideoAlert("<?php echo __("Sorry!"); ?>",response.msg, "error");
|
||||
avideoAlert("<?php echo __("Sorry!"); ?>", response.msg, "error");
|
||||
} else {
|
||||
$("#grid").bootgrid('reload');
|
||||
}
|
||||
|
@ -922,12 +925,12 @@ if (empty($advancedCustomUser->userCanNotChangeUserGroup) || User::isAdmin()) {
|
|||
<?php
|
||||
if (empty($advancedCustom->disableHTMLDescription)) {
|
||||
?>
|
||||
$('#inputDescription').val(row.descriptionHTML);
|
||||
tinymce.get('inputDescription').setContent(row.descriptionHTML);
|
||||
$('#inputDescription').val(row.descriptionHTML);
|
||||
tinymce.get('inputDescription').setContent(row.descriptionHTML);
|
||||
<?php
|
||||
}else{
|
||||
} else {
|
||||
?>
|
||||
$('#inputDescription').val(row.descriptionHTML);
|
||||
$('#inputDescription').val(row.descriptionHTML);
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
@ -1190,11 +1193,11 @@ if (empty($advancedCustom->disableHTMLDescription)) {
|
|||
$('#inputVideoId').val(response.videos_id);
|
||||
videos_id = response.videos_id;
|
||||
} else {
|
||||
if (response.error) {
|
||||
avideoAlert("<?php echo __("Sorry!"); ?>",response.error, "error");
|
||||
} else {
|
||||
avideoAlert("<?php echo __("Sorry!"); ?>", "<?php echo __("Your video has NOT been saved!"); ?>", "error");
|
||||
}
|
||||
if (response.error) {
|
||||
avideoAlert("<?php echo __("Sorry!"); ?>", response.error, "error");
|
||||
} else {
|
||||
avideoAlert("<?php echo __("Sorry!"); ?>", "<?php echo __("Your video has NOT been saved!"); ?>", "error");
|
||||
}
|
||||
}
|
||||
modal.hidePleaseWait();
|
||||
setTimeout(function () {
|
||||
|
@ -1458,7 +1461,7 @@ echo AVideoPlugin::getManagerVideosReset();
|
|||
},
|
||||
done: function (e, data) {
|
||||
if (data.result.error && data.result.msg) {
|
||||
avideoAlert("<?php echo __("Sorry!"); ?>",data.result.msg, "error");
|
||||
avideoAlert("<?php echo __("Sorry!"); ?>", data.result.msg, "error");
|
||||
data.context.addClass('error');
|
||||
data.context.find('p.action').text("Error");
|
||||
} else if (data.result.status === "error") {
|
||||
|
@ -1467,8 +1470,8 @@ echo AVideoPlugin::getManagerVideosReset();
|
|||
} else {
|
||||
msg = data.result.msg[data.result.msg.length - 1];
|
||||
}
|
||||
|
||||
avideoAlert("<?php echo __("Sorry!"); ?>",msg, "error");
|
||||
|
||||
avideoAlert("<?php echo __("Sorry!"); ?>", msg, "error");
|
||||
data.context.addClass('error');
|
||||
data.context.find('p.action').text("Error");
|
||||
} else {
|
||||
|
@ -2000,7 +2003,7 @@ if (AVideoPlugin::isEnabledByName('PlayLists')) {
|
|||
success: function (response) {
|
||||
modal.hidePleaseWait();
|
||||
if (response.error) {
|
||||
avideoAlert("<?php echo __("Sorry!"); ?>",response.error, "error");
|
||||
avideoAlert("<?php echo __("Sorry!"); ?>", response.error, "error");
|
||||
} else {
|
||||
$("#grid").bootgrid("reload");
|
||||
}
|
||||
|
@ -2018,9 +2021,9 @@ if (AVideoPlugin::isEnabledByName('PlayLists')) {
|
|||
success: function (response) {
|
||||
modal.hidePleaseWait();
|
||||
if (!response.success) {
|
||||
avideoAlert("<?php echo __("Sorry!"); ?>",response.error, "error");
|
||||
avideoAlert("<?php echo __("Sorry!"); ?>", response.error, "error");
|
||||
} else {
|
||||
avideoAlert("<?php echo __("Success!"); ?>",response.error, "success");
|
||||
avideoAlert("<?php echo __("Success!"); ?>", response.error, "success");
|
||||
$("#grid").bootgrid("reload");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,6 +51,8 @@ if (file_exists($path)) {
|
|||
header("Content-type: " . mime_content_type($path));
|
||||
header('Content-Length: ' . filesize($path));
|
||||
if (!empty($advancedCustom->doNotUseXsendFile)) {
|
||||
ini_set('memory_limit', filesize($path)*1.5);
|
||||
_error_log("Your XSEND File is not enabled, it may slowdown your site, file = $path", AVideoLog::$WARNING);
|
||||
//echo url_get_contents($path);
|
||||
// stream the file
|
||||
$fp = fopen($path, 'rb');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue