Completed
Push — master ( ded118...cf7347 )
by Michael
02:48
created

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 * $Id: rss.php 2011-12-21 01:21:42Z $
4
 * Module: Lexikon - glossary module
5
 * Version: v 1.00
6
 * Release Date: 18 Dec 2011
7
 * Author: Yerres
8
 * Licence: GNU
9
 */
10
 
11
12
global $xoopsModule, $xoopsUser;
13
14
include '../../mainfile.php';
15
$GLOBALS['xoopsLogger']->activated = false;
16
if (function_exists('mb_http_output')) {
17
    mb_http_output('pass');
18
}
19
//error_reporting(E_ALL |E_ERROR | E_WARNING | E_PARSE);
0 ignored issues
show
Unused Code Comprehensibility introduced by
38% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
20
header('Content-Type:text/xml; charset=utf-8');
21
include_once $GLOBALS['xoops']->path('class/template.php');
22
$tpl = new XoopsTpl();
23
$tpl->caching = 0;
24
$tpl->cache_lifetime = 3600;
25
26
$db =&XoopsDatabaseFactory::getDatabaseConnection();
27
$myts =&MyTextSanitizer::getInstance();
28
$category_rss = isset($_GET['categoryID']) ? $_GET['categoryID'] : 0;
29
//permissions
30
$gperm_handler =& xoops_gethandler('groupperm');
31
$groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS;
32
$module_handler =& xoops_gethandler('module');
33
$module =& $module_handler->getByDirname('lexikon');
34
$module_id = $module->getVar('mid');
35
$allowed_cats = $gperm_handler->getItemIds("lexikon_view", $groups, $module_id);
36
$catids = implode(',', $allowed_cats);
37
$catperms = " AND categoryID IN ($catids) ";
38
39
if ($category_rss<=0) {
40
    $result = $db->query("SELECT * FROM ".$db->prefix("lxentries")."  WHERE offline=0 ".$catperms."  ORDER BY 'datesub' DESC LIMIT 0,50");
41
} else {
42
    $result = $db->query("SELECT * FROM ".$db->prefix("lxentries")." WHERE categoryID='$category_rss'  ".$catperms."  ORDER BY `datesub` DESC LIMIT 0,50");
43
    $info = $db->fetchArray($db->query("SELECT * FROM ".$db->prefix("lxcategories")." WHERE categoryID='$category_rss'"));
44
}
45
if (!$tpl->is_cached('db:lexikon_rss.html')) {
46
   xoops_load('XoopsLocal');
47
  if ($category_rss > 0) {
48
      $tpl->assign('channel_title', htmlspecialchars($xoopsConfig['sitename']." - ".sprintf(_MD_LEXIKON_INCATS, $info['name']), ENT_QUOTES, 'utf-8'));
49
      $tpl->assign('channel_link', XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname').'/category.php?categoryID='.$category_rss);
50
      $tpl->assign('channel_desc', sprintf(_MD_LEXIKON_INCATS_DESC, $info['name'], $xoopsConfig['sitename']));
51
      $tpl->assign('channel_lastbuild', formatTimestamp(time(), 'rss'));
52
      $tpl->assign('channel_generator', 'XOOPS Lexikon');
53
      $tpl->assign('channel_category', 'Categories');
54
      $tpl->assign('channel_editor', $xoopsConfig['adminmail']);
55
      $tpl->assign('channel_webmaster', $xoopsConfig['adminmail']);
56
      $tpl->assign('channel_language', _LANGCODE);
57
      $tpl->assign('image_url', XOOPS_URL.'/images/logo.gif');
58
      $dimention = getimagesize(XOOPS_ROOT_PATH.'/images/logo.gif');
59 View Code Duplication
      if (empty($dimention[0])) {
60
          $width = 128;
61
      } else {
62
          $width = ($dimention[0] > 128) ? 128 : $dimention[0];
63
      }
64 View Code Duplication
      if (empty($dimention[1])) {
65
          $height = 128;
66
      } else {
67
          $height = ($dimention[1] > 128) ? 128 : $dimention[1];
68
      }
69
      $tpl->assign('image_width',$width);
70
      $tpl->assign('image_height',$height);
71
  } else {
72
      $tpl->assign('channel_title', htmlspecialchars($xoopsConfig['sitename'] ." - ".sprintf(_MD_LEXIKON_INCATS, $xoopsModule->getVar('dirname')), ENT_QUOTES, 'utf-8'));
73
      $tpl->assign('channel_link', XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname'));
74
      $tpl->assign('channel_desc', sprintf(_MD_LEXIKON_LASTDESC, $xoopsConfig['sitename']));
75
      $tpl->assign('channel_lastbuild', formatTimestamp(time(), 'rss'));
76
      $tpl->assign('channel_generator', 'XOOPS Lexikon');
77
      $tpl->assign('channel_category', 'Entries');
78
      $tpl->assign('channel_editor', $xoopsConfig['adminmail']);
79
      $tpl->assign('channel_webmaster', $xoopsConfig['adminmail']);
80
      $tpl->assign('channel_language', _LANGCODE);
81
      $tpl->assign('image_url', XOOPS_URL.'/images/logo.gif');
82
      $dimention = getimagesize(XOOPS_ROOT_PATH.'/images/logo.gif');
83 View Code Duplication
      if (empty($dimention[0])) {
84
          $width = 128;
85
      } else {
86
          $width = ($dimention[0] > 128) ? 128 : $dimention[0];
87
      }
88 View Code Duplication
      if (empty($dimention[1])) {
89
          $height = 128;
90
      } else {
91
          $height = ($dimention[1] > 128) ? 128 : $dimention[1];
92
      }
93
      $tpl->assign('image_width',$width);
94
      $tpl->assign('image_height',$height);
95
  }
96
  while ($row=$db->fetchArray($result)) {
97
      $tpl->append('items', array('title' =>htmlspecialchars($row['term'], ENT_QUOTES, 'utf-8'), 'link' => XOOPS_URL.'/modules/lexikon/entry.php?entryID='.$row['entryID'], 'guid' => XOOPS_URL.'/modules/lexikon/entry.php?entryID='.$row['entryID'], 'pubdate' => formatTimestamp($row['datesub'],'rss'),  'description' => htmlspecialchars($myts->displayTarea($row['definition'],1,1,1), ENT_QUOTES)));
98
  }
99
}
100
$tpl->display('db:lexikon_rss.html');
101