- Timestamp:
- Aug 28, 2014, 3:40:34 PM (10 years ago)
- Location:
- lib
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/host.php
r561 r649 49 49 /// This value is computed by setup(). 50 50 public $script_filename; 51 52 /// $slash_filename: Cross-platform $script_filename, always starting with a "/". 53 public $slash_filename; 51 54 52 55 /// $ressources: CSS and JavaScript file paths ("Assets"), as used by the RessourceLoader, … … 229 232 230 233 $this->script_filename = substr(realpath($_SERVER['SCRIPT_FILENAME']), strlen($this->document_root)); # e.g.: "/de/page.php" 234 235 # Bug when DOCUMENT_ROOT ends with trailing slash: make sure $file begins with /: 236 $this->slash_filename = $this->script_filename; 237 if($this->slash_filename{0} != '/') $this->slash_filename = '/'.$this->slash_filename; 231 238 232 239 // Windows realpath() converts Unix Paths ($_SERVER) to Windows Paths (like \en\index.php). -
lib/menu.php
r569 r649 73 73 require_once $this->conf['lib'].'/spyc.php'; 74 74 $data = Spyc::YAMLLoad($this->load_news_data()); 75 $fields = array(' titel', 'text', 'link', /*'bild'*/);75 $fields = array('datum', 'titel',/* 'untertitel', 'bild'*/); 76 76 77 77 $news_ul_content = ''; … … 80 80 function($a,$b){ return $a && $b;}, true)) { 81 81 $li = "<li><a href='#'>Fehler in Formatierung!<em>Dieser Menüeintrag ist falsch formatiert</em></a></li>"; 82 $this->log->WARN("<h5>Neuigkeiten-Menü: Fehler in Formatierung</h5><p>Ein Eintrag im Neuigkeiten-Menü ist falsch formatiert. ");82 $this->log->WARN("<h5>Neuigkeiten-Menü: Fehler in Formatierung</h5><p>Ein Eintrag im Neuigkeiten-Menü ist falsch formatiert. Ich erwarte zu jedem Menüeintrag die Felder ".implode(", ", $fields).". Eine der Angaben fehlt oder ist fehlerhaft formatiert: <pre>".var_export($e, true)."</pre>"); 83 83 } else { 84 $url = ($e['link']{0} == '#' ? $this->conf['lang_path'].'/'.self::news_file : '').$e['link']; 84 // Ehemals konnte die URL per "link: #August_2013" angegeben werden oder "link: /de/irgendwohin". 85 // $url = ($e['link']{0} == '#' ? $this->conf['lang_path'].'/'.self::news_file : '').$e['link']; 86 // Jetzt wird die URL automatisch aus dem Datum gebaut (slugify-artig) 87 $url = $this->conf['lang_path'].'/'.self::news_file.'#'.str_replace(' ', '_', $e['datum']); 85 88 if($host) 86 89 $url = $host->rewrite_link($url); 87 $li = "<li><a href='$url'>$e[titel]<span class='hidden'>: </span><em>$e[text]</em></a></li>"; 90 91 // optionales Feld: Untertitel 92 if(!isset($e['untertitel'])) $e['untertitel'] = ''; 93 94 // weiteres optionales Feld: Bildeinbindung 95 $img = !isset($e['bild']) ? '' : "<img src='$e[bild]' style='max-width:64px; max-height:64px;'>"; 96 $li = "<li><a href='$url'>$img$e[titel]<span class='hidden'>: </span><em>$e[untertitel]</em></a></li>"; 88 97 } 89 98 $news_ul_content .= "\t".$li."\n"; -
lib/messages.php
r585 r649 172 172 'js-interlang-notify-heading' => array("This page is also avaliable in English", "Diese Website gibt es auch auf Deutsch"), 173 173 'js-interlang-notify-text' => array("Do you want to switch to the English version <i>%s</i>?", "Möchtest du die deutschsprachige Seite <i>%s</i> lesen?"), 174 175 // RSS-feed, in /lib/news.php verwendet 176 'rss-title' => array('technikum29 Computer Museum - Was gibt es Neues?','technikum29 Computer Museum - What\'s new?'), 177 'rss-description' => array('Neuste Geräte und Erweiterungen im technikum29-Computermuseum', 'The latest devices and news from the technikum29 computer museum'), 178 'rss-copyright' => array('Heribert Müller und das technikum29-Team', 'Heribert Müller and the technikum29 team'), 179 174 180 ); 175 181 } -
lib/news.php
r644 r649 23 23 $required_fields = array('titel', 'text', 'link', /*'bild'*/); 24 24 25 # Hack, um die Sprache zu bekommen, von technikum29.php kopiert. 26 require "$lib/host.php"; 27 $host = t29Host::detect(); 28 $file = $host->slash_filename; # e.g.: "/de/page.php" 29 if(!isset($lang)) $lang = substr($file, 1, 2); 30 if(!in_array($lang, array('de','en'))) $lang = "de"; # check if language exists 31 32 require $lib.'/messages.php'; 33 $msg = new t29Messages($lang); 34 $p = $msg->get_shorthand_printer(); 35 25 36 # und hostname davor. 26 37 # $this->conf['lang_path'].'/'.self::news_file 27 $news_url = "http://www.technikum29.de/ de/news";38 $news_url = "http://www.technikum29.de/$lang/news"; 28 39 # if($host) $url = $host->rewrite_link($url); 29 40 … … 35 46 <rss 36 47 xmlns:atom="http://www.w3.org/2005/Atom" 37 xml:lang=" de-DE"48 xml:lang="<?php print $lang; ?>" 38 49 version="2.0"> 39 50 <channel> 40 <title> technikum29 Computer Museum - Was gibt es Neues?</title>51 <title><?php $p('rss-title'); ?></title> 41 52 <link>http://www.technikum29.de</link> 42 <description> Neuste Geräte und Erweiterungen im technikum29-Computermuseum</description>43 <language> de-DE</language>44 <copyright>℗ & © 20 33-<?=date('Y'); ?> Heribert Müller und das technikum29-Team</copyright>53 <description><?php $p('rss-description'); ?></description> 54 <language><?php print $lang; ?></language> 55 <copyright>℗ & © 2003-<?=date('Y'); ?> <?php $p('rss-copyright'); ?></copyright> 45 56 <pubDate><?=date('r', $pubdate); ?></pubDate> 46 57 <image> 47 <url>http://www.technikum29.de/shared/img-v6/banner. de.png</url>58 <url>http://www.technikum29.de/shared/img-v6/banner.<?php print $lang; ?>.png</url> 48 59 <title>technikum29 Computermuseum</title> 49 60 <link>http://www.technikum29.de/</link> … … 52 63 <!--<ttl><?=60*12; ?></ttl>--><!-- half a day --> 53 64 54 <atom:link href="http://www.technikum29.de/ de/news.php?format=rss" rel="self" type="application/rss+xml" />65 <atom:link href="http://www.technikum29.de/<?php print $lang; ?>/news.php?format=rss" rel="self" type="application/rss+xml" /> 55 66 56 67 <?php 57 68 foreach($data as $e) { 69 // Kompatibilitaet im August 2014, Uebergangsphase 70 if(!isset($e['text']) && isset($e['untertitel'])) $e['text'] = $e['untertitel']; 71 if(!isset($e['link']) && isset($e['datum'])) $e['link'] = $news_url.'#'.str_replace(' ', '_', $e['datum']); 72 58 73 if(!array_reduce(array_map(function($x) use ($required_fields,$e){ return isset($e[$x]); }, $required_fields), 59 74 function($a,$b){ return $a && $b;}, true)) { … … 61 76 <item> 62 77 <title>Fehlformatierung</title> 63 <description>Leider ist dieser Eintrag nicht richtig formatiert. Schauen Sie sich die News-Seite direkt an.</description> 78 <description><![CDATA[<html><body> 79 <b>Leider ist dieser Eintrag nicht richtig formatiert</b>. Schauen Sie sich die News-Seite direkt an. 80 <p><i>Details:</i></p> 81 Eines der Fehler Felder <?php print implode(", ", $required_fields); ?> fehlt. 82 Details: <pre><?php print var_dump($e); ?></pre> 83 </body></html>]]> 84 </description> 64 85 <link>http://www.technikum29.de/de/news</link> 65 86 </item> … … 69 90 <item> 70 91 <title><?=$e['titel']; ?></title> 71 <description><?=$e['text']; ?></description> 92 <description><?php 93 // if text contains tags like <em>, mark it as HTML 94 if(strpos($e['text'], '<') !== false) { print '<![CDATA[<html><body>'; } 95 print $e['text']; 96 if(strpos($e['text'], '<') !== false) { print '</body></html>]]>'; } ?> 97 </description> 72 98 <author>Heribert Müller</author> 73 99 <?php 74 $link = ($e['link']{0} == '#' ? $news_url : '').$e['link']; 100 if($e['link']{0} == '#') $link = $news_url . $e['link']; 101 else if($e['link']{0} == '/') $link = 'http://www.technikum29.de' . $e['link']; 102 else $link = $e['link']; 75 103 ?> 76 104 <link><?=$link; ?></link> … … 89 117 // rss ausgegeben, jetzt: exit um nicht noch Seite auszugeben. 90 118 exit(); 91 92 119 } else { 120 // bin eingebunden von news-Seite 93 121 require("$lib/technikum29.php"); 122 // wichtig: 94 123 return true; 95 124 } 125 -
lib/technikum29.php
r585 r649 27 27 require "$lib/host.php"; 28 28 $host = $external ? t29Host::create('t29ExternalHost') : t29Host::detect(); 29 30 $file = $host->script_filename; # e.g.: "/de/page.php" 31 # Bug when DOCUMENT_ROOT ends with trailing slash: make sure $file begins with /: 32 if($file{0} != '/') $file = "/$file"; 29 $file = $host->slash_filename; # e.g.: "/de/page.php" 33 30 34 31 // exactly define debugging behaviour -
lib/template.php
r618 r649 255 255 <link rel="copyright" href="<?php print $href($_('footer-legal-file')); ?>" title="<?php $p('footer-legal-link'); ?>"> 256 256 <link rel="search" type="application/opensearchdescription+xml" href="<?php print $href($_('topnav-search-page')); print '?action=opensearch-desc&lang='.$this->conf['lang']; ?>" title="<?php $p('opensearch-desc'); ?>"> 257 <link rel="alternate" type="application/rss+xml" href="/ de/news.php?format=rss" title="Neuigkeiten vom technikum29-Museum" />257 <link rel="alternate" type="application/rss+xml" href="/<?php print $this->conf['lang']; ?>/news.php?format=rss" title="<?php $p('rss-title'); ?>" /> 258 258 <?php 259 259 // print interlanguage links for all languages except the active one
Note: See TracChangeset
for help on using the changeset viewer.