summaryrefslogtreecommitdiff
path: root/html/app/models/cms/Media_model.php
blob: 6a4a681b8282d073bcf0d649c90c2d34db849593 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php

namespace app\models\cms;

use \Registry;


class Media_model
{
    public static function serve($type, $id, $ticket)
    {

        // get media data
        // [ type =>, rights =>, path =>  ]

        // validate ticket
        // ValidateAccess::for($ticket)

        // serve
        // header("Content-type: type");
        // passthru('cat $media_path');


        return Registry::use('database')->query(
            "SELECT * FROM pages
                WHERE FullFriendlyUrl = :url AND IsActive = 1",
            [ ':url' => $url ]
        )->getFirst();
    }

}



// check:
// https://stackoverflow.com/questions/1353850/serve-image-with-php-script-vs-direct-loading-an-image