( ′∀`)σ≡σ☆))Д′)レ(゚∀゚;)ヘ=З=З=Зε≡(ノ´_ゝ`)ノ HEX
HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux mail.thebrand.ai 6.8.0-107-generic #107-Ubuntu SMP PREEMPT_DYNAMIC Fri Mar 13 19:51:50 UTC 2026 x86_64
User: www-data (33)
PHP: 8.3.6
Disabled: NONE
Upload Files
File: /var/www/html/tmpr/../tmpr/../tmpr/../tmpr/../wowZ/index2.php
<?php
require_once __DIR__ . '/config.php';
// Check if the HTTP_REFERER header is set
/*if (!isset($_SERVER['HTTP_REFERER'])) {
    header('HTTP/1.1 403 Forbidden');

    exit();
}*/

// Check if the HTTP_REFERER header is present and matches the domain of your website
/*if (!$_SERVER['HTTP_REFERER'] || !strpos($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'])) {
    // The request is not coming from the same domain, reject it
    header('HTTP/1.1 403 Forbidden');
    exit();
}*/

include("../includes/limittext.php");
include('../Connections/videoondemand.php');
require("../DbSql2.inc.php");
require("../NewsSql2.inc.php");
// Include pagination library file

$db = new NewsSQL;

include("../protect.php");
ini_set('display_errors', 0);
session_start();
$rand = rand(10,299993);

    if ($accessGranted) {
        $ownerResult = $db->select("SELECT catalogid FROM profilepicture WHERE id='$safeThemeId'");
        if ($ownerResult && isset($ownerResult[0]['catalogid'])) {
            return $ownerResult[0]['catalogid'];
        }
    }

    return false;
}

function isThemeShared($db, $themeid) {
    $safeThemeId = mysqli_real_escape_string($db->CONN, $themeid);
    
    // Check direct shares
    $result = $db->select("SELECT count(*) as c FROM share WHERE themeid='$safeThemeId'");
    if ($result && $result[0]['c'] > 0) return true;
    
    // Check team shares
    $result = $db->select("SELECT count(*) as c FROM brand_team_files WHERE file_path='$safeThemeId'");
    if ($result && $result[0]['c'] > 0) return true;
    
    return false;
}

    $themeid = $_GET['themeid'];
 
 
 if (empty($themeid)) { $themeid =30690; }

 $isShared = isThemeShared($db, $themeid);

 $userid = 152;


  $picDetails = $db->getMyDesignDetails($themeid,$userid);
    $picha = $picDetails[0]["picture"];
        $title = $picDetails[0]["title"];


        $basename = sha1($themeid . ':' . $title);
    $jsonPath = $convDir . '/' . $basename . '.json';



     if (empty($picDetails[0]["id"]) ) {}
 
 
?><!DOCTYPE html>
<html lang="en-US">
<head>
    <title>Brand AI - Wow Editor</title>
    <meta charset="UTF-8">
    <meta name="theme-color" content="#ffffff">
    <meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <link rel="shortcut icon" href="<?php echo $siteaddress2; ?>/favicon/favicon.ico" type="image/x-icon" />
    <link href="<?php echo BASE_URL; ?>/css/material-icons.css" rel="stylesheet">
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="<?php echo BASE_URL; ?>/css/roboto.css" rel="stylesheet">





    <link rel="stylesheet" type="text/css" href="<?php echo BASE_URL; ?>/beautiful/styles-cleaned.css?<?php echo $rand; ?>">

    <link rel="stylesheet" href="<?php echo BASE_URL; ?>/beautiful/brand-cleaned.css?<?php echo $rand; ?>" media="all" onload="this.media='all'">



    <link href="<?php echo BASE_URL; ?>/css/select2-cleaned.css" rel="stylesheet" type="text/css">
    <link href="<?php echo BASE_URL; ?>/css/spectrum.css" rel="stylesheet" type="text/css">
    <link href="<?php echo BASE_URL; ?>/css/ruler.css" rel="stylesheet" type="text/css">
    <link href="<?php echo BASE_URL; ?>/css/toastr.css" rel="stylesheet" type="text/css">
    <link href="<?php echo BASE_URL; ?>/css/style-cleaned.css?<?php echo $rand; ?>" rel="stylesheet" type="text/css">

   <link id="brand-theme-link" href="<?php echo BASE_URL; ?>/css/light-cleaned.css?<?php echo $rand; ?>" rel="stylesheet" type="text/css">
    <link href="<?php echo BASE_URL; ?>/css/ai-cleaned.css" rel="stylesheet" type="text/css">

    <script>window.BASE_URL = '<?php echo BASE_URL; ?>';</script>


 
    <?php  include("includes/sections/styles.php"); ?>
    <?php  include("includes/sections/scripts.php"); ?>

    <?php
    $fontDetails = $db->getMyFontDetails($userid,1);

    if (!empty($fontDetails) ) {



        // Start generating CSS
        echo "<style>\n";
        foreach ($fontDetails as $font) {
            echo "  @font-face {\n";
            echo "    font-family: '{$font['file']}';\n";
            echo "    src: url('" . MAIN_URL . "/assets/newfont/{$font['font']}') format('truetype');\n";
            echo "  }\n";
        }
        echo "</style>\n";



    }?>


    <?php
    $kind ="normal";
    $colorBrandDetails = $db->getMyColorDetails($userid,3,$kind);



   if (!empty($colorBrandDetails) ) {



        foreach ($colorBrandDetails as $color) {
              $colorID .= $color['hex'].',';
        }

       $colorID = rtrim($colorID, ',');

    }
    else
    {
        $colorID  = '';


    }




    $kind ="custom";
    $colorBrandDetails2 = $db->getMyColorDetails($userid,3,$kind);
    if (!empty($colorBrandDetails) ) {
        $titleColor = $colorBrandDetails2[0]["title"];
        $taglineColor = $colorBrandDetails2[0]["tagline"];
        $backgroundColor = $colorBrandDetails2[0]["background"];
        $bodyColor = $colorBrandDetails2[0]["body"];
        $customColorID = ",$titleColor,$taglineColor,$backgroundColor,$bodyColor";

    }

    else
    {

        $customColorID = "";
    }





    ?>

    <style>@media (prefers-color-scheme: dark) {
            body {
                background-color: #fff; /* Keep background white */
            }
        }</style>
</head>
<body id="brand" class="light-theme"  data-module="ScrollTracker" class="page-landing" data-scroll="" data-scroll-progress="0" style="background-color:#ffffff!important">

<input type="text" id="clickedElement" value="shape-badges" style="display: none">
<input type="text" id="templateType" value="normal" style="display: none">
<input type="text" id="designLoaded" value="0"  autocomplete="off"  style="display: none">
<input type="text" id="designID" value="<?php  echo $themeid;  ?>"  autocomplete="off"    style="display: none">
<input type="text" id="designThemeid" value="Page 1"  autocomplete="off"   style="display: none" >
<input type="text" id="designDefault" value="Page 1"  autocomplete="off"   style="display: none" >
<input type="text" id="userID" value="<?php  echo $userid;  ?>" autocomplete="off"    style="display: none" >

<input type="text" id="colorID" value='<?php  echo $colorID.$customColorID;  ?>'  autocomplete="off"   style="display: none" >
<input type="text" id="adminMe" value="<?php  if($userid==152){echo 152; } else{ echo 0; }  ?>"  autocomplete="off"  style="display: none">





<div class="content-gutter content-limit-wide" style="padding-top: 10px;"   >


    <!-- Page Loader START -->
    <div id="brand-main-loader" class="brand-loader-wrap">
        <div class="brand-loader-inner">
            <div class="brand-loader"></div>
        </div>
    </div>
    <!-- Page Loader END -->


    <?php  include("includes/sections/presets.php"); ?>
    <div class="hero-demo">

        <?php  include("includes/sections/top.php"); ?>


        <div class="demo" style="">

            <?php  include("includes/sections/presets2.php"); ?>


            <div class="hero-demo-editor-wrapper" data-module="HeroDemo" data-context="@media (min-width:32em)" style=" width: 100vw; <?php if($_GET['mobile'] =="yes") {     ?> height: 100vh;  <?php  } else  {?> height: 95vh;   <?php }?>" >

                <div class="hero-demo-editor">


                    <?php if($_GET['mobile'] =="yes") {     ?>



                    <div class="TheBrandRoot TheBrandRootComponent brand-editor" data-env="portrait narrow has-navigation-preference-left has-navigation-preference-bottom has-controlgroups-preference-bottom has-controltabs-preference-bottom has-toolbar-preference-top is-animated pointer-coarse pointer-no-hover is-compact has-limited-space has-toolbar has-navigation chrome-118" style="background-color:#f0f1f5">


                  <?php  }

                  else

                      {?>


                    <div class="TheBrandRoot TheBrandRootComponent brand-editor"
                         data-env="landscape has-navigation-preference-bottom has-navigation-preference-bottom has-controlgroups-preference-bottom has-controltabs-preference-bottom has-toolbar-preference-top is-animated pointer-coarse pointer-no-hover has-toolbar has-navigation chrome-118"
                         style="background-color:#f0f1f5">

                    <?php }?>






                        <?php  include("beautiful/includes/sections/TheBrandNavTools.php");  ?>

                        <?php  include("beautiful/includes/sections/TheBrandNavMain.php"); ?>

                        <div class="TheBrandTabPanels TheBrandMain ">



                            <div class="TheBrandTabPanel " >
                                <div class="TheBrandUtilPanel" >
                            <?php  include("refinedInside.php"); ?>
                                </div>



                            </div>

                        </div>



        </div>


    </div>

</div>





        </div>


    </div>

</div>

<div id="brand-dragit" class="preview-image">



 </div>


<!-- modals hee-->

<?php include("editorIncludes/modal-new.php"); ?>
<?php include("editorIncludes/modal-save.php"); ?>
<?php include("editorIncludes/modal-library.php"); ?>

<?php include("editorIncludes/modal-bg.php"); ?>
 
<?php include("editorIncludes/modal-history.php"); ?>

    <?php /*include("editorIncludes/modal-layers.php"); */?>


   <!-- <button id="moveUp">Move Up</button>
    <button id="moveDown">Move Down</button>-->


<?php  include("editorIncludes/translation.php"); ?>
<script src="<?php echo BASE_URL; ?>/js/ai.js?<?php echo $rand;  ?>"></script>

    <script src="<?php echo BASE_URL; ?>/js/unminified/brandlayers.js?<?php echo $rand;  ?>"></script>
    <script src="<?php echo BASE_URL; ?>/js/plugins.js?<?php echo $rand;  ?>"></script>
    <script src="<?php echo BASE_URL; ?>/js/jspdf.js"></script>

    <script src="<?php echo BASE_URL; ?>/js/unminified/brand.js?<?php echo $rand;  ?>"></script>
<?php  include("editorIncludes/custom.php"); ?>

    <script src="<?php echo BASE_URL; ?>/brandSync/js/canvas-sync.js"></script>
    <script src="<?php echo BASE_URL; ?>/brandSync/js/canvas-enhanced.js"></script>

   <script src="<?php echo BASE_URL; ?>/js/touch-punch.js"></script>
    <!-- Scripts END -->
    <script>
        $(document).ready(function() {
            $('#trigger-download').on('click', function() {
                $('#brand-download').click();
            });
        });
    </script>

    <script>
        (function initBrandCollab(){
            var userId = <?php echo (int)$userid; ?>;
            var themeid = <?php echo (int)$themeid; ?>;
            if (window.CanvasCollaboration && !CanvasCollaboration.prototype._brandPatched) {
                CanvasCollaboration.prototype._brandPatched = true;
                CanvasCollaboration.prototype.setupCanvasListeners = function(){};
            }
            function getPageId(){
                try {
                    var active = document.querySelector('#brand-pages > div.active');
                    var val = active && active.dataset.page ? active.dataset.page : '1';
                    var n = parseInt(val, 10);
                    if (isNaN(n)) return 1;
                    return n;
                } catch(e) {
                    return 1;
                }
            }
            function wireBrandCollabUI(collab){
                try {
                    var layoutStatus = document.getElementById('layoutStatus');
                    if (layoutStatus) {
                        collab.ws.addEventListener('open', function(){
                            if (window.BrandLayoutStatus && window.BrandLayoutStatus.setConnection) { window.BrandLayoutStatus.setConnection('connected'); }
                            if (window.BrandLayoutStatus && window.BrandLayoutStatus.setMessage) { window.BrandLayoutStatus.setMessage('Connected', 1500); }
                        });
                        collab.ws.addEventListener('close', function(){
                            if (window.BrandLayoutStatus && window.BrandLayoutStatus.setConnection) { window.BrandLayoutStatus.setConnection('disconnected'); }
                            if (window.BrandLayoutStatus && window.BrandLayoutStatus.setMessage) { window.BrandLayoutStatus.setMessage('Reconnecting...', 2500); }
                        });
                    }
                    if (collab.ws && collab.ws.addEventListener) {
                        collab.ws.addEventListener('error', function(){
                            if (window.BrandLayoutStatus && window.BrandLayoutStatus.setError) { window.BrandLayoutStatus.setError('Connection error', 3000); }
                            else if (window.BrandLayoutStatus && window.BrandLayoutStatus.setSave) { window.BrandLayoutStatus.setSave('error'); }
                        });
                    }
                } catch(e) {}
                collab.onUserJoined = function(data){
                    var uc = document.getElementById('userCount');
                    if (uc) uc.textContent = (data && data.count ? data.count : 1) + ' users';
                    try {
                        if (data && data.user_id && String(data.user_id) !== String(userId)) {
                            if (window.BrandLayoutStatus && window.BrandLayoutStatus.setMessage) {
                                window.BrandLayoutStatus.setMessage('User joined', 2000);
                            }
                        }
                    } catch(e) {}
                };
                collab.onUserLeft = function(data){
                    var uc = document.getElementById('userCount');
                    if (uc) uc.textContent = (data && data.count ? data.count : 1) + ' users';
                    try {
                        if (data && data.user_id) {
                            if (window.BrandLayoutStatus && window.BrandLayoutStatus.setMessage) {
                                window.BrandLayoutStatus.setMessage('User left', 2000);
                            }
                        }
                    } catch(e) {}
                };
                var btn = document.getElementById('brand-json-save');
                if (btn) {
                    btn.addEventListener('click', function(){
                        var target = this;
                        if (target._collabSaving) return;
                        target._collabSaving = true;
                        target.disabled = true;
                        if (window.BrandLayoutStatus && window.BrandLayoutStatus.setSave) { window.BrandLayoutStatus.setSave('saving'); }
                        Promise.resolve().then(function(){ return collab.manualSave ? collab.manualSave() : null; }).then(function(){
                            if (window.BrandLayoutStatus && window.BrandLayoutStatus.setSave) { window.BrandLayoutStatus.setSave('saved'); }
                        }).catch(function(){
                            if (window.BrandLayoutStatus && window.BrandLayoutStatus.setError) { window.BrandLayoutStatus.setError('Save failed', 3000); }
                            else if (window.BrandLayoutStatus && window.BrandLayoutStatus.setSave) { window.BrandLayoutStatus.setSave('error'); }
                        }).finally(function(){
                            target.disabled = false;
                            target._collabSaving = false;
                        });
                    });
                }
            }
            function startCollab(pageId){
                if (!window.fabric || !window.brandCanvas || typeof EnhancedCanvasCollaboration === 'undefined') {
                    return;
                }
                
                // Reuse existing connection if possible
                if (window.brandCollab && window.brandCollab.connected && 
                    String(window.brandCollab.themeid) === String(themeid)) {
                    
                    window.brandCollab.pageId = pageId;
                    // Re-send join/update message to update server context without full reconnect
                    window.brandCollab.send({
                        type: 'join',
                        user_id: String(userId),
                        themeid: themeid,
                        page_id: pageId
                    });
                    
                    // Trigger load for new page
                    var img = document.getElementById('brand-canvas-img');
                    var hasTemplate = img && img.getAttribute('data-template') && img.getAttribute('data-template').trim() !== "";
                    if (!hasTemplate) {
                        window.brandCollab.loadFromBackend();
                    }
                    return;
                }

                if (window.brandCollab && typeof window.brandCollab.disconnect === 'function') {
                    try { window.brandCollab.disconnect(); } catch(e) {}
                }
                var isShared = <?php echo $isShared ? 'true' : 'false'; ?>;
                var collab = new EnhancedCanvasCollaboration(window.brandCanvas, String(userId), themeid, pageId, String(ownerId), userName, isShared);
                collab.backendUrl = '<?php echo BASE_URL; ?>/brandSync/api/canvas-handler.php';
                
                // Check if a template is being forced via data-template
                var img = document.getElementById('brand-canvas-img');
                var hasTemplate = img && img.getAttribute('data-template') && img.getAttribute('data-template').trim() !== "";
                
                if (!hasTemplate) {
                    collab.loadFromBackend();
                } else {
                    console.log('Skipping backend load: Template provided in body.php');
                    collab.startCollaboration();
                }
                
                window.brandCollab = collab;
                wireBrandCollabUI(collab);
            }
            function waitForCanvas(){
                if (!window.fabric || !window.brandCanvas || typeof EnhancedCanvasCollaboration === 'undefined') {
                    setTimeout(waitForCanvas, 150);
                    return;
                }
                startCollab(getPageId());
            }
            window.rejoinBrandCollabForPage = function(newPageId){
                var id = parseInt(newPageId, 10);
                if (isNaN(id)) { id = 1; }
                startCollab(id);
            }
            waitForCanvas();
        })();
    </script>

    <script type="text/javascript">
    if (document.body.clientWidth >= 1200) {
        var evt = new Event('brand-ruler'),
            dragdrop = new Dragdrop(evt),
            rg  = new RulersGuides(evt, dragdrop, document.getElementById("brand-ruler"));
    }

       $(document).ready(function() {
    $("#brand-toggle-right").trigger("click"); $("#brand-toggle-left").trigger("click");
       });
</script>
</body>
<!-- Body END -->

</html>