summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-x[-rw-r--r--]admin/administration.php14
-rwxr-xr-xadmin/index.php30
-rwxr-xr-xadmin/template.php10
-rwxr-xr-x[-rw-r--r--]app/app.php25
-rw-r--r--app/classes/PlanetConfig.php1
-rw-r--r--app/classes/Simplel10n.class.php40
-rw-r--r--app/l10n/fr.lang169
-rwxr-xr-x[-rw-r--r--]custom/views/archive/footer.tpl.php4
-rwxr-xr-x[-rw-r--r--]custom/views/archive/index.tpl.php42
-rwxr-xr-x[-rw-r--r--]custom/views/archive/sidebar.tpl.php20
-rwxr-xr-x[-rw-r--r--]custom/views/default/footer.tpl.php4
-rwxr-xr-x[-rw-r--r--]custom/views/default/index.tpl.php20
-rwxr-xr-x[-rw-r--r--]custom/views/default/sidebar.tpl.php20
-rwxr-xr-x[-rw-r--r--]index.php8
-rwxr-xr-xinstall.php82
15 files changed, 353 insertions, 136 deletions
diff --git a/admin/administration.php b/admin/administration.php
index 894ebd3..1202e91 100644..100755
--- a/admin/administration.php
+++ b/admin/administration.php
@@ -1,7 +1,7 @@
<?php
require_once dirname(__FILE__) . '/inc/auth.inc.php';
-require_once dirname(__FILE__) . '/../app/lib/lib.opml.php';
+require_once dirname(__FILE__) . '/../app/app.php';
$opml = OpmlManager::load(dirname(__FILE__) . '/../custom/people.opml');
$opml_people = $opml->getPeople();
@@ -11,7 +11,7 @@ $header_extra = <<<"HTML"
window.onload = function(){
var formManage = document.getElementById('frmPurge');
formManage.onsubmit = function(){
- return confirm('Are you sure you want to purge the cache?');
+ return confirm("{$l10n->getString('Are you sure you want to purge the cache?')}");
}
}
</script>
@@ -21,17 +21,17 @@ HTML;
$page_content = <<<"FRAGMENT"
<div class="widget">
- <h3>Clear cache</h3>
+ <h3>{$l10n->getString('Clear cache')}</h3>
<form action="purgecache.php" method="post" id="frmPurge">
- <p><label>Clear cache:</label><input type="submit" class="submit delete" name="purge" id="purge" value="Clear" /></p>
- <p class="help">Clearing the cache will make moonmoon reload all feeds.</p>
+ <p><label>{$l10n->getString('Clear cache:')}</label><input type="submit" class="submit delete" name="purge" id="purge" value="{$l10n->getString('Clear')}" /></p>
+ <p class="help">{$l10n->getString('Clearing the cache will make moonmoon reload all feeds.')}</p>
</form>
</div>
<div class="widget">
- <h3>Change administrator password</h3>
+ <h3>{$l10n->getString('Change administrator password')}</h3>
<form action="changepassword.php" method="post" id="frmPassword">
- <p><label for="password">New password:</label> <input type="password" class="text" value="" name="password" id="password" size="20" /> <input type="submit" class="submit delete" name="changepwd" id="changepwd" value="Change password" /></p>
+ <p><label for="password">{$l10n->getString('New password:')}</label> <input type="password" class="text" value="" name="password" id="password" size="20" /> <input type="submit" class="submit delete" name="changepwd" id="changepwd" value="{$l10n->getString('Change password')}" /></p>
</form>
</div>
diff --git a/admin/index.php b/admin/index.php
index 77ba04d..28f7198 100755
--- a/admin/index.php
+++ b/admin/index.php
@@ -71,34 +71,34 @@ ob_start();
?>
<div class="widget">
- <h3>Add a new feed</h3>
+ <h3><?=_g('Add Feed')?></h3>
<form action="subscriptions.php" method="post" id="feedimport">
<fieldset>
- <label for="url">Link:</label>
+ <label for="url"><?=_g('Link:')?></label>
<input type="text" class="text" name="url" id="url" placeholder="http://" class="text" size="50" />
- <input type="submit" class="submit add" name="add" value="Add feed" />
+ <input type="submit" class="submit add" name="add" value="<?=_g('Add Feed')?>" />
</fieldset>
- <p class="help">Accepted formats are RSS and ATOM. If the link is not a feed, moonmoon will try to autodiscover the feed.</p>
+ <p class="help"><?=_g('Accepted formats are RSS and ATOM. If the link is not a feed, moonmoon will try to autodiscover the feed.')?></p>
</form>
</div>
<div class="widget">
- <h3>Manage existing feeds</h3>
+ <h3><?=_g('Manage existing feeds')?></h3>
<form action="subscriptions.php" method="post" id="feedmanage">
<p class="action">
- <span class="count">Number of feeds: <?=$count_feeds?></span>
- <input type="submit" class="submit save" name="save" id="save" value="Save changes" />
- <input type="submit" class="submit delete" name="delete" id="delete" value="Delete selected" />
+ <span class="count"><?php echo sprintf(_g('Number of feeds: %s'), $count_feeds)?></span>
+ <input type="submit" class="submit save" name="save" id="save" value="<?=_g('Save changes')?>" />
+ <input type="submit" class="submit delete" name="delete" id="delete" value="<?=_g('Delete selected Feeds')?>" />
</p>
- <p class="select">Select : <a href="javascript:void(0);" id="selectall">All</a>, <a href="javascript:void(0);" id="selectnone">None</a></p>
+ <p class="select"><?=_g('Select :')?> <a href="javascript:void(0);" id="selectall"><?=_g('All')?></a>, <a href="javascript:void(0);" id="selectnone"><?=_g('None')?></a></p>
<table>
<thead>
<tr>
- <th><span>Selection</span></th>
- <th>Name</th>
- <th>Last entry</th>
- <th>Website link</th>
- <th>Feed link</th>
+ <th><span><?=_g('Selection')?></span></th>
+ <th><?=_g('Name')?></th>
+ <th><?=_g('Last entry')?></th>
+ <th><?=_g('Website link')?></th>
+ <th><?=_g('Feed link')?></th>
</tr>
</thead>
<tbody>
@@ -116,7 +116,7 @@ ob_start();
if (count($items) > 0) {
echo $items[0]->get_date();
} else {
- echo "Not in cache";
+ echo _g('Not in cache');
}
?>
</td>
diff --git a/admin/template.php b/admin/template.php
index 6a3c2ea..d5641f9 100755
--- a/admin/template.php
+++ b/admin/template.php
@@ -3,7 +3,7 @@
<html lang="en">
<head>
<meta charset="utf-8">
- <title>moonmoon administration</title>
+ <title><?=_g('moonmoon administration')?></title>
<link rel="stylesheet" media="screen" type="text/css" href="default.css">
<!--[if lte IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
@@ -17,16 +17,16 @@
<div id="page">
<header>
<h1>moonmoon</h1>
- <p><a href="../">Back to main page</a></p>
+ <p><a href="../"><?=_g('Back to main page')?></a></p>
</header>
<?php if($admin_access == 1) : ?>
- <p class="logout"><a href="logout.php">Logout</a></p>
+ <p class="logout"><a href="logout.php"><?=_g('Logout')?></a></p>
<nav>
<ul>
- <li id="nav-feed"><a href="index.php">Feeds</a></li>
- <li id="nav-admin"><a href="administration.php">Administration</a></li>
+ <li id="nav-feed"><a href="index.php"><?=_g('Feeds')?></a></li>
+ <li id="nav-admin"><a href="administration.php"><?=_g('Administration')?></a></li>
</ul>
</nav>
diff --git a/app/app.php b/app/app.php
index 1bb632c..d17c42e 100644..100755
--- a/app/app.php
+++ b/app/app.php
@@ -17,9 +17,30 @@ include_once(dirname(__FILE__).'/classes/PlanetFeed.php');
include_once(dirname(__FILE__).'/classes/PlanetItem.php');
include_once(dirname(__FILE__).'/classes/PlanetError.php');
include_once(dirname(__FILE__).'/classes/Planet.class.php');
+include_once(dirname(__FILE__).'/classes/Simplel10n.class.php');
+
+$savedConfig = dirname(__FILE__).'/../custom/config.yml';
+
+if (is_file($savedConfig)){
+
+ $conf = Spyc::YAMLLoad($savedConfig);
+
+ // this is a check to upgrade older config file without l10n
+ if(!isset($conf['locale'])) {
+ $resetPlanetConfig = new PlanetConfig($conf);
+ file_put_contents($savedConfig, $resetPlanetConfig->toYaml());
+ $conf = Spyc::YAMLLoad($savedConfig);
+ }
-if (is_file(dirname(__FILE__).'/../custom/config.yml')){
- $conf = Spyc::YAMLLoad(dirname(__FILE__).'/../custom/config.yml');
$PlanetConfig = new PlanetConfig($conf);
$Planet = new Planet($PlanetConfig);
}
+
+$l10n = new Simplel10n($conf['locale']);
+
+// this is an helper function. We will usually use that function and not Simplel10n::getString()
+function _g($str) {
+ return Simplel10n::getString($str);
+}
+
+
diff --git a/app/classes/PlanetConfig.php b/app/classes/PlanetConfig.php
index 13e1cc6..a31938e 100644
--- a/app/classes/PlanetConfig.php
+++ b/app/classes/PlanetConfig.php
@@ -13,6 +13,7 @@ class PlanetConfig
$defaultConfig = array(
'url' => 'http://www.example.com/',
'name' => '',
+ 'locale' => 'en',
'items' => 10,
'shuffle' => 0,
'refresh' => 240,
diff --git a/app/classes/Simplel10n.class.php b/app/classes/Simplel10n.class.php
new file mode 100644
index 0000000..cc31921
--- /dev/null
+++ b/app/classes/Simplel10n.class.php
@@ -0,0 +1,40 @@
+<?php
+
+
+class Simplel10n {
+
+ public $locale;
+ public $l10nFolder;
+
+ public function __construct($locale='en') {
+ $GLOBALS['locale'] = array();
+ $this->locale = $locale;
+ $this->l10nFolder = dirname(__FILE__) . '/../l10n/';
+ $this->load($this->l10nFolder . $this->locale);
+ }
+
+ public function setL1OnFolder($path) {
+ $this->l10nFolder = $path;
+ }
+
+ static function getString($str) {
+ if(array_key_exists($str, $GLOBALS['locale'])) {
+ return $GLOBALS['locale'][$str];
+ } else {
+ return $str;
+ }
+ }
+
+ static function load($pathToFile) {
+
+ if (!file_exists($pathToFile . '.lang')) return false;
+
+ $file = file($pathToFile . '.lang');
+
+ foreach ($file as $k => $v) {
+ if (substr($v,0,1) == ';' && !empty($file[$k+1])) {
+ $GLOBALS['locale'][trim(substr($v,1))] = trim($file[$k+1]);
+ }
+ }
+ }
+}
diff --git a/app/l10n/fr.lang b/app/l10n/fr.lang
new file mode 100644
index 0000000..2b933f0
--- /dev/null
+++ b/app/l10n/fr.lang
@@ -0,0 +1,169 @@
+;People
+Personnes
+
+;Powered by <a %s>moonmoon</a>
+Propulsé par <a %s>moonmoon</a>
+
+;Feed
+Flux
+
+;Website
+Site Web
+
+;All feeds in OPML format
+Tous les flux au format OPML
+
+;Syndicate
+Syndiquer
+
+;Feed (ATOM)
+Flux (ATOM)
+
+;Archives
+Archives
+
+;See all headlines
+Afficher tous les titres
+
+;Source:
+Source&nbsp;:
+
+;Today
+Aujourd'hui
+
+;This week
+Cette semaine
+
+;This month
+Ce mois
+
+;Older items
+Billets plus anciens
+
+;No article
+Pas d'articles
+
+;No news, good news.
+Pas de nouvelles, bonne nouvelle.
+
+;Go to original place
+Aller à l'emplacement d'origine
+
+# administration panel strings below
+
+;moonmoon installation
+Installation de moonmoon
+
+
+;Server is running PHP5
+Le serveur utilise PHP5
+
+;Check your server documentation to activate PHP5.
+Vérifiez la documentation de votre serveur pour activer PHP5
+
+;<code>%s</code> is writable
+<code>%s</code> est accessible en écriture
+
+;Make <code>%s</code> writable with CHMOD
+Donnez les droits en écriture sur <code>%s</code> avec CHMOD
+
+;Congratulations! Your moonmoon is ready.
+Félicitations&nbsp;! Votre moonmoon est prêt.
+
+;What's next?
+Et maintenant &nbsp;?
+
+;<strong>Delete</strong> <code>install.php</code> with your FTP software.
+<strong>Effacez</strong> <code>install.php</code> avec votre logiciel FTP.
+
+;Use your password to go to the <a href="./admin/">administration panel</a>
+Utilisez votre mot de passe pour vous rendre sur la <a href="./admin/">console d'administration</a>
+
+
+;Feeds
+Flux
+
+;Back to main page
+Retour à l'accueil
+
+;moonmoon administration
+Administration de moonmoon
+
+;Logout
+Déconnexion
+
+;Administration
+Administration
+
+;Add Feed
+Ajouter un flux
+
+;Link:
+Lien&nbsp;:
+
+;Accepted formats are RSS and ATOM. If the link is not a feed, moonmoon will try to autodiscover the feed.
+Les formats valides sont RSS et ATOM. Si le lien n'est pas un flux, moonmoon essaiera de trouver le flux automatiquement.
+
+;Manage existing feeds
+Gérer les flux
+
+;Number of feeds: %s
+Nombre de flux&nbsp;: %s
+
+;Save changes
+Enregistrer les changements
+
+;Delete selected Feeds
+Effacer les flux sélectionnés
+
+;Select :
+Sélectionner
+
+;All
+Tout
+
+;None
+Aucun
+
+
+;Selection
+Sélection
+
+;Name
+Titre
+
+;Last entry
+Dernière entrée
+
+;Website link
+Lien du site
+
+;Feed link
+Lien du Flux
+
+;Not in cache
+Pas en cache
+
+;Are you sure you want to purge the cache?
+Êtes-vous sûr de vouloir vider le cache ?
+
+;Clear cache:
+Vider le cache &nbsp;:
+
+;Clear cache
+Vider le cache
+
+;Clear
+Vider
+
+;Clearing the cache will make moonmoon reload all feeds.
+Vider le cache forcera moonmoon à recharger tous les flux.
+
+;Change administrator password
+Changer le mot de passe de l'administrateur
+
+;New password:
+Nouveau mot de passe &nbsp;:
+
+;Change password
+Changer le mot de passe
diff --git a/custom/views/archive/footer.tpl.php b/custom/views/archive/footer.tpl.php
index 5b27882..bfc0210 100644..100755
--- a/custom/views/archive/footer.tpl.php
+++ b/custom/views/archive/footer.tpl.php
@@ -1,3 +1,3 @@
<div id="footer">
- <p>Powered by <a href="http://moonmoon.org/">moonmoon</a> | <a href="./admin/">Administration</a></p>
- </div> \ No newline at end of file
+ <p><? echo str_replace('%s', 'href="http://moonmoon.org"', _g('Powered by <a %s>moonmoon</a>'))?> | <a href="./admin/"><?=_g('Administration')?></a></p>
+ </div>
diff --git a/custom/views/archive/index.tpl.php b/custom/views/archive/index.tpl.php
index c09e266..2bb8f36 100644..100755
--- a/custom/views/archive/index.tpl.php
+++ b/custom/views/archive/index.tpl.php
@@ -5,7 +5,7 @@ $week = Array();
$month = Array();
$older = Array();
$now = time();
-
+
foreach ($items as $item) {
$age = ($now - $item->get_date('U')) / (60*60*24);
if ($age < 1) {
@@ -22,7 +22,7 @@ foreach ($items as $item) {
header('Content-type: text/html; charset=UTF-8');
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?=$conf['locale']?>" lang="<?=$conf['locale']?>">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
@@ -35,69 +35,69 @@ header('Content-type: text/html; charset=UTF-8');
<body>
<div id="page">
<?php include(dirname(__FILE__).'/top.tpl.php'); ?>
-
+
<div id="content">
<?php if (0 == count($items)) :?>
<div class="article">
<h2 class="article-title">
- No article
+ <?=_g('No article')?>
</h2>
- <p class="article-content">No news, good news.</p>
+ <p class="article-content"><?=_g('No news, good news.')?></p>
</div>
<?php endif; ?>
<?php if (count($today)): ?>
<div class="article">
- <h2>Today</h2>
+ <h2><?=_g('Today')?></h2>
<ul>
<?php foreach ($today as $item): ?>
<?php $feed = $item->get_feed(); ?>
<li>
- <a href="<?php echo $feed->getWebsite() ?>" class="source"><?php echo $feed->getName() ?></a> :
- <a href="<?php echo $item->get_permalink(); ?>" title="Go to original place"><?php echo $item->get_title(); ?></a>
+ <a href="<?php echo $feed->getWebsite() ?>" class="source"><?php echo $feed->getName() ?></a> :
+ <a href="<?php echo $item->get_permalink(); ?>" title="<?=_g('Go to original place')?>"><?php echo $item->get_title(); ?></a>
</li>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
-
+
<?php if (count($week)): ?>
<div class="article">
- <h2>This week</h2>
+ <h2><?=_g('This week')?></h2>
<ul>
<?php foreach ($week as $item): ?>
<?php $feed = $item->get_feed(); ?>
<li>
- <a href="<?php echo $feed->getWebsite() ?>" class="source"><?php echo $feed->getName() ?></a> :
- <a href="<?php echo $item->get_permalink(); ?>" title="Go to original place"><?php echo $item->get_title(); ?></a>
+ <a href="<?php echo $feed->getWebsite() ?>" class="source"><?php echo $feed->getName() ?></a> :
+ <a href="<?php echo $item->get_permalink(); ?>" title="<?=_g('Go to original place')?>"><?php echo $item->get_title(); ?></a>
</li>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
-
+
<?php if (count($month)): ?>
<div class="article">
- <h2>This month</h2>
+ <h2><?=_g('This month')?></h2>
<ul>
<?php foreach ($month as $item): ?>
<?php $feed = $item->get_feed(); ?>
<li>
- <a href="<?php echo $feed->getWebsite() ?>" class="source"><?php echo $feed->getName() ?></a> :
- <a href="<?php echo $item->get_permalink(); ?>" title="Go to original place"><?php echo $item->get_title(); ?></a>
+ <a href="<?php echo $feed->getWebsite() ?>" class="source"><?php echo $feed->getName() ?></a> :
+ <a href="<?php echo $item->get_permalink(); ?>" title="<?=_g('Go to original place')?>"><?php echo $item->get_title(); ?></a>
</li>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
-
+
<?php if (count($older)): ?>
<div class="article">
- <h2>Older items</h2>
+ <h2><?=_g('Older items')?></h2>
<ul>
<?php foreach ($older as $item): ?>
<?php $feed = $item->get_feed(); ?>
<li>
- <a href="<?php echo $feed->getWebsite() ?>" class="source"><?php echo $feed->getName() ?></a> :
+ <a href="<?php echo $feed->getWebsite() ?>" class="source"><?php echo $feed->getName() ?></a> :
<a href="<?php echo $item->get_permalink(); ?>" title="Go to original place"><?php echo $item->get_title(); ?></a>
</li>
<?php endforeach; ?>
@@ -105,9 +105,9 @@ header('Content-type: text/html; charset=UTF-8');
</div>
<?php endif; ?>
</div>
-
+
<?php include_once(dirname(__FILE__).'/sidebar.tpl.php'); ?>
-
+
<?php include(dirname(__FILE__).'/footer.tpl.php'); ?>
</div>
</body>
diff --git a/custom/views/archive/sidebar.tpl.php b/custom/views/archive/sidebar.tpl.php
index fc2c881..3f0d617 100644..100755
--- a/custom/views/archive/sidebar.tpl.php
+++ b/custom/views/archive/sidebar.tpl.php
@@ -4,31 +4,31 @@ usort($all_people, array('PlanetFeed', 'compare'));
?>
<div id="sidebar">
<div id="sidebar-people">
- <h2>People (<?php echo count($all_people); ?>)</h2>
+ <h2><?=_g('People')?> (<?php echo count($all_people); ?>)</h2>
<ul>
<?php foreach ($all_people as $person) : ?>
<li>
- <a href="<?php echo htmlspecialchars($person->getFeed(), ENT_QUOTES, 'UTF-8'); ?>" title="Feed"><img src="postload.php?url=<?php echo urlencode(htmlspecialchars($person->getFeed(), ENT_QUOTES, 'UTF-8')); ?>" alt="feed" height="12" width="12" /></a>
- <a href="<?php echo $person->getWebsite(); ?>" title="Website"><?php echo htmlspecialchars($person->getName(), ENT_QUOTES, 'UTF-8'); ?></a>
+ <a href="<?php echo htmlspecialchars($person->getFeed(), ENT_QUOTES, 'UTF-8'); ?>" title="<?=_g('Feed')?>"><img src="postload.php?url=<?php echo urlencode(htmlspecialchars($person->getFeed(), ENT_QUOTES, 'UTF-8')); ?>" alt="<?=_g('Feed')?>" height="12" width="12" /></a>
+ <a href="<?php echo $person->getWebsite(); ?>" title="<?=_g('Website')?>"><?php echo htmlspecialchars($person->getName(), ENT_QUOTES, 'UTF-8'); ?></a>
</li>
<?php endforeach; ?>
</ul>
<p>
- <a href="custom/people.opml"><img src="custom/img/opml.png" alt="feed" height="12" width="12" />&nbsp;All feeds in OPML format</a>
+ <a href="custom/people.opml"><img src="custom/img/opml.png" alt="<?=_g('Feed')?>" height="12" width="12" />&nbsp;<?=_g('All feeds in OPML format')?></a>
</p>
</div>
-
+
<div>
- <h2>Syndicate</h2>
+ <h2><?=_g('Syndicate')?></h2>
<ul>
- <li><img src="custom/img/feed.png" alt="feed" height="12" width="12" />&nbsp;<a href="?type=atom10">Feed (ATOM)</a></li>
+ <li><img src="custom/img/feed.png" alt="<?=_g('Feed')?>" height="12" width="12" />&nbsp;<a href="?type=atom10"><?=_g('Feed (ATOM)')?></a></li>
</ul>
</div>
<div>
- <h2>Archives</h2>
+ <h2><?=_g('Archives')?></h2>
<ul>
- <li><a href="?type=archive">See all headlines</a></li>
+ <li><a href="?type=archive"><?=_g('See all headlines')?></a></li>
</ul>
</div>
-</div> \ No newline at end of file
+</div>
diff --git a/custom/views/default/footer.tpl.php b/custom/views/default/footer.tpl.php
index 5b27882..bfc0210 100644..100755
--- a/custom/views/default/footer.tpl.php
+++ b/custom/views/default/footer.tpl.php
@@ -1,3 +1,3 @@
<div id="footer">
- <p>Powered by <a href="http://moonmoon.org/">moonmoon</a> | <a href="./admin/">Administration</a></p>
- </div> \ No newline at end of file
+ <p><? echo str_replace('%s', 'href="http://moonmoon.org"', _g('Powered by <a %s>moonmoon</a>'))?> | <a href="./admin/"><?=_g('Administration')?></a></p>
+ </div>
diff --git a/custom/views/default/index.tpl.php b/custom/views/default/index.tpl.php
index 9efc5f7..8153f2f 100644..100755
--- a/custom/views/default/index.tpl.php
+++ b/custom/views/default/index.tpl.php
@@ -5,7 +5,7 @@ $count = 0;
header('Content-type: text/html; charset=UTF-8');
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?=$conf['locale']?>" lang="<?=$conf['locale']?>">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
@@ -21,7 +21,7 @@ header('Content-type: text/html; charset=UTF-8');
</script>
<div id="page">
<?php include(dirname(__FILE__).'/top.tpl.php'); ?>
-
+
<div id="content">
<?php if (0 == count($items)) : ?>
<div class="article">
@@ -32,7 +32,7 @@ header('Content-type: text/html; charset=UTF-8');
</div>
<?php else : ?>
<?php foreach ($items as $item): ?>
- <?php
+ <?php
$arParsedUrl = parse_url($item->get_feed()->getWebsite());
$host = 'from-' . preg_replace('/[^a-zA-Z0-9]/i', '-', $arParsedUrl['host']);
?>
@@ -41,17 +41,17 @@ header('Content-type: text/html; charset=UTF-8');
<a href="<?php echo $item->get_permalink(); ?>" title="Go to original place"><?php echo $item->get_title(); ?></a>
</h2>
<p class="article-info">
-
+
<?php echo ($item->get_author()? $item->get_author()->get_name() : 'Anonymous'); ?>,
- <?php
+ <?php
$ago = time() - $item->get_date('U');
//echo '<span title="'.Duration::toString($ago).' ago" class="date">'.date('d/m/Y', $item->get_date('U')).'</span>';
echo '<span id="post'.$item->get_date('U').'" class="date">'.$item->get_date('d/m/Y').'</span>';
?>
-
+
|
-
- Source: <?php
+
+ <?=_g('Source:')?> <?php
$feed = $item->get_feed();
echo '<a href="'.$feed->getWebsite().'" class="source">'.$feed->getName().'</a>';
?>
@@ -64,9 +64,9 @@ header('Content-type: text/html; charset=UTF-8');
<?php endforeach; ?>
<?php endif; ?>
</div>
-
+
<?php include_once(dirname(__FILE__).'/sidebar.tpl.php'); ?>
-
+
<?php include(dirname(__FILE__).'/footer.tpl.php'); ?>
</div>
</body>
diff --git a/custom/views/default/sidebar.tpl.php b/custom/views/default/sidebar.tpl.php
index 9e7631c..2a3a360 100644..100755
--- a/custom/views/default/sidebar.tpl.php
+++ b/custom/views/default/sidebar.tpl.php
@@ -4,31 +4,31 @@ usort($all_people, array('PlanetFeed', 'compare'));
?>
<div id="sidebar" class="aside">
<div id="sidebar-people" class="section">
- <h2>People (<?php echo count($all_people); ?>)</h2>
+ <h2><?php echo _g('People') . ' (' . count($all_people) . ')'?></h2>
<ul>
<?php foreach ($all_people as $person) : ?>
<li>
- <a href="<?php echo htmlspecialchars($person->getFeed(), ENT_QUOTES, 'UTF-8'); ?>" title="Feed"><img src="postload.php?url=<?php echo urlencode(htmlspecialchars($person->getFeed(), ENT_QUOTES, 'UTF-8')); ?>" alt="" height="12" width="12" /></a>
- <a href="<?php echo $person->getWebsite(); ?>" title="Website"><?php echo htmlspecialchars($person->getName(), ENT_QUOTES, 'UTF-8'); ?></a>
+ <a href="<?php echo htmlspecialchars($person->getFeed(), ENT_QUOTES, 'UTF-8'); ?>" title="<?=_g('Feed')?>"><img src="postload.php?url=<?php echo urlencode(htmlspecialchars($person->getFeed(), ENT_QUOTES, 'UTF-8')); ?>" alt="" height="12" width="12" /></a>
+ <a href="<?php echo $person->getWebsite(); ?>" title="<?=_g('Website')?>"><?php echo htmlspecialchars($person->getName(), ENT_QUOTES, 'UTF-8'); ?></a>
</li>
<?php endforeach; ?>
</ul>
<p>
- <img src="custom/img/opml.png" alt="feed" height="12" width="12" /> <a href="custom/people.opml">All feeds in OPML format</a>
+ <img src="custom/img/opml.png" alt="<?=_g('Feed')?>" height="12" width="12" /> <a href="custom/people.opml"><?=_g('All feeds in OPML format')?></a>
</p>
</div>
-
+
<div class="section">
- <h2>Syndicate</h2>
+ <h2><?=_g('Syndicate')?></h2>
<ul>
- <li><img src="custom/img/feed.png" alt="feed" height="12" width="12" />&nbsp;<a href="?type=atom10">Feed (ATOM)</a></li>
+ <li><img src="custom/img/feed.png" alt="<?=_g('Feed')?>" height="12" width="12" />&nbsp;<a href="?type=atom10"><?=_g('Feed (ATOM)')?></a></li>
</ul>
</div>
<div class="section">
- <h2>Archives</h2>
+ <h2><?=_g('Archives')?></h2>
<ul>
- <li><a href="?type=archive">See all headlines</a></li>
+ <li><a href="?type=archive"><?=_g('See all headlines')?></a></li>
</ul>
</div>
-</div> \ No newline at end of file
+</div>
diff --git a/index.php b/index.php
index e8644c2..d6a2853 100644..100755
--- a/index.php
+++ b/index.php
@@ -4,7 +4,7 @@ include_once(dirname(__FILE__).'/app/lib/Cache.php');
//Installed ?
if (!isset($Planet)) {
- echo '<p>You might want to <a href="install.php">install moonmoon</a>.</p>';
+ echo '<p>' . _g('You might want to <a href="install.php">install moonmoon</a>.') . '</p>';
exit;
}
@@ -23,8 +23,8 @@ $cache_duration = $PlanetConfig->getOutputTimeout()*60;
Cache::setStore(dirname(__FILE__).'/'.$conf['cachedir']);
//Go display
-if (!isset($_GET['type']) ||
- !is_file(dirname(__FILE__).'/custom/views/'.$_GET['type'].'/index.tpl.php') ||
+if (!isset($_GET['type']) ||
+ !is_file(dirname(__FILE__).'/custom/views/'.$_GET['type'].'/index.tpl.php') ||
strpos($_GET['type'], DIRECTORY_SEPARATOR)){
$_GET['type'] = 'default';
}
@@ -36,4 +36,4 @@ if (!OutputCache::Start($_GET['type'], $cache_key, $cache_duration)) {
echo "<!--";
var_dump($Planet->errors);
-echo "-->"; \ No newline at end of file
+echo "-->";
diff --git a/install.php b/install.php
index 482a8d0..3a3eae7 100755
--- a/install.php
+++ b/install.php
@@ -1,5 +1,7 @@
<?php
+require_once dirname(__FILE__) . '/app/app.php';
+
// This is an helper function returning an html table row to avoid code duplication
function installStatus($str, $msg, $result) {
$class = ($result) ? 'ok' : 'fail';
@@ -11,12 +13,12 @@ if (file_exists(dirname(__FILE__) . '/custom/config.yml')
&& file_exists(dirname(__FILE__) . '/admin/inc/pwd.inc.php')) {
$status = 'installed';
} elseif (isset($_REQUEST['url'])) {
- require_once dirname(__FILE__) . '/app/app.php';
$save = array();
//Save config file
$config = array(
'url' => filter_var($_REQUEST['url'], FILTER_SANITIZE_ENCODED),
'name' => filter_var($_REQUEST['title'], FILTER_SANITIZE_SPECIAL_CHARS),
+ 'locale' => filter_var($_REQUEST['locale'], FILTER_SANITIZE_SPECIAL_CHARS),
'items' => 10,
'shuffle' => 0,
'refresh' => 240,
@@ -37,53 +39,30 @@ if (file_exists(dirname(__FILE__) . '/custom/config.yml')
}
} else {
- // Server requirements with advices in case there is something wrong
- $tests = array(
- 'php5' => array(
- 'file' => false,
- 'label' => 'Server is running PHP5',
- 'solution' => 'Check your server documentation to activate PHP5.',
- ),
- 'custom' => array(
- 'file' => '/custom',
- 'label' => '<code>./custom</code> is writable',
- 'solution' => 'Change the access rights for <code>./custom</code> with CHMOD'
- ),
- 'opml' => array(
- 'file' => '/custom/people.opml',
- 'label' => '<code>./custom/people.opml</code> is writable',
- 'solution' => 'Change the access rights for <code>./custom/people.opml</code> with CHMOD'
- ),
- 'changepassword' => array(
- 'file' => '/admin/inc/pwd.inc.php',
- 'label' => 'Administrator password can be changed',
- 'solution' => 'Change the access right for <code>./admin/inc/pwd.inc.php</code> with CHMOD'
- ),
- 'cache' => array(
- 'file' => '/cache',
- 'label' => '<code>./cache</code> is writable',
- 'solution' => 'Make <code>./cache</code> writable with CHMOD'
- ),
- );
-
// We start by malking sure we have PHP5 as a base requirement
if(phpversion() >= 5) {
- $strInstall = installStatus($tests['php5']['label'], 'OK',true);
+ $strInstall = installStatus('Server is running PHP5', 'OK',true);
$strRecommendation = '';
} else {
- $strInstall = installStatus($tests['php5']['label'], 'FAIL',false);
- $strRecommendation = '<li>' . $tests['php5']['solution'] . '</li>';
+ $strInstall = installStatus('Server is running PHP5', 'FAIL',false);
+ $strRecommendation = '<li>Check your server documentation to activate PHP5</li>';
}
+ // Writable file requirements
+ $tests = array(
+ '/custom',
+ '/custom/people.opml',
+ '/admin/inc/pwd.inc.php',
+ '/cache',
+ );
+
// We now test that all required files are writable
- foreach ($tests as $k => $v) {
- if ($tests[$k]['file']) {
- if(is_writable(dirname(__FILE__) . $tests[$k]['file'])) {
- $strInstall .= installStatus($tests[$k]['label'], 'OK', true);
- } else {
- $strInstall .= installStatus($tests[$k]['label'], 'FAIL',false);
- $strRecommendation .= '<li>' . $tests[$k]['solution'] . '</li>';
- }
+ foreach ($tests as $v) {
+ if(is_writable(dirname(__FILE__) . $v)) {
+ $strInstall .= installStatus("<code>$v</code> is writable", 'OK', true);
+ } else {
+ $strInstall .= installStatus("<code>$v</code> is writable", 'FAIL',false);
+ $strRecommendation .= "<li>Make <code>$v</code> writable with CHMOD</li>";
}
}
@@ -94,8 +73,9 @@ if (file_exists(dirname(__FILE__) . '/custom/config.yml')
?>
<!DOCTYPE html>
<html lang="en">
+<meta charset="utf-8">
<head>
- <title>moonmoon install</title>
+ <title><?=_g('moonmoon installation')?></title>
<style>
body {
font: normal 1em sans-serif;
@@ -129,7 +109,7 @@ if (file_exists(dirname(__FILE__) . '/custom/config.yml')
</head>
<body>
- <h1>moonmoon installation</h1>
+ <h1><?=_g('moonmoon installation')?></h1>
<?php if ($status == 'error') : ?>
<div id="compatibility">
@@ -179,6 +159,13 @@ if (file_exists(dirname(__FILE__) . '/custom/config.yml')
<label for="password">Administrator password:</label>
<input type="text" id="password" name="password" class="text password" value="admin" />
</p>
+ <p class="field">
+ <label for="locale">Language:</label>
+ <select name="locale" id="locale">
+ <option selected="selected" value="en">English</option>
+ <option value="fr">Français</option>
+ </select>
+ </p>
<p>
<input type="submit" class="submit" value="Install"/>
</p>
@@ -188,15 +175,14 @@ if (file_exists(dirname(__FILE__) . '/custom/config.yml')
<?php elseif ($status =='installed'): ?>
- <p>Congratulations! Your moonmoon is ready.</p>
- <h3>What's next?</h3>
+ <p><?=_g('Congratulations! Your moonmoon is ready.')?></p>
+ <h3><?=_g("What's next?")?></h3>
<ol>
<li>
- <strong>Delete</strong> <code>install.php</code> with your FTP software.
+ <?=_g('<strong>Delete</strong> <code>install.php</code> with your FTP software.')?>
</li>
<li>
- Use your password to go to the
- <a href="./admin/">administration panel</a>
+ <?=_g('Use your password to go to the <a href="./admin/">administration panel</a>')?>
</li>
</ol>
<?php endif; ?>