Resource:Woltlab-Connector: Difference between revisions
Xthepr0mise (talk | contribs) No edit summary |
Xthepr0mise (talk | contribs) No edit summary |
||
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_addUser==== | ||
<section name="Server" class="server" show="true"> | <section name="Server" class="server" show="true"> | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
bool woltlab_addUser ( username, email, password ) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
==Required Arguments== | ==Required Arguments== | ||
*''' | *'''username''': The username of the player you want to add | ||
*'''email''': His e-mail address | |||
*'''password''': His password (encrypted) | |||
==Returns== | ==Returns== | ||
Returns ''' | Returns '''true''' if the user got created or '''false''' | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
-- TODO | -- TODO | ||
Line 101: | Line 105: | ||
</section> | </section> | ||
=== | ====woltlab_userExists==== | ||
<section name="Server" class="server" show="true"> | <section name="Server" class="server" show="true"> | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
bool woltlab_userExists ( username ) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
==Required Arguments== | ==Required Arguments== | ||
*''' | *'''username''': The username of the player you want to check | ||
==Returns== | ==Returns== | ||
Returns ''' | Returns '''true''' or '''false''' | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
-- TODO | -- TODO | ||
Line 119: | Line 123: | ||
</section> | </section> | ||
=== | ===Board-Functions=== | ||
====woltlab_getBoardID==== | |||
<section name="Server" class="server" show="true"> | <section name="Server" class="server" show="true"> | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
int woltlab_getBoardID ( title ) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
==Required Arguments== | ==Required Arguments== | ||
*''' | *'''title''': The title of the board whose ID you want to get | ||
==Returns== | ==Returns== | ||
Returns ''' | Returns '''int ID''' or '''false''' if the board does not exist | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
-- TODO | -- TODO | ||
Line 144: | Line 142: | ||
</section> | </section> | ||
=== | ====woltlab_getBoardTitle==== | ||
<section name="Server" class="server" show="true"> | <section name="Server" class="server" show="true"> | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
string woltlab_getBoardTitle ( id ) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
==Required Arguments== | ==Required Arguments== | ||
*''' | *'''id''': The ID of the board whose title you want to get | ||
==Returns== | ==Returns== | ||
Returns ''' | Returns '''string title''' or '''false''' if the board does not exist | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
-- TODO | -- TODO | ||
Line 162: | Line 160: | ||
</section> | </section> | ||
=== | ====woltlab_addThread==== | ||
<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_addThread ( username, boardID, prefix, head, description, [registered] ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==Required Arguments== | ==Required Arguments== | ||
*'''username''': The username of the player | *'''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== | ||
Returns '''true''' if the | Returns '''true''' if the thread got created or '''false''' | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
-- TODO | -- TODO | ||
Line 182: | Line 185: | ||
</section> | </section> | ||
===woltlab_groupExists=== | ===Group-Functions=== | ||
====woltlab_groupExists==== | |||
<section name="Server" class="server" show="true"> | <section name="Server" class="server" show="true"> | ||
==Syntax== | ==Syntax== | ||
Line 200: | Line 204: | ||
</section> | </section> | ||
===woltlab_isUserInGroup=== | ====woltlab_isUserInGroup==== | ||
<section name="Server" class="server" show="true"> | <section name="Server" class="server" show="true"> | ||
==Syntax== | ==Syntax== | ||
Line 219: | Line 223: | ||
</section> | </section> | ||
===woltlab_getGroupID=== | ====woltlab_getGroupID==== | ||
<section name="Server" class="server" show="true"> | <section name="Server" class="server" show="true"> | ||
==Syntax== | ==Syntax== | ||
Line 237: | Line 241: | ||
</section> | </section> | ||
===woltlab_getGroupTitle=== | ====woltlab_getGroupTitle==== | ||
<section name="Server" class="server" show="true"> | <section name="Server" class="server" show="true"> | ||
==Syntax== | ==Syntax== | ||
Line 255: | Line 259: | ||
</section> | </section> | ||
===woltlab_addUserToGroup=== | ====woltlab_addUserToGroup==== | ||
<section name="Server" class="server" show="true"> | <section name="Server" class="server" show="true"> | ||
==Syntax== | ==Syntax== | ||
Line 274: | Line 278: | ||
</section> | </section> | ||
===woltlab_removeUserFromGroup=== | ====woltlab_removeUserFromGroup==== | ||
<section name="Server" class="server" show="true"> | <section name="Server" class="server" show="true"> | ||
==Syntax== | ==Syntax== |
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