void ban(
[int
$time = 0]
)
|
|
Parameters:
|
int |
$time: |
Time for time until expires (0 - forever). |
API Tags:
| Deprecated: | 0.1.5 Use OTS_AccountBan class. |
| Access: | public |
Information Tags:
| Version: | 0.1.5 |
| Version: | 0.0.1 |
| Since: | 0.0.5 |
| Throws: | PDOException On PDO operation error. |
Blocks account.
Blocks account.
This method only updates object state. To save changes in database you need to use save() method to flush changed to database.
API Tags:
Information Tags:
Returns number of player within.
Returns number of player within.
API Tags:
| Return: | Count of players. |
| Access: | public |
Information Tags:
| Version: | 0.0.5 |
| Version: | 0.0.1 |
| Throws: | E_OTS_NotLoaded If account is not loaded. |
| Since: | 0.0.5 |
| Throws: | PDOException On PDO operation error. |
Implementation of:
- Countable::count
int create(
[int
$min = 1], [int
$max = 9999999], [string
$name = null]
)
|
|
Creates new account.
Creates new account.
Create new account in given range (1 - 9999999 by default).
Note: If account name won't be speciffied random will be created.
Note: Since 0.0.3 version this method doesn't require buffered queries.
Note: Since 0.1.5 version you should use createNamed() method since OTServ now uses account names.
Note: Since 0.1.1 version this method throws E_OTS_Generic exceptions instead of general Exception class objects. Since all exception classes are child classes of Exception class so your old code will still handle all exceptions.
Note: Since 0.1.5 version this method no longer creates account as blocked.
Parameters:
|
int |
$min: |
Minimum number. |
|
int |
$max: |
Maximum number. |
|
string |
$name: |
Account name. |
API Tags:
| Return: | Created account number. |
| Deprecated: | 0.1.5 Use createNamed(). |
| Access: | public |
Information Tags:
| Version: | 0.1.5 |
| Version: | 0.0.1 |
| Throws: | PDOException On PDO operation error. |
| Throws: | E_OTS_Generic When there are no free account numbers. |
int createEx(
OTS_Group
$group, [int
$min = 1], [int
$max = 9999999]
)
|
|
Parameters:
|
OTS_Group |
$group: |
Group to be assigned to account. |
|
int |
$min: |
Minimum number. |
|
int |
$max: |
Maximum number. |
API Tags:
| Return: | Created account number. |
| Deprecated: | 0.0.6 There is no more group_id field in database, use create(). |
| Access: | public |
Information Tags:
| Version: | 0.0.6 |
| Version: | 0.0.1 |
| Since: | 0.0.4 |
string createNamed(
[string
$name = null]
)
|
|
Creates new account.
Creates new account.
This method creates new account with given name. Account number is generated automaticly and saved into ID field.
If you won't specify account name then random one will be generated.
If you use own account name then it will be returned after success, and exception will be generated if it will be alredy used as name will be simply used in query with account create attempt.
Parameters:
|
string |
$name: |
Account name. |
API Tags:
| Return: | Account name. |
| Access: | public |
| Example: | create.php |
Information Tags:
| Tutorial: | Accounts |
| Version: | 0.0.1 |
| Version: | 0.1.5 |
| Throws: | PDOException On PDO operation error. |
| Since: | 0.1.5 |
Deletes account.
Deletes account.
This method physicly deletes account from database! To set deleted flag use setDeleted() method.
API Tags:
Information Tags:
| Version: | 0.0.5 |
| Version: | 0.0.1 |
| Throws: | E_OTS_NotLoaded If account is not loaded. |
| Since: | 0.0.5 |
| Throws: | PDOException On PDO operation error. |
void find(
string
$name
)
|
|
Loads account by it's name.
Loads account by it's name.
Note: Since 0.1.5 version this method loads account by it's name not by e-mail address. To find account by it's e-mail address use findByEMail() method.
Parameters:
|
string |
$name: |
Account's name. |
API Tags:
Information Tags:
| Version: | 0.1.5 |
| Version: | 0.0.1 |
| Throws: | PDOException On PDO operation error. |
| Since: | 0.0.2 |
Redefinition of:
- OTS_Row_DAO::find()
- Loads row by it's name.
void findByEMail(
string
$email
)
|
|
Loads account by it's e-mail address.
Loads account by it's e-mail address.
Parameters:
|
string |
$email: |
Account's e-mail address. |
API Tags:
Information Tags:
| Version: | 0.1.5 |
| Version: | 0.0.1 |
| Throws: | PDOException On PDO operation error. |
| Since: | 0.1.5 |
Checks highest access level of account.
Checks highest access level of account.
API Tags:
| Return: | Access level (highest access level of all characters). |
| Access: | public |
Information Tags:
| Version: | 0.0.1 |
| Throws: | PDOException On PDO operation error. |
string getCustomField(
string
$field
)
|
|
Reads custom field.
Reads custom field.
Reads field by it's name. Can read any field of given record that exists in database.
Note: You should use this method only for fields that are not provided in standard setters/getters (SVN fields). This method runs SQL query each time you call it so it highly overloads used resources.
Parameters:
|
string |
$field: |
Field name. |
API Tags:
| Return: | Field value. |
| Access: | public |
Information Tags:
| Version: | 0.0.5 |
| Version: | 0.0.1 |
| Throws: | E_OTS_NotLoaded If account is not loaded. |
| Since: | 0.0.3 |
| Throws: | PDOException On PDO operation error. |
E-mail address.
E-mail address.
Note: Since 0.0.3 version this method throws E_OTS_NotLoaded exception instead of triggering E_USER_WARNING.
API Tags:
| Return: | E-mail. |
| Access: | public |
Information Tags:
| Version: | 0.0.3 |
| Version: | 0.0.1 |
| Throws: | E_OTS_NotLoaded If account is not loaded. |
API Tags:
| Return: | Group of which current account is member (currently random group). |
| Deprecated: | 0.0.6 There is no more group_id field in database. |
| Access: | public |
Information Tags:
| Version: | 0.1.0 |
| Version: | 0.0.1 |
| Since: | 0.0.4 |
| Throws: | E_OTS_NotLoaded If account is not loaded. |
Checks highest access level of account in given guild.
Checks highest access level of account in given guild.
Parameters:
|
OTS_Guild |
$guild: |
Guild in which access should be checked. |
API Tags:
| Return: | Access level (highest access level of all characters). |
| Access: | public |
Information Tags:
| Version: | 0.0.1 |
| Throws: | PDOException On PDO operation error. |
Account number.
Account number.
Note: Since 0.0.3 version this method throws E_OTS_NotLoaded exception instead of triggering E_USER_WARNING.
API Tags:
| Return: | Account number. |
| Access: | public |
Information Tags:
| Version: | 0.0.3 |
| Version: | 0.0.1 |
| Throws: | E_OTS_NotLoaded If account is not loaded. |
Returns players iterator.
Returns players iterator.
There is no need to implement entire Iterator interface since we have players list class for it.
API Tags:
| Return: | List of players. |
| Access: | public |
Information Tags:
| Version: | 0.0.5 |
| Version: | 0.0.1 |
| Throws: | E_OTS_NotLoaded If account is not loaded. |
| Since: | 0.0.5 |
| Throws: | PDOException On PDO operation error. |
Implementation of:
- IteratorAggregate::getIterator
Name.
Name.
API Tags:
| Return: | Name. |
| Access: | public |
Information Tags:
| Version: | 0.1.5 |
| Version: | 0.0.1 |
| Throws: | E_OTS_NotLoaded If account is not loaded. |
| Since: | 0.1.5 |
API Tags:
| Return: | PACC days. |
| Deprecated: | 0.0.3 There is no more premdays field in accounts table. |
| Access: | public |
Information Tags:
| Version: | 0.0.4 |
| Version: | 0.0.1 |
| Throws: | E_OTS_NotLoaded If account is not loaded. |
Account's password.
Account's password.
Doesn't matter what password hashing mechanism is used by OTServ - this method will just return RAW database content. It is not possible to "decrypt" hashed strings, so it even wouldn't be possible to return real password string.
Note: Since 0.0.3 version this method throws E_OTS_NotLoaded exception instead of triggering E_USER_WARNING.
API Tags:
| Return: | Password. |
| Access: | public |
Information Tags:
| Version: | 0.0.3 |
| Version: | 0.0.1 |
| Throws: | E_OTS_NotLoaded If account is not loaded. |
API Tags:
| Return: | Array of OTS_Player objects from given account. |
| Deprecated: | 0.0.5 Use getPlayersList(). |
| Access: | public |
Information Tags:
| Version: | 0.1.0 |
| Version: | 0.0.1 |
| Throws: | E_OTS_NotLoaded If account is not loaded. |
List of characters on account.
List of characters on account.
In difference to getPlayers() method this method returns filtered OTS_Players_List object instead of array of OTS_Player objects. It is more effective since OTS_Player_List doesn't perform all rows loading at once.
Note: Returned object is only prepared, but not initialised. When using as parameter in foreach loop it doesn't matter since it will return it's iterator, but if you will wan't to execute direct operation on that object you will need to call rewind() method first.
API Tags:
| Return: | List of players from current account. |
| Access: | public |
Information Tags:
| Version: | 0.1.4 |
| Version: | 0.0.1 |
| Throws: | E_OTS_NotLoaded If account is not loaded. |
| Since: | 0.0.5 |
Account's Premium Account expiration timestamp.
Account's Premium Account expiration timestamp.
API Tags:
| Return: | Account PACC expiration timestamp. |
| Access: | public |
Information Tags:
| Version: | 0.1.5 |
| Version: | 0.0.1 |
| Throws: | E_OTS_NotLoaded If account is not loaded. |
| Since: | 0.1.5 |
API Tags:
| Return: | True if account is banned, false otherwise. |
| Deprecated: | 0.1.5 Use OTS_AccountBan class. |
| Access: | public |
Information Tags:
| Version: | 0.1.5 |
| Version: | 0.0.1 |
| Since: | 0.0.5 |
| Throws: | PDOException On PDO operation error. |
Checks if account is blocked.
Checks if account is blocked.
Note: Since 0.0.3 version this method throws E_OTS_NotLoaded exception instead of triggering E_USER_WARNING.
API Tags:
| Return: | Blocked state. |
| Access: | public |
Information Tags:
| Version: | 0.0.3 |
| Version: | 0.0.1 |
| Throws: | E_OTS_NotLoaded If account is not loaded. |
Checks if account is deleted (by flag setting).
Checks if account is deleted (by flag setting).
API Tags:
| Return: | Flag state. |
| Access: | public |
Information Tags:
| Version: | 0.1.5 |
| Version: | 0.0.1 |
| Throws: | E_OTS_NotLoaded If account is not loaded. |
| Since: | 0.1.5 |
Checks if object is loaded.
Checks if object is loaded.
API Tags:
| Return: | Load state. |
| Access: | public |
Information Tags:
Checks if account is warned.
Checks if account is warned.
API Tags:
| Return: | Flag state. |
| Access: | public |
Information Tags:
| Version: | 0.1.5 |
| Version: | 0.0.1 |
| Throws: | E_OTS_NotLoaded If account is not loaded. |
| Since: | 0.1.5 |
Loads account with given number.
Loads account with given number.
Parameters:
API Tags:
Information Tags:
| Version: | 0.0.6 |
| Version: | 0.0.1 |
| Throws: | PDOException On PDO operation error. |
Redefinition of:
- OTS_Row_DAO::load()
- Loads row by it's ID.
Updates account in database.
Updates account in database.
Unlike other DAO objects account can't be saved without ID being set. It means that you can't just save unexisting account to automaticly create it. First you have to create record by using OTS_Account::createName()
Note: Since 0.0.3 version this method throws E_OTS_NotLoaded exception instead of triggering E_USER_WARNING.
API Tags:
Information Tags:
| Version: | 0.1.5 |
| Version: | 0.0.1 |
| Throws: | E_OTS_NotLoaded If account doesn't have ID assigned. |
| Throws: | PDOException On PDO operation error. |
void setCustomField(
string
$field, mixed
$value
)
|
|
Writes custom field.
Writes custom field.
Write field by it's name. Can write any field of given record that exists in database.
Note: You should use this method only for fields that are not provided in standard setters/getters (SVN fields). This method runs SQL query each time you call it so it highly overloads used resources.
Note: Make sure that you pass $value argument of correct type. This method determinates whether to quote field name. It is safe - it makes you sure that no unproper queries that could lead to SQL injection will be executed, but it can make your code working wrong way. For example: $object->setCustomField('foo', '1'); will quote 1 as as string ('1') instead of passing it as a integer.
Parameters:
|
string |
$field: |
Field name. |
|
mixed |
$value: |
Field value. |
API Tags:
Information Tags:
| Version: | 0.0.5 |
| Version: | 0.0.1 |
| Throws: | E_OTS_NotLoaded If account is not loaded. |
| Since: | 0.0.3 |
| Throws: | PDOException On PDO operation error. |
Deletes account (only by setting flag state, not physicly).
Deletes account (only by setting flag state, not physicly).
This method only updates object state. To save changes in database you need to use save() method to flush changed to database.
API Tags:
Information Tags:
| Version: | 0.1.5 |
| Version: | 0.0.1 |
| Since: | 0.1.5 |
void setEMail(
string
$email
)
|
|
Sets account's email.
Sets account's email.
This method only updates object state. To save changes in database you need to use save() method to flush changed to database.
Parameters:
|
string |
$email: |
E-mail address. |
API Tags:
Information Tags:
Parameters:
API Tags:
| Deprecated: | 0.0.6 There is no more group_id field in database. |
| Access: | public |
Information Tags:
| Version: | 0.0.6 |
| Version: | 0.0.1 |
void setName(
string
$name
)
|
|
Sets account's name.
Sets account's name.
This method only updates object state. To save changes in database you need to use save() method to flush changed to database.
Parameters:
|
string |
$name: |
Account name. |
API Tags:
Information Tags:
| Version: | 0.1.5 |
| Version: | 0.0.1 |
| Since: | 0.1.5 |
void setPACCDays(
$premdays, int
$pacc
)
|
|
Parameters:
|
int |
$pacc: |
PACC days. |
|
|
$premdays: |
|
API Tags:
| Deprecated: | 0.0.3 There is no more premdays field in accounts table. |
| Access: | public |
Information Tags:
| Version: | 0.0.4 |
| Version: | 0.0.1 |
void setPassword(
string
$password
)
|
|
Sets account's password.
Sets account's password.
This method only updates object state. To save changes in database you need to use save() method to flush changed to database.
Remember that this method just sets database field's content. It doesn't apply any hashing/encryption so if OTServ uses hashing for passwords you have to apply it by yourself before passing string to this method.
Parameters:
|
string |
$password: |
Password. |
API Tags:
Information Tags:
void setPremiumEnd(
int
$premend
)
|
|
Sets account's Premium Account expiration timestamp.
Sets account's Premium Account expiration timestamp.
This method only updates object state. To save changes in database you need to use save() method to flush changed to database.
Parameters:
|
int |
$premend: |
PACC expiration timestamp. |
API Tags:
Information Tags:
| Version: | 0.1.5 |
| Version: | 0.0.1 |
| Since: | 0.1.5 |
API Tags:
| Deprecated: | 0.1.5 Use OTS_AccountBan class. |
| Access: | public |
Information Tags:
| Version: | 0.1.5 |
| Version: | 0.0.1 |
| Since: | 0.0.5 |
| Throws: | PDOException On PDO operation error. |
Unblocks account.
Unblocks account.
This method only updates object state. To save changes in database you need to use save() method to flush changed to database.
API Tags:
Information Tags:
Unsets account's deleted flag.
Unsets account's deleted flag.
This method only updates object state. To save changes in database you need to use save() method to flush changed to database.
API Tags:
Information Tags:
| Version: | 0.1.5 |
| Version: | 0.0.1 |
| Since: | 0.1.5 |
Unwarns account.
Unwarns account.
This method only updates object state. To save changes in database you need to use save() method to flush changed to database.
API Tags:
Information Tags:
| Version: | 0.1.5 |
| Version: | 0.0.1 |
| Since: | 0.1.5 |
Warns account.
Warns account.
This method only updates object state. To save changes in database you need to use save() method to flush changed to database.
API Tags:
Information Tags:
| Version: | 0.1.5 |
| Version: | 0.0.1 |
| Since: | 0.1.5 |
mixed __get(
string
$name
)
|
|
Magic PHP5 method.
Magic PHP5 method.
Parameters:
|
string |
$name: |
Property name. |
API Tags:
| Return: | Property value. |
| Access: | public |
Information Tags:
| Version: | 0.1.5 |
| Version: | 0.0.1 |
| Throws: | OutOfBoundsException For non-supported properties. |
| Throws: | E_OTS_NotLoaded If account is not loaded. |
| Throws: | PDOException On PDO operation error. |
| Since: | 0.1.0 |
void __set(
string
$name, mixed
$value
)
|
|
Magic PHP5 method.
Magic PHP5 method.
Parameters:
|
string |
$name: |
Property name. |
|
mixed |
$value: |
Property value. |
API Tags:
Information Tags:
| Version: | 0.1.5 |
| Version: | 0.0.1 |
| Throws: | OutOfBoundsException For non-supported properties. |
| Throws: | E_OTS_NotLoaded If account is not loaded. |
| Throws: | PDOException On PDO operation error. |
| Since: | 0.1.0 |
Returns string representation of object.
Returns string representation of object.
If any display driver is currently loaded then it uses it's method. Otherwise just returns account number.
API Tags:
| Return: | String representation of object. |
| Access: | public |
Information Tags:
| Version: | 0.1.3 |
| Version: | 0.0.1 |
| Since: | 0.1.0 |