oc-server3/htdocs/articles.php
following e267c532c6 attribute name and translation fixes
- consistent spelling of German attribute names
- fixed translations of danger, overnight and children attributes
  (introduced with commit 3059715c)
- fixed English spelling of those three attributes
2012-08-26 01:44:15 +02:00

90 lines
2.4 KiB
PHP

<?php
/***************************************************************************
* For license information see doc/license.txt
*
* Unicode Reminder メモ
***************************************************************************/
require('./lib2/web.inc.php');
//get the article name to display
$article = '';
$language = $opt['template']['locale'];
if (isset($_REQUEST['page']) &&
(mb_strpos($_REQUEST['page'], '.') === false) &&
(mb_strpos($_REQUEST['page'], '/') === false) &&
(mb_strpos($_REQUEST['page'], '\\') === false))
{
$article = $_REQUEST['page'];
}
if ($article == '')
{
//no article specified
$tpl->redirect('index.php');
}
else if (!file_exists($opt['stylepath'] . '/articles/' . $language . '/' . $article . '.tpl'))
{
// does article exist in default-language?
if (file_exists($opt['stylepath'] . '/articles/' . $opt['template']['default']['article_locale'] . '/' . $article . '.tpl'))
{
$language = $opt['template']['default']['article_locale'];
}
elseif (file_exists($opt['stylepath'] . '/articles/EN/' . $article . '.tpl'))
{
$language = 'EN';
}
else
{
// use any
$language = false;
if ($hDir = opendir($opt['stylepath'] . '/articles/'))
{
while ((($sFile = readdir($hDir)) !== false) && ($language === false))
{
if (($sFile != '.') && ($sFile != '..') && (is_dir($opt['stylepath'] . '/articles/' . $sFile)))
{
if (file_exists($opt['stylepath'] . '/articles/' . $sFile . '/' . $article . '.tpl'))
{
$language = $sFile;
}
}
}
closedir($hDir);
}
//article doesn't exists
if ($language === false)
{
$tpl->redirect('index.php');
}
}
}
$tpl->name = 'articles';
$tpl->caching = true;
$tpl->cache_id = 'articles|' . $language . '|' . $article;
$tpl->cache_lifetime = 43200;
if (!$tpl->is_cached())
{
$tpl->menuitem = sql_value("SELECT `id` FROM `sys_menu` WHERE `href`='&1' LIMIT 1", 0, 'articles.php?page=' . urlencode($article));
if ($tpl->menuitem == 0)
$tpl->redirect('index.php');
$tpl->assign('article', $article);
$tpl->assign('language', $language);
/* prepare smarty vars for special pages ...
*/
if ($article == 'cacheinfo')
{
require_once($opt['rootpath'] . 'lib2/logic/attribute.class.php');
$attributes = attribute::getSelectableAttrbutesListArray(true);
$tpl->assign('attributes', $attributes);
}
}
$tpl->display();
?>