1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-06 03:50:04 +02:00

Improve ad blocker

This commit is contained in:
Daniel Neto 2024-04-22 16:06:38 -03:00
parent 42420af7c8
commit fe3de2fd2e
6 changed files with 114 additions and 78 deletions

View file

@ -6988,7 +6988,10 @@ function getActivationCode()
function fix_parse_url($url, $parameter) function fix_parse_url($url, $parameter)
{ {
$cleanParameter = str_replace('.', '_', $parameter); $cleanParameter = str_replace('.', '_', $parameter);
return str_replace("{$cleanParameter}=", "{$parameter}=", $url); //var_dump("{$cleanParameter}%3D", "{$parameter}%3D", $url);
$url = str_replace("{$cleanParameter}%3D", "{$parameter}%3D", $url);
$url = str_replace("{$cleanParameter}=", "{$parameter}=", $url);
return $url;
} }
function generateHorizontalFlickity($items) function generateHorizontalFlickity($items)

View file

@ -37,8 +37,11 @@ class AdBlockerDetector extends PluginAbstract
public function getStart() public function getStart()
{ {
if (!empty($_REQUEST["adBlockerDetected"])) { global $global;
forbiddenPage("We've detected that you're using an ad blocker. This content is accessible when no ad blocker is detected."); if (!empty($_REQUEST["adBDetec"]) && empty($global['ignoreAdBlocker'])) {
$global['ignoreAdBlocker'] = 1;
require_once "{$global['systemRootPath']}plugin/AdBlockerDetector/index.php";
exit;
} }
} }
@ -46,17 +49,18 @@ class AdBlockerDetector extends PluginAbstract
{ {
global $global, $config; global $global, $config;
$js = ''; $js = '';
if (empty($_REQUEST["adBlockerDetected"])) { if(empty($global['ignoreAdBlocker'])){
if (empty($_REQUEST["adBDetec"])) {
$js .= '<script src="' . getURL('node_modules/blockadblock/blockadblock.js') . '" type="text/javascript"></script>'; $js .= '<script src="' . getURL('node_modules/blockadblock/blockadblock.js') . '" type="text/javascript"></script>';
$js .= '<script src="' . getURL('plugin/AdBlockerDetector/script.js') . '" type="text/javascript"></script>'; $js .= '<script src="' . getURL('plugin/AdBlockerDetector/script.js') . '" type="text/javascript"></script>';
$js .= "<script> $js .= "<script>
function reloadWithAdBlockerDetected() { function reloadWithadBDetec() {
var currentUrl = window.location.href; var currentUrl = window.location.href;
if (currentUrl.indexOf('?') === -1) { if (currentUrl.indexOf('?') === -1) {
currentUrl += '?adBlockerDetected=true'; currentUrl += '?adBDetec=1';
} else { } else {
currentUrl += '&adBlockerDetected=true'; currentUrl += '&adBDetec=1';
} }
window.location.href = currentUrl; window.location.href = currentUrl;
} }
@ -64,7 +68,7 @@ class AdBlockerDetector extends PluginAbstract
modal.showPleaseWait(); modal.showPleaseWait();
avideoToastError('Ad Blocker detected'); avideoToastError('Ad Blocker detected');
$('.container, .container-fluid').html(''); $('.container, .container-fluid').html('');
reloadWithAdBlockerDetected(); reloadWithadBDetec();
} }
if(typeof blockAdBlock === 'undefined') { if(typeof blockAdBlock === 'undefined') {
avideoToastError('Ad Blocker file not found'); avideoToastError('Ad Blocker file not found');
@ -79,6 +83,7 @@ class AdBlockerDetector extends PluginAbstract
}else{ }else{
$js .= '<script>history.replaceState(null, null, "'.getRedirectUri().'");</script>'; $js .= '<script>history.replaceState(null, null, "'.getRedirectUri().'");</script>';
} }
}
return $js; return $js;
} }

View file

@ -4,6 +4,34 @@ global $global, $config;
if (!isset($global['systemRootPath'])) { if (!isset($global['systemRootPath'])) {
require_once '../../videos/configuration.php'; require_once '../../videos/configuration.php';
} }
$_GET['redirectUri'] = getRedirectUri();
forbiddenPage("We've detected that you're using an ad blocker. This content is accessible when no ad blocker is detected."); $global['ignoreAdBlocker'] = 1;
$_page = new Page(array('Disable Ad Blocker'));
?>
<div class="container">
<div class="row">
<div class="col-md-6 col-md-offset-3">
<div class="panel panel-danger">
<div class="panel-heading">
<h2>
<i class="fa-solid fa-ban"></i> We see youre using an ad blocker.
</h2>
</div>
<div class="panel-body">
<h3>
<i class="fa-solid fa-handshake"></i> Please help us continue to provide you with free, quality movie and TV streaming by disabling your ad blocker.
</h3>
</div>
<div class="panel-footer">
<button class="btn btn-primary btn-lg btn-block" onclick="location.reload();"><i class="fa fa-refresh"></i> Refresh Page</button>
<p><small><i class="fa fa-info-circle"></i> Please refresh this page once you have disabled the ad blocker.</small></p>
</div>
</div>
</div>
</div>
</div>
<?php
$_page->print();
?> ?>

View file

@ -191,7 +191,7 @@ TimeLogEnd($timelogname, __LINE__);
<link href="<?php echo getURL('view/bootstrap/css/bootstrap.min.css'); ?>" rel="stylesheet" type="text/css"/> <link href="<?php echo getURL('view/bootstrap/css/bootstrap.min.css'); ?>" rel="stylesheet" type="text/css"/>
<link href="<?php echo getURL('node_modules/video.js/dist/video-js.min.css'); ?>" rel="stylesheet" type="text/css"/> <link href="<?php echo getURL('node_modules/video.js/dist/video-js.min.css'); ?>" rel="stylesheet" type="text/css"/>
<link href="<?php echo getCDN(); ?>view/css/social.css" rel="stylesheet" type="text/css"/> <link href="<?php echo getURL('view/css/social.css'); ?>" rel="stylesheet" type="text/css"/>
<link href="<?php echo getURL('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"/>
<link href="<?php echo getCDN(); ?>node_modules/videojs-playlist-ui/dist/videojs-playlist-ui.css" rel="stylesheet"> <link href="<?php echo getCDN(); ?>node_modules/videojs-playlist-ui/dist/videojs-playlist-ui.css" rel="stylesheet">

View file

@ -80,7 +80,7 @@ if(empty($playListData)){
<head> <head>
<title><?php echo $playListObj->getName() . $config->getPageTitleSeparator() . $config->getWebSiteTitle(); ?></title> <title><?php echo $playListObj->getName() . $config->getPageTitleSeparator() . $config->getWebSiteTitle(); ?></title>
<link href="<?php echo getURL('node_modules/video.js/dist/video-js.min.css'); ?>" rel="stylesheet" type="text/css"/> <link href="<?php echo getURL('node_modules/video.js/dist/video-js.min.css'); ?>" rel="stylesheet" type="text/css"/>
<link href="<?php echo getCDN(); ?>view/css/social.css" rel="stylesheet" type="text/css"/> <link href="<?php echo getURL('view/css/social.css'); ?>" rel="stylesheet" type="text/css"/>
<link href="<?php echo getCDN(); ?>node_modules/videojs-playlist-ui/dist/videojs-playlist-ui.css" rel="stylesheet"> <link href="<?php echo getCDN(); ?>node_modules/videojs-playlist-ui/dist/videojs-playlist-ui.css" rel="stylesheet">

View file

@ -15,109 +15,109 @@ ul.social-network li {
} }
/* footer social icons */ /* footer social icons */
.social-network a.icoRss:hover { .social-network .icoRss:hover {
background-color: #F56505; background-color: #F56505;
} }
.social-network a.icoTelegram:hover { .social-network .icoTelegram:hover {
background-color: #26A5E4; background-color: #26A5E4;
} }
.social-network a.icoThreads:hover { .social-network .icoThreads:hover {
background-color: #000; background-color: #000;
} }
.social-network a.icoWhatsapp:hover { .social-network .icoWhatsapp:hover {
background-color: #25D366; background-color: #25D366;
} }
.social-network a.icoInstagram:hover { .social-network .icoInstagram:hover {
background-color: #E4405F; background-color: #E4405F;
} }
.social-network a.icoSpreaker:hover { .social-network .icoSpreaker:hover {
background-color: #FF0000; background-color: #FF0000;
} }
.social-network a.icoFacebook:hover { .social-network .icoFacebook:hover {
background-color: #3B5998; background-color: #3B5998;
} }
.social-network a.icoTwitter:hover { .social-network .icoTwitter:hover {
background-color: #1DA1F2; background-color: #1DA1F2;
} }
.social-network a.icoXTwitter:hover { .social-network .icoXTwitter:hover {
background-color: #000; background-color: #000;
} }
.social-network a.icoGoogle:hover { .social-network .icoGoogle:hover {
background-color: #DB4437; background-color: #DB4437;
} }
.social-network a.icoVimeo:hover { .social-network .icoVimeo:hover {
background-color: #1AB7EA; background-color: #1AB7EA;
} }
.social-network a.icoLinkedIn:hover { .social-network .icoLinkedIn:hover {
background-color: #0077B5; background-color: #0077B5;
} }
.social-network a.icoTumblr:hover { .social-network .icoTumblr:hover {
background-color: #36465D; background-color: #36465D;
} }
.social-network a.icoPinterest:hover { .social-network .icoPinterest:hover {
background-color: #BD081C; background-color: #BD081C;
} }
.social-network a.icoReddit:hover { .social-network .icoReddit:hover {
background-color: #FF4500; background-color: #FF4500;
} }
.social-network a.icoWordpress:hover { .social-network .icoWordpress:hover {
background-color: #21759B; background-color: #21759B;
} }
.social-network a.icoPinboard:hover { .social-network .icoPinboard:hover {
background-color: #0000FF; background-color: #0000FF;
} }
.social-network a.icoCopy:hover { .social-network .icoCopy:hover {
background-color: #333; background-color: #333;
} }
.social-network a.icoGab:hover { .social-network .icoGab:hover {
background-color: #00D178; background-color: #00D178;
} }
.social-network a.icoCloutHub:hover { .social-network .icoCloutHub:hover {
background-color: #F16E28; background-color: #F16E28;
} }
.social-network a.icoYoutube:hover { .social-network .icoYoutube:hover {
background-color: #FF0000; background-color: #FF0000;
} }
.social-network a.icoTikTok:hover { .social-network .icoTikTok:hover {
background-color: #000000; /* TikTok's primary color is black, but sometimes it's represented with a lighter shade or with the blue from its logo */ background-color: #000000; /* TikTok's primary color is black, but sometimes it's represented with a lighter shade or with the blue from its logo */
} }
.social-network a.icoPatreon:hover { .social-network .icoPatreon:hover {
background-color: #F96854; /* Patreon's primary color */ background-color: #F96854; /* Patreon's primary color */
} }
.social-network a.icoAmazon:hover { .social-network .icoAmazon:hover {
background-color: #FF9900; background-color: #FF9900;
} }
.social-network a.icoGoodreads:hover { .social-network .icoGoodreads:hover {
background-color: #372213; background-color: #372213;
} }
.social-network a.icoShopping:hover { .social-network .icoShopping:hover {
background-color: #FF5733; /* This is a price-tag red color */ background-color: #FF5733; /* This is a price-tag red color */
} }
.social-network a.icoCopy:hover { /* for Website */ .social-network .icoCopy:hover { /* for Website */
background-color: #333; /* Using a neutral color since "Website" doesn't have a specific brand color */ background-color: #333; /* Using a neutral color since "Website" doesn't have a specific brand color */
} }
.social-network a.icoApple:hover { .social-network .icoApple:hover {
background-color: #A3AAAE; /* A neutral Apple gray; Apple often uses white, black, or gray for branding */ background-color: #A3AAAE; /* A neutral Apple gray; Apple often uses white, black, or gray for branding */
} }
.social-network a.icoPodcast:hover { .social-network .icoPodcast:hover {
background-color: #FF2D55; /* Using the Apple Podcast color as it's a commonly recognized color for podcasts */ background-color: #FF2D55; /* Using the Apple Podcast color as it's a commonly recognized color for podcasts */
} }
.social-network a.icoIMDB:hover { .social-network .icoIMDB:hover {
background-color: #E6B91E; /* IMDB's golden yellow color */ background-color: #E6B91E; /* IMDB's golden yellow color */
} }
.social-network a.icoRss:hover i, .social-network .icoRss:hover i,
.social-network a.icoFacebook:hover i, .social-network .icoFacebook:hover i,
.social-network a.icoTwitter:hover i, .social-network .icoTwitter:hover i,
.social-network a.icoGoogle:hover i, .social-network .icoGoogle:hover i,
.social-network a.icoVimeo:hover i, .social-network .icoVimeo:hover i,
.social-network a.icoLinkedIn:hover i , .social-network .icoLinkedIn:hover i ,
.social-network a.icoTumblr:hover i , .social-network .icoTumblr:hover i ,
.social-network a.icoPinterest:hover i , .social-network .icoPinterest:hover i ,
.social-network a.icoReddit:hover i , .social-network .icoReddit:hover i ,
.social-network a.icoWordpress:hover i, .social-network .icoWordpress:hover i,
.social-network a.icoPinboard:hover i { .social-network .icoPinboard:hover i {
color: #fff; color: #fff;
} }
a.socialIcon:hover, a.socialIcon:hover,