From 8985917a96e4a3a5f285eb68224e0c2a470796dd Mon Sep 17 00:00:00 2001 From: slawkens Date: Tue, 14 Feb 2023 18:28:31 +0100 Subject: [PATCH 01/68] Fixes to account number --- admin/pages/accounts.php | 18 ++++++++++++++---- install/steps/7-finish.php | 2 +- system/libs/pot/OTS_Account.php | 23 ++++++++++++----------- system/libs/pot/OTS_Player.php | 2 +- system/login.php | 2 +- system/pages/account/login.php | 2 +- tools/validate.php | 7 ++++--- 7 files changed, 34 insertions(+), 22 deletions(-) diff --git a/admin/pages/accounts.php b/admin/pages/accounts.php index e481c782..554ed60c 100644 --- a/admin/pages/accounts.php +++ b/admin/pages/accounts.php @@ -16,6 +16,11 @@ $use_datatable = true; if ($config['account_country']) require SYSTEM . 'countries.conf.php'; +$nameOrNumberColumn = 'name'; +if (USE_ACCOUNT_NUMBER) { + $nameOrNumberColumn = 'number'; +} + $hasSecretColumn = $db->hasColumn('accounts', 'secret'); $hasCoinsColumn = $db->hasColumn('accounts', 'coins'); $hasPointsColumn = $db->hasColumn('accounts', 'premium_points'); @@ -48,7 +53,7 @@ else if (isset($_REQUEST['search'])) { if (strlen($search_account) < 3 && !Validator::number($search_account)) { echo_error('Player name is too short.'); } else { - $query = $db->query('SELECT `id` FROM `accounts` WHERE `name` = ' . $db->quote($search_account)); + $query = $db->query('SELECT `id` FROM `accounts` WHERE `' . $nameOrNumberColumn . '` = ' . $db->quote($search_account)); if ($query->rowCount() == 1) { $query = $query->fetch(); $id = (int)$query['id']; @@ -203,7 +208,7 @@ else if (isset($_REQUEST['search'])) { } } } else if ($id == 0) { - $accounts_db = $db->query('SELECT `id`, `name`' . ($hasTypeColumn ? ',type' : ($hasGroupColumn ? ',group_id' : '')) . ' FROM `accounts` ORDER BY `id` ASC'); + $accounts_db = $db->query('SELECT `id`, `' . $nameOrNumberColumn . '`' . ($hasTypeColumn ? ',type' : ($hasGroupColumn ? ',group_id' : '')) . ' FROM `accounts` ORDER BY `id` ASC'); ?>
@@ -215,7 +220,7 @@ else if (isset($_REQUEST['search'])) { ID - Name + Position @@ -226,7 +231,7 @@ else if (isset($_REQUEST['search'])) { - + Account Name:
+ +
+ + +
diff --git a/install/steps/7-finish.php b/install/steps/7-finish.php index 81ace38f..75a76f70 100644 --- a/install/steps/7-finish.php +++ b/install/steps/7-finish.php @@ -8,7 +8,7 @@ if(isset($config['installed']) && $config['installed'] && !isset($_SESSION['save else { require SYSTEM . 'init.php'; if(!$error) { - if(USE_ACCOUNT_NAME) + if(USE_ACCOUNT_NAME || USE_ACCOUNT_NUMBER) $account = isset($_SESSION['var_account']) ? $_SESSION['var_account'] : null; else $account_id = isset($_SESSION['var_account_id']) ? $_SESSION['var_account_id'] : null; diff --git a/system/libs/pot/OTS_Account.php b/system/libs/pot/OTS_Account.php index 89db0d16..b511ff29 100644 --- a/system/libs/pot/OTS_Account.php +++ b/system/libs/pot/OTS_Account.php @@ -231,26 +231,22 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable * @param int $id Account number. * @throws PDOException On PDO operation error. */ - public function load($id, $fresh = false, $searchOnlyById = false) + public function load($id, $fresh = false) { if(!$fresh && isset(self::$cache[$id])) { $this->data = self::$cache[$id]; return; } - $numberColumn = 'id'; $nameOrNumber = ''; - if (!$searchOnlyById) { - if (USE_ACCOUNT_NAME) { - $nameOrNumber = '`name`,'; - } else if (USE_ACCOUNT_NUMBER) { - $nameOrNumber = '`number`,'; - $numberColumn = 'number'; - } + if (USE_ACCOUNT_NAME) { + $nameOrNumber = '`name`,'; + } else if (USE_ACCOUNT_NUMBER) { + $nameOrNumber = '`number`,'; } // SELECT query on database - $this->data = $this->db->query('SELECT `id`, ' . $nameOrNumber . '`password`, `email`, `blocked`, `rlname`, `location`, `country`, `web_flags`, ' . ($this->db->hasColumn('accounts', 'premdays') ? '`premdays`, ' : '') . ($this->db->hasColumn('accounts', 'lastday') ? '`lastday`, ' : ($this->db->hasColumn('accounts', 'premend') ? '`premend`,' : ($this->db->hasColumn('accounts', 'premium_ends_at') ? '`premium_ends_at`,' : ''))) . '`created` FROM `accounts` WHERE `' . $numberColumn . '` = ' . (int) $id)->fetch(); + $this->data = $this->db->query('SELECT `id`, ' . $nameOrNumber . '`password`, `email`, `blocked`, `rlname`, `location`, `country`, `web_flags`, ' . ($this->db->hasColumn('accounts', 'premdays') ? '`premdays`, ' : '') . ($this->db->hasColumn('accounts', 'lastday') ? '`lastday`, ' : ($this->db->hasColumn('accounts', 'premend') ? '`premend`,' : ($this->db->hasColumn('accounts', 'premium_ends_at') ? '`premium_ends_at`,' : ''))) . '`created` FROM `accounts` WHERE `id` = ' . (int) $id)->fetch(); self::$cache[$id] = $this->data; } @@ -268,8 +264,13 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable */ public function find($name) { + $nameOrNumberColumn = 'name'; + if (USE_ACCOUNT_NUMBER) { + $nameOrNumberColumn = 'number'; + } + // finds player's ID - $id = $this->db->query('SELECT `id` FROM `accounts` WHERE `name` = ' . $this->db->quote($name) )->fetch(); + $id = $this->db->query('SELECT `id` FROM `accounts` WHERE `' . $nameOrNumberColumn . '` = ' . $this->db->quote($name) )->fetch(); // if anything was found if( isset($id['id']) ) diff --git a/system/libs/pot/OTS_Player.php b/system/libs/pot/OTS_Player.php index b5f48dc6..b111a150 100644 --- a/system/libs/pot/OTS_Player.php +++ b/system/libs/pot/OTS_Player.php @@ -602,7 +602,7 @@ class OTS_Player extends OTS_Row_DAO } $account = new OTS_Account(); - $account->load($this->data['account_id'], false, true); + $account->load($this->data['account_id']); return $account; } diff --git a/system/login.php b/system/login.php index 5d55cd18..e002b0b2 100644 --- a/system/login.php +++ b/system/login.php @@ -16,7 +16,7 @@ $current_session = getSession('account'); if($current_session !== false) { $account_logged = new OTS_Account(); - $account_logged->load($current_session); + $account_logged->find($current_session); if($account_logged->isLoaded() && $account_logged->getPassword() == getSession('password') //&& (!isset($_SESSION['admin']) || admin()) && (getSession('remember_me') !== false || getSession('last_visit') > time() - 15 * 60)) { // login for 15 minutes if "remember me" is not used diff --git a/system/pages/account/login.php b/system/pages/account/login.php index 9cc31503..99c812b7 100644 --- a/system/pages/account/login.php +++ b/system/pages/account/login.php @@ -37,7 +37,7 @@ if(!$logged && isset($_POST['account_login'], $_POST['password_login'])) } if (!config('account_login_by_email') || config('account_login_by_email_fallback')) { - if(USE_ACCOUNT_NAME) { + if(USE_ACCOUNT_NAME || USE_ACCOUNT_NUMBER) { $account_logged->find($login_account); } else { $account_logged->load($login_account, true); diff --git a/tools/validate.php b/tools/validate.php index b0718062..6e80a6e6 100644 --- a/tools/validate.php +++ b/tools/validate.php @@ -27,15 +27,16 @@ if(isset($_GET['account'])) error_(Validator::getLastError()); $_account = new OTS_Account(); - if(USE_ACCOUNT_NAME) + if(USE_ACCOUNT_NAME || USE_ACCOUNT_NUMBER) $_account->find($account); else $_account->load($account); + $accountNameOrNumber = (USE_ACCOUNT_NAME ? ' name' : 'number'); if($_account->isLoaded()) - error_('Account with this name already exist.'); + error_("Account with this $accountNameOrNumber already exist."); - success_('Good account' . (USE_ACCOUNT_NAME ? ' name' : '') . ' ( ' . $account . ' ).'); + success_("Good account $accountNameOrNumber ($account)."); } else if(isset($_GET['email'])) { From ed7e9e1eae9ba22d916d29ea410a19570c87a61b Mon Sep 17 00:00:00 2001 From: slawkens Date: Tue, 14 Feb 2023 18:40:31 +0100 Subject: [PATCH 02/68] fixes to account number part 2 --- system/login.php | 2 +- system/pages/account/login.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/system/login.php b/system/login.php index e002b0b2..5d55cd18 100644 --- a/system/login.php +++ b/system/login.php @@ -16,7 +16,7 @@ $current_session = getSession('account'); if($current_session !== false) { $account_logged = new OTS_Account(); - $account_logged->find($current_session); + $account_logged->load($current_session); if($account_logged->isLoaded() && $account_logged->getPassword() == getSession('password') //&& (!isset($_SESSION['admin']) || admin()) && (getSession('remember_me') !== false || getSession('last_visit') > time() - 15 * 60)) { // login for 15 minutes if "remember me" is not used diff --git a/system/pages/account/login.php b/system/pages/account/login.php index 99c812b7..a62aa827 100644 --- a/system/pages/account/login.php +++ b/system/pages/account/login.php @@ -48,7 +48,7 @@ if(!$logged && isset($_POST['account_login'], $_POST['password_login'])) && (!isset($t) || $t['attempts'] < 5) ) { - setSession('account', $account_logged->getNumber()); + setSession('account', $account_logged->getId()); setSession('password', encrypt((USE_ACCOUNT_SALT ? $account_logged->getCustomField('salt') : '') . $login_password)); if($remember_me) { setSession('remember_me', true); From fc0eb0e793fe4769c36875fae54ff151cfe99bdd Mon Sep 17 00:00:00 2001 From: slawkens Date: Wed, 8 Feb 2023 15:22:14 +0100 Subject: [PATCH 03/68] add missing hook --- system/hooks.php | 1 + 1 file changed, 1 insertion(+) diff --git a/system/hooks.php b/system/hooks.php index 3201880d..448d40c0 100644 --- a/system/hooks.php +++ b/system/hooks.php @@ -51,6 +51,7 @@ define('HOOK_ACCOUNT_CREATE_POST', ++$i); define('HOOK_ACCOUNT_LOGIN_BEFORE_PAGE', ++$i); define('HOOK_ACCOUNT_LOGIN_BEFORE_ACCOUNT', ++$i); define('HOOK_ACCOUNT_LOGIN_AFTER_ACCOUNT', ++$i); +define('HOOK_ACCOUNT_LOGIN_BEFORE_PASSWORD', ++$i); define('HOOK_ACCOUNT_LOGIN_AFTER_PASSWORD', ++$i); define('HOOK_ACCOUNT_LOGIN_AFTER_REMEMBER_ME', ++$i); define('HOOK_ACCOUNT_LOGIN_AFTER_PAGE', ++$i); From 66ec66b29131cf6b287041197e6ab2a0455ff057 Mon Sep 17 00:00:00 2001 From: slawkens Date: Tue, 14 Feb 2023 18:47:56 +0100 Subject: [PATCH 04/68] Allow TinyMCE to resize horizontally and vertically --- system/templates/tinymce.html.twig | 1 + 1 file changed, 1 insertion(+) diff --git a/system/templates/tinymce.html.twig b/system/templates/tinymce.html.twig index b0817800..880de4f0 100644 --- a/system/templates/tinymce.html.twig +++ b/system/templates/tinymce.html.twig @@ -9,6 +9,7 @@ theme: "silver", plugins: 'preview searchreplace autolink directionality visualblocks visualchars fullscreen image link media template codesample table charmap pagebreak nonbreaking anchor insertdatetime advlist lists wordcount help code emoticons', toolbar1: 'formatselect | bold italic strikethrough forecolor backcolor | emoticons link | alignleft aligncenter alignright alignjustify | numlist bullist outdent indent | removeformat code', + resize: 'both', image_advtab: true, images_upload_url: '{{ constant('BASE_URL') }}admin/tools/upload_image.php', images_upload_credentials: true, From 7d8dbcbde7497ac04b831cdd495743d812c9c197 Mon Sep 17 00:00:00 2001 From: slawkens Date: Tue, 14 Feb 2023 19:40:55 +0100 Subject: [PATCH 05/68] fixes to account number part 3 --- admin/pages/accounts.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/pages/accounts.php b/admin/pages/accounts.php index 554ed60c..8c648578 100644 --- a/admin/pages/accounts.php +++ b/admin/pages/accounts.php @@ -58,7 +58,7 @@ else if (isset($_REQUEST['search'])) { $query = $query->fetch(); $id = (int)$query['id']; } else { - $query = $db->query('SELECT `id`, `name` FROM `accounts` WHERE `name` LIKE ' . $db->quote('%' . $search_account . '%')); + $query = $db->query('SELECT `id`, `' . $nameOrNumberColumn . '` FROM `accounts` WHERE `' . $nameOrNumberColumn . '` LIKE ' . $db->quote('%' . $search_account . '%')); if ($query->rowCount() > 0 && $query->rowCount() <= 10) { $str_construct = 'Do you mean?
    '; foreach ($query as $row) From c88156802a56596a1e6ac3b0eb912a64bcc45fa1 Mon Sep 17 00:00:00 2001 From: slawkens Date: Tue, 14 Feb 2023 21:51:46 +0100 Subject: [PATCH 06/68] fix pages not found --- system/pages/{experiencestages.php => experience_stages.php} | 0 system/pages/{experiencetable.php => experience_table.php} | 0 system/pages/{serverinfo.php => server_info.php} | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename system/pages/{experiencestages.php => experience_stages.php} (100%) rename system/pages/{experiencetable.php => experience_table.php} (100%) rename system/pages/{serverinfo.php => server_info.php} (100%) diff --git a/system/pages/experiencestages.php b/system/pages/experience_stages.php similarity index 100% rename from system/pages/experiencestages.php rename to system/pages/experience_stages.php diff --git a/system/pages/experiencetable.php b/system/pages/experience_table.php similarity index 100% rename from system/pages/experiencetable.php rename to system/pages/experience_table.php diff --git a/system/pages/serverinfo.php b/system/pages/server_info.php similarity index 100% rename from system/pages/serverinfo.php rename to system/pages/server_info.php From d565b90736fe0a6139ddd7c17867666ae640b42f Mon Sep 17 00:00:00 2001 From: slawkens Date: Tue, 14 Feb 2023 21:51:54 +0100 Subject: [PATCH 07/68] Update accounts.php --- admin/pages/accounts.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/pages/accounts.php b/admin/pages/accounts.php index 8c648578..f96d0ec2 100644 --- a/admin/pages/accounts.php +++ b/admin/pages/accounts.php @@ -62,7 +62,7 @@ else if (isset($_REQUEST['search'])) { if ($query->rowCount() > 0 && $query->rowCount() <= 10) { $str_construct = 'Do you mean?'; echo_error($str_construct); } else if ($query->rowCount() > 10) From 590fe0762d33411bb4c2ee81c87567294bb5082d Mon Sep 17 00:00:00 2001 From: slawkens Date: Tue, 14 Feb 2023 22:03:22 +0100 Subject: [PATCH 08/68] small fixes --- system/router.php | 11 +++++++---- templates/tibiacom/index.php | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/system/router.php b/system/router.php index ff8c7d3d..596121f5 100644 --- a/system/router.php +++ b/system/router.php @@ -55,10 +55,9 @@ if (BASE_DIR !== '') { define('URI', $uri); -/** @var boolean $load_it */ if(!$load_it) { // ignore warnings in some functions/plugins - // page is not loaded anyways + // page is not loaded anyway define('PAGE', ''); return; @@ -147,6 +146,10 @@ $found = true; // old support for pages like /?subtopic=accountmanagement $page = $_REQUEST['p'] ?? ($_REQUEST['subtopic'] ?? ''); if(!empty($page) && preg_match('/^[A-z0-9\-]+$/', $page)) { + if (isset($_REQUEST['p'])) { // some plugins may require this + $_REQUEST['subtopic'] = $_REQUEST['p']; + } + if (config('backward_support')) { require SYSTEM . 'compat/pages.php'; } @@ -161,7 +164,6 @@ else { switch ($routeInfo[0]) { case FastRoute\Dispatcher::NOT_FOUND: // ... 404 Not Found - //var_dump('not found'); /** * Fallback to load page from templates/ or system/pages/ directory */ @@ -282,7 +284,8 @@ function getDatabasePages() { return $ret; } -function loadPageFromFileSystem($page, &$found) { +function loadPageFromFileSystem($page, &$found): string +{ $file = SYSTEM . 'pages/' . $page . '.php'; if (!is_file($file)) { // feature: convert camelCase to snake_case diff --git a/templates/tibiacom/index.php b/templates/tibiacom/index.php index 8ebbd5b6..989a05ca 100644 --- a/templates/tibiacom/index.php +++ b/templates/tibiacom/index.php @@ -27,7 +27,7 @@ if(isset($config['boxes'])) var loginStatus=""; Date: Tue, 14 Feb 2023 23:22:17 +0100 Subject: [PATCH 09/68] add some notice --- nginx-sample.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/nginx-sample.conf b/nginx-sample.conf index 5a2deab7..8db44d54 100644 --- a/nginx-sample.conf +++ b/nginx-sample.conf @@ -22,6 +22,7 @@ server { deny all; } + # this is very important, be sure its in your nginx conf - it prevents access to logs etc. location /system { deny all; return 404; From 6ae1bf58147eee6427b6612afa60864c5315f3b3 Mon Sep 17 00:00:00 2001 From: slawkens Date: Wed, 15 Feb 2023 08:06:08 +0100 Subject: [PATCH 10/68] Add missing header to some files --- system/exception.php | 9 ++++++++- system/functions.php | 3 +-- system/logout.php | 9 +++++++++ system/migrate.php | 11 ++++++++++- system/pages/account/login.php | 11 +++++++++++ system/router.php | 3 ++- system/routes.php | 1 + system/twig.php | 9 +++++++++ 8 files changed, 51 insertions(+), 5 deletions(-) diff --git a/system/exception.php b/system/exception.php index 3ad1fefe..e46f0d54 100644 --- a/system/exception.php +++ b/system/exception.php @@ -1,5 +1,12 @@ + * @copyright 2023 MyAAC + * @link https://my-aac.org + */ require LIBS . 'SensitiveException.php'; /** diff --git a/system/functions.php b/system/functions.php index db3bfd8f..a2c7d202 100644 --- a/system/functions.php +++ b/system/functions.php @@ -7,12 +7,11 @@ * @copyright 2019 MyAAC * @link https://my-aac.org */ +defined('MYAAC') or die('Direct access not allowed!'); use PHPMailer\PHPMailer\PHPMailer; use Twig\Loader\ArrayLoader as Twig_ArrayLoader; -defined('MYAAC') or die('Direct access not allowed!'); - function message($message, $type, $return) { if(IS_CLI) { diff --git a/system/logout.php b/system/logout.php index a7f5d8fd..af443aa3 100644 --- a/system/logout.php +++ b/system/logout.php @@ -1,4 +1,13 @@ + * @copyright 2019 MyAAC + * @link https://my-aac.org + */ +defined('MYAAC') or die('Direct access not allowed!'); if(isset($account_logged) && $account_logged->isLoaded()) { if($hooks->trigger(HOOK_LOGOUT, ['account_id' => $account_logged->getId()])) { diff --git a/system/migrate.php b/system/migrate.php index 46daeef6..4eb7bf7a 100644 --- a/system/migrate.php +++ b/system/migrate.php @@ -1,4 +1,13 @@ + * @copyright 2019 MyAAC + * @link https://my-aac.org + */ +defined('MYAAC') or die('Direct access not allowed!'); // database migrations $tmp = ''; @@ -19,4 +28,4 @@ else { // register first version require SYSTEM . 'migrations/' . $i . '.php'; updateDatabaseConfig('database_version', $i); } -} \ No newline at end of file +} diff --git a/system/pages/account/login.php b/system/pages/account/login.php index a62aa827..557aeb86 100644 --- a/system/pages/account/login.php +++ b/system/pages/account/login.php @@ -1,4 +1,15 @@ + * @author Slawkens + * @copyright 2023 MyAAC + * @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'])) diff --git a/system/router.php b/system/router.php index 596121f5..4f3b6321 100644 --- a/system/router.php +++ b/system/router.php @@ -4,9 +4,10 @@ * * @package MyAAC * @author Slawkens - * @copyright 2021 MyAAC + * @copyright 2023 MyAAC * @link https://my-aac.org */ +defined('MYAAC') or die('Direct access not allowed!'); if(!isset($content[0])) $content = ''; diff --git a/system/routes.php b/system/routes.php index a7ddd295..c6dfa780 100644 --- a/system/routes.php +++ b/system/routes.php @@ -7,6 +7,7 @@ * @copyright 2021 MyAAC * @link https://my-aac.org */ +defined('MYAAC') or die('Direct access not allowed!'); return [ ['GET', '', '__redirect__/news'], // redirect empty URL to news diff --git a/system/twig.php b/system/twig.php index 5b912875..87d2ad6f 100644 --- a/system/twig.php +++ b/system/twig.php @@ -1,4 +1,13 @@ + * @copyright 2021 MyAAC + * @link https://my-aac.org + */ +defined('MYAAC') or die('Direct access not allowed!'); use Twig\Environment as Twig_Environment; use Twig\Extension\DebugExtension as Twig_DebugExtension; From 6c4b3dea9683e1022a341e23946f819942500e4a Mon Sep 17 00:00:00 2001 From: slawkens Date: Wed, 15 Feb 2023 08:06:57 +0100 Subject: [PATCH 11/68] Delete autoload.php --- system/autoload.php | 206 -------------------------------------------- 1 file changed, 206 deletions(-) delete mode 100644 system/autoload.php diff --git a/system/autoload.php b/system/autoload.php deleted file mode 100644 index a13db1db..00000000 --- a/system/autoload.php +++ /dev/null @@ -1,206 +0,0 @@ -register(); - -// register the base directories for the namespace prefix -$loader->addNamespace('Composer\Semver', LIBS . 'semver'); -$loader->addNamespace('Twig', LIBS . 'Twig'); -/** - * An example of a general-purpose implementation that includes the optional - * functionality of allowing multiple base directories for a single namespace - * prefix. - * - * Given a foo-bar package of classes in the file system at the following - * paths ... - * - * /path/to/packages/foo-bar/ - * src/ - * Baz.php # Foo\Bar\Baz - * Qux/ - * Quux.php # Foo\Bar\Qux\Quux - * tests/ - * BazTest.php # Foo\Bar\BazTest - * Qux/ - * QuuxTest.php # Foo\Bar\Qux\QuuxTest - * - * ... add the path to the class files for the \Foo\Bar\ namespace prefix - * as follows: - * - * register(); - * - * // register the base directories for the namespace prefix - * $loader->addNamespace('Foo\Bar', '/path/to/packages/foo-bar/src'); - * $loader->addNamespace('Foo\Bar', '/path/to/packages/foo-bar/tests'); - * - * The following line would cause the autoloader to attempt to load the - * \Foo\Bar\Qux\Quux class from /path/to/packages/foo-bar/src/Qux/Quux.php: - * - * prefixes[$prefix]) === false) { - $this->prefixes[$prefix] = array(); - } - - // retain the base directory for the namespace prefix - if ($prepend) { - array_unshift($this->prefixes[$prefix], $base_dir); - } else { - array_push($this->prefixes[$prefix], $base_dir); - } - } - - /** - * Loads the class file for a given class name. - * - * @param string $class The fully-qualified class name. - * @return mixed The mapped file name on success, or boolean false on - * failure. - */ - public function loadClass($class) - { - if (0 === strpos($class, 'Twig_')) { - $file = LIBS . 'Twig/' . str_replace(array('_', "\0"), array('/', ''), $class).'.php'; - - if((config('env') === 'dev') && !is_file($file)) { - return false; - } - - require $file; - return false; - } - - // the current namespace prefix - $prefix = $class; - - // work backwards through the namespace names of the fully-qualified - // class name to find a mapped file name - while (false !== $pos = strrpos($prefix, '\\')) { - - // retain the trailing namespace separator in the prefix - $prefix = substr($class, 0, $pos + 1); - - // the rest is the relative class name - $relative_class = substr($class, $pos + 1); - - // try to load a mapped file for the prefix and relative class - $mapped_file = $this->loadMappedFile($prefix, $relative_class); - if ($mapped_file) { - return $mapped_file; - } - - // remove the trailing namespace separator for the next iteration - // of strrpos() - $prefix = rtrim($prefix, '\\'); - } - - // never found a mapped file - return false; - } - - /** - * Load the mapped file for a namespace prefix and relative class. - * - * @param string $prefix The namespace prefix. - * @param string $relative_class The relative class name. - * @return mixed Boolean false if no mapped file can be loaded, or the - * name of the mapped file that was loaded. - */ - protected function loadMappedFile($prefix, $relative_class) - { - // are there any base directories for this namespace prefix? - if (isset($this->prefixes[$prefix]) === false) { - return false; - } - - // look through base directories for this namespace prefix - foreach ($this->prefixes[$prefix] as $base_dir) { - - // replace the namespace prefix with the base directory, - // replace namespace separators with directory separators - // in the relative class name, append with .php - $file = $base_dir - . str_replace('\\', '/', $relative_class) - . '.php'; - - // if the mapped file exists, require it - if ($this->requireFile($file)) { - // yes, we're done - return $file; - } - } - - // never found it - return false; - } - - /** - * If a file exists, require it from the file system. - * - * @param string $file The file to require. - * @return bool True if the file exists, false if not. - */ - protected function requireFile($file) - { - if (config('env') !== 'dev' || file_exists($file)) { - require $file; - return true; - } - return false; - } -} \ No newline at end of file From 7bc20b0993c76e460f799761a6fb27918e324ee7 Mon Sep 17 00:00:00 2001 From: slawkens Date: Wed, 15 Feb 2023 17:12:30 +0100 Subject: [PATCH 12/68] change spaces to tabs --- system/pages/guilds/list.php | 28 +- system/pages/guilds/show.php | 158 +++--- system/templates/guilds.list.html.twig | 290 +++++------ system/templates/guilds.view.html.twig | 636 ++++++++++++------------- 4 files changed, 556 insertions(+), 556 deletions(-) diff --git a/system/pages/guilds/list.php b/system/pages/guilds/list.php index 6296db72..2b65e15d 100644 --- a/system/pages/guilds/list.php +++ b/system/pages/guilds/list.php @@ -19,23 +19,23 @@ $guilds_list->orderBy("name"); $guilds = array(); if(count($guilds_list) > 0) { - foreach ($guilds_list as $guild) { - $guild_logo = $guild->getCustomField('logo_name'); - if (empty($guild_logo) || !file_exists(GUILD_IMAGES_DIR . $guild_logo)) - $guild_logo = "default.gif"; + foreach ($guilds_list as $guild) { + $guild_logo = $guild->getCustomField('logo_name'); + if (empty($guild_logo) || !file_exists(GUILD_IMAGES_DIR . $guild_logo)) + $guild_logo = "default.gif"; - $description = $guild->getCustomField('description'); - $description_with_lines = str_replace(array("\r\n", "\n", "\r"), '
    ', $description, $count); - if ($count < $config['guild_description_lines_limit']) - $description = wordwrap(nl2br($description), 60, "
    ", true); + $description = $guild->getCustomField('description'); + $description_with_lines = str_replace(array("\r\n", "\n", "\r"), '
    ', $description, $count); + if ($count < $config['guild_description_lines_limit']) + $description = wordwrap(nl2br($description), 60, "
    ", true); - $guildName = $guild->getName(); - $guilds[] = array('name' => $guildName, 'logo' => $guild_logo, 'link' => getGuildLink($guildName, false), 'description' => $description); - } + $guildName = $guild->getName(); + $guilds[] = array('name' => $guildName, 'logo' => $guild_logo, 'link' => getGuildLink($guildName, false), 'description' => $description); + } }; $twig->display('guilds.list.html.twig', array( - 'guilds' => $guilds, - 'logged' => isset($logged) ? $logged : false, - 'isAdmin' => admin(), + 'guilds' => $guilds, + 'logged' => isset($logged) ? $logged : false, + 'isAdmin' => admin(), )); diff --git a/system/pages/guilds/show.php b/system/pages/guilds/show.php index dc10480c..f4b4f15c 100644 --- a/system/pages/guilds/show.php +++ b/system/pages/guilds/show.php @@ -49,78 +49,78 @@ $players_from_account_in_guild = array(); $players_from_account_ids = array(); if($logged) { - $account_players = $account_logged->getPlayers(); - foreach($account_players as $player) - { - $players_from_account_ids[] = $player->getId(); - $player_rank = $player->getRank(); - if($player_rank->isLoaded()) - { - foreach($rank_list as $rank_in_guild) - { - if($guild_owner->isLoaded() && $rank_in_guild->isLoaded() && $player_rank->isLoaded() && - $rank_in_guild->getId() == $player_rank->getId()) - { - $players_from_account_in_guild[] = $player->getName(); - if($guild_owner->getId() == $player->getId()) - { - $guild_vice = true; - $guild_leader = true; - } - else if($player_rank->getLevel() > 1) - { - $guild_vice = true; - $level_in_guild = $player_rank->getLevel(); - } - } - } - } - } + $account_players = $account_logged->getPlayers(); + foreach($account_players as $player) + { + $players_from_account_ids[] = $player->getId(); + $player_rank = $player->getRank(); + if($player_rank->isLoaded()) + { + foreach($rank_list as $rank_in_guild) + { + if($guild_owner->isLoaded() && $rank_in_guild->isLoaded() && $player_rank->isLoaded() && + $rank_in_guild->getId() == $player_rank->getId()) + { + $players_from_account_in_guild[] = $player->getName(); + if($guild_owner->getId() == $player->getId()) + { + $guild_vice = true; + $guild_leader = true; + } + else if($player_rank->getLevel() > 1) + { + $guild_vice = true; + $level_in_guild = $player_rank->getLevel(); + } + } + } + } + } } //show guild page $guild_logo = $guild->getCustomField('logo_name'); if(empty($guild_logo) || !file_exists(GUILD_IMAGES_DIR . $guild_logo)) - $guild_logo = "default.gif"; + $guild_logo = "default.gif"; $description = $guild->getCustomField('description'); $description_with_lines = str_replace(array("\r\n", "\n", "\r"), '
    ', $description, $count); if($count < $config['guild_description_lines_limit']) - $description = wordwrap(nl2br($description), 60, "
    ", true); + $description = wordwrap(nl2br($description), 60, "
    ", true); //$description = $description_with_lines; $guild_owner = $guild->getOwner(); if($guild_owner->isLoaded()) - $guild_owner_name = $guild_owner->getName(); + $guild_owner_name = $guild_owner->getName(); $guild_members = array(); foreach($rank_list as $rank) { - if($db->hasTable(GUILD_MEMBERS_TABLE)) - $players_with_rank = $db->query('SELECT `players`.`id` as `id`, `' . GUILD_MEMBERS_TABLE . '`.`rank_id` as `rank_id` FROM `players`, `' . GUILD_MEMBERS_TABLE . '` WHERE `' . GUILD_MEMBERS_TABLE . '`.`rank_id` = ' . $rank->getId() . ' AND `players`.`id` = `' . GUILD_MEMBERS_TABLE . '`.`player_id` ORDER BY `name`;'); - else if($db->hasColumn('players', 'rank_id')) - $players_with_rank = $db->query('SELECT `id`, `rank_id` FROM `players` WHERE `rank_id` = ' . $rank->getId() . ' AND `deleted` = 0;'); + if($db->hasTable(GUILD_MEMBERS_TABLE)) + $players_with_rank = $db->query('SELECT `players`.`id` as `id`, `' . GUILD_MEMBERS_TABLE . '`.`rank_id` as `rank_id` FROM `players`, `' . GUILD_MEMBERS_TABLE . '` WHERE `' . GUILD_MEMBERS_TABLE . '`.`rank_id` = ' . $rank->getId() . ' AND `players`.`id` = `' . GUILD_MEMBERS_TABLE . '`.`player_id` ORDER BY `name`;'); + else if($db->hasColumn('players', 'rank_id')) + $players_with_rank = $db->query('SELECT `id`, `rank_id` FROM `players` WHERE `rank_id` = ' . $rank->getId() . ' AND `deleted` = 0;'); - $players_with_rank_number = $players_with_rank->rowCount(); - if($players_with_rank_number > 0) - { - $members = array(); - foreach($players_with_rank as $result) - { - $player = new OTS_Player(); - $player->load($result['id']); - if(!$player->isLoaded()) - continue; + $players_with_rank_number = $players_with_rank->rowCount(); + if($players_with_rank_number > 0) + { + $members = array(); + foreach($players_with_rank as $result) + { + $player = new OTS_Player(); + $player->load($result['id']); + if(!$player->isLoaded()) + continue; - $members[] = $player; - } + $members[] = $player; + } - $guild_members[] = array( - 'rank_name' => $rank->getName(), - 'rank_level' => $rank->getLevel(), - 'members' => $members - ); - } + $guild_members[] = array( + 'rank_name' => $rank->getName(), + 'rank_level' => $rank->getLevel(), + 'members' => $members + ); + } } include(SYSTEM . 'libs/pot/InvitesDriver.php'); @@ -129,37 +129,37 @@ $invited_list = $guild->listInvites(); $show_accept_invite = 0; if($logged && count($invited_list) > 0) { - foreach($invited_list as $invited_player) - { - if(count($account_players) > 0) - { - foreach($account_players as $player_from_acc) - { - if($player_from_acc->isLoaded() && $invited_player->isLoaded() && $player_from_acc->getName() == $invited_player->getName()) - $show_accept_invite++; - } - } - } + foreach($invited_list as $invited_player) + { + if(count($account_players) > 0) + { + foreach($account_players as $player_from_acc) + { + if($player_from_acc->isLoaded() && $invited_player->isLoaded() && $player_from_acc->getName() == $invited_player->getName()) + $show_accept_invite++; + } + } + } } $useGuildNick = false; if($db->hasColumn('players', 'guildnick')) - $useGuildNick = true; + $useGuildNick = true; $twig->display('guilds.view.html.twig', array( - 'logo' => $guild_logo, - 'guild_name' => $guild_name, - 'description' => $description, - 'guild_owner' => $guild_owner->isLoaded() ? $guild_owner : null, - 'guild_creation_date' => $guild->getCreationData(), - 'guild_members' => $guild_members, - 'players_from_account_ids' => $players_from_account_ids, - 'players_from_account_in_guild' => $players_from_account_in_guild, - 'level_in_guild' => $level_in_guild, - 'isLeader' => $guild_leader, - 'isVice' => $guild_vice, - 'logged' => $logged, - 'invited_list' => $invited_list, - 'show_accept_invite' => $show_accept_invite, - 'useGuildNick' => $useGuildNick + 'logo' => $guild_logo, + 'guild_name' => $guild_name, + 'description' => $description, + 'guild_owner' => $guild_owner->isLoaded() ? $guild_owner : null, + 'guild_creation_date' => $guild->getCreationData(), + 'guild_members' => $guild_members, + 'players_from_account_ids' => $players_from_account_ids, + 'players_from_account_in_guild' => $players_from_account_in_guild, + 'level_in_guild' => $level_in_guild, + 'isLeader' => $guild_leader, + 'isVice' => $guild_vice, + 'logged' => $logged, + 'invited_list' => $invited_list, + 'show_accept_invite' => $show_accept_invite, + 'useGuildNick' => $useGuildNick )); diff --git a/system/templates/guilds.list.html.twig b/system/templates/guilds.list.html.twig index f1c03404..da5016b0 100644 --- a/system/templates/guilds.list.html.twig +++ b/system/templates/guilds.list.html.twig @@ -1,162 +1,162 @@
    -
    -
    - - - - -
    Active Guilds on {{ config.lua.serverName }}
    - - - - -
    -
    +
    +
    + + + + +
    Active Guilds on {{ config.lua.serverName }}
    + + + + +
    +
    - - - - + + +
    -
    - - - - + {% endif %} + + {% endif %} + +
    -
    -
    -
    -
    -
    - - - {% if guilds|length > 0 %} - - - - - +
    LogoDescription 
    + + + - - -
    +
    + + + + - - -
    +
    +
    +
    +
    +
    + + + {% if guilds|length > 0 %} + + + + + - {% set i = 0 %} - {% for guild in guilds %} - {% set i = i + 1 %} - - + {% set i = 0 %} + {% for guild in guilds %} + {% set i = i + 1 %} + + - + {% if guild.description is not empty %} +
    + {{ guild.description }} + {% endif %} + - - - {% endfor %} - {% else %} - - + + + {% endfor %} + {% else %} + + - {% if logged %} - - {% endif %} - - {% endif %} - -
    LogoDescription 
    - -
    + + - - {{ guild.name }}{% if isAdmin %} - Delete this guild (for ADMIN only!){% endif %} - + + + {{ guild.name }}{% if isAdmin %} - Delete this guild (for ADMIN only!){% endif %} + - {% if guild.description is not empty %} -
    - {{ guild.description }} - {% endif %} -
    - - - - - - -
    -
    - {{ include('buttons.view.html.twig') }} -
    -
    -
    - Create Guild -
    - Actually there is no guild on server.{% if logged %} Create first! Press button "Create Guild"{% endif %} -
    + + + + + + +
    +
    + {{ include('buttons.view.html.twig') }} +
    +
    +
    + Create Guild +
    + Actually there is no guild on server.{% if logged %} Create first! Press button "Create Guild"{% endif %} +
    - - - - {% set button_name = 'Found Guild' %} - {% set button_image = '_sbutton_foundguild' %} - {% include('buttons.base.html.twig') %} - - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    + {% if logged %} +
    + + + + {% set button_name = 'Found Guild' %} + {% set button_image = '_sbutton_foundguild' %} + {% include('buttons.base.html.twig') %} + + +
    +
    +
    + +
    +
    +
    +
    +
    +
    +
    +
    + + + +

- - - + + + - + {% if logged %} +
+ If you have any problem with guilds try: +
+ Cleanup players - can't join guild/be invited? Can't create guild? Try cleanup players. +
+ Cleanup guilds - made guild, you are a leader, but you are not on players list? Cleanup guilds! + {% endif %} + - - - + + +
- -
+ + - - - {% if logged %} - No guild found that suits your needs? - - {% set button_name = 'Found Guild' %} - {% set button_image = '_sbutton_foundguild' %} - {% include('buttons.base.html.twig') %} - - {% else %} - Before you can create a guild you must login. -
- - {% include('buttons.login.html.twig') %} - - {% endif %} - -
+
+ + + {% if logged %} + No guild found that suits your needs? + + {% set button_name = 'Found Guild' %} + {% set button_image = '_sbutton_foundguild' %} + {% include('buttons.base.html.twig') %} + + {% else %} + Before you can create a guild you must login. +
+ + {% include('buttons.login.html.twig') %} + + {% endif %} + +
- {% if logged %} -
- If you have any problem with guilds try: -
- Cleanup players - can't join guild/be invited? Can't create guild? Try cleanup players. -
- Cleanup guilds - made guild, you are a leader, but you are not on players list? Cleanup guilds! - {% endif %} -
- -
+ +
diff --git a/system/templates/guilds.view.html.twig b/system/templates/guilds.view.html.twig index 52d5e8b5..36efbc3d 100644 --- a/system/templates/guilds.view.html.twig +++ b/system/templates/guilds.view.html.twig @@ -1,347 +1,347 @@
-
-
- - - - +
+
+
- -
+ + + - + - - - -
+ +

{{ guild_name }}

{{ guild_name }}

- -
-
+ + + + + + +
- - - - + + +
-
-
-
-
- - - - -
Guild Information
- - - - -
-
-
+ + + + + + +
+
+
+
+
+ + + + +
Guild Information
+ + + + +
+
+
- - - - + + +
-
- - - - - - -
-
- {% if descriptions is not empty %} - {{ description }} -
-
- {% endif %} + + + + - - -
+
+ + + + - - -
+
+ {% if descriptions is not empty %} + {{ description }} +
+
+ {% endif %} - {% if guild_owner is not empty %} - {% set guildOwnerName = guild_owner.getName() %} + {% if guild_owner is not empty %} + {% set guildOwnerName = guild_owner.getName() %} - {{ guildOwnerName }} is guild leader of {{ guild_name }}. -
- {% endif %} + {{ guildOwnerName }} is guild leader of {{ guild_name }}. +
+ {% endif %} - The guild was founded on {{ config.lua.serverName }} on {{ guild_creation_date|date("j F Y") }}. - {% if isLeader %} - - Manage Guild - - {% endif %} -
-
-
-
-
-
+ The guild was founded on {{ config.lua.serverName }} on {{ guild_creation_date|date("j F Y") }}. + {% if isLeader %} + + Manage Guild + + {% endif %} +
+
+
+
+
+
-
-
-
-
-
- - - - -
Guild Members
- - - - -
-
-
+
+
+
+
+
+ + + + +
Guild Members
+ + + + +
+
+
- - - - + + +
-
- - - - + + + {% endfor %} + +
-
-
- - - - - - - - - +
RankName{% if useGuildNick %} and Title{% endif %}VocationLevelStatus
+ + + - - -
+
+ + + + - - -
+
+
+ + + + + + + + + - {% set showedRank, i = false, 0 %} - {% for rank in guild_members if rank.members|length > 0 %} - {% set rankStyle, i = getStyle(i), i + 1 %} + {% set showedRank, i = false, 0 %} + {% for rank in guild_members if rank.members|length > 0 %} + {% set rankStyle, i = getStyle(i), i + 1 %} - {% for player in rank.members %} - - + {% for player in rank.members %} + + - + {% if level_in_guild > rank.rank_level or isLeader %} + {% if guildOwnerName != playerName %} + + {KICK} + + {% endif %} + {% endif %} + {% else %} + {% if showGuildNick %} ({{ guildNickRaw }}){% endif %} + {% endif %} + + - - - - - {% endfor %} + + + + + {% endfor %} - {% set showedRank = false %} - {% else %} - - - - {% endfor %} - -
RankName{% if useGuildNick %} and Title{% endif %}VocationLevelStatus
- {% if not showedRank %}{{ rank.rank_name }}{% endif %} - {% set showedRank = true %} -
+ {% if not showedRank %}{{ rank.rank_name }}{% endif %} + {% set showedRank = true %} + - {% set playerName = player.getName() %} -
- {{ getPlayerLink(playerName, true)|raw }} +
+ {% set playerName = player.getName() %} + + {{ getPlayerLink(playerName, true)|raw }} - {% set showGuildNick = false %} - {% if player.getGuildNick() is not empty %} - {% set showGuildNick = true %} - {% set guildNickRaw = player.getGuildNick()|raw %} - {% endif %} + {% set showGuildNick = false %} + {% if player.getGuildNick() is not empty %} + {% set showGuildNick = true %} + {% set guildNickRaw = player.getGuildNick()|raw %} + {% endif %} - {% if logged %} - {% if player.getId() in players_from_account_ids %} - () - {% else %} - {% if showGuildNick %} ({{ guildNickRaw }}){% endif %} - {% endif %} + {% if logged %} + {% if player.getId() in players_from_account_ids %} + () + {% else %} + {% if showGuildNick %} ({{ guildNickRaw }}){% endif %} + {% endif %} - {% if level_in_guild > rank.rank_level or isLeader %} - {% if guildOwnerName != playerName %} - - {KICK} - - {% endif %} - {% endif %} - {% else %} - {% if showGuildNick %} ({{ guildNickRaw }}){% endif %} - {% endif %} - - {{ player.getVocationName() }}{{ player.getLevel() }} - Online{% else %} red;">Offline{% endif %} -
{{ player.getVocationName() }}{{ player.getLevel() }} + Online{% else %} red;">Offline{% endif %} +
No guild members found.
-
-
-
-
-
-
-
+ {% set showedRank = false %} + {% else %} +
No guild members found.
+
+ +
+
+ + + + +
+
-
-
-
- - - - -
Invited Characters
- - - - -
-
+
+
+
+ + + + +
Invited Characters
+ + + + +
+
- - - - + + +
-
- - - - + + {% endif %} + {% else %} + + + + {% endfor %} + +
-
- - - - - +
Name
+ + + - - -
+
+ + + + - - -
+
+ + + + + - {% set i = 0 %} - {% for invited_player in invited_list if invited_list|length > 0 %} - {% if invited_player.isLoaded() %} - - {% set i = i + 1 %} + {% set i = 0 %} + {% for invited_player in invited_list if invited_list|length > 0 %} + {% if invited_player.isLoaded() %} + + {% set i = i + 1 %} - - - {% endif %} - {% else %} - - - - {% endfor %} - -
Name
- {{ getPlayerLink(invited_player.getName(), true)|raw }} + + {{ getPlayerLink(invited_player.getName(), true)|raw }} - {% if isVice %} - - {% endif %} -
- No invited characters found. -
-
-
-
-
-
-
+ {% if isVice %} + + {% endif %} +
+ No invited characters found. +
+
+
+
+ + + + +
+
-
- - - - + + +
-
- - - - + + + +
-
- - - - {% if not logged %} - - - - {% else %} - {% if show_accept_invite > 0 %} - - - - {% endif %} +
+
- {{ include('buttons.login.html.twig') }} -
- -
+ + + - - -
+
+ + + + - - -
+
+ + + + {% if not logged %} + + + + {% else %} + {% if show_accept_invite > 0 %} + + + + {% endif %} - {% if isVice %} - - - + {% if isVice %} + + + - - - - {% endif %} + + + + {% endif %} - {% if players_from_account_in_guild|length > 0 %} - - - - {% endif %} - {% endif %} + {% if players_from_account_in_guild|length > 0 %} + + + + {% endif %} + {% endif %} - - - - - -
+ {{ include('buttons.login.html.twig') }} +
+ +
- {% set button_name = 'Invite Character' %} - {% set button_image = '_sbutton_invitecharacter' %} - {% include('buttons.base.html.twig') %} -
+ {% set button_name = 'Invite Character' %} + {% set button_image = '_sbutton_invitecharacter' %} + {% include('buttons.base.html.twig') %} +
- {% set button_name = 'Edit Ranks' %} - {% set button_image = '_sbutton_editranks' %} - {% include('buttons.base.html.twig') %} -
+ {% set button_name = 'Edit Ranks' %} + {% set button_image = '_sbutton_editranks' %} + {% include('buttons.base.html.twig') %} +
- {% set button_name = 'Leave Guild' %} - {% set button_image = '_sbutton_leaveguild' %} - {% include('buttons.base.html.twig') %} -
+ {% set button_name = 'Leave Guild' %} + {% set button_image = '_sbutton_leaveguild' %} + {% include('buttons.base.html.twig') %} +
- {{ include('buttons.back.html.twig') }} -
-
-
-
-
-
- - +
+
+ {{ include('buttons.back.html.twig') }} +
+
+
+
+ + + + +
+
+
From d17c547bcaf32c85308d162828c4f45d0bc13775 Mon Sep 17 00:00:00 2001 From: slawkens Date: Wed, 15 Feb 2023 17:12:56 +0100 Subject: [PATCH 13/68] add $params as optional parameter to hook twig function --- system/twig.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/twig.php b/system/twig.php index 87d2ad6f..4f3639d8 100644 --- a/system/twig.php +++ b/system/twig.php @@ -90,14 +90,14 @@ $function = new TwigFunction('truncate', function ($s, $n) { }); $twig->addFunction($function); -$function = new TwigFunction('hook', function ($hook) { +$function = new TwigFunction('hook', function ($hook, array $params = []) { global $hooks; if(is_string($hook)) { $hook = constant($hook); } - $hooks->trigger($hook); + $hooks->trigger($hook, $params); }); $twig->addFunction($function); From 61285b6b8c5a2aae8a1748d32171edc76e9fb78d Mon Sep 17 00:00:00 2001 From: slawkens Date: Wed, 15 Feb 2023 17:32:48 +0100 Subject: [PATCH 14/68] small fix to routes with string --- system/router.php | 2 +- system/routes.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/system/router.php b/system/router.php index 4f3b6321..60d5268a 100644 --- a/system/router.php +++ b/system/router.php @@ -118,7 +118,7 @@ $dispatcher = FastRoute\cachedDispatcher(function (FastRoute\RouteCollector $r) $aliases = [ [':int', ':string', ':alphanum'], - [':\d+', ':[A-Za-z0-9-_%+\']+}', ':[A-Za-z0-9]+'], + [':\d+', ':[A-Za-z0-9-_%+\']+', ':[A-Za-z0-9]+'], ]; // apply aliases diff --git a/system/routes.php b/system/routes.php index c6dfa780..28d03168 100644 --- a/system/routes.php +++ b/system/routes.php @@ -30,7 +30,7 @@ return [ ['GET', 'account/confirm_email/{hash:[A-Za-z0-9-_]+}[/]', 'account/confirm_email.php'], ['GET', 'bans/{page:\d+}[/]', 'bans.php'], - [['GET', 'POST'], 'characters[/{name:string]', 'characters.php'], + [['GET', 'POST'], 'characters[/{name:string}]', 'characters.php'], ['GET', 'changelog[/{page:int}]', 'changelog.php'], ['GET', 'creatures[/{name:string}]', 'creatures.php'], From 3ed9a5d3d8981d861f03edf9a8790237c4bc8434 Mon Sep 17 00:00:00 2001 From: slawkens Date: Thu, 16 Feb 2023 05:16:22 +0100 Subject: [PATCH 15/68] add hook: HOOK_GUILDS_AFTER_INVITED_CHARACTERS, for guild wars --- system/hooks.php | 4 +++- system/pages/guilds/show.php | 1 + system/templates/guilds.view.html.twig | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/system/hooks.php b/system/hooks.php index 448d40c0..3c4629d9 100644 --- a/system/hooks.php +++ b/system/hooks.php @@ -66,8 +66,10 @@ define('HOOK_ADMIN_LOGIN_AFTER_ACCOUNT', ++$i); define('HOOK_ADMIN_LOGIN_AFTER_PASSWORD', ++$i); define('HOOK_ADMIN_LOGIN_AFTER_SIGN_IN', ++$i); define('HOOK_EMAIL_CONFIRMED', ++$i); +define('HOOK_GUILDS_AFTER_INVITED_CHARACTERS', ++$i); + const HOOK_FIRST = HOOK_STARTUP; -const HOOK_LAST = HOOK_EMAIL_CONFIRMED; +define('HOOK_LAST', $i); require_once LIBS . 'plugins.php'; class Hook diff --git a/system/pages/guilds/show.php b/system/pages/guilds/show.php index f4b4f15c..34420e23 100644 --- a/system/pages/guilds/show.php +++ b/system/pages/guilds/show.php @@ -148,6 +148,7 @@ if($db->hasColumn('players', 'guildnick')) $twig->display('guilds.view.html.twig', array( 'logo' => $guild_logo, + 'guild_id' => $guild->getId(), 'guild_name' => $guild_name, 'description' => $description, 'guild_owner' => $guild_owner->isLoaded() ? $guild_owner : null, diff --git a/system/templates/guilds.view.html.twig b/system/templates/guilds.view.html.twig index 36efbc3d..a6d7c60e 100644 --- a/system/templates/guilds.view.html.twig +++ b/system/templates/guilds.view.html.twig @@ -265,6 +265,8 @@

+ {{ hook(constant('HOOK_GUILDS_AFTER_INVITED_CHARACTERS'), { 'guild_id': guild_id }) }} +
From c7ec1f44e9281db3a725f7da783b3dd2c7dece6e Mon Sep 17 00:00:00 2001 From: slawkens Date: Thu, 16 Feb 2023 06:57:46 +0100 Subject: [PATCH 16/68] Option to enable/disable plugin by renaming file + cleanup new function: getAllPluginsJson removeComments removed - json doesnt allow for comments anyway --- admin/pages/plugins.php | 48 ++++++--- system/functions.php | 13 ++- system/libs/plugins.php | 127 +++++++++++++---------- system/templates/admin.plugins.html.twig | 17 ++- 4 files changed, 129 insertions(+), 76 deletions(-) diff --git a/admin/pages/plugins.php b/admin/pages/plugins.php index 65132118..6072455b 100644 --- a/admin/pages/plugins.php +++ b/admin/pages/plugins.php @@ -23,13 +23,29 @@ if (isset($_REQUEST['uninstall'])) { } else { error('Error while uninstalling plugin ' . $uninstall . ': ' . Plugins::getError()); } -} else if (isset($_FILES["plugin"]["name"])) { - $file = $_FILES["plugin"]; - $filename = $file["name"]; - $tmp_name = $file["tmp_name"]; - $type = $file["type"]; +} +else if (isset($_REQUEST['enable'])) { + $enable = $_REQUEST['enable']; + if (Plugins::enable($enable)) { + success('Successfully enabled plugin ' . $enable); + } else { + error('Error while enabling plugin ' . $enable . ': ' . Plugins::getError()); + } +} +else if (isset($_REQUEST['disable'])) { + $disable = $_REQUEST['disable']; + if (Plugins::disable($disable)) { + success('Successfully disabled plugin ' . $disable); + } else { + error('Error while disabling plugin ' . $disable . ': ' . Plugins::getError()); + } +} else if (isset($_FILES['plugin']['name'])) { + $file = $_FILES['plugin']; + $filename = $file['name']; + $tmp_name = $file['tmp_name']; + $type = $file['type']; - $name = explode(".", $filename); + $name = explode('.', $filename); $accepted_types = array('application/zip', 'application/x-zip-compressed', 'multipart/x-zip', 'application/x-compressed', 'application/octet-stream', 'application/zip-compressed'); if (isset($file['error'])) { @@ -90,21 +106,23 @@ if (isset($_REQUEST['uninstall'])) { } $plugins = array(); -foreach (get_plugins() as $plugin) { +foreach (get_plugins(true) as $plugin) { $string = file_get_contents(BASE . 'plugins/' . $plugin . '.json'); - $string = Plugins::removeComments($string); $plugin_info = json_decode($string, true); - if ($plugin_info == false) { + if (!$plugin_info) { warning('Cannot load plugin info ' . $plugin . '.json'); } else { + $disabled = (strpos($plugin, 'disabled.') !== false); + $pluginOriginal = ($disabled ? str_replace('disabled.', '', $plugin) : $plugin); $plugins[] = array( - 'name' => isset($plugin_info['name']) ? $plugin_info['name'] : '', - 'description' => isset($plugin_info['description']) ? $plugin_info['description'] : '', - 'version' => isset($plugin_info['version']) ? $plugin_info['version'] : '', - 'author' => isset($plugin_info['author']) ? $plugin_info['author'] : '', - 'contact' => isset($plugin_info['contact']) ? $plugin_info['contact'] : '', - 'file' => $plugin, + 'name' => $plugin_info['name'] ?? '', + 'description' => $plugin_info['description'] ?? '', + 'version' => $plugin_info['version'] ?? '', + 'author' => $plugin_info['author'] ?? '', + 'contact' => $plugin_info['contact'] ?? '', + 'file' => $pluginOriginal, + 'enabled' => !$disabled, 'uninstall' => isset($plugin_info['uninstall']) ); } diff --git a/system/functions.php b/system/functions.php index a2c7d202..d1184272 100644 --- a/system/functions.php +++ b/system/functions.php @@ -791,16 +791,21 @@ function get_templates() * Generates list of installed plugins * @return array $plugins */ -function get_plugins() +function get_plugins($disabled = false): array { - $ret = array(); + $ret = []; $path = PLUGINS; - foreach(scandir($path, 0) as $file) { + foreach(scandir($path, SCANDIR_SORT_DESCENDING) as $file) { $file_ext = pathinfo($file, PATHINFO_EXTENSION); $file_name = pathinfo($file, PATHINFO_FILENAME); - if ($file === '.' || $file === '..' || $file === 'disabled' || $file === 'example.json' || $file_ext !== 'json' || is_dir($path . $file)) + if ($file === '.' || $file === '..' || $file === 'example.json' || $file_ext !== 'json' || is_dir($path . $file)) { continue; + } + + if (!$disabled && strpos($file, 'disabled.') !== false) { + continue; + } $ret[] = str_replace('.json', '', $file_name); } diff --git a/system/libs/plugins.php b/system/libs/plugins.php index 3d9792b9..420c1cdd 100644 --- a/system/libs/plugins.php +++ b/system/libs/plugins.php @@ -10,7 +10,7 @@ */ defined('MYAAC') or die('Direct access not allowed!'); -function is_sub_dir($path = NULL, $parent_folder = SITE_PATH) { +function is_sub_dir($path = NULL, $parent_folder = BASE) { //Get directory path minus last folder $dir = dirname($path); @@ -41,9 +41,9 @@ function is_sub_dir($path = NULL, $parent_folder = SITE_PATH) { use Composer\Semver\Semver; class Plugins { - private static $warnings = array(); + private static $warnings = []; private static $error = null; - private static $plugin_json = array(); + private static $plugin_json = []; public static function getRoutes() { @@ -56,22 +56,8 @@ class Plugins { } $routes = []; - foreach(get_plugins() as $filename) { - $string = file_get_contents(PLUGINS . $filename . '.json'); - $string = self::removeComments($string); - $plugin = json_decode($string, true); - self::$plugin_json = $plugin; - if ($plugin == null) { - self::$warnings[] = 'Cannot load ' . $filename . '.json. File might be not a valid json code.'; - continue; - } - - if(isset($plugin['enabled']) && !getBoolean($plugin['enabled'])) { - self::$warnings[] = 'Skipping ' . $filename . '... The plugin is disabled.'; - continue; - } - - $warningPreTitle = 'Plugin: ' . $filename . ' - '; + foreach(self::getAllPluginsJson() as $plugin) { + $warningPreTitle = 'Plugin: ' . $plugin['name'] . ' - '; if (isset($plugin['routes'])) { foreach ($plugin['routes'] as $_name => $info) { @@ -161,28 +147,14 @@ class Plugins { } $hooks = []; - foreach(get_plugins() as $filename) { - $string = file_get_contents(PLUGINS . $filename . '.json'); - $string = self::removeComments($string); - $plugin = json_decode($string, true); - self::$plugin_json = $plugin; - if ($plugin == null) { - self::$warnings[] = 'Cannot load ' . $filename . '.json. File might be not a valid json code.'; - continue; - } - - if(isset($plugin['enabled']) && !getBoolean($plugin['enabled'])) { - self::$warnings[] = 'Skipping ' . $filename . '... The plugin is disabled.'; - continue; - } - + foreach(self::getAllPluginsJson() as $plugin) { if (isset($plugin['hooks'])) { foreach ($plugin['hooks'] as $_name => $info) { if (defined('HOOK_'. $info['type'])) { $hook = constant('HOOK_'. $info['type']); $hooks[] = ['name' => $_name, 'type' => $hook, 'file' => $info['file']]; } else { - self::$warnings[] = 'Plugin: ' . $filename . '. Unknown event type: ' . $info['type']; + self::$warnings[] = 'Plugin: ' . $plugin['name'] . '. Unknown event type: ' . $info['type']; } } } @@ -195,6 +167,41 @@ class Plugins { return $hooks; } + public static function getAllPluginsJson($disabled = false) + { + $cache = Cache::getInstance(); + if ($cache->enabled()) { + $tmp = ''; + if ($cache->fetch('plugins', $tmp)) { + return unserialize($tmp); + } + } + + $plugins = []; + foreach (get_plugins($disabled) as $filename) { + $string = file_get_contents(PLUGINS . $filename . '.json'); + $plugin = json_decode($string, true); + self::$plugin_json = $plugin; + if ($plugin == null) { + self::$warnings[] = 'Cannot load ' . $filename . '.json. File might be not a valid json code.'; + continue; + } + + if (isset($plugin['enabled']) && !getBoolean($plugin['enabled'])) { + self::$warnings[] = 'Skipping ' . $filename . '... The plugin is disabled.'; + continue; + } + + $plugins[] = $plugin; + } + + if ($cache->enabled()) { + $cache->set('plugins', serialize($plugins), 600); + } + + return $plugins; + } + public static function install($file) { global $db; @@ -235,7 +242,6 @@ class Plugins { } $string = file_get_contents($file_name); - $string = self::removeComments($string); $plugin_json = json_decode($string, true); self::$plugin_json = $plugin_json; if ($plugin_json == null) { @@ -435,7 +441,35 @@ class Plugins { return false; } - public static function uninstall($plugin_name) + public static function enable($pluginFileName): bool + { + return self::enableDisable($pluginFileName, true); + } + + public static function disable($pluginFileName): bool + { + return self::enableDisable($pluginFileName, false); + } + + private static function enableDisable($pluginFileName, $enable): bool + { + $filenameJson = $pluginFileName . '.json'; + $fileExist = is_file(PLUGINS . ($enable ? 'disabled.' : '') . $filenameJson); + if (!$fileExist) { + self::$error = 'Cannot ' . ($enable ? 'enable' : 'disable') . ' plugin: ' . $pluginFileName . '. File does not exist.'; + return false; + } + + $result = rename(PLUGINS . ($enable ? 'disabled.' : '') . $filenameJson, PLUGINS . ($enable ? '' : 'disabled.') . $filenameJson); + if (!$result) { + self::$error = 'Cannot ' . ($enable ? 'enable' : 'disable') . ' plugin: ' . $pluginFileName . '. Permission problem.'; + return false; + } + + return true; + } + + public static function uninstall($plugin_name): bool { $filename = BASE . 'plugins/' . $plugin_name . '.json'; if(!file_exists($filename)) { @@ -443,9 +477,8 @@ class Plugins { return false; } $string = file_get_contents($filename); - $string = self::removeComments($string); $plugin_info = json_decode($string, true); - if($plugin_info == false) { + if(!$plugin_info) { self::$error = 'Cannot load plugin info ' . $plugin_name . '.json'; return false; } @@ -527,22 +560,6 @@ class Plugins { return self::$plugin_json; } - public static function removeComments($string) { - $string = preg_replace('!/\*.*?\*/!s', '', $string); - $string = preg_replace('/\n\s*\n/', "\n", $string); - // Removes multi-line comments and does not create - // a blank line, also treats white spaces/tabs - $string = preg_replace('!^[ \t]*/\*.*?\*/[ \t]*[\r\n]!s', '', $string); - - // Removes single line '//' comments, treats blank characters - $string = preg_replace('![ \t]*//.*[ \t]*[\r\n]!', '', $string); - - // Strip blank lines - $string = preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $string); - - return $string; - } - /** * Install menus * Helper function for plugins diff --git a/system/templates/admin.plugins.html.twig b/system/templates/admin.plugins.html.twig index 07d2c044..bffb82f3 100644 --- a/system/templates/admin.plugins.html.twig +++ b/system/templates/admin.plugins.html.twig @@ -6,6 +6,7 @@
+ @@ -16,6 +17,17 @@ {% for plugin in plugins %} + @@ -29,7 +41,8 @@ - {% endif %} + {% endif %} + {% endfor %} @@ -39,6 +52,6 @@ From d04e44f52f2583bed91cb85e86282ced1d7c8283 Mon Sep 17 00:00:00 2001 From: slawkens Date: Thu, 16 Feb 2023 07:21:38 +0100 Subject: [PATCH 17/68] add info which plugin is going to be uninstalled --- system/functions.php | 2 +- system/templates/admin.plugins.html.twig | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/system/functions.php b/system/functions.php index d1184272..e489ffb9 100644 --- a/system/functions.php +++ b/system/functions.php @@ -796,7 +796,7 @@ function get_plugins($disabled = false): array $ret = []; $path = PLUGINS; - foreach(scandir($path, SCANDIR_SORT_DESCENDING) as $file) { + foreach(scandir($path, SCANDIR_SORT_ASCENDING) as $file) { $file_ext = pathinfo($file, PATHINFO_EXTENSION); $file_name = pathinfo($file, PATHINFO_FILENAME); if ($file === '.' || $file === '..' || $file === 'example.json' || $file_ext !== 'json' || is_dir($path . $file)) { diff --git a/system/templates/admin.plugins.html.twig b/system/templates/admin.plugins.html.twig index bffb82f3..d6ffe7b2 100644 --- a/system/templates/admin.plugins.html.twig +++ b/system/templates/admin.plugins.html.twig @@ -38,7 +38,7 @@ + + + +
Enabled Name Version Author
+ {% if plugin.enabled %} + + Enabled + + {% else %} + + Disabled + + {% endif %} + {{ plugin.name }}
{{ plugin.description|raw }}
{{ plugin.file }}.json {% if plugin.uninstall %} - + {% endif %} From 58598742e88f21ab8d30007e7bde16143fcf509d Mon Sep 17 00:00:00 2001 From: slawkens Date: Thu, 16 Feb 2023 08:43:21 +0100 Subject: [PATCH 18/68] change spaces to tabs --- system/pages/houses.php | 264 +++++++++++----------- system/templates/houses.html.twig | 298 ++++++++++++------------- system/templates/houses.view.html.twig | 90 ++++---- 3 files changed, 326 insertions(+), 326 deletions(-) diff --git a/system/pages/houses.php b/system/pages/houses.php index db1a6992..de4bc943 100644 --- a/system/pages/houses.php +++ b/system/pages/houses.php @@ -14,17 +14,17 @@ $title = 'Houses'; $errors = array(); if(!$db->hasColumn('houses', 'name')) { - $errors[] = 'Houses list is not available on this server.'; + $errors[] = 'Houses list is not available on this server.'; - $twig->display('houses.html.twig', array( - 'errors' => $errors - )); + $twig->display('houses.html.twig', array( + 'errors' => $errors + )); return; } $rentType = trim(strtolower($config['lua']['houseRentPeriod'])); if($rentType != 'yearly' && $rentType != 'monthly' && $rentType != 'weekly' && $rentType != 'daily') - $rentType = 'never'; + $rentType = 'never'; $state = ''; $order = ''; @@ -32,116 +32,116 @@ $type = ''; if(isset($_GET['page']) && $_GET['page'] == 'view' && isset($_REQUEST['house'])) { - $beds = array("", "one", "two", "three", "fourth", "fifth"); - $houseName = $_REQUEST['house']; - $houseId = (Validator::number($_REQUEST['house']) ? $_REQUEST['house'] : -1); - $selectHouse = $db->query('SELECT * FROM ' . $db->tableName('houses') . ' WHERE ' . $db->fieldName('name') . ' LIKE ' . $db->quote($houseName) . ' OR `id` = ' . $db->quote($houseId)); + $beds = array("", "one", "two", "three", "fourth", "fifth"); + $houseName = $_REQUEST['house']; + $houseId = (Validator::number($_REQUEST['house']) ? $_REQUEST['house'] : -1); + $selectHouse = $db->query('SELECT * FROM ' . $db->tableName('houses') . ' WHERE ' . $db->fieldName('name') . ' LIKE ' . $db->quote($houseName) . ' OR `id` = ' . $db->quote($houseId)); - $house = array(); - if($selectHouse->rowCount() > 0) - { - $house = $selectHouse->fetch(); - $houseId = $house['id']; + $house = array(); + if($selectHouse->rowCount() > 0) + { + $house = $selectHouse->fetch(); + $houseId = $house['id']; - $title = $house['name'] . ' - ' . $title; + $title = $house['name'] . ' - ' . $title; - $imgPath = 'images/houses/' . $houseId . '.gif'; - if(!file_exists($imgPath)) { - $imgPath = 'images/houses/default.jpg'; - } + $imgPath = 'images/houses/' . $houseId . '.gif'; + if(!file_exists($imgPath)) { + $imgPath = 'images/houses/default.jpg'; + } - $bedsMessage = null; - $houseBeds = $house['beds']; - if($houseBeds > 0) - $bedsMessage = 'House have ' . (isset($beds[$houseBeds]) ? $beds[$houseBeds] : $houseBeds) . ' bed' . ($houseBeds > 1 ? 's' : ''); - else - $bedsMessage = 'This house dont have any beds'; + $bedsMessage = null; + $houseBeds = $house['beds']; + if($houseBeds > 0) + $bedsMessage = 'House have ' . (isset($beds[$houseBeds]) ? $beds[$houseBeds] : $houseBeds) . ' bed' . ($houseBeds > 1 ? 's' : ''); + else + $bedsMessage = 'This house dont have any beds'; - $houseOwner = $house['owner']; - if($houseOwner > 0) - { - $guild = NULL; - $owner = null; - if(isset($house['guild']) && $house['guild'] == 1) - { - $guild = new OTS_Guild(); - $guild->load($houseOwner); - $owner = getGuildLink($guild->getName()); - } - else - $owner = getCreatureName($houseOwner); + $houseOwner = $house['owner']; + if($houseOwner > 0) + { + $guild = NULL; + $owner = null; + if(isset($house['guild']) && $house['guild'] == 1) + { + $guild = new OTS_Guild(); + $guild->load($houseOwner); + $owner = getGuildLink($guild->getName()); + } + else + $owner = getCreatureName($houseOwner); - if($rentType != 'never' && $house['paid'] > 0) - { - $who = ''; - if($guild) - $who = $guild->getName(); - else - { - $player = new OTS_Player(); - $player->load($houseOwner); - if($player->isLoaded()) - { - $sexs = array('She', 'He'); - $who = $sexs[$player->getSex()]; - } - } - $owner .= ' ' . $who . ' has paid the rent until ' . date("M d Y, H:i:s", $house['paid']) . ' CEST.'; - } - } - } - else - $errors[] = 'House with name ' . $houseName . ' does not exists.'; + if($rentType != 'never' && $house['paid'] > 0) + { + $who = ''; + if($guild) + $who = $guild->getName(); + else + { + $player = new OTS_Player(); + $player->load($houseOwner); + if($player->isLoaded()) + { + $sexs = array('She', 'He'); + $who = $sexs[$player->getSex()]; + } + } + $owner .= ' ' . $who . ' has paid the rent until ' . date("M d Y, H:i:s", $house['paid']) . ' CEST.'; + } + } + } + else + $errors[] = 'House with name ' . $houseName . ' does not exists.'; - $twig->display('houses.view.html.twig', array( - 'errors' => $errors, - 'imgPath' => isset($imgPath) ? $imgPath : null, - 'houseName' => isset($house['name']) ? $house['name'] : null, - 'bedsMessage' => isset($bedsMessage) ? $bedsMessage : null, - 'houseSize' => isset($house['size']) ? $house['size'] : null, - 'houseRent' => isset($house['rent']) ? $house['rent'] : null, - 'owner' => isset($owner) ? $owner : null, - 'rentType' => isset($rentType) ? $rentType : null - )); + $twig->display('houses.view.html.twig', array( + 'errors' => $errors, + 'imgPath' => isset($imgPath) ? $imgPath : null, + 'houseName' => isset($house['name']) ? $house['name'] : null, + 'bedsMessage' => isset($bedsMessage) ? $bedsMessage : null, + 'houseSize' => isset($house['size']) ? $house['size'] : null, + 'houseRent' => isset($house['rent']) ? $house['rent'] : null, + 'owner' => isset($owner) ? $owner : null, + 'rentType' => isset($rentType) ? $rentType : null + )); - if (count($errors) > 0) { - return; - } + if (count($errors) > 0) { + return; + } } $cleanOldHouse = null; if(isset($config['lua']['houseCleanOld'])) { - $cleanOldHouse = (int)(eval('return ' . $config['lua']['houseCleanOld'] . ';') / (24 * 60 * 60)); + $cleanOldHouse = (int)(eval('return ' . $config['lua']['houseCleanOld'] . ';') / (24 * 60 * 60)); } $housesSearch = false; if(isset($_POST['town']) && isset($_POST['state']) && isset($_POST['order']) && (isset($_POST['type']) || !$db->hasColumn('houses', 'guild'))) { - $townName = $config['towns'][$_POST['town']]; - $order = $_POST['order']; - $orderby = '`name`'; - if(!empty($order)) - { - if($order == 'size') - $orderby = '`size`'; - else if($order == 'rent') - $orderby = '`rent`'; - } + $townName = $config['towns'][$_POST['town']]; + $order = $_POST['order']; + $orderby = '`name`'; + if(!empty($order)) + { + if($order == 'size') + $orderby = '`size`'; + else if($order == 'rent') + $orderby = '`rent`'; + } - $town = 'town'; - if($db->hasColumn('houses', 'town_id')) - $town = 'town_id'; - else if($db->hasColumn('houses', 'townid')) - $town = 'townid'; + $town = 'town'; + if($db->hasColumn('houses', 'town_id')) + $town = 'town_id'; + else if($db->hasColumn('houses', 'townid')) + $town = 'townid'; - $whereby = '`' . $town . '` = ' .(int)$_POST['town']; - $state = $_POST['state']; - if(!empty($state)) - $whereby .= ' AND `owner` ' . ($state == 'free' ? '' : '!'). '= 0'; + $whereby = '`' . $town . '` = ' .(int)$_POST['town']; + $state = $_POST['state']; + if(!empty($state)) + $whereby .= ' AND `owner` ' . ($state == 'free' ? '' : '!'). '= 0'; - $type = isset($_POST['type']) ? $_POST['type'] : NULL; - if($type == 'guildhalls' && !$db->hasColumn('houses', 'guild')) - $type = 'all'; + $type = isset($_POST['type']) ? $_POST['type'] : NULL; + if($type == 'guildhalls' && !$db->hasColumn('houses', 'guild')) + $type = 'all'; if (!empty($type) && $type != 'all') { @@ -158,49 +158,49 @@ if(isset($_POST['town']) && isset($_POST['state']) && isset($_POST['order']) && } } - $houses_info = $db->query('SELECT * FROM `houses` WHERE ' . $whereby. ' ORDER BY ' . $orderby); + $houses_info = $db->query('SELECT * FROM `houses` WHERE ' . $whereby. ' ORDER BY ' . $orderby); - $players_info = $db->query("SELECT `houses`.`id` AS `houseid` , `players`.`name` AS `ownername` FROM `houses` , `players` , `accounts` WHERE `players`.`id` = `houses`.`owner` AND `accounts`.`id` = `players`.`account_id`"); - $players = array(); - foreach($players_info->fetchAll() as $player) - $players[$player['houseid']] = array('name' => $player['ownername']); + $players_info = $db->query("SELECT `houses`.`id` AS `houseid` , `players`.`name` AS `ownername` FROM `houses` , `players` , `accounts` WHERE `players`.`id` = `houses`.`owner` AND `accounts`.`id` = `players`.`account_id`"); + $players = array(); + foreach($players_info->fetchAll() as $player) + $players[$player['houseid']] = array('name' => $player['ownername']); - $houses = array(); - foreach($houses_info->fetchAll() as $house) - { - $owner = isset($players[$house['id']]) ? $players[$house['id']] : array(); + $houses = array(); + foreach($houses_info->fetchAll() as $house) + { + $owner = isset($players[$house['id']]) ? $players[$house['id']] : array(); - $houseRent = null; - if($db->hasColumn('houses', 'guild') && $house['guild'] == 1 && $house['owner'] != 0) - { - $guild = new OTS_Guild(); - $guild->load($house['owner']); - $houseRent = 'Rented by ' . getGuildLink($guild->getName()); - } - else - { - if(!empty($owner['name'])) - $houseRent = 'Rented by ' . getPlayerLink($owner['name']); - else - $houseRent = 'Free'; - } + $houseRent = null; + if($db->hasColumn('houses', 'guild') && $house['guild'] == 1 && $house['owner'] != 0) + { + $guild = new OTS_Guild(); + $guild->load($house['owner']); + $houseRent = 'Rented by ' . getGuildLink($guild->getName()); + } + else + { + if(!empty($owner['name'])) + $houseRent = 'Rented by ' . getPlayerLink($owner['name']); + else + $houseRent = 'Free'; + } - $houses[] = array('owner' => $owner, 'name' => $house['name'], 'size' => $house['size'], 'rent' => $house['rent'], 'rentedBy' => $houseRent); - } + $houses[] = array('owner' => $owner, 'name' => $house['name'], 'size' => $house['size'], 'rent' => $house['rent'], 'rentedBy' => $houseRent); + } - $housesSearch = true; + $housesSearch = true; } $guild = $db->hasColumn('houses', 'guild') ? ' or guildhall' : ''; $twig->display('houses.html.twig', array( - 'state' => $state, - 'order' => $order, - 'type' => $type, - 'houseType' => $type == 'guildhalls' ? 'Guildhalls' : 'Houses and Flats', - 'townName' => isset($townName) ? $townName : null, - 'townId' => isset($_POST['town']) ? $_POST['town'] : null, - 'guild' => $guild, - 'cleanOldHouse' => isset($cleanOld) ? $cleanOld : null, - 'housesSearch' => $housesSearch, - 'houses' => isset($houses) ? $houses : null -)); \ No newline at end of file + 'state' => $state, + 'order' => $order, + 'type' => $type, + 'houseType' => $type == 'guildhalls' ? 'Guildhalls' : 'Houses and Flats', + 'townName' => isset($townName) ? $townName : null, + 'townId' => isset($_POST['town']) ? $_POST['town'] : null, + 'guild' => $guild, + 'cleanOldHouse' => isset($cleanOld) ? $cleanOld : null, + 'housesSearch' => $housesSearch, + 'houses' => isset($houses) ? $houses : null +)); diff --git a/system/templates/houses.html.twig b/system/templates/houses.html.twig index 4e75942c..20e8926d 100644 --- a/system/templates/houses.html.twig +++ b/system/templates/houses.html.twig @@ -1,171 +1,171 @@
- {% if errors is not empty %} - {% for error in errors %} -

{{ error }}

- {% endfor %} - {% else %} - -
-
- - - - -
House Search
- - - - -
-
+ {% if errors is not empty %} + {% for error in errors %} +

{{ error }}

+ {% endfor %} + {% else %} +
+
+
+ + + + +
House Search
+ + + + +
+
- - + + + {% endfor %} + {% endif %} + +
-
- Here you can see the list of all available houses, flats{{ guildString }}. - Click on any view button to get more information about a house or adjust - the search criteria and start a new search. -

- {% if cleanOldHouse is not empty or rentType != 'never' %} - Every morning during global server save there is automatic house cleaning. Server delete house owners who have not logged in last {{ cleanOldHouse }} days{% if rentType != 'never' %} or have not paid {{ rentType }} house rent. Remember to leave money for a rent in {% if config.lua.bankSystem is not empty %}your house bank or {% else %}depo in same city where you have house!{% endif %}{% else %}.{% endif %} -

- {% endif %} +
+
+ Here you can see the list of all available houses, flats{{ guildString }}. + Click on any view button to get more information about a house or adjust + the search criteria and start a new search. +

+ {% if cleanOldHouse is not empty or rentType != 'never' %} + Every morning during global server save there is automatic house cleaning. Server delete house owners who have not logged in last {{ cleanOldHouse }} days{% if rentType != 'never' %} or have not paid {{ rentType }} house rent. Remember to leave money for a rent in {% if config.lua.bankSystem is not empty %}your house bank or {% else %}depo in same city where you have house!{% endif %}{% else %}.{% endif %} +

+ {% endif %} - {% if houses is not empty or housesSearch %} - - - - - + {% if houses is not empty or housesSearch %} +
Available {{ houseType }}{% if townName is not empty %} in {{ townName }}{% endif %} on {{ config.lua.serverName }}
+ + + + - - {% if houses is not empty %} - - - + + {% if houses is not empty %} + + + - - - {% elseif housesSearch %} - - {% endif %} - + + + {% elseif housesSearch %} + + {% endif %} + - {% if houses is not empty %} - {% set i = 0 %} - {% for house in houses %} - {% set i = i + 1 %} - - + {% if houses is not empty %} + {% set i = 0 %} + {% for house in houses %} + {% set i = i + 1 %} + + - + - + - + - - - {% endfor %} - {% endif %} - -
Available {{ houseType }}{% if townName is not empty %} in {{ townName }}{% endif %} on {{ config.lua.serverName }}
NameSizeRent
NameSizeRentStatus No {{ houseType }} with specified criterias.
Status No {{ houseType }} with specified criterias.
- {{ house.name }} -
+ {{ house.name }} + - {{ house.size }} - + {{ house.size }} + - {{ house.rent }} golds - + {{ house.rent }} golds + - {{ house.rentedBy|raw }} - + {{ house.rentedBy|raw }} + -
- - {{ include('buttons.view.html.twig') }} -
-
-
- {% endif %} +
+
+ + {{ include('buttons.view.html.twig') }} +
+
+
+ {% endif %} -
- - - - - + +
House Search
+ + + + - - - - - + + + + + - - + + + +
+ {% endfor %} + - + +
+ - - + +
+ + - - - - -
House Search
TownStatusOrder
TownStatusOrder
- {% set checked = false %} - {% for id, name in config.towns if id > 0 %} - {% if ((townId is empty and name is not empty) or id == townId) and not checked %} - {% set variable = "checked" %} - {% set checked = true %} - {% else %} - {% set variable = "" %} - {% endif %} +
+ {% set checked = false %} + {% for id, name in config.towns if id > 0 %} + {% if ((townId is empty and name is not empty) or id == townId) and not checked %} + {% set variable = "checked" %} + {% set checked = true %} + {% else %} + {% set variable = "" %} + {% endif %} - - -
- {% endfor %} -
- -
+
+ +
- -
+ +
- -
-
- -
+
+ +
- -
+ +
- -
-
- -
- -
- -
-
-
+
+ +
+ +
+ +
+
+
- - - - - - -
- {{ include('buttons.submit.html.twig') }} -
- -
- - - - {% endif %} - \ No newline at end of file + + + + + + +
+ {{ include('buttons.submit.html.twig') }} +
+ + + + + + {% endif %} + diff --git a/system/templates/houses.view.html.twig b/system/templates/houses.view.html.twig index 31fc5c23..64baad76 100644 --- a/system/templates/houses.view.html.twig +++ b/system/templates/houses.view.html.twig @@ -1,51 +1,51 @@
- {% if errors is not empty %} - {% for error in errors %} -

{{ error }}

- {% endfor %} - {% else %} - -
-
- - - - -
{{ houseName }}
- - - - -
-
+ {% if errors is not empty %} + {% for error in errors %} +

{{ error }}

+ {% endfor %} + {% else %} +
+
+
+ + + + +
{{ houseName }}
+ + + + +
+
- - + +
-
- - - - + - -
- {{ bedsMessage }} and has a size of {{ houseSize }} square meters. +
+
+ + + + - -
+ {{ bedsMessage }} and has a size of {{ houseSize }} square meters. - {% if rentType != 'never' %} - The {{ rentType }} is {{ houseRent }} gold and will be debited to the bank account on {{ config.lua.serverName }}. - {% endif %} -
+ {% if rentType != 'never' %} + The {{ rentType }} is {{ houseRent }} gold and will be debited to the bank account on {{ config.lua.serverName }}. + {% endif %} +
- {% if owner is not empty %} - The house has been rented by {{ owner|raw }}. - {% else %} - No one has bought this house yet. - {% endif %} -
-
-
- {% endif %} + {% if owner is not empty %} + The house has been rented by {{ owner|raw }}. + {% else %} + No one has bought this house yet. + {% endif %} +
+
+ + + + {% endif %} -

\ No newline at end of file +

From 9a475f2c574192918e7b3f10ccb43db64daa0486 Mon Sep 17 00:00:00 2001 From: slawkens Date: Thu, 16 Feb 2023 08:44:17 +0100 Subject: [PATCH 19/68] fix for othire where size is saved in houses.tiles --- system/pages/houses.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/system/pages/houses.php b/system/pages/houses.php index de4bc943..f548d23b 100644 --- a/system/pages/houses.php +++ b/system/pages/houses.php @@ -165,6 +165,8 @@ if(isset($_POST['town']) && isset($_POST['state']) && isset($_POST['order']) && foreach($players_info->fetchAll() as $player) $players[$player['houseid']] = array('name' => $player['ownername']); + $hasTilesColumn = $db->hasColumn('houses', 'tiles'); + $houses = array(); foreach($houses_info->fetchAll() as $house) { @@ -185,7 +187,7 @@ if(isset($_POST['town']) && isset($_POST['state']) && isset($_POST['order']) && $houseRent = 'Free'; } - $houses[] = array('owner' => $owner, 'name' => $house['name'], 'size' => $house['size'], 'rent' => $house['rent'], 'rentedBy' => $houseRent); + $houses[] = array('owner' => $owner, 'name' => $house['name'], 'size' => ($hasTilesColumn ? $house['tiles'] : $house['size']), 'rent' => $house['rent'], 'rentedBy' => $houseRent); } $housesSearch = true; From 3a2870a6bb589da890c8d440a45b22a0c22246c3 Mon Sep 17 00:00:00 2001 From: slawkens Date: Thu, 16 Feb 2023 10:06:08 +0100 Subject: [PATCH 20/68] 760 is correct permission --- README.md | 2 +- install/includes/twig_error.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6fabc570..8edd3cbc 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ Official website: https://my-aac.org chmod 660 images/guilds chmod 660 images/houses chmod 660 images/gallery - chmod -R 770 system/cache + chmod -R 760 system/cache Visit http://your_domain/install (http://localhost/install) and follow instructions in the browser. diff --git a/install/includes/twig_error.html b/install/includes/twig_error.html index 40daedec..aea25001 100644 --- a/install/includes/twig_error.html +++ b/install/includes/twig_error.html @@ -1,4 +1,4 @@ -We have detected that you don't have access to write to the system/cache directory. Under linux you can fix it by using this two command, where first one should be enough (for apache):

chown -R www-data.www-data /var/www/*
chmod -R 660 system/cache +We have detected that you don't have access to write to the system/cache directory. Under linux you can fix it by using this two command, where first one should be enough (for apache):

chown -R www-data.www-data /var/www/*
chmod -R 760 system/cache ").appendTo(o)),a.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",a.opacity)),a.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",a.zIndex)),this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",e,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!s)for(n=this.containers.length-1;n>=0;n--)this.containers[n]._trigger("activate",e,this._uiHash(this));return t.ui.ddmanager&&(t.ui.ddmanager.current=this),t.ui.ddmanager&&!a.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e),this.dragging=!0,this._addClass(this.helper,"ui-sortable-helper"),this._mouseDrag(e),!0},_mouseDrag:function(e){var i,s,n,o,a=this.options,r=!1;for(this.position=this._generatePosition(e),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs),this.options.scroll&&(this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-e.pageY=0;i--)if(s=this.items[i],n=s.item[0],o=this._intersectsWithPointer(s),o&&s.instance===this.currentContainer&&n!==this.currentItem[0]&&this.placeholder[1===o?"next":"prev"]()[0]!==n&&!t.contains(this.placeholder[0],n)&&("semi-dynamic"===this.options.type?!t.contains(this.element[0],n):!0)){if(this.direction=1===o?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(s))break;this._rearrange(e,s),this._trigger("change",e,this._uiHash());break}return this._contactContainers(e),t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),this._trigger("sort",e,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(e,i){if(e){if(t.ui.ddmanager&&!this.options.dropBehaviour&&t.ui.ddmanager.drop(this,e),this.options.revert){var s=this,n=this.placeholder.offset(),o=this.options.axis,a={};o&&"x"!==o||(a.left=n.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollLeft)),o&&"y"!==o||(a.top=n.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollTop)),this.reverting=!0,t(this.helper).animate(a,parseInt(this.options.revert,10)||500,function(){s._clear(e)})}else this._clear(e,i);return!1}},cancel:function(){if(this.dragging){this._mouseUp(new t.Event("mouseup",{target:null})),"original"===this.options.helper?(this.currentItem.css(this._storedCSS),this._removeClass(this.currentItem,"ui-sortable-helper")):this.currentItem.show();for(var e=this.containers.length-1;e>=0;e--)this.containers[e]._trigger("deactivate",null,this._uiHash(this)),this.containers[e].containerCache.over&&(this.containers[e]._trigger("out",null,this._uiHash(this)),this.containers[e].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),"original"!==this.options.helper&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),t.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?t(this.domPosition.prev).after(this.currentItem):t(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(e){var i=this._getItemsAsjQuery(e&&e.connected),s=[];return e=e||{},t(i).each(function(){var i=(t(e.item||this).attr(e.attribute||"id")||"").match(e.expression||/(.+)[\-=_](.+)/);i&&s.push((e.key||i[1]+"[]")+"="+(e.key&&e.expression?i[1]:i[2]))}),!s.length&&e.key&&s.push(e.key+"="),s.join("&")},toArray:function(e){var i=this._getItemsAsjQuery(e&&e.connected),s=[];return e=e||{},i.each(function(){s.push(t(e.item||this).attr(e.attribute||"id")||"")}),s},_intersectsWith:function(t){var e=this.positionAbs.left,i=e+this.helperProportions.width,s=this.positionAbs.top,n=s+this.helperProportions.height,o=t.left,a=o+t.width,r=t.top,h=r+t.height,l=this.offset.click.top,c=this.offset.click.left,u="x"===this.options.axis||s+l>r&&h>s+l,d="y"===this.options.axis||e+c>o&&a>e+c,p=u&&d;return"pointer"===this.options.tolerance||this.options.forcePointerForContainers||"pointer"!==this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>t[this.floating?"width":"height"]?p:e+this.helperProportions.width/2>o&&a>i-this.helperProportions.width/2&&s+this.helperProportions.height/2>r&&h>n-this.helperProportions.height/2},_intersectsWithPointer:function(t){var e,i,s="x"===this.options.axis||this._isOverAxis(this.positionAbs.top+this.offset.click.top,t.top,t.height),n="y"===this.options.axis||this._isOverAxis(this.positionAbs.left+this.offset.click.left,t.left,t.width),o=s&&n;return o?(e=this._getDragVerticalDirection(),i=this._getDragHorizontalDirection(),this.floating?"right"===i||"down"===e?2:1:e&&("down"===e?2:1)):!1},_intersectsWithSides:function(t){var e=this._isOverAxis(this.positionAbs.top+this.offset.click.top,t.top+t.height/2,t.height),i=this._isOverAxis(this.positionAbs.left+this.offset.click.left,t.left+t.width/2,t.width),s=this._getDragVerticalDirection(),n=this._getDragHorizontalDirection();return this.floating&&n?"right"===n&&i||"left"===n&&!i:s&&("down"===s&&e||"up"===s&&!e)},_getDragVerticalDirection:function(){var t=this.positionAbs.top-this.lastPositionAbs.top;return 0!==t&&(t>0?"down":"up")},_getDragHorizontalDirection:function(){var t=this.positionAbs.left-this.lastPositionAbs.left;return 0!==t&&(t>0?"right":"left")},refresh:function(t){return this._refreshItems(t),this._setHandleClassName(),this.refreshPositions(),this},_connectWith:function(){var t=this.options;return t.connectWith.constructor===String?[t.connectWith]:t.connectWith},_getItemsAsjQuery:function(e){function i(){r.push(this)}var s,n,o,a,r=[],h=[],l=this._connectWith();if(l&&e)for(s=l.length-1;s>=0;s--)for(o=t(l[s],this.document[0]),n=o.length-1;n>=0;n--)a=t.data(o[n],this.widgetFullName),a&&a!==this&&!a.options.disabled&&h.push([t.isFunction(a.options.items)?a.options.items.call(a.element):t(a.options.items,a.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),a]);for(h.push([t.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):t(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]),s=h.length-1;s>=0;s--)h[s][0].each(i);return t(r)},_removeCurrentsFromItems:function(){var e=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=t.grep(this.items,function(t){for(var i=0;e.length>i;i++)if(e[i]===t.item[0])return!1;return!0})},_refreshItems:function(e){this.items=[],this.containers=[this];var i,s,n,o,a,r,h,l,c=this.items,u=[[t.isFunction(this.options.items)?this.options.items.call(this.element[0],e,{item:this.currentItem}):t(this.options.items,this.element),this]],d=this._connectWith();if(d&&this.ready)for(i=d.length-1;i>=0;i--)for(n=t(d[i],this.document[0]),s=n.length-1;s>=0;s--)o=t.data(n[s],this.widgetFullName),o&&o!==this&&!o.options.disabled&&(u.push([t.isFunction(o.options.items)?o.options.items.call(o.element[0],e,{item:this.currentItem}):t(o.options.items,o.element),o]),this.containers.push(o));for(i=u.length-1;i>=0;i--)for(a=u[i][1],r=u[i][0],s=0,l=r.length;l>s;s++)h=t(r[s]),h.data(this.widgetName+"-item",a),c.push({item:h,instance:a,width:0,height:0,left:0,top:0})},refreshPositions:function(e){this.floating=this.items.length?"x"===this.options.axis||this._isFloating(this.items[0].item):!1,this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());var i,s,n,o;for(i=this.items.length-1;i>=0;i--)s=this.items[i],s.instance!==this.currentContainer&&this.currentContainer&&s.item[0]!==this.currentItem[0]||(n=this.options.toleranceElement?t(this.options.toleranceElement,s.item):s.item,e||(s.width=n.outerWidth(),s.height=n.outerHeight()),o=n.offset(),s.left=o.left,s.top=o.top);if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(i=this.containers.length-1;i>=0;i--)o=this.containers[i].element.offset(),this.containers[i].containerCache.left=o.left,this.containers[i].containerCache.top=o.top,this.containers[i].containerCache.width=this.containers[i].element.outerWidth(),this.containers[i].containerCache.height=this.containers[i].element.outerHeight();return this},_createPlaceholder:function(e){e=e||this;var i,s=e.options;s.placeholder&&s.placeholder.constructor!==String||(i=s.placeholder,s.placeholder={element:function(){var s=e.currentItem[0].nodeName.toLowerCase(),n=t("<"+s+">",e.document[0]);return e._addClass(n,"ui-sortable-placeholder",i||e.currentItem[0].className)._removeClass(n,"ui-sortable-helper"),"tbody"===s?e._createTrPlaceholder(e.currentItem.find("tr").eq(0),t("",e.document[0]).appendTo(n)):"tr"===s?e._createTrPlaceholder(e.currentItem,n):"img"===s&&n.attr("src",e.currentItem.attr("src")),i||n.css("visibility","hidden"),n},update:function(t,n){(!i||s.forcePlaceholderSize)&&(n.height()||n.height(e.currentItem.innerHeight()-parseInt(e.currentItem.css("paddingTop")||0,10)-parseInt(e.currentItem.css("paddingBottom")||0,10)),n.width()||n.width(e.currentItem.innerWidth()-parseInt(e.currentItem.css("paddingLeft")||0,10)-parseInt(e.currentItem.css("paddingRight")||0,10)))}}),e.placeholder=t(s.placeholder.element.call(e.element,e.currentItem)),e.currentItem.after(e.placeholder),s.placeholder.update(e,e.placeholder)},_createTrPlaceholder:function(e,i){var s=this;e.children().each(function(){t(" ",s.document[0]).attr("colspan",t(this).attr("colspan")||1).appendTo(i)})},_contactContainers:function(e){var i,s,n,o,a,r,h,l,c,u,d=null,p=null;for(i=this.containers.length-1;i>=0;i--)if(!t.contains(this.currentItem[0],this.containers[i].element[0]))if(this._intersectsWith(this.containers[i].containerCache)){if(d&&t.contains(this.containers[i].element[0],d.element[0]))continue;d=this.containers[i],p=i}else this.containers[i].containerCache.over&&(this.containers[i]._trigger("out",e,this._uiHash(this)),this.containers[i].containerCache.over=0);if(d)if(1===this.containers.length)this.containers[p].containerCache.over||(this.containers[p]._trigger("over",e,this._uiHash(this)),this.containers[p].containerCache.over=1);else{for(n=1e4,o=null,c=d.floating||this._isFloating(this.currentItem),a=c?"left":"top",r=c?"width":"height",u=c?"pageX":"pageY",s=this.items.length-1;s>=0;s--)t.contains(this.containers[p].element[0],this.items[s].item[0])&&this.items[s].item[0]!==this.currentItem[0]&&(h=this.items[s].item.offset()[a],l=!1,e[u]-h>this.items[s][r]/2&&(l=!0),n>Math.abs(e[u]-h)&&(n=Math.abs(e[u]-h),o=this.items[s],this.direction=l?"up":"down"));if(!o&&!this.options.dropOnEmpty)return;if(this.currentContainer===this.containers[p])return this.currentContainer.containerCache.over||(this.containers[p]._trigger("over",e,this._uiHash()),this.currentContainer.containerCache.over=1),void 0;o?this._rearrange(e,o,null,!0):this._rearrange(e,null,this.containers[p].element,!0),this._trigger("change",e,this._uiHash()),this.containers[p]._trigger("change",e,this._uiHash(this)),this.currentContainer=this.containers[p],this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[p]._trigger("over",e,this._uiHash(this)),this.containers[p].containerCache.over=1}},_createHelper:function(e){var i=this.options,s=t.isFunction(i.helper)?t(i.helper.apply(this.element[0],[e,this.currentItem])):"clone"===i.helper?this.currentItem.clone():this.currentItem;return s.parents("body").length||t("parent"!==i.appendTo?i.appendTo:this.currentItem[0].parentNode)[0].appendChild(s[0]),s[0]===this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),(!s[0].style.width||i.forceHelperSize)&&s.width(this.currentItem.width()),(!s[0].style.height||i.forceHelperSize)&&s.height(this.currentItem.height()),s},_adjustOffsetFromHelper:function(e){"string"==typeof e&&(e=e.split(" ")),t.isArray(e)&&(e={left:+e[0],top:+e[1]||0}),"left"in e&&(this.offset.click.left=e.left+this.margins.left),"right"in e&&(this.offset.click.left=this.helperProportions.width-e.right+this.margins.left),"top"in e&&(this.offset.click.top=e.top+this.margins.top),"bottom"in e&&(this.offset.click.top=this.helperProportions.height-e.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var e=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==this.document[0]&&t.contains(this.scrollParent[0],this.offsetParent[0])&&(e.left+=this.scrollParent.scrollLeft(),e.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===this.document[0].body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&t.ui.ie)&&(e={top:0,left:0}),{top:e.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:e.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var t=this.currentItem.position();return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:t.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e,i,s,n=this.options;"parent"===n.containment&&(n.containment=this.helper[0].parentNode),("document"===n.containment||"window"===n.containment)&&(this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,"document"===n.containment?this.document.width():this.window.width()-this.helperProportions.width-this.margins.left,("document"===n.containment?this.document.height()||document.body.parentNode.scrollHeight:this.window.height()||this.document[0].body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(n.containment)||(e=t(n.containment)[0],i=t(n.containment).offset(),s="hidden"!==t(e).css("overflow"),this.containment=[i.left+(parseInt(t(e).css("borderLeftWidth"),10)||0)+(parseInt(t(e).css("paddingLeft"),10)||0)-this.margins.left,i.top+(parseInt(t(e).css("borderTopWidth"),10)||0)+(parseInt(t(e).css("paddingTop"),10)||0)-this.margins.top,i.left+(s?Math.max(e.scrollWidth,e.offsetWidth):e.offsetWidth)-(parseInt(t(e).css("borderLeftWidth"),10)||0)-(parseInt(t(e).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,i.top+(s?Math.max(e.scrollHeight,e.offsetHeight):e.offsetHeight)-(parseInt(t(e).css("borderTopWidth"),10)||0)-(parseInt(t(e).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top])},_convertPositionTo:function(e,i){i||(i=this.position);var s="absolute"===e?1:-1,n="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,o=/(html|body)/i.test(n[0].tagName);return{top:i.top+this.offset.relative.top*s+this.offset.parent.top*s-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():o?0:n.scrollTop())*s,left:i.left+this.offset.relative.left*s+this.offset.parent.left*s-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():o?0:n.scrollLeft())*s}},_generatePosition:function(e){var i,s,n=this.options,o=e.pageX,a=e.pageY,r="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,h=/(html|body)/i.test(r[0].tagName);return"relative"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&this.scrollParent[0]!==this.offsetParent[0]||(this.offset.relative=this._getRelativeOffset()),this.originalPosition&&(this.containment&&(e.pageX-this.offset.click.leftthis.containment[2]&&(o=this.containment[2]+this.offset.click.left),e.pageY-this.offset.click.top>this.containment[3]&&(a=this.containment[3]+this.offset.click.top)),n.grid&&(i=this.originalPageY+Math.round((a-this.originalPageY)/n.grid[1])*n.grid[1],a=this.containment?i-this.offset.click.top>=this.containment[1]&&i-this.offset.click.top<=this.containment[3]?i:i-this.offset.click.top>=this.containment[1]?i-n.grid[1]:i+n.grid[1]:i,s=this.originalPageX+Math.round((o-this.originalPageX)/n.grid[0])*n.grid[0],o=this.containment?s-this.offset.click.left>=this.containment[0]&&s-this.offset.click.left<=this.containment[2]?s:s-this.offset.click.left>=this.containment[0]?s-n.grid[0]:s+n.grid[0]:s)),{top:a-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():h?0:r.scrollTop()),left:o-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():h?0:r.scrollLeft())}},_rearrange:function(t,e,i,s){i?i[0].appendChild(this.placeholder[0]):e.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?e.item[0]:e.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var n=this.counter; -this._delay(function(){n===this.counter&&this.refreshPositions(!s)})},_clear:function(t,e){function i(t,e,i){return function(s){i._trigger(t,s,e._uiHash(e))}}this.reverting=!1;var s,n=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(s in this._storedCSS)("auto"===this._storedCSS[s]||"static"===this._storedCSS[s])&&(this._storedCSS[s]="");this.currentItem.css(this._storedCSS),this._removeClass(this.currentItem,"ui-sortable-helper")}else this.currentItem.show();for(this.fromOutside&&!e&&n.push(function(t){this._trigger("receive",t,this._uiHash(this.fromOutside))}),!this.fromOutside&&this.domPosition.prev===this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent()[0]||e||n.push(function(t){this._trigger("update",t,this._uiHash())}),this!==this.currentContainer&&(e||(n.push(function(t){this._trigger("remove",t,this._uiHash())}),n.push(function(t){return function(e){t._trigger("receive",e,this._uiHash(this))}}.call(this,this.currentContainer)),n.push(function(t){return function(e){t._trigger("update",e,this._uiHash(this))}}.call(this,this.currentContainer)))),s=this.containers.length-1;s>=0;s--)e||n.push(i("deactivate",this,this.containers[s])),this.containers[s].containerCache.over&&(n.push(i("out",this,this.containers[s])),this.containers[s].containerCache.over=0);if(this.storedCursor&&(this.document.find("body").css("cursor",this.storedCursor),this.storedStylesheet.remove()),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,e||this._trigger("beforeStop",t,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.cancelHelperRemoval||(this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null),!e){for(s=0;n.length>s;s++)n[s].call(this,t);this._trigger("stop",t,this._uiHash())}return this.fromOutside=!1,!this.cancelHelperRemoval},_trigger:function(){t.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(e){var i=e||this;return{helper:i.helper,placeholder:i.placeholder||t([]),position:i.position,originalPosition:i.originalPosition,offset:i.positionAbs,item:i.currentItem,sender:e?e.element:null}}}),t.widget("ui.spinner",{version:"1.12.1",defaultElement:"",widgetEventPrefix:"spin",options:{classes:{"ui-spinner":"ui-corner-all","ui-spinner-down":"ui-corner-br","ui-spinner-up":"ui-corner-tr"},culture:null,icons:{down:"ui-icon-triangle-1-s",up:"ui-icon-triangle-1-n"},incremental:!0,max:null,min:null,numberFormat:null,page:10,step:1,change:null,spin:null,start:null,stop:null},_create:function(){this._setOption("max",this.options.max),this._setOption("min",this.options.min),this._setOption("step",this.options.step),""!==this.value()&&this._value(this.element.val(),!0),this._draw(),this._on(this._events),this._refresh(),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_getCreateOptions:function(){var e=this._super(),i=this.element;return t.each(["min","max","step"],function(t,s){var n=i.attr(s);null!=n&&n.length&&(e[s]=n)}),e},_events:{keydown:function(t){this._start(t)&&this._keydown(t)&&t.preventDefault()},keyup:"_stop",focus:function(){this.previous=this.element.val()},blur:function(t){return this.cancelBlur?(delete this.cancelBlur,void 0):(this._stop(),this._refresh(),this.previous!==this.element.val()&&this._trigger("change",t),void 0)},mousewheel:function(t,e){if(e){if(!this.spinning&&!this._start(t))return!1;this._spin((e>0?1:-1)*this.options.step,t),clearTimeout(this.mousewheelTimer),this.mousewheelTimer=this._delay(function(){this.spinning&&this._stop(t)},100),t.preventDefault()}},"mousedown .ui-spinner-button":function(e){function i(){var e=this.element[0]===t.ui.safeActiveElement(this.document[0]);e||(this.element.trigger("focus"),this.previous=s,this._delay(function(){this.previous=s}))}var s;s=this.element[0]===t.ui.safeActiveElement(this.document[0])?this.previous:this.element.val(),e.preventDefault(),i.call(this),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur,i.call(this)}),this._start(e)!==!1&&this._repeat(null,t(e.currentTarget).hasClass("ui-spinner-up")?1:-1,e)},"mouseup .ui-spinner-button":"_stop","mouseenter .ui-spinner-button":function(e){return t(e.currentTarget).hasClass("ui-state-active")?this._start(e)===!1?!1:(this._repeat(null,t(e.currentTarget).hasClass("ui-spinner-up")?1:-1,e),void 0):void 0},"mouseleave .ui-spinner-button":"_stop"},_enhance:function(){this.uiSpinner=this.element.attr("autocomplete","off").wrap("").parent().append("")},_draw:function(){this._enhance(),this._addClass(this.uiSpinner,"ui-spinner","ui-widget ui-widget-content"),this._addClass("ui-spinner-input"),this.element.attr("role","spinbutton"),this.buttons=this.uiSpinner.children("a").attr("tabIndex",-1).attr("aria-hidden",!0).button({classes:{"ui-button":""}}),this._removeClass(this.buttons,"ui-corner-all"),this._addClass(this.buttons.first(),"ui-spinner-button ui-spinner-up"),this._addClass(this.buttons.last(),"ui-spinner-button ui-spinner-down"),this.buttons.first().button({icon:this.options.icons.up,showLabel:!1}),this.buttons.last().button({icon:this.options.icons.down,showLabel:!1}),this.buttons.height()>Math.ceil(.5*this.uiSpinner.height())&&this.uiSpinner.height()>0&&this.uiSpinner.height(this.uiSpinner.height())},_keydown:function(e){var i=this.options,s=t.ui.keyCode;switch(e.keyCode){case s.UP:return this._repeat(null,1,e),!0;case s.DOWN:return this._repeat(null,-1,e),!0;case s.PAGE_UP:return this._repeat(null,i.page,e),!0;case s.PAGE_DOWN:return this._repeat(null,-i.page,e),!0}return!1},_start:function(t){return this.spinning||this._trigger("start",t)!==!1?(this.counter||(this.counter=1),this.spinning=!0,!0):!1},_repeat:function(t,e,i){t=t||500,clearTimeout(this.timer),this.timer=this._delay(function(){this._repeat(40,e,i)},t),this._spin(e*this.options.step,i)},_spin:function(t,e){var i=this.value()||0;this.counter||(this.counter=1),i=this._adjustValue(i+t*this._increment(this.counter)),this.spinning&&this._trigger("spin",e,{value:i})===!1||(this._value(i),this.counter++)},_increment:function(e){var i=this.options.incremental;return i?t.isFunction(i)?i(e):Math.floor(e*e*e/5e4-e*e/500+17*e/200+1):1},_precision:function(){var t=this._precisionOf(this.options.step);return null!==this.options.min&&(t=Math.max(t,this._precisionOf(this.options.min))),t},_precisionOf:function(t){var e=""+t,i=e.indexOf(".");return-1===i?0:e.length-i-1},_adjustValue:function(t){var e,i,s=this.options;return e=null!==s.min?s.min:0,i=t-e,i=Math.round(i/s.step)*s.step,t=e+i,t=parseFloat(t.toFixed(this._precision())),null!==s.max&&t>s.max?s.max:null!==s.min&&s.min>t?s.min:t},_stop:function(t){this.spinning&&(clearTimeout(this.timer),clearTimeout(this.mousewheelTimer),this.counter=0,this.spinning=!1,this._trigger("stop",t))},_setOption:function(t,e){var i,s,n;return"culture"===t||"numberFormat"===t?(i=this._parse(this.element.val()),this.options[t]=e,this.element.val(this._format(i)),void 0):(("max"===t||"min"===t||"step"===t)&&"string"==typeof e&&(e=this._parse(e)),"icons"===t&&(s=this.buttons.first().find(".ui-icon"),this._removeClass(s,null,this.options.icons.up),this._addClass(s,null,e.up),n=this.buttons.last().find(".ui-icon"),this._removeClass(n,null,this.options.icons.down),this._addClass(n,null,e.down)),this._super(t,e),void 0)},_setOptionDisabled:function(t){this._super(t),this._toggleClass(this.uiSpinner,null,"ui-state-disabled",!!t),this.element.prop("disabled",!!t),this.buttons.button(t?"disable":"enable")},_setOptions:r(function(t){this._super(t)}),_parse:function(t){return"string"==typeof t&&""!==t&&(t=window.Globalize&&this.options.numberFormat?Globalize.parseFloat(t,10,this.options.culture):+t),""===t||isNaN(t)?null:t},_format:function(t){return""===t?"":window.Globalize&&this.options.numberFormat?Globalize.format(t,this.options.numberFormat,this.options.culture):t},_refresh:function(){this.element.attr({"aria-valuemin":this.options.min,"aria-valuemax":this.options.max,"aria-valuenow":this._parse(this.element.val())})},isValid:function(){var t=this.value();return null===t?!1:t===this._adjustValue(t)},_value:function(t,e){var i;""!==t&&(i=this._parse(t),null!==i&&(e||(i=this._adjustValue(i)),t=this._format(i))),this.element.val(t),this._refresh()},_destroy:function(){this.element.prop("disabled",!1).removeAttr("autocomplete role aria-valuemin aria-valuemax aria-valuenow"),this.uiSpinner.replaceWith(this.element)},stepUp:r(function(t){this._stepUp(t)}),_stepUp:function(t){this._start()&&(this._spin((t||1)*this.options.step),this._stop())},stepDown:r(function(t){this._stepDown(t)}),_stepDown:function(t){this._start()&&(this._spin((t||1)*-this.options.step),this._stop())},pageUp:r(function(t){this._stepUp((t||1)*this.options.page)}),pageDown:r(function(t){this._stepDown((t||1)*this.options.page)}),value:function(t){return arguments.length?(r(this._value).call(this,t),void 0):this._parse(this.element.val())},widget:function(){return this.uiSpinner}}),t.uiBackCompat!==!1&&t.widget("ui.spinner",t.ui.spinner,{_enhance:function(){this.uiSpinner=this.element.attr("autocomplete","off").wrap(this._uiSpinnerHtml()).parent().append(this._buttonHtml())},_uiSpinnerHtml:function(){return""},_buttonHtml:function(){return""}}),t.ui.spinner,t.widget("ui.tabs",{version:"1.12.1",delay:300,options:{active:null,classes:{"ui-tabs":"ui-corner-all","ui-tabs-nav":"ui-corner-all","ui-tabs-panel":"ui-corner-bottom","ui-tabs-tab":"ui-corner-top"},collapsible:!1,event:"click",heightStyle:"content",hide:null,show:null,activate:null,beforeActivate:null,beforeLoad:null,load:null},_isLocal:function(){var t=/#.*$/;return function(e){var i,s;i=e.href.replace(t,""),s=location.href.replace(t,"");try{i=decodeURIComponent(i)}catch(n){}try{s=decodeURIComponent(s)}catch(n){}return e.hash.length>1&&i===s}}(),_create:function(){var e=this,i=this.options;this.running=!1,this._addClass("ui-tabs","ui-widget ui-widget-content"),this._toggleClass("ui-tabs-collapsible",null,i.collapsible),this._processTabs(),i.active=this._initialActive(),t.isArray(i.disabled)&&(i.disabled=t.unique(i.disabled.concat(t.map(this.tabs.filter(".ui-state-disabled"),function(t){return e.tabs.index(t)}))).sort()),this.active=this.options.active!==!1&&this.anchors.length?this._findActive(i.active):t(),this._refresh(),this.active.length&&this.load(i.active)},_initialActive:function(){var e=this.options.active,i=this.options.collapsible,s=location.hash.substring(1);return null===e&&(s&&this.tabs.each(function(i,n){return t(n).attr("aria-controls")===s?(e=i,!1):void 0}),null===e&&(e=this.tabs.index(this.tabs.filter(".ui-tabs-active"))),(null===e||-1===e)&&(e=this.tabs.length?0:!1)),e!==!1&&(e=this.tabs.index(this.tabs.eq(e)),-1===e&&(e=i?!1:0)),!i&&e===!1&&this.anchors.length&&(e=0),e},_getCreateEventData:function(){return{tab:this.active,panel:this.active.length?this._getPanelForTab(this.active):t()}},_tabKeydown:function(e){var i=t(t.ui.safeActiveElement(this.document[0])).closest("li"),s=this.tabs.index(i),n=!0;if(!this._handlePageNav(e)){switch(e.keyCode){case t.ui.keyCode.RIGHT:case t.ui.keyCode.DOWN:s++;break;case t.ui.keyCode.UP:case t.ui.keyCode.LEFT:n=!1,s--;break;case t.ui.keyCode.END:s=this.anchors.length-1;break;case t.ui.keyCode.HOME:s=0;break;case t.ui.keyCode.SPACE:return e.preventDefault(),clearTimeout(this.activating),this._activate(s),void 0;case t.ui.keyCode.ENTER:return e.preventDefault(),clearTimeout(this.activating),this._activate(s===this.options.active?!1:s),void 0;default:return}e.preventDefault(),clearTimeout(this.activating),s=this._focusNextTab(s,n),e.ctrlKey||e.metaKey||(i.attr("aria-selected","false"),this.tabs.eq(s).attr("aria-selected","true"),this.activating=this._delay(function(){this.option("active",s)},this.delay))}},_panelKeydown:function(e){this._handlePageNav(e)||e.ctrlKey&&e.keyCode===t.ui.keyCode.UP&&(e.preventDefault(),this.active.trigger("focus"))},_handlePageNav:function(e){return e.altKey&&e.keyCode===t.ui.keyCode.PAGE_UP?(this._activate(this._focusNextTab(this.options.active-1,!1)),!0):e.altKey&&e.keyCode===t.ui.keyCode.PAGE_DOWN?(this._activate(this._focusNextTab(this.options.active+1,!0)),!0):void 0},_findNextTab:function(e,i){function s(){return e>n&&(e=0),0>e&&(e=n),e}for(var n=this.tabs.length-1;-1!==t.inArray(s(),this.options.disabled);)e=i?e+1:e-1;return e},_focusNextTab:function(t,e){return t=this._findNextTab(t,e),this.tabs.eq(t).trigger("focus"),t},_setOption:function(t,e){return"active"===t?(this._activate(e),void 0):(this._super(t,e),"collapsible"===t&&(this._toggleClass("ui-tabs-collapsible",null,e),e||this.options.active!==!1||this._activate(0)),"event"===t&&this._setupEvents(e),"heightStyle"===t&&this._setupHeightStyle(e),void 0)},_sanitizeSelector:function(t){return t?t.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g,"\\$&"):""},refresh:function(){var e=this.options,i=this.tablist.children(":has(a[href])");e.disabled=t.map(i.filter(".ui-state-disabled"),function(t){return i.index(t)}),this._processTabs(),e.active!==!1&&this.anchors.length?this.active.length&&!t.contains(this.tablist[0],this.active[0])?this.tabs.length===e.disabled.length?(e.active=!1,this.active=t()):this._activate(this._findNextTab(Math.max(0,e.active-1),!1)):e.active=this.tabs.index(this.active):(e.active=!1,this.active=t()),this._refresh()},_refresh:function(){this._setOptionDisabled(this.options.disabled),this._setupEvents(this.options.event),this._setupHeightStyle(this.options.heightStyle),this.tabs.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}),this.panels.not(this._getPanelForTab(this.active)).hide().attr({"aria-hidden":"true"}),this.active.length?(this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}),this._addClass(this.active,"ui-tabs-active","ui-state-active"),this._getPanelForTab(this.active).show().attr({"aria-hidden":"false"})):this.tabs.eq(0).attr("tabIndex",0)},_processTabs:function(){var e=this,i=this.tabs,s=this.anchors,n=this.panels;this.tablist=this._getList().attr("role","tablist"),this._addClass(this.tablist,"ui-tabs-nav","ui-helper-reset ui-helper-clearfix ui-widget-header"),this.tablist.on("mousedown"+this.eventNamespace,"> li",function(e){t(this).is(".ui-state-disabled")&&e.preventDefault()}).on("focus"+this.eventNamespace,".ui-tabs-anchor",function(){t(this).closest("li").is(".ui-state-disabled")&&this.blur()}),this.tabs=this.tablist.find("> li:has(a[href])").attr({role:"tab",tabIndex:-1}),this._addClass(this.tabs,"ui-tabs-tab","ui-state-default"),this.anchors=this.tabs.map(function(){return t("a",this)[0]}).attr({role:"presentation",tabIndex:-1}),this._addClass(this.anchors,"ui-tabs-anchor"),this.panels=t(),this.anchors.each(function(i,s){var n,o,a,r=t(s).uniqueId().attr("id"),h=t(s).closest("li"),l=h.attr("aria-controls");e._isLocal(s)?(n=s.hash,a=n.substring(1),o=e.element.find(e._sanitizeSelector(n))):(a=h.attr("aria-controls")||t({}).uniqueId()[0].id,n="#"+a,o=e.element.find(n),o.length||(o=e._createPanel(a),o.insertAfter(e.panels[i-1]||e.tablist)),o.attr("aria-live","polite")),o.length&&(e.panels=e.panels.add(o)),l&&h.data("ui-tabs-aria-controls",l),h.attr({"aria-controls":a,"aria-labelledby":r}),o.attr("aria-labelledby",r)}),this.panels.attr("role","tabpanel"),this._addClass(this.panels,"ui-tabs-panel","ui-widget-content"),i&&(this._off(i.not(this.tabs)),this._off(s.not(this.anchors)),this._off(n.not(this.panels)))},_getList:function(){return this.tablist||this.element.find("ol, ul").eq(0)},_createPanel:function(e){return t("
").attr("id",e).data("ui-tabs-destroy",!0)},_setOptionDisabled:function(e){var i,s,n;for(t.isArray(e)&&(e.length?e.length===this.anchors.length&&(e=!0):e=!1),n=0;s=this.tabs[n];n++)i=t(s),e===!0||-1!==t.inArray(n,e)?(i.attr("aria-disabled","true"),this._addClass(i,null,"ui-state-disabled")):(i.removeAttr("aria-disabled"),this._removeClass(i,null,"ui-state-disabled"));this.options.disabled=e,this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,e===!0)},_setupEvents:function(e){var i={};e&&t.each(e.split(" "),function(t,e){i[e]="_eventHandler"}),this._off(this.anchors.add(this.tabs).add(this.panels)),this._on(!0,this.anchors,{click:function(t){t.preventDefault()}}),this._on(this.anchors,i),this._on(this.tabs,{keydown:"_tabKeydown"}),this._on(this.panels,{keydown:"_panelKeydown"}),this._focusable(this.tabs),this._hoverable(this.tabs)},_setupHeightStyle:function(e){var i,s=this.element.parent();"fill"===e?(i=s.height(),i-=this.element.outerHeight()-this.element.height(),this.element.siblings(":visible").each(function(){var e=t(this),s=e.css("position");"absolute"!==s&&"fixed"!==s&&(i-=e.outerHeight(!0))}),this.element.children().not(this.panels).each(function(){i-=t(this).outerHeight(!0)}),this.panels.each(function(){t(this).height(Math.max(0,i-t(this).innerHeight()+t(this).height()))}).css("overflow","auto")):"auto"===e&&(i=0,this.panels.each(function(){i=Math.max(i,t(this).height("").height())}).height(i))},_eventHandler:function(e){var i=this.options,s=this.active,n=t(e.currentTarget),o=n.closest("li"),a=o[0]===s[0],r=a&&i.collapsible,h=r?t():this._getPanelForTab(o),l=s.length?this._getPanelForTab(s):t(),c={oldTab:s,oldPanel:l,newTab:r?t():o,newPanel:h};e.preventDefault(),o.hasClass("ui-state-disabled")||o.hasClass("ui-tabs-loading")||this.running||a&&!i.collapsible||this._trigger("beforeActivate",e,c)===!1||(i.active=r?!1:this.tabs.index(o),this.active=a?t():o,this.xhr&&this.xhr.abort(),l.length||h.length||t.error("jQuery UI Tabs: Mismatching fragment identifier."),h.length&&this.load(this.tabs.index(o),e),this._toggle(e,c))},_toggle:function(e,i){function s(){o.running=!1,o._trigger("activate",e,i)}function n(){o._addClass(i.newTab.closest("li"),"ui-tabs-active","ui-state-active"),a.length&&o.options.show?o._show(a,o.options.show,s):(a.show(),s())}var o=this,a=i.newPanel,r=i.oldPanel;this.running=!0,r.length&&this.options.hide?this._hide(r,this.options.hide,function(){o._removeClass(i.oldTab.closest("li"),"ui-tabs-active","ui-state-active"),n()}):(this._removeClass(i.oldTab.closest("li"),"ui-tabs-active","ui-state-active"),r.hide(),n()),r.attr("aria-hidden","true"),i.oldTab.attr({"aria-selected":"false","aria-expanded":"false"}),a.length&&r.length?i.oldTab.attr("tabIndex",-1):a.length&&this.tabs.filter(function(){return 0===t(this).attr("tabIndex")}).attr("tabIndex",-1),a.attr("aria-hidden","false"),i.newTab.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_activate:function(e){var i,s=this._findActive(e);s[0]!==this.active[0]&&(s.length||(s=this.active),i=s.find(".ui-tabs-anchor")[0],this._eventHandler({target:i,currentTarget:i,preventDefault:t.noop}))},_findActive:function(e){return e===!1?t():this.tabs.eq(e)},_getIndex:function(e){return"string"==typeof e&&(e=this.anchors.index(this.anchors.filter("[href$='"+t.ui.escapeSelector(e)+"']"))),e},_destroy:function(){this.xhr&&this.xhr.abort(),this.tablist.removeAttr("role").off(this.eventNamespace),this.anchors.removeAttr("role tabIndex").removeUniqueId(),this.tabs.add(this.panels).each(function(){t.data(this,"ui-tabs-destroy")?t(this).remove():t(this).removeAttr("role tabIndex aria-live aria-busy aria-selected aria-labelledby aria-hidden aria-expanded")}),this.tabs.each(function(){var e=t(this),i=e.data("ui-tabs-aria-controls");i?e.attr("aria-controls",i).removeData("ui-tabs-aria-controls"):e.removeAttr("aria-controls")}),this.panels.show(),"content"!==this.options.heightStyle&&this.panels.css("height","")},enable:function(e){var i=this.options.disabled;i!==!1&&(void 0===e?i=!1:(e=this._getIndex(e),i=t.isArray(i)?t.map(i,function(t){return t!==e?t:null}):t.map(this.tabs,function(t,i){return i!==e?i:null})),this._setOptionDisabled(i))},disable:function(e){var i=this.options.disabled;if(i!==!0){if(void 0===e)i=!0;else{if(e=this._getIndex(e),-1!==t.inArray(e,i))return;i=t.isArray(i)?t.merge([e],i).sort():[e]}this._setOptionDisabled(i)}},load:function(e,i){e=this._getIndex(e);var s=this,n=this.tabs.eq(e),o=n.find(".ui-tabs-anchor"),a=this._getPanelForTab(n),r={tab:n,panel:a},h=function(t,e){"abort"===e&&s.panels.stop(!1,!0),s._removeClass(n,"ui-tabs-loading"),a.removeAttr("aria-busy"),t===s.xhr&&delete s.xhr};this._isLocal(o[0])||(this.xhr=t.ajax(this._ajaxSettings(o,i,r)),this.xhr&&"canceled"!==this.xhr.statusText&&(this._addClass(n,"ui-tabs-loading"),a.attr("aria-busy","true"),this.xhr.done(function(t,e,n){setTimeout(function(){a.html(t),s._trigger("load",i,r),h(n,e)},1)}).fail(function(t,e){setTimeout(function(){h(t,e)},1)})))},_ajaxSettings:function(e,i,s){var n=this;return{url:e.attr("href").replace(/#.*$/,""),beforeSend:function(e,o){return n._trigger("beforeLoad",i,t.extend({jqXHR:e,ajaxSettings:o},s))}}},_getPanelForTab:function(e){var i=t(e).attr("aria-controls");return this.element.find(this._sanitizeSelector("#"+i))}}),t.uiBackCompat!==!1&&t.widget("ui.tabs",t.ui.tabs,{_processTabs:function(){this._superApply(arguments),this._addClass(this.tabs,"ui-tab")}}),t.ui.tabs,t.widget("ui.tooltip",{version:"1.12.1",options:{classes:{"ui-tooltip":"ui-corner-all ui-widget-shadow"},content:function(){var e=t(this).attr("title")||"";return t("").text(e).html()},hide:!0,items:"[title]:not([disabled])",position:{my:"left top+15",at:"left bottom",collision:"flipfit flip"},show:!0,track:!1,close:null,open:null},_addDescribedBy:function(e,i){var s=(e.attr("aria-describedby")||"").split(/\s+/);s.push(i),e.data("ui-tooltip-id",i).attr("aria-describedby",t.trim(s.join(" ")))},_removeDescribedBy:function(e){var i=e.data("ui-tooltip-id"),s=(e.attr("aria-describedby")||"").split(/\s+/),n=t.inArray(i,s);-1!==n&&s.splice(n,1),e.removeData("ui-tooltip-id"),s=t.trim(s.join(" ")),s?e.attr("aria-describedby",s):e.removeAttr("aria-describedby")},_create:function(){this._on({mouseover:"open",focusin:"open"}),this.tooltips={},this.parents={},this.liveRegion=t("
").attr({role:"log","aria-live":"assertive","aria-relevant":"additions"}).appendTo(this.document[0].body),this._addClass(this.liveRegion,null,"ui-helper-hidden-accessible"),this.disabledTitles=t([])},_setOption:function(e,i){var s=this;this._super(e,i),"content"===e&&t.each(this.tooltips,function(t,e){s._updateContent(e.element)})},_setOptionDisabled:function(t){this[t?"_disable":"_enable"]()},_disable:function(){var e=this;t.each(this.tooltips,function(i,s){var n=t.Event("blur");n.target=n.currentTarget=s.element[0],e.close(n,!0)}),this.disabledTitles=this.disabledTitles.add(this.element.find(this.options.items).addBack().filter(function(){var e=t(this);return e.is("[title]")?e.data("ui-tooltip-title",e.attr("title")).removeAttr("title"):void 0}))},_enable:function(){this.disabledTitles.each(function(){var e=t(this);e.data("ui-tooltip-title")&&e.attr("title",e.data("ui-tooltip-title"))}),this.disabledTitles=t([])},open:function(e){var i=this,s=t(e?e.target:this.element).closest(this.options.items);s.length&&!s.data("ui-tooltip-id")&&(s.attr("title")&&s.data("ui-tooltip-title",s.attr("title")),s.data("ui-tooltip-open",!0),e&&"mouseover"===e.type&&s.parents().each(function(){var e,s=t(this);s.data("ui-tooltip-open")&&(e=t.Event("blur"),e.target=e.currentTarget=this,i.close(e,!0)),s.attr("title")&&(s.uniqueId(),i.parents[this.id]={element:this,title:s.attr("title")},s.attr("title",""))}),this._registerCloseHandlers(e,s),this._updateContent(s,e))},_updateContent:function(t,e){var i,s=this.options.content,n=this,o=e?e.type:null;return"string"==typeof s||s.nodeType||s.jquery?this._open(e,t,s):(i=s.call(t[0],function(i){n._delay(function(){t.data("ui-tooltip-open")&&(e&&(e.type=o),this._open(e,t,i))})}),i&&this._open(e,t,i),void 0)},_open:function(e,i,s){function n(t){l.of=t,a.is(":hidden")||a.position(l)}var o,a,r,h,l=t.extend({},this.options.position);if(s){if(o=this._find(i))return o.tooltip.find(".ui-tooltip-content").html(s),void 0;i.is("[title]")&&(e&&"mouseover"===e.type?i.attr("title",""):i.removeAttr("title")),o=this._tooltip(i),a=o.tooltip,this._addDescribedBy(i,a.attr("id")),a.find(".ui-tooltip-content").html(s),this.liveRegion.children().hide(),h=t("
").html(a.find(".ui-tooltip-content").html()),h.removeAttr("name").find("[name]").removeAttr("name"),h.removeAttr("id").find("[id]").removeAttr("id"),h.appendTo(this.liveRegion),this.options.track&&e&&/^mouse/.test(e.type)?(this._on(this.document,{mousemove:n}),n(e)):a.position(t.extend({of:i},this.options.position)),a.hide(),this._show(a,this.options.show),this.options.track&&this.options.show&&this.options.show.delay&&(r=this.delayedShow=setInterval(function(){a.is(":visible")&&(n(l.of),clearInterval(r))},t.fx.interval)),this._trigger("open",e,{tooltip:a})}},_registerCloseHandlers:function(e,i){var s={keyup:function(e){if(e.keyCode===t.ui.keyCode.ESCAPE){var s=t.Event(e);s.currentTarget=i[0],this.close(s,!0)}}};i[0]!==this.element[0]&&(s.remove=function(){this._removeTooltip(this._find(i).tooltip)}),e&&"mouseover"!==e.type||(s.mouseleave="close"),e&&"focusin"!==e.type||(s.focusout="close"),this._on(!0,i,s)},close:function(e){var i,s=this,n=t(e?e.currentTarget:this.element),o=this._find(n);return o?(i=o.tooltip,o.closing||(clearInterval(this.delayedShow),n.data("ui-tooltip-title")&&!n.attr("title")&&n.attr("title",n.data("ui-tooltip-title")),this._removeDescribedBy(n),o.hiding=!0,i.stop(!0),this._hide(i,this.options.hide,function(){s._removeTooltip(t(this))}),n.removeData("ui-tooltip-open"),this._off(n,"mouseleave focusout keyup"),n[0]!==this.element[0]&&this._off(n,"remove"),this._off(this.document,"mousemove"),e&&"mouseleave"===e.type&&t.each(this.parents,function(e,i){t(i.element).attr("title",i.title),delete s.parents[e]}),o.closing=!0,this._trigger("close",e,{tooltip:i}),o.hiding||(o.closing=!1)),void 0):(n.removeData("ui-tooltip-open"),void 0)},_tooltip:function(e){var i=t("
").attr("role","tooltip"),s=t("
").appendTo(i),n=i.uniqueId().attr("id");return this._addClass(s,"ui-tooltip-content"),this._addClass(i,"ui-tooltip","ui-widget ui-widget-content"),i.appendTo(this._appendTo(e)),this.tooltips[n]={element:e,tooltip:i}},_find:function(t){var e=t.data("ui-tooltip-id");return e?this.tooltips[e]:null},_removeTooltip:function(t){t.remove(),delete this.tooltips[t.attr("id")]},_appendTo:function(t){var e=t.closest(".ui-front, dialog");return e.length||(e=this.document[0].body),e},_destroy:function(){var e=this;t.each(this.tooltips,function(i,s){var n=t.Event("blur"),o=s.element;n.target=n.currentTarget=o[0],e.close(n,!0),t("#"+i).remove(),o.data("ui-tooltip-title")&&(o.attr("title")||o.attr("title",o.data("ui-tooltip-title")),o.removeData("ui-tooltip-title"))}),this.liveRegion.remove()}}),t.uiBackCompat!==!1&&t.widget("ui.tooltip",t.ui.tooltip,{options:{tooltipClass:null},_tooltip:function(){var t=this._superApply(arguments);return this.options.tooltipClass&&t.tooltip.addClass(this.options.tooltipClass),t}}),t.ui.tooltip}); \ No newline at end of file +!function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)}(function(V){"use strict";V.ui=V.ui||{};V.ui.version="1.13.2";var n,i=0,a=Array.prototype.hasOwnProperty,r=Array.prototype.slice;V.cleanData=(n=V.cleanData,function(t){for(var e,i,s=0;null!=(i=t[s]);s++)(e=V._data(i,"events"))&&e.remove&&V(i).triggerHandler("remove");n(t)}),V.widget=function(t,i,e){var s,n,o,a={},r=t.split(".")[0],l=r+"-"+(t=t.split(".")[1]);return e||(e=i,i=V.Widget),Array.isArray(e)&&(e=V.extend.apply(null,[{}].concat(e))),V.expr.pseudos[l.toLowerCase()]=function(t){return!!V.data(t,l)},V[r]=V[r]||{},s=V[r][t],n=V[r][t]=function(t,e){if(!this||!this._createWidget)return new n(t,e);arguments.length&&this._createWidget(t,e)},V.extend(n,s,{version:e.version,_proto:V.extend({},e),_childConstructors:[]}),(o=new i).options=V.widget.extend({},o.options),V.each(e,function(e,s){function n(){return i.prototype[e].apply(this,arguments)}function o(t){return i.prototype[e].apply(this,t)}a[e]="function"==typeof s?function(){var t,e=this._super,i=this._superApply;return this._super=n,this._superApply=o,t=s.apply(this,arguments),this._super=e,this._superApply=i,t}:s}),n.prototype=V.widget.extend(o,{widgetEventPrefix:s&&o.widgetEventPrefix||t},a,{constructor:n,namespace:r,widgetName:t,widgetFullName:l}),s?(V.each(s._childConstructors,function(t,e){var i=e.prototype;V.widget(i.namespace+"."+i.widgetName,n,e._proto)}),delete s._childConstructors):i._childConstructors.push(n),V.widget.bridge(t,n),n},V.widget.extend=function(t){for(var e,i,s=r.call(arguments,1),n=0,o=s.length;n",options:{classes:{},disabled:!1,create:null},_createWidget:function(t,e){e=V(e||this.defaultElement||this)[0],this.element=V(e),this.uuid=i++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=V(),this.hoverable=V(),this.focusable=V(),this.classesElementLookup={},e!==this&&(V.data(e,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===e&&this.destroy()}}),this.document=V(e.style?e.ownerDocument:e.document||e),this.window=V(this.document[0].defaultView||this.document[0].parentWindow)),this.options=V.widget.extend({},this.options,this._getCreateOptions(),t),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:V.noop,_create:V.noop,_init:V.noop,destroy:function(){var i=this;this._destroy(),V.each(this.classesElementLookup,function(t,e){i._removeClass(e,t)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:V.noop,widget:function(){return this.element},option:function(t,e){var i,s,n,o=t;if(0===arguments.length)return V.widget.extend({},this.options);if("string"==typeof t)if(o={},t=(i=t.split(".")).shift(),i.length){for(s=o[t]=V.widget.extend({},this.options[t]),n=0;n
"),i=e.children()[0];return V("body").append(e),t=i.offsetWidth,e.css("overflow","scroll"),t===(i=i.offsetWidth)&&(i=e[0].clientWidth),e.remove(),s=t-i},getScrollInfo:function(t){var e=t.isWindow||t.isDocument?"":t.element.css("overflow-x"),i=t.isWindow||t.isDocument?"":t.element.css("overflow-y"),e="scroll"===e||"auto"===e&&t.widthx(k(s),k(n))?o.important="horizontal":o.important="vertical",u.using.call(this,t,o)}),a.offset(V.extend(h,{using:t}))})},V.ui.position={fit:{left:function(t,e){var i=e.within,s=i.isWindow?i.scrollLeft:i.offset.left,n=i.width,o=t.left-e.collisionPosition.marginLeft,a=s-o,r=o+e.collisionWidth-n-s;e.collisionWidth>n?0n?0")[0],w=d.each;function P(t){return null==t?t+"":"object"==typeof t?p[e.call(t)]||"object":typeof t}function M(t,e,i){var s=v[e.type]||{};return null==t?i||!e.def?null:e.def:(t=s.floor?~~t:parseFloat(t),isNaN(t)?e.def:s.mod?(t+s.mod)%s.mod:Math.min(s.max,Math.max(0,t)))}function S(s){var n=m(),o=n._rgba=[];return s=s.toLowerCase(),w(g,function(t,e){var i=e.re.exec(s),i=i&&e.parse(i),e=e.space||"rgba";if(i)return i=n[e](i),n[_[e].cache]=i[_[e].cache],o=n._rgba=i._rgba,!1}),o.length?("0,0,0,0"===o.join()&&d.extend(o,B.transparent),n):B[s]}function H(t,e,i){return 6*(i=(i+1)%1)<1?t+(e-t)*i*6:2*i<1?e:3*i<2?t+(e-t)*(2/3-i)*6:t}y.style.cssText="background-color:rgba(1,1,1,.5)",b.rgba=-1o.mod/2?s+=o.mod:s-n>o.mod/2&&(s-=o.mod)),l[i]=M((n-s)*a+s,e)))}),this[e](l)},blend:function(t){if(1===this._rgba[3])return this;var e=this._rgba.slice(),i=e.pop(),s=m(t)._rgba;return m(d.map(e,function(t,e){return(1-i)*s[e]+i*t}))},toRgbaString:function(){var t="rgba(",e=d.map(this._rgba,function(t,e){return null!=t?t:2
").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),e={width:i.width(),height:i.height()},n=document.activeElement;try{n.id}catch(t){n=document.body}return i.wrap(t),i[0]!==n&&!V.contains(i[0],n)||V(n).trigger("focus"),t=i.parent(),"static"===i.css("position")?(t.css({position:"relative"}),i.css({position:"relative"})):(V.extend(s,{position:i.css("position"),zIndex:i.css("z-index")}),V.each(["top","left","bottom","right"],function(t,e){s[e]=i.css(e),isNaN(parseInt(s[e],10))&&(s[e]="auto")}),i.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),i.css(e),t.css(s).show()},removeWrapper:function(t){var e=document.activeElement;return t.parent().is(".ui-effects-wrapper")&&(t.parent().replaceWith(t),t[0]!==e&&!V.contains(t[0],e)||V(e).trigger("focus")),t}}),V.extend(V.effects,{version:"1.13.2",define:function(t,e,i){return i||(i=e,e="effect"),V.effects.effect[t]=i,V.effects.effect[t].mode=e,i},scaledDimensions:function(t,e,i){if(0===e)return{height:0,width:0,outerHeight:0,outerWidth:0};var s="horizontal"!==i?(e||100)/100:1,e="vertical"!==i?(e||100)/100:1;return{height:t.height()*e,width:t.width()*s,outerHeight:t.outerHeight()*e,outerWidth:t.outerWidth()*s}},clipToBox:function(t){return{width:t.clip.right-t.clip.left,height:t.clip.bottom-t.clip.top,left:t.clip.left,top:t.clip.top}},unshift:function(t,e,i){var s=t.queue();1").insertAfter(t).css({display:/^(inline|ruby)/.test(t.css("display"))?"inline-block":"block",visibility:"hidden",marginTop:t.css("marginTop"),marginBottom:t.css("marginBottom"),marginLeft:t.css("marginLeft"),marginRight:t.css("marginRight"),float:t.css("float")}).outerWidth(t.outerWidth()).outerHeight(t.outerHeight()).addClass("ui-effects-placeholder"),t.data(j+"placeholder",e)),t.css({position:i,left:s.left,top:s.top}),e},removePlaceholder:function(t){var e=j+"placeholder",i=t.data(e);i&&(i.remove(),t.removeData(e))},cleanUp:function(t){V.effects.restoreStyle(t),V.effects.removePlaceholder(t)},setTransition:function(s,t,n,o){return o=o||{},V.each(t,function(t,e){var i=s.cssUnit(e);0
");l.appendTo("body").addClass(t.className).css({top:s.top-a,left:s.left-r,height:i.innerHeight(),width:i.innerWidth(),position:n?"fixed":"absolute"}).animate(o,t.duration,t.easing,function(){l.remove(),"function"==typeof e&&e()})}}),V.fx.step.clip=function(t){t.clipInit||(t.start=V(t.elem).cssClip(),"string"==typeof t.end&&(t.end=G(t.end,t.elem)),t.clipInit=!0),V(t.elem).cssClip({top:t.pos*(t.end.top-t.start.top)+t.start.top,right:t.pos*(t.end.right-t.start.right)+t.start.right,bottom:t.pos*(t.end.bottom-t.start.bottom)+t.start.bottom,left:t.pos*(t.end.left-t.start.left)+t.start.left})},Y={},V.each(["Quad","Cubic","Quart","Quint","Expo"],function(e,t){Y[t]=function(t){return Math.pow(t,e+2)}}),V.extend(Y,{Sine:function(t){return 1-Math.cos(t*Math.PI/2)},Circ:function(t){return 1-Math.sqrt(1-t*t)},Elastic:function(t){return 0===t||1===t?t:-Math.pow(2,8*(t-1))*Math.sin((80*(t-1)-7.5)*Math.PI/15)},Back:function(t){return t*t*(3*t-2)},Bounce:function(t){for(var e,i=4;t<((e=Math.pow(2,--i))-1)/11;);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*e-2)/22-t,2)}}),V.each(Y,function(t,e){V.easing["easeIn"+t]=e,V.easing["easeOut"+t]=function(t){return 1-e(1-t)},V.easing["easeInOut"+t]=function(t){return t<.5?e(2*t)/2:1-e(-2*t+2)/2}});y=V.effects,V.effects.define("blind","hide",function(t,e){var i={up:["bottom","top"],vertical:["bottom","top"],down:["top","bottom"],left:["right","left"],horizontal:["right","left"],right:["left","right"]},s=V(this),n=t.direction||"up",o=s.cssClip(),a={clip:V.extend({},o)},r=V.effects.createPlaceholder(s);a.clip[i[n][0]]=a.clip[i[n][1]],"show"===t.mode&&(s.cssClip(a.clip),r&&r.css(V.effects.clipToBox(a)),a.clip=o),r&&r.animate(V.effects.clipToBox(a),t.duration,t.easing),s.animate(a,{queue:!1,duration:t.duration,easing:t.easing,complete:e})}),V.effects.define("bounce",function(t,e){var i,s,n=V(this),o=t.mode,a="hide"===o,r="show"===o,l=t.direction||"up",h=t.distance,c=t.times||5,o=2*c+(r||a?1:0),u=t.duration/o,d=t.easing,p="up"===l||"down"===l?"top":"left",f="up"===l||"left"===l,g=0,t=n.queue().length;for(V.effects.createPlaceholder(n),l=n.css(p),h=h||n["top"==p?"outerHeight":"outerWidth"]()/3,r&&((s={opacity:1})[p]=l,n.css("opacity",0).css(p,f?2*-h:2*h).animate(s,u,d)),a&&(h/=Math.pow(2,c-1)),(s={})[p]=l;g
").css({position:"absolute",visibility:"visible",left:-s*p,top:-i*f}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:p,height:f,left:n+(u?a*p:0),top:o+(u?r*f:0),opacity:u?0:1}).animate({left:n+(u?0:a*p),top:o+(u?0:r*f),opacity:u?1:0},t.duration||500,t.easing,m)}),V.effects.define("fade","toggle",function(t,e){var i="show"===t.mode;V(this).css("opacity",i?0:1).animate({opacity:i?1:0},{queue:!1,duration:t.duration,easing:t.easing,complete:e})}),V.effects.define("fold","hide",function(e,t){var i=V(this),s=e.mode,n="show"===s,o="hide"===s,a=e.size||15,r=/([0-9]+)%/.exec(a),l=!!e.horizFirst?["right","bottom"]:["bottom","right"],h=e.duration/2,c=V.effects.createPlaceholder(i),u=i.cssClip(),d={clip:V.extend({},u)},p={clip:V.extend({},u)},f=[u[l[0]],u[l[1]]],s=i.queue().length;r&&(a=parseInt(r[1],10)/100*f[o?0:1]),d.clip[l[0]]=a,p.clip[l[0]]=a,p.clip[l[1]]=0,n&&(i.cssClip(p.clip),c&&c.css(V.effects.clipToBox(p)),p.clip=u),i.queue(function(t){c&&c.animate(V.effects.clipToBox(d),h,e.easing).animate(V.effects.clipToBox(p),h,e.easing),t()}).animate(d,h,e.easing).animate(p,h,e.easing).queue(t),V.effects.unshift(i,s,4)}),V.effects.define("highlight","show",function(t,e){var i=V(this),s={backgroundColor:i.css("backgroundColor")};"hide"===t.mode&&(s.opacity=0),V.effects.saveStyle(i),i.css({backgroundImage:"none",backgroundColor:t.color||"#ffff99"}).animate(s,{queue:!1,duration:t.duration,easing:t.easing,complete:e})}),V.effects.define("size",function(s,e){var n,i=V(this),t=["fontSize"],o=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],a=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],r=s.mode,l="effect"!==r,h=s.scale||"both",c=s.origin||["middle","center"],u=i.css("position"),d=i.position(),p=V.effects.scaledDimensions(i),f=s.from||p,g=s.to||V.effects.scaledDimensions(i,0);V.effects.createPlaceholder(i),"show"===r&&(r=f,f=g,g=r),n={from:{y:f.height/p.height,x:f.width/p.width},to:{y:g.height/p.height,x:g.width/p.width}},"box"!==h&&"both"!==h||(n.from.y!==n.to.y&&(f=V.effects.setTransition(i,o,n.from.y,f),g=V.effects.setTransition(i,o,n.to.y,g)),n.from.x!==n.to.x&&(f=V.effects.setTransition(i,a,n.from.x,f),g=V.effects.setTransition(i,a,n.to.x,g))),"content"!==h&&"both"!==h||n.from.y!==n.to.y&&(f=V.effects.setTransition(i,t,n.from.y,f),g=V.effects.setTransition(i,t,n.to.y,g)),c&&(c=V.effects.getBaseline(c,p),f.top=(p.outerHeight-f.outerHeight)*c.y+d.top,f.left=(p.outerWidth-f.outerWidth)*c.x+d.left,g.top=(p.outerHeight-g.outerHeight)*c.y+d.top,g.left=(p.outerWidth-g.outerWidth)*c.x+d.left),delete f.outerHeight,delete f.outerWidth,i.css(f),"content"!==h&&"both"!==h||(o=o.concat(["marginTop","marginBottom"]).concat(t),a=a.concat(["marginLeft","marginRight"]),i.find("*[width]").each(function(){var t=V(this),e=V.effects.scaledDimensions(t),i={height:e.height*n.from.y,width:e.width*n.from.x,outerHeight:e.outerHeight*n.from.y,outerWidth:e.outerWidth*n.from.x},e={height:e.height*n.to.y,width:e.width*n.to.x,outerHeight:e.height*n.to.y,outerWidth:e.width*n.to.x};n.from.y!==n.to.y&&(i=V.effects.setTransition(t,o,n.from.y,i),e=V.effects.setTransition(t,o,n.to.y,e)),n.from.x!==n.to.x&&(i=V.effects.setTransition(t,a,n.from.x,i),e=V.effects.setTransition(t,a,n.to.x,e)),l&&V.effects.saveStyle(t),t.css(i),t.animate(e,s.duration,s.easing,function(){l&&V.effects.restoreStyle(t)})})),i.animate(g,{queue:!1,duration:s.duration,easing:s.easing,complete:function(){var t=i.offset();0===g.opacity&&i.css("opacity",f.opacity),l||(i.css("position","static"===u?"relative":u).offset(t),V.effects.saveStyle(i)),e()}})}),V.effects.define("scale",function(t,e){var i=V(this),s=t.mode,s=parseInt(t.percent,10)||(0===parseInt(t.percent,10)||"effect"!==s?0:100),s=V.extend(!0,{from:V.effects.scaledDimensions(i),to:V.effects.scaledDimensions(i,s,t.direction||"both"),origin:t.origin||["middle","center"]},t);t.fade&&(s.from.opacity=1,s.to.opacity=0),V.effects.effect.size.call(this,s,e)}),V.effects.define("puff","hide",function(t,e){t=V.extend(!0,{},t,{fade:!0,percent:parseInt(t.percent,10)||150});V.effects.effect.scale.call(this,t,e)}),V.effects.define("pulsate","show",function(t,e){var i=V(this),s=t.mode,n="show"===s,o=2*(t.times||5)+(n||"hide"===s?1:0),a=t.duration/o,r=0,l=1,s=i.queue().length;for(!n&&i.is(":visible")||(i.css("opacity",0).show(),r=1);l li > :first-child").add(t.find("> :not(li)").even())},heightStyle:"auto",icons:{activeHeader:"ui-icon-triangle-1-s",header:"ui-icon-triangle-1-e"},activate:null,beforeActivate:null},hideProps:{borderTopWidth:"hide",borderBottomWidth:"hide",paddingTop:"hide",paddingBottom:"hide",height:"hide"},showProps:{borderTopWidth:"show",borderBottomWidth:"show",paddingTop:"show",paddingBottom:"show",height:"show"},_create:function(){var t=this.options;this.prevShow=this.prevHide=V(),this._addClass("ui-accordion","ui-widget ui-helper-reset"),this.element.attr("role","tablist"),t.collapsible||!1!==t.active&&null!=t.active||(t.active=0),this._processPanels(),t.active<0&&(t.active+=this.headers.length),this._refresh()},_getCreateEventData:function(){return{header:this.active,panel:this.active.length?this.active.next():V()}},_createIcons:function(){var t,e=this.options.icons;e&&(t=V(""),this._addClass(t,"ui-accordion-header-icon","ui-icon "+e.header),t.prependTo(this.headers),t=this.active.children(".ui-accordion-header-icon"),this._removeClass(t,e.header)._addClass(t,null,e.activeHeader)._addClass(this.headers,"ui-accordion-icons"))},_destroyIcons:function(){this._removeClass(this.headers,"ui-accordion-icons"),this.headers.children(".ui-accordion-header-icon").remove()},_destroy:function(){var t;this.element.removeAttr("role"),this.headers.removeAttr("role aria-expanded aria-selected aria-controls tabIndex").removeUniqueId(),this._destroyIcons(),t=this.headers.next().css("display","").removeAttr("role aria-hidden aria-labelledby").removeUniqueId(),"content"!==this.options.heightStyle&&t.css("height","")},_setOption:function(t,e){"active"!==t?("event"===t&&(this.options.event&&this._off(this.headers,this.options.event),this._setupEvents(e)),this._super(t,e),"collapsible"!==t||e||!1!==this.options.active||this._activate(0),"icons"===t&&(this._destroyIcons(),e&&this._createIcons())):this._activate(e)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",t),this._toggleClass(null,"ui-state-disabled",!!t),this._toggleClass(this.headers.add(this.headers.next()),null,"ui-state-disabled",!!t)},_keydown:function(t){if(!t.altKey&&!t.ctrlKey){var e=V.ui.keyCode,i=this.headers.length,s=this.headers.index(t.target),n=!1;switch(t.keyCode){case e.RIGHT:case e.DOWN:n=this.headers[(s+1)%i];break;case e.LEFT:case e.UP:n=this.headers[(s-1+i)%i];break;case e.SPACE:case e.ENTER:this._eventHandler(t);break;case e.HOME:n=this.headers[0];break;case e.END:n=this.headers[i-1]}n&&(V(t.target).attr("tabIndex",-1),V(n).attr("tabIndex",0),V(n).trigger("focus"),t.preventDefault())}},_panelKeyDown:function(t){t.keyCode===V.ui.keyCode.UP&&t.ctrlKey&&V(t.currentTarget).prev().trigger("focus")},refresh:function(){var t=this.options;this._processPanels(),!1===t.active&&!0===t.collapsible||!this.headers.length?(t.active=!1,this.active=V()):!1===t.active?this._activate(0):this.active.length&&!V.contains(this.element[0],this.active[0])?this.headers.length===this.headers.find(".ui-state-disabled").length?(t.active=!1,this.active=V()):this._activate(Math.max(0,t.active-1)):t.active=this.headers.index(this.active),this._destroyIcons(),this._refresh()},_processPanels:function(){var t=this.headers,e=this.panels;"function"==typeof this.options.header?this.headers=this.options.header(this.element):this.headers=this.element.find(this.options.header),this._addClass(this.headers,"ui-accordion-header ui-accordion-header-collapsed","ui-state-default"),this.panels=this.headers.next().filter(":not(.ui-accordion-content-active)").hide(),this._addClass(this.panels,"ui-accordion-content","ui-helper-reset ui-widget-content"),e&&(this._off(t.not(this.headers)),this._off(e.not(this.panels)))},_refresh:function(){var i,t=this.options,e=t.heightStyle,s=this.element.parent();this.active=this._findActive(t.active),this._addClass(this.active,"ui-accordion-header-active","ui-state-active")._removeClass(this.active,"ui-accordion-header-collapsed"),this._addClass(this.active.next(),"ui-accordion-content-active"),this.active.next().show(),this.headers.attr("role","tab").each(function(){var t=V(this),e=t.uniqueId().attr("id"),i=t.next(),s=i.uniqueId().attr("id");t.attr("aria-controls",s),i.attr("aria-labelledby",e)}).next().attr("role","tabpanel"),this.headers.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}).next().attr({"aria-hidden":"true"}).hide(),this.active.length?this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}).next().attr({"aria-hidden":"false"}):this.headers.eq(0).attr("tabIndex",0),this._createIcons(),this._setupEvents(t.event),"fill"===e?(i=s.height(),this.element.siblings(":visible").each(function(){var t=V(this),e=t.css("position");"absolute"!==e&&"fixed"!==e&&(i-=t.outerHeight(!0))}),this.headers.each(function(){i-=V(this).outerHeight(!0)}),this.headers.next().each(function(){V(this).height(Math.max(0,i-V(this).innerHeight()+V(this).height()))}).css("overflow","auto")):"auto"===e&&(i=0,this.headers.next().each(function(){var t=V(this).is(":visible");t||V(this).show(),i=Math.max(i,V(this).css("height","").height()),t||V(this).hide()}).height(i))},_activate:function(t){t=this._findActive(t)[0];t!==this.active[0]&&(t=t||this.active[0],this._eventHandler({target:t,currentTarget:t,preventDefault:V.noop}))},_findActive:function(t){return"number"==typeof t?this.headers.eq(t):V()},_setupEvents:function(t){var i={keydown:"_keydown"};t&&V.each(t.split(" "),function(t,e){i[e]="_eventHandler"}),this._off(this.headers.add(this.headers.next())),this._on(this.headers,i),this._on(this.headers.next(),{keydown:"_panelKeyDown"}),this._hoverable(this.headers),this._focusable(this.headers)},_eventHandler:function(t){var e=this.options,i=this.active,s=V(t.currentTarget),n=s[0]===i[0],o=n&&e.collapsible,a=o?V():s.next(),r=i.next(),a={oldHeader:i,oldPanel:r,newHeader:o?V():s,newPanel:a};t.preventDefault(),n&&!e.collapsible||!1===this._trigger("beforeActivate",t,a)||(e.active=!o&&this.headers.index(s),this.active=n?V():s,this._toggle(a),this._removeClass(i,"ui-accordion-header-active","ui-state-active"),e.icons&&(i=i.children(".ui-accordion-header-icon"),this._removeClass(i,null,e.icons.activeHeader)._addClass(i,null,e.icons.header)),n||(this._removeClass(s,"ui-accordion-header-collapsed")._addClass(s,"ui-accordion-header-active","ui-state-active"),e.icons&&(n=s.children(".ui-accordion-header-icon"),this._removeClass(n,null,e.icons.header)._addClass(n,null,e.icons.activeHeader)),this._addClass(s.next(),"ui-accordion-content-active")))},_toggle:function(t){var e=t.newPanel,i=this.prevShow.length?this.prevShow:t.oldPanel;this.prevShow.add(this.prevHide).stop(!0,!0),this.prevShow=e,this.prevHide=i,this.options.animate?this._animate(e,i,t):(i.hide(),e.show(),this._toggleComplete(t)),i.attr({"aria-hidden":"true"}),i.prev().attr({"aria-selected":"false","aria-expanded":"false"}),e.length&&i.length?i.prev().attr({tabIndex:-1,"aria-expanded":"false"}):e.length&&this.headers.filter(function(){return 0===parseInt(V(this).attr("tabIndex"),10)}).attr("tabIndex",-1),e.attr("aria-hidden","false").prev().attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_animate:function(t,i,e){var s,n,o,a=this,r=0,l=t.css("box-sizing"),h=t.length&&(!i.length||t.index()",delay:300,options:{icons:{submenu:"ui-icon-caret-1-e"},items:"> *",menus:"ul",position:{my:"left top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element,this.mouseHandled=!1,this.lastMousePosition={x:null,y:null},this.element.uniqueId().attr({role:this.options.role,tabIndex:0}),this._addClass("ui-menu","ui-widget ui-widget-content"),this._on({"mousedown .ui-menu-item":function(t){t.preventDefault(),this._activateItem(t)},"click .ui-menu-item":function(t){var e=V(t.target),i=V(V.ui.safeActiveElement(this.document[0]));!this.mouseHandled&&e.not(".ui-state-disabled").length&&(this.select(t),t.isPropagationStopped()||(this.mouseHandled=!0),e.has(".ui-menu").length?this.expand(t):!this.element.is(":focus")&&i.closest(".ui-menu").length&&(this.element.trigger("focus",[!0]),this.active&&1===this.active.parents(".ui-menu").length&&clearTimeout(this.timer)))},"mouseenter .ui-menu-item":"_activateItem","mousemove .ui-menu-item":"_activateItem",mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(t,e){var i=this.active||this._menuItems().first();e||this.focus(t,i)},blur:function(t){this._delay(function(){V.contains(this.element[0],V.ui.safeActiveElement(this.document[0]))||this.collapseAll(t)})},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(t){this._closeOnDocumentClick(t)&&this.collapseAll(t,!0),this.mouseHandled=!1}})},_activateItem:function(t){var e,i;this.previousFilter||t.clientX===this.lastMousePosition.x&&t.clientY===this.lastMousePosition.y||(this.lastMousePosition={x:t.clientX,y:t.clientY},e=V(t.target).closest(".ui-menu-item"),i=V(t.currentTarget),e[0]===i[0]&&(i.is(".ui-state-active")||(this._removeClass(i.siblings().children(".ui-state-active"),null,"ui-state-active"),this.focus(t,i))))},_destroy:function(){var t=this.element.find(".ui-menu-item").removeAttr("role aria-disabled").children(".ui-menu-item-wrapper").removeUniqueId().removeAttr("tabIndex role aria-haspopup");this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeAttr("role aria-labelledby aria-expanded aria-hidden aria-disabled tabIndex").removeUniqueId().show(),t.children().each(function(){var t=V(this);t.data("ui-menu-submenu-caret")&&t.remove()})},_keydown:function(t){var e,i,s,n=!0;switch(t.keyCode){case V.ui.keyCode.PAGE_UP:this.previousPage(t);break;case V.ui.keyCode.PAGE_DOWN:this.nextPage(t);break;case V.ui.keyCode.HOME:this._move("first","first",t);break;case V.ui.keyCode.END:this._move("last","last",t);break;case V.ui.keyCode.UP:this.previous(t);break;case V.ui.keyCode.DOWN:this.next(t);break;case V.ui.keyCode.LEFT:this.collapse(t);break;case V.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(t);break;case V.ui.keyCode.ENTER:case V.ui.keyCode.SPACE:this._activate(t);break;case V.ui.keyCode.ESCAPE:this.collapse(t);break;default:e=this.previousFilter||"",s=n=!1,i=96<=t.keyCode&&t.keyCode<=105?(t.keyCode-96).toString():String.fromCharCode(t.keyCode),clearTimeout(this.filterTimer),i===e?s=!0:i=e+i,e=this._filterMenuItems(i),(e=s&&-1!==e.index(this.active.next())?this.active.nextAll(".ui-menu-item"):e).length||(i=String.fromCharCode(t.keyCode),e=this._filterMenuItems(i)),e.length?(this.focus(t,e),this.previousFilter=i,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter}n&&t.preventDefault()},_activate:function(t){this.active&&!this.active.is(".ui-state-disabled")&&(this.active.children("[aria-haspopup='true']").length?this.expand(t):this.select(t))},refresh:function(){var t,e,s=this,n=this.options.icons.submenu,i=this.element.find(this.options.menus);this._toggleClass("ui-menu-icons",null,!!this.element.find(".ui-icon").length),e=i.filter(":not(.ui-menu)").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var t=V(this),e=t.prev(),i=V("").data("ui-menu-submenu-caret",!0);s._addClass(i,"ui-menu-icon","ui-icon "+n),e.attr("aria-haspopup","true").prepend(i),t.attr("aria-labelledby",e.attr("id"))}),this._addClass(e,"ui-menu","ui-widget ui-widget-content ui-front"),(t=i.add(this.element).find(this.options.items)).not(".ui-menu-item").each(function(){var t=V(this);s._isDivider(t)&&s._addClass(t,"ui-menu-divider","ui-widget-content")}),i=(e=t.not(".ui-menu-item, .ui-menu-divider")).children().not(".ui-menu").uniqueId().attr({tabIndex:-1,role:this._itemRole()}),this._addClass(e,"ui-menu-item")._addClass(i,"ui-menu-item-wrapper"),t.filter(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!V.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(t,e){var i;"icons"===t&&(i=this.element.find(".ui-menu-icon"),this._removeClass(i,null,this.options.icons.submenu)._addClass(i,null,e.submenu)),this._super(t,e)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",String(t)),this._toggleClass(null,"ui-state-disabled",!!t)},focus:function(t,e){var i;this.blur(t,t&&"focus"===t.type),this._scrollIntoView(e),this.active=e.first(),i=this.active.children(".ui-menu-item-wrapper"),this._addClass(i,null,"ui-state-active"),this.options.role&&this.element.attr("aria-activedescendant",i.attr("id")),i=this.active.parent().closest(".ui-menu-item").children(".ui-menu-item-wrapper"),this._addClass(i,null,"ui-state-active"),t&&"keydown"===t.type?this._close():this.timer=this._delay(function(){this._close()},this.delay),(i=e.children(".ui-menu")).length&&t&&/^mouse/.test(t.type)&&this._startOpening(i),this.activeMenu=e.parent(),this._trigger("focus",t,{item:e})},_scrollIntoView:function(t){var e,i,s;this._hasScroll()&&(i=parseFloat(V.css(this.activeMenu[0],"borderTopWidth"))||0,s=parseFloat(V.css(this.activeMenu[0],"paddingTop"))||0,e=t.offset().top-this.activeMenu.offset().top-i-s,i=this.activeMenu.scrollTop(),s=this.activeMenu.height(),t=t.outerHeight(),e<0?this.activeMenu.scrollTop(i+e):s",options:{appendTo:null,autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},requestIndex:0,pending:0,liveRegionTimer:null,_create:function(){var i,s,n,t=this.element[0].nodeName.toLowerCase(),e="textarea"===t,t="input"===t;this.isMultiLine=e||!t&&this._isContentEditable(this.element),this.valueMethod=this.element[e||t?"val":"text"],this.isNewMenu=!0,this._addClass("ui-autocomplete-input"),this.element.attr("autocomplete","off"),this._on(this.element,{keydown:function(t){if(this.element.prop("readOnly"))s=n=i=!0;else{s=n=i=!1;var e=V.ui.keyCode;switch(t.keyCode){case e.PAGE_UP:i=!0,this._move("previousPage",t);break;case e.PAGE_DOWN:i=!0,this._move("nextPage",t);break;case e.UP:i=!0,this._keyEvent("previous",t);break;case e.DOWN:i=!0,this._keyEvent("next",t);break;case e.ENTER:this.menu.active&&(i=!0,t.preventDefault(),this.menu.select(t));break;case e.TAB:this.menu.active&&this.menu.select(t);break;case e.ESCAPE:this.menu.element.is(":visible")&&(this.isMultiLine||this._value(this.term),this.close(t),t.preventDefault());break;default:s=!0,this._searchTimeout(t)}}},keypress:function(t){if(i)return i=!1,void(this.isMultiLine&&!this.menu.element.is(":visible")||t.preventDefault());if(!s){var e=V.ui.keyCode;switch(t.keyCode){case e.PAGE_UP:this._move("previousPage",t);break;case e.PAGE_DOWN:this._move("nextPage",t);break;case e.UP:this._keyEvent("previous",t);break;case e.DOWN:this._keyEvent("next",t)}}},input:function(t){if(n)return n=!1,void t.preventDefault();this._searchTimeout(t)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(t){clearTimeout(this.searching),this.close(t),this._change(t)}}),this._initSource(),this.menu=V("