@@ -11,7 +11,7 @@ |
||
| 11 | 11 | * @param string $file Configuration file name |
| 12 | 12 | * @param bool $use_sections Whether configuration values should be loaded into their own section |
| 13 | 13 | * @param bool $fail_gracefully Whether to just return FALSE or display an error message |
| 14 | - * @return bool TRUE if the file was loaded correctly or FALSE on failure |
|
| 14 | + * @return boolean|null TRUE if the file was loaded correctly or FALSE on failure |
|
| 15 | 15 | */ |
| 16 | 16 | public function load($file = '', $use_sections = FALSE, $fail_gracefully = FALSE) |
| 17 | 17 | { |
@@ -18,26 +18,26 @@ discard block |
||
| 18 | 18 | $file = ($file === '') ? 'config' : str_replace('.php', '', $file); |
| 19 | 19 | $loaded = FALSE; |
| 20 | 20 | |
| 21 | - foreach ($this->_config_paths as $path) |
|
| 21 | + foreach($this->_config_paths as $path) |
|
| 22 | 22 | { |
| 23 | - foreach (array($file, '_secure'.DIRECTORY_SEPARATOR.$file, ENVIRONMENT.DIRECTORY_SEPARATOR.$file) as $location) |
|
| 23 | + foreach(array($file, '_secure'.DIRECTORY_SEPARATOR.$file, ENVIRONMENT.DIRECTORY_SEPARATOR.$file) as $location) |
|
| 24 | 24 | { |
| 25 | 25 | $file_path = $path.'config/'.$location.'.php'; |
| 26 | - if (in_array($file_path, $this->is_loaded, TRUE)) |
|
| 26 | + if(in_array($file_path, $this->is_loaded, TRUE)) |
|
| 27 | 27 | { |
| 28 | 28 | return TRUE; |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - if ( ! file_exists($file_path)) |
|
| 31 | + if(!file_exists($file_path)) |
|
| 32 | 32 | { |
| 33 | 33 | continue; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | include($file_path); |
| 37 | 37 | |
| 38 | - if ( ! isset($config) OR ! is_array($config)) |
|
| 38 | + if(!isset($config) OR !is_array($config)) |
|
| 39 | 39 | { |
| 40 | - if ($fail_gracefully === TRUE) |
|
| 40 | + if($fail_gracefully === TRUE) |
|
| 41 | 41 | { |
| 42 | 42 | return FALSE; |
| 43 | 43 | } |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | show_error('Your '.$file_path.' file does not appear to contain a valid configuration array.'); |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - if ($use_sections === TRUE) |
|
| 48 | + if($use_sections === TRUE) |
|
| 49 | 49 | { |
| 50 | 50 | $this->config[$file] = isset($this->config[$file]) |
| 51 | 51 | ? array_merge($this->config[$file], $config) |
@@ -63,11 +63,11 @@ discard block |
||
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - if ($loaded === TRUE) |
|
| 66 | + if($loaded === TRUE) |
|
| 67 | 67 | { |
| 68 | 68 | return TRUE; |
| 69 | 69 | } |
| 70 | - elseif ($fail_gracefully === TRUE) |
|
| 70 | + elseif($fail_gracefully === TRUE) |
|
| 71 | 71 | { |
| 72 | 72 | return FALSE; |
| 73 | 73 | } |
@@ -13,46 +13,36 @@ discard block |
||
| 13 | 13 | * @param bool $fail_gracefully Whether to just return FALSE or display an error message |
| 14 | 14 | * @return bool TRUE if the file was loaded correctly or FALSE on failure |
| 15 | 15 | */ |
| 16 | - public function load($file = '', $use_sections = FALSE, $fail_gracefully = FALSE) |
|
| 17 | - { |
|
| 16 | + public function load($file = '', $use_sections = FALSE, $fail_gracefully = FALSE) { |
|
| 18 | 17 | $file = ($file === '') ? 'config' : str_replace('.php', '', $file); |
| 19 | 18 | $loaded = FALSE; |
| 20 | 19 | |
| 21 | - foreach ($this->_config_paths as $path) |
|
| 22 | - { |
|
| 23 | - foreach (array($file, '_secure'.DIRECTORY_SEPARATOR.$file, ENVIRONMENT.DIRECTORY_SEPARATOR.$file) as $location) |
|
| 24 | - { |
|
| 20 | + foreach ($this->_config_paths as $path) { |
|
| 21 | + foreach (array($file, '_secure'.DIRECTORY_SEPARATOR.$file, ENVIRONMENT.DIRECTORY_SEPARATOR.$file) as $location) { |
|
| 25 | 22 | $file_path = $path.'config/'.$location.'.php'; |
| 26 | - if (in_array($file_path, $this->is_loaded, TRUE)) |
|
| 27 | - { |
|
| 23 | + if (in_array($file_path, $this->is_loaded, TRUE)) { |
|
| 28 | 24 | return TRUE; |
| 29 | 25 | } |
| 30 | 26 | |
| 31 | - if ( ! file_exists($file_path)) |
|
| 32 | - { |
|
| 27 | + if ( ! file_exists($file_path)) { |
|
| 33 | 28 | continue; |
| 34 | 29 | } |
| 35 | 30 | |
| 36 | 31 | include($file_path); |
| 37 | 32 | |
| 38 | - if ( ! isset($config) OR ! is_array($config)) |
|
| 39 | - { |
|
| 40 | - if ($fail_gracefully === TRUE) |
|
| 41 | - { |
|
| 33 | + if ( ! isset($config) OR ! is_array($config)) { |
|
| 34 | + if ($fail_gracefully === TRUE) { |
|
| 42 | 35 | return FALSE; |
| 43 | 36 | } |
| 44 | 37 | |
| 45 | 38 | show_error('Your '.$file_path.' file does not appear to contain a valid configuration array.'); |
| 46 | 39 | } |
| 47 | 40 | |
| 48 | - if ($use_sections === TRUE) |
|
| 49 | - { |
|
| 41 | + if ($use_sections === TRUE) { |
|
| 50 | 42 | $this->config[$file] = isset($this->config[$file]) |
| 51 | 43 | ? array_merge($this->config[$file], $config) |
| 52 | 44 | : $config; |
| 53 | - } |
|
| 54 | - else |
|
| 55 | - { |
|
| 45 | + } else { |
|
| 56 | 46 | $this->config = array_merge($this->config, $config); |
| 57 | 47 | } |
| 58 | 48 | |
@@ -63,12 +53,9 @@ discard block |
||
| 63 | 53 | } |
| 64 | 54 | } |
| 65 | 55 | |
| 66 | - if ($loaded === TRUE) |
|
| 67 | - { |
|
| 56 | + if ($loaded === TRUE) { |
|
| 68 | 57 | return TRUE; |
| 69 | - } |
|
| 70 | - elseif ($fail_gracefully === TRUE) |
|
| 71 | - { |
|
| 58 | + } elseif ($fail_gracefully === TRUE) { |
|
| 72 | 59 | return FALSE; |
| 73 | 60 | } |
| 74 | 61 | |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php defined('BASEPATH') OR exit('No direct script access allowed'); |
|
| 1 | +<?php defined('BASEPATH') or exit('No direct script access allowed'); |
|
| 2 | 2 | |
| 3 | 3 | class MY_Config extends CI_Config { |
| 4 | 4 | public function __construct() { |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | include($file_path); |
| 37 | 37 | |
| 38 | - if ( ! isset($config) OR ! is_array($config)) |
|
| 38 | + if ( ! isset($config) or ! is_array($config)) |
|
| 39 | 39 | { |
| 40 | 40 | if ($fail_gracefully === TRUE) |
| 41 | 41 | { |
@@ -71,7 +71,7 @@ |
||
| 71 | 71 | |
| 72 | 72 | /** |
| 73 | 73 | * @param string $verificationCode |
| 74 | - * @return mixed |
|
| 74 | + * @return string |
|
| 75 | 75 | */ |
| 76 | 76 | public function verificationCheck(string $verificationCode) { |
| 77 | 77 | //user is trying to validate their email for signup, check if verification code is still valid/exists |
@@ -76,9 +76,9 @@ discard block |
||
| 76 | 76 | public function verificationCheck(string $verificationCode) { |
| 77 | 77 | //user is trying to validate their email for signup, check if verification code is still valid/exists |
| 78 | 78 | $query = $this->db->select('email, verification_code_time') |
| 79 | - ->from('auth_signup_verification') |
|
| 80 | - ->where(array('verification_code' => $verificationCode)) |
|
| 81 | - ->get(); |
|
| 79 | + ->from('auth_signup_verification') |
|
| 80 | + ->where(array('verification_code' => $verificationCode)) |
|
| 81 | + ->get(); |
|
| 82 | 82 | |
| 83 | 83 | $return = FALSE; |
| 84 | 84 | if($query->num_rows() > 0) { |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | $this->session->set_flashdata('errors', 'Verification code expired. Please re-submit signup.'); |
| 91 | 91 | $this->db->delete('auth_signup_verification') |
| 92 | - ->where(array('verification_code' => $verificationCode)); |
|
| 92 | + ->where(array('verification_code' => $verificationCode)); |
|
| 93 | 93 | } else { |
| 94 | 94 | //not expired, verification is valid, return email |
| 95 | 95 | $return = $result->email; |
@@ -125,9 +125,9 @@ discard block |
||
| 125 | 125 | $this->load->database(); |
| 126 | 126 | |
| 127 | 127 | $query = $this->db->select('email') |
| 128 | - ->from('auth_users') |
|
| 129 | - ->where('username', $identity) |
|
| 130 | - ->get(); |
|
| 128 | + ->from('auth_users') |
|
| 129 | + ->where('username', $identity) |
|
| 130 | + ->get(); |
|
| 131 | 131 | |
| 132 | 132 | if($query->num_rows() > 0) { |
| 133 | 133 | //username exists, grab email |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | $success = TRUE; |
| 62 | - } catch (Exception $e) { |
|
| 62 | + } catch(Exception $e) { |
|
| 63 | 63 | //echo 'Caught exception: ', $e->getMessage(), "\n"; |
| 64 | 64 | |
| 65 | 65 | //revert verification |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | ->where(array('verification_code' => $verificationCode)); |
| 93 | 93 | } else { |
| 94 | 94 | //not expired, verification is valid, return email |
| 95 | - $return = $result->email; |
|
| 95 | + $return = $result->email; |
|
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | return $return; |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | if($query->num_rows() > 0) { |
| 133 | 133 | //username exists, grab email |
| 134 | 134 | $email = $query->row('email'); |
| 135 | - }else{ |
|
| 135 | + } else { |
|
| 136 | 136 | //username doesn't exist, return FALSE |
| 137 | 137 | $email = NULL; |
| 138 | 138 | } |
@@ -132,7 +132,7 @@ |
||
| 132 | 132 | if($query->num_rows() > 0) { |
| 133 | 133 | //username exists, grab email |
| 134 | 134 | $email = $query->row('email'); |
| 135 | - }else{ |
|
| 135 | + } else { |
|
| 136 | 136 | //username doesn't exist, return FALSE |
| 137 | 137 | $email = NULL; |
| 138 | 138 | } |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | * @return bool |
| 7 | 7 | */ |
| 8 | 8 | function view_exists(string $path) : bool { |
| 9 | - return file_exists(APPPATH . "/views/{$path}.php"); |
|
| 9 | + return file_exists(APPPATH."/views/{$path}.php"); |
|
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | function get_time_class(string $time_string) : string { |
@@ -32,19 +32,19 @@ discard block |
||
| 32 | 32 | return $time_string; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | -if (!function_exists('http_parse_headers')) { #http://www.php.net/manual/en/function.http-parse-headers.php#112917 |
|
| 36 | - function http_parse_headers (string $raw_headers) : array { |
|
| 35 | +if(!function_exists('http_parse_headers')) { #http://www.php.net/manual/en/function.http-parse-headers.php#112917 |
|
| 36 | + function http_parse_headers(string $raw_headers) : array { |
|
| 37 | 37 | $headers = array(); // $headers = []; |
| 38 | - foreach (explode("\n", $raw_headers) as $i => $h) { |
|
| 38 | + foreach(explode("\n", $raw_headers) as $i => $h) { |
|
| 39 | 39 | $h = explode(':', $h, 2); |
| 40 | - if (isset($h[1])){ |
|
| 41 | - if(!isset($headers[$h[0]])){ |
|
| 40 | + if(isset($h[1])) { |
|
| 41 | + if(!isset($headers[$h[0]])) { |
|
| 42 | 42 | $headers[$h[0]] = trim($h[1]); |
| 43 | - }else if(is_array($headers[$h[0]])){ |
|
| 44 | - $tmp = array_merge($headers[$h[0]],array(trim($h[1]))); |
|
| 43 | + } else if(is_array($headers[$h[0]])) { |
|
| 44 | + $tmp = array_merge($headers[$h[0]], array(trim($h[1]))); |
|
| 45 | 45 | $headers[$h[0]] = $tmp; |
| 46 | - }else{ |
|
| 47 | - $tmp = array_merge(array($headers[$h[0]]),array(trim($h[1]))); |
|
| 46 | + } else { |
|
| 47 | + $tmp = array_merge(array($headers[$h[0]]), array(trim($h[1]))); |
|
| 48 | 48 | $headers[$h[0]] = $tmp; |
| 49 | 49 | } |
| 50 | 50 | } |
@@ -66,19 +66,19 @@ discard block |
||
| 66 | 66 | } elseif($notices = $CI->session->flashdata('errors')) { |
| 67 | 67 | $CI->session->unset_userdata('errors'); //Sometimes we call this flashdata without redirecting, so make sure we remove it |
| 68 | 68 | if(is_string($notices)) { |
| 69 | - $notice_str = $CI->config->item('error_start_delimiter', 'ion_auth') . $notices . $CI->config->item('error_end_delimiter', 'ion_auth'); |
|
| 69 | + $notice_str = $CI->config->item('error_start_delimiter', 'ion_auth').$notices.$CI->config->item('error_end_delimiter', 'ion_auth'); |
|
| 70 | 70 | } elseif(is_array($notices)) { |
| 71 | 71 | foreach($notices as $notice) { |
| 72 | - $notice_str .= $CI->config->item('error_start_delimiter', 'ion_auth') . $notice . $CI->config->item('error_end_delimiter', 'ion_auth'); |
|
| 72 | + $notice_str .= $CI->config->item('error_start_delimiter', 'ion_auth').$notice.$CI->config->item('error_end_delimiter', 'ion_auth'); |
|
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | } elseif($notices = $CI->session->flashdata('notices')) { |
| 76 | 76 | $CI->session->unset_userdata('notices'); //Sometimes we call this flashdata without redirecting, so make sure we remove it |
| 77 | 77 | if(is_string($notices)) { |
| 78 | - $notice_str = $CI->config->item('message_start_delimiter', 'ion_auth') . $notices . $CI->config->item('message_end_delimiter', 'ion_auth'); |
|
| 78 | + $notice_str = $CI->config->item('message_start_delimiter', 'ion_auth').$notices.$CI->config->item('message_end_delimiter', 'ion_auth'); |
|
| 79 | 79 | } elseif(is_array($notices)) { |
| 80 | 80 | foreach($notices as $notice) { |
| 81 | - $notice_str .= $CI->config->item('message_start_delimiter', 'ion_auth') . $notice . $CI->config->item('message_end_delimiter', 'ion_auth'); |
|
| 81 | + $notice_str .= $CI->config->item('message_start_delimiter', 'ion_auth').$notice.$CI->config->item('message_end_delimiter', 'ion_auth'); |
|
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | 'is_unique_email' => 'Email already exists.' |
| 42 | 42 | )); |
| 43 | 43 | |
| 44 | - if ($isValid = ($this->form_validation->run() === TRUE)) { |
|
| 44 | + if($isValid = ($this->form_validation->run() === TRUE)) { |
|
| 45 | 45 | $email = $this->Auth->parseEmail($this->input->post('email')); |
| 46 | 46 | |
| 47 | 47 | $this->body_data['email'] = $email; |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | //login wasn't valid, failed, or this is a fresh login attempt |
| 57 | - if(!$isValid){ |
|
| 57 | + if(!$isValid) { |
|
| 58 | 58 | //display the email validation form |
| 59 | 59 | $this->body_data['form_email'] = array( |
| 60 | 60 | 'name' => 'email', |
@@ -89,14 +89,14 @@ discard block |
||
| 89 | 89 | if(!($email = $this->Auth->verificationCheck($verificationCode))) redirect('user/signup'); |
| 90 | 90 | |
| 91 | 91 | //validation is valid, proceed as normal |
| 92 | - $this->form_validation->set_rules('username', 'Username', 'required|min_length[4]|max_length[15]|valid_username|is_unique_username'); |
|
| 93 | - $this->form_validation->set_rules('password', 'Password', 'required|valid_password'); |
|
| 94 | - $this->form_validation->set_rules('password_confirm', 'Confirm Password', 'required|matches[password]'); |
|
| 95 | - $this->form_validation->set_rules('terms', 'Terms & Conditions', 'required'); |
|
| 92 | + $this->form_validation->set_rules('username', 'Username', 'required|min_length[4]|max_length[15]|valid_username|is_unique_username'); |
|
| 93 | + $this->form_validation->set_rules('password', 'Password', 'required|valid_password'); |
|
| 94 | + $this->form_validation->set_rules('password_confirm', 'Confirm Password', 'required|matches[password]'); |
|
| 95 | + $this->form_validation->set_rules('terms', 'Terms & Conditions', 'required'); |
|
| 96 | 96 | //TODO: timezone |
| 97 | 97 | //TODO: receive email |
| 98 | 98 | |
| 99 | - if ($isValid = ($this->form_validation->run() === TRUE)) { |
|
| 99 | + if($isValid = ($this->form_validation->run() === TRUE)) { |
|
| 100 | 100 | $username = $this->input->post('username'); |
| 101 | 101 | $password = $this->input->post('password'); |
| 102 | 102 | |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | //signup wasn't valid, failed, or this is a fresh signup attempt |
| 120 | - if(!$isValid){ |
|
| 120 | + if(!$isValid) { |
|
| 121 | 121 | //display the create user form |
| 122 | 122 | $this->body_data['verificationCode'] = $verificationCode; |
| 123 | 123 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | //login wasn't valid, failed, or this is a fresh login attempt |
| 57 | - if(!$isValid){ |
|
| 57 | + if(!$isValid) { |
|
| 58 | 58 | //display the email validation form |
| 59 | 59 | $this->body_data['form_email'] = array( |
| 60 | 60 | 'name' => 'email', |
@@ -86,7 +86,9 @@ discard block |
||
| 86 | 86 | //This continued signup occurs after the user clicks the verification link in their email. |
| 87 | 87 | private function _continue_signup($verificationCode) : void { |
| 88 | 88 | //check if validation is valid, if so return email, if not redirect to signup |
| 89 | - if(!($email = $this->Auth->verificationCheck($verificationCode))) redirect('user/signup'); |
|
| 89 | + if(!($email = $this->Auth->verificationCheck($verificationCode))) { |
|
| 90 | + redirect('user/signup'); |
|
| 91 | + } |
|
| 90 | 92 | |
| 91 | 93 | //validation is valid, proceed as normal |
| 92 | 94 | $this->form_validation->set_rules('username', 'Username', 'required|min_length[4]|max_length[15]|valid_username|is_unique_username'); |
@@ -110,14 +112,15 @@ discard block |
||
| 110 | 112 | $this->Auth->verificationComplete($email); |
| 111 | 113 | |
| 112 | 114 | redirect('help'); |
| 113 | - } else { //@codeCoverageIgnore |
|
| 115 | + } else { |
|
| 116 | +//@codeCoverageIgnore |
|
| 114 | 117 | //Signup failed. |
| 115 | 118 | $isValid = FALSE; |
| 116 | 119 | } |
| 117 | 120 | } |
| 118 | 121 | |
| 119 | 122 | //signup wasn't valid, failed, or this is a fresh signup attempt |
| 120 | - if(!$isValid){ |
|
| 123 | + if(!$isValid) { |
|
| 121 | 124 | //display the create user form |
| 122 | 125 | $this->body_data['verificationCode'] = $verificationCode; |
| 123 | 126 | |
@@ -16,12 +16,12 @@ discard block |
||
| 16 | 16 | $this->header_data['page'] = 'forgot_password'; |
| 17 | 17 | |
| 18 | 18 | //TODO (RESEARCH): Should we allow username here too? |
| 19 | - $this->form_validation->set_rules('email', 'Email', 'required|valid_email', array( |
|
| 19 | + $this->form_validation->set_rules('email', 'Email', 'required|valid_email', array( |
|
| 20 | 20 | 'required' => 'Please enter your email.', |
| 21 | 21 | 'valid_email' => 'The email your entered is invalid.' |
| 22 | 22 | )); |
| 23 | 23 | |
| 24 | - if ($this->form_validation->run() === TRUE) { |
|
| 24 | + if($this->form_validation->run() === TRUE) { |
|
| 25 | 25 | //form is valid |
| 26 | 26 | |
| 27 | 27 | $identity = $this->ion_auth->where('email', $this->input->post('email'))->users()->row(); |
@@ -67,20 +67,20 @@ discard block |
||
| 67 | 67 | $this->header_data['page'] = 'reset-password'; |
| 68 | 68 | |
| 69 | 69 | $user = $this->ion_auth->forgotten_password_check($code); |
| 70 | - if ($user) { |
|
| 70 | + if($user) { |
|
| 71 | 71 | //code is valid, show reset form or process reset |
| 72 | 72 | $min_password_length = $this->config->item('min_password_length', 'ion_auth'); |
| 73 | 73 | $max_password_length = $this->config->item('max_password_length', 'ion_auth'); |
| 74 | - $this->form_validation->set_rules('new_password', 'Password', 'required|min_length['.$min_password_length.']|max_length['.$max_password_length.']'); |
|
| 74 | + $this->form_validation->set_rules('new_password', 'Password', 'required|min_length['.$min_password_length.']|max_length['.$max_password_length.']'); |
|
| 75 | 75 | $this->form_validation->set_rules('new_password_confirm', 'Password Confirm', 'required|matches[new_password]'); |
| 76 | 76 | |
| 77 | - if ($this->form_validation->run() === TRUE) { |
|
| 77 | + if($this->form_validation->run() === TRUE) { |
|
| 78 | 78 | //form is valid, process the password reset request |
| 79 | 79 | |
| 80 | 80 | $identity = $user->{'email'}; |
| 81 | 81 | $change = $this->ion_auth->reset_password($identity, $this->input->post('new_password')); |
| 82 | 82 | |
| 83 | - if ($change) { |
|
| 83 | + if($change) { |
|
| 84 | 84 | //password changed successfully, redirect to login |
| 85 | 85 | redirect('user/login', 'refresh'); |
| 86 | 86 | } else { //@codeCoverageIgnore |
@@ -83,11 +83,13 @@ |
||
| 83 | 83 | if ($change) { |
| 84 | 84 | //password changed successfully, redirect to login |
| 85 | 85 | redirect('user/login', 'refresh'); |
| 86 | - } else { //@codeCoverageIgnore |
|
| 86 | + } else { |
|
| 87 | +//@codeCoverageIgnore |
|
| 87 | 88 | //password changed unsuccessfully, refresh page. |
| 88 | 89 | redirect('user/reset_password/'.$code, 'refresh'); |
| 89 | 90 | } |
| 90 | - } else { //@codeCoverageIgnore |
|
| 91 | + } else { |
|
| 92 | +//@codeCoverageIgnore |
|
| 91 | 93 | //form is invalid OR first-time viewing page |
| 92 | 94 | $this->body_data['reset_code'] = $code; |
| 93 | 95 | $this->body_data['form_password'] = array( |
@@ -13,17 +13,17 @@ discard block |
||
| 13 | 13 | $this->header_data['title'] = 'Login'; |
| 14 | 14 | $this->header_data['page'] = 'login'; |
| 15 | 15 | |
| 16 | - $this->form_validation->set_rules('identity', 'Identity', 'required|max_length[254]', array( |
|
| 16 | + $this->form_validation->set_rules('identity', 'Identity', 'required|max_length[254]', array( |
|
| 17 | 17 | 'required' => 'Please enter your username or email.', |
| 18 | 18 | 'max_length' => 'Invalid username.' |
| 19 | 19 | |
| 20 | 20 | )); |
| 21 | - $this->form_validation->set_rules('password', 'Password', 'required|max_length[64]', array( |
|
| 21 | + $this->form_validation->set_rules('password', 'Password', 'required|max_length[64]', array( |
|
| 22 | 22 | 'required' => 'Please enter your password.', |
| 23 | 23 | 'max_length' => 'Invalid password.' |
| 24 | 24 | )); |
| 25 | 25 | |
| 26 | - if ($isValid = ($this->form_validation->run() === TRUE)) { |
|
| 26 | + if($isValid = ($this->form_validation->run() === TRUE)) { |
|
| 27 | 27 | //form is valid |
| 28 | 28 | |
| 29 | 29 | //check if identity is email, if not then attempt to use grab from DB |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | //login wasn't valid, failed, or this is a fresh login attempt |
| 67 | 67 | if(!$isValid) { |
| 68 | - $this->body_data['form_create'] = array ( |
|
| 68 | + $this->body_data['form_create'] = array( |
|
| 69 | 69 | 'action' => 'user/login', |
| 70 | 70 | |
| 71 | 71 | 'role' => 'form' |
@@ -46,7 +46,8 @@ |
||
| 46 | 46 | $this->session->keep_flashdata('referred_from'); |
| 47 | 47 | if($prevURL = $this->session->flashdata('referred_from')) { |
| 48 | 48 | redirect($prevURL); |
| 49 | - } else { //@codeCoverageIgnore |
|
| 49 | + } else { |
|
| 50 | +//@codeCoverageIgnore |
|
| 50 | 51 | redirect(site_url('/'), 'refresh'); |
| 51 | 52 | } //@codeCoverageIgnore |
| 52 | 53 | } else { |
@@ -1,4 +1,4 @@ |
||
| 1 | -<?php defined('BASEPATH') OR exit('No direct script access allowed'); |
|
| 1 | +<?php defined('BASEPATH') or exit('No direct script access allowed'); |
|
| 2 | 2 | |
| 3 | 3 | class About extends MY_Controller { |
| 4 | 4 | public function __construct() { |
@@ -74,8 +74,8 @@ discard block |
||
| 74 | 74 | */ |
| 75 | 75 | public function __construct(&$db) { |
| 76 | 76 | // Assign the main CI object to $this->CI and load the file helper since we use it a lot |
| 77 | - $this->CI =& get_instance(); |
|
| 78 | - $this->db =& $db; |
|
| 77 | + $this->CI = & get_instance(); |
|
| 78 | + $this->db = & $db; |
|
| 79 | 79 | $this->CI->load->helper('file'); |
| 80 | 80 | |
| 81 | 81 | $this->check_path(); |
@@ -102,18 +102,18 @@ discard block |
||
| 102 | 102 | |
| 103 | 103 | // Add a trailing slash to the path if needed |
| 104 | 104 | $path = realpath($path) |
| 105 | - ? rtrim(realpath($path), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR |
|
| 106 | - : rtrim($path, '/') . '/'; |
|
| 105 | + ? rtrim(realpath($path), DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR |
|
| 106 | + : rtrim($path, '/').'/'; |
|
| 107 | 107 | |
| 108 | 108 | if(!is_dir($path)) { |
| 109 | - log_message('debug', 'DB cache path error: ' . $path); |
|
| 109 | + log_message('debug', 'DB cache path error: '.$path); |
|
| 110 | 110 | |
| 111 | 111 | // If the path is wrong we'll turn off caching |
| 112 | 112 | return $this->db->cache_off(); |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | if(!is_really_writable($path)) { |
| 116 | - log_message('debug', 'DB cache dir not writable: ' . $path); |
|
| 116 | + log_message('debug', 'DB cache dir not writable: '.$path); |
|
| 117 | 117 | |
| 118 | 118 | // If the path is not really writable we'll turn off caching |
| 119 | 119 | return $this->db->cache_off(); |
@@ -143,11 +143,11 @@ discard block |
||
| 143 | 143 | // BEGIN --- modification for supporting multi-level cache folders |
| 144 | 144 | |
| 145 | 145 | if(is_array($this->CI->config->item('multi_level_cache_folders'))) { |
| 146 | - $uri_md5 = md5($segment_one . '+' . $segment_two); |
|
| 146 | + $uri_md5 = md5($segment_one.'+'.$segment_two); |
|
| 147 | 147 | $layer = $this->get_folder_layers($uri_md5); |
| 148 | - $filepath = $this->db->cachedir . $segment_one . '/' . $segment_two . '/' . trim(implode('/', $layer), '/') . '/' . $uri_md5; |
|
| 148 | + $filepath = $this->db->cachedir.$segment_one.'/'.$segment_two.'/'.trim(implode('/', $layer), '/').'/'.$uri_md5; |
|
| 149 | 149 | } else { |
| 150 | - $filepath = $this->db->cachedir . $segment_one . '/' . $segment_two . '/' . md5($sql); |
|
| 150 | + $filepath = $this->db->cachedir.$segment_one.'/'.$segment_two.'/'.md5($sql); |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | // END --- modification for supporting multi-level cache folders |
@@ -178,9 +178,9 @@ discard block |
||
| 178 | 178 | // BEGIN --- modification for supporting multi-level cache folders |
| 179 | 179 | |
| 180 | 180 | if(is_array($this->CI->config->item('multi_level_cache_folders'))) { |
| 181 | - $uri_md5 = md5($segment_one . '+' . $segment_two); |
|
| 181 | + $uri_md5 = md5($segment_one.'+'.$segment_two); |
|
| 182 | 182 | $layer = $this->get_folder_layers($uri_md5); |
| 183 | - $dir_path = $this->db->cachedir . $segment_one . '/' . $segment_two . '/' . trim(implode('/', $layer), '/') . '/'; |
|
| 183 | + $dir_path = $this->db->cachedir.$segment_one.'/'.$segment_two.'/'.trim(implode('/', $layer), '/').'/'; |
|
| 184 | 184 | |
| 185 | 185 | if(!is_dir($dir_path)) { |
| 186 | 186 | $old = umask(0); |
@@ -188,18 +188,18 @@ discard block |
||
| 188 | 188 | umask($old); |
| 189 | 189 | } |
| 190 | 190 | } else { |
| 191 | - $dir_path = $this->db->cachedir . $segment_one . '/' . $segment_two . '/'; |
|
| 191 | + $dir_path = $this->db->cachedir.$segment_one.'/'.$segment_two.'/'; |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | $filename = md5($sql); |
| 195 | 195 | |
| 196 | 196 | // END --- modification for supporting multi-level cache folders |
| 197 | 197 | |
| 198 | - if(write_file($dir_path . $filename, serialize($object)) === FALSE) { |
|
| 198 | + if(write_file($dir_path.$filename, serialize($object)) === FALSE) { |
|
| 199 | 199 | return FALSE; |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | - chmod($dir_path . $filename, 0640); |
|
| 202 | + chmod($dir_path.$filename, 0640); |
|
| 203 | 203 | return TRUE; |
| 204 | 204 | } |
| 205 | 205 | |
@@ -223,11 +223,11 @@ discard block |
||
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | if(is_array($this->CI->config->item('multi_level_cache_folders'))) { |
| 226 | - $uri_md5 = md5($segment_one . '+' . $segment_two); |
|
| 226 | + $uri_md5 = md5($segment_one.'+'.$segment_two); |
|
| 227 | 227 | $layer = $this->get_folder_layers($uri_md5); |
| 228 | - $dir_path = $this->db->cachedir . $segment_one . '/' . $segment_two . '/' . trim(implode('/', $layer), '/') . '/'; |
|
| 228 | + $dir_path = $this->db->cachedir.$segment_one.'/'.$segment_two.'/'.trim(implode('/', $layer), '/').'/'; |
|
| 229 | 229 | } else { |
| 230 | - $dir_path = $this->db->cachedir . $segment_one . '/' . $segment_two . '/'; |
|
| 230 | + $dir_path = $this->db->cachedir.$segment_one.'/'.$segment_two.'/'; |
|
| 231 | 231 | } |
| 232 | 232 | delete_files($dir_path, TRUE); |
| 233 | 233 | } |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php declare(strict_types=1); defined('BASEPATH') or exit('No direct script access allowed'); |
| 2 | 2 | |
| 3 | -require_once APPPATH . '../vendor/erusev/parsedown/Parsedown.php'; |
|
| 3 | +require_once APPPATH.'../vendor/erusev/parsedown/Parsedown.php'; |
|
| 4 | 4 | class CustomParsedown extends Parsedown { |
| 5 | 5 | public function __construct() { |
| 6 | 6 | $this->setSafeMode(TRUE); |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | $link = parent::inlineLink($excerpt); |
| 11 | 11 | |
| 12 | 12 | if(!isset($link)) { |
| 13 | - return null; |
|
| 13 | + return NULL; |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | //Make title attribute the same as link |