Main Menu
Daily Lucky Numbers:
4
5
23
27
38
40

Recent posts

#11
EhPortal Support / Re: Database Error
Last post by Chen Zhen - October 23, 2024, 12:13:01 AM

This has been fixed in the latest release.
#12
EhPortal Support / Re: Cant add block
Last post by Chen Zhen - October 23, 2024, 12:12:02 AM

There is now a new version available which fixes the problem that you reported.
You can get this package from the download section.

Make sure to uninstall & delete your old version prior to installing any new version.
#13
EhPortal Support / Re: Cant add block
Last post by Chen Zhen - October 22, 2024, 01:29:34 AM
Welcome to the site.

I am able to duplicate your issue & thanks for the report.
When I have a fix for this bug report, I will keep you updated in this thread.

Thank you.
#14
EhPortal Support / Cant add block
Last post by Plus - October 21, 2024, 03:50:45 PM
Hello, i updated my ehportal.

but now its give error when i try to add latest post/topic.

Duplicate entry '17' for key 'axt_sp_parameters.PRIMARY'
Dosya: /home/**/public_html/Sources/PortalAdminBlocks.php
Satır: 933
#15
EhPortal Support / EhPortal block code for Google...
Last post by Chen Zhen - October 19, 2024, 06:17:05 PM
I have found that Google's ad code that is put into the <head> of the HTML page causes some unwanted behavior.
Sometimes form submissions give errors, requiring the user to re-submit the task which can cause some inconvenience.

Here is a PHP block example that puts your Google Ads code in an iframe, separating it from the main page body yet it will still
work as normal.
Be sure to check the options for hiding the title & body of your block code.
There is an option at the onset of the block code to set your unique Google-Ad ID.
// set this variable to your unique Google-Ad ID
// ie. $googleAdCode = 'us-pub-0000000000000000';
$googleAdCode = 'us-pub-0000000000000000';
echo '<iframe sandbox style="visibility: hidden;width: 0px;height: 0px;position: absolute;" id="smf_gdoc" srdoc=\'<!DOCTYPE html><head></head>
<html>
<body>
<div style="display: none;"><span></span></div>
</body>
</html>\'>
</iframe>
<script>
$(document).ready(function() {
var gmeta = $("<meta>", {
name: "google-adsense-account",
content: "' . $googleAdCode . '"
});
var gscript = $("<script>", {
type: "text/javascript",
src: "https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=' . $googleAdCode . '"
});
gscript[0].setAttribute("async", "");
gscript[0].setAttribute("sandbox", "");
$("head", window.frames["smf_gdoc"].document).append(gmeta[0]);
$("head", window.frames["smf_gdoc"].document).append(gscript[0]);
});
</script>';

I advise not to not put the ad code on any pages that have frequent form submissions.
This code should stop any problems in that respect but it might still be prudent to have the block only display on pages that are primarily read only such as the portal page & forum.
For blocks you can opt advanced options & control the area where the block shows on your website.
#16
SMF Arcade Support + Plugins / Re: Avoid installing duplicate...
Last post by Chen Zhen - September 17, 2024, 02:13:45 PM

In your SMF-Arcade admin settings look for the "Game Uploading" heading.
There are options to avoid the installation of duplicate games.
#17
SMF Arcade Support + Plugins / Avoid installing duplicate gam...
Last post by Allach - September 17, 2024, 11:49:57 AM
How to avoid installing duplicate games? Is there a setting?
#18
SMF Arcade Block Codes / Drop-Down Category Block
Last post by Chen Zhen - September 14, 2024, 12:57:41 AM
Drop-Down categories PHP block code for SMF Arcade
Version: SMF-Arcade v2.7.0.2+



This will give you a nice drop-down category menu inside a PHP block.
You can check out the one in this arcade for the example.



Custom Display Options:
(For viewing on portal - leave this line blank)
~action|arcade
Main PHP Code:
// Category PHP block code for SMF Arcade
global $scripturl, $smcFunc;
/**************************
set $gameTypes
0 = Permission based
1 = Flash/HTML
2 = ROM only
3 = All game types
**************************/
$gameTypes = 0;
$selectCSS = 'font-size: 100%;';

switch($gameTypes) {
case 1:
$where = ' AND game.rom_flag = {int:romflag}';
$romflag = 0;
break;
case 2:
$where = ' AND game.rom_flag = {int:romflag}';
$romflag = 1;
$included_game_types[] = 'rom';
break;
case 3:
$where = '';
$romflag = 0;
break;
default:
$romflag = 0;
if (allowedTo('arcade_view_retro_arch')) {
$where = '';
}
else {
$where = ' AND game.rom_flag = {int:romflag}';
}
}
list($count, $cat_name, $cat_link, $cat_drop, $gameCats) = array(1, array(), array(), array(), array());

echo '
    <script type="text/javascript">
    function arcadeCatBlockSelect() {
        var arcadeNewFormSelectOpt = document.getElementById("arcCategoryBlockId");
        var arcadeNewFormCatId = arcadeNewFormSelectOpt.options[arcadeNewFormSelectOpt.selectedIndex].value;
        document.getElementById("arcadeBlockForm3").action += ";category=" + arcadeNewFormCatId;
        document.getElementById("arcadeBlockForm3").submit()
    }
    </script>
    <div class="centertext" style="width: 100%;margin: 0 auto;">
        <form id="arcadeBlockForm3" action="', $scripturl, '?action=arcade" method="post">
            <select id="arcCategoryBlockId" name="arcCategoryBlock" style="' . $selectCSS . '" onchange="arcadeCatBlockSelect()">
                <option value="">View By Category</option>';


$request = $smcFunc['db_query']('', '
    SELECT game.id_game, game.id_cat, game.enabled, game.rom_flag
    FROM {db_prefix}arcade_games as game
WHERE enabled = {int:enabled}' . $where . '
    ORDER BY game.id_game ASC',
    array('enabled' => 1,'romflag' => $romflag)
);
while ($row = $smcFunc['db_fetch_assoc']($request)) {
$idCat = !empty($row['id_cat']) ? intval($row['id_cat']) : 0;
if (empty($gameTypes) && empty($row['rom_flag']) && !allowedTo('arcade_play'))
continue;
elseif (empty($gameTypes) && !empty($row['rom_flag']) && !allowedTo('arcade_view_retro_arch'))
continue;

$gameCats[$idCat][] = $row['id_game'];
}
$smcFunc['db_free_result']($request);
$request = $smcFunc['db_query']('', '
    SELECT cat.id_cat, cat.cat_name, cat.num_games, cat.cat_order
    FROM {db_prefix}arcade_categories as cat
    ORDER BY cat_order',
    array('romflag' => $romflag)
);

while ($row = $smcFunc['db_fetch_assoc']($request)) {
if (empty($gameCats[$row['id_cat']]))
continue;

    $count = $row['id_cat'];
    $cat_name[$count] = $row['cat_name'];
    $cat_link[$count] = $scripturl . '?action=arcade;category=' . $count;
    $cat_drop[$count] = '<a href="' . $cat_link[$count] .'">'.$cat_name[$count].'</a>';

    echo '
                <option value="', $count, '">', $cat_name[$count], '</option>';
}
$smcFunc['db_free_result']($request);

echo '
            </select>
        </form>
    </div>';



Note: You can style your select box with this part of the above code:
$selectCSS = 'font-size: 100%;';
#19
SMF Arcade Block Codes / Game Block
Last post by Chen Zhen - September 13, 2024, 11:19:55 PM
Play a game in a PHP portal block
Version: SMF-Arcade v2.7.0.2+



PHP Block Code -
$gameid: represents the game ID (elect a game id number or 0 for random)
$minimum_height: represents a minimum value if a game height is not found in the db
$container_class: css class background (around the game)
$randomReplay: boolean ~ play button selects random game (true) or same game (false)

/**************************
set $gameTypes
0 = Permission based
1 = Flash/HTML
2 = ROM only
3 = All game types

set $included_game_types ... ROM games are generalized | empty array for all | $gameTypes = 2 automatically adds rom to this list | all game types shown below for reference
array('v1game', 'v2game', 'v3arcade', 'phpbb', 'mochi', 'custom_game', 'ibp', 'ibp2', 'ibp3', 'ibp32', 'html5', 'html52', 'html53', 'rom')
**************************/
$gameTypes = 0;
global $scripturl, $boardurl, $txt, $smcFunc, $arcadeModSettings;

/* Change $gameid to a specific game id (0 for random) ~ other options are available  */
$included_game_types = array('html5', 'html52', 'html53', 'rom');
$minimum_height = '700';
$minimum_width = '400';
$container_class = 'windowbg';
$gameid = 0;
$randomReplay = true;
switch($gameTypes) {
case 1:
$where = ' AND rom_flag = {int:romflag}';
$romflag = 0;
break;
case 2:
$where = ' AND rom_flag = {int:romflag}';
$romflag = 1;
$included_game_types[] = 'rom';
break;
case 3:
$where = '';
$romflag = 0;
break;
default:
$romflag = 0;
if (allowedTo('arcade_view_retro_arch')) {
$where = '';
}
else {
$where = ' AND rom_flag = {int:romflag}';
}
}
list($countz, $gameData, $order) = array(array(), array(), ($gameid == 0 ? 'RAND()' : 'id_game ASC'));
$request = $smcFunc['db_query']('', '
SELECT id_game, extra_data, submit_system, rom_flag, rom_system
FROM {db_prefix}arcade_games
WHERE id_game > {int:idgame} AND enabled = {int:enabled}' . $where . '
ORDER BY ' . $order,
array(
'idgame' => 0,
'enabled' => 1,
'romflag' => $romflag,
)
);

while ($row = $smcFunc['db_fetch_assoc']($request)) {
if (!empty($included_game_types) && $gameTypes != 2 && !in_array($row['submit_system'], $included_game_types))
continue;

if (empty($gameTypes)) {
if ($row['submit_system'] == 'rom' && !allowedTo('arcade_view_retro_arch'))
continue;
elseif (!allowedTo('arcade_play'))
continue;
}
$countz[] = $row['id_game'];
$extraData = unserialize($row['extra_data']);
$extraData['height'] = !empty($extraData['height']) ? preg_replace('/[^0-9]/', '', $extraData['height']) : $minimum_height;
$extraData['width'] = !empty($extraData['width']) ? preg_replace('/[^0-9]/', '', $extraData['width']) : $minimum_width;
$gameData[$row['id_game']] = array('width' => preg_replace('/[^0-9]/', '', $extraData['width']), 'height' => $extraData['height'], 'action' => (!empty($row['rom_flag']) ? 'retro_arch' : 'arcade'), 'rom_system' => (!empty($row['rom_system']) ? $row['rom_system'] : ''));
}
$smcFunc['db_free_result']($request);

$arcadeAllGamesArray = json_encode($countz);
$arcadeAllGamesDimsArray = json_encode($gameData);
$randGameId = array_rand($countz);
$requestGameId = isset($_REQUEST['game']) ? abs((int)$_REQUEST['game']) : abs($gameid);
$ranum = !empty($requestGameId) && in_array($requestGameId, $countz) ? $requestGameId : $countz[$randGameId];
$id = 'x_gameblock' . $gameid . $ranum . '_x';
$romCheck = !empty($gameData[$ranum]['action']) && $gameData[$ranum]['action'] == 'retro_arch' ? 1 : 0;
echo  '
<script type="text/javascript">
var arcadeAllGamesArray = ' . $arcadeAllGamesArray . ';
var arcadeAllGamesDimsArray = ' . $arcadeAllGamesDimsArray . ';
function arcadeResizeIframeBlock(idgamex) {
var arcadeIframBlockId = document.getElementById("' . $id . '");
var arcadeIframBlockContId = document.getElementById("arcCont' . $id . '");
arcadeIframBlockContId.style.overflow = "hidden";
arcadeIframBlockContId.style.height = parseInt(arcadeAllGamesDimsArray[idgamex]["height"]) + "px";
arcadeIframBlockContId.style.minHeight = parseInt(arcadeAllGamesDimsArray[idgamex]["height"]) + "px";
arcadeIframBlockContId.style.maxHeight = parseInt(arcadeAllGamesDimsArray[idgamex]["height"]) + "px";
arcadeIframBlockId.style.overflow = "hidden";
arcadeIframBlockId.style.overflow = "hidden";
arcadeIframBlockId.contentDocument.getElementsByTagName("BODY")[0].style = "overflow: hidden;border: 0px;background: none;";
arcadeIframBlockId.style.visibility = "visible";
}
function arcadeBlockReloadIframeGame() {
var arcadeBlockScrollHeight = document.getElementsByTagName("BODY")[0].scrollHeight;
document.getElementsByTagName("BODY")[0].style.display = "flex";
document.getElementsByTagName("BODY")[0].style.justifyContent = "flex-start";
document.getElementsByTagName("BODY")[0].style.minHeight = arcadeBlockScrollHeight + "px";
document.getElementsByTagName("BODY")[0].style.overflowY = "auto";
document.getElementsByTagName("BODY")[0].style.flex = "1";
document.getElementsByTagName("BODY")[0].style.flexFlow = "column nowrap";
var arcadeIframBlockId = document.getElementById("' . $id . '");
var newRandomArcadeGame = Math.floor(Math.random() * arcadeAllGamesArray.length);
var arcadeBlockRandomReplay = ' . (!empty($randomReplay) ? '1' : '0') . ' == 1 ? arcadeAllGamesArray[newRandomArcadeGame] : ' . $ranum . ';
arcadeIframBlockId.style.visibility = "hidden";
$("#' . $id . '").attr("src", "' . $scripturl . '?action="+arcadeAllGamesDimsArray[arcadeBlockRandomReplay]["action"]+";sa=play;pop=1;full=1;game=" + arcadeBlockRandomReplay);
arcadeResizeIframeBlock(arcadeAllGamesArray[newRandomArcadeGame]);
}
$(document).ready(function() {
arcadeBlockReloadIframeGame();
});
</script>
<div style="clear: both;margin: 0 auto;width: 100%;overflow: hidden;">
<div style="margin: 0 auto;text-align: center;">
<img onclick="arcadeBlockReloadIframeGame()" src="' . $boardurl . '/Themes/default/images/arc_icons/popup_play_btn.gif" alt="" />
</div>
</div>
<div class="' . $container_class . '" id="arcCont' . $id . '" style="clear: both;margin: 0 auto;display: flex;flex-wrap: wrap;flex-direction: column;height: ' . $gameData[$ranum]['height'] . 'px;min-height: ' . $gameData[$ranum]['height'] . 'px;overflow: hidden;">
<iframe allowtransparency="true" id="' . $id . '" name="' . $id . '" src="#" style="clear: both;border: 0px;flex-grow: 1;overflow: hidden;visibility: hidden;"></iframe>
</div>';
#20
SMF Arcade Block Codes / Horizontal Latest Scores Block
Last post by Chen Zhen - September 13, 2024, 01:12:50 PM
Horizontal javascript marquee: Latest Scores
Version: SMF-Arcade v2.7.0.2+

Use the code content shown below in a php portal block.
Some adjustable variables are at the start of the block code.

PHP Block Code:
/*  Latest High Scores with Icons - Using javascript marquee */
/**************************
set $gameTypes
0 = Permission based
1 = Flash/HTML
2 = ROM only
3 = All game types
**************************/
global $boardurl;
$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} ';
}
}

/* For these dimensions... Set width to what suits your block, set height to what is needed for your images +5 */
$mar_width = 1400;
$mar_height = 55;
$mar_speed = 3;
$mar_pause = 1;

/* Thumbnail dimensions  */
$width = 50;
$height = 50;

/*  Number of scores to display,  games folder, enable thumbnail display */
$no_games = 29;  /* Set 1 to 29 games to display  */
$show_thumbnail = true;

$mar_width = empty($mar_width) || $mar_width > 1400 ? 1400 : abs($mar_width);
$no_games = empty($no_games) || $no_games > 29 ? 29 : abs($no_games);

if ($no_games < 1) {$no_games = 1;}
/*  Execute the function and start the display  */
$display = latest_scores2($no_games, $width, $height, $show_thumbnail, $where, $romflag);
echo '
    <div style="display: flex-block;overflow:hidden;border: 0px;white-space: nowrap;">
        <div style="display: inline;position:relative;width:' . $mar_width . 'px;height:' . $mar_height . 'px;overflow:hidden;">
            <div style="display: inline;position:relative;width:' . $mar_width . 'px;height:' . $mar_height . 'px;">
                <div id="arcadeBlockInnerMarquee" style="position:relative;left:0px;top:0px;" onmouseover="arcadeMarqueeSpeedVar(true)" onmouseout="arcadeMarqueeSpeedVar(false)">
                    <div id="arcadeBlockInnerContainer1" style="display: inline;visibility:hidden;position:relative;"></div>
                </div>
            </div>
        </div>
    </div>';
echo javascript_marquee($display, $mar_width, $mar_height, $mar_speed, $mar_pause, $where, $romflag);

function javascript_marquee($display2, $mar_width, $mar_height, $mar_speed, $mar_pause, $where, $romflag)
{
    echo '
    <script type="text/javascript">
        var marqueewidth = "' . $mar_width . 'px";
        var marqueeheight = "' . $mar_height . 'px";
        var marqueespeed = "' . $mar_speed . '";
        var pauseit = "' . $mar_pause . '";
        var marqueecontentArcade1 = '<span id="arcadeBlockInnerContainer1" style="font-face: Arial;white-space: nowrap;">' . $display2 . '</span>';
        marqueespeed = Math.max(1, marqueespeed-1);
        var copyspeed = marqueespeed;
        var pausespeed = (pauseit==0) ? copyspeed: 0;
        document.getElementById("arcadeBlockInnerContainer1").innerHTML = marqueecontentArcade1;

        var actualwidth = "";
        var cross_marquee, ns_marquee;
        function arcadePopulateBlockContainer1(){
            cross_marquee = document.getElementById("arcadeBlockInnerMarquee");
            cross_marquee.style.left = parseInt(marqueewidth)+8+"px";
            cross_marquee.innerHTML = marqueecontentArcade1;
            actualwidth = document.getElementById("arcadeBlockInnerContainer1") ? document.getElementById("arcadeBlockInnerContainer1").offsetWidth : 0;
            lefttime=setInterval("scrollmarquee()",20);
        }

        function scrollmarquee(){
            if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
                cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+"px";
            else
                cross_marquee.style.left=parseInt(marqueewidth)+8+"px";
        }
        function arcadeMarqueeSpeedVar(pauseitz) {
            if (!pauseitz)
                copyspeed = marqueespeed;
            else {
                copyspeed = pausespeed;
            }
        }
        if (window.addEventListener)
            window.addEventListener("load", arcadePopulateBlockContainer1, false);
        else if (window.attachEvent)
            window.attachEvent("onload", arcadePopulateBlockContainer1);
        else
            window.onload = arcadePopulateBlockContainer1();
    </script>';
}

/*  Function to read the db for latest scores and relevant info */
function latest_scores2($no_games, $width, $height, $show_thumbnail, $where, $romflag)
{
    $start = 0;
    $count = $no_games;
    $display = '&nbsp;';
    $space1 = '<span style="padding-left: 3em;"></span>';
    $space2 = '<span style="padding-left: 14em;"></span>';
    $space3 =  '<span style="padding-left: 1em;"></span>';
  /* show latest high scores */
    global $smcFunc, $scripturl, $db_prefix, $txt, $arcadeModSettings;

    $result = $smcFunc['db_query']('', '
        SELECT game.id_game, game.game_name, game.thumbnail, game.game_directory, score.score, score.position, game.rom_flag,
        IFNULL(mem.id_member, 0) AS id_member, IFNULL(mem.real_name, score.player_name) AS real_name,  score.end_time
        FROM {db_prefix}arcade_scores AS score
        INNER JOIN {db_prefix}arcade_games AS game ON (game.id_game = score.id_game)
        LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = score.id_member)
        ' . $where . 'ORDER BY end_time DESC
        LIMIT {int:start}, {int:count}',
        array(
            'start' => $start,
            'count' => $count,
            'empty' => '',
'romflag' => $romflag,
        )
    );

    while ($game = $smcFunc['db_fetch_assoc']($result))
    {
$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'];

        $scoring = '<a style="padding: 0.075em 0em 0.075em 0em;" href="'.$scripturl.'?action=arcade;sa=highscore;game='.$game['id_game'].'">Scored: '. $game['score'].'</a>';
        $thumb = '';
        if ($show_thumbnail == true)
            $thumb = '<a href="'.$scripturl.'?action=' . $action . ';sa=play;game='.$game['id_game'].'"><img src="'.$game_thumb.'" style="border: 0px;height: ' . $height . 'px;width: ' . $width . 'px;" alt="'.$game['game_name'].'" title="Play '.$game['game_name'].'" /></a>' . $space3;

        $display .= $thumb . '<span style="width: 14em;min-width: 14em;"><span style="max-width: 12em;line-height: 98%;min-height: ' . $height . 'px;vertical-align: middle;position: absolute;padding: 0.15em 0em 0.15em 0em;"><a style="vertical-align: middle;padding: 0.075em 0em 0.075em 0em;" href="'.$scripturl.'?action=arcade;sa=play;game='.$game['id_game'].'">' . $game['game_name'] . '</a><span style="display: block;"></span><a style="padding: 0.075em 0em 0.075em 0em;" href="'.$scripturl.'?action=profile;u='.$game['id_member'].'">' . $game['real_name'] . '</a><span style="display: block;"></span>' . $scoring . '</span></span>' . $space2;

    }
    $smcFunc['db_free_result']($result);
    return $display;
}