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

Show all in an iframe

This commit is contained in:
DanieL 2022-09-15 16:33:18 -03:00
parent 9bff738c71
commit 03a1ae4670
22 changed files with 1156 additions and 1091 deletions

View file

@ -114,6 +114,7 @@ Options All -Indexes
#main Files
RewriteRule ^index.php$ view/index.php [NC,L,QSA]
RewriteRule ^site/?$ view/firstPage.php [NC,L,QSA]
RewriteRule ^index.html$ %{ENV:proto}://%{HTTP_HOST} [L,R=301,NE]
RewriteRule ^index.htm$ %{ENV:proto}://%{HTTP_HOST} [L,R=301,NE]
#RewriteRule ^index.php$ /view/index.php [NC,L]
@ -156,18 +157,18 @@ Options All -Indexes
#for the video name
RewriteRule ^video/([0-9]+)/poster.png$ view/videoGetPoster.php?videos_id=$1 [QSA]
RewriteRule ^video/([0-9]+)/?$ view/?v=$1 [QSA]
RewriteRule ^video/([^!#$&'()*,\/:;=?@[\]]+)/?$ view/?videoName=$1 [QSA]
RewriteRule ^video/([^!#$&'()*,\/:;=?@[\]]+)/page/([0-9]+)/??$ view/?videoName=$1&page=$2 [QSA]
RewriteRule ^v/([0-9a-zA-Z_.-]+)/?$ view/?v=$1 [QSA]
RewriteRule ^v/([0-9a-zA-Z_.-]+)/page/([0-9]+)/??$ view/?v=$1&page=$2 [QSA]
RewriteRule ^video/([0-9a-zA-Z_.-]+)/([^!#$&'()*,\/:;=?@[\]]+)/?$ view/?v=$1 [QSA]
RewriteRule ^video/([0-9a-zA-Z_.-]+)/([^!#$&'()*,\/:;=?@[\]]+)/page/([0-9]+)/??$ view/?v=$1&page=$3 [QSA]
RewriteRule ^evideo/([a-zA-z0-9=]+)/?$ view/?evideo=$1 [QSA]
RewriteRule ^video/([0-9]+)/?$ view/modeYoutube.php?v=$1 [QSA]
RewriteRule ^video/([^!#$&'()*,\/:;=?@[\]]+)/?$ view/modeYoutube.php?videoName=$1 [QSA]
RewriteRule ^video/([^!#$&'()*,\/:;=?@[\]]+)/page/([0-9]+)/??$ view/modeYoutube.php?videoName=$1&page=$2 [QSA]
RewriteRule ^v/([0-9a-zA-Z_.-]+)/?$ view/modeYoutube.php?v=$1 [QSA]
RewriteRule ^v/([0-9a-zA-Z_.-]+)/page/([0-9]+)/??$ view/modeYoutube.php?v=$1&page=$2 [QSA]
RewriteRule ^video/([0-9a-zA-Z_.-]+)/([^!#$&'()*,\/:;=?@[\]]+)/?$ view/modeYoutube.php?v=$1 [QSA]
RewriteRule ^video/([0-9a-zA-Z_.-]+)/([^!#$&'()*,\/:;=?@[\]]+)/page/([0-9]+)/??$ view/modeYoutube.php?v=$1&page=$3 [QSA]
RewriteRule ^evideo/([a-zA-z0-9=]+)/?$ view/modeYoutube.php?evideo=$1 [QSA]
#for the video name
RewriteRule ^cat/([^!#$&'()*,\/:;=?@[\]]+)/video/([^!#$&'()*+,\/:;=?@[\]]+)/?$ view/?catName=$1&videoName=$2 [QSA]
RewriteRule ^cat/([^!#$&'()*,\/:;=?@[\]]+)/video/([^!#$&'()*+,\/:;=?@[\]]+)/page/([0-9]+)/?$ view/?catName=$1&videoName=$2&page=$3 [QSA]
RewriteRule ^cat/([^!#$&'()*,\/:;=?@[\]]+)/video/([^!#$&'()*+,\/:;=?@[\]]+)/?$ view/modeYoutube.php?catName=$1&videoName=$2 [QSA]
RewriteRule ^cat/([^!#$&'()*,\/:;=?@[\]]+)/video/([^!#$&'()*+,\/:;=?@[\]]+)/page/([0-9]+)/?$ view/modeYoutube.php?catName=$1&videoName=$2&page=$3 [QSA]
#for the embeded video name
RewriteRule ^videoEmbeded/([0-9a-zA-Z_.-]+)/? view/videoEmbeded.php?v=$1 [QSA]
RewriteRule ^videoEmbeded/([^!#$&'()*+,\/:;=?@[\]]+)/?$ view/videoEmbeded.php?videoName=$1 [QSA]
@ -185,10 +186,10 @@ Options All -Indexes
RewriteRule ^uploadPoster/([0-9]+)/(jpg|gif)$ objects/uploadPoster.php?video_id=$1&type=$2 [NC,L]
#for the Article name
RewriteRule ^article/([^!#$&'()*,\/:;=?@[\]]+)/?$ view/?videoName=$1 [QSA]
RewriteRule ^article/([^!#$&'()*,\/:;=?@[\]]+)/page/([0-9]+)/??$ view/?videoName=$1&page=$2 [QSA]
RewriteRule ^article/([0-9a-zA-Z_.-]+)/([^!#$&'()*,\/:;=?@[\]]+)/?$ view/?v=$1 [QSA]
RewriteRule ^article/([0-9a-zA-Z_.-]+)/([^!#$&'()*,\/:;=?@[\]]+)/page/([0-9]+)/??$ view/?v=$1&page=$3 [QSA]
RewriteRule ^article/([^!#$&'()*,\/:;=?@[\]]+)/?$ view/modeYoutube.php?videoName=$1 [QSA]
RewriteRule ^article/([^!#$&'()*,\/:;=?@[\]]+)/page/([0-9]+)/??$ view/modeYoutube.php?videoName=$1&page=$2 [QSA]
RewriteRule ^article/([0-9a-zA-Z_.-]+)/([^!#$&'()*,\/:;=?@[\]]+)/?$ view/modeYoutube.php?v=$1 [QSA]
RewriteRule ^article/([0-9a-zA-Z_.-]+)/([^!#$&'()*,\/:;=?@[\]]+)/page/([0-9]+)/??$ view/modeYoutube.php?v=$1&page=$3 [QSA]
#for the embeded article name
RewriteRule ^articleEmbed/([0-9a-zA-Z_.-]+)/? view/videoEmbeded.php?v=$1 [QSA]
@ -250,8 +251,8 @@ Options All -Indexes
RewriteRule ^playListsFromUser.json/([0-9]+)/?$ objects/playlistsFromUser.json.php?users_id=$1 [NC,L]
RewriteRule ^addNewPlayList$ objects/playlistAddNew.json.php [NC,L]
RewriteRule ^playListAddVideo.json$ objects/playListAddVideo.json.php [NC,L]
RewriteRule ^playlist/([0-9]+)/([0-9]+)/?$ view/?playlist_id=$1&playlist_index=$2 [NC,L]
RewriteRule ^playlist/([0-9]+)/?$ view/?playlist_id=$1 [NC,L]
RewriteRule ^playlist/([0-9]+)/([0-9]+)/?$ view/modeYoutube.php?playlist_id=$1&playlist_index=$2 [NC,L]
RewriteRule ^playlist/([0-9]+)/?$ view/modeYoutube.php?playlist_id=$1 [NC,L]
RewriteRule ^removeVideoFromPlaylist/?$ objects/playlistRemoveVideo.php [NC,L]
RewriteRule ^removePlaylist/?$ objects/playlistRemove.php [NC,L]
RewriteRule ^renamePlaylist/?$ objects/playlistRename.php [NC,L]
@ -268,11 +269,11 @@ Options All -Indexes
#playlist alias
RewriteRule ^programs.json$ objects/playlists.json.php [QSA]
RewriteRule ^program/([0-9]+)/([0-9]+)(/.*)?$ view/?playlist_id=$1&playlist_index=$2 [QSA]
RewriteRule ^program/([0-9]+)(/.*)?$ view/?playlist_id=$1 [QSA]
RewriteRule ^program/([0-9]+)/([0-9]+)(/.*)?$ view/modeYoutube.php?playlist_id=$1&playlist_index=$2 [QSA]
RewriteRule ^program/([0-9]+)(/.*)?$ view/modeYoutube.php?playlist_id=$1 [QSA]
RewriteRule ^viewProgram/([0-9]+).*?$ view/channelProgram.php?program_id=$1 [QSA]
RewriteRule ^favorite/?$ view/?playlist_name=favorite [QSA]
RewriteRule ^watch-later/?$ view/?playlist_name=watch-later [QSA]
RewriteRule ^favorite/?$ view/modeYoutube.php?playlist_name=favorite [QSA]
RewriteRule ^watch-later/?$ view/modeYoutube.php?playlist_name=watch-later [QSA]
#manager videos
RewriteRule ^orphanFiles$ view/orphanFiles.php [NC,L]

View file

@ -31,7 +31,7 @@ require_once '../locale/function.php';
<span class="glyphicon glyphicon-ok-circle"></span>
Your system is installed, remove the <code><?php echo $global['systemRootPath']; ?>install</code> directory to continue
<hr>
<a href="<?php echo $global['webSiteRootURL']; ?>" class="btn btn-success btn-lg center-block">Go to the main page</a>
<a href="<?php echo getHomePageURL(); ?>" class="btn btn-success btn-lg center-block">Go to the main page</a>
</h3>
</div>
<?php

View file

@ -44,13 +44,6 @@ $video_id = $video->save();
$video = new Video("", "", $video_id);
if ($video->getType() == 'audio' && AVideoPlugin::isEnabledByName('MP4ThumbsAndGif')) {
$videoFileName = $video->getFilename();
MP4ThumbsAndGif::getImage($videoFileName, 'jpg', $video_id);
Video::deleteThumbs($videoFileName);
Video::deleteGifAndWebp($videoFileName);
}
$obj->error = false;
$obj->video_id = $video_id;
Video::updateFilesize($video_id);

View file

@ -1642,6 +1642,30 @@ function getimgsize($file_src) {
return $size;
}
function getImageFormat($file) {
$extension = strtolower(pathinfo($file, PATHINFO_EXTENSION));
if ($extension === 'jpg') {
$format = 'jpeg';
} else {
$size = getimgsize($file);
if ($size === false) {
return false;
}
if (empty($size['mime']) || $size['mime'] == 'image/pjpeg') {
$size['mime'] = 'image/jpeg';
}
//var_dump($file_src, $size);exit;
$format = strtolower(substr($size['mime'], strpos($size['mime'], '/') + 1));
$extension = $format;
if (empty($format)) {
$format = 'jpeg';
$extension = 'jpg';
}
}
return array('format' => $format, 'extension' => $extension);
}
function im_resize($file_src, $file_dest, $wd, $hd, $q = 80) {
if (empty($file_dest)) {
return false;
@ -1655,26 +1679,9 @@ function im_resize($file_src, $file_dest, $wd, $hd, $q = 80) {
_error_log("im_resize: Source not found: {$file_src}");
return false;
}
$size = getimgsize($file_src);
if ($size === false) {
_error_log("im_resize: Could not get image size: {$file_src}");
return false;
}
if (empty($size['mime']) || $size['mime'] == 'image/pjpeg') {
$size['mime'] = 'image/jpeg';
}
$format = strtolower(substr($size['mime'], strpos($size['mime'], '/') + 1));
if (empty($format)) {
$format = 'jpeg';
}
$destformat = strtolower(substr($file_dest, -4));
if (empty($destformat)) {
_error_log("destformat not found {$file_dest}");
$destformat = ".jpg";
}
$icfunc = "imagecreatefrom" . $format;
$format = getImageFormat($file_src);
$destformat = strtolower(pathinfo($file_dest, PATHINFO_EXTENSION));
$icfunc = "imagecreatefrom" . $format['format'];
if (!function_exists($icfunc)) {
_error_log("im_resize: Function does not exists: {$icfunc}");
return false;
@ -1688,6 +1695,7 @@ function im_resize($file_src, $file_dest, $wd, $hd, $q = 80) {
return false;
}
try {
//var_dump($file_src, $icfunc);
$src = $icfunc($file_src);
} catch (Exception $exc) {
_error_log("im_resize: ($file_src) " . $exc->getMessage());
@ -1745,12 +1753,14 @@ function im_resize($file_src, $file_dest, $wd, $hd, $q = 80) {
imagecopyresampled($dest, $src, 0, 0, ($ws - $wc) / 2, ($hs - $hc) / 2, $wd, $hd, $wc, $hc);
$saved = false;
if ($destformat == '.png') {
if ($destformat == 'png') {
$saved = imagepng($dest, $file_dest);
}
if ($destformat == '.jpg') {
}else if ($destformat == 'jpg') {
$saved = imagejpeg($dest, $file_dest, $q);
}else if ($destformat == 'webp') {
$saved = imagewebp($dest, $file_dest, $q);
}else if ($destformat == 'gif') {
$saved = imagegif($dest, $file_dest);
}
if (!$saved) {
@ -3146,7 +3156,7 @@ function isSameDomainAsMyAVideo($url) {
return isSameDomain($url, $global['webSiteRootURL']) || isSameDomain($url, getCDN());
}
function getRefferOrOrigin(){
function getRefferOrOrigin() {
$url = '';
if (!empty($_SERVER['HTTP_REFERER'])) {
$url = $_SERVER['HTTP_REFERER'];
@ -5571,16 +5581,16 @@ function getCurrentPage() {
return 1;
}
function getTrendingLimit(){
function getTrendingLimit() {
global $advancedCustom;
if(empty($advancedCustom)){
if (empty($advancedCustom)) {
$advancedCustom = AVideoPlugin::getObjectData("CustomizeAdvanced");
}
$daysLimit = intval($advancedCustom->trendingOnLastDays->value);
return $daysLimit;
}
function getTrendingLimitDate(){
function getTrendingLimitDate() {
$daysLimit = getTrendingLimit();
$dateDaysLimit = date('Y-m-d H:i:s', strtotime("-{$daysLimit} days"));
return $dateDaysLimit;
@ -6389,7 +6399,7 @@ function forbiddenPage($message = '', $logMessage = false, $unlockPassword = '',
break;
}
}
header('HTTP/1.0 '.$pageCode);
header('HTTP/1.0 ' . $pageCode);
if (empty($unlockPassword) && preg_match('/json/i', $contentType)) {
header("Content-Type: application/json");
$obj = new stdClass();
@ -6398,10 +6408,10 @@ function forbiddenPage($message = '', $logMessage = false, $unlockPassword = '',
$obj->forbiddenPage = true;
die(json_encode($obj));
} else {
if(empty($unlockPassword) && !User::isLogged()){
$message .= ', '.__('please login');
if (empty($unlockPassword) && !User::isLogged()) {
$message .= ', ' . __('please login');
gotToLoginAndComeBackHere($message);
}else{
} else {
header("Content-Type: text/html");
include $global['systemRootPath'] . 'view/forbiddenPage.php';
}
@ -6719,9 +6729,9 @@ function showAlertMessage() {
}
_session_start();
unset($_SESSION['YPTalertMessage']);
}else{
} else {
if (!requestComesFromSafePlace()) {
echo PHP_EOL, "/** showAlertMessage !requestComesFromSafePlace [".getRefferOrOrigin()."] **/";
echo PHP_EOL, "/** showAlertMessage !requestComesFromSafePlace [" . getRefferOrOrigin() . "] **/";
return false;
}
}
@ -7469,11 +7479,11 @@ function sendSocketMessage($msg, $callbackJSFunction = "", $users_id = "-1", $se
try {
$obj = YPTSocket::send($msg, $callbackJSFunction, $users_id, $send_to_uri_pattern);
} catch (Exception $exc) {
if($try<3){
if ($try < 3) {
sleep(1);
_error_log("sendSocketMessage try agaion [$try]" . $exc->getMessage());
$obj = sendSocketMessage($msg, $callbackJSFunction, $users_id, $send_to_uri_pattern, $try+1);
}else{
$obj = sendSocketMessage($msg, $callbackJSFunction, $users_id, $send_to_uri_pattern, $try + 1);
} else {
$obj = new stdClass();
$obj->error = true;
$obj->msg = $exc->getMessage();
@ -9598,17 +9608,21 @@ function setDefaultSort($defaultSortColumn, $defaultSortOrder) {
}
}
function getWordOrIcon($word, $class=''){
function getWordOrIcon($word, $class = '') {
$word = trim($word);
if(preg_match('/facebook/i', $word)){
return '<i class="fab fa-facebook '.$class.'" data-toggle="tooltip" title="'.$word.'"></i>';
if (preg_match('/facebook/i', $word)) {
return '<i class="fab fa-facebook ' . $class . '" data-toggle="tooltip" title="' . $word . '"></i>';
}
if(preg_match('/youtube|youtu.be/i', $word)){
return '<i class="fab fa-youtube '.$class.'" data-toggle="tooltip" title="'.$word.'"></i>';
if (preg_match('/youtube|youtu.be/i', $word)) {
return '<i class="fab fa-youtube ' . $class . '" data-toggle="tooltip" title="' . $word . '"></i>';
}
if(preg_match('/twitch/i', $word)){
return '<i class="fab fa-twitch '.$class.'" data-toggle="tooltip" title="'.$word.'"></i>';
if (preg_match('/twitch/i', $word)) {
return '<i class="fab fa-twitch ' . $class . '" data-toggle="tooltip" title="' . $word . '"></i>';
}
return $word;
}
function getHomePageURL() {
global $global;
return "{$global['webSiteRootURL']}site/";
}

View file

@ -651,7 +651,7 @@ class CDNStorage {
}else{
$bytesPerSecond = 0;
}
$mbps = humanFileSize($bytesPerSecond).'s';
$mbps = humanFileSize($bytesPerSecond).'ps';
$totalBytesTransferred += $thisFilesize;
$remainingFiles = $total-$count;
$eta = $remainingFiles*$seconds;

View file

@ -79,7 +79,7 @@ $ogURL = Video::getLinkToVideo($video['id'], $video['clean_title'], false,false)
<div class="modal-footer" >
<a href="<?php echo $_SERVER['REQUEST_URI'],strpos($_SERVER['REQUEST_URI'], "?")===false?"?":"&"; ?>rrating=1" class="btn btn-success pull-right"><i class="fas fa-check-circle"></i> <?php echo __("Confirm"); ?></a>
<a href="<?php echo $global['webSiteRootURL']; ?>" class="btn btn-danger pull-right"><i class="fas fa-times-circle"></i> <?php echo __("Cancel"); ?></a>
<a href="<?php echo getHomePageURL(); ?>" class="btn btn-danger pull-right"><i class="fas fa-times-circle"></i> <?php echo __("Cancel"); ?></a>
</div>
</div>

View file

@ -91,7 +91,7 @@ $ogURL = Video::getLinkToVideo($video['id'], $video['clean_title'], false,false)
<button type="submit" class="btn btn-success btn-block"><i class="fas fa-check-circle"></i> <?php echo __("Confirm"); ?></button>
</div>
<div class="col-md-6">
<a href="<?php echo $global['webSiteRootURL']; ?>" class="btn btn-danger btn-block"><i class="fas fa-times-circle"></i> <?php echo __("Cancel"); ?></a>
<a href="<?php echo getHomePageURL(); ?>" class="btn btn-danger btn-block"><i class="fas fa-times-circle"></i> <?php echo __("Cancel"); ?></a>
</div>
</div>
</form>

View file

@ -167,13 +167,9 @@ class Gallery extends PluginAbstract {
public function getFirstPage() {
global $global;
if (!AVideoPlugin::isEnabledByName("YouPHPFlix2")) {
if(false && empty($_REQUEST['inMainIframe']) && !inIframe()){
return $global['systemRootPath'] . 'plugin/Gallery/view/modeGalleryIframe.php';
}else{
return $global['systemRootPath'] . 'plugin/Gallery/view/modeGallery.php';
}
}
}
public function getFooterCode() {
$obj = $this->getDataObject();

View file

@ -246,6 +246,6 @@ if ($obj->BigVideo && empty($_GET['showOnly'])) {
<?php
} else if (!empty($_GET['showOnly'])) {
?>
<a href="<?php echo $global['webSiteRootURL']; ?>" class="btn btn-default"><i class="fa fa-arrow-left"></i> <?php echo __("Go Back"); ?></a>
<a href="<?php echo getHomePageURL(); ?>" class="btn btn-default"><i class="fa fa-arrow-left"></i> <?php echo __("Go Back"); ?></a>
<?php
}

View file

@ -1,176 +0,0 @@
<?php
//var_dump($_SERVER);exit;
$configFile = dirname(__FILE__) . '/../../../videos/configuration.php';
$doNotIncludeConfig = 1;
require_once $configFile;
$uuid = uniqid();
?><!DOCTYPE html>
<html>
<head>
<script>
function isASubIFrame() {
return document.location.ancestorOrigins.length > 0 && whoAmI() !== parent.whoAmI() && window.parent !== window.top;
}
if (isASubIFrame()) {
console.log('isASubIFrame', window.parent.document.location, document.location);
window.parent.document.location = document.location;
}
</script>
<title>Loading...</title>
<link rel="shortcut icon" href="<?php echo $global['webSiteRootURL']; ?>videos/favicon.ico" sizes="16x16,24x24,32x32,48x48,144x144">
<link href="<?php echo $global['webSiteRootURL']; ?>node_modules/jquery-ui-dist/jquery-ui.min.css" rel="stylesheet" type="text/css"/>
<style>
html{
overflow: auto;
}
html, body, iframe {
margin: 0px;
padding: 0px;
height: 100%;
border: none;
}
html, body, iframe, .ui-dialog .ui-dialog-content {
margin: 0px !important;
padding: 0px !important;
}
.ui-dialog{
box-shadow: 2px 2px 15px black;
}
iframe{
display: block;
width: 100%;
border: none;
overflow-y: auto;
overflow-x: hidden;
/*border: 4px solid green;
margin: 5px;*/
}
</style>
</head>
<body>
<iframe
frameborder="0"
marginheight="0"
marginwidth="0"
width="100%"
height="100%"
scrolling="auto"
src="<?php echo $global['webSiteRootURL']; ?>?inMainIframe=1" id="mainIframe"></iframe>
<script src="<?php echo $global['webSiteRootURL']; ?>node_modules/jquery/dist/jquery.min.js"></script>
<script src="<?php echo $global['webSiteRootURL']; ?>node_modules/jquery-ui-dist/jquery-ui.min.js" type="text/javascript"></script>
<script src="<?php echo $global['webSiteRootURL']; ?>view/js/jquery-dialogextend/build/jquery.dialogextend.min.js" type="text/javascript"></script>
<script src="<?php echo $global['webSiteRootURL']; ?>node_modules/sweetalert/dist/sweetalert.min.js" type="text/javascript"></script>
<script src="<?php echo $global['webSiteRootURL']; ?>node_modules/js-cookie/dist/js.cookie.js" type="text/javascript"></script>
<script src="<?php echo $global['webSiteRootURL']; ?>node_modules/jquery-toast-plugin/dist/jquery.toast.min.js" type="text/javascript"></script>
<script src="<?php echo $global['webSiteRootURL']; ?>view/js/script.js" type="text/javascript"></script>
<script>
var uuid = '<?php echo $uuid; ?>';
function whoAmI() {
return uuid;
}
function iframeURLChange(iframe, callback) {
var unloadHandler = function () {
// Timeout needed because the URL changes immediately after
// the `unload` event is dispatched.
setTimeout(function () {
console.log('iframe 1', iframe);
callback(iframe.contentWindow.location.href, iframe.contentDocument.title);
}, 1000);
};
function attachUnload() {
// Remove the unloadHandler in case it was already attached.
// Otherwise, the change will be dispatched twice.
iframe.contentWindow.removeEventListener("unload", unloadHandler);
iframe.contentWindow.addEventListener("unload", unloadHandler);
}
iframe.addEventListener("load", attachUnload);
attachUnload();
}
iframeURLChange(document.getElementById("mainIframe"), function (src, title) {
console.log("URL changed 1:", src, title);
document.title = title;
window.history.pushState("", "", src.replace('?inMainIframe=1', ''));
});
var windowCount = 0;
function openWindow(url, iframeAllowAttributes, title) {
var id = 'window' + windowCount;
windowCount++;
var html = '<div id="' + id + '" title="' + title + '">';
html += '<iframe id="avideoWindowIframe' + id + '" frameBorder="0" class="animate__animated animate__bounceInDown" src="' + url + '" ' + iframeAllowAttributes + ' ></iframe>';
html += '</div>';
$('body').append(html);
$('#' + id).dialog({
draggable: true,
autoOpen: true,
modal: false,
responsive: true,
width: 800,
height: 600,
minHeight: 300,
minWidth: 300,
close: function (event, ui) {
$(this).remove();
}
}).dialogExtend({
"closable": true,
"maximizable": true,
"minimizable": true,
"collapsable": true,
"dblclick": "collapse",
"titlebar": "transparent",
"minimizeLocation": "right",
"icons": {
"close": "ui-icon-circle-close",
"maximize": "ui-icon-circle-plus",
"minimize": "ui-icon-circle-minus",
"collapse": "ui-icon-triangle-1-s",
"restore": "ui-icon-bullet"
}
});
function iframeURLChange2(iframe, selector, callback) {
var unloadHandler = function () {
// Timeout needed because the URL changes immediately after
// the `unload` event is dispatched.
setTimeout(function () {
//console.log('iframe 1', iframe);
if(iframe.contentDocument){
callback(selector, iframe.contentDocument.title);
}
}, 1000);
};
function attachUnload() {
// Remove the unloadHandler in case it was already attached.
// Otherwise, the change will be dispatched twice.
iframe.contentWindow.removeEventListener("unload", unloadHandler);
iframe.contentWindow.addEventListener("unload", unloadHandler);
}
iframe.addEventListener("load", attachUnload);
attachUnload();
}
iframeURLChange2(document.getElementById('avideoWindowIframe' + id), '#' + id, function (selector, title) {
$(selector).dialog('option', 'title', title);
});
//addButtons($("." + id));
}
$(document).ready(function () {
//$("#window").draggable({handle: ".panel-heading", containment: "body"});
//$("#window").resizable();
});
</script>
</body>
</html>

View file

@ -105,7 +105,7 @@ $global['ignoreChat2'] = 1;
<button type="submit" class="btn btn-success btn-block"><i class="fas fa-check-circle"></i> <?php echo __("Confirm"); ?></button>
</div>
<div class="col-md-6">
<a href="<?php echo $global['webSiteRootURL']; ?>" class="btn btn-danger btn-block"><i class="fas fa-times-circle"></i> <?php echo __("Cancel"); ?></a>
<a href="<?php echo getHomePageURL(); ?>" class="btn btn-danger btn-block"><i class="fas fa-times-circle"></i> <?php echo __("Cancel"); ?></a>
</div>
</div>
</form>

View file

@ -80,7 +80,7 @@ $photo = User::getPhoto($meet->getUsers_id());
<button type="submit" class="btn btn-success btn-block"><i class="fas fa-check-circle"></i> <?php echo __("Confirm"); ?></button>
</div>
<div class="col-md-6">
<a href="<?php echo $global['webSiteRootURL']; ?>" class="btn btn-danger btn-block"><i class="fas fa-times-circle"></i> <?php echo __("Cancel"); ?></a>
<a href="<?php echo getHomePageURL(); ?>" class="btn btn-danger btn-block"><i class="fas fa-times-circle"></i> <?php echo __("Cancel"); ?></a>
</div>
</div>
</form>

View file

@ -73,7 +73,7 @@ if ($obj->BigVideo && empty($_GET['showOnly'])) {
}
} else if (!empty($_GET['showOnly'])) {
?>
<a href="<?php echo $global['webSiteRootURL']; ?>" class="btn btn-default"><i class="fa fa-arrow-left"></i> <?php echo __("Go Back"); ?></a>
<a href="<?php echo getHomePageURL(); ?>" class="btn btn-default"><i class="fa fa-arrow-left"></i> <?php echo __("Go Back"); ?></a>
<?php
} else {
$ads1 = getAdsLeaderBoardTop();

View file

@ -38,7 +38,7 @@ $metaDescription = " Contact Form";
<h2><?php echo __("Your message has been sent!"); ?></h2>
</div>
</div>
<a class="btn btn-success btn-block" href="<?php echo $global['webSiteRootURL']; ?>"><?php echo __("Go back to the main page"); ?></a>
<a class="btn btn-success btn-block" href="<?php echo getHomePageURL(); ?>"><?php echo __("Go back to the main page"); ?></a>
</div>
<form class="well form-horizontal" action=" " method="post" id="contact_form">
<input type="hidden" name="contactForm" value="1"/>

View file

@ -510,7 +510,7 @@ header("HTTP/1.0 404 Not Found");
</div>
<div id="navigation">
<a class="navigation" href="<?php echo $global['webSiteRootURL']; ?>"><?php echo __("Home"); ?></a>
<a class="navigation" href="<?php echo getHomePageURL(); ?>"><?php echo __("Home"); ?></a>
<a class="navigation" href="<?php echo $global['webSiteRootURL']; ?>about"><?php echo __("About Us"); ?></a>
<a class="navigation" href="<?php echo $global['webSiteRootURL']; ?>sitemap.xml"><?php echo __("Site Map"); ?></a>
<a class="navigation" href="<?php echo $global['webSiteRootURL']; ?>contact"><?php echo __("Contact"); ?></a>

58
view/firstPage.php Normal file
View file

@ -0,0 +1,58 @@
<?php
if (version_compare(PHP_VERSION, '7.2') < 0) {
$msg = [];
$msg[] = 'You are runing PHP version: '.PHP_VERSION;
$msg[] = 'Please Update your PHP version to 7.2 or above. (7.3 is recommended)';
$msg[] = '<h5>For Ubuntu 16</h5>sudo add-apt-repository ppa:jczaplicki/xenial-php74-temp';
$msg[] = 'sudo apt-get update && sudo apt-get upgrade';
$msg[] = 'sudo apt-get install php7.4 libapache2-mod-php7.4 php7.4-mysql php7.4-curl php7.4-gd php7.4-intl php7.4-zip php7.4-xml -y';
$msg[] = 'sudo update-alternatives --set php /usr/bin/php7.4 && sudo a2dismod php7.0 && sudo a2enmod php7.4';
//$msg[] = 'sudo apt-get install php8.1 libapache2-mod-php8.1 php8.1-mysql php8.1-curl php8.1-gd php8.1-intl php8.1-zip php8.1-xml -y';
//$msg[] = ' $msg[] = 'sudo update-alternatives --set php /usr/bin/php8.1 && sudo a2dismod php7.4 && sudo a2enmod php8.1';
$msg[] = 'sudo /etc/init.d/apache2 restart';
die(implode('<br>', $msg));
}
global $global, $config;
$configFile = '../videos/configuration.php';
if (!isset($global['systemRootPath'])) {
if (!file_exists($configFile)) {
if (!file_exists('../install/index.php')) {
forbiddenPage("No Configuration and no Installation");
}
header("Location: install/index.php");
exit;
} else {
require_once '../videos/configuration.php';
}
}
if (!empty($global['systemRootPath']) && empty($config)) {
// update config file for version 2.8
$txt = 'require_once $global[\'systemRootPath\'].\'objects/include_config.php\';';
$myfile = file_put_contents($configFile, $txt . PHP_EOL, FILE_APPEND | LOCK_EX);
require_once $global['systemRootPath'].'objects/include_config.php';
} elseif (empty($global['systemRootPath'])) {
die("Error to find systemRootPath = ({$global['systemRootPath']})");
error_log(json_encode($global));
}
if (!empty($_GET['playlist_name']) && empty($_GET['playlist_id'])) {
if ($_GET['playlist_name'] == "favorite") {
$_GET['playlist_id'] = 'favorite';
} else {
$_GET['playlist_id'] = 'watch-later';
}
}
require_once $global['systemRootPath'].'plugin/AVideoPlugin.php';
$firstPage = AVideoPlugin::getFirstPage();
require $firstPage;
/*
if (empty($firstPage) || !empty($_GET['videoName']) || !empty($_GET['v']) || !empty($_GET['playlist_id']) || !empty($_GET['liveVideoName']) || !empty($_GET['evideo'])) {
require $global['systemRootPath'].'view/modeYoutube.php';
} else {
require $firstPage;
}
*
*/
include $global['systemRootPath'].'objects/include_end.php';

View file

@ -18,15 +18,14 @@ if (empty($advancedCustom->openEncoderInIFrame) || !isSameDomainAsMyAVideo($conf
}
if (empty($advancedCustom->doNotShowEncoderButton)) {
if (!empty($config->getEncoderURL())) {
$params = new stdClass();
$params->webSiteRootURL = $global['webSiteRootURL'];
$params->user = User::getUserName();
$params->pass = User::getUserPass();
?>
<li>
<form id="formEncoder" method="post" action="<?php echo $config->getEncoderURL(); ?>" target="encoder" autocomplete="off" >
<input type="hidden" name="webSiteRootURL" value="<?php echo $global['webSiteRootURL']; ?>" autocomplete="off" />
<input type="hidden" name="user" value="<?php echo User::getUserName(); ?>" autocomplete="off" />
<input type="hidden" name="pass" value="<?php echo User::getUserPass(); ?>" autocomplete="off" />
</form>
<a href="#" onclick="$('#formEncoder').submit();
return false;" data-toggle="tooltip" title="<?php echo __("Upload a file or download it from the Internet"); ?>" data-placement="left"
<a href="#" onclick='avideoDialogWithPost("<?php echo $config->getEncoderURL(); ?>", <?php echo json_encode($params); ?>);return false;' data-toggle="tooltip" title="<?php echo __("Upload a file or download it from the Internet"); ?>" data-placement="left"
class="faa-parent animated-hover" >
<span class="fas fa-cog faa-spin"></span> <?php echo empty($advancedCustom->encoderButtonLabel) ? __("Encode video and audio") : __($advancedCustom->encoderButtonLabel); ?>
</a>

View file

@ -17,7 +17,7 @@
?>
</li>
<li style="width: 100%; text-align: center;">
<a class="navbar-brand" id="mainNavbarLogo" href="<?php echo empty($advancedCustom->logoMenuBarURL) ? $global['webSiteRootURL'] : $advancedCustom->logoMenuBarURL; ?>" >
<a class="navbar-brand" id="mainNavbarLogo" href="<?php echo empty($advancedCustom->logoMenuBarURL) ? getHomePageURL() : $advancedCustom->logoMenuBarURL; ?>" >
<img src="<?php echo getURL($config->getLogo()); ?>" alt="<?php echo $config->getWebSiteTitle(); ?>" class="img-responsive " width="250" height="70">
<?php
if(isFirstPage()){

View file

@ -8,7 +8,7 @@
<li>
<div>
<a href="<?php echo $global['webSiteRootURL']; ?>" class="btn btn-primary btn-block " style="border-radius: 4px 4px 0 0;">
<a href="<?php echo getHomePageURL(); ?>" class="btn btn-primary btn-block " style="border-radius: 4px 4px 0 0;">
<span class="fa fa-home"></span>
<?php echo __("Home"); ?>
</a>

View file

@ -1,54 +1,228 @@
<?php
if (version_compare(PHP_VERSION, '7.2') < 0) {
$msg = [];
$msg[] = 'You are runing PHP version: '.PHP_VERSION;
$msg[] = 'Please Update your PHP version to 7.2 or above. (7.3 is recommended)';
$msg[] = '<h5>For Ubuntu 16</h5>sudo add-apt-repository ppa:jczaplicki/xenial-php74-temp';
$msg[] = 'sudo apt-get update && sudo apt-get upgrade';
$msg[] = 'sudo apt-get install php7.4 libapache2-mod-php7.4 php7.4-mysql php7.4-curl php7.4-gd php7.4-intl php7.4-zip php7.4-xml -y';
$msg[] = 'sudo update-alternatives --set php /usr/bin/php7.4 && sudo a2dismod php7.0 && sudo a2enmod php7.4';
//$msg[] = 'sudo apt-get install php8.1 libapache2-mod-php8.1 php8.1-mysql php8.1-curl php8.1-gd php8.1-intl php8.1-zip php8.1-xml -y';
//$msg[] = ' $msg[] = 'sudo update-alternatives --set php /usr/bin/php8.1 && sudo a2dismod php7.4 && sudo a2enmod php8.1';
$msg[] = 'sudo /etc/init.d/apache2 restart';
die(implode('<br>', $msg));
}
include dirname(__FILE__) . '/../view/firstPage.php';exit;
global $global, $config;
$configFile = '../videos/configuration.php';
if (!isset($global['systemRootPath'])) {
if (!file_exists($configFile)) {
if (!file_exists('../install/index.php')) {
forbiddenPage("No Configuration and no Installation");
}
header("Location: install/index.php");
//var_dump($_SERVER);exit;
$configFile = dirname(__FILE__) . '/../videos/configuration.php';
$doNotIncludeConfig = 1;
require_once $configFile;
require_once "{$global['systemRootPath']}objects/functions.php";
if (isIframe()) {
include "{$global['systemRootPath']}view/firstPage.php";
exit;
} else {
require_once '../videos/configuration.php';
}
//var_dump($_SERVER);exit;
?><!DOCTYPE html>
<html>
<head>
<script>
var webSiteRootURL = '<?php echo $global['webSiteRootURL']; ?>';
</script>
<title>Loading...</title>
<link rel="shortcut icon" href="<?php echo $global['webSiteRootURL']; ?>videos/favicon.ico" sizes="16x16,24x24,32x32,48x48,144x144">
<link href="<?php echo $global['webSiteRootURL']; ?>node_modules/jquery-ui-dist/jquery-ui.min.css" rel="stylesheet" type="text/css"/>
<link href="<?php echo $global['webSiteRootURL']; ?>node_modules/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css"/>
<style>
html{
overflow: auto;
}
}
if (!empty($global['systemRootPath']) && empty($config)) {
// update config file for version 2.8
$txt = 'require_once $global[\'systemRootPath\'].\'objects/include_config.php\';';
$myfile = file_put_contents($configFile, $txt . PHP_EOL, FILE_APPEND | LOCK_EX);
require_once $global['systemRootPath'].'objects/include_config.php';
} elseif (empty($global['systemRootPath'])) {
die("Error to find systemRootPath = ({$global['systemRootPath']})");
error_log(json_encode($global));
}
html, body, iframe {
margin: 0px;
padding: 0px;
height: 100%;
border: none;
}
html, body, iframe, .ui-dialog .ui-dialog-content {
margin: 0px !important;
padding: 0px !important;
}
.ui-dialog{
box-shadow: 2px 2px 15px black;
}
iframe{
display: block;
width: 100%;
border: none;
overflow-y: auto;
overflow-x: hidden;
/*border: 4px solid green;
margin: 5px;*/
}
</style>
</head>
<body>
<iframe
frameborder="0"
marginheight="0"
marginwidth="0"
width="100%"
height="100%"
scrolling="auto"
src="<?php echo $global['webSiteRootURL']; ?>site" id="mainIframe"></iframe>
<script src="<?php echo $global['webSiteRootURL']; ?>node_modules/jquery/dist/jquery.min.js"></script>
<script src="<?php echo $global['webSiteRootURL']; ?>node_modules/jquery-ui-dist/jquery-ui.min.js" type="text/javascript"></script>
<script src="<?php echo $global['webSiteRootURL']; ?>view/js/jquery-dialogextend/build/jquery.dialogextend.min.js" type="text/javascript"></script>
<script src="<?php echo $global['webSiteRootURL']; ?>node_modules/sweetalert/dist/sweetalert.min.js" type="text/javascript"></script>
<script src="<?php echo $global['webSiteRootURL']; ?>node_modules/js-cookie/dist/js.cookie.js" type="text/javascript"></script>
<script src="<?php echo $global['webSiteRootURL']; ?>node_modules/jquery-toast-plugin/dist/jquery.toast.min.js" type="text/javascript"></script>
<script src="<?php echo $global['webSiteRootURL']; ?>view/js/script.js" type="text/javascript"></script>
<script>
if (!empty($_GET['playlist_name']) && empty($_GET['playlist_id'])) {
if ($_GET['playlist_name'] == "favorite") {
$_GET['playlist_id'] = 'favorite';
} else {
$_GET['playlist_id'] = 'watch-later';
function iframeURLChange(iframe, callback) {
var unloadHandler = function () {
// Timeout needed because the URL changes immediately after
// the `unload` event is dispatched.
setTimeout(function () {
console.log('iframe 1', iframe, iframe.contentWindow.location.href, iframe.contentDocument.title);
callback(iframe.contentWindow.location.href, iframe.contentDocument.title);
}, 1000);
};
function attachUnload() {
// Remove the unloadHandler in case it was already attached.
// Otherwise, the change will be dispatched twice.
iframe.contentWindow.removeEventListener("unload", unloadHandler);
iframe.contentWindow.addEventListener("unload", unloadHandler);
}
}
require_once $global['systemRootPath'].'plugin/AVideoPlugin.php';
$firstPage = AVideoPlugin::getFirstPage();
if (empty($firstPage) || !empty($_GET['videoName']) || !empty($_GET['v']) || !empty($_GET['playlist_id']) || !empty($_GET['liveVideoName']) || !empty($_GET['evideo'])) {
require $global['systemRootPath'].'view/modeYoutube.php';
} else {
require $firstPage;
}
include $global['systemRootPath'].'objects/include_end.php';
iframe.addEventListener("load", attachUnload);
attachUnload();
}
iframeURLChange(document.getElementById("mainIframe"), function (src, title) {
console.log("URL changed 1:", src, title);
document.title = title;
if (src === webSiteRootURL + 'site' || src === webSiteRootURL + 'site/') {
src = webSiteRootURL;
}
window.history.pushState("", "", src);
});
function getDialogWidth() {
var suggestedMinimumSize = 800;
var x = $(window).width();
var suggestedSize = x-100;
if (suggestedSize > suggestedMinimumSize) {
x = suggestedSize;
}
return x;
}
function getDialogHeight() {
var suggestedMinimumSize = 600;
var x = $(window).height();
var suggestedSize = x-100;
if (suggestedSize > suggestedMinimumSize) {
x = suggestedSize;
}
return x;
}
var windowCount = 0;
function openWindow(url, iframeAllowAttributes, title, maximize) {
var id = 'window' + windowCount;
var dialogSelector = '#' + id;
windowCount++;
var html = '<div id="' + id + '" title="' + title + '">';
var iframeId = 'avideoWindowIframe' + id;
html += '<iframe id="' + iframeId + '" name="' + iframeId + '" frameBorder="0" class="animate__animated animate__bounceInDown" src="' + url + '" ' + iframeAllowAttributes + ' ></iframe>';
html += '</div>';
$('body').append(html);
var w = getDialogWidth();
var h = getDialogHeight();
$(dialogSelector).dialog({
draggable: true,
autoOpen: true,
modal: false,
responsive: true,
width: w,
height: h,
minWidth: w / 2,
minHeight: h / 2,
close: function (event, ui) {
$(this).remove();
}
}).dialogExtend({
"closable": true,
"maximizable": true,
"minimizable": true,
"collapsable": true,
"dblclick": "collapse",
"titlebar": "transparent",
"minimizeLocation": "right",
"icons": {
close: "ui-icon-circle-close",
//close: "far fa-times-circle",
"maximize": "ui-icon-circle-plus",
"minimize": "ui-icon-circle-minus",
"collapse": "ui-icon-triangle-1-s",
"restore": "ui-icon-bullet"
}
});
if (maximize) {
$(dialogSelector).dialogExtend("maximize");
}
function iframeURLChange2(iframe, selector, callback) {
var unloadHandler = function () {
// Timeout needed because the URL changes immediately after
// the `unload` event is dispatched.
setTimeout(function () {
//console.log('iframe 1', iframe);
if (iframe.contentDocument) {
callback(selector, iframe.contentDocument.title);
}
}, 1000);
};
function attachUnload() {
// Remove the unloadHandler in case it was already attached.
// Otherwise, the change will be dispatched twice.
iframe.contentWindow.removeEventListener("unload", unloadHandler);
iframe.contentWindow.addEventListener("unload", unloadHandler);
}
iframe.addEventListener("load", attachUnload);
attachUnload();
}
iframeURLChange2(document.getElementById(iframeId), dialogSelector, function (selector, title) {
$(selector).dialog('option', 'title', title);
});
return iframeId;
//addButtons($("." + id));
}
function openWindowWithPost(url, iframeAllowAttributes, params) {
var name = openWindow("about:blank", iframeAllowAttributes, '', true);
var form = document.createElement("form");
form.setAttribute("method", "post");
form.setAttribute("action", url);
form.setAttribute("target", name);
console.log('openWindowWithPost', name);
for (var i in params) {
if (params.hasOwnProperty(i)) {
var input = document.createElement('input');
input.type = 'hidden';
input.name = i;
input.value = params[i];
form.appendChild(input);
}
}
document.body.appendChild(form);
form.submit();
document.body.removeChild(form);
}
$(document).ready(function () {
//$("#window").draggable({handle: ".panel-heading", containment: "body"});
//$("#window").resizable();
});
</script>
</body>
</html>

View file

@ -27,6 +27,7 @@ try {
var isDebuging = false;
var avideoIsOnline = false;
var userLang = navigator.language || navigator.userLanguage;
var iframeAllowAttributes = 'allow="fullscreen;autoplay;camera *;microphone *;" allowfullscreen="allowfullscreen" mozallowfullscreen="mozallowfullscreen" msallowfullscreen="msallowfullscreen" oallowfullscreen="oallowfullscreen" webkitallowfullscreen="webkitallowfullscreen"';
// Create browser compatible event handler.
var eventMethod = window.addEventListener ? "addEventListener" : "attachEvent";
@ -1392,6 +1393,24 @@ function avideoModalIframeCloseToastSuccess(msg) {
window.parent.avideoToastSuccess(msg);
}
function avideoDialog(url, maximize) {
if(typeof parent.openWindow === 'function'){
url = addGetParam(url, 'avideoIframe', 1);
parent.openWindow(url, iframeAllowAttributes, '', maximize);
}else{
avideoModalIframeFullScreen(url);
}
}
function avideoDialogWithPost(url, params) {
if(typeof parent.openWindowWithPost === 'function'){
parent.openWindowWithPost(url, iframeAllowAttributes, params);
}else{
var strWindowFeatures = "directories=no,titlebar=no,toolbar=no,location=no,status=no,menubar=no,resizable=no,height=600,width=800";
openWindowWithPost(url, 'avideoDialogWithPost', params, strWindowFeatures);
}
}
function avideoModalIframe(url) {
avideoModalIframeWithClassName(url, 'swal-modal-iframe', false);
}
@ -1414,7 +1433,7 @@ function avideoModalIframeFullScreen(url) {
function avideoModalIframeFullWithMinimize(url) {
if(typeof parent.openWindow === 'function'){
parent.openWindow(url, iframeAllowAttributes, '');
parent.openWindow(url, iframeAllowAttributes, '', true);
}else{
avideoModalIframeWithClassName(url, 'swal-modal-iframe-full-with-minimize', true);
}
@ -1537,9 +1556,6 @@ function avideoModalIframeWithClassName(url, className, updateURL) {
html += '<img src="' + webSiteRootURL + 'videos/userPhoto/logo.png" class="img img-responsive swal-modal-logo" style="max-height:34px;">';
}
if (typeof iframeAllowAttributes == 'undefined') {
iframeAllowAttributes = 'allow="fullscreen;autoplay;camera *;microphone *;" allowfullscreen="allowfullscreen" mozallowfullscreen="mozallowfullscreen" msallowfullscreen="msallowfullscreen" oallowfullscreen="oallowfullscreen" webkitallowfullscreen="webkitallowfullscreen"';
}
html += '</div>';
html += '<iframe id="avideoModalIframe" frameBorder="0" class="animate__animated animate__bounceInDown" src="' + url + '" ' + iframeAllowAttributes + ' ></iframe>';

View file

@ -114,16 +114,6 @@ if (isset($_FILES['upl']) && $_FILES['upl']['error'] == 0) {
$filenameMP4 = $filename . "." . $extension;
decideMoveUploadedToVideos($tmp_name, $filenameMP4, $video->getType());
if ((AVideoPlugin::isEnabledByName('MP4ThumbsAndGif')) && ($extension == "mp4" || $extension == "webm" || $extension == "mp3")) {
$videoFileName = $video->getFilename();
MP4ThumbsAndGif::getImage($videoFileName, 'jpg', $id);
MP4ThumbsAndGif::getImage($videoFileName, 'gif', $id);
MP4ThumbsAndGif::getImage($videoFileName, 'webp', $id);
}
// } else if(($extension=="mp3")||($extension=="ogg")){
// }
$obj->title = $video->getTitle();
$obj->error = false;
$obj->filename = $filename;