[19050] | 1 | <?php |
---|
| 2 | // Chech whether we are indeed included by Piwigo. |
---|
| 3 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
| 4 | |
---|
| 5 | $post_per_page = $page['evil_blog']['posts_per_page']; |
---|
| 6 | //óçíàåì êîëè÷åñòâî çàïèñåé â áëîãå |
---|
| 7 | $row = pwg_db_fetch_assoc(pwg_query("SELECT COUNT(*) FROM `".Evil_Blog_Table."`")); |
---|
| 8 | |
---|
| 9 | if ($row["COUNT(*)"] % $post_per_page != 0) { |
---|
| 10 | $pages = floor($row["COUNT(*)"] / $post_per_page)+1; |
---|
| 11 | } else {$pages = floor($row["COUNT(*)"] / $post_per_page);} |
---|
| 12 | if ((empty($tokens[1])) or ($tokens[1]<=1)) { |
---|
| 13 | $number = 0; |
---|
| 14 | $npage = 1; |
---|
| 15 | } else { |
---|
| 16 | $npage = $tokens[1]; |
---|
| 17 | if ($npage<=$pages) { |
---|
| 18 | $number=($npage-1)*$post_per_page; |
---|
| 19 | } else { |
---|
| 20 | $number=($pages-1)*$post_per_page; |
---|
| 21 | $npage=$pages; |
---|
| 22 | } |
---|
| 23 | } |
---|
| 24 | |
---|
| 25 | $query = "SELECT id, UNIX_TIMESTAMP(date) AS date, header, text |
---|
| 26 | FROM `".Evil_Blog_Table."` |
---|
| 27 | WHERE 1 |
---|
| 28 | ORDER BY `date` DESC |
---|
| 29 | LIMIT ".$number.",".$post_per_page; |
---|
| 30 | $result = pwg_query($query); |
---|
| 31 | $qwe = 0; |
---|
| 32 | while ($row = pwg_db_fetch_assoc($result)) {//áîëåå âìåíÿåìàÿ îáðàáîòêà ðåçóëüòàòà èç áàçû, íóæíî äëÿ íîðìàëüíîé ðàáîòû SMARTY |
---|
| 33 | $row1[$qwe] = $row; |
---|
| 34 | $row1[$qwe]['date'] = date($page['evil_blog']['date_format'], $row['date']); |
---|
| 35 | if($ExDesc['state'] == 'active') { |
---|
| 36 | $row1[$qwe]['text'] = get_extended_desc($row['text']); |
---|
| 37 | $row1[$qwe]['header'] = get_user_language_desc($row['header']); |
---|
| 38 | } |
---|
| 39 | $qwe++; |
---|
| 40 | } |
---|
| 41 | if (!empty($row1)) { |
---|
| 42 | $template->assign('row', $row1); |
---|
| 43 | } |
---|
| 44 | $template->assign('npage', $npage); |
---|
| 45 | $template->assign('pages', $pages); |
---|
| 46 | for ($it=1; $it<=$pages; $it++) { |
---|
| 47 | $pagi[$it] = $it; |
---|
| 48 | } |
---|
| 49 | if (!empty($pagi)) { |
---|
| 50 | $template->assign('pagi', $pagi); |
---|
| 51 | } |
---|
| 52 | //îïðåäåëÿåì çàãîëîâîê |
---|
[19304] | 53 | if ((($page['evil_blog']['show_on_main_page']) or ($page['evil_blog']['show_on_category_page'])) and ($tokens[0]!='blog')) { |
---|
[19050] | 54 | $place = 'PLUGIN_INDEX_CONTENT_BEFORE'; |
---|
[19304] | 55 | $template->assign('TITLE', |
---|
| 56 | '<div id="content" class="content contentWithMenu"><div class="titrePage"><h2>'.$page['evil_blog']['blog_name']. |
---|
[19546] | 57 | '<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></h2></div>'); |
---|
[19050] | 58 | $template->assign('TITLE_END', '</div>'); |
---|
| 59 | }else{//õëåáíûå êðîøêè |
---|
| 60 | $place = 'PLUGIN_INDEX_CONTENT_END'; |
---|
[19304] | 61 | $page['title'] = |
---|
| 62 | '<a href="'.get_gallery_home_url().'">'.l10n('Home').'</a>'.$conf['level_separator'].$page['evil_blog']['blog_name']. |
---|
[19546] | 63 | '<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>'; |
---|
[19050] | 64 | $template->assign('TITLE_END', ' '); |
---|
| 65 | } |
---|
| 66 | //îòñûëàåì â ÑÌÀÐÒÈ íàñòðîéêè âíåøíåãî âèäà |
---|
| 67 | $template->assign('show_number', $page['evil_blog']['show_number']); |
---|
| 68 | $template->assign('show_date', $page['evil_blog']['show_date']); |
---|
| 69 | $template->assign('show_on_main_page', $page['evil_blog']['show_on_main_page']); |
---|
| 70 | |
---|
| 71 | //îïðåäåëÿåì àäðåñ øàáëîíà ïëàãèíà |
---|
| 72 | $template->set_template_dir(Evil_Blog_PATH); |
---|
| 73 | $template->set_filename('blog', 'blog.tpl'); |
---|
| 74 | //ïîäêëþ÷åíèå ñòèëÿ |
---|
| 75 | $template->func_combine_css(array('path' => Evil_Blog_PATH.'posts.css',)); |
---|
| 76 | |
---|
| 77 | //îáúÿâëÿåì ãäå êîíêðåòíî íà ñòðàíèöå äîëæåí âûâåñòèñü íàø øàáëîí ïëàãèíà. Âñÿ ñóòü â 'PLUGIN_INDEX_CONTENT_BEFORE'. |
---|
| 78 | $template->concat($place, $template->parse('blog', true)); |
---|
| 79 | ?> |
---|