+-

SMFHacks.com

+- User Information

Welcome, Guest.
Please login or register.
 
 
 
Forgot your password?

+- Forum Stats

Members
Total Members: 4257
Latest: Alex998.
New This Month: 1
New This Week: 0
New Today: 0
Stats
Total Posts: 43295
Total Topics: 7523
Most Online Today: 212
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 0
Guests: 203
Total: 203

Forum > Support

problem adding ads on specifical boards / adseller2.php

(1/2) > >>

kohai.raul:
Hi all!

My site makes use of TinyPortal and PrettyURL. I tried for some days adding some ads to specifical boards, without luck!.

So I decided to test the source code and I've seen some strange behavior on ShowAdLocation() function (at Sources/adseller2.php)

Around line 2480, we can see:


--- Code: ---
if (isset($_REQUEST['board']) || !empty($board))
{

if (!empty($board))
$bID = (int) $board;
else
$bID = (int) $_REQUEST['board'];



$boardCheck = " AND ((l.showinallboards = 1 OR  FIND_IN_SET($bID, l.boards)) AND (a.showinallboards = 1 OR  FIND_IN_SET($bID, a.boards))) ";
}
--- End code ---

By testing the values of  REQUEST['board'] and bID, I've seen the following:


--- Code: ---       

            [REQUEST_board] => 150
            [board] => Array
                (
                    [id] => 62
                    [name] => Cliparts imágenes longitudinales
                    [child_level] => 2
                    [selected] =>
                )

--- End code ---

the correct value is on Request_board. I don't understand why bID = 62, because it does not corresponds to the current board.

The solution applied was to substitute this portion of code by:


--- Code: --- if (isset($_REQUEST['board']))
{

  $bID = (int) $_REQUEST['board'];



$boardCheck = " AND ((l.showinallboards = 1 OR  FIND_IN_SET($bID, l.boards)) AND (a.showinallboards = 1 OR  FIND_IN_SET($bID, a.boards))) ";
}

--- End code ---

Depending totally on board parameter from request.

Has anyone experienced a similar situation?

Best Regards,

SMFHacks:
The request [board] should never be an array.
Not sure where [REQUEST_board] is coming from is that from Tiny Portal?

kohai.raul:
Hi,

I think it corresponds to the "board" parameter,

http://mydomain.com?board=X

I've needed move the adSeller snippets from Themes/default/messageindex.template.php to Themes/reseller/messageindex.template.php

maybe it's a problem introduced by Reseller  (a responsive theme)...

kohai.raul:
I'm Sorry!

when I said about [board] => array (...) I meant $board at the following portion of code:


--- Code: ---...
if (!empty($board))
$bID = (int) $board;
...

--- End code ---



kohai.raul:
Hi all!

By now, basing on original code on ShowAdLocation:


--- Code: ---global ..., $board, ...;


if (isset($_REQUEST['board']) || !empty($board))
{

if (!empty($board))
$bID = (int) $board;
else
$bID = (int) $_REQUEST['board'];



$boardCheck = " AND ((l.showinallboards = 1 OR  FIND_IN_SET($bID, l.boards)) AND (a.showinallboards = 1 OR  FIND_IN_SET($bID, a.boards))) ";
}

--- End code ---

By reviewing default/MessageIndex.template.php and reseller/MessageIndex.template.php, the only $board var I've seen in both, corresponds to a previous iteration:


--- Code: ---...
foreach ($context['boards'] as $board)
{

...
                 } //end foreach


 showAdLocation(...);


--- End code ---

And it's always empty. But this global var applies to BoardsIndex.template.php, where $boards gets the following structure:


--- Quote ---[boards] => Array
                        (
                            [150] => Array
                                (
                                    [new] =>
                                    [id] => 150
                                    [name] => Preséntate. El sitio de partida
                                    [description] => Visible sólo para usuarios registrados. Preséntate y cuéntanos cuál es tu relación o expectativas con respecto a la permacultura.
                                    [moderators] => Array
                                        (
                                        )

                                    [link_moderators] => Array
                                        (
                                        )

                                    [children] => Array
                                        (
                                        )

                                    [link_children] => Array
                                        (
                                        )

                                    [children_new] =>
                                    [topics] => 42
                                    [posts] => 478
                                    [is_redirect] => 0
                                    [unapproved_topics] => 0
                                    [unapproved_posts] => 0
                                    [can_approve_posts] => 1
                                    [href] =>index.php?board=150.0
                                    [link] => Preséntate. El sitio de partida
                                    [last_post] => Array
                                        (
                                            [id] => 11279
                                            [time] => 19 Agosto de 2014, 03:55:26 pm
                                            [timestamp] => 1408456526
                                            [subject] => Re:Nuevo en el foro
                                            [member] => Array
                                                (
                                                    [id] => 9803
                                                    [username] => Isma
                                                    [name] => Isma
                                                    [href] => index.php?action=profile;u=9803
                                                    [link] => Isma
                                                )

                                            [start] => msg11951
                                            [topic] => 2553
                                            [href] => index.php?topic=2553.msg11951#new
                                            [link] => Re:Nuevo en el foro
                                        )

                                )

                            [151] => Array
                                (...)
    )

--- End quote ---

But it's not usable by ShowAdLocation in this situation...

So, from this point I don't understand the reason why ShowAdLocation makes use of global $board... it seems an unusable case...

what do you think about this???

Best Regards,

Navigation

[0] Message Index

[#] Next page

+- Recent Topics

Please Help! by SMFHacks
April 17, 2024, 08:04:55 am

Rate own images by fvlog19
April 11, 2024, 10:56:53 am

Tidy Child Boards on 2.1.4 by SMFHacks
April 04, 2024, 03:54:12 pm

Problems SMF 2.0.19 > 2.1.4 SMF Gallery Pro - Recents Images to overall header by Michel68
March 30, 2024, 12:41:08 pm

Can't DROP 'id_member'; check that column/key exists Datei: by SMFHacks
March 30, 2024, 11:58:20 am

No thumbnails on new uploads by Tonyvic
March 29, 2024, 06:26:18 am

Display the Contact Page for guests by SMFHacks
March 27, 2024, 10:55:43 am

is it possible to add support for odysee.com by fvlog19
March 21, 2024, 08:47:51 am

Request for admin notification by davejo
March 10, 2024, 01:31:59 am

I need help with torrent upload by Ineedsmfhelp
March 09, 2024, 10:01:13 pm

Powered by EzPortal
Go to full version