. require_once("../inc/forum_db.inc"); require_once("../inc/util.inc"); require_once("../inc/xml.inc"); xml_header(); $retval = db_init_xml(); if ($retval) xml_error($retval); $method = get_str("method", true); if ($method != "user_posts" && $method != "user_threads") { xml_error(-210); } $userid = get_int("userid", true); $user = lookup_user_id($userid); if (!$user) { xml_error(-136); } if ($method == "user_posts") { $count = get_int("count", true); if (!$count || $count <= 0 || $count > 50) { $count = 10; } $length = get_int("contentlength", true); if (($length == null) || ($length <= 0)) { $length = 0; } $posts = BoincPost::enum("user=$userid ORDER BY timestamp DESC LIMIT $count"); $count = count($posts); echo "\n"; echo "$count\n"; echo "\n"; foreach ($posts as $post) { $thread = BoincThread::lookup_id($post->thread); echo "\n"; echo " $post->id\n"; echo " $post->thread\n"; echo " title."]]>\n"; echo " $post->timestamp\n"; if ($length > 0) { echo " content, 0, $length)."]]>\n"; } else { echo " content."]]>\n"; } echo "\n"; } echo "\n"; echo "\n"; } elseif ($method == "user_threads") { $count = get_int("count", true); if (!$count || $count <= 0 || $count > 50) { $count = 10; } $threads = BoincThread::enum("owner=$userid ORDER BY timestamp DESC LIMIT $count"); $count = count($threads); echo "\n"; echo "$count\n"; echo "\n"; foreach($threads as $thread) { echo "\n"; echo " $thread->id\n"; echo " $thread->forum\n"; echo " $thread->replies\n"; echo " $thread->views\n"; echo " $thread->timestamp\n"; echo " <![CDATA[$thread->title]]>\n"; echo "\n"; } echo "\n"; echo "\n"; } ?>