예제 #1
0
        $PSCID = $config->getSetting("PSCID");
        $PSCIDFormat = \Utility::structureToPCRE($PSCID['structure'], "SITE");
        $type = $PSCID['generation'] == 'sequential' ? 'auto' : 'prompt';
        $settings = ["useEDC" => $useEDC, "PSCID" => ["Type" => $type, "Regex" => $PSCIDFormat]];
        if ($useProjects && $useProjects !== "false" && $useProjects !== "0") {
            $projects = \Utility::getProjectList();
            $projArray = [];
            foreach ($projects as $project) {
                $projArray[$project] = $settings;
            }
            $this->JSON = ["Projects" => $projArray];
        } else {
            $this->JSON = ["Projects" => array("loris" => $settings)];
        }
    }
    /**
     * Calculates ETag for projects based on the JSON encoding
     *
     * @return string ETag for projects
     */
    function calculateETag()
    {
        $this->handleGET();
        $etag = md5(json_encode($this->JSON, true));
        return $etag;
    }
}
if (isset($_REQUEST['PrintProjects'])) {
    $obj = new Projects($_SERVER['REQUEST_METHOD']);
    print $obj->toJSONString();
}