diff --git a/application/controllers/Login.php b/application/controllers/Login.php index 6617167eb..cf49d97b6 100644 --- a/application/controllers/Login.php +++ b/application/controllers/Login.php @@ -54,9 +54,9 @@ class Login extends CI_Controller { $password = $this->input->post('password'); - if($this->_security_check()) + if(!$this->_installation_check()) { - $this->form_validation->set_message('login_check', $this->lang->line('login_invalid_security')); + $this->form_validation->set_message('login_check', $this->lang->line('login_invalid_installation')); return FALSE; } @@ -94,9 +94,31 @@ class Login extends CI_Controller return TRUE; } - private function _security_check() + private function _installation_check() { - return preg_match('~\b(Copyright|(c)|©|All rights reserved|Developed|Crafted|Implemented|Made|Powered|Code|Design|unblockUI|blockUI|blockOverlay|hide|opacity)\b~i', file_get_contents(APPPATH . 'views/partial/footer.php')); + // get PHP extensions and check that the required ones are installed + $extensions = implode(', ', get_loaded_extensions()); + $keys = array('bcmath', 'intl', 'gd', 'sockets', 'mcrypt'); + $pattern = '/'; + foreach($keys as $key) + { + $pattern .= '(?=.*\b' . preg_quote($key, '/') . '\b)'; + } + $pattern .= '/i'; + $result = preg_match($pattern, $extensions); + + if(!$result) + { + error_log('Check your php.ini'); + error_log('PHP installed extensions: ' . $extensions); + error_log('PHP required extensions: ' . implode(', ', $keys)); + } + else + { + $result = preg_match('~\b(Copyright|(c)|©|All rights reserved|Developed|Crafted|Implemented|Made|Powered|Code|Design|unblockUI|blockUI|blockOverlay|hide|opacity)\b~i', file_get_contents(APPPATH . 'views/partial/footer.php')) != TRUE; + } + + return $result; } } ?> diff --git a/application/language/en/login_lang.php b/application/language/en/login_lang.php index e20309954..cc64779a0 100644 --- a/application/language/en/login_lang.php +++ b/application/language/en/login_lang.php @@ -3,8 +3,8 @@ $lang["login_gcaptcha"] = "I'm not a robot"; $lang["login_go"] = "Go"; $lang["login_invalid_gcaptcha"] = "Invalid I'm not a robot"; +$lang["login_invalid_installation"] = "The installation is not correct, check your php.ini"; $lang["login_invalid_username_and_password"] = "Invalid username or password"; -$lang["login_invalid_security"] = "Security check failure"; $lang["login_login"] = "Login"; $lang["login_password"] = "Password"; $lang["login_username"] = "Username";