| @@ -747,8 +747,17 @@ | ||
| 747 | 747 | |
| 748 | 748 | //Takers Count |
| 749 | 749 | $settings[ $name_prefix . 'takers_count' ] = (isset($options[ $name_prefix . 'takers_count' ]) && $options[ $name_prefix . 'takers_count' ] != '') ? absint ( intval( $options[ $name_prefix . 'takers_count' ] ) ) : 1; |
| 750 | 750 | |
| 751 | + // Password survey | |
| 752 | + $options[ $name_prefix . 'enable_password' ] = ! isset( $options[ $name_prefix . 'enable_password' ] ) ? 'off' : $options[ $name_prefix .'enable_password' ]; | |
| 753 | + $settings[ $name_prefix . 'enable_password' ] = (isset( $options[ $name_prefix . 'enable_password' ] ) && $options[ $name_prefix . 'enable_password' ] == 'on') ? true : false; | |
| 754 | + $settings[ $name_prefix . 'password_survey' ] = (isset( $options[ $name_prefix . 'password_survey' ] ) && $options[ $name_prefix . 'password_survey' ] != '') ? $options[ $name_prefix .'password_survey' ] : ''; | |
| 755 | + $settings[ $name_prefix . 'password_type' ] = (isset( $options[ $name_prefix . 'password_type' ] ) && $options[ $name_prefix . 'password_type' ] != '') ? $options[ $name_prefix .'password_type' ] : 'general'; | |
| 756 | + | |
| 757 | + // Message - Password | |
| 758 | + $settings[ $name_prefix . 'password_message' ] = (isset($options[ $name_prefix . 'password_message' ]) && $options[ $name_prefix . 'password_message' ] != '') ? stripslashes( wpautop( $options[ $name_prefix . 'password_message' ] ) ) : ''; | |
| 759 | + | |
| 751 | 760 | // Auto numbering |
| 752 | 761 | $settings[ $name_prefix . 'auto_numbering' ] = (isset($options[ $name_prefix . 'auto_numbering' ]) && $options[ $name_prefix . 'auto_numbering' ] != '') ? stripslashes( $options[ $name_prefix . 'auto_numbering' ] ) : 'none'; |
| 753 | 762 | |
| 754 | 763 | // Loader custom gif |
| @@ -1140,61 +1149,33 @@ | ||
| 1140 | 1149 | return $result; |
| 1141 | 1150 | } |
| 1142 | 1151 | |
| 1143 | 1152 | public static function get_user_ip(){ |
| 1144 | - $ipaddress = ''; | |
| 1145 | - if( !empty($_SERVER) && !empty($_SERVER['REMOTE_ADDR']) ){ | |
| 1146 | - $ipaddress = isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] ? sanitize_text_field($_SERVER['REMOTE_ADDR']) : 'UNKNOWN'; | |
| 1147 | - } else { | |
| 1148 | - if (getenv('REMOTE_ADDR')) | |
| 1149 | - $ipaddress = getenv('REMOTE_ADDR'); | |
| 1150 | - elseif (getenv('HTTP_CLIENT_IP')) | |
| 1151 | - $ipaddress = getenv('HTTP_CLIENT_IP'); | |
| 1152 | - else if (getenv('HTTP_X_FORWARDED_FOR')) | |
| 1153 | - $ipaddress = getenv('HTTP_X_FORWARDED_FOR'); | |
| 1154 | - else if (getenv('HTTP_X_FORWARDED')) | |
| 1155 | - $ipaddress = getenv('HTTP_X_FORWARDED'); | |
| 1156 | - else if (getenv('HTTP_FORWARDED_FOR')) | |
| 1157 | - $ipaddress = getenv('HTTP_FORWARDED_FOR'); | |
| 1158 | - else if (getenv('HTTP_FORWARDED')) | |
| 1159 | - $ipaddress = getenv('HTTP_FORWARDED'); | |
| 1160 | - else | |
| 1161 | - $ipaddress = 'UNKNOWN'; | |
| 1153 | + $ipaddress = false; | |
| 1154 | + | |
| 1155 | + if (getenv('HTTP_CLIENT_IP')) { | |
| 1156 | + $ipaddress = getenv('HTTP_CLIENT_IP'); | |
| 1157 | + } else if (getenv('HTTP_X_FORWARDED_FOR')) { | |
| 1158 | + $ipaddress = getenv('HTTP_X_FORWARDED_FOR'); | |
| 1159 | + } else if (getenv('HTTP_X_FORWARDED')) { | |
| 1160 | + $ipaddress = getenv('HTTP_X_FORWARDED'); | |
| 1161 | + } else if (getenv('HTTP_FORWARDED_FOR')) { | |
| 1162 | + $ipaddress = getenv('HTTP_FORWARDED_FOR'); | |
| 1163 | + } else if (getenv('HTTP_FORWARDED')) { | |
| 1164 | + $ipaddress = getenv('HTTP_FORWARDED'); | |
| 1162 | 1165 | } |
| 1163 | - return $ipaddress; | |
| 1164 | - } | |
| 1165 | 1166 | |
| 1166 | - // OLD | |
| 1167 | - // public static function get_user_ip_validated(){ | |
| 1168 | - // $ipaddress = ''; | |
| 1169 | - // if (getenv('REMOTE_ADDR')){ | |
| 1170 | - // $ipaddress = getenv('REMOTE_ADDR'); | |
| 1171 | - // } | |
| 1172 | - // elseif (getenv('HTTP_CLIENT_IP')){ | |
| 1173 | - // $ipaddress = getenv('HTTP_CLIENT_IP'); | |
| 1174 | - // } | |
| 1175 | - // else if (getenv('HTTP_X_FORWARDED_FOR')){ | |
| 1176 | - // $ipaddress = getenv('HTTP_X_FORWARDED_FOR'); | |
| 1177 | - // } | |
| 1178 | - // else if (getenv('HTTP_X_FORWARDED')){ | |
| 1179 | - // $ipaddress = getenv('HTTP_X_FORWARDED'); | |
| 1180 | - // } | |
| 1181 | - // else if (getenv('HTTP_FORWARDED_FOR')){ | |
| 1182 | - // $ipaddress = getenv('HTTP_FORWARDED_FOR'); | |
| 1183 | - // } | |
| 1184 | - // else if (getenv('HTTP_FORWARDED')){ | |
| 1185 | - // $ipaddress = getenv('HTTP_FORWARDED'); | |
| 1186 | - // } | |
| 1187 | - // else{ | |
| 1188 | - // $ipaddress = 'UNKNOWN'; | |
| 1189 | - // } | |
| 1190 | - // // Validate the IP address | |
| 1191 | - // if (filter_var($ipaddress, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_IPV6) && $ipaddress !== '0.0.0.0') { | |
| 1192 | - // return $ipaddress; | |
| 1193 | - // } | |
| 1194 | - // return 'UNKNOWN'; | |
| 1195 | - | |
| 1196 | - // } | |
| 1167 | + if ( $ipaddress !== false && filter_var( $ipaddress, FILTER_VALIDATE_IP ) !== false ) { | |
| 1168 | + return $ipaddress; | |
| 1169 | + } | |
| 1170 | + | |
| 1171 | + $remote_address = getenv('REMOTE_ADDR'); | |
| 1172 | + if ( $remote_address !== false && filter_var( $remote_address, FILTER_VALIDATE_IP ) !== false ) { | |
| 1173 | + return $remote_address; | |
| 1174 | + } | |
| 1175 | + | |
| 1176 | + return 'UNKNOWN'; | |
| 1177 | + } | |
| 1197 | 1178 | |
| 1198 | 1179 | // FOR REVIEW |
| 1199 | 1180 | public static function get_user_ip_validated(){ |
| 1200 | 1181 | |