Rev 189 | Rev 210 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 189 | Rev 191 | ||
|---|---|---|---|
| 1 | <?php
 | 
            1 | <?php
 | 
          
| 2 | 2 | ||
| 3 | $encoding = 'UTF-8';  | 
            3 | $encoding = 'UTF-8';  | 
          
| 4 | header("Content-Type: text/html" . ($encoding ? "; charset=$encoding" : ""));  | 
            4 | header("Content-Type: text/html" . ($encoding ? "; charset=$encoding" : ""));  | 
          
| 5 | 5 | ||
| 6 | $modi = max(array(  | 
            6 | $modi = max(array(  | 
          
| 7 | @filemtime(__FILE__),  | 
            7 | @filemtime(__FILE__),  | 
          
| 8 | @filemtime('LocaleData'),  | 
            8 | @filemtime('LocaleData'),  | 
          
| 9 | @filemtime('index.phtml'),  | 
            9 | @filemtime('index.phtml'),  | 
          
| 10 | @filemtime('footer.phtml'),  | 
            10 | @filemtime('footer.phtml'),  | 
          
| 11 | @filemtime('styles/lcars-basic.css'),  | 
            11 | @filemtime('styles/lcars-basic.css'),  | 
          
| 12 | @filemtime('styles/lcars22.css'),  | 
            12 | @filemtime('styles/lcars22.css'),  | 
          
| 13 | @filemtime('styles/lcars22-ie6.css'),  | 
            13 | @filemtime('styles/lcars22-ie6.css'),  | 
          
| 14 | @filemtime('styles/lcars-ani.css'),  | 
            14 | @filemtime('styles/lcars-ani.css'),  | 
          
| 15 | @filemtime('scripts/object.js'),  | 
            15 | @filemtime('scripts/object.js'),  | 
          
| 16 | ));  | 
            16 | ));  | 
          
| 17 | 17 | ||
| 18 | header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $modi) . ' GMT');  | 
            18 | header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $modi) . ' GMT');  | 
          
| 19 | 19 | ||
| 20 | /* Cached resource expires in HTTP/1.1 caches 24h after last retrieval */
 | 
            20 | /* Cached resource expires in HTTP/1.1 caches 24h after last retrieval */
 | 
          
| 21 | header('Cache-Control: max-age=86400, s-maxage=86400, must-revalidate, proxy-revalidate');  | 
            21 | header('Cache-Control: max-age=86400, s-maxage=86400, must-revalidate, proxy-revalidate');  | 
          
| 22 | 22 | ||
| 23 | /* Cached resource expires in HTTP/1.0 caches 24h after last retrieval */
 | 
            23 | /* Cached resource expires in HTTP/1.0 caches 24h after last retrieval */
 | 
          
| 24 | header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 86400) . ' GMT');  | 
            24 | header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 86400) . ' GMT');  | 
          
| 25 | 25 | ||
| 26 | $languages = array(  | 
            26 | $languages = array(  | 
          
| 27 | 'en' => 'English',  | 
            27 | 'en' => 'English',  | 
          
| 28 | 'de' => 'Deutsch'  | 
            28 | 'de' => 'Deutsch',  | 
          
| - | 29 | //   'ru' => 'По-русски',
 | 
          |
| 29 | );  | 
            30 | );  | 
          
| 30 | 31 | ||
| 31 | require_once 'Zend/Loader/StandardAutoloader.php';  | 
            32 | require_once 'Zend/Loader/StandardAutoloader.php';  | 
          
| 32 | $loader = new Zend\Loader\StandardAutoloader(array('autoregister_zf' => true));  | 
            33 | $loader = new Zend\Loader\StandardAutoloader(array('autoregister_zf' => true));  | 
          
| 33 | $loader->register();  | 
            34 | $loader->register();  | 
          
| 34 | 35 | ||
| 35 | $translator = new Zend\I18n\Translator\Translator();  | 
            36 | $translator = new Zend\I18n\Translator\Translator();  | 
          
| 36 | // $translator->setCache(new Zend\Cache\Storage\*Adapter());
 | 
            37 | // $translator->setCache(new Zend\Cache\Storage\*Adapter());
 | 
          
| 37 | $type = 'gettext';  | 
            38 | $type = 'gettext';  | 
          
| 38 | $baseDir = './i18n/LocaleData';  | 
            39 | $baseDir = './i18n/LocaleData';  | 
          
| 39 | $pattern = '%s/LC_MESSAGES/%1$s.pointedears.mo';  | 
            - | |
| 40 | $textDomain = 'de.pointedears';  | 
            40 | $textDomain = 'de.pointedears';  | 
          
| - | 41 | $pattern = "%s/LC_MESSAGES/{$textDomain}.mo";  | 
          |
| 41 | $translator->addTranslationFilePattern($type, $baseDir, $pattern, $textDomain);  | 
            42 | $translator->addTranslationFilePattern($type, $baseDir, $pattern, $textDomain);  | 
          
| 42 | 43 | ||
| 43 | /**
 | 
            44 | /**
 | 
          
| 44 |  * Returns the translation of the parameter, if any,
 | 
            45 |  * Returns the translation of the parameter, if any,
 | 
          
| 45 |  * using Zend Framework 2.1 Translate
 | 
            46 |  * using Zend Framework 2.1 Translate
 | 
          
| 46 |  *
 | 
            47 |  *
 | 
          
| 47 |  * @param string $s
 | 
            48 |  * @param string $s
 | 
          
| 48 |  * @return string
 | 
            49 |  * @return string
 | 
          
| 49 |  */
 | 
            50 |  */
 | 
          
| 50 | function tr ($s)  | 
            51 | function tr ($s)  | 
          
| 51 | {
 | 
            52 | {
 | 
          
| 52 | global $translator;  | 
            53 | global $translator;  | 
          
| 53 | global $textDomain;  | 
            54 | global $textDomain;  | 
          
| 54 | global $language;  | 
            55 | global $language;  | 
          
| 55 | 56 | ||
| - | 57 |   /* DEBUG */
 | 
          |
| - | 58 | //   echo "return \$translator->translate(\"$s\", \"$textDomain\", \"$language\");<br>\n";
 | 
          |
| - | 59 | ||
| 56 | return $translator->translate($s, $textDomain, $language);  | 
            60 | return $translator->translate($s, $textDomain, $language);  | 
          
| 57 | }
 | 
            61 | }
 | 
          
| 58 | 62 | ||
| 59 | $menu = array(  | 
            63 | $menu = array(  | 
          
| 60 | 'scripts' => array('path' => 'scripts/', 'text' => 'Scripting'),  | 
            64 | 'scripts' => array('path' => 'scripts/', 'text' => 'Scripting'),  | 
          
| 61 | 'es-matrix' => array(  | 
            65 | 'es-matrix' => array(  | 
          
| 62 | 'path' => 'es-matrix',  | 
            66 | 'path' => 'es-matrix',  | 
          
| 63 | 'text' => 'ES Matrix',  | 
            67 | 'text' => 'ES Matrix',  | 
          
| 64 | 'title' => 'ECMAScript Support Matrix: ' . tr("A comparison of features of ECMAScript implementations")  | 
            68 | 'title' => 'ECMAScript Support Matrix: ' . tr("A comparison of features of ECMAScript implementations")  | 
          
| 65 | ),  | 
            69 | ),  | 
          
| 66 | 'devel' => array('path' => 'websvn/', 'text' => tr('Software projects')),  | 
            70 | 'devel' => array('path' => 'websvn/', 'text' => tr('Software projects')),  | 
          
| 67 | 'series' => array('path' => "media/video/series/", 'text' => 'Seri-o-meter'),  | 
            71 | 'series' => array('path' => "media/video/series/", 'text' => 'Seri-o-meter'),  | 
          
| 68 | 'ufpdb' => array(  | 
            72 | 'ufpdb' => array(  | 
          
| 69 | 'path' => "ufpdb/index.$language",  | 
            73 | 'path' => "ufpdb/index.$language",  | 
          
| 70 | 'text' => 'UFPDB',  | 
            74 | 'text' => 'UFPDB',  | 
          
| 71 | 'title' => tr('United Federation of Planets DataBase')  | 
            75 | 'title' => tr('United Federation of Planets DataBase')  | 
          
| 72 |   )
 | 
            76 |   )
 | 
          
| 73 | );  | 
            77 | );  | 
          
| 74 | 78 | ||