diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml
index 610cafed..8c581d8a 100644
--- a/.github/workflows/phpstan.yml
+++ b/.github/workflows/phpstan.yml
@@ -36,9 +36,8 @@ jobs:
with:
path: ${{ steps.composer-cache.outputs.dir }}
# Use composer.json for key, if composer.lock is not committed.
- key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
- #key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
- restore-keys: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
+ key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
+ restore-keys: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
- name: "Install composer dependencies"
run: "composer install"
diff --git a/.gitignore b/.gitignore
index cc9460c2..a7b02182 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,7 +7,6 @@ Thumbs.db
# composer
composer.phar
-composer.lock
vendor
# npm
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7327c8ff..66117c5d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,6 @@
# Changelog
-## [1.0-beta - 02.02.2024]
+## [1.0-beta - 18.05.2024]
Minimum PHP version for this release is 8.1.
@@ -22,7 +22,7 @@ Minimum PHP version for this release is 8.1.
* list of open source libraries used in project page
* auto-loading of themes, commands & pages from plugins/ folder. You need just to place them in correct folder and they will be loaded automatically - this allows better customization, without interfering with core AAC folders. This will allow in the future automatic updates for plugins as well the AAC as whole.
* config.php moved to Admin Panel -> Settings page
-* new console script: aac (comes from MyAAC) - using symfony/console
+* new console script: aac - using symfony/console
* usage: `php aac` (will list all commands by default)
* example: `php aac cache:clear`
* example: `php aac plugin:install theme-example.zip`
@@ -46,7 +46,7 @@ Minimum PHP version for this release is 8.1.
* phpdebug bar (http://phpdebugbar.com/). Activated if env == 'dev', can be also activated in production by enabling "enable_debugbar" in local config
### Changed
-* Composer is now used for external libraries like: Twig, PHPMailer, fast-route etc.
+* Composer and NPM is now used for external libraries like: Twig, PHPMailer, fast-route, jQuery, Bootstrap etc.
* mail support is disabled on fresh install, can be manually enabled by user
* disable add php pages in admin panel for security. Option to disable plugins upload
* visitors counter shows now user browser, and also if its bot
diff --git a/admin/pages/accounts.php b/admin/pages/accounts.php
index 34b3941b..d42a2ee6 100644
--- a/admin/pages/accounts.php
+++ b/admin/pages/accounts.php
@@ -404,6 +404,7 @@ else if (isset($_REQUEST['search'])) {
autocomplete="off" maxlength="20"
value="getLocation(); ?>"/>
+
* This class defines basic mechanisms for all classes that will represent database accessors. However no coding logic is defined here - only connection handling and PHP core-related stuff to enable variouse operations with objects.
*
- *
+ *
*
* This class is mostly usefull when you create own extensions for POT code.
*
- *
+ *
* @return array List of properties that should be saved.
*/
public function __sleep()
@@ -62,7 +62,7 @@ abstract class OTS_Base_DAO implements IOTS_DAO
/**
* Magic PHP5 method.
- *
+ *
*
* Allows object unserialisation.
*
@@ -74,7 +74,7 @@ abstract class OTS_Base_DAO implements IOTS_DAO
/**
* Creates clone of object.
- *
+ *
*
* This is generic class for classes that uses buffer-baser read-write operations (it can also emulate C-like pointers).
*
- *
+ *
*
* Note that unlike NetworkMessage class from OTServ C++ source code, in this one reading and writing positions are separated so you can pararelly read and write it's content like for example using object of this class as stack.
*
* Allows object importing from {@link http://www.php.net/manual/en/function.var-export.php var_export()}.
*
- *
+ *
* @param array $properties List of object properties.
*/
- public static function __set_state($properties)
- {
- $object = new self();
+ public static function __set_state($properties)
+ {
+ $object = new self();
- // loads properties
- foreach($properties as $name => $value)
- {
- $object->$name = $value;
- }
+ // loads properties
+ foreach($properties as $name => $value)
+ {
+ $object->$name = $value;
+ }
- return $object;
- }
+ return $object;
+ }
/**
* Returs properties stream.
- *
+ *
* @return string Properties stream.
*/
- public function getBuffer()
- {
- return $this->buffer;
- }
+ public function getBuffer()
+ {
+ return $this->buffer;
+ }
/**
* Sets properties stream.
- *
+ *
* @param string Properties stream.
*/
- public function setBuffer($buffer)
- {
- $this->buffer = $buffer;
- $this->pos = 0;
- }
+ public function setBuffer($buffer)
+ {
+ $this->buffer = $buffer;
+ $this->pos = 0;
+ }
/**
* Checks if there is anything left in stream.
- *
+ *
* @return bool False if pointer is at the end of stream.
*/
- public function isValid()
- {
- return $this->pos < strlen($this->buffer);
- }
+ public function isValid()
+ {
+ return $this->pos < strlen($this->buffer);
+ }
/**
* Checks stream end state.
- *
+ *
* @param int $size Amount of bytes that are going to be read.
* @throws E_OTS_OutOfBuffer When there is read attemp after end of stream.
*/
- protected function check($size = 1)
- {
- if( strlen($this->buffer) < $this->pos + $size)
- {
- throw new E_OTS_OutOfBuffer();
- }
- }
+ protected function check($size = 1)
+ {
+ if( strlen($this->buffer) < $this->pos + $size)
+ {
+ throw new E_OTS_OutOfBuffer();
+ }
+ }
/**
* Returns single byte.
- *
+ *
* @return int Byte (char) value.
* @throws E_OTS_OutOfBuffer When there is read attemp after end of stream.
*/
- public function getChar()
- {
- // checks buffer size
- $this->check();
+ public function getChar()
+ {
+ // checks buffer size
+ $this->check();
- $value = ord($this->buffer[$this->pos]);
- $this->pos++;
- return $value;
- }
+ $value = ord($this->buffer[$this->pos]);
+ $this->pos++;
+ return $value;
+ }
/**
* Appends single byte to buffer.
- *
+ *
* @param int $char Byte (char) value.
*/
- public function putChar($char)
- {
- $this->buffer .= chr($char);
- }
+ public function putChar($char)
+ {
+ $this->buffer .= chr($char);
+ }
/**
* Returns double byte.
- *
+ *
* @return int Word (short) value.
* @throws E_OTS_OutOfBuffer When there is read attemp after end of stream.
*/
- public function getShort()
- {
- // checks buffer size
- $this->check(2);
+ public function getShort()
+ {
+ // checks buffer size
+ $this->check(2);
- $value = unpack('v', substr($this->buffer, $this->pos, 2) );
- $this->pos += 2;
- return $value[1];
- }
+ $value = unpack('v', substr($this->buffer, $this->pos, 2) );
+ $this->pos += 2;
+ return $value[1];
+ }
/**
* Appends double byte to buffer.
- *
+ *
* @param int $short Word (short) value.
*/
- public function putShort($short)
- {
- $this->buffer .= pack('v', $short);
- }
+ public function putShort($short)
+ {
+ $this->buffer .= pack('v', $short);
+ }
/**
* Returns quater byte.
- *
+ *
* @return int Double word (long) value.
* @throws E_OTS_OutOfBuffer When there is read attemp after end of stream.
*/
- public function getLong()
- {
- // checks buffer size
- $this->check(4);
+ public function getLong()
+ {
+ // checks buffer size
+ $this->check(4);
- $value = unpack('V', substr($this->buffer, $this->pos, 4) );
- $this->pos += 4;
- return $value[1];
- }
+ $value = unpack('V', substr($this->buffer, $this->pos, 4) );
+ $this->pos += 4;
+ return $value[1];
+ }
+
+ public function getLongLong()
+ {
+ // checks buffer size
+ $this->check(8);
+
+ $value = unpack('P', substr($this->buffer, $this->pos, 8) );
+ $this->pos += 8;
+ return $value[1];
+ }
/**
* Appends quater byte to buffer.
- *
+ *
* @param int $long Double word (long) value.
*/
- public function putLong($long)
- {
- $this->buffer .= pack('V', $long);
- }
+ public function putLong($long)
+ {
+ $this->buffer .= pack('V', $long);
+ }
/**
* Returns string from buffer.
- *
+ *
*
* If length is not given then treats first short value from current buffer as string length.
*
- *
+ *
* @param int|bool $length String length.
* @return string First substring.
* @throws E_OTS_OutOfBuffer When there is read attemp after end of stream.
*/
- public function getString($length = false)
- {
- // reads string length if not given
- if($length === false)
- {
- $length = $this->getShort();
- }
+ public function getString($length = false)
+ {
+ // reads string length if not given
+ if($length === false)
+ {
+ $length = $this->getShort();
+ }
- // checks buffer size
- $this->check($length);
+ // checks buffer size
+ $this->check($length);
- // copies substring
- $value = substr($this->buffer, $this->pos, $length);
- $this->pos += $length;
- return $value;
- }
+ // copies substring
+ $value = substr($this->buffer, $this->pos, $length);
+ $this->pos += $length;
+ return $value;
+ }
/**
* Appends string to buffer.
- *
+ *
* @param string $string Binary length.
* @param bool $dynamic Whether if string length is fixed or not (if it is dynamic then length will be inserted as short before string chunk).
*/
- public function putString($string, $dynamic = true)
- {
- // appends string length if requires
- if($dynamic)
- {
- $this->putShort( strlen($string) );
- }
+ public function putString($string, $dynamic = true)
+ {
+ // appends string length if requires
+ if($dynamic)
+ {
+ $this->putShort( strlen($string) );
+ }
- $this->buffer .= $string;
- }
+ $this->buffer .= $string;
+ }
/**
* Empties buffer.
*/
- public function reset()
- {
- $this->__construct();
- }
+ public function reset()
+ {
+ $this->__construct();
+ }
/**
* Returns current read position.
- *
+ *
* @return int Read position.
*/
- public function getPos()
- {
- return $this->pos;
- }
+ public function getPos()
+ {
+ return $this->pos;
+ }
/**
* Seeks current reading position.
- *
+ *
* @param int $pos Read position.
*/
- public function setPos($pos)
- {
- $this->pos = $pos;
- }
+ public function setPos($pos)
+ {
+ $this->pos = $pos;
+ }
/**
* Returns buffer size.
- *
+ *
* @return int Buffer length.
*/
- public function getSize()
- {
- return strlen($this->buffer);
- }
+ public function getSize()
+ {
+ return strlen($this->buffer);
+ }
/**
* Skips given amount of bytes.
- *
+ *
* @param int $n Bytes to skip.
* @throws E_OTS_OutOfBuffer When there is read attemp after end of stream.
*/
- public function skip($n)
- {
- $this->check($n);
- $this->pos += $n;
- }
+ public function skip($n)
+ {
+ $this->check($n);
+ $this->pos += $n;
+ }
/**
* Magic PHP5 method.
- *
+ *
* @param string $name Property name.
* @return mixed Property value.
* @throws OutOfBoundsException For non-supported properties.
* @throws E_OTS_OutOfBuffer When there is read attemp after end of stream.
*/
- public function __get($name)
- {
- switch($name)
- {
- // simple properties
- case 'buffer':
- return $this->buffer;
+ public function __get($name)
+ {
+ switch($name)
+ {
+ // simple properties
+ case 'buffer':
+ return $this->buffer;
- // isValid() wrapper
- case 'valid':
- return $this->isValid();
+ // isValid() wrapper
+ case 'valid':
+ return $this->isValid();
- // getChar() wrapper
- case 'char':
- return $this->getChar();
+ // getChar() wrapper
+ case 'char':
+ return $this->getChar();
- // getShort() wrapper
- case 'short':
- return $this->getShort();
+ // getShort() wrapper
+ case 'short':
+ return $this->getShort();
- // getLong() wrapper
- case 'long':
- return $this->getLong();
+ // getLong() wrapper
+ case 'long':
+ return $this->getLong();
- // getString() wrapper
- case 'string':
- return $this->getString();
+ // getString() wrapper
+ case 'string':
+ return $this->getString();
- // getPos() wrapper
- case 'pos':
- return $this->getPos();
+ // getPos() wrapper
+ case 'pos':
+ return $this->getPos();
- // getSize() wrapper
- case 'size':
- return $this->getSize();
+ // getSize() wrapper
+ case 'size':
+ return $this->getSize();
- default:
- throw new OutOfBoundsException();
- }
- }
+ default:
+ throw new OutOfBoundsException();
+ }
+ }
/**
* Magic PHP5 method.
- *
+ *
* @version 0.1.3
* @param string $name Property name.
* @param mixed $value Property value.
* @throws OutOfBoundsException For non-supported properties.
*/
- public function __set($name, $value)
- {
- switch($name)
- {
- // buffer needs to be reset
- case 'buffer':
- $this->setBuffer($value);
- break;
+ public function __set($name, $value)
+ {
+ switch($name)
+ {
+ // buffer needs to be reset
+ case 'buffer':
+ $this->setBuffer($value);
+ break;
- // putChar() wrapper
- case 'char':
- $this->putChar($value);
- break;
+ // putChar() wrapper
+ case 'char':
+ $this->putChar($value);
+ break;
- // putShort() wrapper
- case 'short':
- $this->putShort($value);
- break;
+ // putShort() wrapper
+ case 'short':
+ $this->putShort($value);
+ break;
- // putLong() wrapper
- case 'long':
- $this->putLong($value);
- break;
+ // putLong() wrapper
+ case 'long':
+ $this->putLong($value);
+ break;
- // putString() wrapper
- case 'string':
- $this->putString($value);
- break;
+ // putString() wrapper
+ case 'string':
+ $this->putString($value);
+ break;
- // setPos() wrapper
- case 'pos':
- $this->setPos($value);
- break;
+ // setPos() wrapper
+ case 'pos':
+ $this->setPos($value);
+ break;
- default:
- throw new OutOfBoundsException();
- }
- }
+ default:
+ throw new OutOfBoundsException();
+ }
+ }
/**
* Returns string representation of buffer object.
- *
+ *
* @return string Object's buffer.
*/
- public function __toString()
- {
- return $this->buffer;
- }
+ public function __toString()
+ {
+ return $this->buffer;
+ }
/**
* Resets pointer of cloned object.
*/
- public function __clone()
- {
- $this->pos = 0;
- }
+ public function __clone()
+ {
+ $this->pos = 0;
+ }
}
/**#@-*/
diff --git a/system/libs/pot/OTS_Monster.php b/system/libs/pot/OTS_Monster.php
index 19482dce..759375f5 100644
--- a/system/libs/pot/OTS_Monster.php
+++ b/system/libs/pot/OTS_Monster.php
@@ -57,10 +57,10 @@ class OTS_Monster extends DOMDocument
* @return string Name.
* @throws DOMException On DOM operation error.
*/
- public function getName()
- {
- return $this->documentElement->getAttribute('name');
- }
+ public function getName()
+ {
+ return $this->documentElement->getAttribute('name');
+ }
/**
* Returns monster race.
@@ -68,10 +68,10 @@ class OTS_Monster extends DOMDocument
* @return string Race.
* @throws DOMException On DOM operation error.
*/
- public function getRace()
- {
- return $this->documentElement->getAttribute('race');
- }
+ public function getRace()
+ {
+ return $this->documentElement->getAttribute('race');
+ }
/**
* Returns amount of experience for killing this monster.
@@ -79,10 +79,10 @@ class OTS_Monster extends DOMDocument
* @return int Experience points.
* @throws DOMException On DOM operation error.
*/
- public function getExperience()
- {
- return (int) $this->documentElement->getAttribute('experience');
- }
+ public function getExperience()
+ {
+ return (int) $this->documentElement->getAttribute('experience');
+ }
/**
* Returns monster speed.
@@ -90,10 +90,10 @@ class OTS_Monster extends DOMDocument
* @return int Speed.
* @throws DOMException On DOM operation error.
*/
- public function getSpeed()
- {
- return (int) $this->documentElement->getAttribute('speed');
- }
+ public function getSpeed()
+ {
+ return (int) $this->documentElement->getAttribute('speed');
+ }
/**
* Returns amount of mana required to summon this monster.
@@ -101,18 +101,18 @@ class OTS_Monster extends DOMDocument
* @return int|bool Mana required (false if not possible).
* @throws DOMException On DOM operation error.
*/
- public function getManaCost()
- {
- // check if it is possible to summon this monster
- if( $this->documentElement->hasAttribute('manacost') )
- {
- return (int) $this->documentElement->getAttribute('manacost');
- }
- else
- {
- return false;
- }
- }
+ public function getManaCost()
+ {
+ // check if it is possible to summon this monster
+ if( $this->documentElement->hasAttribute('manacost') )
+ {
+ return (int) $this->documentElement->getAttribute('manacost');
+ }
+ else
+ {
+ return false;
+ }
+ }
/**
* Returns monster HP.
@@ -120,10 +120,10 @@ class OTS_Monster extends DOMDocument
* @return int Hit points.
* @throws DOMException On DOM operation error.
*/
- public function getHealth()
- {
- return (int) $this->documentElement->getElementsByTagName('health')->item(0)->getAttribute('max');
- }
+ public function getHealth()
+ {
+ return (int) $this->documentElement->getElementsByTagName('health')->item(0)->getAttribute('max');
+ }
/**
* Returns all monster flags (in format flagname => value).
@@ -131,20 +131,21 @@ class OTS_Monster extends DOMDocument
* @return array Flags.
* @throws DOMException On DOM operation error.
*/
- public function getFlags()
- {
- $flags = array();
+ public function getFlags()
+ {
+ $flags = array();
- // read all flags
- foreach( $this->documentElement->getElementsByTagName('flags')->item(0)->getElementsByTagName('flag') as $flag)
- {
- $flag = $flag->attributes->item(0);
+ if ($this->documentElement->getElementsByTagName('flags')->item(0)) {
+ foreach( $this->documentElement->getElementsByTagName('flags')->item(0)->getElementsByTagName('flag') as $flag)
+ {
+ $flag = $flag->attributes->item(0);
- $flags[$flag->nodeName] = (int) $flag->nodeValue;
- }
+ $flags[$flag->nodeName] = (int) $flag->nodeValue;
+ }
+ }
- return $flags;
- }
+ return $flags;
+ }
/**
* Returns specified flag value.
@@ -153,21 +154,21 @@ class OTS_Monster extends DOMDocument
* @return int|bool Flag value (false if not set).
* @throws DOMException On DOM operation error.
*/
- public function getFlag($flag)
- {
- // searches for flag
- foreach( $this->documentElement->getElementsByTagName('flags')->item(0)->getElementsByTagName('flag') as $flag)
- {
- // found
- if( $flag->hasAttribute($flag) )
- {
- return (int) $flag->getAttribute($flag);
- }
- }
+ public function getFlag($flag)
+ {
+ // searches for flag
+ foreach( $this->documentElement->getElementsByTagName('flags')->item(0)->getElementsByTagName('flag') as $flag)
+ {
+ // found
+ if( $flag->hasAttribute($flag) )
+ {
+ return (int) $flag->getAttribute($flag);
+ }
+ }
- // not found
- return false;
- }
+ // not found
+ return false;
+ }
/**
* Returns voices that monster can sound.
@@ -175,64 +176,64 @@ class OTS_Monster extends DOMDocument
* @return array List of voices.
* @throws DOMException On DOM operation error.
*/
- public function getVoices()
- {
- $voices = array();
+ public function getVoices()
+ {
+ $voices = array();
- $element = $this->documentElement->getElementsByTagName('voices')->item(0);
+ $element = $this->documentElement->getElementsByTagName('voices')->item(0);
- // checks if it has any voices
- if( isset($element) )
- {
- // loads all voices
- foreach( $element->getElementsByTagName('voice') as $voice)
- {
- $voices[] = $voice->getAttribute('sentence');
- }
- }
+ // checks if it has any voices
+ if( isset($element) )
+ {
+ // loads all voices
+ foreach( $element->getElementsByTagName('voice') as $voice)
+ {
+ $voices[] = $voice->getAttribute('sentence');
+ }
+ }
- return $voices;
- }
+ return $voices;
+ }
/**
* @return array List of item IDs.
*/
- public function getLoot()
- {
- $loot = array();
+ public function getLoot()
+ {
+ $loot = array();
- $element = $this->documentElement->getElementsByTagName('loot')->item(0);
+ $element = $this->documentElement->getElementsByTagName('loot')->item(0);
- // checks if it has any loot
- if( isset($element) )
- {
- // adds all items
- foreach( $element->getElementsByTagName('item') as $item)
- {
- $chance = $item->getAttribute('chance');
- if(empty($chance)) {
- $chance = $item->getAttribute('chance1');
- if(empty($chance)) {
- $chance = 100000;
- }
- }
+ // checks if it has any loot
+ if( isset($element) )
+ {
+ // adds all items
+ foreach( $element->getElementsByTagName('item') as $item)
+ {
+ $chance = $item->getAttribute('chance');
+ if(empty($chance)) {
+ $chance = $item->getAttribute('chance1');
+ if(empty($chance)) {
+ $chance = 100000;
+ }
+ }
- $count = $item->getAttribute('countmax');
- if(empty($count)) {
- $count = 1;
- }
+ $count = $item->getAttribute('countmax');
+ if(empty($count)) {
+ $count = 1;
+ }
- $id = $item->getAttribute('id');
- if(empty($id)) {
- $id = $item->getAttribute('name');
- }
+ $id = $item->getAttribute('id');
+ if(empty($id)) {
+ $id = $item->getAttribute('name');
+ }
- $loot[] = array('id' => $id, 'count' => $count, 'chance' => $chance);
- }
- }
+ $loot[] = array('id' => $id, 'count' => $count, 'chance' => $chance);
+ }
+ }
- return $loot;
- }
+ return $loot;
+ }
/**
* Returns all possible loot.
@@ -247,33 +248,33 @@ class OTS_Monster extends DOMDocument
* @throws E_OTS_NotLoaded When there is no items list available in global POT instance.
* @throws DOMException On DOM operation error.
*/
- public function getItems()
- {
- $loot = array();
- $keys = array();
- $items = POT::getInstance()->getItemsList();
+ public function getItems()
+ {
+ $loot = array();
+ $keys = array();
+ $items = POT::getInstance()->getItemsList();
- $element = $this->documentElement->getElementsByTagName('loot')->item(0);
+ $element = $this->documentElement->getElementsByTagName('loot')->item(0);
- // checks if it has any loot
- if( isset($element) )
- {
- // adds all items
- foreach( $element->getElementsByTagName('item') as $item)
- {
- $id = $item->getAttribute('id');
+ // checks if it has any loot
+ if( isset($element) )
+ {
+ // adds all items
+ foreach( $element->getElementsByTagName('item') as $item)
+ {
+ $id = $item->getAttribute('id');
- // avoid redundancy
- if( !in_array($id, $keys) )
- {
- $keys[] = $id;
- $loot[] = $items->getItemType($id);
- }
- }
- }
+ // avoid redundancy
+ if( !in_array($id, $keys) )
+ {
+ $keys[] = $id;
+ $loot[] = $items->getItemType($id);
+ }
+ }
+ }
- return $loot;
- }
+ return $loot;
+ }
/**
* Returns look of the monster.
@@ -281,27 +282,27 @@ class OTS_Monster extends DOMDocument
* @return array Look with all the attributes of the look.
* @throws DOMException On DOM operation error.
*/
- public function getLook()
- {
- $look = array();
+ public function getLook()
+ {
+ $look = array();
- $element = $this->documentElement->getElementsByTagName('look')->item(0);
+ $element = $this->documentElement->getElementsByTagName('look')->item(0);
- if (!$element) {
- return $look;
- }
+ if (!$element) {
+ return $look;
+ }
- $look['type'] = $element->getAttribute('type');
- $look['typeex'] = $element->getAttribute('typeex');
- $look['head'] = $element->getAttribute('head');
- $look['body'] = $element->getAttribute('body');
- $look['legs'] = $element->getAttribute('legs');
- $look['feet'] = $element->getAttribute('feet');
- $look['addons'] = $element->getAttribute('addons');
- $look['corpse'] = $element->getAttribute('corpse');
+ $look['type'] = $element->getAttribute('type');
+ $look['typeex'] = $element->getAttribute('typeex');
+ $look['head'] = $element->getAttribute('head');
+ $look['body'] = $element->getAttribute('body');
+ $look['legs'] = $element->getAttribute('legs');
+ $look['feet'] = $element->getAttribute('feet');
+ $look['addons'] = $element->getAttribute('addons');
+ $look['corpse'] = $element->getAttribute('corpse');
- return $look;
- }
+ return $look;
+ }
/**
* Returns all monster summons.
@@ -311,24 +312,24 @@ class OTS_Monster extends DOMDocument
*/
public function getSummons()
- {
- $summons = array();
+ {
+ $summons = array();
- $element = $this->documentElement->getElementsByTagName('summons')->item(0);
+ $element = $this->documentElement->getElementsByTagName('summons')->item(0);
- // checks if it has any Summons
- if( isset($element) )
- {
- // adds all summons
- foreach( $element->getElementsByTagName('summon') as $item)
- {
- $chance = $item->getAttribute('chance');
- $id = $item->getAttribute('name');
- $summons[] = array('name' => $id, 'chance' => $chance);
- }
- }
- return $summons;
- }
+ // checks if it has any Summons
+ if( isset($element) )
+ {
+ // adds all summons
+ foreach( $element->getElementsByTagName('summon') as $item)
+ {
+ $chance = $item->getAttribute('chance');
+ $id = $item->getAttribute('name');
+ $summons[] = array('name' => $id, 'chance' => $chance);
+ }
+ }
+ return $summons;
+ }
/**
* Returns all monster elements.
@@ -336,30 +337,30 @@ class OTS_Monster extends DOMDocument
* @return array elements.
* @throws DOMException On DOM operation error.
*/
- public function getElements()
- {
- $elements = array();
+ public function getElements()
+ {
+ $elements = array();
- $element = $this->documentElement->getElementsByTagName('elements')->item(0);
+ $element = $this->documentElement->getElementsByTagName('elements')->item(0);
- // checks if it has any elements
- if( isset($element) )
- {
- // read all elements
- foreach( $element->getElementsByTagName('element') as $elementv)
- {
- $elementv = $elementv->attributes->item(0);
+ // checks if it has any elements
+ if( isset($element) )
+ {
+ // read all elements
+ foreach( $element->getElementsByTagName('element') as $elementv)
+ {
+ $elementv = $elementv->attributes->item(0);
- // checks if element is set
- if($elementv->nodeValue > 0)
- {
+ // checks if element is set
+ if($elementv->nodeValue > 0)
+ {
$elements[] = array('name' => ucfirst(str_replace('Percent', '', $elementv->nodeName)), 'percent' => $elementv->nodeValue);
- }
- }
- }
+ }
+ }
+ }
- return $elements;
- }
+ return $elements;
+ }
/**
* Checks if monster has given element.
@@ -368,26 +369,26 @@ class OTS_Monster extends DOMDocument
* @return bool element state.
* @throws DOMException On DOM operation error.
*/
- public function hasElement($name)
- {
- $element = $this->documentElement->getElementsByTagName('elements')->item(0);
+ public function hasElement($name)
+ {
+ $element = $this->documentElement->getElementsByTagName('elements')->item(0);
- // if doesn't have any elements obviously doesn't have this one too
- if( isset($element) )
- {
- // read all elements
- foreach( $element->getElementsByTagName('element') as $element)
- {
- // checks if this is what we are searching for
- if( $element->hasAttribute($name) )
- {
- return $element->getAttribute($name) > 0;
- }
- }
- }
+ // if doesn't have any elements obviously doesn't have this one too
+ if( isset($element) )
+ {
+ // read all elements
+ foreach( $element->getElementsByTagName('element') as $element)
+ {
+ // checks if this is what we are searching for
+ if( $element->hasAttribute($name) )
+ {
+ return $element->getAttribute($name) > 0;
+ }
+ }
+ }
- return false;
- }
+ return false;
+ }
/**
* Returns all monster immunities.
@@ -395,30 +396,30 @@ class OTS_Monster extends DOMDocument
* @return array Immunities.
* @throws DOMException On DOM operation error.
*/
- public function getImmunities()
- {
- $immunities = array();
+ public function getImmunities()
+ {
+ $immunities = array();
- $element = $this->documentElement->getElementsByTagName('immunities')->item(0);
+ $element = $this->documentElement->getElementsByTagName('immunities')->item(0);
- // checks if it has any immunities
- if( isset($element) )
- {
- // read all immunities
- foreach( $element->getElementsByTagName('immunity') as $immunity)
- {
- $immunity = $immunity->attributes->item(0);
+ // checks if it has any immunities
+ if( isset($element) )
+ {
+ // read all immunities
+ foreach( $element->getElementsByTagName('immunity') as $immunity)
+ {
+ $immunity = $immunity->attributes->item(0);
- // checks if immunity is set
- if($immunity->nodeValue > 0)
- {
- $immunities[] = $immunity->nodeName;
- }
- }
- }
+ // checks if immunity is set
+ if($immunity->nodeValue > 0)
+ {
+ $immunities[] = $immunity->nodeName;
+ }
+ }
+ }
- return $immunities;
- }
+ return $immunities;
+ }
/**
* Checks if monster has given immunity.
@@ -427,26 +428,26 @@ class OTS_Monster extends DOMDocument
* @return bool Immunity state.
* @throws DOMException On DOM operation error.
*/
- public function hasImmunity($name)
- {
- $element = $this->documentElement->getElementsByTagName('immunities')->item(0);
+ public function hasImmunity($name)
+ {
+ $element = $this->documentElement->getElementsByTagName('immunities')->item(0);
- // if doesn't have any immunities obviously doesn't have this one too
- if( isset($element) )
- {
- // read all immunities
- foreach( $element->getElementsByTagName('immunity') as $immunity)
- {
- // checks if this is what we are searching for
- if( $immunity->hasAttribute($name) )
- {
- return $immunity->getAttribute($name) > 0;
- }
- }
- }
+ // if doesn't have any immunities obviously doesn't have this one too
+ if( isset($element) )
+ {
+ // read all immunities
+ foreach( $element->getElementsByTagName('immunity') as $immunity)
+ {
+ // checks if this is what we are searching for
+ if( $immunity->hasAttribute($name) )
+ {
+ return $immunity->getAttribute($name) > 0;
+ }
+ }
+ }
- return false;
- }
+ return false;
+ }
/**
* Returns monster defense rate.
@@ -454,18 +455,18 @@ class OTS_Monster extends DOMDocument
* @return int Defense rate.
* @throws DOMException On DOM operation error.
*/
- public function getDefense()
- {
- $element = $this->documentElement->getElementsByTagName('defenses')->item(0);
+ public function getDefense()
+ {
+ $element = $this->documentElement->getElementsByTagName('defenses')->item(0);
- // checks if defenses element is set
- if( isset($element) )
- {
- return (int) $element->getAttribute('defense');
- }
+ // checks if defenses element is set
+ if( isset($element) )
+ {
+ return (int) $element->getAttribute('defense');
+ }
- return 0;
- }
+ return 0;
+ }
/**
* Returns monster armor.
@@ -473,18 +474,18 @@ class OTS_Monster extends DOMDocument
* @return int Armor rate.
* @throws DOMException On DOM operation error.
*/
- public function getArmor()
- {
- $element = $this->documentElement->getElementsByTagName('defenses')->item(0);
+ public function getArmor()
+ {
+ $element = $this->documentElement->getElementsByTagName('defenses')->item(0);
- // checks if defenses element is set
- if( isset($element) )
- {
- return (int) $element->getAttribute('armor');
- }
+ // checks if defenses element is set
+ if( isset($element) )
+ {
+ return (int) $element->getAttribute('armor');
+ }
- return 0;
- }
+ return 0;
+ }
/**
* Returns list of special defenses.
@@ -492,23 +493,23 @@ class OTS_Monster extends DOMDocument
* @return array List of defense effects.
* @throws DOMException On DOM operation error.
*/
- public function getDefenses()
- {
- $defenses = array();
+ public function getDefenses()
+ {
+ $defenses = array();
- $element = $this->documentElement->getElementsByTagName('defenses')->item(0);
+ $element = $this->documentElement->getElementsByTagName('defenses')->item(0);
- // checks if it has any defenses
- if( isset($element) )
- {
- foreach( $element->getElementsByTagName('defense') as $defense)
- {
- $defenses[] = $defense->getAttribute('name');
- }
- }
+ // checks if it has any defenses
+ if( isset($element) )
+ {
+ foreach( $element->getElementsByTagName('defense') as $defense)
+ {
+ $defenses[] = $defense->getAttribute('name');
+ }
+ }
- return $defenses;
- }
+ return $defenses;
+ }
/**
* Returns list of monster attacks.
@@ -516,23 +517,23 @@ class OTS_Monster extends DOMDocument
* @return array List of attafck effects.
* @throws DOMException On DOM operation error.
*/
- public function getAttacks()
- {
- $attacks = array();
+ public function getAttacks()
+ {
+ $attacks = array();
- $element = $this->documentElement->getElementsByTagName('attacks')->item(0);
+ $element = $this->documentElement->getElementsByTagName('attacks')->item(0);
- // checks if it has any defenses
- if( isset($element) )
- {
- foreach( $element->getElementsByTagName('attack') as $attack)
- {
- $attacks[] = $attack->getAttribute('name');
- }
- }
+ // checks if it has any defenses
+ if( isset($element) )
+ {
+ foreach( $element->getElementsByTagName('attack') as $attack)
+ {
+ $attacks[] = $attack->getAttribute('name');
+ }
+ }
- return $attacks;
- }
+ return $attacks;
+ }
/**
* Magic PHP5 method.
@@ -544,59 +545,59 @@ class OTS_Monster extends DOMDocument
* @throws OutOfBoundsException For non-supported properties.
* @throws DOMException On DOM operation error.
*/
- public function __get($name)
- {
- switch($name)
- {
- case 'name':
- return $this->getName();
+ public function __get($name)
+ {
+ switch($name)
+ {
+ case 'name':
+ return $this->getName();
- case 'race':
- return $this->getRace();
+ case 'race':
+ return $this->getRace();
- case 'experience':
- return $this->getExperience();
+ case 'experience':
+ return $this->getExperience();
- case 'speed':
- return $this->getSpeed();
+ case 'speed':
+ return $this->getSpeed();
- case 'manaCost':
- return $this->getManaCost();
+ case 'manaCost':
+ return $this->getManaCost();
- case 'health':
- return $this->getHealth();
+ case 'health':
+ return $this->getHealth();
- case 'flags':
- return $this->getFlags();
+ case 'flags':
+ return $this->getFlags();
- case 'voices':
- return $this->getVoices();
+ case 'voices':
+ return $this->getVoices();
- case 'items':
- return $this->getItems();
+ case 'items':
+ return $this->getItems();
- case 'immunities':
- return $this->getImmunities();
+ case 'immunities':
+ return $this->getImmunities();
- case 'defense':
- return $this->getDefense();
+ case 'defense':
+ return $this->getDefense();
- case 'armor':
- return $this->getArmor();
+ case 'armor':
+ return $this->getArmor();
- case 'defenses':
- return $this->getDefenses();
+ case 'defenses':
+ return $this->getDefenses();
- case 'attacks':
- return $this->getAttacks();
+ case 'attacks':
+ return $this->getAttacks();
- case 'look':
- return $this->getLook();
+ case 'look':
+ return $this->getLook();
- default:
- throw new OutOfBoundsException();
- }
- }
+ default:
+ throw new OutOfBoundsException();
+ }
+ }
/**
* Returns string representation of XML.
@@ -609,18 +610,18 @@ class OTS_Monster extends DOMDocument
* @since 0.1.0
* @return string String representation of object.
*/
- public function __toString()
- {
- $ots = POT::getInstance();
+ public function __toString()
+ {
+ $ots = POT::getInstance();
- // checks if display driver is loaded
- if( $ots->isDataDisplayDriverLoaded() )
- {
- return $ots->getDataDisplayDriver()->displayMonster($this);
- }
+ // checks if display driver is loaded
+ if( $ots->isDataDisplayDriverLoaded() )
+ {
+ return $ots->getDataDisplayDriver()->displayMonster($this);
+ }
- return $this->saveXML();
- }
+ return $this->saveXML();
+ }
}
/**#@-*/
diff --git a/system/libs/pot/OTS_Player.php b/system/libs/pot/OTS_Player.php
index 491a6303..1cc1a7cd 100644
--- a/system/libs/pot/OTS_Player.php
+++ b/system/libs/pot/OTS_Player.php
@@ -90,7 +90,7 @@ class OTS_Player extends OTS_Row_DAO
* @version 0.1.2
* @var array
*/
- private $data = array('sex' => 0, 'vocation' => 0, 'experience' => 0, 'level' => 1, 'maglevel' => 0, 'health' => 100, 'healthmax' => 100, 'mana' => 100, 'manamax' => 100, 'manaspent' => 0, 'soul' => 0, 'lookbody' => 10, 'lookfeet' => 10, 'lookhead' => 10, 'looklegs' => 10, 'looktype' => 136, 'lookaddons' => 0, 'posx' => 0, 'posy' => 0, 'posz' => 0, 'cap' => 0, 'lastlogin' => 0, 'lastip' => 0, 'save' => true, 'skulltime' => 0, 'skull' => 0, 'balance' => 0, 'lastlogout' => 0, 'blessings' => 0, 'stamina' => 0, 'online' => 0, 'comment' => '', 'created' => 0, 'hide' => 0);
+ private $data = array('group_id' => 1, 'sex' => 0, 'vocation' => 0, 'experience' => 0, 'level' => 1, 'maglevel' => 0, 'health' => 100, 'healthmax' => 100, 'mana' => 100, 'manamax' => 100, 'manaspent' => 0, 'soul' => 0, 'lookbody' => 10, 'lookfeet' => 10, 'lookhead' => 10, 'looklegs' => 10, 'looktype' => 136, 'lookaddons' => 0, 'posx' => 0, 'posy' => 0, 'posz' => 0, 'cap' => 0, 'lastlogin' => 0, 'lastip' => 0, 'save' => true, 'skulltime' => 0, 'skull' => 0, 'balance' => 0, 'lastlogout' => 0, 'blessings' => 0, 'stamina' => 0, 'online' => 0, 'comment' => '', 'created' => 0, 'hide' => 0);
/**
* Player skills.
@@ -1229,6 +1229,13 @@ class OTS_Player extends OTS_Row_DAO
$this->data['direction'] = (int) $direction;
}
+ public function getOutfit(): string
+ {
+ $hasLookAddons = $this->db->hasColumn('players', 'lookaddons');
+
+ return setting('core.outfit_images_url') . '?id=' . $this->getLookType() . ($hasLookAddons ? '&addons=' . $this->getLookAddons() : '') . '&head=' . $this->getLookHead() . '&body=' . $this->getLookBody() . '&legs=' . $this->getLookLegs() . '&feet=' . $this->getLookFeet();
+ }
+
/**
* Body color.
*
diff --git a/system/locale/de/install.php b/system/locale/de/install.php
index 85be3b16..ad354609 100644
--- a/system/locale/de/install.php
+++ b/system/locale/de/install.php
@@ -36,6 +36,10 @@ $locale['step_requirements'] = 'Anforderungen';
$locale['step_requirements_title'] = 'Anforderungen überprüfen';
$locale['step_requirements_php_version'] = 'PHP Version';
$locale['step_requirements_write_perms'] = 'Schreibberechtigungen';
+$locale['step_requirements_folder_exists'] = 'Ordner ist vorhanden';
+$locale['step_requirements_folder_not_exists_tools_ext'] = 'NPM Package Manager wird verwendet für externe JavaScript/CSS Bibliotheken.'
+ . ' Es sollte via Command Line installiert werden: https://docs.npmjs.com/downloading-and-installing-node-js-and-npm'
+ . ' Nachdem das Tool installiert wurde, folgende Befehl sollte ausgeführt in dem Hauptordner des MyAACs: "npm install".';
$locale['step_requirements_failed'] = 'Die Installation wird deaktiviert, bis diese Anforderungen erfüllt sind. Für weitere Informationen siehe README Datei.';
$locale['step_requirements_extension'] = '$EXTENSION$ PHP Erweiterung';
diff --git a/system/locale/en/install.php b/system/locale/en/install.php
index 3de85896..e25537c9 100644
--- a/system/locale/en/install.php
+++ b/system/locale/en/install.php
@@ -36,6 +36,10 @@ $locale['step_requirements'] = 'Requirements';
$locale['step_requirements_title'] = 'Requirements check';
$locale['step_requirements_php_version'] = 'PHP Version';
$locale['step_requirements_write_perms'] = 'Write permissions';
+$locale['step_requirements_folder_exists'] = 'Directory exists';
+$locale['step_requirements_folder_not_exists_tools_ext'] = 'NPM Package Manager is used for external JavaScript/CSS libraries.'
+ . ' You need to install it through Command Line: https://docs.npmjs.com/downloading-and-installing-node-js-and-npm'
+ . ' When you done with installing that tool, execute: "npm install" in the main MyAAC folder.';
$locale['step_requirements_failed'] = 'Installation will be disabled until these requirements will be passed. For more informations see README file.';
$locale['step_requirements_extension'] = '$EXTENSION$ PHP extension';
$locale['step_requirements_warning_images_guilds'] = 'Guild logo upload will not work';
diff --git a/system/locale/pl/install.php b/system/locale/pl/install.php
index 1afb2ddd..22204adf 100644
--- a/system/locale/pl/install.php
+++ b/system/locale/pl/install.php
@@ -36,6 +36,10 @@ $locale['step_requirements'] = 'Wymagania';
$locale['step_requirements_title'] = 'Sprawdzanie wymagań';
$locale['step_requirements_php_version'] = 'Wersja PHP';
$locale['step_requirements_write_perms'] = 'Uprawnienia do zapisu';
+$locale['step_requirements_folder_exists'] = 'Folder istnieje';
+$locale['step_requirements_folder_not_exists_tools_ext'] = 'Manadżer Pakietów NPM jest używany do zewnętrznych bibliotek JavaScript/CSS.'
+ . ' Trzeba go zainstalować poprzez wiersz poleceń: https://docs.npmjs.com/downloading-and-installing-node-js-and-npm'
+ . ' Po instalacji narzędzia, wywołaj następujące polecenie w głownym katalogu MyAAC: "npm install".';
$locale['step_requirements_failed'] = 'Instalacja zostanie zablokowana dopóki te wymagania nie zostaną spełnione. Po więcej informacji zasięgnij do pliku README.';
$locale['step_requirements_extension'] = 'Rozszerzenie PHP - $EXTENSION$';
$locale['step_requirements_warning_images_guilds'] = 'Nie będzie możliwości uploadu obrazków gildii';
diff --git a/system/logout.php b/system/logout.php
index 4f653ecb..dd72a455 100644
--- a/system/logout.php
+++ b/system/logout.php
@@ -22,11 +22,5 @@ if(isset($account_logged) && $account_logged->isLoaded()) {
$logged = false;
unset($account_logged);
-
- if(isset($_REQUEST['redirect']))
- {
- header('Location: ' . urldecode($_REQUEST['redirect']));
- exit;
- }
}
}
diff --git a/system/pages/account/base.php b/system/pages/account/base.php
index 75b1cc77..e644b610 100644
--- a/system/pages/account/base.php
+++ b/system/pages/account/base.php
@@ -12,6 +12,8 @@ defined('MYAAC') or die('Direct access not allowed!');
if(!$logged)
{
+ $title = 'Login';
+
if(!empty($errors))
$twig->display('error_box.html.twig', array('errors' => $errors));
@@ -19,7 +21,8 @@ if(!$logged)
'redirect' => $_REQUEST['redirect'] ?? null,
'account' => USE_ACCOUNT_NAME ? 'Name' : 'Number',
'account_login_by' => getAccountLoginByLabel(),
- 'error' => $errors[0] ?? null
+ 'error' => $errors[0] ?? null,
+ 'errors' => $errors ?? [],
));
return;
diff --git a/system/pages/account/change_email.php b/system/pages/account/change-email.php
similarity index 97%
rename from system/pages/account/change_email.php
rename to system/pages/account/change-email.php
index 954d596b..c97b5541 100644
--- a/system/pages/account/change_email.php
+++ b/system/pages/account/change-email.php
@@ -57,14 +57,14 @@ if($email_new_time < 10) {
$twig->display('error_box.html.twig', array('errors' => $errors));
//show form
- $twig->display('account.change_mail.html.twig', array(
+ $twig->display('account.change-email.html.twig', array(
'new_email' => isset($_POST['new_email']) ? $_POST['new_email'] : null
));
}
}
else
{
- $twig->display('account.change_mail.html.twig', array(
+ $twig->display('account.change-email.html.twig', array(
'new_email' => isset($_POST['new_email']) ? $_POST['new_email'] : null
));
}
diff --git a/system/pages/account/change_info.php b/system/pages/account/change-info.php
similarity index 77%
rename from system/pages/account/change_info.php
rename to system/pages/account/change-info.php
index 2a8d4a07..709dce27 100644
--- a/system/pages/account/change_info.php
+++ b/system/pages/account/change-info.php
@@ -26,12 +26,13 @@ if(setting('core.account_country'))
$account = Account::find($account_logged->getId());
$show_form = true;
-$new_rlname = isset($_POST['info_rlname']) ? htmlspecialchars(stripslashes($_POST['info_rlname'])) : NULL;
-$new_location = isset($_POST['info_location']) ? htmlspecialchars(stripslashes($_POST['info_location'])) : NULL;
-$new_country = isset($_POST['info_country']) ? htmlspecialchars(stripslashes($_POST['info_country'])) : NULL;
+$new_rlname = isset($_POST['info_rlname']) ? htmlspecialchars(stripslashes($_POST['info_rlname'])) : '';
+$new_location = isset($_POST['info_location']) ? htmlspecialchars(stripslashes($_POST['info_location'])) : '';
+$new_country = isset($_POST['info_country']) ? htmlspecialchars(stripslashes($_POST['info_country'])) : '';
if(isset($_POST['changeinfosave']) && $_POST['changeinfosave'] == 1) {
- if(!isset($config['countries'][$new_country]))
+ if(setting('core.account_country') && !isset($config['countries'][$new_country])) {
$errors[] = 'Country is not correct.';
+ }
if(empty($errors)) {
//save data from form
@@ -39,7 +40,14 @@ if(isset($_POST['changeinfosave']) && $_POST['changeinfosave'] == 1) {
$account->location = $new_location;
$account->country = $new_country;
$account->save();
- $account_logged->logAction('Changed Real Name to ' . $new_rlname . ', Location to ' . $new_location . ' and Country to ' . $config['countries'][$new_country] . '.');
+
+ $log = 'Changed Real Name to ' . $new_rlname . ', Location to ' . $new_location . '';
+ if(setting('core.account_country')) {
+ $log .= ' and Country to ' . $config['countries'][$new_country] . '';
+ }
+ $log .= '.';
+
+ $account_logged->logAction($log);
$twig->display('success.html.twig', array(
'title' => 'Public Information Changed',
'description' => 'Your public information has been changed.'
@@ -68,7 +76,7 @@ if($show_form) {
$countries[$code] = $country;
}
- $twig->display('account.change_info.html.twig', array(
+ $twig->display('account.change-info.html.twig', array(
'countries' => $countries ?? [],
'account_rlname' => $account_rlname,
'account_location' => $account_location,
diff --git a/system/pages/account/change_password.php b/system/pages/account/change-password.php
similarity index 96%
rename from system/pages/account/change_password.php
rename to system/pages/account/change-password.php
index 309c8dee..bf172455 100644
--- a/system/pages/account/change_password.php
+++ b/system/pages/account/change-password.php
@@ -21,7 +21,7 @@ $new_password = $_POST['newpassword'] ?? NULL;
$new_password_confirm = $_POST['newpassword_confirm'] ?? NULL;
$old_password = $_POST['oldpassword'] ?? NULL;
if(empty($new_password) && empty($new_password_confirm) && empty($old_password)) {
- $twig->display('account.change_password.html.twig');
+ $twig->display('account.change-password.html.twig');
}
else
{
@@ -52,7 +52,7 @@ else
$twig->display('error_box.html.twig', array('errors' => $errors));
//show form
- $twig->display('account.change_password.html.twig');
+ $twig->display('account.change-password.html.twig');
}
else {
$org_pass = $new_password;
diff --git a/system/pages/account/change_comment.php b/system/pages/account/characters/change-comment.php
similarity index 94%
rename from system/pages/account/change_comment.php
rename to system/pages/account/characters/change-comment.php
index e4fb6e42..7fa10c69 100644
--- a/system/pages/account/change_comment.php
+++ b/system/pages/account/characters/change-comment.php
@@ -14,7 +14,7 @@ use MyAAC\Models\Player;
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Change Comment';
-require __DIR__ . '/base.php';
+require PAGES . 'account/base.php';
if(!$logged) {
return;
@@ -68,7 +68,7 @@ if($show_form) {
}
if(isset($player) && $player) {
- $twig->display('account.change_comment.html.twig', array(
+ $twig->display('account.characters.change-comment.html.twig', array(
'player' => $player->toArray()
));
}
diff --git a/system/pages/account/change_name.php b/system/pages/account/characters/change-name.php
similarity index 97%
rename from system/pages/account/change_name.php
rename to system/pages/account/characters/change-name.php
index ef82b9ad..4a23131d 100644
--- a/system/pages/account/change_name.php
+++ b/system/pages/account/characters/change-name.php
@@ -11,7 +11,7 @@
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Change Name';
-require __DIR__ . '/base.php';
+require PAGES . 'account/base.php';
if(!$logged) {
return;
@@ -109,7 +109,7 @@ else
$twig->display('error_box.html.twig', array('errors' => $errors));
}
- $twig->display('account.change_name.html.twig', array(
+ $twig->display('account.characters.change-name.html.twig', array(
'points' => $points,
'errors' => $errors
//'account_players' => $account_logged->getPlayersList()
diff --git a/system/pages/account/change_sex.php b/system/pages/account/characters/change-sex.php
similarity index 96%
rename from system/pages/account/change_sex.php
rename to system/pages/account/characters/change-sex.php
index 7e43b6ff..6c95a6e7 100644
--- a/system/pages/account/change_sex.php
+++ b/system/pages/account/characters/change-sex.php
@@ -11,7 +11,7 @@
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Change Sex';
-require __DIR__ . '/base.php';
+require PAGES . 'account/base.php';
if(!$logged) {
return;
@@ -88,7 +88,7 @@ else
if(!empty($errors)) {
$twig->display('error_box.html.twig', array('errors' => $errors));
}
- $twig->display('account.change_sex.html.twig', array(
+ $twig->display('account.characters.change-sex.html.twig', array(
'players' => $account_logged->getPlayersList(false),
'player_sex' => isset($player) ? $player->getSex() : -1,
'points' => $points
diff --git a/system/pages/account/create_character.php b/system/pages/account/characters/create.php
similarity index 93%
rename from system/pages/account/create_character.php
rename to system/pages/account/characters/create.php
index e68c8773..5ad21dab 100644
--- a/system/pages/account/create_character.php
+++ b/system/pages/account/characters/create.php
@@ -14,7 +14,7 @@ use MyAAC\CreateCharacter;
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Create Character';
-require __DIR__ . '/base.php';
+require PAGES . 'account/base.php';
if(!$logged) {
return;
@@ -43,7 +43,7 @@ if(count($errors) > 0) {
}
if(!$character_created) {
- $twig->display('account.create_character.html.twig', array(
+ $twig->display('account.characters.create.html.twig', array(
'name' => $character_name,
'sex' => $character_sex,
'vocation' => $character_vocation,
diff --git a/system/pages/account/delete_character.php b/system/pages/account/characters/delete.php
similarity index 96%
rename from system/pages/account/delete_character.php
rename to system/pages/account/characters/delete.php
index 7804f01d..af32070b 100644
--- a/system/pages/account/delete_character.php
+++ b/system/pages/account/characters/delete.php
@@ -11,7 +11,7 @@
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Delete Character';
-require __DIR__ . '/base.php';
+require PAGES . 'account/base.php';
if(!$logged) {
return;
@@ -93,5 +93,5 @@ if($show_form) {
$twig->display('error_box.html.twig', array('errors' => $errors));
}
- $twig->display('account.delete_character.html.twig');
+ $twig->display('account.characters.delete.html.twig');
}
diff --git a/system/pages/account/confirm_email.php b/system/pages/account/confirm-email.php
similarity index 61%
rename from system/pages/account/confirm_email.php
rename to system/pages/account/confirm-email.php
index 925aef5e..615dd942 100644
--- a/system/pages/account/confirm_email.php
+++ b/system/pages/account/confirm-email.php
@@ -25,16 +25,20 @@ if(!Account::where('email_hash', $hash)->exists()) {
}
else
{
- if (Account::where('email_hash', $hash)->where('email_verified', 0)->exists()) {
- $query = $query->fetch(PDO::FETCH_ASSOC);
+ $accountModel = Account::where('email_hash', $hash)->where('email_verified', 0)->first();
+ if ($accountModel) {
+ $accountModel->email_verified = 1;
+ $accountModel->save();
+
+ success('You have now verified your e-mail, this will increase the security of your account. Thank you for doing this. You can now log in.');
+
$account = new OTS_Account();
- $account->load($query['id']);
+ $account->load($accountModel->id);
if ($account->isLoaded()) {
$hooks->trigger(HOOK_EMAIL_CONFIRMED, ['account' => $account]);
}
}
-
- Account::where('email_hash', $hash)->update('email_verified', 1);
- success('You have now verified your e-mail, this will increase the security of your account. Thank you for doing this.');
+ else {
+ error('Link has expired.');
+ }
}
-?>
diff --git a/system/pages/account/create.php b/system/pages/account/create.php
index 58e72356..0074f9e3 100644
--- a/system/pages/account/create.php
+++ b/system/pages/account/create.php
@@ -227,7 +227,7 @@ if($save)
$hash = md5(generateRandomString(16, true, true) . $email);
$new_account->setCustomField('email_hash', $hash);
- $verify_url = getLink('account/confirm_email/' . $hash);
+ $verify_url = getLink('account/confirm-email/' . $hash);
$body_html = $twig->render('mail.account.verify.html.twig', array(
'account' => $tmp_account,
'verify_url' => generateLink($verify_url, $verify_url, true)
@@ -236,6 +236,9 @@ if($save)
if(_mail($email, 'New account on ' . $config['lua']['serverName'], $body_html))
{
echo 'Your account has been created.
';
+
+ warning("Before you can login - you need to verify your E-Mail. The verification link has been sent to $email. If the message is not coming - remember to check the SPAM folder.");
+
$twig->display('success.html.twig', array(
'title' => 'Account Created',
'description' => 'Your account ' . $account_type . ' is ' . $tmp_account . ' You will need the account ' . $account_type . ' and your password to play on ' . configLua('serverName') . '.
@@ -252,15 +255,6 @@ if($save)
}
else
{
- if(setting('core.account_create_character_create')) {
- // character creation
- $character_created = $createCharacter->doCreate($character_name, $character_sex, $character_vocation, $character_town, $new_account, $errors);
- if (!$character_created) {
- error('There was an error creating your character. Please create your character later in account management page.');
- error(implode(' ', $errors));
- }
- }
-
if(setting('core.account_create_auto_login')) {
if ($hasBeenCreatedByEMail) {
$_POST['account_login'] = $email;
@@ -311,6 +305,15 @@ if($save)
}
}
+ if(setting('core.account_create_character_create')) {
+ // character creation
+ $character_created = $createCharacter->doCreate($character_name, $character_sex, $character_vocation, $character_town, $new_account, $errors);
+ if (!$character_created) {
+ error('There was an error creating your character. Please create your character later in account management page.');
+ error(implode(' ', $errors));
+ }
+ }
+
return;
}
}
diff --git a/system/pages/account/login.php b/system/pages/account/login.php
index c063c28e..0fce795d 100644
--- a/system/pages/account/login.php
+++ b/system/pages/account/login.php
@@ -9,56 +9,61 @@
* @link https://my-aac.org
*/
defined('MYAAC') or die('Direct access not allowed!');
-$title = 'Login';
// new login with data from form
-if(!$logged && isset($_POST['account_login'], $_POST['password_login']))
+if($logged || !isset($_POST['account_login']) || !isset($_POST['password_login'])) {
+ return;
+}
+
+$login_account = $_POST['account_login'];
+$login_password = $_POST['password_login'];
+$remember_me = isset($_POST['remember_me']);
+if(!empty($login_account) && !empty($login_password))
{
- $login_account = $_POST['account_login'];
- $login_password = $_POST['password_login'];
- $remember_me = isset($_POST['remember_me']);
- if(!empty($login_account) && !empty($login_password))
+ if($cache->enabled())
{
- if($cache->enabled())
+ $tmp = '';
+ if($cache->fetch('failed_logins', $tmp))
{
- $tmp = '';
- if($cache->fetch('failed_logins', $tmp))
+ $tmp = unserialize($tmp);
+ $to_remove = array();
+ foreach($tmp as $ip => $t)
{
- $tmp = unserialize($tmp);
- $to_remove = array();
- foreach($tmp as $ip => $t)
- {
- if(time() - $t['last'] >= 5 * 60)
- $to_remove[] = $ip;
- }
-
- foreach($to_remove as $ip)
- unset($tmp[$ip]);
+ if(time() - $t['last'] >= 5 * 60)
+ $to_remove[] = $ip;
}
- else
- $tmp = array();
- $ip = $_SERVER['REMOTE_ADDR'];
- $t = $tmp[$ip] ?? null;
+ foreach($to_remove as $ip)
+ unset($tmp[$ip]);
}
+ else
+ $tmp = array();
- $account_logged = new OTS_Account();
- if (config('account_login_by_email')) {
- $account_logged->findByEMail($login_account);
+ $ip = $_SERVER['REMOTE_ADDR'];
+ $t = $tmp[$ip] ?? null;
+ }
+
+ $account_logged = new OTS_Account();
+ if (config('account_login_by_email')) {
+ $account_logged->findByEMail($login_account);
+ }
+
+ if (!config('account_login_by_email') || config('account_login_by_email_fallback')) {
+ if(USE_ACCOUNT_NAME || USE_ACCOUNT_NUMBER) {
+ $account_logged->find($login_account);
+ } else {
+ $account_logged->load($login_account, true);
}
+ }
- if (!config('account_login_by_email') || config('account_login_by_email_fallback')) {
- if(USE_ACCOUNT_NAME || USE_ACCOUNT_NUMBER) {
- $account_logged->find($login_account);
- } else {
- $account_logged->load($login_account, true);
- }
+ if($account_logged->isLoaded() && encrypt((USE_ACCOUNT_SALT ? $account_logged->getCustomField('salt') : '') . $login_password) == $account_logged->getPassword()
+ && (!isset($t) || $t['attempts'] < 5)
+ )
+ {
+ if (setting('core.account_mail_verify') && (int)$account_logged->getCustomField('email_verified') !== 1) {
+ $errors[] = 'Your account is not verified. Please verify your email address. If the message is not coming check the SPAM folder in your E-Mail client.';
}
-
- if($account_logged->isLoaded() && encrypt((USE_ACCOUNT_SALT ? $account_logged->getCustomField('salt') : '') . $login_password) == $account_logged->getPassword()
- && (!isset($t) || $t['attempts'] < 5)
- )
- {
+ else {
session_regenerate_id();
setSession('account', $account_logged->getId());
setSession('password', encrypt((USE_ACCOUNT_SALT ? $account_logged->getCustomField('salt') : '') . $login_password));
@@ -82,44 +87,44 @@ if(!$logged && isset($_POST['account_login'], $_POST['password_login']))
$hooks->trigger(HOOK_LOGIN, array('account' => $account_logged, 'password' => $login_password, 'remember_me' => $remember_me));
}
- else
+ }
+ else
+ {
+ $hooks->trigger(HOOK_LOGIN_ATTEMPT, array('account' => $login_account, 'password' => $login_password, 'remember_me' => $remember_me));
+
+ $errorMessage = getAccountLoginByLabel() . ' or password is not correct.';
+
+ // temporary solution for blocking failed login attempts
+ if($cache->enabled())
{
- $hooks->trigger(HOOK_LOGIN_ATTEMPT, array('account' => $login_account, 'password' => $login_password, 'remember_me' => $remember_me));
-
- $errorMessage = getAccountLoginByLabel() . ' or password is not correct.';
-
- // temporary solution for blocking failed login attempts
- if($cache->enabled())
+ if(isset($t))
{
- if(isset($t))
- {
- $t['attempts']++;
- $t['last'] = time();
+ $t['attempts']++;
+ $t['last'] = time();
- if($t['attempts'] >= 5)
- $errors[] = 'A wrong password has been entered 5 times in a row. You are unable to log into your account for the next 5 minutes. Please wait.';
- else
- $errors[] = $errorMessage;
- }
+ if($t['attempts'] >= 5)
+ $errors[] = 'A wrong password has been entered 5 times in a row. You are unable to log into your account for the next 5 minutes. Please wait.';
else
- {
- $t = array('attempts' => 1, 'last' => time());
$errors[] = $errorMessage;
- }
-
- $tmp[$ip] = $t;
- $cache->set('failed_logins', serialize($tmp), 60 * 60); // save for 1 hour
}
- else {
+ else
+ {
+ $t = array('attempts' => 1, 'last' => time());
$errors[] = $errorMessage;
}
+
+ $tmp[$ip] = $t;
+ $cache->set('failed_logins', serialize($tmp), 60 * 60); // save for 1 hour
+ }
+ else {
+ $errors[] = $errorMessage;
}
}
- else {
- $errors[] = 'Please enter your ' . getAccountLoginByLabel() . ' and password.';
-
- $hooks->trigger(HOOK_LOGIN_ATTEMPT, array('account' => $login_account, 'password' => $login_password, 'remember_me' => $remember_me));
- }
-
- $hooks->trigger(HOOK_ACCOUNT_LOGIN_POST);
}
+else {
+ $errors[] = 'Please enter your ' . getAccountLoginByLabel() . ' and password.';
+
+ $hooks->trigger(HOOK_LOGIN_ATTEMPT, array('account' => $login_account, 'password' => $login_password, 'remember_me' => $remember_me));
+}
+
+$hooks->trigger(HOOK_ACCOUNT_LOGIN_POST);
diff --git a/system/pages/account/manage.php b/system/pages/account/manage.php
index 615ffdc7..eff71c78 100644
--- a/system/pages/account/manage.php
+++ b/system/pages/account/manage.php
@@ -22,6 +22,12 @@ if(isset($_REQUEST['redirect']))
{
$redirect = urldecode($_REQUEST['redirect']);
+ // should never happen, unless hacker modify the URL
+ if (!str_contains($redirect, BASE_URL)) {
+ error('Fatal error: Cannot redirect outside the website.');
+ return;
+ }
+
$twig->display('account.redirect.html.twig', array(
'redirect' => $redirect
));
@@ -46,7 +52,7 @@ if(empty($recovery_key))
else
{
if(setting('core.account_generate_new_reckey') && setting('core.mail_enabled'))
- $account_registered = 'Yes ( Buy new Recovery Key )';
+ $account_registered = 'Yes ( Buy new Recovery Key )';
else
$account_registered = 'Yes';
}
diff --git a/system/pages/account/redirect.php b/system/pages/account/redirect.php
index 8abff630..78bc54d9 100644
--- a/system/pages/account/redirect.php
+++ b/system/pages/account/redirect.php
@@ -12,6 +12,12 @@ defined('MYAAC') or die('Direct access not allowed!');
$redirect = urldecode($_REQUEST['redirect']);
+// should never happen, unless hacker modify the URL
+if (!str_contains($redirect, BASE_URL)) {
+ error('Fatal error: Cannot redirect outside the website.');
+ return;
+}
+
$twig->display('account.redirect.html.twig', array(
'redirect' => $redirect
));
diff --git a/system/pages/account/register_new.php b/system/pages/account/register-new.php
similarity index 100%
rename from system/pages/account/register_new.php
rename to system/pages/account/register-new.php
diff --git a/system/pages/characters.php b/system/pages/characters.php
index b2286db6..89f98cf0 100644
--- a/system/pages/characters.php
+++ b/system/pages/characters.php
@@ -8,6 +8,9 @@
* @copyright 2019 MyAAC
* @link https://my-aac.org
*/
+
+use MyAAC\Models\PlayerDeath;
+
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Characters';
@@ -199,7 +202,7 @@ if($player->isLoaded() && !$player->isDeleted())
unset($storage);
}
- if($config['characters']['equipment'] && $db->hasTable('player_items') && $db->hasColumn('player_items', 'pid') && $db->hasColumn('player_items', 'sid') && $db->hasColumn('player_items', 'itemtype')) {
+ if($db->hasTable('player_items') && $db->hasColumn('player_items', 'pid') && $db->hasColumn('player_items', 'sid') && $db->hasColumn('player_items', 'itemtype')) {
$eq_sql = $db->query('SELECT `pid`, `itemtype` FROM player_items WHERE player_id = '.$player->getId().' AND (`pid` >= 1 and `pid` <= 10)');
$equipment = array();
foreach($eq_sql as $eq)
@@ -322,17 +325,36 @@ WHERE killers.death_id = '".$death['id']."' ORDER BY killers.final_hit DESC, kil
$frags = array();
$frag_add_content = '';
- if($config['characters']['frags'] && $db->hasTable('killers')) {
- //frags list by Xampy
- $i = 0;
+ if ($config['characters']['frags']) {
$frags_limit = 10; // frags limit to show? // default: 10
- $player_frags = $db->query('SELECT `player_deaths`.*, `players`.`name`, `killers`.`unjustified` FROM `player_deaths` LEFT JOIN `killers` ON `killers`.`death_id` = `player_deaths`.`id` LEFT JOIN `player_killers` ON `player_killers`.`kill_id` = `killers`.`id` LEFT JOIN `players` ON `players`.`id` = `player_deaths`.`player_id` WHERE `player_killers`.`player_id` = '.$player->getId().' ORDER BY `date` DESC LIMIT 0,'.$frags_limit.';')->fetchAll();
- if(count($player_frags)) {
- $row_count = 0;
- foreach($player_frags as $frag)
- {
- $description = 'Fragged ' . $frag['name'] . ' at level ' . $frag['level'];
- $frags[] = array('time' => $frag['date'], 'description' => $description, 'unjustified' => $frag['unjustified'] != 0);
+
+ if ($db->hasTable('killers')) {
+ //frags list by Xampy
+ $i = 0;
+ $player_frags = $db->query('SELECT `player_deaths`.*, `players`.`name`, `killers`.`unjustified` FROM `player_deaths` LEFT JOIN `killers` ON `killers`.`death_id` = `player_deaths`.`id` LEFT JOIN `player_killers` ON `player_killers`.`kill_id` = `killers`.`id` LEFT JOIN `players` ON `players`.`id` = `player_deaths`.`player_id` WHERE `player_killers`.`player_id` = ' . $player->getId() . ' ORDER BY `date` DESC LIMIT 0,' . $frags_limit . ';')->fetchAll();
+ if (count($player_frags)) {
+ $row_count = 0;
+ foreach ($player_frags as $frag) {
+ $description = 'Fragged ' . $frag['name'] . ' at level ' . $frag['level'];
+ $frags[] = array('time' => $frag['date'], 'description' => $description, 'unjustified' => $frag['unjustified'] != 0);
+ }
+ }
+ }
+ else if($db->hasTable('player_deaths') && $db->hasColumn('player_deaths', 'killed_by')) {
+ $i = 0;
+ $player_frags = PlayerDeath::where('player_deaths.killed_by', $player->getName())
+ ->join('players', 'players.id', '=', 'player_deaths.player_id')
+ ->limit($frags_limit)
+ ->selectRaw('players.name, player_deaths.*')
+ ->orderBy('player_deaths.time', 'DESC')
+ ->get();
+
+ if ($player_frags->count()) {
+ $row_count = 0;
+ foreach ($player_frags as $frag) {
+ $description = 'Fragged ' . $frag->name . ' at level ' . $frag->level;
+ $frags[] = array('time' => $frag->time, 'description' => $description, 'unjustified' => $frag->unjustified != 0);
+ }
}
}
}
diff --git a/system/pages/forum/edit_post.php b/system/pages/forum/edit_post.php
index f42b743f..29ac1bec 100644
--- a/system/pages/forum/edit_post.php
+++ b/system/pages/forum/edit_post.php
@@ -19,7 +19,7 @@ if ($ret === false) {
}
if(!$logged) {
- echo 'You are not logged in. Log in to post on the forum.
';
+ echo 'You are not logged in. Log in to post on the forum.
';
return;
}
diff --git a/system/pages/forum/move_thread.php b/system/pages/forum/move_thread.php
index 86305b4d..cdae005a 100644
--- a/system/pages/forum/move_thread.php
+++ b/system/pages/forum/move_thread.php
@@ -19,7 +19,7 @@ if ($ret === false) {
}
if(!$logged) {
- echo 'You are not logged in. Log in to post on the forum.
';
+ echo 'You are not logged in. Log in to post on the forum.
';
return;
}
diff --git a/system/pages/forum/new_post.php b/system/pages/forum/new_post.php
index 659b4037..c47302b6 100644
--- a/system/pages/forum/new_post.php
+++ b/system/pages/forum/new_post.php
@@ -24,7 +24,7 @@ if(!$logged) {
$extra_url = '?action=new_post&thread_id=' . $_GET['thread_id'];
}
- echo 'You are not logged in. Log in to post on the forum.
';
+ echo 'You are not logged in. Log in to post on the forum.
';
return;
}
diff --git a/system/pages/forum/new_thread.php b/system/pages/forum/new_thread.php
index 7b97f30e..7a66ac27 100644
--- a/system/pages/forum/new_thread.php
+++ b/system/pages/forum/new_thread.php
@@ -24,7 +24,7 @@ if(!$logged) {
$extra_url = '?action=new_thread§ion_id=' . $_GET['section_id'];
}
- echo 'You are not logged in. Log in to post on the forum.
';
+ echo 'You are not logged in. Log in to post on the forum.
';
return;
}
diff --git a/system/pages/forum/remove_post.php b/system/pages/forum/remove_post.php
index 3e234e6f..690b3f75 100644
--- a/system/pages/forum/remove_post.php
+++ b/system/pages/forum/remove_post.php
@@ -19,7 +19,7 @@ if ($ret === false) {
}
if(!$logged) {
- echo 'You are not logged in. Log in to post on the forum.
';
+ echo 'You are not logged in. Log in to post on the forum.
+{% set title = 'Change Email Address' %}
+{% set background = config('darkborder') %}
+{% set content %}
+
+
+
+ New Email Address:
+
+
+
+
+
+
+
+ Password:
+
+
+
+
+
+
+{% endset %}
+{% include 'tables.headline.html.twig' %}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/system/templates/account.change-info.html.twig b/system/templates/account.change-info.html.twig
new file mode 100644
index 00000000..e3481472
--- /dev/null
+++ b/system/templates/account.change-info.html.twig
@@ -0,0 +1,84 @@
+Here you can tell other players about yourself. This information will be displayed alongside the data of your characters. If you do not want to fill in a certain field, just leave it blank.
+{% set title = 'Change Public Information' %}
+{% set background = config('darkborder') %}
+{% set content %}
+
+
+
Real Name:
+
+
+
+
+
+
Location:
+
+
+
+
+ {% if setting('core.account_country') %}
+
+
Country:
+
+
+
+
+
+
+ {% endif %}
+
+{% endset %}
+{% include 'tables.headline.html.twig' %}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/system/templates/account.change-password.html.twig b/system/templates/account.change-password.html.twig
new file mode 100644
index 00000000..56e52c08
--- /dev/null
+++ b/system/templates/account.change-password.html.twig
@@ -0,0 +1,62 @@
+Please enter your current password and a new password. For your security, please enter the new password twice.
+
+{% set title = 'Change Password' %}
+{% set background = config('darkborder') %}
+{% set content %}
+
+
+
+ New Password:
+
+
+
+
+
+
+
+ New Password Again:
+
+
+
+
+
+
+
+ Current Password:
+
+
+
+
+
+
+{% endset %}
+{% include 'tables.headline.html.twig' %}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/system/templates/account.change_info.html.twig b/system/templates/account.change_info.html.twig
deleted file mode 100644
index 067eabc5..00000000
--- a/system/templates/account.change_info.html.twig
+++ /dev/null
@@ -1,102 +0,0 @@
-Here you can tell other players about yourself. This information will be displayed alongside the data of your characters. If you do not want to fill in a certain field, just leave it blank.
-
- {{ csrf() }}
-
-
-
-
-
-
-
-
-
Change Email Address
-
-
-
-
-
-
-
-
-
-
-
-
- New Email Address:
-
-
-
-
-
-
-
- Password:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{ include('buttons.submit.html.twig') }}
-
-
-
-
-
-
-
-
- {{ csrf() }}
-
-
- {{ include('buttons.back.html.twig') }}
-
-
-
-
-
-
-
diff --git a/system/templates/account.change_name.html.twig b/system/templates/account.change_name.html.twig
deleted file mode 100644
index 1fd10609..00000000
--- a/system/templates/account.change_name.html.twig
+++ /dev/null
@@ -1,79 +0,0 @@
-To change a name of character select player and choose a new name.
-Change name cost {{ setting('core.account_change_character_name_price') }} {{ setting('core.donate_column') == 'coins' ? 'coins' : 'premium points' }}. You have {{ points }} {{ setting('core.donate_column') == 'coins' ? 'coins' : 'premium points' }}.
-
- {{ csrf() }}
-
-
-
-
-
-
-
-
-
-
Change Name
-
-
-
-
-
-
-
-
-
-
-
-
Character:
-
-
-
-
-
-
New Name:
-
-
-
-
-
-
Please enter your character name.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{ include('buttons.submit.html.twig') }}
-
-
-
-
-
-
-
-
- {{ csrf() }}
-
-
- {{ include('buttons.back.html.twig') }}
-
-
-
-
-
-
-
-
diff --git a/system/templates/account.change_password.html.twig b/system/templates/account.change_password.html.twig
deleted file mode 100644
index 89ccf592..00000000
--- a/system/templates/account.change_password.html.twig
+++ /dev/null
@@ -1,80 +0,0 @@
-Please enter your current password and a new password. For your security, please enter the new password twice.
-
-
- {{ csrf() }}
-
-
-
-
-
-
-
-
-
Change Password
-
-
-
-
-
-
-
-
-
-
-
-
- New Password:
-
-
-
-
-
-
-
- New Password Again:
-
-
-
-
-
-
-
- Current Password:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{ include('buttons.submit.html.twig') }}
-
-
-
-
-
-
-
-
- {{ csrf() }}
-
-
- {{ include('buttons.back.html.twig') }}
-
-
-
-
-
-
-
diff --git a/system/templates/account.change_sex.html.twig b/system/templates/account.change_sex.html.twig
deleted file mode 100644
index fe0ef6e7..00000000
--- a/system/templates/account.change_sex.html.twig
+++ /dev/null
@@ -1,78 +0,0 @@
-To change a sex of character select player and choose a new sex.
-Change sex cost {{ setting('core.account_change_character_sex_price') }} {{ setting('core.donate_column') == 'coins' ? 'coins' : 'premium points' }}. You have {{ points }} {{ setting('core.donate_column') == 'coins' ? 'coins' : 'premium points' }}.
-
- {{ csrf() }}
-
-
-
-
-
-
-
-
-
-
Change sex
-
-
-
-
-
-
-
-
-
-
-
-
Character:
-
-
-
-
-
-
New Sex:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{ include('buttons.submit.html.twig') }}
-
-
-
-
-
-
-
-
-
- {{ csrf() }}
-
-
- {{ include('buttons.back.html.twig') }}
-
-
-
-
-
-
-
diff --git a/system/templates/account.change_comment.html.twig b/system/templates/account.characters.change-comment.html.twig
similarity index 98%
rename from system/templates/account.change_comment.html.twig
rename to system/templates/account.characters.change-comment.html.twig
index 04e20c0b..8bb94c80 100644
--- a/system/templates/account.change_comment.html.twig
+++ b/system/templates/account.characters.change-comment.html.twig
@@ -1,6 +1,6 @@
Here you can see and edit the information about your character.
If you do not want to specify a certain field, just leave it blank.
-
+
{{ csrf() }}
diff --git a/system/templates/account.characters.change-name.html.twig b/system/templates/account.characters.change-name.html.twig
new file mode 100644
index 00000000..7c0d18f3
--- /dev/null
+++ b/system/templates/account.characters.change-name.html.twig
@@ -0,0 +1,62 @@
+To change a name of character select player and choose a new name.
+Change name cost {{ setting('core.account_change_character_name_price') }} {{ setting('core.donate_column') == 'coins' ? 'coins' : 'premium points' }}. You have {{ points }} {{ setting('core.donate_column') == 'coins' ? 'coins' : 'premium points' }}.
+
+{% set title = 'Change Name' %}
+{% set background = config('darkborder') %}
+{% set content %}
+
+
+
Character:
+
+
+
+
+
+
New Name:
+
+
+
+
+
+
Please enter your character name.
+
+
+
+
+{% endset %}
+{% include 'tables.headline.html.twig' %}
+
+
+
diff --git a/system/templates/account.characters.change-sex.html.twig b/system/templates/account.characters.change-sex.html.twig
new file mode 100644
index 00000000..440fed9f
--- /dev/null
+++ b/system/templates/account.characters.change-sex.html.twig
@@ -0,0 +1,61 @@
+To change a sex of character select player and choose a new sex.
+Change sex cost {{ setting('core.account_change_character_sex_price') }} {{ setting('core.donate_column') == 'coins' ? 'coins' : 'premium points' }}. You have {{ points }} {{ setting('core.donate_column') == 'coins' ? 'coins' : 'premium points' }}.
+
+{% set title = 'Change sex' %}
+{% set background = config('darkborder') %}
+{% set content %}
+
+
+
Character:
+
+
+
+
+
+
New Sex:
+
+
+
+
+
+{% endset %}
+{% include 'tables.headline.html.twig' %}
+
+
+
diff --git a/system/templates/account.characters.create.html.twig b/system/templates/account.characters.create.html.twig
new file mode 100644
index 00000000..6e2b613d
--- /dev/null
+++ b/system/templates/account.characters.create.html.twig
@@ -0,0 +1,168 @@
+Please choose a name{% if config.character_samples|length > 1 %}, vocation{% endif %}
+{% if config.character_towns|length > 1 %}, town{% endif %}
+ and sex for your character.
+In any case the name must not violate the naming conventions stated in the {{ config.lua.serverName }} Rules, or your character might get deleted or name locked.
+{% if account_logged.getPlayersList(true)|length >= setting('core.characters_per_account') %}
+ You have maximum number of characters per account on your account. Delete one before you make new.
+{% endif %}
+
+
diff --git a/system/templates/account.characters.delete.html.twig b/system/templates/account.characters.delete.html.twig
new file mode 100644
index 00000000..8593f7ed
--- /dev/null
+++ b/system/templates/account.characters.delete.html.twig
@@ -0,0 +1,50 @@
+To delete a character enter the name of the character and your password.
+{% set title = 'Delete Character' %}
+{% set background = config('darkborder') %}
+{% set content %}
+
+
+
Character Name:
+
+
+
+
+
+
Password:
+
+
+
+
+
+{% endset %}
+{% include 'tables.headline.html.twig' %}
+
+
- {{ hook('HOOK_ACCOUNT_CREATE_BETWEEN_BOXES_1') }}
+ {{ hook('HOOK_ACCOUNT_CREATE_BETWEEN_BOXES_1') }}
- {% if (not setting('core.mail_enabled') or not setting('core.account_mail_verify')) and setting('core.account_create_character_create') %}
-
-
-
-
-
-
-
-
-
+ {% if setting('core.account_create_character_create') %}
+
diff --git a/system/templates/account.create.js.html.twig b/system/templates/account.create.js.html.twig
index 61300039..8c3534ca 100644
--- a/system/templates/account.create.js.html.twig
+++ b/system/templates/account.create.js.html.twig
@@ -3,10 +3,12 @@
var lastSend = 0;
$(function() {
- updateFlag();
- $('#account_country').change(function() {
+ {% if setting('core.account_country') %}
updateFlag();
- });
+ $('#account_country').change(function() {
+ updateFlag();
+ });
+ {% endif %}
$('#account_input').blur(function() {
checkAccount();
diff --git a/system/templates/account.create_character.html.twig b/system/templates/account.create_character.html.twig
deleted file mode 100644
index a860a8b1..00000000
--- a/system/templates/account.create_character.html.twig
+++ /dev/null
@@ -1,150 +0,0 @@
-Please choose a name{% if config.character_samples|length > 1 %}, vocation{% endif %}
-{% if config.character_towns|length > 1 %}, town{% endif %}
- and sex for your character.
-In any case the name must not violate the naming conventions stated in the {{ config.lua.serverName }} Rules, or your character might get deleted or name locked.
-{% if account_logged.getPlayersList(true)|length >= setting('core.characters_per_account') %}
- You have maximum number of characters per account on your account. Delete one before you make new.
-{% endif %}
-
-
- {{ csrf() }}
-
-
-
-
-
-
-
-
-
-
Create Character
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Name
-
-
- Sex
-
-
-
-
-
-
-
-
-
{% if not save or errors.name is defined %}Please enter your character name.{% endif %}
-
-
-
- {% set i = 0 %}
- {% for id, gender in config.genders|reverse(true) %}
- {% set i = i + 1 %}
-
- {% endfor %}
-
-
-
-
-
-
-
-
-
-
- {% if config.character_samples|length > 1 %}
-
-
-
-
Select your vocation:
-
-
- {% for key, sample_char in config.character_samples %}
-
-
diff --git a/system/templates/account.delete_character.html.twig b/system/templates/account.delete_character.html.twig
deleted file mode 100644
index c5953cc7..00000000
--- a/system/templates/account.delete_character.html.twig
+++ /dev/null
@@ -1,68 +0,0 @@
-To delete a character enter the name of the character and your password.
-
- {{ csrf() }}
-
-
-
-
-
-
-
-
-
-
Delete Character
-
-
-
-
-
-
-
-
-
-
-
-
Character Name:
-
-
-
-
-
-
Password:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{ include('buttons.submit.html.twig') }}
-
-
-
-
-
-
-
-
- {{ csrf() }}
-
-
- {{ include('buttons.back.html.twig') }}
-
-
-
-
-
-
-
diff --git a/system/templates/account.generate_new_recovery_key.html.twig b/system/templates/account.generate_new_recovery_key.html.twig
index 9b28cebc..fc48d3a9 100644
--- a/system/templates/account.generate_new_recovery_key.html.twig
+++ b/system/templates/account.generate_new_recovery_key.html.twig
@@ -1,61 +1,44 @@
To generate new recovery key for your account please enter your password.
-New recovery key cost {{ setting('core.account_generate_new_reckey_price') }} Premium Points. You have {{ points }} premium points. You will receive e-mail with this recovery key.
-
- {{ csrf() }}
-
-
-
-
-
-
-
-
-
-
Generate recovery key
-
-
-
-
-
-
-
-
-
-
-
-
Password:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+New recovery key cost {{ setting('core.account_generate_new_reckey_price') }} Premium Points. You have {{ points }} premium points. You will receive e-mail with this recovery key.
+
+{% set title = 'Generate recovery key' %}
+{% set background = config('darkborder') %}
+{% set content %}
+
+
+
Password:
+
+
+
+{% endset %}
+{% include 'tables.headline.html.twig' %}
+
+
diff --git a/system/templates/account.generate_recovery_key.html.twig b/system/templates/account.generate_recovery_key.html.twig
index cb69476c..29ed1ec5 100644
--- a/system/templates/account.generate_recovery_key.html.twig
+++ b/system/templates/account.generate_recovery_key.html.twig
@@ -1,40 +1,19 @@
To generate recovery key for your account please enter your password.
-
- {{ csrf() }}
-
-
-
-
-
-
-
-
-
-
Generate recovery key
-
-
-
-
-
-
-
-
-
-
-
-
- Password:
-
-
-
-
-
-
-
-
-
-
-
+{% set title = 'Generate recovery key' %}
+{% set background = config('darkborder') %}
+{% set content %}
+
+
+
+ Password:
+
+
+
+
+
+
+{% endset %}
+{% include 'tables.headline.html.twig' %}
@@ -42,12 +21,15 @@ To generate recovery key for your account please enter your password.
@@ -40,10 +40,10 @@
{{ name }}
{% endfor %}
{% if setting('core.account_change_character_name') %}
- Change Name
+ Change Name
{% endif %}
{% if setting('core.account_change_character_sex') %}
- Change Sex
+ Change Sex
{% endif %}
Logout
@@ -80,7 +80,7 @@
A request has been submitted to change the email address of this account to {{ email_new }}. After {{ email_new_time|date("j F Y, G:i:s") }} you can accept the new email address and finish the process. Please cancel the request if you do not want your email address to be changed! Also cancel the request if you have no access to the new email address!
-
You have logged in. Press here if you are not returned automatically.
-
-
-
-
-
-
-
+{% set title = 'Login Successful' %}
+{% set background = config('darkborder') %}
+{% set content %}
+
+
+
You have logged in. Press here if you are not returned automatically.
+
+
+{% endset %}
+{% include 'tables.headline.html.twig' %}
\ No newline at end of file
+
diff --git a/system/templates/characters.html.twig b/system/templates/characters.html.twig
index ec00758e..2e09bd26 100644
--- a/system/templates/characters.html.twig
+++ b/system/templates/characters.html.twig
@@ -275,7 +275,7 @@
{% for frag in frags %}
{{ frag.time|date("j M Y, H:i") }}
-
{{ frag.description|raw }}({% if frag.unjustified %}Unjustified{% else %}Justified{% endif %})
+
{% set i = 0 %}
{% for board in boards %}
{% set i = i + 1 %}
diff --git a/system/templates/guilds.change_description.html.twig b/system/templates/guilds.change_description.html.twig
index 4576ae0a..9c656920 100644
--- a/system/templates/guilds.change_description.html.twig
+++ b/system/templates/guilds.change_description.html.twig
@@ -1,14 +1,24 @@
-