Skip to content
Commits on Source (2)
......@@ -28,34 +28,6 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
require_once '../../lib/config.inc.php';
require_once '../../lib/app.inc.php';
include_once '../common.php';
// Check if we have an active users session and no login_as.
if ($_SESSION['s']['user']['active'] == 1 && @$_POST['login_as'] != 1) {
header('Location: /index.php');
die();
}
$app->uses('tpl');
$app->tpl->newTemplate('main_login.tpl.htm');
$app->tpl->setInclude('content_tpl', 'templates/index.htm');
$error = '';
$app->load_language_file('web/login/lib/lang/'.$conf["language"].'.lng');
// Maintenance mode
$maintenance_mode = false;
$maintenance_mode_error = '';
$server_config_array = $app->getconf->get_global_config('misc');
if ($app->is_under_maintenance()) {
$maintenance_mode = true;
$maintenance_mode_error = $app->lng('error_maintenance_mode');
}
/**
* @param app $app
* @param $error
......@@ -210,8 +182,7 @@ function is_admin_ip_whitelisted($ip, $conf)
// if the file doesn't exist, we assume that webmaster doesn't use this feature
if (!file_exists($conf['admin_ip_whitelist_file'])) return true;
$file_content = file_get_contents($conf['admin_ip_whitelist_file']);
$file_lines = explode("\n", $file_content);
$file_lines = file($conf['admin_ip_whitelist_file']);
$matches = array_filter($file_lines, function($v) use ($ip) {
$line = trim($v);
......@@ -408,6 +379,34 @@ function is_login_as(app $app, $username, $password)
return $loginAs;
}
require_once '../../lib/config.inc.php';
require_once '../../lib/app.inc.php';
include_once '../common.php';
// Check if we have an active users session and no login_as.
if ($_SESSION['s']['user']['active'] == 1 && @$_POST['login_as'] != 1) {
header('Location: /index.php');
die();
}
$app->uses('tpl');
$app->tpl->newTemplate('main_login.tpl.htm');
$app->tpl->setInclude('content_tpl', 'templates/index.htm');
$error = '';
$app->load_language_file('web/login/lib/lang/'.$conf["language"].'.lng');
// Maintenance mode
$maintenance_mode = false;
$maintenance_mode_error = '';
$server_config_array = $app->getconf->get_global_config('misc');
if ($app->is_under_maintenance()) {
$maintenance_mode = true;
$maintenance_mode_error = $app->lng('error_maintenance_mode');
}
//* Login Form was sent
if (count($_POST) > 0) {
process_login_request($app, $error, $conf, $module);
......