<?php
/*
Generated by OutputBooks Team
*/

defined("\x42\x41\x53\105\120\x41\x54\110") or exit("\x4e\x6f\x20\144\151\162\145\143\164\x20\163\x63\162\x69\x70\x74\40\141\x63\x63\145\x73\x73\x20\x61\x6c\x6c\x6f\167\x65\x64");
class Attachment extends MY_Controller
{
    public function __construct()
    {
        parent::__construct();
        $this->load->model("\x61\x74\164\x61\x63\150\155\145\x6e\164\115\x6f\144\x65\x6c");
    }
    public function index()
    {
        $this->load->page("\x68\157\x6d\x65");
    }
    public function upload($module = "\x61\x74\164\141\x63\x68", $insertId = 0, $itemStyle = '', $productWidth = 0, $listWidth = 0)
    {
        goto AdGMW;
        ZK1t7:
        $ecomImageConfig = array();
        goto oaDiA;
        iOFi7:
        if (!empty($postData)) {
            $orderIdIndex = $postData;
        }
        goto ZK1t7;
        ANFHY:
        $this->response->write();
        goto YJNPB;
        o6QvK:
        $data = $this->attachmentModel->upload_file($module, $insertId, $orderIdIndex, $ecomImageConfig);
        goto YWete;
        YJNPB:
        return true;
        goto PSLE0;
        oaDiA:
        if ($itemStyle != '' && $productWidth > 0) {
            goto FE6ec;
            Lj8Hg:
            $ecomImageConfig["\154\151\x73\x74\127\x69\144\x74\x68"] = $listWidth;
            goto X6lK2;
            HXmyw:
            $ecomImageConfig["\x70\162\x6f\x64\165\x63\x74\x57\x69\144\x74\x68"] = $productWidth;
            goto Lj8Hg;
            FE6ec:
            $ecomImageConfig["\151\164\145\x6d\123\x74\x79\x6c\145"] = $itemStyle;
            goto HXmyw;
            X6lK2:
        }
        goto o6QvK;
        AdGMW:
        $postData = $this->request->post();
        goto Q6FjV;
        YWete:
        if ($data) {
            $this->response->success($this->attachmentModel->message);
            $this->response->set_data($data);
        } else {
            if (!empty($this->attachmentModel->message)) {
                $this->response->error(strip_tags($this->attachmentModel->message));
            }
        }
        goto ANFHY;
        Q6FjV:
        $orderIdIndex = array();
        goto iOFi7;
        PSLE0:
    }
    public function download($id = 0, $isPreview = 0)
    {
        goto p0U1c;
        up2ZQ:
        $this->_trigger_download($data["\x66\151\154\145\x50\x61\164\150"], $data["\146\x69\x6c\x65\116\141\155\145"], $isPreview);
        goto DGN28;
        p0U1c:
        $data = $this->attachmentModel->get_file($id);
        goto DOZta;
        DOZta:
        if (empty($data)) {
            return;
        }
        goto up2ZQ;
        DGN28:
    }
    public function logo()
    {
        goto CjTSq;
        dOcvt:
        $logo = "\165\x70\x6c\157\141\144\x73" . DS . get_company("\151\x64") . DS . $logo;
        goto WDB3x;
        WDB3x:
        $this->_trigger_download($logo, '', 1);
        goto DmKQn;
        CjTSq:
        $logo = get_company("\154\x6f\147\x6f");
        goto K61u4;
        K61u4:
        if (empty($logo)) {
            return;
        }
        goto dOcvt;
        DmKQn:
    }
    private function _trigger_download($filePath = '', $fileName = '', $isPreview = 0)
    {
        goto svTxP;
        y_eyV:
        $this->load->helper("\x64\x6f\x77\156\x6c\x6f\141\x64");
        goto qPP55;
        JWLrD:
        return true;
        goto uDll1;
        qPP55:
        $filePath = FCPATH . $filePath;
        goto ro3YD;
        svTxP:
        if (defined("\x55\123\105\137\101\127\123\137\x53\x33") && USE_AWS_S3) {
            goto C6F_b;
            gCv_P:
            header("\x43\157\x6e\164\x65\156\x74\x2d\x54\171\x70\x65\x3a\40{$result["\x43\157\156\x74\x65\x6e\x74\x54\171\x70\x65"]}");
            goto jBEV4;
            C6F_b:
            $result = get_from_s3($filePath);
            goto gCv_P;
            YuJZp:
            echo $result["\x42\x6f\144\x79"];
            goto DtIX_;
            DtIX_:
            return true;
            goto sBMuF;
            d4Bo7:
            header("\x43\157\156\164\145\156\x74\x2d\124\162\x61\156\163\146\145\162\x2d\x45\156\143\x6f\144\151\x6e\x67\x3a\40\142\x69\x6e\141\x72\x79");
            goto Zv7xU;
            jBEV4:
            if (!$isPreview) {
                header("\103\157\156\x74\145\x6e\164\55\104\x69\x73\x70\x6f\163\x69\164\x69\x6f\156\72\40\141\x74\x74\141\143\150\155\x65\x6e\x74\x3b\x20\146\x69\154\x65\x6e\x61\x6d\145\x3d\x22" . $fileName . "\42");
            }
            goto xpmHz;
            Zv7xU:
            header("\103\x61\143\x68\145\x2d\103\157\156\164\x72\157\154\72\40\160\x72\151\166\141\x74\x65\54\x20\156\x6f\55\164\162\x61\x6e\x73\x66\x6f\x72\155\54\40\x6e\157\55\163\164\x6f\162\x65\54\x20\155\x75\x73\164\55\162\x65\x76\141\x6c\x69\x64\x61\x74\x65");
            goto YuJZp;
            xpmHz:
            header("\x45\x78\160\x69\162\145\163\x3a\x20\x30");
            goto d4Bo7;
            sBMuF:
        }
        goto y_eyV;
        ro3YD:
        if (strtoupper(substr(PHP_OS, 0, 3)) === "\x57\x49\116") {
            $filePath = str_replace("\x2f", "\x5c", $filePath);
        }
        goto uWypr;
        uWypr:
        force_download($filePath, null, true, $fileName, $isPreview ? false : true);
        goto JWLrD;
        uDll1:
    }
}
