tiki-list_posts.php 1.45 KB
Newer Older
1
<?php
2
// (c) Copyright 2002-2011 by authors of the Tiki Wiki CMS Groupware Project
changi67's avatar
changi67 committed
3
// 
4 5
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
6
// $Id$
changi67's avatar
changi67 committed
7

8 9
require_once ('tiki-setup.php');
include_once ('lib/blogs/bloglib.php');
10 11
$access->check_feature('feature_blogs');
$access->check_permission('tiki_p_blog_admin');
sampaioprimo's avatar
sampaioprimo committed
12

13
if (isset($_REQUEST["remove"])) {
14 15
	$access->check_authenticity();
	$bloglib->remove_post($_REQUEST["remove"]);
16
}
17

18 19
if (!isset($_REQUEST["sort_mode"])) {
	$sort_mode = 'created_desc';
20
} else {
21 22 23
	$sort_mode = $_REQUEST["sort_mode"];
}
$smarty->assign_by_ref('sort_mode', $sort_mode);
24

25 26
if (!isset($_REQUEST["offset"])) {
	$offset = 0;
27
} else {
28
	$offset = $_REQUEST["offset"];
29
}
30
$smarty->assign_by_ref('offset', $offset);
31

32 33
if (isset($_REQUEST["find"])) {
	$find = $_REQUEST["find"];
34
} else {
35
	$find = '';
36
}
37
$smarty->assign('find', $find);
38 39 40 41 42 43 44 45 46 47 48 49
if (isset($_REQUEST['blogId'])) {
	$blogId = $_REQUEST['blogId'];
	$blog = $bloglib->get_blog($blogId);
	$smarty->assign('blogTitle', $blog['title']);
	$smarty->assign('blogId', $blogId);
} else {
	$blogId = -1;
}

$posts = $bloglib->list_posts($offset, $maxRecords, $sort_mode, $find, $blogId);
$smarty->assign_by_ref('cant', $posts["cant"]);
$smarty->assign_by_ref('posts', $posts["data"]);
50

51
ask_ticket('list-posts');
52
// Display the template
53
$smarty->assign('mid', 'tiki-list_posts.tpl');
54
$smarty->display("tiki.tpl");