コード例 #1
0
$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
0
 function deleteFile($filename)
 {
     $targetFile = sotf_Utils::getFileInDir($this->getUserDir(), $filename);
     if (unlink($targetFile)) {
         return 0;
     } else {
         raiseError("Could not remove file {$targetFile}");
     }
 }
コード例 #3
0
 /** 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
0
ファイル: getFile.php プロジェクト: BackupTheBerlios/sotf-svn
    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
0
<?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();