| @@ -1011,27 +1011,27 @@ | ||
| 1011 | 1011 | $args = apply_filters( 'gamipress_get_rank_earners_args', $args, $rank_id ); |
| 1012 | 1012 | |
| 1013 | 1013 | $args = wp_parse_args( $args, $defaults ); |
| 1014 | 1014 | |
| 1015 | + // Sanitization | |
| 1016 | + $args['limit'] = absint( $args['limit'] ); | |
| 1017 | + $args['order'] = gamipress_validate_from_array( strtoupper( $args['order'] ), array( 'ASC', 'DESC' ), 'DESC' ); | |
| 1018 | + | |
| 1015 | 1019 | // Setup FROM |
| 1016 | - if( ! empty( $args['from'] ) ) { | |
| 1020 | + if( ! empty( $args['from'] ) ) | |
| 1017 | 1021 | $from .= $args['from']; |
| 1018 | - } | |
| 1019 | 1022 | |
| 1020 | 1023 | // Setup WHERE |
| 1021 | - if( ! empty( $args['where'] ) ) { | |
| 1024 | + if( ! empty( $args['where'] ) ) | |
| 1022 | 1025 | $where .= $args['where']; |
| 1023 | - } | |
| 1024 | 1026 | |
| 1025 | 1027 | // Setup LIMIT |
| 1026 | - if( $args['limit'] > 0 ) { | |
| 1028 | + if( $args['limit'] > 0 ) | |
| 1027 | 1029 | $limit = '0, ' . $args['limit']; |
| 1028 | - } | |
| 1029 | 1030 | |
| 1030 | 1031 | // Setup ORDER BY |
| 1031 | - if( ! empty( $args['orderby'] ) ) { | |
| 1032 | + if( ! empty( $args['orderby'] ) ) | |
| 1032 | 1033 | $order_by = $args['orderby'] . ' ' . $args['order']; |
| 1033 | - } | |
| 1034 | 1034 | |
| 1035 | 1035 | $earners = $wpdb->get_col( |
| 1036 | 1036 | "SELECT u.user_id |
| 1037 | 1037 | FROM {$from} |