Odyssey
GenAPP.prg
1 <?php
2 /* GenAPP.prg
3  *
4  * History:
5  * 01/31/18 Converted to use cookie for UserKey. Removed some MDESK and ACCSOFT support.
6  * 05/10/18 Reactivate MDESK support for testing
7  * 10/25/2018 Move MDESK support into GenMDX as MDX interface is very different
8  * use GenMDX for MDesk testing
9  */
10  $serviceMinimal = true;
11  $serviceShowInfo = false;
12  $serviceLoadMenu = false;
13  $serviceShowMenu = false;
14 
15  // ** INCLUDE MAIN GLOBAL SCRIPT -- Handles security / global variable values
16  // hcuService will be returning a status object: e.g. ["homecuErrors":{[{"message":"message1"}...{"message":"messageN"}}]
17  require_once(dirname(__FILE__) . '/../library/hcuService.i');
18  require_once(dirname(__FILE__) . '/../library/hcuDispFunctions.i');
19  require_once(dirname(__FILE__) . '/../library/hcuAuthShared.i');
20  require_once('cutrusted.i');
21  setIncludeFiles(false,true,'bootstrap',true);
22 
23  // no dictionary
24  unset( $HB_ENV["MC"] );
25 
26  $inPost = array();
27  $varOk = array(
28  "APPID" => array('filter' => FILTER_SANITIZE_STRING),
29  "DTSTART" => array('filter' => FILTER_SANITIZE_STRING),
30  "DTEND" => array('filter' => FILTER_SANITIZE_STRING),
31  "CRED2" => array('filter' => FILTER_SANITIZE_STRING),
32  "CRED3" => array('filter' => FILTER_SANITIZE_STRING),
33  "USERID" => array('filter' => FILTER_SANITIZE_STRING),
34  "USERPASS" => array('filter' => FILTER_SANITIZE_STRING),
35  "USERKEY" => array('filter' => FILTER_SANITIZE_STRING),
36  "MFABUNDLE" => array('filter' => FILTER_SANITIZE_STRING),
37  "MFAKEY" => array('filter' => FILTER_SANITIZE_STRING),
38  "cu" => array('filter' => FILTER_SANITIZE_STRING),
39  "URLQstr" => array('filter' => FILTER_SANITIZE_STRING),
40  "URLPassWith" => array('filter' => FILTER_SANITIZE_STRING),
41  "generate" => array('filter' => FILTER_SANITIZE_STRING),
42  "msg" => array('filter' => FILTER_SANITIZE_STRING),
43  "WWWSvr" => array('filter' => FILTER_SANITIZE_STRING),
44  "RQMODE" => array('filter' => FILTER_SANITIZE_STRING),
45  "FACCTID" => array('filter' => FILTER_SANITIZE_STRING),
46  "TACCTID" => array('filter' => FILTER_SANITIZE_STRING),
47  "AMOUNT" => array('filter' => FILTER_SANITIZE_NUMBER_INT),
48  "TRMEMO" => array('filter' => FILTER_SANITIZE_STRING),
49  "PASSTO" => array('filter' => FILTER_SANITIZE_STRING),
50  "PASSWITH" => array('filter' => FILTER_SANITIZE_STRING),
51  "KEYACCTID" => array('filter' => FILTER_SANITIZE_STRING),
52  "CFGFLAG" => array('filter' => FILTER_SANITIZE_STRING),
53  "UPDAWARE" => array('filter' => FILTER_SANITIZE_NUMBER_INT),
54  'MFA_' => 'prefix_s'
55  );
56 # CFGFLAG is to be used to capture the session flag settings as used in Fmsg_tx on the desktop. Should be used
57 # currently in TXLIST / TXPOST to control whether or not to query the core for txaccount authority. Not implemented
58 # completely yet, but added to the Load_HB_ENV function and calls
59 
60 HCU_ImportVars( $inPost, "", $varOk );
61 
62 $msg=HCU_array_key_value('msg',$inPost);
63 $cu = HCU_array_key_value('cu',$inPost);
64  # look a little closer at that cu value --
65  # ctype_alnum ensures not empty / null, and contains only letters / digits
66  if (!ctype_alnum($cu)) {
67  $msg .= "Invalid Request CU";
68  }
69 
70 $USERID=HCU_array_key_value('USERID',$inPost);
71 $USERPASS=HCU_array_key_value('USERPASS',$inPost);
72 $USERKEY=urldecode(HCU_array_key_value('USERKEY',$inPost));
73 $MFAKEY=HCU_array_key_value('MFAKEY',$inPost);
74 $MFABUNDLE=HCU_array_key_value('MFABUNDLE',$inPost);
75 $APPID=HCU_array_key_value('APPID',$inPost);
76 $CRED2=HCU_array_key_value('CRED2',$inPost);
77 $CRED3=HCU_array_key_value('CRED3',$inPost);
78 $URLQstr=HCU_array_key_value('URLQstr',$inPost);
79 $URLPassWith=HCU_array_key_value('URLPassWith',$inPost);
80 $golink=HCU_array_key_value('golink',$inPost);
81 $show=HCU_array_key_value('show',$inPost);
82 $generate=HCU_array_key_value('generate',$inPost);
83 $WWWSvr=HCU_array_key_value('WWWSvr',$inPost);
84 $UPDAWARE=(HCU_array_key_exists('UPDAWARE',$inPost) ? HCU_array_key_value('UPDAWARE',$inPost) : 1);
85 
86 $CU = $cu;
87 //$HB_ENV["SYSENV"]["logger"]->info( "CRED2 {$inPost['$CRED2']} CRED3 {$inPost['CRED3']} USERKEY {$inPost['USERKEY']}" );
88 if (!empty($generate)) {
89  $msg = "";
90  if (empty($USERID) && empty($USERKEY)) {
91  $msg .= "Please enter User ID or User Key<br>\n";
92  }
93  switch ($APPID) {
94  case "OFXRQ":
95  # iPhone APP
96  $apptokenkey = 'Chahriv8pahvahsa';
97  $client_source_override = 'APP';
98  $appkey = "yuiQu8laLux7bahx";
99  break;
100 
101  case "OFXAA":
102  # Android APP
103  $apptokenkey = 'Chahriv8pahvahsa';
104  $client_source_override = 'ADA';
105  $appkey = "Gai7Vain2pab5zae";
106  break;
107 
108  case "ACCSOFT":
109  # 3rd Party inbound authentication for ElecTel Cooperative
110  $apptokenkey = 'Phoophohye4deiha';
111  $client_source_override = 'OVA';
112  $appkey = "AVoopaiSuTh8shie";
113 // $appkey = "Meireethahxee9op";
114  break;
115 
116  default:
117  $msg .= "Invalid App ID<br>\n";
118  }
119  if ($msg == '') {
120  # default DTSTART will be now minus 30 days
121  $dtstart = date("Y/m/d", time() - (30 * 24 * 3600));
122 
123  if ( empty($USERPASS) ) {
124  if ( empty( $USERKEY ) ) {
125  // need to add some things to HB_ENV
126  $userrec = GetUserbyName($dbh, $inPost['cu'], $USERID);
127 
128  $HB_ENV['Cu'] = $inPost['cu'];
129 
130  $HB_ENV['Uid'] = $userrec['user_id'];
131  $HB_ENV['Cn'] = $userrec['user_name'];
132  $HB_ENV['Ce'] = time() + $HB_ENV['SYSENV']['ticket']['expires'];
133  $HB_ENV["Clw"] = $userrec['livewait'];
134  $HB_ENV["Clu"] = (empty($userrec['lastupdate']) ? $MC->msg("Unknown") : urlencode(trim($userrec['lastupdate'])));
135  $HB_ENV["Cauth"] = trim($userrec['primary_account']);
136  $HB_ENV["Fplog"] = (empty($userrec['llog']) ? $MC->msg("None") : urlencode(trim($userrec['llog'])));
137  $HB_ENV["Fflog"] = (empty($userrec['flog']) ? $MC->msg("None") : urlencode(trim($userrec['flog'])));
138  $HB_ENV["Ffchg"] = (is_null($userrec['fchange']) ? 'N' : $userrec['fchange']);
139 
140  $HB_ENV['Ffremain'] = (is_null($userrec['fremain']) || $userrec['fremain'] == 0 ? $userrec['grace'] : $userrec['fremain']);
141  $HB_ENV['Fmsg_tx'] = $userrec['msg_tx'];
142  $HB_ENV['Fset'] = $userrec['flagset'];
143  $HB_ENV['Fset2'] = $userrec['flagset2'];
144  $HB_ENV['Fset3'] = $userrec['flagset3'];
145  $HB_ENV['Fhdays'] = $userrec['fhdays'];
146  $HB_ENV['Ml'] = $userrec['email'];
147  $HB_ENV['Ffreset'] = $userrec['freset'];
148 
149  // build a user key
150  $baseKey = BuildBaseSessionTicket( $HB_ENV );
151 
152  $now = time();
153  $newCtime = $now;
154  $newCe = $now + $HB_ENV['SYSENV']['ticket']['expires'];
155 
156  $newSet = "Ctime={$newCtime}&Ce={$newCe}";
157 
158  $USERKEY = urlencode( BuildSessionTicketStr($HB_ENV, $baseKey, $newSet ) );
159  } else {
160  $USERKEY = urlencode($USERKEY);
161  }
162  } else {
163  $USERCLAUSE = "&USERID=$USERID&USERPASS=$USERPASS";
164  }
165 
166  $MEMBER = $USERID;
167 /*
168  $show = "${APPID}${CU}:${MEMBER}${gmdate}<br>CRED3 : $CRED3<br>Key $appkey";
169 
170  # Challenge
171  $chall = "{$WWWSvr}?APPID=$APPID&ORG=$CU&USERID=$MEMBER&USERPASS=$USERPASS&CRED2=$gmdate&CRED3=$CRED3&DTSTART=$dtstart";
172  #$URLQstr="&MFA_E=samcu@jonbrinkerhoff.com&MFA_54=piper&MFA_64=piper&MFA_65=piper";
173  $txlist = "{$WWWSvr}?APPID=$APPID&ORG=$CU&USERKEY=$USERKEY&CRED2=$gmdate&CRED3=$CRED3&RQMODE=TXLIST&DTSTART=$dtstart";
174  $txpost = "{$WWWSvr}?APPID=$APPID&ORG=$CU&USERKEY=$USERKEY&CRED2=$gmdate&CRED3=$CRED3&RQMODE=TXPOST&DTSTART=$dtstart&FACCTID=D|6680|0|0&TACCTID=D|6680|10|0&AMOUNT=5.00";
175  $check = "{$WWWSvr}?APPID=$APPID&ORG=$CU&USERKEY=$USERKEY&CRED2=$gmdate&CRED3=$CRED3&RQMODE=PASSTHRU&DTSTART=$dtstart&PASSTO=CKIMAGE&PASSWITH=";
176  $ckitem = "SAMCU:5992:10:0:1722456";
177  $ckhash = sha1("SAMCU59921001722456cierto");
178  $ckitem = "SAMCU:5992:10:0:1774604";
179  $ckhash = "b91ea2426384ebddae81cef2f4ffe41e31791e78";
180  $check .= urlencode("CKITEM=$ckitem&CKHASH=$ckhash");
181 $checkurl = 'RQMODE=PASSTHRU&PASSTO=CKIMAGE';
182 $checkpasswith = "CKITEM=02104af3eb57e6677c720079e0af300c51b562ef8cce01c59894c8203b961248&CKHASH=1aeb12be1db583aeaae1cd91c42d36e3c4961fa1";
183 
184 
185  $notice = "https://www0.homecu.net/hcubin7/hcuAppFeed.prg?APPID=OFXRQ&ORG=$CU&USERKEY=$USERKEY&CRED2=$gmdate&CRED3=$CRED3&RQMODE=NOTICE&DTSTART=$dtstart&PASSWITH=" .
186  urlencode("NOTICE_ID=estatement&NOTICE_TYPE=N&NOTICE_ACTION=P");
187  #urlencode("NOTICE_TYPE=N&NOTICE_ACTION=V&NOTICE_ID=transfer");
188  #urlencode("NOTICE_TYPE=M&NOTICE_ACTION=V");
189  #urlencode("NOTICE_TYPE=S&NOTICE_ACTION=V");
190  #urlencode("NOTICE_ID=1588&NOTICE_TYPE=M&NOTICE_ACTION=P&ANS_1588=1");
191  #urlencode("NOTICE_ID=1594&NOTICE_TYPE=S&NOTICE_ACTION=P&ANS_1=1");
192 #
193  $golink = "{$WWWSvr}?APPID=$APPID&ORG=$CU&cu=$CU&$USERCLAUSE&CRED2=$gmdate&CRED3=$CRED3&DTSTART=$dtstart";
194 */
195  $golink = "{$WWWSvr}?APPID=$APPID&ORG=$CU&cu=$CU{$USERCLAUSE}&DTSTART=$dtstart";
196 // $URLQstr='MFA_E=test@test.com&MFA_57=wronganswer&UPDAWARE=1';
197  if (!empty($MFABUNDLE))
198  $golink .= "&MFABUNDLE=$MFABUNDLE";
199  if (!empty($CRED2))
200  $golink .= "&CRED2=$CRED2";
201  if (!empty($CRED3))
202  $golink .= "&CRED3=$CRED3";
203  if (!empty($MFAKEY))
204  $golink .= "&MFAKEY=$MFAKEY";
205  if (!empty($URLQstr))
206  $golink .= "&$URLQstr";
207  if (isset($UPDAWARE))
208  $golink .= "&UPDAWARE=$UPDAWARE";
209 
210  if (!empty($URLPassWith))
211  $golink .= "&PASSWITH=" . urlencode($URLPassWith);
212  }
213 /*
214  * This call does what I expected, but then the rest of the form is on the screen below. Need to fill in a new tab, or a div or something....
215  */
216 // Get_AppFeed($WWWSvr, $APPID, $CU, $USERCLAUSE, $gmdate, $CRED3, $dtstart, $URLQstr, $URLPassWith);
217 
218 }
219 //cu_header("Generate HomeCU APP Key");
220 //========================================
221 $WWWSvr = (empty($WWWSvr) ? "http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/hcuAppFeed.prg" : $WWWSvr);
222 
223 ?>
224 <!DOCTYPE html>
225 <html>
226  <head>
227  <title><?php echo hcu_displayHtml("App Simulator"); ?></title>
228  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
229  <meta name="robots" content="noindex,nofollow" />
230  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
231 
232  <meta name="viewport" content="width=device-width, initial-scale=1" />
233  </head>
234  <body>
235  <div class='container-fluid'>
236 <?php
237  if ( strlen( $msg ) > 0 ) {
238  print <<<EOP
239  <div class="well" style="color:darkred;">
240  $msg
241  </div>
242 EOP;
243  }
244 ?>
245  <div class='well well-sm col-xs-6' style="max-width:48%;">
246 
247  <h3>HomeCU APP Key Generator</h3>
248 
249  <form id='formAppKey' name='formAppKey' method="post" action="GenAPP.prg">
250  <fieldset>
251 
252  <div class="col-xs-12 hcu-container-margin">
253  <label for="APPID" class="col-xs-3">
254  APP ID:
255  </label>
256  <input id='APPID' name='APPID' class='col-xs-8' placeholder="Choose: OFXAA OFXRQ"
257  required data-required-msg="Choose: OFXAA OFXRQ" value="<?php echo "$APPID"; ?>" size="50"/>
258  </div>
259 
260  <div class="col-xs-12 hcu-container-margin">
261  <label for="cu" class="col-xs-3" >
262  ORG ID:
263  </label>
264  <input id='cu' name='cu' class='col-xs-8' placeholder="Upper Case CU Code"
265  required data-required-msg="The CU code" value="<?php echo "$cu"; ?>" size="50"/>
266  </div>
267 
268  <div class="col-xs-12 hcu-container-margin">
269  <label for="USERID" class="col-xs-3">
270  UserID:
271  </label>
272  <input id='USERID' name='USERID' class='col-xs-8' value="<?php echo "$USERID"; ?>" size="50"/>
273  </div>
274 
275  <div class="col-xs-12 hcu-container-margin">
276  <div class="col-xs-12" style='font-size:smaller; opacity=0.38; padding-bottom: 10px;'>
277  User Key is added to computed link; copy in latest
278  </div>
279  <label for="USERKEY" class="col-xs-3">
280  User Key:
281  </label>
282  <textarea id='USERKEY' name='USERKEY' class='col-xs-8' style="height: 5em;"><?php echo "$USERKEY"; ?></textarea>
283  </div>
284 
285  <div class="well col-xs-12 hcu-container-margin">
286  <div class="row">
287  <div class="col-xs-12" style='font-size:smaller; opacity=0.38; padding-bottom: 10px;'>Use if testing authentication process (supply Password, blank User Key, click Generate Link first)</div>
288  </div>
289  <div class="row">
290  <label for="USERPASS" class="col-xs-3">
291  Password:
292  </label>
293  <input id='USERPASS' name='USERPASS' type="password" class='col-xs-8' placeholder="Leave blank to populate User Key" value="<?php echo "$USERPASS"; ?>" size="50"/>
294  </div>
295  <div class="row">
296  <div class="col-xs-12">&nbsp;</div>
297  </div>
298  <div class="row">
299  <label for="MFAKEY" class="col-xs-3">
300  MFA Key:
301  </label>
302  <input id='MFAKEY' name='MFAKEY' class='col-xs-8' placeholder="" value="<?php echo "$MFAKEY"; ?>" size="50"/>
303  <div class="col-sm-offset-3 col-xs-8" style='font-size:smaller; opacity=0.38;'>This is the device key stored on phone; can use one returned by the server for subsequent calls.</div>
304  </div>
305  <div class="row">
306  <div class="col-xs-12">&nbsp;</div>
307  </div>
308  <div class="row">
309  <label for="MFABUNDLE" class="col-xs-3">
310  MFA Bundle:
311  </label>
312  <input id='MFABUNDLE' name='MFABUNDLE' class='col-xs-8' placeholder="Copy latest MFA Bundle into here" value="<?php echo "$MFABUNDLE"; ?>" size="50"/>
313  </div>
314  </div>
315 
316  <div class="well col-xs-12 hcu-container-margin">
317  <div class="row">
318  <div class="col-xs-12" style='font-size:smaller; opacity=0.38; padding-bottom: 10px;'>Passed with RQMODE or any other parameters, and PASSWITH values as needed</div>
319  </div>
320  <div class="row">
321  <label for="URLQstr" class="col-xs-3">
322  Query String:
323  </label>
324  <input id='URLQstr' name='URLQstr' class='col-xs-8' value="<?php echo "$URLQstr"; ?>" size="50"/>
325  </div>
326  <div class="row">
327  <div class="col-xs-12">&nbsp;</div>
328  </div>
329  <div class="row">
330  <label for="URLPassWith" class="col-xs-3">
331  Pass With:
332  </label>
333  <input id='URLPassWith' name='URLPassWith' class='col-xs-8' value="<?php echo "$URLPassWith"; ?>" size="50"/>
334  </div>
335  </div>
336 
337  <div class="col-xs-12 hcu-container-margin">
338  <label for="WWWSvr" class="col-xs-3">
339  Host Path:
340  </label>
341  <input id='WWWSvr' name='WWWSvr' class='col-xs-8' value="<?php echo "$WWWSvr"; ?>" size="50"/>
342  </div>
343 
344 
345  <div class="col-xs-12 hcu-container-margin">
346  <div class="col-xs-6">
347  <button id="generate" name='btnGenerate' type="submit" class="k-button k-primary hcu-all-100 hcu-xs-btn-margin-top hcu-xs-btn-pad">
348  <span class="fa fa-arrow-right local-pad-icon"></span>
349  Generate Link
350  </button>
351  </div>
352  <div class="col-xs-6">
353  <button id="getData" name='getData' type="button" class="k-button hcu-all-100 hcu-xs-btn-margin-top hcu-xs-btn-pad">
354  <span class="fa fa-arrow-right local-pad-icon"></span>
355  Get Data
356  </button>
357  </div>
358  <input type="hidden" name="generate" value="go">
359  </div>
360  </fieldset>
361  </form>
362  </div>
363  <div class='well well-sm col-xs-6' style="max-width:48%; margin-left:10px;">
364  <div class="col-xs-12 hcu-container-margin">
365  Computed link (sent when 'Get Data' clicked)
366  <textarea id='targetLink' name='targetLink' class='col-xs-12' style="height: 10em;">
367 <?php echo "$golink"; ?>
368  </textarea>
369  </div>
370  <div class="col-xs-12 hcu-container-margin">
371  Result
372  <textarea id="getDataResult" name="getDataResult" class="col-xs-12" style="height: 27em;">
373  </textarea>
374  </div>
375  </div>
376  <div class='col-xs-12'>
377  <div class="well">
378  How to use:<br>
379  <ol>
380  <li>Enter App ID, Org ID, User ID. Leave User Key blank to get generated key.</li>
381  <li>Click Generate Key. This generates a User Key to start communications.</li>
382  <li>If testing authentication process, enter password matching the User ID; optionally can enter MFA Key or Query String fields as needed. Copy MFA bundle from replies.</li>
383  <li>Click Get Data. Copy the returned &lt;userkey&gt; contents into User Key as needed.</li>
384  <li>Add Query String and Pass With (as needed). Click Generate Key to re-build the link.</li>
385  <li>Can edit Computed Link directly, if desired, and then click Get Data.</li>
386  </ol>
387  (Clicking Get Data will send AJAX call with computed link and User Key).<br>
388  </div>
389  <div class="well">
390  Possible Query String choices for RQMODE (feature requests):<br>
391  <ul>
392  <li>GETALERTS</li>
393  <li>NOTICE (PASSWITH has notice response)</li>
394  <li>MEMBERSETTINGS (PASSWITH has GETALLOWED=1, GETSETTINGS=1(password)|2(email)|4(challenge)|8(useralias)|16(phone))</li>
395  <li>RDCMOBILE</li>
396  <li>ESTMT</li>
397  <li>ESTMT_PDF</li>
398  <li>MESSAGE</li>
399  <li>TXLIST</li>
400  <li>TXPOST</li>
401  <li>PASSTHRU</li>
402  <li>MOBILEPAY</li>
403  <li>UPDCRED (PASSWITH: ASKLATER=1, EMAIL=<email addr>&OPTIN=Y|N&PHONE=<num1>|<num2>&CONFWORD=<words>&CQID_1=<id>&CQANS_1=<encoded resp>)</li>
404  <li>CHECKALIAS</li>
405  </ul>
406  Possible Query String choices for AUTHMODE (MFA process):
407  <ul>
408  <li>AUTHMODE=EML|MFQ|MFS|MFC|MFP
409  <ul>
410  <li>EML PassWith: MFA_E=email address</li>
411  <li>MFQ PassWith: id=answer (repeated if multiple)</li>
412  <li>MFS PassWith: MFS_Deliver=access code delivery location id</li>
413  <li>MFC PassWith: MFS_Auth=secure access code</li>
414  <li>MFP PassWith: (none, uses UserID and Password)</li>
415  </ul>
416  </li>
417  </ul>
418  </div>
419 </div>
420 </body>
421 </html>
422 
423 <!--============================================-->
424 <?php
425 // <td bgcolor="#CCCCFF">&nbsp;</td>
426 // <td class='hdr'>Enter User ID and MODE below and click generate key:</td>
427 //
428 // if (trim($msg) > "") {
429 // print <<<EOF
430 // <td class='ahd'>$msg:</td>
431 // </tr>
432 //EOF;
433 //}
434 // <input type="hidden" name="generate" value="go">
435 // <p align="center">
436 //$golink<BR><BR>$show
437 // </p></td>
438 // <td class='dtl'><br> <form name="form2" method="post" action="$golink">
439 // </td></tr>
440 // <tr>
441 // <td class='dtl' align='center'><p>
442 // <input type="submit" name="submit" value="Submit Link">
443 //EOF;
444 //
445 
446 function Get_AppFeed($WWWSvr, $APPID, $CU, $USERCLAUSE, $CRED2, $CRED3, $DTSTART, $URLQstr, $URLPassWith) {
447 
448  $req = "APPID=$APPID&ORG=$CU&cu=$CU&$USERCLAUSE&CRED2=$CRED2&CRED3=$CRED3&DTSTART=$DTSTART";
449 
450  if (!empty($URLQstr))
451  $req .= "&$URLQstr";
452  if (!empty($URLPassWith))
453  $req .= "&PASSWITH=" . urlencode($URLPassWith);
454 
455  $cmd = "/usr/bin/curl --request POST --url '{$WWWSvr}?{$req}'";
456 
457  $curlopts = array(
458  CURLOPT_RETURNTRANSFER => 1,
459  CURLOPT_POST => 1,
460  CURLOPT_HEADER => false,
461  CURLOPT_POST => 1,
462  CURLOPT_POSTFIELDS => $req,
463  CURLOPT_URL => "$WWWSvr");
464 
465  $response = "";
466  $ch = curl_init();
467 //curl_setopt($ch, CURLOPT_VERBOSE, true);
468 //$verbose = fopen('/home/scrubcu/tmp/curltrace', 'a+');
469 //curl_setopt($ch, CURLOPT_STDERR, $verbose);
470  if ($ch) {
471  curl_setopt_array($ch, $curlopts);
472  $response = curl_exec($ch);
473  $cerrno = curl_errno($ch);
474  $cerr = curl_error($ch);
475  $HTTPerr = curl_getinfo($ch, CURLINFO_HTTP_CODE);
476  curl_close($ch);
477  }
478 // if ($parms["logging"] == "enabled") {
479 // $logParms = $parms["environment"]; // get the environment info passed in
480 // $logParms["token"] = ''; // the id used across all communications in session
481 // $logParms["txnId"] = time(); // the id for this transaction
482 // $logParms["logPoint"] = "GenAPP"; // this action in a readable form
483 // $logParms["request"] = $cmd; // the request
484 // $logParms["reply"] = $response; // the response
485 // LogSSOActivity($logParms);
486 // }
487 
488 # check for fault & throw error
489  if ($cerr) {
490  print "Connection Error $cerrno $cerr<br>";
491  print "$cmd<br>" . print_r($curlopts);
492  } elseif (empty($response) ) {
493  print "Empty Response<br>";
494  if($HTTPerr >=400) {
495  print "HTTP Error $HTTPerr<br>";
496  }
497  } else {
498 
499 
500 $dom = new DOMDocument();
501 
502 // Initial block (must before load xml string)
503 $dom->preserveWhiteSpace = false;
504 $dom->formatOutput = true;
505 // End initial block
506 
507 $dom->loadXML($response);
508 $out = $dom->saveXML();
509 print "<pre>" . htmlentities($out) . "</pre>";
510  }
511 }
512 
513 function Format_AppFeed($data) {
514 
515 
516 
517  $dom = new DOMDocument();
518 
519  $dom->preserveWhiteSpace = false;
520  $dom->formatOutput = true;
521 
522  $dom->loadXML($data);
523  $out = $dom->saveXML();
524  return ($out);
525 }
526 
527 ?>
528 <script>
529  $("#generate").click( function() {
530  var org = $("#cu").val();
531  var action = $("#formAppKey").attr( "action" );
532 
533  $("#formAppKey").attr("action", action + "?cu=" + org );
534 
535  });
536  $('#getData').click(function () {
537  var targetLink = $('#targetLink').text().trim();
538  var userkey = $('#USERKEY').text().trim();
539 
540  if ( userkey.indexOf( "&" ) > -1 ) {
541  userkey = encodeURIComponent( userkey );
542  }
543 
544  var whatToSend = targetLink + "&USERKEY=" + userkey;
545 
546  // disable the button
547  $(this).prop("disabled", "disabled");
548  $("#getDataResult").html("");
549  $("#getDataResult").css("display", "inline");
550 
551  // start AJAX
552  $.ajax({
553  url: whatToSend,
554  type: "post",
555  datatype: "html"
556  })
557  .done(function (data, textStatus, jqXHR) {
558  // Show the result
559 
560  var pretty =
561  $("#getDataResult").html( data );
562  $("#getDataResult").show();
563 
564  })
565  .fail(function (jqXHR, textStatus, errorThrown) {
566  $("#getDataResult").html("<?php echo $MC->msg("Error", HCU_DISPLAY_AS_HTML); ?>");
567  $("#getDataResult").css("color", "red");
568  })
569  .always(function (jqXHR, textStatus, errorThrown) {
570  $("#getData").removeProp("disabled");
571  $("#getDataResult").show();
572  });
573 
574  });
575 </script>
576 <style>
577 
578 html {
579  overflow: auto;
580 }
581 ol, ul {
582  padding-left: 20px;
583 }
584 .local-transfer-msg {
585  padding: 1em;
586 }
587 
588 .local-transfer-button {
589  padding-top: 20px;
590 }
591 
592 
593 .k-dropdown .k-input,.k-selectbox .k-input {
594  white-space: normal;
595 }
596 
597  .container-fluid-margin {
598  margin: 15px;
599  }
600 
601  .k-block > .k-header {
602  white-space: normal;
603  height: 100%;
604  }
605 
606  .hcu-info-margin, .hcu-error-margin {
607  margin: 15px 0;
608  }
609 
610  .hcu-info-padding, .hcu-error-padding {
611  padding: 15px;
612  }
613 
614  .hcu-all-100 {
615  width: 100%;
616  }
617  /* top-bottom margin */
618  .hcu-container-margin {
619  margin: 15px 0;
620  }
621  .local-pad-icon {
622  padding-right: 5px;
623  }
624 
625 </style>
626 
Definition: User.php:7