[eGroupWare-svn] r56064 - in /trunk/egroupware/api: lang.php src/Etemplate.php src/Framework/Login.php

[email protected] Fri, 06 May 2016 10:49:11 -0000
Newsgroups gmane.comp.web.egroupware.cvs
Message-ID <[email protected]>
Author: ralfbecker
Date: Fri May  6 12:49:11 2016
New Revision: 56064

URL: http://svn.stylite.de/viewvc/egroupware?rev=56064&view=rev
Log:
if template-set does not supply (login_deny)login.tpl, use the ones from api/templates/default

Modified:
    trunk/egroupware/api/lang.php
    trunk/egroupware/api/src/Etemplate.php
    trunk/egroupware/api/src/Framework/Login.php

Modified: trunk/egroupware/api/lang.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/egroupware/api/lang.php?rev=56064&r1=56063&r2=56064&view=diff
==============================================================================
--- trunk/egroupware/api/lang.php (original)
+++ trunk/egroupware/api/lang.php Fri May  6 12:49:11 2016
@@ -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 @@
 
 // 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 @@
 }
 
 // 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'))

Modified: trunk/egroupware/api/src/Etemplate.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/egroupware/api/src/Etemplate.php?rev=56064&r1=56063&r2=56064&view=diff
==============================================================================
--- trunk/egroupware/api/src/Etemplate.php (original)
+++ trunk/egroupware/api/src/Etemplate.php Fri May  6 12:49:11 2016
@@ -159,7 +159,7 @@
 		// 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

Modified: trunk/egroupware/api/src/Framework/Login.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/egroupware/api/src/Framework/Login.php?rev=56064&r1=56063&r2=56064&view=diff
==============================================================================
--- trunk/egroupware/api/src/Framework/Login.php (original)
+++ trunk/egroupware/api/src/Framework/Login.php Fri May  6 12:49:11 2016
@@ -49,9 +49,15 @@
 		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 @@
 	*/
 	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',


------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z