3 # <quotebox [lang={deutsch|english}] [type={linux|infodrom|general}]>
6 <preserve lang type btitle error fortune>
8 <if <not <get-var lang>> <set-var lang=deutsch>>
9 <if <not <get-var type>> <set-var type=general>>
11 <ifeq "<get-var lang>" "deutsch" "<set-var btitle="Zitat des Tages">">
12 <ifeq "<get-var lang>" "english" "<set-var btitle="Quote of the day">">
14 <ifeq "<get-var lang>" "deutsch" "<set-var error="Leider heute kein Zitat.">">
15 <ifeq "<get-var lang>" "english" "<set-var error="Sorry, no quote today.">">
17 <ifeq "<get-var type>" "infodrom" "<set-var fortune="<root_prefix>fortune-infodrom.html">">
18 <ifeq "<get-var type>" "linux" "<set-var fortune="<root_prefix>fortune-linux.html">">
20 <ifeq "<get-var type>" "general"
21 <ifeq "<get-var lang>" "english"
22 "<set-var fortune="<root_prefix>fortune-general-en.html">"
23 "<set-var fortune="<root_prefix>fortune-general.html">"
27 <center><box header="<ifont><font size=-1 color="#<box-fgcolor>"><b><get-var btitle></b></font></ifont>"
28 bdcolor="#<box-bdcolor>" bdwidth=1 bdspace=10 width=100
29 bgcolor="#<box-bgcolor>">
30 <ifont><font size=-1 color="#<box-fgcolor>">
32 # FIXME: Was gibt fopen() zurück, wenn die Datei nicht geöffnet werden konnte?
33 if (is_file ("<get-var fortune>") && (($fortune = fopen ("<get-var fortune>", "r")) !== false)) {
34 while (!feof ($fortune)) {
35 $line = fgets ($fortune, 255);
40 echo "<get-var error>";
45 <restore lang type btitle error fortune>
53 # -- [ Old ] -----------------------------------------------------------
55 # Quote of the day boxes
63 # FIXME: Schöner wäre es, wenn ich %0 == "" -> .fortune, sonst %0 abfragen könnte
65 <define-tag quotebox-de-shtml whitespace=delete>
66 <box header="<ifont><font size=-1 color="#<box-bdcolor>"><b>Zitat des Tages</b></font></ifont>"
67 bdcolor="#<box-bdcolor>" bdwidth=2 bdspace=10
68 bgcolor="#<box-bgcolor>"
70 <font face="helvetica,arial" size=-1 color="#<box-fgcolor>">
71 <!--#include file="%0"-->
76 <define-tag quotebox-en-shtml whitespace=delete>
77 <box header="<ifont><font size=-1 color="#<box-fgcolor>"><b>Quote of the day</b></font></ifont>"
78 bdcolor="#<box-bdcolor>" bdwidth=2 bdspace=10
79 bgcolor="#<box-bgcolor>">
80 <font face="helvetica,arial" size=-1 color="#<box-fgcolor>">
81 <!--#include file="%0"-->
86 <define-tag quotebox-en-php whitespace=delete>
87 <box header="<ifont><font size=-1 color="#<box-fgcolor>"><b>Zitat des Tages</b></font></ifont>"
88 bdcolor="#<box-bdcolor>" bdwidth=2 bdspace=10
89 bgcolor="#<box-bgcolor>">
90 <font face="helvetica,arial" size=-1 color="#<box-fgcolor>">
92 if (($fortune = fopen ("index-fortune.html", "r")) !== false) {
93 while (!feof ($fortune)) {
94 $line = fgets ($fortune, 255);
104 <define-tag quotebox-en-php whitespace=delete>
105 <box header="<ifont><font size=-1 color="#<box-fgcolor>"><b>Quote of the day</b></font></ifont>"
106 bdcolor="#<box-bdcolor>" bdwidth=2 bdspace=10
107 bgcolor="#<box-bgcolor>">
108 <font face="helvetica,arial" size=-1 color="#<box-fgcolor>">
110 if (($fortune = fopen ("index-fortune.html", "r")) !== false) {
111 while (!feof ($fortune)) {
112 $line = fgets ($fortune, 255);
122 <define-tag format_cookie>
124 function format_cookie ($cookie, $bg)
126 $fsource = "<div class=\"fortune-attribution\"><span style=\"display: none;\">-- </span>%s</div>";
129 $result = '<div class="fortune_'.$bg.'">';
130 $firstchar = substr ($cookie[0], 0, 1);
131 if ( ($firstchar == "<")
132 || ($firstchar == ">")
133 || ($firstchar == "*")
134 || ($firstchar == " ")
135 || ($firstchar == "[") ) {
137 $result .= "<pre class=\"smallfont\">\n";
142 for ($i=0; $i < count ($cookie); $i++) {
144 $line = str_replace (array("<", ">"),
145 array("<", ">"),
148 if (preg_match('/^\t\t?-- (.*)/', $line, $matches)) {
149 $line = rtrim($matches[1]);
152 $result .= "</pre>\n";
156 $result .= sprintf ($fsource, $line);
159 if (!$pre && substr($line, 0, 1) == ' ')
167 $result .= "</pre>\n";
172 $result .= "</div>\n";
180 <preserve title source>
181 <set-var %attributes>
183 <if <not <get-var title>> <set-var title="Random Fortune Cookie">>
187 <div class=fortune-body>
188 <h3 class=fortune-title><get-var title></h3>
189 <div class=fortune-content id=fortune>
192 if (is_file ("<get-var source>")) {
193 $fortune = fopen ("<get-var source>", "r");
195 $fortune = popen ("<get-var source>", "r");
197 if ($fortune !== false) {
199 while (!feof ($fortune)) {
200 $line = fgets ($fortune, 255);
203 if (is_file ("<get-var source>")) {
208 echo format_cookie ($cookie, 0);
210 echo "<p>No fortune today.</p>";
218 <restore title source>