aboutsummaryrefslogtreecommitdiffhomepage
path: root/view.php
blob: 0ee8957b92a201fff8cfdb799736f890aa136ce3 (plain) (blame)
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
37
38
39
40
41
42
43
44
45
46
<?php
/**
 * poche, a read it later open source system
 *
 * @category   poche
 * @author     Nicolas LÅ“uillet <nicolas@loeuillet.org>
 * @copyright  2013
 * @license    http://www.wtfpl.net/ see COPYING file
 */

include dirname(__FILE__).'/inc/config.php';

if(isset($_GET['id']) && $_GET['id'] != '') {

    $sql    = "SELECT * FROM entries WHERE id=?";
    $params = array(intval($_GET['id']));

    # view article query
    try
    {
        $query  = $db->getHandle()->prepare($sql);
        $query->execute($params);
        $entry = $query->fetchAll();
    }
    catch (Exception $e)
    {
        die('query error : '.$e->getMessage());
    }

    if ($entry != NULL) {
        $tpl->assign('id', $entry[0]['id']);
        $tpl->assign('url', $entry[0]['url']);
        $tpl->assign('title', $entry[0]['title']);
        $tpl->assign('content', $entry[0]['content']);
        $tpl->assign('is_fav', $entry[0]['is_fav']);
        $tpl->assign('is_read', $entry[0]['is_read']);
        $tpl->assign('load_all_js', 0);
        $tpl->draw('view');
    }
    else {
        die('error in view call');
    }
}
else {
    die('error in view call');
}