HEX
Server: Apache/2.4.59 (Debian)
System: Linux keymana 4.19.0-21-cloud-amd64 #1 SMP Debian 4.19.249-2 (2022-06-30) x86_64
User: lijunjie (1003)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/doco/keytest/wp-content/themes/ormedia/keylabData/minutes/r_minutes.php
<?php
// if(isset($_REQUEST['checking_api_file'])){
//     exit();
// }

// $property_id = $_REQUEST['property_id'];
// $search = $_REQUEST['search'];

// $rv = new stdClass();

// $sql_statment = "select * from keylab_property_minutes";
// $where = " where ";

// if (!empty($property_id)){
//     $where = $where."property_id = ".$property_id." and ";
// }
// if(!empty($search)){
// 	$where = $where."type like '%".$search."%' and ";
// }

// $where = substr($where, 0, -5);

// if(strlen($where) > 5){
//     $sql_statment = $sql_statment.$where;
// }

// $result = $wpdb->get_results($sql_statment);
// $rv->list = $result;
// foreach ($rv->list as $item){
//     $item->minutes_file = unserialize($item->minutes_file) ?: [];
//     $item->agenda_file = unserialize($item->agenda_file) ?: [];
// }
// exit(json_encode($rv));
 

if(isset($_REQUEST['checking_api_file'])){
    exit();
}

$property_id = $_REQUEST['property_id'];
$search = $_REQUEST['search'];
$platform = $_REQUEST['platform'];


$sql_statment = "select * from keylab_property_minutes";
$where = " where ";

if (!empty($property_id)){
    $where = $where."property_id = ".$property_id." and ";
}
if(!empty($search)){
	$where = $where."type like '%".$search."%' and ";
}

$where = substr($where, 0, -5);

if(strlen($where) > 5){
    $sql_statment = $sql_statment.$where;
}
// if($platform=="app"){
// 	$sql_statment.=" order by meeting_date desc";
// }

$sql_statment = $sql_statment.' ORDER BY minutes_id DESC';

$result = $wpdb->get_results($sql_statment);

if($platform=="app"){
	$blocks = [];
	foreach($result as $r){
		array_push($blocks,$r->oc_term);
	}
	$blocks = array_unique($blocks);
	arsort($blocks);
	$list2 = [];
	foreach ($blocks as $value) {
		$obj = new stdClass();
		$obj->type = $value;
		$obj->list = [];
		foreach ($result as $r) {
			if($r->oc_term==$value){
				array_push($obj->list,$r);
			}
		}
		foreach ($obj->list as $item){
		    $item->minutes_file = unserialize($item->minutes_file) ?: [];
		    $item->agenda_file = unserialize($item->agenda_file) ?: [];
		}
		array_push($list2,$obj);
	}
	$rv->list = $list2;
}else{
	$rv->list = $result;
	foreach ($rv->list as $item){
	    $item->minutes_file = unserialize($item->minutes_file) ?: [];
	    $item->agenda_file = unserialize($item->agenda_file) ?: [];
	}
}

exit(json_encode($rv));
?>