Example #1
0
        httpStatusExit(403, 'Forbidden');
    }
}
// check quota
if (check_quota($_root, $_SERVER["CONTENT_LENGTH"]) == false) {
    httpStatusExit(507, 'Insufficient Storage');
}
// action
$d = dirname($_filename);
if (!file_exists($d)) {
    mkdir($d, 0777, true);
}
$_data = file_get_contents('php://input');
if ($_input == 'raw') {
    require_once 'if-match.php';
    file_put_contents($_filename, $_data);
    httpStatusExit(201, 'Created');
}
$g = new Graph('', $_filename, '', $_base);
require_once 'if-match.php';
$g->truncate();
if (!empty($_input) && $g->append($_input, $_data)) {
    librdf_php_last_log_level() && httpStatusExit(400, 'Bad Request', null, librdf_php_last_log_message());
    $g->save();
    header('ETag: "' . md5_file($_filename) . '"');
    httpStatusExit(201, 'Created');
} else {
    librdf_php_last_log_level() && httpStatusExit(400, 'Bad Request', null, librdf_php_last_log_message());
    header('Accept-Post: ' . implode(',', $_content_types));
    httpStatusExit(406, 'Content-Type (' . $_content_type . ') Not Acceptable');
}