Facebook  Twitter 

SMFHacks.com

+- +-

SMFHacks.com

+- User Information

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

+- Forum Stats

Members
Total Members: 12356
Latest: Hermankidd
New This Month: 7
New This Week: 0
New Today: 0
Stats
Total Posts: 39780
Total Topics: 7006
Most Online Today: 27
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 0
Guests: 42
Total: 42

Author Topic: problem adding ads on specifical boards / adseller2.php  (Read 2880 times)

0 Members and 1 Guest are viewing this topic.

Offline kohai.raul

  • Newbie
  • *
  • Posts: 9
    • View Profile
problem adding ads on specifical boards / adseller2.php
« on: March 01, 2016, 11:38:06 am »
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: [Select]

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))) ";
}

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

Code: [Select]
       

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

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: [Select]
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))) ";
}

Depending totally on board parameter from request.

Has anyone experienced a similar situation?

Best Regards,

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 14904
    • View Profile
Re: problem adding ads on specifical boards / adseller2.php
« Reply #1 on: March 01, 2016, 12:00:13 pm »
The request [board] should never be an array.
Not sure where [REQUEST_board] is coming from is that from Tiny Portal?
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline kohai.raul

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: problem adding ads on specifical boards / adseller2.php
« Reply #2 on: March 01, 2016, 12:07:59 pm »
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)...


Offline kohai.raul

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: problem adding ads on specifical boards / adseller2.php
« Reply #3 on: March 01, 2016, 12:09:53 pm »
I'm Sorry!

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

Code: [Select]
...
if (!empty($board))
$bID = (int) $board;
...



« Last Edit: March 01, 2016, 12:11:24 pm by kohai.raul »

Offline kohai.raul

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: problem adding ads on specifical boards / adseller2.php
« Reply #4 on: March 02, 2016, 04:51:02 am »
Hi all!

By now, basing on original code on ShowAdLocation:

Code: [Select]
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))) ";
}

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: [Select]
...
foreach ($context['boards'] as $board)
{

...
                 } //end foreach


 showAdLocation(...);


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
                                (...)
    )

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,
« Last Edit: March 02, 2016, 04:54:39 am by kohai.raul »

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 14904
    • View Profile
Re: problem adding ads on specifical boards / adseller2.php
« Reply #5 on: March 02, 2016, 07:57:07 am »
Hmm never noticed it before
What you can do is change your ShowAdLocation(###)
To

ShowAdLocation(###,$_REQUEST['board'])

In the messageindex area at least and that will fix that issue.
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline kohai.raul

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: problem adding ads on specifical boards / adseller2.php
« Reply #6 on: March 03, 2016, 03:11:11 am »
Thanks, but I tested before. It works well in case of "Top Message Index" and " Bottom Message Index", but I've detected that another ads on Tiny-Portal's Blocks and customised locations that must be visible in the context of MessageIndex, they were not.

Definitely by changing the mentioned piece of code for the following, works great in my case:

Code: [Select]


        if (isset($_REQUEST['board'])){
$bID = (int) $_REQUEST['board'];
}


I'm not sure, but maybe this behavior is connected with my own scenario and it don't applies to common situations.  It's a behavior don't detected before on AdSeller and this seems strange.

best regards,
« Last Edit: March 03, 2016, 03:30:21 am by kohai.raul »

 

Related Topics

  Subject / Started by Replies Last post
2 Replies
5404 Views
Last post May 28, 2006, 04:08:58 am
by gamesmad
5 Replies
5661 Views
Last post September 15, 2007, 10:41:18 am
by SMFHacks
2 Replies
3157 Views
Last post October 15, 2007, 07:32:45 pm
by merosler
1 Replies
3412 Views
Last post November 15, 2008, 02:03:25 pm
by SMFHacks
2 Replies
2332 Views
Last post June 20, 2010, 11:40:37 pm
by Cutter

+- Recent Topics

[Mod]Login Menu Button by SMFHacks
July 05, 2019, 03:26:24 pm

Update by SMFHacks
June 19, 2019, 10:58:25 am

About Comments Approval by ajac63
June 12, 2019, 07:48:52 pm

Pretty Urls extras by SMFHacks
June 06, 2019, 12:14:53 pm

About using chmod to secure files by ajac63
June 05, 2019, 04:02:28 am

Bulk upload image problem by SMFHacks
June 01, 2019, 07:24:00 pm

About Watermark Options by ajac63
May 30, 2019, 05:25:39 pm

Why PayPal only by ajac63
May 30, 2019, 04:20:47 pm

Seller ToU not showing by ajac63
May 29, 2019, 01:59:24 am

Not happy by ajac63
May 28, 2019, 06:37:58 pm

Powered by EzPortal