<?php
class ControllerCommonEcommerceOnly extends Controller {
    public function index() {
        if ($this->config->get('config_sistema_marketplace') && !$this->config->get('config_sistema_ecommerce')) {

            $this->load->type('tipocomum');
            $this->load->helper('ftr_geral');

            $route = '';
            if (isset($this->request->get['route']) || isset($this->request->get['_route_'])) {

                $part = (isset($this->request->get['route'])) ? explode('/', $this->request->get['route']) : explode('/', $this->request->get['_route_']);

                if (isset($part[0])) {
                    $route .= $part[0];
                }

                if($route == Type_DefaultValues::Tp_UrlLiberada){
                    return false;
                }

                $route2 = (isset($this->request->get['route'])) ? $this->request->get['route'] : $this->request->get['_route_'];

                if($this->ftrgeralregistry->getUrlRelease($route2)){
                    return false;
                }

            }

            // Show site if logged in as admin
            $this->load->library('user');

            $this->user = new User($this->registry);

            if (($route != 'payment')) {
                return $this->forward('common/ecommerce_only/info');
            }
        }
    }

    public function info() {
        $this->load->type('tipocomum');
        $this->load->helper('ftr_geral');

        $this->redirect($this->url->linkAnchor('', '', '', 'NONSSL', false) . 'admin');
    }
}
