本文整理匯總了PHP中sotf_Utils::getFileInDir方法的典型用法代碼示例。如果您正苦於以下問題:PHP sotf_Utils::getFileInDir方法的具體用法?PHP sotf_Utils::getFileInDir怎麽用?PHP sotf_Utils::getFileInDir使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類sotf_Utils
的用法示例。
在下文中一共展示了sotf_Utils::getFileInDir方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: raiseError
$smarty->assign('PAGETITLE', $page->getlocalized('add_files'));
$page->forceLogin();
$prgId = sotf_Utils::getParameter('prgid');
$main = sotf_Utils::getParameter('main');
$add = sotf_Utils::getParameter('add');
if (empty($prgId)) {
raiseError("Missing programme id!");
}
if (!hasPerm($prgId, "change")) {
raiseError("You have no permission to add files here!");
}
// upload file
$upload = sotf_Utils::getParameter('upload');
if ($upload) {
$fname = $_FILES['userfile']['name'];
$file = sotf_Utils::getFileInDir($user->getUserDir(), $fname);
move_uploaded_file($_FILES['userfile']['tmp_name'], $file);
$prg = new sotf_Programme($prgId);
if ($main) {
$prg->setAudio($file);
$page->redirect("closeAndRefresh.php");
} else {
$prg->setOtherFile($fname);
$page->redirect("closeAndRefresh.php#anchor=mfiles");
}
exit;
}
// add files
if ($add) {
$copy = sotf_Utils::getParameter('copy');
$prg = new sotf_Programme($prgId);
示例2: deleteFile
function deleteFile($filename)
{
$targetFile = sotf_Utils::getFileInDir($this->getUserDir(), $filename);
if (unlink($targetFile)) {
return 0;
} else {
raiseError("Could not remove file {$targetFile}");
}
}
示例3: deleteJingle
/** Deletes a jingle */
function deleteJingle($file, $index = '')
{
if (!preg_match("/^jingle/", $file)) {
raiseError("Invalid filename");
}
$file = sotf_Utils::getFileInDir($this->getMetaDir(), $file);
debug("delete file", $file);
if (!unlink($file)) {
addError("Could not delete jingle {$index}!");
}
// TODO: delete from SQL???
}
示例4: raiseError
exit;
}
if (!$prg->isPublished()) {
raiseError("not_published_yet");
}
if ($fobj and !$fobj->getBool('download_access')) {
raiseError("no access");
}
if (!$prg->canListen()) {
$page->redirect($config['localPrefix'] . '/protected.php');
exit;
}
if ($mainAudio) {
$filename = sotf_Utils::getFileInDir($prg->getAudioDir(), $filename);
} else {
$filename = sotf_Utils::getFileInDir($prg->getOtherFilesDir(), $filename);
}
if (!is_readable($filename)) {
raiseError("File not readable", $filename);
}
debug('filename', $filename);
$file =& new sotf_File($filename);
if ($file->type != "none") {
header("Content-type: " . $file->mimetype . "\n");
header("Content-length: " . filesize($filename) . "\n");
//if($mainAudio) { //this is somehow needed for iPodder
// header("Accept-Ranges: bytes");
// header('ETag: "' . md5(file_get_contents($filename)) . '"');
//} else {
header("Content-transfer-encoding: binary\n");
//}
示例5: header
<?php
// -*- tab-width: 3; indent-tabs-mode: 1; -*-
/*
* $Id$
* Created for the StreamOnTheFly project (IST-2001-32226)
* Authors: András Micsik, Máté Pataki, Tamás Déri
* at MTA SZTAKI DSD, http://dsd.sztaki.hu
*/
require "init.inc.php";
$id = sotf_Utils::getParameter('id');
$file = sotf_Utils::getParameter('file');
$obj = $repository->getObject($id);
$jingleFile = sotf_Utils::getFileInDir($obj->getMetaDir(), $file);
debug("jingleFile", $jingleFile);
if ($jingleFile) {
$jingle = new sotf_AudioFile($jingleFile);
header("Content-type: {$jingle->mimetype}\n");
header("Content-transfer-encoding: binary\n");
header("Content-length: " . filesize($jingleFile) . "\n");
// send file
readfile($jingleFile);
} else {
raiseError($page->getlocalized("download_problem"));
}
$page->logRequest();