/
admin.php
132 lines (125 loc) · 5.49 KB
/
admin.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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<?php
/**
* XOOPS admin file
*
* You may not change or alter any portion of this comment or credits
* of supporting developers from this source code or any supporting source code
* which is considered copyrighted (c) material of the original comment or credit authors.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* @copyright The XOOPS Project http://sourceforge.net/projects/xoops/
* @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
* @version $Id: admin.php 12033 2013-09-14 03:16:44Z beckmi $
*/
$xoopsOption['pagetype'] = 'admin';
include dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mainfile.php';
include_once $GLOBALS['xoops']->path('include/cp_functions.php');
/**
* Admin Authentication
*/
if ($xoopsUser) {
if (!$xoopsUser->isAdmin(-1)) {
redirect_header('index.php', 2, _AD_NORIGHT);
exit();
}
} else {
redirect_header('index.php', 2, _AD_NORIGHT);
exit();
}
xoops_cp_header();
// ###### Output warn messages for security ######
/**
* Error warning messages
*/
if (!isset($xoopsConfig['admin_warnings_enable']) || $xoopsConfig['admin_warnings_enable']) {
if (is_dir(XOOPS_ROOT_PATH . '/install/')) {
xoops_error(sprintf(_AD_WARNINGINSTALL, XOOPS_ROOT_PATH . '/install/'));
echo '<br />';
}
if (is_writable(XOOPS_ROOT_PATH . '/mainfile.php')) {
xoops_error(sprintf(_AD_WARNINGWRITEABLE, XOOPS_ROOT_PATH . '/mainfile.php'));
echo '<br />';
}
// ###### Output warn messages for correct functionality ######
if (! is_writable(XOOPS_CACHE_PATH)) {
xoops_error(sprintf(_AD_WARNINGNOTWRITEABLE, XOOPS_CACHE_PATH));
echo '<br />';
}
if (! is_writable(XOOPS_UPLOAD_PATH)) {
xoops_error(sprintf(_AD_WARNINGNOTWRITEABLE, XOOPS_UPLOAD_PATH));
echo '<br />';
}
if (! is_writable(XOOPS_COMPILE_PATH)) {
xoops_error(sprintf(_AD_WARNINGNOTWRITEABLE, XOOPS_COMPILE_PATH));
echo '<br />';
}
//www fits inside www_private, lets add a trailing slash to make sure it doesn't
if (strpos(XOOPS_PATH . '/', XOOPS_ROOT_PATH . '/') !== false || strpos(XOOPS_PATH . '/', $_SERVER['DOCUMENT_ROOT'] . '/') !== false) {
xoops_error(sprintf(_AD_WARNINGXOOPSLIBINSIDE, XOOPS_PATH));
echo '<br />';
}
if (strpos(XOOPS_VAR_PATH . '/', XOOPS_ROOT_PATH . '/') !== false || strpos(XOOPS_VAR_PATH . '/', $_SERVER['DOCUMENT_ROOT'] . '/') !== false) {
xoops_error(sprintf(_AD_WARNINGXOOPSLIBINSIDE, XOOPS_VAR_PATH));
echo '<br />';
}
}
if (!empty($_GET['xoopsorgnews'])) {
// Multiple feeds
$myts =& MyTextSanitizer::getInstance();
$rssurl = array();
$rssurl[] = 'http://sourceforge.net/export/rss2_projnews.php?group_id=41586&rss_fulltext=1';
$rssurl[] = 'http://www.xoops.org/backend.php';
if ($URLs = include $GLOBALS['xoops']->path('language/' . xoops_getConfigOption('language') . '/backend.php')) {
$rssurl = array_unique(array_merge($rssurl, $URLs));
}
$rssfile = 'adminnews-' . xoops_getConfigOption('language');
xoops_load('XoopsCache');
$items = array();
if (!$items = XoopsCache::read($rssfile)) {
require_once $GLOBALS['xoops']->path('class/snoopy.php');
include_once $GLOBALS['xoops']->path('class/xml/rss/xmlrss2parser.php');
xoops_load('XoopsLocal');
$snoopy = new Snoopy();
$cnt = 0;
foreach ($rssurl as $url) {
if ($snoopy->fetch($url)) {
$rssdata = $snoopy->results;
$rss2parser = new XoopsXmlRss2Parser($rssdata);
if (false != $rss2parser->parse()) {
$_items = $rss2parser->getItems();
$count = count($_items);
for ($i = 0; $i < $count; $i ++) {
$_items[$i]['title'] = XoopsLocal::convert_encoding($_items[$i]['title'], _CHARSET, 'UTF-8');
$_items[$i]['description'] = XoopsLocal::convert_encoding($_items[$i]['description'], _CHARSET, 'UTF-8');
$items[strval(strtotime($_items[$i]['pubdate'])) . "-" . strval(++$cnt)] = $_items[$i];
}
} else {
echo $rss2parser->getErrors();
}
}
}
krsort($items);
XoopsCache::write($rssfile, $items, 86400);
}
if ($items != '') {
$ret = '<table class="outer width100">';
foreach(array_keys($items) as $i) {
$ret .= '<tr class="head"><td><a href="' . htmlspecialchars($items[$i]['link']) . '" rel="external">';
$ret .= htmlspecialchars($items[$i]['title']) . '</a> (' . htmlspecialchars($items[$i]['pubdate']) . ')</td></tr>';
if ($items[$i]['description'] != "") {
$ret .= '<tr><td class="odd">' . $items[$i]['description'];
if (! empty($items[$i]['guid'])) {
$ret .= ' <a href="' . htmlspecialchars($items[$i]['guid']) . '" rel="external" title="">' . _MORE . '</a>';
}
$ret .= '</td></tr>';
} else if ($items[$i]['guid'] != "") {
$ret .= '<tr><td class="even aligntop"></td><td colspan="2" class="odd"><a href="' . htmlspecialchars($items[$i]['guid']) . '" rel="external">' . _MORE . '</a></td></tr>';
}
}
$ret .= '</table>';
echo $ret;
}
}
xoops_cp_footer();