Daily Lucky Numbers:
3
22
24
41
42
43

Recent posts

#11
SMF Arcade Support + Plugins / Re: Undefined array key "rese...
Last post by Chen Zhen - July 27, 2025, 11:16:58 PM

No need to apologize.. I haven't been very active online for some time now.
12 hour shifts will do that!  :blank:

I'm not positive I understand the Arcade email behavior.
So I think you're saying precursory is working but signature and inline css is not?
 
#12
SMF Arcade Block Codes / Re: High Scores/Stats Block (V...
Last post by Chen Zhen - July 27, 2025, 11:10:11 PM
I see I neglected to put in backslashes which caused it to throw an error.
Anonymous functions can be used to negate the use of backslashes in that part of the code.

The cache was messing up the use of that best players function, so try this with a custom function included:

/* High Scores/Stats PHP Block */
/**************************
    set $gameTypes
    0 = Permission based
    1 = Flash/HTML
    2 = ROM only
    3 = All game types
**************************/
global $settings, $scripturl, $sourcedir, $boardurl, $smcFunc, $arcadeModSettings, $boarddir;
require_once($boarddir . '/ArcadeSources/ArcadeStats.php');

$no = 10; //number of top players to show
$txtplay = "The Top Players"; // change "The Top Players" to your language
$txtwin = "Number Of Wins :";// change "Number Of Wins :" to your language
$txtlate = "Latest High Score by ";// change "Latest High Score set by" to your language
$txtwit = "with ";// change "with" to your language
$txton = "on ";// change "on" to your language
$arcade_icon = 'arcade.jpg';
$gameTypes = 0;

switch($gameTypes) {
    case 1:
        $where = ' WHERE rom_flag = {int:romflag}';
        $romflag = 0;
        break;
    case 2:
        $where = ' WHERE rom_flag = {int:romflag}';
        $romflag = 1;
        break;
    case 3:
        $where = '';
        $romflag = 0;
        break;
    default:
        $romflag = 0;
        if (allowedTo('arcade_view_retro_arch')) {
            $where = '';
        }
        else {
            $where = ' WHERE rom_flag = {int:romflag}';
        }
}

$no_games = 8;
$icons_per_row = 4;
$mydisplays = true;
$check_game = !empty($_REQUEST['game']) ? (int) $_REQUEST['game'] : 0;
$no_games = !empty($check_game) ? 28 : 12;
$display = RandomArcadeDatum($no, $txtplay, $txtwin, $txtlate, $txtwit, $txton, $arcade_icon, $gameTypes, $no_games, $icons_per_row, $mydisplays, $check_game, $where, $romflag);

function RandomArcadeDatum($no, $txtplay, $txtwin, $txtlate, $txtwit, $txton, $arcade_icon, $gameTypes, $no_games, $icons_per_row, $mydisplays, $check_game, $where, $romflag)
{
    global $settings, $scripturl, $sourcedir, $boardurl, $smcFunc, $arcadeModSettings, $boarddir;

    if (!allowedTo('arcade_view') && $gameTypes == 0) {
        return false;
    }

    $request = $smcFunc['db_query']('', '
        SELECT  game.id_game, game.game_name, game.thumbnail, game.game_directory, game.rom_flag,
        IFNULL(mem.id_member, 0) AS id_member, IFNULL(mem.real_name, {string:rname}) AS player_name, score.score
        FROM {db_prefix}arcade_scores AS score
        LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = score.id_member)
        RIGHT JOIN {db_prefix}arcade_games AS game ON (game.id_game = score.id_game)' . (str_replace('rom_flag', 'game.rom_flag', $where)) . '
        ORDER BY champion_from DESC
        LIMIT 0,1',
        array('rname' => '???', 'romflag' => $romflag)
    );
    if(!$request)
      die("Could not get the newest champ");

    $row = $smcFunc['db_fetch_assoc']($request);
    $smcFunc['db_free_result']($request);

    if(isset($row['game_directory']))
      $row['game_directory'] = $row['game_directory'];

    //newest champ details
    $playerid = $row['id_member'];
    $player = !empty($row['real_name']) ? $row['real_name'] : $row['player_name'];
    $game_id = $row['id_game'];
    $game_name = $row['game_name'];
    $score = $row['score'];
    $game_pic = (!empty($row['rom_flag']) ? $arcadeModSettings['romGamesUrl'] : $arcadeModSettings['gamesUrl']) . '/' . $row['game_directory'] . '/' . $row['thumbnail'];
    $arcadePic = file_exists($settings['default_theme_dir'] . '/images/arc_icons/' . $arcade_icon) ? '<img style="border: 0px;height: 3em;width: 8em;" src="' . $settings['default_theme_url'] . '/images/arc_icons/' . $arcade_icon . '" alt="" />' : '<img style="border: 0px;height: 5em;width: 5em;" src="' . $settings['default_theme_url'] . '/images/arc_icons/thearcade.png" alt="" />';
    $bp=ArcadeStats_BestPlayers2($no);
    $bp = !empty($bp) ? $bp : [];
    for ($x=1;$x<=$no;$x++) {
        $imgFile = file_exists($settings['default_theme_dir'] . '/images/arc_icons/' . $x . '.gif') ? $settings['default_theme_url'] . '/images/arc_icons/' . $x . '.gif' : $settings['default_theme_url'] . '/images/arc_icons/trophy.png';
        $trophy[$x] = '<img src="' . $imgFile . '" border= "0" alt="#' . $x . ' Score" />';
    }
    $score_poss=0; //players position

    echo '
        <script type="text/javascript">
            var delayb4scrollx = 2000;
            var marqueespeedx = 1;
            var pauseitx = 1;
            var copyspeedx = marqueespeedx;
            var pausespeedx = pauseitx == 0 ? copyspeedx : 0;
            var actualheightx = "";

            function scrollmarqueex(){
                if (parseInt(cross_marqueex.style.top)>(actualheightx*(-1)+8))
                    cross_marqueex.style.top=parseInt(cross_marqueex.style.top)-copyspeedx+"px"
                else
                    cross_marqueex.style.top=parseInt(marqueeheightx)+8+"px"
            }

            function initializemarqueex(){
                cross_marqueex = document.getElementById("vmarqueex");
                cross_marqueex.style.top = 0;
                marqueeheightx = document.getElementById("marqueecontainerx").offsetHeight;
                actualheightx = cross_marqueex.offsetHeight;
                if (window.opera || navigator.userAgent.indexOf("Netscape/7")!=-1){
                    cross_marqueex.style.height = marqueeheightx+"px";
                    cross_marqueex.style.overflow = "scroll";
                    return;
                }
                setTimeout(function(){setInterval(function(){scrollmarqueex();},30);}, delayb4scrollx);
            }

            $( document ).ready(function() {
                initializemarqueex();
            });
        </script>
    <div style="overflow: hidden;">
        <div style="display:table;width: 100%;text-align: center;overflow: hidden;">
            <div style="display: table-row;">
                <div style="display: table-cell;text-align: center;">
                    <span style="display: block;line-height: 1em;"></span>
                    <a href="', $scripturl, '?action=arcade">
                        ', $arcadePic, '
                    </a>
                    <span style="display: block;line-height: 2em;"></span>
                </div>
            </div>
        </div>
    </div>';
    if ($mydisplays == true || $check_game == true) {
        /* Start 1 of 4 random stats display above top 10 marquee  */
        $random_games_choice = random_int(1,4);
        $games_choice = 'games'.$random_games_choice;
        $curr_position = 0;
        $games_choice($no_games,$curr_position,$icons_per_row, '', $no, $gameTypes, $where, $romflag);
        /* END random stats display */
    }
    if ($check_game == false)
    {
        echo '
    <div class="centertext" style="display: flex;justify-content: center;overflow: hidden;">
        <div id="marqueecontainerx" style="position: relative; width: 100%; height:200px; overflow: hidden; border: 0px;" onmouseover="copyspeedx=pausespeedx" onmouseout="copyspeedx=marqueespeedx">
            <div id="vmarqueex" style="position: absolute; width: 100%;">
                <div class="centertext">
                    <a href="', $scripturl, '?action=arcade;sa=play;game=', $game_id, '">
                        <img src="' . $game_pic . '" border="0" alt="' . $game_name . '" style="width: 4em;height: 4em;"/>
                    </a>
                    <span style="display: block;line-height: 1em;"></span>', $txtlate, '<span style="display: block;line-height: 1em;"></span>
                    <a href="', $scripturl, '?action=profile;u=', $playerid, '">', $player, '</a>
                    <span style="display: block;line-height: 1em;"></span>
                    ', $txtwit, ' ', $score, ' ', $txton, '
                    <span style="display: block;line-height: 1em;"></span>', $game_name, '
                    <span style="display: block;line-height: 1em;"></span>
                    <div style="width: 20%;margin: 0 auto;line-height: 0.2em;"><hr style="border-top: 1px dashed;" /></div>
                    <span style="display: block;line-height: 1em;"></span>
                    <span style="font: italic small-caps bold 12px/30px Georgia, serif;padding: 1em;">', $txtplay, '</span>
                    <span style="display: block;line-height: 2em;"></span>';
        foreach ($bp as $out) {
            $score_poss++;
            if ($score_poss > 10)
                $trophy[$score_poss] = '[' . $score_poss . ']';

            echo $trophy[$score_poss], '
                    <span style="display: block;line-height: 1em;"></span>
                    ' . $out['link'] . '
                    <span style="display: block;line-height: 1em;"></span>
                    ' . $txtwin . ' ' . $out['champions'] . '
                    <span style="display: block;line-height: 1em;"></span>
                    <div style="width: 30%;margin: 0 auto;line-height: 0.2em;"><hr style="border-top: 1px dashed;" /></div>
                    <span style="display: block;line-height: 1em;"></span>';
        }
    }

    echo '
                </div>
            </div>
        </div>
    </div>';
    return true;
}

/* START - Display Functions */
function games3($no_games,$curr_position,$icons_per_row, $gamesUrl, $no, $gameTypes, $where, $romflag)
{
    //show the latest games
    global $smcFunc, $scripturl, $arcadeModSettings;

    echo '
    <div style="width: 100%;margin: 0 auto;text-align: center;overflow: hidden;">Latest Games
        <span style="display: block;line-height: 1em;"></span>
        <div style="display: table;border-spacing: 5px;margin: 0 auto;">
            <div style="display: table-row;">';

    $result = $smcFunc['db_query']('', '
        SELECT id_game, game_name, thumbnail, game_directory, rom_flag
        FROM {db_prefix}arcade_games' . $where . '
        ORDER BY id_game DESC, game_name DESC
        LIMIT 0,{int:no}',
        array(
            'no' => $no_games, 'romflag' => $romflag
        )
    );

    while ($game = $smcFunc['db_fetch_assoc']($result))
    {
        $path = str_replace('', '/', (!empty($game['rom_flag']) ? $arcadeModSettings['romGamesDirectory'] : $arcadeModSettings['gamesDirectory']));
        $filepath = rtrim($path, '/');
        $gamesUrl = !empty($game['rom_flag']) ? $arcadeModSettings['romGamesUrl'] : $arcadeModSettings['gamesUrl'];
        $action = !empty($game['rom_flag']) ? 'retro_arch' : 'arcade';
        $game_thumb = $gamesUrl . '/' . $game['game_directory'] . '/' . $game['thumbnail'];
        if($curr_position == $icons_per_row)
        {
            echo '
                </div>
                <div style="display: table-row;">';
            $curr_position=0;
        }
        echo'
                <div style="display: table-cell;padding: 2px;">
                    <a href="'.$scripturl.'?action=' . $action . ';sa=play;game='.$game['id_game'].'">
                    <img src="'.$game_thumb.'" alt="'.$game['game_name'].'" style="border: 0px;width: 30px;height: 30px;" title="Play '.$game['game_name'].'" /></a>
                </div>';
      $curr_position++;
  }
  $smcFunc['db_free_result']($result);

  echo '
            </div>
        </div>
    </div>';
}

function games1($no_games,$curr_position,$icons_per_row, $gamesUrl, $no, $gameTypes, $where, $romflag)
{
    //show most played games (one score version only)
    global $smcFunc, $scripturl, $arcadeModSettings;

    echo '
    <div style="width: 100%;margin: 0 auto;text-align: center;overflow: hidden;">Most Played
        <span style="display: block;line-height: 1em;"></span>
        <div style="display: table;border-spacing: 5px;margin: 0 auto;">
            <div style="display: table-row;">';

    $result = $smcFunc['db_query']('', '
        SELECT id_game, game_name, thumbnail, game_directory, rom_flag, num_plays
        FROM {db_prefix}arcade_games' . $where . '
        ORDER BY num_plays DESC , game_name ASC
        LIMIT 0,{int:no}',
        array(
            'no' => $no_games, 'romflag' => $romflag,
        )
    );

    while ($game = $smcFunc['db_fetch_assoc']($result))
    {
        $path = str_replace('', '/', (!empty($game['rom_flag']) ? $arcadeModSettings['romGamesDirectory'] : $arcadeModSettings['gamesDirectory']));
        $filepath = rtrim($path, '/');
        $gamesUrl = !empty($game['rom_flag']) ? $arcadeModSettings['romGamesUrl'] : $arcadeModSettings['gamesUrl'];
        $action = !empty($game['rom_flag']) ? 'retro_arch' : 'arcade';
        $game_thumb = $gamesUrl . '/' . $game['game_directory'] . '/' . $game['thumbnail'];
        if($curr_position == $icons_per_row)
        {
            echo '
                </div>
                <div style="display: table-row;">';
            $curr_position=0;
        }
        echo'
                <div style="display: table-cell;padding: 2px;">
                    <a href="'.$scripturl.'?action=' . $action . ';sa=play;game='.$game['id_game'].'">
                    <img src="'.$game_thumb.'" alt="'.$game['game_name'].'" style="border: 0px;width: 30px;height: 30px;" title="Play '.$game['game_name'].'" /></a>
                </div>';
        $curr_position++;
    }

    $smcFunc['db_free_result']($result);

  echo '
            </div>
        </div>
    </div>';
}

function games4($no_games,$curr_position,$icons_per_row, $gamesUrl, $no, $gameTypes, $where, $romflag)
{
  //show least played games (one score version only)
  global $smcFunc, $scripturl, $arcadeModSettings;

  echo '
    <div style="width: 100%;margin: 0 auto;text-align: center;overflow: hidden;">Least Played
        <span style="display: block;line-height: 1em;"></span>
        <div style="display: table;border-spacing: 5px;margin: 0 auto;">
            <div style="display: table-row;">';

    $result = $smcFunc['db_query']('', '
        SELECT id_game, game_name, thumbnail, game_directory, num_plays, rom_flag
        FROM {db_prefix}arcade_games' . $where . '
        ORDER BY num_plays ASC , game_name ASC
        LIMIT 0,{int:no}',
        array(
            'no' => $no_games, 'romflag' => $romflag,
        )
    );

    while ($game = $smcFunc['db_fetch_assoc']($result))
    {
        $path = str_replace('', '/', (!empty($game['rom_flag']) ? $arcadeModSettings['romGamesDirectory'] : $arcadeModSettings['gamesDirectory']));
        $filepath = rtrim($path, '/');
        $gamesUrl = !empty($game['rom_flag']) ? $arcadeModSettings['romGamesUrl'] : $arcadeModSettings['gamesUrl'];
        $action = !empty($game['rom_flag']) ? 'retro_arch' : 'arcade';
        $game_thumb = $gamesUrl . '/' . $game['game_directory'] . '/' . $game['thumbnail'];
        if($curr_position == $icons_per_row)
        {
            echo '
                </div>
                <div style="display: table-row;">';
            $curr_position=0;
        }
        echo '
                <div style="display: table-cell;padding: 2px;">
                    <a href="'.$scripturl.'?action=' . $action . ';sa=play;game='.$game['id_game'].'">
                    <img src="'.$game_thumb.'" alt="'.$game['game_name'].'" style="border: 0px;width: 30px;height: 30px;" title="Play '.$game['game_name'].'" /></a>
                </div>';
        $curr_position++;
    }
    $smcFunc['db_free_result']($result);

  echo '
            </div>
        </div>
    </div>';
}

function games2($no_games,$curr_position,$icons_per_row, $gamesUrl, $no, $gameTypes, $where, $romflag)
{
    //show best rated games
    global $smcFunc, $scripturl, $arcadeModSettings;

    echo '
    <div style="width: 100%;margin: 0 auto;text-align: center;overflow: hidden;">Top Rated
    <span style="display: block;line-height: 1em;"></span>
        <div style="display: table;border-spacing: 5px;margin: 0 auto;">
            <div style="display: table-row;">';

    $result = $smcFunc['db_query']('', '
        SELECT id_game, game_name, thumbnail, game_directory, game_rating, rom_flag
        FROM {db_prefix}arcade_games' . $where . '
        ORDER BY game_rating DESC , game_name ASC
        LIMIT 0,{int:no}',
        array(
            'no' => $no_games, 'romflag' => $romflag,
        )
    );

    while ($game = $smcFunc['db_fetch_assoc']($result))
    {
        $path = str_replace('', '/', (!empty($game['rom_flag']) ? $arcadeModSettings['romGamesDirectory'] : $arcadeModSettings['gamesDirectory']));
        $filepath = rtrim($path, '/');
        $gamesUrl = !empty($game['rom_flag']) ? $arcadeModSettings['romGamesUrl'] : $arcadeModSettings['gamesUrl'];
        $action = !empty($game['rom_flag']) ? 'retro_arch' : 'arcade';
        $game_thumb = $gamesUrl . '/' . $game['game_directory'] . '/' . $game['thumbnail'];
        if($curr_position == $icons_per_row)
        {
            echo '</div><div style="display: table-row;">';
            $curr_position=0;
        }
        echo'
                <div style="display: table-cell;padding: 2px;">
                    <a href="'.$scripturl.'?action=' . $action . ';sa=play;game='.$game['id_game'].'">
                    <img src="'.$game_thumb.'" alt="'.$game['game_name'].'" style="border: 0px;width: 30px;height: 30px;" title="Play '.$game['game_name'].'" /></a>
                </div>';
        $curr_position++;
    }

    $smcFunc['db_free_result']($result);

  echo '
            </div>
        </div>
    </div>';
}

function ArcadeStats_BestPlayers2($count = 10, $rom = 0)
{
    // Returns best players by count of champions
    global $db_prefix, $scripturl, $txt, $smcFunc, $arcadeModSettings;

    $action = isset($_REQUEST['action']) && $_REQUEST['action'] == 'retro_arch' ? 'retro_arch' : (isset($_REQUEST['action']) && $_REQUEST['action'] == 'arcade' ? 'arcade' : '');
    $rom = !empty($_SESSION['arcade_rom_initiate']) && !empty($action) ? 1 : ($action == 'retro_arch' ? 1 : $rom);
    $rom2 = !empty($rom) ? '_rom' : '';
    $where = empty($arcadeModSettings['arcadeRomToggle']) && $rom > -1 ? ' AND game.rom_flag = {int:romflag}' : '';
    $top = [];
    $request = $smcFunc['db_query']('', '
        SELECT COUNT(*) AS champions, game.rom_flag, IFNULL(mem.id_member, 0) AS id_member, IFNULL(mem.real_name, {string:empty}) AS real_name
        FROM {db_prefix}arcade_games AS game
            LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = game.id_champion)
        WHERE game.id_champion_score > 0' . $where . '
        GROUP BY game.id_champion, id_member, real_name, game.rom_flag
        ORDER BY champions DESC
        LIMIT {int:count}',
        array(
            'count' => $count,
            'empty' => '',
            'romflag' => $rom,
        )
    );
    $max = -1;

    while ($score = $smcFunc['db_fetch_assoc']($request))
    {
        if ($max == -1)
            $max = $score['champions'];

        $top[] = array(
            'name' => $score['real_name'],
            'link' => !empty($score['real_name']) ? '<a href="' . $scripturl . '?action=profile;u=' . $score['id_member'] . '">' .  $score['real_name'] . '</a>' : $txt['guest'],
            'champions' => comma_format($score['champions']),
            'precent' => ($score['champions'] / $max) * 100,
        );
    }
    $smcFunc['db_free_result']($request);

    $top = !empty($arcadeBestPlayers) ? json_decode($arcadeBestPlayers, true) : $top;

    if (count($top) == 0)
        return false;
    elseif ($count > 1)
        return $top;
    else
        return $top[0];
}



Please let me know if it works so I can replace the function in the OP.

#13
SMF Arcade Support + Plugins / Re: Undefined array key "rese...
Last post by Duban Black - July 26, 2025, 05:48:53 PM
Quote from: Chen Zhen on June 26, 2025, 10:22:12 PMIf you don't mind testing a possible fix, please download the attached file and overwrite the existing file located in this path:
\ArcadeSources




Please let me know if it resolves your reported issue.

I apologize for taking so long to respond. I had a very difficult month. With the new code, the first part of the email was fixed, but the body and signature are not correct. I am leaving the evidence.

#14
SMF Arcade Block Codes / Re: High Scores/Stats Block (V...
Last post by Dave - July 26, 2025, 06:12:32 AM
I know your not about at the moment but for some reason the code in your previous post seems to break the portal, that's TP and EHPortal. I thought it might have been to do with PHP8 but it's not, it's possible the issue is related to the latest SMF update to 2.1.6.

The code below works, sort of, I say sort of because it now only shows a single top scorer

/**************************
    set $gameTypes
    0 = Permission based
    1 = Flash/HTML
    2 = ROM only
    3 = All game types
**************************/
global $settings, $scripturl, $sourcedir, $boardurl, $smcFunc, $arcadeModSettings, $boarddir;
require_once($boarddir . '/ArcadeSources/ArcadeStats.php');

$no = 5; //number of top players to show
$txtplay = "The Top Players"; // change "The Top Players" to your language
$txtwin = "Number Of Wins :";// change "Number Of Wins :" to your language
$txtlate = "Latest High Score by ";// change "Latest High Score set by" to your language
$txtwit = "with ";// change "with" to your language
$txton = "on ";// change "on" to your language
$arcade_icon = 'arcade.jpg';
$gameTypes = 1;

switch($gameTypes) {
    case 1:
        $where = ' WHERE rom_flag = {int:romflag}';
        $romflag = 0;
        break;
    case 2:
        $where = ' WHERE rom_flag = {int:romflag}';
        $romflag = 1;
        break;
    case 3:
        $where = '';
        $romflag = 0;
        break;
    default:
        $romflag = 0;
        if (allowedTo('arcade_view_retro_arch')) {
            $where = '';
        }
        else {
            $where = ' WHERE rom_flag = {int:romflag}';
        }
}

$no_games = 8;
$icons_per_row = 4;
$mydisplays = false;
$check_game = !empty($_REQUEST['game']) ? (int) $_REQUEST['game'] : 0;
$no_games = !empty($check_game) ? 28 : 8;
$display = RandomArcadeDatum($no, $txtplay, $txtwin, $txtlate, $txtwit, $txton, $arcade_icon, $gameTypes, $no_games, $icons_per_row, $mydisplays, $check_game, $where, $romflag);

function RandomArcadeDatum($no, $txtplay, $txtwin, $txtlate, $txtwit, $txton, $arcade_icon, $gameTypes, $no_games, $icons_per_row, $mydisplays, $check_game, $where, $romflag)
{
    global $settings, $scripturl, $sourcedir, $boardurl, $smcFunc, $arcadeModSettings, $boarddir;

    if (!allowedTo('arcade_view') && $gameTypes == 0) {
        return false;
    }

    $request = $smcFunc['db_query']('', '
        SELECT  game.id_game, game.game_name, game.thumbnail, game.game_directory, game.rom_flag,
        IFNULL(mem.id_member, 0) AS id_member, IFNULL(mem.real_name, {string:rname}) AS player_name, score.score
        FROM {db_prefix}arcade_scores AS score
        LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = score.id_member)
        RIGHT JOIN {db_prefix}arcade_games AS game ON (game.id_game = score.id_game)' . (str_replace('rom_flag', 'game.rom_flag', $where)) . '
        ORDER BY champion_from DESC
        LIMIT 0,1',
        array('rname' => '???', 'romflag' => $romflag)
    );
    if(!$request)
      die("Could not get the newest champ");

    $row = $smcFunc['db_fetch_assoc']($request);
    $smcFunc['db_free_result']($request);

    if(isset($row['game_directory']))
      $row['game_directory'] = $row['game_directory'];

    //newest champ details
    $playerid = $row['id_member'];
    $player = !empty($row['real_name']) ? $row['real_name'] : $row['player_name'];
    $game_id = $row['id_game'];
    $game_name = $row['game_name'];
    $score = $row['score'];
    $game_pic = (!empty($row['rom_flag']) ? $arcadeModSettings['romGamesUrl'] : $arcadeModSettings['gamesUrl']) . '/' . $row['game_directory'] . '/' . $row['thumbnail'];
    $arcadePic = file_exists($settings['default_theme_dir'] . '/images/arc_icons/' . $arcade_icon) ? '<img style="border: 0px;height: 3em;width: 8em;" src="' . $settings['default_theme_url'] . '/images/arc_icons/' . $arcade_icon . '" alt="" />' : '<img style="border: 0px;height: 5em;width: 5em;" src="' . $settings['default_theme_url'] . '/images/arc_icons/thearcade.png" alt="" />';
    $bp=ArcadeStats_BestPlayers($no);
    $bp = !empty($bp) ? $bp : array();
    for ($x=1;$x<11;$x++) {
        $imgFile = file_exists($settings['default_theme_dir'] . '/images/arc_icons/' . $x . '.gif') ? $settings['default_theme_url'] . '/images/arc_icons/' . $x . '.gif' : $settings['default_theme_url'] . '/images/arc_icons/trophy.png';
        $trophy[$x] = '<img src="' . $imgFile . '" border= "0" alt="#' . $x . ' Score" />';
    }
    $score_poss=0; //players position

    echo '
        <script type="text/javascript">
            var delayb4scrollx = 2000;
            var marqueespeedx = 1;
            var pauseitx = 1;
            var copyspeedx = marqueespeedx;
            var pausespeedx = pauseitx == 0 ? copyspeedx : 0;
            var actualheightx = "";

            function scrollmarqueex(){
                if (parseInt(cross_marqueex.style.top)>(actualheightx*(-1)+8))
                    cross_marqueex.style.top=parseInt(cross_marqueex.style.top)-copyspeedx+"px"
                else
                    cross_marqueex.style.top=parseInt(marqueeheightx)+8+"px"
            }

            function initializemarqueex(){
                cross_marqueex = document.getElementById("vmarqueex");
                cross_marqueex.style.top = 0;
                marqueeheightx = document.getElementById("marqueecontainerx").offsetHeight;
                actualheightx = cross_marqueex.offsetHeight;
                if (window.opera || navigator.userAgent.indexOf("Netscape/7")!=-1){
                    cross_marqueex.style.height = marqueeheightx+"px";
                    cross_marqueex.style.overflow = "scroll";
                    return;
                }
                setTimeout(\'lefttime=setInterval("scrollmarqueex()",30)\', delayb4scrollx);
            }

            if (window.addEventListener)
                window.addEventListener("load", initializemarqueex, false);
            else if (window.attachEvent)
                window.attachEvent("onload", initializemarqueex);
            else
                window.onload = initializemarqueex();
        </script>
    <div style="overflow: hidden;">
        <div style="display:table;width: 100%;text-align: center;overflow: hidden;">
            <div style="display: table-row;">
                <div style="display: table-cell;text-align: center;">
                    <span style="display: block;line-height: 1em;"></span>
                    <a href="', $scripturl, '?action=arcade">
                        ', $arcadePic, '
                    </a>
                    <span style="display: block;line-height: 2em;"></span>
                </div>
            </div>
        </div>
    </div>';
    if ($mydisplays == true || $check_game == true) {
        /* Start 1 of 4 random stats display above top 10 marquee  */
        $random_games_choice = random_int(1,4);
        $games_choice = 'games'.$random_games_choice;
        $curr_position = 0;
        $games_choice($no_games,$curr_position,$icons_per_row, '', $no, $gameTypes, $where, $romflag);
        /* END random stats display */
    }
    if ($check_game == false)
    {
        echo '
    <div class="centertext" style="display: flex;justify-content: center;overflow: hidden;">
        <div id="marqueecontainerx" style="position: relative; width: 100%; height:200px; overflow: hidden; border: 0px;" onmouseover="copyspeedx=pausespeedx" onmouseout="copyspeedx=marqueespeedx">
            <div id="vmarqueex" style="position: absolute; width: 100%;">
                <div class="centertext">
                    <a href="', $scripturl, '?action=arcade;sa=play;game=', $game_id, '">
                        <img src="' . $game_pic . '" border="0" alt="' . $game_name . '" style="width: 4em;height: 4em;"/>
                    </a>
                    <span style="display: block;line-height: 1em;"></span>', $txtlate, '<span style="display: block;line-height: 1em;"></span>
                    <a href="', $scripturl, '?action=profile;u=', $playerid, '">', $player, '</a>
                    <span style="display: block;line-height: 1em;"></span>
                    ', $txtwit, ' ', $score, ' ', $txton, '
                    <span style="display: block;line-height: 1em;"></span>', $game_name, '
                    <span style="display: block;line-height: 1em;"></span>
                    <div style="width: 20%;margin: 0 auto;line-height: 0.2em;"><hr style="border-top: 1px dashed;" /></div>
                    <span style="display: block;line-height: 1em;"></span>
                    <span style="font: italic small-caps bold 12px/30px Georgia, serif;padding: 1em;">', $txtplay, '</span>
                    <span style="display: block;line-height: 2em;"></span>';
        foreach ($bp as $out) {
            $score_poss++;
            if ($score_poss > 10)
                $trophy[$score_poss] = '[' . $score_poss . ']';

            echo $trophy[$score_poss], '
                    <span style="display: block;line-height: 1em;"></span>
                    ' . $out['link'] . '
                    <span style="display: block;line-height: 1em;"></span>
                    ' . $txtwin . ' ' . $out['champions'] . '
                    <span style="display: block;line-height: 1em;"></span>
                    <div style="width: 30%;margin: 0 auto;line-height: 0.2em;"><hr style="border-top: 1px dashed;" /></div>
                    <span style="display: block;line-height: 1em;"></span>';
        }
    }

    echo '
                </div>
            </div>
        </div>
    </div>';
    return true;
}

/* START - Display Functions */
function games3($no_games,$curr_position,$icons_per_row, $gamesUrl, $no, $gameTypes, $where, $romflag)
{
    //show the latest games
    global $smcFunc, $scripturl, $arcadeModSettings;

    echo '
    <div style="width: 100%;margin: 0 auto;text-align: center;overflow: hidden;">Latest Games
        <span style="display: block;line-height: 1em;"></span>
        <div style="display: table;border-spacing: 5px;margin: 0 auto;">
            <div style="display: table-row;">';

    $result = $smcFunc['db_query']('', '
        SELECT id_game, game_name, thumbnail, game_directory, rom_flag
        FROM {db_prefix}arcade_games' . $where . '
        ORDER BY id_game DESC, game_name DESC
        LIMIT 0,{int:no}',
        array(
            'no' => $no_games, 'romflag' => $romflag
        )
    );

    while ($game = $smcFunc['db_fetch_assoc']($result))
    {
        $path = str_replace('\\', '/', (!empty($game['rom_flag']) ? $arcadeModSettings['romGamesDirectory'] : $arcadeModSettings['gamesDirectory']));
        $filepath = rtrim($path, '/');
        $gamesUrl = !empty($game['rom_flag']) ? $arcadeModSettings['romGamesUrl'] : $arcadeModSettings['gamesUrl'];
        $action = !empty($game['rom_flag']) ? 'retro_arch' : 'arcade';
        $game_thumb = $gamesUrl . '/' . $game['game_directory'] . '/' . $game['thumbnail'];
        if($curr_position == $icons_per_row)
        {
            echo '
                </div>
                <div style="display: table-row;">';
            $curr_position=0;
        }
        echo'
                <div style="display: table-cell;padding: 2px;">
                    <a href="'.$scripturl.'?action=' . $action . ';sa=play;game='.$game['id_game'].'">
                    <img src="'.$game_thumb.'" alt="'.$game['game_name'].'" style="border: 0px;width: 30px;height: 30px;" title="Play '.$game['game_name'].'" /></a>
                </div>';
      $curr_position++;
  }
  $smcFunc['db_free_result']($result);

  echo '
            </div>
        </div>
    </div>';
}

function games1($no_games,$curr_position,$icons_per_row, $gamesUrl, $no, $gameTypes, $where, $romflag)
{
    //show most played games (one score version only)
    global $smcFunc, $scripturl, $arcadeModSettings;

    echo '
    <div style="width: 100%;margin: 0 auto;text-align: center;overflow: hidden;">Most Played
        <span style="display: block;line-height: 1em;"></span>
        <div style="display: table;border-spacing: 5px;margin: 0 auto;">
            <div style="display: table-row;">';

    $result = $smcFunc['db_query']('', '
        SELECT id_game, game_name, thumbnail, game_directory, rom_flag, num_plays
        FROM {db_prefix}arcade_games' . $where . '
        ORDER BY num_plays DESC , game_name ASC
        LIMIT 0,{int:no}',
        array(
            'no' => $no_games, 'romflag' => $romflag,
        )
    );

    while ($game = $smcFunc['db_fetch_assoc']($result))
    {
        $path = str_replace('\\', '/', !empty($game['rom_flag']) ? $arcadeModSettings['romGamesDirectory'] : $arcadeModSettings['gamesDirectory']);
        $filepath = rtrim($path, '/');
        $gamesUrl = !empty($game['rom_flag']) ? $arcadeModSettings['romGamesUrl'] : $arcadeModSettings['gamesUrl'];
        $action = !empty($game['rom_flag']) ? 'retro_arch' : 'arcade';
        $game_thumb = $gamesUrl . '/' . $game['game_directory'] . '/' . $game['thumbnail'];
        if($curr_position == $icons_per_row)
        {
            echo '
                </div>
                <div style="display: table-row;">';
            $curr_position=0;
        }
        echo'
                <div style="display: table-cell;padding: 2px;">
                    <a href="'.$scripturl.'?action=' . $action . ';sa=play;game='.$game['id_game'].'">
                    <img src="'.$game_thumb.'" alt="'.$game['game_name'].'" style="border: 0px;width: 30px;height: 30px;" title="Play '.$game['game_name'].'" /></a>
                </div>';
        $curr_position++;
    }

    $smcFunc['db_free_result']($result);

  echo '
            </div>
        </div>
    </div>';
}

function games4($no_games,$curr_position,$icons_per_row, $gamesUrl, $no, $gameTypes, $where, $romflag)
{
  //show least played games (one score version only)
  global $smcFunc, $scripturl, $arcadeModSettings;

  echo '
    <div style="width: 100%;margin: 0 auto;text-align: center;overflow: hidden;">Least Played
        <span style="display: block;line-height: 1em;"></span>
        <div style="display: table;border-spacing: 5px;margin: 0 auto;">
            <div style="display: table-row;">';

    $result = $smcFunc['db_query']('', '
        SELECT id_game, game_name, thumbnail, game_directory, num_plays, rom_flag
        FROM {db_prefix}arcade_games' . $where . '
        ORDER BY num_plays ASC , game_name ASC
        LIMIT 0,{int:no}',
        array(
            'no' => $no_games, 'romflag' => $romflag,
        )
    );

    while ($game = $smcFunc['db_fetch_assoc']($result))
    {
        $path = str_replace('\\', '/', !empty($game['rom_flag']) ? $arcadeModSettings['romGamesDirectory'] : $arcadeModSettings['gamesDirectory']);
        $filepath = rtrim($path, '/');
        $gamesUrl = !empty($game['rom_flag']) ? $arcadeModSettings['romGamesUrl'] : $arcadeModSettings['gamesUrl'];
        $action = !empty($game['rom_flag']) ? 'retro_arch' : 'arcade';
        $game_thumb = $gamesUrl . '/' . $game['game_directory'] . '/' . $game['thumbnail'];
        if($curr_position == $icons_per_row)
        {
            echo '
                </div>
                <div style="display: table-row;">';
            $curr_position=0;
        }
        echo '
                <div style="display: table-cell;padding: 2px;">
                    <a href="'.$scripturl.'?action=' . $action . ';sa=play;game='.$game['id_game'].'">
                    <img src="'.$game_thumb.'" alt="'.$game['game_name'].'" style="border: 0px;width: 30px;height: 30px;" title="Play '.$game['game_name'].'" /></a>
                </div>';
        $curr_position++;
    }
    $smcFunc['db_free_result']($result);

  echo '
            </div>
        </div>
    </div>';
}

function games2($no_games,$curr_position,$icons_per_row, $gamesUrl, $no, $gameTypes, $where, $romflag)
{
    //show best rated games
    global $smcFunc, $scripturl, $arcadeModSettings;

    echo '
    <div style="width: 100%;margin: 0 auto;text-align: center;overflow: hidden;">Top Rated
    <span style="display: block;line-height: 1em;"></span>
        <div style="display: table;border-spacing: 5px;margin: 0 auto;">
            <div style="display: table-row;">';

    $result = $smcFunc['db_query']('', '
        SELECT id_game, game_name, thumbnail, game_directory, game_rating, rom_flag
        FROM {db_prefix}arcade_games' . $where . '
        ORDER BY game_rating DESC , game_name ASC
        LIMIT 0,{int:no}',
        array(
            'no' => $no_games, 'romflag' => $romflag,
        )
    );

    while ($game = $smcFunc['db_fetch_assoc']($result))
    {
        $path = str_replace('\\', '/', !empty($game['rom_flag']) ? $arcadeModSettings['romGamesDirectory'] : $arcadeModSettings['gamesDirectory']);
        $filepath = rtrim($path, '/');
        $gamesUrl = !empty($game['rom_flag']) ? $arcadeModSettings['romGamesUrl'] : $arcadeModSettings['gamesUrl'];
        $action = !empty($game['rom_flag']) ? 'retro_arch' : 'arcade';
        $game_thumb = $gamesUrl . '/' . $game['game_directory'] . '/' . $game['thumbnail'];
        if($curr_position == $icons_per_row)
        {
            echo '</div><div style="display: table-row;">';
            $curr_position=0;
        }
        echo'
                <div style="display: table-cell;padding: 2px;">
                    <a href="'.$scripturl.'?action=' . $action . ';sa=play;game='.$game['id_game'].'">
                    <img src="'.$game_thumb.'" alt="'.$game['game_name'].'" style="border: 0px;width: 30px;height: 30px;" title="Play '.$game['game_name'].'" /></a>
                </div>';
        $curr_position++;
    }

    $smcFunc['db_free_result']($result);

  echo '
            </div>
        </div>
    </div>';
}
#15
SMF Arcade Support + Plugins / Re: Undefined array key "rese...
Last post by Chen Zhen - June 28, 2025, 10:11:08 PM

Please read this post:
https://web-develop.ca/index.php?topic=3933.msg12165

The changes to Zhen Mailer files from this thread are already included in the ZhenMailer package that is in WebDev's download section.
#16
Zhen Mailer / Re: Zhen Mailer version 2.0.1
Last post by Chen Zhen - June 28, 2025, 10:08:37 PM

Prior to upgrading the SMF main package to version 2.1.5 and/or version 2.1.6 via patching, Zhen Mailer should be uninstalled.
After patching/upgrading the main forum package Zhen Mailer should be downloaded from this site & installed.
#17
SMF Arcade Support + Plugins / Re: Undefined array key "rese...
Last post by Chen Zhen - June 26, 2025, 10:22:12 PM
If you don't mind testing a possible fix, please download the attached file and overwrite the existing file located in this path:
\ArcadeSources




Please let me know if it resolves your reported issue.
#18
SMF Arcade Support + Plugins / Re: Undefined array key "rese...
Last post by Duban Black - June 23, 2025, 06:43:27 PM
Quote from: Chen Zhen on June 22, 2025, 12:33:02 AMZhenMailer only filters SMF's default email templates and not any emails from custom modifications.
However, "Precursory" & "Signature" should be working for all emails.
   

"Precursory" & "Signature" do not work in this type of email, it seems to me that it does not follow the regular sending flow that is SMTP and that is currently used with ZhenMailer. On the contrary the email sending in Arcade is by (PHP default). Even the sending email which is the same looks different in both emails, attached evidence.

Mail sent by zhenmailer (smtp)

Mail sent by Arcade (I assume it is php default)

Where in the arcade code could I change the email sending and configure smtp instead of php default?
#19
SMF Arcade Support + Plugins / Re: Undefined array key "rese...
Last post by Chen Zhen - June 22, 2025, 12:33:02 AM

ZhenMailer only filters SMF's default email templates and not any emails from custom modifications.
However, "Precursory" & "Signature" should be working for all emails.
   
#20
SMF Arcade Support + Plugins / Re: Undefined array key "rese...
Last post by Duban Black - June 11, 2025, 11:10:56 PM
@Chen Zhen  It's working ok, no more errors occur, but the emails are sent outside the ZhenMailer format, is there a way to include them in the default templates?