diff options
Diffstat (limited to 'website/include')
-rw-r--r-- | website/include/detect-os.inc.php | 18 | ||||
-rw-r--r-- | website/include/footer.inc.php | 34 | ||||
-rw-r--r-- | website/include/header.inc.php | 89 | ||||
-rw-r--r-- | website/include/lang.inc.php | 95 | ||||
-rw-r--r-- | website/include/news.inc.php | 44 | ||||
-rw-r--r-- | website/include/strings.inc.php | 0 |
6 files changed, 280 insertions, 0 deletions
diff --git a/website/include/detect-os.inc.php b/website/include/detect-os.inc.php new file mode 100644 index 0000000..32b8e58 --- /dev/null +++ b/website/include/detect-os.inc.php @@ -0,0 +1,18 @@ +<?php +/* + * Copyright 2004 Matt Brubeck + * This file is licensed under a Creative Commons license: + * http://creativecommons.org/licenses/by/2.0/ + */ + +// Guess which download to offer, based on the user's OS. +function which_download() { + $useragent = $_SERVER["HTTP_USER_AGENT"]; + if (eregi("Mac", $useragent)) + return "mac"; + else if (eregi("X11", $useragent)) + return "source"; + else + return "windows"; +} +?> diff --git a/website/include/footer.inc.php b/website/include/footer.inc.php new file mode 100644 index 0000000..59d7fd1 --- /dev/null +++ b/website/include/footer.inc.php @@ -0,0 +1,34 @@ +<?php +/* + * Copyright 2004 Matt Brubeck + * This file is licensed under a Creative Commons license: + * http://creativecommons.org/licenses/by/2.0/ + */ +?> +</div> +<div id="footer"> + <hr> + <h2><?=_("Page Footer")?></h2> + <p> + <a href="<?=$sitePath?>/copyright"><?=_("Copyright")?></a> + | <a href="<?=$sitePath?>/site-map"><?=_("Site Map")?></a> + </p> + <p><a title="<?=_("Creative Commons Attribution license")?>" href="http://creativecommons.org/licenses/by/2.0/"><img alt="<?=_("Creative Commons: Some rights reserved.")?>" src="<?=$sitePath?>/images/creative-commons.gif"></a> + <a title="<?=_("Development hosted by SourceForge")?>" href="http://sourceforge.net/projects/audacity/"><img alt="SourceForge.net" src="http://sflogo.sourceforge.net/sflogo.php?group_id=6235&type=1"></a></p> +</div> +<!-- License metadata --> +<!-- +<rdf:RDF xmlns="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> + <Work rdf:about=""> + <license rdf:resource="http://creativecommons.org/licenses/by/2.0/" /> + </Work> + <License rdf:about="http://creativecommons.org/licenses/by/2.0/"> + <permits rdf:resource="http://web.resource.org/cc/Reproduction" /> + <permits rdf:resource="http://web.resource.org/cc/Distribution" /> + <requires rdf:resource="http://web.resource.org/cc/Notice" /> + <requires rdf:resource="http://web.resource.org/cc/Attribution" /> + <permits rdf:resource="http://web.resource.org/cc/DerivativeWorks" /> + </License> +</rdf:RDF> +--> +</body></html> diff --git a/website/include/header.inc.php b/website/include/header.inc.php new file mode 100644 index 0000000..831d01a --- /dev/null +++ b/website/include/header.inc.php @@ -0,0 +1,89 @@ +<?php +/* + * Copyright 2004 Matt Brubeck + * This file is licensed under a Creative Commons license: + * http://creativecommons.org/licenses/by/2.0/ + */ +?> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html lang="<?=$lang?>"> +<head> + <title><?=_("Oreka")?>: <?=$pageTitle?></title> + <meta http-equiv="Content-Type" content="text/html; charset=<?=$encoding?>"> + <link rel="stylesheet" href="<?=$sitePath?>/style.css" type="text/css"> +</head> +<body> +<p><a class="skip" href="#content"><?=_("Jump to page content")?></a></p> + +<form id="search" action="http://google.com/custom" method="get"><p> + <label for="q"><a href="http://www.google.com/"><img alt="Google" title="<?=_("Powered by Google")?>" src="http://www.google.com/logos/Logo_25wht.gif"></a></label> + <input name="q" id="q" class="text"> + <input type="hidden" name="sitesearch" value="oreka.sourceforge.net"> + <input type="hidden" name="cof" value="S:http://oreka.sourceforge.net/;AH:center;LH:100;L:http://oreka.sourceforge.net/images/oreka.jpg;LW:253;AWFID:a42d5b7b681df0fd;"> + <input type="hidden" name="domains" value="oreka.sourceforge.net"> + <input type="submit" value="<?=_("Search this site")?>"> +</p></form> + +<?php + $titleStr = _("Oreka"); + $titleImg = "<img title=\"$titleStr\" alt=\"$titleStr\" src=\"$sitePath/images/oreka.jpg\" width=\"253\" height=\"100\">"; + + if ($sectionId == "" && $pageId == "") { + echo "<h1>$titleStr</h1><p> </p>"; + } + else { + echo "<h1>$titleStr</h1><p> </p>"; + } +?> + +<div id="sitenav"> + <h2><?=_("Site Navigation")?></h2> + <ul> + <?php + foreach ($siteNavItems as $navItem) { + $name = $navItem[0]; + $path = $navItem[1]; + if ($sectionId == $path) { + $sectionNavItems = $navItem[2]; + ?><li class="selected"><?=$name?></li><?php + } + else { + ?><li><a href="<?=$sitePath?>/<?=$path?>"><?=$name?></a></li><?php + } + } + ?> + </ul> +</div> + +<?php + if ($sectionNavItems) { + ?> + <div id="subnav"> + <?php + if ($pageId == "") { + ?><h3 class="selected"><?=$sectionTitle?></h3><?php + } + else { + ?><h3><a href="<?=$sectionPath?>/"><?=$sectionTitle?></a></h3><?php + } + ?> + <ul> + <?php + foreach ($sectionNavItems as $navItem) { + $name = $navItem[0]; + $path = $navItem[1]; + if ($pageId == $path) { + ?><li class="selected"><?=$name?></li><?php + } + else { + ?><li><a href="<?=$sectionPath?>/<?=$path?>"><?=$name?></a></li><?php + } + } + ?> + </ul> + </div> + <?php + } +?> + +<div id="content"<?php if ($sectionNavItems) echo ' class="afternav"';?>> diff --git a/website/include/lang.inc.php b/website/include/lang.inc.php new file mode 100644 index 0000000..246ed0d --- /dev/null +++ b/website/include/lang.inc.php @@ -0,0 +1,95 @@ +<?php +/* + * This file contains code to set up and use the gettext-based localization + * system. + * + * Copyright 2005 Matt Brubeck + * This file is licensed under a Creative Commons license: + * http://creativecommons.org/licenses/by/2.0/ + */ + +require_once 'HTTP.php'; + +// Locale configuration variables. +$domain = "audacity_website"; +$lang = "en"; +$encoding = "UTF-8"; +$cookie_days = 90; + +// List of available languages. +$available_locales = array( + // Language code => Full locale name, Human-readable name. + "cs" => array("cs_CZ", "Česky"), + "de" => array("de_DE", "Deutsch"), + "el" => array("el_GR", "Ελληνικά"), + "en" => array("en_US", "English"), + "es" => array("es_ES", "Español"), + "fr" => array("fr_FR", "Français"), + "it" => array("it_IT", "Italiano"), + "hu" => array("hu_HU", "Magyar"), + "nb" => array("nb_NO", "Norsk (Bokmål)"), + "pt" => array("pt_BR", "Português"), + "sl" => array("sl_SI", "Slovenščina"), + "fi" => array("fi_FI", "Suomi"), + "sv" => array("sv_SE", "Svenska"), + "ja" => array("ja_JP", "日本語"), + "ru" => array("ru_RU", "Русский"), + "zh-CN" => array("zh_CN.UTF-8", "中文(简)"), + "zh-TW" => array("zh_TW.UTF-8", "中文(繁)"), +); + +// Set up the translation variables and libraries. +function localization_setup() { + global $lang, $domain, $encoding, $available_locales, $preferred_lang; + + // Choose a default language based on the client's HTTP headers. + // TODO: Replace HTTP::negotiateLanguage with something less buggy. + // (See http://www.dracos.co.uk/web/php/HTTP/ for details.) + $supported = $available_locales; + $preferred_lang = HTTP::negotiateLanguage($supported, $lang); + if ($preferred_lang) + $lang = $preferred_lang; + + // Override the default if the user has an explicit cookie or query string. + $force_lang = get_requested_lang(); + if ($force_lang && array_key_exists($force_lang, $available_locales)) + $lang = $force_lang; + + if ($available_locales[$lang]) { + // Set the locale. + $locale = $available_locales[$lang][0]; + setlocale(LC_ALL, $locale); + + // Find the locale directory. + $path_parts = pathinfo(__FILE__); + $this_dir = $path_parts["dirname"]; + bindtextdomain($domain, "$this_dir/../locale"); + + // Set up gettext message localization. + textdomain($domain); + bind_textdomain_codeset($domain, $encoding); + } + + // Tell clients to cache different languages separately. + header("Vary: Accept-Language"); +} + +// Return the explicitly requested language, if available. +function get_requested_lang() { + global $cookie_days; + $result = $_COOKIE["lang"]; + if ($_GET["lang"]) { + $result = $_GET["lang"]; + setcookie("lang", $result, time() + $cookie_days*24*60*60, "/"); + } + return $result; +} + +// Convert a string from the locale encoding to the output encoding. +function locale_to_unicode($s) { + global $encoding; + $locale_encoding = nl_langinfo(CODESET); + $s = iconv($locale_encoding, $encoding, $s); + return $s; +} +?> diff --git a/website/include/news.inc.php b/website/include/news.inc.php new file mode 100644 index 0000000..a912510 --- /dev/null +++ b/website/include/news.inc.php @@ -0,0 +1,44 @@ +<?php +/* + * Copyright 2004 Matt Brubeck + * This file is licensed under a Creative Commons license: + * http://creativecommons.org/licenses/by/2.0/ + */ +class NewsItem { + var $id; + var $date; + var $title; + var $body; + + // Constructor. + function NewsItem($date, $title, $body) { + $this->date = $date; + $this->title = $title; + $this->body = $body; + } + + // Returns the date, in the preferred format for the current locale. + function dateStr() { + // i18n-hint: Controls how dates are formatted. + // See http://www.php.net/manual/function.strftime.php for details. + return locale_to_unicode(strftime(_("%B %d, %Y"), $this->date)); + } +} + +$news_items = array(); +function add_news_item($dateStr, $id, $title, $body) { + global $news_items; + $date = strtotime($dateStr); + $key = strftime("%Y-%m-%d", $date)."/".$id; + $news_items[$key] = new NewsItem($date, $title, $body); +} +function most_recent_news_item() { +} + +add_news_item( + "October 26, 2005", + "0.1-release", + _("Oreka 0.1 Released"), + _('<p>This is the first public release of oreka. Please check it out and let us know issues you are encountering on oreka-devel and oreka-user mailing lists.</p>') +); +?> diff --git a/website/include/strings.inc.php b/website/include/strings.inc.php new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/website/include/strings.inc.php |