hooks.php

Shared decode - view only

Get Your Own Account
35.7 KB
Original Size
5.0 KB
Decoded Size
PHP 8.1
PHP Version
12.0.2
ionCube
hooks.php
<?php

add_hook('AdminAreaFooterOutput', 1, function($vars) {
    $script = $_SERVER['REQUEST_URI'];
    if (preg_match('/module=emailtemplateahost_addon/', $script)) {
        $html[] = '<link rel="stylesheet" href="https://cdn.rawgit.com/arboshiki/lobibox/v1.2.4/dist/css/lobibox.min.css"/>';
        $html[] = '<script src="https://cdn.rawgit.com/arboshiki/lobibox/v1.2.4/dist/js/lobibox.min.js"></script>';
        $html[] = '<script src="https://cdnjs.cloudflare.com/ajax/libs/bootbox.js/4.4.0/bootbox.min.js"></script>';
        if (isset($_GET['saveconfig'])) {
            if ($_GET['saveconfig'] == 'success') {
                $html[] = sprintf("\n                <script>\n                    Lobibox.notify(\"success\", {\n                        size: \"mini\",\n                        sound: false,\n                        title: \"Correcto\",\n                        msg: \"Configuración guardada.\"\n                    });\n                </script>\n                ");
            }
        }
        return implode('', $html);
    }
});
$setting = \WHMCS\Database\Capsule::table('tbladdonmodules')->select('value')->where('module', 'emailtemplateahost_addon')->where('setting', 'integracion_sevp')->first();
if ($setting->value == '') {
    add_hook('EmailPreSend', 1, function($vars) {
    $getgenerals = \WHMCS\Database\Capsule::table('mod_ahostplantillas_redes')->where('tipo', '=', 'general')->get();
    $getfooters = \WHMCS\Database\Capsule::table('mod_ahostplantillas_redes')->where('tipo', '=', 'footer')->get();
    $getcopyright = \WHMCS\Database\Capsule::table('mod_ahostplantillas_redes')->where('tipo', '=', 'copyright')->first();
    $migeneraltext = [];
    $migeneralurl = [];
    $mifootertext = [];
    $mifooterurl = [];
    foreach ($getgenerals as $getgeneral) {
        $migeneraltext[] = $getgeneral->nombreRed;
        $migeneralurl[] = $getgeneral->enlace;
    }
    foreach ($getfooters as $getfoot) {
        $mifootertext[] = $getfoot->nombreRed;
        $mifooterurl[] = $getfoot->enlace;
    }
    $redes = \WHMCS\Database\Capsule::table('mod_ahostplantillas_redes')->whereIn('id', [1, 2, 3, 4, 5, 6])->get();
    $redes_sociales = [];
    $redes_sociales_icono = [];
    foreach ($redes as $red) {
        $redes_sociales[$red->id] = $red->enlace;
        $redes_sociales_icono[$red->id] = $red->icono;
    }
    $urlfacebook = $redes_sociales[1];
    $urltwitter = $redes_sociales[2];
    $urlinstagram = $redes_sociales[3];
    $urlyoutube = $redes_sociales[4];
    $urlwhatsapp = $redes_sociales[5];
    $urltiktok = $redes_sociales[6];
    $urlfacebook_icon = $redes_sociales_icono[1];
    $urltwitter_icon = $redes_sociales_icono[2];
    $urlinstagram_icon = $redes_sociales_icono[3];
    $urlyoutube_icon = $redes_sociales_icono[4];
    $urlwhatsapp_icon = $redes_sociales_icono[5];
    $urltiktok_icon = $redes_sociales_icono[6];
    $patch_Plantilla = 'modules/addons/emailtemplateahost_addon/imagenes/plantilla1/img/';
    $ICONO_GEN1 = 'email_blog.png';
    $ICONO_GEN2 = 'email_wiki.png';
    require_once './funciones/clases.php';
    $ClaseTplAhost = new ClaseTplAhost();
    $ClaseTplAhost->Parametrosglobales(isset($mifooterurl[0]) ? $mifooterurl[0] : '');
    $miarray = ['VAR_GENERAL1_URL' => $ClaseTplAhost->Parametrosglobales($migeneralurl[0]), 'VAR_GENERAL1_TEXT' => $migeneraltext[0], 'VAR_GENERAL2_URL' => $ClaseTplAhost->Parametrosglobales($migeneralurl[1]), 'VAR_GENERAL2_TEXT' => $migeneraltext[1], 'ICONO_GEN1' => $ICONO_GEN1, 'ICONO_GEN2' => $ICONO_GEN2, 'PATCH_PLANTILLA' => $patch_Plantilla, 'ICONO_FACEBOOK' => $urlfacebook_icon, 'ICONO_TWITTER' => $urltwitter_icon, 'ICONO_INSTAGRAM' => $urlinstagram_icon, 'ICONO_YOUTUBE' => $urlyoutube_icon, 'ICONO_WHATSAPP' => $urlwhatsapp_icon, 'ICONO_TIKTOK' => $urltiktok_icon, 'VAR_FACEBOOK_URL' => $urlfacebook, 'VAR_TWITTER_URL' => $urltwitter, 'VAR_INSTAGRAM_URL' => $urlinstagram, 'VAR_YOUTUBE_URL' => $urlyoutube, 'VAR_WHATSAPP_URL' => $urlwhatsapp, 'VAR_TIKTOK_URL' => $urltiktok, 'VAR_FOOTER1_URL' => $ClaseTplAhost->Parametrosglobales(isset($mifooterurl[0]) ? $mifooterurl[0] : ''), 'VAR_FOOTER1_TEXT' => $ClaseTplAhost->Parametrosglobales(isset($mifootertext[0]) ? $mifootertext[0] : ''), 'VAR_FOOTER2_URL' => $ClaseTplAhost->Parametrosglobales(isset($mifooterurl[1]) ? $mifooterurl[1] : ''), 'VAR_FOOTER2_TEXT' => $ClaseTplAhost->Parametrosglobales(isset($mifootertext[1]) ? $mifootertext[1] : ''), 'VAR_FOOTER3_URL' => $ClaseTplAhost->Parametrosglobales(isset($mifooterurl[2]) ? $mifooterurl[2] : ''), 'VAR_FOOTER3_TEXT' => $ClaseTplAhost->Parametrosglobales(isset($mifootertext[2]) ? $mifootertext[2] : ''), 'VAR_FOOTER4_URL' => $ClaseTplAhost->Parametrosglobales(isset($mifooterurl[3]) ? $mifooterurl[3] : ''), 'VAR_FOOTER4_TEXT' => $ClaseTplAhost->Parametrosglobales(isset($mifootertext[3]) ? $mifootertext[3] : ''), 'VAR_FOOTER5_URL' => $ClaseTplAhost->Parametrosglobales(isset($mifooterurl[4]) ? $mifooterurl[4] : ''), 'VAR_FOOTER5_TEXT' => $ClaseTplAhost->Parametrosglobales(isset($mifootertext[4]) ? $mifootertext[4] : ''), 'VAR_COPYRIGHT' => $getcopyright ? $getcopyright->nombreRed : ''];
    return $miarray;
});
}

Need to decode your own files?

DecodePHP supports ionCube 10-15 and SourceGuardian with PHP 7.1, 7.2, 7.3, 7.4, 8.1, 8.2, 8.3, and 8.4

Get Started Free