The Elearning Community • Errore Chat - Page 2
Page 2 of 2

Re: Errore Chat

Posted: Mon Mar 23, 2020 11:57 am
by alfa24
Si tratta di come è scritta la funzione jump_to nella classe Utils (il file è quello che ho indicato).

Re: Errore Chat

Posted: Mon Mar 23, 2020 12:08 pm
by toni
risolto!!!

sostituire in /lib/lib.utils.php:

public static function jump_to($relative_url, $anchor = '') {

$relative_url = trim(str_replace('&', '&', $relative_url));

session_write_close();

$url = Get::abs_path() . $relative_url . $anchor;
Header("Location: $url");

ob_clean();
exit();

con:

public static function jump_to($relative_url, $anchor = false) {

$relative_url = trim(str_replace('&', '&', $relative_url));

session_write_close();
Header('Location: http' . ( isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 's' : '' ).'://'.$_SERVER['HTTP_HOST']
.( strlen(dirname($_SERVER['SCRIPT_NAME'])) != 1 ? dirname($_SERVER['SCRIPT_NAME']) : '' )
.'/'.$relative_url
//.( strpos($relative_url, '?') === false ? '?' : '&' ).session_name().'='.session_id()

.( $anchor !== false ? $anchor : '' ) );
ob_clean();
exit();


Grazie!

Re: Errore Chat

Posted: Mon Mar 23, 2020 2:32 pm
by alfa24
Ottimo, complimenti.
Mi permetto di ottimizzare:

Code: Select all

public static function jump_to($relative_url, $anchor = false)
    {
        $relative_url = trim(str_replace('&', '&', $relative_url));

        session_write_close();

        Header('Location: http' . (((isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on')
                                  or (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) == 'https')
                                  or (isset($_SERVER['HTTP_FRONT_END_HTTPS']) && strtolower($_SERVER['HTTP_FRONT_END_HTTPS']) == 'on')) ? 's' : '').'://'
             .((isset($_SERVER['HTTP_X_FORWARDED_HOST'])) ? $_SERVER['HTTP_X_FORWARDED_HOST'] : $_SERVER['HTTP_HOST'])
            .(strlen(dirname($_SERVER['SCRIPT_NAME'])) != 1 ? dirname($_SERVER['SCRIPT_NAME']) : '')
            .'/'.$relative_url
            .($anchor !== false ? $anchor : ''));
        ob_clean();
        exit();
    }

Re: Errore Chat

Posted: Mon Mar 23, 2020 5:16 pm
by toni
Grazie!!!!

Re: Errore Chat

Posted: Thu Mar 26, 2020 12:20 am
by pexlex
Grazie ragazzi !

This site uses cookies.

Some of the cookies we use are essential for parts of the site to operate and have already been set. We also use Google Analytics scripts, which all use cookies.
You may delete or block all cookies from this site in your browser options.