Skip to content

Commit

Permalink
Merge pull request #63 from Sageth/webhook_notification
Browse files Browse the repository at this point in the history
Add check for Dev URL
  • Loading branch information
Sageth committed Jun 17, 2018
2 parents dd8ec54 + c42b28c commit fb44d46
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions includes/classes/Scores.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public static function getScoreType($string, $ostring)
public static function notifyDiscordHighScore($gamename = '', $player = '', $score = 0, $link)
{
$inicfg = Core::getINIConfig();
$url = $inicfg['webhook']['highscoreURI'];
$url = $inicfg['environment']['state'] === 'dev' ? $inicfg['webhook']['highscoreURI_Dev'] : $inicfg['webhook']['highscoreURI'];

$message = $player . ' is the new champion of _' . $gamename . '_ with a score of ' . $score . '! Play now at ' . $link;

Expand All @@ -82,7 +82,7 @@ public static function notifyDiscordHighScore($gamename = '', $player = '', $sco
public static function notifyDiscordNewScore($gamename = '', $player = '', $score = 0, $link)
{
$inicfg = Core::getINIConfig();
$url = $inicfg['webhook']['highscoreURI'];
$url = $inicfg['environment']['state'] === 'dev' ? $inicfg['webhook']['highscoreURI_Dev'] : $inicfg['webhook']['highscoreURI'];

$message = $player . ' has a new personal high score of ' . $score . ' in _' . $gamename . 'Play now at ' . $link;

Expand All @@ -99,9 +99,6 @@ public static function notifyDiscordNewScore($gamename = '', $player = '', $scor
public static function submitGameScore($gameid = '', $score = 0, $player = '', $ip = '1.1.1.1', $link, $sort = 'DESC')
{
$time = Core::getCurrentDate();
$gamechamp = self::GetGameChampsbyGameNameID($gameid);
$game = Games::getGame($gameid);
$playername = ucfirst($_SESSION['user']['name']);

self::updateGameChamp($gameid, $player, $score, $sort, $time);
self::updateGameScore($gameid, $player, $score, $ip, $time, $sort, $link);
Expand Down Expand Up @@ -147,7 +144,7 @@ public static function updateGameChamp($gameid, $playerid, $score, $sort, $time)
}
public static function updateGameScore($nameid, $player, $score, $ip, $time, $sort, $link)
{
$game = Games::getGame($gameid);
$game = Games::getGameByNameID($nameid);
$playername = ucfirst($_SESSION['user']['name']);

/* Update games_score table */
Expand Down

0 comments on commit fb44d46

Please sign in to comment.