mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-03 01:39:24 +02:00
Getting ready for iframe
This commit is contained in:
parent
5839d017e5
commit
8873b73879
13 changed files with 514 additions and 267 deletions
|
@ -114,7 +114,7 @@ Options All -Indexes
|
||||||
|
|
||||||
#main Files
|
#main Files
|
||||||
RewriteRule ^index.php$ view/index.php [NC,L,QSA]
|
RewriteRule ^index.php$ view/index.php [NC,L,QSA]
|
||||||
RewriteRule ^site/?$ view/firstPage.php [NC,L,QSA]
|
RewriteRule ^site/?$ view/index_firstPage.php [NC,L,QSA]
|
||||||
RewriteRule ^index.html$ %{ENV:proto}://%{HTTP_HOST} [L,R=301,NE]
|
RewriteRule ^index.html$ %{ENV:proto}://%{HTTP_HOST} [L,R=301,NE]
|
||||||
RewriteRule ^index.htm$ %{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]
|
#RewriteRule ^index.php$ /view/index.php [NC,L]
|
||||||
|
|
|
@ -5214,9 +5214,10 @@ function getSelfURI() {
|
||||||
$http = 'https';
|
$http = 'https';
|
||||||
}
|
}
|
||||||
|
|
||||||
$queryStringWithoutError = preg_replace("/error=[^&]*/", "", @$_SERVER['QUERY_STRING']);
|
$queryString = preg_replace("/error=[^&]*/", "", @$_SERVER['QUERY_STRING']);
|
||||||
|
$queryString = preg_replace("/inMainIframe=[^&]*/", "", $queryString);
|
||||||
$phpselfWithoutIndex = preg_replace("/index.php/", "", @$_SERVER['PHP_SELF']);
|
$phpselfWithoutIndex = preg_replace("/index.php/", "", @$_SERVER['PHP_SELF']);
|
||||||
$url = $http . "://$_SERVER[HTTP_HOST]$phpselfWithoutIndex?$queryStringWithoutError";
|
$url = $http . "://$_SERVER[HTTP_HOST]$phpselfWithoutIndex?$queryString";
|
||||||
$url = rtrim($url, '?');
|
$url = rtrim($url, '?');
|
||||||
return $url;
|
return $url;
|
||||||
}
|
}
|
||||||
|
@ -6675,7 +6676,9 @@ function isIframe() {
|
||||||
if (isset($_SERVER['HTTP_SEC_FETCH_DEST']) && $_SERVER['HTTP_SEC_FETCH_DEST'] === 'iframe') {
|
if (isset($_SERVER['HTTP_SEC_FETCH_DEST']) && $_SERVER['HTTP_SEC_FETCH_DEST'] === 'iframe') {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (empty($_SERVER['HTTP_REFERER']) || $_SERVER['HTTP_REFERER'] == $global['webSiteRootURL'] || str_replace('view/', '', getSelfURI()) == $global['webSiteRootURL']) {
|
|
||||||
|
$pattern = '/'. str_replace('/', '\\/', $global['webSiteRootURL']).'((view|site)\/?)?/';
|
||||||
|
if (empty($_SERVER['HTTP_REFERER']) || preg_match($pattern, $_SERVER['HTTP_REFERER'])) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -9624,5 +9627,40 @@ function getWordOrIcon($word, $class = '') {
|
||||||
|
|
||||||
function getHomePageURL() {
|
function getHomePageURL() {
|
||||||
global $global;
|
global $global;
|
||||||
|
//return "{$global['webSiteRootURL']}";
|
||||||
return "{$global['webSiteRootURL']}site/";
|
return "{$global['webSiteRootURL']}site/";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function useIframe(){
|
||||||
|
return isOnDeveloperMode() && !isBot();
|
||||||
|
}
|
||||||
|
|
||||||
|
function getIframePaths(){
|
||||||
|
global $global;
|
||||||
|
$modeYoutube = false;
|
||||||
|
if (!empty($_GET['videoName']) || !empty($_GET['v']) || !empty($_GET['playlist_id']) || !empty($_GET['liveVideoName']) || !empty($_GET['evideo'])) {
|
||||||
|
$modeYoutube = true;
|
||||||
|
$relativeSRC = 'view/modeYoutube.php';
|
||||||
|
} else {
|
||||||
|
$relativeSRC = 'view/index_firstPage.php';
|
||||||
|
}
|
||||||
|
$url = "{$global['webSiteRootURL']}{$relativeSRC}";
|
||||||
|
if($modeYoutube && !empty($_GET['v'])){
|
||||||
|
if(!empty($_GET['v'])){
|
||||||
|
$url = "{$global['webSiteRootURL']}video/".$_GET['v'].'/';
|
||||||
|
unset($_GET['v']);
|
||||||
|
if(!empty($_GET['videoName'])){
|
||||||
|
$url .= urlencode($_GET['videoName']).'/';
|
||||||
|
unset($_GET['videoName']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
unset($_GET['inMainIframe']);
|
||||||
|
|
||||||
|
foreach ($_GET as $key => $value) {
|
||||||
|
$url = addQueryStringParameter($url, $key, $value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return array('relative'=>$relativeSRC, 'url'=>$url, 'path'=>"{$global['systemRootPath']}{$relativeSRC}", 'modeYoutube'=>$modeYoutube);
|
||||||
|
|
||||||
|
}
|
|
@ -260,6 +260,14 @@ if (typeof gtag !== \"function\") {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static function getCookieUsersId() {
|
||||||
|
if (empty($_COOKIE['users_id'])) {
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
return intval($_COOKIE['users_id']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static function getEmail_() {
|
public static function getEmail_() {
|
||||||
if (self::isLogged()) {
|
if (self::isLogged()) {
|
||||||
return $_SESSION['user']['email'];
|
return $_SESSION['user']['email'];
|
||||||
|
@ -1072,6 +1080,7 @@ if (typeof gtag !== \"function\") {
|
||||||
_unsetcookie('rememberme');
|
_unsetcookie('rememberme');
|
||||||
_unsetcookie('user');
|
_unsetcookie('user');
|
||||||
_unsetcookie('pass');
|
_unsetcookie('pass');
|
||||||
|
_unsetcookie('users_id');
|
||||||
//session_regenerate_id(true);
|
//session_regenerate_id(true);
|
||||||
ObjectYPT::deleteAllSessionCache();
|
ObjectYPT::deleteAllSessionCache();
|
||||||
unset($_SESSION['user']);
|
unset($_SESSION['user']);
|
||||||
|
|
60
sw.js
60
sw.js
|
@ -8,8 +8,8 @@ workbox.setConfig({
|
||||||
|
|
||||||
const webSiteRootURL = this.location.href.split('sw.js?')[0];
|
const webSiteRootURL = this.location.href.split('sw.js?')[0];
|
||||||
const FALLBACK_HTML_URL = webSiteRootURL + 'offline';
|
const FALLBACK_HTML_URL = webSiteRootURL + 'offline';
|
||||||
const CACHE_NAME = 'avideo-cache-ver-1.4';
|
const CACHE_NAME = 'avideo-cache-ver-1.5';
|
||||||
console.log('sw CACHE_NAME', CACHE_NAME);
|
console.log('sw strategy CACHE_NAME', CACHE_NAME);
|
||||||
const precahedFiles = [
|
const precahedFiles = [
|
||||||
FALLBACK_HTML_URL,
|
FALLBACK_HTML_URL,
|
||||||
webSiteRootURL + 'node_modules/video.js/dist/video-js.min.css',
|
webSiteRootURL + 'node_modules/video.js/dist/video-js.min.css',
|
||||||
|
@ -75,10 +75,6 @@ const StaleWhileRevalidate = new workbox.strategies.StaleWhileRevalidate(showCac
|
||||||
|
|
||||||
var getStrategyTypeURLs = [];
|
var getStrategyTypeURLs = [];
|
||||||
async function getStrategyType(strategyName, args, fallback) {
|
async function getStrategyType(strategyName, args, fallback) {
|
||||||
if (args.request.url == webSiteRootURL) {
|
|
||||||
console.log('getStrategyType', strategyName, args.request.url, fallback);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof getStrategyTypeURLs[args.request.url] !== 'undefined') {
|
if (typeof getStrategyTypeURLs[args.request.url] !== 'undefined') {
|
||||||
return await CacheFirst.handle(args);
|
return await CacheFirst.handle(args);
|
||||||
}
|
}
|
||||||
|
@ -124,9 +120,18 @@ async function getStrategyType(strategyName, args, fallback) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function shouldShowLog(request, extension) {
|
||||||
|
if (request.destination !== 'script' && request.destination !== 'style' && request.destination !== 'image' && extension !== 'webp' && extension !== 'woff2' && extension !== 'png') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
function ruleMatches(rules, extension, request) {
|
function ruleMatches(rules, extension, request) {
|
||||||
var ruleIsValid = true;
|
var ruleIsValid = true;
|
||||||
//console.log('ruleMatches start', extension, request.url);
|
if (shouldShowLog(request, extension)) {
|
||||||
|
//console.log('strategy ruleMatches start', extension, request.url);
|
||||||
|
}
|
||||||
for (var i in rules) {
|
for (var i in rules) {
|
||||||
var rule = rules[i];
|
var rule = rules[i];
|
||||||
if (rule) {
|
if (rule) {
|
||||||
|
@ -135,25 +140,33 @@ function ruleMatches(rules, extension, request) {
|
||||||
if (!ruleIsValid) {
|
if (!ruleIsValid) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//console.log('ruleMatches', i);
|
if (shouldShowLog(request, extension)) {
|
||||||
|
console.log('strategy ruleMatches', i, extension);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (i == 'destination') {
|
if (i == 'destination') {
|
||||||
ruleIsValid = request.destination === rule;
|
ruleIsValid = request.destination === rule;
|
||||||
if (!ruleIsValid) {
|
if (!ruleIsValid) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//console.log('ruleMatches', i, rule, request.url);
|
if (shouldShowLog(request, extension)) {
|
||||||
|
console.log('strategy ruleMatches', i, rule, request.url);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (i == 'url') {
|
if (i == 'url') {
|
||||||
ruleIsValid = request.url === rule;
|
ruleIsValid = request.url === rule;
|
||||||
if (!ruleIsValid) {
|
if (!ruleIsValid) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//console.log('ruleMatches', i, rule);
|
if (shouldShowLog(request, extension)) {
|
||||||
|
console.log('strategy ruleMatches', i, rule);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//console.log('ruleMatches end');
|
}
|
||||||
|
if (shouldShowLog(request, extension)) {
|
||||||
|
//console.log('strategy ruleMatches end');
|
||||||
|
}
|
||||||
return ruleIsValid;
|
return ruleIsValid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,7 +174,9 @@ async function processStrategy(strategy, args, extension, strategyName) {
|
||||||
for (var i in strategy) {
|
for (var i in strategy) {
|
||||||
var rules = strategy[i];
|
var rules = strategy[i];
|
||||||
if (ruleMatches(rules, extension, args.request)) {
|
if (ruleMatches(rules, extension, args.request)) {
|
||||||
//console.log('processStrategy', args.request.url, extension, strategyName);
|
if (shouldShowLog(args.request, extension)) {
|
||||||
|
console.log('processStrategy', args.request.url, extension, strategyName);
|
||||||
|
}
|
||||||
return await getStrategyType(strategyName, args, rules.fallback);
|
return await getStrategyType(strategyName, args, rules.fallback);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -174,7 +189,10 @@ async function processStrategyDefault(args, extension) {
|
||||||
|
|
||||||
async function getStrategy(args) {
|
async function getStrategy(args) {
|
||||||
var strategiesNetworkOnly = [];
|
var strategiesNetworkOnly = [];
|
||||||
strategiesNetworkOnly.push({extension: false, destination: 'document', url: webSiteRootURL, fallback: true});
|
strategiesNetworkOnly.push({extension: false, destination: false, url: webSiteRootURL, fallback: true});
|
||||||
|
strategiesNetworkOnly.push({extension: false, destination: false, url: webSiteRootURL + 'site', fallback: true});
|
||||||
|
strategiesNetworkOnly.push({extension: false, destination: false, url: webSiteRootURL + 'site/', fallback: true});
|
||||||
|
strategiesNetworkOnly.push({extension: false, destination: false, url: webSiteRootURL + 'objects/getTimes.json.php', fallback: true});
|
||||||
|
|
||||||
var strategiesNetworkOnlyRaw = [];
|
var strategiesNetworkOnlyRaw = [];
|
||||||
strategiesNetworkOnlyRaw.push({extension: 'key', destination: false, url: false, fallback: false});
|
strategiesNetworkOnlyRaw.push({extension: 'key', destination: false, url: false, fallback: false});
|
||||||
|
@ -183,9 +201,11 @@ async function getStrategy(args) {
|
||||||
strategiesNetworkOnlyRaw.push({extension: 'mp4', destination: false, url: false, fallback: false});
|
strategiesNetworkOnlyRaw.push({extension: 'mp4', destination: false, url: false, fallback: false});
|
||||||
strategiesNetworkOnlyRaw.push({extension: 'mp3', destination: false, url: false, fallback: false});
|
strategiesNetworkOnlyRaw.push({extension: 'mp3', destination: false, url: false, fallback: false});
|
||||||
strategiesNetworkOnlyRaw.push({extension: 'webm', destination: false, url: false, fallback: false});
|
strategiesNetworkOnlyRaw.push({extension: 'webm', destination: false, url: false, fallback: false});
|
||||||
|
strategiesNetworkOnlyRaw.push({extension: false, destination: 'iframe', url: false, fallback: false});
|
||||||
|
|
||||||
var strategiesNetworkFirst = [];
|
var strategiesNetworkFirst = [];
|
||||||
strategiesNetworkFirst.push({extension: false, destination: 'document', url: webSiteRootURL + 'offline', fallback: false});
|
strategiesNetworkFirst.push({extension: false, destination: 'document', url: webSiteRootURL + 'offline', fallback: false});
|
||||||
|
strategiesNetworkFirst.push({extension: false, destination: 'document', url: webSiteRootURL, fallback: false});
|
||||||
|
|
||||||
var strategiesCacheFirst = [];
|
var strategiesCacheFirst = [];
|
||||||
strategiesCacheFirst.push({extension: false, destination: 'font', url: false, fallback: false});
|
strategiesCacheFirst.push({extension: false, destination: 'font', url: false, fallback: false});
|
||||||
|
@ -195,13 +215,19 @@ async function getStrategy(args) {
|
||||||
strategiesStaleWhileRevalidate.push({extension: false, destination: 'style', url: false, fallback: false});
|
strategiesStaleWhileRevalidate.push({extension: false, destination: 'style', url: false, fallback: false});
|
||||||
strategiesStaleWhileRevalidate.push({extension: false, destination: 'script', url: false, fallback: false});
|
strategiesStaleWhileRevalidate.push({extension: false, destination: 'script', url: false, fallback: false});
|
||||||
strategiesStaleWhileRevalidate.push({extension: false, destination: 'image', url: false, fallback: false});
|
strategiesStaleWhileRevalidate.push({extension: false, destination: 'image', url: false, fallback: false});
|
||||||
|
strategiesStaleWhileRevalidate.push({extension: 'webp', destination: false, url: false, fallback: false});
|
||||||
|
strategiesStaleWhileRevalidate.push({extension: 'woff2', destination: false, url: false, fallback: false});
|
||||||
|
strategiesStaleWhileRevalidate.push({extension: 'png', destination: false, url: false, fallback: false});
|
||||||
strategiesStaleWhileRevalidate.push({extension: false, destination: false, url: webSiteRootURL + 'plugin/Live/stats.json.php?Menu', fallback: false});
|
strategiesStaleWhileRevalidate.push({extension: false, destination: false, url: webSiteRootURL + 'plugin/Live/stats.json.php?Menu', fallback: false});
|
||||||
|
|
||||||
let domain = (new URL(args.request.url));
|
let domain = (new URL(args.request.url));
|
||||||
var extension = domain.pathname.split('.').pop().toLowerCase();
|
var extension = domain.pathname.split('.').pop().toLowerCase();
|
||||||
//console.log('getStrategy', extension, args);
|
if (shouldShowLog(args.request, extension)) {
|
||||||
return await processStrategy(strategiesNetworkOnlyRaw, args, extension, 'NetworkOnlyRaw') ||
|
//console.log('getStrategy', 'extension=', extension, 'destination=', args.request.destination, 'url=', args.request.url);
|
||||||
await processStrategy(strategiesNetworkOnly, args, extension, 'NetworkOnly') ||
|
}
|
||||||
|
//return await NetworkOnlyRaw.handle(args);
|
||||||
|
return await processStrategy(strategiesNetworkOnly, args, extension, 'NetworkOnly') ||
|
||||||
|
await processStrategy(strategiesNetworkOnlyRaw, args, extension, 'NetworkOnlyRaw') ||
|
||||||
await processStrategy(strategiesNetworkFirst, args, extension, 'NetworkFirst') ||
|
await processStrategy(strategiesNetworkFirst, args, extension, 'NetworkFirst') ||
|
||||||
await processStrategy(strategiesCacheFirst, args, extension, 'CacheFirst') ||
|
await processStrategy(strategiesCacheFirst, args, extension, 'CacheFirst') ||
|
||||||
await processStrategy(strategiesStaleWhileRevalidate, args, extension, 'StaleWhileRevalidate') ||
|
await processStrategy(strategiesStaleWhileRevalidate, args, extension, 'StaleWhileRevalidate') ||
|
||||||
|
@ -209,7 +235,7 @@ async function getStrategy(args) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//workbox.routing.registerRoute(/.*/, getStrategy);
|
workbox.routing.registerRoute(/.*/, getStrategy);
|
||||||
|
|
||||||
self.addEventListener('install', event => {
|
self.addEventListener('install', event => {
|
||||||
//console.log('sw.js 1', event);
|
//console.log('sw.js 1', event);
|
||||||
|
|
|
@ -1,58 +0,0 @@
|
||||||
<?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';
|
|
|
@ -67,6 +67,7 @@ if (!empty($head_videos_id)) {
|
||||||
echo $tags['head'];
|
echo $tags['head'];
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
<script class="doNotSepareteTag" src="<?php echo getURL('view/js/swRegister.js'); ?>" type="text/javascript"></script>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
@ -177,7 +178,8 @@ if (isRTL()) {
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<script src="<?php echo getURL('node_modules/jquery/dist/jquery.min.js'); ?>"></script>
|
<script src="<?php echo getURL('node_modules/jquery/dist/jquery.min.js'); ?>"></script>
|
||||||
<script>
|
<script class="doNotSepareteTag">
|
||||||
|
var useIframe = <?php echo json_encode(useIframe()); ?>;
|
||||||
var webSiteRootURL = '<?php echo $global['webSiteRootURL']; ?>';
|
var webSiteRootURL = '<?php echo $global['webSiteRootURL']; ?>';
|
||||||
var my_users_id = <?php echo intval(User::getId()); ?>;
|
var my_users_id = <?php echo intval(User::getId()); ?>;
|
||||||
var my_identification = <?php echo json_encode(User::getNameIdentification()); ?>;
|
var my_identification = <?php echo json_encode(User::getNameIdentification()); ?>;
|
||||||
|
|
|
@ -2,15 +2,14 @@
|
||||||
global $config, $advancedCustom;
|
global $config, $advancedCustom;
|
||||||
if (empty($advancedCustom->openEncoderInIFrame) || !isSameDomainAsMyAVideo($config->getEncoderURL())) {
|
if (empty($advancedCustom->openEncoderInIFrame) || !isSameDomainAsMyAVideo($config->getEncoderURL())) {
|
||||||
if (!empty($advancedCustom->encoderNetwork) && empty($advancedCustom->doNotShowEncoderNetwork)) {
|
if (!empty($advancedCustom->encoderNetwork) && empty($advancedCustom->doNotShowEncoderNetwork)) {
|
||||||
|
$params = new stdClass();
|
||||||
|
$params->webSiteRootURL = $global['webSiteRootURL'];
|
||||||
|
$params->user = User::getUserName();
|
||||||
|
$params->pass = User::getUserPass();
|
||||||
?>
|
?>
|
||||||
<li>
|
<li>
|
||||||
<form id="formEncoderN" method="post" action="<?php echo $advancedCustom->encoderNetwork; ?>" target="encoder" autocomplete="off">
|
<a href="#" onclick='postFormToTarget("<?php echo $advancedCustom->encoderNetwork; ?>", "encoderN", <?php echo json_encode($params); ?>);return false;' data-toggle="tooltip" title="<?php echo __("Choose one of our encoders to upload a file or download it from the Internet"); ?>" data-placement="left"
|
||||||
<input type="hidden" name="webSiteRootURL" value="<?php echo $global['webSiteRootURL']; ?>" autocomplete="off" />
|
class="faa-parent animated-hover" >
|
||||||
<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="$('#formEncoderN').submit();
|
|
||||||
return false;" data-toggle="tooltip" title="<?php echo __("Choose one of our encoders to upload a file or download it from the Internet"); ?>" data-placement="left" >
|
|
||||||
<span class="fa fa-cogs"></span> <?php echo empty($advancedCustom->encoderNetworkLabel) ? __("Encoder Network") : __($advancedCustom->encoderNetworkLabel); ?>
|
<span class="fa fa-cogs"></span> <?php echo empty($advancedCustom->encoderNetworkLabel) ? __("Encoder Network") : __($advancedCustom->encoderNetworkLabel); ?>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
@ -18,14 +17,14 @@ if (empty($advancedCustom->openEncoderInIFrame) || !isSameDomainAsMyAVideo($conf
|
||||||
}
|
}
|
||||||
if (empty($advancedCustom->doNotShowEncoderButton)) {
|
if (empty($advancedCustom->doNotShowEncoderButton)) {
|
||||||
if (!empty($config->getEncoderURL())) {
|
if (!empty($config->getEncoderURL())) {
|
||||||
|
|
||||||
$params = new stdClass();
|
$params = new stdClass();
|
||||||
$params->webSiteRootURL = $global['webSiteRootURL'];
|
$params->webSiteRootURL = $global['webSiteRootURL'];
|
||||||
$params->user = User::getUserName();
|
$params->user = User::getUserName();
|
||||||
$params->pass = User::getUserPass();
|
$params->pass = User::getUserPass();
|
||||||
?>
|
?>
|
||||||
<li>
|
<li>
|
||||||
<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"
|
<a href="#" onclick='postFormToTarget("<?php echo $config->getEncoderURL(); ?>", "encoder", <?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" >
|
class="faa-parent animated-hover" >
|
||||||
<span class="fas fa-cog faa-spin"></span> <?php echo empty($advancedCustom->encoderButtonLabel) ? __("Encode video and audio") : __($advancedCustom->encoderButtonLabel); ?>
|
<span class="fas fa-cog faa-spin"></span> <?php echo empty($advancedCustom->encoderButtonLabel) ? __("Encode video and audio") : __($advancedCustom->encoderButtonLabel); ?>
|
||||||
</a>
|
</a>
|
||||||
|
|
227
view/index.php
227
view/index.php
|
@ -1,26 +1,43 @@
|
||||||
<?php
|
<?php
|
||||||
include dirname(__FILE__) . '/../view/firstPage.php';exit;
|
//include dirname(__FILE__) . '/../view/firstPage.php';exit;
|
||||||
|
|
||||||
//var_dump($_SERVER);exit;
|
//var_dump($_SERVER);exit;
|
||||||
$configFile = dirname(__FILE__) . '/../videos/configuration.php';
|
$configFile = dirname(__FILE__) . '/../videos/configuration.php';
|
||||||
$doNotIncludeConfig = 1;
|
//$doNotIncludeConfig = 1;
|
||||||
require_once $configFile;
|
require_once $configFile;
|
||||||
require_once "{$global['systemRootPath']}objects/functions.php";
|
//require_once "{$global['systemRootPath']}objects/functions.php";
|
||||||
if (isIframe()) {
|
|
||||||
include "{$global['systemRootPath']}view/firstPage.php";
|
$paths = getIframePaths();
|
||||||
|
//var_dump(!useIframe(), isIframe());exit;
|
||||||
|
if (!useIframe() || isIframe() || !empty($_REQUEST['inMainIframe'])) {
|
||||||
|
include $paths['path'];
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$postURL = $paths['url'];
|
||||||
|
|
||||||
|
$postURL = addQueryStringParameter($postURL, 'inMainIframe', 1);
|
||||||
|
//var_dump($postURL, $_REQUEST['inMainIframe']);exit;
|
||||||
//var_dump($_SERVER);exit;
|
//var_dump($_SERVER);exit;
|
||||||
?><!DOCTYPE html>
|
?><!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
<script class="doNotSepareteTag" src="<?php echo getURL('view/js/swRegister.js'); ?>" type="text/javascript"></script>
|
||||||
|
<title>Loading...</title>
|
||||||
<script>
|
<script>
|
||||||
var webSiteRootURL = '<?php echo $global['webSiteRootURL']; ?>';
|
var webSiteRootURL = '<?php echo $global['webSiteRootURL']; ?>';
|
||||||
|
function isASubIFrame() {
|
||||||
|
return document.location.ancestorOrigins.length > 0 && typeof parent.isASubIFrame === 'function';
|
||||||
|
}
|
||||||
|
if (isASubIFrame()) {
|
||||||
|
console.log('isASubIFrame', window.parent.document.location, document.location);
|
||||||
|
window.parent.document.location = document.location;
|
||||||
|
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<title>Loading...</title>
|
<link rel="shortcut icon" href="<?php echo getURL('videos/favicon.ico'); ?>" sizes="16x16,24x24,32x32,48x48,144x144">
|
||||||
<link rel="shortcut icon" href="<?php echo $global['webSiteRootURL']; ?>videos/favicon.ico" sizes="16x16,24x24,32x32,48x48,144x144">
|
<link href="<?php echo getURL('view/bootstrap/css/bootstrap.min.css'); ?>" rel="stylesheet" type="text/css"/>
|
||||||
<link href="<?php echo $global['webSiteRootURL']; ?>node_modules/jquery-ui-dist/jquery-ui.min.css" rel="stylesheet" type="text/css"/>
|
<link href="<?php echo getURL('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"/>
|
<link href="<?php echo getURL('node_modules/fontawesome-free/css/all.min.css'); ?>" rel="stylesheet" type="text/css"/>
|
||||||
<style>
|
<style>
|
||||||
html{
|
html{
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
|
@ -59,48 +76,141 @@ if (isIframe()) {
|
||||||
width="100%"
|
width="100%"
|
||||||
height="100%"
|
height="100%"
|
||||||
scrolling="auto"
|
scrolling="auto"
|
||||||
src="<?php echo $global['webSiteRootURL']; ?>site" id="mainIframe"></iframe>
|
src="<?php echo getURL('view\index_loading.html'); ?>" id="mainIframe" name="mainIframe"></iframe>
|
||||||
<script src="<?php echo $global['webSiteRootURL']; ?>node_modules/jquery/dist/jquery.min.js"></script>
|
<form action="<?php echo $postURL; ?>" method="post" target="mainIframe" style="display: none;" id="mainIframeForm">
|
||||||
<script src="<?php echo $global['webSiteRootURL']; ?>node_modules/jquery-ui-dist/jquery-ui.min.js" type="text/javascript"></script>
|
<?php
|
||||||
<script src="<?php echo $global['webSiteRootURL']; ?>view/js/jquery-dialogextend/build/jquery.dialogextend.min.js" type="text/javascript"></script>
|
foreach ($_POST as $key => $value) {
|
||||||
<script src="<?php echo $global['webSiteRootURL']; ?>node_modules/sweetalert/dist/sweetalert.min.js" type="text/javascript"></script>
|
echo "<input type='hidden' name='{$key}' value=". json_encode($value)." />";
|
||||||
<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>
|
</form>
|
||||||
|
<script src="<?php echo getURL('node_modules/jquery/dist/jquery.min.js'); ?>"></script>
|
||||||
|
<script src="<?php echo getURL('view/bootstrap/js/bootstrap.min.js'); ?>" type="text/javascript"></script>
|
||||||
|
<script src="<?php echo getURL('node_modules/jquery-ui-dist/jquery-ui.min.js'); ?>" type="text/javascript"></script>
|
||||||
|
<script src="<?php echo getURL('view/js/jquery-dialogextend/build/jquery.dialogextend.min.js'); ?>" type="text/javascript"></script>
|
||||||
|
<script src="<?php echo getURL('node_modules/sweetalert/dist/sweetalert.min.js'); ?>" type="text/javascript"></script>
|
||||||
|
<script src="<?php echo getURL('node_modules/js-cookie/dist/js.cookie.js'); ?>" type="text/javascript"></script>
|
||||||
|
<script src="<?php echo getURL('node_modules/jquery-toast-plugin/dist/jquery.toast.min.js'); ?>" type="text/javascript"></script>
|
||||||
|
<script src="<?php echo getURL('view/js/script.js'); ?>" type="text/javascript"></script>
|
||||||
|
<script src="<?php echo getURL('view/js/a2hs.js'); ?>" type="text/javascript"></script>
|
||||||
<script>
|
<script>
|
||||||
|
var avideoLoader = <?php echo json_encode(file_get_contents($global['systemRootPath'] . 'plugin/Layout/loaders/avideo.html'), JSON_UNESCAPED_UNICODE); ?>;
|
||||||
|
function attachOnload() {
|
||||||
function iframeURLChange(iframe, callback) {
|
var iframe = document.getElementById("mainIframe");
|
||||||
var unloadHandler = function () {
|
var onLoadHandler = function () {
|
||||||
// Timeout needed because the URL changes immediately after
|
console.log('onLoadHandler');
|
||||||
// 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);
|
|
||||||
};
|
};
|
||||||
|
iframe.contentWindow.removeEventListener("load", onLoadHandler);
|
||||||
|
iframe.contentWindow.addEventListener("load", onLoadHandler);
|
||||||
|
}
|
||||||
|
|
||||||
|
function attachOnBeforeUnload() {
|
||||||
|
var iframe = document.getElementById("mainIframe");
|
||||||
|
var onBeforeUnloadHandler = function () {
|
||||||
|
console.log('onBeforeUnloadHandler');
|
||||||
|
modal.showPleaseWait();
|
||||||
|
};
|
||||||
|
iframe.contentWindow.removeEventListener("beforeunload", onBeforeUnloadHandler);
|
||||||
|
iframe.contentWindow.addEventListener("beforeunload", onBeforeUnloadHandler);
|
||||||
|
}
|
||||||
|
|
||||||
function attachUnload() {
|
function attachUnload() {
|
||||||
// Remove the unloadHandler in case it was already attached.
|
var iframe = document.getElementById("mainIframe");
|
||||||
// Otherwise, the change will be dispatched twice.
|
var onUnLoadHandler = function () {
|
||||||
iframe.contentWindow.removeEventListener("unload", unloadHandler);
|
console.log('onUnLoadHandler');
|
||||||
iframe.contentWindow.addEventListener("unload", unloadHandler);
|
iframeLoadIsDone();
|
||||||
|
};
|
||||||
|
iframe.contentWindow.removeEventListener("unload", onUnLoadHandler);
|
||||||
|
iframe.contentWindow.addEventListener("unload", onUnLoadHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
iframe.addEventListener("load", attachUnload);
|
|
||||||
attachUnload();
|
attachUnload();
|
||||||
|
attachOnload();
|
||||||
|
attachOnBeforeUnload();
|
||||||
|
var iframeLoadIsDoneTimeout;
|
||||||
|
function iframeLoadIsDone() {
|
||||||
|
clearTimeout(iframeLoadIsDoneTimeout);
|
||||||
|
var iframe = document.getElementById("mainIframe");
|
||||||
|
if (!iframe.contentDocument) {
|
||||||
|
iframeLoadIsDoneTimeout = setTimeout(function () {
|
||||||
|
iframeLoadIsDone();
|
||||||
|
}, 500);
|
||||||
|
} else {
|
||||||
|
iframeLoadIsDoneTimeout = setTimeout(function () {
|
||||||
|
updatePageFromIframe();
|
||||||
|
console.log('reset Handler');
|
||||||
|
attachUnload();
|
||||||
|
attachOnload();
|
||||||
|
attachOnBeforeUnload();
|
||||||
|
}, 500);
|
||||||
|
modal.hidePleaseWait();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
iframeURLChange(document.getElementById("mainIframe"), function (src, title) {
|
function getIframeTitle() {
|
||||||
console.log("URL changed 1:", src, title);
|
return document.getElementById("mainIframe").contentDocument.title;
|
||||||
document.title = title;
|
}
|
||||||
|
function getIframeSRC() {
|
||||||
|
if (empty(document.getElementById("mainIframe").contentDocument)) {
|
||||||
|
return document.getElementById("mainIframe").src;
|
||||||
|
} else {
|
||||||
|
return document.getElementById("mainIframe").contentDocument.location.href;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (src === webSiteRootURL + 'site' || src === webSiteRootURL + 'site/') {
|
function setIframeSRC(src) {
|
||||||
|
return document.getElementById("mainIframe").src = src;
|
||||||
|
}
|
||||||
|
|
||||||
|
var updatePageFromIframeTimeout;
|
||||||
|
function updatePageFromIframe() {
|
||||||
|
clearTimeout(updatePageFromIframeTimeout);
|
||||||
|
var title = getIframeTitle();
|
||||||
|
var src = getIframeSRC();
|
||||||
|
updatePage(title, src);
|
||||||
|
//updatePageFromIframeTimeout = setTimeout(function(){updatePageFromIframe();}, 2000);
|
||||||
|
}
|
||||||
|
|
||||||
|
function updatePage(title, src) {
|
||||||
|
updatePageTitle(title);
|
||||||
|
updatePageSRC(src);
|
||||||
|
}
|
||||||
|
function updatePageTitle(title) {
|
||||||
|
document.title = title;
|
||||||
|
}
|
||||||
|
function updatePageSRC(src) {
|
||||||
|
var iframeSRC = getIframeSRC();
|
||||||
|
if (src == 'about:blank') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
var mainPages = ['site', 'site/', 'view/index_firstPage.php'];
|
||||||
|
|
||||||
|
for (var i in mainPages) {
|
||||||
|
var page = mainPages[i];
|
||||||
|
if(typeof page !== 'string'){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
eval('var pattern = /'+webSiteRootURL.replaceAll('/', '\\/')+page.replace('/', '\\/')+'.*/');
|
||||||
|
if(pattern.test(src)){
|
||||||
src = webSiteRootURL;
|
src = webSiteRootURL;
|
||||||
}
|
}
|
||||||
|
if(pattern.test(iframeSRC)){
|
||||||
|
iframeSRC = webSiteRootURL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (src !== iframeSRC) {
|
||||||
|
setIframeSRC(src);
|
||||||
|
}
|
||||||
|
src.replace(/inMainIframe=1&?/g, '');
|
||||||
|
console.log('updatePageSRC', src, iframeSRC);
|
||||||
window.history.pushState("", "", src);
|
window.history.pushState("", "", src);
|
||||||
});
|
|
||||||
|
if (typeof parent.updatePageSRC == 'funciton') {
|
||||||
|
console.log('parent updatePageSRC', src);
|
||||||
|
parent.updatePageSRC(src);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function getDialogWidth() {
|
function getDialogWidth() {
|
||||||
var suggestedMinimumSize = 800;
|
var suggestedMinimumSize = 800;
|
||||||
|
@ -150,24 +260,23 @@ if (isIframe()) {
|
||||||
"closable": true,
|
"closable": true,
|
||||||
"maximizable": true,
|
"maximizable": true,
|
||||||
"minimizable": true,
|
"minimizable": true,
|
||||||
"collapsable": true,
|
//"collapsable": true,
|
||||||
"dblclick": "collapse",
|
"dblclick": "collapse",
|
||||||
"titlebar": "transparent",
|
"titlebar": "transparent",
|
||||||
"minimizeLocation": "right",
|
"minimizeLocation": "right",
|
||||||
"icons": {
|
"icons": {
|
||||||
close: "ui-icon-circle-close",
|
close: "ui-icon-close",
|
||||||
//close: "far fa-times-circle",
|
"maximize": "ui-icon-plus",
|
||||||
"maximize": "ui-icon-circle-plus",
|
"minimize": "ui-icon-minus",
|
||||||
"minimize": "ui-icon-circle-minus",
|
|
||||||
"collapse": "ui-icon-triangle-1-s",
|
"collapse": "ui-icon-triangle-1-s",
|
||||||
"restore": "ui-icon-bullet"
|
"restore": "ui-icon-triangle-1-n"
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (maximize) {
|
if (maximize) {
|
||||||
$(dialogSelector).dialogExtend("maximize");
|
$(dialogSelector).dialogExtend("maximize");
|
||||||
}
|
}
|
||||||
function iframeURLChange2(iframe, selector, callback) {
|
function iframeURLChange2(iframe, selector, callback) {
|
||||||
var unloadHandler = function () {
|
var onUnLoadHandler = function () {
|
||||||
// Timeout needed because the URL changes immediately after
|
// Timeout needed because the URL changes immediately after
|
||||||
// the `unload` event is dispatched.
|
// the `unload` event is dispatched.
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
|
@ -179,10 +288,10 @@ if (isIframe()) {
|
||||||
};
|
};
|
||||||
|
|
||||||
function attachUnload() {
|
function attachUnload() {
|
||||||
// Remove the unloadHandler in case it was already attached.
|
// Remove the onLoadHandler in case it was already attached.
|
||||||
// Otherwise, the change will be dispatched twice.
|
// Otherwise, the change will be dispatched twice.
|
||||||
iframe.contentWindow.removeEventListener("unload", unloadHandler);
|
iframe.contentWindow.removeEventListener("unload", onUnLoadHandler);
|
||||||
iframe.contentWindow.addEventListener("unload", unloadHandler);
|
iframe.contentWindow.addEventListener("unload", onUnLoadHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
iframe.addEventListener("load", attachUnload);
|
iframe.addEventListener("load", attachUnload);
|
||||||
|
@ -219,7 +328,29 @@ if (isIframe()) {
|
||||||
document.body.removeChild(form);
|
document.body.removeChild(form);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function avideoLoadPage(url) {
|
||||||
|
modal.showPleaseWait();
|
||||||
|
|
||||||
|
/*
|
||||||
|
var iframe = $('#mainIframe').clone();
|
||||||
|
$('#mainIframe').attr('id', 'oldMainIframe');
|
||||||
|
$(iframe).css({display:'none'});
|
||||||
|
$('body').append(iframe);
|
||||||
|
|
||||||
|
var oldMainIframe = $('#oldMainIframe');
|
||||||
|
if(oldMainIframe.length){
|
||||||
|
$(oldMainIframe).slideUp('fast', function () {
|
||||||
|
$(oldMainIframe).remove();
|
||||||
|
});
|
||||||
|
$('#mainIframe').slideDown();
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
setIframeSRC(url);
|
||||||
|
}
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
|
$('#mainIframeForm').submit();
|
||||||
//$("#window").draggable({handle: ".panel-heading", containment: "body"});
|
//$("#window").draggable({handle: ".panel-heading", containment: "body"});
|
||||||
//$("#window").resizable();
|
//$("#window").resizable();
|
||||||
});
|
});
|
||||||
|
|
35
view/index_loading.html
Normal file
35
view/index_loading.html
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Loading...</title>
|
||||||
|
<style>
|
||||||
|
div {
|
||||||
|
height: 100vh;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
@keyframes pulse {
|
||||||
|
0% {
|
||||||
|
transform: scale(0.95);
|
||||||
|
}
|
||||||
|
|
||||||
|
70% {
|
||||||
|
transform: scale(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
100% {
|
||||||
|
transform: scale(0.95);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
img{
|
||||||
|
animation: pulse 2s infinite;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div>
|
||||||
|
<img src="../videos/userPhoto/logo.png" alt="Logo" class="img-responsive ">
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -1,30 +1,4 @@
|
||||||
var deferredPrompt;
|
var deferredPrompt;
|
||||||
|
|
||||||
// Register service worker to control making site work offline
|
|
||||||
function serviceWorkerRegister() {
|
|
||||||
//console.log('Service Worker called');
|
|
||||||
if (typeof webSiteRootURL == 'undefined') {
|
|
||||||
setTimeout(function () {
|
|
||||||
//console.log('Service Worker NOT Registered');
|
|
||||||
serviceWorkerRegister();
|
|
||||||
}, 1000);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ('serviceWorker' in navigator) {
|
|
||||||
var newURL = swapOriginsFromDomains(webSiteRootURL, window.location.href);
|
|
||||||
//console.log('Service Worker trying to Register', newURL, window.location.href, webSiteRootURL);
|
|
||||||
try {
|
|
||||||
navigator.serviceWorker
|
|
||||||
.register(newURL + 'sw.js?' + Math.random())
|
|
||||||
.then(() => {
|
|
||||||
console.log('Service Worker Registered');
|
|
||||||
});
|
|
||||||
} catch (e) {
|
|
||||||
console.log('serviceWorkerRegister ERROR', e, window.location.href, webSiteRootURL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function A2HSInstall() {
|
function A2HSInstall() {
|
||||||
// Show the prompt
|
// Show the prompt
|
||||||
deferredPrompt.prompt();
|
deferredPrompt.prompt();
|
||||||
|
@ -39,11 +13,6 @@ function A2HSInstall() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function swapOriginsFromDomains(url1, url2) {
|
|
||||||
let domain1 = (new URL(url1));
|
|
||||||
let domain2 = (new URL(url2));
|
|
||||||
return url1.replace(domain1.origin, domain2.origin);
|
|
||||||
}
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
eventer('beforeinstallprompt', (e) => {
|
eventer('beforeinstallprompt', (e) => {
|
||||||
// Prevent Chrome 67 and earlier from automatically showing the prompt
|
// Prevent Chrome 67 and earlier from automatically showing the prompt
|
||||||
|
@ -63,5 +32,4 @@ $(document).ready(function () {
|
||||||
expires: 365
|
expires: 365
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
serviceWorkerRegister();
|
|
||||||
});
|
});
|
|
@ -247,7 +247,6 @@ async function lazyImage() {
|
||||||
processing_lazyImage = false;
|
processing_lazyImage = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
lazyImage();
|
|
||||||
var pauseIfIsPlayinAdsInterval;
|
var pauseIfIsPlayinAdsInterval;
|
||||||
var seconds_watching_video = 0;
|
var seconds_watching_video = 0;
|
||||||
var _startCountPlayingTime;
|
var _startCountPlayingTime;
|
||||||
|
@ -643,8 +642,20 @@ function nl2br(str, is_xhtml) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function inMainIframe() {
|
function inMainIframe() {
|
||||||
|
var response = false;
|
||||||
|
if (window.self !== window.top) {
|
||||||
var mainIframe = $('iframe', window.parent.document).attr('id');
|
var mainIframe = $('iframe', window.parent.document).attr('id');
|
||||||
return mainIframe === 'mainIframe';
|
response = mainIframe === 'mainIframe';
|
||||||
|
}
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
function redirectIfIsNotInIframe() {
|
||||||
|
if (!inMainIframe() && (document.location.href === webSiteRootURL + 'site' || document.location.href === webSiteRootURL + 'site/')) {
|
||||||
|
document.location = webSiteRootURL;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function inIframe() {
|
function inIframe() {
|
||||||
|
@ -1406,8 +1417,7 @@ function avideoDialogWithPost(url, params) {
|
||||||
if (typeof parent.openWindowWithPost === 'function') {
|
if (typeof parent.openWindowWithPost === 'function') {
|
||||||
parent.openWindowWithPost(url, iframeAllowAttributes, params);
|
parent.openWindowWithPost(url, iframeAllowAttributes, params);
|
||||||
} else {
|
} 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, '');
|
||||||
openWindowWithPost(url, 'avideoDialogWithPost', params, strWindowFeatures);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1561,7 +1571,7 @@ function avideoModalIframeWithClassName(url, className, updateURL) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
console.log('avideoModalIframeWithClassName window.history.pushState showURL', showURL);
|
console.log('avideoModalIframeWithClassName window.history.pushState showURL', showURL);
|
||||||
window.history.pushState("", "", showURL);
|
avideoPushState(showURL);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1578,7 +1588,7 @@ function avideoModalIframeWithClassName(url, className, updateURL) {
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
if (avideoModalIframeFullScreenOriginalURL) {
|
if (avideoModalIframeFullScreenOriginalURL) {
|
||||||
//console.log('avideoModalIframeWithClassName window.history.pushState avideoModalIframeFullScreenOriginalURL', avideoModalIframeFullScreenOriginalURL);
|
//console.log('avideoModalIframeWithClassName window.history.pushState avideoModalIframeFullScreenOriginalURL', avideoModalIframeFullScreenOriginalURL);
|
||||||
window.history.pushState("", "", avideoModalIframeFullScreenOriginalURL);
|
avideoPushState(avideoModalIframeFullScreenOriginalURL);
|
||||||
avideoModalIframeFullScreenOriginalURL = false;
|
avideoModalIframeFullScreenOriginalURL = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1625,6 +1635,14 @@ function avideoModalIframeWithClassName(url, className, updateURL) {
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function avideoPushState(url) {
|
||||||
|
window.history.pushState("", "", url);
|
||||||
|
if (typeof parent.updatePageSRC == 'funciton') {
|
||||||
|
console.log('avideoPushState', url);
|
||||||
|
parent.updatePageSRC(url);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function checkIframeLoaded(id) {
|
function checkIframeLoaded(id) {
|
||||||
// Get a handle to the iframe element
|
// Get a handle to the iframe element
|
||||||
var iframe = document.getElementById(id);
|
var iframe = document.getElementById(id);
|
||||||
|
@ -2733,7 +2751,7 @@ function addAtMention(selector) {
|
||||||
position: {collision: "flip"}
|
position: {collision: "flip"}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
async function selectAElements() {
|
async function selectAElements() {
|
||||||
$("a").each(function () {
|
$("a").each(function () {
|
||||||
var location = window.location.toString()
|
var location = window.location.toString()
|
||||||
|
@ -2745,7 +2763,7 @@ async function selectAElements() {
|
||||||
$(this).addClass("selected");
|
$(this).addClass("selected");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}*/
|
||||||
|
|
||||||
var hidePleaseWaitTimeout = {};
|
var hidePleaseWaitTimeout = {};
|
||||||
var pleaseWaitIsINUse = {};
|
var pleaseWaitIsINUse = {};
|
||||||
|
@ -2814,6 +2832,9 @@ function getPleaseWait() {
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
|
if (redirectIfIsNotInIframe()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
getServerTime();
|
getServerTime();
|
||||||
addViewFromCookie();
|
addViewFromCookie();
|
||||||
checkDescriptionArea();
|
checkDescriptionArea();
|
||||||
|
@ -2847,7 +2868,8 @@ $(document).ready(function () {
|
||||||
setToolTips();
|
setToolTips();
|
||||||
}, 5000);
|
}, 5000);
|
||||||
lazyImage();
|
lazyImage();
|
||||||
selectAElements();
|
//aHrefToAjax();
|
||||||
|
//selectAElements();
|
||||||
$('#clearCache, .clearCacheButton').on('click', function (ev) {
|
$('#clearCache, .clearCacheButton').on('click', function (ev) {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
clearCache(true, 0, 0);
|
clearCache(true, 0, 0);
|
||||||
|
@ -2894,7 +2916,7 @@ $(document).ready(function () {
|
||||||
});
|
});
|
||||||
checkAutoPlay();
|
checkAutoPlay();
|
||||||
// Code to handle install prompt on desktop
|
// Code to handle install prompt on desktop
|
||||||
aHrefToAjax();
|
//aHrefToAjax();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2921,7 +2943,15 @@ async function checkSavedCookies() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function openWindowWithPost(url, name, params, strWindowFeatures) {
|
function openWindowWithPost(url, name, params, strWindowFeatures) {
|
||||||
|
if(empty(strWindowFeatures)){
|
||||||
|
strWindowFeatures = "directories=no,titlebar=no,toolbar=no,location=no,status=no,menubar=no,resizable=no,height=600,width=800";
|
||||||
|
}
|
||||||
var windowObject = window.open("about:blank", name, strWindowFeatures);
|
var windowObject = window.open("about:blank", name, strWindowFeatures);
|
||||||
|
postFormToTarget(url, name, params);
|
||||||
|
return windowObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
function postFormToTarget(url, name, params) {
|
||||||
var form = document.createElement("form");
|
var form = document.createElement("form");
|
||||||
form.setAttribute("method", "post");
|
form.setAttribute("method", "post");
|
||||||
form.setAttribute("action", url);
|
form.setAttribute("action", url);
|
||||||
|
@ -2938,7 +2968,6 @@ function openWindowWithPost(url, name, params, strWindowFeatures) {
|
||||||
document.body.appendChild(form);
|
document.body.appendChild(form);
|
||||||
form.submit();
|
form.submit();
|
||||||
document.body.removeChild(form);
|
document.body.removeChild(form);
|
||||||
return windowObject;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function fixAdSize() {
|
function fixAdSize() {
|
||||||
|
@ -3318,11 +3347,25 @@ function arrayToTemplate(itemsArray, template) {
|
||||||
template = template.replace(new RegExp('{[^\}]}', 'g'), '');
|
template = template.replace(new RegExp('{[^\}]}', 'g'), '');
|
||||||
return template;
|
return template;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
function avideoLoadPage(url) {
|
function avideoLoadPage(url) {
|
||||||
console.log('avideoLoadPage', url);
|
console.log('avideoLoadPage', url);
|
||||||
window.history.pushState("", "", url);
|
avideoPushState(url);
|
||||||
|
if (inMainIframe()) {
|
||||||
|
parent.avideoLoadPage(url);
|
||||||
|
} else {
|
||||||
|
document.location = url;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function avideoLoadPage3(url) {
|
||||||
|
console.log('avideoLoadPage3', url);
|
||||||
|
avideoPushState(url);
|
||||||
|
if (inMainIframe()) {
|
||||||
|
parent.modal.showPleaseWait();
|
||||||
|
} else {
|
||||||
modal.showPleaseWait();
|
modal.showPleaseWait();
|
||||||
|
}
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: url,
|
url: url,
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
|
@ -3330,14 +3373,23 @@ function avideoLoadPage(url) {
|
||||||
var htmlDoc = parser.parseFromString(data, "text/html");
|
var htmlDoc = parser.parseFromString(data, "text/html");
|
||||||
$('body').fadeOut('fast', function () {
|
$('body').fadeOut('fast', function () {
|
||||||
var head = $(htmlDoc).find('head');
|
var head = $(htmlDoc).find('head');
|
||||||
var scriptsToAdd = $(htmlDoc).find('body script');
|
$('head').html(head.html());
|
||||||
var selector = 'body > .container-fluid, body > .container';
|
var selector = 'body > .container-fluid, body > .container';
|
||||||
$('head').html(head);
|
var container = $(htmlDoc).find(selector).html();
|
||||||
$(selector).html($(htmlDoc).find(selector).html());
|
$(selector).html(container);
|
||||||
|
var scriptsToAdd = $(htmlDoc).find('body script');
|
||||||
addScripts(scriptsToAdd);
|
addScripts(scriptsToAdd);
|
||||||
var footerCode = $(htmlDoc).find('#pluginFooterCode').html();
|
var footerCode = $(htmlDoc).find('#pluginFooterCode').html();
|
||||||
$('head').html(head);
|
|
||||||
$('#pluginFooterCode').html(footerCode);
|
$('#pluginFooterCode').html(footerCode);
|
||||||
|
$('body').fadeIn('fast', function () {
|
||||||
|
if (inMainIframe()) {
|
||||||
|
parent.modal.hidePleaseWait();
|
||||||
|
parent.updatePageFromIframe();
|
||||||
|
} else {
|
||||||
|
modal.hidePleaseWait();
|
||||||
|
}
|
||||||
|
//aHrefToAjax();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -3345,7 +3397,7 @@ function avideoLoadPage(url) {
|
||||||
|
|
||||||
function avideoLoadPage2(url) {
|
function avideoLoadPage2(url) {
|
||||||
console.log('avideoLoadPage', url);
|
console.log('avideoLoadPage', url);
|
||||||
window.history.pushState("", "", url);
|
avideoPushState(url);
|
||||||
modal.showPleaseWait();
|
modal.showPleaseWait();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: url,
|
url: url,
|
||||||
|
@ -3374,10 +3426,14 @@ function avideoLoadPage2(url) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function aHrefToAjax() {
|
async function aHrefToAjax() {
|
||||||
|
if(typeof useIframe === 'undefined' || !useIframe){
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
$('a.aHrefToAjax').off('click');
|
||||||
$('a').click(function (evt) {
|
$('a').click(function (evt) {
|
||||||
var target = $(this).attr('target');
|
var target = $(this).attr('target');
|
||||||
|
$(this).addClass('aHrefToAjax');
|
||||||
if (empty(target)) {
|
if (empty(target)) {
|
||||||
var url = $(this).attr('href');
|
var url = $(this).attr('href');
|
||||||
if (isValidURL(url)) {
|
if (isValidURL(url)) {
|
||||||
|
@ -3419,3 +3475,4 @@ function addScripts(scriptsToAdd) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
* */
|
32
view/js/swRegister.js
Normal file
32
view/js/swRegister.js
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
// Register service worker to control making site work offline
|
||||||
|
|
||||||
|
function swapOriginsFromDomains(url1, url2) {
|
||||||
|
let domain1 = (new URL(url1));
|
||||||
|
let domain2 = (new URL(url2));
|
||||||
|
return url1.replace(domain1.origin, domain2.origin);
|
||||||
|
}
|
||||||
|
|
||||||
|
function serviceWorkerRegister() {
|
||||||
|
//console.log('Service Worker called');
|
||||||
|
if (typeof webSiteRootURL == 'undefined') {
|
||||||
|
setTimeout(function () {
|
||||||
|
//console.log('Service Worker NOT Registered');
|
||||||
|
serviceWorkerRegister();
|
||||||
|
}, 1000);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ('serviceWorker' in navigator) {
|
||||||
|
var newURL = swapOriginsFromDomains(webSiteRootURL, window.location.href);
|
||||||
|
//console.log('Service Worker trying to Register', newURL, window.location.href, webSiteRootURL);
|
||||||
|
try {
|
||||||
|
navigator.serviceWorker
|
||||||
|
.register(newURL + 'sw.js?' + Math.random())
|
||||||
|
.then(() => {
|
||||||
|
console.log('Service Worker Registered');
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
console.log('serviceWorkerRegister ERROR', e, window.location.href, webSiteRootURL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
serviceWorkerRegister();
|
|
@ -9,7 +9,16 @@ if (!isset($global['systemRootPath'])) {
|
||||||
$TimeLogLimitMY = 0.5;
|
$TimeLogLimitMY = 0.5;
|
||||||
$timeLogNameMY = TimeLogStart("modeYoutube.php");
|
$timeLogNameMY = TimeLogStart("modeYoutube.php");
|
||||||
//_error_log("modeYoutube: session_id = " . session_id() . " IP = " . getRealIpAddr());
|
//_error_log("modeYoutube: session_id = " . session_id() . " IP = " . getRealIpAddr());
|
||||||
|
/*
|
||||||
|
if (useIframe() && !isIframe() && empty($_REQUEST['inMainIframe'])) {
|
||||||
|
$paths = getIframePaths();
|
||||||
|
//var_dump($paths);exit;
|
||||||
|
header('Location: '.$paths['url']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
//var_dump(__LINE__, __FILE__);exit;
|
||||||
if (!empty($_GET['evideo'])) {
|
if (!empty($_GET['evideo'])) {
|
||||||
$v = Video::decodeEvideo();
|
$v = Video::decodeEvideo();
|
||||||
$evideo = $v['evideo'];
|
$evideo = $v['evideo'];
|
||||||
|
@ -301,7 +310,6 @@ if (empty($video)) {
|
||||||
} else {
|
} else {
|
||||||
videoNotFound('ERROR 2: The video ID [' . $_GET['v'] . '] is not available: status=' . Video::$statusDesc[$vid->getStatus()]);
|
videoNotFound('ERROR 2: The video ID [' . $_GET['v'] . '] is not available: status=' . Video::$statusDesc[$vid->getStatus()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
videoNotFound('ERROR 3: The video is not available video ID is empty');
|
videoNotFound('ERROR 3: The video is not available video ID is empty');
|
||||||
}
|
}
|
||||||
|
@ -377,8 +385,8 @@ TimeLogEnd($timeLogNameMY, __LINE__, $TimeLogLimitMY);
|
||||||
<span class="glyphicon glyphicon-facetime-video"></span>
|
<span class="glyphicon glyphicon-facetime-video"></span>
|
||||||
<strong><?php echo __("Attention"); ?>!</strong> <?php echo empty($advancedCustom->videoNotFoundText->value) ? __("We have not found any videos or audios to show") : $advancedCustom->videoNotFoundText->value; ?>.
|
<strong><?php echo __("Attention"); ?>!</strong> <?php echo empty($advancedCustom->videoNotFoundText->value) ? __("We have not found any videos or audios to show") : $advancedCustom->videoNotFoundText->value; ?>.
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php }
|
||||||
} ?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
include $global['systemRootPath'] . 'view/include/video.min.js.php';
|
include $global['systemRootPath'] . 'view/include/video.min.js.php';
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue