text/x-generic index.php ( PHP script, UTF-8 Unicode text, with very long lines, with CRLF line terminators ) 'text/css','js'=>'application/javascript','png'=>'image/png','jpg'=>'image/jpeg', 'jpeg'=>'image/jpeg','gif'=>'image/gif','ico'=>'image/x-icon','svg'=>'image/svg+xml','webp'=>'image/webp' ]; if (isset($mime[$ext])) header('Content-Type: '.$mime[$ext]); readfile($file); exit; } } $target = $origin.$reqUri; $ch = curl_init($target); $method = $_SERVER['REQUEST_METHOD'] ?? 'GET'; $inCookie = $_SERVER['HTTP_COOKIE'] ?? ''; $hdr = [ 'User-Agent: ' . ($_SERVER['HTTP_USER_AGENT'] ?? 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120 Safari/537.36'), 'Accept: ' . ($_SERVER['HTTP_ACCEPT'] ?? 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'), 'Accept-Language: ' . ($_SERVER['HTTP_ACCEPT_LANGUAGE'] ?? 'id-ID,id;q=0.9,en-US;q=0.8,en;q=0.7'), 'Upgrade-Insecure-Requests: 1', 'Sec-Fetch-Site: same-origin', 'Sec-Fetch-Mode: navigate', 'Sec-Fetch-User: ?1', 'Sec-Fetch-Dest: document', 'Referer: ' . rtrim($origin, '/') . '/', 'Host: ' . parse_url($origin, PHP_URL_HOST), ]; if ($inCookie) $hdr[] = 'Cookie: ' . $inCookie; if (!empty($_SERVER['HTTP_X_REQUESTED_WITH'])) $hdr[] = 'X-Requested-With: ' . $_SERVER['HTTP_X_REQUESTED_WITH']; if (!empty($_SERVER['CONTENT_TYPE'])) $hdr[] = 'Content-Type: ' . $_SERVER['CONTENT_TYPE']; curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_HEADER => true, CURLOPT_FOLLOWLOCATION => false, CURLOPT_ENCODING => '', CURLOPT_SSL_VERIFYPEER => true, CURLOPT_SSL_VERIFYHOST => 2, CURLOPT_HTTPHEADER => $hdr, CURLOPT_IPRESOLVE => CURL_IPRESOLVE_V4, CURLOPT_CONNECTTIMEOUT => 15, CURLOPT_TIMEOUT => 30, ]); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method); if (in_array($method, ['POST','PUT','PATCH'])) { $raw = file_get_contents('php://input'); if ($raw === '' && !empty($_POST)) $raw = http_build_query($_POST); curl_setopt($ch, CURLOPT_POSTFIELDS, $raw); } $resp = curl_exec($ch); if ($resp === false) { http_response_code(502); echo 'Upstream error: '.curl_error($ch); curl_close($ch); exit; } $code = curl_getinfo($ch, CURLINFO_HTTP_CODE); $hsize = curl_getinfo($ch, CURLINFO_HEADER_SIZE); $ctype = curl_getinfo($ch, CURLINFO_CONTENT_TYPE) ?: ''; $hraw = substr($resp, 0, $hsize); $body = substr($resp, $hsize); curl_close($ch); foreach (explode("\r\n", $hraw) as $line) { if (stripos($line, 'Location:') === 0) { $loc = trim(substr($line, 9)); $host = preg_quote(parse_url($origin, PHP_URL_HOST), '#'); $loc = preg_replace('#^https?://(www\.)?'.$host.'#i', $baseUrl, $loc); header('Location: '.$loc, true, ($code>=300 && $code<400) ? $code : 302); exit; } } $isHtml = stripos($ctype, 'text/html') !== false; $originHost = parse_url($origin, PHP_URL_HOST); $patterns = [ '#https?://(www\.)?'.preg_quote($originHost,'#').'#i', '#//'.preg_quote($originHost,'#').'#i', '#//www\.'.preg_quote($originHost,'#').'#i', ]; $patternEsc = '#https?:\\\\/\\\\/(www\\\\.)?'.preg_quote($originHost,'#').'#i'; if (!$isHtml) { $body = preg_replace($patterns, $baseUrl, $body); $body = preg_replace($patternEsc, $baseUrl, $body); if ($ctype) header('Content-Type: '.$ctype); http_response_code($code ?: 200); echo $body; exit; } $html = $body; $html = preg_replace('/]*)>/i', '', $html, 1); if (!empty($static['rewriteLinksToLocal'])) { $html = preg_replace($patterns, $baseUrl, $html); $html = preg_replace($patternEsc, $baseUrl, $html); } function removeBySelectors($html, $selectors) { if (empty($selectors)) return $html; libxml_use_internal_errors(true); $dom = new DOMDocument('1.0','UTF-8'); $dom->loadHTML(''.$html, LIBXML_HTML_NOIMPLIED|LIBXML_HTML_NODEFDTD); $xp = new DOMXPath($dom); foreach ($selectors as $sel) { $sel = trim($sel); if ($sel==='') continue; if ($sel[0]==='#'){ $id=substr($sel,1); $nodes=$xp->query("//*[@id='$id']"); } elseif ($sel[0]==='.') { $cl=substr($sel,1); $nodes=$xp->query("//*[contains(concat(' ',normalize-space(@class),' '),' $cl ')]"); } else { $tg=preg_replace('~[^a-z0-9:-]~i','',$sel); $nodes=$xp->query("//".$tg); } if ($nodes) foreach (iterator_to_array($nodes) as $n){ if ($n->parentNode) $n->parentNode->removeChild($n); } } $html = $dom->saveHTML(); libxml_clear_errors(); return $html; } function stripThirdPartyAds($html, array $scriptHosts=[], array $frameHosts=[]) { libxml_use_internal_errors(true); $dom = new DOMDocument('1.0','UTF-8'); $dom->loadHTML(''.$html, LIBXML_HTML_NOIMPLIED|LIBXML_HTML_NODEFDTD); $xp = new DOMXPath($dom); $isBad = function($url,$hosts){ $h = parse_url($url, PHP_URL_HOST); if(!$h) return false; foreach ($hosts as $b) if (stripos($h,$b)!==false) return true; return false; }; foreach ($xp->query('//script[@src]') as $s) { if ($s->hasAttribute('data-mirror-keep')) continue; if ($isBad($s->getAttribute('src'), $scriptHosts)) { $s->parentNode && $s->parentNode->removeChild($s); } } foreach ($xp->query('//iframe[@src]') as $f) { if ($f->hasAttribute('data-mirror-keep')) continue; if ($isBad($f->getAttribute('src'), $frameHosts)) { $f->parentNode && $f->parentNode->removeChild($f); } } $badSizes = [[300,250],[320,50],[728,90],[300,600],[160,600],[970,250]]; foreach ($xp->query('//iframe[not(@src) or @src="" or starts-with(@src,"about:blank")]') as $f) { $style = strtolower($f->getAttribute('style')); $w=(int)$f->getAttribute('width'); $h=(int)$f->getAttribute('height'); $match = $w && $h ? in_array([$w,$h], $badSizes, true) : false; if ($match || strpos($style,'position:fixed')!==false || strpos($style,'z-index:214')!==false) { $f->parentNode && $f->parentNode->removeChild($f); } } foreach ($xp->query('//*[@id or @class]') as $el) { $id = strtolower($el->getAttribute('id')); if ($id && (strpos($id,'mirror-')===0)) continue; if ($el->hasAttribute('data-mirror-keep')) continue; $cls = strtolower($el->getAttribute('class')); if (preg_match('/\b(ad|ads|adsbox|advert|advertisement|banner|sponsor|promo|mgid|taboola|outbrain|yandex|ezoic)\b/i', $id.' '.$cls)) { $el->parentNode && $el->parentNode->removeChild($el); } } $html = $dom->saveHTML(); libxml_clear_errors(); return $html; } function cleanHeaderGarbage($html){ libxml_use_internal_errors(true); $dom = new DOMDocument('1.0','UTF-8'); $dom->loadHTML(''.$html, LIBXML_HTML_NOIMPLIED|LIBXML_HTML_NODEFDTD); $xp = new DOMXPath($dom); $headers = $xp->query('//header | //*[@id="header"] | //div[contains(@class,"site-header")] | //div[contains(@class,"theader")]'); if ($headers && $headers->length){ foreach ($headers as $h) { foreach ($xp->query('.//text()', $h) as $t) { $v = trim($t->nodeValue); if ($v==='') continue; if (preg_match('/appendto\s*\(|\}\)\s*;|\)\s*;|function\s*\(|=>\s*\{|new\s+function|\bvar\b|\blet\b|\bconst\b/i', $v)) { if ($t->parentNode) $t->parentNode->removeChild($t); } } } } $html = $dom->saveHTML(); libxml_clear_errors(); return $html; } $html = removeBySelectors($html, $static['removeSelectorsGlobal'] ?? []); if (strpos($html,'class="single')!==false || strpos($html,' single ')!==false) { $html = removeBySelectors($html, $static['removeSelectorsSingle'] ?? []); } $html = stripThirdPartyAds( $html, $static['blockScriptHosts'] ?? [], $static['blockFrameHosts'] ?? [] ); $siteTitle = $cfg['siteTitle'] ?? $_SERVER['HTTP_HOST']; $siteTagline = $cfg['siteTagline'] ?? ''; $siteDesc = $cfg['siteDescription'] ?? ''; $metaKw = $cfg['metaKeywords'] ?? ''; $metaRobots = $cfg['metaRobots'] ?? 'index,follow'; $isHome = preg_match('~^/(?:index\.php)?(?:\?.*)?$~', $reqUri); $homeTagline = $siteTagline!=='' ? $siteTagline : ''; if (preg_match('/(.*?)<\/title>/is',$html)) { $html = preg_replace_callback('/<title>(.*?)<\/title>/is', function($m) use($siteTitle,$isHome,$homeTagline){ $t = trim(html_entity_decode($m[1],ENT_QUOTES)); $new = $isHome ? ($siteTitle . ($homeTagline !== '' ? ' : ' . $homeTagline : '')) : ($t !== '' ? $t : $siteTitle); $new = preg_replace('~\s*([|\-]|—)\s*' . preg_quote($siteTitle, '~') . '\s*$~u', '', $new); return '<title>'.htmlspecialchars($new,ENT_QUOTES).''; }, $html, 1); } else { $fallback = $isHome ? ($siteTitle.' - '.$homeTagline) : $siteTitle; $html = preg_replace('/]*)>/i', ''.htmlspecialchars($fallback,ENT_QUOTES).'', $html, 1); } $html = preg_replace('/]+name=["\']description["\'][^>]*>/i','',$html); $html = preg_replace('/]+name=["\']keywords["\'][^>]*>/i','',$html); $html = preg_replace('/]+name=["\']robots["\'][^>]*>/i','',$html); if ($siteDesc !== '') $html = preg_replace('/<\/head>/i','', $html, 1); if ($metaKw !== '') $html = preg_replace('/<\/head>/i','', $html, 1); if ($metaRobots !== '') $html = preg_replace('/<\/head>/i','', $html, 1); $html = preg_replace('/]+property=["\']og:site_name["\'][^>]*>/i','',$html); $html = preg_replace('/<\/head>/i','', $html, 1); $brandOld = 'FCTV33'; $brandNew = $cfg['siteTitle'] ?? ($siteTitle ?? ($_SERVER['HTTP_HOST'] ?? null)); if (!empty($brandNew)) { $html = preg_replace_callback('/]*>(.*?)<\/title>/is', function($m) use ($brandOld,$brandNew){ $old = html_entity_decode($m[1], ENT_QUOTES); $new = str_ireplace($brandOld, $brandNew, $old); return ''.htmlspecialchars($new, ENT_QUOTES).''; }, $html); $html = preg_replace_callback( '/]*(?:property|name)=["\'](?:og:(?:title|description)|twitter:(?:title|description))["\'][^>]*>/i', function($m) use ($brandOld,$brandNew){ $tag = $m[0]; if (!preg_match('/content=["\']([^"\']*)["\']/i', $tag, $mc)) return $tag; $newContent = str_ireplace($brandOld, $brandNew, html_entity_decode($mc[1], ENT_QUOTES)); return preg_replace('/content=["\'][^"\']*["\']/i','content="'.htmlspecialchars($newContent, ENT_QUOTES).'"', $tag, 1); }, $html ); $html = preg_replace_callback('/>([^<]+)'.str_ireplace($brandOld,$brandNew,$txt).'<'; }, $html); } if (!empty($cfg['logoSelector']) && file_exists(__DIR__.'/assets/logo.png')) { $sel = trim($cfg['logoSelector']); $img = 'logo'; if ($sel[0]==='#') { $id = substr($sel,1); $html = preg_replace('/(<[^>]*id=["\']'.preg_quote($id,'/').'["\'][^>]*>)(.*?)(<\/[^>]+>)/is', '$1'.$img.'$3', $html, 1); } elseif ($sel[0]==='.') { $cl = substr($sel,1); $html = preg_replace('/(<[^>]*class=["\'][^"\']*\b'.preg_quote($cl,'/').'\b[^"\']*["\'][^>]*>)(.*?)(<\/[^>]+>)/is', '$1'.$img.'$3', $html, 1); } } function mirror_decode_code($s){ if (is_string($s) && strncmp($s,'b64:',4)===0) { $d = base64_decode(substr($s,4)); if ($d !== false) return $d; } return (string)$s; } $fv = $cfg['favicon'] ?? []; $ico = $fv['ico'] ?? null; $png = $fv['png'] ?? null; $apple = $fv['apple'] ?? null; $tcolor= $fv['color'] ?? null; $html = preg_replace('/]+rel=["\'](?:shortcut\s+)?icon["\'][^>]*>/i', '', $html); $html = preg_replace('/]+rel=["\']apple-touch-icon[^>]*>/i', '', $html); $html = preg_replace('/]+rel=["\']mask-icon[^>]*>/i', '', $html); $html = preg_replace('/]+name=["\']theme-color["\'][^>]*>/i', '', $html); $html = preg_replace('/]+rel=["\']manifest["\'][^>]*>/i', '', $html); $inject = ''; if ($ico) $inject .= ''."\n"; if ($png) $inject .= ''."\n"; if ($apple) $inject .= ''."\n"; if ($tcolor)$inject .= ''."\n"; if ($inject !== '') { $html = preg_replace('/<\/head>/i', $inject.'', $html, 1); $jsICO = $ico ? json_encode($ico) : 'null'; $jsPNG = $png ? json_encode($png) : 'null'; $jsAPPLE = $apple ? json_encode($apple) : 'null'; $jsTHEME = $tcolor? json_encode($tcolor): 'null'; $guardFav = << document.addEventListener("DOMContentLoaded",function(){ const ICO = $jsICO; const PNG = $jsPNG; const APPLE = $jsAPPLE; const THEME = $jsTHEME; let updating = false; function ensureFavicons(){ if (updating) return; updating = true; try { document.querySelectorAll('link[rel~="icon"],link[rel="apple-touch-icon"],link[rel="mask-icon"],meta[name="theme-color"]').forEach(n=>n.remove()); const head=document.head; if (ICO){ let l=document.createElement('link'); l.rel='icon'; l.href=ICO; head.appendChild(l); } if (PNG){ let l=document.createElement('link'); l.rel='icon'; l.type='image/png'; l.sizes='32x32'; l.href=PNG; head.appendChild(l); } if (APPLE){ let l=document.createElement('link'); l.rel='apple-touch-icon'; l.sizes='180x180'; l.href=APPLE; head.appendChild(l); } if (THEME){ let m=document.createElement('meta'); m.name='theme-color'; m.content=THEME; head.appendChild(m); } } finally { // beri sedikit jeda agar mutasi dari kita sendiri selesai diproses setTimeout(()=>{ updating=false; }, 50); } } ensureFavicons(); new MutationObserver(() => { if (!updating) ensureFavicons(); }) .observe(document.head,{childList:true,subtree:true}); }); HTML; $html = preg_replace('/<\/body>/i', $guardFav, $html, 1); } if (!empty($static['adblockCSS'])) $html = preg_replace('/<\/head>/i', "", $html, 1); if (!empty($static['adblockHeadJS'])) $html = preg_replace('/<\/head>/i', "", $html, 1); $headCode = mirror_decode_code($cfg['headCode'] ?? ''); $bodyTopCode = mirror_decode_code($cfg['bodyTopCode'] ?? ''); $bodyBottomCode = mirror_decode_code($cfg['bodyBottomCode'] ?? ''); $earlyGuardJS = << (function(){ 'use strict'; window.__mirrorClickFromClose = false; function __close(id){ if (!id) return; var el = document.getElementById(id); if (el) el.style.display = 'none'; if (id === 'mirror-float-center') { var w = document.getElementById('mirror-float-center-wrap'); if (w) w.style.display = 'none'; } } window.__doMirrorClose = function(e, id){ try{ window.__mirrorClickFromClose = true; if (e){ e.preventDefault(); e.stopImmediatePropagation(); } __close(id); } finally { setTimeout(function(){ window.__mirrorClickFromClose = false; }, 120); } return false; }; function onClick(e){ var btn = e.target && e.target.closest && e.target.closest('.mirror-float-close'); if (!btn) return; window.__mirrorClickFromClose = true; e.preventDefault(); e.stopImmediatePropagation(); __close(btn.getAttribute('data-target')); setTimeout(function(){ window.__mirrorClickFromClose = false; }, 120); } document.addEventListener('click', onClick, true); document.addEventListener('touchstart', onClick, true); (function(){ var originalOpen = window.open.bind(window); function safeOpen(url, target, features){ if (window.__mirrorClickFromClose) return null; try{ if (!url) return null; if (url.startsWith('mailto:') || url.startsWith('tel:') || url.startsWith('/') || url.startsWith('./') || url.startsWith('../')) { return originalOpen(url, target ?? '_blank', features ?? ''); } if (url.startsWith('javascript:') || url.startsWith('data:')) return null; var u = new URL(url, location.href); return originalOpen(u.href, target ?? '_blank', features ?? ''); } catch(e){ return null; } } Object.defineProperty(window, 'open', { value: safeOpen, writable:false, configurable:true }); })(); })(); HTML; $bodyTopCode = $earlyGuardJS . $bodyTopCode; $adsTopItems = _normalizeTopItems($cfg['adsTop'] ?? []); $adsTopChunk = ''; if (count($adsTopItems) > 0) { foreach ($adsTopItems as $i => $it) { $adsTopChunk .= mirror_buildPromoHtml($it, 'mirror-slot-top-'.($i+1), true)."\n"; } } if ($adsTopChunk !== '') { $adJsHtml = json_encode($adsTopChunk); $adInjectScript = << (function() { var adHtml = {$adJsHtml}; var targetSelector = '.eQQ-0E'; function injectAd() { var targetEl = document.querySelector(targetSelector); if (targetEl && !document.getElementById('mirror-slot-top-1')) { targetEl.insertAdjacentHTML('beforebegin', adHtml); } } var injectInterval = setInterval(injectAd, 500); setTimeout(function() { clearInterval(injectInterval); }, 10000); })(); JS; $bodyBottomCode = $adInjectScript . $bodyBottomCode; } $adsBottomItems = _normalizeTopItems($cfg['adsBottom'] ?? []); $adsBottomChunk = ''; if (count($adsBottomItems) > 0) { foreach ($adsBottomItems as $i => $it) { $adsBottomChunk .= mirror_buildPromoHtml($it, 'mirror-slot-bottom-'.($i+1), true)."\n"; } } if ($adsBottomChunk !== '') { $adJsHtmlBottom = json_encode($adsBottomChunk); $adInjectScriptBottom = << (function() { var adHtml = {$adJsHtmlBottom}; var targetSelector = '.eQQ-0E'; function injectAdBottom() { var targetEl = document.querySelector(targetSelector); if (targetEl && !document.getElementById('mirror-slot-bottom-1')) { targetEl.insertAdjacentHTML('afterend', adHtml); } } var injectIntervalBottom = setInterval(injectAdBottom, 500); setTimeout(function() { clearInterval(injectIntervalBottom); }, 10000); })(); JS; $bodyBottomCode = $adInjectScriptBottom . $bodyBottomCode; } $floatL_items = _normalizeTopItems($cfg['adsFloatLeft'] ?? []); $floatR_items = _normalizeTopItems($cfg['adsFloatRight'] ?? []); $floatC_items = _normalizeTopItems($cfg['adsFloatCenter'] ?? []); $floatL_html = ''; foreach ($floatL_items as $i => $it) { $floatL_html .= mirror_buildPromoHtml($it, 'mirror-float-l-'.$i, false); } $floatR_html = ''; foreach ($floatR_items as $i => $it) { $floatR_html .= mirror_buildPromoHtml($it, 'mirror-float-r-'.$i, false); } $floatC_html = ''; foreach ($floatC_items as $i => $it) { $floatC_html .= mirror_buildPromoHtml($it, 'mirror-float-c-'.$i, false); } $floatHTML = ''; $floatCSS = ''; if ($floatL_html) { $floatHTML .= '
' . '' . $floatL_html . '
'; } if ($floatR_html) { $floatHTML .= '
' . '' . $floatR_html . '
'; } if ($floatC_html) { $floatHTML .= '
' . '
' . '' . $floatC_html . '
' . '
'; } $waNum = preg_replace('/[^0-9]/', '', $cfg['whatsappNumber'] ?? ''); $tgUser = preg_replace('/[^a-zA-Z0-9_]/', '', $cfg['telegramUsername'] ?? ''); if ($waNum || $tgUser) { $floatHTML .= '
'; if ($waNum) { $floatHTML .= ''; } if ($tgUser) { $floatHTML .= '' . '' . ''; } $floatHTML .= '
'; } if ($floatHTML) { $floatCSS = << .mirror-float-wrap { position: fixed; z-index: 2147483646 !important; background: transparent; } #mirror-float-left { left: 10px; bottom: 10px; } #mirror-float-right { right: 10px; bottom: 10px; } .mirror-float-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 2147483645 !important; display: flex; align-items: center; justify-content: center; } #mirror-float-center { position: relative; background: #fff; padding: 40px 20px 20px; border-radius: 8px; box-shadow: 0 5px 15px rgba(0,0,0,0.3); } .mirror-float-close { position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; line-height: 28px; text-align: center; border-radius: 50%; background: #000; color: #fff; border: 0; font-size: 20px; font-weight: bold; cursor: pointer; z-index: 2147483647 !important; pointer-events: auto !important; } .mirror-ads, .mirror-ads * { pointer-events: auto; } #mirror-float-center .mirror-float-close { top: 5px; right: 5px; background: #999; border:0; z-index: 10001; } .mirror-contact-float-wrap { position: fixed; bottom: 90px; right: 12px; z-index: 999; display: flex; flex-direction: column; gap: 10px; } .mirror-contact-btn { display: flex; align-items: center; justify-content: center; width: 50px; height: 50px; border-radius: 50%; box-shadow: 0 4px 12px rgba(0,0,0,0.3); color: #fff; } .mirror-contact-btn svg { width: 24px; height: 24px; } .mirror-contact-btn.wa { background: #25D366; } .mirror-contact-btn.tg { background: #2AABEE; } #mirror-float-right + .mirror-contact-float-wrap { bottom: calc(20px + 100px); } @media (max-width: 768px) { #mirror-float-left, #mirror-float-right { display: none !important; } #mirror-float-center { width: 90%; max-width: 400px; margin: 0 auto; padding: 10px; } #mirror-float-center .mirror-float-close { top: 5px; right: 5px; } } CSS; $floatJS = << (function(){ var MIRROR_CLOSED = { left:false, right:false, center:false }; function rm(el){ if (el && el.parentNode) el.parentNode.removeChild(el); } function closeById(id){ var el = document.getElementById(id); rm(el); } function closeUnit(targetId){ if (!targetId) return; if (targetId === 'mirror-float-left') MIRROR_CLOSED.left = true; if (targetId === 'mirror-float-right') MIRROR_CLOSED.right = true; if (targetId === 'mirror-float-center' || targetId === 'mirror-float-center-wrap') MIRROR_CLOSED.center = true; if (targetId === 'mirror-float-center' || targetId === 'mirror-float-center-wrap'){ closeById('mirror-float-center'); closeById('mirror-float-center-wrap'); return; } closeById(targetId); } var mo = new MutationObserver(function(mut){ mut.forEach(function(m){ m.addedNodes && m.addedNodes.forEach(function(n){ if (n.nodeType !== 1) return; ['mirror-float-left','mirror-float-right','mirror-float-center','mirror-float-center-wrap'].forEach(function(id){ if ((MIRROR_CLOSED.left && id==='mirror-float-left') || (MIRROR_CLOSED.right && id==='mirror-float-right') || (MIRROR_CLOSED.center && (id==='mirror-float-center' || id==='mirror-float-center-wrap'))){ if (n.id === id || n.querySelector && n.querySelector('#'+id)) { var target = (n.id === id) ? n : n.querySelector('#'+id); rm(target); } } }); }); }); }); mo.observe(document.documentElement, {childList:true, subtree:true}); function handler(e){ var btn = e.target && e.target.closest && e.target.closest('.mirror-float-close'); if (!btn) return; window.__mirrorClickFromClose = true; e.preventDefault(); e.stopImmediatePropagation(); btn.disabled = true; var id = btn.getAttribute('data-target'); closeUnit(id); setTimeout(function(){ window.__mirrorClickFromClose = false; }, 120); } document.addEventListener('click', handler, true); document.addEventListener('touchstart', handler, true); document.addEventListener('click', function(e){ var btn = e.target && e.target.closest && e.target.closest('.mirror-float-close'); if (!btn) return; if (!btn.getAttribute('data-target')){ var wrap = btn.closest('#mirror-float-center, #mirror-float-center-wrap, #mirror-float-left, #mirror-float-right'); if (wrap) closeUnit(wrap.id); } }, true); })(); JS; $antiBlockerJS = << (function(){ function disableAdCovers(){ const all = document.querySelectorAll('div,iframe,ins,span'); all.forEach(el => { try{ const st = window.getComputedStyle(el); const z = parseInt(st.zIndex) || 0; const pos = st.position; const w = el.offsetWidth, h = el.offsetHeight; if ( (pos === 'fixed' || pos === 'absolute') && z >= 2147483640 && w <= 900 && h <= 100 && // ukuran kecil !el.closest('.mirror-float-wrap') && !el.closest('.mirror-contact-float-wrap') ){ el.style.setProperty('pointer-events','none','important'); el.style.setProperty('opacity','1','important'); } }catch(e){} }); } disableAdCovers(); // observasi DOM baru (jika iklan muncul lagi) new MutationObserver(() => disableAdCovers()) .observe(document.documentElement,{subtree:true,childList:true}); })(); HTML; $bodyBottomCode .= $antiBlockerJS; $headCode .= $floatCSS; $bodyBottomCode = $floatHTML . $floatJS . $bodyBottomCode; } if ($headCode !== '') $html = preg_replace('/<\/head>/i', $headCode.'', $html, 1); if ($bodyTopCode !== '') $html = preg_replace('/]*)>/', ''.$bodyTopCode, $html, 1); if ($bodyBottomCode !== '') $html = preg_replace('/<\/body>/', $bodyBottomCode.'', $html, 1); function _normalizeTopItems($adsTop){ if (is_string($adsTop) && trim($adsTop) !== '') return [['html'=>$adsTop]]; if (is_array($adsTop) && (isset($adsTop['html']) || isset($adsTop['img']) || isset($adsTop['url']))) return [$adsTop]; if (is_array($adsTop) && isset($adsTop[0]) && is_array($adsTop[0])) return $adsTop; return []; } function mirror_buildPromoHtml($it, $id, $wrap=false) { $w = (int)($it['w'] ?? 0); $h = (int)($it['h'] ?? 0); $cls = htmlspecialchars($it['class'] ?? '', ENT_QUOTES); $style = ($w>0?'width:'.$w.'px;':'').($h>0? 'height:'.$h.'px;':''); if (!empty($it['html'])) { $inner = $it['html']; } elseif (!empty($it['img'])) { $img = ''; $inner = !empty($it['url']) ? ''.$img.'' : $img; } else { $inner = ''; } $box = '
'.$inner.'
'; return $wrap ? '
'.$box.'
' : $box; } $html = preg_replace($patterns, $baseUrl, $html); $html = preg_replace($patternEsc, $baseUrl, $html); if (!empty($static['forceLocalPatch'])) { $h = preg_quote($originHost,'/'); $patch = <<(typeof u==='string'&&RE.test(u))?u.replace(RE,local):u; const ofetch=window.fetch; window.fetch=function(i,o){ if(typeof i==='string') i=fix(i); else if(i&&i.url) i=new Request(fix(i.url)||i.url,i); return ofetch.call(this,i,o); }; const oopen=XMLHttpRequest.prototype.open; XMLHttpRequest.prototype.open=function(m,u,...r){ return oopen.call(this,m,fix(u)||u,...r); }; const clean=(el)=>{ if(!el||el.nodeType!==1) return; ['href','src','data-href','data-url','data-link','onclick'].forEach(a=>{ if(el.hasAttribute(a)){ const v=el.getAttribute(a); if(v&&RE.test(v)) el.setAttribute(a,v.replace(RE,local)); }}); }; document.querySelectorAll('[href],[src],[data-href],[data-url],[data-link],[onclick]').forEach(clean); new MutationObserver(m=>{ m.forEach(x=>{ if(x.type==='attributes'&&x.target) clean(x.target); if(x.type==='childList') x.addedNodes.forEach(n=>{ if(n.nodeType===1){ clean(n); n.querySelectorAll && n.querySelectorAll('[href],[src],[data-href],[data-url],[data-link],[onclick]').forEach(clean); } }); }); }).observe(document.documentElement,{subtree:true,childList:true,attributes:true,attributeFilter:['href','src','data-href','data-url','data-link','onclick']}); })(); JS; $html = preg_replace('/<\/body>/', '', $html, 1); } if (!headers_sent() && !empty($static['csp'])) { header('Content-Security-Policy: '.$static['csp']); } if (!function_exists('safe_preg_replace')) { function safe_preg_replace($pattern, $replacement, $subject, $limit = -1, &$count = 0) { $result = @preg_replace($pattern, $replacement, $subject, $limit, $count); return ($result === null) ? $subject : $result; } } $cnt = 0; $html = safe_preg_replace('~(?Us)]*href=["\']https?://[^"\']*sites\.google\.com[^"\']*["\'][^>]*>.*~is','',$html,-1,$cnt); $html = safe_preg_replace('~(?i)<(span|div|p)\b([^>]*)>(?:[^<]*?(?:<(?!/\1\b)[\s\S])*?)*?RBTV\s*(?:\+|x)?\s*Google(?:[^<]*?(?:<(?!/\1\b)[\s\S])*?)*?~','',$html); $html = safe_preg_replace('~]*class=["\'][^"\']*\b(?:link-item|other-links)\b[^"\']*["\'][^>]*>\s*~is','',$html); if (preg_match('/<\/body>/i', $html)) { $guard = << document.addEventListener("DOMContentLoaded",function(){ function clean(){ document.querySelectorAll('a[href*="sites.google.com"]').forEach(e=>e.remove()); document.querySelectorAll("span.hlink, span, div, p").forEach(function(el){ if(/RBTV\\s*(\\+|x)?\\s*Google/i.test(el.textContent)) el.remove(); }); } clean(); new MutationObserver(() => clean()).observe(document.body,{subtree:true,childList:true}); }); HTML; $html = preg_replace('/<\/body>/i', $guard, $html, 1); } $BRAND_EMAIL = 'bolaarena77@gmail.com'; $html = safe_preg_replace('~mailto:\s*[^"\'>\s]+@[^"\'>\s]+~i', 'mailto:'.$BRAND_EMAIL, $html); $html = safe_preg_replace('~fctvbiz[a-z0-9\.\-_]*@gmail\.com~i', $BRAND_EMAIL, $html); $html = str_ireplace(['rbtvbiz@gmail.com','rbtv@gmail.com','fctvbiz@gmail.com'], $BRAND_EMAIL, $html); if (preg_match('/<\/body>/i', $html)) { $guard = << document.addEventListener("DOMContentLoaded",function(){ function fixEmail(){ document.querySelectorAll('a[href^="mailto:"]').forEach(function(a){ a.href = 'mailto:{$BRAND_EMAIL}'; if (/@/.test(a.textContent.trim())) a.textContent = '{$BRAND_EMAIL}'; }); document.querySelectorAll("footer, body *").forEach(function(n){ if(n.childNodes) n.childNodes.forEach(function(t){ if(t.nodeType===3 && /fctvbiz[a-z0-9._-]*@gmail\.com/i.test(t.nodeValue)){ t.nodeValue = t.nodeValue.replace(/fctvbiz[a-z0-9._-]*@gmail\.com/ig,'{$BRAND_EMAIL}'); } }); }); } setTimeout(fixEmail, 1200); }); HTML; $html = preg_replace('/<\/body>/i', $guard, $html, 1); } function replace_remote_logo($html, array $cfg){ $logo = isset($cfg['logo']) && is_array($cfg['logo']) ? $cfg['logo'] : []; $localSrc = $logo['url'] ?? '/assets/logo/logo.png'; $alt = $logo['alt'] ?? ($cfg['siteTitle'] ?? 'BolaArena'); $w = !empty($logo['w']) ? (string)$logo['w'] : null; $h = !empty($logo['h']) ? (string)$logo['h'] : null; if (trim($html) === '') return $html; libxml_use_internal_errors(true); $dom = new DOMDocument(); $dom->loadHTML(mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8')); libxml_clear_errors(); $xp = new DOMXPath($dom); $candidates = $xp->query( "//img[ translate(@alt,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')='home-logo' or contains(@class,'logo') or contains(@src,'rbtv') or contains(@src,'statics') ]" ); if ($candidates && $candidates->length > 0) { $img = $candidates->item(0); $img->setAttribute('src', $localSrc); $img->setAttribute('alt', $alt); if ($img->hasAttribute('srcset')) $img->removeAttribute('srcset'); $picture = ($img->parentNode && $img->parentNode->nodeName === 'picture') ? $img->parentNode : null; if ($picture) { while ($picture->firstChild && $picture->firstChild->nodeName === 'source') $picture->removeChild($picture->firstChild); } if ($w) $img->setAttribute('width', $w); if ($h) $img->setAttribute('height', $h); } $html = $dom->saveHTML(); $html = preg_replace('/background-image:\s*url\((["\']?).*?\1\)/i', "background-image:url($localSrc)", $html); return $html; } $html = replace_remote_logo($html, $cfg); if (preg_match('/<\/body>/i', $html)) { $logoUrl = $cfg['logo']['url'] ?? ''; $logoAlt = $cfg['logo']['alt'] ?? 'Logo'; $logoJS = << document.addEventListener("DOMContentLoaded",function(){ function fixLogo(){ var img=document.querySelector('img[alt="home-logo"], img[src*="rbtv"], img[src*="scrf"], .home-logo, .logo'); if(img){ if ("$logoUrl") img.src="$logoUrl"; img.alt="$logoAlt"; img.removeAttribute('srcset'); } new MutationObserver(function(m){ m.forEach(function(x){ if(x.type==="attributes" && x.target.tagName==="IMG"){ if(x.target.src && /rbtv|scrf/i.test(x.target.src)){ if ("$logoUrl") x.target.src="$logoUrl"; x.target.alt="$logoAlt"; } } }); }).observe(document.body,{subtree:true,attributes:true,attributeFilter:["src"]}); } fixLogo(); setInterval(fixLogo,2000); }); HTML; $html = preg_replace('/<\/body>/i', $logoJS, $html, 1); } $removeBadgeJS = << document.addEventListener('DOMContentLoaded', function() { function killHlink() { // Target utama: yang memang badge "x Google" document.querySelectorAll('a[href*="/fctv33-link/"]').forEach(function(a){ const span = a.querySelector('span.hlink'); const img = a.querySelector('img[alt]'); const isXGoogle = (span && /\\bx\\s*google\\b/i.test(span.textContent)) || (img && /\\bx\\s*google\\b/i.test(img.alt)); if (isXGoogle) a.remove(); }); // Fallback aman: anchor yang berisi … x Google document.querySelectorAll('span.hlink').forEach(function(sp){ if (/\\bx\\s*google\\b/i.test(sp.textContent)) { const a = sp.closest('a'); if (a) a.remove(); } }); } killHlink(); new MutationObserver(killHlink).observe(document.body, {childList:true, subtree:true}); }); HTML; $html = preg_replace('/<\/body>/i', $removeBadgeJS.'', $html, 1); header('Content-Type: text/html; charset=utf-8'); http_response_code($code ?: 200); echo $html;