Skip to content

Commit 9e1b22f

Browse files
committed
Non-critical code fixes
1 parent aecd590 commit 9e1b22f

File tree

3 files changed

+11
-22
lines changed

3 files changed

+11
-22
lines changed

webui/application/controllers/Api.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
Description: API for GRCentral.
88
API version: v1
99
10-
2020-2021 (c) Copyright GRCentral
10+
2020-2024 (c) Copyright GRCentral
1111
Get this on Github: http://github.com/lumian/grcentral
1212
****************************************************************/
1313

@@ -111,7 +111,7 @@ public function v1($query_category=NULL,$param1=NULL,$param2=NULL)
111111
// RU: Получение информации о моделях устройств
112112
if (!is_null($param1) AND $param1 != FALSE AND !is_null($param2) AND $param2 != FALSE)
113113
{
114-
$query_result = $this->v1_device_models_get($param1, $param2);
114+
$query_result = $this->_v1_device_models_get($param1, $param2);
115115
}
116116
}
117117
}
@@ -288,7 +288,7 @@ private function _v1_device_get($type=NULL, $subtype=NULL)
288288
return $result;
289289
}
290290

291-
private function v1_device_models_get($type=NULL, $subtype=NULL)
291+
private function _v1_device_models_get($type=NULL, $subtype=NULL)
292292
{
293293
$this->load->model('settings_model');
294294

webui/application/controllers/Auth.php

+4-16
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
File: application\controllers\Auth.php
77
Description: Controller for user authorization
88
9-
2020-2021 (c) Copyright GRCentral
9+
2020-2024 (c) Copyright GRCentral
1010
Get this on Github: http://github.com/lumian/grcentral
1111
****************************************************************/
1212

@@ -30,7 +30,7 @@ public function login()
3030

3131
if ($is_user == TRUE)
3232
{
33-
$this->_back_redirect();
33+
redirect(index_page());
3434
}
3535

3636
if (!is_null($this->input->post('login')) AND !is_null($this->input->post('password')))
@@ -47,7 +47,7 @@ public function login()
4747
$this->session->set_flashdata('error_result', lang('main_message_autherror'));
4848
}
4949

50-
$this->_back_redirect();
50+
redirect(index_page());
5151
}
5252
else
5353
{
@@ -59,19 +59,7 @@ public function logout()
5959
{
6060
$this->session->unset_userdata('logged_in');
6161
$this->session->set_flashdata('success_result', lang('main_message_authlogout'));
62-
$this->_back_redirect();
63-
}
64-
65-
private function _back_redirect()
66-
{
67-
if (isset($_SERVER["HTTP_REFERER"]) AND mb_stripos($_SERVER["HTTP_REFERER"],base_url()) == '0')
68-
{
69-
redirect($_SERVER["HTTP_REFERER"]);
70-
}
71-
else
72-
{
73-
redirect(index_page());
74-
}
62+
redirect(index_page());
7563
}
7664

7765
private function _check_credentials($login=NULL, $password=NULL)

webui/application/libraries/Grcentral.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
File: application\libraries\Grcentral.php
77
Description: Small but necessary functions that are used in different system controllers.
88
9-
2020-2021 (c) Copyright GRCentral
9+
2020-2024 (c) Copyright GRCentral
1010
Get this on Github: http://github.com/lumian/grcentral
1111
****************************************************************/
1212

@@ -161,7 +161,7 @@ public function return_bytes($size_str)
161161

162162
public function installed_check($action = 'redirect')
163163
{
164-
if ($this->CI->config->item('system_installed') != TRUE)
164+
if ($this->CI->config->item('system_installed') !== TRUE)
165165
{
166166
$this->correct_baseurl();
167167

@@ -188,9 +188,10 @@ public function installed_check($action = 'redirect')
188188

189189
public function correct_baseurl()
190190
{
191+
$hostname = $this->CI->input->server('HTTP_HOST');
191192
$scheme = $this->get_system_protocol();
192193
$system_path = $this->get_system_path();
193-
$base_url = $scheme.'://'.$_SERVER['HTTP_HOST'].$system_path;
194+
$base_url = $scheme.'://'.$hostname.$system_path;
194195
$this->CI->config->set_item('base_url', $base_url);
195196
}
196197

0 commit comments

Comments
 (0)