IP : 3.142.131.69Hostname : host45.registrar-servers.comKernel : Linux host45.registrar-servers.com 4.18.0-513.18.1.lve.2.el8.x86_64 #1 SMP Sat Mar 30 15:36:11 UTC 2024 x86_64Disable Function : None :) OS : Linux
PATH:
/
home/
../
var/
softaculous/
popoji/
../
easyp/
../
qtoa/
../
qtoa/
../
fud/
feed.php/
/
<?php /** * copyright : (C) 2001-2021 Advanced Internet Designs Inc. * email : forum@prohost.org * $Id$ * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; version 2 of the License. **/
if (function_exists('mb_internal_encoding')) { mb_internal_encoding('utf-8'); } require('./GLOBALS.php'); fud_use('err.inc');
/* Before we go on, we need to do some very basic activation checks. */ if (!($FUD_OPT_1 & 1)) { // FORUM_ENABLED fud_use('errmsg.inc'); exit_forum_disabled('xml'); }
/* Control options. */ $mode = (isset($_GET['mode']) && in_array($_GET['mode'], array('m', 't', 'u'))) ? $_GET['mode'] : 'm'; $basic = isset($_GET['basic']); $format = 'rdf'; // Default syndication type. if (isset($_GET['format'])) { if (strtolower(substr($_GET['format'], 0, 4)) == 'atom') { $format = 'atom'; } else if (strtolower(substr($_GET['format'], 0, 3)) == 'rss') { $format = 'rss'; } } if (!isset($_GET['th'])) { $_GET['l'] = 1; // Unless thread is syndicated, we will always order entries from newest to oldest. }
# define('fud_query_stats', 1);
class db { public static $db, $slave; }
if (empty(db::$db)) {
// Use MYSQLI_REPORT_OFF so we can check error codes manually. $driver = new mysqli_driver(); $driver->report_mode = MYSQLI_REPORT_OFF;
function db_locked() { return isset($GLOBALS['__DB_INC_INTERNALS__']['db_locked']); }
function db_affected() { return db::$db->affected_rows; }
function uq($query) { return q($query); }
if (!defined('fud_query_stats')) { function q($query) { // Assume master DB, route SELECT's to slave DB. // Force master if DB is locked (in transaction) or 'SELECT /* USE MASTER */'. $db = db::$db; if (!empty(db::$slave) && !db_locked() && !strncasecmp($query, 'SELECT', 6) && strncasecmp($query, 'SELECT /* USE MASTER */', 23)) { $db = db::$slave; }
if (!isset($GLOBALS['__DB_INC_INTERNALS__']['total_sql_time'])) { $GLOBALS['__DB_INC_INTERNALS__']['total_sql_time'] = 0; }
// Assume master DB, route SELECT's to slave DB. // Force master if DB is locked (in transaction) or 'SELECT /* USE MASTER */'. $db = db::$db; if (!empty(db::$slave) && !db_locked() && !strncasecmp($query, 'SELECT', 6) && strncasecmp($query, 'SELECT /* USE MASTER */', 23)) { $db = db::$slave; }
function q_concat($arg) { // MySQL badly breaks the SQL standard by redefining || to mean OR. $tmp = func_get_args(); return 'CONCAT('. implode(',', $tmp) .')'; }
function q_rownum() { q('SET @seq=0'); // For simulating rownum. return '(@seq:=@seq+1)'; }
function _esc($s) { return '\''. db::$db->real_escape_string($s) .'\''; }function read_msg_body($off, $len, $id) { if ($off == -1) { // Fetch from DB and return. return q_singleval('SELECT data FROM fud30_msg_store WHERE id='. $id); }
if (!$len) { // Empty message. return; }
// Open file if it's not already open. if (!isset($GLOBALS['__MSG_FP__'][$id])) { $GLOBALS['__MSG_FP__'][$id] = fopen($GLOBALS['MSG_STORE_DIR'] .'msg_'. $id, 'rb'); }
$file_name = $FORUM_SETTINGS_PATH .'feed_cache_'. md5(serialize($key)); if (file_exists($file_name) && (($t = filemtime($file_name)) + $FEED_CACHE_AGE) > __request_timestamp__) { $mod = gmdate('D, d M Y H:i:s', $t) .' GMT'; if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && !isset($_SERVER['HTTP_RANGE']) && $_SERVER['HTTP_IF_MODIFIED_SINCE'] == $mod) { header('HTTP/1.1 304 Not Modified'); header('Status: 304 Not Modified'); return; } header('Content-Type: application/'.$format.'+xml'); header('Last-Modified: '. $mod); readfile($file_name); return; } ob_start(); }
if ($FEED_MAX_N_RESULTS < 1) { // Handler for events when the value is not set. $FEED_MAX_N_RESULTS = 10; } $limit = (isset($_GET['n']) && $_GET['n'] <= $FEED_MAX_N_RESULTS) ? (int)$_GET['n'] : $FEED_MAX_N_RESULTS;
$feed_data = $feed_header = $join = ''; switch ($mode) { case 'm': $lmt = ' t.moved_to=0 AND m.apr=1'; /* check for various supported limits * cat - category * frm - forum * th - thread * id - message id * ds - start date * de - date end * o - offset * n - number of rows to get * l - latest * sf - subcribed forums based on user id * st - subcribed topics based on user id * basic - output basic info parsable by all rdf parsers */ if (isset($_GET['sf'])) { $_GET['frm'] = db_all('SELECT forum_id FROM fud30_forum_notify WHERE user_id='. (int)$_GET['sf']); } else if (isset($_GET['st'])) { $_GET['th'] = db_all('SELECT thread_id FROM fud30_thread_notify WHERE user_id='. (int)$_GET['sf']); } if (isset($_GET['cat'])) { $lmt .= ' AND f.cat_id IN('. multi_id($_GET['cat']) .')'; } if (isset($_GET['frm'])) { $lmt .= ' AND t.forum_id IN('. multi_id($_GET['frm']) .')'; } if (isset($_GET['th'])) { $lmt .= ' AND m.thread_id IN('. multi_id($_GET['th']) .')'; } if (isset($_GET['id'])) { $lmt .= ' AND m.id IN('. multi_id($_GET['id']) .')'; } if (isset($_GET['ds'])) { $lmt .= ' AND m.post_stamp >='. (int)$_GET['ds']; } if (isset($_GET['de'])) { $lmt .= ' AND m.post_stamp <='. (int)$_GET['de']; }
/* This is an optimization so that the forum does not need to * go through the entire message db to fetch latest messages. * So, instead we set an arbitrary search limit of 14 days. */ if (isset($_GET['l']) && $lmt == ' t.moved_to=0 AND m.apr=1') { $lmt .= ' AND t.last_post_date >='. (__request_timestamp__ - 86400 * 14); }
if ($FUD_OPT_2 & 33554432) { // FEED_AUTH if ($FEED_AUTH_ID) { $join = ' INNER JOIN fud30_group_cache g1 ON g1.user_id=2147483647 AND g1.resource_id=f.id LEFT JOIN fud30_group_cache g2 ON g2.user_id='. $FEED_AUTH_ID .' AND g2.resource_id=f.id LEFT JOIN fud30_mod mm ON mm.forum_id=f.id AND mm.user_id='. $FEED_AUTH_ID .' '; $lmt .= ' AND (mm.id IS NOT NULL OR '. q_bitand('COALESCE(g2.group_cache_opt, g1.group_cache_opt)', 2) .' > 0)'; } else { $join = ' INNER JOIN fud30_group_cache g1 ON g1.user_id=0 AND g1.resource_id=f.id '; $lmt .= ' AND '. q_bitand('g1.group_cache_opt', 2) .' > 0'; } }
$c = q(q_limit('SELECT m.*, u.alias, t.forum_id, p.name AS poll_name, p.total_votes, m2.subject AS th_subject, m3.subject AS reply_subject, f.name AS frm_name, c.name AS cat_name FROM fud30_msg m INNER JOIN fud30_thread t ON m.thread_id=t.id INNER JOIN fud30_forum f ON t.forum_id=f.id INNER JOIN fud30_cat c ON c.id=f.cat_id INNER JOIN fud30_msg m2 ON t.root_msg_id=m2.id LEFT JOIN fud30_msg m3 ON m3.id=m.reply_to LEFT JOIN fud30_users u ON m.poster_id=u.id LEFT JOIN fud30_poll p ON m.poll_id=p.id '. $join .' WHERE '. $lmt .' ORDER BY m.post_stamp '. (isset($_GET['l']) ? 'DESC' : 'ASC'), $limit, $offset)); while ($r = db_rowobj($c)) { if (!$res) { header('Content-Type: application/'.$format.'+xml'); $res = 1; }
case 't': /* check for various supported limits * cat - category * frm - forum * id - topic id * ds - start date * de - date end * o - offset * n - number of rows to get * l - latest */ $lmt = ' t.moved_to=0 AND m.apr=1'; if (isset($_GET['cat'])) { $lmt .= ' AND f.cat_id IN('. multi_id($_GET['cat']) .')'; } if (isset($_GET['frm'])) { $lmt .= ' AND t.forum_id IN('. multi_id($_GET['frm']) .')'; } if (isset($_GET['id'])) { $lmt .= ' AND t.id IN ('. multi_id($_GET['id']) .')'; } if (isset($_GET['ds'])) { $lmt .= ' AND t.last_post_date >='. (int)$_GET['ds']; } if (isset($_GET['de'])) { $lmt .= ' AND t.last_post_date <='. (int)$_GET['de']; }
/* This is an optimization so that the forum does not need to * go through the entire message db to fetch latest messages. * So, instead we set an arbitrary search limit if 14 days. */ if (isset($_GET['l']) && $lmt == ' t.moved_to=0 AND m.apr=1') { $lmt .= ' AND t.last_post_date >='. (__request_timestamp__ - 86400 * 14); }
if ($FUD_OPT_2 & 33554432) { // FEED_AUTH if ($FEED_AUTH_ID) { $join = ' INNER JOIN fud30_group_cache g1 ON g1.user_id=2147483647 AND g1.resource_id=f.id LEFT JOIN fud30_group_cache g2 ON g2.user_id='. $FEED_AUTH_ID .' AND g2.resource_id=f.id LEFT JOIN fud30_mod mm ON mm.forum_id=f.id AND mm.user_id='. $FEED_AUTH_ID .' '; $lmt .= ' AND (mm.id IS NOT NULL OR '. q_bitand('COALESCE(g2.group_cache_opt, g1.group_cache_opt)', 2) .' > 0)'; } else { $join = ' INNER JOIN fud30_group_cache g1 ON g1.user_id=0 AND g1.resource_id=f.id '; $lmt .= ' AND '. q_bitand('g1.group_cache_opt', 2) .' > 0'; } } $c = q(q_limit('SELECT t.*, f.name AS frm_name, c.name AS cat_name, m.subject, m.post_stamp, m.poster_id, m.foff, m.length, m.file_id, m2.subject AS lp_subject, u.alias FROM fud30_thread t INNER JOIN fud30_forum f ON t.forum_id=f.id INNER JOIN fud30_cat c ON c.id=f.cat_id INNER JOIN fud30_msg m ON t.root_msg_id=m.id INNER JOIN fud30_msg m2 ON t.last_post_id=m2.id LEFT JOIN fud30_users u ON m.poster_id=u.id '. $join .' WHERE '. $lmt . (isset($_GET['l']) ? ' ORDER BY m.post_stamp DESC' : ''), $limit, $offset));
$data = ''; while ($r = db_rowobj($c)) { if (!$res) { header('Content-Type: application/'.$format.'+xml'); $res = 1; } if ($r->root_msg_id == $r->last_post_id) { $r->last_post_id = $r->lp_subject = $r->last_post_date = ''; }
case 'u': /* check for various supported limits * pc - order by post count * rd - order by registration date * cl - show only currently online users * l - limit to 'l' rows * o - offset * n - max rows to fetch */ $lmt .= ' u.id>1 '; if (isset($_GET['pc'])) { $order_by = 'u.posted_msg_count'; } else if (isset($_GET['rd'])) { $order_by = 'u.join_date'; } else { $order_by = 'u.alias'; } if (isset($_GET['cl'])) { $lmt .= ' AND u.last_visit>='. (__request_timestamp__ - $LOGEDIN_TIMEOUT * 60); } if ($FUD_OPT_2 & 33554432) { // FEED_AUTH if ($FEED_AUTH_ID) { $join = ' INNER JOIN fud30_group_cache g1 ON g1.user_id=2147483647 AND g1.resource_id=f.id LEFT JOIN fud30_group_cache g2 ON g2.user_id='. $FEED_AUTH_ID .' AND g2.resource_id=f.id LEFT JOIN fud30_mod mm ON mm.forum_id=f.id AND mm.user_id='. $FEED_AUTH_ID .' '; $perms = ', (CASE WHEN (mm.id IS NOT NULL OR '. q_bitand('COALESCE(g2.group_cache_opt, g1.group_cache_opt)', 2) .' > 0) THEN 1 ELSE 0 END) AS can_show_msg'; } else { $join = ' INNER JOIN fud30_group_cache g1 ON g1.user_id=0 AND g1.resource_id=f.id '; $perms = ', '. q_bitand('g1.group_cache_opt', 2) .' > 0 AS can_show_msg'; } } else { $perms = ', 1 AS can_show_msg'; } $c = q(q_limit('SELECT u.id, u.alias, u.join_date, u.posted_msg_count, u.avatar_loc, u.users_opt, u.home_page, u.birthday, u.last_visit, u.icq, u.facebook, u.yahoo, u.jabber, u.google, u.skype, u.twitter, u.name, u.email, m.id AS msg_id, m.subject, m.thread_id, t.forum_id, f.name AS frm_name, c.name AS cat_name '. $perms .'
FROM fud30_users u LEFT JOIN fud30_msg m ON m.id=u.u_last_post_id LEFT JOIN fud30_thread t ON m.thread_id=t.id LEFT JOIN fud30_forum f ON f.id=t.forum_id LEFT JOIN fud30_cat c ON c.id=f.cat_id '. $join .' WHERE '. $lmt .' ORDER BY '. $order_by .' DESC', $limit, $offset)); while ($r = db_rowobj($c)) { if (!$res) { header('Content-Type: application/'.$format.'+xml'); $res = 1; }