<?php
/*
Generated by OutputBooks Team
*/

goto eiAzm;
KT3a9:
ini_set("\x6d\145\x6d\x6f\x72\171\x5f\154\x69\155\151\164", "\55\x31");
goto E0QVG;
E0QVG:
set_time_limit(0);
goto n09Zu;
eiAzm:
defined("\102\101\x53\x45\120\101\x54\x48") or exit("\116\x6f\40\144\x69\162\x65\143\164\40\163\143\x72\x69\x70\164\40\141\x63\x63\145\163\x73\x20\141\154\x6c\x6f\167\145\x64");
goto KT3a9;
n09Zu:
class Update extends MY_Controller
{
    private $isCloud = false;
    public function __construct()
    {
        goto uMNVo;
        uMNVo:
        parent::__construct();
        goto N26L2;
        JfPnm:
        $this->isCloud = isCloud();
        goto GIsau;
        N26L2:
        $this->load->model("\x75\x70\x64\x61\x74\x65\115\x6f\144\145\x6c");
        goto JfPnm;
        GIsau:
    }
    public function _remap($method, $params = array())
    {
        if ($this->isCloud && !in_array($method, array("\x61\x62\x6f\165\164", "\x62\141\143\x6b\165\160\144\142", "\x62\x61\143\x6b\x75\x70", "\x6f\x62\104\165\155\160\104\102"))) {
            show_404();
            return false;
        }
        if (method_exists($this, $method)) {
            return call_user_func_array(array($this, $method), $params);
        } else {
            $this->index();
        }
    }
    public function index()
    {
        $this->load->page("\x68\157\x6d\x65");
    }
    public function check($isBeta = 0)
    {
        goto KVPdg;
        lMx_v:
        $message = '';
        goto rJiY_;
        e6tGf:
        $latest = null;
        goto zvef_;
        D6LXN:
        $retData["\151\x73\114\157\143\x61\154"] = 1;
        goto LWN4u;
        rJiY_:
        if (empty($latest)) {
            $message = $this->updateModel->message;
        } else {
            if (version_compare($latest, $retData["\x63\165\x72\x72\145\156\164"]) <= 0) {
                $message = "\x41\x6c\x72\x65\x61\x64\171\40\125\160\164\x6f\x20\x44\x61\x74\x65\x2e";
            } else {
                $retData["\154\x61\164\145\163\164"] = $latest;
            }
        }
        goto Sthvd;
        LWN4u:
        if ($latest === false) {
            $latest = $this->updateModel->get_latest($isBeta);
            $retData["\x69\x73\x4c\157\x63\x61\154"] = 0;
        }
        goto lMx_v;
        JtXsv:
        $this->response->write();
        goto mf0bR;
        Sthvd:
        $this->response->success($message);
        goto Bu9ET;
        zvef_:
        $latest = $this->updateModel->get_latest_local();
        goto D6LXN;
        Bu9ET:
        $this->response->set_data($retData);
        goto JtXsv;
        Pgg3j:
        $retData["\143\165\162\x72\x65\x6e\x74"] = OB_VERSION;
        goto e6tGf;
        KVPdg:
        $retData = array();
        goto Pgg3j;
        mf0bR:
        return true;
        goto rrrxF;
        rrrxF:
    }
    public function backup($type = "\106")
    {
        echo $this->updateModel->backup($type);
    }
    public function backupdb($isGdrive = 0)
    {
        goto jSKku;
        L70PF:
        if (!get_user_data("\x69\x64")) {
            if (empty($_SERVER["\x48\124\x54\x50\137\x43\x4c\x49\105\x4e\124\x41\x50\x50"]) || $_SERVER["\110\124\x54\120\137\103\x4c\111\x45\x4e\124\101\120\x50"] != "\x4f\165\164\160\165\164\x43\x72\157\x6e") {
                show_404();
                return false;
            }
            $userName = "\x43\x72\157\156\40\x4a\x6f\142";
        }
        goto ejkwm;
        GjgXQ:
        $this->updateModel->update_ack("\x44\x42\40\x42\141\143\153\165\160\x20\142\x79\40\x3a\x20" . $userName, true);
        goto QxUJv;
        jSKku:
        $userName = "\x55\116\113\116\117\127\116";
        goto L70PF;
        ejkwm:
        if (get_user_data("\156\x61\x6d\x65")) {
            $userName = get_user_data("\156\x61\x6d\145");
        }
        goto IDiC1;
        IDiC1:
        $this->obDumpDB($isGdrive);
        goto GjgXQ;
        QxUJv:
    }
    public function cronack()
    {
        goto o03fz;
        zh0Ut:
        $data = $this->request->post();
        goto FQ0tB;
        FQ0tB:
        if (!empty($data) && !empty($data["\x6d\163\147"])) {
            $this->updateModel->update_ack($data["\x6d\163\147"], empty($data["\151\x73\x53\x75\x63\143\x65\163\x73"]) ? false : true);
            $this->response->success("\123\165\143\x63\x65\163\x73\146\x75\154\x6c\x79\x20\165\160\144\141\x74\x65\x64\56");
        } else {
            $this->response->error("\x52\x65\x71\165\151\162\145\x64\40\146\x69\145\x6c\144\40\155\x69\x73\163\151\156\x67\x2e");
        }
        goto Bj4k_;
        o03fz:
        if (isCloud() || empty($_SERVER["\x48\x54\124\120\137\103\114\111\105\116\124\x41\120\x50"]) || $_SERVER["\110\x54\124\x50\137\x43\114\111\x45\x4e\124\x41\x50\x50"] != "\117\x75\x74\x70\x75\164\103\162\x6f\156") {
            show_404();
            return false;
        }
        goto zh0Ut;
        Bj4k_:
        $this->response->write();
        goto jf5Y_;
        jf5Y_:
    }
    public function obDumpDB($isGdrive = 0)
    {
        $file = $this->updateModel->ob_dumpDB($isGdrive);
        if (is_file($file)) {
            goto awWWm;
            E96Iq:
            unlink($file);
            goto U83T5;
            HNQTO:
            readfile($file);
            goto E96Iq;
            O2z84:
            header("\103\x6f\x6e\x6e\x65\143\x74\151\x6f\156\x3a\40\143\x6c\157\x73\145");
            goto HNQTO;
            CK0qa:
            header("\103\x6f\x6e\x74\145\156\x74\55\124\171\160\x65\72\40\141\x70\x70\x6c\151\143\x61\164\151\x6f\x6e\x2f\x66\157\162\143\145\55\x64\x6f\167\156\x6c\157\141\x64");
            goto oi2ew;
            oi2ew:
            header("\x43\157\x6e\164\x65\156\x74\55\x4c\145\x6e\147\x74\x68\x3a\40" . filesize($file));
            goto O2z84;
            awWWm:
            header("\103\157\156\x74\145\x6e\164\55\x44\x69\163\x70\x6f\163\x69\x74\x69\157\156\72\x20\x61\x74\164\x61\x63\150\x6d\145\x6e\164\73\x20\146\x69\154\x65\156\141\x6d\x65\x3d\x22" . basename($file) . "\42");
            goto CK0qa;
            U83T5:
        } else {
            goto OeSVR;
            OeSVR:
            if (!empty($file)) {
                $this->response->success($this->updateModel->message);
            } else {
                $this->response->error();
            }
            goto xmUhj;
            xmUhj:
            $this->response->write();
            goto jV8tt;
            jV8tt:
            return;
            goto A_2Lr;
            A_2Lr:
        }
    }
    public function doupdate($isLocal = false, $skipBackup = false)
    {
        goto dc1EI;
        y9bHS:
        if (empty($licData)) {
            goto wIqr4;
            wIqr4:
            $this->response->error("\x4c\x69\x63\145\x6e\163\145\40\144\141\164\x61\x20\x6e\x6f\x74\x20\141\166\x61\151\x6c\56");
            goto qdDbd;
            qdDbd:
            $this->response->write();
            goto ydCWQ;
            ydCWQ:
            return false;
            goto pZf5u;
            pZf5u:
        }
        goto RFfd4;
        Td3Yz:
        $this->response->write();
        goto d39ZI;
        OxZXt:
        if (!empty($isLocal)) {
            $ret = $this->updateModel->update_obooks_local($_GET["\166"], $skipBackup);
        } else {
            $ret = $this->updateModel->update_obooks($_GET["\166"], $skipBackup);
        }
        goto BfsTP;
        BfsTP:
        if ($ret) {
            goto EQc7e;
            SK8BA:
            $result = $this->users->set_company_data(get_company("\x69\144"));
            goto YCgjv;
            YCgjv:
            $this->response->success("\123\x75\143\143\145\x73\x73\146\x75\x6c\x6c\171\x20\x75\x70\144\141\x74\x65\144\x2e");
            goto dZslQ;
            EQc7e:
            $this->load->model("\x75\163\145\162\163");
            goto SK8BA;
            dZslQ:
            $this->response->set_data(array("\x76\145\x72\x73\x69\157\x6e" => $_GET["\x76"]));
            goto KJQHV;
            KJQHV:
        } else {
            $this->response->error($this->updateModel->message ? $this->updateModel->message : "\x44\157\x77\x6e\x6c\157\x61\x64\x20\x65\x72\162\x6f\162\56");
        }
        goto Td3Yz;
        q0VWX:
        $ret = null;
        goto OxZXt;
        RFfd4:
        if (!empty($licData["\151\x73\x45\170\x70\151\162\x65\144"])) {
            goto GS2Qw;
            bUKCf:
            return false;
            goto PaZiA;
            kXptz:
            $this->response->write();
            goto bUKCf;
            GS2Qw:
            if (!empty($licData["\x69\x73\x54\x72\151\141\x6c"])) {
                $this->response->error("\x4c\151\x63\x65\156\163\x65\x20\x6b\145\x79\x20\x65\x78\160\151\162\x65\144\x2e");
            } else {
                $this->response->error("\122\x65\x6e\145\167\40\171\157\x75\162\40\x50\x72\157\40\114\151\x63\x65\156\163\145\x20\153\x65\x79\x20\141\x6e\x64\40\x67\x65\164\x20\154\141\164\x65\163\164\x20\165\160\x64\x61\x74\145\x73\x20\146\x6f\162\40\156\x65\170\x74\40\157\156\x65\40\171\145\x61\x72\56\x26\x6e\142\x73\x70\73\46\156\142\x73\x70\x3b\46\156\142\163\160\73\74\x61\40\x68\x72\145\x66\x3d\x22\x2f\57\167\x77\167\56\x6f\165\x74\160\165\164\x62\157\157\153\x73\x2e\x63\157\x6d\57\x70\x72\151\x63\151\156\x67\x2f\x22\x20\164\141\162\x67\x65\x74\75\42\x5f\142\154\141\156\153\42\x3e\x52\x65\x6e\x65\167\x20\x4e\157\167\x3c\x2f\x61\x3e\46\156\x62\x73\160\x3b\x26\x6e\142\163\160\x3b\46\x6e\142\x73\x70\x3b");
            }
            goto kXptz;
            PaZiA:
        }
        goto eqBKM;
        eqBKM:
        if (empty($_GET["\166"])) {
            goto CndIM;
            CndIM:
            $this->response->error("\126\x65\x72\x73\x69\157\x6e\40\x6d\x69\163\x73\151\156\x67\56");
            goto cU9iG;
            cU9iG:
            $this->response->write();
            goto A03HQ;
            A03HQ:
            return false;
            goto Yn4Yq;
            Yn4Yq:
        }
        goto q0VWX;
        dc1EI:
        $licData = get_user_data("\x6c\x69\143\145\156\163\x65\104\141\164\x61");
        goto y9bHS;
        d39ZI:
    }
    public function licensekey()
    {
        goto wIvXv;
        MwPo_:
        $this->response->write();
        goto WUIvi;
        a1RgV:
        if (!empty($data) && !empty($data["\x6c\x69\x63\145\156\x73\145\113\x65\171"])) {
            goto be1yb;
            k7fVb:
            if ($ret) {
                goto IkdZ6;
                VvKb4:
                $this->response->success("\x53\x75\143\143\145\x73\163\146\x75\154\x6c\171\x20\165\160\x64\x61\164\x65\x64\56");
                goto DAUp_;
                IkdZ6:
                $userData = get_user_data();
                goto HC3CT;
                pBlhx:
                set_user_data($userData);
                goto VvKb4;
                HC3CT:
                $userData = array_merge($userData, $ret);
                goto pBlhx;
                DAUp_:
            } else {
                $this->response->error($this->users->message);
            }
            goto YtuPb;
            be1yb:
            $uId = get_user_data("\x70\x72\x69\155\125\x73\x65\x72\151\x64", true);
            goto WPJKm;
            ney8C:
            $actKey = empty($data["\x61\x63\164\x4b\145\x79"]) ? '' : $data["\x61\143\x74\113\x65\x79"];
            goto BxliC;
            BxliC:
            $ret = $this->users->updateLicenseDetails($uId, $data["\154\x69\x63\x65\x6e\163\x65\113\145\171"], $actKey);
            goto k7fVb;
            WPJKm:
            $this->load->model("\x75\163\145\x72\x73");
            goto ney8C;
            YtuPb:
        } else {
            goto lrzh3;
            lrzh3:
            $licenseKey = get_user_data("\x6c\x69\143\x65\156\163\145\x4b\145\171", true);
            goto JPlpY;
            hTmKm:
            if (!empty($licenseKey)) {
                $this->response->set_data(array("\x6c\x69\143\145\156\163\145\x4b\x65\x79" => $licenseKey));
            }
            goto v6zTp;
            JPlpY:
            $this->response->success();
            goto hTmKm;
            v6zTp:
        }
        goto MwPo_;
        wIvXv:
        $data = $this->request->post();
        goto a1RgV;
        WUIvi:
    }
    public function actkey()
    {
        goto T_qlj;
        T_qlj:
        $data = $this->request->post();
        goto DMAXj;
        DMAXj:
        if (!empty($data) && !empty($data["\x61\x63\164\113\x65\171"])) {
            $this->_activate($data);
        } else {
            $this->response->error("\x41\x63\164\x69\166\x61\164\x69\x6f\x6e\x20\153\145\x79\40\x6d\x69\163\x73\x69\156\x67");
        }
        goto wAgCO;
        wAgCO:
        $this->response->write();
        goto Bgr40;
        Bgr40:
    }
    public function activate()
    {
        goto ItgEb;
        ItgEb:
        $result = $this->updateModel->activate();
        goto N1GBd;
        LD7bA:
        if (!empty($result["\141\143\164\113\145\171"])) {
            $this->_activate($result);
        } else {
            $this->response->set_data($result);
        }
        goto OaRWS;
        OaRWS:
        $this->response->write();
        goto FBddP;
        N1GBd:
        if ($result === false) {
            goto S3hGz;
            STPkt:
            $this->response->write();
            goto Vn8lW;
            S3hGz:
            $this->response->error($this->updateModel->message);
            goto STPkt;
            Vn8lW:
            return false;
            goto C_osh;
            C_osh:
        }
        goto fk6kH;
        fk6kH:
        $this->response->success();
        goto LD7bA;
        FBddP:
    }
    private function _activate($data = array())
    {
        goto Yuh6i;
        Yuh6i:
        $uId = get_user_data("\160\162\151\x6d\125\163\x65\162\x69\144", true);
        goto L3iRu;
        L3iRu:
        $this->load->model("\165\x73\145\x72\x73");
        goto ZU9hB;
        Sz8vt:
        if ($ret) {
            goto UM4NP;
            wmk1J:
            $this->response->set_data("\144\x65\166\x69\143\x65\x5f\141\143\x74\151\166\x61\x74\x65\144", "\61");
            goto bWkvT;
            UM4NP:
            $userData = get_user_data();
            goto I0Vh_;
            tiM87:
            $this->response->success("\123\x75\x63\143\145\163\x73\146\x75\x6c\154\x79\x20\x64\145\x76\x69\143\145\40\141\143\x74\x69\x76\141\164\x65\144\56");
            goto wmk1J;
            I0Vh_:
            $userData = array_merge($userData, $ret);
            goto CWWg5;
            CWWg5:
            set_user_data($userData);
            goto tiM87;
            bWkvT:
        } else {
            $this->response->error($this->users->message);
        }
        goto HWIaz;
        Otcjy:
        $licenseKey = get_user_data("\154\x69\x63\145\x6e\163\145\x4b\145\x79", true);
        goto xDUci;
        ZU9hB:
        $actKey = $data["\x61\143\x74\113\x65\x79"];
        goto Otcjy;
        xDUci:
        $ret = $this->users->updateLicenseDetails($uId, $licenseKey, $actKey);
        goto Sz8vt;
        HWIaz:
    }
    public function reqkey()
    {
        goto LfJjm;
        Gx6TJ:
        $this->response->success();
        goto W63iK;
        W63iK:
        $this->response->set_data(array("\162\145\161\113\145\171" => $reqKey));
        goto WmZzn;
        WmZzn:
        $this->response->write();
        goto hqY81;
        LfJjm:
        $this->load->library("\157\142\137\154\151\143\x65\x6e\163\145");
        goto JPNQ7;
        JPNQ7:
        $reqKey = $this->ob_license->get_machine_info();
        goto Gx6TJ;
        hqY81:
    }
    public function about()
    {
        goto ja2Wk;
        ja2Wk:
        $licenseKey = get_user_data("\154\151\143\145\156\163\145\x4b\x65\x79", true);
        goto abuYm;
        PVAAS:
        if (!$this->isCloud) {
            goto ojEVK;
            HFrf2:
            if (!empty($dbBackupLog)) {
                $this->response->set_data(array("\x64\x62\x42\x61\x63\153\x75\160\114\157\x67" => $dbBackupLog));
            }
            goto u0XMf;
            gY_JT:
            $dbBackupLog = $this->updateModel->get_db_backup_log();
            goto HFrf2;
            ojEVK:
            if (!empty($licenseKey)) {
                $actKey = $this->updateModel->get_actkey();
                $this->response->set_data(array("\x6c\x69\x63\145\156\163\x65\x4b\x65\171" => $licenseKey, "\x61\143\x74\113\x65\171" => $actKey));
            }
            goto Cl10n;
            wmxbN:
            if (!empty($backupList)) {
                $this->response->set_data(array("\142\141\143\x6b\x75\160\114\151\163\x74" => $backupList));
            }
            goto gY_JT;
            Cl10n:
            $backupList = $this->updateModel->get_backup_list();
            goto wmxbN;
            u0XMf:
        }
        goto dtxwy;
        abuYm:
        $this->response->success();
        goto PVAAS;
        w035q:
        $this->response->write();
        goto MZJoZ;
        s3mCX:
        $result = $this->oauth2Model->connected("\147\157\157\x67\154\145");
        goto zPaE6;
        zPaE6:
        if ($result) {
            goto Xar6h;
            s2WAG:
            $this->response->set_data("\x67\144\x72\x69\x76\145", $sendData);
            goto KipQT;
            xOltT:
            if (!empty($this->oauth2Model->params)) {
                $sendData = array_merge($sendData, $this->oauth2Model->params);
            }
            goto ZciiY;
            ZciiY:
            if (!empty($this->oauth2Model->dir)) {
                $sendData = array_merge($sendData, is_array($this->oauth2Model->dir) ? $this->oauth2Model->dir : array($this->oauth2Model->dir));
            } else {
                $dirs = $this->oauth2Model->getdirs();
                if (!empty($dirs)) {
                    $sendData["\x64\151\162\x4c\x69\163\164"] = $dirs;
                }
            }
            goto s2WAG;
            Xar6h:
            $sendData = array("\143\x6f\156\156\x65\143\x74\x65\x64" => 1);
            goto xOltT;
            KipQT:
        } else {
            if (!empty($this->oauth2Model->message)) {
                $this->response->set_message($this->oauth2Model->message);
            }
        }
        goto w035q;
        dtxwy:
        $this->load->model("\157\x61\x75\x74\150\62\115\x6f\x64\x65\154");
        goto s3mCX;
        MZJoZ:
    }
    public function authorize($app = "\147\x6f\x6f\x67\154\145", $code = '')
    {
        goto eQYQm;
        eQYQm:
        $this->load->model("\x6f\x61\165\x74\150\x32\x4d\157\144\x65\154");
        goto PZ0EH;
        zfhgC:
        $this->response->write();
        goto G_QQ1;
        PZ0EH:
        $ret = $this->oauth2Model->callback($app, $code);
        goto p364G;
        p364G:
        if ($ret) {
            goto qJwv9;
            ouie7:
            $dirs = $this->oauth2Model->getdirs();
            goto enXdm;
            VvfEz:
            $this->response->set_data("\x67\144\x72\x69\166\x65", $sendData);
            goto twC_0;
            qJwv9:
            $this->response->success();
            goto mfb1m;
            p9nAg:
            if (!empty($this->oauth2Model->params)) {
                $sendData = array_merge($sendData, $this->oauth2Model->params);
            }
            goto ouie7;
            mfb1m:
            $sendData = array("\x63\x6f\x6e\x6e\145\143\164\x65\x64" => 1);
            goto p9nAg;
            enXdm:
            if (!empty($dirs)) {
                $sendData["\x64\x69\162\x4c\151\163\164"] = $dirs;
            }
            goto VvfEz;
            twC_0:
        } else {
            $this->response->error($this->oauth2Model->message);
        }
        goto zfhgC;
        G_QQ1:
    }
    public function revert()
    {
        goto coZod;
        sqMEw:
        if ($ret) {
            $this->response->success("\x53\165\x63\143\x65\163\163\x66\165\154\x6c\171\x20\165\x70\144\141\164\x65\x64\56");
            $this->response->set_data(array("\166\x65\162\x73\x69\157\x6e" => $_GET["\x76"]));
        } else {
            $this->response->error($this->updateModel->message ? $this->updateModel->message : "\x52\x65\x76\145\162\164\x20\x65\162\x72\x6f\162\56");
        }
        goto ax6cl;
        ihRwQ:
        $ret = null;
        goto nUfVq;
        coZod:
        if (empty($_GET["\x76"])) {
            goto SZ6AP;
            rm0NW:
            return false;
            goto awb9I;
            SZ6AP:
            $this->response->error("\x56\x65\162\x73\151\x6f\156\x20\155\x69\163\x73\x69\156\x67\x2e");
            goto XBfvc;
            XBfvc:
            $this->response->write();
            goto rm0NW;
            awb9I:
        }
        goto ihRwQ;
        nUfVq:
        $ret = $this->updateModel->revert($_GET["\x76"]);
        goto sqMEw;
        ax6cl:
        $this->response->write();
        goto ldgQN;
        ldgQN:
    }
    public function updatedb()
    {
        $ret = $this->updateModel->update_db(FCPATH . "\144\141\x74\x61\x62\x61\x73\145\x2e\x70\x68\160");
        print_R($ret);
    }
}
