Facebook  Twitter 

SMFHacks.com

+- +-

SMFHacks.com

+- User Information

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

+- Forum Stats

Members
Total Members: 12404
Latest: azaratir
New This Month: 10
New This Week: 0
New Today: 0
Stats
Total Posts: 39925
Total Topics: 7028
Most Online Today: 109
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 1
Guests: 23
Total: 24

Author Topic: problem adding ads on specifical boards / adseller2.php  (Read 3050 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: 14969
    • 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: 14969
    • 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
5479 Views
Last post May 28, 2006, 04:08:58 am
by gamesmad
5 Replies
5730 Views
Last post September 15, 2007, 10:41:18 am
by SMFHacks
2 Replies
3205 Views
Last post October 15, 2007, 07:32:45 pm
by merosler
1 Replies
3463 Views
Last post November 15, 2008, 02:03:25 pm
by SMFHacks
2 Replies
2416 Views
Last post June 20, 2010, 11:40:37 pm
by Cutter

+- Recent Topics

Update detect mobile mode PHP5 to PHP7 by Rock Lee
November 16, 2019, 07:18:13 pm

PHP error by davejo
November 12, 2019, 12:09:47 pm

Message Editor Pro Issues by SMFHacks
November 06, 2019, 09:58:33 pm

most popular categories doesnt work by fussilet
November 02, 2019, 02:51:42 pm

Change colors of Halloween theme by SMFHacks
October 24, 2019, 11:44:59 am

prettyurls - TroubleShooting.wiki by Rock Lee
October 10, 2019, 11:37:09 am

Some issues with adding and editing a listing by ajac63
October 07, 2019, 04:16:40 am

Problem update 1.1.21 to 2.0.15 by Rock Lee
October 06, 2019, 06:09:16 pm

[Mod]SMF 2.0.x PHP 7.2 Support by sah62
October 04, 2019, 01:46:00 pm

Ideas by shuban
October 03, 2019, 10:19:06 pm

Powered by EzPortal