/[pkg-tikiwiki]/tags/feature/1.9.5/external-libs/tiki-view_articles.php
ViewVC logotype

Contents of /tags/feature/1.9.5/external-libs/tiki-view_articles.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 124 - (hide annotations) (download)
Tue Nov 7 12:14:33 2006 UTC (6 years, 6 months ago) by marcusb-guest
File size: 4837 byte(s)
Tag and move branch.
1 marcusb-guest 79 <?php
2    
3     // $Header: /cvsroot/tikiwiki/tiki/tiki-view_articles.php,v 1.22.2.12 2006/07/27 21:16:40 marclaporte 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/articles/artlib.php');
13     include_once("lib/commentslib.php");
14     if ($feature_categories == 'y') {
15     include_once('lib/categories/categlib.php');
16     }
17    
18     $commentslib = new Comments($dbTiki);
19    
20     /*
21     if($feature_listPages != 'y') {
22     $smarty->assign('msg',tra("This feature is disabled"));
23     $smarty->display("error.tpl");
24     die;
25     }
26     */
27     if ($feature_articles != 'y') {
28     $smarty->assign('msg', tra("This feature is disabled").": feature_articles");
29    
30     $smarty->display("error.tpl");
31     die;
32     }
33    
34     if ($tiki_p_read_article != 'y') {
35     $smarty->assign('msg', tra("Permission denied you cannot view this section"));
36    
37     $smarty->display("error.tpl");
38     die;
39     }
40    
41     if (isset($_REQUEST["remove"])) {
42     if ($tiki_p_remove_article != 'y') {
43     $smarty->assign('msg', tra("Permission denied you cannot remove articles"));
44     $smarty->display("error.tpl");
45     die;
46     }
47     $area = 'delarticle';
48     if ($feature_ticketlib2 != 'y' or (isset($_POST['daconfirm']) and isset($_SESSION["ticket_$area"]))) {
49     key_check($area);
50     $artlib->remove_article($_REQUEST["remove"]);
51     } else {
52     key_get($area);
53     }
54     }
55    
56     // This script can receive the thresold
57     // for the information as the number of
58     // days to get in the log 1,3,4,etc
59     // it will default to 1 recovering information for today
60     if (!isset($_REQUEST["sort_mode"])) {
61     $sort_mode = 'publishDate_desc';
62     } else {
63     $sort_mode = $_REQUEST["sort_mode"];
64     }
65    
66     $smarty->assign_by_ref('sort_mode', $sort_mode);
67    
68     // If offset is set use it if not then use offset =0
69     // use the maxRecords php variable to set the limit
70     // if sortMode is not set then use lastModif_desc
71     if (!isset($_REQUEST["offset"])) {
72     $offset = 0;
73     } else {
74     $offset = $_REQUEST["offset"];
75     }
76    
77     $smarty->assign_by_ref('offset', $offset);
78    
79     $now = date("U");
80    
81     if (isset($_SESSION["thedate"])) {
82     if ($_SESSION["thedate"] < $now) {
83     $pdate = $_SESSION["thedate"];
84     } else {
85     if ($tiki_p_admin == 'y' || $tiki_p_admin_cms == 'y') {
86     $pdate = $_SESSION["thedate"];
87     } else {
88     $pdate = $now;
89     }
90     }
91     } else {
92     $pdate = $now;
93     }
94    
95     if (isset($_REQUEST["find"])) {
96     $find = $_REQUEST["find"];
97     } else {
98     $find = '';
99     }
100     $smarty->assign_by_ref('find', $find);
101    
102     if (isset($_REQUEST["type"])) {
103     $type = $_REQUEST["type"];
104     } else {
105     $type = '';
106     }
107     $smarty->assign_by_ref('type', $type);
108    
109     if (isset($_REQUEST["topic"])) {
110     $topic = $_REQUEST["topic"];
111     } else {
112     $topic = '';
113     }
114     $smarty->assign_by_ref('topic', $topic);
115    
116     if (isset($_REQUEST["categId"])) {
117     $categId = $_REQUEST["categId"];
118     } else {
119     $categId = '';
120     }
121     $smarty->assign_by_ref('categId', $categId);
122    
123    
124    
125     // Get a list of last changes to the Wiki database
126     $listpages = $tikilib->list_articles($offset, $maxArticles, $sort_mode, $find, $pdate, $user, $type, $topic, 'y', '', $categId);
127     if ($feature_multilingual == 'y') {
128     include_once("lib/multilingual/multilinguallib.php");
129     $listpages['data'] = $multilinguallib->selectLangList('article', $listpages['data']);
130     }
131    
132     $temp_max = count($listpages["data"]);
133     for ($i = 0; $i < $temp_max; $i++) {
134     $listpages["data"][$i]["parsed_heading"] = $tikilib->parse_data($listpages["data"][$i]["heading"]);
135     $comments_prefix_var='article:';
136     $comments_object_var=$listpages["data"][$i]["articleId"];
137     $comments_objectId = $comments_prefix_var.$comments_object_var;
138     $listpages["data"][$i]["comments_cant"] = $commentslib->count_comments($comments_objectId);
139     }
140    
141     $topics = $artlib->list_topics();
142     $smarty->assign_by_ref('topics', $topics);
143    
144     $cant_pages = ceil($listpages["cant"] / $maxArticles);
145     $smarty->assign_by_ref('cant_pages', $cant_pages);
146     $smarty->assign('actual_page', 1 + ($offset / $maxArticles));
147     $smarty->assign('maxArticles', $maxArticles);
148    
149     if ($listpages["cant"] > ($offset + $maxArticles)) {
150     $smarty->assign('next_offset', $offset + $maxArticles);
151     } else {
152     $smarty->assign('next_offset', -1);
153     }
154    
155     // If offset is > 0 then prev_offset
156     if ($offset > 0) {
157     $smarty->assign('prev_offset', $offset - $maxArticles);
158     } else {
159     $smarty->assign('prev_offset', -1);
160     }
161     // If there're more records then assign next_offset
162     $smarty->assign_by_ref('listpages', $listpages["data"]);
163     //print_r($listpages["data"]);
164     $section = 'cms';
165     $smarty->assign('section', $section);
166     include_once ('tiki-section_options.php');
167    
168     $section = 'cms';
169     $smarty->assign('section', $section);
170     include_once ('tiki-section_options.php');
171    
172     ask_ticket('view_article');
173    
174     // Display the template
175     $smarty->assign('mid', 'tiki-view_articles.tpl');
176     $smarty->display("tiki.tpl");
177    
178     ?>

  ViewVC Help
Powered by ViewVC 1.1.5