04-13-2024, 09:48 PM
1

Estás Saliendo V3
Bueno esta es una versión un poco más simplificada, no requiere de la versión anterior (mejorada)
1 - En inc/ext/bbcode.inc.php buscan
Código: ( Seleccionar Todo )
array('tag' => 'url', 'replace' => '<a href="{param}" target="_blank">{param}</a>', 'parse' => false, 'validParam' => $urlValidator),
array('tag' => 'url', 'replace' => '<a href="{option}" target="_blank">{param}</a>', 'option' => true, 'validOption' => $urlValidator),Y lo que haremos es solamente agregar un atributo data-encode="true" y quedaría así
Código: ( Seleccionar Todo )
array('tag' => 'url', 'replace' => '<a href="{param}" target="_blank" data-encode="true">{param}</a>', 'parse' => false, 'validParam' => $urlValidator),
array('tag' => 'url', 'replace' => '<a href="{option}" target="_blank" data-encode="true">{param}</a>', 'option' => true, 'validOption' => $urlValidator),2 - En tutema/js/jquery.plugins.js agregan debajo de todo o en acciones.js/funciones.js esto.
Código: ( Seleccionar Todo )
/* Una versión refactorizada by Miguel92 */
function base64_encode(string) {
let type = "undefined" != typeof window && window.btoa;
return type ? window.btoa(unescape(encodeURIComponent(string))) : Buffer.from(string,"binary").toString("base64");
}
$(document).ready(function(){
$('a[data-encode="true"]').each(function(){
let url = $(this).attr('href');
$(this).attr({
href: `${global_data.url}/go/?p=` + base64_encode(url)
});
});
});3 - En tutema/template/ crean un archivo llamado t.go.tpl y en el agregan (modifique el diseño)
Código: ( Seleccionar Todo )
<style>
*, *::after, *::before {
padding: 0;
margin: 0;
box-sizing: border-box;
border-radius: .325rem;
}
body {
display: flex;
justify-content: center;
align-items: center;
background-color: #F4F4F4;
font: normal normal 500 1rem/1.5rem 'Roboto', sans-serif;
}
.leaving-wrapper {
padding: 3rem 1rem;
background-color: #FFF;
width: 50%;
box-shadow: 0 0 2rem rgba(0,0,0,.4);
border: 3px solid #36BC6C;
text-align: center;
}
.leaving-wrapper h1 {
padding: 0.785rem;
}
.leaving-wrapper p {
margin: 1rem 0;
}
.leaving-wrapper .buttons {
display: flex;
justify-content: center;
align-items: center;
gap: 1rem;
}
.leaving-wrapper .buttons a {
display: block;
text-align: center;
text-decoration: none;
padding: 0.25rem 0.875rem;
color: #333;
background-color: #D3FFE1;
}
.leaving-wrapper .buttons a:hover {
background-color: #C5E7D0;
}
.leaving-wrapper .buttons a:first-child {
background-color: #25BE54;
color: #FFF;
}
.leaving-wrapper .buttons a:hover:first-child {
background-color: #2A8B48;
}
</style>
<link rel="preconnect" href="Registrate o inicia tu sesión para ver este contenido">
<link rel="preconnect" href="Registrate o inicia tu sesión para ver este contenido" crossorigin>
<link rel="stylesheet" href="Registrate o inicia tu sesión para ver este contenido@100;300;400;500;700;900&display=swap">
<title>{$tsTitle}</title>
<div class="leaving-wrapper">
<div class="leaving-message">
<h1>Estás saliendo de {$tsConfig.titulo}</h1>
<p>Hiciste click en un enlace que te redirigirá hacia un sitio externo.</p>
<div class="buttons">
<a href="{$tsDecode}" class="btn a">Continuar</a>
<a href="{$tsConfig.url}" class="btn btn-link">Volver a {$tsConfig.titulo}</a>
</div>
</div>
</div>4 - En inc/php/ crean un archivo llamado go.php y el agregan lo siguiente
Código PHP: ( Seleccionar Todo )
<?php
/**
* Controlador
*
* @name
* @author PHPost Team
*/
/**********************************\
* (VARIABLES POR DEFAULT) *
\*********************************/
$tsPage = "go"; // tsPage.tpl -> PLANTILLA PARA MOSTRAR CON ESTE ARCHIVO.
$tsLevel = 0; // NIVEL DE ACCESO A ESTA PAGINA. => VER FAQs
$tsAjax = empty($_GET['ajax']) ? 0 : 1; // LA RESPUESTA SERA AJAX?
$tsContinue = true; // CONTINUAR EL SCRIPT
/*++++++++ = ++++++++*/
include "../../header.php"; // INCLUIR EL HEADER
$tsTitle = "Saliendo de {$tsCore->settings['titulo']}"; // TITULO DE LA PAGINA ACTUAL
/*++++++++ = ++++++++*/
// VERIFICAMOS EL NIVEL DE ACCSESO ANTES CONFIGURADO
$tsLevelMsg = $tsCore->setLevel($tsLevel, true);
if($tsLevelMsg != 1){
$tsPage = 'aviso';
$tsAjax = 0;
$smarty->assign("tsAviso",$tsLevelMsg);
//
$tsContinue = false;
}
//
if($tsContinue){
/**********************************\
* (VARIABLES LOCALES ESTE ARCHIVO) *
\*********************************/
$action = $_GET['action'];
/**********************************\
* (INSTRUCCIONES DE CODIGO) *
\*********************************/
$page = isset($_GET['p']) ? $_GET['p'] : '';
$decode = base64_decode($page);
$smarty->assign("tsDecode", $decode);
/**********************************\
* (AGREGAR DATOS GENERADOS | SMARTY) *
\*********************************/
}
if(empty($tsAjax)) { // SI LA PETICION SE HIZO POR AJAX DETENER EL SCRIPT Y NO MOSTRAR PLANTILLA, SI NO ENTONCES MOSTRARLA.
$smarty->assign("tsTitle", $tsTitle); // AGREGAR EL TITULO DE LA PAGINA ACTUAL
/*++++++++ = ++++++++*/
include("../../footer.php");
/*++++++++ = ++++++++*/
}
Eso sería todo...
[img]Registrate o inicia tu sesión para ver este contenido[/img]


Facebook
Twitter
Reddit
Digg
del.icio.us
Tumblr
Pinterest
Blogger
Fark
LinkedIn
Mix
Google