Don't register the call when rendering error pages
This commit is contained in:
parent
dd7b8e4555
commit
3de69ff81b
|
@ -29,7 +29,7 @@ require_once __DIR__.'/template/functions.php';
|
||||||
class OC_Template extends \OC\Template\Base {
|
class OC_Template extends \OC\Template\Base {
|
||||||
private $renderas; // Create a full page?
|
private $renderas; // Create a full page?
|
||||||
private $path; // The path to the template
|
private $path; // The path to the template
|
||||||
private $headers=array(); //custom headers
|
private $headers = array(); //custom headers
|
||||||
protected $app; // app id
|
protected $app; // app id
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -37,6 +37,7 @@ class OC_Template extends \OC\Template\Base {
|
||||||
* @param string $app app providing the template
|
* @param string $app app providing the template
|
||||||
* @param string $name of the template file (without suffix)
|
* @param string $name of the template file (without suffix)
|
||||||
* @param string $renderas = ""; produce a full page
|
* @param string $renderas = ""; produce a full page
|
||||||
|
* @param bool $registerCall = true
|
||||||
* @return OC_Template object
|
* @return OC_Template object
|
||||||
*
|
*
|
||||||
* This function creates an OC_Template object.
|
* This function creates an OC_Template object.
|
||||||
|
@ -45,14 +46,14 @@ class OC_Template extends \OC\Template\Base {
|
||||||
* according layout. For now, renderas can be set to "guest", "user" or
|
* according layout. For now, renderas can be set to "guest", "user" or
|
||||||
* "admin".
|
* "admin".
|
||||||
*/
|
*/
|
||||||
public function __construct( $app, $name, $renderas = "" ) {
|
public function __construct( $app, $name, $renderas = "", $registerCall = true ) {
|
||||||
// Read the selected theme from the config file
|
// Read the selected theme from the config file
|
||||||
$theme = OC_Util::getTheme();
|
$theme = OC_Util::getTheme();
|
||||||
|
|
||||||
// Read the detected formfactor and use the right file name.
|
// Read the detected formfactor and use the right file name.
|
||||||
$fext = self::getFormFactorExtension();
|
$fext = self::getFormFactorExtension();
|
||||||
|
|
||||||
$requesttoken = OC::$server->getSession() ? OC_Util::callRegister() : '';
|
$requesttoken = (OC::$server->getSession() and $registerCall) ? OC_Util::callRegister() : '';
|
||||||
|
|
||||||
$parts = explode('/', $app); // fix translation when app is something like core/lostpassword
|
$parts = explode('/', $app); // fix translation when app is something like core/lostpassword
|
||||||
$l10n = OC_L10N::get($parts[0]);
|
$l10n = OC_L10N::get($parts[0]);
|
||||||
|
@ -253,7 +254,7 @@ class OC_Template extends \OC\Template\Base {
|
||||||
* Warning: All data passed to $hint needs to get sanitized using OC_Util::sanitizeHTML
|
* Warning: All data passed to $hint needs to get sanitized using OC_Util::sanitizeHTML
|
||||||
*/
|
*/
|
||||||
public static function printErrorPage( $error_msg, $hint = '' ) {
|
public static function printErrorPage( $error_msg, $hint = '' ) {
|
||||||
$content = new OC_Template( '', 'error', 'error' );
|
$content = new \OC_Template( '', 'error', 'error', false );
|
||||||
$errors = array(array('error' => $error_msg, 'hint' => $hint));
|
$errors = array(array('error' => $error_msg, 'hint' => $hint));
|
||||||
$content->assign( 'errors', $errors );
|
$content->assign( 'errors', $errors );
|
||||||
$content->printPage();
|
$content->printPage();
|
||||||
|
|
|
@ -59,7 +59,9 @@ class OC_TemplateLayout extends OC_Template {
|
||||||
$this->assign( 'user_uid', OC_User::getUser() );
|
$this->assign( 'user_uid', OC_User::getUser() );
|
||||||
$this->assign( 'appsmanagement_active', strpos(OC_Request::requestUri(), OC_Helper::linkToRoute('settings_apps')) === 0 );
|
$this->assign( 'appsmanagement_active', strpos(OC_Request::requestUri(), OC_Helper::linkToRoute('settings_apps')) === 0 );
|
||||||
$this->assign('enableAvatars', \OC_Config::getValue('enable_avatars', true));
|
$this->assign('enableAvatars', \OC_Config::getValue('enable_avatars', true));
|
||||||
} else if ($renderas == 'guest' || $renderas == 'error') {
|
} else if ($renderas == 'error') {
|
||||||
|
parent::__construct('core', 'layout.guest', '', false);
|
||||||
|
} else if ($renderas == 'guest') {
|
||||||
parent::__construct('core', 'layout.guest');
|
parent::__construct('core', 'layout.guest');
|
||||||
} else {
|
} else {
|
||||||
parent::__construct('core', 'layout.base');
|
parent::__construct('core', 'layout.base');
|
||||||
|
|
Loading…
Reference in New Issue