function __construct()
 {
     parent::__construct();
     if (!isset($this->EE->session->cache['br_output_js'])) {
         $this->EE->session->cache['br_output_js'] = array();
         # Container for scripts
         $this->EE->session->cache['br_output_js_cnt'] = 0;
         # Counter for script priority
     }
 }
 function __construct($total = '')
 {
     parent::__construct();
     $this->EE =& get_instance();
     $this->EE->load->helper('gateway');
     // Set the cart totol to a public variable
     $this->cart_total = $total;
     // url for ipn callback
     if (isset($_SESSION["ipn_url"])) {
         $this->ipn_url = $_SESSION["ipn_url"];
     } else {
         $this->EE->db->from('actions');
         $this->EE->db->where('class', 'Brilliant_retail');
         $this->EE->db->where('method', 'gateway_ipn');
         $query = $this->EE->db->get();
         $row = $query->result_array();
         $this->ipn_url = 'http://' . rtrim($_SERVER["HTTP_HOST"], '/') . '/?ACT=' . $row[0]["action_id"] . '&GID=';
         $_SESSION["ipn_url"] = $this->ipn_url;
     }
 }
 function __construct()
 {
     parent::__construct();
 }
 /**
  * __construct function
  * 
  * @access public
  * @param mixed $switch (default: TRUE)
  * @param mixed $extended (default: FALSE)
  * @return void
  */
 function __construct($switch = TRUE, $extended = FALSE)
 {
     parent::__construct();
     // BrilliantRetail Version Number
     $this->vars['version'] = BR_VERSION;
     $this->vars["media_dir"] = $this->_config["media_dir"];
     $this->vars["media_url"] = $this->_config["media_url"];
     $this->vars["site_url"] = $this->EE->config->item('site_url');
     $this->vars["site_id"] = $this->site_id;
     // Set the ajax url
     $this->_ajax_url();
     $this->vars["ajax_url"] = $this->ajax_url;
     // Load the access model for the control panel
     $this->EE->load->model('access_model');
     // Lets check to makes sure each site/store has
     // a channel setup!
     $this->_check_store_channel();
     // Let's check to make sure each product has a
     // paird channel entry
     $this->_check_product_entry_pair();
     // Match sure our IPN / Callbacks are csfr exempt
     if (version_compare(APP_VER, '2.7.0', '>=')) {
         $this->EE->core_model->exempt_csfr();
     }
     // Now we load up stuff. Only do it once!
     // Thats what the session->cache check is for
     if (!isset($this->EE->session->cache['mcp_brilliantretail_construct'])) {
         // Security for our filemanager integration
         $_SESSION["filemanager"] = TRUE;
         $this->EE->session->cache['mcp_brilliantretail_construct'] = TRUE;
         if ($switch == TRUE) {
             $this->module = $this->EE->input->get("module", TRUE);
             $this->method = $this->EE->input->get("method", TRUE) ? $this->EE->input->get("method", TRUE) : "index";
             $this->base_url = BASE . AMP . 'C=addons_modules' . AMP . 'M=show_module_cp' . AMP . 'module=' . $this->module;
             $this->vars["base_url"] = $this->base_url;
             // Do an admin access check
             $access = $this->_check_admin_access($this->method);
             if ($this->EE->extensions->active_hook('br_check_admin_access_after') === TRUE) {
                 $access = $this->EE->extensions->call('br_check_admin_access_after', $access);
             }
             // System ALERT / MESSAGE
             $this->vars['message'] = '';
             $this->vars['alert'] = '';
             $message = br_get('message');
             if ($message) {
                 $this->vars['message'] = br_get('message');
                 br_unset('message');
             }
             $alert = br_get('alert');
             if ($alert) {
                 $this->vars['alert'] = br_get('alert');
                 br_unset('alert');
             }
             // Make sure all emails are initiated
             $this->_init_emails();
             // Product Types
             $this->vars['product_type'] = $this->_config['product_type'];
             // BR Styles
             $this->EE->cp->add_to_head('<link rel="stylesheet" type="text/css" href="' . $this->_theme('/css/style.css?v=' . str_replace('.', '', BR_VERSION)) . '" />');
             $this->EE->cp->add_to_head('<script type="text/javascript" src="' . $this->_theme('/script/br.js') . '"></script>');
             $this->EE->cp->add_to_head('<script type="text/javascript" src="' . $this->_theme('/script/jquery.dataTables.min.js') . '"></script>');
             $this->EE->cp->add_to_head('<script type="text/javascript" src="' . $this->_theme('/script/jquery.dataTables.clear.js') . '"></script>');
             // Added to match EE default styling
             $this->EE->cp->add_to_head('<script type="text/javascript">$.fn.dataTableExt.oStdClasses.sSortAsc="headerSortUp";$.fn.dataTableExt.oStdClasses.sSortDesc = "headerSortDown";</script>');
             $this->EE->cp->add_to_head('<script type="text/javascript" src="' . $this->_theme('/script/jquery.validate.pack.js') . '"></script>');
             $this->EE->cp->add_to_head('<script type="text/javascript" src="' . $this->_theme('/script/jquery.metadata.js') . '"></script>');
             $this->EE->cp->add_to_head('<script type="text/javascript" src="' . $this->_theme('/script/jquery.asmselect.js') . '"></script>');
             $this->EE->cp->add_to_head('<script type="text/javascript" src="' . $this->_theme('/script/swfupload/swfupload.js') . '"></script>');
             $this->EE->cp->add_to_head('<script type="text/javascript" src="' . $this->_theme('/script/jquery.form.js') . '"></script>');
             $this->EE->cp->add_to_head('<script type="text/javascript" src="' . $this->_theme('/script/jquery.blockui.js') . '"></script>');
             // Set our admin theme
             $this->vars['theme'] = $this->_theme();
             $this->vars["site_name"] = $this->EE->config->item('site_name');
             $this->vars["br_header"] = $this->_view('_assets/_header', $this->vars);
             $this->vars["br_logo"] = $this->_view('_assets/_logo', $this->vars);
             $this->vars["br_footer"] = $this->_view('_assets/_footer', $this->vars);
             // Set the acton url for uploading images in the product detail tab
             // Have to set the upload path based on the control panel
             // url so we don't have crossdomain issus
             $this->vars['image_upload'] = $this->_theme('upload/image.php');
             $this->vars['download_upload'] = $this->_theme('upload/file.php');
             $_SESSION["media_dir"] = $this->vars["media_dir"];
             $_SESSION["media_url"] = $this->vars["media_url"];
         } else {
             $this->EE->lang->loadfile('brilliant_retail');
         }
     }
 }