| @@ -4,9 +4,9 @@ | ||
| 4 | 4 | * Plugin URI: https://wpforo.com |
| 5 | 5 | * Description: WordPress Forum plugin. wpForo is the only AI powered forum solution for your community. Modern design and 5 forum layouts. |
| 6 | 6 | * Author: gVectors Team |
| 7 | 7 | * Author URI: https://gvectors.com/ |
| 8 | -* Version: 3.1.1 | |
| 8 | +* Version: 3.1.6 | |
| 9 | 9 | * Requires at least: 5.2 |
| 10 | 10 | * Requires PHP: 7.1 |
| 11 | 11 | * Text Domain: wpforo |
| 12 | 12 | * Domain Path: /languages |
| @@ -13,9 +13,9 @@ | ||
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | 15 | namespace wpforo; |
| 16 | 16 | |
| 17 | -define( 'WPFORO_VERSION', '3.1.1' ); | |
| 17 | +define( 'WPFORO_VERSION', '3.1.6' ); | |
| 18 | 18 | |
| 19 | 19 | //Exit if accessed directly |
| 20 | 20 | if( ! defined( 'ABSPATH' ) ) exit; |
| 21 | 21 | |
| @@ -1291,9 +1291,16 @@ | ||
| 1291 | 1291 | 'period' => $period, |
| 1292 | 1292 | ]; |
| 1293 | 1293 | } elseif( $this->current_object['template'] === 'tags' ) { |
| 1294 | 1294 | $current_object['items_per_page'] = wpforo_setting( 'tags', 'per_page' ); |
| 1295 | + // Tag sort: whitelist the URL key, then map to orderby/order. Never pass raw input to get_tags(). | |
| 1296 | + $tag_sort_map = [ 'count' => [ 'count', 'DESC' ], 'az' => [ 'tag', 'ASC' ], 'za' => [ 'tag', 'DESC' ] ]; | |
| 1297 | + $tag_sort_key = sanitize_key( (string) wpfval( $_GET, 'wpf_tag_sort' ) ); | |
| 1298 | + if( ! isset( $tag_sort_map[ $tag_sort_key ] ) ) $tag_sort_key = 'count'; | |
| 1299 | + $current_object['tag_sort'] = $tag_sort_key; | |
| 1295 | 1300 | $args = [ |
| 1301 | + 'orderby' => $tag_sort_map[ $tag_sort_key ][0], | |
| 1302 | + 'order' => $tag_sort_map[ $tag_sort_key ][1], | |
| 1296 | 1303 | 'offset' => ( $current_object['paged'] - 1 ) * $current_object['items_per_page'], |
| 1297 | 1304 | 'row_count' => $current_object['items_per_page'], |
| 1298 | 1305 | ]; |
| 1299 | 1306 | $current_object['tags'] = $this->topic->get_tags( $args, $current_object['items_count'] ); |