-
Notifications
You must be signed in to change notification settings - Fork 0
/
newsfeed.php
119 lines (96 loc) · 2.68 KB
/
newsfeed.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<?php
/*
* e107 website system
*
* Copyright (C) 2008-2009 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* Plugin - newsfeeds
*
* $Source: /cvs_backup/e107_0.8/e107_plugins/newsfeed/newsfeed.php,v $
* $Revision$
* $Date$
* $Author$
*
*/
if(!defined('e107_INIT'))
{
require_once(__DIR__.'/../../class2.php');
}
if (!e107::isInstalled('newsfeed'))
{
e107::redirect();
exit;
}
e107::includeLan(e_PLUGIN.'newsfeed/languages/'.e_LANGUAGE.'_newsfeed.php');
if(!class_exists('newsfeedClass'))
{
require(e_PLUGIN.'newsfeed/newsfeed_functions.php');
}
global $newsFeed;
if (!is_object($newsFeed))
{
$newsFeed = new newsfeedClass;
}
e107::css('inline', "
.newsfeed ul { max-width:100% }
.newsfeed img { max-width:100% }
");
require_once(HEADERF);
/* get template */
if(file_exists(THEME."templates/newsfeed/newsfeed_template.php"))
{
include(THEME."templates/newsfeed/newsfeed_template.php");
}
elseif(!varset($NEWSFEED_LIST_MODE, FALSE))
{
include(e_PLUGIN."newsfeed/templates/newsfeed_template.php");
}
$action = FALSE;
if(e_QUERY)
{
$qs = explode(".", e_QUERY);
$action = $qs[0];
$id = intval(varset($qs[1], 0));
}
if(!empty($_GET['id'])) //v2.x
{
$id = intval($_GET['id']);
$action = 'show';
}
$breadarray[] =
array('text' => NFLAN_29 , 'url' => e107::url('newsfeed', 'index'));
if($action == "show")
{
/* 'show' action - show feed */
$data = $newsFeed->newsfeedInfo($id == 0 ? 'all' : $id, 'main');
$breadarray[] = array('text' => $data['title'], '');
e107::breadcrumb($breadarray);
$ns->tablerender($data['title'], $data['text'], $NEWSFEED_SHOW_MODE);
require_once(FOOTERF);
exit;
}
e107::breadcrumb($breadarray);
/* no action - display feed list ... */
$newsFeed->readFeedList();
$vars = array();
if (count($newsFeed->feedList))
{
$data = "";
foreach ($newsFeed->feedList as $feed)
{
if (($feed['newsfeed_active'] == 2) || ($feed['newsfeed_active'] == 3))
{
$feed['newsfeed_sef'] = eHelper::title2sef($feed['newsfeed_name'], 'dashl');
$url = e107::url('newsfeed', 'source', $feed); // e_SELF."?show.{$feed['newsfeed_id']}
$vars['FEEDNAME'] = "<a href='".$url."'>{$feed['newsfeed_name']}</a>";
$vars['FEEDDESCRIPTION'] = ((!$feed['newsfeed_description'] || $feed['newsfeed_description'] == "default") ? " " : $feed['newsfeed_description']);
// $FEEDIMAGE = $feed['newsfeed_image']; // This needs splitting up. Not used ATM anyway, so disable for now
$data .= $tp->simpleParse($NEWSFEED_LIST, $vars);
}
}
}
$text = $NEWSFEED_LIST_START . vartrue($data) . $NEWSFEED_LIST_END;
$ns->tablerender(NFLAN_29, $text, $NEWSFEED_LIST_MODE);
require_once(FOOTERF);