Minor - Set $responseCode in Template creation

pull/2458/head
Julio 8 years ago
parent 6b50f0ffaf
commit 2b4aec1ca9
  1. 3
      main/inc/lib/api.lib.php
  2. 8
      main/inc/lib/template.lib.php

@ -3408,8 +3408,7 @@ function api_not_allowed(
$show_headers = 1;
}
$tpl = new Template(null, $show_headers, $show_headers, false, true, false);
$tpl->setResponseCode($responseCode);
$tpl = new Template(null, $show_headers, $show_headers, false, true, false, true, $responseCode);
$tpl->assign('hide_login_link', 1);
$tpl->assign('content', $msg);

@ -46,7 +46,7 @@ class Template
public $load_plugins = false;
public $params = [];
public $force_plugin_load = false;
public $responseCode = '';
public $responseCode = 0;
/**
* @param string $title
@ -55,6 +55,7 @@ class Template
* @param bool $show_learnpath
* @param bool $hide_global_chat
* @param bool $load_plugins
* @param int $responseCode
* @param bool $sendHeaders send http headers or not
*/
public function __construct(
@ -64,12 +65,13 @@ class Template
$show_learnpath = false,
$hide_global_chat = false,
$load_plugins = true,
$sendHeaders = true
$sendHeaders = true,
$responseCode = 0
) {
// Page title
$this->title = $title;
$this->show_learnpath = $show_learnpath;
$this->setResponseCode($responseCode);
if (empty($this->show_learnpath)) {
$origin = api_get_origin();

Loading…
Cancel
Save