1 | <?php |
---|
2 | // Chech whether we are indeed included by Piwigo. |
---|
3 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
4 | |
---|
5 | //узнаем номер страницы на которой находит пост, чтобы пользователь мог к ней вернутся через ссылку |
---|
6 | $row = pwg_db_fetch_assoc(pwg_query("SELECT COUNT(*) FROM `".Evil_Blog_Table."`")); |
---|
7 | if ($row["COUNT(*)"] % $page['evil_blog']['posts_per_page'] != 0) { |
---|
8 | $pages = floor($row["COUNT(*)"] / $page['evil_blog']['posts_per_page'])+1; |
---|
9 | } else {$pages = floor($row["COUNT(*)"] / $page['evil_blog']['posts_per_page']);} |
---|
10 | |
---|
11 | $npage = floor($tokens[2] / $page['evil_blog']['posts_per_page'])+1; |
---|
12 | $npage = $pages-$npage+1; |
---|
13 | ///// |
---|
14 | $query = "SELECT id, UNIX_TIMESTAMP(date) AS date, header, text |
---|
15 | FROM `".Evil_Blog_Table."` |
---|
16 | WHERE `id`=".$tokens[2]; |
---|
17 | $row = pwg_db_fetch_assoc(pwg_query($query)); |
---|
18 | if (!empty($row)){ |
---|
19 | $row['date'] = date($page['evil_blog']['date_format'], $row['date']); |
---|
20 | if($ExDesc['state'] == 'active') { |
---|
21 | $row['text'] = get_extended_desc($row['text']); |
---|
22 | $row['header'] = get_user_language_desc($row['header']); |
---|
23 | } |
---|
24 | $template->assign('row', $row); |
---|
25 | $template->assign('npage', $npage); |
---|
26 | //отсылаем в СМАРТИ настройки внешнего вида |
---|
27 | $template->assign('show_number', $page['evil_blog']['show_number']); |
---|
28 | $template->assign('show_date', $page['evil_blog']['show_date']); |
---|
29 | $template->assign('show_on_main_page', $page['evil_blog']['show_on_main_page']); |
---|
30 | $page['title'] = '<a href="'.get_gallery_home_url().'">'.l10n('Home').'</a>'.$conf['level_separator']; |
---|
31 | if ( ($npage==1) and ($page['evil_blog']['show_on_main_page']) ) { |
---|
32 | $page['title'] .= '<a href="'.get_gallery_home_url().'">'.$page['evil_blog']['blog_name'].'</a>'; |
---|
33 | }else{ |
---|
34 | $page['title'] .= '<a href="'.get_root_url().'?/blog/'.$npage.'">'.$page['evil_blog']['blog_name'].'</a>'; |
---|
35 | } |
---|
36 | $page['title'] .= |
---|
37 | $conf['level_separator'].'<a href="'.get_root_url().'?/blog/id/'.$row['id'].'">'.$row['header'].'</a>'. |
---|
38 | '<a id="blog_rss_icon" href="'.get_gallery_home_url().'?/blog/feed" title="'.l10n("Notification").'"><img src="'.get_gallery_home_url().'plugins/Evil_Blog/rss.png"></a>'; |
---|
39 | |
---|
40 | //определяем адрес шаблона плагина |
---|
41 | $template->set_template_dir(Evil_Blog_PATH); |
---|
42 | $template->set_filename('post', 'post.tpl'); |
---|
43 | //подключение стиля |
---|
44 | $template->func_combine_css(array('path' => Evil_Blog_PATH.'posts.css',)); |
---|
45 | |
---|
46 | //объявляем где конкретно на странице должен вывестись наш шаблон плагина. Вся суть в 'PLUGIN_INDEX_CONTENT_BEFORE'. |
---|
47 | $template->concat('PLUGIN_INDEX_CONTENT_END', $template->parse('post', true)); |
---|
48 | } |
---|
49 | ?> |
---|