( ′∀`)σ≡σ☆))Д′)レ(゚∀゚;)ヘ=З=З=Зε≡(ノ´_ゝ`)ノ 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/../brandEngine/embed.php
<?php
 global $starTagVersion, $base_url, $system_folder, $application_folder, $CFG, $UNI, $starTagEmbedder, $wpdb;

$base_url = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? "https" : "http");
$base_url .= "://".$_SERVER['HTTP_HOST'];
$base_url .= str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']);
$base_url = str_replace('/install', '', $base_url);

// CI base data
$system_folder = "brandEngine/brandSystem";
$application_folder = 'brandEngine/brandApplication';

if (strpos($system_folder, '/') === FALSE)
{
	if (function_exists('realpath') AND @realpath(dirname(__FILE__)) !== FALSE)
		$system_folder = realpath(dirname(__FILE__)).'/'.$system_folder;
}
else
{
	$system_folder = str_replace("\\", "/", $system_folder);
}

// CI constants

define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
define('EXT', '.'.pathinfo(__FILE__, PATHINFO_EXTENSION));
define('BASEPATH', $system_folder.'/');
define('FCPATH', str_replace(SELF, '', __FILE__));
define('BASEURL', $base_url);
define('APPPATH', FCPATH . $application_folder.'/');

// Include dev configs

if (file_exists(APPPATH.'config/dev.php')) {
    include APPPATH.'config/dev.php';
}

// CI classes include

require($system_folder . '/database/DB.php');
require($system_folder . '/core/Config.php');
require($system_folder . '/core/Common.php');
require($system_folder . '/core/Loader.php');
require($system_folder . '/core/Utf8.php');
require($system_folder . '/core/Input.php');
require($application_folder . '/config/constants.php');
require($application_folder . '/config/brandX.php');
require($system_folder . '/helpers/url_helper.php');
require($application_folder . '/libraries/data.php');
require($application_folder . '/libraries/plugin.php');
require($application_folder . '/helpers/trace_helper.php');
require($application_folder . '/helpers/general_helper.php');
require($application_folder . '/helpers/option_helper.php');
require($application_folder . '/helpers/language_helper.php');
require($application_folder . '/helpers/images_helper.php');
require($application_folder . '/helpers/plugin_helper.php');

//include framework files
require_once(BR_PLUGIN_PATH . 'includes/framework/include-framework.php');

//include bases
require_once($folderIncludes . 'base.class.php');
require_once($folderIncludes . 'elements-base.class.php');
require_once($folderIncludes . 'base-admin.class.php');
require_once($folderIncludes . 'base-front.class.php');

//include product files
require_once(BR_PLUGIN_PATH . 'includes/globals.class.php');
require_once(BR_PLUGIN_PATH . 'includes/operations.class.php');
require_once(BR_PLUGIN_PATH . 'includes/theme.class.php');
require_once(BR_PLUGIN_PATH . 'includes/output.class.php');
require_once(BR_PLUGIN_PATH . 'includes/frame.class.php');
require_once(BR_PLUGIN_PATH . 'includes/navigation.class.php');
require_once(BR_PLUGIN_PATH . 'includes/object-library.class.php');
require_once(BR_PLUGIN_PATH . 'includes/template.class.php');
require_once(BR_PLUGIN_PATH . 'includes/external-sources.class.php');
require_once(BR_PLUGIN_PATH . 'includes/tinybox.class.php');
require_once(BR_PLUGIN_PATH . 'includes/extension.class.php');
require_once(BR_PLUGIN_PATH . 'public/startag-app-front.class.php');

// theme version
$starTagVersion = TheBrandGlobals::BRAND_VERSION;

// The Brand Embedder Class

$CFG = new CI_Config;
$CFG->set_item('rs_image_sizes', $config['rs_image_sizes']);
$UNI = new CI_Utf8;

class StarTagEmbedder {

	private static $instance;
	public static $table_prefix;
	public $load;
	public $db;
	public $config;
	public $input;
	public $utf8;

	/**
	 * Constructor
	 *
	 */
	public function __construct() {

        if ( !defined('BRAND_IMAGE_PATH') ) {
            define('BRAND_IMAGE_PATH', BRAND_IMAGE_PATH_COMMON);
            define('BRAND_THUMB_PATH', BRAND_IMAGE_PATH . '/' . BRAND_THUMB_FOLDER);
            define('WP_CONTENT_DIR', BRAND_IMAGE_PATH);
        }

        global $CFG;
		global $UNI;

		$CFG->set_item('global_xss_filtering', FALSE);
		$CFG->set_item('csrf_protection', FALSE);

		self::$instance =& $this;
		self::$instance->config = & $CFG;
		self::$instance->load = new CI_Loader;
		self::$instance->utf8 = & $UNI;
		self::$instance->input = new CI_Input;
		self::$instance->data = new Data;

        include(APPPATH.'config/database'.EXT);
		$this->db = DB('default', true);
		$this->db->db_connect();
		$this->db->db_select();

		self::$table_prefix = $db[$active_group]['dbprefix'];

		TheBrandGlobals::$table_themes = self::$table_prefix . TheBrandGlobals::TABLE_THEMES_NAME;
		TheBrandGlobals::$table_layers = self::$table_prefix . TheBrandGlobals::TABLE_FRAMES_NAME;
		TheBrandGlobals::$table_static_layers = self::$table_prefix . TheBrandGlobals::TABLE_STATIC_FRAME_NAME;
		TheBrandGlobals::$table_settings = self::$table_prefix . TheBrandGlobals::TABLE_SETTINGS_NAME;
		TheBrandGlobals::$table_css = self::$table_prefix . TheBrandGlobals::TABLE_CSS_NAME;
		TheBrandGlobals::$table_layer_anims = self::$table_prefix . TheBrandGlobals::TABLE_LAYER_ANIMS_NAME;
		TheBrandGlobals::$table_navigation = self::$table_prefix . TheBrandGlobals::TABLE_NAVIGATION_NAME;
	}

	/**
	 * Returns current instance of Embedder
	 *
	 */
	public static function &get_instance() {
		return self::$instance;
	}

    /**
     * check if theme exist
     *
     * @param string $alias
     * @return bool
     */
	public static function isThemeExist($alias) {
        $theme = new TheBrand();
        return $theme->isAliasExistsInDB($alias);
	}

	/**
	 *	Output header includes
	 *
	 *	@param	boolean	Include jQuery
	 */
	public static function headIncludes($jQueryInclude = true) {
        self::cssIncludes();
        self::jsIncludes($jQueryInclude);
	}
	
	/**
	 *	Output CSS includes
	 */
	public static function cssIncludes() {

		$output = '';
		$output .= '<link rel="stylesheet" href="' . THE_BRAND_URL . 'public/assets/css/settings.css' . '" type="text/css" media="all" />' . "\n";

		$custom_css = TheBrandOperations::getStaticCss();
		$custom_css = StarTagCssParser::compress_css($custom_css);
		if ( $custom_css != '' ) {
			$output .= '<style type="text/css">' . $custom_css . '</style>' . "\n";
		}

		echo $output;
	}

	/**
	 *	Output JS includes
	 *
	 *	@param	boolean	Include jQuery
	 *	@return string
	 */

	public static function jsIncludes($jQueryInclude = true) {

		$output = '';

		if ($jQueryInclude) {
			$output .= '<script type="text/javascript" src="' . BRAND_BASE_URL . 'brandEngine/brandAssets/js/includes/jquery/jquery.js' . '"></script>' . "\n";
		}

		$output .= '<script type="text/javascript" src="' . THE_BRAND_URL .'public/assets/js/tools.js' . '"></script>' . "\n";
		$output .= '<script type="text/javascript" src="' . THE_BRAND_URL .'public/assets/js/engineX.js' . '"></script>' . "\n";

		echo $output;
	}

	/**
	 *	Put Theme
	 */

	public static function putStarTag($data,$putIn = "") {

		// Do not output Theme if we are on mobile
		ob_start();
		$theme = StarTagOutput::putTheme($data,$putIn);
		$content = ob_get_contents();
		ob_clean();
		ob_end_clean();

        ob_start();
        do_action('wp_footer');
        $content = ob_get_contents() . $content;
        ob_clean();
        ob_end_clean();

        if(!empty($theme)){

            $content = self::add_styles_and_scripts($theme)
                     . self::load_icon_fonts()
                     . StarTagFront::add_InitBrandSize()
                     . $content;

            // Do not output Theme if we are on mobile
            $disable_on_mobile = $theme->getParam("disable_on_mobile","off");
            if($disable_on_mobile == 'on'){
                $mobile = (strstr($_SERVER['HTTP_USER_AGENT'],'Android') || strstr($_SERVER['HTTP_USER_AGENT'],'webOS') || strstr($_SERVER['HTTP_USER_AGENT'],'iPhone') ||strstr($_SERVER['HTTP_USER_AGENT'],'iPod') || strstr($_SERVER['HTTP_USER_AGENT'],'iPad') || strstr($_SERVER['HTTP_USER_AGENT'],'Windows Phone') || wp_is_mobile()) ? true : false;
                if($mobile) return false;
            }

            $show_alternate = $theme->getParam("show_alternative_type","off");

            if($show_alternate == 'mobile' || $show_alternate == 'mobile-ie8'){
                if(strstr($_SERVER['HTTP_USER_AGENT'],'Android') || strstr($_SERVER['HTTP_USER_AGENT'],'webOS') || strstr($_SERVER['HTTP_USER_AGENT'],'iPhone') ||strstr($_SERVER['HTTP_USER_AGENT'],'iPod') || strstr($_SERVER['HTTP_USER_AGENT'],'iPad') || strstr($_SERVER['HTTP_USER_AGENT'],'Windows Phone') || wp_is_mobile()){
                    $show_alternate_image = $theme->getParam("show_alternate_image","");
                    $content = '<img class="brand-theme-alternative-image" src="'.$show_alternate_image.'" data-no-retina>';
                }
            }
        }

		echo $content;
	}

	/**
	 *	Add icon fonts
	 */

	public static function load_icon_fonts(){
		global $fa_icon_var,$pe_7s_var;
		$content = '';
		if($fa_icon_var) $content .= "<link rel='stylesheet' property='stylesheet' id='br-icon-set-fa-icon-css'  href='" . THE_BRAND_URL . "public/assets/fonts/font-awesome/css/font-awesome.css' type='text/css' media='all' />";
		if($pe_7s_var) $content .= "<link rel='stylesheet' property='stylesheet' id='br-icon-set-pe-7s-css'  href='" . THE_BRAND_URL . "public/assets/fonts/pe-icon-7-stroke/css/pe-icon-7-stroke.css' type='text/css' media='all' />";
		return $content;
	}
    
    /**
     * Load additional styles and scripts
     *
     * @param TheStartagBrand $theme
     * @return string
     */  
    
    public static function add_styles_and_scripts($theme) {

        do_action('wp_enqueue_scripts');

        $addons = self::get_instance()->plugin->getThemePlugins($theme);

        $content = '';

		foreach (self::get_instance()->data->get('styles', array()) as $style) {
            if (strpos($style, THE_BRAND_URL . 'public/assets') === false) {
                $addStyle = false;
                foreach ($addons as $_key => $_status) {
                    if ($_status && strpos($style, $_key) !== false) {
                        $addStyle = true;
                    }
                }
            } else {
                $addStyle = true;
            }

            if ($addStyle) {
                $content .= '<link rel="stylesheet" type="text/css"  media="all" href="' . force_ssl($style) . '" />' . "\n";
            }
		}

		foreach (self::get_instance()->data->get('scripts', array()) as $script) {
            foreach ($addons as $_key => $_status) {
                if ($_status && strpos($script, $_key) !== false) {
                    $content .= '<script type="text/javascript" src="' . force_ssl($script) . '"></script>' . "\n";
                }
            }
		}

        $localizeScripts = self::$instance->data->get('localize_scripts');
        if ($localizeScripts) {
            $content .= '<script type="text/javascript">' . "\n";
            foreach ($localizeScripts as $localizeScript) {
                $content .= 'var ' . $localizeScript['var'] . ' = ' . json_encode($localizeScript['lang']) . "\n";;
            }
            $content .= '</script>' . "\n";
        }

        return $content;
    }

	public function enqueue_styles(){
	}
}

// Create new instance

$starTagEmbedder = new StarTagEmbedder();
$starTagEmbedder->plugin = new Plugin;

force_config_ssl();

// Global DB instance

$starTagEmbedder->load->model('wpdb_model', 'WPDB');
$wpdb = $starTagEmbedder->WPDB;

// Add actions and filters

add_filter('punchfonts_modify_url', array('StarTagFront', 'modify_punch_url'));
add_action('wp_enqueue_scripts', array($starTagEmbedder, 'enqueue_styles'));

// Load plugins

foreach ($starTagEmbedder->plugin->getActivePlugins() as $plugin) {
    if (file_exists(FCPATH . WP_PLUGIN_DIR . $plugin)) {
        include FCPATH . WP_PLUGIN_DIR . $plugin;
    }
}
do_action('plugins_loaded');

// Get intance globally

function &get_instance() {
	global $starTagEmbedder;
	return $starTagEmbedder::get_instance();
}

// define plugin url
$BRAND_BASE_URL = base_url();
if ( (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ) {
	$BRAND_BASE_URL = str_replace('http://', 'https://', $BRAND_BASE_URL);
} else {
	$BRAND_BASE_URL = str_replace('https://', 'http://', $BRAND_BASE_URL);
}
define('BRAND_BASE_URL', $BRAND_BASE_URL );
define('THE_BRAND_URL', $BRAND_BASE_URL . 'brandEngine/brandRoute/');