Resource:Woltlab-Connector: Difference between revisions
Xthepr0mise (talk | contribs) (Created page with "{{Resource page}} '''Current Version: 1.1.0''' This is a library, created by xthepr0mise, which allows you to connect to your forum software easily. It uses the MySQL-Plugin to ...") |
Xthepr0mise (talk | contribs) No edit summary |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{Resource page}} | {{Resource page}} | ||
'''Current Version: 1.1. | '''Current Version: 1.1.2''' | ||
This is a library, created by xthepr0mise, which allows you to connect to your forum software easily. | This is a library, created by xthepr0mise, which allows you to connect to your forum software easily. | ||
Line 7: | Line 7: | ||
==Functions== | ==Functions== | ||
===woltlab_connect=== | ===Connection=== | ||
====woltlab_connect==== | |||
<section name="Server" class="server" show="true"> | <section name="Server" class="server" show="true"> | ||
==Syntax== | ==Syntax== | ||
Line 28: | Line 29: | ||
</section> | </section> | ||
===woltlab_disconnect=== | ====woltlab_disconnect==== | ||
<section name="Server" class="server" show="true"> | <section name="Server" class="server" show="true"> | ||
==Syntax== | ==Syntax== | ||
Line 46: | Line 47: | ||
</section> | </section> | ||
===woltlab_checkPassword=== | ===User-Functions=== | ||
====woltlab_checkPassword==== | |||
<section name="Server" class="server" show="true"> | <section name="Server" class="server" show="true"> | ||
==Syntax== | ==Syntax== | ||
Line 65: | Line 67: | ||
</section> | </section> | ||
===woltlab_getUserID=== | ====woltlab_getUserID==== | ||
<section name="Server" class="server" show="true"> | <section name="Server" class="server" show="true"> | ||
==Syntax== | ==Syntax== | ||
Line 83: | Line 85: | ||
</section> | </section> | ||
===woltlab_getBoardID=== | ====woltlab_addUser==== | ||
<section name="Server" class="server" show="true"> | |||
==Syntax== | |||
<syntaxhighlight lang="lua"> | |||
bool woltlab_addUser ( username, email, password ) | |||
</syntaxhighlight> | |||
==Required Arguments== | |||
*'''username''': The username of the player you want to add | |||
*'''email''': His e-mail address | |||
*'''password''': His password (encrypted) | |||
==Returns== | |||
Returns '''true''' if the user got created or '''false''' | |||
<syntaxhighlight lang="lua"> | |||
-- TODO | |||
</syntaxhighlight> | |||
</section> | |||
====woltlab_userExists==== | |||
<section name="Server" class="server" show="true"> | |||
==Syntax== | |||
<syntaxhighlight lang="lua"> | |||
bool woltlab_userExists ( username ) | |||
</syntaxhighlight> | |||
==Required Arguments== | |||
*'''username''': The username of the player you want to check | |||
==Returns== | |||
Returns '''true''' or '''false''' | |||
<syntaxhighlight lang="lua"> | |||
-- TODO | |||
</syntaxhighlight> | |||
</section> | |||
===Board-Functions=== | |||
====woltlab_getBoardID==== | |||
<section name="Server" class="server" show="true"> | <section name="Server" class="server" show="true"> | ||
==Syntax== | ==Syntax== | ||
Line 101: | Line 142: | ||
</section> | </section> | ||
===woltlab_getBoardTitle=== | ====woltlab_getBoardTitle==== | ||
<section name="Server" class="server" show="true"> | <section name="Server" class="server" show="true"> | ||
==Syntax== | ==Syntax== | ||
Line 119: | Line 160: | ||
</section> | </section> | ||
===woltlab_addThread=== | ====woltlab_addThread==== | ||
<section name="Server" class="server" show="true"> | <section name="Server" class="server" show="true"> | ||
==Syntax== | ==Syntax== | ||
Line 144: | Line 185: | ||
</section> | </section> | ||
=== | ===Group-Functions=== | ||
====woltlab_groupExists==== | |||
<section name="Server" class="server" show="true"> | <section name="Server" class="server" show="true"> | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
bool | bool woltlab_groupExists ( ID ) | ||
</syntaxhighlight> | |||
==Required Arguments== | |||
*'''ID''': The ID of the group | |||
==Returns== | |||
Returns '''true''' if the group exists or '''false''' | |||
<syntaxhighlight lang="lua"> | |||
-- TODO | |||
</syntaxhighlight> | |||
</section> | |||
====woltlab_isUserInGroup==== | |||
<section name="Server" class="server" show="true"> | |||
==Syntax== | |||
<syntaxhighlight lang="lua"> | |||
bool woltlab_isUserInGroup ( username, ID ) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
==Required Arguments== | ==Required Arguments== | ||
*'''username''': The username of the player you want to check | *'''username''': The username of the player you want to check | ||
*'''ID''': The ID of the group | |||
==Returns== | ==Returns== | ||
Returns '''true''' or '''false''' | Returns '''true''' if he is in the group or '''false''' | ||
<syntaxhighlight lang="lua"> | |||
-- TODO | |||
</syntaxhighlight> | |||
</section> | |||
====woltlab_getGroupID==== | |||
<section name="Server" class="server" show="true"> | |||
==Syntax== | |||
<syntaxhighlight lang="lua"> | |||
bool woltlab_getGroupID ( title ) | |||
</syntaxhighlight> | |||
==Required Arguments== | |||
*'''title''': The title of the group | |||
==Returns== | |||
Returns '''int ID''' of the group or '''false''' | |||
<syntaxhighlight lang="lua"> | |||
-- TODO | |||
</syntaxhighlight> | |||
</section> | |||
====woltlab_getGroupTitle==== | |||
<section name="Server" class="server" show="true"> | |||
==Syntax== | |||
<syntaxhighlight lang="lua"> | |||
bool woltlab_getGroupTitle ( ID ) | |||
</syntaxhighlight> | |||
==Required Arguments== | |||
*'''ID''': The ID of the group | |||
==Returns== | |||
Returns '''string title''' of the group or '''false''' | |||
<syntaxhighlight lang="lua"> | |||
-- TODO | |||
</syntaxhighlight> | |||
</section> | |||
====woltlab_addUserToGroup==== | |||
<section name="Server" class="server" show="true"> | |||
==Syntax== | |||
<syntaxhighlight lang="lua"> | |||
bool woltlab_addUserToGroup ( username, groupID ) | |||
</syntaxhighlight> | |||
==Required Arguments== | |||
*'''username''': The username of the player | |||
*'''groupID''': The ID of the group | |||
==Returns== | |||
Returns '''true''' if he got added or '''false''' | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
-- TODO | -- TODO | ||
Line 162: | Line 278: | ||
</section> | </section> | ||
=== | ====woltlab_removeUserFromGroup==== | ||
<section name="Server" class="server" show="true"> | <section name="Server" class="server" show="true"> | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
bool | bool woltlab_removeUserFromGroup ( username, groupID ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==Required Arguments== | ==Required Arguments== | ||
*'''username''': The username of the player | *'''username''': The username of the player | ||
*''' | *'''groupID''': The ID of the group | ||
==Returns== | ==Returns== | ||
Returns '''true''' if | Returns '''true''' if he got removed or '''false''' | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
-- TODO | -- TODO |
Latest revision as of 12:37, 11 October 2012
Current Version: 1.1.2
This is a library, created by xthepr0mise, which allows you to connect to your forum software easily. It uses the MySQL-Plugin to connect to the database and includes a full log which documents nearly every (woltlab_)function called by the user.
Functions
Connection
woltlab_connect
Syntax
bool woltlab_connect ( dbHost, dbUsername, dbPasswort, dbName )
Required Arguments
- dbHost: The IP-Address of the database
- dbUsername: The username of the database
- dbPasswort: The password of the database
- dbName: The name of the database
Returns
Returns true if it connected successfully else false
-- TODO
woltlab_disconnect
Syntax
bool woltlab_disconnect ( )
Required Arguments
- None
Returns
Returns true if it disconnected successfully else false
-- TODO
User-Functions
woltlab_checkPassword
Syntax
bool woltlab_checkPassword ( username, password )
Required Arguments
- username: The username of the player you want to check
- password: The password he entered (encrypted)
Returns
Returns true if the password is right else false
-- TODO
woltlab_getUserID
Syntax
int woltlab_getUserID ( username )
Required Arguments
- username: The username of the player whose ID you want to get
Returns
Returns int ID or false if the user does not exist
-- TODO
woltlab_addUser
Syntax
bool woltlab_addUser ( username, email, password )
Required Arguments
- username: The username of the player you want to add
- email: His e-mail address
- password: His password (encrypted)
Returns
Returns true if the user got created or false
-- TODO
woltlab_userExists
Syntax
bool woltlab_userExists ( username )
Required Arguments
- username: The username of the player you want to check
Returns
Returns true or false
-- TODO
Board-Functions
woltlab_getBoardID
Syntax
int woltlab_getBoardID ( title )
Required Arguments
- title: The title of the board whose ID you want to get
Returns
Returns int ID or false if the board does not exist
-- TODO
woltlab_getBoardTitle
Syntax
string woltlab_getBoardTitle ( id )
Required Arguments
- id: The ID of the board whose title you want to get
Returns
Returns string title or false if the board does not exist
-- TODO
woltlab_addThread
Syntax
bool woltlab_addThread ( username, boardID, prefix, head, description, [registered] )
Required Arguments
- username: The username of the player which creates the thread
- boardID: The ID of the board in which the thread should be created
- prefix: The prefix of the thread
- head: The title of the thread
- description: The content of the thread
Optional Arguments
- registered: A bool whether the user is registered in the forum or not
Returns
Returns true if the thread got created or false
-- TODO
Group-Functions
woltlab_groupExists
Syntax
bool woltlab_groupExists ( ID )
Required Arguments
- ID: The ID of the group
Returns
Returns true if the group exists or false
-- TODO
woltlab_isUserInGroup
Syntax
bool woltlab_isUserInGroup ( username, ID )
Required Arguments
- username: The username of the player you want to check
- ID: The ID of the group
Returns
Returns true if he is in the group or false
-- TODO
woltlab_getGroupID
Syntax
bool woltlab_getGroupID ( title )
Required Arguments
- title: The title of the group
Returns
Returns int ID of the group or false
-- TODO
woltlab_getGroupTitle
Syntax
bool woltlab_getGroupTitle ( ID )
Required Arguments
- ID: The ID of the group
Returns
Returns string title of the group or false
-- TODO
woltlab_addUserToGroup
Syntax
bool woltlab_addUserToGroup ( username, groupID )
Required Arguments
- username: The username of the player
- groupID: The ID of the group
Returns
Returns true if he got added or false
-- TODO
woltlab_removeUserFromGroup
Syntax
bool woltlab_removeUserFromGroup ( username, groupID )
Required Arguments
- username: The username of the player
- groupID: The ID of the group
Returns
Returns true if he got removed or false
-- TODO
Usage
Option 1
exports.woltlab:FUNCTION ( PARAMETERS )
Option 2
exports:['woltlab']:FUNCTION ( PARAMETERS )
Examples
Simple password-checking
exports.woltlab:woltlab_connect ( "127.0.0.1", "root", "", "wcf" ) local login = exports.woltlab:woltlab_checkPassword ( "xthepr0mise", "test" ) if login == true then outputChatBox("Your password is right!") else outputChatBox("Your password is wrong!") end exports.woltlab:woltlab_disconnect()
Known Bugs
- none