/[pkg-tikiwiki]/trunk/tiki-list_blogs.php
ViewVC logotype

Contents of /trunk/tiki-list_blogs.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 11 - (show annotations) (download)
Tue Jul 11 06:27:24 2006 UTC (6 years, 10 months ago) by marcusb-guest
File size: 4798 byte(s)
Imported into trunk (integration branch).
1 <?php
2
3 // $Header: /cvsroot/tikiwiki/tiki/tiki-list_blogs.php,v 1.21.2.3 2005/10/30 18:36:29 ohertel Exp $
4
5 // Copyright (c) 2002-2005, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
6 // All Rights Reserved. See copyright.txt for details and a complete list of authors.
7 // Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
8
9 // Initialization
10 require_once ('tiki-setup.php');
11
12 include_once ('lib/blogs/bloglib.php');
13
14 if ($feature_categories == 'y') {
15 include_once ('lib/categories/categlib.php');
16 }
17
18 if ($feature_blogs != 'y') {
19 $smarty->assign('msg', tra("This feature is disabled").": feature_blogs");
20
21 $smarty->display("error.tpl");
22 die;
23 }
24
25 if ($tiki_p_read_blog != 'y') {
26 $smarty->assign('msg', tra("Permission denied you can not view this section"));
27
28 $smarty->display("error.tpl");
29 die;
30 }
31
32 /*
33 if($feature_listPages != 'y') {
34 $smarty->assign('msg',tra("This feature is disabled"));
35 $smarty->display("error.tpl");
36 die;
37 }
38 */
39
40 /*
41 // Now check permissions to access this page
42 if($tiki_p_view != 'y') {
43 $smarty->assign('msg',tra("Permission denied you cannot view pages"));
44 $smarty->display("error.tpl");
45 die;
46 }
47 */
48 if (isset($_REQUEST["remove"])) {
49
50 // Check if it is the owner
51 $data = $tikilib->get_blog($_REQUEST["remove"]);
52
53 if ($data["user"] != $user) {
54 if ($tiki_p_blog_admin != 'y') {
55 $smarty->assign('msg', tra("Permission denied you cannot remove this blog"));
56 $smarty->display("error.tpl");
57 die;
58 }
59 }
60 $area = 'delblog';
61 if ($feature_ticketlib2 != 'y' or (isset($_POST['daconfirm']) and isset($_SESSION["ticket_$area"]))) {
62 key_check($area);
63 $bloglib->remove_blog($_REQUEST["remove"]);
64 } else {
65 key_get($area);
66 }
67
68 }
69
70 // This script can receive the thresold
71 // for the information as the number of
72 // days to get in the log 1,3,4,etc
73 // it will default to 1 recovering information for today
74 if (!isset($_REQUEST["sort_mode"])) {
75 $sort_mode = $blog_list_order;
76 } else {
77 $sort_mode = $_REQUEST["sort_mode"];
78 }
79
80 $smarty->assign_by_ref('sort_mode', $sort_mode);
81
82 // If offset is set use it if not then use offset =0
83 // use the maxRecords php variable to set the limit
84 // if sortMode is not set then use lastModif_desc
85 if (!isset($_REQUEST["offset"])) {
86 $offset = 0;
87 } else {
88 $offset = $_REQUEST["offset"];
89 }
90
91 $smarty->assign_by_ref('offset', $offset);
92
93 if (isset($_REQUEST["find"])) {
94 $find = $_REQUEST["find"];
95 } else {
96 $find = '';
97 }
98
99 $smarty->assign('find', $find);
100
101 // Get a list of last changes to the Wiki database
102 $listpages = $tikilib->list_blogs($offset, $maxRecords, $sort_mode, $find);
103
104 $temp_max = count($listpages["data"]);
105 for ($i = 0; $i < $temp_max; $i++) {
106 if ($userlib->object_has_one_permission($listpages["data"][$i]["blogId"], 'blog')) {
107 $listpages["data"][$i]["individual"] = 'y';
108
109 // blogs that user cannot read are not displayed at all
110 $listpages["data"][$i]["individual_tiki_p_read_blog"] = 'y';
111
112 if ($userlib->object_has_permission($user, $listpages["data"][$i]["blogId"], 'blog', 'tiki_p_blog_post')) {
113 $listpages["data"][$i]["individual_tiki_p_blog_post"] = 'y';
114 } else {
115 $listpages["data"][$i]["individual_tiki_p_blog_post"] = 'n';
116 }
117
118 if ($userlib->object_has_permission($user, $listpages["data"][$i]["blogId"], 'blog', 'tiki_p_create_blogs')) {
119 $listpages["data"][$i]["individual_tiki_p_create_blogs"] = 'y';
120 } else {
121 $listpages["data"][$i]["individual_tiki_p_create_blogs"] = 'n';
122 }
123
124 if ($tiki_p_admin == 'y' || $userlib->object_has_permission($user, $listpages["data"][$i]["blogId"], 'blog', 'tiki_p_blog_admin'))
125 {
126 $listpages["data"][$i]["individual_tiki_p_create_blogs"] = 'y';
127 $listpages["data"][$i]["individual_tiki_p_blog_post"] = 'y';
128 }
129 } else {
130 $listpages["data"][$i]["individual"] = 'n';
131 }
132 }
133
134 // If there're more records then assign next_offset
135 $cant_pages = ceil($listpages["cant"] / $maxRecords);
136 $smarty->assign_by_ref('cant_pages', $cant_pages);
137 $smarty->assign('actual_page', 1 + ($offset / $maxRecords));
138
139 if ($listpages["cant"] > ($offset + $maxRecords)) {
140 $smarty->assign('next_offset', $offset + $maxRecords);
141 } else {
142 $smarty->assign('next_offset', -1);
143 }
144
145 // If offset is > 0 then prev_offset
146 if ($offset > 0) {
147 $smarty->assign('prev_offset', $offset - $maxRecords);
148 } else {
149 $smarty->assign('prev_offset', -1);
150 }
151
152 $smarty->assign_by_ref('listpages', $listpages["data"]);
153 //print_r($listpages["data"]);
154 $section = 'blogs';
155 include_once ('tiki-section_options.php');
156
157 if ($feature_mobile =='y' && isset($_REQUEST['mode']) && $_REQUEST['mode'] == 'mobile') {
158 include_once ("lib/hawhaw/hawtikilib.php");
159
160 HAWTIKI_list_blogs($listpages, $tiki_p_read_blog);
161 }
162 ask_ticket('list-blogs');
163
164 // Display the template
165 $smarty->assign('mid', 'tiki-list_blogs.tpl');
166 $smarty->display("tiki.tpl");
167
168 ?>

  ViewVC Help
Powered by ViewVC 1.1.5