本文整理汇总了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();