Redirect page issue

A place to report and discuss bugs - please mention CMSimple-version, server, platform and browser version
cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Redirect page issue

Post by cmb » Mon Feb 10, 2014 6:52 pm

milkodb wrote:Then, I did some testing on codes of xtoc replacing instructions of the type ereg_ with the recommended ones. Although he is using PHP 3.5.28 have occurred from time to time inconsistencies. The tests are done on Firefox, Opera and Chrome, latest releases , and the result is not equal for everyone.

It ' possible that this is due to some configuration on the server side or more likely by the browser?
Well, I suppose you mean PHP 5.3.28. As far as I can tell it's pretty unlikely that the issues are caused by the server side configuration, and even more so that they are related to the browser.

Please try the following function. I have reformatted it for better readability, and replaced ereg_replace() with str_replace(), eregi_replace() with str_ireplace() and eregi() with stripos(). However, I have not tested it.

Code: Select all

function xli($ts_ta, $ts_st)
{
    global $s, $c, $l, $h, $hc, $hl, $edit, $pd_router;
    if (count($ts_ta) == 0)
        return;
    $ts_t = '';
    if ($ts_st == 'submenu' || $ts_st == 'search')
        $ts_t .= '<ul class="' . $ts_st . '">';
    $b = 0;
    if ($ts_st == 1 || $ts_st == 2 || $ts_st == 3) {
        $b     = $ts_st - 1;
        $ts_st = 'menulevel';
    }
    $ts_j  = 0;
    $le    = 0;
    $lf[0] = $lf[1] = $lf[2] = $lf[3] = false;
    for ($ts_i = 0; $ts_i < $hl; $ts_i++) {
        if (!isset($ts_ta[$ts_j]))
            break;
        if ($hc[$ts_i] != $ts_ta[$ts_j])
            continue;
        $ts_tf = ($s != $ts_ta[$ts_j]);
        if ($ts_st == 'menulevel' || $ts_st == 'sitemaplevel') {
            for ($k = (isset($ts_ta[$ts_j - 1]) ? $l[$ts_ta[$ts_j - 1]] : $b); $k < $l[$ts_ta[$ts_j]]; $k++)
                $ts_t .= '<ul class="' . $ts_st . ($k + 1) . '">';
        }
        if (stripos($h[$ts_ta[$ts_j]], 'category_') !== false) {
            $ts_t .= '<li class="category">';
        } elseif (stripos($h[$ts_ta[$ts_j]], 'break_') !== false) {
            $ts_t .= '<li class="break">';
        } else {
            $ts_t .= '<li class="';
            if (!$ts_tf)
                $ts_t .= 's';
            $ts_t .= 'doc';
            if (isset($hc[$ts_i + 1]))
                if ($l[$hc[$ts_i + 1]] > $l[$ts_ta[$ts_j]])
                    $ts_t .= 's';
            $ts_t .= '">';
        }
        if (stripos($h[$ts_ta[$ts_j]], 'break_') !== false) {
            if (str_ireplace('break_', '', $h[$ts_ta[$ts_j]]) || str_ireplace('break_', '', $h[$ts_ta[$ts_j]]) == '') {
                $ts_t .= '&nbsp;';
            }
        } elseif (stripos($h[$ts_ta[$ts_j]], 'category_') !== false) {
            if (str_ireplace('_', ' ', str_ireplace('category_', '', $h[$ts_ta[$ts_j]])) == '') {
                $ts_t .= '&nbsp;';
            } else {
                $ts_t .= str_replace('_', ' ', str_ireplace('category_', '', $h[$ts_ta[$ts_j]]));
            }
        } else {
            /*if($ts_tf)*/
            $pageData = $pd_router->find_page($ts_ta[$ts_j]);
            $ts_x     = !(XH_ADM && $edit) && $pageData['use_header_location'] === '2' ? '" target="_blank' : '';
            $ts_t .= a($ts_ta[$ts_j], $ts_x);
            $ts_t .= $h[$ts_ta[$ts_j]];
            /*if($ts_tf)*/
            $ts_t .= '</a>';
        }
        if ($ts_st == 'menulevel' || $ts_st == 'sitemaplevel') {
            if ((isset($ts_ta[$ts_j + 1]) ? $l[$ts_ta[$ts_j + 1]] : $b) > $l[$ts_ta[$ts_j]])
                $lf[$l[$ts_ta[$ts_j]]] = true;
            else {
                $ts_t .= '</li>';
                $lf[$l[$ts_ta[$ts_j]]] = false;
            }
            for ($k = $l[$ts_ta[$ts_j]]; $k > (isset($ts_ta[$ts_j + 1]) ? $l[$ts_ta[$ts_j + 1]] : $b); $k--) {
                $ts_t .= '</ul>';
                if ($lf[$k - 1]) {
                    $ts_t .= '</li>';
                    $lf[$k - 1] = false;
                }
            }
            ;
        } else
            $ts_t .= '</li>';
        $ts_j++;
    }
    if ($ts_st == 'submenu' || $ts_st == 'search')
        $ts_t .= '</ul>';
    return $ts_t;
}
Christoph M. Becker – Plugins for CMSimple_XH

milkodb
Posts: 47
Joined: Sun Jun 23, 2013 11:00 pm
Location: Italy

Re: Redirect page issue

Post by milkodb » Mon Feb 10, 2014 7:17 pm

Yes, "5.3.28", a classic typing error...

in a little 'I feel and then tell you what happens.

thanks
Milko

milkodb
Posts: 47
Joined: Sun Jun 23, 2013 11:00 pm
Location: Italy

Re: Redirect page issue

Post by milkodb » Tue Feb 18, 2014 1:55 am

...I,ve tried your code and all works.
The problem was about a configuration error on the server side.

Thanks


Milko
Milko

Post Reply