예제 #1
0
파일: Downloads.php 프로젝트: ssrsfs/blg
 public function output(\Pagemill_Data $data, \Pagemill_Stream $stream)
 {
     $this->pluginTemplate = "/downloads/downloads.plug.html";
     $data = $data->fork();
     $downloads = new Model_Download_File();
     $downloads->where('siteid = ?', Typeframe::CurrentPage()->siteid());
     $data['downloads'] = $downloads;
     parent::output($data, $stream);
 }
예제 #2
0
파일: download.php 프로젝트: ssrsfs/blg
<?php

$query = new Model_Download_File();
$query->where('encodedtitle = ?', pathinfo(Typeframe::CurrentPage()->pathInfo(), PATHINFO_FILENAME));
$query->where('siteid = ?', Typeframe::CurrentPage()->siteid());
$download = $query->getFirst();
if ($download->exists()) {
    $fullname = TYPEF_DIR . '/files/public/downloads/' . $download['filename'];
    $extension = pathinfo($download['filename'], PATHINFO_EXTENSION);
    if (file_exists($fullname) && is_file($fullname)) {
        $download['downloads'] = $download['downloads'] + 1;
        $download->save();
        header('Pragma: public');
        header('Content-Type: application/force-download');
        header('Content-Disposition: attachment; filename="' . $download['encodedtitle'] . '.' . $extension . '"');
        readfile($fullname);
        exit;
    }
}
http_response_code(404);
Typeframe::SetPageTemplate('/404.html');
예제 #3
0
파일: index.php 프로젝트: ssrsfs/blg
<?php

$downloads = new Model_Download_File();
$downloads->where('siteid = ?', Typeframe::CurrentPage()->siteid());
$pm->setVariable('downloads', $downloads);