plugins/SpecialUserFuncs.php
changeset 542 5841df0ab575
parent 541 acb7e23b6ffa
child 555 ac4c6a7f01d8
equal deleted inserted replaced
541:acb7e23b6ffa 542:5841df0ab575
  2012   if ( $lang->lang_id == $lang_id )
  2012   if ( $lang->lang_id == $lang_id )
  2013     $lang_local =& $lang;
  2013     $lang_local =& $lang;
  2014   else
  2014   else
  2015     $lang_local = new Language($lang_id);
  2015     $lang_local = new Language($lang_id);
  2016   
  2016   
       
  2017   $lang_strings = enano_json_encode($lang_local->strings);
       
  2018   $etag = substr(sha1($lang_strings), 0, 20) . '-' . dechex($lang_local->lang_timestamp);
       
  2019   
       
  2020   if ( isset($_SERVER['HTTP_IF_NONE_MATCH']) )
       
  2021   {
       
  2022     if ( "\"$etag\"" == $_SERVER['HTTP_IF_NONE_MATCH'] )
       
  2023     {
       
  2024       header('HTTP/1.1 304 Not Modified');
       
  2025       exit();
       
  2026     }
       
  2027   }
  2017   
  2028   
  2018   $timestamp = enano_date('D, j M Y H:i:s T', $lang_local->lang_timestamp);
  2029   $timestamp = enano_date('D, j M Y H:i:s T', $lang_local->lang_timestamp);
  2019   header("Last-Modified: $timestamp");
  2030   header("Last-Modified: $timestamp");
  2020   header("Date: $timestamp");
  2031   header("Date: $timestamp");
       
  2032   header("ETag: \"$etag\"");
  2021   header('Content-type: text/javascript');
  2033   header('Content-type: text/javascript');
  2022   
  2034   
  2023   $lang_local->fetch();
  2035   $lang_local->fetch();
  2024   echo "if ( typeof(enano_lang) != 'object' )
  2036   echo "if ( typeof(enano_lang) != 'object' )
  2025   var enano_lang = new Object();
  2037   var enano_lang = new Object();
  2026 
  2038 
  2027 enano_lang[{$lang->lang_id}] = " . enano_json_encode($lang_local->strings) . ";";
  2039 enano_lang[{$lang->lang_id}] = " . $lang_strings . ";";
  2028   
  2040   
       
  2041   exit(0);
  2029 }
  2042 }
  2030 
  2043 
  2031 /**
  2044 /**
  2032  * Fetches and displays an avatar from the filesystem. Avatar fetching is abstracted as of 1.1.4.
  2045  * Fetches and displays an avatar from the filesystem. Avatar fetching is abstracted as of 1.1.4.
  2033  */
  2046  */