本文整理汇总了PHP中Output::http_error方法的典型用法代码示例。如果您正苦于以下问题:PHP Output::http_error方法的具体用法?PHP Output::http_error怎么用?PHP Output::http_error使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Output
的用法示例。
在下文中一共展示了Output::http_error方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例3: die
<?php
if (!Session::is_group_user("Importer")) {
Output::http_error(403);
} else {
if (!isset($_REQUEST["filename"])) {
die(json_encode(array("error" => "invalid input file")));
}
$uploaded_file = utf8_decode(FILE_ROOT . "uploads/" . $_REQUEST["filename"]);
if (!isset($_REQUEST["type"])) {
$_REQUEST["type"] = "music";
}
if (!isset($_REQUEST["title"]) || $_REQUEST["title"] === "") {
die(json_encode(array("error" => "You must specify a title")));
}
$current_archive = Archives::get_playin();
$path = is_dir($current_archive->get_localpath()) ? $current_archive->get_localpath() : (is_dir($current_archive->get_remotepath()) ? $current_archive->get_remotepath() : die(json_encode(array('error' => 'Playin archive inaccessible'))));
if (!is_writable($path)) {
die(json_encode(array("error" => "Audio archive is not writable")));
}
$tempfile = tempnam(sys_get_temp_dir(), 'dps') . "." . pathinfo($uploaded_file, PATHINFO_EXTENSION);
copy($uploaded_file, $tempfile);
$md5 = md5_file($tempfile);
$output = array();
# Execute SoX to convert our audio
# Trim silence from beginning and end (1% volume threshold)
# Convert to 44.1kHz 16-bit stereo for consistency
# Normalise to -0.1dB
# Save as flac in inbox
exec("sox \"" . $tempfile . "\" -b 16 \"" . $path . "/inbox/" . $md5 . ".flac\" silence 1 0.1 -72d reverse silence 1 0.1 -72d reverse channels 2 rate 44100 gain -n -0.1 2>&1", $output);
if (strpos(implode($output), "FAIL")) {