* @license http://www.wtfpl.net/ see COPYING file
*/
-header('Content-type:text/html; charset=utf-8');
-
include dirname(__FILE__).'/inc/config.php';
-require_once dirname(__FILE__).'/inc/rain.tpl.class.php';
-$db = new db(DB_PATH);
-if(isset($_GET['id']) && $_GET['id'] != '') {
+$id = (isset ($_GET['id'])) ? htmlspecialchars($_GET['id']) : '';
+
+if(!empty($id)) {
- $sql = "SELECT * FROM entries WHERE id=?";
- $params = array(intval($_GET['id']));
+ $entry = get_article($id);
- # view article query
- try
- {
- $query = $db->getHandle()->prepare($sql);
- $query->execute($params);
- $entry = $query->fetchAll();
+ 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->assign('token', $_SESSION['token_poche']);
+ $tpl->draw('view');
}
- catch (Exception $e)
- {
- die('query error : '.$e->getMessage());
+ else {
+ die('error in view call');
}
-
- generate_page($entry[0]['url'], $entry[0]['title'], $entry[0]['content']);
+}
+else {
+ die('error in view call');
}
\ No newline at end of file