report_mode = MYSQLI_REPORT_OFF;
if (substr($GLOBALS['DBHOST'], 0, 1) == ':') { // Socket connection.
$socket = substr($GLOBALS['DBHOST'], 1);
$GLOBALS['DBHOST'] = 'localhost';
} else {
$socket = NULL;
}
if ($GLOBALS['FUD_OPT_1'] & 256 && $socket == NULL && version_compare(PHP_VERSION, '5.3.0', '>=')) { // Enable pconnect for PHP 5.3+.
$GLOBALS['DBHOST'] = 'p:'. $GLOBALS['DBHOST'];
}
db::$db = new mysqli($GLOBALS['DBHOST'], $GLOBALS['DBHOST_USER'], $GLOBALS['DBHOST_PASSWORD'], $GLOBALS['DBHOST_DBNAME'], NULL, $socket);
if (mysqli_connect_errno()) {
fud_sql_error_handler('Failed to establish database connection', 'MySQLi says: '. mysqli_connect_error(), mysqli_connect_errno(), '');
}
db::$db->set_charset('utf8');
/* Connect to slave, if specified. */
if (!empty($GLOBALS['DBHOST_SLAVE_HOST']) && !$GLOBALS['is_post']) {
db::$slave = new mysqli($GLOBALS['DBHOST'], $GLOBALS['DBHOST_USER'], $GLOBALS['DBHOST_PASSWORD'], $GLOBALS['DBHOST_DBNAME'], NULL, $socket);
if (mysqli_connect_errno()) {
fud_logerror('Unable to init SlaveDB, fallback to MasterDB: '. mysqli_connect_error(), 'sql_errors');
} else {
db::$db->set_charset('utf8');
}
}
define('__dbtype__', 'mysql');
}
function db_close()
{
db::$db->close();
}
function db_version()
{
if (!defined('__FUD_SQL_VERSION__')) {
$ver = q_singleval('SELECT VERSION()');
define('__FUD_SQL_VERSION__', $ver);
}
return __FUD_SQL_VERSION__;
}
function db_lock($tables)
{
if (!empty($GLOBALS['__DB_INC_INTERNALS__']['db_locked'])) {
fud_sql_error_handler('Recursive Lock', 'internal', 'internal', db_version());
} else {
q('LOCK TABLES '. $tables);
$GLOBALS['__DB_INC_INTERNALS__']['db_locked'] = 1;
}
}
function db_unlock()
{
if (empty($GLOBALS['__DB_INC_INTERNALS__']['db_locked'])) {
unset($GLOBALS['__DB_INC_INTERNALS__']['db_locked']);
fud_sql_error_handler('DB_UNLOCK: no previous lock established', 'internal', 'internal', db_version());
}
if (--$GLOBALS['__DB_INC_INTERNALS__']['db_locked'] < 0) {
unset($GLOBALS['__DB_INC_INTERNALS__']['db_locked']);
fud_sql_error_handler('DB_UNLOCK: unlock overcalled', 'internal', 'internal', db_version());
}
unset($GLOBALS['__DB_INC_INTERNALS__']['db_locked']);
q('UNLOCK TABLES');
}
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;
}
$r = $db->query($query);
if ($db->error) {
fud_sql_error_handler($query, $db->error, $db->errno, db_version());
}
return $r;
}
} else {
function q($query)
{
if (!isset($GLOBALS['__DB_INC_INTERNALS__']['query_count'])) {
$GLOBALS['__DB_INC_INTERNALS__']['query_count'] = 1;
} else {
++$GLOBALS['__DB_INC_INTERNALS__']['query_count'];
}
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;
}
$s = microtime(true);
$result = $db->query($query);
if ($db->error) {
fud_sql_error_handler($query, $db->error, $db->errno, db_version());
}
$e = microtime(true);
$GLOBALS['__DB_INC_INTERNALS__']['last_time'] = ($e - $s);
$GLOBALS['__DB_INC_INTERNALS__']['total_sql_time'] += $GLOBALS['__DB_INC_INTERNALS__']['last_time'];
echo '
Query #'. $GLOBALS['__DB_INC_INTERNALS__']['query_count'] .'';
echo ': time taken: '. number_format($GLOBALS['__DB_INC_INTERNALS__']['last_time'], 4) .'';
echo ', affected rows: '. db_affected() .'';
echo ', total sql time: '. number_format($GLOBALS['__DB_INC_INTERNALS__']['total_sql_time'], 4) .'';
echo ''. preg_replace('!\s+!', ' ', htmlspecialchars($query)) .'
';
return $result;
}
}
function db_rowobj($result)
{
return $result->fetch_object();
}
function db_rowarr($result)
{
return $result->fetch_row();
}
function q_singleval($query)
{
$r = q($query);
if (($result = $r->fetch_row()) !== false && isset($result)) {
return isset($result) ? $result[0] : '';
}
}
function q_limit($query, $limit, $off=0)
{
return $query .' LIMIT '. $limit .' OFFSET '. $off;
}
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 q_bitand($fieldLeft, $fieldRight) {
return $fieldLeft .' & '. $fieldRight;
}
function q_bitor($fieldLeft, $fieldRight) {
return '('. $fieldLeft .' | '. $fieldRight .')';
}
function q_bitnot($bitField) {
return '~'. $bitField;
}
function db_saq($q)
{
$r = q($q);
return $r->fetch_row() ;
}
function db_sab($q)
{
$r = q($q);
return $r->fetch_object();
}
function db_qid($q)
{
q($q);
return db::$db->insert_id;
}
function db_arr_assoc($q)
{
$r = q($q);
return $r->fetch_array(MYSQLI_ASSOC);
}
function db_fetch_array($r)
{
return is_object($r) ? $r->fetch_array(MYSQLI_ASSOC) : null;
}
function db_li($q, &$ef, $li=0)
{
$r = db::$db->query($q);
if ($r) {
return ($li ? db::$db->insert_id : $r);
}
/* Duplicate key. */
if (db::$db->errno == 1062) {
$ef = ltrim(strrchr(db::$db->error, ' '));
return null;
} else {
fud_sql_error_handler($q, db::$db->error, db::$db->errno, db_version());
}
}
function ins_m($tbl, $flds, $types, $vals)
{
q('INSERT IGNORE INTO '. $tbl .' ('. $flds .') VALUES ('. implode('),(', $vals) .')');
}
function db_all($q)
{
$f = array();
$c = uq($q);
while ($r = $c->fetch_row()) {
$f[] = $r[0];
}
return $f;
}
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');
}
// Read from file.
fseek($GLOBALS['__MSG_FP__'][$id], $off);
return fread($GLOBALS['__MSG_FP__'][$id], $len);
}$GLOBALS['__revfs'] = array('"', '<', '>', '&');
$GLOBALS['__revfd'] = array('"', '<', '>', '&');
function reverse_fmt($data)
{
$s = $d = array();
if (empty($data)) return '';
foreach ($GLOBALS['__revfs'] as $k => $v) {
if (strpos($data, $v) !== false) {
$s[] = $v;
$d[] = $GLOBALS['__revfd'][$k];
}
}
return $s ? str_replace($s, $d, $data) : $data;
}
if (!($FUD_OPT_2 & 16777216) || (!($FUD_OPT_2 & 67108864) && $mode == 'u')) {
fud_use('cookies.inc');
fud_use('users.inc');
std_error('disabled');
}
if ($FUD_OPT_2 & 16384) {
ob_start('ob_gzhandler', (int)$PHP_COMPRESSION_LEVEL);
}
function sp($data)
{
return '';
}
function email_format($data)
{
return str_replace(array('.', '@'), array(' dot ', ' at '), $data);
}
function multi_id($data)
{
$out = array();
foreach (explode(',', (string)$data) as $v) {
$out[] = (int) $v;
}
return implode(',', $out);
}
$enc_src = array('
', '&', "\r", ' ', '<', '>', chr(0));
$enc_dst = array('
', '&', '
', ' ', '<', '>', '');
function fud_xml_encode($str)
{
return str_replace($GLOBALS['enc_src'], $GLOBALS['enc_dst'], $str);
}
function feed_cache_cleanup()
{
$cache_files = glob($GLOBALS['FORUM_SETTINGS_PATH'].'feed_cache_*');
if (is_array($cache_files)) {
foreach ($cache_files as $v) {
$filemtime = @filemtime($v);
if ($filemtime && $filemtime + $GLOBALS['FEED_CACHE_AGE'] < __request_timestamp__) {
unlink($v);
}
}
}
}
/** Change relative smiley URLs to full ones. */
function smiley_full(&$data)
{
if (strpos($data, 'id.'&th='.$r->thread_id.'#msg_'.$r->id.'" />';
$rdf_message_attachments = '';
if ($r->attach_cnt && $r->attach_cache) {
if (($al = unserialize($r->attach_cache))) {
foreach ($al as $a) {
$rdf_message_attachments .= '
'.sp($a[1]).'
'.$a[0].'
'.$a[2].'
'.$a[3].'
';
}
}
}
$rdf_message_polls = '';
if ($r->poll_name) {
if ($r->poll_cache) {
if (($pc = unserialize($r->poll_cache))) {
foreach ($pc as $o) {
$rdf_message_polls .= '
'.sp($o[0]).'
'.$o[1].'
';
}
}
}
}
$feed_data .= ($basic ? '
-
'.htmlspecialchars($r->subject).'
[[softurl]]/index.phpindex.php?t=rview&goto='.$r->id.'&th='.$r->thread_id.'#msg_'.$r->id.'
'.sp($body).'
'.$r->alias.'
'.gmdate('Y-m-d\TH:i:s', $r->post_stamp).'-00:00
' : '
-
'.sp($r->subject).'
'.$r->thread_id.'
'.sp($r->th_subject).'
'.$r->id.'
'.$r->reply_to.'
'.$r->reply_subject.'
'.$r->forum_id.'
'.sp($r->frm_name).'
'.sp($r->cat_name).'
'.sp($r->alias).'
'.$r->poster_id.'
'.gmdate('Y-m-d\TH:i:s', $r->post_stamp).'-00:00
'.str_replace("\n", "", sp($body)).'
'.($rdf_message_attachments ? '
'.$rdf_message_attachments.'
' : '' ) .'
'.($rdf_message_polls ? '
'.sp($r->poll_name).''.$r->total_votes.'
'.$rdf_message_polls.'
' : '' ) .'
' ) ;
}
if ($format == 'rss' ) $feed_data .= '-
'.htmlspecialchars($r->subject).'
[[softurl]]/index.phpindex.php?t=rview&goto='.$r->id.'&th='.$r->thread_id.'#msg_'.$r->id.'
'.$r->alias.'
'.gmdate('Y-m-d\TH:i:s', $r->post_stamp).'-00:00
'.sp($body).'
';
if ($format == 'atom') $feed_data .= '
'.htmlspecialchars($r->subject).'
[[softurl]]/index.phpindex.php?t=rview&goto='.$r->id.'&th='.$r->thread_id.'#msg_'.$r->id.'
'.$r->alias.'
'.gmdate('Y-m-d\TH:i:s', $r->post_stamp).'-00:00
'.($r->update_stamp ? ''.gmdate('Y-m-d\TH:i:s', $r->update_stamp).'-00:00' : '' ) .'
'.sp($body).'
';
}
if ($res) {
if ($format == 'rdf') echo '
'.($basic ? '
' : '
' ) .'
'.$FORUM_TITLE.' - RDF feed
[[softurl]]/index.php
'.sp($GLOBALS['FORUM_DESCR']).'
'.($basic && $feed_header ? '
'.$feed_header.'
' : '' ) .'
'.$feed_data.'
';
if ($format == 'rss') echo '
'.$FORUM_TITLE.' - RSS2 feed
[[softurl]]/index.php
'.sp($GLOBALS['FORUM_DESCR']).'
en
'.gmdate('Y-m-d\TH:i:s', __request_timestamp__).'-00:00
FUDforum '.$FORUM_VERSION.'
'.$feed_data.'
';
if ($format == 'atom') echo '
'.$FORUM_TITLE.' - ATOM feed
'.sp($GLOBALS['FORUM_DESCR']).'
'.gmdate('Y-m-d\TH:i:s', __request_timestamp__).'-00:00
[[softurl]]/index.php
FUDforum
'.$feed_data.'
';
}
unset($c);
break;
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 = '';
}
$body = read_msg_body($r->foff, $r->length, $r->file_id);
smiley_full($body);
if ($format == 'rdf') {
$feed_header .= '';
$feed_data .= ($basic ? '
-
'.htmlspecialchars($r->subject).'
[[softurl]]/index.phpindex.php?t=rview&th='.$r->id.'
'.sp($body).'
'.sp($r->frm_name).'
'.sp($r->alias).'
'.gmdate('Y-m-d\TH:i:s', $r->post_stamp).'-00:00
' : '
-
'.$r->id.'
'.sp($r->subject).'
'.gmdate('Y-m-d\TH:i:s', $r->post_stamp).'-00:00
'.$r->forum_id.'
'.sp($r->frm_name).'
'.sp($r->cat_name).'
'.sp($r->alias).'
'.$r->poster_id.'
'.$r->replies.'
'.$r->views.'
'.($r->last_post_id ? ''.$r->last_post_id.'' : '' ) .'
'.($r->lp_subject ? ''.sp($r->lp_subject).'' : '' ) .'
'.($r->last_post_date ? ''.gmdate('Y-m-d\TH:i:s', $r->last_post_date).'-00:00' : '' ) .'
'.str_replace("\n", "", sp($body)).'
' ) ;
}
if ($format == 'rss' ) $feed_data .= '-
'.htmlspecialchars($r->subject).'
[[softurl]]/index.phpindex.php?t=rview&th='.$r->id.'
'.sp($r->alias).'
'.gmdate('Y-m-d\TH:i:s', $r->post_stamp).'-00:00
'.sp($body).'
';
if ($format == 'atom') $feed_data .= '
'.htmlspecialchars($r->subject).'
'.($r->tdescr ? ''.sp($r->tdescr).'' : '' ) .'
[[softurl]]/index.phpindex.php?t=rview&th='.$r->id.'
'.sp($r->alias).'
'.gmdate('Y-m-d\TH:i:s', $r->post_stamp).'-00:00
'.($r->last_post_date ? ''.gmdate('Y-m-d\TH:i:s', $r->last_post_date).'-00:00' : '' ) .'
'.sp($body).'
';
}
if ($res) {
if ($format == 'rdf') echo '
'.($basic ? '
' : '
' ) .'
'.$FORUM_TITLE.' - RDF feed
[[softurl]]/index.php
'.sp($GLOBALS['FORUM_DESCR']).'
'.($basic && $feed_header ? '
'.$feed_header.'
' : '' ) .'
'.$feed_data.'
';
if ($format == 'rss') echo '
'.$FORUM_TITLE.' - RSS2 feed
[[softurl]]/index.php
'.sp($GLOBALS['FORUM_DESCR']).'
en
'.gmdate('Y-m-d\TH:i:s', __request_timestamp__).'-00:00
FUDforum '.$FORUM_VERSION.'
'.$feed_data.'
';
if ($format == 'atom') echo '
'.$FORUM_TITLE.' - ATOM feed
'.sp($GLOBALS['FORUM_DESCR']).'
'.gmdate('Y-m-d\TH:i:s', __request_timestamp__).'-00:00
[[softurl]]/index.php
FUDforum
'.$feed_data.'
';
}
unset($c);
break;
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;
}
if ($r->birthday) {
$y = substr($r->birthday, 4);
$m = substr($r->birthday, 0, 2);
$d = substr($r->birthday, 2, 2);
$r->birthday = gmdate('r', gmmktime(1, 1, 1, $m, $d, $y));
} else {
$r->birthday = '';
}
$r->last_visit = ($r->last_visit && $r->last_visit > 631155661) ? $r->last_visit : '';
$r->join_date = ($r->join_date && $r->join_date > 631155661) ? $r->join_date : '';
if ($r->users_opt >= 16777216) {
$r->avatar_loc = '';
}
if ($format == 'rdf' ) $feed_data .= '-
'.$r->id.'
'.sp($r->alias).'
'.sp($r->name).'
'.sp(email_format($r->email)).'
'.$r->posted_msg_count.'
'.sp($r->avatar_loc).'
'.sp(htmlspecialchars($r->homepage)).'
'.$r->birthday.'
'.($r->last_visit ? ''.gmdate('Y-m-d\TH:i:s', $r->last_visit).'' : '' ) .'
'.($r->join_date ? ''.gmdate('Y-m-d\TH:i:s', $r->join_date).'' : '' ) .'
'.$r->icq.'
'.sp($r->facebook).'
'.sp($r->yahoo).'
'.sp($r->jabber).'
'.sp($r->google).'
'.sp($r->skype).'
'.sp($r->twitter).'
'.($r->subject && $r->can_show_msg ? '
'.sp($r->subject).'
'.$r->msg_id.'
'.$r->thread_id.'
'.$r->forum_id.'
'.sp($r->frm_name).'
'.sp($r->cat_name).'
' : '' ) .'
';
if ($format == 'rss' ) $feed_data .= '-
'.sp($r->alias).'
[[softurl]]/index.phpindex.php?t=usrinfo&id='.$r->id.'
'.sp($r->name).'
'.($r->last_visit ? ''.gmdate('Y-m-d\TH:i:s', $r->last_visit).'' : '' ) .'
';
if ($format == 'atom') $feed_data .= '
'.sp($r->alias).'
[[softurl]]/index.phpindex.php?t=usrinfo&id='.$r->id.'
'.sp($r->name).'
'.sp(email_format($r->email)).'
'.($r->homepage ? ''.sp(htmlspecialchars($r->homepage)).'' : '' ) .'
'.($r->last_visit ? ''.gmdate('Y-m-d\TH:i:s', $r->last_visit).'' : '' ) .'
'.($r->join_date ? ''.gmdate('Y-m-d\TH:i:s', $r->join_date).'' : '' ) .'
';
}
if ($res) {
if ($format == 'rdf') echo '
'.($basic ? '
' : '
' ) .'
'.$FORUM_TITLE.' - RDF feed
[[softurl]]/index.php
'.sp($GLOBALS['FORUM_DESCR']).'
'.($basic && $feed_header ? '
'.$feed_header.'
' : '' ) .'
'.$feed_data.'
';
if ($format == 'rss') echo '
'.$FORUM_TITLE.' - RSS2 feed
[[softurl]]/index.php
'.sp($GLOBALS['FORUM_DESCR']).'
en
'.gmdate('Y-m-d\TH:i:s', __request_timestamp__).'-00:00
FUDforum '.$FORUM_VERSION.'
'.$feed_data.'
';
if ($format == 'atom') echo '
'.$FORUM_TITLE.' - ATOM feed
'.sp($GLOBALS['FORUM_DESCR']).'
'.gmdate('Y-m-d\TH:i:s', __request_timestamp__).'-00:00
[[softurl]]/index.php
FUDforum
'.$feed_data.'
';
}
unset($c);
break;
} // switch ($mode)
if ($res) {
if ($FEED_CACHE_AGE) {
echo ($out = ob_get_clean());
$fp = fopen($file_name, 'w');
fwrite($fp, $out);
fclose($fp);
}
} else {
exit('
No matching data found.
');
}
?>