value tossing :)

Started by texasman1979, March 10, 2011, 03:18:44 PM

Previous topic - Next topic

texasman1979

the board id is caught and placed in a url to a custom file:
    $url = 'http://www.myfewclicks.com/CBE.php?rc=' . $context['active_rc']['reg_code'] . '&b=' . $brd;

    $context['forBlock']['footer'] = !$context['user']['is_admin'] ? '' : '
        <div style="float:right">
            <br class="clear" /><br class="clear" />
            <a href="' . $url . '">Edit This!</a>
        </div>
        ';


and it is received upon clicking here:
if (isset($_GET['rc'], $_GET['b']))
{
    require_once($sourcedir . '/region_code.php');
   
    Fill_Content_Block($_GET['rc'], $_GET['b']);


the function in question is:
//fills the forum block
function Fill_Content_Block($rc, $b)
{
    global $context, $board_info, $smcFunc;

    $brd = !empty($b) ? $b : empty($board_info['id']) ? 'forum' : $board_info['id'];

    $rdb = $smcFunc['db_query']('', '
        SELECT content
        FROM {db_prefix}content_blocks
        WHERE reg_code = {string:rc} AND board_id = {string:b_id}',
        array(
            'rc' => !empty($rc) ? $rc : $context['active_rc']['reg_code'],
            'b_id' => $brd,
            )
    );
   
    $row = $smcFunc['db_num_rows']($rdb) > 0 ? $smcFunc['db_fetch_assoc']($rdb) : false;
    $smcFunc['db_free_result']($rdb);

    $context['forBlock']['content'] = $row != false ? $row['content'] : 'some content.';

    if (!empty($rc) && !empty($b))
        return;

    if (isset($board_info['id']))
        if ($board_info['child_level'] > 0)
            $context['forBlock']['header'] = $board_info['parent_boards'][$board_info['parent']]['name'] . ' - ' . $board_info['name'];
        else
            $context['forBlock']['header'] = $board_info['cat']['name'] . ' - ' . $board_info['name'];
    else
        $context['forBlock']['header'] = 'Myfewclicks.com Discussion Forum';

    $url = 'http://www.myfewclicks.com/CBE.php?rc=' . $context['active_rc']['reg_code'] . '&b=' . $brd;

    $context['forBlock']['footer'] = !$context['user']['is_admin'] ? '' : '
        <div style="float:right">
            <br class="clear" /><br class="clear" />
            <a href="' . $url . '">Edit This!</a>
        </div>
        ';
}


i dont understand how the board id is getting lost. im passing it along with perfectly normal passing methods. where is the board id number going? lol
SMF 2.0.4
SimplePortal 2.3.5

LOGIC is a FOUR letter word! :)


Arantor

Does the URL contain ?board= or ?topic= because if not, $board_info will not be defined.
Holder of controversial views, all of which my own.


texasman1979

if $b is defined, it should never get to $board_info.

but what is happening, that line of code is for some reason defaulting to 'forum' every time i call it from my custom php file. but i am then supplying $b, so it should work. but it doesnt. it keeps getting lost in that statement.

the url is created here:
    $url = 'http://www.myfewclicks.com/CBE.php?rc=' . $context['active_rc']['reg_code'] . '&b=' . $brd;

    $context['forBlock']['footer'] = !$context['user']['is_admin'] ? '' : '
        <div style="float:right">
            <br class="clear" /><br class="clear" />
            <a href="' . $url . '">Edit This!</a>
        </div>
        ';


then those values are sent back to the function here:
Fill_Content_Block($_GET['rc'], $_GET['b']);

the code:
$brd = !empty($b) ? $b : empty($board_info['id']) ? 'forum' : $board_info['id'];
should work fine, but it doesnt.
SMF 2.0.4
SimplePortal 2.3.5

LOGIC is a FOUR letter word! :)


Arantor

Before calling your function, var_dump the contents of $_GET['b']
Holder of controversial views, all of which my own.


texasman1979

the code that i was needing i just moved to the custom php file and it works now, im not at all sure what the glitch is but problem solved.

thx for input
SMF 2.0.4
SimplePortal 2.3.5

LOGIC is a FOUR letter word! :)


Advertisement: