Plugin Directory

Changeset 2563001


Ignore:
Timestamp:
07/12/2021 04:59:15 PM (5 years ago)
Author:
scottopolis
Message:

v4.1.0

Location:
apppresser
Files:
859 added
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • apppresser/trunk/apppresser.php

    r2456516 r2563001  
    66Text Domain: apppresser
    77Domain Path: /languages
    8 Version: 4.0.7
     8Version: 4.1.0
    99Author: AppPresser Team
    1010Author URI: http://apppresser.com
     
    3333class AppPresser {
    3434
    35     const VERSION           = '4.0.7';
     35    const VERSION           = '4.1.0';
    3636    const SETTINGS_NAME     = 'appp_settings';
    3737    public static $settings = 'false';
  • apppresser/trunk/inc/AppPresser_Remote_Scripts.php

    r1702479 r2563001  
    171171     * @param string $file_id indexed name for the file upload field
    172172     * @param string $nonce Nonce key
    173      * @param string $nonce_action Nonce action to verify
    174      */
    175     function validate_upload( $file_id, $public_nonce_key ) {
    176 
    177         $is_valid_nonce = ( isset( $_POST[ $public_nonce_key ] ) && wp_verify_nonce( $_POST[ $public_nonce_key ], plugin_basename( __FILE__ ) ) );
    178         $is_valid_upload = ( ! empty( $_FILES ) ) && isset( $_FILES[ $file_id ] );
    179 
    180         return ( $is_valid_upload && $is_valid_nonce );
    181     }
     173     */
     174    function validate_upload($file_id, $public_nonce_key)
     175    {
     176        $is_valid_nonce = (isset($_POST[$public_nonce_key]) && wp_verify_nonce($_POST[$public_nonce_key], plugin_basename(__FILE__)));
     177        $is_valid_upload = (!empty($_FILES) && isset($_FILES[$file_id]) && $_FILES[$file_id]['error'] !== 4); // error code 4 means there is no file uploaded
     178
     179        return ($is_valid_nonce && $is_valid_upload);
     180    }
    182181
    183182    /**
  • apppresser/trunk/inc/AppPresser_WPAPI_Mods.php

    r2440838 r2563001  
    4545            array(
    4646                'methods'             => WP_REST_Server::CREATABLE,
    47                 'callback'            => array( $this, 'api_login' )
     47                'callback'            => array( $this, 'api_login' ),
     48                'permission_callback' => '__return_true'
    4849            ),
    4950        ) );
     
    5253            array(
    5354                'methods'             => WP_REST_Server::READABLE,
    54                 'callback'            => array( $this, 'api_logout' )
     55                'callback'            => array( $this, 'api_logout' ),
     56                'permission_callback' => '__return_true'
    5557            ),
    5658        ) );
     
    5961            array(
    6062                'methods'             => WP_REST_Server::CREATABLE,
    61                 'callback'            => array( $this, 'register_user')
     63                'callback'            => array( $this, 'register_user'),
     64                'permission_callback' => '__return_true'
    6265            ),
    6366        ) );
     
    6669            array(
    6770                'methods'             => WP_REST_Server::CREATABLE,
    68                 'callback'            => array( $this, 'verify_user')
     71                'callback'            => array( $this, 'verify_user'),
     72                'permission_callback' => '__return_true'
    6973            ),
    7074        ) );
     
    7377            array(
    7478                'methods'             => WP_REST_Server::CREATABLE,
    75                 'callback'            => array( $this, 'send_verification_code')
     79                'callback'            => array( $this, 'send_verification_code'),
     80                'permission_callback' => '__return_true'
    7681            ),
    7782        ) );
     
    8085            array(
    8186                'methods'             => WP_REST_Server::CREATABLE,
    82                 'callback'            => array( $this, 'reset_password')
     87                'callback'            => array( $this, 'reset_password'),
     88                'permission_callback' => '__return_true'
    8389            ),
    8490        ) );
     
    8793            array(
    8894                'methods'             => WP_REST_Server::READABLE,
    89                 'callback'            => array( $this, 'system_information')
     95                'callback'            => array( $this, 'system_information'),
     96                'permission_callback' => '__return_true'
    9097            ),
    9198        ) );
     
    95102                'methods'             => WP_REST_Server::CREATABLE,
    96103                'callback'            => array( $this, 'submit_form'),
    97                 'permission_callback' => array( $this, 'post_permissions' )
     104                'permission_callback' => array( $this, 'form_permissions' )
    98105            ),
    99106        ) );
     
    152159        ***/
    153160
    154         $post_types = get_post_types();
     161        $post_types = apply_filters('appp_api_fields_post_types', get_post_types());
    155162
    156163        foreach ($post_types as $key => $value) {
     
    696703
    697704    // permissions callback for submitting data
    698     public function post_permissions() {
    699 
    700         if (!is_user_logged_in()) {
    701             return new WP_Error(
    702                 'rest_authorization_required',
    703                 __('Sorry, you are not allowed to do that.', 'apppresser'),
    704                 array(
    705                     'status' => rest_authorization_required_code(),
    706                 )
    707             );
     705    public function form_permissions() {
     706
     707        $has_permission = false;
     708
     709        if (is_user_logged_in()) {
     710            $has_permission = true;
    708711        }
    709712
    710         return true;
     713        $has_permission = apply_filters( 'appp_form_permissions', $has_permission );
     714
     715        return $has_permission;
    711716    }
    712717
  • apppresser/trunk/readme.txt

    r2456516 r2563001  
    44Tags: mobile, app, ios, android, application, phonegap, iphone app, android app, mobile app, native app, wordpress mobile, ipad app, iOS app
    55Requires at least: 4.7.0
    6 Tested up to: 5.6
    7 Stable tag: 4.0.7
     6Tested up to: 5.8
     7Stable tag: 4.1.0
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    4747
    4848== Changelog ==
     49
     50= 4.1.0 =
     51
     52* Remove deprecated files from AppPresser 1 in /pg/*
     53* Validate upload by checking if file input is empty
     54* Add filter on post types when adding api fields: appp_api_fields_post_types
     55* Add missing permission callbacks
    4956
    5057= 4.0.7 =
Note: See TracChangeset for help on using the changeset viewer.