source: companies/celepar/news_admin/website/export.php @ 763

Revision 763, 2.6 KB checked in by niltonneto, 15 years ago (diff)

Importação inicial do Expresso da Celepar

Line 
1<?php
2  /**************************************************************************\
3  * eGroupWare - Webpage news admin                                          *
4  * http://www.egroupware.org                                                *
5  * --------------------------------------------                             *
6  *  This program is free software; you can redistribute it and/or modify it *
7  *  under the terms of the GNU General Public License as published by the   *
8  *  Free Software Foundation; either version 2 of the License, or (at your  *
9  *  option) any later version.                                              *
10  * --------------------------------------------                             *
11  * This program was sponsered by Golden Glair productions                   *
12  * http://www.goldenglair.com                                               *
13  \**************************************************************************/
14
15
16        include('setup.inc.php');
17
18        $cat_id = (int)$_GET['cat_id'];
19//      $format = (isset($_GET['format']) ? strtolower(trim($_GET['format'])) : 'rss');
20        $limit  = (isset($_GET['limit']) ? trim($_GET['limit']) : 5);
21//      $all    = (isset($_GET['all']) ? True : False);
22
23        $site = $export_obj->readconfig($cat_id);
24
25        //TODO allow override of configured value by a configurable flag
26        //validate format
27
28//      $available_formats = array('rss'        => True, //RSS 0.91
29//                              'rdf-chan'      => True, //RDF 1.0
30//                              'rdf2'          => True, //RDF/RSS 2.0
31//                              );
32
33//      if(!$available_formats[$format])
34//      {
35//              $format = 'rss';
36//      }
37
38        if(!$site['type'])
39        {
40                echo "THIS CATEGORY IS NOT PUBLICLY ACCESSIBLE";
41                die();
42        }
43
44        $formats = array(1 => 'rss091', 2 => 'rss1', 3 => 'rss2');
45        $itemsyntaxs = array(
46                0 => '?item=',
47                1 => '&item=',
48                2 => '?news%5Bitem%5D=',
49                3 => '&news%5Bitem%5D='
50        );
51        $format = $formats[$site['type']];
52        $itemsyntax = $itemsyntaxs[$site['itemsyntax']];
53
54        $tpl->set_file(array('news' => $format . '.tpl'));
55        $tpl->set_block('news', 'item', 'items');
56        if($format == 'rss1')
57        {
58                $tpl->set_block('news', 'seq', 'seqs');
59        }
60
61        $tpl->set_var($site);
62
63//      if($all)
64//      {
65//              $news = $news_obj->get_all_public_news($limit);
66//      }
67//      else
68//      {
69                $news = $news_obj->get_newslist($cat_id, 0,'','',$limit,True);
70//      }
71
72        if(is_array($news))
73        {
74                foreach($news as $news_id => $news_data)
75                {
76                        $tpl->set_var($news_data);
77
78                        $tpl->set_var('item_link', $site['link'] . $itemsyntax . $news_id);
79                        if($format == 'rss1')
80                        {
81                                $tpl->parse('seqs','seq',True);
82                        }
83   
84                        $tpl->parse('items','item',True);
85                }
86        }
87        else
88        {
89                $tpl->set_var('items', '');
90        }
91        $tpl->pparse('out','news');
92?>
Note: See TracBrowser for help on using the repository browser.