Benjy
Well-known member
THIS IS NO LONGER SUPPORTED, PLEASE USE THIS INSTEAD!
Description
This script allows you to access (some of) your xF data remotely and retrieve it in XML. This is very useful if you don't want to include a load of scripts/frameworks in your website, yet want to connect it to your forums (e.g. a news system which comments come from a forum or simply a login box).
Limitations
- For the isloggedin function, your website must have access to your forum cookies.
- Facebook Connect automatic connection isn't handled (that is, if a FB session exists and a xF doesn't, the xF session won't be created).
How to use it
- Place the Server script at the root of your xF installation (and rename it to whatever you want, for security purposes)
- Place the Client script where you include your libs on your website, require it then:
PHP:
/* Example usage */
$fcc = new forumConnect_Client('xenForo', 'http://www.example.org/forums', '_myconnector.php');
$isloggedinxml = $fcc->isloggedin('xf_');
$threadxml = $fcc->getthread(1);
Methods
Name: isloggedin
Parameters: sessionid (string, e.g. $_COOKIE['xf_session']), ipaddress (string, e.g. $_SERVER['REMOTE_ADDR']), sessionuser (string, e.g. $_COOKIE['xf_user'])
Returns on success:
Code:
<user>
<userid>int</userid>
</user>
Returns on failure:
Code:
<user>
<userid>0</userid>
</user>
Name: getthread
Parameters: threadid(int), getposts(bool)
Returns on success:
Code:
<thread>
<threadid>int</threadid>
<description>string</description>
<title>string</title>
<url>string</url>
<firstpostid>int</firstpostid>
<lastpostid>int</lastpostid>
<forumid>int</forumid>
<replycount>int</replycount>
<lastusername>string</lastusername>
<lastuserid>int</lastuserid>
<dateline>int</dateline>
<views>int</views>
<votecount>int</votecount><!-- not ([URL='http://xenforo.com/community/threads/thread-rating-system-reputation-system.6357/']yet[/URL]?) supported -->
<votetotal>int</votetotal><!-- not ([URL='http://xenforo.com/community/threads/thread-rating-system-reputation-system.6357/']yet[/URL]?) supported -->
<isdeleted>bool</isdeleted>
<isopen>bool</isopen>
<issticky>bool</issticky>
<isvisible>bool</isvisible>
<!-- if getposts is TRUE -->
<posts>
<post>
<postid>int</postid>
<parentid>int</parentid>
<title>string</title>
<dateline>int</dateline>
<content>string</content>
<url>string</url>
<isdeleted>bool</isdeleted>
<isvisible>bool</isvisible>
<user>
<userid>int</userid>
<usergroupids>string</usergroupids>
<username>string</username>
<usertitle>string</usertitle>
<email>string</email>
<avatarurl>string</avatarurl>
<logouthash>string</logouthash>
<isadmin>bool</isadmin>
<isbanned>bool</isbanned>
<isvalid>bool</isvalid>
</user>
</post>
</posts>
<!-- elseif getposts is FALSE -->
<user>
<userid>int</userid>
<usergroupids>string</usergroupids>
<username>string</username>
<usertitle>string</usertitle>
<email>string</email>
<avatarurl>string</avatarurl>
<logouthash>string</logouthash>
<isadmin>bool</isadmin>
<isbanned>bool</isbanned>
<isvalid>bool</isvalid>
</user>
</thread>
Returns on failure:
Code:
<thread>
<threadid>0</threadid>
</thread>
Name: getuser
Parameters: userid (int)
Returns on success:
Code:
<user>
<userid>int</userid>
<usergroupids>string</usergroupids>
<username>string</username>
<usertitle>string</usertitle>
<email>string</email>
<avatarurl>string</avatarurl>
<logouthash>string</logouthash>
<isadmin>bool</isadmin>
<isbanned>bool</isbanned>
<isvalid>bool</isvalid>
</user>
Returns on failure:
Code:
<user>
<userid>0</userid>
</user>
Where can I find it?
Here: http://code.google.com/p/forumconnect/
And more specifically:
- Server: http://code.google.com/p/forumconnect/source/browse/trunk/Server/xenForo.php
- Client: http://code.google.com/p/forumconnect/source/browse/trunk/Client.php
- ?
FAQ
- Is this bug free? No.
- Why is your OO code awful? I don't like OO much but I wanted to sandbox this a maximum.
- Are you looking for help? Of course! My goal was to start this, then let the community enhance it.
- What about the vB... script I see in the repository? Wouldn't it be great if it could handle multiple forum softwares?