mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-27 01:39:22 +02:00
Use $db->exec where appropriate
May bring some performance boost (little, but still)
This commit is contained in:
parent
82e64559a8
commit
2dbf189f43
@ -329,15 +329,15 @@ function delete_player($name)
|
|||||||
$player = new OTS_Player();
|
$player = new OTS_Player();
|
||||||
$player->find($name);
|
$player->find($name);
|
||||||
if($player->isLoaded()) {
|
if($player->isLoaded()) {
|
||||||
try { $db->query("DELETE FROM player_skills WHERE player_id = '".$player->getId()."';"); } catch(PDOException $error) {}
|
try { $db->exec("DELETE FROM player_skills WHERE player_id = '".$player->getId()."';"); } catch(PDOException $error) {}
|
||||||
try { $db->query("DELETE FROM guild_invites WHERE player_id = '".$player->getId()."';"); } catch(PDOException $error) {}
|
try { $db->exec("DELETE FROM guild_invites WHERE player_id = '".$player->getId()."';"); } catch(PDOException $error) {}
|
||||||
try { $db->query("DELETE FROM player_items WHERE player_id = '".$player->getId()."';"); } catch(PDOException $error) {}
|
try { $db->exec("DELETE FROM player_items WHERE player_id = '".$player->getId()."';"); } catch(PDOException $error) {}
|
||||||
try { $db->query("DELETE FROM player_depotitems WHERE player_id = '".$player->getId()."';"); } catch(PDOException $error) {}
|
try { $db->exec("DELETE FROM player_depotitems WHERE player_id = '".$player->getId()."';"); } catch(PDOException $error) {}
|
||||||
try { $db->query("DELETE FROM player_spells WHERE player_id = '".$player->getId()."';"); } catch(PDOException $error) {}
|
try { $db->exec("DELETE FROM player_spells WHERE player_id = '".$player->getId()."';"); } catch(PDOException $error) {}
|
||||||
try { $db->query("DELETE FROM player_storage WHERE player_id = '".$player->getId()."';"); } catch(PDOException $error) {}
|
try { $db->exec("DELETE FROM player_storage WHERE player_id = '".$player->getId()."';"); } catch(PDOException $error) {}
|
||||||
try { $db->query("DELETE FROM player_viplist WHERE player_id = '".$player->getId()."';"); } catch(PDOException $error) {}
|
try { $db->exec("DELETE FROM player_viplist WHERE player_id = '".$player->getId()."';"); } catch(PDOException $error) {}
|
||||||
try { $db->query("DELETE FROM player_deaths WHERE player_id = '".$player->getId()."';"); } catch(PDOException $error) {}
|
try { $db->exec("DELETE FROM player_deaths WHERE player_id = '".$player->getId()."';"); } catch(PDOException $error) {}
|
||||||
try { $db->query("DELETE FROM player_deaths WHERE killed_by = '".$player->getId()."';"); } catch(PDOException $error) {}
|
try { $db->exec("DELETE FROM player_deaths WHERE killed_by = '".$player->getId()."';"); } catch(PDOException $error) {}
|
||||||
$rank = $player->getRank();
|
$rank = $player->getRank();
|
||||||
if($rank->isLoaded()) {
|
if($rank->isLoaded()) {
|
||||||
$guild = $rank->getGuild();
|
$guild = $rank->getGuild();
|
||||||
|
@ -90,7 +90,7 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
}
|
}
|
||||||
|
|
||||||
// saves blank account info
|
// saves blank account info
|
||||||
$this->db->query('INSERT INTO ' . $this->db->tableName('accounts') . ' (' . $this->db->fieldName('name') . ', ' . $this->db->fieldName('password') . ', ' . $this->db->fieldName('email') . ') VALUES (' . $this->db->quote($name) . ', \'\', \'\')');
|
$this->db->exec('INSERT INTO ' . $this->db->tableName('accounts') . ' (' . $this->db->fieldName('name') . ', ' . $this->db->fieldName('password') . ', ' . $this->db->fieldName('email') . ') VALUES (' . $this->db->quote($name) . ', \'\', \'\')');
|
||||||
|
|
||||||
// reads created account's ID
|
// reads created account's ID
|
||||||
$this->data['id'] = $this->db->lastInsertId();
|
$this->data['id'] = $this->db->lastInsertId();
|
||||||
@ -138,7 +138,7 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
public function create($name = NULL, $id = NULL)
|
public function create($name = NULL, $id = NULL)
|
||||||
{
|
{
|
||||||
// saves blank account info
|
// saves blank account info
|
||||||
$this->db->query('INSERT INTO `accounts` (' . (isset($id) ? '`id`,' : '') . (isset($name) ? '`name`,' : '') . '`password`, `email`, `created`) VALUES (' . (isset($id) ? $id . ',' : '') . (isset($name) ? $this->db->quote($name) . ',' : '') . ' \'\', \'\',' . time() . ')');
|
$this->db->exec('INSERT INTO `accounts` (' . (isset($id) ? '`id`,' : '') . (isset($name) ? '`name`,' : '') . '`password`, `email`, `created`) VALUES (' . (isset($id) ? $id . ',' : '') . (isset($name) ? $this->db->quote($name) . ',' : '') . ' \'\', \'\',' . time() . ')');
|
||||||
|
|
||||||
if(isset($name))
|
if(isset($name))
|
||||||
$this->data['name'] = $name;
|
$this->data['name'] = $name;
|
||||||
@ -265,7 +265,7 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
}
|
}
|
||||||
|
|
||||||
// UPDATE query on database
|
// UPDATE query on database
|
||||||
$this->db->query('UPDATE `accounts` SET ' . ($this->db->hasColumn('accounts', 'name') ? '`name` = ' . $this->db->quote($this->data['name']) . ',' : '') . '`password` = ' . $this->db->quote($this->data['password']) . ', `email` = ' . $this->db->quote($this->data['email']) . ', `blocked` = ' . (int) $this->data['blocked'] . ', `rlname` = ' . $this->db->quote($this->data['rlname']) . ', `location` = ' . $this->db->quote($this->data['location']) . ', `country` = ' . $this->db->quote($this->data['country']) . ', `web_flags` = ' . (int) $this->data['web_flags'] . ', ' . ($this->db->hasColumn('accounts', 'premdays') ? '`premdays` = ' . (int) $this->data['premdays'] . ',' : '') . '`' . $field . '` = ' . (int) $this->data[$field] . ' WHERE `id` = ' . $this->data['id']);
|
$this->db->exec('UPDATE `accounts` SET ' . ($this->db->hasColumn('accounts', 'name') ? '`name` = ' . $this->db->quote($this->data['name']) . ',' : '') . '`password` = ' . $this->db->quote($this->data['password']) . ', `email` = ' . $this->db->quote($this->data['email']) . ', `blocked` = ' . (int) $this->data['blocked'] . ', `rlname` = ' . $this->db->quote($this->data['rlname']) . ', `location` = ' . $this->db->quote($this->data['location']) . ', `country` = ' . $this->db->quote($this->data['country']) . ', `web_flags` = ' . (int) $this->data['web_flags'] . ', ' . ($this->db->hasColumn('accounts', 'premdays') ? '`premdays` = ' . (int) $this->data['premdays'] . ',' : '') . '`' . $field . '` = ' . (int) $this->data[$field] . ' WHERE `id` = ' . $this->data['id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -658,7 +658,7 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
{
|
{
|
||||||
$value = $this->db->quote($value);
|
$value = $this->db->quote($value);
|
||||||
}
|
}
|
||||||
$this->db->query('UPDATE ' . $this->db->tableName('accounts') . ' SET ' . $this->db->fieldName($field) . ' = ' . $value . ' WHERE ' . $this->db->fieldName('id') . ' = ' . $this->data['id']);
|
$this->db->exec('UPDATE ' . $this->db->tableName('accounts') . ' SET ' . $this->db->fieldName($field) . ' = ' . $value . ' WHERE ' . $this->db->fieldName('id') . ' = ' . $this->data['id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -847,7 +847,7 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
}
|
}
|
||||||
|
|
||||||
// deletes row from database
|
// deletes row from database
|
||||||
$this->db->query('DELETE FROM ' . $this->db->tableName('accounts') . ' WHERE ' . $this->db->fieldName('id') . ' = ' . $this->data['id']);
|
$this->db->exec('DELETE FROM ' . $this->db->tableName('accounts') . ' WHERE ' . $this->db->fieldName('id') . ' = ' . $this->data['id']);
|
||||||
|
|
||||||
// resets object handle
|
// resets object handle
|
||||||
unset($this->data['id']);
|
unset($this->data['id']);
|
||||||
@ -955,7 +955,7 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
$ip = '';
|
$ip = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->db->query('INSERT INTO `' . TABLE_PREFIX . 'account_actions` (`account_id`, `ip`, `ipv6`, `date`, `action`) VALUES (' . $this->db->quote($this->getId()).', ' . ($ip == '' ? '0' : $this->db->quote(ip2long($ip))) . ', (' . ($ipv6 == '0' ? $this->db->quote('') : $this->db->quote(inet_pton($ipv6))) . '), UNIX_TIMESTAMP(NOW()), ' . $this->db->quote($action).')');
|
return $this->db->exec('INSERT INTO `' . TABLE_PREFIX . 'account_actions` (`account_id`, `ip`, `ipv6`, `date`, `action`) VALUES (' . $this->db->quote($this->getId()).', ' . ($ip == '' ? '0' : $this->db->quote(ip2long($ip))) . ', (' . ($ipv6 == '0' ? $this->db->quote('') : $this->db->quote(inet_pton($ipv6))) . '), UNIX_TIMESTAMP(NOW()), ' . $this->db->quote($action).')');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getActionsLog($limit1, $limit2)
|
public function getActionsLog($limit1, $limit2)
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* List of accounts.
|
* List of accounts.
|
||||||
*
|
*
|
||||||
* @package POT
|
* @package POT
|
||||||
* @version 0.1.3
|
* @version 0.1.3
|
||||||
*/
|
*/
|
||||||
@ -23,16 +23,16 @@ class OTS_Accounts_List extends OTS_Base_List
|
|||||||
*/
|
*/
|
||||||
public function deleteAccount(OTS_Account $account)
|
public function deleteAccount(OTS_Account $account)
|
||||||
{
|
{
|
||||||
$this->db->query('DELETE FROM ' . $this->db->tableName('account') . ' WHERE ' . $this->db->fieldName('id') . ' = ' . $account->getId() );
|
$this->db->exec('DELETE FROM ' . $this->db->tableName('account') . ' WHERE ' . $this->db->fieldName('id') . ' = ' . $account->getId() );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets list parameters.
|
* Sets list parameters.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* This method is called at object creation.
|
* This method is called at object creation.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @version 0.0.5
|
* @version 0.0.5
|
||||||
* @since 0.0.5
|
* @since 0.0.5
|
||||||
*/
|
*/
|
||||||
@ -44,11 +44,11 @@ class OTS_Accounts_List extends OTS_Base_List
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns string representation of object.
|
* Returns string representation of object.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* If any display driver is currently loaded then it uses it's method.
|
* If any display driver is currently loaded then it uses it's method.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @version 0.1.3
|
* @version 0.1.3
|
||||||
* @since 0.1.0
|
* @since 0.1.0
|
||||||
* @return string String representation of object.
|
* @return string String representation of object.
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* OTServ ban generic class. For particular purpose use {@link OTS_AccountBan OTS_AccountBan}, {@link OTS_PlayerBan OTS_PlayerBan} or {@link OTS_IPBan OTS_IPBan} classes respectively.
|
* OTServ ban generic class. For particular purpose use {@link OTS_AccountBan OTS_AccountBan}, {@link OTS_PlayerBan OTS_PlayerBan} or {@link OTS_IPBan OTS_IPBan} classes respectively.
|
||||||
*
|
*
|
||||||
* @package POT
|
* @package POT
|
||||||
* @version 0.1.5
|
* @version 0.1.5
|
||||||
* @since 0.1.5
|
* @since 0.1.5
|
||||||
@ -30,7 +30,7 @@ abstract class OTS_Ban extends OTS_Row_DAO
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Ban data.
|
* Ban data.
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
* @version 0.1.5
|
* @version 0.1.5
|
||||||
* @since 0.1.5
|
* @since 0.1.5
|
||||||
@ -39,7 +39,7 @@ abstract class OTS_Ban extends OTS_Row_DAO
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads ban with given id.
|
* Loads ban with given id.
|
||||||
*
|
*
|
||||||
* @version 0.1.5
|
* @version 0.1.5
|
||||||
* @since 0.1.5
|
* @since 0.1.5
|
||||||
* @param int $id Ban ID.
|
* @param int $id Ban ID.
|
||||||
@ -53,7 +53,7 @@ abstract class OTS_Ban extends OTS_Row_DAO
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if object is loaded.
|
* Checks if object is loaded.
|
||||||
*
|
*
|
||||||
* @version 0.1.5
|
* @version 0.1.5
|
||||||
* @since 0.1.5
|
* @since 0.1.5
|
||||||
* @return bool Load state.
|
* @return bool Load state.
|
||||||
@ -65,11 +65,11 @@ abstract class OTS_Ban extends OTS_Row_DAO
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Saves ban in database.
|
* Saves ban in database.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* If object is not loaded to represent any existing ban it will create new row for it.
|
* If object is not loaded to represent any existing ban it will create new row for it.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @version 0.1.5
|
* @version 0.1.5
|
||||||
* @since 0.1.5
|
* @since 0.1.5
|
||||||
* @throws PDOException On PDO operation error.
|
* @throws PDOException On PDO operation error.
|
||||||
@ -80,13 +80,13 @@ abstract class OTS_Ban extends OTS_Row_DAO
|
|||||||
if( isset($this->data['id']) )
|
if( isset($this->data['id']) )
|
||||||
{
|
{
|
||||||
// UPDATE query on database
|
// UPDATE query on database
|
||||||
$this->db->query('UPDATE ' . $this->db->tableName('bans') . ' SET ' . $this->db->fieldName('type') . ' = ' . $this->data['type'] . ', ' . $this->db->fieldName('value') . ' = ' . $this->data['value'] . ', ' . $this->db->fieldName('param') . ' = ' . $this->data['param'] . ', ' . $this->db->fieldName('active') . ' = ' . (int) $this->data['active'] . ', ' . $this->db->fieldName('expires') . ' = ' . $this->data['expires'] . ', ' . $this->db->fieldName('added') . ' = ' . $this->data['added'] . ', ' . $this->db->fieldName('admin_id') . ' = ' . $this->data['admin_id'] . ', ' . $this->db->fieldName('comment') . ' = ' . $this->db->quote($this->data['comment']) . ', ' . $this->db->fieldName('reason') . ' = ' . $this->data['reason'] . ' WHERE ' . $this->db->fieldName('id') . ' = ' . $this->data['id']);
|
$this->db->exec('UPDATE ' . $this->db->tableName('bans') . ' SET ' . $this->db->fieldName('type') . ' = ' . $this->data['type'] . ', ' . $this->db->fieldName('value') . ' = ' . $this->data['value'] . ', ' . $this->db->fieldName('param') . ' = ' . $this->data['param'] . ', ' . $this->db->fieldName('active') . ' = ' . (int) $this->data['active'] . ', ' . $this->db->fieldName('expires') . ' = ' . $this->data['expires'] . ', ' . $this->db->fieldName('added') . ' = ' . $this->data['added'] . ', ' . $this->db->fieldName('admin_id') . ' = ' . $this->data['admin_id'] . ', ' . $this->db->fieldName('comment') . ' = ' . $this->db->quote($this->data['comment']) . ', ' . $this->db->fieldName('reason') . ' = ' . $this->data['reason'] . ' WHERE ' . $this->db->fieldName('id') . ' = ' . $this->data['id']);
|
||||||
}
|
}
|
||||||
// creates new ban
|
// creates new ban
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// INSERT query on database
|
// INSERT query on database
|
||||||
$this->db->query('INSERT INTO ' . $this->db->tableName('bans') . ' (' . $this->db->fieldName('type') . ', ' . $this->db->fieldName('value') . ', ' . $this->db->fieldName('param') . ', ' . $this->db->fieldName('active') . ', ' . $this->db->fieldName('expires') . ', ' . $this->db->fieldName('added') . ', ' . $this->db->fieldName('admin_id') . ', ' . $this->db->fieldName('comment') . ', ' . $this->db->fieldName('reason') . ') VALUES (' . $this->data['type'] . ', ' . $this->data['value'] . ', ' . $this->data['param'] . ', ' . (int) $this->data['active'] . ', ' . $this->data['expires'] . ', ' . $this->data['added'] . ', ' . $this->data['admin_id'] . ', ' . $this->db->quote($this->data['comment']) . ', ' . $this->data['reason'] . ')');
|
$this->db->exec('INSERT INTO ' . $this->db->tableName('bans') . ' (' . $this->db->fieldName('type') . ', ' . $this->db->fieldName('value') . ', ' . $this->db->fieldName('param') . ', ' . $this->db->fieldName('active') . ', ' . $this->db->fieldName('expires') . ', ' . $this->db->fieldName('added') . ', ' . $this->db->fieldName('admin_id') . ', ' . $this->db->fieldName('comment') . ', ' . $this->db->fieldName('reason') . ') VALUES (' . $this->data['type'] . ', ' . $this->data['value'] . ', ' . $this->data['param'] . ', ' . (int) $this->data['active'] . ', ' . $this->data['expires'] . ', ' . $this->data['added'] . ', ' . $this->data['admin_id'] . ', ' . $this->db->quote($this->data['comment']) . ', ' . $this->data['reason'] . ')');
|
||||||
// ID of new ban
|
// ID of new ban
|
||||||
$this->data['id'] = $this->db->lastInsertId();
|
$this->data['id'] = $this->db->lastInsertId();
|
||||||
}
|
}
|
||||||
@ -94,7 +94,7 @@ abstract class OTS_Ban extends OTS_Row_DAO
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Ban ID.
|
* Ban ID.
|
||||||
*
|
*
|
||||||
* @version 0.1.5
|
* @version 0.1.5
|
||||||
* @since 0.1.5
|
* @since 0.1.5
|
||||||
* @return int Ban ID.
|
* @return int Ban ID.
|
||||||
@ -112,7 +112,7 @@ abstract class OTS_Ban extends OTS_Row_DAO
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes ban.
|
* Deletes ban.
|
||||||
*
|
*
|
||||||
* @version 0.1.5
|
* @version 0.1.5
|
||||||
* @since 0.1.5
|
* @since 0.1.5
|
||||||
* @throws E_OTS_NotLoaded If ban is not loaded.
|
* @throws E_OTS_NotLoaded If ban is not loaded.
|
||||||
@ -126,7 +126,7 @@ abstract class OTS_Ban extends OTS_Row_DAO
|
|||||||
}
|
}
|
||||||
|
|
||||||
// deletes row from database
|
// deletes row from database
|
||||||
$this->db->query('DELETE FROM ' . $this->db->tableName('bans') . ' WHERE ' . $this->db->fieldName('id') . ' = ' . $this->data['id']);
|
$this->db->exec('DELETE FROM ' . $this->db->tableName('bans') . ' WHERE ' . $this->db->fieldName('id') . ' = ' . $this->data['id']);
|
||||||
|
|
||||||
// resets object handle
|
// resets object handle
|
||||||
unset($this->data['id']);
|
unset($this->data['id']);
|
||||||
@ -134,7 +134,7 @@ abstract class OTS_Ban extends OTS_Row_DAO
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Banned target.
|
* Banned target.
|
||||||
*
|
*
|
||||||
* @version 0.1.5
|
* @version 0.1.5
|
||||||
* @since 0.1.5
|
* @since 0.1.5
|
||||||
* @return int Target identifier.
|
* @return int Target identifier.
|
||||||
@ -152,11 +152,11 @@ abstract class OTS_Ban extends OTS_Row_DAO
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets banned target.
|
* Sets banned target.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* This method only updates object state. To save changes in database you need to use {@link OTS_Ban::save() save() method} to flush changed to database.
|
* This method only updates object state. To save changes in database you need to use {@link OTS_Ban::save() save() method} to flush changed to database.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @version 0.1.5
|
* @version 0.1.5
|
||||||
* @since 0.1.5
|
* @since 0.1.5
|
||||||
* @param int $value Banned target identifier.
|
* @param int $value Banned target identifier.
|
||||||
@ -168,7 +168,7 @@ abstract class OTS_Ban extends OTS_Row_DAO
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Additional parameter.
|
* Additional parameter.
|
||||||
*
|
*
|
||||||
* @version 0.1.5
|
* @version 0.1.5
|
||||||
* @since 0.1.5
|
* @since 0.1.5
|
||||||
* @return int Parameter value (usualy used as IP mask).
|
* @return int Parameter value (usualy used as IP mask).
|
||||||
@ -186,11 +186,11 @@ abstract class OTS_Ban extends OTS_Row_DAO
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets additional parameter.
|
* Sets additional parameter.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* This method only updates object state. To save changes in database you need to use {@link OTS_Ban::save() save() method} to flush changed to database.
|
* This method only updates object state. To save changes in database you need to use {@link OTS_Ban::save() save() method} to flush changed to database.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @version 0.1.5
|
* @version 0.1.5
|
||||||
* @since 0.1.5
|
* @since 0.1.5
|
||||||
* @param int $param Parameter value (usualy used as IP mask).
|
* @param int $param Parameter value (usualy used as IP mask).
|
||||||
@ -202,7 +202,7 @@ abstract class OTS_Ban extends OTS_Row_DAO
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Activation state.
|
* Activation state.
|
||||||
*
|
*
|
||||||
* @version 0.1.5
|
* @version 0.1.5
|
||||||
* @since 0.1.5
|
* @since 0.1.5
|
||||||
* @return bool Is ban active.
|
* @return bool Is ban active.
|
||||||
@ -220,11 +220,11 @@ abstract class OTS_Ban extends OTS_Row_DAO
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Activates ban.
|
* Activates ban.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* This method only updates object state. To save changes in database you need to use {@link OTS_Ban::save() save() method} to flush changed to database.
|
* This method only updates object state. To save changes in database you need to use {@link OTS_Ban::save() save() method} to flush changed to database.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @version 0.1.5
|
* @version 0.1.5
|
||||||
* @since 0.1.5
|
* @since 0.1.5
|
||||||
*/
|
*/
|
||||||
@ -235,11 +235,11 @@ abstract class OTS_Ban extends OTS_Row_DAO
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Deactivates ban.
|
* Deactivates ban.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* This method only updates object state. To save changes in database you need to use {@link OTS_Ban::save() save() method} to flush changed to database.
|
* This method only updates object state. To save changes in database you need to use {@link OTS_Ban::save() save() method} to flush changed to database.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @version 0.1.5
|
* @version 0.1.5
|
||||||
* @since 0.1.5
|
* @since 0.1.5
|
||||||
*/
|
*/
|
||||||
@ -250,7 +250,7 @@ abstract class OTS_Ban extends OTS_Row_DAO
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Expiration time.
|
* Expiration time.
|
||||||
*
|
*
|
||||||
* @version 0.1.5
|
* @version 0.1.5
|
||||||
* @since 0.1.5
|
* @since 0.1.5
|
||||||
* @return int Ban expiration time (0 - forever).
|
* @return int Ban expiration time (0 - forever).
|
||||||
@ -268,11 +268,11 @@ abstract class OTS_Ban extends OTS_Row_DAO
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets expiration time.
|
* Sets expiration time.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* This method only updates object state. To save changes in database you need to use {@link OTS_Ban::save() save() method} to flush changed to database.
|
* This method only updates object state. To save changes in database you need to use {@link OTS_Ban::save() save() method} to flush changed to database.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @version 0.1.5
|
* @version 0.1.5
|
||||||
* @since 0.1.5
|
* @since 0.1.5
|
||||||
* @param int $expires Ban expiration time (0 - forever).
|
* @param int $expires Ban expiration time (0 - forever).
|
||||||
@ -284,7 +284,7 @@ abstract class OTS_Ban extends OTS_Row_DAO
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Banned time.
|
* Banned time.
|
||||||
*
|
*
|
||||||
* @version 0.1.5
|
* @version 0.1.5
|
||||||
* @since 0.1.5
|
* @since 0.1.5
|
||||||
* @return int Ban creation time.
|
* @return int Ban creation time.
|
||||||
@ -302,11 +302,11 @@ abstract class OTS_Ban extends OTS_Row_DAO
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets banned time.
|
* Sets banned time.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* This method only updates object state. To save changes in database you need to use {@link OTS_Ban::save() save() method} to flush changed to database.
|
* This method only updates object state. To save changes in database you need to use {@link OTS_Ban::save() save() method} to flush changed to database.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @version 0.1.5
|
* @version 0.1.5
|
||||||
* @since 0.1.5
|
* @since 0.1.5
|
||||||
* @param int $added Ban creation time.
|
* @param int $added Ban creation time.
|
||||||
@ -318,7 +318,7 @@ abstract class OTS_Ban extends OTS_Row_DAO
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Ban creator.
|
* Ban creator.
|
||||||
*
|
*
|
||||||
* @version 0.1.5
|
* @version 0.1.5
|
||||||
* @since 0.1.5
|
* @since 0.1.5
|
||||||
* @return int ID of administrator who created ban entry.
|
* @return int ID of administrator who created ban entry.
|
||||||
@ -336,11 +336,11 @@ abstract class OTS_Ban extends OTS_Row_DAO
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets ban creator.
|
* Sets ban creator.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* This method only updates object state. To save changes in database you need to use {@link OTS_Ban::save() save() method} to flush changed to database.
|
* This method only updates object state. To save changes in database you need to use {@link OTS_Ban::save() save() method} to flush changed to database.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @version 0.1.5
|
* @version 0.1.5
|
||||||
* @since 0.1.5
|
* @since 0.1.5
|
||||||
* @param int $adminId ID of administrator who created ban entry.
|
* @param int $adminId ID of administrator who created ban entry.
|
||||||
@ -352,7 +352,7 @@ abstract class OTS_Ban extends OTS_Row_DAO
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Explaination comment.
|
* Explaination comment.
|
||||||
*
|
*
|
||||||
* @version 0.1.5
|
* @version 0.1.5
|
||||||
* @since 0.1.5
|
* @since 0.1.5
|
||||||
* @return string Ban description.
|
* @return string Ban description.
|
||||||
@ -370,11 +370,11 @@ abstract class OTS_Ban extends OTS_Row_DAO
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets explaination comment.
|
* Sets explaination comment.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* This method only updates object state. To save changes in database you need to use {@link OTS_Ban::save() save() method} to flush changed to database.
|
* This method only updates object state. To save changes in database you need to use {@link OTS_Ban::save() save() method} to flush changed to database.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @version 0.1.5
|
* @version 0.1.5
|
||||||
* @since 0.1.5
|
* @since 0.1.5
|
||||||
* @param string $comment Ban description.
|
* @param string $comment Ban description.
|
||||||
@ -386,7 +386,7 @@ abstract class OTS_Ban extends OTS_Row_DAO
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Ban reason.
|
* Ban reason.
|
||||||
*
|
*
|
||||||
* @version 0.1.5
|
* @version 0.1.5
|
||||||
* @since 0.1.5
|
* @since 0.1.5
|
||||||
* @return int Reason for which ban was created.
|
* @return int Reason for which ban was created.
|
||||||
@ -404,11 +404,11 @@ abstract class OTS_Ban extends OTS_Row_DAO
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets ban reason.
|
* Sets ban reason.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* This method only updates object state. To save changes in database you need to use {@link OTS_Ban::save() save() method} to flush changed to database.
|
* This method only updates object state. To save changes in database you need to use {@link OTS_Ban::save() save() method} to flush changed to database.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @version 0.1.5
|
* @version 0.1.5
|
||||||
* @since 0.1.5
|
* @since 0.1.5
|
||||||
* @param int $reason Reason for which ban was created.
|
* @param int $reason Reason for which ban was created.
|
||||||
@ -420,15 +420,15 @@ abstract class OTS_Ban extends OTS_Row_DAO
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads custom field.
|
* Reads custom field.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* Reads field by it's name. Can read any field of given record that exists in database.
|
* Reads field by it's name. Can read any field of given record that exists in database.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* 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: 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.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @version 0.1.5
|
* @version 0.1.5
|
||||||
* @since 0.1.5
|
* @since 0.1.5
|
||||||
* @param string $field Field name.
|
* @param string $field Field name.
|
||||||
@ -449,19 +449,19 @@ abstract class OTS_Ban extends OTS_Row_DAO
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Writes custom field.
|
* Writes custom field.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* Write field by it's name. Can write any field of given record that exists in database.
|
* Write field by it's name. Can write any field of given record that exists in database.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* 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: 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.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* 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.
|
* 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.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @version 0.1.5
|
* @version 0.1.5
|
||||||
* @since 0.1.5
|
* @since 0.1.5
|
||||||
* @param string $field Field name.
|
* @param string $field Field name.
|
||||||
@ -482,12 +482,12 @@ abstract class OTS_Ban extends OTS_Row_DAO
|
|||||||
$value = $this->db->quote($value);
|
$value = $this->db->quote($value);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->query('UPDATE ' . $this->db->tableName('bans') . ' SET ' . $this->db->fieldName($field) . ' = ' . $value . ' WHERE ' . $this->db->fieldName('id') . ' = ' . $this->data['id']);
|
$this->db->exec('UPDATE ' . $this->db->tableName('bans') . ' SET ' . $this->db->fieldName($field) . ' = ' . $value . ' WHERE ' . $this->db->fieldName('id') . ' = ' . $this->data['id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Magic PHP5 method.
|
* Magic PHP5 method.
|
||||||
*
|
*
|
||||||
* @version 0.1.5
|
* @version 0.1.5
|
||||||
* @since 0.1.5
|
* @since 0.1.5
|
||||||
* @param string $name Property name.
|
* @param string $name Property name.
|
||||||
@ -537,7 +537,7 @@ abstract class OTS_Ban extends OTS_Row_DAO
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Magic PHP5 method.
|
* Magic PHP5 method.
|
||||||
*
|
*
|
||||||
* @version 0.1.5
|
* @version 0.1.5
|
||||||
* @since 0.1.5
|
* @since 0.1.5
|
||||||
* @param string $name Property name.
|
* @param string $name Property name.
|
||||||
|
@ -128,13 +128,13 @@ class OTS_Group extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
if( isset($this->data['id']) )
|
if( isset($this->data['id']) )
|
||||||
{
|
{
|
||||||
// UPDATE query on database
|
// UPDATE query on database
|
||||||
$this->db->query('UPDATE ' . $this->db->tableName('groups') . ' SET ' . $this->db->fieldName('name') . ' = ' . $this->db->quote($this->data['name']) . ', ' . $this->db->fieldName('flags') . ' = ' . $this->data['flags'] . ', ' . $this->db->fieldName('access') . ' = ' . $this->data['access'] . ', ' . $this->db->fieldName('maxdepotitems') . ' = ' . $this->data['maxdepotitems'] . ', ' . $this->db->fieldName('maxviplist') . ' = ' . $this->data['maxviplist'] . ' WHERE ' . $this->db->fieldName('id') . ' = ' . $this->data['id']);
|
$this->db->exec('UPDATE ' . $this->db->tableName('groups') . ' SET ' . $this->db->fieldName('name') . ' = ' . $this->db->quote($this->data['name']) . ', ' . $this->db->fieldName('flags') . ' = ' . $this->data['flags'] . ', ' . $this->db->fieldName('access') . ' = ' . $this->data['access'] . ', ' . $this->db->fieldName('maxdepotitems') . ' = ' . $this->data['maxdepotitems'] . ', ' . $this->db->fieldName('maxviplist') . ' = ' . $this->data['maxviplist'] . ' WHERE ' . $this->db->fieldName('id') . ' = ' . $this->data['id']);
|
||||||
}
|
}
|
||||||
// creates new group
|
// creates new group
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// INSERT query on database
|
// INSERT query on database
|
||||||
$this->db->query('INSERT INTO ' . $this->db->tableName('groups') . ' (' . $this->db->fieldName('name') . ', ' . $this->db->fieldName('flags') . ', ' . $this->db->fieldName('access') . ', ' . $this->db->fieldName('maxdepotitems') . ', ' . $this->db->fieldName('maxviplist') . ') VALUES (' . $this->db->quote($this->data['name']) . ', ' . $this->data['flags'] . ', ' . $this->data['access'] . ', ' . $this->data['maxdepotitems'] . ', ' . $this->data['maxviplist'] . ')');
|
$this->db->exec('INSERT INTO ' . $this->db->tableName('groups') . ' (' . $this->db->fieldName('name') . ', ' . $this->db->fieldName('flags') . ', ' . $this->db->fieldName('access') . ', ' . $this->db->fieldName('maxdepotitems') . ', ' . $this->db->fieldName('maxviplist') . ') VALUES (' . $this->db->quote($this->data['name']) . ', ' . $this->data['flags'] . ', ' . $this->data['access'] . ', ' . $this->data['maxdepotitems'] . ', ' . $this->data['maxviplist'] . ')');
|
||||||
// ID of new group
|
// ID of new group
|
||||||
$this->data['id'] = $this->db->lastInsertId();
|
$this->data['id'] = $this->db->lastInsertId();
|
||||||
}
|
}
|
||||||
@ -435,7 +435,7 @@ class OTS_Group extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
$value = $this->db->quote($value);
|
$value = $this->db->quote($value);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->query('UPDATE ' . $this->db->tableName('groups') . ' SET ' . $this->db->fieldName($field) . ' = ' . $value . ' WHERE ' . $this->db->fieldName('id') . ' = ' . $this->data['id']);
|
$this->db->exec('UPDATE ' . $this->db->tableName('groups') . ' SET ' . $this->db->fieldName($field) . ' = ' . $value . ' WHERE ' . $this->db->fieldName('id') . ' = ' . $this->data['id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -519,7 +519,7 @@ class OTS_Group extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
}
|
}
|
||||||
|
|
||||||
// deletes row from database
|
// deletes row from database
|
||||||
$this->db->query('DELETE FROM ' . $this->db->tableName('groups') . ' WHERE ' . $this->db->fieldName('id') . ' = ' . $this->data['id']);
|
$this->db->exec('DELETE FROM ' . $this->db->tableName('groups') . ' WHERE ' . $this->db->fieldName('id') . ' = ' . $this->data['id']);
|
||||||
|
|
||||||
// resets object handle
|
// resets object handle
|
||||||
unset($this->data['id']);
|
unset($this->data['id']);
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* OTServ guild abstraction.
|
* OTServ guild abstraction.
|
||||||
*
|
*
|
||||||
* @package POT
|
* @package POT
|
||||||
* @version 0.1.4
|
* @version 0.1.4
|
||||||
* @property string $read Guild name.
|
* @property string $read Guild name.
|
||||||
@ -34,30 +34,30 @@ class OTS_Guild extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Guild data.
|
* Guild data.
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
private $data = array();
|
private $data = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Invites handler.
|
* Invites handler.
|
||||||
*
|
*
|
||||||
* @var IOTS_GuildAction
|
* @var IOTS_GuildAction
|
||||||
*/
|
*/
|
||||||
private $invites;
|
private $invites;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Membership requests handler.
|
* Membership requests handler.
|
||||||
*
|
*
|
||||||
* @var IOTS_GuildAction
|
* @var IOTS_GuildAction
|
||||||
*/
|
*/
|
||||||
private $requests;
|
private $requests;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Magic PHP5 method.
|
* Magic PHP5 method.
|
||||||
*
|
*
|
||||||
* Allows object serialisation.
|
* Allows object serialisation.
|
||||||
*
|
*
|
||||||
* @return array List of properties that should be saved.
|
* @return array List of properties that should be saved.
|
||||||
*/
|
*/
|
||||||
public function __sleep()
|
public function __sleep()
|
||||||
@ -67,11 +67,11 @@ class OTS_Guild extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates clone of object.
|
* Creates clone of object.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* Copy of object needs to have different ID. Also invites and requests drivers are copied and assigned to object's copy.
|
* Copy of object needs to have different ID. Also invites and requests drivers are copied and assigned to object's copy.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @version 0.1.3
|
* @version 0.1.3
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
@ -94,7 +94,7 @@ class OTS_Guild extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* Assigns invites handler.
|
* Assigns invites handler.
|
||||||
*
|
*
|
||||||
* @param IOTS_GuildAction $invites Invites driver (don't pass it to clear driver).
|
* @param IOTS_GuildAction $invites Invites driver (don't pass it to clear driver).
|
||||||
*/
|
*/
|
||||||
public function setInvitesDriver(IOTS_GuildAction $invites = null)
|
public function setInvitesDriver(IOTS_GuildAction $invites = null)
|
||||||
@ -104,7 +104,7 @@ class OTS_Guild extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Assigns requests handler.
|
* Assigns requests handler.
|
||||||
*
|
*
|
||||||
* @param IOTS_GuildAction $requests Membership requests driver (don't pass it to clear driver).
|
* @param IOTS_GuildAction $requests Membership requests driver (don't pass it to clear driver).
|
||||||
*/
|
*/
|
||||||
public function setRequestsDriver(IOTS_GuildAction $requests = null)
|
public function setRequestsDriver(IOTS_GuildAction $requests = null)
|
||||||
@ -114,7 +114,7 @@ class OTS_Guild extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads guild with given id.
|
* Loads guild with given id.
|
||||||
*
|
*
|
||||||
* @version 0.0.5
|
* @version 0.0.5
|
||||||
* @param int $id Guild's ID.
|
* @param int $id Guild's ID.
|
||||||
* @throws PDOException On PDO operation error.
|
* @throws PDOException On PDO operation error.
|
||||||
@ -124,7 +124,7 @@ class OTS_Guild extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
$ownerid = 'ownerid';
|
$ownerid = 'ownerid';
|
||||||
if($this->db->hasColumn('guilds', 'owner_id'))
|
if($this->db->hasColumn('guilds', 'owner_id'))
|
||||||
$ownerid = 'owner_id';
|
$ownerid = 'owner_id';
|
||||||
|
|
||||||
$creationdata = 'creationdata';
|
$creationdata = 'creationdata';
|
||||||
if($this->db->hasColumn('guilds', 'creationdate'))
|
if($this->db->hasColumn('guilds', 'creationdate'))
|
||||||
$creationdata = 'creationdate';
|
$creationdata = 'creationdate';
|
||||||
@ -137,7 +137,7 @@ class OTS_Guild extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads guild by it's name.
|
* Loads guild by it's name.
|
||||||
*
|
*
|
||||||
* @version 0.0.5
|
* @version 0.0.5
|
||||||
* @param string $name Guild's name.
|
* @param string $name Guild's name.
|
||||||
* @throws PDOException On PDO operation error.
|
* @throws PDOException On PDO operation error.
|
||||||
@ -156,7 +156,7 @@ class OTS_Guild extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if object is loaded.
|
* Checks if object is loaded.
|
||||||
*
|
*
|
||||||
* @return bool Load state.
|
* @return bool Load state.
|
||||||
*/
|
*/
|
||||||
public function isLoaded()
|
public function isLoaded()
|
||||||
@ -166,11 +166,11 @@ class OTS_Guild extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Saves guild in database.
|
* Saves guild in database.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* If guild is not loaded to represent any existing group it will create new row for it.
|
* If guild is not loaded to represent any existing group it will create new row for it.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @version 0.0.5
|
* @version 0.0.5
|
||||||
* @throws PDOException On PDO operation error.
|
* @throws PDOException On PDO operation error.
|
||||||
*/
|
*/
|
||||||
@ -179,7 +179,7 @@ class OTS_Guild extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
$ownerid = 'ownerid';
|
$ownerid = 'ownerid';
|
||||||
if($this->db->hasColumn('guilds', 'owner_id'))
|
if($this->db->hasColumn('guilds', 'owner_id'))
|
||||||
$ownerid = 'owner_id';
|
$ownerid = 'owner_id';
|
||||||
|
|
||||||
$creationdata = 'creationdata';
|
$creationdata = 'creationdata';
|
||||||
if($this->db->hasColumn('guilds', 'creationdate'))
|
if($this->db->hasColumn('guilds', 'creationdate'))
|
||||||
$creationdata = 'creationdate';
|
$creationdata = 'creationdate';
|
||||||
@ -190,13 +190,13 @@ class OTS_Guild extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
if( isset($this->data['id']) )
|
if( isset($this->data['id']) )
|
||||||
{
|
{
|
||||||
// UPDATE query on database
|
// UPDATE query on database
|
||||||
$this->db->query('UPDATE `guilds` SET `name` = ' . $this->db->quote($this->data['name']) . ', `' . $ownerid . '` = ' . $this->data['ownerid'] . ', `' . $creationdata . '` = ' . $this->data['creationdata'] . ' WHERE `id` = ' . $this->data['id']);
|
$this->db->exec('UPDATE `guilds` SET `name` = ' . $this->db->quote($this->data['name']) . ', `' . $ownerid . '` = ' . $this->data['ownerid'] . ', `' . $creationdata . '` = ' . $this->data['creationdata'] . ' WHERE `id` = ' . $this->data['id']);
|
||||||
}
|
}
|
||||||
// creates new guild
|
// creates new guild
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// INSERT query on database
|
// INSERT query on database
|
||||||
$this->db->query("INSERT INTO `guilds` (`name`, `" . $ownerid . "`, `" . $creationdata . "`, `description`) VALUES (" . $this->db->quote($this->data['name']) . ", " . $this->data['ownerid'] . ", " . $this->data['creationdata'] . ", '')");
|
$this->db->exec("INSERT INTO `guilds` (`name`, `" . $ownerid . "`, `" . $creationdata . "`, `description`) VALUES (" . $this->db->quote($this->data['name']) . ", " . $this->data['ownerid'] . ", " . $this->data['creationdata'] . ", '')");
|
||||||
// ID of new group
|
// ID of new group
|
||||||
$this->data['id'] = $this->db->lastInsertId();
|
$this->data['id'] = $this->db->lastInsertId();
|
||||||
}
|
}
|
||||||
@ -204,7 +204,7 @@ class OTS_Guild extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Guild ID.
|
* Guild ID.
|
||||||
*
|
*
|
||||||
* @return int Guild ID.
|
* @return int Guild ID.
|
||||||
* @throws E_OTS_NotLoaded If guild is not loaded.
|
* @throws E_OTS_NotLoaded If guild is not loaded.
|
||||||
*/
|
*/
|
||||||
@ -220,7 +220,7 @@ class OTS_Guild extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Guild name.
|
* Guild name.
|
||||||
*
|
*
|
||||||
* @return string Guild's name.
|
* @return string Guild's name.
|
||||||
* @throws E_OTS_NotLoaded If guild is not loaded.
|
* @throws E_OTS_NotLoaded If guild is not loaded.
|
||||||
*/
|
*/
|
||||||
@ -236,11 +236,11 @@ class OTS_Guild extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets guild's name.
|
* Sets guild's name.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* This method only updates object state. To save changes in database you need to use {@link OTS_Guild::save() save() method} to flush changed to database.
|
* This method only updates object state. To save changes in database you need to use {@link OTS_Guild::save() save() method} to flush changed to database.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param string $name Name.
|
* @param string $name Name.
|
||||||
*/
|
*/
|
||||||
public function setName($name)
|
public function setName($name)
|
||||||
@ -250,7 +250,7 @@ class OTS_Guild extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns owning player of this player.
|
* Returns owning player of this player.
|
||||||
*
|
*
|
||||||
* @version 0.1.0
|
* @version 0.1.0
|
||||||
* @return OTS_Player Owning player.
|
* @return OTS_Player Owning player.
|
||||||
* @throws E_OTS_NotLoaded If guild is not loaded.
|
* @throws E_OTS_NotLoaded If guild is not loaded.
|
||||||
@ -270,11 +270,11 @@ class OTS_Guild extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Assigns guild to owner.
|
* Assigns guild to owner.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* This method only updates object state. To save changes in database you need to use {@link OTS_Guild::save() save() method} to flush changed to database.
|
* This method only updates object state. To save changes in database you need to use {@link OTS_Guild::save() save() method} to flush changed to database.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param OTS_Player $owner Owning player.
|
* @param OTS_Player $owner Owning player.
|
||||||
* @throws E_OTS_NotLoaded If given <var>$owner</var> object is not loaded.
|
* @throws E_OTS_NotLoaded If given <var>$owner</var> object is not loaded.
|
||||||
*/
|
*/
|
||||||
@ -285,27 +285,27 @@ class OTS_Guild extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
|
|
||||||
public function hasMember(OTS_Player $player) {
|
public function hasMember(OTS_Player $player) {
|
||||||
global $db;
|
global $db;
|
||||||
|
|
||||||
if(!$player || !$player->isLoaded()) {
|
if(!$player || !$player->isLoaded()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$player_rank = $player->getRank();
|
$player_rank = $player->getRank();
|
||||||
if(!$player_rank->isLoaded()) {
|
if(!$player_rank->isLoaded()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($this->getGuildRanksList() as $rank) {
|
foreach($this->getGuildRanksList() as $rank) {
|
||||||
if($rank->getId() == $player_rank->getId()) {
|
if($rank->getId() == $player_rank->getId()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Guild creation data.
|
* Guild creation data.
|
||||||
*
|
*
|
||||||
* @return int Guild creation data.
|
* @return int Guild creation data.
|
||||||
* @throws E_OTS_NotLoaded If guild is not loaded.
|
* @throws E_OTS_NotLoaded If guild is not loaded.
|
||||||
*/
|
*/
|
||||||
@ -321,11 +321,11 @@ class OTS_Guild extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets guild creation data.
|
* Sets guild creation data.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* This method only updates object state. To save changes in database you need to use {@link OTS_Guild::save() save() method} to flush changed to database.
|
* This method only updates object state. To save changes in database you need to use {@link OTS_Guild::save() save() method} to flush changed to database.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param int $creationdata Guild creation data.
|
* @param int $creationdata Guild creation data.
|
||||||
*/
|
*/
|
||||||
public function setCreationData($creationdata)
|
public function setCreationData($creationdata)
|
||||||
@ -335,15 +335,15 @@ class OTS_Guild extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads custom field.
|
* Reads custom field.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* Reads field by it's name. Can read any field of given record that exists in database.
|
* Reads field by it's name. Can read any field of given record that exists in database.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* 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: 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.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @version 0.0.8
|
* @version 0.0.8
|
||||||
* @param string $field Field name.
|
* @param string $field Field name.
|
||||||
* @return string Field value.
|
* @return string Field value.
|
||||||
@ -363,19 +363,19 @@ class OTS_Guild extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Writes custom field.
|
* Writes custom field.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* Write field by it's name. Can write any field of given record that exists in database.
|
* Write field by it's name. Can write any field of given record that exists in database.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* 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: 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.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* Note: Make sure that you pass $value argument of correct type. This method determinates whether to quote field value. 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.
|
* Note: Make sure that you pass $value argument of correct type. This method determinates whether to quote field value. 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.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @version 0.0.5
|
* @version 0.0.5
|
||||||
* @param string $field Field name.
|
* @param string $field Field name.
|
||||||
* @param mixed $value Field value.
|
* @param mixed $value Field value.
|
||||||
@ -395,7 +395,7 @@ class OTS_Guild extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
$value = $this->db->quote($value);
|
$value = $this->db->quote($value);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->query('UPDATE ' . $this->db->tableName('guilds') . ' SET ' . $this->db->fieldName($field) . ' = ' . $value . ' WHERE ' . $this->db->fieldName('id') . ' = ' . $this->data['id']);
|
$this->db->exec('UPDATE ' . $this->db->tableName('guilds') . ' SET ' . $this->db->fieldName($field) . ' = ' . $value . ' WHERE ' . $this->db->fieldName('id') . ' = ' . $this->data['id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -426,15 +426,15 @@ class OTS_Guild extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* List of ranks in guild.
|
* List of ranks in guild.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* In difference to {@link OTS_Guild::getGuildRanks() getGuildRanks() method} this method returns filtered {@link OTS_GuildRanks_List OTS_GuildRanks_List} object instead of array of {@link OTS_GuildRank OTS_GuildRank} objects. It is more effective since OTS_GuildRanks_List doesn't perform all rows loading at once.
|
* In difference to {@link OTS_Guild::getGuildRanks() getGuildRanks() method} this method returns filtered {@link OTS_GuildRanks_List OTS_GuildRanks_List} object instead of array of {@link OTS_GuildRank OTS_GuildRank} objects. It is more effective since OTS_GuildRanks_List doesn't perform all rows loading at once.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* 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 {@link OTS_Base_List::rewind() rewind() method} first.
|
* 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 {@link OTS_Base_List::rewind() rewind() method} first.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @version 0.1.4
|
* @version 0.1.4
|
||||||
* @since 0.0.5
|
* @since 0.0.5
|
||||||
* @return OTS_GuildRanks_List List of ranks from current guild.
|
* @return OTS_GuildRanks_List List of ranks from current guild.
|
||||||
@ -460,11 +460,11 @@ class OTS_Guild extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns list of invited players.
|
* Returns list of invited players.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* OTServ and it's database doesn't provide such feature like guild invitations. In order to use this mechanism you have to write own {@link IOTS_GuildAction invitations drivers} and assign it using {@link OTS_Guild::setInvitesDriver() setInvitesDriver() method}.
|
* OTServ and it's database doesn't provide such feature like guild invitations. In order to use this mechanism you have to write own {@link IOTS_GuildAction invitations drivers} and assign it using {@link OTS_Guild::setInvitesDriver() setInvitesDriver() method}.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @return array List of invited players.
|
* @return array List of invited players.
|
||||||
* @throws E_OTS_NotLoaded If guild is not loaded.
|
* @throws E_OTS_NotLoaded If guild is not loaded.
|
||||||
* @throws E_OTS_NoDriver If there is no invites driver assigned.
|
* @throws E_OTS_NoDriver If there is no invites driver assigned.
|
||||||
@ -487,11 +487,11 @@ class OTS_Guild extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Invites player to guild.
|
* Invites player to guild.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* OTServ and it's database doesn't provide such feature like guild invitations. In order to use this mechanism you have to write own {@link IOTS_GuildAction invitations drivers} and assign it using {@link OTS_Guild::setInvitesDriver() setInvitesDriver() method}.
|
* OTServ and it's database doesn't provide such feature like guild invitations. In order to use this mechanism you have to write own {@link IOTS_GuildAction invitations drivers} and assign it using {@link OTS_Guild::setInvitesDriver() setInvitesDriver() method}.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param OTS_Player Player to be invited.
|
* @param OTS_Player Player to be invited.
|
||||||
* @throws E_OTS_NotLoaded If guild is not loaded.
|
* @throws E_OTS_NotLoaded If guild is not loaded.
|
||||||
* @throws E_OTS_NoDriver If there is no invites driver assigned.
|
* @throws E_OTS_NoDriver If there is no invites driver assigned.
|
||||||
@ -514,11 +514,11 @@ class OTS_Guild extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes invitation for player to guild.
|
* Deletes invitation for player to guild.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* OTServ and it's database doesn't provide such feature like guild invitations. In order to use this mechanism you have to write own {@link IOTS_GuildAction invitations drivers} and assign it using {@link OTS_Guild::setInvitesDriver() setInvitesDriver() method}.
|
* OTServ and it's database doesn't provide such feature like guild invitations. In order to use this mechanism you have to write own {@link IOTS_GuildAction invitations drivers} and assign it using {@link OTS_Guild::setInvitesDriver() setInvitesDriver() method}.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param OTS_Player Player to be un-invited.
|
* @param OTS_Player Player to be un-invited.
|
||||||
* @throws E_OTS_NotLoaded If guild is not loaded.
|
* @throws E_OTS_NotLoaded If guild is not loaded.
|
||||||
* @throws E_OTS_NoDriver If there is no invites driver assigned.
|
* @throws E_OTS_NoDriver If there is no invites driver assigned.
|
||||||
@ -541,11 +541,11 @@ class OTS_Guild extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Finalise invitation.
|
* Finalise invitation.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* OTServ and it's database doesn't provide such feature like guild invitations. In order to use this mechanism you have to write own {@link IOTS_GuildAction invitations drivers} and assign it using {@link OTS_Guild::setInvitesDriver() setInvitesDriver() method}.
|
* OTServ and it's database doesn't provide such feature like guild invitations. In order to use this mechanism you have to write own {@link IOTS_GuildAction invitations drivers} and assign it using {@link OTS_Guild::setInvitesDriver() setInvitesDriver() method}.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param OTS_Player Player to be joined.
|
* @param OTS_Player Player to be joined.
|
||||||
* @throws E_OTS_NotLoaded If guild is not loaded.
|
* @throws E_OTS_NotLoaded If guild is not loaded.
|
||||||
* @throws E_OTS_NoDriver If there is no invites driver assigned.
|
* @throws E_OTS_NoDriver If there is no invites driver assigned.
|
||||||
@ -568,11 +568,11 @@ class OTS_Guild extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns list of players that requested membership.
|
* Returns list of players that requested membership.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* OTServ and it's database doesn't provide such feature like membership requests. In order to use this mechanism you have to write own {@link IOTS_GuildAction requests drivers} and assign it using {@link OTS_Guild::setInvitesDriver() setRequestsDriver() method}.
|
* OTServ and it's database doesn't provide such feature like membership requests. In order to use this mechanism you have to write own {@link IOTS_GuildAction requests drivers} and assign it using {@link OTS_Guild::setInvitesDriver() setRequestsDriver() method}.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @return array List of players.
|
* @return array List of players.
|
||||||
* @throws E_OTS_NotLoaded If guild is not loaded.
|
* @throws E_OTS_NotLoaded If guild is not loaded.
|
||||||
* @throws E_OTS_NoDriver If there is no requests driver assigned.
|
* @throws E_OTS_NoDriver If there is no requests driver assigned.
|
||||||
@ -595,11 +595,11 @@ class OTS_Guild extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Requests membership in guild for player player.
|
* Requests membership in guild for player player.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* OTServ and it's database doesn't provide such feature like membership requests. In order to use this mechanism you have to write own {@link IOTS_GuildAction requests drivers} and assign it using {@link OTS_Guild::setInvitesDriver() setRequestsDriver() method}.
|
* OTServ and it's database doesn't provide such feature like membership requests. In order to use this mechanism you have to write own {@link IOTS_GuildAction requests drivers} and assign it using {@link OTS_Guild::setInvitesDriver() setRequestsDriver() method}.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param OTS_Player Player that requested membership.
|
* @param OTS_Player Player that requested membership.
|
||||||
* @throws E_OTS_NotLoaded If guild is not loaded.
|
* @throws E_OTS_NotLoaded If guild is not loaded.
|
||||||
* @throws E_OTS_NoDriver If there is no requests driver assigned.
|
* @throws E_OTS_NoDriver If there is no requests driver assigned.
|
||||||
@ -622,11 +622,11 @@ class OTS_Guild extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes request from player.
|
* Deletes request from player.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* OTServ and it's database doesn't provide such feature like membership requests. In order to use this mechanism you have to write own {@link IOTS_GuildAction requests drivers} and assign it using {@link OTS_Guild::setInvitesDriver() setRequestsDriver() method}.
|
* OTServ and it's database doesn't provide such feature like membership requests. In order to use this mechanism you have to write own {@link IOTS_GuildAction requests drivers} and assign it using {@link OTS_Guild::setInvitesDriver() setRequestsDriver() method}.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param OTS_Player Player to be rejected.
|
* @param OTS_Player Player to be rejected.
|
||||||
* @throws E_OTS_NotLoaded If guild is not loaded.
|
* @throws E_OTS_NotLoaded If guild is not loaded.
|
||||||
* @throws E_OTS_NoDriver If there is no requests driver assigned.
|
* @throws E_OTS_NoDriver If there is no requests driver assigned.
|
||||||
@ -649,11 +649,11 @@ class OTS_Guild extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Accepts player.
|
* Accepts player.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* OTServ and it's database doesn't provide such feature like membership requests. In order to use this mechanism you have to write own {@link IOTS_GuildAction requests drivers} and assign it using {@link OTS_Guild::setInvitesDriver() setRequestsDriver() method}.
|
* OTServ and it's database doesn't provide such feature like membership requests. In order to use this mechanism you have to write own {@link IOTS_GuildAction requests drivers} and assign it using {@link OTS_Guild::setInvitesDriver() setRequestsDriver() method}.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param OTS_Player Player to be accepted.
|
* @param OTS_Player Player to be accepted.
|
||||||
* @throws E_OTS_NotLoaded If guild is not loaded.
|
* @throws E_OTS_NotLoaded If guild is not loaded.
|
||||||
* @throws E_OTS_NoDriver If there is no requests driver assigned.
|
* @throws E_OTS_NoDriver If there is no requests driver assigned.
|
||||||
@ -676,7 +676,7 @@ class OTS_Guild extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes guild.
|
* Deletes guild.
|
||||||
*
|
*
|
||||||
* @version 0.0.5
|
* @version 0.0.5
|
||||||
* @since 0.0.5
|
* @since 0.0.5
|
||||||
* @throws E_OTS_NotLoaded If guild is not loaded.
|
* @throws E_OTS_NotLoaded If guild is not loaded.
|
||||||
@ -690,7 +690,7 @@ class OTS_Guild extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
}
|
}
|
||||||
|
|
||||||
// deletes row from database
|
// deletes row from database
|
||||||
$this->db->query('DELETE FROM ' . $this->db->tableName('guilds') . ' WHERE ' . $this->db->fieldName('id') . ' = ' . $this->data['id']);
|
$this->db->exec('DELETE FROM ' . $this->db->tableName('guilds') . ' WHERE ' . $this->db->fieldName('id') . ' = ' . $this->data['id']);
|
||||||
|
|
||||||
// resets object handle
|
// resets object handle
|
||||||
unset($this->data['id']);
|
unset($this->data['id']);
|
||||||
@ -698,11 +698,11 @@ class OTS_Guild extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns ranks iterator.
|
* Returns ranks iterator.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* There is no need to implement entire Iterator interface since we have {@link OTS_GuildRanks_List ranks list class} for it.
|
* There is no need to implement entire Iterator interface since we have {@link OTS_GuildRanks_List ranks list class} for it.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @version 0.0.5
|
* @version 0.0.5
|
||||||
* @since 0.0.5
|
* @since 0.0.5
|
||||||
* @throws E_OTS_NotLoaded If guild is not loaded.
|
* @throws E_OTS_NotLoaded If guild is not loaded.
|
||||||
@ -716,7 +716,7 @@ class OTS_Guild extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns number of ranks within.
|
* Returns number of ranks within.
|
||||||
*
|
*
|
||||||
* @version 0.0.5
|
* @version 0.0.5
|
||||||
* @since 0.0.5
|
* @since 0.0.5
|
||||||
* @throws E_OTS_NotLoaded If guild is not loaded.
|
* @throws E_OTS_NotLoaded If guild is not loaded.
|
||||||
@ -730,7 +730,7 @@ class OTS_Guild extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Magic PHP5 method.
|
* Magic PHP5 method.
|
||||||
*
|
*
|
||||||
* @version 0.1.3
|
* @version 0.1.3
|
||||||
* @since 0.1.0
|
* @since 0.1.0
|
||||||
* @param string $name Property name.
|
* @param string $name Property name.
|
||||||
@ -773,7 +773,7 @@ class OTS_Guild extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Magic PHP5 method.
|
* Magic PHP5 method.
|
||||||
*
|
*
|
||||||
* @version 0.1.0
|
* @version 0.1.0
|
||||||
* @since 0.1.0
|
* @since 0.1.0
|
||||||
* @param string $name Property name.
|
* @param string $name Property name.
|
||||||
@ -812,11 +812,11 @@ class OTS_Guild extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns string representation of object.
|
* Returns string representation of object.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* If any display driver is currently loaded then it uses it's method. Else it returns guild name.
|
* If any display driver is currently loaded then it uses it's method. Else it returns guild name.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @version 0.1.3
|
* @version 0.1.3
|
||||||
* @since 0.1.0
|
* @since 0.1.0
|
||||||
* @return string String representation of object.
|
* @return string String representation of object.
|
||||||
|
@ -106,13 +106,13 @@ class OTS_GuildRank extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
if( isset($this->data['id']) )
|
if( isset($this->data['id']) )
|
||||||
{
|
{
|
||||||
// UPDATE query on database
|
// UPDATE query on database
|
||||||
$this->db->query('UPDATE ' . $this->db->tableName('guild_ranks') . ' SET ' . $this->db->fieldName('guild_id') . ' = ' . $this->db->quote($this->data['guild_id']) . ', ' . $this->db->fieldName('name') . ' = ' . $this->db->quote($this->data['name']) . ', ' . $this->db->fieldName('level') . ' = ' . $this->data['level'] . ' WHERE ' . $this->db->fieldName('id') . ' = ' . $this->data['id']);
|
$this->db->exec('UPDATE ' . $this->db->tableName('guild_ranks') . ' SET ' . $this->db->fieldName('guild_id') . ' = ' . $this->db->quote($this->data['guild_id']) . ', ' . $this->db->fieldName('name') . ' = ' . $this->db->quote($this->data['name']) . ', ' . $this->db->fieldName('level') . ' = ' . $this->data['level'] . ' WHERE ' . $this->db->fieldName('id') . ' = ' . $this->data['id']);
|
||||||
}
|
}
|
||||||
// creates new rank
|
// creates new rank
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// INSERT query on database
|
// INSERT query on database
|
||||||
$this->db->query('INSERT INTO ' . $this->db->tableName('guild_ranks') . ' (' . $this->db->fieldName('guild_id') . ', ' . $this->db->fieldName('name') . ', ' . $this->db->fieldName('level') . ') VALUES (' . $this->data['guild_id'] . ', ' . $this->db->quote($this->data['name']) . ', ' . $this->data['level'] . ')');
|
$this->db->exec('INSERT INTO ' . $this->db->tableName('guild_ranks') . ' (' . $this->db->fieldName('guild_id') . ', ' . $this->db->fieldName('name') . ', ' . $this->db->fieldName('level') . ') VALUES (' . $this->data['guild_id'] . ', ' . $this->db->quote($this->data['name']) . ', ' . $this->data['level'] . ')');
|
||||||
// ID of new rank
|
// ID of new rank
|
||||||
$this->data['id'] = $this->db->lastInsertId();
|
$this->data['id'] = $this->db->lastInsertId();
|
||||||
}
|
}
|
||||||
|
@ -15,11 +15,11 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Wrapper for house information.
|
* Wrapper for house information.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* Unlike other {@link OTS_Base_DAO OTS_Base_DAO} child classes, OTS_House bases not only on database, but also loads some additional info from XML DOM node. It can't be load - it is always initialised with {@link http://www.php.net/manual/en/ref.dom.php DOMElement} object. Saving will only update database row - won't change XML data. Same about using {@link OTS_House::delete() delete() method}.
|
* Unlike other {@link OTS_Base_DAO OTS_Base_DAO} child classes, OTS_House bases not only on database, but also loads some additional info from XML DOM node. It can't be load - it is always initialised with {@link http://www.php.net/manual/en/ref.dom.php DOMElement} object. Saving will only update database row - won't change XML data. Same about using {@link OTS_House::delete() delete() method}.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @package POT
|
* @package POT
|
||||||
* @version 0.1.3
|
* @version 0.1.3
|
||||||
* @property OTS_Player $owner House owner.
|
* @property OTS_Player $owner House owner.
|
||||||
@ -38,23 +38,23 @@ class OTS_House extends OTS_Row_DAO
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* House rent info.
|
* House rent info.
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
private $data = array();
|
private $data = array();
|
||||||
|
|
||||||
//private $columns = array('id', 'name', 'owner', 'paid', 'warnings', 'rent', 'beds');
|
//private $columns = array('id', 'name', 'owner', 'paid', 'warnings', 'rent', 'beds');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Information handler.
|
* Information handler.
|
||||||
*
|
*
|
||||||
* @var DOMElement
|
* @var DOMElement
|
||||||
*/
|
*/
|
||||||
private $element;
|
private $element;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tiles list.
|
* Tiles list.
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
private $tiles = array();
|
private $tiles = array();
|
||||||
@ -67,7 +67,7 @@ class OTS_House extends OTS_Row_DAO
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function find($name)
|
public function find($name)
|
||||||
{
|
{
|
||||||
// finds player's ID
|
// finds player's ID
|
||||||
@ -83,7 +83,7 @@ class OTS_House extends OTS_Row_DAO
|
|||||||
public function setElement(DOMElement $element) {
|
public function setElement(DOMElement $element) {
|
||||||
$this->element = $element;
|
$this->element = $element;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if object is loaded.
|
* Checks if object is loaded.
|
||||||
*
|
*
|
||||||
@ -96,11 +96,11 @@ class OTS_House extends OTS_Row_DAO
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Magic PHP5 method.
|
* Magic PHP5 method.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* Allows object serialisation.
|
* Allows object serialisation.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @return array List of properties that should be saved.
|
* @return array List of properties that should be saved.
|
||||||
*/
|
*/
|
||||||
public function __sleep()
|
public function __sleep()
|
||||||
@ -110,7 +110,7 @@ class OTS_House extends OTS_Row_DAO
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Saves info in database.
|
* Saves info in database.
|
||||||
*
|
*
|
||||||
* @throws PDOException On PDO operation error.
|
* @throws PDOException On PDO operation error.
|
||||||
*/
|
*/
|
||||||
public function save()
|
public function save()
|
||||||
@ -118,7 +118,7 @@ class OTS_House extends OTS_Row_DAO
|
|||||||
// inserts new record
|
// inserts new record
|
||||||
if( empty($this->data) )
|
if( empty($this->data) )
|
||||||
{
|
{
|
||||||
$this->db->query('INSERT INTO ' . $this->db->tableName('houses') . ' (' . $this->db->fieldName('id') . ', ' . $this->db->fieldName('owner') . ', ' . $this->db->fieldName('paid') . ', ' . $this->db->fieldName('warnings') . ') VALUES (' . $this->getId() . ', ' . $this->data['owner'] . ', ' . $this->data['paid'] . ', ' . $this->data['warnings'] . ')');
|
$this->db->exec('INSERT INTO ' . $this->db->tableName('houses') . ' (' . $this->db->fieldName('id') . ', ' . $this->db->fieldName('owner') . ', ' . $this->db->fieldName('paid') . ', ' . $this->db->fieldName('warnings') . ') VALUES (' . $this->getId() . ', ' . $this->data['owner'] . ', ' . $this->data['paid'] . ', ' . $this->data['warnings'] . ')');
|
||||||
}
|
}
|
||||||
// updates previous one
|
// updates previous one
|
||||||
else
|
else
|
||||||
@ -129,13 +129,13 @@ class OTS_House extends OTS_Row_DAO
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes house info from database.
|
* Deletes house info from database.
|
||||||
*
|
*
|
||||||
* @throws PDOException On PDO operation error.
|
* @throws PDOException On PDO operation error.
|
||||||
*/
|
*/
|
||||||
public function delete()
|
public function delete()
|
||||||
{
|
{
|
||||||
// deletes row from database
|
// deletes row from database
|
||||||
$this->db->query('DELETE FROM ' . $this->db->tableName('houses') . ' WHERE ' . $this->db->fieldName('id') . ' = ' . $this->data['id']);
|
$this->db->exec('DELETE FROM ' . $this->db->tableName('houses') . ' WHERE ' . $this->db->fieldName('id') . ' = ' . $this->data['id']);
|
||||||
|
|
||||||
// resets object handle
|
// resets object handle
|
||||||
$this->data = array();
|
$this->data = array();
|
||||||
@ -143,7 +143,7 @@ class OTS_House extends OTS_Row_DAO
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns house's ID.
|
* Returns house's ID.
|
||||||
*
|
*
|
||||||
* @return int House ID.
|
* @return int House ID.
|
||||||
* @throws DOMException On DOM operation error.
|
* @throws DOMException On DOM operation error.
|
||||||
*/
|
*/
|
||||||
@ -160,7 +160,7 @@ class OTS_House extends OTS_Row_DAO
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return house's name.
|
* Return house's name.
|
||||||
*
|
*
|
||||||
* @return string House name.
|
* @return string House name.
|
||||||
* @throws DOMException On DOM operation error.
|
* @throws DOMException On DOM operation error.
|
||||||
*/
|
*/
|
||||||
@ -169,7 +169,7 @@ class OTS_House extends OTS_Row_DAO
|
|||||||
if(isset($this->data['name'])) {
|
if(isset($this->data['name'])) {
|
||||||
return $this->data['name'];
|
return $this->data['name'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->element) {
|
if($this->element) {
|
||||||
return $this->element->getAttribute('name');
|
return $this->element->getAttribute('name');
|
||||||
}
|
}
|
||||||
@ -177,7 +177,7 @@ class OTS_House extends OTS_Row_DAO
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns town ID in which house is located.
|
* Returns town ID in which house is located.
|
||||||
*
|
*
|
||||||
* @return int Town ID.
|
* @return int Town ID.
|
||||||
* @throws DOMException On DOM operation error.
|
* @throws DOMException On DOM operation error.
|
||||||
*/
|
*/
|
||||||
@ -192,18 +192,18 @@ class OTS_House extends OTS_Row_DAO
|
|||||||
if(isset($this->data['townid'])) {
|
if(isset($this->data['townid'])) {
|
||||||
return $this->data['townid'];
|
return $this->data['townid'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->element) {
|
if($this->element) {
|
||||||
return (int) $this->element->getAttribute('townid');
|
return (int) $this->element->getAttribute('townid');
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns town name.
|
* Returns town name.
|
||||||
*
|
*
|
||||||
* @return string Town name.
|
* @return string Town name.
|
||||||
* @throws E_OTS_NotLoaded When map file is not loaded to fetch towns names.
|
* @throws E_OTS_NotLoaded When map file is not loaded to fetch towns names.
|
||||||
*/
|
*/
|
||||||
@ -214,7 +214,7 @@ class OTS_House extends OTS_Row_DAO
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns house rent cost.
|
* Returns house rent cost.
|
||||||
*
|
*
|
||||||
* @return int Rent cost.
|
* @return int Rent cost.
|
||||||
* @throws DOMException On DOM operation error.
|
* @throws DOMException On DOM operation error.
|
||||||
*/
|
*/
|
||||||
@ -225,7 +225,7 @@ class OTS_House extends OTS_Row_DAO
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns house size.
|
* Returns house size.
|
||||||
*
|
*
|
||||||
* @return int House size.
|
* @return int House size.
|
||||||
* @throws DOMException On DOM operation error.
|
* @throws DOMException On DOM operation error.
|
||||||
*/
|
*/
|
||||||
@ -236,7 +236,7 @@ class OTS_House extends OTS_Row_DAO
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns entry position.
|
* Returns entry position.
|
||||||
*
|
*
|
||||||
* @return OTS_MapCoords Entry coordinations on map.
|
* @return OTS_MapCoords Entry coordinations on map.
|
||||||
*/
|
*/
|
||||||
public function getEntry()
|
public function getEntry()
|
||||||
@ -248,12 +248,12 @@ class OTS_House extends OTS_Row_DAO
|
|||||||
if( isset($this->data['owner'])) {
|
if( isset($this->data['owner'])) {
|
||||||
return $this->data['owner'];
|
return $this->data['owner'];
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Returns current house owner.
|
* Returns current house owner.
|
||||||
*
|
*
|
||||||
* @return OTS_Player|null Player that currently owns house (null if there is no owner).
|
* @return OTS_Player|null Player that currently owns house (null if there is no owner).
|
||||||
*/
|
*/
|
||||||
public function getOwner()
|
public function getOwner()
|
||||||
@ -273,11 +273,11 @@ class OTS_House extends OTS_Row_DAO
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets house owner.
|
* Sets house owner.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* This method only updates object state. To save changes in database you need to use {@link OTS_House::save() save() method} to flush changed to database.
|
* This method only updates object state. To save changes in database you need to use {@link OTS_House::save() save() method} to flush changed to database.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param OTS_Player $player House owner to be set.
|
* @param OTS_Player $player House owner to be set.
|
||||||
* @throws E_OTS_NotLoaded If given <var>$player</var> object is not loaded.
|
* @throws E_OTS_NotLoaded If given <var>$player</var> object is not loaded.
|
||||||
*/
|
*/
|
||||||
@ -288,7 +288,7 @@ class OTS_House extends OTS_Row_DAO
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns paid date.
|
* Returns paid date.
|
||||||
*
|
*
|
||||||
* @return int|false Date timestamp until which house is rent (false if none).
|
* @return int|false Date timestamp until which house is rent (false if none).
|
||||||
*/
|
*/
|
||||||
public function getPaid()
|
public function getPaid()
|
||||||
@ -306,11 +306,11 @@ class OTS_House extends OTS_Row_DAO
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets paid date.
|
* Sets paid date.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* This method only updates object state. To save changes in database you need to use {@link OTS_House::save() save() method} to flush changed to database.
|
* This method only updates object state. To save changes in database you need to use {@link OTS_House::save() save() method} to flush changed to database.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param int $paid Sets paid timestamp to passed one.
|
* @param int $paid Sets paid timestamp to passed one.
|
||||||
*/
|
*/
|
||||||
public function setPaid($paid)
|
public function setPaid($paid)
|
||||||
@ -320,7 +320,7 @@ class OTS_House extends OTS_Row_DAO
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns house warnings.
|
* Returns house warnings.
|
||||||
*
|
*
|
||||||
* @version 0.1.2
|
* @version 0.1.2
|
||||||
* @return int|false Warnings text (false if none).
|
* @return int|false Warnings text (false if none).
|
||||||
*/
|
*/
|
||||||
@ -339,11 +339,11 @@ class OTS_House extends OTS_Row_DAO
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets house warnings.
|
* Sets house warnings.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* This method only updates object state. To save changes in database you need to use {@link OTS_House::save() save() method} to flush changed to database.
|
* This method only updates object state. To save changes in database you need to use {@link OTS_House::save() save() method} to flush changed to database.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @version 0.1.2
|
* @version 0.1.2
|
||||||
* @param int $warnings Sets house warnings.
|
* @param int $warnings Sets house warnings.
|
||||||
*/
|
*/
|
||||||
@ -356,10 +356,10 @@ class OTS_House extends OTS_Row_DAO
|
|||||||
if(isset($this->data['bid'])) {
|
if(isset($this->data['bid'])) {
|
||||||
return $this->data['bid'];
|
return $this->data['bid'];
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setBid($bid) {
|
public function setBid($bid) {
|
||||||
$this->data['bid'] = $bid;
|
$this->data['bid'] = $bid;
|
||||||
}
|
}
|
||||||
@ -368,10 +368,10 @@ class OTS_House extends OTS_Row_DAO
|
|||||||
if(isset($this->data['bid_end'])) {
|
if(isset($this->data['bid_end'])) {
|
||||||
return $this->data['bid_end'];
|
return $this->data['bid_end'];
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setBidEnd($bid_end) {
|
public function setBidEnd($bid_end) {
|
||||||
$this->data['bid_end'] = $bid_end;
|
$this->data['bid_end'] = $bid_end;
|
||||||
}
|
}
|
||||||
@ -380,7 +380,7 @@ class OTS_House extends OTS_Row_DAO
|
|||||||
if(isset($this->data['last_bid'])) {
|
if(isset($this->data['last_bid'])) {
|
||||||
return $this->data['last_bid'];
|
return $this->data['last_bid'];
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -392,16 +392,16 @@ class OTS_House extends OTS_Row_DAO
|
|||||||
if(isset($this->data['highest_bidder'])) {
|
if(isset($this->data['highest_bidder'])) {
|
||||||
return $this->data['highest_bidder'];
|
return $this->data['highest_bidder'];
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setHighestBidder($highest_bidder) {
|
public function setHighestBidder($highest_bidder) {
|
||||||
$this->data['highest_bidder'] = $highest_bidder;
|
$this->data['highest_bidder'] = $highest_bidder;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Adds tile to house.
|
* Adds tile to house.
|
||||||
*
|
*
|
||||||
* @param OTS_MapCoords $tile Tile to be added.
|
* @param OTS_MapCoords $tile Tile to be added.
|
||||||
*/
|
*/
|
||||||
public function addTile(OTS_MapCoords $tile)
|
public function addTile(OTS_MapCoords $tile)
|
||||||
@ -411,11 +411,11 @@ class OTS_House extends OTS_Row_DAO
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns tiles list.
|
* Returns tiles list.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* This returns list of coords of tiles used by this house on map. It will succeed only if house object was created during map loading with houses file opened to assign loaded tiles.
|
* This returns list of coords of tiles used by this house on map. It will succeed only if house object was created during map loading with houses file opened to assign loaded tiles.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @return array List of tiles.
|
* @return array List of tiles.
|
||||||
*/
|
*/
|
||||||
public function getTiles()
|
public function getTiles()
|
||||||
@ -425,7 +425,7 @@ class OTS_House extends OTS_Row_DAO
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Magic PHP5 method.
|
* Magic PHP5 method.
|
||||||
*
|
*
|
||||||
* @param string $name Property name.
|
* @param string $name Property name.
|
||||||
* @return mixed Property value.
|
* @return mixed Property value.
|
||||||
* @throws E_OTS_NotLoaded When atempt to read info about map while map not being loaded.
|
* @throws E_OTS_NotLoaded When atempt to read info about map while map not being loaded.
|
||||||
@ -476,7 +476,7 @@ class OTS_House extends OTS_Row_DAO
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Magic PHP5 method.
|
* Magic PHP5 method.
|
||||||
*
|
*
|
||||||
* @param string $name Property name.
|
* @param string $name Property name.
|
||||||
* @param mixed $value Property value.
|
* @param mixed $value Property value.
|
||||||
* @throws E_OTS_NotLoaded If passed parameter for owner field won't be loaded.
|
* @throws E_OTS_NotLoaded If passed parameter for owner field won't be loaded.
|
||||||
@ -505,11 +505,11 @@ class OTS_House extends OTS_Row_DAO
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns string representation of object.
|
* Returns string representation of object.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* If any display driver is currently loaded then it uses it's method. Otherwise just returns house ID.
|
* If any display driver is currently loaded then it uses it's method. Otherwise just returns house ID.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @version 0.1.3
|
* @version 0.1.3
|
||||||
* @since 0.1.3
|
* @since 0.1.3
|
||||||
* @return string String representation of object.
|
* @return string String representation of object.
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* List of players.
|
* List of players.
|
||||||
*
|
*
|
||||||
* @package POT
|
* @package POT
|
||||||
* @version 0.1.3
|
* @version 0.1.3
|
||||||
*/
|
*/
|
||||||
@ -23,16 +23,16 @@ class OTS_Players_List extends OTS_Base_List
|
|||||||
*/
|
*/
|
||||||
public function deletePlayer(OTS_Player $player)
|
public function deletePlayer(OTS_Player $player)
|
||||||
{
|
{
|
||||||
$this->db->query('DELETE FROM ' . $this->db->tableName('players') . ' WHERE ' . $this->db->fieldName('id') . ' = ' . $player->getId() );
|
$this->db->exec('DELETE FROM ' . $this->db->tableName('players') . ' WHERE ' . $this->db->fieldName('id') . ' = ' . $player->getId() );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets list parameters.
|
* Sets list parameters.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* This method is called at object creation.
|
* This method is called at object creation.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @version 0.0.5
|
* @version 0.0.5
|
||||||
* @since 0.0.5
|
* @since 0.0.5
|
||||||
*/
|
*/
|
||||||
@ -44,11 +44,11 @@ class OTS_Players_List extends OTS_Base_List
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns string representation of object.
|
* Returns string representation of object.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* If any display driver is currently loaded then it uses it's method.
|
* If any display driver is currently loaded then it uses it's method.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @version 0.1.3
|
* @version 0.1.3
|
||||||
* @since 0.1.0
|
* @since 0.1.0
|
||||||
* @return string String representation of object.
|
* @return string String representation of object.
|
||||||
|
@ -13,7 +13,7 @@ defined('MYAAC') or die('Direct access not allowed!');
|
|||||||
class Spells {
|
class Spells {
|
||||||
private static $spellsList = null;
|
private static $spellsList = null;
|
||||||
private static $lastError = '';
|
private static $lastError = '';
|
||||||
|
|
||||||
// 1 - attack, 2 - healing, 3 - summon, 4 - supply, 5 - support
|
// 1 - attack, 2 - healing, 3 - summon, 4 - supply, 5 - support
|
||||||
public static function loadGroup($tGroup) {
|
public static function loadGroup($tGroup) {
|
||||||
switch ($tGroup) {
|
switch ($tGroup) {
|
||||||
@ -22,24 +22,24 @@ class Spells {
|
|||||||
case "healing":
|
case "healing":
|
||||||
return 2;
|
return 2;
|
||||||
case "summon":
|
case "summon":
|
||||||
return 3;
|
return 3;
|
||||||
case "supply":
|
case "supply":
|
||||||
return 4;
|
return 4;
|
||||||
case "support":
|
case "support":
|
||||||
return 5;
|
return 5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function loadFromXML($show = false) {
|
public static function loadFromXML($show = false) {
|
||||||
global $config, $db;
|
global $config, $db;
|
||||||
|
|
||||||
try { $db->query('DELETE FROM `' . TABLE_PREFIX . 'spells`;'); } catch(PDOException $error) {}
|
try { $db->exec('DELETE FROM `' . TABLE_PREFIX . 'spells`;'); } catch(PDOException $error) {}
|
||||||
|
|
||||||
if($show) {
|
if($show) {
|
||||||
echo '<h2>Reload spells.</h2>';
|
echo '<h2>Reload spells.</h2>';
|
||||||
echo '<h2>All records deleted from table <b>' . TABLE_PREFIX . 'spells</b> in database.</h2>';
|
echo '<h2>All records deleted from table <b>' . TABLE_PREFIX . 'spells</b> in database.</h2>';
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
self::$spellsList = new OTS_SpellsList($config['data_path'].'spells/spells.xml');
|
self::$spellsList = new OTS_SpellsList($config['data_path'].'spells/spells.xml');
|
||||||
}
|
}
|
||||||
@ -47,21 +47,21 @@ class Spells {
|
|||||||
self::$lastError = $e->getMessage();
|
self::$lastError = $e->getMessage();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//add conjure spells
|
//add conjure spells
|
||||||
$conjurelist = self::$spellsList->getConjuresList();
|
$conjurelist = self::$spellsList->getConjuresList();
|
||||||
if($show) {
|
if($show) {
|
||||||
echo "<h3>Conjure:</h3>";
|
echo "<h3>Conjure:</h3>";
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($conjurelist as $spellname) {
|
foreach($conjurelist as $spellname) {
|
||||||
$spell = self::$spellsList->getConjure($spellname);
|
$spell = self::$spellsList->getConjure($spellname);
|
||||||
$name = $spell->getName();
|
$name = $spell->getName();
|
||||||
|
|
||||||
$words = $spell->getWords();
|
$words = $spell->getWords();
|
||||||
if(strpos($words, '#') !== false)
|
if(strpos($words, '#') !== false)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$db->insert(TABLE_PREFIX . 'spells', array(
|
$db->insert(TABLE_PREFIX . 'spells', array(
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
@ -89,21 +89,21 @@ class Spells {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// add instant spells
|
// add instant spells
|
||||||
$instantlist = self::$spellsList->getInstantsList();
|
$instantlist = self::$spellsList->getInstantsList();
|
||||||
if($show) {
|
if($show) {
|
||||||
echo "<h3>Instant:</h3>";
|
echo "<h3>Instant:</h3>";
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($instantlist as $spellname) {
|
foreach($instantlist as $spellname) {
|
||||||
$spell = self::$spellsList->getInstant($spellname);
|
$spell = self::$spellsList->getInstant($spellname);
|
||||||
$name = $spell->getName();
|
$name = $spell->getName();
|
||||||
|
|
||||||
$words = $spell->getWords();
|
$words = $spell->getWords();
|
||||||
if(strpos($words, '#') !== false)
|
if(strpos($words, '#') !== false)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$db->insert(TABLE_PREFIX . 'spells', array(
|
$db->insert(TABLE_PREFIX . 'spells', array(
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
@ -118,7 +118,7 @@ class Spells {
|
|||||||
'conjure_count' => 0,
|
'conjure_count' => 0,
|
||||||
'hidden' => $spell->isEnabled() ? 0 : 1
|
'hidden' => $spell->isEnabled() ? 0 : 1
|
||||||
));
|
));
|
||||||
|
|
||||||
if($show) {
|
if($show) {
|
||||||
success('Added: ' . $name . '<br/>');
|
success('Added: ' . $name . '<br/>');
|
||||||
}
|
}
|
||||||
@ -129,13 +129,13 @@ class Spells {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// add runes
|
// add runes
|
||||||
$runeslist = self::$spellsList->getRunesList();
|
$runeslist = self::$spellsList->getRunesList();
|
||||||
if($show) {
|
if($show) {
|
||||||
echo "<h3>Runes:</h3>";
|
echo "<h3>Runes:</h3>";
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($runeslist as $spellname) {
|
foreach($runeslist as $spellname) {
|
||||||
$spell = self::$spellsList->getRune($spellname);
|
$spell = self::$spellsList->getRune($spellname);
|
||||||
|
|
||||||
@ -156,7 +156,7 @@ class Spells {
|
|||||||
'item_id' => $spell->getID(),
|
'item_id' => $spell->getID(),
|
||||||
'hidden' => $spell->isEnabled() ? 0 : 1
|
'hidden' => $spell->isEnabled() ? 0 : 1
|
||||||
));
|
));
|
||||||
|
|
||||||
if($show) {
|
if($show) {
|
||||||
success('Added: ' . $name . '<br/>');
|
success('Added: ' . $name . '<br/>');
|
||||||
}
|
}
|
||||||
@ -167,14 +167,14 @@ class Spells {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getSpellsList() {
|
public static function getSpellsList() {
|
||||||
return self::$spellsList;
|
return self::$spellsList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getLastError() {
|
public static function getLastError() {
|
||||||
return self::$lastError;
|
return self::$lastError;
|
||||||
}
|
}
|
||||||
|
@ -16,21 +16,21 @@ class Weapons {
|
|||||||
public static function loadFromXML($show = false)
|
public static function loadFromXML($show = false)
|
||||||
{
|
{
|
||||||
global $config, $db;
|
global $config, $db;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$db->query("DELETE FROM `myaac_weapons`;");
|
$db->exec("DELETE FROM `myaac_weapons`;");
|
||||||
} catch (PDOException $error) {
|
} catch (PDOException $error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$file_path = $config['data_path'] . 'weapons/weapons.xml';
|
$file_path = $config['data_path'] . 'weapons/weapons.xml';
|
||||||
if (!file_exists($file_path)) {
|
if (!file_exists($file_path)) {
|
||||||
self::$error = 'Cannot load file ' . $file_path;
|
self::$error = 'Cannot load file ' . $file_path;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$xml = new DOMDocument;
|
$xml = new DOMDocument;
|
||||||
$xml->load($file_path);
|
$xml->load($file_path);
|
||||||
|
|
||||||
foreach ($xml->getElementsByTagName('wand') as $weapon) {
|
foreach ($xml->getElementsByTagName('wand') as $weapon) {
|
||||||
self::parseNode($weapon, $show);
|
self::parseNode($weapon, $show);
|
||||||
}
|
}
|
||||||
@ -40,18 +40,18 @@ class Weapons {
|
|||||||
foreach ($xml->getElementsByTagName('distance') as $weapon) {
|
foreach ($xml->getElementsByTagName('distance') as $weapon) {
|
||||||
self::parseNode($weapon, $show);
|
self::parseNode($weapon, $show);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function parseNode($node, $show = false) {
|
public static function parseNode($node, $show = false) {
|
||||||
global $config, $db;
|
global $config, $db;
|
||||||
|
|
||||||
$id = (int)$node->getAttribute('id');
|
$id = (int)$node->getAttribute('id');
|
||||||
$vocations_ids = array_flip($config['vocations']);
|
$vocations_ids = array_flip($config['vocations']);
|
||||||
$level = (int)$node->getAttribute('level');
|
$level = (int)$node->getAttribute('level');
|
||||||
$maglevel = (int)$node->getAttribute('maglevel');
|
$maglevel = (int)$node->getAttribute('maglevel');
|
||||||
|
|
||||||
$vocations = array();
|
$vocations = array();
|
||||||
foreach($node->getElementsByTagName('vocation') as $vocation) {
|
foreach($node->getElementsByTagName('vocation') as $vocation) {
|
||||||
$show = $vocation->getAttribute('showInDescription');
|
$show = $vocation->getAttribute('showInDescription');
|
||||||
@ -60,10 +60,10 @@ class Weapons {
|
|||||||
else {
|
else {
|
||||||
$voc_id = $vocations_ids[$vocation->getAttribute('name')];
|
$voc_id = $vocations_ids[$vocation->getAttribute('name')];
|
||||||
}
|
}
|
||||||
|
|
||||||
$vocations[$voc_id] = strlen($show) == 0 || $show != '0';
|
$vocations[$voc_id] = strlen($show) == 0 || $show != '0';
|
||||||
}
|
}
|
||||||
|
|
||||||
$exist = $db->query('SELECT `id` FROM `' . TABLE_PREFIX . 'weapons` WHERE `id` = ' . $id);
|
$exist = $db->query('SELECT `id` FROM `' . TABLE_PREFIX . 'weapons` WHERE `id` = ' . $id);
|
||||||
if($exist->rowCount() > 0) {
|
if($exist->rowCount() > 0) {
|
||||||
if($show) {
|
if($show) {
|
||||||
@ -74,7 +74,7 @@ class Weapons {
|
|||||||
$db->insert(TABLE_PREFIX . 'weapons', array('id' => $id, 'level' => $level, 'maglevel' => $maglevel, 'vocations' => json_encode($vocations)));
|
$db->insert(TABLE_PREFIX . 'weapons', array('id' => $id, 'level' => $level, 'maglevel' => $maglevel, 'vocations' => json_encode($vocations)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getError() {
|
public static function getError() {
|
||||||
return self::$error;
|
return self::$error;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$db->query("ALTER TABLE `" . TABLE_PREFIX . "forum` ADD `post_html` TINYINT(1) NOT NULL DEFAULT 0 AFTER `post_smile`;");
|
$db->exec("ALTER TABLE `" . TABLE_PREFIX . "forum` ADD `post_html` TINYINT(1) NOT NULL DEFAULT 0 AFTER `post_smile`;");
|
||||||
|
|
||||||
$query = $db->query("SELECT `id` FROM `" . TABLE_PREFIX . "forum_boards` WHERE `name` LIKE " . $db->quote('News') . " LIMIT 1;");
|
$query = $db->query("SELECT `id` FROM `" . TABLE_PREFIX . "forum_boards` WHERE `name` LIKE " . $db->quote('News') . " LIMIT 1;");
|
||||||
if($query->rowCount() == 0) {
|
if($query->rowCount() == 0) {
|
||||||
@ -11,4 +11,4 @@ $query = $query->fetch();
|
|||||||
$id = $query['id'];
|
$id = $query['id'];
|
||||||
|
|
||||||
// update all forum threads with is_html = 1
|
// update all forum threads with is_html = 1
|
||||||
$db->query("UPDATE `" . TABLE_PREFIX . "forum` SET `post_html` = 1 WHERE `section` = " . $id . " AND `id` = `first_post`;");
|
$db->exec("UPDATE `" . TABLE_PREFIX . "forum` SET `post_html` = 1 WHERE `section` = " . $id . " AND `id` = `first_post`;");
|
@ -120,9 +120,9 @@ if(isset($todo) && $todo == 'save')
|
|||||||
'leader_name' => $player->getName()
|
'leader_name' => $player->getName()
|
||||||
));
|
));
|
||||||
|
|
||||||
/*$db->query('INSERT INTO `guild_ranks` (`id`, `guild_id`, `name`, `level`) VALUES (null, '.$new_guild->getId().', "the Leader", 3)');
|
/*$db->exec('INSERT INTO `guild_ranks` (`id`, `guild_id`, `name`, `level`) VALUES (null, '.$new_guild->getId().', "the Leader", 3)');
|
||||||
$db->query('INSERT INTO `guild_ranks` (`id`, `guild_id`, `name`, `level`) VALUES (null, '.$new_guild->getId().', "a Vice-Leader", 2)');
|
$db->exec('INSERT INTO `guild_ranks` (`id`, `guild_id`, `name`, `level`) VALUES (null, '.$new_guild->getId().', "a Vice-Leader", 2)');
|
||||||
$db->query('INSERT INTO `guild_ranks` (`id`, `guild_id`, `name`, `level`) VALUES (null, '.$new_guild->getId().', "a Member", 1)');*/
|
$db->exec('INSERT INTO `guild_ranks` (`id`, `guild_id`, `name`, `level`) VALUES (null, '.$new_guild->getId().', "a Member", 1)');*/
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sort($array_of_player_nig);
|
sort($array_of_player_nig);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user