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')->...
39 lines
1.0 KiB
PHP
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));
|
|
}
|
|
}
|