Пример #1
0
 public function publishAction()
 {
     $id = isset($_POST["id"]) ? $_POST["id"] : null;
     $type = isset($_POST["type"]) ? $_POST["type"] : null;
     if ($_SERVER['REQUEST_METHOD'] != "POST" || $_SERVER["Repository_Enabled"] !== 'true' || is_numeric($this->session->userid) === false || is_numeric($id) === false || $type == null || Repository::canManageEntity($this->session->userid, $id, "release") == false) {
         header("Status: 404 Not Found");
         return;
     }
     $typename = "";
     if (trim($type) !== "") {
         switch (strtolower(trim($type))) {
             case "candidate":
                 $typename = "candidate";
                 break;
             case "production":
                 $typename = "production";
             default:
                 break;
         }
     }
     $output = "";
     $result = true;
     $result = RepositoryBackend::publish($id, $typename, $output);
     echo $output;
 }