Changeset 3468303
- Timestamp:
- 02/24/2026 07:01:33 AM (5 weeks ago)
- Location:
- infility-global/trunk
- Files:
-
- 2 edited
-
include/class/action.class.php (modified) (2 diffs)
-
infility_global.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
infility-global/trunk/include/class/action.class.php
r3452498 r3468303 41 41 } 42 42 43 public static function get_cf7_data($postData){ 44 global $wpdb; 45 $table = $wpdb->prefix . 'db7_forms'; 46 $form_post_id = intval($postData['form_post_id'] ?? 0); 47 $start_date = $postData['start_date'] ?? ''; 48 $end_date = $postData['end_date'] ?? ''; 49 $order = $postData['order'] ?? ''; 50 $page = intval($postData['page'] ?? 1); 51 $pageLimit = intval($postData['pageLimit'] ?? 20); 52 53 $page < 1 && $page = 1; 54 $pageLimit < 1 && $pageLimit = 20; 55 56 $params = []; 57 $where_sql = ''; 58 if(!empty($form_post_id)){ 59 $where_sql .= "form_post_id = %d"; 60 $params[] = $form_post_id; 61 } 62 63 $sd_ts = $start_date ? strtotime($start_date) : false; 64 $ed_ts = $end_date ? strtotime($end_date) : false; 65 if ($sd_ts && $ed_ts) { 66 $start_date = date('Y-m-d H:i:s', $sd_ts); 67 $end_date = date('Y-m-d H:i:s', $ed_ts); 68 $where_sql .= " AND form_date >= %s AND form_date <= %s"; 69 $params[] = $start_date; 70 $params[] = $end_date; 71 } 72 73 if(!empty($where_sql)){ 74 $where_sql = "WHERE $where_sql"; 75 } 76 77 $count_sql = $wpdb->prepare("SELECT COUNT(*) FROM $table $where_sql", $params); 78 $row_count = intval($wpdb->get_var($count_sql)); 79 $total_pages = $row_count > 0 ? (int)ceil($row_count / $pageLimit) : 1; 80 ($page < 1 || $page > $total_pages) && $page = 1; 81 $start_row = ($page - 1) * $pageLimit; 82 83 $order_sql = 'form_date DESC'; 84 if ($order) { 85 $dir = strtoupper($order) === 'ASC' ? 'ASC' : (strtoupper($order) === 'DESC' ? 'DESC' : ''); 86 $dir && ($order_sql = "form_date $dir"); 87 } 88 89 $list_sql = "SELECT * FROM $table $where_sql ORDER BY $order_sql LIMIT %d, %d"; 90 $list_params = array_merge($params, [$start_row, $pageLimit]); 91 $list_query = $wpdb->prepare($list_sql, $list_params); 92 $list = $wpdb->get_results($list_query, ARRAY_A); 93 94 $data = [$list,$row_count]; 95 96 $result = [ 97 'data' => $data, 98 ]; 99 100 str::e_json($result,1); 101 } 102 103 /* 43 104 public static function infility_get_data($postData){ 44 105 global $wpdb; … … 77 138 str::e_json($result,1); 78 139 } 140 */ 79 141 80 142 public static function plugin_swtich(){ -
infility-global/trunk/infility_global.php
r3458821 r3468303 4 4 Plugin URI: https://www.infility.cn/ 5 5 Description: Infility公共插件 6 Version: 2.14.5 36 Version: 2.14.54 7 7 Author: Infility 8 8 Author URI: https://www.infility.cn/ … … 141 141 v2.14.52 (20260203) Step: 修复 infility_get_data 接口的安全问题。 142 142 v2.14.53 (20260211) Ben: 新增elepost列表组件的当前分类post功能。 143 v2.14.54 (20260224) Ben: 新增获取cf7表单数据接口,废弃infility_get_data接口。 143 144 */ 144 145 … … 146 147 function __construct() 147 148 { 148 define( 'INFILITY_GLOBAL_VERSION', '2.14.5 3' );149 define( 'INFILITY_GLOBAL_VERSION', '2.14.54' ); 149 150 define( 'INFILITY_GLOBAL_PATH', plugin_dir_path( __FILE__ ) ); // fullpath/wp-content/plugins/infility-global/ // 有斜杠 150 151 define( 'INFILITY_GLOBAL_URL', plugins_url( '/', __FILE__ ) ); // https://the_domain/wp-content/plugins/infility-global/ // 斜杠是自己加的 … … 621 622 if ($p_do_action=='edit_power_by_html') { 622 623 action::check_power_by_html($_POST); 623 } else if ( $p_do_action === ' infility_get_data' ) {624 } else if ( $p_do_action === 'get_cf7_data' ) { 624 625 // 这个 action 权限太大(能获取任意表的任意数据),需要限制使用 625 626 $allowed_ips = [ "43.154.205.169" ]; … … 634 635 exit('{"ret":-1,"error":"Access Denied"}'); 635 636 } 636 action::infility_get_data($_POST); 637 // action::infility_get_data($_POST); 638 action::get_cf7_data($_POST); 637 639 }else{ 638 640 if (method_exists('action', $p_do_action)) {
Note: See TracChangeset
for help on using the changeset viewer.