Changeset 2298283
- Timestamp:
- 05/05/2020 08:20:51 AM (6 years ago)
- Location:
- wp-appkit/trunk
- Files:
-
- 5 edited
-
lib/apps/build.php (modified) (1 diff)
-
lib/simulator/config-file.php (modified) (1 diff)
-
lib/user-permissions/auth-engines/rsa-public-private-auth.php (modified) (9 diffs)
-
readme.txt (modified) (2 diffs)
-
wp-appkit.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-appkit/trunk/lib/apps/build.php
r2197382 r2298283 835 835 } 836 836 837 $index_content = preg_replace( '/< head>(\s*?)<link/is', "<head>$1". $app_title_html ."$1". $app_description_html ."$1". $manifest_html ."$1". $base_html ."$1". $theme_color ."$1<link", $index_content );837 $index_content = preg_replace( '/<meta charset="([^"]*)">(\s*?)<link/is', "<meta charset=\"$1\">$2". $app_title_html ."$2". $app_description_html ."$2". $manifest_html ."$2". $base_html ."$2". $theme_color ."$2<link", $index_content ); 838 838 839 839 //Remove script used only for app simulation in web browser: -
wp-appkit/trunk/lib/simulator/config-file.php
r2127247 r2298283 38 38 39 39 if ( WpakApps::get_app_simulation_is_secured( $app_id ) && !current_user_can( $capability ) ) { 40 wp_nonce_ays( $action);40 wp_nonce_ays(''); 41 41 } 42 42 -
wp-appkit/trunk/lib/user-permissions/auth-engines/rsa-public-private-auth.php
r2127247 r2298283 8 8 9 9 public function settings_meta_box_content( $post, $current_box ) { 10 11 //Include theme and addons php files so that authentication hooks are applied 12 WpakThemes::include_app_theme_php( $post->ID ); 13 WpakAddons::require_app_addons_php_files( $post->ID ); 10 14 11 15 $auth_settings = $this->get_authentication_settings( $post->ID ); … … 60 64 61 65 if ( !empty( $auth_settings['private_key'] ) ) { 62 ?><h4><?php _e( 'User connections', WpAppKit::i18n_domain ) ?></h4><?php 66 ?><h4><?php _e( 'User connections', WpAppKit::i18n_domain ) ?></h4> 67 <?php 63 68 $current_connections = $this->get_current_connections( $post->ID ); 64 69 ?> … … 80 85 <th style="width:25%"><?php _e( 'Login time', WpAppKit::i18n_domain ) ?></th> 81 86 <th style="width:25%"><?php _e( 'Last access time', WpAppKit::i18n_domain ) ?></th> 87 <th style="width:25%"><?php _e( 'Validity', WpAppKit::i18n_domain ) ?></th> 88 <th style="width:25%"><?php _e( 'Expiration time', WpAppKit::i18n_domain ) ?></th> 82 89 </tr> 83 90 </thead> … … 109 116 </table> 110 117 </td> 118 <td> 119 <?php 120 $user_last_time = $this->get_user_last_time( $user_id, $post->ID ); 121 if ( $user_last_time ) { 122 $expiration_type = $this->get_expiration_type($user_id, $post->ID); 123 $validity_duration = $this->get_expiration_time($user_id, $post->ID); 124 echo human_time_diff( 0, $validity_duration ) .' '; 125 echo $expiration_type == 'last_access_time' ? __( 'from last access time', WpAppKit::i18n_domain ) : __( 'from login time', WpAppKit::i18n_domain ); 126 } 127 ?> 128 </td> 129 <td> 130 <?php 131 if ( $user_last_time ) { 132 echo get_date_from_gmt( date( 'Y-m-d H:i:s', $user_last_time + $validity_duration ) ); 133 } 134 ?> 135 </td> 111 136 </tr> 112 137 <?php … … 133 158 $current_connections = []; 134 159 $current_connections_raw = $wpdb->get_results( "SELECT user_id, meta_value FROM {$wpdb->prefix}usermeta WHERE meta_key = '$user_meta'", ARRAY_A ); 135 //$current_connections_raw136 160 if ( !empty( $current_connections_raw ) ) { 137 161 foreach( $current_connections_raw as $current_connection ) { … … 755 779 } 756 780 757 $purge_time = apply_filters( 'wpak_auth_purge_time', 30*24*3600, $user_id, $app_id ); //1 month by default758 759 781 $expiration_type = $this->get_expiration_type( $user_id, $app_id ); 760 782 $expiration_time = $this->get_expiration_time( $user_id, $app_id ); 783 784 //Purge time. 1 month by default : 785 $purge_time = apply_filters( 'wpak_auth_purge_time', 30*24*3600, $user_id, $app_id ); 786 if ( $purge_time < $expiration_time ) { 787 $purge_time = $expiration_time; //Purge time must be >= to expiration time 788 } 761 789 762 790 $time = time(); … … 769 797 $changed = true; 770 798 } 799 //Check if all devices have expired 771 800 if ( $time - $auth_data[$expiration_type] < $expiration_time ) { 772 unset( $user_auth_data[$device_id] );773 801 $all_expired = false; 774 802 } … … 832 860 $connection_validity = 0; 833 861 862 $user_last_time = $this->get_user_last_time( $user_id, $app_id ); 863 if ( $user_last_time ) { 864 865 $expiration_time = $this->get_expiration_time( $user_id, $app_id ); 866 867 if ( $expiration_time === -1 ) { 868 $connection_validity = 1; 869 } else { 870 $connection_validity = ( ( time() - $user_last_time ) <= $expiration_time ) ? 1 : -1; 871 } 872 } 873 874 return $connection_validity; 875 } 876 877 /** 878 * Get the given user last login or access time (according to expiration_type) 879 * 880 * @param int $user_id User id 881 * @param int $app_id App id 882 * @return int $user_last_time Timestamp or 0 if no valid last time found 883 */ 884 protected function get_user_last_time( $user_id, $app_id ) { 885 $user_last_time = 0; 886 834 887 $user_meta = '_wpak_auth_'. $app_id; 835 888 … … 869 922 870 923 if ( $expiration_type === 'login_time' ) { 871 $user_ secret_time = $last_login_time;924 $user_last_time = $last_login_time; 872 925 } else if ( $expiration_type === 'last_access_time' ) { 873 $user_secret_time = $last_access_time; 874 } 875 876 $expiration_time = $this->get_expiration_time( $user_id, $app_id ); 877 878 if ( $expiration_time === -1 ) { 879 $connection_validity = 1; 880 } else { 881 $connection_validity = ( ( time() - $user_secret_time ) <= $expiration_time ) ? 1 : -1; 882 } 883 884 } 885 886 return $connection_validity; 926 $user_last_time = $last_access_time; 927 } 928 929 } 930 931 return $user_last_time; 887 932 } 888 933 -
wp-appkit/trunk/readme.txt
r2197382 r2298283 3 3 Tags: pwa, mobile app, android, ios, progressive web app, phonegap build 4 4 Requires at least: 4.0 5 Tested up to: 5. 36 Stable tag: 1.5. 55 Tested up to: 5.4.1 6 Stable tag: 1.5.6 7 7 License: GPLv2 or later 8 8 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 122 122 123 123 Also see [changelog on github](https://github.com/uncatcrea/wp-appkit/blob/master/CHANGELOG.md) for full details. 124 125 = 1.5.6 (2020-05-05) = 126 127 *Fixes* 128 129 - Fix PWA: manifest.json not linked properly 130 - User authentication: fix purge time when long expiration time 131 - User authentication: fix old connections cleanup 132 - Fix PHP notice when accessing preview for private app 133 134 *Features* 135 136 - User authentication: add expiration time info 124 137 125 138 = 1.5.5 (2019-11-20) = -
wp-appkit/trunk/wp-appkit.php
r2197382 r2298283 4 4 Plugin URI: https://github.com/uncatcrea/wp-appkit 5 5 Description: Build mobile apps and PWA based on your WordPress content. 6 Version: 1.5. 56 Version: 1.5.6 7 7 Author: Uncategorized Creations 8 8 Author URI: http://getwpappkit.com … … 21 21 class WpAppKit { 22 22 23 const resources_version = '1.5. 5';23 const resources_version = '1.5.6'; 24 24 const i18n_domain = 'wp-appkit'; 25 25
Note: See TracChangeset
for help on using the changeset viewer.