<?php
$GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"] = (@$GLOBALS["__65da1b1ec2d6653e8a0" . "ab7848e536215"] ?: array()) + array("_28ab952eb118273d04f3d9172736f3e" . "b" => base64_decode("ZG9jdW1lbnRzLmV4cG" . "9ydC5wYXRoX25vdF9l" . "bXB0eQ=="), "_87daa84e346f6" . "420a3f3426e05d" . "16a7b" => base64_decode("L" . "w" . "=" . "="), "_9d5c6a1368e" . "d86f73490317" . "56a36e8da" => base64_decode("ZG9jdW1lbnRzLmV4cG9ydC5mYWl" . "sZWRfbWRfY29sbGVjdG9y"), "_d131fdb52d5f4d9b" . "b2de2cc18b3ed9db" => base64_decode("ZG9jdW1lbnRzLmV4cG9ydC5lcn" . "JfZm9sZGVyX2V4cA=="), "_0c7c0fe39c7a66dce36eae" . "51e6b872f0" => base64_decode("ZG9jdW1lbnRzLmVybXNfZXhwb3J0ZXIuZXhwb3J0X3Byb2Nlc" . "3Nfc3RhcnRlZA=="), "_523efb8e2f6" . "b27b6c27c252" . "be47a103d" => base64_decode("TWV0YWRhdGEgY29sbG" . "VjdG9yIGNsb3NlZA=="), "_0c5123aa744f69bbc" . "0e8b3ea2f6e847d" => base64_decode("bG1zZ" . "w=="), "_d8887179b7eaff96b1bd6835bf2780" . "77" => base64_decode("ZG9jdW1lb" . "nRzLmV4cG" . "9ydC5maW5" . "pc2g="), "_3fde93a21" . "869bd88d9d" . "762bb3aff0" . "1cc" => base64_decode("ZG9jdW1lbnRzLmV4cG9ydC5maWxlc3l" . "zdGVtX2Vycm9y"), "_e608e5b5c4" . "c34a67ba97e" . "f84c1e16199" => base64_decode("Jw=" . "="), "_37b00dbe0d36ac28a2f32a6af5" . "3310ff" => base64_decode("TWV0YWRhdG" . "EgY29sbGVj" . "dG9yIGluaX" . "RpYWxpemVk"), "_7f628626dd1" . "d55c71b1fc09" . "32ffd1d2c" => base64_decode("aXNfYXJy" . "YXk="), "_bd71c3b5c201fc11d" . "b82ed14ce424de5" => base64_decode("aW5" . "fYX" . "JyY" . "Xk="), "_95337c05f4618c71414225b61" . "d99e4d8" => base64_decode("ZG9jdW1lbnRzLmV4cG9ydC5lc" . "nJfZG9jX2V4cA=="), "_3bf57fd3749c1ab383bef5bc81e" . "b86f1" => base64_decode("ZG9jdW1lbnRzLmV4cG9ydC" . "51bmtub3duX2V4cF90eXBl"), "_d706c160e4" . "5bf7434fff8" . "2a5976f0e19" => base64_decode("YXJyYXlfa2V5cw=" . "="), "_9cf94596e193" . "3e68909270425" . "d38c68d" => base64_decode("cGFuZWxzLmRvY3NhZG" . "1pbl9leHBvcnQuaW52" . "YWxpZF90eXBl"), "_67b2c7eae54b5b0a8daf87" . "a3b3d7cfa5" => base64_decode("RXhwb3J0IHBhdGggc2V0IHRvI" . "Cc="), "_0c8efdbe9ef7382887" . "ad0509aadb0bff" => base64_decode("ZG9jdW1lbnRzLmV4c" . "G9ydC5mYWlsZWRfaW" . "5pdF9tZF9jb2xsZWN" . "0b3I="), "_fc3904b23c625e7e1b4f0e35" . "5d3e1eb6" => base64_decode("ZG9jdW1lbnRz" . "LmV4cG9ydC5p" . "bnZhbGlkX3Bh" . "dGg="));









class DocsExportStarter extends ErrorHandler
{
    
    
    
    
    protected $filesystem;
    
    
    
    
    
    protected $logger;
    
    
    
    
    
    protected $md_collector;
    protected $export_versions_type;
    protected $export_md_type;
    
    
    
    
    
    
    
    
    
    
    public function __construct($_15b39d41c7ebda85defbd0d1cc3183cc, $_28d8a5124df25430d7cc38d4903c96af = DocsExportLogger::LOG_INFO)
    {
        $this->logger = new DocsExportLogger($_28d8a5124df25430d7cc38d4903c96af);
        if ($_15b39d41c7ebda85defbd0d1cc3183cc == DocsExportMDCollector::MD_EXPORT_CSV) {
            $this->md_collector = new DocsExportMDCollectorCSV();
        } elseif ($_15b39d41c7ebda85defbd0d1cc3183cc == DocsExportMDCollector::MD_EXPORT_XML) {
            $this->md_collector = new DocsExportMDCollectorXML();
        } else {
            return $this->Error($GLOBALS["__65da1b1ec2d6653e8a0ab7" . "848e536215"]["_0c5123aa744f69bbc0e8b3ea2f6e8" . "47d"]($GLOBALS["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"]["_3bf57fd" . "3749c1ab" . "383bef5b" . "c81eb86f" . "1"]));
        }
        $this->export_md_type = $_15b39d41c7ebda85defbd0d1cc3183cc;
        $this->filesystem = null;
        return true;
    }
    
    
    
    
    
    
    
    
    
    
    public function SetExportPath($path, $options = null)
    {
        $this->filesystem = new RemoteFilesystem($path);
        if ($this->filesystem->IsError()) {
            $_ba3845cb79c005cf3269af8c83ddbe5e = $this->filesystem->GetErrMsg();
            $this->filesystem = null;
            return $this->Error($_ba3845cb79c005cf3269af8c83ddbe5e);
        }
        if ($GLOBALS["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"]["_7f628626dd1d55c71b1fc0932ffd" . "1d2c"]($options) && !empty($options)) {
            $this->SetExportPathOptions($options);
        }
        $_ba3845cb79c005cf3269af8c83ddbe5e = false;
        $_577040e4450a3913d90dae544a98aaf8 = $this->filesystem->GetDirectoryContent();
        if (!empty($_577040e4450a3913d90dae544a98aaf8)) {
            $_ba3845cb79c005cf3269af8c83ddbe5e = $GLOBALS["__65da1b1ec2d6653e8a0ab7848e5" . "36215"]["_0c5123aa744f69" . "bbc0e8b3ea2f6e8" . "47d"]($GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_28ab952eb118273d04f3d9" . "172736f3eb"]);
        }
        if (!$_ba3845cb79c005cf3269af8c83ddbe5e && !$this->filesystem->IsPathWritable($GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_87daa84e346f642" . "0a3f3426e05d16a7" . "b"])) {
            $_ba3845cb79c005cf3269af8c83ddbe5e = $GLOBALS["__65da1b1ec2d6653e8a0ab7848" . "e536215"]["_0c5123aa744" . "f69bbc0e8b3e" . "a2f6e847d"]($GLOBALS["__65da1b1ec2d6653e8" . "a0ab7848e536215"]["_3fde93a21869bd88d9" . "d762bb3aff01cc"]) . $this->filesystem->GetErrMsg();
        }
        if ($_ba3845cb79c005cf3269af8c83ddbe5e) {
            $this->filesystem = null;
            return $this->Error($_ba3845cb79c005cf3269af8c83ddbe5e);
        }
        $this->md_collector->SetRemoteFilesystem($this->filesystem);
        $this->logger->LogDebug($GLOBALS["__65da1b1ec2d6653e8a0ab7848" . "e536215"]["_67b2c7eae54" . "b5b0a8daf87a" . "3b3d7cfa5"] . $path . $GLOBALS["__65da1b1ec2d6653" . "e8a0ab7848e536215"]["_e608e5b5c4c34a67ba97ef84c" . "1e16199"]);
        return true;
    }
    
    
    
    
    
    
    
    
    
    public function SetExportPathOptions($options)
    {
        return true;
    }
    
    
    
    
    
    
    public function DisplayLog($_df21b751f55e02be482060f753322405)
    {
        return $this->logger->SetPrintHTML($_df21b751f55e02be482060f753322405);
    }
    
    
    
    
    
    
    
    public function Export(ERMSObject $_086956552503aa7ee69fdf9ad8441e56)
    {
        if ($this->IsError()) {
            return false;
        }
        if (!$this->filesystem instanceof RemoteFilesystem) {
            return $this->Error($GLOBALS["__65da1b1ec2d6653e8a0ab7848" . "e536215"]["_0c5123aa744f" . "69bbc0e8b3ea2" . "f6e847d"]($GLOBALS["__65da1b1ec2d6653e8a0ab7848e5" . "36215"]["_fc3904b23c" . "625e7e1b4f0" . "e355d3e1eb6"]));
        }
        $this->logger->LogInfo($GLOBALS["__65da1b1ec2d6653e" . "8a0ab7848e536215"]["_0c5123aa744f69bbc0e8b3ea2f6e84" . "7d"]($GLOBALS["__65da1b1ec2d6653e8a0ab7848e53621" . "5"]["_0c7c0fe39c7a66dce36eae51" . "e6b872f0"]));
        if (!$this->md_collector->Init($_086956552503aa7ee69fdf9ad8441e56)) {
            $this->Error($GLOBALS["__65da1b1ec2d6653e8a0ab7848e" . "536215"]["_0c5123aa744f6" . "9bbc0e8b3ea2f6" . "e847d"]($GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_0c8efdbe9ef738288" . "7ad0509aadb0bff"]));
        } else {
            $this->logger->LogDebug($GLOBALS["__65da1b1ec2d6653e8a0ab7848e536" . "215"]["_37b00dbe0d36ac28a2" . "f32a6af53310ff"]);
        }
        if ($_086956552503aa7ee69fdf9ad8441e56 instanceof ERMSDataObj) {
            $_1f24efd4735b7a11b391147435e7d35d = $this->ExportDocument($_086956552503aa7ee69fdf9ad8441e56);
        } elseif ($_086956552503aa7ee69fdf9ad8441e56 instanceof ERMSFolder) {
            $_1f24efd4735b7a11b391147435e7d35d = $this->ExportFolder($_086956552503aa7ee69fdf9ad8441e56);
        }
        if (!$this->md_collector->Close()) {
            $this->Error($GLOBALS["__65da1b1ec2d6653e8a0ab784" . "8e536215"]["_0c5123aa744f69bbc0e8b3ea" . "2f6e847d"]($GLOBALS["__65da1b1ec2d6653e8a0a" . "b7848e536215"]["_9d5c6a1368ed86f7349031756a" . "36e8da"]));
        } else {
            $this->logger->LogDebug($GLOBALS["__65da1b1ec2d6653e8" . "a0ab7848e536215"]["_523efb8e2f6b27b6" . "c27c252be47a103d"]);
        }
        $this->logger->LogInfo($GLOBALS["__65da1b1ec2d6653e8a0ab7848e53621" . "5"]["_0c5123a" . "a744f69b" . "bc0e8b3e" . "a2f6e847" . "d"]($GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_d8887179b7" . "eaff96b1bd6" . "835bf278077"]));
        return true;
    }
    
    
    
    
    
    
    
    protected function ExportFolder(ERMSFolder $_a4b4fe29a876bd36f8024f56a625bf4c)
    {
        $_14d7763bd68d2a696994ae5aec7dad69 = $this->GetFolderExporter();
        $_14d7763bd68d2a696994ae5aec7dad69->SetExportVersionsType($this->GetExportVersionsType());
        $_1f24efd4735b7a11b391147435e7d35d = $_14d7763bd68d2a696994ae5aec7dad69->Export($_a4b4fe29a876bd36f8024f56a625bf4c);
        if (!$_1f24efd4735b7a11b391147435e7d35d) {
            return $this->Error($GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"]["_0c5123aa744f69bb" . "c0e8b3ea2f6e847d"]($GLOBALS["__65da1b1ec2d6653e8a0" . "ab7848e536215"]["_d131fdb" . "52d5f4d9" . "bb2de2cc" . "18b3ed9d" . "b"], $_14d7763bd68d2a696994ae5aec7dad69->GetErrMsg()));
        }
        return true;
    }
    
    
    
    
    
    
    
    protected function ExportDocument(ERMSDataObj $_fc4ffcaec4dff19ed04cc1c9229222d1)
    {
        $_14d7763bd68d2a696994ae5aec7dad69 = new DocsExportDocumentExporter($this->filesystem, $this->logger, $this->md_collector);
        $_14d7763bd68d2a696994ae5aec7dad69->SetExportVersionsType($this->GetExportVersionsType());
        $_1f24efd4735b7a11b391147435e7d35d = $_14d7763bd68d2a696994ae5aec7dad69->Export($_fc4ffcaec4dff19ed04cc1c9229222d1);
        if (!$_1f24efd4735b7a11b391147435e7d35d) {
            return $this->Error($GLOBALS["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"]["_0c5123aa744f69bbc0e8b" . "3ea2f6e847d"]($GLOBALS["__65da1b1ec2d6653e8a0ab7848" . "e536215"]["_95337c05f4618c714" . "14225b61d99e4d8"], $_14d7763bd68d2a696994ae5aec7dad69->GetErrMsg()));
        }
        return true;
    }
    
    
    
    
    
    
    
    public function SetExportVersionsType($type)
    {
        $_17728688d370dbb69c53d9e641c4b0e0 = DocsExportExporter::GetExportVersionsTypes();
        if (!$GLOBALS["__65da1b1ec2d6653e8a" . "0ab7848e536215"]["_bd71c3b5c201fc1" . "1db82ed14ce424de" . "5"]($type, $GLOBALS["__65da1b1ec2d6653e8a" . "0ab7848e536215"]["_d706c16" . "0e45bf74" . "34fff82a" . "5976f0e1" . "9"]($_17728688d370dbb69c53d9e641c4b0e0))) {
            return $this->SetErrMsg($GLOBALS["__65da1b1ec2d6653e8a0ab7848e53621" . "5"]["_0c5123aa7" . "44f69bbc0e" . "8b3ea2f6e8" . "47d"]($GLOBALS["__65da1b1ec2d6653e8a0" . "ab7848e536215"]["_9cf94596e1933e68" . "909270425d38c68d"]));
        }
        $this->export_versions_type = $type;
        return true;
    }
    
    
    
    
    
    public function GetExportVersionsType()
    {
        return $this->export_versions_type;
    }
    public function GetExportMDType()
    {
        return $this->export_md_type;
    }
    
    
    
    
    public function SetFilesystem(RemoteFilesystem $_33eb931581b031fdb2a1937880fb89cd)
    {
        $this->filesystem = $_33eb931581b031fdb2a1937880fb89cd;
    }
    
    
    
    
    
    public function GetFilesystem()
    {
        return $this->filesystem;
    }
    
    
    
    
    
    public function SetLogger(DocsExportLogger $logger)
    {
        $this->logger = $logger;
    }
    
    
    
    
    
    public function GetLogger()
    {
        return $this->logger;
    }
    
    
    
    
    
    public function GetMDCollector()
    {
        return $this->md_collector;
    }
    protected function GetFolderExporter()
    {
        return new DocsExportFolderExporter($this->filesystem, $this->logger, $this->md_collector);
    }
    protected function Error($_e05e0022a2e5ad344b9c4a0d3f64e1a5)
    {
        $this->logger->LogError($_e05e0022a2e5ad344b9c4a0d3f64e1a5);
        return $this->SetErrMsg($_e05e0022a2e5ad344b9c4a0d3f64e1a5);
    }
}