Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge Develop #156

Merged
merged 14 commits into from
Nov 10, 2023
35 changes: 35 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: publish

on: [push]

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
FROM php:7-apache
FROM php:8.1-apache

RUN rm -rf /var/www/html/*
WORKDIR /var/www/html/

# Install Node
RUN apt-get update && apt-get -y install curl gnupg
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash -
RUN curl -sL https://deb.nodesource.com/setup_18.x | bash -
RUN apt-get update && apt-get -y install nodejs

# Install PHP modules
RUN docker-php-ext-install mysqli

# Install Node depdencies
COPY package.json .
COPY package.json .
COPY config.env.php config.php
RUN npm install
# Install PoracleWeb
COPY . .
COPY . .
10 changes: 6 additions & 4 deletions actions/channel_sync.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@
atk, def, sta,
template, min_weight, max_weight, form, max_atk,
max_def, max_sta, gender,
pvp_ranking_worst, pvp_ranking_best,pvp_ranking_min_cp, pvp_ranking_league,
profile_no, min_time, rarity, max_rarity
pvp_ranking_worst, pvp_ranking_best, pvp_ranking_min_cp, pvp_ranking_league, pvp_ranking_cap,
profile_no, min_time, rarity, max_rarity,
size, max_size
)
SELECT REPLACE(id, ?, ? ),
ping, clean, pokemon_id, distance,
Expand All @@ -55,8 +56,9 @@
atk, def, sta,
template, min_weight, max_weight, form, max_atk,
max_def, max_sta, gender,
pvp_ranking_worst, pvp_ranking_best,pvp_ranking_min_cp, pvp_ranking_league,
profile_no, min_time, rarity, max_rarity
pvp_ranking_worst, pvp_ranking_best, pvp_ranking_min_cp, pvp_ranking_league, pvp_ranking_cap,
profile_no, min_time, rarity, max_rarity,
size, max_size
FROM monsters
WHERE id = ?
");
Expand Down
3 changes: 2 additions & 1 deletion discord_auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
error_reporting(E_ALL);

include_once "./config.php";
include_once "include/defaults.php";

define('OAUTH2_CLIENT_ID', $discordBotClientId); //Your client Id
define('OAUTH2_CLIENT_SECRET', $discordBotClientSecret); //Your secret client code
Expand Down Expand Up @@ -67,7 +68,7 @@
{
header("Location: $redirect_url?type=display&page=server_settings");
}
else if ( version_compare($_SESSION['poracleVersion'], @$min_poracle_version) < 0 )
else if ( version_compare($_SESSION['poracleVersion'], $min_poracle_version) < 0 )
{
header("Location: $redirect_url?type=display&page=server_settings");
}
Expand Down
29 changes: 15 additions & 14 deletions docker-compose.example.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
version: '3.1'
services:
poracle-web:
build: ./poracleWeb # folder or subfolder where poracle-web is located
image: ghcr.io/bbdoc/poracleweb:main
container_name: poracle-web
restart: unless-stopped
tty: true
environment:
PORACLE_DB_HOST: poracle-db
PORACLE_DB_DATABASE: poracledb
PORACLE_DB_USERNAME: poracleuser
PORACLE_DB_PASSWORD: dbPassword
PORACLE_DB_PORT: 3306
ADMIN_ID: 123456789123456
REDIRECT_URL: https://poracle.map.com #
DISCORD_BOT_CLIENT_ID: 123456789123456789
DISCORD_BOT_CLIENT_SECRET: abcdefghijklmnopqrstuvwxyz
MAP_URL: https://tiles.map.com/staticmap/poracle-web?img=https://raw.githubusercontent>
MAP_PORACLE_WEB: https://tiles.map.com/staticmap/poracle-web
# for the configuration you can work with environment variables or bind config.php into container
# environment:
# PORACLE_DB_HOST: poracle-db
# PORACLE_DB_DATABASE: poracledb
# PORACLE_DB_USERNAME: poracleuser
# PORACLE_DB_PASSWORD: dbPassword
# PORACLE_DB_PORT: 3306
# ADMIN_ID: 123456789123456
# REDIRECT_URL: https://poracle.map.com #
# DISCORD_BOT_CLIENT_ID: 123456789123456789
# DISCORD_BOT_CLIENT_SECRET: abcdefghijklmnopqrstuvwxyz
# MAP_URL: https://tiles.map.com/staticmap/poracle-web?img=https://raw.githubusercontent>
# MAP_PORACLE_WEB: https://tiles.map.com/staticmap/poracle-web
depends_on:
- poracle-db
- poracle
volumes:
- ./poracle/:/poracle/
# - ./config.php:/var/www/html/config.php
- /etc/localtime:/etc/localtime:ro
ports:
- 127.0.0.1:9060:80
2 changes: 1 addition & 1 deletion include/defaults.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
);

$min_poracle_version = "4.6.2";
$max_pokemon="904";
$max_pokemon="1008";

$other_grunt_types = array(
"7"=>"gold-stop",
Expand Down
16 changes: 15 additions & 1 deletion include/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,18 @@ function get_lure_name($id) {

}

function get_size_name($id) {

if ($id == '1') { $size_name = "XXS"; }
else if ($id == '2') { $size_name = "XS"; }
else if ($id == '3') { $size_name = "M"; }
else if ($id == '4') { $size_name = "XL"; }
else if ($id == '5') { $size_name = "XXL"; }

return $size_name;

}

function get_gym_name($id) {

if ( $id == "0") {
Expand Down Expand Up @@ -356,7 +368,9 @@ function get_gym_color($id) {
function set_locale() {

global $conn;
$_SESSION['locale'] = $_SESSION['server_locale'];
if (isset($_SESSION['server_locale'])) {
$_SESSION['locale'] = $_SESSION['server_locale'];
}

if (isset($_SESSION['id'])) {
include_once "./config.php";
Expand Down
1 change: 1 addition & 0 deletions locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@
"Successfully Connected to Poracle DB":"Connecté à la DB Poracle",
"Unable to Connect to Scanner DB":"Impossible de se connecter à la DB du scanneur",
"Successfully Connected to Scanner DB":"Connecté à la DB du scanneur",
"Please configure Scanner DB":"Veuillez configurer la DB su scanneur",
"Unable to Connect to Poracle API":"Impossible de se connecter à l'API Poracle",
"Successfully Connected to Poracle API":"Connecté à l'API Poracle",
"To activate cache please perform following actions from your PoracleWeb root folder":"Pour l'activer, veuillez lancer les commandes suivantes depuis votre dossier principal",
Expand Down
4 changes: 3 additions & 1 deletion modal/areas_modal.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,15 @@
echo "<div class='accordion' id='accordion'>";

foreach ($areas as $group => $areaList) {
// Check if $group is empty or null, and set the default text accordingly
$buttonText = !empty($group) ? $group : "No group";
$updatedGroup = str_replace(' ', '_', $group);

echo "<div class='card'>
<div class='card-header' id='heading$updatedGroup'>
<h5 class='mb-0'>
<button class='btn btn-link $collapsedState' type='button' data-toggle='collapse' data-target='#collapse$updatedGroup' aria-expanded='false' aria-controls='collapse$updatedGroup'>
$group
$buttonText
</button>
</h5>
</div>
Expand Down
8 changes: 4 additions & 4 deletions modal/distance_show_modal.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@
</div>
<br>

<?php if (@$disable_nominatim <> "True") { ?>
<div class="alert alert-success" role="alert">
<?php echo i8ln("Your Location is set to"); ?><br>
<?php $address=get_address($latitude, $longitude); ?>
<?php echo "<b>".$address."</b><br>"; ?>
<?php if (@$disable_nominatim <> "True") { ?>
<?php $address=get_address($latitude, $longitude); ?>
<?php echo "<b>".$address."</b><br>"; ?>
<?php } ?>
<?php echo "[ ".round($latitude, 4); ?>, <?php echo round($longitude, 4)." ]"; ?>
</div>
<?php } ?>

<div class="alert alert-success" role="alert">
<?php echo i8ln("Configured Distance:"); ?> <br>
Expand Down
2 changes: 1 addition & 1 deletion modal/location_modal.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<div class="alert alert-success" role="alert">
<?php echo i8ln("Your Location is set to"); ?><br>
<?php echo "<b>".$address."</b><br>"; ?>
<?php if (@$disable_nominatim <> "True") { echo "<b>".$address."</b><br>"; } ?>
<?php echo "[ ".round($latitude, 4); ?>, <?php echo round($longitude, 4)." ]"; ?>
</div>

Expand Down
45 changes: 27 additions & 18 deletions pages/display/pokemon.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,14 @@
$result = $conn->query($sql);
while ($row = $result->fetch_assoc()) { $gen7 = $row['count']; }

$sql = $sql_base."AND pokemon_id >= 810";
$sql = $sql_base."AND pokemon_id between 810 and 905";
$result = $conn->query($sql);
while ($row = $result->fetch_assoc()) { $gen8 = $row['count']; }

$sql = $sql_base."AND pokemon_id >= 906";
$result = $conn->query($sql);
while ($row = $result->fetch_assoc()) { $gen9 = $row['count']; }

?>


Expand Down Expand Up @@ -176,7 +180,8 @@ class="btn btn-danger"><?php echo i8ln("DELETE"); ?></a>
if ( @$_GET['gen'] == 5 ) { $gen_selector = "AND pokemon_id between 494 and 649"; }
if ( @$_GET['gen'] == 6 ) { $gen_selector = "AND pokemon_id between 650 and 721"; }
if ( @$_GET['gen'] == 7 ) { $gen_selector = "AND pokemon_id between 722 and 809"; }
if ( @$_GET['gen'] == 8 ) { $gen_selector = "AND pokemon_id >= 810"; }
if ( @$_GET['gen'] == 8 ) { $gen_selector = "AND pokemon_id between 810 and 905"; }
if ( @$_GET['gen'] == 9 ) { $gen_selector = "AND pokemon_id >= 906"; }

?>

Expand All @@ -201,24 +206,26 @@ class="btn btn-danger"><?php echo i8ln("DELETE"); ?></a>
<ul class="pagination justify-content-left ml-1">
<li class="page-item <?php if (@$_GET['gen'] == "all") { echo "active";}; ?>">
<a class="page-link gen-link" href="?type=display&page=pokemon&gen=all">
<center><?php echo i8ln("ALL"); ?><br><small><?php echo $genall; ?></small></center>
<center><small><b><?php echo i8ln("ALL"); ?></b><br><?php echo $genall; ?></small></center>
</a></li>
<li class="page-item <?php if (@$_GET['gen'] == 1) { echo "active";}; ?>">
<a class="page-link gen-link" href="?type=display&page=pokemon&gen=1"><center>G1<br><small><?php echo $gen1; ?></small></center></a></li>
<a class="page-link gen-link" href="?type=display&page=pokemon&gen=1"><center><small><b>G1</b><br><?php echo $gen1; ?></small></center></a></li>
<li class="page-item <?php if (@$_GET['gen'] == 2) { echo "active";}; ?>">
<a class="page-link gen-link" href="?type=display&page=pokemon&gen=2"><center>G2<br><small><?php echo $gen2; ?></small></center></a></li>
<a class="page-link gen-link" href="?type=display&page=pokemon&gen=2"><center><small><b>G2</b><br><?php echo $gen2; ?></small></center></a></li>
<li class="page-item <?php if (@$_GET['gen'] == 3) { echo "active";}; ?>">
<a class="page-link gen-link" href="?type=display&page=pokemon&gen=3"><center>G3<br><small><?php echo $gen3; ?></small></center></a></li>
<a class="page-link gen-link" href="?type=display&page=pokemon&gen=3"><center><small><b>G3</b><br><?php echo $gen3; ?></small></center></a></li>
<li class="page-item <?php if (@$_GET['gen'] == 4) { echo "active";}; ?>">
<a class="page-link gen-link" href="?type=display&page=pokemon&gen=4"><center>G4<br><small><?php echo $gen4; ?></small></center></a></li>
<a class="page-link gen-link" href="?type=display&page=pokemon&gen=4"><center><small><b>G4</b><br><?php echo $gen4; ?></small></center></a></li>
<li class="page-item <?php if (@$_GET['gen'] == 5) { echo "active";}; ?>">
<a class="page-link gen-link" href="?type=display&page=pokemon&gen=5"><center>G5<br><small><?php echo $gen5; ?></small></center></a></li>
<a class="page-link gen-link" href="?type=display&page=pokemon&gen=5"><center><small><b>G5</b><br><?php echo $gen5; ?></small></center></a></li>
<li class="page-item <?php if (@$_GET['gen'] == 6) { echo "active";}; ?>">
<a class="page-link gen-link" href="?type=display&page=pokemon&gen=6"><center>G6<br><small><?php echo $gen6; ?></small></center></a></li>
<a class="page-link gen-link" href="?type=display&page=pokemon&gen=6"><center><small><b>G6</b><br><?php echo $gen6; ?></small></center></a></li>
<li class="page-item <?php if (@$_GET['gen'] == 7) { echo "active";}; ?>">
<a class="page-link gen-link" href="?type=display&page=pokemon&gen=7"><center>G7<br><small><?php echo $gen7; ?></small></center></a></li>
<a class="page-link gen-link" href="?type=display&page=pokemon&gen=7"><center><small><b>G7</b><br><?php echo $gen7; ?></small></center></a></li>
<li class="page-item <?php if (@$_GET['gen'] == 8) { echo "active";}; ?>">
<a class="page-link gen-link" href="?type=display&page=pokemon&gen=8"><center>G8<br><small><?php echo $gen8; ?></small></center></a></li>
<a class="page-link gen-link" href="?type=display&page=pokemon&gen=8"><center><small><b>G8</b><br><?php echo $gen8; ?></small></center></a></li>
<li class="page-item <?php if (@$_GET['gen'] == 9) { echo "active";}; ?>">
<a class="page-link gen-link" href="?type=display&page=pokemon&gen=9"><center><small><b>G9</b><br><?php echo $gen9; ?></small></center></a></li>
</ul>
</nav>

Expand Down Expand Up @@ -324,7 +331,7 @@ class="badge badge-primary badge-pill w-100"><?php echo $row['pokemon_id']." | "
<li
class="list-group-item d-flex justify-content-between align-items-center">
<?php echo i8ln("DISTANCE"); ?>
<?php if ( @$distance_map <> "True" || @$disable_nominatim == "True" ) { ?>
<?php if ( @$distance_map <> "True" ) { ?>
<span
class="badge badge-primary badge-pill"><?php echo $row['distance']; ?>
</span>
Expand All @@ -338,7 +345,7 @@ class="badge badge-primary badge-pill"><?php echo $row['distance']; ?>
<?php } ?>
</li>

<?php if ( $row['distance'] > 0 && @$disable_nominatim <> "True" ) { ?>
<?php if ( $row['distance'] > 0 ) { ?>
<!-- SHOW DISTANCE Modal -->
<div class="modal fade" id="DistanceShowPokemons_<?php echo $row['distance']; ?>" tabindex="-1" role="dialog"
aria-labelledby="DistanceShowPokemonsTitle" aria-hidden="true">
Expand Down Expand Up @@ -479,11 +486,13 @@ class="list-group-item d-flex justify-content-between align-items-center">
<?php echo i8ln("SIZE"); ?>
<span class="badge badge-primary badge-pill">
<?php
if ($row['size'] == '1') { echo i8ln("XXS"); }
if ($row['size'] == '2') { echo i8ln("XS"); }
if ($row['size'] == '3') { echo i8ln("M"); }
if ($row['size'] == '4') { echo i8ln("XL"); }
if ($row['size'] == '5') { echo i8ln("XXL"); }
$size_name=get_size_name($row['size']);
echo $size_name;
if ( $row['max_size'] <> $row['size'] )
{
$max_size_name=get_size_name($row['max_size']);
echo "-".$max_size_name;
}
?>
</span>
</li>
Expand Down
15 changes: 10 additions & 5 deletions pages/display/server_settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,16 @@

// Check Connection to Scanner DB

$conn = new mysqli($scan_dbhost.":".$scan_dbport, $scan_dbuser, $scan_dbpass, $scan_dbname);
if ($conn->connect_errno) {
echo "<div class='alert alert-danger fade show' role='alert' style='padding: 3px; margin:3px;'>".i8ln("Unable to Connect to Scanner DB")."</div>";
} else {
echo "<div class='alert alert-success fade show' role='alert' style='padding: 3px; margin:3px;'>".i8ln("Successfully Connected to Scanner DB")."</div>";
if ( isset($scan_dbhost) ) {
$conn = new mysqli($scan_dbhost.":".$scan_dbport, $scan_dbuser, $scan_dbpass, $scan_dbname);
if ($conn->connect_errno) {
echo "<div class='alert alert-danger fade show' role='alert' style='padding: 3px; margin:3px;'>".i8ln("Unable to Connect to Scanner DB")."</div>";
} else {
echo "<div class='alert alert-success fade show' role='alert' style='padding: 3px; margin:3px;'>".i8ln("Successfully Connected to Scanner DB")."</div>";
}
} else
{
echo "<div class='alert alert-danger fade show' role='alert' style='padding: 3px; margin:3px;'>".i8ln("Please configure Scanner DB")."</div>";
}

// Check Connection to API
Expand Down
Loading