--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<Site>
+ <Config>
+ <Title>Downloads</Title>
+ </Config>
+ <Paragraphs>
+ <Paragraph>
+ <Heading>Downloads</Heading>
+
+ <Content raw="1"><![CDATA[
+ <img src="/images/box_ipfire.png" class="floatTL" alt="Download" />
+ ]]></Content>
+
+ <Content lang="en"><![CDATA[
+ One can find here all the downloads of the ipfire project.<br />
+ There are the brand new release <b>2.3</b> and the
+ two good old stables <b>2.1</b> and <b>1.4.9</b>
+ ]]></Content>
+ <Content lang="de"><![CDATA[
+ Hier findet ihr alle Downloads des IPFire-Projektes.<br />
+ Die stabile Version <b>2.3</b> sowie die guten alten
+ Versionen <b">2.1</b> und <b>1.4.9</b>.
+ ]]></Content>
+
+ <Content lang="en"><![CDATA[
+ We would be pleased if you heavily use the torrent download. We also request you to seed
+ as long as possible after download.<br />
+ A list of torrent clients is on the right bar.
+ ]]></Content>
+ <Content lang="de"><![CDATA[
+ Besonders freuen würden wir uns darüber, wenn vor allem der Torrent-Download gefördert wird.
+ Daher bitten wir auch nach dem Download unsere ISOs weiter zu seeden.<br />
+ Eine Reihe von Torrent-Clients findet ihr in der Liste rechts.
+ ]]></Content>
+
+ <Content lang="en"><![CDATA[
+ We would like to say thanks to all the people that support this project by
+ lending their bandwidth. The traffic increased rapidly in the last few month.
+ ]]></Content>
+ <Content lang="de"><![CDATA[
+ Ebenso möchten wir uns an dieser Stelle bei den Personen bedanken, die die zahlreichen Mirrorserver
+ für das Projekt zur Verfügung stellen. Das erforderliche Übertragungsvolumen ist in den letzten Wochen
+ und Monat drastisch angestiegen und wir hoffen natürlich, dass das so bleibt.
+ ]]></Content>
+ </Paragraph>
+
+ <Paragraph>
+ <Heading>IPFire 2.3 (Stable)</Heading>
+
+ <Content lang="en"><![CDATA[
+ This is the very new stable 2.3 with kernel 2.6.25.19.
+ ]]></Content>
+ <Content lang="de"><![CDATA[
+ Die neue stabile Version vom 8. November 2008 mit Kernel 2.6.25.19.
+ ]]></Content>
+
+ <Content raw="1"><![CDATA[
+ <div align="right">
+ <a href="http://download.ipfire.org/torrent/ipfire-2.3.i586-full.iso.torrent">IPFire 2.3 - TORRENT - DISK</a><br />
+ <a href="http://download.ipfire.org/iso/ipfire-2.3.i586-full.iso">IPFire 2.3 - HTTP - DISK</a><br /><br />
+ <a href="http://download.ipfire.org/iso/ipfire-2.3-install-usb-hdd.i586.img.gz">IPFire 2.3 - HTTP - USB (HDD)</a><br />
+ <a href="http://download.ipfire.org/iso/ipfire-2.3-install-usb-fdd.i586.img.gz">IPFire 2.3 - HTTP - USB (FDD)</a>
+ </div>
+ ]]></Content>
+ </Paragraph>
+
+ <Paragraph>
+ <Heading>IPFire 2.1</Heading>
+
+ <Content lang="en"><![CDATA[
+ This is the very new stable 2.1 with kernel 2.6.16.57.
+ ]]></Content>
+ <Content lang="de"><![CDATA[
+ Die neue stabile Version vom 8. November 2007 mit Kernel 2.6.16.57.
+ ]]></Content>
+
+ <Content raw="1"><![CDATA[
+ <div align="right">
+ <a href="http://download.ipfire.org/torrent/ipfire-2.1.i586-full.iso.torrent">IPFire 2.1 - TORRENT - DISK</a><br />
+ <a href="http://download.ipfire.org/iso/ipfire-2.1.i586-full.iso">IPFire 2.1 - HTTP - DISK</a><br /><br />
+ <a href="http://download.ipfire.org/iso/ipfire-2.1-install-usb-hdd.i586.img.gz">IPFire 2.1 - HTTP - USB (HDD)</a><br />
+ <a href="http://download.ipfire.org/iso/ipfire-2.1-install-usb-fdd.i586.img.gz">IPFire 2.1 - HTTP - USB (FDD)</a>
+ </div>
+ ]]></Content>
+ </Paragraph>
+
+ <Paragraph>
+ <Heading>IPFire 1.4.9</Heading>
+
+ <Content lang="en"><![CDATA[
+ The final version was released in August 2005.
+ ]]></Content>
+ <Content lang="de"><![CDATA[
+ Die finale Version des IPFire wurde im August 2005 veröffentlicht.
+ ]]></Content>
+
+ <Content lang="en"><![CDATA[
+ <b>After 4 years, the team has decided to cease support for this release.</b>
+ ]]></Content>
+ <Content lang="de"><![CDATA[
+ <b>Nach 4 Jahren produktivem Einsatz hat das Team sich entschlossen den Support für
+ diese Version einzustellen.</b>
+ ]]></Content>
+
+ <Content raw="1"><![CDATA[
+ <div align="right">
+ <a href="http://download.ipfire.org/torrent/IPFire-1.4.9-FINAL.iso.torrent">IPFire 1.4.9 - TORRENT</a><br />
+ <a href="http://download.ipfire.org/iso/IPFire-1.4.9-FINAL.iso">IPFire 1.4.9 - HTTP</a>
+ </div>
+ ]]></Content>
+ </Paragraph>
+
+ <Paragraph>
+ <Heading lang="en">Development builds</Heading>
+ <Heading lang="de">Entwicklungsversionen</Heading>
+
+ <Content lang="en"><![CDATA[
+ One of us builds installation images for testing purposes regularly.
+ These are ready for download, but do not use them for systems in a productive environment.
+ ]]></Content>
+ <Content lang="de"><![CDATA[
+ In regelmäßigen Abständen wird aus dem aktuellen Quellcode
+ der Entwicklungsversionen ein installationsfähiges Image, welches man downloaden kann, erstellt.
+ <br />Diese Versionen dienen dem Test und sind unter Umständen nicht für den
+ Produktiveinsatz geeignet.
+ ]]></Content>
+
+ <Content raw="1"><![CDATA[
+ <div align="right">
+ <a href="http://download.ipfire.org/iso/ipfire-2.3-rc1.i586-full.iso">IPFire 2.3 - RC1</a>
+
+ <a href="http://download.ipfire.org/iso/ipfire-2.3-rc1.i586-full.iso.md5">MD5</a>
+ <br />
+ <a href="http://download.ipfire.org/iso/ipfire-2.3-beta5.i586-full.iso">IPFire 2.3 - Beta5</a>
+
+ <a href="http://download.ipfire.org/iso/ipfire-2.3-beta5.i586-full.iso.md5">MD5</a>
+ <br />
+ <a href="http://download.ipfire.org/iso/ipfire-2.3-beta4.i586-full.iso">IPFire 2.3 - Beta4</a>
+
+ <a href="http://download.ipfire.org/iso/ipfire-2.3-beta4.i586-full.iso.md5">MD5</a>
+ <br />
+ <a href="http://download.ipfire.org/iso/ipfire-2.3-beta3.i586-full.iso">IPFire 2.3 - Beta3</a>
+ <br />
+ <a href="http://download.ipfire.org/iso/ipfire-2.3-beta2.i586-full.iso">IPFire 2.3 - Beta2</a>
+ <br />
+ <a href="http://download.ipfire.org/iso/ipfire-2.3-beta1.i586-full.iso">IPFire 2.3 - Beta1</a>
+ </div>
+ ]]></Content>
+ </Paragraph>
+
+ </Paragraphs>
+
+ <Sidebar>
+ <Paragraph>
+ <Heading lang="en"><![CDATA[<span>Other</span> Tools]]></Heading>
+ <Heading lang="de"><![CDATA[<span>Andere</span> Tools]]></Heading>
+
+ <Content><![CDATA[
+ <ul class="links">
+ <li class="first"><a href="http://wiki.ipfire.org/Tools:Windows">Windows</a></li>
+ <li><a href="http://wiki.ipfire.org/Tools:Linux">Linux</a></li>
+ <li><a href="http://wiki.ipfire.org/Tools:Mac_OS">Mac OS</a></li>
+ </ul>
+ ]]></Content>
+ </Paragraph>
+
+ </Sidebar>
+</Site>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<Site>
+ <Config>
+ <Title lang="en">Welcome</Title>
+ <Title lang="de">Willkommen</Title>
+ </Config>
+ <Paragraphs>
+ <Paragraph>
+ <Heading lang="en">more security for your network</Heading>
+ <Heading lang="de">Sicherheit heute!</Heading>
+
+ <Content lang="en"><![CDATA[
+ <strong>IPFire</strong> is a source-based linux firewall distribution
+ that brings additional features with it. The easy-to-set-up system defeats
+ its competitiors like IPCop, Smoothwall and Endian-Firewall potty.
+ A <strong>stateful-inspection-firewall</strong> with a luxuriant
+ <strong>content-filtering</strong>-engine plus
+ <strong>traffic-control (QoS)</strong> rounded with latest
+ <strong>vpn-technology</strong> and a lot of logging is
+ foolproof to administer with just a very few clicks.
+ ]]></Content>
+ <Content lang="de"><![CDATA[
+ <strong>IPFire</strong> ist eine aus den Sourcen gebaute Linux-Firewall-Distribution,
+ die mit zusätzlichen Funktionen aufwarten kann. Das leicht installierte
+ Grundsystem, kann es an sich mit Konkurrenten wie
+ z.B. IPCop, Smoothwall oder der Endian-Firewall aufnehmen.
+ Die <strong>Stateful-Inspection-Firewall</strong> mit üppigen
+ <strong>Content-Filtering</strong>-Funktionen, sowie
+ <strong>Traffic-Kontrolle (QoS)</strong>, abgerundet durch
+ <strong>VPN-Technologie</strong> und breitbandigem Logging,
+ kann der Administrator umfassend und mit wenigen Knopfdrücken
+ konfigurieren.
+ ]]></Content>
+
+ <Content><![CDATA[
+ <img src="/images/Network-1.png" alt="IPFire Logo" />
+ <br class="clear" />
+ ]]></Content>
+
+ <Content lang="en"><![CDATA["Modular system" is the principle of IPFire.<br />
+ There is a big number of addons. See the short list below:
+ ]]></Content>
+ <Content lang="de"><![CDATA[
+ Nach dem "Baukastenprinzip" lässt sich der IPFire
+ durch diverse Addons erweitern.<br />
+ Zu diesen Addons gehören:
+ ]]></Content>
+
+ <Content lang="en" raw="1"><![CDATA[
+ <ul class="links">
+ <li class="first">- Intrusion-Prevention-System Snort(Guardian) and more security tools Tripwire and Lynis</li>
+ <li>- File- and printserver for heterogeneous networks (Samba, CUPS, FTP & NFS)</li>
+ <li>- Voice-over-IP solution with Asterisk and Teamspeak plus traffic prioritization</li>
+ <li>- Multimedia addons (video- & audio-streaming, jukebox)</li>
+ <li>- WLan Access Point with hostap and many Atheros Chips</li>
+ <li>- and many more - <a href="http://wiki.ipfire.org/Addons" target="_blank">List of all Addons</a></li>
+ </ul>
+ ]]></Content>
+ <Content lang="de" raw="1"><![CDATA[
+ <ul class="links">
+ <li class="first">- Intrusion-Prevention-System Snort(Guardian), sowie weitere Securtiy Tools wie Tripwire und Lynis</li>
+ <li>- Datei- und Druckserver für heterogene Netzwerke (Samba, CUPS, FTP & NFS)</li>
+ <li>- Voice-over-IP-Lösung mittels Asterisk und Teamspeak, sowie Traffic-Priorisierung</li>
+ <li>- Multimedia-Addons (Video- & Audio-Streaming, Jukebox)</li>
+ <li>- WLan Access Point mittels hostap für viele Atheros Chips</li>
+ <li>- und weiteren Addons - <a href="http://wiki.ipfire.org/Addons" target="_blank">Alle Addons im Wiki</a></li>
+ </ul>
+ ]]></Content>
+
+ </Paragraph>
+ </Paragraphs>
+
+ <Sidebar>
+ <Paragraph>
+ <Heading lang="en"><![CDATA[<span>search</span> our wiki]]></Heading>
+ <Heading lang="de"><![CDATA[<span>Suche</span> im Wiki]]></Heading>
+
+ <Content raw="1"><![CDATA[
+ <form method="post" action="http://wiki.ipfire.org/Spezial:Suche">
+ <div id="search">
+ <input name="search" value="" type="text" class="text" />
+ <input type='submit' name="fulltext" class="button" value="Go" />
+ <br class="clear" />
+ </div>
+ </form>
+ ]]></Content>
+ </Paragraph>
+
+ <Paragraph>
+ <Heading lang="en"><![CDATA[About</span> us]]></Heading>
+ <Heading lang="de"><![CDATA[<span>Über</span> uns]]></Heading>
+
+ <Content lang="en"><![CDATA[
+ <strong>IPFire</strong> is developed by a group
+ of free programmers. They set it as their target
+ to create a secure and easy-going on ressources
+ firewall and a wide-ranging soho-server
+ in one piece.]]></Content>
+ <Content lang="de"><![CDATA[
+ <strong>IPFire</strong> wird von einer Gruppe von
+ freien Personen programmiert. Diese haben sich
+ zum Ziel gesetzt eine sichere und ressourcenschonende
+ Firewall und einen breit gefächerten SOHO-Server
+ aus einem Guss zu erstellen.
+ ]]></Content>
+ </Paragraph>
+
+ <Paragraph>
+ <Heading><![CDATA[<span>RSS</span> feed]]></Heading>
+
+ <Content lang="en"><![CDATA[
+ <a class="feed" href="http://www.ipfire.org/data/feeds/main-en.rss">IPFire - News</a>
+ <br />
+ <a href="news.shtml">news archive</a>]]></Content>
+ <Content lang="de"><![CDATA[
+ <a class="feed" href="http://www.ipfire.org/data/feeds/main-en.rss">IPFire - News</a>
+ <br />
+ <a href="news.shtml">News-Archiv</a>
+ ]]></Content>
+ </Paragraph>
+
+ <Paragraph>
+ <Heading><![CDATA[<span>Internet Relay</span> Chat]]></Heading>
+ <Content><![CDATA[
+ <b>Server:</b> irc.freenode.net<br />
+ <b>Channel:</b> #ipfire<br />
+ <a href="http://embed.mibbit.com/?settings=7ca12664887d4b6e7a0fa6552f9e0de6&server=irc.freenode.net&channel=%23ipfire&noServerNotices=true&forcePrompt=true&charset=ISO-8859-2" target="_blank">Web-Chat</a>
+ ]]></Content>
+ </Paragraph>
+ </Sidebar>
+</Site>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<Site>
+ <Posts>
+ <Post>
+ <Date>08/11/2008</Date>
+ <Id>news-12</Id>
+ <Heading>IPFire 2.3 Final</Heading>
+ <Subtitle>Get it quick</Subtitle>
+ <Content lang="de"><![CDATA[
+ <b>Dear Community!</b><br />
+ This day, we released the final version of IPFire 2.3.
+ <br />
+ <br />
+ Major changes since the first version 2.1 in Oktober 2007
+ <br />
+ <ul>
+ <li class="first">-DNS-Securityupdate and many more packet updates</li>
+ <li>-Enhancement of the packet manager</li>
+ <li>-Improvement of the Quality-of-Service rules - Presets for QoS</li>
+ <li>-Adjustable Firewall Logging</li>
+ <li>-Kernel-Modules for better hardware suport</li>
+ <li>-Change the system statistic to „collectd"</li>
+ <li>-Better disk handling (S.M.A.R.T. and Standby)</li>
+ <li>-Status- and Serviceview in the Webinterface</li>
+ <li>-Proxy and Redirector now work more dynamic</li>
+ </ul>
+ <br />
+ <br />
+ In addition the 2.3 will change the following things
+ <br />
+ <ul>
+ <li class="first">-Kernel update to Linux-2.6.25.19</li>
+ <li>Update of many more packets (OpenSSL, OpenSSH, Apache, Squid, Snort, collectd, ntfs-3g, Openswan, Updatexlrator, iptables, l7protocols)</li>
+ <li>-With severall Atheros Chips IPFire is able to work as Wireless Access Point</li>
+ <li>-Better support of UMTS-3G-Modems</li>
+ <li>-Use of tmpfs to reduce disk reads and writes</li>
+ <li>-Better hardware monitoring by the use of lmsensors</li>
+ <li>-Vnstat Traffic-Accounting replaces ipac-ng</li>
+ </ul>
+ <br />
+ <br />
+ The IPFire Team
+ ]]></Content>
+ <Content lang="de"><![CDATA[
+ <b>Sehr geehrte Community!</b><br />
+ Heute wurde die Final Version von IPFire 2.3 veröffentlicht.
+ <br />
+ <br />
+ Wesentliche Änderungen seit der ersten Version 2.1 im Oktober 2007
+ <br />
+ <ul>
+ <li class="first">-DNS-Sicherheitsupdate und viele weitere Paket-Aktualisierungen</li>
+ <li>-Erweiterung des Paketmanagers</li>
+ <li>-Verfeinerung der Quality-of-Service Regeln - Voreinstellungsmodell für QoS</li>
+ <li>-Feiner einstellbares Firewall Logging</li>
+ <li>-Kernel-Module zur Hardwareunterstützung wurden nachgeliefert</li>
+ <li>-Umstellung der Systemstatistiken auf „collectd"</li>
+ <li>-Verbessertes Festplatten-Handling (S.M.A.R.T. und Standby)</li>
+ <li>-Status- und Serviceübersicht im Webinterface</li>
+ <li>-Proxy und Redirector arbeiten dynamischer zusammen</li>
+ </ul>
+ <br />
+ <br />
+ Mit der 2.3 wird sich zusätzlich folgendes ändern
+ <br />
+ <ul>
+ <li class="first">-Der Kernel wurde auf Linux-2.6.25.19 aktualisiert</li>
+ <li>Aktualisierungen von weiteren Paketen (OpenSSL, OpenSSH, Apache, Squid, Snort, collectd, ntfs-3g, Openswan, Updatexlrator, iptables, l7protocols)</li>
+ <li>-Mit einer passenden WLAN-Karte kann der IPFire als Access-Point für WLAN-Clients dienen</li>
+ <li>-Bessere Unterstützung für UMTS-3G-Modems</li>
+ <li>-Verwendung von tmpfs zur Reduzierung von Schreibzugriffen</li>
+ <li>-Verbesserte Hardwareüberwachung durch Lmsensors</li>
+ <li>-Vnstat Traffic-Accounting ersetzt ipac-ng</li>
+ </ul>
+ <br />
+ <br />
+ Das IPFire-Team
+ ]]></Content>
+ </Post>
+ </Posts>
+</Site>
--- /dev/null
+ <br class="clear" />
+ </div>
+ </div>
+ <div id="footer" class="fixed">
+ Copyright © 2008 IPFire.org. All rights reserved. <a href="/imprint/%(lang)s">Imprint</a>
+ </div>
+ </body>
+</html>
--- /dev/null
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+ <title>%(title)s</title>
+ <meta name="keywords" content="Linux, Firewall, IPCop, IPFire, Security" />
+ <meta name="description" content="" />
+ <meta name="verify-v1" content="2LEf3W8naILGWVy2dhedSVEHPXTpp2xFNVsHXZMH1JI=" />
+ <link rel="stylesheet" type="text/css" href="../style.css" />
+ <link rel="alternate" type="application/rss+xml" title="RSS" href="http://www.ipfire.org/data/feeds/main-en.rss" />
+ <!--[if lt IE 7]>
+ <script type="text/javascript">
+ function correctPNG() // correctly handle PNG transparency in Win IE 5.5 or higher.
+ {
+ for(var i=0; i<document.images.length; i++)
+ {
+ var img = document.images[i]
+ var imgName = img.src.toUpperCase()
+ if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
+ {
+ var imgID = (img.id) ? "id='" + img.id + "' " : ""
+ var imgClass = (img.className) ? "class='" + img.className + "' " : ""
+ var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
+ var imgStyle = "display:inline-block;" + img.style.cssText
+ if (img.align == "left") imgStyle = "float:left;" + imgStyle
+ if (img.align == "right") imgStyle = "float:right;" + imgStyle
+ if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
+ var strNewHTML = "<span " + imgID + imgClass + imgTitle
+ + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
+ + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
+ + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"
+ img.outerHTML = strNewHTML
+ i = i-1
+ }
+ }
+ }
+ window.attachEvent("onload", correctPNG);
+ </script>
+ <![endif]-->
+ </head>
+ <body>
+ <div id="header">
+ <div id="header_inner" class="fixed">
+ <div id="logo">
+ <img src="/images/icons/ipfire.png" width="48px" height="48px" class="symbol" alt="IPFire" />
+ <h1><span>IPFire</span>.org</h1>
+ <br />
+ <h2>Security today!</h2>
+ </div>
+ <div id="lang">
+ <a href="/%(document_name)s/en" ><img src="/images/en.gif" alt="english" /></a>
+ <a href="/%(document_name)s/de" ><img src="/images/de.gif" alt="german" /></a>
+ </div>
+ %(menu)s
+ </div>
+ </div>
+ <div id="main">
+ <div id="main_inner" class="fixed">
sites = (
("ipfire.org", ("www.ipfire.org", None)),
- ("www.ipfire.org", (None, cgi.FieldStorage().getfirst("file") or "index.shtml")),
+ ("www.ipfire.org", (None, cgi.FieldStorage().getfirst("file") or "index")),
("source.ipfire.org", (None, "source.shtml")),
("tracker.ipfire.org", (None, "tracker.shtml")),
("download.ipfire.org", (None, "download.shtml")),
if destination[0]:
location = "http://%s" % destination[0]
if destination[1]:
- location += "/%s/%s" % (language, destination[1])
+ location += "/%s/%s" % (destination[1], language,)
break
print "Location: %s" % location
--- /dev/null
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+import os
+import sys
+import cgi
+
+sys.path.append(os.environ['DOCUMENT_ROOT'])
+
+import xml.dom.minidom
+
+class Error404(Exception):
+ pass
+
+class Error500(Exception):
+ pass
+
+class SItem:
+ def __init__(self, xml, page, lang):
+ self.xml = xml
+ self.page = page
+ self.lang = lang
+
+ self.data = u""
+
+ def write(self, s):
+ self.data += s #.encode("utf-8")
+
+ def read(self):
+ return self.data
+
+
+class Menu(SItem):
+ def __init__(self, file, page, lang):
+ SItem.__init__(self, Xml(file, lang), page, lang)
+ self.xml.load()
+
+ self.items = XItem(self.xml.dom).childs("Item")
+
+ def __call__(self):
+ self.write("""<div id="menu"><ul>""")
+ for item in self.items:
+ uri = item.attr("uri")
+ active = ""
+ if self.page == uri:
+ active = "class=\"active\""
+
+ if not uri.startswith("http://"):
+ uri = "/%s/%s" % (uri, self.lang)
+
+ for name in item.childs("Name"):
+ if name.attr("lang") in (self.lang, ""):
+ self.write("<li><a %s href=\"%s\">%s</a></li>" % \
+ (active, uri, name.text()))
+ self.write("</ul></div>")
+ return self.read()
+
+
+class Body(SItem):
+ def __init__(self, xml, page, lang):
+ SItem.__init__(self, xml, page, lang)
+
+ self.paragraphs = XItem(self.xml.dom, "Paragraphs").childs("Paragraph")
+
+ self.news = News("news", self.page, self.lang)
+
+ def __call__(self):
+ self.write("""<div id="primaryContent_2columns">
+ <div id="columnA_2columns">""")
+ for paragraph in self.paragraphs:
+ for heading in paragraph.childs("Heading"):
+ if heading.attr("lang") in (self.lang, ""):
+ self.write("<h3>" + heading.text() + "</h3>")
+ for content in paragraph.childs("Content"):
+ if content.attr("lang") in (self.lang, ""):
+ if content.attr("raw"):
+ self.write(content.text())
+ else:
+ self.write("<p>" + content.text() + "</p>\n")
+ self.write("""<br class="clear" />\n""")
+
+ if self.page in ("index", "news",):
+ self.write(self.news(3))
+ self.write("""</div></div>""")
+ return self.read()
+
+
+class News(SItem):
+ def __init__(self, file, page, lang):
+ SItem.__init__(self, Xml(file, lang), page, lang)
+ self.xml.load()
+
+ self.posts = XItem(self.xml.dom).childs("Posts")
+
+ def __call__(self, limit=None):
+ a = 1
+ for post in self.posts:
+ self.write("""<div class="post">""")
+ for id in post.childs("Id"):
+ self.write("""<a name="%s"></a>""" % id.text())
+ for heading in post.childs("Heading"):
+ if heading.attr("lang") in (self.lang, ""):
+ self.write("""<h3>%s - %s</h3>""" % (post.childs("Date")[0].text(), heading.text()))
+ for subtitle in post.childs("Subtitle"):
+ if subtitle.attr("lang") in (self.lang, ""):
+ self.write("""<ul class="post_info">
+ <li class="date">%s</li></ul>""" % \
+ subtitle.text())
+ for content in post.childs("Content"):
+ if content.attr("lang") in (self.lang, ""):
+ if content.attr("raw"):
+ self.write(content.text())
+ else:
+ self.write("<p>" + content.text() + "</p>\n")
+ self.write("""</div>""")
+ a += 1
+ if limit and a > limit:
+ break
+ return self.read()
+
+
+class Sidebar(SItem):
+ def __init__(self, xml, page, lang):
+ SItem.__init__(self, xml, page, lang)
+
+ self.paragraphs = XItem(self.xml.dom, "Sidebar").childs("Paragraph")
+
+ def __call__(self):
+ self.write("""<div id="secondaryContent_2columns">
+ <div id="columnC_2columns">""")
+ for post in self.paragraphs:
+ for heading in post.childs("Heading"):
+ if heading.attr("lang") in (self.lang, ""):
+ self.write("<h4>" + heading.text() + "</h4>")
+ for content in post.childs("Content"):
+ if content.attr("lang") in (self.lang, ""):
+ if content.attr("raw"):
+ self.write(content.text())
+ else:
+ self.write("<p>" + content.text() + "</p>\n")
+ self.write("""</div></div>""")
+ return self.read()
+
+
+class XItem:
+ def __init__(self, dom, node=None):
+ self.dom = self.node = dom
+ if node:
+ self.node = self.dom.getElementsByTagName(node)[0]
+ self.lang = lang
+
+ def attr(self, name):
+ return self.node.getAttribute(name).strip()
+
+ def text(self):
+ ret = ""
+ for i in self.node.childNodes:
+ ret = ret + i.data
+ return ret
+
+ def element(self, name):
+ return XItem(self.node, name)
+
+ def childs(self, name):
+ ret = []
+ for i in self.node.getElementsByTagName(name):
+ ret.append(XItem(i))
+ return ret
+
+
+class Xml:
+ def __init__(self, page, lang):
+ self.page = page
+ self.lang = lang
+
+ self.path = None
+
+ self.data = None
+ self.dom = None
+
+ self._config = {}
+
+ def load(self):
+ self.path = \
+ os.path.join(os.environ['DOCUMENT_ROOT'], "data/%s.xml" % self.page)
+ try:
+ f = open(self.path)
+ self.data = f.read()
+ f.close()
+ self.dom = \
+ xml.dom.minidom.parseString(self.data).getElementsByTagName("Site")[0]
+ except IOError:
+ #self.page = "404"
+ #self.load()
+ raise Error404
+ except:
+ #self.page = "500"
+ #self.load()
+ raise
+
+ def config(self):
+ elements = ("Title", "Columns",)
+ for element in elements:
+ self._config[element.lower()] = ""
+
+ config = XItem(self.dom, "Config")
+ for element in elements:
+ for lang in config.childs(element):
+ if lang.attr("lang") == self.lang:
+ self._config[element.lower()] = lang.text()
+ return self._config
+
+
+class Site:
+ def __init__(self, page, lang="en"):
+ self.code = "200 - OK"
+ self.mime = "text/html"
+
+ self.page = page
+ self.lang = lang
+ self.xml = Xml(page=page, lang=lang)
+
+ self.data = u""
+
+ self.menu = Menu("../menu", self.page, self.lang)
+
+ self.config = { "document_name" : page,
+ "lang" : self.lang,
+ "menu" : self.menu() }
+
+ try:
+ self.xml.load()
+ except Error404:
+ self.code = "404 - Not found"
+ #except:
+ # self.code = "500 - Internal Server Error"
+
+ def write(self, s):
+ self.data += s #.encode("utf-8")
+
+ def include(self, file):
+ f = open(file)
+ data = f.read()
+ f.close()
+ self.write(data % self.config)
+
+ def prepare(self):
+ for key, val in self.xml.config().items():
+ self.config[key] = val
+
+ self.config["title"] = "%s - %s" % \
+ (os.environ["SERVER_NAME"], self.config["title"],)
+
+ self.body = Body(self.xml, self.page, self.lang)
+ self.sidebar = Sidebar(self.xml, self.page, self.lang)
+
+ def run(self):
+ # First, return the http header
+ print "Status: %s" % self.code
+ print "Content-Type: %s" % self.mime
+ print # End header
+
+ # Include the site's header
+ self.include("header.inc")
+
+ # Import body and side elements
+ self.write(self.body())
+ self.write(self.sidebar())
+
+ # Include the site's footer
+ self.include("footer.inc")
+
+ return self.data.encode("utf-8")
+
+
+page = cgi.FieldStorage().getfirst("page")
+lang = cgi.FieldStorage().getfirst("lang")
+
+if not lang:
+ lang = "en"
+
+site = Site(page=page, lang=lang)
+site.prepare()
+
+print site.run()
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<Site>
+ <Item uri="index">
+ <Name lang="en">Home</Name>
+ <Name lang="de">Start</Name>
+ </Item>
+ <Item uri="download">
+ <Name>Downloads</Name>
+ </Item>
+ <Item uri="http://wiki.ipfire.org/">
+ <Name lang="en">Docs</Name>
+ <Name lang="de">Wiki</Name>
+ </Item>
+ <Item uri="http://forum.ipfire.org/">
+ <Name>Forum</Name>
+ </Item>
+ <Item uri="development">
+ <Name lang="en">Development</Name>
+ <Name lang="de">Entwicklung</Name>
+ </Item>
+</Site>