Files
oc-server3/htdocs/lib2/translateAccess.php
Markus Birth 6a487c218d Removed loading login.class.php from lib2/common.inc.php. So no $login variable is propagated anymore (for lib2).
Fixed all calls in index.php and included files. DID NOT YET FIX OTHER PAGES! THEY WILL BREAK!
N.B.: Instead of $login->..., you now have to do $GLOBALS['container']->get('ocde.login')->...
2014-01-18 23:50:39 +01:00

39 lines
1.0 KiB
PHP

<?php
/***************************************************************************
* For license information see doc/license.txt
*
* Unicode Reminder メモ
***************************************************************************/
require_once($GLOBALS['container']->get('ocde.config')->getBaseDir() . '/lib2/logic/const.inc.php');
class translateAccess
{
private $languages = false;
public function hasAccess()
{
return $GLOBALS['container']->get('ocde.login')->hasAdminPriv(ADMIN_TRANSLATE);
}
public function mayTranslate($language)
{
return $GLOBALS['container']->get('ocde.login')->hasAdminPriv(ADMIN_ROOT) || in_array($language, $this->getLanguages());
}
private function getLanguages()
{
if ($this->languages === false)
$this->loadLanguages();
return $this->languages;
}
private function loadLanguages()
{
$options = new useroptions($GLOBALS['container']->get('ocde.login')->getUserId());
$this->languages = explode(',', $options->getOptValue(USR_OPT_TRANSLANG));
}
}