XOOPS 2.5.6  Final
 All Classes Namespaces Files Functions Variables Pages
admin.php
Go to the documentation of this file.
1 <?php
16 $xoopsOption['pagetype'] = 'admin';
17 
18 include dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mainfile.php';
19 include_once $GLOBALS['xoops']->path('include/cp_functions.php');
23 if ($xoopsUser) {
24  if (!$xoopsUser->isAdmin(-1)) {
25  redirect_header('index.php', 2, _AD_NORIGHT);
26  exit();
27  }
28 } else {
29  redirect_header('index.php', 2, _AD_NORIGHT);
30  exit();
31 }
32 
34 // ###### Output warn messages for security ######
38 if (!isset($xoopsConfig['admin_warnings_enable']) || $xoopsConfig['admin_warnings_enable']) {
39  if (is_dir(XOOPS_ROOT_PATH . '/install/')) {
40  xoops_error(sprintf(_AD_WARNINGINSTALL, XOOPS_ROOT_PATH . '/install/'));
41  echo '<br />';
42  }
43 
44  if (is_writable(XOOPS_ROOT_PATH . '/mainfile.php')) {
45  xoops_error(sprintf(_AD_WARNINGWRITEABLE, XOOPS_ROOT_PATH . '/mainfile.php'));
46  echo '<br />';
47  }
48  // ###### Output warn messages for correct functionality ######
49  if (! is_writable(XOOPS_CACHE_PATH)) {
51  echo '<br />';
52  }
53  if (! is_writable(XOOPS_UPLOAD_PATH)) {
55  echo '<br />';
56  }
57  if (! is_writable(XOOPS_COMPILE_PATH)) {
59  echo '<br />';
60  }
61 
62  //www fits inside www_private, lets add a trailing slash to make sure it doesn't
63  if (strpos(XOOPS_PATH . '/', XOOPS_ROOT_PATH . '/') !== false || strpos(XOOPS_PATH . '/', $_SERVER['DOCUMENT_ROOT'] . '/') !== false) {
64  xoops_error(sprintf(_AD_WARNINGXOOPSLIBINSIDE, XOOPS_PATH));
65  echo '<br />';
66  }
67 
68  if (strpos(XOOPS_VAR_PATH . '/', XOOPS_ROOT_PATH . '/') !== false || strpos(XOOPS_VAR_PATH . '/', $_SERVER['DOCUMENT_ROOT'] . '/') !== false) {
69  xoops_error(sprintf(_AD_WARNINGXOOPSLIBINSIDE, XOOPS_VAR_PATH));
70  echo '<br />';
71  }
72 }
73 
74 if (!empty($_GET['xoopsorgnews'])) {
75  // Multiple feeds
77  $rssurl = array();
78  $rssurl[] = 'http://sourceforge.net/export/rss2_projnews.php?group_id=41586&rss_fulltext=1';
79  $rssurl[] = 'http://www.xoops.org/backend.php';
80  if ($URLs = include $GLOBALS['xoops']->path('language/' . xoops_getConfigOption('language') . '/backend.php')) {
81  $rssurl = array_unique(array_merge($rssurl, $URLs));
82  }
83  $rssfile = 'adminnews-' . xoops_getConfigOption('language');
84  xoops_load('XoopsCache');
85  $items = array();
86  if (!$items = XoopsCache::read($rssfile)) {
87  require_once $GLOBALS['xoops']->path('class/snoopy.php');
88  include_once $GLOBALS['xoops']->path('class/xml/rss/xmlrss2parser.php');
89 
90  xoops_load('XoopsLocal');
91  $snoopy = new Snoopy();
92  $cnt = 0;
93  foreach ($rssurl as $url) {
94  if ($snoopy->fetch($url)) {
95  $rssdata = $snoopy->results;
96  $rss2parser = new XoopsXmlRss2Parser($rssdata);
97  if (false != $rss2parser->parse()) {
98  $_items = $rss2parser->getItems();
99  $count = count($_items);
100  for ($i = 0; $i < $count; $i ++) {
101  $_items[$i]['title'] = XoopsLocal::convert_encoding($_items[$i]['title'], _CHARSET, 'UTF-8');
102  $_items[$i]['description'] = XoopsLocal::convert_encoding($_items[$i]['description'], _CHARSET, 'UTF-8');
103  $items[strval(strtotime($_items[$i]['pubdate'])) . "-" . strval(++$cnt)] = $_items[$i];
104  }
105  } else {
106  echo $rss2parser->getErrors();
107  }
108  }
109  }
110  krsort($items);
111  XoopsCache::write($rssfile, $items, 86400);
112  }
113  if ($items != '') {
114  $ret = '<table class="outer width100">';
115  foreach(array_keys($items) as $i) {
116  $ret .= '<tr class="head"><td><a href="' . htmlspecialchars($items[$i]['link']) . '" rel="external">';
117  $ret .= htmlspecialchars($items[$i]['title']) . '</a> (' . htmlspecialchars($items[$i]['pubdate']) . ')</td></tr>';
118  if ($items[$i]['description'] != "") {
119  $ret .= '<tr><td class="odd">' . $items[$i]['description'];
120  if (! empty($items[$i]['guid'])) {
121  $ret .= '&nbsp;&nbsp;<a href="' . htmlspecialchars($items[$i]['guid']) . '" rel="external" title="">' . _MORE . '</a>';
122  }
123  $ret .= '</td></tr>';
124  } else if ($items[$i]['guid'] != "") {
125  $ret .= '<tr><td class="even aligntop"></td><td colspan="2" class="odd"><a href="' . htmlspecialchars($items[$i]['guid']) . '" rel="external">' . _MORE . '</a></td></tr>';
126  }
127  }
128  $ret .= '</table>';
129  echo $ret;
130  }
131 }
133 
134 ?>