mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 06:30:59 +01:00
if template-set does not supply (login_deny)login.tpl, use the ones from api/templates/default
This commit is contained in:
parent
35790eabec
commit
4a128b913c
13
api/lang.php
13
api/lang.php
@ -2,9 +2,7 @@
|
||||
/**
|
||||
* API: loading translation from server
|
||||
*
|
||||
* Usage:
|
||||
* - /egroupware/api/lang.php?app=infolog&lang=de
|
||||
* - /egroupware/api/lang.php?app=infolog&lang=de&debug=1 gives pretty-printed JSON
|
||||
* Usage: /egroupware/api/lang.php?app=infolog&lang=de
|
||||
*
|
||||
* @link www.egroupware.org
|
||||
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
@ -45,7 +43,7 @@ $etag = '"'.$_GET['app'].'-'.$_GET['lang'].'-'. Api\Translation::etag($_GET['ap
|
||||
|
||||
// headers to allow caching, we specify etag on url to force reload, even with Expires header
|
||||
Api\Session::cache_control(864000); // cache for 10 days
|
||||
Header('Content-Type: '.(empty($_GET['debug'])?'text/javascript':'application/json').'; charset=utf-8');
|
||||
Header('Content-Type: text/javascript; charset=utf-8');
|
||||
Header('ETag: '.$etag);
|
||||
|
||||
// if servers send a If-None-Match header, response with 304 Not Modified, if etag matches
|
||||
@ -63,12 +61,7 @@ if (!count(Api\Translation::$lang_arr))
|
||||
}
|
||||
|
||||
// fix for phrases containing \n
|
||||
$content = str_replace('\\\\n', '\\n', json_encode(Api\Translation::$lang_arr,
|
||||
JSON_UNESCAPED_UNICODE | // send utf-8 unencoded, smaller and better readable
|
||||
JSON_UNESCAPED_SLASHES | // do not escape slashes, smaller and better readable
|
||||
(!empty($_GET['debug']) ? JSON_PRETTY_PRINT : 0)));
|
||||
|
||||
if (empty($_GET['debug'])) $content = 'egw.set_lang_arr("'.$_GET['app'].'", '.$content.', egw && egw.window !== window);';
|
||||
$content = 'egw.set_lang_arr("'.$_GET['app'].'", '.str_replace('\\\\n', '\\n', json_encode(Api\Translation::$lang_arr)).', egw && egw.window !== window);';
|
||||
|
||||
// we run our own gzip compression, to set a correct Content-Length of the encoded content
|
||||
if (in_array('gzip', explode(',',$_SERVER['HTTP_ACCEPT_ENCODING'])) && function_exists('gzencode'))
|
||||
|
@ -159,7 +159,7 @@ class Etemplate extends Etemplate\Widget\Template
|
||||
// not sure if we want to handle it this way, thought otherwise we will have a few ajax request for each dialog fetching predefined selectboxes
|
||||
$template = self::instance($this->name, $this->template_set, $this->version, $this->laod_via);
|
||||
if (!$template) throw new Exception\AssertionFailed("Template $this->name not instanciable! Maybe you forgot to rename template id.");
|
||||
// Translation::add_app('etemplate');
|
||||
Translation::add_app('etemplate');
|
||||
$template->run('beforeSendToClient', array('', array('cont'=>$content)));
|
||||
|
||||
// some apps (eg. InfoLog) set app_header only in get_rows depending on filter settings
|
||||
|
@ -49,9 +49,15 @@ class Login
|
||||
Api\Header\ContentSecurityPolicy::add('frame-src', array()); // array() no external frame-sources
|
||||
|
||||
//error_log(__METHOD__."() this->template=$this->framework->template, this->template_dir=$this->framework->template_dir, get_class(this)=".get_class($this));
|
||||
$tmpl = new Template(EGW_SERVER_ROOT.$this->framework->template_dir);
|
||||
|
||||
$tmpl->set_file(array('login_form' => Api\Header\UserAgent::mobile()?'login_mobile.tpl':'login.tpl'));
|
||||
try {
|
||||
$tmpl = new Template(EGW_SERVER_ROOT.$this->framework->template_dir);
|
||||
$tmpl->set_file(array('login_form' => Api\Header\UserAgent::mobile()?'login_mobile.tpl':'login.tpl'));
|
||||
}
|
||||
catch(Api\Exception\WrongParameter $e) {
|
||||
unset($e);
|
||||
$tmpl = new Template(EGW_SERVER_ROOT.'/api/templates/default');
|
||||
$tmpl->set_file(array('login_form' => Api\Header\UserAgent::mobile()?'login_mobile.tpl':'login.tpl'));
|
||||
}
|
||||
|
||||
$tmpl->set_var('lang_message',$GLOBALS['loginscreenmessage']);
|
||||
|
||||
@ -224,11 +230,15 @@ class Login
|
||||
*/
|
||||
function denylogin_screen()
|
||||
{
|
||||
$tmpl = new Template(EGW_SERVER_ROOT.$this->framework->template_dir);
|
||||
|
||||
$tmpl->set_file(array(
|
||||
'login_form' => 'login_denylogin.tpl'
|
||||
));
|
||||
try {
|
||||
$tmpl = new Template(EGW_SERVER_ROOT.$this->framework->template_dir);
|
||||
$tmpl->set_file(array('login_form' => 'login_denylogin.tpl'));
|
||||
}
|
||||
catch(Api\Exception\WrongParameter $e) {
|
||||
unset($e);
|
||||
$tmpl = new Template(EGW_SERVER_ROOT.'/api/templates/default');
|
||||
$tmpl->set_file(array('login_form' => 'login_denylogin.tpl'));
|
||||
}
|
||||
|
||||
$tmpl->set_var(array(
|
||||
'template_set' => 'default',
|
||||
|
Loading…
Reference in New Issue
Block a user