17 $monLibrary= dirname(__FILE__) .
"/../library";
18 $monIncludes= dirname(__FILE__) .
"/../includes";
19 $sharedLibrary= dirname(__FILE__) .
"/../../shared/library";
20 require_once(
"$monLibrary/cu_top.i");
21 require_once(
"$monLibrary/ck_hticket.i");
22 require_once(
"$monIncludes/cu_remote_top.prg");
23 require_once(
"$sharedLibrary/cutrusted.i");
24 require_once(
"$sharedLibrary/hcuErrorReport.i");
26 $dms_ok = array(
'action'=>
'string',
'trustid'=>
'string',
'cu'=>
'string');
32 header(
'Content-Type: application/json');
58 $return = cutm_list($dbh, $parms);
62 if (is_array($return[
'data'])) {
63 foreach ($return[
'data'] as $key => $val) {
65 if (is_array($val[
'fields'])) {
66 foreach ($val[
'fields'] as $vk => $vv) {
68 $thisprop[] = array(
'vname' => $vk,
'vtype' => $vv[
'Type'],
'vdefault' => $vv[
'Default']);
73 'trustedid' => $val[
'trustedid'],
74 'trustedvendor' => $val[
'trustedvendor'],
75 'trustedtype' => $val[
'trustedtype'],
76 'trustedprops' => array_values($thisprop));
78 $return[
'data'][$key] = $thisun;
81 $aryResult=(is_array($return[
'data']) ? array_values($return[
'data']) :
'[]');
83 fwrite($fp, print_r($aryResult,
true));
93 case "read_masterprop":
97 $parms = array(
'trustedid' => $trustid);
98 $return = cutm_readdflt($dbh, $parms);
100 $aryResult = $return[
"master"];
108 $parms = array(
'trustedid' => $trustid);
109 $return = cutd_list($dbh, $parms);
111 $aryResult = array();
115 if (is_array($return[
'data'])) {
116 foreach ($return[
'data'] as $key => $val) {
118 if (is_array($val[
'fields'])) {
119 foreach ($val[
'fields'] as $vk =>$vv) {
120 $thisprop[]=array(
'propname'=>$vk,
'propval'=>$vv);
125 'trustedid' => $val[
'trustedid'],
126 'trustedprops'=> array_values($thisprop));
127 $return[
'data'][$key]=$thisun;
130 $aryResult=(is_array($return[
'data']) ? array_values($return[
'data']) :
'[]');
132 fwrite($fp, print_r($aryResult,
true));
137 case "read_clientprop":
141 $parms = array(
'Cu' => $cu,
'trustedid' => $trustid);
142 $return = cutd_read($dbh, $parms);
144 $aryResult = array();
145 foreach ($return[
'data'] as $key => $val) {
150 $aryErrors[] =
"Unexpected action: {$action}";
151 throw new Exception(json_encode($aryErrors));
157 $aryReply[
"homecuErrors"] = json_decode( $ex->getMessage() );
160 $aryResult = array();
166 if ( count( $aryInfo ) ) {
167 $aryReply[
"homecuInfo"] = $aryInfo;
170 if ($aryResult ==
'[]') {
171 $aryReply[
"homecuData"]=
null;
172 $aryReply[
"homecuCount"] = 0;
174 $aryReply[
"homecuData"] = $aryResult;
175 $aryReply[
"homecuCount"] = count($aryResult);
178 print json_encode($aryReply);