Ticket #9833: mythweb_timeformat_session.patch

File mythweb_timeformat_session.patch, 3.8 KB (added by Martin Bene <myth@…>, 4 years ago)

fix date/time format handling in mythweb

  • classes/Translate.php

    diff -ur mythweb/classes/Translate.php mythweb.mbe/classes/Translate.php
    old new  
    197197            trigger_error('No language strings defined.', FATAL);
    198198
    199199    // Generate the date formats
    200         $_SESSION['date_statusbar']       = $this->string('generic_date').', '.$this->string('generic_time');
    201         $_SESSION['date_scheduled']       = $this->string('generic_date').' ('.$this->string('generic_time').')';
    202         $_SESSION['date_scheduled_popup'] = $this->string('generic_date');
    203         $_SESSION['date_recorded']        = $this->string('generic_date').' ('.$this->string('generic_time').')';
    204         $_SESSION['date_search']          = $this->string('generic_date').', '.$this->string('generic_time');
    205         $_SESSION['date_listing_key']     = $this->string('generic_date').', '.$this->string('generic_time');
    206         $_SESSION['date_listing_jump']    = $this->string('generic_date');
    207         $_SESSION['date_channel_jump']    = $this->string('generic_date');
    208         $_SESSION['date_job_status']      = $this->string('generic_date').', '.$this->string('generic_time');
    209         $_SESSION['time_format']          = $this->string('generic_time');
     200        empty($_SESSION['date_statusbar'])      && $_SESSION['date_statusbar']       = $this->string('generic_date').', '.$this->string('generic_time');
     201        empty($_SESSION['date_scheduled'])      && $_SESSION['date_scheduled']       = $this->string('generic_date').' ('.$this->string('generic_time').')';
     202        empty($_SESSION['date_scheduled_popup'])&& $_SESSION['date_scheduled_popup'] = $this->string('generic_date');
     203        empty($_SESSION['date_recorded'])       && $_SESSION['date_recorded']        = $this->string('generic_date').' ('.$this->string('generic_time').')';
     204        empty($_SESSION['date_search'])         && $_SESSION['date_search']          = $this->string('generic_date').', '.$this->string('generic_time');
     205        empty($_SESSION['date_listing_key'])    && $_SESSION['date_listing_key']     = $this->string('generic_date').', '.$this->string('generic_time');
     206        empty($_SESSION['date_listing_jump'])   && $_SESSION['date_listing_jump']    = $this->string('generic_date');
     207        empty($_SESSION['date_channel_jump'])   && $_SESSION['date_channel_jump']    = $this->string('generic_date');
     208        empty($_SESSION['date_job_status'])     && $_SESSION['date_job_status']      = $this->string('generic_date').', '.$this->string('generic_time');
     209        empty($_SESSION['time_format'])         && $_SESSION['time_format']          = $this->string('generic_time');
    210210
    211211        $this->currentLanguage = $language;
    212212    }
  • modules/mythweb/set_session.php

    diff -ur mythweb/modules/mythweb/set_session.php mythweb.mbe/modules/mythweb/set_session.php
    old new  
    2626    // Change language?  Make sure we load the new translation file, too.
    2727        if ($_POST['language'] && $_POST['language'] != $_SESSION['language']){
    2828            $_SESSION['language'] = $_POST['language'];
     29            // Unset the date/time formats in session so translation can fill in the
     30            // language specific defaults
     31            unset($_SESSION['date_statusbar']);
     32            unset($_SESSION['date_scheduled']);
     33            unset($_SESSION['date_scheduled_popup']);
     34            unset($_SESSION['date_recorded']);
     35            unset($_SESSION['date_search']);
     36            unset($_SESSION['date_listing_key']);
     37            unset($_SESSION['date_listing_jump']);
     38            unset($_SESSION['date_channel_jump']);
     39            unset($_SESSION['date_job_status']);
     40            unset($_SESSION['time_format']);
    2941            Translate::find()->load_translation();
    3042        }