Fix #881 disable display.before triggers if site is locked and visitor is not admin

This commit is contained in:
Kijin Sung 2017-07-23 22:21:28 +09:00
parent 468b1cc00f
commit 44be0468ab

View file

@ -15,7 +15,6 @@ class DisplayHandler extends Handler
public static $debug_printed = 0; public static $debug_printed = 0;
var $content_size = 0; // /< The size of displaying contents var $content_size = 0; // /< The size of displaying contents
var $gz_enabled = FALSE; // / <a flog variable whether to call contents after compressing by gzip var $gz_enabled = FALSE; // / <a flog variable whether to call contents after compressing by gzip
var $handler = NULL;
/** /**
* print either html or xml content given oModule object * print either html or xml content given oModule object
@ -59,6 +58,9 @@ class DisplayHandler extends Handler
$output = $handler->toDoc($oModule); $output = $handler->toDoc($oModule);
// Skip the following if site lock is effective
if(!config('lock.locked') || Context::get('logged_info')->is_admin === 'Y')
{
// call a trigger before display // call a trigger before display
ModuleHandler::triggerCall('display', 'before', $output); ModuleHandler::triggerCall('display', 'before', $output);
$original_output = $output; $original_output = $output;
@ -72,6 +74,7 @@ class DisplayHandler extends Handler
{ {
$output = $original_output; $output = $original_output;
} }
}
if(method_exists($handler, "prepareToPrint")) if(method_exists($handler, "prepareToPrint"))
{ {
@ -140,7 +143,6 @@ class DisplayHandler extends Handler
public function getDebugInfo(&$output = null) public function getDebugInfo(&$output = null)
{ {
// Check if debugging information has already been printed. // Check if debugging information has already been printed.
if (self::$debug_printed) if (self::$debug_printed)
{ {
return; return;