| @@ -1457,9 +1457,8 @@ | ||
| 1457 | 1457 | } |
| 1458 | 1458 | |
| 1459 | 1459 | function uwp_get_localize_data() |
| 1460 | 1460 | { |
| 1461 | - $pass_msg = uwp_get_option("register_uwp_strong_pass_msg"); | |
| 1462 | 1461 | $uwp_localize_data = array( |
| 1463 | 1462 | 'uwp_more_char_limit' => 100, |
| 1464 | 1463 | 'uwp_more_text' => __('more', 'userswp'), |
| 1465 | 1464 | 'uwp_less_text' => __('less', 'userswp'), |
| @@ -1470,12 +1469,11 @@ | ||
| 1470 | 1469 | 'login_modal' => uwp_get_option("design_style", 'bootstrap') == 'bootstrap' && uwp_get_option("login_modal", 1) ? 1 : '', |
| 1471 | 1470 | 'register_modal' => uwp_get_option("design_style", 'bootstrap') == 'bootstrap' && uwp_get_option("register_modal", 1) ? 1 : '', |
| 1472 | 1471 | 'forgot_modal' => uwp_get_option("design_style", 'bootstrap') == 'bootstrap' && uwp_get_option("forgot_modal", 1) ? 1 : '', |
| 1473 | 1472 | 'uwp_pass_strength' => uwp_get_option("register_min_password_strength", 0), |
| 1474 | - 'uwp_strong_pass_msg' => !empty($pass_msg) ? $pass_msg : __("Please enter valid strong password.", "userswp"), | |
| 1473 | + 'uwp_strong_pass_msg' => uwp_get_option("register_uwp_strong_pass_msg", __("Please enter valid strong password.", "userswp")), | |
| 1475 | 1474 | 'default_banner' => uwp_get_default_banner_uri(), |
| 1476 | - 'basicNonce' => esc_attr(wp_create_nonce('uwp_basic_nonce')), | |
| 1477 | - 'wordfence_2fa_active' => ( class_exists( '\WordfenceLS\Controller_Users' ) && class_exists( '\WordfenceLS\Controller_TOTP' ) ) ? 1 : '' | |
| 1475 | + 'basicNonce' => esc_attr(wp_create_nonce('uwp_basic_nonce')) | |
| 1478 | 1476 | ); |
| 1479 | 1477 | |
| 1480 | 1478 | return apply_filters('uwp_localize_data', $uwp_localize_data); |
| 1481 | 1479 | } |
| @@ -1871,17 +1869,13 @@ | ||
| 1871 | 1869 | $key = wp_generate_password(20, false); |
| 1872 | 1870 | |
| 1873 | 1871 | do_action('uwp_activation_key', $user_data->user_login, $key); |
| 1874 | 1872 | |
| 1875 | - if ( function_exists( 'wp_fast_hash' ) ) { | |
| 1876 | - $hashed = wp_fast_hash( $key ); | |
| 1877 | - } else { | |
| 1878 | - if ( empty( $wp_hasher ) ) { | |
| 1879 | - require_once ABSPATH . 'wp-includes/class-phpass.php'; | |
| 1880 | - $wp_hasher = new PasswordHash( 8, true ); | |
| 1881 | - } | |
| 1882 | - $hashed = $wp_hasher->HashPassword( $key ); | |
| 1873 | + if (empty($wp_hasher)) { | |
| 1874 | + require_once ABSPATH . 'wp-includes/class-phpass.php'; | |
| 1875 | + $wp_hasher = new PasswordHash(8, true); | |
| 1883 | 1876 | } |
| 1877 | + $hashed = $wp_hasher->HashPassword($key); | |
| 1884 | 1878 | $wpdb->update($wpdb->users, array('user_activation_key' => time() . ":" . $hashed), array('user_login' => $user_data->user_login)); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching |
| 1885 | 1879 | update_user_meta($user_id, 'uwp_mod', 'email_unconfirmed'); |
| 1886 | 1880 | |
| 1887 | 1881 | $activation_args = array( |
| @@ -1886,9 +1880,9 @@ | ||
| 1886 | 1880 | |
| 1887 | 1881 | $activation_args = array( |
| 1888 | 1882 | 'uwp_activate' => 'yes', |
| 1889 | 1883 | 'key' => $key, |
| 1890 | - 'login' => rawurlencode($user_data->user_login) | |
| 1884 | + 'login' => $user_data->user_login | |
| 1891 | 1885 | ); |
| 1892 | 1886 | |
| 1893 | 1887 | $activation_args = apply_filters('uwp_activation_link_args', $activation_args, $user_id, $user_data); |
| 1894 | 1888 | |
| @@ -2037,89 +2031,5 @@ | ||
| 2037 | 2031 | |
| 2038 | 2032 | $display_name = ! empty($user_data->display_name) ? $user_data->display_name : $user_data->user_login; |
| 2039 | 2033 | |
| 2040 | 2034 | return apply_filters('uwp_get_username', $display_name, $user_id, $user_data); |
| 2041 | -} | |
| 2042 | - | |
| 2043 | -/** | |
| 2044 | - * File relative url. | |
| 2045 | - * | |
| 2046 | - * @since 1.2.66 | |
| 2047 | - * | |
| 2048 | - * @param string $url URL. | |
| 2049 | - * @param bool $full_path Optional. Full Path. Default false. | |
| 2050 | - * @return string | |
| 2051 | - */ | |
| 2052 | -function uwp_get_file_relative_url( $url, $full_path = false ) { | |
| 2053 | - $url = trim( $url ); | |
| 2054 | - | |
| 2055 | - if ( !$url ) { | |
| 2056 | - return $url; | |
| 2057 | - } | |
| 2058 | - | |
| 2059 | - $relative_url = $url; | |
| 2060 | - $url = trim( $url, '/\\' ); // clean slashes | |
| 2061 | - | |
| 2062 | - $upload_dir = wp_upload_dir(); | |
| 2063 | - $upload_basedir = $upload_dir['basedir']; | |
| 2064 | - $upload_baseurl = $upload_dir['baseurl']; | |
| 2065 | - $content_dir = untrailingslashit( WP_CONTENT_DIR ); | |
| 2066 | - $content_url = untrailingslashit( WP_CONTENT_URL ); | |
| 2067 | - | |
| 2068 | - if ( strpos( $upload_baseurl, 'https://' ) === 0 ) { | |
| 2069 | - $https = 'https://'; | |
| 2070 | - $match_upload_baseurl = str_replace( 'https://', '', $upload_baseurl ); | |
| 2071 | - $content_url = str_replace( 'http://', 'https://', $content_url ); | |
| 2072 | - } else { | |
| 2073 | - $https = 'http://'; | |
| 2074 | - $match_upload_baseurl = str_replace( 'http://', '', $upload_baseurl ); | |
| 2075 | - $content_url = str_replace( 'https://', 'http://', $content_url ); | |
| 2076 | - } | |
| 2077 | - | |
| 2078 | - $match_content_url = strpos( $content_url, 'https://' ) === 0 ? str_replace( 'https://', '', $content_url ) : str_replace( 'http://', '', $content_url ); | |
| 2079 | - $match_url = strpos( $url, 'https://' ) === 0 ? str_replace( 'https://', '', $url ) : str_replace( 'http://', '', $url ); | |
| 2080 | - | |
| 2081 | - // www. | |
| 2082 | - $www = ''; | |
| 2083 | - if ( strpos( $match_upload_baseurl, 'www.' ) === 0 ) { | |
| 2084 | - $www = 'www.'; | |
| 2085 | - $match_upload_baseurl = str_replace( 'www.', '', $match_upload_baseurl ); | |
| 2086 | - } | |
| 2087 | - if ( strpos( $match_content_url, 'www.' ) === 0 ) { | |
| 2088 | - $match_content_url = str_replace( 'www.', '', $match_content_url ); | |
| 2089 | - } | |
| 2090 | - if ( strpos( $match_url, 'www.' ) === 0 ) { | |
| 2091 | - $match_url = str_replace( 'www.', '', $match_url ); | |
| 2092 | - } | |
| 2093 | - | |
| 2094 | - if ( $full_path ) { | |
| 2095 | - if ( strpos( $relative_url, 'http://' ) === 0 || strpos( $relative_url, 'https://' ) === 0 ) { | |
| 2096 | - if ( strpos( $match_url, $match_upload_baseurl ) === 0 || strpos( $match_url, $match_content_url ) === 0 ) { | |
| 2097 | - $relative_url = $https . $www . $match_url; | |
| 2098 | - } | |
| 2099 | - } else { | |
| 2100 | - if ( is_file( $content_dir . '/' . $match_url ) && file_exists( $content_dir . '/' . $match_url ) ) { // url contains content url | |
| 2101 | - $relative_url = $content_url . '/' . $match_url; | |
| 2102 | - } elseif ( is_file( $upload_basedir . '/' . $match_url ) && file_exists( $upload_basedir . '/' . $match_url ) ) { // url contains content url | |
| 2103 | - $relative_url = $upload_baseurl . '/' . $match_url; | |
| 2104 | - } | |
| 2105 | - } | |
| 2106 | - } else { | |
| 2107 | - if ( substr_count( $match_url, $match_upload_baseurl ) > 1 || substr_count( $match_url, $match_content_url ) > 1 ) { | |
| 2108 | - return ''; | |
| 2109 | - } | |
| 2110 | - | |
| 2111 | - if ( strpos( $match_url, $match_upload_baseurl ) === 0 ) { // url contains uploads baseurl | |
| 2112 | - $relative_url = substr( $match_url, strlen( $match_upload_baseurl ) ); | |
| 2113 | - } elseif ( strpos( $match_url, $match_content_url ) === 0 ) { // url contains content url | |
| 2114 | - $relative_url = substr( $match_url, strlen( $match_content_url ) ); | |
| 2115 | - } | |
| 2116 | - | |
| 2117 | - $relative_url = trim( $relative_url, '/\\' ); | |
| 2118 | - | |
| 2119 | - if ( false !== strpos( $relative_url, '..' ) ) { | |
| 2120 | - return ''; | |
| 2121 | - } | |
| 2122 | - } | |
| 2123 | - | |
| 2124 | - return apply_filters( 'uwp_get_file_relative_url', $relative_url, $url, $full_path ); | |
| 2125 | 2035 | } |