Skip to content

Commit

Permalink
Merge branch 'phacUFPE/multiworld_system' into feature/status-multiworld
Browse files Browse the repository at this point in the history
  • Loading branch information
elsongabriel authored Sep 10, 2024
2 parents b14b20c + f36ee60 commit f4ad61b
Show file tree
Hide file tree
Showing 11 changed files with 403 additions and 21 deletions.
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
"/^gallery\/{$regexes['number']}\/?$/" => array("subtopic" => "gallery", "image" => "$1"),
"/^gifts\/history\/?$/" => array("subtopic" => "gifts", "action" => "show_history"),
"/^guilds\/{$regexes['special']}$/" => array("subtopic" => "guilds", "action" => "show", "guild" => "$1"),
"/^online\/{$regexes['special']}$/" => array("subtopic" => "online", "world" => "$1"),
"/^worlds\/{$regexes['special']}$/" => array("subtopic" => "worlds", "world" => "$1"),
"/^highscores\/{$regexes['url']}\/{$regexes['special']}\/{$regexes['text']}\/{$regexes['number']}\/?$/" => array("subtopic" => "highscores", "list" => "$1", "world" => "$2", "vocation" => "$3", "page" => "$4"),
"/^highscores\/{$regexes['url']}\/{$regexes['special']}\/{$regexes['number']}\/?$/" => array("subtopic" => "highscores", "list" => "$1", "world" => "$2", "page" => "$3"),
"/^highscores\/{$regexes['url']}\/{$regexes['special']}\/{$regexes['text']}\/?$/" => array("subtopic" => "highscores", "list" => "$1", "world" => "$2", "vocation" => "$3"),
Expand Down
2 changes: 1 addition & 1 deletion install/includes/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VA
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'Report Bug', 'bugtracker', 2, 5);
/* MENU_CATEGORY_COMMUNITY tibiacom */
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'Characters', 'characters', 3, 0);
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'Who Is Online?', 'online', 3, 1);
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'Worlds', 'worlds', 3, 1);
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'Highscores', 'highscores', 3, 2);
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'Last Kills', 'lastkills', 3, 3);
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'Houses', 'houses', 3, 4);
Expand Down
3 changes: 2 additions & 1 deletion system/compat/pages.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
break;

case 'whoisonline':
$page = 'online';
case 'online':
$page = 'worlds';
break;

case 'latestnews':
Expand Down
6 changes: 3 additions & 3 deletions system/migrations/17.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Downloads', 'downloads', 5, 4);
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Report Bug', 'bugtracker', 2, 5);
/* MENU_CATEGORY_COMMUNITY kathrine */
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Who is Online?', 'online', 3, 0);
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Characters', 'characters', 3, 1);
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Characters', 'characters', 3, 0);
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Worlds', 'worlds', 3, 1);
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Guilds', 'guilds', 3, 2);
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Highscores', 'highscores', 3, 3);
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Last Deaths', 'lastkills', 3, 4);
Expand Down Expand Up @@ -63,7 +63,7 @@
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'Report Bug', 'bugtracker', 2, 5);
/* MENU_CATEGORY_COMMUNITY tibiacom */
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'Characters', 'characters', 3, 0);
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'Who Is Online?', 'online', 3, 1);
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'Worlds', 'worlds', 3, 1);
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'Highscores', 'highscores', 3, 2);
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'Last Kills', 'lastkills', 3, 3);
INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'Houses', 'houses', 3, 4);
Expand Down
3 changes: 0 additions & 3 deletions system/pages/lastkills.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,3 @@
'lastkills' => $last_kills,
'world' => $world,
));

//search bar
$twig->display('online.form.html.twig');
14 changes: 3 additions & 11 deletions system/pages/online.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,11 @@
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Who is online?';

if ($w = $_POST['world'] ?? null) {
header("Location: ?online/$w");
}

if ($world = $_GET['world'] ?? null) {
$w_sql = '';
if ($world = $_POST['world'] ?? null) {
$world = $db->query("SELECT * FROM `worlds` WHERE `name` = {$db->quote(urldecode($world))}")->fetch(PDO::FETCH_ASSOC) ?? null;
} else {
$world = count(WORLDS) == 1 ? WORLDS[0] : $world;
$w_sql = $world ? " AND `players`.`world_id` = {$world['id']} " : "";
}
$w_sql = $world ? " AND `players`.`world_id` = {$world['id']} " : "";

if ($config['account_country'])
require SYSTEM . 'countries.conf.php';
Expand Down Expand Up @@ -117,6 +112,3 @@
'world' => $world,
'status' => $world ? $status[$world['id']] : null,
));

//search bar
$twig->display('online.form.html.twig');
31 changes: 31 additions & 0 deletions system/pages/worlds.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php global $db, $config, $twig, $status;
/**
* Online
*
* @package MyAAC
* @author OpenTibiaBR
* @copyright 2024 MyAAC
* @link https://github.com/opentibiabr/myaac
*/
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Worlds';

if ($w = $_POST['world'] ?? null) {
header("Location: ?worlds/$w");
}

if ($world = $_GET['world'] ?? null) {
$world = $db->query("SELECT * FROM `worlds` WHERE `name` = {$db->quote(urldecode($world))}")->fetch(PDO::FETCH_ASSOC) ?? null;
}

$twig->display('worlds.html.twig', [
'_worlds' => $db->query("SELECT * FROM `worlds`")->fetchAll(PDO::FETCH_ASSOC),
'world' => $world,
'overall_maximum' => number_format(0) . ' players (on ' . date('M d Y, H:i:s', time()) . ')',
'status' => $world ? ($status[$world['id']] ?? $status) : null, //todo remove $status in other PR
]);

if ($world) {
// search character
$twig->display('character.search.form.html.twig');
}
File renamed without changes.
Loading

0 comments on commit f4ad61b

Please sign in to comment.