Verzeichnisstruktur phpBB-3.1.0


Veröffentlicht
27.10.2014

So funktioniert es


Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück

Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

      (Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

feed.php

Zuletzt modifiziert: 09.10.2024, 12:50 - Dateigröße: 7.83 KiB


 001  <?php
 002  /**
 003  *
 004  * This file is part of the phpBB Forum Software package.
 005  *
 006  * @copyright (c) phpBB Limited <https://www.phpbb.com>
 007  * @license GNU General Public License, version 2 (GPL-2.0)
 008  *
 009  * For full copyright and license information, please see
 010  * the docs/CREDITS.txt file.
 011  *
 012  * Idea and original RSS Feed 2.0 MOD (Version 1.0.8/9) by leviatan21
 013  * Original MOD: http://www.phpbb.com/community/viewtopic.php?f=69&t=1214645
 014  * MOD Author Profile: http://www.phpbb.com/community/memberlist.php?mode=viewprofile&u=345763
 015  * MOD Author Homepage: http://www.mssti.com/phpbb3/
 016  *
 017  **/
 018   
 019  /**
 020  * @ignore
 021  **/
 022  define('IN_PHPBB', true);
 023  $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
 024  $phpEx = substr(strrchr(__FILE__, '.'), 1);
 025  include($phpbb_root_path . 'common.' . $phpEx);
 026  include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
 027   
 028  if (!$config['feed_enable'])
 029  {
 030      trigger_error('NO_FEED_ENABLED');
 031  }
 032   
 033  // Start session
 034  $user->session_begin();
 035   
 036  if (!empty($config['feed_http_auth']) && request_var('auth', '') == 'http')
 037  {
 038      phpbb_http_login(array(
 039          'auth_message'    => 'Feed',
 040          'viewonline'    => request_var('viewonline', true),
 041      ));
 042  }
 043   
 044  $auth->acl($user->data);
 045  $user->setup('viewtopic');
 046   
 047  // Initial var setup
 048  $forum_id    = request_var('f', 0);
 049  $topic_id    = request_var('t', 0);
 050  $mode        = request_var('mode', '');
 051   
 052  // We do not use a template, therefore we simply define the global template variables here
 053  $global_vars = $item_vars = array();
 054  $feed_updated_time = 0;
 055   
 056  // Generate params array for use in append_sid() to correctly link back to this page
 057  $params = false;
 058  if ($forum_id || $topic_id || $mode)
 059  {
 060      $params = array(
 061          'f'        => ($forum_id) ? $forum_id : NULL,
 062          't'        => ($topic_id) ? $topic_id : NULL,
 063          'mode'    => ($mode) ? $mode : NULL,
 064      );
 065  }
 066   
 067  // This boards URL
 068  $phpbb_feed_helper = $phpbb_container->get('feed.helper');
 069  $board_url = $phpbb_feed_helper->get_board_url();
 070   
 071  // Get correct feed object
 072  $phpbb_feed_factory = $phpbb_container->get('feed.factory');
 073  $feed = $phpbb_feed_factory->get_feed($mode, $forum_id, $topic_id);
 074   
 075  // No feed found
 076  if ($feed === false)
 077  {
 078      trigger_error('NO_FEED');
 079  }
 080   
 081  // Open Feed
 082  $feed->open();
 083   
 084  // Iterate through items
 085  while ($row = $feed->get_item())
 086  {
 087      // BBCode options to correctly disable urls, smilies, bbcode...
 088      if ($feed->get('options') === NULL)
 089      {
 090          // Allow all combinations
 091          $options = 7;
 092   
 093          if ($feed->get('enable_bbcode') !== NULL && $feed->get('enable_smilies') !== NULL && $feed->get('enable_magic_url') !== NULL)
 094          {
 095              $options = (($row[$feed->get('enable_bbcode')]) ? OPTION_FLAG_BBCODE : 0) + (($row[$feed->get('enable_smilies')]) ? OPTION_FLAG_SMILIES : 0) + (($row[$feed->get('enable_magic_url')]) ? OPTION_FLAG_LINKS : 0);
 096          }
 097      }
 098      else
 099      {
 100          $options = $row[$feed->get('options')];
 101      }
 102   
 103      $title = (isset($row[$feed->get('title')]) && $row[$feed->get('title')] !== '') ? $row[$feed->get('title')] : ((isset($row[$feed->get('title2')])) ? $row[$feed->get('title2')] : '');
 104   
 105      $published = ($feed->get('published') !== NULL) ? (int) $row[$feed->get('published')] : 0;
 106      $updated = ($feed->get('updated') !== NULL) ? (int) $row[$feed->get('updated')] : 0;
 107   
 108      $display_attachments = ($auth->acl_get('u_download') && $auth->acl_get('f_download', $row['forum_id']) && isset($row['post_attachment']) && $row['post_attachment']) ? true : false;
 109   
 110      $item_row = array(
 111          'author'        => ($feed->get('creator') !== NULL) ? $row[$feed->get('creator')] : '',
 112          'published'        => ($published > 0) ? $phpbb_feed_helper->format_date($published) : '',
 113          'updated'        => ($updated > 0) ? $phpbb_feed_helper->format_date($updated) : '',
 114          'link'            => '',
 115          'title'            => censor_text($title),
 116          'category'        => ($config['feed_item_statistics'] && !empty($row['forum_id'])) ? $board_url . '/viewforum.' . $phpEx . '?f=' . $row['forum_id'] : '',
 117          'category_name'    => ($config['feed_item_statistics'] && isset($row['forum_name'])) ? $row['forum_name'] : '',
 118          'description'    => censor_text($phpbb_feed_helper->generate_content($row[$feed->get('text')], $row[$feed->get('bbcode_uid')], $row[$feed->get('bitfield')], $options, $row['forum_id'], ($display_attachments ? $feed->get_attachments($row['post_id']) : array()))),
 119          'statistics'    => '',
 120      );
 121   
 122      // Adjust items, fill link, etc.
 123      $feed->adjust_item($item_row, $row);
 124   
 125      $item_vars[] = $item_row;
 126   
 127      $feed_updated_time = max($feed_updated_time, $published, $updated);
 128  }
 129   
 130  // If we do not have any items at all, sending the current time is better than sending no time.
 131  if (!$feed_updated_time)
 132  {
 133      $feed_updated_time = time();
 134  }
 135   
 136  // Some default assignments
 137  // FEED_IMAGE is not used (atom)
 138  $global_vars = array_merge($global_vars, array(
 139      'FEED_IMAGE'            => '',
 140      'SELF_LINK'                => $phpbb_feed_helper->append_sid('feed.' . $phpEx, $params),
 141      'FEED_LINK'                => $board_url . '/index.' . $phpEx,
 142      'FEED_TITLE'            => $config['sitename'],
 143      'FEED_SUBTITLE'            => $config['site_desc'],
 144      'FEED_UPDATED'            => $phpbb_feed_helper->format_date($feed_updated_time),
 145      'FEED_LANG'                => $user->lang['USER_LANG'],
 146      'FEED_AUTHOR'            => $config['sitename'],
 147  ));
 148   
 149  $feed->close();
 150   
 151  // Output page
 152   
 153  // gzip_compression
 154  if ($config['gzip_compress'])
 155  {
 156      if (@extension_loaded('zlib') && !headers_sent())
 157      {
 158          ob_start('ob_gzhandler');
 159      }
 160  }
 161   
 162  // IF debug extra is enabled and admin want to "explain" the page we need to set other headers...
 163  if (defined('DEBUG') && request_var('explain', 0) && $auth->acl_get('a_'))
 164  {
 165      header('Content-type: text/html; charset=UTF-8');
 166      header('Cache-Control: private, no-cache="set-cookie"');
 167      header('Expires: ' . gmdate('D, d M Y H:i:s', time()) . ' GMT');
 168   
 169      $mtime = explode(' ', microtime());
 170      $totaltime = $mtime[0] + $mtime[1] - $starttime;
 171   
 172      if (method_exists($db, 'sql_report'))
 173      {
 174          $db->sql_report('display');
 175      }
 176   
 177      garbage_collection();
 178      exit_handler();
 179  }
 180   
 181  header("Content-Type: application/atom+xml; charset=UTF-8");
 182  header("Last-Modified: " . gmdate('D, d M Y H:i:s', $feed_updated_time) . ' GMT');
 183   
 184  if (!empty($user->data['is_bot']))
 185  {
 186      // Let reverse proxies know we detected a bot.
 187      header('X-PHPBB-IS-BOT: yes');
 188  }
 189   
 190  echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
 191  echo '<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="' . $global_vars['FEED_LANG'] . '">' . "\n";
 192  echo '<link rel="self" type="application/atom+xml" href="' . $global_vars['SELF_LINK'] . '" />' . "\n\n";
 193   
 194  echo (!empty($global_vars['FEED_TITLE'])) ? '<title>' . $global_vars['FEED_TITLE'] . '</title>' . "\n" : '';
 195  echo (!empty($global_vars['FEED_SUBTITLE'])) ? '<subtitle>' . $global_vars['FEED_SUBTITLE'] . '</subtitle>' . "\n" : '';
 196  echo (!empty($global_vars['FEED_LINK'])) ? '<link href="' . $global_vars['FEED_LINK'] .'" />' . "\n" : '';
 197  echo '<updated>' . $global_vars['FEED_UPDATED'] . '</updated>' . "\n\n";
 198   
 199  echo '<author><name><![CDATA[' . $global_vars['FEED_AUTHOR'] . ']]></name></author>' . "\n";
 200  echo '<id>' . $global_vars['SELF_LINK'] . '</id>' . "\n";
 201   
 202  foreach ($item_vars as $row)
 203  {
 204      echo '<entry>' . "\n";
 205   
 206      if (!empty($row['author']))
 207      {
 208          echo '<author><name><![CDATA[' . $row['author'] . ']]></name></author>' . "\n";
 209      }
 210   
 211      echo '<updated>' . ((!empty($row['updated'])) ? $row['updated'] : $row['published']) . '</updated>' . "\n";
 212   
 213      if (!empty($row['published']))
 214      {
 215          echo '<published>' . $row['published'] . '</published>' . "\n";
 216      }
 217   
 218      echo '<id>' . $row['link'] . '</id>' . "\n";
 219      echo '<link href="' . $row['link'] . '"/>' . "\n";
 220      echo '<title type="html"><![CDATA[' . $row['title'] . ']]></title>' . "\n\n";
 221   
 222      if (!empty($row['category']) && isset($row['category_name']) && $row['category_name'] !== '')
 223      {
 224          echo '<category term="' . $row['category_name'] . '" scheme="' . $row['category'] . '" label="' . $row['category_name'] . '"/>' . "\n";
 225      }
 226   
 227      echo '<content type="html" xml:base="' . $row['link'] . '"><![CDATA[' . "\n";
 228      echo $row['description'];
 229   
 230      if (!empty($row['statistics']))
 231      {
 232          echo '<p>' . $user->lang['STATISTICS'] . ': ' . $row['statistics'] . '</p>';
 233      }
 234   
 235      echo '<hr />' . "\n" . ']]></content>' . "\n";
 236      echo '</entry>' . "\n";
 237  }
 238   
 239  echo '</feed>';
 240   
 241  garbage_collection();
 242  exit_handler();
 243