Errore Chat

Funzionalità di frontend per utenti e amministratori dei corsi: navigazione generale, materiali didattici, test, registro valutazioni, ecc.
alfa24
Senior Boarder
Posts: 621
Joined: Fri Nov 24, 2017 8:45 am
Version: forma.lms 1.4.2

Re: Errore Chat

Post by alfa24 »

Si tratta di come è scritta la funzione jump_to nella classe Utils (il file è quello che ho indicato).
I'm Jasmines, the One. If you need, you can contact me.

toni
Newbie
Posts: 4
Joined: Sun Mar 22, 2020 6:55 pm

Re: Errore Chat

Post 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!

alfa24
Senior Boarder
Posts: 621
Joined: Fri Nov 24, 2017 8:45 am
Version: forma.lms 1.4.2

Re: Errore Chat

Post 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();
    }
I'm Jasmines, the One. If you need, you can contact me.

toni
Newbie
Posts: 4
Joined: Sun Mar 22, 2020 6:55 pm

Re: Errore Chat

Post by toni »

Grazie!!!!

User avatar
pexlex
FormaLms User
Posts: 93
Joined: Wed Sep 09, 2015 11:56 pm
Version: forma.lms 2.0

Re: Errore Chat

Post by pexlex »

Grazie ragazzi !

Post Reply