コード例 #1
0
<?php

require_once realpath(dirname(__FILE__)) . '/FileManagers.php';
include_once realpath(dirname(__FILE__)) . '/../libs/login.php';
global $current_user;
if (!$current_user->authenticated) {
    die('Please login to use this function.');
}
$fileId = $_GET['fileId'];
SourceDesAttachmentManager::getInstance()->deleteFile($fileId, $current_user->user_id);
echo $fileId;
コード例 #2
0
 private function __construct()
 {
     self::$attachment_dir = mnmpath . "sourceDesAttachments/";
 }
コード例 #3
0
<?php

include_once realpath(dirname(__FILE__)) . '/FileManagers.php';
require_once realpath(dirname(__FILE__)) . '/../OriginalSmarty/OriginalSmarty.class.php';
$sid = $_POST['sid'];
$allowDeleteFiles = $_POST['allowDeleteFiles'];
$attachmentInfos = SourceDesAttachmentManager::getInstance()->getSourceAttachmentsInfo($sid);
// Assign model to template.
$smarty = new OriginalSmarty();
$smarty->assign('attachmentInfos', $attachmentInfos);
$smarty->assign('allowDeleteFiles', $allowDeleteFiles);
$smarty->display('attachmentList.tpl');
コード例 #4
0
<?php

include_once realpath(dirname(__FILE__)) . '/FileManagers.php';
include_once realpath(dirname(__FILE__)) . '/../libs/login.php';
global $current_user;
if (!$current_user->authenticated) {
    die('Please login to use this function.');
}
$userId = $current_user->user_id;
$sid = $_GET['sid'];
$description = trim($_POST['description']);
$fileMgr = SourceDesAttachmentManager::getInstance();
$listItemModel = $fileMgr->saveFile($sid, $userId, $_FILES['files'], $description);
$files[] = $listItemModel;
$fileList = array('files' => $files);
echo json_encode($fileList);
コード例 #5
0
<?php

if (!isset($_GET['sid']) || is_int($_GET['sid'])) {
    die;
}
require_once realpath(dirname(__FILE__)) . '/FileManagers.php';
require_once realpath(dirname(__FILE__)) . '/../OriginalSmarty/OriginalSmarty.class.php';
include_once realpath(dirname(__FILE__)) . '/../libs/login.php';
global $current_user;
if (!$current_user->authenticated) {
    die('Please login to use this function.');
}
$model = SourceDesAttachmentManager::getInstance()->createFileUploadPageModel();
// Assign model to template.
$smarty = new OriginalSmarty();
$smarty->assign('model', $model);
$smarty->assign('sid', $_GET['sid']);
$smarty->display('sourceAttachmentUploadPage.tpl');
コード例 #6
0
<?php

require_once realpath(dirname(__FILE__)) . '/FileManagers.php';
$fileId = $_GET['fileId'];
$fileInfo = SourceDesAttachmentManager::getInstance()->downloadFile($fileId);
if ($fileInfo === null || !file_exists($fileInfo->path)) {
    die('File Not Found.');
}
header("Content-type:application");
header("Content-Length: " . $fileInfo->Size);
header("Content-Disposition: attachment; filename=" . $fileInfo->Title);
readfile($fileInfo->path);