mirror of
https://github.com/slawkens/myaac.git
synced 2025-06-10 14:54:30 +02:00
Merge branch 'develop' into feature/login-by-email
This commit is contained in:
commit
2563583f84
@ -12,5 +12,8 @@ insert_final_newline = true
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[composer.json]
|
||||
indent_style = space
|
||||
[{composer.json,package.json}]
|
||||
indent_style = space
|
||||
|
||||
[package.json]
|
||||
indent_size = 2
|
13
.gitignore
vendored
13
.gitignore
vendored
@ -1,15 +1,19 @@
|
||||
Thumbs.db
|
||||
.DS_Store
|
||||
.idea
|
||||
tmp
|
||||
|
||||
# composer
|
||||
composer.lock
|
||||
vendor
|
||||
|
||||
# npm
|
||||
node_modules
|
||||
|
||||
# created by release.sh
|
||||
releases
|
||||
tmp
|
||||
|
||||
config.local.php
|
||||
PERSONAL_NOTES
|
||||
|
||||
# all custom templates
|
||||
templates/*
|
||||
@ -35,6 +39,10 @@ system/logs/*
|
||||
system/data/*
|
||||
!system/data/index.html
|
||||
|
||||
# php sessions
|
||||
system/php_sessions/*
|
||||
!system/php_sessions/index.html
|
||||
|
||||
# plugins
|
||||
plugins/*
|
||||
!plugins/.htaccess
|
||||
@ -42,7 +50,6 @@ plugins/*
|
||||
!plugins/account-create-hint.json
|
||||
!plugins/account-create-hint
|
||||
landing
|
||||
/login.php
|
||||
|
||||
# system
|
||||
system/functions_custom.php
|
||||
|
14
CONTRIBUTORS.txt
Normal file
14
CONTRIBUTORS.txt
Normal file
@ -0,0 +1,14 @@
|
||||
# automatically exported using this script:
|
||||
# git log --all --format='%cN <%cE>' | sort -u > contributors
|
||||
# in no particular order
|
||||
# cleaned for readability
|
||||
|
||||
Evil Puncker <EPuncker@users.noreply.github.com>
|
||||
Fernando Matos <fernando@pixele.com.br>
|
||||
Lee <42119604+Leesneaks@users.noreply.github.com>
|
||||
caio <caio.zucoli@gmail.com>
|
||||
slawkens <slawkens@gmail.com>
|
||||
tobi132 <52947952+tobi132@users.noreply.github.com>
|
||||
vankk <nwtr.otland@hotmail.com>
|
||||
whiteblXK <krzys16001@gmail.com>
|
||||
xitobuh <jonas.hockert92@gmail.com>
|
3
CREDITS
3
CREDITS
@ -1,2 +1,3 @@
|
||||
* Gesior.pl (2007 - 2008)
|
||||
* Slawkens (2009 - 2020)
|
||||
* Slawkens (2009 - 2021)
|
||||
* Contributors listed in CONTRIBUTORS.txt
|
||||
|
@ -175,6 +175,16 @@
|
||||
echo $content;
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
/**
|
||||
* @var OTS_Account $account_logged
|
||||
*/
|
||||
if ($logged && admin()) {
|
||||
$twig->display('admin-bar.html.twig', [
|
||||
'username' => USE_ACCOUNT_NAME ? $account_logged->getName() : $account_logged->getId()
|
||||
]);
|
||||
}
|
||||
?>
|
||||
<script src="<?php echo BASE_URL; ?>tools/js/bootstrap.min.js"></script>
|
||||
<script src="<?php echo BASE_URL; ?>tools/js/jquery-ui.min.js"></script>
|
||||
<?php if (isset($use_datatable)) { ?>
|
||||
|
98
common.php
98
common.php
@ -24,68 +24,70 @@
|
||||
* @link https://my-aac.org
|
||||
*/
|
||||
if (version_compare(phpversion(), '7.1', '<')) die('PHP version 7.1 or higher is required.');
|
||||
session_start();
|
||||
|
||||
define('MYAAC', true);
|
||||
define('MYAAC_VERSION', '0.9.0-dev');
|
||||
define('DATABASE_VERSION', 32);
|
||||
define('TABLE_PREFIX', 'myaac_');
|
||||
const MYAAC = true;
|
||||
const MYAAC_VERSION = '0.9.0-dev';
|
||||
const DATABASE_VERSION = 32;
|
||||
const TABLE_PREFIX = 'myaac_';
|
||||
define('START_TIME', microtime(true));
|
||||
define('MYAAC_OS', stripos(PHP_OS, 'WIN') === 0 ? 'WINDOWS' : (strtoupper(PHP_OS) === 'DARWIN' ? 'MAC' : 'LINUX'));
|
||||
define('IS_CLI', in_array(php_sapi_name(), ['cli', 'phpdb']));
|
||||
|
||||
// account flags
|
||||
define('FLAG_ADMIN', 1);
|
||||
define('FLAG_SUPER_ADMIN', 2);
|
||||
define('FLAG_CONTENT_PAGES', 4);
|
||||
define('FLAG_CONTENT_MAILER', 8);
|
||||
define('FLAG_CONTENT_NEWS', 16);
|
||||
define('FLAG_CONTENT_FORUM', 32);
|
||||
define('FLAG_CONTENT_COMMANDS', 64);
|
||||
define('FLAG_CONTENT_SPELLS', 128);
|
||||
define('FLAG_CONTENT_MONSTERS', 256);
|
||||
define('FLAG_CONTENT_GALLERY', 512);
|
||||
define('FLAG_CONTENT_VIDEOS', 1024);
|
||||
define('FLAG_CONTENT_FAQ', 2048);
|
||||
define('FLAG_CONTENT_MENUS', 4096);
|
||||
define('FLAG_CONTENT_PLAYERS', 8192);
|
||||
const FLAG_ADMIN = 1;
|
||||
const FLAG_SUPER_ADMIN = 2;
|
||||
const FLAG_CONTENT_PAGES = 4;
|
||||
const FLAG_CONTENT_MAILER = 8;
|
||||
const FLAG_CONTENT_NEWS = 16;
|
||||
const FLAG_CONTENT_FORUM = 32;
|
||||
const FLAG_CONTENT_COMMANDS = 64;
|
||||
const FLAG_CONTENT_SPELLS = 128;
|
||||
const FLAG_CONTENT_MONSTERS = 256;
|
||||
const FLAG_CONTENT_GALLERY = 512;
|
||||
const FLAG_CONTENT_VIDEOS = 1024;
|
||||
const FLAG_CONTENT_FAQ = 2048;
|
||||
const FLAG_CONTENT_MENUS = 4096;
|
||||
const FLAG_CONTENT_PLAYERS = 8192;
|
||||
|
||||
// news
|
||||
define('NEWS', 1);
|
||||
define('TICKER', 2);
|
||||
define('ARTICLE', 3);
|
||||
const NEWS = 1;
|
||||
const TICKER = 2;
|
||||
const ARTICLE = 3;
|
||||
|
||||
// directories
|
||||
define('BASE', __DIR__ . '/');
|
||||
define('ADMIN', BASE . 'admin/');
|
||||
define('SYSTEM', BASE . 'system/');
|
||||
define('CACHE', SYSTEM . 'cache/');
|
||||
define('LOCALE', SYSTEM . 'locale/');
|
||||
define('LIBS', SYSTEM . 'libs/');
|
||||
define('LOGS', SYSTEM . 'logs/');
|
||||
define('PAGES', SYSTEM . 'pages/');
|
||||
define('PLUGINS', BASE . 'plugins/');
|
||||
define('TEMPLATES', BASE . 'templates/');
|
||||
define('TOOLS', BASE . 'tools/');
|
||||
define('VENDOR', BASE . 'vendor/');
|
||||
const BASE = __DIR__ . '/';
|
||||
const ADMIN = BASE . 'admin/';
|
||||
const SYSTEM = BASE . 'system/';
|
||||
const CACHE = SYSTEM . 'cache/';
|
||||
const LOCALE = SYSTEM . 'locale/';
|
||||
const LIBS = SYSTEM . 'libs/';
|
||||
const LOGS = SYSTEM . 'logs/';
|
||||
const PAGES = SYSTEM . 'pages/';
|
||||
const PLUGINS = BASE . 'plugins/';
|
||||
const TEMPLATES = BASE . 'templates/';
|
||||
const TOOLS = BASE . 'tools/';
|
||||
const VENDOR = BASE . 'vendor/';
|
||||
|
||||
// menu categories
|
||||
define('MENU_CATEGORY_NEWS', 1);
|
||||
define('MENU_CATEGORY_ACCOUNT', 2);
|
||||
define('MENU_CATEGORY_COMMUNITY', 3);
|
||||
define('MENU_CATEGORY_FORUM', 4);
|
||||
define('MENU_CATEGORY_LIBRARY', 5);
|
||||
define('MENU_CATEGORY_SHOP', 6);
|
||||
const MENU_CATEGORY_NEWS = 1;
|
||||
const MENU_CATEGORY_ACCOUNT = 2;
|
||||
const MENU_CATEGORY_COMMUNITY = 3;
|
||||
const MENU_CATEGORY_FORUM = 4;
|
||||
const MENU_CATEGORY_LIBRARY = 5;
|
||||
const MENU_CATEGORY_SHOP = 6;
|
||||
|
||||
// otserv versions
|
||||
define('OTSERV', 1);
|
||||
define('OTSERV_06', 2);
|
||||
define('OTSERV_FIRST', OTSERV);
|
||||
define('OTSERV_LAST', OTSERV_06);
|
||||
define('TFS_02', 3);
|
||||
define('TFS_03', 4);
|
||||
define('TFS_FIRST', TFS_02);
|
||||
define('TFS_LAST', TFS_03);
|
||||
const OTSERV = 1;
|
||||
const OTSERV_06 = 2;
|
||||
const OTSERV_FIRST = OTSERV;
|
||||
const OTSERV_LAST = OTSERV_06;
|
||||
const TFS_02 = 3;
|
||||
const TFS_03 = 4;
|
||||
const TFS_FIRST = TFS_02;
|
||||
const TFS_LAST = TFS_03;
|
||||
|
||||
session_save_path(SYSTEM . 'php_sessions');
|
||||
session_start();
|
||||
|
||||
// basedir
|
||||
$basedir = '';
|
||||
|
@ -1,16 +1,14 @@
|
||||
{
|
||||
"require": {
|
||||
"php": ">=7.1",
|
||||
"ext-dom": "*",
|
||||
"ext-json": "*",
|
||||
"ext-gd": "*",
|
||||
"php": "^7.2.5 || ^8.0",
|
||||
"ext-pdo": "*",
|
||||
"ext-pdo_mysql": "*",
|
||||
"ext-json": "*",
|
||||
"ext-xml": "*",
|
||||
"ext-zip": "*",
|
||||
"ext-dom": "*",
|
||||
"phpmailer/phpmailer": "^6.1",
|
||||
"composer/semver": "^3.2",
|
||||
"twig/twig": "~1.42.5",
|
||||
"twig/twig": "^1.0",
|
||||
"erusev/parsedown": "^1.7"
|
||||
}
|
||||
}
|
||||
|
@ -369,6 +369,14 @@ if($config['backward_support']) {
|
||||
$topic = $title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var OTS_Account $account_logged
|
||||
*/
|
||||
if ($logged && admin()) {
|
||||
$content .= $twig->render('admin-bar.html.twig', [
|
||||
'username' => USE_ACCOUNT_NAME ? $account_logged->getName() : $account_logged->getId()
|
||||
]);
|
||||
}
|
||||
$title_full = (isset($title) ? $title . ' - ' : '') . $config['lua']['serverName'];
|
||||
require $template_path . '/' . $template_index;
|
||||
|
||||
|
@ -2,10 +2,10 @@ We have detected that you don't have access to write to the system/cache directo
|
||||
|
||||
<style type="text/css">
|
||||
.console {
|
||||
font-family:Courier;
|
||||
font-family: Courier,serif;
|
||||
color: #CCCCCC;
|
||||
background: #000000;
|
||||
border: 3px double #CCCCCC;
|
||||
padding: 0px;
|
||||
padding: 0;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
@ -12,10 +12,11 @@ $dirs_optional = [
|
||||
];
|
||||
|
||||
$extensions_required = [
|
||||
'json', 'pdo', 'pdo_mysql', 'xml', 'zip'
|
||||
'pdo', 'pdo_mysql', 'json', 'xml'
|
||||
];
|
||||
$extensions_optional = [
|
||||
'gd' => $locale['step_requirements_warning_player_signatures'],
|
||||
'zip' => $locale['step_requirements_warning_install_plugins'],
|
||||
];
|
||||
/*
|
||||
*
|
||||
|
285
login.php
Normal file
285
login.php
Normal file
@ -0,0 +1,285 @@
|
||||
<?php
|
||||
require_once 'common.php';
|
||||
require_once 'config.php';
|
||||
require_once 'config.local.php';
|
||||
require_once SYSTEM . 'functions.php';
|
||||
require_once SYSTEM . 'init.php';
|
||||
require_once SYSTEM . 'status.php';
|
||||
|
||||
# error function
|
||||
function sendError($message, $code = 3){
|
||||
$ret = [];
|
||||
$ret['errorCode'] = $code;
|
||||
$ret['errorMessage'] = $message;
|
||||
die(json_encode($ret));
|
||||
}
|
||||
|
||||
# event schedule function
|
||||
function parseEvent($table1, $date, $table2)
|
||||
{
|
||||
if ($table1) {
|
||||
if ($date) {
|
||||
if ($table2) {
|
||||
$date = $table1->getAttribute('startdate');
|
||||
return date_create("{$date}")->format('U');
|
||||
} else {
|
||||
$date = $table1->getAttribute('enddate');
|
||||
return date_create("{$date}")->format('U');
|
||||
}
|
||||
} else {
|
||||
foreach($table1 as $attr) {
|
||||
if ($attr) {
|
||||
return $attr->getAttribute($table2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 'error';
|
||||
}
|
||||
|
||||
$request = json_decode(file_get_contents('php://input'));
|
||||
$action = $request->type ?? '';
|
||||
|
||||
/** @var OTS_Base_DB $db */
|
||||
/** @var array $config */
|
||||
|
||||
switch ($action) {
|
||||
case 'cacheinfo':
|
||||
$playersonline = $db->query("select count(*) from `players_online`")->fetchAll();
|
||||
die(json_encode([
|
||||
'playersonline' => (intval($playersonline[0][0])),
|
||||
'twitchstreams' => 0,
|
||||
'twitchviewer' => 0,
|
||||
'gamingyoutubestreams' => 0,
|
||||
'gamingyoutubeviewer' => 0
|
||||
]));
|
||||
|
||||
case 'eventschedule':
|
||||
$eventlist = [];
|
||||
$file_path = config('server_path') . 'data/XML/events.xml';
|
||||
if (!file_exists($file_path)) {
|
||||
die(json_encode([]));
|
||||
}
|
||||
$xml = new DOMDocument;
|
||||
$xml->load($file_path);
|
||||
$tmplist = [];
|
||||
$tableevent = $xml->getElementsByTagName('event');
|
||||
|
||||
foreach ($tableevent as $event) {
|
||||
if ($event) { $tmplist = [
|
||||
'colorlight' => parseEvent($event->getElementsByTagName('colors'), false, 'colorlight'),
|
||||
'colordark' => parseEvent($event->getElementsByTagName('colors'), false, 'colordark'),
|
||||
'description' => parseEvent($event->getElementsByTagName('description'), false, 'description'),
|
||||
'displaypriority' => intval(parseEvent($event->getElementsByTagName('details'), false, 'displaypriority')),
|
||||
'enddate' => intval(parseEvent($event, true, false)),
|
||||
'isseasonal' => getBoolean(intval(parseEvent($event->getElementsByTagName('details'), false, 'isseasonal'))),
|
||||
'name' => $event->getAttribute('name'),
|
||||
'startdate' => intval(parseEvent($event, true, true)),
|
||||
'specialevent' => intval(parseEvent($event->getElementsByTagName('details'), false, 'specialevent'))
|
||||
];
|
||||
$eventlist[] = $tmplist; } }
|
||||
die(json_encode(['eventlist' => $eventlist, 'lastupdatetimestamp' => time()]));
|
||||
|
||||
case 'boostedcreature':
|
||||
$boostDB = $db->query("select * from " . $db->tableName('boosted_creature'))->fetchAll();
|
||||
foreach ($boostDB as $Tableboost) {
|
||||
die(json_encode([
|
||||
'boostedcreature' => true,
|
||||
'raceid' => intval($Tableboost['raceid'])
|
||||
]));
|
||||
}
|
||||
break;
|
||||
|
||||
case 'login':
|
||||
|
||||
$port = $config['lua']['gameProtocolPort'];
|
||||
|
||||
// default world info
|
||||
$world = [
|
||||
'id' => 0,
|
||||
'name' => $config['lua']['serverName'],
|
||||
'externaladdress' => $config['lua']['ip'],
|
||||
'externalport' => $port,
|
||||
'externaladdressprotected' => $config['lua']['ip'],
|
||||
'externalportprotected' => $port,
|
||||
'externaladdressunprotected' => $config['lua']['ip'],
|
||||
'externalportunprotected' => $port,
|
||||
'previewstate' => 0,
|
||||
'location' => 'BRA', // BRA, EUR, USA
|
||||
'anticheatprotection' => false,
|
||||
'pvptype' => array_search($config['lua']['worldType'], ['pvp', 'no-pvp', 'pvp-enforced']),
|
||||
'istournamentworld' => false,
|
||||
'restrictedstore' => false,
|
||||
'currenttournamentphase' => 2
|
||||
];
|
||||
|
||||
$characters = [];
|
||||
$account = new OTS_Account();
|
||||
|
||||
$inputEmail = $request->email ?? false;
|
||||
$inputAccountName = $request->accountname ?? false;
|
||||
$inputToken = $request->token ?? false;
|
||||
|
||||
if ($inputEmail != false) { // login by email
|
||||
$account->findByEmail($request->email);
|
||||
}
|
||||
else if($inputAccountName != false) { // login by account name
|
||||
$account->find($inputAccountName);
|
||||
}
|
||||
|
||||
$config_salt_enabled = fieldExist('salt', 'accounts');
|
||||
$current_password = encrypt(($config_salt_enabled ? $account->getCustomField('salt') : '') . $request->password);
|
||||
|
||||
if (!$account->isLoaded() || $account->getPassword() != $current_password) {
|
||||
sendError(($inputEmail != false ? 'Email' : 'Account name') . ' or password is not correct.');
|
||||
}
|
||||
|
||||
//log_append('test.log', var_export($account->getCustomField('secret'), true));
|
||||
$accountHasSecret = false;
|
||||
if (fieldExist('secret', 'accounts')) {
|
||||
$accountSecret = $account->getCustomField('secret');
|
||||
if ($accountSecret != null && $accountSecret != '') {
|
||||
$accountHasSecret = true;
|
||||
if ($inputToken === false) {
|
||||
sendError('Submit a valid two-factor authentication token.', 6);
|
||||
} else {
|
||||
require_once LIBS . 'rfc6238.php';
|
||||
if (TokenAuth6238::verify($accountSecret, $inputToken) !== true) {
|
||||
sendError('Two-factor authentication failed, token is wrong.', 6);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// common columns
|
||||
$columns = 'id, name, level, sex, vocation, looktype, lookhead, lookbody, looklegs, lookfeet, lookaddons';
|
||||
|
||||
if (fieldExist('isreward', 'accounts')) {
|
||||
$columns .= ', isreward';
|
||||
}
|
||||
|
||||
if (fieldExist('istutorial', 'accounts')) {
|
||||
$columns .= ', istutorial';
|
||||
}
|
||||
|
||||
$players = $db->query("select {$columns} from players where account_id = " . $account->getId() . " AND deletion = 0");
|
||||
if($players && $players->rowCount() > 0) {
|
||||
$players = $players->fetchAll();
|
||||
|
||||
$highestLevelId = 0;
|
||||
$highestLevel = 0;
|
||||
foreach ($players as $player) {
|
||||
if ($player['level'] >= $highestLevel) {
|
||||
$highestLevel = $player['level'];
|
||||
$highestLevelId = $player['id'];
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($players as $player) {
|
||||
$characters[] = create_char($player, $highestLevelId);
|
||||
}
|
||||
}
|
||||
|
||||
if (fieldExist('premdays', 'accounts') && fieldExist('lastday', 'accounts')) {
|
||||
$save = false;
|
||||
$timeNow = time();
|
||||
$query = $db->query("select `premdays`, `lastday` from `accounts` where `id` = " . $account->getId());
|
||||
if ($query->rowCount() > 0) {
|
||||
$query = $query->fetch();
|
||||
$premDays = (int)$query['premdays'];
|
||||
$lastDay = (int)$query['lastday'];
|
||||
$lastLogin = $lastDay;
|
||||
} else {
|
||||
sendError("Error while fetching your account data. Please contact admin.");
|
||||
}
|
||||
if ($premDays != 0 && $premDays != PHP_INT_MAX) {
|
||||
if ($lastDay == 0) {
|
||||
$lastDay = $timeNow;
|
||||
$save = true;
|
||||
} else {
|
||||
$days = (int)(($timeNow - $lastDay) / 86400);
|
||||
if ($days > 0) {
|
||||
if ($days >= $premDays) {
|
||||
$premDays = 0;
|
||||
$lastDay = 0;
|
||||
} else {
|
||||
$premDays -= $days;
|
||||
$reminder = ($timeNow - $lastDay) % 86400;
|
||||
$lastDay = $timeNow - $reminder;
|
||||
}
|
||||
|
||||
$save = true;
|
||||
}
|
||||
}
|
||||
} else if ($lastDay != 0) {
|
||||
$lastDay = 0;
|
||||
$save = true;
|
||||
}
|
||||
if ($save) {
|
||||
$db->query("update `accounts` set `premdays` = " . $premDays . ", `lastday` = " . $lastDay . " where `id` = " . $account->getId());
|
||||
}
|
||||
}
|
||||
|
||||
$worlds = [$world];
|
||||
$playdata = compact('worlds', 'characters');
|
||||
|
||||
$sessionKey = ($inputEmail !== false) ? $inputEmail : $inputAccountName; // email or account name
|
||||
$sessionKey .= "\n" . $request->password; // password
|
||||
if (!fieldExist('istutorial', 'players')) {
|
||||
$sessionKey .= "\n";
|
||||
}
|
||||
$sessionKey .= ($accountHasSecret && strlen($accountSecret) > 5) ? $inputToken : '';
|
||||
|
||||
// this is workaround to distinguish between TFS 1.x and otservbr
|
||||
// TFS 1.x requires the number in session key
|
||||
// otservbr requires just login and password
|
||||
// so we check for istutorial field which is present in otservbr, and not in TFS
|
||||
if (!fieldExist('istutorial', 'players')) {
|
||||
$sessionKey .= "\n".floor(time() / 30);
|
||||
}
|
||||
|
||||
//log_append('slaw.log', $sessionKey);
|
||||
|
||||
$session = [
|
||||
'sessionkey' => $sessionKey,
|
||||
'lastlogintime' => 0,
|
||||
'ispremium' => $config['lua']['freePremium'] || $account->isPremium(),
|
||||
'premiumuntil' => ($account->getPremDays()) > 0 ? (time() + ($account->getPremDays() * 86400)) : 0,
|
||||
'status' => 'active', // active, frozen or suspended
|
||||
'returnernotification' => false,
|
||||
'showrewardnews' => true,
|
||||
'isreturner' => true,
|
||||
'fpstracking' => false,
|
||||
'optiontracking' => false,
|
||||
'tournamentticketpurchasestate' => 0,
|
||||
'emailcoderequest' => false
|
||||
];
|
||||
die(json_encode(compact('session', 'playdata')));
|
||||
|
||||
default:
|
||||
sendError("Unrecognized event {$action}.");
|
||||
break;
|
||||
}
|
||||
|
||||
function create_char($player, $highestLevelId) {
|
||||
global $config;
|
||||
return [
|
||||
'worldid' => 0,
|
||||
'name' => $player['name'],
|
||||
'ismale' => intval($player['sex']) === 1,
|
||||
'tutorial' => isset($player['istutorial']) && $player['istutorial'],
|
||||
'level' => intval($player['level']),
|
||||
'vocation' => $config['vocations'][$player['vocation']],
|
||||
'outfitid' => intval($player['looktype']),
|
||||
'headcolor' => intval($player['lookhead']),
|
||||
'torsocolor' => intval($player['lookbody']),
|
||||
'legscolor' => intval($player['looklegs']),
|
||||
'detailcolor' => intval($player['lookfeet']),
|
||||
'addonsflags' => intval($player['lookaddons']),
|
||||
'ishidden' => isset($player['deletion']) && (int)$player['deletion'] === 1,
|
||||
'istournamentparticipant' => false,
|
||||
'ismaincharacter' => $highestLevelId == $player['id'],
|
||||
'dailyrewardstate' => isset($player['isreward']) ? intval($player['isreward']) : 0,
|
||||
'remainingdailytournamentplaytime' => 0
|
||||
];
|
||||
}
|
@ -462,7 +462,7 @@ function tickers()
|
||||
*/
|
||||
function template_place_holder($type)
|
||||
{
|
||||
global $template_place_holders;
|
||||
global $twig, $template_place_holders;
|
||||
$ret = '';
|
||||
|
||||
if(array_key_exists($type, $template_place_holders) && is_array($template_place_holders[$type]))
|
||||
@ -471,6 +471,9 @@ function template_place_holder($type)
|
||||
if($type === 'head_start') {
|
||||
$ret .= template_header();
|
||||
}
|
||||
elseif ($type === 'body_start') {
|
||||
$ret .= $twig->render('browsehappy.html.twig');
|
||||
}
|
||||
elseif($type === 'body_end') {
|
||||
$ret .= template_ga_code();
|
||||
}
|
||||
|
@ -12,27 +12,44 @@
|
||||
class CreateCharacter
|
||||
{
|
||||
/**
|
||||
* @param string $name
|
||||
* @param int $sex
|
||||
* @param int $vocation
|
||||
* @param int $town
|
||||
* @param array $errors
|
||||
* @param $name
|
||||
* @param $errors
|
||||
* @return bool
|
||||
*/
|
||||
public function check($name, $sex, &$vocation, &$town, &$errors) {
|
||||
public function checkName($name, &$errors)
|
||||
{
|
||||
$minLength = config('character_name_min_length');
|
||||
$maxLength = config('character_name_max_length');
|
||||
|
||||
if(empty($name))
|
||||
if(empty($name)) {
|
||||
$errors['name'] = 'Please enter a name for your character!';
|
||||
else if(strlen($name) > $maxLength)
|
||||
$errors['name'] = 'Name is too long. Max. length <b>'.$maxLength.'</b> letters.';
|
||||
else if(strlen($name) < $minLength)
|
||||
$errors['name'] = 'Name is too short. Min. length <b>'.$minLength.'</b> letters.';
|
||||
else {
|
||||
if(!admin() && !Validator::newCharacterName($name)) {
|
||||
$errors['name'] = Validator::getLastError();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if(strlen($name) > $maxLength) {
|
||||
$errors['name'] = 'Name is too long. Max. length <b>' . $maxLength . '</b> letters.';
|
||||
return false;
|
||||
}
|
||||
|
||||
if(strlen($name) < $minLength) {
|
||||
$errors['name'] = 'Name is too short. Min. length <b>' . $minLength . '</b> letters.';
|
||||
return false;
|
||||
}
|
||||
|
||||
$name_length = strlen($name);
|
||||
if(strspn($name, "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM- '") != $name_length) {
|
||||
$errors['name'] = 'This name contains invalid letters, words or format. Please use only a-Z, - , \' and space.';
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!preg_match("/[A-z ']/", $name)) {
|
||||
$errors['name'] = 'Your name contains illegal characters.';
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!admin() && !Validator::newCharacterName($name)) {
|
||||
$errors['name'] = Validator::getLastError();
|
||||
return false;
|
||||
}
|
||||
|
||||
$player = new OTS_Player();
|
||||
@ -42,20 +59,38 @@ class CreateCharacter
|
||||
return false;
|
||||
}
|
||||
|
||||
if(empty($sex) && $sex != "0")
|
||||
return empty($errors);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param int $sex
|
||||
* @param int $vocation
|
||||
* @param int $town
|
||||
* @param array $errors
|
||||
* @return bool
|
||||
*/
|
||||
public function check($name, $sex, &$vocation, &$town, &$errors)
|
||||
{
|
||||
$this->checkName($name, $errors);
|
||||
|
||||
if(empty($sex) && $sex != "0") {
|
||||
$errors['sex'] = 'Please select the sex for your character!';
|
||||
}
|
||||
|
||||
if(count(config('character_samples')) > 1)
|
||||
{
|
||||
if(!isset($vocation))
|
||||
$errors['vocation'] = 'Please select a vocation for your character.';
|
||||
}
|
||||
else
|
||||
else {
|
||||
$vocation = config('character_samples')[0];
|
||||
}
|
||||
|
||||
if(count(config('character_towns')) > 1) {
|
||||
if(!isset($town))
|
||||
if(!isset($town)) {
|
||||
$errors['town'] = 'Please select a town for your character.';
|
||||
}
|
||||
}
|
||||
else {
|
||||
$town = config('character_towns')[0];
|
||||
|
@ -83,10 +83,10 @@ abstract class OTS_Base_DB extends PDO implements IOTS_DB
|
||||
$startTime = microtime(true);
|
||||
}
|
||||
|
||||
$ret = parent::query(...$args);;
|
||||
$ret = parent::query(...$args);
|
||||
if($this->logged) {
|
||||
$totalTime = microtime(true) - $startTime;
|
||||
$this->log .= round($totalTime, 4) . ' ms - ' . $query . PHP_EOL;
|
||||
$this->log .= round($totalTime, 4) . ' ms - ' . $args[0] . PHP_EOL;
|
||||
}
|
||||
|
||||
return $ret;
|
||||
|
285
system/libs/rfc6238.php
Normal file
285
system/libs/rfc6238.php
Normal file
@ -0,0 +1,285 @@
|
||||
<?php
|
||||
/** https://github.com/Voronenko/PHPOTP/blob/08cda9cb9c30b7242cf0b3a9100a6244a2874927/code/base32static.php
|
||||
* Encode in Base32 based on RFC 4648.
|
||||
* Requires 20% more space than base64
|
||||
* Great for case-insensitive filesystems like Windows and URL's (except for = char which can be excluded using the pad option for urls)
|
||||
*
|
||||
* @package default
|
||||
* @author Bryan Ruiz
|
||||
**/
|
||||
class Base32Static {
|
||||
|
||||
private static $map = array(
|
||||
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', // 7
|
||||
'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', // 15
|
||||
'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', // 23
|
||||
'Y', 'Z', '2', '3', '4', '5', '6', '7', // 31
|
||||
'=' // padding character
|
||||
);
|
||||
|
||||
private static $flippedMap = array(
|
||||
'A'=>'0', 'B'=>'1', 'C'=>'2', 'D'=>'3', 'E'=>'4', 'F'=>'5', 'G'=>'6', 'H'=>'7',
|
||||
'I'=>'8', 'J'=>'9', 'K'=>'10', 'L'=>'11', 'M'=>'12', 'N'=>'13', 'O'=>'14', 'P'=>'15',
|
||||
'Q'=>'16', 'R'=>'17', 'S'=>'18', 'T'=>'19', 'U'=>'20', 'V'=>'21', 'W'=>'22', 'X'=>'23',
|
||||
'Y'=>'24', 'Z'=>'25', '2'=>'26', '3'=>'27', '4'=>'28', '5'=>'29', '6'=>'30', '7'=>'31'
|
||||
);
|
||||
|
||||
/**
|
||||
* Use padding false when encoding for urls
|
||||
*
|
||||
* @return base32 encoded string
|
||||
* @author Bryan Ruiz
|
||||
**/
|
||||
public static function encode($input, $padding = true) {
|
||||
if(empty($input)) return "";
|
||||
|
||||
$input = str_split($input);
|
||||
$binaryString = "";
|
||||
|
||||
for($i = 0; $i < count($input); $i++) {
|
||||
$binaryString .= str_pad(base_convert(ord($input[$i]), 10, 2), 8, '0', STR_PAD_LEFT);
|
||||
}
|
||||
|
||||
$fiveBitBinaryArray = str_split($binaryString, 5);
|
||||
$base32 = "";
|
||||
$i=0;
|
||||
|
||||
while($i < count($fiveBitBinaryArray)) {
|
||||
$base32 .= self::$map[base_convert(str_pad($fiveBitBinaryArray[$i], 5,'0'), 2, 10)];
|
||||
$i++;
|
||||
}
|
||||
|
||||
if($padding && ($x = strlen($binaryString) % 40) != 0) {
|
||||
if($x == 8) $base32 .= str_repeat(self::$map[32], 6);
|
||||
else if($x == 16) $base32 .= str_repeat(self::$map[32], 4);
|
||||
else if($x == 24) $base32 .= str_repeat(self::$map[32], 3);
|
||||
else if($x == 32) $base32 .= self::$map[32];
|
||||
}
|
||||
|
||||
return $base32;
|
||||
}
|
||||
|
||||
public static function decode($input) {
|
||||
if(empty($input)) return;
|
||||
|
||||
$paddingCharCount = substr_count($input, self::$map[32]);
|
||||
$allowedValues = array(6,4,3,1,0);
|
||||
|
||||
if(!in_array($paddingCharCount, $allowedValues)) return false;
|
||||
|
||||
for($i=0; $i<4; $i++){
|
||||
if($paddingCharCount == $allowedValues[$i] &&
|
||||
substr($input, -($allowedValues[$i])) != str_repeat(self::$map[32], $allowedValues[$i])) return false;
|
||||
}
|
||||
|
||||
$input = str_replace('=','', $input);
|
||||
$input = str_split($input);
|
||||
$binaryString = "";
|
||||
|
||||
for($i=0; $i < count($input); $i = $i+8) {
|
||||
$x = "";
|
||||
|
||||
if(!in_array($input[$i], self::$map)) return false;
|
||||
|
||||
for($j=0; $j < 8; $j++) {
|
||||
$x .= str_pad(base_convert(@self::$flippedMap[@$input[$i + $j]], 10, 2), 5, '0', STR_PAD_LEFT);
|
||||
}
|
||||
|
||||
$eightBits = str_split($x, 8);
|
||||
|
||||
for($z = 0; $z < count($eightBits); $z++) {
|
||||
$binaryString .= ( ($y = chr(base_convert($eightBits[$z], 2, 10))) || ord($y) == 48 ) ? $y:"";
|
||||
}
|
||||
}
|
||||
|
||||
return $binaryString;
|
||||
}
|
||||
}
|
||||
|
||||
// http://www.faqs.org/rfcs/rfc6238.html
|
||||
// https://github.com/Voronenko/PHPOTP/blob/08cda9cb9c30b7242cf0b3a9100a6244a2874927/code/rfc6238.php
|
||||
// Local changes: http -> https, consistent indentation, 200x200 -> 300x300 QR image size, PHP end tag
|
||||
class TokenAuth6238 {
|
||||
|
||||
/**
|
||||
* verify
|
||||
*
|
||||
* @param string $secretkey Secret clue (base 32).
|
||||
* @return bool True if success, false if failure
|
||||
*/
|
||||
public static function verify($secretkey, $code, $rangein30s = 3) {
|
||||
$key = base32static::decode($secretkey);
|
||||
$unixtimestamp = time()/30;
|
||||
|
||||
for($i=-($rangein30s); $i<=$rangein30s; $i++) {
|
||||
$checktime = (int)($unixtimestamp+$i);
|
||||
$thiskey = self::oath_hotp($key, $checktime);
|
||||
|
||||
if ((int)$code == self::oath_truncate($thiskey,6)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public static function getTokenCode($secretkey,$rangein30s = 3) {
|
||||
$result = "";
|
||||
$key = base32static::decode($secretkey);
|
||||
$unixtimestamp = time()/30;
|
||||
|
||||
for($i=-($rangein30s); $i<=$rangein30s; $i++) {
|
||||
$checktime = (int)($unixtimestamp+$i);
|
||||
$thiskey = self::oath_hotp($key, $checktime);
|
||||
$result = $result." # ".self::oath_truncate($thiskey,6);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public static function getTokenCodeDebug($secretkey,$rangein30s = 3) {
|
||||
$result = "";
|
||||
print "<br/>SecretKey: $secretkey <br/>";
|
||||
|
||||
$key = base32static::decode($secretkey);
|
||||
print "Key(base 32 decode): $key <br/>";
|
||||
|
||||
$unixtimestamp = time()/30;
|
||||
print "UnixTimeStamp (time()/30): $unixtimestamp <br/>";
|
||||
|
||||
for($i=-($rangein30s); $i<=$rangein30s; $i++) {
|
||||
$checktime = (int)($unixtimestamp+$i);
|
||||
print "Calculating oath_hotp from (int)(unixtimestamp +- 30sec offset): $checktime basing on secret key<br/>";
|
||||
|
||||
$thiskey = self::oath_hotp($key, $checktime, true);
|
||||
print "======================================================<br/>";
|
||||
print "CheckTime: $checktime oath_hotp:".$thiskey."<br/>";
|
||||
|
||||
$result = $result." # ".self::oath_truncate($thiskey,6,true);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public static function getBarCodeUrl($username, $domain, $secretkey, $issuer) {
|
||||
$url = "https://chart.apis.google.com/chart";
|
||||
$url = $url."?chs=300x300&chld=M|0&cht=qr&chl=otpauth://totp/";
|
||||
$url = $url.$username . "@" . $domain . "%3Fsecret%3D" . $secretkey . '%26issuer%3D' . rawurlencode($issuer);
|
||||
return $url;
|
||||
}
|
||||
|
||||
public static function generateRandomClue($length = 16) {
|
||||
$b32 = "234567QWERTYUIOPASDFGHJKLZXCVBNM";
|
||||
$s = "";
|
||||
|
||||
for ($i = 0; $i < $length; $i++)
|
||||
$s .= $b32[rand(0,31)];
|
||||
|
||||
return $s;
|
||||
}
|
||||
|
||||
private static function hotp_tobytestream($key) {
|
||||
$result = array();
|
||||
$last = strlen($key);
|
||||
for ($i = 0; $i < $last; $i = $i + 2) {
|
||||
$x = $key[$i] + $key[$i + 1];
|
||||
$x = strtoupper($x);
|
||||
$x = hexdec($x);
|
||||
$result = $result.chr($x);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
private static function oath_hotp ($key, $counter, $debug=false) {
|
||||
$result = "";
|
||||
$orgcounter = $counter;
|
||||
$cur_counter = array(0,0,0,0,0,0,0,0);
|
||||
|
||||
if ($debug) {
|
||||
print "Packing counter $counter (".dechex($counter).")into binary string - pay attention to hex representation of key and binary representation<br/>";
|
||||
}
|
||||
|
||||
for($i=7;$i>=0;$i--) { // C for unsigned char, * for repeating to the end of the input data
|
||||
$cur_counter[$i] = pack ('C*', $counter);
|
||||
|
||||
if ($debug) {
|
||||
print $cur_counter[$i]."(".dechex(ord($cur_counter[$i])).")"." from $counter <br/>";
|
||||
}
|
||||
|
||||
$counter = $counter >> 8;
|
||||
}
|
||||
|
||||
if ($debug) {
|
||||
foreach ($cur_counter as $char) {
|
||||
print ord($char) . " ";
|
||||
}
|
||||
|
||||
print "<br/>";
|
||||
}
|
||||
|
||||
$binary = implode($cur_counter);
|
||||
|
||||
// Pad to 8 characters
|
||||
str_pad($binary, 8, chr(0), STR_PAD_LEFT);
|
||||
|
||||
if ($debug) {
|
||||
print "Prior to HMAC calculation pad with zero on the left until 8 characters.<br/>";
|
||||
print "Calculate sha1 HMAC(Hash-based Message Authentication Code http://en.wikipedia.org/wiki/HMAC).<br/>";
|
||||
print "hash_hmac ('sha1', $binary, $key)<br/>";
|
||||
}
|
||||
|
||||
$result = hash_hmac ('sha1', $binary, $key);
|
||||
|
||||
if ($debug) {
|
||||
print "Result: $result <br/>";
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
private static function oath_truncate($hash, $length = 6, $debug=false) {
|
||||
$result="";
|
||||
|
||||
// Convert to dec
|
||||
if($debug) {
|
||||
print "converting hex hash into characters<br/>";
|
||||
}
|
||||
|
||||
$hashcharacters = str_split($hash,2);
|
||||
|
||||
if($debug) {
|
||||
print_r($hashcharacters);
|
||||
print "<br/>and convert to decimals:<br/>";
|
||||
}
|
||||
|
||||
for ($j=0; $j<count($hashcharacters); $j++) {
|
||||
$hmac_result[]=hexdec($hashcharacters[$j]);
|
||||
}
|
||||
|
||||
if($debug) {
|
||||
print_r($hmac_result);
|
||||
}
|
||||
|
||||
// http://php.net/manual/ru/function.hash-hmac.php
|
||||
// adopted from brent at thebrent dot net 21-May-2009 08:17 comment
|
||||
|
||||
$offset = $hmac_result[19] & 0xf;
|
||||
|
||||
if($debug) {
|
||||
print "Calculating offset as 19th element of hmac:".$hmac_result[19]."<br/>";
|
||||
print "offset:".$offset;
|
||||
}
|
||||
|
||||
$result = (
|
||||
(($hmac_result[$offset+0] & 0x7f) << 24 ) |
|
||||
(($hmac_result[$offset+1] & 0xff) << 16 ) |
|
||||
(($hmac_result[$offset+2] & 0xff) << 8 ) |
|
||||
($hmac_result[$offset+3] & 0xff)
|
||||
) % pow(10,$length);
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
?>
|
@ -354,16 +354,6 @@ class Validator
|
||||
}
|
||||
}
|
||||
|
||||
if(strspn($name, "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM- '") != $name_length) {
|
||||
self::$lastError = 'This name contains invalid letters, words or format. Please use only a-Z, - , \' and space.';
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!preg_match("/[A-z ']/", $name)) {
|
||||
self::$lastError = 'Your name containst illegal characters.';
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -41,6 +41,7 @@ $locale['step_requirements_extension'] = '$EXTENSION$ PHP extension';
|
||||
$locale['step_requirements_warning_images_guilds'] = 'Guild logo upload will not work';
|
||||
$locale['step_requirements_warning_images_gallery'] = 'Gallery image upload will not work';
|
||||
$locale['step_requirements_warning_player_signatures'] = 'Player Signatures will not work';
|
||||
$locale['step_requirements_warning_install_plugins'] = 'It will be not possible to install plugins';
|
||||
|
||||
// config
|
||||
$locale['step_config'] = 'Configuration';
|
||||
|
@ -41,6 +41,7 @@ $locale['step_requirements_extension'] = 'Rozszerzenie PHP - $EXTENSION$';
|
||||
$locale['step_requirements_warning_images_guilds'] = 'Nie będzie możliwości uploadu obrazków gildii';
|
||||
$locale['step_requirements_warning_images_gallery'] = 'Nie będzie możliwości uploadu obrazków do galerii';
|
||||
$locale['step_requirements_warning_player_signatures'] = 'Sygnatury graczy nie będą działać';
|
||||
$locale['step_requirements_warning_install_plugins'] = 'Nie będzie można instalować rozszerzeń';
|
||||
|
||||
// config
|
||||
$locale['step_config'] = 'Konfiguracja';
|
||||
|
@ -52,6 +52,29 @@ else
|
||||
$old_name = $player->getName();
|
||||
$player->setName($name);
|
||||
$player->save();
|
||||
|
||||
if ($db->hasTable('player_deaths') &&
|
||||
$db->hasColumn('player_deaths', 'mostdamage_is_player') &&
|
||||
$db->hasColumn('player_deaths', 'killed_by')) {
|
||||
|
||||
$namesToChange = $db->query('SELECT `player_id`, `time`, `is_player`, `killed_by`, `mostdamage_is_player`, `mostdamage_by` FROM `player_deaths` WHERE (`is_player` = 1 AND `killed_by` = ' . $db->quote($old_name) . ') OR (`mostdamage_is_player` = 1 AND `mostdamage_by` = ' . $db->quote($old_name) . ');');
|
||||
|
||||
if ($namesToChange->rowCount() > 0) {
|
||||
foreach ($namesToChange->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$changeKey = '';
|
||||
if ($row['is_player'] == '1' && $row['killed_by'] == $old_name) {
|
||||
$changeKey = 'killed_by';
|
||||
} else if ($row['mostdamage_is_player'] == '1' && $row['mostdamage_by'] == $old_name) {
|
||||
$changeKey = 'mostdamage_by';
|
||||
}
|
||||
|
||||
if (!empty($changeKey)) {
|
||||
$db->update('player_deaths', [$changeKey => $name], ['player_id' => $row['player_id'], 'time' => $row['time']]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$account_logged->setCustomField("premium_points", $points - $config['account_change_character_name_points']);
|
||||
$account_logged->logAction('Changed name from <b>' . $old_name . '</b> to <b>' . $player->getName() . '</b>.');
|
||||
$twig->display('success.html.twig', array(
|
||||
@ -83,4 +106,4 @@ else
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
@ -86,7 +86,7 @@ if($guild_vice)
|
||||
else
|
||||
{
|
||||
$player_in_guild = false;
|
||||
if($guild->getName() === $player_to_change->getRank()->getGuild()->getName() || $guild_leader)
|
||||
if($guild->getName() === $player_to_change->getRank()->getGuild()->getName())
|
||||
{
|
||||
$player_in_guild = true;
|
||||
$player_has_lower_rank = false;
|
||||
|
0
system/php_sessions/index.html
Normal file
0
system/php_sessions/index.html
Normal file
123
system/templates/admin-bar.html.twig
Normal file
123
system/templates/admin-bar.html.twig
Normal file
@ -0,0 +1,123 @@
|
||||
<style>
|
||||
html { margin-top: 32px !important; }
|
||||
* html body { margin-top: 32px !important; }
|
||||
|
||||
#ma-admin-bar {
|
||||
direction: ltr;
|
||||
color: #ccc;
|
||||
font-size: 13px;
|
||||
font-weight: 400;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
|
||||
line-height: 2.46153846;
|
||||
height: 32px;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
min-width: 600px;
|
||||
z-index: 99999;
|
||||
background: #23282d;
|
||||
}
|
||||
|
||||
#ma-admin-bar a.ab-item {
|
||||
color: #eee;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
#ma-admin-bar ul, #ma-admin-bar ul li {
|
||||
background: 0 0;
|
||||
clear: none;
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0 15px 0 0;
|
||||
position: relative;
|
||||
text-indent: 0;
|
||||
z-index: 99999;
|
||||
}
|
||||
|
||||
#ma-admin-bar li {
|
||||
float: left;
|
||||
}
|
||||
|
||||
#ma-admin-bar li:hover {
|
||||
color: lightskyblue;
|
||||
}
|
||||
|
||||
#ma-admin-bar .ab-top-secondary>li {
|
||||
float: right;
|
||||
margin-right: 15px;
|
||||
}
|
||||
|
||||
.dropdown {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.dropdown-content {
|
||||
display: none;
|
||||
position: absolute;
|
||||
background-color: #343a40;
|
||||
box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2);
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.dropdown-content a {
|
||||
color: #eee;
|
||||
padding: 12px 16px;
|
||||
text-decoration: none;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.dropdown-content a:hover {color: lightskyblue;}
|
||||
|
||||
.dropdown:hover .dropdown-content {display: block;}
|
||||
|
||||
</style>
|
||||
|
||||
<div id="ma-admin-bar">
|
||||
<ul>
|
||||
<li class="dropdown">
|
||||
<a href="{{ constant('ADMIN_URL') }}" class="ab-item">
|
||||
<img alt="MyAAC" src="{{ constant('ADMIN_URL') }}images/logo.png" class="brand-image img-circle elevation-3" style="opacity: .8; height: 26px; width: 26px">
|
||||
<span class="brand-text">
|
||||
<b>My</b>AAC
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-house-door" viewBox="0 0 16 16">
|
||||
<path d="M8.354 1.146a.5.5 0 0 0-.708 0l-6 6A.5.5 0 0 0 1.5 7.5v7a.5.5 0 0 0 .5.5h4.5a.5.5 0 0 0 .5-.5v-4h2v4a.5.5 0 0 0 .5.5H14a.5.5 0 0 0 .5-.5v-7a.5.5 0 0 0-.146-.354L13 5.793V2.5a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 0-.5.5v1.293L8.354 1.146zM2.5 14V7.707l5.5-5.5 5.5 5.5V14H10v-4a.5.5 0 0 0-.5-.5h-3a.5.5 0 0 0-.5.5v4H2.5z"></path>
|
||||
</svg>
|
||||
<a class="ab-item" href="#"><i class="bi bi-house"></i>{{ config.lua.serverName }}</a>
|
||||
<div class="dropdown-content">
|
||||
<a href="{{ getLink('') }}">Visit Site</a>
|
||||
</div>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
<a class="ab-item" href="#"><i class="bi bi-house"></i>New</a>
|
||||
<div class="dropdown-content">
|
||||
<a href="{{ constant('ADMIN_URL') }}?p=news&action=new">News</a>
|
||||
<a href="{{ constant('ADMIN_URL') }}?p=pages&action=new">Page</a>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<a class="ab-item" href="{{ constant('ADMIN_URL') }}?p=plugins">
|
||||
Plugins
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="ab-item" href="{{ constant('ADMIN_URL') }}?p=dashboard&clear_cache">
|
||||
Clear Cache
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="ab-top-secondary">
|
||||
<li class="dropdown">
|
||||
<a class="ab-item" href="#">Hello, {{ username }}</a>
|
||||
<div class="dropdown-content">
|
||||
<a href="{{ getLink('account/manage') }}">Manage Account</a>
|
||||
<a href="{{ constant('ADMIN_URL') }}?action=logout">Logout</a>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
@ -104,7 +104,7 @@
|
||||
|
||||
$('#select-type').change(function () {
|
||||
var value = $('#select-type').val();
|
||||
if (value == {{ constant('ARTICLE') }}) {
|
||||
if (value === {{ constant('ARTICLE') }}) {
|
||||
$('#article-text').show();
|
||||
$('#article-image').show();
|
||||
} else {
|
||||
@ -118,8 +118,8 @@
|
||||
|
||||
<script type="text/javascript" src="{{ constant('BASE_URL') }}tools/tinymce/tinymce.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
var unsaved = false;
|
||||
var lastContent = '';
|
||||
let unsaved = false;
|
||||
let lastContent = '';
|
||||
|
||||
tinymce.init({
|
||||
selector: "#body",
|
||||
@ -129,7 +129,7 @@
|
||||
image_advtab: true,
|
||||
setup: function (ed) {
|
||||
ed.on('NodeChange', function (e) {
|
||||
if (ed.getContent() != lastContent) {
|
||||
if (ed.getContent() !== lastContent) {
|
||||
unsaved = true;
|
||||
}
|
||||
});
|
||||
|
3
system/templates/browsehappy.html.twig
Normal file
3
system/templates/browsehappy.html.twig
Normal file
@ -0,0 +1,3 @@
|
||||
<!--[if lt IE 7]>
|
||||
<p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
|
||||
<![endif]-->
|
@ -133,7 +133,7 @@
|
||||
{% include('buttons.base.html.twig') %}
|
||||
</form>
|
||||
{% else %}
|
||||
<b>Before you can create guild you must login.</b>
|
||||
<b>Before you can create a guild you must login.</b>
|
||||
<br/>
|
||||
<form action="?subtopic=accountmanagement&redirect={{ getLink('guilds') }}" method="post">
|
||||
{% include('buttons.login.html.twig') %}
|
||||
|
@ -3,7 +3,30 @@
|
||||
<td style="width: 17px"></td>
|
||||
<td>
|
||||
<div style="text-align:center"><h2>Ranking for {{ skillName }}{% if vocation is not null %} ({{ vocation }}){% endif %} on {{ config.lua.serverName }}</h2></div><br/>
|
||||
<table border="0" cellpadding="4" cellspacing="1" width="100%"></table>
|
||||
<table border="0" cellpadding="4" cellspacing="1" width="100%">
|
||||
<tr>
|
||||
<td>Filters</td>
|
||||
<td>
|
||||
<label for="vocationFilter">Choose a Skill</label>
|
||||
<select onchange="location = this.value;" aria-label="skillFilter" id="skillFilter">
|
||||
{% set i = 0 %}
|
||||
{% for link, name in types %}
|
||||
<option value="{{ getLink('highscores') }}/{{ link }}{% if vocation is defined %}/{{ vocation }}{% endif %}" class="size_xs">{{ name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<label for="vocationFilter">Choose a vocation</label>
|
||||
<select onchange="location = this.value;" aria-label="vocationFilter" id="vocationFilter">
|
||||
<option value="{{ getLink('highscores') }}/{{ list }}" class="size_xs">[ALL]</option>
|
||||
{% set i = 0 %}
|
||||
{% for i in 1..config.vocations_amount %}
|
||||
<option value="{{ getLink('highscores') }}/{{ list }}/{{ config.vocations[i]|lower }}" class="size_xs">{{ config.vocations[i]}}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table border="0" cellpadding="4" cellspacing="1" width="100%">
|
||||
<tr bgcolor="{{ config.vdarkborder }}">
|
||||
{% if config.account_country %}
|
||||
|
@ -3,7 +3,7 @@
|
||||
<img src="{{ constant('BASE_URL') }}images/news/icon_{{ icon }}.gif" class="NewsHeadlineIcon" />
|
||||
<div class="NewsHeadlineDate">{{ date|date(config.news_date_format) }} - </div>
|
||||
<div class="NewsHeadlineText">{{ title }}</div>
|
||||
{% if author is not empty %}
|
||||
{% if config.news_author and author is not empty %}
|
||||
<div class="NewsHeadlineAuthor"><b>Author: </b><i>{{ author }}</i></div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
24
system/templates/tables.headline.html.twig
Normal file
24
system/templates/tables.headline.html.twig
Normal file
@ -0,0 +1,24 @@
|
||||
<div class="TableContainer">
|
||||
<div class="CaptionContainer">
|
||||
<div class="CaptionInnerContainer">
|
||||
<span class="CaptionEdgeLeftTop" style="background-image:url({{ template_path }}/images/content/box-frame-edge.gif);"></span>
|
||||
<span class="CaptionEdgeRightTop" style="background-image:url({{ template_path }}/images/content/box-frame-edge.gif);"></span>
|
||||
<span class="CaptionBorderTop" style="background-image:url({{ template_path }}/images/content/table-headline-border.gif);"></span>
|
||||
<span class="CaptionVerticalLeft" style="background-image:url({{ template_path }}/images/content/box-frame-vertical.gif);"></span>
|
||||
<div class="Text" >{{ title|raw }}</div>
|
||||
<span class="CaptionVerticalRight" style="background-image:url({{ template_path }}/images/content/box-frame-vertical.gif);"></span>
|
||||
<span class="CaptionBorderBottom" style="background-image:url({{ template_path }}/images/content/table-headline-border.gif);"></span>
|
||||
<span class="CaptionEdgeLeftBottom" style="background-image:url({{ template_path }}/images/content/box-frame-edge.gif);"></span>
|
||||
<span class="CaptionEdgeRightBottom" style="background-image:url({{ template_path }}/images/content/box-frame-edge.gif);"></span>
|
||||
</div>
|
||||
</div>
|
||||
<table class="Table1" cellpadding="0" cellspacing="0" style="background-color: {{ config.lightborder }}">
|
||||
<tr>
|
||||
<td>
|
||||
<div class="InnerTableContainer">
|
||||
{{ content|raw }}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
@ -1,19 +1,18 @@
|
||||
<div class="TableContainer">
|
||||
<table class="Table1" cellpadding="0" cellspacing="0" style="background-color: {{ config.lightborder }}">
|
||||
<div class="CaptionContainer">
|
||||
<div class="CaptionInnerContainer">
|
||||
<span class="CaptionEdgeLeftTop" style="background-image:url({{ template_path }}/images/content/box-frame-edge.gif);"></span>
|
||||
<span class="CaptionEdgeRightTop" style="background-image:url({{ template_path }}/images/content/box-frame-edge.gif);"></span>
|
||||
<span class="CaptionBorderTop" style="background-image:url({{ template_path }}/images/content/table-headline-border.gif);"></span>
|
||||
<span class="CaptionVerticalLeft" style="background-image:url({{ template_path }}/images/content/box-frame-vertical.gif);"></span>
|
||||
<div class="Text" >Support in game</div>
|
||||
<span class="CaptionVerticalRight" style="background-image:url({{ template_path }}/images/content/box-frame-vertical.gif);"></span>
|
||||
<span class="CaptionBorderBottom" style="background-image:url({{ template_path }}/images/content/table-headline-border.gif);"></span>
|
||||
<span class="CaptionEdgeLeftBottom" style="background-image:url({{ template_path }}/images/content/box-frame-edge.gif);"></span>
|
||||
<span class="CaptionEdgeRightBottom" style="background-image:url({{ template_path }}/images/content/box-frame-edge.gif);"></span>
|
||||
</div>
|
||||
<div class="CaptionContainer">
|
||||
<div class="CaptionInnerContainer">
|
||||
<span class="CaptionEdgeLeftTop" style="background-image:url({{ template_path }}/images/content/box-frame-edge.gif);"></span>
|
||||
<span class="CaptionEdgeRightTop" style="background-image:url({{ template_path }}/images/content/box-frame-edge.gif);"></span>
|
||||
<span class="CaptionBorderTop" style="background-image:url({{ template_path }}/images/content/table-headline-border.gif);"></span>
|
||||
<span class="CaptionVerticalLeft" style="background-image:url({{ template_path }}/images/content/box-frame-vertical.gif);"></span>
|
||||
<div class="Text" >Support in game</div>
|
||||
<span class="CaptionVerticalRight" style="background-image:url({{ template_path }}/images/content/box-frame-vertical.gif);"></span>
|
||||
<span class="CaptionBorderBottom" style="background-image:url({{ template_path }}/images/content/table-headline-border.gif);"></span>
|
||||
<span class="CaptionEdgeLeftBottom" style="background-image:url({{ template_path }}/images/content/box-frame-edge.gif);"></span>
|
||||
<span class="CaptionEdgeRightBottom" style="background-image:url({{ template_path }}/images/content/box-frame-edge.gif);"></span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<table class="Table1" cellpadding="0" cellspacing="0" style="background-color: {{ config.lightborder }}">
|
||||
<tr>
|
||||
<td>
|
||||
<div class="InnerTableContainer">
|
||||
@ -60,7 +59,7 @@
|
||||
{% for member in group.members|reverse %}
|
||||
{% set i = i + 1 %}
|
||||
<tr bgcolor="{{ getStyle(i) }}" style="height: 32px;">
|
||||
<td>{{ group.group_name }}</td>
|
||||
<td>{{ group.group_name|capitalize }}</td>
|
||||
|
||||
{% if config.team_display_outfit %}
|
||||
<td>
|
||||
@ -104,7 +103,7 @@
|
||||
{% elseif config.team_style == 2 %}
|
||||
{% for group in groupmember|reverse %}
|
||||
{% if group.members is not empty %}
|
||||
<div style="text-align:center"><h2>{{ group.group_name }}</h2></div>
|
||||
<div style="text-align:center"><h2>{{ group.group_name|capitalize }}</h2></div>
|
||||
|
||||
<table cellspacing="1" cellpadding="4" border="0" width="100%">
|
||||
<tr bgcolor="{{ config.vdarkborder }}">
|
||||
|
@ -1,25 +0,0 @@
|
||||
function getCookie(name)
|
||||
{
|
||||
if (document.cookie.length>0)
|
||||
{
|
||||
c_start=document.cookie.indexOf(name + "=");
|
||||
if (c_start!=-1)
|
||||
{
|
||||
c_start=c_start + name.length+1;
|
||||
c_end=document.cookie.indexOf(";",c_start);
|
||||
if (c_end==-1) c_end=document.cookie.length;
|
||||
|
||||
return unescape(document.cookie.substring(c_start,c_end));
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
function setCookie(name, value, expireDays)
|
||||
{
|
||||
var exdate=new Date();
|
||||
exdate.setDate(exdate.getDate()+expireDays);
|
||||
document.cookie=name+ "=" +escape(value)+
|
||||
((expireDays==null) ? "" : ";expires="+exdate.toGMTString());
|
||||
}
|
@ -29,7 +29,7 @@ function performInstall(url) {
|
||||
}
|
||||
});
|
||||
// On completed
|
||||
ajaxRequest.done(function(data) {
|
||||
ajaxRequest.done(function(/*data*/) {
|
||||
$('#spinner').hide();
|
||||
$('#reload_button').show();
|
||||
});
|
||||
@ -38,4 +38,4 @@ function performInstall(url) {
|
||||
console.log('Error: ', error);
|
||||
$('<span class="error">Error while doing AJAX request. Please refresh the page.</span>').insertAfter("#success-" + lastId);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -66,10 +66,10 @@ else if(isset($_GET['name']))
|
||||
if(!admin() && !Validator::newCharacterName($name))
|
||||
error_(Validator::getLastError());
|
||||
|
||||
$player = new OTS_Player();
|
||||
$player->find($name);
|
||||
if($player->isLoaded()) {
|
||||
error_('Character with this name already exist.');
|
||||
require_once LIBS . 'CreateCharacter.php';
|
||||
$createCharacter = new CreateCharacter();
|
||||
if (!$createCharacter->checkName($name, $errors)) {
|
||||
error_($errors['name']);
|
||||
}
|
||||
|
||||
success_('Good. Your name will be:<br /><b>' . (admin() ? $name : ucwords($name)) . '</b>');
|
||||
|
Loading…
x
Reference in New Issue
Block a user